@stoker-platform/web-client 0.5.36 → 0.5.37

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
@@ -1,14 +1,14 @@
1
1
  import { getApp as it, registerVersion as xm, initializeApp as zn, setLogLevel as Qr, onLog as Nm } from "firebase/app";
2
2
  import { isSupported as Fm, initializeAnalytics as Dm, setConsent as Mm } from "firebase/analytics";
3
- import { getAuth as fr, validatePassword as _d, initializeAuth as Oc, indexedDBLocalPersistence as Pm, browserLocalPersistence as qm, browserSessionPersistence as Ec, inMemoryPersistence as Sc, beforeAuthStateChanged as Lm, connectAuthEmulator as $m, onAuthStateChanged as Bn, getIdTokenResult as jm, signOut as vd, signInWithEmailAndPassword as Um, getMultiFactorResolver as Vm, TotpMultiFactorGenerator as Xa, signInWithCustomToken as Wm, multiFactor as Tc } from "firebase/auth";
3
+ import { getAuth as dr, validatePassword as _d, initializeAuth as Oc, indexedDBLocalPersistence as Pm, browserLocalPersistence as qm, browserSessionPersistence as Ec, inMemoryPersistence as Sc, beforeAuthStateChanged as Lm, connectAuthEmulator as $m, onAuthStateChanged as Bn, getIdTokenResult as jm, signOut as vd, signInWithEmailAndPassword as Um, getMultiFactorResolver as Vm, TotpMultiFactorGenerator as Xa, signInWithCustomToken as Wm, multiFactor as Tc } from "firebase/auth";
4
4
  import { getDatabase as wd, onValue as zm, ref as Bm, connectDatabaseEmulator as Zm } from "firebase/database";
5
- import { getFirestore as We, where as ye, query as me, collection as qr, and as Xr, or as Rc, onSnapshot as dr, doc as ke, Timestamp as Bt, setDoc as Gm, getDoc as bd, orderBy as rt, limit as Xt, startAfter as eo, endBefore as to, limitToLast as Nr, getDocsFromCache as Od, getDocsFromServer as Hm, getDocs as Km, getCountFromServer as Ed, getDocFromCache as Ym, getDocFromServer as Jm, writeBatch as Ao, serverTimestamp as Lr, deleteField as Cn, arrayRemove as ko, arrayUnion as Io, collectionGroup as Qm, connectFirestoreEmulator as Cc, persistentLocalCache as Ac, persistentSingleTabManager as kc, persistentMultipleTabManager as Ic, memoryEagerGarbageCollector as Xm, memoryLruGarbageCollector as ep, memoryLocalCache as tp, initializeFirestore as Zn, getPersistentCacheIndexManager as rp, enablePersistentCacheIndexAutoCreation as np, terminate as sp, clearIndexedDbPersistence as xc, waitForPendingWrites as ip, onSnapshotsInSync as Sd, startAt as ap, endAt as op, addDoc as Td } from "firebase/firestore";
5
+ import { getFirestore as We, where as ye, query as he, collection as qr, and as Xr, or as Rc, onSnapshot as hr, doc as ke, Timestamp as Bt, setDoc as Gm, getDoc as bd, orderBy as rt, limit as Xt, startAfter as eo, endBefore as to, limitToLast as Fr, getDocsFromCache as Od, getDocsFromServer as Hm, getDocs as Km, getCountFromServer as Ed, getDocFromCache as Ym, getDocFromServer as Jm, writeBatch as Ao, serverTimestamp as Lr, deleteField as Cn, arrayRemove as ko, arrayUnion as Io, collectionGroup as Qm, connectFirestoreEmulator as Cc, persistentLocalCache as Ac, persistentSingleTabManager as kc, persistentMultipleTabManager as Ic, memoryEagerGarbageCollector as Xm, memoryLruGarbageCollector as ep, memoryLocalCache as tp, initializeFirestore as Zn, getPersistentCacheIndexManager as rp, enablePersistentCacheIndexAutoCreation as np, terminate as sp, clearIndexedDbPersistence as xc, waitForPendingWrites as ip, onSnapshotsInSync as Sd, startAt as ap, endAt as op, addDoc as Td } from "firebase/firestore";
6
6
  import { connectStorageEmulator as cp, getStorage as lp } from "firebase/storage";
7
7
  import { getFunctions as Ue, httpsCallable as Je, connectFunctionsEmulator as up } from "firebase/functions";
8
8
  import { ReCaptchaEnterpriseProvider as fp, initializeAppCheck as Gn, onTokenChanged as Hn } from "firebase/app-check";
9
9
  import { getPerformance as dp } from "firebase/performance";
10
10
  import { getRemoteConfig as hp, fetchAndActivate as mp } from "firebase/remote-config";
