@intlayer/ai 7.5.2-canary.2 → 7.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/cjs/auditDictionaryMetadata/index.cjs +7 -7
  2. package/dist/cjs/auditDictionaryMetadata/index.cjs.map +1 -1
  3. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.cjs +30 -0
  4. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.cjs.map +1 -0
  5. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.cjs +41 -0
  6. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.cjs.map +1 -0
  7. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/parse.cjs +31 -0
  8. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/parse.cjs.map +1 -0
  9. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.cjs +577 -0
  10. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.cjs.map +1 -0
  11. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/api.cjs +535 -0
  12. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/api.cjs.map +1 -0
  13. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/checks.cjs +376 -0
  14. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/checks.cjs.map +1 -0
  15. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/core.cjs +67 -0
  16. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/core.cjs.map +1 -0
  17. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/doc.cjs +35 -0
  18. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/doc.cjs.map +1 -0
  19. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/errors.cjs +66 -0
  20. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/errors.cjs.map +1 -0
  21. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/json-schema-processors.cjs +239 -0
  22. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/json-schema-processors.cjs.map +1 -0
  23. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/parse.cjs +123 -0
  24. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/parse.cjs.map +1 -0
  25. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/regexes.cjs +88 -0
  26. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/regexes.cjs.map +1 -0
  27. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/registries.cjs +54 -0
  28. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/registries.cjs.map +1 -0
  29. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/schemas.cjs +1048 -0
  30. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/schemas.cjs.map +1 -0
  31. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/to-json-schema.cjs +263 -0
  32. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/to-json-schema.cjs.map +1 -0
  33. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/util.cjs +350 -0
  34. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/util.cjs.map +1 -0
  35. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/versions.cjs +11 -0
  36. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/versions.cjs.map +1 -0
  37. package/dist/cjs/translateJSON/index.cjs +10 -10
  38. package/dist/cjs/translateJSON/index.cjs.map +1 -1
  39. package/dist/esm/auditDictionaryMetadata/index.mjs +7 -7
  40. package/dist/esm/auditDictionaryMetadata/index.mjs.map +1 -1
  41. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.mjs +30 -0
  42. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.mjs.map +1 -0
  43. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.mjs +38 -0
  44. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.mjs.map +1 -0
  45. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/parse.mjs +20 -0
  46. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/parse.mjs.map +1 -0
  47. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.mjs +571 -0
  48. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.mjs.map +1 -0
  49. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/api.mjs +478 -0
  50. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/api.mjs.map +1 -0
  51. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/checks.mjs +361 -0
  52. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/checks.mjs.map +1 -0
  53. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/core.mjs +62 -0
  54. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/core.mjs.map +1 -0
  55. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/doc.mjs +34 -0
  56. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/doc.mjs.map +1 -0
  57. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/errors.mjs +63 -0
  58. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/errors.mjs.map +1 -0
  59. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/json-schema-processors.mjs +219 -0
  60. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/json-schema-processors.mjs.map +1 -0
  61. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/parse.mjs +110 -0
  62. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/parse.mjs.map +1 -0
  63. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/regexes.mjs +61 -0
  64. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/regexes.mjs.map +1 -0
  65. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/registries.mjs +53 -0
  66. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/registries.mjs.map +1 -0
  67. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/schemas.mjs +1002 -0
  68. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/schemas.mjs.map +1 -0
  69. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/to-json-schema.mjs +261 -0
  70. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/to-json-schema.mjs.map +1 -0
  71. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/util.mjs +317 -0
  72. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/util.mjs.map +1 -0
  73. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/versions.mjs +10 -0
  74. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/versions.mjs.map +1 -0
  75. package/dist/esm/translateJSON/index.mjs +10 -10
  76. package/dist/esm/translateJSON/index.mjs.map +1 -1
  77. package/dist/types/translateJSON/index.d.ts +2 -2
  78. package/dist/types/translateJSON/index.d.ts.map +1 -1
  79. package/package.json +6 -7
  80. package/dist/assets/auditDictionaryMetadata/PROMPT copy 2.md +0 -73
  81. package/dist/assets/auditDictionaryMetadata/PROMPT copy.md +0 -73
