@stoker-platform/node-client 0.3.2 → 0.3.4

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/bundle.js CHANGED
@@ -4,9 +4,9 @@ import ze from "lodash/isEqual.js";
4
4
  import Wo from "lodash/merge.js";
5
5
  import jo from "lodash/set.js";
6
6
  import ye from "lodash/cloneDeep.js";
7
- import { getFirestore as ue, Timestamp as at, FieldValue as me } from "firebase-admin/firestore";
7
+ import { getFirestore as ue, Timestamp as lt, FieldValue as me } from "firebase-admin/firestore";
8
8
  import { getDatabase as si } from "firebase-admin/database";
9
- import { getAuth as yt } from "firebase-admin/auth";
9
+ import { getAuth as gt } from "firebase-admin/auth";
10
10
  const su = async (n, e, t, s) => new Promise((r, i) => {
11
11
  const o = Uo(n, e, { cwd: t || process.cwd(), env: { ...process.env, ...s } });
12
12
  let a = "";
@@ -179,7 +179,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
179
179
  return;
180
180
  }
181
181
  return l;
182
- }, rt = (n, e, t, s, r, i) => {
182
+ }, it = (n, e, t, s, r, i) => {
183
183
  const { labels: o } = e, a = r.collections?.[o.collection];
184
184
  let l = !0;
185
185
  if (!a || !r.Role)
@@ -468,25 +468,25 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
468
468
  if (r && !c)
469
469
  throw new Error("PERMISSION_DENIED");
470
470
  r && !Te("Create", c) && (u = !1), r && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
471
- !rt("Create", t, s, r, i, n) && (u = !1), t.auth && o && (r && !Wn(c) && (u = !1), Ls("create", n, e, t, s, r, i, o) || (u = !1));
471
+ !it("Create", t, s, r, i, n) && (u = !1), t.auth && o && (r && !Wn(c) && (u = !1), Ls("create", n, e, t, s, r, i, o) || (u = !1));
472
472
  for (const h of l) {
473
473
  const f = n[h.name];
474
474
  h.access && !jn(h, i) && f !== void 0 && (u = !1), f !== void 0 && !Zo(h, i) && (u = !1);
475
475
  }
476
476
  if (!u)
477
477
  throw new Error("PERMISSION_DENIED");
478
- }, Me = (n) => n && (n._methodName === "deleteField" || n.constructor.name === "DeleteTransform"), tt = (n) => {
478
+ }, Me = (n) => n && (n._methodName === "deleteField" || n.constructor.name === "DeleteTransform"), nt = (n) => {
479
479
  for (const e in n)
480
- Object.prototype.hasOwnProperty.call(n, e) && (Me(n[e]) ? delete n[e] : typeof n[e] == "object" && n[e] !== null && tt(n[e]));
480
+ Object.prototype.hasOwnProperty.call(n, e) && (Me(n[e]) ? delete n[e] : typeof n[e] == "object" && n[e] !== null && nt(n[e]));
481
481
  }, ir = (n, e, t, s, r, i, o, a, l, c) => {
482
482
  const { labels: u, fields: h } = s, f = o?.collections?.[u.collection], d = { ...e, ...n };
483
- tt(d);
483
+ nt(d);
484
484
  let m = !0, O = "";
485
485
  if (i && !f)
486
486
  throw new Error("PERMISSION_DENIED");
487
487
  i && !Te("Update", f) && (m = !1, O = "Authenticated user does not have Update access to this collection"), i && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
488
- (!rt("Update", s, r, i, o, e) || // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
489
- !rt("Update", s, r, i, o, d)) && (m = !1, O = "Authenticated user does not have Update access to this document"), a && (i && !Wn(f) && (m = !1, O = "Authenticated user does not have Auth access for this collection"), Ls("update", d, t, s, r, i, o, l, c, e, a) || (O = "Authenticated user does not have sufficient write access for this record", m = !1));
488
+ (!it("Update", s, r, i, o, e) || // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
489
+ !it("Update", s, r, i, o, d)) && (m = !1, O = "Authenticated user does not have Update access to this document"), a && (i && !Wn(f) && (m = !1, O = "Authenticated user does not have Auth access for this collection"), Ls("update", d, t, s, r, i, o, l, c, e, a) || (O = "Authenticated user does not have sufficient write access for this record", m = !1));
490
490
  for (const y of h) {
491
491
  const w = n[y.name];
492
492
  y.access && !jn(y, o) && w !== void 0 && (O = `Authenticated user does not have access to field ${y.name}`, m = !1), w !== void 0 && !ri(y, o) && (O = `Authenticated user does not have Update access to field ${y.name}`, m = !1);
@@ -498,7 +498,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
498
498
  let l = !0;
499
499
  if (!a)
500
500
  throw new Error("PERMISSION_DENIED");
501
- if (Te("Delete", a) || (l = !1), rt("Delete", t, s, r, i, n) || (l = !1), t.auth && n.User_ID && (Wn(a) || (l = !1), Ls("delete", n, e, t, s, r, i) || (l = !1)), !l)
501
+ if (Te("Delete", a) || (l = !1), it("Delete", t, s, r, i, n) || (l = !1), t.auth && n.User_ID && (Wn(a) || (l = !1), Ls("delete", n, e, t, s, r, i) || (l = !1)), !l)
502
502
  throw new Error("PERMISSION_DENIED");
503
503
  }, Jo = async (n, e, t, s, r) => {
504
504
  const { labels: i } = e, o = r.collections?.[i.collection];
@@ -507,7 +507,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
507
507
  a = !1;
508
508
  return;
509
509
  }
510
- if (Te("Read", o) || (a = !1), rt("Read", e, t, s, r, n) || (a = !1), !a)
510
+ if (Te("Read", o) || (a = !1), it("Read", e, t, s, r, n) || (a = !1), !a)
511
511
  throw new Error("PERMISSION_DENIED");
512
512
  }, Qo = async (n, e, t, s, r) => {
513
513
  const { labels: i } = e, o = r.collections?.[i.collection];
@@ -517,7 +517,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
517
517
  return;
518
518
  }
519
519
  if (Te("Read", o) || (a = !1), n.forEach((l) => {
520
- rt("Read", e, t, s, r, l) || (a = !1);
520
+ it("Read", e, t, s, r, l) || (a = !1);
521
521
  }), !a)
522
522
  throw new Error("PERMISSION_DENIED");
523
523
  }, Ko = (n, e, t) => {
@@ -559,7 +559,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
559
559
  i[o] = l;
560
560
  }
561
561
  return i;
562
- }, De = (n, e) => e.fields.filter((t) => t.name === n.name)[0], Kn = {
562
+ }, Ie = (n, e) => e.fields.filter((t) => t.name === n.name)[0], Kn = {
563
563
  global: {},
564
564
  collections: {}
565
565
  }, qt = (n, e) => n && typeof n == "function" ? e ? n(...e) : n() : n, ie = async (n, e) => {
@@ -603,7 +603,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
603
603
  Wo(Kn, h);
604
604
  }
605
605
  return c;
606
- }, lt = (n, e, t) => {
606
+ }, ct = (n, e, t) => {
607
607
  const s = Object.values(t.collections), { labels: r } = e;
608
608
  let i = !1;
609
609
  for (const o of s) {
@@ -626,7 +626,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
626
626
  });
627
627
  });
628
628
  }), r;
