@instantdb/react 0.22.162 → 0.22.163-branch-dwwoelfel-patch-3.23205861850.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  var mi = Object.defineProperty;
2
2
  var wi = (n, e, t) => e in n ? mi(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
3
  var h = (n, e, t) => wi(n, typeof e != "symbol" ? e + "" : e, t);
4
- import rs, { useRef as Xe, useCallback as Me, useSyncExternalStore as dn, useEffect as Fe, useMemo as hn, useState as ss, createElement as Ti } from "react";
4
+ import rs, { useRef as et, useCallback as Me, useSyncExternalStore as dn, useEffect as Fe, useMemo as hn, useState as ss, createElement as Ti } from "react";
5
5
  function J(n) {
6
6
  if (typeof n == "number")
7
7
  return (Math.abs(n * 2654435761) >>> 0).toString(16);
@@ -48,7 +48,7 @@ const q = {
48
48
  mutable: "mutable",
49
49
  immutable: "immutable"
50
50
  }, Nn = {};
51
- function ht(n, e) {
51
+ function pt(n, e) {
52
52
  return n instanceof Map ? n.has(e) : Object.prototype.hasOwnProperty.call(n, e);
53
53
  }
54
54
  function br(n, e) {
@@ -95,7 +95,7 @@ function os(n, e = []) {
95
95
  if (r !== null && (r == null ? void 0 : r.original) !== n.original)
96
96
  return null;
97
97
  const s = n.parent.type === 3, i = s ? Array.from(n.parent.setMap.keys()).indexOf(n.key) : n.key;
98
- if (!(s && t.size > i || ht(t, i)))
98
+ if (!(s && t.size > i || pt(t, i)))
99
99
  return null;
100
100
  e.push(i);
101
101
  }
@@ -199,15 +199,15 @@ function as(n, e) {
199
199
  function re(n) {
200
200
  n.copy || (n.copy = as(n.original, n.options));
201
201
  }
202
- function at(n) {
202
+ function ct(n) {
203
203
  if (!Se(n))
204
204
  return qn(n);
205
205
  if (Array.isArray(n))
206
- return n.map(at);
206
+ return n.map(ct);
207
207
  if (n instanceof Map) {
208
208
  const t = Array.from(n.entries()).map(([r, s]) => [
209
209
  r,
210
- at(s)
210
+ ct(s)
211
211
  ]);
212
212
  if (!Kn(n)) {
213
213
  const r = Object.getPrototypeOf(n).constructor;
@@ -216,7 +216,7 @@ function at(n) {
216
216
  return new Map(t);
217
217
  }
218
218
  if (n instanceof Set) {
219
- const t = Array.from(n).map(at);
219
+ const t = Array.from(n).map(ct);
220
220
  if (!Wn(n)) {
221
221
  const r = Object.getPrototypeOf(n).constructor;
222
222
  return new r(t);
@@ -225,11 +225,11 @@ function at(n) {
225
225
  }
226
226
  const e = Object.create(Object.getPrototypeOf(n));
227
227
  for (const t in n)
228
- e[t] = at(n[t]);
228
+ e[t] = ct(n[t]);
229
229
  return e;
230
230
  }
231
231
  function Rt(n) {
232
- return Ne(n) ? at(n) : n;
232
+ return Ne(n) ? ct(n) : n;
233
233
  }
234
234
  function Oe(n) {
235
235
  var e;
@@ -397,7 +397,7 @@ function ki(n, e, t, r, s) {
397
397
  }
398
398
  function Ci({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
399
399
  t.forEach((a, c) => {
400
- const u = Ie(n, c), l = Rt(Ie(e, c)), f = a ? ht(n, c) ? q.Replace : q.Add : q.Remove;
400
+ const u = Ie(n, c), l = Rt(Ie(e, c)), f = a ? pt(n, c) ? q.Replace : q.Add : q.Remove;
401
401
  if (Ce(u, l) && f === q.Replace)
402
402
  return;
403
403
  const p = r.concat(c), y = Ue(p, o);
@@ -672,7 +672,7 @@ const Mi = Reflect.ownKeys(Ft), us = /* @__PURE__ */ new WeakSet(), ls = {
672
672
  if (u)
673
673
  return u.bind(n.proxy);
674
674
  }
675
- if (!ht(a, e)) {
675
+ if (!pt(a, e)) {
676
676
  const u = br(a, e);
677
677
  return u ? "value" in u ? u.value : (
678
678
  // !case: support for getter
@@ -708,7 +708,7 @@ const Mi = Reflect.ownKeys(Ft), us = /* @__PURE__ */ new WeakSet(), ls = {
708
708
  if (i != null && i.set)
709
709
  return i.set.call(n.proxy, t), !0;
710
710
  const o = rn(he(n), e), a = R(o);
711
- return a && Ce(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Ce(t, o) && (t !== void 0 || ht(n.original, e)) || (re(n), Oe(n), ht(n.original, e) && Ce(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, Vn(n, e, t, _t)), !0);
711
+ return a && Ce(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Ce(t, o) && (t !== void 0 || pt(n.original, e)) || (re(n), Oe(n), pt(n.original, e) && Ce(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, Vn(n, e, t, _t)), !0);
712
712
  },
713
713
  has(n, e) {
714
714
  return e in he(n);
@@ -948,7 +948,7 @@ function jt(n, e) {
948
948
  return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : ds(n, e) ? Object.keys(n).every((t) => jt(n[t], e[t])) : !1;
949
949
  }
950
950
  function Gn(n) {
951
- if (!ct(n))
951
+ if (!ut(n))
952
952
  return n;
953
953
  const e = {};
954
954
  for (const [t, r] of Object.entries(n))
@@ -956,7 +956,7 @@ function Gn(n) {
956
956
  return e;
957
957
  }
958
958
  function hs(n, e) {
959
- if (!ct(n) || !ct(e))
959
+ if (!ut(n) || !ut(e))
960
960
  return e;
961
961
  const t = { ...n };
962
962
  for (const r of Object.keys(e)) {
@@ -966,12 +966,12 @@ function hs(n, e) {
966
966
  delete t[r];
967
967
  continue;
968
968
  }
969
- const s = ct(n[r]) && ct(e[r]);
969
+ const s = ut(n[r]) && ut(e[r]);
970
970
  t[r] = s ? hs(n[r], e[r]) : e[r];
971
971
  }
972
972
  return t;
973
973
  }
974
- function ct(n) {
974
+ function ut(n) {
975
975
  return typeof n == "object" && n !== null && !Array.isArray(n);
976
976
  }
977
977
  function $i(n, e, t) {
@@ -1418,7 +1418,7 @@ function Qn(n) {
1418
1418
  function Hn(n) {
1419
1419
  return n["value-type"] === "blob";
1420
1420
  }
1421
- function nt(n, e) {
1421
+ function rt(n, e) {
1422
1422
  return e.reduce((t, r) => t && t.get(r), n);
1423
1423
  }
1424
1424
  function Te(n, e) {
@@ -1463,7 +1463,7 @@ function bs(n) {
1463
1463
  };
1464
1464
  }
1465
1465
  function gs(n, e) {
1466
- return ut(n, e.triples, e.cardinalityInference, e.useDateObjects);
1466
+ return lt(n, e.triples, e.cardinalityInference, e.useDateObjects);
1467
1467
  }
1468
1468
  function _s(n, e) {
1469
1469
  if (n)
@@ -1472,9 +1472,9 @@ function _s(n, e) {
1472
1472
  return new Le(e.attrs, e.linkIndex);
1473
1473
  }
1474
1474
  function to(n, e) {
1475
- return nt(n.eav, [e]) !== void 0;
1475
+ return rt(n.eav, [e]) !== void 0;
1476
1476
  }
1477
- function ut(n, e, t, r) {
1477
+ function lt(n, e, t, r) {
1478
1478
  const s = ys(n, e, r);
1479
1479
  return s.cardinalityInference = t, s.useDateObjects = r, s;
1480
1480
  }
@@ -1516,7 +1516,7 @@ let no = 0;
1516
1516
  function ws(n, e, t) {
1517
1517
  const [r, s, i] = t;
1518
1518
  let o;
1519
- const a = nt(n.eav, [r, s, i]);
1519
+ const a = rt(n.eav, [r, s, i]);
1520
1520
  return a && (o = a[3]), o || Date.now() * 10 + no++;
1521
1521
  }
1522
1522
  function Ts(n, e, t) {
@@ -1528,7 +1528,7 @@ function Ts(n, e, t) {
1528
1528
  if (!a)
1529
1529
  return;
1530
1530
  a["checked-data-type"] === "date" && n.useDateObjects && (o = zt(o));
1531
- const c = nt(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? ws(n, a, r), l = [s, i, o, u];
1531
+ const c = rt(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? ws(n, a, r), l = [s, i, o, u];
1532
1532
  eo(a) ? (le(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (le(n.eav, [s, i, o], l), le(n.aev, [i, s, o], l)), Qn(a) && le(n.vae, [o, i, s], l);
1533
1533
  }
1534
1534
  function ro(n, e, t) {
@@ -1541,7 +1541,7 @@ function ro(n, e, t) {
1541
1541
  return;
1542
1542
  if (!Hn(a))
1543
1543
  throw new Error("merge operation is not supported for links");
1544
- const c = nt(n.eav, [s, i]);
1544
+ const c = rt(n.eav, [s, i]);
1545
1545
  if (!c)
1546
1546
  return;
1547
1547
  const u = (y = c.values().next()) == null ? void 0 : y.value;
@@ -1766,7 +1766,7 @@ function ho(n, e, t) {
1766
1766
  return;
1767
1767
  const [s, i, o] = r;
1768
1768
  if (e.getAttr(i))
1769
- return nt(n.eav, [s, i]);
1769
+ return rt(n.eav, [s, i]);
1770
1770
  }
1771
1771
  function po(n, e, t) {
1772
1772
  const r = t.filter(([s, i, o, a, c]) => {
@@ -1861,7 +1861,7 @@ function Eo(n, e, t) {
1861
1861
  return uo(n, Jn(t, e));
1862
1862
  }
1863
1863
  const Oo = /^(?:[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;
1864
- function et(n) {
1864
+ function tt(n) {
1865
1865
  return typeof n == "string" && Oo.test(n);
1866
1866
  }
1867
1867
  const Z = [];
@@ -1930,13 +1930,13 @@ const Fu = (n) => {
1930
1930
  As = n;
1931
1931
  };
1932
1932
  let Do = 0;
1933
- function pt(n) {
1933
+ function yt(n) {
1934
1934
  return Vt(`_${n}`, Do++);
1935
1935
  }
1936
1936
  function Vt(n, e) {
1937
1937
  return `?${n}-${e}`;
1938
1938
  }
1939
- class tt extends Error {
1939
+ class nt extends Error {
1940
1940
  constructor(e) {
1941
1941
  super(e), this.name = "AttrNotFoundError";
1942
1942
  }
@@ -1944,7 +1944,7 @@ class tt extends Error {
1944
1944
  function Uo(n, e) {
1945
1945
  const t = Es(n, e);
1946
1946
  if (!t)
1947
- throw new tt(`Could not find id attr for ${e}`);
1947
+ throw new nt(`Could not find id attr for ${e}`);
1948
1948
  return t;
1949
1949
  }
1950
1950
  function Ar(n, e, t, r) {
@@ -1964,19 +1964,19 @@ function Fo(n, e, t) {
1964
1964
  function ks(n, e, t, r, s) {
1965
1965
  const i = V(e, t, s), o = Ke(e, t, s), a = i || o;
1966
1966
  if (!a)
1967
- throw new tt(`Could not find attr for ${[t, s]}`);
1967
+ throw new nt(`Could not find attr for ${[t, s]}`);
1968
1968
  if (a["value-type"] !== "ref")
1969
1969
  throw new Error(`Attr ${a.id} is not a ref`);
1970
1970
  const [c, u] = a["forward-identity"], [l, f] = a["reverse-identity"], p = r + 1, y = i ? [
1971
1971
  n(u, r),
1972
1972
  a.id,
1973
1973
  n(f, p),
1974
- pt("time")
1974
+ yt("time")
1975
1975
  ] : [
1976
1976
  n(u, p),
1977
1977
  a.id,
1978
1978
  n(f, r),
1979
- pt("time")
1979
+ yt("time")
1980
1980
  ];
1981
1981
  return [i ? f : u, p, y, a, !!i];
1982
1982
  }
@@ -2053,24 +2053,24 @@ function No(n, e) {
2053
2053
  function Wo(n, e, t, r, s, i) {
2054
2054
  const o = V(e, t, s), a = Ke(e, t, s), c = o || a;
2055
2055
  if (!c)
2056
- throw new tt(`No attr for etype = ${t} label = ${s}`);
2056
+ throw new nt(`No attr for etype = ${t} label = ${s}`);
2057
2057
  if (i != null && i.hasOwnProperty("$isNull")) {
2058
2058
  const u = V(e, t, "id");
2059
2059
  if (!u)
2060
- throw new tt(`No attr for etype = ${t} label = id`);
2060
+ throw new nt(`No attr for etype = ${t} label = id`);
2061
2061
  return [
2062
2062
  n(t, r),
2063
2063
  u.id,
2064
2064
  { $isNull: { attrId: c.id, isNull: i.$isNull, reverse: !o } },
2065
- pt("time")
2065
+ yt("time")
2066
2066
  ];
2067
2067
  }
2068
2068
  return o ? [
2069
2069
  n(t, r),
2070
2070
  c.id,
2071
2071
  No(c, i),
2072
- pt("time")
2073
- ] : [i, c.id, n(t, r), pt("time")];
2072
+ yt("time")
2073
+ ] : [i, c.id, n(t, r), yt("time")];
2074
2074
  }
2075
2075
  function Ko(n, e, t, r, s) {
2076
2076
  const [i, o, a] = s.reduce((c, u) => {
@@ -2172,7 +2172,7 @@ function Yo(n, e, t, { etype: r, level: s, form: i }, o) {
2172
2172
  }), C = b ? v[0] : v;
2173
2173
  return { [y]: C };
2174
2174
  } catch (g) {
2175
- if (g instanceof tt)
2175
+ if (g instanceof nt)
2176
2176
  return { [y]: b ? void 0 : [] };
2177
2177
  throw g;
2178
2178
  }
@@ -2184,11 +2184,11 @@ function Yo(n, e, t, { etype: r, level: s, form: i }, o) {
2184
2184
  function Zo(n, e, t) {
2185
2185
  return t === "string" ? $o(n, e) : n > e ? 1 : -1;
2186
2186
  }
2187
- function lt(n, e, t, r, s) {
2187
+ function ft(n, e, t, r, s) {
2188
2188
  return e === r || e == null && r == null ? Ro(n, t) : r == null ? 1 : e == null ? -1 : Zo(e, r, s);
2189
2189
  }
2190
2190
  function Wt([n, e], [t, r], s) {
2191
- return lt(n, e, t, r, s);
2191
+ return ft(n, e, t, r, s);
2192
2192
  }
2193
2193
  function vn(n) {
2194
2194
  return n == null ? n : new Date(n).getTime();
@@ -2290,7 +2290,7 @@ function aa(n, e, t) {
2290
2290
  try {
2291
2291
  return oa(n, e, t);
2292
2292
  } catch (r) {
2293
- if (r instanceof tt)
2293
+ if (r instanceof nt)
2294
2294
  return {};
2295
2295
  throw r;
2296
2296
  }
@@ -2781,7 +2781,7 @@ function Fa(n, e) {
2781
2781
  function Mr(n, e) {
2782
2782
  typeof requestIdleCallback > "u" ? n() : requestIdleCallback(n, { timeout: e });
2783
2783
  }
2784
- const yt = "__meta";
2784
+ const Je = "__meta";
2785
2785
  class Na {
2786
2786
  constructor(e, t) {
2787
2787
  }
@@ -2819,7 +2819,7 @@ class Cn {
2819
2819
  var e;
2820
2820
  this._meta.loadingPromise && await this._meta.loadingPromise;
2821
2821
  try {
2822
- const t = this._persister.getItem(yt);
2822
+ const t = this._persister.getItem(Je);
2823
2823
  this._meta.loadingPromise = t;
2824
2824
  const r = await t;
2825
2825
  this._meta.isLoading = !1, this._meta.error = null, this._meta.loadingPromise = null, this._meta.attempts = 0;
@@ -2901,7 +2901,7 @@ class Cn {
2901
2901
  const p = this._persister.removeItem(f);
2902
2902
  t.push(p.then(() => 1)), this._loadedKeys.delete(f), this._pendingSaveKeys.delete(f);
2903
2903
  }
2904
- const a = [], c = [[yt, s]], u = s.objects ?? {};
2904
+ const a = [], c = [[Je, s]], u = s.objects ?? {};
2905
2905
  s.objects = u;
2906
2906
  for (const f of o)
2907
2907
  if (this._loadedKeys.has(f)) {
@@ -2930,7 +2930,7 @@ class Cn {
2930
2930
  if (!this._gcOpts)
2931
2931
  return;
2932
2932
  const e = new Set(await this._persister.getAllKeys());
2933
- e.delete(yt);
2933
+ e.delete(Je);
2934
2934
  const t = new Set(Object.keys(this.currentValue));
2935
2935
  for (const p of Object.keys(this._loadingKeys))
2936
2936
  t.add(p);
@@ -3025,6 +3025,14 @@ class Cn {
3025
3025
  this._subs = this._subs.filter((t) => t !== e);
3026
3026
  };
3027
3027
  }
3028
+ // Removes any keys that we haven't loaded--used when
3029
+ // changing users to make sure we clean out all user data
3030
+ async clearUnloadedKeys() {
3031
+ let e = !1;
3032
+ for (const t of await this._persister.getAllKeys())
3033
+ t === Je || t in this.currentValue || (this._pendingSaveKeys.add(t), e = !0);
3034
+ e && await this._enqueuePersist();
3035
+ }
3028
3036
  }
3029
3037
  const Wa = 6, Ka = ["kv", "querySubs", "syncSubs"];
3030
3038
  function qa(n) {
@@ -3070,7 +3078,7 @@ async function Va(n, e, t) {
3070
3078
  const m = t.put(_, y);
3071
3079
  s.add(m);
3072
3080
  }
3073
- const c = { objects: a }, u = t.put(c, yt);
3081
+ const c = { objects: a }, u = t.put(c, Je);
3074
3082
  s.add(u);
3075
3083
  for (const y of s)
3076
3084
  y.onsuccess = () => {
@@ -3126,7 +3134,7 @@ async function Ba(n, e) {
3126
3134
  break;
3127
3135
  }
3128
3136
  }
3129
- const u = Rr(yt, c, i);
3137
+ const u = Rr(Je, c, i);
3130
3138
  a.push(u), await Promise.all(a), await new Promise((l, f) => {
3131
3139
  s.oncomplete = (p) => l(p), s.onerror = (p) => f(p), s.onabort = (p) => f(p);
3132
3140
  });
@@ -3486,7 +3494,7 @@ function Lr(n) {
3486
3494
  }, e;
3487
3495
  }, {});
3488
3496
  }
3489
- const Xn = "v0.22.162";
3497
+ const Xn = "v0.22.163-branch-dwwoelfel-patch-3.23205861850.1";
3490
3498
  function oc(n, e) {
3491
3499
  return {
3492
3500
  info: n ? (...t) => console.info(...t, e()) : () => {
@@ -3634,7 +3642,7 @@ const Fr = [
3634
3642
  default:
3635
3643
  throw new L(`Unknown operator '${n}' for attribute '${r}' in entity '${s}'`, o);
3636
3644
  }
3637
- }, Ye = (n, e, t, r, s) => {
3645
+ }, Ze = (n, e, t, r, s) => {
3638
3646
  const i = ac(t), o = t.valueType === "json";
3639
3647
  if (typeof n == "object" && n !== null && !Array.isArray(n)) {
3640
3648
  if (o)
@@ -3664,23 +3672,23 @@ const Fr = [
3664
3672
  if (!c)
3665
3673
  throw new L(`Target entity '${o}' does not exist in schema for dot notation path '${n}'.`, s);
3666
3674
  if (a === "id") {
3667
- if (typeof e == "string" && !et(e))
3675
+ if (typeof e == "string" && !tt(e))
3668
3676
  throw new L(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
3669
- Ye(e, n, new ie("string", !1, !0), t, s);
3677
+ Ze(e, n, new ie("string", !1, !0), t, s);
3670
3678
  return;
3671
3679
  }
3672
3680
  const u = c.attrs[a];
3673
3681
  if (Object.keys(c.links).includes(a)) {
3674
- if (typeof e == "string" && !et(e))
3682
+ if (typeof e == "string" && !tt(e))
3675
3683
  throw new L(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
3676
- Ye(e, n, new ie("string", !1, !0), t, s);
3684
+ Ze(e, n, new ie("string", !1, !0), t, s);
3677
3685
  return;
3678
3686
  }
3679
3687
  if (!u) {
3680
3688
  const l = Object.keys(c.attrs);
3681
3689
  throw new L(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${n}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
3682
3690
  }
3683
- Ye(e, n, u, t, s);
3691
+ Ze(e, n, u, t, s);
3684
3692
  }, Ns = (n, e, t, r) => {
3685
3693
  for (const [s, i] of Object.entries(n)) {
3686
3694
  if (s === "or" || s === "and") {
@@ -3690,7 +3698,7 @@ const Fr = [
3690
3698
  continue;
3691
3699
  }
3692
3700
  if (s === "id") {
3693
- Ye(i, "id", new ie("string", !1, !0), e, `${r}.id`);
3701
+ Ze(i, "id", new ie("string", !1, !0), e, `${r}.id`);
3694
3702
  continue;
3695
3703
  }
3696
3704
  if (s.includes(".")) {
@@ -3706,12 +3714,12 @@ const Fr = [
3706
3714
  throw new L(`Attribute or link '${s}' does not exist on entity '${e}'. Available attributes: ${u.length > 0 ? u.join(", ") : "none"}. Available links: ${l.length > 0 ? l.join(", ") : "none"}`, `${r}.${s}`);
3707
3715
  }
3708
3716
  if (a)
3709
- Ye(i, s, a, e, `${r}.${s}`);
3717
+ Ze(i, s, a, e, `${r}.${s}`);
3710
3718
  else if (c) {
3711
- if (typeof i == "string" && !et(i))
3719
+ if (typeof i == "string" && !tt(i))
3712
3720
  throw new L(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
3713
3721
  const u = new ie("string", !1, !0);
3714
- Ye(i, s, u, e, `${r}.${s}`);
3722
+ Ze(i, s, u, e, `${r}.${s}`);
3715
3723
  }
3716
3724
  }
3717
3725
  }, lc = (n, e, t, r, s = 0) => {
@@ -3774,7 +3782,7 @@ const Fr = [
3774
3782
  Ws(t[r], r, e, r, 0);
3775
3783
  }
3776
3784
  }
3777
- }, Wr = (n) => typeof n != "string" ? !1 : Kt(n) ? !0 : et(n);
3785
+ }, Wr = (n) => typeof n != "string" ? !1 : Kt(n) ? !0 : tt(n);
3778
3786
  class ge extends Error {
3779
3787
  constructor(e) {
3780
3788
  super(e), this.name = "TransactionValidationError";
@@ -3835,7 +3843,7 @@ const Ks = (n) => n.length > 0 ? n.join(", ") : "none", fc = (n, e) => new ge(`E
3835
3843
  if (!e)
3836
3844
  return;
3837
3845
  const [t, r, s, i] = n;
3838
- if (!Array.isArray(s) && !et(s))
3846
+ if (!Array.isArray(s) && !tt(s))
3839
3847
  throw new ge(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
3840
3848
  if (typeof r != "string")
3841
3849
  throw new ge(`Entity name must be a string, but received: ${typeof r}`);
@@ -4028,7 +4036,7 @@ function zr(n, e, t, r) {
4028
4036
  const s = (o = V(t, n.table, "id")) == null ? void 0 : o.id;
4029
4037
  if (!s)
4030
4038
  return -1;
4031
- const i = nt(e.eav, [r, s, r]);
4039
+ const i = rt(e.eav, [r, s, r]);
4032
4040
  return i ? i[3] : -1;
4033
4041
  }
4034
4042
  function Vr(n, e, t) {
@@ -4081,17 +4089,17 @@ function Sc(n, e, t) {
4081
4089
  const r = e;
4082
4090
  if (n.orderField === "serverCreatedAt") {
4083
4091
  t.sort(n.orderDirection === "asc" ? function(o, a) {
4084
- return lt(o.entity.id, o.serverCreatedAt, a.entity.id, a.serverCreatedAt, r);
4092
+ return ft(o.entity.id, o.serverCreatedAt, a.entity.id, a.serverCreatedAt, r);
4085
4093
  } : function(o, a) {
4086
- return lt(a.entity.id, a.serverCreatedAt, o.entity.id, o.serverCreatedAt, r);
4094
+ return ft(a.entity.id, a.serverCreatedAt, o.entity.id, o.serverCreatedAt, r);
4087
4095
  });
4088
4096
  return;
4089
4097
  }
4090
4098
  const s = n.orderField;
4091
4099
  t.sort(n.orderDirection === "asc" ? function(o, a) {
4092
- return lt(o.entity.id, o.entity[s], a.entity.id, a.entity[s], r);
4100
+ return ft(o.entity.id, o.entity[s], a.entity.id, a.entity[s], r);
4093
4101
  } : function(o, a) {
4094
- return lt(a.entity.id, a.entity[s], o.entity.id, o.entity[s], r);
4102
+ return ft(a.entity.id, a.entity[s], o.entity.id, o.entity[s], r);
4095
4103
  });
4096
4104
  }
4097
4105
  var xe;
@@ -4493,8 +4501,8 @@ function Ec({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
4493
4501
  });
4494
4502
  switch (ae.type) {
4495
4503
  case "ok": {
4496
- const { streamId: _e, offset: rt } = ae;
4497
- if (rt !== 0) {
4504
+ const { streamId: _e, offset: st } = ae;
4505
+ if (st !== 0) {
4498
4506
  const me = new se("Write stream is corrupted");
4499
4507
  te(A, me);
4500
4508
  return;
@@ -4531,10 +4539,10 @@ function Ec({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
4531
4539
  me();
4532
4540
  }, _e = (me) => {
4533
4541
  I(me), ae();
4534
- }, rt = (me) => {
4542
+ }, st = (me) => {
4535
4543
  H(me || new se("Stream is closed.")), ae();
4536
4544
  };
4537
- Y.push(U(_e)), Y.push(v(rt));
4545
+ Y.push(U(_e)), Y.push(v(st));
4538
4546
  });
4539
4547
  }
4540
4548
  }
@@ -5196,7 +5204,7 @@ class Nc {
5196
5204
  if (this._EventSource = i, this.config = { ...Rc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Ic, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Pc, this._log = oc(e.verbose || Zn || Ds, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": Xn }, this.config.schema && (this._linkIndex = Lr(this.config.schema)), !!xc()) {
5197
5205
  if (!e.appId)
5198
5206
  throw new Error("Instant must be initialized with an appId.");
5199
- if (!et(e.appId))
5207
+ if (!tt(e.appId))
5200
5208
  throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
5201
5209
  typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", async (o) => {
5202
5210
  var a;
@@ -5214,7 +5222,7 @@ class Nc {
5214
5222
  }
5215
5223
  })), this._initStorage(t), this._syncTable = new vc(this._trySendAuthed.bind(this), new t(this.config.appId, "syncSubs"), {
5216
5224
  useDateObjects: this.config.useDateObjects
5217
- }, this._log, (o) => ut(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new kc({
5225
+ }, this._log, (o) => lt(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new kc({
5218
5226
  WStream: this.config.WritableStream || WritableStream,
5219
5227
  RStream: this.config.ReadableStream || ReadableStream,
5220
5228
  trySend: this._trySendAuthed.bind(this),
@@ -5347,7 +5355,7 @@ class Nc {
5347
5355
  _addQueryData(e, t, r) {
5348
5356
  if (!this.attrs)
5349
5357
  throw new Error("Attrs in reactor have not been set");
5350
- const s = J(e), i = this.ensureAttrs(), o = ut(this.attrs, t.triples, r, this.config.useDateObjects);
5358
+ const s = J(e), i = this.ensureAttrs(), o = lt(this.attrs, t.triples, r, this.config.useDateObjects);
5351
5359
  this.querySubs.updateInPlace((a) => {
5352
5360
  a[s] = {
5353
5361
  result: {
@@ -5381,7 +5389,7 @@ class Nc {
5381
5389
  const { q: y, result: b } = t, _ = J(y);
5382
5390
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[_])
5383
5391
  break;
5384
- const m = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, g = Ur(b), w = this.ensureAttrs(), O = ut(w, g, r, this.config.useDateObjects);
5392
+ const m = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, g = Ur(b), w = this.ensureAttrs(), O = lt(w, g, r, this.config.useDateObjects);
5385
5393
  this.querySubs.updateInPlace((v) => {
5386
5394
  if (!v[_]) {
5387
5395
  this._log.info("Missing value in querySubs", { hash: _, q: y });
@@ -5438,7 +5446,7 @@ class Nc {
5438
5446
  });
5439
5447
  const S = ln(m.entries()), g = y.map((w) => {
5440
5448
  var W, Q, ee, Ae;
5441
- const O = w["instaql-query"], v = w["instaql-result"], C = J(O), j = Ur(v), U = this.ensureAttrs(), B = ut(U, j, r, this.config.useDateObjects), { store: ye, attrsStore: Re } = this._applyOptimisticUpdates(B, U, S, _), te = (Q = (W = v == null ? void 0 : v[0]) == null ? void 0 : W.data) == null ? void 0 : Q["page-info"], oe = (Ae = (ee = v == null ? void 0 : v[0]) == null ? void 0 : ee.data) == null ? void 0 : Ae.aggregate;
5449
+ const O = w["instaql-query"], v = w["instaql-result"], C = J(O), j = Ur(v), U = this.ensureAttrs(), B = lt(U, j, r, this.config.useDateObjects), { store: ye, attrsStore: Re } = this._applyOptimisticUpdates(B, U, S, _), te = (Q = (W = v == null ? void 0 : v[0]) == null ? void 0 : W.data) == null ? void 0 : Q["page-info"], oe = (Ae = (ee = v == null ? void 0 : v[0]) == null ? void 0 : ee.data) == null ? void 0 : Ae.aggregate;
5442
5450
  return {
5443
5451
  q: O,
5444
5452
  hash: C,
@@ -6118,6 +6126,13 @@ class Nc {
6118
6126
  Object.keys(r).forEach((s) => {
6119
6127
  delete r[s].result;
6120
6128
  });
6129
+ }), this.querySubs.clearUnloadedKeys(), this._updatePendingMutations((r) => {
6130
+ for (const [s, i] of r.entries())
6131
+ this.mutationDeferredStore.get(s) && this._finishTransaction("error", s, {
6132
+ message: "User changed while transaction was in progress.",
6133
+ type: "user-changed"
6134
+ });
6135
+ r.clear();
6121
6136
  }), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(t);
6122
6137
  }
6123
6138
  sendMagicCode({ email: e }) {
@@ -7093,7 +7108,7 @@ function pu(n, e) {
7093
7108
  };
7094
7109
  t.allowedHosts.includes(window.location.hostname) && Jc(n, t);
7095
7110
  }
7096
- var Mn = { exports: {} }, it = {};
7111
+ var Mn = { exports: {} }, ot = {};
7097
7112
  /**
7098
7113
  * @license React
7099
7114
  * react-jsx-runtime.production.min.js
@@ -7105,7 +7120,7 @@ var Mn = { exports: {} }, it = {};
7105
7120
  */
7106
7121
  var Hr;
7107
7122
  function yu() {
7108
- if (Hr) return it;
7123
+ if (Hr) return ot;
7109
7124
  Hr = 1;
7110
7125
  var n = rs, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
7111
7126
  function o(a, c, u) {
@@ -7115,11 +7130,11 @@ function yu() {
7115
7130
  if (a && a.defaultProps) for (l in c = a.defaultProps, c) f[l] === void 0 && (f[l] = c[l]);
7116
7131
  return { $$typeof: e, type: a, key: p, ref: y, props: f, _owner: s.current };
7117
7132
  }
7118
- return it.Fragment = t, it.jsx = o, it.jsxs = o, it;
7133
+ return ot.Fragment = t, ot.jsx = o, ot.jsxs = o, ot;
7119
7134
  }
7120
- var ot = {}, Jr;
7135
+ var at = {}, Jr;
7121
7136
  function bu() {
7122
- if (Jr) return ot;
7137
+ if (Jr) return at;
7123
7138
  Jr = 1;
7124
7139
  var n = {};
7125
7140
  /**
@@ -7248,7 +7263,7 @@ function bu() {
7248
7263
  ee++;
7249
7264
  }
7250
7265
  }
7251
- function rt() {
7266
+ function st() {
7252
7267
  {
7253
7268
  if (ee--, ee === 0) {
7254
7269
  var d = {
@@ -7368,7 +7383,7 @@ function bu() {
7368
7383
  }
7369
7384
  }
7370
7385
  } finally {
7371
- Yt = !1, me.current = D, rt(), Error.prepareStackTrace = $;
7386
+ Yt = !1, me.current = D, st(), Error.prepareStackTrace = $;
7372
7387
  }
7373
7388
  var ze = d ? d.displayName || d.name : "", je = ze ? St(ze) : "";
7374
7389
  return typeof d == "function" && vt.set(d, je), je;
@@ -7409,7 +7424,7 @@ function bu() {
7409
7424
  }
7410
7425
  return "";
7411
7426
  }
7412
- var st = Object.prototype.hasOwnProperty, nr = {}, rr = g.ReactDebugCurrentFrame;
7427
+ var it = Object.prototype.hasOwnProperty, nr = {}, rr = g.ReactDebugCurrentFrame;
7413
7428
  function Ot(d) {
7414
7429
  if (d) {
7415
7430
  var T = d._owner, E = Et(d.type, d._source, T ? T.type : null);
@@ -7419,7 +7434,7 @@ function bu() {
7419
7434
  }
7420
7435
  function Ys(d, T, E, k, $) {
7421
7436
  {
7422
- var D = Function.call.bind(st);
7437
+ var D = Function.call.bind(it);
7423
7438
  for (var x in d)
7424
7439
  if (D(d, x)) {
7425
7440
  var M = void 0;
@@ -7467,7 +7482,7 @@ function bu() {
7467
7482
  __source: !0
7468
7483
  }, ar, cr;
7469
7484
  function ni(d) {
7470
- if (st.call(d, "ref")) {
7485
+ if (it.call(d, "ref")) {
7471
7486
  var T = Object.getOwnPropertyDescriptor(d, "ref").get;
7472
7487
  if (T && T.isReactWarning)
7473
7488
  return !1;
@@ -7475,7 +7490,7 @@ function bu() {
7475
7490
  return d.ref !== void 0;
7476
7491
  }
7477
7492
  function ri(d) {
7478
- if (st.call(d, "key")) {
7493
+ if (it.call(d, "key")) {
7479
7494
  var T = Object.getOwnPropertyDescriptor(d, "key").get;
7480
7495
  if (T && T.isReactWarning)
7481
7496
  return !1;
@@ -7541,7 +7556,7 @@ function bu() {
7541
7556
  var D, x = {}, M = null, ne = null;
7542
7557
  E !== void 0 && (ir(E), M = "" + E), ri(T) && (ir(T.key), M = "" + T.key), ni(T) && (ne = T.ref, si(T, $));
7543
7558
  for (D in T)
7544
- st.call(T, D) && !ti.hasOwnProperty(D) && (x[D] = T[D]);
7559
+ it.call(T, D) && !ti.hasOwnProperty(D) && (x[D] = T[D]);
7545
7560
  if (d && d.defaultProps) {
7546
7561
  var K = d.defaultProps;
7547
7562
  for (D in K)
@@ -7692,7 +7707,7 @@ Check the top-level render call using <` + E + ">.");
7692
7707
  else
7693
7708
  hr(be, d);
7694
7709
  }
7695
- if (st.call(T, "key")) {
7710
+ if (it.call(T, "key")) {
7696
7711
  var je = W(d), ce = Object.keys(T).filter(function(_i) {
7697
7712
  return _i !== "key";
7698
7713
  }), nn = ce.length > 0 ? "{key: someKey, " + ce.join(": ..., ") + ": ...}" : "{key: someKey}";
@@ -7716,8 +7731,8 @@ React keys must be passed directly to JSX without using spread:
7716
7731
  return yr(d, T, E, !1);
7717
7732
  }
7718
7733
  var yi = pi, bi = hi;
7719
- ot.Fragment = s, ot.jsx = yi, ot.jsxs = bi;
7720
- }(), ot;
7734
+ at.Fragment = s, at.jsx = yi, at.jsxs = bi;
7735
+ }(), at;
7721
7736
  }
7722
7737
  var gu = {};
7723
7738
  gu.NODE_ENV === "production" ? Mn.exports = yu() : Mn.exports = bu();
@@ -7739,7 +7754,7 @@ function Yr(n) {
7739
7754
  }
7740
7755
  function mu(n, e, t, r) {
7741
7756
  e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
7742
- const s = e ? lu(e) : null, i = J(s), o = Xe(Yr(n._reactor.getPreviousResult(s))), a = Xe(_u), c = Me(
7757
+ const s = e ? lu(e) : null, i = J(s), o = et(Yr(n._reactor.getPreviousResult(s))), a = et(_u), c = Me(
7743
7758
  (l) => (o.current = Yr(n._reactor.getPreviousResult(s)), l(), s ? n.subscribeQuery(s, (p) => {
7744
7759
  o.current = {
7745
7760
  isLoading: !p,
@@ -7759,7 +7774,7 @@ function mu(n, e, t, r) {
7759
7774
  return { state: dn(c, () => o.current, () => a.current), query: s, queryHash: i };
7760
7775
  }
7761
7776
  function wu() {
7762
- const n = Xe(null);
7777
+ const n = et(null);
7763
7778
  Fe(() => {
7764
7779
  t();
7765
7780
  }, []);
@@ -7773,7 +7788,7 @@ function wu() {
7773
7788
  }
7774
7789
  const Tu = 1e3;
7775
7790
  function Su(n, e, t) {
7776
- const r = Xe(t);
7791
+ const r = et(t);
7777
7792
  r.current = t, Fe(() => n.core._reactor.subscribeTopic(n.type, n.id, e, (i, o) => {
7778
7793
  r.current(i, o);
7779
7794
  }), [n.id, e]);
@@ -8105,7 +8120,7 @@ class $t {
8105
8120
  * }
8106
8121
  */
8107
8122
  h(this, "useConnectionStatus", () => {
8108
- const e = Xe(this.core._reactor.status), t = Me((s) => this.core.subscribeConnectionStatus((o) => {
8123
+ const e = et(this.core._reactor.status), t = Me((s) => this.core.subscribeConnectionStatus((o) => {
8109
8124
  o !== e.current && (e.current = o, s());
8110
8125
  }), []);
8111
8126
  return dn(
@@ -8184,7 +8199,7 @@ class $t {
8184
8199
  return new ku(this.core, e, t);
8185
8200
  }
8186
8201
  _useAuth() {
8187
- const e = Xe(this.core._reactor._currentUserCached), t = Me((s) => this.core.subscribeAuth((o) => {
8202
+ const e = et(this.core._reactor._currentUserCached), t = Me((s) => this.core.subscribeAuth((o) => {
8188
8203
  e.current = { isLoading: !1, ...o }, s();
8189
8204
  }), []);
8190
8205
  return dn(t, () => e.current, () => Cu);
@@ -8366,32 +8381,32 @@ function es(n) {
8366
8381
  }
8367
8382
  var Bs = (n) => {
8368
8383
  throw TypeError(n);
8369
- }, er = (n, e, t) => e.has(n) || Bs("Cannot " + t), P = (n, e, t) => (er(n, e, "read from private field"), t ? t.call(n) : e.get(n)), G = (n, e, t) => e.has(n) ? Bs("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), F = (n, e, t, r) => (er(n, e, "write to private field"), e.set(n, t), t), ke = (n, e, t) => (er(n, e, "access private method"), t), ue, De, Ge, Dt, qt, bt, Je, gt, Pe, Qe, Ze, He, ft, we, jn, xn, $n, ts, Dn, Un, dt, Ln, Fn;
8384
+ }, er = (n, e, t) => e.has(n) || Bs("Cannot " + t), P = (n, e, t) => (er(n, e, "read from private field"), t ? t.call(n) : e.get(n)), G = (n, e, t) => e.has(n) ? Bs("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), F = (n, e, t, r) => (er(n, e, "write to private field"), e.set(n, t), t), ke = (n, e, t) => (er(n, e, "access private method"), t), ue, De, Ge, Dt, qt, bt, Ye, gt, Pe, Qe, Xe, He, dt, we, jn, xn, $n, ts, Dn, Un, ht, Ln, Fn;
8370
8385
  class Ut extends EventTarget {
8371
8386
  constructor(e, t) {
8372
8387
  var r, s;
8373
- super(), G(this, we), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, G(this, ue), G(this, De), G(this, Ge), G(this, Dt), G(this, qt), G(this, bt), G(this, Je), G(this, gt, null), G(this, Pe), G(this, Qe), G(this, Ze, null), G(this, He, null), G(this, ft, null), G(this, xn, async (i) => {
8388
+ super(), G(this, we), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, G(this, ue), G(this, De), G(this, Ge), G(this, Dt), G(this, qt), G(this, bt), G(this, Ye), G(this, gt, null), G(this, Pe), G(this, Qe), G(this, Xe, null), G(this, He, null), G(this, dt, null), G(this, xn, async (i) => {
8374
8389
  var o;
8375
8390
  P(this, Qe).reset();
8376
8391
  const { body: a, redirected: c, status: u, headers: l } = i;
8377
8392
  if (u === 204) {
8378
- ke(this, we, dt).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
8393
+ ke(this, we, ht).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
8379
8394
  return;
8380
8395
  }
8381
8396
  if (c ? F(this, Ge, new URL(i.url)) : F(this, Ge, void 0), u !== 200) {
8382
- ke(this, we, dt).call(this, `Non-200 status code (${u})`, u);
8397
+ ke(this, we, ht).call(this, `Non-200 status code (${u})`, u);
8383
8398
  return;
8384
8399
  }
8385
8400
  if (!(l.get("content-type") || "").startsWith("text/event-stream")) {
8386
- ke(this, we, dt).call(this, 'Invalid content type, expected "text/event-stream"', u);
8401
+ ke(this, we, ht).call(this, 'Invalid content type, expected "text/event-stream"', u);
8387
8402
  return;
8388
8403
  }
8389
8404
  if (P(this, ue) === this.CLOSED)
8390
8405
  return;
8391
8406
  F(this, ue, this.OPEN);
8392
8407
  const f = new Event("open");
8393
- if ((o = P(this, ft)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
8394
- ke(this, we, dt).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
8408
+ if ((o = P(this, dt)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
8409
+ ke(this, we, ht).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
8395
8410
  return;
8396
8411
  }
8397
8412
  const p = new TextDecoder(), y = a.getReader();
@@ -8413,7 +8428,7 @@ class Ut extends EventTarget {
8413
8428
  }), G(this, Un, (i) => {
8414
8429
  F(this, bt, i);
8415
8430
  }), G(this, Fn, () => {
8416
- F(this, Je, void 0), P(this, ue) === this.CONNECTING && ke(this, we, jn).call(this);
8431
+ F(this, Ye, void 0), P(this, ue) === this.CONNECTING && ke(this, we, jn).call(this);
8417
8432
  });
8418
8433
  try {
8419
8434
  if (e instanceof URL)
@@ -8463,10 +8478,10 @@ class Ut extends EventTarget {
8463
8478
  }
8464
8479
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
8465
8480
  get onerror() {
8466
- return P(this, Ze);
8481
+ return P(this, Xe);
8467
8482
  }
8468
8483
  set onerror(e) {
8469
- F(this, Ze, e);
8484
+ F(this, Xe, e);
8470
8485
  }
8471
8486
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
8472
8487
  get onmessage() {
@@ -8477,10 +8492,10 @@ class Ut extends EventTarget {
8477
8492
  }
8478
8493
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
8479
8494
  get onopen() {
8480
- return P(this, ft);
8495
+ return P(this, dt);
8481
8496
  }
8482
8497
  set onopen(e) {
8483
- F(this, ft, e);
8498
+ F(this, dt, e);
8484
8499
  }
8485
8500
  addEventListener(e, t, r) {
8486
8501
  const s = t;
@@ -8498,10 +8513,10 @@ class Ut extends EventTarget {
8498
8513
  * @public
8499
8514
  */
8500
8515
  close() {
8501
- P(this, Je) && clearTimeout(P(this, Je)), P(this, ue) !== this.CLOSED && (P(this, Pe) && P(this, Pe).abort(), F(this, ue, this.CLOSED), F(this, Pe, void 0));
8516
+ P(this, Ye) && clearTimeout(P(this, Ye)), P(this, ue) !== this.CLOSED && (P(this, Pe) && P(this, Pe).abort(), F(this, ue, this.CLOSED), F(this, Pe, void 0));
8502
8517
  }
8503
8518
  }
8504
- ue = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap(), Dt = /* @__PURE__ */ new WeakMap(), qt = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakMap(), Je = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), Pe = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakSet(), /**
8519
+ ue = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap(), Dt = /* @__PURE__ */ new WeakMap(), qt = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), Pe = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakSet(), /**
8505
8520
  * Connect to the given URL and start receiving events
8506
8521
  *
8507
8522
  * @internal
@@ -8533,11 +8548,11 @@ ts = function() {
8533
8548
  * @param code - The HTTP status code, if available
8534
8549
  * @internal
8535
8550
  */
8536
- dt = function(n, e) {
8551
+ ht = function(n, e) {
8537
8552
  var t;
8538
8553
  P(this, ue) !== this.CLOSED && F(this, ue, this.CLOSED);
8539
8554
  const r = new Xr("error", { code: e, message: n });
8540
- (t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r);
8555
+ (t = P(this, Xe)) == null || t.call(this, r), this.dispatchEvent(r);
8541
8556
  }, /**
8542
8557
  * Schedules a reconnection attempt against the EventSource endpoint.
8543
8558
  *
@@ -8551,7 +8566,7 @@ Ln = function(n, e) {
8551
8566
  return;
8552
8567
  F(this, ue, this.CONNECTING);
8553
8568
  const r = new Xr("error", { code: e, message: n });
8554
- (t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r), F(this, Je, setTimeout(P(this, Fn), P(this, bt)));
8569
+ (t = P(this, Xe)) == null || t.call(this, r), this.dispatchEvent(r), F(this, Ye, setTimeout(P(this, Fn), P(this, bt)));
8555
8570
  }, Fn = /* @__PURE__ */ new WeakMap(), /**
8556
8571
  * ReadyState representing an EventSource currently trying to connect
8557
8572
  *