@rspack-canary/core 1.6.0-canary-17d2172b-20251016033144 → 1.6.0-canary-c1ffd5c5-20251016085846

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.
package/dist/index.js CHANGED
@@ -279,7 +279,7 @@ __webpack_require__.n = (module1)=>{
279
279
  };
280
280
  var __webpack_exports__ = {};
281
281
  for(var __webpack_i__ in (()=>{
282
- let createMd4, createXxhash64, service_pool, loadLoader_url, _Err, _Err1;
282
+ let createMd4, createXxhash64, service_pool, loadLoader_url, _Err, _Err1, _Err2, _Err3, _Err4, _Err5, _Err6, _Err7, Sizable, Nouns;
283
283
  __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
284
284
  CopyRspackPlugin: ()=>CopyRspackPlugin,
285
285
  RuntimePlugin: ()=>RuntimePlugin,
@@ -351,7 +351,7 @@ for(var __webpack_i__ in (()=>{
351
351
  wasm: ()=>exports_wasm,
352
352
  version: ()=>exports_version
353
353
  });
354
- var StatsErrorCode, _computedKey, _computedKey1, _computedKey2, ArrayQueue_computedKey, browserslistTargetHandler_namespaceObject = {};
354
+ var StatsErrorCode, _computedKey, _computedKey1, _computedKey2, compat_ZodFirstPartyTypeKind, ArrayQueue_computedKey, browserslistTargetHandler_namespaceObject = {};
355
355
  __webpack_require__.r(browserslistTargetHandler_namespaceObject), __webpack_require__.d(browserslistTargetHandler_namespaceObject, {
356
356
  resolve: ()=>browserslistTargetHandler_resolve
357
357
  });
@@ -4223,16 +4223,18 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4223
4223
  super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
4224
4224
  }
4225
4225
  }
4226
+ class $ZodEncodeError extends Error {
4227
+ constructor(name){
4228
+ super(`Encountered unidirectional transform during encode: ${name}`), this.name = "ZodEncodeError";
4229
+ }
4230
+ }
4226
4231
  let globalConfig = {};
4227
4232
  function core_config(newConfig) {
4228
4233
  return newConfig && Object.assign(globalConfig, newConfig), globalConfig;
4229
4234
  }
4230
- let cuid = /^[cC][^\s-]{8,}$/, cuid2 = /^[0-9a-z]+$/, ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, xid = /^[0-9a-vA-V]{20}$/, ksuid = /^[A-Za-z0-9]{27}$/, nanoid = /^[a-zA-Z0-9_-]{21}$/, duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, regexes_uuid = (version)=>version ? RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/, email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, ipv4 = /^(?:(?: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])$/, ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/, cidrv4 = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/, cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, regexes_base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, base64url = /^[A-Za-z0-9_-]*$/, hostname = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/, e164 = /^\+(?:[0-9]){6,14}[0-9]$/, dateSource = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))", regexes_date = RegExp(`^${dateSource}$`);
4231
- function timeSource(args) {
4232
- let hhmm = "(?:[01]\\d|2[0-3]):[0-5]\\d";
4233
- return "number" == typeof args.precision ? -1 === args.precision ? `${hhmm}` : 0 === args.precision ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
4235
+ function joinValues(array, separator = "|") {
4236
+ return array.map((val)=>stringifyPrimitive(val)).join(separator);
4234
4237
  }
4235
- let integer = /^\d+$/, number = /^-?\d+(?:\.\d+)?/i, regexes_boolean = /true|false/i, _null = /null/i, _undefined = /undefined/i, lowercase = /^[^A-Z]*$/, uppercase = /^[^a-z]*$/;
4236
4238
  function jsonStringifyReplacer(_, value) {
4237
4239
  return "bigint" == typeof value ? value.toString() : value;
4238
4240
  }
@@ -4252,13 +4254,12 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4252
4254
  let start = +!!source.startsWith("^"), end = source.endsWith("$") ? source.length - 1 : source.length;
4253
4255
  return source.slice(start, end);
4254
4256
  }
4257
+ let EVALUATING = Symbol("evaluating");
4255
4258
  function defineLazy(object, key, getter) {
4259
+ let value;
4256
4260
  Object.defineProperty(object, key, {
4257
4261
  get () {
4258
- {
4259
- let value = getter();
4260
- return object[key] = value, value;
4261
- }
4262
+ if (value !== EVALUATING) return void 0 === value && (value = EVALUATING, value = getter()), value;
4262
4263
  },
4263
4264
  set (v) {
4264
4265
  Object.defineProperty(object, key, {
@@ -4276,10 +4277,15 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4276
4277
  configurable: !0
4277
4278
  });
4278
4279
  }
4280
+ function mergeDefs(...defs) {
4281
+ let mergedDescriptors = {};
4282
+ for (let def of defs)Object.assign(mergedDescriptors, Object.getOwnPropertyDescriptors(def));
4283
+ return Object.defineProperties({}, mergedDescriptors);
4284
+ }
4279
4285
  function esc(str) {
4280
4286
  return JSON.stringify(str);
4281
4287
  }
4282
- let captureStackTrace = Error.captureStackTrace ? Error.captureStackTrace : (..._args)=>{};
4288
+ let captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args)=>{};
4283
4289
  function util_isObject(data) {
4284
4290
  return "object" == typeof data && null !== data && !Array.isArray(data);
4285
4291
  }
@@ -4298,6 +4304,13 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4298
4304
  let prot = ctor.prototype;
4299
4305
  return !1 !== util_isObject(prot) && !1 !== Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf");
4300
4306
  }
4307
+ function shallowClone(o) {
4308
+ return isPlainObject(o) ? {
4309
+ ...o
4310
+ } : Array.isArray(o) ? [
4311
+ ...o
4312
+ ] : o;
4313
+ }
4301
4314
  let propertyKeyTypes = new Set([
4302
4315
  "string",
4303
4316
  "number",
@@ -4324,6 +4337,9 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4324
4337
  error: ()=>_params.error
4325
4338
  } : _params;
4326
4339
  }
4340
+ function stringifyPrimitive(value) {
4341
+ return "bigint" == typeof value ? value.toString() + "n" : "string" == typeof value ? `"${value}"` : `${value}`;
4342
+ }
4327
4343
  let NUMBER_FORMAT_RANGES = {
4328
4344
  safeint: [
4329
4345
  Number.MIN_SAFE_INTEGER,
@@ -4347,6 +4363,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4347
4363
  ]
4348
4364
  };
4349
4365
  function aborted(x, startIndex = 0) {
4366
+ if (!0 === x.aborted) return !0;
4350
4367
  for(let i = startIndex; i < x.issues.length; i++)if (x.issues[i]?.continue !== !0) return !0;
4351
4368
  return !1;
4352
4369
  }
@@ -4377,7 +4394,88 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4377
4394
  ...iss
4378
4395
  };
4379
4396
  }
4380
- let $ZodCheck = $constructor("$ZodCheck", (inst, def)=>{
4397
+ let errors_initializer = (inst, def)=>{
4398
+ inst.name = "$ZodError", Object.defineProperty(inst, "_zod", {
4399
+ value: inst._zod,
4400
+ enumerable: !1
4401
+ }), Object.defineProperty(inst, "issues", {
4402
+ value: def,
4403
+ enumerable: !1
4404
+ }), inst.message = JSON.stringify(def, jsonStringifyReplacer, 2), Object.defineProperty(inst, "toString", {
4405
+ value: ()=>inst.message,
4406
+ enumerable: !1
4407
+ });
4408
+ }, $ZodError = $constructor("$ZodError", errors_initializer), $ZodRealError = $constructor("$ZodError", errors_initializer, {
4409
+ Parent: Error
4410
+ }), _parse = (_Err)=>(schema, value, _ctx, _params)=>{
4411
+ let ctx = _ctx ? Object.assign(_ctx, {
4412
+ async: !1
4413
+ }) : {
4414
+ async: !1
4415
+ }, result = schema._zod.run({
4416
+ value,
4417
+ issues: []
4418
+ }, ctx);
4419
+ if (result instanceof Promise) throw new $ZodAsyncError();
4420
+ if (result.issues.length) {
4421
+ let e = new (_params?.Err ?? _Err)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())));
4422
+ throw captureStackTrace(e, _params?.callee), e;
4423
+ }
4424
+ return result.value;
4425
+ }, _parseAsync = (_Err)=>async (schema, value, _ctx, params)=>{
4426
+ let ctx = _ctx ? Object.assign(_ctx, {
4427
+ async: !0
4428
+ }) : {
4429
+ async: !0
4430
+ }, result = schema._zod.run({
4431
+ value,
4432
+ issues: []
4433
+ }, ctx);
4434
+ if (result instanceof Promise && (result = await result), result.issues.length) {
4435
+ let e = new (params?.Err ?? _Err)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())));
4436
+ throw captureStackTrace(e, params?.callee), e;
4437
+ }
4438
+ return result.value;
4439
+ }, _safeParse = (_Err)=>(schema, value, _ctx)=>{
4440
+ let ctx = _ctx ? {
4441
+ ..._ctx,
4442
+ async: !1
4443
+ } : {
4444
+ async: !1
4445
+ }, result = schema._zod.run({
4446
+ value,
4447
+ issues: []
4448
+ }, ctx);
4449
+ if (result instanceof Promise) throw new $ZodAsyncError();
4450
+ return result.issues.length ? {
4451
+ success: !1,
4452
+ error: new (_Err ?? $ZodError)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
4453
+ } : {
4454
+ success: !0,
4455
+ data: result.value
4456
+ };
4457
+ }, safeParse = _safeParse($ZodRealError), _safeParseAsync = (_Err)=>async (schema, value, _ctx)=>{
4458
+ let ctx = _ctx ? Object.assign(_ctx, {
4459
+ async: !0
4460
+ }) : {
4461
+ async: !0
4462
+ }, result = schema._zod.run({
4463
+ value,
4464
+ issues: []
4465
+ }, ctx);
4466
+ return result instanceof Promise && (result = await result), result.issues.length ? {
4467
+ success: !1,
4468
+ error: new _Err(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
4469
+ } : {
4470
+ success: !0,
4471
+ data: result.value
4472
+ };
4473
+ }, safeParseAsync = _safeParseAsync($ZodRealError), cuid = /^[cC][^\s-]{8,}$/, cuid2 = /^[0-9a-z]+$/, ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, xid = /^[0-9a-vA-V]{20}$/, ksuid = /^[A-Za-z0-9]{27}$/, nanoid = /^[a-zA-Z0-9_-]{21}$/, duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, regexes_uuid = (version)=>version ? RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, ipv4 = /^(?:(?: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])$/, ipv6 = /^(([0-9a-fA-F]{1,4}:){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}|:))$/, cidrv4 = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/, cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, regexes_base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, regexes_base64url = /^[A-Za-z0-9_-]*$/, hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/, e164 = /^\+(?:[0-9]){6,14}[0-9]$/, dateSource = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))", regexes_date = RegExp(`^${dateSource}$`);
4474
+ function timeSource(args) {
4475
+ let hhmm = "(?:[01]\\d|2[0-3]):[0-5]\\d";
4476
+ return "number" == typeof args.precision ? -1 === args.precision ? `${hhmm}` : 0 === args.precision ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
4477
+ }
4478
+ let integer = /^-?\d+$/, regexes_number = /^-?\d+(?:\.\d+)?/, regexes_boolean = /^(?:true|false)$/i, _null = /^null$/i, _undefined = /^undefined$/i, lowercase = /^[^A-Z]*$/, uppercase = /^[^a-z]*$/, $ZodCheck = $constructor("$ZodCheck", (inst, def)=>{
4381
4479
  var _a;
4382
4480
  inst._zod ?? (inst._zod = {}), inst._zod.def = def, (_a = inst._zod).onattach ?? (_a.onattach = []);
4383
4481
  }), numericOriginMap = {
@@ -4423,10 +4521,16 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4423
4521
  var _a;
4424
4522
  (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
4425
4523
  }), inst._zod.check = (payload)=>{
4426
- var val, step;
4427
- let valDecCount, stepDecCount, decCount, valInt;
4428
4524
  if (typeof payload.value != typeof def.value) throw Error("Cannot mix number and bigint in multiple_of check.");
4429
- ("bigint" == typeof payload.value ? payload.value % def.value === BigInt(0) : 0 == (val = payload.value, step = def.value, valDecCount = (val.toString().split(".")[1] || "").length, stepDecCount = (step.toString().split(".")[1] || "").length, decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount, (valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""))) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount)) || payload.issues.push({
4525
+ ("bigint" == typeof payload.value ? payload.value % def.value === BigInt(0) : 0 === function(val, step) {
4526
+ let valDecCount = (val.toString().split(".")[1] || "").length, stepString = step.toString(), stepDecCount = (stepString.split(".")[1] || "").length;
4527
+ if (0 === stepDecCount && /\d?e-\d?/.test(stepString)) {
4528
+ let match = stepString.match(/\d?e-(\d?)/);
4529
+ match?.[1] && (stepDecCount = Number.parseInt(match[1]));
4530
+ }
4531
+ let decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount, valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
4532
+ return valInt % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
4533
+ }(payload.value, def.value)) || payload.issues.push({
4430
4534
  origin: typeof payload.value,
4431
4535
  code: "not_multiple_of",
4432
4536
  divisor: def.value,
@@ -4448,6 +4552,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4448
4552
  expected: origin,
4449
4553
  format: def.format,
4450
4554
  code: "invalid_type",
4555
+ continue: !1,
4451
4556
  input,
4452
4557
  inst
4453
4558
  });
@@ -4675,60 +4780,10 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4675
4780
  ].join("\n"));
