sixseconds-modules 1.6.112 → 1.6.113

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.es.js CHANGED
@@ -1342,7 +1342,7 @@ function requireReactIs_production_min() {
1342
1342
  if (hasRequiredReactIs_production_min) return reactIs_production_min;
1343
1343
  hasRequiredReactIs_production_min = 1;
1344
1344
  var b = "function" === typeof Symbol && Symbol.for, c = b ? Symbol.for("react.element") : 60103, d = b ? Symbol.for("react.portal") : 60106, e = b ? Symbol.for("react.fragment") : 60107, f = b ? Symbol.for("react.strict_mode") : 60108, g = b ? Symbol.for("react.profiler") : 60114, h = b ? Symbol.for("react.provider") : 60109, k = b ? Symbol.for("react.context") : 60110, l = b ? Symbol.for("react.async_mode") : 60111, m = b ? Symbol.for("react.concurrent_mode") : 60111, n = b ? Symbol.for("react.forward_ref") : 60112, p = b ? Symbol.for("react.suspense") : 60113, q = b ? Symbol.for("react.suspense_list") : 60120, r = b ? Symbol.for("react.memo") : 60115, t = b ? Symbol.for("react.lazy") : 60116, v = b ? Symbol.for("react.block") : 60121, w = b ? Symbol.for("react.fundamental") : 60117, x = b ? Symbol.for("react.responder") : 60118, y = b ? Symbol.for("react.scope") : 60119;
1345
- function z(a) {
1345
+ function z2(a) {
1346
1346
  if ("object" === typeof a && null !== a) {
1347
1347
  var u = a.$$typeof;
1348
1348
  switch (u) {
@@ -1373,7 +1373,7 @@ function requireReactIs_production_min() {
1373
1373
  }
1374
1374
  }
1375
1375
  function A(a) {
1376
- return z(a) === m;
1376
+ return z2(a) === m;
1377
1377
  }
1378
1378
  reactIs_production_min.AsyncMode = l;
1379
1379
  reactIs_production_min.ConcurrentMode = m;
@@ -1389,46 +1389,46 @@ function requireReactIs_production_min() {
1389
1389
  reactIs_production_min.StrictMode = f;
1390
1390
  reactIs_production_min.Suspense = p;
1391
1391
  reactIs_production_min.isAsyncMode = function(a) {
1392
- return A(a) || z(a) === l;
1392
+ return A(a) || z2(a) === l;
1393
1393
  };
1394
1394
  reactIs_production_min.isConcurrentMode = A;
1395
1395
  reactIs_production_min.isContextConsumer = function(a) {
1396
- return z(a) === k;
1396
+ return z2(a) === k;
1397
1397
  };
1398
1398
  reactIs_production_min.isContextProvider = function(a) {
1399
- return z(a) === h;
1399
+ return z2(a) === h;
1400
1400
  };
1401
1401
  reactIs_production_min.isElement = function(a) {
1402
1402
  return "object" === typeof a && null !== a && a.$$typeof === c;
1403
1403
  };
1404
1404
  reactIs_production_min.isForwardRef = function(a) {
1405
- return z(a) === n;
1405
+ return z2(a) === n;
1406
1406
  };
1407
1407
  reactIs_production_min.isFragment = function(a) {
1408
- return z(a) === e;
1408
+ return z2(a) === e;
1409
1409
  };
1410
1410
  reactIs_production_min.isLazy = function(a) {
1411
- return z(a) === t;
1411
+ return z2(a) === t;
1412
1412
  };
1413
1413
  reactIs_production_min.isMemo = function(a) {
1414
- return z(a) === r;
1414
+ return z2(a) === r;
1415
1415
  };
1416
1416
  reactIs_production_min.isPortal = function(a) {
1417
- return z(a) === d;
1417
+ return z2(a) === d;
1418
1418
  };
1419
1419
  reactIs_production_min.isProfiler = function(a) {
1420
- return z(a) === g;
1420
+ return z2(a) === g;
1421
1421
  };
1422
1422
  reactIs_production_min.isStrictMode = function(a) {
1423
- return z(a) === f;
1423
+ return z2(a) === f;
1424
1424
  };
1425
1425
  reactIs_production_min.isSuspense = function(a) {
1426
- return z(a) === p;
1426
+ return z2(a) === p;
1427
1427
  };
1428
1428
  reactIs_production_min.isValidElementType = function(a) {
1429
1429
  return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
1430
1430
  };
1431
- reactIs_production_min.typeOf = z;
1431
+ reactIs_production_min.typeOf = z2;
1432
1432
  return reactIs_production_min;
1433
1433
  }
1434
1434
  var reactIs_development = {};
@@ -2655,8 +2655,4070 @@ function createEnv(opts) {
2655
2655
  }
2656
2656
  return runtimeEnv;
2657
2657
  }
2658
- const __vite_import_meta_env__ = { "BASE_URL": "/", "DEV": false, "MODE": "production", "PROD": true, "SSR": false, "VITE_MODULES_CARDS_ADMIN_FRONTEND_BASE_URL": "https://admin-cards.6seconds.org", "VITE_MODULES_CARDS_HOME_FRONTEND_BASE_URL": "https://cards.6seconds.org", "VITE_MODULES_CERT_FRONTEND_BASE_URL": "https://cert.6seconds.org", "VITE_MODULES_EVENTS_FRONTEND_BASE_URL": "https://events.6seconds.org", "VITE_MODULES_SSO_BACKEND_BASE_URL": "https://ssoapi.6seconds.org", "VITE_MODULES_SSO_FRONTEND_BASE_URL": "https://sso.6seconds.org", "VITE_MODULES_TOOLS_FRONTEND_BASE_URL": "https://newtools.6seconds.org" };
2658
+ var util;
2659
+ (function(util2) {
2660
+ util2.assertEqual = (val) => val;
2661
+ function assertIs(_arg) {
2662
+ }
2663
+ util2.assertIs = assertIs;
2664
+ function assertNever(_x) {
2665
+ throw new Error();
2666
+ }
2667
+ util2.assertNever = assertNever;
2668
+ util2.arrayToEnum = (items) => {
2669
+ const obj = {};
2670
+ for (const item of items) {
2671
+ obj[item] = item;
2672
+ }
2673
+ return obj;
2674
+ };
2675
+ util2.getValidEnumValues = (obj) => {
2676
+ const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
2677
+ const filtered = {};
2678
+ for (const k of validKeys) {
2679
+ filtered[k] = obj[k];
2680
+ }
2681
+ return util2.objectValues(filtered);
2682
+ };
2683
+ util2.objectValues = (obj) => {
2684
+ return util2.objectKeys(obj).map(function(e) {
2685
+ return obj[e];
2686
+ });
2687
+ };
2688
+ util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object2) => {
2689
+ const keys2 = [];
2690
+ for (const key in object2) {
2691
+ if (Object.prototype.hasOwnProperty.call(object2, key)) {
2692
+ keys2.push(key);
2693
+ }
2694
+ }
2695
+ return keys2;
2696
+ };
2697
+ util2.find = (arr, checker) => {
2698
+ for (const item of arr) {
2699
+ if (checker(item))
2700
+ return item;
2701
+ }
2702
+ return void 0;
2703
+ };
2704
+ util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
2705
+ function joinValues(array2, separator = " | ") {
2706
+ return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
2707
+ }
2708
+ util2.joinValues = joinValues;
2709
+ util2.jsonStringifyReplacer = (_, value) => {
2710
+ if (typeof value === "bigint") {
2711
+ return value.toString();
2712
+ }
2713
+ return value;
2714
+ };
2715
+ })(util || (util = {}));
2716
+ var objectUtil;
2717
+ (function(objectUtil2) {
2718
+ objectUtil2.mergeShapes = (first, second) => {
2719
+ return {
2720
+ ...first,
2721
+ ...second
2722
+ // second overwrites first
2723
+ };
2724
+ };
2725
+ })(objectUtil || (objectUtil = {}));
2726
+ const ZodParsedType = util.arrayToEnum([
2727
+ "string",
2728
+ "nan",
2729
+ "number",
2730
+ "integer",
2731
+ "float",
2732
+ "boolean",
2733
+ "date",
2734
+ "bigint",
2735
+ "symbol",
2736
+ "function",
2737
+ "undefined",
2738
+ "null",
2739
+ "array",
2740
+ "object",
2741
+ "unknown",
2742
+ "promise",
2743
+ "void",
2744
+ "never",
2745
+ "map",
2746
+ "set"
2747
+ ]);
2748
+ const getParsedType = (data) => {
2749
+ const t = typeof data;
2750
+ switch (t) {
2751
+ case "undefined":
2752
+ return ZodParsedType.undefined;
2753
+ case "string":
2754
+ return ZodParsedType.string;
2755
+ case "number":
2756
+ return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
2757
+ case "boolean":
2758
+ return ZodParsedType.boolean;
2759
+ case "function":
2760
+ return ZodParsedType.function;
2761
+ case "bigint":
2762
+ return ZodParsedType.bigint;
2763
+ case "symbol":
2764
+ return ZodParsedType.symbol;
2765
+ case "object":
2766
+ if (Array.isArray(data)) {
2767
+ return ZodParsedType.array;
2768
+ }
2769
+ if (data === null) {
2770
+ return ZodParsedType.null;
2771
+ }
2772
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
2773
+ return ZodParsedType.promise;
2774
+ }
2775
+ if (typeof Map !== "undefined" && data instanceof Map) {
2776
+ return ZodParsedType.map;
2777
+ }
2778
+ if (typeof Set !== "undefined" && data instanceof Set) {
2779
+ return ZodParsedType.set;
2780
+ }
2781
+ if (typeof Date !== "undefined" && data instanceof Date) {
2782
+ return ZodParsedType.date;
2783
+ }
2784
+ return ZodParsedType.object;
2785
+ default:
2786
+ return ZodParsedType.unknown;
2787
+ }
2788
+ };
2789
+ const ZodIssueCode = util.arrayToEnum([
2790
+ "invalid_type",
2791
+ "invalid_literal",
2792
+ "custom",
2793
+ "invalid_union",
2794
+ "invalid_union_discriminator",
2795
+ "invalid_enum_value",
2796
+ "unrecognized_keys",
2797
+ "invalid_arguments",
2798
+ "invalid_return_type",
2799
+ "invalid_date",
2800
+ "invalid_string",
2801
+ "too_small",
2802
+ "too_big",
2803
+ "invalid_intersection_types",
2804
+ "not_multiple_of",
2805
+ "not_finite"
2806
+ ]);
2807
+ const quotelessJson = (obj) => {
2808
+ const json = JSON.stringify(obj, null, 2);
2809
+ return json.replace(/"([^"]+)":/g, "$1:");
2810
+ };
2811
+ class ZodError extends Error {
2812
+ get errors() {
2813
+ return this.issues;
2814
+ }
2815
+ constructor(issues) {
2816
+ super();
2817
+ this.issues = [];
2818
+ this.addIssue = (sub) => {
2819
+ this.issues = [...this.issues, sub];
2820
+ };
2821
+ this.addIssues = (subs = []) => {
2822
+ this.issues = [...this.issues, ...subs];
2823
+ };
2824
+ const actualProto = new.target.prototype;
2825
+ if (Object.setPrototypeOf) {
2826
+ Object.setPrototypeOf(this, actualProto);
2827
+ } else {
2828
+ this.__proto__ = actualProto;
2829
+ }
2830
+ this.name = "ZodError";
2831
+ this.issues = issues;
2832
+ }
2833
+ format(_mapper) {
2834
+ const mapper = _mapper || function(issue) {
2835
+ return issue.message;
2836
+ };
2837
+ const fieldErrors = { _errors: [] };
2838
+ const processError = (error) => {
2839
+ for (const issue of error.issues) {
2840
+ if (issue.code === "invalid_union") {
2841
+ issue.unionErrors.map(processError);
2842
+ } else if (issue.code === "invalid_return_type") {
2843
+ processError(issue.returnTypeError);
2844
+ } else if (issue.code === "invalid_arguments") {
2845
+ processError(issue.argumentsError);
2846
+ } else if (issue.path.length === 0) {
2847
+ fieldErrors._errors.push(mapper(issue));
2848
+ } else {
2849
+ let curr = fieldErrors;
2850
+ let i = 0;
2851
+ while (i < issue.path.length) {
2852
+ const el = issue.path[i];
2853
+ const terminal = i === issue.path.length - 1;
2854
+ if (!terminal) {
2855
+ curr[el] = curr[el] || { _errors: [] };
2856
+ } else {
2857
+ curr[el] = curr[el] || { _errors: [] };
2858
+ curr[el]._errors.push(mapper(issue));
2859
+ }
2860
+ curr = curr[el];
2861
+ i++;
2862
+ }
2863
+ }
2864
+ }
2865
+ };
2866
+ processError(this);
2867
+ return fieldErrors;
2868
+ }
2869
+ static assert(value) {
2870
+ if (!(value instanceof ZodError)) {
2871
+ throw new Error(`Not a ZodError: ${value}`);
2872
+ }
2873
+ }
2874
+ toString() {
2875
+ return this.message;
2876
+ }
2877
+ get message() {
2878
+ return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
2879
+ }
2880
+ get isEmpty() {
2881
+ return this.issues.length === 0;
2882
+ }
2883
+ flatten(mapper = (issue) => issue.message) {
2884
+ const fieldErrors = {};
2885
+ const formErrors = [];
2886
+ for (const sub of this.issues) {
2887
+ if (sub.path.length > 0) {
2888
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
2889
+ fieldErrors[sub.path[0]].push(mapper(sub));
2890
+ } else {
2891
+ formErrors.push(mapper(sub));
2892
+ }
2893
+ }
2894
+ return { formErrors, fieldErrors };
2895
+ }
2896
+ get formErrors() {
2897
+ return this.flatten();
2898
+ }
2899
+ }
2900
+ ZodError.create = (issues) => {
2901
+ const error = new ZodError(issues);
2902
+ return error;
2903
+ };
2904
+ const errorMap = (issue, _ctx) => {
2905
+ let message;
2906
+ switch (issue.code) {
2907
+ case ZodIssueCode.invalid_type:
2908
+ if (issue.received === ZodParsedType.undefined) {
2909
+ message = "Required";
2910
+ } else {
2911
+ message = `Expected ${issue.expected}, received ${issue.received}`;
2912
+ }
2913
+ break;
2914
+ case ZodIssueCode.invalid_literal:
2915
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
2916
+ break;
2917
+ case ZodIssueCode.unrecognized_keys:
2918
+ message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
2919
+ break;
2920
+ case ZodIssueCode.invalid_union:
2921
+ message = `Invalid input`;
2922
+ break;
2923
+ case ZodIssueCode.invalid_union_discriminator:
2924
+ message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
2925
+ break;
2926
+ case ZodIssueCode.invalid_enum_value:
2927
+ message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
2928
+ break;
2929
+ case ZodIssueCode.invalid_arguments:
2930
+ message = `Invalid function arguments`;
2931
+ break;
2932
+ case ZodIssueCode.invalid_return_type:
2933
+ message = `Invalid function return type`;
2934
+ break;
2935
+ case ZodIssueCode.invalid_date:
2936
+ message = `Invalid date`;
2937
+ break;
2938
+ case ZodIssueCode.invalid_string:
2939
+ if (typeof issue.validation === "object") {
2940
+ if ("includes" in issue.validation) {
2941
+ message = `Invalid input: must include "${issue.validation.includes}"`;
2942
+ if (typeof issue.validation.position === "number") {
2943
+ message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
2944
+ }
2945
+ } else if ("startsWith" in issue.validation) {
2946
+ message = `Invalid input: must start with "${issue.validation.startsWith}"`;
2947
+ } else if ("endsWith" in issue.validation) {
2948
+ message = `Invalid input: must end with "${issue.validation.endsWith}"`;
2949
+ } else {
2950
+ util.assertNever(issue.validation);
2951
+ }
2952
+ } else if (issue.validation !== "regex") {
2953
+ message = `Invalid ${issue.validation}`;
2954
+ } else {
2955
+ message = "Invalid";
2956
+ }
2957
+ break;
2958
+ case ZodIssueCode.too_small:
2959
+ if (issue.type === "array")
2960
+ message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
2961
+ else if (issue.type === "string")
2962
+ message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
2963
+ else if (issue.type === "number")
2964
+ message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
2965
+ else if (issue.type === "date")
2966
+ message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
2967
+ else
2968
+ message = "Invalid input";
2969
+ break;
2970
+ case ZodIssueCode.too_big:
2971
+ if (issue.type === "array")
2972
+ message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
2973
+ else if (issue.type === "string")
2974
+ message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
2975
+ else if (issue.type === "number")
2976
+ message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
2977
+ else if (issue.type === "bigint")
2978
+ message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
2979
+ else if (issue.type === "date")
2980
+ message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
2981
+ else
2982
+ message = "Invalid input";
2983
+ break;
2984
+ case ZodIssueCode.custom:
2985
+ message = `Invalid input`;
2986
+ break;
2987
+ case ZodIssueCode.invalid_intersection_types:
2988
+ message = `Intersection results could not be merged`;
2989
+ break;
2990
+ case ZodIssueCode.not_multiple_of:
2991
+ message = `Number must be a multiple of ${issue.multipleOf}`;
2992
+ break;
2993
+ case ZodIssueCode.not_finite:
2994
+ message = "Number must be finite";
2995
+ break;
2996
+ default:
2997
+ message = _ctx.defaultError;
2998
+ util.assertNever(issue);
2999
+ }
3000
+ return { message };
3001
+ };
3002
+ let overrideErrorMap = errorMap;
3003
+ function setErrorMap(map2) {
3004
+ overrideErrorMap = map2;
3005
+ }
3006
+ function getErrorMap() {
3007
+ return overrideErrorMap;
3008
+ }
3009
+ const makeIssue = (params) => {
3010
+ const { data, path, errorMaps, issueData } = params;
3011
+ const fullPath = [...path, ...issueData.path || []];
3012
+ const fullIssue = {
3013
+ ...issueData,
3014
+ path: fullPath
3015
+ };
3016
+ if (issueData.message !== void 0) {
3017
+ return {
3018
+ ...issueData,
3019
+ path: fullPath,
3020
+ message: issueData.message
3021
+ };
3022
+ }
3023
+ let errorMessage = "";
3024
+ const maps = errorMaps.filter((m) => !!m).slice().reverse();
3025
+ for (const map2 of maps) {
3026
+ errorMessage = map2(fullIssue, { data, defaultError: errorMessage }).message;
3027
+ }
3028
+ return {
3029
+ ...issueData,
3030
+ path: fullPath,
3031
+ message: errorMessage
3032
+ };
3033
+ };
3034
+ const EMPTY_PATH = [];
3035
+ function addIssueToContext(ctx, issueData) {
3036
+ const overrideMap = getErrorMap();
3037
+ const issue = makeIssue({
3038
+ issueData,
3039
+ data: ctx.data,
3040
+ path: ctx.path,
3041
+ errorMaps: [
3042
+ ctx.common.contextualErrorMap,
3043
+ // contextual error map is first priority
3044
+ ctx.schemaErrorMap,
3045
+ // then schema-bound map if available
3046
+ overrideMap,
3047
+ // then global override map
3048
+ overrideMap === errorMap ? void 0 : errorMap
3049
+ // then global default map
3050
+ ].filter((x) => !!x)
3051
+ });
3052
+ ctx.common.issues.push(issue);
3053
+ }
3054
+ class ParseStatus {
3055
+ constructor() {
3056
+ this.value = "valid";
3057
+ }
3058
+ dirty() {
3059
+ if (this.value === "valid")
3060
+ this.value = "dirty";
3061
+ }
3062
+ abort() {
3063
+ if (this.value !== "aborted")
3064
+ this.value = "aborted";
3065
+ }
3066
+ static mergeArray(status, results) {
3067
+ const arrayValue = [];
3068
+ for (const s of results) {
3069
+ if (s.status === "aborted")
3070
+ return INVALID;
3071
+ if (s.status === "dirty")
3072
+ status.dirty();
3073
+ arrayValue.push(s.value);
3074
+ }
3075
+ return { status: status.value, value: arrayValue };
3076
+ }
3077
+ static async mergeObjectAsync(status, pairs) {
3078
+ const syncPairs = [];
3079
+ for (const pair of pairs) {
3080
+ const key = await pair.key;
3081
+ const value = await pair.value;
3082
+ syncPairs.push({
3083
+ key,
3084
+ value
3085
+ });
3086
+ }
3087
+ return ParseStatus.mergeObjectSync(status, syncPairs);
3088
+ }
3089
+ static mergeObjectSync(status, pairs) {
3090
+ const finalObject = {};
3091
+ for (const pair of pairs) {
3092
+ const { key, value } = pair;
3093
+ if (key.status === "aborted")
3094
+ return INVALID;
3095
+ if (value.status === "aborted")
3096
+ return INVALID;
3097
+ if (key.status === "dirty")
3098
+ status.dirty();
3099
+ if (value.status === "dirty")
3100
+ status.dirty();
3101
+ if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
3102
+ finalObject[key.value] = value.value;
3103
+ }
3104
+ }
3105
+ return { status: status.value, value: finalObject };
3106
+ }
3107
+ }
3108
+ const INVALID = Object.freeze({
3109
+ status: "aborted"
3110
+ });
3111
+ const DIRTY = (value) => ({ status: "dirty", value });
3112
+ const OK = (value) => ({ status: "valid", value });
3113
+ const isAborted = (x) => x.status === "aborted";
3114
+ const isDirty = (x) => x.status === "dirty";
3115
+ const isValid$3 = (x) => x.status === "valid";
3116
+ const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
3117
+ function __classPrivateFieldGet(receiver, state, kind, f) {
3118
+ if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
3119
+ return state.get(receiver);
3120
+ }
3121
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
3122
+ if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
3123
+ return state.set(receiver, value), value;
3124
+ }
3125
+ typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
3126
+ var e = new Error(message);
3127
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
3128
+ };
3129
+ var errorUtil;
3130
+ (function(errorUtil2) {
3131
+ errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
3132
+ errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
3133
+ })(errorUtil || (errorUtil = {}));
3134
+ var _ZodEnum_cache, _ZodNativeEnum_cache;
3135
+ class ParseInputLazyPath {
3136
+ constructor(parent, value, path, key) {
3137
+ this._cachedPath = [];
3138
+ this.parent = parent;
3139
+ this.data = value;
3140
+ this._path = path;
3141
+ this._key = key;
3142
+ }
3143
+ get path() {
3144
+ if (!this._cachedPath.length) {
3145
+ if (this._key instanceof Array) {
3146
+ this._cachedPath.push(...this._path, ...this._key);
3147
+ } else {
3148
+ this._cachedPath.push(...this._path, this._key);
3149
+ }
3150
+ }
3151
+ return this._cachedPath;
3152
+ }
3153
+ }
3154
+ const handleResult = (ctx, result) => {
3155
+ if (isValid$3(result)) {
3156
+ return { success: true, data: result.value };
3157
+ } else {
3158
+ if (!ctx.common.issues.length) {
3159
+ throw new Error("Validation failed but no issues detected.");
3160
+ }
3161
+ return {
3162
+ success: false,
3163
+ get error() {
3164
+ if (this._error)
3165
+ return this._error;
3166
+ const error = new ZodError(ctx.common.issues);
3167
+ this._error = error;
3168
+ return this._error;
3169
+ }
3170
+ };
3171
+ }
3172
+ };
3173
+ function processCreateParams(params) {
3174
+ if (!params)
3175
+ return {};
3176
+ const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
3177
+ if (errorMap2 && (invalid_type_error || required_error)) {
3178
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
3179
+ }
3180
+ if (errorMap2)
3181
+ return { errorMap: errorMap2, description };
3182
+ const customMap = (iss, ctx) => {
3183
+ var _a, _b;
3184
+ const { message } = params;
3185
+ if (iss.code === "invalid_enum_value") {
3186
+ return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
3187
+ }
3188
+ if (typeof ctx.data === "undefined") {
3189
+ return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
3190
+ }
3191
+ if (iss.code !== "invalid_type")
3192
+ return { message: ctx.defaultError };
3193
+ return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
3194
+ };
3195
+ return { errorMap: customMap, description };
3196
+ }
3197
+ class ZodType {
3198
+ get description() {
3199
+ return this._def.description;
3200
+ }
3201
+ _getType(input) {
3202
+ return getParsedType(input.data);
3203
+ }
3204
+ _getOrReturnCtx(input, ctx) {
3205
+ return ctx || {
3206
+ common: input.parent.common,
3207
+ data: input.data,
3208
+ parsedType: getParsedType(input.data),
3209
+ schemaErrorMap: this._def.errorMap,
3210
+ path: input.path,
3211
+ parent: input.parent
3212
+ };
3213
+ }
3214
+ _processInputParams(input) {
3215
+ return {
3216
+ status: new ParseStatus(),
3217
+ ctx: {
3218
+ common: input.parent.common,
3219
+ data: input.data,
3220
+ parsedType: getParsedType(input.data),
3221
+ schemaErrorMap: this._def.errorMap,
3222
+ path: input.path,
3223
+ parent: input.parent
3224
+ }
3225
+ };
3226
+ }
3227
+ _parseSync(input) {
3228
+ const result = this._parse(input);
3229
+ if (isAsync(result)) {
3230
+ throw new Error("Synchronous parse encountered promise.");
3231
+ }
3232
+ return result;
3233
+ }
3234
+ _parseAsync(input) {
3235
+ const result = this._parse(input);
3236
+ return Promise.resolve(result);
3237
+ }
3238
+ parse(data, params) {
3239
+ const result = this.safeParse(data, params);
3240
+ if (result.success)
3241
+ return result.data;
3242
+ throw result.error;
3243
+ }
3244
+ safeParse(data, params) {
3245
+ var _a;
3246
+ const ctx = {
3247
+ common: {
3248
+ issues: [],
3249
+ async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
3250
+ contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
3251
+ },
3252
+ path: (params === null || params === void 0 ? void 0 : params.path) || [],
3253
+ schemaErrorMap: this._def.errorMap,
3254
+ parent: null,
3255
+ data,
3256
+ parsedType: getParsedType(data)
3257
+ };
3258
+ const result = this._parseSync({ data, path: ctx.path, parent: ctx });
3259
+ return handleResult(ctx, result);
3260
+ }
3261
+ "~validate"(data) {
3262
+ var _a, _b;
3263
+ const ctx = {
3264
+ common: {
3265
+ issues: [],
3266
+ async: !!this["~standard"].async
3267
+ },
3268
+ path: [],
3269
+ schemaErrorMap: this._def.errorMap,
3270
+ parent: null,
3271
+ data,
3272
+ parsedType: getParsedType(data)
3273
+ };
3274
+ if (!this["~standard"].async) {
3275
+ try {
3276
+ const result = this._parseSync({ data, path: [], parent: ctx });
3277
+ return isValid$3(result) ? {
3278
+ value: result.value
3279
+ } : {
3280
+ issues: ctx.common.issues
3281
+ };
3282
+ } catch (err) {
3283
+ if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
3284
+ this["~standard"].async = true;
3285
+ }
3286
+ ctx.common = {
3287
+ issues: [],
3288
+ async: true
3289
+ };
3290
+ }
3291
+ }
3292
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid$3(result) ? {
3293
+ value: result.value
3294
+ } : {
3295
+ issues: ctx.common.issues
3296
+ });
3297
+ }
3298
+ async parseAsync(data, params) {
3299
+ const result = await this.safeParseAsync(data, params);
3300
+ if (result.success)
3301
+ return result.data;
3302
+ throw result.error;
3303
+ }
3304
+ async safeParseAsync(data, params) {
3305
+ const ctx = {
3306
+ common: {
3307
+ issues: [],
3308
+ contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
3309
+ async: true
3310
+ },
3311
+ path: (params === null || params === void 0 ? void 0 : params.path) || [],
3312
+ schemaErrorMap: this._def.errorMap,
3313
+ parent: null,
3314
+ data,
3315
+ parsedType: getParsedType(data)
3316
+ };
3317
+ const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
3318
+ const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
3319
+ return handleResult(ctx, result);
3320
+ }
3321
+ refine(check, message) {
3322
+ const getIssueProperties = (val) => {
3323
+ if (typeof message === "string" || typeof message === "undefined") {
3324
+ return { message };
3325
+ } else if (typeof message === "function") {
3326
+ return message(val);
3327
+ } else {
3328
+ return message;
3329
+ }
3330
+ };
3331
+ return this._refinement((val, ctx) => {
3332
+ const result = check(val);
3333
+ const setError = () => ctx.addIssue({
3334
+ code: ZodIssueCode.custom,
3335
+ ...getIssueProperties(val)
3336
+ });
3337
+ if (typeof Promise !== "undefined" && result instanceof Promise) {
3338
+ return result.then((data) => {
3339
+ if (!data) {
3340
+ setError();
3341
+ return false;
3342
+ } else {
3343
+ return true;
3344
+ }
3345
+ });
3346
+ }
3347
+ if (!result) {
3348
+ setError();
3349
+ return false;
3350
+ } else {
3351
+ return true;
3352
+ }
3353
+ });
3354
+ }
3355
+ refinement(check, refinementData) {
3356
+ return this._refinement((val, ctx) => {
3357
+ if (!check(val)) {
3358
+ ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
3359
+ return false;
3360
+ } else {
3361
+ return true;
3362
+ }
3363
+ });
3364
+ }
3365
+ _refinement(refinement) {
3366
+ return new ZodEffects({
3367
+ schema: this,
3368
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
3369
+ effect: { type: "refinement", refinement }
3370
+ });
3371
+ }
3372
+ superRefine(refinement) {
3373
+ return this._refinement(refinement);
3374
+ }
3375
+ constructor(def) {
3376
+ this.spa = this.safeParseAsync;
3377
+ this._def = def;
3378
+ this.parse = this.parse.bind(this);
3379
+ this.safeParse = this.safeParse.bind(this);
3380
+ this.parseAsync = this.parseAsync.bind(this);
3381
+ this.safeParseAsync = this.safeParseAsync.bind(this);
3382
+ this.spa = this.spa.bind(this);
3383
+ this.refine = this.refine.bind(this);
3384
+ this.refinement = this.refinement.bind(this);
3385
+ this.superRefine = this.superRefine.bind(this);
3386
+ this.optional = this.optional.bind(this);
3387
+ this.nullable = this.nullable.bind(this);
3388
+ this.nullish = this.nullish.bind(this);
3389
+ this.array = this.array.bind(this);
3390
+ this.promise = this.promise.bind(this);
3391
+ this.or = this.or.bind(this);
3392
+ this.and = this.and.bind(this);
3393
+ this.transform = this.transform.bind(this);
3394
+ this.brand = this.brand.bind(this);
3395
+ this.default = this.default.bind(this);
3396
+ this.catch = this.catch.bind(this);
3397
+ this.describe = this.describe.bind(this);
3398
+ this.pipe = this.pipe.bind(this);
3399
+ this.readonly = this.readonly.bind(this);
3400
+ this.isNullable = this.isNullable.bind(this);
3401
+ this.isOptional = this.isOptional.bind(this);
3402
+ this["~standard"] = {
3403
+ version: 1,
3404
+ vendor: "zod",
3405
+ validate: (data) => this["~validate"](data)
3406
+ };
3407
+ }
3408
+ optional() {
3409
+ return ZodOptional.create(this, this._def);
3410
+ }
3411
+ nullable() {
3412
+ return ZodNullable.create(this, this._def);
3413
+ }
3414
+ nullish() {
3415
+ return this.nullable().optional();
3416
+ }
3417
+ array() {
3418
+ return ZodArray.create(this);
3419
+ }
3420
+ promise() {
3421
+ return ZodPromise.create(this, this._def);
3422
+ }
3423
+ or(option) {
3424
+ return ZodUnion.create([this, option], this._def);
3425
+ }
3426
+ and(incoming) {
3427
+ return ZodIntersection.create(this, incoming, this._def);
3428
+ }
3429
+ transform(transform) {
3430
+ return new ZodEffects({
3431
+ ...processCreateParams(this._def),
3432
+ schema: this,
3433
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
3434
+ effect: { type: "transform", transform }
3435
+ });
3436
+ }
3437
+ default(def) {
3438
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
3439
+ return new ZodDefault({
3440
+ ...processCreateParams(this._def),
3441
+ innerType: this,
3442
+ defaultValue: defaultValueFunc,
3443
+ typeName: ZodFirstPartyTypeKind.ZodDefault
3444
+ });
3445
+ }
3446
+ brand() {
3447
+ return new ZodBranded({
3448
+ typeName: ZodFirstPartyTypeKind.ZodBranded,
3449
+ type: this,
3450
+ ...processCreateParams(this._def)
3451
+ });
3452
+ }
3453
+ catch(def) {
3454
+ const catchValueFunc = typeof def === "function" ? def : () => def;
3455
+ return new ZodCatch({
3456
+ ...processCreateParams(this._def),
3457
+ innerType: this,
3458
+ catchValue: catchValueFunc,
3459
+ typeName: ZodFirstPartyTypeKind.ZodCatch
3460
+ });
3461
+ }
3462
+ describe(description) {
3463
+ const This = this.constructor;
3464
+ return new This({
3465
+ ...this._def,
3466
+ description
3467
+ });
3468
+ }
3469
+ pipe(target) {
3470
+ return ZodPipeline.create(this, target);
3471
+ }
3472
+ readonly() {
3473
+ return ZodReadonly.create(this);
3474
+ }
3475
+ isOptional() {
3476
+ return this.safeParse(void 0).success;
3477
+ }
3478
+ isNullable() {
3479
+ return this.safeParse(null).success;
3480
+ }
3481
+ }
3482
+ const cuidRegex = /^c[^\s-]{8,}$/i;
3483
+ const cuid2Regex = /^[0-9a-z]+$/;
3484
+ const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
3485
+ const uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
3486
+ const nanoidRegex = /^[a-z0-9_-]{21}$/i;
3487
+ const jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
3488
+ const durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
3489
+ const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
3490
+ const _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
3491
+ let emojiRegex;
3492
+ const ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
3493
+ const ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
3494
+ const ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
3495
+ const ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
3496
+ const base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
3497
+ const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
3498
+ const dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
3499
+ const dateRegex = new RegExp(`^${dateRegexSource}$`);
3500
+ function timeRegexSource(args) {
3501
+ let secondsRegexSource = `[0-5]\\d`;
3502
+ if (args.precision) {
3503
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
3504
+ } else if (args.precision == null) {
3505
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
3506
+ }
3507
+ const secondsQuantifier = args.precision ? "+" : "?";
3508
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
3509
+ }
3510
+ function timeRegex(args) {
3511
+ return new RegExp(`^${timeRegexSource(args)}$`);
3512
+ }
3513
+ function datetimeRegex(args) {
3514
+ let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
3515
+ const opts = [];
3516
+ opts.push(args.local ? `Z?` : `Z`);
3517
+ if (args.offset)
3518
+ opts.push(`([+-]\\d{2}:?\\d{2})`);
3519
+ regex = `${regex}(${opts.join("|")})`;
3520
+ return new RegExp(`^${regex}$`);
3521
+ }
3522
+ function isValidIP(ip, version) {
3523
+ if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
3524
+ return true;
3525
+ }
3526
+ if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
3527
+ return true;
3528
+ }
3529
+ return false;
3530
+ }
3531
+ function isValidJWT(jwt, alg) {
3532
+ if (!jwtRegex.test(jwt))
3533
+ return false;
3534
+ try {
3535
+ const [header] = jwt.split(".");
3536
+ const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
3537
+ const decoded = JSON.parse(atob(base64));
3538
+ if (typeof decoded !== "object" || decoded === null)
3539
+ return false;
3540
+ if (!decoded.typ || !decoded.alg)
3541
+ return false;
3542
+ if (alg && decoded.alg !== alg)
3543
+ return false;
3544
+ return true;
3545
+ } catch (_a) {
3546
+ return false;
3547
+ }
3548
+ }
3549
+ function isValidCidr(ip, version) {
3550
+ if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
3551
+ return true;
3552
+ }
3553
+ if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
3554
+ return true;
3555
+ }
3556
+ return false;
3557
+ }
3558
+ class ZodString extends ZodType {
3559
+ _parse(input) {
3560
+ if (this._def.coerce) {
3561
+ input.data = String(input.data);
3562
+ }
3563
+ const parsedType = this._getType(input);
3564
+ if (parsedType !== ZodParsedType.string) {
3565
+ const ctx2 = this._getOrReturnCtx(input);
3566
+ addIssueToContext(ctx2, {
3567
+ code: ZodIssueCode.invalid_type,
3568
+ expected: ZodParsedType.string,
3569
+ received: ctx2.parsedType
3570
+ });
3571
+ return INVALID;
3572
+ }
3573
+ const status = new ParseStatus();
3574
+ let ctx = void 0;
3575
+ for (const check of this._def.checks) {
3576
+ if (check.kind === "min") {
3577
+ if (input.data.length < check.value) {
3578
+ ctx = this._getOrReturnCtx(input, ctx);
3579
+ addIssueToContext(ctx, {
3580
+ code: ZodIssueCode.too_small,
3581
+ minimum: check.value,
3582
+ type: "string",
3583
+ inclusive: true,
3584
+ exact: false,
3585
+ message: check.message
3586
+ });
3587
+ status.dirty();
3588
+ }
3589
+ } else if (check.kind === "max") {
3590
+ if (input.data.length > check.value) {
3591
+ ctx = this._getOrReturnCtx(input, ctx);
3592
+ addIssueToContext(ctx, {
3593
+ code: ZodIssueCode.too_big,
3594
+ maximum: check.value,
3595
+ type: "string",
3596
+ inclusive: true,
3597
+ exact: false,
3598
+ message: check.message
3599
+ });
3600
+ status.dirty();
3601
+ }
3602
+ } else if (check.kind === "length") {
3603
+ const tooBig = input.data.length > check.value;
3604
+ const tooSmall = input.data.length < check.value;
3605
+ if (tooBig || tooSmall) {
3606
+ ctx = this._getOrReturnCtx(input, ctx);
3607
+ if (tooBig) {
3608
+ addIssueToContext(ctx, {
3609
+ code: ZodIssueCode.too_big,
3610
+ maximum: check.value,
3611
+ type: "string",
3612
+ inclusive: true,
3613
+ exact: true,
3614
+ message: check.message
3615
+ });
3616
+ } else if (tooSmall) {
3617
+ addIssueToContext(ctx, {
3618
+ code: ZodIssueCode.too_small,
3619
+ minimum: check.value,
3620
+ type: "string",
3621
+ inclusive: true,
3622
+ exact: true,
3623
+ message: check.message
3624
+ });
3625
+ }
3626
+ status.dirty();
3627
+ }
3628
+ } else if (check.kind === "email") {
3629
+ if (!emailRegex.test(input.data)) {
3630
+ ctx = this._getOrReturnCtx(input, ctx);
3631
+ addIssueToContext(ctx, {
3632
+ validation: "email",
3633
+ code: ZodIssueCode.invalid_string,
3634
+ message: check.message
3635
+ });
3636
+ status.dirty();
3637
+ }
3638
+ } else if (check.kind === "emoji") {
3639
+ if (!emojiRegex) {
3640
+ emojiRegex = new RegExp(_emojiRegex, "u");
3641
+ }
3642
+ if (!emojiRegex.test(input.data)) {
3643
+ ctx = this._getOrReturnCtx(input, ctx);
3644
+ addIssueToContext(ctx, {
3645
+ validation: "emoji",
3646
+ code: ZodIssueCode.invalid_string,
3647
+ message: check.message
3648
+ });
3649
+ status.dirty();
3650
+ }
3651
+ } else if (check.kind === "uuid") {
3652
+ if (!uuidRegex.test(input.data)) {
3653
+ ctx = this._getOrReturnCtx(input, ctx);
3654
+ addIssueToContext(ctx, {
3655
+ validation: "uuid",
3656
+ code: ZodIssueCode.invalid_string,
3657
+ message: check.message
3658
+ });
3659
+ status.dirty();
3660
+ }
3661
+ } else if (check.kind === "nanoid") {
3662
+ if (!nanoidRegex.test(input.data)) {
3663
+ ctx = this._getOrReturnCtx(input, ctx);
3664
+ addIssueToContext(ctx, {
3665
+ validation: "nanoid",
3666
+ code: ZodIssueCode.invalid_string,
3667
+ message: check.message
3668
+ });
3669
+ status.dirty();
3670
+ }
3671
+ } else if (check.kind === "cuid") {
3672
+ if (!cuidRegex.test(input.data)) {
3673
+ ctx = this._getOrReturnCtx(input, ctx);
3674
+ addIssueToContext(ctx, {
3675
+ validation: "cuid",
3676
+ code: ZodIssueCode.invalid_string,
3677
+ message: check.message
3678
+ });
3679
+ status.dirty();
3680
+ }
3681
+ } else if (check.kind === "cuid2") {
3682
+ if (!cuid2Regex.test(input.data)) {
3683
+ ctx = this._getOrReturnCtx(input, ctx);
3684
+ addIssueToContext(ctx, {
3685
+ validation: "cuid2",
3686
+ code: ZodIssueCode.invalid_string,
3687
+ message: check.message
3688
+ });
3689
+ status.dirty();
3690
+ }
3691
+ } else if (check.kind === "ulid") {
3692
+ if (!ulidRegex.test(input.data)) {
3693
+ ctx = this._getOrReturnCtx(input, ctx);
3694
+ addIssueToContext(ctx, {
3695
+ validation: "ulid",
3696
+ code: ZodIssueCode.invalid_string,
3697
+ message: check.message
3698
+ });
3699
+ status.dirty();
3700
+ }
3701
+ } else if (check.kind === "url") {
3702
+ try {
3703
+ new URL(input.data);
3704
+ } catch (_a) {
3705
+ ctx = this._getOrReturnCtx(input, ctx);
3706
+ addIssueToContext(ctx, {
3707
+ validation: "url",
3708
+ code: ZodIssueCode.invalid_string,
3709
+ message: check.message
3710
+ });
3711
+ status.dirty();
3712
+ }
3713
+ } else if (check.kind === "regex") {
3714
+ check.regex.lastIndex = 0;
3715
+ const testResult = check.regex.test(input.data);
3716
+ if (!testResult) {
3717
+ ctx = this._getOrReturnCtx(input, ctx);
3718
+ addIssueToContext(ctx, {
3719
+ validation: "regex",
3720
+ code: ZodIssueCode.invalid_string,
3721
+ message: check.message
3722
+ });
3723
+ status.dirty();
3724
+ }
3725
+ } else if (check.kind === "trim") {
3726
+ input.data = input.data.trim();
3727
+ } else if (check.kind === "includes") {
3728
+ if (!input.data.includes(check.value, check.position)) {
3729
+ ctx = this._getOrReturnCtx(input, ctx);
3730
+ addIssueToContext(ctx, {
3731
+ code: ZodIssueCode.invalid_string,
3732
+ validation: { includes: check.value, position: check.position },
3733
+ message: check.message
3734
+ });
3735
+ status.dirty();
3736
+ }
3737
+ } else if (check.kind === "toLowerCase") {
3738
+ input.data = input.data.toLowerCase();
3739
+ } else if (check.kind === "toUpperCase") {
3740
+ input.data = input.data.toUpperCase();
3741
+ } else if (check.kind === "startsWith") {
3742
+ if (!input.data.startsWith(check.value)) {
3743
+ ctx = this._getOrReturnCtx(input, ctx);
3744
+ addIssueToContext(ctx, {
3745
+ code: ZodIssueCode.invalid_string,
3746
+ validation: { startsWith: check.value },
3747
+ message: check.message
3748
+ });
3749
+ status.dirty();
3750
+ }
3751
+ } else if (check.kind === "endsWith") {
3752
+ if (!input.data.endsWith(check.value)) {
3753
+ ctx = this._getOrReturnCtx(input, ctx);
3754
+ addIssueToContext(ctx, {
3755
+ code: ZodIssueCode.invalid_string,
3756
+ validation: { endsWith: check.value },
3757
+ message: check.message
3758
+ });
3759
+ status.dirty();
3760
+ }
3761
+ } else if (check.kind === "datetime") {
3762
+ const regex = datetimeRegex(check);
3763
+ if (!regex.test(input.data)) {
3764
+ ctx = this._getOrReturnCtx(input, ctx);
3765
+ addIssueToContext(ctx, {
3766
+ code: ZodIssueCode.invalid_string,
3767
+ validation: "datetime",
3768
+ message: check.message
3769
+ });
3770
+ status.dirty();
3771
+ }
3772
+ } else if (check.kind === "date") {
3773
+ const regex = dateRegex;
3774
+ if (!regex.test(input.data)) {
3775
+ ctx = this._getOrReturnCtx(input, ctx);
3776
+ addIssueToContext(ctx, {
3777
+ code: ZodIssueCode.invalid_string,
3778
+ validation: "date",
3779
+ message: check.message
3780
+ });
3781
+ status.dirty();
3782
+ }
3783
+ } else if (check.kind === "time") {
3784
+ const regex = timeRegex(check);
3785
+ if (!regex.test(input.data)) {
3786
+ ctx = this._getOrReturnCtx(input, ctx);
3787
+ addIssueToContext(ctx, {
3788
+ code: ZodIssueCode.invalid_string,
3789
+ validation: "time",
3790
+ message: check.message
3791
+ });
3792
+ status.dirty();
3793
+ }
3794
+ } else if (check.kind === "duration") {
3795
+ if (!durationRegex.test(input.data)) {
3796
+ ctx = this._getOrReturnCtx(input, ctx);
3797
+ addIssueToContext(ctx, {
3798
+ validation: "duration",
3799
+ code: ZodIssueCode.invalid_string,
3800
+ message: check.message
3801
+ });
3802
+ status.dirty();
3803
+ }
3804
+ } else if (check.kind === "ip") {
3805
+ if (!isValidIP(input.data, check.version)) {
3806
+ ctx = this._getOrReturnCtx(input, ctx);
3807
+ addIssueToContext(ctx, {
3808
+ validation: "ip",
3809
+ code: ZodIssueCode.invalid_string,
3810
+ message: check.message
3811
+ });
3812
+ status.dirty();
3813
+ }
3814
+ } else if (check.kind === "jwt") {
3815
+ if (!isValidJWT(input.data, check.alg)) {
3816
+ ctx = this._getOrReturnCtx(input, ctx);
3817
+ addIssueToContext(ctx, {
3818
+ validation: "jwt",
3819
+ code: ZodIssueCode.invalid_string,
3820
+ message: check.message
3821
+ });
3822
+ status.dirty();
3823
+ }
3824
+ } else if (check.kind === "cidr") {
3825
+ if (!isValidCidr(input.data, check.version)) {
3826
+ ctx = this._getOrReturnCtx(input, ctx);
3827
+ addIssueToContext(ctx, {
3828
+ validation: "cidr",
3829
+ code: ZodIssueCode.invalid_string,
3830
+ message: check.message
3831
+ });
3832
+ status.dirty();
3833
+ }
3834
+ } else if (check.kind === "base64") {
3835
+ if (!base64Regex.test(input.data)) {
3836
+ ctx = this._getOrReturnCtx(input, ctx);
3837
+ addIssueToContext(ctx, {
3838
+ validation: "base64",
3839
+ code: ZodIssueCode.invalid_string,
3840
+ message: check.message
3841
+ });
3842
+ status.dirty();
3843
+ }
3844
+ } else if (check.kind === "base64url") {
3845
+ if (!base64urlRegex.test(input.data)) {
3846
+ ctx = this._getOrReturnCtx(input, ctx);
3847
+ addIssueToContext(ctx, {
3848
+ validation: "base64url",
3849
+ code: ZodIssueCode.invalid_string,
3850
+ message: check.message
3851
+ });
3852
+ status.dirty();
3853
+ }
3854
+ } else {
3855
+ util.assertNever(check);
3856
+ }
3857
+ }
3858
+ return { status: status.value, value: input.data };
3859
+ }
3860
+ _regex(regex, validation, message) {
3861
+ return this.refinement((data) => regex.test(data), {
3862
+ validation,
3863
+ code: ZodIssueCode.invalid_string,
3864
+ ...errorUtil.errToObj(message)
3865
+ });
3866
+ }
3867
+ _addCheck(check) {
3868
+ return new ZodString({
3869
+ ...this._def,
3870
+ checks: [...this._def.checks, check]
3871
+ });
3872
+ }
3873
+ email(message) {
3874
+ return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
3875
+ }
3876
+ url(message) {
3877
+ return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
3878
+ }
3879
+ emoji(message) {
3880
+ return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
3881
+ }
3882
+ uuid(message) {
3883
+ return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
3884
+ }
3885
+ nanoid(message) {
3886
+ return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
3887
+ }
3888
+ cuid(message) {
3889
+ return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
3890
+ }
3891
+ cuid2(message) {
3892
+ return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
3893
+ }
3894
+ ulid(message) {
3895
+ return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
3896
+ }
3897
+ base64(message) {
3898
+ return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
3899
+ }
3900
+ base64url(message) {
3901
+ return this._addCheck({
3902
+ kind: "base64url",
3903
+ ...errorUtil.errToObj(message)
3904
+ });
3905
+ }
3906
+ jwt(options) {
3907
+ return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
3908
+ }
3909
+ ip(options) {
3910
+ return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
3911
+ }
3912
+ cidr(options) {
3913
+ return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
3914
+ }
3915
+ datetime(options) {
3916
+ var _a, _b;
3917
+ if (typeof options === "string") {
3918
+ return this._addCheck({
3919
+ kind: "datetime",
3920
+ precision: null,
3921
+ offset: false,
3922
+ local: false,
3923
+ message: options
3924
+ });
3925
+ }
3926
+ return this._addCheck({
3927
+ kind: "datetime",
3928
+ precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
3929
+ offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
3930
+ local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
3931
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
3932
+ });
3933
+ }
3934
+ date(message) {
3935
+ return this._addCheck({ kind: "date", message });
3936
+ }
3937
+ time(options) {
3938
+ if (typeof options === "string") {
3939
+ return this._addCheck({
3940
+ kind: "time",
3941
+ precision: null,
3942
+ message: options
3943
+ });
3944
+ }
3945
+ return this._addCheck({
3946
+ kind: "time",
3947
+ precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
3948
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
3949
+ });
3950
+ }
3951
+ duration(message) {
3952
+ return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
3953
+ }
3954
+ regex(regex, message) {
3955
+ return this._addCheck({
3956
+ kind: "regex",
3957
+ regex,
3958
+ ...errorUtil.errToObj(message)
3959
+ });
3960
+ }
3961
+ includes(value, options) {
3962
+ return this._addCheck({
3963
+ kind: "includes",
3964
+ value,
3965
+ position: options === null || options === void 0 ? void 0 : options.position,
3966
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
3967
+ });
3968
+ }
3969
+ startsWith(value, message) {
3970
+ return this._addCheck({
3971
+ kind: "startsWith",
3972
+ value,
3973
+ ...errorUtil.errToObj(message)
3974
+ });
3975
+ }
3976
+ endsWith(value, message) {
3977
+ return this._addCheck({
3978
+ kind: "endsWith",
3979
+ value,
3980
+ ...errorUtil.errToObj(message)
3981
+ });
3982
+ }
3983
+ min(minLength, message) {
3984
+ return this._addCheck({
3985
+ kind: "min",
3986
+ value: minLength,
3987
+ ...errorUtil.errToObj(message)
3988
+ });
3989
+ }
3990
+ max(maxLength, message) {
3991
+ return this._addCheck({
3992
+ kind: "max",
3993
+ value: maxLength,
3994
+ ...errorUtil.errToObj(message)
3995
+ });
3996
+ }
3997
+ length(len, message) {
3998
+ return this._addCheck({
3999
+ kind: "length",
4000
+ value: len,
4001
+ ...errorUtil.errToObj(message)
4002
+ });
4003
+ }
4004
+ /**
4005
+ * Equivalent to `.min(1)`
4006
+ */
4007
+ nonempty(message) {
4008
+ return this.min(1, errorUtil.errToObj(message));
4009
+ }
4010
+ trim() {
4011
+ return new ZodString({
4012
+ ...this._def,
4013
+ checks: [...this._def.checks, { kind: "trim" }]
4014
+ });
4015
+ }
4016
+ toLowerCase() {
4017
+ return new ZodString({
4018
+ ...this._def,
4019
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
4020
+ });
4021
+ }
4022
+ toUpperCase() {
4023
+ return new ZodString({
4024
+ ...this._def,
4025
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
4026
+ });
4027
+ }
4028
+ get isDatetime() {
4029
+ return !!this._def.checks.find((ch) => ch.kind === "datetime");
4030
+ }
4031
+ get isDate() {
4032
+ return !!this._def.checks.find((ch) => ch.kind === "date");
4033
+ }
4034
+ get isTime() {
4035
+ return !!this._def.checks.find((ch) => ch.kind === "time");
4036
+ }
4037
+ get isDuration() {
4038
+ return !!this._def.checks.find((ch) => ch.kind === "duration");
4039
+ }
4040
+ get isEmail() {
4041
+ return !!this._def.checks.find((ch) => ch.kind === "email");
4042
+ }
4043
+ get isURL() {
4044
+ return !!this._def.checks.find((ch) => ch.kind === "url");
4045
+ }
4046
+ get isEmoji() {
4047
+ return !!this._def.checks.find((ch) => ch.kind === "emoji");
4048
+ }
4049
+ get isUUID() {
4050
+ return !!this._def.checks.find((ch) => ch.kind === "uuid");
4051
+ }
4052
+ get isNANOID() {
4053
+ return !!this._def.checks.find((ch) => ch.kind === "nanoid");
4054
+ }
4055
+ get isCUID() {
4056
+ return !!this._def.checks.find((ch) => ch.kind === "cuid");
4057
+ }
4058
+ get isCUID2() {
4059
+ return !!this._def.checks.find((ch) => ch.kind === "cuid2");
4060
+ }
4061
+ get isULID() {
4062
+ return !!this._def.checks.find((ch) => ch.kind === "ulid");
4063
+ }
4064
+ get isIP() {
4065
+ return !!this._def.checks.find((ch) => ch.kind === "ip");
4066
+ }
4067
+ get isCIDR() {
4068
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
4069
+ }
4070
+ get isBase64() {
4071
+ return !!this._def.checks.find((ch) => ch.kind === "base64");
4072
+ }
4073
+ get isBase64url() {
4074
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
4075
+ }
4076
+ get minLength() {
4077
+ let min2 = null;
4078
+ for (const ch of this._def.checks) {
4079
+ if (ch.kind === "min") {
4080
+ if (min2 === null || ch.value > min2)
4081
+ min2 = ch.value;
4082
+ }
4083
+ }
4084
+ return min2;
4085
+ }
4086
+ get maxLength() {
4087
+ let max2 = null;
4088
+ for (const ch of this._def.checks) {
4089
+ if (ch.kind === "max") {
4090
+ if (max2 === null || ch.value < max2)
4091
+ max2 = ch.value;
4092
+ }
4093
+ }
4094
+ return max2;
4095
+ }
4096
+ }
4097
+ ZodString.create = (params) => {
4098
+ var _a;
4099
+ return new ZodString({
4100
+ checks: [],
4101
+ typeName: ZodFirstPartyTypeKind.ZodString,
4102
+ coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
4103
+ ...processCreateParams(params)
4104
+ });
4105
+ };
4106
+ function floatSafeRemainder(val, step) {
4107
+ const valDecCount = (val.toString().split(".")[1] || "").length;
4108
+ const stepDecCount = (step.toString().split(".")[1] || "").length;
4109
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
4110
+ const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
4111
+ const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
4112
+ return valInt % stepInt / Math.pow(10, decCount);
4113
+ }
4114
+ class ZodNumber extends ZodType {
4115
+ constructor() {
4116
+ super(...arguments);
4117
+ this.min = this.gte;
4118
+ this.max = this.lte;
4119
+ this.step = this.multipleOf;
4120
+ }
4121
+ _parse(input) {
4122
+ if (this._def.coerce) {
4123
+ input.data = Number(input.data);
4124
+ }
4125
+ const parsedType = this._getType(input);
4126
+ if (parsedType !== ZodParsedType.number) {
4127
+ const ctx2 = this._getOrReturnCtx(input);
4128
+ addIssueToContext(ctx2, {
4129
+ code: ZodIssueCode.invalid_type,
4130
+ expected: ZodParsedType.number,
4131
+ received: ctx2.parsedType
4132
+ });
4133
+ return INVALID;
4134
+ }
4135
+ let ctx = void 0;
4136
+ const status = new ParseStatus();
4137
+ for (const check of this._def.checks) {
4138
+ if (check.kind === "int") {
4139
+ if (!util.isInteger(input.data)) {
4140
+ ctx = this._getOrReturnCtx(input, ctx);
4141
+ addIssueToContext(ctx, {
4142
+ code: ZodIssueCode.invalid_type,
4143
+ expected: "integer",
4144
+ received: "float",
4145
+ message: check.message
4146
+ });
4147
+ status.dirty();
4148
+ }
4149
+ } else if (check.kind === "min") {
4150
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
4151
+ if (tooSmall) {
4152
+ ctx = this._getOrReturnCtx(input, ctx);
4153
+ addIssueToContext(ctx, {
4154
+ code: ZodIssueCode.too_small,
4155
+ minimum: check.value,
4156
+ type: "number",
4157
+ inclusive: check.inclusive,
4158
+ exact: false,
4159
+ message: check.message
4160
+ });
4161
+ status.dirty();
4162
+ }
4163
+ } else if (check.kind === "max") {
4164
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
4165
+ if (tooBig) {
4166
+ ctx = this._getOrReturnCtx(input, ctx);
4167
+ addIssueToContext(ctx, {
4168
+ code: ZodIssueCode.too_big,
4169
+ maximum: check.value,
4170
+ type: "number",
4171
+ inclusive: check.inclusive,
4172
+ exact: false,
4173
+ message: check.message
4174
+ });
4175
+ status.dirty();
4176
+ }
4177
+ } else if (check.kind === "multipleOf") {
4178
+ if (floatSafeRemainder(input.data, check.value) !== 0) {
4179
+ ctx = this._getOrReturnCtx(input, ctx);
4180
+ addIssueToContext(ctx, {
4181
+ code: ZodIssueCode.not_multiple_of,
4182
+ multipleOf: check.value,
4183
+ message: check.message
4184
+ });
4185
+ status.dirty();
4186
+ }
4187
+ } else if (check.kind === "finite") {
4188
+ if (!Number.isFinite(input.data)) {
4189
+ ctx = this._getOrReturnCtx(input, ctx);
4190
+ addIssueToContext(ctx, {
4191
+ code: ZodIssueCode.not_finite,
4192
+ message: check.message
4193
+ });
4194
+ status.dirty();
4195
+ }
4196
+ } else {
4197
+ util.assertNever(check);
4198
+ }
4199
+ }
4200
+ return { status: status.value, value: input.data };
4201
+ }
4202
+ gte(value, message) {
4203
+ return this.setLimit("min", value, true, errorUtil.toString(message));
4204
+ }
4205
+ gt(value, message) {
4206
+ return this.setLimit("min", value, false, errorUtil.toString(message));
4207
+ }
4208
+ lte(value, message) {
4209
+ return this.setLimit("max", value, true, errorUtil.toString(message));
4210
+ }
4211
+ lt(value, message) {
4212
+ return this.setLimit("max", value, false, errorUtil.toString(message));
4213
+ }
4214
+ setLimit(kind, value, inclusive, message) {
4215
+ return new ZodNumber({
4216
+ ...this._def,
4217
+ checks: [
4218
+ ...this._def.checks,
4219
+ {
4220
+ kind,
4221
+ value,
4222
+ inclusive,
4223
+ message: errorUtil.toString(message)
4224
+ }
4225
+ ]
4226
+ });
4227
+ }
4228
+ _addCheck(check) {
4229
+ return new ZodNumber({
4230
+ ...this._def,
4231
+ checks: [...this._def.checks, check]
4232
+ });
4233
+ }
4234
+ int(message) {
4235
+ return this._addCheck({
4236
+ kind: "int",
4237
+ message: errorUtil.toString(message)
4238
+ });
4239
+ }
4240
+ positive(message) {
4241
+ return this._addCheck({
4242
+ kind: "min",
4243
+ value: 0,
4244
+ inclusive: false,
4245
+ message: errorUtil.toString(message)
4246
+ });
4247
+ }
4248
+ negative(message) {
4249
+ return this._addCheck({
4250
+ kind: "max",
4251
+ value: 0,
4252
+ inclusive: false,
4253
+ message: errorUtil.toString(message)
4254
+ });
4255
+ }
4256
+ nonpositive(message) {
4257
+ return this._addCheck({
4258
+ kind: "max",
4259
+ value: 0,
4260
+ inclusive: true,
4261
+ message: errorUtil.toString(message)
4262
+ });
4263
+ }
4264
+ nonnegative(message) {
4265
+ return this._addCheck({
4266
+ kind: "min",
4267
+ value: 0,
4268
+ inclusive: true,
4269
+ message: errorUtil.toString(message)
4270
+ });
4271
+ }
4272
+ multipleOf(value, message) {
4273
+ return this._addCheck({
4274
+ kind: "multipleOf",
4275
+ value,
4276
+ message: errorUtil.toString(message)
4277
+ });
4278
+ }
4279
+ finite(message) {
4280
+ return this._addCheck({
4281
+ kind: "finite",
4282
+ message: errorUtil.toString(message)
4283
+ });
4284
+ }
4285
+ safe(message) {
4286
+ return this._addCheck({
4287
+ kind: "min",
4288
+ inclusive: true,
4289
+ value: Number.MIN_SAFE_INTEGER,
4290
+ message: errorUtil.toString(message)
4291
+ })._addCheck({
4292
+ kind: "max",
4293
+ inclusive: true,
4294
+ value: Number.MAX_SAFE_INTEGER,
4295
+ message: errorUtil.toString(message)
4296
+ });
4297
+ }
4298
+ get minValue() {
4299
+ let min2 = null;
4300
+ for (const ch of this._def.checks) {
4301
+ if (ch.kind === "min") {
4302
+ if (min2 === null || ch.value > min2)
4303
+ min2 = ch.value;
4304
+ }
4305
+ }
4306
+ return min2;
4307
+ }
4308
+ get maxValue() {
4309
+ let max2 = null;
4310
+ for (const ch of this._def.checks) {
4311
+ if (ch.kind === "max") {
4312
+ if (max2 === null || ch.value < max2)
4313
+ max2 = ch.value;
4314
+ }
4315
+ }
4316
+ return max2;
4317
+ }
4318
+ get isInt() {
4319
+ return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
4320
+ }
4321
+ get isFinite() {
4322
+ let max2 = null, min2 = null;
4323
+ for (const ch of this._def.checks) {
4324
+ if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
4325
+ return true;
4326
+ } else if (ch.kind === "min") {
4327
+ if (min2 === null || ch.value > min2)
4328
+ min2 = ch.value;
4329
+ } else if (ch.kind === "max") {
4330
+ if (max2 === null || ch.value < max2)
4331
+ max2 = ch.value;
4332
+ }
4333
+ }
4334
+ return Number.isFinite(min2) && Number.isFinite(max2);
4335
+ }
4336
+ }
4337
+ ZodNumber.create = (params) => {
4338
+ return new ZodNumber({
4339
+ checks: [],
4340
+ typeName: ZodFirstPartyTypeKind.ZodNumber,
4341
+ coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
4342
+ ...processCreateParams(params)
4343
+ });
4344
+ };
4345
+ class ZodBigInt extends ZodType {
4346
+ constructor() {
4347
+ super(...arguments);
4348
+ this.min = this.gte;
4349
+ this.max = this.lte;
4350
+ }
4351
+ _parse(input) {
4352
+ if (this._def.coerce) {
4353
+ try {
4354
+ input.data = BigInt(input.data);
4355
+ } catch (_a) {
4356
+ return this._getInvalidInput(input);
4357
+ }
4358
+ }
4359
+ const parsedType = this._getType(input);
4360
+ if (parsedType !== ZodParsedType.bigint) {
4361
+ return this._getInvalidInput(input);
4362
+ }
4363
+ let ctx = void 0;
4364
+ const status = new ParseStatus();
4365
+ for (const check of this._def.checks) {
4366
+ if (check.kind === "min") {
4367
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
4368
+ if (tooSmall) {
4369
+ ctx = this._getOrReturnCtx(input, ctx);
4370
+ addIssueToContext(ctx, {
4371
+ code: ZodIssueCode.too_small,
4372
+ type: "bigint",
4373
+ minimum: check.value,
4374
+ inclusive: check.inclusive,
4375
+ message: check.message
4376
+ });
4377
+ status.dirty();
4378
+ }
4379
+ } else if (check.kind === "max") {
4380
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
4381
+ if (tooBig) {
4382
+ ctx = this._getOrReturnCtx(input, ctx);
4383
+ addIssueToContext(ctx, {
4384
+ code: ZodIssueCode.too_big,
4385
+ type: "bigint",
4386
+ maximum: check.value,
4387
+ inclusive: check.inclusive,
4388
+ message: check.message
4389
+ });
4390
+ status.dirty();
4391
+ }
4392
+ } else if (check.kind === "multipleOf") {
4393
+ if (input.data % check.value !== BigInt(0)) {
4394
+ ctx = this._getOrReturnCtx(input, ctx);
4395
+ addIssueToContext(ctx, {
4396
+ code: ZodIssueCode.not_multiple_of,
4397
+ multipleOf: check.value,
4398
+ message: check.message
4399
+ });
4400
+ status.dirty();
4401
+ }
4402
+ } else {
4403
+ util.assertNever(check);
4404
+ }
4405
+ }
4406
+ return { status: status.value, value: input.data };
4407
+ }
4408
+ _getInvalidInput(input) {
4409
+ const ctx = this._getOrReturnCtx(input);
4410
+ addIssueToContext(ctx, {
4411
+ code: ZodIssueCode.invalid_type,
4412
+ expected: ZodParsedType.bigint,
4413
+ received: ctx.parsedType
4414
+ });
4415
+ return INVALID;
4416
+ }
4417
+ gte(value, message) {
4418
+ return this.setLimit("min", value, true, errorUtil.toString(message));
4419
+ }
4420
+ gt(value, message) {
4421
+ return this.setLimit("min", value, false, errorUtil.toString(message));
4422
+ }
4423
+ lte(value, message) {
4424
+ return this.setLimit("max", value, true, errorUtil.toString(message));
4425
+ }
4426
+ lt(value, message) {
4427
+ return this.setLimit("max", value, false, errorUtil.toString(message));
4428
+ }
4429
+ setLimit(kind, value, inclusive, message) {
4430
+ return new ZodBigInt({
4431
+ ...this._def,
4432
+ checks: [
4433
+ ...this._def.checks,
4434
+ {
4435
+ kind,
4436
+ value,
4437
+ inclusive,
4438
+ message: errorUtil.toString(message)
4439
+ }
4440
+ ]
4441
+ });
4442
+ }
4443
+ _addCheck(check) {
4444
+ return new ZodBigInt({
4445
+ ...this._def,
4446
+ checks: [...this._def.checks, check]
4447
+ });
4448
+ }
4449
+ positive(message) {
4450
+ return this._addCheck({
4451
+ kind: "min",
4452
+ value: BigInt(0),
4453
+ inclusive: false,
4454
+ message: errorUtil.toString(message)
4455
+ });
4456
+ }
4457
+ negative(message) {
4458
+ return this._addCheck({
4459
+ kind: "max",
4460
+ value: BigInt(0),
4461
+ inclusive: false,
4462
+ message: errorUtil.toString(message)
4463
+ });
4464
+ }
4465
+ nonpositive(message) {
4466
+ return this._addCheck({
4467
+ kind: "max",
4468
+ value: BigInt(0),
4469
+ inclusive: true,
4470
+ message: errorUtil.toString(message)
4471
+ });
4472
+ }
4473
+ nonnegative(message) {
4474
+ return this._addCheck({
4475
+ kind: "min",
4476
+ value: BigInt(0),
4477
+ inclusive: true,
4478
+ message: errorUtil.toString(message)
4479
+ });
4480
+ }
4481
+ multipleOf(value, message) {
4482
+ return this._addCheck({
4483
+ kind: "multipleOf",
4484
+ value,
4485
+ message: errorUtil.toString(message)
4486
+ });
4487
+ }
4488
+ get minValue() {
4489
+ let min2 = null;
4490
+ for (const ch of this._def.checks) {
4491
+ if (ch.kind === "min") {
4492
+ if (min2 === null || ch.value > min2)
4493
+ min2 = ch.value;
4494
+ }
4495
+ }
4496
+ return min2;
4497
+ }
4498
+ get maxValue() {
4499
+ let max2 = null;
4500
+ for (const ch of this._def.checks) {
4501
+ if (ch.kind === "max") {
4502
+ if (max2 === null || ch.value < max2)
4503
+ max2 = ch.value;
4504
+ }
4505
+ }
4506
+ return max2;
4507
+ }
4508
+ }
4509
+ ZodBigInt.create = (params) => {
4510
+ var _a;
4511
+ return new ZodBigInt({
4512
+ checks: [],
4513
+ typeName: ZodFirstPartyTypeKind.ZodBigInt,
4514
+ coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
4515
+ ...processCreateParams(params)
4516
+ });
4517
+ };
4518
+ class ZodBoolean extends ZodType {
4519
+ _parse(input) {
4520
+ if (this._def.coerce) {
4521
+ input.data = Boolean(input.data);
4522
+ }
4523
+ const parsedType = this._getType(input);
4524
+ if (parsedType !== ZodParsedType.boolean) {
4525
+ const ctx = this._getOrReturnCtx(input);
4526
+ addIssueToContext(ctx, {
4527
+ code: ZodIssueCode.invalid_type,
4528
+ expected: ZodParsedType.boolean,
4529
+ received: ctx.parsedType
4530
+ });
4531
+ return INVALID;
4532
+ }
4533
+ return OK(input.data);
4534
+ }
4535
+ }
4536
+ ZodBoolean.create = (params) => {
4537
+ return new ZodBoolean({
4538
+ typeName: ZodFirstPartyTypeKind.ZodBoolean,
4539
+ coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
4540
+ ...processCreateParams(params)
4541
+ });
4542
+ };
4543
+ class ZodDate extends ZodType {
4544
+ _parse(input) {
4545
+ if (this._def.coerce) {
4546
+ input.data = new Date(input.data);
4547
+ }
4548
+ const parsedType = this._getType(input);
4549
+ if (parsedType !== ZodParsedType.date) {
4550
+ const ctx2 = this._getOrReturnCtx(input);
4551
+ addIssueToContext(ctx2, {
4552
+ code: ZodIssueCode.invalid_type,
4553
+ expected: ZodParsedType.date,
4554
+ received: ctx2.parsedType
4555
+ });
4556
+ return INVALID;
4557
+ }
4558
+ if (isNaN(input.data.getTime())) {
4559
+ const ctx2 = this._getOrReturnCtx(input);
4560
+ addIssueToContext(ctx2, {
4561
+ code: ZodIssueCode.invalid_date
4562
+ });
4563
+ return INVALID;
4564
+ }
4565
+ const status = new ParseStatus();
4566
+ let ctx = void 0;
4567
+ for (const check of this._def.checks) {
4568
+ if (check.kind === "min") {
4569
+ if (input.data.getTime() < check.value) {
4570
+ ctx = this._getOrReturnCtx(input, ctx);
4571
+ addIssueToContext(ctx, {
4572
+ code: ZodIssueCode.too_small,
4573
+ message: check.message,
4574
+ inclusive: true,
4575
+ exact: false,
4576
+ minimum: check.value,
4577
+ type: "date"
4578
+ });
4579
+ status.dirty();
4580
+ }
4581
+ } else if (check.kind === "max") {
4582
+ if (input.data.getTime() > check.value) {
4583
+ ctx = this._getOrReturnCtx(input, ctx);
4584
+ addIssueToContext(ctx, {
4585
+ code: ZodIssueCode.too_big,
4586
+ message: check.message,
4587
+ inclusive: true,
4588
+ exact: false,
4589
+ maximum: check.value,
4590
+ type: "date"
4591
+ });
4592
+ status.dirty();
4593
+ }
4594
+ } else {
4595
+ util.assertNever(check);
4596
+ }
4597
+ }
4598
+ return {
4599
+ status: status.value,
4600
+ value: new Date(input.data.getTime())
4601
+ };
4602
+ }
4603
+ _addCheck(check) {
4604
+ return new ZodDate({
4605
+ ...this._def,
4606
+ checks: [...this._def.checks, check]
4607
+ });
4608
+ }
4609
+ min(minDate, message) {
4610
+ return this._addCheck({
4611
+ kind: "min",
4612
+ value: minDate.getTime(),
4613
+ message: errorUtil.toString(message)
4614
+ });
4615
+ }
4616
+ max(maxDate, message) {
4617
+ return this._addCheck({
4618
+ kind: "max",
4619
+ value: maxDate.getTime(),
4620
+ message: errorUtil.toString(message)
4621
+ });
4622
+ }
4623
+ get minDate() {
4624
+ let min2 = null;
4625
+ for (const ch of this._def.checks) {
4626
+ if (ch.kind === "min") {
4627
+ if (min2 === null || ch.value > min2)
4628
+ min2 = ch.value;
4629
+ }
4630
+ }
4631
+ return min2 != null ? new Date(min2) : null;
4632
+ }
4633
+ get maxDate() {
4634
+ let max2 = null;
4635
+ for (const ch of this._def.checks) {
4636
+ if (ch.kind === "max") {
4637
+ if (max2 === null || ch.value < max2)
4638
+ max2 = ch.value;
4639
+ }
4640
+ }
4641
+ return max2 != null ? new Date(max2) : null;
4642
+ }
4643
+ }
4644
+ ZodDate.create = (params) => {
4645
+ return new ZodDate({
4646
+ checks: [],
4647
+ coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
4648
+ typeName: ZodFirstPartyTypeKind.ZodDate,
4649
+ ...processCreateParams(params)
4650
+ });
4651
+ };
4652
+ class ZodSymbol extends ZodType {
4653
+ _parse(input) {
4654
+ const parsedType = this._getType(input);
4655
+ if (parsedType !== ZodParsedType.symbol) {
4656
+ const ctx = this._getOrReturnCtx(input);
4657
+ addIssueToContext(ctx, {
4658
+ code: ZodIssueCode.invalid_type,
4659
+ expected: ZodParsedType.symbol,
4660
+ received: ctx.parsedType
4661
+ });
4662
+ return INVALID;
4663
+ }
4664
+ return OK(input.data);
4665
+ }
4666
+ }
4667
+ ZodSymbol.create = (params) => {
4668
+ return new ZodSymbol({
4669
+ typeName: ZodFirstPartyTypeKind.ZodSymbol,
4670
+ ...processCreateParams(params)
4671
+ });
4672
+ };
4673
+ class ZodUndefined extends ZodType {
4674
+ _parse(input) {
4675
+ const parsedType = this._getType(input);
4676
+ if (parsedType !== ZodParsedType.undefined) {
4677
+ const ctx = this._getOrReturnCtx(input);
4678
+ addIssueToContext(ctx, {
4679
+ code: ZodIssueCode.invalid_type,
4680
+ expected: ZodParsedType.undefined,
4681
+ received: ctx.parsedType
4682
+ });
4683
+ return INVALID;
4684
+ }
4685
+ return OK(input.data);
4686
+ }
4687
+ }
4688
+ ZodUndefined.create = (params) => {
4689
+ return new ZodUndefined({
4690
+ typeName: ZodFirstPartyTypeKind.ZodUndefined,
4691
+ ...processCreateParams(params)
4692
+ });
4693
+ };
4694
+ class ZodNull extends ZodType {
4695
+ _parse(input) {
4696
+ const parsedType = this._getType(input);
4697
+ if (parsedType !== ZodParsedType.null) {
4698
+ const ctx = this._getOrReturnCtx(input);
4699
+ addIssueToContext(ctx, {
4700
+ code: ZodIssueCode.invalid_type,
4701
+ expected: ZodParsedType.null,
4702
+ received: ctx.parsedType
4703
+ });
4704
+ return INVALID;
4705
+ }
4706
+ return OK(input.data);
4707
+ }
4708
+ }
4709
+ ZodNull.create = (params) => {
4710
+ return new ZodNull({
4711
+ typeName: ZodFirstPartyTypeKind.ZodNull,
4712
+ ...processCreateParams(params)
4713
+ });
4714
+ };
4715
+ class ZodAny extends ZodType {
4716
+ constructor() {
4717
+ super(...arguments);
4718
+ this._any = true;
4719
+ }
4720
+ _parse(input) {
4721
+ return OK(input.data);
4722
+ }
4723
+ }
4724
+ ZodAny.create = (params) => {
4725
+ return new ZodAny({
4726
+ typeName: ZodFirstPartyTypeKind.ZodAny,
4727
+ ...processCreateParams(params)
4728
+ });
4729
+ };
4730
+ class ZodUnknown extends ZodType {
4731
+ constructor() {
4732
+ super(...arguments);
4733
+ this._unknown = true;
4734
+ }
4735
+ _parse(input) {
4736
+ return OK(input.data);
4737
+ }
4738
+ }
4739
+ ZodUnknown.create = (params) => {
4740
+ return new ZodUnknown({
4741
+ typeName: ZodFirstPartyTypeKind.ZodUnknown,
4742
+ ...processCreateParams(params)
4743
+ });
4744
+ };
4745
+ class ZodNever extends ZodType {
4746
+ _parse(input) {
4747
+ const ctx = this._getOrReturnCtx(input);
4748
+ addIssueToContext(ctx, {
4749
+ code: ZodIssueCode.invalid_type,
4750
+ expected: ZodParsedType.never,
4751
+ received: ctx.parsedType
4752
+ });
4753
+ return INVALID;
4754
+ }
4755
+ }
4756
+ ZodNever.create = (params) => {
4757
+ return new ZodNever({
4758
+ typeName: ZodFirstPartyTypeKind.ZodNever,
4759
+ ...processCreateParams(params)
4760
+ });
4761
+ };
4762
+ class ZodVoid extends ZodType {
4763
+ _parse(input) {
4764
+ const parsedType = this._getType(input);
4765
+ if (parsedType !== ZodParsedType.undefined) {
4766
+ const ctx = this._getOrReturnCtx(input);
4767
+ addIssueToContext(ctx, {
4768
+ code: ZodIssueCode.invalid_type,
4769
+ expected: ZodParsedType.void,
4770
+ received: ctx.parsedType
4771
+ });
4772
+ return INVALID;
4773
+ }
4774
+ return OK(input.data);
4775
+ }
4776
+ }
4777
+ ZodVoid.create = (params) => {
4778
+ return new ZodVoid({
4779
+ typeName: ZodFirstPartyTypeKind.ZodVoid,
4780
+ ...processCreateParams(params)
4781
+ });
4782
+ };
4783
+ class ZodArray extends ZodType {
4784
+ _parse(input) {
4785
+ const { ctx, status } = this._processInputParams(input);
4786
+ const def = this._def;
4787
+ if (ctx.parsedType !== ZodParsedType.array) {
4788
+ addIssueToContext(ctx, {
4789
+ code: ZodIssueCode.invalid_type,
4790
+ expected: ZodParsedType.array,
4791
+ received: ctx.parsedType
4792
+ });
4793
+ return INVALID;
4794
+ }
4795
+ if (def.exactLength !== null) {
4796
+ const tooBig = ctx.data.length > def.exactLength.value;
4797
+ const tooSmall = ctx.data.length < def.exactLength.value;
4798
+ if (tooBig || tooSmall) {
4799
+ addIssueToContext(ctx, {
4800
+ code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
4801
+ minimum: tooSmall ? def.exactLength.value : void 0,
4802
+ maximum: tooBig ? def.exactLength.value : void 0,
4803
+ type: "array",
4804
+ inclusive: true,
4805
+ exact: true,
4806
+ message: def.exactLength.message
4807
+ });
4808
+ status.dirty();
4809
+ }
4810
+ }
4811
+ if (def.minLength !== null) {
4812
+ if (ctx.data.length < def.minLength.value) {
4813
+ addIssueToContext(ctx, {
4814
+ code: ZodIssueCode.too_small,
4815
+ minimum: def.minLength.value,
4816
+ type: "array",
4817
+ inclusive: true,
4818
+ exact: false,
4819
+ message: def.minLength.message
4820
+ });
4821
+ status.dirty();
4822
+ }
4823
+ }
4824
+ if (def.maxLength !== null) {
4825
+ if (ctx.data.length > def.maxLength.value) {
4826
+ addIssueToContext(ctx, {
4827
+ code: ZodIssueCode.too_big,
4828
+ maximum: def.maxLength.value,
4829
+ type: "array",
4830
+ inclusive: true,
4831
+ exact: false,
4832
+ message: def.maxLength.message
4833
+ });
4834
+ status.dirty();
4835
+ }
4836
+ }
4837
+ if (ctx.common.async) {
4838
+ return Promise.all([...ctx.data].map((item, i) => {
4839
+ return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
4840
+ })).then((result2) => {
4841
+ return ParseStatus.mergeArray(status, result2);
4842
+ });
4843
+ }
4844
+ const result = [...ctx.data].map((item, i) => {
4845
+ return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
4846
+ });
4847
+ return ParseStatus.mergeArray(status, result);
4848
+ }
4849
+ get element() {
4850
+ return this._def.type;
4851
+ }
4852
+ min(minLength, message) {
4853
+ return new ZodArray({
4854
+ ...this._def,
4855
+ minLength: { value: minLength, message: errorUtil.toString(message) }
4856
+ });
4857
+ }
4858
+ max(maxLength, message) {
4859
+ return new ZodArray({
4860
+ ...this._def,
4861
+ maxLength: { value: maxLength, message: errorUtil.toString(message) }
4862
+ });
4863
+ }
4864
+ length(len, message) {
4865
+ return new ZodArray({
4866
+ ...this._def,
4867
+ exactLength: { value: len, message: errorUtil.toString(message) }
4868
+ });
4869
+ }
4870
+ nonempty(message) {
4871
+ return this.min(1, message);
4872
+ }
4873
+ }
4874
+ ZodArray.create = (schema, params) => {
4875
+ return new ZodArray({
4876
+ type: schema,
4877
+ minLength: null,
4878
+ maxLength: null,
4879
+ exactLength: null,
4880
+ typeName: ZodFirstPartyTypeKind.ZodArray,
4881
+ ...processCreateParams(params)
4882
+ });
4883
+ };
4884
+ function deepPartialify(schema) {
4885
+ if (schema instanceof ZodObject) {
4886
+ const newShape = {};
4887
+ for (const key in schema.shape) {
4888
+ const fieldSchema = schema.shape[key];
4889
+ newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
4890
+ }
4891
+ return new ZodObject({
4892
+ ...schema._def,
4893
+ shape: () => newShape
4894
+ });
4895
+ } else if (schema instanceof ZodArray) {
4896
+ return new ZodArray({
4897
+ ...schema._def,
4898
+ type: deepPartialify(schema.element)
4899
+ });
4900
+ } else if (schema instanceof ZodOptional) {
4901
+ return ZodOptional.create(deepPartialify(schema.unwrap()));
4902
+ } else if (schema instanceof ZodNullable) {
4903
+ return ZodNullable.create(deepPartialify(schema.unwrap()));
4904
+ } else if (schema instanceof ZodTuple) {
4905
+ return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
4906
+ } else {
4907
+ return schema;
4908
+ }
4909
+ }
4910
+ class ZodObject extends ZodType {
4911
+ constructor() {
4912
+ super(...arguments);
4913
+ this._cached = null;
4914
+ this.nonstrict = this.passthrough;
4915
+ this.augment = this.extend;
4916
+ }
4917
+ _getCached() {
4918
+ if (this._cached !== null)
4919
+ return this._cached;
4920
+ const shape = this._def.shape();
4921
+ const keys2 = util.objectKeys(shape);
4922
+ return this._cached = { shape, keys: keys2 };
4923
+ }
4924
+ _parse(input) {
4925
+ const parsedType = this._getType(input);
4926
+ if (parsedType !== ZodParsedType.object) {
4927
+ const ctx2 = this._getOrReturnCtx(input);
4928
+ addIssueToContext(ctx2, {
4929
+ code: ZodIssueCode.invalid_type,
4930
+ expected: ZodParsedType.object,
4931
+ received: ctx2.parsedType
4932
+ });
4933
+ return INVALID;
4934
+ }
4935
+ const { status, ctx } = this._processInputParams(input);
4936
+ const { shape, keys: shapeKeys } = this._getCached();
4937
+ const extraKeys = [];
4938
+ if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
4939
+ for (const key in ctx.data) {
4940
+ if (!shapeKeys.includes(key)) {
4941
+ extraKeys.push(key);
4942
+ }
4943
+ }
4944
+ }
4945
+ const pairs = [];
4946
+ for (const key of shapeKeys) {
4947
+ const keyValidator = shape[key];
4948
+ const value = ctx.data[key];
4949
+ pairs.push({
4950
+ key: { status: "valid", value: key },
4951
+ value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
4952
+ alwaysSet: key in ctx.data
4953
+ });
4954
+ }
4955
+ if (this._def.catchall instanceof ZodNever) {
4956
+ const unknownKeys = this._def.unknownKeys;
4957
+ if (unknownKeys === "passthrough") {
4958
+ for (const key of extraKeys) {
4959
+ pairs.push({
4960
+ key: { status: "valid", value: key },
4961
+ value: { status: "valid", value: ctx.data[key] }
4962
+ });
4963
+ }
4964
+ } else if (unknownKeys === "strict") {
4965
+ if (extraKeys.length > 0) {
4966
+ addIssueToContext(ctx, {
4967
+ code: ZodIssueCode.unrecognized_keys,
4968
+ keys: extraKeys
4969
+ });
4970
+ status.dirty();
4971
+ }
4972
+ } else if (unknownKeys === "strip") ;
4973
+ else {
4974
+ throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
4975
+ }
4976
+ } else {
4977
+ const catchall = this._def.catchall;
4978
+ for (const key of extraKeys) {
4979
+ const value = ctx.data[key];
4980
+ pairs.push({
4981
+ key: { status: "valid", value: key },
4982
+ value: catchall._parse(
4983
+ new ParseInputLazyPath(ctx, value, ctx.path, key)
4984
+ //, ctx.child(key), value, getParsedType(value)
4985
+ ),
4986
+ alwaysSet: key in ctx.data
4987
+ });
4988
+ }
4989
+ }
4990
+ if (ctx.common.async) {
4991
+ return Promise.resolve().then(async () => {
4992
+ const syncPairs = [];
4993
+ for (const pair of pairs) {
4994
+ const key = await pair.key;
4995
+ const value = await pair.value;
4996
+ syncPairs.push({
4997
+ key,
4998
+ value,
4999
+ alwaysSet: pair.alwaysSet
5000
+ });
5001
+ }
5002
+ return syncPairs;
5003
+ }).then((syncPairs) => {
5004
+ return ParseStatus.mergeObjectSync(status, syncPairs);
5005
+ });
5006
+ } else {
5007
+ return ParseStatus.mergeObjectSync(status, pairs);
5008
+ }
5009
+ }
5010
+ get shape() {
5011
+ return this._def.shape();
5012
+ }
5013
+ strict(message) {
5014
+ errorUtil.errToObj;
5015
+ return new ZodObject({
5016
+ ...this._def,
5017
+ unknownKeys: "strict",
5018
+ ...message !== void 0 ? {
5019
+ errorMap: (issue, ctx) => {
5020
+ var _a, _b, _c, _d;
5021
+ const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
5022
+ if (issue.code === "unrecognized_keys")
5023
+ return {
5024
+ message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
5025
+ };
5026
+ return {
5027
+ message: defaultError
5028
+ };
5029
+ }
5030
+ } : {}
5031
+ });
5032
+ }
5033
+ strip() {
5034
+ return new ZodObject({
5035
+ ...this._def,
5036
+ unknownKeys: "strip"
5037
+ });
5038
+ }
5039
+ passthrough() {
5040
+ return new ZodObject({
5041
+ ...this._def,
5042
+ unknownKeys: "passthrough"
5043
+ });
5044
+ }
5045
+ // const AugmentFactory =
5046
+ // <Def extends ZodObjectDef>(def: Def) =>
5047
+ // <Augmentation extends ZodRawShape>(
5048
+ // augmentation: Augmentation
5049
+ // ): ZodObject<
5050
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
5051
+ // Def["unknownKeys"],
5052
+ // Def["catchall"]
5053
+ // > => {
5054
+ // return new ZodObject({
5055
+ // ...def,
5056
+ // shape: () => ({
5057
+ // ...def.shape(),
5058
+ // ...augmentation,
5059
+ // }),
5060
+ // }) as any;
5061
+ // };
5062
+ extend(augmentation) {
5063
+ return new ZodObject({
5064
+ ...this._def,
5065
+ shape: () => ({
5066
+ ...this._def.shape(),
5067
+ ...augmentation
5068
+ })
5069
+ });
5070
+ }
5071
+ /**
5072
+ * Prior to zod@1.0.12 there was a bug in the
5073
+ * inferred type of merged objects. Please
5074
+ * upgrade if you are experiencing issues.
5075
+ */
5076
+ merge(merging) {
5077
+ const merged = new ZodObject({
5078
+ unknownKeys: merging._def.unknownKeys,
5079
+ catchall: merging._def.catchall,
5080
+ shape: () => ({
5081
+ ...this._def.shape(),
5082
+ ...merging._def.shape()
5083
+ }),
5084
+ typeName: ZodFirstPartyTypeKind.ZodObject
5085
+ });
5086
+ return merged;
5087
+ }
5088
+ // merge<
5089
+ // Incoming extends AnyZodObject,
5090
+ // Augmentation extends Incoming["shape"],
5091
+ // NewOutput extends {
5092
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
5093
+ // ? Augmentation[k]["_output"]
5094
+ // : k extends keyof Output
5095
+ // ? Output[k]
5096
+ // : never;
5097
+ // },
5098
+ // NewInput extends {
5099
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
5100
+ // ? Augmentation[k]["_input"]
5101
+ // : k extends keyof Input
5102
+ // ? Input[k]
5103
+ // : never;
5104
+ // }
5105
+ // >(
5106
+ // merging: Incoming
5107
+ // ): ZodObject<
5108
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
5109
+ // Incoming["_def"]["unknownKeys"],
5110
+ // Incoming["_def"]["catchall"],
5111
+ // NewOutput,
5112
+ // NewInput
5113
+ // > {
5114
+ // const merged: any = new ZodObject({
5115
+ // unknownKeys: merging._def.unknownKeys,
5116
+ // catchall: merging._def.catchall,
5117
+ // shape: () =>
5118
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
5119
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
5120
+ // }) as any;
5121
+ // return merged;
5122
+ // }
5123
+ setKey(key, schema) {
5124
+ return this.augment({ [key]: schema });
5125
+ }
5126
+ // merge<Incoming extends AnyZodObject>(
5127
+ // merging: Incoming
5128
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
5129
+ // ZodObject<
5130
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
5131
+ // Incoming["_def"]["unknownKeys"],
5132
+ // Incoming["_def"]["catchall"]
5133
+ // > {
5134
+ // // const mergedShape = objectUtil.mergeShapes(
5135
+ // // this._def.shape(),
5136
+ // // merging._def.shape()
5137
+ // // );
5138
+ // const merged: any = new ZodObject({
5139
+ // unknownKeys: merging._def.unknownKeys,
5140
+ // catchall: merging._def.catchall,
5141
+ // shape: () =>
5142
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
5143
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
5144
+ // }) as any;
5145
+ // return merged;
5146
+ // }
5147
+ catchall(index) {
5148
+ return new ZodObject({
5149
+ ...this._def,
5150
+ catchall: index
5151
+ });
5152
+ }
5153
+ pick(mask) {
5154
+ const shape = {};
5155
+ util.objectKeys(mask).forEach((key) => {
5156
+ if (mask[key] && this.shape[key]) {
5157
+ shape[key] = this.shape[key];
5158
+ }
5159
+ });
5160
+ return new ZodObject({
5161
+ ...this._def,
5162
+ shape: () => shape
5163
+ });
5164
+ }
5165
+ omit(mask) {
5166
+ const shape = {};
5167
+ util.objectKeys(this.shape).forEach((key) => {
5168
+ if (!mask[key]) {
5169
+ shape[key] = this.shape[key];
5170
+ }
5171
+ });
5172
+ return new ZodObject({
5173
+ ...this._def,
5174
+ shape: () => shape
5175
+ });
5176
+ }
5177
+ /**
5178
+ * @deprecated
5179
+ */
5180
+ deepPartial() {
5181
+ return deepPartialify(this);
5182
+ }
5183
+ partial(mask) {
5184
+ const newShape = {};
5185
+ util.objectKeys(this.shape).forEach((key) => {
5186
+ const fieldSchema = this.shape[key];
5187
+ if (mask && !mask[key]) {
5188
+ newShape[key] = fieldSchema;
5189
+ } else {
5190
+ newShape[key] = fieldSchema.optional();
5191
+ }
5192
+ });
5193
+ return new ZodObject({
5194
+ ...this._def,
5195
+ shape: () => newShape
5196
+ });
5197
+ }
5198
+ required(mask) {
5199
+ const newShape = {};
5200
+ util.objectKeys(this.shape).forEach((key) => {
5201
+ if (mask && !mask[key]) {
5202
+ newShape[key] = this.shape[key];
5203
+ } else {
5204
+ const fieldSchema = this.shape[key];
5205
+ let newField = fieldSchema;
5206
+ while (newField instanceof ZodOptional) {
5207
+ newField = newField._def.innerType;
5208
+ }
5209
+ newShape[key] = newField;
5210
+ }
5211
+ });
5212
+ return new ZodObject({
5213
+ ...this._def,
5214
+ shape: () => newShape
5215
+ });
5216
+ }
5217
+ keyof() {
5218
+ return createZodEnum(util.objectKeys(this.shape));
5219
+ }
5220
+ }
5221
+ ZodObject.create = (shape, params) => {
5222
+ return new ZodObject({
5223
+ shape: () => shape,
5224
+ unknownKeys: "strip",
5225
+ catchall: ZodNever.create(),
5226
+ typeName: ZodFirstPartyTypeKind.ZodObject,
5227
+ ...processCreateParams(params)
5228
+ });
5229
+ };
5230
+ ZodObject.strictCreate = (shape, params) => {
5231
+ return new ZodObject({
5232
+ shape: () => shape,
5233
+ unknownKeys: "strict",
5234
+ catchall: ZodNever.create(),
5235
+ typeName: ZodFirstPartyTypeKind.ZodObject,
5236
+ ...processCreateParams(params)
5237
+ });
5238
+ };
5239
+ ZodObject.lazycreate = (shape, params) => {
5240
+ return new ZodObject({
5241
+ shape,
5242
+ unknownKeys: "strip",
5243
+ catchall: ZodNever.create(),
5244
+ typeName: ZodFirstPartyTypeKind.ZodObject,
5245
+ ...processCreateParams(params)
5246
+ });
5247
+ };
5248
+ class ZodUnion extends ZodType {
5249
+ _parse(input) {
5250
+ const { ctx } = this._processInputParams(input);
5251
+ const options = this._def.options;
5252
+ function handleResults(results) {
5253
+ for (const result of results) {
5254
+ if (result.result.status === "valid") {
5255
+ return result.result;
5256
+ }
5257
+ }
5258
+ for (const result of results) {
5259
+ if (result.result.status === "dirty") {
5260
+ ctx.common.issues.push(...result.ctx.common.issues);
5261
+ return result.result;
5262
+ }
5263
+ }
5264
+ const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
5265
+ addIssueToContext(ctx, {
5266
+ code: ZodIssueCode.invalid_union,
5267
+ unionErrors
5268
+ });
5269
+ return INVALID;
5270
+ }
5271
+ if (ctx.common.async) {
5272
+ return Promise.all(options.map(async (option) => {
5273
+ const childCtx = {
5274
+ ...ctx,
5275
+ common: {
5276
+ ...ctx.common,
5277
+ issues: []
5278
+ },
5279
+ parent: null
5280
+ };
5281
+ return {
5282
+ result: await option._parseAsync({
5283
+ data: ctx.data,
5284
+ path: ctx.path,
5285
+ parent: childCtx
5286
+ }),
5287
+ ctx: childCtx
5288
+ };
5289
+ })).then(handleResults);
5290
+ } else {
5291
+ let dirty = void 0;
5292
+ const issues = [];
5293
+ for (const option of options) {
5294
+ const childCtx = {
5295
+ ...ctx,
5296
+ common: {
5297
+ ...ctx.common,
5298
+ issues: []
5299
+ },
5300
+ parent: null
5301
+ };
5302
+ const result = option._parseSync({
5303
+ data: ctx.data,
5304
+ path: ctx.path,
5305
+ parent: childCtx
5306
+ });
5307
+ if (result.status === "valid") {
5308
+ return result;
5309
+ } else if (result.status === "dirty" && !dirty) {
5310
+ dirty = { result, ctx: childCtx };
5311
+ }
5312
+ if (childCtx.common.issues.length) {
5313
+ issues.push(childCtx.common.issues);
5314
+ }
5315
+ }
5316
+ if (dirty) {
5317
+ ctx.common.issues.push(...dirty.ctx.common.issues);
5318
+ return dirty.result;
5319
+ }
5320
+ const unionErrors = issues.map((issues2) => new ZodError(issues2));
5321
+ addIssueToContext(ctx, {
5322
+ code: ZodIssueCode.invalid_union,
5323
+ unionErrors
5324
+ });
5325
+ return INVALID;
5326
+ }
5327
+ }
5328
+ get options() {
5329
+ return this._def.options;
5330
+ }
5331
+ }
5332
+ ZodUnion.create = (types, params) => {
5333
+ return new ZodUnion({
5334
+ options: types,
5335
+ typeName: ZodFirstPartyTypeKind.ZodUnion,
5336
+ ...processCreateParams(params)
5337
+ });
5338
+ };
5339
+ const getDiscriminator = (type) => {
5340
+ if (type instanceof ZodLazy) {
5341
+ return getDiscriminator(type.schema);
5342
+ } else if (type instanceof ZodEffects) {
5343
+ return getDiscriminator(type.innerType());
5344
+ } else if (type instanceof ZodLiteral) {
5345
+ return [type.value];
5346
+ } else if (type instanceof ZodEnum) {
5347
+ return type.options;
5348
+ } else if (type instanceof ZodNativeEnum) {
5349
+ return util.objectValues(type.enum);
5350
+ } else if (type instanceof ZodDefault) {
5351
+ return getDiscriminator(type._def.innerType);
5352
+ } else if (type instanceof ZodUndefined) {
5353
+ return [void 0];
5354
+ } else if (type instanceof ZodNull) {
5355
+ return [null];
5356
+ } else if (type instanceof ZodOptional) {
5357
+ return [void 0, ...getDiscriminator(type.unwrap())];
5358
+ } else if (type instanceof ZodNullable) {
5359
+ return [null, ...getDiscriminator(type.unwrap())];
5360
+ } else if (type instanceof ZodBranded) {
5361
+ return getDiscriminator(type.unwrap());
5362
+ } else if (type instanceof ZodReadonly) {
5363
+ return getDiscriminator(type.unwrap());
5364
+ } else if (type instanceof ZodCatch) {
5365
+ return getDiscriminator(type._def.innerType);
5366
+ } else {
5367
+ return [];
5368
+ }
5369
+ };
5370
+ class ZodDiscriminatedUnion extends ZodType {
5371
+ _parse(input) {
5372
+ const { ctx } = this._processInputParams(input);
5373
+ if (ctx.parsedType !== ZodParsedType.object) {
5374
+ addIssueToContext(ctx, {
5375
+ code: ZodIssueCode.invalid_type,
5376
+ expected: ZodParsedType.object,
5377
+ received: ctx.parsedType
5378
+ });
5379
+ return INVALID;
5380
+ }
5381
+ const discriminator = this.discriminator;
5382
+ const discriminatorValue = ctx.data[discriminator];
5383
+ const option = this.optionsMap.get(discriminatorValue);
5384
+ if (!option) {
5385
+ addIssueToContext(ctx, {
5386
+ code: ZodIssueCode.invalid_union_discriminator,
5387
+ options: Array.from(this.optionsMap.keys()),
5388
+ path: [discriminator]
5389
+ });
5390
+ return INVALID;
5391
+ }
5392
+ if (ctx.common.async) {
5393
+ return option._parseAsync({
5394
+ data: ctx.data,
5395
+ path: ctx.path,
5396
+ parent: ctx
5397
+ });
5398
+ } else {
5399
+ return option._parseSync({
5400
+ data: ctx.data,
5401
+ path: ctx.path,
5402
+ parent: ctx
5403
+ });
5404
+ }
5405
+ }
5406
+ get discriminator() {
5407
+ return this._def.discriminator;
5408
+ }
5409
+ get options() {
5410
+ return this._def.options;
5411
+ }
5412
+ get optionsMap() {
5413
+ return this._def.optionsMap;
5414
+ }
5415
+ /**
5416
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
5417
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
5418
+ * have a different value for each object in the union.
5419
+ * @param discriminator the name of the discriminator property
5420
+ * @param types an array of object schemas
5421
+ * @param params
5422
+ */
5423
+ static create(discriminator, options, params) {
5424
+ const optionsMap = /* @__PURE__ */ new Map();
5425
+ for (const type of options) {
5426
+ const discriminatorValues = getDiscriminator(type.shape[discriminator]);
5427
+ if (!discriminatorValues.length) {
5428
+ throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
5429
+ }
5430
+ for (const value of discriminatorValues) {
5431
+ if (optionsMap.has(value)) {
5432
+ throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
5433
+ }
5434
+ optionsMap.set(value, type);
5435
+ }
5436
+ }
5437
+ return new ZodDiscriminatedUnion({
5438
+ typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
5439
+ discriminator,
5440
+ options,
5441
+ optionsMap,
5442
+ ...processCreateParams(params)
5443
+ });
5444
+ }
5445
+ }
5446
+ function mergeValues(a, b) {
5447
+ const aType = getParsedType(a);
5448
+ const bType = getParsedType(b);
5449
+ if (a === b) {
5450
+ return { valid: true, data: a };
5451
+ } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
5452
+ const bKeys = util.objectKeys(b);
5453
+ const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
5454
+ const newObj = { ...a, ...b };
5455
+ for (const key of sharedKeys) {
5456
+ const sharedValue = mergeValues(a[key], b[key]);
5457
+ if (!sharedValue.valid) {
5458
+ return { valid: false };
5459
+ }
5460
+ newObj[key] = sharedValue.data;
5461
+ }
5462
+ return { valid: true, data: newObj };
5463
+ } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
5464
+ if (a.length !== b.length) {
5465
+ return { valid: false };
5466
+ }
5467
+ const newArray = [];
5468
+ for (let index = 0; index < a.length; index++) {
5469
+ const itemA = a[index];
5470
+ const itemB = b[index];
5471
+ const sharedValue = mergeValues(itemA, itemB);
5472
+ if (!sharedValue.valid) {
5473
+ return { valid: false };
5474
+ }
5475
+ newArray.push(sharedValue.data);
5476
+ }
5477
+ return { valid: true, data: newArray };
5478
+ } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
5479
+ return { valid: true, data: a };
5480
+ } else {
5481
+ return { valid: false };
5482
+ }
5483
+ }
5484
+ class ZodIntersection extends ZodType {
5485
+ _parse(input) {
5486
+ const { status, ctx } = this._processInputParams(input);
5487
+ const handleParsed = (parsedLeft, parsedRight) => {
5488
+ if (isAborted(parsedLeft) || isAborted(parsedRight)) {
5489
+ return INVALID;
5490
+ }
5491
+ const merged = mergeValues(parsedLeft.value, parsedRight.value);
5492
+ if (!merged.valid) {
5493
+ addIssueToContext(ctx, {
5494
+ code: ZodIssueCode.invalid_intersection_types
5495
+ });
5496
+ return INVALID;
5497
+ }
5498
+ if (isDirty(parsedLeft) || isDirty(parsedRight)) {
5499
+ status.dirty();
5500
+ }
5501
+ return { status: status.value, value: merged.data };
5502
+ };
5503
+ if (ctx.common.async) {
5504
+ return Promise.all([
5505
+ this._def.left._parseAsync({
5506
+ data: ctx.data,
5507
+ path: ctx.path,
5508
+ parent: ctx
5509
+ }),
5510
+ this._def.right._parseAsync({
5511
+ data: ctx.data,
5512
+ path: ctx.path,
5513
+ parent: ctx
5514
+ })
5515
+ ]).then(([left, right]) => handleParsed(left, right));
5516
+ } else {
5517
+ return handleParsed(this._def.left._parseSync({
5518
+ data: ctx.data,
5519
+ path: ctx.path,
5520
+ parent: ctx
5521
+ }), this._def.right._parseSync({
5522
+ data: ctx.data,
5523
+ path: ctx.path,
5524
+ parent: ctx
5525
+ }));
5526
+ }
5527
+ }
5528
+ }
5529
+ ZodIntersection.create = (left, right, params) => {
5530
+ return new ZodIntersection({
5531
+ left,
5532
+ right,
5533
+ typeName: ZodFirstPartyTypeKind.ZodIntersection,
5534
+ ...processCreateParams(params)
5535
+ });
5536
+ };
5537
+ class ZodTuple extends ZodType {
5538
+ _parse(input) {
5539
+ const { status, ctx } = this._processInputParams(input);
5540
+ if (ctx.parsedType !== ZodParsedType.array) {
5541
+ addIssueToContext(ctx, {
5542
+ code: ZodIssueCode.invalid_type,
5543
+ expected: ZodParsedType.array,
5544
+ received: ctx.parsedType
5545
+ });
5546
+ return INVALID;
5547
+ }
5548
+ if (ctx.data.length < this._def.items.length) {
5549
+ addIssueToContext(ctx, {
5550
+ code: ZodIssueCode.too_small,
5551
+ minimum: this._def.items.length,
5552
+ inclusive: true,
5553
+ exact: false,
5554
+ type: "array"
5555
+ });
5556
+ return INVALID;
5557
+ }
5558
+ const rest = this._def.rest;
5559
+ if (!rest && ctx.data.length > this._def.items.length) {
5560
+ addIssueToContext(ctx, {
5561
+ code: ZodIssueCode.too_big,
5562
+ maximum: this._def.items.length,
5563
+ inclusive: true,
5564
+ exact: false,
5565
+ type: "array"
5566
+ });
5567
+ status.dirty();
5568
+ }
5569
+ const items = [...ctx.data].map((item, itemIndex) => {
5570
+ const schema = this._def.items[itemIndex] || this._def.rest;
5571
+ if (!schema)
5572
+ return null;
5573
+ return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
5574
+ }).filter((x) => !!x);
5575
+ if (ctx.common.async) {
5576
+ return Promise.all(items).then((results) => {
5577
+ return ParseStatus.mergeArray(status, results);
5578
+ });
5579
+ } else {
5580
+ return ParseStatus.mergeArray(status, items);
5581
+ }
5582
+ }
5583
+ get items() {
5584
+ return this._def.items;
5585
+ }
5586
+ rest(rest) {
5587
+ return new ZodTuple({
5588
+ ...this._def,
5589
+ rest
5590
+ });
5591
+ }
5592
+ }
5593
+ ZodTuple.create = (schemas, params) => {
5594
+ if (!Array.isArray(schemas)) {
5595
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
5596
+ }
5597
+ return new ZodTuple({
5598
+ items: schemas,
5599
+ typeName: ZodFirstPartyTypeKind.ZodTuple,
5600
+ rest: null,
5601
+ ...processCreateParams(params)
5602
+ });
5603
+ };
5604
+ class ZodRecord extends ZodType {
5605
+ get keySchema() {
5606
+ return this._def.keyType;
5607
+ }
5608
+ get valueSchema() {
5609
+ return this._def.valueType;
5610
+ }
5611
+ _parse(input) {
5612
+ const { status, ctx } = this._processInputParams(input);
5613
+ if (ctx.parsedType !== ZodParsedType.object) {
5614
+ addIssueToContext(ctx, {
5615
+ code: ZodIssueCode.invalid_type,
5616
+ expected: ZodParsedType.object,
5617
+ received: ctx.parsedType
5618
+ });
5619
+ return INVALID;
5620
+ }
5621
+ const pairs = [];
5622
+ const keyType = this._def.keyType;
5623
+ const valueType = this._def.valueType;
5624
+ for (const key in ctx.data) {
5625
+ pairs.push({
5626
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
5627
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
5628
+ alwaysSet: key in ctx.data
5629
+ });
5630
+ }
5631
+ if (ctx.common.async) {
5632
+ return ParseStatus.mergeObjectAsync(status, pairs);
5633
+ } else {
5634
+ return ParseStatus.mergeObjectSync(status, pairs);
5635
+ }
5636
+ }
5637
+ get element() {
5638
+ return this._def.valueType;
5639
+ }
5640
+ static create(first, second, third) {
5641
+ if (second instanceof ZodType) {
5642
+ return new ZodRecord({
5643
+ keyType: first,
5644
+ valueType: second,
5645
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
5646
+ ...processCreateParams(third)
5647
+ });
5648
+ }
5649
+ return new ZodRecord({
5650
+ keyType: ZodString.create(),
5651
+ valueType: first,
5652
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
5653
+ ...processCreateParams(second)
5654
+ });
5655
+ }
5656
+ }
5657
+ class ZodMap extends ZodType {
5658
+ get keySchema() {
5659
+ return this._def.keyType;
5660
+ }
5661
+ get valueSchema() {
5662
+ return this._def.valueType;
5663
+ }
5664
+ _parse(input) {
5665
+ const { status, ctx } = this._processInputParams(input);
5666
+ if (ctx.parsedType !== ZodParsedType.map) {
5667
+ addIssueToContext(ctx, {
5668
+ code: ZodIssueCode.invalid_type,
5669
+ expected: ZodParsedType.map,
5670
+ received: ctx.parsedType
5671
+ });
5672
+ return INVALID;
5673
+ }
5674
+ const keyType = this._def.keyType;
5675
+ const valueType = this._def.valueType;
5676
+ const pairs = [...ctx.data.entries()].map(([key, value], index) => {
5677
+ return {
5678
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
5679
+ value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
5680
+ };
5681
+ });
5682
+ if (ctx.common.async) {
5683
+ const finalMap = /* @__PURE__ */ new Map();
5684
+ return Promise.resolve().then(async () => {
5685
+ for (const pair of pairs) {
5686
+ const key = await pair.key;
5687
+ const value = await pair.value;
5688
+ if (key.status === "aborted" || value.status === "aborted") {
5689
+ return INVALID;
5690
+ }
5691
+ if (key.status === "dirty" || value.status === "dirty") {
5692
+ status.dirty();
5693
+ }
5694
+ finalMap.set(key.value, value.value);
5695
+ }
5696
+ return { status: status.value, value: finalMap };
5697
+ });
5698
+ } else {
5699
+ const finalMap = /* @__PURE__ */ new Map();
5700
+ for (const pair of pairs) {
5701
+ const key = pair.key;
5702
+ const value = pair.value;
5703
+ if (key.status === "aborted" || value.status === "aborted") {
5704
+ return INVALID;
5705
+ }
5706
+ if (key.status === "dirty" || value.status === "dirty") {
5707
+ status.dirty();
5708
+ }
5709
+ finalMap.set(key.value, value.value);
5710
+ }
5711
+ return { status: status.value, value: finalMap };
5712
+ }
5713
+ }
5714
+ }
5715
+ ZodMap.create = (keyType, valueType, params) => {
5716
+ return new ZodMap({
5717
+ valueType,
5718
+ keyType,
5719
+ typeName: ZodFirstPartyTypeKind.ZodMap,
5720
+ ...processCreateParams(params)
5721
+ });
5722
+ };
5723
+ class ZodSet extends ZodType {
5724
+ _parse(input) {
5725
+ const { status, ctx } = this._processInputParams(input);
5726
+ if (ctx.parsedType !== ZodParsedType.set) {
5727
+ addIssueToContext(ctx, {
5728
+ code: ZodIssueCode.invalid_type,
5729
+ expected: ZodParsedType.set,
5730
+ received: ctx.parsedType
5731
+ });
5732
+ return INVALID;
5733
+ }
5734
+ const def = this._def;
5735
+ if (def.minSize !== null) {
5736
+ if (ctx.data.size < def.minSize.value) {
5737
+ addIssueToContext(ctx, {
5738
+ code: ZodIssueCode.too_small,
5739
+ minimum: def.minSize.value,
5740
+ type: "set",
5741
+ inclusive: true,
5742
+ exact: false,
5743
+ message: def.minSize.message
5744
+ });
5745
+ status.dirty();
5746
+ }
5747
+ }
5748
+ if (def.maxSize !== null) {
5749
+ if (ctx.data.size > def.maxSize.value) {
5750
+ addIssueToContext(ctx, {
5751
+ code: ZodIssueCode.too_big,
5752
+ maximum: def.maxSize.value,
5753
+ type: "set",
5754
+ inclusive: true,
5755
+ exact: false,
5756
+ message: def.maxSize.message
5757
+ });
5758
+ status.dirty();
5759
+ }
5760
+ }
5761
+ const valueType = this._def.valueType;
5762
+ function finalizeSet(elements2) {
5763
+ const parsedSet = /* @__PURE__ */ new Set();
5764
+ for (const element of elements2) {
5765
+ if (element.status === "aborted")
5766
+ return INVALID;
5767
+ if (element.status === "dirty")
5768
+ status.dirty();
5769
+ parsedSet.add(element.value);
5770
+ }
5771
+ return { status: status.value, value: parsedSet };
5772
+ }
5773
+ const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
5774
+ if (ctx.common.async) {
5775
+ return Promise.all(elements).then((elements2) => finalizeSet(elements2));
5776
+ } else {
5777
+ return finalizeSet(elements);
5778
+ }
5779
+ }
5780
+ min(minSize, message) {
5781
+ return new ZodSet({
5782
+ ...this._def,
5783
+ minSize: { value: minSize, message: errorUtil.toString(message) }
5784
+ });
5785
+ }
5786
+ max(maxSize, message) {
5787
+ return new ZodSet({
5788
+ ...this._def,
5789
+ maxSize: { value: maxSize, message: errorUtil.toString(message) }
5790
+ });
5791
+ }
5792
+ size(size, message) {
5793
+ return this.min(size, message).max(size, message);
5794
+ }
5795
+ nonempty(message) {
5796
+ return this.min(1, message);
5797
+ }
5798
+ }
5799
+ ZodSet.create = (valueType, params) => {
5800
+ return new ZodSet({
5801
+ valueType,
5802
+ minSize: null,
5803
+ maxSize: null,
5804
+ typeName: ZodFirstPartyTypeKind.ZodSet,
5805
+ ...processCreateParams(params)
5806
+ });
5807
+ };
5808
+ class ZodFunction extends ZodType {
5809
+ constructor() {
5810
+ super(...arguments);
5811
+ this.validate = this.implement;
5812
+ }
5813
+ _parse(input) {
5814
+ const { ctx } = this._processInputParams(input);
5815
+ if (ctx.parsedType !== ZodParsedType.function) {
5816
+ addIssueToContext(ctx, {
5817
+ code: ZodIssueCode.invalid_type,
5818
+ expected: ZodParsedType.function,
5819
+ received: ctx.parsedType
5820
+ });
5821
+ return INVALID;
5822
+ }
5823
+ function makeArgsIssue(args, error) {
5824
+ return makeIssue({
5825
+ data: args,
5826
+ path: ctx.path,
5827
+ errorMaps: [
5828
+ ctx.common.contextualErrorMap,
5829
+ ctx.schemaErrorMap,
5830
+ getErrorMap(),
5831
+ errorMap
5832
+ ].filter((x) => !!x),
5833
+ issueData: {
5834
+ code: ZodIssueCode.invalid_arguments,
5835
+ argumentsError: error
5836
+ }
5837
+ });
5838
+ }
5839
+ function makeReturnsIssue(returns, error) {
5840
+ return makeIssue({
5841
+ data: returns,
5842
+ path: ctx.path,
5843
+ errorMaps: [
5844
+ ctx.common.contextualErrorMap,
5845
+ ctx.schemaErrorMap,
5846
+ getErrorMap(),
5847
+ errorMap
5848
+ ].filter((x) => !!x),
5849
+ issueData: {
5850
+ code: ZodIssueCode.invalid_return_type,
5851
+ returnTypeError: error
5852
+ }
5853
+ });
5854
+ }
5855
+ const params = { errorMap: ctx.common.contextualErrorMap };
5856
+ const fn = ctx.data;
5857
+ if (this._def.returns instanceof ZodPromise) {
5858
+ const me = this;
5859
+ return OK(async function(...args) {
5860
+ const error = new ZodError([]);
5861
+ const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
5862
+ error.addIssue(makeArgsIssue(args, e));
5863
+ throw error;
5864
+ });
5865
+ const result = await Reflect.apply(fn, this, parsedArgs);
5866
+ const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
5867
+ error.addIssue(makeReturnsIssue(result, e));
5868
+ throw error;
5869
+ });
5870
+ return parsedReturns;
5871
+ });
5872
+ } else {
5873
+ const me = this;
5874
+ return OK(function(...args) {
5875
+ const parsedArgs = me._def.args.safeParse(args, params);
5876
+ if (!parsedArgs.success) {
5877
+ throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
5878
+ }
5879
+ const result = Reflect.apply(fn, this, parsedArgs.data);
5880
+ const parsedReturns = me._def.returns.safeParse(result, params);
5881
+ if (!parsedReturns.success) {
5882
+ throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
5883
+ }
5884
+ return parsedReturns.data;
5885
+ });
5886
+ }
5887
+ }
5888
+ parameters() {
5889
+ return this._def.args;
5890
+ }
5891
+ returnType() {
5892
+ return this._def.returns;
5893
+ }
5894
+ args(...items) {
5895
+ return new ZodFunction({
5896
+ ...this._def,
5897
+ args: ZodTuple.create(items).rest(ZodUnknown.create())
5898
+ });
5899
+ }
5900
+ returns(returnType) {
5901
+ return new ZodFunction({
5902
+ ...this._def,
5903
+ returns: returnType
5904
+ });
5905
+ }
5906
+ implement(func) {
5907
+ const validatedFunc = this.parse(func);
5908
+ return validatedFunc;
5909
+ }
5910
+ strictImplement(func) {
5911
+ const validatedFunc = this.parse(func);
5912
+ return validatedFunc;
5913
+ }
5914
+ static create(args, returns, params) {
5915
+ return new ZodFunction({
5916
+ args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
5917
+ returns: returns || ZodUnknown.create(),
5918
+ typeName: ZodFirstPartyTypeKind.ZodFunction,
5919
+ ...processCreateParams(params)
5920
+ });
5921
+ }
5922
+ }
5923
+ class ZodLazy extends ZodType {
5924
+ get schema() {
5925
+ return this._def.getter();
5926
+ }
5927
+ _parse(input) {
5928
+ const { ctx } = this._processInputParams(input);
5929
+ const lazySchema = this._def.getter();
5930
+ return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
5931
+ }
5932
+ }
5933
+ ZodLazy.create = (getter, params) => {
5934
+ return new ZodLazy({
5935
+ getter,
5936
+ typeName: ZodFirstPartyTypeKind.ZodLazy,
5937
+ ...processCreateParams(params)
5938
+ });
5939
+ };
5940
+ class ZodLiteral extends ZodType {
5941
+ _parse(input) {
5942
+ if (input.data !== this._def.value) {
5943
+ const ctx = this._getOrReturnCtx(input);
5944
+ addIssueToContext(ctx, {
5945
+ received: ctx.data,
5946
+ code: ZodIssueCode.invalid_literal,
5947
+ expected: this._def.value
5948
+ });
5949
+ return INVALID;
5950
+ }
5951
+ return { status: "valid", value: input.data };
5952
+ }
5953
+ get value() {
5954
+ return this._def.value;
5955
+ }
5956
+ }
5957
+ ZodLiteral.create = (value, params) => {
5958
+ return new ZodLiteral({
5959
+ value,
5960
+ typeName: ZodFirstPartyTypeKind.ZodLiteral,
5961
+ ...processCreateParams(params)
5962
+ });
5963
+ };
5964
+ function createZodEnum(values, params) {
5965
+ return new ZodEnum({
5966
+ values,
5967
+ typeName: ZodFirstPartyTypeKind.ZodEnum,
5968
+ ...processCreateParams(params)
5969
+ });
5970
+ }
5971
+ class ZodEnum extends ZodType {
5972
+ constructor() {
5973
+ super(...arguments);
5974
+ _ZodEnum_cache.set(this, void 0);
5975
+ }
5976
+ _parse(input) {
5977
+ if (typeof input.data !== "string") {
5978
+ const ctx = this._getOrReturnCtx(input);
5979
+ const expectedValues = this._def.values;
5980
+ addIssueToContext(ctx, {
5981
+ expected: util.joinValues(expectedValues),
5982
+ received: ctx.parsedType,
5983
+ code: ZodIssueCode.invalid_type
5984
+ });
5985
+ return INVALID;
5986
+ }
5987
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache)) {
5988
+ __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values));
5989
+ }
5990
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache).has(input.data)) {
5991
+ const ctx = this._getOrReturnCtx(input);
5992
+ const expectedValues = this._def.values;
5993
+ addIssueToContext(ctx, {
5994
+ received: ctx.data,
5995
+ code: ZodIssueCode.invalid_enum_value,
5996
+ options: expectedValues
5997
+ });
5998
+ return INVALID;
5999
+ }
6000
+ return OK(input.data);
6001
+ }
6002
+ get options() {
6003
+ return this._def.values;
6004
+ }
6005
+ get enum() {
6006
+ const enumValues = {};
6007
+ for (const val of this._def.values) {
6008
+ enumValues[val] = val;
6009
+ }
6010
+ return enumValues;
6011
+ }
6012
+ get Values() {
6013
+ const enumValues = {};
6014
+ for (const val of this._def.values) {
6015
+ enumValues[val] = val;
6016
+ }
6017
+ return enumValues;
6018
+ }
6019
+ get Enum() {
6020
+ const enumValues = {};
6021
+ for (const val of this._def.values) {
6022
+ enumValues[val] = val;
6023
+ }
6024
+ return enumValues;
6025
+ }
6026
+ extract(values, newDef = this._def) {
6027
+ return ZodEnum.create(values, {
6028
+ ...this._def,
6029
+ ...newDef
6030
+ });
6031
+ }
6032
+ exclude(values, newDef = this._def) {
6033
+ return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
6034
+ ...this._def,
6035
+ ...newDef
6036
+ });
6037
+ }
6038
+ }
6039
+ _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
6040
+ ZodEnum.create = createZodEnum;
6041
+ class ZodNativeEnum extends ZodType {
6042
+ constructor() {
6043
+ super(...arguments);
6044
+ _ZodNativeEnum_cache.set(this, void 0);
6045
+ }
6046
+ _parse(input) {
6047
+ const nativeEnumValues = util.getValidEnumValues(this._def.values);
6048
+ const ctx = this._getOrReturnCtx(input);
6049
+ if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
6050
+ const expectedValues = util.objectValues(nativeEnumValues);
6051
+ addIssueToContext(ctx, {
6052
+ expected: util.joinValues(expectedValues),
6053
+ received: ctx.parsedType,
6054
+ code: ZodIssueCode.invalid_type
6055
+ });
6056
+ return INVALID;
6057
+ }
6058
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache)) {
6059
+ __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)));
6060
+ }
6061
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache).has(input.data)) {
6062
+ const expectedValues = util.objectValues(nativeEnumValues);
6063
+ addIssueToContext(ctx, {
6064
+ received: ctx.data,
6065
+ code: ZodIssueCode.invalid_enum_value,
6066
+ options: expectedValues
6067
+ });
6068
+ return INVALID;
6069
+ }
6070
+ return OK(input.data);
6071
+ }
6072
+ get enum() {
6073
+ return this._def.values;
6074
+ }
6075
+ }
6076
+ _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
6077
+ ZodNativeEnum.create = (values, params) => {
6078
+ return new ZodNativeEnum({
6079
+ values,
6080
+ typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
6081
+ ...processCreateParams(params)
6082
+ });
6083
+ };
6084
+ class ZodPromise extends ZodType {
6085
+ unwrap() {
6086
+ return this._def.type;
6087
+ }
6088
+ _parse(input) {
6089
+ const { ctx } = this._processInputParams(input);
6090
+ if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
6091
+ addIssueToContext(ctx, {
6092
+ code: ZodIssueCode.invalid_type,
6093
+ expected: ZodParsedType.promise,
6094
+ received: ctx.parsedType
6095
+ });
6096
+ return INVALID;
6097
+ }
6098
+ const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
6099
+ return OK(promisified.then((data) => {
6100
+ return this._def.type.parseAsync(data, {
6101
+ path: ctx.path,
6102
+ errorMap: ctx.common.contextualErrorMap
6103
+ });
6104
+ }));
6105
+ }
6106
+ }
6107
+ ZodPromise.create = (schema, params) => {
6108
+ return new ZodPromise({
6109
+ type: schema,
6110
+ typeName: ZodFirstPartyTypeKind.ZodPromise,
6111
+ ...processCreateParams(params)
6112
+ });
6113
+ };
6114
+ class ZodEffects extends ZodType {
6115
+ innerType() {
6116
+ return this._def.schema;
6117
+ }
6118
+ sourceType() {
6119
+ return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
6120
+ }
6121
+ _parse(input) {
6122
+ const { status, ctx } = this._processInputParams(input);
6123
+ const effect = this._def.effect || null;
6124
+ const checkCtx = {
6125
+ addIssue: (arg) => {
6126
+ addIssueToContext(ctx, arg);
6127
+ if (arg.fatal) {
6128
+ status.abort();
6129
+ } else {
6130
+ status.dirty();
6131
+ }
6132
+ },
6133
+ get path() {
6134
+ return ctx.path;
6135
+ }
6136
+ };
6137
+ checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
6138
+ if (effect.type === "preprocess") {
6139
+ const processed = effect.transform(ctx.data, checkCtx);
6140
+ if (ctx.common.async) {
6141
+ return Promise.resolve(processed).then(async (processed2) => {
6142
+ if (status.value === "aborted")
6143
+ return INVALID;
6144
+ const result = await this._def.schema._parseAsync({
6145
+ data: processed2,
6146
+ path: ctx.path,
6147
+ parent: ctx
6148
+ });
6149
+ if (result.status === "aborted")
6150
+ return INVALID;
6151
+ if (result.status === "dirty")
6152
+ return DIRTY(result.value);
6153
+ if (status.value === "dirty")
6154
+ return DIRTY(result.value);
6155
+ return result;
6156
+ });
6157
+ } else {
6158
+ if (status.value === "aborted")
6159
+ return INVALID;
6160
+ const result = this._def.schema._parseSync({
6161
+ data: processed,
6162
+ path: ctx.path,
6163
+ parent: ctx
6164
+ });
6165
+ if (result.status === "aborted")
6166
+ return INVALID;
6167
+ if (result.status === "dirty")
6168
+ return DIRTY(result.value);
6169
+ if (status.value === "dirty")
6170
+ return DIRTY(result.value);
6171
+ return result;
6172
+ }
6173
+ }
6174
+ if (effect.type === "refinement") {
6175
+ const executeRefinement = (acc) => {
6176
+ const result = effect.refinement(acc, checkCtx);
6177
+ if (ctx.common.async) {
6178
+ return Promise.resolve(result);
6179
+ }
6180
+ if (result instanceof Promise) {
6181
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
6182
+ }
6183
+ return acc;
6184
+ };
6185
+ if (ctx.common.async === false) {
6186
+ const inner = this._def.schema._parseSync({
6187
+ data: ctx.data,
6188
+ path: ctx.path,
6189
+ parent: ctx
6190
+ });
6191
+ if (inner.status === "aborted")
6192
+ return INVALID;
6193
+ if (inner.status === "dirty")
6194
+ status.dirty();
6195
+ executeRefinement(inner.value);
6196
+ return { status: status.value, value: inner.value };
6197
+ } else {
6198
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
6199
+ if (inner.status === "aborted")
6200
+ return INVALID;
6201
+ if (inner.status === "dirty")
6202
+ status.dirty();
6203
+ return executeRefinement(inner.value).then(() => {
6204
+ return { status: status.value, value: inner.value };
6205
+ });
6206
+ });
6207
+ }
6208
+ }
6209
+ if (effect.type === "transform") {
6210
+ if (ctx.common.async === false) {
6211
+ const base = this._def.schema._parseSync({
6212
+ data: ctx.data,
6213
+ path: ctx.path,
6214
+ parent: ctx
6215
+ });
6216
+ if (!isValid$3(base))
6217
+ return base;
6218
+ const result = effect.transform(base.value, checkCtx);
6219
+ if (result instanceof Promise) {
6220
+ throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
6221
+ }
6222
+ return { status: status.value, value: result };
6223
+ } else {
6224
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
6225
+ if (!isValid$3(base))
6226
+ return base;
6227
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
6228
+ });
6229
+ }
6230
+ }
6231
+ util.assertNever(effect);
6232
+ }
6233
+ }
6234
+ ZodEffects.create = (schema, effect, params) => {
6235
+ return new ZodEffects({
6236
+ schema,
6237
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
6238
+ effect,
6239
+ ...processCreateParams(params)
6240
+ });
6241
+ };
6242
+ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
6243
+ return new ZodEffects({
6244
+ schema,
6245
+ effect: { type: "preprocess", transform: preprocess },
6246
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
6247
+ ...processCreateParams(params)
6248
+ });
6249
+ };
6250
+ class ZodOptional extends ZodType {
6251
+ _parse(input) {
6252
+ const parsedType = this._getType(input);
6253
+ if (parsedType === ZodParsedType.undefined) {
6254
+ return OK(void 0);
6255
+ }
6256
+ return this._def.innerType._parse(input);
6257
+ }
6258
+ unwrap() {
6259
+ return this._def.innerType;
6260
+ }
6261
+ }
6262
+ ZodOptional.create = (type, params) => {
6263
+ return new ZodOptional({
6264
+ innerType: type,
6265
+ typeName: ZodFirstPartyTypeKind.ZodOptional,
6266
+ ...processCreateParams(params)
6267
+ });
6268
+ };
6269
+ class ZodNullable extends ZodType {
6270
+ _parse(input) {
6271
+ const parsedType = this._getType(input);
6272
+ if (parsedType === ZodParsedType.null) {
6273
+ return OK(null);
6274
+ }
6275
+ return this._def.innerType._parse(input);
6276
+ }
6277
+ unwrap() {
6278
+ return this._def.innerType;
6279
+ }
6280
+ }
6281
+ ZodNullable.create = (type, params) => {
6282
+ return new ZodNullable({
6283
+ innerType: type,
6284
+ typeName: ZodFirstPartyTypeKind.ZodNullable,
6285
+ ...processCreateParams(params)
6286
+ });
6287
+ };
6288
+ class ZodDefault extends ZodType {
6289
+ _parse(input) {
6290
+ const { ctx } = this._processInputParams(input);
6291
+ let data = ctx.data;
6292
+ if (ctx.parsedType === ZodParsedType.undefined) {
6293
+ data = this._def.defaultValue();
6294
+ }
6295
+ return this._def.innerType._parse({
6296
+ data,
6297
+ path: ctx.path,
6298
+ parent: ctx
6299
+ });
6300
+ }
6301
+ removeDefault() {
6302
+ return this._def.innerType;
6303
+ }
6304
+ }
6305
+ ZodDefault.create = (type, params) => {
6306
+ return new ZodDefault({
6307
+ innerType: type,
6308
+ typeName: ZodFirstPartyTypeKind.ZodDefault,
6309
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
6310
+ ...processCreateParams(params)
6311
+ });
6312
+ };
6313
+ class ZodCatch extends ZodType {
6314
+ _parse(input) {
6315
+ const { ctx } = this._processInputParams(input);
6316
+ const newCtx = {
6317
+ ...ctx,
6318
+ common: {
6319
+ ...ctx.common,
6320
+ issues: []
6321
+ }
6322
+ };
6323
+ const result = this._def.innerType._parse({
6324
+ data: newCtx.data,
6325
+ path: newCtx.path,
6326
+ parent: {
6327
+ ...newCtx
6328
+ }
6329
+ });
6330
+ if (isAsync(result)) {
6331
+ return result.then((result2) => {
6332
+ return {
6333
+ status: "valid",
6334
+ value: result2.status === "valid" ? result2.value : this._def.catchValue({
6335
+ get error() {
6336
+ return new ZodError(newCtx.common.issues);
6337
+ },
6338
+ input: newCtx.data
6339
+ })
6340
+ };
6341
+ });
6342
+ } else {
6343
+ return {
6344
+ status: "valid",
6345
+ value: result.status === "valid" ? result.value : this._def.catchValue({
6346
+ get error() {
6347
+ return new ZodError(newCtx.common.issues);
6348
+ },
6349
+ input: newCtx.data
6350
+ })
6351
+ };
6352
+ }
6353
+ }
6354
+ removeCatch() {
6355
+ return this._def.innerType;
6356
+ }
6357
+ }
6358
+ ZodCatch.create = (type, params) => {
6359
+ return new ZodCatch({
6360
+ innerType: type,
6361
+ typeName: ZodFirstPartyTypeKind.ZodCatch,
6362
+ catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
6363
+ ...processCreateParams(params)
6364
+ });
6365
+ };
6366
+ class ZodNaN extends ZodType {
6367
+ _parse(input) {
6368
+ const parsedType = this._getType(input);
6369
+ if (parsedType !== ZodParsedType.nan) {
6370
+ const ctx = this._getOrReturnCtx(input);
6371
+ addIssueToContext(ctx, {
6372
+ code: ZodIssueCode.invalid_type,
6373
+ expected: ZodParsedType.nan,
6374
+ received: ctx.parsedType
6375
+ });
6376
+ return INVALID;
6377
+ }
6378
+ return { status: "valid", value: input.data };
6379
+ }
6380
+ }
6381
+ ZodNaN.create = (params) => {
6382
+ return new ZodNaN({
6383
+ typeName: ZodFirstPartyTypeKind.ZodNaN,
6384
+ ...processCreateParams(params)
6385
+ });
6386
+ };
6387
+ const BRAND = Symbol("zod_brand");
6388
+ class ZodBranded extends ZodType {
6389
+ _parse(input) {
6390
+ const { ctx } = this._processInputParams(input);
6391
+ const data = ctx.data;
6392
+ return this._def.type._parse({
6393
+ data,
6394
+ path: ctx.path,
6395
+ parent: ctx
6396
+ });
6397
+ }
6398
+ unwrap() {
6399
+ return this._def.type;
6400
+ }
6401
+ }
6402
+ class ZodPipeline extends ZodType {
6403
+ _parse(input) {
6404
+ const { status, ctx } = this._processInputParams(input);
6405
+ if (ctx.common.async) {
6406
+ const handleAsync = async () => {
6407
+ const inResult = await this._def.in._parseAsync({
6408
+ data: ctx.data,
6409
+ path: ctx.path,
6410
+ parent: ctx
6411
+ });
6412
+ if (inResult.status === "aborted")
6413
+ return INVALID;
6414
+ if (inResult.status === "dirty") {
6415
+ status.dirty();
6416
+ return DIRTY(inResult.value);
6417
+ } else {
6418
+ return this._def.out._parseAsync({
6419
+ data: inResult.value,
6420
+ path: ctx.path,
6421
+ parent: ctx
6422
+ });
6423
+ }
6424
+ };
6425
+ return handleAsync();
6426
+ } else {
6427
+ const inResult = this._def.in._parseSync({
6428
+ data: ctx.data,
6429
+ path: ctx.path,
6430
+ parent: ctx
6431
+ });
6432
+ if (inResult.status === "aborted")
6433
+ return INVALID;
6434
+ if (inResult.status === "dirty") {
6435
+ status.dirty();
6436
+ return {
6437
+ status: "dirty",
6438
+ value: inResult.value
6439
+ };
6440
+ } else {
6441
+ return this._def.out._parseSync({
6442
+ data: inResult.value,
6443
+ path: ctx.path,
6444
+ parent: ctx
6445
+ });
6446
+ }
6447
+ }
6448
+ }
6449
+ static create(a, b) {
6450
+ return new ZodPipeline({
6451
+ in: a,
6452
+ out: b,
6453
+ typeName: ZodFirstPartyTypeKind.ZodPipeline
6454
+ });
6455
+ }
6456
+ }
6457
+ class ZodReadonly extends ZodType {
6458
+ _parse(input) {
6459
+ const result = this._def.innerType._parse(input);
6460
+ const freeze = (data) => {
6461
+ if (isValid$3(data)) {
6462
+ data.value = Object.freeze(data.value);
6463
+ }
6464
+ return data;
6465
+ };
6466
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
6467
+ }
6468
+ unwrap() {
6469
+ return this._def.innerType;
6470
+ }
6471
+ }
6472
+ ZodReadonly.create = (type, params) => {
6473
+ return new ZodReadonly({
6474
+ innerType: type,
6475
+ typeName: ZodFirstPartyTypeKind.ZodReadonly,
6476
+ ...processCreateParams(params)
6477
+ });
6478
+ };
6479
+ function cleanParams(params, data) {
6480
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
6481
+ const p2 = typeof p === "string" ? { message: p } : p;
6482
+ return p2;
6483
+ }
6484
+ function custom(check, _params = {}, fatal) {
6485
+ if (check)
6486
+ return ZodAny.create().superRefine((data, ctx) => {
6487
+ var _a, _b;
6488
+ const r = check(data);
6489
+ if (r instanceof Promise) {
6490
+ return r.then((r2) => {
6491
+ var _a2, _b2;
6492
+ if (!r2) {
6493
+ const params = cleanParams(_params, data);
6494
+ const _fatal = (_b2 = (_a2 = params.fatal) !== null && _a2 !== void 0 ? _a2 : fatal) !== null && _b2 !== void 0 ? _b2 : true;
6495
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
6496
+ }
6497
+ });
6498
+ }
6499
+ if (!r) {
6500
+ const params = cleanParams(_params, data);
6501
+ const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
6502
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
6503
+ }
6504
+ return;
6505
+ });
6506
+ return ZodAny.create();
6507
+ }
6508
+ const late = {
6509
+ object: ZodObject.lazycreate
6510
+ };
6511
+ var ZodFirstPartyTypeKind;
6512
+ (function(ZodFirstPartyTypeKind2) {
6513
+ ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
6514
+ ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
6515
+ ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
6516
+ ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
6517
+ ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
6518
+ ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
6519
+ ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
6520
+ ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
6521
+ ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
6522
+ ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
6523
+ ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
6524
+ ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
6525
+ ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
6526
+ ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
6527
+ ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
6528
+ ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
6529
+ ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
6530
+ ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
6531
+ ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
6532
+ ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
6533
+ ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
6534
+ ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
6535
+ ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
6536
+ ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
6537
+ ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
6538
+ ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
6539
+ ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
6540
+ ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
6541
+ ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
6542
+ ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
6543
+ ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
6544
+ ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
6545
+ ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
6546
+ ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
6547
+ ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
6548
+ ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
6549
+ })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
6550
+ const instanceOfType = (cls, params = {
6551
+ message: `Input not instance of ${cls.name}`
6552
+ }) => custom((data) => data instanceof cls, params);
6553
+ const stringType = ZodString.create;
6554
+ const numberType = ZodNumber.create;
6555
+ const nanType = ZodNaN.create;
6556
+ const bigIntType = ZodBigInt.create;
6557
+ const booleanType = ZodBoolean.create;
6558
+ const dateType = ZodDate.create;
6559
+ const symbolType = ZodSymbol.create;
6560
+ const undefinedType = ZodUndefined.create;
6561
+ const nullType = ZodNull.create;
6562
+ const anyType = ZodAny.create;
6563
+ const unknownType = ZodUnknown.create;
6564
+ const neverType = ZodNever.create;
6565
+ const voidType = ZodVoid.create;
6566
+ const arrayType = ZodArray.create;
6567
+ const objectType = ZodObject.create;
6568
+ const strictObjectType = ZodObject.strictCreate;
6569
+ const unionType = ZodUnion.create;
6570
+ const discriminatedUnionType = ZodDiscriminatedUnion.create;
6571
+ const intersectionType = ZodIntersection.create;
6572
+ const tupleType = ZodTuple.create;
6573
+ const recordType = ZodRecord.create;
6574
+ const mapType = ZodMap.create;
6575
+ const setType = ZodSet.create;
6576
+ const functionType = ZodFunction.create;
6577
+ const lazyType = ZodLazy.create;
6578
+ const literalType = ZodLiteral.create;
6579
+ const enumType = ZodEnum.create;
6580
+ const nativeEnumType = ZodNativeEnum.create;
6581
+ const promiseType = ZodPromise.create;
6582
+ const effectsType = ZodEffects.create;
6583
+ const optionalType = ZodOptional.create;
6584
+ const nullableType = ZodNullable.create;
6585
+ const preprocessType = ZodEffects.createWithPreprocess;
6586
+ const pipelineType = ZodPipeline.create;
6587
+ const ostring = () => stringType().optional();
6588
+ const onumber = () => numberType().optional();
6589
+ const oboolean = () => booleanType().optional();
6590
+ const coerce = {
6591
+ string: (arg) => ZodString.create({ ...arg, coerce: true }),
6592
+ number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
6593
+ boolean: (arg) => ZodBoolean.create({
6594
+ ...arg,
6595
+ coerce: true
6596
+ }),
6597
+ bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
6598
+ date: (arg) => ZodDate.create({ ...arg, coerce: true })
6599
+ };
6600
+ const NEVER = INVALID;
6601
+ var z = /* @__PURE__ */ Object.freeze({
6602
+ __proto__: null,
6603
+ defaultErrorMap: errorMap,
6604
+ setErrorMap,
6605
+ getErrorMap,
6606
+ makeIssue,
6607
+ EMPTY_PATH,
6608
+ addIssueToContext,
6609
+ ParseStatus,
6610
+ INVALID,
6611
+ DIRTY,
6612
+ OK,
6613
+ isAborted,
6614
+ isDirty,
6615
+ isValid: isValid$3,
6616
+ isAsync,
6617
+ get util() {
6618
+ return util;
6619
+ },
6620
+ get objectUtil() {
6621
+ return objectUtil;
6622
+ },
6623
+ ZodParsedType,
6624
+ getParsedType,
6625
+ ZodType,
6626
+ datetimeRegex,
6627
+ ZodString,
6628
+ ZodNumber,
6629
+ ZodBigInt,
6630
+ ZodBoolean,
6631
+ ZodDate,
6632
+ ZodSymbol,
6633
+ ZodUndefined,
6634
+ ZodNull,
6635
+ ZodAny,
6636
+ ZodUnknown,
6637
+ ZodNever,
6638
+ ZodVoid,
6639
+ ZodArray,
6640
+ ZodObject,
6641
+ ZodUnion,
6642
+ ZodDiscriminatedUnion,
6643
+ ZodIntersection,
6644
+ ZodTuple,
6645
+ ZodRecord,
6646
+ ZodMap,
6647
+ ZodSet,
6648
+ ZodFunction,
6649
+ ZodLazy,
6650
+ ZodLiteral,
6651
+ ZodEnum,
6652
+ ZodNativeEnum,
6653
+ ZodPromise,
6654
+ ZodEffects,
6655
+ ZodTransformer: ZodEffects,
6656
+ ZodOptional,
6657
+ ZodNullable,
6658
+ ZodDefault,
6659
+ ZodCatch,
6660
+ ZodNaN,
6661
+ BRAND,
6662
+ ZodBranded,
6663
+ ZodPipeline,
6664
+ ZodReadonly,
6665
+ custom,
6666
+ Schema: ZodType,
6667
+ ZodSchema: ZodType,
6668
+ late,
6669
+ get ZodFirstPartyTypeKind() {
6670
+ return ZodFirstPartyTypeKind;
6671
+ },
6672
+ coerce,
6673
+ any: anyType,
6674
+ array: arrayType,
6675
+ bigint: bigIntType,
6676
+ boolean: booleanType,
6677
+ date: dateType,
6678
+ discriminatedUnion: discriminatedUnionType,
6679
+ effect: effectsType,
6680
+ "enum": enumType,
6681
+ "function": functionType,
6682
+ "instanceof": instanceOfType,
6683
+ intersection: intersectionType,
6684
+ lazy: lazyType,
6685
+ literal: literalType,
6686
+ map: mapType,
6687
+ nan: nanType,
6688
+ nativeEnum: nativeEnumType,
6689
+ never: neverType,
6690
+ "null": nullType,
6691
+ nullable: nullableType,
6692
+ number: numberType,
6693
+ object: objectType,
6694
+ oboolean,
6695
+ onumber,
6696
+ optional: optionalType,
6697
+ ostring,
6698
+ pipeline: pipelineType,
6699
+ preprocess: preprocessType,
6700
+ promise: promiseType,
6701
+ record: recordType,
6702
+ set: setType,
6703
+ strictObject: strictObjectType,
6704
+ string: stringType,
6705
+ symbol: symbolType,
6706
+ transformer: effectsType,
6707
+ tuple: tupleType,
6708
+ "undefined": undefinedType,
6709
+ union: unionType,
6710
+ unknown: unknownType,
6711
+ "void": voidType,
6712
+ NEVER,
6713
+ ZodIssueCode,
6714
+ quotelessJson,
6715
+ ZodError
6716
+ });
6717
+ const __vite_import_meta_env__ = { "BASE_URL": "/", "DEV": false, "MODE": "development", "PROD": true, "SSR": false, "VITE_MODULES_CARDS_ADMIN_FRONTEND_BASE_URL": "https://dev-sso.6seconds.org", "VITE_MODULES_CARDS_HOME_FRONTEND_BASE_URL": "https://dev-sso.6seconds.org", "VITE_MODULES_CERT_FRONTEND_BASE_URL": "https://dev-sso.6seconds.org", "VITE_MODULES_ENV": "dev", "VITE_MODULES_EVENTS_FRONTEND_BASE_URL": "https://dev-sso.6seconds.org", "VITE_MODULES_SSO_BACKEND_BASE_URL": "https://dev-ssoapi.6seconds.org", "VITE_MODULES_SSO_FRONTEND_BASE_URL": "https://dev-sso.6seconds.org", "VITE_MODULES_TOOLS_FRONTEND_BASE_URL": "https://dev-sso.6seconds.org" };
2659
6718
  const env = createEnv({
6719
+ client: {
6720
+ VITE_MODULES_ENV: z.string()
6721
+ },
2660
6722
  runtimeEnv: __vite_import_meta_env__
2661
6723
  });