11
- const pp = "0.5.35", yp = (r) => !!r.auth, vt = (r, e) => {
11
+ const pp = "0.5.37", yp = (r) => !!r.auth, vt = (r, e) => {
12
12
  if (e?.operations)
13
13
  return e.operations.includes(r);
14
14
  }, An = (r, e) => e ? e.Role ? r.access?.includes(e.Role) : !1 : !0, gp = (r, e) => e ? !e.Role || r.restrictCreate === !0 ? !1 : typeof r.restrictCreate == "object" ? r.restrictCreate?.includes(e.Role) : !0 : !0, _p = (r, e) => e ? !e.Role || r.restrictUpdate === !0 ? !1 : typeof r.restrictUpdate == "object" ? r.restrictUpdate?.includes(e.Role) : !0 : !0, re = (r, e) => r.filter((t) => t.name === e)[0], _e = (r) => ["OneToOne", "OneToMany", "ManyToOne", "ManyToMany"].includes(r.type), Rd = (r, e) => {
@@ -41,7 +41,7 @@ const pp = "0.5.35", yp = (r) => !!r.auth, vt = (r, e) => {
41
41
  const l = t.collections?.[c.collection], f = e.collections[c.collection].access.entityRestrictions;
42
42
  if (!f)
43
43
  throw new Error("PERMISSION_DENIED");
44
- const h = f.restrictions?.find((d) => d.type === a.type && d.roles.some((m) => m.role === t.Role));
44
+ const h = f.restrictions?.find((d) => d.type === a.type && d.roles.some((p) => p.role === t.Role));
45
45
  if (!h)
46
46
  throw new Error("PERMISSION_DENIED");
47
47
  h.roles.forEach((d) => {
@@ -66,36 +66,36 @@ const pp = "0.5.35", yp = (r) => !!r.auth, vt = (r, e) => {
66
66
  return;
67
67
  }
68
68
  const u = Rd(e, s), f = xo(e, s), h = Cd(e, t, s);
69
- u?.filter((g) => g.type === "Record_Owner").forEach((g) => {
70
- "operations" in g && g.operations && !g.operations.includes(r) || i.Created_By !== n && (l = !1);
71
- }), u?.filter((g) => g.type === "Record_User").forEach((g) => {
72
- if ("operations" in g && g.operations && !g.operations.includes(r))
69
+ u?.filter((m) => m.type === "Record_Owner").forEach((m) => {
70
+ "operations" in m && m.operations && !m.operations.includes(r) || i.Created_By !== n && (l = !1);
71
+ }), u?.filter((m) => m.type === "Record_User").forEach((m) => {
72
+ if ("operations" in m && m.operations && !m.operations.includes(r))
73
73
  return;
74
- const C = re(o, g.collectionField);
75
- i[`${C.name}_Array`]?.includes(s.Doc_ID) || (l = !1);
76
- }), u?.filter((g) => g.type === "Record_Property").forEach((g) => {
77
- if ("operations" in g && g.operations && !g.operations.includes(r))
74
+ const T = re(o, m.collectionField);
75
+ i[`${T.name}_Array`]?.includes(s.Doc_ID) || (l = !1);
76
+ }), u?.filter((m) => m.type === "Record_Property").forEach((m) => {
77
+ if ("operations" in m && m.operations && !m.operations.includes(r))
78
78
  return;
79
- const C = re(o, g.propertyField), R = g.roles.find((v) => v.role === s.Role);
80
- C.type === "Array" ? R.values?.some((v) => i[C.name].includes(v)) || (l = !1) : R.values?.includes(i[C.name]) || (l = !1);
79
+ const T = re(o, m.propertyField), R = m.roles.find((v) => v.role === s.Role);
80
+ T.type === "Array" ? R.values?.some((v) => i[T.name].includes(v)) || (l = !1) : R.values?.includes(i[T.name]) || (l = !1);
81
81
  });
82
- let d = !0, m = !1;
83
- f?.filter((g) => g.type === "Individual").forEach(() => {
84
- m = !0, c?.individualEntities?.includes(i.id) || (d = !1);
82
+ let d = !0, p = !1;
83
+ f?.filter((m) => m.type === "Individual").forEach(() => {
84
+ p = !0, c?.individualEntities?.includes(i.id) || (d = !1);
85
85
  });
86
86
  let E = !0, y = !1;
87
- if (f?.filter((g) => g.type === "Parent").forEach((g) => {
87
+ if (f?.filter((m) => m.type === "Parent").forEach((m) => {
88
88
  y = !0;
89
- const C = re(o, g.collectionField);
90
- c?.parentEntities?.some((R) => i[`${C.name}_Array`].includes(R)) || (E = !1);
91
- }), f?.filter((g) => g.type === "Parent_Property").forEach((g) => {
89
+ const T = re(o, m.collectionField);
90
+ c?.parentEntities?.some((R) => i[`${T.name}_Array`].includes(R)) || (E = !1);
91
+ }), f?.filter((m) => m.type === "Parent_Property").forEach((m) => {
92
92
  y = !0;
93
- const C = re(o, g.collectionField), R = re(o, g.propertyField);
93
+ const T = re(o, m.collectionField), R = re(o, m.propertyField);
94
94
  Object.entries(c?.parentPropertyEntities || {}).some((v) => {
95
- const [A, p] = v;
96
- return A === i[R.name] && i[`${C.name}_Array`].some((k) => p.includes(k));
95
+ const [C, g] = v;
96
+ return C === i[R.name] && i[`${T.name}_Array`].some((k) => g.includes(k));
97
97
  }) || (E = !1);
98
- }), m && y) {
98
+ }), p && y) {
99
99
  if (!(d || E)) {
100
100
  l = !1;
101
101
  return;
@@ -105,41 +105,41 @@ const pp = "0.5.35", yp = (r) => !!r.auth, vt = (r, e) => {
105
105
  return;
106
106
  }
107
107
  let _ = !0, S = !1;
108
- h?.filter((g) => g.parentFilter.type === "Individual").forEach((g) => {
108
+ h?.filter((m) => m.parentFilter.type === "Individual").forEach((m) => {
109
109
  S = !0;
110
- const { parentFilter: C } = g, R = re(o, C.collectionField), v = s.collections?.[R.collection];
110
+ const { parentFilter: T } = m, R = re(o, T.collectionField), v = s.collections?.[R.collection];
111
111
  if (!v) {
112
112
  l = !1;
113
113
  return;
114
114
  }
115
- v.individualEntities?.some((A) => i[`${R.name}_Array`].includes(A)) || (_ = !1);
115
+ v.individualEntities?.some((C) => i[`${R.name}_Array`].includes(C)) || (_ = !1);
116
116
  });
117
- let T = !0, P = !1;
118
- if (h?.filter((g) => g.parentFilter.type === "Parent").forEach((g) => {
119
- P = !0;
120
- const { parentFilter: C } = g, R = re(o, C.collectionField), v = re(o, C.parentCollectionField), A = s.collections?.[R.collection];
121
- if (!A) {
117
+ let A = !0, F = !1;
118
+ if (h?.filter((m) => m.parentFilter.type === "Parent").forEach((m) => {
119
+ F = !0;
120
+ const { parentFilter: T } = m, R = re(o, T.collectionField), v = re(o, T.parentCollectionField), C = s.collections?.[R.collection];
121
+ if (!C) {
122
122
  l = !1;
123
123
  return;
124
124
  }
125
- A.parentEntities?.some((p) => i[`${v.name}_Array`].includes(p)) || (T = !1);
126
- }), h?.filter((g) => g.parentFilter.type === "Parent_Property").forEach((g) => {
127
- P = !0;
128
- const { parentFilter: C } = g, R = re(o, C.collectionField), v = re(o, C.parentPropertyField), A = re(o, C.parentCollectionField), p = s.collections?.[R.collection];
129
- if (!p) {
125
+ C.parentEntities?.some((g) => i[`${v.name}_Array`].includes(g)) || (A = !1);
126
+ }), h?.filter((m) => m.parentFilter.type === "Parent_Property").forEach((m) => {
127
+ F = !0;
128
+ const { parentFilter: T } = m, R = re(o, T.collectionField), v = re(o, T.parentPropertyField), C = re(o, T.parentCollectionField), g = s.collections?.[R.collection];
129
+ if (!g) {
130
130
  l = !1;
131
131
  return;
132
132
  }
133
- Object.entries(p.parentPropertyEntities || {}).some((k) => {
133
+ Object.entries(g.parentPropertyEntities || {}).some((k) => {
134
134
  const [I, b] = k;
135
- return I === i[v.name] && i[`${A.name}_Array`].some((w) => b.includes(w));
136
- }) || (T = !1);
137
- }), S && P) {
138
- if (!(_ || T)) {
135
+ return I === i[v.name] && i[`${C.name}_Array`].some((w) => b.includes(w));
136
+ }) || (A = !1);
137
+ }), S && F) {
138
+ if (!(_ || A)) {
139
139
  l = !1;
140
140
  return;
141
141
  }
142
- } else if (!_ || !T) {
142
+ } else if (!_ || !A) {
143
143
  l = !1;
144
144
  return;
145
145
  }
@@ -354,7 +354,7 @@ function Ip() {
354
354
  return fs = t, fs;
355
355
  }
356
356
  var ds, Kc;
357
- function hr() {
357
+ function mr() {
358
358
  if (Kc) return ds;
359
359
  Kc = 1;
360
360
  var r = Wr(), e = kp(), t = Ip(), n = "[object Null]", s = "[object Undefined]", i = r ? r.toStringTag : void 0;
@@ -377,7 +377,7 @@ var ms, Jc;
377
377
  function No() {
378
378
  if (Jc) return ms;
379
379
  Jc = 1;
380
- var r = hr(), e = wt(), t = "[object AsyncFunction]", n = "[object Function]", s = "[object GeneratorFunction]", i = "[object Proxy]";
380
+ var r = mr(), e = wt(), t = "[object AsyncFunction]", n = "[object Function]", s = "[object GeneratorFunction]", i = "[object Proxy]";
381
381
  function a(o) {
382
382
  if (!e(o))
383
383
  return !1;
@@ -723,32 +723,32 @@ function xd() {
723
723
  Cl = 1;
724
724
  var r = Yp(), e = Jp(), t = Qp(), n = 1, s = 2;
725
725
  function i(a, o, c, l, u, f) {
726
- var h = c & n, d = a.length, m = o.length;
727
- if (d != m && !(h && m > d))
726
+ var h = c & n, d = a.length, p = o.length;
727
+ if (d != p && !(h && p > d))
728
728
  return !1;
729
729
  var E = f.get(a), y = f.get(o);
730
730
  if (E && y)
731
731
  return E == o && y == a;
732
- var _ = -1, S = !0, T = c & s ? new r() : void 0;
732
+ var _ = -1, S = !0, A = c & s ? new r() : void 0;
733
733
  for (f.set(a, o), f.set(o, a); ++_ < d; ) {
734
- var P = a[_], g = o[_];
734
+ var F = a[_], m = o[_];
735
735
  if (l)
736
- var C = h ? l(g, P, _, o, a, f) : l(P, g, _, a, o, f);
737
- if (C !== void 0) {
738
- if (C)
736
+ var T = h ? l(m, F, _, o, a, f) : l(F, m, _, a, o, f);
737
+ if (T !== void 0) {
738
+ if (T)
739
739
  continue;
740
740
  S = !1;
741
741
  break;
742
742
  }
743
- if (T) {
743
+ if (A) {
744
744
  if (!e(o, function(R, v) {
745
- if (!t(T, v) && (P === R || u(P, R, c, l, f)))
746
- return T.push(v);
745
+ if (!t(A, v) && (F === R || u(F, R, c, l, f)))
746
+ return A.push(v);
747
747
  })) {
748
748
  S = !1;
749
749
  break;
750
750
  }
751
- } else if (!(P === g || u(P, g, c, l, f))) {
751
+ } else if (!(F === m || u(F, m, c, l, f))) {
752
752
  S = !1;
753
753
  break;
754
754
  }
@@ -792,43 +792,43 @@ var Hs, xl;
792
792
  function ty() {
793
793
  if (xl) return Hs;
794
794
  xl = 1;
795
- var r = Wr(), e = Nd(), t = Vr(), n = xd(), s = Xp(), i = ey(), a = 1, o = 2, c = "[object Boolean]", l = "[object Date]", u = "[object Error]", f = "[object Map]", h = "[object Number]", d = "[object RegExp]", m = "[object Set]", E = "[object String]", y = "[object Symbol]", _ = "[object ArrayBuffer]", S = "[object DataView]", T = r ? r.prototype : void 0, P = T ? T.valueOf : void 0;
796
- function g(C, R, v, A, p, k, I) {
795
+ var r = Wr(), e = Nd(), t = Vr(), n = xd(), s = Xp(), i = ey(), a = 1, o = 2, c = "[object Boolean]", l = "[object Date]", u = "[object Error]", f = "[object Map]", h = "[object Number]", d = "[object RegExp]", p = "[object Set]", E = "[object String]", y = "[object Symbol]", _ = "[object ArrayBuffer]", S = "[object DataView]", A = r ? r.prototype : void 0, F = A ? A.valueOf : void 0;
796
+ function m(T, R, v, C, g, k, I) {
797
797
  switch (v) {
798
798
  case S:
799
- if (C.byteLength != R.byteLength || C.byteOffset != R.byteOffset)
799
+ if (T.byteLength != R.byteLength || T.byteOffset != R.byteOffset)
800
800
  return !1;
801
- C = C.buffer, R = R.buffer;
801
+ T = T.buffer, R = R.buffer;
802
802
  case _:
803
- return !(C.byteLength != R.byteLength || !k(new e(C), new e(R)));
803
+ return !(T.byteLength != R.byteLength || !k(new e(T), new e(R)));
804
804
  case c:
805
805
  case l:
806
806
  case h:
807
- return t(+C, +R);
807
+ return t(+T, +R);
808
808
  case u:
809
- return C.name == R.name && C.message == R.message;
809
+ return T.name == R.name && T.message == R.message;
810
810
  case d:
811
811
  case E:
812
- return C == R + "";
812
+ return T == R + "";
813
813
  case f:
814
814
  var b = s;
815
- case m:
816
- var w = A & a;
817
- if (b || (b = i), C.size != R.size && !w)
815
+ case p:
816
+ var w = C & a;
817
+ if (b || (b = i), T.size != R.size && !w)
818
818
  return !1;
819
- var O = I.get(C);
819
+ var O = I.get(T);
820
820
  if (O)
821
821
  return O == R;
822
- A |= o, I.set(C, R);
823
- var x = n(b(C), b(R), A, p, k, I);
824
- return I.delete(C), x;
822
+ C |= o, I.set(T, R);
823
+ var x = n(b(T), b(R), C, g, k, I);
824
+ return I.delete(T), x;
825
825
  case y:
826
- if (P)
827
- return P.call(C) == P.call(R);
826
+ if (F)
827
+ return F.call(T) == F.call(R);
828
828
  }
829
829
  return !1;
830
830
  }
831
- return Hs = g, Hs;
831
+ return Hs = m, Hs;
832
832
  }
833
833
  var Ks, Nl;
834
834
  function Fd() {
@@ -916,7 +916,7 @@ var ni, jl;
916
916
  function sy() {
917
917
  if (jl) return ni;
918
918
  jl = 1;
919
- var r = hr(), e = bt(), t = "[object Arguments]";
919
+ var r = mr(), e = bt(), t = "[object Arguments]";
920
920
  function n(s) {
921
921
  return e(s) && r(s) == t;
922
922
  }
@@ -933,7 +933,7 @@ function Pd() {
933
933
  };
934
934
  return si = i, si;
935
935
  }
936
- var Er = { exports: {} }, ii, Vl;
936
+ var Sr = { exports: {} }, ii, Vl;
937
937
  function iy() {
938
938
  if (Vl) return ii;
939
939
  Vl = 1;
@@ -942,13 +942,13 @@ function iy() {
942
942
  }
943
943
  return ii = r, ii;
944
944
  }
945
- Er.exports;
945
+ Sr.exports;
946
946
  var Wl;
947
947
  function Mn() {
948
948
  return Wl || (Wl = 1, (function(r, e) {
949
949
  var t = ct(), n = iy(), s = e && !e.nodeType && e, i = s && !0 && r && !r.nodeType && r, a = i && i.exports === s, o = a ? t.Buffer : void 0, c = o ? o.isBuffer : void 0, l = c || n;
950
950
  r.exports = l;
951
- })(Er, Er.exports)), Er.exports;
951
+ })(Sr, Sr.exports)), Sr.exports;
952
952
  }
953
953
  var ai, zl;
954
954
  function qo() {
@@ -975,8 +975,8 @@ var ci, Zl;
975
975
  function ay() {
976
976
  if (Zl) return ci;
977
977
  Zl = 1;
978
- var r = hr(), e = qd(), t = bt(), n = "[object Arguments]", s = "[object Array]", i = "[object Boolean]", a = "[object Date]", o = "[object Error]", c = "[object Function]", l = "[object Map]", u = "[object Number]", f = "[object Object]", h = "[object RegExp]", d = "[object Set]", m = "[object String]", E = "[object WeakMap]", y = "[object ArrayBuffer]", _ = "[object DataView]", S = "[object Float32Array]", T = "[object Float64Array]", P = "[object Int8Array]", g = "[object Int16Array]", C = "[object Int32Array]", R = "[object Uint8Array]", v = "[object Uint8ClampedArray]", A = "[object Uint16Array]", p = "[object Uint32Array]", k = {};
979
- k[S] = k[T] = k[P] = k[g] = k[C] = k[R] = k[v] = k[A] = k[p] = !0, k[n] = k[s] = k[y] = k[i] = k[_] = k[a] = k[o] = k[c] = k[l] = k[u] = k[f] = k[h] = k[d] = k[m] = k[E] = !1;
978
+ var r = mr(), e = qd(), t = bt(), n = "[object Arguments]", s = "[object Array]", i = "[object Boolean]", a = "[object Date]", o = "[object Error]", c = "[object Function]", l = "[object Map]", u = "[object Number]", f = "[object Object]", h = "[object RegExp]", d = "[object Set]", p = "[object String]", E = "[object WeakMap]", y = "[object ArrayBuffer]", _ = "[object DataView]", S = "[object Float32Array]", A = "[object Float64Array]", F = "[object Int8Array]", m = "[object Int16Array]", T = "[object Int32Array]", R = "[object Uint8Array]", v = "[object Uint8ClampedArray]", C = "[object Uint16Array]", g = "[object Uint32Array]", k = {};
979
+ k[S] = k[A] = k[F] = k[m] = k[T] = k[R] = k[v] = k[C] = k[g] = !0, k[n] = k[s] = k[y] = k[i] = k[_] = k[a] = k[o] = k[c] = k[l] = k[u] = k[f] = k[h] = k[d] = k[p] = k[E] = !1;
980
980
  function I(b) {
981
981
  return t(b) && e(b.length) && !!k[r(b)];
982
982
  }
@@ -993,8 +993,8 @@ function Lo() {
993
993
  }
994
994
  return li = r, li;
995
995
  }
996
- var Sr = { exports: {} };
997
- Sr.exports;
996
+ var Tr = { exports: {} };
997
+ Tr.exports;
998
998
  var Hl;
999
999
  function $o() {
1000
1000
  return Hl || (Hl = 1, (function(r, e) {
@@ -1006,7 +1006,7 @@ function $o() {
1006
1006
  }
1007
1007
  })();
1008
1008
  r.exports = o;
1009
- })(Sr, Sr.exports)), Sr.exports;
1009
+ })(Tr, Tr.exports)), Tr.exports;
1010
1010
  }
1011
1011
  var ui, Kl;
1012
1012
  function jo() {
@@ -1021,12 +1021,12 @@ function Ld() {
1021
1021
  Yl = 1;
1022
1022
  var r = ny(), e = Pd(), t = Dt(), n = Mn(), s = qo(), i = jo(), a = Object.prototype, o = a.hasOwnProperty;
1023
1023
  function c(l, u) {
1024
- var f = t(l), h = !f && e(l), d = !f && !h && n(l), m = !f && !h && !d && i(l), E = f || h || d || m, y = E ? r(l.length, String) : [], _ = y.length;
1024
+ var f = t(l), h = !f && e(l), d = !f && !h && n(l), p = !f && !h && !d && i(l), E = f || h || d || p, y = E ? r(l.length, String) : [], _ = y.length;
1025
1025
  for (var S in l)
1026
1026
  (u || o.call(l, S)) && !(E && // Safari 9 has enumerable `arguments.length` in strict mode.
1027
1027
  (S == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
1028
1028
  d && (S == "offset" || S == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
1029
- m && (S == "buffer" || S == "byteLength" || S == "byteOffset") || // Skip index properties.
1029
+ p && (S == "buffer" || S == "byteLength" || S == "byteOffset") || // Skip index properties.
1030
1030
  s(S, _))) && y.push(S);
1031
1031
  return y;
1032
1032
  }
@@ -1112,7 +1112,7 @@ function ly() {
1112
1112
  su = 1;
1113
1113
  var r = jd(), e = 1, t = Object.prototype, n = t.hasOwnProperty;
1114
1114
  function s(i, a, o, c, l, u) {
1115
- var f = o & e, h = r(i), d = h.length, m = r(a), E = m.length;
1115
+ var f = o & e, h = r(i), d = h.length, p = r(a), E = p.length;
1116
1116
  if (d != E && !f)
1117
1117
  return !1;
1118
1118
  for (var y = d; y--; ) {
@@ -1120,27 +1120,27 @@ function ly() {
1120
1120
  if (!(f ? _ in a : n.call(a, _)))
1121
1121
  return !1;
1122
1122
  }
1123
- var S = u.get(i), T = u.get(a);
1124
- if (S && T)
1125
- return S == a && T == i;
1126
- var P = !0;
1123
+ var S = u.get(i), A = u.get(a);
1124
+ if (S && A)
1125
+ return S == a && A == i;
1126
+ var F = !0;
1127
1127
  u.set(i, a), u.set(a, i);
1128
- for (var g = f; ++y < d; ) {
1128
+ for (var m = f; ++y < d; ) {
1129
1129
  _ = h[y];
1130
- var C = i[_], R = a[_];
1130
+ var T = i[_], R = a[_];
1131
1131
  if (c)
1132
- var v = f ? c(R, C, _, a, i, u) : c(C, R, _, i, a, u);
1133
- if (!(v === void 0 ? C === R || l(C, R, o, c, u) : v)) {
1134
- P = !1;
1132
+ var v = f ? c(R, T, _, a, i, u) : c(T, R, _, i, a, u);
1133
+ if (!(v === void 0 ? T === R || l(T, R, o, c, u) : v)) {
1134
+ F = !1;
1135
1135
  break;
1136
1136
  }
1137
- g || (g = _ == "constructor");
1137
+ m || (m = _ == "constructor");
1138
1138
  }
1139
- if (P && !g) {
1140
- var A = i.constructor, p = a.constructor;
1141
- A != p && "constructor" in i && "constructor" in a && !(typeof A == "function" && A instanceof A && typeof p == "function" && p instanceof p) && (P = !1);
1139
+ if (F && !m) {
1140
+ var C = i.constructor, g = a.constructor;
1141
+ C != g && "constructor" in i && "constructor" in a && !(typeof C == "function" && C instanceof C && typeof g == "function" && g instanceof g) && (F = !1);
1142
1142
  }
1143
- return u.delete(i), u.delete(a), P;
1143
+ return u.delete(i), u.delete(a), F;
1144
1144
  }
1145
1145
  return vi = s, vi;
1146
1146
  }
@@ -1176,14 +1176,14 @@ var Si, lu;
1176
1176
  function qn() {
1177
1177
  if (lu) return Si;
1178
1178
  lu = 1;
1179
- var r = uy(), e = Fo(), t = fy(), n = dy(), s = hy(), i = hr(), a = Id(), o = "[object Map]", c = "[object Object]", l = "[object Promise]", u = "[object Set]", f = "[object WeakMap]", h = "[object DataView]", d = a(r), m = a(e), E = a(t), y = a(n), _ = a(s), S = i;
1180
- return (r && S(new r(new ArrayBuffer(1))) != h || e && S(new e()) != o || t && S(t.resolve()) != l || n && S(new n()) != u || s && S(new s()) != f) && (S = function(T) {
1181
- var P = i(T), g = P == c ? T.constructor : void 0, C = g ? a(g) : "";
1182
- if (C)
1183
- switch (C) {
1179
+ var r = uy(), e = Fo(), t = fy(), n = dy(), s = hy(), i = mr(), a = Id(), o = "[object Map]", c = "[object Object]", l = "[object Promise]", u = "[object Set]", f = "[object WeakMap]", h = "[object DataView]", d = a(r), p = a(e), E = a(t), y = a(n), _ = a(s), S = i;
1180
+ return (r && S(new r(new ArrayBuffer(1))) != h || e && S(new e()) != o || t && S(t.resolve()) != l || n && S(new n()) != u || s && S(new s()) != f) && (S = function(A) {
1181
+ var F = i(A), m = F == c ? A.constructor : void 0, T = m ? a(m) : "";
1182
+ if (T)
1183
+ switch (T) {
1184
1184
  case d:
1185
1185
  return h;
1186
- case m:
1186
+ case p:
1187
1187
  return o;
1188
1188
  case E:
1189
1189
  return l;
@@ -1192,7 +1192,7 @@ function qn() {
1192
1192
  case _:
1193
1193
  return f;
1194
1194
  }
1195
- return P;
1195
+ return F;
1196
1196
  }), Si = S, Si;
1197
1197
  }
1198
1198
  var Ti, uu;
@@ -1200,27 +1200,27 @@ function my() {
1200
1200
  if (uu) return Ti;
1201
1201
  uu = 1;
1202
1202
  var r = Mo(), e = xd(), t = ty(), n = ly(), s = qn(), i = Dt(), a = Mn(), o = jo(), c = 1, l = "[object Arguments]", u = "[object Array]", f = "[object Object]", h = Object.prototype, d = h.hasOwnProperty;
1203
- function m(E, y, _, S, T, P) {
1204
- var g = i(E), C = i(y), R = g ? u : s(E), v = C ? u : s(y);
1203
+ function p(E, y, _, S, A, F) {
1204
+ var m = i(E), T = i(y), R = m ? u : s(E), v = T ? u : s(y);
1205
1205
  R = R == l ? f : R, v = v == l ? f : v;
1206
- var A = R == f, p = v == f, k = R == v;
1206
+ var C = R == f, g = v == f, k = R == v;
1207
1207
  if (k && a(E)) {
1208
1208
  if (!a(y))
1209
1209
  return !1;
1210
- g = !0, A = !1;
1210
+ m = !0, C = !1;
1211
1211
  }
1212
- if (k && !A)
1213
- return P || (P = new r()), g || o(E) ? e(E, y, _, S, T, P) : t(E, y, R, _, S, T, P);
1212
+ if (k && !C)
1213
+ return F || (F = new r()), m || o(E) ? e(E, y, _, S, A, F) : t(E, y, R, _, S, A, F);
1214
1214
  if (!(_ & c)) {
1215
- var I = A && d.call(E, "__wrapped__"), b = p && d.call(y, "__wrapped__");
1215
+ var I = C && d.call(E, "__wrapped__"), b = g && d.call(y, "__wrapped__");
1216
1216
  if (I || b) {
1217
1217
  var w = I ? E.value() : E, O = b ? y.value() : y;
1218
- return P || (P = new r()), T(w, O, _, S, P);
1218
+ return F || (F = new r()), A(w, O, _, S, F);
1219
1219
  }
1220
1220
  }
1221
- return k ? (P || (P = new r()), n(E, y, _, S, T, P)) : !1;
1221
+ return k ? (F || (F = new r()), n(E, y, _, S, A, F)) : !1;
1222
1222
  }
1223
- return Ti = m, Ti;
1223
+ return Ti = p, Ti;
1224
1224
  }
1225
1225
  var Ri, fu;
1226
1226
  function py() {
@@ -1246,9 +1246,9 @@ var gy = yy();
1246
1246
  const _y = /* @__PURE__ */ In(gy), vy = (r, e, t, n, s, i, a, o, c) => {
1247
1247
  const { access: l } = e, { permissionWriteRestrictions: u } = l;
1248
1248
  let f = !0, h = "";
1249
- const d = u?.filter((m) => n === m.userRole);
1250
- return d?.length && !d.some((m) => m.recordRole === s) ? (h = `User ${n} does not have write access to record with role ${s}`, f = !1, f) : (u?.forEach((m) => {
1251
- n === m.userRole && m.recordRole;
1249
+ const d = u?.filter((p) => n === p.userRole);
1250
+ return d?.length && !d.some((p) => p.recordRole === s) ? (h = `User ${n} does not have write access to record with role ${s}`, f = !1, f) : (u?.forEach((p) => {
1251
+ n === p.userRole && p.recordRole;
1252
1252
  }), h && console.error(`PERMISSION_DENIED: ${h}`), f);
1253
1253
  }, wy = (r, e, t, n, s, i, a, o, c, l, u) => {
1254
1254
  const { labels: f } = n;
@@ -1267,23 +1267,23 @@ const _y = /* @__PURE__ */ In(gy), vy = (r, e, t, n, s, i, a, o, c) => {
1267
1267
  }
1268
1268
  if (!u)
1269
1269
  throw new Error("PERMISSION_DENIED");
1270
- }, sr = (r) => r && (r._methodName === "deleteField" || r.constructor.name === "DeleteTransform"), tr = (r) => {
1270
+ }, ir = (r) => r && (r._methodName === "deleteField" || r.constructor.name === "DeleteTransform"), tr = (r) => {
1271
1271
  for (const e in r)
1272
- Object.prototype.hasOwnProperty.call(r, e) && (sr(r[e]) ? delete r[e] : typeof r[e] == "object" && r[e] !== null && tr(r[e]));
1272
+ Object.prototype.hasOwnProperty.call(r, e) && (ir(r[e]) ? delete r[e] : typeof r[e] == "object" && r[e] !== null && tr(r[e]));
1273
1273
  }, Oy = (r, e, t, n, s, i, a, o, c, l) => {
1274
1274
  const { labels: u, fields: f } = n, h = a?.collections?.[u.collection], d = { ...e, ...r };
1275
1275
  tr(d);
1276
- let m = !0, E = "";
1276
+ let p = !0, E = "";
1277
1277
  if (i && !h)
1278
1278
  throw new Error("PERMISSION_DENIED");
1279
- i && !vt("Update", h) && (m = !1, E = "Authenticated user does not have Update access to this collection"), i && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1279
+ i && !vt("Update", h) && (p = !1, E = "Authenticated user does not have Update access to this collection"), i && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1280
1280
  (!dn("Update", n, s, i, a, e) || // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1281
- !dn("Update", n, s, i, a, d)) && (m = !1, E = "Authenticated user does not have Update access to this document");
1281
+ !dn("Update", n, s, i, a, d)) && (p = !1, E = "Authenticated user does not have Update access to this document");
1282
1282
  for (const y of f) {
1283
1283
  const _ = r[y.name];
1284
- y.access && !An(y, a) && _ !== void 0 && (E = `Authenticated user does not have access to field ${y.name}`, m = !1), _ !== void 0 && !_p(y, a) && (E = `Authenticated user does not have Update access to field ${y.name}`, m = !1);
1284
+ y.access && !An(y, a) && _ !== void 0 && (E = `Authenticated user does not have access to field ${y.name}`, p = !1), _ !== void 0 && !_p(y, a) && (E = `Authenticated user does not have Update access to field ${y.name}`, p = !1);
1285
1285
  }
1286
- if (!m)
1286
+ if (!p)
1287
1287
  throw E && console.error(`PERMISSION_DENIED: ${E}`), new Error("PERMISSION_DENIED");
1288
1288
  }, Ey = (r, e, t, n, s, i) => {
1289
1289
  const { labels: a } = t, o = i.collections?.[a.collection];
@@ -1389,8 +1389,8 @@ function Cy() {
1389
1389
  var r = Ry(), e = r();
1390
1390
  return Ni = e, Ni;
1391
1391
  }
1392
- var Tr = { exports: {} };
1393
- Tr.exports;
1392
+ var Rr = { exports: {} };
1393
+ Rr.exports;
1394
1394
  var _u;
1395
1395
  function zd() {
1396
1396
  return _u || (_u = 1, (function(r, e) {
@@ -1402,7 +1402,7 @@ function zd() {
1402
1402
  return l.copy(h), h;
1403
1403
  }
1404
1404
  r.exports = c;
1405
- })(Tr, Tr.exports)), Tr.exports;
1405
+ })(Rr, Rr.exports)), Rr.exports;
1406
1406
  }
1407
1407
  var Fi, vu;
1408
1408
  function zo() {
@@ -1488,7 +1488,7 @@ var ji, Ru;
1488
1488
  function Iy() {
1489
1489
  if (Ru) return ji;
1490
1490
  Ru = 1;
1491
- var r = hr(), e = Bo(), t = bt(), n = "[object Object]", s = Function.prototype, i = Object.prototype, a = s.toString, o = i.hasOwnProperty, c = a.call(Object);
1491
+ var r = mr(), e = Bo(), t = bt(), n = "[object Object]", s = Function.prototype, i = Object.prototype, a = s.toString, o = i.hasOwnProperty, c = a.call(Object);
1492
1492
  function l(u) {
1493
1493
  if (!t(u) || r(u) != n)
1494
1494
  return !1;
@@ -1589,19 +1589,19 @@ var Hi, Du;
1589
1589
  function Dy() {
1590
1590
  if (Du) return Hi;
1591
1591
  Du = 1;
1592
- var r = Wd(), e = zd(), t = Bd(), n = Zd(), s = Gd(), i = Pd(), a = Dt(), o = ky(), c = Mn(), l = No(), u = wt(), f = Iy(), h = jo(), d = Hd(), m = Fy();
1593
- function E(y, _, S, T, P, g, C) {
1594
- var R = d(y, S), v = d(_, S), A = C.get(v);
1595
- if (A) {
1596
- r(y, S, A);
1592
+ var r = Wd(), e = zd(), t = Bd(), n = Zd(), s = Gd(), i = Pd(), a = Dt(), o = ky(), c = Mn(), l = No(), u = wt(), f = Iy(), h = jo(), d = Hd(), p = Fy();
1593
+ function E(y, _, S, A, F, m, T) {
1594
+ var R = d(y, S), v = d(_, S), C = T.get(v);
1595
+ if (C) {
1596
+ r(y, S, C);
1597
1597
  return;
1598
1598
  }
1599
- var p = g ? g(R, v, S + "", y, _, C) : void 0, k = p === void 0;
1599
+ var g = m ? m(R, v, S + "", y, _, T) : void 0, k = g === void 0;
1600
1600
  if (k) {
1601
1601
  var I = a(v), b = !I && c(v), w = !I && !b && h(v);
1602
- p = v, I || b || w ? a(R) ? p = R : o(R) ? p = n(R) : b ? (k = !1, p = e(v, !0)) : w ? (k = !1, p = t(v, !0)) : p = [] : f(v) || i(v) ? (p = R, i(R) ? p = m(R) : (!u(R) || l(R)) && (p = s(v))) : k = !1;
1602
+ g = v, I || b || w ? a(R) ? g = R : o(R) ? g = n(R) : b ? (k = !1, g = e(v, !0)) : w ? (k = !1, g = t(v, !0)) : g = [] : f(v) || i(v) ? (g = R, i(R) ? g = p(R) : (!u(R) || l(R)) && (g = s(v))) : k = !1;
1603
1603
  }
1604
- k && (C.set(v, p), P(p, v, T, g, C), C.delete(v)), r(y, S, p);
1604
+ k && (T.set(v, g), F(g, v, A, m, T), T.delete(v)), r(y, S, g);
1605
1605
  }
1606
1606
  return Hi = E, Hi;
1607
1607
  }
@@ -1611,12 +1611,12 @@ function My() {
1611
1611
  Mu = 1;
1612
1612
  var r = Mo(), e = Wd(), t = Cy(), n = Dy(), s = wt(), i = Br(), a = Hd();
1613
1613
  function o(c, l, u, f, h) {
1614
- c !== l && t(l, function(d, m) {
1614
+ c !== l && t(l, function(d, p) {
1615
1615
  if (h || (h = new r()), s(d))
1616
- n(c, l, m, u, o, f, h);
1616
+ n(c, l, p, u, o, f, h);
1617
1617
  else {
1618
- var E = f ? f(a(c, m), d, m + "", c, l, h) : void 0;
1619
- E === void 0 && (E = d), e(c, m, E);
1618
+ var E = f ? f(a(c, p), d, p + "", c, l, h) : void 0;
1619
+ E === void 0 && (E = d), e(c, p, E);
1620
1620
  }
1621
1621
  }, i);
1622
1622
  }
@@ -1773,7 +1773,7 @@ var oa, Gu;
1773
1773
  function Go() {
1774
1774
  if (Gu) return oa;
1775
1775
  Gu = 1;
1776
- var r = hr(), e = bt(), t = "[object Symbol]";
1776
+ var r = mr(), e = bt(), t = "[object Symbol]";
1777
1777
  function n(s) {
1778
1778
  return typeof s == "symbol" || e(s) && r(s) == t;
1779
1779
  }
@@ -1907,14 +1907,14 @@ function ng() {
1907
1907
  return a;
1908
1908
  o = e(o, a);
1909
1909
  for (var u = -1, f = o.length, h = f - 1, d = a; d != null && ++u < f; ) {
1910
- var m = s(o[u]), E = c;
1911
- if (m === "__proto__" || m === "constructor" || m === "prototype")
1910
+ var p = s(o[u]), E = c;
1911
+ if (p === "__proto__" || p === "constructor" || p === "prototype")
1912
1912
  return a;
1913
1913
  if (u != h) {
1914
- var y = d[m];
1915
- E = l ? l(y, m, d) : void 0, E === void 0 && (E = n(y) ? y : t(o[u + 1]) ? [] : {});
1914
+ var y = d[p];
1915
+ E = l ? l(y, p, d) : void 0, E === void 0 && (E = n(y) ? y : t(o[u + 1]) ? [] : {});
1916
1916
  }
1917
- r(d, m, E), d = d[m];
1917
+ r(d, p, E), d = d[p];
1918
1918
  }
1919
1919
  return a;
1920
1920
  }
@@ -1931,11 +1931,11 @@ function sg() {
1931
1931
  return _a = e, _a;
1932
1932
  }
1933
1933
  var ig = sg();
1934
- const ag = /* @__PURE__ */ In(ig), Fr = {
1934
+ const ag = /* @__PURE__ */ In(ig), Dr = {
1935
1935
  global: {},
1936
1936
  collections: {}
1937
1937
  }, og = () => {
1938
- Fr.global = {}, Fr.collections = {};
1938
+ Dr.global = {}, Dr.collections = {};
1939
1939
  }, ve = async (r, e) => {
1940
1940
  let t = r;
1941
1941
  return r && (typeof r == "function" || typeof r.then == "function") && (e ? t = await r(...e) : t = await r()), t;
@@ -1943,7 +1943,7 @@ const ag = /* @__PURE__ */ In(ig), Fr = {
1943
1943
  for (const u of e)
1944
1944
  if (u === "__proto__" || u === "constructor" || u === "prototype")
1945
1945
  throw new Error("Invalid config path: prototype pollution keys are not allowed");
1946
- let s = Fr, i = !0;
1946
+ let s = Dr, i = !0;
1947
1947
  for (const u of e) {
1948
1948
  if (u === void 0 || s[u] === void 0) {
1949
1949
  i = !1;
@@ -1964,7 +1964,7 @@ const ag = /* @__PURE__ */ In(ig), Fr = {
1964
1964
  }
1965
1965
  let l;
1966
1966
  if (c && (l = await ve(o, t)), l) {
1967
- let u = Fr;
1967
+ let u = Dr;
1968
1968
  const f = {};
1969
1969
  for (let h = 0; h < e.length; h++) {
1970
1970
  const d = e[h];
@@ -1974,7 +1974,7 @@ const ag = /* @__PURE__ */ In(ig), Fr = {
1974
1974
  h === e.length - 1 ? ag(f, e.join("."), l) : (u[d] ||= {}, u = u[d]);
1975
1975
  }
1976
1976
  }
1977
- Gy(Fr, f);
1977
+ Gy(Dr, f);
1978
1978
  }
1979
1979
  return l;
1980
1980
  }, cg = (r, e, t) => {
@@ -2179,7 +2179,7 @@ const Ko = (r, e, t, n, s, i, a, o, c, l) => (r == "create" && (t.Collection_Pat
2179
2179
  n.forEach((i) => {
2180
2180
  if (_e(i))
2181
2181
  if (e[i.name]) {
2182
- if (sr(e[i.name]))
2182
+ if (ir(e[i.name]))
2183
2183
  e[`${i.name}_Array`] = e[i.name];
2184
2184
  else if (e[`${i.name}_Array`] = Object.keys(e[i.name]), i.includeFields)
2185
2185
  for (const a of i.includeFields) {
@@ -2192,7 +2192,7 @@ const Ko = (r, e, t, n, s, i, a, o, c, l) => (r == "create" && (t.Collection_Pat
2192
2192
  delete e[`${i.name}_Array`], delete e[`${i.name}_Single`];
2193
2193
  }), Qd(r, n).forEach((i) => {
2194
2194
  if (e[i.name])
2195
- if (sr(e[i.name]))
2195
+ if (ir(e[i.name]))
2196
2196
  e[`${i.name}_Single`] = e[i.name];
2197
2197
  else {
2198
2198
  const a = e[`${i.name}_Array`]?.[0];
@@ -2526,7 +2526,7 @@ class qe {
2526
2526
  }
2527
2527
  const X = Object.freeze({
2528
2528
  status: "aborted"
2529
- }), Rr = (r) => ({ status: "dirty", value: r }), Qe = (r) => ({ status: "valid", value: r }), of = (r) => r.status === "aborted", cf = (r) => r.status === "dirty", ir = (r) => r.status === "valid", hn = (r) => typeof Promise < "u" && r instanceof Promise;
2529
+ }), Cr = (r) => ({ status: "dirty", value: r }), Qe = (r) => ({ status: "valid", value: r }), of = (r) => r.status === "aborted", cf = (r) => r.status === "dirty", ar = (r) => r.status === "valid", hn = (r) => typeof Promise < "u" && r instanceof Promise;
2530
2530
  var W;
2531
2531
  (function(r) {
2532
2532
  r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e?.message;
@@ -2540,7 +2540,7 @@ class ot {
2540
2540
  }
2541
2541
  }
2542
2542
  const lf = (r, e) => {
2543
- if (ir(e))
2543
+ if (ar(e))
2544
2544
  return { success: !0, data: e.value };
2545
2545
  if (!r.common.issues.length)
2546
2546
  throw new Error("Validation failed but no issues detected.");
@@ -2641,7 +2641,7 @@ class le {
2641
2641
  if (!this["~standard"].async)
2642
2642
  try {
2643
2643
  const n = this._parseSync({ data: e, path: [], parent: t });
2644
- return ir(n) ? {
2644
+ return ar(n) ? {
2645
2645
  value: n.value
2646
2646
  } : {
2647
2647
  issues: t.common.issues
@@ -2652,7 +2652,7 @@ class le {
2652
2652
  async: !0
2653
2653
  };
2654
2654
  }
2655
- return this._parseAsync({ data: e, path: [], parent: t }).then((n) => ir(n) ? {
2655
+ return this._parseAsync({ data: e, path: [], parent: t }).then((n) => ar(n) ? {
2656
2656
  value: n.value
2657
2657
  } : {
2658
2658
  issues: t.common.issues
@@ -2693,7 +2693,7 @@ class le {
2693
2693
  return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof t == "function" ? t(n, s) : t), !1));
2694
2694
  }
2695
2695
  _refinement(e) {
2696
- return new cr({
2696
+ return new lr({
2697
2697
  schema: this,
2698
2698
  typeName: Q.ZodEffects,
2699
2699
  effect: { type: "refinement", refinement: e }
@@ -2713,7 +2713,7 @@ class le {
2713
2713
  return It.create(this, this._def);
2714
2714
  }
2715
2715
  nullable() {
2716
- return lr.create(this, this._def);
2716
+ return ur.create(this, this._def);
2717
2717
  }
2718
2718
  nullish() {
2719
2719
  return this.nullable().optional();
@@ -2731,7 +2731,7 @@ class le {
2731
2731
  return yn.create(this, e, this._def);
2732
2732
  }
2733
2733
  transform(e) {
2734
- return new cr({
2734
+ return new lr({
2735
2735
  ...ae(this._def),
2736
2736
  schema: this,
2737
2737
  typeName: Q.ZodEffects,
@@ -3206,7 +3206,7 @@ function Lg(r, e) {
3206
3206
  const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, i = Number.parseInt(r.toFixed(s).replace(".", "")), a = Number.parseInt(e.toFixed(s).replace(".", ""));
3207
3207
  return i % a / 10 ** s;
3208
3208
  }
3209
- class ar extends le {
3209
+ class or extends le {
3210
3210
  constructor() {
3211
3211
  super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
3212
3212
  }
@@ -3264,7 +3264,7 @@ class ar extends le {
3264
3264
  return this.setLimit("max", e, !1, W.toString(t));
3265
3265
  }
3266
3266
  setLimit(e, t, n, s) {
3267
- return new ar({
3267
+ return new or({
3268
3268
  ...this._def,
3269
3269
  checks: [
3270
3270
  ...this._def.checks,
@@ -3278,7 +3278,7 @@ class ar extends le {
3278
3278
  });
3279
3279
  }
3280
3280
  _addCheck(e) {
3281
- return new ar({
3281
+ return new or({
3282
3282
  ...this._def,
3283
3283
  checks: [...this._def.checks, e]
3284
3284
  });
@@ -3372,7 +3372,7 @@ class ar extends le {
3372
3372
  return Number.isFinite(t) && Number.isFinite(e);
3373
3373
  }
3374
3374
  }
3375
- ar.create = (r) => new ar({
3375
+ or.create = (r) => new or({
3376
3376
  checks: [],
3377
3377
  typeName: Q.ZodNumber,
3378
3378
  coerce: r?.coerce || !1,
@@ -3800,7 +3800,7 @@ function Qt(r) {
3800
3800
  } else return r instanceof at ? new at({
3801
3801
  ...r._def,
3802
3802
  type: Qt(r.element)
3803
- }) : r instanceof It ? It.create(Qt(r.unwrap())) : r instanceof lr ? lr.create(Qt(r.unwrap())) : r instanceof Wt ? Wt.create(r.items.map((e) => Qt(e))) : r;
3803
+ }) : r instanceof It ? It.create(Qt(r.unwrap())) : r instanceof ur ? ur.create(Qt(r.unwrap())) : r instanceof Wt ? Wt.create(r.items.map((e) => Qt(e))) : r;
3804
3804
  }
3805
3805
  class Ce extends le {
3806
3806
  constructor() {
@@ -4465,13 +4465,13 @@ ao.create = (r, e) => new ao({
4465
4465
  ...ae(e)
4466
4466
  });
4467
4467
  function nh(r, e) {
4468
- return new or({
4468
+ return new cr({
4469
4469
  values: r,
4470
4470
  typeName: Q.ZodEnum,
4471
4471
  ...ae(e)
4472
4472
  });
4473
4473
  }
4474
- class or extends le {
4474
+ class cr extends le {
4475
4475
  _parse(e) {
4476
4476
  if (typeof e.data != "string") {
4477
4477
  const t = this._getOrReturnCtx(e), n = this._def.values;
@@ -4513,19 +4513,19 @@ class or extends le {
4513
4513
  return e;
4514
4514
  }
4515
4515
  extract(e, t = this._def) {
4516
- return or.create(e, {
4516
+ return cr.create(e, {
4517
4517
  ...this._def,
4518
4518
  ...t
4519
4519
  });
4520
4520
  }
4521
4521
  exclude(e, t = this._def) {
4522
- return or.create(this.options.filter((n) => !e.includes(n)), {
4522
+ return cr.create(this.options.filter((n) => !e.includes(n)), {
4523
4523
  ...this._def,
4524
4524
  ...t
4525
4525
  });
4526
4526
  }
4527
4527
  }
4528
- or.create = nh;
4528
+ cr.create = nh;
4529
4529
  class gf extends le {
4530
4530
  _parse(e) {
4531
4531
  const t = fe.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
@@ -4580,7 +4580,7 @@ _n.create = (r, e) => new _n({
4580
4580
  typeName: Q.ZodPromise,
4581
4581
  ...ae(e)
4582
4582
  });
4583
- class cr extends le {
4583
+ class lr extends le {
4584
4584
  innerType() {
4585
4585
  return this._def.schema;
4586
4586
  }
@@ -4607,7 +4607,7 @@ class cr extends le {
4607
4607
  path: n.path,
4608
4608
  parent: n
4609
4609
  });
4610
- return c.status === "aborted" ? X : c.status === "dirty" || t.value === "dirty" ? Rr(c.value) : c;
4610
+ return c.status === "aborted" ? X : c.status === "dirty" || t.value === "dirty" ? Cr(c.value) : c;
4611
4611
  });
4612
4612
  {
4613
4613
  if (t.value === "aborted")
@@ -4617,7 +4617,7 @@ class cr extends le {
4617
4617
  path: n.path,
4618
4618
  parent: n
4619
4619
  });
4620
- return o.status === "aborted" ? X : o.status === "dirty" || t.value === "dirty" ? Rr(o.value) : o;
4620
+ return o.status === "aborted" ? X : o.status === "dirty" || t.value === "dirty" ? Cr(o.value) : o;
4621
4621
  }
4622
4622
  }
4623
4623
  if (s.type === "refinement") {
@@ -4646,27 +4646,27 @@ class cr extends le {
4646
4646
  path: n.path,
4647
4647
  parent: n
4648
4648
  });
4649
- if (!ir(a))
4649
+ if (!ar(a))
4650
4650
  return X;
4651
4651
  const o = s.transform(a.value, i);
4652
4652
  if (o instanceof Promise)
4653
4653
  throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
4654
4654
  return { status: t.value, value: o };
4655
4655
  } else
4656
- return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((a) => ir(a) ? Promise.resolve(s.transform(a.value, i)).then((o) => ({
4656
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((a) => ar(a) ? Promise.resolve(s.transform(a.value, i)).then((o) => ({
4657
4657
  status: t.value,
4658
4658
  value: o
4659
4659
  })) : X);
4660
4660
  fe.assertNever(s);
4661
4661
  }
4662
4662
  }
4663
- cr.create = (r, e, t) => new cr({
4663
+ lr.create = (r, e, t) => new lr({
4664
4664
  schema: r,
4665
4665
  typeName: Q.ZodEffects,
4666
4666
  effect: e,
4667
4667
  ...ae(t)
4668
4668
  });
4669
- cr.createWithPreprocess = (r, e, t) => new cr({
4669
+ lr.createWithPreprocess = (r, e, t) => new lr({
4670
4670
  schema: e,
4671
4671
  effect: { type: "preprocess", transform: r },
4672
4672
  typeName: Q.ZodEffects,
@@ -4685,7 +4685,7 @@ It.create = (r, e) => new It({
4685
4685
  typeName: Q.ZodOptional,
4686
4686
  ...ae(e)
4687
4687
  });
4688
- class lr extends le {
4688
+ class ur extends le {
4689
4689
  _parse(e) {
4690
4690
  return this._getType(e) === V.null ? Qe(null) : this._def.innerType._parse(e);
4691
4691
  }
@@ -4693,7 +4693,7 @@ class lr extends le {
4693
4693
  return this._def.innerType;
4694
4694
  }
4695
4695
  }
4696
- lr.create = (r, e) => new lr({
4696
+ ur.create = (r, e) => new ur({
4697
4697
  innerType: r,
4698
4698
  typeName: Q.ZodNullable,
4699
4699
  ...ae(e)
@@ -4801,7 +4801,7 @@ class Yo extends le {
4801
4801
  path: n.path,
4802
4802
  parent: n
4803
4803
  });
4804
- return i.status === "aborted" ? X : i.status === "dirty" ? (t.dirty(), Rr(i.value)) : this._def.out._parseAsync({
4804
+ return i.status === "aborted" ? X : i.status === "dirty" ? (t.dirty(), Cr(i.value)) : this._def.out._parseAsync({
4805
4805
  data: i.value,
4806
4806
  path: n.path,
4807
4807
  parent: n
@@ -4833,7 +4833,7 @@ class Yo extends le {
4833
4833
  }
4834
4834
  class lo extends le {
4835
4835
  _parse(e) {
4836
- const t = this._def.innerType._parse(e), n = (s) => (ir(s) && (s.value = Object.freeze(s.value)), s);
4836
+ const t = this._def.innerType._parse(e), n = (s) => (ar(s) && (s.value = Object.freeze(s.value)), s);
4837
4837
  return hn(t) ? t.then((s) => n(s)) : n(t);
4838
4838
  }
4839
4839
  unwrap() {
@@ -4849,15 +4849,15 @@ var Q;
4849
4849
  (function(r) {
4850
4850
  r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
4851
4851
  })(Q || (Q = {}));
4852
- const pt = yt.create, uo = ar.create, jg = no.create, Ut = so.create;
4852
+ const pt = yt.create, uo = or.create, jg = no.create, Ut = so.create;
4853
4853
  Ft.create;
4854
4854
  const Ln = at.create, sh = Ce.create, vn = pn.create;
4855
4855
  yn.create;
4856
4856
  Wt.create;
4857
- const Jo = gn.create, fo = ao.create, ho = or.create;
4857
+ const Jo = gn.create, fo = ao.create, ho = cr.create;
4858
4858
  _n.create;
4859
4859
  It.create;
4860
- lr.create;
4860
+ ur.create;
4861
4861
  const on = () => Ut().refine((r) => r && (r.seconds !== void 0 && r.nanoseconds !== void 0 || r._seconds !== void 0 && r._nanoseconds !== void 0), {
4862
4862
  message: "Value is not a valid timestamp"
4863
4863
  }), vf = () => Ut().refine((r) => r && (r._methodName === "serverTimestamp" || r.constructor.name === "ServerTimestampTransform"), {
@@ -5231,7 +5231,7 @@ class $n extends Gr {
5231
5231
  }
5232
5232
  /** @override **/
5233
5233
  formatOffset(e, t) {
5234
- return Dr(this.offset(e), t);
5234
+ return Mr(this.offset(e), t);
5235
5235
  }
5236
5236
  /** @override **/
5237
5237
  offset(e) {
@@ -5376,7 +5376,7 @@ class _t extends Gr {
5376
5376
  * @return {string}
5377
5377
  */
5378
5378
  formatOffset(e, t) {
5379
- return Dr(this.offset(e), t);
5379
+ return Mr(this.offset(e), t);
5380
5380
  }
5381
5381
  /**
5382
5382
  * Return the offset in minutes for this zone at the specified timestamp.
@@ -5401,8 +5401,8 @@ class _t extends Gr {
5401
5401
  millisecond: 0
5402
5402
  });
5403
5403
  let d = +t;
5404
- const m = d % 1e3;
5405
- return d -= m >= 0 ? m : 1e3 + m, (h - d) / (60 * 1e3);
5404
+ const p = d % 1e3;
5405
+ return d -= p >= 0 ? p : 1e3 + p, (h - d) / (60 * 1e3);
5406
5406
  }
5407
5407
  /**
5408
5408
  * Return whether this Zone is equal to another zone
@@ -5446,9 +5446,9 @@ function t_(r, e = {}) {
5446
5446
  let i = _o.get(s);
5447
5447
  return i === void 0 && (i = new Intl.RelativeTimeFormat(r, e), _o.set(s, i)), i;
5448
5448
  }
5449
- let Cr = null;
5449
+ let Ar = null;
5450
5450
  function r_() {
5451
- return Cr || (Cr = new Intl.DateTimeFormat().resolvedOptions().locale, Cr);
5451
+ return Ar || (Ar = new Intl.DateTimeFormat().resolvedOptions().locale, Ar);
5452
5452
  }
5453
5453
  const vo = /* @__PURE__ */ new Map();
5454
5454
  function Rh(r) {
@@ -5579,9 +5579,9 @@ const Ch = {
5579
5579
  minimalDays: 4,
5580
5580
  weekend: [6, 7]
5581
5581
  };
5582
- class he {
5582
+ class me {
5583
5583
  static fromOpts(e) {
5584
- return he.create(
5584
+ return me.create(
5585
5585
  e.locale,
5586
5586
  e.numberingSystem,
5587
5587
  e.outputCalendar,
@@ -5591,13 +5591,13 @@ class he {
5591
5591
  }
5592
5592
  static create(e, t, n, s, i = !1) {
5593
5593
  const a = e || Ee.defaultLocale, o = a || (i ? "en-US" : r_()), c = t || Ee.defaultNumberingSystem, l = n || Ee.defaultOutputCalendar, u = Oo(s) || Ee.defaultWeekSettings;
5594
- return new he(o, c, l, u, a);
5594
+ return new me(o, c, l, u, a);
5595
5595
  }
5596
5596
  static resetCache() {
5597
- Cr = null, po.clear(), go.clear(), _o.clear(), vo.clear(), wo.clear();
5597
+ Ar = null, po.clear(), go.clear(), _o.clear(), vo.clear(), wo.clear();
5598
5598
  }
5599
5599
  static fromObject({ locale: e, numberingSystem: t, outputCalendar: n, weekSettings: s } = {}) {
5600
- return he.create(e, t, n, s);
5600
+ return me.create(e, t, n, s);
5601
5601
  }
5602
5602
  constructor(e, t, n, s, i) {
5603
5603
  const [a, o, c] = s_(e);
@@ -5611,7 +5611,7 @@ class he {
5611
5611
  return e && t ? "en" : "intl";
5612
5612
  }
5613
5613
  clone(e) {
5614
- return !e || Object.getOwnPropertyNames(e).length === 0 ? this : he.create(
5614
+ return !e || Object.getOwnPropertyNames(e).length === 0 ? this : me.create(
5615
5615
  e.locale || this.specifiedLocale,
5616
5616
  e.numberingSystem || this.numberingSystem,
5617
5617
  e.outputCalendar || this.outputCalendar,
@@ -5758,7 +5758,7 @@ class Pe extends Gr {
5758
5758
  * @type {string}
5759
5759
  */
5760
5760
  get name() {
5761
- return this.fixed === 0 ? "UTC" : `UTC${Dr(this.fixed, "narrow")}`;
5761
+ return this.fixed === 0 ? "UTC" : `UTC${Mr(this.fixed, "narrow")}`;
5762
5762
  }
5763
5763
  /**
5764
5764
  * The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn`
@@ -5767,7 +5767,7 @@ class Pe extends Gr {
5767
5767
  * @type {string}
5768
5768
  */
5769
5769
  get ianaName() {
5770
- return this.fixed === 0 ? "Etc/UTC" : `Etc/GMT${Dr(-this.fixed, "narrow")}`;
5770
+ return this.fixed === 0 ? "Etc/UTC" : `Etc/GMT${Mr(-this.fixed, "narrow")}`;
5771
5771
  }
5772
5772
  /**
5773
5773
  * Returns the offset's common name at the specified timestamp.
@@ -5787,7 +5787,7 @@ class Pe extends Gr {
5787
5787
  * @return {string}
5788
5788
  */
5789
5789
  formatOffset(e, t) {
5790
- return Dr(this.fixed, t);
5790
+ return Mr(this.fixed, t);
5791
5791
  }
5792
5792
  /**
5793
5793
  * Returns whether the offset is known to be fixed for the whole year:
@@ -6083,7 +6083,7 @@ class Ee {
6083
6083
  * @return {void}
6084
6084
  */
6085
6085
  static resetCaches() {
6086
- he.resetCache(), _t.resetCache(), B.resetCache(), p_();
6086
+ me.resetCache(), _t.resetCache(), B.resetCache(), p_();
6087
6087
  }
6088
6088
  }
6089
6089
  class nt {
@@ -6212,7 +6212,7 @@ function Ff(r, e, t) {
6212
6212
  function b_(r, e) {
6213
6213
  return e.reduce((t, n) => (t[n] = r[n], t), {});
6214
6214
  }
6215
- function ur(r, e) {
6215
+ function fr(r, e) {
6216
6216
  return Object.prototype.hasOwnProperty.call(r, e);
6217
6217
  }
6218
6218
  function Oo(r) {
@@ -6330,14 +6330,14 @@ function qh(r) {
6330
6330
  function Sn(r, e) {
6331
6331
  const t = {};
6332
6332
  for (const n in r)
6333
- if (ur(r, n)) {
6333
+ if (fr(r, n)) {
6334
6334
  const s = r[n];
6335
6335
  if (s == null) continue;
6336
6336
  t[e(n)] = qh(s);
6337
6337
  }
6338
6338
  return t;
6339
6339
  }
6340
- function Dr(r, e) {
6340
+ function Mr(r, e) {
6341
6341
  const t = Math.trunc(Math.abs(r / 60)), n = Math.trunc(Math.abs(r % 60)), s = r >= 0 ? "+" : "-";
6342
6342
  switch (e) {
6343
6343
  case "short":
@@ -6544,12 +6544,12 @@ class Fe {
6544
6544
  return t > 0 && (s.padTo = t), n && (s.signDisplay = n), this.loc.numberFormatter(s).format(e);
6545
6545
  }
6546
6546
  formatDateTimeFromString(e, t) {
6547
- const n = this.loc.listingMode() === "en", s = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", i = (d, m) => this.loc.extract(e, d, m), a = (d) => e.isOffsetFixed && e.offset === 0 && d.allowZ ? "Z" : e.isValid ? e.zone.formatOffset(e.ts, d.format) : "", o = () => n ? k_(e) : i({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), c = (d, m) => n ? x_(e, d) : i(m ? { month: d } : { month: d, day: "numeric" }, "month"), l = (d, m) => n ? I_(e, d) : i(
6548
- m ? { weekday: d } : { weekday: d, month: "long", day: "numeric" },
6547
+ const n = this.loc.listingMode() === "en", s = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", i = (d, p) => this.loc.extract(e, d, p), a = (d) => e.isOffsetFixed && e.offset === 0 && d.allowZ ? "Z" : e.isValid ? e.zone.formatOffset(e.ts, d.format) : "", o = () => n ? k_(e) : i({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), c = (d, p) => n ? x_(e, d) : i(p ? { month: d } : { month: d, day: "numeric" }, "month"), l = (d, p) => n ? I_(e, d) : i(
6548
+ p ? { weekday: d } : { weekday: d, month: "long", day: "numeric" },
6549
6549
  "weekday"
6550
6550
  ), u = (d) => {
6551
- const m = Fe.macroTokenToFormatOpts(d);
6552
- return m ? this.formatWithSystemDefault(e, m) : d;
6551
+ const p = Fe.macroTokenToFormatOpts(d);
6552
+ return p ? this.formatWithSystemDefault(e, p) : d;
6553
6553
  }, f = (d) => n ? N_(e, d) : i({ era: d }, "era"), h = (d) => {
6554
6554
  switch (d) {
6555
6555
  // ms
@@ -6720,9 +6720,9 @@ class Fe {
6720
6720
  }, i = (u, f) => (h) => {
6721
6721
  const d = s(h);
6722
6722
  if (d) {
6723
- const m = f.isNegativeDuration && d !== f.largestUnit ? n : 1;
6723
+ const p = f.isNegativeDuration && d !== f.largestUnit ? n : 1;
6724
6724
  let E;
6725
- return this.opts.signMode === "negativeLargestOnly" && d !== f.largestUnit ? E = "never" : this.opts.signMode === "all" ? E = "always" : E = "auto", this.num(u.get(d) * m, h.length, E);
6725
+ return this.opts.signMode === "negativeLargestOnly" && d !== f.largestUnit ? E = "never" : this.opts.signMode === "all" ? E = "always" : E = "auto", this.num(u.get(d) * p, h.length, E);
6726
6726
  } else
6727
6727
  return h;
6728
6728
  }, a = Fe.parseFormat(t), o = a.reduce(
@@ -6738,11 +6738,11 @@ class Fe {
6738
6738
  }
6739
6739
  }
6740
6740
  const Bh = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
6741
- function mr(...r) {
6741
+ function pr(...r) {
6742
6742
  const e = r.reduce((t, n) => t + n.source, "");
6743
6743
  return RegExp(`^${e}$`);
6744
6744
  }
6745
- function pr(...r) {
6745
+ function yr(...r) {
6746
6746
  return (e) => r.reduce(
6747
6747
  ([t, n, s], i) => {
6748
6748
  const [a, o, c] = i(e, s);
@@ -6751,7 +6751,7 @@ function pr(...r) {
6751
6751
  [{}, null, 1]
6752
6752
  ).slice(0, 2);
6753
6753
  }
6754
- function yr(r, ...e) {
6754
+ function gr(r, ...e) {
6755
6755
  if (r == null)
6756
6756
  return [null, null];
6757
6757
  for (const [t, n] of e) {
@@ -6784,7 +6784,7 @@ function W_(r, e) {
6784
6784
  day: nr(r, e + 2, 1)
6785
6785
  }, null, e + 3];
6786
6786
  }
6787
- function gr(r, e) {
6787
+ function _r(r, e) {
6788
6788
  return [{
6789
6789
  hours: nr(r, e, 0),
6790
6790
  minutes: nr(r, e + 1, 0),
@@ -6802,7 +6802,7 @@ function Yr(r, e) {
6802
6802
  }
6803
6803
  const z_ = RegExp(`^T?${nc.source}$`), B_ = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;
6804
6804
  function Z_(r) {
6805
- const [e, t, n, s, i, a, o, c, l] = r, u = e[0] === "-", f = c && c[0] === "-", h = (d, m = !1) => d !== void 0 && (m || d && u) ? -d : d;
6805
+ const [e, t, n, s, i, a, o, c, l] = r, u = e[0] === "-", f = c && c[0] === "-", h = (d, p = !1) => d !== void 0 && (p || d && u) ? -d : d;
6806
6806
  return [
6807
6807
  {
6808
6808
  years: h(qt(t)),
@@ -6868,28 +6868,28 @@ function ev(r) {
6868
6868
  const [, e, t, n, s, i, a, o] = r;
6869
6869
  return [ic(e, o, t, n, s, i, a), Pe.utcInstance];
6870
6870
  }
6871
- const tv = mr(P_, sc), rv = mr(q_, sc), nv = mr(L_, sc), sv = mr(Hh), Yh = pr(
6871
+ const tv = pr(P_, sc), rv = pr(q_, sc), nv = pr(L_, sc), sv = pr(Hh), Yh = yr(
6872
6872
  W_,
6873
- gr,
6873
+ _r,
6874
6874
  Kr,
6875
6875
  Yr
6876
- ), iv = pr(
6876
+ ), iv = yr(
6877
6877
  $_,
6878
- gr,
6878
+ _r,
6879
6879
  Kr,
6880
6880
  Yr
6881
- ), av = pr(
6881
+ ), av = yr(
6882
6882
  j_,
6883
- gr,
6883
+ _r,
6884
6884
  Kr,
6885
6885
  Yr
6886
- ), ov = pr(
6887
- gr,
6886
+ ), ov = yr(
6887
+ _r,
6888
6888
  Kr,
6889
6889
  Yr
6890
6890
  );
6891
6891
  function cv(r) {
6892
- return yr(
6892
+ return gr(
6893
6893
  r,
6894
6894
  [tv, Yh],
6895
6895
  [rv, iv],
@@ -6898,10 +6898,10 @@ function cv(r) {
6898
6898
  );
6899
6899
  }
6900
6900
  function lv(r) {
6901
- return yr(Y_(r), [H_, K_]);
6901
+ return gr(Y_(r), [H_, K_]);
6902
6902
  }
6903
6903
  function uv(r) {
6904
- return yr(
6904
+ return gr(
6905
6905
  r,
6906
6906
  [J_, Pf],
6907
6907
  [Q_, Pf],
@@ -6909,19 +6909,19 @@ function uv(r) {
6909
6909
  );
6910
6910
  }
6911
6911
  function fv(r) {
6912
- return yr(r, [B_, Z_]);
6912
+ return gr(r, [B_, Z_]);
6913
6913
  }
6914
- const dv = pr(gr);
6914
+ const dv = yr(_r);
6915
6915
  function hv(r) {
6916
- return yr(r, [z_, dv]);
6916
+ return gr(r, [z_, dv]);
6917
6917
  }
6918
- const mv = mr(U_, V_), pv = mr(Kh), yv = pr(
6919
- gr,
6918
+ const mv = pr(U_, V_), pv = pr(Kh), yv = yr(
6919
+ _r,
6920
6920
  Kr,
6921
6921
  Yr
6922
6922
  );
6923
6923
  function gv(r) {
6924
- return yr(
6924
+ return gr(
6925
6925
  r,
6926
6926
  [mv, Yh],
6927
6927
  [pv, yv]
@@ -7061,7 +7061,7 @@ class ue {
7061
7061
  constructor(e) {
7062
7062
  const t = e.conversionAccuracy === "longterm" || !1;
7063
7063
  let n = t ? vv : _v;
7064
- e.matrix && (n = e.matrix), this.values = e.values, this.loc = e.loc || he.create(), this.conversionAccuracy = t ? "longterm" : "casual", this.invalid = e.invalid || null, this.matrix = n, this.isLuxonDuration = !0;
7064
+ e.matrix && (n = e.matrix), this.values = e.values, this.loc = e.loc || me.create(), this.conversionAccuracy = t ? "longterm" : "casual", this.invalid = e.invalid || null, this.matrix = n, this.isLuxonDuration = !0;
7065
7065
  }
7066
7066
  /**
7067
7067
  * Create Duration from a number of milliseconds.
@@ -7102,7 +7102,7 @@ class ue {
7102
7102
  );
7103
7103
  return new ue({
7104
7104
  values: Sn(e, ue.normalizeUnit),
7105
- loc: he.fromObject(t),
7105
+ loc: me.fromObject(t),
7106
7106
  conversionAccuracy: t.conversionAccuracy,
7107
7107
  matrix: t.matrix
7108
7108
  });
@@ -7382,7 +7382,7 @@ class ue {
7382
7382
  if (!this.isValid) return this;
7383
7383
  const t = ue.fromDurationLike(e), n = {};
7384
7384
  for (const s of Vt)
7385
- (ur(t.values, s) || ur(this.values, s)) && (n[s] = t.get(s) + this.get(s));
7385
+ (fr(t.values, s) || fr(this.values, s)) && (n[s] = t.get(s) + this.get(s));
7386
7386
  return ft(this, { values: n }, !0);
7387
7387
  }
7388
7388
  /**
@@ -7685,7 +7685,7 @@ class Oe {
7685
7685
  * @return {Interval}
7686
7686
  */
7687
7687
  static fromDateTimes(e, t) {
7688
- const n = br(e), s = br(t), i = bv(n, s);
7688
+ const n = Or(e), s = Or(t), i = bv(n, s);
7689
7689
  return i ?? new Oe({
7690
7690
  start: n,
7691
7691
  end: s
@@ -7698,7 +7698,7 @@ class Oe {
7698
7698
  * @return {Interval}
7699
7699
  */
7700
7700
  static after(e, t) {
7701
- const n = ue.fromDurationLike(t), s = br(e);
7701
+ const n = ue.fromDurationLike(t), s = Or(e);
7702
7702
  return Oe.fromDateTimes(s, s.plus(n));
7703
7703
  }
7704
7704
  /**
@@ -7708,7 +7708,7 @@ class Oe {
7708
7708
  * @return {Interval}
7709
7709
  */
7710
7710
  static before(e, t) {
7711
- const n = ue.fromDurationLike(t), s = br(e);
7711
+ const n = ue.fromDurationLike(t), s = Or(e);
7712
7712
  return Oe.fromDateTimes(s.minus(n), s);
7713
7713
  }
7714
7714
  /**
@@ -7878,7 +7878,7 @@ class Oe {
7878
7878
  */
7879
7879
  splitAt(...e) {
7880
7880
  if (!this.isValid) return [];
7881
- const t = e.map(br).filter((a) => this.contains(a)).sort((a, o) => a.toMillis() - o.toMillis()), n = [];
7881
+ const t = e.map(Or).filter((a) => this.contains(a)).sort((a, o) => a.toMillis() - o.toMillis()), n = [];
7882
7882
  let { s } = this, i = 0;
7883
7883
  for (; s < this.e; ) {
7884
7884
  const a = t[i] || this.e, o = +a > +this.e ? this.e : a;
@@ -8160,7 +8160,7 @@ class rn {
8160
8160
  * @returns {number} the start of the week, 1 for Monday through 7 for Sunday
8161
8161
  */
8162
8162
  static getStartOfWeek({ locale: e = null, locObj: t = null } = {}) {
8163
- return (t || he.create(e)).getStartOfWeek();
8163
+ return (t || me.create(e)).getStartOfWeek();
8164
8164
  }
8165
8165
  /**
8166
8166
  * Get the minimum number of days necessary in a week before it is considered part of the next year according
@@ -8171,7 +8171,7 @@ class rn {
8171
8171
  * @returns {number}
8172
8172
  */
8173
8173
  static getMinimumDaysInFirstWeek({ locale: e = null, locObj: t = null } = {}) {
8174
- return (t || he.create(e)).getMinDaysInFirstWeek();
8174
+ return (t || me.create(e)).getMinDaysInFirstWeek();
8175
8175
  }
8176
8176
  /**
8177
8177
  * Get the weekdays, which are considered the weekend according to the given locale
@@ -8181,7 +8181,7 @@ class rn {
8181
8181
  * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday
8182
8182
  */
8183
8183
  static getWeekendWeekdays({ locale: e = null, locObj: t = null } = {}) {
8184
- return (t || he.create(e)).getWeekendDays().slice();
8184
+ return (t || me.create(e)).getWeekendDays().slice();
8185
8185
  }
8186
8186
  /**
8187
8187
  * Return an array of standalone month names.
@@ -8201,7 +8201,7 @@ class rn {
8201
8201
  * @return {Array}
8202
8202
  */
8203
8203
  static months(e = "long", { locale: t = null, numberingSystem: n = null, locObj: s = null, outputCalendar: i = "gregory" } = {}) {
8204
- return (s || he.create(t, n, i)).months(e);
8204
+ return (s || me.create(t, n, i)).months(e);
8205
8205
  }
8206
8206
  /**
8207
8207
  * Return an array of format month names.
@@ -8217,7 +8217,7 @@ class rn {
8217
8217
  * @return {Array}
8218
8218
  */
8219
8219
  static monthsFormat(e = "long", { locale: t = null, numberingSystem: n = null, locObj: s = null, outputCalendar: i = "gregory" } = {}) {
8220
- return (s || he.create(t, n, i)).months(e, !0);
8220
+ return (s || me.create(t, n, i)).months(e, !0);
8221
8221
  }
8222
8222
  /**
8223
8223
  * Return an array of standalone week names.
@@ -8234,7 +8234,7 @@ class rn {
8234
8234
  * @return {Array}
8235
8235
  */
8236
8236
  static weekdays(e = "long", { locale: t = null, numberingSystem: n = null, locObj: s = null } = {}) {
8237
- return (s || he.create(t, n, null)).weekdays(e);
8237
+ return (s || me.create(t, n, null)).weekdays(e);
8238
8238
  }
8239
8239
  /**
8240
8240
  * Return an array of format week names.
@@ -8249,7 +8249,7 @@ class rn {
8249
8249
  * @return {Array}
8250
8250
  */
8251
8251
  static weekdaysFormat(e = "long", { locale: t = null, numberingSystem: n = null, locObj: s = null } = {}) {
8252
- return (s || he.create(t, n, null)).weekdays(e, !0);
8252
+ return (s || me.create(t, n, null)).weekdays(e, !0);
8253
8253
  }
8254
8254
  /**
8255
8255
  * Return an array of meridiems.
@@ -8260,7 +8260,7 @@ class rn {
8260
8260
  * @return {Array}
8261
8261
  */
8262
8262
  static meridiems({ locale: e = null } = {}) {
8263
- return he.create(e).meridiems();
8263
+ return me.create(e).meridiems();
8264
8264
  }
8265
8265
  /**
8266
8266
  * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.
@@ -8273,7 +8273,7 @@ class rn {
8273
8273
  * @return {Array}
8274
8274
  */
8275
8275
  static eras(e = "short", { locale: t = null } = {}) {
8276
- return he.create(t, null, "gregory").eras(e);
8276
+ return me.create(t, null, "gregory").eras(e);
8277
8277
  }
8278
8278
  /**
8279
8279
  * Return the set of available features in this environment.
@@ -8542,7 +8542,7 @@ function Nv(r, e, t) {
8542
8542
  const s = {};
8543
8543
  let i = 1;
8544
8544
  for (const a in t)
8545
- if (ur(t, a)) {
8545
+ if (fr(t, a)) {
8546
8546
  const o = t[a], c = o.groups ? o.groups + 1 : 1;
8547
8547
  !o.literal && o.token && (s[o.token.val[0]] = o.deser(n.slice(i, i + c))), i += c;
8548
8548
  }
@@ -8613,7 +8613,7 @@ class rm {
8613
8613
  explainFromTokens(e) {
8614
8614
  if (this.isValid) {
8615
8615
  const [t, n] = Nv(e, this.regex, this.handlers), [s, i, a] = n ? Fv(n) : [null, null, void 0];
8616
- if (ur(n, "a") && ur(n, "H"))
8616
+ if (fr(n, "a") && fr(n, "H"))
8617
8617
  throw new er(
8618
8618
  "Can't include meridiem when specifying 24-hour format"
8619
8619
  );
@@ -8651,7 +8651,7 @@ function sm(r, e) {
8651
8651
  return s.map((a) => Iv(a, r, i));
8652
8652
  }
8653
8653
  const Ra = "Invalid DateTime", Wf = 864e13;
8654
- function Ar(r) {
8654
+ function kr(r) {
8655
8655
  return new nt("unsupported zone", `the zone "${r.name}" is not supported`);
8656
8656
  }
8657
8657
  function Ca(r) {
@@ -8735,7 +8735,7 @@ function Jt(r, e, t, n, s, i) {
8735
8735
  );
8736
8736
  }
8737
8737
  function an(r, e, t = !0) {
8738
- return r.isValid ? Fe.create(he.create("en-US"), {
8738
+ return r.isValid ? Fe.create(me.create("en-US"), {
8739
8739
  allowZ: t,
8740
8740
  forceSimple: !0
8741
8741
  }).formatDateTimeFromString(r, e) : null;
@@ -8846,17 +8846,17 @@ function Zf(r) {
8846
8846
  }
8847
8847
  }
8848
8848
  function Uv(r) {
8849
- if (kr === void 0 && (kr = Ee.now()), r.type !== "iana")
8850
- return r.offset(kr);
8849
+ if (Ir === void 0 && (Ir = Ee.now()), r.type !== "iana")
8850
+ return r.offset(Ir);
8851
8851
  const e = r.name;
8852
8852
  let t = So.get(e);
8853
- return t === void 0 && (t = r.offset(kr), So.set(e, t)), t;
8853
+ return t === void 0 && (t = r.offset(Ir), So.set(e, t)), t;
8854
8854
  }
8855
8855
  function Gf(r, e) {
8856
8856
  const t = kt(e.zone, Ee.defaultZone);
8857
8857
  if (!t.isValid)
8858
- return B.invalid(Ar(t));
8859
- const n = he.fromObject(e);
8858
+ return B.invalid(kr(t));
8859
+ const n = me.fromObject(e);
8860
8860
  let s, i;
8861
8861
  if (J(r.year))
8862
8862
  s = Ee.now();
@@ -8886,7 +8886,7 @@ function Kf(r) {
8886
8886
  let e = {}, t;
8887
8887
  return r.length > 0 && typeof r[r.length - 1] == "object" ? (e = r[r.length - 1], t = Array.from(r).slice(0, r.length - 1)) : t = Array.from(r), [e, t];
8888
8888
  }
8889
- let kr;
8889
+ let Ir;
8890
8890
  const So = /* @__PURE__ */ new Map();
8891
8891
  class B {
8892
8892
  /**
@@ -8894,7 +8894,7 @@ class B {
8894
8894
  */
8895
8895
  constructor(e) {
8896
8896
  const t = e.zone || Ee.defaultZone;
8897
- let n = e.invalid || (Number.isNaN(e.ts) ? new nt("invalid input") : null) || (t.isValid ? null : Ar(t));
8897
+ let n = e.invalid || (Number.isNaN(e.ts) ? new nt("invalid input") : null) || (t.isValid ? null : kr(t));
8898
8898
  this.ts = J(e.ts) ? Ee.now() : e.ts;
8899
8899
  let s = null, i = null;
8900
8900
  if (!n)
@@ -8904,7 +8904,7 @@ class B {
8904
8904
  const o = xt(e.o) && !e.old ? e.o : t.offset(this.ts);
8905
8905
  s = sn(this.ts, o), n = Number.isNaN(s.year) ? new nt("invalid input") : null, s = n ? null : s, i = n ? null : o;
8906
8906
  }
8907
- this._zone = t, this.loc = e.loc || he.create(), this.invalid = n, this.weekData = null, this.localWeekData = null, this.c = s, this.o = i, this.isLuxonDateTime = !0;
8907
+ this._zone = t, this.loc = e.loc || me.create(), this.invalid = n, this.weekData = null, this.localWeekData = null, this.c = s, this.o = i, this.isLuxonDateTime = !0;
8908
8908
  }
8909
8909
  // CONSTRUCT
8910
8910
  /**
@@ -8986,8 +8986,8 @@ class B {
8986
8986
  return s.isValid ? new B({
8987
8987
  ts: n,
8988
8988
  zone: s,
8989
- loc: he.fromObject(t)
8990
- }) : B.invalid(Ar(s));
8989
+ loc: me.fromObject(t)
8990
+ }) : B.invalid(kr(s));
8991
8991
  }
8992
8992
  /**
8993
8993
  * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.
@@ -9005,7 +9005,7 @@ class B {
9005
9005
  return e < -Wf || e > Wf ? B.invalid("Timestamp out of range") : new B({
9006
9006
  ts: e,
9007
9007
  zone: kt(t.zone, Ee.defaultZone),
9008
- loc: he.fromObject(t)
9008
+ loc: me.fromObject(t)
9009
9009
  });
9010
9010
  throw new Ne(
9011
9011
  `fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`
@@ -9027,7 +9027,7 @@ class B {
9027
9027
  return new B({
9028
9028
  ts: e * 1e3,
9029
9029
  zone: kt(t.zone, Ee.defaultZone),
9030
- loc: he.fromObject(t)
9030
+ loc: me.fromObject(t)
9031
9031
  });
9032
9032
  throw new Ne("fromSeconds requires a numerical input");
9033
9033
  }
@@ -9068,35 +9068,35 @@ class B {
9068
9068
  e = e || {};
9069
9069
  const n = kt(t.zone, Ee.defaultZone);
9070
9070
  if (!n.isValid)
9071
- return B.invalid(Ar(n));
9072
- const s = he.fromObject(t), i = Sn(e, Zf), { minDaysInFirstWeek: a, startOfWeek: o } = Nf(i, s), c = Ee.now(), l = J(t.specificOffset) ? n.offset(c) : t.specificOffset, u = !J(i.ordinal), f = !J(i.year), h = !J(i.month) || !J(i.day), d = f || h, m = i.weekYear || i.weekNumber;
9073
- if ((d || u) && m)
9071
+ return B.invalid(kr(n));
9072
+ const s = me.fromObject(t), i = Sn(e, Zf), { minDaysInFirstWeek: a, startOfWeek: o } = Nf(i, s), c = Ee.now(), l = J(t.specificOffset) ? n.offset(c) : t.specificOffset, u = !J(i.ordinal), f = !J(i.year), h = !J(i.month) || !J(i.day), d = f || h, p = i.weekYear || i.weekNumber;
9073
+ if ((d || u) && p)
9074
9074
  throw new er(
9075
9075
  "Can't mix weekYear/weekNumber units with year/month/day or ordinals"
9076
9076
  );
9077
9077
  if (h && u)
9078
9078
  throw new er("Can't mix ordinal dates with month/day");
9079
- const E = m || i.weekday && !d;
9079
+ const E = p || i.weekday && !d;
9080
9080
  let y, _, S = sn(c, l);
9081
9081
  E ? (y = $v, _ = qv, S = On(S, a, o)) : u ? (y = jv, _ = Lv, S = Sa(S)) : (y = ln, _ = am);
9082
- let T = !1;
9083
- for (const p of y) {
9084
- const k = i[p];
9085
- J(k) ? T ? i[p] = _[p] : i[p] = S[p] : T = !0;
9086
- }
9087
- const P = E ? y_(i, a, o) : u ? g_(i) : Nh(i), g = P || Fh(i);
9088
- if (g)
9089
- return B.invalid(g);
9090
- const C = E ? If(i, a, o) : u ? xf(i) : i, [R, v] = cn(C, l, n), A = new B({
9082
+ let A = !1;
9083
+ for (const g of y) {
9084
+ const k = i[g];
9085
+ J(k) ? A ? i[g] = _[g] : i[g] = S[g] : A = !0;
9086
+ }
9087
+ const F = E ? y_(i, a, o) : u ? g_(i) : Nh(i), m = F || Fh(i);
9088
+ if (m)
9089
+ return B.invalid(m);
9090
+ const T = E ? If(i, a, o) : u ? xf(i) : i, [R, v] = cn(T, l, n), C = new B({
9091
9091
  ts: R,
9092
9092
  zone: n,
9093
9093
  o: v,
9094
9094
  loc: s
9095
9095
  });
9096
- return i.weekday && d && e.weekday !== A.weekday ? B.invalid(
9096
+ return i.weekday && d && e.weekday !== C.weekday ? B.invalid(
9097
9097
  "mismatched weekday",
9098
- `you can't specify both a weekday of ${i.weekday} and a date of ${A.toISO()}`
9099
- ) : A.isValid ? A : B.invalid(A.invalid);
9098
+ `you can't specify both a weekday of ${i.weekday} and a date of ${C.toISO()}`
9099
+ ) : C.isValid ? C : B.invalid(C.invalid);
9100
9100
  }
9101
9101
  /**
9102
9102
  * Create a DateTime from an ISO 8601 string
@@ -9175,7 +9175,7 @@ class B {
9175
9175
  static fromFormat(e, t, n = {}) {
9176
9176
  if (J(e) || J(t))
9177
9177
  throw new Ne("fromFormat requires an input string and a format");
9178
- const { locale: s = null, numberingSystem: i = null } = n, a = he.fromOpts({
9178
+ const { locale: s = null, numberingSystem: i = null } = n, a = me.fromOpts({
9179
9179
  locale: s,
9180
9180
  numberingSystem: i,
9181
9181
  defaultToEN: !0
@@ -9242,7 +9242,7 @@ class B {
9242
9242
  * @returns {string}
9243
9243
  */
9244
9244
  static parseFormatForOpts(e, t = {}) {
9245
- const n = sm(e, he.fromObject(t));
9245
+ const n = sm(e, me.fromObject(t));
9246
9246
  return n ? n.map((s) => s ? s.val : null).join("") : null;
9247
9247
  }
9248
9248
  /**
@@ -9253,10 +9253,10 @@ class B {
9253
9253
  * @returns {string}
9254
9254
  */
9255
9255
  static expandFormat(e, t = {}) {
9256
- return tm(Fe.parseFormat(e), he.fromObject(t)).map((s) => s.val).join("");
9256
+ return tm(Fe.parseFormat(e), me.fromObject(t)).map((s) => s.val).join("");
9257
9257
  }
9258
9258
  static resetCache() {
9259
- kr = void 0, So.clear();
9259
+ Ir = void 0, So.clear();
9260
9260
  }
9261
9261
  // INFO
9262
9262
  /**
@@ -9664,7 +9664,7 @@ class B {
9664
9664
  }
9665
9665
  return Lt(this, { ts: s, zone: e });
9666
9666
  } else
9667
- return B.invalid(Ar(e));
9667
+ return B.invalid(kr(e));
9668
9668
  }
9669
9669
  /**
9670
9670
  * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.
@@ -10241,7 +10241,7 @@ class B {
10241
10241
  * @return {Object}
10242
10242
  */
10243
10243
  static fromFormatExplain(e, t, n = {}) {
10244
- const { locale: s = null, numberingSystem: i = null } = n, a = he.fromOpts({
10244
+ const { locale: s = null, numberingSystem: i = null } = n, a = me.fromOpts({
10245
10245
  locale: s,
10246
10246
  numberingSystem: i,
10247
10247
  defaultToEN: !0
@@ -10267,7 +10267,7 @@ class B {
10267
10267
  * @returns {TokenParser} - opaque object to be used
10268
10268
  */
10269
10269
  static buildFormatParser(e, t = {}) {
10270
- const { locale: n = null, numberingSystem: s = null } = t, i = he.fromOpts({
10270
+ const { locale: n = null, numberingSystem: s = null } = t, i = me.fromOpts({
10271
10271
  locale: n,
10272
10272
  numberingSystem: s,
10273
10273
  defaultToEN: !0
@@ -10289,7 +10289,7 @@ class B {
10289
10289
  throw new Ne(
10290
10290
  "fromFormatParser requires an input string and a format parser"
10291
10291
  );
10292
- const { locale: s = null, numberingSystem: i = null } = n, a = he.fromOpts({
10292
+ const { locale: s = null, numberingSystem: i = null } = n, a = me.fromOpts({
10293
10293
  locale: s,
10294
10294
  numberingSystem: i,
10295
10295
  defaultToEN: !0
@@ -10464,7 +10464,7 @@ class B {
10464
10464
  return Th;
10465
10465
  }
10466
10466
  }
10467
- function br(r) {
10467
+ function Or(r) {
10468
10468
  if (B.isDateTime(r))
10469
10469
  return r;
10470
10470
  if (r && r.valueOf && xt(r.valueOf()))
@@ -10486,31 +10486,31 @@ const Yf = async (r, e) => {
10486
10486
  for (const o of n.fields)
10487
10487
  await Yf(o.custom?.preValidate, s);
10488
10488
  return Wg(r, t, i).parse(e), e;
10489
- }, ac = (r, e, t, n, s, i, a, o, c, l, u, f, h, d, m, E, y, _, S, T, P) => {
10490
- const { fields: g } = a;
10491
- g.filter((v) => "unique" in v && v.unique).forEach((v) => {
10489
+ }, ac = (r, e, t, n, s, i, a, o, c, l, u, f, h, d, p, E, y, _, S, A, F) => {
10490
+ const { fields: m } = a;
10491
+ m.filter((v) => "unique" in v && v.unique).forEach((v) => {
10492
10492
  r !== "delete" && (typeof s[v.name] == "string" || typeof s[v.name] == "number") && e.set(d(v, s[v.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||")), {
10493
10493
  id: n,
10494
10494
  Collection_Path: t
10495
10495
  });
10496
- }), g.forEach((v) => {
10496
+ }), m.forEach((v) => {
10497
10497
  if (cg(v, a, i)) {
10498
- const A = fg(v, a, i), p = {};
10499
- s[v.name] !== void 0 && (p[v.name] = s[v.name], _e(v) && (p[`${v.name}_Array`] = s[`${v.name}_Array`])), A.forEach((k) => {
10500
- s[k.name] !== void 0 && (_e(k) ? p[`${k.name}_Array`] = s[`${k.name}_Array`] : p[k.name] = s[k.name]);
10501
- }), Object.keys(p).length > 0 && (r === "create" && (p.Collection_Path = t, p.Collection_Path_String = t.join("/"), e.set(h(v), p)), r === "update" && e.update(h(v), p), r === "delete" && e.delete(h(v)));
10498
+ const C = fg(v, a, i), g = {};
10499
+ s[v.name] !== void 0 && (g[v.name] = s[v.name], _e(v) && (g[`${v.name}_Array`] = s[`${v.name}_Array`])), C.forEach((k) => {
10500
+ s[k.name] !== void 0 && (_e(k) ? g[`${k.name}_Array`] = s[`${k.name}_Array`] : g[k.name] = s[k.name]);
10501
+ }), Object.keys(g).length > 0 && (r === "create" && (g.Collection_Path = t, g.Collection_Path_String = t.join("/"), e.set(h(v), g)), r === "update" && e.update(h(v), g), r === "delete" && e.delete(h(v)));
10502
10502
  }
10503
10503
  });
10504
- const C = c[a.labels.collection];
10505
- for (const v of C) {
10506
- const A = dg(v, a), p = { ...s };
10507
- A.forEach((k) => {
10508
- delete p[k.name], delete p[`${k.name}_Array`], delete p[`${k.name}_Single`], delete p[`${k.name}_Lowercase`];
10509
- }), Object.keys(p).length > 0 && (r === "create" && (p.Collection_Path ||= t, p.Collection_Path_String = t.join("/"), e.set(m(v.key), p)), r === "update" && e.update(m(v.key), p), r === "delete" && e.delete(m(v.key)));
10504
+ const T = c[a.labels.collection];
10505
+ for (const v of T) {
10506
+ const C = dg(v, a), g = { ...s };
10507
+ C.forEach((k) => {
10508
+ delete g[k.name], delete g[`${k.name}_Array`], delete g[`${k.name}_Single`], delete g[`${k.name}_Lowercase`];
10509
+ }), Object.keys(g).length > 0 && (r === "create" && (g.Collection_Path ||= t, g.Collection_Path_String = t.join("/"), e.set(p(v.key), g)), r === "update" && e.update(p(v.key), g), r === "delete" && e.delete(p(v.key)));
10510
10510
  }
10511
10511
  if (r === "delete")
10512
10512
  return;
10513
- const R = g.filter((v) => _e(v) && v.twoWay);
10513
+ const R = m.filter((v) => _e(v) && v.twoWay);
10514
10514
  if (!o?.noTwoWay) {
10515
10515
  for (const v of R)
10516
10516
  throw new Error("VALIDATION_ERROR: batchSize is required");
@@ -10639,38 +10639,38 @@ var Ua, cd;
10639
10639
  function Qv() {
10640
10640
  if (cd) return Ua;
10641
10641
  cd = 1;
10642
- var r = zo(), e = Kv(), t = Yv(), n = Jv(), s = Bd(), i = "[object Boolean]", a = "[object Date]", o = "[object Map]", c = "[object Number]", l = "[object RegExp]", u = "[object Set]", f = "[object String]", h = "[object Symbol]", d = "[object ArrayBuffer]", m = "[object DataView]", E = "[object Float32Array]", y = "[object Float64Array]", _ = "[object Int8Array]", S = "[object Int16Array]", T = "[object Int32Array]", P = "[object Uint8Array]", g = "[object Uint8ClampedArray]", C = "[object Uint16Array]", R = "[object Uint32Array]";
10643
- function v(A, p, k) {
10644
- var I = A.constructor;
10645
- switch (p) {
10642
+ var r = zo(), e = Kv(), t = Yv(), n = Jv(), s = Bd(), i = "[object Boolean]", a = "[object Date]", o = "[object Map]", c = "[object Number]", l = "[object RegExp]", u = "[object Set]", f = "[object String]", h = "[object Symbol]", d = "[object ArrayBuffer]", p = "[object DataView]", E = "[object Float32Array]", y = "[object Float64Array]", _ = "[object Int8Array]", S = "[object Int16Array]", A = "[object Int32Array]", F = "[object Uint8Array]", m = "[object Uint8ClampedArray]", T = "[object Uint16Array]", R = "[object Uint32Array]";
10643
+ function v(C, g, k) {
10644
+ var I = C.constructor;
10645
+ switch (g) {
10646
10646
  case d:
10647
- return r(A);
10647
+ return r(C);
10648
10648
  case i:
10649
10649
  case a:
10650
- return new I(+A);
10651
- case m:
10652
- return e(A, k);
10650
+ return new I(+C);
10651
+ case p:
10652
+ return e(C, k);
10653
10653
  case E:
10654
10654
  case y:
10655
10655
  case _:
10656
10656
  case S:
10657
+ case A:
10658
+ case F:
10659
+ case m:
10657
10660
  case T:
10658
- case P:
10659
- case g:
10660
- case C:
10661
10661
  case R:
10662
- return s(A, k);
10662
+ return s(C, k);
10663
10663
  case o:
10664
10664
  return new I();
10665
10665
  case c:
10666
10666
  case f:
10667
- return new I(A);
10667
+ return new I(C);
10668
10668
  case l:
10669
- return t(A);
10669
+ return t(C);
10670
10670
  case u:
10671
10671
  return new I();
10672
10672
  case h:
10673
- return n(A);
10673
+ return n(C);
10674
10674
  }
10675
10675
  }
10676
10676
  return Ua = v, Ua;
@@ -10713,41 +10713,41 @@ var Za, hd;
10713
10713
  function nw() {
10714
10714
  if (hd) return Za;
10715
10715
  hd = 1;
10716
- var r = Mo(), e = Vv(), t = Zo(), n = Wv(), s = zv(), i = zd(), a = Zd(), o = Bv(), c = Zv(), l = jd(), u = Gv(), f = qn(), h = Hv(), d = Qv(), m = Gd(), E = Dt(), y = Mn(), _ = ew(), S = wt(), T = rw(), P = Vo(), g = Br(), C = 1, R = 2, v = 4, A = "[object Arguments]", p = "[object Array]", k = "[object Boolean]", I = "[object Date]", b = "[object Error]", w = "[object Function]", O = "[object GeneratorFunction]", x = "[object Map]", M = "[object Number]", D = "[object Object]", q = "[object RegExp]", z = "[object Set]", ee = "[object String]", oe = "[object Symbol]", F = "[object WeakMap]", te = "[object ArrayBuffer]", ne = "[object DataView]", Me = "[object Float32Array]", Se = "[object Float64Array]", Le = "[object Int8Array]", Ot = "[object Int16Array]", G = "[object Int32Array]", K = "[object Uint8Array]", j = "[object Uint8ClampedArray]", Y = "[object Uint16Array]", U = "[object Uint32Array]", Z = {};
10717
- Z[A] = Z[p] = Z[te] = Z[ne] = Z[k] = Z[I] = Z[Me] = Z[Se] = Z[Le] = Z[Ot] = Z[G] = Z[x] = Z[M] = Z[D] = Z[q] = Z[z] = Z[ee] = Z[oe] = Z[K] = Z[j] = Z[Y] = Z[U] = !0, Z[b] = Z[w] = Z[F] = !1;
10716
+ var r = Mo(), e = Vv(), t = Zo(), n = Wv(), s = zv(), i = zd(), a = Zd(), o = Bv(), c = Zv(), l = jd(), u = Gv(), f = qn(), h = Hv(), d = Qv(), p = Gd(), E = Dt(), y = Mn(), _ = ew(), S = wt(), A = rw(), F = Vo(), m = Br(), T = 1, R = 2, v = 4, C = "[object Arguments]", g = "[object Array]", k = "[object Boolean]", I = "[object Date]", b = "[object Error]", w = "[object Function]", O = "[object GeneratorFunction]", x = "[object Map]", P = "[object Number]", M = "[object Object]", q = "[object RegExp]", z = "[object Set]", ee = "[object String]", oe = "[object Symbol]", D = "[object WeakMap]", te = "[object ArrayBuffer]", ne = "[object DataView]", Me = "[object Float32Array]", Se = "[object Float64Array]", Le = "[object Int8Array]", Ot = "[object Int16Array]", G = "[object Int32Array]", K = "[object Uint8Array]", j = "[object Uint8ClampedArray]", Y = "[object Uint16Array]", U = "[object Uint32Array]", Z = {};
10717
+ Z[C] = Z[g] = Z[te] = Z[ne] = Z[k] = Z[I] = Z[Me] = Z[Se] = Z[Le] = Z[Ot] = Z[G] = Z[x] = Z[P] = Z[M] = Z[q] = Z[z] = Z[ee] = Z[oe] = Z[K] = Z[j] = Z[Y] = Z[U] = !0, Z[b] = Z[w] = Z[D] = !1;
10718
10718
  function Te(H, ge, se, Xe, ut, Be) {
10719
- var xe, vr = ge & C, Re = ge & R, wr = ge & v;
10719
+ var xe, wr = ge & T, Re = ge & R, br = ge & v;
10720
10720
  if (se && (xe = ut ? se(H, Xe, ut, Be) : se(H)), xe !== void 0)
10721
10721
  return xe;
10722
10722
  if (!S(H))
10723
10723
  return H;
10724
10724
  var _c = E(H);
10725
10725
  if (_c) {
10726
- if (xe = h(H), !vr)
10726
+ if (xe = h(H), !wr)
10727
10727
  return a(H, xe);
10728
10728
  } else {
10729
10729
  var Ht = f(H), vc = Ht == w || Ht == O;
10730
10730
  if (y(H))
10731
- return i(H, vr);
10732
- if (Ht == D || Ht == A || vc && !ut) {
10733
- if (xe = Re || vc ? {} : m(H), !vr)
10731
+ return i(H, wr);
10732
+ if (Ht == M || Ht == C || vc && !ut) {
10733
+ if (xe = Re || vc ? {} : p(H), !wr)
10734
10734
  return Re ? c(H, s(xe, H)) : o(H, n(xe, H));
10735
10735
  } else {
10736
10736
  if (!Z[Ht])
10737
10737
  return ut ? H : {};
10738
- xe = d(H, Ht, vr);
10738
+ xe = d(H, Ht, wr);
10739
10739
  }
10740
10740
  }
10741
10741
  Be || (Be = new r());
10742
10742
  var wc = Be.get(H);
10743
10743
  if (wc)
10744
10744
  return wc;
10745
- Be.set(H, xe), T(H) ? H.forEach(function(Et) {
10745
+ Be.set(H, xe), A(H) ? H.forEach(function(Et) {
10746
10746
  xe.add(Te(Et, ge, se, Et, H, Be));
10747
10747
  }) : _(H) && H.forEach(function(Et, Pt) {
10748
10748
  xe.set(Pt, Te(Et, ge, se, Pt, H, Be));
10749
10749
  });
10750
- var Im = wr ? Re ? u : l : Re ? g : P, bc = _c ? void 0 : Im(H);
10750
+ var Im = br ? Re ? u : l : Re ? m : F, bc = _c ? void 0 : Im(H);
10751
10751
  return e(bc || H, function(Et, Pt) {
10752
10752
  bc && (Pt = Et, Et = H[Pt]), t(xe, Pt, Te(Et, ge, se, Pt, H, Be));
10753
10753
  }), xe;
@@ -10857,90 +10857,91 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
10857
10857
  const c = i.collections[o], { labels: l, fields: u, preloadCache: f } = c, h = lt(o), d = a.collections?.[l.collection];
10858
10858
  if (!a.Role)
10859
10859
  throw new Error("PERMISSION_DENIED");
10860
- const m = d && vt("Read", d), E = kn(c, i, a), y = Rd(c, a), _ = xo(c, a), S = Cd(c, i, a), T = (w = []) => {
10860
+ const p = d && vt("Read", d), E = kn(c, i, a), y = Rd(c, a), _ = xo(c, a), S = Cd(c, i, a), A = (w = []) => {
10861
10861
  const O = [];
10862
- if (m)
10863
- O.push(me(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${e.key}`), ye("Collection_Path_String", "==", r.join("/")), ...w));
10864
- else if (E)
10862
+ if (p) {
10863
+ let x = he(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${e.key}`), ...w);
10864
+ t || (x = he(x, ye("Collection_Path_String", "==", r.join("/")))), O.push(x);
10865
+ } else if (E)
10865
10866
  for (const x of E)
10866
- O.push(me(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${x.field}`), ye("Collection_Path_String", "==", r.join("/")), ...w));
10867
+ O.push(he(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${x.field}`), ye("Collection_Path_String", "==", r.join("/")), ...w));
10867
10868
  return O;
10868
- }, P = y.filter((w) => "operations" in w && w.operations ? w.operations.includes("Read") : !0);
10869
- if (t || P.length === 0 && _.length === 0 && S.length === 0)
10870
- return T();
10871
- let g = 0;
10872
- const C = (w) => {
10873
- w && (g === 0 ? g = w : g *= w);
10869
+ }, F = y.filter((w) => "operations" in w && w.operations ? w.operations.includes("Read") : !0);
10870
+ if (F.length === 0 && _.length === 0 && S.length === 0)
10871
+ return A();
10872
+ let m = 0;
10873
+ const T = (w) => {
10874
+ w && (m === 0 ? m = w : m *= w);
10874
10875
  };
10875
- if (P) {
10876
- for (const w of P)
10876
+ if (F) {
10877
+ for (const w of F)
10877
10878
  if (w.type === "Record_Property") {
10878
10879
  const O = w.roles.find((x) => x.role === a.Role);
10879
10880
  if (!O)
10880
10881
  throw new Error("PERMISSION_DENIED");
10881
- C(O.values?.length);
10882
+ T(O.values?.length);
10882
10883
  }
10883
10884
  }
10884
- f?.roles.includes(a.Role) && f.range && C(f.range.fields.length);
10885
+ f?.roles.includes(a.Role) && f.range && T(f.range.fields.length);
10885
10886
  const R = h.admin?.statusField;
10886
- R && !f?.roles.includes(a.Role) && C(Math.max(R.active?.length || 0, R.archived?.length || 0));
10887
- const v = g === 0 ? 30 : Math.max(1, Math.floor(30 / g)), A = [];
10888
- P.filter((w) => w.type === "Record_Owner").forEach(() => A.push(ye("Created_By", "==", a.User_ID))), P.filter((w) => w.type === "Record_User").forEach((w) => {
10887
+ R && !f?.roles.includes(a.Role) && T(Math.max(R.active?.length || 0, R.archived?.length || 0));
10888
+ const v = m === 0 ? 30 : Math.max(1, Math.floor(30 / m)), C = [];
10889
+ F.filter((w) => w.type === "Record_Owner").forEach(() => C.push(ye("Created_By", "==", a.User_ID))), F.filter((w) => w.type === "Record_User").forEach((w) => {
10889
10890
  if ("collectionField" in w) {
10890
10891
  const O = re(u, w.collectionField);
10891
- A.push(ye(`${O.name}_Array`, "array-contains", a.Doc_ID));
10892
+ C.push(ye(`${O.name}_Array`, "array-contains", a.Doc_ID));
10892
10893
  }
10893
- }), P.filter((w) => w.type === "Record_Property").forEach((w) => {
10894
+ }), F.filter((w) => w.type === "Record_Property").forEach((w) => {
10894
10895
  if ("propertyField" in w) {
10895
- const O = w.roles.find((M) => M.role === a.Role);
10896
+ const O = w.roles.find((P) => P.role === a.Role);
10896
10897
  if (!O)
10897
10898
  throw new Error("PERMISSION_DENIED");
10898
10899
  const x = re(u, w.propertyField);
10899
- x.type === "Array" ? A.push(ye(x.name, "array-contains-any", O.values)) : A.push(ye(x.name, "in", O.values));
10900
+ x.type === "Array" ? C.push(ye(x.name, "array-contains-any", O.values)) : C.push(ye(x.name, "in", O.values));
10900
10901
  }
10901
10902
  });
10902
- const p = [];
10903
+ const g = [];
10903
10904
  _.filter((w) => w.type === "Individual").forEach((w) => {
10904
10905
  const O = d?.individualEntities, x = [];
10905
10906
  if (O) {
10906
- const M = w.singleQuery ? w.singleQuery : v;
10907
- for (let D = 0; D < O.length; D += M) {
10908
- const q = O.slice(D, D + M);
10907
+ const P = w.singleQuery ? w.singleQuery : v;
10908
+ for (let M = 0; M < O.length; M += P) {
10909
+ const q = O.slice(M, M + P);
10909
10910
  x.push(q);
10910
10911
  }
10911
10912
  if (!w.singleQuery)
10912
- x.forEach((D) => {
10913
- p.push(...T(A.concat(ye("id", "in", D))));
10913
+ x.forEach((M) => {
10914
+ g.push(...A(C.concat(ye("id", "in", M))));
10914
10915
  });
10915
10916
  else {
10916
- if (O.length > M)
10917
+ if (O.length > P)
10917
10918
  throw new Error(`INPUT_ERROR: Individual entity restriction with singleQuery set to true must not have more than ${w.singleQuery} entities`);
10918
- A.push(ye("id", "in", O));
10919
+ C.push(ye("id", "in", O));
10919
10920
  }
10920
10921
  }
10921
10922
  }), S.filter((w) => w.parentFilter.type === "Individual").forEach((w) => {
10922
10923
  const { parentFilter: O, parentRestriction: x } = w;
10923
10924
  if ("collectionField" in O) {
10924
- const M = re(u, O.collectionField);
10925
- if ("collection" in M) {
10926
- const D = a.collections?.[M.collection];
10927
- if (!D)
10925
+ const P = re(u, O.collectionField);
10926
+ if ("collection" in P) {
10927
+ const M = a.collections?.[P.collection];
10928
+ if (!M)
10928
10929
  throw new Error("PERMISSION_DENIED");
10929
- const q = D?.individualEntities, z = [];
10930
+ const q = M?.individualEntities, z = [];
10930
10931
  if (q) {
10931
10932
  const ee = x.singleQuery ? x.singleQuery : v;
10932
10933
  for (let oe = 0; oe < q.length; oe += ee) {
10933
- const F = q.slice(oe, oe + ee);
10934
- z.push(F);
10934
+ const D = q.slice(oe, oe + ee);
10935
+ z.push(D);
10935
10936
  }
10936
10937
  if (!x.singleQuery)
10937
10938
  z.forEach((oe) => {
10938
- p.push(...T(A.concat(ye(`${M.name}_Array`, "array-contains-any", oe))));
10939
+ g.push(...A(C.concat(ye(`${P.name}_Array`, "array-contains-any", oe))));
10939
10940
  });
10940
10941
  else {
10941
10942
  if (q.length > ee)
10942
10943
  throw new Error(`INPUT_ERROR: Individual entity parentFilter with singleQuery set to true must not have more than ${x.singleQuery} entities`);
10943
- A.push(ye(`${M.name}_Array`, "array-contains-any", q));
10944
+ C.push(ye(`${P.name}_Array`, "array-contains-any", q));
10944
10945
  }
10945
10946
  }
10946
10947
  }
@@ -10951,21 +10952,21 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
10951
10952
  if ("collectionField" in w) {
10952
10953
  const O = re(u, w.collectionField);
10953
10954
  if ("collection" in O) {
10954
- const x = d?.parentEntities, M = [];
10955
+ const x = d?.parentEntities, P = [];
10955
10956
  if (x) {
10956
- const D = w.singleQuery ? w.singleQuery : v;
10957
- for (let q = 0; q < x.length; q += D) {
10958
- const z = x.slice(q, q + D);
10959
- M.push(z);
10957
+ const M = w.singleQuery ? w.singleQuery : v;
10958
+ for (let q = 0; q < x.length; q += M) {
10959
+ const z = x.slice(q, q + M);
10960
+ P.push(z);
10960
10961
  }
10961
10962
  if (!w.singleQuery)
10962
- M.forEach((q) => {
10963
- k.push(...T(A.concat(ye(`${O.name}_Array`, "array-contains-any", q))));
10963
+ P.forEach((q) => {
10964
+ k.push(...A(C.concat(ye(`${O.name}_Array`, "array-contains-any", q))));
10964
10965
  });
10965
10966
  else {
10966
- if (x && x.length > D)
10967
+ if (x && x.length > M)
10967
10968
  throw new Error(`INPUT_ERROR: Parent entity restriction with singleQuery set to true must not have more than ${w.singleQuery} entities`);
10968
- A.push(ye(`${O.name}_Array`, "array-contains-any", x));
10969
+ C.push(ye(`${O.name}_Array`, "array-contains-any", x));
10969
10970
  }
10970
10971
  }
10971
10972
  }
@@ -10973,26 +10974,26 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
10973
10974
  }), S.filter((w) => w.parentFilter.type === "Parent").forEach((w) => {
10974
10975
  const { parentFilter: O, parentRestriction: x } = w;
10975
10976
  if ("collectionField" in O && "parentCollectionField" in O) {
10976
- const M = re(u, O.collectionField), D = re(u, O.parentCollectionField);
10977
- if ("collection" in M && "collection" in D) {
10978
- const q = a.collections?.[M.collection];
10977
+ const P = re(u, O.collectionField), M = re(u, O.parentCollectionField);
10978
+ if ("collection" in P && "collection" in M) {
10979
+ const q = a.collections?.[P.collection];
10979
10980
  if (!q)
10980
10981
  throw new Error("PERMISSION_DENIED");
10981
10982
  const z = q.parentEntities, ee = [];
10982
10983
  if (z) {
10983
10984
  const oe = x.singleQuery ? x.singleQuery : v;
10984
- for (let F = 0; F < z.length; F += oe) {
10985
- const te = z.slice(F, F + oe);
10985
+ for (let D = 0; D < z.length; D += oe) {
10986
+ const te = z.slice(D, D + oe);
10986
10987
  ee.push(te);
10987
10988
  }
10988
10989
  if (!x.singleQuery)
10989
- ee.forEach((F) => {
10990
- k.push(...T(A.concat(ye(`${D.name}_Array`, "array-contains-any", F))));
10990
+ ee.forEach((D) => {
10991
+ k.push(...A(C.concat(ye(`${M.name}_Array`, "array-contains-any", D))));
10991
10992
  });
10992
10993
  else {
10993
10994
  if (z && z.length > oe)
10994
10995
  throw new Error(`INPUT_ERROR: Parent entity parentFilter with singleQuery set to true must not have more than ${x.singleQuery} entities`);
10995
- A.push(ye(`${D.name}_Array`, "array-contains-any", z));
10996
+ C.push(ye(`${M.name}_Array`, "array-contains-any", z));
10996
10997
  }
10997
10998
  }
10998
10999
  }
@@ -11003,8 +11004,8 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
11003
11004
  if ("collectionField" in w && "propertyField" in w) {
11004
11005
  const O = re(u, w.collectionField), x = re(u, w.propertyField);
11005
11006
  if ("collection" in O) {
11006
- const M = d?.parentPropertyEntities || {};
11007
- Object.entries(M).forEach(([D, q]) => {
11007
+ const P = d?.parentPropertyEntities || {};
11008
+ Object.entries(P).forEach(([M, q]) => {
11008
11009
  if (q.length > 0) {
11009
11010
  const z = [];
11010
11011
  for (let ee = 0; ee < q.length; ee += v) {
@@ -11012,9 +11013,9 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
11012
11013
  z.push(oe);
11013
11014
  }
11014
11015
  z.forEach((ee) => {
11015
- I.push(...T(A.concat([
11016
+ I.push(...A(C.concat([
11016
11017
  ye(`${O.name}_Array`, "array-contains-any", ee),
11017
- ye(x.name, "==", D)
11018
+ ye(x.name, "==", M)
11018
11019
  ])));
11019
11020
  });
11020
11021
  }
@@ -11024,23 +11025,23 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
11024
11025
  }), S.filter((w) => w.parentFilter.type === "Parent_Property").forEach((w) => {
11025
11026
  const { parentFilter: O } = w;
11026
11027
  if ("collectionField" in O && "parentCollectionField" in O && "parentPropertyField" in O) {
11027
- const x = re(u, O.collectionField), M = re(u, O.parentCollectionField), D = re(u, O.parentPropertyField);
11028
- if ("collection" in x && "collection" in M) {
11028
+ const x = re(u, O.collectionField), P = re(u, O.parentCollectionField), M = re(u, O.parentPropertyField);
11029
+ if ("collection" in x && "collection" in P) {
11029
11030
  const q = a.collections?.[x.collection];
11030
11031
  if (!q)
11031
11032
  throw new Error("PERMISSION_DENIED");
11032
11033
  const z = q.parentPropertyEntities || {};
11033
11034
  Object.entries(z).forEach(([ee, oe]) => {
11034
11035
  if (oe.length > 0) {
11035
- const F = [];
11036
+ const D = [];
11036
11037
  for (let te = 0; te < oe.length; te += v) {
11037
11038
  const ne = oe.slice(te, te + v);
11038
- F.push(ne);
11039
+ D.push(ne);
11039
11040
  }
11040
- F.forEach((te) => {
11041
- I.push(...T(A.concat([
11042
- ye(`${M.name}_Array`, "array-contains-any", te),
11043
- ye(D.name, "==", ee)
11041
+ D.forEach((te) => {
11042
+ I.push(...A(C.concat([
11043
+ ye(`${P.name}_Array`, "array-contains-any", te),
11044
+ ye(M.name, "==", ee)
11044
11045
  ])));
11045
11046
  });
11046
11047
  }
@@ -11048,96 +11049,98 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
11048
11049
  }
11049
11050
  }
11050
11051
  }));
11051
- const b = [...p, ...k, ...I];
11052
- return !_.length && !S.length ? T(A) : b;
11053
- }, fm = {}, Ir = {}, Zw = async (r) => {
11054
- for (const s of Object.keys(Ir))
11055
- delete Ir[s];
11052
+ const b = [...g, ...k, ...I];
11053
+ return !_.length && !S.length ? A(C) : b;
11054
+ }, fm = {}, xr = {}, Zw = async (r) => {
11055
+ for (const s of Object.keys(xr))
11056
+ delete xr[s];
11056
11057
  for (const s of Object.keys(r || {}))
11057
- Ir[s] = [], delete fm[s];
11058
+ xr[s] = [], delete fm[s];
11058
11059
  const e = await Ie(), t = await ie(e, ["global", "preload", "sync"]), n = await ie(e, ["global", "preload", "async"]);
11059
11060
  if (n)
11060
11061
  for (const s of n)
11061
- r?.[s] && Mr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
11062
+ r?.[s] && sr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
11062
11063
  if (t)
11063
11064
  for (const s of t)
11064
- r?.[s] && await Mr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
11065
+ r?.[s] && await sr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
11065
11066
  for (const s of Object.keys(r || {}))
11066
- n.includes(s) || t.includes(s) || await Mr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
11067
- return Ir;
11068
- }, To = () => fm, lw = () => Ir, uw = async (r, e, t, n) => {
11069
- const { labels: s, preloadCache: i } = r, o = Jr()[s.collection], c = Ie(), l = lt(s.collection), u = De();
11070
- if (!u?.Role)
11067
+ n.includes(s) || t.includes(s) || await sr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
11068
+ return xr;
11069
+ }, To = () => fm, lw = () => xr, uw = async (r, e, t, n, s) => {
11070
+ const { labels: i, preloadCache: a } = r, c = Jr()[i.collection], l = Ie(), u = lt(i.collection), f = De();
11071
+ if (!f?.Role)
11071
11072
  throw new Error("PERMISSION_DENIED");
11072
- if (!i?.roles.includes(u.Role))
11073
+ if (!a?.roles.includes(f.Role))
11073
11074
  return;
11074
- const f = lw();
11075
- f[s.collection] && f[s.collection].forEach((m) => m()), await ie(c, ["global", "timezone"]), e ||= await ie(l, [
11075
+ const h = lw();
11076
+ let d = i.collection;
11077
+ s && (d = s, h[d] ||= []), h[d] && h[d].forEach((y) => y()), await ie(l, ["global", "timezone"]), e ||= await ie(u, [
11076
11078
  "collections",
11077
- s.collection,
11079
+ i.collection,
11078
11080
  "custom",
11079
11081
  "preloadCacheConstraints"
11080
- ]), n ||= await ie(l, [
11082
+ ]), n ||= await ie(u, [
11081
11083
  "collections",
11082
- s.collection,
11084
+ i.collection,
11083
11085
  "custom",
11084
11086
  "preloadCacheOrQueries"
11085
- ]), t ||= i.range;
11086
- const h = oc([s.collection], o).map((m) => {
11087
+ ]), s || (t ||= a.range);
11088
+ const p = oc([i.collection], c, !!s).map((y) => {
11087
11089
  if (t) {
11088
- const { start: E, end: y } = aw(t), _ = t.fields.filter((T) => !t.ranges?.some((P) => P.includes(T))).map((T) => Xr(ye(T, ">=", E), ye(T, "<=", y))), S = t.ranges?.map((T) => Xr(ye(T[0], "<=", y), ye(T[1], ">=", E)));
11089
- m = me(m, Rc(..._, ...S || []));
11090
- }
11091
- return n && (m = me(m, Xr(Rc(...n.map((E) => ye(...E)))))), e && (m = me(m, Xr(...e.map((E) => ye(...E))))), m;
11092
- }), d = /* @__PURE__ */ new Map();
11093
- return new Promise((m, E) => {
11094
- if (h.length === 0) {
11095
- m({});
11090
+ const { start: _, end: S } = aw(t), A = t.fields.filter((m) => !t.ranges?.some((T) => T.includes(m))).map((m) => Xr(ye(m, ">=", _), ye(m, "<=", S))), F = t.ranges?.map((m) => Xr(ye(m[0], "<=", S), ye(m[1], ">=", _)));
11091
+ y = he(y, Rc(...A, ...F || []));
11092
+ }
11093
+ return n && (y = he(y, Xr(Rc(...n.map((_) => ye(..._)))))), e && (y = he(y, Xr(...e.map((_) => ye(..._))))), y;
11094
+ }), E = /* @__PURE__ */ new Map();
11095
+ return new Promise((y, _) => {
11096
+ if (p.length === 0) {
11097
+ y({});
11096
11098
  return;
11097
11099
  }
11098
- h.forEach((y) => {
11099
- let _ = !1;
11100
- const S = dr(y, { includeMetadataChanges: !0 }, (T) => {
11101
- (!T.metadata.fromCache || _) && (_ || (_ = !0, d.set(y, !0), d.size === h.length && m({})));
11102
- }, (T) => {
11103
- console.error(T), E(T);
11100
+ p.forEach((S) => {
11101
+ let A = !1;
11102
+ const F = hr(S, { includeMetadataChanges: !0 }, (m) => {
11103
+ (!m.metadata.fromCache || A) && (A || (A = !0, E.set(S, !0), E.size === p.length && y({})));
11104
+ }, (m) => {
11105
+ console.error(`${d} - ${m.message}`), _(m);
11104
11106
  });
11105
- f[s.collection].push(S);
11107
+ h[d].push(F);
11106
11108
  });
11107
11109
  });
11108
- }, Mr = async (r, e, t, n, s) => {
11109
- const i = Ve(), a = De();
11110
- if (!a?.Role)
11110
+ }, sr = async (r, e, t, n, s, i) => {
11111
+ const a = Ve(), o = De();
11112
+ if (!o?.Role)
11111
11113
  throw new Error("PERMISSION_DENIED");
11112
- const o = i.collections[r], { labels: c, preloadCache: l } = o, u = To();
11113
- if (u[c.collection] === "Loading" || !l?.roles.includes(a.Role))
11114
+ const c = a.collections[r], { labels: l, preloadCache: u } = c, f = To();
11115
+ let h = l.collection;
11116
+ if (i && (h = i), f[h] === "Loading" || !u?.roles.includes(o.Role))
11114
11117
  return;
11115
- const f = a.collections?.[r];
11116
- if (!(f && vt("Read", f) || kn(o, i, a).length > 0)) {
11117
- u[c.collection] = "Error";
11118
+ const d = o.collections?.[r];
11119
+ if (!(d && vt("Read", d) || kn(c, a, o).length > 0)) {
11120
+ f[h] = "Error";
11118
11121
  return;
11119
11122
  }
11120
- u[c.collection] = "Loading";
11121
- const h = new Event(`stoker:loading:${r}`);
11122
- document.dispatchEvent(h);
11123
+ f[h] = "Loading";
11124
+ const p = new Event(`stoker:loading:${r}`);
11125
+ document.dispatchEvent(p);
11123
11126
  try {
11124
- if (await uw(o, e, t, n), l?.relationCollections && await ve(l.relationCollections)) {
11125
- const E = jt(o, i, a);
11126
- for (const y of E)
11127
- if (!s?.[y]) {
11128
- if (!i.collections[y].preloadCache?.roles.includes(a.Role))
11127
+ if (await uw(c, e, t, n, i), u?.relationCollections && !i && await ve(u.relationCollections)) {
11128
+ const _ = jt(c, a, o);
11129
+ for (const S of _)
11130
+ if (!s?.[S]) {
11131
+ if (!a.collections[S].preloadCache?.roles.includes(o.Role))
11129
11132
  continue;
11130
- const S = To()[y];
11131
- if (S === "Loading" || S === "Loaded" || S === "Error")
11133
+ const F = To()[S];
11134
+ if (F === "Loading" || F === "Loaded" || F === "Error")
11132
11135
  continue;
11133
- S || await Mr(y, void 0, void 0, void 0, s);
11136
+ F || await sr(S, void 0, void 0, void 0, s);
11134
11137
  }
11135
11138
  }
11136
- u[c.collection] = "Loaded";
11137
- const d = new Event(`stoker:loaded:${r}`);
11138
- document.dispatchEvent(d);
11139
- } catch (d) {
11140
- throw u[c.collection] = "Error", d;
11139
+ f[h] = "Loaded";
11140
+ const E = new Event(`stoker:loaded:${r}`);
11141
+ document.dispatchEvent(E);
11142
+ } catch (E) {
11143
+ throw f[h] = "Error", E;
11141
11144
  }
11142
11145
  };
11143
11146
  let $t = null;
@@ -11147,15 +11150,15 @@ const fw = async (r, e) => {
11147
11150
  throw new Error("User document ID not found in claims");
11148
11151
  let o = !1, c = null;
11149
11152
  return await new Promise((u, f) => {
11150
- const h = dr(ke(s, "tenants", n, "system_user_permissions", r.uid), (d) => {
11153
+ const h = hr(ke(s, "tenants", n, "system_user_permissions", r.uid), (d) => {
11151
11154
  if (d.exists()) {
11152
11155
  if ($t = d.data(), $t.User_ID = d.id, !$t.Role)
11153
11156
  throw new Error("PERMISSION_DENIED");
11154
11157
  if (!o)
11155
11158
  o = !0, u();
11156
11159
  else {
11157
- const m = new Event("stoker:permissionsChange");
11158
- if (document.dispatchEvent(m), i.auth.signOutOnPermissionsChange)
11160
+ const p = new Event("stoker:permissionsChange");
11161
+ if (document.dispatchEvent(p), i.auth.signOutOnPermissionsChange)
11159
11162
  Em();
11160
11163
  else {
11161
11164
  const E = $t.collections;
@@ -11164,7 +11167,7 @@ const fw = async (r, e) => {
11164
11167
  // eslint-disable-next-line security/detect-object-injection
11165
11168
  a.collections[y] && c && // eslint-disable-next-line security/detect-object-injection
11166
11169
  (!c.collections?.[y] || // eslint-disable-next-line security/detect-object-injection
11167
- !_y(_, c.collections[y])) && Mr(y);
11170
+ !_y(_, c.collections[y])) && sr(y);
11168
11171
  }
11169
11172
  }
11170
11173
  c = $t;
@@ -11180,9 +11183,9 @@ const fw = async (r, e) => {
11180
11183
  }, cc = (r) => {
11181
11184
  if (typeof r == "object")
11182
11185
  for (const e in r)
11183
- Object.prototype.hasOwnProperty.call(r, e) && (sr(r[e]) ? r[e] = "_DELETE_FIELD" : cc(r[e]));
11186
+ Object.prototype.hasOwnProperty.call(r, e) && (ir(r[e]) ? r[e] = "_DELETE_FIELD" : cc(r[e]));
11184
11187
  }, Ye = async (r, e, t, n, s, i, a, o, c) => {
11185
- const l = Mt(), { labels: u } = i, f = Ie(), h = gc(), d = await ie(f, ["global", "firebase", "writeLogTTL"]), m = {
11188
+ const l = Mt(), { labels: u } = i, f = Ie(), h = gc(), d = await ie(f, ["global", "firebase", "writeLogTTL"]), p = {
11186
11189
  operation: r,
11187
11190
  collection: u.collection,
11188
11191
  docId: s,
@@ -11197,13 +11200,13 @@ const fw = async (r, e) => {
11197
11200
  data: {}
11198
11201
  };
11199
11202
  if (d) {
11200
- const S = /* @__PURE__ */ new Date(), T = new Date((/* @__PURE__ */ new Date()).setDate(S.getDate() + d));
11201
- m.TTL = Bt.fromDate(T);
11203
+ const S = /* @__PURE__ */ new Date(), A = new Date((/* @__PURE__ */ new Date()).setDate(S.getDate() + d));
11204
+ p.TTL = Bt.fromDate(A);
11202
11205
  }
11203
11206
  const E = we(t);
11204
- r !== "delete" && (m.data.data = E, e === "written" && cc(m.data.data)), r !== "delete" && e !== "written" && tr(E), r === "update" && (m.data.originalRecord = we(c)), r !== "delete" && ["started", "written"].includes(e) && (delete m.data.data.Saved_At, delete m.data.data.Last_Save_At), e === "failed" && (m.data.error = JSON.stringify(o));
11207
+ r !== "delete" && (p.data.data = E, e === "written" && cc(p.data.data)), r !== "delete" && e !== "written" && tr(E), r === "update" && (p.data.originalRecord = we(c)), r !== "delete" && ["started", "written"].includes(e) && (delete p.data.data.Saved_At, delete p.data.data.Last_Save_At), e === "failed" && (p.data.error = JSON.stringify(o));
11205
11208
  const y = t.Last_Write_At, _ = ke(h, "tenants", l, n.join("/"), s, "system_write_log", `${a}-${y.valueOf()}`);
11206
- Gm(_, m).catch((S) => {
11209
+ Gm(_, p).catch((S) => {
11207
11210
  console.error(`Error saving "${e}" ${r} log entry for record ${s} in ${u.collection} collection.`, { cause: S });
11208
11211
  });
11209
11212
  }, lc = async (r, e, t, n, s) => {
@@ -11212,7 +11215,7 @@ const fw = async (r, e) => {
11212
11215
  throw new Error("No role found in permissions");
11213
11216
  if (await Promise.all(c.map(async (u) => {
11214
11217
  if (!u.access || u.access.includes(s.Role)) {
11215
- if (t[u.name] === void 0 || sr(t[u.name]))
11218
+ if (t[u.name] === void 0 || ir(t[u.name]))
11216
11219
  return;
11217
11220
  const f = t[u.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
11218
11221
  if (!ow(f))
@@ -11236,8 +11239,8 @@ const fw = async (r, e) => {
11236
11239
  if (f)
11237
11240
  d.push(ke(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${t.key}`, e));
11238
11241
  else if (h)
11239
- for (const m of h)
11240
- d.push(ke(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${m.field}`, e));
11242
+ for (const p of h)
11243
+ d.push(ke(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${p.field}`, e));
11241
11244
  return d;
11242
11245
  }, yd = (r) => r !== null && typeof r == "object" && !Array.isArray(r), hm = (r) => {
11243
11246
  const e = (t) => {
@@ -11285,15 +11288,15 @@ const fw = async (r, e) => {
11285
11288
  only: i,
11286
11289
  pagination: t.limit,
11287
11290
  noEmbeddingFields: a
11288
- }).catch((m) => {
11289
- throw m.code === "permission-denied" && console.info(`PERMISSION_DENIED for subcollection ${h} for document at ${e.join("/")}`), m;
11291
+ }).catch((p) => {
11292
+ throw p.code === "permission-denied" && console.info(`PERMISSION_DENIED for subcollection ${h} for document at ${e.join("/")}`), p;
11290
11293
  });
11291
11294
  r[h] = d.docs, s && await Promise.all(
11292
11295
  // eslint-disable-next-line security/detect-object-injection
11293
- r[h].map((m) => uc(m, [...e, h, m.id], s, n, i, a))
11296
+ r[h].map((p) => uc(p, [...e, h, p.id], s, n, i, a))
11294
11297
  ), u > 0 && await Promise.all(
11295
11298
  // eslint-disable-next-line security/detect-object-injection
11296
- r[h].map((m) => mm(m, [...e, h, m.id], { depth: u }, n, s, i, a))
11299
+ r[h].map((p) => mm(p, [...e, h, p.id], { depth: u }, n, s, i, a))
11297
11300
  );
11298
11301
  });
11299
11302
  await Promise.all(f);
@@ -11310,12 +11313,12 @@ const fw = async (r, e) => {
11310
11313
  continue;
11311
11314
  const h = Object.keys(f);
11312
11315
  for (const d of h) {
11313
- const m = f[d], E = _r(m.Collection_Path, d, { only: s, noEmbeddingFields: i }).then((y) => {
11316
+ const p = f[d], E = vr(p.Collection_Path, d, { only: s, noEmbeddingFields: i }).then((y) => {
11314
11317
  if (f[d] = y, c > 0)
11315
11318
  return uc(
11316
11319
  // eslint-disable-next-line security/detect-object-injection
11317
11320
  f[d],
11318
- [...m.Collection_Path, d],
11321
+ [...p.Collection_Path, d],
11319
11322
  { depth: c },
11320
11323
  n,
11321
11324
  s,
@@ -11344,8 +11347,8 @@ const fw = async (r, e) => {
11344
11347
  const n = r.at(-1);
11345
11348
  if (!n)
11346
11349
  throw new Error("EMPTY_PATH");
11347
- const s = Ve(!0), a = Jr()[n], o = s.collections[n], { labels: c, access: l, preloadCache: u } = o, { serverReadOnly: f } = l, h = Ie(), d = Object.keys(s.collections).includes(n), m = h.disabledCollections?.includes(n);
11348
- if (!d || m)
11350
+ const s = Ve(!0), a = Jr()[n], o = s.collections[n], { labels: c, access: l, preloadCache: u } = o, { serverReadOnly: f } = l, h = Ie(), d = Object.keys(s.collections).includes(n), p = h.disabledCollections?.includes(n);
11351
+ if (!d || p)
11349
11352
  throw new Error("COLLECTION_NOT_FOUND");
11350
11353
  const E = await lt(c.collection), y = await ie(h, [
11351
11354
  "global",
@@ -11356,11 +11359,11 @@ const fw = async (r, e) => {
11356
11359
  throw new Error("PERMISSIONS_DENIED");
11357
11360
  if (f?.includes(_.Role))
11358
11361
  return await hw(r, e, t);
11359
- const S = oc(r, a, t?.getAll);
11362
+ const S = oc(r, a);
11360
11363
  if (S.length === 0)
11361
11364
  return { cursor: {}, pages: 0, docs: [] };
11362
- let T = S.map((b) => me(b, ...e || []));
11363
- const P = t?.pagination?.startAfter || t?.pagination?.endBefore || {
11365
+ let A = S.map((b) => he(b, ...e || []));
11366
+ const F = t?.pagination?.startAfter || t?.pagination?.endBefore || {
11364
11367
  first: /* @__PURE__ */ new Map(),
11365
11368
  last: /* @__PURE__ */ new Map()
11366
11369
  };
@@ -11370,28 +11373,28 @@ const fw = async (r, e) => {
11370
11373
  const b = t.pagination.startAfter || t.pagination.endBefore, w = Ud(_.Role, o, s);
11371
11374
  if (b && w !== !0)
11372
11375
  throw new Error("INPUT_ERROR: Pagination is not allowed when using " + w);
11373
- t.pagination.orderByField && t.pagination.orderByDirection ? t.pagination.startAfter || t.pagination.endBefore ? t.pagination.startAfter ? T = T.map((O, x) => me(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), eo(P.last.get(x)), Xt(t.pagination.number))) : T = T.map((O, x) => me(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), to(P.first.get(x)), Nr(t.pagination.number))) : T = T.map((O) => me(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), Xt(t.pagination.number))) : !t.pagination.startAfter && !t.pagination.endBefore ? T = T.map((O) => me(O, Xt(t.pagination.number))) : t.pagination.startAfter ? T = T.map((O, x) => me(O, eo(P.last.get(x)), Xt(t.pagination.number))) : T = T.map((O, x) => me(O, to(P.first.get(x)), Nr(t.pagination.number)));
11376
+ t.pagination.orderByField && t.pagination.orderByDirection ? t.pagination.startAfter || t.pagination.endBefore ? t.pagination.startAfter ? A = A.map((O, x) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), eo(F.last.get(x)), Xt(t.pagination.number))) : A = A.map((O, x) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), to(F.first.get(x)), Fr(t.pagination.number))) : A = A.map((O) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), Xt(t.pagination.number))) : !t.pagination.startAfter && !t.pagination.endBefore ? A = A.map((O) => he(O, Xt(t.pagination.number))) : t.pagination.startAfter ? A = A.map((O, x) => he(O, eo(F.last.get(x)), Xt(t.pagination.number))) : A = A.map((O, x) => he(O, to(F.first.get(x)), Fr(t.pagination.number)));
11374
11377
  }
11375
- const g = { collection: c.collection };
11376
- await ce("preOperation", h, E, ["read", void 0, void 0, g]), await ce("preRead", h, E, [g, T, !0, !1]);
11377
- const v = /* @__PURE__ */ new Map(), A = T.map(async (b) => {
11378
+ const m = { collection: c.collection };
11379
+ await ce("preOperation", h, E, ["read", void 0, void 0, m]), await ce("preRead", h, E, [m, A, !0, !1]);
11380
+ const v = /* @__PURE__ */ new Map(), C = A.map(async (b) => {
11378
11381
  let w;
11379
11382
  return t?.only === "cache" ? w = await Od(b) : t?.only === "server" ? w = await Hm(b) : w = await Km(b), w;
11380
- }), p = await Promise.all(A);
11381
- for (const b of p) {
11383
+ }), g = await Promise.all(C);
11384
+ for (const b of g) {
11382
11385
  for (const w of b.docs) {
11383
11386
  v.has(w.id) || v.set(w.id, {});
11384
11387
  const O = w.data({ serverTimestamps: y || "none" }), x = v.get(w.id);
11385
11388
  x.id ||= w.id;
11386
- const M = { ...x, ...O };
11387
- delete M.Collection_Path_String, v.set(w.id, M);
11389
+ const P = { ...x, ...O };
11390
+ delete P.Collection_Path_String, v.set(w.id, P);
11388
11391
  }
11389
- P.first.set(p.indexOf(b), b.docs[0]), P.last.set(p.indexOf(b), b.docs.at(-1) || b.docs[0]);
11392
+ F.first.set(g.indexOf(b), b.docs[0]), F.last.set(g.indexOf(b), b.docs.at(-1) || b.docs[0]);
11390
11393
  }
11391
11394
  let k;
11392
11395
  if (t?.pagination && !u?.roles.includes(_?.Role) && !f?.includes(_?.Role)) {
11393
- let b = me(S[0], ...e || []);
11394
- t.pagination.orderByField && t.pagination.orderByDirection && (b = me(b, rt(t.pagination.orderByField, t.pagination.orderByDirection)));
11396
+ let b = he(S[0], ...e || []);
11397
+ t.pagination.orderByField && t.pagination.orderByDirection && (b = he(b, rt(t.pagination.orderByField, t.pagination.orderByDirection)));
11395
11398
  const w = await Ed(b).catch(() => {
11396
11399
  });
11397
11400
  if (w) {
@@ -11435,10 +11438,10 @@ const fw = async (r, e) => {
11435
11438
  b[q.name] = z;
11436
11439
  })), t?.noEmbeddingFields && q.type === "Embedding" && delete b[q.name];
11437
11440
  await Promise.all(x);
11438
- const M = ["read", b, b.id, g];
11439
- await ce("postOperation", h, E, M), await ce("postRead", h, E, [g, S, b, !1]);
11441
+ const P = ["read", b, b.id, m];
11442
+ await ce("postOperation", h, E, P), await ce("postRead", h, E, [m, S, b, !1]);
11440
11443
  }
11441
- return { cursor: P, pages: k, docs: Array.from(v.values()) };
11444
+ return { cursor: F, pages: k, docs: Array.from(v.values()) };
11442
11445
  }, mw = async (r, e, t) => {
11443
11446
  const n = it(), s = ze(), i = Ue(n, s.STOKER_FB_FUNCTIONS_REGION), l = (await Je(i, "stoker-readapi")({
11444
11447
  path: r,
@@ -11482,8 +11485,8 @@ const fw = async (r, e) => {
11482
11485
  const h = r[f.name];
11483
11486
  if (!h)
11484
11487
  continue;
11485
- for (const [d, m] of Object.entries(h)) {
11486
- const E = _r(m.Collection_Path, d, {
11488
+ for (const [d, p] of Object.entries(h)) {
11489
+ const E = vr(p.Collection_Path, d, {
11487
11490
  only: s,
11488
11491
  noComputedFields: i,
11489
11492
  noEmbeddingFields: a
@@ -11492,7 +11495,7 @@ const fw = async (r, e) => {
11492
11495
  return gm(
11493
11496
  // eslint-disable-next-line security/detect-object-injection
11494
11497
  h[d],
11495
- [...m.Collection_Path, d],
11498
+ [...p.Collection_Path, d],
11496
11499
  { depth: l },
11497
11500
  n,
11498
11501
  s,
@@ -11509,7 +11512,7 @@ const fw = async (r, e) => {
11509
11512
  }
11510
11513
  }
11511
11514
  await Promise.all(u);
11512
- }, _r = async (r, e, t) => {
11515
+ }, vr = async (r, e, t) => {
11513
11516
  if (t?.subcollections?.depth && t.subcollections.depth > 10)
11514
11517
  throw new Error("INPUT_ERROR: Subcollections depth cannot exceed 10");
11515
11518
  if (t?.relations?.depth && t.relations.depth > 10)
@@ -11524,27 +11527,27 @@ const fw = async (r, e) => {
11524
11527
  "global",
11525
11528
  "firebase",
11526
11529
  "serverTimestampOptions"
11527
- ]), f = s.collections[n], { labels: h, access: d } = f, { serverReadOnly: m } = d, E = lt(h.collection), y = De();
11530
+ ]), f = s.collections[n], { labels: h, access: d } = f, { serverReadOnly: p } = d, E = lt(h.collection), y = De();
11528
11531
  if (!y?.Role)
11529
11532
  throw new Error("PERMISSIONS_DENIED");
11530
- if (m?.includes(y.Role))
11533
+ if (p?.includes(y.Role))
11531
11534
  return await mw(r, e, t);
11532
11535
  const _ = dm(r, e, a);
11533
11536
  if (_.length === 0)
11534
11537
  throw new Error("PERMISSION_DENIED");
11535
11538
  const S = { collection: h.collection };
11536
11539
  await ce("preOperation", o, E, ["read", void 0, e, S]), await ce("preRead", o, E, [S, _, !1, !1]);
11537
- let g = {};
11538
- const C = _.map(async (I) => {
11540
+ let m = {};
11541
+ const T = _.map(async (I) => {
11539
11542
  let b;
11540
11543
  if (t?.only === "cache" ? b = await Ym(I) : t?.only === "server" ? b = await Jm(I) : b = await bd(I), !b.exists())
11541
11544
  throw new Error(`NOT_FOUND: Document with ID ${e} does not exist at location ${r?.join("/") || h.collection}`);
11542
11545
  return { id: b.id, data: b.data({ serverTimestamps: u || "none" }) };
11543
- }), R = await Promise.all(C);
11546
+ }), R = await Promise.all(T);
11544
11547
  for (const I of R)
11545
- g.id ||= I.id, g = { ...g, ...I.data }, delete g.Collection_Path_String;
11546
- const v = [], A = r ? [...r, e] : [h.collection, e];
11547
- if (t?.subcollections && v.push(ym(g, A, we(t.subcollections), s, we(t?.relations), t?.only)), t?.relations && (t.relations.fields && (t.relations.fields = t.relations.fields.map((I) => {
11548
+ m.id ||= I.id, m = { ...m, ...I.data }, delete m.Collection_Path_String;
11549
+ const v = [], C = r ? [...r, e] : [h.collection, e];
11550
+ if (t?.subcollections && v.push(ym(m, C, we(t.subcollections), s, we(t?.relations), t?.only)), t?.relations && (t.relations.fields && (t.relations.fields = t.relations.fields.map((I) => {
11548
11551
  if (typeof I == "string") {
11549
11552
  const b = f.fields.find((w) => w.name === I);
11550
11553
  if (b)
@@ -11552,13 +11555,13 @@ const fw = async (r, e) => {
11552
11555
  throw new Error(`SCHEMA_ERROR: Field ${I} not found in collection ${n}`);
11553
11556
  }
11554
11557
  return I;
11555
- })), v.push(gm(g, A, we(t.relations), s, t?.only, t?.noComputedFields, t?.noEmbeddingFields))), await Promise.all(v), !t?.noComputedFields)
11558
+ })), v.push(gm(m, C, we(t.relations), s, t?.only, t?.noComputedFields, t?.noEmbeddingFields))), await Promise.all(v), !t?.noComputedFields)
11556
11559
  for (const I of f.fields)
11557
- I.type === "Computed" && (g[I.name] = await I.formula(g));
11560
+ I.type === "Computed" && (m[I.name] = await I.formula(m));
11558
11561
  if (t?.noEmbeddingFields)
11559
11562
  for (const I of f.fields)
11560
- I.type === "Embedding" && delete g[I.name];
11561
- return await ce("postOperation", o, E, ["read", g, e, S]), await ce("postRead", o, E, [S, _, g, !1]), g;
11563
+ I.type === "Embedding" && delete m[I.name];
11564
+ return await ce("postOperation", o, E, ["read", m, e, S]), await ce("postRead", o, E, [S, _, m, !1]), m;
11562
11565
  }, pw = (r) => r !== null && typeof r == "object", _m = (r) => {
11563
11566
  const e = (t) => {
11564
11567
  Object.entries(t).forEach(([n, s]) => {
@@ -11579,32 +11582,32 @@ const fw = async (r, e) => {
11579
11582
  user: n
11580
11583
  })).data?.result;
11581
11584
  }, fc = async (r, e, t, n, s, i) => {
11582
- const a = Mt(), o = Ve(), c = Ve(!0), l = yc(), u = Ie(), f = fr(), h = We(), d = De();
11585
+ const a = Mt(), o = Ve(), c = Ve(!0), l = yc(), u = Ie(), f = dr(), h = We(), d = De();
11583
11586
  if (r.length === 0)
11584
11587
  throw new Error("EMPTY_PATH");
11585
- const m = r.at(-1), E = Object.keys(o.collections).includes(m), y = u.disabledCollections?.includes(m);
11588
+ const p = r.at(-1), E = Object.keys(o.collections).includes(p), y = u.disabledCollections?.includes(p);
11586
11589
  if (!E || y)
11587
11590
  throw new Error("COLLECTION_NOT_FOUND");
11588
- const _ = o.collections[m], { labels: S, access: T, fields: P, enableWriteLog: g } = _, { serverWriteOnly: C } = T, R = lt(S.collection), v = await ie(u, ["global", "appName"]), A = s?.retry, p = f.currentUser;
11589
- if (!p)
11591
+ const _ = o.collections[p], { labels: S, access: A, fields: F, enableWriteLog: m } = _, { serverWriteOnly: T } = A, R = lt(S.collection), v = await ie(u, ["global", "appName"]), C = s?.retry, g = f.currentUser;
11592
+ if (!g)
11590
11593
  throw new Error("NOT_AUTHENTICATED");
11591
11594
  if (!d)
11592
11595
  throw new Error("PERMISSION_DENIED");
11593
11596
  if (bm(e))
11594
11597
  throw new Error("RECORD_BUSY");
11595
- i = A?.originalRecord || i || await _r(r, e, { noComputedFields: !0, noEmbeddingFields: !0 });
11596
- for (const F of c.collections[m].fields)
11597
- F.type === "Computed" && (delete t[F.name], delete i[F.name]);
11598
+ i = C?.originalRecord || i || await vr(r, e, { noComputedFields: !0, noEmbeddingFields: !0 });
11599
+ for (const D of c.collections[p].fields)
11600
+ D.type === "Computed" && (delete t[D.name], delete i[D.name]);
11598
11601
  const k = Ao(h), I = { collection: S.collection }, b = _.auth && n?.operation === "create", w = _.auth && n?.operation === "delete", O = _.auth && !b && !w && (n?.operation === "update" || t.Role || t.Enabled !== void 0 || t.Name || t.Email || t.Photo_URL), x = await ie(R, [
11599
11602
  "collections",
11600
11603
  S.collection,
11601
11604
  "custom",
11602
11605
  "disableOfflineUpdate"
11603
- ]), M = () => {
11604
- if (zt() === "Offline" && (x || C || _.auth && (b || O || w)))
11606
+ ]), P = () => {
11607
+ if (zt() === "Offline" && (x || T || _.auth && (b || O || w)))
11605
11608
  throw new Error("CLIENT_OFFLINE");
11606
11609
  };
11607
- if (M(), C || b || O || w) {
11610
+ if (P(), T || b || O || w) {
11608
11611
  if (b) {
11609
11612
  if (!n.password)
11610
11613
  throw new Error("VALIDATION_ERROR: Password is required");
@@ -11613,7 +11616,7 @@ const fw = async (r, e) => {
11613
11616
  if (n.password !== n.passwordConfirm)
11614
11617
  throw new Error("VALIDATION_ERROR: Passwords do not match");
11615
11618
  if (!await ie(u, ["global", "firebase", "enableEmulators"])) {
11616
- M();
11619
+ P();
11617
11620
  try {
11618
11621
  const { isValid: Me } = await _d(f, n.password);
11619
11622
  if (!Me)
@@ -11623,86 +11626,86 @@ const fw = async (r, e) => {
11623
11626
  }
11624
11627
  }
11625
11628
  }
11626
- const F = [
11629
+ const D = [
11627
11630
  "update",
11628
11631
  { ...i, ...t },
11629
11632
  I,
11630
11633
  k,
11631
11634
  we(i)
11632
11635
  ];
11633
- return await ce("preValidate", u, R, F), await yw(r, e, t, n ? { operation: n.operation, permissions: n.permissions, password: n.password } : void 0);
11636
+ return await ce("preValidate", u, R, D), await yw(r, e, t, n ? { operation: n.operation, permissions: n.permissions, password: n.password } : void 0);
11634
11637
  }
11635
11638
  delete t.id;
11636
- const D = Ko("update", r, t, o, v, zt(), p.uid, Bt.now(), Lr(), !!A);
11637
- for (const F of P)
11638
- !_e(F) && sr(D[F.name]) && F.nullable && (D[F.name] = null);
11639
- if (Nt(D), Nt(i), !A && g && Ye("update", "started", D, r, e, _, p.uid, void 0, i), !A) {
11640
- const F = [
11639
+ const M = Ko("update", r, t, o, v, zt(), g.uid, Bt.now(), Lr(), !!C);
11640
+ for (const D of F)
11641
+ !_e(D) && ir(M[D.name]) && D.nullable && (M[D.name] = null);
11642
+ if (Nt(M), Nt(i), !C && m && Ye("update", "started", M, r, e, _, g.uid, void 0, i), !C) {
11643
+ const D = [
11641
11644
  "update",
11642
- D,
11645
+ M,
11643
11646
  e,
11644
11647
  I,
11645
11648
  k,
11646
11649
  we(i)
11647
11650
  ];
11648
- await ce("preOperation", u, R, F);
11649
- const te = ["update", D, e, I, k, we(i)];
11651
+ await ce("preOperation", u, R, D);
11652
+ const te = ["update", M, e, I, k, we(i)];
11650
11653
  await ce("preWrite", u, R, te);
11651
11654
  }
11652
- if (Xd(_, D, o), eh(_, D), !A)
11655
+ if (Xd(_, M, o), eh(_, M), !C)
11653
11656
  try {
11654
- const F = { ...i, ...D };
11655
- tr(F), await om("update", F, _, R, ["update", F, I, k, we(i)], o), x && (M(), await lc("update", e, D, _, d));
11656
- } catch (F) {
11657
- throw new Error(`VALIDATION_ERROR: ${F.message}`);
11657
+ const D = { ...i, ...M };
11658
+ tr(D), await om("update", D, _, R, ["update", D, I, k, we(i)], o), x && (P(), await lc("update", e, M, _, d));
11659
+ } catch (D) {
11660
+ throw new Error(`VALIDATION_ERROR: ${D.message}`);
11658
11661
  }
11659
- if (Oy(D, i, e, _, o, p.uid, d), Nt(D), ac("update", k, r, e, D, o, _, s, l, Io, ko, Cn, (F) => ke(h, "tenants", a, "system_fields", S.collection, `${S.collection}-${F.name}`, e), (F, te) => ke(h, "tenants", a, "system_unique", S.collection, `Unique-${S.collection}-${F.name}`, te), (F) => ke(h, "tenants", a, "system_fields", S.collection, `${S.collection}-${F}`, e)), k.update(ke(h, "tenants", a, r.join("/"), e), D), !A && g && Ye("update", "written", D, r, e, _, p.uid, void 0, i), await dc("update", r, e, D, I, _, R, k, p.uid, g || !1, d, !!A, i), A?.type === "unique") {
11660
- const F = { ...i, ...D };
11661
- return tr(F), { id: e, ...F };
11662
+ if (Oy(M, i, e, _, o, g.uid, d), Nt(M), ac("update", k, r, e, M, o, _, s, l, Io, ko, Cn, (D) => ke(h, "tenants", a, "system_fields", S.collection, `${S.collection}-${D.name}`, e), (D, te) => ke(h, "tenants", a, "system_unique", S.collection, `Unique-${S.collection}-${D.name}`, te), (D) => ke(h, "tenants", a, "system_fields", S.collection, `${S.collection}-${D}`, e)), k.update(ke(h, "tenants", a, r.join("/"), e), M), !C && m && Ye("update", "written", M, r, e, _, g.uid, void 0, i), await dc("update", r, e, M, I, _, R, k, g.uid, m || !1, d, !!C, i), C?.type === "unique") {
11663
+ const D = { ...i, ...M };
11664
+ return tr(D), { id: e, ...D };
11662
11665
  }
11663
- g && Ye("update", "success", D, r, e, _, p.uid, void 0, i);
11664
- const q = ["update", D, e, I, !!A, we(i)], z = [...q];
11666
+ m && Ye("update", "success", M, r, e, _, g.uid, void 0, i);
11667
+ const q = ["update", M, e, I, !!C, we(i)], z = [...q];
11665
11668
  await ce("postWrite", u, R, q), await ce("postOperation", u, R, z);
11666
- const ee = { ...i, ...D };
11669
+ const ee = { ...i, ...M };
11667
11670
  return tr(ee), { id: e, ...ee };
11668
11671
  }, dc = async (r, e, t, n, s, i, a, o, c, l, u, f, h) => {
11669
- const d = Ve(), m = Ie(), { labels: E } = i;
11672
+ const d = Ve(), p = Ie(), { labels: E } = i;
11670
11673
  let y = 0;
11671
11674
  const _ = async () => {
11672
11675
  try {
11673
11676
  await we(o).commit();
11674
11677
  return;
11675
11678
  } catch (S) {
11676
- let T;
11677
- const P = await ie(a, [
11679
+ let A;
11680
+ const F = await ie(a, [
11678
11681
  "collections",
11679
11682
  E.collection,
11680
11683
  "custom",
11681
11684
  "autoCorrectUnique"
11682
11685
  ]);
11683
- if (S.code === "unavailable" && await ve(m.onIndexedDBConnectionLost), r !== "delete" && S.code === "permission-denied")
11686
+ if (S.code === "unavailable" && await ve(p.onIndexedDBConnectionLost), r !== "delete" && S.code === "permission-denied")
11684
11687
  try {
11685
11688
  await lc(r, t, n, i, u);
11686
- } catch (A) {
11687
- const p = A.message.split(", "), k = [], I = [];
11689
+ } catch (C) {
11690
+ const g = C.message.split(", "), k = [], I = [];
11688
11691
  let b = !1;
11689
- for (const w of p) {
11690
- const O = w.split(" ")[0], x = d.collections[E.collection].fields.find((M) => M.name === O);
11692
+ for (const w of g) {
11693
+ const O = w.split(" ")[0], x = d.collections[E.collection].fields.find((P) => P.name === O);
11691
11694
  if (!x)
11692
11695
  throw new Error(`SCHEMA_ERROR: Field ${O} not found in ${E.collection} schema`);
11693
11696
  x.type === "Number" && k.push(w), x.type === "String" && I.push(w);
11694
11697
  }
11695
- if ((!P || k.length > 0) && (T = new Error(`VALIDATION_ERROR: ${p.join(", ")}`)), P && I.length > 0) {
11698
+ if ((!F || k.length > 0) && (A = new Error(`VALIDATION_ERROR: ${g.join(", ")}`)), F && I.length > 0) {
11696
11699
  for (const w of I) {
11697
11700
  const O = w.split(" ")[0];
11698
- if (d.collections[E.collection].fields.find((D) => D.name === O).type === "Number")
11701
+ if (d.collections[E.collection].fields.find((M) => M.name === O).type === "Number")
11699
11702
  continue;
11700
- let M = 1;
11701
- n[O].match(/ - DUPLICATE-\d+/) ? (M = parseInt(
11703
+ let P = 1;
11704
+ n[O].match(/ - DUPLICATE-\d+/) ? (P = parseInt(
11702
11705
  // eslint-disable-next-line security/detect-object-injection
11703
11706
  n[O].match(/ - DUPLICATE-\d+/)[0].split("-")[2]
11704
11707
  ), n[O] = // eslint-disable-next-line security/detect-object-injection
11705
- n[O].replace(/ - DUPLICATE-\d+/g, "") + ` - DUPLICATE-${M + 1}`) : n[O] = n[O] + " - DUPLICATE-1", M < 10 ? b = !0 : T = new Error(p.map((D) => D.replace(/ - DUPLICATE-\d+/g, "")).join(", "));
11708
+ n[O].replace(/ - DUPLICATE-\d+/g, "") + ` - DUPLICATE-${P + 1}`) : n[O] = n[O] + " - DUPLICATE-1", P < 10 ? b = !0 : A = new Error(g.map((M) => M.replace(/ - DUPLICATE-\d+/g, "")).join(", "));
11706
11709
  }
11707
11710
  if (b) {
11708
11711
  r === "create" && await vm(e, n, void 0, { retry: { type: "unique", docId: t } }), r === "update" && await fc(e, t, n, void 0, {
@@ -11716,17 +11719,17 @@ const fw = async (r, e) => {
11716
11719
  }
11717
11720
  }
11718
11721
  }
11719
- const g = T || S, C = [
11722
+ const m = A || S, T = [
11720
11723
  r,
11721
11724
  n,
11722
11725
  t,
11723
11726
  s,
11724
- g,
11727
+ m,
11725
11728
  o,
11726
11729
  f,
11727
11730
  y,
11728
11731
  r === "update" ? h : void 0
11729
- ], R = S.code === "unavailable", v = await ce("postWriteError", m, a, C);
11732
+ ], R = S.code === "unavailable", v = await ce("postWriteError", p, a, T);
11730
11733
  if (v?.resolved)
11731
11734
  return;
11732
11735
  if (!R && v?.retry) {
@@ -11741,11 +11744,11 @@ const fw = async (r, e) => {
11741
11744
  t,
11742
11745
  i,
11743
11746
  c,
11744
- g,
11747
+ m,
11745
11748
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11746
11749
  r === "update" ? h : void 0
11747
11750
  );
11748
- throw g;
11751
+ throw m;
11749
11752
  }
11750
11753
  };
11751
11754
  await _();
@@ -11759,29 +11762,29 @@ const fw = async (r, e) => {
11759
11762
  id: n
11760
11763
  })).data?.result;
11761
11764
  }, vm = async (r, e, t, n, s, i) => {
11762
- const a = Mt(), o = Ve(), c = yc(), l = Ie(), u = fr(), f = We(), h = De();
11765
+ const a = Mt(), o = Ve(), c = yc(), l = Ie(), u = dr(), f = We(), h = De();
11763
11766
  if (r.length === 0)
11764
11767
  throw new Error("EMPTY_PATH");
11765
- const d = r.at(-1), m = Object.keys(o.collections).includes(d), E = l.disabledCollections?.includes(d);
11766
- if (!m || E)
11768
+ const d = r.at(-1), p = Object.keys(o.collections).includes(d), E = l.disabledCollections?.includes(d);
11769
+ if (!p || E)
11767
11770
  throw new Error("COLLECTION_NOT_FOUND");
11768
- const y = o.collections[d], { labels: _, access: S, enableWriteLog: T, softDelete: P } = y, { serverWriteOnly: g } = S, C = lt(_.collection), R = await ie(l, ["global", "appName"]), v = n?.retry, A = u.currentUser;
11769
- if (!A)
11771
+ const y = o.collections[d], { labels: _, access: S, enableWriteLog: A, softDelete: F } = y, { serverWriteOnly: m } = S, T = lt(_.collection), R = await ie(l, ["global", "appName"]), v = n?.retry, C = u.currentUser;
11772
+ if (!C)
11770
11773
  throw new Error("NOT_AUTHENTICATED");
11771
11774
  if (!h)
11772
11775
  throw new Error("PERMISSION_DENIED");
11773
- const p = await ie(C, [
11776
+ const g = await ie(T, [
11774
11777
  "collections",
11775
11778
  _.collection,
11776
11779
  "custom",
11777
11780
  "disableOfflineCreate"
11778
11781
  ]), k = () => {
11779
- if (zt() === "Offline" && (p || g || y.auth && t))
11782
+ if (zt() === "Offline" && (g || m || y.auth && t))
11780
11783
  throw new Error("CLIENT_OFFLINE");
11781
11784
  };
11782
11785
  k();
11783
11786
  const I = Ao(f), b = v?.docId || s || ke(qr(f, "tenants", a, _.collection)).id, w = { collection: _.collection };
11784
- if (g || y.auth && t) {
11787
+ if (m || y.auth && t) {
11785
11788
  if (k(), y.auth && t) {
11786
11789
  if (!t.password)
11787
11790
  throw new Error("VALIDATION_ERROR: Password is required");
@@ -11800,21 +11803,21 @@ const fw = async (r, e) => {
11800
11803
  }
11801
11804
  }
11802
11805
  }
11803
- return await ce("preValidate", l, C, ["create", e, w, I]), i && i(), await gw(r, e, t ? { permissions: t.permissions, password: t.password } : void 0, b);
11806
+ return await ce("preValidate", l, T, ["create", e, w, I]), i && i(), await gw(r, e, t ? { permissions: t.permissions, password: t.password } : void 0, b);
11804
11807
  }
11805
11808
  e.id = b;
11806
- const O = Ko("create", r, e, o, R, zt(), A.uid, Bt.now(), Lr(), !!v);
11807
- if (P && (O[P.archivedField] = !1), Nt(O), !v && T && Ye("create", "started", O, r, b, y, A.uid), v || (await ce("preOperation", l, C, ["create", O, b, w, I]), await ce("preWrite", l, C, ["create", O, b, w, I])), Xd(y, O, o), eh(y, O), v || await hg(O, y, C, h.Role), !v)
11809
+ const O = Ko("create", r, e, o, R, zt(), C.uid, Bt.now(), Lr(), !!v);
11810
+ if (F && (O[F.archivedField] = !1), Nt(O), !v && A && Ye("create", "started", O, r, b, y, C.uid), v || (await ce("preOperation", l, T, ["create", O, b, w, I]), await ce("preWrite", l, T, ["create", O, b, w, I])), Xd(y, O, o), eh(y, O), v || await hg(O, y, T, h.Role), !v)
11808
11811
  try {
11809
- await om("create", O, y, C, ["create", O, w, I], o), p && (k(), await lc("create", b, O, y, h));
11812
+ await om("create", O, y, T, ["create", O, w, I], o), g && (k(), await lc("create", b, O, y, h));
11810
11813
  } catch (q) {
11811
11814
  throw new Error(`VALIDATION_ERROR: ${q.message}`);
11812
11815
  }
11813
- if (i && i(), Nt(O), by(O, b, y, o, A.uid, h), ac("create", I, r, b, O, o, y, n, c, Io, ko, Cn, (q) => ke(f, "tenants", a, "system_fields", _.collection, `${_.collection}-${q.name}`, b), (q, z) => ke(f, "tenants", a, "system_unique", _.collection, `Unique-${_.collection}-${q.name}`, z), (q) => ke(f, "tenants", a, "system_fields", _.collection, `${_.collection}-${q}`, b)), I.set(ke(f, "tenants", a, r.join("/"), b), O), !v && T && Ye("create", "written", O, r, b, y, A.uid), await dc("create", r, b, O, w, y, C, I, A.uid, T || !1, h, !!v), v?.type === "unique")
11816
+ if (i && i(), Nt(O), by(O, b, y, o, C.uid, h), ac("create", I, r, b, O, o, y, n, c, Io, ko, Cn, (q) => ke(f, "tenants", a, "system_fields", _.collection, `${_.collection}-${q.name}`, b), (q, z) => ke(f, "tenants", a, "system_unique", _.collection, `Unique-${_.collection}-${q.name}`, z), (q) => ke(f, "tenants", a, "system_fields", _.collection, `${_.collection}-${q}`, b)), I.set(ke(f, "tenants", a, r.join("/"), b), O), !v && A && Ye("create", "written", O, r, b, y, C.uid), await dc("create", r, b, O, w, y, T, I, C.uid, A || !1, h, !!v), v?.type === "unique")
11814
11817
  return { id: b, ...O };
11815
- T && Ye("create", "success", O, r, b, y, A.uid);
11816
- const x = ["create", O, b, w, !!v], M = [...x];
11817
- return await ce("postWrite", l, C, x), await ce("postOperation", l, C, M), { id: b, ...O };
11818
+ A && Ye("create", "success", O, r, b, y, C.uid);
11819
+ const x = ["create", O, b, w, !!v], P = [...x];
11820
+ return await ce("postWrite", l, T, x), await ce("postOperation", l, T, P), { id: b, ...O };
11818
11821
  }, _w = async (r, e) => {
11819
11822
  const t = it(), n = ze(), s = Ue(t, n.STOKER_FB_FUNCTIONS_REGION);
11820
11823
  return (await Je(s, "stoker-writeapi", { timeout: 540 * 1e3 })({
@@ -11823,14 +11826,14 @@ const fw = async (r, e) => {
11823
11826
  id: e
11824
11827
  })).data?.result;
11825
11828
  }, vw = async (r, e, t) => {
11826
- const n = Mt(), s = Ve(), i = yc(), a = fr(), o = We(), c = Ie(), l = De();
11829
+ const n = Mt(), s = Ve(), i = yc(), a = dr(), o = We(), c = Ie(), l = De();
11827
11830
  if (r.length === 0)
11828
11831
  throw new Error("EMPTY_PATH");
11829
11832
  const u = r.at(-1), f = Object.keys(s.collections).includes(u), h = c.disabledCollections?.includes(u);
11830
11833
  if (!f || h)
11831
11834
  throw new Error("COLLECTION_NOT_FOUND");
11832
- const d = s.collections[u], { labels: m, access: E, enableWriteLog: y, softDelete: _ } = d, { serverWriteOnly: S } = E, T = lt(m.collection), P = await ie(c, ["global", "appName"]), g = t?.retry, C = a.currentUser;
11833
- if (!C)
11835
+ const d = s.collections[u], { labels: p, access: E, enableWriteLog: y, softDelete: _ } = d, { serverWriteOnly: S } = E, A = lt(p.collection), F = await ie(c, ["global", "appName"]), m = t?.retry, T = a.currentUser;
11836
+ if (!T)
11834
11837
  throw new Error("NOT_AUTHENTICATED");
11835
11838
  if (!l)
11836
11839
  throw new Error("PERMISSION_DENIED");
@@ -11839,9 +11842,9 @@ const fw = async (r, e) => {
11839
11842
  [_.archivedField]: !0,
11840
11843
  [_.timestampField]: Lr()
11841
11844
  });
11842
- const R = await ie(T, [
11845
+ const R = await ie(A, [
11843
11846
  "collections",
11844
- m.collection,
11847
+ p.collection,
11845
11848
  "custom",
11846
11849
  "disableOfflineDelete"
11847
11850
  ]);
@@ -11850,19 +11853,19 @@ const fw = async (r, e) => {
11850
11853
  throw new Error("CLIENT_OFFLINE");
11851
11854
  })(), bm(e))
11852
11855
  throw new Error("RECORD_BUSY");
11853
- let A;
11856
+ let C;
11854
11857
  try {
11855
- A = await _r(r, e);
11856
- } catch (M) {
11857
- throw y && g?.record && M.message.indexOf("NOT_FOUND") !== -1 && await Ye("delete", "failed", g?.record, r, e, d, C.uid, M), M;
11858
+ C = await vr(r, e);
11859
+ } catch (P) {
11860
+ throw y && m?.record && P.message.indexOf("NOT_FOUND") !== -1 && await Ye("delete", "failed", m?.record, r, e, d, T.uid, P), P;
11858
11861
  }
11859
- if (S || d.auth && A.User_ID)
11862
+ if (S || d.auth && C.User_ID)
11860
11863
  return await _w(r, e);
11861
- delete A.id;
11862
- const p = Ao(o), k = { collection: m.collection }, I = Ko("delete", r, A, s, P, zt(), C.uid, Bt.now(), Lr(), !!g);
11863
- Nt(I), !g && y && Ye("delete", "started", I, r, e, d, C.uid), g || (await ce("preOperation", c, T, ["delete", I, e, k, p]), await ce("preWrite", c, T, ["delete", I, e, k, p])), Nt(I), Ey(I, e, d, s, C.uid, l), ac("delete", p, r, e, I, s, d, t, i, Io, ko, Cn, (M) => ke(o, "tenants", n, "system_fields", m.collection, `${m.collection}-${M.name}`, e), (M, D) => ke(o, "tenants", n, "system_unique", m.collection, `Unique-${m.collection}-${M.name}`, D), (M) => ke(o, "tenants", n, "system_fields", m.collection, `${m.collection}-${M}`, e)), p.delete(ke(o, "tenants", n, r.join("/"), e)), !g && y && Ye("delete", "written", I, r, e, d, C.uid), await dc("delete", r, e, I, k, d, T, p, C.uid, y || !1, l, !!g), y && Ye("delete", "success", { ...I, ...g?.record || {} }, r, e, d, C.uid);
11864
- const w = ["delete", I, e, k, !!g], O = [...w];
11865
- return await ce("postWrite", c, T, w), await ce("postOperation", c, T, O), { id: e, ...I };
11864
+ delete C.id;
11865
+ const g = Ao(o), k = { collection: p.collection }, I = Ko("delete", r, C, s, F, zt(), T.uid, Bt.now(), Lr(), !!m);
11866
+ Nt(I), !m && y && Ye("delete", "started", I, r, e, d, T.uid), m || (await ce("preOperation", c, A, ["delete", I, e, k, g]), await ce("preWrite", c, A, ["delete", I, e, k, g])), Nt(I), Ey(I, e, d, s, T.uid, l), ac("delete", g, r, e, I, s, d, t, i, Io, ko, Cn, (P) => ke(o, "tenants", n, "system_fields", p.collection, `${p.collection}-${P.name}`, e), (P, M) => ke(o, "tenants", n, "system_unique", p.collection, `Unique-${p.collection}-${P.name}`, M), (P) => ke(o, "tenants", n, "system_fields", p.collection, `${p.collection}-${P}`, e)), g.delete(ke(o, "tenants", n, r.join("/"), e)), !m && y && Ye("delete", "written", I, r, e, d, T.uid), await dc("delete", r, e, I, k, d, A, g, T.uid, y || !1, l, !!m), y && Ye("delete", "success", { ...I, ...m?.record || {} }, r, e, d, T.uid);
11867
+ const w = ["delete", I, e, k, !!m], O = [...w];
11868
+ return await ce("postWrite", c, A, w), await ce("postOperation", c, A, O), { id: e, ...I };
11866
11869
  }, wm = (r) => {
11867
11870
  if (typeof r == "object")
11868
11871
  for (const e in r)
@@ -11873,16 +11876,16 @@ const fw = async (r, e) => {
11873
11876
  };
11874
11877
  let mt = {};
11875
11878
  const bw = async (r, e) => {
11876
- const t = fr(), n = gc(), s = t.currentUser;
11879
+ const t = dr(), n = gc(), s = t.currentUser;
11877
11880
  if (s?.uid !== e.uid)
11878
11881
  return;
11879
- const i = await Od(me(Qm(n, "system_write_log"), ye("status", "==", "written"), ye("user", "==", e.uid), rt("Last_Write_At", "asc")));
11882
+ const i = await Od(he(Qm(n, "system_write_log"), ye("status", "==", "written"), ye("user", "==", e.uid), rt("Last_Write_At", "asc")));
11880
11883
  await new Promise((o) => setTimeout(o, 1e4));
11881
11884
  const a = Om();
11882
11885
  if (a?.version)
11883
11886
  for (const o of i.docs) {
11884
11887
  mt[o.id] ??= 0;
11885
- const c = o.data(), { data: l, operation: u, docId: f, collection: h, Collection_Path: d, Last_Write_Version: m } = c;
11888
+ const c = o.data(), { data: l, operation: u, docId: f, collection: h, Collection_Path: d, Last_Write_Version: p } = c;
11886
11889
  await new Promise((_) => setTimeout(_, 1e3));
11887
11890
  const E = await ww("stoker-writelog", {
11888
11891
  path: d,
@@ -11893,7 +11896,7 @@ const bw = async (r, e) => {
11893
11896
  continue;
11894
11897
  if (s?.uid !== e.uid)
11895
11898
  return;
11896
- if (a.force && m !== a.version) {
11899
+ if (a.force && p !== a.version) {
11897
11900
  Ye(
11898
11901
  u,
11899
11902
  "failed",
@@ -11904,7 +11907,7 @@ const bw = async (r, e) => {
11904
11907
  // eslint-disable-next-line security/detect-object-injection
11905
11908
  r.collections[h],
11906
11909
  e.uid,
11907
- `Version mismatch- write log version ${m} not compatible with forced version ${a.version}`,
11910
+ `Version mismatch- write log version ${p} not compatible with forced version ${a.version}`,
11908
11911
  u === "update" ? l.originalRecord : void 0
11909
11912
  );
11910
11913
  continue;
@@ -11925,8 +11928,8 @@ const bw = async (r, e) => {
11925
11928
  type: "offline",
11926
11929
  originalRecord: l.originalRecord
11927
11930
  }
11928
- }).catch((T) => {
11929
- console.error(T);
11931
+ }).catch((A) => {
11932
+ console.error(A);
11930
11933
  }), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done");
11931
11934
  }
11932
11935
  u === "delete" && (mt[f]++, await vw(d, f, {
@@ -11951,7 +11954,7 @@ const bw = async (r, e) => {
11951
11954
  let fn, Ka = 0;
11952
11955
  const Ew = async () => {
11953
11956
  const r = Am(), e = Ie();
11954
- return dr(ke(r, "system_deployment", "latest_deploy"), (n) => {
11957
+ return hr(ke(r, "system_deployment", "latest_deploy"), (n) => {
11955
11958
  if (n.exists())
11956
11959
  fn = n.data(), Ka++, Ka > 1 && (fn.refresh ? window.location.reload() : ve(e.onVersionUpdate, [fn, Ka]));
11957
11960
  else
@@ -11963,7 +11966,7 @@ const Ew = async () => {
11963
11966
  let Ro;
11964
11967
  const Sw = async () => {
11965
11968
  const r = Ie(), e = Am();
11966
- dr(ke(e, "system_deployment", "maintenance_mode"), (t) => {
11969
+ hr(ke(e, "system_deployment", "maintenance_mode"), (t) => {
11967
11970
  if (t.exists())
11968
11971
  Ro = t.data(), ve(r.onMaintenanceUpdate, [Ro.active ? "on" : "off"]);
11969
11972
  else
@@ -11972,17 +11975,17 @@ const Sw = async () => {
11972
11975
  throw new Error("Error getting maintenance status", { cause: t.message });
11973
11976
  });
11974
11977
  }, Tw = () => Ro;
11975
- let xr, Or = null;
11978
+ let Nr, Er = null;
11976
11979
  const Rw = () => {
11977
11980
  const r = wd(), e = Ie();
11978
11981
  let t = !1;
11979
11982
  return zm(Bm(r, ".info/connected"), (s) => {
11980
- s.val() === !0 ? (Or && (clearTimeout(Or), Or = null), xr = "Online", ve(e.onConnectionStatusChange, [xr, !t]), t || (t = !0)) : !Or && t && (Or = setTimeout(() => {
11981
- xr = "Offline", ve(e.onConnectionStatusChange, [xr]);
11983
+ s.val() === !0 ? (Er && (clearTimeout(Er), Er = null), Nr = "Online", ve(e.onConnectionStatusChange, [Nr, !t]), t || (t = !0)) : !Er && t && (Er = setTimeout(() => {
11984
+ Nr = "Offline", ve(e.onConnectionStatusChange, [Nr]);
11982
11985
  }, 5e3));
11983
11986
  });
11984
- }, zt = () => xr, Cw = () => navigator.onLine ? "Online" : "Offline", Em = async () => {
11985
- const r = Ie(), e = fr(), t = e.currentUser;
11987
+ }, zt = () => Nr, Cw = () => navigator.onLine ? "Online" : "Offline", Em = async () => {
11988
+ const r = Ie(), e = dr(), t = e.currentUser;
11986
11989
  if (r.preLogout && await ve(r.preLogout, [t]) === !1)
11987
11990
  throw new Error("Operation cancelled by preLogout");
11988
11991
  try {
@@ -12094,18 +12097,18 @@ const Gw = async (r, e, t, n) => {
12094
12097
  const a = dp(dt);
12095
12098
  Tt === "development" && (a.instrumentationEnabled = !1, a.dataCollectionEnabled = !1);
12096
12099
  const o = ["firestoreWrite"];
12097
- for (const p of o)
12098
- Ya[`${p}App`] = zn(s, p);
12100
+ for (const g of o)
12101
+ Ya[`${g}App`] = zn(s, g);
12099
12102
  const { firestoreWriteApp: c } = Ya, l = zn(s, "maintenance");
12100
12103
  Ge.maintenance = We(l);
12101
12104
  const u = hp();
12102
12105
  if (u.settings.minimumFetchIntervalMillis = 36e5, await mp(u), be.STOKER_FB_ENABLE_APP_CHECK === "true" && be.STOKER_FB_APP_CHECK_KEY) {
12103
12106
  (Tt === "development" || window.location.hostname === "localhost") && (globalThis.FIREBASE_APPCHECK_DEBUG_TOKEN = !0);
12104
- const p = {
12107
+ const g = {
12105
12108
  provider: new fp(be.STOKER_FB_APP_CHECK_KEY),
12106
12109
  isTokenAutoRefreshEnabled: !0
12107
12110
  };
12108
- At.main = Gn(dt, p), At.firestoreWrite = Gn(c, p), At.maintenance = Gn(l, p);
12111
+ At.main = Gn(dt, g), At.firestoreWrite = Gn(c, g), At.maintenance = Gn(l, g);
12109
12112
  let k = !1;
12110
12113
  const I = (b, w) => {
12111
12114
  if (console.log(`App Check token error detected for ${w}`), !k)
@@ -12133,7 +12136,7 @@ const Gw = async (r, e, t, n) => {
12133
12136
  "global",
12134
12137
  "firebase",
12135
12138
  "analyticsConsentSettings"
12136
- ]), m = await ie(pe, [
12139
+ ]), p = await ie(pe, [
12137
12140
  "global",
12138
12141
  "firebase",
12139
12142
  "enableEmulators"
@@ -12147,24 +12150,24 @@ const Gw = async (r, e, t, n) => {
12147
12150
  "firebase",
12148
12151
  "logLevel",
12149
12152
  "prod"
12150
- ]), S = await Fm().catch((p) => {
12151
- throw new Error("Error checking analytics support.", { cause: p });
12153
+ ]), S = await Fm().catch((g) => {
12154
+ throw new Error("Error checking analytics support.", { cause: g });
12152
12155
  });
12153
12156
  Tt === "production" && f && S && Dm(dt, h || {}), d && Mm(d);
12154
- const T = await ie(pe, [
12157
+ const A = await ie(pe, [
12155
12158
  "global",
12156
12159
  "auth",
12157
12160
  "authPersistenceType"
12158
- ]), g = {
12161
+ ]), m = {
12159
12162
  popupRedirectResolver: void 0,
12160
- persistence: T === "LOCAL" ? [Pm, qm, Ec] : T === "SESSION" ? [Ec, Sc] : [Sc]
12163
+ persistence: A === "LOCAL" ? [Pm, qm, Ec] : A === "SESSION" ? [Ec, Sc] : [Sc]
12161
12164
  };
12162
- ht.main = Oc(dt, g);
12163
- for (const p of o)
12164
- ht[p] = Oc(Ya[`${p}App`], g);
12165
- const { main: C } = ht;
12166
- Lm(C, async (p) => {
12167
- if (p && await ve(pe.preLogin, [p]) === !1)
12165
+ ht.main = Oc(dt, m);
12166
+ for (const g of o)
12167
+ ht[g] = Oc(Ya[`${g}App`], m);
12168
+ const { main: T } = ht;
12169
+ Lm(T, async (g) => {
12170
+ if (g && await ve(pe.preLogin, [g]) === !1)
12168
12171
  throw new Error("Operation cancelled by preLogin");
12169
12172
  });
12170
12173
  const R = await ie(pe, [
@@ -12172,31 +12175,31 @@ const Gw = async (r, e, t, n) => {
12172
12175
  "firebase",
12173
12176
  "disableIndividualEmulators"
12174
12177
  ]);
12175
- if (Tt === "development" && m) {
12178
+ if (Tt === "development" && p) {
12176
12179
  if (!R?.includes("Auth")) {
12177
- const p = be.STOKER_FB_EMULATOR_AUTH_PORT ? parseInt(be.STOKER_FB_EMULATOR_AUTH_PORT) : 9099;
12180
+ const g = be.STOKER_FB_EMULATOR_AUTH_PORT ? parseInt(be.STOKER_FB_EMULATOR_AUTH_PORT) : 9099;
12178
12181
  for (const k of Object.values(ht))
12179
- $m(k, `http://localhost:${p}`);
12182
+ $m(k, `http://localhost:${g}`);
12180
12183
  }
12181
12184
  if (!R?.includes("Database")) {
12182
- const p = be.STOKER_FB_EMULATOR_DATABASE_PORT ? parseInt(be.STOKER_FB_EMULATOR_DATABASE_PORT) : 9e3;
12183
- Zm(wd(), "localhost", p);
12185
+ const g = be.STOKER_FB_EMULATOR_DATABASE_PORT ? parseInt(be.STOKER_FB_EMULATOR_DATABASE_PORT) : 9e3;
12186
+ Zm(wd(), "localhost", g);
12184
12187
  }
12185
12188
  if (!R?.includes("Firestore")) {
12186
- const p = be.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(be.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
12187
- Cc(Ge.maintenance, "localhost", p);
12189
+ const g = be.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(be.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
12190
+ Cc(Ge.maintenance, "localhost", g);
12188
12191
  }
12189
12192
  if (!R?.includes("Storage")) {
12190
- const p = be.STOKER_FB_EMULATOR_STORAGE_PORT ? parseInt(be.STOKER_FB_EMULATOR_STORAGE_PORT) : 9199;
12191
- cp(lp(), "localhost", p);
12193
+ const g = be.STOKER_FB_EMULATOR_STORAGE_PORT ? parseInt(be.STOKER_FB_EMULATOR_STORAGE_PORT) : 9199;
12194
+ cp(lp(), "localhost", g);
12192
12195
  }
12193
12196
  if (!R?.includes("Functions")) {
12194
- const p = be.STOKER_FB_EMULATOR_FUNCTIONS_PORT ? parseInt(be.STOKER_FB_EMULATOR_FUNCTIONS_PORT) : 5001;
12195
- up(Ue(dt, be.STOKER_FB_FUNCTIONS_REGION), "localhost", p);
12197
+ const g = be.STOKER_FB_EMULATOR_FUNCTIONS_PORT ? parseInt(be.STOKER_FB_EMULATOR_FUNCTIONS_PORT) : 5001;
12198
+ up(Ue(dt, be.STOKER_FB_FUNCTIONS_REGION), "localhost", g);
12196
12199
  }
12197
12200
  }
12198
12201
  if (Ew(), Sw(), Rw(), Tt === "development" && (y ? Qr(y) : Qr("debug")), Tt === "production" && (_ ? Qr(_) : Qr("error")), E) {
12199
- const p = Bn(C, async (k) => {
12202
+ const g = Bn(T, async (k) => {
12200
12203
  if (k) {
12201
12204
  const I = JSON.parse(be.STOKER_FB_WEB_APP_CONFIG);
12202
12205
  Nm(() => {
@@ -12204,18 +12207,18 @@ const Gw = async (r, e, t, n) => {
12204
12207
  });
12205
12208
  }
12206
12209
  });
12207
- Rn.push(p);
12210
+ Rn.push(g);
12208
12211
  }
12209
- await Promise.all(Object.values(ht).map((p) => p.authStateReady().catch((k) => {
12210
- throw new Error(`Error waiting for auth state in ${p.app.name}.`, { cause: k });
12212
+ await Promise.all(Object.values(ht).map((g) => g.authStateReady().catch((k) => {
12213
+ throw new Error(`Error waiting for auth state in ${g.app.name}.`, { cause: k });
12211
12214
  })));
12212
12215
  let v = !1;
12213
- for (const p of Object.values(ht))
12214
- p.currentUser || (v = !0);
12215
- let A;
12216
- return Bn(C, async (p) => {
12217
- if (p) {
12218
- $e = p;
12216
+ for (const g of Object.values(ht))
12217
+ g.currentUser || (v = !0);
12218
+ let C;
12219
+ return Bn(T, async (g) => {
12220
+ if (g) {
12221
+ $e = g;
12219
12222
  const k = await jm($e), { claims: I } = k;
12220
12223
  hc = I.tenant, Rm = {
12221
12224
  ...$e,
@@ -12230,9 +12233,9 @@ const Gw = async (r, e, t, n) => {
12230
12233
  G && (Ot(), Le({}));
12231
12234
  });
12232
12235
  }));
12233
- await Promise.all(b), gd || (Aw(pe), gd = !0), A = await ie(pe, ["global", "auth", "offlinePersistenceType"], [$e, I]);
12234
- const w = await ie(pe, ["global", "auth", "tabManager"], [$e, I]), O = await ie(pe, ["global", "auth", "garbageCollectionStrategy"], [$e, I]), x = await ie(pe, ["global", "auth", "maxCacheSize"], [$e, I]) || -1, M = await ie(pe, ["global", "auth", "maxWriteCacheSize"], [$e, I]);
12235
- let D;
12236
+ await Promise.all(b), gd || (Aw(pe), gd = !0), C = await ie(pe, ["global", "auth", "offlinePersistenceType"], [$e, I]);
12237
+ const w = await ie(pe, ["global", "auth", "tabManager"], [$e, I]), O = await ie(pe, ["global", "auth", "garbageCollectionStrategy"], [$e, I]), x = await ie(pe, ["global", "auth", "maxCacheSize"], [$e, I]) || -1, P = await ie(pe, ["global", "auth", "maxWriteCacheSize"], [$e, I]);
12238
+ let M;
12236
12239
  const q = {
12237
12240
  localCache: Ac({
12238
12241
  tabManager: w === "SINGLE" ? kc({ forceOwnership: !1 }) : Ic(),
@@ -12241,31 +12244,31 @@ const Gw = async (r, e, t, n) => {
12241
12244
  }, z = {
12242
12245
  localCache: Ac({
12243
12246
  tabManager: w === "SINGLE" ? kc({ forceOwnership: !1 }) : Ic(),
12244
- cacheSizeBytes: M || x
12247
+ cacheSizeBytes: P || x
12245
12248
  })
12246
12249
  };
12247
12250
  let ee;
12248
- if (O === "EAGER" ? ee = Xm() : ee = ep({ cacheSizeBytes: x }), A === "ALL" ? D = q : D = {
12251
+ if (O === "EAGER" ? ee = Xm() : ee = ep({ cacheSizeBytes: x }), C === "ALL" ? M = q : M = {
12249
12252
  localCache: tp({
12250
12253
  garbageCollector: ee
12251
12254
  })
12252
- }, Ge.main = Zn(dt, D), ["ALL", "WRITE"].includes(A) ? Ge.firestoreWrite = Zn(c, z) : Ge.firestoreWrite = Zn(c, D), Tt === "development" && m && !R?.includes("Firestore")) {
12255
+ }, Ge.main = Zn(dt, M), ["ALL", "WRITE"].includes(C) ? Ge.firestoreWrite = Zn(c, z) : Ge.firestoreWrite = Zn(c, M), Tt === "development" && p && !R?.includes("Firestore")) {
12253
12256
  const Se = be.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(be.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
12254
12257
  for (const [Le, Ot] of Object.entries(Ge))
12255
12258
  Le !== "maintenance" && Cc(Ot, "localhost", Se);
12256
12259
  }
12257
- if (A === "ALL") {
12260
+ if (C === "ALL") {
12258
12261
  const Se = rp(Ge.main);
12259
12262
  Se && np(Se);
12260
12263
  }
12261
- const F = await Je(Ue(dt, be.STOKER_FB_FUNCTIONS_REGION), "stoker-schema")().catch((Se) => {
12264
+ const D = await Je(Ue(dt, be.STOKER_FB_FUNCTIONS_REGION), "stoker-schema")().catch((Se) => {
12262
12265
  throw new Error("Error fetching schema.", { cause: Se });
12263
12266
  });
12264
- Pr = F.data.schema;
12265
- const te = Object.entries(F.data.allRoleGroups).map(([Se, Le]) => [Se, new Set(Le)]);
12266
- mc = Object.fromEntries(te), pc = F.data.currentUserRoleGroups, Tm = Sy(Object.keys(Pr.collections), e, "web", Co, n);
12267
+ Pr = D.data.schema;
12268
+ const te = Object.entries(D.data.allRoleGroups).map(([Se, Le]) => [Se, new Set(Le)]);
12269
+ mc = Object.fromEntries(te), pc = D.data.currentUserRoleGroups, Tm = Sy(Object.keys(Pr.collections), e, "web", Co, n);
12267
12270
  const ne = await fw($e, k);
12268
- Rn.push(...ne), A === "WRITE" && bw(Pr, $e), await ve(pe.postLogin, [$e]);
12271
+ Rn.push(...ne), C === "WRITE" && bw(Pr, $e), await ve(pe.postLogin, [$e]);
12269
12272
  const Me = new Event("stoker:ready");
12270
12273
  document.dispatchEvent(Me);
12271
12274
  } else if ($e) {
@@ -12284,26 +12287,26 @@ const Gw = async (r, e, t, n) => {
12284
12287
  }), console.error(`Error signing out of ${O.app.name}.`);
12285
12288
  });
12286
12289
  })), await Promise.all(Object.entries(Ge).map(async ([O, x]) => {
12287
- O !== "maintenance" && Object.keys(x).length !== 0 && await sp(x).catch((M) => {
12290
+ O !== "maintenance" && Object.keys(x).length !== 0 && await sp(x).catch((P) => {
12288
12291
  console.error(`Error terminating ${x.app.name}.`), b.error = !0, b.instances.push({
12289
12292
  instance: x.app.name,
12290
12293
  code: "TERMINATE_APP",
12291
- error: M
12294
+ error: P
12292
12295
  });
12293
12296
  });
12294
12297
  })), (await ie(pe, [
12295
12298
  "global",
12296
12299
  "auth",
12297
12300
  "clearPersistenceOnSignOut"
12298
- ]) ?? !0) && (A === "ALL" && await xc(Ge.main).catch((O) => {
12301
+ ]) ?? !0) && (C === "ALL" && await xc(Ge.main).catch((O) => {
12299
12302
  console.error('Error clearing indexedDB persistence in "[DEFAULT]".'), b.error = !0, b.instances.push({ instance: "[DEFAULT]", code: "CLEAR_CACHE", error: O });
12300
- }), ["ALL", "WRITE"].includes(A) && await xc(Ge.firestoreWrite).catch((O) => {
12303
+ }), ["ALL", "WRITE"].includes(C) && await xc(Ge.firestoreWrite).catch((O) => {
12301
12304
  console.error('Error clearing indexedDB persistence in "firestoreWrite".'), b.error = !0, b.instances.push({ instance: "firestoreWrite", code: "CLEAR_CACHE", error: O });
12302
12305
  })), b.error ? console.info("Sign out operation completed with errors.") : console.info("Sign out operation completed successfully."), await ve(pe.postLogout, [b]);
12303
12306
  }
12304
- }), v ? !1 : C.currentUser ? (E && console.info(`${C.currentUser.uid} successfully logged in.`), !0) : !1;
12307
+ }), v ? !1 : T.currentUser ? (E && console.info(`${T.currentUser.uid} successfully logged in.`), !0) : !1;
12305
12308
  }, { getTenant: Mt, getEnv: ze, getTimezone: Cm, getSchema: Ve, getCurrentUser: Hw, getCurrentUserRoleGroups: Jr, getAllRoleGroups: yc, getGlobalConfigModule: Ie, getCollectionConfigModule: lt, getAppCheck: Kw, getAppCheckFirestoreWrite: Yw, getFirestoreWriteAuth: Nw, getFirestoreWrite: gc, getFirestoreMaintenance: Am } = Co, Jw = async (r, e, t) => {
12306
- const [n, s] = [fr(), Nw()], i = Ie();
12309
+ const [n, s] = [dr(), Nw()], i = Ie();
12307
12310
  if (!r || !e)
12308
12311
  throw new Error("Email and password are required.");
12309
12312
  try {
@@ -12392,82 +12395,82 @@ const Gw = async (r, e, t, n) => {
12392
12395
  const o = Ve(!0), l = Jr()[i], u = We(), f = o.collections[i];
12393
12396
  if (!f)
12394
12397
  throw new Error("COLLECTION_NOT_FOUND");
12395
- const { labels: h, preloadCache: d } = f, m = Ie(), E = Object.keys(o.collections).includes(i), y = m.disabledCollections?.includes(i);
12398
+ const { labels: h, preloadCache: d } = f, p = Ie(), E = Object.keys(o.collections).includes(i), y = p.disabledCollections?.includes(i);
12396
12399
  if (!E || y)
12397
12400
  throw new Error("COLLECTION_NOT_FOUND");
12398
- const _ = lt(h.collection), S = await ie(m, [
12401
+ const _ = lt(h.collection), S = await ie(p, [
12399
12402
  "global",
12400
12403
  "firebase",
12401
12404
  "serverTimestampOptions"
12402
- ]), T = dm(r, e, l);
12403
- if (T.length === 0)
12405
+ ]), A = dm(r, e, l);
12406
+ if (A.length === 0)
12404
12407
  throw new Error("PERMISSION_DENIED");
12405
- const P = d?.roles?.includes(a.Role), g = { collection: h.collection };
12406
- await ce("preOperation", m, _, ["read", void 0, e, g]), await ce("preRead", m, _, [g, T, !1, !0]);
12407
- const v = /* @__PURE__ */ new Map(), A = [];
12408
- let p = {};
12408
+ const F = d?.roles?.includes(a.Role), m = { collection: h.collection };
12409
+ await ce("preOperation", p, _, ["read", void 0, e, m]), await ce("preRead", p, _, [m, A, !1, !0]);
12410
+ const v = /* @__PURE__ */ new Map(), C = [];
12411
+ let g = {};
12409
12412
  const k = /* @__PURE__ */ new Map();
12410
- typeof s?.relations == "object" && (s.relations.fields = s.relations.fields.map((M) => {
12411
- if (typeof M == "string") {
12412
- const D = f.fields.find((q) => q.name === M);
12413
- if (D)
12414
- return D;
12415
- throw new Error(`SCHEMA_ERROR: Field ${M} not found in collection ${i}`);
12416
- }
12417
- return M;
12413
+ typeof s?.relations == "object" && (s.relations.fields = s.relations.fields.map((P) => {
12414
+ if (typeof P == "string") {
12415
+ const M = f.fields.find((q) => q.name === P);
12416
+ if (M)
12417
+ return M;
12418
+ throw new Error(`SCHEMA_ERROR: Field ${P} not found in collection ${i}`);
12419
+ }
12420
+ return P;
12418
12421
  }));
12419
12422
  const I = () => {
12420
- const M = Sd(u, async () => {
12421
- if (M(), p) {
12422
- if (um(p, k), !s?.noComputedFields) {
12423
- const D = [];
12423
+ const P = Sd(u, async () => {
12424
+ if (P(), g) {
12425
+ if (um(g, k), !s?.noComputedFields) {
12426
+ const M = [];
12424
12427
  for (const q of f.fields)
12425
- q.type === "Computed" && D.push(ve(() => q.formula(p)).then((z) => {
12426
- p && (p[q.name] = z);
12428
+ q.type === "Computed" && M.push(ve(() => q.formula(g)).then((z) => {
12429
+ g && (g[q.name] = z);
12427
12430
  }));
12428
- await Promise.all(D);
12431
+ await Promise.all(M);
12429
12432
  }
12430
12433
  if (s?.noEmbeddingFields)
12431
- for (const D of f.fields)
12432
- D.type === "Embedding" && delete p[D.name];
12434
+ for (const M of f.fields)
12435
+ M.type === "Embedding" && delete g[M.name];
12433
12436
  }
12434
- t(we(p));
12437
+ t(we(g));
12435
12438
  });
12436
- }, b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = (M) => typeof M == "object" ? M.fields.filter((q) => typeof q == "object" && _e(q) && jt(f, o, a).includes(q.collection)) : f.fields.filter((q) => _e(q) && jt(f, o, a).includes(q.collection)), x = (M) => new Promise((D) => {
12439
+ }, b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = (P) => typeof P == "object" ? P.fields.filter((q) => typeof q == "object" && _e(q) && jt(f, o, a).includes(q.collection)) : f.fields.filter((q) => _e(q) && jt(f, o, a).includes(q.collection)), x = (P) => new Promise((M) => {
12437
12440
  if (!s?.relations) {
12438
- D({});
12441
+ M({});
12439
12442
  return;
12440
12443
  }
12441
12444
  const q = we(s.relations), z = /* @__PURE__ */ new Map(), ee = /* @__PURE__ */ new Map(), oe = O(q);
12442
- for (const F of oe)
12445
+ for (const D of oe)
12443
12446
  for (const te of w.values())
12444
- te.type === F.type && te.field === F.name && // eslint-disable-next-line security/detect-object-injection
12445
- !p[F.name][te.id] && (te.listener(), b.delete(`${F.name}_${te.id}`));
12446
- for (const F of oe)
12447
- if ("collection" in F) {
12448
- const te = p[F.name];
12447
+ te.type === D.type && te.field === D.name && // eslint-disable-next-line security/detect-object-injection
12448
+ !g[D.name][te.id] && (te.listener(), b.delete(`${D.name}_${te.id}`));
12449
+ for (const D of oe)
12450
+ if ("collection" in D) {
12451
+ const te = g[D.name];
12449
12452
  if (!te)
12450
12453
  continue;
12451
12454
  for (const ne of Object.keys(te))
12452
- te?.[ne].id || (z.set(`${F.name}_${ne}`, !1), b.has(`${F.name}_${ne}`) ? ee.set(`${F.name}_${ne}`, !0) : b.set(`${F.name}_${ne}`, !0));
12455
+ te?.[ne].id || (z.set(`${D.name}_${ne}`, !1), b.has(`${D.name}_${ne}`) ? ee.set(`${D.name}_${ne}`, !0) : b.set(`${D.name}_${ne}`, !0));
12453
12456
  }
12454
12457
  if (z.size === 0)
12455
- D({});
12458
+ M({});
12456
12459
  else
12457
- for (const F of oe)
12458
- if ("collection" in F) {
12459
- const te = p[F.name];
12460
+ for (const D of oe)
12461
+ if ("collection" in D) {
12462
+ const te = g[D.name];
12460
12463
  if (!te)
12461
12464
  continue;
12462
12465
  for (const [ne, Me] of Object.entries(te))
12463
- if (ee.has(`${F.name}_${ne}`)) {
12466
+ if (ee.has(`${D.name}_${ne}`)) {
12464
12467
  const Se = async () => {
12465
- te[ne].id ? (z.set(`${F.name}_${ne}`, !0), Array.from(z.values()).every((Le) => Le) && (D({}), I())) : setTimeout(Se, 100);
12468
+ te[ne].id ? (z.set(`${D.name}_${ne}`, !0), Array.from(z.values()).every((Le) => Le) && (M({}), I())) : setTimeout(Se, 100);
12466
12469
  };
12467
12470
  Se();
12468
12471
  } else {
12469
- const Se = o.collections[F.collection], { access: Le } = Se, { serverReadOnly: Ot } = Le;
12470
- Ot?.includes(a.Role) ? _r([...Me.Collection_Path], ne, {
12472
+ const Se = o.collections[D.collection], { access: Le } = Se, { serverReadOnly: Ot } = Le;
12473
+ Ot?.includes(a.Role) ? vr([...Me.Collection_Path], ne, {
12471
12474
  noComputedFields: s?.noComputedFields,
12472
12475
  noEmbeddingFields: s?.noEmbeddingFields
12473
12476
  }).then((K) => {
@@ -12476,22 +12479,22 @@ const Gw = async (r, e, t, n) => {
12476
12479
  return;
12477
12480
  }
12478
12481
  if (!te?.[ne]) {
12479
- z.set(`${F.name}_${ne}`, !0), b.delete(`${F.name}_${ne}`);
12482
+ z.set(`${D.name}_${ne}`, !0), b.delete(`${D.name}_${ne}`);
12480
12483
  return;
12481
12484
  }
12482
- te[ne] = K, z.set(`${F.name}_${ne}`, !0), Array.from(z.values()).every((j) => j) && (D({}), I(), M.fromCache === !1 && (ce("postOperation", m, _, [
12485
+ te[ne] = K, z.set(`${D.name}_${ne}`, !0), Array.from(z.values()).every((j) => j) && (M({}), I(), P.fromCache === !1 && (ce("postOperation", p, _, [
12483
12486
  "read",
12484
- p,
12487
+ g,
12485
12488
  e,
12486
- g
12487
- ]), ce("postRead", m, _, [
12489
+ m
12490
+ ]), ce("postRead", p, _, [
12491
+ m,
12492
+ A,
12488
12493
  g,
12489
- T,
12490
- p,
12491
12494
  !0
12492
12495
  ])));
12493
12496
  }).catch((K) => {
12494
- delete te[ne], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${F.collection} with ID ${e} at location ${Me.Collection_Path?.join("/")}`, {
12497
+ delete te[ne], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${D.collection} with ID ${e} at location ${Me.Collection_Path?.join("/")}`, {
12495
12498
  cause: K
12496
12499
  }));
12497
12500
  }) : km(
@@ -12503,70 +12506,70 @@ const Gw = async (r, e, t, n) => {
12503
12506
  return;
12504
12507
  }
12505
12508
  if (!te?.[ne]) {
12506
- w.get(`${F.name}_${ne}`) && w.get(`${F.name}_${ne}`).listener(), z.set(`${F.name}_${ne}`, !0), b.delete(`${F.name}_${ne}`);
12509
+ w.get(`${D.name}_${ne}`) && w.get(`${D.name}_${ne}`).listener(), z.set(`${D.name}_${ne}`, !0), b.delete(`${D.name}_${ne}`);
12507
12510
  return;
12508
12511
  }
12509
- te[ne] = K, z.set(`${F.name}_${ne}`, !0), Array.from(z.values()).every((j) => j) && (D({}), I(), M.fromCache === !1 && (ce("postOperation", m, _, [
12512
+ te[ne] = K, z.set(`${D.name}_${ne}`, !0), Array.from(z.values()).every((j) => j) && (M({}), I(), P.fromCache === !1 && (ce("postOperation", p, _, [
12510
12513
  "read",
12511
- p,
12514
+ g,
12512
12515
  e,
12513
- g
12514
- ]), ce("postRead", m, _, [
12516
+ m
12517
+ ]), ce("postRead", p, _, [
12518
+ m,
12519
+ A,
12515
12520
  g,
12516
- T,
12517
- p,
12518
12521
  !0
12519
12522
  ])));
12520
12523
  },
12521
12524
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12522
12525
  (K) => {
12523
- delete te[ne], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${F.collection} with ID ${e} at location ${Me.Collection_Path?.join("/")}`, {
12526
+ delete te[ne], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${D.collection} with ID ${e} at location ${Me.Collection_Path?.join("/")}`, {
12524
12527
  cause: K
12525
12528
  }));
12526
12529
  },
12527
12530
  { ...s, relations: !1 }
12528
12531
  ).then((K) => {
12529
12532
  if (!te?.[ne]) {
12530
- K(), b.delete(`${F.name}_${ne}`);
12533
+ K(), b.delete(`${D.name}_${ne}`);
12531
12534
  return;
12532
12535
  }
12533
- A.push(K), w.set(`${F.name}_${ne}`, {
12536
+ C.push(K), w.set(`${D.name}_${ne}`, {
12534
12537
  id: ne,
12535
- type: F.type,
12536
- field: F.name,
12538
+ type: D.type,
12539
+ field: D.name,
12537
12540
  listener: K
12538
12541
  });
12539
12542
  });
12540
12543
  }
12541
12544
  }
12542
12545
  });
12543
- for (const M of T) {
12544
- const D = dr(M, { source: s?.only || (P ? "cache" : "default") }, (q) => {
12546
+ for (const P of A) {
12547
+ const M = hr(P, { source: s?.only || (F ? "cache" : "default") }, (q) => {
12545
12548
  if (q.exists()) {
12546
12549
  const z = q.data({ serverTimestamps: S || "none" });
12547
- if (v.has(M.path) && s?.relations) {
12550
+ if (v.has(P.path) && s?.relations) {
12548
12551
  const oe = O(s?.relations);
12549
- for (const F of oe)
12550
- "collection" in F && z[F.name] && (z[F.name] = p?.[F.name]);
12552
+ for (const D of oe)
12553
+ "collection" in D && z[D.name] && (z[D.name] = g?.[D.name]);
12551
12554
  }
12552
- v.set(M.path, !0), p ||= {}, p.id ||= q.id, p = { ...p, ...z }, delete p.Collection_Path_String;
12553
- const ee = k.get(M) || /* @__PURE__ */ new Set();
12554
- lm(z, ee), k.set(M, ee), v.size === T.length && x(q.metadata).then(() => {
12555
- I(), q.metadata.fromCache === !1 && (ce("postOperation", m, _, [
12555
+ v.set(P.path, !0), g ||= {}, g.id ||= q.id, g = { ...g, ...z }, delete g.Collection_Path_String;
12556
+ const ee = k.get(P) || /* @__PURE__ */ new Set();
12557
+ lm(z, ee), k.set(P, ee), v.size === A.length && x(q.metadata).then(() => {
12558
+ I(), q.metadata.fromCache === !1 && (ce("postOperation", p, _, [
12556
12559
  "read",
12557
- p,
12560
+ g,
12558
12561
  e,
12559
- g
12560
- ]), ce("postRead", m, _, [g, T, p, !0]));
12562
+ m
12563
+ ]), ce("postRead", p, _, [m, A, g, !0]));
12561
12564
  });
12562
- } else p && (p = void 0, I(), q.metadata.fromCache === !1 && (ce("postOperation", m, _, ["read", void 0, e, g]), ce("postRead", m, _, [g, T, void 0, !0])));
12565
+ } else g && (g = void 0, I(), q.metadata.fromCache === !1 && (ce("postOperation", p, _, ["read", void 0, e, m]), ce("postRead", p, _, [m, A, void 0, !0])));
12563
12566
  }, (q) => {
12564
- n && n(q), A.forEach((z) => z());
12567
+ n && n(q), C.forEach((z) => z());
12565
12568
  });
12566
- A.push(D);
12569
+ C.push(M);
12567
12570
  }
12568
12571
  return () => {
12569
- A.forEach((M) => M());
12572
+ C.forEach((P) => P());
12570
12573
  };
12571
12574
  }, Ja = (r) => {
12572
12575
  const e = r.first.values().next().value?.id;
@@ -12591,24 +12594,24 @@ const Gw = async (r, e, t, n) => {
12591
12594
  const a = De();
12592
12595
  if (!a?.Role)
12593
12596
  throw new Error("PERMISSION_DENIED");
12594
- const o = Ve(!0), l = Jr()[i], u = We(), f = o.collections[i], { labels: h, preloadCache: d, access: m } = f, { serverReadOnly: E } = m, y = Ie(), _ = Object.keys(o.collections).includes(i), S = y.disabledCollections?.includes(i);
12597
+ const o = Ve(!0), l = Jr()[i], u = We(), f = o.collections[i], { labels: h, preloadCache: d, access: p } = f, { serverReadOnly: E } = p, y = Ie(), _ = Object.keys(o.collections).includes(i), S = y.disabledCollections?.includes(i);
12595
12598
  if (!_ || S)
12596
12599
  throw new Error("COLLECTION_NOT_FOUND");
12597
- const T = lt(h.collection), P = await ie(y, [
12600
+ const A = lt(h.collection), F = await ie(y, [
12598
12601
  "global",
12599
12602
  "firebase",
12600
12603
  "serverTimestampOptions"
12601
- ]), g = d?.roles?.includes(a.Role);
12604
+ ]), m = d?.roles?.includes(a.Role);
12602
12605
  if (s?.pagination?.number !== void 0) {
12603
12606
  const G = s.pagination.number;
12604
12607
  if (typeof G != "number" || !Number.isFinite(G) || !Number.isInteger(G) || G < 1)
12605
12608
  throw new Error("INPUT_ERROR: Pagination number must be a positive finite integer");
12606
12609
  }
12607
- const C = oc(r, l, s?.getAll);
12608
- if (C.length === 0)
12610
+ const T = oc(r, l, !!s?.tempCache);
12611
+ if (T.length === 0)
12609
12612
  return { pages: 0, count: 0, unsubscribe: () => {
12610
12613
  } };
12611
- let R = C.map((G) => me(G, ...e));
12614
+ let R = T.map((G) => he(G, ...e));
12612
12615
  const v = s?.pagination?.startAfter || s?.pagination?.endBefore || s?.pagination?.startAt || s?.pagination?.endAt || {
12613
12616
  first: /* @__PURE__ */ new Map(),
12614
12617
  last: /* @__PURE__ */ new Map()
@@ -12622,43 +12625,43 @@ const Gw = async (r, e, t, n) => {
12622
12625
  s.pagination.startAfter || s.pagination.endBefore || s.pagination.startAt || s.pagination.endAt ? s.pagination.startAfter ? (Qa(s.pagination.startAfter), R = R.map((j, Y) => {
12623
12626
  if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
12624
12627
  throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using startAfter");
12625
- let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), eo(v.last.get(Y)));
12626
- return s.pagination.number && (U = me(U, Xt(s.pagination.number))), U;
12628
+ let U = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), eo(v.last.get(Y)));
12629
+ return s.pagination.number && (U = he(U, Xt(s.pagination.number))), U;
12627
12630
  })) : s.pagination.endBefore ? (Ja(s.pagination.endBefore), R = R.map((j, Y) => {
12628
12631
  if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
12629
12632
  throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using endBefore");
12630
- let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), to(v.first.get(Y)));
12631
- return s.pagination.number && (U = me(U, Nr(s.pagination.number))), U;
12633
+ let U = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), to(v.first.get(Y)));
12634
+ return s.pagination.number && (U = he(U, Fr(s.pagination.number))), U;
12632
12635
  })) : s.pagination.startAt ? (Ja(s.pagination.startAt), R = R.map((j, Y) => {
12633
12636
  if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
12634
12637
  throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using startAt");
12635
- let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), ap(v.first.get(Y)));
12636
- return s.pagination.number && (U = me(U, Nr(s.pagination.number))), U;
12638
+ let U = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), ap(v.first.get(Y)));
12639
+ return s.pagination.number && (U = he(U, Fr(s.pagination.number))), U;
12637
12640
  })) : s.pagination.endAt && (Qa(s.pagination.endAt), R = R.map((j, Y) => {
12638
12641
  if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
12639
12642
  throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using endAt");
12640
- let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), op(v.last.get(Y)));
12641
- return s.pagination.number && (U = me(U, Nr(s.pagination.number))), U;
12643
+ let U = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), op(v.last.get(Y)));
12644
+ return s.pagination.number && (U = he(U, Fr(s.pagination.number))), U;
12642
12645
  })) : R = R.map((j) => {
12643
- let Y = me(j);
12644
- return s.pagination?.orderByField && s.pagination.orderByDirection && (Y = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection))), s.pagination.number && (Y = me(Y, Xt(s.pagination.number))), Y;
12646
+ let Y = he(j);
12647
+ return s.pagination?.orderByField && s.pagination.orderByDirection && (Y = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection))), s.pagination.number && (Y = he(Y, Xt(s.pagination.number))), Y;
12645
12648
  });
12646
12649
  }
12647
- const A = { collection: h.collection };
12648
- await ce("preOperation", y, T, ["read", void 0, void 0, A]), await ce("preRead", y, T, [A, R, !0, !0]);
12650
+ const C = { collection: h.collection };
12651
+ await ce("preOperation", y, A, ["read", void 0, void 0, C]), await ce("preRead", y, A, [C, R, !0, !0]);
12649
12652
  let I = !0;
12650
- const b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = [], x = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), q = (G, K, j) => {
12653
+ const b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = [], x = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), q = (G, K, j) => {
12651
12654
  const Y = [];
12652
12655
  x.forEach((U) => {
12653
- um(U, M.get(U.id));
12656
+ um(U, P.get(U.id));
12654
12657
  for (const Z of f.fields)
12655
12658
  Z.type === "Computed" && !s?.noComputedFields && Y.push(ve(Z.formula, [U, j]).then((Te) => {
12656
12659
  U[Z.name] = Te;
12657
12660
  })), s?.noEmbeddingFields && Z.type === "Embedding" && delete U[Z.name];
12658
12661
  }), Promise.all(Y).then(() => {
12659
12662
  t(Array.from(x.values()), G, K), K?.fromCache === !1 && x.forEach((U) => {
12660
- const Z = ["read", U, U.id, A];
12661
- ce("postOperation", y, T, Z), ce("postRead", y, T, [A, C, U, !0]);
12663
+ const Z = ["read", U, U.id, C];
12664
+ ce("postOperation", y, A, Z), ce("postRead", y, A, [C, T, U, !0]);
12662
12665
  });
12663
12666
  });
12664
12667
  }, z = (G, K) => {
@@ -12669,7 +12672,7 @@ const Gw = async (r, e, t, n) => {
12669
12672
  }), b.size === R.length && j) {
12670
12673
  I = !1;
12671
12674
  const Y = Sd(u, () => {
12672
- Y(), !s?.noComputedFields && T?.admin?.retriever ? ve(T.admin.retriever).then((U) => {
12675
+ Y(), !s?.noComputedFields && A?.admin?.retriever ? ve(A.admin.retriever).then((U) => {
12673
12676
  q(G, K, U);
12674
12677
  }) : q(G, K);
12675
12678
  });
@@ -12684,7 +12687,7 @@ const Gw = async (r, e, t, n) => {
12684
12687
  }
12685
12688
  return G;
12686
12689
  }));
12687
- const ee = {}, oe = {}, F = (G, K) => {
12690
+ const ee = {}, oe = {}, D = (G, K) => {
12688
12691
  if (!G)
12689
12692
  return;
12690
12693
  const j = G.id;
@@ -12721,7 +12724,7 @@ const Gw = async (r, e, t, n) => {
12721
12724
  ut();
12722
12725
  } else {
12723
12726
  const ut = o.collections[H.collection], { access: Be } = ut, { serverReadOnly: xe } = Be;
12724
- xe?.includes(a.Role) ? _r([...Xe.Collection_Path], se).then((Re) => {
12727
+ xe?.includes(a.Role) ? vr([...Xe.Collection_Path], se).then((Re) => {
12725
12728
  if (!Re) {
12726
12729
  delete ge[se];
12727
12730
  return;
@@ -12730,7 +12733,7 @@ const Gw = async (r, e, t, n) => {
12730
12733
  Z.set(se, !0), ee[j].delete(se);
12731
12734
  return;
12732
12735
  }
12733
- ge[se] = Re, Z.set(se, !0), Array.from(Z.values()).every((wr) => wr) && (w.set(j, "loaded"), z(K));
12736
+ ge[se] = Re, Z.set(se, !0), Array.from(Z.values()).every((br) => br) && (w.set(j, "loaded"), z(K));
12734
12737
  }).catch((Re) => {
12735
12738
  delete ge[se], Re.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${H.collection} with ID ${j} at location ${Xe.Collection_Path?.join("/")}`, {
12736
12739
  cause: Re
@@ -12747,7 +12750,7 @@ const Gw = async (r, e, t, n) => {
12747
12750
  oe[j].has(se) && oe[j].get(se)?.listener(), Z.set(se, !0), ee[j].delete(se);
12748
12751
  return;
12749
12752
  }
12750
- ge[se] = Re, Z.set(se, !0), Array.from(Z.values()).every((wr) => wr) && (w.set(j, "loaded"), z(K));
12753
+ ge[se] = Re, Z.set(se, !0), Array.from(Z.values()).every((br) => br) && (w.set(j, "loaded"), z(K));
12751
12754
  },
12752
12755
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12753
12756
  (Re) => {
@@ -12780,23 +12783,24 @@ const Gw = async (r, e, t, n) => {
12780
12783
  }
12781
12784
  }, ne = (G, K, j) => {
12782
12785
  const Y = j.data({
12783
- serverTimestamps: P || "none"
12786
+ serverTimestamps: F || "none"
12784
12787
  });
12785
12788
  K.id ||= j.id, K = { ...K, ...Y }, delete K.Collection_Path_String;
12786
- const U = M.get(j.id) || /* @__PURE__ */ new Map(), Z = U.get(G) || /* @__PURE__ */ new Set();
12787
- lm(Y, Z), U.set(G, Z), M.set(j.id, U), x.set(j.id, K);
12788
- }, Me = s?.only === "cache" || g;
12789
+ const U = P.get(j.id) || /* @__PURE__ */ new Map(), Z = U.get(G) || /* @__PURE__ */ new Set();
12790
+ lm(Y, Z), U.set(G, Z), P.set(j.id, U), x.set(j.id, K);
12791
+ }, Me = s?.only === "cache" || m;
12792
+ m && s?.tempCache && await sr(h.collection, s.tempCache?.constraints, void 0, void 0, void 0, s.tempCache?.label);
12789
12793
  for (const G of R) {
12790
12794
  let K = !0;
12791
- const j = dr(G, { source: Me ? "cache" : "default", includeMetadataChanges: !0 }, (Y) => {
12795
+ const j = hr(G, { source: Me ? "cache" : "default", includeMetadataChanges: !0 }, (Y) => {
12792
12796
  (Me || Y.metadata.fromCache === !1) && (b.set(G, !0), v.first.set(R.indexOf(G), Y.docs[0]), v.last.set(R.indexOf(G), Y.docs.at(-1) || Y.docs[0]), I && s?.relations || z(v, Y.metadata)), b.get(G) === !0 && (K ? (Y.docs.forEach((U) => {
12793
- const Z = x.get(U.id) || {}, Te = D.get(U.id) || 0;
12794
- D.set(U.id, Te + 1), ne(G, Z, U);
12797
+ const Z = x.get(U.id) || {}, Te = M.get(U.id) || 0;
12798
+ M.set(U.id, Te + 1), ne(G, Z, U);
12795
12799
  }), K = !1) : Y.docChanges().forEach((U) => {
12796
- const Z = x.get(U.doc.id) || {}, Te = D.get(U.doc.id) || 0;
12797
- U.type === "added" && D.set(U.doc.id, Te + 1), U.type === "added" || U.type === "modified" ? ne(G, Z, U.doc) : U.type === "removed" && (D.set(U.doc.id, Te - 1), D.get(U.doc.id) === 0 && (x.delete(U.doc.id), b.size === R.length && s?.relations && (w.set(U.doc.id, "deleted"), te(U.doc.id))));
12800
+ const Z = x.get(U.doc.id) || {}, Te = M.get(U.doc.id) || 0;
12801
+ U.type === "added" && M.set(U.doc.id, Te + 1), U.type === "added" || U.type === "modified" ? ne(G, Z, U.doc) : U.type === "removed" && (M.set(U.doc.id, Te - 1), M.get(U.doc.id) === 0 && (x.delete(U.doc.id), b.size === R.length && s?.relations && (w.set(U.doc.id, "deleted"), te(U.doc.id))));
12798
12802
  }), b.size === R.length && s?.relations && (x.size === 0 && z(v, Y.metadata), x.forEach((U) => {
12799
- F(U, v);
12803
+ D(U, v);
12800
12804
  })));
12801
12805
  }, (Y) => {
12802
12806
  n && n(new Error(`Error fetching documents at location ${r.join("/")}`, { cause: Y })), O.forEach((U) => U());
@@ -12805,8 +12809,8 @@ const Gw = async (r, e, t, n) => {
12805
12809
  }
12806
12810
  let Se, Le;
12807
12811
  if (s?.pagination && !d?.roles.includes(a.Role) && !E?.includes(a.Role)) {
12808
- let G = me(C[0], ...e);
12809
- s.pagination.orderByField && s.pagination.orderByDirection && (G = me(G, rt(s.pagination.orderByField, s.pagination.orderByDirection)));
12812
+ let G = he(T[0], ...e);
12813
+ s.pagination.orderByField && s.pagination.orderByDirection && (G = he(G, rt(s.pagination.orderByField, s.pagination.orderByDirection)));
12810
12814
  const K = await Ed(G).catch(() => {
12811
12815
  });
12812
12816
  if (K) {
@@ -12840,19 +12844,19 @@ const Gw = async (r, e, t, n) => {
12840
12844
  await Fw(e, t, n, s, i, a);
12841
12845
  return;
12842
12846
  }
12843
- const f = Ha(r), h = cw(e), d = t ? pd(t) : void 0, m = n ? pd(n) : void 0, E = s ? Ha(s) : void 0, y = i ? Ha(i) : void 0, _ = a ? Tn(a) : void 0, S = c ? Tn(c) : void 0, T = Array.isArray(f) ? f : [f];
12844
- if (T.length === 0 || T.length === 1 && !T[0])
12847
+ const f = Ha(r), h = cw(e), d = t ? pd(t) : void 0, p = n ? pd(n) : void 0, E = s ? Ha(s) : void 0, y = i ? Ha(i) : void 0, _ = a ? Tn(a) : void 0, S = c ? Tn(c) : void 0, A = Array.isArray(f) ? f : [f];
12848
+ if (A.length === 0 || A.length === 1 && !A[0])
12845
12849
  throw new Error("No valid email addresses provided");
12846
- const P = We(), g = { to: f, message: { subject: h } };
12847
- if (d && (g.message.text = d), m && (g.message.html = m), E) {
12848
- const C = Array.isArray(E) ? E : [E];
12849
- C.length > 0 && C[0] && (g.cc = E);
12850
+ const F = We(), m = { to: f, message: { subject: h } };
12851
+ if (d && (m.message.text = d), p && (m.message.html = p), E) {
12852
+ const T = Array.isArray(E) ? E : [E];
12853
+ T.length > 0 && T[0] && (m.cc = E);
12850
12854
  }
12851
12855
  if (y) {
12852
- const C = Array.isArray(y) ? y : [y];
12853
- C.length > 0 && C[0] && (g.bcc = y);
12856
+ const T = Array.isArray(y) ? y : [y];
12857
+ T.length > 0 && T[0] && (m.bcc = y);
12854
12858
  }
12855
- _ && (g.replyTo = _), o && (g.message.attachments = o), S && (g.from = S), await Td(qr(P, "system_mail"), g);
12859
+ _ && (m.replyTo = _), o && (m.message.attachments = o), S && (m.from = S), await Td(qr(F, "system_mail"), m);
12856
12860
  }, Dw = async (r) => {
12857
12861
  const e = it(), t = ze(), n = Ue(e, t.STOKER_FB_FUNCTIONS_REGION);
12858
12862
  await Je(n, "stoker-adminsms")({
@@ -12911,8 +12915,9 @@ export {
12911
12915
  To as getLoadingState,
12912
12916
  Tw as getMaintenanceInfo,
12913
12917
  Cw as getNetworkStatus,
12914
- _r as getOne,
12918
+ vr as getOne,
12915
12919
  mw as getOneServer,
12920
+ lw as getPreloadListeners,
12916
12921
  Ve as getSchema,
12917
12922
  pm as getSome,
12918
12923
  hw as getSomeServer,
@@ -12922,14 +12927,14 @@ export {
12922
12927
  Om as getVersionInfo,
12923
12928
  Wg as getZodSchema,
12924
12929
  Gw as initializeStoker,
12925
- sr as isDeleteSentinel,
12930
+ ir as isDeleteSentinel,
12926
12931
  lb as keepTimezone,
12927
12932
  tb as multiFactorEnroll,
12928
12933
  eb as onStokerPermissionsChange,
12929
12934
  Qw as onStokerReady,
12930
12935
  Xw as onStokerSignOut,
12931
12936
  Zw as preloadCache,
12932
- Mr as preloadCollection,
12937
+ sr as preloadCollection,
12933
12938
  ub as removeTimezone,
12934
12939
  Fw as sendAdminEmail,
12935
12940
  Dw as sendAdminSMS,