4676
4781
  }
4677
4782
  }
4678
- let errors_initializer = (inst, def)=>{
4679
- inst.name = "$ZodError", Object.defineProperty(inst, "_zod", {
4680
- value: inst._zod,
4681
- enumerable: !1
4682
- }), Object.defineProperty(inst, "issues", {
4683
- value: def,
4684
- enumerable: !1
4685
- }), Object.defineProperty(inst, "message", {
4686
- get: ()=>JSON.stringify(def, jsonStringifyReplacer, 2),
4687
- enumerable: !0
4688
- }), Object.defineProperty(inst, "toString", {
4689
- value: ()=>inst.message,
4690
- enumerable: !1
4691
- });
4692
- }, $ZodError = $constructor("$ZodError", errors_initializer), $ZodRealError = $constructor("$ZodError", errors_initializer, {
4693
- Parent: Error
4694
- }), _safeParse = (_Err)=>(schema, value, _ctx)=>{
4695
- let ctx = _ctx ? {
4696
- ..._ctx,
4697
- async: !1
4698
- } : {
4699
- async: !1
4700
- }, result = schema._zod.run({
4701
- value,
4702
- issues: []
4703
- }, ctx);
4704
- if (result instanceof Promise) throw new $ZodAsyncError();
4705
- return result.issues.length ? {
4706
- success: !1,
4707
- error: new (_Err ?? $ZodError)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
4708
- } : {
4709
- success: !0,
4710
- data: result.value
4711
- };
4712
- }, safeParse = _safeParse($ZodRealError), _safeParseAsync = (_Err)=>async (schema, value, _ctx)=>{
4713
- let ctx = _ctx ? Object.assign(_ctx, {
4714
- async: !0
4715
- }) : {
4716
- async: !0
4717
- }, result = schema._zod.run({
4718
- value,
4719
- issues: []
4720
- }, ctx);
4721
- return result instanceof Promise && (result = await result), result.issues.length ? {
4722
- success: !1,
4723
- error: new _Err(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
4724
- } : {
4725
- success: !0,
4726
- data: result.value
4727
- };
4728
- }, safeParseAsync = _safeParseAsync($ZodRealError), versions_version = {
4783
+ let versions_version = {
4729
4784
  major: 4,
4730
- minor: 0,
4731
- patch: 0
4785
+ minor: 1,
4786
+ patch: 12
4732
4787
  }, $ZodType = $constructor("$ZodType", (inst, def)=>{
4733
4788
  var _a;
4734
4789
  inst ?? (inst = {}), inst._zod.def = def, inst._zod.bag = inst._zod.bag || {}, inst._zod.version = versions_version;
@@ -4757,8 +4812,27 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4757
4812
  }
4758
4813
  }
4759
4814
  return asyncResult ? asyncResult.then(()=>payload) : payload;
4815
+ }, handleCanaryResult = (canary, payload, ctx)=>{
4816
+ if (aborted(canary)) return canary.aborted = !0, canary;
4817
+ let checkResult = runChecks(payload, checks, ctx);
4818
+ if (checkResult instanceof Promise) {
4819
+ if (!1 === ctx.async) throw new $ZodAsyncError();
4820
+ return checkResult.then((checkResult)=>inst._zod.parse(checkResult, ctx));
4821
+ }
4822
+ return inst._zod.parse(checkResult, ctx);
4760
4823
  };
4761
4824
  inst._zod.run = (payload, ctx)=>{
4825
+ if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
4826
+ if ("backward" === ctx.direction) {
4827
+ let canary = inst._zod.parse({
4828
+ value: payload.value,
4829
+ issues: []
4830
+ }, {
4831
+ ...ctx,
4832
+ skipChecks: !0
4833
+ });
4834
+ return canary instanceof Promise ? canary.then((canary)=>handleCanaryResult(canary, payload, ctx)) : handleCanaryResult(canary, payload, ctx);
4835
+ }
4762
4836
  let result = inst._zod.parse(payload, ctx);
4763
4837
  if (result instanceof Promise) {
4764
4838
  if (!1 === ctx.async) throw new $ZodAsyncError();
@@ -4828,7 +4902,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4828
4902
  }), $ZodURL = $constructor("$ZodURL", (inst, def)=>{
4829
4903
  $ZodStringFormat.init(inst, def), inst._zod.check = (payload)=>{
4830
4904
  try {
4831
- let orig = payload.value, url = new URL(orig), href = url.href;
4905
+ let trimmed = payload.value.trim(), url = new URL(trimmed);
4832
4906
  def.hostname && (def.hostname.lastIndex = 0, def.hostname.test(url.hostname) || payload.issues.push({
4833
4907
  code: "invalid_format",
4834
4908
  format: "url",
@@ -4845,7 +4919,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4845
4919
  input: payload.value,
4846
4920
  inst,
4847
4921
  continue: !def.abort
4848
- })), !orig.endsWith("/") && href.endsWith("/") ? payload.value = href.slice(0, -1) : payload.value = href;
4922
+ })), def.normalize ? payload.value = url.href : payload.value = trimmed;
4849
4923
  return;
4850
4924
  } catch (_) {
4851
4925
  payload.issues.push({
@@ -4878,7 +4952,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4878
4952
  precision: (args = def).precision
4879
4953
  }), opts = [
4880
4954
  "Z"
4881
- ], args.local && opts.push(""), args.offset && opts.push("([+-]\\d{2}:\\d{2})"), timeRegex = `${time}(?:${opts.join("|")})`, def.pattern = RegExp(`^${dateSource}T(?:${timeRegex})$`)), $ZodStringFormat.init(inst, def);
4955
+ ], args.local && opts.push(""), args.offset && opts.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"), timeRegex = `${time}(?:${opts.join("|")})`, def.pattern = RegExp(`^${dateSource}T(?:${timeRegex})$`)), $ZodStringFormat.init(inst, def);
4882
4956
  }), $ZodISODate = $constructor("$ZodISODate", (inst, def)=>{
4883
4957
  def.pattern ?? (def.pattern = regexes_date), $ZodStringFormat.init(inst, def);
4884
4958
  }), $ZodISOTime = $constructor("$ZodISOTime", (inst, def)=>{
@@ -4910,8 +4984,10 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4910
4984
  def.pattern ?? (def.pattern = cidrv4), $ZodStringFormat.init(inst, def);
4911
4985
  }), $ZodCIDRv6 = $constructor("$ZodCIDRv6", (inst, def)=>{
4912
4986
  def.pattern ?? (def.pattern = cidrv6), $ZodStringFormat.init(inst, def), inst._zod.check = (payload)=>{
4913
- let [address, prefix] = payload.value.split("/");
4987
+ let parts = payload.value.split("/");
4914
4988
  try {
4989
+ if (2 !== parts.length) throw Error();
4990
+ let [address, prefix] = parts;
4915
4991
  if (!prefix) throw Error();
4916
4992
  let prefixNum = Number(prefix);
4917
4993
  if (`${prefixNum}` !== prefix || prefixNum < 0 || prefixNum > 128) throw Error();
@@ -4949,11 +5025,11 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4949
5025
  });
4950
5026
  };
4951
5027
  }), $ZodBase64URL = $constructor("$ZodBase64URL", (inst, def)=>{
4952
- def.pattern ?? (def.pattern = base64url), $ZodStringFormat.init(inst, def), inst._zod.onattach.push((inst)=>{
5028
+ def.pattern ?? (def.pattern = regexes_base64url), $ZodStringFormat.init(inst, def), inst._zod.onattach.push((inst)=>{
4953
5029
  inst._zod.bag.contentEncoding = "base64url";
4954
5030
  }), inst._zod.check = (payload)=>{
4955
5031
  !function(data) {
4956
- if (!base64url.test(data)) return !1;
5032
+ if (!regexes_base64url.test(data)) return !1;
4957
5033
  let base64 = data.replace(/[-_]/g, (c)=>"-" === c ? "+" : "/");
4958
5034
  return isValidBase64(base64.padEnd(4 * Math.ceil(base64.length / 4), "="));
4959
5035
  }(payload.value) && payload.issues.push({
@@ -4989,7 +5065,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4989
5065
  });
4990
5066
  };
4991
5067
  }), $ZodNumber = $constructor("$ZodNumber", (inst, def)=>{
4992
- $ZodType.init(inst, def), inst._zod.pattern = inst._zod.bag.pattern ?? number, inst._zod.parse = (payload, _ctx)=>{
5068
+ $ZodType.init(inst, def), inst._zod.pattern = inst._zod.bag.pattern ?? regexes_number, inst._zod.parse = (payload, _ctx)=>{
4993
5069
  if (def.coerce) try {
4994
5070
  payload.value = Number(payload.value);
4995
5071
  } catch (_) {}
@@ -5081,28 +5157,61 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5081
5157
  return proms.length ? Promise.all(proms).then(()=>payload) : payload;
5082
5158
  };
5083
5159
  });
5084
- function handleObjectResult(result, final, key) {
5085
- result.issues.length && final.issues.push(...prefixIssues(key, result.issues)), final.value[key] = result.value;
5086
- }
5087
- function handleOptionalObjectResult(result, final, key, input) {
5088
- result.issues.length ? void 0 === input[key] ? key in input ? final.value[key] = void 0 : final.value[key] = result.value : final.issues.push(...prefixIssues(key, result.issues)) : void 0 === result.value ? key in input && (final.value[key] = void 0) : final.value[key] = result.value;
5160
+ function handlePropertyResult(result, final, key, input) {
5161
+ result.issues.length && final.issues.push(...prefixIssues(key, result.issues)), void 0 === result.value ? key in input && (final.value[key] = void 0) : final.value[key] = result.value;
5162
+ }
5163
+ function normalizeDef(def) {
5164
+ var shape;
5165
+ let keys = Object.keys(def.shape);
5166
+ for (let k of keys)if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw Error(`Invalid element at key "${k}": expected a Zod schema`);
5167
+ let okeys = Object.keys(shape = def.shape).filter((k)=>"optional" === shape[k]._zod.optin && "optional" === shape[k]._zod.optout);
5168
+ return {
5169
+ ...def,
5170
+ keys,
5171
+ keySet: new Set(keys),
5172
+ numKeys: keys.length,
5173
+ optionalKeys: new Set(okeys)
5174
+ };
5175
+ }
5176
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
5177
+ let unrecognized = [], keySet = def.keySet, _catchall = def.catchall._zod, t = _catchall.def.type;
5178
+ for (let key of Object.keys(input)){
5179
+ if (keySet.has(key)) continue;
5180
+ if ("never" === t) {
5181
+ unrecognized.push(key);
5182
+ continue;
5183
+ }
5184
+ let r = _catchall.run({
5185
+ value: input[key],
5186
+ issues: []
5187
+ }, ctx);
5188
+ r instanceof Promise ? proms.push(r.then((r)=>handlePropertyResult(r, payload, key, input))) : handlePropertyResult(r, payload, key, input);
5189
+ }
5190
+ return (unrecognized.length && payload.issues.push({
5191
+ code: "unrecognized_keys",
5192
+ keys: unrecognized,
5193
+ input,
5194
+ inst
5195
+ }), proms.length) ? Promise.all(proms).then(()=>payload) : payload;
5089
5196
  }
5090
5197
  let $ZodObject = $constructor("$ZodObject", (inst, def)=>{
5091
- let fastpass, value;
5198
+ let value;
5092
5199
  $ZodType.init(inst, def);
5093
- let _normalized = util_cached(()=>{
5094
- var shape;
5095
- let keys = Object.keys(def.shape);
5096
- for (let k of keys)if (!(def.shape[k] instanceof $ZodType)) throw Error(`Invalid element at key "${k}": expected a Zod schema`);
5097
- let okeys = Object.keys(shape = def.shape).filter((k)=>"optional" === shape[k]._zod.optin && "optional" === shape[k]._zod.optout);
5098
- return {
5099
- shape: def.shape,
5100
- keys,
5101
- keySet: new Set(keys),
5102
- numKeys: keys.length,
5103
- optionalKeys: new Set(okeys)
5104
- };
5105
- });
5200
+ let desc = Object.getOwnPropertyDescriptor(def, "shape");
5201
+ if (!desc?.get) {
5202
+ let sh = def.shape;
5203
+ Object.defineProperty(def, "shape", {
5204
+ get: ()=>{
5205
+ let newSh = {
5206
+ ...sh
5207
+ };
5208
+ return Object.defineProperty(def, "shape", {
5209
+ value: newSh
5210
+ }), newSh;
5211
+ }
5212
+ });
5213
+ }
5214
+ let _normalized = util_cached(()=>normalizeDef(def));
5106
5215
  defineLazy(inst._zod, "propValues", ()=>{
5107
5216
  let shape = def.shape, propValues = {};
5108
5217
  for(let key in shape){
@@ -5111,7 +5220,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5111
5220
  }
5112
5221
  return propValues;
5113
5222
  });
5114
- let jit = !globalConfig.jitless, fastEnabled = jit && util_allowsEval.value, catchall = def.catchall;
5223
+ let catchall = def.catchall;
5115
5224
  inst._zod.parse = (payload, ctx)=>{
5116
5225
  value ?? (value = _normalized.value);
5117
5226
  let input = payload.value;
@@ -5121,8 +5230,25 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5121
5230
  input,
5122
5231
  inst
5123
5232
  }), payload;
5124
- let proms = [];
5125
- if (jit && fastEnabled && ctx?.async === !1 && !0 !== ctx.jitless) fastpass || (fastpass = ((shape)=>{
5233
+ payload.value = {};
5234
+ let proms = [], shape = value.shape;
5235
+ for (let key of value.keys){
5236
+ let r = shape[key]._zod.run({
5237
+ value: input[key],
5238
+ issues: []
5239
+ }, ctx);
5240
+ r instanceof Promise ? proms.push(r.then((r)=>handlePropertyResult(r, payload, key, input))) : handlePropertyResult(r, payload, key, input);
5241
+ }
5242
+ return catchall ? handleCatchall(proms, input, payload, ctx, _normalized.value, inst) : proms.length ? Promise.all(proms).then(()=>payload) : payload;
5243
+ };
5244
+ }), $ZodObjectJIT = $constructor("$ZodObjectJIT", (inst, def)=>{
5245
+ let fastpass, value;
5246
+ $ZodObject.init(inst, def);
5247
+ let superParse = inst._zod.parse, _normalized = util_cached(()=>normalizeDef(def)), jit = !globalConfig.jitless, fastEnabled = jit && util_allowsEval.value, catchall = def.catchall;
5248
+ inst._zod.parse = (payload, ctx)=>{
5249
+ value ?? (value = _normalized.value);
5250
+ let input = payload.value;
5251
+ return util_isObject(input) ? jit && fastEnabled && ctx?.async === !1 && !0 !== ctx.jitless ? (fastpass || (fastpass = ((shape)=>{
5126
5252
  let doc = new Doc([
5127
5253
  "shape",
5128
5254
  "payload",
@@ -5134,83 +5260,47 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5134
5260
  doc.write("const input = payload.value;");
5135
5261
  let ids = Object.create(null), counter = 0;
5136
5262
  for (let key of normalized.keys)ids[key] = `key_${counter++}`;
5137
- for (let key of (doc.write("const newResult = {}"), normalized.keys))if (normalized.optionalKeys.has(key)) {
5138
- let id = ids[key];
5139
- doc.write(`const ${id} = ${parseStr(key)};`);
5140
- let k = esc(key);
5141
- doc.write(`
5263
+ for (let key of (doc.write("const newResult = {};"), normalized.keys)){
5264
+ let id = ids[key], k = esc(key);
5265
+ doc.write(`const ${id} = ${parseStr(key)};`), doc.write(`
5142
5266
  if (${id}.issues.length) {
5143
- if (input[${k}] === undefined) {
5144
- if (${k} in input) {
5145
- newResult[${k}] = undefined;
5146
- }
5147
- } else {
5148
- payload.issues = payload.issues.concat(
5149
- ${id}.issues.map((iss) => ({
5150
- ...iss,
5151
- path: iss.path ? [${k}, ...iss.path] : [${k}],
5152
- }))
5153
- );
5267
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
5268
+ ...iss,
5269
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
5270
+ })));
5271
+ }
5272
+
5273
+
5274
+ if (${id}.value === undefined) {
5275
+ if (${k} in input) {
5276
+ newResult[${k}] = undefined;
5154
5277
  }
5155
- } else if (${id}.value === undefined) {
5156
- if (${k} in input) newResult[${k}] = undefined;
5157
5278
  } else {
5158
5279
  newResult[${k}] = ${id}.value;
5159
5280
  }
5160
- `);
5161
- } else {
5162
- let id = ids[key];
5163
- doc.write(`const ${id} = ${parseStr(key)};`), doc.write(`
5164
- if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
5165
- ...iss,
5166
- path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
5167
- })));`), doc.write(`newResult[${esc(key)}] = ${id}.value`);
5281
+
5282
+ `);
5168
5283
  }
5169
5284
  doc.write("payload.value = newResult;"), doc.write("return payload;");
5170
5285
  let fn = doc.compile();
5171
5286
  return (payload, ctx)=>fn(shape, payload, ctx);
5172
- })(def.shape)), payload = fastpass(payload, ctx);
5173
- else {
5174
- payload.value = {};
5175
- let shape = value.shape;
5176
- for (let key of value.keys){
5177
- let el = shape[key], r = el._zod.run({
5178
- value: input[key],
5179
- issues: []
5180
- }, ctx), isOptional = "optional" === el._zod.optin && "optional" === el._zod.optout;
5181
- r instanceof Promise ? proms.push(r.then((r)=>isOptional ? handleOptionalObjectResult(r, payload, key, input) : handleObjectResult(r, payload, key))) : isOptional ? handleOptionalObjectResult(r, payload, key, input) : handleObjectResult(r, payload, key);
5182
- }
5183
- }
5184
- if (!catchall) return proms.length ? Promise.all(proms).then(()=>payload) : payload;
5185
- let unrecognized = [], keySet = value.keySet, _catchall = catchall._zod, t = _catchall.def.type;
5186
- for (let key of Object.keys(input)){
5187
- if (keySet.has(key)) continue;
5188
- if ("never" === t) {
5189
- unrecognized.push(key);
5190
- continue;
5191
- }
5192
- let r = _catchall.run({
5193
- value: input[key],
5194
- issues: []
5195
- }, ctx);
5196
- r instanceof Promise ? proms.push(r.then((r)=>handleObjectResult(r, payload, key))) : handleObjectResult(r, payload, key);
5197
- }
5198
- return (unrecognized.length && payload.issues.push({
5199
- code: "unrecognized_keys",
5200
- keys: unrecognized,
5287
+ })(def.shape)), payload = fastpass(payload, ctx), catchall) ? handleCatchall([], input, payload, ctx, value, inst) : payload : superParse(payload, ctx) : (payload.issues.push({
5288
+ expected: "object",
5289
+ code: "invalid_type",
5201
5290
  input,
5202
5291
  inst
5203
- }), proms.length) ? Promise.all(proms).then(()=>payload) : payload;
5292
+ }), payload);
5204
5293
  };