@@ -0,0 +1,350 @@
1
+
2
+ //#region ../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/util.js
3
+ function getEnumValues(entries) {
4
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
5
+ return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
6
+ }
7
+ function jsonStringifyReplacer(_, value) {
8
+ if (typeof value === "bigint") return value.toString();
9
+ return value;
10
+ }
11
+ function cached(getter) {
12
+ return { get value() {
13
+ {
14
+ const value = getter();
15
+ Object.defineProperty(this, "value", { value });
16
+ return value;
17
+ }
18
+ throw new Error("cached value already set");
19
+ } };
20
+ }
21
+ function nullish(input) {
22
+ return input === null || input === void 0;
23
+ }
24
+ function cleanRegex(source) {
25
+ const start = source.startsWith("^") ? 1 : 0;
26
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
27
+ return source.slice(start, end);
28
+ }
29
+ function floatSafeRemainder(val, step) {
30
+ const valDecCount = (val.toString().split(".")[1] || "").length;
31
+ const stepString = step.toString();
32
+ let stepDecCount = (stepString.split(".")[1] || "").length;
33
+ if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
34
+ const match = stepString.match(/\d?e-(\d?)/);
35
+ if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
36
+ }
37
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
38
+ return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
39
+ }
40
+ const EVALUATING = Symbol("evaluating");
41
+ function defineLazy(object, key, getter) {
42
+ let value = void 0;
43
+ Object.defineProperty(object, key, {
44
+ get() {
45
+ if (value === EVALUATING) return;
46
+ if (value === void 0) {
47
+ value = EVALUATING;
48
+ value = getter();
49
+ }
50
+ return value;
51
+ },
52
+ set(v) {
53
+ Object.defineProperty(object, key, { value: v });
54
+ },
55
+ configurable: true
56
+ });
57
+ }
58
+ function assignProp(target, prop, value) {
59
+ Object.defineProperty(target, prop, {
60
+ value,
61
+ writable: true,
62
+ enumerable: true,
63
+ configurable: true
64
+ });
65
+ }
66
+ function mergeDefs(...defs) {
67
+ const mergedDescriptors = {};
68
+ for (const def of defs) {
69
+ const descriptors = Object.getOwnPropertyDescriptors(def);
70
+ Object.assign(mergedDescriptors, descriptors);
71
+ }
72
+ return Object.defineProperties({}, mergedDescriptors);
73
+ }
74
+ function esc(str) {
75
+ return JSON.stringify(str);
76
+ }
77
+ function slugify(input) {
78
+ return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
79
+ }
80
+ const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
81
+ function isObject(data) {
82
+ return typeof data === "object" && data !== null && !Array.isArray(data);
83
+ }
84
+ const allowsEval = cached(() => {
85
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
86
+ try {
87
+ new Function("");
88
+ return true;
89
+ } catch (_) {
90
+ return false;
91
+ }
92
+ });
93
+ function isPlainObject(o) {
94
+ if (isObject(o) === false) return false;
95
+ const ctor = o.constructor;
96
+ if (ctor === void 0) return true;
97
+ if (typeof ctor !== "function") return true;
98
+ const prot = ctor.prototype;
99
+ if (isObject(prot) === false) return false;
100
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
101
+ return true;
102
+ }
103
+ function shallowClone(o) {
104
+ if (isPlainObject(o)) return { ...o };
105
+ if (Array.isArray(o)) return [...o];
106
+ return o;
107
+ }
108
+ const propertyKeyTypes = new Set([
109
+ "string",
110
+ "number",
111
+ "symbol"
112
+ ]);
113
+ function escapeRegex(str) {
114
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
115
+ }
116
+ function clone(inst, def, params) {
117
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
118
+ if (!def || params?.parent) cl._zod.parent = inst;
119
+ return cl;
120
+ }
121
+ function normalizeParams(_params) {
122
+ const params = _params;
123
+ if (!params) return {};
124
+ if (typeof params === "string") return { error: () => params };
125
+ if (params?.message !== void 0) {
126
+ if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
127
+ params.error = params.message;
128
+ }
129
+ delete params.message;
130
+ if (typeof params.error === "string") return {
131
+ ...params,
132
+ error: () => params.error
133
+ };
134
+ return params;
135
+ }
136
+ function optionalKeys(shape) {
137
+ return Object.keys(shape).filter((k) => {
138
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
139
+ });
140
+ }
141
+ const NUMBER_FORMAT_RANGES = {
142
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
143
+ int32: [-2147483648, 2147483647],
144
+ uint32: [0, 4294967295],
145
+ float32: [-34028234663852886e22, 34028234663852886e22],
146
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
147
+ };
148
+ function pick(schema, mask) {
149
+ const currDef = schema._zod.def;
150
+ return clone(schema, mergeDefs(schema._zod.def, {
151
+ get shape() {
152
+ const newShape = {};
153
+ for (const key in mask) {
154
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
155
+ if (!mask[key]) continue;
156
+ newShape[key] = currDef.shape[key];
157
+ }
158
+ assignProp(this, "shape", newShape);
159
+ return newShape;
160
+ },
161
+ checks: []
162
+ }));
163
+ }
164
+ function omit(schema, mask) {
165
+ const currDef = schema._zod.def;
166
+ return clone(schema, mergeDefs(schema._zod.def, {
167
+ get shape() {
168
+ const newShape = { ...schema._zod.def.shape };
169
+ for (const key in mask) {
170
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
171
+ if (!mask[key]) continue;
172
+ delete newShape[key];
173
+ }
174
+ assignProp(this, "shape", newShape);
175
+ return newShape;
176
+ },
177
+ checks: []
178
+ }));
179
+ }
180
+ function extend(schema, shape) {
181
+ if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
182
+ const checks = schema._zod.def.checks;
183
+ if (checks && checks.length > 0) throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
184
+ return clone(schema, mergeDefs(schema._zod.def, {
185
+ get shape() {
186
+ const _shape = {
187
+ ...schema._zod.def.shape,
188
+ ...shape
189
+ };
190
+ assignProp(this, "shape", _shape);
191
+ return _shape;
192
+ },
193
+ checks: []
194
+ }));
195
+ }
196
+ function safeExtend(schema, shape) {
197
+ if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
198
+ return clone(schema, {
199
+ ...schema._zod.def,
200
+ get shape() {
201
+ const _shape = {
202
+ ...schema._zod.def.shape,
203
+ ...shape
204
+ };
205
+ assignProp(this, "shape", _shape);
206
+ return _shape;
207
+ },
208
+ checks: schema._zod.def.checks
209
+ });
210
+ }
211
+ function merge(a, b) {
212
+ return clone(a, mergeDefs(a._zod.def, {
213
+ get shape() {
214
+ const _shape = {
215
+ ...a._zod.def.shape,
216
+ ...b._zod.def.shape
217
+ };
218
+ assignProp(this, "shape", _shape);
219
+ return _shape;
220
+ },
221
+ get catchall() {
222
+ return b._zod.def.catchall;
223
+ },
224
+ checks: []
225
+ }));
226
+ }
227
+ function partial(Class, schema, mask) {
228
+ return clone(schema, mergeDefs(schema._zod.def, {
229
+ get shape() {
230
+ const oldShape = schema._zod.def.shape;
231
+ const shape = { ...oldShape };
232
+ if (mask) for (const key in mask) {
233
+ if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
234
+ if (!mask[key]) continue;
235
+ shape[key] = Class ? new Class({
236
+ type: "optional",
237
+ innerType: oldShape[key]
238
+ }) : oldShape[key];
239
+ }
240
+ else for (const key in oldShape) shape[key] = Class ? new Class({
241
+ type: "optional",
242
+ innerType: oldShape[key]
243
+ }) : oldShape[key];
244
+ assignProp(this, "shape", shape);
245
+ return shape;
246
+ },
247
+ checks: []
248
+ }));
249
+ }
250
+ function required(Class, schema, mask) {
251
+ return clone(schema, mergeDefs(schema._zod.def, {
252
+ get shape() {
253
+ const oldShape = schema._zod.def.shape;
254
+ const shape = { ...oldShape };
255
+ if (mask) for (const key in mask) {
256
+ if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
257
+ if (!mask[key]) continue;
258
+ shape[key] = new Class({
259
+ type: "nonoptional",
260
+ innerType: oldShape[key]
261
+ });
262
+ }
263
+ else for (const key in oldShape) shape[key] = new Class({
264
+ type: "nonoptional",
265
+ innerType: oldShape[key]
266
+ });
267
+ assignProp(this, "shape", shape);
268
+ return shape;
269
+ },
270
+ checks: []
271
+ }));
272
+ }
273
+ function aborted(x, startIndex = 0) {
274
+ if (x.aborted === true) return true;
275
+ for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
276
+ return false;
277
+ }
278
+ function prefixIssues(path, issues) {
279
+ return issues.map((iss) => {
280
+ var _a;
281
+ (_a = iss).path ?? (_a.path = []);
282
+ iss.path.unshift(path);
283
+ return iss;
284
+ });
285
+ }
286
+ function unwrapMessage(message) {
287
+ return typeof message === "string" ? message : message?.message;
288
+ }
289
+ function finalizeIssue(iss, ctx, config) {
290
+ const full = {
291
+ ...iss,
292
+ path: iss.path ?? []
293
+ };
294
+ if (!iss.message) full.message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
295
+ delete full.inst;
296
+ delete full.continue;
297
+ if (!ctx?.reportInput) delete full.input;
298
+ return full;
299
+ }
300
+ function getLengthableOrigin(input) {
301
+ if (Array.isArray(input)) return "array";
302
+ if (typeof input === "string") return "string";
303
+ return "unknown";
304
+ }
305
+ function issue(...args) {
306
+ const [iss, input, inst] = args;
307
+ if (typeof iss === "string") return {
308
+ message: iss,
309
+ code: "custom",
310
+ input,
311
+ inst
312
+ };
313
+ return { ...iss };
314
+ }
315
+
316
+ //#endregion
317
+ exports.NUMBER_FORMAT_RANGES = NUMBER_FORMAT_RANGES;
318
+ exports.aborted = aborted;
319
+ exports.allowsEval = allowsEval;
320
+ exports.cached = cached;
321
+ exports.captureStackTrace = captureStackTrace;
322
+ exports.cleanRegex = cleanRegex;
323
+ exports.clone = clone;
324
+ exports.defineLazy = defineLazy;
325
+ exports.esc = esc;
326
+ exports.escapeRegex = escapeRegex;
327
+ exports.extend = extend;
328
+ exports.finalizeIssue = finalizeIssue;
329
+ exports.floatSafeRemainder = floatSafeRemainder;
330
+ exports.getEnumValues = getEnumValues;
331
+ exports.getLengthableOrigin = getLengthableOrigin;
332
+ exports.isObject = isObject;
333
+ exports.isPlainObject = isPlainObject;
334
+ exports.issue = issue;
335
+ exports.jsonStringifyReplacer = jsonStringifyReplacer;
336
+ exports.merge = merge;
337
+ exports.mergeDefs = mergeDefs;
338
+ exports.normalizeParams = normalizeParams;
339
+ exports.nullish = nullish;
340
+ exports.omit = omit;
341
+ exports.optionalKeys = optionalKeys;
342
+ exports.partial = partial;
343
+ exports.pick = pick;
344
+ exports.prefixIssues = prefixIssues;
345
+ exports.propertyKeyTypes = propertyKeyTypes;
346
+ exports.required = required;
347
+ exports.safeExtend = safeExtend;
348
+ exports.shallowClone = shallowClone;
349
+ exports.slugify = slugify;
350
+ //# sourceMappingURL=util.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.cjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/util.js"],"sourcesContent":["// functions\nexport function assertEqual(val) {\n return val;\n}\nexport function assertNotEqual(val) {\n return val;\n}\nexport function assertIs(_arg) { }\nexport function assertNever(_x) {\n throw new Error(\"Unexpected value in exhaustive check\");\n}\nexport function assert(_) { }\nexport function getEnumValues(entries) {\n const numericValues = Object.values(entries).filter((v) => typeof v === \"number\");\n const values = Object.entries(entries)\n .filter(([k, _]) => numericValues.indexOf(+k) === -1)\n .map(([_, v]) => v);\n return values;\n}\nexport function joinValues(array, separator = \"|\") {\n return array.map((val) => stringifyPrimitive(val)).join(separator);\n}\nexport function jsonStringifyReplacer(_, value) {\n if (typeof value === \"bigint\")\n return value.toString();\n return value;\n}\nexport function cached(getter) {\n const set = false;\n return {\n get value() {\n if (!set) {\n const value = getter();\n Object.defineProperty(this, \"value\", { value });\n return value;\n }\n throw new Error(\"cached value already set\");\n },\n };\n}\nexport function nullish(input) {\n return input === null || input === undefined;\n}\nexport function cleanRegex(source) {\n const start = source.startsWith(\"^\") ? 1 : 0;\n const end = source.endsWith(\"$\") ? source.length - 1 : source.length;\n return source.slice(start, end);\n}\nexport function floatSafeRemainder(val, step) {\n const valDecCount = (val.toString().split(\".\")[1] || \"\").length;\n const stepString = step.toString();\n let stepDecCount = (stepString.split(\".\")[1] || \"\").length;\n if (stepDecCount === 0 && /\\d?e-\\d?/.test(stepString)) {\n const match = stepString.match(/\\d?e-(\\d?)/);\n if (match?.[1]) {\n stepDecCount = Number.parseInt(match[1]);\n }\n }\n const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n const valInt = Number.parseInt(val.toFixed(decCount).replace(\".\", \"\"));\n const stepInt = Number.parseInt(step.toFixed(decCount).replace(\".\", \"\"));\n return (valInt % stepInt) / 10 ** decCount;\n}\nconst EVALUATING = Symbol(\"evaluating\");\nexport function defineLazy(object, key, getter) {\n let value = undefined;\n Object.defineProperty(object, key, {\n get() {\n if (value === EVALUATING) {\n // Circular reference detected, return undefined to break the cycle\n return undefined;\n }\n if (value === undefined) {\n value = EVALUATING;\n value = getter();\n }\n return value;\n },\n set(v) {\n Object.defineProperty(object, key, {\n value: v,\n // configurable: true,\n });\n // object[key] = v;\n },\n configurable: true,\n });\n}\nexport function objectClone(obj) {\n return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));\n}\nexport function assignProp(target, prop, value) {\n Object.defineProperty(target, prop, {\n value,\n writable: true,\n enumerable: true,\n configurable: true,\n });\n}\nexport function mergeDefs(...defs) {\n const mergedDescriptors = {};\n for (const def of defs) {\n const descriptors = Object.getOwnPropertyDescriptors(def);\n Object.assign(mergedDescriptors, descriptors);\n }\n return Object.defineProperties({}, mergedDescriptors);\n}\nexport function cloneDef(schema) {\n return mergeDefs(schema._zod.def);\n}\nexport function getElementAtPath(obj, path) {\n if (!path)\n return obj;\n return path.reduce((acc, key) => acc?.[key], obj);\n}\nexport function promiseAllObject(promisesObj) {\n const keys = Object.keys(promisesObj);\n const promises = keys.map((key) => promisesObj[key]);\n return Promise.all(promises).then((results) => {\n const resolvedObj = {};\n for (let i = 0; i < keys.length; i++) {\n resolvedObj[keys[i]] = results[i];\n }\n return resolvedObj;\n });\n}\nexport function randomString(length = 10) {\n const chars = \"abcdefghijklmnopqrstuvwxyz\";\n let str = \"\";\n for (let i = 0; i < length; i++) {\n str += chars[Math.floor(Math.random() * chars.length)];\n }\n return str;\n}\nexport function esc(str) {\n return JSON.stringify(str);\n}\nexport function slugify(input) {\n return input\n .toLowerCase()\n .trim()\n .replace(/[^\\w\\s-]/g, \"\")\n .replace(/[\\s_-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\nexport const captureStackTrace = (\"captureStackTrace\" in Error ? Error.captureStackTrace : (..._args) => { });\nexport function isObject(data) {\n return typeof data === \"object\" && data !== null && !Array.isArray(data);\n}\nexport const allowsEval = cached(() => {\n // @ts-ignore\n if (typeof navigator !== \"undefined\" && navigator?.userAgent?.includes(\"Cloudflare\")) {\n return false;\n }\n try {\n const F = Function;\n new F(\"\");\n return true;\n }\n catch (_) {\n return false;\n }\n});\nexport function isPlainObject(o) {\n if (isObject(o) === false)\n return false;\n // modified constructor\n const ctor = o.constructor;\n if (ctor === undefined)\n return true;\n if (typeof ctor !== \"function\")\n return true;\n // modified prototype\n const prot = ctor.prototype;\n if (isObject(prot) === false)\n return false;\n // ctor doesn't have static `isPrototypeOf`\n if (Object.prototype.hasOwnProperty.call(prot, \"isPrototypeOf\") === false) {\n return false;\n }\n return true;\n}\nexport function shallowClone(o) {\n if (isPlainObject(o))\n return { ...o };\n if (Array.isArray(o))\n return [...o];\n return o;\n}\nexport function numKeys(data) {\n let keyCount = 0;\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n keyCount++;\n }\n }\n return keyCount;\n}\nexport const getParsedType = (data) => {\n const t = typeof data;\n switch (t) {\n case \"undefined\":\n return \"undefined\";\n case \"string\":\n return \"string\";\n case \"number\":\n return Number.isNaN(data) ? \"nan\" : \"number\";\n case \"boolean\":\n return \"boolean\";\n case \"function\":\n return \"function\";\n case \"bigint\":\n return \"bigint\";\n case \"symbol\":\n return \"symbol\";\n case \"object\":\n if (Array.isArray(data)) {\n return \"array\";\n }\n if (data === null) {\n return \"null\";\n }\n if (data.then && typeof data.then === \"function\" && data.catch && typeof data.catch === \"function\") {\n return \"promise\";\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return \"map\";\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return \"set\";\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return \"date\";\n }\n // @ts-ignore\n if (typeof File !== \"undefined\" && data instanceof File) {\n return \"file\";\n }\n return \"object\";\n default:\n throw new Error(`Unknown data type: ${t}`);\n }\n};\nexport const propertyKeyTypes = new Set([\"string\", \"number\", \"symbol\"]);\nexport const primitiveTypes = new Set([\"string\", \"number\", \"bigint\", \"boolean\", \"symbol\", \"undefined\"]);\nexport function escapeRegex(str) {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n// zod-specific utils\nexport function clone(inst, def, params) {\n const cl = new inst._zod.constr(def ?? inst._zod.def);\n if (!def || params?.parent)\n cl._zod.parent = inst;\n return cl;\n}\nexport function normalizeParams(_params) {\n const params = _params;\n if (!params)\n return {};\n if (typeof params === \"string\")\n return { error: () => params };\n if (params?.message !== undefined) {\n if (params?.error !== undefined)\n throw new Error(\"Cannot specify both `message` and `error` params\");\n params.error = params.message;\n }\n delete params.message;\n if (typeof params.error === \"string\")\n return { ...params, error: () => params.error };\n return params;\n}\nexport function createTransparentProxy(getter) {\n let target;\n return new Proxy({}, {\n get(_, prop, receiver) {\n target ?? (target = getter());\n return Reflect.get(target, prop, receiver);\n },\n set(_, prop, value, receiver) {\n target ?? (target = getter());\n return Reflect.set(target, prop, value, receiver);\n },\n has(_, prop) {\n target ?? (target = getter());\n return Reflect.has(target, prop);\n },\n deleteProperty(_, prop) {\n target ?? (target = getter());\n return Reflect.deleteProperty(target, prop);\n },\n ownKeys(_) {\n target ?? (target = getter());\n return Reflect.ownKeys(target);\n },\n getOwnPropertyDescriptor(_, prop) {\n target ?? (target = getter());\n return Reflect.getOwnPropertyDescriptor(target, prop);\n },\n defineProperty(_, prop, descriptor) {\n target ?? (target = getter());\n return Reflect.defineProperty(target, prop, descriptor);\n },\n });\n}\nexport function stringifyPrimitive(value) {\n if (typeof value === \"bigint\")\n return value.toString() + \"n\";\n if (typeof value === \"string\")\n return `\"${value}\"`;\n return `${value}`;\n}\nexport function optionalKeys(shape) {\n return Object.keys(shape).filter((k) => {\n return shape[k]._zod.optin === \"optional\" && shape[k]._zod.optout === \"optional\";\n });\n}\nexport const NUMBER_FORMAT_RANGES = {\n safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],\n int32: [-2147483648, 2147483647],\n uint32: [0, 4294967295],\n float32: [-3.4028234663852886e38, 3.4028234663852886e38],\n float64: [-Number.MAX_VALUE, Number.MAX_VALUE],\n};\nexport const BIGINT_FORMAT_RANGES = {\n int64: [/* @__PURE__*/ BigInt(\"-9223372036854775808\"), /* @__PURE__*/ BigInt(\"9223372036854775807\")],\n uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt(\"18446744073709551615\")],\n};\nexport function pick(schema, mask) {\n const currDef = schema._zod.def;\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const newShape = {};\n for (const key in mask) {\n if (!(key in currDef.shape)) {\n throw new Error(`Unrecognized key: \"${key}\"`);\n }\n if (!mask[key])\n continue;\n newShape[key] = currDef.shape[key];\n }\n assignProp(this, \"shape\", newShape); // self-caching\n return newShape;\n },\n checks: [],\n });\n return clone(schema, def);\n}\nexport function omit(schema, mask) {\n const currDef = schema._zod.def;\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const newShape = { ...schema._zod.def.shape };\n for (const key in mask) {\n if (!(key in currDef.shape)) {\n throw new Error(`Unrecognized key: \"${key}\"`);\n }\n if (!mask[key])\n continue;\n delete newShape[key];\n }\n assignProp(this, \"shape\", newShape); // self-caching\n return newShape;\n },\n checks: [],\n });\n return clone(schema, def);\n}\nexport function extend(schema, shape) {\n if (!isPlainObject(shape)) {\n throw new Error(\"Invalid input to extend: expected a plain object\");\n }\n const checks = schema._zod.def.checks;\n const hasChecks = checks && checks.length > 0;\n if (hasChecks) {\n throw new Error(\"Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.\");\n }\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const _shape = { ...schema._zod.def.shape, ...shape };\n assignProp(this, \"shape\", _shape); // self-caching\n return _shape;\n },\n checks: [],\n });\n return clone(schema, def);\n}\nexport function safeExtend(schema, shape) {\n if (!isPlainObject(shape)) {\n throw new Error(\"Invalid input to safeExtend: expected a plain object\");\n }\n const def = {\n ...schema._zod.def,\n get shape() {\n const _shape = { ...schema._zod.def.shape, ...shape };\n assignProp(this, \"shape\", _shape); // self-caching\n return _shape;\n },\n checks: schema._zod.def.checks,\n };\n return clone(schema, def);\n}\nexport function merge(a, b) {\n const def = mergeDefs(a._zod.def, {\n get shape() {\n const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };\n assignProp(this, \"shape\", _shape); // self-caching\n return _shape;\n },\n get catchall() {\n return b._zod.def.catchall;\n },\n checks: [], // delete existing checks\n });\n return clone(a, def);\n}\nexport function partial(Class, schema, mask) {\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const oldShape = schema._zod.def.shape;\n const shape = { ...oldShape };\n if (mask) {\n for (const key in mask) {\n if (!(key in oldShape)) {\n throw new Error(`Unrecognized key: \"${key}\"`);\n }\n if (!mask[key])\n continue;\n // if (oldShape[key]!._zod.optin === \"optional\") continue;\n shape[key] = Class\n ? new Class({\n type: \"optional\",\n innerType: oldShape[key],\n })\n : oldShape[key];\n }\n }\n else {\n for (const key in oldShape) {\n // if (oldShape[key]!._zod.optin === \"optional\") continue;\n shape[key] = Class\n ? new Class({\n type: \"optional\",\n innerType: oldShape[key],\n })\n : oldShape[key];\n }\n }\n assignProp(this, \"shape\", shape); // self-caching\n return shape;\n },\n checks: [],\n });\n return clone(schema, def);\n}\nexport function required(Class, schema, mask) {\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const oldShape = schema._zod.def.shape;\n const shape = { ...oldShape };\n if (mask) {\n for (const key in mask) {\n if (!(key in shape)) {\n throw new Error(`Unrecognized key: \"${key}\"`);\n }\n if (!mask[key])\n continue;\n // overwrite with non-optional\n shape[key] = new Class({\n type: \"nonoptional\",\n innerType: oldShape[key],\n });\n }\n }\n else {\n for (const key in oldShape) {\n // overwrite with non-optional\n shape[key] = new Class({\n type: \"nonoptional\",\n innerType: oldShape[key],\n });\n }\n }\n assignProp(this, \"shape\", shape); // self-caching\n return shape;\n },\n checks: [],\n });\n return clone(schema, def);\n}\n// invalid_type | too_big | too_small | invalid_format | not_multiple_of | unrecognized_keys | invalid_union | invalid_key | invalid_element | invalid_value | custom\nexport function aborted(x, startIndex = 0) {\n if (x.aborted === true)\n return true;\n for (let i = startIndex; i < x.issues.length; i++) {\n if (x.issues[i]?.continue !== true) {\n return true;\n }\n }\n return false;\n}\nexport function prefixIssues(path, issues) {\n return issues.map((iss) => {\n var _a;\n (_a = iss).path ?? (_a.path = []);\n iss.path.unshift(path);\n return iss;\n });\n}\nexport function unwrapMessage(message) {\n return typeof message === \"string\" ? message : message?.message;\n}\nexport function finalizeIssue(iss, ctx, config) {\n const full = { ...iss, path: iss.path ?? [] };\n // for backwards compatibility\n if (!iss.message) {\n const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ??\n unwrapMessage(ctx?.error?.(iss)) ??\n unwrapMessage(config.customError?.(iss)) ??\n unwrapMessage(config.localeError?.(iss)) ??\n \"Invalid input\";\n full.message = message;\n }\n // delete (full as any).def;\n delete full.inst;\n delete full.continue;\n if (!ctx?.reportInput) {\n delete full.input;\n }\n return full;\n}\nexport function getSizableOrigin(input) {\n if (input instanceof Set)\n return \"set\";\n if (input instanceof Map)\n return \"map\";\n // @ts-ignore\n if (input instanceof File)\n return \"file\";\n return \"unknown\";\n}\nexport function getLengthableOrigin(input) {\n if (Array.isArray(input))\n return \"array\";\n if (typeof input === \"string\")\n return \"string\";\n return \"unknown\";\n}\nexport function issue(...args) {\n const [iss, input, inst] = args;\n if (typeof iss === \"string\") {\n return {\n message: iss,\n code: \"custom\",\n input,\n inst,\n };\n }\n return { ...iss };\n}\nexport function cleanEnum(obj) {\n return Object.entries(obj)\n .filter(([k, _]) => {\n // return true if NaN, meaning it's not a number, thus a string key\n return Number.isNaN(Number.parseInt(k, 10));\n })\n .map((el) => el[1]);\n}\n// Codec utility functions\nexport function base64ToUint8Array(base64) {\n const binaryString = atob(base64);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n return bytes;\n}\nexport function uint8ArrayToBase64(bytes) {\n let binaryString = \"\";\n for (let i = 0; i < bytes.length; i++) {\n binaryString += String.fromCharCode(bytes[i]);\n }\n return btoa(binaryString);\n}\nexport function base64urlToUint8Array(base64url) {\n const base64 = base64url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padding = \"=\".repeat((4 - (base64.length % 4)) % 4);\n return base64ToUint8Array(base64 + padding);\n}\nexport function uint8ArrayToBase64url(bytes) {\n return uint8ArrayToBase64(bytes).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=/g, \"\");\n}\nexport function hexToUint8Array(hex) {\n const cleanHex = hex.replace(/^0x/, \"\");\n if (cleanHex.length % 2 !== 0) {\n throw new Error(\"Invalid hex string length\");\n }\n const bytes = new Uint8Array(cleanHex.length / 2);\n for (let i = 0; i < cleanHex.length; i += 2) {\n bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);\n }\n return bytes;\n}\nexport function uint8ArrayToHex(bytes) {\n return Array.from(bytes)\n .map((b) => b.toString(16).padStart(2, \"0\"))\n .join(\"\");\n}\n// instanceof\nexport class Class {\n constructor(..._args) { }\n}\n"],"x_google_ignoreList":[0],"mappings":";;AAYA,SAAgB,cAAc,SAAS;CACnC,MAAM,gBAAgB,OAAO,OAAO,QAAQ,CAAC,QAAQ,MAAM,OAAO,MAAM,SAAS;AAIjF,QAHe,OAAO,QAAQ,QAAQ,CACjC,QAAQ,CAAC,GAAG,OAAO,cAAc,QAAQ,CAAC,EAAE,KAAK,GAAG,CACpD,KAAK,CAAC,GAAG,OAAO,EAAE;;AAM3B,SAAgB,sBAAsB,GAAG,OAAO;AAC5C,KAAI,OAAO,UAAU,SACjB,QAAO,MAAM,UAAU;AAC3B,QAAO;;AAEX,SAAgB,OAAO,QAAQ;AAE3B,QAAO,EACH,IAAI,QAAQ;EACE;GACN,MAAM,QAAQ,QAAQ;AACtB,UAAO,eAAe,MAAM,SAAS,EAAE,OAAO,CAAC;AAC/C,UAAO;;AAEX,QAAM,IAAI,MAAM,2BAA2B;IAElD;;AAEL,SAAgB,QAAQ,OAAO;AAC3B,QAAO,UAAU,QAAQ,UAAU;;AAEvC,SAAgB,WAAW,QAAQ;CAC/B,MAAM,QAA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AM;CAC3B,MAAM,CAAC,KAAK,OAAO,QAAQ;AAC3B,KAAI,OAAO,QAAQ,SACf,QAAO;EACH,SAAS;EACT,MAAM;EACN;EACA;EACH;AAEL,QAAO,EAAE,GAAG,KAAK"}
@@ -0,0 +1,11 @@
1
+
2
+ //#region ../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/versions.js
3
+ const version = {
4
+ major: 4,
5
+ minor: 2,
6
+ patch: 1
7
+ };
8
+
9
+ //#endregion
10
+ exports.version = version;
11
+ //# sourceMappingURL=versions.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versions.cjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/versions.js"],"sourcesContent":["export const version = {\n major: 4,\n minor: 2,\n patch: 1,\n};\n"],"x_google_ignoreList":[0],"mappings":";;AAAA,MAAa,UAAU;CACnB,OAAO;CACP,OAAO;CACP,OAAO;CACV"}
@@ -1,7 +1,7 @@
1
1
  const require_aiSdk = require('../aiSdk.cjs');
