@iflyrpa/share 0.0.15-beta.1 → 0.0.15-beta.2

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.mjs CHANGED
@@ -178,17 +178,17 @@ async function downloadImage(url, savePath) {
178
178
  default:
179
179
  break;
180
180
  }
181
- customMessage.message = "请求图片时" + customMessage.message;
181
+ customMessage.message = `请求图片时${customMessage.message}`;
182
182
  customMessage.extra = {
183
183
  url
184
184
  };
185
185
  reject(customMessage);
186
186
  };
187
- const req = __WEBPACK_EXTERNAL_MODULE_node_https_626f33a7__["default"].get(url, handleResponse);
187
+ const req = __WEBPACK_EXTERNAL_MODULE_node_https_626f33a7__["default"].get(decodeURIComponent(url), handleResponse);
188
188
  req.setTimeout(10000, ()=>{
189
189
  req.destroy();
190
190
  reject({
191
- code: 200,
191
+ code: 500,
192
192
  message: "图片下载超时,请检查网络连接或稍后重试!"
193
193
  });
194
194
  });
@@ -197,7 +197,9 @@ async function downloadImage(url, savePath) {
197
197
  }
198
198
  function getFilenameFromUrl(imageUrl) {
199
199
  const parsedUrl = new URL(imageUrl);
200
- return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(parsedUrl.pathname);
200
+ const fileName = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(parsedUrl.pathname);
201
+ const ext = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(fileName);
202
+ return ext ? fileName : `${fileName}.png`;
201
203
  }
202
204
  const sleep = (ms)=>new Promise((resolve)=>setTimeout(resolve, ms));