5205
5294
  });
5206
5295
  function handleUnionResults(results, final, inst, ctx) {
5207
5296
  for (let result of results)if (0 === result.issues.length) return final.value = result.value, final;
5208
- return final.issues.push({
5297
+ let nonaborted = results.filter((r)=>!aborted(r));
5298
+ return 1 === nonaborted.length ? (final.value = nonaborted[0].value, nonaborted[0]) : (final.issues.push({
5209
5299
  code: "invalid_union",
5210
5300
  input: final.value,
5211
5301
  inst,
5212
5302
  errors: results.map((result)=>result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
5213
- }), final;
5303
+ }), final);
5214
5304
  }
5215
5305
  let $ZodUnion = $constructor("$ZodUnion", (inst, def)=>{
5216
5306
  $ZodType.init(inst, def), defineLazy(inst._zod, "optin", ()=>def.options.some((o)=>"optional" === o._zod.optin) ? "optional" : void 0), defineLazy(inst._zod, "optout", ()=>def.options.some((o)=>"optional" === o._zod.optout) ? "optional" : void 0), defineLazy(inst._zod, "values", ()=>{
@@ -5220,7 +5310,10 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5220
5310
  let patterns = def.options.map((o)=>o._zod.pattern);
5221
5311
  return RegExp(`^(${patterns.map((p)=>cleanRegex(p.source)).join("|")})$`);
5222
5312
  }
5223
- }), inst._zod.parse = (payload, ctx)=>{
5313
+ });
5314
+ let single = 1 === def.options.length, first = def.options[0]._zod.run;
5315
+ inst._zod.parse = (payload, ctx)=>{
5316
+ if (single) return first(payload, ctx);
5224
5317
  let async = !1, results = [];
5225
5318
  for (let option of def.options){
5226
5319
  let result = option._zod.run({
@@ -5326,16 +5419,16 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5326
5419
  if (!def.rest) {
5327
5420
  let tooBig = input.length > items.length, tooSmall = input.length < optStart - 1;
5328
5421
  if (tooBig || tooSmall) return payload.issues.push({
5329
- input,
5330
- inst,
5331
- origin: "array",
5332
5422
  ...tooBig ? {
5333
5423
  code: "too_big",
5334
5424
  maximum: items.length
5335
5425
  } : {
5336
5426
  code: "too_small",
5337
5427
  minimum: items.length
5338
- }
5428
+ },
5429
+ input,
5430
+ inst,
5431
+ origin: "array"
5339
5432
  }), payload;
5340
5433
  }
5341
5434
  let i = -1;
@@ -5398,8 +5491,8 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5398
5491
  if (keyResult instanceof Promise) throw Error("Async schemas not supported in object keys currently");
5399
5492
  if (keyResult.issues.length) {
5400
5493
  payload.issues.push({
5401
- origin: "record",
5402
5494
  code: "invalid_key",
5495
+ origin: "record",
5403
5496
  issues: keyResult.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())),
5404
5497
  input: key,
5405
5498
  path: [
@@ -5423,10 +5516,10 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5423
5516
  var entries;
5424
5517
  let numericValues;
5425
5518
  $ZodType.init(inst, def);
5426
- let values = (numericValues = Object.values(entries = def.entries).filter((v)=>"number" == typeof v), Object.entries(entries).filter(([k, _])=>-1 === numericValues.indexOf(+k)).map(([_, v])=>v));
5427
- inst._zod.values = new Set(values), inst._zod.pattern = RegExp(`^(${values.filter((k)=>propertyKeyTypes.has(typeof k)).map((o)=>"string" == typeof o ? escapeRegex(o) : o.toString()).join("|")})$`), inst._zod.parse = (payload, _ctx)=>{
5519
+ let values = (numericValues = Object.values(entries = def.entries).filter((v)=>"number" == typeof v), Object.entries(entries).filter(([k, _])=>-1 === numericValues.indexOf(+k)).map(([_, v])=>v)), valuesSet = new Set(values);
5520
+ inst._zod.values = valuesSet, inst._zod.pattern = RegExp(`^(${values.filter((k)=>propertyKeyTypes.has(typeof k)).map((o)=>"string" == typeof o ? escapeRegex(o) : o.toString()).join("|")})$`), inst._zod.parse = (payload, _ctx)=>{
5428
5521
  let input = payload.value;
5429
- return inst._zod.values.has(input) || payload.issues.push({
5522
+ return valuesSet.has(input) || payload.issues.push({
5430
5523
  code: "invalid_value",
5431
5524
  values,
5432
5525
  input,
@@ -5434,7 +5527,8 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5434
5527
  }), payload;
5435
5528
  };
5436
5529
  }), $ZodLiteral = $constructor("$ZodLiteral", (inst, def)=>{
5437
- $ZodType.init(inst, def), inst._zod.values = new Set(def.values), inst._zod.pattern = RegExp(`^(${def.values.map((o)=>"string" == typeof o ? escapeRegex(o) : o ? o.toString() : String(o)).join("|")})$`), inst._zod.parse = (payload, _ctx)=>{
5530
+ if ($ZodType.init(inst, def), 0 === def.values.length) throw Error("Cannot create literal schema with no valid values");
5531
+ inst._zod.values = new Set(def.values), inst._zod.pattern = RegExp(`^(${def.values.map((o)=>"string" == typeof o ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`), inst._zod.parse = (payload, _ctx)=>{
5438
5532
  let input = payload.value;
5439
5533
  return inst._zod.values.has(input) || payload.issues.push({
5440
5534
  code: "invalid_value",
@@ -5444,20 +5538,34 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5444
5538
  }), payload;
5445
5539
  };
5446
5540
  }), $ZodTransform = $constructor("$ZodTransform", (inst, def)=>{
5447
- $ZodType.init(inst, def), inst._zod.parse = (payload, _ctx)=>{
5541
+ $ZodType.init(inst, def), inst._zod.parse = (payload, ctx)=>{
5542
+ if ("backward" === ctx.direction) throw new $ZodEncodeError(inst.constructor.name);
5448
5543
  let _out = def.transform(payload.value, payload);
5449
- if (_ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output)=>(payload.value = output, payload));
5544
+ if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output)=>(payload.value = output, payload));
5450
5545
  if (_out instanceof Promise) throw new $ZodAsyncError();
5451
5546
  return payload.value = _out, payload;
5452
5547
  };
5453
- }), $ZodOptional = $constructor("$ZodOptional", (inst, def)=>{
5548
+ });
5549
+ function handleOptionalResult(result, input) {
5550
+ return result.issues.length && void 0 === input ? {
5551
+ issues: [],
5552
+ value: void 0
5553
+ } : result;
5554
+ }
5555
+ let $ZodOptional = $constructor("$ZodOptional", (inst, def)=>{
5454
5556
  $ZodType.init(inst, def), inst._zod.optin = "optional", inst._zod.optout = "optional", defineLazy(inst._zod, "values", ()=>def.innerType._zod.values ? new Set([
5455
5557
  ...def.innerType._zod.values,
5456
5558
  void 0
5457
5559
  ]) : void 0), defineLazy(inst._zod, "pattern", ()=>{
5458
5560
  let pattern = def.innerType._zod.pattern;
5459
5561
  return pattern ? RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
5460
- }), inst._zod.parse = (payload, ctx)=>"optional" === def.innerType._zod.optin ? def.innerType._zod.run(payload, ctx) : void 0 === payload.value ? payload : def.innerType._zod.run(payload, ctx);
5562
+ }), inst._zod.parse = (payload, ctx)=>{
5563
+ if ("optional" === def.innerType._zod.optin) {
5564
+ let result = def.innerType._zod.run(payload, ctx);
5565
+ return result instanceof Promise ? result.then((r)=>handleOptionalResult(r, payload.value)) : handleOptionalResult(result, payload.value);
5566
+ }
5567
+ return void 0 === payload.value ? payload : def.innerType._zod.run(payload, ctx);
5568
+ };
5461
5569
  }), $ZodNullable = $constructor("$ZodNullable", (inst, def)=>{
5462
5570
  $ZodType.init(inst, def), defineLazy(inst._zod, "optin", ()=>def.innerType._zod.optin), defineLazy(inst._zod, "optout", ()=>def.innerType._zod.optout), defineLazy(inst._zod, "pattern", ()=>{
5463
5571
  let pattern = def.innerType._zod.pattern;
@@ -5468,6 +5576,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5468
5576
  ]) : void 0), inst._zod.parse = (payload, ctx)=>null === payload.value ? payload : def.innerType._zod.run(payload, ctx);
5469
5577
  }), $ZodDefault = $constructor("$ZodDefault", (inst, def)=>{
5470
5578
  $ZodType.init(inst, def), inst._zod.optin = "optional", defineLazy(inst._zod, "values", ()=>def.innerType._zod.values), inst._zod.parse = (payload, ctx)=>{
5579
+ if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
5471
5580
  if (void 0 === payload.value) return payload.value = def.defaultValue, payload;
5472
5581
  let result = def.innerType._zod.run(payload, ctx);
5473
5582
  return result instanceof Promise ? result.then((result)=>handleDefaultResult(result, def)) : handleDefaultResult(result, def);
@@ -5477,7 +5586,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5477
5586
  return void 0 === payload.value && (payload.value = def.defaultValue), payload;
5478
5587
  }
5479
5588
  let $ZodPrefault = $constructor("$ZodPrefault", (inst, def)=>{
5480
- $ZodType.init(inst, def), inst._zod.optin = "optional", defineLazy(inst._zod, "values", ()=>def.innerType._zod.values), inst._zod.parse = (payload, ctx)=>(void 0 === payload.value && (payload.value = def.defaultValue), def.innerType._zod.run(payload, ctx));
5589
+ $ZodType.init(inst, def), inst._zod.optin = "optional", defineLazy(inst._zod, "values", ()=>def.innerType._zod.values), inst._zod.parse = (payload, ctx)=>("backward" === ctx.direction || void 0 === payload.value && (payload.value = def.defaultValue), def.innerType._zod.run(payload, ctx));
5481
5590
  }), $ZodNonOptional = $constructor("$ZodNonOptional", (inst, def)=>{
5482
5591
  $ZodType.init(inst, def), defineLazy(inst._zod, "values", ()=>{
5483
5592
  let v = def.innerType._zod.values;
@@ -5498,7 +5607,8 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5498
5607
  }), payload;
5499
5608
  }
5500
5609
  let $ZodCatch = $constructor("$ZodCatch", (inst, def)=>{
5501
- $ZodType.init(inst, def), inst._zod.optin = "optional", defineLazy(inst._zod, "optout", ()=>def.innerType._zod.optout), defineLazy(inst._zod, "values", ()=>def.innerType._zod.values), inst._zod.parse = (payload, ctx)=>{
5610
+ $ZodType.init(inst, def), defineLazy(inst._zod, "optin", ()=>def.innerType._zod.optin), defineLazy(inst._zod, "optout", ()=>def.innerType._zod.optout), defineLazy(inst._zod, "values", ()=>def.innerType._zod.values), inst._zod.parse = (payload, ctx)=>{
5611
+ if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
5502
5612
  let result = def.innerType._zod.run(payload, ctx);
5503
5613
  return result instanceof Promise ? result.then((result)=>(payload.value = result.value, result.issues.length && (payload.value = def.catchValue({
5504
5614
  ...payload,
@@ -5515,19 +5625,24 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5515
5625
  }), payload.issues = []), payload);
5516
5626
  };
5517
5627
  }), $ZodPipe = $constructor("$ZodPipe", (inst, def)=>{
5518
- $ZodType.init(inst, def), defineLazy(inst._zod, "values", ()=>def.in._zod.values), defineLazy(inst._zod, "optin", ()=>def.in._zod.optin), defineLazy(inst._zod, "optout", ()=>def.out._zod.optout), inst._zod.parse = (payload, ctx)=>{
5628
+ $ZodType.init(inst, def), defineLazy(inst._zod, "values", ()=>def.in._zod.values), defineLazy(inst._zod, "optin", ()=>def.in._zod.optin), defineLazy(inst._zod, "optout", ()=>def.out._zod.optout), defineLazy(inst._zod, "propValues", ()=>def.in._zod.propValues), inst._zod.parse = (payload, ctx)=>{
5629
+ if ("backward" === ctx.direction) {
5630
+ let right = def.out._zod.run(payload, ctx);
5631
+ return right instanceof Promise ? right.then((right)=>handlePipeResult(right, def.in, ctx)) : handlePipeResult(right, def.in, ctx);
5632
+ }
5519
5633
  let left = def.in._zod.run(payload, ctx);
5520
- return left instanceof Promise ? left.then((left)=>handlePipeResult(left, def, ctx)) : handlePipeResult(left, def, ctx);
5634
+ return left instanceof Promise ? left.then((left)=>handlePipeResult(left, def.out, ctx)) : handlePipeResult(left, def.out, ctx);
5521
5635
  };
5522
5636
  });
5523
- function handlePipeResult(left, def, ctx) {
5524
- return aborted(left) ? left : def.out._zod.run({
5637
+ function handlePipeResult(left, next, ctx) {
5638
+ return left.issues.length ? (left.aborted = !0, left) : next._zod.run({
5525
5639
  value: left.value,
5526
5640
  issues: left.issues
5527
5641
  }, ctx);
5528
5642
  }
5529
5643
  let $ZodReadonly = $constructor("$ZodReadonly", (inst, def)=>{
5530
5644
  $ZodType.init(inst, def), defineLazy(inst._zod, "propValues", ()=>def.innerType._zod.propValues), defineLazy(inst._zod, "values", ()=>def.innerType._zod.values), defineLazy(inst._zod, "optin", ()=>def.innerType._zod.optin), defineLazy(inst._zod, "optout", ()=>def.innerType._zod.optout), inst._zod.parse = (payload, ctx)=>{
5645
+ if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
5531
5646
  let result = def.innerType._zod.run(payload, ctx);
5532
5647
  return result instanceof Promise ? result.then(handleReadonlyResult) : handleReadonlyResult(result);
5533
5648
  };
@@ -5536,7 +5651,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5536
5651
  return payload.value = Object.freeze(payload.value), payload;
5537
5652
  }
5538
5653
  let $ZodLazy = $constructor("$ZodLazy", (inst, def)=>{
5539
- $ZodType.init(inst, def), defineLazy(inst._zod, "innerType", ()=>def.getter()), defineLazy(inst._zod, "pattern", ()=>inst._zod.innerType._zod.pattern), defineLazy(inst._zod, "propValues", ()=>inst._zod.innerType._zod.propValues), defineLazy(inst._zod, "optin", ()=>inst._zod.innerType._zod.optin), defineLazy(inst._zod, "optout", ()=>inst._zod.innerType._zod.optout), inst._zod.parse = (payload, ctx)=>inst._zod.innerType._zod.run(payload, ctx);
5654
+ $ZodType.init(inst, def), defineLazy(inst._zod, "innerType", ()=>def.getter()), defineLazy(inst._zod, "pattern", ()=>inst._zod.innerType._zod.pattern), defineLazy(inst._zod, "propValues", ()=>inst._zod.innerType._zod.propValues), defineLazy(inst._zod, "optin", ()=>inst._zod.innerType._zod.optin ?? void 0), defineLazy(inst._zod, "optout", ()=>inst._zod.innerType._zod.optout ?? void 0), inst._zod.parse = (payload, ctx)=>inst._zod.innerType._zod.run(payload, ctx);
5540
5655
  }), $ZodCustom = $constructor("$ZodCustom", (inst, def)=>{
5541
5656
  $ZodCheck.init(inst, def), $ZodType.init(inst, def), inst._zod.parse = (payload, _)=>payload, inst._zod.check = (payload)=>{
5542
5657
  let input = payload.value, r = def.fn(input);
@@ -5559,9 +5674,9 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5559
5674
  }
5560
5675
  }
5561
5676
  Symbol("ZodOutput"), Symbol("ZodInput");
5562
- class $ZodRegistry {
5677
+ class registries_$ZodRegistry {
5563
5678
  constructor(){
5564
- this._map = new Map(), this._idmap = new Map();
5679
+ this._map = new WeakMap(), this._idmap = new Map();
5565
5680
  }
5566
5681
  add(schema, ..._meta) {
5567
5682
  let meta = _meta[0];
@@ -5572,7 +5687,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5572
5687
  return this;
5573
5688
  }
5574
5689
  clear() {
5575
- return this._map = new Map(), this._idmap = new Map(), this;
5690
+ return this._map = new WeakMap(), this._idmap = new Map(), this;
5576
5691
  }
5577
5692
  remove(schema) {
5578
5693
  let meta = this._map.get(schema);
@@ -5584,10 +5699,12 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5584
5699
  let pm = {
5585
5700
  ...this.get(p) ?? {}
5586
5701
  };
5587
- return delete pm.id, {
5702
+ delete pm.id;
5703
+ let f = {
5588
5704
  ...pm,
5589
5705
  ...this._map.get(schema)
5590
5706
  };
5707
+ return Object.keys(f).length ? f : void 0;
5591
5708
  }
5592
5709
  return this._map.get(schema);
5593
5710
  }
@@ -5595,7 +5712,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5595
5712
  return this._map.has(schema);
5596
5713
  }
5597
5714
  }
5598
- let globalRegistry = new $ZodRegistry();
5715
+ let registries_globalRegistry = new registries_$ZodRegistry();
5599
5716
  function _guid(Class, params) {
5600
5717
  return new Class({
5601
5718
  type: "string",
@@ -5682,37 +5799,34 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5682
5799
  }), classic_errors_initializer = (inst, issues)=>{
5683
5800
  $ZodError.init(inst, issues), inst.name = "ZodError", Object.defineProperties(inst, {
5684
5801
  format: {
5685
- value: (mapper)=>{
5686
- var error;
5687
- let mapper1, fieldErrors, processError;
5688
- return error = inst, mapper1 = mapper || function(issue) {
5689
- return issue.message;
5690
- }, fieldErrors = {
5691
- _errors: []
5692
- }, (processError = (error)=>{
5693
- for (let issue of error.issues)if ("invalid_union" === issue.code && issue.errors.length) issue.errors.map((issues)=>processError({
5694
- issues
5695
- }));
5696
- else if ("invalid_key" === issue.code) processError({
5697
- issues: issue.issues
5698
- });
5699
- else if ("invalid_element" === issue.code) processError({
5700
- issues: issue.issues
5701
- });
5702
- else if (0 === issue.path.length) fieldErrors._errors.push(mapper1(issue));
5703
- else {
5704
- let curr = fieldErrors, i = 0;
5705
- for(; i < issue.path.length;){
5706
- let el = issue.path[i];
5707
- i === issue.path.length - 1 ? (curr[el] = curr[el] || {
5708
- _errors: []
5709
- }, curr[el]._errors.push(mapper1(issue))) : curr[el] = curr[el] || {
5710
- _errors: []
5711
- }, curr = curr[el], i++;
5802
+ value: (mapper)=>(function(error, mapper = (issue)=>issue.message) {
5803
+ let fieldErrors = {
5804
+ _errors: []
5805
+ }, processError = (error)=>{
5806
+ for (let issue of error.issues)if ("invalid_union" === issue.code && issue.errors.length) issue.errors.map((issues)=>processError({
5807
+ issues
5808
+ }));
5809
+ else if ("invalid_key" === issue.code) processError({
5810
+ issues: issue.issues
5811
+ });
5812
+ else if ("invalid_element" === issue.code) processError({
5813
+ issues: issue.issues
5814
+ });
5815
+ else if (0 === issue.path.length) fieldErrors._errors.push(mapper(issue));
5816
+ else {
5817
+ let curr = fieldErrors, i = 0;
5818
+ for(; i < issue.path.length;){
5819
+ let el = issue.path[i];
5820
+ i === issue.path.length - 1 ? (curr[el] = curr[el] || {
5821
+ _errors: []
5822
+ }, curr[el]._errors.push(mapper(issue))) : curr[el] = curr[el] || {
5823
+ _errors: []
5824
+ }, curr = curr[el], i++;
5825
+ }
5712
5826
  }
5713
- }
5714
- })(error), fieldErrors;
5715
- }
5827
+ };
5828
+ return processError(error), fieldErrors;
5829
+ })(inst, mapper)
5716
5830
  },
5717
5831
  flatten: {
5718
5832
  value: (mapper)=>(function(error, mapper = (issue)=>issue.message) {
@@ -5725,10 +5839,14 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5725
5839
  })(inst, mapper)
5726
5840
  },
5727
5841
  addIssue: {
5728
- value: (issue)=>inst.issues.push(issue)
5842
+ value: (issue)=>{
5843
+ inst.issues.push(issue), inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
5844
+ }
5729
5845
  },
5730
5846
  addIssues: {
5731
- value: (issues)=>inst.issues.push(...issues)
5847
+ value: (issues)=>{
5848
+ inst.issues.push(...issues), inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
5849
+ }
5732
5850
  },
5733
5851
  isEmpty: {
5734
5852
  get: ()=>0 === inst.issues.length
@@ -5738,39 +5856,37 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5738
5856
  $constructor("ZodError", classic_errors_initializer);
5739
5857
  let ZodRealError = $constructor("ZodError", classic_errors_initializer, {
5740
5858
  Parent: Error
5741
- }), parse_parse = (_Err = ZodRealError, (schema, value, _ctx, _params)=>{
5859
+ }), classic_parse_parse = _parse(ZodRealError), classic_parse_parseAsync = _parseAsync(ZodRealError), parse_safeParse = _safeParse(ZodRealError), parse_safeParseAsync = _safeParseAsync(ZodRealError), parse_encode = (_Err = ZodRealError, (schema, value, _ctx)=>{
5742
5860
  let ctx = _ctx ? Object.assign(_ctx, {
5743
- async: !1
5861
+ direction: "backward"
5744
5862
  }) : {
5745
- async: !1
5746
- }, result = schema._zod.run({
5747
- value,
5748
- issues: []
5749
- }, ctx);
5750
- if (result instanceof Promise) throw new $ZodAsyncError();
5751
- if (result.issues.length) {
5752
- let e = new (_params?.Err ?? _Err)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())));
5753
- throw captureStackTrace(e, _params?.callee), e;
5754
- }
5755
- return result.value;
5756
- }), parse_parseAsync = (_Err1 = ZodRealError, async (schema, value, _ctx, params)=>{
5863
+ direction: "backward"
5864
+ };
5865
+ return _parse(_Err)(schema, value, ctx);
5866
+ }), parse_decode = (_Err1 = ZodRealError, (schema, value, _ctx)=>_parse(_Err1)(schema, value, _ctx)), parse_encodeAsync = (_Err2 = ZodRealError, async (schema, value, _ctx)=>{
5757
5867
  let ctx = _ctx ? Object.assign(_ctx, {
5758
- async: !0
5868
+ direction: "backward"
5759
5869
  }) : {
5760
- async: !0
5761
- }, result = schema._zod.run({
5762
- value,
5763
- issues: []
5764
- }, ctx);
5765
- if (result instanceof Promise && (result = await result), result.issues.length) {
5766
- let e = new (params?.Err ?? _Err1)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())));
5767
- throw captureStackTrace(e, params?.callee), e;
5768
- }
5769
- return result.value;
5770
- }), parse_safeParse = _safeParse(ZodRealError), parse_safeParseAsync = _safeParseAsync(ZodRealError), ZodType = $constructor("ZodType", (inst, def)=>($ZodType.init(inst, def), inst.def = def, Object.defineProperty(inst, "_def", {
5870
+ direction: "backward"
5871
+ };
5872
+ return _parseAsync(_Err2)(schema, value, ctx);
5873
+ }), parse_decodeAsync = (_Err3 = ZodRealError, async (schema, value, _ctx)=>_parseAsync(_Err3)(schema, value, _ctx)), parse_safeEncode = (_Err4 = ZodRealError, (schema, value, _ctx)=>{
5874
+ let ctx = _ctx ? Object.assign(_ctx, {
5875
+ direction: "backward"
5876
+ }) : {
5877
+ direction: "backward"
5878
+ };
5879
+ return _safeParse(_Err4)(schema, value, ctx);
5880
+ }), parse_safeDecode = (_Err5 = ZodRealError, (schema, value, _ctx)=>_safeParse(_Err5)(schema, value, _ctx)), parse_safeEncodeAsync = (_Err6 = ZodRealError, async (schema, value, _ctx)=>{
5881
+ let ctx = _ctx ? Object.assign(_ctx, {
5882
+ direction: "backward"
5883
+ }) : {
5884
+ direction: "backward"
5885
+ };
5886
+ return _safeParseAsync(_Err6)(schema, value, ctx);
5887
+ }), parse_safeDecodeAsync = (_Err7 = ZodRealError, async (schema, value, _ctx)=>_safeParseAsync(_Err7)(schema, value, _ctx)), ZodType = $constructor("ZodType", (inst, def)=>($ZodType.init(inst, def), inst.def = def, inst.type = def.type, Object.defineProperty(inst, "_def", {
5771
5888
  value: def
5772
- }), inst.check = (...checks)=>inst.clone({
5773
- ...def,
5889
+ }), inst.check = (...checks)=>inst.clone(mergeDefs(def, {
5774
5890
  checks: [
5775
5891
  ...def.checks ?? [],
5776
5892
  ...checks.map((ch)=>"function" == typeof ch ? {
@@ -5783,11 +5899,11 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5783
5899
  }
5784
5900
  } : ch)
5785
5901
  ]
5786
- }), inst.clone = (def, params)=>clone(inst, def, params), inst.brand = ()=>inst, inst.register = (reg, meta)=>(reg.add(inst, meta), inst), inst.parse = (data, params)=>parse_parse(inst, data, params, {
5902
+ })), inst.clone = (def, params)=>clone(inst, def, params), inst.brand = ()=>inst, inst.register = (reg, meta)=>(reg.add(inst, meta), inst), inst.parse = (data, params)=>classic_parse_parse(inst, data, params, {
5787
5903
  callee: inst.parse
5788
- }), inst.safeParse = (data, params)=>parse_safeParse(inst, data, params), inst.parseAsync = async (data, params)=>parse_parseAsync(inst, data, params, {
5904
+ }), inst.safeParse = (data, params)=>parse_safeParse(inst, data, params), inst.parseAsync = async (data, params)=>classic_parse_parseAsync(inst, data, params, {
5789
5905
  callee: inst.parseAsync
5790
- }), inst.safeParseAsync = async (data, params)=>parse_safeParseAsync(inst, data, params), inst.spa = inst.safeParseAsync, inst.refine = (check, params)=>inst.check(function(fn, _params = {}) {
5906
+ }), inst.safeParseAsync = async (data, params)=>parse_safeParseAsync(inst, data, params), inst.spa = inst.safeParseAsync, inst.encode = (data, params)=>parse_encode(inst, data, params), inst.decode = (data, params)=>parse_decode(inst, data, params), inst.encodeAsync = async (data, params)=>parse_encodeAsync(inst, data, params), inst.decodeAsync = async (data, params)=>parse_decodeAsync(inst, data, params), inst.safeEncode = (data, params)=>parse_safeEncode(inst, data, params), inst.safeDecode = (data, params)=>parse_safeDecode(inst, data, params), inst.safeEncodeAsync = async (data, params)=>parse_safeEncodeAsync(inst, data, params), inst.safeDecodeAsync = async (data, params)=>parse_safeDecodeAsync(inst, data, params), inst.refine = (check, params)=>inst.check(function(fn, _params = {}) {
5791
5907
  return new ZodCustom({
5792
5908
  type: "custom",
5793
5909
  check: "custom",
@@ -5797,11 +5913,12 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5797
5913
  }(check, params)), inst.superRefine = (refinement)=>{
5798
5914
  var fn, fn1;
5799
5915
  let ch, ch1;
5800
- return inst.check((fn = refinement, ch1 = (fn1 = (payload)=>(payload.addIssue = (issue)=>{
5801
- "string" == typeof issue ? payload.issues.push(util_issue(issue, payload.value, ch1._zod.def)) : (issue.fatal && (issue.continue = !1), issue.code ?? (issue.code = "custom"), issue.input ?? (issue.input = payload.value), issue.inst ?? (issue.inst = ch1), issue.continue ?? (issue.continue = !ch1._zod.def.abort), payload.issues.push(util_issue(issue)));
5802
- }, fn(payload.value, payload)), (ch = new $ZodCheck({
5803
- check: "custom"
5804
- }))._zod.check = fn1, ch)));
5916
+ return inst.check((fn = refinement, fn1 = (payload)=>(payload.addIssue = (issue)=>{
5917
+ "string" == typeof issue ? payload.issues.push(util_issue(issue, payload.value, ch._zod.def)) : (issue.fatal && (issue.continue = !1), issue.code ?? (issue.code = "custom"), issue.input ?? (issue.input = payload.value), issue.inst ?? (issue.inst = ch), issue.continue ?? (issue.continue = !ch._zod.def.abort), payload.issues.push(util_issue(issue)));
5918
+ }, fn(payload.value, payload)), (ch1 = new $ZodCheck({
5919
+ check: "custom",
5920
+ ...normalizeParams(void 0)
5921
+ }))._zod.check = fn1, ch = ch1));
5805
5922
  }, inst.overwrite = (fn)=>inst.check(_overwrite(fn)), inst.optional = ()=>schemas_optional(inst), inst.nullable = ()=>nullable(inst), inst.nullish = ()=>schemas_optional(nullable(inst)), inst.nonoptional = (params)=>new ZodNonOptional({
5806
5923
  type: "nonoptional",
5807
5924
  innerType: inst,
@@ -5822,7 +5939,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5822
5939
  type: "default",
5823
5940
  innerType: innerType,
5824
5941
  get defaultValue () {
5825
- return "function" == typeof defaultValue ? defaultValue() : defaultValue;
5942
+ return "function" == typeof defaultValue ? defaultValue() : shallowClone(defaultValue);
5826
5943
  }
5827
5944
  });
5828
5945
  }, inst.prefault = (def)=>{
@@ -5831,7 +5948,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5831
5948
  type: "prefault",
5832
5949
  innerType: innerType,
5833
5950
  get defaultValue () {
5834
- return "function" == typeof defaultValue ? defaultValue() : defaultValue;
5951
+ return "function" == typeof defaultValue ? defaultValue() : shallowClone(defaultValue);
5835
5952
  }
5836
5953
  });
5837
5954
  }, inst.catch = (params)=>{
@@ -5846,16 +5963,16 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5846
5963
  innerType: inst
5847
5964
  }), inst.describe = (description)=>{
5848
5965
  let cl = inst.clone();
5849
- return globalRegistry.add(cl, {
5966
+ return registries_globalRegistry.add(cl, {
5850
5967
  description
5851
5968
  }), cl;
5852
5969
  }, Object.defineProperty(inst, "description", {
5853
- get: ()=>globalRegistry.get(inst)?.description,
5970
+ get: ()=>registries_globalRegistry.get(inst)?.description,
5854
5971
  configurable: !0
5855
5972
  }), inst.meta = (...args)=>{
5856
- if (0 === args.length) return globalRegistry.get(inst);
5973
+ if (0 === args.length) return registries_globalRegistry.get(inst);
5857
5974
  let cl = inst.clone();
5858
- return globalRegistry.add(cl, args[0]), cl;
5975
+ return registries_globalRegistry.add(cl, args[0]), cl;
5859
5976
  }, inst.isOptional = ()=>inst.safeParse(void 0).success, inst.isNullable = ()=>inst.safeParse(null).success, inst)), _ZodString = $constructor("_ZodString", (inst, def)=>{
5860
5977
  $ZodString.init(inst, def), ZodType.init(inst, def);
5861
5978
  let bag = inst._zod.bag;
@@ -6180,7 +6297,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
6180
6297
  });
6181
6298
  }
6182
6299
  let ZodObject = $constructor("ZodObject", (inst, def)=>{
6183
- $ZodObject.init(inst, def), ZodType.init(inst, def), defineLazy(inst, "shape", ()=>def.shape), inst.keyof = ()=>schemas_enum(Object.keys(inst._zod.def.shape)), inst.catchall = (catchall)=>inst.clone({
6300
+ $ZodObjectJIT.init(inst, def), ZodType.init(inst, def), defineLazy(inst, "shape", ()=>def.shape), inst.keyof = ()=>schemas_enum(Object.keys(inst._zod.def.shape)), inst.catchall = (catchall)=>inst.clone({
6184
6301
  ...inst._zod.def,
6185
6302
  catchall: catchall
6186
6303
  }), inst.passthrough = ()=>inst.clone({
@@ -6197,6 +6314,21 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
6197
6314
  catchall: void 0
6198
6315
  }), inst.extend = (incoming)=>(function(schema, shape) {
6199
6316
  if (!isPlainObject(shape)) throw Error("Invalid input to extend: expected a plain object");
6317
+ let checks = schema._zod.def.checks;
6318
+ if (checks && checks.length > 0) throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
6319
+ let def = mergeDefs(schema._zod.def, {
6320
+ get shape () {
6321
+ let _shape = {
6322
+ ...schema._zod.def.shape,
6323
+ ...shape
6324
+ };
6325
+ return assignProp(this, "shape", _shape), _shape;
6326
+ },
6327
+ checks: []
6328
+ });
6329
+ return clone(schema, def);
6330
+ })(inst, incoming), inst.safeExtend = (incoming)=>(function(schema, shape) {
6331
+ if (!isPlainObject(shape)) throw Error("Invalid input to safeExtend: expected a plain object");
6200
6332
  let def = {
6201
6333
  ...schema._zod.def,
6202
6334
  get shape () {
@@ -6206,13 +6338,13 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
6206
6338
  };
6207
6339
  return assignProp(this, "shape", _shape), _shape;
6208
6340
  },
6209
- checks: []
6341
+ checks: schema._zod.def.checks
6210
6342
  };
6211
6343
  return clone(schema, def);
6212
6344
  })(inst, incoming), inst.merge = (other)=>{
6213
6345
  var a, b;
6214
- return a = inst, b = other, clone(a, {
6215
- ...a._zod.def,
6346
+ let def;
6347
+ return a = inst, b = other, def = mergeDefs(a._zod.def, {
6216
6348
  get shape () {
6217
6349
  let _shape = {
6218
6350
  ...a._zod.def.shape,
@@ -6220,94 +6352,100 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
6220
6352
  };
6221
6353
  return assignProp(this, "shape", _shape), _shape;
6222
6354
  },
6223
- catchall: b._zod.def.catchall,
6355
+ get catchall () {
6356
+ return b._zod.def.catchall;
6357
+ },
6224
6358
  checks: []
6225
- });
6226
- }, inst.pick = (mask)=>(function(schema, mask) {
6227
- let newShape = {}, currDef = schema._zod.def;
6228
- for(let key in mask){
6229
- if (!(key in currDef.shape)) throw Error(`Unrecognized key: "${key}"`);
6230
- mask[key] && (newShape[key] = currDef.shape[key]);
6231
- }
6232
- return clone(schema, {
6233
- ...schema._zod.def,
6234
- shape: newShape,
6235
- checks: []
6236
- });
6237
- })(inst, mask), inst.omit = (mask)=>(function(schema, mask) {
6238
- let newShape = {
6239
- ...schema._zod.def.shape
6240
- }, currDef = schema._zod.def;
6241
- for(let key in mask){
6242
- if (!(key in currDef.shape)) throw Error(`Unrecognized key: "${key}"`);
6243
- mask[key] && delete newShape[key];
6244
- }
6245
- return clone(schema, {
6246
- ...schema._zod.def,
6247
- shape: newShape,
6248
- checks: []
6249
- });
6250
- })(inst, mask), inst.partial = (...args)=>(function(Class, schema, mask) {
6251
- let oldShape = schema._zod.def.shape, shape = {
6252
- ...oldShape
6253
- };
6254
- if (mask) for(let key in mask){
6255
- if (!(key in oldShape)) throw Error(`Unrecognized key: "${key}"`);
6256
- mask[key] && (shape[key] = Class ? new Class({
6359
+ }), clone(a, def);
6360
+ }, inst.pick = (mask)=>{
6361
+ var schema, mask1;
6362
+ let currDef, def;
6363
+ return schema = inst, mask1 = mask, currDef = schema._zod.def, def = mergeDefs(schema._zod.def, {
6364
+ get shape () {
6365
+ let newShape = {};
6366
+ for(let key in mask1){
6367
+ if (!(key in currDef.shape)) throw Error(`Unrecognized key: "${key}"`);
6368
+ mask1[key] && (newShape[key] = currDef.shape[key]);
6369
+ }
6370
+ return assignProp(this, "shape", newShape), newShape;
6371
+ },
6372
+ checks: []
6373
+ }), clone(schema, def);
6374
+ }, inst.omit = (mask)=>{
6375
+ var schema, mask1;
6376
+ let currDef, def;
6377
+ return schema = inst, mask1 = mask, currDef = schema._zod.def, def = mergeDefs(schema._zod.def, {
6378
+ get shape () {
6379
+ let newShape = {
6380
+ ...schema._zod.def.shape
6381
+ };
6382
+ for(let key in mask1){
6383
+ if (!(key in currDef.shape)) throw Error(`Unrecognized key: "${key}"`);
6384
+ mask1[key] && delete newShape[key];
6385
+ }
6386
+ return assignProp(this, "shape", newShape), newShape;
6387
+ },
6388
+ checks: []
6389
+ }), clone(schema, def);
6390
+ }, inst.partial = (...args)=>{
6391
+ var Class, schema, mask;
6392
+ let def;
6393
+ return Class = ZodOptional, schema = inst, mask = args[0], def = mergeDefs(schema._zod.def, {
6394
+ get shape () {
6395
+ let oldShape = schema._zod.def.shape, shape = {
6396
+ ...oldShape
6397
+ };
6398
+ if (mask) for(let key in mask){
6399
+ if (!(key in oldShape)) throw Error(`Unrecognized key: "${key}"`);
6400
+ mask[key] && (shape[key] = Class ? new Class({
6401
+ type: "optional",
6402
+ innerType: oldShape[key]
6403
+ }) : oldShape[key]);
6404
+ }
6405
+ else for(let key in oldShape)shape[key] = Class ? new Class({
6257
6406
  type: "optional",
6258
6407
  innerType: oldShape[key]
6259
- }) : oldShape[key]);
6260
- }
6261
- else for(let key in oldShape)shape[key] = Class ? new Class({
6262
- type: "optional",
6263
- innerType: oldShape[key]
6264
- }) : oldShape[key];
6265
- return clone(schema, {
6266
- ...schema._zod.def,
6267
- shape,
6268
- checks: []
6269
- });
6270
- })(ZodOptional, inst, args[0]), inst.required = (...args)=>(function(Class, schema, mask) {
6271
- let oldShape = schema._zod.def.shape, shape = {
6272
- ...oldShape
6273
- };
6274
- if (mask) for(let key in mask){
6275
- if (!(key in shape)) throw Error(`Unrecognized key: "${key}"`);
6276
- mask[key] && (shape[key] = new Class({
6408
+ }) : oldShape[key];
6409
+ return assignProp(this, "shape", shape), shape;
6410
+ },
6411
+ checks: []
6412
+ }), clone(schema, def);
6413
+ }, inst.required = (...args)=>{
6414
+ var Class, schema, mask;
6415
+ let def;
6416
+ return Class = ZodNonOptional, schema = inst, mask = args[0], def = mergeDefs(schema._zod.def, {
6417
+ get shape () {
6418
+ let oldShape = schema._zod.def.shape, shape = {
6419
+ ...oldShape
6420
+ };
6421
+ if (mask) for(let key in mask){
6422
+ if (!(key in shape)) throw Error(`Unrecognized key: "${key}"`);
6423
+ mask[key] && (shape[key] = new Class({
6424
+ type: "nonoptional",
6425
+ innerType: oldShape[key]
6426
+ }));
6427
+ }
6428
+ else for(let key in oldShape)shape[key] = new Class({
6277
6429
  type: "nonoptional",
6278
6430
  innerType: oldShape[key]
6279
- }));
6280
- }
6281
- else for(let key in oldShape)shape[key] = new Class({
6282
- type: "nonoptional",
6283
- innerType: oldShape[key]
6284
- });
6285
- return clone(schema, {
6286
- ...schema._zod.def,
6287
- shape,
6288
- checks: []
6289
- });
6290
- })(ZodNonOptional, inst, args[0]);
6431
+ });
6432
+ return assignProp(this, "shape", shape), shape;
6433
+ },
6434
+ checks: []
6435
+ }), clone(schema, def);
6436
+ };
6291
6437
  });
6292
6438
  function schemas_object(shape, params) {
6293
6439
  return new ZodObject({
6294
6440
  type: "object",
6295
- get shape () {
6296
- return assignProp(this, "shape", {
6297
- ...shape
6298
- }), this.shape;
6299
- },
6441
+ shape: shape ?? {},
6300
6442
  ...normalizeParams(params)
6301
6443
  });
6302
6444
  }
6303
6445
  function strictObject(shape, params) {
6304
6446
  return new ZodObject({
6305
6447
  type: "object",
6306
- get shape () {
6307
- return assignProp(this, "shape", {
6308
- ...shape
6309
- }), this.shape;
6310
- },
6448
+ shape,
6311
6449
  catchall: never(),
6312
6450
  ...normalizeParams(params)
6313
6451
  });
@@ -6406,8 +6544,9 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
6406
6544
  }
6407
6545
  let ZodTransform = $constructor("ZodTransform", (inst, def)=>{
6408
6546
  $ZodTransform.init(inst, def), ZodType.init(inst, def), inst._zod.parse = (payload, _ctx)=>{
6547
+ if ("backward" === _ctx.direction) throw new $ZodEncodeError(inst.constructor.name);
6409
6548
  payload.addIssue = (issue)=>{
6410
- "string" == typeof issue ? payload.issues.push(util_issue(issue, payload.value, def)) : (issue.fatal && (issue.continue = !1), issue.code ?? (issue.code = "custom"), issue.input ?? (issue.input = payload.value), issue.inst ?? (issue.inst = inst), issue.continue ?? (issue.continue = !0), payload.issues.push(util_issue(issue)));
6549
+ "string" == typeof issue ? payload.issues.push(util_issue(issue, payload.value, def)) : (issue.fatal && (issue.continue = !1), issue.code ?? (issue.code = "custom"), issue.input ?? (issue.input = payload.value), issue.inst ?? (issue.inst = inst), payload.issues.push(util_issue(issue)));
6411
6550
  };
6412
6551
  let output = def.transform(payload.value, payload);
6413
6552
  return output instanceof Promise ? output.then((output)=>(payload.value = output, payload)) : (payload.value = output, payload);
@@ -6449,7 +6588,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
6449
6588
  });
6450
6589
  }
6451
6590
  let ZodReadonly = $constructor("ZodReadonly", (inst, def)=>{
6452
- $ZodReadonly.init(inst, def), ZodType.init(inst, def);
6591
+ $ZodReadonly.init(inst, def), ZodType.init(inst, def), inst.unwrap = ()=>inst._zod.def.innerType;
6453
6592
  }), ZodLazy = $constructor("ZodLazy", (inst, def)=>{
6454
6593
  $ZodLazy.init(inst, def), ZodType.init(inst, def), inst.unwrap = ()=>inst._zod.def.getter();
6455
6594
  });
@@ -6484,6 +6623,103 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
6484
6623
  });
6485
6624
  return inst._zod.bag.Class = cls, inst;
6486
6625
  }
6626
+ compat_ZodFirstPartyTypeKind || (compat_ZodFirstPartyTypeKind = {}), core_config({
6627
+ localeError: (Sizable = {
6628
+ string: {
6629
+ unit: "characters",
6630
+ verb: "to have"
6631
+ },
6632
+ file: {
6633
+ unit: "bytes",
6634
+ verb: "to have"
6635
+ },
6636
+ array: {
6637
+ unit: "items",
6638
+ verb: "to have"
6639
+ },
6640
+ set: {
6641
+ unit: "items",
6642
+ verb: "to have"
6643
+ }
6644
+ }, Nouns = {
6645
+ regex: "input",
6646
+ email: "email address",
6647
+ url: "URL",
6648
+ emoji: "emoji",
6649
+ uuid: "UUID",
6650
+ uuidv4: "UUIDv4",
6651
+ uuidv6: "UUIDv6",
6652
+ nanoid: "nanoid",
6653
+ guid: "GUID",
6654
+ cuid: "cuid",
6655
+ cuid2: "cuid2",
6656
+ ulid: "ULID",
6657
+ xid: "XID",
6658
+ ksuid: "KSUID",
6659
+ datetime: "ISO datetime",
6660
+ date: "ISO date",
6661
+ time: "ISO time",
6662
+ duration: "ISO duration",
6663
+ ipv4: "IPv4 address",
6664
+ ipv6: "IPv6 address",
6665
+ cidrv4: "IPv4 range",
6666
+ cidrv6: "IPv6 range",
6667
+ base64: "base64-encoded string",
6668
+ base64url: "base64url-encoded string",
6669
+ json_string: "JSON string",
6670
+ e164: "E.164 number",
6671
+ jwt: "JWT",
6672
+ template_literal: "input"
6673
+ }, (issue)=>{
6674
+ switch(issue.code){
6675
+ case "invalid_type":
6676
+ return `Invalid input: expected ${issue.expected}, received ${((data)=>{
6677
+ let t = typeof data;
6678
+ switch(t){
6679
+ case "number":
6680
+ return Number.isNaN(data) ? "NaN" : "number";
6681
+ case "object":
6682
+ if (Array.isArray(data)) return "array";
6683
+ if (null === data) return "null";
6684
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) return data.constructor.name;
6685
+ }
6686
+ return t;
6687
+ })(issue.input)}`;
6688
+ case "invalid_value":
6689
+ if (1 === issue.values.length) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
6690
+ return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
6691
+ case "too_big":
6692
+ {
6693
+ let adj = issue.inclusive ? "<=" : "<", sizing = Sizable[issue.origin] ?? null;
6694
+ if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
6695
+ return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
6696
+ }
6697
+ case "too_small":
6698
+ {
6699
+ let adj = issue.inclusive ? ">=" : ">", sizing = Sizable[issue.origin] ?? null;
6700
+ if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
6701
+ return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
6702
+ }
6703
+ case "invalid_format":
6704
+ if ("starts_with" === issue.format) return `Invalid string: must start with "${issue.prefix}"`;
6705
+ if ("ends_with" === issue.format) return `Invalid string: must end with "${issue.suffix}"`;
6706
+ if ("includes" === issue.format) return `Invalid string: must include "${issue.includes}"`;
6707
+ if ("regex" === issue.format) return `Invalid string: must match pattern ${issue.pattern}`;
6708
+ return `Invalid ${Nouns[issue.format] ?? issue.format}`;
6709
+ case "not_multiple_of":
6710
+ return `Invalid number: must be a multiple of ${issue.divisor}`;
6711
+ case "unrecognized_keys":
6712
+ return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
6713
+ case "invalid_key":
6714
+ return `Invalid key in ${issue.origin}`;
6715
+ case "invalid_union":
6716
+ default:
6717
+ return "Invalid input";
6718
+ case "invalid_element":
6719
+ return `Invalid value in ${issue.origin}`;
6720
+ }
6721
+ })
6722
+ });
6487
6723
  let numberOrInfinity = schemas_number().or(literal(1 / 0)), intOrInfinity = schemas_int().or(literal(1 / 0)), anyFunction = custom((data)=>"function" == typeof data, {
6488
6724
  error: (input)=>({
6489
6725
  message: `Expected function, received ${((data)=>{
@@ -6711,10 +6947,6 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
6711
6947
  return String(value);
6712
6948
  }
6713
6949
  }
6714
- var identifierRegex = /[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;
6715
- function isNonEmptyArray(value) {
6716
- return 0 !== value.length;
6717
- }
6718
6950
  function v4_joinValues(values, options) {
6719
6951
  let valuesToDisplay = (options.maxValuesToDisplay ? values.slice(0, options.maxValuesToDisplay) : values).map((value)=>stringify(value, {
6720
6952
  wrapStringValueInQuote: options.wrapStringValuesInQuote
@@ -6744,7 +6976,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
6744
6976
  return {
6745
6977
  type: issue.code,
6746
6978
  path: issue.path,
6747
- message: `number must be less ${issue.inclusive ? "or equal to" : "than"} ${maxValueStr}`
6979
+ message: `number must be less than${issue.inclusive ? " or equal to" : ""} ${maxValueStr}`
6748
6980
  };
6749
6981
  case "string":
6750
6982
  return {
@@ -6780,7 +7012,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
6780
7012
  return {
6781
7013
  type: issue.code,
6782
7014
  path: issue.path,
6783
- message: `value must be less ${issue.inclusive ? "or equal to" : "than"} ${maxValueStr}`
7015
+ message: `value must be less than${issue.inclusive ? " or equal to" : ""} ${maxValueStr}`
6784
7016
  };
6785
7017
  }
6786
7018
  },
@@ -6797,7 +7029,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
6797
7029
  return {
6798
7030
  type: issue.code,
6799
7031
  path: issue.path,
6800
- message: `number must be greater ${issue.inclusive ? "or equal to" : "than"} ${minValueStr}`
7032
+ message: `number must be greater than${issue.inclusive ? " or equal to" : ""} ${minValueStr}`
6801
7033
  };
6802
7034
  case "date":
6803
7035
  return {
@@ -6833,7 +7065,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
6833
7065
  return {
6834
7066
  type: issue.code,
6835
7067
  path: issue.path,
6836
- message: `value must be greater ${issue.inclusive ? "or equal to" : "than"} ${minValueStr}`
7068
+ message: `value must be greater than${issue.inclusive ? " or equal to" : ""} ${minValueStr}`
6837
7069
  };
6838
7070
  }
6839
7071
  },
@@ -6958,24 +7190,17 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
6958
7190
  return {
6959
7191
  type: issue.code,
6960
7192
  path: issue.path,
6961
- message: issue.message
7193
+ message: issue.message ?? "Invalid input"
6962
7194
  };
6963
7195
  },
6964
- invalid_union: function(issue, options) {
6965
- let errorMap = createErrorMap(options), message = Array.from(new Set(issue.errors.map((issues)=>issues.map((subIssue)=>errorMap({
6966
- ...subIssue,
6967
- path: issue.path.concat(subIssue.path)
6968
- })).join(options.issueSeparator)))).join(options.unionSeparator);
7196
+ invalid_union: function(issue) {
6969
7197
  return {
6970
7198
  type: issue.code,
6971
- path: [],
6972
- message
7199
+ path: issue.path,
7200
+ message: issue.message ?? "Invalid input"
6973
7201
  };
6974
7202
  }
6975
7203
  }, defaultErrorMapOptions = {
6976
- includePath: !0,
6977
- unionSeparator: " or ",
6978
- issueSeparator: "; ",
6979
7204
  displayInvalidFormatDetails: !1,
6980
7205
  allowedValuesSeparator: ", ",
6981
7206
  allowedValuesLastSeparator: " or ",
@@ -6985,52 +7210,20 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
6985
7210
  unrecognizedKeysLastSeparator: " and ",
6986
7211
  wrapUnrecognizedKeysInQuote: !0,
6987
7212
  maxUnrecognizedKeysToDisplay: 5,
6988
- issuesInTitleCase: !0,
6989
7213
  dateLocalization: !0,
6990
7214
  numberLocalization: !0
6991
7215
  };
6992
- function createErrorMap(partialOptions = {}) {
6993
- let options = {
6994
- ...defaultErrorMapOptions,
6995
- ...partialOptions
6996
- };
6997
- return (issue)=>void 0 === issue.code ? "Not supported issue type" : function(ast, options) {
6998
- let buf = [];
6999
- if (options.issuesInTitleCase) {
7000
- var value;
7001
- buf.push(0 === (value = ast.message).length ? value : value.charAt(0).toUpperCase() + value.slice(1));
7002
- } else buf.push(ast.message);
7003
- pathCondition: if (options.includePath && void 0 !== ast.path && isNonEmptyArray(ast.path)) {
7004
- if (1 === ast.path.length) {
7005
- let identifier = ast.path[0];
7006
- if ("number" == typeof identifier) {
7007
- buf.push(` at index ${identifier}`);
7008
- break pathCondition;
7009
- }
7010
- }
7011
- buf.push(` at "${function(path) {
7012
- if (1 === path.length) {
7013
- let propertyKey = path[0];
7014
- return "symbol" == typeof propertyKey && (propertyKey = stringifySymbol(propertyKey)), propertyKey.toString() || '""';
7015
- }
7016
- return path.reduce((acc, propertyKey)=>{
7017
- if ("number" == typeof propertyKey) return acc + "[" + propertyKey.toString() + "]";
7018
- if ("symbol" == typeof propertyKey && (propertyKey = stringifySymbol(propertyKey)), propertyKey.includes('"')) return acc + '["' + propertyKey.replace(/"/g, '\\"') + '"]';
7019
- if (!identifierRegex.test(propertyKey)) return acc + '["' + propertyKey + '"]';
7020
- let separator = 0 === acc.length ? "" : ".";
7021
- return acc + separator + propertyKey;
7022
- }, "");
7023
- }(ast.path)}"`);
7024
- }
7025
- return buf.join("");
7026
- }((0, issueParsers[issue.code])(issue, options), options);
7216
+ function isNonEmptyArray(value) {
7217
+ return 0 !== value.length;
7027
7218
  }
7028
- var defaultMessageBuilderOptions = {
7219
+ var identifierRegex = /[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u, defaultMessageBuilderOptions = {
7029
7220
  prefix: "Validation error",
7030
7221
  prefixSeparator: ": ",
7031
7222
  maxIssuesInMessage: 99,
7032
- issueSeparator: defaultErrorMapOptions.issueSeparator,
7033
- error: (issue)=>issue.message
7223
+ unionSeparator: " or ",
7224
+ issueSeparator: "; ",
7225
+ includePath: !0,
7226
+ forceTitleCase: !0
7034
7227
  };
7035
7228
  function fromZodError(zodError, options = {}) {
7036
7229
  if (!isZodErrorLike(zodError)) throw TypeError(`Invalid zodError param; expected instance of ZodError. Did you mean to use the "${fromError.name}" method instead?`);
@@ -7043,10 +7236,43 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
7043
7236
  let options = {
7044
7237
  ...defaultMessageBuilderOptions,
7045
7238
  ...partialOptions
7046
- }, errorMap = options.error;
7239
+ };
7047
7240
  return function(issues) {
7048
7241
  var message, options1;
7049
- return message = issues.slice(0, options.maxIssuesInMessage).map(errorMap).join(options.issueSeparator), null != (options1 = options).prefix ? message.length > 0 ? [
7242
+ return message = issues.slice(0, options.maxIssuesInMessage).map((issue)=>(function mapIssue(issue, options) {
7243
+ if ("invalid_union" === issue.code && isNonEmptyArray(issue.errors)) return Array.from(new Set(issue.errors.map((issues)=>issues.map((subIssue)=>mapIssue({
7244
+ ...subIssue,
7245
+ path: issue.path.concat(subIssue.path)
7246
+ }, options)).join(options.issueSeparator)))).join(options.unionSeparator);
7247
+ let buf = [];
7248
+ if (options.forceTitleCase) {
7249
+ var value;
7250
+ buf.push(0 === (value = issue.message).length ? value : value.charAt(0).toUpperCase() + value.slice(1));
7251
+ } else buf.push(issue.message);
7252
+ pathCondition: if (options.includePath && void 0 !== issue.path && isNonEmptyArray(issue.path)) {
7253
+ if (1 === issue.path.length) {
7254
+ let identifier = issue.path[0];
7255
+ if ("number" == typeof identifier) {
7256
+ buf.push(` at index ${identifier}`);
7257
+ break pathCondition;
7258
+ }
7259
+ }
7260
+ buf.push(` at "${function(path) {
7261
+ if (1 === path.length) {
7262
+ let propertyKey = path[0];
7263
+ return "symbol" == typeof propertyKey && (propertyKey = stringifySymbol(propertyKey)), propertyKey.toString() || '""';
7264
+ }
7265
+ return path.reduce((acc, propertyKey)=>{
7266
+ if ("number" == typeof propertyKey) return acc + "[" + propertyKey.toString() + "]";
7267
+ if ("symbol" == typeof propertyKey && (propertyKey = stringifySymbol(propertyKey)), propertyKey.includes('"')) return acc + '["' + propertyKey.replace(/"/g, '\\"') + '"]';
7268
+ if (!identifierRegex.test(propertyKey)) return acc + '["' + propertyKey + '"]';
7269
+ let separator = 0 === acc.length ? "" : ".";
7270
+ return acc + separator + propertyKey;
7271
+ }, "");
7272
+ }(issue.path)}"`);
7273
+ }
7274
+ return buf.join("");
7275
+ })(issue, options)).join(options.issueSeparator), null != (options1 = options).prefix ? message.length > 0 ? [
7050
7276
  options1.prefix,
7051
7277
  message
7052
7278
  ].join(options1.prefixSeparator) : options1.prefix : message.length > 0 ? message : defaultMessageBuilderOptions.prefix;
@@ -7090,12 +7316,10 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
7090
7316
  return null;
7091
7317
  }
7092
7318
  function validate_toValidationError(error) {
7093
- let customErrorMap = createErrorMap();
7094
7319
  return new validate_ValidationError(fromZodError(error, {
7095
7320
  prefix: "Invalid configuration object. Rspack has been initialized using a configuration object that does not match the API schema.",
7096
7321
  prefixSeparator: "\n- ",
7097
- issueSeparator: "\n- ",
7098
- error: customErrorMap
7322
+ issueSeparator: "\n- "
7099
7323
  }).message);
7100
7324
  }
7101
7325
  function isValidate(opts, createSchema) {
@@ -8626,7 +8850,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8626
8850
  }, applyExperimentsDefaults = (experiments, { development })=>{
8627
8851
  defaults_F(experiments, "cache", ()=>development), D(experiments, "futureDefaults", !1), D(experiments, "lazyCompilation", !1), D(experiments, "asyncWebAssembly", experiments.futureDefaults), D(experiments, "css", !!experiments.futureDefaults || void 0), D(experiments, "topLevelAwait", !0), D(experiments, "buildHttp", void 0), experiments.buildHttp && "object" == typeof experiments.buildHttp && D(experiments.buildHttp, "upgrade", !1), D(experiments, "incremental", {}), "object" == typeof experiments.incremental && (D(experiments.incremental, "silent", !0), D(experiments.incremental, "make", !0), D(experiments.incremental, "inferAsyncModules", !0), D(experiments.incremental, "providedExports", !0), D(experiments.incremental, "dependenciesDiagnostics", !0), D(experiments.incremental, "sideEffects", !0), D(experiments.incremental, "buildChunkGraph", !1), D(experiments.incremental, "moduleIds", !0), D(experiments.incremental, "chunkIds", !0), D(experiments.incremental, "modulesHashes", !0), D(experiments.incremental, "modulesCodegen", !0), D(experiments.incremental, "modulesRuntimeRequirements", !0), D(experiments.incremental, "chunksRuntimeRequirements", !0), D(experiments.incremental, "chunksHashes", !0), D(experiments.incremental, "chunksRender", !0), D(experiments.incremental, "emitAssets", !0)), D(experiments, "rspackFuture", {}), D(experiments, "parallelCodeSplitting", !1), D(experiments, "parallelLoader", !1), D(experiments, "useInputFileSystem", !1), D(experiments, "inlineConst", !1), D(experiments, "inlineEnum", !1), D(experiments, "typeReexportsPresence", !1), D(experiments, "lazyBarrel", !0);
8628
8852
  }, applybundlerInfoDefaults = (rspackFuture, library)=>{
8629
- "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.6.0-canary-17d2172b-20251016033144"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
8853
+ "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.6.0-canary-c1ffd5c5-20251016085846"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
8630
8854
  }, applySnapshotDefaults = (_snapshot, _env)=>{}, applyModuleDefaults = (module1, { asyncWebAssembly, css, targetProperties, mode, uniqueName, usedExports, inlineConst })=>{
8631
8855
  if (assertNotNill(module1.parser), assertNotNill(module1.generator), defaults_F(module1.parser, "asset", ()=>({})), assertNotNill(module1.parser.asset), defaults_F(module1.parser.asset, "dataUrlCondition", ()=>({})), "object" == typeof module1.parser.asset.dataUrlCondition && D(module1.parser.asset.dataUrlCondition, "maxSize", 8096), defaults_F(module1.parser, "javascript", ()=>({})), assertNotNill(module1.parser.javascript), ((parserOptions, { usedExports, inlineConst })=>{
8632
8856
  D(parserOptions, "dynamicImportMode", "lazy"), D(parserOptions, "dynamicImportPrefetch", !1), D(parserOptions, "dynamicImportPreload", !1), D(parserOptions, "url", !0), D(parserOptions, "exprContextCritical", !0), D(parserOptions, "unknownContextCritical", !0), D(parserOptions, "wrappedContextCritical", !1), D(parserOptions, "wrappedContextRegExp", /.*/), D(parserOptions, "strictExportPresence", !1), D(parserOptions, "requireAsExpression", !0), D(parserOptions, "requireDynamic", !0), D(parserOptions, "requireResolve", !0), D(parserOptions, "commonjs", !0), D(parserOptions, "importDynamic", !0), D(parserOptions, "worker", [
@@ -10267,7 +10491,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
10267
10491
  });
10268
10492
  }
10269
10493
  }
10270
- let CORE_VERSION = "1.6.0-canary-17d2172b-20251016033144", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
10494
+ let CORE_VERSION = "1.6.0-canary-c1ffd5c5-20251016085846", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
10271
10495
 
10272
10496
  Help:
10273
10497
  Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
@@ -11545,7 +11769,7 @@ Help:
11545
11769
  obj.children = this.stats.map((stat, idx)=>{
11546
11770
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
11547
11771
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
11548
- }), childOptions.version && (obj.rspackVersion = "1.6.0-canary-17d2172b-20251016033144", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
11772
+ }), childOptions.version && (obj.rspackVersion = "1.6.0-canary-c1ffd5c5-20251016085846", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
11549
11773
  let mapError = (j, obj)=>({
11550
11774
  ...obj,
11551
11775
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -12441,7 +12665,7 @@ Help:
12441
12665
  object.hash = context.getStatsCompilation(compilation).hash;
12442
12666
  },
12443
12667
  version: (object)=>{
12444
- object.version = "5.75.0", object.rspackVersion = "1.6.0-canary-17d2172b-20251016033144";
12668
+ object.version = "5.75.0", object.rspackVersion = "1.6.0-canary-c1ffd5c5-20251016085846";
12445
12669
  },
12446
12670
  env: (object, _compilation, _context, { _env })=>{
12447
12671
  object.env = _env;
@@ -14657,7 +14881,14 @@ Help:
14657
14881
  }).partial();
14658
14882
  });
14659
14883
  core_config({
14660
- jitless: !0
14884
+ jitless: !0,
14885
+ customError: function(partialOptions = {}) {
14886
+ let options = {
14887
+ ...defaultErrorMapOptions,
14888
+ ...partialOptions
14889
+ };
14890
+ return (issue)=>void 0 === issue.code ? "Not supported issue type" : (0, issueParsers[issue.code])(issue, options).message;
14891
+ }()
14661
14892
  });
14662
14893
  let getExternalsTypeSchema = memoize(()=>schemas_enum([
14663
14894
  "var",
@@ -14891,10 +15122,7 @@ Help:
14891
15122
  let res = getZodSwcLoaderOptionsSchema().safeParse(data.options);
14892
15123
  if (!res.success) {
14893
15124
  let validationErr = fromZodError(res.error, {
14894
- prefix: "Invalid options for 'builtin:swc-loader'",
14895
- error: createErrorMap({
14896
- issuesInTitleCase: !1
14897
- })
15125
+ prefix: "Invalid options for 'builtin:swc-loader'"
14898
15126
  });
14899
15127
  ctx.issues.push({
14900
15128
  code: "custom",
@@ -15767,7 +15995,7 @@ Help:
15767
15995
  let _options = JSON.stringify(options || {});
15768
15996
  return binding_default().transform(source, _options);
15769
15997
  }
15770
- let exports_rspackVersion = "1.6.0-canary-17d2172b-20251016033144", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
15998
+ let exports_rspackVersion = "1.6.0-canary-c1ffd5c5-20251016085846", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
15771
15999
  getNormalizedRspackOptions: getNormalizedRspackOptions,
15772
16000
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
15773
16001
  getNormalizedWebpackOptions: getNormalizedRspackOptions,