2
2
  const require__utils_asset = require('../_virtual/_utils_asset.cjs');
3
+ const require_schemas = require('../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.cjs');
3
4
  let ai = require("ai");
4
- let zod = require("zod");
5
5
  let _intlayer_core = require("@intlayer/core");
6
6
  let _intlayer_types = require("@intlayer/types");
7
7
 
@@ -35,19 +35,19 @@ const getModeInstructions = (mode) => {
35
35
  return "Mode: \"Review\" - Fill missing content and review existing keys from the preset content. If a key from the entry is missing in the output, it must be translated to the target language and added. If you detect misspelled content, or content that should be reformulated, correct it. If a translation is not coherent with the desired language, translate it.";
36
36
  };
37
37
  const jsonToZod = (content) => {
38
- if (typeof content === "string") return zod.z.string();
39
- if (typeof content === "number") return zod.z.number();
40
- if (typeof content === "boolean") return zod.z.boolean();
38
+ if (typeof content === "string") return require_schemas.string();
39
+ if (typeof content === "number") return require_schemas.number();
40
+ if (typeof content === "boolean") return require_schemas.boolean();
41
41
  if (Array.isArray(content)) {
42
- if (content.length === 0) return zod.z.array(zod.z.string());
43
- return zod.z.array(jsonToZod(content[0]));
42
+ if (content.length === 0) return require_schemas.array(require_schemas.string());
43
+ return require_schemas.array(jsonToZod(content[0]));
44
44
  }
45
45
  if (typeof content === "object" && content !== null) {
46
46
  const shape = {};
47
47
  for (const key in content) shape[key] = jsonToZod(content[key]);
48
- return zod.z.object(shape);
48
+ return require_schemas.object(shape);
49
49
  }
50
- return zod.z.any();
50
+ return require_schemas.any();
51
51
  };