203
205
  const success = (data, message)=>({
@@ -205,10 +207,3402 @@ const success = (data, message)=>({
205
207
  message: message || "发布成功",
206
208
  data
207
209
  });
210
+ const utils_response = (code, message, data)=>({
211
+ code,
212
+ message: message || "操作成功",
213
+ data
214
+ });
208
215
  const randomString = (length)=>{
209
216
  let T = "";
210
217
  const H = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
211
218
  for(let de = 0; de < length; de++)T += H.charAt(Math.floor(Math.random() * H.length));
212
219
  return T;
213
220
  };
214
- export { downloadImage, ensureFile, ensureFileSync, fetchJSON, getFilenameFromUrl, isNil, pathExists, randomString, semver, sleep, success, writeFile };
221
+ Object.freeze({
222
+ status: "aborted"
223
+ });
224
+ function $constructor(name, initializer, params) {
225
+ function init(inst, def) {
226
+ var _a;
227
+ Object.defineProperty(inst, "_zod", {
228
+ value: inst._zod ?? {},
229
+ enumerable: false
230
+ });
231
+ (_a = inst._zod).traits ?? (_a.traits = new Set());
232
+ inst._zod.traits.add(name);
233
+ initializer(inst, def);
234
+ for(const k in _.prototype)if (!(k in inst)) Object.defineProperty(inst, k, {
235
+ value: _.prototype[k].bind(inst)
236
+ });
237
+ inst._zod.constr = _;
238
+ inst._zod.def = def;
239
+ }
240
+ const Parent = params?.Parent ?? Object;
241
+ class Definition extends Parent {
242
+ }
243
+ Object.defineProperty(Definition, "name", {
244
+ value: name
245
+ });
246
+ function _(def) {
247
+ var _a;
248
+ const inst = params?.Parent ? new Definition() : this;
249
+ init(inst, def);
250
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
251
+ for (const fn of inst._zod.deferred)fn();
252
+ return inst;
253
+ }
254
+ Object.defineProperty(_, "init", {
255
+ value: init
256
+ });
257
+ Object.defineProperty(_, Symbol.hasInstance, {
258
+ value: (inst)=>{
259
+ if (params?.Parent && inst instanceof params.Parent) return true;
260
+ return inst?._zod?.traits?.has(name);
261
+ }
262
+ });
263
+ Object.defineProperty(_, "name", {
264
+ value: name
265
+ });
266
+ return _;
267
+ }
268
+ Symbol("zod_brand");
269
+ class $ZodAsyncError extends Error {
270
+ constructor(){
271
+ super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
272
+ }
273
+ }
274
+ class $ZodEncodeError extends Error {
275
+ constructor(name){
276
+ super(`Encountered unidirectional transform during encode: ${name}`);
277
+ this.name = "ZodEncodeError";
278
+ }
279
+ }
280
+ const globalConfig = {};
281
+ function core_config(newConfig) {
282
+ if (newConfig) Object.assign(globalConfig, newConfig);
283
+ return globalConfig;
284
+ }
285
+ function util_getEnumValues(entries) {
286
+ const numericValues = Object.values(entries).filter((v)=>"number" == typeof v);
287
+ const values = Object.entries(entries).filter(([k, _])=>-1 === numericValues.indexOf(+k)).map(([_, v])=>v);
288
+ return values;
289
+ }
290
+ function joinValues(array, separator = "|") {
291
+ return array.map((val)=>stringifyPrimitive(val)).join(separator);
292
+ }
293
+ function jsonStringifyReplacer(_, value) {
294
+ if ("bigint" == typeof value) return value.toString();
295
+ return value;
296
+ }
297
+ function cached(getter) {
298
+ const set = false;
299
+ return {
300
+ get value () {
301
+ if (!set) {
302
+ const value = getter();
303
+ Object.defineProperty(this, "value", {
304
+ value
305
+ });
306
+ return value;
307
+ }
308
+ throw new Error("cached value already set");
309
+ }
310
+ };
311
+ }
312
+ function nullish(input) {
313
+ return null == input;
314
+ }
315
+ function cleanRegex(source) {
316
+ const start = source.startsWith("^") ? 1 : 0;
317
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
318
+ return source.slice(start, end);
319
+ }
320
+ function floatSafeRemainder(val, step) {
321
+ const valDecCount = (val.toString().split(".")[1] || "").length;
322
+ const stepString = step.toString();
323
+ let stepDecCount = (stepString.split(".")[1] || "").length;
324
+ if (0 === stepDecCount && /\d?e-\d?/.test(stepString)) {
325
+ const match = stepString.match(/\d?e-(\d?)/);
326
+ if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
327
+ }
328
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
329
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
330
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
331
+ return valInt % stepInt / 10 ** decCount;
332
+ }
333
+ const EVALUATING = Symbol("evaluating");
334
+ function defineLazy(object, key, getter) {
335
+ let value;
336
+ Object.defineProperty(object, key, {
337
+ get () {
338
+ if (value === EVALUATING) return;
339
+ if (void 0 === value) {
340
+ value = EVALUATING;
341
+ value = getter();
342
+ }
343
+ return value;
344
+ },
345
+ set (v) {
346
+ Object.defineProperty(object, key, {
347
+ value: v
348
+ });
349
+ },
350
+ configurable: true
351
+ });
352
+ }
353
+ function assignProp(target, prop, value) {
354
+ Object.defineProperty(target, prop, {
355
+ value,
356
+ writable: true,
357
+ enumerable: true,
358
+ configurable: true
359
+ });
360
+ }
361
+ function mergeDefs(...defs) {
362
+ const mergedDescriptors = {};
363
+ for (const def of defs){
364
+ const descriptors = Object.getOwnPropertyDescriptors(def);
365
+ Object.assign(mergedDescriptors, descriptors);
366
+ }
367
+ return Object.defineProperties({}, mergedDescriptors);
368
+ }
369
+ function esc(str) {
370
+ return JSON.stringify(str);
371
+ }
372
+ const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args)=>{};
373
+ function util_isObject(data) {
374
+ return "object" == typeof data && null !== data && !Array.isArray(data);
375
+ }
376
+ const util_allowsEval = cached(()=>{
377
+ if ("undefined" != typeof navigator && navigator?.userAgent?.includes("Cloudflare")) return false;
378
+ try {
379
+ const F = Function;
380
+ new F("");
381
+ return true;
382
+ } catch (_) {
383
+ return false;
384
+ }
385
+ });
386
+ function isPlainObject(o) {
387
+ if (false === util_isObject(o)) return false;
388
+ const ctor = o.constructor;
389
+ if (void 0 === ctor) return true;
390
+ const prot = ctor.prototype;
391
+ if (false === util_isObject(prot)) return false;
392
+ if (false === Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf")) return false;
393
+ return true;
394
+ }
395
+ function shallowClone(o) {
396
+ if (isPlainObject(o)) return {
397
+ ...o
398
+ };
399
+ if (Array.isArray(o)) return [
400
+ ...o
401
+ ];
402
+ return o;
403
+ }
404
+ const propertyKeyTypes = new Set([
405
+ "string",
406
+ "number",
407
+ "symbol"
408
+ ]);
409
+ new Set([
410
+ "string",
411
+ "number",
412
+ "bigint",
413
+ "boolean",
414
+ "symbol",
415
+ "undefined"
416
+ ]);
417
+ function escapeRegex(str) {
418
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
419
+ }
420
+ function clone(inst, def, params) {
421
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
422
+ if (!def || params?.parent) cl._zod.parent = inst;
423
+ return cl;
424
+ }
425
+ function normalizeParams(_params) {
426
+ const params = _params;
427
+ if (!params) return {};
428
+ if ("string" == typeof params) return {
429
+ error: ()=>params
430
+ };
431
+ if (params?.message !== void 0) {
432
+ if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
433
+ params.error = params.message;
434
+ }
435
+ delete params.message;
436
+ if ("string" == typeof params.error) return {
437
+ ...params,
438
+ error: ()=>params.error
439
+ };
440
+ return params;
441
+ }
442
+ function stringifyPrimitive(value) {
443
+ if ("bigint" == typeof value) return value.toString() + "n";
444
+ if ("string" == typeof value) return `"${value}"`;
445
+ return `${value}`;
446
+ }
447
+ function optionalKeys(shape) {
448
+ return Object.keys(shape).filter((k)=>"optional" === shape[k]._zod.optin && "optional" === shape[k]._zod.optout);
449
+ }
450
+ const NUMBER_FORMAT_RANGES = {
451
+ safeint: [
452
+ Number.MIN_SAFE_INTEGER,
453
+ Number.MAX_SAFE_INTEGER
454
+ ],
455
+ int32: [
456
+ -2147483648,
457
+ 2147483647
458
+ ],
459
+ uint32: [
460
+ 0,
461
+ 4294967295
462
+ ],
463
+ float32: [
464
+ -340282346638528860000000000000000000000,
465
+ 3.4028234663852886e38
466
+ ],
467
+ float64: [
468
+ -Number.MAX_VALUE,
469
+ Number.MAX_VALUE
470
+ ]
471
+ };
472
+ function pick(schema, mask) {
473
+ const currDef = schema._zod.def;
474
+ const def = mergeDefs(schema._zod.def, {
475
+ get shape () {
476
+ const newShape = {};
477
+ for(const key in mask){
478
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
479
+ if (!!mask[key]) newShape[key] = currDef.shape[key];
480
+ }
481
+ assignProp(this, "shape", newShape);
482
+ return newShape;
483
+ },
484
+ checks: []
485
+ });
486
+ return clone(schema, def);
487
+ }
488
+ function omit(schema, mask) {
489
+ const currDef = schema._zod.def;
490
+ const def = mergeDefs(schema._zod.def, {
491
+ get shape () {
492
+ const newShape = {
493
+ ...schema._zod.def.shape
494
+ };
495
+ for(const key in mask){
496
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
497
+ if (!!mask[key]) delete newShape[key];
498
+ }
499
+ assignProp(this, "shape", newShape);
500
+ return newShape;
501
+ },
502
+ checks: []
503
+ });
504
+ return clone(schema, def);
505
+ }
506
+ function extend(schema, shape) {
507
+ if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
508
+ const checks = schema._zod.def.checks;
509
+ const hasChecks = checks && checks.length > 0;
510
+ if (hasChecks) throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
511
+ const def = mergeDefs(schema._zod.def, {
512
+ get shape () {
513
+ const _shape = {
514
+ ...schema._zod.def.shape,
515
+ ...shape
516
+ };
517
+ assignProp(this, "shape", _shape);
518
+ return _shape;
519
+ },
520
+ checks: []
521
+ });
522
+ return clone(schema, def);
523
+ }
524
+ function safeExtend(schema, shape) {
525
+ if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
526
+ const def = {
527
+ ...schema._zod.def,
528
+ get shape () {
529
+ const _shape = {
530
+ ...schema._zod.def.shape,
531
+ ...shape
532
+ };
533
+ assignProp(this, "shape", _shape);
534
+ return _shape;
535
+ },
536
+ checks: schema._zod.def.checks
537
+ };
538
+ return clone(schema, def);
539
+ }
540
+ function merge(a, b) {
541
+ const def = mergeDefs(a._zod.def, {
542
+ get shape () {
543
+ const _shape = {
544
+ ...a._zod.def.shape,
545
+ ...b._zod.def.shape
546
+ };
547
+ assignProp(this, "shape", _shape);
548
+ return _shape;
549
+ },
550
+ get catchall () {
551
+ return b._zod.def.catchall;
552
+ },
553
+ checks: []
554
+ });
555
+ return clone(a, def);
556
+ }
557
+ function partial(Class, schema, mask) {
558
+ const def = mergeDefs(schema._zod.def, {
559
+ get shape () {
560
+ const oldShape = schema._zod.def.shape;
561
+ const shape = {
562
+ ...oldShape
563
+ };
564
+ if (mask) for(const key in mask){
565
+ if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
566
+ if (!!mask[key]) shape[key] = Class ? new Class({
567
+ type: "optional",
568
+ innerType: oldShape[key]
569
+ }) : oldShape[key];
570
+ }
571
+ else for(const key in oldShape)shape[key] = Class ? new Class({
572
+ type: "optional",
573
+ innerType: oldShape[key]
574
+ }) : oldShape[key];
575
+ assignProp(this, "shape", shape);
576
+ return shape;
577
+ },
578
+ checks: []
579
+ });
580
+ return clone(schema, def);
581
+ }
582
+ function required(Class, schema, mask) {
583
+ const def = mergeDefs(schema._zod.def, {
584
+ get shape () {
585
+ const oldShape = schema._zod.def.shape;
586
+ const shape = {
587
+ ...oldShape
588
+ };
589
+ if (mask) for(const key in mask){
590
+ if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
591
+ if (!!mask[key]) shape[key] = new Class({
592
+ type: "nonoptional",
593
+ innerType: oldShape[key]
594
+ });
595
+ }
596
+ else for(const key in oldShape)shape[key] = new Class({
597
+ type: "nonoptional",
598
+ innerType: oldShape[key]
599
+ });
600
+ assignProp(this, "shape", shape);
601
+ return shape;
602
+ },
603
+ checks: []
604
+ });
605
+ return clone(schema, def);
606
+ }
607
+ function aborted(x, startIndex = 0) {
608
+ if (true === x.aborted) return true;
609
+ for(let i = startIndex; i < x.issues.length; i++)if (x.issues[i]?.continue !== true) return true;
610
+ return false;
611
+ }
612
+ function prefixIssues(path, issues) {
613
+ return issues.map((iss)=>{
614
+ var _a;
615
+ (_a = iss).path ?? (_a.path = []);
616
+ iss.path.unshift(path);
617
+ return iss;
618
+ });
619
+ }
620
+ function unwrapMessage(message) {
621
+ return "string" == typeof message ? message : message?.message;
622
+ }
623
+ function finalizeIssue(iss, ctx, config) {
624
+ const full = {
625
+ ...iss,
626
+ path: iss.path ?? []
627
+ };
628
+ if (!iss.message) {
629
+ const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
630
+ full.message = message;
631
+ }
632
+ delete full.inst;
633
+ delete full.continue;
634
+ if (!ctx?.reportInput) delete full.input;
635
+ return full;
636
+ }
637
+ function getLengthableOrigin(input) {
638
+ if (Array.isArray(input)) return "array";
639
+ if ("string" == typeof input) return "string";
640
+ return "unknown";
641
+ }
642
+ function util_issue(...args) {
643
+ const [iss, input, inst] = args;
644
+ if ("string" == typeof iss) return {
645
+ message: iss,
646
+ code: "custom",
647
+ input,
648
+ inst
649
+ };
650
+ return {
651
+ ...iss
652
+ };
653
+ }
654
+ const errors_initializer = (inst, def)=>{
655
+ inst.name = "$ZodError";
656
+ Object.defineProperty(inst, "_zod", {
657
+ value: inst._zod,
658
+ enumerable: false
659
+ });
660
+ Object.defineProperty(inst, "issues", {
661
+ value: def,
662
+ enumerable: false
663
+ });
664
+ inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
665
+ Object.defineProperty(inst, "toString", {
666
+ value: ()=>inst.message,
667
+ enumerable: false
668
+ });
669
+ };
670
+ const $ZodError = $constructor("$ZodError", errors_initializer);
671
+ const $ZodRealError = $constructor("$ZodError", errors_initializer, {
672
+ Parent: Error
673
+ });
674
+ function flattenError(error, mapper = (issue)=>issue.message) {
675
+ const fieldErrors = {};
676
+ const formErrors = [];
677
+ for (const sub of error.issues)if (sub.path.length > 0) {
678
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
679
+ fieldErrors[sub.path[0]].push(mapper(sub));
680
+ } else formErrors.push(mapper(sub));
681
+ return {
682
+ formErrors,
683
+ fieldErrors
684
+ };
685
+ }
686
+ function formatError(error, mapper = (issue)=>issue.message) {
687
+ const fieldErrors = {
688
+ _errors: []
689
+ };
690
+ const processError = (error)=>{
691
+ for (const issue of error.issues)if ("invalid_union" === issue.code && issue.errors.length) issue.errors.map((issues)=>processError({
692
+ issues
693
+ }));
694
+ else if ("invalid_key" === issue.code) processError({
695
+ issues: issue.issues
696
+ });
697
+ else if ("invalid_element" === issue.code) processError({
698
+ issues: issue.issues
699
+ });
700
+ else if (0 === issue.path.length) fieldErrors._errors.push(mapper(issue));
701
+ else {
702
+ let curr = fieldErrors;
703
+ let i = 0;
704
+ while(i < issue.path.length){
705
+ const el = issue.path[i];
706
+ const terminal = i === issue.path.length - 1;
707
+ if (terminal) {
708
+ curr[el] = curr[el] || {
709
+ _errors: []
710
+ };
711
+ curr[el]._errors.push(mapper(issue));
712
+ } else curr[el] = curr[el] || {
713
+ _errors: []
714
+ };
715
+ curr = curr[el];
716
+ i++;
717
+ }
718
+ }
719
+ };
720
+ processError(error);
721
+ return fieldErrors;
722
+ }
723
+ const _parse = (_Err)=>(schema, value, _ctx, _params)=>{
724
+ const ctx = _ctx ? Object.assign(_ctx, {
725
+ async: false
726
+ }) : {
727
+ async: false
728
+ };
729
+ const result = schema._zod.run({
730
+ value,
731
+ issues: []
732
+ }, ctx);
733
+ if (result instanceof Promise) throw new $ZodAsyncError();
734
+ if (result.issues.length) {
735
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())));
736
+ captureStackTrace(e, _params?.callee);
737
+ throw e;
738
+ }
739
+ return result.value;
740
+ };
741
+ const _parseAsync = (_Err)=>async (schema, value, _ctx, params)=>{
742
+ const ctx = _ctx ? Object.assign(_ctx, {
743
+ async: true
744
+ }) : {
745
+ async: true
746
+ };
747
+ let result = schema._zod.run({
748
+ value,
749
+ issues: []
750
+ }, ctx);
751
+ if (result instanceof Promise) result = await result;
752
+ if (result.issues.length) {
753
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())));
754
+ captureStackTrace(e, params?.callee);
755
+ throw e;
756
+ }
757
+ return result.value;
758
+ };
759
+ const _safeParse = (_Err)=>(schema, value, _ctx)=>{
760
+ const ctx = _ctx ? {
761
+ ..._ctx,
762
+ async: false
763
+ } : {
764
+ async: false
765
+ };
766
+ const result = schema._zod.run({
767
+ value,
768
+ issues: []
769
+ }, ctx);
770
+ if (result instanceof Promise) throw new $ZodAsyncError();
771
+ return result.issues.length ? {
772
+ success: false,
773
+ error: new (_Err ?? $ZodError)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
774
+ } : {
775
+ success: true,
776
+ data: result.value
777
+ };
778
+ };
779
+ const safeParse = /* @__PURE__*/ _safeParse($ZodRealError);
780
+ const _safeParseAsync = (_Err)=>async (schema, value, _ctx)=>{
781
+ const ctx = _ctx ? Object.assign(_ctx, {
782
+ async: true
783
+ }) : {
784
+ async: true
785
+ };
786
+ let result = schema._zod.run({
787
+ value,
788
+ issues: []
789
+ }, ctx);
790
+ if (result instanceof Promise) result = await result;
791
+ return result.issues.length ? {
792
+ success: false,
793
+ error: new _Err(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
794
+ } : {
795
+ success: true,
796
+ data: result.value
797
+ };
798
+ };
799
+ const safeParseAsync = /* @__PURE__*/ _safeParseAsync($ZodRealError);
800
+ const _encode = (_Err)=>(schema, value, _ctx)=>{
801
+ const ctx = _ctx ? Object.assign(_ctx, {
802
+ direction: "backward"
803
+ }) : {
804
+ direction: "backward"
805
+ };
806
+ return _parse(_Err)(schema, value, ctx);
807
+ };
808
+ const _decode = (_Err)=>(schema, value, _ctx)=>_parse(_Err)(schema, value, _ctx);
809
+ const _encodeAsync = (_Err)=>async (schema, value, _ctx)=>{
810
+ const ctx = _ctx ? Object.assign(_ctx, {
811
+ direction: "backward"
812
+ }) : {
813
+ direction: "backward"
814
+ };
815
+ return _parseAsync(_Err)(schema, value, ctx);
816
+ };
817
+ const _decodeAsync = (_Err)=>async (schema, value, _ctx)=>_parseAsync(_Err)(schema, value, _ctx);
818
+ const _safeEncode = (_Err)=>(schema, value, _ctx)=>{
819
+ const ctx = _ctx ? Object.assign(_ctx, {
820
+ direction: "backward"
821
+ }) : {
822
+ direction: "backward"
823
+ };
824
+ return _safeParse(_Err)(schema, value, ctx);
825
+ };
826
+ const _safeDecode = (_Err)=>(schema, value, _ctx)=>_safeParse(_Err)(schema, value, _ctx);
827
+ const _safeEncodeAsync = (_Err)=>async (schema, value, _ctx)=>{
828
+ const ctx = _ctx ? Object.assign(_ctx, {
829
+ direction: "backward"
830
+ }) : {
831
+ direction: "backward"
832
+ };
833
+ return _safeParseAsync(_Err)(schema, value, ctx);
834
+ };
835
+ const _safeDecodeAsync = (_Err)=>async (schema, value, _ctx)=>_safeParseAsync(_Err)(schema, value, _ctx);
836
+ const cuid = /^[cC][^\s-]{8,}$/;
837
+ const cuid2 = /^[0-9a-z]+$/;
838
+ const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
839
+ const xid = /^[0-9a-vA-V]{20}$/;
840
+ const ksuid = /^[A-Za-z0-9]{27}$/;
841
+ const nanoid = /^[a-zA-Z0-9_-]{21}$/;
842
+ const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
843
+ const 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})$/;
844
+ const uuid = (version)=>{
845
+ if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
846
+ return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
847
+ };
848
+ const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
849
+ const _emoji = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
850
+ function emoji() {
851
+ return new RegExp(_emoji, "u");
852
+ }
853
+ const 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])$/;
854
+ const 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}|:))$/;
855
+ const 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])$/;
856
+ const 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])$/;
857
+ const regexes_base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
858
+ const regexes_base64url = /^[A-Za-z0-9_-]*$/;
859
+ const 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])?)*\.?$/;
860
+ const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
861
+ const 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])))";
862
+ const date = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
863
+ function timeSource(args) {
864
+ const hhmm = "(?:[01]\\d|2[0-3]):[0-5]\\d";
865
+ const regex = "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+)?)?`;
866
+ return regex;
867
+ }
868
+ function regexes_time(args) {
869
+ return new RegExp(`^${timeSource(args)}$`);
870
+ }
871
+ function datetime(args) {
872
+ const time = timeSource({
873
+ precision: args.precision
874
+ });
875
+ const opts = [
876
+ "Z"
877
+ ];
878
+ if (args.local) opts.push("");
879
+ if (args.offset) opts.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
880
+ const timeRegex = `${time}(?:${opts.join("|")})`;
881
+ return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
882
+ }
883
+ const string = (params)=>{
884
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : "[\\s\\S]*";
885
+ return new RegExp(`^${regex}$`);
886
+ };
887
+ const integer = /^-?\d+$/;
888
+ const regexes_number = /^-?\d+(?:\.\d+)?/;
889
+ const regexes_boolean = /^(?:true|false)$/i;
890
+ const lowercase = /^[^A-Z]*$/;
891
+ const uppercase = /^[^a-z]*$/;
892
+ const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def)=>{
893
+ var _a;
894
+ inst._zod ?? (inst._zod = {});
895
+ inst._zod.def = def;
896
+ (_a = inst._zod).onattach ?? (_a.onattach = []);
897
+ });
898
+ const numericOriginMap = {
899
+ number: "number",
900
+ bigint: "bigint",
901
+ object: "date"
902
+ };
903
+ const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def)=>{
904
+ $ZodCheck.init(inst, def);
905
+ const origin = numericOriginMap[typeof def.value];
906
+ inst._zod.onattach.push((inst)=>{
907
+ const bag = inst._zod.bag;
908
+ const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
909
+ if (def.value < curr) {
910
+ if (def.inclusive) bag.maximum = def.value;
911
+ else bag.exclusiveMaximum = def.value;
912
+ }
913
+ });
914
+ inst._zod.check = (payload)=>{
915
+ if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
916
+ payload.issues.push({
917
+ origin,
918
+ code: "too_big",
919
+ maximum: def.value,
920
+ input: payload.value,
921
+ inclusive: def.inclusive,
922
+ inst,
923
+ continue: !def.abort
924
+ });
925
+ };
926
+ });
927
+ const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def)=>{
928
+ $ZodCheck.init(inst, def);
929
+ const origin = numericOriginMap[typeof def.value];
930
+ inst._zod.onattach.push((inst)=>{
931
+ const bag = inst._zod.bag;
932
+ const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
933
+ if (def.value > curr) {
934
+ if (def.inclusive) bag.minimum = def.value;
935
+ else bag.exclusiveMinimum = def.value;
936
+ }
937
+ });
938
+ inst._zod.check = (payload)=>{
939
+ if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
940
+ payload.issues.push({
941
+ origin,
942
+ code: "too_small",
943
+ minimum: def.value,
944
+ input: payload.value,
945
+ inclusive: def.inclusive,
946
+ inst,
947
+ continue: !def.abort
948
+ });
949
+ };
950
+ });
951
+ const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def)=>{
952
+ $ZodCheck.init(inst, def);
953
+ inst._zod.onattach.push((inst)=>{
954
+ var _a;
955
+ (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
956
+ });
957
+ inst._zod.check = (payload)=>{
958
+ if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
959
+ const isMultiple = "bigint" == typeof payload.value ? payload.value % def.value === BigInt(0) : 0 === floatSafeRemainder(payload.value, def.value);
960
+ if (isMultiple) return;
961
+ payload.issues.push({
962
+ origin: typeof payload.value,
963
+ code: "not_multiple_of",
964
+ divisor: def.value,
965
+ input: payload.value,
966
+ inst,
967
+ continue: !def.abort
968
+ });
969
+ };
970
+ });
971
+ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat", (inst, def)=>{
972
+ $ZodCheck.init(inst, def);
973
+ def.format = def.format || "float64";
974
+ const isInt = def.format?.includes("int");
975
+ const origin = isInt ? "int" : "number";
976
+ const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
977
+ inst._zod.onattach.push((inst)=>{
978
+ const bag = inst._zod.bag;
979
+ bag.format = def.format;
980
+ bag.minimum = minimum;
981
+ bag.maximum = maximum;
982
+ if (isInt) bag.pattern = integer;
983
+ });
984
+ inst._zod.check = (payload)=>{
985
+ const input = payload.value;
986
+ if (isInt) {
987
+ if (!Number.isInteger(input)) {
988
+ payload.issues.push({
989
+ expected: origin,
990
+ format: def.format,
991
+ code: "invalid_type",
992
+ continue: false,
993
+ input,
994
+ inst
995
+ });
996
+ return;
997
+ }
998
+ if (!Number.isSafeInteger(input)) {
999
+ if (input > 0) payload.issues.push({
1000
+ input,
1001
+ code: "too_big",
1002
+ maximum: Number.MAX_SAFE_INTEGER,
1003
+ note: "Integers must be within the safe integer range.",
1004
+ inst,
1005
+ origin,
1006
+ continue: !def.abort
1007
+ });
1008
+ else payload.issues.push({
1009
+ input,
1010
+ code: "too_small",
1011
+ minimum: Number.MIN_SAFE_INTEGER,
1012
+ note: "Integers must be within the safe integer range.",
1013
+ inst,
1014
+ origin,
1015
+ continue: !def.abort
1016
+ });
1017
+ return;
1018
+ }
1019
+ }
1020
+ if (input < minimum) payload.issues.push({
1021
+ origin: "number",
1022
+ input,
1023
+ code: "too_small",
1024
+ minimum,
1025
+ inclusive: true,
1026
+ inst,
1027
+ continue: !def.abort
1028
+ });
1029
+ if (input > maximum) payload.issues.push({
1030
+ origin: "number",
1031
+ input,
1032
+ code: "too_big",
1033
+ maximum,
1034
+ inst
1035
+ });
1036
+ };
1037
+ });
1038
+ const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def)=>{
1039
+ var _a;
1040
+ $ZodCheck.init(inst, def);
1041
+ (_a = inst._zod.def).when ?? (_a.when = (payload)=>{
1042
+ const val = payload.value;
1043
+ return !nullish(val) && void 0 !== val.length;
1044
+ });
1045
+ inst._zod.onattach.push((inst)=>{
1046
+ const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1047
+ if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
1048
+ });
1049
+ inst._zod.check = (payload)=>{
1050
+ const input = payload.value;
1051
+ const length = input.length;
1052
+ if (length <= def.maximum) return;
1053
+ const origin = getLengthableOrigin(input);
1054
+ payload.issues.push({
1055
+ origin,
1056
+ code: "too_big",
1057
+ maximum: def.maximum,
1058
+ inclusive: true,
1059
+ input,
1060
+ inst,
1061
+ continue: !def.abort
1062
+ });
1063
+ };
1064
+ });
1065
+ const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def)=>{
1066
+ var _a;
1067
+ $ZodCheck.init(inst, def);
1068
+ (_a = inst._zod.def).when ?? (_a.when = (payload)=>{
1069
+ const val = payload.value;
1070
+ return !nullish(val) && void 0 !== val.length;
1071
+ });
1072
+ inst._zod.onattach.push((inst)=>{
1073
+ const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1074
+ if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
1075
+ });
1076
+ inst._zod.check = (payload)=>{
1077
+ const input = payload.value;
1078
+ const length = input.length;
1079
+ if (length >= def.minimum) return;
1080
+ const origin = getLengthableOrigin(input);
1081
+ payload.issues.push({
1082
+ origin,
1083
+ code: "too_small",
1084
+ minimum: def.minimum,
1085
+ inclusive: true,
1086
+ input,
1087
+ inst,
1088
+ continue: !def.abort
1089
+ });
1090
+ };
1091
+ });
1092
+ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def)=>{
1093
+ var _a;
1094
+ $ZodCheck.init(inst, def);
1095
+ (_a = inst._zod.def).when ?? (_a.when = (payload)=>{
1096
+ const val = payload.value;
1097
+ return !nullish(val) && void 0 !== val.length;
1098
+ });
1099
+ inst._zod.onattach.push((inst)=>{
1100
+ const bag = inst._zod.bag;
1101
+ bag.minimum = def.length;
1102
+ bag.maximum = def.length;
1103
+ bag.length = def.length;
1104
+ });
1105
+ inst._zod.check = (payload)=>{
1106
+ const input = payload.value;
1107
+ const length = input.length;
1108
+ if (length === def.length) return;
1109
+ const origin = getLengthableOrigin(input);
1110
+ const tooBig = length > def.length;
1111
+ payload.issues.push({
1112
+ origin,
1113
+ ...tooBig ? {
1114
+ code: "too_big",
1115
+ maximum: def.length
1116
+ } : {
1117
+ code: "too_small",
1118
+ minimum: def.length
1119
+ },
1120
+ inclusive: true,
1121
+ exact: true,
1122
+ input: payload.value,
1123
+ inst,
1124
+ continue: !def.abort
1125
+ });
1126
+ };
1127
+ });
1128
+ const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def)=>{
1129
+ var _a, _b;
1130
+ $ZodCheck.init(inst, def);
1131
+ inst._zod.onattach.push((inst)=>{
1132
+ const bag = inst._zod.bag;
1133
+ bag.format = def.format;
1134
+ if (def.pattern) {
1135
+ bag.patterns ?? (bag.patterns = new Set());
1136
+ bag.patterns.add(def.pattern);
1137
+ }
1138
+ });
1139
+ if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload)=>{
1140
+ def.pattern.lastIndex = 0;
1141
+ if (def.pattern.test(payload.value)) return;
1142
+ payload.issues.push({
1143
+ origin: "string",
1144
+ code: "invalid_format",
1145
+ format: def.format,
1146
+ input: payload.value,
1147
+ ...def.pattern ? {
1148
+ pattern: def.pattern.toString()
1149
+ } : {},
1150
+ inst,
1151
+ continue: !def.abort
1152
+ });
1153
+ });
1154
+ else (_b = inst._zod).check ?? (_b.check = ()=>{});
1155
+ });
1156
+ const $ZodCheckRegex = /*@__PURE__*/ $constructor("$ZodCheckRegex", (inst, def)=>{
1157
+ $ZodCheckStringFormat.init(inst, def);
1158
+ inst._zod.check = (payload)=>{
1159
+ def.pattern.lastIndex = 0;
1160
+ if (def.pattern.test(payload.value)) return;
1161
+ payload.issues.push({
1162
+ origin: "string",
1163
+ code: "invalid_format",
1164
+ format: "regex",
1165
+ input: payload.value,
1166
+ pattern: def.pattern.toString(),
1167
+ inst,
1168
+ continue: !def.abort
1169
+ });
1170
+ };
1171
+ });
1172
+ const $ZodCheckLowerCase = /*@__PURE__*/ $constructor("$ZodCheckLowerCase", (inst, def)=>{
1173
+ def.pattern ?? (def.pattern = lowercase);
1174
+ $ZodCheckStringFormat.init(inst, def);
1175
+ });
1176
+ const $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (inst, def)=>{
1177
+ def.pattern ?? (def.pattern = uppercase);
1178
+ $ZodCheckStringFormat.init(inst, def);
1179
+ });
1180
+ const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def)=>{
1181
+ $ZodCheck.init(inst, def);
1182
+ const escapedRegex = escapeRegex(def.includes);
1183
+ const pattern = new RegExp("number" == typeof def.position ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
1184
+ def.pattern = pattern;
1185
+ inst._zod.onattach.push((inst)=>{
1186
+ const bag = inst._zod.bag;
1187
+ bag.patterns ?? (bag.patterns = new Set());
1188
+ bag.patterns.add(pattern);
1189
+ });
1190
+ inst._zod.check = (payload)=>{
1191
+ if (payload.value.includes(def.includes, def.position)) return;
1192
+ payload.issues.push({
1193
+ origin: "string",
1194
+ code: "invalid_format",
1195
+ format: "includes",
1196
+ includes: def.includes,
1197
+ input: payload.value,
1198
+ inst,
1199
+ continue: !def.abort
1200
+ });
1201
+ };
1202
+ });
1203
+ const $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (inst, def)=>{
1204
+ $ZodCheck.init(inst, def);
1205
+ const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
1206
+ def.pattern ?? (def.pattern = pattern);
1207
+ inst._zod.onattach.push((inst)=>{
1208
+ const bag = inst._zod.bag;
1209
+ bag.patterns ?? (bag.patterns = new Set());
1210
+ bag.patterns.add(pattern);
1211
+ });
1212
+ inst._zod.check = (payload)=>{
1213
+ if (payload.value.startsWith(def.prefix)) return;
1214
+ payload.issues.push({
1215
+ origin: "string",
1216
+ code: "invalid_format",
1217
+ format: "starts_with",
1218
+ prefix: def.prefix,
1219
+ input: payload.value,
1220
+ inst,
1221
+ continue: !def.abort
1222
+ });
1223
+ };
1224
+ });
1225
+ const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst, def)=>{
1226
+ $ZodCheck.init(inst, def);
1227
+ const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
1228
+ def.pattern ?? (def.pattern = pattern);
1229
+ inst._zod.onattach.push((inst)=>{
1230
+ const bag = inst._zod.bag;
1231
+ bag.patterns ?? (bag.patterns = new Set());
1232
+ bag.patterns.add(pattern);
1233
+ });
1234
+ inst._zod.check = (payload)=>{
1235
+ if (payload.value.endsWith(def.suffix)) return;
1236
+ payload.issues.push({
1237
+ origin: "string",
1238
+ code: "invalid_format",
1239
+ format: "ends_with",
1240
+ suffix: def.suffix,
1241
+ input: payload.value,
1242
+ inst,
1243
+ continue: !def.abort
1244
+ });
1245
+ };
1246
+ });
1247
+ const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (inst, def)=>{
1248
+ $ZodCheck.init(inst, def);
1249
+ inst._zod.check = (payload)=>{
1250
+ payload.value = def.tx(payload.value);
1251
+ };
1252
+ });
1253
+ class Doc {
1254
+ constructor(args = []){
1255
+ this.content = [];
1256
+ this.indent = 0;
1257
+ if (this) this.args = args;
1258
+ }
1259
+ indented(fn) {
1260
+ this.indent += 1;
1261
+ fn(this);
1262
+ this.indent -= 1;
1263
+ }
1264
+ write(arg) {
1265
+ if ("function" == typeof arg) {
1266
+ arg(this, {
1267
+ execution: "sync"
1268
+ });
1269
+ arg(this, {
1270
+ execution: "async"
1271
+ });
1272
+ return;
1273
+ }
1274
+ const content = arg;
1275
+ const lines = content.split("\n").filter((x)=>x);
1276
+ const minIndent = Math.min(...lines.map((x)=>x.length - x.trimStart().length));
1277
+ const dedented = lines.map((x)=>x.slice(minIndent)).map((x)=>" ".repeat(2 * this.indent) + x);
1278
+ for (const line of dedented)this.content.push(line);
1279
+ }
1280
+ compile() {
1281
+ const F = Function;
1282
+ const args = this?.args;
1283
+ const content = this?.content ?? [
1284
+ ""
1285
+ ];
1286
+ const lines = [
1287
+ ...content.map((x)=>` ${x}`)
1288
+ ];
1289
+ return new F(...args, lines.join("\n"));
1290
+ }
1291
+ }
1292
+ const versions_version = {
1293
+ major: 4,
1294
+ minor: 1,
1295
+ patch: 12
1296
+ };
1297
+ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def)=>{
1298
+ var _a;
1299
+ inst ?? (inst = {});
1300
+ inst._zod.def = def;
1301
+ inst._zod.bag = inst._zod.bag || {};
1302
+ inst._zod.version = versions_version;
1303
+ const checks = [
1304
+ ...inst._zod.def.checks ?? []
1305
+ ];
1306
+ if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
1307
+ for (const ch of checks)for (const fn of ch._zod.onattach)fn(inst);
1308
+ if (0 === checks.length) {
1309
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
1310
+ inst._zod.deferred?.push(()=>{
1311
+ inst._zod.run = inst._zod.parse;
1312
+ });
1313
+ } else {
1314
+ const runChecks = (payload, checks, ctx)=>{
1315
+ let isAborted = aborted(payload);
1316
+ let asyncResult;
1317
+ for (const ch of checks){
1318
+ if (ch._zod.def.when) {
1319
+ const shouldRun = ch._zod.def.when(payload);
1320
+ if (!shouldRun) continue;
1321
+ } else if (isAborted) continue;
1322
+ const currLen = payload.issues.length;
1323
+ const _ = ch._zod.check(payload);
1324
+ if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
1325
+ if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async ()=>{
1326
+ await _;
1327
+ const nextLen = payload.issues.length;
1328
+ if (nextLen === currLen) return;
1329
+ if (!isAborted) isAborted = aborted(payload, currLen);
1330
+ });
1331
+ else {
1332
+ const nextLen = payload.issues.length;
1333
+ if (nextLen === currLen) continue;
1334
+ if (!isAborted) isAborted = aborted(payload, currLen);
1335
+ }
1336
+ }
1337
+ if (asyncResult) return asyncResult.then(()=>payload);
1338
+ return payload;
1339
+ };
1340
+ const handleCanaryResult = (canary, payload, ctx)=>{
1341
+ if (aborted(canary)) {
1342
+ canary.aborted = true;
1343
+ return canary;
1344
+ }
1345
+ const checkResult = runChecks(payload, checks, ctx);
1346
+ if (checkResult instanceof Promise) {
1347
+ if (false === ctx.async) throw new $ZodAsyncError();
1348
+ return checkResult.then((checkResult)=>inst._zod.parse(checkResult, ctx));
1349
+ }
1350
+ return inst._zod.parse(checkResult, ctx);
1351
+ };
1352
+ inst._zod.run = (payload, ctx)=>{
1353
+ if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
1354
+ if ("backward" === ctx.direction) {
1355
+ const canary = inst._zod.parse({
1356
+ value: payload.value,
1357
+ issues: []
1358
+ }, {
1359
+ ...ctx,
1360
+ skipChecks: true
1361
+ });
1362
+ if (canary instanceof Promise) return canary.then((canary)=>handleCanaryResult(canary, payload, ctx));
1363
+ return handleCanaryResult(canary, payload, ctx);
1364
+ }
1365
+ const result = inst._zod.parse(payload, ctx);
1366
+ if (result instanceof Promise) {
1367
+ if (false === ctx.async) throw new $ZodAsyncError();
1368
+ return result.then((result)=>runChecks(result, checks, ctx));
1369
+ }
1370
+ return runChecks(result, checks, ctx);
1371
+ };
1372
+ }
1373
+ inst["~standard"] = {
1374
+ validate: (value)=>{
1375
+ try {
1376
+ const r = safeParse(inst, value);
1377
+ return r.success ? {
1378
+ value: r.data
1379
+ } : {
1380
+ issues: r.error?.issues
1381
+ };
1382
+ } catch (_) {
1383
+ return safeParseAsync(inst, value).then((r)=>r.success ? {
1384
+ value: r.data
1385
+ } : {
1386
+ issues: r.error?.issues
1387
+ });
1388
+ }
1389
+ },
1390
+ vendor: "zod",
1391
+ version: 1
1392
+ };
1393
+ });
1394
+ const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def)=>{
1395
+ $ZodType.init(inst, def);
1396
+ inst._zod.pattern = [
1397
+ ...inst?._zod.bag?.patterns ?? []
1398
+ ].pop() ?? string(inst._zod.bag);
1399
+ inst._zod.parse = (payload, _)=>{
1400
+ if (def.coerce) try {
1401
+ payload.value = String(payload.value);
1402
+ } catch (_) {}
1403
+ if ("string" == typeof payload.value) return payload;
1404
+ payload.issues.push({
1405
+ expected: "string",
1406
+ code: "invalid_type",
1407
+ input: payload.value,
1408
+ inst
1409
+ });
1410
+ return payload;
1411
+ };
1412
+ });
1413
+ const $ZodStringFormat = /*@__PURE__*/ $constructor("$ZodStringFormat", (inst, def)=>{
1414
+ $ZodCheckStringFormat.init(inst, def);
1415
+ $ZodString.init(inst, def);
1416
+ });
1417
+ const $ZodGUID = /*@__PURE__*/ $constructor("$ZodGUID", (inst, def)=>{
1418
+ def.pattern ?? (def.pattern = guid);
1419
+ $ZodStringFormat.init(inst, def);
1420
+ });
1421
+ const $ZodUUID = /*@__PURE__*/ $constructor("$ZodUUID", (inst, def)=>{
1422
+ if (def.version) {
1423
+ const versionMap = {
1424
+ v1: 1,
1425
+ v2: 2,
1426
+ v3: 3,
1427
+ v4: 4,
1428
+ v5: 5,
1429
+ v6: 6,
1430
+ v7: 7,
1431
+ v8: 8
1432
+ };
1433
+ const v = versionMap[def.version];
1434
+ if (void 0 === v) throw new Error(`Invalid UUID version: "${def.version}"`);
1435
+ def.pattern ?? (def.pattern = uuid(v));
1436
+ } else def.pattern ?? (def.pattern = uuid());
1437
+ $ZodStringFormat.init(inst, def);
1438
+ });
1439
+ const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def)=>{
1440
+ def.pattern ?? (def.pattern = email);
1441
+ $ZodStringFormat.init(inst, def);
1442
+ });
1443
+ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def)=>{
1444
+ $ZodStringFormat.init(inst, def);
1445
+ inst._zod.check = (payload)=>{
1446
+ try {
1447
+ const trimmed = payload.value.trim();
1448
+ const url = new URL(trimmed);
1449
+ if (def.hostname) {
1450
+ def.hostname.lastIndex = 0;
1451
+ if (!def.hostname.test(url.hostname)) payload.issues.push({
1452
+ code: "invalid_format",
1453
+ format: "url",
1454
+ note: "Invalid hostname",
1455
+ pattern: hostname.source,
1456
+ input: payload.value,
1457
+ inst,
1458
+ continue: !def.abort
1459
+ });
1460
+ }
1461
+ if (def.protocol) {
1462
+ def.protocol.lastIndex = 0;
1463
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
1464
+ code: "invalid_format",
1465
+ format: "url",
1466
+ note: "Invalid protocol",
1467
+ pattern: def.protocol.source,
1468
+ input: payload.value,
1469
+ inst,
1470
+ continue: !def.abort
1471
+ });
1472
+ }
1473
+ if (def.normalize) payload.value = url.href;
1474
+ else payload.value = trimmed;
1475
+ return;
1476
+ } catch (_) {
1477
+ payload.issues.push({
1478
+ code: "invalid_format",
1479
+ format: "url",
1480
+ input: payload.value,
1481
+ inst,
1482
+ continue: !def.abort
1483
+ });
1484
+ }
1485
+ };
1486
+ });
1487
+ const $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def)=>{
1488
+ def.pattern ?? (def.pattern = emoji());
1489
+ $ZodStringFormat.init(inst, def);
1490
+ });
1491
+ const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def)=>{
1492
+ def.pattern ?? (def.pattern = nanoid);
1493
+ $ZodStringFormat.init(inst, def);
1494
+ });
1495
+ const $ZodCUID = /*@__PURE__*/ $constructor("$ZodCUID", (inst, def)=>{
1496
+ def.pattern ?? (def.pattern = cuid);
1497
+ $ZodStringFormat.init(inst, def);
1498
+ });
1499
+ const $ZodCUID2 = /*@__PURE__*/ $constructor("$ZodCUID2", (inst, def)=>{
1500
+ def.pattern ?? (def.pattern = cuid2);
1501
+ $ZodStringFormat.init(inst, def);
1502
+ });
1503
+ const $ZodULID = /*@__PURE__*/ $constructor("$ZodULID", (inst, def)=>{
1504
+ def.pattern ?? (def.pattern = ulid);
1505
+ $ZodStringFormat.init(inst, def);
1506
+ });
1507
+ const $ZodXID = /*@__PURE__*/ $constructor("$ZodXID", (inst, def)=>{
1508
+ def.pattern ?? (def.pattern = xid);
1509
+ $ZodStringFormat.init(inst, def);
1510
+ });
1511
+ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def)=>{
1512
+ def.pattern ?? (def.pattern = ksuid);
1513
+ $ZodStringFormat.init(inst, def);
1514
+ });
1515
+ const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def)=>{
1516
+ def.pattern ?? (def.pattern = datetime(def));
1517
+ $ZodStringFormat.init(inst, def);
1518
+ });
1519
+ const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def)=>{
1520
+ def.pattern ?? (def.pattern = date);
1521
+ $ZodStringFormat.init(inst, def);
1522
+ });
1523
+ const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def)=>{
1524
+ def.pattern ?? (def.pattern = regexes_time(def));
1525
+ $ZodStringFormat.init(inst, def);
1526
+ });
1527
+ const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def)=>{
1528
+ def.pattern ?? (def.pattern = duration);
1529
+ $ZodStringFormat.init(inst, def);
1530
+ });
1531
+ const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def)=>{
1532
+ def.pattern ?? (def.pattern = ipv4);
1533
+ $ZodStringFormat.init(inst, def);
1534
+ inst._zod.onattach.push((inst)=>{
1535
+ const bag = inst._zod.bag;
1536
+ bag.format = "ipv4";
1537
+ });
1538
+ });
1539
+ const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def)=>{
1540
+ def.pattern ?? (def.pattern = ipv6);
1541
+ $ZodStringFormat.init(inst, def);
1542
+ inst._zod.onattach.push((inst)=>{
1543
+ const bag = inst._zod.bag;
1544
+ bag.format = "ipv6";
1545
+ });
1546
+ inst._zod.check = (payload)=>{
1547
+ try {
1548
+ new URL(`http://[${payload.value}]`);
1549
+ } catch {
1550
+ payload.issues.push({
1551
+ code: "invalid_format",
1552
+ format: "ipv6",
1553
+ input: payload.value,
1554
+ inst,
1555
+ continue: !def.abort
1556
+ });
1557
+ }
1558
+ };
1559
+ });
1560
+ const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def)=>{
1561
+ def.pattern ?? (def.pattern = cidrv4);
1562
+ $ZodStringFormat.init(inst, def);
1563
+ });
1564
+ const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def)=>{
1565
+ def.pattern ?? (def.pattern = cidrv6);
1566
+ $ZodStringFormat.init(inst, def);
1567
+ inst._zod.check = (payload)=>{
1568
+ const parts = payload.value.split("/");
1569
+ try {
1570
+ if (2 !== parts.length) throw new Error();
1571
+ const [address, prefix] = parts;
1572
+ if (!prefix) throw new Error();
1573
+ const prefixNum = Number(prefix);
1574
+ if (`${prefixNum}` !== prefix) throw new Error();
1575
+ if (prefixNum < 0 || prefixNum > 128) throw new Error();
1576
+ new URL(`http://[${address}]`);
1577
+ } catch {
1578
+ payload.issues.push({
1579
+ code: "invalid_format",
1580
+ format: "cidrv6",
1581
+ input: payload.value,
1582
+ inst,
1583
+ continue: !def.abort
1584
+ });
1585
+ }
1586
+ };
1587
+ });
1588
+ function isValidBase64(data) {
1589
+ if ("" === data) return true;
1590
+ if (data.length % 4 !== 0) return false;
1591
+ try {
1592
+ atob(data);
1593
+ return true;
1594
+ } catch {
1595
+ return false;
1596
+ }
1597
+ }
1598
+ const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def)=>{
1599
+ def.pattern ?? (def.pattern = regexes_base64);
1600
+ $ZodStringFormat.init(inst, def);
1601
+ inst._zod.onattach.push((inst)=>{
1602
+ inst._zod.bag.contentEncoding = "base64";
1603
+ });
1604
+ inst._zod.check = (payload)=>{
1605
+ if (isValidBase64(payload.value)) return;
1606
+ payload.issues.push({
1607
+ code: "invalid_format",
1608
+ format: "base64",
1609
+ input: payload.value,
1610
+ inst,
1611
+ continue: !def.abort
1612
+ });
1613
+ };
1614
+ });
1615
+ function isValidBase64URL(data) {
1616
+ if (!regexes_base64url.test(data)) return false;
1617
+ const base64 = data.replace(/[-_]/g, (c)=>"-" === c ? "+" : "/");
1618
+ const padded = base64.padEnd(4 * Math.ceil(base64.length / 4), "=");
1619
+ return isValidBase64(padded);
1620
+ }
1621
+ const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def)=>{
1622
+ def.pattern ?? (def.pattern = regexes_base64url);
1623
+ $ZodStringFormat.init(inst, def);
1624
+ inst._zod.onattach.push((inst)=>{
1625
+ inst._zod.bag.contentEncoding = "base64url";
1626
+ });
1627
+ inst._zod.check = (payload)=>{
1628
+ if (isValidBase64URL(payload.value)) return;
1629
+ payload.issues.push({
1630
+ code: "invalid_format",
1631
+ format: "base64url",
1632
+ input: payload.value,
1633
+ inst,
1634
+ continue: !def.abort
1635
+ });
1636
+ };
1637
+ });
1638
+ const $ZodE164 = /*@__PURE__*/ $constructor("$ZodE164", (inst, def)=>{
1639
+ def.pattern ?? (def.pattern = e164);
1640
+ $ZodStringFormat.init(inst, def);
1641
+ });
1642
+ function isValidJWT(token, algorithm = null) {
1643
+ try {
1644
+ const tokensParts = token.split(".");
1645
+ if (3 !== tokensParts.length) return false;
1646
+ const [header] = tokensParts;
1647
+ if (!header) return false;
1648
+ const parsedHeader = JSON.parse(atob(header));
1649
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
1650
+ if (!parsedHeader.alg) return false;
1651
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
1652
+ return true;
1653
+ } catch {
1654
+ return false;
1655
+ }
1656
+ }
1657
+ const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def)=>{
1658
+ $ZodStringFormat.init(inst, def);
1659
+ inst._zod.check = (payload)=>{
1660
+ if (isValidJWT(payload.value, def.alg)) return;
1661
+ payload.issues.push({
1662
+ code: "invalid_format",
1663
+ format: "jwt",
1664
+ input: payload.value,
1665
+ inst,
1666
+ continue: !def.abort
1667
+ });
1668
+ };
1669
+ });
1670
+ const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def)=>{
1671
+ $ZodType.init(inst, def);
1672
+ inst._zod.pattern = inst._zod.bag.pattern ?? regexes_number;
1673
+ inst._zod.parse = (payload, _ctx)=>{
1674
+ if (def.coerce) try {
1675
+ payload.value = Number(payload.value);
1676
+ } catch (_) {}
1677
+ const input = payload.value;
1678
+ if ("number" == typeof input && !Number.isNaN(input) && Number.isFinite(input)) return payload;
1679
+ const received = "number" == typeof input ? Number.isNaN(input) ? "NaN" : Number.isFinite(input) ? void 0 : "Infinity" : void 0;
1680
+ payload.issues.push({
1681
+ expected: "number",
1682
+ code: "invalid_type",
1683
+ input,
1684
+ inst,
1685
+ ...received ? {
1686
+ received
1687
+ } : {}
1688
+ });
1689
+ return payload;
1690
+ };
1691
+ });
1692
+ const $ZodNumberFormat = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def)=>{
1693
+ $ZodCheckNumberFormat.init(inst, def);
1694
+ $ZodNumber.init(inst, def);
1695
+ });
1696
+ const $ZodBoolean = /*@__PURE__*/ $constructor("$ZodBoolean", (inst, def)=>{
1697
+ $ZodType.init(inst, def);
1698
+ inst._zod.pattern = regexes_boolean;
1699
+ inst._zod.parse = (payload, _ctx)=>{
1700
+ if (def.coerce) try {
1701
+ payload.value = Boolean(payload.value);
1702
+ } catch (_) {}
1703
+ const input = payload.value;
1704
+ if ("boolean" == typeof input) return payload;
1705
+ payload.issues.push({
1706
+ expected: "boolean",
1707
+ code: "invalid_type",
1708
+ input,
1709
+ inst
1710
+ });
1711
+ return payload;
1712
+ };
1713
+ });
1714
+ const $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def)=>{
1715
+ $ZodType.init(inst, def);
1716
+ inst._zod.parse = (payload)=>payload;
1717
+ });
1718
+ const $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def)=>{
1719
+ $ZodType.init(inst, def);
1720
+ inst._zod.parse = (payload, _ctx)=>{
1721
+ payload.issues.push({
1722
+ expected: "never",
1723
+ code: "invalid_type",
1724
+ input: payload.value,
1725
+ inst
1726
+ });
1727
+ return payload;
1728
+ };
1729
+ });
1730
+ function handleArrayResult(result, final, index) {
1731
+ if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
1732
+ final.value[index] = result.value;
1733
+ }
1734
+ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def)=>{
1735
+ $ZodType.init(inst, def);
1736
+ inst._zod.parse = (payload, ctx)=>{
1737
+ const input = payload.value;
1738
+ if (!Array.isArray(input)) {
1739
+ payload.issues.push({
1740
+ expected: "array",
1741
+ code: "invalid_type",
1742
+ input,
1743
+ inst
1744
+ });
1745
+ return payload;
1746
+ }
1747
+ payload.value = Array(input.length);
1748
+ const proms = [];
1749
+ for(let i = 0; i < input.length; i++){
1750
+ const item = input[i];
1751
+ const result = def.element._zod.run({
1752
+ value: item,
1753
+ issues: []
1754
+ }, ctx);
1755
+ if (result instanceof Promise) proms.push(result.then((result)=>handleArrayResult(result, payload, i)));
1756
+ else handleArrayResult(result, payload, i);
1757
+ }
1758
+ if (proms.length) return Promise.all(proms).then(()=>payload);
1759
+ return payload;
1760
+ };
1761
+ });
1762
+ function handlePropertyResult(result, final, key, input) {
1763
+ if (result.issues.length) final.issues.push(...prefixIssues(key, result.issues));
1764
+ if (void 0 === result.value) {
1765
+ if (key in input) final.value[key] = void 0;
1766
+ } else final.value[key] = result.value;
1767
+ }
1768
+ function normalizeDef(def) {
1769
+ const keys = Object.keys(def.shape);
1770
+ for (const k of keys)if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1771
+ const okeys = optionalKeys(def.shape);
1772
+ return {
1773
+ ...def,
1774
+ keys,
1775
+ keySet: new Set(keys),
1776
+ numKeys: keys.length,
1777
+ optionalKeys: new Set(okeys)
1778
+ };
1779
+ }
1780
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
1781
+ const unrecognized = [];
1782
+ const keySet = def.keySet;
1783
+ const _catchall = def.catchall._zod;
1784
+ const t = _catchall.def.type;
1785
+ for (const key of Object.keys(input)){
1786
+ if (keySet.has(key)) continue;
1787
+ if ("never" === t) {
1788
+ unrecognized.push(key);
1789
+ continue;
1790
+ }
1791
+ const r = _catchall.run({
1792
+ value: input[key],
1793
+ issues: []
1794
+ }, ctx);
1795
+ if (r instanceof Promise) proms.push(r.then((r)=>handlePropertyResult(r, payload, key, input)));
1796
+ else handlePropertyResult(r, payload, key, input);
1797
+ }
1798
+ if (unrecognized.length) payload.issues.push({
1799
+ code: "unrecognized_keys",
1800
+ keys: unrecognized,
1801
+ input,
1802
+ inst
1803
+ });
1804
+ if (!proms.length) return payload;
1805
+ return Promise.all(proms).then(()=>payload);
1806
+ }
1807
+ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def)=>{
1808
+ $ZodType.init(inst, def);
1809
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
1810
+ if (!desc?.get) {
1811
+ const sh = def.shape;
1812
+ Object.defineProperty(def, "shape", {
1813
+ get: ()=>{
1814
+ const newSh = {
1815
+ ...sh
1816
+ };
1817
+ Object.defineProperty(def, "shape", {
1818
+ value: newSh
1819
+ });
1820
+ return newSh;
1821
+ }
1822
+ });
1823
+ }
1824
+ const _normalized = cached(()=>normalizeDef(def));
1825
+ defineLazy(inst._zod, "propValues", ()=>{
1826
+ const shape = def.shape;
1827
+ const propValues = {};
1828
+ for(const key in shape){
1829
+ const field = shape[key]._zod;
1830
+ if (field.values) {
1831
+ propValues[key] ?? (propValues[key] = new Set());
1832
+ for (const v of field.values)propValues[key].add(v);
1833
+ }
1834
+ }
1835
+ return propValues;
1836
+ });
1837
+ const isObject = util_isObject;
1838
+ const catchall = def.catchall;
1839
+ let value;
1840
+ inst._zod.parse = (payload, ctx)=>{
1841
+ value ?? (value = _normalized.value);
1842
+ const input = payload.value;
1843
+ if (!isObject(input)) {
1844
+ payload.issues.push({
1845
+ expected: "object",
1846
+ code: "invalid_type",
1847
+ input,
1848
+ inst
1849
+ });
1850
+ return payload;
1851
+ }
1852
+ payload.value = {};
1853
+ const proms = [];
1854
+ const shape = value.shape;
1855
+ for (const key of value.keys){
1856
+ const el = shape[key];
1857
+ const r = el._zod.run({
1858
+ value: input[key],
1859
+ issues: []
1860
+ }, ctx);
1861
+ if (r instanceof Promise) proms.push(r.then((r)=>handlePropertyResult(r, payload, key, input)));
1862
+ else handlePropertyResult(r, payload, key, input);
1863
+ }
1864
+ if (!catchall) return proms.length ? Promise.all(proms).then(()=>payload) : payload;
1865
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
1866
+ };
1867
+ });
1868
+ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def)=>{
1869
+ $ZodObject.init(inst, def);
1870
+ const superParse = inst._zod.parse;
1871
+ const _normalized = cached(()=>normalizeDef(def));
1872
+ const generateFastpass = (shape)=>{
1873
+ const doc = new Doc([
1874
+ "shape",
1875
+ "payload",
1876
+ "ctx"
1877
+ ]);
1878
+ const normalized = _normalized.value;
1879
+ const parseStr = (key)=>{
1880
+ const k = esc(key);
1881
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1882
+ };
1883
+ doc.write("const input = payload.value;");
1884
+ const ids = Object.create(null);
1885
+ let counter = 0;
1886
+ for (const key of normalized.keys)ids[key] = `key_${counter++}`;
1887
+ doc.write("const newResult = {};");
1888
+ for (const key of normalized.keys){
1889
+ const id = ids[key];
1890
+ const k = esc(key);
1891
+ doc.write(`const ${id} = ${parseStr(key)};`);
1892
+ doc.write(`
1893
+ if (${id}.issues.length) {
1894
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1895
+ ...iss,
1896
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1897
+ })));
1898
+ }
1899
+
1900
+
1901
+ if (${id}.value === undefined) {
1902
+ if (${k} in input) {
1903
+ newResult[${k}] = undefined;
1904
+ }
1905
+ } else {
1906
+ newResult[${k}] = ${id}.value;
1907
+ }
1908
+
1909
+ `);
1910
+ }
1911
+ doc.write("payload.value = newResult;");
1912
+ doc.write("return payload;");
1913
+ const fn = doc.compile();
1914
+ return (payload, ctx)=>fn(shape, payload, ctx);
1915
+ };
1916
+ let fastpass;
1917
+ const isObject = util_isObject;
1918
+ const jit = !globalConfig.jitless;
1919
+ const allowsEval = util_allowsEval;
1920
+ const fastEnabled = jit && allowsEval.value;
1921
+ const catchall = def.catchall;
1922
+ let value;
1923
+ inst._zod.parse = (payload, ctx)=>{
1924
+ value ?? (value = _normalized.value);
1925
+ const input = payload.value;
1926
+ if (!isObject(input)) {
1927
+ payload.issues.push({
1928
+ expected: "object",
1929
+ code: "invalid_type",
1930
+ input,
1931
+ inst
1932
+ });
1933
+ return payload;
1934
+ }
1935
+ if (jit && fastEnabled && ctx?.async === false && true !== ctx.jitless) {
1936
+ if (!fastpass) fastpass = generateFastpass(def.shape);
1937
+ payload = fastpass(payload, ctx);
1938
+ if (!catchall) return payload;
1939
+ return handleCatchall([], input, payload, ctx, value, inst);
1940
+ }
1941
+ return superParse(payload, ctx);
1942
+ };
1943
+ });
1944
+ function handleUnionResults(results, final, inst, ctx) {
1945
+ for (const result of results)if (0 === result.issues.length) {
1946
+ final.value = result.value;
1947
+ return final;
1948
+ }
1949
+ const nonaborted = results.filter((r)=>!aborted(r));
1950
+ if (1 === nonaborted.length) {
1951
+ final.value = nonaborted[0].value;
1952
+ return nonaborted[0];
1953
+ }
1954
+ final.issues.push({
1955
+ code: "invalid_union",
1956
+ input: final.value,
1957
+ inst,
1958
+ errors: results.map((result)=>result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
1959
+ });
1960
+ return final;
1961
+ }
1962
+ const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def)=>{
1963
+ $ZodType.init(inst, def);
1964
+ defineLazy(inst._zod, "optin", ()=>def.options.some((o)=>"optional" === o._zod.optin) ? "optional" : void 0);
1965
+ defineLazy(inst._zod, "optout", ()=>def.options.some((o)=>"optional" === o._zod.optout) ? "optional" : void 0);
1966
+ defineLazy(inst._zod, "values", ()=>{
1967
+ if (def.options.every((o)=>o._zod.values)) return new Set(def.options.flatMap((option)=>Array.from(option._zod.values)));
1968
+ });
1969
+ defineLazy(inst._zod, "pattern", ()=>{
1970
+ if (def.options.every((o)=>o._zod.pattern)) {
1971
+ const patterns = def.options.map((o)=>o._zod.pattern);
1972
+ return new RegExp(`^(${patterns.map((p)=>cleanRegex(p.source)).join("|")})$`);
1973
+ }
1974
+ });
1975
+ const single = 1 === def.options.length;
1976
+ const first = def.options[0]._zod.run;
1977
+ inst._zod.parse = (payload, ctx)=>{
1978
+ if (single) return first(payload, ctx);
1979
+ let async = false;
1980
+ const results = [];
1981
+ for (const option of def.options){
1982
+ const result = option._zod.run({
1983
+ value: payload.value,
1984
+ issues: []
1985
+ }, ctx);
1986
+ if (result instanceof Promise) {
1987
+ results.push(result);
1988
+ async = true;
1989
+ } else {
1990
+ if (0 === result.issues.length) return result;
1991
+ results.push(result);
1992
+ }
1993
+ }
1994
+ if (!async) return handleUnionResults(results, payload, inst, ctx);
1995
+ return Promise.all(results).then((results)=>handleUnionResults(results, payload, inst, ctx));
1996
+ };
1997
+ });
1998
+ const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def)=>{
1999
+ $ZodType.init(inst, def);
2000
+ inst._zod.parse = (payload, ctx)=>{
2001
+ const input = payload.value;
2002
+ const left = def.left._zod.run({
2003
+ value: input,
2004
+ issues: []
2005
+ }, ctx);
2006
+ const right = def.right._zod.run({
2007
+ value: input,
2008
+ issues: []
2009
+ }, ctx);
2010
+ const async = left instanceof Promise || right instanceof Promise;
2011
+ if (async) return Promise.all([
2012
+ left,
2013
+ right
2014
+ ]).then(([left, right])=>handleIntersectionResults(payload, left, right));
2015
+ return handleIntersectionResults(payload, left, right);
2016
+ };
2017
+ });
2018
+ function mergeValues(a, b) {
2019
+ if (a === b) return {
2020
+ valid: true,
2021
+ data: a
2022
+ };
2023
+ if (a instanceof Date && b instanceof Date && +a === +b) return {
2024
+ valid: true,
2025
+ data: a
2026
+ };
2027
+ if (isPlainObject(a) && isPlainObject(b)) {
2028
+ const bKeys = Object.keys(b);
2029
+ const sharedKeys = Object.keys(a).filter((key)=>-1 !== bKeys.indexOf(key));
2030
+ const newObj = {
2031
+ ...a,
2032
+ ...b
2033
+ };
2034
+ for (const key of sharedKeys){
2035
+ const sharedValue = mergeValues(a[key], b[key]);
2036
+ if (!sharedValue.valid) return {
2037
+ valid: false,
2038
+ mergeErrorPath: [
2039
+ key,
2040
+ ...sharedValue.mergeErrorPath
2041
+ ]
2042
+ };
2043
+ newObj[key] = sharedValue.data;
2044
+ }
2045
+ return {
2046
+ valid: true,
2047
+ data: newObj
2048
+ };
2049
+ }
2050
+ if (Array.isArray(a) && Array.isArray(b)) {
2051
+ if (a.length !== b.length) return {
2052
+ valid: false,
2053
+ mergeErrorPath: []
2054
+ };
2055
+ const newArray = [];
2056
+ for(let index = 0; index < a.length; index++){
2057
+ const itemA = a[index];
2058
+ const itemB = b[index];
2059
+ const sharedValue = mergeValues(itemA, itemB);
2060
+ if (!sharedValue.valid) return {
2061
+ valid: false,
2062
+ mergeErrorPath: [
2063
+ index,
2064
+ ...sharedValue.mergeErrorPath
2065
+ ]
2066
+ };
2067
+ newArray.push(sharedValue.data);
2068
+ }
2069
+ return {
2070
+ valid: true,
2071
+ data: newArray
2072
+ };
2073
+ }
2074
+ return {
2075
+ valid: false,
2076
+ mergeErrorPath: []
2077
+ };
2078
+ }
2079
+ function handleIntersectionResults(result, left, right) {
2080
+ if (left.issues.length) result.issues.push(...left.issues);
2081
+ if (right.issues.length) result.issues.push(...right.issues);
2082
+ if (aborted(result)) return result;
2083
+ const merged = mergeValues(left.value, right.value);
2084
+ if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
2085
+ result.value = merged.data;
2086
+ return result;
2087
+ }
2088
+ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def)=>{
2089
+ $ZodType.init(inst, def);
2090
+ const values = util_getEnumValues(def.entries);
2091
+ const valuesSet = new Set(values);
2092
+ inst._zod.values = valuesSet;
2093
+ inst._zod.pattern = new RegExp(`^(${values.filter((k)=>propertyKeyTypes.has(typeof k)).map((o)=>"string" == typeof o ? escapeRegex(o) : o.toString()).join("|")})$`);
2094
+ inst._zod.parse = (payload, _ctx)=>{
2095
+ const input = payload.value;
2096
+ if (valuesSet.has(input)) return payload;
2097
+ payload.issues.push({
2098
+ code: "invalid_value",
2099
+ values,
2100
+ input,
2101
+ inst
2102
+ });
2103
+ return payload;
2104
+ };
2105
+ });
2106
+ const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def)=>{
2107
+ $ZodType.init(inst, def);
2108
+ inst._zod.parse = (payload, ctx)=>{
2109
+ if ("backward" === ctx.direction) throw new $ZodEncodeError(inst.constructor.name);
2110
+ const _out = def.transform(payload.value, payload);
2111
+ if (ctx.async) {
2112
+ const output = _out instanceof Promise ? _out : Promise.resolve(_out);
2113
+ return output.then((output)=>{
2114
+ payload.value = output;
2115
+ return payload;
2116
+ });
2117
+ }
2118
+ if (_out instanceof Promise) throw new $ZodAsyncError();
2119
+ payload.value = _out;
2120
+ return payload;
2121
+ };
2122
+ });
2123
+ function handleOptionalResult(result, input) {
2124
+ if (result.issues.length && void 0 === input) return {
2125
+ issues: [],
2126
+ value: void 0
2127
+ };
2128
+ return result;
2129
+ }
2130
+ const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def)=>{
2131
+ $ZodType.init(inst, def);
2132
+ inst._zod.optin = "optional";
2133
+ inst._zod.optout = "optional";
2134
+ defineLazy(inst._zod, "values", ()=>def.innerType._zod.values ? new Set([
2135
+ ...def.innerType._zod.values,
2136
+ void 0
2137
+ ]) : void 0);
2138
+ defineLazy(inst._zod, "pattern", ()=>{
2139
+ const pattern = def.innerType._zod.pattern;
2140
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
2141
+ });
2142
+ inst._zod.parse = (payload, ctx)=>{
2143
+ if ("optional" === def.innerType._zod.optin) {
2144
+ const result = def.innerType._zod.run(payload, ctx);
2145
+ if (result instanceof Promise) return result.then((r)=>handleOptionalResult(r, payload.value));
2146
+ return handleOptionalResult(result, payload.value);
2147
+ }
2148
+ if (void 0 === payload.value) return payload;
2149
+ return def.innerType._zod.run(payload, ctx);
2150
+ };
2151
+ });
2152
+ const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def)=>{
2153
+ $ZodType.init(inst, def);
2154
+ defineLazy(inst._zod, "optin", ()=>def.innerType._zod.optin);
2155
+ defineLazy(inst._zod, "optout", ()=>def.innerType._zod.optout);
2156
+ defineLazy(inst._zod, "pattern", ()=>{
2157
+ const pattern = def.innerType._zod.pattern;
2158
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
2159
+ });
2160
+ defineLazy(inst._zod, "values", ()=>def.innerType._zod.values ? new Set([
2161
+ ...def.innerType._zod.values,
2162
+ null
2163
+ ]) : void 0);
2164
+ inst._zod.parse = (payload, ctx)=>{
2165
+ if (null === payload.value) return payload;
2166
+ return def.innerType._zod.run(payload, ctx);
2167
+ };
2168
+ });
2169
+ const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def)=>{
2170
+ $ZodType.init(inst, def);
2171
+ inst._zod.optin = "optional";
2172
+ defineLazy(inst._zod, "values", ()=>def.innerType._zod.values);
2173
+ inst._zod.parse = (payload, ctx)=>{
2174
+ if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
2175
+ if (void 0 === payload.value) {
2176
+ payload.value = def.defaultValue;
2177
+ return payload;
2178
+ }
2179
+ const result = def.innerType._zod.run(payload, ctx);
2180
+ if (result instanceof Promise) return result.then((result)=>handleDefaultResult(result, def));
2181
+ return handleDefaultResult(result, def);
2182
+ };
2183
+ });
2184
+ function handleDefaultResult(payload, def) {
2185
+ if (void 0 === payload.value) payload.value = def.defaultValue;
2186
+ return payload;
2187
+ }
2188
+ const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def)=>{
2189
+ $ZodType.init(inst, def);
2190
+ inst._zod.optin = "optional";
2191
+ defineLazy(inst._zod, "values", ()=>def.innerType._zod.values);
2192
+ inst._zod.parse = (payload, ctx)=>{
2193
+ if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
2194
+ if (void 0 === payload.value) payload.value = def.defaultValue;
2195
+ return def.innerType._zod.run(payload, ctx);
2196
+ };
2197
+ });
2198
+ const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def)=>{
2199
+ $ZodType.init(inst, def);
2200
+ defineLazy(inst._zod, "values", ()=>{
2201
+ const v = def.innerType._zod.values;
2202
+ return v ? new Set([
2203
+ ...v
2204
+ ].filter((x)=>void 0 !== x)) : void 0;
2205
+ });
2206
+ inst._zod.parse = (payload, ctx)=>{
2207
+ const result = def.innerType._zod.run(payload, ctx);
2208
+ if (result instanceof Promise) return result.then((result)=>handleNonOptionalResult(result, inst));
2209
+ return handleNonOptionalResult(result, inst);
2210
+ };
2211
+ });
2212
+ function handleNonOptionalResult(payload, inst) {
2213
+ if (!payload.issues.length && void 0 === payload.value) payload.issues.push({
2214
+ code: "invalid_type",
2215
+ expected: "nonoptional",
2216
+ input: payload.value,
2217
+ inst
2218
+ });
2219
+ return payload;
2220
+ }
2221
+ const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def)=>{
2222
+ $ZodType.init(inst, def);
2223
+ defineLazy(inst._zod, "optin", ()=>def.innerType._zod.optin);
2224
+ defineLazy(inst._zod, "optout", ()=>def.innerType._zod.optout);
2225
+ defineLazy(inst._zod, "values", ()=>def.innerType._zod.values);
2226
+ inst._zod.parse = (payload, ctx)=>{
2227
+ if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
2228
+ const result = def.innerType._zod.run(payload, ctx);
2229
+ if (result instanceof Promise) return result.then((result)=>{
2230
+ payload.value = result.value;
2231
+ if (result.issues.length) {
2232
+ payload.value = def.catchValue({
2233
+ ...payload,
2234
+ error: {
2235
+ issues: result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config()))
2236
+ },
2237
+ input: payload.value
2238
+ });
2239
+ payload.issues = [];
2240
+ }
2241
+ return payload;
2242
+ });
2243
+ payload.value = result.value;
2244
+ if (result.issues.length) {
2245
+ payload.value = def.catchValue({
2246
+ ...payload,
2247
+ error: {
2248
+ issues: result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config()))
2249
+ },
2250
+ input: payload.value
2251
+ });
2252
+ payload.issues = [];
2253
+ }
2254
+ return payload;
2255
+ };
2256
+ });
2257
+ const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def)=>{
2258
+ $ZodType.init(inst, def);
2259
+ defineLazy(inst._zod, "values", ()=>def.in._zod.values);
2260
+ defineLazy(inst._zod, "optin", ()=>def.in._zod.optin);
2261
+ defineLazy(inst._zod, "optout", ()=>def.out._zod.optout);
2262
+ defineLazy(inst._zod, "propValues", ()=>def.in._zod.propValues);
2263
+ inst._zod.parse = (payload, ctx)=>{
2264
+ if ("backward" === ctx.direction) {
2265
+ const right = def.out._zod.run(payload, ctx);
2266
+ if (right instanceof Promise) return right.then((right)=>handlePipeResult(right, def.in, ctx));
2267
+ return handlePipeResult(right, def.in, ctx);
2268
+ }
2269
+ const left = def.in._zod.run(payload, ctx);
2270
+ if (left instanceof Promise) return left.then((left)=>handlePipeResult(left, def.out, ctx));
2271
+ return handlePipeResult(left, def.out, ctx);
2272
+ };
2273
+ });
2274
+ function handlePipeResult(left, next, ctx) {
2275
+ if (left.issues.length) {
2276
+ left.aborted = true;
2277
+ return left;
2278
+ }
2279
+ return next._zod.run({
2280
+ value: left.value,
2281
+ issues: left.issues
2282
+ }, ctx);
2283
+ }
2284
+ const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def)=>{
2285
+ $ZodType.init(inst, def);
2286
+ defineLazy(inst._zod, "propValues", ()=>def.innerType._zod.propValues);
2287
+ defineLazy(inst._zod, "values", ()=>def.innerType._zod.values);
2288
+ defineLazy(inst._zod, "optin", ()=>def.innerType._zod.optin);
2289
+ defineLazy(inst._zod, "optout", ()=>def.innerType._zod.optout);
2290
+ inst._zod.parse = (payload, ctx)=>{
2291
+ if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
2292
+ const result = def.innerType._zod.run(payload, ctx);
2293
+ if (result instanceof Promise) return result.then(handleReadonlyResult);
2294
+ return handleReadonlyResult(result);
2295
+ };
2296
+ });
2297
+ function handleReadonlyResult(payload) {
2298
+ payload.value = Object.freeze(payload.value);
2299
+ return payload;
2300
+ }
2301
+ const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def)=>{
2302
+ $ZodCheck.init(inst, def);
2303
+ $ZodType.init(inst, def);
2304
+ inst._zod.parse = (payload, _)=>payload;
2305
+ inst._zod.check = (payload)=>{
2306
+ const input = payload.value;
2307
+ const r = def.fn(input);
2308
+ if (r instanceof Promise) return r.then((r)=>handleRefineResult(r, payload, input, inst));
2309
+ handleRefineResult(r, payload, input, inst);
2310
+ };
2311
+ });
2312
+ function handleRefineResult(result, payload, input, inst) {
2313
+ if (!result) {
2314
+ const _iss = {
2315
+ code: "custom",
2316
+ input,
2317
+ inst,
2318
+ path: [
2319
+ ...inst._zod.def.path ?? []
2320
+ ],
2321
+ continue: !inst._zod.def.abort
2322
+ };
2323
+ if (inst._zod.def.params) _iss.params = inst._zod.def.params;
2324
+ payload.issues.push(util_issue(_iss));
2325
+ }
2326
+ }
2327
+ const en_parsedType = (data)=>{
2328
+ const t = typeof data;
2329
+ switch(t){
2330
+ case "number":
2331
+ return Number.isNaN(data) ? "NaN" : "number";
2332
+ case "object":
2333
+ if (Array.isArray(data)) return "array";
2334
+ if (null === data) return "null";
2335
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) return data.constructor.name;
2336
+ }
2337
+ return t;
2338
+ };
2339
+ const en_error = ()=>{
2340
+ const Sizable = {
2341
+ string: {
2342
+ unit: "characters",
2343
+ verb: "to have"
2344
+ },
2345
+ file: {
2346
+ unit: "bytes",
2347
+ verb: "to have"
2348
+ },
2349
+ array: {
2350
+ unit: "items",
2351
+ verb: "to have"
2352
+ },
2353
+ set: {
2354
+ unit: "items",
2355
+ verb: "to have"
2356
+ }
2357
+ };
2358
+ function getSizing(origin) {
2359
+ return Sizable[origin] ?? null;
2360
+ }
2361
+ const Nouns = {
2362
+ regex: "input",
2363
+ email: "email address",
2364
+ url: "URL",
2365
+ emoji: "emoji",
2366
+ uuid: "UUID",
2367
+ uuidv4: "UUIDv4",
2368
+ uuidv6: "UUIDv6",
2369
+ nanoid: "nanoid",
2370
+ guid: "GUID",
2371
+ cuid: "cuid",
2372
+ cuid2: "cuid2",
2373
+ ulid: "ULID",
2374
+ xid: "XID",
2375
+ ksuid: "KSUID",
2376
+ datetime: "ISO datetime",
2377
+ date: "ISO date",
2378
+ time: "ISO time",
2379
+ duration: "ISO duration",
2380
+ ipv4: "IPv4 address",
2381
+ ipv6: "IPv6 address",
2382
+ cidrv4: "IPv4 range",
2383
+ cidrv6: "IPv6 range",
2384
+ base64: "base64-encoded string",
2385
+ base64url: "base64url-encoded string",
2386
+ json_string: "JSON string",
2387
+ e164: "E.164 number",
2388
+ jwt: "JWT",
2389
+ template_literal: "input"
2390
+ };
2391
+ return (issue)=>{
2392
+ switch(issue.code){
2393
+ case "invalid_type":
2394
+ return `Invalid input: expected ${issue.expected}, received ${en_parsedType(issue.input)}`;
2395
+ case "invalid_value":
2396
+ if (1 === issue.values.length) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
2397
+ return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
2398
+ case "too_big":
2399
+ {
2400
+ const adj = issue.inclusive ? "<=" : "<";
2401
+ const sizing = getSizing(issue.origin);
2402
+ if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
2403
+ return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
2404
+ }
2405
+ case "too_small":
2406
+ {
2407
+ const adj = issue.inclusive ? ">=" : ">";
2408
+ const sizing = getSizing(issue.origin);
2409
+ if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
2410
+ return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
2411
+ }
2412
+ case "invalid_format":
2413
+ {
2414
+ const _issue = issue;
2415
+ if ("starts_with" === _issue.format) return `Invalid string: must start with "${_issue.prefix}"`;
2416
+ if ("ends_with" === _issue.format) return `Invalid string: must end with "${_issue.suffix}"`;
2417
+ if ("includes" === _issue.format) return `Invalid string: must include "${_issue.includes}"`;
2418
+ if ("regex" === _issue.format) return `Invalid string: must match pattern ${_issue.pattern}`;
2419
+ return `Invalid ${Nouns[_issue.format] ?? issue.format}`;
2420
+ }
2421
+ case "not_multiple_of":
2422
+ return `Invalid number: must be a multiple of ${issue.divisor}`;
2423
+ case "unrecognized_keys":
2424
+ return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
2425
+ case "invalid_key":
2426
+ return `Invalid key in ${issue.origin}`;
2427
+ case "invalid_union":
2428
+ return "Invalid input";
2429
+ case "invalid_element":
2430
+ return `Invalid value in ${issue.origin}`;
2431
+ default:
2432
+ return "Invalid input";
2433
+ }
2434
+ };
2435
+ };
2436
+ function en() {
2437
+ return {
2438
+ localeError: en_error()
2439
+ };
2440
+ }
2441
+ Symbol("ZodOutput");
2442
+ Symbol("ZodInput");
2443
+ class registries_$ZodRegistry {
2444
+ constructor(){
2445
+ this._map = new WeakMap();
2446
+ this._idmap = new Map();
2447
+ }
2448
+ add(schema, ..._meta) {
2449
+ const meta = _meta[0];
2450
+ this._map.set(schema, meta);
2451
+ if (meta && "object" == typeof meta && "id" in meta) {
2452
+ if (this._idmap.has(meta.id)) throw new Error(`ID ${meta.id} already exists in the registry`);
2453
+ this._idmap.set(meta.id, schema);
2454
+ }
2455
+ return this;
2456
+ }
2457
+ clear() {
2458
+ this._map = new WeakMap();
2459
+ this._idmap = new Map();
2460
+ return this;
2461
+ }
2462
+ remove(schema) {
2463
+ const meta = this._map.get(schema);
2464
+ if (meta && "object" == typeof meta && "id" in meta) this._idmap.delete(meta.id);
2465
+ this._map.delete(schema);
2466
+ return this;
2467
+ }
2468
+ get(schema) {
2469
+ const p = schema._zod.parent;
2470
+ if (p) {
2471
+ const pm = {
2472
+ ...this.get(p) ?? {}
2473
+ };
2474
+ delete pm.id;
2475
+ const f = {
2476
+ ...pm,
2477
+ ...this._map.get(schema)
2478
+ };
2479
+ return Object.keys(f).length ? f : void 0;
2480
+ }
2481
+ return this._map.get(schema);
2482
+ }
2483
+ has(schema) {
2484
+ return this._map.has(schema);
2485
+ }
2486
+ }
2487
+ function registry() {
2488
+ return new registries_$ZodRegistry();
2489
+ }
2490
+ const globalRegistry = /*@__PURE__*/ registry();
2491
+ function _string(Class, params) {
2492
+ return new Class({
2493
+ type: "string",
2494
+ ...normalizeParams(params)
2495
+ });
2496
+ }
2497
+ function _email(Class, params) {
2498
+ return new Class({
2499
+ type: "string",
2500
+ format: "email",
2501
+ check: "string_format",
2502
+ abort: false,
2503
+ ...normalizeParams(params)
2504
+ });
2505
+ }
2506
+ function _guid(Class, params) {
2507
+ return new Class({
2508
+ type: "string",
2509
+ format: "guid",
2510
+ check: "string_format",
2511
+ abort: false,
2512
+ ...normalizeParams(params)
2513
+ });
2514
+ }
2515
+ function _uuid(Class, params) {
2516
+ return new Class({
2517
+ type: "string",
2518
+ format: "uuid",
2519
+ check: "string_format",
2520
+ abort: false,
2521
+ ...normalizeParams(params)
2522
+ });
2523
+ }
2524
+ function _uuidv4(Class, params) {
2525
+ return new Class({
2526
+ type: "string",
2527
+ format: "uuid",
2528
+ check: "string_format",
2529
+ abort: false,
2530
+ version: "v4",
2531
+ ...normalizeParams(params)
2532
+ });
2533
+ }
2534
+ function _uuidv6(Class, params) {
2535
+ return new Class({
2536
+ type: "string",
2537
+ format: "uuid",
2538
+ check: "string_format",
2539
+ abort: false,
2540
+ version: "v6",
2541
+ ...normalizeParams(params)
2542
+ });
2543
+ }
2544
+ function _uuidv7(Class, params) {
2545
+ return new Class({
2546
+ type: "string",
2547
+ format: "uuid",
2548
+ check: "string_format",
2549
+ abort: false,
2550
+ version: "v7",
2551
+ ...normalizeParams(params)
2552
+ });
2553
+ }
2554
+ function _url(Class, params) {
2555
+ return new Class({
2556
+ type: "string",
2557
+ format: "url",
2558
+ check: "string_format",
2559
+ abort: false,
2560
+ ...normalizeParams(params)
2561
+ });
2562
+ }
2563
+ function api_emoji(Class, params) {
2564
+ return new Class({
2565
+ type: "string",
2566
+ format: "emoji",
2567
+ check: "string_format",
2568
+ abort: false,
2569
+ ...normalizeParams(params)
2570
+ });
2571
+ }
2572
+ function _nanoid(Class, params) {
2573
+ return new Class({
2574
+ type: "string",
2575
+ format: "nanoid",
2576
+ check: "string_format",
2577
+ abort: false,
2578
+ ...normalizeParams(params)
2579
+ });
2580
+ }
2581
+ function _cuid(Class, params) {
2582
+ return new Class({
2583
+ type: "string",
2584
+ format: "cuid",
2585
+ check: "string_format",
2586
+ abort: false,
2587
+ ...normalizeParams(params)
2588
+ });
2589
+ }
2590
+ function _cuid2(Class, params) {
2591
+ return new Class({
2592
+ type: "string",
2593
+ format: "cuid2",
2594
+ check: "string_format",
2595
+ abort: false,
2596
+ ...normalizeParams(params)
2597
+ });
2598
+ }
2599
+ function _ulid(Class, params) {
2600
+ return new Class({
2601
+ type: "string",
2602
+ format: "ulid",
2603
+ check: "string_format",
2604
+ abort: false,
2605
+ ...normalizeParams(params)
2606
+ });
2607
+ }
2608
+ function _xid(Class, params) {
2609
+ return new Class({
2610
+ type: "string",
2611
+ format: "xid",
2612
+ check: "string_format",
2613
+ abort: false,
2614
+ ...normalizeParams(params)
2615
+ });
2616
+ }
2617
+ function _ksuid(Class, params) {
2618
+ return new Class({
2619
+ type: "string",
2620
+ format: "ksuid",
2621
+ check: "string_format",
2622
+ abort: false,
2623
+ ...normalizeParams(params)
2624
+ });
2625
+ }
2626
+ function _ipv4(Class, params) {
2627
+ return new Class({
2628
+ type: "string",
2629
+ format: "ipv4",
2630
+ check: "string_format",
2631
+ abort: false,
2632
+ ...normalizeParams(params)
2633
+ });
2634
+ }
2635
+ function _ipv6(Class, params) {
2636
+ return new Class({
2637
+ type: "string",
2638
+ format: "ipv6",
2639
+ check: "string_format",
2640
+ abort: false,
2641
+ ...normalizeParams(params)
2642
+ });
2643
+ }
2644
+ function _cidrv4(Class, params) {
2645
+ return new Class({
2646
+ type: "string",
2647
+ format: "cidrv4",
2648
+ check: "string_format",
2649
+ abort: false,
2650
+ ...normalizeParams(params)
2651
+ });
2652
+ }
2653
+ function _cidrv6(Class, params) {
2654
+ return new Class({
2655
+ type: "string",
2656
+ format: "cidrv6",
2657
+ check: "string_format",
2658
+ abort: false,
2659
+ ...normalizeParams(params)
2660
+ });
2661
+ }
2662
+ function _base64(Class, params) {
2663
+ return new Class({
2664
+ type: "string",
2665
+ format: "base64",
2666
+ check: "string_format",
2667
+ abort: false,
2668
+ ...normalizeParams(params)
2669
+ });
2670
+ }
2671
+ function _base64url(Class, params) {
2672
+ return new Class({
2673
+ type: "string",
2674
+ format: "base64url",
2675
+ check: "string_format",
2676
+ abort: false,
2677
+ ...normalizeParams(params)
2678
+ });
2679
+ }
2680
+ function _e164(Class, params) {
2681
+ return new Class({
2682
+ type: "string",
2683
+ format: "e164",
2684
+ check: "string_format",
2685
+ abort: false,
2686
+ ...normalizeParams(params)
2687
+ });
2688
+ }
2689
+ function _jwt(Class, params) {
2690
+ return new Class({
2691
+ type: "string",
2692
+ format: "jwt",
2693
+ check: "string_format",
2694
+ abort: false,
2695
+ ...normalizeParams(params)
2696
+ });
2697
+ }
2698
+ function _isoDateTime(Class, params) {
2699
+ return new Class({
2700
+ type: "string",
2701
+ format: "datetime",
2702
+ check: "string_format",
2703
+ offset: false,
2704
+ local: false,
2705
+ precision: null,
2706
+ ...normalizeParams(params)
2707
+ });
2708
+ }
2709
+ function _isoDate(Class, params) {
2710
+ return new Class({
2711
+ type: "string",
2712
+ format: "date",
2713
+ check: "string_format",
2714
+ ...normalizeParams(params)
2715
+ });
2716
+ }
2717
+ function _isoTime(Class, params) {
2718
+ return new Class({
2719
+ type: "string",
2720
+ format: "time",
2721
+ check: "string_format",
2722
+ precision: null,
2723
+ ...normalizeParams(params)
2724
+ });
2725
+ }
2726
+ function _isoDuration(Class, params) {
2727
+ return new Class({
2728
+ type: "string",
2729
+ format: "duration",
2730
+ check: "string_format",
2731
+ ...normalizeParams(params)
2732
+ });
2733
+ }
2734
+ function _number(Class, params) {
2735
+ return new Class({
2736
+ type: "number",
2737
+ checks: [],
2738
+ ...normalizeParams(params)
2739
+ });
2740
+ }
2741
+ function _int(Class, params) {
2742
+ return new Class({
2743
+ type: "number",
2744
+ check: "number_format",
2745
+ abort: false,
2746
+ format: "safeint",
2747
+ ...normalizeParams(params)
2748
+ });
2749
+ }
2750
+ function _boolean(Class, params) {
2751
+ return new Class({
2752
+ type: "boolean",
2753
+ ...normalizeParams(params)
2754
+ });
2755
+ }
2756
+ function _unknown(Class) {
2757
+ return new Class({
2758
+ type: "unknown"
2759
+ });
2760
+ }
2761
+ function _never(Class, params) {
2762
+ return new Class({
2763
+ type: "never",
2764
+ ...normalizeParams(params)
2765
+ });
2766
+ }
2767
+ function _lt(value, params) {
2768
+ return new $ZodCheckLessThan({
2769
+ check: "less_than",
2770
+ ...normalizeParams(params),
2771
+ value,
2772
+ inclusive: false
2773
+ });
2774
+ }
2775
+ function _lte(value, params) {
2776
+ return new $ZodCheckLessThan({
2777
+ check: "less_than",
2778
+ ...normalizeParams(params),
2779
+ value,
2780
+ inclusive: true
2781
+ });
2782
+ }
2783
+ function _gt(value, params) {
2784
+ return new $ZodCheckGreaterThan({
2785
+ check: "greater_than",
2786
+ ...normalizeParams(params),
2787
+ value,
2788
+ inclusive: false
2789
+ });
2790
+ }
2791
+ function _gte(value, params) {
2792
+ return new $ZodCheckGreaterThan({
2793
+ check: "greater_than",
2794
+ ...normalizeParams(params),
2795
+ value,
2796
+ inclusive: true
2797
+ });
2798
+ }
2799
+ function _multipleOf(value, params) {
2800
+ return new $ZodCheckMultipleOf({
2801
+ check: "multiple_of",
2802
+ ...normalizeParams(params),
2803
+ value
2804
+ });
2805
+ }
2806
+ function _maxLength(maximum, params) {
2807
+ const ch = new $ZodCheckMaxLength({
2808
+ check: "max_length",
2809
+ ...normalizeParams(params),
2810
+ maximum
2811
+ });
2812
+ return ch;
2813
+ }
2814
+ function _minLength(minimum, params) {
2815
+ return new $ZodCheckMinLength({
2816
+ check: "min_length",
2817
+ ...normalizeParams(params),
2818
+ minimum
2819
+ });
2820
+ }
2821
+ function _length(length, params) {
2822
+ return new $ZodCheckLengthEquals({
2823
+ check: "length_equals",
2824
+ ...normalizeParams(params),
2825
+ length
2826
+ });
2827
+ }
2828
+ function _regex(pattern, params) {
2829
+ return new $ZodCheckRegex({
2830
+ check: "string_format",
2831
+ format: "regex",
2832
+ ...normalizeParams(params),
2833
+ pattern
2834
+ });
2835
+ }
2836
+ function _lowercase(params) {
2837
+ return new $ZodCheckLowerCase({
2838
+ check: "string_format",
2839
+ format: "lowercase",
2840
+ ...normalizeParams(params)
2841
+ });
2842
+ }
2843
+ function _uppercase(params) {
2844
+ return new $ZodCheckUpperCase({
2845
+ check: "string_format",
2846
+ format: "uppercase",
2847
+ ...normalizeParams(params)
2848
+ });
2849
+ }
2850
+ function _includes(includes, params) {
2851
+ return new $ZodCheckIncludes({
2852
+ check: "string_format",
2853
+ format: "includes",
2854
+ ...normalizeParams(params),
2855
+ includes
2856
+ });
2857
+ }
2858
+ function _startsWith(prefix, params) {
2859
+ return new $ZodCheckStartsWith({
2860
+ check: "string_format",
2861
+ format: "starts_with",
2862
+ ...normalizeParams(params),
2863
+ prefix
2864
+ });
2865
+ }
2866
+ function _endsWith(suffix, params) {
2867
+ return new $ZodCheckEndsWith({
2868
+ check: "string_format",
2869
+ format: "ends_with",
2870
+ ...normalizeParams(params),
2871
+ suffix
2872
+ });
2873
+ }
2874
+ function _overwrite(tx) {
2875
+ return new $ZodCheckOverwrite({
2876
+ check: "overwrite",
2877
+ tx
2878
+ });
2879
+ }
2880
+ function _normalize(form) {
2881
+ return _overwrite((input)=>input.normalize(form));
2882
+ }
2883
+ function _trim() {
2884
+ return _overwrite((input)=>input.trim());
2885
+ }
2886
+ function _toLowerCase() {
2887
+ return _overwrite((input)=>input.toLowerCase());
2888
+ }
2889
+ function _toUpperCase() {
2890
+ return _overwrite((input)=>input.toUpperCase());
2891
+ }
2892
+ function _array(Class, element, params) {
2893
+ return new Class({
2894
+ type: "array",
2895
+ element,
2896
+ ...normalizeParams(params)
2897
+ });
2898
+ }
2899
+ function _refine(Class, fn, _params) {
2900
+ const schema = new Class({
2901
+ type: "custom",
2902
+ check: "custom",
2903
+ fn: fn,
2904
+ ...normalizeParams(_params)
2905
+ });
2906
+ return schema;
2907
+ }
2908
+ function _superRefine(fn) {
2909
+ const ch = _check((payload)=>{
2910
+ payload.addIssue = (issue)=>{
2911
+ if ("string" == typeof issue) payload.issues.push(util_issue(issue, payload.value, ch._zod.def));
2912
+ else {
2913
+ const _issue = issue;
2914
+ if (_issue.fatal) _issue.continue = false;
2915
+ _issue.code ?? (_issue.code = "custom");
2916
+ _issue.input ?? (_issue.input = payload.value);
2917
+ _issue.inst ?? (_issue.inst = ch);
2918
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
2919
+ payload.issues.push(util_issue(_issue));
2920
+ }
2921
+ };
2922
+ return fn(payload.value, payload);
2923
+ });
2924
+ return ch;
2925
+ }
2926
+ function _check(fn, params) {
2927
+ const ch = new $ZodCheck({
2928
+ check: "custom",
2929
+ ...normalizeParams(params)
2930
+ });
2931
+ ch._zod.check = fn;
2932
+ return ch;
2933
+ }
2934
+ const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def)=>{
2935
+ $ZodISODateTime.init(inst, def);
2936
+ ZodStringFormat.init(inst, def);
2937
+ });
2938
+ function iso_datetime(params) {
2939
+ return _isoDateTime(ZodISODateTime, params);
2940
+ }
2941
+ const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def)=>{
2942
+ $ZodISODate.init(inst, def);
2943
+ ZodStringFormat.init(inst, def);
2944
+ });
2945
+ function iso_date(params) {
2946
+ return _isoDate(ZodISODate, params);
2947
+ }
2948
+ const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def)=>{
2949
+ $ZodISOTime.init(inst, def);
2950
+ ZodStringFormat.init(inst, def);
2951
+ });
2952
+ function iso_time(params) {
2953
+ return _isoTime(ZodISOTime, params);
2954
+ }
2955
+ const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def)=>{
2956
+ $ZodISODuration.init(inst, def);
2957
+ ZodStringFormat.init(inst, def);
2958
+ });
2959
+ function iso_duration(params) {
2960
+ return _isoDuration(ZodISODuration, params);
2961
+ }
2962
+ const classic_errors_initializer = (inst, issues)=>{
2963
+ $ZodError.init(inst, issues);
2964
+ inst.name = "ZodError";
2965
+ Object.defineProperties(inst, {
2966
+ format: {
2967
+ value: (mapper)=>formatError(inst, mapper)
2968
+ },
2969
+ flatten: {
2970
+ value: (mapper)=>flattenError(inst, mapper)
2971
+ },
2972
+ addIssue: {
2973
+ value: (issue)=>{
2974
+ inst.issues.push(issue);
2975
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
2976
+ }
2977
+ },
2978
+ addIssues: {
2979
+ value: (issues)=>{
2980
+ inst.issues.push(...issues);
2981
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
2982
+ }
2983
+ },
2984
+ isEmpty: {
2985
+ get () {
2986
+ return 0 === inst.issues.length;
2987
+ }
2988
+ }
2989
+ });
2990
+ };
2991
+ $constructor("ZodError", classic_errors_initializer);
2992
+ const ZodRealError = $constructor("ZodError", classic_errors_initializer, {
2993
+ Parent: Error
2994
+ });
2995
+ const classic_parse_parse = /* @__PURE__ */ _parse(ZodRealError);
2996
+ const classic_parse_parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
2997
+ const parse_safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
2998
+ const parse_safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
2999
+ const parse_encode = /* @__PURE__ */ _encode(ZodRealError);
3000
+ const parse_decode = /* @__PURE__ */ _decode(ZodRealError);
3001
+ const parse_encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
3002
+ const parse_decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
3003
+ const parse_safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
3004
+ const parse_safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
3005
+ const parse_safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
3006
+ const parse_safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3007
+ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def)=>{
3008
+ $ZodType.init(inst, def);
3009
+ inst.def = def;
3010
+ inst.type = def.type;
3011
+ Object.defineProperty(inst, "_def", {
3012
+ value: def
3013
+ });
3014
+ inst.check = (...checks)=>inst.clone(mergeDefs(def, {
3015
+ checks: [
3016
+ ...def.checks ?? [],
3017
+ ...checks.map((ch)=>"function" == typeof ch ? {
3018
+ _zod: {
3019
+ check: ch,
3020
+ def: {
3021
+ check: "custom"
3022
+ },
3023
+ onattach: []
3024
+ }
3025
+ } : ch)
3026
+ ]
3027
+ }));
3028
+ inst.clone = (def, params)=>clone(inst, def, params);
3029
+ inst.brand = ()=>inst;
3030
+ inst.register = (reg, meta)=>{
3031
+ reg.add(inst, meta);
3032
+ return inst;
3033
+ };
3034
+ inst.parse = (data, params)=>classic_parse_parse(inst, data, params, {
3035
+ callee: inst.parse
3036
+ });
3037
+ inst.safeParse = (data, params)=>parse_safeParse(inst, data, params);
3038
+ inst.parseAsync = async (data, params)=>classic_parse_parseAsync(inst, data, params, {
3039
+ callee: inst.parseAsync
3040
+ });
3041
+ inst.safeParseAsync = async (data, params)=>parse_safeParseAsync(inst, data, params);
3042
+ inst.spa = inst.safeParseAsync;
3043
+ inst.encode = (data, params)=>parse_encode(inst, data, params);
3044
+ inst.decode = (data, params)=>parse_decode(inst, data, params);
3045
+ inst.encodeAsync = async (data, params)=>parse_encodeAsync(inst, data, params);
3046
+ inst.decodeAsync = async (data, params)=>parse_decodeAsync(inst, data, params);
3047
+ inst.safeEncode = (data, params)=>parse_safeEncode(inst, data, params);
3048
+ inst.safeDecode = (data, params)=>parse_safeDecode(inst, data, params);
3049
+ inst.safeEncodeAsync = async (data, params)=>parse_safeEncodeAsync(inst, data, params);
3050
+ inst.safeDecodeAsync = async (data, params)=>parse_safeDecodeAsync(inst, data, params);
3051
+ inst.refine = (check, params)=>inst.check(refine(check, params));
3052
+ inst.superRefine = (refinement)=>inst.check(superRefine(refinement));
3053
+ inst.overwrite = (fn)=>inst.check(_overwrite(fn));
3054
+ inst.optional = ()=>optional(inst);
3055
+ inst.nullable = ()=>nullable(inst);
3056
+ inst.nullish = ()=>optional(nullable(inst));
3057
+ inst.nonoptional = (params)=>nonoptional(inst, params);
3058
+ inst.array = ()=>schemas_array(inst);
3059
+ inst.or = (arg)=>union([
3060
+ inst,
3061
+ arg
3062
+ ]);
3063
+ inst.and = (arg)=>intersection(inst, arg);
3064
+ inst.transform = (tx)=>pipe(inst, transform(tx));
3065
+ inst.default = (def)=>schemas_default(inst, def);
3066
+ inst.prefault = (def)=>prefault(inst, def);
3067
+ inst.catch = (params)=>schemas_catch(inst, params);
3068
+ inst.pipe = (target)=>pipe(inst, target);
3069
+ inst.readonly = ()=>readonly(inst);
3070
+ inst.describe = (description)=>{
3071
+ const cl = inst.clone();
3072
+ globalRegistry.add(cl, {
3073
+ description
3074
+ });
3075
+ return cl;
3076
+ };
3077
+ Object.defineProperty(inst, "description", {
3078
+ get () {
3079
+ return globalRegistry.get(inst)?.description;
3080
+ },
3081
+ configurable: true
3082
+ });
3083
+ inst.meta = (...args)=>{
3084
+ if (0 === args.length) return globalRegistry.get(inst);
3085
+ const cl = inst.clone();
3086
+ globalRegistry.add(cl, args[0]);
3087
+ return cl;
3088
+ };
3089
+ inst.isOptional = ()=>inst.safeParse(void 0).success;
3090
+ inst.isNullable = ()=>inst.safeParse(null).success;
3091
+ return inst;
3092
+ });
3093
+ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def)=>{
3094
+ $ZodString.init(inst, def);
3095
+ ZodType.init(inst, def);
3096
+ const bag = inst._zod.bag;
3097
+ inst.format = bag.format ?? null;
3098
+ inst.minLength = bag.minimum ?? null;
3099
+ inst.maxLength = bag.maximum ?? null;
3100
+ inst.regex = (...args)=>inst.check(_regex(...args));
3101
+ inst.includes = (...args)=>inst.check(_includes(...args));
3102
+ inst.startsWith = (...args)=>inst.check(_startsWith(...args));
3103
+ inst.endsWith = (...args)=>inst.check(_endsWith(...args));
3104
+ inst.min = (...args)=>inst.check(_minLength(...args));
3105
+ inst.max = (...args)=>inst.check(_maxLength(...args));
3106
+ inst.length = (...args)=>inst.check(_length(...args));
3107
+ inst.nonempty = (...args)=>inst.check(_minLength(1, ...args));
3108
+ inst.lowercase = (params)=>inst.check(_lowercase(params));
3109
+ inst.uppercase = (params)=>inst.check(_uppercase(params));
3110
+ inst.trim = ()=>inst.check(_trim());
3111
+ inst.normalize = (...args)=>inst.check(_normalize(...args));
3112
+ inst.toLowerCase = ()=>inst.check(_toLowerCase());
3113
+ inst.toUpperCase = ()=>inst.check(_toUpperCase());
3114
+ });
3115
+ const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def)=>{
3116
+ $ZodString.init(inst, def);
3117
+ _ZodString.init(inst, def);
3118
+ inst.email = (params)=>inst.check(_email(ZodEmail, params));
3119
+ inst.url = (params)=>inst.check(_url(ZodURL, params));
3120
+ inst.jwt = (params)=>inst.check(_jwt(ZodJWT, params));
3121
+ inst.emoji = (params)=>inst.check(api_emoji(ZodEmoji, params));
3122
+ inst.guid = (params)=>inst.check(_guid(ZodGUID, params));
3123
+ inst.uuid = (params)=>inst.check(_uuid(ZodUUID, params));
3124
+ inst.uuidv4 = (params)=>inst.check(_uuidv4(ZodUUID, params));
3125
+ inst.uuidv6 = (params)=>inst.check(_uuidv6(ZodUUID, params));
3126
+ inst.uuidv7 = (params)=>inst.check(_uuidv7(ZodUUID, params));
3127
+ inst.nanoid = (params)=>inst.check(_nanoid(ZodNanoID, params));
3128
+ inst.guid = (params)=>inst.check(_guid(ZodGUID, params));
3129
+ inst.cuid = (params)=>inst.check(_cuid(ZodCUID, params));
3130
+ inst.cuid2 = (params)=>inst.check(_cuid2(ZodCUID2, params));
3131
+ inst.ulid = (params)=>inst.check(_ulid(ZodULID, params));
3132
+ inst.base64 = (params)=>inst.check(_base64(ZodBase64, params));
3133
+ inst.base64url = (params)=>inst.check(_base64url(ZodBase64URL, params));
3134
+ inst.xid = (params)=>inst.check(_xid(ZodXID, params));
3135
+ inst.ksuid = (params)=>inst.check(_ksuid(ZodKSUID, params));
3136
+ inst.ipv4 = (params)=>inst.check(_ipv4(ZodIPv4, params));
3137
+ inst.ipv6 = (params)=>inst.check(_ipv6(ZodIPv6, params));
3138
+ inst.cidrv4 = (params)=>inst.check(_cidrv4(ZodCIDRv4, params));
3139
+ inst.cidrv6 = (params)=>inst.check(_cidrv6(ZodCIDRv6, params));
3140
+ inst.e164 = (params)=>inst.check(_e164(ZodE164, params));
3141
+ inst.datetime = (params)=>inst.check(iso_datetime(params));
3142
+ inst.date = (params)=>inst.check(iso_date(params));
3143
+ inst.time = (params)=>inst.check(iso_time(params));
3144
+ inst.duration = (params)=>inst.check(iso_duration(params));
3145
+ });
3146
+ function schemas_string(params) {
3147
+ return _string(ZodString, params);
3148
+ }
3149
+ const ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def)=>{
3150
+ $ZodStringFormat.init(inst, def);
3151
+ _ZodString.init(inst, def);
3152
+ });
3153
+ const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def)=>{
3154
+ $ZodEmail.init(inst, def);
3155
+ ZodStringFormat.init(inst, def);
3156
+ });
3157
+ const ZodGUID = /*@__PURE__*/ $constructor("ZodGUID", (inst, def)=>{
3158
+ $ZodGUID.init(inst, def);
3159
+ ZodStringFormat.init(inst, def);
3160
+ });
3161
+ const ZodUUID = /*@__PURE__*/ $constructor("ZodUUID", (inst, def)=>{
3162
+ $ZodUUID.init(inst, def);
3163
+ ZodStringFormat.init(inst, def);
3164
+ });
3165
+ const ZodURL = /*@__PURE__*/ $constructor("ZodURL", (inst, def)=>{
3166
+ $ZodURL.init(inst, def);
3167
+ ZodStringFormat.init(inst, def);
3168
+ });
3169
+ const ZodEmoji = /*@__PURE__*/ $constructor("ZodEmoji", (inst, def)=>{
3170
+ $ZodEmoji.init(inst, def);
3171
+ ZodStringFormat.init(inst, def);
3172
+ });
3173
+ const ZodNanoID = /*@__PURE__*/ $constructor("ZodNanoID", (inst, def)=>{
3174
+ $ZodNanoID.init(inst, def);
3175
+ ZodStringFormat.init(inst, def);
3176
+ });
3177
+ const ZodCUID = /*@__PURE__*/ $constructor("ZodCUID", (inst, def)=>{
3178
+ $ZodCUID.init(inst, def);
3179
+ ZodStringFormat.init(inst, def);
3180
+ });
3181
+ const ZodCUID2 = /*@__PURE__*/ $constructor("ZodCUID2", (inst, def)=>{
3182
+ $ZodCUID2.init(inst, def);
3183
+ ZodStringFormat.init(inst, def);
3184
+ });
3185
+ const ZodULID = /*@__PURE__*/ $constructor("ZodULID", (inst, def)=>{
3186
+ $ZodULID.init(inst, def);
3187
+ ZodStringFormat.init(inst, def);
3188
+ });
3189
+ const ZodXID = /*@__PURE__*/ $constructor("ZodXID", (inst, def)=>{
3190
+ $ZodXID.init(inst, def);
3191
+ ZodStringFormat.init(inst, def);
3192
+ });
3193
+ const ZodKSUID = /*@__PURE__*/ $constructor("ZodKSUID", (inst, def)=>{
3194
+ $ZodKSUID.init(inst, def);
3195
+ ZodStringFormat.init(inst, def);
3196
+ });
3197
+ const ZodIPv4 = /*@__PURE__*/ $constructor("ZodIPv4", (inst, def)=>{
3198
+ $ZodIPv4.init(inst, def);
3199
+ ZodStringFormat.init(inst, def);
3200
+ });
3201
+ const ZodIPv6 = /*@__PURE__*/ $constructor("ZodIPv6", (inst, def)=>{
3202
+ $ZodIPv6.init(inst, def);
3203
+ ZodStringFormat.init(inst, def);
3204
+ });
3205
+ const ZodCIDRv4 = /*@__PURE__*/ $constructor("ZodCIDRv4", (inst, def)=>{
3206
+ $ZodCIDRv4.init(inst, def);
3207
+ ZodStringFormat.init(inst, def);
3208
+ });
3209
+ const ZodCIDRv6 = /*@__PURE__*/ $constructor("ZodCIDRv6", (inst, def)=>{
3210
+ $ZodCIDRv6.init(inst, def);
3211
+ ZodStringFormat.init(inst, def);
3212
+ });
3213
+ const ZodBase64 = /*@__PURE__*/ $constructor("ZodBase64", (inst, def)=>{
3214
+ $ZodBase64.init(inst, def);
3215
+ ZodStringFormat.init(inst, def);
3216
+ });
3217
+ const ZodBase64URL = /*@__PURE__*/ $constructor("ZodBase64URL", (inst, def)=>{
3218
+ $ZodBase64URL.init(inst, def);
3219
+ ZodStringFormat.init(inst, def);
3220
+ });
3221
+ const ZodE164 = /*@__PURE__*/ $constructor("ZodE164", (inst, def)=>{
3222
+ $ZodE164.init(inst, def);
3223
+ ZodStringFormat.init(inst, def);
3224
+ });
3225
+ const ZodJWT = /*@__PURE__*/ $constructor("ZodJWT", (inst, def)=>{
3226
+ $ZodJWT.init(inst, def);
3227
+ ZodStringFormat.init(inst, def);
3228
+ });
3229
+ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def)=>{
3230
+ $ZodNumber.init(inst, def);
3231
+ ZodType.init(inst, def);
3232
+ inst.gt = (value, params)=>inst.check(_gt(value, params));
3233
+ inst.gte = (value, params)=>inst.check(_gte(value, params));
3234
+ inst.min = (value, params)=>inst.check(_gte(value, params));
3235
+ inst.lt = (value, params)=>inst.check(_lt(value, params));
3236
+ inst.lte = (value, params)=>inst.check(_lte(value, params));
3237
+ inst.max = (value, params)=>inst.check(_lte(value, params));
3238
+ inst.int = (params)=>inst.check(schemas_int(params));
3239
+ inst.safe = (params)=>inst.check(schemas_int(params));
3240
+ inst.positive = (params)=>inst.check(_gt(0, params));
3241
+ inst.nonnegative = (params)=>inst.check(_gte(0, params));
3242
+ inst.negative = (params)=>inst.check(_lt(0, params));
3243
+ inst.nonpositive = (params)=>inst.check(_lte(0, params));
3244
+ inst.multipleOf = (value, params)=>inst.check(_multipleOf(value, params));
3245
+ inst.step = (value, params)=>inst.check(_multipleOf(value, params));
3246
+ inst.finite = ()=>inst;
3247
+ const bag = inst._zod.bag;
3248
+ inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
3249
+ inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
3250
+ inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
3251
+ inst.isFinite = true;
3252
+ inst.format = bag.format ?? null;
3253
+ });
3254
+ function schemas_number(params) {
3255
+ return _number(ZodNumber, params);
3256
+ }
3257
+ const ZodNumberFormat = /*@__PURE__*/ $constructor("ZodNumberFormat", (inst, def)=>{
3258
+ $ZodNumberFormat.init(inst, def);
3259
+ ZodNumber.init(inst, def);
3260
+ });
3261
+ function schemas_int(params) {
3262
+ return _int(ZodNumberFormat, params);
3263
+ }
3264
+ const ZodBoolean = /*@__PURE__*/ $constructor("ZodBoolean", (inst, def)=>{
3265
+ $ZodBoolean.init(inst, def);
3266
+ ZodType.init(inst, def);
3267
+ });
3268
+ function schemas_boolean(params) {
3269
+ return _boolean(ZodBoolean, params);
3270
+ }
3271
+ const ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def)=>{
3272
+ $ZodUnknown.init(inst, def);
3273
+ ZodType.init(inst, def);
3274
+ });
3275
+ function unknown() {
3276
+ return _unknown(ZodUnknown);
3277
+ }
3278
+ const ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def)=>{
3279
+ $ZodNever.init(inst, def);
3280
+ ZodType.init(inst, def);
3281
+ });
3282
+ function never(params) {
3283
+ return _never(ZodNever, params);
3284
+ }
3285
+ const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def)=>{
3286
+ $ZodArray.init(inst, def);
3287
+ ZodType.init(inst, def);
3288
+ inst.element = def.element;
3289
+ inst.min = (minLength, params)=>inst.check(_minLength(minLength, params));
3290
+ inst.nonempty = (params)=>inst.check(_minLength(1, params));
3291
+ inst.max = (maxLength, params)=>inst.check(_maxLength(maxLength, params));
3292
+ inst.length = (len, params)=>inst.check(_length(len, params));
3293
+ inst.unwrap = ()=>inst.element;
3294
+ });
3295
+ function schemas_array(element, params) {
3296
+ return _array(ZodArray, element, params);
3297
+ }
3298
+ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def)=>{
3299
+ $ZodObjectJIT.init(inst, def);
3300
+ ZodType.init(inst, def);
3301
+ defineLazy(inst, "shape", ()=>def.shape);
3302
+ inst.keyof = ()=>schemas_enum(Object.keys(inst._zod.def.shape));
3303
+ inst.catchall = (catchall)=>inst.clone({
3304
+ ...inst._zod.def,
3305
+ catchall: catchall
3306
+ });
3307
+ inst.passthrough = ()=>inst.clone({
3308
+ ...inst._zod.def,
3309
+ catchall: unknown()
3310
+ });
3311
+ inst.loose = ()=>inst.clone({
3312
+ ...inst._zod.def,
3313
+ catchall: unknown()
3314
+ });
3315
+ inst.strict = ()=>inst.clone({
3316
+ ...inst._zod.def,
3317
+ catchall: never()
3318
+ });
3319
+ inst.strip = ()=>inst.clone({
3320
+ ...inst._zod.def,
3321
+ catchall: void 0
3322
+ });
3323
+ inst.extend = (incoming)=>extend(inst, incoming);
3324
+ inst.safeExtend = (incoming)=>safeExtend(inst, incoming);
3325
+ inst.merge = (other)=>merge(inst, other);
3326
+ inst.pick = (mask)=>pick(inst, mask);
3327
+ inst.omit = (mask)=>omit(inst, mask);
3328
+ inst.partial = (...args)=>partial(ZodOptional, inst, args[0]);
3329
+ inst.required = (...args)=>required(ZodNonOptional, inst, args[0]);
3330
+ });
3331
+ function schemas_object(shape, params) {
3332
+ const def = {
3333
+ type: "object",
3334
+ shape: shape ?? {},
3335
+ ...normalizeParams(params)
3336
+ };
3337
+ return new ZodObject(def);
3338
+ }
3339
+ const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def)=>{
3340
+ $ZodUnion.init(inst, def);
3341
+ ZodType.init(inst, def);
3342
+ inst.options = def.options;
3343
+ });
3344
+ function union(options, params) {
3345
+ return new ZodUnion({
3346
+ type: "union",
3347
+ options: options,
3348
+ ...normalizeParams(params)
3349
+ });
3350
+ }
3351
+ const ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def)=>{
3352
+ $ZodIntersection.init(inst, def);
3353
+ ZodType.init(inst, def);
3354
+ });
3355
+ function intersection(left, right) {
3356
+ return new ZodIntersection({
3357
+ type: "intersection",
3358
+ left: left,
3359
+ right: right
3360
+ });
3361
+ }
3362
+ const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def)=>{
3363
+ $ZodEnum.init(inst, def);
3364
+ ZodType.init(inst, def);
3365
+ inst.enum = def.entries;
3366
+ inst.options = Object.values(def.entries);
3367
+ const keys = new Set(Object.keys(def.entries));
3368
+ inst.extract = (values, params)=>{
3369
+ const newEntries = {};
3370
+ for (const value of values)if (keys.has(value)) newEntries[value] = def.entries[value];
3371
+ else throw new Error(`Key ${value} not found in enum`);
3372
+ return new ZodEnum({
3373
+ ...def,
3374
+ checks: [],
3375
+ ...normalizeParams(params),
3376
+ entries: newEntries
3377
+ });
3378
+ };
3379
+ inst.exclude = (values, params)=>{
3380
+ const newEntries = {
3381
+ ...def.entries
3382
+ };
3383
+ for (const value of values)if (keys.has(value)) delete newEntries[value];
3384
+ else throw new Error(`Key ${value} not found in enum`);
3385
+ return new ZodEnum({
3386
+ ...def,
3387
+ checks: [],
3388
+ ...normalizeParams(params),
3389
+ entries: newEntries
3390
+ });
3391
+ };
3392
+ });
3393
+ function schemas_enum(values, params) {
3394
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v)=>[
3395
+ v,
3396
+ v
3397
+ ])) : values;
3398
+ return new ZodEnum({
3399
+ type: "enum",
3400
+ entries,
3401
+ ...normalizeParams(params)
3402
+ });
3403
+ }
3404
+ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def)=>{
3405
+ $ZodTransform.init(inst, def);
3406
+ ZodType.init(inst, def);
3407
+ inst._zod.parse = (payload, _ctx)=>{
3408
+ if ("backward" === _ctx.direction) throw new $ZodEncodeError(inst.constructor.name);
3409
+ payload.addIssue = (issue)=>{
3410
+ if ("string" == typeof issue) payload.issues.push(util_issue(issue, payload.value, def));
3411
+ else {
3412
+ const _issue = issue;
3413
+ if (_issue.fatal) _issue.continue = false;
3414
+ _issue.code ?? (_issue.code = "custom");
3415
+ _issue.input ?? (_issue.input = payload.value);
3416
+ _issue.inst ?? (_issue.inst = inst);
3417
+ payload.issues.push(util_issue(_issue));
3418
+ }
3419
+ };
3420
+ const output = def.transform(payload.value, payload);
3421
+ if (output instanceof Promise) return output.then((output)=>{
3422
+ payload.value = output;
3423
+ return payload;
3424
+ });
3425
+ payload.value = output;
3426
+ return payload;
3427
+ };
3428
+ });
3429
+ function transform(fn) {
3430
+ return new ZodTransform({
3431
+ type: "transform",
3432
+ transform: fn
3433
+ });
3434
+ }
3435
+ const ZodOptional = /*@__PURE__*/ $constructor("ZodOptional", (inst, def)=>{
3436
+ $ZodOptional.init(inst, def);
3437
+ ZodType.init(inst, def);
3438
+ inst.unwrap = ()=>inst._zod.def.innerType;
3439
+ });
3440
+ function optional(innerType) {
3441
+ return new ZodOptional({
3442
+ type: "optional",
3443
+ innerType: innerType
3444
+ });
3445
+ }
3446
+ const ZodNullable = /*@__PURE__*/ $constructor("ZodNullable", (inst, def)=>{
3447
+ $ZodNullable.init(inst, def);
3448
+ ZodType.init(inst, def);
3449
+ inst.unwrap = ()=>inst._zod.def.innerType;
3450
+ });
3451
+ function nullable(innerType) {
3452
+ return new ZodNullable({
3453
+ type: "nullable",
3454
+ innerType: innerType
3455
+ });
3456
+ }
3457
+ const ZodDefault = /*@__PURE__*/ $constructor("ZodDefault", (inst, def)=>{
3458
+ $ZodDefault.init(inst, def);
3459
+ ZodType.init(inst, def);
3460
+ inst.unwrap = ()=>inst._zod.def.innerType;
3461
+ inst.removeDefault = inst.unwrap;
3462
+ });
3463
+ function schemas_default(innerType, defaultValue) {
3464
+ return new ZodDefault({
3465
+ type: "default",
3466
+ innerType: innerType,
3467
+ get defaultValue () {
3468
+ return "function" == typeof defaultValue ? defaultValue() : shallowClone(defaultValue);
3469
+ }
3470
+ });
3471
+ }
3472
+ const ZodPrefault = /*@__PURE__*/ $constructor("ZodPrefault", (inst, def)=>{
3473
+ $ZodPrefault.init(inst, def);
3474
+ ZodType.init(inst, def);
3475
+ inst.unwrap = ()=>inst._zod.def.innerType;
3476
+ });
3477
+ function prefault(innerType, defaultValue) {
3478
+ return new ZodPrefault({
3479
+ type: "prefault",
3480
+ innerType: innerType,
3481
+ get defaultValue () {
3482
+ return "function" == typeof defaultValue ? defaultValue() : shallowClone(defaultValue);
3483
+ }
3484
+ });
3485
+ }
3486
+ const ZodNonOptional = /*@__PURE__*/ $constructor("ZodNonOptional", (inst, def)=>{
3487
+ $ZodNonOptional.init(inst, def);
3488
+ ZodType.init(inst, def);
3489
+ inst.unwrap = ()=>inst._zod.def.innerType;
3490
+ });
3491
+ function nonoptional(innerType, params) {
3492
+ return new ZodNonOptional({
3493
+ type: "nonoptional",
3494
+ innerType: innerType,
3495
+ ...normalizeParams(params)
3496
+ });
3497
+ }
3498
+ const ZodCatch = /*@__PURE__*/ $constructor("ZodCatch", (inst, def)=>{
3499
+ $ZodCatch.init(inst, def);
3500
+ ZodType.init(inst, def);
3501
+ inst.unwrap = ()=>inst._zod.def.innerType;
3502
+ inst.removeCatch = inst.unwrap;
3503
+ });
3504
+ function schemas_catch(innerType, catchValue) {
3505
+ return new ZodCatch({
3506
+ type: "catch",
3507
+ innerType: innerType,
3508
+ catchValue: "function" == typeof catchValue ? catchValue : ()=>catchValue
3509
+ });
3510
+ }
3511
+ const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def)=>{
3512
+ $ZodPipe.init(inst, def);
3513
+ ZodType.init(inst, def);
3514
+ inst.in = def.in;
3515
+ inst.out = def.out;
3516
+ });
3517
+ function pipe(in_, out) {
3518
+ return new ZodPipe({
3519
+ type: "pipe",
3520
+ in: in_,
3521
+ out: out
3522
+ });
3523
+ }
3524
+ const ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def)=>{
3525
+ $ZodReadonly.init(inst, def);
3526
+ ZodType.init(inst, def);
3527
+ inst.unwrap = ()=>inst._zod.def.innerType;
3528
+ });
3529
+ function readonly(innerType) {
3530
+ return new ZodReadonly({
3531
+ type: "readonly",
3532
+ innerType: innerType
3533
+ });
3534
+ }
3535
+ const ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def)=>{
3536
+ $ZodCustom.init(inst, def);
3537
+ ZodType.init(inst, def);
3538
+ });
3539
+ function refine(fn, _params = {}) {
3540
+ return _refine(ZodCustom, fn, _params);
3541
+ }
3542
+ function superRefine(fn) {
3543
+ return _superRefine(fn);
3544
+ }
3545
+ var compat_ZodFirstPartyTypeKind;
3546
+ compat_ZodFirstPartyTypeKind || (compat_ZodFirstPartyTypeKind = {});
3547
+ core_config(en());
3548
+ const CookieBaseSchema = schemas_object({
3549
+ domain: schemas_string().optional(),
3550
+ path: schemas_string().optional(),
3551
+ expires: schemas_number().optional(),
3552
+ httpOnly: schemas_boolean().optional(),
3553
+ secure: schemas_boolean().optional(),
3554
+ session: schemas_boolean().optional()
3555
+ });
3556
+ const CookieSchema = CookieBaseSchema.extend({
3557
+ url: schemas_string(),
3558
+ name: schemas_string().optional(),
3559
+ value: schemas_string().optional(),
3560
+ sameSite: schemas_enum([
3561
+ 'unspecified',
3562
+ 'no_restriction',
3563
+ 'lax',
3564
+ 'strict'
3565
+ ]).optional()
3566
+ });
3567
+ const CDPSameSite = schemas_enum([
3568
+ "Strict",
3569
+ "Lax",
3570
+ "None"
3571
+ ]);
3572
+ const CDPCookiePriority = schemas_enum([
3573
+ "Low",
3574
+ "Medium",
3575
+ "High"
3576
+ ]);
3577
+ const CDPSourceScheme = schemas_enum([
3578
+ "Unset",
3579
+ "NonSecure",
3580
+ "Secure"
3581
+ ]);
3582
+ const CDPCookieSchema = CookieBaseSchema.extend({
3583
+ name: schemas_string(),
3584
+ value: schemas_string(),
3585
+ url: schemas_string().optional(),
3586
+ sameSite: CDPSameSite.optional(),
3587
+ size: schemas_number().optional(),
3588
+ partitionKey: schemas_object({
3589
+ topLevelSite: schemas_string(),
3590
+ hasCrossSiteAncestor: schemas_boolean()
3591
+ }).optional(),
3592
+ priority: CDPCookiePriority.optional(),
3593
+ sameParty: schemas_boolean().optional(),
3594
+ sourceScheme: CDPSourceScheme.optional(),
3595
+ sourcePort: schemas_number().optional()
3596
+ });
3597
+ var types_TaskState = /*#__PURE__*/ function(TaskState) {
3598
+ TaskState["INIT"] = "INIT";
3599
+ TaskState["ACTION"] = "ACTION";
3600
+ TaskState["WAIT_SCAN"] = "WAIT_SCAN";
3601
+ TaskState["SCANNED"] = "SCANNED";
3602
+ TaskState["CONFIRMED"] = "CONFIRMED";
3603
+ TaskState["SUCCESS"] = "SUCCESS";
3604
+ TaskState["FAILED"] = "FAILED";
3605
+ TaskState["TIMEOUT"] = "TIMEOUT";
3606
+ return TaskState;
3607
+ }({});
3608
+ export { CDPCookiePriority, CDPCookieSchema, CDPSameSite, CDPSourceScheme, CookieBaseSchema, CookieSchema, types_TaskState as TaskState, downloadImage, ensureFile, ensureFileSync, fetchJSON, getFilenameFromUrl, isNil, pathExists, randomString, utils_response as response, semver, sleep, success, writeFile };