@instantdb/react 0.22.77 → 0.22.78

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 tn, useEffect as ke, useMemo as nn, useState as di, createElement as ks } from "react";
1
+ import ci, { useRef as at, useCallback as ge, useSyncExternalStore as tn, useEffect as je, useMemo as nn, useState as di, createElement as js } from "react";
2
2
  function z(t) {
3
3
  if (typeof t == "number")
4
4
  return (Math.abs(t * 2654435761) >>> 0).toString(16);
@@ -41,7 +41,7 @@ const U = {
41
41
  Remove: "remove",
42
42
  Replace: "replace",
43
43
  Add: "add"
44
- }, fi = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), js = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), vt = Symbol.iterator, ne = {
44
+ }, fi = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), ks = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), vt = Symbol.iterator, ne = {
45
45
  mutable: "mutable",
46
46
  immutable: "immutable"
47
47
  }, Mn = {};
@@ -69,15 +69,15 @@ function te(t) {
69
69
  var e;
70
70
  return (e = t.copy) !== null && e !== void 0 ? e : t.original;
71
71
  }
72
- function je(t) {
73
- return !!j(t);
72
+ function ke(t) {
73
+ return !!k(t);
74
74
  }
75
- function j(t) {
75
+ function k(t) {
76
76
  return typeof t != "object" ? null : t == null ? void 0 : t[fi];
77
77
  }
78
78
  function $n(t) {
79
79
  var e;
80
- const n = j(t);
80
+ const n = k(t);
81
81
  return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
82
82
  }
83
83
  function ae(t, e) {
@@ -88,7 +88,7 @@ function ae(t, e) {
88
88
  }
89
89
  function li(t, e = []) {
90
90
  if (Object.hasOwnProperty.call(t, "key")) {
91
- const n = t.parent.copy, r = j(be(n, t.key));
91
+ const n = t.parent.copy, r = k(be(n, t.key));
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;
@@ -116,7 +116,7 @@ function ct(t, e, n) {
116
116
  Ce(t) === 2 ? t.set(e, n) : t[e] = n;
117
117
  }
118
118
  function Ht(t, e) {
119
- const n = j(t);
119
+ const n = k(t);
120
120
  return (n ? te(n) : t)[e];
121
121
  }
122
122
  function ye(t, e) {
@@ -226,7 +226,7 @@ function Je(t) {
226
226
  return e;
227
227
  }
228
228
  function St(t) {
229
- return je(t) ? Je(t) : t;
229
+ return ke(t) ? Je(t) : t;
230
230
  }
231
231
  function fe(t) {
232
232
  var e;
@@ -252,7 +252,7 @@ function Me(t, e, n, r, i) {
252
252
  } else
253
253
  r.push(o);
254
254
  }
255
- if (Object.isFrozen(t) || je(t)) {
255
+ if (Object.isFrozen(t) || ke(t)) {
256
256
  r.pop(), i.pop();
257
257
  return;
258
258
  }
@@ -295,13 +295,13 @@ function Dn(t, e) {
295
295
  t.forEach((r, i) => e(i, r, t));
296
296
  }
297
297
  function pi(t, e, n) {
298
- if (je(t) || !ae(t, n) || e.has(t) || Object.isFrozen(t))
298
+ if (ke(t) || !ae(t, n) || e.has(t) || Object.isFrozen(t))
299
299
  return;
300
300
  const r = t instanceof Set, i = r ? /* @__PURE__ */ new Map() : void 0;
301
301
  if (e.add(t), Dn(t, (s, o) => {
302
302
  var a;
303
- if (je(o)) {
304
- const u = j(o);
303
+ if (ke(o)) {
304
+ const u = k(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
307
  ct(r ? i : t, s, d);
@@ -333,7 +333,7 @@ function on(t, e, n, r) {
333
333
  }
334
334
  }
335
335
  function Un(t, e, n, r) {
336
- const i = j(n);
336
+ const i = k(n);
337
337
  i && (i.callbacks || (i.callbacks = []), i.callbacks.push((s, o) => {
338
338
  var a;
339
339
  const u = t.type === 3 ? t.setMap : t.copy;
@@ -445,28 +445,28 @@ function ut(t, e, n, r) {
445
445
  return $s(t, e, n, r, i);
446
446
  }
447
447
  }
448
- const jt = (t, e, n = !1) => {
448
+ const kt = (t, e, n = !1) => {
449
449
  if (typeof t == "object" && t !== null && (!ae(t, e) || n))
450
450
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
451
451
  }, an = {
452
452
  get size() {
453
- return te(j(this)).size;
453
+ return te(k(this)).size;
454
454
  },
455
455
  has(t) {
456
- return te(j(this)).has(t);
456
+ return te(k(this)).has(t);
457
457
  },
458
458
  set(t, e) {
459
- const n = j(this), r = te(n);
459
+ const n = k(this), r = te(n);
460
460
  return (!r.has(t) || !ye(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), Un(n, t, e, ut)), this;
461
461
  },
462
462
  delete(t) {
463
463
  if (!this.has(t))
464
464
  return !1;
465
- const e = j(this);
465
+ const e = k(this);
466
466
  return Q(e), fe(e), e.original.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.copy.delete(t), !0;
467
467
  },
468
468
  clear() {
469
- const t = j(this);
469
+ const t = k(this);
470
470
  if (this.size) {
471
471
  Q(t), fe(t), t.assignedMap = /* @__PURE__ */ new Map();
472
472
  for (const [e] of t.original)
@@ -475,15 +475,15 @@ const jt = (t, e, n = !1) => {
475
475
  }
476
476
  },
477
477
  forEach(t, e) {
478
- const n = j(this);
478
+ const n = k(this);
479
479
  te(n).forEach((r, i) => {
480
480
  t.call(e, this.get(i), i, this);
481
481
  });
482
482
  },
483
483
  get(t) {
484
484
  var e, n;
485
- const r = j(this), i = te(r).get(t), s = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, i, ne)) === ne.mutable;
486
- if (r.options.strict && jt(i, r.options, s), s || r.finalized || !ae(i, r.options) || i !== r.original.get(t))
485
+ const r = k(this), i = te(r).get(t), s = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, i, ne)) === ne.mutable;
486
+ if (r.options.strict && kt(i, r.options, s), s || r.finalized || !ae(i, r.options) || i !== r.original.get(t))
487
487
  return i;
488
488
  const o = Mn.createDraft({
489
489
  original: i,
@@ -495,7 +495,7 @@ const jt = (t, e, n = !1) => {
495
495
  return Q(r), r.copy.set(t, o), o;
496
496
  },
497
497
  keys() {
498
- return te(j(this)).keys();
498
+ return te(k(this)).keys();
499
499
  },
500
500
  values() {
501
501
  const t = this.keys();
@@ -536,8 +536,8 @@ const jt = (t, e, n = !1) => {
536
536
  return s;
537
537
  const o = s.value;
538
538
  let a = t.setMap.get(o);
539
- const u = j(a), d = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, a, ne)) === ne.mutable;
540
- if (t.options.strict && jt(o, t.options, d), !d && !u && ae(o, t.options) && !t.finalized && t.original.has(o)) {
539
+ const u = k(a), d = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, a, ne)) === ne.mutable;
540
+ if (t.options.strict && kt(o, t.options, d), !d && !u && ae(o, t.options) && !t.finalized && t.original.has(o)) {
541
541
  const c = Mn.createDraft({
542
542
  original: o,
543
543
  parentDraft: t,
@@ -553,39 +553,39 @@ const jt = (t, e, n = !1) => {
553
553
  };
554
554
  }, Ct = {
555
555
  get size() {
556
- return j(this).setMap.size;
556
+ return k(this).setMap.size;
557
557
  },
558
558
  has(t) {
559
- const e = j(this);
559
+ const e = k(this);
560
560
  if (e.setMap.has(t))
561
561
  return !0;
562
562
  Q(e);
563
- const n = j(t);
563
+ const n = k(t);
564
564
  return !!(n && e.setMap.has(n.original));
565
565
  },
566
566
  add(t) {
567
- const e = j(this);
567
+ const e = k(this);
568
568
  return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Un(e, t, t, ut)), this;
569
569
  },
570
570
  delete(t) {
571
571
  if (!this.has(t))
572
572
  return !1;
573
- const e = j(this);
573
+ const e = k(this);
574
574
  Q(e), fe(e);
575
- const n = j(t);
575
+ const n = k(t);
576
576
  return n && e.setMap.has(n.original) ? (e.assignedMap.set(n.original, !1), e.setMap.delete(n.original)) : (!n && e.setMap.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.setMap.delete(t));
577
577
  },
578
578
  clear() {
579
579
  if (!this.size)
580
580
  return;
581
- const t = j(this);
581
+ const t = k(this);
582
582
  Q(t), fe(t);
583
583
  for (const e of t.original)
584
584
  t.assignedMap.set(e, !1);
585
585
  t.setMap.clear();
586
586
  },
587
587
  values() {
588
- const t = j(this);
588
+ const t = k(this);
589
589
  Q(t);
590
590
  const e = t.setMap.keys();
591
591
  return {
@@ -594,7 +594,7 @@ const jt = (t, e, n = !1) => {
594
594
  };
595
595
  },
596
596
  entries() {
597
- const t = j(this);
597
+ const t = k(this);
598
598
  Q(t);
599
599
  const e = t.setMap.keys();
600
600
  return {
@@ -652,7 +652,7 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
652
652
  if (t.options.mark) {
653
653
  const d = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, n);
654
654
  if (o = t.options.mark(d, ne), o === ne.mutable)
655
- return t.options.strict && jt(d, t.options, !0), d;
655
+ return t.options.strict && kt(d, t.options, !0), d;
656
656
  }
657
657
  const a = te(t);
658
658
  if (a instanceof Map && Ds.includes(e)) {
@@ -677,7 +677,7 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
677
677
  ) : void 0;
678
678
  }
679
679
  const u = a[e];
680
- if (t.options.strict && jt(u, t.options), t.finalized || !ae(u, t.options))
680
+ if (t.options.strict && kt(u, t.options), t.finalized || !ae(u, t.options))
681
681
  return u;
682
682
  if (u === Ht(t.original, e)) {
683
683
  if (Q(t), t.copy[e] = Ln({
@@ -687,7 +687,7 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
687
687
  finalities: t.finalities,
688
688
  options: t.options
689
689
  }), typeof o == "function") {
690
- const d = j(t.copy[e]);
690
+ const d = k(t.copy[e]);
691
691
  return Q(d), fe(d), d.copy;
692
692
  }
693
693
  return t.copy[e];
@@ -704,7 +704,7 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
704
704
  const s = gr(te(t), e);
705
705
  if (s != null && s.set)
706
706
  return s.set.call(t.proxy, n), !0;
707
- const o = Ht(te(t), e), a = j(o);
707
+ const o = Ht(te(t), e), a = k(o);
708
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, Un(t, e, n, ut)), !0);
709
709
  },
710
710
  has(t, e) {
@@ -755,9 +755,9 @@ function Ln(t) {
755
755
  const c = n;
756
756
  c.finalities.draft.push((f, l) => {
757
757
  var p, y;
758
- const b = j(u);
758
+ const b = k(u);
759
759
  let _ = c.type === 3 ? c.setMap : c.copy;
760
- const w = be(_, r), g = j(w);
760
+ const w = be(_, r), g = k(w);
761
761
  if (g) {
762
762
  let m = g.original;
763
763
  g.operated && (m = $n(w)), sn(g), on(g, 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, g.original)), ct(_, r, m);
@@ -767,7 +767,7 @@ function Ln(t) {
767
767
  });
768
768
  });
769
769
  } else {
770
- const c = j(u);
770
+ const c = k(u);
771
771
  c.finalities.draft.push((f, l) => {
772
772
  sn(c), on(c, ut, f, l);
773
773
  });
@@ -777,7 +777,7 @@ function Ln(t) {
777
777
  Mn.createDraft = Ln;
778
778
  function Ls(t, e, n, r, i) {
779
779
  var s;
780
- const o = j(t), a = (s = o == null ? void 0 : o.original) !== null && s !== void 0 ? s : t, u = !!e.length;
780
+ const o = k(t), a = (s = o == null ? void 0 : o.original) !== null && s !== void 0 ? s : t, u = !!e.length;
781
781
  if (o != null && o.operated)
782
782
  for (; o.finalities.draft.length > 0; )
783
783
  o.finalities.draft.pop()(n, r);
@@ -814,7 +814,7 @@ function Fs(t, e) {
814
814
  function un(t) {
815
815
  const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: i = !0 } = t;
816
816
  Dn(n, (s, o, a) => {
817
- const u = j(o);
817
+ const u = k(o);
818
818
  if (u && e && u.finalities === e.finalities) {
819
819
  t.isContainDraft = !0;
820
820
  const d = u.original;
@@ -828,7 +828,7 @@ function un(t) {
828
828
  }
829
829
  function _i(t) {
830
830
  var e;
831
- const n = j(t);
831
+ const n = k(t);
832
832
  if (!ae(t, n == null ? void 0 : n.options))
833
833
  return t;
834
834
  const r = Ce(t);
@@ -859,7 +859,7 @@ function _i(t) {
859
859
  return i;
860
860
  }
861
861
  function mr(t) {
862
- if (!je(t))
862
+ if (!ke(t))
863
863
  throw new Error(`current() is only used for Draft, parameter: ${t}`);
864
864
  return _i(t);
865
865
  }
@@ -874,7 +874,7 @@ const Ns = (t) => function e(n, r, i) {
874
874
  if (typeof r != "function" && (c = r), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
875
875
  throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
876
876
  c = Object.assign(Object.assign({}, t), c);
877
- const f = je(u) ? mr(u) : u, l = Array.isArray(c.mark) ? (S, I) => {
877
+ const f = ke(u) ? mr(u) : u, l = Array.isArray(c.mark) ? (S, I) => {
878
878
  for (const x of c.mark) {
879
879
  if (typeof x != "function")
880
880
  throw new Error(`Invalid mark: ${x}, 'mark' should be a function.`);
@@ -900,14 +900,14 @@ const Ns = (t) => function e(n, r, i) {
900
900
  try {
901
901
  m = d(w);
902
902
  } catch (S) {
903
- throw rn(j(w)), S;
903
+ throw rn(k(w)), S;
904
904
  }
905
905
  const E = (S) => {
906
- const I = j(w);
907
- if (!je(S)) {
906
+ const I = k(w);
907
+ if (!ke(S)) {
908
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
- const B = S == null ? void 0 : S[js];
910
+ const B = S == null ? void 0 : S[ks];
911
911
  if (B) {
912
912
  const Ve = B[0];
913
913
  return _.strict && typeof S == "object" && S !== null && un({
@@ -921,7 +921,7 @@ const Ns = (t) => function e(n, r, i) {
921
921
  }
922
922
  if (S === w || S === void 0)
923
923
  return g([]);
924
- const x = j(S);
924
+ const x = k(S);
925
925
  if (_ === x.options) {
926
926
  if (x.operated)
927
927
  throw new Error("Cannot return a modified child draft.");
@@ -930,7 +930,7 @@ const Ns = (t) => function e(n, r, i) {
930
930
  return g([S]);
931
931
  };
932
932
  return m instanceof Promise ? m.then(E, (S) => {
933
- throw rn(j(w)), S;
933
+ throw rn(k(w)), S;
934
934
  }) : E(m);
935
935
  }, Pt = Ns();
936
936
  Object.prototype.constructor.toString();
@@ -1455,7 +1455,7 @@ function Ai(t, e, n) {
1455
1455
  const a = We(t.ea, [r, i, s]);
1456
1456
  return a && (o = a[3]), o || Date.now() * 10 + uo++;
1457
1457
  }
1458
- function ki(t, e) {
1458
+ function ji(t, e) {
1459
1459
  var n;
1460
1460
  const r = dt(t, e);
1461
1461
  if (!r)
@@ -1519,7 +1519,7 @@ function dn(t, e) {
1519
1519
  (!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 && dn(t, [y, (p = w["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
1520
1520
  }), ((r = t.vae.get(a)) === null || r === void 0 ? void 0 : r.size) === 0 && oe(t.vae, [a]);
1521
1521
  }
1522
- function ji(t, e) {
1522
+ function ki(t, e) {
1523
1523
  const n = mi(t.attrs, e, t.useDateObjects);
1524
1524
  Object.keys(n).forEach((r) => {
1525
1525
  t[r] = n[r];
@@ -1535,17 +1535,17 @@ function lo(t, [e]) {
1535
1535
  if (!t.attrs[e])
1536
1536
  return;
1537
1537
  const n = Ci(t).filter(([r, i]) => i !== e);
1538
- delete t.attrs[e], qn(t), ji(t, n);
1538
+ delete t.attrs[e], qn(t), ki(t, n);
1539
1539
  }
1540
1540
  function ho(t, [e]) {
1541
1541
  const n = t.attrs[e.id];
1542
- n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), qn(t), ji(t, Ci(t)));
1542
+ n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), qn(t), ki(t, Ci(t)));
1543
1543
  }
1544
1544
  function po(t, e) {
1545
1545
  const [n, ...r] = e;
1546
1546
  switch (n) {
1547
1547
  case "add-triple":
1548
- ki(t, r);
1548
+ ji(t, r);
1549
1549
  break;
1550
1550
  case "deep-merge-triple":
1551
1551
  co(t, r);
@@ -1769,14 +1769,14 @@ function Ao(t, e, n) {
1769
1769
  return Mi(i, o, r);
1770
1770
  }, n);
1771
1771
  }
1772
- function ko(t, e, n) {
1772
+ function jo(t, e, n) {
1773
1773
  return Po(t, e, n).map((r) => Ao(e, r, n)).filter((r) => r);
1774
1774
  }
1775
- function jo(t, e, n) {
1776
- return e.or ? e.or.patterns.flatMap((r) => fn(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => fn(t, i, r), n) : n.flatMap((r) => ko(t, e, r));
1775
+ function ko(t, e, n) {
1776
+ return e.or ? e.or.patterns.flatMap((r) => fn(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => fn(t, i, r), n) : n.flatMap((r) => jo(t, e, r));
1777
1777
  }
1778
1778
  function fn(t, e, n = [{}]) {
1779
- return e.reduce((r, i) => jo(t, i, r), n);
1779
+ return e.reduce((r, i) => ko(t, i, r), n);
1780
1780
  }
1781
1781
  function Wn(t, e) {
1782
1782
  return Array.isArray(e) ? e.map((n) => Wn(t, n)) : mo(e) ? t[e] : e;
@@ -1818,7 +1818,7 @@ function Do(t, e, n) {
1818
1818
  throw new Error("Random bytes length must be >= 16");
1819
1819
  return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Mo(r);
1820
1820
  }
1821
- function kr(t) {
1821
+ function jr(t) {
1822
1822
  const e = t.replace(/-/g, ""), n = [];
1823
1823
  for (let r = 0; r < e.length; r += 2)
1824
1824
  n.push(parseInt(e.substring(r, r + 2), 16));
@@ -1834,7 +1834,7 @@ function Uo(t, e) {
1834
1834
  return 0;
1835
1835
  }
1836
1836
  function Lo(t, e) {
1837
- return Uo(kr(t), kr(e));
1837
+ return Uo(jr(t), jr(e));
1838
1838
  }
1839
1839
  function K() {
1840
1840
  return Do();
@@ -1870,7 +1870,7 @@ function Wo(t, e) {
1870
1870
  throw new Ne(`Could not find id attr for ${e}`);
1871
1871
  return n;
1872
1872
  }
1873
- function jr(t, e, n, r) {
1873
+ function kr(t, e, n, r) {
1874
1874
  return [zo(t, e, n, r)];
1875
1875
  }
1876
1876
  function zo(t, e, n, r) {
@@ -2069,7 +2069,7 @@ function xi(t, e, n, r, i) {
2069
2069
  }
2070
2070
  function ea(t, e, n, r) {
2071
2071
  const i = $t;
2072
- return r ? xi(i, t, e, n, r).concat(jr(i, t, e, n)) : jr(i, t, e, n);
2072
+ return r ? xi(i, t, e, n, r).concat(kr(i, t, e, n)) : kr(i, t, e, n);
2073
2073
  }
2074
2074
  function ta(t, e, n) {
2075
2075
  return [t(e, n), t("time", n)];
@@ -2470,10 +2470,10 @@ function Aa(t, e) {
2470
2470
  ];
2471
2471
  });
2472
2472
  }
2473
- function ka({ attrs: t }, [e, n]) {
2473
+ function ja({ attrs: t }, [e, n]) {
2474
2474
  return [["delete-entity", ee(t, e, n), e]];
2475
2475
  }
2476
- function ja(t, e) {
2476
+ function ka(t, e) {
2477
2477
  const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Fn(o), d = ee(r, i, s), c = Ni(t, [i, d, o, a]), f = Object.entries(u).map(([p, y]) => {
2478
2478
  const b = V(r, i, p);
2479
2479
  return [
@@ -2506,7 +2506,7 @@ function Ia(t, e) {
2506
2506
  const [n, ...r] = Pa(e);
2507
2507
  switch (n) {
2508
2508
  case "merge":
2509
- return ja(t, r);
2509
+ return ka(t, r);
2510
2510
  case "create":
2511
2511
  return Ea(t, r);
2512
2512
  case "update":
@@ -2516,7 +2516,7 @@ function Ia(t, e) {
2516
2516
  case "unlink":
2517
2517
  return Sa(t, r);
2518
2518
  case "delete":
2519
- return ka(t, r);
2519
+ return ja(t, r);
2520
2520
  case "ruleParams":
2521
2521
  return Ca(t, r);
2522
2522
  default:
@@ -2920,9 +2920,6 @@ class Tn {
2920
2920
  const s = i.path[0];
2921
2921
  s && typeof s == "string" && (this._pendingSaveKeys.add(s), this._loadedKeys.has(s) || this._loadKey(s));
2922
2922
  }
2923
- for (const i of Object.keys(n))
2924
- if (!n[i])
2925
- debugger;
2926
2923
  this.currentValue = n, this._enqueuePersist();
2927
2924
  for (const i of this._subs)
2928
2925
  i(this.currentValue);
@@ -3559,7 +3556,7 @@ function Nr(t) {
3559
3556
  }, e;
3560
3557
  }, {});
3561
3558
  }
3562
- const Bn = "v0.22.77";
3559
+ const Bn = "v0.22.78";
3563
3560
  function lu(t, e) {
3564
3561
  return {
3565
3562
  info: t ? (...n) => console.info(...n, e()) : () => {
@@ -4122,7 +4119,7 @@ function Yr(t, e) {
4122
4119
  for (const { action: n, triple: r } of e)
4123
4120
  switch (n) {
4124
4121
  case "added":
4125
- ki(t, r);
4122
+ ji(t, r);
4126
4123
  break;
4127
4124
  case "removed":
4128
4125
  Ei(t, r);
@@ -4157,14 +4154,14 @@ function Au(t, e) {
4157
4154
  function wt(t, e) {
4158
4155
  return { [t.table]: e.map((n) => n.entity) };
4159
4156
  }
4160
- function ku(t, e) {
4157
+ function ju(t, e) {
4161
4158
  var n;
4162
4159
  if (t.orderFieldType)
4163
4160
  return t.orderFieldType;
4164
4161
  const r = t.orderField === "serverCreatedAt" ? "number" : (n = Te(e([]), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
4165
4162
  return t.orderFieldType = r, r;
4166
4163
  }
4167
- function ju(t, e, n) {
4164
+ function ku(t, e, n) {
4168
4165
  const r = e;
4169
4166
  if (t.orderField === "serverCreatedAt") {
4170
4167
  n.sort(t.orderDirection === "asc" ? function(o, a) {
@@ -4426,8 +4423,8 @@ class Cu {
4426
4423
  const _ = [];
4427
4424
  for (const g of c.sort().reverse())
4428
4425
  _.push(p[g].entity), p.splice(g, 1);
4429
- const w = ku(a, this.createStore);
4430
- ju(a, w, p), this.notifyCbs(o, {
4426
+ const w = ju(a, this.createStore);
4427
+ ku(a, w, p), this.notifyCbs(o, {
4431
4428
  type: ve.SyncTransaction,
4432
4429
  data: wt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
4433
4430
  added: b,
@@ -6440,17 +6437,17 @@ function bc() {
6440
6437
  }
6441
6438
  } catch (Y) {
6442
6439
  if (Y && O && typeof Y.stack == "string") {
6443
- for (var k = Y.stack.split(`
6440
+ for (var j = Y.stack.split(`
6444
6441
  `), G = O.stack.split(`
6445
- `), D = k.length - 1, L = G.length - 1; D >= 1 && L >= 0 && k[D] !== G[L]; )
6442
+ `), D = j.length - 1, L = G.length - 1; D >= 1 && L >= 0 && j[D] !== G[L]; )
6446
6443
  L--;
6447
6444
  for (; D >= 1 && L >= 0; D--, L--)
6448
- if (k[D] !== G[L]) {
6445
+ if (j[D] !== G[L]) {
6449
6446
  if (D !== 1 || L !== 1)
6450
6447
  do
6451
- if (D--, L--, L < 0 || k[D] !== G[L]) {
6448
+ if (D--, L--, L < 0 || j[D] !== G[L]) {
6452
6449
  var re = `
6453
- ` + k[D].replace(" at new ", " at ");
6450
+ ` + j[D].replace(" at new ", " at ");
6454
6451
  return h.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", h.displayName)), typeof h == "function" && yt.set(h, re), re;
6455
6452
  }
6456
6453
  while (D >= 1 && L >= 0);
@@ -6512,17 +6509,17 @@ function bc() {
6512
6509
  var M = Function.call.bind(Ge);
6513
6510
  for (var C in h)
6514
6511
  if (M(h, C)) {
6515
- var k = void 0;
6512
+ var j = void 0;
6516
6513
  try {
6517
6514
  if (typeof h[C] != "function") {
6518
6515
  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`.");
6519
6516
  throw G.name = "Invariant Violation", G;
6520
6517
  }
6521
- k = h[C](T, C, O, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
6518
+ j = h[C](T, C, O, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
6522
6519
  } catch (D) {
6523
- k = D;
6520
+ j = D;
6524
6521
  }
6525
- k && !(k instanceof Error) && (_t(P), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", v, C, typeof k), _t(null)), k instanceof Error && !(k.message in ir) && (ir[k.message] = !0, _t(P), m("Failed %s type: %s", v, k.message), _t(null));
6522
+ j && !(j instanceof Error) && (_t(P), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", v, C, typeof j), _t(null)), j instanceof Error && !(j.message in ir) && (ir[j.message] = !0, _t(P), m("Failed %s type: %s", v, j.message), _t(null));
6526
6523
  }
6527
6524
  }
6528
6525
  }
@@ -6598,7 +6595,7 @@ function bc() {
6598
6595
  }
6599
6596
  }
6600
6597
  var ys = function(h, T, v, O, P, M, C) {
6601
- var k = {
6598
+ var j = {
6602
6599
  // This tag allows us to uniquely identify this as a React Element
6603
6600
  $$typeof: n,
6604
6601
  // Built-in properties that belong on the element
@@ -6609,27 +6606,27 @@ function bc() {
6609
6606
  // Record the component responsible for creating this element.
6610
6607
  _owner: M
6611
6608
  };
6612
- return k._store = {}, Object.defineProperty(k._store, "validated", {
6609
+ return j._store = {}, Object.defineProperty(j._store, "validated", {
6613
6610
  configurable: !1,
6614
6611
  enumerable: !1,
6615
6612
  writable: !0,
6616
6613
  value: !1
6617
- }), Object.defineProperty(k, "_self", {
6614
+ }), Object.defineProperty(j, "_self", {
6618
6615
  configurable: !1,
6619
6616
  enumerable: !1,
6620
6617
  writable: !1,
6621
6618
  value: O
6622
- }), Object.defineProperty(k, "_source", {
6619
+ }), Object.defineProperty(j, "_source", {
6623
6620
  configurable: !1,
6624
6621
  enumerable: !1,
6625
6622
  writable: !1,
6626
6623
  value: P
6627
- }), Object.freeze && (Object.freeze(k.props), Object.freeze(k)), k;
6624
+ }), Object.freeze && (Object.freeze(j.props), Object.freeze(j)), j;
6628
6625
  };
6629
6626
  function bs(h, T, v, O, P) {
6630
6627
  {
6631
- var M, C = {}, k = null, G = null;
6632
- v !== void 0 && (ar(v), k = "" + v), fs(T) && (ar(T.key), k = "" + T.key), ds(T) && (G = T.ref, ls(T, P));
6628
+ var M, C = {}, j = null, G = null;
6629
+ v !== void 0 && (ar(v), j = "" + v), fs(T) && (ar(T.key), j = "" + T.key), ds(T) && (G = T.ref, ls(T, P));
6633
6630
  for (M in T)
6634
6631
  Ge.call(T, M) && !cs.hasOwnProperty(M) && (C[M] = T[M]);
6635
6632
  if (h && h.defaultProps) {
@@ -6637,11 +6634,11 @@ function bc() {
6637
6634
  for (M in D)
6638
6635
  C[M] === void 0 && (C[M] = D[M]);
6639
6636
  }
6640
- if (k || G) {
6637
+ if (j || G) {
6641
6638
  var L = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
6642
- k && hs(C, L), G && ps(C, L);
6639
+ j && hs(C, L), G && ps(C, L);
6643
6640
  }
6644
- return ys(h, k, G, P, O, ur.current, C);
6641
+ return ys(h, j, G, P, O, ur.current, C);
6645
6642
  }
6646
6643
  }
6647
6644
  var Vt = g.ReactCurrentOwner, fr = g.ReactDebugCurrentFrame;
@@ -6759,12 +6756,12 @@ Check the top-level render call using <` + v + ">.");
6759
6756
  {
6760
6757
  var C = Ft(h);
6761
6758
  if (!C) {
6762
- var k = "";
6763
- (h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (k += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
6759
+ var j = "";
6760
+ (h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (j += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
6764
6761
  var G = _s();
6765
- G ? k += G : k += lr();
6762
+ G ? j += G : j += lr();
6766
6763
  var D;
6767
- 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);
6764
+ h === null ? D = "null" : zt(h) ? D = "array" : h !== void 0 && h.$$typeof === n ? (D = "<" + (ce(h.type) || "Unknown") + " />", j = " 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, j);
6768
6765
  }
6769
6766
  var L = bs(h, T, v, P, M);
6770
6767
  if (L == null)
@@ -6843,7 +6840,7 @@ function Tc(t, e, n) {
6843
6840
  }
6844
6841
  function wc() {
6845
6842
  const t = at(null);
6846
- ke(() => {
6843
+ je(() => {
6847
6844
  n();
6848
6845
  }, []);
6849
6846
  function e(r, i) {
@@ -6857,12 +6854,12 @@ function wc() {
6857
6854
  const mc = 1e3;
6858
6855
  function vc(t, e, n) {
6859
6856
  const r = at(n);
6860
- r.current = n, ke(() => t.core._reactor.subscribeTopic(t.id, e, (s, o) => {
6857
+ r.current = n, je(() => t.core._reactor.subscribeTopic(t.id, e, (s, o) => {
6861
6858
  r.current(s, o);
6862
6859
  }), [t.id, e]);
6863
6860
  }
6864
6861
  function Sc(t, e) {
6865
- return ke(() => t.core._reactor.joinRoom(t.id), [t.id]), ge((r) => {
6862
+ return je(() => t.core._reactor.joinRoom(t.id), [t.id]), ge((r) => {
6866
6863
  t.core._reactor.publishTopic({
6867
6864
  roomType: t.type,
6868
6865
  roomId: t.id,
@@ -6880,7 +6877,7 @@ function Oc(t, e = {}) {
6880
6877
  isLoading: !0
6881
6878
  };
6882
6879
  });
6883
- ke(() => t.core._reactor.subscribePresence(t.type, t.id, e, (d) => {
6880
+ je(() => t.core._reactor.subscribePresence(t.type, t.id, e, (d) => {
6884
6881
  s(d);
6885
6882
  }), [t.id, e.user, (n = e.peers) === null || n === void 0 ? void 0 : n.join(), (r = e.keys) === null || r === void 0 ? void 0 : r.join()]);
6886
6883
  const o = ge((u) => {
@@ -6889,7 +6886,7 @@ function Oc(t, e = {}) {
6889
6886
  return nn(() => Object.assign(Object.assign({}, i), { publishPresence: o }), [i, o]);
6890
6887
  }
6891
6888
  function Ec(t, e, n) {
6892
- ke(() => t.core._reactor.joinRoom(t.id, e), [t.id]), ke(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
6889
+ 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)]);
6893
6890
  }
6894
6891
  function Ac(t, e, n = {}) {
6895
6892
  const r = wc(), i = Se.usePresence(t, {
@@ -6926,14 +6923,14 @@ const Se = {
6926
6923
  useSyncPresence: Ec,
6927
6924
  useTypingIndicator: Ac
6928
6925
  };
6929
- class kc {
6926
+ class jc {
6930
6927
  constructor(e, n, r) {
6931
6928
  this.useTopicEffect = (i, s) => {
6932
6929
  Se.useTopicEffect(this, i, s);
6933
6930
  }, this.usePublishTopic = (i) => Se.usePublishTopic(this, i), this.usePresence = (i = {}) => Se.usePresence(this, i), this.useSyncPresence = (i, s) => Se.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => Se.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
6934
6931
  }
6935
6932
  }
6936
- var jc = function(t, e, n, r) {
6933
+ var kc = function(t, e, n, r) {
6937
6934
  function i(s) {
6938
6935
  return s instanceof n ? s : new n(function(o) {
6939
6936
  o(s);
@@ -6969,8 +6966,8 @@ class Pc {
6969
6966
  constructor(e, n) {
6970
6967
  this.tx = zn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
6971
6968
  const [i, s] = di(null);
6972
- return ke(() => {
6973
- jc(this, void 0, void 0, function* () {
6969
+ return je(() => {
6970
+ kc(this, void 0, void 0, function* () {
6974
6971
  const a = yield this.getLocalId(r);
6975
6972
  s(a);
6976
6973
  });
@@ -7025,7 +7022,7 @@ class Pc {
7025
7022
  * const { peers } = db.rooms.usePresence(room);
7026
7023
  */
7027
7024
  room(e = "_defaultRoomType", n = "_defaultRoomId") {
7028
- return new kc(this.core, e, n);
7025
+ return new jc(this.core, e, n);
7029
7026
  }
7030
7027
  /**
7031
7028
  * One time query for the logged in state. This is useful
@@ -7203,8 +7200,8 @@ function oi(t) {
7203
7200
  }
7204
7201
  var Xi = (t) => {
7205
7202
  throw TypeError(t);
7206
- }, Gn = (t, e, n) => e.has(t) || Xi("Cannot " + n), A = (t, e, n) => (Gn(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) => (Gn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (Gn(t, e, "access private method"), n), J, Oe, Re, At, Rt, st, De, ot, _e, xe, Le, $e, et, se, On, En, An, ai, kn, jn, tt, Cn, Pn;
7207
- class kt extends EventTarget {
7203
+ }, Gn = (t, e, n) => e.has(t) || Xi("Cannot " + n), A = (t, e, n) => (Gn(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) => (Gn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (Gn(t, e, "access private method"), n), J, Oe, Re, At, Rt, st, De, ot, _e, xe, Le, $e, et, se, On, En, An, ai, jn, kn, tt, Cn, Pn;
7204
+ class jt extends EventTarget {
7208
7205
  constructor(e, n) {
7209
7206
  var r, i;
7210
7207
  super(), N(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, N(this, J), N(this, Oe), N(this, Re), N(this, At), N(this, Rt), N(this, st), N(this, De), N(this, ot, null), N(this, _e), N(this, xe), N(this, Le, null), N(this, $e, null), N(this, et, null), N(this, En, async (s) => {
@@ -7239,7 +7236,7 @@ class kt extends EventTarget {
7239
7236
  } while (y);
7240
7237
  }), N(this, An, (s) => {
7241
7238
  $(this, _e, void 0), !(s.name === "AbortError" || s.type === "aborted") && he(this, se, Cn).call(this, Sn(s));
7242
- }), N(this, kn, (s) => {
7239
+ }), N(this, jn, (s) => {
7243
7240
  typeof s.id == "string" && $(this, ot, s.id);
7244
7241
  const o = new MessageEvent(s.event || "message", {
7245
7242
  data: s.data,
@@ -7247,7 +7244,7 @@ class kt extends EventTarget {
7247
7244
  lastEventId: s.id || ""
7248
7245
  });
7249
7246
  A(this, $e) && (!s.event || s.event === "message") && A(this, $e).call(this, o), this.dispatchEvent(o);
7250
- }), N(this, jn, (s) => {
7247
+ }), N(this, kn, (s) => {
7251
7248
  $(this, st, s);
7252
7249
  }), N(this, Pn, () => {
7253
7250
  $(this, De, void 0), A(this, J) === this.CONNECTING && he(this, se, On).call(this);
@@ -7263,8 +7260,8 @@ class kt extends EventTarget {
7263
7260
  throw Rc("An invalid or illegal string was specified");
7264
7261
  }
7265
7262
  $(this, xe, Ic({
7266
- onEvent: A(this, kn),
7267
- onRetry: A(this, jn)
7263
+ onEvent: A(this, jn),
7264
+ onRetry: A(this, kn)
7268
7265
  })), $(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, On).call(this);
7269
7266
  }
7270
7267
  /**
@@ -7363,7 +7360,7 @@ ai = function() {
7363
7360
  signal: (t = A(this, _e)) == null ? void 0 : t.signal
7364
7361
  };
7365
7362
  return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
7366
- }, kn = /* @__PURE__ */ new WeakMap(), jn = /* @__PURE__ */ new WeakMap(), /**
7363
+ }, jn = /* @__PURE__ */ new WeakMap(), kn = /* @__PURE__ */ new WeakMap(), /**
7367
7364
  * Handles the process referred to in the EventSource specification as "failing a connection".
7368
7365
  *
7369
7366
  * @param error - The error causing the connection to fail
@@ -7394,24 +7391,24 @@ Cn = function(t, e) {
7394
7391
  *
7395
7392
  * @public
7396
7393
  */
7397
- kt.CONNECTING = 0, /**
7394
+ jt.CONNECTING = 0, /**
7398
7395
  * ReadyState representing an EventSource connection that is open (eg connected)
7399
7396
  *
7400
7397
  * @public
7401
7398
  */
7402
- kt.OPEN = 1, /**
7399
+ jt.OPEN = 1, /**
7403
7400
  * ReadyState representing an EventSource connection that is closed (eg disconnected)
7404
7401
  *
7405
7402
  * @public
7406
7403
  */
7407
- kt.CLOSED = 2;
7404
+ jt.CLOSED = 2;
7408
7405
  function xc() {
7409
7406
  const t = "document" in globalThis ? globalThis.document : void 0;
7410
7407
  return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
7411
7408
  }
7412
7409
  const Qn = class Qn extends Pc {
7413
7410
  };
7414
- Qn.EventSourceImpl = kt;
7411
+ Qn.EventSourceImpl = jt;
7415
7412
  let In = Qn;
7416
7413
  function $c(t) {
7417
7414
  const e = {
@@ -7475,7 +7472,7 @@ function zc({
7475
7472
  [c]: void 0
7476
7473
  });
7477
7474
  }
7478
- return ks(
7475
+ return js(
7479
7476
  t,
7480
7477
  {
7481
7478
  onMouseMove: y,