@stoker-platform/web-client 0.5.94 → 0.5.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/bundle.js +290 -275
  2. package/package.json +3 -3
package/dist/bundle.js CHANGED
@@ -2,13 +2,13 @@ import { getApp as at, registerVersion as Wm, initializeApp as Qn, setLogLevel a
2
2
  import { isSupported as Bm, initializeAnalytics as Zm, setConsent as Gm } from "firebase/analytics";
3
3
  import { getAuth as yr, validatePassword as Id, initializeAuth as xc, indexedDBLocalPersistence as Hm, browserLocalPersistence as Km, browserSessionPersistence as Fc, inMemoryPersistence as Nc, beforeAuthStateChanged as Ym, connectAuthEmulator as Jm, onAuthStateChanged as Xn, getIdTokenResult as Qm, signOut as xd, signInWithEmailAndPassword as Xm, getMultiFactorResolver as ep, TotpMultiFactorGenerator as ao, signInWithCustomToken as tp, multiFactor as Dc } from "firebase/auth";
4
4
  import { getDatabase as Fd, onValue as rp, ref as np, connectDatabaseEmulator as sp } from "firebase/database";
5
- import { where as ye, query as he, collection as ir, and as rn, or as Pc, onSnapshot as _r, doc as Te, Timestamp as Kt, setDoc as ip, getDoc as Nd, orderBy as nt, limit as nr, startAfter as oo, endBefore as co, limitToLast as Mr, getDocsFromCache as Dd, getDocsFromServer as ap, getDocs as op, getCountFromServer as Pd, getDocFromCache as cp, getDocFromServer as lp, writeBatch as Mo, serverTimestamp as Vr, deleteField as Fn, arrayRemove as qo, arrayUnion as Lo, collectionGroup as up, getFirestore as Mc, initializeFirestore as nn, connectFirestoreEmulator as qc, persistentLocalCache as Lc, persistentSingleTabManager as $c, persistentMultipleTabManager as jc, memoryEagerGarbageCollector as fp, memoryLruGarbageCollector as dp, memoryLocalCache as hp, getPersistentCacheIndexManager as mp, enablePersistentCacheIndexAutoCreation as pp, terminate as gp, clearIndexedDbPersistence as Vc, waitForPendingWrites as yp, onSnapshotsInSync as Md, startAt as _p, endAt as vp, addDoc as qd } from "firebase/firestore";
5
+ import { where as ye, query as he, collection as ar, and as rn, or as Pc, onSnapshot as _r, doc as Re, Timestamp as Yt, setDoc as ip, getDoc as Nd, orderBy as nt, limit as sr, startAfter as oo, endBefore as co, limitToLast as Mr, getDocsFromCache as Dd, getDocsFromServer as ap, getDocs as op, getCountFromServer as Pd, getDocFromCache as cp, getDocFromServer as lp, writeBatch as Mo, serverTimestamp as Vr, deleteField as Fn, arrayRemove as qo, arrayUnion as Lo, collectionGroup as up, getFirestore as Mc, initializeFirestore as nn, connectFirestoreEmulator as qc, persistentLocalCache as Lc, persistentSingleTabManager as $c, persistentMultipleTabManager as jc, memoryEagerGarbageCollector as fp, memoryLruGarbageCollector as dp, memoryLocalCache as hp, getPersistentCacheIndexManager as mp, enablePersistentCacheIndexAutoCreation as pp, terminate as gp, clearIndexedDbPersistence as Vc, waitForPendingWrites as yp, onSnapshotsInSync as Md, startAt as _p, endAt as vp, addDoc as qd } from "firebase/firestore";
6
6
  import { connectStorageEmulator as wp, getStorage as bp } from "firebase/storage";
7
7
  import { getFunctions as We, httpsCallable as Qe, connectFunctionsEmulator as Op } from "firebase/functions";
8
8
  import { ReCaptchaEnterpriseProvider as Ep, initializeAppCheck as es, onTokenChanged as ts } from "firebase/app-check";
9
9
  import { getPerformance as Sp } from "firebase/performance";
10
10
  import { getRemoteConfig as Tp, fetchAndActivate as Rp } from "firebase/remote-config";
11
- const Ap = "0.5.93", Nn = (t) => !!t && !Array.isArray(t), lo = (t, e) => t.access ? Nn(t.access) ? !1 : t.access.includes(e) : !0, Cp = (t, e) => {
11
+ const Ap = "0.5.95", Nn = (t) => !!t && !Array.isArray(t), lo = (t, e) => t.access ? Nn(t.access) ? !1 : t.access.includes(e) : !0, Cp = (t, e) => {
12
12
  if (Nn(t.access))
13
13
  return e.fieldAccessGroups?.[t.access.group];
14
14
  }, Dn = (t) => {
@@ -41,7 +41,7 @@ const Ap = "0.5.93", Nn = (t) => !!t && !Array.isArray(t), lo = (t, e) => t.acce
41
41
  }, Ip = (t) => !!t.auth, ut = (t, e) => {
42
42
  if (e?.operations)
43
43
  return e.operations.includes(t);
44
- }, Zt = (t, e, r, n) => e ? e.Role ? Nn(t.access) ? !r || !n ? !1 : kp(t, r, e, n) : t.access?.includes(e.Role) : !1 : !0, Ld = (t, e, r, n) => t === !0 ? !1 : Array.isArray(t) ? t.includes(e.Role) : typeof t == "object" && t !== null ? !r || !n ? !1 : Pn(t, r, e, n) : !0, xp = (t, e, r, n) => e ? e.Role ? Ld(t.restrictCreate, e, r, n) : !1 : !0, Fp = (t, e, r, n) => e ? e.Role ? Ld(t.restrictUpdate, e, r, n) : !1 : !0, J = (t, e) => t.filter((r) => r.name === e)[0], ve = (t) => ["OneToOne", "OneToMany", "ManyToOne", "ManyToMany"].includes(t.type), $d = (t, e) => {
44
+ }, Gt = (t, e, r, n) => e ? e.Role ? Nn(t.access) ? !r || !n ? !1 : kp(t, r, e, n) : t.access?.includes(e.Role) : !1 : !0, Ld = (t, e, r, n) => t === !0 ? !1 : Array.isArray(t) ? t.includes(e.Role) : typeof t == "object" && t !== null ? !r || !n ? !1 : Pn(t, r, e, n) : !0, xp = (t, e, r, n) => e ? e.Role ? Ld(t.restrictCreate, e, r, n) : !1 : !0, Fp = (t, e, r, n) => e ? e.Role ? Ld(t.restrictUpdate, e, r, n) : !1 : !0, J = (t, e) => t.filter((r) => r.name === e)[0], we = (t) => ["OneToOne", "OneToMany", "ManyToOne", "ManyToMany"].includes(t.type), $d = (t, e) => {
45
45
  const r = {
46
46
  Record_Owner: "recordOwner",
47
47
  Record_User: "recordUser",
@@ -66,7 +66,7 @@ const Ap = "0.5.93", Nn = (t) => !!t && !Array.isArray(t), lo = (t, e) => t.acce
66
66
  if (!a.roles.some((h) => h.role === r.Role))
67
67
  return;
68
68
  const o = a.collectionField, c = J(t.fields, o);
69
- if (!ve(c))
69
+ if (!we(c))
70
70
  throw new Error("PERMISSION_DENIED");
71
71
  const l = r.collections?.[c.collection], f = e.collections[c.collection].access.entityRestrictions;
72
72
  if (!f)
@@ -83,7 +83,7 @@ const Ap = "0.5.93", Nn = (t) => !!t && !Array.isArray(t), lo = (t, e) => t.acce
83
83
  for (const o of s) {
84
84
  const { fields: c } = o;
85
85
  for (const l of c)
86
- if (!(l.access && !Zt(l, r, o, n)) && r.Role && ve(l) && l.collection === i.collection && l.dependencyFields)
86
+ if (!(l.access && !Gt(l, r, o, n)) && r.Role && we(l) && l.collection === i.collection && l.dependencyFields)
87
87
  for (const u of l.dependencyFields)
88
88
  !a.find((d) => d.field === u.field) && u.roles.includes(r.Role) && a.push(u);
89
89
  }
@@ -185,8 +185,8 @@ const Ap = "0.5.93", Nn = (t) => !!t && !Array.isArray(t), lo = (t, e) => t.acce
185
185
  }, Wt = (t, e, r, n) => {
186
186
  const s = [];
187
187
  for (const i of t.fields)
188
- if (ve(i)) {
189
- if (i.access && (!r || !Zt(i, r, t, n)) || !e.collections[i.collection])
188
+ if (we(i)) {
189
+ if (i.access && (!r || !Gt(i, r, t, n)) || !e.collections[i.collection])
190
190
  continue;
191
191
  const o = r?.collections?.[i.collection];
192
192
  if (!o)
@@ -481,7 +481,7 @@ function Hp() {
481
481
  return Rs = t, Rs;
482
482
  }
483
483
  var As, hl;
484
- function Yt() {
484
+ function Jt() {
485
485
  if (hl) return As;
486
486
  hl = 1;
487
487
  var t = Gp(), e = Hp();
@@ -495,14 +495,14 @@ var Cs, ml;
495
495
  function Vo() {
496
496
  if (ml) return Cs;
497
497
  ml = 1;
498
- var t = Yt(), e = dt(), r = t(e, "Map");
498
+ var t = Jt(), e = dt(), r = t(e, "Map");
499
499
  return Cs = r, Cs;
500
500
  }
501
501
  var ks, pl;
502
502
  function jn() {
503
503
  if (pl) return ks;
504
504
  pl = 1;
505
- var t = Yt(), e = t(Object, "create");
505
+ var t = Jt(), e = t(Object, "create");
506
506
  return ks = e, ks;
507
507
  }
508
508
  var Is, gl;
@@ -1178,28 +1178,28 @@ var Ai, pu;
1178
1178
  function Sg() {
1179
1179
  if (pu) return Ai;
1180
1180
  pu = 1;
1181
- var t = Yt(), e = dt(), r = t(e, "DataView");
1181
+ var t = Jt(), e = dt(), r = t(e, "DataView");
1182
1182
  return Ai = r, Ai;
1183
1183
  }
1184
1184
  var Ci, gu;
1185
1185
  function Tg() {
1186
1186
  if (gu) return Ci;
1187
1187
  gu = 1;
1188
- var t = Yt(), e = dt(), r = t(e, "Promise");
1188
+ var t = Jt(), e = dt(), r = t(e, "Promise");
1189
1189
  return Ci = r, Ci;
1190
1190
  }
1191
1191
  var ki, yu;
1192
1192
  function Rg() {
1193
1193
  if (yu) return ki;
1194
1194
  yu = 1;
1195
- var t = Yt(), e = dt(), r = t(e, "Set");
1195
+ var t = Jt(), e = dt(), r = t(e, "Set");
1196
1196
  return ki = r, ki;
1197
1197
  }
1198
1198
  var Ii, _u;
1199
1199
  function Ag() {
1200
1200
  if (_u) return Ii;
1201
1201
  _u = 1;
1202
- var t = Yt(), e = dt(), r = t(e, "WeakMap");
1202
+ var t = Jt(), e = dt(), r = t(e, "WeakMap");
1203
1203
  return Ii = r, Ii;
1204
1204
  }
1205
1205
  var xi, vu;
@@ -1293,16 +1293,16 @@ const Fg = /* @__PURE__ */ qn(xg), Ng = (t, e, r, n, s, i, a, o, c) => {
1293
1293
  !gn("Create", r, n, s, i, t) && (f = !1), r.auth;
1294
1294
  for (const d of l) {
1295
1295
  const h = t[d.name];
1296
- d.access && !Zt(d, i, r, o) && h !== void 0 && (f = !1), h !== void 0 && !xp(d, i, c.collection, o) && (f = !1);
1296
+ d.access && !Gt(d, i, r, o) && h !== void 0 && (f = !1), h !== void 0 && !xp(d, i, c.collection, o) && (f = !1);
1297
1297
  }
1298
1298
  if (!f)
1299
1299
  throw new Error("PERMISSION_DENIED");
1300
- }, ur = (t) => t && (t._methodName === "deleteField" || t.constructor.name === "DeleteTransform"), ar = (t) => {
1300
+ }, ur = (t) => t && (t._methodName === "deleteField" || t.constructor.name === "DeleteTransform"), zt = (t) => {
1301
1301
  for (const e in t)
1302
- Object.prototype.hasOwnProperty.call(t, e) && (ur(t[e]) ? delete t[e] : typeof t[e] == "object" && t[e] !== null && ar(t[e]));
1302
+ Object.prototype.hasOwnProperty.call(t, e) && (ur(t[e]) ? delete t[e] : typeof t[e] == "object" && t[e] !== null && zt(t[e]));
1303
1303
  }, Mg = (t, e, r, n, s, i, a, o, c, l, u) => {
1304
1304
  const { labels: f, fields: d } = n, h = a?.collections?.[f.collection], p = { ...e, ...t };
1305
- ar(p);
1305
+ zt(p);
1306
1306
  let v = !0, g = "";
1307
1307
  if (i && !h)
1308
1308
  throw new Error("PERMISSION_DENIED");
@@ -1312,7 +1312,7 @@ const Fg = /* @__PURE__ */ qn(xg), Ng = (t, e, r, n, s, i, a, o, c) => {
1312
1312
  !ut("Delete", h) && (v = !1, g = "Authenticated user does not have Delete or Restore access to this document");
1313
1313
  for (const w of d) {
1314
1314
  const E = t[w.name];
1315
- w.access && !Zt(w, a, n, u) && E !== void 0 && (g = `Authenticated user does not have access to field ${w.name}`, v = !1), E !== void 0 && !Fp(w, a, f.collection, u) && (g = `Authenticated user does not have Update access to field ${w.name}`, v = !1);
1315
+ w.access && !Gt(w, a, n, u) && E !== void 0 && (g = `Authenticated user does not have access to field ${w.name}`, v = !1), E !== void 0 && !Fp(w, a, f.collection, u) && (g = `Authenticated user does not have Update access to field ${w.name}`, v = !1);
1316
1316
  }
1317
1317
  if (!v)
1318
1318
  throw g && console.error(`PERMISSION_DENIED: ${g}`), new Error("PERMISSION_DENIED");
@@ -1335,7 +1335,7 @@ const Fg = /* @__PURE__ */ qn(xg), Ng = (t, e, r, n, s, i, a, o, c) => {
1335
1335
  if (!i.roles.some((l) => l.role === t))
1336
1336
  continue;
1337
1337
  const a = J(e.fields, i.collectionField);
1338
- if (!ve(a))
1338
+ if (!we(a))
1339
1339
  throw new Error("PERMISSION_DENIED");
1340
1340
  const c = r.collections[a.collection].access.entityRestrictions?.restrictions?.find((l) => l.type === i.type && l.roles.some((u) => u.role === t));
1341
1341
  if (!c)
@@ -1363,7 +1363,7 @@ var Pi, Eu;
1363
1363
  function th() {
1364
1364
  if (Eu) return Pi;
1365
1365
  Eu = 1;
1366
- var t = Yt(), e = (function() {
1366
+ var t = Jt(), e = (function() {
1367
1367
  try {
1368
1368
  var r = t(Object, "defineProperty");
1369
1369
  return r({}, "", {}), r;
@@ -1967,7 +1967,7 @@ const wy = /* @__PURE__ */ qn(vy), qr = {
1967
1967
  collections: {}
1968
1968
  }, by = () => {
1969
1969
  qr.global = {}, qr.collections = {};
1970
- }, we = async (t, e) => {
1970
+ }, be = async (t, e) => {
1971
1971
  let r = t;
1972
1972
  return t && (typeof t == "function" || typeof t.then == "function") && (e ? r = await t(...e) : r = await t()), r;
1973
1973
  }, ne = async (t, e, r, n) => {
@@ -1994,7 +1994,7 @@ const wy = /* @__PURE__ */ qn(vy), qr = {
1994
1994
  o = o[u];
1995
1995
  }
1996
1996
  let l;
1997
- if (c && (l = await we(o, r)), l) {
1997
+ if (c && (l = await be(o, r)), l) {
1998
1998
  let u = qr;
1999
1999
  const f = {};
2000
2000
  for (let d = 0; d < e.length; d++) {
@@ -2014,7 +2014,7 @@ const wy = /* @__PURE__ */ qn(vy), qr = {
2014
2014
  for (const a of n) {
2015
2015
  const { fields: o } = a;
2016
2016
  for (const c of o)
2017
- if (ve(c) && c.collection === s.collection && c.dependencyFields)
2017
+ if (we(c) && c.collection === s.collection && c.dependencyFields)
2018
2018
  for (const l of c.dependencyFields)
2019
2019
  l.field === t.name && (i = !0);
2020
2020
  }
@@ -2024,7 +2024,7 @@ const wy = /* @__PURE__ */ qn(vy), qr = {
2024
2024
  return r.forEach((i) => {
2025
2025
  const { labels: a, fields: o } = i;
2026
2026
  o.forEach((c) => {
2027
- ve(c) && c.collection === n.collection && c.dependencyFields && c.dependencyFields.forEach((l) => {
2027
+ we(c) && c.collection === n.collection && c.dependencyFields && c.dependencyFields.forEach((l) => {
2028
2028
  s[l.field] ||= {}, s[l.field][a.collection] ||= [], s[l.field][a.collection] = s[l.field][a.collection].concat(l.roles), s[l.field][a.collection] = [
2029
2029
  ...new Set(s[l.field][a.collection])
2030
2030
  ];
@@ -2156,7 +2156,7 @@ const wy = /* @__PURE__ */ qn(vy), qr = {
2156
2156
  if (Object.values(o).forEach((c) => {
2157
2157
  Object.keys(c).forEach((l) => {
2158
2158
  r.collections[l].fields.forEach((f) => {
2159
- ve(f) && f.collection === e.labels.collection && f.dependencyFields?.some((d) => d.field === t.name) && f.constraints && f.constraints.forEach((d) => {
2159
+ we(f) && f.collection === e.labels.collection && f.dependencyFields?.some((d) => d.field === t.name) && f.constraints && f.constraints.forEach((d) => {
2160
2160
  a.push(d[0]);
2161
2161
  });
2162
2162
  });
@@ -2210,7 +2210,7 @@ const wy = /* @__PURE__ */ qn(vy), qr = {
2210
2210
  }), s;
2211
2211
  }, Ra = async (t, e, r) => {
2212
2212
  if (e) {
2213
- const n = await we(e, [r]);
2213
+ const n = await be(e, [r]);
2214
2214
  if (n === !1)
2215
2215
  throw new Error(`CANCELLED: Operation cancelled by ${t}`);
2216
2216
  return n;
@@ -2228,10 +2228,10 @@ const sc = (t, e, r, n, s, i, a, o, c, l) => (t === "create" && (r.Collection_Pa
2228
2228
  if (n)
2229
2229
  for (const a of n) {
2230
2230
  const o = J(e, a.field);
2231
- e.find((c) => c.name === a.field) && ve(o) && ["OneToOne", "OneToMany"].includes(o.type) && i.add(o);
2231
+ e.find((c) => c.name === a.field) && we(o) && ["OneToOne", "OneToMany"].includes(o.type) && i.add(o);
2232
2232
  }
2233
2233
  return e.forEach((a) => {
2234
- ve(a) && ["OneToOne", "OneToMany"].includes(a.type) && a.sorting && (typeof a.sorting == "boolean" || !a.sorting.roles?.every((o) => s?.includes(o))) && i.add(a);
2234
+ we(a) && ["OneToOne", "OneToMany"].includes(a.type) && a.sorting && (typeof a.sorting == "boolean" || !a.sorting.roles?.every((o) => s?.includes(o))) && i.add(a);
2235
2235
  }), i;
2236
2236
  }, Kr = (t, e) => {
2237
2237
  const { access: r, recordTitleField: n } = t, { serverReadOnly: s } = r, i = /* @__PURE__ */ new Set();
@@ -2249,7 +2249,7 @@ const sc = (t, e, r, n, s, i, a, o, c, l) => (t === "create" && (r.Collection_Pa
2249
2249
  }, Lr = (t, e, r) => {
2250
2250
  const { fields: n } = t;
2251
2251
  n.forEach((i) => {
2252
- if (ve(i))
2252
+ if (we(i))
2253
2253
  if (e[i.name]) {
2254
2254
  if (ur(e[i.name]))
2255
2255
  e[`${i.name}_Array`] = e[i.name];
@@ -2285,10 +2285,10 @@ const sc = (t, e, r, n, s, i, a, o, c, l) => (t === "create" && (r.Collection_Pa
2285
2285
  const { fields: i } = e;
2286
2286
  for (const a of r.fields) {
2287
2287
  const o = J(i, a.name);
2288
- a.custom?.initialValue !== void 0 && (!o.access || Zt(o, n, e, s || {})) && (t[a.name] = await we(a.custom.initialValue, [t]), Kr(e, [o]).size === 1 && (t[`${a.name}_Lowercase`] = t[a.name].toLowerCase()));
2288
+ a.custom?.initialValue !== void 0 && (!o.access || Gt(o, n, e, s || {})) && (t[a.name] = await be(a.custom.initialValue, [t]), Kr(e, [o]).size === 1 && (t[`${a.name}_Lowercase`] = t[a.name].toLowerCase()));
2289
2289
  }
2290
2290
  for (const a of i)
2291
- (!a.access || Zt(a, n, e, s || {})) && ("autoIncrement" in a && a.autoIncrement && !t[a.name] && (t[a.name] = "Pending"), !ve(a) && a.nullable && t[a.name] === void 0 && (t[a.name] = null));
2291
+ (!a.access || Gt(a, n, e, s || {})) && ("autoIncrement" in a && a.autoIncrement && !t[a.name] && (t[a.name] = "Pending"), !we(a) && a.nullable && t[a.name] === void 0 && (t[a.name] = null));
2292
2292
  };
2293
2293
  var fe;
2294
2294
  (function(t) {
@@ -3861,12 +3861,12 @@ lt.create = (t, e) => new lt({
3861
3861
  typeName: ee.ZodArray,
3862
3862
  ...se(e)
3863
3863
  });
3864
- function rr(t) {
3864
+ function nr(t) {
3865
3865
  if (t instanceof Ce) {
3866
3866
  const e = {};
3867
3867
  for (const r in t.shape) {
3868
3868
  const n = t.shape[r];
3869
- e[r] = Ft.create(rr(n));
3869
+ e[r] = Ft.create(nr(n));
3870
3870
  }
3871
3871
  return new Ce({
3872
3872
  ...t._def,
@@ -3874,8 +3874,8 @@ function rr(t) {
3874
3874
  });
3875
3875
  } else return t instanceof lt ? new lt({
3876
3876
  ...t._def,
3877
- type: rr(t.element)
3878
- }) : t instanceof Ft ? Ft.create(rr(t.unwrap())) : t instanceof pr ? pr.create(rr(t.unwrap())) : t instanceof Gt ? Gt.create(t.items.map((e) => rr(e))) : t;
3877
+ type: nr(t.element)
3878
+ }) : t instanceof Ft ? Ft.create(nr(t.unwrap())) : t instanceof pr ? pr.create(nr(t.unwrap())) : t instanceof Ht ? Ht.create(t.items.map((e) => nr(e))) : t;
3879
3879
  }
3880
3880
  class Ce extends le {
3881
3881
  constructor() {
@@ -4110,7 +4110,7 @@ class Ce extends le {
4110
4110
  * @deprecated
4111
4111
  */
4112
4112
  deepPartial() {
4113
- return rr(this);
4113
+ return nr(this);
4114
4114
  }
4115
4115
  partial(e) {
4116
4116
  const r = {};
@@ -4301,7 +4301,7 @@ wn.create = (t, e, r) => new wn({
4301
4301
  typeName: ee.ZodIntersection,
4302
4302
  ...se(r)
4303
4303
  });
4304
- class Gt extends le {
4304
+ class Ht extends le {
4305
4305
  _parse(e) {
4306
4306
  const { status: r, ctx: n } = this._processInputParams(e);
4307
4307
  if (n.parsedType !== z.array)
@@ -4335,16 +4335,16 @@ class Gt extends le {
4335
4335
  return this._def.items;
4336
4336
  }
4337
4337
  rest(e) {
4338
- return new Gt({
4338
+ return new Ht({
4339
4339
  ...this._def,
4340
4340
  rest: e
4341
4341
  });
4342
4342
  }
4343
4343
  }
4344
- Gt.create = (t, e) => {
4344
+ Ht.create = (t, e) => {
4345
4345
  if (!Array.isArray(t))
4346
4346
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
4347
- return new Gt({
4347
+ return new Ht({
4348
4348
  items: t,
4349
4349
  typeName: ee.ZodTuple,
4350
4350
  rest: null,
@@ -4924,25 +4924,25 @@ var ee;
4924
4924
  (function(t) {
4925
4925
  t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
4926
4926
  })(ee || (ee = {}));
4927
- const ct = _t.create, vo = dr.create, r_ = fo.create, zt = ho.create;
4927
+ const ct = _t.create, vo = dr.create, r_ = fo.create, Bt = ho.create;
4928
4928
  Pt.create;
4929
4929
  const Zn = lt.create, gh = Ce.create, En = vn.create;
4930
4930
  wn.create;
4931
- Gt.create;
4931
+ Ht.create;
4932
4932
  const ac = bn.create, wo = po.create, bo = hr.create;
4933
4933
  On.create;
4934
4934
  Ft.create;
4935
4935
  pr.create;
4936
- const fn = () => zt().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds !== void 0 || t._seconds !== void 0 && t._nanoseconds !== void 0), {
4936
+ const fn = () => Bt().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds !== void 0 || t._seconds !== void 0 && t._nanoseconds !== void 0), {
4937
4937
  message: "Value is not a valid timestamp"
4938
- }), kf = () => zt().refine((t) => t && (t._methodName === "serverTimestamp" || t.constructor.name === "ServerTimestampTransform"), {
4938
+ }), kf = () => Bt().refine((t) => t && (t._methodName === "serverTimestamp" || t.constructor.name === "ServerTimestampTransform"), {
4939
4939
  message: "Value is not a valid server timestamp"
4940
4940
  }), yh = (t, e, r) => {
4941
4941
  const n = {};
4942
4942
  if (t.includeFields) {
4943
4943
  const i = e.collections[t.collection];
4944
4944
  if (!i)
4945
- return ac(zt());
4945
+ return ac(Bt());
4946
4946
  t.includeFields.forEach((a) => {
4947
4947
  const o = i.fields.find((l) => l.name === a);
4948
4948
  if (!o)
@@ -4984,7 +4984,7 @@ const fn = () => zt().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
4984
4984
  })));
4985
4985
  break;
4986
4986
  case "Timestamp":
4987
- e.name === s ? i = zt().refine((a) => a && (a._methodName === "serverTimestamp" || a.constructor.name === "ServerTimestampTransform" || a.seconds !== void 0 && a.nanoseconds !== void 0 || a._seconds !== void 0 && a._nanoseconds !== void 0), {
4987
+ e.name === s ? i = Bt().refine((a) => a && (a._methodName === "serverTimestamp" || a.constructor.name === "ServerTimestampTransform" || a.seconds !== void 0 && a.nanoseconds !== void 0 || a._seconds !== void 0 && a._nanoseconds !== void 0), {
4988
4988
  message: "Value is not a valid timestamp"
4989
4989
  }) : (i = fn(), e.min && (i = i.refine((a) => a.toMillis() >= e.min, {
4990
4990
  message: `Value is less than the minimum allowed value of ${e.min}`
@@ -4993,7 +4993,7 @@ const fn = () => zt().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
4993
4993
  })));
4994
4994
  break;
4995
4995
  case "Array":
4996
- i = Zn(zt()), e.length && (i = i.length(e.length)), e.minlength ? i = i.min(e.minlength) : e.required && (i = i.nonempty()), e.maxlength && (i = i.max(e.maxlength)), e.values && (i = i.refine((a) => {
4996
+ i = Zn(Bt()), e.length && (i = i.length(e.length)), e.minlength ? i = i.min(e.minlength) : e.required && (i = i.nonempty()), e.maxlength && (i = i.max(e.maxlength)), e.values && (i = i.refine((a) => {
4997
4997
  let o = !0;
4998
4998
  return a.forEach((c) => {
4999
4999
  e.values && !e.values.includes(c) && (o = !1);
@@ -5001,15 +5001,15 @@ const fn = () => zt().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
5001
5001
  }, { message: "Value is not an allowed value" }));
5002
5002
  break;
5003
5003
  case "Map":
5004
- i = ac(zt()), e.required && (i = i.refine((a) => a && typeof a == "object" && Object.keys(a).length > 0, {
5004
+ i = ac(Bt()), e.required && (i = i.refine((a) => a && typeof a == "object" && Object.keys(a).length > 0, {
5005
5005
  message: "Value must have at least one object property"
5006
5006
  }));
5007
5007
  break;
5008
5008
  case "Embedding":
5009
- i = zt();
5009
+ i = Bt();
5010
5010
  break;
5011
5011
  }
5012
- return !ve(e) && e.nullable && (i = i.nullable()), e.required || (i = i.optional()), i;
5012
+ return !we(e) && e.nullable && (i = i.nullable()), e.required || (i = i.optional()), i;
5013
5013
  }, i_ = (t, e, r) => {
5014
5014
  const n = {
5015
5015
  Collection_Path: Zn(ct()),
@@ -5026,7 +5026,7 @@ const fn = () => zt().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
5026
5026
  t === "create" && (n.Saved_At = kf()), t === "update" && (n.Saved_At = fn(), n.Collection_Path = n.Collection_Path.optional(), n.id = n.id.optional(), n.Created_At = n.Created_At.optional(), n.Saved_At = n.Saved_At.optional(), n.Created_By = n.Created_By.optional());
5027
5027
  const s = fh(e, e.fields), i = Array.from(s).map((c) => c.name);
5028
5028
  e.fields.forEach((c) => {
5029
- ve(c) ? (n[c.name] = n_(c, r), n[`${c.name}_Array`] = s_(c), i.includes(c.name) && (n[`${c.name}_Single`] = yh(c, r, !0), c.required || (n[`${c.name}_Single`] = n[`${c.name}_Single`].optional())), c.length && (n[c.name] = n[c.name].refine((l) => c.length && l && Object.keys(l).length === c.length, {
5029
+ we(c) ? (n[c.name] = n_(c, r), n[`${c.name}_Array`] = s_(c), i.includes(c.name) && (n[`${c.name}_Single`] = yh(c, r, !0), c.required || (n[`${c.name}_Single`] = n[`${c.name}_Single`].optional())), c.length && (n[c.name] = n[c.name].refine((l) => c.length && l && Object.keys(l).length === c.length, {
5030
5030
  message: `Value must contain ${c.length} item(s)`
5031
5031
  })), c.min && (n[c.name] = n[c.name].refine((l) => c.min && l && Object.keys(l).length >= c.min, {
5032
5032
  message: `Value must contain at least ${c.min} item(s)`
@@ -5039,33 +5039,33 @@ const fn = () => zt().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
5039
5039
  const o = gh(n);
5040
5040
  return e.allowSchemalessFields ? o.passthrough() : o.strict();
5041
5041
  };
5042
- class Jt extends Error {
5042
+ class Qt extends Error {
5043
5043
  }
5044
- class a_ extends Jt {
5044
+ class a_ extends Qt {
5045
5045
  constructor(e) {
5046
5046
  super(`Invalid DateTime: ${e.toMessage()}`);
5047
5047
  }
5048
5048
  }
5049
- class o_ extends Jt {
5049
+ class o_ extends Qt {
5050
5050
  constructor(e) {
5051
5051
  super(`Invalid Interval: ${e.toMessage()}`);
5052
5052
  }
5053
5053
  }
5054
- class c_ extends Jt {
5054
+ class c_ extends Qt {
5055
5055
  constructor(e) {
5056
5056
  super(`Invalid Duration: ${e.toMessage()}`);
5057
5057
  }
5058
5058
  }
5059
- class sr extends Jt {
5059
+ class ir extends Qt {
5060
5060
  }
5061
- class _h extends Jt {
5061
+ class _h extends Qt {
5062
5062
  constructor(e) {
5063
5063
  super(`Invalid unit ${e}`);
5064
5064
  }
5065
5065
  }
5066
- class Pe extends Jt {
5066
+ class Pe extends Qt {
5067
5067
  }
5068
- class Rt extends Jt {
5068
+ class Rt extends Qt {
5069
5069
  constructor() {
5070
5070
  super("Zone is an abstract class");
5071
5071
  }
@@ -5666,7 +5666,7 @@ class me {
5666
5666
  );
5667
5667
  }
5668
5668
  static create(e, r, n, s, i = !1) {
5669
- const a = e || Se.defaultLocale, o = a || (i ? "en-US" : __()), c = r || Se.defaultNumberingSystem, l = n || Se.defaultOutputCalendar, u = Io(s) || Se.defaultWeekSettings;
5669
+ const a = e || Te.defaultLocale, o = a || (i ? "en-US" : __()), c = r || Te.defaultNumberingSystem, l = n || Te.defaultOutputCalendar, u = Io(s) || Te.defaultWeekSettings;
5670
5670
  return new me(o, c, l, u, a);
5671
5671
  }
5672
5672
  static resetCache() {
@@ -6023,7 +6023,7 @@ function tt({ numberingSystem: t }, e = "") {
6023
6023
  return s === void 0 && (s = new RegExp(`${oc[r]}${e}`), n.set(e, s)), s;
6024
6024
  }
6025
6025
  let Ff = () => Date.now(), Nf = "system", Df = null, Pf = null, Mf = null, qf = 60, Lf, $f = null;
6026
- class Se {
6026
+ class Te {
6027
6027
  /**
6028
6028
  * Get the callback for returning the current timestamp.
6029
6029
  * @type {function}
@@ -6216,7 +6216,7 @@ function Vf(t) {
6216
6216
  function Uf(t, e) {
6217
6217
  if (!Q(t.localWeekday) || !Q(t.localWeekNumber) || !Q(t.localWeekYear)) {
6218
6218
  if (!Q(t.weekday) || !Q(t.weekNumber) || !Q(t.weekYear))
6219
- throw new sr(
6219
+ throw new ir(
6220
6220
  "Cannot mix locale-based week fields with ISO-based week fields"
6221
6221
  );
6222
6222
  return Q(t.localWeekday) || (t.weekday = t.localWeekday), Q(t.localWeekNumber) || (t.weekNumber = t.localWeekNumber), Q(t.localWeekYear) || (t.weekYear = t.localWeekYear), delete t.localWeekday, delete t.localWeekNumber, delete t.localWeekYear, {
@@ -6376,7 +6376,7 @@ function zr(t, e = 4, r = 1) {
6376
6376
  return (or(t) - n + s) / 7;
6377
6377
  }
6378
6378
  function xo(t) {
6379
- return t > 99 ? t : t > Se.twoDigitCutoffYear ? 1900 + t : 2e3 + t;
6379
+ return t > 99 ? t : t > Te.twoDigitCutoffYear ? 1900 + t : 2e3 + t;
6380
6380
  }
6381
6381
  function Hh(t, e, r, n = null) {
6382
6382
  const s = new Date(t), i = {
@@ -7049,7 +7049,7 @@ const Gf = "Invalid Duration", lm = {
7049
7049
  milliseconds: 720 * 60 * 60 * 1e3
7050
7050
  },
7051
7051
  ...lm
7052
- }, Ge = 146097 / 400, Xt = 146097 / 4800, Pv = {
7052
+ }, Ge = 146097 / 400, er = 146097 / 4800, Pv = {
7053
7053
  years: {
7054
7054
  quarters: 4,
7055
7055
  months: 12,
@@ -7070,15 +7070,15 @@ const Gf = "Invalid Duration", lm = {
7070
7070
  milliseconds: Ge * 24 * 60 * 60 * 1e3 / 4
7071
7071
  },
7072
7072
  months: {
7073
- weeks: Xt / 7,
7074
- days: Xt,
7075
- hours: Xt * 24,
7076
- minutes: Xt * 24 * 60,
7077
- seconds: Xt * 24 * 60 * 60,
7078
- milliseconds: Xt * 24 * 60 * 60 * 1e3
7073
+ weeks: er / 7,
7074
+ days: er,
7075
+ hours: er * 24,
7076
+ minutes: er * 24 * 60,
7077
+ seconds: er * 24 * 60 * 60,
7078
+ milliseconds: er * 24 * 60 * 60 * 1e3
7079
7079
  },
7080
7080
  ...lm
7081
- }, Bt = [
7081
+ }, Zt = [
7082
7082
  "years",
7083
7083
  "quarters",
7084
7084
  "months",
@@ -7088,7 +7088,7 @@ const Gf = "Invalid Duration", lm = {
7088
7088
  "minutes",
7089
7089
  "seconds",
7090
7090
  "milliseconds"
7091
- ], Mv = Bt.slice(0).reverse();
7091
+ ], Mv = Zt.slice(0).reverse();
7092
7092
  function mt(t, e, r = !1) {
7093
7093
  const n = {
7094
7094
  values: r ? e.values : { ...t.values, ...e.values || {} },
@@ -7106,7 +7106,7 @@ function um(t, e) {
7106
7106
  }
7107
7107
  function Hf(t, e) {
7108
7108
  const r = um(t, e) < 0 ? -1 : 1;
7109
- Bt.reduceRight((n, s) => {
7109
+ Zt.reduceRight((n, s) => {
7110
7110
  if (Q(e[s]))
7111
7111
  return n;
7112
7112
  if (n) {
@@ -7114,7 +7114,7 @@ function Hf(t, e) {
7114
7114
  e[s] += o * r, e[n] -= o * a * r;
7115
7115
  }
7116
7116
  return s;
7117
- }, null), Bt.reduce((n, s) => {
7117
+ }, null), Zt.reduce((n, s) => {
7118
7118
  if (Q(e[s]))
7119
7119
  return n;
7120
7120
  if (n) {
@@ -7252,7 +7252,7 @@ class ue {
7252
7252
  if (!e)
7253
7253
  throw new Pe("need to specify a reason the Duration is invalid");
7254
7254
  const n = e instanceof st ? e : new st(e, r);
7255
- if (Se.throwOnInvalid)
7255
+ if (Te.throwOnInvalid)
7256
7256
  throw new c_(n);
7257
7257
  return new ue({ invalid: n });
7258
7258
  }
@@ -7357,7 +7357,7 @@ class ue {
7357
7357
  */
7358
7358
  toHuman(e = {}) {
7359
7359
  if (!this.isValid) return Gf;
7360
- const r = e.showZeros !== !1, n = Bt.map((s) => {
7360
+ const r = e.showZeros !== !1, n = Zt.map((s) => {
7361
7361
  const i = this.values[s];
7362
7362
  return Q(i) || i === 0 && !r ? null : this.loc.numberFormatter({ style: "unit", unitDisplay: "long", ...e, unit: s.slice(0, -1) }).format(i);
7363
7363
  }).filter((s) => s);
@@ -7457,7 +7457,7 @@ class ue {
7457
7457
  plus(e) {
7458
7458
  if (!this.isValid) return this;
7459
7459
  const r = ue.fromDurationLike(e), n = {};
7460
- for (const s of Bt)
7460
+ for (const s of Zt)
7461
7461
  (gr(r.values, s) || gr(this.values, s)) && (n[s] = r.get(s) + this.get(s));
7462
7462
  return mt(this, { values: n }, !0);
7463
7463
  }
@@ -7570,7 +7570,7 @@ class ue {
7570
7570
  e = e.map((a) => ue.normalizeUnit(a));
7571
7571
  const r = {}, n = {}, s = this.toObject();
7572
7572
  let i;
7573
- for (const a of Bt)
7573
+ for (const a of Zt)
7574
7574
  if (e.indexOf(a) >= 0) {
7575
7575
  i = a;
7576
7576
  let o = 0;
@@ -7720,20 +7720,20 @@ class ue {
7720
7720
  function r(n, s) {
7721
7721
  return n === void 0 || n === 0 ? s === void 0 || s === 0 : n === s;
7722
7722
  }
7723
- for (const n of Bt)
7723
+ for (const n of Zt)
7724
7724
  if (!r(this.values[n], e.values[n]))
7725
7725
  return !1;
7726
7726
  return !0;
7727
7727
  }
7728
7728
  }
7729
- const er = "Invalid Interval";
7729
+ const tr = "Invalid Interval";
7730
7730
  function qv(t, e) {
7731
- return !t || !t.isValid ? Ee.invalid("missing or invalid start") : !e || !e.isValid ? Ee.invalid("missing or invalid end") : e < t ? Ee.invalid(
7731
+ return !t || !t.isValid ? Se.invalid("missing or invalid start") : !e || !e.isValid ? Se.invalid("missing or invalid end") : e < t ? Se.invalid(
7732
7732
  "end before start",
7733
7733
  `The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`
7734
7734
  ) : null;
7735
7735
  }
7736
- class Ee {
7736
+ class Se {
7737
7737
  /**
7738
7738
  * @private
7739
7739
  */
@@ -7750,9 +7750,9 @@ class Ee {
7750
7750
  if (!e)
7751
7751
  throw new Pe("need to specify a reason the Interval is invalid");
7752
7752
  const n = e instanceof st ? e : new st(e, r);
7753
- if (Se.throwOnInvalid)
7753
+ if (Te.throwOnInvalid)
7754
7754
  throw new o_(n);
7755
- return new Ee({ invalid: n });
7755
+ return new Se({ invalid: n });
7756
7756
  }
7757
7757
  /**
7758
7758
  * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.
@@ -7762,7 +7762,7 @@ class Ee {
7762
7762
  */
7763
7763
  static fromDateTimes(e, r) {
7764
7764
  const n = Tr(e), s = Tr(r), i = qv(n, s);
7765
- return i ?? new Ee({
7765
+ return i ?? new Se({
7766
7766
  start: n,
7767
7767
  end: s
7768
7768
  });
@@ -7775,7 +7775,7 @@ class Ee {
7775
7775
  */
7776
7776
  static after(e, r) {
7777
7777
  const n = ue.fromDurationLike(r), s = Tr(e);
7778
- return Ee.fromDateTimes(s, s.plus(n));
7778
+ return Se.fromDateTimes(s, s.plus(n));
7779
7779
  }
7780
7780
  /**
7781
7781
  * Create an Interval from an end DateTime and a Duration to extend backwards to.
@@ -7785,7 +7785,7 @@ class Ee {
7785
7785
  */
7786
7786
  static before(e, r) {
7787
7787
  const n = ue.fromDurationLike(r), s = Tr(e);
7788
- return Ee.fromDateTimes(s.minus(n), s);
7788
+ return Se.fromDateTimes(s.minus(n), s);
7789
7789
  }
7790
7790
  /**
7791
7791
  * Create an Interval from an ISO 8601 string.
@@ -7811,18 +7811,18 @@ class Ee {
7811
7811
  c = !1;
7812
7812
  }
7813
7813
  if (a && c)
7814
- return Ee.fromDateTimes(i, o);
7814
+ return Se.fromDateTimes(i, o);
7815
7815
  if (a) {
7816
7816
  const l = ue.fromISO(s, r);
7817
7817
  if (l.isValid)
7818
- return Ee.after(i, l);
7818
+ return Se.after(i, l);
7819
7819
  } else if (c) {
7820
7820
  const l = ue.fromISO(n, r);
7821
7821
  if (l.isValid)
7822
- return Ee.before(o, l);
7822
+ return Se.before(o, l);
7823
7823
  }
7824
7824
  }
7825
- return Ee.invalid("unparsable", `the input "${e}" can't be parsed as ISO 8601`);
7825
+ return Se.invalid("unparsable", `the input "${e}" can't be parsed as ISO 8601`);
7826
7826
  }
7827
7827
  /**
7828
7828
  * Check if an object is an Interval. Works across context boundaries
@@ -7945,7 +7945,7 @@ class Ee {
7945
7945
  * @return {Interval}
7946
7946
  */
7947
7947
  set({ start: e, end: r } = {}) {
7948
- return this.isValid ? Ee.fromDateTimes(e || this.s, r || this.e) : this;
7948
+ return this.isValid ? Se.fromDateTimes(e || this.s, r || this.e) : this;
7949
7949
  }
7950
7950
  /**
7951
7951
  * Split this Interval at each of the specified DateTimes
@@ -7958,7 +7958,7 @@ class Ee {
7958
7958
  let { s } = this, i = 0;
7959
7959
  for (; s < this.e; ) {
7960
7960
  const a = r[i] || this.e, o = +a > +this.e ? this.e : a;
7961
- n.push(Ee.fromDateTimes(s, o)), s = o, i += 1;
7961
+ n.push(Se.fromDateTimes(s, o)), s = o, i += 1;
7962
7962
  }
7963
7963
  return n;
7964
7964
  }
@@ -7976,7 +7976,7 @@ class Ee {
7976
7976
  const a = [];
7977
7977
  for (; n < this.e; ) {
7978
7978
  const o = this.start.plus(r.mapUnits((c) => c * s));
7979
- i = +o > +this.e ? this.e : o, a.push(Ee.fromDateTimes(n, i)), n = i, s += 1;
7979
+ i = +o > +this.e ? this.e : o, a.push(Se.fromDateTimes(n, i)), n = i, s += 1;
7980
7980
  }
7981
7981
  return a;
7982
7982
  }
@@ -8038,7 +8038,7 @@ class Ee {
8038
8038
  intersection(e) {
8039
8039
  if (!this.isValid) return this;
8040
8040
  const r = this.s > e.s ? this.s : e.s, n = this.e < e.e ? this.e : e.e;
8041
- return r >= n ? null : Ee.fromDateTimes(r, n);
8041
+ return r >= n ? null : Se.fromDateTimes(r, n);
8042
8042
  }
8043
8043
  /**
8044
8044
  * Return an Interval representing the union of this Interval and the specified Interval.
@@ -8049,7 +8049,7 @@ class Ee {
8049
8049
  union(e) {
8050
8050
  if (!this.isValid) return this;
8051
8051
  const r = this.s < e.s ? this.s : e.s, n = this.e > e.e ? this.e : e.e;
8052
- return Ee.fromDateTimes(r, n);
8052
+ return Se.fromDateTimes(r, n);
8053
8053
  }
8054
8054
  /**
8055
8055
  * Merge an array of Intervals into an equivalent minimal set of Intervals.
@@ -8079,8 +8079,8 @@ class Ee {
8079
8079
  { time: c.e, type: "e" }
8080
8080
  ]), a = Array.prototype.concat(...i), o = a.sort((c, l) => c.time - l.time);
8081
8081
  for (const c of o)
8082
- n += c.type === "s" ? 1 : -1, n === 1 ? r = c.time : (r && +r != +c.time && s.push(Ee.fromDateTimes(r, c.time)), r = null);
8083
- return Ee.merge(s);
8082
+ n += c.type === "s" ? 1 : -1, n === 1 ? r = c.time : (r && +r != +c.time && s.push(Se.fromDateTimes(r, c.time)), r = null);
8083
+ return Se.merge(s);
8084
8084
  }
8085
8085
  /**
8086
8086
  * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.
@@ -8088,14 +8088,14 @@ class Ee {
8088
8088
  * @return {Array}
8089
8089
  */
8090
8090
  difference(...e) {
8091
- return Ee.xor([this].concat(e)).map((r) => this.intersection(r)).filter((r) => r && !r.isEmpty());
8091
+ return Se.xor([this].concat(e)).map((r) => this.intersection(r)).filter((r) => r && !r.isEmpty());
8092
8092
  }
8093
8093
  /**
8094
8094
  * Returns a string representation of this Interval appropriate for debugging.
8095
8095
  * @return {string}
8096
8096
  */
8097
8097
  toString() {
8098
- return this.isValid ? `[${this.s.toISO()} – ${this.e.toISO()})` : er;
8098
+ return this.isValid ? `[${this.s.toISO()} – ${this.e.toISO()})` : tr;
8099
8099
  }
8100
8100
  /**
8101
8101
  * Returns a string representation of this Interval appropriate for the REPL.
@@ -8123,7 +8123,7 @@ class Ee {
8123
8123
  * @return {string}
8124
8124
  */
8125
8125
  toLocaleString(e = Tn, r = {}) {
8126
- return this.isValid ? Me.create(this.s.loc.clone(r), e).formatInterval(this) : er;
8126
+ return this.isValid ? Me.create(this.s.loc.clone(r), e).formatInterval(this) : tr;
8127
8127
  }
8128
8128
  /**
8129
8129
  * Returns an ISO 8601-compliant string representation of this Interval.
@@ -8132,7 +8132,7 @@ class Ee {
8132
8132
  * @return {string}
8133
8133
  */
8134
8134
  toISO(e) {
8135
- return this.isValid ? `${this.s.toISO(e)}/${this.e.toISO(e)}` : er;
8135
+ return this.isValid ? `${this.s.toISO(e)}/${this.e.toISO(e)}` : tr;
8136
8136
  }
8137
8137
  /**
8138
8138
  * Returns an ISO 8601-compliant string representation of date of this Interval.
@@ -8141,7 +8141,7 @@ class Ee {
8141
8141
  * @return {string}
8142
8142
  */
8143
8143
  toISODate() {
8144
- return this.isValid ? `${this.s.toISODate()}/${this.e.toISODate()}` : er;
8144
+ return this.isValid ? `${this.s.toISODate()}/${this.e.toISODate()}` : tr;
8145
8145
  }
8146
8146
  /**
8147
8147
  * Returns an ISO 8601-compliant string representation of time of this Interval.
@@ -8151,7 +8151,7 @@ class Ee {
8151
8151
  * @return {string}
8152
8152
  */
8153
8153
  toISOTime(e) {
8154
- return this.isValid ? `${this.s.toISOTime(e)}/${this.e.toISOTime(e)}` : er;
8154
+ return this.isValid ? `${this.s.toISOTime(e)}/${this.e.toISOTime(e)}` : tr;
8155
8155
  }
8156
8156
  /**
8157
8157
  * Returns a string representation of this Interval formatted according to the specified format
@@ -8165,7 +8165,7 @@ class Ee {
8165
8165
  * @return {string}
8166
8166
  */
8167
8167
  toFormat(e, { separator: r = " – " } = {}) {
8168
- return this.isValid ? `${this.s.toFormat(e)}${r}${this.e.toFormat(e)}` : er;
8168
+ return this.isValid ? `${this.s.toFormat(e)}${r}${this.e.toFormat(e)}` : tr;
8169
8169
  }
8170
8170
  /**
8171
8171
  * Return a Duration representing the time spanned by this interval.
@@ -8190,7 +8190,7 @@ class Ee {
8190
8190
  * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))
8191
8191
  */
8192
8192
  mapEndpoints(e) {
8193
- return Ee.fromDateTimes(e(this.s), e(this.e));
8193
+ return Se.fromDateTimes(e(this.s), e(this.e));
8194
8194
  }
8195
8195
  }
8196
8196
  class on {
@@ -8199,7 +8199,7 @@ class on {
8199
8199
  * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.
8200
8200
  * @return {boolean}
8201
8201
  */
8202
- static hasDST(e = Se.defaultZone) {
8202
+ static hasDST(e = Te.defaultZone) {
8203
8203
  const r = Y.now().setZone(e).set({ month: 12 });
8204
8204
  return !e.isUniversal && r.offset !== r.set({ month: 6 }).offset;
8205
8205
  }
@@ -8226,7 +8226,7 @@ class on {
8226
8226
  * @return {Zone}
8227
8227
  */
8228
8228
  static normalizeZone(e) {
8229
- return xt(e, Se.defaultZone);
8229
+ return xt(e, Te.defaultZone);
8230
8230
  }
8231
8231
  /**
8232
8232
  * Get the weekday on which the week starts according to the given locale.
@@ -8690,7 +8690,7 @@ class mm {
8690
8690
  if (this.isValid) {
8691
8691
  const [r, n] = Hv(e, this.regex, this.handlers), [s, i, a] = n ? Kv(n) : [null, null, void 0];
8692
8692
  if (gr(n, "a") && gr(n, "H"))
8693
- throw new sr(
8693
+ throw new ir(
8694
8694
  "Can't include meridiem when specifying 24-hour format"
8695
8695
  );
8696
8696
  return {
@@ -8796,7 +8796,7 @@ function ed(t, e) {
8796
8796
  let [c, l] = ym(o, r, t.zone);
8797
8797
  return a !== 0 && (c += a, l = t.zone.offset(c)), { ts: c, o: l };
8798
8798
  }
8799
- function tr(t, e, r, n, s, i) {
8799
+ function rr(t, e, r, n, s, i) {
8800
8800
  const { setZone: a, zone: o } = r;
8801
8801
  if (t && Object.keys(t).length !== 0 || e) {
8802
8802
  const c = e || o, l = Y.fromObject(t, {
@@ -8922,20 +8922,20 @@ function rd(t) {
8922
8922
  }
8923
8923
  }
8924
8924
  function nw(t) {
8925
- if (Nr === void 0 && (Nr = Se.now()), t.type !== "iana")
8925
+ if (Nr === void 0 && (Nr = Te.now()), t.type !== "iana")
8926
8926
  return t.offset(Nr);
8927
8927
  const e = t.name;
8928
8928
  let r = Fo.get(e);
8929
8929
  return r === void 0 && (r = t.offset(Nr), Fo.set(e, r)), r;
8930
8930
  }
8931
8931
  function nd(t, e) {
8932
- const r = xt(e.zone, Se.defaultZone);
8932
+ const r = xt(e.zone, Te.defaultZone);
8933
8933
  if (!r.isValid)
8934
8934
  return Y.invalid(Fr(r));
8935
8935
  const n = me.fromObject(e);
8936
8936
  let s, i;
8937
8937
  if (Q(t.year))
8938
- s = Se.now();
8938
+ s = Te.now();
8939
8939
  else {
8940
8940
  for (const c of hn)
8941
8941
  Q(t[c]) && (t[c] = _m[c]);
@@ -8969,9 +8969,9 @@ class Y {
8969
8969
  * @access private
8970
8970
  */
8971
8971
  constructor(e) {
8972
- const r = e.zone || Se.defaultZone;
8972
+ const r = e.zone || Te.defaultZone;
8973
8973
  let n = e.invalid || (Number.isNaN(e.ts) ? new st("invalid input") : null) || (r.isValid ? null : Fr(r));
8974
- this.ts = Q(e.ts) ? Se.now() : e.ts;
8974
+ this.ts = Q(e.ts) ? Te.now() : e.ts;
8975
8975
  let s = null, i = null;
8976
8976
  if (!n)
8977
8977
  if (e.old && e.old.ts === this.ts && e.old.zone.equals(r))
@@ -9058,7 +9058,7 @@ class Y {
9058
9058
  const n = P_(e) ? e.valueOf() : NaN;
9059
9059
  if (Number.isNaN(n))
9060
9060
  return Y.invalid("invalid input");
9061
- const s = xt(r.zone, Se.defaultZone);
9061
+ const s = xt(r.zone, Te.defaultZone);
9062
9062
  return s.isValid ? new Y({
9063
9063
  ts: n,
9064
9064
  zone: s,
@@ -9080,7 +9080,7 @@ class Y {
9080
9080
  if (Nt(e))
9081
9081
  return e < -Xf || e > Xf ? Y.invalid("Timestamp out of range") : new Y({
9082
9082
  ts: e,
9083
- zone: xt(r.zone, Se.defaultZone),
9083
+ zone: xt(r.zone, Te.defaultZone),
9084
9084
  loc: me.fromObject(r)
9085
9085
  });
9086
9086
  throw new Pe(
@@ -9102,7 +9102,7 @@ class Y {
9102
9102
  if (Nt(e))
9103
9103
  return new Y({
9104
9104
  ts: e * 1e3,
9105
- zone: xt(r.zone, Se.defaultZone),
9105
+ zone: xt(r.zone, Te.defaultZone),
9106
9106
  loc: me.fromObject(r)
9107
9107
  });
9108
9108
  throw new Pe("fromSeconds requires a numerical input");
@@ -9142,16 +9142,16 @@ class Y {
9142
9142
  */
9143
9143
  static fromObject(e, r = {}) {
9144
9144
  e = e || {};
9145
- const n = xt(r.zone, Se.defaultZone);
9145
+ const n = xt(r.zone, Te.defaultZone);
9146
9146
  if (!n.isValid)
9147
9147
  return Y.invalid(Fr(n));
9148
- const s = me.fromObject(r), i = Cn(e, rd), { minDaysInFirstWeek: a, startOfWeek: o } = Uf(i, s), c = Se.now(), l = Q(r.specificOffset) ? n.offset(c) : r.specificOffset, u = !Q(i.ordinal), f = !Q(i.year), d = !Q(i.month) || !Q(i.day), h = f || d, p = i.weekYear || i.weekNumber;
9148
+ const s = me.fromObject(r), i = Cn(e, rd), { minDaysInFirstWeek: a, startOfWeek: o } = Uf(i, s), c = Te.now(), l = Q(r.specificOffset) ? n.offset(c) : r.specificOffset, u = !Q(i.ordinal), f = !Q(i.year), d = !Q(i.month) || !Q(i.day), h = f || d, p = i.weekYear || i.weekNumber;
9149
9149
  if ((h || u) && p)
9150
- throw new sr(
9150
+ throw new ir(
9151
9151
  "Can't mix weekYear/weekNumber units with year/month/day or ordinals"
9152
9152
  );
9153
9153
  if (d && u)
9154
- throw new sr("Can't mix ordinal dates with month/day");
9154
+ throw new ir("Can't mix ordinal dates with month/day");
9155
9155
  const v = p || i.weekday && !h;
9156
9156
  let g, w, E = ln(c, l);
9157
9157
  v ? (g = tw, w = Xv, E = Rn(E, a, o)) : u ? (g = rw, w = ew, E = xa(E)) : (g = hn, w = _m);
@@ -9193,7 +9193,7 @@ class Y {
9193
9193
  */
9194
9194
  static fromISO(e, r = {}) {
9195
9195
  const [n, s] = Sv(e);
9196
- return tr(n, s, r, "ISO 8601", e);
9196
+ return rr(n, s, r, "ISO 8601", e);
9197
9197
  }
9198
9198
  /**
9199
9199
  * Create a DateTime from an RFC 2822 string
@@ -9212,7 +9212,7 @@ class Y {
9212
9212
  */
9213
9213
  static fromRFC2822(e, r = {}) {
9214
9214
  const [n, s] = Tv(e);
9215
- return tr(n, s, r, "RFC 2822", e);
9215
+ return rr(n, s, r, "RFC 2822", e);
9216
9216
  }
9217
9217
  /**
9218
9218
  * Create a DateTime from an HTTP header date
@@ -9232,7 +9232,7 @@ class Y {
9232
9232
  */
9233
9233
  static fromHTTP(e, r = {}) {
9234
9234
  const [n, s] = Rv(e);
9235
- return tr(n, s, r, "HTTP", r);
9235
+ return rr(n, s, r, "HTTP", r);
9236
9236
  }
9237
9237
  /**
9238
9238
  * Create a DateTime from an input string and format string.
@@ -9256,7 +9256,7 @@ class Y {
9256
9256
  numberingSystem: i,
9257
9257
  defaultToEN: !0
9258
9258
  }), [o, c, l, u] = Qv(a, e, r);
9259
- return u ? Y.invalid(u) : tr(o, c, n, `format ${r}`, e, l);
9259
+ return u ? Y.invalid(u) : rr(o, c, n, `format ${r}`, e, l);
9260
9260
  }
9261
9261
  /**
9262
9262
  * @deprecated use fromFormat instead
@@ -9287,7 +9287,7 @@ class Y {
9287
9287
  */
9288
9288
  static fromSQL(e, r = {}) {
9289
9289
  const [n, s] = Nv(e);
9290
- return tr(n, s, r, "SQL", e);
9290
+ return rr(n, s, r, "SQL", e);
9291
9291
  }
9292
9292
  /**
9293
9293
  * Create an invalid DateTime.
@@ -9299,7 +9299,7 @@ class Y {
9299
9299
  if (!e)
9300
9300
  throw new Pe("need to specify a reason the DateTime is invalid");
9301
9301
  const n = e instanceof st ? e : new st(e, r);
9302
- if (Se.throwOnInvalid)
9302
+ if (Te.throwOnInvalid)
9303
9303
  throw new a_(n);
9304
9304
  return new Y({ invalid: n });
9305
9305
  }
@@ -9718,7 +9718,7 @@ class Y {
9718
9718
  * @return {DateTime}
9719
9719
  */
9720
9720
  toLocal() {
9721
- return this.setZone(Se.defaultZone);
9721
+ return this.setZone(Te.defaultZone);
9722
9722
  }
9723
9723
  /**
9724
9724
  * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime.
@@ -9730,7 +9730,7 @@ class Y {
9730
9730
  * @return {DateTime}
9731
9731
  */
9732
9732
  setZone(e, { keepLocalTime: r = !1, keepCalendarTime: n = !1 } = {}) {
9733
- if (e = xt(e, Se.defaultZone), e.equals(this.zone))
9733
+ if (e = xt(e, Te.defaultZone), e.equals(this.zone))
9734
9734
  return this;
9735
9735
  if (e.isValid) {
9736
9736
  let s = this.ts;
@@ -9778,11 +9778,11 @@ class Y {
9778
9778
  if (!this.isValid) return this;
9779
9779
  const r = Cn(e, rd), { minDaysInFirstWeek: n, startOfWeek: s } = Uf(r, this.loc), i = !Q(r.weekYear) || !Q(r.weekNumber) || !Q(r.weekday), a = !Q(r.ordinal), o = !Q(r.year), c = !Q(r.month) || !Q(r.day), l = o || c, u = r.weekYear || r.weekNumber;
9780
9780
  if ((l || a) && u)
9781
- throw new sr(
9781
+ throw new ir(
9782
9782
  "Can't mix weekYear/weekNumber units with year/month/day or ordinals"
9783
9783
  );
9784
9784
  if (c && a)
9785
- throw new sr("Can't mix ordinal dates with month/day");
9785
+ throw new ir("Can't mix ordinal dates with month/day");
9786
9786
  let f;
9787
9787
  i ? f = jf(
9788
9788
  { ...Rn(this.c, n, s), ...r },
@@ -10209,7 +10209,7 @@ class Y {
10209
10209
  * @return {Interval|DateTime}
10210
10210
  */
10211
10211
  until(e) {
10212
- return this.isValid ? Ee.fromDateTimes(this, e) : this;
10212
+ return this.isValid ? Se.fromDateTimes(this, e) : this;
10213
10213
  }
10214
10214
  /**
10215
10215
  * Return whether this DateTime is in the same unit of time as another DateTime.
@@ -10375,7 +10375,7 @@ class Y {
10375
10375
  `fromFormatParser called with a locale of ${a}, but the format parser was created for ${r.locale}`
10376
10376
  );
10377
10377
  const { result: o, zone: c, specificOffset: l, invalidReason: u } = r.explainFromTokens(e);
10378
- return u ? Y.invalid(u) : tr(
10378
+ return u ? Y.invalid(u) : rr(
10379
10379
  o,
10380
10380
  c,
10381
10381
  n,
@@ -10553,7 +10553,7 @@ function Tr(t) {
10553
10553
  }
10554
10554
  const ad = async (t, e) => {
10555
10555
  if (t) {
10556
- const r = await we(t, [e]);
10556
+ const r = await be(t, [e]);
10557
10557
  if (!r.valid)
10558
10558
  throw new Error(r.message);
10559
10559
  }
@@ -10572,8 +10572,8 @@ const ad = async (t, e) => {
10572
10572
  }), _.forEach((O) => {
10573
10573
  if (Oy(O, a, i)) {
10574
10574
  const N = Sy(O, a, i), m = {};
10575
- s[O.name] !== void 0 && (m[O.name] = s[O.name], ve(O) && (m[`${O.name}_Array`] = s[`${O.name}_Array`])), N.forEach((R) => {
10576
- s[R.name] !== void 0 && (ve(R) ? m[`${R.name}_Array`] = s[`${R.name}_Array`] : m[R.name] = s[R.name]);
10575
+ s[O.name] !== void 0 && (m[O.name] = s[O.name], we(O) && (m[`${O.name}_Array`] = s[`${O.name}_Array`])), N.forEach((R) => {
10576
+ s[R.name] !== void 0 && (we(R) ? m[`${R.name}_Array`] = s[`${R.name}_Array`] : m[R.name] = s[R.name]);
10577
10577
  }), Object.keys(m).length > 0 && (t === "create" && (m.Collection_Path = r, m.Collection_Path_String = r.join("/"), e.set(d(O), m)), t === "update" && e.update(d(O), m), t === "delete" && e.delete(d(O)));
10578
10578
  }
10579
10579
  });
@@ -10605,7 +10605,7 @@ const ad = async (t, e) => {
10605
10605
  }
10606
10606
  if (t === "delete")
10607
10607
  return;
10608
- const T = _.filter((O) => ve(O) && O.twoWay);
10608
+ const T = _.filter((O) => we(O) && O.twoWay);
10609
10609
  if (!o?.noTwoWay) {
10610
10610
  for (const O of T)
10611
10611
  throw new Error("VALIDATION_ERROR: batchSize is required");
@@ -10808,10 +10808,10 @@ var Xa, Ed;
10808
10808
  function vw() {
10809
10809
  if (Ed) return Xa;
10810
10810
  Ed = 1;
10811
- var t = Wo(), e = sw(), r = ec(), n = iw(), s = aw(), i = nh(), a = ih(), o = ow(), c = cw(), l = Xd(), u = lw(), f = zn(), d = uw(), h = mw(), p = ah(), v = Mt(), g = Un(), w = gw(), E = bt(), x = _w(), k = Yo(), _ = Hr(), b = 1, F = 2, T = 4, O = "[object Arguments]", N = "[object Array]", m = "[object Boolean]", R = "[object Date]", S = "[object Error]", y = "[object Function]", A = "[object GeneratorFunction]", I = "[object Map]", G = "[object Number]", C = "[object Object]", P = "[object RegExp]", M = "[object Set]", K = "[object String]", oe = "[object Symbol]", ce = "[object WeakMap]", B = "[object ArrayBuffer]", V = "[object DataView]", te = "[object Float32Array]", Re = "[object Float64Array]", xe = "[object Int8Array]", et = "[object Int16Array]", Et = "[object Int32Array]", Ve = "[object Uint8Array]", L = "[object Uint8ClampedArray]", X = "[object Uint16Array]", W = "[object Uint32Array]", $ = {};
10812
- $[O] = $[N] = $[B] = $[V] = $[m] = $[R] = $[te] = $[Re] = $[xe] = $[et] = $[Et] = $[I] = $[G] = $[C] = $[P] = $[M] = $[K] = $[oe] = $[Ve] = $[L] = $[X] = $[W] = !0, $[S] = $[y] = $[ce] = !1;
10813
- function U(H, Oe, pe, Ae, ie, Fe) {
10814
- var Ie, St = Oe & b, Qt = Oe & F, Ac = Oe & T;
10811
+ var t = Wo(), e = sw(), r = ec(), n = iw(), s = aw(), i = nh(), a = ih(), o = ow(), c = cw(), l = Xd(), u = lw(), f = zn(), d = uw(), h = mw(), p = ah(), v = Mt(), g = Un(), w = gw(), E = bt(), x = _w(), k = Yo(), _ = Hr(), b = 1, F = 2, T = 4, O = "[object Arguments]", N = "[object Array]", m = "[object Boolean]", R = "[object Date]", S = "[object Error]", y = "[object Function]", A = "[object GeneratorFunction]", I = "[object Map]", G = "[object Number]", C = "[object Object]", P = "[object RegExp]", M = "[object Set]", K = "[object String]", oe = "[object Symbol]", ce = "[object WeakMap]", B = "[object ArrayBuffer]", V = "[object DataView]", te = "[object Float32Array]", _e = "[object Float64Array]", xe = "[object Int8Array]", et = "[object Int16Array]", Et = "[object Int32Array]", Ve = "[object Uint8Array]", L = "[object Uint8ClampedArray]", X = "[object Uint16Array]", W = "[object Uint32Array]", $ = {};
10812
+ $[O] = $[N] = $[B] = $[V] = $[m] = $[R] = $[te] = $[_e] = $[xe] = $[et] = $[Et] = $[I] = $[G] = $[C] = $[P] = $[M] = $[K] = $[oe] = $[Ve] = $[L] = $[X] = $[W] = !0, $[S] = $[y] = $[ce] = !1;
10813
+ function U(H, Ee, pe, Ae, ie, Fe) {
10814
+ var Ie, St = Ee & b, Xt = Ee & F, Ac = Ee & T;
10815
10815
  if (pe && (Ie = ie ? pe(H, Ae, ie, Fe) : pe(H)), Ie !== void 0)
10816
10816
  return Ie;
10817
10817
  if (!E(H))
@@ -10825,8 +10825,8 @@ function vw() {
10825
10825
  if (g(H))
10826
10826
  return i(H, St);
10827
10827
  if (ot == C || ot == O || Cc && !ie) {
10828
- if (Ie = Qt || Cc ? {} : p(H), !St)
10829
- return Qt ? c(H, s(Ie, H)) : o(H, n(Ie, H));
10828
+ if (Ie = Xt || Cc ? {} : p(H), !St)
10829
+ return Xt ? c(H, s(Ie, H)) : o(H, n(Ie, H));
10830
10830
  } else {
10831
10831
  if (!$[ot])
10832
10832
  return ie ? H : {};
@@ -10838,13 +10838,13 @@ function vw() {
10838
10838
  if (kc)
10839
10839
  return kc;
10840
10840
  Fe.set(H, Ie), x(H) ? H.forEach(function(Tt) {
10841
- Ie.add(U(Tt, Oe, pe, Tt, H, Fe));
10841
+ Ie.add(U(Tt, Ee, pe, Tt, H, Fe));
10842
10842
  }) : w(H) && H.forEach(function(Tt, $t) {
10843
- Ie.set($t, U(Tt, Oe, pe, $t, H, Fe));
10843
+ Ie.set($t, U(Tt, Ee, pe, $t, H, Fe));
10844
10844
  });
10845
- var Um = Ac ? Qt ? u : l : Qt ? _ : k, Ic = Ne ? void 0 : Um(H);
10845
+ var Um = Ac ? Xt ? u : l : Xt ? _ : k, Ic = Ne ? void 0 : Um(H);
10846
10846
  return e(Ic || H, function(Tt, $t) {
10847
- Ic && ($t = Tt, Tt = H[$t]), r(Ie, $t, U(Tt, Oe, pe, $t, H, Fe));
10847
+ Ic && ($t = Tt, Tt = H[$t]), r(Ie, $t, U(Tt, Ee, pe, $t, H, Fe));
10848
10848
  }), Ie;
10849
10849
  }
10850
10850
  return Xa = U, Xa;
@@ -10860,7 +10860,7 @@ function ww() {
10860
10860
  return eo = n, eo;
10861
10861
  }
10862
10862
  var bw = ww();
10863
- const _e = /* @__PURE__ */ qn(bw), Dt = (t) => {
10863
+ const ve = /* @__PURE__ */ qn(bw), Dt = (t) => {
10864
10864
  for (const e in t)
10865
10865
  Object.prototype.hasOwnProperty.call(t, e) && (t[e] === void 0 ? delete t[e] : typeof t[e] == "object" && t[e] !== null && Dt(t[e]));
10866
10866
  }, Ow = (t, e) => {
@@ -10955,17 +10955,17 @@ const _e = /* @__PURE__ */ qn(bw), Dt = (t) => {
10955
10955
  const p = h && ut("Read", h), v = Mn(c, s, i, a), g = $d(c, i), w = $o(c, i), E = jd(c, s, i), x = (y = []) => {
10956
10956
  const A = [];
10957
10957
  if (p) {
10958
- A.push(he(ir(r, "tenants", n, "system_fields", l.collection, `${l.collection}-${e.key}`), ye("Collection_Path_String", "==", t.join("/")), ...y));
10958
+ A.push(he(ar(r, "tenants", n, "system_fields", l.collection, `${l.collection}-${e.key}`), ye("Collection_Path_String", "==", t.join("/")), ...y));
10959
10959
  const I = Dn(c);
10960
10960
  Object.entries(c.fieldAccessGroups || {}).forEach(([G, C]) => {
10961
10961
  if (!I[G]?.length || !Pn(C, l.collection, i, a))
10962
10962
  return;
10963
10963
  const P = nc(G, e.key);
10964
- A.push(he(ir(r, "tenants", n, "system_fields", l.collection, `${l.collection}-${P}`), ye("Collection_Path_String", "==", t.join("/")), ...y));
10964
+ A.push(he(ar(r, "tenants", n, "system_fields", l.collection, `${l.collection}-${P}`), ye("Collection_Path_String", "==", t.join("/")), ...y));
10965
10965
  });
10966
10966
  } else if (v)
10967
10967
  for (const I of v)
10968
- A.push(he(ir(r, "tenants", n, "system_fields", l.collection, `${l.collection}-${I.field}`), ye("Collection_Path_String", "==", t.join("/")), ...y));
10968
+ A.push(he(ar(r, "tenants", n, "system_fields", l.collection, `${l.collection}-${I.field}`), ye("Collection_Path_String", "==", t.join("/")), ...y));
10969
10969
  return A;
10970
10970
  }, k = g.filter((y) => "operations" in y && y.operations ? y.operations.includes("Read") : !0);
10971
10971
  if (k.length === 0 && w.length === 0 && E.length === 0)
@@ -11225,7 +11225,7 @@ const _e = /* @__PURE__ */ qn(bw), Dt = (t) => {
11225
11225
  const v = new Event(`stoker:loading:${t}`);
11226
11226
  document.dispatchEvent(v);
11227
11227
  try {
11228
- if (await Aw(l, e, r, n, i), f?.relationCollections && !i && await we(f.relationCollections)) {
11228
+ if (await Aw(l, e, r, n, i), f?.relationCollections && !i && await be(f.relationCollections)) {
11229
11229
  const E = Wt(l, a, o, c);
11230
11230
  for (const x of E)
11231
11231
  if (!s?.[x]) {
@@ -11251,7 +11251,7 @@ const Cw = async (t, e) => {
11251
11251
  throw new Error("User document ID not found in claims");
11252
11252
  let o = !1, c = null;
11253
11253
  return await new Promise((u, f) => {
11254
- const d = _r(Te(s, "tenants", n, "system_user_permissions", t.uid), (h) => {
11254
+ const d = _r(Re(s, "tenants", n, "system_user_permissions", t.uid), (h) => {
11255
11255
  if (h.exists()) {
11256
11256
  if (Ut = h.data(), Ut.User_ID = h.id, !Ut.Role)
11257
11257
  throw new Error("PERMISSION_DENIED");
@@ -11302,11 +11302,11 @@ const Cw = async (t, e) => {
11302
11302
  };
11303
11303
  if (h) {
11304
11304
  const E = /* @__PURE__ */ new Date(), x = new Date((/* @__PURE__ */ new Date()).setDate(E.getDate() + h));
11305
- p.TTL = Kt.fromDate(x);
11305
+ p.TTL = Yt.fromDate(x);
11306
11306
  }
11307
- const v = _e(r);
11308
- t !== "delete" && (p.data.data = v, e === "written" && yc(p.data.data)), t !== "delete" && e !== "written" && ar(v), t === "update" && (p.data.originalRecord = _e(c)), t !== "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));
11309
- const g = r.Last_Write_At, w = Te(d, "tenants", l, n.join("/"), s, "system_write_log", `${a}-${g.valueOf()}`);
11307
+ const v = ve(r);
11308
+ t !== "delete" && (p.data.data = v, e === "written" && yc(p.data.data)), t !== "delete" && e !== "written" && zt(v), t === "update" && (p.data.originalRecord = ve(c)), t !== "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));
11309
+ const g = r.Last_Write_At, w = Re(d, "tenants", l, n.join("/"), s, "system_write_log", `${a}-${g.valueOf()}`);
11310
11310
  ip(w, p).catch((E) => {
11311
11311
  console.error(`Error saving "${e}" ${t} log entry for record ${s} in ${u.collection} collection.`, { cause: E });
11312
11312
  });
@@ -11315,14 +11315,14 @@ const Cw = async (t, e) => {
11315
11315
  if (!s.Role)
11316
11316
  throw new Error("No role found in permissions");
11317
11317
  if (await Promise.all(l.map(async (f) => {
11318
- if (!f.access || Zt(f, s, n, i)) {
11318
+ if (!f.access || Gt(f, s, n, i)) {
11319
11319
  if (r[f.name] === void 0 || ur(r[f.name]))
11320
11320
  return;
11321
11321
  const d = r[f.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
11322
11322
  if (!Ew(d))
11323
11323
  u.push(`${f.name} "${r[f.name]}" is invalid`);
11324
11324
  else {
11325
- const h = await Nd(Te(o, "tenants", a, "system_unique", c, `Unique-${c}-${f.name}`, d)).catch(() => {
11325
+ const h = await Nd(Re(o, "tenants", a, "system_unique", c, `Unique-${c}-${f.name}`, d)).catch(() => {
11326
11326
  });
11327
11327
  h?.exists() && !(t === "update" && h.data().id === e) && u.push(`${f.name} "${r[f.name]}" already exists`);
11328
11328
  }
@@ -11338,22 +11338,22 @@ const Cw = async (t, e) => {
11338
11338
  throw new Error("PERMISSION_DENIED");
11339
11339
  const d = f && ut("Read", f), h = Mn(l, i, a, o), p = [];
11340
11340
  if (d) {
11341
- p.push(Te(n, "tenants", s, "system_fields", u.collection, `${u.collection}-${r.key}`, e));
11341
+ p.push(Re(n, "tenants", s, "system_fields", u.collection, `${u.collection}-${r.key}`, e));
11342
11342
  const v = Dn(l);
11343
11343
  Object.entries(l.fieldAccessGroups || {}).forEach(([g, w]) => {
11344
11344
  if (!v[g]?.length || !Pn(w, u.collection, a, o))
11345
11345
  return;
11346
11346
  const E = nc(g, r.key);
11347
- p.push(Te(n, "tenants", s, "system_fields", u.collection, `${u.collection}-${E}`, e));
11347
+ p.push(Re(n, "tenants", s, "system_fields", u.collection, `${u.collection}-${E}`, e));
11348
11348
  });
11349
11349
  } else if (h)
11350
11350
  for (const v of h)
11351
- p.push(Te(n, "tenants", s, "system_fields", u.collection, `${u.collection}-${v.field}`, e));
11351
+ p.push(Re(n, "tenants", s, "system_fields", u.collection, `${u.collection}-${v.field}`, e));
11352
11352
  return p;
11353
11353
  }, Rd = (t) => t !== null && typeof t == "object" && !Array.isArray(t), Tm = (t) => {
11354
11354
  const e = (r) => {
11355
11355
  Object.entries(r).forEach(([n, s]) => {
11356
- Rd(s) && Object.keys(s).length === 2 && typeof s._seconds == "number" && typeof s._nanoseconds == "number" ? r[n] = new Kt(s._seconds, s._nanoseconds) : Rd(s) && e(s);
11356
+ Rd(s) && Object.keys(s).length === 2 && typeof s._seconds == "number" && typeof s._nanoseconds == "number" ? r[n] = new Yt(s._seconds, s._nanoseconds) : Rd(s) && e(s);
11357
11357
  });
11358
11358
  };
11359
11359
  e(t);
@@ -11413,7 +11413,7 @@ const Cw = async (t, e) => {
11413
11413
  if (!qe())
11414
11414
  throw new Error("PERMISSIONS_NOT_FOUND");
11415
11415
  const o = e.at(-2);
11416
- r.fields ||= n.collections[o].fields.filter((u) => ve(u));
11416
+ r.fields ||= n.collections[o].fields.filter((u) => we(u));
11417
11417
  const c = r.depth - 1, l = [];
11418
11418
  for (const u of r.fields)
11419
11419
  if ("collection" in u) {
@@ -11482,7 +11482,7 @@ const Cw = async (t, e) => {
11482
11482
  const S = e.pagination.startAfter || e.pagination.endBefore, y = eh(w.Role, o, s);
11483
11483
  if (S && y !== !0)
11484
11484
  throw new Error("INPUT_ERROR: Pagination is not allowed when using " + y);
11485
- e.pagination.orderByField && e.pagination.orderByDirection ? e.pagination.startAfter || e.pagination.endBefore ? e.pagination.startAfter ? x = x.map((A, I) => he(A, nt(e.pagination.orderByField, e.pagination.orderByDirection), oo(k.last.get(I)), nr(e.pagination.number))) : x = x.map((A, I) => he(A, nt(e.pagination.orderByField, e.pagination.orderByDirection), co(k.first.get(I)), Mr(e.pagination.number))) : x = x.map((A) => he(A, nt(e.pagination.orderByField, e.pagination.orderByDirection), nr(e.pagination.number))) : !e.pagination.startAfter && !e.pagination.endBefore ? x = x.map((A) => he(A, nr(e.pagination.number))) : e.pagination.startAfter ? x = x.map((A, I) => he(A, oo(k.last.get(I)), nr(e.pagination.number))) : x = x.map((A, I) => he(A, co(k.first.get(I)), Mr(e.pagination.number)));
11485
+ e.pagination.orderByField && e.pagination.orderByDirection ? e.pagination.startAfter || e.pagination.endBefore ? e.pagination.startAfter ? x = x.map((A, I) => he(A, nt(e.pagination.orderByField, e.pagination.orderByDirection), oo(k.last.get(I)), sr(e.pagination.number))) : x = x.map((A, I) => he(A, nt(e.pagination.orderByField, e.pagination.orderByDirection), co(k.first.get(I)), Mr(e.pagination.number))) : x = x.map((A) => he(A, nt(e.pagination.orderByField, e.pagination.orderByDirection), sr(e.pagination.number))) : !e.pagination.startAfter && !e.pagination.endBefore ? x = x.map((A) => he(A, sr(e.pagination.number))) : e.pagination.startAfter ? x = x.map((A, I) => he(A, oo(k.last.get(I)), sr(e.pagination.number))) : x = x.map((A, I) => he(A, co(k.first.get(I)), Mr(e.pagination.number)));
11486
11486
  }
11487
11487
  const _ = { collection: c.collection };
11488
11488
  await ae("preOperation", d, v, { operation: "read", context: _ }), await ae("preRead", d, v, { context: _, refs: x, multiple: !0, listener: !1 });
@@ -11512,16 +11512,16 @@ const Cw = async (t, e) => {
11512
11512
  }
11513
11513
  }
11514
11514
  let R;
11515
- e?.noComputedFields || (R = await we(v.admin?.retriever));
11515
+ e?.noComputedFields || (R = await be(v.admin?.retriever));
11516
11516
  for (const S of T.values()) {
11517
11517
  const y = [], A = [...S.Collection_Path, S.id];
11518
11518
  e?.subcollections && y.push(Rm(
11519
11519
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11520
11520
  T.get(S.id),
11521
11521
  A,
11522
- _e(e.subcollections),
11522
+ ve(e.subcollections),
11523
11523
  s,
11524
- _e(e?.relations),
11524
+ ve(e?.relations),
11525
11525
  e?.only,
11526
11526
  e?.noEmbeddingFields
11527
11527
  )), e?.relations && (e.relations.fields && (e.relations.fields = e.relations.fields.map((P) => {
@@ -11536,14 +11536,14 @@ const Cw = async (t, e) => {
11536
11536
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11537
11537
  T.get(S.id),
11538
11538
  A,
11539
- _e(e.relations),
11539
+ ve(e.relations),
11540
11540
  s,
11541
11541
  e?.only,
11542
11542
  e?.noEmbeddingFields
11543
11543
  ))), await Promise.all(y);
11544
11544
  const I = [];
11545
11545
  for (const P of o.fields)
11546
- P.type === "Computed" && !e?.noComputedFields && I.push(we(P.formula, [S, R]).then((M) => {
11546
+ P.type === "Computed" && !e?.noComputedFields && I.push(be(P.formula, [S, R]).then((M) => {
11547
11547
  S[P.name] = M;
11548
11548
  })), e?.noEmbeddingFields && P.type === "Embedding" && delete S[P.name];
11549
11549
  await Promise.all(I);
@@ -11588,7 +11588,7 @@ const Cw = async (t, e) => {
11588
11588
  if (!qe())
11589
11589
  throw new Error("PERMISSIONS_NOT_FOUND");
11590
11590
  const c = e.at(-2);
11591
- r.fields ||= n.collections[c].fields.filter((f) => ve(f));
11591
+ r.fields ||= n.collections[c].fields.filter((f) => we(f));
11592
11592
  const l = r.depth - 1, u = [];
11593
11593
  for (const f of r.fields)
11594
11594
  if ("collection" in f) {
@@ -11657,7 +11657,7 @@ const Cw = async (t, e) => {
11657
11657
  for (const R of F)
11658
11658
  _.id ||= R.id, _ = { ..._, ...R.data }, delete _.Collection_Path_String;
11659
11659
  const T = [], O = t ? [...t, e] : [d.collection, e];
11660
- if (r?.subcollections && T.push(Cm(_, O, _e(r.subcollections), s, _e(r?.relations), r?.only)), r?.relations && (r.relations.fields && (r.relations.fields = r.relations.fields.map((R) => {
11660
+ if (r?.subcollections && T.push(Cm(_, O, ve(r.subcollections), s, ve(r?.relations), r?.only)), r?.relations && (r.relations.fields && (r.relations.fields = r.relations.fields.map((R) => {
11661
11661
  if (typeof R == "string") {
11662
11662
  const S = f.fields.find((y) => y.name === R);
11663
11663
  if (S)
@@ -11665,7 +11665,7 @@ const Cw = async (t, e) => {
11665
11665
  throw new Error(`SCHEMA_ERROR: Field ${R} not found in collection ${n}`);
11666
11666
  }
11667
11667
  return R;
11668
- })), T.push(km(_, O, _e(r.relations), s, r?.only, r?.noComputedFields, r?.noEmbeddingFields))), await Promise.all(T), !r?.noComputedFields)
11668
+ })), T.push(km(_, O, ve(r.relations), s, r?.only, r?.noComputedFields, r?.noEmbeddingFields))), await Promise.all(T), !r?.noComputedFields)
11669
11669
  for (const R of f.fields)
11670
11670
  R.type === "Computed" && (_[R.name] = await R.formula(_));
11671
11671
  if (r?.noEmbeddingFields)
@@ -11675,7 +11675,7 @@ const Cw = async (t, e) => {
11675
11675
  }, Fw = (t) => t !== null && typeof t == "object", Im = (t) => {
11676
11676
  const e = (r) => {
11677
11677
  Object.entries(r).forEach(([n, s]) => {
11678
- s instanceof Kt ? r[n] = {
11678
+ s instanceof Yt ? r[n] = {
11679
11679
  _seconds: s.seconds,
11680
11680
  _nanoseconds: s.nanoseconds
11681
11681
  } : Fw(s) && e(s);
@@ -11683,7 +11683,7 @@ const Cw = async (t, e) => {
11683
11683
  };
11684
11684
  e(t);
11685
11685
  }, Nw = async (t, e, r, n) => {
11686
- const s = at(), i = Ze(), a = We(s, i.STOKER_FB_FUNCTIONS_REGION), o = Qe(a, "stoker-writeapi", { timeout: 540 * 1e3 }), c = _e(r);
11686
+ const s = at(), i = Ze(), a = We(s, i.STOKER_FB_FUNCTIONS_REGION), o = Qe(a, "stoker-writeapi", { timeout: 540 * 1e3 }), c = ve(r);
11687
11687
  return Im(c), yc(c), (await o({
11688
11688
  operation: "update",
11689
11689
  path: t,
@@ -11714,7 +11714,7 @@ const Cw = async (t, e) => {
11714
11714
  "custom",
11715
11715
  "disableOfflineUpdate"
11716
11716
  ]), P = () => {
11717
- if (Ht() === "Offline" && (C || _ || g.auth && (A || G || I)))
11717
+ if (Kt() === "Offline" && (C || _ || g.auth && (A || G || I)))
11718
11718
  throw new Error("CLIENT_OFFLINE");
11719
11719
  };
11720
11720
  if (P(), _ || A || G || I) {
@@ -11736,19 +11736,28 @@ const Cw = async (t, e) => {
11736
11736
  }
11737
11737
  }
11738
11738
  }
11739
+ if (A) {
11740
+ const _e = { ...m, ...r };
11741
+ if (zt(_e), !_e.Role)
11742
+ throw new Error("VALIDATION_ERROR: Role field is required");
11743
+ if (_e.Enabled === void 0 || _e.Enabled === null)
11744
+ throw new Error("VALIDATION_ERROR: Enabled field is required");
11745
+ if (!_e.Email)
11746
+ throw new Error("VALIDATION_ERROR: Email field is required");
11747
+ }
11739
11748
  const V = {
11740
11749
  operation: "update",
11741
11750
  data: r,
11742
11751
  context: S,
11743
11752
  batch: R,
11744
- originalRecord: _e(m)
11753
+ originalRecord: ve(m)
11745
11754
  };
11746
11755
  return await ae("preValidate", l, b, V), await Nw(t, e, r, s ? { operation: s.operation, permissions: s.permissions, password: s.password } : void 0);
11747
11756
  }
11748
11757
  delete r.id;
11749
- const M = sc("update", t, r, a, F, Ht(), O.uid, Kt.now(), Vr(), !!T);
11758
+ const M = sc("update", t, r, a, F, Kt(), O.uid, Yt.now(), Vr(), !!T);
11750
11759
  for (const V of x)
11751
- !ve(V) && ur(M[V.name]) && V.nullable && (M[V.name] = null);
11760
+ !we(V) && ur(M[V.name]) && V.nullable && (M[V.name] = null);
11752
11761
  if (Dt(M), Dt(m), Lr(g, M, a), Lr(g, m, a), !T && k && Je("update", "started", M, t, e, g, O.uid, void 0, m), !T) {
11753
11762
  const V = {
11754
11763
  operation: "update",
@@ -11756,7 +11765,7 @@ const Cw = async (t, e) => {
11756
11765
  recordId: e,
11757
11766
  context: S,
11758
11767
  batch: R,
11759
- originalRecord: _e(m)
11768
+ originalRecord: ve(m)
11760
11769
  };
11761
11770
  await ae("preOperation", l, b, V);
11762
11771
  const te = {
@@ -11765,20 +11774,20 @@ const Cw = async (t, e) => {
11765
11774
  recordId: e,
11766
11775
  context: S,
11767
11776
  batch: R,
11768
- originalRecord: _e(m)
11777
+ originalRecord: ve(m)
11769
11778
  };
11770
11779
  await ae("preWrite", l, b, te);
11771
11780
  }
11772
11781
  if (Lr(g, M, a), dh(g, M), !T)
11773
11782
  try {
11774
11783
  const V = { ...m, ...M };
11775
- ar(V), await vm("update", V, g, b, { operation: "update", data: M, context: S, batch: R, originalRecord: _e(m) }, a), C && (P(), await _c("update", e, M, g, d, N));
11784
+ zt(V), await vm("update", V, g, b, { operation: "update", data: M, context: S, batch: R, originalRecord: ve(m) }, a), C && (P(), await _c("update", e, M, g, d, N));
11776
11785
  } catch (V) {
11777
11786
  throw new Error(`VALIDATION_ERROR: ${V.message}`);
11778
11787
  }
11779
- if (Mg(M, m, e, g, a, O.uid, d, void 0, void 0, void 0, N), Dt(M), pc("update", R, t, e, M, a, g, n, c, Lo, qo, Fn, (V) => Te(f, "tenants", i, "system_fields", w.collection, `${w.collection}-${V.name}`, e), (V, te) => Te(f, "tenants", i, "system_unique", w.collection, `Unique-${w.collection}-${V.name}`, te), (V) => Te(f, "tenants", i, "system_fields", w.collection, `${w.collection}-${V}`, e)), R.update(Te(f, "tenants", i, t.join("/"), e), M), !T && k && Je("update", "written", M, t, e, g, O.uid, void 0, m), await bc("update", t, e, M, S, g, b, R, O.uid, k || !1, d, N, !!T, m), T?.type === "unique") {
11788
+ if (Mg(M, m, e, g, a, O.uid, d, void 0, void 0, void 0, N), Dt(M), pc("update", R, t, e, M, a, g, n, c, Lo, qo, Fn, (V) => Re(f, "tenants", i, "system_fields", w.collection, `${w.collection}-${V.name}`, e), (V, te) => Re(f, "tenants", i, "system_unique", w.collection, `Unique-${w.collection}-${V.name}`, te), (V) => Re(f, "tenants", i, "system_fields", w.collection, `${w.collection}-${V}`, e)), R.update(Re(f, "tenants", i, t.join("/"), e), M), !T && k && Je("update", "written", M, t, e, g, O.uid, void 0, m), await bc("update", t, e, M, S, g, b, R, O.uid, k || !1, d, N, !!T, m), T?.type === "unique") {
11780
11789
  const V = { ...m, ...M };
11781
- return ar(V), { id: e, ...V };
11790
+ return zt(V), { id: e, ...V };
11782
11791
  }
11783
11792
  k && Je("update", "success", M, t, e, g, O.uid, void 0, m);
11784
11793
  const K = {
@@ -11787,17 +11796,17 @@ const Cw = async (t, e) => {
11787
11796
  recordId: e,
11788
11797
  context: S,
11789
11798
  retry: !!T,
11790
- originalRecord: _e(m)
11799
+ originalRecord: ve(m)
11791
11800
  }, oe = { ...K };
11792
11801
  await ae("postWrite", l, b, K), await ae("postOperation", l, b, oe);
11793
11802
  const ce = { ...m, ...M };
11794
- return ar(ce), { id: e, ...ce };
11803
+ return zt(ce), { id: e, ...ce };
11795
11804
  }, bc = async (t, e, r, n, s, i, a, o, c, l, u, f, d, h) => {
11796
11805
  const p = ze(), v = De(), { labels: g } = i;
11797
11806
  let w = 0;
11798
11807
  const E = async () => {
11799
11808
  try {
11800
- await _e(o).commit();
11809
+ await ve(o).commit();
11801
11810
  return;
11802
11811
  } catch (x) {
11803
11812
  let k;
@@ -11807,7 +11816,7 @@ const Cw = async (t, e) => {
11807
11816
  "custom",
11808
11817
  "autoCorrectUnique"
11809
11818
  ]);
11810
- if (x.code === "unavailable" && await we(v.onIndexedDBConnectionLost), t !== "delete" && x.code === "permission-denied")
11819
+ if (x.code === "unavailable" && await be(v.onIndexedDBConnectionLost), t !== "delete" && x.code === "permission-denied")
11811
11820
  try {
11812
11821
  await _c(t, r, n, i, u, f);
11813
11822
  } catch (N) {
@@ -11877,7 +11886,7 @@ const Cw = async (t, e) => {
11877
11886
  };
11878
11887
  await E();
11879
11888
  }, Dw = async (t, e, r, n) => {
11880
- const s = at(), i = Ze(), a = We(s, i.STOKER_FB_FUNCTIONS_REGION), o = Qe(a, "stoker-writeapi", { timeout: 540 * 1e3 }), c = _e(e);
11889
+ const s = at(), i = Ze(), a = We(s, i.STOKER_FB_FUNCTIONS_REGION), o = Qe(a, "stoker-writeapi", { timeout: 540 * 1e3 }), c = ve(e);
11881
11890
  return Im(c), (await o({
11882
11891
  operation: "create",
11883
11892
  path: t,
@@ -11903,11 +11912,11 @@ const Cw = async (t, e) => {
11903
11912
  "custom",
11904
11913
  "disableOfflineCreate"
11905
11914
  ]), N = () => {
11906
- if (Ht() === "Offline" && (O || x || p.auth && n))
11915
+ if (Kt() === "Offline" && (O || x || p.auth && n))
11907
11916
  throw new Error("CLIENT_OFFLINE");
11908
11917
  };
11909
11918
  N();
11910
- const m = Mo(l), R = b?.docId || r?.id || Te(ir(l, "tenants", s, v.collection)).id, S = { collection: v.collection };
11919
+ const m = Mo(l), R = b?.docId || r?.id || Re(ar(l, "tenants", s, v.collection)).id, S = { collection: v.collection };
11911
11920
  if (x || p.auth && n) {
11912
11921
  if (N(), p.auth && n) {
11913
11922
  if (!n.password)
@@ -11916,6 +11925,12 @@ const Cw = async (t, e) => {
11916
11925
  throw new Error("VALIDATION_ERROR: Password Confirm is required");
11917
11926
  if (n.password !== n.passwordConfirm)
11918
11927
  throw new Error("VALIDATION_ERROR: Passwords do not match");
11928
+ if (!e.Role)
11929
+ throw new Error("VALIDATION_ERROR: Role field is required");
11930
+ if (!e.Email)
11931
+ throw new Error("VALIDATION_ERROR: Email field is required");
11932
+ if (e.Enabled === void 0 || e.Enabled === null)
11933
+ throw new Error("VALIDATION_ERROR: Enabled field is required");
11919
11934
  if (!await ne(o, ["global", "firebase", "enableEmulators"])) {
11920
11935
  N();
11921
11936
  try {
@@ -11935,7 +11950,7 @@ const Cw = async (t, e) => {
11935
11950
  }), r?.onValid && r.onValid(), await Dw(t, e, n ? { permissions: n.permissions, password: n.password } : void 0, R);
11936
11951
  }
11937
11952
  e.id = R;
11938
- const y = sc("create", t, e, i, _, Ht(), F.uid, Kt.now(), Vr(), !!b);
11953
+ const y = sc("create", t, e, i, _, Kt(), F.uid, Yt.now(), Vr(), !!b);
11939
11954
  if (E && (y[E.archivedField] = !1), Dt(y), Lr(p, y, i), !b && w && Je("create", "started", y, t, R, p, F.uid), b || (await ae("preOperation", o, k, {
11940
11955
  operation: "create",
11941
11956
  data: y,
@@ -11954,7 +11969,7 @@ const Cw = async (t, e) => {
11954
11969
  } catch (C) {
11955
11970
  throw new Error(`VALIDATION_ERROR: ${C.message}`);
11956
11971
  }
11957
- if (r?.onValid && r.onValid(), Dt(y), Pg(y, R, p, i, F.uid, u, void 0, T), pc("create", m, t, R, y, i, p, r, a, Lo, qo, Fn, (C) => Te(l, "tenants", s, "system_fields", v.collection, `${v.collection}-${C.name}`, R), (C, P) => Te(l, "tenants", s, "system_unique", v.collection, `Unique-${v.collection}-${C.name}`, P), (C) => Te(l, "tenants", s, "system_fields", v.collection, `${v.collection}-${C}`, R)), m.set(Te(l, "tenants", s, t.join("/"), R), y), !b && w && Je("create", "written", y, t, R, p, F.uid), await bc("create", t, R, y, S, p, k, m, F.uid, w || !1, u, T, !!b), b?.type === "unique")
11972
+ if (r?.onValid && r.onValid(), Dt(y), Pg(y, R, p, i, F.uid, u, void 0, T), pc("create", m, t, R, y, i, p, r, a, Lo, qo, Fn, (C) => Re(l, "tenants", s, "system_fields", v.collection, `${v.collection}-${C.name}`, R), (C, P) => Re(l, "tenants", s, "system_unique", v.collection, `Unique-${v.collection}-${C.name}`, P), (C) => Re(l, "tenants", s, "system_fields", v.collection, `${v.collection}-${C}`, R)), m.set(Re(l, "tenants", s, t.join("/"), R), y), !b && w && Je("create", "written", y, t, R, p, F.uid), await bc("create", t, R, y, S, p, k, m, F.uid, w || !1, u, T, !!b), b?.type === "unique")
11958
11973
  return { id: R, ...y };
11959
11974
  w && Je("create", "success", y, t, R, p, F.uid);
11960
11975
  const A = {
@@ -11996,7 +12011,7 @@ const Cw = async (t, e) => {
11996
12011
  "disableOfflineDelete"
11997
12012
  ]);
11998
12013
  if ((() => {
11999
- if (Ht() === "Offline" && (T || E || h.auth))
12014
+ if (Kt() === "Offline" && (T || E || h.auth))
12000
12015
  throw new Error("CLIENT_OFFLINE");
12001
12016
  })(), Nm(e))
12002
12017
  throw new Error("RECORD_BUSY");
@@ -12009,7 +12024,7 @@ const Cw = async (t, e) => {
12009
12024
  if (E || h.auth && N.User_ID)
12010
12025
  return await Pw(t, e);
12011
12026
  delete N.id;
12012
- const m = Mo(o), R = { collection: p.collection }, S = sc("delete", t, N, s, k, Ht(), b.uid, Kt.now(), Vr(), !!_);
12027
+ const m = Mo(o), R = { collection: p.collection }, S = sc("delete", t, N, s, k, Kt(), b.uid, Yt.now(), Vr(), !!_);
12013
12028
  Dt(S), !_ && g && Je("delete", "started", S, t, e, h, b.uid), _ || (await ae("preOperation", c, x, {
12014
12029
  operation: "delete",
12015
12030
  data: S,
@@ -12022,7 +12037,7 @@ const Cw = async (t, e) => {
12022
12037
  recordId: e,
12023
12038
  context: R,
12024
12039
  batch: m
12025
- })), Dt(S), qg(S, e, h, s, b.uid, l), pc("delete", m, t, e, S, s, h, r, i, Lo, qo, Fn, (C) => Te(o, "tenants", n, "system_fields", p.collection, `${p.collection}-${C.name}`, e), (C, P) => Te(o, "tenants", n, "system_unique", p.collection, `Unique-${p.collection}-${C.name}`, P), (C) => Te(o, "tenants", n, "system_fields", p.collection, `${p.collection}-${C}`, e)), m.delete(Te(o, "tenants", n, t.join("/"), e)), !_ && g && Je("delete", "written", S, t, e, h, b.uid), await bc("delete", t, e, S, R, h, x, m, b.uid, g || !1, l, F, !!_), g && Je("delete", "success", { ...S, ..._?.record || {} }, t, e, h, b.uid);
12040
+ })), Dt(S), qg(S, e, h, s, b.uid, l), pc("delete", m, t, e, S, s, h, r, i, Lo, qo, Fn, (C) => Re(o, "tenants", n, "system_fields", p.collection, `${p.collection}-${C.name}`, e), (C, P) => Re(o, "tenants", n, "system_unique", p.collection, `Unique-${p.collection}-${C.name}`, P), (C) => Re(o, "tenants", n, "system_fields", p.collection, `${p.collection}-${C}`, e)), m.delete(Re(o, "tenants", n, t.join("/"), e)), !_ && g && Je("delete", "written", S, t, e, h, b.uid), await bc("delete", t, e, S, R, h, x, m, b.uid, g || !1, l, F, !!_), g && Je("delete", "success", { ...S, ..._?.record || {} }, t, e, h, b.uid);
12026
12041
  const A = {
12027
12042
  operation: "delete",
12028
12043
  data: S,
@@ -12119,8 +12134,8 @@ const Lw = async (t, e) => {
12119
12134
  let pn, ro = 0;
12120
12135
  const jw = async () => {
12121
12136
  const t = jm(), e = De();
12122
- return _r(Te(t, "system_deployment", "latest_deploy"), (n) => {
12123
- n.exists() ? (pn = n.data(), ro++, ro > 1 && (pn.refresh ? window.location.reload() : we(e.onVersionUpdate, [pn, ro]))) : console.error("Version info not found");
12137
+ return _r(Re(t, "system_deployment", "latest_deploy"), (n) => {
12138
+ n.exists() ? (pn = n.data(), ro++, ro > 1 && (pn.refresh ? window.location.reload() : be(e.onVersionUpdate, [pn, ro]))) : console.error("Version info not found");
12124
12139
  }, (n) => {
12125
12140
  console.error("Error getting version info", { cause: n.message });
12126
12141
  });
@@ -12128,8 +12143,8 @@ const jw = async () => {
12128
12143
  let Do;
12129
12144
  const Vw = async () => {
12130
12145
  const t = De(), e = jm();
12131
- _r(Te(e, "system_deployment", "maintenance_mode"), (r) => {
12132
- r.exists() ? (Do = r.data(), we(t.onMaintenanceUpdate, [Do.active ? "on" : "off"])) : console.error("Maintenance status not found");
12146
+ _r(Re(e, "system_deployment", "maintenance_mode"), (r) => {
12147
+ r.exists() ? (Do = r.data(), be(t.onMaintenanceUpdate, [Do.active ? "on" : "off"])) : console.error("Maintenance status not found");
12133
12148
  }, (r) => {
12134
12149
  console.error("Error getting maintenance status", { cause: r.message });
12135
12150
  });
@@ -12139,24 +12154,24 @@ const Ww = () => {
12139
12154
  const t = Fd(), e = De();
12140
12155
  let r = !1;
12141
12156
  return rp(np(t, ".info/connected"), (s) => {
12142
- s.val() === !0 ? (Rr && (clearTimeout(Rr), Rr = null), Pr = "Online", we(e.onConnectionStatusChange, [Pr, !r]), r || (r = !0)) : !Rr && r && (Rr = setTimeout(() => {
12143
- Pr = "Offline", we(e.onConnectionStatusChange, [Pr]);
12157
+ s.val() === !0 ? (Rr && (clearTimeout(Rr), Rr = null), Pr = "Online", be(e.onConnectionStatusChange, [Pr, !r]), r || (r = !0)) : !Rr && r && (Rr = setTimeout(() => {
12158
+ Pr = "Offline", be(e.onConnectionStatusChange, [Pr]);
12144
12159
  }, 5e3));
12145
12160
  });
12146
- }, Ht = () => Pr ?? "Online", zw = () => navigator.onLine ? "Online" : "Offline", Pm = async () => {
12161
+ }, Kt = () => Pr ?? "Online", zw = () => navigator.onLine ? "Online" : "Offline", Pm = async () => {
12147
12162
  const t = De(), e = yr(), r = e.currentUser;
12148
- if (t.preLogout && await we(t.preLogout, [r]) === !1)
12163
+ if (t.preLogout && await be(t.preLogout, [r]) === !1)
12149
12164
  throw new Error("Operation cancelled by preLogout");
12150
12165
  try {
12151
12166
  e.signOut();
12152
12167
  } catch (n) {
12153
12168
  console.error(n);
12154
12169
  const s = { error: !0, instances: [{ instance: "[DEFAULT]", code: "SIGN_OUT", error: n }] };
12155
- await we(t.postLogout, [s]);
12170
+ await be(t.postLogout, [s]);
12156
12171
  }
12157
12172
  }, Bw = (t) => {
12158
12173
  const e = (s) => {
12159
- typeof s == "string" && s.includes("Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.") && (console.warn("Slow Firestore Connection Detected"), we(t.onFirestoreSlowConnection)), typeof s == "string" && s.includes("Using maximum backoff delay to prevent overloading the backend.") && (console.warn("Firestore Load Failure Detected"), we(t.onFirestoreLoadFailure)), typeof s == "string" && s.includes("The user's credential is no longer valid. The user must sign in again.") && (console.warn("User Credential Expired"), Pm()), typeof s == "string" && s.includes("Connection to Indexed Database server lost. Refresh the page to try again") && (console.warn("Indexed Database Connection Lost"), we(t.onIndexedDBConnectionLost));
12174
+ typeof s == "string" && s.includes("Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.") && (console.warn("Slow Firestore Connection Detected"), be(t.onFirestoreSlowConnection)), typeof s == "string" && s.includes("Using maximum backoff delay to prevent overloading the backend.") && (console.warn("Firestore Load Failure Detected"), be(t.onFirestoreLoadFailure)), typeof s == "string" && s.includes("The user's credential is no longer valid. The user must sign in again.") && (console.warn("User Credential Expired"), Pm()), typeof s == "string" && s.includes("Connection to Indexed Database server lost. Refresh the page to try again") && (console.warn("Indexed Database Connection Lost"), be(t.onIndexedDBConnectionLost));
12160
12175
  }, r = console.error.bind(console);
12161
12176
  let n = !1;
12162
12177
  console.error = (...s) => {
@@ -12186,7 +12201,7 @@ const Zw = (t, e) => {
12186
12201
  const t = navigator.userAgent;
12187
12202
  return /iPad|iPhone|iPod/.test(t) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1 ? { experimentalForceLongPolling: !0 } : /Safari/i.test(t) && !/Chrome|Chromium|CriOS|EdgiOS|Edg\/|OPR|FxiOS/i.test(t) ? { experimentalForceLongPolling: !0 } : {};
12188
12203
  };
12189
- let pt, Oc, At, Mm, ge, qm, jr, Ec, Sc, Le, Lm, xn = [], be;
12204
+ let pt, Oc, At, Mm, ge, qm, jr, Ec, Sc, Le, Lm, xn = [], Oe;
12190
12205
  const no = {
12191
12206
  firestoreWriteApp: {}
12192
12207
  }, gt = {
@@ -12205,15 +12220,15 @@ const no = {
12205
12220
  return Oc;
12206
12221
  },
12207
12222
  getEnv() {
12208
- return be;
12223
+ return Oe;
12209
12224
  },
12210
12225
  getTimezone() {
12211
12226
  return Mm;
12212
12227
  },
12213
- getConnectionStatus: Ht,
12228
+ getConnectionStatus: Kt,
12214
12229
  getNetworkStatus: zw,
12215
12230
  getSchema(t = !1) {
12216
- const e = _e(jr);
12231
+ const e = ve(jr);
12217
12232
  if (t) {
12218
12233
  for (const r of Object.values(e.collections))
12219
12234
  for (const n of r.fields)
@@ -12230,16 +12245,16 @@ const no = {
12230
12245
  return Lm;
12231
12246
  },
12232
12247
  getCurrentUserRoleGroups() {
12233
- return _e(Sc);
12248
+ return ve(Sc);
12234
12249
  },
12235
12250
  getAllRoleGroups() {
12236
- return _e(Ec);
12251
+ return ve(Ec);
12237
12252
  },
12238
12253
  getGlobalConfigModule() {
12239
- return _e(ge);
12254
+ return ve(ge);
12240
12255
  },
12241
12256
  getCollectionConfigModule(t) {
12242
- return _e(qm[t]);
12257
+ return ve(qm[t]);
12243
12258
  },
12244
12259
  getVersionInfo: Dm,
12245
12260
  getMaintenanceInfo: Uw,
@@ -12268,11 +12283,11 @@ const no = {
12268
12283
  };
12269
12284
  let Cd = !1, kd = 0;
12270
12285
  const db = async (t, e, r, n) => {
12271
- if (be = r, pt)
12286
+ if (Oe = r, pt)
12272
12287
  return console.error("Stoker is already initialized."), !0;
12273
- Wm("stoker-client", Ap, "web"), At = be.MODE, ge = t.default({ sdk: "web", utils: Po, context: n }), Mm = await ne(ge, ["global", "timezone"]), ne(ge, ["global", "roles"]), ne(ge, ["global", "appName"]), ne(ge, ["global", "auth", "enableMultiFactorAuth"]);
12274
- const s = JSON.parse(be.STOKER_FB_WEB_APP_CONFIG);
12275
- Zw(be.STOKER_FB_FIRESTORE_EDITION, s.projectId);
12288
+ Wm("stoker-client", Ap, "web"), At = Oe.MODE, ge = t.default({ sdk: "web", utils: Po, context: n }), Mm = await ne(ge, ["global", "timezone"]), ne(ge, ["global", "roles"]), ne(ge, ["global", "appName"]), ne(ge, ["global", "auth", "enableMultiFactorAuth"]);
12289
+ const s = JSON.parse(Oe.STOKER_FB_WEB_APP_CONFIG);
12290
+ Zw(Oe.STOKER_FB_FIRESTORE_EDITION, s.projectId);
12276
12291
  const i = Gw(), a = await ne(ge, ["global", "firebase", "GDPRSettings"]);
12277
12292
  pt = Qn(s, {
12278
12293
  automaticDataCollectionEnabled: a || !0
@@ -12285,10 +12300,10 @@ const db = async (t, e, r, n) => {
12285
12300
  const { firestoreWriteApp: l } = no, u = Qn(s, "maintenance");
12286
12301
  He.maintenance = nn(u, Ad(), i);
12287
12302
  const f = Tp();
12288
- if (f.settings.minimumFetchIntervalMillis = 36e5, await Rp(f), be.STOKER_FB_ENABLE_APP_CHECK === "true" && be.STOKER_FB_APP_CHECK_KEY) {
12303
+ if (f.settings.minimumFetchIntervalMillis = 36e5, await Rp(f), Oe.STOKER_FB_ENABLE_APP_CHECK === "true" && Oe.STOKER_FB_APP_CHECK_KEY) {
12289
12304
  (At === "development" || window.location.hostname === "localhost") && (globalThis.FIREBASE_APPCHECK_DEBUG_TOKEN = !0);
12290
12305
  const m = {
12291
- provider: new Ep(be.STOKER_FB_APP_CHECK_KEY),
12306
+ provider: new Ep(Oe.STOKER_FB_APP_CHECK_KEY),
12292
12307
  isTokenAutoRefreshEnabled: !0
12293
12308
  };
12294
12309
  It.main = es(pt, m), It.firestoreWrite = es(l, m), It.maintenance = es(u, m);
@@ -12296,7 +12311,7 @@ const db = async (t, e, r, n) => {
12296
12311
  const S = (y, A) => {
12297
12312
  if (console.log(`App Check token error detected for ${A}`), !R)
12298
12313
  if (R = !0, ge.onAppCheckTokenFailure)
12299
- we(ge.onAppCheckTokenFailure, [y]);
12314
+ be(ge.onAppCheckTokenFailure, [y]);
12300
12315
  else {
12301
12316
  const I = sessionStorage.getItem("stoker-app-check-reload");
12302
12317
  !I || new Date(I).getTime() < Date.now() - 3e5 ? (sessionStorage.setItem("stoker-app-check-reload", (/* @__PURE__ */ new Date()).toISOString()), window.location.reload()) : alert("For security reasons, please close this tab and wait a while before restarting it.");
@@ -12350,7 +12365,7 @@ const db = async (t, e, r, n) => {
12350
12365
  gt[m] = xc(no[`${m}App`], b);
12351
12366
  const { main: F } = gt;
12352
12367
  Ym(F, async (m) => {
12353
- if (m && await we(ge.preLogin, [m]) === !1)
12368
+ if (m && await be(ge.preLogin, [m]) === !1)
12354
12369
  throw new Error("Operation cancelled by preLogin");
12355
12370
  });
12356
12371
  const T = await ne(ge, [
@@ -12360,31 +12375,31 @@ const db = async (t, e, r, n) => {
12360
12375
  ]);
12361
12376
  if (At === "development" && v) {
12362
12377
  if (!T?.includes("Auth")) {
12363
- const m = be.STOKER_FB_EMULATOR_AUTH_PORT ? parseInt(be.STOKER_FB_EMULATOR_AUTH_PORT) : 9099;
12378
+ const m = Oe.STOKER_FB_EMULATOR_AUTH_PORT ? parseInt(Oe.STOKER_FB_EMULATOR_AUTH_PORT) : 9099;
12364
12379
  for (const R of Object.values(gt))
12365
12380
  Jm(R, `http://localhost:${m}`);
12366
12381
  }
12367
12382
  if (!T?.includes("Database")) {
12368
- const m = be.STOKER_FB_EMULATOR_DATABASE_PORT ? parseInt(be.STOKER_FB_EMULATOR_DATABASE_PORT) : 9e3;
12383
+ const m = Oe.STOKER_FB_EMULATOR_DATABASE_PORT ? parseInt(Oe.STOKER_FB_EMULATOR_DATABASE_PORT) : 9e3;
12369
12384
  sp(Fd(), "localhost", m);
12370
12385
  }
12371
12386
  if (!T?.includes("Firestore")) {
12372
- const m = be.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(be.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
12387
+ const m = Oe.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(Oe.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
12373
12388
  qc(He.maintenance, "localhost", m);
12374
12389
  }
12375
12390
  if (!T?.includes("Storage")) {
12376
- const m = be.STOKER_FB_EMULATOR_STORAGE_PORT ? parseInt(be.STOKER_FB_EMULATOR_STORAGE_PORT) : 9199;
12391
+ const m = Oe.STOKER_FB_EMULATOR_STORAGE_PORT ? parseInt(Oe.STOKER_FB_EMULATOR_STORAGE_PORT) : 9199;
12377
12392
  wp(bp(), "localhost", m);
12378
12393
  }
12379
12394
  if (!T?.includes("Functions")) {
12380
- const m = be.STOKER_FB_EMULATOR_FUNCTIONS_PORT ? parseInt(be.STOKER_FB_EMULATOR_FUNCTIONS_PORT) : 5001;
12381
- Op(We(pt, be.STOKER_FB_FUNCTIONS_REGION), "localhost", m);
12395
+ const m = Oe.STOKER_FB_EMULATOR_FUNCTIONS_PORT ? parseInt(Oe.STOKER_FB_EMULATOR_FUNCTIONS_PORT) : 5001;
12396
+ Op(We(pt, Oe.STOKER_FB_FUNCTIONS_REGION), "localhost", m);
12382
12397
  }
12383
12398
  }
12384
12399
  if (jw(), Vw(), Ww(), At === "development" && (w ? tn(w) : tn("debug")), At === "production" && (E ? tn(E) : tn("error")), g) {
12385
12400
  const m = Xn(F, async (R) => {
12386
12401
  if (R) {
12387
- const S = JSON.parse(be.STOKER_FB_WEB_APP_CONFIG);
12402
+ const S = JSON.parse(Oe.STOKER_FB_WEB_APP_CONFIG);
12388
12403
  zm(() => {
12389
12404
  console.log(`Tenant - ${S.projectId} - User - ${R.uid}`);
12390
12405
  });
@@ -12459,7 +12474,7 @@ const db = async (t, e, r, n) => {
12459
12474
  ...K,
12460
12475
  ...V
12461
12476
  }, i), At === "development" && v && !T?.includes("Firestore")) {
12462
- const Ve = be.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(be.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
12477
+ const Ve = Oe.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(Oe.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
12463
12478
  for (const [L, X] of Object.entries(He))
12464
12479
  L !== "maintenance" && qc(X, "localhost", Ve);
12465
12480
  }
@@ -12467,16 +12482,16 @@ const db = async (t, e, r, n) => {
12467
12482
  const Ve = mp(He.main);
12468
12483
  Ve && pp(Ve);
12469
12484
  }
12470
- const Re = await Qe(We(pt, be.STOKER_FB_FUNCTIONS_REGION), "stoker-schema")().catch((Ve) => {
12485
+ const _e = await Qe(We(pt, Oe.STOKER_FB_FUNCTIONS_REGION), "stoker-schema")().catch((Ve) => {
12471
12486
  throw new Error("Error fetching schema.", { cause: Ve });
12472
12487
  });
12473
12488
  if (S())
12474
12489
  return;
12475
- jr = Re.data.schema;
12476
- const xe = Object.entries(Re.data.allRoleGroups).map(([Ve, L]) => [Ve, new Set(L)]);
12477
- Ec = Object.fromEntries(xe), Sc = Re.data.currentUserRoleGroups, qm = Lg(Object.keys(jr.collections), e, "web", Po, n);
12490
+ jr = _e.data.schema;
12491
+ const xe = Object.entries(_e.data.allRoleGroups).map(([Ve, L]) => [Ve, new Set(L)]);
12492
+ Ec = Object.fromEntries(xe), Sc = _e.data.currentUserRoleGroups, qm = Lg(Object.keys(jr.collections), e, "web", Po, n);
12478
12493
  const et = await Cw(Le, y);
12479
- if (S() || (xn.push(...et), N === "WRITE" && Lw(jr, Le), await we(ge.postLogin, [Le]), S()))
12494
+ if (S() || (xn.push(...et), N === "WRITE" && Lw(jr, Le), await be(ge.postLogin, [Le]), S()))
12480
12495
  return;
12481
12496
  const Et = new Event("stoker:ready");
12482
12497
  document.dispatchEvent(Et);
@@ -12511,7 +12526,7 @@ const db = async (t, e, r, n) => {
12511
12526
  console.error('Error clearing indexedDB persistence in "[DEFAULT]".'), I.error = !0, I.instances.push({ instance: "[DEFAULT]", code: "CLEAR_CACHE", error: C });
12512
12527
  }), ["ALL", "WRITE"].includes(N) && await Vc(He.firestoreWrite).catch((C) => {
12513
12528
  console.error('Error clearing indexedDB persistence in "firestoreWrite".'), I.error = !0, I.instances.push({ instance: "firestoreWrite", code: "CLEAR_CACHE", error: C });
12514
- })), I.error ? console.info("Sign out operation completed with errors.") : console.info("Sign out operation completed successfully."), await we(ge.postLogout, [I]);
12529
+ })), I.error ? console.info("Sign out operation completed with errors.") : console.info("Sign out operation completed successfully."), await be(ge.postLogout, [I]);
12515
12530
  }
12516
12531
  }), O ? !1 : F.currentUser ? (g && console.info(`${F.currentUser.uid} successfully logged in.`), !0) : !1;
12517
12532
  }, { getTenant: qt, getEnv: Ze, getTimezone: $m, getSchema: ze, getCurrentUser: Lt, getCurrentUserRoleGroups: en, getAllRoleGroups: Tc, getGlobalConfigModule: De, getCollectionConfigModule: ht, getAppCheck: hb, getAppCheckFirestoreWrite: mb, getFirestoreWriteAuth: Jw, getFirestoreWrite: Rc, getFirestoreMaintenance: jm } = Po, pb = async (t, e, r) => {
@@ -12549,7 +12564,7 @@ const db = async (t, e, r, n) => {
12549
12564
  }
12550
12565
  console.info(`${a} successfully logged in.`);
12551
12566
  } catch (a) {
12552
- throw await we(i.postLogin, [null, a]), a;
12567
+ throw await be(i.postLogin, [null, a]), a;
12553
12568
  }
12554
12569
  }, gb = (t) => (document.addEventListener("stoker:ready", t), () => {
12555
12570
  document.removeEventListener("stoker:ready", t);
@@ -12634,7 +12649,7 @@ const db = async (t, e, r, n) => {
12634
12649
  if (Om(m, R), !s?.noComputedFields) {
12635
12650
  const P = [];
12636
12651
  for (const M of d.fields)
12637
- M.type === "Computed" && P.push(we(() => M.formula(m)).then((K) => {
12652
+ M.type === "Computed" && P.push(be(() => M.formula(m)).then((K) => {
12638
12653
  m && (m[M.name] = K);
12639
12654
  }));
12640
12655
  await Promise.all(P);
@@ -12643,14 +12658,14 @@ const db = async (t, e, r, n) => {
12643
12658
  for (const P of d.fields)
12644
12659
  P.type === "Embedding" && delete m[P.name];
12645
12660
  }
12646
- r(_e(m));
12661
+ r(ve(m));
12647
12662
  });
12648
- }, y = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), I = (C) => typeof C == "object" ? C.fields.filter((M) => typeof M == "object" && ve(M) && Wt(d, c, a, o).includes(M.collection)) : d.fields.filter((M) => ve(M) && Wt(d, c, a, o).includes(M.collection)), G = (C) => new Promise((P) => {
12663
+ }, y = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), I = (C) => typeof C == "object" ? C.fields.filter((M) => typeof M == "object" && we(M) && Wt(d, c, a, o).includes(M.collection)) : d.fields.filter((M) => we(M) && Wt(d, c, a, o).includes(M.collection)), G = (C) => new Promise((P) => {
12649
12664
  if (!s?.relations) {
12650
12665
  P({});
12651
12666
  return;
12652
12667
  }
12653
- const M = _e(s.relations), K = /* @__PURE__ */ new Map(), oe = /* @__PURE__ */ new Map(), ce = I(M);
12668
+ const M = ve(s.relations), K = /* @__PURE__ */ new Map(), oe = /* @__PURE__ */ new Map(), ce = I(M);
12654
12669
  for (const B of ce)
12655
12670
  for (const V of A.values())
12656
12671
  V.type === B.type && V.field === B.name && // eslint-disable-next-line security/detect-object-injection
@@ -12671,7 +12686,7 @@ const db = async (t, e, r, n) => {
12671
12686
  const V = m[B.name];
12672
12687
  if (!V)
12673
12688
  continue;
12674
- for (const [te, Re] of Object.entries(V))
12689
+ for (const [te, _e] of Object.entries(V))
12675
12690
  if (oe.has(`${B.name}_${te}`)) {
12676
12691
  const xe = async () => {
12677
12692
  V[te].id ? (K.set(`${B.name}_${te}`, !0), Array.from(K.values()).every((et) => et) && (P({}), S())) : setTimeout(xe, 100);
@@ -12679,7 +12694,7 @@ const db = async (t, e, r, n) => {
12679
12694
  xe();
12680
12695
  } else {
12681
12696
  const xe = c.collections[B.collection], { access: et } = xe, { serverReadOnly: Et } = et;
12682
- Et?.includes(a.Role) ? Sr([...Re.Collection_Path], te, {
12697
+ Et?.includes(a.Role) ? Sr([..._e.Collection_Path], te, {
12683
12698
  noComputedFields: s?.noComputedFields,
12684
12699
  noEmbeddingFields: s?.noEmbeddingFields
12685
12700
  }).then((L) => {
@@ -12703,11 +12718,11 @@ const db = async (t, e, r, n) => {
12703
12718
  listener: !0
12704
12719
  })));
12705
12720
  }).catch((L) => {
12706
- delete V[te], L.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${B.collection} with ID ${e} at location ${Re.Collection_Path?.join("/")}`, {
12721
+ delete V[te], L.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${B.collection} with ID ${e} at location ${_e.Collection_Path?.join("/")}`, {
12707
12722
  cause: L
12708
12723
  }));
12709
12724
  }) : Vm(
12710
- [...Re.Collection_Path],
12725
+ [..._e.Collection_Path],
12711
12726
  te,
12712
12727
  (L) => {
12713
12728
  if (!L) {
@@ -12732,7 +12747,7 @@ const db = async (t, e, r, n) => {
12732
12747
  },
12733
12748
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12734
12749
  (L) => {
12735
- delete V[te], L.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${B.collection} with ID ${e} at location ${Re.Collection_Path?.join("/")}`, {
12750
+ delete V[te], L.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${B.collection} with ID ${e} at location ${_e.Collection_Path?.join("/")}`, {
12736
12751
  cause: L
12737
12752
  }));
12738
12753
  },
@@ -12761,10 +12776,10 @@ const db = async (t, e, r, n) => {
12761
12776
  for (const B of ce)
12762
12777
  if ("collection" in B && K[B.name]) {
12763
12778
  const V = m?.[B.name] || {}, te = K[B.name];
12764
- for (const Re of Object.keys(V))
12765
- Re in te || delete V[Re];
12766
- for (const [Re, xe] of Object.entries(te))
12767
- V[Re]?.id || (V[Re] = xe);
12779
+ for (const _e of Object.keys(V))
12780
+ _e in te || delete V[_e];
12781
+ for (const [_e, xe] of Object.entries(te))
12782
+ V[_e]?.id || (V[_e] = xe);
12768
12783
  K[B.name] = V;
12769
12784
  }
12770
12785
  }
@@ -12851,7 +12866,7 @@ const db = async (t, e, r, n) => {
12851
12866
  if (!n.pagination?.orderByField || !n.pagination.orderByDirection)
12852
12867
  throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using startAfter");
12853
12868
  let U = he(W, nt(n.pagination.orderByField, n.pagination.orderByDirection), oo(N.last.get($)));
12854
- return n.pagination.number && (U = he(U, nr(n.pagination.number))), U;
12869
+ return n.pagination.number && (U = he(U, sr(n.pagination.number))), U;
12855
12870
  })) : n.pagination.endBefore ? (so(n.pagination.endBefore), T = T.map((W, $) => {
12856
12871
  if (!n.pagination?.orderByField || !n.pagination.orderByDirection)
12857
12872
  throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using endBefore");
@@ -12869,7 +12884,7 @@ const db = async (t, e, r, n) => {
12869
12884
  return n.pagination.number && (U = he(U, Mr(n.pagination.number))), U;
12870
12885
  })) : T = T.map((W) => {
12871
12886
  let $ = he(W);
12872
- return n.pagination?.orderByField && n.pagination.orderByDirection && ($ = he(W, nt(n.pagination.orderByField, n.pagination.orderByDirection))), n.pagination.number && ($ = he($, nr(n.pagination.number))), $;
12887
+ return n.pagination?.orderByField && n.pagination.orderByDirection && ($ = he(W, nt(n.pagination.orderByField, n.pagination.orderByDirection))), n.pagination.number && ($ = he($, sr(n.pagination.number))), $;
12873
12888
  });
12874
12889
  }
12875
12890
  const m = { collection: h.collection };
@@ -12880,8 +12895,8 @@ const db = async (t, e, r, n) => {
12880
12895
  C.forEach((U) => {
12881
12896
  Om(U, P.get(U.id));
12882
12897
  for (const H of d.fields)
12883
- H.type === "Computed" && !n?.noComputedFields && $.push(we(H.formula, [U, W]).then((Oe) => {
12884
- U[H.name] = Oe;
12898
+ H.type === "Computed" && !n?.noComputedFields && $.push(be(H.formula, [U, W]).then((Ee) => {
12899
+ U[H.name] = Ee;
12885
12900
  })), n?.noEmbeddingFields && H.type === "Embedding" && delete U[H.name];
12886
12901
  }), Promise.all($).then(() => {
12887
12902
  e(Array.from(C.values()), L, X), (xe || X?.fromCache === !1) && C.forEach((U) => {
@@ -12902,7 +12917,7 @@ const db = async (t, e, r, n) => {
12902
12917
  }), A.size === O.length && W) {
12903
12918
  y = !1;
12904
12919
  const $ = Md(f, () => {
12905
- $(), !n?.noComputedFields && k?.admin?.retriever ? we(k.admin.retriever).then((U) => {
12920
+ $(), !n?.noComputedFields && k?.admin?.retriever ? be(k.admin.retriever).then((U) => {
12906
12921
  K(L, X, U);
12907
12922
  }) : K(L, X);
12908
12923
  });
@@ -12922,7 +12937,7 @@ const db = async (t, e, r, n) => {
12922
12937
  return;
12923
12938
  const W = L.id;
12924
12939
  I.set(W, "loading"), B[W] ||= /* @__PURE__ */ new Map();
12925
- const $ = _e(n?.relations), U = typeof $ == "object" ? $.fields.filter((pe) => typeof pe == "object" && ve(pe) && Wt(d, c, a, o).includes(pe.collection)) : d.fields.filter((pe) => ve(pe) && Wt(d, c, a, o).includes(pe.collection)), H = /* @__PURE__ */ new Map(), Oe = /* @__PURE__ */ new Map();
12940
+ const $ = ve(n?.relations), U = typeof $ == "object" ? $.fields.filter((pe) => typeof pe == "object" && we(pe) && Wt(d, c, a, o).includes(pe.collection)) : d.fields.filter((pe) => we(pe) && Wt(d, c, a, o).includes(pe.collection)), H = /* @__PURE__ */ new Map(), Ee = /* @__PURE__ */ new Map();
12926
12941
  ce[W] ||= /* @__PURE__ */ new Map();
12927
12942
  for (const pe of U)
12928
12943
  for (const Ae of B[W].entries()) {
@@ -12936,7 +12951,7 @@ const db = async (t, e, r, n) => {
12936
12951
  if (!Ae)
12937
12952
  continue;
12938
12953
  for (const ie of Object.keys(Ae))
12939
- !Ae?.[ie].id && !ce[W].has(ie) && (H.set(ie, !1), ce[W].has(ie) ? Oe.set(ie, !0) : ce[W].set(ie, !0));
12954
+ !Ae?.[ie].id && !ce[W].has(ie) && (H.set(ie, !1), ce[W].has(ie) ? Ee.set(ie, !0) : ce[W].set(ie, !0));
12940
12955
  }
12941
12956
  if (H.size === 0)
12942
12957
  I.set(W, "loaded"), oe(X);
@@ -12947,14 +12962,14 @@ const db = async (t, e, r, n) => {
12947
12962
  if (!Ae)
12948
12963
  continue;
12949
12964
  for (const [ie, Fe] of Object.entries(Ae))
12950
- if (Oe.has(ie)) {
12965
+ if (Ee.has(ie)) {
12951
12966
  const Ie = async () => {
12952
12967
  Ae[ie].id ? (H.set(ie, !0), Array.from(H.values()).every((St) => St) && I.set(W, "loaded")) : setTimeout(Ie, 100);
12953
12968
  };
12954
12969
  Ie();
12955
12970
  } else {
12956
- const Ie = c.collections[pe.collection], { access: St } = Ie, { serverReadOnly: Qt } = St;
12957
- Qt?.includes(a.Role) ? Sr([...Fe.Collection_Path], ie).then((Ne) => {
12971
+ const Ie = c.collections[pe.collection], { access: St } = Ie, { serverReadOnly: Xt } = St;
12972
+ Xt?.includes(a.Role) ? Sr([...Fe.Collection_Path], ie).then((Ne) => {
12958
12973
  if (!Ne) {
12959
12974
  delete Ae[ie];
12960
12975
  return;
@@ -13004,14 +13019,14 @@ const db = async (t, e, r, n) => {
13004
13019
  }
13005
13020
  }
13006
13021
  }, te = (L) => {
13007
- const X = _e(n?.relations), W = typeof X == "object" ? X.fields.filter(($) => typeof $ == "object" && ve($) && Wt(d, c, a, o).includes($.collection)) : d.fields.filter(($) => ve($) && Wt(d, c, a, o).includes($.collection));
13022
+ const X = ve(n?.relations), W = typeof X == "object" ? X.fields.filter(($) => typeof $ == "object" && we($) && Wt(d, c, a, o).includes($.collection)) : d.fields.filter(($) => we($) && Wt(d, c, a, o).includes($.collection));
13008
13023
  for (const $ of W)
13009
13024
  if (B[L])
13010
13025
  for (const U of B[L].entries()) {
13011
- const [H, Oe] = U;
13012
- Oe.doc === L && Oe.type === $.type && Oe.field === $.name && (Oe.listener(), ce[L].delete(H));
13026
+ const [H, Ee] = U;
13027
+ Ee.doc === L && Ee.type === $.type && Ee.field === $.name && (Ee.listener(), ce[L].delete(H));
13013
13028
  }
13014
- }, Re = (L, X, W) => {
13029
+ }, _e = (L, X, W) => {
13015
13030
  const $ = W.data({
13016
13031
  serverTimestamps: _ || "none"
13017
13032
  });
@@ -13030,11 +13045,11 @@ const db = async (t, e, r, n) => {
13030
13045
  let X = !0;
13031
13046
  const W = _r(L, { source: xe ? "cache" : "default", includeMetadataChanges: !0 }, ($) => {
13032
13047
  (xe || $.metadata.fromCache === !1) && (A.set(L, !0), N.first.set(O.indexOf(L), $.docs[0]), N.last.set(O.indexOf(L), $.docs.at(-1) || $.docs[0]), y && n?.relations || oe(N, $.metadata)), A.get(L) === !0 && (X ? ($.docs.forEach((U) => {
13033
- const H = C.get(U.id) || {}, Oe = M.get(U.id) || 0;
13034
- M.set(U.id, Oe + 1), Re(L, H, U);
13048
+ const H = C.get(U.id) || {}, Ee = M.get(U.id) || 0;
13049
+ M.set(U.id, Ee + 1), _e(L, H, U);
13035
13050
  }), X = !1) : $.docChanges().forEach((U) => {
13036
- const H = C.get(U.doc.id) || {}, Oe = M.get(U.doc.id) || 0;
13037
- U.type === "added" && M.set(U.doc.id, Oe + 1), U.type === "added" || U.type === "modified" ? Re(L, H, U.doc) : U.type === "removed" && (M.set(U.doc.id, Oe - 1), M.get(U.doc.id) === 0 && (C.delete(U.doc.id), A.size === O.length && n?.relations && (I.set(U.doc.id, "deleted"), te(U.doc.id))));
13051
+ const H = C.get(U.doc.id) || {}, Ee = M.get(U.doc.id) || 0;
13052
+ U.type === "added" && M.set(U.doc.id, Ee + 1), U.type === "added" || U.type === "modified" ? _e(L, H, U.doc) : U.type === "removed" && (M.set(U.doc.id, Ee - 1), M.get(U.doc.id) === 0 && (C.delete(U.doc.id), A.size === O.length && n?.relations && (I.set(U.doc.id, "deleted"), te(U.doc.id))));
13038
13053
  }), A.size === O.length && n?.relations && (C.size === 0 && oe(N, $.metadata), C.forEach((U) => {
13039
13054
  V(U, N);
13040
13055
  })));
@@ -13092,7 +13107,7 @@ const db = async (t, e, r, n) => {
13092
13107
  const b = Array.isArray(g) ? g : [g];
13093
13108
  b.length > 0 && b[0] && (_.bcc = g);
13094
13109
  }
13095
- w && (_.replyTo = w), o && (_.message.attachments = o), E && (_.from = E), await qd(ir(k, "system_mail"), _);
13110
+ w && (_.replyTo = w), o && (_.message.attachments = o), E && (_.from = E), await qd(ar(k, "system_mail"), _);
13096
13111
  }, Xw = async (t) => {
13097
13112
  const e = at(), r = Ze(), n = We(e, r.STOKER_FB_FUNCTIONS_REGION);
13098
13113
  await Qe(n, "stoker-adminsms")({
@@ -13104,7 +13119,7 @@ const db = async (t, e, r, n) => {
13104
13119
  return;
13105
13120
  }
13106
13121
  const s = Be(), i = { to: t, body: e };
13107
- await qd(ir(s, "system_messages"), i);
13122
+ await qd(ar(s, "system_messages"), i);
13108
13123
  }, Rb = (t) => {
13109
13124
  const e = $m();
13110
13125
  return Y.fromJSDate(t).setZone(e);
@@ -13117,7 +13132,7 @@ const db = async (t, e, r, n) => {
13117
13132
  }, Cb = (t, e) => {
13118
13133
  const n = Y.fromJSDate(t, { zone: e }).offset, i = Y.fromJSDate(t).offset, a = n - i;
13119
13134
  return Y.fromJSDate(t).minus({ minutes: a }).toJSDate();
13120
- }, kb = (t) => "seconds" in t && "nanoseconds" in t ? eb(new Kt(t.seconds, t.nanoseconds)).toFormat("MMMM d, yyyy '@' h:mm a") : "";
13135
+ }, kb = (t) => "seconds" in t && "nanoseconds" in t ? eb(new Yt(t.seconds, t.nanoseconds)).toFormat("MMMM d, yyyy '@' h:mm a") : "";
13121
13136
  export {
13122
13137
  xm as addRecord,
13123
13138
  Dw as addRecordServer,
@@ -13137,7 +13152,7 @@ export {
13137
13152
  ne as getCachedConfigValue,
13138
13153
  ht as getCollectionConfigModule,
13139
13154
  gc as getCollectionRefs,
13140
- Ht as getConnectionStatus,
13155
+ Kt as getConnectionStatus,
13141
13156
  Lt as getCurrentUser,
13142
13157
  qe as getCurrentUserPermissions,
13143
13158
  en as getCurrentUserRoleGroups,
@@ -13181,7 +13196,7 @@ export {
13181
13196
  Pm as signOut,
13182
13197
  Ob as subscribeMany,
13183
13198
  Vm as subscribeOne,
13184
- we as tryPromise,
13199
+ be as tryPromise,
13185
13200
  wc as updateRecord,
13186
13201
  Nw as updateRecordServer,
13187
13202
  bb as waitForPendingWrites