lkd-web-kit 0.4.3 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/dist/hooks/useZodConfig.cjs +21 -0
  2. package/dist/hooks/useZodConfig.js +17 -0
  3. package/dist/index.cjs +2 -0
  4. package/dist/index.d.ts +4 -3
  5. package/dist/index.js +1 -0
  6. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.cjs +38 -33
  7. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +38 -33
  8. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.cjs +1 -1
  9. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +1 -1
  10. package/dist/node_modules/zod/v4/classic/coerce.cjs +28 -0
  11. package/dist/node_modules/zod/v4/classic/coerce.js +20 -0
  12. package/dist/node_modules/zod/v4/classic/compat.cjs +37 -0
  13. package/dist/node_modules/zod/v4/classic/compat.js +30 -0
  14. package/dist/node_modules/zod/v4/classic/errors.cjs +49 -0
  15. package/dist/node_modules/zod/v4/classic/errors.js +44 -0
  16. package/dist/node_modules/zod/v4/classic/external.cjs +231 -0
  17. package/dist/node_modules/zod/v4/classic/external.js +28 -0
  18. package/dist/node_modules/zod/v4/classic/index.cjs +10 -0
  19. package/dist/node_modules/zod/v4/classic/index.js +5 -0
  20. package/dist/node_modules/zod/v4/classic/iso.cjs +46 -0
  21. package/dist/node_modules/zod/v4/classic/iso.js +35 -0
  22. package/dist/node_modules/zod/v4/classic/parse.cjs +16 -0
  23. package/dist/node_modules/zod/v4/classic/parse.js +9 -0
  24. package/dist/node_modules/zod/v4/classic/schemas.cjs +1155 -0
  25. package/dist/node_modules/zod/v4/classic/schemas.js +1006 -0
  26. package/dist/node_modules/zod/v4/core/api.cjs +1016 -0
  27. package/dist/node_modules/zod/v4/core/api.js +903 -0
  28. package/dist/node_modules/zod/v4/core/checks.cjs +587 -0
  29. package/dist/node_modules/zod/v4/core/checks.js +562 -0
  30. package/dist/node_modules/zod/v4/core/core.cjs +72 -0
  31. package/dist/node_modules/zod/v4/core/core.js +63 -0
  32. package/dist/node_modules/zod/v4/core/doc.cjs +41 -0
  33. package/dist/node_modules/zod/v4/core/doc.js +37 -0
  34. package/dist/node_modules/zod/v4/core/errors.cjs +204 -0
  35. package/dist/node_modules/zod/v4/core/errors.js +194 -0
  36. package/dist/node_modules/zod/v4/core/function.cjs +81 -0
  37. package/dist/node_modules/zod/v4/core/function.js +76 -0
  38. package/dist/node_modules/zod/v4/core/index.cjs +261 -0
  39. package/dist/node_modules/zod/v4/core/index.js +20 -0
  40. package/dist/node_modules/zod/v4/core/json-schema.cjs +2 -0
  41. package/dist/node_modules/zod/v4/core/json-schema.js +1 -0
  42. package/dist/node_modules/zod/v4/core/parse.cjs +71 -0
  43. package/dist/node_modules/zod/v4/core/parse.js +60 -0
  44. package/dist/node_modules/zod/v4/core/regexes.cjs +139 -0
  45. package/dist/node_modules/zod/v4/core/regexes.js +95 -0
  46. package/dist/node_modules/zod/v4/core/registries.cjs +52 -0
  47. package/dist/node_modules/zod/v4/core/registries.js +44 -0
  48. package/dist/node_modules/zod/v4/core/schemas.cjs +1793 -0
  49. package/dist/node_modules/zod/v4/core/schemas.js +1720 -0
  50. package/dist/node_modules/zod/v4/core/to-json-schema.cjs +823 -0
  51. package/dist/node_modules/zod/v4/core/to-json-schema.js +818 -0
  52. package/dist/node_modules/zod/v4/core/util.cjs +543 -0
  53. package/dist/node_modules/zod/v4/core/util.js +491 -0
  54. package/dist/node_modules/zod/v4/core/versions.cjs +11 -0
  55. package/dist/node_modules/zod/v4/core/versions.js +7 -0
  56. package/dist/node_modules/zod/v4/index.cjs +10 -0
  57. package/dist/node_modules/zod/v4/index.js +5 -0
  58. package/dist/node_modules/zod/v4/locales/ar.cjs +121 -0
  59. package/dist/node_modules/zod/v4/locales/ar.js +119 -0
  60. package/dist/node_modules/zod/v4/locales/az.cjs +120 -0
  61. package/dist/node_modules/zod/v4/locales/az.js +118 -0
  62. package/dist/node_modules/zod/v4/locales/be.cjs +169 -0
  63. package/dist/node_modules/zod/v4/locales/be.js +167 -0
  64. package/dist/node_modules/zod/v4/locales/ca.cjs +123 -0
  65. package/dist/node_modules/zod/v4/locales/ca.js +121 -0
  66. package/dist/node_modules/zod/v4/locales/cs.cjs +140 -0
  67. package/dist/node_modules/zod/v4/locales/cs.js +138 -0
  68. package/dist/node_modules/zod/v4/locales/de.cjs +121 -0
  69. package/dist/node_modules/zod/v4/locales/de.js +119 -0
  70. package/dist/node_modules/zod/v4/locales/en.cjs +125 -0
  71. package/dist/node_modules/zod/v4/locales/en.js +120 -0
  72. package/dist/node_modules/zod/v4/locales/eo.cjs +124 -0
  73. package/dist/node_modules/zod/v4/locales/eo.js +119 -0
  74. package/dist/node_modules/zod/v4/locales/es.cjs +122 -0
  75. package/dist/node_modules/zod/v4/locales/es.js +120 -0
  76. package/dist/node_modules/zod/v4/locales/fa.cjs +127 -0
  77. package/dist/node_modules/zod/v4/locales/fa.js +125 -0
  78. package/dist/node_modules/zod/v4/locales/fi.cjs +127 -0
  79. package/dist/node_modules/zod/v4/locales/fi.js +125 -0
  80. package/dist/node_modules/zod/v4/locales/fr-CA.cjs +122 -0
  81. package/dist/node_modules/zod/v4/locales/fr-CA.js +120 -0
  82. package/dist/node_modules/zod/v4/locales/fr.cjs +121 -0
  83. package/dist/node_modules/zod/v4/locales/fr.js +119 -0
  84. package/dist/node_modules/zod/v4/locales/he.cjs +122 -0
  85. package/dist/node_modules/zod/v4/locales/he.js +120 -0
  86. package/dist/node_modules/zod/v4/locales/hu.cjs +122 -0
  87. package/dist/node_modules/zod/v4/locales/hu.js +120 -0
  88. package/dist/node_modules/zod/v4/locales/id.cjs +121 -0
  89. package/dist/node_modules/zod/v4/locales/id.js +119 -0
  90. package/dist/node_modules/zod/v4/locales/index.cjs +85 -0
  91. package/dist/node_modules/zod/v4/locales/index.js +39 -0
  92. package/dist/node_modules/zod/v4/locales/it.cjs +122 -0
  93. package/dist/node_modules/zod/v4/locales/it.js +120 -0
  94. package/dist/node_modules/zod/v4/locales/ja.cjs +120 -0
  95. package/dist/node_modules/zod/v4/locales/ja.js +118 -0
  96. package/dist/node_modules/zod/v4/locales/kh.cjs +122 -0
  97. package/dist/node_modules/zod/v4/locales/kh.js +120 -0
  98. package/dist/node_modules/zod/v4/locales/ko.cjs +126 -0
  99. package/dist/node_modules/zod/v4/locales/ko.js +124 -0
  100. package/dist/node_modules/zod/v4/locales/mk.cjs +123 -0
  101. package/dist/node_modules/zod/v4/locales/mk.js +121 -0
  102. package/dist/node_modules/zod/v4/locales/ms.cjs +121 -0
  103. package/dist/node_modules/zod/v4/locales/ms.js +119 -0
  104. package/dist/node_modules/zod/v4/locales/nl.cjs +122 -0
  105. package/dist/node_modules/zod/v4/locales/nl.js +120 -0
  106. package/dist/node_modules/zod/v4/locales/no.cjs +121 -0
  107. package/dist/node_modules/zod/v4/locales/no.js +119 -0
  108. package/dist/node_modules/zod/v4/locales/ota.cjs +122 -0
  109. package/dist/node_modules/zod/v4/locales/ota.js +120 -0
  110. package/dist/node_modules/zod/v4/locales/pl.cjs +122 -0
  111. package/dist/node_modules/zod/v4/locales/pl.js +120 -0
  112. package/dist/node_modules/zod/v4/locales/ps.cjs +127 -0
  113. package/dist/node_modules/zod/v4/locales/ps.js +125 -0
  114. package/dist/node_modules/zod/v4/locales/pt.cjs +121 -0
  115. package/dist/node_modules/zod/v4/locales/pt.js +119 -0
  116. package/dist/node_modules/zod/v4/locales/ru.cjs +169 -0
  117. package/dist/node_modules/zod/v4/locales/ru.js +167 -0
  118. package/dist/node_modules/zod/v4/locales/sl.cjs +122 -0
  119. package/dist/node_modules/zod/v4/locales/sl.js +120 -0
  120. package/dist/node_modules/zod/v4/locales/sv.cjs +123 -0
  121. package/dist/node_modules/zod/v4/locales/sv.js +121 -0
  122. package/dist/node_modules/zod/v4/locales/ta.cjs +122 -0
  123. package/dist/node_modules/zod/v4/locales/ta.js +120 -0
  124. package/dist/node_modules/zod/v4/locales/th.cjs +122 -0
  125. package/dist/node_modules/zod/v4/locales/th.js +120 -0
  126. package/dist/node_modules/zod/v4/locales/tr.cjs +123 -0
  127. package/dist/node_modules/zod/v4/locales/tr.js +118 -0
  128. package/dist/node_modules/zod/v4/locales/ua.cjs +122 -0
  129. package/dist/node_modules/zod/v4/locales/ua.js +120 -0
  130. package/dist/node_modules/zod/v4/locales/ur.cjs +122 -0
  131. package/dist/node_modules/zod/v4/locales/ur.js +120 -0
  132. package/dist/node_modules/zod/v4/locales/vi.cjs +121 -0
  133. package/dist/node_modules/zod/v4/locales/vi.js +119 -0
  134. package/dist/node_modules/zod/v4/locales/zh-CN.cjs +121 -0
  135. package/dist/node_modules/zod/v4/locales/zh-CN.js +119 -0
  136. package/dist/node_modules/zod/v4/locales/zh-TW.cjs +122 -0
  137. package/dist/node_modules/zod/v4/locales/zh-TW.js +120 -0
  138. package/package.json +1 -1
