@instantdb/react 0.22.69 → 0.22.70

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 ke, useMemo as rn, useState as di, createElement as ks } from "react";
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";
2
2
  function z(t) {
3
3
  if (typeof t == "number")
4
4
  return (Math.abs(t * 2654435761) >>> 0).toString(16);
@@ -44,11 +44,11 @@ const U = {
44
44
  }, fi = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), js = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), vt = Symbol.iterator, ne = {
45
45
  mutable: "mutable",
46
46
  immutable: "immutable"
47
- }, Rn = {};
47
+ }, Mn = {};
48
48
  function nt(t, e) {
49
49
  return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
50
50
  }
51
- function Tr(t, e) {
51
+ function gr(t, e) {
52
52
  if (e in t) {
53
53
  let n = Reflect.getPrototypeOf(t);
54
54
  for (; n; ) {
@@ -59,10 +59,10 @@ function Tr(t, e) {
59
59
  }
60
60
  }
61
61
  }
62
- function xn(t) {
62
+ function Rn(t) {
63
63
  return Object.getPrototypeOf(t) === Set.prototype;
64
64
  }
65
- function $n(t) {
65
+ function xn(t) {
66
66
  return Object.getPrototypeOf(t) === Map.prototype;
67
67
  }
68
68
  function te(t) {
@@ -75,7 +75,7 @@ function je(t) {
75
75
  function j(t) {
76
76
  return typeof t != "object" ? null : t == null ? void 0 : t[fi];
77
77
  }
78
- function Dn(t) {
78
+ function $n(t) {
79
79
  var e;
80
80
  const n = j(t);
81
81
  return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
@@ -122,7 +122,7 @@ function Ht(t, e) {
122
122
  function ye(t, e) {
123
123
  return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
124
124
  }
125
- function sn(t) {
125
+ function rn(t) {
126
126
  if (t)
127
127
  for (; t.finalities.revoke.length > 0; )
128
128
  t.finalities.revoke.pop()();
@@ -163,13 +163,13 @@ function hi(t, e) {
163
163
  if (Array.isArray(t))
164
164
  return Array.prototype.concat.call(t);
165
165
  if (t instanceof Set) {
166
- if (!xn(t)) {
166
+ if (!Rn(t)) {
167
167
  const r = Object.getPrototypeOf(t).constructor;
168
168
  return new r(t.values());
169
169
  }
170
170
  return Set.prototype.difference ? Set.prototype.difference.call(t, /* @__PURE__ */ new Set()) : new Set(t.values());
171
171
  } else if (t instanceof Map) {
172
- if (!$n(t)) {
172
+ if (!xn(t)) {
173
173
  const r = Object.getPrototypeOf(t).constructor;
174
174
  return new r(t);
175
175
  }
@@ -198,7 +198,7 @@ function Q(t) {
198
198
  }
199
199
  function Je(t) {
200
200
  if (!ae(t))
201
- return Dn(t);
201
+ return $n(t);
202
202
  if (Array.isArray(t))
203
203
  return t.map(Je);
204
204
  if (t instanceof Map) {
@@ -206,7 +206,7 @@ function Je(t) {
206
206
  r,
207
207
  Je(i)
208
208
  ]);
209
- if (!$n(t)) {
209
+ if (!xn(t)) {
210
210
  const r = Object.getPrototypeOf(t).constructor;
211
211
  return new r(n);
212
212
  }
@@ -214,7 +214,7 @@ function Je(t) {
214
214
  }
215
215
  if (t instanceof Set) {
216
216
  const n = Array.from(t).map(Je);
217
- if (!xn(t)) {
217
+ if (!Rn(t)) {
218
218
  const r = Object.getPrototypeOf(t).constructor;
219
219
  return new r(n);
220
220
  }
@@ -232,7 +232,7 @@ 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 wr() {
235
+ function Tr() {
236
236
  throw new Error("Cannot modify frozen object");
237
237
  }
238
238
  function Me(t, e, n, r, i) {
@@ -260,12 +260,12 @@ function Me(t, e, n, r, i) {
260
260
  case 2:
261
261
  for (const [a, u] of t)
262
262
  Me(a, a, n, r, i), Me(u, a, n, r, i);
263
- t.set = t.clear = t.delete = wr;
263
+ t.set = t.clear = t.delete = Tr;
264
264
  break;
265
265
  case 3:
266
266
  for (const a of t)
267
267
  Me(a, a, n, r, i);
268
- t.add = t.clear = t.delete = wr;
268
+ t.add = t.clear = t.delete = Tr;
269
269
  break;
270
270
  case 1:
271
271
  Object.freeze(t);
@@ -281,7 +281,7 @@ function Me(t, e, n, r, i) {
281
281
  }
282
282
  r.pop(), i.pop();
283
283
  }
284
- function Un(t, e) {
284
+ function Dn(t, e) {
285
285
  const n = Ce(t);
286
286
  if (n === 0)
287
287
  Reflect.ownKeys(t).forEach((r) => {
@@ -298,7 +298,7 @@ function pi(t, e, n) {
298
298
  if (je(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
- if (e.add(t), Un(t, (s, o) => {
301
+ if (e.add(t), Dn(t, (s, o) => {
302
302
  var a;
303
303
  if (je(o)) {
304
304
  const u = j(o);
@@ -318,12 +318,12 @@ function Ms(t, e) {
318
318
  const n = t.type === 3 ? t.setMap : t.copy;
319
319
  t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && pi(be(n, e), t.finalities.handledSet, t.options);
320
320
  }
321
- function on(t) {
321
+ function sn(t) {
322
322
  t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
323
- t.copy.add(Dn(e));
323
+ t.copy.add($n(e));
324
324
  }));
325
325
  }
326
- function an(t, e, n, r) {
326
+ function on(t, e, n, r) {
327
327
  if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
328
328
  if (n && r) {
329
329
  const s = li(t);
@@ -332,14 +332,14 @@ function an(t, e, n, r) {
332
332
  t.finalized = !0;
333
333
  }
334
334
  }
335
- function Ln(t, e, n, r) {
335
+ function Un(t, e, n, r) {
336
336
  const i = j(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;
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), sn(t), on(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);
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;
@@ -448,7 +448,7 @@ function ut(t, e, n, r) {
448
448
  const jt = (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
- }, un = {
451
+ }, an = {
452
452
  get size() {
453
453
  return te(j(this)).size;
454
454
  },
@@ -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), Un(n, t, e, ut)), this;
461
461
  },
462
462
  delete(t) {
463
463
  if (!this.has(t))
@@ -485,7 +485,7 @@ const jt = (t, e, n = !1) => {
485
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
486
  if (r.options.strict && jt(i, r.options, s), s || r.finalized || !ae(i, r.options) || i !== r.original.get(t))
487
487
  return i;
488
- const o = Rn.createDraft({
488
+ const o = Mn.createDraft({
489
489
  original: i,
490
490
  parentDraft: r,
491
491
  key: t,
@@ -529,7 +529,7 @@ const jt = (t, e, n = !1) => {
529
529
  [vt]() {
530
530
  return this.entries();
531
531
  }
532
- }, Ds = Reflect.ownKeys(un), mr = (t, e, { isValuesIterator: n }) => () => {
532
+ }, Ds = Reflect.ownKeys(an), wr = (t, e, { isValuesIterator: n }) => () => {
533
533
  var r, i;
534
534
  const s = e.next();
535
535
  if (s.done)
@@ -538,7 +538,7 @@ const jt = (t, e, n = !1) => {
538
538
  let a = t.setMap.get(o);
539
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
540
  if (t.options.strict && jt(o, t.options, d), !d && !u && ae(o, t.options) && !t.finalized && t.original.has(o)) {
541
- const c = Rn.createDraft({
541
+ const c = Mn.createDraft({
542
542
  original: o,
543
543
  parentDraft: t,
544
544
  key: o,
@@ -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), Un(e, t, t, ut)), this;
569
569
  },
570
570
  delete(t) {
571
571
  if (!this.has(t))
@@ -590,7 +590,7 @@ const jt = (t, e, n = !1) => {
590
590
  const e = t.setMap.keys();
591
591
  return {
592
592
  [Symbol.iterator]: () => this.values(),
593
- next: mr(t, e, { isValuesIterator: !0 })
593
+ next: wr(t, e, { isValuesIterator: !0 })
594
594
  };
595
595
  },
596
596
  entries() {
@@ -599,7 +599,7 @@ const jt = (t, e, n = !1) => {
599
599
  const e = t.setMap.keys();
600
600
  return {
601
601
  [Symbol.iterator]: () => this.entries(),
602
- next: mr(t, e, {
602
+ next: wr(t, e, {
603
603
  isValuesIterator: !1
604
604
  })
605
605
  };
@@ -657,8 +657,8 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
657
657
  const a = te(t);
658
658
  if (a instanceof Map && Ds.includes(e)) {
659
659
  if (e === "size")
660
- return Object.getOwnPropertyDescriptor(un, "size").get.call(t.proxy);
661
- const d = un[e];
660
+ return Object.getOwnPropertyDescriptor(an, "size").get.call(t.proxy);
661
+ const d = an[e];
662
662
  if (d)
663
663
  return d.bind(t.proxy);
664
664
  }
@@ -670,7 +670,7 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
670
670
  return d.bind(t.proxy);
671
671
  }
672
672
  if (!nt(a, e)) {
673
- const d = Tr(a, e);
673
+ const d = gr(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)
@@ -680,7 +680,7 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
680
680
  if (t.options.strict && jt(u, t.options), t.finalized || !ae(u, t.options))
681
681
  return u;
682
682
  if (u === Ht(t.original, e)) {
683
- if (Q(t), t.copy[e] = Fn({
683
+ if (Q(t), t.copy[e] = Ln({
684
684
  original: t.original[e],
685
685
  parentDraft: t,
686
686
  key: t.type === 1 ? Number(e) : e,
@@ -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 = Tr(te(t), e);
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
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 || 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) {
711
711
  return e in te(t);
@@ -736,7 +736,7 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
736
736
  return t.type === 1 ? bi.set.call(this, t, e, void 0, t.proxy) : (Ht(t.original, e) !== void 0 || e in t.original ? (Q(t), fe(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
737
737
  }
738
738
  };
739
- function Fn(t) {
739
+ function Ln(t) {
740
740
  const { original: e, parentDraft: n, key: r, finalities: i, options: s } = t, o = Ce(e), a = {
741
741
  type: o,
742
742
  finalized: !1,
@@ -760,7 +760,7 @@ function Fn(t) {
760
760
  const w = be(_, r), g = j(w);
761
761
  if (g) {
762
762
  let m = g.original;
763
- g.operated && (m = Dn(w)), on(g), an(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);
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);
764
764
  }
765
765
  (y = b.callbacks) === null || y === void 0 || y.forEach((m) => {
766
766
  m(f, l);
@@ -769,12 +769,12 @@ 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
+ sn(c), on(c, ut, f, l);
773
773
  });
774
774
  }
775
775
  return u;
776
776
  }
777
- Rn.createDraft = Fn;
777
+ Mn.createDraft = Ln;
778
778
  function Ls(t, e, n, r, i) {
779
779
  var s;
780
780
  const o = j(t), a = (s = o == null ? void 0 : o.original) !== null && s !== void 0 ? s : t, u = !!e.length;
@@ -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 && Me(d, d, o == null ? void 0 : o.options.updatedValues), [
785
+ return o && rn(o), i && Me(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
@@ -797,7 +797,7 @@ function Fs(t, e) {
797
797
  };
798
798
  let i, s;
799
799
  e.enablePatches && (i = [], s = []);
800
- const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, ne)) === ne.mutable || !ae(t, e) ? t : Fn({
800
+ const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, ne)) === ne.mutable || !ae(t, e) ? t : Ln({
801
801
  original: t,
802
802
  parentDraft: null,
803
803
  finalities: r,
@@ -811,9 +811,9 @@ function Fs(t, e) {
811
811
  }
812
812
  ];
813
813
  }
814
- function cn(t) {
814
+ function un(t) {
815
815
  const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: i = !0 } = t;
816
- Un(n, (s, o, a) => {
816
+ Dn(n, (s, o, a) => {
817
817
  const u = j(o);
818
818
  if (u && e && u.finalities === e.finalities) {
819
819
  t.isContainDraft = !0;
@@ -823,7 +823,7 @@ function cn(t) {
823
823
  a.clear(), c.forEach((f) => a.add(s === f ? d : f));
824
824
  } else
825
825
  ct(a, s, d);
826
- } else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, cn(t));
826
+ } else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, un(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
  }
829
829
  function _i(t) {
@@ -836,7 +836,7 @@ function _i(t) {
836
836
  return n.original;
837
837
  let i;
838
838
  function s() {
839
- i = r === 2 ? $n(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : hi(t, n == null ? void 0 : n.options);
839
+ i = r === 2 ? xn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : hi(t, n == null ? void 0 : n.options);
840
840
  }
841
841
  if (n) {
842
842
  n.finalized = !0;
@@ -847,18 +847,18 @@ function _i(t) {
847
847
  }
848
848
  } else
849
849
  i = t;
850
- if (Un(i, (o, a) => {
850
+ if (Dn(i, (o, a) => {
851
851
  if (n && ye(be(n.original, o), a))
852
852
  return;
853
853
  const u = _i(a);
854
854
  u !== a && (i === t && s(), ct(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
- return xn(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
857
+ return Rn(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
858
858
  }
859
859
  return i;
860
860
  }
861
- function vr(t) {
861
+ function mr(t) {
862
862
  if (!je(t))
863
863
  throw new Error(`current() is only used for Draft, parameter: ${t}`);
864
864
  return _i(t);
@@ -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) ? vr(u) : u, l = Array.isArray(c.mark) ? (S, I) => {
877
+ const f = je(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,7 +900,7 @@ const Ns = (t) => function e(n, r, i) {
900
900
  try {
901
901
  m = d(w);
902
902
  } catch (S) {
903
- throw sn(j(w)), S;
903
+ throw rn(j(w)), S;
904
904
  }
905
905
  const E = (S) => {
906
906
  const I = j(w);
@@ -910,14 +910,14 @@ const Ns = (t) => function e(n, r, i) {
910
910
  const B = S == null ? void 0 : S[js];
911
911
  if (B) {
912
912
  const Ve = B[0];
913
- return _.strict && typeof S == "object" && S !== null && cn({
913
+ return _.strict && typeof S == "object" && S !== null && un({
914
914
  rootDraft: I,
915
915
  value: S,
916
916
  useRawReturn: !0
917
917
  }), g([Ve]);
918
918
  }
919
919
  if (S !== void 0)
920
- return typeof S == "object" && S !== null && cn({ rootDraft: I, value: S }), g([S]);
920
+ return typeof S == "object" && S !== null && un({ rootDraft: I, value: S }), g([S]);
921
921
  }
922
922
  if (S === w || S === void 0)
923
923
  return g([]);
@@ -925,12 +925,12 @@ const Ns = (t) => function e(n, r, i) {
925
925
  if (_ === x.options) {
926
926
  if (x.operated)
927
927
  throw new Error("Cannot return a modified child draft.");
928
- return g([vr(S)]);
928
+ return g([mr(S)]);
929
929
  }
930
930
  return g([S]);
931
931
  };
932
932
  return m instanceof Promise ? m.then(E, (S) => {
933
- throw sn(j(w)), S;
933
+ throw rn(j(w)), S;
934
934
  }) : E(m);
935
935
  }, Pt = Ns();
936
936
  Object.prototype.constructor.toString();
@@ -938,13 +938,13 @@ function gi(t, e) {
938
938
  const n = Object.keys(t), r = Object.keys(e);
939
939
  return n.length === r.length && Object.keys(t).every((i) => e.hasOwnProperty(i));
940
940
  }
941
- function Sr(t, e) {
941
+ function vr(t, e) {
942
942
  return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((n) => e.hasOwnProperty(n) && t[n] === e[n]);
943
943
  }
944
944
  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
- function Nn(t) {
947
+ function Fn(t) {
948
948
  if (!Ze(t))
949
949
  return t;
950
950
  const e = {};
@@ -982,7 +982,7 @@ function Ks(t, e, n) {
982
982
  const i = e[e.length - 1];
983
983
  Array.isArray(r) && typeof i == "number" ? r.splice(i, 0, n) : r[i] = n;
984
984
  }
985
- function Or(t, e, n) {
985
+ function Sr(t, e, n) {
986
986
  if (!t || e.length === 0)
987
987
  return;
988
988
  let r = t || {};
@@ -1007,7 +1007,7 @@ function wi(t, e) {
1007
1007
  function qs(t) {
1008
1008
  return t && Object.keys(t).length === 0;
1009
1009
  }
1010
- const Er = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|WAST|WAKT|WADT|VUT|VOLT|VLAT|VLAST|VET|UZT|UZST|UYT|UYST|UTC|UT|ULAT|ULAST|UCT|TVT|TRUT|TOT|TMT|TKT|TJT|TFT|TAHT|SGT|SCT|SAST|SADT|RET|PYT|PYST|PWT|PST|PONT|PMST|PMDT|PKT|PKST|PHT|PGT|PETT|PETST|PET|PDT|OMST|OMSST|NZT|NZST|NZDT|NUT|NST|NPT|NOVT|NOVST|NFT|NDT|MYT|MVT|MUT|MUST|MST|MSK|MSD|MPT|MMT|MHT|MEZ|METDST|MET|MESZ|MEST|MDT|MAWT|MART|MAGT|MAGST|LKT|LINT|LIGT|LHST|LHDT|KST|KRAT|KRAST|KOST|KGT|KGST|KDT|JST|JAYT|IST|IRT|IRKT|IRKST|IOT|IDT|ICT|HST|HKT|GYT|GMT|GILT|GFT|GET|GEST|GAMT|GALT|FNT|FNST|FKT|FKST|FJT|FJST|FET|EST|EGT|EGST|EETDST|EET|EEST|EDT|EAT|EAST|EASST|DDUT|DAVT|CXT|CST|COT|CLT|CLST|CKT|CHUT|CHAST|CHADT|CETDST|CET|CEST|CDT|CCT|CAST|CADT|BTT|BST|BRT|BRST|BRA|BOT|BORT|BNT|BDT|BDST|AZT|AZST|AZOT|AZOST|AWST|AWSST|AST|ART|ARST|ANAT|ANAST|AMT|AMST|ALMT|ALMST|AKST|AKDT|AFT|AEST|AESST|AEDT|ADT|ACWST|ACT|ACST|ACSST|ACDT$/, Ws = {
1010
+ const Or = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|WAST|WAKT|WADT|VUT|VOLT|VLAT|VLAST|VET|UZT|UZST|UYT|UYST|UTC|UT|ULAT|ULAST|UCT|TVT|TRUT|TOT|TMT|TKT|TJT|TFT|TAHT|SGT|SCT|SAST|SADT|RET|PYT|PYST|PWT|PST|PONT|PMST|PMDT|PKT|PKST|PHT|PGT|PETT|PETST|PET|PDT|OMST|OMSST|NZT|NZST|NZDT|NUT|NST|NPT|NOVT|NOVST|NFT|NDT|MYT|MVT|MUT|MUST|MST|MSK|MSD|MPT|MMT|MHT|MEZ|METDST|MET|MESZ|MEST|MDT|MAWT|MART|MAGT|MAGST|LKT|LINT|LIGT|LHST|LHDT|KST|KRAT|KRAST|KOST|KGT|KGST|KDT|JST|JAYT|IST|IRT|IRKT|IRKST|IOT|IDT|ICT|HST|HKT|GYT|GMT|GILT|GFT|GET|GEST|GAMT|GALT|FNT|FNST|FKT|FKST|FJT|FJST|FET|EST|EGT|EGST|EETDST|EET|EEST|EDT|EAT|EAST|EASST|DDUT|DAVT|CXT|CST|COT|CLT|CLST|CKT|CHUT|CHAST|CHADT|CETDST|CET|CEST|CDT|CCT|CAST|CADT|BTT|BST|BRT|BRST|BRA|BOT|BORT|BNT|BDT|BDST|AZT|AZST|AZOT|AZOST|AWST|AWSST|AST|ART|ARST|ANAT|ANAST|AMT|AMST|ALMT|ALMST|AKST|AKDT|AFT|AEST|AESST|AEDT|ADT|ACWST|ACT|ACST|ACSST|ACDT$/, Ws = {
1011
1011
  ZULU: 0,
1012
1012
  YEKT: 18e3,
1013
1013
  YEKST: 21600,
@@ -1263,10 +1263,10 @@ function eo(t) {
1263
1263
  }
1264
1264
  }
1265
1265
  function to(t) {
1266
- const e = t.match(Er);
1266
+ const e = t.match(Or);
1267
1267
  if (!e)
1268
1268
  return null;
1269
- const [n] = e, r = Ws[n], i = new Date(t.replace(Er, "Z"));
1269
+ const [n] = e, r = Ws[n], i = new Date(t.replace(Or, "Z"));
1270
1270
  return new Date(i.getTime() - r * 1e3);
1271
1271
  }
1272
1272
  const no = [
@@ -1290,7 +1290,7 @@ function ro(t, e) {
1290
1290
  return null;
1291
1291
  }
1292
1292
  }
1293
- function dn(t) {
1293
+ function cn(t) {
1294
1294
  for (const e of no) {
1295
1295
  const n = ro(e, t);
1296
1296
  if (n)
@@ -1301,7 +1301,7 @@ function dn(t) {
1301
1301
  function io(t) {
1302
1302
  try {
1303
1303
  const e = JSON.parse(t);
1304
- return typeof e == "string" ? dn(e) : null;
1304
+ return typeof e == "string" ? cn(e) : null;
1305
1305
  } catch {
1306
1306
  return null;
1307
1307
  }
@@ -1313,7 +1313,7 @@ function xt(t) {
1313
1313
  if (t instanceof Date)
1314
1314
  return t;
1315
1315
  if (typeof t == "string") {
1316
- const e = dn(t) || io(t) || dn(t.trim());
1316
+ const e = cn(t) || io(t) || cn(t.trim());
1317
1317
  if (!e)
1318
1318
  throw new Error(`Unable to parse \`${t}\` as a date.`);
1319
1319
  return e;
@@ -1325,10 +1325,10 @@ function xt(t) {
1325
1325
  function so(t) {
1326
1326
  return t.cardinality === "one";
1327
1327
  }
1328
- function Kn(t) {
1328
+ function Nn(t) {
1329
1329
  return t["value-type"] === "ref";
1330
1330
  }
1331
- function qn(t) {
1331
+ function Kn(t) {
1332
1332
  return t["value-type"] === "blob";
1333
1333
  }
1334
1334
  function qe(t, e) {
@@ -1367,7 +1367,7 @@ function mi(t, e, n) {
1367
1367
  console.warn("no such attr", a, t);
1368
1368
  continue;
1369
1369
  }
1370
- f["checked-data-type"] === "date" && n && (d = xt(d), o[2] = d), Kn(f) && Z(s, [d, u, a], o), Z(r, [a, u, d], o), Z(i, [u, a, d], o);
1370
+ f["checked-data-type"] === "date" && n && (d = xt(d), o[2] = d), Nn(f) && Z(s, [d, u, a], o), Z(r, [a, u, d], o), Z(i, [u, a, d], o);
1371
1371
  }
1372
1372
  return { eav: r, aev: i, vae: s };
1373
1373
  }
@@ -1375,7 +1375,7 @@ function vi(t) {
1375
1375
  const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
1376
1376
  for (const s of Object.values(t)) {
1377
1377
  const o = s["forward-identity"], [a, u, d] = o, c = s["reverse-identity"];
1378
- if (Z(r, [u, d], s), qn(s) && Z(e, [u, d], s), s["primary?"] && Z(n, [u], s), c) {
1378
+ if (Z(r, [u, d], s), Kn(s) && Z(e, [u, d], s), s["primary?"] && Z(n, [u], s), c) {
1379
1379
  const [f, l, p] = c;
1380
1380
  Z(i, [l, p], s);
1381
1381
  }
@@ -1398,7 +1398,7 @@ function Oi(t) {
1398
1398
  function oo(t, e) {
1399
1399
  return We(t.eav, [e]) !== void 0;
1400
1400
  }
1401
- function Wn(t) {
1401
+ function qn(t) {
1402
1402
  t.attrIndexes = vi(t.attrs);
1403
1403
  }
1404
1404
  function Et(t, e, n, r, i) {
@@ -1437,7 +1437,7 @@ function Ei(t, e) {
1437
1437
  if (!n)
1438
1438
  return;
1439
1439
  const [r, i, s] = n, o = qe(t.attrs, i);
1440
- o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]), Kn(o) && oe(t.vae, [s, i, r]));
1440
+ o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]), Nn(o) && oe(t.vae, [s, i, r]));
1441
1441
  }
1442
1442
  let ao = 0;
1443
1443
  function Ai(t, e, n) {
@@ -1457,7 +1457,7 @@ function ki(t, e) {
1457
1457
  return;
1458
1458
  a["checked-data-type"] === "date" && t.useDateObjects && (o = xt(o));
1459
1459
  const u = We(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
- 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);
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)), Nn(a) && Z(t.vae, [o, s, i], c);
1461
1461
  }
1462
1462
  function uo(t, e) {
1463
1463
  var n;
@@ -1467,7 +1467,7 @@ function uo(t, e) {
1467
1467
  const [i, s, o] = r, a = qe(t.attrs, s);
1468
1468
  if (!a)
1469
1469
  return;
1470
- if (!qn(a))
1470
+ if (!Kn(a))
1471
1471
  throw new Error("merge operation is not supported for links");
1472
1472
  const u = We(t.eav, [i, s]);
1473
1473
  if (!u)
@@ -1483,7 +1483,7 @@ function uo(t, e) {
1483
1483
  ];
1484
1484
  Z(t.eav, [i, s], /* @__PURE__ */ new Map([[f, l]]));
1485
1485
  }
1486
- function fn(t, e) {
1486
+ function dn(t, e) {
1487
1487
  var n, r;
1488
1488
  const [i, s] = e, o = dt(t, [i]);
1489
1489
  if (!o)
@@ -1494,7 +1494,7 @@ function fn(t, e) {
1494
1494
  const f = t.attrs[c];
1495
1495
  f && f["on-delete-reverse"] === "cascade" && X(u.get(c), 1).forEach(([l, p, y]) => {
1496
1496
  var b;
1497
- return fn(t, [y, (b = f["reverse-identity"]) === null || b === void 0 ? void 0 : b[1]]);
1497
+ return dn(t, [y, (b = f["reverse-identity"]) === null || b === void 0 ? void 0 : b[1]]);
1498
1498
  }), // Fall back to deleting everything if we've rehydrated tx-steps from
1499
1499
  // the store that didn't set `etype` in deleteEntity
1500
1500
  (!s || // If we don't know about the attr, let's just get rid of it
@@ -1507,7 +1507,7 @@ function fn(t, e) {
1507
1507
  d && d.forEach((c) => {
1508
1508
  var f, l, p;
1509
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]]);
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 && dn(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) {
@@ -1517,7 +1517,7 @@ function ji(t, e) {
1517
1517
  });
1518
1518
  }
1519
1519
  function co(t, [e]) {
1520
- t.attrs[e.id] = e, Wn(t);
1520
+ t.attrs[e.id] = e, qn(t);
1521
1521
  }
1522
1522
  function Ci(t) {
1523
1523
  return X(t.eav, 3);
@@ -1526,11 +1526,11 @@ function fo(t, [e]) {
1526
1526
  if (!t.attrs[e])
1527
1527
  return;
1528
1528
  const n = Ci(t).filter(([r, i]) => i !== e);
1529
- delete t.attrs[e], Wn(t), ji(t, n);
1529
+ delete t.attrs[e], qn(t), ji(t, n);
1530
1530
  }
1531
1531
  function lo(t, [e]) {
1532
1532
  const n = t.attrs[e.id];
1533
- n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), Wn(t), ji(t, Ci(t)));
1533
+ n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), qn(t), ji(t, Ci(t)));
1534
1534
  }
1535
1535
  function ho(t, e) {
1536
1536
  const [n, ...r] = e;
@@ -1545,7 +1545,7 @@ function ho(t, e) {
1545
1545
  Ei(t, r);
1546
1546
  break;
1547
1547
  case "delete-entity":
1548
- fn(t, r);
1548
+ dn(t, r);
1549
1549
  break;
1550
1550
  case "add-attr":
1551
1551
  co(t, r);
@@ -1726,15 +1726,15 @@ function mo(t, e, n) {
1726
1726
  }
1727
1727
  return Object.assign(Object.assign({}, n), { [t]: e });
1728
1728
  }
1729
- function Ar(t, e, n) {
1729
+ function Er(t, e, n) {
1730
1730
  return t === e ? n : null;
1731
1731
  }
1732
1732
  function vo(t) {
1733
1733
  switch (typeof t) {
1734
1734
  case "string":
1735
- return t.startsWith("?") ? mo : Ar;
1735
+ return t.startsWith("?") ? mo : Er;
1736
1736
  default:
1737
- return Ar;
1737
+ return Er;
1738
1738
  }
1739
1739
  }
1740
1740
  const So = [
@@ -1764,19 +1764,19 @@ function Ao(t, e, n) {
1764
1764
  return Co(t, e, n).map((r) => Eo(e, r, n)).filter((r) => r);
1765
1765
  }
1766
1766
  function ko(t, e, n) {
1767
- return e.or ? e.or.patterns.flatMap((r) => ln(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => ln(t, i, r), n) : n.flatMap((r) => Ao(t, e, r));
1767
+ 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) => Ao(t, e, r));
1768
1768
  }
1769
- function ln(t, e, n = [{}]) {
1769
+ function fn(t, e, n = [{}]) {
1770
1770
  return e.reduce((r, i) => ko(t, i, r), n);
1771
1771
  }
1772
- function zn(t, e) {
1773
- return Array.isArray(e) ? e.map((n) => zn(t, n)) : wo(e) ? t[e] : e;
1772
+ function Wn(t, e) {
1773
+ return Array.isArray(e) ? e.map((n) => Wn(t, n)) : wo(e) ? t[e] : e;
1774
1774
  }
1775
1775
  function jo(t, { find: e, where: n }) {
1776
- return ln(t, n).map((i) => zn(i, e));
1776
+ return fn(t, n).map((i) => Wn(i, e));
1777
1777
  }
1778
1778
  function Co(t, e, n) {
1779
- return yo(t, zn(n, e));
1779
+ return yo(t, Wn(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
1782
  function Fe(t) {
@@ -1798,18 +1798,18 @@ function Ro() {
1798
1798
  }
1799
1799
  return Yt(Mo);
1800
1800
  }
1801
- const xo = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), kr = { randomUUID: xo };
1801
+ const xo = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ar = { randomUUID: xo };
1802
1802
  function $o(t, e, n) {
1803
1803
  var i;
1804
- if (kr.randomUUID && !t)
1805
- return kr.randomUUID();
1804
+ if (Ar.randomUUID && !t)
1805
+ return Ar.randomUUID();
1806
1806
  t = t || {};
1807
1807
  const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? Ro();
1808
1808
  if (r.length < 16)
1809
1809
  throw new Error("Random bytes length must be >= 16");
1810
1810
  return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Io(r);
1811
1811
  }
1812
- function jr(t) {
1812
+ function kr(t) {
1813
1813
  const e = t.replace(/-/g, ""), n = [];
1814
1814
  for (let r = 0; r < e.length; r += 2)
1815
1815
  n.push(parseInt(e.substring(r, r + 2), 16));
@@ -1825,7 +1825,7 @@ function Do(t, e) {
1825
1825
  return 0;
1826
1826
  }
1827
1827
  function Uo(t, e) {
1828
- return Do(jr(t), jr(e));
1828
+ return Do(kr(t), kr(e));
1829
1829
  }
1830
1830
  function K() {
1831
1831
  return $o();
@@ -1861,7 +1861,7 @@ function qo(t, e) {
1861
1861
  throw new Ne(`Could not find id attr for ${e}`);
1862
1862
  return n;
1863
1863
  }
1864
- function Cr(t, e, n, r) {
1864
+ function jr(t, e, n, r) {
1865
1865
  return [Wo(t, e, n, r)];
1866
1866
  }
1867
1867
  function Wo(t, e, n, r) {
@@ -1894,7 +1894,7 @@ function Ri(t, e, n, r, i) {
1894
1894
  ];
1895
1895
  return [s ? f : d, l, p, a, !!s];
1896
1896
  }
1897
- function Pr(t, e) {
1897
+ function Cr(t, e) {
1898
1898
  if (typeof e != "string")
1899
1899
  return function(o) {
1900
1900
  return !1;
@@ -1945,7 +1945,7 @@ function Vo(t, e) {
1945
1945
  }
1946
1946
  };
1947
1947
  if (e.hasOwnProperty("$like")) {
1948
- const r = Pr(!0, e.$like);
1948
+ const r = Cr(!0, e.$like);
1949
1949
  return {
1950
1950
  $comparator: !0,
1951
1951
  $op: function(s) {
@@ -1954,7 +1954,7 @@ function Vo(t, e) {
1954
1954
  };
1955
1955
  }
1956
1956
  if (e.hasOwnProperty("$ilike")) {
1957
- const r = Pr(!1, e.$ilike);
1957
+ const r = Cr(!1, e.$ilike);
1958
1958
  return {
1959
1959
  $comparator: !0,
1960
1960
  $op: function(s) {
@@ -1993,7 +1993,7 @@ function Go(t, e, n, r, i) {
1993
1993
  }, [n, r, []]);
1994
1994
  return [s, o, a];
1995
1995
  }
1996
- function hn(t, e, n, r, i, s) {
1996
+ function ln(t, e, n, r, i, s) {
1997
1997
  const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, d, c] = Go(t, e, n, r, o), f = Bo(t, e, u, d, a, s);
1998
1998
  return c.concat([f]);
1999
1999
  }
@@ -2012,7 +2012,7 @@ function Jo(t, e, n) {
2012
2012
  return e == s ? s : `${s}-${n}`;
2013
2013
  };
2014
2014
  }
2015
- function Ir(t, e, n, r, i, s) {
2015
+ function Pr(t, e, n, r, i, s) {
2016
2016
  const o = t(r, i), a = s.map((u, d) => {
2017
2017
  const c = Jo(t, o, d);
2018
2018
  return xi(c, n, r, i, u);
@@ -2025,20 +2025,20 @@ function Zo(t) {
2025
2025
  e.push(t.slice(0, n));
2026
2026
  return e;
2027
2027
  }
2028
- function Mr(t, e, n, r, i) {
2029
- return Zo(i).map((s) => hn(t, e, n, r, s, { $isNull: !0 }));
2028
+ function Ir(t, e, n, r, i) {
2029
+ return Zo(i).map((s) => ln(t, e, n, r, s, { $isNull: !0 }));
2030
2030
  }
2031
2031
  function xi(t, e, n, r, i) {
2032
2032
  return Object.entries(i).flatMap(([s, o]) => {
2033
2033
  if (Ho([s, o]))
2034
- return Ir(t, "or", e, n, r, o);
2034
+ return Pr(t, "or", e, n, r, o);
2035
2035
  if (Yo([s, o]))
2036
- return Ir(t, "and", e, n, r, o);
2036
+ return Pr(t, "and", e, n, r, o);
2037
2037
  if (s === "$entityIdStartsWith")
2038
2038
  return [];
2039
2039
  const a = s.split(".");
2040
2040
  if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
2041
- const u = hn(t, e, n, r, a, o), d = Mr(t, e, n, r, a);
2041
+ const u = ln(t, e, n, r, a, o), d = Ir(t, e, n, r, a);
2042
2042
  return [
2043
2043
  {
2044
2044
  or: {
@@ -2051,16 +2051,16 @@ function xi(t, e, n, r, i) {
2051
2051
  return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && a.length > 1 ? [
2052
2052
  {
2053
2053
  or: {
2054
- patterns: Mr(t, e, n, r, a),
2054
+ patterns: Ir(t, e, n, r, a),
2055
2055
  joinSym: t(n, r)
2056
2056
  }
2057
2057
  }
2058
- ] : hn(t, e, n, r, a, o);
2058
+ ] : ln(t, e, n, r, a, o);
2059
2059
  });
2060
2060
  }
2061
2061
  function Xo(t, e, n, r) {
2062
2062
  const i = $t;
2063
- return r ? xi(i, t, e, n, r).concat(Cr(i, t, e, n)) : Cr(i, t, e, n);
2063
+ return r ? xi(i, t, e, n, r).concat(jr(i, t, e, n)) : jr(i, t, e, n);
2064
2064
  }
2065
2065
  function ea(t, e, n) {
2066
2066
  return [t(e, n), t("time", n)];
@@ -2102,7 +2102,7 @@ function Xe(t, e, n, r, i) {
2102
2102
  function It([t, e], [n, r], i) {
2103
2103
  return Xe(t, e, n, r, i);
2104
2104
  }
2105
- function pn(t) {
2105
+ function hn(t) {
2106
2106
  return t == null ? t : new Date(t).getTime();
2107
2107
  }
2108
2108
  function ia(t, e, n, r) {
@@ -2110,7 +2110,7 @@ function ia(t, e, n, r) {
2110
2110
  const [s, o, a, u] = t, d = n === "desc" ? 1 : -1;
2111
2111
  if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
2112
2112
  return It(r, [s, u], null) === d;
2113
- const [c, f] = r, l = e["checked-data-type"], p = l === "date" ? pn(f) : f, y = l === "date" ? pn(a) : a;
2113
+ const [c, f] = r, l = e["checked-data-type"], p = l === "date" ? hn(f) : f, y = l === "date" ? hn(a) : a;
2114
2114
  return It([c, p], [s, y], l) === d;
2115
2115
  }
2116
2116
  function sa(t, e) {
@@ -2134,7 +2134,7 @@ function ua(t, e, n) {
2134
2134
  const s = /* @__PURE__ */ new Map();
2135
2135
  for (const o of n.fields) {
2136
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
- u && qn(a) && s.set(u, a);
2137
+ u && Kn(a) && s.set(u, a);
2138
2138
  }
2139
2139
  if (!s.has("id")) {
2140
2140
  const o = Te(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
@@ -2152,7 +2152,7 @@ function ca(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2152
2152
  c = c.map(([w]) => {
2153
2153
  var g, m, E, S, I;
2154
2154
  let x = (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 && (x = pn(x)), [w, x];
2155
+ return b && (x = hn(x)), [w, x];
2156
2156
  });
2157
2157
  }
2158
2158
  c.sort(d === "asc" ? function(_, w) {
@@ -2248,7 +2248,7 @@ function pa() {
2248
2248
  return new Set(Object.keys(e));
2249
2249
  }
2250
2250
  const ya = pa();
2251
- function yn(t, e, n) {
2251
+ function pn(t, e, n) {
2252
2252
  const r = {
2253
2253
  __etype: t,
2254
2254
  __ops: n
@@ -2260,7 +2260,7 @@ function yn(t, e, n) {
2260
2260
  if (s === "__etype")
2261
2261
  return t;
2262
2262
  if (ya.has(s))
2263
- return (o, a) => yn(t, e, [
2263
+ return (o, a) => pn(t, e, [
2264
2264
  ...n,
2265
2265
  a ? [s, t, e, o, a] : [s, t, e, o]
2266
2266
  ]);
@@ -2285,18 +2285,18 @@ function ba(t) {
2285
2285
  if (n === "__etype")
2286
2286
  return t;
2287
2287
  const r = n;
2288
- return Mt(r) ? yn(t, Li(r), []) : yn(t, r, []);
2288
+ return Mt(r) ? pn(t, Li(r), []) : pn(t, r, []);
2289
2289
  }
2290
2290
  });
2291
2291
  }
2292
- function Vn() {
2292
+ function zn() {
2293
2293
  return new Proxy({}, {
2294
2294
  get(t, e) {
2295
2295
  return ba(e);
2296
2296
  }
2297
2297
  });
2298
2298
  }
2299
- const Nc = Vn();
2299
+ const Nc = zn();
2300
2300
  function _a(t) {
2301
2301
  return t.__ops;
2302
2302
  }
@@ -2342,30 +2342,30 @@ function Ta(t) {
2342
2342
  throw new Error("lookup must be an object with a single unique attr and value.");
2343
2343
  return e[0];
2344
2344
  }
2345
- function bn(t, e, n) {
2345
+ function yn(t, e, n) {
2346
2346
  return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
2347
2347
  // before assuming it's a ref lookup.
2348
2348
  !V(t, e, n);
2349
2349
  }
2350
- function _n(t) {
2350
+ function bn(t) {
2351
2351
  const [e, n, ...r] = t.split(".");
2352
2352
  if (r.length > 0 || n !== "id")
2353
2353
  throw new Error(`${t} is not a valid lookup attribute.`);
2354
2354
  return e;
2355
2355
  }
2356
2356
  function wa(t, e, n) {
2357
- if (!bn(t, e, n))
2357
+ if (!yn(t, e, n))
2358
2358
  return V(t, e, n);
2359
- const r = _n(n), i = V(t, e, r) || Ae(t, e, r);
2359
+ const r = bn(n), i = V(t, e, r) || Ae(t, e, r);
2360
2360
  if (i && i["value-type"] !== "ref")
2361
2361
  throw new Error(`${n} does not reference a valid link attribute.`);
2362
2362
  return i;
2363
2363
  }
2364
- function gn(t) {
2364
+ function _n(t) {
2365
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
- const r = gn(n);
2368
+ const r = _n(n);
2369
2369
  if (r === null)
2370
2370
  return n;
2371
2371
  const [i, s] = r, o = wa(t, e, i);
@@ -2442,14 +2442,14 @@ function Ni({ stores: t, attrs: e }, [n, r, i, s]) {
2442
2442
  return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : Sa(t, n, r) ? { mode: "update" } : null;
2443
2443
  }
2444
2444
  function Oa(t, e) {
2445
- const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Nn(o), d = ee(r, i, s);
2445
+ const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Fn(o), d = ee(r, i, s);
2446
2446
  return [["id", d]].concat(Object.entries(u)).map(([f, l]) => {
2447
2447
  const p = V(r, i, f);
2448
2448
  return p["checked-data-type"] === "date" && t.useDateObjects && (l = xt(l)), ["add-triple", d, p.id, l, { mode: "create" }];
2449
2449
  });
2450
2450
  }
2451
2451
  function Ea(t, e) {
2452
- const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Nn(o), d = ee(r, i, s), c = Ni(t, [i, d, o, a]);
2452
+ 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]);
2453
2453
  return [["id", d]].concat(Object.entries(u)).map(([l, p]) => {
2454
2454
  const y = V(r, i, l);
2455
2455
  return y["checked-data-type"] === "date" && t.useDateObjects && (p = xt(p)), [
@@ -2465,7 +2465,7 @@ function Aa({ attrs: t }, [e, n]) {
2465
2465
  return [["delete-entity", ee(t, e, n), e]];
2466
2466
  }
2467
2467
  function ka(t, e) {
2468
- const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Nn(o), d = ee(r, i, s), c = Ni(t, [i, d, o, a]), f = Object.entries(u).map(([p, y]) => {
2468
+ 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]) => {
2469
2469
  const b = V(r, i, p);
2470
2470
  return [
2471
2471
  "deep-merge-triple",
@@ -2560,7 +2560,7 @@ function xa(t, e, n) {
2560
2560
  "on-delete-reverse": s.onDelete
2561
2561
  };
2562
2562
  }
2563
- function Rr(t, e, n, r) {
2563
+ function Mr(t, e, n, r) {
2564
2564
  const i = t ? xa(t, e, n) : null, s = K(), o = [K(), e, n], a = [K(), n, e];
2565
2565
  return Object.assign(Object.assign({ id: s, "forward-identity": o, "reverse-identity": a, "value-type": "ref", cardinality: "many", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
2566
2566
  }
@@ -2572,17 +2572,17 @@ const $a = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
2572
2572
  "merge",
2573
2573
  "delete",
2574
2574
  "ruleParams"
2575
- ]), Tn = { "unique?": !0, "index?": !0 }, Fa = Object.assign(Object.assign({}, Tn), { cardinality: "one" });
2575
+ ]), gn = { "unique?": !0, "index?": !0 }, Fa = Object.assign(Object.assign({}, gn), { cardinality: "one" });
2576
2576
  function Na(t) {
2577
2577
  const e = [], [n, r, i, s] = t;
2578
2578
  if (!La.has(n))
2579
2579
  return e;
2580
- const o = gn(i);
2580
+ const o = _n(i);
2581
2581
  if (o && e.push({ etype: r, lookupPair: o }), n === "link")
2582
2582
  for (const [a, u] of Object.entries(s)) {
2583
2583
  const d = Array.isArray(u) ? u : [u];
2584
2584
  for (const c of d) {
2585
- const f = gn(c);
2585
+ const f = _n(c);
2586
2586
  f && e.push({
2587
2587
  etype: r,
2588
2588
  lookupPair: f,
@@ -2603,7 +2603,7 @@ function Ka({ attrs: t, schema: e }, n) {
2603
2603
  }
2604
2604
  function c(f, l) {
2605
2605
  const p = V(o, f, l), y = Ae(o, f, l);
2606
- d(p), d(y), !p && !y && u(Rr(e, f, l, Fa));
2606
+ d(p), d(y), !p && !y && u(Mr(e, f, l, Fa));
2607
2607
  }
2608
2608
  for (const f of n)
2609
2609
  for (const { etype: l, lookupPair: p, linkLabel: y } of Na(f)) {
@@ -2613,17 +2613,17 @@ function Ka({ attrs: t, schema: e }, n) {
2613
2613
  const _ = V(o, l, y), w = Ae(o, l, y);
2614
2614
  d(_), d(w);
2615
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));
2616
+ if (yn(o, g, b))
2617
+ c(g, bn(b));
2618
2618
  else {
2619
2619
  const m = V(o, g, b);
2620
- m || u(Tt(e, g, b, Tn)), d(m);
2620
+ m || u(Tt(e, g, b, gn)), d(m);
2621
2621
  }
2622
- } else if (bn(o, l, b))
2623
- c(l, _n(b));
2622
+ } else if (yn(o, l, b))
2623
+ c(l, bn(b));
2624
2624
  else {
2625
2625
  const _ = V(o, l, b);
2626
- _ || u(Tt(e, l, b, Tn)), d(_);
2626
+ _ || u(Tt(e, l, b, gn)), d(_);
2627
2627
  }
2628
2628
  }
2629
2629
  for (const f of n) {
@@ -2635,7 +2635,7 @@ function Ka({ attrs: t, schema: e }, n) {
2635
2635
  const g = V(o, p, w);
2636
2636
  if (d(g), Ua.has(l) && (g || u(Tt(e, p, w, w === "id" ? { "unique?": !0 } : null))), Da.has(l)) {
2637
2637
  const m = Ae(o, p, w);
2638
- !g && !m && u(Rr(e, p, w)), d(m);
2638
+ !g && !m && u(Mr(e, p, w)), d(m);
2639
2639
  }
2640
2640
  }
2641
2641
  }
@@ -2673,7 +2673,7 @@ var de = function(t, e, n, r) {
2673
2673
  d((r = r.apply(t, e || [])).next());
2674
2674
  });
2675
2675
  };
2676
- function xr(t, e) {
2676
+ function Rr(t, e) {
2677
2677
  typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
2678
2678
  }
2679
2679
  const it = "__meta";
@@ -2681,7 +2681,7 @@ class Wa {
2681
2681
  constructor(e, n) {
2682
2682
  }
2683
2683
  }
2684
- class wn {
2684
+ class Tn {
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 = {
@@ -2875,7 +2875,7 @@ class wn {
2875
2875
  gc() {
2876
2876
  this._nextGc || (this._nextGc = setTimeout(
2877
2877
  () => {
2878
- xr(() => {
2878
+ Rr(() => {
2879
2879
  this._nextGc = null, this._gc();
2880
2880
  }, 30 * 1e3);
2881
2881
  },
@@ -2890,7 +2890,7 @@ class wn {
2890
2890
  return;
2891
2891
  }
2892
2892
  this._nextSave = setTimeout(() => {
2893
- xr(() => {
2893
+ Rr(() => {
2894
2894
  this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
2895
2895
  }, this._idleCallbackMaxWaitMs);
2896
2896
  }, this._saveThrottleMs);
@@ -3010,7 +3010,7 @@ function Qa(t, e, n) {
3010
3010
  });
3011
3011
  });
3012
3012
  }
3013
- function $r(t, e, n) {
3013
+ function xr(t, e, n) {
3014
3014
  return pe(this, void 0, void 0, function* () {
3015
3015
  const r = n.put(e, t);
3016
3016
  return new Promise((i, s) => {
@@ -3048,7 +3048,7 @@ function Ha(t, e) {
3048
3048
  break;
3049
3049
  }
3050
3050
  default: {
3051
- const l = $r(c, f, s);
3051
+ const l = xr(c, f, s);
3052
3052
  a.push(l);
3053
3053
  const p = {
3054
3054
  createdAt: Date.now(),
@@ -3059,13 +3059,13 @@ function Ha(t, e) {
3059
3059
  break;
3060
3060
  }
3061
3061
  }
3062
- const d = $r(it, u, s);
3062
+ const d = xr(it, u, s);
3063
3063
  a.push(d), yield Promise.all(a), yield new Promise((c, f) => {
3064
3064
  i.oncomplete = (l) => c(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
3065
3065
  });
3066
3066
  });
3067
3067
  }
3068
- const Dr = /* @__PURE__ */ new Map();
3068
+ const $r = /* @__PURE__ */ new Map();
3069
3069
  class Ki extends Wa {
3070
3070
  constructor(e, n) {
3071
3071
  super(e, n), this.dbName = `instant_${e}_${za}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
@@ -3082,9 +3082,9 @@ class Ki extends Wa {
3082
3082
  const u = Ha(this._appId, a).catch((d) => {
3083
3083
  Ba("Error upgrading store from version 5 to 6.")(d);
3084
3084
  });
3085
- Dr.set(this.dbName, u), u.then(() => e(a)).catch(() => e(a));
3085
+ $r.set(this.dbName, u), u.then(() => e(a)).catch(() => e(a));
3086
3086
  } else {
3087
- const u = Dr.get(this.dbName);
3087
+ const u = $r.get(this.dbName);
3088
3088
  u ? u.then(() => e(a)).catch(() => e(a)) : e(a);
3089
3089
  }
3090
3090
  }, i.onupgradeneeded = (s) => {
@@ -3338,7 +3338,7 @@ function tu(t) {
3338
3338
  });
3339
3339
  });
3340
3340
  }
3341
- function Ur(t) {
3341
+ function Dr(t) {
3342
3342
  return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
3343
3343
  return yield ue(`${e}/runtime/oauth/token`, {
3344
3344
  method: "POST",
@@ -3474,9 +3474,9 @@ function uu(t) {
3474
3474
  return s;
3475
3475
  });
3476
3476
  }
3477
- let Bn = !1, Wi = !1, zi = !1;
3478
- typeof window < "u" && typeof window.localStorage < "u" && (Bn = !!window.localStorage.getItem("devBackend"), Wi = !!window.localStorage.getItem("__instantLogging"), zi = !!window.localStorage.getItem("__devtoolLocalDash"));
3479
- function Lr(t, e) {
3477
+ let Vn = !1, Wi = !1, zi = !1;
3478
+ typeof window < "u" && typeof window.localStorage < "u" && (Vn = !!window.localStorage.getItem("devBackend"), Wi = !!window.localStorage.getItem("__instantLogging"), zi = !!window.localStorage.getItem("__devtoolLocalDash"));
3479
+ function Ur(t, e) {
3480
3480
  if (!e)
3481
3481
  return t;
3482
3482
  const n = {};
@@ -3490,27 +3490,27 @@ function cu(t, e, n) {
3490
3490
  peers: {}
3491
3491
  };
3492
3492
  if (e && "user" in e ? e.user : !0) {
3493
- const a = Lr((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
3493
+ const a = Ur((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
3494
3494
  s.user = Object.assign(Object.assign({}, a), { peerId: n });
3495
3495
  }
3496
3496
  for (const a of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
3497
3497
  const u = (e == null ? void 0 : e.peers) === void 0, d = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(a));
3498
3498
  if (u || d) {
3499
- const c = Lr(t.peers[a], e == null ? void 0 : e.keys);
3499
+ const c = Ur(t.peers[a], e == null ? void 0 : e.keys);
3500
3500
  s.peers[a] = Object.assign(Object.assign({}, c), { peerId: a });
3501
3501
  }
3502
3502
  }
3503
3503
  return s;
3504
3504
  }
3505
3505
  function du(t, e) {
3506
- if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !Sr(t.user, e.user)) || !gi(t.peers, e.peers))
3506
+ if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !vr(t.user, e.user)) || !gi(t.peers, e.peers))
3507
3507
  return !0;
3508
3508
  for (const r of Object.keys(t.peers))
3509
- if (!Sr(t.peers[r], e.peers[r]))
3509
+ if (!vr(t.peers[r], e.peers[r]))
3510
3510
  return !0;
3511
3511
  return !1;
3512
3512
  }
3513
- class Fr {
3513
+ class Lr {
3514
3514
  constructor() {
3515
3515
  this.promise = new Promise((e, n) => {
3516
3516
  this._resolve = e, this._reject = n;
@@ -3532,11 +3532,11 @@ function Vi(t, e = []) {
3532
3532
  Vi(n["child-nodes"], e);
3533
3533
  });
3534
3534
  }
3535
- function Nr(t) {
3535
+ function Fr(t) {
3536
3536
  const e = [];
3537
3537
  return Vi(t, e), e;
3538
3538
  }
3539
- function Kr(t) {
3539
+ function Nr(t) {
3540
3540
  return Object.values(t.links).reduce((e, n) => {
3541
3541
  var r, i, s, o;
3542
3542
  return (r = e[s = n.forward.on]) !== null && r !== void 0 || (e[s] = {}), e[n.forward.on][n.forward.label] = {
@@ -3550,7 +3550,7 @@ function Kr(t) {
3550
3550
  }, e;
3551
3551
  }, {});
3552
3552
  }
3553
- const Gn = "v0.22.69";
3553
+ const Bn = "v0.22.70";
3554
3554
  function fu(t, e) {
3555
3555
  return {
3556
3556
  info: t ? (...n) => console.info(...n, e()) : () => {
@@ -3624,7 +3624,7 @@ class R extends Error {
3624
3624
  super(r), this.name = "QueryValidationError";
3625
3625
  }
3626
3626
  }
3627
- const qr = [
3627
+ const Kr = [
3628
3628
  "where",
3629
3629
  "order",
3630
3630
  "limit",
@@ -3764,8 +3764,8 @@ const qr = [
3764
3764
  }
3765
3765
  }, yu = (t, e, n, r, i = 0) => {
3766
3766
  for (const o of Object.keys(t))
3767
- if (!qr.includes(o))
3768
- throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${qr.join(", ")}. Found: ${o}`, r);
3767
+ if (!Kr.includes(o))
3768
+ throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Kr.join(", ")}. Found: ${o}`, r);
3769
3769
  const s = [
3770
3770
  // 'limit', // only supported client side
3771
3771
  "offset",
@@ -3803,7 +3803,7 @@ const qr = [
3803
3803
  throw new R(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
3804
3804
  yu(a, e, n, `${r}.$`, i);
3805
3805
  }
3806
- }, Wr = (t, e) => {
3806
+ }, qr = (t, e) => {
3807
3807
  if (typeof t != "object" || t === null)
3808
3808
  throw new R(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
3809
3809
  if (Array.isArray(t))
@@ -3822,13 +3822,13 @@ const qr = [
3822
3822
  Qi(n[r], r, e, r, 0);
3823
3823
  }
3824
3824
  }
3825
- }, zr = (t) => typeof t != "string" ? !1 : Mt(t) ? !0 : Fe(t);
3825
+ }, Wr = (t) => typeof t != "string" ? !1 : Mt(t) ? !0 : Fe(t);
3826
3826
  class ie extends Error {
3827
3827
  constructor(e) {
3828
3828
  super(e), this.name = "TransactionValidationError";
3829
3829
  }
3830
3830
  }
3831
- const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`Entity '${t}' does not exist in schema. Available entities: ${Hi(e)}`), Vr = {
3831
+ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`Entity '${t}' does not exist in schema. Available entities: ${Hi(e)}`), zr = {
3832
3832
  string: (t) => typeof t == "string",
3833
3833
  number: (t) => typeof t == "number" && !isNaN(t),
3834
3834
  boolean: (t) => typeof t == "boolean",
@@ -3836,7 +3836,7 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3836
3836
  json: () => !0
3837
3837
  }, _u = (t, e) => {
3838
3838
  var n, r;
3839
- return t == null ? !0 : (r = (n = Vr[e.valueType]) === null || n === void 0 ? void 0 : n.call(Vr, t)) !== null && r !== void 0 ? r : !1;
3839
+ return t == null ? !0 : (r = (n = zr[e.valueType]) === null || n === void 0 ? void 0 : n.call(zr, t)) !== null && r !== void 0 ? r : !1;
3840
3840
  }, Yi = (t, e) => {
3841
3841
  const n = e.entities[t];
3842
3842
  if (!n)
@@ -3853,7 +3853,7 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3853
3853
  if (o && !_u(s, o))
3854
3854
  throw new ie(`Invalid value for attribute '${i}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof s}`);
3855
3855
  }
3856
- }, Br = (t, e, n) => {
3856
+ }, Vr = (t, e, n) => {
3857
3857
  const r = Yi(t, n);
3858
3858
  if (typeof e != "object" || e === null)
3859
3859
  throw new ie(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
@@ -3865,9 +3865,9 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3865
3865
  if (s != null) {
3866
3866
  if (Array.isArray(s)) {
3867
3867
  for (const a of s)
3868
- if (!zr(a))
3868
+ if (!Wr(a))
3869
3869
  throw new ie(`Invalid entity ID in link '${i}' for entity '${t}'. Expected a UUID or a lookup, but received: ${a}`);
3870
- } else if (!zr(s))
3870
+ } else if (!Wr(s))
3871
3871
  throw new ie(`Invalid UUID in link '${i}' for entity '${t}'. Expected a UUID, but received: ${s}`);
3872
3872
  }
3873
3873
  }
@@ -3875,8 +3875,8 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3875
3875
  create: Jt,
3876
3876
  update: Jt,
3877
3877
  merge: Jt,
3878
- link: Br,
3879
- unlink: Br,
3878
+ link: Vr,
3879
+ unlink: Vr,
3880
3880
  delete: () => {
3881
3881
  }
3882
3882
  }, Tu = (t, e) => {
@@ -3903,7 +3903,7 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3903
3903
  }
3904
3904
  }
3905
3905
  };
3906
- var Gr = function(t, e, n, r) {
3906
+ var Br = function(t, e, n, r) {
3907
3907
  function i(s) {
3908
3908
  return s instanceof n ? s : new n(function(o) {
3909
3909
  o(s);
@@ -3931,7 +3931,7 @@ var Gr = function(t, e, n, r) {
3931
3931
  });
3932
3932
  };
3933
3933
  let Ji = 0;
3934
- class Qr {
3934
+ class Gr {
3935
3935
  constructor(e) {
3936
3936
  this.type = "ws", this.id = `${this.type}_${Ji++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
3937
3937
  this.onopen && this.onopen({ target: this });
@@ -3963,7 +3963,7 @@ class Qr {
3963
3963
  }
3964
3964
  class mu {
3965
3965
  constructor(e, n) {
3966
- this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = null, this.id = `${this.type}_${Ji++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
3966
+ this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${Ji++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
3967
3967
  this.initParams || this.handleError();
3968
3968
  }, 1e4), this.conn.onmessage = (r) => {
3969
3969
  const i = JSON.parse(r.data);
@@ -3995,15 +3995,16 @@ class mu {
3995
3995
  this.conn.close(), this.onclose && !this.closeFired && (this.closeFired = !0, this.onclose({ target: this }));
3996
3996
  }
3997
3997
  postMessages(e) {
3998
- return Gr(this, void 0, void 0, function* () {
3998
+ return Br(this, void 0, void 0, function* () {
3999
+ var n, r, i;
3999
4000
  try {
4000
4001
  (yield fetch(this.url, {
4001
4002
  method: "POST",
4002
4003
  headers: { "Content-Type": "application/json" },
4003
4004
  body: JSON.stringify({
4004
- machine_id: this.initParams.machineId,
4005
- session_id: this.initParams.sessionId,
4006
- sse_token: this.initParams.sseToken,
4005
+ machine_id: (n = this.initParams) === null || n === void 0 ? void 0 : n.machineId,
4006
+ session_id: (r = this.initParams) === null || r === void 0 ? void 0 : r.sessionId,
4007
+ sse_token: (i = this.initParams) === null || i === void 0 ? void 0 : i.sseToken,
4007
4008
  messages: e
4008
4009
  })
4009
4010
  })).ok || this.handleError();
@@ -4013,7 +4014,7 @@ class mu {
4013
4014
  });
4014
4015
  }
4015
4016
  flushQueue() {
4016
- return Gr(this, void 0, void 0, function* () {
4017
+ return Br(this, void 0, void 0, function* () {
4017
4018
  if (this.sendPromise || !this.sendQueue.length)
4018
4019
  return;
4019
4020
  const e = this.sendQueue;
@@ -4039,7 +4040,7 @@ class mu {
4039
4040
  this.handleClose();
4040
4041
  }
4041
4042
  }
4042
- var Hr = function(t, e, n, r) {
4043
+ var Qr = function(t, e, n, r) {
4043
4044
  function i(s) {
4044
4045
  return s instanceof n ? s : new n(function(o) {
4045
4046
  o(s);
@@ -4093,7 +4094,7 @@ function Ou(t, e, n) {
4093
4094
  function Zt(t, e) {
4094
4095
  return Ui({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
4095
4096
  }
4096
- function Yr(t, e, n) {
4097
+ function Hr(t, e, n) {
4097
4098
  var r;
4098
4099
  const i = (r = Te(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
4099
4100
  if (!i)
@@ -4101,7 +4102,7 @@ function Yr(t, e, n) {
4101
4102
  const s = We(e.eav, [n, i, n]);
4102
4103
  return s ? s[3] : -1;
4103
4104
  }
4104
- function Jr(t, e) {
4105
+ function Yr(t, e) {
4105
4106
  for (const { action: n, triple: r } of e)
4106
4107
  switch (n) {
4107
4108
  case "added":
@@ -4170,7 +4171,7 @@ var ve;
4170
4171
  })(ve || (ve = {}));
4171
4172
  class ju {
4172
4173
  constructor(e, n, r, i, s) {
4173
- this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new wn({
4174
+ this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Tn({
4174
4175
  persister: n,
4175
4176
  merge: Ou,
4176
4177
  serialize: Su,
@@ -4231,7 +4232,7 @@ class ju {
4231
4232
  });
4232
4233
  }
4233
4234
  initSubscription(e, n, r) {
4234
- return Hr(this, void 0, void 0, function* () {
4235
+ return Qr(this, void 0, void 0, function* () {
4235
4236
  var i, s, o, a;
4236
4237
  yield this.subs.waitForKeyToLoad(n);
4237
4238
  const u = this.subs.currentValue[n];
@@ -4257,7 +4258,7 @@ class ju {
4257
4258
  });
4258
4259
  }
4259
4260
  flushPending() {
4260
- return Hr(this, void 0, void 0, function* () {
4261
+ return Qr(this, void 0, void 0, function* () {
4261
4262
  for (const e of Object.keys(this.callbacks)) {
4262
4263
  yield this.subs.waitForKeyToLoad(e);
4263
4264
  const n = this.subs.currentValue[e];
@@ -4306,7 +4307,7 @@ class ju {
4306
4307
  d.push({
4307
4308
  store: f,
4308
4309
  entity: l,
4309
- serverCreatedAt: Yr(a, f, l.id)
4310
+ serverCreatedAt: Hr(a, f, l.id)
4310
4311
  }), o.push(l);
4311
4312
  }
4312
4313
  this.subs.updateInPlace((c) => {
@@ -4377,7 +4378,7 @@ class ju {
4377
4378
  for (let E = 0; E < p.length; E++) {
4378
4379
  const S = p[E];
4379
4380
  if (oo(S.store, g)) {
4380
- Jr(S.store, m);
4381
+ Yr(S.store, m);
4381
4382
  const I = Zt(a, S.store), x = Eu(S.store, m)[g];
4382
4383
  I ? (y.push({
4383
4384
  oldEntity: S.entity,
@@ -4390,7 +4391,7 @@ class ju {
4390
4391
  const b = [];
4391
4392
  for (const [g, m] of Object.entries(f)) {
4392
4393
  const E = this.createStore([]);
4393
- l.attrs = E.attrs, Jr(E, m);
4394
+ l.attrs = E.attrs, Yr(E, m);
4394
4395
  const S = Zt(a, E);
4395
4396
  if (!S) {
4396
4397
  this.log.error("No entity found after applying change", {
@@ -4403,7 +4404,7 @@ class ju {
4403
4404
  p.push({
4404
4405
  store: E,
4405
4406
  entity: S,
4406
- serverCreatedAt: Yr(a, E, S.id)
4407
+ serverCreatedAt: Hr(a, E, S.id)
4407
4408
  }), b.push(S);
4408
4409
  }
4409
4410
  const _ = [];
@@ -4497,10 +4498,10 @@ const le = {
4497
4498
  }, Xt = "_instant_oauth_redirect", Qe = "currentUser";
4498
4499
  function xu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
4499
4500
  if (!i)
4500
- return new Qr(`${r}?app_id=${e}`);
4501
+ return new Gr(`${r}?app_id=${e}`);
4501
4502
  switch (t) {
4502
4503
  case "ws":
4503
- return new Qr(`${r}?app_id=${e}`);
4504
+ return new Gr(`${r}?app_id=${e}`);
4504
4505
  case "sse":
4505
4506
  return new mu(i, `${n}/runtime/sse?app_id=${e}`);
4506
4507
  default:
@@ -4510,7 +4511,7 @@ function xu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl:
4510
4511
  function $u() {
4511
4512
  return typeof window < "u" || typeof chrome < "u";
4512
4513
  }
4513
- const Zr = {
4514
+ const Jr = {
4514
4515
  "set-presence": !0,
4515
4516
  "set-presence-ok": !0,
4516
4517
  "refresh-presence": !0,
@@ -4550,7 +4551,7 @@ function Nu(t, e, n) {
4550
4551
  const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
4551
4552
  return r && !i && n && (n.result = r), n || e;
4552
4553
  }
4553
- function Xr(t) {
4554
+ function Zr(t) {
4554
4555
  return [...t].sort((e, n) => {
4555
4556
  const [r, i] = e, [s, o] = n, a = i.order || 0, u = o.order || 0;
4556
4557
  return a == u ? r < s ? -1 : r > s ? 1 : 0 : a - u;
@@ -4614,7 +4615,7 @@ class Ku {
4614
4615
  this._updatePendingMutations((_) => {
4615
4616
  _.set(f, y);
4616
4617
  });
4617
- const b = new Fr();
4618
+ const b = new Lr();
4618
4619
  return this.mutationDeferredStore.set(f, b), this._sendMutation(f, y), this.notifyAll(), b.promise;
4619
4620
  }, this._transportOnOpen = (d) => {
4620
4621
  const c = d.target;
@@ -4675,7 +4676,7 @@ class Ku {
4675
4676
  return;
4676
4677
  }
4677
4678
  this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
4678
- }, 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()) {
4679
+ }, 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 || Vn || Wi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Bn }), this.config.schema && (this._linkIndex = Nr(this.config.schema)), !!$u()) {
4679
4680
  if (!e.appId)
4680
4681
  throw new Error("Instant must be initialized with an appId.");
4681
4682
  if (!Fe(e.appId))
@@ -4700,7 +4701,7 @@ class Ku {
4700
4701
  }
4701
4702
  }
4702
4703
  updateSchema(e) {
4703
- this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ? Kr(this.config.schema) : null;
4704
+ this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ? Nr(this.config.schema) : null;
4704
4705
  }
4705
4706
  _reactorStats() {
4706
4707
  return {
@@ -4713,7 +4714,7 @@ class Ku {
4713
4714
  this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
4714
4715
  }
4715
4716
  _initStorage(e) {
4716
- this.querySubs = new wn({
4717
+ this.querySubs = new Tn({
4717
4718
  persister: new e(this.config.appId, "querySubs"),
4718
4719
  merge: Nu,
4719
4720
  serialize: Uu,
@@ -4733,7 +4734,7 @@ class Ku {
4733
4734
  maxSize: 1e6
4734
4735
  // 1 million triples
4735
4736
  }
4736
- }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new wn({
4737
+ }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Tn({
4737
4738
  persister: new e(this.config.appId, "kv"),
4738
4739
  merge: this._onMergeKv,
4739
4740
  serialize: Fu,
@@ -4792,7 +4793,7 @@ class Ku {
4792
4793
  _handleReceive(e, n) {
4793
4794
  var r, i, s, o, a, u;
4794
4795
  const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
4795
- switch (Zr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
4796
+ switch (Jr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
4796
4797
  case "init-ok": {
4797
4798
  this._setStatus(le.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
4798
4799
  for (const l of Object.keys(this._rooms)) {
@@ -4809,7 +4810,7 @@ class Ku {
4809
4810
  const { q: l, result: p } = n, y = z(l);
4810
4811
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
4811
4812
  break;
4812
- 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);
4813
+ 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 = Fr(p), g = Et(this.attrs, w, d, this._linkIndex, this.config.useDateObjects);
4813
4814
  this.querySubs.updateInPlace((m) => {
4814
4815
  if (!m[y]) {
4815
4816
  this._log.info("Missing value in querySubs", { hash: y, q: l });
@@ -4847,9 +4848,9 @@ class Ku {
4847
4848
  b !== this._pendingMutations() && this.kv.updateInPlace((g) => {
4848
4849
  g.pendingMutations = b;
4849
4850
  });
4850
- const _ = Xr(b.entries()), w = l.map((g) => {
4851
+ const _ = Zr(b.entries()), w = l.map((g) => {
4851
4852
  var m, E, S, I;
4852
- const x = g["instaql-query"], B = g["instaql-result"], Ve = z(x), lt = Nr(B), Ft = Et(this.attrs, lt, d, this._linkIndex, this.config.useDateObjects), Nt = this._applyOptimisticUpdates(Ft, _, y), ht = (E = (m = B == null ? void 0 : B[0]) === null || m === void 0 ? void 0 : m.data) === null || E === void 0 ? void 0 : E["page-info"], ce = (I = (S = B == null ? void 0 : B[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
4853
+ const x = g["instaql-query"], B = g["instaql-result"], Ve = z(x), lt = Fr(B), Ft = Et(this.attrs, lt, d, this._linkIndex, this.config.useDateObjects), Nt = this._applyOptimisticUpdates(Ft, _, y), ht = (E = (m = B == null ? void 0 : B[0]) === null || m === void 0 ? void 0 : m.data) === null || E === void 0 ? void 0 : E["page-info"], ce = (I = (S = B == null ? void 0 : B[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
4853
4854
  return { q: x, hash: Ve, store: Nt, pageInfo: ht, aggregate: ce };
4854
4855
  });
4855
4856
  w.forEach(({ hash: g, q: m, store: E, pageInfo: S, aggregate: I }) => {
@@ -5012,7 +5013,7 @@ class Ku {
5012
5013
  */
5013
5014
  subscribeQuery(e, n, r) {
5014
5015
  var i;
5015
- this.config.disableValidation || Wr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
5016
+ this.config.disableValidation || qr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
5016
5017
  const s = z(e), o = this.getPreviousResult(e);
5017
5018
  return o && n(o), this.queryCbs[s] = (i = this.queryCbs[s]) !== null && i !== void 0 ? i : [], this.queryCbs[s].push({ q: e, cb: n }), this._startQuerySub(e, s), () => {
5018
5019
  this._unsubQuery(e, s, n);
@@ -5020,8 +5021,8 @@ class Ku {
5020
5021
  }
5021
5022
  queryOnce(e, n) {
5022
5023
  var r;
5023
- this.config.disableValidation || Wr(e, this.config.schema), n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
5024
- const i = new Fr();
5024
+ this.config.disableValidation || qr(e, this.config.schema), n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
5025
+ const i = new Lr();
5025
5026
  if (!this._isOnline)
5026
5027
  return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
5027
5028
  if (!this.querySubs)
@@ -5098,7 +5099,7 @@ class Ku {
5098
5099
  return a ? d : n;
5099
5100
  }
5100
5101
  _rewriteMutationsSorted(e, n) {
5101
- return Xr(this._rewriteMutations(e, n).entries());
5102
+ return Zr(this._rewriteMutations(e, n).entries());
5102
5103
  }
5103
5104
  // ---------------------------
5104
5105
  // Transact
@@ -5228,7 +5229,7 @@ class Ku {
5228
5229
  }
5229
5230
  _trySend(e, n, r) {
5230
5231
  if (this._transport.isOpen()) {
5231
- switch (Zr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
5232
+ switch (Jr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
5232
5233
  case "transact": {
5233
5234
  this._inFlightMutationEventIds.add(e);
5234
5235
  break;
@@ -5322,7 +5323,7 @@ class Ku {
5322
5323
  return null;
5323
5324
  this._replaceUrlAfterOAuth();
5324
5325
  try {
5325
- const u = yield this._getCurrentUser(), d = (u == null ? void 0 : u.type) === "guest", { user: c } = yield Ur({
5326
+ const u = yield this._getCurrentUser(), d = (u == null ? void 0 : u.type) === "guest", { user: c } = yield Dr({
5326
5327
  apiURI: this.config.apiURI,
5327
5328
  appId: this.config.appId,
5328
5329
  code: a,
@@ -5534,7 +5535,7 @@ class Ku {
5534
5535
  exchangeCodeForToken(e) {
5535
5536
  return F(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
5536
5537
  var i;
5537
- const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield Ur({
5538
+ const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield Dr({
5538
5539
  apiURI: this.config.apiURI,
5539
5540
  appId: this.config.appId,
5540
5541
  code: n,
@@ -5662,7 +5663,7 @@ class Ku {
5662
5663
  Ks(d, c, l);
5663
5664
  break;
5664
5665
  case "r":
5665
- Or(d, c, l);
5666
+ Sr(d, c, l);
5666
5667
  break;
5667
5668
  case "-":
5668
5669
  wi(d, c);
@@ -5677,7 +5678,7 @@ class Ku {
5677
5678
  delete r[this._sessionId];
5678
5679
  const i = Object.fromEntries(Object.entries(r).map(([s, o]) => [s, o.data]));
5679
5680
  this._presence = Pt(this._presence, (s) => {
5680
- Or(s, [e, "result", "peers"], i);
5681
+ Sr(s, [e, "result", "peers"], i);
5681
5682
  });
5682
5683
  }
5683
5684
  // --------
@@ -5865,7 +5866,7 @@ function Ju(t, e) {
5865
5866
  return d();
5866
5867
  }
5867
5868
  function Zu(t) {
5868
- return `${Bn || zi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
5869
+ return `${Vn || zi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
5869
5870
  }
5870
5871
  function Xu(t) {
5871
5872
  const e = document.createElement("iframe");
@@ -5945,11 +5946,11 @@ function oc() {
5945
5946
  var t;
5946
5947
  return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
5947
5948
  }
5948
- function mn(t) {
5949
+ function wn(t) {
5949
5950
  const e = t.__adminToken;
5950
5951
  return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
5951
5952
  }
5952
- const vn = oc(), en = sc();
5953
+ const mn = oc(), Xr = sc();
5953
5954
  class ac {
5954
5955
  constructor(e) {
5955
5956
  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);
@@ -5965,7 +5966,7 @@ function cc(t) {
5965
5966
  }
5966
5967
  class dc {
5967
5968
  constructor(e) {
5968
- this.tx = Vn(), this._reactor = e, this.auth = new ac(this._reactor), this.storage = new uc(this._reactor);
5969
+ this.tx = zn(), this._reactor = e, this.auth = new ac(this._reactor), this.storage = new uc(this._reactor);
5969
5970
  }
5970
5971
  /**
5971
5972
  * Use this to write data! You can create, update, delete, and link objects
@@ -6106,7 +6107,7 @@ class dc {
6106
6107
  };
6107
6108
  }
6108
6109
  shutdown() {
6109
- delete vn[mn(this._reactor.config)], this._reactor.shutdown();
6110
+ delete mn[wn(this._reactor.config)], this._reactor.shutdown();
6110
6111
  }
6111
6112
  /**
6112
6113
  * Use this for one-off queries.
@@ -6142,20 +6143,21 @@ class dc {
6142
6143
  function ei(t) {
6143
6144
  if (!t)
6144
6145
  return "0";
6145
- if (en.get(t))
6146
- return en.get(t);
6147
- const e = z(t);
6148
- return en.set(t, e), e;
6146
+ const e = Xr.get(t);
6147
+ if (e)
6148
+ return e;
6149
+ const n = z(t);
6150
+ return Xr.set(t, n), n;
6149
6151
  }
6150
6152
  function fc(t, e) {
6151
6153
  return ei(t._reactor.config.schema) !== ei(e);
6152
6154
  }
6153
6155
  function lc(t, e, n, r, i) {
6154
- const s = vn[mn(t)];
6156
+ const s = mn[wn(t)];
6155
6157
  if (s)
6156
6158
  return fc(s, t.schema) && s._reactor.updateSchema(t.schema), s;
6157
- 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);
6158
- return vn[mn(t)] = a, hc(t.appId, t.devtool), a;
6159
+ 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": Bn }), i), a = new dc(o);
6160
+ return mn[wn(t)] = a, hc(t.appId, t.devtool), a;
6159
6161
  }
6160
6162
  function hc(t, e) {
6161
6163
  if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
@@ -6163,7 +6165,7 @@ function hc(t, e) {
6163
6165
  const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
6164
6166
  n.allowedHosts.includes(window.location.hostname) && Ju(t, n);
6165
6167
  }
6166
- var Sn = { exports: {} }, He = {};
6168
+ var vn = { exports: {} }, He = {};
6167
6169
  /**
6168
6170
  * @license React
6169
6171
  * react-jsx-runtime.production.min.js
@@ -6291,18 +6293,18 @@ function yc() {
6291
6293
  }
6292
6294
  return null;
6293
6295
  }
6294
- var we = Object.assign, Be = 0, Yn, Jn, Zn, Xn, er, tr, nr;
6295
- function rr() {
6296
+ var we = Object.assign, Be = 0, Hn, Yn, Jn, Zn, Xn, er, tr;
6297
+ function nr() {
6296
6298
  }
6297
- rr.__reactDisabledLog = !0;
6299
+ nr.__reactDisabledLog = !0;
6298
6300
  function es() {
6299
6301
  {
6300
6302
  if (Be === 0) {
6301
- Yn = console.log, Jn = console.info, Zn = console.warn, Xn = console.error, er = console.group, tr = console.groupCollapsed, nr = console.groupEnd;
6303
+ Hn = console.log, Yn = console.info, Jn = console.warn, Zn = console.error, Xn = console.group, er = console.groupCollapsed, tr = console.groupEnd;
6302
6304
  var h = {
6303
6305
  configurable: !0,
6304
6306
  enumerable: !0,
6305
- value: rr,
6307
+ value: nr,
6306
6308
  writable: !0
6307
6309
  };
6308
6310
  Object.defineProperties(console, {
@@ -6328,25 +6330,25 @@ function yc() {
6328
6330
  };
6329
6331
  Object.defineProperties(console, {
6330
6332
  log: we({}, h, {
6331
- value: Yn
6333
+ value: Hn
6332
6334
  }),
6333
6335
  info: we({}, h, {
6334
- value: Jn
6336
+ value: Yn
6335
6337
  }),
6336
6338
  warn: we({}, h, {
6337
- value: Zn
6339
+ value: Jn
6338
6340
  }),
6339
6341
  error: we({}, h, {
6340
- value: Xn
6342
+ value: Zn
6341
6343
  }),
6342
6344
  group: we({}, h, {
6343
- value: er
6345
+ value: Xn
6344
6346
  }),
6345
6347
  groupCollapsed: we({}, h, {
6346
- value: tr
6348
+ value: er
6347
6349
  }),
6348
6350
  groupEnd: we({}, h, {
6349
- value: nr
6351
+ value: tr
6350
6352
  })
6351
6353
  });
6352
6354
  }
@@ -6372,7 +6374,7 @@ function yc() {
6372
6374
  var ns = typeof WeakMap == "function" ? WeakMap : Map;
6373
6375
  yt = new ns();
6374
6376
  }
6375
- function ir(h, T) {
6377
+ function rr(h, T) {
6376
6378
  if (!h || Wt)
6377
6379
  return "";
6378
6380
  {
@@ -6444,7 +6446,7 @@ function yc() {
6444
6446
  return typeof h == "function" && yt.set(h, me), me;
6445
6447
  }
6446
6448
  function rs(h, T, v) {
6447
- return ir(h, !1);
6449
+ return rr(h, !1);
6448
6450
  }
6449
6451
  function is(h) {
6450
6452
  var T = h.prototype;
@@ -6454,7 +6456,7 @@ function yc() {
6454
6456
  if (h == null)
6455
6457
  return "";
6456
6458
  if (typeof h == "function")
6457
- return ir(h, is(h));
6459
+ return rr(h, is(h));
6458
6460
  if (typeof h == "string")
6459
6461
  return pt(h);
6460
6462
  switch (h) {
@@ -6479,13 +6481,13 @@ function yc() {
6479
6481
  }
6480
6482
  return "";
6481
6483
  }
6482
- var Ge = Object.prototype.hasOwnProperty, sr = {}, or = g.ReactDebugCurrentFrame;
6484
+ var Ge = Object.prototype.hasOwnProperty, ir = {}, sr = g.ReactDebugCurrentFrame;
6483
6485
  function _t(h) {
6484
6486
  if (h) {
6485
6487
  var T = h._owner, v = bt(h.type, h._source, T ? T.type : null);
6486
- or.setExtraStackFrame(v);
6488
+ sr.setExtraStackFrame(v);
6487
6489
  } else
6488
- or.setExtraStackFrame(null);
6490
+ sr.setExtraStackFrame(null);
6489
6491
  }
6490
6492
  function ss(h, T, v, O, P) {
6491
6493
  {
@@ -6502,7 +6504,7 @@ function yc() {
6502
6504
  } catch (D) {
6503
6505
  k = D;
6504
6506
  }
6505
- 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 sr) && (sr[k.message] = !0, _t(P), m("Failed %s type: %s", v, k.message), _t(null));
6507
+ 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));
6506
6508
  }
6507
6509
  }
6508
6510
  }
@@ -6518,24 +6520,24 @@ function yc() {
6518
6520
  }
6519
6521
  function us(h) {
6520
6522
  try {
6521
- return ar(h), !1;
6523
+ return or(h), !1;
6522
6524
  } catch {
6523
6525
  return !0;
6524
6526
  }
6525
6527
  }
6526
- function ar(h) {
6528
+ function or(h) {
6527
6529
  return "" + h;
6528
6530
  }
6529
- function ur(h) {
6531
+ function ar(h) {
6530
6532
  if (us(h))
6531
- 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);
6533
+ 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)), or(h);
6532
6534
  }
6533
- var cr = g.ReactCurrentOwner, cs = {
6535
+ var ur = g.ReactCurrentOwner, cs = {
6534
6536
  key: !0,
6535
6537
  ref: !0,
6536
6538
  __self: !0,
6537
6539
  __source: !0
6538
- }, dr, fr;
6540
+ }, cr, dr;
6539
6541
  function ds(h) {
6540
6542
  if (Ge.call(h, "ref")) {
6541
6543
  var T = Object.getOwnPropertyDescriptor(h, "ref").get;
@@ -6553,12 +6555,12 @@ function yc() {
6553
6555
  return h.key !== void 0;
6554
6556
  }
6555
6557
  function ls(h, T) {
6556
- typeof h.ref == "string" && cr.current;
6558
+ typeof h.ref == "string" && ur.current;
6557
6559
  }
6558
6560
  function hs(h, T) {
6559
6561
  {
6560
6562
  var v = function() {
6561
- 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));
6563
+ cr || (cr = !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));
6562
6564
  };
6563
6565
  v.isReactWarning = !0, Object.defineProperty(h, "key", {
6564
6566
  get: v,
@@ -6569,7 +6571,7 @@ function yc() {
6569
6571
  function ps(h, T) {
6570
6572
  {
6571
6573
  var v = function() {
6572
- 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));
6574
+ dr || (dr = !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));
6573
6575
  };
6574
6576
  v.isReactWarning = !0, Object.defineProperty(h, "ref", {
6575
6577
  get: v,
@@ -6609,7 +6611,7 @@ function yc() {
6609
6611
  function bs(h, T, v, O, P) {
6610
6612
  {
6611
6613
  var M, C = {}, k = null, G = null;
6612
- v !== void 0 && (ur(v), k = "" + v), fs(T) && (ur(T.key), k = "" + T.key), ds(T) && (G = T.ref, ls(T, P));
6614
+ v !== void 0 && (ar(v), k = "" + v), fs(T) && (ar(T.key), k = "" + T.key), ds(T) && (G = T.ref, ls(T, P));
6613
6615
  for (M in T)
6614
6616
  Ge.call(T, M) && !cs.hasOwnProperty(M) && (C[M] = T[M]);
6615
6617
  if (h && h.defaultProps) {
@@ -6621,23 +6623,23 @@ function yc() {
6621
6623
  var L = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
6622
6624
  k && hs(C, L), G && ps(C, L);
6623
6625
  }
6624
- return ys(h, k, G, P, O, cr.current, C);
6626
+ return ys(h, k, G, P, O, ur.current, C);
6625
6627
  }
6626
6628
  }
6627
- var Vt = g.ReactCurrentOwner, lr = g.ReactDebugCurrentFrame;
6629
+ var Vt = g.ReactCurrentOwner, fr = g.ReactDebugCurrentFrame;
6628
6630
  function Pe(h) {
6629
6631
  if (h) {
6630
6632
  var T = h._owner, v = bt(h.type, h._source, T ? T.type : null);
6631
- lr.setExtraStackFrame(v);
6633
+ fr.setExtraStackFrame(v);
6632
6634
  } else
6633
- lr.setExtraStackFrame(null);
6635
+ fr.setExtraStackFrame(null);
6634
6636
  }
6635
6637
  var Bt;
6636
6638
  Bt = !1;
6637
6639
  function Gt(h) {
6638
6640
  return typeof h == "object" && h !== null && h.$$typeof === n;
6639
6641
  }
6640
- function hr() {
6642
+ function lr() {
6641
6643
  {
6642
6644
  if (Vt.current) {
6643
6645
  var h = ce(Vt.current.type);
@@ -6652,10 +6654,10 @@ Check the render method of \`` + h + "`.";
6652
6654
  function _s(h) {
6653
6655
  return "";
6654
6656
  }
6655
- var pr = {};
6657
+ var hr = {};
6656
6658
  function gs(h) {
6657
6659
  {
6658
- var T = hr();
6660
+ var T = lr();
6659
6661
  if (!T) {
6660
6662
  var v = typeof h == "string" ? h : h.displayName || h.name;
6661
6663
  v && (T = `
@@ -6665,27 +6667,27 @@ Check the top-level render call using <` + v + ">.");
6665
6667
  return T;
6666
6668
  }
6667
6669
  }
6668
- function yr(h, T) {
6670
+ function pr(h, T) {
6669
6671
  {
6670
6672
  if (!h._store || h._store.validated || h.key != null)
6671
6673
  return;
6672
6674
  h._store.validated = !0;
6673
6675
  var v = gs(T);
6674
- if (pr[v])
6676
+ if (hr[v])
6675
6677
  return;
6676
- pr[v] = !0;
6678
+ hr[v] = !0;
6677
6679
  var O = "";
6678
6680
  h && h._owner && h._owner !== Vt.current && (O = " It was passed a child from " + ce(h._owner.type) + "."), Pe(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), Pe(null);
6679
6681
  }
6680
6682
  }
6681
- function br(h, T) {
6683
+ function yr(h, T) {
6682
6684
  {
6683
6685
  if (typeof h != "object")
6684
6686
  return;
6685
6687
  if (zt(h))
6686
6688
  for (var v = 0; v < h.length; v++) {
6687
6689
  var O = h[v];
6688
- Gt(O) && yr(O, T);
6690
+ Gt(O) && pr(O, T);
6689
6691
  }
6690
6692
  else if (Gt(h))
6691
6693
  h._store && (h._store.validated = !0);
@@ -6693,7 +6695,7 @@ Check the top-level render call using <` + v + ">.");
6693
6695
  var P = w(h);
6694
6696
  if (typeof P == "function" && P !== h.entries)
6695
6697
  for (var M = P.call(h), C; !(C = M.next()).done; )
6696
- Gt(C.value) && yr(C.value, T);
6698
+ Gt(C.value) && pr(C.value, T);
6697
6699
  }
6698
6700
  }
6699
6701
  }
@@ -6734,15 +6736,15 @@ Check the top-level render call using <` + v + ">.");
6734
6736
  h.ref !== null && (Pe(h), m("Invalid attribute `ref` supplied to `React.Fragment`."), Pe(null));
6735
6737
  }
6736
6738
  }
6737
- var _r = {};
6738
- function gr(h, T, v, O, P, M) {
6739
+ var br = {};
6740
+ function _r(h, T, v, O, P, M) {
6739
6741
  {
6740
6742
  var C = Ft(h);
6741
6743
  if (!C) {
6742
6744
  var k = "";
6743
6745
  (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.");
6744
6746
  var G = _s();
6745
- G ? k += G : k += hr();
6747
+ G ? k += G : k += lr();
6746
6748
  var D;
6747
6749
  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);
6748
6750
  }
@@ -6755,43 +6757,43 @@ Check the top-level render call using <` + v + ">.");
6755
6757
  if (O)
6756
6758
  if (zt(re)) {
6757
6759
  for (var Ie = 0; Ie < re.length; Ie++)
6758
- br(re[Ie], h);
6760
+ yr(re[Ie], h);
6759
6761
  Object.freeze && Object.freeze(re);
6760
6762
  } else
6761
6763
  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.");
6762
6764
  else
6763
- br(re, h);
6765
+ yr(re, h);
6764
6766
  }
6765
6767
  if (Ge.call(T, "key")) {
6766
6768
  var me = ce(h), Y = Object.keys(T).filter(function(As) {
6767
6769
  return As !== "key";
6768
6770
  }), Qt = Y.length > 0 ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}";
6769
- if (!_r[me + Qt]) {
6771
+ if (!br[me + Qt]) {
6770
6772
  var Es = Y.length > 0 ? "{" + Y.join(": ..., ") + ": ...}" : "{}";
6771
6773
  m(`A props object containing a "key" prop is being spread into JSX:
6772
6774
  let props = %s;
6773
6775
  <%s {...props} />
6774
6776
  React keys must be passed directly to JSX without using spread:
6775
6777
  let props = %s;
6776
- <%s key={someKey} {...props} />`, Qt, me, Es, me), _r[me + Qt] = !0;
6778
+ <%s key={someKey} {...props} />`, Qt, me, Es, me), br[me + Qt] = !0;
6777
6779
  }
6778
6780
  }
6779
6781
  return h === i ? ws(L) : Ts(L), L;
6780
6782
  }
6781
6783
  }
6782
6784
  function ms(h, T, v) {
6783
- return gr(h, T, v, !0);
6785
+ return _r(h, T, v, !0);
6784
6786
  }
6785
6787
  function vs(h, T, v) {
6786
- return gr(h, T, v, !1);
6788
+ return _r(h, T, v, !1);
6787
6789
  }
6788
6790
  var Ss = vs, Os = ms;
6789
6791
  Ye.Fragment = i, Ye.jsx = Ss, Ye.jsxs = Os;
6790
6792
  }(), Ye;
6791
6793
  }
6792
6794
  var bc = {};
6793
- bc.NODE_ENV === "production" ? Sn.exports = pc() : Sn.exports = yc();
6794
- var W = Sn.exports;
6795
+ bc.NODE_ENV === "production" ? vn.exports = pc() : vn.exports = yc();
6796
+ var W = vn.exports;
6795
6797
  const _c = {
6796
6798
  isLoading: !0,
6797
6799
  data: void 0,
@@ -6811,7 +6813,7 @@ function gc(t, e, n) {
6811
6813
  // Build a new subscribe function if the query changes
6812
6814
  [i]
6813
6815
  );
6814
- return { state: nn(o, () => s.current, () => _c), query: r };
6816
+ return { state: tn(o, () => s.current, () => _c), query: r };
6815
6817
  }
6816
6818
  function Tc() {
6817
6819
  const t = at(null);
@@ -6858,7 +6860,7 @@ function Sc(t, e = {}) {
6858
6860
  const o = ge((u) => {
6859
6861
  t.core._reactor.publishPresence(t.type, t.id, u);
6860
6862
  }, [t.type, t.id]);
6861
- return rn(() => Object.assign(Object.assign({}, i), { publishPresence: o }), [i, o]);
6863
+ return nn(() => Object.assign(Object.assign({}, i), { publishPresence: o }), [i, o]);
6862
6864
  }
6863
6865
  function Oc(t, e, n) {
6864
6866
  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)]);
@@ -6866,7 +6868,7 @@ function Oc(t, e, n) {
6866
6868
  function Ec(t, e, n = {}) {
6867
6869
  const r = Tc(), i = Se.usePresence(t, {
6868
6870
  keys: [e]
6869
- }), s = rn(() => {
6871
+ }), s = nn(() => {
6870
6872
  var c;
6871
6873
  const f = t._core._reactor.getPresence(t.type, t.id);
6872
6874
  return n != null && n.writeOnly ? [] : Object.values((c = f == null ? void 0 : f.peers) !== null && c !== void 0 ? c : {}).filter((l) => l[e] === !0);
@@ -6884,7 +6886,7 @@ function Ec(t, e, n = {}) {
6884
6886
  o(l);
6885
6887
  }, [n.stopOnEnter, o]), u = ge(() => {
6886
6888
  o(!1);
6887
- }, [o]), d = rn(() => ({ onKeyDown: a, onBlur: u }), [a, u]);
6889
+ }, [o]), d = nn(() => ({ onKeyDown: a, onBlur: u }), [a, u]);
6888
6890
  return {
6889
6891
  active: s,
6890
6892
  setActive: o,
@@ -6939,7 +6941,7 @@ const jc = {
6939
6941
  };
6940
6942
  class Cc {
6941
6943
  constructor(e, n) {
6942
- this.tx = Vn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
6944
+ this.tx = zn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
6943
6945
  const [i, s] = di(null);
6944
6946
  return ke(() => {
6945
6947
  kc(this, void 0, void 0, function* () {
@@ -6951,7 +6953,7 @@ class Cc {
6951
6953
  const r = at(this.core._reactor._currentUserCached), i = ge((o) => this.core.subscribeAuth((u) => {
6952
6954
  r.current = Object.assign({ isLoading: !1 }, u), o();
6953
6955
  }), []);
6954
- return nn(i, () => r.current, () => jc);
6956
+ return tn(i, () => r.current, () => jc);
6955
6957
  }, this.useUser = () => {
6956
6958
  const { user: r } = this.useAuth();
6957
6959
  if (!r)
@@ -6961,7 +6963,7 @@ class Cc {
6961
6963
  const r = at(this.core._reactor.status), i = ge((o) => this.core.subscribeConnectionStatus((u) => {
6962
6964
  u !== r.current && (r.current = u, o());
6963
6965
  }), []);
6964
- return nn(
6966
+ return tn(
6965
6967
  i,
6966
6968
  () => r.current,
6967
6969
  // For SSR, always return 'connecting' as the initial state
@@ -7018,14 +7020,14 @@ class ii extends Error {
7018
7020
  super(e), this.name = "ParseError", this.type = n.type, this.field = n.field, this.value = n.value, this.line = n.line;
7019
7021
  }
7020
7022
  }
7021
- function tn(t) {
7023
+ function en(t) {
7022
7024
  }
7023
7025
  function Pc(t) {
7024
7026
  if (typeof t == "function")
7025
7027
  throw new TypeError(
7026
7028
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
7027
7029
  );
7028
- const { onEvent: e = tn, onError: n = tn, onRetry: r = tn, onComment: i } = t;
7030
+ const { onEvent: e = en, onError: n = en, onRetry: r = en, onComment: i } = t;
7029
7031
  let s = "", o = !0, a, u = "", d = "";
7030
7032
  function c(b) {
7031
7033
  const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, g] = Ic(`${s}${_}`);
@@ -7160,8 +7162,8 @@ function Mc(t) {
7160
7162
  const e = globalThis.DOMException;
7161
7163
  return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
7162
7164
  }
7163
- function On(t) {
7164
- return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(On).join(", ") : "cause" in t && t.cause instanceof Error ? `${t}: ${On(t.cause)}` : t.message : `${t}`;
7165
+ function Sn(t) {
7166
+ return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(Sn).join(", ") : "cause" in t && t.cause instanceof Error ? `${t}: ${Sn(t.cause)}` : t.message : `${t}`;
7165
7167
  }
7166
7168
  function oi(t) {
7167
7169
  return {
@@ -7175,11 +7177,11 @@ function oi(t) {
7175
7177
  }
7176
7178
  var Xi = (t) => {
7177
7179
  throw TypeError(t);
7178
- }, 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, Oe, Re, At, Rt, st, De, ot, _e, xe, Le, $e, et, se, En, An, kn, ai, jn, Cn, tt, Pn, In;
7180
+ }, 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;
7179
7181
  class kt extends EventTarget {
7180
7182
  constructor(e, n) {
7181
7183
  var r, i;
7182
- 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, An, async (s) => {
7184
+ 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) => {
7183
7185
  var o;
7184
7186
  A(this, xe).reset();
7185
7187
  const { body: a, redirected: u, status: d, headers: c } = s;
@@ -7207,11 +7209,11 @@ class kt extends EventTarget {
7207
7209
  let y = !0;
7208
7210
  do {
7209
7211
  const { done: b, value: _ } = await p.read();
7210
- _ && A(this, xe).feed(l.decode(_, { stream: !b })), b && (y = !1, A(this, xe).reset(), he(this, se, Pn).call(this));
7212
+ _ && A(this, xe).feed(l.decode(_, { stream: !b })), b && (y = !1, A(this, xe).reset(), he(this, se, Cn).call(this));
7211
7213
  } while (y);
7214
+ }), N(this, An, (s) => {
7215
+ $(this, _e, void 0), !(s.name === "AbortError" || s.type === "aborted") && he(this, se, Cn).call(this, Sn(s));
7212
7216
  }), N(this, kn, (s) => {
7213
- $(this, _e, void 0), !(s.name === "AbortError" || s.type === "aborted") && he(this, se, Pn).call(this, On(s));
7214
- }), N(this, jn, (s) => {
7215
7217
  typeof s.id == "string" && $(this, ot, s.id);
7216
7218
  const o = new MessageEvent(s.event || "message", {
7217
7219
  data: s.data,
@@ -7219,10 +7221,10 @@ class kt extends EventTarget {
7219
7221
  lastEventId: s.id || ""
7220
7222
  });
7221
7223
  A(this, $e) && (!s.event || s.event === "message") && A(this, $e).call(this, o), this.dispatchEvent(o);
7222
- }), N(this, Cn, (s) => {
7224
+ }), N(this, jn, (s) => {
7223
7225
  $(this, st, s);
7224
- }), N(this, In, () => {
7225
- $(this, De, void 0), A(this, J) === this.CONNECTING && he(this, se, En).call(this);
7226
+ }), N(this, Pn, () => {
7227
+ $(this, De, void 0), A(this, J) === this.CONNECTING && he(this, se, On).call(this);
7226
7228
  });
7227
7229
  try {
7228
7230
  if (e instanceof URL)
@@ -7235,9 +7237,9 @@ class kt extends EventTarget {
7235
7237
  throw Mc("An invalid or illegal string was specified");
7236
7238
  }
7237
7239
  $(this, xe, Pc({
7238
- onEvent: A(this, jn),
7239
- onRetry: A(this, Cn)
7240
- })), $(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);
7240
+ onEvent: A(this, kn),
7241
+ onRetry: A(this, jn)
7242
+ })), $(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);
7241
7243
  }
7242
7244
  /**
7243
7245
  * Returns the state of this EventSource object's connection. It can have the values described below.
@@ -7315,9 +7317,9 @@ J = /* @__PURE__ */ new WeakMap(), Oe = /* @__PURE__ */ new WeakMap(), Re = /* @
7315
7317
  *
7316
7318
  * @internal
7317
7319
  */
7318
- En = function() {
7319
- $(this, J, this.CONNECTING), $(this, _e, new AbortController()), A(this, Rt)(A(this, Oe), he(this, se, ai).call(this)).then(A(this, An)).catch(A(this, kn));
7320
- }, An = /* @__PURE__ */ new WeakMap(), kn = /* @__PURE__ */ new WeakMap(), /**
7320
+ On = function() {
7321
+ $(this, J, this.CONNECTING), $(this, _e, new AbortController()), A(this, Rt)(A(this, Oe), he(this, se, ai).call(this)).then(A(this, En)).catch(A(this, An));
7322
+ }, En = /* @__PURE__ */ new WeakMap(), An = /* @__PURE__ */ new WeakMap(), /**
7321
7323
  * Get request options for the `fetch()` request
7322
7324
  *
7323
7325
  * @returns The request options
@@ -7335,7 +7337,7 @@ ai = function() {
7335
7337
  signal: (t = A(this, _e)) == null ? void 0 : t.signal
7336
7338
  };
7337
7339
  return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
7338
- }, jn = /* @__PURE__ */ new WeakMap(), Cn = /* @__PURE__ */ new WeakMap(), /**
7340
+ }, kn = /* @__PURE__ */ new WeakMap(), jn = /* @__PURE__ */ new WeakMap(), /**
7339
7341
  * Handles the process referred to in the EventSource specification as "failing a connection".
7340
7342
  *
7341
7343
  * @param error - The error causing the connection to fail
@@ -7354,14 +7356,14 @@ tt = function(t, e) {
7354
7356
  * @param code - The HTTP status code, if available
7355
7357
  * @internal
7356
7358
  */
7357
- Pn = function(t, e) {
7359
+ Cn = function(t, e) {
7358
7360
  var n;
7359
7361
  if (A(this, J) === this.CLOSED)
7360
7362
  return;
7361
7363
  $(this, J, this.CONNECTING);
7362
7364
  const r = new si("error", { code: e, message: t });
7363
- (n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r), $(this, De, setTimeout(A(this, In), A(this, st)));
7364
- }, In = /* @__PURE__ */ new WeakMap(), /**
7365
+ (n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r), $(this, De, setTimeout(A(this, Pn), A(this, st)));
7366
+ }, Pn = /* @__PURE__ */ new WeakMap(), /**
7365
7367
  * ReadyState representing an EventSource currently trying to connect
7366
7368
  *
7367
7369
  * @public
@@ -7381,15 +7383,15 @@ function Rc() {
7381
7383
  const t = "document" in globalThis ? globalThis.document : void 0;
7382
7384
  return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
7383
7385
  }
7384
- const Hn = class Hn extends Cc {
7386
+ const Qn = class Qn extends Cc {
7385
7387
  };
7386
- Hn.EventSourceImpl = kt;
7387
- let Mn = Hn;
7388
+ Qn.EventSourceImpl = kt;
7389
+ let In = Qn;
7388
7390
  function xc(t) {
7389
- return new Mn(
7391
+ return new In(
7390
7392
  t,
7391
7393
  {
7392
- "@instantdb/react": Gn
7394
+ "@instantdb/react": Bn
7393
7395
  }
7394
7396
  );
7395
7397
  }
@@ -7556,7 +7558,7 @@ export {
7556
7558
  Wc as Cursors,
7557
7559
  Dt as InstantAPIError,
7558
7560
  Cc as InstantReactAbstractDatabase,
7559
- Mn as InstantReactWebDatabase,
7561
+ In as InstantReactWebDatabase,
7560
7562
  ve as SyncTableCallbackEventType,
7561
7563
  Kc as i,
7562
7564
  K as id,