@instantdb/react 0.22.60 → 0.22.61-experimental.delay-looking-at-store.19555739599.1

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.
@@ -1,4 +1,4 @@
1
- import ci, { useRef as at, useCallback as ge, useSyncExternalStore as nn, useEffect as je, useMemo as rn, useState as di, createElement as ks } from "react";
1
+ import ci, { useRef as ut, useCallback as ge, useSyncExternalStore as nn, useEffect as je, useMemo as rn, useState as di, createElement as ks } from "react";
2
2
  function V(t) {
3
3
  if (typeof t == "number")
4
4
  return (Math.abs(t * 2654435761) >>> 0).toString(16);
@@ -45,10 +45,10 @@ const U = {
45
45
  mutable: "mutable",
46
46
  immutable: "immutable"
47
47
  }, Rn = {};
48
- function nt(t, e) {
48
+ function rt(t, e) {
49
49
  return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
50
50
  }
51
- function wr(t, e) {
51
+ function Tr(t, e) {
52
52
  if (e in t) {
53
53
  let n = Reflect.getPrototypeOf(t);
54
54
  for (; n; ) {
@@ -92,7 +92,7 @@ function li(t, e = []) {
92
92
  if (r !== null && (r == null ? void 0 : r.original) !== t.original)
93
93
  return null;
94
94
  const i = t.parent.type === 3, s = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
95
- if (!(i && n.size > s || nt(n, s)))
95
+ if (!(i && n.size > s || rt(n, s)))
96
96
  return null;
97
97
  e.push(s);
98
98
  }
@@ -112,7 +112,7 @@ function Pe(t) {
112
112
  function be(t, e) {
113
113
  return Pe(t) === 2 ? t.get(e) : t[e];
114
114
  }
115
- function ct(t, e, n) {
115
+ function dt(t, e, n) {
116
116
  Pe(t) === 2 ? t.set(e, n) : t[e] = n;
117
117
  }
118
118
  function Ht(t, e) {
@@ -196,15 +196,15 @@ function hi(t, e) {
196
196
  function Q(t) {
197
197
  t.copy || (t.copy = hi(t.original, t.options));
198
198
  }
199
- function Je(t) {
199
+ function Ze(t) {
200
200
  if (!ae(t))
201
201
  return Dn(t);
202
202
  if (Array.isArray(t))
203
- return t.map(Je);
203
+ return t.map(Ze);
204
204
  if (t instanceof Map) {
205
205
  const n = Array.from(t.entries()).map(([r, i]) => [
206
206
  r,
207
- Je(i)
207
+ Ze(i)
208
208
  ]);
209
209
  if (!$n(t)) {
210
210
  const r = Object.getPrototypeOf(t).constructor;
@@ -213,7 +213,7 @@ function Je(t) {
213
213
  return new Map(n);
214
214
  }
215
215
  if (t instanceof Set) {
216
- const n = Array.from(t).map(Je);
216
+ const n = Array.from(t).map(Ze);
217
217
  if (!xn(t)) {
218
218
  const r = Object.getPrototypeOf(t).constructor;
219
219
  return new r(n);
@@ -222,20 +222,20 @@ function Je(t) {
222
222
  }
223
223
  const e = Object.create(Object.getPrototypeOf(t));
224
224
  for (const n in t)
225
- e[n] = Je(t[n]);
225
+ e[n] = Ze(t[n]);
226
226
  return e;
227
227
  }
228
228
  function St(t) {
229
- return Ce(t) ? Je(t) : t;
229
+ return Ce(t) ? Ze(t) : t;
230
230
  }
231
231
  function fe(t) {
232
232
  var e;
233
233
  t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && fe(t.parent));
234
234
  }
235
- function Tr() {
235
+ function wr() {
236
236
  throw new Error("Cannot modify frozen object");
237
237
  }
238
- function Re(t, e, n, r, i) {
238
+ function xe(t, e, n, r, i) {
239
239
  {
240
240
  n = n ?? /* @__PURE__ */ new WeakMap(), r = r ?? [], i = i ?? [];
241
241
  const o = n.has(t) ? n.get(t) : t;
@@ -259,24 +259,24 @@ function Re(t, e, n, r, i) {
259
259
  switch (Pe(t)) {
260
260
  case 2:
261
261
  for (const [a, u] of t)
262
- Re(a, a, n, r, i), Re(u, a, n, r, i);
263
- t.set = t.clear = t.delete = Tr;
262
+ xe(a, a, n, r, i), xe(u, a, n, r, i);
263
+ t.set = t.clear = t.delete = wr;
264
264
  break;
265
265
  case 3:
266
266
  for (const a of t)
267
- Re(a, a, n, r, i);
268
- t.add = t.clear = t.delete = Tr;
267
+ xe(a, a, n, r, i);
268
+ t.add = t.clear = t.delete = wr;
269
269
  break;
270
270
  case 1:
271
271
  Object.freeze(t);
272
272
  let o = 0;
273
273
  for (const a of t)
274
- Re(a, o, n, r, i), o += 1;
274
+ xe(a, o, n, r, i), o += 1;
275
275
  break;
276
276
  default:
277
277
  Object.freeze(t), Object.keys(t).forEach((a) => {
278
278
  const u = t[a];
279
- Re(u, a, n, r, i);
279
+ xe(u, a, n, r, i);
280
280
  });
281
281
  }
282
282
  r.pop(), i.pop();
@@ -304,7 +304,7 @@ function pi(t, e, n) {
304
304
  const u = j(o);
305
305
  Q(u);
306
306
  const d = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
307
- ct(r ? i : t, s, d);
307
+ dt(r ? i : t, s, d);
308
308
  } else
309
309
  pi(o, e, n);
310
310
  }), i) {
@@ -339,7 +339,7 @@ function Ln(t, e, n, r) {
339
339
  const u = t.type === 3 ? t.setMap : t.copy;
340
340
  if (ye(be(u, e), n)) {
341
341
  let d = i.original;
342
- i.copy && (d = i.copy), on(t), an(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)), ct(u, e, d);
342
+ i.copy && (d = i.copy), on(t), an(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)), dt(u, e, d);
343
343
  }
344
344
  }), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ae(n, t.options) && t.finalities.draft.push(() => {
345
345
  const s = t.type === 3 ? t.setMap : t.copy;
@@ -394,7 +394,7 @@ function Rs(t, e, n, r, i) {
394
394
  }
395
395
  function xs({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
396
396
  n.forEach((a, u) => {
397
- const d = be(t, u), c = St(be(e, u)), f = a ? nt(t, u) ? U.Replace : U.Add : U.Remove;
397
+ const d = be(t, u), c = St(be(e, u)), f = a ? rt(t, u) ? U.Replace : U.Add : U.Remove;
398
398
  if (ye(d, c) && f === U.Replace)
399
399
  return;
400
400
  const l = r.concat(u), p = Ae(l, o);
@@ -433,7 +433,7 @@ function $s({ original: t, copy: e }, n, r, i, s) {
433
433
  o += 1;
434
434
  });
435
435
  }
436
- function ut(t, e, n, r) {
436
+ function ct(t, e, n, r) {
437
437
  const { pathAsArray: i = !0 } = t.options.enablePatches;
438
438
  switch (t.type) {
439
439
  case 0:
@@ -457,7 +457,7 @@ const jt = (t, e, n = !1) => {
457
457
  },
458
458
  set(t, e) {
459
459
  const n = j(this), r = te(n);
460
- return (!r.has(t) || !ye(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), Ln(n, t, e, ut)), this;
460
+ return (!r.has(t) || !ye(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), Ln(n, t, e, ct)), this;
461
461
  },
462
462
  delete(t) {
463
463
  if (!this.has(t))
@@ -565,7 +565,7 @@ const jt = (t, e, n = !1) => {
565
565
  },
566
566
  add(t) {
567
567
  const e = j(this);
568
- return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Ln(e, t, t, ut)), this;
568
+ return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Ln(e, t, t, ct)), this;
569
569
  },
570
570
  delete(t) {
571
571
  if (!this.has(t))
@@ -669,8 +669,8 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
669
669
  if (d)
670
670
  return d.bind(t.proxy);
671
671
  }
672
- if (!nt(a, e)) {
673
- const d = wr(a, e);
672
+ if (!rt(a, e)) {
673
+ const d = Tr(a, e);
674
674
  return d ? "value" in d ? d.value : (
675
675
  // !case: support for getter
676
676
  (i = d.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
@@ -701,11 +701,11 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
701
701
  let i;
702
702
  if (t.type === 1 && e !== "length" && !(Number.isInteger(i = Number(e)) && i >= 0 && (e === 0 || i === 0 || String(i) === String(e))))
703
703
  throw new Error("Only supports setting array indices and the 'length' property.");
704
- const s = wr(te(t), e);
704
+ const s = Tr(te(t), e);
705
705
  if (s != null && s.set)
706
706
  return s.set.call(t.proxy, n), !0;
707
707
  const o = Ht(te(t), e), a = j(o);
708
- return a && ye(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ye(n, o) && (n !== void 0 || nt(t.original, e)) || (Q(t), fe(t), nt(t.original, e) && ye(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, Ln(t, e, n, ut)), !0);
708
+ return a && ye(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ye(n, o) && (n !== void 0 || rt(t.original, e)) || (Q(t), fe(t), rt(t.original, e) && ye(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, Ln(t, e, n, ct)), !0);
709
709
  },
710
710
  has(t, e) {
711
711
  return e in te(t);
@@ -757,10 +757,10 @@ function Fn(t) {
757
757
  var p, y;
758
758
  const b = j(u);
759
759
  let _ = c.type === 3 ? c.setMap : c.copy;
760
- const T = be(_, r), w = j(T);
761
- if (w) {
762
- let m = w.original;
763
- w.operated && (m = Dn(T)), on(w), an(w, ut, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(m, w.original)), ct(_, r, m);
760
+ const w = be(_, r), g = j(w);
761
+ if (g) {
762
+ let m = g.original;
763
+ g.operated && (m = Dn(w)), on(g), an(g, ct, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(m, g.original)), dt(_, r, m);
764
764
  }
765
765
  (y = b.callbacks) === null || y === void 0 || y.forEach((m) => {
766
766
  m(f, l);
@@ -769,7 +769,7 @@ function Fn(t) {
769
769
  } else {
770
770
  const c = j(u);
771
771
  c.finalities.draft.push((f, l) => {
772
- on(c), an(c, ut, f, l);
772
+ on(c), an(c, ct, f, l);
773
773
  });
774
774
  }
775
775
  return u;
@@ -782,7 +782,7 @@ function Ls(t, e, n, r, i) {
782
782
  for (; o.finalities.draft.length > 0; )
783
783
  o.finalities.draft.pop()(n, r);
784
784
  const d = u ? e[0] : o ? o.operated ? o.copy : o.original : t;
785
- return o && sn(o), i && Re(d, d, o == null ? void 0 : o.options.updatedValues), [
785
+ return o && sn(o), i && xe(d, d, o == null ? void 0 : o.options.updatedValues), [
786
786
  d,
787
787
  n && u ? [{ op: U.Replace, path: [], value: e[0] }] : n,
788
788
  r && u ? [{ op: U.Replace, path: [], value: a }] : r
@@ -822,7 +822,7 @@ function cn(t) {
822
822
  const c = Array.from(a);
823
823
  a.clear(), c.forEach((f) => a.add(s === f ? d : f));
824
824
  } else
825
- ct(a, s, d);
825
+ dt(a, s, d);
826
826
  } else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, cn(t));
827
827
  }), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
828
828
  }
@@ -851,7 +851,7 @@ function _i(t) {
851
851
  if (n && ye(be(n.original, o), a))
852
852
  return;
853
853
  const u = _i(a);
854
- u !== a && (i === t && s(), ct(i, o, u));
854
+ u !== a && (i === t && s(), dt(i, o, u));
855
855
  }), r === 3) {
856
856
  const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : i;
857
857
  return xn(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
@@ -867,7 +867,7 @@ const Ns = (t) => function e(n, r, i) {
867
867
  var s, o, a;
868
868
  if (typeof n == "function" && typeof r != "function")
869
869
  return function(S, ...I) {
870
- return e(S, (x) => n.call(this, x, ...I), r);
870
+ return e(S, (R) => n.call(this, R, ...I), r);
871
871
  };
872
872
  const u = n, d = r;
873
873
  let c = i;
@@ -875,10 +875,10 @@ const Ns = (t) => function e(n, r, i) {
875
875
  throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
876
876
  c = Object.assign(Object.assign({}, t), c);
877
877
  const f = Ce(u) ? vr(u) : u, l = Array.isArray(c.mark) ? (S, I) => {
878
- for (const x of c.mark) {
879
- if (typeof x != "function")
880
- throw new Error(`Invalid mark: ${x}, 'mark' should be a function.`);
881
- const q = x(S, I);
878
+ for (const R of c.mark) {
879
+ if (typeof R != "function")
880
+ throw new Error(`Invalid mark: ${R}, 'mark' should be a function.`);
881
+ const q = R(S, I);
882
882
  if (q)
883
883
  return q;
884
884
  }
@@ -890,47 +890,47 @@ const Ns = (t) => function e(n, r, i) {
890
890
  };
891
891
  if (!ae(f, _) && typeof f == "object" && f !== null)
892
892
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
893
- const [T, w] = Fs(f, _);
893
+ const [w, g] = Fs(f, _);
894
894
  if (typeof r != "function") {
895
895
  if (!ae(f, _))
896
896
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
897
- return [T, w];
897
+ return [w, g];
898
898
  }
899
899
  let m;
900
900
  try {
901
- m = d(T);
901
+ m = d(w);
902
902
  } catch (S) {
903
- throw sn(j(T)), S;
903
+ throw sn(j(w)), S;
904
904
  }
905
905
  const E = (S) => {
906
- const I = j(T);
906
+ const I = j(w);
907
907
  if (!Ce(S)) {
908
- if (S !== void 0 && !ye(S, T) && (I != null && I.operated))
908
+ if (S !== void 0 && !ye(S, w) && (I != null && I.operated))
909
909
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
910
910
  const q = S == null ? void 0 : S[js];
911
911
  if (q) {
912
- const Te = q[0];
912
+ const we = q[0];
913
913
  return _.strict && typeof S == "object" && S !== null && cn({
914
914
  rootDraft: I,
915
915
  value: S,
916
916
  useRawReturn: !0
917
- }), w([Te]);
917
+ }), g([we]);
918
918
  }
919
919
  if (S !== void 0)
920
- return typeof S == "object" && S !== null && cn({ rootDraft: I, value: S }), w([S]);
920
+ return typeof S == "object" && S !== null && cn({ rootDraft: I, value: S }), g([S]);
921
921
  }
922
- if (S === T || S === void 0)
923
- return w([]);
924
- const x = j(S);
925
- if (_ === x.options) {
926
- if (x.operated)
922
+ if (S === w || S === void 0)
923
+ return g([]);
924
+ const R = j(S);
925
+ if (_ === R.options) {
926
+ if (R.operated)
927
927
  throw new Error("Cannot return a modified child draft.");
928
- return w([vr(S)]);
928
+ return g([vr(S)]);
929
929
  }
930
- return w([S]);
930
+ return g([S]);
931
931
  };
932
932
  return m instanceof Promise ? m.then(E, (S) => {
933
- throw sn(j(T)), S;
933
+ throw sn(j(w)), S;
934
934
  }) : E(m);
935
935
  }, Pt = Ns();
936
936
  Object.prototype.constructor.toString();
@@ -945,15 +945,15 @@ function Ot(t, e) {
945
945
  return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : gi(t, e) ? Object.keys(t).every((n) => Ot(t[n], e[n])) : !1;
946
946
  }
947
947
  function Nn(t) {
948
- if (!Ze(t))
948
+ if (!Xe(t))
949
949
  return t;
950
950
  const e = {};
951
951
  for (const [n, r] of Object.entries(t))
952
952
  r !== void 0 && (e[n] = r);
953
953
  return e;
954
954
  }
955
- function wi(t, e) {
956
- if (!Ze(t) || !Ze(e))
955
+ function Ti(t, e) {
956
+ if (!Xe(t) || !Xe(e))
957
957
  return e;
958
958
  const n = Object.assign({}, t);
959
959
  for (const r of Object.keys(e)) {
@@ -963,12 +963,12 @@ function wi(t, e) {
963
963
  delete n[r];
964
964
  continue;
965
965
  }
966
- const i = Ze(t[r]) && Ze(e[r]);
967
- n[r] = i ? wi(t[r], e[r]) : e[r];
966
+ const i = Xe(t[r]) && Xe(e[r]);
967
+ n[r] = i ? Ti(t[r], e[r]) : e[r];
968
968
  }
969
969
  return n;
970
970
  }
971
- function Ze(t) {
971
+ function Xe(t) {
972
972
  return typeof t == "object" && t !== null && !Array.isArray(t);
973
973
  }
974
974
  function Ks(t, e, n) {
@@ -992,7 +992,7 @@ function Or(t, e, n) {
992
992
  }
993
993
  r[e[e.length - 1]] = n;
994
994
  }
995
- function Ti(t, e) {
995
+ function wi(t, e) {
996
996
  if (!t || e.length === 0)
997
997
  return;
998
998
  const [n, ...r] = e;
@@ -1001,7 +1001,7 @@ function Ti(t, e) {
1001
1001
  Array.isArray(t) ? t.splice(n, 1) : delete t[n];
1002
1002
  return;
1003
1003
  }
1004
- Ti(t[n], r), qs(t[n]) && delete t[n];
1004
+ wi(t[n], r), qs(t[n]) && delete t[n];
1005
1005
  }
1006
1006
  }
1007
1007
  function qs(t) {
@@ -1331,10 +1331,10 @@ function Kn(t) {
1331
1331
  function qn(t) {
1332
1332
  return t["value-type"] === "blob";
1333
1333
  }
1334
- function We(t, e) {
1334
+ function ze(t, e) {
1335
1335
  return t[e];
1336
1336
  }
1337
- function ze(t, e) {
1337
+ function Ve(t, e) {
1338
1338
  return e.reduce((n, r) => n && n.get(r), t);
1339
1339
  }
1340
1340
  function oe(t, e) {
@@ -1362,7 +1362,7 @@ function mi(t, e, n) {
1362
1362
  const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1363
1363
  for (const o of e) {
1364
1364
  let [a, u, d, c] = o;
1365
- const f = We(t, u);
1365
+ const f = ze(t, u);
1366
1366
  if (!f) {
1367
1367
  console.warn("no such attr", a, t);
1368
1368
  continue;
@@ -1396,7 +1396,7 @@ function Oi(t) {
1396
1396
  return Et(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
1397
1397
  }
1398
1398
  function oo(t, e) {
1399
- return ze(t.eav, [e]) !== void 0;
1399
+ return Ve(t.eav, [e]) !== void 0;
1400
1400
  }
1401
1401
  function Wn(t) {
1402
1402
  t.attrIndexes = vi(t.attrs);
@@ -1405,7 +1405,7 @@ function Et(t, e, n, r, i) {
1405
1405
  const s = mi(t, e, i);
1406
1406
  return s.useDateObjects = i, s.attrs = t, s.attrIndexes = vi(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
1407
1407
  }
1408
- function dt(t, e) {
1408
+ function ft(t, e) {
1409
1409
  var n, r;
1410
1410
  let i;
1411
1411
  if (Array.isArray(e[0])) {
@@ -1433,49 +1433,49 @@ function dt(t, e) {
1433
1433
  }
1434
1434
  }
1435
1435
  function Ei(t, e) {
1436
- const n = dt(t, e);
1436
+ const n = ft(t, e);
1437
1437
  if (!n)
1438
1438
  return;
1439
- const [r, i, s] = n, o = We(t.attrs, i);
1439
+ const [r, i, s] = n, o = ze(t.attrs, i);
1440
1440
  o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]), Kn(o) && oe(t.vae, [s, i, r]));
1441
1441
  }
1442
1442
  let ao = 0;
1443
1443
  function Ai(t, e, n) {
1444
1444
  const [r, i, s] = n;
1445
1445
  let o;
1446
- const a = ze(t.ea, [r, i, s]);
1446
+ const a = Ve(t.ea, [r, i, s]);
1447
1447
  return a && (o = a[3]), o || Date.now() * 10 + ao++;
1448
1448
  }
1449
1449
  function ki(t, e) {
1450
1450
  var n;
1451
- const r = dt(t, e);
1451
+ const r = ft(t, e);
1452
1452
  if (!r)
1453
1453
  return;
1454
1454
  let [i, s, o] = r;
1455
- const a = We(t.attrs, s);
1455
+ const a = ze(t.attrs, s);
1456
1456
  if (!a)
1457
1457
  return;
1458
1458
  a["checked-data-type"] === "date" && t.useDateObjects && (o = xt(o));
1459
- const u = ze(t.eav, [i, s, o]), d = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n : Ai(t, a, r), c = [i, s, o, d];
1459
+ const u = Ve(t.eav, [i, s, o]), d = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n : Ai(t, a, r), c = [i, s, o, d];
1460
1460
  so(a) ? (Z(t.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), Z(t.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (Z(t.eav, [i, s, o], c), Z(t.aev, [s, i, o], c)), Kn(a) && Z(t.vae, [o, s, i], c);
1461
1461
  }
1462
1462
  function uo(t, e) {
1463
1463
  var n;
1464
- const r = dt(t, e);
1464
+ const r = ft(t, e);
1465
1465
  if (!r)
1466
1466
  return;
1467
- const [i, s, o] = r, a = We(t.attrs, s);
1467
+ const [i, s, o] = r, a = ze(t.attrs, s);
1468
1468
  if (!a)
1469
1469
  return;
1470
1470
  if (!qn(a))
1471
1471
  throw new Error("merge operation is not supported for links");
1472
- const u = ze(t.eav, [i, s]);
1472
+ const u = Ve(t.eav, [i, s]);
1473
1473
  if (!u)
1474
1474
  return;
1475
1475
  const d = (n = u.values().next()) === null || n === void 0 ? void 0 : n.value;
1476
1476
  if (!d)
1477
1477
  return;
1478
- const c = d[2], f = wi(c, o), l = [
1478
+ const c = d[2], f = Ti(c, o), l = [
1479
1479
  i,
1480
1480
  s,
1481
1481
  f,
@@ -1485,7 +1485,7 @@ function uo(t, e) {
1485
1485
  }
1486
1486
  function fn(t, e) {
1487
1487
  var n, r;
1488
- const [i, s] = e, o = dt(t, [i]);
1488
+ const [i, s] = e, o = ft(t, [i]);
1489
1489
  if (!o)
1490
1490
  return;
1491
1491
  const [a] = o, u = t.eav.get(a);
@@ -1506,8 +1506,8 @@ function fn(t, e) {
1506
1506
  const d = t.vae.get(a) && X(t.vae.get(a), 2);
1507
1507
  d && d.forEach((c) => {
1508
1508
  var f, l, p;
1509
- const [y, b, _] = c, T = t.attrs[b];
1510
- (!s || !T || ((f = T["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (oe(t.eav, [y, b, _]), oe(t.aev, [b, y, _]), oe(t.vae, [_, b, y])), T && T["on-delete"] === "cascade" && ((l = T["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && fn(t, [y, (p = T["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
1509
+ const [y, b, _] = c, w = t.attrs[b];
1510
+ (!s || !w || ((f = w["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (oe(t.eav, [y, b, _]), oe(t.aev, [b, y, _]), oe(t.vae, [_, b, y])), w && w["on-delete"] === "cascade" && ((l = w["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && fn(t, [y, (p = w["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
1511
1511
  }), ((r = t.vae.get(a)) === null || r === void 0 ? void 0 : r.size) === 0 && oe(t.vae, [a]);
1512
1512
  }
1513
1513
  function ji(t, e) {
@@ -1671,7 +1671,7 @@ function bo(t, e, n) {
1671
1671
  }
1672
1672
  return i;
1673
1673
  }
1674
- function we(t, e, n) {
1674
+ function Te(t, e, n) {
1675
1675
  var r;
1676
1676
  return (r = t.attrIndexes.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
1677
1677
  }
@@ -1688,14 +1688,14 @@ function Ii(t, e) {
1688
1688
  return r || ((n = t.attrIndexes.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
1689
1689
  }
1690
1690
  function go(t, e) {
1691
- const n = dt(t, e);
1691
+ const n = ft(t, e);
1692
1692
  if (!n)
1693
1693
  return;
1694
1694
  const [r, i, s] = n;
1695
- if (We(t.attrs, i))
1696
- return ze(t.eav, [r, i]);
1695
+ if (ze(t.attrs, i))
1696
+ return Ve(t.eav, [r, i]);
1697
1697
  }
1698
- function wo(t, e) {
1698
+ function To(t, e) {
1699
1699
  const n = e.filter(([r, i, s, o, a]) => {
1700
1700
  if (r !== "add-triple" && r !== "deep-merge-triple")
1701
1701
  return !0;
@@ -1703,7 +1703,7 @@ function wo(t, e) {
1703
1703
  if (u !== "create" && u !== "update")
1704
1704
  return !0;
1705
1705
  let d = !1;
1706
- const c = We(t.attrs, s);
1706
+ const c = ze(t.attrs, s);
1707
1707
  if (c) {
1708
1708
  const f = Ii(t, c["forward-identity"][1]);
1709
1709
  d = !!go(t, [i, f.id, i]);
@@ -1716,7 +1716,7 @@ function wo(t, e) {
1716
1716
  });
1717
1717
  });
1718
1718
  }
1719
- function To(t) {
1719
+ function wo(t) {
1720
1720
  return typeof t == "string" && t.startsWith("?");
1721
1721
  }
1722
1722
  function mo(t, e, n) {
@@ -1770,7 +1770,7 @@ function ln(t, e, n = [{}]) {
1770
1770
  return e.reduce((r, i) => ko(t, i, r), n);
1771
1771
  }
1772
1772
  function zn(t, e) {
1773
- return Array.isArray(e) ? e.map((n) => zn(t, n)) : To(e) ? t[e] : e;
1773
+ return Array.isArray(e) ? e.map((n) => zn(t, n)) : wo(e) ? t[e] : e;
1774
1774
  }
1775
1775
  function jo(t, { find: e, where: n }) {
1776
1776
  return ln(t, n).map((i) => zn(i, e));
@@ -1779,7 +1779,7 @@ function Co(t, e, n) {
1779
1779
  return yo(t, zn(n, e));
1780
1780
  }
1781
1781
  const Po = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
1782
- function Ne(t) {
1782
+ function Ke(t) {
1783
1783
  return typeof t == "string" && Po.test(t);
1784
1784
  }
1785
1785
  const W = [];
@@ -1844,13 +1844,13 @@ function Fo() {
1844
1844
  }
1845
1845
  const No = Fo();
1846
1846
  let Ko = 0;
1847
- function rt(t) {
1847
+ function it(t) {
1848
1848
  return $t(`_${t}`, Ko++);
1849
1849
  }
1850
1850
  function $t(t, e) {
1851
1851
  return `?${t}-${e}`;
1852
1852
  }
1853
- class Ke extends Error {
1853
+ class qe extends Error {
1854
1854
  constructor(e) {
1855
1855
  super(e), this.name = "AttrNotFoundError";
1856
1856
  }
@@ -1858,7 +1858,7 @@ class Ke extends Error {
1858
1858
  function qo(t, e) {
1859
1859
  const n = Ii(t, e);
1860
1860
  if (!n)
1861
- throw new Ke(`Could not find id attr for ${e}`);
1861
+ throw new qe(`Could not find id attr for ${e}`);
1862
1862
  return n;
1863
1863
  }
1864
1864
  function Cr(t, e, n, r) {
@@ -1876,21 +1876,21 @@ function zo(t, e, n) {
1876
1876
  return t.map((r) => r === e ? n : r);
1877
1877
  }
1878
1878
  function Ri(t, e, n, r, i) {
1879
- const s = we(e, n, i), o = Pi(e, n, i), a = s || o;
1879
+ const s = Te(e, n, i), o = Pi(e, n, i), a = s || o;
1880
1880
  if (!a)
1881
- throw new Ke(`Could not find attr for ${[n, i]}`);
1881
+ throw new qe(`Could not find attr for ${[n, i]}`);
1882
1882
  if (a["value-type"] !== "ref")
1883
1883
  throw new Error(`Attr ${a.id} is not a ref`);
1884
1884
  const [u, d] = a["forward-identity"], [c, f] = a["reverse-identity"], l = r + 1, p = s ? [
1885
1885
  t(d, r),
1886
1886
  a.id,
1887
1887
  t(f, l),
1888
- rt("time")
1888
+ it("time")
1889
1889
  ] : [
1890
1890
  t(d, l),
1891
1891
  a.id,
1892
1892
  t(f, r),
1893
- rt("time")
1893
+ it("time")
1894
1894
  ];
1895
1895
  return [s ? f : d, l, p, a, !!s];
1896
1896
  }
@@ -1965,26 +1965,26 @@ function Vo(t, e) {
1965
1965
  return e;
1966
1966
  }
1967
1967
  function Bo(t, e, n, r, i, s) {
1968
- const o = we(e, n, i), a = Pi(e, n, i), u = o || a;
1968
+ const o = Te(e, n, i), a = Pi(e, n, i), u = o || a;
1969
1969
  if (!u)
1970
- throw new Ke(`No attr for etype = ${n} label = ${i}`);
1970
+ throw new qe(`No attr for etype = ${n} label = ${i}`);
1971
1971
  if (s != null && s.hasOwnProperty("$isNull")) {
1972
- const d = we(e, n, "id");
1972
+ const d = Te(e, n, "id");
1973
1973
  if (!d)
1974
- throw new Ke(`No attr for etype = ${n} label = id`);
1974
+ throw new qe(`No attr for etype = ${n} label = id`);
1975
1975
  return [
1976
1976
  t(n, r),
1977
1977
  d.id,
1978
1978
  { $isNull: { attrId: u.id, isNull: s.$isNull, reverse: !o } },
1979
- rt("time")
1979
+ it("time")
1980
1980
  ];
1981
1981
  }
1982
1982
  return o ? [
1983
1983
  t(n, r),
1984
1984
  u.id,
1985
1985
  Vo(u, s),
1986
- rt("time")
1987
- ] : [s, u.id, t(n, r), rt("time")];
1986
+ it("time")
1987
+ ] : [s, u.id, t(n, r), it("time")];
1988
1988
  }
1989
1989
  function Go(t, e, n, r, i) {
1990
1990
  const [s, o, a] = i.reduce((u, d) => {
@@ -2076,17 +2076,17 @@ function na(t, e, { etype: n, level: r, form: i }, s) {
2076
2076
  var p, y, b;
2077
2077
  const _ = !!(e.cardinalityInference && (!((b = (y = (p = e.linkIndex) === null || p === void 0 ? void 0 : p[n]) === null || y === void 0 ? void 0 : y[l]) === null || b === void 0) && b.isSingular));
2078
2078
  try {
2079
- const [T, w, m] = ta(t, e, n, r, l, u), E = Di(e, {
2080
- etype: T,
2081
- level: w,
2079
+ const [w, g, m] = ta(t, e, n, r, l, u), E = Di(e, {
2080
+ etype: w,
2081
+ level: g,
2082
2082
  form: i[l],
2083
2083
  join: m
2084
2084
  }), S = _ ? E[0] : E;
2085
2085
  return { [l]: S };
2086
- } catch (T) {
2087
- if (T instanceof Ke)
2086
+ } catch (w) {
2087
+ if (w instanceof qe)
2088
2088
  return { [l]: _ ? void 0 : [] };
2089
- throw T;
2089
+ throw w;
2090
2090
  }
2091
2091
  }).reduce(function(l, p) {
2092
2092
  return Object.assign(Object.assign({}, l), p);
@@ -2096,11 +2096,11 @@ function na(t, e, { etype: n, level: r, form: i }, s) {
2096
2096
  function ra(t, e, n) {
2097
2097
  return n === "string" ? No(t, e) : t > e ? 1 : -1;
2098
2098
  }
2099
- function Xe(t, e, n, r, i) {
2099
+ function et(t, e, n, r, i) {
2100
2100
  return e === r || e == null && r == null ? Uo(t, n) : r == null ? 1 : e == null ? -1 : ra(e, r, i);
2101
2101
  }
2102
2102
  function It([t, e], [n, r], i) {
2103
- return Xe(t, e, n, r, i);
2103
+ return et(t, e, n, r, i);
2104
2104
  }
2105
2105
  function pn(t) {
2106
2106
  return t == null ? t : new Date(t).getTime();
@@ -2119,7 +2119,7 @@ function sa(t, e) {
2119
2119
  }
2120
2120
  function oa(t, e, n) {
2121
2121
  const r = Object.keys(n)[0];
2122
- return we(t, e, r);
2122
+ return Te(t, e, r);
2123
2123
  }
2124
2124
  function aa(t, e, n, r) {
2125
2125
  if (n)
@@ -2133,11 +2133,11 @@ function ua(t, e, n) {
2133
2133
  return _o(t, e);
2134
2134
  const s = /* @__PURE__ */ new Map();
2135
2135
  for (const o of n.fields) {
2136
- const a = we(t, e, o), u = (r = a == null ? void 0 : a["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
2136
+ const a = Te(t, e, o), u = (r = a == null ? void 0 : a["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
2137
2137
  u && qn(a) && s.set(u, a);
2138
2138
  }
2139
2139
  if (!s.has("id")) {
2140
- const o = we(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
2140
+ const o = Te(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
2141
2141
  a && s.set(a, o);
2142
2142
  }
2143
2143
  return s;
@@ -2149,16 +2149,16 @@ function ca(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2149
2149
  const f = n == null ? void 0 : n["start-cursor"], l = aa(t, e, f, a);
2150
2150
  if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
2151
2151
  const b = l["checked-data-type"] === "date", _ = l.id;
2152
- c = c.map(([T]) => {
2153
- var w, m, E, S, I;
2154
- let x = (I = (S = (E = (m = (w = t.eav.get(T)) === null || w === void 0 ? void 0 : w.get(_)) === null || m === void 0 ? void 0 : m.values()) === null || E === void 0 ? void 0 : E.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
2155
- return b && (x = pn(x)), [T, x];
2152
+ c = c.map(([w]) => {
2153
+ var g, m, E, S, I;
2154
+ let R = (I = (S = (E = (m = (g = t.eav.get(w)) === null || g === void 0 ? void 0 : g.get(_)) === null || m === void 0 ? void 0 : m.values()) === null || E === void 0 ? void 0 : E.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
2155
+ return b && (R = pn(R)), [w, R];
2156
2156
  });
2157
2157
  }
2158
- c.sort(d === "asc" ? function(_, T) {
2159
- return It(_, T, l == null ? void 0 : l["checked-data-type"]);
2160
- } : function(_, T) {
2161
- return It(T, _, l == null ? void 0 : l["checked-data-type"]);
2158
+ c.sort(d === "asc" ? function(_, w) {
2159
+ return It(_, w, l == null ? void 0 : l["checked-data-type"]);
2160
+ } : function(_, w) {
2161
+ return It(w, _, l == null ? void 0 : l["checked-data-type"]);
2162
2162
  });
2163
2163
  let p = {};
2164
2164
  const y = ua(t, e, r);
@@ -2166,8 +2166,8 @@ function ca(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2166
2166
  const [_] = b;
2167
2167
  if (p[_] || !u && f && l && ia(f, l, d, b))
2168
2168
  continue;
2169
- const T = bo(t, y, _);
2170
- T && (p[_] = T);
2169
+ const w = bo(t, y, _);
2170
+ w && (p[_] = w);
2171
2171
  }
2172
2172
  return p;
2173
2173
  }
@@ -2202,7 +2202,7 @@ function la(t, e) {
2202
2202
  try {
2203
2203
  return fa(t, e);
2204
2204
  } catch (n) {
2205
- if (n instanceof Ke)
2205
+ if (n instanceof qe)
2206
2206
  return {};
2207
2207
  throw n;
2208
2208
  }
@@ -2267,7 +2267,7 @@ function yn(t, e, n) {
2267
2267
  }
2268
2268
  });
2269
2269
  }
2270
- function Lc(t, e) {
2270
+ function Fc(t, e) {
2271
2271
  return `lookup__${t}__${JSON.stringify(e)}`;
2272
2272
  }
2273
2273
  function Mt(t) {
@@ -2296,7 +2296,7 @@ function Vn() {
2296
2296
  }
2297
2297
  });
2298
2298
  }
2299
- const Fc = Vn();
2299
+ const Nc = Vn();
2300
2300
  function _a(t) {
2301
2301
  return t.__ops;
2302
2302
  }
@@ -2334,7 +2334,7 @@ function ke(t, e, n) {
2334
2334
  return o === e && a === n;
2335
2335
  });
2336
2336
  }
2337
- function wa(t) {
2337
+ function Ta(t) {
2338
2338
  if (Array.isArray(t))
2339
2339
  return t;
2340
2340
  const e = Object.entries(t);
@@ -2353,7 +2353,7 @@ function _n(t) {
2353
2353
  throw new Error(`${t} is not a valid lookup attribute.`);
2354
2354
  return e;
2355
2355
  }
2356
- function Ta(t, e, n) {
2356
+ function wa(t, e, n) {
2357
2357
  if (!bn(t, e, n))
2358
2358
  return B(t, e, n);
2359
2359
  const r = _n(n), i = B(t, e, r) || ke(t, e, r);
@@ -2362,13 +2362,13 @@ function Ta(t, e, n) {
2362
2362
  return i;
2363
2363
  }
2364
2364
  function gn(t) {
2365
- return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? Li(t) : wa(t);
2365
+ return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? Li(t) : Ta(t);
2366
2366
  }
2367
2367
  function ee(t, e, n) {
2368
2368
  const r = gn(n);
2369
2369
  if (r === null)
2370
2370
  return n;
2371
- const [i, s] = r, o = Ta(t, e, i);
2371
+ const [i, s] = r, o = wa(t, e, i);
2372
2372
  if (!o || !o["unique?"])
2373
2373
  throw new Error(`${i} is not a unique attribute.`);
2374
2374
  return [o.id, s];
@@ -2539,7 +2539,7 @@ function Ma(t, e, n) {
2539
2539
  "checked-data-type": u
2540
2540
  };
2541
2541
  }
2542
- function wt(t, e, n, r) {
2542
+ function Tt(t, e, n, r) {
2543
2543
  const i = t ? Ma(t, e, n) : null, s = K(), a = [K(), e, n];
2544
2544
  return Object.assign(Object.assign({ id: s, "forward-identity": a, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
2545
2545
  }
@@ -2572,7 +2572,7 @@ const $a = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
2572
2572
  "merge",
2573
2573
  "delete",
2574
2574
  "ruleParams"
2575
- ]), wn = { "unique?": !0, "index?": !0 }, Fa = Object.assign(Object.assign({}, wn), { cardinality: "one" });
2575
+ ]), Tn = { "unique?": !0, "index?": !0 }, Fa = Object.assign(Object.assign({}, Tn), { cardinality: "one" });
2576
2576
  function Na(t) {
2577
2577
  const e = [], [n, r, i, s] = t;
2578
2578
  if (!La.has(n))
@@ -2610,32 +2610,32 @@ function Ka({ attrs: t, schema: e }, n) {
2610
2610
  const b = p[0];
2611
2611
  if (y) {
2612
2612
  c(l, y);
2613
- const _ = B(o, l, y), T = ke(o, l, y);
2614
- d(_), d(T);
2615
- const w = ((r = _ == null ? void 0 : _["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = T == null ? void 0 : T["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
2616
- if (bn(o, w, b))
2617
- c(w, _n(b));
2613
+ const _ = B(o, l, y), w = ke(o, l, y);
2614
+ d(_), d(w);
2615
+ const g = ((r = _ == null ? void 0 : _["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = w == null ? void 0 : w["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
2616
+ if (bn(o, g, b))
2617
+ c(g, _n(b));
2618
2618
  else {
2619
- const m = B(o, w, b);
2620
- m || u(wt(e, w, b, wn)), d(m);
2619
+ const m = B(o, g, b);
2620
+ m || u(Tt(e, g, b, Tn)), d(m);
2621
2621
  }
2622
2622
  } else if (bn(o, l, b))
2623
2623
  c(l, _n(b));
2624
2624
  else {
2625
2625
  const _ = B(o, l, b);
2626
- _ || u(wt(e, l, b, wn)), d(_);
2626
+ _ || u(Tt(e, l, b, Tn)), d(_);
2627
2627
  }
2628
2628
  }
2629
2629
  for (const f of n) {
2630
2630
  const [l, p, y, b] = f;
2631
2631
  if ($a.has(l)) {
2632
2632
  const _ = B(o, p, "id");
2633
- d(_), _ || u(wt(e, p, "id", { "unique?": !0 }));
2634
- for (const T of Object.keys(b)) {
2635
- const w = B(o, p, T);
2636
- if (d(w), Ua.has(l) && (w || u(wt(e, p, T, T === "id" ? { "unique?": !0 } : null))), Da.has(l)) {
2637
- const m = ke(o, p, T);
2638
- !w && !m && u(Rr(e, p, T)), d(m);
2633
+ d(_), _ || u(Tt(e, p, "id", { "unique?": !0 }));
2634
+ for (const w of Object.keys(b)) {
2635
+ const g = B(o, p, w);
2636
+ if (d(g), Ua.has(l) && (g || u(Tt(e, p, w, w === "id" ? { "unique?": !0 } : null))), Da.has(l)) {
2637
+ const m = ke(o, p, w);
2638
+ !g && !m && u(Rr(e, p, w)), d(m);
2639
2639
  }
2640
2640
  }
2641
2641
  }
@@ -2676,12 +2676,12 @@ var de = function(t, e, n, r) {
2676
2676
  function xr(t, e) {
2677
2677
  typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
2678
2678
  }
2679
- const it = "__meta";
2679
+ const st = "__meta";
2680
2680
  class Wa {
2681
2681
  constructor(e, n) {
2682
2682
  }
2683
2683
  }
2684
- class Tn {
2684
+ class wn {
2685
2685
  constructor(e) {
2686
2686
  var n, r;
2687
2687
  this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
@@ -2697,7 +2697,7 @@ class Tn {
2697
2697
  var e, n, r;
2698
2698
  this._meta.loadingPromise && (yield this._meta.loadingPromise);
2699
2699
  try {
2700
- const i = this._persister.getItem(it);
2700
+ const i = this._persister.getItem(st);
2701
2701
  this._meta.loadingPromise = i;
2702
2702
  const s = yield i;
2703
2703
  this._meta.isLoading = !1, this._meta.error = null, this._meta.loadingPromise = null, this._meta.attempts = 0;
@@ -2790,7 +2790,7 @@ class Tn {
2790
2790
  const y = this._persister.removeItem(p);
2791
2791
  i.push(y.then(() => 1)), this._loadedKeys.delete(p), this._pendingSaveKeys.delete(p);
2792
2792
  }
2793
- const d = [], c = [[it, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
2793
+ const d = [], c = [[st, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
2794
2794
  o.objects = f;
2795
2795
  for (const p of u)
2796
2796
  if (this._loadedKeys.has(p)) {
@@ -2822,7 +2822,7 @@ class Tn {
2822
2822
  if (!this._gcOpts)
2823
2823
  return;
2824
2824
  const e = new Set(yield this._persister.getAllKeys());
2825
- e.delete(it);
2825
+ e.delete(st);
2826
2826
  const n = new Set(Object.keys(this.currentValue));
2827
2827
  for (const l of Object.keys(this._loadingKeys))
2828
2828
  n.add(l);
@@ -2985,17 +2985,17 @@ function Qa(t, e, n) {
2985
2985
  for (const [y, b] of Object.entries(r)) {
2986
2986
  const _ = typeof b == "string" ? JSON.parse(b) : b;
2987
2987
  if (_.lastAccessed) {
2988
- const w = {
2988
+ const g = {
2989
2989
  createdAt: _.lastAccessed,
2990
2990
  updatedAt: _.lastAccessed,
2991
2991
  size: (c = (d = (u = (a = _.result) === null || a === void 0 ? void 0 : a.store) === null || u === void 0 ? void 0 : u.triples) === null || d === void 0 ? void 0 : d.length) !== null && c !== void 0 ? c : 0
2992
2992
  };
2993
- f[y] = w;
2993
+ f[y] = g;
2994
2994
  }
2995
- const T = n.put(_, y);
2996
- i.add(T);
2995
+ const w = n.put(_, y);
2996
+ i.add(w);
2997
2997
  }
2998
- const l = { objects: f }, p = n.put(l, it);
2998
+ const l = { objects: f }, p = n.put(l, st);
2999
2999
  i.add(p);
3000
3000
  for (const y of i)
3001
3001
  y.onsuccess = () => {
@@ -3028,8 +3028,8 @@ function Ha(t, e) {
3028
3028
  y.onsuccess = () => {
3029
3029
  const _ = y.result;
3030
3030
  if (_) {
3031
- const T = _.key, w = _.value;
3032
- b.push([T, w]), _.continue();
3031
+ const w = _.key, g = _.value;
3032
+ b.push([w, g]), _.continue();
3033
3033
  } else
3034
3034
  c(b);
3035
3035
  }, y.onerror = (_) => {
@@ -3055,7 +3055,7 @@ function Ha(t, e) {
3055
3055
  break;
3056
3056
  }
3057
3057
  }
3058
- const d = $r(it, u, s);
3058
+ const d = $r(st, u, s);
3059
3059
  a.push(d), yield Promise.all(a), yield new Promise((c, f) => {
3060
3060
  i.oncomplete = (l) => c(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
3061
3061
  });
@@ -3209,11 +3209,11 @@ class qi {
3209
3209
  };
3210
3210
  }
3211
3211
  }
3212
- class qe extends Error {
3212
+ class We extends Error {
3213
3213
  constructor(e, n) {
3214
3214
  super(e), this.hint = n;
3215
3215
  const r = new.target.prototype;
3216
- Object.setPrototypeOf && Object.setPrototypeOf(this, r), Error.captureStackTrace && Error.captureStackTrace(this, qe), this.name = "InstantError";
3216
+ Object.setPrototypeOf && Object.setPrototypeOf(this, r), Error.captureStackTrace && Error.captureStackTrace(this, We), this.name = "InstantError";
3217
3217
  }
3218
3218
  get [Symbol.toStringTag]() {
3219
3219
  return "InstantError";
@@ -3246,7 +3246,7 @@ var Ja = function(t, e, n, r) {
3246
3246
  d((r = r.apply(t, e || [])).next());
3247
3247
  });
3248
3248
  };
3249
- class Dt extends qe {
3249
+ class Dt extends We {
3250
3250
  constructor(e) {
3251
3251
  var n;
3252
3252
  const r = ((n = e.body) === null || n === void 0 ? void 0 : n.message) || `API Error (${e.status})`;
@@ -3264,7 +3264,7 @@ function ue(t, e) {
3264
3264
  return n.status === 200 ? Promise.resolve(r) : Promise.reject(new Dt({ status: n.status, body: r }));
3265
3265
  });
3266
3266
  }
3267
- var Ve = function(t, e, n, r) {
3267
+ var Be = function(t, e, n, r) {
3268
3268
  function i(s) {
3269
3269
  return s instanceof n ? s : new n(function(o) {
3270
3270
  o(s);
@@ -3299,7 +3299,7 @@ function Za({ apiURI: t, appId: e, email: n }) {
3299
3299
  });
3300
3300
  }
3301
3301
  function Xa(t) {
3302
- return Ve(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
3302
+ return Be(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
3303
3303
  return yield ue(`${e}/runtime/auth/verify_magic_code`, {
3304
3304
  method: "POST",
3305
3305
  headers: { "content-type": "application/json" },
@@ -3312,7 +3312,7 @@ function Xa(t) {
3312
3312
  });
3313
3313
  }
3314
3314
  function eu(t) {
3315
- return Ve(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3315
+ return Be(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3316
3316
  return yield ue(`${e}/runtime/auth/verify_refresh_token`, {
3317
3317
  method: "POST",
3318
3318
  headers: { "content-type": "application/json" },
@@ -3324,7 +3324,7 @@ function eu(t) {
3324
3324
  });
3325
3325
  }
3326
3326
  function tu(t) {
3327
- return Ve(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
3327
+ return Be(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
3328
3328
  return yield ue(`${e}/runtime/auth/sign_in_guest`, {
3329
3329
  method: "POST",
3330
3330
  headers: { "content-type": "application/json" },
@@ -3335,7 +3335,7 @@ function tu(t) {
3335
3335
  });
3336
3336
  }
3337
3337
  function Ur(t) {
3338
- return Ve(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
3338
+ return Be(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
3339
3339
  return yield ue(`${e}/runtime/oauth/token`, {
3340
3340
  method: "POST",
3341
3341
  headers: { "content-type": "application/json" },
@@ -3349,7 +3349,7 @@ function Ur(t) {
3349
3349
  });
3350
3350
  }
3351
3351
  function nu(t) {
3352
- return Ve(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
3352
+ return Be(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
3353
3353
  return yield ue(`${e}/runtime/oauth/id_token`, {
3354
3354
  method: "POST",
3355
3355
  headers: { "content-type": "application/json" },
@@ -3364,7 +3364,7 @@ function nu(t) {
3364
3364
  });
3365
3365
  }
3366
3366
  function ru(t) {
3367
- return Ve(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3367
+ return Be(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3368
3368
  return yield ue(`${e}/runtime/signout`, {
3369
3369
  method: "POST",
3370
3370
  headers: {
@@ -3377,7 +3377,7 @@ function ru(t) {
3377
3377
  });
3378
3378
  });
3379
3379
  }
3380
- var ft = function(t, e, n, r) {
3380
+ var lt = function(t, e, n, r) {
3381
3381
  function i(s) {
3382
3382
  return s instanceof n ? s : new n(function(o) {
3383
3383
  o(s);
@@ -3405,7 +3405,7 @@ var ft = function(t, e, n, r) {
3405
3405
  });
3406
3406
  };
3407
3407
  function iu(t) {
3408
- return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: a }) {
3408
+ return lt(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: a }) {
3409
3409
  const u = {
3410
3410
  app_id: n,
3411
3411
  path: r,
@@ -3420,7 +3420,7 @@ function iu(t) {
3420
3420
  });
3421
3421
  }
3422
3422
  function su(t) {
3423
- return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
3423
+ return lt(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
3424
3424
  const { data: s } = yield ue(`${e}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
3425
3425
  method: "DELETE",
3426
3426
  headers: {
@@ -3432,7 +3432,7 @@ function su(t) {
3432
3432
  });
3433
3433
  }
3434
3434
  function ou(t) {
3435
- return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
3435
+ return lt(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
3436
3436
  const { data: o } = yield ue(`${e}/storage/signed-upload-url`, {
3437
3437
  method: "POST",
3438
3438
  headers: {
@@ -3448,7 +3448,7 @@ function ou(t) {
3448
3448
  });
3449
3449
  }
3450
3450
  function au(t, e) {
3451
- return ft(this, void 0, void 0, function* () {
3451
+ return lt(this, void 0, void 0, function* () {
3452
3452
  return (yield fetch(t, {
3453
3453
  method: "PUT",
3454
3454
  body: e,
@@ -3459,7 +3459,7 @@ function au(t, e) {
3459
3459
  });
3460
3460
  }
3461
3461
  function uu(t) {
3462
- return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
3462
+ return lt(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
3463
3463
  const { data: s } = yield ue(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
3464
3464
  method: "GET",
3465
3465
  headers: {
@@ -3546,7 +3546,7 @@ function Kr(t) {
3546
3546
  }, e;
3547
3547
  }, {});
3548
3548
  }
3549
- const Gn = "v0.22.60";
3549
+ const Gn = "v0.22.61-experimental.delay-looking-at-store.19555739599.1";
3550
3550
  function fu(t, e) {
3551
3551
  return {
3552
3552
  info: t ? (...n) => console.info(...n, e()) : () => {
@@ -3614,7 +3614,7 @@ class Lt {
3614
3614
  return new Lt(this.entities, this.links, {});
3615
3615
  }
3616
3616
  }
3617
- class R extends Error {
3617
+ class x extends Error {
3618
3618
  constructor(e, n) {
3619
3619
  const r = n ? `At path '${n}': ${e}` : e;
3620
3620
  super(r), this.name = "QueryValidationError";
@@ -3649,13 +3649,13 @@ const qr = [
3649
3649
  }, hu = (t, e, n, r, i, s, o) => {
3650
3650
  const a = s.valueType === "json", u = (d, c, f) => {
3651
3651
  if (!Bi(f, c, a))
3652
- throw new R(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
3652
+ throw new x(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
3653
3653
  };
3654
3654
  switch (t) {
3655
3655
  case "in":
3656
3656
  case "$in":
3657
3657
  if (!Array.isArray(e))
3658
- throw new R(`Operator '${t}' for attribute '${r}' in entity '${i}' must be an array, but received: ${typeof e}`, o);
3658
+ throw new x(`Operator '${t}' for attribute '${r}' in entity '${i}' must be an array, but received: ${typeof e}`, o);
3659
3659
  for (const d of e)
3660
3660
  u(t, n, d);
3661
3661
  break;
@@ -3670,15 +3670,15 @@ const qr = [
3670
3670
  case "$like":
3671
3671
  case "$ilike":
3672
3672
  if (u(t, "string", e), t === "$ilike" && !s.isIndexed)
3673
- throw new R(`Operator '${t}' can only be used with indexed attributes, but '${r}' in entity '${i}' is not indexed`, o);
3673
+ throw new x(`Operator '${t}' can only be used with indexed attributes, but '${r}' in entity '${i}' is not indexed`, o);
3674
3674
  break;
3675
3675
  case "$isNull":
3676
3676
  u(t, "boolean", e);
3677
3677
  break;
3678
3678
  default:
3679
- throw new R(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
3679
+ throw new x(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
3680
3680
  }
3681
- }, Le = (t, e, n, r, i) => {
3681
+ }, Fe = (t, e, n, r, i) => {
3682
3682
  const s = lu(n), o = n.valueType === "json";
3683
3683
  if (typeof t == "object" && t !== null && !Array.isArray(t)) {
3684
3684
  if (o)
@@ -3687,44 +3687,44 @@ const qr = [
3687
3687
  for (const [d, c] of Object.entries(u))
3688
3688
  hu(d, c, s, e, r, n, `${i}.${d}`);
3689
3689
  } else if (!Bi(t, s, o))
3690
- throw new R(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
3690
+ throw new x(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
3691
3691
  }, pu = (t, e, n, r, i) => {
3692
3692
  const s = t.split(".");
3693
3693
  if (s.length < 2)
3694
- throw new R(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
3694
+ throw new x(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
3695
3695
  let o = n;
3696
3696
  for (let c = 0; c < s.length - 1; c++) {
3697
3697
  const f = s[c], l = r.entities[o];
3698
3698
  if (!l)
3699
- throw new R(`Entity '${o}' does not exist in schema while traversing dot notation path '${t}'.`, i);
3699
+ throw new x(`Entity '${o}' does not exist in schema while traversing dot notation path '${t}'.`, i);
3700
3700
  const p = l.links[f];
3701
3701
  if (!p) {
3702
3702
  const y = Object.keys(l.links);
3703
- throw new R(`Link '${f}' does not exist on entity '${o}' in dot notation path '${t}'. Available links: ${y.length > 0 ? y.join(", ") : "none"}`, i);
3703
+ throw new x(`Link '${f}' does not exist on entity '${o}' in dot notation path '${t}'. Available links: ${y.length > 0 ? y.join(", ") : "none"}`, i);
3704
3704
  }
3705
3705
  o = p.entityName;
3706
3706
  }
3707
3707
  const a = s[s.length - 1], u = r.entities[o];
3708
3708
  if (!u)
3709
- throw new R(`Target entity '${o}' does not exist in schema for dot notation path '${t}'.`, i);
3709
+ throw new x(`Target entity '${o}' does not exist in schema for dot notation path '${t}'.`, i);
3710
3710
  if (a === "id") {
3711
- if (typeof e == "string" && !Ne(e))
3712
- throw new R(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, i);
3713
- Le(e, t, new H("string", !1, !0), n, i);
3711
+ if (typeof e == "string" && !Ke(e))
3712
+ throw new x(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, i);
3713
+ Fe(e, t, new H("string", !1, !0), n, i);
3714
3714
  return;
3715
3715
  }
3716
3716
  const d = u.attrs[a];
3717
3717
  if (Object.keys(u.links).includes(a)) {
3718
- if (typeof e == "string" && !Ne(e))
3719
- throw new R(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
3720
- Le(e, t, new H("string", !1, !0), n, i);
3718
+ if (typeof e == "string" && !Ke(e))
3719
+ throw new x(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
3720
+ Fe(e, t, new H("string", !1, !0), n, i);
3721
3721
  return;
3722
3722
  }
3723
3723
  if (!d) {
3724
3724
  const c = Object.keys(u.attrs);
3725
- throw new R(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
3725
+ throw new x(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
3726
3726
  }
3727
- Le(e, t, d, n, i);
3727
+ Fe(e, t, d, n, i);
3728
3728
  }, Gi = (t, e, n, r) => {
3729
3729
  for (const [i, s] of Object.entries(t)) {
3730
3730
  if (i === "or" || i === "and") {
@@ -3734,7 +3734,7 @@ const qr = [
3734
3734
  continue;
3735
3735
  }
3736
3736
  if (i === "id") {
3737
- Le(s, "id", new H("string", !1, !0), e, `${r}.id`);
3737
+ Fe(s, "id", new H("string", !1, !0), e, `${r}.id`);
3738
3738
  continue;
3739
3739
  }
3740
3740
  if (i.includes(".")) {
@@ -3747,21 +3747,21 @@ const qr = [
3747
3747
  const a = o.attrs[i], u = o.links[i];
3748
3748
  if (!a && !u) {
3749
3749
  const d = Object.keys(o.attrs), c = Object.keys(o.links);
3750
- throw new R(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${d.length > 0 ? d.join(", ") : "none"}. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${i}`);
3750
+ throw new x(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${d.length > 0 ? d.join(", ") : "none"}. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${i}`);
3751
3751
  }
3752
3752
  if (a)
3753
- Le(s, i, a, e, `${r}.${i}`);
3753
+ Fe(s, i, a, e, `${r}.${i}`);
3754
3754
  else if (u) {
3755
- if (typeof s == "string" && !Ne(s))
3756
- throw new R(`Invalid value for link '${i}' in entity '${e}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
3755
+ if (typeof s == "string" && !Ke(s))
3756
+ throw new x(`Invalid value for link '${i}' in entity '${e}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
3757
3757
  const d = new H("string", !1, !0);
3758
- Le(s, i, d, e, `${r}.${i}`);
3758
+ Fe(s, i, d, e, `${r}.${i}`);
3759
3759
  }
3760
3760
  }
3761
3761
  }, yu = (t, e, n, r, i = 0) => {
3762
3762
  for (const o of Object.keys(t))
3763
3763
  if (!qr.includes(o))
3764
- throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${qr.join(", ")}. Found: ${o}`, r);
3764
+ throw new x(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${qr.join(", ")}. Found: ${o}`, r);
3765
3765
  const s = [
3766
3766
  // 'limit', // only supported client side
3767
3767
  "offset",
@@ -3772,21 +3772,21 @@ const qr = [
3772
3772
  ];
3773
3773
  for (const o of s)
3774
3774
  if (t[o] !== void 0 && i > 0)
3775
- throw new R(`'${o}' can only be used on top-level namespaces. It cannot be used in nested queries.`, r);
3775
+ throw new x(`'${o}' can only be used on top-level namespaces. It cannot be used in nested queries.`, r);
3776
3776
  if (t.where && n) {
3777
3777
  if (typeof t.where != "object" || t.where === null)
3778
- throw new R(`'where' clause must be an object in entity '${e}', but received: ${typeof t.where}`, r ? `${r}.where` : void 0);
3778
+ throw new x(`'where' clause must be an object in entity '${e}', but received: ${typeof t.where}`, r ? `${r}.where` : void 0);
3779
3779
  Gi(t.where, e, n, r ? `${r}.where` : "where");
3780
3780
  }
3781
3781
  }, Qi = (t, e, n, r, i = 0) => {
3782
3782
  var s;
3783
3783
  if (!t || typeof t != "object")
3784
- throw new R(`Query part for entity '${e}' must be an object, but received: ${typeof t}`, r);
3784
+ throw new x(`Query part for entity '${e}' must be an object, but received: ${typeof t}`, r);
3785
3785
  for (const o of Object.keys(t))
3786
3786
  if (o !== "$") {
3787
3787
  if (n && !(o in n.entities[e].links)) {
3788
3788
  const u = Object.keys(n.entities[e].links);
3789
- throw new R(`Link '${o}' does not exist on entity '${e}'. Available links: ${u.length > 0 ? u.join(", ") : "none"}`, `${r}.${o}`);
3789
+ throw new x(`Link '${o}' does not exist on entity '${e}'. Available links: ${u.length > 0 ? u.join(", ") : "none"}`, `${r}.${o}`);
3790
3790
  }
3791
3791
  const a = t[o];
3792
3792
  if (typeof a == "object" && a !== null) {
@@ -3796,29 +3796,29 @@ const qr = [
3796
3796
  } else {
3797
3797
  const a = t[o];
3798
3798
  if (typeof a != "object" || a === null)
3799
- throw new R(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
3799
+ throw new x(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
3800
3800
  yu(a, e, n, `${r}.$`, i);
3801
3801
  }
3802
3802
  }, Wr = (t, e) => {
3803
3803
  if (typeof t != "object" || t === null)
3804
- throw new R(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
3804
+ throw new x(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
3805
3805
  if (Array.isArray(t))
3806
- throw new R(`Query must be an object, but received: ${typeof t}`);
3806
+ throw new x(`Query must be an object, but received: ${typeof t}`);
3807
3807
  const n = t;
3808
3808
  for (const r of Object.keys(n)) {
3809
3809
  if (Array.isArray(t[r]))
3810
- throw new R(`Query keys must be strings, but found key of type: ${typeof r}`, r);
3810
+ throw new x(`Query keys must be strings, but found key of type: ${typeof r}`, r);
3811
3811
  if (typeof r != "string")
3812
- throw new R(`Query keys must be strings, but found key of type: ${typeof r}`, r);
3812
+ throw new x(`Query keys must be strings, but found key of type: ${typeof r}`, r);
3813
3813
  if (r !== "$$ruleParams") {
3814
3814
  if (e && !e.entities[r]) {
3815
3815
  const i = Object.keys(e.entities);
3816
- throw new R(`Entity '${r}' does not exist in schema. Available entities: ${i.length > 0 ? i.join(", ") : "none"}`, r);
3816
+ throw new x(`Entity '${r}' does not exist in schema. Available entities: ${i.length > 0 ? i.join(", ") : "none"}`, r);
3817
3817
  }
3818
3818
  Qi(n[r], r, e, r, 0);
3819
3819
  }
3820
3820
  }
3821
- }, zr = (t) => typeof t != "string" ? !1 : Mt(t) ? !0 : Ne(t);
3821
+ }, zr = (t) => typeof t != "string" ? !1 : Mt(t) ? !0 : Ke(t);
3822
3822
  class ie extends Error {
3823
3823
  constructor(e) {
3824
3824
  super(e), this.name = "TransactionValidationError";
@@ -3875,17 +3875,17 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3875
3875
  unlink: Br,
3876
3876
  delete: () => {
3877
3877
  }
3878
- }, wu = (t, e) => {
3878
+ }, Tu = (t, e) => {
3879
3879
  if (!e)
3880
3880
  return;
3881
3881
  const [n, r, i, s] = t;
3882
- if (!Array.isArray(i) && !Ne(i))
3882
+ if (!Array.isArray(i) && !Ke(i))
3883
3883
  throw new ie(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
3884
3884
  if (typeof r != "string")
3885
3885
  throw new ie(`Entity name must be a string, but received: ${typeof r}`);
3886
3886
  const o = gu[n];
3887
3887
  o && s !== void 0 && o(r, s, e);
3888
- }, Tu = (t, e) => {
3888
+ }, wu = (t, e) => {
3889
3889
  const n = Array.isArray(t) ? t : [t];
3890
3890
  for (const r of n) {
3891
3891
  if (!r || typeof r != "object")
@@ -3895,7 +3895,7 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3895
3895
  for (const i of r.__ops) {
3896
3896
  if (!Array.isArray(i))
3897
3897
  throw new ie(`Transaction operation must be an array, but received: ${typeof i}`);
3898
- wu(i, e);
3898
+ Tu(i, e);
3899
3899
  }
3900
3900
  }
3901
3901
  };
@@ -4090,10 +4090,10 @@ function Zt(t, e) {
4090
4090
  }
4091
4091
  function Yr(t, e, n) {
4092
4092
  var r;
4093
- const i = (r = we(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
4093
+ const i = (r = Te(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
4094
4094
  if (!i)
4095
4095
  return -1;
4096
- const s = ze(e.eav, [n, i, n]);
4096
+ const s = Ve(e.eav, [n, i, n]);
4097
4097
  return s ? s[3] : -1;
4098
4098
  }
4099
4099
  function Jr(t, e) {
@@ -4128,33 +4128,40 @@ function Eu(t, e) {
4128
4128
  }
4129
4129
  return o;
4130
4130
  }
4131
- function Tt(t, e) {
4131
+ function wt(t, e) {
4132
4132
  return { [t.table]: e.map((n) => n.entity) };
4133
4133
  }
4134
4134
  function Au(t, e) {
4135
- const n = t.orderFieldType;
4135
+ var n;
4136
+ if (t.orderFieldType)
4137
+ return t.orderFieldType;
4138
+ const r = t.orderField === "serverCreatedAt" ? "number" : (n = Te(e([]), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
4139
+ return t.orderFieldType = r, r;
4140
+ }
4141
+ function ku(t, e, n) {
4142
+ const r = e;
4136
4143
  if (t.orderField === "serverCreatedAt") {
4137
- e.sort(t.orderDirection === "asc" ? function(s, o) {
4138
- return Xe(s.entity.id, s.serverCreatedAt, o.entity.id, o.serverCreatedAt, n);
4139
- } : function(s, o) {
4140
- return Xe(o.entity.id, o.serverCreatedAt, s.entity.id, s.serverCreatedAt, n);
4144
+ n.sort(t.orderDirection === "asc" ? function(o, a) {
4145
+ return et(o.entity.id, o.serverCreatedAt, a.entity.id, a.serverCreatedAt, r);
4146
+ } : function(o, a) {
4147
+ return et(a.entity.id, a.serverCreatedAt, o.entity.id, o.serverCreatedAt, r);
4141
4148
  });
4142
4149
  return;
4143
4150
  }
4144
- const r = t.orderField;
4145
- e.sort(t.orderDirection === "asc" ? function(s, o) {
4146
- return Xe(s.entity.id, s.entity[r], o.entity.id, o.entity[r], n);
4147
- } : function(s, o) {
4148
- return Xe(o.entity.id, o.entity[r], s.entity.id, s.entity[r], n);
4151
+ const i = t.orderField;
4152
+ n.sort(t.orderDirection === "asc" ? function(o, a) {
4153
+ return et(o.entity.id, o.entity[i], a.entity.id, a.entity[i], r);
4154
+ } : function(o, a) {
4155
+ return et(a.entity.id, a.entity[i], o.entity.id, o.entity[i], r);
4149
4156
  });
4150
4157
  }
4151
4158
  var Se;
4152
4159
  (function(t) {
4153
4160
  t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
4154
4161
  })(Se || (Se = {}));
4155
- class ku {
4162
+ class ju {
4156
4163
  constructor(e, n, r, i, s) {
4157
- this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Tn({
4164
+ this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new wn({
4158
4165
  persister: n,
4159
4166
  merge: Ou,
4160
4167
  serialize: Su,
@@ -4216,25 +4223,24 @@ class ku {
4216
4223
  }
4217
4224
  initSubscription(e, n, r) {
4218
4225
  return Hr(this, void 0, void 0, function* () {
4219
- var i, s, o, a, u;
4226
+ var i, s, o, a;
4220
4227
  yield this.subs.waitForKeyToLoad(n);
4221
- const d = this.subs.currentValue[n];
4222
- if (d && d.state && d.state.txId) {
4223
- this.sendResync(d, d.state), !((i = d.values) === null || i === void 0) && i.entities && r && (Object.keys(e)[0], r({
4228
+ const u = this.subs.currentValue[n];
4229
+ if (u && u.state && u.state.txId) {
4230
+ this.sendResync(u, u.state), !((i = u.values) === null || i === void 0) && i.entities && r && (Object.keys(e)[0], r({
4224
4231
  type: Se.LoadFromStorage,
4225
- data: Tt(d, (s = d.values) === null || s === void 0 ? void 0 : s.entities)
4232
+ data: wt(u, (s = u.values) === null || s === void 0 ? void 0 : s.entities)
4226
4233
  }));
4227
4234
  return;
4228
4235
  }
4229
- const c = Object.keys(e)[0], f = ((a = (o = e[c]) === null || o === void 0 ? void 0 : o.$) === null || a === void 0 ? void 0 : a.order) || { serverCreatedAt: "asc" }, [l, p] = Object.entries(f)[0], y = l === "serverCreatedAt" ? "number" : (u = we(this.createStore([]), c, l)) === null || u === void 0 ? void 0 : u["checked-data-type"];
4230
- this.subs.updateInPlace((b) => {
4231
- b[n] = {
4236
+ const d = Object.keys(e)[0], c = ((a = (o = e[d]) === null || o === void 0 ? void 0 : o.$) === null || a === void 0 ? void 0 : a.order) || { serverCreatedAt: "asc" }, [f, l] = Object.entries(c)[0];
4237
+ this.subs.updateInPlace((p) => {
4238
+ p[n] = {
4232
4239
  query: e,
4233
4240
  hash: n,
4234
- table: c,
4235
- orderDirection: p,
4236
- orderField: l,
4237
- orderFieldType: y,
4241
+ table: d,
4242
+ orderDirection: l,
4243
+ orderField: f,
4238
4244
  createdAt: Date.now(),
4239
4245
  updatedAt: Date.now()
4240
4246
  };
@@ -4298,7 +4304,7 @@ class ku {
4298
4304
  c[s] = a, c[s].updatedAt = Date.now();
4299
4305
  }), a.values && this.notifyCbs(s, {
4300
4306
  type: Se.InitialSyncBatch,
4301
- data: Tt(a, a.values.entities),
4307
+ data: wt(a, a.values.entities),
4302
4308
  batch: o
4303
4309
  });
4304
4310
  }
@@ -4323,7 +4329,7 @@ class ku {
4323
4329
  const s = this.subs.currentValue[i];
4324
4330
  s && this.notifyCbs(i, {
4325
4331
  type: Se.InitialSyncComplete,
4326
- data: Tt(s, ((n = s.values) === null || n === void 0 ? void 0 : n.entities) || [])
4332
+ data: wt(s, ((n = s.values) === null || n === void 0 ? void 0 : n.entities) || [])
4327
4333
  });
4328
4334
  }
4329
4335
  onSyncUpdateTriples(e) {
@@ -4348,9 +4354,9 @@ class ku {
4348
4354
  continue;
4349
4355
  u.txId = d["tx-id"];
4350
4356
  const c = [], f = {};
4351
- for (const T of d.changes) {
4352
- const w = (n = f[T.triple[0]]) !== null && n !== void 0 ? n : [];
4353
- f[T.triple[0]] = w, w.push(T);
4357
+ for (const g of d.changes) {
4358
+ const m = (n = f[g.triple[0]]) !== null && n !== void 0 ? n : [];
4359
+ f[g.triple[0]] = m, m.push(g);
4354
4360
  }
4355
4361
  const l = (r = a.values) !== null && r !== void 0 ? r : {
4356
4362
  entities: [],
@@ -4358,45 +4364,46 @@ class ku {
4358
4364
  }, p = l.entities;
4359
4365
  a.values = l;
4360
4366
  const y = [];
4361
- e: for (const [T, w] of Object.entries(f))
4362
- for (const [m, E] of Object.entries(p))
4363
- if (oo(E.store, T)) {
4364
- Jr(E.store, w);
4365
- const S = Zt(a, E.store), I = Eu(E.store, w)[T];
4366
- for (const [x, { oldValue: q, newValue: Te }] of Object.entries(I || {}))
4367
- q === Te && delete I[x];
4368
- S ? (y.push({
4369
- oldEntity: E.entity,
4370
- newEntity: S,
4371
- changedFields: I || {}
4372
- }), E.entity = S) : c.push(m), delete f[T];
4367
+ e: for (const [g, m] of Object.entries(f))
4368
+ for (const [E, S] of Object.entries(p))
4369
+ if (oo(S.store, g)) {
4370
+ Jr(S.store, m);
4371
+ const I = Zt(a, S.store), R = Eu(S.store, m)[g];
4372
+ for (const [q, { oldValue: we, newValue: Ie }] of Object.entries(R || {}))
4373
+ we === Ie && delete R[q];
4374
+ I ? (y.push({
4375
+ oldEntity: S.entity,
4376
+ newEntity: I,
4377
+ changedFields: R || {}
4378
+ }), S.entity = I) : c.push(E), delete f[g];
4373
4379
  continue e;
4374
4380
  }
4375
4381
  const b = [];
4376
- for (const [T, w] of Object.entries(f)) {
4377
- const m = this.createStore([]);
4378
- l.attrs = m.attrs, Jr(m, w);
4379
- const E = Zt(a, m);
4380
- if (!E) {
4382
+ for (const [g, m] of Object.entries(f)) {
4383
+ const E = this.createStore([]);
4384
+ l.attrs = E.attrs, Jr(E, m);
4385
+ const S = Zt(a, E);
4386
+ if (!S) {
4381
4387
  this.log.error("No entity found after applying change", {
4382
4388
  sub: a,
4383
- changes: w,
4384
- store: m
4389
+ changes: m,
4390
+ store: E
4385
4391
  });
4386
4392
  continue;
4387
4393
  }
4388
4394
  p.push({
4389
- store: m,
4390
- entity: E,
4391
- serverCreatedAt: Yr(a, m, E.id)
4392
- }), b.push(E);
4395
+ store: E,
4396
+ entity: S,
4397
+ serverCreatedAt: Yr(a, E, S.id)
4398
+ }), b.push(S);
4393
4399
  }
4394
4400
  const _ = [];
4395
- for (const T of c.sort().reverse())
4396
- _.push(p[T].entity), p.splice(T, 1);
4397
- Au(a, p), this.notifyCbs(o, {
4401
+ for (const g of c.sort().reverse())
4402
+ _.push(p[g].entity), p.splice(g, 1);
4403
+ const w = Au(a, this.createStore);
4404
+ ku(a, w, p), this.notifyCbs(o, {
4398
4405
  type: Se.SyncTransaction,
4399
- data: Tt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
4406
+ data: wt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
4400
4407
  added: b,
4401
4408
  removed: _,
4402
4409
  updated: y
@@ -4461,7 +4468,7 @@ var F = function(t, e, n, r) {
4461
4468
  }
4462
4469
  d((r = r.apply(t, e || [])).next());
4463
4470
  });
4464
- }, ju = function(t, e) {
4471
+ }, Cu = function(t, e) {
4465
4472
  var n = {};
4466
4473
  for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
4467
4474
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
@@ -4475,11 +4482,11 @@ const le = {
4475
4482
  AUTHENTICATED: "authenticated",
4476
4483
  CLOSED: "closed",
4477
4484
  ERRORED: "errored"
4478
- }, Cu = 3e4, Pu = 3e4, Iu = 200, Mu = {
4485
+ }, Pu = 3e4, Iu = 3e4, Mu = 200, Ru = {
4479
4486
  apiURI: "https://api.instantdb.com",
4480
4487
  websocketURI: "wss://api.instantdb.com/runtime/session"
4481
- }, Xt = "_instant_oauth_redirect", Qe = "currentUser";
4482
- function Ru({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
4488
+ }, Xt = "_instant_oauth_redirect", He = "currentUser";
4489
+ function xu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
4483
4490
  if (!i)
4484
4491
  return new Qr(`${r}?app_id=${e}`);
4485
4492
  switch (t) {
@@ -4491,7 +4498,7 @@ function Ru({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl:
4491
4498
  throw new Error("Unknown transport type " + t);
4492
4499
  }
4493
4500
  }
4494
- function xu() {
4501
+ function $u() {
4495
4502
  return typeof window < "u" || typeof chrome < "u";
4496
4503
  }
4497
4504
  const Zr = {
@@ -4500,7 +4507,7 @@ const Zr = {
4500
4507
  "refresh-presence": !0,
4501
4508
  "patch-presence": !0
4502
4509
  };
4503
- function $u(t, e) {
4510
+ function Du(t, e) {
4504
4511
  var n;
4505
4512
  const r = typeof t == "string" ? JSON.parse(t) : t;
4506
4513
  if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
@@ -4509,12 +4516,12 @@ function $u(t, e) {
4509
4516
  }
4510
4517
  return r;
4511
4518
  }
4512
- function Du(t, e) {
4519
+ function Uu(t, e) {
4513
4520
  var n;
4514
4521
  const r = Object.assign({}, e);
4515
4522
  return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: Si(e.result.store) })), r;
4516
4523
  }
4517
- function Uu(t, e) {
4524
+ function Lu(t, e) {
4518
4525
  switch (t) {
4519
4526
  case "pendingMutations":
4520
4527
  return new Map(typeof e == "string" ? JSON.parse(e) : e);
@@ -4522,7 +4529,7 @@ function Uu(t, e) {
4522
4529
  return e;
4523
4530
  }
4524
4531
  }
4525
- function Lu(t, e) {
4532
+ function Fu(t, e) {
4526
4533
  switch (t) {
4527
4534
  case "pendingMutations":
4528
4535
  return [...e.entries()];
@@ -4530,7 +4537,7 @@ function Lu(t, e) {
4530
4537
  return e;
4531
4538
  }
4532
4539
  }
4533
- function Fu(t, e, n) {
4540
+ function Nu(t, e, n) {
4534
4541
  const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
4535
4542
  return r && !i && n && (n.result = r), n || e;
4536
4543
  }
@@ -4540,7 +4547,7 @@ function Xr(t) {
4540
4547
  return a == u ? r < s ? -1 : r > s ? 1 : 0 : a - u;
4541
4548
  });
4542
4549
  }
4543
- class Nu {
4550
+ class Ku {
4544
4551
  constructor(e, n = Ki, r = qi, i, s) {
4545
4552
  var o, a, u;
4546
4553
  if (this._isOnline = !0, this._isShutdown = !1, this.status = le.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (d, c, f) => {
@@ -4548,9 +4555,9 @@ class Nu {
4548
4555
  switch (d) {
4549
4556
  case "pendingMutations": {
4550
4557
  const y = (l = c == null ? void 0 : c.entries()) !== null && l !== void 0 ? l : [], b = (p = f == null ? void 0 : f.entries()) !== null && p !== void 0 ? p : [], _ = new Map([...y, ...b]);
4551
- return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([w, m]) => {
4558
+ return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([g, m]) => {
4552
4559
  var E;
4553
- !(!((E = f == null ? void 0 : f.pendingMutations) === null || E === void 0) && E.has(w)) && !m["tx-id"] && this._sendMutation(w, m);
4560
+ !(!((E = f == null ? void 0 : f.pendingMutations) === null || E === void 0) && E.has(g)) && !m["tx-id"] && this._sendMutation(g, m);
4554
4561
  }), _;
4555
4562
  }
4556
4563
  default:
@@ -4572,7 +4579,7 @@ class Nu {
4572
4579
  }, this.notifyQueryError = (d, c) => {
4573
4580
  (this.queryCbs[d] || []).forEach((l) => l.cb({ error: c }));
4574
4581
  }, this.pushTx = (d) => {
4575
- this.config.disableValidation || Tu(d, this.config.schema);
4582
+ this.config.disableValidation || wu(d, this.config.schema);
4576
4583
  try {
4577
4584
  const c = qa({
4578
4585
  attrs: this.optimisticAttrs(),
@@ -4659,10 +4666,10 @@ class Nu {
4659
4666
  return;
4660
4667
  }
4661
4668
  this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
4662
- }, this._EventSource = s, this.config = Object.assign(Object.assign({}, Mu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (a = this.config.pendingTxCleanupTimeout) !== null && a !== void 0 ? a : Pu, this._pendingMutationCleanupThreshold = (u = this.config.pendingMutationCleanupThreshold) !== null && u !== void 0 ? u : Iu, this._log = fu(e.verbose || Bn || Wi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Gn }), this.config.schema && (this._linkIndex = Kr(this.config.schema)), !!xu()) {
4669
+ }, this._EventSource = s, this.config = Object.assign(Object.assign({}, Ru), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (a = this.config.pendingTxCleanupTimeout) !== null && a !== void 0 ? a : Iu, this._pendingMutationCleanupThreshold = (u = this.config.pendingMutationCleanupThreshold) !== null && u !== void 0 ? u : Mu, this._log = fu(e.verbose || Bn || Wi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Gn }), this.config.schema && (this._linkIndex = Kr(this.config.schema)), !!$u()) {
4663
4670
  if (!e.appId)
4664
4671
  throw new Error("Instant must be initialized with an appId.");
4665
- if (!Ne(e.appId))
4672
+ if (!Ke(e.appId))
4666
4673
  throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
4667
4674
  typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) => F(this, void 0, void 0, function* () {
4668
4675
  var c;
@@ -4674,7 +4681,7 @@ class Nu {
4674
4681
  } catch (f) {
4675
4682
  this._log.error("[error] handle broadcast channel", f);
4676
4683
  }
4677
- }))), this._initStorage(n), this._syncTable = new ku(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
4684
+ }))), this._initStorage(n), this._syncTable = new ju(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
4678
4685
  useDateObjects: this.config.useDateObjects
4679
4686
  }, this._log, (d) => Et(this.attrs, d, this.config.enableCardinalityInference, this._linkIndex, this.config.useDateObjects)), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
4680
4687
  this._isOnline = d, this._startSocket(), r.listen((c) => {
@@ -4697,11 +4704,11 @@ class Nu {
4697
4704
  this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
4698
4705
  }
4699
4706
  _initStorage(e) {
4700
- this.querySubs = new Tn({
4707
+ this.querySubs = new wn({
4701
4708
  persister: new e(this.config.appId, "querySubs"),
4702
- merge: Fu,
4703
- serialize: Du,
4704
- parse: (n, r) => $u(r, this.config.useDateObjects),
4709
+ merge: Nu,
4710
+ serialize: Uu,
4711
+ parse: (n, r) => Du(r, this.config.useDateObjects),
4705
4712
  // objectSize
4706
4713
  objectSize: (n) => {
4707
4714
  var r, i, s, o;
@@ -4717,11 +4724,11 @@ class Nu {
4717
4724
  maxSize: 1e6
4718
4725
  // 1 million triples
4719
4726
  }
4720
- }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Tn({
4727
+ }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new wn({
4721
4728
  persister: new e(this.config.appId, "kv"),
4722
4729
  merge: this._onMergeKv,
4723
- serialize: Lu,
4724
- parse: Uu,
4730
+ serialize: Fu,
4731
+ parse: Lu,
4725
4732
  objectSize: () => 0,
4726
4733
  logger: this._log,
4727
4734
  saveThrottleMs: 100,
@@ -4730,7 +4737,7 @@ class Nu {
4730
4737
  gc: null
4731
4738
  }), this.kv.onKeyLoaded = (n) => {
4732
4739
  n === "pendingMutations" && this.notifyAll();
4733
- }, this.kv.waitForKeyToLoad("pendingMutations"), this.kv.waitForKeyToLoad(Qe), this._beforeUnloadCbs.push(() => {
4740
+ }, this.kv.waitForKeyToLoad("pendingMutations"), this.kv.waitForKeyToLoad(He), this._beforeUnloadCbs.push(() => {
4734
4741
  this.kv.flush(), this.querySubs.flush();
4735
4742
  });
4736
4743
  }
@@ -4752,14 +4759,14 @@ class Nu {
4752
4759
  if (s)
4753
4760
  i.resolve({ status: e, eventId: n });
4754
4761
  else if (r.type) {
4755
- const { status: o } = r, a = ju(r, ["status"]);
4762
+ const { status: o } = r, a = Cu(r, ["status"]);
4756
4763
  i.reject(new Dt({
4757
4764
  // @ts-expect-error body.type is not constant typed
4758
4765
  body: a,
4759
4766
  status: o
4760
4767
  }));
4761
4768
  } else
4762
- i.reject(new qe(r.message, r.hint));
4769
+ i.reject(new We(r.message, r.hint));
4763
4770
  }
4764
4771
  _setStatus(e, n) {
4765
4772
  this.status = e, this._errorMessage = n, this.notifyConnectionStatusSubs(e);
@@ -4793,14 +4800,14 @@ class Nu {
4793
4800
  const { q: l, result: p } = n, y = V(l);
4794
4801
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
4795
4802
  break;
4796
- const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, T = Nr(p), w = Et(this.attrs, T, d, this._linkIndex, this.config.useDateObjects);
4803
+ const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, w = Nr(p), g = Et(this.attrs, w, d, this._linkIndex, this.config.useDateObjects);
4797
4804
  this.querySubs.updateInPlace((m) => {
4798
4805
  if (!m[y]) {
4799
4806
  this._log.info("Missing value in querySubs", { hash: y, q: l });
4800
4807
  return;
4801
4808
  }
4802
4809
  m[y].result = {
4803
- store: w,
4810
+ store: g,
4804
4811
  pageInfo: b,
4805
4812
  aggregate: _,
4806
4813
  processedTxId: n["processed-tx-id"]
@@ -4828,24 +4835,24 @@ class Nu {
4828
4835
  const { computations: l, attrs: p } = n, y = n["processed-tx-id"];
4829
4836
  p && this._setAttrs(p), this._cleanupPendingMutationsTimeout();
4830
4837
  const b = this._rewriteMutations(this.attrs, this._pendingMutations(), y);
4831
- b !== this._pendingMutations() && this.kv.updateInPlace((w) => {
4832
- w.pendingMutations = b;
4838
+ b !== this._pendingMutations() && this.kv.updateInPlace((g) => {
4839
+ g.pendingMutations = b;
4833
4840
  });
4834
- const _ = Xr(b.entries()), T = l.map((w) => {
4841
+ const _ = Xr(b.entries()), w = l.map((g) => {
4835
4842
  var m, E, S, I;
4836
- const x = w["instaql-query"], q = w["instaql-result"], Te = V(x), lt = Nr(q), Ft = Et(this.attrs, lt, d, this._linkIndex, this.config.useDateObjects), Nt = this._applyOptimisticUpdates(Ft, _, y), ht = (E = (m = q == null ? void 0 : q[0]) === null || m === void 0 ? void 0 : m.data) === null || E === void 0 ? void 0 : E["page-info"], ce = (I = (S = q == null ? void 0 : q[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
4837
- return { q: x, hash: Te, store: Nt, pageInfo: ht, aggregate: ce };
4843
+ const R = g["instaql-query"], q = g["instaql-result"], we = V(R), Ie = Nr(q), Ft = Et(this.attrs, Ie, d, this._linkIndex, this.config.useDateObjects), Nt = this._applyOptimisticUpdates(Ft, _, y), ht = (E = (m = q == null ? void 0 : q[0]) === null || m === void 0 ? void 0 : m.data) === null || E === void 0 ? void 0 : E["page-info"], ce = (I = (S = q == null ? void 0 : q[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
4844
+ return { q: R, hash: we, store: Nt, pageInfo: ht, aggregate: ce };
4838
4845
  });
4839
- T.forEach(({ hash: w, q: m, store: E, pageInfo: S, aggregate: I }) => {
4840
- this.querySubs.updateInPlace((x) => {
4841
- if (!x[w]) {
4842
- this._log.error("Missing value in querySubs", { hash: w, q: m });
4846
+ w.forEach(({ hash: g, q: m, store: E, pageInfo: S, aggregate: I }) => {
4847
+ this.querySubs.updateInPlace((R) => {
4848
+ if (!R[g]) {
4849
+ this._log.error("Missing value in querySubs", { hash: g, q: m });
4843
4850
  return;
4844
4851
  }
4845
- x[w].result = { store: E, pageInfo: S, aggregate: I, processedTxId: y };
4852
+ R[g].result = { store: E, pageInfo: S, aggregate: I, processedTxId: y };
4846
4853
  });
4847
- }), this._cleanupPendingMutationsQueries(), T.forEach(({ hash: w }) => {
4848
- this.notifyOne(w);
4854
+ }), this._cleanupPendingMutationsQueries(), w.forEach(({ hash: g }) => {
4855
+ this.notifyOne(g);
4849
4856
  });
4850
4857
  break;
4851
4858
  }
@@ -4855,10 +4862,10 @@ class Nu {
4855
4862
  const b = this._rewriteMutations(this.attrs, this._pendingMutations()).get(l);
4856
4863
  if (!b)
4857
4864
  break;
4858
- this._updatePendingMutations((T) => {
4859
- T.set(l, Object.assign(Object.assign({}, T.get(l)), { "tx-id": p, confirmed: Date.now() }));
4865
+ this._updatePendingMutations((w) => {
4866
+ w.set(l, Object.assign(Object.assign({}, w.get(l)), { "tx-id": p, confirmed: Date.now() }));
4860
4867
  });
4861
- const _ = b["tx-steps"].filter(([T, ...w]) => T === "add-attr").map(([T, w]) => w).concat(Object.values(this.attrs));
4868
+ const _ = b["tx-steps"].filter(([w, ...g]) => w === "add-attr").map(([w, g]) => g).concat(Object.values(this.attrs));
4862
4869
  this._setAttrs(_), this._finishTransaction("synced", l), this._cleanupPendingMutationsTimeout();
4863
4870
  break;
4864
4871
  }
@@ -5011,7 +5018,7 @@ class Nu {
5011
5018
  if (!this.querySubs)
5012
5019
  return i.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), i.promise;
5013
5020
  const s = V(e), o = this._startQuerySub(e, s);
5014
- return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), Cu), i.promise;
5021
+ return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), Pu), i.promise;
5015
5022
  }
5016
5023
  _completeQueryOnce(e, n, r) {
5017
5024
  this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
@@ -5055,15 +5062,15 @@ class Nu {
5055
5062
  for (const p of c) {
5056
5063
  const [y] = p;
5057
5064
  if (y === "add-attr") {
5058
- const [_, T] = p, w = i(T);
5059
- if (w && T.id !== w.id) {
5060
- o.attrIdMap[T.id] = w.id, a = !0;
5065
+ const [_, w] = p, g = i(w);
5066
+ if (g && w.id !== g.id) {
5067
+ o.attrIdMap[w.id] = g.id, a = !0;
5061
5068
  continue;
5062
5069
  }
5063
- if (T["value-type"] === "ref") {
5064
- const m = s(T);
5070
+ if (w["value-type"] === "ref") {
5071
+ const m = s(w);
5065
5072
  if (m) {
5066
- o.attrIdMap[T.id] = m.id, o.refSwapAttrIds.add(T.id), a = !0;
5073
+ o.attrIdMap[w.id] = m.id, o.refSwapAttrIds.add(w.id), a = !0;
5067
5074
  continue;
5068
5075
  }
5069
5076
  }
@@ -5124,7 +5131,7 @@ class Nu {
5124
5131
  }
5125
5132
  _applyOptimisticUpdates(e, n, r) {
5126
5133
  for (const [i, s] of n)
5127
- (!s["tx-id"] || r && s["tx-id"] > r) && (e = wo(e, s["tx-steps"]));
5134
+ (!s["tx-id"] || r && s["tx-id"] > r) && (e = To(e, s["tx-steps"]));
5128
5135
  return e;
5129
5136
  }
5130
5137
  /** Re-compute all subscriptions */
@@ -5233,7 +5240,7 @@ class Nu {
5233
5240
  return;
5234
5241
  }
5235
5242
  const e = this._transport;
5236
- this._transport = Ru({
5243
+ this._transport = xu({
5237
5244
  transportType: this._transportType,
5238
5245
  appId: this.config.appId,
5239
5246
  apiURI: this.config.apiURI,
@@ -5343,7 +5350,7 @@ class Nu {
5343
5350
  return F(this, void 0, void 0, function* () {
5344
5351
  const { user: e, error: n } = yield this.getCurrentUser();
5345
5352
  if (n)
5346
- throw new qe("Could not get current user: " + n.message);
5353
+ throw new We("Could not get current user: " + n.message);
5347
5354
  return e;
5348
5355
  });
5349
5356
  }
@@ -5375,8 +5382,8 @@ class Nu {
5375
5382
  setCurrentUser(e) {
5376
5383
  return F(this, void 0, void 0, function* () {
5377
5384
  this.kv.updateInPlace((n) => {
5378
- n[Qe] = e;
5379
- }), yield this.kv.waitForKeyToLoad(Qe);
5385
+ n[He] = e;
5386
+ }), yield this.kv.waitForKeyToLoad(He);
5380
5387
  });
5381
5388
  }
5382
5389
  getCurrentUserCached() {
@@ -5384,7 +5391,7 @@ class Nu {
5384
5391
  }
5385
5392
  _getCurrentUser() {
5386
5393
  return F(this, void 0, void 0, function* () {
5387
- const e = yield this.kv.waitForKeyToLoad(Qe);
5394
+ const e = yield this.kv.waitForKeyToLoad(He);
5388
5395
  return typeof e == "string" ? JSON.parse(e) : e;
5389
5396
  });
5390
5397
  }
@@ -5409,7 +5416,7 @@ class Nu {
5409
5416
  }
5410
5417
  _hasCurrentUser() {
5411
5418
  return F(this, void 0, void 0, function* () {
5412
- const e = yield this.kv.waitForKeyToLoad(Qe);
5419
+ const e = yield this.kv.waitForKeyToLoad(He);
5413
5420
  return typeof e == "string" ? JSON.parse(e) != null : e != null;
5414
5421
  });
5415
5422
  }
@@ -5649,7 +5656,7 @@ class Nu {
5649
5656
  Or(d, c, l);
5650
5657
  break;
5651
5658
  case "-":
5652
- Ti(d, c);
5659
+ wi(d, c);
5653
5660
  break;
5654
5661
  }
5655
5662
  delete d[this._sessionId];
@@ -5748,7 +5755,7 @@ class Nu {
5748
5755
  });
5749
5756
  }
5750
5757
  }
5751
- function Ku(t, e) {
5758
+ function qu(t, e) {
5752
5759
  return new Lt(
5753
5760
  Zi(t, e),
5754
5761
  // (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
@@ -5760,25 +5767,25 @@ function Ku(t, e) {
5760
5767
  void 0
5761
5768
  );
5762
5769
  }
5763
- function qu(t) {
5770
+ function Wu(t) {
5764
5771
  return new Ut(t, {});
5765
5772
  }
5766
- function Wu() {
5773
+ function zu() {
5767
5774
  return new H("string", !0, !1);
5768
5775
  }
5769
- function zu() {
5776
+ function Vu() {
5770
5777
  return new H("number", !0, !1);
5771
5778
  }
5772
- function Vu() {
5779
+ function Bu() {
5773
5780
  return new H("boolean", !0, !1);
5774
5781
  }
5775
- function Bu() {
5782
+ function Gu() {
5776
5783
  return new H("date", !0, !1);
5777
5784
  }
5778
- function Gu() {
5785
+ function Qu() {
5779
5786
  return new H("json", !0, !1);
5780
5787
  }
5781
- function Qu() {
5788
+ function Hu() {
5782
5789
  return new H("json", !0, !1);
5783
5790
  }
5784
5791
  function Zi(t, e) {
@@ -5797,7 +5804,7 @@ function Zi(t, e) {
5797
5804
  new Ut(d.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
5798
5805
  ]));
5799
5806
  }
5800
- function Hu({ entities: t, links: e, rooms: n }) {
5807
+ function Yu({ entities: t, links: e, rooms: n }) {
5801
5808
  const r = e ?? {}, i = n ?? {};
5802
5809
  return new Lt(
5803
5810
  Zi(t, r),
@@ -5810,23 +5817,23 @@ function Hu({ entities: t, links: e, rooms: n }) {
5810
5817
  i
5811
5818
  );
5812
5819
  }
5813
- const Nc = {
5820
+ const Kc = {
5814
5821
  // constructs
5815
- graph: Ku,
5816
- schema: Hu,
5817
- entity: qu,
5822
+ graph: qu,
5823
+ schema: Yu,
5824
+ entity: Wu,
5818
5825
  // value types
5819
- string: Wu,
5820
- number: zu,
5821
- boolean: Vu,
5822
- date: Bu,
5823
- json: Gu,
5824
- any: Qu
5826
+ string: zu,
5827
+ number: Vu,
5828
+ boolean: Bu,
5829
+ date: Gu,
5830
+ json: Qu,
5831
+ any: Hu
5825
5832
  };
5826
5833
  let mt;
5827
- function Yu(t, e) {
5834
+ function Ju(t, e) {
5828
5835
  mt == null || mt.dispose();
5829
- const n = nc(e), r = Xu(e, a), i = Zu(Ju(t));
5836
+ const n = rc(e), r = ec(e, a), i = Xu(Zu(t));
5830
5837
  function s(c) {
5831
5838
  var f;
5832
5839
  c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && a();
@@ -5848,10 +5855,10 @@ function Yu(t, e) {
5848
5855
  }
5849
5856
  return d();
5850
5857
  }
5851
- function Ju(t) {
5858
+ function Zu(t) {
5852
5859
  return `${Bn || zi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
5853
5860
  }
5854
- function Zu(t) {
5861
+ function Xu(t) {
5855
5862
  const e = document.createElement("iframe");
5856
5863
  return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
5857
5864
  width: "100%",
@@ -5860,7 +5867,7 @@ function Zu(t) {
5860
5867
  border: "none"
5861
5868
  }), { element: e };
5862
5869
  }
5863
- function Xu(t, e) {
5870
+ function ec(t, e) {
5864
5871
  const n = `
5865
5872
  <svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
5866
5873
  <rect width="512" height="512" fill="black"/>
@@ -5870,7 +5877,7 @@ function Xu(t, e) {
5870
5877
  return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
5871
5878
  // pos
5872
5879
  position: "fixed"
5873
- }, ec(t.position)), {
5880
+ }, tc(t.position)), {
5874
5881
  height: "32px",
5875
5882
  width: "32px",
5876
5883
  // layout
@@ -5885,7 +5892,7 @@ function Xu(t, e) {
5885
5892
  cursor: "pointer"
5886
5893
  })), r.addEventListener("click", e), { element: r };
5887
5894
  }
5888
- function ec(t) {
5895
+ function tc(t) {
5889
5896
  switch (t) {
5890
5897
  case "bottom-left":
5891
5898
  return { bottom: "24px", left: "24px" };
@@ -5897,7 +5904,7 @@ function ec(t) {
5897
5904
  return { top: "24px", left: "24px" };
5898
5905
  }
5899
5906
  }
5900
- function tc(t) {
5907
+ function nc(t) {
5901
5908
  switch (t) {
5902
5909
  case "bottom-left":
5903
5910
  return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
@@ -5909,23 +5916,23 @@ function tc(t) {
5909
5916
  return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
5910
5917
  }
5911
5918
  }
5912
- function nc(t) {
5919
+ function rc(t) {
5913
5920
  const e = document.createElement("div");
5914
- Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, tc(t.position)), { display: "block", borderRadius: "4px", border: "1px #ccc solid", boxShadow: "0px 0px 8px #00000044", backgroundColor: "#eee", zIndex: "999990" })), e.style.display = "none", e.className = "instant-devtool-container";
5921
+ Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, nc(t.position)), { display: "block", borderRadius: "4px", border: "1px #ccc solid", boxShadow: "0px 0px 8px #00000044", backgroundColor: "#eee", zIndex: "999990" })), e.style.display = "none", e.className = "instant-devtool-container";
5915
5922
  function n() {
5916
5923
  return e.style.display !== "none";
5917
5924
  }
5918
5925
  return { element: e, isVisible: n };
5919
5926
  }
5920
- const rc = {
5927
+ const ic = {
5921
5928
  apiURI: "https://api.instantdb.com",
5922
5929
  websocketURI: "wss://api.instantdb.com/runtime/session"
5923
5930
  };
5924
- function ic() {
5931
+ function sc() {
5925
5932
  var t;
5926
5933
  return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
5927
5934
  }
5928
- function sc() {
5935
+ function oc() {
5929
5936
  var t;
5930
5937
  return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
5931
5938
  }
@@ -5933,23 +5940,23 @@ function mn(t) {
5933
5940
  const e = t.__adminToken;
5934
5941
  return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
5935
5942
  }
5936
- const vn = sc(), en = ic();
5937
- class oc {
5943
+ const vn = oc(), en = sc();
5944
+ class ac {
5938
5945
  constructor(e) {
5939
5946
  this.db = e, this.sendMagicCode = (n) => this.db.sendMagicCode(n), this.signInWithMagicCode = (n) => this.db.signInWithMagicCode(n), this.signInWithToken = (n) => this.db.signInWithCustomToken(n), this.signInAsGuest = () => this.db.signInAsGuest(), this.createAuthorizationURL = (n) => this.db.createAuthorizationURL(n), this.signInWithIdToken = (n) => this.db.signInWithIdToken(n), this.exchangeOAuthCode = (n) => this.db.exchangeCodeForToken(n), this.issuerURI = () => this.db.issuerURI(), this.signOut = (n = { invalidateToken: !0 }) => this.db.signOut(n);
5940
5947
  }
5941
5948
  }
5942
- class ac {
5949
+ class uc {
5943
5950
  constructor(e) {
5944
5951
  this.db = e, this.uploadFile = (n, r, i = {}) => this.db.uploadFile(n, r, i), this.delete = (n) => this.db.deleteFile(n), this.upload = (n, r) => this.db.upload(n, r), this.put = this.upload, this.getDownloadUrl = (n) => this.db.getDownloadUrl(n);
5945
5952
  }
5946
5953
  }
5947
- function uc(t) {
5954
+ function cc(t) {
5948
5955
  return JSON.parse(JSON.stringify(t));
5949
5956
  }
5950
- class cc {
5957
+ class dc {
5951
5958
  constructor(e) {
5952
- this.tx = Vn(), this._reactor = e, this.auth = new oc(this._reactor), this.storage = new ac(this._reactor);
5959
+ this.tx = Vn(), this._reactor = e, this.auth = new ac(this._reactor), this.storage = new uc(this._reactor);
5953
5960
  }
5954
5961
  /**
5955
5962
  * Use this to write data! You can create, update, delete, and link objects
@@ -6131,23 +6138,23 @@ function ei(t) {
6131
6138
  const e = V(t);
6132
6139
  return en.set(t, e), e;
6133
6140
  }
6134
- function dc(t, e) {
6141
+ function fc(t, e) {
6135
6142
  return ei(t._reactor.config.schema) !== ei(e);
6136
6143
  }
6137
- function fc(t, e, n, r, i) {
6144
+ function lc(t, e, n, r, i) {
6138
6145
  const s = vn[mn(t)];
6139
6146
  if (s)
6140
- return dc(s, t.schema) && s._reactor.updateSchema(t.schema), s;
6141
- const o = new Nu(Object.assign(Object.assign(Object.assign({}, rc), t), { cardinalityInference: !!t.schema }), e || Ki, n || qi, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Gn }), i), a = new cc(o);
6142
- return vn[mn(t)] = a, lc(t.appId, t.devtool), a;
6147
+ return fc(s, t.schema) && s._reactor.updateSchema(t.schema), s;
6148
+ const o = new Ku(Object.assign(Object.assign(Object.assign({}, ic), t), { cardinalityInference: !!t.schema }), e || Ki, n || qi, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Gn }), i), a = new dc(o);
6149
+ return vn[mn(t)] = a, hc(t.appId, t.devtool), a;
6143
6150
  }
6144
- function lc(t, e) {
6151
+ function hc(t, e) {
6145
6152
  if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
6146
6153
  return;
6147
6154
  const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
6148
- n.allowedHosts.includes(window.location.hostname) && Yu(t, n);
6155
+ n.allowedHosts.includes(window.location.hostname) && Ju(t, n);
6149
6156
  }
6150
- var Sn = { exports: {} }, He = {};
6157
+ var Sn = { exports: {} }, Ye = {};
6151
6158
  /**
6152
6159
  * @license React
6153
6160
  * react-jsx-runtime.production.min.js
@@ -6158,8 +6165,8 @@ var Sn = { exports: {} }, He = {};
6158
6165
  * LICENSE file in the root directory of this source tree.
6159
6166
  */
6160
6167
  var ti;
6161
- function hc() {
6162
- if (ti) return He;
6168
+ function pc() {
6169
+ if (ti) return Ye;
6163
6170
  ti = 1;
6164
6171
  var t = ci, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
6165
6172
  function o(a, u, d) {
@@ -6169,11 +6176,11 @@ function hc() {
6169
6176
  if (a && a.defaultProps) for (c in u = a.defaultProps, u) f[c] === void 0 && (f[c] = u[c]);
6170
6177
  return { $$typeof: e, type: a, key: l, ref: p, props: f, _owner: i.current };
6171
6178
  }
6172
- return He.Fragment = n, He.jsx = o, He.jsxs = o, He;
6179
+ return Ye.Fragment = n, Ye.jsx = o, Ye.jsxs = o, Ye;
6173
6180
  }
6174
- var Ye = {}, ni;
6175
- function pc() {
6176
- if (ni) return Ye;
6181
+ var Je = {}, ni;
6182
+ function yc() {
6183
+ if (ni) return Je;
6177
6184
  ni = 1;
6178
6185
  var t = {};
6179
6186
  /**
@@ -6187,44 +6194,44 @@ function pc() {
6187
6194
  */
6188
6195
  return t.NODE_ENV !== "production" && function() {
6189
6196
  var e = ci, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, _ = "@@iterator";
6190
- function T(h) {
6197
+ function w(h) {
6191
6198
  if (h === null || typeof h != "object")
6192
6199
  return null;
6193
- var g = b && h[b] || h[_];
6194
- return typeof g == "function" ? g : null;
6200
+ var T = b && h[b] || h[_];
6201
+ return typeof T == "function" ? T : null;
6195
6202
  }
6196
- var w = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
6203
+ var g = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
6197
6204
  function m(h) {
6198
6205
  {
6199
- for (var g = arguments.length, v = new Array(g > 1 ? g - 1 : 0), O = 1; O < g; O++)
6206
+ for (var T = arguments.length, v = new Array(T > 1 ? T - 1 : 0), O = 1; O < T; O++)
6200
6207
  v[O - 1] = arguments[O];
6201
6208
  E("error", h, v);
6202
6209
  }
6203
6210
  }
6204
- function E(h, g, v) {
6211
+ function E(h, T, v) {
6205
6212
  {
6206
- var O = w.ReactDebugCurrentFrame, P = O.getStackAddendum();
6207
- P !== "" && (g += "%s", v = v.concat([P]));
6213
+ var O = g.ReactDebugCurrentFrame, P = O.getStackAddendum();
6214
+ P !== "" && (T += "%s", v = v.concat([P]));
6208
6215
  var M = v.map(function(C) {
6209
6216
  return String(C);
6210
6217
  });
6211
- M.unshift("Warning: " + g), Function.prototype.apply.call(console[h], console, M);
6218
+ M.unshift("Warning: " + T), Function.prototype.apply.call(console[h], console, M);
6212
6219
  }
6213
6220
  }
6214
- var S = !1, I = !1, x = !1, q = !1, Te = !1, lt;
6215
- lt = Symbol.for("react.module.reference");
6221
+ var S = !1, I = !1, R = !1, q = !1, we = !1, Ie;
6222
+ Ie = Symbol.for("react.module.reference");
6216
6223
  function Ft(h) {
6217
- return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Te || h === s || h === c || h === f || q || h === y || S || I || x || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof === a || h.$$typeof === u || h.$$typeof === d || // This needs to include all possible module reference object
6224
+ return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || we || h === s || h === c || h === f || q || h === y || S || I || R || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof === a || h.$$typeof === u || h.$$typeof === d || // This needs to include all possible module reference object
6218
6225
  // types supported by any Flight configuration anywhere since
6219
6226
  // we don't know which Flight build this will end up being used
6220
6227
  // with.
6221
- h.$$typeof === lt || h.getModuleId !== void 0));
6228
+ h.$$typeof === Ie || h.getModuleId !== void 0));
6222
6229
  }
6223
- function Nt(h, g, v) {
6230
+ function Nt(h, T, v) {
6224
6231
  var O = h.displayName;
6225
6232
  if (O)
6226
6233
  return O;
6227
- var P = g.displayName || g.name || "";
6234
+ var P = T.displayName || T.name || "";
6228
6235
  return P !== "" ? v + "(" + P + ")" : v;
6229
6236
  }
6230
6237
  function ht(h) {
@@ -6254,8 +6261,8 @@ function pc() {
6254
6261
  if (typeof h == "object")
6255
6262
  switch (h.$$typeof) {
6256
6263
  case u:
6257
- var g = h;
6258
- return ht(g) + ".Consumer";
6264
+ var T = h;
6265
+ return ht(T) + ".Consumer";
6259
6266
  case a:
6260
6267
  var v = h;
6261
6268
  return ht(v._context) + ".Provider";
@@ -6275,13 +6282,13 @@ function pc() {
6275
6282
  }
6276
6283
  return null;
6277
6284
  }
6278
- var me = Object.assign, Be = 0, Yn, Jn, Zn, Xn, er, tr, nr;
6285
+ var me = Object.assign, Ge = 0, Yn, Jn, Zn, Xn, er, tr, nr;
6279
6286
  function rr() {
6280
6287
  }
6281
6288
  rr.__reactDisabledLog = !0;
6282
6289
  function es() {
6283
6290
  {
6284
- if (Be === 0) {
6291
+ if (Ge === 0) {
6285
6292
  Yn = console.log, Jn = console.info, Zn = console.warn, Xn = console.error, er = console.group, tr = console.groupCollapsed, nr = console.groupEnd;
6286
6293
  var h = {
6287
6294
  configurable: !0,
@@ -6299,12 +6306,12 @@ function pc() {
6299
6306
  groupEnd: h
6300
6307
  });
6301
6308
  }
6302
- Be++;
6309
+ Ge++;
6303
6310
  }
6304
6311
  }
6305
6312
  function ts() {
6306
6313
  {
6307
- if (Be--, Be === 0) {
6314
+ if (Ge--, Ge === 0) {
6308
6315
  var h = {
6309
6316
  configurable: !0,
6310
6317
  enumerable: !0,
@@ -6334,11 +6341,11 @@ function pc() {
6334
6341
  })
6335
6342
  });
6336
6343
  }
6337
- Be < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
6344
+ Ge < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
6338
6345
  }
6339
6346
  }
6340
- var Kt = w.ReactCurrentDispatcher, qt;
6341
- function pt(h, g, v) {
6347
+ var Kt = g.ReactCurrentDispatcher, qt;
6348
+ function pt(h, T, v) {
6342
6349
  {
6343
6350
  if (qt === void 0)
6344
6351
  try {
@@ -6356,7 +6363,7 @@ function pc() {
6356
6363
  var ns = typeof WeakMap == "function" ? WeakMap : Map;
6357
6364
  yt = new ns();
6358
6365
  }
6359
- function ir(h, g) {
6366
+ function ir(h, T) {
6360
6367
  if (!h || Wt)
6361
6368
  return "";
6362
6369
  {
@@ -6371,7 +6378,7 @@ function pc() {
6371
6378
  var M;
6372
6379
  M = Kt.current, Kt.current = null, es();
6373
6380
  try {
6374
- if (g) {
6381
+ if (T) {
6375
6382
  var C = function() {
6376
6383
  throw Error();
6377
6384
  };
@@ -6424,17 +6431,17 @@ function pc() {
6424
6431
  } finally {
6425
6432
  Wt = !1, Kt.current = M, ts(), Error.prepareStackTrace = P;
6426
6433
  }
6427
- var Me = h ? h.displayName || h.name : "", ve = Me ? pt(Me) : "";
6434
+ var Re = h ? h.displayName || h.name : "", ve = Re ? pt(Re) : "";
6428
6435
  return typeof h == "function" && yt.set(h, ve), ve;
6429
6436
  }
6430
- function rs(h, g, v) {
6437
+ function rs(h, T, v) {
6431
6438
  return ir(h, !1);
6432
6439
  }
6433
6440
  function is(h) {
6434
- var g = h.prototype;
6435
- return !!(g && g.isReactComponent);
6441
+ var T = h.prototype;
6442
+ return !!(T && T.isReactComponent);
6436
6443
  }
6437
- function bt(h, g, v) {
6444
+ function bt(h, T, v) {
6438
6445
  if (h == null)
6439
6446
  return "";
6440
6447
  if (typeof h == "function")
@@ -6452,28 +6459,28 @@ function pc() {
6452
6459
  case d:
6453
6460
  return rs(h.render);
6454
6461
  case l:
6455
- return bt(h.type, g, v);
6462
+ return bt(h.type, T, v);
6456
6463
  case p: {
6457
6464
  var O = h, P = O._payload, M = O._init;
6458
6465
  try {
6459
- return bt(M(P), g, v);
6466
+ return bt(M(P), T, v);
6460
6467
  } catch {
6461
6468
  }
6462
6469
  }
6463
6470
  }
6464
6471
  return "";
6465
6472
  }
6466
- var Ge = Object.prototype.hasOwnProperty, sr = {}, or = w.ReactDebugCurrentFrame;
6473
+ var Qe = Object.prototype.hasOwnProperty, sr = {}, or = g.ReactDebugCurrentFrame;
6467
6474
  function _t(h) {
6468
6475
  if (h) {
6469
- var g = h._owner, v = bt(h.type, h._source, g ? g.type : null);
6476
+ var T = h._owner, v = bt(h.type, h._source, T ? T.type : null);
6470
6477
  or.setExtraStackFrame(v);
6471
6478
  } else
6472
6479
  or.setExtraStackFrame(null);
6473
6480
  }
6474
- function ss(h, g, v, O, P) {
6481
+ function ss(h, T, v, O, P) {
6475
6482
  {
6476
- var M = Function.call.bind(Ge);
6483
+ var M = Function.call.bind(Qe);
6477
6484
  for (var C in h)
6478
6485
  if (M(h, C)) {
6479
6486
  var k = void 0;
@@ -6482,7 +6489,7 @@ function pc() {
6482
6489
  var G = Error((O || "React class") + ": " + v + " type `" + C + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[C] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
6483
6490
  throw G.name = "Invariant Violation", G;
6484
6491
  }
6485
- k = h[C](g, C, O, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
6492
+ k = h[C](T, C, O, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
6486
6493
  } catch (D) {
6487
6494
  k = D;
6488
6495
  }
@@ -6496,7 +6503,7 @@ function pc() {
6496
6503
  }
6497
6504
  function as(h) {
6498
6505
  {
6499
- var g = typeof Symbol == "function" && Symbol.toStringTag, v = g && h[Symbol.toStringTag] || h.constructor.name || "Object";
6506
+ var T = typeof Symbol == "function" && Symbol.toStringTag, v = T && h[Symbol.toStringTag] || h.constructor.name || "Object";
6500
6507
  return v;
6501
6508
  }
6502
6509
  }
@@ -6514,35 +6521,35 @@ function pc() {
6514
6521
  if (us(h))
6515
6522
  return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", as(h)), ar(h);
6516
6523
  }
6517
- var cr = w.ReactCurrentOwner, cs = {
6524
+ var cr = g.ReactCurrentOwner, cs = {
6518
6525
  key: !0,
6519
6526
  ref: !0,
6520
6527
  __self: !0,
6521
6528
  __source: !0
6522
6529
  }, dr, fr;
6523
6530
  function ds(h) {
6524
- if (Ge.call(h, "ref")) {
6525
- var g = Object.getOwnPropertyDescriptor(h, "ref").get;
6526
- if (g && g.isReactWarning)
6531
+ if (Qe.call(h, "ref")) {
6532
+ var T = Object.getOwnPropertyDescriptor(h, "ref").get;
6533
+ if (T && T.isReactWarning)
6527
6534
  return !1;
6528
6535
  }
6529
6536
  return h.ref !== void 0;
6530
6537
  }
6531
6538
  function fs(h) {
6532
- if (Ge.call(h, "key")) {
6533
- var g = Object.getOwnPropertyDescriptor(h, "key").get;
6534
- if (g && g.isReactWarning)
6539
+ if (Qe.call(h, "key")) {
6540
+ var T = Object.getOwnPropertyDescriptor(h, "key").get;
6541
+ if (T && T.isReactWarning)
6535
6542
  return !1;
6536
6543
  }
6537
6544
  return h.key !== void 0;
6538
6545
  }
6539
- function ls(h, g) {
6546
+ function ls(h, T) {
6540
6547
  typeof h.ref == "string" && cr.current;
6541
6548
  }
6542
- function hs(h, g) {
6549
+ function hs(h, T) {
6543
6550
  {
6544
6551
  var v = function() {
6545
- dr || (dr = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", g));
6552
+ dr || (dr = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
6546
6553
  };
6547
6554
  v.isReactWarning = !0, Object.defineProperty(h, "key", {
6548
6555
  get: v,
@@ -6550,10 +6557,10 @@ function pc() {
6550
6557
  });
6551
6558
  }
6552
6559
  }
6553
- function ps(h, g) {
6560
+ function ps(h, T) {
6554
6561
  {
6555
6562
  var v = function() {
6556
- fr || (fr = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", g));
6563
+ fr || (fr = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
6557
6564
  };
6558
6565
  v.isReactWarning = !0, Object.defineProperty(h, "ref", {
6559
6566
  get: v,
@@ -6561,13 +6568,13 @@ function pc() {
6561
6568
  });
6562
6569
  }
6563
6570
  }
6564
- var ys = function(h, g, v, O, P, M, C) {
6571
+ var ys = function(h, T, v, O, P, M, C) {
6565
6572
  var k = {
6566
6573
  // This tag allows us to uniquely identify this as a React Element
6567
6574
  $$typeof: n,
6568
6575
  // Built-in properties that belong on the element
6569
6576
  type: h,
6570
- key: g,
6577
+ key: T,
6571
6578
  ref: v,
6572
6579
  props: C,
6573
6580
  // Record the component responsible for creating this element.
@@ -6590,12 +6597,12 @@ function pc() {
6590
6597
  value: P
6591
6598
  }), Object.freeze && (Object.freeze(k.props), Object.freeze(k)), k;
6592
6599
  };
6593
- function bs(h, g, v, O, P) {
6600
+ function bs(h, T, v, O, P) {
6594
6601
  {
6595
6602
  var M, C = {}, k = null, G = null;
6596
- v !== void 0 && (ur(v), k = "" + v), fs(g) && (ur(g.key), k = "" + g.key), ds(g) && (G = g.ref, ls(g, P));
6597
- for (M in g)
6598
- Ge.call(g, M) && !cs.hasOwnProperty(M) && (C[M] = g[M]);
6603
+ v !== void 0 && (ur(v), k = "" + v), fs(T) && (ur(T.key), k = "" + T.key), ds(T) && (G = T.ref, ls(T, P));
6604
+ for (M in T)
6605
+ Qe.call(T, M) && !cs.hasOwnProperty(M) && (C[M] = T[M]);
6599
6606
  if (h && h.defaultProps) {
6600
6607
  var D = h.defaultProps;
6601
6608
  for (M in D)
@@ -6608,10 +6615,10 @@ function pc() {
6608
6615
  return ys(h, k, G, P, O, cr.current, C);
6609
6616
  }
6610
6617
  }
6611
- var Vt = w.ReactCurrentOwner, lr = w.ReactDebugCurrentFrame;
6612
- function Ie(h) {
6618
+ var Vt = g.ReactCurrentOwner, lr = g.ReactDebugCurrentFrame;
6619
+ function Me(h) {
6613
6620
  if (h) {
6614
- var g = h._owner, v = bt(h.type, h._source, g ? g.type : null);
6621
+ var T = h._owner, v = bt(h.type, h._source, T ? T.type : null);
6615
6622
  lr.setExtraStackFrame(v);
6616
6623
  } else
6617
6624
  lr.setExtraStackFrame(null);
@@ -6639,87 +6646,87 @@ Check the render method of \`` + h + "`.";
6639
6646
  var pr = {};
6640
6647
  function gs(h) {
6641
6648
  {
6642
- var g = hr();
6643
- if (!g) {
6649
+ var T = hr();
6650
+ if (!T) {
6644
6651
  var v = typeof h == "string" ? h : h.displayName || h.name;
6645
- v && (g = `
6652
+ v && (T = `
6646
6653
 
6647
6654
  Check the top-level render call using <` + v + ">.");
6648
6655
  }
6649
- return g;
6656
+ return T;
6650
6657
  }
6651
6658
  }
6652
- function yr(h, g) {
6659
+ function yr(h, T) {
6653
6660
  {
6654
6661
  if (!h._store || h._store.validated || h.key != null)
6655
6662
  return;
6656
6663
  h._store.validated = !0;
6657
- var v = gs(g);
6664
+ var v = gs(T);
6658
6665
  if (pr[v])
6659
6666
  return;
6660
6667
  pr[v] = !0;
6661
6668
  var O = "";
6662
- h && h._owner && h._owner !== Vt.current && (O = " It was passed a child from " + ce(h._owner.type) + "."), Ie(h), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', v, O), Ie(null);
6669
+ h && h._owner && h._owner !== Vt.current && (O = " It was passed a child from " + ce(h._owner.type) + "."), Me(h), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', v, O), Me(null);
6663
6670
  }
6664
6671
  }
6665
- function br(h, g) {
6672
+ function br(h, T) {
6666
6673
  {
6667
6674
  if (typeof h != "object")
6668
6675
  return;
6669
6676
  if (zt(h))
6670
6677
  for (var v = 0; v < h.length; v++) {
6671
6678
  var O = h[v];
6672
- Gt(O) && yr(O, g);
6679
+ Gt(O) && yr(O, T);
6673
6680
  }
6674
6681
  else if (Gt(h))
6675
6682
  h._store && (h._store.validated = !0);
6676
6683
  else if (h) {
6677
- var P = T(h);
6684
+ var P = w(h);
6678
6685
  if (typeof P == "function" && P !== h.entries)
6679
6686
  for (var M = P.call(h), C; !(C = M.next()).done; )
6680
- Gt(C.value) && yr(C.value, g);
6687
+ Gt(C.value) && yr(C.value, T);
6681
6688
  }
6682
6689
  }
6683
6690
  }
6684
- function ws(h) {
6691
+ function Ts(h) {
6685
6692
  {
6686
- var g = h.type;
6687
- if (g == null || typeof g == "string")
6693
+ var T = h.type;
6694
+ if (T == null || typeof T == "string")
6688
6695
  return;
6689
6696
  var v;
6690
- if (typeof g == "function")
6691
- v = g.propTypes;
6692
- else if (typeof g == "object" && (g.$$typeof === d || // Note: Memo only checks outer props here.
6697
+ if (typeof T == "function")
6698
+ v = T.propTypes;
6699
+ else if (typeof T == "object" && (T.$$typeof === d || // Note: Memo only checks outer props here.
6693
6700
  // Inner props are checked in the reconciler.
6694
- g.$$typeof === l))
6695
- v = g.propTypes;
6701
+ T.$$typeof === l))
6702
+ v = T.propTypes;
6696
6703
  else
6697
6704
  return;
6698
6705
  if (v) {
6699
- var O = ce(g);
6706
+ var O = ce(T);
6700
6707
  ss(v, h.props, "prop", O, h);
6701
- } else if (g.PropTypes !== void 0 && !Bt) {
6708
+ } else if (T.PropTypes !== void 0 && !Bt) {
6702
6709
  Bt = !0;
6703
- var P = ce(g);
6710
+ var P = ce(T);
6704
6711
  m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", P || "Unknown");
6705
6712
  }
6706
- typeof g.getDefaultProps == "function" && !g.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
6713
+ typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
6707
6714
  }
6708
6715
  }
6709
- function Ts(h) {
6716
+ function ws(h) {
6710
6717
  {
6711
- for (var g = Object.keys(h.props), v = 0; v < g.length; v++) {
6712
- var O = g[v];
6718
+ for (var T = Object.keys(h.props), v = 0; v < T.length; v++) {
6719
+ var O = T[v];
6713
6720
  if (O !== "children" && O !== "key") {
6714
- Ie(h), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", O), Ie(null);
6721
+ Me(h), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", O), Me(null);
6715
6722
  break;
6716
6723
  }
6717
6724
  }
6718
- h.ref !== null && (Ie(h), m("Invalid attribute `ref` supplied to `React.Fragment`."), Ie(null));
6725
+ h.ref !== null && (Me(h), m("Invalid attribute `ref` supplied to `React.Fragment`."), Me(null));
6719
6726
  }
6720
6727
  }
6721
6728
  var _r = {};
6722
- function gr(h, g, v, O, P, M) {
6729
+ function gr(h, T, v, O, P, M) {
6723
6730
  {
6724
6731
  var C = Ft(h);
6725
6732
  if (!C) {
@@ -6730,24 +6737,24 @@ Check the top-level render call using <` + v + ">.");
6730
6737
  var D;
6731
6738
  h === null ? D = "null" : zt(h) ? D = "array" : h !== void 0 && h.$$typeof === n ? (D = "<" + (ce(h.type) || "Unknown") + " />", k = " Did you accidentally export a JSX literal instead of a component?") : D = typeof h, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", D, k);
6732
6739
  }
6733
- var L = bs(h, g, v, P, M);
6740
+ var L = bs(h, T, v, P, M);
6734
6741
  if (L == null)
6735
6742
  return L;
6736
6743
  if (C) {
6737
- var re = g.children;
6744
+ var re = T.children;
6738
6745
  if (re !== void 0)
6739
6746
  if (O)
6740
6747
  if (zt(re)) {
6741
- for (var Me = 0; Me < re.length; Me++)
6742
- br(re[Me], h);
6748
+ for (var Re = 0; Re < re.length; Re++)
6749
+ br(re[Re], h);
6743
6750
  Object.freeze && Object.freeze(re);
6744
6751
  } else
6745
6752
  m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
6746
6753
  else
6747
6754
  br(re, h);
6748
6755
  }
6749
- if (Ge.call(g, "key")) {
6750
- var ve = ce(h), Y = Object.keys(g).filter(function(As) {
6756
+ if (Qe.call(T, "key")) {
6757
+ var ve = ce(h), Y = Object.keys(T).filter(function(As) {
6751
6758
  return As !== "key";
6752
6759
  }), Qt = Y.length > 0 ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}";
6753
6760
  if (!_r[ve + Qt]) {
@@ -6760,23 +6767,23 @@ React keys must be passed directly to JSX without using spread:
6760
6767
  <%s key={someKey} {...props} />`, Qt, ve, Es, ve), _r[ve + Qt] = !0;
6761
6768
  }
6762
6769
  }
6763
- return h === i ? Ts(L) : ws(L), L;
6770
+ return h === i ? ws(L) : Ts(L), L;
6764
6771
  }
6765
6772
  }
6766
- function ms(h, g, v) {
6767
- return gr(h, g, v, !0);
6773
+ function ms(h, T, v) {
6774
+ return gr(h, T, v, !0);
6768
6775
  }
6769
- function vs(h, g, v) {
6770
- return gr(h, g, v, !1);
6776
+ function vs(h, T, v) {
6777
+ return gr(h, T, v, !1);
6771
6778
  }
6772
6779
  var Ss = vs, Os = ms;
6773
- Ye.Fragment = i, Ye.jsx = Ss, Ye.jsxs = Os;
6774
- }(), Ye;
6780
+ Je.Fragment = i, Je.jsx = Ss, Je.jsxs = Os;
6781
+ }(), Je;
6775
6782
  }
6776
- var yc = {};
6777
- yc.NODE_ENV === "production" ? Sn.exports = hc() : Sn.exports = pc();
6783
+ var bc = {};
6784
+ bc.NODE_ENV === "production" ? Sn.exports = pc() : Sn.exports = yc();
6778
6785
  var z = Sn.exports;
6779
- const bc = {
6786
+ const _c = {
6780
6787
  isLoading: !0,
6781
6788
  data: void 0,
6782
6789
  pageInfo: void 0,
@@ -6785,9 +6792,9 @@ const bc = {
6785
6792
  function ri(t) {
6786
6793
  return Object.assign({ isLoading: !t, data: void 0, pageInfo: void 0, error: void 0 }, t || {});
6787
6794
  }
6788
- function _c(t, e, n) {
6795
+ function gc(t, e, n) {
6789
6796
  e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
6790
- const r = e ? uc(e) : null, i = V(r), s = at(ri(t._reactor.getPreviousResult(r))), o = ge(
6797
+ const r = e ? cc(e) : null, i = V(r), s = ut(ri(t._reactor.getPreviousResult(r))), o = ge(
6791
6798
  (u) => (s.current = ri(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (c) => {
6792
6799
  s.current = Object.assign({ isLoading: !c, data: void 0, pageInfo: void 0, error: void 0 }, c), u();
6793
6800
  }) : () => {
@@ -6795,10 +6802,10 @@ function _c(t, e, n) {
6795
6802
  // Build a new subscribe function if the query changes
6796
6803
  [i]
6797
6804
  );
6798
- return { state: nn(o, () => s.current, () => bc), query: r };
6805
+ return { state: nn(o, () => s.current, () => _c), query: r };
6799
6806
  }
6800
- function gc() {
6801
- const t = at(null);
6807
+ function Tc() {
6808
+ const t = ut(null);
6802
6809
  je(() => {
6803
6810
  n();
6804
6811
  }, []);
@@ -6811,13 +6818,13 @@ function gc() {
6811
6818
  return { set: e, clear: n };
6812
6819
  }
6813
6820
  const wc = 1e3;
6814
- function Tc(t, e, n) {
6815
- const r = at(n);
6821
+ function mc(t, e, n) {
6822
+ const r = ut(n);
6816
6823
  r.current = n, je(() => t.core._reactor.subscribeTopic(t.id, e, (s, o) => {
6817
6824
  r.current(s, o);
6818
6825
  }), [t.id, e]);
6819
6826
  }
6820
- function mc(t, e) {
6827
+ function vc(t, e) {
6821
6828
  return je(() => t.core._reactor.joinRoom(t.id), [t.id]), ge((r) => {
6822
6829
  t.core._reactor.publishTopic({
6823
6830
  roomType: t.type,
@@ -6827,7 +6834,7 @@ function mc(t, e) {
6827
6834
  });
6828
6835
  }, [t.id, e]);
6829
6836
  }
6830
- function vc(t, e = {}) {
6837
+ function Sc(t, e = {}) {
6831
6838
  var n, r;
6832
6839
  const [i, s] = di(() => {
6833
6840
  var u;
@@ -6844,11 +6851,11 @@ function vc(t, e = {}) {
6844
6851
  }, [t.type, t.id]);
6845
6852
  return rn(() => Object.assign(Object.assign({}, i), { publishPresence: o }), [i, o]);
6846
6853
  }
6847
- function Sc(t, e, n) {
6854
+ function Oc(t, e, n) {
6848
6855
  je(() => t.core._reactor.joinRoom(t.id, e), [t.id]), je(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
6849
6856
  }
6850
- function Oc(t, e, n = {}) {
6851
- const r = gc(), i = Oe.usePresence(t, {
6857
+ function Ec(t, e, n = {}) {
6858
+ const r = Tc(), i = Oe.usePresence(t, {
6852
6859
  keys: [e]
6853
6860
  }), s = rn(() => {
6854
6861
  var c;
@@ -6876,20 +6883,20 @@ function Oc(t, e, n = {}) {
6876
6883
  };
6877
6884
  }
6878
6885
  const Oe = {
6879
- useTopicEffect: Tc,
6880
- usePublishTopic: mc,
6881
- usePresence: vc,
6882
- useSyncPresence: Sc,
6883
- useTypingIndicator: Oc
6886
+ useTopicEffect: mc,
6887
+ usePublishTopic: vc,
6888
+ usePresence: Sc,
6889
+ useSyncPresence: Oc,
6890
+ useTypingIndicator: Ec
6884
6891
  };
6885
- class Ec {
6892
+ class Ac {
6886
6893
  constructor(e, n, r) {
6887
6894
  this.useTopicEffect = (i, s) => {
6888
6895
  Oe.useTopicEffect(this, i, s);
6889
6896
  }, this.usePublishTopic = (i) => Oe.usePublishTopic(this, i), this.usePresence = (i = {}) => Oe.usePresence(this, i), this.useSyncPresence = (i, s) => Oe.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => Oe.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
6890
6897
  }
6891
6898
  }
6892
- var Ac = function(t, e, n, r) {
6899
+ var kc = function(t, e, n, r) {
6893
6900
  function i(s) {
6894
6901
  return s instanceof n ? s : new n(function(o) {
6895
6902
  o(s);
@@ -6916,33 +6923,33 @@ var Ac = function(t, e, n, r) {
6916
6923
  d((r = r.apply(t, e || [])).next());
6917
6924
  });
6918
6925
  };
6919
- const kc = {
6926
+ const jc = {
6920
6927
  isLoading: !0,
6921
6928
  user: void 0,
6922
6929
  error: void 0
6923
6930
  };
6924
- class jc {
6931
+ class Cc {
6925
6932
  constructor(e, n) {
6926
6933
  this.tx = Vn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
6927
6934
  const [i, s] = di(null);
6928
6935
  return je(() => {
6929
- Ac(this, void 0, void 0, function* () {
6936
+ kc(this, void 0, void 0, function* () {
6930
6937
  const a = yield this.getLocalId(r);
6931
6938
  s(a);
6932
6939
  });
6933
6940
  }, [r]), i;
6934
- }, this.rooms = Oe, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => _c(this.core, r, i).state, this.useAuth = () => {
6935
- const r = at(this.core._reactor._currentUserCached), i = ge((o) => this.core.subscribeAuth((u) => {
6941
+ }, this.rooms = Oe, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => gc(this.core, r, i).state, this.useAuth = () => {
6942
+ const r = ut(this.core._reactor._currentUserCached), i = ge((o) => this.core.subscribeAuth((u) => {
6936
6943
  r.current = Object.assign({ isLoading: !1 }, u), o();
6937
6944
  }), []);
6938
- return nn(i, () => r.current, () => kc);
6945
+ return nn(i, () => r.current, () => jc);
6939
6946
  }, this.useUser = () => {
6940
6947
  const { user: r } = this.useAuth();
6941
6948
  if (!r)
6942
- throw new qe("useUser must be used within an auth-protected route");
6949
+ throw new We("useUser must be used within an auth-protected route");
6943
6950
  return r;
6944
6951
  }, this.useConnectionStatus = () => {
6945
- const r = at(this.core._reactor.status), i = ge((o) => this.core.subscribeConnectionStatus((u) => {
6952
+ const r = ut(this.core._reactor.status), i = ge((o) => this.core.subscribeConnectionStatus((u) => {
6946
6953
  u !== r.current && (r.current = u, o());
6947
6954
  }), []);
6948
6955
  return nn(
@@ -6957,7 +6964,7 @@ class jc {
6957
6964
  }, this.SignedOut = ({ children: r }) => {
6958
6965
  const i = this.useAuth();
6959
6966
  return i.isLoading || i.error || i.user ? null : z.jsx(z.Fragment, { children: r });
6960
- }, this.core = fc(
6967
+ }, this.core = lc(
6961
6968
  e,
6962
6969
  // @ts-expect-error because TS can't resolve subclass statics
6963
6970
  this.constructor.Storage,
@@ -6981,7 +6988,7 @@ class jc {
6981
6988
  * const { peers } = db.rooms.usePresence(room);
6982
6989
  */
6983
6990
  room(e = "_defaultRoomType", n = "_defaultRoomId") {
6984
- return new Ec(this.core, e, n);
6991
+ return new Ac(this.core, e, n);
6985
6992
  }
6986
6993
  /**
6987
6994
  * One time query for the logged in state. This is useful
@@ -7004,7 +7011,7 @@ class ii extends Error {
7004
7011
  }
7005
7012
  function tn(t) {
7006
7013
  }
7007
- function Cc(t) {
7014
+ function Pc(t) {
7008
7015
  if (typeof t == "function")
7009
7016
  throw new TypeError(
7010
7017
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
@@ -7012,10 +7019,10 @@ function Cc(t) {
7012
7019
  const { onEvent: e = tn, onError: n = tn, onRetry: r = tn, onComment: i } = t;
7013
7020
  let s = "", o = !0, a, u = "", d = "";
7014
7021
  function c(b) {
7015
- const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [T, w] = Pc(`${s}${_}`);
7016
- for (const m of T)
7022
+ const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, g] = Ic(`${s}${_}`);
7023
+ for (const m of w)
7017
7024
  f(m);
7018
- s = w, o = !1;
7025
+ s = g, o = !1;
7019
7026
  }
7020
7027
  function f(b) {
7021
7028
  if (b === "") {
@@ -7028,13 +7035,13 @@ function Cc(t) {
7028
7035
  }
7029
7036
  const _ = b.indexOf(":");
7030
7037
  if (_ !== -1) {
7031
- const T = b.slice(0, _), w = b[_ + 1] === " " ? 2 : 1, m = b.slice(_ + w);
7032
- l(T, m, b);
7038
+ const w = b.slice(0, _), g = b[_ + 1] === " " ? 2 : 1, m = b.slice(_ + g);
7039
+ l(w, m, b);
7033
7040
  return;
7034
7041
  }
7035
7042
  l(b, "", b);
7036
7043
  }
7037
- function l(b, _, T) {
7044
+ function l(b, _, w) {
7038
7045
  switch (b) {
7039
7046
  case "event":
7040
7047
  d = _;
@@ -7051,7 +7058,7 @@ function Cc(t) {
7051
7058
  new ii(`Invalid \`retry\` value: "${_}"`, {
7052
7059
  type: "invalid-retry",
7053
7060
  value: _,
7054
- line: T
7061
+ line: w
7055
7062
  })
7056
7063
  );
7057
7064
  break;
@@ -7059,7 +7066,7 @@ function Cc(t) {
7059
7066
  n(
7060
7067
  new ii(
7061
7068
  `Unknown field "${b.length > 20 ? `${b.slice(0, 20)}…` : b}"`,
7062
- { type: "unknown-field", field: b, value: _, line: T }
7069
+ { type: "unknown-field", field: b, value: _, line: w }
7063
7070
  )
7064
7071
  );
7065
7072
  break;
@@ -7080,7 +7087,7 @@ function Cc(t) {
7080
7087
  }
7081
7088
  return { feed: c, reset: y };
7082
7089
  }
7083
- function Pc(t) {
7090
+ function Ic(t) {
7084
7091
  const e = [];
7085
7092
  let n = "", r = 0;
7086
7093
  for (; r < t.length; ) {
@@ -7140,7 +7147,7 @@ class si extends Event {
7140
7147
  return e(oi(this), n);
7141
7148
  }
7142
7149
  }
7143
- function Ic(t) {
7150
+ function Mc(t) {
7144
7151
  const e = globalThis.DOMException;
7145
7152
  return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
7146
7153
  }
@@ -7159,69 +7166,69 @@ function oi(t) {
7159
7166
  }
7160
7167
  var Xi = (t) => {
7161
7168
  throw TypeError(t);
7162
- }, Qn = (t, e, n) => e.has(t) || Xi("Cannot " + n), A = (t, e, n) => (Qn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), N = (t, e, n) => e.has(t) ? Xi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Qn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (Qn(t, e, "access private method"), n), J, Ee, xe, At, Rt, st, Ue, ot, _e, $e, Fe, De, et, se, En, An, kn, ai, jn, Cn, tt, Pn, In;
7169
+ }, Qn = (t, e, n) => e.has(t) || Xi("Cannot " + n), A = (t, e, n) => (Qn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), N = (t, e, n) => e.has(t) ? Xi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Qn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (Qn(t, e, "access private method"), n), J, Ee, $e, At, Rt, ot, Le, at, _e, De, Ne, Ue, tt, se, En, An, kn, ai, jn, Cn, nt, Pn, In;
7163
7170
  class kt extends EventTarget {
7164
7171
  constructor(e, n) {
7165
7172
  var r, i;
7166
- super(), N(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, N(this, J), N(this, Ee), N(this, xe), N(this, At), N(this, Rt), N(this, st), N(this, Ue), N(this, ot, null), N(this, _e), N(this, $e), N(this, Fe, null), N(this, De, null), N(this, et, null), N(this, An, async (s) => {
7173
+ super(), N(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, N(this, J), N(this, Ee), N(this, $e), N(this, At), N(this, Rt), N(this, ot), N(this, Le), N(this, at, null), N(this, _e), N(this, De), N(this, Ne, null), N(this, Ue, null), N(this, tt, null), N(this, An, async (s) => {
7167
7174
  var o;
7168
- A(this, $e).reset();
7175
+ A(this, De).reset();
7169
7176
  const { body: a, redirected: u, status: d, headers: c } = s;
7170
7177
  if (d === 204) {
7171
- he(this, se, tt).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
7178
+ he(this, se, nt).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
7172
7179
  return;
7173
7180
  }
7174
- if (u ? $(this, xe, new URL(s.url)) : $(this, xe, void 0), d !== 200) {
7175
- he(this, se, tt).call(this, `Non-200 status code (${d})`, d);
7181
+ if (u ? $(this, $e, new URL(s.url)) : $(this, $e, void 0), d !== 200) {
7182
+ he(this, se, nt).call(this, `Non-200 status code (${d})`, d);
7176
7183
  return;
7177
7184
  }
7178
7185
  if (!(c.get("content-type") || "").startsWith("text/event-stream")) {
7179
- he(this, se, tt).call(this, 'Invalid content type, expected "text/event-stream"', d);
7186
+ he(this, se, nt).call(this, 'Invalid content type, expected "text/event-stream"', d);
7180
7187
  return;
7181
7188
  }
7182
7189
  if (A(this, J) === this.CLOSED)
7183
7190
  return;
7184
7191
  $(this, J, this.OPEN);
7185
7192
  const f = new Event("open");
7186
- if ((o = A(this, et)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
7187
- he(this, se, tt).call(this, "Invalid response body, expected a web ReadableStream", d), this.close();
7193
+ if ((o = A(this, tt)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
7194
+ he(this, se, nt).call(this, "Invalid response body, expected a web ReadableStream", d), this.close();
7188
7195
  return;
7189
7196
  }
7190
7197
  const l = new TextDecoder(), p = a.getReader();
7191
7198
  let y = !0;
7192
7199
  do {
7193
7200
  const { done: b, value: _ } = await p.read();
7194
- _ && A(this, $e).feed(l.decode(_, { stream: !b })), b && (y = !1, A(this, $e).reset(), he(this, se, Pn).call(this));
7201
+ _ && A(this, De).feed(l.decode(_, { stream: !b })), b && (y = !1, A(this, De).reset(), he(this, se, Pn).call(this));
7195
7202
  } while (y);
7196
7203
  }), N(this, kn, (s) => {
7197
7204
  $(this, _e, void 0), !(s.name === "AbortError" || s.type === "aborted") && he(this, se, Pn).call(this, On(s));
7198
7205
  }), N(this, jn, (s) => {
7199
- typeof s.id == "string" && $(this, ot, s.id);
7206
+ typeof s.id == "string" && $(this, at, s.id);
7200
7207
  const o = new MessageEvent(s.event || "message", {
7201
7208
  data: s.data,
7202
- origin: A(this, xe) ? A(this, xe).origin : A(this, Ee).origin,
7209
+ origin: A(this, $e) ? A(this, $e).origin : A(this, Ee).origin,
7203
7210
  lastEventId: s.id || ""
7204
7211
  });
7205
- A(this, De) && (!s.event || s.event === "message") && A(this, De).call(this, o), this.dispatchEvent(o);
7212
+ A(this, Ue) && (!s.event || s.event === "message") && A(this, Ue).call(this, o), this.dispatchEvent(o);
7206
7213
  }), N(this, Cn, (s) => {
7207
- $(this, st, s);
7214
+ $(this, ot, s);
7208
7215
  }), N(this, In, () => {
7209
- $(this, Ue, void 0), A(this, J) === this.CONNECTING && he(this, se, En).call(this);
7216
+ $(this, Le, void 0), A(this, J) === this.CONNECTING && he(this, se, En).call(this);
7210
7217
  });
7211
7218
  try {
7212
7219
  if (e instanceof URL)
7213
7220
  $(this, Ee, e);
7214
7221
  else if (typeof e == "string")
7215
- $(this, Ee, new URL(e, Mc()));
7222
+ $(this, Ee, new URL(e, Rc()));
7216
7223
  else
7217
7224
  throw new Error("Invalid URL");
7218
7225
  } catch {
7219
- throw Ic("An invalid or illegal string was specified");
7226
+ throw Mc("An invalid or illegal string was specified");
7220
7227
  }
7221
- $(this, $e, Cc({
7228
+ $(this, De, Pc({
7222
7229
  onEvent: A(this, jn),
7223
7230
  onRetry: A(this, Cn)
7224
- })), $(this, J, this.CONNECTING), $(this, st, 3e3), $(this, Rt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, At, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), he(this, se, En).call(this);
7231
+ })), $(this, J, this.CONNECTING), $(this, ot, 3e3), $(this, Rt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, At, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), he(this, se, En).call(this);
7225
7232
  }
7226
7233
  /**
7227
7234
  * Returns the state of this EventSource object's connection. It can have the values described below.
@@ -7256,24 +7263,24 @@ class kt extends EventTarget {
7256
7263
  }
7257
7264
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
7258
7265
  get onerror() {
7259
- return A(this, Fe);
7266
+ return A(this, Ne);
7260
7267
  }
7261
7268
  set onerror(e) {
7262
- $(this, Fe, e);
7269
+ $(this, Ne, e);
7263
7270
  }
7264
7271
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
7265
7272
  get onmessage() {
7266
- return A(this, De);
7273
+ return A(this, Ue);
7267
7274
  }
7268
7275
  set onmessage(e) {
7269
- $(this, De, e);
7276
+ $(this, Ue, e);
7270
7277
  }
7271
7278
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
7272
7279
  get onopen() {
7273
- return A(this, et);
7280
+ return A(this, tt);
7274
7281
  }
7275
7282
  set onopen(e) {
7276
- $(this, et, e);
7283
+ $(this, tt, e);
7277
7284
  }
7278
7285
  addEventListener(e, n, r) {
7279
7286
  const i = n;
@@ -7291,10 +7298,10 @@ class kt extends EventTarget {
7291
7298
  * @public
7292
7299
  */
7293
7300
  close() {
7294
- A(this, Ue) && clearTimeout(A(this, Ue)), A(this, J) !== this.CLOSED && (A(this, _e) && A(this, _e).abort(), $(this, J, this.CLOSED), $(this, _e, void 0));
7301
+ A(this, Le) && clearTimeout(A(this, Le)), A(this, J) !== this.CLOSED && (A(this, _e) && A(this, _e).abort(), $(this, J, this.CLOSED), $(this, _e, void 0));
7295
7302
  }
7296
7303
  }
7297
- J = /* @__PURE__ */ new WeakMap(), Ee = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap(), Rt = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), Ue = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap(), _e = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), Fe = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), et = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakSet(), /**
7304
+ J = /* @__PURE__ */ new WeakMap(), Ee = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap(), Rt = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap(), Le = /* @__PURE__ */ new WeakMap(), at = /* @__PURE__ */ new WeakMap(), _e = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), Ne = /* @__PURE__ */ new WeakMap(), Ue = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakSet(), /**
7298
7305
  * Connect to the given URL and start receiving events
7299
7306
  *
7300
7307
  * @internal
@@ -7314,7 +7321,7 @@ ai = function() {
7314
7321
  // [spec] …will have their mode set to "cors"…
7315
7322
  mode: "cors",
7316
7323
  redirect: "follow",
7317
- headers: { Accept: "text/event-stream", ...A(this, ot) ? { "Last-Event-ID": A(this, ot) } : void 0 },
7324
+ headers: { Accept: "text/event-stream", ...A(this, at) ? { "Last-Event-ID": A(this, at) } : void 0 },
7318
7325
  cache: "no-store",
7319
7326
  signal: (t = A(this, _e)) == null ? void 0 : t.signal
7320
7327
  };
@@ -7326,11 +7333,11 @@ ai = function() {
7326
7333
  * @param code - The HTTP status code, if available
7327
7334
  * @internal
7328
7335
  */
7329
- tt = function(t, e) {
7336
+ nt = function(t, e) {
7330
7337
  var n;
7331
7338
  A(this, J) !== this.CLOSED && $(this, J, this.CLOSED);
7332
7339
  const r = new si("error", { code: e, message: t });
7333
- (n = A(this, Fe)) == null || n.call(this, r), this.dispatchEvent(r);
7340
+ (n = A(this, Ne)) == null || n.call(this, r), this.dispatchEvent(r);
7334
7341
  }, /**
7335
7342
  * Schedules a reconnection attempt against the EventSource endpoint.
7336
7343
  *
@@ -7344,7 +7351,7 @@ Pn = function(t, e) {
7344
7351
  return;
7345
7352
  $(this, J, this.CONNECTING);
7346
7353
  const r = new si("error", { code: e, message: t });
7347
- (n = A(this, Fe)) == null || n.call(this, r), this.dispatchEvent(r), $(this, Ue, setTimeout(A(this, In), A(this, st)));
7354
+ (n = A(this, Ne)) == null || n.call(this, r), this.dispatchEvent(r), $(this, Le, setTimeout(A(this, In), A(this, ot)));
7348
7355
  }, In = /* @__PURE__ */ new WeakMap(), /**
7349
7356
  * ReadyState representing an EventSource currently trying to connect
7350
7357
  *
@@ -7361,15 +7368,15 @@ kt.OPEN = 1, /**
7361
7368
  * @public
7362
7369
  */
7363
7370
  kt.CLOSED = 2;
7364
- function Mc() {
7371
+ function Rc() {
7365
7372
  const t = "document" in globalThis ? globalThis.document : void 0;
7366
7373
  return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
7367
7374
  }
7368
- const Hn = class Hn extends jc {
7375
+ const Hn = class Hn extends Cc {
7369
7376
  };
7370
7377
  Hn.EventSourceImpl = kt;
7371
7378
  let Mn = Hn;
7372
- function Rc(t) {
7379
+ function xc(t) {
7373
7380
  return new Mn(
7374
7381
  t,
7375
7382
  {
@@ -7377,8 +7384,8 @@ function Rc(t) {
7377
7384
  }
7378
7385
  );
7379
7386
  }
7380
- const Kc = Rc;
7381
- function qc({
7387
+ const qc = xc;
7388
+ function Wc({
7382
7389
  as: t = "div",
7383
7390
  spaceId: e,
7384
7391
  room: n,
@@ -7393,39 +7400,39 @@ function qc({
7393
7400
  const c = e || `cursors-space-default--${String(n.type)}-${n.id}`, f = n.usePresence({
7394
7401
  keys: [c]
7395
7402
  }), l = n._core._reactor.getPresence(n.type, n.id);
7396
- function p(w, m) {
7397
- const E = m.clientX, S = m.clientY, I = (E - w.left) / w.width * 100, x = (S - w.top) / w.height * 100;
7403
+ function p(g, m) {
7404
+ const E = m.clientX, S = m.clientY, I = (E - g.left) / g.width * 100, R = (S - g.top) / g.height * 100;
7398
7405
  f.publishPresence({
7399
7406
  [c]: {
7400
7407
  x: E,
7401
7408
  y: S,
7402
7409
  xPercent: I,
7403
- yPercent: x,
7410
+ yPercent: R,
7404
7411
  color: s
7405
7412
  }
7406
7413
  });
7407
7414
  }
7408
- function y(w) {
7409
- u || w.stopPropagation();
7410
- const m = w.currentTarget.getBoundingClientRect();
7411
- p(m, w);
7415
+ function y(g) {
7416
+ u || g.stopPropagation();
7417
+ const m = g.currentTarget.getBoundingClientRect();
7418
+ p(m, g);
7412
7419
  }
7413
- function b(w) {
7420
+ function b(g) {
7414
7421
  f.publishPresence({
7415
7422
  [c]: void 0
7416
7423
  });
7417
7424
  }
7418
- function _(w) {
7419
- if (w.touches.length !== 1)
7425
+ function _(g) {
7426
+ if (g.touches.length !== 1)
7420
7427
  return;
7421
- const m = w.touches[0];
7428
+ const m = g.touches[0];
7422
7429
  if (m.target instanceof Element) {
7423
- u || w.stopPropagation();
7430
+ u || g.stopPropagation();
7424
7431
  const E = m.target.getBoundingClientRect();
7425
7432
  p(E, m);
7426
7433
  }
7427
7434
  }
7428
- function T(w) {
7435
+ function w(g) {
7429
7436
  f.publishPresence({
7430
7437
  [c]: void 0
7431
7438
  });
@@ -7436,7 +7443,7 @@ function qc({
7436
7443
  onMouseMove: y,
7437
7444
  onMouseOut: b,
7438
7445
  onTouchMove: _,
7439
- onTouchEnd: T,
7446
+ onTouchEnd: w,
7440
7447
  className: r,
7441
7448
  style: {
7442
7449
  position: "relative",
@@ -7450,10 +7457,10 @@ function qc({
7450
7457
  {
7451
7458
  style: {
7452
7459
  ...ui,
7453
- ...$c,
7454
- zIndex: d !== void 0 ? d : Dc
7460
+ ...Dc,
7461
+ zIndex: d !== void 0 ? d : Uc
7455
7462
  },
7456
- children: Object.entries(f.peers).map(([w, m]) => {
7463
+ children: Object.entries(f.peers).map(([g, m]) => {
7457
7464
  const E = m[c];
7458
7465
  return E ? /* @__PURE__ */ z.jsx(
7459
7466
  "div",
@@ -7466,10 +7473,10 @@ function qc({
7466
7473
  },
7467
7474
  children: a ? a({
7468
7475
  color: E.color,
7469
- presence: l.peers[w]
7470
- }) : /* @__PURE__ */ z.jsx(xc, { ...E })
7476
+ presence: l.peers[g]
7477
+ }) : /* @__PURE__ */ z.jsx($c, { ...E })
7471
7478
  },
7472
- w
7479
+ g
7473
7480
  ) : null;
7474
7481
  })
7475
7482
  },
@@ -7478,7 +7485,7 @@ function qc({
7478
7485
  ]
7479
7486
  );
7480
7487
  }
7481
- function xc({ color: t }) {
7488
+ function $c({ color: t }) {
7482
7489
  const n = t || "black";
7483
7490
  return /* @__PURE__ */ z.jsxs(
7484
7491
  "svg",
@@ -7531,21 +7538,21 @@ const ui = {
7531
7538
  left: 0,
7532
7539
  bottom: 0,
7533
7540
  right: 0
7534
- }, $c = {
7541
+ }, Dc = {
7535
7542
  overflow: "hidden",
7536
7543
  pointerEvents: "none",
7537
7544
  userSelect: "none"
7538
- }, Dc = 99999;
7545
+ }, Uc = 99999;
7539
7546
  export {
7540
- qc as Cursors,
7547
+ Wc as Cursors,
7541
7548
  Dt as InstantAPIError,
7542
- jc as InstantReactAbstractDatabase,
7549
+ Cc as InstantReactAbstractDatabase,
7543
7550
  Mn as InstantReactWebDatabase,
7544
7551
  Se as SyncTableCallbackEventType,
7545
- Nc as i,
7552
+ Kc as i,
7546
7553
  K as id,
7547
- Rc as init,
7548
- Kc as init_experimental,
7549
- Lc as lookup,
7550
- Fc as tx
7554
+ xc as init,
7555
+ qc as init_experimental,
7556
+ Fc as lookup,
7557
+ Nc as tx
7551
7558
  };