@@ -0,0 +1,543 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ // functions
6
+ function assertEqual(val) {
7
+ return val;
8
+ }
9
+ function assertNotEqual(val) {
10
+ return val;
11
+ }
12
+ function assertIs(_arg) { }
13
+ function assertNever(_x) {
14
+ throw new Error();
15
+ }
16
+ function assert(_) { }
17
+ function getEnumValues(entries) {
18
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
19
+ const values = Object.entries(entries)
20
+ .filter(([k, _]) => numericValues.indexOf(+k) === -1)
21
+ .map(([_, v]) => v);
22
+ return values;
23
+ }
24
+ function joinValues(array, separator = "|") {
25
+ return array.map((val) => stringifyPrimitive(val)).join(separator);
26
+ }
27
+ function jsonStringifyReplacer(_, value) {
28
+ if (typeof value === "bigint")
29
+ return value.toString();
30
+ return value;
31
+ }
32
+ function cached(getter) {
33
+ return {
34
+ get value() {
35
+ {
36
+ const value = getter();
37
+ Object.defineProperty(this, "value", { value });
38
+ return value;
39
+ }
40
+ },
41
+ };
42
+ }
43
+ function nullish(input) {
44
+ return input === null || input === undefined;
45
+ }
46
+ function cleanRegex(source) {
47
+ const start = source.startsWith("^") ? 1 : 0;
48
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
49
+ return source.slice(start, end);
50
+ }
51
+ function floatSafeRemainder(val, step) {
52
+ const valDecCount = (val.toString().split(".")[1] || "").length;
53
+ const stepDecCount = (step.toString().split(".")[1] || "").length;
54
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
55
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
56
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
57
+ return (valInt % stepInt) / 10 ** decCount;
58
+ }
59
+ function defineLazy(object, key, getter) {
60
+ Object.defineProperty(object, key, {
61
+ get() {
62
+ {
63
+ const value = getter();
64
+ object[key] = value;
65
+ return value;
66
+ }
67
+ },
68
+ set(v) {
69
+ Object.defineProperty(object, key, {
70
+ value: v,
71
+ // configurable: true,
72
+ });
73
+ // object[key] = v;
74
+ },
75
+ configurable: true,
76
+ });
77
+ }
78
+ function assignProp(target, prop, value) {
79
+ Object.defineProperty(target, prop, {
80
+ value,
81
+ writable: true,
82
+ enumerable: true,
83
+ configurable: true,
84
+ });
85
+ }
86
+ function getElementAtPath(obj, path) {
87
+ if (!path)
88
+ return obj;
89
+ return path.reduce((acc, key) => acc?.[key], obj);
90
+ }
91
+ function promiseAllObject(promisesObj) {
92
+ const keys = Object.keys(promisesObj);
93
+ const promises = keys.map((key) => promisesObj[key]);
94
+ return Promise.all(promises).then((results) => {
95
+ const resolvedObj = {};
96
+ for (let i = 0; i < keys.length; i++) {
97
+ resolvedObj[keys[i]] = results[i];
98
+ }
99
+ return resolvedObj;
100
+ });
101
+ }
102
+ function randomString(length = 10) {
103
+ const chars = "abcdefghijklmnopqrstuvwxyz";
104
+ let str = "";
105
+ for (let i = 0; i < length; i++) {
106
+ str += chars[Math.floor(Math.random() * chars.length)];
107
+ }
108
+ return str;
109
+ }
110
+ function esc(str) {
111
+ return JSON.stringify(str);
112
+ }
113
+ const captureStackTrace = Error.captureStackTrace
114
+ ? Error.captureStackTrace
115
+ : (..._args) => { };
116
+ function isObject(data) {
117
+ return typeof data === "object" && data !== null && !Array.isArray(data);
118
+ }
119
+ const allowsEval = cached(() => {
120
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
121
+ return false;
122
+ }
123
+ try {
124
+ const F = Function;
125
+ new F("");
126
+ return true;
127
+ }
128
+ catch (_) {
129
+ return false;
130
+ }
131
+ });
132
+ function isPlainObject(o) {
133
+ if (isObject(o) === false)
134
+ return false;
135
+ // modified constructor
136
+ const ctor = o.constructor;
137
+ if (ctor === undefined)
138
+ return true;
139
+ // modified prototype
140
+ const prot = ctor.prototype;
141
+ if (isObject(prot) === false)
142
+ return false;
143
+ // ctor doesn't have static `isPrototypeOf`
144
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
145
+ return false;
146
+ }
147
+ return true;
148
+ }
149
+ function numKeys(data) {
150
+ let keyCount = 0;
151
+ for (const key in data) {
152
+ if (Object.prototype.hasOwnProperty.call(data, key)) {
153
+ keyCount++;
154
+ }
155
+ }
156
+ return keyCount;
157
+ }
158
+ const getParsedType = (data) => {
159
+ const t = typeof data;
160
+ switch (t) {
161
+ case "undefined":
162
+ return "undefined";
163
+ case "string":
164
+ return "string";
165
+ case "number":
166
+ return Number.isNaN(data) ? "nan" : "number";
167
+ case "boolean":
168
+ return "boolean";
169
+ case "function":
170
+ return "function";
171
+ case "bigint":
172
+ return "bigint";
173
+ case "symbol":
174
+ return "symbol";
175
+ case "object":
176
+ if (Array.isArray(data)) {
177
+ return "array";
178
+ }
179
+ if (data === null) {
180
+ return "null";
181
+ }
182
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
183
+ return "promise";
184
+ }
185
+ if (typeof Map !== "undefined" && data instanceof Map) {
186
+ return "map";
187
+ }
188
+ if (typeof Set !== "undefined" && data instanceof Set) {
189
+ return "set";
190
+ }
191
+ if (typeof Date !== "undefined" && data instanceof Date) {
192
+ return "date";
193
+ }
194
+ if (typeof File !== "undefined" && data instanceof File) {
195
+ return "file";
196
+ }
197
+ return "object";
198
+ default:
199
+ throw new Error(`Unknown data type: ${t}`);
200
+ }
201
+ };
202
+ const propertyKeyTypes = new Set(["string", "number", "symbol"]);
203
+ const primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
204
+ function escapeRegex(str) {
205
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
206
+ }
207
+ // zod-specific utils
208
+ function clone(inst, def, params) {
209
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
210
+ if (!def || params?.parent)
211
+ cl._zod.parent = inst;
212
+ return cl;
213
+ }
214
+ function normalizeParams(_params) {
215
+ const params = _params;
216
+ if (!params)
217
+ return {};
218
+ if (typeof params === "string")
219
+ return { error: () => params };
220
+ if (params?.message !== undefined) {
221
+ if (params?.error !== undefined)
222
+ throw new Error("Cannot specify both `message` and `error` params");
223
+ params.error = params.message;
224
+ }
225
+ delete params.message;
226
+ if (typeof params.error === "string")
227
+ return { ...params, error: () => params.error };
228
+ return params;
229
+ }
230
+ function createTransparentProxy(getter) {
231
+ let target;
232
+ return new Proxy({}, {
233
+ get(_, prop, receiver) {
234
+ target ?? (target = getter());
235
+ return Reflect.get(target, prop, receiver);
236
+ },
237
+ set(_, prop, value, receiver) {
238
+ target ?? (target = getter());
239
+ return Reflect.set(target, prop, value, receiver);
240
+ },
241
+ has(_, prop) {
242
+ target ?? (target = getter());
243
+ return Reflect.has(target, prop);
244
+ },
245
+ deleteProperty(_, prop) {
246
+ target ?? (target = getter());
247
+ return Reflect.deleteProperty(target, prop);
248
+ },
249
+ ownKeys(_) {
250
+ target ?? (target = getter());
251
+ return Reflect.ownKeys(target);
252
+ },
253
+ getOwnPropertyDescriptor(_, prop) {
254
+ target ?? (target = getter());
255
+ return Reflect.getOwnPropertyDescriptor(target, prop);
256
+ },
257
+ defineProperty(_, prop, descriptor) {
258
+ target ?? (target = getter());
259
+ return Reflect.defineProperty(target, prop, descriptor);
260
+ },
261
+ });
262
+ }
263
+ function stringifyPrimitive(value) {
264
+ if (typeof value === "bigint")
265
+ return value.toString() + "n";
266
+ if (typeof value === "string")
267
+ return `"${value}"`;
268
+ return `${value}`;
269
+ }
270
+ function optionalKeys(shape) {
271
+ return Object.keys(shape).filter((k) => {
272
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
273
+ });
274
+ }
275
+ const NUMBER_FORMAT_RANGES = {
276
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
277
+ int32: [-2147483648, 2147483647],
278
+ uint32: [0, 4294967295],
279
+ float32: [-34028234663852886e22, 3.4028234663852886e38],
280
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE],
281
+ };
282
+ const BIGINT_FORMAT_RANGES = {
283
+ int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
284
+ uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")],
285
+ };
286
+ function pick(schema, mask) {
287
+ const newShape = {};
288
+ const currDef = schema._zod.def; //.shape;
289
+ for (const key in mask) {
290
+ if (!(key in currDef.shape)) {
291
+ throw new Error(`Unrecognized key: "${key}"`);
292
+ }
293
+ if (!mask[key])
294
+ continue;
295
+ // pick key
296
+ newShape[key] = currDef.shape[key];
297
+ }
298
+ return clone(schema, {
299
+ ...schema._zod.def,
300
+ shape: newShape,
301
+ checks: [],
302
+ });
303
+ }
304
+ function omit(schema, mask) {
305
+ const newShape = { ...schema._zod.def.shape };
306
+ const currDef = schema._zod.def; //.shape;
307
+ for (const key in mask) {
308
+ if (!(key in currDef.shape)) {
309
+ throw new Error(`Unrecognized key: "${key}"`);
310
+ }
311
+ if (!mask[key])
312
+ continue;
313
+ delete newShape[key];
314
+ }
315
+ return clone(schema, {
316
+ ...schema._zod.def,
317
+ shape: newShape,
318
+ checks: [],
319
+ });
320
+ }
321
+ function extend(schema, shape) {
322
+ if (!isPlainObject(shape)) {
323
+ throw new Error("Invalid input to extend: expected a plain object");
324
+ }
325
+ const def = {
326
+ ...schema._zod.def,
327
+ get shape() {
328
+ const _shape = { ...schema._zod.def.shape, ...shape };
329
+ assignProp(this, "shape", _shape); // self-caching
330
+ return _shape;
331
+ },
332
+ checks: [], // delete existing checks
333
+ };
334
+ return clone(schema, def);
335
+ }
336
+ function merge(a, b) {
337
+ return clone(a, {
338
+ ...a._zod.def,
339
+ get shape() {
340
+ const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
341
+ assignProp(this, "shape", _shape); // self-caching
342
+ return _shape;
343
+ },
344
+ catchall: b._zod.def.catchall,
345
+ checks: [], // delete existing checks
346
+ });
347
+ }
348
+ function partial(Class, schema, mask) {
349
+ const oldShape = schema._zod.def.shape;
350
+ const shape = { ...oldShape };
351
+ if (mask) {
352
+ for (const key in mask) {
353
+ if (!(key in oldShape)) {
354
+ throw new Error(`Unrecognized key: "${key}"`);
355
+ }
356
+ if (!mask[key])
357
+ continue;
358
+ // if (oldShape[key]!._zod.optin === "optional") continue;
359
+ shape[key] = Class
360
+ ? new Class({
361
+ type: "optional",
362
+ innerType: oldShape[key],
363
+ })
364
+ : oldShape[key];
365
+ }
366
+ }
367
+ else {
368
+ for (const key in oldShape) {
369
+ // if (oldShape[key]!._zod.optin === "optional") continue;
370
+ shape[key] = Class
371
+ ? new Class({
372
+ type: "optional",
373
+ innerType: oldShape[key],
374
+ })
375
+ : oldShape[key];
376
+ }
377
+ }
378
+ return clone(schema, {
379
+ ...schema._zod.def,
380
+ shape,
381
+ checks: [],
382
+ });
383
+ }
384
+ function required(Class, schema, mask) {
385
+ const oldShape = schema._zod.def.shape;
386
+ const shape = { ...oldShape };
387
+ if (mask) {
388
+ for (const key in mask) {
389
+ if (!(key in shape)) {
390
+ throw new Error(`Unrecognized key: "${key}"`);
391
+ }
392
+ if (!mask[key])
393
+ continue;
394
+ // overwrite with non-optional
395
+ shape[key] = new Class({
396
+ type: "nonoptional",
397
+ innerType: oldShape[key],
398
+ });
399
+ }
400
+ }
401
+ else {
402
+ for (const key in oldShape) {
403
+ // overwrite with non-optional
404
+ shape[key] = new Class({
405
+ type: "nonoptional",
406
+ innerType: oldShape[key],
407
+ });
408
+ }
409
+ }
410
+ return clone(schema, {
411
+ ...schema._zod.def,
412
+ shape,
413
+ // optional: [],
414
+ checks: [],
415
+ });
416
+ }
417
+ function aborted(x, startIndex = 0) {
418
+ for (let i = startIndex; i < x.issues.length; i++) {
419
+ if (x.issues[i]?.continue !== true)
420
+ return true;
421
+ }
422
+ return false;
423
+ }
424
+ function prefixIssues(path, issues) {
425
+ return issues.map((iss) => {
426
+ var _a;
427
+ (_a = iss).path ?? (_a.path = []);
428
+ iss.path.unshift(path);
429
+ return iss;
430
+ });
431
+ }
432
+ function unwrapMessage(message) {
433
+ return typeof message === "string" ? message : message?.message;
434
+ }
435
+ function finalizeIssue(iss, ctx, config) {
436
+ const full = { ...iss, path: iss.path ?? [] };
437
+ // for backwards compatibility
438
+ if (!iss.message) {
439
+ const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ??
440
+ unwrapMessage(ctx?.error?.(iss)) ??
441
+ unwrapMessage(config.customError?.(iss)) ??
442
+ unwrapMessage(config.localeError?.(iss)) ??
443
+ "Invalid input";
444
+ full.message = message;
445
+ }
446
+ // delete (full as any).def;
447
+ delete full.inst;
448
+ delete full.continue;
449
+ if (!ctx?.reportInput) {
450
+ delete full.input;
451
+ }
452
+ return full;
453
+ }
454
+ function getSizableOrigin(input) {
455
+ if (input instanceof Set)
456
+ return "set";
457
+ if (input instanceof Map)
458
+ return "map";
459
+ if (input instanceof File)
460
+ return "file";
461
+ return "unknown";
462
+ }
463
+ function getLengthableOrigin(input) {
464
+ if (Array.isArray(input))
465
+ return "array";
466
+ if (typeof input === "string")
467
+ return "string";
468
+ return "unknown";
469
+ }
470
+ function issue(...args) {
471
+ const [iss, input, inst] = args;
472
+ if (typeof iss === "string") {
473
+ return {
474
+ message: iss,
475
+ code: "custom",
476
+ input,
477
+ inst,
478
+ };
479
+ }
480
+ return { ...iss };
481
+ }
482
+ function cleanEnum(obj) {
483
+ return Object.entries(obj)
484
+ .filter(([k, _]) => {
485
+ // return true if NaN, meaning it's not a number, thus a string key
486
+ return Number.isNaN(Number.parseInt(k, 10));
487
+ })
488
+ .map((el) => el[1]);
489
+ }
490
+ // instanceof
491
+ class Class {
492
+ constructor(..._args) { }
493
+ }
494
+
495
+ exports.BIGINT_FORMAT_RANGES = BIGINT_FORMAT_RANGES;
496
+ exports.Class = Class;
497
+ exports.NUMBER_FORMAT_RANGES = NUMBER_FORMAT_RANGES;
498
+ exports.aborted = aborted;
499
+ exports.allowsEval = allowsEval;
500
+ exports.assert = assert;
501
+ exports.assertEqual = assertEqual;
502
+ exports.assertIs = assertIs;
503
+ exports.assertNever = assertNever;
504
+ exports.assertNotEqual = assertNotEqual;
505
+ exports.assignProp = assignProp;
506
+ exports.cached = cached;
507
+ exports.captureStackTrace = captureStackTrace;
508
+ exports.cleanEnum = cleanEnum;
509
+ exports.cleanRegex = cleanRegex;
510
+ exports.clone = clone;
511
+ exports.createTransparentProxy = createTransparentProxy;
512
+ exports.defineLazy = defineLazy;
513
+ exports.esc = esc;
514
+ exports.escapeRegex = escapeRegex;
515
+ exports.extend = extend;
516
+ exports.finalizeIssue = finalizeIssue;
517
+ exports.floatSafeRemainder = floatSafeRemainder;
518
+ exports.getElementAtPath = getElementAtPath;
519
+ exports.getEnumValues = getEnumValues;
520
+ exports.getLengthableOrigin = getLengthableOrigin;
521
+ exports.getParsedType = getParsedType;
522
+ exports.getSizableOrigin = getSizableOrigin;
523
+ exports.isObject = isObject;
524
+ exports.isPlainObject = isPlainObject;
525
+ exports.issue = issue;
526
+ exports.joinValues = joinValues;
527
+ exports.jsonStringifyReplacer = jsonStringifyReplacer;
528
+ exports.merge = merge;
529
+ exports.normalizeParams = normalizeParams;
530
+ exports.nullish = nullish;
531
+ exports.numKeys = numKeys;
532
+ exports.omit = omit;
533
+ exports.optionalKeys = optionalKeys;
534
+ exports.partial = partial;
535
+ exports.pick = pick;
536
+ exports.prefixIssues = prefixIssues;
537
+ exports.primitiveTypes = primitiveTypes;
538
+ exports.promiseAllObject = promiseAllObject;
539
+ exports.propertyKeyTypes = propertyKeyTypes;
540
+ exports.randomString = randomString;
541
+ exports.required = required;
542
+ exports.stringifyPrimitive = stringifyPrimitive;
543
+ exports.unwrapMessage = unwrapMessage;