629
- }, Xn = (n) => JSON.stringify(n.map((e) => e.name)), mt = [
629
+ }, Xn = (n) => JSON.stringify(n.map((e) => e.name)), pt = [
630
630
  "id",
631
631
  "Collection_Path",
632
632
  "Last_Write_At",
@@ -638,7 +638,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
638
638
  "Created_At",
639
639
  "Saved_At",
640
640
  "Created_By"
641
- ], Zn = () => mt.map((n) => {
641
+ ], Zn = () => pt.map((n) => {
642
642
  let e = "", t;
643
643
  switch (n) {
644
644
  case "id":
@@ -734,17 +734,17 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
734
734
  }), r?.filter((c) => (!c.roles || c.roles.includes(e)) && c.field !== "Collection_Path").forEach((c) => {
735
735
  t.push(W(a, c.field));
736
736
  }), i?.range && i.range.fields.forEach((c) => {
737
- mt.includes(c) && t.push(W(a, c));
737
+ pt.includes(c) && t.push(W(a, c));
738
738
  }), o?.forEach((c) => {
739
739
  const u = W(s.concat(a), c.field);
740
- (!c.roles || c.roles.includes(e)) && u && (!u.access || u.access?.includes(e)) && mt.includes(c.field) && t.push(W(a, c.field));
740
+ (!c.roles || c.roles.includes(e)) && u && (!u.access || u.access?.includes(e)) && pt.includes(c.field) && t.push(W(a, c.field));
741
741
  }), ui(n, e).forEach((c) => {
742
- mt.includes(c.name) && t.push(W(a, c.name));
742
+ pt.includes(c.name) && t.push(W(a, c.name));
743
743
  }), [...new Set(t)];
744
744
  }, na = (n, e, t) => {
745
745
  const s = [], { fields: r, preloadCache: i } = e, o = Zn();
746
746
  i?.range && i.range.fields.forEach((c) => {
747
- mt.includes(c) ? s.push(W(o, c)) : s.push(W(r, c));
747
+ pt.includes(c) ? s.push(W(o, c)) : s.push(W(r, c));
748
748
  });
749
749
  const a = /* @__PURE__ */ new Set(), l = ci(e, t);
750
750
  return Object.entries(l).map(([c, u]) => {
@@ -837,7 +837,7 @@ async function ae(n, e, t, s) {
837
837
  if (n !== "setEmbedding" && (await es(n, e?.[n], s), n === "postWriteError"))
838
838
  return r;
839
839
  }
840
- const Us = (n, e, t, s, r, i, o, a, l, c) => (n == "create" && (t.Collection_Path = e, t.Created_At = a, t.Saved_At = l, t.Created_By = o || "System"), t.Last_Write_App = r, t.Last_Write_At = a, t.Last_Save_At = l, t.Last_Write_By = o || "System", t.Last_Write_Connection_Status = i, t.Last_Write_Version = s.version, t), dt = (n, e) => {
840
+ const Us = (n, e, t, s, r, i, o, a, l, c) => (n == "create" && (t.Collection_Path = e, t.Created_At = a, t.Saved_At = l, t.Created_By = o || "System"), t.Last_Write_App = r, t.Last_Write_At = a, t.Last_Save_At = l, t.Last_Write_By = o || "System", t.Last_Write_Connection_Status = i, t.Last_Write_Version = s.version, t), ft = (n, e) => {
841
841
  const { access: t, queries: s } = n, { serverReadOnly: r } = t, i = /* @__PURE__ */ new Set();
842
842
  if (s)
843
843
  for (const o of s) {
@@ -847,7 +847,7 @@ const Us = (n, e, t, s, r, i, o, a, l, c) => (n == "create" && (t.Collection_Pat
847
847
  return e.forEach((o) => {
848
848
  K(o) && ["OneToOne", "OneToMany"].includes(o.type) && o.sorting && (typeof o.sorting == "boolean" || !o.sorting.roles?.every((a) => r?.includes(a))) && i.add(o);
849
849
  }), i;
850
- }, gt = (n, e) => {
850
+ }, wt = (n, e) => {
851
851
  const { access: t, recordTitleField: s } = n, { serverReadOnly: r } = t, i = /* @__PURE__ */ new Set();
852
852
  return e.forEach((o) => {
853
853
  (s === o.name || o.sorting && (typeof o.sorting == "boolean" || !o.sorting.roles?.every((a) => r?.includes(a)))) && o.type === "String" && i.add(o);
@@ -862,13 +862,13 @@ const Us = (n, e, t, s, r, i, o, a, l, c) => (n == "create" && (t.Collection_Pat
862
862
  else if (e[`${i.name}_Array`] = Object.keys(e[i.name]), i.includeFields)
863
863
  for (const o of i.includeFields) {
864
864
  const a = t.collections[i.collection], l = W(a.fields, o);
865
- gt(a, [l]).size === 1 && Object.keys(e[i.name]).forEach((u) => {
865
+ wt(a, [l]).size === 1 && Object.keys(e[i.name]).forEach((u) => {
866
866
  e[i.name][u][o] ? e[i.name][u][`${o}_Lowercase`] = e[i.name][u][o].toLowerCase() : delete e[i.name][u][`${o}_Lowercase`];
867
867
  });
868
868
  }
869
869
  } else
870
870
  delete e[`${i.name}_Array`], delete e[`${i.name}_Single`];
871
- }), dt(n, s).forEach((i) => {
871
+ }), ft(n, s).forEach((i) => {
872
872
  if (e[i.name])
873
873
  if (Me(e[i.name]))
874
874
  e[`${i.name}_Single`] = e[i.name];
@@ -881,14 +881,14 @@ const Us = (n, e, t, s, r, i, o, a, l, c) => (n == "create" && (t.Collection_Pat
881
881
  }
882
882
  });
883
883
  }, Tn = (n, e) => {
884
- gt(n, n.fields).forEach((s) => {
884
+ wt(n, n.fields).forEach((s) => {
885
885
  e[s.name] ? e[`${s.name}_Lowercase`] = e[s.name].toLowerCase() : delete e[`${s.name}_Lowercase`];
886
886
  });
887
887
  }, ra = async (n, e, t, s) => {
888
888
  const { fields: r } = e;
889
889
  for (const i of t.fields) {
890
890
  const o = W(r, i.name);
891
- i.custom?.initialValue && !(s && o.access && !o.access.includes(s)) && (n[i.name] = await ie(i.custom.initialValue, [n]), gt(e, [o]).size === 1 && (n[`${i.name}_Lowercase`] = n[i.name].toLowerCase()));
891
+ i.custom?.initialValue && !(s && o.access && !o.access.includes(s)) && (n[i.name] = await ie(i.custom.initialValue, [n]), wt(e, [o]).size === 1 && (n[`${i.name}_Lowercase`] = n[i.name].toLowerCase()));
892
892
  }
893
893
  for (const i of r)
894
894
  s && i.access && !i.access.includes(s) || ("autoIncrement" in i && i.autoIncrement && !n[i.name] && (n[i.name] = "Pending"), !K(i) && i.nullable && n[i.name] === void 0 && (n[i.name] = null));
@@ -959,7 +959,7 @@ const U = te.arrayToEnum([
959
959
  "never",
960
960
  "map",
961
961
  "set"
962
- ]), Ke = (n) => {
962
+ ]), Xe = (n) => {
963
963
  switch (typeof n) {
964
964
  case "undefined":
965
965
  return U.undefined;
@@ -980,7 +980,7 @@ const U = te.arrayToEnum([
980
980
  default:
981
981
  return U.unknown;
982
982
  }
983
- }, D = te.arrayToEnum([
983
+ }, I = te.arrayToEnum([
984
984
  "invalid_type",
985
985
  "invalid_literal",
986
986
  "custom",
@@ -1065,52 +1065,52 @@ Be.create = (n) => new Be(n);
1065
1065
  const gs = (n, e) => {
1066
1066
  let t;
1067
1067
  switch (n.code) {
1068
- case D.invalid_type:
1068
+ case I.invalid_type:
1069
1069
  n.received === U.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
1070
1070
  break;
1071
- case D.invalid_literal:
1071
+ case I.invalid_literal:
1072
1072
  t = `Invalid literal value, expected ${JSON.stringify(n.expected, te.jsonStringifyReplacer)}`;
1073
1073
  break;
1074
- case D.unrecognized_keys:
1074
+ case I.unrecognized_keys:
1075
1075
  t = `Unrecognized key(s) in object: ${te.joinValues(n.keys, ", ")}`;
1076
1076
  break;
1077
- case D.invalid_union:
1077
+ case I.invalid_union:
1078
1078
  t = "Invalid input";
1079
1079
  break;
1080
- case D.invalid_union_discriminator:
1080
+ case I.invalid_union_discriminator:
1081
1081
  t = `Invalid discriminator value. Expected ${te.joinValues(n.options)}`;
1082
1082
  break;
1083
- case D.invalid_enum_value:
1083
+ case I.invalid_enum_value:
1084
1084
  t = `Invalid enum value. Expected ${te.joinValues(n.options)}, received '${n.received}'`;
1085
1085
  break;
1086
- case D.invalid_arguments:
1086
+ case I.invalid_arguments:
1087
1087
  t = "Invalid function arguments";
1088
1088
  break;
1089
- case D.invalid_return_type:
1089
+ case I.invalid_return_type:
1090
1090
  t = "Invalid function return type";
1091
1091
  break;
1092
- case D.invalid_date:
1092
+ case I.invalid_date:
1093
1093
  t = "Invalid date";
1094
1094
  break;
1095
- case D.invalid_string:
1095
+ case I.invalid_string:
1096
1096
  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}"` : te.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
1097
1097
  break;
1098
- case D.too_small:
1098
+ case I.too_small:
1099
1099
  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 === "bigint" ? 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";
1100
1100
  break;
1101
- case D.too_big:
1101
+ case I.too_big:
1102
1102
  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";
1103
1103
  break;
1104
- case D.custom:
1104
+ case I.custom:
1105
1105
  t = "Invalid input";
1106
1106
  break;
1107
- case D.invalid_intersection_types:
1107
+ case I.invalid_intersection_types:
1108
1108
  t = "Intersection results could not be merged";
1109
1109
  break;
1110
- case D.not_multiple_of:
1110
+ case I.not_multiple_of:
1111
1111
  t = `Number must be a multiple of ${n.multipleOf}`;
1112
1112
  break;
1113
- case D.not_finite:
1113
+ case I.not_finite:
1114
1114
  t = "Number must be finite";
1115
1115
  break;
1116
1116
  default:
@@ -1248,13 +1248,13 @@ class X {
1248
1248
  return this._def.description;
1249
1249
  }
1250
1250
  _getType(e) {
1251
- return Ke(e.data);
1251
+ return Xe(e.data);
1252
1252
  }
1253
1253
  _getOrReturnCtx(e, t) {
1254
1254
  return t || {
1255
1255
  common: e.parent.common,
1256
1256
  data: e.data,
1257
- parsedType: Ke(e.data),
1257
+ parsedType: Xe(e.data),
1258
1258
  schemaErrorMap: this._def.errorMap,
1259
1259
  path: e.path,
1260
1260
  parent: e.parent
@@ -1266,7 +1266,7 @@ class X {
1266
1266
  ctx: {
1267
1267
  common: e.parent.common,
1268
1268
  data: e.data,
1269
- parsedType: Ke(e.data),
1269
+ parsedType: Xe(e.data),
1270
1270
  schemaErrorMap: this._def.errorMap,
1271
1271
  path: e.path,
1272
1272
  parent: e.parent
@@ -1300,7 +1300,7 @@ class X {
1300
1300
  schemaErrorMap: this._def.errorMap,
1301
1301
  parent: null,
1302
1302
  data: e,
1303
- parsedType: Ke(e)
1303
+ parsedType: Xe(e)
1304
1304
  }, r = this._parseSync({ data: e, path: s.path, parent: s });
1305
1305
  return cr(s, r);
1306
1306
  }
@@ -1314,7 +1314,7 @@ class X {
1314
1314
  schemaErrorMap: this._def.errorMap,
1315
1315
  parent: null,
1316
1316
  data: e,
1317
- parsedType: Ke(e)
1317
+ parsedType: Xe(e)
1318
1318
  };
1319
1319
  if (!this["~standard"].async)
1320
1320
  try {
@@ -1353,7 +1353,7 @@ class X {
1353
1353
  schemaErrorMap: this._def.errorMap,
1354
1354
  parent: null,
1355
1355
  data: e,
1356
- parsedType: Ke(e)
1356
+ parsedType: Xe(e)
1357
1357
  }, r = this._parse({ data: e, path: s.path, parent: s }), i = await (Rn(r) ? r : Promise.resolve(r));
1358
1358
  return cr(s, i);
1359
1359
  }
@@ -1361,7 +1361,7 @@ class X {
1361
1361
  const s = (r) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(r) : t;
1362
1362
  return this._refinement((r, i) => {
1363
1363
  const o = e(r), a = () => i.addIssue({
1364
- code: D.custom,
1364
+ code: I.custom,
1365
1365
  ...s(r)
1366
1366
  });
1367
1367
  return typeof Promise < "u" && o instanceof Promise ? o.then((l) => l ? !0 : (a(), !1)) : o ? !0 : (a(), !1);
@@ -1388,7 +1388,7 @@ class X {
1388
1388
  };
1389
1389
  }
1390
1390
  optional() {
1391
- return nt.create(this, this._def);
1391
+ return st.create(this, this._def);
1392
1392
  }
1393
1393
  nullable() {
1394
1394
  return Ct.create(this, this._def);
@@ -1406,7 +1406,7 @@ class X {
1406
1406
  return xn.create([this, e], this._def);
1407
1407
  }
1408
1408
  and(e) {
1409
- return Dn.create(this, e, this._def);
1409
+ return In.create(this, e, this._def);
1410
1410
  }
1411
1411
  transform(e) {
1412
1412
  return new At({
@@ -1426,7 +1426,7 @@ class X {
1426
1426
  });
1427
1427
  }
1428
1428
  brand() {
1429
- return new Da({
1429
+ return new Ia({
1430
1430
  typeName: G.ZodBranded,
1431
1431
  type: this,
1432
1432
  ...J(this._def)
@@ -1502,7 +1502,7 @@ class qe extends X {
1502
1502
  if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== U.string) {
1503
1503
  const i = this._getOrReturnCtx(e);
1504
1504
  return L(i, {
1505
- code: D.invalid_type,
1505
+ code: I.invalid_type,
1506
1506
  expected: U.string,
1507
1507
  received: i.parsedType
1508
1508
  }), Y;
@@ -1512,7 +1512,7 @@ class qe extends X {
1512
1512
  for (const i of this._def.checks)
1513
1513
  if (i.kind === "min")
1514
1514
  e.data.length < i.value && (r = this._getOrReturnCtx(e, r), L(r, {
1515
- code: D.too_small,
1515
+ code: I.too_small,
1516
1516
  minimum: i.value,
1517
1517
  type: "string",
1518
1518
  inclusive: !0,
@@ -1521,7 +1521,7 @@ class qe extends X {
1521
1521
  }), s.dirty());
1522
1522
  else if (i.kind === "max")
1523
1523
  e.data.length > i.value && (r = this._getOrReturnCtx(e, r), L(r, {
1524
- code: D.too_big,
1524
+ code: I.too_big,
1525
1525
  maximum: i.value,
1526
1526
  type: "string",
1527
1527
  inclusive: !0,
@@ -1531,14 +1531,14 @@ class qe extends X {
1531
1531
  else if (i.kind === "length") {
1532
1532
  const o = e.data.length > i.value, a = e.data.length < i.value;
1533
1533
  (o || a) && (r = this._getOrReturnCtx(e, r), o ? L(r, {
1534
- code: D.too_big,
1534
+ code: I.too_big,
1535
1535
  maximum: i.value,
1536
1536
  type: "string",
1537
1537
  inclusive: !0,
1538
1538
  exact: !0,
1539
1539
  message: i.message
1540
1540
  }) : a && L(r, {
1541
- code: D.too_small,
1541
+ code: I.too_small,
1542
1542
  minimum: i.value,
1543
1543
  type: "string",
1544
1544
  inclusive: !0,
@@ -1548,43 +1548,43 @@ class qe extends X {
1548
1548
  } else if (i.kind === "email")
1549
1549
  pa.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1550
1550
  validation: "email",
1551
- code: D.invalid_string,
1551
+ code: I.invalid_string,
1552
1552
  message: i.message
1553
1553
  }), s.dirty());
1554
1554
  else if (i.kind === "emoji")
1555
1555
  ts || (ts = new RegExp(ya, "u")), ts.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1556
1556
  validation: "emoji",
1557
- code: D.invalid_string,
1557
+ code: I.invalid_string,
1558
1558
  message: i.message
1559
1559
  }), s.dirty());
1560
1560
  else if (i.kind === "uuid")
1561
1561
  da.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1562
1562
  validation: "uuid",
1563
- code: D.invalid_string,
1563
+ code: I.invalid_string,
1564
1564
  message: i.message
1565
1565
  }), s.dirty());
1566
1566
  else if (i.kind === "nanoid")
1567
1567
  fa.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1568
1568
  validation: "nanoid",
1569
- code: D.invalid_string,
1569
+ code: I.invalid_string,
1570
1570
  message: i.message
1571
1571
  }), s.dirty());
1572
1572
  else if (i.kind === "cuid")
1573
1573
  la.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1574
1574
  validation: "cuid",
1575
- code: D.invalid_string,
1575
+ code: I.invalid_string,
1576
1576
  message: i.message
1577
1577
  }), s.dirty());
1578
1578
  else if (i.kind === "cuid2")
1579
1579
  ca.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1580
1580
  validation: "cuid2",
1581
- code: D.invalid_string,
1581
+ code: I.invalid_string,
1582
1582
  message: i.message
1583
1583
  }), s.dirty());
1584
1584
  else if (i.kind === "ulid")
1585
1585
  ua.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1586
1586
  validation: "ulid",
1587
- code: D.invalid_string,
1587
+ code: I.invalid_string,
1588
1588
  message: i.message
1589
1589
  }), s.dirty());
1590
1590
  else if (i.kind === "url")
@@ -1593,61 +1593,61 @@ class qe extends X {
1593
1593
  } catch {
1594
1594
  r = this._getOrReturnCtx(e, r), L(r, {
1595
1595
  validation: "url",
1596
- code: D.invalid_string,
1596
+ code: I.invalid_string,
1597
1597
  message: i.message
1598
1598
  }), s.dirty();
1599
1599
  }
1600
1600
  else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1601
1601
  validation: "regex",
1602
- code: D.invalid_string,
1602
+ code: I.invalid_string,
1603
1603
  message: i.message
1604
1604
  }), s.dirty())) : i.kind === "trim" ? e.data = e.data.trim() : i.kind === "includes" ? e.data.includes(i.value, i.position) || (r = this._getOrReturnCtx(e, r), L(r, {
1605
- code: D.invalid_string,
1605
+ code: I.invalid_string,
1606
1606
  validation: { includes: i.value, position: i.position },
1607
1607
  message: i.message
1608
1608
  }), s.dirty()) : i.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : i.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : i.kind === "startsWith" ? e.data.startsWith(i.value) || (r = this._getOrReturnCtx(e, r), L(r, {
1609
- code: D.invalid_string,
1609
+ code: I.invalid_string,
1610
1610
  validation: { startsWith: i.value },
1611
1611
  message: i.message
1612
1612
  }), s.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (r = this._getOrReturnCtx(e, r), L(r, {
1613
- code: D.invalid_string,
1613
+ code: I.invalid_string,
1614
1614
  validation: { endsWith: i.value },
1615
1615
  message: i.message
1616
1616
  }), s.dirty()) : i.kind === "datetime" ? Sa(i).test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1617
- code: D.invalid_string,
1617
+ code: I.invalid_string,
1618
1618
  validation: "datetime",
1619
1619
  message: i.message
1620
1620
  }), s.dirty()) : i.kind === "date" ? ka.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1621
- code: D.invalid_string,
1621
+ code: I.invalid_string,
1622
1622
  validation: "date",
1623
1623
  message: i.message
1624
1624
  }), s.dirty()) : i.kind === "time" ? ba(i).test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1625
- code: D.invalid_string,
1625
+ code: I.invalid_string,
1626
1626
  validation: "time",
1627
1627
  message: i.message
1628
1628
  }), s.dirty()) : i.kind === "duration" ? ma.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1629
1629
  validation: "duration",
1630
- code: D.invalid_string,
1630
+ code: I.invalid_string,
1631
1631
  message: i.message
1632
1632
  }), s.dirty()) : i.kind === "ip" ? Ta(e.data, i.version) || (r = this._getOrReturnCtx(e, r), L(r, {
1633
1633
  validation: "ip",
1634
- code: D.invalid_string,
1634
+ code: I.invalid_string,
1635
1635
  message: i.message
1636
1636
  }), s.dirty()) : i.kind === "jwt" ? Ra(e.data, i.alg) || (r = this._getOrReturnCtx(e, r), L(r, {
1637
1637
  validation: "jwt",
1638
- code: D.invalid_string,
1638
+ code: I.invalid_string,
1639
1639
  message: i.message
1640
1640
  }), s.dirty()) : i.kind === "cidr" ? Na(e.data, i.version) || (r = this._getOrReturnCtx(e, r), L(r, {
1641
1641
  validation: "cidr",
1642
- code: D.invalid_string,
1642
+ code: I.invalid_string,
1643
1643
  message: i.message
1644
1644
  }), s.dirty()) : i.kind === "base64" ? va.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1645
1645
  validation: "base64",
1646
- code: D.invalid_string,
1646
+ code: I.invalid_string,
1647
1647
  message: i.message
1648
1648
  }), s.dirty()) : i.kind === "base64url" ? Oa.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1649
1649
  validation: "base64url",
1650
- code: D.invalid_string,
1650
+ code: I.invalid_string,
1651
1651
  message: i.message
1652
1652
  }), s.dirty()) : te.assertNever(i);
1653
1653
  return { status: s.value, value: e.data };
@@ -1655,7 +1655,7 @@ class qe extends X {
1655
1655
  _regex(e, t, s) {
1656
1656
  return this.refinement((r) => e.test(r), {
1657
1657
  validation: t,
1658
- code: D.invalid_string,
1658
+ code: I.invalid_string,
1659
1659
  ...z.errToObj(s)
1660
1660
  });
1661
1661
  }
@@ -1884,7 +1884,7 @@ function xa(n, e) {
1884
1884
  const t = (n.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = t > s ? t : s, i = Number.parseInt(n.toFixed(r).replace(".", "")), o = Number.parseInt(e.toFixed(r).replace(".", ""));
1885
1885
  return i % o / 10 ** r;
1886
1886
  }
1887
- class Dt extends X {
1887
+ class It extends X {
1888
1888
  constructor() {
1889
1889
  super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1890
1890
  }
@@ -1892,7 +1892,7 @@ class Dt extends X {
1892
1892
  if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== U.number) {
1893
1893
  const i = this._getOrReturnCtx(e);
1894
1894
  return L(i, {
1895
- code: D.invalid_type,
1895
+ code: I.invalid_type,
1896
1896
  expected: U.number,
1897
1897
  received: i.parsedType
1898
1898
  }), Y;
@@ -1901,30 +1901,30 @@ class Dt extends X {
1901
1901
  const r = new ve();
1902
1902
  for (const i of this._def.checks)
1903
1903
  i.kind === "int" ? te.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), L(s, {
1904
- code: D.invalid_type,
1904
+ code: I.invalid_type,
1905
1905
  expected: "integer",
1906
1906
  received: "float",
1907
1907
  message: i.message
1908
1908
  }), r.dirty()) : i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (s = this._getOrReturnCtx(e, s), L(s, {
1909
- code: D.too_small,
1909
+ code: I.too_small,
1910
1910
  minimum: i.value,
1911
1911
  type: "number",
1912
1912
  inclusive: i.inclusive,
1913
1913
  exact: !1,
1914
1914
  message: i.message
1915
1915
  }), r.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (s = this._getOrReturnCtx(e, s), L(s, {
1916
- code: D.too_big,
1916
+ code: I.too_big,
1917
1917
  maximum: i.value,
1918
1918
  type: "number",
1919
1919
  inclusive: i.inclusive,
1920
1920
  exact: !1,
1921
1921
  message: i.message
1922
1922
  }), r.dirty()) : i.kind === "multipleOf" ? xa(e.data, i.value) !== 0 && (s = this._getOrReturnCtx(e, s), L(s, {
1923
- code: D.not_multiple_of,
1923
+ code: I.not_multiple_of,
1924
1924
  multipleOf: i.value,
1925
1925
  message: i.message
1926
1926
  }), r.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), L(s, {
1927
- code: D.not_finite,
1927
+ code: I.not_finite,
1928
1928
  message: i.message
1929
1929
  }), r.dirty()) : te.assertNever(i);
1930
1930
  return { status: r.value, value: e.data };
@@ -1942,7 +1942,7 @@ class Dt extends X {
1942
1942
  return this.setLimit("max", e, !1, z.toString(t));
1943
1943
  }
1944
1944
  setLimit(e, t, s, r) {
1945
- return new Dt({
1945
+ return new It({
1946
1946
  ...this._def,
1947
1947
  checks: [
1948
1948
  ...this._def.checks,
@@ -1956,7 +1956,7 @@ class Dt extends X {
1956
1956
  });
1957
1957
  }
1958
1958
  _addCheck(e) {
1959
- return new Dt({
1959
+ return new It({
1960
1960
  ...this._def,
1961
1961
  checks: [...this._def.checks, e]
1962
1962
  });
@@ -2050,7 +2050,7 @@ class Dt extends X {
2050
2050
  return Number.isFinite(t) && Number.isFinite(e);
2051
2051
  }
2052
2052
  }
2053
- Dt.create = (n) => new Dt({
2053
+ It.create = (n) => new It({
2054
2054
  checks: [],
2055
2055
  typeName: G.ZodNumber,
2056
2056
  coerce: n?.coerce || !1,
@@ -2073,19 +2073,19 @@ class en extends X {
2073
2073
  const r = new ve();
2074
2074
  for (const i of this._def.checks)
2075
2075
  i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (s = this._getOrReturnCtx(e, s), L(s, {
2076
- code: D.too_small,
2076
+ code: I.too_small,
2077
2077
  type: "bigint",
2078
2078
  minimum: i.value,
2079
2079
  inclusive: i.inclusive,
2080
2080
  message: i.message
2081
2081
  }), r.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (s = this._getOrReturnCtx(e, s), L(s, {
2082
- code: D.too_big,
2082
+ code: I.too_big,
2083
2083
  type: "bigint",
2084
2084
  maximum: i.value,
2085
2085
  inclusive: i.inclusive,
2086
2086
  message: i.message
2087
2087
  }), r.dirty()) : i.kind === "multipleOf" ? e.data % i.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), L(s, {
2088
- code: D.not_multiple_of,
2088
+ code: I.not_multiple_of,
2089
2089
  multipleOf: i.value,
2090
2090
  message: i.message
2091
2091
  }), r.dirty()) : te.assertNever(i);
@@ -2094,7 +2094,7 @@ class en extends X {
2094
2094
  _getInvalidInput(e) {
2095
2095
  const t = this._getOrReturnCtx(e);
2096
2096
  return L(t, {
2097
- code: D.invalid_type,
2097
+ code: I.invalid_type,
2098
2098
  expected: U.bigint,
2099
2099
  received: t.parsedType
2100
2100
  }), Y;
@@ -2194,7 +2194,7 @@ class ws extends X {
2194
2194
  if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== U.boolean) {
2195
2195
  const s = this._getOrReturnCtx(e);
2196
2196
  return L(s, {
2197
- code: D.invalid_type,
2197
+ code: I.invalid_type,
2198
2198
  expected: U.boolean,
2199
2199
  received: s.parsedType
2200
2200
  }), Y;
@@ -2212,7 +2212,7 @@ class Nn extends X {
2212
2212
  if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== U.date) {
2213
2213
  const i = this._getOrReturnCtx(e);
2214
2214
  return L(i, {
2215
- code: D.invalid_type,
2215
+ code: I.invalid_type,
2216
2216
  expected: U.date,
2217
2217
  received: i.parsedType
2218
2218
  }), Y;
@@ -2220,21 +2220,21 @@ class Nn extends X {
2220
2220
  if (Number.isNaN(e.data.getTime())) {
2221
2221
  const i = this._getOrReturnCtx(e);
2222
2222
  return L(i, {
2223
- code: D.invalid_date
2223
+ code: I.invalid_date
2224
2224
  }), Y;
2225
2225
  }
2226
2226
  const s = new ve();
2227
2227
  let r;
2228
2228
  for (const i of this._def.checks)
2229
2229
  i.kind === "min" ? e.data.getTime() < i.value && (r = this._getOrReturnCtx(e, r), L(r, {
2230
- code: D.too_small,
2230
+ code: I.too_small,
2231
2231
  message: i.message,
2232
2232
  inclusive: !0,
2233
2233
  exact: !1,
2234
2234
  minimum: i.value,
2235
2235
  type: "date"
2236
2236
  }), s.dirty()) : i.kind === "max" ? e.data.getTime() > i.value && (r = this._getOrReturnCtx(e, r), L(r, {
2237
- code: D.too_big,
2237
+ code: I.too_big,
2238
2238
  message: i.message,
2239
2239
  inclusive: !0,
2240
2240
  exact: !1,
@@ -2290,7 +2290,7 @@ class ur extends X {
2290
2290
  if (this._getType(e) !== U.symbol) {
2291
2291
  const s = this._getOrReturnCtx(e);
2292
2292
  return L(s, {
2293
- code: D.invalid_type,
2293
+ code: I.invalid_type,
2294
2294
  expected: U.symbol,
2295
2295
  received: s.parsedType
2296
2296
  }), Y;
@@ -2307,7 +2307,7 @@ class _s extends X {
2307
2307
  if (this._getType(e) !== U.undefined) {
2308
2308
  const s = this._getOrReturnCtx(e);
2309
2309
  return L(s, {
2310
- code: D.invalid_type,
2310
+ code: I.invalid_type,
2311
2311
  expected: U.undefined,
2312
2312
  received: s.parsedType
2313
2313
  }), Y;
@@ -2324,7 +2324,7 @@ class dr extends X {
2324
2324
  if (this._getType(e) !== U.null) {
2325
2325
  const s = this._getOrReturnCtx(e);
2326
2326
  return L(s, {
2327
- code: D.invalid_type,
2327
+ code: I.invalid_type,
2328
2328
  expected: U.null,
2329
2329
  received: s.parsedType
2330
2330
  }), Y;
@@ -2360,17 +2360,17 @@ fr.create = (n) => new fr({
2360
2360
  typeName: G.ZodUnknown,
2361
2361
  ...J(n)
2362
2362
  });
2363
- class it extends X {
2363
+ class ot extends X {
2364
2364
  _parse(e) {
2365
2365
  const t = this._getOrReturnCtx(e);
2366
2366
  return L(t, {
2367
- code: D.invalid_type,
2367
+ code: I.invalid_type,
2368
2368
  expected: U.never,
2369
2369
  received: t.parsedType
2370
2370
  }), Y;
2371
2371
  }
2372
2372
  }
2373
- it.create = (n) => new it({
2373
+ ot.create = (n) => new ot({
2374
2374
  typeName: G.ZodNever,
2375
2375
  ...J(n)
2376
2376
  });
@@ -2379,7 +2379,7 @@ class hr extends X {
2379
2379
  if (this._getType(e) !== U.undefined) {
2380
2380
  const s = this._getOrReturnCtx(e);
2381
2381
  return L(s, {
2382
- code: D.invalid_type,
2382
+ code: I.invalid_type,
2383
2383
  expected: U.void,
2384
2384
  received: s.parsedType
2385
2385
  }), Y;
@@ -2396,14 +2396,14 @@ class Ue extends X {
2396
2396
  const { ctx: t, status: s } = this._processInputParams(e), r = this._def;
2397
2397
  if (t.parsedType !== U.array)
2398
2398
  return L(t, {
2399
- code: D.invalid_type,
2399
+ code: I.invalid_type,
2400
2400
  expected: U.array,
2401
2401
  received: t.parsedType
2402
2402
  }), Y;
2403
2403
  if (r.exactLength !== null) {
2404
2404
  const o = t.data.length > r.exactLength.value, a = t.data.length < r.exactLength.value;
2405
2405
  (o || a) && (L(t, {
2406
- code: o ? D.too_big : D.too_small,
2406
+ code: o ? I.too_big : I.too_small,
2407
2407
  minimum: a ? r.exactLength.value : void 0,
2408
2408
  maximum: o ? r.exactLength.value : void 0,
2409
2409
  type: "array",
@@ -2413,14 +2413,14 @@ class Ue extends X {
2413
2413
  }), s.dirty());
2414
2414
  }
2415
2415
  if (r.minLength !== null && t.data.length < r.minLength.value && (L(t, {
2416
- code: D.too_small,
2416
+ code: I.too_small,
2417
2417
  minimum: r.minLength.value,
2418
2418
  type: "array",
2419
2419
  inclusive: !0,
2420
2420
  exact: !1,
2421
2421
  message: r.minLength.message
2422
2422
  }), s.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (L(t, {
2423
- code: D.too_big,
2423
+ code: I.too_big,
2424
2424
  maximum: r.maxLength.value,
2425
2425
  type: "array",
2426
2426
  inclusive: !0,
@@ -2469,7 +2469,7 @@ function bt(n) {
2469
2469
  const e = {};
2470
2470
  for (const t in n.shape) {
2471
2471
  const s = n.shape[t];
2472
- e[t] = nt.create(bt(s));
2472
+ e[t] = st.create(bt(s));
2473
2473
  }
2474
2474
  return new fe({
2475
2475
  ...n._def,
@@ -2478,7 +2478,7 @@ function bt(n) {
2478
2478
  } else return n instanceof Ue ? new Ue({
2479
2479
  ...n._def,
2480
2480
  type: bt(n.element)
2481
- }) : n instanceof nt ? nt.create(bt(n.unwrap())) : n instanceof Ct ? Ct.create(bt(n.unwrap())) : n instanceof pt ? pt.create(n.items.map((e) => bt(e))) : n;
2481
+ }) : n instanceof st ? st.create(bt(n.unwrap())) : n instanceof Ct ? Ct.create(bt(n.unwrap())) : n instanceof yt ? yt.create(n.items.map((e) => bt(e))) : n;
2482
2482
  }
2483
2483
  class fe extends X {
2484
2484
  constructor() {
@@ -2494,13 +2494,13 @@ class fe extends X {
2494
2494
  if (this._getType(e) !== U.object) {
2495
2495
  const c = this._getOrReturnCtx(e);
2496
2496
  return L(c, {
2497
- code: D.invalid_type,
2497
+ code: I.invalid_type,
2498
2498
  expected: U.object,
2499
2499
  received: c.parsedType
2500
2500
  }), Y;
2501
2501
  }
2502
2502
  const { status: s, ctx: r } = this._processInputParams(e), { shape: i, keys: o } = this._getCached(), a = [];
2503
- if (!(this._def.catchall instanceof it && this._def.unknownKeys === "strip"))
2503
+ if (!(this._def.catchall instanceof ot && this._def.unknownKeys === "strip"))
2504
2504
  for (const c in r.data)
2505
2505
  o.includes(c) || a.push(c);
2506
2506
  const l = [];
@@ -2512,7 +2512,7 @@ class fe extends X {
2512
2512
  alwaysSet: c in r.data
2513
2513
  });
2514
2514
  }
2515
- if (this._def.catchall instanceof it) {
2515
+ if (this._def.catchall instanceof ot) {
2516
2516
  const c = this._def.unknownKeys;
2517
2517
  if (c === "passthrough")
2518
2518
  for (const u of a)
@@ -2522,7 +2522,7 @@ class fe extends X {
2522
2522
  });
2523
2523
  else if (c === "strict")
2524
2524
  a.length > 0 && (L(r, {
2525
- code: D.unrecognized_keys,
2525
+ code: I.unrecognized_keys,
2526
2526
  keys: a
2527
2527
  }), s.dirty());
2528
2528
  else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
@@ -2733,7 +2733,7 @@ class fe extends X {
2733
2733
  t[s] = this.shape[s];
2734
2734
  else {
2735
2735
  let i = this.shape[s];
2736
- for (; i instanceof nt; )
2736
+ for (; i instanceof st; )
2737
2737
  i = i._def.innerType;
2738
2738
  t[s] = i;
2739
2739
  }
@@ -2749,21 +2749,21 @@ class fe extends X {
2749
2749
  fe.create = (n, e) => new fe({
2750
2750
  shape: () => n,
2751
2751
  unknownKeys: "strip",
2752
- catchall: it.create(),
2752
+ catchall: ot.create(),
2753
2753
  typeName: G.ZodObject,
2754
2754
  ...J(e)
2755
2755
  });
2756
2756
  fe.strictCreate = (n, e) => new fe({
2757
2757
  shape: () => n,
2758
2758
  unknownKeys: "strict",
2759
- catchall: it.create(),
2759
+ catchall: ot.create(),
2760
2760
  typeName: G.ZodObject,
2761
2761
  ...J(e)
2762
2762
  });
2763
2763
  fe.lazycreate = (n, e) => new fe({
2764
2764
  shape: n,
2765
2765
  unknownKeys: "strip",
2766
- catchall: it.create(),
2766
+ catchall: ot.create(),
2767
2767
  typeName: G.ZodObject,
2768
2768
  ...J(e)
2769
2769
  });
@@ -2779,7 +2779,7 @@ class xn extends X {
2779
2779
  return t.common.issues.push(...a.ctx.common.issues), a.result;
2780
2780
  const o = i.map((a) => new Be(a.ctx.common.issues));
2781
2781
  return L(t, {
2782
- code: D.invalid_union,
2782
+ code: I.invalid_union,
2783
2783
  unionErrors: o
2784
2784
  }), Y;
2785
2785
  }
@@ -2826,7 +2826,7 @@ class xn extends X {
2826
2826
  return t.common.issues.push(...i.ctx.common.issues), i.result;
2827
2827
  const a = o.map((l) => new Be(l));
2828
2828
  return L(t, {
2829
- code: D.invalid_union,
2829
+ code: I.invalid_union,
2830
2830
  unionErrors: a
2831
2831
  }), Y;
2832
2832
  }
@@ -2841,7 +2841,7 @@ xn.create = (n, e) => new xn({
2841
2841
  ...J(e)
2842
2842
  });
2843
2843
  function vs(n, e) {
2844
- const t = Ke(n), s = Ke(e);
2844
+ const t = Xe(n), s = Xe(e);
2845
2845
  if (n === e)
2846
2846
  return { valid: !0, data: n };
2847
2847
  if (t === U.object && s === U.object) {
@@ -2866,14 +2866,14 @@ function vs(n, e) {
2866
2866
  return { valid: !0, data: r };
2867
2867
  } else return t === U.date && s === U.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
2868
2868
  }
2869
- class Dn extends X {
2869
+ class In extends X {
2870
2870
  _parse(e) {
2871
2871
  const { status: t, ctx: s } = this._processInputParams(e), r = (i, o) => {
2872
2872
  if (ar(i) || ar(o))
2873
2873
  return Y;
2874
2874
  const a = vs(i.value, o.value);
2875
2875
  return a.valid ? ((lr(i) || lr(o)) && t.dirty(), { status: t.value, value: a.data }) : (L(s, {
2876
- code: D.invalid_intersection_types
2876
+ code: I.invalid_intersection_types
2877
2877
  }), Y);
2878
2878
  };
2879
2879
  return s.common.async ? Promise.all([
@@ -2898,31 +2898,31 @@ class Dn extends X {
2898
2898
  }));
2899
2899
  }
2900
2900
  }
2901
- Dn.create = (n, e, t) => new Dn({
2901
+ In.create = (n, e, t) => new In({
2902
2902
  left: n,
2903
2903
  right: e,
2904
2904
  typeName: G.ZodIntersection,
2905
2905
  ...J(t)
2906
2906
  });
2907
- class pt extends X {
2907
+ class yt extends X {
2908
2908
  _parse(e) {
2909
2909
  const { status: t, ctx: s } = this._processInputParams(e);
2910
2910
  if (s.parsedType !== U.array)
2911
2911
  return L(s, {
2912
- code: D.invalid_type,
2912
+ code: I.invalid_type,
2913
2913
  expected: U.array,
2914
2914
  received: s.parsedType
2915
2915
  }), Y;
2916
2916
  if (s.data.length < this._def.items.length)
2917
2917
  return L(s, {
2918
- code: D.too_small,
2918
+ code: I.too_small,
2919
2919
  minimum: this._def.items.length,
2920
2920
  inclusive: !0,
2921
2921
  exact: !1,
2922
2922
  type: "array"
2923
2923
  }), Y;
2924
2924
  !this._def.rest && s.data.length > this._def.items.length && (L(s, {
2925
- code: D.too_big,
2925
+ code: I.too_big,
2926
2926
  maximum: this._def.items.length,
2927
2927
  inclusive: !0,
2928
2928
  exact: !1,
@@ -2938,23 +2938,23 @@ class pt extends X {
2938
2938
  return this._def.items;
2939
2939
  }
2940
2940
  rest(e) {
2941
- return new pt({
2941
+ return new yt({
2942
2942
  ...this._def,
2943
2943
  rest: e
2944
2944
  });
2945
2945
  }
2946
2946
  }
2947
- pt.create = (n, e) => {
2947
+ yt.create = (n, e) => {
2948
2948
  if (!Array.isArray(n))
2949
2949
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2950
- return new pt({
2950
+ return new yt({
2951
2951
  items: n,
2952
2952
  typeName: G.ZodTuple,
2953
2953
  rest: null,
2954
2954
  ...J(e)
2955
2955
  });
2956
2956
  };
2957
- class In extends X {
2957
+ class Dn extends X {
2958
2958
  get keySchema() {
2959
2959
  return this._def.keyType;
2960
2960
  }
@@ -2965,7 +2965,7 @@ class In extends X {
2965
2965
  const { status: t, ctx: s } = this._processInputParams(e);
2966
2966
  if (s.parsedType !== U.object)
2967
2967
  return L(s, {
2968
- code: D.invalid_type,
2968
+ code: I.invalid_type,
2969
2969
  expected: U.object,
2970
2970
  received: s.parsedType
2971
2971
  }), Y;
@@ -2982,12 +2982,12 @@ class In extends X {
2982
2982
  return this._def.valueType;
2983
2983
  }
2984
2984
  static create(e, t, s) {
2985
- return t instanceof X ? new In({
2985
+ return t instanceof X ? new Dn({
2986
2986
  keyType: e,
2987
2987
  valueType: t,
2988
2988
  typeName: G.ZodRecord,
2989
2989
  ...J(s)
2990
- }) : new In({
2990
+ }) : new Dn({
2991
2991
  keyType: qe.create(),
2992
2992
  valueType: e,
2993
2993
  typeName: G.ZodRecord,
@@ -3006,7 +3006,7 @@ class mr extends X {
3006
3006
  const { status: t, ctx: s } = this._processInputParams(e);
3007
3007
  if (s.parsedType !== U.map)
3008
3008
  return L(s, {
3009
- code: D.invalid_type,
3009
+ code: I.invalid_type,
3010
3010
  expected: U.map,
3011
3011
  received: s.parsedType
3012
3012
  }), Y;
@@ -3048,20 +3048,20 @@ class tn extends X {
3048
3048
  const { status: t, ctx: s } = this._processInputParams(e);
3049
3049
  if (s.parsedType !== U.set)
3050
3050
  return L(s, {
3051
- code: D.invalid_type,
3051
+ code: I.invalid_type,
3052
3052
  expected: U.set,
3053
3053
  received: s.parsedType
3054
3054
  }), Y;
3055
3055
  const r = this._def;
3056
3056
  r.minSize !== null && s.data.size < r.minSize.value && (L(s, {
3057
- code: D.too_small,
3057
+ code: I.too_small,
3058
3058
  minimum: r.minSize.value,
3059
3059
  type: "set",
3060
3060
  inclusive: !0,
3061
3061
  exact: !1,
3062
3062
  message: r.minSize.message
3063
3063
  }), t.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (L(s, {
3064
- code: D.too_big,
3064
+ code: I.too_big,
3065
3065
  maximum: r.maxSize.value,
3066
3066
  type: "set",
3067
3067
  inclusive: !0,
@@ -3127,7 +3127,7 @@ class Os extends X {
3127
3127
  const t = this._getOrReturnCtx(e);
3128
3128
  return L(t, {
3129
3129
  received: t.data,
3130
- code: D.invalid_literal,
3130
+ code: I.invalid_literal,
3131
3131
  expected: this._def.value
3132
3132
  }), Y;
3133
3133
  }
@@ -3143,27 +3143,27 @@ Os.create = (n, e) => new Os({
3143
3143
  ...J(e)
3144
3144
  });
3145
3145
  function pi(n, e) {
3146
- return new It({
3146
+ return new Dt({
3147
3147
  values: n,
3148
3148
  typeName: G.ZodEnum,
3149
3149
  ...J(e)
3150
3150
  });
3151
3151
  }
3152
- class It extends X {
3152
+ class Dt extends X {
3153
3153
  _parse(e) {
3154
3154
  if (typeof e.data != "string") {
3155
3155
  const t = this._getOrReturnCtx(e), s = this._def.values;
3156
3156
  return L(t, {
3157
3157
  expected: te.joinValues(s),
3158
3158
  received: t.parsedType,
3159
- code: D.invalid_type
3159
+ code: I.invalid_type
3160
3160
  }), Y;
3161
3161
  }
3162
3162
  if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
3163
3163
  const t = this._getOrReturnCtx(e), s = this._def.values;
3164
3164
  return L(t, {
3165
3165
  received: t.data,
3166
- code: D.invalid_enum_value,
3166
+ code: I.invalid_enum_value,
3167
3167
  options: s
3168
3168
  }), Y;
3169
3169
  }
@@ -3191,19 +3191,19 @@ class It extends X {
3191
3191
  return e;
3192
3192
  }
3193
3193
  extract(e, t = this._def) {
3194
- return It.create(e, {
3194
+ return Dt.create(e, {
3195
3195
  ...this._def,
3196
3196
  ...t
3197
3197
  });
3198
3198
  }
3199
3199
  exclude(e, t = this._def) {
3200
- return It.create(this.options.filter((s) => !e.includes(s)), {
3200
+ return Dt.create(this.options.filter((s) => !e.includes(s)), {
3201
3201
  ...this._def,
3202
3202
  ...t
3203
3203
  });
3204
3204
  }
3205
3205
  }
3206
- It.create = pi;
3206
+ Dt.create = pi;
3207
3207
  class yr extends X {
3208
3208
  _parse(e) {
3209
3209
  const t = te.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
@@ -3212,14 +3212,14 @@ class yr extends X {
3212
3212
  return L(s, {
3213
3213
  expected: te.joinValues(r),
3214
3214
  received: s.parsedType,
3215
- code: D.invalid_type
3215
+ code: I.invalid_type
3216
3216
  }), Y;
3217
3217
  }
3218
3218
  if (this._cache || (this._cache = new Set(te.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
3219
3219
  const r = te.objectValues(t);
3220
3220
  return L(s, {
3221
3221
  received: s.data,
3222
- code: D.invalid_enum_value,
3222
+ code: I.invalid_enum_value,
3223
3223
  options: r
3224
3224
  }), Y;
3225
3225
  }
@@ -3242,7 +3242,7 @@ class An extends X {
3242
3242
  const { ctx: t } = this._processInputParams(e);
3243
3243
  if (t.parsedType !== U.promise && t.common.async === !1)
3244
3244
  return L(t, {
3245
- code: D.invalid_type,
3245
+ code: I.invalid_type,
3246
3246
  expected: U.promise,
3247
3247
  received: t.parsedType
3248
3248
  }), Y;
@@ -3350,7 +3350,7 @@ At.createWithPreprocess = (n, e, t) => new At({
3350
3350
  typeName: G.ZodEffects,
3351
3351
  ...J(t)
3352
3352
  });
3353
- class nt extends X {
3353
+ class st extends X {
3354
3354
  _parse(e) {
3355
3355
  return this._getType(e) === U.undefined ? Ae(void 0) : this._def.innerType._parse(e);
3356
3356
  }
@@ -3358,7 +3358,7 @@ class nt extends X {
3358
3358
  return this._def.innerType;
3359
3359
  }
3360
3360
  }
3361
- nt.create = (n, e) => new nt({
3361
+ st.create = (n, e) => new st({
3362
3362
  innerType: n,
3363
3363
  typeName: G.ZodOptional,
3364
3364
  ...J(e)
@@ -3444,7 +3444,7 @@ class gr extends X {
3444
3444
  if (this._getType(e) !== U.nan) {
3445
3445
  const s = this._getOrReturnCtx(e);
3446
3446
  return L(s, {
3447
- code: D.invalid_type,
3447
+ code: I.invalid_type,
3448
3448
  expected: U.nan,
3449
3449
  received: s.parsedType
3450
3450
  }), Y;
@@ -3456,7 +3456,7 @@ gr.create = (n) => new gr({
3456
3456
  typeName: G.ZodNaN,
3457
3457
  ...J(n)
3458
3458
  });
3459
- class Da extends X {
3459
+ class Ia extends X {
3460
3460
  _parse(e) {
3461
3461
  const { ctx: t } = this._processInputParams(e), s = t.data;
3462
3462
  return this._def.type._parse({
@@ -3527,14 +3527,14 @@ var G;
3527
3527
  (function(n) {
3528
3528
  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";
3529
3529
  })(G || (G = {}));
3530
- const be = qe.create, ft = Dt.create, Kt = ws.create, ns = _s.create, ge = Es.create;
3531
- it.create;
3532
- const wt = Ue.create, We = fe.create, Oe = xn.create;
3533
- Dn.create;
3534
- pt.create;
3535
- const rn = In.create, ke = Os.create, Cn = It.create;
3530
+ const be = qe.create, ht = It.create, Kt = ws.create, ns = _s.create, ge = Es.create;
3531
+ ot.create;
3532
+ const _t = Ue.create, We = fe.create, Oe = xn.create;
3533
+ In.create;
3534
+ yt.create;
3535
+ const rn = Dn.create, ke = Os.create, Cn = Dt.create;
3536
3536
  An.create;
3537
- nt.create;
3537
+ st.create;
3538
3538
  Ct.create;
3539
3539
  const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds !== void 0 || n._seconds !== void 0 && n._nanoseconds !== void 0), {
3540
3540
  message: "Value is not a valid timestamp"
@@ -3550,18 +3550,18 @@ const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
3550
3550
  const i = s.fields.find((a) => a.name === r);
3551
3551
  if (!i)
3552
3552
  throw new Error(`Field ${r} not found in collection ${n.collection}`);
3553
- t[r] = $n(s, i), gt(s, [i]).size === 1 && (t[`${r}_Lowercase`] = $n(s, i, !0));
3553
+ t[r] = $n(s, i), wt(s, [i]).size === 1 && (t[`${r}_Lowercase`] = $n(s, i, !0));
3554
3554
  });
3555
3555
  }
3556
3556
  return We({
3557
- Collection_Path: wt(be()),
3557
+ Collection_Path: _t(be()),
3558
3558
  ...t
3559
3559
  });
3560
- }, Ia = (n, e) => {
3560
+ }, Da = (n, e) => {
3561
3561
  let t = rn(yi(n, e));
3562
3562
  return n.required || (t = t.optional()), t;
3563
3563
  }, Aa = (n) => {
3564
- let e = wt(Oe([be().length(20), be().length(28)]));
3564
+ let e = _t(Oe([be().length(20), be().length(28)]));
3565
3565
  return ["OneToOne", "OneToMany"].includes(n.type) ? e = e.max(1) : (n.min && (e = e.min(n.min)), n.max && (e = e.max(n.max)), n.length && (e = e.length(n.length))), n.required ? e = e.nonempty() : e = e.optional(), e;
3566
3566
  }, $n = (n, e, t) => {
3567
3567
  const { softDelete: s } = n, r = s?.timestampField;
@@ -3579,7 +3579,7 @@ const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
3579
3579
  i = Kt();
3580
3580
  break;
3581
3581
  case "Number":
3582
- e.autoIncrement ? i = Oe([ke("Pending"), ft().int()]) : (i = ft(), e.min && (i = i.min(e.min)), e.max && (i = i.max(e.max)), e.decimal ? i = i.refine((o) => e.decimal ? (o.toString().split(".")[1]?.length || 0) <= e.decimal : !1, {
3582
+ e.autoIncrement ? i = Oe([ke("Pending"), ht().int()]) : (i = ht(), e.min && (i = i.min(e.min)), e.max && (i = i.max(e.max)), e.decimal ? i = i.refine((o) => e.decimal ? (o.toString().split(".")[1]?.length || 0) <= e.decimal : !1, {
3583
3583
  message: `Value must have ${e.decimal} or fewer decimal places`
3584
3584
  }) : i = i.int(), e.values && (i = i.refine((o) => e.values?.includes(o), {
3585
3585
  message: "Value is not an allowed value"
@@ -3595,7 +3595,7 @@ const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
3595
3595
  })));
3596
3596
  break;
3597
3597
  case "Array":
3598
- i = wt(ge()), e.length && (i = i.length(e.length)), e.minlength ? i = i.min(e.minlength) : e.required && (i = i.nonempty()), e.maxlength && (i = i.max(e.maxlength)), e.values && (i = i.refine((o) => {
3598
+ i = _t(ge()), e.length && (i = i.length(e.length)), e.minlength ? i = i.min(e.minlength) : e.required && (i = i.nonempty()), e.maxlength && (i = i.max(e.maxlength)), e.values && (i = i.refine((o) => {
3599
3599
  let a = !0;
3600
3600
  return o.forEach((l) => {
3601
3601
  e.values && !e.values.includes(l) && (a = !1);
@@ -3614,60 +3614,60 @@ const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
3614
3614
  return !K(e) && e.nullable && (i = i.nullable()), e.required || (i = i.optional()), i;
3615
3615
  }, Ca = (n, e, t) => {
3616
3616
  const s = {
3617
- Collection_Path: wt(be()),
3617
+ Collection_Path: _t(be()),
3618
3618
  Last_Write_App: be(),
3619
3619
  Last_Write_At: wn(),
3620
3620
  Last_Save_At: wr(),
3621
3621
  Last_Write_By: Oe([be().length(28), ke("System")]),
3622
3622
  Last_Write_Connection_Status: Cn(["Online", "Offline"]),
3623
- Last_Write_Version: ft().int(),
3623
+ Last_Write_Version: ht().int(),
3624
3624
  id: be().regex(new RegExp("^[a-zA-Z0-9]+$")).length(20),
3625
3625
  Created_At: wn(),
3626
3626
  Created_By: Oe([be().length(28), ke("System")])
3627
3627
  };
3628
3628
  n === "create" && (s.Saved_At = wr()), n === "update" && (s.Saved_At = wn(), s.Collection_Path = s.Collection_Path.optional(), s.id = s.id.optional(), s.Created_At = s.Created_At.optional(), s.Saved_At = s.Saved_At.optional(), s.Created_By = s.Created_By.optional());
3629
- const r = dt(e, e.fields), i = Array.from(r).map((l) => l.name);
3629
+ const r = ft(e, e.fields), i = Array.from(r).map((l) => l.name);
3630
3630
  e.fields.forEach((l) => {
3631
- K(l) ? (s[l.name] = Ia(l, t), s[`${l.name}_Array`] = Aa(l), i.includes(l.name) && (s[`${l.name}_Single`] = yi(l, t), l.required || (s[`${l.name}_Single`] = s[`${l.name}_Single`].optional())), l.length && (s[l.name] = s[l.name].refine((c) => l.length && c && Object.keys(c).length === l.length, {
3631
+ K(l) ? (s[l.name] = Da(l, t), s[`${l.name}_Array`] = Aa(l), i.includes(l.name) && (s[`${l.name}_Single`] = yi(l, t), l.required || (s[`${l.name}_Single`] = s[`${l.name}_Single`].optional())), l.length && (s[l.name] = s[l.name].refine((c) => l.length && c && Object.keys(c).length === l.length, {
3632
3632
  message: `Value must contain ${l.length} item(s)`
3633
3633
  })), l.min && (s[l.name] = s[l.name].refine((c) => l.min && c && Object.keys(c).length >= l.min, {
3634
3634
  message: `Value must contain at least ${l.min} item(s)`
3635
3635
  })), l.max && (s[l.name] = s[l.name].refine((c) => l.max && (!c || Object.keys(c).length <= l.max), {
3636
3636
  message: `Value must contain at most ${l.max} item(s)`
3637
3637
  }))) : l.type !== "Computed" && (s[l.name] = $n(e, l));
3638
- }), gt(e, e.fields).forEach((l) => {
3638
+ }), wt(e, e.fields).forEach((l) => {
3639
3639
  s[l.name] && (s[`${l.name}_Lowercase`] = $n(e, l, !0));
3640
3640
  });
3641
3641
  const a = We(s);
3642
3642
  return e.allowSchemalessFields ? a.passthrough() : a.strict();
3643
3643
  };
3644
- class _t extends Error {
3644
+ class Et extends Error {
3645
3645
  }
3646
- class $a extends _t {
3646
+ class $a extends Et {
3647
3647
  constructor(e) {
3648
3648
  super(`Invalid DateTime: ${e.toMessage()}`);
3649
3649
  }
3650
3650
  }
3651
- class Ma extends _t {
3651
+ class Ma extends Et {
3652
3652
  constructor(e) {
3653
3653
  super(`Invalid Interval: ${e.toMessage()}`);
3654
3654
  }
3655
3655
  }
3656
- class Fa extends _t {
3656
+ class Fa extends Et {
3657
3657
  constructor(e) {
3658
3658
  super(`Invalid Duration: ${e.toMessage()}`);
3659
3659
  }
3660
3660
  }
3661
- class St extends _t {
3661
+ class St extends Et {
3662
3662
  }
3663
- class gi extends _t {
3663
+ class gi extends Et {
3664
3664
  constructor(e) {
3665
3665
  super(`Invalid unit ${e}`);
3666
3666
  }
3667
3667
  }
3668
- class we extends _t {
3668
+ class we extends Et {
3669
3669
  }
3670
- class Qe extends _t {
3670
+ class Ke extends Et {
3671
3671
  constructor() {
3672
3672
  super("Zone is an abstract class");
3673
3673
  }
@@ -3738,14 +3738,14 @@ const $ = "numeric", Pe = "short", Se = "long", Mn = {
3738
3738
  day: $,
3739
3739
  hour: $,
3740
3740
  minute: $
3741
- }, Di = {
3741
+ }, Ii = {
3742
3742
  year: $,
3743
3743
  month: $,
3744
3744
  day: $,
3745
3745
  hour: $,
3746
3746
  minute: $,
3747
3747
  second: $
3748
- }, Ii = {
3748
+ }, Di = {
3749
3749
  year: $,
3750
3750
  month: Pe,
3751
3751
  day: $,
@@ -3805,7 +3805,7 @@ class on {
3805
3805
  * @type {string}
3806
3806
  */
3807
3807
  get type() {
3808
- throw new Qe();
3808
+ throw new Ke();
3809
3809
  }
3810
3810
  /**
3811
3811
  * The name of this zone.
@@ -3813,7 +3813,7 @@ class on {
3813
3813
  * @type {string}
3814
3814
  */
3815
3815
  get name() {
3816
- throw new Qe();
3816
+ throw new Ke();
3817
3817
  }
3818
3818
  /**
3819
3819
  * The IANA name of this zone.
@@ -3830,7 +3830,7 @@ class on {
3830
3830
  * @type {boolean}
3831
3831
  */
3832
3832
  get isUniversal() {
3833
- throw new Qe();
3833
+ throw new Ke();
3834
3834
  }
3835
3835
  /**
3836
3836
  * Returns the offset's common name (such as EST) at the specified timestamp
@@ -3842,7 +3842,7 @@ class on {
3842
3842
  * @return {string}
3843
3843
  */
3844
3844
  offsetName(e, t) {
3845
- throw new Qe();
3845
+ throw new Ke();
3846
3846
  }
3847
3847
  /**
3848
3848
  * Returns the offset's value as a string
@@ -3853,7 +3853,7 @@ class on {
3853
3853
  * @return {string}
3854
3854
  */
3855
3855
  formatOffset(e, t) {
3856
- throw new Qe();
3856
+ throw new Ke();
3857
3857
  }
3858
3858
  /**
3859
3859
  * Return the offset in minutes for this zone at the specified timestamp.
@@ -3862,7 +3862,7 @@ class on {
3862
3862
  * @return {number}
3863
3863
  */
3864
3864
  offset(e) {
3865
- throw new Qe();
3865
+ throw new Ke();
3866
3866
  }
3867
3867
  /**
3868
3868
  * Return whether this Zone is equal to another zone
@@ -3871,7 +3871,7 @@ class on {
3871
3871
  * @return {boolean}
3872
3872
  */
3873
3873
  equals(e) {
3874
- throw new Qe();
3874
+ throw new Ke();
3875
3875
  }
3876
3876
  /**
3877
3877
  * Return whether this Zone is valid.
@@ -3879,7 +3879,7 @@ class on {
3879
3879
  * @type {boolean}
3880
3880
  */
3881
3881
  get isValid() {
3882
- throw new Qe();
3882
+ throw new Ke();
3883
3883
  }
3884
3884
  }
3885
3885
  let ss = null;
@@ -4118,20 +4118,20 @@ function za(n, e = {}) {
4118
4118
  let s = xs.get(t);
4119
4119
  return s === void 0 && (s = new Intl.NumberFormat(n, e), xs.set(t, s)), s;
4120
4120
  }
4121
- const Ds = /* @__PURE__ */ new Map();
4121
+ const Is = /* @__PURE__ */ new Map();
4122
4122
  function qa(n, e = {}) {
4123
4123
  const { base: t, ...s } = e, r = JSON.stringify([n, s]);
4124
- let i = Ds.get(r);
4125
- return i === void 0 && (i = new Intl.RelativeTimeFormat(n, e), Ds.set(r, i)), i;
4124
+ let i = Is.get(r);
4125
+ return i === void 0 && (i = new Intl.RelativeTimeFormat(n, e), Is.set(r, i)), i;
4126
4126
  }
4127
4127
  let Ht = null;
4128
4128
  function Ba() {
4129
4129
  return Ht || (Ht = new Intl.DateTimeFormat().resolvedOptions().locale, Ht);
4130
4130
  }
4131
- const Is = /* @__PURE__ */ new Map();
4131
+ const Ds = /* @__PURE__ */ new Map();
4132
4132
  function Pi(n) {
4133
- let e = Is.get(n);
4134
- return e === void 0 && (e = new Intl.DateTimeFormat(n).resolvedOptions(), Is.set(n, e)), e;
4133
+ let e = Ds.get(n);
4134
+ return e === void 0 && (e = new Intl.DateTimeFormat(n).resolvedOptions(), Ds.set(n, e)), e;
4135
4135
  }
4136
4136
  const As = /* @__PURE__ */ new Map();
4137
4137
  function Ha(n) {
@@ -4272,7 +4272,7 @@ class se {
4272
4272
  return new se(a, l, c, u, o);
4273
4273
  }
4274
4274
  static resetCache() {
4275
- Ht = null, Rs.clear(), xs.clear(), Ds.clear(), Is.clear(), As.clear();
4275
+ Ht = null, Rs.clear(), xs.clear(), Is.clear(), Ds.clear(), As.clear();
4276
4276
  }
4277
4277
  static fromObject({ locale: e, numberingSystem: t, outputCalendar: s, weekSettings: r } = {}) {
4278
4278
  return se.create(e, t, s, r);
@@ -4542,7 +4542,7 @@ class nl extends on {
4542
4542
  return !1;
4543
4543
  }
4544
4544
  }
4545
- function et(n, e) {
4545
+ function tt(n, e) {
4546
4546
  if (H(n) || n === null)
4547
4547
  return e;
4548
4548
  if (n instanceof on)
@@ -4550,7 +4550,7 @@ function et(n, e) {
4550
4550
  if (ll(n)) {
4551
4551
  const t = n.toLowerCase();
4552
4552
  return t === "default" ? e : t === "local" || t === "system" ? zn.instance : t === "utc" || t === "gmt" ? Ee.utcInstance : Ee.parseSpecifier(t) || He.create(n);
4553
- } else return st(n) ? Ee.instance(n) : typeof n == "object" && "offset" in n && typeof n.offset == "function" ? n : new nl(n);
4553
+ } else return rt(n) ? Ee.instance(n) : typeof n == "object" && "offset" in n && typeof n.offset == "function" ? n : new nl(n);
4554
4554
  }
4555
4555
  const js = {
4556
4556
  arab: "[٠-٩]",
@@ -4657,7 +4657,7 @@ class ce {
4657
4657
  * @type {Zone}
4658
4658
  */
4659
4659
  static get defaultZone() {
4660
- return et(Or, zn.instance);
4660
+ return tt(Or, zn.instance);
4661
4661
  }
4662
4662
  /**
4663
4663
  * Get the default locale to create DateTimes with. Does not affect existing instances.
@@ -4811,11 +4811,11 @@ function os(n) {
4811
4811
  const { year: e, month: t, day: s } = n, r = Wi(e, t, s);
4812
4812
  return { year: e, ordinal: r, ...Gn(n) };
4813
4813
  }
4814
- function Dr(n) {
4814
+ function Ir(n) {
4815
4815
  const { year: e, ordinal: t } = n, { month: s, day: r } = ji(e, t);
4816
4816
  return { year: e, month: s, day: r, ...Gn(n) };
4817
4817
  }
4818
- function Ir(n, e) {
4818
+ function Dr(n, e) {
4819
4819
  if (!H(n.localWeekday) || !H(n.localWeekNumber) || !H(n.localWeekYear)) {
4820
4820
  if (!H(n.weekday) || !H(n.weekNumber) || !H(n.weekYear))
4821
4821
  throw new St(
@@ -4851,7 +4851,7 @@ function zi(n) {
4851
4851
  function H(n) {
4852
4852
  return typeof n > "u";
4853
4853
  }
4854
- function st(n) {
4854
+ function rt(n) {
4855
4855
  return typeof n == "number";
4856
4856
  }
4857
4857
  function qn(n) {
@@ -4917,11 +4917,11 @@ function he(n, e = 2) {
4917
4917
  let s;
4918
4918
  return t ? s = "-" + ("" + -n).padStart(e, "0") : s = ("" + n).padStart(e, "0"), s;
4919
4919
  }
4920
- function Xe(n) {
4920
+ function et(n) {
4921
4921
  if (!(H(n) || n === null || n === ""))
4922
4922
  return parseInt(n, 10);
4923
4923
  }
4924
- function ct(n) {
4924
+ function ut(n) {
4925
4925
  if (!(H(n) || n === null || n === ""))
4926
4926
  return parseFloat(n);
4927
4927
  }
@@ -5167,10 +5167,10 @@ const bl = {
5167
5167
  TTT: Ri,
5168
5168
  TTTT: Ni,
5169
5169
  f: xi,
5170
- ff: Ii,
5170
+ ff: Di,
5171
5171
  fff: Ci,
5172
5172
  ffff: Mi,
5173
- F: Di,
5173
+ F: Ii,
5174
5174
  FF: Ai,
5175
5175
  FFF: $i,
5176
5176
  FFFF: Fi
@@ -5444,16 +5444,16 @@ function so(...n) {
5444
5444
  const s = {};
5445
5445
  let r;
5446
5446
  for (r = 0; r < n.length; r++)
5447
- s[n[r]] = Xe(e[t + r]);
5447
+ s[n[r]] = et(e[t + r]);
5448
5448
  return [s, null, t + r];
5449
5449
  };
5450
5450
  }
5451
- const ro = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/, Sl = `(?:${ro.source}?(?:\\[(${no.source})\\])?)?`, Hs = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/, io = RegExp(`${Hs.source}${Sl}`), Gs = RegExp(`(?:[Tt]${io.source})?`), Tl = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, Rl = /(\d{4})-?W(\d\d)(?:-?(\d))?/, Nl = /(\d{4})-?(\d{3})/, xl = so("weekYear", "weekNumber", "weekDay"), Dl = so("year", "ordinal"), Il = /(\d{4})-(\d\d)-(\d\d)/, oo = RegExp(
5451
+ const ro = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/, Sl = `(?:${ro.source}?(?:\\[(${no.source})\\])?)?`, Hs = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/, io = RegExp(`${Hs.source}${Sl}`), Gs = RegExp(`(?:[Tt]${io.source})?`), Tl = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, Rl = /(\d{4})-?W(\d\d)(?:-?(\d))?/, Nl = /(\d{4})-?(\d{3})/, xl = so("weekYear", "weekNumber", "weekDay"), Il = so("year", "ordinal"), Dl = /(\d{4})-(\d\d)-(\d\d)/, oo = RegExp(
5452
5452
  `${Hs.source} ?(?:${ro.source}|(${no.source}))?`
5453
5453
  ), Al = RegExp(`(?: ${oo.source})?`);
5454
5454
  function Nt(n, e, t) {
5455
5455
  const s = n[e];
5456
- return H(s) ? t : Xe(s);
5456
+ return H(s) ? t : et(s);
5457
5457
  }
5458
5458
  function Cl(n, e) {
5459
5459
  return [{
@@ -5483,13 +5483,13 @@ function Fl(n) {
5483
5483
  const [e, t, s, r, i, o, a, l, c] = n, u = e[0] === "-", h = l && l[0] === "-", f = (d, m = !1) => d !== void 0 && (m || d && u) ? -d : d;
5484
5484
  return [
5485
5485
  {
5486
- years: f(ct(t)),
5487
- months: f(ct(s)),
5488
- weeks: f(ct(r)),
5489
- days: f(ct(i)),
5490
- hours: f(ct(o)),
5491
- minutes: f(ct(a)),
5492
- seconds: f(ct(l), l === "-0"),
5486
+ years: f(ut(t)),
5487
+ months: f(ut(s)),
5488
+ weeks: f(ut(r)),
5489
+ days: f(ut(i)),
5490
+ hours: f(ut(o)),
5491
+ minutes: f(ut(a)),
5492
+ seconds: f(ut(l), l === "-0"),
5493
5493
  milliseconds: f(qs(c), h)
5494
5494
  }
5495
5495
  ];
@@ -5507,13 +5507,13 @@ const Pl = {
5507
5507
  };
5508
5508
  function Ys(n, e, t, s, r, i, o) {
5509
5509
  const a = {
5510
- year: e.length === 2 ? Ms(Xe(e)) : Xe(e),
5510
+ year: e.length === 2 ? Ms(et(e)) : et(e),
5511
5511
  month: Yi.indexOf(t) + 1,
5512
- day: Xe(s),
5513
- hour: Xe(r),
5514
- minute: Xe(i)
5512
+ day: et(s),
5513
+ hour: et(r),
5514
+ minute: et(i)
5515
5515
  };
5516
- return o && (a.second = Xe(o)), n && (a.weekday = n.length > 3 ? Qi.indexOf(n) + 1 : Ki.indexOf(n) + 1), a;
5516
+ return o && (a.second = et(o)), n && (a.weekday = n.length > 3 ? Qi.indexOf(n) + 1 : Ki.indexOf(n) + 1), a;
5517
5517
  }
5518
5518
  const Ll = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;
5519
5519
  function Vl(n) {
@@ -5557,7 +5557,7 @@ const ql = Ft(Tl, Gs), Bl = Ft(Rl, Gs), Hl = Ft(Nl, Gs), Gl = Ft(io), ao = Pt(
5557
5557
  ln,
5558
5558
  cn
5559
5559
  ), Jl = Pt(
5560
- Dl,
5560
+ Il,
5561
5561
  Vt,
5562
5562
  ln,
5563
5563
  cn
@@ -5593,7 +5593,7 @@ const nc = Pt(Vt);
5593
5593
  function sc(n) {
5594
5594
  return Lt(n, [$l, nc]);
5595
5595
  }
5596
- const rc = Ft(Il, Al), ic = Ft(oo), oc = Pt(
5596
+ const rc = Ft(Dl, Al), ic = Ft(oo), oc = Pt(
5597
5597
  Vt,
5598
5598
  ln,
5599
5599
  cn
@@ -5680,7 +5680,7 @@ const Fr = "Invalid Duration", lo = {
5680
5680
  milliseconds: vt * 24 * 60 * 60 * 1e3
5681
5681
  },
5682
5682
  ...lo
5683
- }, ht = [
5683
+ }, mt = [
5684
5684
  "years",
5685
5685
  "quarters",
5686
5686
  "months",
@@ -5690,7 +5690,7 @@ const Fr = "Invalid Duration", lo = {
5690
5690
  "minutes",
5691
5691
  "seconds",
5692
5692
  "milliseconds"
5693
- ], uc = ht.slice(0).reverse();
5693
+ ], uc = mt.slice(0).reverse();
5694
5694
  function Ze(n, e, t = !1) {
5695
5695
  const s = {
5696
5696
  values: t ? e.values : { ...n.values, ...e.values || {} },
@@ -5708,7 +5708,7 @@ function co(n, e) {
5708
5708
  }
5709
5709
  function Pr(n, e) {
5710
5710
  const t = co(n, e) < 0 ? -1 : 1;
5711
- ht.reduceRight((s, r) => {
5711
+ mt.reduceRight((s, r) => {
5712
5712
  if (H(e[r]))
5713
5713
  return s;
5714
5714
  if (s) {
@@ -5716,7 +5716,7 @@ function Pr(n, e) {
5716
5716
  e[r] += a * t, e[s] -= a * o * t;
5717
5717
  }
5718
5718
  return r;
5719
- }, null), ht.reduce((s, r) => {
5719
+ }, null), mt.reduce((s, r) => {
5720
5720
  if (H(e[r]))
5721
5721
  return s;
5722
5722
  if (s) {
@@ -5796,7 +5796,7 @@ class ee {
5796
5796
  * @return {Duration}
5797
5797
  */
5798
5798
  static fromDurationLike(e) {
5799
- if (st(e))
5799
+ if (rt(e))
5800
5800
  return ee.fromMillis(e);
5801
5801
  if (ee.isDuration(e))
5802
5802
  return e;
@@ -5959,7 +5959,7 @@ class ee {
5959
5959
  */
5960
5960
  toHuman(e = {}) {
5961
5961
  if (!this.isValid) return Fr;
5962
- const t = e.showZeros !== !1, s = ht.map((r) => {
5962
+ const t = e.showZeros !== !1, s = mt.map((r) => {
5963
5963
  const i = this.values[r];
5964
5964
  return H(i) || i === 0 && !t ? null : this.loc.numberFormatter({ style: "unit", unitDisplay: "long", ...e, unit: r.slice(0, -1) }).format(i);
5965
5965
  }).filter((r) => r);
@@ -6059,7 +6059,7 @@ class ee {
6059
6059
  plus(e) {
6060
6060
  if (!this.isValid) return this;
6061
6061
  const t = ee.fromDurationLike(e), s = {};
6062
- for (const r of ht)
6062
+ for (const r of mt)
6063
6063
  ($t(t.values, r) || $t(this.values, r)) && (s[r] = t.get(r) + this.get(r));
6064
6064
  return Ze(this, { values: s }, !0);
6065
6065
  }
@@ -6172,16 +6172,16 @@ class ee {
6172
6172
  e = e.map((o) => ee.normalizeUnit(o));
6173
6173
  const t = {}, s = {}, r = this.toObject();
6174
6174
  let i;
6175
- for (const o of ht)
6175
+ for (const o of mt)
6176
6176
  if (e.indexOf(o) >= 0) {
6177
6177
  i = o;
6178
6178
  let a = 0;
6179
6179
  for (const c in s)
6180
6180
  a += this.matrix[c][o] * s[c], s[c] = 0;
6181
- st(r[o]) && (a += r[o]);
6181
+ rt(r[o]) && (a += r[o]);
6182
6182
  const l = Math.trunc(a);
6183
6183
  t[o] = l, s[o] = (a * 1e3 - l * 1e3) / 1e3;
6184
- } else st(r[o]) && (s[o] = r[o]);
6184
+ } else rt(r[o]) && (s[o] = r[o]);
6185
6185
  for (const o in s)
6186
6186
  s[o] !== 0 && (t[i] += o === i ? s[o] : s[o] / this.matrix[i][o]);
6187
6187
  return Pr(this.matrix, t), Ze(this, { values: t }, !0);
@@ -6322,7 +6322,7 @@ class ee {
6322
6322
  function t(s, r) {
6323
6323
  return s === void 0 || s === 0 ? r === void 0 || r === 0 : s === r;
6324
6324
  }
6325
- for (const s of ht)
6325
+ for (const s of mt)
6326
6326
  if (!t(this.values[s], e.values[s]))
6327
6327
  return !1;
6328
6328
  return !0;
@@ -6828,7 +6828,7 @@ class hn {
6828
6828
  * @return {Zone}
6829
6829
  */
6830
6830
  static normalizeZone(e) {
6831
- return et(e, ce.defaultZone);
6831
+ return tt(e, ce.defaultZone);
6832
6832
  }
6833
6833
  /**
6834
6834
  * Get the weekday on which the week starts according to the given locale.
@@ -7342,7 +7342,7 @@ function us(n) {
7342
7342
  n.loc.getStartOfWeek()
7343
7343
  )), n.localWeekData;
7344
7344
  }
7345
- function ut(n, e) {
7345
+ function dt(n, e) {
7346
7346
  const t = {
7347
7347
  ts: n.ts,
7348
7348
  zone: n.zone,
@@ -7477,7 +7477,7 @@ const wo = {
7477
7477
  "minute",
7478
7478
  "second",
7479
7479
  "millisecond"
7480
- ], Dc = ["year", "ordinal", "hour", "minute", "second", "millisecond"];
7480
+ ], Ic = ["year", "ordinal", "hour", "minute", "second", "millisecond"];
7481
7481
  function vn(n) {
7482
7482
  const e = {
7483
7483
  year: "year",
@@ -7523,7 +7523,7 @@ function qr(n) {
7523
7523
  return vn(n);
7524
7524
  }
7525
7525
  }
7526
- function Ic(n) {
7526
+ function Dc(n) {
7527
7527
  if (Yt === void 0 && (Yt = ce.now()), n.type !== "iana")
7528
7528
  return n.offset(Yt);
7529
7529
  const e = n.name;
@@ -7531,7 +7531,7 @@ function Ic(n) {
7531
7531
  return t === void 0 && (t = n.offset(Yt), Fs.set(e, t)), t;
7532
7532
  }
7533
7533
  function Br(n, e) {
7534
- const t = et(e.zone, ce.defaultZone);
7534
+ const t = tt(e.zone, ce.defaultZone);
7535
7535
  if (!t.isValid)
7536
7536
  return V.invalid(Gt(t));
7537
7537
  const s = se.fromObject(e);
@@ -7544,7 +7544,7 @@ function Br(n, e) {
7544
7544
  const o = Zi(n) || zi(n);
7545
7545
  if (o)
7546
7546
  return V.invalid(o);
7547
- const a = Ic(t);
7547
+ const a = Dc(t);
7548
7548
  [r, i] = _n(n, a, t);
7549
7549
  }
7550
7550
  return new V({ ts: r, zone: t, loc: s, o: i });
@@ -7579,7 +7579,7 @@ class V {
7579
7579
  if (e.old && e.old.ts === this.ts && e.old.zone.equals(t))
7580
7580
  [r, i] = [e.old.c, e.old.o];
7581
7581
  else {
7582
- const a = st(e.o) && !e.old ? e.o : t.offset(this.ts);
7582
+ const a = rt(e.o) && !e.old ? e.o : t.offset(this.ts);
7583
7583
  r = pn(this.ts, a), s = Number.isNaN(r.year) ? new Fe("invalid input") : null, r = s ? null : r, i = s ? null : a;
7584
7584
  }
7585
7585
  this._zone = t, this.loc = e.loc || se.create(), this.invalid = s, this.weekData = null, this.localWeekData = null, this.c = r, this.o = i, this.isLuxonDateTime = !0;
@@ -7660,7 +7660,7 @@ class V {
7660
7660
  const s = cl(e) ? e.valueOf() : NaN;
7661
7661
  if (Number.isNaN(s))
7662
7662
  return V.invalid("invalid input");
7663
- const r = et(t.zone, ce.defaultZone);
7663
+ const r = tt(t.zone, ce.defaultZone);
7664
7664
  return r.isValid ? new V({
7665
7665
  ts: s,
7666
7666
  zone: r,
@@ -7679,10 +7679,10 @@ class V {
7679
7679
  * @return {DateTime}
7680
7680
  */
7681
7681
  static fromMillis(e, t = {}) {
7682
- if (st(e))
7682
+ if (rt(e))
7683
7683
  return e < -jr || e > jr ? V.invalid("Timestamp out of range") : new V({
7684
7684
  ts: e,
7685
- zone: et(t.zone, ce.defaultZone),
7685
+ zone: tt(t.zone, ce.defaultZone),
7686
7686
  loc: se.fromObject(t)
7687
7687
  });
7688
7688
  throw new we(
@@ -7701,10 +7701,10 @@ class V {
7701
7701
  * @return {DateTime}
7702
7702
  */
7703
7703
  static fromSeconds(e, t = {}) {
7704
- if (st(e))
7704
+ if (rt(e))
7705
7705
  return new V({
7706
7706
  ts: e * 1e3,
7707
- zone: et(t.zone, ce.defaultZone),
7707
+ zone: tt(t.zone, ce.defaultZone),
7708
7708
  loc: se.fromObject(t)
7709
7709
  });
7710
7710
  throw new we("fromSeconds requires a numerical input");
@@ -7744,10 +7744,10 @@ class V {
7744
7744
  */
7745
7745
  static fromObject(e, t = {}) {
7746
7746
  e = e || {};
7747
- const s = et(t.zone, ce.defaultZone);
7747
+ const s = tt(t.zone, ce.defaultZone);
7748
7748
  if (!s.isValid)
7749
7749
  return V.invalid(Gt(s));
7750
- const r = se.fromObject(t), i = Ln(e, qr), { minDaysInFirstWeek: o, startOfWeek: a } = Ir(i, r), l = ce.now(), c = H(t.specificOffset) ? s.offset(l) : t.specificOffset, u = !H(i.ordinal), h = !H(i.year), f = !H(i.month) || !H(i.day), d = h || f, m = i.weekYear || i.weekNumber;
7750
+ const r = se.fromObject(t), i = Ln(e, qr), { minDaysInFirstWeek: o, startOfWeek: a } = Dr(i, r), l = ce.now(), c = H(t.specificOffset) ? s.offset(l) : t.specificOffset, u = !H(i.ordinal), h = !H(i.year), f = !H(i.month) || !H(i.day), d = h || f, m = i.weekYear || i.weekNumber;
7751
7751
  if ((d || u) && m)
7752
7752
  throw new St(
7753
7753
  "Can't mix weekYear/weekNumber units with year/month/day or ordinals"
@@ -7756,7 +7756,7 @@ class V {
7756
7756
  throw new St("Can't mix ordinal dates with month/day");
7757
7757
  const O = m || i.weekday && !d;
7758
7758
  let y, w, b = pn(l, c);
7759
- O ? (y = xc, w = Rc, b = Fn(b, o, a)) : u ? (y = Dc, w = Nc, b = os(b)) : (y = En, w = wo);
7759
+ O ? (y = xc, w = Rc, b = Fn(b, o, a)) : u ? (y = Ic, w = Nc, b = os(b)) : (y = En, w = wo);
7760
7760
  let N = !1;
7761
7761
  for (const g of y) {
7762
7762
  const k = i[g];
@@ -7765,7 +7765,7 @@ class V {
7765
7765
  const p = O ? ol(i, o, a) : u ? al(i) : Zi(i), T = p || zi(i);
7766
7766
  if (T)
7767
7767
  return V.invalid(T);
7768
- const C = O ? xr(i, o, a) : u ? Dr(i) : i, [v, Z] = _n(C, c, s), x = new V({
7768
+ const C = O ? xr(i, o, a) : u ? Ir(i) : i, [v, Z] = _n(C, c, s), x = new V({
7769
7769
  ts: v,
7770
7770
  zone: s,
7771
7771
  o: Z,
@@ -8236,7 +8236,7 @@ class V {
8236
8236
  if (o === a)
8237
8237
  return [this];
8238
8238
  const l = s - o * t, c = s - a * t, u = pn(l, o), h = pn(c, a);
8239
- return u.hour === h.hour && u.minute === h.minute && u.second === h.second && u.millisecond === h.millisecond ? [ut(this, { ts: l }), ut(this, { ts: c })] : [this];
8239
+ return u.hour === h.hour && u.minute === h.minute && u.second === h.second && u.millisecond === h.millisecond ? [dt(this, { ts: l }), dt(this, { ts: c })] : [this];
8240
8240
  }
8241
8241
  /**
8242
8242
  * Returns true if this DateTime is in a leap year, false otherwise
@@ -8332,7 +8332,7 @@ class V {
8332
8332
  * @return {DateTime}
8333
8333
  */
8334
8334
  setZone(e, { keepLocalTime: t = !1, keepCalendarTime: s = !1 } = {}) {
8335
- if (e = et(e, ce.defaultZone), e.equals(this.zone))
8335
+ if (e = tt(e, ce.defaultZone), e.equals(this.zone))
8336
8336
  return this;
8337
8337
  if (e.isValid) {
8338
8338
  let r = this.ts;
@@ -8340,7 +8340,7 @@ class V {
8340
8340
  const i = e.offset(this.ts), o = this.toObject();
8341
8341
  [r] = _n(o, i, e);
8342
8342
  }
8343
- return ut(this, { ts: r, zone: e });
8343
+ return dt(this, { ts: r, zone: e });
8344
8344
  } else
8345
8345
  return V.invalid(Gt(e));
8346
8346
  }
@@ -8352,7 +8352,7 @@ class V {
8352
8352
  */
8353
8353
  reconfigure({ locale: e, numberingSystem: t, outputCalendar: s } = {}) {
8354
8354
  const r = this.loc.clone({ locale: e, numberingSystem: t, outputCalendar: s });
8355
- return ut(this, { loc: r });
8355
+ return dt(this, { loc: r });
8356
8356
  }
8357
8357
  /**
8358
8358
  * "Set" the locale. Returns a newly-constructed DateTime.
@@ -8378,7 +8378,7 @@ class V {
8378
8378
  */
8379
8379
  set(e) {
8380
8380
  if (!this.isValid) return this;
8381
- const t = Ln(e, qr), { minDaysInFirstWeek: s, startOfWeek: r } = Ir(t, this.loc), i = !H(t.weekYear) || !H(t.weekNumber) || !H(t.weekday), o = !H(t.ordinal), a = !H(t.year), l = !H(t.month) || !H(t.day), c = a || l, u = t.weekYear || t.weekNumber;
8381
+ const t = Ln(e, qr), { minDaysInFirstWeek: s, startOfWeek: r } = Dr(t, this.loc), i = !H(t.weekYear) || !H(t.weekNumber) || !H(t.weekday), o = !H(t.ordinal), a = !H(t.year), l = !H(t.month) || !H(t.day), c = a || l, u = t.weekYear || t.weekNumber;
8382
8382
  if ((c || o) && u)
8383
8383
  throw new St(
8384
8384
  "Can't mix weekYear/weekNumber units with year/month/day or ordinals"
@@ -8390,9 +8390,9 @@ class V {
8390
8390
  { ...Fn(this.c, s, r), ...t },
8391
8391
  s,
8392
8392
  r
8393
- ) : H(t.ordinal) ? (h = { ...this.toObject(), ...t }, H(t.day) && (h.day = Math.min(Pn(h.year, h.month), h.day))) : h = Dr({ ...os(this.c), ...t });
8393
+ ) : H(t.ordinal) ? (h = { ...this.toObject(), ...t }, H(t.day) && (h.day = Math.min(Pn(h.year, h.month), h.day))) : h = Ir({ ...os(this.c), ...t });
8394
8394
  const [f, d] = _n(h, this.o, this.zone);
8395
- return ut(this, { ts: f, o: d });
8395
+ return dt(this, { ts: f, o: d });
8396
8396
  }
8397
8397
  /**
8398
8398
  * Add a period of time to this DateTime and return the resulting DateTime
@@ -8410,7 +8410,7 @@ class V {
8410
8410
  plus(e) {
8411
8411
  if (!this.isValid) return this;
8412
8412
  const t = ee.fromDurationLike(e);
8413
- return ut(this, Zr(this, t));
8413
+ return dt(this, Zr(this, t));
8414
8414
  }
8415
8415
  /**
8416
8416
  * Subtract a period of time to this DateTime and return the resulting DateTime
@@ -8421,7 +8421,7 @@ class V {
8421
8421
  minus(e) {
8422
8422
  if (!this.isValid) return this;
8423
8423
  const t = ee.fromDurationLike(e).negate();
8424
- return ut(this, Zr(this, t));
8424
+ return dt(this, Zr(this, t));
8425
8425
  }
8426
8426
  /**
8427
8427
  * "Set" this DateTime to the beginning of a unit of time.
@@ -9090,14 +9090,14 @@ class V {
9090
9090
  * @type {Object}
9091
9091
  */
9092
9092
  static get DATETIME_SHORT_WITH_SECONDS() {
9093
- return Di;
9093
+ return Ii;
9094
9094
  }
9095
9095
  /**
9096
9096
  * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.
9097
9097
  * @type {Object}
9098
9098
  */
9099
9099
  static get DATETIME_MED() {
9100
- return Ii;
9100
+ return Di;
9101
9101
  }
9102
9102
  /**
9103
9103
  * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.
@@ -9145,7 +9145,7 @@ class V {
9145
9145
  function zt(n) {
9146
9146
  if (V.isDateTime(n))
9147
9147
  return n;
9148
- if (n && n.valueOf && st(n.valueOf()))
9148
+ if (n && n.valueOf && rt(n.valueOf()))
9149
9149
  return V.fromJSDate(n);
9150
9150
  if (n && typeof n == "object")
9151
9151
  return V.fromObject(n);
@@ -9165,13 +9165,13 @@ const Ac = (n, e) => {
9165
9165
  });
9166
9166
  }
9167
9167
  return We({
9168
- Collection_Path: wt(be()),
9168
+ Collection_Path: _t(be()),
9169
9169
  ...t
9170
9170
  });
9171
9171
  }, Cc = (n, e, t, s) => {
9172
9172
  let r = We({}).catchall(Ac(n, e)), i;
9173
9173
  if (!s && t) {
9174
- const o = De(n, t);
9174
+ const o = Ie(n, t);
9175
9175
  i = qt(o.admin?.skipFormRequiredValidation);
9176
9176
  }
9177
9177
  return (!n.required || i) && (r = r.optional()), r;
@@ -9184,7 +9184,7 @@ const Ac = (n, e) => {
9184
9184
  ` || "";
9185
9185
  let i, o, a;
9186
9186
  if (!t && e) {
9187
- const l = De(n, e);
9187
+ const l = Ie(n, e);
9188
9188
  i = l.admin?.condition?.form !== void 0 && !qt(l.admin.condition.form), o = qt(l.admin?.skipFormRequiredValidation), a = qt(l.admin?.image);
9189
9189
  }
9190
9190
  switch (n.type) {
@@ -9202,9 +9202,9 @@ const Ac = (n, e) => {
9202
9202
  s = Kt(), r && (s = s.describe(r.trim()));
9203
9203
  break;
9204
9204
  case "Number":
9205
- n.autoIncrement ? s = Oe([ns(), ft().int()], {
9205
+ n.autoIncrement ? s = Oe([ns(), ht().int()], {
9206
9206
  message: "Must be a valid number"
9207
- }) : (s = ft(), n.min && (s = s.min(n.min, `Must be greater than or equal to ${n.min}`)), n.max && (s = s.max(n.max, `Must be less than or equal to ${n.max}`)), n.decimal ? t ? s = s.describe(`${r}Must have ${n.decimal} decimal places`) : s = s.refine((l) => n.decimal ? (l.toString().split(".")[1]?.length || 0) <= n.decimal : !1, {
9207
+ }) : (s = ht(), n.min && (s = s.min(n.min, `Must be greater than or equal to ${n.min}`)), n.max && (s = s.max(n.max, `Must be less than or equal to ${n.max}`)), n.decimal ? t ? s = s.describe(`${r}Must have ${n.decimal} decimal places`) : s = s.refine((l) => n.decimal ? (l.toString().split(".")[1]?.length || 0) <= n.decimal : !1, {
9208
9208
  message: `Must have ${n.decimal} or fewer decimal places`
9209
9209
  }) : s = s.int("Must not have decimal places"), n.values ? (t || (s = Oe([
9210
9210
  s.refine((l) => n.values?.includes(l), {
@@ -9215,8 +9215,8 @@ const Ac = (n, e) => {
9215
9215
  break;
9216
9216
  case "Timestamp":
9217
9217
  t ? (s = We({
9218
- seconds: ft(),
9219
- nanoseconds: ft()
9218
+ seconds: ht(),
9219
+ nanoseconds: ht()
9220
9220
  }), n.min && n.max ? s = s.describe(`${r}Must be between ${V.fromMillis(n.min).toLocaleString(V.DATE_MED)} and ${V.fromMillis(n.max).toLocaleString(V.DATE_MED)}`) : n.min ? s = s.describe(`${r}Must be greater than or equal to ${V.fromMillis(n.min).toLocaleString(V.DATE_MED)}`) : n.max ? s = s.describe(`${r}Must be less than or equal to ${V.fromMillis(n.max).toLocaleString(V.DATE_MED)}`) : r && (s = s.describe(r.trim()))) : (s = $c(), n.min && (s = s.refine((l) => l.toMillis() >= n.min, {
9221
9221
  message: `Must be greater than or equal to ${V.fromMillis(n.min).toLocaleString(V.DATE_MED)}`
9222
9222
  })), n.max && (s = s.refine((l) => l.toMillis() <= n.max, {
@@ -9224,7 +9224,7 @@ const Ac = (n, e) => {
9224
9224
  })));
9225
9225
  break;
9226
9226
  case "Array":
9227
- s = wt(ge()), n.length && (s = s.length(n.length, `Must contain ${n.length} item(s)`)), n.minlength ? s = s.min(n.minlength, `Must contain at least ${n.minlength} item(s)`) : n.required && !i && (s = s.nonempty("Must contain at least one item")), n.maxlength && (s = s.max(n.maxlength, `Must contain at most ${n.maxlength} item(s)`)), n.values ? (t || (s = s.refine((l) => {
9227
+ s = _t(ge()), n.length && (s = s.length(n.length, `Must contain ${n.length} item(s)`)), n.minlength ? s = s.min(n.minlength, `Must contain at least ${n.minlength} item(s)`) : n.required && !i && (s = s.nonempty("Must contain at least one item")), n.maxlength && (s = s.max(n.maxlength, `Must contain at most ${n.maxlength} item(s)`)), n.values ? (t || (s = s.refine((l) => {
9228
9228
  let c = !0;
9229
9229
  return l.forEach((u) => {
9230
9230
  n.values && !n.values.includes(u) && (c = !1);
@@ -9251,7 +9251,7 @@ const Ac = (n, e) => {
9251
9251
  message: `Must contain at most ${c.max} item(s)`
9252
9252
  })))) : a[c.name] = _o(c, t, s), r && (a[c.name] = a[c.name].optional()));
9253
9253
  }), !s && i && (a.operation = Oe([ke("create"), ke("update"), ke("delete")]).optional(), a.password = be().optional(), a.passwordConfirm = be().optional(), Object.values(e.collections).forEach((c) => {
9254
- a[`auth-${c.labels.collection}`] = Kt().optional(), a[`operations-${c.labels.collection}`] = wt(Oe([ke("Read"), ke("Create"), ke("Update"), ke("Delete")])).optional(), a[`restrict-${c.labels.collection}`] = Kt().optional(), c.access.attributeRestrictions?.forEach((u) => {
9254
+ a[`auth-${c.labels.collection}`] = Kt().optional(), a[`operations-${c.labels.collection}`] = _t(Oe([ke("Read"), ke("Create"), ke("Update"), ke("Delete")])).optional(), a[`restrict-${c.labels.collection}`] = Kt().optional(), c.access.attributeRestrictions?.forEach((u) => {
9255
9255
  a[`attribute-${c.labels.collection}-${u.type}`] = Kt().optional();
9256
9256
  }), c.access.entityRestrictions?.restrictions?.forEach((u) => {
9257
9257
  if (u.type === "Individual" && (a[`accessible-${c.labels.collection}-${c.labels.collection}`] = We({}).catchall(ge()).optional()), u.type === "Parent" || u.type === "Parent_Property") {
@@ -9281,7 +9281,7 @@ const Ac = (n, e) => {
9281
9281
  Collection_Path: t
9282
9282
  }), p && p.size++);
9283
9283
  }), T.forEach((g) => {
9284
- if (lt(g, o, i)) {
9284
+ if (ct(g, o, i)) {
9285
9285
  const k = dn(g, o, i), _ = {};
9286
9286
  r[g.name] !== void 0 && (_[g.name] = r[g.name], K(g) && (_[`${g.name}_Array`] = r[`${g.name}_Array`])), k.forEach((A) => {
9287
9287
  r[A.name] !== void 0 && (K(A) ? _[`${A.name}_Array`] = r[`${A.name}_Array`] : _[A.name] = r[A.name]);
@@ -9297,26 +9297,26 @@ const Ac = (n, e) => {
9297
9297
  }
9298
9298
  const v = (g, k) => {
9299
9299
  let _ = 1;
9300
- lt(k, g, i) && _++, g.fields.forEach((E) => {
9301
- lt(E, g, i) && JSON.parse(Xn(dn(E, g, i))).includes(k.name) && _++;
9300
+ ct(k, g, i) && _++, g.fields.forEach((E) => {
9301
+ ct(E, g, i) && JSON.parse(Xn(dn(E, g, i))).includes(k.name) && _++;
9302
9302
  });
9303
9303
  const A = l[g.labels.collection];
9304
9304
  for (const E of A)
9305
- E.fields.some((I) => I.name === k.name) && K(k) && _++;
9305
+ E.fields.some((D) => D.name === k.name) && K(k) && _++;
9306
9306
  return _;
9307
9307
  }, Z = (g, k, _, A, E) => {
9308
- const I = {};
9309
- I[`${_.name}.${s}`] = h(), I[`${_.name}_Array`] = u(s), I[`${_.name}_Single`] = h(), e.update(O(E, A), I), lt(_, k, i) && e.update(y(g, _.name, A), {
9308
+ const D = {};
9309
+ D[`${_.name}.${s}`] = h(), D[`${_.name}_Array`] = u(s), D[`${_.name}_Single`] = h(), e.update(O(E, A), D), ct(_, k, i) && e.update(y(g, _.name, A), {
9310
9310
  [`${_.name}.${s}`]: h(),
9311
9311
  [`${_.name}_Array`]: u(s)
9312
9312
  }), k.fields.forEach((F) => {
9313
- lt(F, k, i) && JSON.parse(Xn(dn(F, k, i))).includes(_.name) && e.update(y(g, F.name, A), {
9313
+ ct(F, k, i) && JSON.parse(Xn(dn(F, k, i))).includes(_.name) && e.update(y(g, F.name, A), {
9314
9314
  [`${_.name}_Array`]: u(s)
9315
9315
  });
9316
9316
  });
9317
9317
  const R = l[k.labels.collection];
9318
9318
  for (const F of R)
9319
- F.fields.some((M) => M.name === _.name) && K(_) && e.update(w(g, F.key, A), I);
9319
+ F.fields.some((M) => M.name === _.name) && K(_) && e.update(w(g, F.key, A), D);
9320
9320
  };
9321
9321
  if (n === "delete")
9322
9322
  return;
@@ -9325,22 +9325,22 @@ const Ac = (n, e) => {
9325
9325
  for (const g of x) {
9326
9326
  if (!p)
9327
9327
  throw new Error("VALIDATION_ERROR: batchSize is required");
9328
- const k = i.collections[g.collection], _ = W(k.fields, g.twoWay), A = dt(k, k.fields), E = Array.from(A).map((I) => I.name);
9328
+ const k = i.collections[g.collection], _ = W(k.fields, g.twoWay), A = ft(k, k.fields), E = Array.from(A).map((D) => D.name);
9329
9329
  if (!_)
9330
9330
  throw new Error(`SCHEMA_ERROR: Field ${g.twoWay} not found in collection ${g.collection}`);
9331
9331
  if (K(_)) {
9332
9332
  if (r[`${g.name}_Array`])
9333
- for (const [I, R] of Object.entries(r[g.name])) {
9334
- if (n === "update" && b && b[`${g.name}_Array`]?.includes(I))
9333
+ for (const [D, R] of Object.entries(r[g.name])) {
9334
+ if (n === "update" && b && b[`${g.name}_Array`]?.includes(D))
9335
9335
  continue;
9336
9336
  const F = { ...b, ...r };
9337
- tt(F);
9337
+ nt(F);
9338
9338
  const M = {};
9339
9339
  _.includeFields && _.includeFields.forEach((S) => {
9340
9340
  if (F[S] !== void 0) {
9341
9341
  M[S] = F[S];
9342
9342
  const q = W(o.fields, S);
9343
- gt(o, [q]).size === 1 && (M[`${S}_Lowercase`] = F[`${S}_Lowercase`]);
9343
+ wt(o, [q]).size === 1 && (M[`${S}_Lowercase`] = F[`${S}_Lowercase`]);
9344
9344
  }
9345
9345
  });
9346
9346
  const P = {
@@ -9355,21 +9355,21 @@ const Ac = (n, e) => {
9355
9355
  ...M
9356
9356
  });
9357
9357
  const j = bn(r);
9358
- e.update(O(R.Collection_Path, I), {
9358
+ e.update(O(R.Collection_Path, D), {
9359
9359
  ...P,
9360
9360
  ...j
9361
- }), p.size++, lt(_, k, i) && (e.update(y(g, _.name, I), {
9361
+ }), p.size++, ct(_, k, i) && (e.update(y(g, _.name, D), {
9362
9362
  [`${_.name}.${s}`]: {
9363
9363
  Collection_Path: t,
9364
9364
  ...M
9365
9365
  },
9366
9366
  [`${_.name}_Array`]: c(s)
9367
9367
  }), p.size++), k.fields.forEach((S) => {
9368
- if (lt(S, k, i)) {
9368
+ if (ct(S, k, i)) {
9369
9369
  const q = JSON.parse(Xn(dn(S, k, i))), B = {};
9370
9370
  q.includes(_.name) && (B[`${g.twoWay}_Array`] = c(s)), Object.keys(j).forEach((re) => {
9371
9371
  q.includes(re) && (B[re] = j[re]);
9372
- }), Object.keys(B).length > 0 && (e.update(y(g, S.name, I), B), p.size++);
9372
+ }), Object.keys(B).length > 0 && (e.update(y(g, S.name, D), B), p.size++);
9373
9373
  }
9374
9374
  });
9375
9375
  const Q = l[k.labels.collection];
@@ -9378,7 +9378,7 @@ const Ac = (n, e) => {
9378
9378
  const q = { ...P };
9379
9379
  Object.keys(j).forEach((B) => {
9380
9380
  S.fields.some((re) => re.name === B) && (q[B] = j[B]);
9381
- }), Object.keys(q).length > 0 && (e.update(w(g, S.key, I), q), p.size++);
9381
+ }), Object.keys(q).length > 0 && (e.update(w(g, S.key, D), q), p.size++);
9382
9382
  }
9383
9383
  }
9384
9384
  } else
@@ -9534,13 +9534,13 @@ const Tt = {
9534
9534
  };
9535
9535
  h();
9536
9536
  }), Tt;
9537
- }, { getTenant: Et, getMode: bo, getTimezone: So, getGlobalConfigModule: Ut, getCustomizationFile: Ye, getVersionInfo: lu, getMaintenanceInfo: cu } = Tt, Ge = async (n = !1) => {
9537
+ }, { getTenant: Ye, getMode: bo, getTimezone: So, getGlobalConfigModule: Ut, getCustomizationFile: Je, getVersionInfo: lu, getMaintenanceInfo: cu } = Tt, Ge = async (n = !1) => {
9538
9538
  const s = await si().ref("schema").orderByChild("published_time").limitToLast(1).get(), r = Object.values(s.val())[0];
9539
9539
  if (n) {
9540
9540
  for (const i of Object.values(r.collections))
9541
9541
  for (const o of i.fields)
9542
9542
  if (o.type === "Computed") {
9543
- const a = De(o, Ye(i.labels.collection, r));
9543
+ const a = Ie(o, Je(i.labels.collection, r));
9544
9544
  a.formula && (o.formula = a.formula);
9545
9545
  }
9546
9546
  } else
@@ -9551,7 +9551,7 @@ const Tt = {
9551
9551
  const t = await si().ref("schema").orderByChild("published_time").limitToLast(2).get();
9552
9552
  if (!(t.numChildren() < 2))
9553
9553
  return Object.values(t.val())[0];
9554
- }, Ie = (n, e, t) => {
9554
+ }, De = (n, e, t) => {
9555
9555
  let s = n.collection("tenants").doc(t);
9556
9556
  for (let r = 0; r < e.length; r++)
9557
9557
  r % 2 === 0 ? s = s.collection(e[r]) : s = s.doc(e[r]);
@@ -9560,29 +9560,29 @@ const Tt = {
9560
9560
  const i = ue(), o = e.at(-1);
9561
9561
  if (!o)
9562
9562
  throw new Error("EMPTY_PATH");
9563
- const a = t.collections[o], { labels: l, fields: c, preloadCache: u } = a, h = Ye(o, t), f = Ie(i, e, n);
9563
+ const a = t.collections[o], { labels: l, fields: c, preloadCache: u } = a, h = Je(o, t), f = De(i, e, n);
9564
9564
  if (r)
9565
9565
  if (s) {
9566
9566
  const d = r.collections?.[l.collection];
9567
9567
  if (!r.Role)
9568
9568
  throw new Error("PERMISSION_DENIED");
9569
9569
  const m = d && Te("Read", d), O = ai(a, t, r), y = ii(a, r), w = Ps(a, r), b = oi(a, t, r), N = (E = []) => {
9570
- const I = [], R = fi(r.Role, a, t);
9570
+ const D = [], R = fi(r.Role, a, t);
9571
9571
  if (!R)
9572
9572
  throw new Error("PERMISSION_DENIED");
9573
9573
  if (m) {
9574
9574
  let F = i.collection("tenants").doc(n).collection("system_fields").doc(l.collection).collection(`${l.collection}-${R.key}`).where("Collection_Path_String", "==", e.join("/"));
9575
9575
  E.forEach((M) => {
9576
9576
  F = F.where(...M);
9577
- }), I.push(F);
9577
+ }), D.push(F);
9578
9578
  } else if (O)
9579
9579
  for (const F of O) {
9580
9580
  let M = i.collection("tenants").doc(n).collection("system_fields").doc(l.collection).collection(`${l.collection}-${F.field}`).where("Collection_Path_String", "==", e.join("/"));
9581
9581
  E.forEach((P) => {
9582
9582
  M = M.where(...P);
9583
- }), I.push(M);
9583
+ }), D.push(M);
9584
9584
  }
9585
- return I;
9585
+ return D;
9586
9586
  }, p = y.filter((E) => "operations" in E && E.operations ? E.operations.includes("Read") : !0);
9587
9587
  if (p.length === 0 && w.length === 0 && b.length === 0)
9588
9588
  return N();
@@ -9593,10 +9593,10 @@ const Tt = {
9593
9593
  if (p.length > 0) {
9594
9594
  for (const E of p)
9595
9595
  if (E.operations && E.type === "Record_Property") {
9596
- const I = E.roles.find((R) => R.role === r.Role);
9597
- if (!I)
9596
+ const D = E.roles.find((R) => R.role === r.Role);
9597
+ if (!D)
9598
9598
  throw new Error("PERMISSION_DENIED");
9599
- C(I.values?.length);
9599
+ C(D.values?.length);
9600
9600
  }
9601
9601
  }
9602
9602
  u?.roles.includes(r.Role) && u.range && C(u.range.fields.length);
@@ -9605,25 +9605,25 @@ const Tt = {
9605
9605
  const Z = T === 0 ? 30 : Math.max(1, Math.floor(30 / T)), x = [];
9606
9606
  p.filter((E) => E.type === "Record_Owner").forEach(() => x.push(["Created_By", "==", s])), p.filter((E) => E.type === "Record_User").forEach((E) => {
9607
9607
  if ("collectionField" in E) {
9608
- const I = W(c, E.collectionField);
9609
- x.push([`${I.name}_Array`, "array-contains", r.Doc_ID]);
9608
+ const D = W(c, E.collectionField);
9609
+ x.push([`${D.name}_Array`, "array-contains", r.Doc_ID]);
9610
9610
  }
9611
9611
  }), p.filter((E) => E.type === "Record_Property").forEach((E) => {
9612
9612
  if ("propertyField" in E) {
9613
- const I = E.roles.find((F) => F.role === r.Role);
9614
- if (!I)
9613
+ const D = E.roles.find((F) => F.role === r.Role);
9614
+ if (!D)
9615
9615
  throw new Error("PERMISSION_DENIED");
9616
9616
  const R = W(c, E.propertyField);
9617
- R.type === "Array" ? x.push([`${R.name}_Array`, "array-contains-any", I.values]) : x.push([R.name, "in", I.values]);
9617
+ R.type === "Array" ? x.push([`${R.name}_Array`, "array-contains-any", D.values]) : x.push([R.name, "in", D.values]);
9618
9618
  }
9619
9619
  });
9620
9620
  const g = [];
9621
9621
  w.filter((E) => E.type === "Individual").forEach((E) => {
9622
- const I = d?.individualEntities, R = [];
9623
- if (I) {
9622
+ const D = d?.individualEntities, R = [];
9623
+ if (D) {
9624
9624
  const F = E.singleQuery ? E.singleQuery : Z;
9625
- for (let M = 0; M < I.length; M += F) {
9626
- const P = I.slice(M, M + F);
9625
+ for (let M = 0; M < D.length; M += F) {
9626
+ const P = D.slice(M, M + F);
9627
9627
  R.push(P);
9628
9628
  }
9629
9629
  if (!E.singleQuery)
@@ -9631,15 +9631,15 @@ const Tt = {
9631
9631
  g.push(...N(x.concat([["id", "in", M]])));
9632
9632
  });
9633
9633
  else {
9634
- if (I.length > F)
9634
+ if (D.length > F)
9635
9635
  throw new Error(`INPUT_ERROR: Individual entity restriction with singleQuery set to true must not have more than ${E.singleQuery} entities`);
9636
- x.push(["id", "in", I]);
9636
+ x.push(["id", "in", D]);
9637
9637
  }
9638
9638
  }
9639
9639
  }), b.filter((E) => E.parentFilter.type === "Individual").forEach((E) => {
9640
- const { parentFilter: I, parentRestriction: R } = E;
9641
- if ("collectionField" in I) {
9642
- const F = W(c, I.collectionField);
9640
+ const { parentFilter: D, parentRestriction: R } = E;
9641
+ if ("collectionField" in D) {
9642
+ const F = W(c, D.collectionField);
9643
9643
  if ("collection" in F) {
9644
9644
  const M = r.collections?.[F.collection];
9645
9645
  if (!M)
@@ -9667,8 +9667,8 @@ const Tt = {
9667
9667
  const k = [];
9668
9668
  w.filter((E) => E.type === "Parent").forEach((E) => {
9669
9669
  if ("collectionField" in E) {
9670
- const I = W(c, E.collectionField);
9671
- if ("collection" in I) {
9670
+ const D = W(c, E.collectionField);
9671
+ if ("collection" in D) {
9672
9672
  const R = d?.parentEntities, F = [];
9673
9673
  if (R) {
9674
9674
  const M = E.singleQuery ? E.singleQuery : Z;
@@ -9678,20 +9678,20 @@ const Tt = {
9678
9678
  }
9679
9679
  if (!E.singleQuery)
9680
9680
  F.forEach((P) => {
9681
- k.push(...N(x.concat([[`${I.name}_Array`, "array-contains-any", P]])));
9681
+ k.push(...N(x.concat([[`${D.name}_Array`, "array-contains-any", P]])));
9682
9682
  });
9683
9683
  else {
9684
9684
  if (R && R.length > M)
9685
9685
  throw new Error(`INPUT_ERROR: Parent entity restriction with singleQuery set to true must not have more than ${E.singleQuery} entities`);
9686
- x.push([`${I.name}_Array`, "array-contains-any", R]);
9686
+ x.push([`${D.name}_Array`, "array-contains-any", R]);
9687
9687
  }
9688
9688
  }
9689
9689
  }
9690
9690
  }
9691
9691
  }), b.filter((E) => E.parentFilter.type === "Parent").forEach((E) => {
9692
- const { parentFilter: I, parentRestriction: R } = E;
9693
- if ("collectionField" in I && "parentCollectionField" in I) {
9694
- const F = W(c, I.collectionField), M = W(c, I.parentCollectionField);
9692
+ const { parentFilter: D, parentRestriction: R } = E;
9693
+ if ("collectionField" in D && "parentCollectionField" in D) {
9694
+ const F = W(c, D.collectionField), M = W(c, D.parentCollectionField);
9695
9695
  if ("collection" in F && "collection" in M) {
9696
9696
  const P = r.collections?.[F.collection];
9697
9697
  if (!P)
@@ -9725,8 +9725,8 @@ const Tt = {
9725
9725
  const _ = [];
9726
9726
  k.length === 0 && (w.filter((E) => E.type === "Parent_Property").forEach((E) => {
9727
9727
  if ("collectionField" in E && "propertyField" in E) {
9728
- const I = W(c, E.collectionField), R = W(c, E.propertyField);
9729
- if ("collection" in I) {
9728
+ const D = W(c, E.collectionField), R = W(c, E.propertyField);
9729
+ if ("collection" in D) {
9730
9730
  const F = d?.parentPropertyEntities || {};
9731
9731
  Object.entries(F).forEach(([M, P]) => {
9732
9732
  if (P.length > 0) {
@@ -9737,7 +9737,7 @@ const Tt = {
9737
9737
  }
9738
9738
  j.forEach((Q) => {
9739
9739
  _.push(...N(x.concat([
9740
- [`${I.name}_Array`, "array-contains-any", Q],
9740
+ [`${D.name}_Array`, "array-contains-any", Q],
9741
9741
  [R.name, "==", M]
9742
9742
  ])));
9743
9743
  });
@@ -9746,9 +9746,9 @@ const Tt = {
9746
9746
  }
9747
9747
  }
9748
9748
  }), b.filter((E) => E.parentFilter.type === "Parent_Property").forEach((E) => {
9749
- const { parentFilter: I } = E;
9750
- if ("collectionField" in I && "parentCollectionField" in I && "parentPropertyField" in I) {
9751
- const R = W(c, I.collectionField), F = W(c, I.parentCollectionField), M = W(c, I.parentPropertyField);
9749
+ const { parentFilter: D } = E;
9750
+ if ("collectionField" in D && "parentCollectionField" in D && "parentPropertyField" in D) {
9751
+ const R = W(c, D.collectionField), F = W(c, D.parentCollectionField), M = W(c, D.parentPropertyField);
9752
9752
  if ("collection" in R && "collection" in F) {
9753
9753
  const P = r.collections?.[R.collection];
9754
9754
  if (!P)
@@ -9785,7 +9785,7 @@ const Tt = {
9785
9785
  const i = ue(), o = e.at(-1);
9786
9786
  if (!o)
9787
9787
  throw new Error("EMPTY_PATH");
9788
- const a = s.collections[o], { labels: l } = a, c = Ie(i, e, n);
9788
+ const a = s.collections[o], { labels: l } = a, c = De(i, e, n);
9789
9789
  if (r) {
9790
9790
  const u = r.collections?.[l.collection];
9791
9791
  if (!r.Role)
@@ -9836,7 +9836,7 @@ const Tt = {
9836
9836
  continue;
9837
9837
  const m = Object.keys(d);
9838
9838
  for (const O of m) {
9839
- const y = d[O], w = ot(y.Collection_Path, O, {
9839
+ const y = d[O], w = at(y.Collection_Path, O, {
9840
9840
  user: o,
9841
9841
  providedTransaction: a,
9842
9842
  noEmbeddingFields: l
@@ -9874,7 +9874,7 @@ const Tt = {
9874
9874
  if (typeof c != "number" || !Number.isFinite(c) || !Number.isInteger(c) || c < 1)
9875
9875
  throw new Error("INPUT_ERROR: Pagination number must be a positive finite integer");
9876
9876
  }
9877
- const s = Et(), r = ue();
9877
+ const s = Ye(), r = ue();
9878
9878
  let i, o, a;
9879
9879
  const l = async (c) => {
9880
9880
  const [u, h, f] = await Promise.all([
@@ -9894,7 +9894,7 @@ const Tt = {
9894
9894
  const b = Object.keys(m.collections).includes(w), N = y.disabledCollections?.includes(w);
9895
9895
  if (!b || N)
9896
9896
  throw new Error("COLLECTION_NOT_FOUND");
9897
- const p = m.collections[w], { labels: T } = p, C = Ye(T.collection, m);
9897
+ const p = m.collections[w], { labels: T } = p, C = Je(T.collection, m);
9898
9898
  if (t?.user) {
9899
9899
  if (!u?.exists)
9900
9900
  throw new Error("PERMISSION_DENIED");
@@ -9906,8 +9906,8 @@ const Tt = {
9906
9906
  let v = Pc(s, n, m, t?.user, O);
9907
9907
  if (v.length === 0)
9908
9908
  return { cursor: {}, pages: 0, docs: [] };
9909
- if (e && (v = v.map((A) => (e.forEach(([E, I, R]) => {
9910
- A = A.where(E, I, R);
9909
+ if (e && (v = v.map((A) => (e.forEach(([E, D, R]) => {
9910
+ A = A.where(E, D, R);
9911
9911
  }), A))), o = t?.pagination?.startAfter || t?.pagination?.endBefore || {
9912
9912
  first: /* @__PURE__ */ new Map(),
9913
9913
  last: /* @__PURE__ */ new Map()
@@ -9920,7 +9920,7 @@ const Tt = {
9920
9920
  if (A && E !== !0)
9921
9921
  throw new Error("INPUT_ERROR: Pagination is not allowed when using " + E);
9922
9922
  }
9923
- t.pagination.orderByField && t.pagination.orderByDirection ? !t.pagination.startAfter && !t.pagination.endBefore ? v = v.map((E) => E.orderBy(t.pagination.orderByField, t.pagination.orderByDirection).limit(t.pagination.number)) : t.pagination.startAfter ? v = v.map((E, I) => E.orderBy(t.pagination.orderByField, t.pagination.orderByDirection).startAfter(o.last.get(I)).limit(t.pagination.number)) : v = v.map((E, I) => E.orderBy(t.pagination.orderByField, t.pagination.orderByDirection).endBefore(o.first.get(I)).limitToLast(t.pagination.number)) : !t.pagination.startAfter && !t.pagination.endBefore ? v = v.map((E) => E.limit(t.pagination.number)) : t.pagination.startAfter ? v = v.map((E, I) => E.startAfter(o.last.get(I)).limit(t.pagination.number)) : v = v.map((E, I) => E.endBefore(o.first.get(I)).limitToLast(t.pagination.number));
9923
+ t.pagination.orderByField && t.pagination.orderByDirection ? !t.pagination.startAfter && !t.pagination.endBefore ? v = v.map((E) => E.orderBy(t.pagination.orderByField, t.pagination.orderByDirection).limit(t.pagination.number)) : t.pagination.startAfter ? v = v.map((E, D) => E.orderBy(t.pagination.orderByField, t.pagination.orderByDirection).startAfter(o.last.get(D)).limit(t.pagination.number)) : v = v.map((E, D) => E.orderBy(t.pagination.orderByField, t.pagination.orderByDirection).endBefore(o.first.get(D)).limitToLast(t.pagination.number)) : !t.pagination.startAfter && !t.pagination.endBefore ? v = v.map((E) => E.limit(t.pagination.number)) : t.pagination.startAfter ? v = v.map((E, D) => E.startAfter(o.last.get(D)).limit(t.pagination.number)) : v = v.map((E, D) => E.endBefore(o.first.get(D)).limitToLast(t.pagination.number));
9924
9924
  }
9925
9925
  const Z = {};
9926
9926
  await ae("preOperation", y, C, ["read", void 0, void 0, Z]), await ae("preRead", y, C, [Z, v, !0, !1]), a = /* @__PURE__ */ new Map();
@@ -9928,9 +9928,9 @@ const Tt = {
9928
9928
  for (const A of _) {
9929
9929
  for (const E of A.docs) {
9930
9930
  a.has(E.id) || a.set(E.id, {});
9931
- const I = E.data(), R = a.get(E.id);
9931
+ const D = E.data(), R = a.get(E.id);
9932
9932
  R.id ||= E.id;
9933
- const F = { ...R, ...I };
9933
+ const F = { ...R, ...D };
9934
9934
  delete F.Collection_Path_String, a.set(E.id, F);
9935
9935
  }
9936
9936
  o.first.set(_.indexOf(A), A.docs[0]), o.last.set(_.indexOf(A), A.docs.at(-1) || A.docs[0]);
@@ -9938,16 +9938,16 @@ const Tt = {
9938
9938
  if (t?.pagination) {
9939
9939
  let A = v[0];
9940
9940
  e && (A = e.reduce((F, [M, P, j]) => F.where(M, P, j), A)), t.pagination.orderByField && t.pagination.orderByDirection && (A = A.orderBy(t.pagination.orderByField, t.pagination.orderByDirection));
9941
- const I = (await A.count().get()).data().count, R = t.pagination.number;
9942
- i = R > 0 ? Math.ceil(I / R) : 0;
9941
+ const D = (await A.count().get()).data().count, R = t.pagination.number;
9942
+ i = R > 0 ? Math.ceil(D / R) : 0;
9943
9943
  }
9944
9944
  for (const A of a.values()) {
9945
- const E = [], I = [...A.Collection_Path, A.id];
9945
+ const E = [], D = [...A.Collection_Path, A.id];
9946
9946
  t?.subcollections && E.push(Ro(
9947
9947
  s,
9948
9948
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
9949
9949
  a.get(A.id),
9950
- I,
9950
+ D,
9951
9951
  ye(t.subcollections),
9952
9952
  m,
9953
9953
  ye(t?.relations),
@@ -9967,7 +9967,7 @@ const Tt = {
9967
9967
  s,
9968
9968
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
9969
9969
  a.get(A.id),
9970
- I,
9970
+ D,
9971
9971
  ye(t.relations),
9972
9972
  m,
9973
9973
  void 0,
@@ -9978,7 +9978,7 @@ const Tt = {
9978
9978
  for (const M of a.values())
9979
9979
  for (const P of p.fields) {
9980
9980
  if (P.type === "Computed") {
9981
- const j = De(P, C);
9981
+ const j = Ie(P, C);
9982
9982
  if (!j.formula)
9983
9983
  continue;
9984
9984
  M[P.name] = await j.formula(M);
@@ -9992,7 +9992,7 @@ const Tt = {
9992
9992
  continue;
9993
9993
  }
9994
9994
  for (const j of p.fields) {
9995
- const Q = !j.access || j.access.includes(M), S = De(j, C), q = S?.custom?.serverAccess?.read !== void 0 ? await ie(S.custom.serverAccess.read, [M, A]) : !0;
9995
+ const Q = !j.access || j.access.includes(M), S = Ie(j, C), q = S?.custom?.serverAccess?.read !== void 0 ? await ie(S.custom.serverAccess.read, [M, A]) : !0;
9996
9996
  (!Q || !q) && (K(j) ? (delete a.get(A.id)[j.name], delete a.get(A.id)[`${j.name}_Array`], delete a.get(A.id)[`${j.name}_Single`]) : delete a.get(A.id)[j.name]);
9997
9997
  }
9998
9998
  }
@@ -10027,7 +10027,7 @@ const Tt = {
10027
10027
  );
10028
10028
  });
10029
10029
  await Promise.all(h);
10030
- }, Do = async (n, e, t, s, r, i, o, a, l) => {
10030
+ }, Io = async (n, e, t, s, r, i, o, a, l) => {
10031
10031
  const c = s.at(-2);
10032
10032
  i.fields ||= r.collections[c].fields.filter((f) => K(f));
10033
10033
  const u = i.depth - 1, h = [];
@@ -10037,14 +10037,14 @@ const Tt = {
10037
10037
  if (!d)
10038
10038
  continue;
10039
10039
  for (const [m, O] of Object.entries(d)) {
10040
- const y = ot(O.Collection_Path, m, {
10040
+ const y = at(O.Collection_Path, m, {
10041
10041
  user: o,
10042
10042
  providedTransaction: e,
10043
10043
  noComputedFields: a,
10044
10044
  noEmbeddingFields: l
10045
10045
  }).then((w) => {
10046
10046
  if (d[m] = w, u > 0)
10047
- return Do(
10047
+ return Io(
10048
10048
  n,
10049
10049
  e,
10050
10050
  // eslint-disable-next-line security/detect-object-injection
@@ -10066,12 +10066,12 @@ const Tt = {
10066
10066
  }
10067
10067
  }
10068
10068
  await Promise.all(h);
10069
- }, ot = async (n, e, t) => {
10069
+ }, at = async (n, e, t) => {
10070
10070
  if (t?.subcollections?.depth && t.subcollections.depth > 10)
10071
10071
  throw new Error("INPUT_ERROR: Subcollections depth cannot exceed 10");
10072
10072
  if (t?.relations?.depth && t.relations.depth > 10)
10073
10073
  throw new Error("INPUT_ERROR: Relations depth cannot exceed 10");
10074
- const s = Et(), r = ue();
10074
+ const s = Ye(), r = ue();
10075
10075
  let i;
10076
10076
  const o = async (a) => {
10077
10077
  const [l, c, u] = await Promise.all([
@@ -10091,7 +10091,7 @@ const Tt = {
10091
10091
  const y = Object.keys(f.collections).includes(O), w = m.disabledCollections?.includes(O);
10092
10092
  if (!y || w)
10093
10093
  throw new Error("COLLECTION_NOT_FOUND");
10094
- const b = f.collections[O], { labels: N } = b, p = Ye(N.collection, f);
10094
+ const b = f.collections[O], { labels: N } = b, p = Je(N.collection, f);
10095
10095
  let T;
10096
10096
  if (t?.user) {
10097
10097
  if (!l?.exists)
@@ -10126,10 +10126,10 @@ const Tt = {
10126
10126
  throw new Error(`SCHEMA_ERROR: Field ${R} not found in collection ${O}`);
10127
10127
  }
10128
10128
  return R;
10129
- })), _.push(Do(s, a, i, A, f, t.relations, t.user, t.noComputedFields, t.noEmbeddingFields))), await Promise.all(_), !t?.noComputedFields) {
10129
+ })), _.push(Io(s, a, i, A, f, t.relations, t.user, t.noComputedFields, t.noEmbeddingFields))), await Promise.all(_), !t?.noComputedFields) {
10130
10130
  for (const R of b.fields)
10131
10131
  if (R.type === "Computed") {
10132
- const F = De(R, p);
10132
+ const F = Ie(R, p);
10133
10133
  if (!F.formula)
10134
10134
  continue;
10135
10135
  i[R.name] = await F.formula(i);
@@ -10143,7 +10143,7 @@ const Tt = {
10143
10143
  if (!(p.custom?.serverAccess?.read !== void 0 ? await ie(p.custom?.serverAccess?.read, [R, i]) : !0))
10144
10144
  throw new Error("PERMISSION_DENIED");
10145
10145
  for (const M of b.fields) {
10146
- const P = !M.access || M.access.includes(R), j = De(M, p), Q = j?.custom?.serverAccess?.read !== void 0 ? await ie(j.custom.serverAccess.read, [R, i]) : !0;
10146
+ const P = !M.access || M.access.includes(R), j = Ie(M, p), Q = j?.custom?.serverAccess?.read !== void 0 ? await ie(j.custom.serverAccess.read, [R, i]) : !0;
10147
10147
  (!P || !Q) && (K(M) ? (delete i[M.name], delete i[`${M.name}_Array`], delete i[`${M.name}_Single`]) : delete i[M.name]);
10148
10148
  }
10149
10149
  }
@@ -10152,13 +10152,13 @@ const Tt = {
10152
10152
  return t?.providedTransaction ? await o(t.providedTransaction) : await r.runTransaction(async (a) => {
10153
10153
  await o(a);
10154
10154
  }, { readOnly: !0 }), i;
10155
- }, Io = async (n, e, t, s, r, i, o, a) => {
10156
- const l = ue(), c = Ye(r.labels.collection, i), u = r.labels.collection, h = r.fields.filter((d) => "unique" in d && d.unique), f = [];
10155
+ }, Do = async (n, e, t, s, r, i, o, a) => {
10156
+ const l = ue(), c = Je(r.labels.collection, i), u = r.labels.collection, h = r.fields.filter((d) => "unique" in d && d.unique), f = [];
10157
10157
  if (await Promise.all(h.map(async (d) => {
10158
10158
  {
10159
10159
  if (s[d.name] === void 0 || Me(s[d.name]))
10160
10160
  return;
10161
- De(d, c);
10161
+ Ie(d, c);
10162
10162
  const m = s[d.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
10163
10163
  if (!Qs(m))
10164
10164
  f.push(`${d.name} "${s[d.name]}" is invalid`);
@@ -10186,14 +10186,14 @@ const Tt = {
10186
10186
  };
10187
10187
  if (f) {
10188
10188
  const w = /* @__PURE__ */ new Date(), b = new Date((/* @__PURE__ */ new Date()).setDate(w.getDate() + f));
10189
- d.TTL = at.fromDate(b);
10189
+ d.TTL = lt.fromDate(b);
10190
10190
  }
10191
10191
  const m = ye(t);
10192
- tt(m), n !== "delete" && (d.data.data = ye(m)), n === "update" && (d.data.originalRecord = ye(l)), n !== "delete" && ["started", "written"].includes(e) && (delete d.data.data.Saved_At, delete d.data.data.Last_Save_At), e === "failed" && (d.data.error = JSON.stringify(a));
10193
- const O = Ie(u, r, s), y = t.Last_Write_At;
10192
+ nt(m), n !== "delete" && (d.data.data = ye(m)), n === "update" && (d.data.originalRecord = ye(l)), n !== "delete" && ["started", "written"].includes(e) && (delete d.data.data.Saved_At, delete d.data.data.Last_Save_At), e === "failed" && (d.data.error = JSON.stringify(a));
10193
+ const O = De(u, r, s), y = t.Last_Write_At;
10194
10194
  await O.doc(i).collection("system_write_log").doc(`${t.Last_Write_By}-${y.valueOf()}`).set(d);
10195
10195
  }, un = async (n) => {
10196
- const e = Et(), t = yt(), s = ue(), r = [];
10196
+ const e = Ye(), t = gt(), s = ue(), r = [];
10197
10197
  if (await Promise.all([
10198
10198
  (async () => {
10199
10199
  try {
@@ -10236,7 +10236,7 @@ ${i}`);
10236
10236
  }
10237
10237
  b && (T.replyTo = b), a && (T.message.attachments = a), N && (T.from = N), await c.collection("system_mail").add(T);
10238
10238
  }, Co = async (n, e, t, s, r, i, o) => {
10239
- const a = yt(), l = ue(), c = "USER_ERROR", u = async (d, m) => {
10239
+ const a = gt(), l = ue(), c = "USER_ERROR", u = async (d, m) => {
10240
10240
  try {
10241
10241
  await un(d);
10242
10242
  } catch {
@@ -10308,7 +10308,7 @@ ${i}`);
10308
10308
  const r = n.at(-2);
10309
10309
  if (!r)
10310
10310
  throw new Error("PERMISSION_DENIED");
10311
- const i = [...n].slice(0, -2), o = await ot(i, r).catch(() => {
10311
+ const i = [...n].slice(0, -2), o = await at(i, r).catch(() => {
10312
10312
  throw new Error("PERMISSION_DENIED");
10313
10313
  }), a = o.Collection_Path;
10314
10314
  if (a.push(o.id), a.push(t.collection), !ze(n, a))
@@ -10318,14 +10318,14 @@ ${i}`);
10318
10318
  }, Un = (n) => n !== null && typeof n == "object" && !Array.isArray(n), du = (n) => {
10319
10319
  const e = (t) => {
10320
10320
  Object.entries(t).forEach(([s, r]) => {
10321
- Un(r) && Object.keys(r).length === 2 && typeof r.seconds == "number" && typeof r.nanoseconds == "number" ? t[s] = new at(r.seconds, r.nanoseconds) : Un(r) && e(r);
10321
+ Un(r) && Object.keys(r).length === 2 && typeof r.seconds == "number" && typeof r.nanoseconds == "number" ? t[s] = new lt(r.seconds, r.nanoseconds) : Un(r) && e(r);
10322
10322
  });
10323
10323
  };
10324
10324
  e(n);
10325
10325
  }, $o = (n) => {
10326
10326
  const e = (t) => {
10327
10327
  Object.entries(t).forEach(([s, r]) => {
10328
- Un(r) && Object.keys(r).length === 2 && typeof r._seconds == "number" && typeof r._nanoseconds == "number" ? t[s] = new at(r._seconds, r._nanoseconds) : Un(r) && e(r);
10328
+ Un(r) && Object.keys(r).length === 2 && typeof r._seconds == "number" && typeof r._nanoseconds == "number" ? t[s] = new lt(r._seconds, r._nanoseconds) : Un(r) && e(r);
10329
10329
  });
10330
10330
  };
10331
10331
  e(n);
@@ -10340,7 +10340,7 @@ ${i}`);
10340
10340
  if (e[r] !== void 0) {
10341
10341
  s[r] = e[r];
10342
10342
  const i = W(n.fields, r);
10343
- gt(n, [i]).size === 1 && (s[`${r}_Lowercase`] = e[`${r}_Lowercase`]);
10343
+ wt(n, [i]).size === 1 && (s[`${r}_Lowercase`] = e[`${r}_Lowercase`]);
10344
10344
  }
10345
10345
  }), s;
10346
10346
  }
@@ -10354,7 +10354,7 @@ ${i}`);
10354
10354
  const [u, h] = c[0];
10355
10355
  if (!h)
10356
10356
  throw new Error(`VALIDATION_ERROR: Relation ${t.name} is required`);
10357
- const f = Ie(l, h.Collection_Path, n);
10357
+ const f = De(l, h.Collection_Path, n);
10358
10358
  if (i.size++, !o && i.size > 500)
10359
10359
  throw new Error("VALIDATION ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.");
10360
10360
  const d = await r.get(f.doc(u));
@@ -10378,7 +10378,7 @@ ${i}`);
10378
10378
  K(w) && ["OneToOne", "OneToMany"].includes(w.type) && w.enforceHierarchy && s[w.name] && (n === "Create" || n === "Update" && !ze(h?.[w.name], s[w.name])) && await Kr(e, i, w, s, a, l);
10379
10379
  for (const w of f)
10380
10380
  if (K(w) && w.twoWay) {
10381
- const b = o.collections[w.collection], N = W(b.fields, w.twoWay), p = dt(b, [N]);
10381
+ const b = o.collections[w.collection], N = W(b.fields, w.twoWay), p = ft(b, [N]);
10382
10382
  if (s[w.name]) {
10383
10383
  const T = Object.entries(s[w.name]);
10384
10384
  for (const C of T) {
@@ -10391,7 +10391,7 @@ ${i}`);
10391
10391
  else {
10392
10392
  if (l.size++, l && l.size > 500)
10393
10393
  throw new Error("VALIDATION_ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of two way updates, unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.");
10394
- const _ = Ie(d, Z.Collection_Path, e), A = await a.get(_.doc(v));
10394
+ const _ = De(d, Z.Collection_Path, e), A = await a.get(_.doc(v));
10395
10395
  if (!A.exists) {
10396
10396
  gn(w, r, v);
10397
10397
  continue;
@@ -10428,7 +10428,7 @@ ${i}`);
10428
10428
  else {
10429
10429
  if (l.size++, l && l.size > 500)
10430
10430
  throw new Error("VALIDATION_ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of two way updates, unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.");
10431
- const k = Ie(d, Z.Collection_Path, e), _ = await a.get(k.doc(v));
10431
+ const k = De(d, Z.Collection_Path, e), _ = await a.get(k.doc(v));
10432
10432
  if (!_.exists) {
10433
10433
  m.set(w.name, [...m.get(w.name) || [], v]);
10434
10434
  continue;
@@ -10448,7 +10448,7 @@ ${i}`);
10448
10448
  }
10449
10449
  }
10450
10450
  for (const [w, b] of y.entries()) {
10451
- const N = o.collections[w], p = Ye(w, o);
10451
+ const N = o.collections[w], p = Je(w, o);
10452
10452
  for (const [T, C] of Object.entries(b)) {
10453
10453
  const { addedFields: v, removedFields: Z } = Vc(n, T, w, i, s, h);
10454
10454
  if (c && u) {
@@ -10460,7 +10460,7 @@ ${i}`);
10460
10460
  }
10461
10461
  }
10462
10462
  for (const x of Z) {
10463
- const g = W(N.fields, x.twoWay), k = dt(N, [g]);
10463
+ const g = W(N.fields, x.twoWay), k = ft(N, [g]);
10464
10464
  if (!sr(N, g, u)) {
10465
10465
  ps(
10466
10466
  x,
@@ -10473,7 +10473,7 @@ ${i}`);
10473
10473
  continue;
10474
10474
  }
10475
10475
  }
10476
- if (!rt(
10476
+ if (!it(
10477
10477
  "Update",
10478
10478
  N,
10479
10479
  o,
@@ -10485,7 +10485,7 @@ ${i}`);
10485
10485
  for (const x of v)
10486
10486
  gn(x, r, T);
10487
10487
  for (const x of Z) {
10488
- const g = W(N.fields, x.twoWay), k = dt(N, [g]);
10488
+ const g = W(N.fields, x.twoWay), k = ft(N, [g]);
10489
10489
  ps(
10490
10490
  x,
10491
10491
  r,
@@ -10496,11 +10496,11 @@ ${i}`);
10496
10496
  );
10497
10497
  }
10498
10498
  }
10499
- if (!rt("Update", N, o, c, u, C)) {
10499
+ if (!it("Update", N, o, c, u, C)) {
10500
10500
  for (const x of v)
10501
10501
  gn(x, r, T);
10502
10502
  for (const x of Z) {
10503
- const g = W(N.fields, x.twoWay), k = dt(N, [g]);
10503
+ const g = W(N.fields, x.twoWay), k = ft(N, [g]);
10504
10504
  ps(
10505
10505
  x,
10506
10506
  r,
@@ -10525,13 +10525,13 @@ ${i}`);
10525
10525
  }
10526
10526
  return m;
10527
10527
  }, Fo = (n, e, t) => {
10528
- n === "create" && mt.forEach((s) => {
10528
+ n === "create" && pt.forEach((s) => {
10529
10529
  if (!ze(e[s], t[s]))
10530
10530
  throw new Error(`Updating system fields in hooks is not allowed: ${s}`);
10531
10531
  }), n === "update" && (["id", "Collection_Path", "Created_At", "Saved_At", "Created_By"].forEach((s) => {
10532
10532
  if (s in e)
10533
10533
  throw new Error(`Cannot update system field: ${s}`);
10534
- }), mt.forEach((s) => {
10534
+ }), pt.forEach((s) => {
10535
10535
  if (!["id", "Collection_Path", "Created_At", "Saved_At", "Created_By"].includes(s) && !ze(e[s], t[s]))
10536
10536
  throw new Error(`Updating system fields in hooks is not allowed: ${s}`);
10537
10537
  }));
@@ -10555,7 +10555,7 @@ ${i}`);
10555
10555
  if (!Te("Read", r.collections?.[e.labels.collection]))
10556
10556
  return !1;
10557
10557
  try {
10558
- await ot([e.labels.collection], t, { user: s, providedTransaction: n });
10558
+ await at([e.labels.collection], t, { user: s, providedTransaction: n });
10559
10559
  } catch {
10560
10560
  return !1;
10561
10561
  }
@@ -10625,24 +10625,24 @@ ${i}`);
10625
10625
  }
10626
10626
  }
10627
10627
  }, fu = async (n, e, t, s, r, i, o) => {
10628
- const a = Et(), l = Ut();
10628
+ const a = Ye(), l = Ut();
10629
10629
  let c = await Ge();
10630
10630
  if (n.length === 0)
10631
10631
  throw new Error("EMPTY_PATH");
10632
10632
  const u = n.at(-1), h = Object.keys(c.collections).includes(u), f = l.disabledCollections?.includes(u);
10633
10633
  if (!h || f)
10634
10634
  throw new Error("COLLECTION_NOT_FOUND");
10635
- const d = c.collections[u], { labels: m, fields: O, enableWriteLog: y, softDelete: w } = d, b = Ye(m.collection, c), N = await ie(l.appName), p = ue(), T = yt(), v = (s ? await T.getUser(s) : void 0)?.customClaims?.role;
10635
+ const d = c.collections[u], { labels: m, fields: O, enableWriteLog: y, softDelete: w } = d, b = Je(m.collection, c), N = await ie(l.appName), p = ue(), T = gt(), v = (s ? await T.getUser(s) : void 0)?.customClaims?.role;
10636
10636
  let Z;
10637
10637
  s && await Xs(n, d);
10638
- const x = Ie(p, n, a), g = o || x.doc().id;
10638
+ const x = De(p, n, a), g = o || x.doc().id;
10639
10639
  i = i || {}, i.collection = m.collection, e.id = g, $o(e), er(e);
10640
- const k = Us("create", n, e, c, N, "Online", s || "System", at.now(), me.serverTimestamp()), _ = ye(k);
10640
+ const k = Us("create", n, e, c, N, "Online", s || "System", lt.now(), me.serverTimestamp()), _ = ye(k);
10641
10641
  w && (k[w.archivedField] = !1), Ve(e), y && await Mt("create", "started", k, a, n, g, d), await ae("preOperation", l, b, ["create", k, g, i]), await ae("preWrite", l, b, ["create", k, g, i]), Sn(d, k, c), Tn(d, k), await ra(k, d, b, v), Ve(k);
10642
10642
  try {
10643
10643
  if (d.auth && t && !t.password)
10644
10644
  throw new Error("Password is required");
10645
- await Io("create", a, g, k, d, c), await sn("create", k, d, b, ["create", k, i], c);
10645
+ await Do("create", a, g, k, d, c), await sn("create", k, d, b, ["create", k, i], c);
10646
10646
  } catch (P) {
10647
10647
  throw new Error(`VALIDATION_ERROR: ${P.message}`);
10648
10648
  }
@@ -10661,13 +10661,13 @@ ${i}`);
10661
10661
  for (const Q of d.fields) {
10662
10662
  if (!(Q.name in k))
10663
10663
  continue;
10664
- const S = De(Q, b);
10664
+ const S = Ie(Q, b);
10665
10665
  if (S?.custom?.serverAccess?.create !== void 0 && !await ie(S.custom.serverAccess.create, [P, k]))
10666
10666
  throw new Error("PERMISSION_DENIED");
10667
10667
  }
10668
10668
  }
10669
10669
  t && (t.permissions ||= {}, t.permissions.Role ||= k.Role, t.permissions.Enabled ||= k.Enabled);
10670
- const I = async (P, j) => {
10670
+ const D = async (P, j) => {
10671
10671
  const [Q, S, q, B] = await Promise.all([
10672
10672
  P.get(p.collection("system_deployment").doc("latest_deploy")),
10673
10673
  P.get(p.collection("system_deployment").doc("maintenance_mode")),
@@ -10695,7 +10695,7 @@ ${i}`);
10695
10695
  if (!s || !oe.access || oe.access.includes(Z.Role)) {
10696
10696
  if (!e[oe.name])
10697
10697
  return;
10698
- const Le = De(oe, b);
10698
+ const Le = Ie(oe, b);
10699
10699
  if (!(s && Le?.custom?.serverAccess?.read !== void 0 ? await ie(Le.custom.serverAccess.read, [
10700
10700
  Z?.Role,
10701
10701
  k
@@ -10705,7 +10705,7 @@ ${i}`);
10705
10705
  if (Qs(Yn)) {
10706
10706
  if (j && j.size++, j && j.size > 500)
10707
10707
  throw new Error("VALIDATION_ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of unique field checks.");
10708
- if ((await P.get(p.collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${oe.name}`).doc(Yn)))?.exists)
10708
+ if ((await P.get(p.collection("tenants").doc(a).collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${oe.name}`).doc(Yn)))?.exists)
10709
10709
  throw new Error(`VALIDATION_ERROR: ${oe.name} "${k[oe.name]}" already exists`);
10710
10710
  } else
10711
10711
  throw new Error(`VALIDATION_ERROR: ${oe.name} "${k[oe.name]}" is invalid`);
@@ -10715,7 +10715,7 @@ ${i}`);
10715
10715
  };
10716
10716
  if (d.auth && t) {
10717
10717
  await p.runTransaction(async (j) => {
10718
- await I(j);
10718
+ await D(j);
10719
10719
  }, { maxAttempts: 10 });
10720
10720
  const P = await Co(
10721
10721
  a,
@@ -10732,9 +10732,9 @@ ${i}`);
10732
10732
  try {
10733
10733
  const P = { size: 1 };
10734
10734
  await p.runTransaction(async (j) => {
10735
- await I(j, P), r?.noTwoWay || await Mo("Create", a, g, k, k, d, c, j, P, s, Z);
10735
+ await D(j, P), r?.noTwoWay || await Mo("Create", a, g, k, k, d, c, j, P, s, Z);
10736
10736
  const Q = Vs(c);
10737
- Js("create", j, n, g, k, c, d, r, Q, me.arrayUnion, me.arrayRemove, me.delete, (S) => p.collection("tenants").doc(a).collection("system_fields").doc(m.collection).collection(`${m.collection}-${S.name}`).doc(g), (S, q) => p.collection("tenants").doc(a).collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${S.name}`).doc(q), (S) => p.collection("tenants").doc(a).collection("system_fields").doc(m.collection).collection(`${m.collection}-${S}`).doc(g), (S, q) => Ie(p, S, a).doc(q), (S, q, B) => p.collection("tenants").doc(a).collection("system_fields").doc(S.collection).collection(`${S.collection}-${q}`).doc(B), (S, q, B) => p.collection("tenants").doc(a).collection("system_fields").doc(S.collection).collection(`${S.collection}-${q.replaceAll(" ", "-")}`).doc(B), void 0, void 0, P), j.set(x.doc(g), k);
10737
+ Js("create", j, n, g, k, c, d, r, Q, me.arrayUnion, me.arrayRemove, me.delete, (S) => p.collection("tenants").doc(a).collection("system_fields").doc(m.collection).collection(`${m.collection}-${S.name}`).doc(g), (S, q) => p.collection("tenants").doc(a).collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${S.name}`).doc(q), (S) => p.collection("tenants").doc(a).collection("system_fields").doc(m.collection).collection(`${m.collection}-${S}`).doc(g), (S, q) => De(p, S, a).doc(q), (S, q, B) => p.collection("tenants").doc(a).collection("system_fields").doc(S.collection).collection(`${S.collection}-${q}`).doc(B), (S, q, B) => p.collection("tenants").doc(a).collection("system_fields").doc(S.collection).collection(`${S.collection}-${q.replaceAll(" ", "-")}`).doc(B), void 0, void 0, P), j.set(x.doc(g), k);
10738
10738
  }, { maxAttempts: 10 });
10739
10739
  } catch (P) {
10740
10740
  const Q = await ae("postWriteError", l, b, ["create", k, g, i, P]);
@@ -10746,7 +10746,7 @@ ${i}`);
10746
10746
  const R = ["create", k, g, i], F = [...R];
10747
10747
  return await ae("postWrite", l, b, R), await ae("postOperation", l, b, F), { id: g, ...k };
10748
10748
  }, Qt = async (n, e, t, s) => {
10749
- const r = Et(), i = yt(), o = ue(), a = e.customClaims || {};
10749
+ const r = Ye(), i = gt(), o = ue(), a = e.customClaims || {};
10750
10750
  let l = !1;
10751
10751
  try {
10752
10752
  await i.updateUser(n, {
@@ -10780,7 +10780,7 @@ ${i}`);
10780
10780
  if (l)
10781
10781
  throw new Error(`ROLLBACK_FAILED: ${s}`);
10782
10782
  }, jc = async (n, e, t, s, r, i, o, a, l, c, u) => {
10783
- const h = yt(), f = ue(), d = a?.customClaims || {}, m = "USER_ERROR";
10783
+ const h = gt(), f = ue(), d = a?.customClaims || {}, m = "USER_ERROR";
10784
10784
  let O = "";
10785
10785
  if (n === "create") {
10786
10786
  if (!u)
@@ -10854,40 +10854,40 @@ ${i}`);
10854
10854
  if (O)
10855
10855
  return O;
10856
10856
  }, Zc = async (n, e, t) => {
10857
- const s = ue(), r = [e];
10858
- t && t.trim() !== "" && r.push(t), r.sort();
10859
- const i = [];
10860
- for (const o of r) {
10861
- const a = s.collection("system_locks").doc(o);
10862
- if ((await n.get(a)).exists)
10857
+ const s = Ye(), r = ue(), i = [e];
10858
+ t && t.trim() !== "" && i.push(t), i.sort();
10859
+ const o = [];
10860
+ for (const a of i) {
10861
+ const l = r.collection("tenants").doc(s).collection("system_locks").doc(a);
10862
+ if ((await n.get(l)).exists)
10863
10863
  throw new Error("DOCUMENT_LOCKED");
10864
- i.push(a);
10864
+ o.push(l);
10865
10865
  }
10866
- for (const o of i)
10867
- n.set(o, { locked: !0 });
10866
+ for (const a of o)
10867
+ n.set(a, { locked: !0 });
10868
10868
  }, Xr = async (n, e) => {
10869
- const t = ue(), s = [n];
10870
- e && e.trim() !== "" && s.push(e), s.sort();
10871
- const r = t.batch();
10872
- for (const i of s) {
10873
- const o = t.collection("system_locks").doc(i);
10874
- r.delete(o);
10875
- }
10876
- await r.commit();
10869
+ const t = Ye(), s = ue(), r = [n];
10870
+ e && e.trim() !== "" && r.push(e), r.sort();
10871
+ const i = s.batch();
10872
+ for (const o of r) {
10873
+ const a = s.collection("tenants").doc(t).collection("system_locks").doc(o);
10874
+ i.delete(a);
10875
+ }
10876
+ await i.commit();
10877
10877
  }, zc = async (n, e, t, s, r, i, o) => {
10878
- const a = Et(), l = Ut();
10878
+ const a = Ye(), l = Ut();
10879
10879
  let c = await Ge(!0);
10880
10880
  if (n.length === 0)
10881
10881
  throw new Error("EMPTY_PATH");
10882
10882
  const u = n.at(-1), h = Object.keys(c.collections).includes(u), f = l.disabledCollections?.includes(u);
10883
10883
  if (!h || f)
10884
10884
  throw new Error("COLLECTION_NOT_FOUND");
10885
- const d = c.collections[u], { labels: m, fields: O, enableWriteLog: y } = d, w = Ye(m.collection, c), b = await ie(l.appName), N = yt(), p = ue();
10885
+ const d = c.collections[u], { labels: m, fields: O, enableWriteLog: y } = d, w = Je(m.collection, c), b = await ie(l.appName), N = gt(), p = ue();
10886
10886
  let T;
10887
10887
  r && await Xs(n, d);
10888
- const C = Ie(p, n, a);
10888
+ const C = De(p, n, a);
10889
10889
  o = o || {}, o.collection = m.collection;
10890
- let v = await ot(n, e, {
10890
+ let v = await at(n, e, {
10891
10891
  user: r,
10892
10892
  noComputedFields: !0,
10893
10893
  noEmbeddingFields: !0
@@ -10911,7 +10911,7 @@ ${i}`);
10911
10911
  throw new Error("VALIDATION_ERROR: Permissions are not allowed for delete operations");
10912
10912
  const Z = d.auth && s?.operation === "create", x = d.auth && s?.operation === "delete", g = d.auth && !Z && !x && (s?.operation === "update" || t.Role || t.Enabled !== void 0 || t.Name || t.Email || t.Photo_URL), k = (S) => S.User_ID && (d.auth && !Z && !x && s?.operation === "update" || t.Role && t.Role !== S.Role || t.Enabled !== void 0 && t.Enabled !== S.Enabled || t.Name && t.Name !== S.Name || t.Email && t.Email !== S.Email || t.Photo_URL && t.Photo_URL !== S.Photo_URL);
10913
10913
  delete t.id, $o(t), er(t);
10914
- const _ = Us("update", n, t, c, b, "Online", r || "System", at.now(), me.serverTimestamp()), A = ye(_);
10914
+ const _ = Us("update", n, t, c, b, "Online", r || "System", lt.now(), me.serverTimestamp()), A = ye(_);
10915
10915
  for (const S of O)
10916
10916
  !K(S) && Me(_[S.name]) && S.nullable && (_[S.name] = null);
10917
10917
  Ve(_), Ve(v), y && await Mt("update", "started", _, a, n, e, d, void 0, v);
@@ -10924,13 +10924,13 @@ ${i}`);
10924
10924
  ye(v)
10925
10925
  ];
10926
10926
  await ae("preOperation", l, w, E);
10927
- const I = ["update", _, e, o, void 0, ye(v)];
10928
- await ae("preWrite", l, w, I), Sn(d, _, c), Tn(d, _), Ve(_);
10927
+ const D = ["update", _, e, o, void 0, ye(v)];
10928
+ await ae("preWrite", l, w, D), Sn(d, _, c), Tn(d, _), Ve(_);
10929
10929
  try {
10930
10930
  if (Z && !s.password)
10931
10931
  throw new Error("Password is required");
10932
10932
  const S = { ...v, ..._ };
10933
- await Io("update", a, e, S, d, c), tt(S), await sn("update", S, d, w, ["update", _, o, void 0, ye(v)], c);
10933
+ await Do("update", a, e, S, d, c), nt(S), await sn("update", S, d, w, ["update", _, o, void 0, ye(v)], c);
10934
10934
  } catch (S) {
10935
10935
  throw new Error(`VALIDATION_ERROR: ${S.message}`);
10936
10936
  }
@@ -10939,17 +10939,17 @@ ${i}`);
10939
10939
  !K(S) && Me(_[S.name]) && S.nullable && (_[S.name] = null);
10940
10940
  try {
10941
10941
  const S = { ...v, ..._ };
10942
- tt(S), Po("update", d, _, v), Fo("update", _, A), await sn("update", S, d, w, ["update", _, o, void 0, v], c);
10942
+ nt(S), Po("update", d, _, v), Fo("update", _, A), await sn("update", S, d, w, ["update", _, o, void 0, v], c);
10943
10943
  } catch (S) {
10944
10944
  throw new Error(`VALIDATION_ERROR: ${S.message}`);
10945
10945
  }
10946
10946
  let R;
10947
10947
  s && (s.permissions ||= {});
10948
10948
  const F = async (S, q, B) => {
10949
- const [re, Je, Wt, pe, oe] = await Promise.all([
10949
+ const [re, Qe, Wt, pe, oe] = await Promise.all([
10950
10950
  S.get(p.collection("system_deployment").doc("latest_deploy")),
10951
10951
  S.get(p.collection("system_deployment").doc("maintenance_mode")),
10952
- ot(n, e, {
10952
+ at(n, e, {
10953
10953
  user: r,
10954
10954
  providedTransaction: S,
10955
10955
  noComputedFields: !0
@@ -10962,9 +10962,9 @@ ${i}`);
10962
10962
  const Le = re.data();
10963
10963
  if (Le.force && _.Last_Write_At.valueOf() < Le.time.valueOf())
10964
10964
  throw new Error("VERSION_ERROR");
10965
- if (!Je.exists)
10965
+ if (!Qe.exists)
10966
10966
  throw new Error("MAINTENANCE_MODE");
10967
- if (Je.data().active)
10967
+ if (Qe.data().active)
10968
10968
  throw new Error("MAINTENANCE_MODE");
10969
10969
  if (!Wt)
10970
10970
  throw new Error("NOT_FOUND");
@@ -10993,7 +10993,7 @@ ${i}`);
10993
10993
  if (!r || !de.access || de.access.includes(T.Role)) {
10994
10994
  if (_[de.name] === void 0 || Me(_[de.name]))
10995
10995
  return;
10996
- const jt = De(de, w), nr = { ...v, ..._ };
10996
+ const jt = Ie(de, w), nr = { ...v, ..._ };
10997
10997
  if (!(r && jt?.custom?.serverAccess?.read !== void 0 ? await ie(jt.custom.serverAccess.read, [
10998
10998
  T?.Role,
10999
10999
  nr
@@ -11003,7 +11003,7 @@ ${i}`);
11003
11003
  if (Qs(Zt)) {
11004
11004
  if (B && B.size++, B && B.size > 500)
11005
11005
  throw new Error("VALIDATION_ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of unique field checks.");
11006
- const Qn = await S.get(p.collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${de.name}`).doc(Zt));
11006
+ const Qn = await S.get(p.collection("tenants").doc(a).collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${de.name}`).doc(Zt));
11007
11007
  if (Qn.exists && Qn.data().id !== e)
11008
11008
  throw new Error(`VALIDATION_ERROR: ${de.name} "${_[de.name]}" already exists`);
11009
11009
  } else
@@ -11015,7 +11015,7 @@ ${i}`);
11015
11015
  if (!(w.custom?.serverAccess?.update !== void 0 ? await ie(w.custom.serverAccess.update, [de, jt, v]) : !0))
11016
11016
  throw new Error("PERMISSION_DENIED");
11017
11017
  for (const Jn of d.fields) {
11018
- const Zt = De(Jn, w);
11018
+ const Zt = Ie(Jn, w);
11019
11019
  if (Object.prototype.hasOwnProperty.call(_, Jn.name) && Zt?.custom?.serverAccess?.update !== void 0 && !await ie(Zt.custom.serverAccess.update, [
11020
11020
  de,
11021
11021
  jt,
@@ -11039,7 +11039,7 @@ ${i}`);
11039
11039
  throw new Error("USER_ERROR");
11040
11040
  }
11041
11041
  const q = { ...v, ..._ };
11042
- tt(q);
11042
+ nt(q);
11043
11043
  const B = await jc(s?.operation || "update", a, e, l, m.collection, q, v, S, s?.permissions, R, s?.password);
11044
11044
  Z && (_.User_ID = B), x && (_.User_ID = me.delete());
11045
11045
  }
@@ -11048,10 +11048,10 @@ ${i}`);
11048
11048
  await p.runTransaction(async (B) => {
11049
11049
  const re = { ...v, ..._ };
11050
11050
  await F(B, !1, q);
11051
- let Je;
11052
- i?.noTwoWay || (Je = await Mo("Update", a, e, re, _, d, c, B, q, r, T, v));
11051
+ let Qe;
11052
+ i?.noTwoWay || (Qe = await Mo("Update", a, e, re, _, d, c, B, q, r, T, v));
11053
11053
  const Wt = Vs(c);
11054
- Js("update", B, n, e, _, c, d, i, Wt, me.arrayUnion, me.arrayRemove, me.delete, (pe) => p.collection("tenants").doc(a).collection("system_fields").doc(m.collection).collection(`${m.collection}-${pe.name}`).doc(e), (pe, oe) => p.collection("tenants").doc(a).collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${pe.name}`).doc(oe), (pe) => p.collection("tenants").doc(a).collection("system_fields").doc(m.collection).collection(`${m.collection}-${pe}`).doc(e), (pe, oe) => Ie(p, pe, a).doc(oe), (pe, oe, Le) => p.collection("tenants").doc(a).collection("system_fields").doc(pe.collection).collection(`${pe.collection}-${oe}`).doc(Le), (pe, oe, Le) => p.collection("tenants").doc(a).collection("system_fields").doc(pe.collection).collection(`${pe.collection}-${oe.replaceAll(" ", "-")}`).doc(Le), v, Je, q), B.update(C.doc(e), _);
11054
+ Js("update", B, n, e, _, c, d, i, Wt, me.arrayUnion, me.arrayRemove, me.delete, (pe) => p.collection("tenants").doc(a).collection("system_fields").doc(m.collection).collection(`${m.collection}-${pe.name}`).doc(e), (pe, oe) => p.collection("tenants").doc(a).collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${pe.name}`).doc(oe), (pe) => p.collection("tenants").doc(a).collection("system_fields").doc(m.collection).collection(`${m.collection}-${pe}`).doc(e), (pe, oe) => De(p, pe, a).doc(oe), (pe, oe, Le) => p.collection("tenants").doc(a).collection("system_fields").doc(pe.collection).collection(`${pe.collection}-${oe}`).doc(Le), (pe, oe, Le) => p.collection("tenants").doc(a).collection("system_fields").doc(pe.collection).collection(`${pe.collection}-${oe.replaceAll(" ", "-")}`).doc(Le), v, Qe, q), B.update(C.doc(e), _);
11055
11055
  }, { maxAttempts: 10 });
11056
11056
  } catch (q) {
11057
11057
  const B = [
@@ -11064,8 +11064,8 @@ ${i}`);
11064
11064
  void 0,
11065
11065
  ye(v)
11066
11066
  ], re = await ae("postWriteError", l, w, B);
11067
- if (y && (await new Promise((Je) => {
11068
- setTimeout(Je, 250);
11067
+ if (y && (await new Promise((Qe) => {
11068
+ setTimeout(Qe, 250);
11069
11069
  }), await Mt("update", re?.resolved ? "success" : "failed", _, a, n, e, d, re?.resolved ? void 0 : q, v)), !re?.resolved)
11070
11070
  throw Z && await un(v), k(v) && await Qt(v.User_ID, S, R, "USER_ERROR"), x && await p.collection(m.collection).doc(e).update({ User_ID: me.delete() }), q;
11071
11071
  }
@@ -11080,37 +11080,37 @@ ${i}`);
11080
11080
  const M = ["update", _, e, o, void 0, ye(v)], P = [...M];
11081
11081
  await ae("postWrite", l, w, M), await ae("postOperation", l, w, P);
11082
11082
  const j = { ...v, ..._ };
11083
- return tt(j), { id: e, ...j };
11083
+ return nt(j), { id: e, ...j };
11084
11084
  }, hu = async (n, e, t, s, r) => {
11085
- const i = Et(), o = Ut();
11085
+ const i = Ye(), o = Ut();
11086
11086
  let a = await Ge();
11087
11087
  if (n.length === 0)
11088
11088
  throw new Error("EMPTY_PATH");
11089
11089
  const l = n.at(-1), c = Object.keys(a.collections).includes(l), u = o.disabledCollections?.includes(l);
11090
11090
  if (!c || u)
11091
11091
  throw new Error("COLLECTION_NOT_FOUND");
11092
- const h = a.collections[l], { labels: f, auth: d, enableWriteLog: m, softDelete: O } = h, y = Ye(f.collection, a), w = await ie(o.appName);
11092
+ const h = a.collections[l], { labels: f, auth: d, enableWriteLog: m, softDelete: O } = h, y = Je(f.collection, a), w = await ie(o.appName);
11093
11093
  if (O && !d && !s?.force)
11094
11094
  return await zc(n, e, { [O.archivedField]: !0, [O.timestampField]: me.serverTimestamp() }, void 0, t);
11095
11095
  const b = ue();
11096
11096
  let N;
11097
11097
  t && await Xs(n, h);
11098
- const p = Ie(b, n, i);
11098
+ const p = De(b, n, i);
11099
11099
  r = r || {}, r.collection = f.collection;
11100
- const T = await ot(n, e, { user: t });
11101
- let C = Us("delete", n, T, a, w, "Online", t || "System", at.now(), me.serverTimestamp());
11100
+ const T = await at(n, e, { user: t });
11101
+ let C = Us("delete", n, T, a, w, "Online", t || "System", lt.now(), me.serverTimestamp());
11102
11102
  const v = bn(C);
11103
11103
  Ve(C), m && await Mt("delete", "started", C, i, n, e, h), await ae("preOperation", o, y, ["delete", C, e, r]), await ae("preWrite", o, y, ["delete", C, e, r]), Ve(C);
11104
11104
  const g = async (E) => {
11105
- const [I, R, F, M] = await Promise.all([
11105
+ const [D, R, F, M] = await Promise.all([
11106
11106
  E.get(b.collection("system_deployment").doc("maintenance_mode")),
11107
- ot([f.collection], e, { user: t, providedTransaction: E }),
11107
+ at([f.collection], e, { user: t, providedTransaction: E }),
11108
11108
  t ? E.get(b.collection("tenants").doc(i).collection("system_user_permissions").doc(t)) : Promise.resolve(Promise.resolve({})),
11109
11109
  Ge()
11110
11110
  ]);
11111
- if (!I.exists)
11111
+ if (!D.exists)
11112
11112
  throw new Error("MAINTENANCE_MODE");
11113
- if (I.data().active)
11113
+ if (D.data().active)
11114
11114
  throw new Error("MAINTENANCE_MODE");
11115
11115
  if (!R)
11116
11116
  throw new Error("NOT_FOUND");
@@ -11135,8 +11135,8 @@ ${i}`);
11135
11135
  try {
11136
11136
  await b.runTransaction(async (E) => {
11137
11137
  await g(E);
11138
- const I = Vs(a);
11139
- Js("delete", E, n, e, C, a, h, s, I, me.arrayUnion, me.arrayRemove, me.delete, (R) => b.collection("tenants").doc(i).collection("system_fields").doc(f.collection).collection(`${f.collection}-${R.name}`).doc(e), (R, F) => b.collection("tenants").doc(i).collection("system_unique").doc(f.collection).collection(`Unique-${f.collection}-${R.name}`).doc(F), (R) => b.collection("tenants").doc(i).collection("system_fields").doc(f.collection).collection(`${f.collection}-${R}`).doc(e), (R, F) => Ie(b, R, i).doc(F), (R, F, M) => b.collection("tenants").doc(i).collection("system_fields").doc(R.collection).collection(`${R.collection}-${F}`).doc(M), (R, F, M) => b.collection("tenants").doc(i).collection("system_fields").doc(R.collection).collection(`${R.collection}-${F.replaceAll(" ", "-")}`).doc(M)), E.delete(p.doc(e));
11138
+ const D = Vs(a);
11139
+ Js("delete", E, n, e, C, a, h, s, D, me.arrayUnion, me.arrayRemove, me.delete, (R) => b.collection("tenants").doc(i).collection("system_fields").doc(f.collection).collection(`${f.collection}-${R.name}`).doc(e), (R, F) => b.collection("tenants").doc(i).collection("system_unique").doc(f.collection).collection(`Unique-${f.collection}-${R.name}`).doc(F), (R) => b.collection("tenants").doc(i).collection("system_fields").doc(f.collection).collection(`${f.collection}-${R}`).doc(e), (R, F) => De(b, R, i).doc(F), (R, F, M) => b.collection("tenants").doc(i).collection("system_fields").doc(R.collection).collection(`${R.collection}-${F}`).doc(M), (R, F, M) => b.collection("tenants").doc(i).collection("system_fields").doc(R.collection).collection(`${R.collection}-${F.replaceAll(" ", "-")}`).doc(M)), E.delete(p.doc(e));
11140
11140
  }, { maxAttempts: 10 });
11141
11141
  } catch (E) {
11142
11142
  const R = await ae("postWriteError", o, y, ["delete", C, e, r, E]);
@@ -11159,14 +11159,14 @@ ${i}`);
11159
11159
  }, qc = (n) => n !== null && typeof n == "object", pu = (n) => {
11160
11160
  const e = (t) => {
11161
11161
  Object.entries(t).forEach(([s, r]) => {
11162
- r instanceof at ? t[s] = {
11162
+ r instanceof lt ? t[s] = {
11163
11163
  _seconds: r.seconds,
11164
11164
  _nanoseconds: r.nanoseconds
11165
11165
  } : qc(r) && e(r);
11166
11166
  });
11167
11167
  };
11168
11168
  e(n);
11169
- }, yu = async (n) => await yt().getUser(n), gu = (n) => {
11169
+ }, yu = async (n) => await gt().getUser(n), gu = (n) => {
11170
11170
  const e = So();
11171
11171
  return V.fromJSDate(n).setZone(e);
11172
11172
  }, Bc = (n) => {
@@ -11178,7 +11178,7 @@ ${i}`);
11178
11178
  }, _u = (n, e) => {
11179
11179
  const s = V.fromJSDate(n, { zone: e }).offset, i = V.fromJSDate(n).offset, o = s - i;
11180
11180
  return V.fromJSDate(n).minus({ minutes: o }).toJSDate();
11181
- }, Eu = (n) => "seconds" in n && "nanoseconds" in n ? Bc(new at(n.seconds, n.nanoseconds)).toFormat("MMMM d, yyyy '@' h:mm a") : "";
11181
+ }, Eu = (n) => "seconds" in n && "nanoseconds" in n ? Bc(new lt(n.seconds, n.nanoseconds)).toFormat("MMMM d, yyyy '@' h:mm a") : "";
11182
11182
  export {
11183
11183
  fu as addRecord,
11184
11184
  Co as addUser,
@@ -11196,9 +11196,9 @@ export {
11196
11196
  Pc as getCollectionRefs,
11197
11197
  Fc as getCustomizationFiles,
11198
11198
  To as getDocumentRefs,
11199
- Ie as getFirestorePathRef,
11199
+ De as getFirestorePathRef,
11200
11200
  ou as getInputSchema,
11201
- ot as getOne,
11201
+ at as getOne,
11202
11202
  No as getSome,
11203
11203
  yu as getUser,
11204
11204
  Ca as getZodSchema,