52
52
  /**
53
53
  * TranslateJSONs a content declaration file by constructing a prompt for AI models.
@@ -59,7 +59,7 @@ const translateJSON = async ({ entryFileContent, presetOutputContent, dictionary
59
59
  const formattedEntryLocale = formatLocaleWithName(entryLocale);
60
60
  const formattedOutputLocale = formatLocaleWithName(outputLocale);
61
61
  const prompt = promptFile.replace("{{entryLocale}}", formattedEntryLocale).replace("{{outputLocale}}", formattedOutputLocale).replace("{{presetOutputContent}}", JSON.stringify(presetOutputContent)).replace("{{dictionaryDescription}}", dictionaryDescription ?? "").replace("{{applicationContext}}", applicationContext ?? "").replace("{{tagsInstructions}}", formatTagInstructions(tags ?? [])).replace("{{modeInstructions}}", getModeInstructions(mode));
62
- const { object, usage } = await (0, ai.generateObject)({
62
+ const { object: object$1, usage } = await (0, ai.generateObject)({
63
63
  ...aiConfig,
64
64
  schema: jsonToZod(entryFileContent),
65
65
  messages: [{
@@ -79,7 +79,7 @@ const translateJSON = async ({ entryFileContent, presetOutputContent, dictionary
79
79
  }]
80
80
  });
81
81
  return {
82
- fileContent: object,
82
+ fileContent: object$1,
83
83
  tokenUsed: usage?.totalTokens ?? 0
84
84
  };
85
85
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["aiDefaultOptions: AIOptions","AIProvider","Locales","z","shape: Record<string, z.ZodTypeAny>","readAsset"],"sources":["../../../src/translateJSON/index.ts"],"sourcesContent":["import { readAsset } from 'utils:asset';\nimport { getLocaleName } from '@intlayer/core';\nimport { type Locale, Locales } from '@intlayer/types';\nimport { generateObject } from 'ai';\nimport { z } from 'zod';\nimport { type AIConfig, type AIOptions, AIProvider } from '../aiSdk';\n\ntype Tag = {\n key: string;\n description?: string;\n};\n\nexport type TranslateJSONOptions<T> = {\n entryFileContent: T;\n presetOutputContent: Partial<T>;\n dictionaryDescription?: string;\n entryLocale: Locale;\n outputLocale: Locale;\n tags?: Tag[];\n aiConfig: AIConfig;\n mode: 'complete' | 'review';\n applicationContext?: string;\n};\n\nexport type TranslateJSONResultData<T> = {\n fileContent: T;\n tokenUsed: number;\n};\n\nexport const aiDefaultOptions: AIOptions = {\n provider: AIProvider.OPENAI,\n model: 'gpt-5-mini',\n};\n\n/**\n * Format a locale with its name.\n *\n * @param locale - The locale to format.\n * @returns A string in the format \"locale: name\", e.g. \"en: English\".\n */\nconst formatLocaleWithName = (locale: Locale): string =>\n `${locale}: ${getLocaleName(locale, Locales.ENGLISH)}`;\n\n/**\n * Formats tag instructions for the AI prompt.\n * Creates a string with all available tags and their descriptions.\n *\n * @param tags - The list of tags to format.\n * @returns A formatted string with tag instructions.\n */\nconst formatTagInstructions = (tags: Tag[]): string => {\n if (!tags || tags.length === 0) {\n return '';\n }\n\n // Prepare the tag instructions.\n return `Based on the dictionary content, identify specific tags from the list below that would be relevant:\n \n${tags.map(({ key, description }) => `- ${key}: ${description}`).join('\\n\\n')}`;\n};\n\nconst getModeInstructions = (mode: 'complete' | 'review'): string => {\n if (mode === 'complete') {\n return 'Mode: \"Complete\" - Enrich the preset content with the missing keys and values in the output locale. Do not update existing keys. Everything should be returned in the output.';\n }\n\n return 'Mode: \"Review\" - Fill missing content and review existing keys from the preset content. If a key from the entry is missing in the output, it must be translated to the target language and added. If you detect misspelled content, or content that should be reformulated, correct it. If a translation is not coherent with the desired language, translate it.';\n};\n\nconst jsonToZod = (content: any): z.ZodTypeAny => {\n // Base case: content is a string (the translation target)\n if (typeof content === 'string') {\n return z.string();\n }\n\n // Base cases: primitives often preserved in i18n files (e.g. strict numbers/booleans)\n if (typeof content === 'number') {\n return z.number();\n }\n if (typeof content === 'boolean') {\n return z.boolean();\n }\n\n // Recursive case: Array\n if (Array.isArray(content)) {\n // If array is empty, we assume array of strings as default for i18n\n if (content.length === 0) {\n return z.array(z.string());\n }\n // We assume all items in the array share the structure of the first item\n return z.array(jsonToZod(content[0]));\n }\n\n // Recursive case: Object\n if (typeof content === 'object' && content !== null) {\n const shape: Record<string, z.ZodTypeAny> = {};\n for (const key in content) {\n shape[key] = jsonToZod(content[key]);\n }\n return z.object(shape);\n }\n\n // Fallback\n return z.any();\n};\n\n/**\n * TranslateJSONs a content declaration file by constructing a prompt for AI models.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies.\n */\nexport const translateJSON = async <T>({\n entryFileContent,\n presetOutputContent,\n dictionaryDescription,\n aiConfig,\n entryLocale,\n outputLocale,\n tags,\n mode,\n applicationContext,\n}: TranslateJSONOptions<T>): Promise<\n TranslateJSONResultData<T> | undefined\n> => {\n const promptFile = readAsset('./PROMPT.md');\n\n const formattedEntryLocale = formatLocaleWithName(entryLocale);\n const formattedOutputLocale = formatLocaleWithName(outputLocale);\n\n // Prepare the prompt for AI by replacing placeholders with actual values.\n const prompt = promptFile\n .replace('{{entryLocale}}', formattedEntryLocale)\n .replace('{{outputLocale}}', formattedOutputLocale)\n .replace('{{presetOutputContent}}', JSON.stringify(presetOutputContent))\n .replace('{{dictionaryDescription}}', dictionaryDescription ?? '')\n .replace('{{applicationContext}}', applicationContext ?? '')\n .replace('{{tagsInstructions}}', formatTagInstructions(tags ?? []))\n .replace('{{modeInstructions}}', getModeInstructions(mode));\n\n // Use the AI SDK to generate the completion\n const { object, usage } = await generateObject({\n ...aiConfig,\n schema: jsonToZod(entryFileContent),\n messages: [\n { role: 'system', content: prompt },\n {\n role: 'user',\n // KEY CHANGE: Explicitly repeating instructions in the user message\n content: [\n `# Translation Request`,\n `Please translate the following JSON content.`,\n `- **From:** ${formattedEntryLocale}`,\n `- **To:** ${formattedOutputLocale}`,\n ``,\n `## Entry Content:`,\n JSON.stringify(entryFileContent),\n ].join('\\n'),\n },\n ],\n });\n\n return {\n fileContent: object as T,\n tokenUsed: usage?.totalTokens ?? 0,\n };\n};\n"],"mappings":";;;;;;;;AA6BA,MAAaA,mBAA8B;CACzC,UAAUC,yBAAW;CACrB,OAAO;CACR;;;;;;;AAQD,MAAM,wBAAwB,WAC5B,GAAG,OAAO,sCAAkB,QAAQC,wBAAQ,QAAQ;;;;;;;;AAStD,MAAM,yBAAyB,SAAwB;AACrD,KAAI,CAAC,QAAQ,KAAK,WAAW,EAC3B,QAAO;AAIT,QAAO;;EAEP,KAAK,KAAK,EAAE,KAAK,kBAAkB,KAAK,IAAI,IAAI,cAAc,CAAC,KAAK,OAAO;;AAG7E,MAAM,uBAAuB,SAAwC;AACnE,KAAI,SAAS,WACX,QAAO;AAGT,QAAO;;AAGT,MAAM,aAAa,YAA+B;AAEhD,KAAI,OAAO,YAAY,SACrB,QAAOC,MAAE,QAAQ;AAInB,KAAI,OAAO,YAAY,SACrB,QAAOA,MAAE,QAAQ;AAEnB,KAAI,OAAO,YAAY,UACrB,QAAOA,MAAE,SAAS;AAIpB,KAAI,MAAM,QAAQ,QAAQ,EAAE;AAE1B,MAAI,QAAQ,WAAW,EACrB,QAAOA,MAAE,MAAMA,MAAE,QAAQ,CAAC;AAG5B,SAAOA,MAAE,MAAM,UAAU,QAAQ,GAAG,CAAC;;AAIvC,KAAI,OAAO,YAAY,YAAY,YAAY,MAAM;EACnD,MAAMC,QAAsC,EAAE;AAC9C,OAAK,MAAM,OAAO,QAChB,OAAM,OAAO,UAAU,QAAQ,KAAK;AAEtC,SAAOD,MAAE,OAAO,MAAM;;AAIxB,QAAOA,MAAE,KAAK;;;;;;;AAQhB,MAAa,gBAAgB,OAAU,EACrC,kBACA,qBACA,uBACA,UACA,aACA,cACA,MACA,MACA,yBAGG;CACH,MAAM,aAAaE,+BAAU,cAAc;CAE3C,MAAM,uBAAuB,qBAAqB,YAAY;CAC9D,MAAM,wBAAwB,qBAAqB,aAAa;CAGhE,MAAM,SAAS,WACZ,QAAQ,mBAAmB,qBAAqB,CAChD,QAAQ,oBAAoB,sBAAsB,CAClD,QAAQ,2BAA2B,KAAK,UAAU,oBAAoB,CAAC,CACvE,QAAQ,6BAA6B,yBAAyB,GAAG,CACjE,QAAQ,0BAA0B,sBAAsB,GAAG,CAC3D,QAAQ,wBAAwB,sBAAsB,QAAQ,EAAE,CAAC,CAAC,CAClE,QAAQ,wBAAwB,oBAAoB,KAAK,CAAC;CAG7D,MAAM,EAAE,QAAQ,UAAU,6BAAqB;EAC7C,GAAG;EACH,QAAQ,UAAU,iBAAiB;EACnC,UAAU,CACR;GAAE,MAAM;GAAU,SAAS;GAAQ,EACnC;GACE,MAAM;GAEN,SAAS;IACP;IACA;IACA,eAAe;IACf,aAAa;IACb;IACA;IACA,KAAK,UAAU,iBAAiB;IACjC,CAAC,KAAK,KAAK;GACb,CACF;EACF,CAAC;AAEF,QAAO;EACL,aAAa;EACb,WAAW,OAAO,eAAe;EAClC"}
1
+ {"version":3,"file":"index.cjs","names":["aiDefaultOptions: AIOptions","AIProvider","Locales","shape: Record<string, z.ZodTypeAny>","readAsset","object"],"sources":["../../../src/translateJSON/index.ts"],"sourcesContent":["import { readAsset } from 'utils:asset';\nimport { getLocaleName } from '@intlayer/core';\nimport { type Locale, Locales } from '@intlayer/types';\nimport { generateObject } from 'ai';\nimport { z } from 'zod';\nimport { type AIConfig, type AIOptions, AIProvider } from '../aiSdk';\n\ntype Tag = {\n key: string;\n description?: string;\n};\n\nexport type TranslateJSONOptions<T = JSON> = {\n entryFileContent: T;\n presetOutputContent: Partial<T>;\n dictionaryDescription?: string;\n entryLocale: Locale;\n outputLocale: Locale;\n tags?: Tag[];\n aiConfig: AIConfig;\n mode: 'complete' | 'review';\n applicationContext?: string;\n};\n\nexport type TranslateJSONResultData<T = JSON> = {\n fileContent: T;\n tokenUsed: number;\n};\n\nexport const aiDefaultOptions: AIOptions = {\n provider: AIProvider.OPENAI,\n model: 'gpt-5-mini',\n};\n\n/**\n * Format a locale with its name.\n *\n * @param locale - The locale to format.\n * @returns A string in the format \"locale: name\", e.g. \"en: English\".\n */\nconst formatLocaleWithName = (locale: Locale): string =>\n `${locale}: ${getLocaleName(locale, Locales.ENGLISH)}`;\n\n/**\n * Formats tag instructions for the AI prompt.\n * Creates a string with all available tags and their descriptions.\n *\n * @param tags - The list of tags to format.\n * @returns A formatted string with tag instructions.\n */\nconst formatTagInstructions = (tags: Tag[]): string => {\n if (!tags || tags.length === 0) {\n return '';\n }\n\n // Prepare the tag instructions.\n return `Based on the dictionary content, identify specific tags from the list below that would be relevant:\n \n${tags.map(({ key, description }) => `- ${key}: ${description}`).join('\\n\\n')}`;\n};\n\nconst getModeInstructions = (mode: 'complete' | 'review'): string => {\n if (mode === 'complete') {\n return 'Mode: \"Complete\" - Enrich the preset content with the missing keys and values in the output locale. Do not update existing keys. Everything should be returned in the output.';\n }\n\n return 'Mode: \"Review\" - Fill missing content and review existing keys from the preset content. If a key from the entry is missing in the output, it must be translated to the target language and added. If you detect misspelled content, or content that should be reformulated, correct it. If a translation is not coherent with the desired language, translate it.';\n};\n\nconst jsonToZod = (content: any): z.ZodTypeAny => {\n // Base case: content is a string (the translation target)\n if (typeof content === 'string') {\n return z.string();\n }\n\n // Base cases: primitives often preserved in i18n files (e.g. strict numbers/booleans)\n if (typeof content === 'number') {\n return z.number();\n }\n if (typeof content === 'boolean') {\n return z.boolean();\n }\n\n // Recursive case: Array\n if (Array.isArray(content)) {\n // If array is empty, we assume array of strings as default for i18n\n if (content.length === 0) {\n return z.array(z.string());\n }\n // We assume all items in the array share the structure of the first item\n return z.array(jsonToZod(content[0]));\n }\n\n // Recursive case: Object\n if (typeof content === 'object' && content !== null) {\n const shape: Record<string, z.ZodTypeAny> = {};\n for (const key in content) {\n shape[key] = jsonToZod(content[key]);\n }\n return z.object(shape);\n }\n\n // Fallback\n return z.any();\n};\n\n/**\n * TranslateJSONs a content declaration file by constructing a prompt for AI models.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies.\n */\nexport const translateJSON = async <T>({\n entryFileContent,\n presetOutputContent,\n dictionaryDescription,\n aiConfig,\n entryLocale,\n outputLocale,\n tags,\n mode,\n applicationContext,\n}: TranslateJSONOptions<T>): Promise<\n TranslateJSONResultData<T> | undefined\n> => {\n const promptFile = readAsset('./PROMPT.md');\n\n const formattedEntryLocale = formatLocaleWithName(entryLocale);\n const formattedOutputLocale = formatLocaleWithName(outputLocale);\n\n // Prepare the prompt for AI by replacing placeholders with actual values.\n const prompt = promptFile\n .replace('{{entryLocale}}', formattedEntryLocale)\n .replace('{{outputLocale}}', formattedOutputLocale)\n .replace('{{presetOutputContent}}', JSON.stringify(presetOutputContent))\n .replace('{{dictionaryDescription}}', dictionaryDescription ?? '')\n .replace('{{applicationContext}}', applicationContext ?? '')\n .replace('{{tagsInstructions}}', formatTagInstructions(tags ?? []))\n .replace('{{modeInstructions}}', getModeInstructions(mode));\n\n // Use the AI SDK to generate the completion\n const { object, usage } = await generateObject({\n ...aiConfig,\n schema: jsonToZod(entryFileContent),\n messages: [\n { role: 'system', content: prompt },\n {\n role: 'user',\n // KEY CHANGE: Explicitly repeating instructions in the user message\n content: [\n `# Translation Request`,\n `Please translate the following JSON content.`,\n `- **From:** ${formattedEntryLocale}`,\n `- **To:** ${formattedOutputLocale}`,\n ``,\n `## Entry Content:`,\n JSON.stringify(entryFileContent),\n ].join('\\n'),\n },\n ],\n });\n\n return {\n fileContent: object as T,\n tokenUsed: usage?.totalTokens ?? 0,\n };\n};\n"],"mappings":";;;;;;;;AA6BA,MAAaA,mBAA8B;CACzC,UAAUC,yBAAW;CACrB,OAAO;CACR;;;;;;;AAQD,MAAM,wBAAwB,WAC5B,GAAG,OAAO,sCAAkB,QAAQC,wBAAQ,QAAQ;;;;;;;;AAStD,MAAM,yBAAyB,SAAwB;AAC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C,UAAU,CACR;GAAE,MAAM;GAAU,SAAS;GAAQ,EACnC;GACE,MAAM;GAEN,SAAS;IACP;IACA;IACA,eAAe;IACf,aAAa;IACb;IACA;IACA,KAAK,UAAU,iBAAiB;IACjC,CAAC,KAAK,KAAK;GACb,CACF;EACF,CAAC;AAEF,QAAO;EACL,aAAaC;EACb,WAAW,OAAO,eAAe;EAClC"}
@@ -1,6 +1,6 @@
1
1
  import { readAsset } from "../_virtual/_utils_asset.mjs";
2
+ import { array, object, string } from "../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.mjs";
2
3
  import { generateObject } from "ai";
3
- import { z } from "zod";
4
4
 
5
5
  //#region src/auditDictionaryMetadata/index.ts
6
6
  const aiDefaultOptions = {};
@@ -14,12 +14,12 @@ const auditDictionaryMetadata = async ({ fileContent, tags, aiConfig, applicatio
14
14
  const EXAMPLE_REQUEST = readAsset("./EXAMPLE_REQUEST.md");
15
15
  const EXAMPLE_RESPONSE = readAsset("./EXAMPLE_RESPONSE.md");
16
16
  const prompt = CHAT_GPT_PROMPT.replace("{{applicationContext}}", applicationContext ?? "").replace("{{tags}}", tags ? JSON.stringify(tags.map(({ key, description }) => `- ${key}: ${description}`).join("\n\n"), null, 2) : "");
17
- const { object, usage } = await generateObject({
17
+ const { object: object$1, usage } = await generateObject({
18
18
  ...aiConfig,
19
- schema: z.object({
20
- title: z.string(),
21
- description: z.string(),
22
- tags: z.array(z.string())
19
+ schema: object({
20
+ title: string(),
21
+ description: string(),
22
+ tags: array(string())
23
23
  }),
24
24
  messages: [
25
25
  {
@@ -41,7 +41,7 @@ const auditDictionaryMetadata = async ({ fileContent, tags, aiConfig, applicatio
41
41
  ]
42
42
  });
43
43
  return {
44
- fileContent: object,
44
+ fileContent: object$1,
45
45
  tokenUsed: usage?.totalTokens ?? 0
46
46
  };
47
47
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["aiDefaultOptions: AIOptions"],"sources":["../../../src/auditDictionaryMetadata/index.ts"],"sourcesContent":["import { readAsset } from 'utils:asset';\nimport { generateObject } from 'ai';\nimport { z } from 'zod';\nimport type { AIConfig, AIOptions } from '../aiSdk';\n\ntype Tag = {\n key: string;\n description?: string;\n};\n\nexport type AuditDictionaryMetadataOptions = {\n fileContent: string;\n tags?: Tag[];\n aiConfig: AIConfig;\n applicationContext?: string;\n};\n\nexport type AuditFileResultData = {\n fileContent: {\n title: string;\n description: string;\n tags: string[];\n };\n tokenUsed: number;\n};\n\nexport const aiDefaultOptions: AIOptions = {\n // Keep default options\n};\n\n/**\n * Audits a content declaration file by constructing a prompt for AI models.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies.\n */\nexport const auditDictionaryMetadata = async ({\n fileContent,\n tags,\n aiConfig,\n applicationContext,\n}: AuditDictionaryMetadataOptions): Promise<\n AuditFileResultData | undefined\n> => {\n const CHAT_GPT_PROMPT = readAsset('./PROMPT.md');\n const EXAMPLE_REQUEST = readAsset('./EXAMPLE_REQUEST.md');\n const EXAMPLE_RESPONSE = readAsset('./EXAMPLE_RESPONSE.md');\n\n // Prepare the prompt for AI by replacing placeholders with actual values.\n const prompt = CHAT_GPT_PROMPT.replace(\n '{{applicationContext}}',\n applicationContext ?? ''\n ).replace(\n '{{tags}}',\n tags\n ? JSON.stringify(\n tags\n .map(({ key, description }) => `- ${key}: ${description}`)\n .join('\\n\\n'),\n null,\n 2\n )\n : ''\n );\n\n // Use the AI SDK to generate the completion\n const { object, usage } = await generateObject({\n ...aiConfig,\n schema: z.object({\n title: z.string(),\n description: z.string(),\n tags: z.array(z.string()),\n }),\n messages: [\n { role: 'system', content: prompt },\n { role: 'user', content: EXAMPLE_REQUEST },\n { role: 'assistant', content: EXAMPLE_RESPONSE },\n {\n role: 'user',\n content: fileContent,\n },\n ],\n });\n\n return {\n fileContent: object,\n tokenUsed: usage?.totalTokens ?? 0,\n };\n};\n"],"mappings":";;;;;AA0BA,MAAaA,mBAA8B,EAE1C;;;;;;AAOD,MAAa,0BAA0B,OAAO,EAC5C,aACA,MACA,UACA,yBAGG;CACH,MAAM,kBAAkB,UAAU,cAAc;CAChD,MAAM,kBAAkB,UAAU,uBAAuB;CACzD,MAAM,mBAAmB,UAAU,wBAAwB;CAG3D,MAAM,SAAS,gBAAgB,QAC7B,0BACA,sBAAsB,GACvB,CAAC,QACA,YACA,OACI,KAAK,UACH,KACG,KAAK,EAAE,KAAK,kBAAkB,KAAK,IAAI,IAAI,cAAc,CACzD,KAAK,OAAO,EACf,MACA,EACD,GACD,GACL;CAGD,MAAM,EAAE,QAAQ,UAAU,MAAM,eAAe;EAC7C,GAAG;EACH,QAAQ,EAAE,OAAO;GACf,OAAO,EAAE,QAAQ;GACjB,aAAa,EAAE,QAAQ;GACvB,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;GAC1B,CAAC;EACF,UAAU;GACR;IAAE,MAAM;IAAU,SAAS;IAAQ;GACnC;IAAE,MAAM;IAAQ,SAAS;IAAiB;GAC1C;IAAE,MAAM;IAAa,SAAS;IAAkB;GAChD;IACE,MAAM;IACN,SAAS;IACV;GACF;EACF,CAAC;AAEF,QAAO;EACL,aAAa;EACb,WAAW,OAAO,eAAe;EAClC"}
1
+ {"version":3,"file":"index.mjs","names":["aiDefaultOptions: AIOptions","z.object","z.string","z.array","object"],"sources":["../../../src/auditDictionaryMetadata/index.ts"],"sourcesContent":["import { readAsset } from 'utils:asset';\nimport { generateObject } from 'ai';\nimport { z } from 'zod';\nimport type { AIConfig, AIOptions } from '../aiSdk';\n\ntype Tag = {\n key: string;\n description?: string;\n};\n\nexport type AuditDictionaryMetadataOptions = {\n fileContent: string;\n tags?: Tag[];\n aiConfig: AIConfig;\n applicationContext?: string;\n};\n\nexport type AuditFileResultData = {\n fileContent: {\n title: string;\n description: string;\n tags: string[];\n };\n tokenUsed: number;\n};\n\nexport const aiDefaultOptions: AIOptions = {\n // Keep default options\n};\n\n/**\n * Audits a content declaration file by constructing a prompt for AI models.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies.\n */\nexport const auditDictionaryMetadata = async ({\n fileContent,\n tags,\n aiConfig,\n applicationContext,\n}: AuditDictionaryMetadataOptions): Promise<\n AuditFileResultData | undefined\n> => {\n const CHAT_GPT_PROMPT = readAsset('./PROMPT.md');\n const EXAMPLE_REQUEST = readAsset('./EXAMPLE_REQUEST.md');\n const EXAMPLE_RESPONSE = readAsset('./EXAMPLE_RESPONSE.md');\n\n // Prepare the prompt for AI by replacing placeholders with actual values.\n const prompt = CHAT_GPT_PROMPT.replace(\n '{{applicationContext}}',\n applicationContext ?? ''\n ).replace(\n '{{tags}}',\n tags\n ? JSON.stringify(\n tags\n .map(({ key, description }) => `- ${key}: ${description}`)\n .join('\\n\\n'),\n null,\n 2\n )\n : ''\n );\n\n // Use the AI SDK to generate the completion\n const { object, usage } = await generateObject({\n ...aiConfig,\n schema: z.object({\n title: z.string(),\n description: z.string(),\n tags: z.array(z.string()),\n }),\n messages: [\n { role: 'system', content: prompt },\n { role: 'user', content: EXAMPLE_REQUEST },\n { role: 'assistant', content: EXAMPLE_RESPONSE },\n {\n role: 'user',\n content: fileContent,\n },\n ],\n });\n\n return {\n fileContent: object,\n tokenUsed: usage?.totalTokens ?? 0,\n };\n};\n"],"mappings":";;;;;AA0BA,MAAaA,mBAA8B,EAE1C;;;;;;AAOD,MAAa,0BAA0B,OAAO,EAC5C,aACA,MACA,UACA,yBAGG;CACH,MAAM,kBAAkB,UAAU,cAAc;CAChD,MAAM,kBAAkB,UAAU,uBAAuB;CACzD,MAAM,mBAAmB,UAAU,wBAAwB;CAG3D,MAAM,SAAS,gBAAgB,QAC7B,0BACA,sBAAsB,GACvB,CAAC,QACA,YACA,OACI,KAAK,UACH,KACG,KAAK,EAAE,KAAK,kBAAkB,KAAK,IAAI,IAAI,cAAc,CACzD,KAAK,OAAO,EACf,MACA,EACD,GACD,GACL;CAGD,MAAM,EAAE,kBAAQ,UAAU,MAAM,eAAe;EAC7C,GAAG;EACH,QAAQC,OAAS;GACf,OAAOC,QAAU;GACjB,aAAaA,QAAU;GACvB,MAAMC,MAAQD,QAAU,CAAC;GAC1B,CAAC;EACF,UAAU;GACR;IAAE,MAAM;IAAU,SAAS;IAAQ;GACnC;IAAE,MAAM;IAAQ,SAAS;IAAiB;GAC1C;IAAE,MAAM;IAAa,SAAS;IAAkB;GAChD;IACE,MAAM;IACN,SAAS;IACV;GACF;EACF,CAAC;AAEF,QAAO;EACL,aAAaE;EACb,WAAW,OAAO,eAAe;EAClC"}
@@ -0,0 +1,30 @@
1
+ import { $constructor } from "../core/core.mjs";
2
+ import { jsonStringifyReplacer } from "../core/util.mjs";
3
+ import { $ZodError, flattenError, formatError } from "../core/errors.mjs";
4
+
5
+ //#region ../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.js
6
+ const initializer = (inst, issues) => {
7
+ $ZodError.init(inst, issues);
8
+ inst.name = "ZodError";
9
+ Object.defineProperties(inst, {
10
+ format: { value: (mapper) => formatError(inst, mapper) },
11
+ flatten: { value: (mapper) => flattenError(inst, mapper) },
12
+ addIssue: { value: (issue) => {
13
+ inst.issues.push(issue);
14
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
15
+ } },
16
+ addIssues: { value: (issues$1) => {
17
+ inst.issues.push(...issues$1);
18
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
19
+ } },
20
+ isEmpty: { get() {
21
+ return inst.issues.length === 0;
22
+ } }
23
+ });
24
+ };
25
+ const ZodError = $constructor("ZodError", initializer);
26
+ const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
27
+
28
+ //#endregion
29
+ export { ZodRealError };
30
+ //# sourceMappingURL=errors.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.mjs","names":["core.formatError","core.flattenError","util.jsonStringifyReplacer","issues","core.$constructor"],"sources":["../../../../../../../../../../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.js"],"sourcesContent":["import * as core from \"../core/index.js\";\nimport { $ZodError } from \"../core/index.js\";\nimport * as util from \"../core/util.js\";\nconst initializer = (inst, issues) => {\n $ZodError.init(inst, issues);\n inst.name = \"ZodError\";\n Object.defineProperties(inst, {\n format: {\n value: (mapper) => core.formatError(inst, mapper),\n // enumerable: false,\n },\n flatten: {\n value: (mapper) => core.flattenError(inst, mapper),\n // enumerable: false,\n },\n addIssue: {\n value: (issue) => {\n inst.issues.push(issue);\n inst.message = JSON.stringify(inst.issues, util.jsonStringifyReplacer, 2);\n },\n // enumerable: false,\n },\n addIssues: {\n value: (issues) => {\n inst.issues.push(...issues);\n inst.message = JSON.stringify(inst.issues, util.jsonStringifyReplacer, 2);\n },\n // enumerable: false,\n },\n isEmpty: {\n get() {\n return inst.issues.length === 0;\n },\n // enumerable: false,\n },\n });\n // Object.defineProperty(inst, \"isEmpty\", {\n // get() {\n // return inst.issues.length === 0;\n // },\n // });\n};\nexport const ZodError = core.$constructor(\"ZodError\", initializer);\nexport const ZodRealError = core.$constructor(\"ZodError\", initializer, {\n Parent: Error,\n});\n// /** @deprecated Use `z.core.$ZodErrorMapCtx` instead. */\n// export type ErrorMapCtx = core.$ZodErrorMapCtx;\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAGA,MAAM,eAAe,MAAM,WAAW;AAClC,WAAU,KAAK,MAAM,OAAO;AAC5B,MAAK,OAAO;AACZ,QAAO,iBAAiB,MAAM;EAC1B,QAAQ,EACJ,QAAQ,WAAWA,YAAiB,MAAM,OAAO,EAEpD;EACD,SAAS,EACL,QAAQ,WAAWC,aAAkB,MAAM,OAAO,EAErD;EACD,UAAU,EACN,QAAQ,UAAU;AACd,QAAK,OAAO,KAAK,MAAM;AACvB,QAAK,UAAU,KAAK,UAAU,KAAK,QAAQC,uBAA4B,EAAE;KAGhF;EACD,WAAW,EACP,QAAQ,aAAW;AACf,QAAK,OAAO,KAAK,GAAGC,SAAO;AAC3B,QAAK,UAAU,KAAK,UAAU,KAAK,QAAQD,uBAA4B,EAAE;KAGhF;EACD,SAAS,EACL,MAAM;AACF,UAAO,KAAK,OAAO,WAAW;KAGrC;EACJ,CAAC;;AAON,MAAa,WAAWE,aAAkB,YAAY,YAAY;AAClE,MAAa,eAAeA,aAAkB,YAAY,aAAa,EACnE,QAAQ,OACX,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { $constructor } from "../core/core.mjs";
2
+ import { $ZodISODate, $ZodISODateTime, $ZodISODuration, $ZodISOTime } from "../core/schemas.mjs";
3
+ import { _isoDate, _isoDateTime, _isoDuration, _isoTime } from "../core/api.mjs";
4
+ import { ZodStringFormat } from "./schemas.mjs";
5
+
6
+ //#region ../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.js
7
+ const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
8
+ $ZodISODateTime.init(inst, def);
9
+ ZodStringFormat.init(inst, def);
10
+ });
11
+ function datetime(params) {
12
+ return _isoDateTime(ZodISODateTime, params);
13
+ }
14
+ const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
15
+ $ZodISODate.init(inst, def);
16
+ ZodStringFormat.init(inst, def);
17
+ });
18
+ function date(params) {
19
+ return _isoDate(ZodISODate, params);
20
+ }
21
+ const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
22
+ $ZodISOTime.init(inst, def);
23
+ ZodStringFormat.init(inst, def);
24
+ });
25
+ function time(params) {
26
+ return _isoTime(ZodISOTime, params);
27
+ }
28
+ const ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
29
+ $ZodISODuration.init(inst, def);
30
+ ZodStringFormat.init(inst, def);
31
+ });
32
+ function duration(params) {
33
+ return _isoDuration(ZodISODuration, params);
34
+ }
35
+
36
+ //#endregion
37
+ export { date, datetime, duration, time };
38
+ //# sourceMappingURL=iso.mjs.map