@instantdb/react 0.22.47-experimental.sync-table.19152834603.1 → 0.22.47-experimental.sync-table.19174988015.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,5 +1,5 @@
1
1
  import ni, { useRef as St, useCallback as be, useSyncExternalStore as Jt, useEffect as ve, useMemo as Zt, useState as ri, createElement as ws } from "react";
2
- function K(t) {
2
+ function z(t) {
3
3
  if (typeof t == "number")
4
4
  return (Math.abs(t * 2654435761) >>> 0).toString(16);
5
5
  if (typeof t == "boolean")
@@ -18,7 +18,7 @@ function K(t) {
18
18
  let e = 2166136261;
19
19
  for (let n = 0; n < t.length; n++) {
20
20
  e ^= (n + 1) * 2654435761;
21
- const r = K(t[n]);
21
+ const r = z(t[n]);
22
22
  for (let i = 0; i < r.length; i++)
23
23
  e ^= r.charCodeAt(i), e *= 16777619, e = e >>> 0;
24
24
  }
@@ -28,14 +28,14 @@ function K(t) {
28
28
  let e = 2166136261;
29
29
  const n = Object.keys(t).sort();
30
30
  for (let r = 0; r < n.length; r++) {
31
- const i = n[r], s = K(i);
31
+ const i = n[r], s = z(i);
32
32
  e ^= parseInt(s, 16), e *= 16777619, e = e >>> 0;
33
- const o = K(t[i]);
33
+ const o = z(t[i]);
34
34
  e ^= parseInt(o, 16), e *= 16777619, e = e >>> 0;
35
35
  }
36
36
  return e.toString(16);
37
37
  }
38
- return K(String(t));
38
+ return z(String(t));
39
39
  }
40
40
  const D = {
41
41
  Remove: "remove",
@@ -45,7 +45,7 @@ const D = {
45
45
  mutable: "mutable",
46
46
  immutable: "immutable"
47
47
  }, jn = {};
48
- function Je(t, e) {
48
+ function Ze(t, e) {
49
49
  return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
50
50
  }
51
51
  function yr(t, e) {
@@ -92,7 +92,7 @@ function si(t, e = []) {
92
92
  if (r !== null && (r == null ? void 0 : r.original) !== t.original)
93
93
  return null;
94
94
  const i = t.parent.type === 3, s = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
95
- if (!(i && n.size > s || Je(n, s)))
95
+ if (!(i && n.size > s || Ze(n, s)))
96
96
  return null;
97
97
  e.push(s);
98
98
  }
@@ -196,15 +196,15 @@ function oi(t, e) {
196
196
  function Q(t) {
197
197
  t.copy || (t.copy = oi(t.original, t.options));
198
198
  }
199
- function Ge(t) {
199
+ function Qe(t) {
200
200
  if (!ue(t))
201
201
  return Mn(t);
202
202
  if (Array.isArray(t))
203
- return t.map(Ge);
203
+ return t.map(Qe);
204
204
  if (t instanceof Map) {
205
205
  const n = Array.from(t.entries()).map(([r, i]) => [
206
206
  r,
207
- Ge(i)
207
+ Qe(i)
208
208
  ]);
209
209
  if (!Pn(t)) {
210
210
  const r = Object.getPrototypeOf(t).constructor;
@@ -213,7 +213,7 @@ function Ge(t) {
213
213
  return new Map(n);
214
214
  }
215
215
  if (t instanceof Set) {
216
- const n = Array.from(t).map(Ge);
216
+ const n = Array.from(t).map(Qe);
217
217
  if (!In(t)) {
218
218
  const r = Object.getPrototypeOf(t).constructor;
219
219
  return new r(n);
@@ -222,11 +222,11 @@ function Ge(t) {
222
222
  }
223
223
  const e = Object.create(Object.getPrototypeOf(t));
224
224
  for (const n in t)
225
- e[n] = Ge(t[n]);
225
+ e[n] = Qe(t[n]);
226
226
  return e;
227
227
  }
228
228
  function _t(t) {
229
- return Oe(t) ? Ge(t) : t;
229
+ return Oe(t) ? Qe(t) : t;
230
230
  }
231
231
  function de(t) {
232
232
  var e;
@@ -394,7 +394,7 @@ function As(t, e, n, r, i) {
394
394
  }
395
395
  function Cs({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
396
396
  n.forEach((u, a) => {
397
- const d = pe(t, a), c = _t(pe(e, a)), f = u ? Je(t, a) ? D.Replace : D.Add : D.Remove;
397
+ const d = pe(t, a), c = _t(pe(e, a)), f = u ? Ze(t, a) ? D.Replace : D.Add : D.Remove;
398
398
  if (he(d, c) && f === D.Replace)
399
399
  return;
400
400
  const h = r.concat(a), p = me(h, o);
@@ -669,7 +669,7 @@ const Is = Reflect.ownKeys(Ot), ai = /* @__PURE__ */ new WeakSet(), ci = {
669
669
  if (d)
670
670
  return d.bind(t.proxy);
671
671
  }
672
- if (!Je(u, e)) {
672
+ if (!Ze(u, e)) {
673
673
  const d = yr(u, e);
674
674
  return d ? "value" in d ? d.value : (
675
675
  // !case: support for getter
@@ -705,7 +705,7 @@ const Is = Reflect.ownKeys(Ot), ai = /* @__PURE__ */ new WeakSet(), ci = {
705
705
  if (s != null && s.set)
706
706
  return s.set.call(t.proxy, n), !0;
707
707
  const o = qt(te(t), e), u = C(o);
708
- return u && he(u.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) : (he(n, o) && (n !== void 0 || Je(t.original, e)) || (Q(t), de(t), Je(t.original, e) && he(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, $n(t, e, n, nt)), !0);
708
+ return u && he(u.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) : (he(n, o) && (n !== void 0 || Ze(t.original, e)) || (Q(t), de(t), Ze(t.original, e) && he(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, $n(t, e, n, nt)), !0);
709
709
  },
710
710
  has(t, e) {
711
711
  return e in te(t);
@@ -909,12 +909,12 @@ const Rs = (t) => function e(n, r, i) {
909
909
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
910
910
  const B = v == null ? void 0 : v[ms];
911
911
  if (B) {
912
- const We = B[0];
912
+ const Ve = B[0];
913
913
  return _.strict && typeof v == "object" && v !== null && rn({
914
914
  rootDraft: M,
915
915
  value: v,
916
916
  useRawReturn: !0
917
- }), w([We]);
917
+ }), w([Ve]);
918
918
  }
919
919
  if (v !== void 0)
920
920
  return typeof v == "object" && v !== null && rn({ rootDraft: M, value: v }), w([v]);
@@ -945,7 +945,7 @@ function gt(t, e) {
945
945
  return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : fi(t, e) ? Object.keys(t).every((n) => gt(t[n], e[n])) : !1;
946
946
  }
947
947
  function Dn(t) {
948
- if (!Qe(t))
948
+ if (!He(t))
949
949
  return t;
950
950
  const e = {};
951
951
  for (const [n, r] of Object.entries(t))
@@ -953,7 +953,7 @@ function Dn(t) {
953
953
  return e;
954
954
  }
955
955
  function li(t, e) {
956
- if (!Qe(t) || !Qe(e))
956
+ if (!He(t) || !He(e))
957
957
  return e;
958
958
  const n = Object.assign({}, t);
959
959
  for (const r of Object.keys(e)) {
@@ -963,12 +963,12 @@ function li(t, e) {
963
963
  delete n[r];
964
964
  continue;
965
965
  }
966
- const i = Qe(t[r]) && Qe(e[r]);
966
+ const i = He(t[r]) && He(e[r]);
967
967
  n[r] = i ? li(t[r], e[r]) : e[r];
968
968
  }
969
969
  return n;
970
970
  }
971
- function Qe(t) {
971
+ function He(t) {
972
972
  return typeof t == "object" && t !== null && !Array.isArray(t);
973
973
  }
974
974
  function $s(t, e, n) {
@@ -1331,7 +1331,7 @@ function Un(t) {
1331
1331
  function Ln(t) {
1332
1332
  return t["value-type"] === "blob";
1333
1333
  }
1334
- function Fe(t, e) {
1334
+ function Ne(t, e) {
1335
1335
  return t[e];
1336
1336
  }
1337
1337
  function it(t, e) {
@@ -1362,7 +1362,7 @@ function pi(t, e, n) {
1362
1362
  const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1363
1363
  for (const o of e) {
1364
1364
  let [u, a, d, c] = o;
1365
- const f = Fe(t, a);
1365
+ const f = Ne(t, a);
1366
1366
  if (!f) {
1367
1367
  console.warn("no such attr", u, t);
1368
1368
  continue;
@@ -1436,7 +1436,7 @@ function gi(t, e) {
1436
1436
  const n = st(t, e);
1437
1437
  if (!n)
1438
1438
  return;
1439
- const [r, i, s] = n, o = Fe(t.attrs, i);
1439
+ const [r, i, s] = n, o = Ne(t.attrs, i);
1440
1440
  o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]), Un(o) && oe(t.vae, [s, i, r]));
1441
1441
  }
1442
1442
  let eo = 0;
@@ -1452,7 +1452,7 @@ function wi(t, e) {
1452
1452
  if (!r)
1453
1453
  return;
1454
1454
  let [i, s, o] = r;
1455
- const u = Fe(t.attrs, s);
1455
+ const u = Ne(t.attrs, s);
1456
1456
  if (!u)
1457
1457
  return;
1458
1458
  u["checked-data-type"] === "date" && t.useDateObjects && (o = kt(o));
@@ -1464,7 +1464,7 @@ function to(t, e) {
1464
1464
  const r = st(t, e);
1465
1465
  if (!r)
1466
1466
  return;
1467
- const [i, s, o] = r, u = Fe(t.attrs, s);
1467
+ const [i, s, o] = r, u = Ne(t.attrs, s);
1468
1468
  if (!u)
1469
1469
  return;
1470
1470
  if (!Ln(u))
@@ -1671,7 +1671,7 @@ function ao(t, e, n) {
1671
1671
  }
1672
1672
  return i;
1673
1673
  }
1674
- function xe(t, e, n) {
1674
+ function De(t, e, n) {
1675
1675
  var r;
1676
1676
  return (r = t.attrIndexes.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
1677
1677
  }
@@ -1692,7 +1692,7 @@ function fo(t, e) {
1692
1692
  if (!n)
1693
1693
  return;
1694
1694
  const [r, i, s] = n;
1695
- if (Fe(t.attrs, i))
1695
+ if (Ne(t.attrs, i))
1696
1696
  return it(t.eav, [r, i]);
1697
1697
  }
1698
1698
  function lo(t, e) {
@@ -1703,7 +1703,7 @@ function lo(t, e) {
1703
1703
  if (a !== "create" && a !== "update")
1704
1704
  return !0;
1705
1705
  let d = !1;
1706
- const c = Fe(t.attrs, s);
1706
+ const c = Ne(t.attrs, s);
1707
1707
  if (c) {
1708
1708
  const f = Oi(t, c["forward-identity"][1]);
1709
1709
  d = !!fo(t, [i, f.id, i]);
@@ -1779,7 +1779,7 @@ function So(t, e, n) {
1779
1779
  return uo(t, Nn(n, e));
1780
1780
  }
1781
1781
  const vo = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
1782
- function De(t) {
1782
+ function Ue(t) {
1783
1783
  return typeof t == "string" && vo.test(t);
1784
1784
  }
1785
1785
  const V = [];
@@ -1844,13 +1844,13 @@ function Mo() {
1844
1844
  }
1845
1845
  const Ro = Mo();
1846
1846
  let $o = 0;
1847
- function Ze(t) {
1847
+ function Xe(t) {
1848
1848
  return jt(`_${t}`, $o++);
1849
1849
  }
1850
1850
  function jt(t, e) {
1851
1851
  return `?${t}-${e}`;
1852
1852
  }
1853
- class Ue extends Error {
1853
+ class Le extends Error {
1854
1854
  constructor(e) {
1855
1855
  super(e), this.name = "AttrNotFoundError";
1856
1856
  }
@@ -1858,7 +1858,7 @@ class Ue extends Error {
1858
1858
  function xo(t, e) {
1859
1859
  const n = Oi(t, e);
1860
1860
  if (!n)
1861
- throw new Ue(`Could not find id attr for ${e}`);
1861
+ throw new Le(`Could not find id attr for ${e}`);
1862
1862
  return n;
1863
1863
  }
1864
1864
  function Er(t, e, n, r) {
@@ -1876,21 +1876,21 @@ function Uo(t, e, n) {
1876
1876
  return t.map((r) => r === e ? n : r);
1877
1877
  }
1878
1878
  function Ai(t, e, n, r, i) {
1879
- const s = xe(e, n, i), o = vi(e, n, i), u = s || o;
1879
+ const s = De(e, n, i), o = vi(e, n, i), u = s || o;
1880
1880
  if (!u)
1881
- throw new Ue(`Could not find attr for ${[n, i]}`);
1881
+ throw new Le(`Could not find attr for ${[n, i]}`);
1882
1882
  if (u["value-type"] !== "ref")
1883
1883
  throw new Error(`Attr ${u.id} is not a ref`);
1884
1884
  const [a, d] = u["forward-identity"], [c, f] = u["reverse-identity"], h = r + 1, p = s ? [
1885
1885
  t(d, r),
1886
1886
  u.id,
1887
1887
  t(f, h),
1888
- Ze("time")
1888
+ Xe("time")
1889
1889
  ] : [
1890
1890
  t(d, h),
1891
1891
  u.id,
1892
1892
  t(f, r),
1893
- Ze("time")
1893
+ Xe("time")
1894
1894
  ];
1895
1895
  return [s ? f : d, h, p, u, !!s];
1896
1896
  }
@@ -1965,26 +1965,26 @@ function Lo(t, e) {
1965
1965
  return e;
1966
1966
  }
1967
1967
  function Fo(t, e, n, r, i, s) {
1968
- const o = xe(e, n, i), u = vi(e, n, i), a = o || u;
1968
+ const o = De(e, n, i), u = vi(e, n, i), a = o || u;
1969
1969
  if (!a)
1970
- throw new Ue(`No attr for etype = ${n} label = ${i}`);
1970
+ throw new Le(`No attr for etype = ${n} label = ${i}`);
1971
1971
  if (s != null && s.hasOwnProperty("$isNull")) {
1972
- const d = xe(e, n, "id");
1972
+ const d = De(e, n, "id");
1973
1973
  if (!d)
1974
- throw new Ue(`No attr for etype = ${n} label = id`);
1974
+ throw new Le(`No attr for etype = ${n} label = id`);
1975
1975
  return [
1976
1976
  t(n, r),
1977
1977
  d.id,
1978
1978
  { $isNull: { attrId: a.id, isNull: s.$isNull, reverse: !o } },
1979
- Ze("time")
1979
+ Xe("time")
1980
1980
  ];
1981
1981
  }
1982
1982
  return o ? [
1983
1983
  t(n, r),
1984
1984
  a.id,
1985
1985
  Lo(a, s),
1986
- Ze("time")
1987
- ] : [s, a.id, t(n, r), Ze("time")];
1986
+ Xe("time")
1987
+ ] : [s, a.id, t(n, r), Xe("time")];
1988
1988
  }
1989
1989
  function No(t, e, n, r, i) {
1990
1990
  const [s, o, u] = i.reduce((a, d) => {
@@ -2084,7 +2084,7 @@ function Ho(t, e, { etype: n, level: r, form: i }, s) {
2084
2084
  }), v = _ ? j[0] : j;
2085
2085
  return { [h]: v };
2086
2086
  } catch (T) {
2087
- if (T instanceof Ue)
2087
+ if (T instanceof Le)
2088
2088
  return { [h]: _ ? void 0 : [] };
2089
2089
  throw T;
2090
2090
  }
@@ -2116,7 +2116,7 @@ function Zo(t, e) {
2116
2116
  }
2117
2117
  function Xo(t, e, n) {
2118
2118
  const r = Object.keys(n)[0];
2119
- return xe(t, e, r);
2119
+ return De(t, e, r);
2120
2120
  }
2121
2121
  function eu(t, e, n, r) {
2122
2122
  if (n)
@@ -2130,11 +2130,11 @@ function tu(t, e, n) {
2130
2130
  return co(t, e);
2131
2131
  const s = /* @__PURE__ */ new Map();
2132
2132
  for (const o of n.fields) {
2133
- const u = xe(t, e, o), a = (r = u == null ? void 0 : u["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
2133
+ const u = De(t, e, o), a = (r = u == null ? void 0 : u["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
2134
2134
  a && Ln(u) && s.set(a, u);
2135
2135
  }
2136
2136
  if (!s.has("id")) {
2137
- const o = xe(t, e, "id"), u = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
2137
+ const o = De(t, e, "id"), u = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
2138
2138
  u && s.set(u, o);
2139
2139
  }
2140
2140
  return s;
@@ -2199,7 +2199,7 @@ function su(t, e) {
2199
2199
  try {
2200
2200
  return iu(t, e);
2201
2201
  } catch (n) {
2202
- if (n instanceof Ue)
2202
+ if (n instanceof Le)
2203
2203
  return {};
2204
2204
  throw n;
2205
2205
  }
@@ -2316,7 +2316,7 @@ function fu(t, e) {
2316
2316
  }
2317
2317
  return i;
2318
2318
  }
2319
- function z(t, e, n) {
2319
+ function K(t, e, n) {
2320
2320
  return Object.values(t).find((r) => {
2321
2321
  const [i, s, o] = r["forward-identity"];
2322
2322
  return s === e && o === n;
@@ -2342,7 +2342,7 @@ function lu(t) {
2342
2342
  function ln(t, e, n) {
2343
2343
  return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
2344
2344
  // before assuming it's a ref lookup.
2345
- !z(t, e, n);
2345
+ !K(t, e, n);
2346
2346
  }
2347
2347
  function hn(t) {
2348
2348
  const [e, n, ...r] = t.split(".");
@@ -2352,8 +2352,8 @@ function hn(t) {
2352
2352
  }
2353
2353
  function hu(t, e, n) {
2354
2354
  if (!ln(t, e, n))
2355
- return z(t, e, n);
2356
- const r = hn(n), i = z(t, e, r) || Se(t, e, r);
2355
+ return K(t, e, n);
2356
+ const r = hn(n), i = K(t, e, r) || Se(t, e, r);
2357
2357
  if (i && i["value-type"] !== "ref")
2358
2358
  throw new Error(`${n} does not reference a valid link attribute.`);
2359
2359
  return i;
@@ -2375,13 +2375,13 @@ function Mi(t, e, n, r) {
2375
2375
  return Array.isArray(i) ? [[
2376
2376
  "add-triple",
2377
2377
  i,
2378
- z(t, e, "id").id,
2378
+ K(t, e, "id").id,
2379
2379
  i
2380
2380
  ]].concat(r) : r;
2381
2381
  }
2382
2382
  function pu({ attrs: t }, [e, n, r]) {
2383
2383
  const i = Object.entries(r).flatMap(([s, o]) => {
2384
- const u = Array.isArray(o) ? o : [o], a = z(t, e, s), d = Se(t, e, s);
2384
+ const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = Se(t, e, s);
2385
2385
  return u.map((c) => a ? [
2386
2386
  "add-triple",
2387
2387
  ee(t, e, n),
@@ -2398,7 +2398,7 @@ function pu({ attrs: t }, [e, n, r]) {
2398
2398
  }
2399
2399
  function yu({ attrs: t }, [e, n, r]) {
2400
2400
  const i = Object.entries(r).flatMap(([s, o]) => {
2401
- const u = Array.isArray(o) ? o : [o], a = z(t, e, s), d = Se(t, e, s);
2401
+ const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = Se(t, e, s);
2402
2402
  return u.map((c) => a ? [
2403
2403
  "retract-triple",
2404
2404
  ee(t, e, n),
@@ -2441,14 +2441,14 @@ function Ri({ stores: t, attrs: e }, [n, r, i, s]) {
2441
2441
  function _u(t, e) {
2442
2442
  const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = Dn(o), d = ee(r, i, s);
2443
2443
  return [["id", d]].concat(Object.entries(a)).map(([f, h]) => {
2444
- const p = z(r, i, f);
2444
+ const p = K(r, i, f);
2445
2445
  return p["checked-data-type"] === "date" && t.useDateObjects && (h = kt(h)), ["add-triple", d, p.id, h, { mode: "create" }];
2446
2446
  });
2447
2447
  }
2448
2448
  function gu(t, e) {
2449
2449
  const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = Dn(o), d = ee(r, i, s), c = Ri(t, [i, d, o, u]);
2450
2450
  return [["id", d]].concat(Object.entries(a)).map(([h, p]) => {
2451
- const b = z(r, i, h);
2451
+ const b = K(r, i, h);
2452
2452
  return b["checked-data-type"] === "date" && t.useDateObjects && (p = kt(p)), [
2453
2453
  "add-triple",
2454
2454
  d,
@@ -2463,7 +2463,7 @@ function Tu({ attrs: t }, [e, n]) {
2463
2463
  }
2464
2464
  function wu(t, e) {
2465
2465
  const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = Dn(o), d = ee(r, i, s), c = Ri(t, [i, d, o, u]), f = Object.entries(a).map(([p, b]) => {
2466
- const y = z(r, i, p);
2466
+ const y = K(r, i, p);
2467
2467
  return [
2468
2468
  "deep-merge-triple",
2469
2469
  d,
@@ -2475,7 +2475,7 @@ function wu(t, e) {
2475
2475
  return [[
2476
2476
  "add-triple",
2477
2477
  d,
2478
- z(r, i, "id").id,
2478
+ K(r, i, "id").id,
2479
2479
  d,
2480
2480
  ...c ? [c] : []
2481
2481
  ]].concat(f);
@@ -2599,7 +2599,7 @@ function $u({ attrs: t, schema: e }, n) {
2599
2599
  f != null && f.isUnsynced && !s.has(f.id) && (u.push(["add-attr", f]), s.add(f.id));
2600
2600
  }
2601
2601
  function c(f, h) {
2602
- const p = z(o, f, h), b = Se(o, f, h);
2602
+ const p = K(o, f, h), b = Se(o, f, h);
2603
2603
  d(p), d(b), !p && !b && a(jr(e, f, h, Mu));
2604
2604
  }
2605
2605
  for (const f of n)
@@ -2607,29 +2607,29 @@ function $u({ attrs: t, schema: e }, n) {
2607
2607
  const y = p[0];
2608
2608
  if (b) {
2609
2609
  c(h, b);
2610
- const _ = z(o, h, b), T = Se(o, h, b);
2610
+ const _ = K(o, h, b), T = Se(o, h, b);
2611
2611
  d(_), d(T);
2612
2612
  const w = ((r = _ == null ? void 0 : _["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = T == null ? void 0 : T["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || b;
2613
2613
  if (ln(o, w, y))
2614
2614
  c(w, hn(y));
2615
2615
  else {
2616
- const m = z(o, w, y);
2616
+ const m = K(o, w, y);
2617
2617
  m || a(pt(e, w, y, yn)), d(m);
2618
2618
  }
2619
2619
  } else if (ln(o, h, y))
2620
2620
  c(h, hn(y));
2621
2621
  else {
2622
- const _ = z(o, h, y);
2622
+ const _ = K(o, h, y);
2623
2623
  _ || a(pt(e, h, y, yn)), d(_);
2624
2624
  }
2625
2625
  }
2626
2626
  for (const f of n) {
2627
2627
  const [h, p, b, y] = f;
2628
2628
  if (ku.has(h)) {
2629
- const _ = z(o, p, "id");
2629
+ const _ = K(o, p, "id");
2630
2630
  d(_), _ || a(pt(e, p, "id", { "unique?": !0 }));
2631
2631
  for (const T of Object.keys(y)) {
2632
- const w = z(o, p, T);
2632
+ const w = K(o, p, T);
2633
2633
  if (d(w), Iu.has(h) && (w || a(pt(e, p, T, T === "id" ? { "unique?": !0 } : null))), ju.has(h)) {
2634
2634
  const m = Se(o, p, T);
2635
2635
  !w && !m && a(jr(e, p, T)), d(m);
@@ -2758,11 +2758,11 @@ class xi {
2758
2758
  };
2759
2759
  }
2760
2760
  }
2761
- class Le extends Error {
2761
+ class Fe extends Error {
2762
2762
  constructor(e, n) {
2763
2763
  super(e), this.hint = n;
2764
2764
  const r = new.target.prototype;
2765
- Object.setPrototypeOf && Object.setPrototypeOf(this, r), Error.captureStackTrace && Error.captureStackTrace(this, Le), this.name = "InstantError";
2765
+ Object.setPrototypeOf && Object.setPrototypeOf(this, r), Error.captureStackTrace && Error.captureStackTrace(this, Fe), this.name = "InstantError";
2766
2766
  }
2767
2767
  get [Symbol.toStringTag]() {
2768
2768
  return "InstantError";
@@ -2795,7 +2795,7 @@ var Uu = function(t, e, n, r) {
2795
2795
  d((r = r.apply(t, e || [])).next());
2796
2796
  });
2797
2797
  };
2798
- class It extends Le {
2798
+ class It extends Fe {
2799
2799
  constructor(e) {
2800
2800
  var n;
2801
2801
  const r = ((n = e.body) === null || n === void 0 ? void 0 : n.message) || `API Error (${e.status})`;
@@ -2813,7 +2813,7 @@ function ae(t, e) {
2813
2813
  return n.status === 200 ? Promise.resolve(r) : Promise.reject(new It({ status: n.status, body: r }));
2814
2814
  });
2815
2815
  }
2816
- var Ne = function(t, e, n, r) {
2816
+ var We = function(t, e, n, r) {
2817
2817
  function i(s) {
2818
2818
  return s instanceof n ? s : new n(function(o) {
2819
2819
  o(s);
@@ -2848,7 +2848,7 @@ function Lu({ apiURI: t, appId: e, email: n }) {
2848
2848
  });
2849
2849
  }
2850
2850
  function Fu(t) {
2851
- return Ne(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
2851
+ return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
2852
2852
  return yield ae(`${e}/runtime/auth/verify_magic_code`, {
2853
2853
  method: "POST",
2854
2854
  headers: { "content-type": "application/json" },
@@ -2861,7 +2861,7 @@ function Fu(t) {
2861
2861
  });
2862
2862
  }
2863
2863
  function Nu(t) {
2864
- return Ne(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
2864
+ return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
2865
2865
  return yield ae(`${e}/runtime/auth/verify_refresh_token`, {
2866
2866
  method: "POST",
2867
2867
  headers: { "content-type": "application/json" },
@@ -2873,7 +2873,7 @@ function Nu(t) {
2873
2873
  });
2874
2874
  }
2875
2875
  function Wu(t) {
2876
- return Ne(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
2876
+ return We(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
2877
2877
  return yield ae(`${e}/runtime/auth/sign_in_guest`, {
2878
2878
  method: "POST",
2879
2879
  headers: { "content-type": "application/json" },
@@ -2884,7 +2884,7 @@ function Wu(t) {
2884
2884
  });
2885
2885
  }
2886
2886
  function Pr(t) {
2887
- return Ne(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
2887
+ return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
2888
2888
  return yield ae(`${e}/runtime/oauth/token`, {
2889
2889
  method: "POST",
2890
2890
  headers: { "content-type": "application/json" },
@@ -2898,7 +2898,7 @@ function Pr(t) {
2898
2898
  });
2899
2899
  }
2900
2900
  function Vu(t) {
2901
- return Ne(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
2901
+ return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
2902
2902
  return yield ae(`${e}/runtime/oauth/id_token`, {
2903
2903
  method: "POST",
2904
2904
  headers: { "content-type": "application/json" },
@@ -2913,7 +2913,7 @@ function Vu(t) {
2913
2913
  });
2914
2914
  }
2915
2915
  function qu(t) {
2916
- return Ne(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
2916
+ return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
2917
2917
  return yield ae(`${e}/runtime/signout`, {
2918
2918
  method: "POST",
2919
2919
  headers: {
@@ -3068,7 +3068,7 @@ class Rr {
3068
3068
  this._reject(e);
3069
3069
  }
3070
3070
  }
3071
- var ze = function(t, e, n, r) {
3071
+ var Ke = function(t, e, n, r) {
3072
3072
  function i(s) {
3073
3073
  return s instanceof n ? s : new n(function(o) {
3074
3074
  o(s);
@@ -3103,7 +3103,7 @@ class bn {
3103
3103
  this._subs = [], this._nextSave = null, this._persister = e, this._key = n, this._onMerge = i, this._loadedCbs = [], this._isLoading = !0, this.currentValue = r, this.serialize = s, this.parse = o, this._saveThrottleMs = u, this._pendingSaveCbs = [], this._version = 0, this._idleCallbackMaxWaitMs = a, this._load();
3104
3104
  }
3105
3105
  _getFromStorage() {
3106
- return ze(this, void 0, void 0, function* () {
3106
+ return Ke(this, void 0, void 0, function* () {
3107
3107
  try {
3108
3108
  return this.parse(yield this._persister.getItem(this._key));
3109
3109
  } catch (e) {
@@ -3112,7 +3112,7 @@ class bn {
3112
3112
  });
3113
3113
  }
3114
3114
  _load() {
3115
- return ze(this, void 0, void 0, function* () {
3115
+ return Ke(this, void 0, void 0, function* () {
3116
3116
  const e = yield this._getFromStorage();
3117
3117
  this._isLoading = !1;
3118
3118
  const n = this._onMerge(e, this.currentValue);
@@ -3122,7 +3122,7 @@ class bn {
3122
3122
  });
3123
3123
  }
3124
3124
  waitForLoaded() {
3125
- return ze(this, void 0, void 0, function* () {
3125
+ return Ke(this, void 0, void 0, function* () {
3126
3126
  if (!this._isLoading)
3127
3127
  return;
3128
3128
  yield new Promise((n) => {
@@ -3137,7 +3137,7 @@ class bn {
3137
3137
  return this._version;
3138
3138
  }
3139
3139
  waitForSync() {
3140
- return ze(this, void 0, void 0, function* () {
3140
+ return Ke(this, void 0, void 0, function* () {
3141
3141
  if (!this._nextSave)
3142
3142
  return;
3143
3143
  yield new Promise((n) => {
@@ -3152,7 +3152,7 @@ class bn {
3152
3152
  this._pendingSaveCbs.length = 0;
3153
3153
  }
3154
3154
  flush() {
3155
- return ze(this, void 0, void 0, function* () {
3155
+ return Ke(this, void 0, void 0, function* () {
3156
3156
  this._nextSave && (clearTimeout(this._nextSave), this._writeToStorage());
3157
3157
  });
3158
3158
  }
@@ -3206,7 +3206,7 @@ function xr(t) {
3206
3206
  }, e;
3207
3207
  }, {});
3208
3208
  }
3209
- const qn = "v0.22.47-experimental.sync-table.19152834603.1";
3209
+ const qn = "v0.22.47-experimental.sync-table.19174988015.1";
3210
3210
  function Zu(t, e) {
3211
3211
  return {
3212
3212
  info: t ? (...n) => console.info(...n, e()) : () => {
@@ -3338,7 +3338,7 @@ const Dr = [
3338
3338
  default:
3339
3339
  throw new R(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
3340
3340
  }
3341
- }, Re = (t, e, n, r, i) => {
3341
+ }, $e = (t, e, n, r, i) => {
3342
3342
  const s = Xu(n), o = n.valueType === "json";
3343
3343
  if (typeof t == "object" && t !== null && !Array.isArray(t)) {
3344
3344
  if (o)
@@ -3368,23 +3368,23 @@ const Dr = [
3368
3368
  if (!a)
3369
3369
  throw new R(`Target entity '${o}' does not exist in schema for dot notation path '${t}'.`, i);
3370
3370
  if (u === "id") {
3371
- if (typeof e == "string" && !De(e))
3371
+ if (typeof e == "string" && !Ue(e))
3372
3372
  throw new R(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, i);
3373
- Re(e, t, new H("string", !1, !0), n, i);
3373
+ $e(e, t, new H("string", !1, !0), n, i);
3374
3374
  return;
3375
3375
  }
3376
3376
  const d = a.attrs[u];
3377
3377
  if (Object.keys(a.links).includes(u)) {
3378
- if (typeof e == "string" && !De(e))
3378
+ if (typeof e == "string" && !Ue(e))
3379
3379
  throw new R(`Invalid value for link '${u}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
3380
- Re(e, t, new H("string", !1, !0), n, i);
3380
+ $e(e, t, new H("string", !1, !0), n, i);
3381
3381
  return;
3382
3382
  }
3383
3383
  if (!d) {
3384
3384
  const c = Object.keys(a.attrs);
3385
3385
  throw new R(`Attribute '${u}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
3386
3386
  }
3387
- Re(e, t, d, n, i);
3387
+ $e(e, t, d, n, i);
3388
3388
  }, Ni = (t, e, n, r) => {
3389
3389
  for (const [i, s] of Object.entries(t)) {
3390
3390
  if (i === "or" || i === "and") {
@@ -3394,7 +3394,7 @@ const Dr = [
3394
3394
  continue;
3395
3395
  }
3396
3396
  if (i === "id") {
3397
- Re(s, "id", new H("string", !1, !0), e, `${r}.id`);
3397
+ $e(s, "id", new H("string", !1, !0), e, `${r}.id`);
3398
3398
  continue;
3399
3399
  }
3400
3400
  if (i.includes(".")) {
@@ -3410,12 +3410,12 @@ const Dr = [
3410
3410
  throw new R(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${d.length > 0 ? d.join(", ") : "none"}. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${i}`);
3411
3411
  }
3412
3412
  if (u)
3413
- Re(s, i, u, e, `${r}.${i}`);
3413
+ $e(s, i, u, e, `${r}.${i}`);
3414
3414
  else if (a) {
3415
- if (typeof s == "string" && !De(s))
3415
+ if (typeof s == "string" && !Ue(s))
3416
3416
  throw new R(`Invalid value for link '${i}' in entity '${e}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
3417
3417
  const d = new H("string", !1, !0);
3418
- Re(s, i, d, e, `${r}.${i}`);
3418
+ $e(s, i, d, e, `${r}.${i}`);
3419
3419
  }
3420
3420
  }
3421
3421
  }, na = (t, e, n, r, i = 0) => {
@@ -3478,7 +3478,7 @@ const Dr = [
3478
3478
  Wi(n[r], r, e, r, 0);
3479
3479
  }
3480
3480
  }
3481
- }, Lr = (t) => typeof t != "string" ? !1 : At(t) ? !0 : De(t);
3481
+ }, Lr = (t) => typeof t != "string" ? !1 : At(t) ? !0 : Ue(t);
3482
3482
  class ie extends Error {
3483
3483
  constructor(e) {
3484
3484
  super(e), this.name = "TransactionValidationError";
@@ -3539,7 +3539,7 @@ const Vi = (t) => t.length > 0 ? t.join(", ") : "none", ra = (t, e) => new ie(`E
3539
3539
  if (!e)
3540
3540
  return;
3541
3541
  const [n, r, i, s] = t;
3542
- if (!Array.isArray(i) && !De(i))
3542
+ if (!Array.isArray(i) && !Ue(i))
3543
3543
  throw new ie(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
3544
3544
  if (typeof r != "string")
3545
3545
  throw new ie(`Entity name must be a string, but received: ${typeof r}`);
@@ -3787,10 +3787,10 @@ function la(t, e) {
3787
3787
  }
3788
3788
  return o;
3789
3789
  }
3790
- var Xe;
3790
+ var Me;
3791
3791
  (function(t) {
3792
- t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction";
3793
- })(Xe || (Xe = {}));
3792
+ t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
3793
+ })(Me || (Me = {}));
3794
3794
  class ha {
3795
3795
  constructor(e, n, r, i, s) {
3796
3796
  this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new bn(n, "subs", {}, fa, da, (o) => ca(o, this.config.useDateObjects));
@@ -3799,17 +3799,18 @@ class ha {
3799
3799
  this.subs.flush();
3800
3800
  }
3801
3801
  subscribe(e, n) {
3802
- const r = K(e);
3803
- return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(n), this.initSubscription(e, r, n), () => {
3804
- this.unsubscribe(r, n);
3802
+ const r = z(e);
3803
+ return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(n), this.initSubscription(e, r, n), (i) => {
3804
+ this.unsubscribe(r, n, i == null ? void 0 : i.keepSubscription);
3805
3805
  };
3806
3806
  }
3807
- unsubscribe(e, n) {
3808
- const r = (this.callbacks[e] || []).filter((i) => i !== n);
3809
- if (this.callbacks[e] = r, !r.length) {
3810
- delete this.callbacks[e];
3811
- const i = this.subs.currentValue[e];
3812
- i != null && i.state && this.clearSubscriptionData(i.state.subscriptionId), this.subs.set((s) => (delete s[e], s));
3807
+ unsubscribe(e, n, r) {
3808
+ const i = (this.callbacks[e] || []).filter((s) => s !== n);
3809
+ if (this.callbacks[e] = i, !i.length) {
3810
+ if (delete this.callbacks[e], r)
3811
+ return;
3812
+ const s = this.subs.currentValue[e];
3813
+ s != null && s.state && this.clearSubscriptionData(s.state.subscriptionId), this.subs.set((o) => (delete o[e], o));
3813
3814
  }
3814
3815
  }
3815
3816
  sendStart(e) {
@@ -3833,14 +3834,13 @@ class ha {
3833
3834
  "subscription-id": e.subscriptionId
3834
3835
  });
3835
3836
  }
3836
- // XXX: maybe not always cb?
3837
3837
  initSubscription(e, n, r) {
3838
3838
  return qr(this, void 0, void 0, function* () {
3839
3839
  yield this.subs.waitForLoaded();
3840
3840
  const i = this.subs.currentValue[n];
3841
3841
  if (i && i.state && i.state.txId) {
3842
3842
  this.sendResync(i, i.state), i.entities && r && r({
3843
- type: Xe.LoadFromStorage,
3843
+ type: Me.LoadFromStorage,
3844
3844
  // XXX: Need to sort
3845
3845
  data: i.entities.map((s) => s.entity)
3846
3846
  });
@@ -3862,7 +3862,7 @@ class ha {
3862
3862
  });
3863
3863
  }
3864
3864
  onStartSyncOk(e) {
3865
- const n = e["subscription-id"], r = e.q, i = K(r);
3865
+ const n = e["subscription-id"], r = e.q, i = z(r);
3866
3866
  this.idToHash[n] = i, this.subs.set((s) => {
3867
3867
  const o = s[i];
3868
3868
  return o ? (o.state = {
@@ -3895,7 +3895,7 @@ class ha {
3895
3895
  return a;
3896
3896
  })[i];
3897
3897
  u.entities && this.notifyCbs(i, {
3898
- type: Xe.InitialSyncBatch,
3898
+ type: Me.InitialSyncBatch,
3899
3899
  data: u.entities.map((a) => a.entity),
3900
3900
  batch: s
3901
3901
  });
@@ -3973,7 +3973,7 @@ class ha {
3973
3973
  for (const y of d.sort().reverse())
3974
3974
  b.push(f[y].entity), f.splice(y, 1);
3975
3975
  this.notifyCbs(r, {
3976
- type: Xe.SyncTransaction,
3976
+ type: Me.SyncTransaction,
3977
3977
  data: f.map((y) => y.entity),
3978
3978
  added: p,
3979
3979
  removed: b,
@@ -3992,6 +3992,15 @@ class ha {
3992
3992
  return r;
3993
3993
  }
3994
3994
  }
3995
+ onStartSyncError(e) {
3996
+ const n = z(e["original-event"].q), r = {
3997
+ message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
3998
+ status: e.status,
3999
+ type: e.type,
4000
+ hint: e.hint
4001
+ };
4002
+ this.notifyCbs(n, { type: Me.Error, data: [], error: r });
4003
+ }
3995
4004
  onResyncError(e) {
3996
4005
  const n = e["original-event"]["subscription-id"], r = this.clearSubscriptionData(n);
3997
4006
  r && this.initSubscription(r.query, r.hash);
@@ -4111,7 +4120,7 @@ class va {
4111
4120
  !c.has(p) && !b["tx-id"] && this._sendMutation(p, b);
4112
4121
  });
4113
4122
  }, this.getPreviousResult = (d) => {
4114
- const c = K(d);
4123
+ const c = z(d);
4115
4124
  return this.dataForQuery(c);
4116
4125
  }, this.notifyOne = (d) => {
4117
4126
  var c, f;
@@ -4214,7 +4223,7 @@ class va {
4214
4223
  }, this._EventSource = s, this.config = Object.assign(Object.assign({}, ga), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : ba, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : _a, this._log = Zu(e.verbose || Vn || Di, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": qn }), this.config.schema && (this._linkIndex = xr(this.config.schema)), !!wa()) {
4215
4224
  if (!e.appId)
4216
4225
  throw new Error("Instant must be initialized with an appId.");
4217
- if (!De(e.appId))
4226
+ if (!Ue(e.appId))
4218
4227
  throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
4219
4228
  typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) => F(this, void 0, void 0, function* () {
4220
4229
  var c;
@@ -4285,7 +4294,7 @@ class va {
4285
4294
  status: o
4286
4295
  }));
4287
4296
  } else
4288
- i.reject(new Le(r.message, r.hint));
4297
+ i.reject(new Fe(r.message, r.hint));
4289
4298
  }
4290
4299
  _setStatus(e, n) {
4291
4300
  this.status = e, this._errorMessage = n, this.notifyConnectionStatusSubs(e);
@@ -4312,11 +4321,11 @@ class va {
4312
4321
  break;
4313
4322
  }
4314
4323
  case "add-query-exists": {
4315
- this.notifyOneQueryOnce(K(n.q));
4324
+ this.notifyOneQueryOnce(z(n.q));
4316
4325
  break;
4317
4326
  }
4318
4327
  case "add-query-ok": {
4319
- const { q: h, result: p } = n, b = K(h), y = (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"], _ = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, T = $r(p), w = Tt(this.attrs, T, d, this._linkIndex, this.config.useDateObjects);
4328
+ const { q: h, result: p } = n, b = z(h), y = (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"], _ = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, T = $r(p), w = Tt(this.attrs, T, d, this._linkIndex, this.config.useDateObjects);
4320
4329
  this.querySubs.set((m) => (m[b].result = {
4321
4330
  store: w,
4322
4331
  pageInfo: y,
@@ -4348,8 +4357,8 @@ class va {
4348
4357
  y !== this.pendingMutations.currentValue && this.pendingMutations.set(() => y);
4349
4358
  const _ = Br(y.entries()), T = h.map((w) => {
4350
4359
  var m, j, v, M;
4351
- const U = w["instaql-query"], B = w["instaql-result"], We = K(U), ut = $r(B), Rt = Tt(this.attrs, ut, d, this._linkIndex, this.config.useDateObjects), $t = this._applyOptimisticUpdates(Rt, _, b), at = (j = (m = B == null ? void 0 : B[0]) === null || m === void 0 ? void 0 : m.data) === null || j === void 0 ? void 0 : j["page-info"], ce = (M = (v = B == null ? void 0 : B[0]) === null || v === void 0 ? void 0 : v.data) === null || M === void 0 ? void 0 : M.aggregate;
4352
- return { hash: We, store: $t, pageInfo: at, aggregate: ce };
4360
+ const U = w["instaql-query"], B = w["instaql-result"], Ve = z(U), ut = $r(B), Rt = Tt(this.attrs, ut, d, this._linkIndex, this.config.useDateObjects), $t = this._applyOptimisticUpdates(Rt, _, b), at = (j = (m = B == null ? void 0 : B[0]) === null || m === void 0 ? void 0 : m.data) === null || j === void 0 ? void 0 : j["page-info"], ce = (M = (v = B == null ? void 0 : B[0]) === null || v === void 0 ? void 0 : v.data) === null || M === void 0 ? void 0 : M.aggregate;
4361
+ return { hash: Ve, store: $t, pageInfo: at, aggregate: ce };
4353
4362
  });
4354
4363
  T.forEach(({ hash: w, store: m, pageInfo: j, aggregate: v }) => {
4355
4364
  this.querySubs.set((M) => (M[w].result = { store: m, pageInfo: j, aggregate: v, processedTxId: b }, M));
@@ -4427,20 +4436,20 @@ class va {
4427
4436
  }
4428
4437
  }
4429
4438
  _handleReceiveError(e) {
4430
- var n, r, i, s, o, u;
4439
+ var n, r, i, s, o, u, a;
4431
4440
  console.log("error", e);
4432
- const a = e["client-event-id"];
4433
- this._inFlightMutationEventIds.delete(a);
4434
- const d = this.pendingMutations.currentValue.get(a), c = {
4441
+ const d = e["client-event-id"];
4442
+ this._inFlightMutationEventIds.delete(d);
4443
+ const c = this.pendingMutations.currentValue.get(d), f = {
4435
4444
  message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa."
4436
4445
  };
4437
- if (e.hint && (c.hint = e.hint), d) {
4438
- this._handleMutationError("error", a, e);
4446
+ if (e.hint && (f.hint = e.hint), c) {
4447
+ this._handleMutationError("error", d, e);
4439
4448
  return;
4440
4449
  }
4441
4450
  if (!((n = e["original-event"]) === null || n === void 0) && n.hasOwnProperty("q") && ((r = e["original-event"]) === null || r === void 0 ? void 0 : r.op) === "add-query") {
4442
- const p = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, b = K(p);
4443
- this.notifyQueryError(K(p), c), this.notifyQueryOnceError(p, b, a, c);
4451
+ const b = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, y = z(b);
4452
+ this.notifyQueryError(z(b), f), this.notifyQueryOnceError(b, y, d, f);
4444
4453
  return;
4445
4454
  }
4446
4455
  if (((s = e["original-event"]) === null || s === void 0 ? void 0 : s.op) === "init") {
@@ -4448,15 +4457,19 @@ class va {
4448
4457
  this.changeCurrentUser(null);
4449
4458
  return;
4450
4459
  }
4451
- this._setStatus(fe.ERRORED, c), this.notifyAll();
4460
+ this._setStatus(fe.ERRORED, f), this.notifyAll();
4452
4461
  return;
4453
4462
  }
4454
4463
  if (((u = e["original-event"]) === null || u === void 0 ? void 0 : u.op) === "resync-table") {
4455
4464
  this._syncTable.onResyncError(e);
4456
4465
  return;
4457
4466
  }
4458
- const h = Object.assign({}, e);
4459
- delete h.message, delete h.hint, console.error(e.message, h), e.hint && console.error(`This error comes with some debugging information. Here it is:
4467
+ if (((a = e["original-event"]) === null || a === void 0 ? void 0 : a.op) === "start-sync") {
4468
+ this._syncTable.onStartSyncError(e);
4469
+ return;
4470
+ }
4471
+ const p = Object.assign({}, e);
4472
+ delete p.message, delete p.hint, console.error(e.message, p), e.hint && console.error(`This error comes with some debugging information. Here it is:
4460
4473
  `, e.hint);
4461
4474
  }
4462
4475
  notifyQueryOnceError(e, n, r, i) {
@@ -4487,7 +4500,7 @@ class va {
4487
4500
  subscribeQuery(e, n, r) {
4488
4501
  var i;
4489
4502
  this.config.disableValidation || Ur(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
4490
- const s = K(e), o = this.getPreviousResult(e);
4503
+ const s = z(e), o = this.getPreviousResult(e);
4491
4504
  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), () => {
4492
4505
  this._unsubQuery(e, s, n);
4493
4506
  };
@@ -4500,7 +4513,7 @@ class va {
4500
4513
  return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
4501
4514
  if (!this.querySubs)
4502
4515
  return i.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), i.promise;
4503
- const s = K(e), o = this._startQuerySub(e, s);
4516
+ const s = z(e), o = this._startQuerySub(e, s);
4504
4517
  return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), ya), i.promise;
4505
4518
  }
4506
4519
  _completeQueryOnce(e, n, r) {
@@ -4529,7 +4542,7 @@ class va {
4529
4542
  return n;
4530
4543
  const i = (c) => {
4531
4544
  const [f, h, p] = c["forward-identity"];
4532
- return z(e, h, p);
4545
+ return K(e, h, p);
4533
4546
  }, s = (c) => {
4534
4547
  const [f, h, p] = c["forward-identity"];
4535
4548
  return Se(e, h, p);
@@ -4831,7 +4844,7 @@ class va {
4831
4844
  return F(this, void 0, void 0, function* () {
4832
4845
  const { user: e, error: n } = yield this.getCurrentUser();
4833
4846
  if (n)
4834
- throw new Le("Could not get current user: " + n.message);
4847
+ throw new Fe("Could not get current user: " + n.message);
4835
4848
  return e;
4836
4849
  });
4837
4850
  }
@@ -5584,13 +5597,16 @@ class Ba {
5584
5597
  queryOnce(e, n) {
5585
5598
  return this._reactor.queryOnce(e, n);
5586
5599
  }
5600
+ _syncTableExperimental(e, n) {
5601
+ return this._reactor.subscribeTable(e, n);
5602
+ }
5587
5603
  }
5588
5604
  function Gr(t) {
5589
5605
  if (!t)
5590
5606
  return "0";
5591
5607
  if (Ht.get(t))
5592
5608
  return Ht.get(t);
5593
- const e = K(t);
5609
+ const e = z(t);
5594
5610
  return Ht.set(t, e), e;
5595
5611
  }
5596
5612
  function Ga(t, e) {
@@ -5609,7 +5625,7 @@ function Ha(t, e) {
5609
5625
  const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
5610
5626
  n.allowedHosts.includes(window.location.hostname) && Ra(t, n);
5611
5627
  }
5612
- var Tn = { exports: {} }, Ke = {};
5628
+ var Tn = { exports: {} }, Be = {};
5613
5629
  /**
5614
5630
  * @license React
5615
5631
  * react-jsx-runtime.production.min.js
@@ -5621,7 +5637,7 @@ var Tn = { exports: {} }, Ke = {};
5621
5637
  */
5622
5638
  var Qr;
5623
5639
  function Ya() {
5624
- if (Qr) return Ke;
5640
+ if (Qr) return Be;
5625
5641
  Qr = 1;
5626
5642
  var t = ni, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
5627
5643
  function o(u, a, d) {
@@ -5631,11 +5647,11 @@ function Ya() {
5631
5647
  if (u && u.defaultProps) for (c in a = u.defaultProps, a) f[c] === void 0 && (f[c] = a[c]);
5632
5648
  return { $$typeof: e, type: u, key: h, ref: p, props: f, _owner: i.current };
5633
5649
  }
5634
- return Ke.Fragment = n, Ke.jsx = o, Ke.jsxs = o, Ke;
5650
+ return Be.Fragment = n, Be.jsx = o, Be.jsxs = o, Be;
5635
5651
  }
5636
- var Be = {}, Hr;
5652
+ var Ge = {}, Hr;
5637
5653
  function Ja() {
5638
- if (Hr) return Be;
5654
+ if (Hr) return Ge;
5639
5655
  Hr = 1;
5640
5656
  var t = {};
5641
5657
  /**
@@ -5673,10 +5689,10 @@ function Ja() {
5673
5689
  P.unshift("Warning: " + g), Function.prototype.apply.call(console[l], console, P);
5674
5690
  }
5675
5691
  }
5676
- var v = !1, M = !1, U = !1, B = !1, We = !1, ut;
5692
+ var v = !1, M = !1, U = !1, B = !1, Ve = !1, ut;
5677
5693
  ut = Symbol.for("react.module.reference");
5678
5694
  function Rt(l) {
5679
- return !!(typeof l == "string" || typeof l == "function" || l === i || l === o || We || l === s || l === c || l === f || B || l === b || v || M || U || typeof l == "object" && l !== null && (l.$$typeof === p || l.$$typeof === h || l.$$typeof === u || l.$$typeof === a || l.$$typeof === d || // This needs to include all possible module reference object
5695
+ return !!(typeof l == "string" || typeof l == "function" || l === i || l === o || Ve || l === s || l === c || l === f || B || l === b || v || M || U || typeof l == "object" && l !== null && (l.$$typeof === p || l.$$typeof === h || l.$$typeof === u || l.$$typeof === a || l.$$typeof === d || // This needs to include all possible module reference object
5680
5696
  // types supported by any Flight configuration anywhere since
5681
5697
  // we don't know which Flight build this will end up being used
5682
5698
  // with.
@@ -5737,13 +5753,13 @@ function Ja() {
5737
5753
  }
5738
5754
  return null;
5739
5755
  }
5740
- var _e = Object.assign, Ve = 0, Bn, Gn, Qn, Hn, Yn, Jn, Zn;
5756
+ var _e = Object.assign, qe = 0, Bn, Gn, Qn, Hn, Yn, Jn, Zn;
5741
5757
  function Xn() {
5742
5758
  }
5743
5759
  Xn.__reactDisabledLog = !0;
5744
5760
  function Gi() {
5745
5761
  {
5746
- if (Ve === 0) {
5762
+ if (qe === 0) {
5747
5763
  Bn = console.log, Gn = console.info, Qn = console.warn, Hn = console.error, Yn = console.group, Jn = console.groupCollapsed, Zn = console.groupEnd;
5748
5764
  var l = {
5749
5765
  configurable: !0,
@@ -5761,12 +5777,12 @@ function Ja() {
5761
5777
  groupEnd: l
5762
5778
  });
5763
5779
  }
5764
- Ve++;
5780
+ qe++;
5765
5781
  }
5766
5782
  }
5767
5783
  function Qi() {
5768
5784
  {
5769
- if (Ve--, Ve === 0) {
5785
+ if (qe--, qe === 0) {
5770
5786
  var l = {
5771
5787
  configurable: !0,
5772
5788
  enumerable: !0,
@@ -5796,7 +5812,7 @@ function Ja() {
5796
5812
  })
5797
5813
  });
5798
5814
  }
5799
- Ve < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
5815
+ qe < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
5800
5816
  }
5801
5817
  }
5802
5818
  var xt = w.ReactCurrentDispatcher, Dt;
@@ -5925,7 +5941,7 @@ function Ja() {
5925
5941
  }
5926
5942
  return "";
5927
5943
  }
5928
- var qe = Object.prototype.hasOwnProperty, tr = {}, nr = w.ReactDebugCurrentFrame;
5944
+ var ze = Object.prototype.hasOwnProperty, tr = {}, nr = w.ReactDebugCurrentFrame;
5929
5945
  function lt(l) {
5930
5946
  if (l) {
5931
5947
  var g = l._owner, S = ft(l.type, l._source, g ? g.type : null);
@@ -5935,7 +5951,7 @@ function Ja() {
5935
5951
  }
5936
5952
  function Zi(l, g, S, O, I) {
5937
5953
  {
5938
- var P = Function.call.bind(qe);
5954
+ var P = Function.call.bind(ze);
5939
5955
  for (var k in l)
5940
5956
  if (P(l, k)) {
5941
5957
  var A = void 0;
@@ -5983,7 +5999,7 @@ function Ja() {
5983
5999
  __source: !0
5984
6000
  }, or, ur;
5985
6001
  function rs(l) {
5986
- if (qe.call(l, "ref")) {
6002
+ if (ze.call(l, "ref")) {
5987
6003
  var g = Object.getOwnPropertyDescriptor(l, "ref").get;
5988
6004
  if (g && g.isReactWarning)
5989
6005
  return !1;
@@ -5991,7 +6007,7 @@ function Ja() {
5991
6007
  return l.ref !== void 0;
5992
6008
  }
5993
6009
  function is(l) {
5994
- if (qe.call(l, "key")) {
6010
+ if (ze.call(l, "key")) {
5995
6011
  var g = Object.getOwnPropertyDescriptor(l, "key").get;
5996
6012
  if (g && g.isReactWarning)
5997
6013
  return !1;
@@ -6057,7 +6073,7 @@ function Ja() {
6057
6073
  var P, k = {}, A = null, G = null;
6058
6074
  S !== void 0 && (ir(S), A = "" + S), is(g) && (ir(g.key), A = "" + g.key), rs(g) && (G = g.ref, ss(g, I));
6059
6075
  for (P in g)
6060
- qe.call(g, P) && !ns.hasOwnProperty(P) && (k[P] = g[P]);
6076
+ ze.call(g, P) && !ns.hasOwnProperty(P) && (k[P] = g[P]);
6061
6077
  if (l && l.defaultProps) {
6062
6078
  var x = l.defaultProps;
6063
6079
  for (P in x)
@@ -6208,7 +6224,7 @@ Check the top-level render call using <` + S + ">.");
6208
6224
  else
6209
6225
  lr(re, l);
6210
6226
  }
6211
- if (qe.call(g, "key")) {
6227
+ if (ze.call(g, "key")) {
6212
6228
  var ge = ce(l), Y = Object.keys(g).filter(function(Ts) {
6213
6229
  return Ts !== "key";
6214
6230
  }), Vt = Y.length > 0 ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}";
@@ -6232,8 +6248,8 @@ React keys must be passed directly to JSX without using spread:
6232
6248
  return pr(l, g, S, !1);
6233
6249
  }
6234
6250
  var bs = ys, _s = ps;
6235
- Be.Fragment = i, Be.jsx = bs, Be.jsxs = _s;
6236
- }(), Be;
6251
+ Ge.Fragment = i, Ge.jsx = bs, Ge.jsxs = _s;
6252
+ }(), Ge;
6237
6253
  }
6238
6254
  var Za = {};
6239
6255
  Za.NODE_ENV === "production" ? Tn.exports = Ya() : Tn.exports = Ja();
@@ -6249,7 +6265,7 @@ function Yr(t) {
6249
6265
  }
6250
6266
  function ec(t, e, n) {
6251
6267
  e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
6252
- const r = e ? Ka(e) : null, i = K(r), s = St(Yr(t._reactor.getPreviousResult(r))), o = be(
6268
+ const r = e ? Ka(e) : null, i = z(r), s = St(Yr(t._reactor.getPreviousResult(r))), o = be(
6253
6269
  (a) => (s.current = Yr(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (c) => {
6254
6270
  s.current = Object.assign({ isLoading: !c, data: void 0, pageInfo: void 0, error: void 0 }, c), a();
6255
6271
  }) : () => {
@@ -6400,7 +6416,7 @@ class fc {
6400
6416
  }, this.useUser = () => {
6401
6417
  const { user: r } = this.useAuth();
6402
6418
  if (!r)
6403
- throw new Le("useUser must be used within an auth-protected route");
6419
+ throw new Fe("useUser must be used within an auth-protected route");
6404
6420
  return r;
6405
6421
  }, this.useConnectionStatus = () => {
6406
6422
  const r = St(this.core._reactor.status), i = be((o) => this.core.subscribeConnectionStatus((a) => {
@@ -6620,32 +6636,32 @@ function Xr(t) {
6620
6636
  }
6621
6637
  var Bi = (t) => {
6622
6638
  throw TypeError(t);
6623
- }, zn = (t, e, n) => e.has(t) || Bi("Cannot " + n), E = (t, e, n) => (zn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), N = (t, e, n) => e.has(t) ? Bi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (zn(t, e, "write to private field"), e.set(t, n), n), le = (t, e, n) => (zn(t, e, "access private method"), n), J, we, je, wt, Ct, et, Me, tt, ye, Ie, $e, Pe, He, se, mn, Sn, vn, ei, On, En, Ye, An, Cn;
6639
+ }, zn = (t, e, n) => e.has(t) || Bi("Cannot " + n), E = (t, e, n) => (zn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), N = (t, e, n) => e.has(t) ? Bi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (zn(t, e, "write to private field"), e.set(t, n), n), le = (t, e, n) => (zn(t, e, "access private method"), n), J, we, je, wt, Ct, et, Re, tt, ye, Ie, xe, Pe, Ye, se, mn, Sn, vn, ei, On, En, Je, An, Cn;
6624
6640
  class mt extends EventTarget {
6625
6641
  constructor(e, n) {
6626
6642
  var r, i;
6627
- super(), N(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, N(this, J), N(this, we), N(this, je), N(this, wt), N(this, Ct), N(this, et), N(this, Me), N(this, tt, null), N(this, ye), N(this, Ie), N(this, $e, null), N(this, Pe, null), N(this, He, null), N(this, Sn, async (s) => {
6643
+ super(), N(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, N(this, J), N(this, we), N(this, je), N(this, wt), N(this, Ct), N(this, et), N(this, Re), N(this, tt, null), N(this, ye), N(this, Ie), N(this, xe, null), N(this, Pe, null), N(this, Ye, null), N(this, Sn, async (s) => {
6628
6644
  var o;
6629
6645
  E(this, Ie).reset();
6630
6646
  const { body: u, redirected: a, status: d, headers: c } = s;
6631
6647
  if (d === 204) {
6632
- le(this, se, Ye).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
6648
+ le(this, se, Je).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
6633
6649
  return;
6634
6650
  }
6635
6651
  if (a ? $(this, je, new URL(s.url)) : $(this, je, void 0), d !== 200) {
6636
- le(this, se, Ye).call(this, `Non-200 status code (${d})`, d);
6652
+ le(this, se, Je).call(this, `Non-200 status code (${d})`, d);
6637
6653
  return;
6638
6654
  }
6639
6655
  if (!(c.get("content-type") || "").startsWith("text/event-stream")) {
6640
- le(this, se, Ye).call(this, 'Invalid content type, expected "text/event-stream"', d);
6656
+ le(this, se, Je).call(this, 'Invalid content type, expected "text/event-stream"', d);
6641
6657
  return;
6642
6658
  }
6643
6659
  if (E(this, J) === this.CLOSED)
6644
6660
  return;
6645
6661
  $(this, J, this.OPEN);
6646
6662
  const f = new Event("open");
6647
- if ((o = E(this, He)) == null || o.call(this, f), this.dispatchEvent(f), typeof u != "object" || !u || !("getReader" in u)) {
6648
- le(this, se, Ye).call(this, "Invalid response body, expected a web ReadableStream", d), this.close();
6663
+ if ((o = E(this, Ye)) == null || o.call(this, f), this.dispatchEvent(f), typeof u != "object" || !u || !("getReader" in u)) {
6664
+ le(this, se, Je).call(this, "Invalid response body, expected a web ReadableStream", d), this.close();
6649
6665
  return;
6650
6666
  }
6651
6667
  const h = new TextDecoder(), p = u.getReader();
@@ -6667,7 +6683,7 @@ class mt extends EventTarget {
6667
6683
  }), N(this, En, (s) => {
6668
6684
  $(this, et, s);
6669
6685
  }), N(this, Cn, () => {
6670
- $(this, Me, void 0), E(this, J) === this.CONNECTING && le(this, se, mn).call(this);
6686
+ $(this, Re, void 0), E(this, J) === this.CONNECTING && le(this, se, mn).call(this);
6671
6687
  });
6672
6688
  try {
6673
6689
  if (e instanceof URL)
@@ -6717,10 +6733,10 @@ class mt extends EventTarget {
6717
6733
  }
6718
6734
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
6719
6735
  get onerror() {
6720
- return E(this, $e);
6736
+ return E(this, xe);
6721
6737
  }
6722
6738
  set onerror(e) {
6723
- $(this, $e, e);
6739
+ $(this, xe, e);
6724
6740
  }
6725
6741
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
6726
6742
  get onmessage() {
@@ -6731,10 +6747,10 @@ class mt extends EventTarget {
6731
6747
  }
6732
6748
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
6733
6749
  get onopen() {
6734
- return E(this, He);
6750
+ return E(this, Ye);
6735
6751
  }
6736
6752
  set onopen(e) {
6737
- $(this, He, e);
6753
+ $(this, Ye, e);
6738
6754
  }
6739
6755
  addEventListener(e, n, r) {
6740
6756
  const i = n;
@@ -6752,10 +6768,10 @@ class mt extends EventTarget {
6752
6768
  * @public
6753
6769
  */
6754
6770
  close() {
6755
- E(this, Me) && clearTimeout(E(this, Me)), E(this, J) !== this.CLOSED && (E(this, ye) && E(this, ye).abort(), $(this, J, this.CLOSED), $(this, ye, void 0));
6771
+ E(this, Re) && clearTimeout(E(this, Re)), E(this, J) !== this.CLOSED && (E(this, ye) && E(this, ye).abort(), $(this, J, this.CLOSED), $(this, ye, void 0));
6756
6772
  }
6757
6773
  }
6758
- J = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakMap(), Ct = /* @__PURE__ */ new WeakMap(), et = /* @__PURE__ */ new WeakMap(), Me = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), Pe = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakSet(), /**
6774
+ J = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakMap(), Ct = /* @__PURE__ */ new WeakMap(), et = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), Pe = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakSet(), /**
6759
6775
  * Connect to the given URL and start receiving events
6760
6776
  *
6761
6777
  * @internal
@@ -6787,11 +6803,11 @@ ei = function() {
6787
6803
  * @param code - The HTTP status code, if available
6788
6804
  * @internal
6789
6805
  */
6790
- Ye = function(t, e) {
6806
+ Je = function(t, e) {
6791
6807
  var n;
6792
6808
  E(this, J) !== this.CLOSED && $(this, J, this.CLOSED);
6793
6809
  const r = new Zr("error", { code: e, message: t });
6794
- (n = E(this, $e)) == null || n.call(this, r), this.dispatchEvent(r);
6810
+ (n = E(this, xe)) == null || n.call(this, r), this.dispatchEvent(r);
6795
6811
  }, /**
6796
6812
  * Schedules a reconnection attempt against the EventSource endpoint.
6797
6813
  *
@@ -6805,7 +6821,7 @@ An = function(t, e) {
6805
6821
  return;
6806
6822
  $(this, J, this.CONNECTING);
6807
6823
  const r = new Zr("error", { code: e, message: t });
6808
- (n = E(this, $e)) == null || n.call(this, r), this.dispatchEvent(r), $(this, Me, setTimeout(E(this, Cn), E(this, et)));
6824
+ (n = E(this, xe)) == null || n.call(this, r), this.dispatchEvent(r), $(this, Re, setTimeout(E(this, Cn), E(this, et)));
6809
6825
  }, Cn = /* @__PURE__ */ new WeakMap(), /**
6810
6826
  * ReadyState representing an EventSource currently trying to connect
6811
6827
  *