@jsdev_ninja/core 0.23.0 → 0.24.0

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/core.es.js CHANGED
@@ -1,45 +1,45 @@
1
1
  var ut = Object.defineProperty;
2
- var dt = (n, e, t) => e in n ? ut(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var ze = (n, e, t) => dt(n, typeof e != "symbol" ? e + "" : e, t);
2
+ var dt = (r, e, t) => e in r ? ut(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var ze = (r, e, t) => dt(r, typeof e != "symbol" ? e + "" : e, t);
4
4
  var b;
5
- (function(n) {
6
- n.assertEqual = (a) => a;
5
+ (function(r) {
6
+ r.assertEqual = (a) => a;
7
7
  function e(a) {
8
8
  }
9
- n.assertIs = e;
9
+ r.assertIs = e;
10
10
  function t(a) {
11
11
  throw new Error();
12
12
  }
13
- n.assertNever = t, n.arrayToEnum = (a) => {
13
+ r.assertNever = t, r.arrayToEnum = (a) => {
14
14
  const s = {};
15
15
  for (const o of a)
16
16
  s[o] = o;
17
17
  return s;
18
- }, n.getValidEnumValues = (a) => {
19
- const s = n.objectKeys(a).filter((c) => typeof a[a[c]] != "number"), o = {};
18
+ }, r.getValidEnumValues = (a) => {
19
+ const s = r.objectKeys(a).filter((c) => typeof a[a[c]] != "number"), o = {};
20
20
  for (const c of s)
21
21
  o[c] = a[c];
22
- return n.objectValues(o);
23
- }, n.objectValues = (a) => n.objectKeys(a).map(function(s) {
22
+ return r.objectValues(o);
23
+ }, r.objectValues = (a) => r.objectKeys(a).map(function(s) {
24
24
  return a[s];
25
- }), n.objectKeys = typeof Object.keys == "function" ? (a) => Object.keys(a) : (a) => {
25
+ }), r.objectKeys = typeof Object.keys == "function" ? (a) => Object.keys(a) : (a) => {
26
26
  const s = [];
27
27
  for (const o in a)
28
28
  Object.prototype.hasOwnProperty.call(a, o) && s.push(o);
29
29
  return s;
30
- }, n.find = (a, s) => {
30
+ }, r.find = (a, s) => {
31
31
  for (const o of a)
32
32
  if (s(o))
33
33
  return o;
34
- }, n.isInteger = typeof Number.isInteger == "function" ? (a) => Number.isInteger(a) : (a) => typeof a == "number" && isFinite(a) && Math.floor(a) === a;
34
+ }, r.isInteger = typeof Number.isInteger == "function" ? (a) => Number.isInteger(a) : (a) => typeof a == "number" && isFinite(a) && Math.floor(a) === a;
35
35
  function i(a, s = " | ") {
36
36
  return a.map((o) => typeof o == "string" ? `'${o}'` : o).join(s);
37
37
  }
38
- n.joinValues = i, n.jsonStringifyReplacer = (a, s) => typeof s == "bigint" ? s.toString() : s;
38
+ r.joinValues = i, r.jsonStringifyReplacer = (a, s) => typeof s == "bigint" ? s.toString() : s;
39
39
  })(b || (b = {}));
40
40
  var Ze;
41
- (function(n) {
42
- n.mergeShapes = (e, t) => ({
41
+ (function(r) {
42
+ r.mergeShapes = (e, t) => ({
43
43
  ...e,
44
44
  ...t
45
45
  // second overwrites first
@@ -66,14 +66,14 @@ const p = b.arrayToEnum([
66
66
  "never",
67
67
  "map",
68
68
  "set"
69
- ]), R = (n) => {
70
- switch (typeof n) {
69
+ ]), R = (r) => {
70
+ switch (typeof r) {
71
71
  case "undefined":
72
72
  return p.undefined;
73
73
  case "string":
74
74
  return p.string;
75
75
  case "number":
76
- return isNaN(n) ? p.nan : p.number;
76
+ return isNaN(r) ? p.nan : p.number;
77
77
  case "boolean":
78
78
  return p.boolean;
79
79
  case "function":
@@ -83,7 +83,7 @@ const p = b.arrayToEnum([
83
83
  case "symbol":
84
84
  return p.symbol;
85
85
  case "object":
86
- return Array.isArray(n) ? p.array : n === null ? p.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? p.promise : typeof Map < "u" && n instanceof Map ? p.map : typeof Set < "u" && n instanceof Set ? p.set : typeof Date < "u" && n instanceof Date ? p.date : p.object;
86
+ return Array.isArray(r) ? p.array : r === null ? p.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? p.promise : typeof Map < "u" && r instanceof Map ? p.map : typeof Set < "u" && r instanceof Set ? p.set : typeof Date < "u" && r instanceof Date ? p.date : p.object;
87
87
  default:
88
88
  return p.unknown;
89
89
  }
@@ -104,7 +104,7 @@ const p = b.arrayToEnum([
104
104
  "invalid_intersection_types",
105
105
  "not_multiple_of",
106
106
  "not_finite"
107
- ]), lt = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
107
+ ]), lt = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
108
108
  class A extends Error {
109
109
  get errors() {
110
110
  return this.issues;
@@ -164,27 +164,27 @@ class A extends Error {
164
164
  return this.flatten();
165
165
  }
166
166
  }
167
- A.create = (n) => new A(n);
168
- const G = (n, e) => {
167
+ A.create = (r) => new A(r);
168
+ const G = (r, e) => {
169
169
  let t;
170
- switch (n.code) {
170
+ switch (r.code) {
171
171
  case d.invalid_type:
172
- n.received === p.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
172
+ r.received === p.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
173
173
  break;
174
174
  case d.invalid_literal:
175
- t = `Invalid literal value, expected ${JSON.stringify(n.expected, b.jsonStringifyReplacer)}`;
175
+ t = `Invalid literal value, expected ${JSON.stringify(r.expected, b.jsonStringifyReplacer)}`;
176
176
  break;
177
177
  case d.unrecognized_keys:
178
- t = `Unrecognized key(s) in object: ${b.joinValues(n.keys, ", ")}`;
178
+ t = `Unrecognized key(s) in object: ${b.joinValues(r.keys, ", ")}`;
179
179
  break;
180
180
  case d.invalid_union:
181
181
  t = "Invalid input";
182
182
  break;
183
183
  case d.invalid_union_discriminator:
184
- t = `Invalid discriminator value. Expected ${b.joinValues(n.options)}`;
184
+ t = `Invalid discriminator value. Expected ${b.joinValues(r.options)}`;
185
185
  break;
186
186
  case d.invalid_enum_value:
187
- t = `Invalid enum value. Expected ${b.joinValues(n.options)}, received '${n.received}'`;
187
+ t = `Invalid enum value. Expected ${b.joinValues(r.options)}, received '${r.received}'`;
188
188
  break;
189
189
  case d.invalid_arguments:
190
190
  t = "Invalid function arguments";
@@ -196,13 +196,13 @@ const G = (n, e) => {
196
196
  t = "Invalid date";
197
197
  break;
198
198
  case d.invalid_string:
199
- typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : b.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
199
+ typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : b.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
200
200
  break;
201
201
  case d.too_small:
202
- n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
202
+ r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
203
203
  break;
204
204
  case d.too_big:
205
- n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? t = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : t = "Invalid input";
205
+ r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
206
206
  break;
207
207
  case d.custom:
208
208
  t = "Invalid input";
@@ -211,25 +211,25 @@ const G = (n, e) => {
211
211
  t = "Intersection results could not be merged";
212
212
  break;
213
213
  case d.not_multiple_of:
214
- t = `Number must be a multiple of ${n.multipleOf}`;
214
+ t = `Number must be a multiple of ${r.multipleOf}`;
215
215
  break;
216
216
  case d.not_finite:
217
217
  t = "Number must be finite";
218
218
  break;
219
219
  default:
220
- t = e.defaultError, b.assertNever(n);
220
+ t = e.defaultError, b.assertNever(r);
221
221
  }
222
222
  return { message: t };
223
223
  };
224
224
  let Be = G;
225
- function mt(n) {
226
- Be = n;
225
+ function mt(r) {
226
+ Be = r;
227
227
  }
228
228
  function ve() {
229
229
  return Be;
230
230
  }
231
- const _e = (n) => {
232
- const { data: e, path: t, errorMaps: i, issueData: a } = n, s = [...t, ...a.path || []], o = {
231
+ const _e = (r) => {
232
+ const { data: e, path: t, errorMaps: i, issueData: a } = r, s = [...t, ...a.path || []], o = {
233
233
  ...a,
234
234
  path: s
235
235
  };
@@ -249,15 +249,15 @@ const _e = (n) => {
249
249
  message: c
250
250
  };
251
251
  }, pt = [];
252
- function m(n, e) {
252
+ function m(r, e) {
253
253
  const t = ve(), i = _e({
254
254
  issueData: e,
255
- data: n.data,
256
- path: n.path,
255
+ data: r.data,
256
+ path: r.path,
257
257
  errorMaps: [
258
- n.common.contextualErrorMap,
258
+ r.common.contextualErrorMap,
259
259
  // contextual error map is first priority
260
- n.schemaErrorMap,
260
+ r.schemaErrorMap,
261
261
  // then schema-bound map if available
262
262
  t,
263
263
  // then global override map
@@ -265,7 +265,7 @@ function m(n, e) {
265
265
  // then global default map
266
266
  ].filter((a) => !!a)
267
267
  });
268
- n.common.issues.push(i);
268
+ r.common.issues.push(i);
269
269
  }
270
270
  class T {
271
271
  constructor() {
@@ -310,21 +310,21 @@ class T {
310
310
  }
311
311
  const y = Object.freeze({
312
312
  status: "aborted"
313
- }), Y = (n) => ({ status: "dirty", value: n }), S = (n) => ({ status: "valid", value: n }), Oe = (n) => n.status === "aborted", Pe = (n) => n.status === "dirty", q = (n) => n.status === "valid", re = (n) => typeof Promise < "u" && n instanceof Promise;
314
- function be(n, e, t, i) {
315
- if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
316
- return e.get(n);
313
+ }), Y = (r) => ({ status: "dirty", value: r }), S = (r) => ({ status: "valid", value: r }), Oe = (r) => r.status === "aborted", De = (r) => r.status === "dirty", q = (r) => r.status === "valid", re = (r) => typeof Promise < "u" && r instanceof Promise;
314
+ function be(r, e, t, i) {
315
+ if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
316
+ return e.get(r);
317
317
  }
318
- function We(n, e, t, i, a) {
319
- if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
320
- return e.set(n, t), t;
318
+ function We(r, e, t, i, a) {
319
+ if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
320
+ return e.set(r, t), t;
321
321
  }
322
322
  var h;
323
- (function(n) {
324
- n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
323
+ (function(r) {
324
+ r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
325
325
  })(h || (h = {}));
326
326
  var te, ne;
327
- class P {
327
+ class D {
328
328
  constructor(e, t, i, a) {
329
329
  this._cachedPath = [], this.parent = e, this.data = t, this._path = i, this._key = a;
330
330
  }
@@ -332,30 +332,30 @@ class P {
332
332
  return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
333
333
  }
334
334
  }
335
- const Ve = (n, e) => {
335
+ const Ve = (r, e) => {
336
336
  if (q(e))
337
337
  return { success: !0, data: e.value };
338
- if (!n.common.issues.length)
338
+ if (!r.common.issues.length)
339
339
  throw new Error("Validation failed but no issues detected.");
340
340
  return {
341
341
  success: !1,
342
342
  get error() {
343
343
  if (this._error)
344
344
  return this._error;
345
- const t = new A(n.common.issues);
345
+ const t = new A(r.common.issues);
346
346
  return this._error = t, this._error;
347
347
  }
348
348
  };
349
349
  };
350
- function v(n) {
351
- if (!n)
350
+ function v(r) {
351
+ if (!r)
352
352
  return {};
353
- const { errorMap: e, invalid_type_error: t, required_error: i, description: a } = n;
353
+ const { errorMap: e, invalid_type_error: t, required_error: i, description: a } = r;
354
354
  if (e && (t || i))
355
355
  throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
356
356
  return e ? { errorMap: e, description: a } : { errorMap: (o, c) => {
357
357
  var l, u;
358
- const { message: f } = n;
358
+ const { message: f } = r;
359
359
  return o.code === "invalid_enum_value" ? { message: f ?? c.defaultError } : typeof c.data > "u" ? { message: (l = f ?? i) !== null && l !== void 0 ? l : c.defaultError } : o.code !== "invalid_type" ? { message: c.defaultError } : { message: (u = f ?? t) !== null && u !== void 0 ? u : c.defaultError };
360
360
  }, description: a };
361
361
  }
@@ -582,33 +582,33 @@ class _ {
582
582
  const ft = /^c[^\s-]{8,}$/i, ht = /^[0-9a-z]+$/, gt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, yt = /^[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, vt = /^[a-z0-9_-]{21}$/i, _t = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, bt = /^[-+]?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)?)??$/, xt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, kt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
583
583
  let je;
584
584
  const wt = /^(?:(?: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])$/, Tt = /^(?:(?: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])$/, St = /^(([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]))$/, It = /^(([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])$/, At = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Nt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Qe = "((\\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])))", Ct = new RegExp(`^${Qe}$`);
585
- function Ye(n) {
585
+ function Ye(r) {
586
586
  let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
587
- return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
587
+ return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
588
588
  }
589
- function jt(n) {
590
- return new RegExp(`^${Ye(n)}$`);
589
+ function jt(r) {
590
+ return new RegExp(`^${Ye(r)}$`);
591
591
  }
592
- function Xe(n) {
593
- let e = `${Qe}T${Ye(n)}`;
592
+ function Xe(r) {
593
+ let e = `${Qe}T${Ye(r)}`;
594
594
  const t = [];
595
- return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
595
+ return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
596
596
  }
597
- function Zt(n, e) {
598
- return !!((e === "v4" || !e) && wt.test(n) || (e === "v6" || !e) && St.test(n));
597
+ function Zt(r, e) {
598
+ return !!((e === "v4" || !e) && wt.test(r) || (e === "v6" || !e) && St.test(r));
599
599
  }
600
- function Ot(n, e) {
601
- if (!_t.test(n))
600
+ function Ot(r, e) {
601
+ if (!_t.test(r))
602
602
  return !1;
603
603
  try {
604
- const [t] = n.split("."), i = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), a = JSON.parse(atob(i));
604
+ const [t] = r.split("."), i = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), a = JSON.parse(atob(i));
605
605
  return !(typeof a != "object" || a === null || !a.typ || !a.alg || e && a.alg !== e);
606
606
  } catch {
607
607
  return !1;
608
608
  }
609
609
  }
610
- function Pt(n, e) {
611
- return !!((e === "v4" || !e) && Tt.test(n) || (e === "v6" || !e) && It.test(n));
610
+ function Dt(r, e) {
611
+ return !!((e === "v4" || !e) && Tt.test(r) || (e === "v6" || !e) && It.test(r));
612
612
  }
613
613
  class N extends _ {
614
614
  _parse(e) {
@@ -750,7 +750,7 @@ class N extends _ {
750
750
  validation: "jwt",
751
751
  code: d.invalid_string,
752
752
  message: s.message
753
- }), i.dirty()) : s.kind === "cidr" ? Pt(e.data, s.version) || (a = this._getOrReturnCtx(e, a), m(a, {
753
+ }), i.dirty()) : s.kind === "cidr" ? Dt(e.data, s.version) || (a = this._getOrReturnCtx(e, a), m(a, {
754
754
  validation: "cidr",
755
755
  code: d.invalid_string,
756
756
  message: s.message
@@ -988,17 +988,17 @@ class N extends _ {
988
988
  return e;
989
989
  }
990
990
  }
991
- N.create = (n) => {
991
+ N.create = (r) => {
992
992
  var e;
993
993
  return new N({
994
994
  checks: [],
995
995
  typeName: g.ZodString,
996
- coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
997
- ...v(n)
996
+ coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
997
+ ...v(r)
998
998
  });
999
999
  };
1000
- function Dt(n, e) {
1001
- const t = (n.toString().split(".")[1] || "").length, i = (e.toString().split(".")[1] || "").length, a = t > i ? t : i, s = parseInt(n.toFixed(a).replace(".", "")), o = parseInt(e.toFixed(a).replace(".", ""));
1000
+ function Pt(r, e) {
1001
+ const t = (r.toString().split(".")[1] || "").length, i = (e.toString().split(".")[1] || "").length, a = t > i ? t : i, s = parseInt(r.toFixed(a).replace(".", "")), o = parseInt(e.toFixed(a).replace(".", ""));
1002
1002
  return s % o / Math.pow(10, a);
1003
1003
  }
1004
1004
  class z extends _ {
@@ -1036,7 +1036,7 @@ class z extends _ {
1036
1036
  inclusive: s.inclusive,
1037
1037
  exact: !1,
1038
1038
  message: s.message
1039
- }), a.dirty()) : s.kind === "multipleOf" ? Dt(e.data, s.value) !== 0 && (i = this._getOrReturnCtx(e, i), m(i, {
1039
+ }), a.dirty()) : s.kind === "multipleOf" ? Pt(e.data, s.value) !== 0 && (i = this._getOrReturnCtx(e, i), m(i, {
1040
1040
  code: d.not_multiple_of,
1041
1041
  multipleOf: s.value,
1042
1042
  message: s.message
@@ -1167,11 +1167,11 @@ class z extends _ {
1167
1167
  return Number.isFinite(t) && Number.isFinite(e);
1168
1168
  }
1169
1169
  }
1170
- z.create = (n) => new z({
1170
+ z.create = (r) => new z({
1171
1171
  checks: [],
1172
1172
  typeName: g.ZodNumber,
1173
- coerce: (n == null ? void 0 : n.coerce) || !1,
1174
- ...v(n)
1173
+ coerce: (r == null ? void 0 : r.coerce) || !1,
1174
+ ...v(r)
1175
1175
  });
1176
1176
  class V extends _ {
1177
1177
  constructor() {
@@ -1300,13 +1300,13 @@ class V extends _ {
1300
1300
  return e;
1301
1301
  }
1302
1302
  }
1303
- V.create = (n) => {
1303
+ V.create = (r) => {
1304
1304
  var e;
1305
1305
  return new V({
1306
1306
  checks: [],
1307
1307
  typeName: g.ZodBigInt,
1308
- coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
1309
- ...v(n)
1308
+ coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
1309
+ ...v(r)
1310
1310
  });
1311
1311
  };
1312
1312
  class ie extends _ {
@@ -1322,10 +1322,10 @@ class ie extends _ {
1322
1322
  return S(e.data);
1323
1323
  }
1324
1324
  }
1325
- ie.create = (n) => new ie({
1325
+ ie.create = (r) => new ie({
1326
1326
  typeName: g.ZodBoolean,
1327
- coerce: (n == null ? void 0 : n.coerce) || !1,
1328
- ...v(n)
1327
+ coerce: (r == null ? void 0 : r.coerce) || !1,
1328
+ ...v(r)
1329
1329
  });
1330
1330
  class B extends _ {
1331
1331
  _parse(e) {
@@ -1399,11 +1399,11 @@ class B extends _ {
1399
1399
  return e != null ? new Date(e) : null;
1400
1400
  }
1401
1401
  }
1402
- B.create = (n) => new B({
1402
+ B.create = (r) => new B({
1403
1403
  checks: [],
1404
- coerce: (n == null ? void 0 : n.coerce) || !1,
1404
+ coerce: (r == null ? void 0 : r.coerce) || !1,
1405
1405
  typeName: g.ZodDate,
1406
- ...v(n)
1406
+ ...v(r)
1407
1407
  });
1408
1408
  class xe extends _ {
1409
1409
  _parse(e) {
@@ -1418,9 +1418,9 @@ class xe extends _ {
1418
1418
  return S(e.data);
1419
1419
  }
1420
1420
  }
1421
- xe.create = (n) => new xe({
1421
+ xe.create = (r) => new xe({
1422
1422
  typeName: g.ZodSymbol,
1423
- ...v(n)
1423
+ ...v(r)
1424
1424
  });
1425
1425
  class ae extends _ {
1426
1426
  _parse(e) {
@@ -1435,9 +1435,9 @@ class ae extends _ {
1435
1435
  return S(e.data);
1436
1436
  }
1437
1437
  }
1438
- ae.create = (n) => new ae({
1438
+ ae.create = (r) => new ae({
1439
1439
  typeName: g.ZodUndefined,
1440
- ...v(n)
1440
+ ...v(r)
1441
1441
  });
1442
1442
  class se extends _ {
1443
1443
  _parse(e) {
@@ -1452,9 +1452,9 @@ class se extends _ {
1452
1452
  return S(e.data);
1453
1453
  }
1454
1454
  }
1455
- se.create = (n) => new se({
1455
+ se.create = (r) => new se({
1456
1456
  typeName: g.ZodNull,
1457
- ...v(n)
1457
+ ...v(r)
1458
1458
  });
1459
1459
  class J extends _ {
1460
1460
  constructor() {
@@ -1464,9 +1464,9 @@ class J extends _ {
1464
1464
  return S(e.data);
1465
1465
  }
1466
1466
  }
1467
- J.create = (n) => new J({
1467
+ J.create = (r) => new J({
1468
1468
  typeName: g.ZodAny,
1469
- ...v(n)
1469
+ ...v(r)
1470
1470
  });
1471
1471
  class U extends _ {
1472
1472
  constructor() {
@@ -1476,9 +1476,9 @@ class U extends _ {
1476
1476
  return S(e.data);
1477
1477
  }
1478
1478
  }
1479
- U.create = (n) => new U({
1479
+ U.create = (r) => new U({
1480
1480
  typeName: g.ZodUnknown,
1481
- ...v(n)
1481
+ ...v(r)
1482
1482
  });
1483
1483
  class M extends _ {
1484
1484
  _parse(e) {
@@ -1490,9 +1490,9 @@ class M extends _ {
1490
1490
  }), y;
1491
1491
  }
1492
1492
  }
1493
- M.create = (n) => new M({
1493
+ M.create = (r) => new M({
1494
1494
  typeName: g.ZodNever,
1495
- ...v(n)
1495
+ ...v(r)
1496
1496
  });
1497
1497
  class ke extends _ {
1498
1498
  _parse(e) {
@@ -1507,9 +1507,9 @@ class ke extends _ {
1507
1507
  return S(e.data);
1508
1508
  }
1509
1509
  }
1510
- ke.create = (n) => new ke({
1510
+ ke.create = (r) => new ke({
1511
1511
  typeName: g.ZodVoid,
1512
- ...v(n)
1512
+ ...v(r)
1513
1513
  });
1514
1514
  class C extends _ {
1515
1515
  _parse(e) {
@@ -1547,8 +1547,8 @@ class C extends _ {
1547
1547
  exact: !1,
1548
1548
  message: a.maxLength.message
1549
1549
  }), i.dirty()), t.common.async)
1550
- return Promise.all([...t.data].map((o, c) => a.type._parseAsync(new P(t, o, t.path, c)))).then((o) => T.mergeArray(i, o));
1551
- const s = [...t.data].map((o, c) => a.type._parseSync(new P(t, o, t.path, c)));
1550
+ return Promise.all([...t.data].map((o, c) => a.type._parseAsync(new D(t, o, t.path, c)))).then((o) => T.mergeArray(i, o));
1551
+ const s = [...t.data].map((o, c) => a.type._parseSync(new D(t, o, t.path, c)));
1552
1552
  return T.mergeArray(i, s);
1553
1553
  }
1554
1554
  get element() {
@@ -1576,29 +1576,29 @@ class C extends _ {
1576
1576
  return this.min(1, e);
1577
1577
  }
1578
1578
  }
1579
- C.create = (n, e) => new C({
1580
- type: n,
1579
+ C.create = (r, e) => new C({
1580
+ type: r,
1581
1581
  minLength: null,
1582
1582
  maxLength: null,
1583
1583
  exactLength: null,
1584
1584
  typeName: g.ZodArray,
1585
1585
  ...v(e)
1586
1586
  });
1587
- function Q(n) {
1588
- if (n instanceof k) {
1587
+ function Q(r) {
1588
+ if (r instanceof k) {
1589
1589
  const e = {};
1590
- for (const t in n.shape) {
1591
- const i = n.shape[t];
1590
+ for (const t in r.shape) {
1591
+ const i = r.shape[t];
1592
1592
  e[t] = O.create(Q(i));
1593
1593
  }
1594
1594
  return new k({
1595
- ...n._def,
1595
+ ...r._def,
1596
1596
  shape: () => e
1597
1597
  });
1598
- } else return n instanceof C ? new C({
1599
- ...n._def,
1600
- type: Q(n.element)
1601
- }) : n instanceof O ? O.create(Q(n.unwrap())) : n instanceof F ? F.create(Q(n.unwrap())) : n instanceof D ? D.create(n.items.map((e) => Q(e))) : n;
1598
+ } else return r instanceof C ? new C({
1599
+ ...r._def,
1600
+ type: Q(r.element)
1601
+ }) : r instanceof O ? O.create(Q(r.unwrap())) : r instanceof F ? F.create(Q(r.unwrap())) : r instanceof P ? P.create(r.items.map((e) => Q(e))) : r;
1602
1602
  }
1603
1603
  class k extends _ {
1604
1604
  constructor() {
@@ -1628,7 +1628,7 @@ class k extends _ {
1628
1628
  const f = s[u], x = a.data[u];
1629
1629
  l.push({
1630
1630
  key: { status: "valid", value: u },
1631
- value: f._parse(new P(a, x, a.path, u)),
1631
+ value: f._parse(new D(a, x, a.path, u)),
1632
1632
  alwaysSet: u in a.data
1633
1633
  });
1634
1634
  }
@@ -1653,7 +1653,7 @@ class k extends _ {
1653
1653
  l.push({
1654
1654
  key: { status: "valid", value: f },
1655
1655
  value: u._parse(
1656
- new P(a, x, a.path, f)
1656
+ new D(a, x, a.path, f)
1657
1657
  //, ctx.child(key), value, getParsedType(value)
1658
1658
  ),
1659
1659
  alwaysSet: f in a.data
@@ -1866,22 +1866,22 @@ class k extends _ {
1866
1866
  return Ge(b.objectKeys(this.shape));
1867
1867
  }
1868
1868
  }
1869
- k.create = (n, e) => new k({
1870
- shape: () => n,
1869
+ k.create = (r, e) => new k({
1870
+ shape: () => r,
1871
1871
  unknownKeys: "strip",
1872
1872
  catchall: M.create(),
1873
1873
  typeName: g.ZodObject,
1874
1874
  ...v(e)
1875
1875
  });
1876
- k.strictCreate = (n, e) => new k({
1877
- shape: () => n,
1876
+ k.strictCreate = (r, e) => new k({
1877
+ shape: () => r,
1878
1878
  unknownKeys: "strict",
1879
1879
  catchall: M.create(),
1880
1880
  typeName: g.ZodObject,
1881
1881
  ...v(e)
1882
1882
  });
1883
- k.lazycreate = (n, e) => new k({
1884
- shape: n,
1883
+ k.lazycreate = (r, e) => new k({
1884
+ shape: r,
1885
1885
  unknownKeys: "strip",
1886
1886
  catchall: M.create(),
1887
1887
  typeName: g.ZodObject,
@@ -1955,12 +1955,12 @@ class oe extends _ {
1955
1955
  return this._def.options;
1956
1956
  }
1957
1957
  }
1958
- oe.create = (n, e) => new oe({
1959
- options: n,
1958
+ oe.create = (r, e) => new oe({
1959
+ options: r,
1960
1960
  typeName: g.ZodUnion,
1961
1961
  ...v(e)
1962
1962
  });
1963
- const E = (n) => n instanceof de ? E(n.schema) : n instanceof j ? E(n.innerType()) : n instanceof le ? [n.value] : n instanceof L ? n.options : n instanceof me ? b.objectValues(n.enum) : n instanceof pe ? E(n._def.innerType) : n instanceof ae ? [void 0] : n instanceof se ? [null] : n instanceof O ? [void 0, ...E(n.unwrap())] : n instanceof F ? [null, ...E(n.unwrap())] : n instanceof Re || n instanceof he ? E(n.unwrap()) : n instanceof fe ? E(n._def.innerType) : [];
1963
+ const E = (r) => r instanceof de ? E(r.schema) : r instanceof j ? E(r.innerType()) : r instanceof le ? [r.value] : r instanceof L ? r.options : r instanceof me ? b.objectValues(r.enum) : r instanceof pe ? E(r._def.innerType) : r instanceof ae ? [void 0] : r instanceof se ? [null] : r instanceof O ? [void 0, ...E(r.unwrap())] : r instanceof F ? [null, ...E(r.unwrap())] : r instanceof Re || r instanceof he ? E(r.unwrap()) : r instanceof fe ? E(r._def.innerType) : [];
1964
1964
  class Se extends _ {
1965
1965
  _parse(e) {
1966
1966
  const { ctx: t } = this._processInputParams(e);
@@ -2023,39 +2023,39 @@ class Se extends _ {
2023
2023
  });
2024
2024
  }
2025
2025
  }
2026
- function De(n, e) {
2027
- const t = R(n), i = R(e);
2028
- if (n === e)
2029
- return { valid: !0, data: n };
2026
+ function Pe(r, e) {
2027
+ const t = R(r), i = R(e);
2028
+ if (r === e)
2029
+ return { valid: !0, data: r };
2030
2030
  if (t === p.object && i === p.object) {
2031
- const a = b.objectKeys(e), s = b.objectKeys(n).filter((c) => a.indexOf(c) !== -1), o = { ...n, ...e };
2031
+ const a = b.objectKeys(e), s = b.objectKeys(r).filter((c) => a.indexOf(c) !== -1), o = { ...r, ...e };
2032
2032
  for (const c of s) {
2033
- const l = De(n[c], e[c]);
2033
+ const l = Pe(r[c], e[c]);
2034
2034
  if (!l.valid)
2035
2035
  return { valid: !1 };
2036
2036
  o[c] = l.data;
2037
2037
  }
2038
2038
  return { valid: !0, data: o };
2039
2039
  } else if (t === p.array && i === p.array) {
2040
- if (n.length !== e.length)
2040
+ if (r.length !== e.length)
2041
2041
  return { valid: !1 };
2042
2042
  const a = [];
2043
- for (let s = 0; s < n.length; s++) {
2044
- const o = n[s], c = e[s], l = De(o, c);
2043
+ for (let s = 0; s < r.length; s++) {
2044
+ const o = r[s], c = e[s], l = Pe(o, c);
2045
2045
  if (!l.valid)
2046
2046
  return { valid: !1 };
2047
2047
  a.push(l.data);
2048
2048
  }
2049
2049
  return { valid: !0, data: a };
2050
- } else return t === p.date && i === p.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
2050
+ } else return t === p.date && i === p.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
2051
2051
  }
2052
2052
  class ce extends _ {
2053
2053
  _parse(e) {
2054
2054
  const { status: t, ctx: i } = this._processInputParams(e), a = (s, o) => {
2055
2055
  if (Oe(s) || Oe(o))
2056
2056
  return y;
2057
- const c = De(s.value, o.value);
2058
- return c.valid ? ((Pe(s) || Pe(o)) && t.dirty(), { status: t.value, value: c.data }) : (m(i, {
2057
+ const c = Pe(s.value, o.value);
2058
+ return c.valid ? ((De(s) || De(o)) && t.dirty(), { status: t.value, value: c.data }) : (m(i, {
2059
2059
  code: d.invalid_intersection_types
2060
2060
  }), y);
2061
2061
  };
@@ -2081,13 +2081,13 @@ class ce extends _ {
2081
2081
  }));
2082
2082
  }
2083
2083
  }
2084
- ce.create = (n, e, t) => new ce({
2085
- left: n,
2084
+ ce.create = (r, e, t) => new ce({
2085
+ left: r,
2086
2086
  right: e,
2087
2087
  typeName: g.ZodIntersection,
2088
2088
  ...v(t)
2089
2089
  });
2090
- class D extends _ {
2090
+ class P extends _ {
2091
2091
  _parse(e) {
2092
2092
  const { status: t, ctx: i } = this._processInputParams(e);
2093
2093
  if (i.parsedType !== p.array)
@@ -2113,7 +2113,7 @@ class D extends _ {
2113
2113
  }), t.dirty());
2114
2114
  const s = [...i.data].map((o, c) => {
2115
2115
  const l = this._def.items[c] || this._def.rest;
2116
- return l ? l._parse(new P(i, o, i.path, c)) : null;
2116
+ return l ? l._parse(new D(i, o, i.path, c)) : null;
2117
2117
  }).filter((o) => !!o);
2118
2118
  return i.common.async ? Promise.all(s).then((o) => T.mergeArray(t, o)) : T.mergeArray(t, s);
2119
2119
  }
@@ -2121,17 +2121,17 @@ class D extends _ {
2121
2121
  return this._def.items;
2122
2122
  }
2123
2123
  rest(e) {
2124
- return new D({
2124
+ return new P({
2125
2125
  ...this._def,
2126
2126
  rest: e
2127
2127
  });
2128
2128
  }
2129
2129
  }
2130
- D.create = (n, e) => {
2131
- if (!Array.isArray(n))
2130
+ P.create = (r, e) => {
2131
+ if (!Array.isArray(r))
2132
2132
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2133
- return new D({
2134
- items: n,
2133
+ return new P({
2134
+ items: r,
2135
2135
  typeName: g.ZodTuple,
2136
2136
  rest: null,
2137
2137
  ...v(e)
@@ -2155,8 +2155,8 @@ class ue extends _ {
2155
2155
  const a = [], s = this._def.keyType, o = this._def.valueType;
2156
2156
  for (const c in i.data)
2157
2157
  a.push({
2158
- key: s._parse(new P(i, c, i.path, c)),
2159
- value: o._parse(new P(i, i.data[c], i.path, c)),
2158
+ key: s._parse(new D(i, c, i.path, c)),
2159
+ value: o._parse(new D(i, i.data[c], i.path, c)),
2160
2160
  alwaysSet: c in i.data
2161
2161
  });
2162
2162
  return i.common.async ? T.mergeObjectAsync(t, a) : T.mergeObjectSync(t, a);
@@ -2194,8 +2194,8 @@ class we extends _ {
2194
2194
  received: i.parsedType
2195
2195
  }), y;
2196
2196
  const a = this._def.keyType, s = this._def.valueType, o = [...i.data.entries()].map(([c, l], u) => ({
2197
- key: a._parse(new P(i, c, i.path, [u, "key"])),
2198
- value: s._parse(new P(i, l, i.path, [u, "value"]))
2197
+ key: a._parse(new D(i, c, i.path, [u, "key"])),
2198
+ value: s._parse(new D(i, l, i.path, [u, "value"]))
2199
2199
  }));
2200
2200
  if (i.common.async) {
2201
2201
  const c = /* @__PURE__ */ new Map();
@@ -2220,9 +2220,9 @@ class we extends _ {
2220
2220
  }
2221
2221
  }
2222
2222
  }
2223
- we.create = (n, e, t) => new we({
2223
+ we.create = (r, e, t) => new we({
2224
2224
  valueType: e,
2225
- keyType: n,
2225
+ keyType: r,
2226
2226
  typeName: g.ZodMap,
2227
2227
  ...v(t)
2228
2228
  });
@@ -2261,7 +2261,7 @@ class W extends _ {
2261
2261
  }
2262
2262
  return { status: t.value, value: u };
2263
2263
  }
2264
- const c = [...i.data.values()].map((l, u) => s._parse(new P(i, l, i.path, u)));
2264
+ const c = [...i.data.values()].map((l, u) => s._parse(new D(i, l, i.path, u)));
2265
2265
  return i.common.async ? Promise.all(c).then((l) => o(l)) : o(c);
2266
2266
  }
2267
2267
  min(e, t) {
@@ -2283,8 +2283,8 @@ class W extends _ {
2283
2283
  return this.min(1, e);
2284
2284
  }
2285
2285
  }
2286
- W.create = (n, e) => new W({
2287
- valueType: n,
2286
+ W.create = (r, e) => new W({
2287
+ valueType: r,
2288
2288
  minSize: null,
2289
2289
  maxSize: null,
2290
2290
  typeName: g.ZodSet,
@@ -2367,7 +2367,7 @@ class X extends _ {
2367
2367
  args(...e) {
2368
2368
  return new X({
2369
2369
  ...this._def,
2370
- args: D.create(e).rest(U.create())
2370
+ args: P.create(e).rest(U.create())
2371
2371
  });
2372
2372
  }
2373
2373
  returns(e) {
@@ -2384,7 +2384,7 @@ class X extends _ {
2384
2384
  }
2385
2385
  static create(e, t, i) {
2386
2386
  return new X({
2387
- args: e || D.create([]).rest(U.create()),
2387
+ args: e || P.create([]).rest(U.create()),
2388
2388
  returns: t || U.create(),
2389
2389
  typeName: g.ZodFunction,
2390
2390
  ...v(i)
@@ -2400,8 +2400,8 @@ class de extends _ {
2400
2400
  return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2401
2401
  }
2402
2402
  }
2403
- de.create = (n, e) => new de({
2404
- getter: n,
2403
+ de.create = (r, e) => new de({
2404
+ getter: r,
2405
2405
  typeName: g.ZodLazy,
2406
2406
  ...v(e)
2407
2407
  });
@@ -2421,14 +2421,14 @@ class le extends _ {
2421
2421
  return this._def.value;
2422
2422
  }
2423
2423
  }
2424
- le.create = (n, e) => new le({
2425
- value: n,
2424
+ le.create = (r, e) => new le({
2425
+ value: r,
2426
2426
  typeName: g.ZodLiteral,
2427
2427
  ...v(e)
2428
2428
  });
2429
- function Ge(n, e) {
2429
+ function Ge(r, e) {
2430
2430
  return new L({
2431
- values: n,
2431
+ values: r,
2432
2432
  typeName: g.ZodEnum,
2433
2433
  ...v(e)
2434
2434
  });
@@ -2521,8 +2521,8 @@ class me extends _ {
2521
2521
  }
2522
2522
  }
2523
2523
  ne = /* @__PURE__ */ new WeakMap();
2524
- me.create = (n, e) => new me({
2525
- values: n,
2524
+ me.create = (r, e) => new me({
2525
+ values: r,
2526
2526
  typeName: g.ZodNativeEnum,
2527
2527
  ...v(e)
2528
2528
  });
@@ -2545,8 +2545,8 @@ class H extends _ {
2545
2545
  })));
2546
2546
  }
2547
2547
  }
2548
- H.create = (n, e) => new H({
2549
- type: n,
2548
+ H.create = (r, e) => new H({
2549
+ type: r,
2550
2550
  typeName: g.ZodPromise,
2551
2551
  ...v(e)
2552
2552
  });
@@ -2627,15 +2627,15 @@ class j extends _ {
2627
2627
  b.assertNever(a);
2628
2628
  }
2629
2629
  }
2630
- j.create = (n, e, t) => new j({
2631
- schema: n,
2630
+ j.create = (r, e, t) => new j({
2631
+ schema: r,
2632
2632
  typeName: g.ZodEffects,
2633
2633
  effect: e,
2634
2634
  ...v(t)
2635
2635
  });
2636
- j.createWithPreprocess = (n, e, t) => new j({
2636
+ j.createWithPreprocess = (r, e, t) => new j({
2637
2637
  schema: e,
2638
- effect: { type: "preprocess", transform: n },
2638
+ effect: { type: "preprocess", transform: r },
2639
2639
  typeName: g.ZodEffects,
2640
2640
  ...v(t)
2641
2641
  });
@@ -2647,8 +2647,8 @@ class O extends _ {
2647
2647
  return this._def.innerType;
2648
2648
  }
2649
2649
  }
2650
- O.create = (n, e) => new O({
2651
- innerType: n,
2650
+ O.create = (r, e) => new O({
2651
+ innerType: r,
2652
2652
  typeName: g.ZodOptional,
2653
2653
  ...v(e)
2654
2654
  });
@@ -2660,8 +2660,8 @@ class F extends _ {
2660
2660
  return this._def.innerType;
2661
2661
  }
2662
2662
  }
2663
- F.create = (n, e) => new F({
2664
- innerType: n,
2663
+ F.create = (r, e) => new F({
2664
+ innerType: r,
2665
2665
  typeName: g.ZodNullable,
2666
2666
  ...v(e)
2667
2667
  });
@@ -2679,8 +2679,8 @@ class pe extends _ {
2679
2679
  return this._def.innerType;
2680
2680
  }
2681
2681
  }
2682
- pe.create = (n, e) => new pe({
2683
- innerType: n,
2682
+ pe.create = (r, e) => new pe({
2683
+ innerType: r,
2684
2684
  typeName: g.ZodDefault,
2685
2685
  defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2686
2686
  ...v(e)
@@ -2722,8 +2722,8 @@ class fe extends _ {
2722
2722
  return this._def.innerType;
2723
2723
  }
2724
2724
  }
2725
- fe.create = (n, e) => new fe({
2726
- innerType: n,
2725
+ fe.create = (r, e) => new fe({
2726
+ innerType: r,
2727
2727
  typeName: g.ZodCatch,
2728
2728
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2729
2729
  ...v(e)
@@ -2741,9 +2741,9 @@ class Te extends _ {
2741
2741
  return { status: "valid", value: e.data };
2742
2742
  }
2743
2743
  }
2744
- Te.create = (n) => new Te({
2744
+ Te.create = (r) => new Te({
2745
2745
  typeName: g.ZodNaN,
2746
- ...v(n)
2746
+ ...v(r)
2747
2747
  });
2748
2748
  const Et = Symbol("zod_brand");
2749
2749
  class Re extends _ {
@@ -2808,19 +2808,19 @@ class he extends _ {
2808
2808
  return this._def.innerType;
2809
2809
  }
2810
2810
  }
2811
- he.create = (n, e) => new he({
2812
- innerType: n,
2811
+ he.create = (r, e) => new he({
2812
+ innerType: r,
2813
2813
  typeName: g.ZodReadonly,
2814
2814
  ...v(e)
2815
2815
  });
2816
- function Le(n, e) {
2817
- const t = typeof n == "function" ? n(e) : typeof n == "string" ? { message: n } : n;
2816
+ function Le(r, e) {
2817
+ const t = typeof r == "function" ? r(e) : typeof r == "string" ? { message: r } : r;
2818
2818
  return typeof t == "string" ? { message: t } : t;
2819
2819
  }
2820
- function Je(n, e = {}, t) {
2821
- return n ? J.create().superRefine((i, a) => {
2820
+ function Je(r, e = {}, t) {
2821
+ return r ? J.create().superRefine((i, a) => {
2822
2822
  var s, o;
2823
- const c = n(i);
2823
+ const c = r(i);
2824
2824
  if (c instanceof Promise)
2825
2825
  return c.then((l) => {
2826
2826
  var u, f;
@@ -2839,22 +2839,22 @@ const Rt = {
2839
2839
  object: k.lazycreate
2840
2840
  };
2841
2841
  var g;
2842
- (function(n) {
2843
- n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
2842
+ (function(r) {
2843
+ r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
2844
2844
  })(g || (g = {}));
2845
- const $t = (n, e = {
2846
- message: `Input not instance of ${n.name}`
2847
- }) => Je((t) => t instanceof n, e), He = N.create, Ke = z.create, Mt = Te.create, zt = V.create, et = ie.create, Vt = B.create, Lt = xe.create, Ft = ae.create, Ut = se.create, qt = J.create, Bt = U.create, Wt = M.create, Qt = ke.create, Yt = C.create, Xt = k.create, Gt = k.strictCreate, Jt = oe.create, Ht = Se.create, Kt = ce.create, en = D.create, tn = ue.create, nn = we.create, rn = W.create, an = X.create, sn = de.create, on = le.create, cn = L.create, un = me.create, dn = H.create, Fe = j.create, ln = O.create, mn = F.create, pn = j.createWithPreprocess, fn = ge.create, hn = () => He().optional(), gn = () => Ke().optional(), yn = () => et().optional(), vn = {
2848
- string: (n) => N.create({ ...n, coerce: !0 }),
2849
- number: (n) => z.create({ ...n, coerce: !0 }),
2850
- boolean: (n) => ie.create({
2851
- ...n,
2845
+ const $t = (r, e = {
2846
+ message: `Input not instance of ${r.name}`
2847
+ }) => Je((t) => t instanceof r, e), He = N.create, Ke = z.create, Mt = Te.create, zt = V.create, et = ie.create, Vt = B.create, Lt = xe.create, Ft = ae.create, Ut = se.create, qt = J.create, Bt = U.create, Wt = M.create, Qt = ke.create, Yt = C.create, Xt = k.create, Gt = k.strictCreate, Jt = oe.create, Ht = Se.create, Kt = ce.create, en = P.create, tn = ue.create, nn = we.create, rn = W.create, an = X.create, sn = de.create, on = le.create, cn = L.create, un = me.create, dn = H.create, Fe = j.create, ln = O.create, mn = F.create, pn = j.createWithPreprocess, fn = ge.create, hn = () => He().optional(), gn = () => Ke().optional(), yn = () => et().optional(), vn = {
2848
+ string: (r) => N.create({ ...r, coerce: !0 }),
2849
+ number: (r) => z.create({ ...r, coerce: !0 }),
2850
+ boolean: (r) => ie.create({
2851
+ ...r,
2852
2852
  coerce: !0
2853
2853
  }),
2854
- bigint: (n) => V.create({ ...n, coerce: !0 }),
2855
- date: (n) => B.create({ ...n, coerce: !0 })
2854
+ bigint: (r) => V.create({ ...r, coerce: !0 }),
2855
+ date: (r) => B.create({ ...r, coerce: !0 })
2856
2856
  }, _n = y;
2857
- var r = /* @__PURE__ */ Object.freeze({
2857
+ var n = /* @__PURE__ */ Object.freeze({
2858
2858
  __proto__: null,
2859
2859
  defaultErrorMap: G,
2860
2860
  setErrorMap: mt,
@@ -2867,7 +2867,7 @@ var r = /* @__PURE__ */ Object.freeze({
2867
2867
  DIRTY: Y,
2868
2868
  OK: S,
2869
2869
  isAborted: Oe,
2870
- isDirty: Pe,
2870
+ isDirty: De,
2871
2871
  isValid: q,
2872
2872
  isAsync: re,
2873
2873
  get util() {
@@ -2897,7 +2897,7 @@ var r = /* @__PURE__ */ Object.freeze({
2897
2897
  ZodUnion: oe,
2898
2898
  ZodDiscriminatedUnion: Se,
2899
2899
  ZodIntersection: ce,
2900
- ZodTuple: D,
2900
+ ZodTuple: P,
2901
2901
  ZodRecord: ue,
2902
2902
  ZodMap: we,
2903
2903
  ZodSet: W,
@@ -2970,290 +2970,290 @@ var r = /* @__PURE__ */ Object.freeze({
2970
2970
  quotelessJson: lt,
2971
2971
  ZodError: A
2972
2972
  });
2973
- const Ie = r.object({
2974
- country: r.string().optional(),
2975
- city: r.string().optional(),
2976
- street: r.string().optional(),
2977
- streetNumber: r.string().optional(),
2978
- floor: r.string().optional(),
2979
- apartmentEnterNumber: r.string().optional(),
2980
- apartmentNumber: r.string().optional(),
2981
- zip: r.string().optional()
2982
- }), $ = r.string().min(1, { message: "שדה חובה" }), Un = r.string().regex(/^\d+$/, "Must be a numeric string"), qn = r.object({ url: r.string().url(), id: r.string() });
2983
- function Bn(n) {
2984
- return !!(n != null && n.url);
2985
- }
2986
- const ye = r.object({
2987
- lang: r.enum(["he"]),
2988
- value: r.string()
2989
- }), tt = r.object({
2990
- id: r.string().min(1),
2991
- companyId: r.string().min(1),
2992
- storeId: r.string().min(1),
2993
- parentId: r.string().nullish(),
2994
- tag: r.string().optional(),
2995
- locales: r.array(ye),
2996
- depth: r.number()
2973
+ const Ie = n.object({
2974
+ country: n.string().optional(),
2975
+ city: n.string().optional(),
2976
+ street: n.string().optional(),
2977
+ streetNumber: n.string().optional(),
2978
+ floor: n.string().optional(),
2979
+ apartmentEnterNumber: n.string().optional(),
2980
+ apartmentNumber: n.string().optional(),
2981
+ zip: n.string().optional()
2982
+ }), $ = n.string().min(1, { message: "שדה חובה" }), Un = n.string().regex(/^\d+$/, "Must be a numeric string"), qn = n.object({ url: n.string().url(), id: n.string() });
2983
+ function Bn(r) {
2984
+ return !!(r != null && r.url);
2985
+ }
2986
+ const ye = n.object({
2987
+ lang: n.enum(["he"]),
2988
+ value: n.string()
2989
+ }), tt = n.object({
2990
+ id: n.string().min(1),
2991
+ companyId: n.string().min(1),
2992
+ storeId: n.string().min(1),
2993
+ parentId: n.string().nullish(),
2994
+ tag: n.string().optional(),
2995
+ locales: n.array(ye),
2996
+ depth: n.number()
2997
2997
  }), $e = tt.extend({
2998
- children: r.lazy(() => $e.array())
2998
+ children: n.lazy(() => $e.array())
2999
2999
  }), Wn = tt.extend({
3000
- index: r.number(),
3001
- depth: r.number(),
3002
- collapsed: r.boolean().optional(),
3003
- children: r.array($e)
3004
- }), ee = r.string().min(1), Me = r.object({
3005
- type: r.literal("Product"),
3000
+ index: n.number(),
3001
+ depth: n.number(),
3002
+ collapsed: n.boolean().optional(),
3003
+ children: n.array($e)
3004
+ }), ee = n.string().min(1), Me = n.object({
3005
+ type: n.literal("Product"),
3006
3006
  storeId: ee,
3007
3007
  companyId: ee,
3008
3008
  id: ee,
3009
3009
  objectID: ee,
3010
3010
  sku: ee,
3011
- name: r.array(ye),
3012
- description: r.array(ye),
3013
- isPublished: r.boolean(),
3014
- vat: r.boolean(),
3015
- priceType: r.object({
3016
- type: r.enum(["unit", "kg", "gram", "liter", "ml"]),
3017
- value: r.number()
3011
+ name: n.array(ye),
3012
+ description: n.array(ye),
3013
+ isPublished: n.boolean(),
3014
+ vat: n.boolean(),
3015
+ priceType: n.object({
3016
+ type: n.enum(["unit", "kg", "gram", "liter", "ml"]),
3017
+ value: n.number()
3018
3018
  }),
3019
- price: r.number().positive(),
3020
- purchasePrice: r.number().optional(),
3021
- profitPercentage: r.number().optional(),
3022
- currency: r.literal("ILS"),
3023
- discount: r.object({
3024
- type: r.enum(["number", "percent", "none"]),
3025
- value: r.number()
3019
+ price: n.number().positive(),
3020
+ purchasePrice: n.number().optional(),
3021
+ profitPercentage: n.number().optional(),
3022
+ currency: n.literal("ILS"),
3023
+ discount: n.object({
3024
+ type: n.enum(["number", "percent", "none"]),
3025
+ value: n.number()
3026
3026
  }),
3027
- isDiscountable: r.boolean({ description: "included in store discounts" }).optional(),
3028
- weight: r.object({
3029
- value: r.number(),
3030
- unit: r.enum(["kg", "gram", "none"])
3027
+ isDiscountable: n.boolean({ description: "included in store discounts" }).optional(),
3028
+ weight: n.object({
3029
+ value: n.number(),
3030
+ unit: n.enum(["kg", "gram", "none"])
3031
3031
  }),
3032
- volume: r.object({
3033
- value: r.number(),
3034
- unit: r.enum(["liter", "ml", "none"])
3032
+ volume: n.object({
3033
+ value: n.number(),
3034
+ unit: n.enum(["liter", "ml", "none"])
3035
3035
  }),
3036
- images: r.array(r.object({ url: r.string().url(), id: r.string() })),
3037
- manufacturer: r.string(),
3038
- brand: r.string(),
3039
- importer: r.string(),
3040
- supplier: r.string(),
3041
- ingredients: r.array(ye),
3042
- created_at: r.number(),
3043
- updated_at: r.number(),
3044
- categoryIds: r.array(r.string().nonempty()),
3045
- stock: r.object({
3046
- quantity: r.number().min(0),
3047
- unit: r.enum(["piece", "kg", "gram", "liter", "ml"])
3036
+ images: n.array(n.object({ url: n.string().url(), id: n.string() })),
3037
+ manufacturer: n.string(),
3038
+ brand: n.string(),
3039
+ importer: n.string(),
3040
+ supplier: n.string(),
3041
+ ingredients: n.array(ye),
3042
+ created_at: n.number(),
3043
+ updated_at: n.number(),
3044
+ categoryIds: n.array(n.string().nonempty()),
3045
+ stock: n.object({
3046
+ quantity: n.number().min(0),
3047
+ unit: n.enum(["piece", "kg", "gram", "liter", "ml"])
3048
3048
  }).optional(),
3049
3049
  // @deprecated
3050
- categoryList: r.array($e).optional(),
3050
+ categoryList: n.array($e).optional(),
3051
3051
  // @deprecated
3052
- categories: r.object({
3053
- lvl0: r.array(r.string()),
3054
- lvl1: r.array(r.string()),
3055
- lvl2: r.array(r.string()),
3056
- lvl3: r.array(r.string()),
3057
- lvl4: r.array(r.string())
3052
+ categories: n.object({
3053
+ lvl0: n.array(n.string()),
3054
+ lvl1: n.array(n.string()),
3055
+ lvl2: n.array(n.string()),
3056
+ lvl3: n.array(n.string()),
3057
+ lvl4: n.array(n.string())
3058
3058
  }).optional(),
3059
3059
  // @deprecated
3060
- categoryNames: r.array(r.string()).optional()
3060
+ categoryNames: n.array(n.string()).optional()
3061
3061
  }), Qn = Me.extend({
3062
- image: r.instanceof(File).optional()
3063
- }), bn = r.enum(["delivered", "missing", "substituted"]), xn = r.object({
3062
+ image: n.instanceof(File).optional()
3063
+ }), bn = n.enum(["delivered", "missing", "substituted"]), xn = n.object({
3064
3064
  product: Me,
3065
- amount: r.number().positive(),
3066
- price: r.number()
3067
- }), nt = r.object({
3065
+ amount: n.number().positive(),
3066
+ price: n.number()
3067
+ }), nt = n.object({
3068
3068
  product: Me,
3069
- originalPrice: r.number().optional(),
3070
- finalPrice: r.number().optional(),
3071
- finalDiscount: r.number().optional(),
3072
- amount: r.number().positive({ message: "Quantity must be a positive number." }),
3069
+ originalPrice: n.number().optional(),
3070
+ finalPrice: n.number().optional(),
3071
+ finalDiscount: n.number().optional(),
3072
+ amount: n.number().positive({ message: "Quantity must be a positive number." }),
3073
3073
  // Picking / fulfillment — optional so existing items stay valid (treated as "delivered").
3074
3074
  status: bn.optional(),
3075
3075
  substitutedWith: xn.nullable().optional()
3076
- }), Yn = r.object({
3077
- type: r.literal("Cart"),
3078
- id: r.string().uuid(),
3079
- companyId: r.string().uuid(),
3080
- storeId: r.string().uuid(),
3081
- userId: r.string().uuid(),
3082
- status: r.enum(["active", "draft", "completed"]),
3083
- items: r.array(nt)
3084
- }), Xn = r.object({
3085
- id: r.string(),
3086
- name: r.string(),
3087
- websiteDomains: r.array(r.string())
3088
- }), Gn = r.object({
3089
- type: r.literal("FavoriteProduct"),
3090
- id: r.string().uuid(),
3091
- companyId: r.string().uuid(),
3092
- storeId: r.string().uuid(),
3093
- userId: r.string().uuid(),
3094
- productId: r.string().uuid()
3095
- }), Ae = r.enum(["external", "j5", "none"]), kn = r.object({
3096
- type: r.literal("Profile"),
3076
+ }), Yn = n.object({
3077
+ type: n.literal("Cart"),
3078
+ id: n.string().uuid(),
3079
+ companyId: n.string().uuid(),
3080
+ storeId: n.string().uuid(),
3081
+ userId: n.string().uuid(),
3082
+ status: n.enum(["active", "draft", "completed"]),
3083
+ items: n.array(nt)
3084
+ }), Xn = n.object({
3085
+ id: n.string(),
3086
+ name: n.string(),
3087
+ websiteDomains: n.array(n.string())
3088
+ }), Gn = n.object({
3089
+ type: n.literal("FavoriteProduct"),
3090
+ id: n.string().uuid(),
3091
+ companyId: n.string().uuid(),
3092
+ storeId: n.string().uuid(),
3093
+ userId: n.string().uuid(),
3094
+ productId: n.string().uuid()
3095
+ }), Ae = n.enum(["external", "j5", "none"]), kn = n.object({
3096
+ type: n.literal("Profile"),
3097
3097
  id: $,
3098
3098
  companyId: $,
3099
3099
  storeId: $,
3100
3100
  tenantId: $,
3101
3101
  // @deprecated
3102
- clientType: r.enum(["user", "company"]),
3103
- companyName: r.string().optional(),
3102
+ clientType: n.enum(["user", "company"]),
3103
+ companyName: n.string().optional(),
3104
3104
  displayName: $,
3105
- email: r.string().email(),
3106
- phoneNumber: r.string().optional(),
3105
+ email: n.string().email(),
3106
+ phoneNumber: n.string().optional(),
3107
3107
  address: Ie.optional(),
3108
- isAnonymous: r.boolean(),
3109
- createdDate: r.number(),
3110
- lastActivityDate: r.number(),
3108
+ isAnonymous: n.boolean(),
3109
+ createdDate: n.number(),
3110
+ lastActivityDate: n.number(),
3111
3111
  //todo
3112
3112
  paymentType: Ae.optional(),
3113
3113
  /** @deprecated Use organizationIds instead */
3114
- organizationId: r.string().optional().nullable(),
3114
+ organizationId: n.string().optional().nullable(),
3115
3115
  /** Array of organization IDs this user belongs to */
3116
- organizationIds: r.array(r.string()).optional()
3117
- }), rt = r.object({
3118
- _COMMENT: r.string().optional(),
3119
- transaction_id: r.string(),
3120
- date: r.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format"),
3121
- currency: r.string().length(3, "Currency must be 3 characters"),
3122
- rate: r.number().positive(),
3123
- vat: r.string().regex(/^\d+\.\d{2}$/, "VAT must be in format XX.XX"),
3124
- vat_price: r.number().positive(),
3125
- price_discount: r.number(),
3126
- price_discount_in_currency: r.number(),
3127
- price_total: r.string().regex(/^\d+\.\d{2}$/, "Price total must be in format XX.XX"),
3128
- price_total_in_currency: r.number().positive()
3129
- }), wn = r.object({
3130
- doc_uuid: r.string().uuid("Document UUID must be a valid UUID"),
3131
- pdf_link: r.string().url("PDF link must be a valid URL"),
3132
- pdf_link_copy: r.string().url("PDF copy link must be a valid URL"),
3133
- doc_number: r.string().min(1, "Document number is required"),
3134
- sent_mails: r.array(r.string().email("Each email must be valid")),
3135
- success: r.boolean(),
3136
- ua_uuid: r.string().uuid("UA UUID must be a valid UUID"),
3116
+ organizationIds: n.array(n.string()).optional()
3117
+ }), rt = n.object({
3118
+ _COMMENT: n.string().optional(),
3119
+ transaction_id: n.string(),
3120
+ date: n.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format"),
3121
+ currency: n.string().length(3, "Currency must be 3 characters"),
3122
+ rate: n.number().positive(),
3123
+ vat: n.string().regex(/^\d+\.\d{2}$/, "VAT must be in format XX.XX"),
3124
+ vat_price: n.number().positive(),
3125
+ price_discount: n.number(),
3126
+ price_discount_in_currency: n.number(),
3127
+ price_total: n.string().regex(/^\d+\.\d{2}$/, "Price total must be in format XX.XX"),
3128
+ price_total_in_currency: n.number().positive()
3129
+ }), wn = n.object({
3130
+ doc_uuid: n.string().uuid("Document UUID must be a valid UUID"),
3131
+ pdf_link: n.string().url("PDF link must be a valid URL"),
3132
+ pdf_link_copy: n.string().url("PDF copy link must be a valid URL"),
3133
+ doc_number: n.string().min(1, "Document number is required"),
3134
+ sent_mails: n.array(n.string().email("Each email must be valid")),
3135
+ success: n.boolean(),
3136
+ ua_uuid: n.string().uuid("UA UUID must be a valid UUID"),
3137
3137
  calculatedData: rt,
3138
- warning: r.string().optional(),
3139
- date: r.number().optional()
3140
- }), Tn = r.object({
3141
- id: r.string().min(1, "ID is required"),
3142
- number: r.string().min(1, "Number is required"),
3143
- date: r.number().min(1, "Date is required"),
3144
- createdAt: r.number().min(1, "Created at is required"),
3145
- status: r.enum(["pending", "paid", "cancelled"]),
3146
- companyDetails: r.object({
3147
- name: r.string().min(1, "Name is required").optional(),
3148
- address: r.string().min(1, "Address is required").optional(),
3149
- phone: r.string().min(1, "Phone is required").optional(),
3150
- email: r.string().email("Email must be valid").optional()
3138
+ warning: n.string().optional(),
3139
+ date: n.number().optional()
3140
+ }), Tn = n.object({
3141
+ id: n.string().min(1, "ID is required"),
3142
+ number: n.string().min(1, "Number is required"),
3143
+ date: n.number().min(1, "Date is required"),
3144
+ createdAt: n.number().min(1, "Created at is required"),
3145
+ status: n.enum(["pending", "paid", "cancelled"]),
3146
+ companyDetails: n.object({
3147
+ name: n.string().min(1, "Name is required").optional(),
3148
+ address: n.string().min(1, "Address is required").optional(),
3149
+ phone: n.string().min(1, "Phone is required").optional(),
3150
+ email: n.string().email("Email must be valid").optional()
3151
3151
  }).optional(),
3152
- clientDetails: r.object({
3153
- name: r.string().min(1, "Name is required").optional(),
3154
- address: r.string().min(1, "Address is required").optional(),
3155
- phone: r.string().min(1, "Phone is required").optional(),
3156
- email: r.string().email("Email must be valid").optional()
3152
+ clientDetails: n.object({
3153
+ name: n.string().min(1, "Name is required").optional(),
3154
+ address: n.string().min(1, "Address is required").optional(),
3155
+ phone: n.string().min(1, "Phone is required").optional(),
3156
+ email: n.string().email("Email must be valid").optional()
3157
3157
  }).optional(),
3158
- items: r.array(
3159
- r.object({
3160
- name: r.string().min(1, "Name is required").optional(),
3161
- price: r.number().min(1, "Price is required").optional(),
3162
- quantity: r.number().min(1, "Quantity is required").optional(),
3163
- total: r.number().min(1, "Total is required").optional()
3158
+ items: n.array(
3159
+ n.object({
3160
+ name: n.string().min(1, "Name is required").optional(),
3161
+ price: n.number().min(1, "Price is required").optional(),
3162
+ quantity: n.number().min(1, "Quantity is required").optional(),
3163
+ total: n.number().min(1, "Total is required").optional()
3164
3164
  })
3165
3165
  ).optional(),
3166
- total: r.number().min(1, "Total is required").optional(),
3167
- vat: r.number().min(1, "VAT is required").optional(),
3168
- link: r.string().url("Link must be a valid URL").optional()
3169
- }), Sn = r.enum([
3166
+ total: n.number().min(1, "Total is required").optional(),
3167
+ vat: n.number().min(1, "VAT is required").optional(),
3168
+ link: n.string().url("Link must be a valid URL").optional()
3169
+ }), Sn = n.enum([
3170
3170
  "credit",
3171
3171
  "net15",
3172
3172
  "net30",
3173
3173
  "net60",
3174
3174
  "net90"
3175
- ]), it = r.object({
3176
- number: r.string(),
3177
- name: r.string(),
3178
- id: r.string(),
3175
+ ]), it = n.object({
3176
+ number: n.string(),
3177
+ name: n.string(),
3178
+ id: n.string(),
3179
3179
  // Optional, admin-managed billing config (see company-edit-like-demo plan, Phase 2)
3180
3180
  payTerms: Sn.optional(),
3181
- creditLimit: r.number().optional(),
3182
- isPrimary: r.boolean().optional(),
3181
+ creditLimit: n.number().optional(),
3182
+ isPrimary: n.boolean().optional(),
3183
3183
  // Optional category restriction — when `restricted`, the account is limited to
3184
3184
  // `allowedCategories` (category ids). Order-time enforcement is a separate concern.
3185
- restricted: r.boolean().optional(),
3186
- allowedCategories: r.array(r.string()).optional()
3187
- }), In = r.object({
3188
- id: r.string(),
3189
- label: r.string(),
3190
- address: r.string().optional(),
3191
- phone: r.string().optional(),
3192
- isPrimary: r.boolean().optional()
3193
- }), An = r.object({
3194
- id: r.string(),
3195
- name: r.string(),
3196
- discountPercentage: r.number().positive().min(0).max(100).optional(),
3197
- nameOnInvoice: r.string().optional(),
3198
- billingAccounts: r.array(it),
3185
+ restricted: n.boolean().optional(),
3186
+ allowedCategories: n.array(n.string()).optional()
3187
+ }), In = n.object({
3188
+ id: n.string(),
3189
+ label: n.string(),
3190
+ address: n.string().optional(),
3191
+ phone: n.string().optional(),
3192
+ isPrimary: n.boolean().optional()
3193
+ }), An = n.object({
3194
+ id: n.string(),
3195
+ name: n.string(),
3196
+ discountPercentage: n.number().positive().min(0).max(100).optional(),
3197
+ nameOnInvoice: n.string().optional(),
3198
+ billingAccounts: n.array(it),
3199
3199
  paymentType: Ae,
3200
- companyNumber: r.string().optional(),
3200
+ companyNumber: n.string().optional(),
3201
3201
  address: Ie.optional(),
3202
- groupId: r.string().optional(),
3202
+ groupId: n.string().optional(),
3203
3203
  // Contact / billing details (admin-managed, optional — see company-edit-like-demo plan)
3204
- phone: r.string().optional(),
3205
- email: r.string().optional(),
3206
- notes: r.string().optional(),
3207
- freeShipping: r.boolean().optional(),
3208
- branches: r.array(In).optional()
3209
- }), Jn = An.omit({ id: !0 }), Ue = r.object({
3210
- doc_uuid: r.string().uuid("Document UUID must be a valid UUID"),
3211
- pdf_link: r.string().url("PDF link must be a valid URL"),
3212
- pdf_link_copy: r.string().url("PDF copy link must be a valid URL"),
3213
- doc_number: r.string().min(1, "Document number is required"),
3214
- sent_mails: r.array(r.string().email("Each email must be valid")),
3215
- success: r.boolean(),
3216
- ua_uuid: r.string().uuid("UA UUID must be a valid UUID"),
3204
+ phone: n.string().optional(),
3205
+ email: n.string().optional(),
3206
+ notes: n.string().optional(),
3207
+ freeShipping: n.boolean().optional(),
3208
+ branches: n.array(In).optional()
3209
+ }), Jn = An.omit({ id: !0 }), Ue = n.object({
3210
+ doc_uuid: n.string().uuid("Document UUID must be a valid UUID"),
3211
+ pdf_link: n.string().url("PDF link must be a valid URL"),
3212
+ pdf_link_copy: n.string().url("PDF copy link must be a valid URL"),
3213
+ doc_number: n.string().min(1, "Document number is required"),
3214
+ sent_mails: n.array(n.string().email("Each email must be valid")),
3215
+ success: n.boolean(),
3216
+ ua_uuid: n.string().uuid("UA UUID must be a valid UUID"),
3217
3217
  calculatedData: rt,
3218
- warning: r.string().optional(),
3219
- date: r.number().optional()
3220
- }), Nn = r.object({
3221
- id: r.string().min(1, "ID is required"),
3222
- number: r.string().min(1, "Number is required"),
3223
- date: r.string().min(1, "Date is required"),
3224
- createdAt: r.number().min(1, "Created at is required"),
3225
- status: r.enum(["pending", "paid", "cancelled"]),
3226
- companyDetails: r.object({
3227
- name: r.string().min(1, "Name is required").optional(),
3228
- address: r.string().min(1, "Address is required").optional(),
3229
- phone: r.string().min(1, "Phone is required").optional(),
3230
- email: r.string().email("Email must be valid").optional()
3218
+ warning: n.string().optional(),
3219
+ date: n.number().optional()
3220
+ }), Nn = n.object({
3221
+ id: n.string().min(1, "ID is required"),
3222
+ number: n.string().min(1, "Number is required"),
3223
+ date: n.string().min(1, "Date is required"),
3224
+ createdAt: n.number().min(1, "Created at is required"),
3225
+ status: n.enum(["pending", "paid", "cancelled"]),
3226
+ companyDetails: n.object({
3227
+ name: n.string().min(1, "Name is required").optional(),
3228
+ address: n.string().min(1, "Address is required").optional(),
3229
+ phone: n.string().min(1, "Phone is required").optional(),
3230
+ email: n.string().email("Email must be valid").optional()
3231
3231
  }).optional(),
3232
- clientDetails: r.object({
3233
- name: r.string().min(1, "Name is required").optional(),
3234
- address: r.string().min(1, "Address is required").optional(),
3235
- phone: r.string().min(1, "Phone is required").optional(),
3236
- email: r.string().email("Email must be valid").optional()
3232
+ clientDetails: n.object({
3233
+ name: n.string().min(1, "Name is required").optional(),
3234
+ address: n.string().min(1, "Address is required").optional(),
3235
+ phone: n.string().min(1, "Phone is required").optional(),
3236
+ email: n.string().email("Email must be valid").optional()
3237
3237
  }).optional(),
3238
- items: r.array(
3239
- r.object({
3240
- name: r.string().min(1, "Name is required").optional(),
3241
- price: r.number().min(1, "Price is required").optional(),
3242
- quantity: r.number().min(1, "Quantity is required").optional(),
3243
- total: r.number().min(1, "Total is required").optional()
3238
+ items: n.array(
3239
+ n.object({
3240
+ name: n.string().min(1, "Name is required").optional(),
3241
+ price: n.number().min(1, "Price is required").optional(),
3242
+ quantity: n.number().min(1, "Quantity is required").optional(),
3243
+ total: n.number().min(1, "Total is required").optional()
3244
3244
  })
3245
3245
  ).optional(),
3246
- total: r.number().min(1, "Total is required").optional(),
3247
- vat: r.number().min(1, "VAT is required").optional(),
3248
- link: r.string().url("Link must be a valid URL").optional()
3249
- }), Hn = r.object({
3250
- type: r.literal("Order"),
3251
- createdBy: r.enum(["user", "admin"]).optional(),
3246
+ total: n.number().min(1, "Total is required").optional(),
3247
+ vat: n.number().min(1, "VAT is required").optional(),
3248
+ link: n.string().url("Link must be a valid URL").optional()
3249
+ }), Hn = n.object({
3250
+ type: n.literal("Order"),
3251
+ createdBy: n.enum(["user", "admin"]).optional(),
3252
3252
  id: $,
3253
3253
  companyId: $,
3254
3254
  storeId: $,
3255
3255
  userId: $,
3256
- status: r.enum([
3256
+ status: n.enum([
3257
3257
  "draft",
3258
3258
  // before payment
3259
3259
  "pending",
@@ -3268,53 +3268,53 @@ const ye = r.object({
3268
3268
  "refunded"
3269
3269
  ]),
3270
3270
  paymentType: Ae.optional(),
3271
- paymentStatus: r.enum(["pending", "pending_j5", "external", "completed", "failed", "refunded"]),
3271
+ paymentStatus: n.enum(["pending", "pending_j5", "external", "completed", "failed", "refunded"]),
3272
3272
  //todo check if hyp support partial refund
3273
- cart: r.object({
3274
- id: r.string(),
3275
- items: r.array(nt),
3276
- cartDiscount: r.number(),
3277
- cartTotal: r.number(),
3278
- cartVat: r.number(),
3279
- deliveryPrice: r.number().optional()
3273
+ cart: n.object({
3274
+ id: n.string(),
3275
+ items: n.array(nt),
3276
+ cartDiscount: n.number(),
3277
+ cartTotal: n.number(),
3278
+ cartVat: n.number(),
3279
+ deliveryPrice: n.number().optional()
3280
3280
  // final delivery price for cart
3281
3281
  }),
3282
- storeOptions: r.object({
3283
- deliveryPrice: r.number().optional(),
3284
- freeDeliveryPrice: r.number().optional(),
3285
- isVatIncludedInPrice: r.boolean().optional(),
3282
+ storeOptions: n.object({
3283
+ deliveryPrice: n.number().optional(),
3284
+ freeDeliveryPrice: n.number().optional(),
3285
+ isVatIncludedInPrice: n.boolean().optional(),
3286
3286
  // True when the ordering organization is exempt from delivery fees
3287
3287
  // ("פטור מדמי משלוח"). Persisted so any later recompute (admin edit,
3288
3288
  // invoice generation) keeps the exemption.
3289
- freeShipping: r.boolean().optional()
3289
+ freeShipping: n.boolean().optional()
3290
3290
  }).optional(),
3291
- originalAmount: r.number().positive().optional(),
3291
+ originalAmount: n.number().positive().optional(),
3292
3292
  // what client pay
3293
- actualAmount: r.number().positive().optional(),
3293
+ actualAmount: n.number().positive().optional(),
3294
3294
  // what store charge
3295
- date: r.number(),
3296
- deliveryDate: r.coerce.number(),
3295
+ date: n.number(),
3296
+ deliveryDate: n.coerce.number(),
3297
3297
  client: kn.optional(),
3298
3298
  address: Ie.optional(),
3299
- nameOnInvoice: r.string().optional(),
3300
- emailOnInvoice: r.string().email().optional(),
3301
- phoneNumberOnInvoice: r.string().optional(),
3302
- clientComment: r.string().optional(),
3299
+ nameOnInvoice: n.string().optional(),
3300
+ emailOnInvoice: n.string().email().optional(),
3301
+ phoneNumberOnInvoice: n.string().optional(),
3302
+ clientComment: n.string().optional(),
3303
3303
  // --- B2B buyer details (optional, additive — back-compat) ---
3304
- companyName: r.string().optional(),
3305
- companyNumber: r.string().optional(),
3304
+ companyName: n.string().optional(),
3305
+ companyNumber: n.string().optional(),
3306
3306
  // ח.פ / עוסק מורשה (aligns with Organization.companyNumber)
3307
- contact: r.object({
3308
- fullName: r.string().optional(),
3309
- role: r.string().optional(),
3307
+ contact: n.object({
3308
+ fullName: n.string().optional(),
3309
+ role: n.string().optional(),
3310
3310
  // תפקיד
3311
- phone: r.string().optional(),
3312
- email: r.string().optional()
3311
+ phone: n.string().optional(),
3312
+ email: n.string().optional()
3313
3313
  }).optional(),
3314
- poNumber: r.string().optional(),
3314
+ poNumber: n.string().optional(),
3315
3315
  // הזמנת רכש
3316
- outOfStockPolicy: r.enum(["substitute", "remove"]).optional(),
3317
- organizationId: r.string().optional(),
3316
+ outOfStockPolicy: n.enum(["substitute", "remove"]).optional(),
3317
+ organizationId: n.string().optional(),
3318
3318
  billingAccount: it.optional(),
3319
3319
  deliveryNote: Tn.optional(),
3320
3320
  invoice: Nn.optional(),
@@ -3325,7 +3325,7 @@ const ye = r.object({
3325
3325
  * Epoch millis. Absent means no payment has been recorded via the admin payment flow.
3326
3326
  * A row is "open" iff: invoice exists AND invoicePaidAt is unset AND ezReceipt is unset.
3327
3327
  */
3328
- invoicePaidAt: r.number().int().positive().optional(),
3328
+ invoicePaidAt: n.number().int().positive().optional(),
3329
3329
  /**
3330
3330
  * EZcount receipt stored after recording payment.
3331
3331
  * Mirrors EzInvoiceSchema shape (doc_uuid, pdf_link, doc_number, …).
@@ -3333,48 +3333,48 @@ const ye = r.object({
3333
3333
  */
3334
3334
  ezReceipt: Ue.optional(),
3335
3335
  // Audit: who last changed the order + when (epoch millis). Stamped by admin writes.
3336
- updatedBy: r.string().optional(),
3337
- updatedAt: r.number().optional()
3338
- }), Cn = r.enum(["individual", "company"]), Kn = r.object({
3339
- id: r.string(),
3340
- companyId: r.string(),
3341
- name: r.string(),
3342
- urls: r.array(r.string()),
3343
- logoUrl: r.string(),
3344
- tenantId: r.string(),
3336
+ updatedBy: n.string().optional(),
3337
+ updatedAt: n.number().optional()
3338
+ }), Cn = n.enum(["individual", "company"]), Kn = n.object({
3339
+ id: n.string(),
3340
+ companyId: n.string(),
3341
+ name: n.string(),
3342
+ urls: n.array(n.string()),
3343
+ logoUrl: n.string(),
3344
+ tenantId: n.string(),
3345
3345
  // firebase auth tenantId
3346
3346
  paymentType: Ae,
3347
- allowAnonymousClients: r.boolean(),
3348
- isVatIncludedInPrice: r.boolean(),
3349
- clientTypes: r.array(Cn),
3350
- minimumOrder: r.number().optional(),
3351
- freeDeliveryPrice: r.number().optional(),
3352
- deliveryPrice: r.number().optional(),
3347
+ allowAnonymousClients: n.boolean(),
3348
+ isVatIncludedInPrice: n.boolean(),
3349
+ clientTypes: n.array(Cn),
3350
+ minimumOrder: n.number().optional(),
3351
+ freeDeliveryPrice: n.number().optional(),
3352
+ deliveryPrice: n.number().optional(),
3353
3353
  address: Ie.optional(),
3354
- companyNumber: r.string().optional()
3354
+ companyNumber: n.string().optional()
3355
3355
  // חפ של החברה
3356
- }), jn = r.object({
3357
- minSpend: r.number().positive().optional(),
3358
- stackable: r.boolean().default(!1)
3359
- }).optional(), Zn = r.discriminatedUnion("variantType", [
3360
- r.object({
3361
- variantType: r.literal("bundle"),
3362
- productsId: r.array(r.string().nonempty()).min(1),
3356
+ }), jn = n.object({
3357
+ minSpend: n.number().positive().optional(),
3358
+ stackable: n.boolean().default(!1)
3359
+ }).optional(), Zn = n.discriminatedUnion("variantType", [
3360
+ n.object({
3361
+ variantType: n.literal("bundle"),
3362
+ productsId: n.array(n.string().nonempty()).min(1),
3363
3363
  // Which products are included
3364
- requiredQuantity: r.number().positive(),
3364
+ requiredQuantity: n.number().positive(),
3365
3365
  // How many items needed (e.g., 3)
3366
- bundlePrice: r.number().positive()
3366
+ bundlePrice: n.number().positive()
3367
3367
  // Total price for the bundle (e.g., $25)
3368
3368
  })
3369
- ]), er = r.object({
3370
- type: r.literal("Discount"),
3371
- storeId: r.string().min(1),
3372
- companyId: r.string().min(1),
3373
- id: r.string().min(1),
3374
- name: r.array(r.object({ lang: r.enum(["he"]), value: r.string().nonempty() })),
3375
- active: r.boolean(),
3376
- startDate: r.number(),
3377
- endDate: r.number(),
3369
+ ]), er = n.object({
3370
+ type: n.literal("Discount"),
3371
+ storeId: n.string().min(1),
3372
+ companyId: n.string().min(1),
3373
+ id: n.string().min(1),
3374
+ name: n.array(n.object({ lang: n.enum(["he"]), value: n.string().nonempty() })),
3375
+ active: n.boolean(),
3376
+ startDate: n.number(),
3377
+ endDate: n.number(),
3378
3378
  variant: Zn,
3379
3379
  conditions: jn
3380
3380
  });
@@ -3511,100 +3511,100 @@ class tr {
3511
3511
  return this.filterActiveDiscounts(e);
3512
3512
  }
3513
3513
  }
3514
- const Pn = r.object({
3515
- id: r.string(),
3516
- name: r.string()
3517
- }), nr = Pn.omit({ id: !0 }), st = r.object({
3518
- type: r.literal("Supplier"),
3519
- id: r.string(),
3520
- name: r.string(),
3521
- code: r.string()
3514
+ const Dn = n.object({
3515
+ id: n.string(),
3516
+ name: n.string()
3517
+ }), nr = Dn.omit({ id: !0 }), st = n.object({
3518
+ type: n.literal("Supplier"),
3519
+ id: n.string(),
3520
+ name: n.string(),
3521
+ code: n.string()
3522
3522
  // supplier code number
3523
- }), rr = st.omit({ id: !0 }), Dn = r.object({
3524
- type: r.literal("SupplierInvoice"),
3525
- id: r.string(),
3523
+ }), rr = st.omit({ id: !0 }), Pn = n.object({
3524
+ type: n.literal("SupplierInvoice"),
3525
+ id: n.string(),
3526
3526
  // "draft" = work-in-progress, NOT yet finalized. Product prices are only
3527
3527
  // updated once the invoice is finalized ("completed"). Legacy invoices have
3528
3528
  // no status and are treated as finalized.
3529
- status: r.enum(["draft", "completed"]).optional(),
3529
+ status: n.enum(["draft", "completed"]).optional(),
3530
3530
  supplier: st,
3531
- invoiceNumber: r.string(),
3532
- date: r.number(),
3533
- rows: r.array(
3534
- r.object({
3535
- id: r.string(),
3536
- rowNumber: r.number(),
3537
- sku: r.string(),
3538
- itemName: r.string(),
3539
- quantity: r.number(),
3540
- purchasePrice: r.number(),
3541
- lineDiscount: r.number(),
3542
- profitPercentage: r.number(),
3543
- price: r.number(),
3544
- totalPurchasePrice: r.number(),
3545
- vat: r.boolean(),
3546
- originalProduct: r.object({
3547
- purchasePrice: r.number(),
3548
- price: r.number(),
3549
- profitPercentage: r.number()
3531
+ invoiceNumber: n.string(),
3532
+ date: n.number(),
3533
+ rows: n.array(
3534
+ n.object({
3535
+ id: n.string(),
3536
+ rowNumber: n.number(),
3537
+ sku: n.string(),
3538
+ itemName: n.string(),
3539
+ quantity: n.number(),
3540
+ purchasePrice: n.number(),
3541
+ lineDiscount: n.number(),
3542
+ profitPercentage: n.number(),
3543
+ price: n.number(),
3544
+ totalPurchasePrice: n.number(),
3545
+ vat: n.boolean(),
3546
+ originalProduct: n.object({
3547
+ purchasePrice: n.number(),
3548
+ price: n.number(),
3549
+ profitPercentage: n.number()
3550
3550
  }).optional()
3551
3551
  })
3552
3552
  ),
3553
- productsToUpdate: r.array(
3554
- r.object({
3555
- sku: r.string(),
3556
- itemName: r.string(),
3557
- oldPurchasePrice: r.number(),
3558
- newPurchasePrice: r.number(),
3559
- oldPrice: r.number(),
3560
- newPrice: r.number(),
3561
- oldProfitPercentage: r.number(),
3562
- newProfitPercentage: r.number()
3553
+ productsToUpdate: n.array(
3554
+ n.object({
3555
+ sku: n.string(),
3556
+ itemName: n.string(),
3557
+ oldPurchasePrice: n.number(),
3558
+ newPurchasePrice: n.number(),
3559
+ oldPrice: n.number(),
3560
+ newPrice: n.number(),
3561
+ oldProfitPercentage: n.number(),
3562
+ newProfitPercentage: n.number()
3563
3563
  })
3564
3564
  ),
3565
- total: r.number().optional(),
3566
- totalBeforeVat: r.number().optional(),
3567
- vat: r.number().optional()
3568
- }), ir = Dn.omit({ id: !0 }), En = r.enum(["debt_increase", "debt_reduction"]), ar = r.object({
3569
- recordId: r.string().min(1),
3570
- organizationId: r.string().min(1),
3571
- customerId: r.string(),
3565
+ total: n.number().optional(),
3566
+ totalBeforeVat: n.number().optional(),
3567
+ vat: n.number().optional()
3568
+ }), ir = Pn.omit({ id: !0 }), En = n.enum(["debt_increase", "debt_reduction"]), ar = n.object({
3569
+ recordId: n.string().min(1),
3570
+ organizationId: n.string().min(1),
3571
+ customerId: n.string(),
3572
3572
  // "system" when no acting user
3573
- customerName: r.string(),
3574
- billingAccountId: r.string().nullable(),
3573
+ customerName: n.string(),
3574
+ billingAccountId: n.string().nullable(),
3575
3575
  type: En,
3576
3576
  /** Integer agorot, always positive */
3577
- amount: r.number().int().positive(),
3578
- currency: r.literal("ILS"),
3577
+ amount: n.number().int().positive(),
3578
+ currency: n.literal("ILS"),
3579
3579
  /** orderId (debt_increase) | ledger transactionId (debt_reduction) */
3580
- relatedId: r.string().min(1),
3581
- source: r.enum(["order", "ledger", "manual"]),
3580
+ relatedId: n.string().min(1),
3581
+ source: n.enum(["order", "ledger", "manual"]),
3582
3582
  /** event that caused this — trace + idempotency key; null for manual */
3583
- causedByEventId: r.string().nullable(),
3583
+ causedByEventId: n.string().nullable(),
3584
3584
  /** epoch millis */
3585
- createdAt: r.number().int().positive(),
3585
+ createdAt: n.number().int().positive(),
3586
3586
  /** Asia/Jerusalem date parts */
3587
- year: r.number().int(),
3588
- month: r.number().int().min(1).max(12),
3587
+ year: n.number().int(),
3588
+ month: n.number().int().min(1).max(12),
3589
3589
  /** "2026-05" */
3590
- yearMonth: r.string(),
3591
- companyId: r.string().min(1),
3592
- storeId: r.string().min(1)
3593
- }), sr = r.object({
3590
+ yearMonth: n.string(),
3591
+ companyId: n.string().min(1),
3592
+ storeId: n.string().min(1)
3593
+ }), sr = n.object({
3594
3594
  /** = doc id */
3595
- organizationId: r.string().min(1),
3596
- organizationName: r.string(),
3595
+ organizationId: n.string().min(1),
3596
+ organizationName: n.string(),
3597
3597
  /** integer agorot — current outstanding debt */
3598
- totalCurrentDebt: r.number().int(),
3598
+ totalCurrentDebt: n.number().int(),
3599
3599
  /** lifetime sums (agorot) */
3600
- totalDebits: r.number().int(),
3601
- totalCredits: r.number().int(),
3602
- currency: r.literal("ILS"),
3600
+ totalDebits: n.number().int(),
3601
+ totalCredits: n.number().int(),
3602
+ currency: n.literal("ILS"),
3603
3603
  /** epoch millis */
3604
- updatedAt: r.number().int().positive(),
3605
- companyId: r.string().min(1),
3606
- storeId: r.string().min(1)
3607
- }), or = r.enum([
3604
+ updatedAt: n.number().int().positive(),
3605
+ companyId: n.string().min(1),
3606
+ storeId: n.string().min(1)
3607
+ }), or = n.enum([
3608
3608
  "delivery_note",
3609
3609
  "payment_received",
3610
3610
  "credit_note",
@@ -3615,63 +3615,94 @@ const Pn = r.object({
3615
3615
  // legacy
3616
3616
  "order_refunded"
3617
3617
  // legacy
3618
- ]), cr = r.enum(["check", "bank_transfer", "cash", "credit_card", "other"]), ur = r.object({
3618
+ ]), cr = n.enum(["check", "bank_transfer", "cash", "credit_card", "other"]), ur = n.object({
3619
3619
  /** = deterministic dedup doc id */
3620
- id: r.string().min(1),
3621
- organizationId: r.string().min(1),
3620
+ id: n.string().min(1),
3621
+ organizationId: n.string().min(1),
3622
3622
  /** "+" increases owed (accrual), "-" decreases owed (settlement/adjustment) */
3623
- sign: r.enum(["+", "-"]),
3624
- kind: r.enum(["accrual", "settlement", "adjustment"]),
3623
+ sign: n.enum(["+", "-"]),
3624
+ kind: n.enum(["accrual", "settlement", "adjustment"]),
3625
3625
  /** Integer agorot, always positive; sign carries direction */
3626
- amount: r.number().int().positive(),
3627
- currency: r.literal("ILS"),
3628
- source: r.enum(["delivery_note", "ledger_payment", "manual", "order_reversal"]),
3626
+ amount: n.number().int().positive(),
3627
+ currency: n.literal("ILS"),
3628
+ source: n.enum(["delivery_note", "ledger_payment", "manual", "order_reversal", "credit_note"]),
3629
3629
  /** Present for document-sourced accruals */
3630
- document: r.object({
3631
- type: r.enum(["delivery_note", "invoice"]),
3632
- id: r.string().min(1),
3633
- number: r.string().optional()
3630
+ document: n.object({
3631
+ type: n.enum(["delivery_note", "invoice", "credit_note"]),
3632
+ id: n.string().min(1),
3633
+ number: n.string().optional()
3634
3634
  }).optional(),
3635
3635
  /** Order id (accrual), ledger txId (settlement), or manual ref */
3636
- reference: r.object({
3637
- type: r.enum(["order", "transaction", "manual"]),
3638
- id: r.string().min(1)
3636
+ reference: n.object({
3637
+ type: n.enum(["order", "transaction", "manual"]),
3638
+ id: n.string().min(1)
3639
3639
  }).optional(),
3640
3640
  /** Optional sub-grouping within an org */
3641
- billingAccountId: r.string().nullable().optional(),
3641
+ billingAccountId: n.string().nullable().optional(),
3642
3642
  /** Deterministic dedup key; doc id is derived from this */
3643
- dedupKey: r.string().min(1),
3643
+ dedupKey: n.string().min(1),
3644
3644
  /** Event id when source is event-driven */
3645
- causedByEventId: r.string().optional(),
3645
+ causedByEventId: n.string().optional(),
3646
3646
  /** Epoch millis — used for date-range queries */
3647
- createdAt: r.number().int().positive(),
3648
- companyId: r.string().min(1),
3649
- storeId: r.string().min(1)
3650
- }), dr = r.object({
3647
+ createdAt: n.number().int().positive(),
3648
+ companyId: n.string().min(1),
3649
+ storeId: n.string().min(1)
3650
+ }), dr = n.object({
3651
3651
  /** = doc id */
3652
- organizationId: r.string().min(1),
3652
+ organizationId: n.string().min(1),
3653
3653
  /** Σ(+) − Σ(−), clamped ≥ 0; integer agorot. Non-zero only when totalAccrued > totalSettled. */
3654
- owed: r.number().int(),
3654
+ owed: n.number().int(),
3655
3655
  /**
3656
3656
  * Overpayment credit: max(0, totalSettled − totalAccrued); integer agorot, ≥ 0.
3657
3657
  * Non-zero only when org has paid MORE than it has accrued.
3658
3658
  * Visibility only — not client-spendable. At most one of {owed, credit} is non-zero.
3659
3659
  */
3660
- credit: r.number().int(),
3660
+ credit: n.number().int(),
3661
3661
  /** Lifetime Σ(+); integer agorot */
3662
- totalAccrued: r.number().int(),
3662
+ totalAccrued: n.number().int(),
3663
3663
  /** Lifetime Σ(−); integer agorot */
3664
- totalSettled: r.number().int(),
3665
- currency: r.literal("ILS"),
3664
+ totalSettled: n.number().int(),
3665
+ currency: n.literal("ILS"),
3666
3666
  /** Epoch millis */
3667
- updatedAt: r.number().int().positive(),
3668
- companyId: r.string().min(1),
3669
- storeId: r.string().min(1)
3667
+ updatedAt: n.number().int().positive(),
3668
+ companyId: n.string().min(1),
3669
+ storeId: n.string().min(1)
3670
+ }), lr = n.object({
3671
+ /** = deterministic doc id, derived from idempotencyKey */
3672
+ id: n.string().min(1),
3673
+ /** EZcount doc_number */
3674
+ number: n.string().min(1),
3675
+ /** EZcount doc_uuid */
3676
+ docUuid: n.string().min(1),
3677
+ /** EZcount pdf_link */
3678
+ pdfLink: n.string().min(1),
3679
+ /** EZcount pdf_link_copy */
3680
+ pdfLinkCopy: n.string().optional(),
3681
+ organizationId: n.string().min(1),
3682
+ billingAccountId: n.string().nullish(),
3683
+ /** Set when the credit note is linked to an existing invoice's order */
3684
+ orderId: n.string().nullish(),
3685
+ invoiceDocUuid: n.string().nullish(),
3686
+ invoiceNumber: n.string().nullish(),
3687
+ /** Integer agorot (1 ILS = 100 agorot), always positive; gross amount incl. VAT */
3688
+ amount: n.number().int().positive(),
3689
+ currency: n.literal("ILS"),
3690
+ /** Hebrew reason label */
3691
+ reason: n.string().min(1),
3692
+ note: n.string().nullish(),
3693
+ /** Epoch millis */
3694
+ creditDate: n.number().int().positive(),
3695
+ /** Epoch millis */
3696
+ createdAt: n.number().int().positive(),
3697
+ /** Admin uid */
3698
+ createdBy: n.string().min(1),
3699
+ companyId: n.string().min(1),
3700
+ storeId: n.string().min(1)
3670
3701
  }), Ee = {
3671
3702
  VAT: 18
3672
3703
  };
3673
- function Rn(n) {
3674
- return n.reduce((e, t) => {
3704
+ function Rn(r) {
3705
+ return r.reduce((e, t) => {
3675
3706
  if (t.status === "missing")
3676
3707
  return e;
3677
3708
  if (t.status === "substituted" && t.substitutedWith) {
@@ -3687,28 +3718,28 @@ function Rn(n) {
3687
3718
  return e.push(t), e;
3688
3719
  }, []);
3689
3720
  }
3690
- function $n(n, e) {
3721
+ function $n(r, e) {
3691
3722
  var t, i;
3692
- return ((t = n.discount) == null ? void 0 : t.type) === "percent" ? n.price * (n.discount.value ?? 100) / 100 : ((i = n.discount) == null ? void 0 : i.type) === "number" ? n.discount.value ?? 0 : 0;
3723
+ return ((t = r.discount) == null ? void 0 : t.type) === "percent" ? r.price * (r.discount.value ?? 100) / 100 : ((i = r.discount) == null ? void 0 : i.type) === "number" ? r.discount.value ?? 0 : 0;
3693
3724
  }
3694
- function Mn(n, e) {
3725
+ function Mn(r, e) {
3695
3726
  var i, a;
3696
- const t = e && n.vat ? n.price + n.price * Ee.VAT / 100 : n.price;
3697
- if (((i = n.discount) == null ? void 0 : i.type) === "percent") {
3698
- const s = t * n.discount.value / 100;
3699
- return n.price - s;
3727
+ const t = e && r.vat ? r.price + r.price * Ee.VAT / 100 : r.price;
3728
+ if (((i = r.discount) == null ? void 0 : i.type) === "percent") {
3729
+ const s = t * r.discount.value / 100;
3730
+ return r.price - s;
3700
3731
  }
3701
- return ((a = n.discount) == null ? void 0 : a.type) === "number" ? t - n.discount.value : t;
3732
+ return ((a = r.discount) == null ? void 0 : a.type) === "number" ? t - r.discount.value : t;
3702
3733
  }
3703
- function lr({
3704
- cart: n,
3734
+ function mr({
3735
+ cart: r,
3705
3736
  discounts: e,
3706
3737
  deliveryPrice: t = 0,
3707
3738
  freeDeliveryPrice: i = 0,
3708
3739
  freeShipping: a = !1,
3709
3740
  isVatIncludedInPrice: s = !1
3710
3741
  }) {
3711
- const c = Rn(n).map((u, f) => ({
3742
+ const c = Rn(r).map((u, f) => ({
3712
3743
  amount: u.amount,
3713
3744
  product: { ...u.product },
3714
3745
  originalPrice: u.product.price,
@@ -3772,38 +3803,39 @@ const zn = {
3772
3803
  paymentLinks: "paymentLinks",
3773
3804
  duplicateChargeAlerts: "duplicateChargeAlerts",
3774
3805
  organizationBalance: "organizationBalance",
3775
- organizationBalanceRollup: "organizationBalanceRollup"
3806
+ organizationBalanceRollup: "organizationBalanceRollup",
3807
+ creditNotes: "creditNotes"
3776
3808
  }, Ln = {
3777
3809
  systemCollections: zn,
3778
3810
  storeCollections: Vn,
3779
3811
  // for client and server
3780
3812
  getPath: ({
3781
- companyId: n,
3813
+ companyId: r,
3782
3814
  storeId: e,
3783
3815
  collectionName: t,
3784
3816
  id: i
3785
- }) => `${n}/${e}/${t}${i ? `/${i}` : ""}`,
3817
+ }) => `${r}/${e}/${t}${i ? `/${i}` : ""}`,
3786
3818
  getSubPath: ({
3787
- companyId: n,
3819
+ companyId: r,
3788
3820
  storeId: e,
3789
3821
  collectionName: t,
3790
3822
  subCollectionName: i,
3791
3823
  id: a,
3792
3824
  subId: s
3793
- }) => `${n}/${e}/${t}/${a}/${i}${s ? `/${s}` : ""}`,
3825
+ }) => `${r}/${e}/${t}/${a}/${i}${s ? `/${s}` : ""}`,
3794
3826
  // for firestore events
3795
- getDocPath: (n) => `{companyId}/{storeId}/${n}/{id}`,
3796
- getSubDocPath: (n, e, t) => `{companyId}/{storeId}/${n}/${e}/${t}/{id}`
3797
- }, mr = {
3827
+ getDocPath: (r) => `{companyId}/{storeId}/${r}/{id}`,
3828
+ getSubDocPath: (r, e, t) => `{companyId}/{storeId}/${r}/${e}/${t}/{id}`
3829
+ }, pr = {
3798
3830
  firestore: Ln
3799
3831
  }, qe = {
3800
- round: (n, e = 2) => {
3832
+ round: (r, e = 2) => {
3801
3833
  const t = 10 ** e;
3802
- return Math.round((n + Number.EPSILON) * t) / t;
3834
+ return Math.round((r + Number.EPSILON) * t) / t;
3803
3835
  }
3804
- }, pr = {
3805
- calcSalePriceFromMargin: (n, e) => n <= 0 || e <= 0 || n >= 100 ? e : qe.round(e / (1 - n / 100)),
3806
- calcMarginFromSalePrice: (n, e) => n <= 0 || e <= 0 ? 0 : qe.round((n - e) / n * 100)
3836
+ }, fr = {
3837
+ calcSalePriceFromMargin: (r, e) => r <= 0 || e <= 0 || r >= 100 ? e : qe.round(e / (1 - r / 100)),
3838
+ calcMarginFromSalePrice: (r, e) => r <= 0 || e <= 0 ? 0 : qe.round((r - e) / r * 100)
3807
3839
  };
3808
3840
  export {
3809
3841
  Ie as AddressSchema,
@@ -3819,6 +3851,7 @@ export {
3819
3851
  Yn as CartSchema,
3820
3852
  $e as CategorySchema,
3821
3853
  Xn as CompanySchema,
3854
+ lr as CreditNoteSchema,
3822
3855
  Tn as DeliveryNoteSchema,
3823
3856
  jn as DiscountConditionsSchema,
3824
3857
  tr as DiscountEngine,
@@ -3829,7 +3862,7 @@ export {
3829
3862
  Ue as EzInvoiceSchema,
3830
3863
  Gn as FavoriteProductSchema,
3831
3864
  qn as FileSchema,
3832
- mr as FirebaseAPI,
3865
+ pr as FirebaseAPI,
3833
3866
  bn as FulfillmentStatusSchema,
3834
3867
  Nn as InvoiceSchema,
3835
3868
  ye as LocaleSchema,
@@ -3842,7 +3875,7 @@ export {
3842
3875
  ur as OrganizationBalanceEntrySchema,
3843
3876
  dr as OrganizationBalanceRollupSchema,
3844
3877
  sr as OrganizationBudgetSchema,
3845
- Pn as OrganizationGroupSchema,
3878
+ Dn as OrganizationGroupSchema,
3846
3879
  An as OrganizationSchema,
3847
3880
  cr as PaymentMethodSchema,
3848
3881
  Sn as PaymentTermsSchema,
@@ -3851,17 +3884,17 @@ export {
3851
3884
  kn as ProfileSchema,
3852
3885
  Kn as StoreSchema,
3853
3886
  xn as SubstitutedWithSchema,
3854
- Dn as SupplierInvoiceSchema,
3887
+ Pn as SupplierInvoiceSchema,
3855
3888
  st as SupplierSchema,
3856
3889
  Wn as TFlattenCategorySchema,
3857
3890
  Cn as clientTypesSchema,
3858
- lr as getCartCost,
3891
+ mr as getCartCost,
3859
3892
  Rn as getFulfilledCartItems,
3860
3893
  Bn as isFile,
3861
3894
  qe as math,
3862
3895
  $ as notEmptyTextSchema,
3863
3896
  Un as numericTextSchema,
3864
- pr as storeCalculator,
3897
+ fr as storeCalculator,
3865
3898
  Vn as storeCollections,
3866
3899
  zn as systemCollections
3867
3900
  };