2662
6724
  const DEV = process.env.NODE_ENV === "development";
@@ -2720,7 +6782,7 @@ const ROUTES = {
2720
6782
  };
2721
6783
  const STORAGE_VALUES = Object.freeze({
2722
6784
  // mainToken: env.NEXT_PUBLIC_TOKEN_NAME,
2723
- previousLoginBanner: "previousLoginDetails"
6785
+ previousLoginBanner: "previousLoginDetails-" + env.VITE_MODULES_ENV
2724
6786
  });
2725
6787
  const MAIN_DATE_FORMAT = "MM/DD/YYYY";
2726
6788
  const MAIN_TIME_FORMAT = "h:mm a";
@@ -7396,7 +11458,7 @@ function createValidation(config) {
7396
11458
  originalValue,
7397
11459
  schema
7398
11460
  };
7399
- const handleResult = (validOrError) => {
11461
+ const handleResult2 = (validOrError) => {
7400
11462
  if (ValidationError.isError(validOrError)) invalid(validOrError);
7401
11463
  else if (!validOrError) invalid(createError());
7402
11464
  else next(null);
@@ -7407,7 +11469,7 @@ function createValidation(config) {
7407
11469
  };
7408
11470
  const shouldSkip = skipAbsent && isAbsent(value);
7409
11471
  if (shouldSkip) {
7410
- return handleResult(true);
11472
+ return handleResult2(true);
7411
11473
  }
7412
11474
  let result;
7413
11475
  try {
@@ -7417,13 +11479,13 @@ function createValidation(config) {
7417
11479
  if (options.sync) {
7418
11480
  throw new Error(`Validation test of type: "${ctx.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);
7419
11481
  }
7420
- return Promise.resolve(result).then(handleResult, handleError);
11482
+ return Promise.resolve(result).then(handleResult2, handleError);
7421
11483
  }
7422
11484
  } catch (err) {
7423
11485
  handleError(err);
7424
11486
  return;
7425
11487
  }
7426
- handleResult(result);
11488
+ handleResult2(result);
7427
11489
  }
7428
11490
  validate.OPTIONS = config;
7429
11491
  return validate;
@@ -9009,8 +13071,8 @@ function requireDist() {
9009
13071
  dist.default = urlcat2;
9010
13072
  function urlcatImpl(pathTemplate, params, baseUrl) {
9011
13073
  var _a = path(pathTemplate, params), renderedPath = _a.renderedPath, remainingParams = _a.remainingParams;
9012
- var cleanParams = removeNullOrUndef(remainingParams);
9013
- var renderedQuery = query(cleanParams);
13074
+ var cleanParams2 = removeNullOrUndef(remainingParams);
13075
+ var renderedQuery = query(cleanParams2);
9014
13076
  var pathAndQuery = join(renderedPath, "?", renderedQuery);
9015
13077
  return baseUrl ? join(baseUrl, "/", pathAndQuery) : pathAndQuery;
9016
13078
  }