@instantdb/react 0.22.76-experimental.drewh-explorer-component.19938835959.1 → 0.22.76-experimental.fix-date.19939483252.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.
@@ -232,7 +232,7 @@ function fe(t) {
232
232
  var e;
233
233
  t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && fe(t.parent));
234
234
  }
235
- function wr() {
235
+ function Tr() {
236
236
  throw new Error("Cannot modify frozen object");
237
237
  }
238
238
  function Me(t, e, n, r, i) {
@@ -260,12 +260,12 @@ function Me(t, e, n, r, i) {
260
260
  case 2:
261
261
  for (const [a, u] of t)
262
262
  Me(a, a, n, r, i), Me(u, a, n, r, i);
263
- t.set = t.clear = t.delete = wr;
263
+ t.set = t.clear = t.delete = Tr;
264
264
  break;
265
265
  case 3:
266
266
  for (const a of t)
267
267
  Me(a, a, n, r, i);
268
- t.add = t.clear = t.delete = wr;
268
+ t.add = t.clear = t.delete = Tr;
269
269
  break;
270
270
  case 1:
271
271
  Object.freeze(t);
@@ -529,7 +529,7 @@ const jt = (t, e, n = !1) => {
529
529
  [vt]() {
530
530
  return this.entries();
531
531
  }
532
- }, Ds = Reflect.ownKeys(an), Tr = (t, e, { isValuesIterator: n }) => () => {
532
+ }, Ds = Reflect.ownKeys(an), wr = (t, e, { isValuesIterator: n }) => () => {
533
533
  var r, i;
534
534
  const s = e.next();
535
535
  if (s.done)
@@ -590,7 +590,7 @@ const jt = (t, e, n = !1) => {
590
590
  const e = t.setMap.keys();
591
591
  return {
592
592
  [Symbol.iterator]: () => this.values(),
593
- next: Tr(t, e, { isValuesIterator: !0 })
593
+ next: wr(t, e, { isValuesIterator: !0 })
594
594
  };
595
595
  },
596
596
  entries() {
@@ -599,7 +599,7 @@ const jt = (t, e, n = !1) => {
599
599
  const e = t.setMap.keys();
600
600
  return {
601
601
  [Symbol.iterator]: () => this.entries(),
602
- next: Tr(t, e, {
602
+ next: wr(t, e, {
603
603
  isValuesIterator: !1
604
604
  })
605
605
  };
@@ -757,10 +757,10 @@ function Ln(t) {
757
757
  var p, y;
758
758
  const b = j(u);
759
759
  let _ = c.type === 3 ? c.setMap : c.copy;
760
- const T = be(_, r), g = j(T);
760
+ const w = be(_, r), g = j(w);
761
761
  if (g) {
762
762
  let m = g.original;
763
- g.operated && (m = $n(T)), sn(g), on(g, ut, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(m, g.original)), ct(_, r, m);
763
+ g.operated && (m = $n(w)), sn(g), on(g, ut, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(m, g.original)), ct(_, r, m);
764
764
  }
765
765
  (y = b.callbacks) === null || y === void 0 || y.forEach((m) => {
766
766
  m(f, l);
@@ -890,22 +890,22 @@ const Ns = (t) => function e(n, r, i) {
890
890
  };
891
891
  if (!ae(f, _) && typeof f == "object" && f !== null)
892
892
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
893
- const [T, g] = Fs(f, _);
893
+ const [w, g] = Fs(f, _);
894
894
  if (typeof r != "function") {
895
895
  if (!ae(f, _))
896
896
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
897
- return [T, g];
897
+ return [w, g];
898
898
  }
899
899
  let m;
900
900
  try {
901
- m = d(T);
901
+ m = d(w);
902
902
  } catch (S) {
903
- throw rn(j(T)), S;
903
+ throw rn(j(w)), S;
904
904
  }
905
905
  const E = (S) => {
906
- const I = j(T);
906
+ const I = j(w);
907
907
  if (!je(S)) {
908
- if (S !== void 0 && !ye(S, T) && (I != null && I.operated))
908
+ if (S !== void 0 && !ye(S, w) && (I != null && I.operated))
909
909
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
910
910
  const B = S == null ? void 0 : S[js];
911
911
  if (B) {
@@ -919,7 +919,7 @@ const Ns = (t) => function e(n, r, i) {
919
919
  if (S !== void 0)
920
920
  return typeof S == "object" && S !== null && un({ rootDraft: I, value: S }), g([S]);
921
921
  }
922
- if (S === T || S === void 0)
922
+ if (S === w || S === void 0)
923
923
  return g([]);
924
924
  const x = j(S);
925
925
  if (_ === x.options) {
@@ -930,7 +930,7 @@ const Ns = (t) => function e(n, r, i) {
930
930
  return g([S]);
931
931
  };
932
932
  return m instanceof Promise ? m.then(E, (S) => {
933
- throw rn(j(T)), S;
933
+ throw rn(j(w)), S;
934
934
  }) : E(m);
935
935
  }, Pt = Ns();
936
936
  Object.prototype.constructor.toString();
@@ -952,7 +952,7 @@ function Fn(t) {
952
952
  r !== void 0 && (e[n] = r);
953
953
  return e;
954
954
  }
955
- function wi(t, e) {
955
+ function Ti(t, e) {
956
956
  if (!Ze(t) || !Ze(e))
957
957
  return e;
958
958
  const n = Object.assign({}, t);
@@ -964,7 +964,7 @@ function wi(t, e) {
964
964
  continue;
965
965
  }
966
966
  const i = Ze(t[r]) && Ze(e[r]);
967
- n[r] = i ? wi(t[r], e[r]) : e[r];
967
+ n[r] = i ? Ti(t[r], e[r]) : e[r];
968
968
  }
969
969
  return n;
970
970
  }
@@ -992,7 +992,7 @@ function Sr(t, e, n) {
992
992
  }
993
993
  r[e[e.length - 1]] = n;
994
994
  }
995
- function Ti(t, e) {
995
+ function wi(t, e) {
996
996
  if (!t || e.length === 0)
997
997
  return;
998
998
  const [n, ...r] = e;
@@ -1001,7 +1001,7 @@ function Ti(t, e) {
1001
1001
  Array.isArray(t) ? t.splice(n, 1) : delete t[n];
1002
1002
  return;
1003
1003
  }
1004
- Ti(t[n], r), qs(t[n]) && delete t[n];
1004
+ wi(t[n], r), qs(t[n]) && delete t[n];
1005
1005
  }
1006
1006
  }
1007
1007
  function qs(t) {
@@ -1244,13 +1244,21 @@ function Zs(t) {
1244
1244
  return null;
1245
1245
  }
1246
1246
  function Xs(t) {
1247
+ const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, n = t.match(e);
1248
+ if (n) {
1249
+ const [, r, i, s, o, a] = n, u = i.padStart(2, "0"), d = s.padStart(2, "0"), c = `${r}-${u}-${d}T${a}`;
1250
+ return new Date(c);
1251
+ }
1252
+ return null;
1253
+ }
1254
+ function eo(t) {
1247
1255
  const [e, n] = t.split(", "), [r, i, s] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
1248
1256
  if (!o)
1249
1257
  throw new Error(`Unable to parse time from: ${t}`);
1250
1258
  let [, a, u, d, c] = o;
1251
1259
  return a = Number(a), u = Number(u), d = Number(d), c === "PM" && a !== 12 ? a += 12 : c === "AM" && a === 12 && (a = 0), new Date(Date.UTC(s, r - 1, i, a, u, d));
1252
1260
  }
1253
- function eo(t) {
1261
+ function to(t) {
1254
1262
  switch (t) {
1255
1263
  case "epoch":
1256
1264
  return /* @__PURE__ */ new Date(0);
@@ -1262,27 +1270,28 @@ function eo(t) {
1262
1270
  return null;
1263
1271
  }
1264
1272
  }
1265
- function to(t) {
1273
+ function no(t) {
1266
1274
  const e = t.match(Or);
1267
1275
  if (!e)
1268
1276
  return null;
1269
1277
  const [n] = e, r = Ws[n], i = new Date(t.replace(Or, "Z"));
1270
1278
  return new Date(i.getTime() - r * 1e3);
1271
1279
  }
1272
- const no = [
1280
+ const ro = [
1273
1281
  Gs,
1274
1282
  Hs,
1275
1283
  Js,
1276
- Xs,
1284
+ eo,
1277
1285
  Ys,
1278
1286
  Vs,
1279
1287
  Zs,
1280
1288
  Qs,
1281
1289
  zs,
1282
- eo,
1283
- to
1290
+ to,
1291
+ no,
1292
+ Xs
1284
1293
  ];
1285
- function ro(t, e) {
1294
+ function io(t, e) {
1286
1295
  try {
1287
1296
  const n = t(e);
1288
1297
  return n instanceof Date && !isNaN(n.getTime()) ? n : null;
@@ -1291,14 +1300,14 @@ function ro(t, e) {
1291
1300
  }
1292
1301
  }
1293
1302
  function cn(t) {
1294
- for (const e of no) {
1295
- const n = ro(e, t);
1303
+ for (const e of ro) {
1304
+ const n = io(e, t);
1296
1305
  if (n)
1297
1306
  return n;
1298
1307
  }
1299
1308
  return null;
1300
1309
  }
1301
- function io(t) {
1310
+ function so(t) {
1302
1311
  try {
1303
1312
  const e = JSON.parse(t);
1304
1313
  return typeof e == "string" ? cn(e) : null;
@@ -1313,7 +1322,7 @@ function xt(t) {
1313
1322
  if (t instanceof Date)
1314
1323
  return t;
1315
1324
  if (typeof t == "string") {
1316
- const e = cn(t) || io(t) || cn(t.trim());
1325
+ const e = cn(t) || so(t) || cn(t.trim());
1317
1326
  if (!e)
1318
1327
  throw new Error(`Unable to parse \`${t}\` as a date.`);
1319
1328
  return e;
@@ -1322,7 +1331,7 @@ function xt(t) {
1322
1331
  throw new Error(`Invalid date value \`${t}\`. Expected a date, number, or string, got type ${typeof t}.`);
1323
1332
  }
1324
1333
  }
1325
- function so(t) {
1334
+ function oo(t) {
1326
1335
  return t.cardinality === "one";
1327
1336
  }
1328
1337
  function Nn(t) {
@@ -1395,7 +1404,7 @@ function Si(t) {
1395
1404
  function Oi(t) {
1396
1405
  return Et(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
1397
1406
  }
1398
- function oo(t, e) {
1407
+ function ao(t, e) {
1399
1408
  return We(t.eav, [e]) !== void 0;
1400
1409
  }
1401
1410
  function qn(t) {
@@ -1439,12 +1448,12 @@ function Ei(t, e) {
1439
1448
  const [r, i, s] = n, o = qe(t.attrs, i);
1440
1449
  o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]), Nn(o) && oe(t.vae, [s, i, r]));
1441
1450
  }
1442
- let ao = 0;
1451
+ let uo = 0;
1443
1452
  function Ai(t, e, n) {
1444
1453
  const [r, i, s] = n;
1445
1454
  let o;
1446
1455
  const a = We(t.ea, [r, i, s]);
1447
- return a && (o = a[3]), o || Date.now() * 10 + ao++;
1456
+ return a && (o = a[3]), o || Date.now() * 10 + uo++;
1448
1457
  }
1449
1458
  function ki(t, e) {
1450
1459
  var n;
@@ -1457,9 +1466,9 @@ function ki(t, e) {
1457
1466
  return;
1458
1467
  a["checked-data-type"] === "date" && t.useDateObjects && (o = xt(o));
1459
1468
  const u = We(t.eav, [i, s, o]), d = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n : Ai(t, a, r), c = [i, s, o, d];
1460
- so(a) ? (Z(t.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), Z(t.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (Z(t.eav, [i, s, o], c), Z(t.aev, [s, i, o], c)), Nn(a) && Z(t.vae, [o, s, i], c);
1469
+ oo(a) ? (Z(t.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), Z(t.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (Z(t.eav, [i, s, o], c), Z(t.aev, [s, i, o], c)), Nn(a) && Z(t.vae, [o, s, i], c);
1461
1470
  }
1462
- function uo(t, e) {
1471
+ function co(t, e) {
1463
1472
  var n;
1464
1473
  const r = dt(t, e);
1465
1474
  if (!r)
@@ -1475,7 +1484,7 @@ function uo(t, e) {
1475
1484
  const d = (n = u.values().next()) === null || n === void 0 ? void 0 : n.value;
1476
1485
  if (!d)
1477
1486
  return;
1478
- const c = d[2], f = wi(c, o), l = [
1487
+ const c = d[2], f = Ti(c, o), l = [
1479
1488
  i,
1480
1489
  s,
1481
1490
  f,
@@ -1506,8 +1515,8 @@ function dn(t, e) {
1506
1515
  const d = t.vae.get(a) && X(t.vae.get(a), 2);
1507
1516
  d && d.forEach((c) => {
1508
1517
  var f, l, p;
1509
- const [y, b, _] = c, T = t.attrs[b];
1510
- (!s || !T || ((f = T["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (oe(t.eav, [y, b, _]), oe(t.aev, [b, y, _]), oe(t.vae, [_, b, y])), T && T["on-delete"] === "cascade" && ((l = T["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && dn(t, [y, (p = T["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
1518
+ const [y, b, _] = c, w = t.attrs[b];
1519
+ (!s || !w || ((f = w["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (oe(t.eav, [y, b, _]), oe(t.aev, [b, y, _]), oe(t.vae, [_, b, y])), w && w["on-delete"] === "cascade" && ((l = w["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && dn(t, [y, (p = w["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
1511
1520
  }), ((r = t.vae.get(a)) === null || r === void 0 ? void 0 : r.size) === 0 && oe(t.vae, [a]);
1512
1521
  }
1513
1522
  function ji(t, e) {
@@ -1516,30 +1525,30 @@ function ji(t, e) {
1516
1525
  t[r] = n[r];
1517
1526
  });
1518
1527
  }
1519
- function co(t, [e]) {
1528
+ function fo(t, [e]) {
1520
1529
  t.attrs[e.id] = e, qn(t);
1521
1530
  }
1522
1531
  function Ci(t) {
1523
1532
  return X(t.eav, 3);
1524
1533
  }
1525
- function fo(t, [e]) {
1534
+ function lo(t, [e]) {
1526
1535
  if (!t.attrs[e])
1527
1536
  return;
1528
1537
  const n = Ci(t).filter(([r, i]) => i !== e);
1529
1538
  delete t.attrs[e], qn(t), ji(t, n);
1530
1539
  }
1531
- function lo(t, [e]) {
1540
+ function ho(t, [e]) {
1532
1541
  const n = t.attrs[e.id];
1533
1542
  n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), qn(t), ji(t, Ci(t)));
1534
1543
  }
1535
- function ho(t, e) {
1544
+ function po(t, e) {
1536
1545
  const [n, ...r] = e;
1537
1546
  switch (n) {
1538
1547
  case "add-triple":
1539
1548
  ki(t, r);
1540
1549
  break;
1541
1550
  case "deep-merge-triple":
1542
- uo(t, r);
1551
+ co(t, r);
1543
1552
  break;
1544
1553
  case "retract-triple":
1545
1554
  Ei(t, r);
@@ -1548,13 +1557,13 @@ function ho(t, e) {
1548
1557
  dn(t, r);
1549
1558
  break;
1550
1559
  case "add-attr":
1551
- co(t, r);
1560
+ fo(t, r);
1552
1561
  break;
1553
1562
  case "delete-attr":
1554
- fo(t, r);
1563
+ lo(t, r);
1555
1564
  break;
1556
1565
  case "update-attr":
1557
- lo(t, r);
1566
+ ho(t, r);
1558
1567
  break;
1559
1568
  case "restore-attr":
1560
1569
  break;
@@ -1609,13 +1618,13 @@ function gt(t, e, n) {
1609
1618
  }
1610
1619
  return s;
1611
1620
  }
1612
- function po(t, e, n) {
1621
+ function yo(t, e, n) {
1613
1622
  let r = "";
1614
1623
  return t !== void 0 && (r += "e"), e !== void 0 && (r += "a"), n !== void 0 && (r += "v"), r;
1615
1624
  }
1616
- function yo(t, [e, n, r]) {
1625
+ function bo(t, [e, n, r]) {
1617
1626
  var i, s;
1618
- switch (po(e, n, r)) {
1627
+ switch (yo(e, n, r)) {
1619
1628
  case "e": {
1620
1629
  const a = t.eav.get(e);
1621
1630
  return X(a, 2);
@@ -1661,7 +1670,7 @@ function yo(t, [e, n, r]) {
1661
1670
  return X(t.eav, 3);
1662
1671
  }
1663
1672
  }
1664
- function bo(t, e, n) {
1673
+ function _o(t, e, n) {
1665
1674
  var r;
1666
1675
  const i = {};
1667
1676
  for (const [s, o] of e.entries()) {
@@ -1671,7 +1680,7 @@ function bo(t, e, n) {
1671
1680
  }
1672
1681
  return i;
1673
1682
  }
1674
- function we(t, e, n) {
1683
+ function Te(t, e, n) {
1675
1684
  var r;
1676
1685
  return (r = t.attrIndexes.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
1677
1686
  }
@@ -1679,7 +1688,7 @@ function Pi(t, e, n) {
1679
1688
  var r;
1680
1689
  return (r = t.attrIndexes.revIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
1681
1690
  }
1682
- function _o(t, e) {
1691
+ function go(t, e) {
1683
1692
  return t.attrIndexes.blobAttrs.get(e);
1684
1693
  }
1685
1694
  function Ii(t, e) {
@@ -1687,7 +1696,7 @@ function Ii(t, e) {
1687
1696
  const r = t.attrIndexes.primaryKeys.get(e);
1688
1697
  return r || ((n = t.attrIndexes.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
1689
1698
  }
1690
- function go(t, e) {
1699
+ function To(t, e) {
1691
1700
  const n = dt(t, e);
1692
1701
  if (!n)
1693
1702
  return;
@@ -1706,20 +1715,20 @@ function wo(t, e) {
1706
1715
  const c = qe(t.attrs, s);
1707
1716
  if (c) {
1708
1717
  const f = Ii(t, c["forward-identity"][1]);
1709
- d = !!go(t, [i, f.id, i]);
1718
+ d = !!To(t, [i, f.id, i]);
1710
1719
  }
1711
1720
  return !(u === "create" && d || u === "update" && !d);
1712
1721
  });
1713
1722
  return Pt(t, (r) => {
1714
1723
  n.forEach((i) => {
1715
- ho(r, i);
1724
+ po(r, i);
1716
1725
  });
1717
1726
  });
1718
1727
  }
1719
- function To(t) {
1728
+ function mo(t) {
1720
1729
  return typeof t == "string" && t.startsWith("?");
1721
1730
  }
1722
- function mo(t, e, n) {
1731
+ function vo(t, e, n) {
1723
1732
  if (n.hasOwnProperty(t)) {
1724
1733
  const r = n[t];
1725
1734
  return Mi(r, e, n);
@@ -1729,15 +1738,15 @@ function mo(t, e, n) {
1729
1738
  function Er(t, e, n) {
1730
1739
  return t === e ? n : null;
1731
1740
  }
1732
- function vo(t) {
1741
+ function So(t) {
1733
1742
  switch (typeof t) {
1734
1743
  case "string":
1735
- return t.startsWith("?") ? mo : Er;
1744
+ return t.startsWith("?") ? vo : Er;
1736
1745
  default:
1737
1746
  return Er;
1738
1747
  }
1739
1748
  }
1740
- const So = [
1749
+ const Oo = [
1741
1750
  "in",
1742
1751
  "$in",
1743
1752
  "$not",
@@ -1745,69 +1754,69 @@ const So = [
1745
1754
  "$comparator"
1746
1755
  // covers all of $gt, $lt, etc.
1747
1756
  ];
1748
- function Oo(t) {
1749
- for (const e of So)
1757
+ function Eo(t) {
1758
+ for (const e of Oo)
1750
1759
  if (t.hasOwnProperty(e))
1751
1760
  return !0;
1752
1761
  return !1;
1753
1762
  }
1754
1763
  function Mi(t, e, n) {
1755
- return n ? typeof t == "object" ? Oo(t) ? n : null : vo(t)(t, e, n) : null;
1764
+ return n ? typeof t == "object" ? Eo(t) ? n : null : So(t)(t, e, n) : null;
1756
1765
  }
1757
- function Eo(t, e, n) {
1766
+ function Ao(t, e, n) {
1758
1767
  return t.reduce((r, i, s) => {
1759
1768
  const o = e[s];
1760
1769
  return Mi(i, o, r);
1761
1770
  }, n);
1762
1771
  }
1763
- function Ao(t, e, n) {
1764
- return Co(t, e, n).map((r) => Eo(e, r, n)).filter((r) => r);
1765
- }
1766
1772
  function ko(t, e, n) {
1767
- return e.or ? e.or.patterns.flatMap((r) => fn(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => fn(t, i, r), n) : n.flatMap((r) => Ao(t, e, r));
1773
+ return Po(t, e, n).map((r) => Ao(e, r, n)).filter((r) => r);
1774
+ }
1775
+ function jo(t, e, n) {
1776
+ return e.or ? e.or.patterns.flatMap((r) => fn(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => fn(t, i, r), n) : n.flatMap((r) => ko(t, e, r));
1768
1777
  }
1769
1778
  function fn(t, e, n = [{}]) {
1770
- return e.reduce((r, i) => ko(t, i, r), n);
1779
+ return e.reduce((r, i) => jo(t, i, r), n);
1771
1780
  }
1772
1781
  function Wn(t, e) {
1773
- return Array.isArray(e) ? e.map((n) => Wn(t, n)) : To(e) ? t[e] : e;
1782
+ return Array.isArray(e) ? e.map((n) => Wn(t, n)) : mo(e) ? t[e] : e;
1774
1783
  }
1775
- function jo(t, { find: e, where: n }) {
1784
+ function Co(t, { find: e, where: n }) {
1776
1785
  return fn(t, n).map((i) => Wn(i, e));
1777
1786
  }
1778
- function Co(t, e, n) {
1779
- return yo(t, Wn(n, e));
1787
+ function Po(t, e, n) {
1788
+ return bo(t, Wn(n, e));
1780
1789
  }
1781
- const Po = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
1790
+ const Io = /^(?:[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
1791
  function Fe(t) {
1783
- return typeof t == "string" && Po.test(t);
1792
+ return typeof t == "string" && Io.test(t);
1784
1793
  }
1785
1794
  const q = [];
1786
1795
  for (let t = 0; t < 256; ++t)
1787
1796
  q.push((t + 256).toString(16).slice(1));
1788
- function Io(t, e = 0) {
1797
+ function Mo(t, e = 0) {
1789
1798
  return (q[t[e + 0]] + q[t[e + 1]] + q[t[e + 2]] + q[t[e + 3]] + "-" + q[t[e + 4]] + q[t[e + 5]] + "-" + q[t[e + 6]] + q[t[e + 7]] + "-" + q[t[e + 8]] + q[t[e + 9]] + "-" + q[t[e + 10]] + q[t[e + 11]] + q[t[e + 12]] + q[t[e + 13]] + q[t[e + 14]] + q[t[e + 15]]).toLowerCase();
1790
1799
  }
1791
1800
  let Yt;
1792
- const Mo = new Uint8Array(16);
1793
- function Ro() {
1801
+ const Ro = new Uint8Array(16);
1802
+ function xo() {
1794
1803
  if (!Yt) {
1795
1804
  if (typeof crypto > "u" || !crypto.getRandomValues)
1796
1805
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1797
1806
  Yt = crypto.getRandomValues.bind(crypto);
1798
1807
  }
1799
- return Yt(Mo);
1808
+ return Yt(Ro);
1800
1809
  }
1801
- const xo = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ar = { randomUUID: xo };
1802
- function $o(t, e, n) {
1810
+ const $o = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ar = { randomUUID: $o };
1811
+ function Do(t, e, n) {
1803
1812
  var i;
1804
1813
  if (Ar.randomUUID && !t)
1805
1814
  return Ar.randomUUID();
1806
1815
  t = t || {};
1807
- const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? Ro();
1816
+ const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? xo();
1808
1817
  if (r.length < 16)
1809
1818
  throw new Error("Random bytes length must be >= 16");
1810
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Io(r);
1819
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Mo(r);
1811
1820
  }
1812
1821
  function kr(t) {
1813
1822
  const e = t.replace(/-/g, ""), n = [];
@@ -1815,7 +1824,7 @@ function kr(t) {
1815
1824
  n.push(parseInt(e.substring(r, r + 2), 16));
1816
1825
  return n;
1817
1826
  }
1818
- function Do(t, e) {
1827
+ function Uo(t, e) {
1819
1828
  for (let n = 0; n < t.length; n++) {
1820
1829
  if (t[n] < e[n])
1821
1830
  return -1;
@@ -1824,17 +1833,17 @@ function Do(t, e) {
1824
1833
  }
1825
1834
  return 0;
1826
1835
  }
1827
- function Uo(t, e) {
1828
- return Do(kr(t), kr(e));
1836
+ function Lo(t, e) {
1837
+ return Uo(kr(t), kr(e));
1829
1838
  }
1830
1839
  function K() {
1831
- return $o();
1840
+ return Do();
1832
1841
  }
1833
- function Lo(t, e) {
1842
+ function Fo(t, e) {
1834
1843
  return t.localeCompare(e);
1835
1844
  }
1836
- function Fo() {
1837
- let t = Lo;
1845
+ function No() {
1846
+ let t = Fo;
1838
1847
  if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
1839
1848
  try {
1840
1849
  t = Intl.Collator("en-US").compare;
@@ -1842,10 +1851,10 @@ function Fo() {
1842
1851
  }
1843
1852
  return t;
1844
1853
  }
1845
- const No = Fo();
1846
- let Ko = 0;
1854
+ const Ko = No();
1855
+ let qo = 0;
1847
1856
  function rt(t) {
1848
- return $t(`_${t}`, Ko++);
1857
+ return $t(`_${t}`, qo++);
1849
1858
  }
1850
1859
  function $t(t, e) {
1851
1860
  return `?${t}-${e}`;
@@ -1855,28 +1864,28 @@ class Ne extends Error {
1855
1864
  super(e), this.name = "AttrNotFoundError";
1856
1865
  }
1857
1866
  }
1858
- function qo(t, e) {
1867
+ function Wo(t, e) {
1859
1868
  const n = Ii(t, e);
1860
1869
  if (!n)
1861
1870
  throw new Ne(`Could not find id attr for ${e}`);
1862
1871
  return n;
1863
1872
  }
1864
1873
  function jr(t, e, n, r) {
1865
- return [Wo(t, e, n, r)];
1874
+ return [zo(t, e, n, r)];
1866
1875
  }
1867
- function Wo(t, e, n, r) {
1876
+ function zo(t, e, n, r) {
1868
1877
  return [
1869
1878
  t(n, r),
1870
- qo(e, n).id,
1879
+ Wo(e, n).id,
1871
1880
  t(n, r),
1872
1881
  t("time", r)
1873
1882
  ];
1874
1883
  }
1875
- function zo(t, e, n) {
1884
+ function Vo(t, e, n) {
1876
1885
  return t.map((r) => r === e ? n : r);
1877
1886
  }
1878
1887
  function Ri(t, e, n, r, i) {
1879
- const s = we(e, n, i), o = Pi(e, n, i), a = s || o;
1888
+ const s = Te(e, n, i), o = Pi(e, n, i), a = s || o;
1880
1889
  if (!a)
1881
1890
  throw new Ne(`Could not find attr for ${[n, i]}`);
1882
1891
  if (a["value-type"] !== "ref")
@@ -1904,7 +1913,7 @@ function Cr(t, e) {
1904
1913
  return typeof o != "string" ? !1 : i.test(o);
1905
1914
  };
1906
1915
  }
1907
- function Vo(t, e) {
1916
+ function Bo(t, e) {
1908
1917
  if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
1909
1918
  return e;
1910
1919
  const n = t["checked-data-type"] === "date";
@@ -1964,12 +1973,12 @@ function Vo(t, e) {
1964
1973
  }
1965
1974
  return e;
1966
1975
  }
1967
- function Bo(t, e, n, r, i, s) {
1968
- const o = we(e, n, i), a = Pi(e, n, i), u = o || a;
1976
+ function Go(t, e, n, r, i, s) {
1977
+ const o = Te(e, n, i), a = Pi(e, n, i), u = o || a;
1969
1978
  if (!u)
1970
1979
  throw new Ne(`No attr for etype = ${n} label = ${i}`);
1971
1980
  if (s != null && s.hasOwnProperty("$isNull")) {
1972
- const d = we(e, n, "id");
1981
+ const d = Te(e, n, "id");
1973
1982
  if (!d)
1974
1983
  throw new Ne(`No attr for etype = ${n} label = id`);
1975
1984
  return [
@@ -1982,11 +1991,11 @@ function Bo(t, e, n, r, i, s) {
1982
1991
  return o ? [
1983
1992
  t(n, r),
1984
1993
  u.id,
1985
- Vo(u, s),
1994
+ Bo(u, s),
1986
1995
  rt("time")
1987
1996
  ] : [s, u.id, t(n, r), rt("time")];
1988
1997
  }
1989
- function Go(t, e, n, r, i) {
1998
+ function Qo(t, e, n, r, i) {
1990
1999
  const [s, o, a] = i.reduce((u, d) => {
1991
2000
  const [c, f, l] = u, [p, y, b] = Ri(t, e, c, f, d);
1992
2001
  return [p, y, [...l, b]];
@@ -1994,19 +2003,19 @@ function Go(t, e, n, r, i) {
1994
2003
  return [s, o, a];
1995
2004
  }
1996
2005
  function ln(t, e, n, r, i, s) {
1997
- const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, d, c] = Go(t, e, n, r, o), f = Bo(t, e, u, d, a, s);
2006
+ const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, d, c] = Qo(t, e, n, r, o), f = Go(t, e, u, d, a, s);
1998
2007
  return c.concat([f]);
1999
2008
  }
2000
- function Qo(t, e) {
2009
+ function Ho(t, e) {
2001
2010
  return e ? [e].concat(t) : t;
2002
2011
  }
2003
- function Ho([t, e]) {
2012
+ function Yo([t, e]) {
2004
2013
  return t === "or" && Array.isArray(e);
2005
2014
  }
2006
- function Yo([t, e]) {
2015
+ function Jo([t, e]) {
2007
2016
  return t === "and" && Array.isArray(e);
2008
2017
  }
2009
- function Jo(t, e, n) {
2018
+ function Zo(t, e, n) {
2010
2019
  return (r, i) => {
2011
2020
  const s = t(r, i);
2012
2021
  return e == s ? s : `${s}-${n}`;
@@ -2014,25 +2023,25 @@ function Jo(t, e, n) {
2014
2023
  }
2015
2024
  function Pr(t, e, n, r, i, s) {
2016
2025
  const o = t(r, i), a = s.map((u, d) => {
2017
- const c = Jo(t, o, d);
2026
+ const c = Zo(t, o, d);
2018
2027
  return xi(c, n, r, i, u);
2019
2028
  });
2020
2029
  return { [e]: { patterns: a, joinSym: o } };
2021
2030
  }
2022
- function Zo(t) {
2031
+ function Xo(t) {
2023
2032
  const e = [];
2024
2033
  for (let n = 1; n <= t.length; n++)
2025
2034
  e.push(t.slice(0, n));
2026
2035
  return e;
2027
2036
  }
2028
2037
  function Ir(t, e, n, r, i) {
2029
- return Zo(i).map((s) => ln(t, e, n, r, s, { $isNull: !0 }));
2038
+ return Xo(i).map((s) => ln(t, e, n, r, s, { $isNull: !0 }));
2030
2039
  }
2031
2040
  function xi(t, e, n, r, i) {
2032
2041
  return Object.entries(i).flatMap(([s, o]) => {
2033
- if (Ho([s, o]))
2034
- return Pr(t, "or", e, n, r, o);
2035
2042
  if (Yo([s, o]))
2043
+ return Pr(t, "or", e, n, r, o);
2044
+ if (Jo([s, o]))
2036
2045
  return Pr(t, "and", e, n, r, o);
2037
2046
  if (s === "$entityIdStartsWith")
2038
2047
  return [];
@@ -2058,46 +2067,46 @@ function xi(t, e, n, r, i) {
2058
2067
  ] : ln(t, e, n, r, a, o);
2059
2068
  });
2060
2069
  }
2061
- function Xo(t, e, n, r) {
2070
+ function ea(t, e, n, r) {
2062
2071
  const i = $t;
2063
2072
  return r ? xi(i, t, e, n, r).concat(jr(i, t, e, n)) : jr(i, t, e, n);
2064
2073
  }
2065
- function ea(t, e, n) {
2074
+ function ta(t, e, n) {
2066
2075
  return [t(e, n), t("time", n)];
2067
2076
  }
2068
- function ta(t, e, n, r, i, s) {
2069
- const [o, a, u, d, c] = Ri(t, e, n, r, i), f = zo(u, t(n, r), s);
2077
+ function na(t, e, n, r, i, s) {
2078
+ const [o, a, u, d, c] = Ri(t, e, n, r, i), f = Vo(u, t(n, r), s);
2070
2079
  return [o, a, f, d, c];
2071
2080
  }
2072
- function na(t, e, { etype: n, level: r, form: i }, s) {
2081
+ function ra(t, e, { etype: n, level: r, form: i }, s) {
2073
2082
  const o = Object.keys(i).filter((a) => a !== "$");
2074
2083
  return o.length ? Object.entries(s).map(function([u, d]) {
2075
2084
  return o.map(function(l) {
2076
2085
  var p, y, b;
2077
2086
  const _ = !!(e.cardinalityInference && (!((b = (y = (p = e.linkIndex) === null || p === void 0 ? void 0 : p[n]) === null || y === void 0 ? void 0 : y[l]) === null || b === void 0) && b.isSingular));
2078
2087
  try {
2079
- const [T, g, m] = ta(t, e, n, r, l, u), E = Di(e, {
2080
- etype: T,
2088
+ const [w, g, m] = na(t, e, n, r, l, u), E = Di(e, {
2089
+ etype: w,
2081
2090
  level: g,
2082
2091
  form: i[l],
2083
2092
  join: m
2084
2093
  }), S = _ ? E[0] : E;
2085
2094
  return { [l]: S };
2086
- } catch (T) {
2087
- if (T instanceof Ne)
2095
+ } catch (w) {
2096
+ if (w instanceof Ne)
2088
2097
  return { [l]: _ ? void 0 : [] };
2089
- throw T;
2098
+ throw w;
2090
2099
  }
2091
2100
  }).reduce(function(l, p) {
2092
2101
  return Object.assign(Object.assign({}, l), p);
2093
2102
  }, d);
2094
2103
  }) : Object.values(s);
2095
2104
  }
2096
- function ra(t, e, n) {
2097
- return n === "string" ? No(t, e) : t > e ? 1 : -1;
2105
+ function ia(t, e, n) {
2106
+ return n === "string" ? Ko(t, e) : t > e ? 1 : -1;
2098
2107
  }
2099
2108
  function Xe(t, e, n, r, i) {
2100
- return e === r || e == null && r == null ? Uo(t, n) : r == null ? 1 : e == null ? -1 : ra(e, r, i);
2109
+ return e === r || e == null && r == null ? Lo(t, n) : r == null ? 1 : e == null ? -1 : ia(e, r, i);
2101
2110
  }
2102
2111
  function It([t, e], [n, r], i) {
2103
2112
  return Xe(t, e, n, r, i);
@@ -2105,7 +2114,7 @@ function It([t, e], [n, r], i) {
2105
2114
  function hn(t) {
2106
2115
  return t == null ? t : new Date(t).getTime();
2107
2116
  }
2108
- function ia(t, e, n, r) {
2117
+ function sa(t, e, n, r) {
2109
2118
  var i;
2110
2119
  const [s, o, a, u] = t, d = n === "desc" ? 1 : -1;
2111
2120
  if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
@@ -2113,65 +2122,65 @@ function ia(t, e, n, r) {
2113
2122
  const [c, f] = r, l = e["checked-data-type"], p = l === "date" ? hn(f) : f, y = l === "date" ? hn(a) : a;
2114
2123
  return It([c, p], [s, y], l) === d;
2115
2124
  }
2116
- function sa(t, e) {
2125
+ function oa(t, e) {
2117
2126
  const n = e[1];
2118
2127
  return t.attrs[n];
2119
2128
  }
2120
- function oa(t, e, n) {
2129
+ function aa(t, e, n) {
2121
2130
  const r = Object.keys(n)[0];
2122
- return we(t, e, r);
2131
+ return Te(t, e, r);
2123
2132
  }
2124
- function aa(t, e, n, r) {
2133
+ function ua(t, e, n, r) {
2125
2134
  if (n)
2126
- return sa(t, n);
2135
+ return oa(t, n);
2127
2136
  if (r)
2128
- return oa(t, e, r);
2137
+ return aa(t, e, r);
2129
2138
  }
2130
- function ua(t, e, n) {
2139
+ function ca(t, e, n) {
2131
2140
  var r, i;
2132
2141
  if (!Array.isArray(n.fields))
2133
- return _o(t, e);
2142
+ return go(t, e);
2134
2143
  const s = /* @__PURE__ */ new Map();
2135
2144
  for (const o of n.fields) {
2136
- const a = we(t, e, o), u = (r = a == null ? void 0 : a["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
2145
+ const a = Te(t, e, o), u = (r = a == null ? void 0 : a["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
2137
2146
  u && Kn(a) && s.set(u, a);
2138
2147
  }
2139
2148
  if (!s.has("id")) {
2140
- const o = we(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
2149
+ const o = Te(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
2141
2150
  a && s.set(a, o);
2142
2151
  }
2143
2152
  return s;
2144
2153
  }
2145
- function ca(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2154
+ function da(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2146
2155
  var s, o;
2147
- const a = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, u = $i(i), d = da(i);
2148
- let c = jo(t, r);
2149
- const f = n == null ? void 0 : n["start-cursor"], l = aa(t, e, f, a);
2156
+ const a = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, u = $i(i), d = fa(i);
2157
+ let c = Co(t, r);
2158
+ const f = n == null ? void 0 : n["start-cursor"], l = ua(t, e, f, a);
2150
2159
  if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
2151
2160
  const b = l["checked-data-type"] === "date", _ = l.id;
2152
- c = c.map(([T]) => {
2161
+ c = c.map(([w]) => {
2153
2162
  var g, m, E, S, I;
2154
- let x = (I = (S = (E = (m = (g = t.eav.get(T)) === null || g === void 0 ? void 0 : g.get(_)) === null || m === void 0 ? void 0 : m.values()) === null || E === void 0 ? void 0 : E.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
2155
- return b && (x = hn(x)), [T, x];
2163
+ let x = (I = (S = (E = (m = (g = t.eav.get(w)) === null || g === void 0 ? void 0 : g.get(_)) === null || m === void 0 ? void 0 : m.values()) === null || E === void 0 ? void 0 : E.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
2164
+ return b && (x = hn(x)), [w, x];
2156
2165
  });
2157
2166
  }
2158
- c.sort(d === "asc" ? function(_, T) {
2159
- return It(_, T, l == null ? void 0 : l["checked-data-type"]);
2160
- } : function(_, T) {
2161
- return It(T, _, l == null ? void 0 : l["checked-data-type"]);
2167
+ c.sort(d === "asc" ? function(_, w) {
2168
+ return It(_, w, l == null ? void 0 : l["checked-data-type"]);
2169
+ } : function(_, w) {
2170
+ return It(w, _, l == null ? void 0 : l["checked-data-type"]);
2162
2171
  });
2163
2172
  let p = {};
2164
- const y = ua(t, e, r);
2173
+ const y = ca(t, e, r);
2165
2174
  for (const b of c) {
2166
2175
  const [_] = b;
2167
- if (p[_] || !u && f && l && ia(f, l, d, b))
2176
+ if (p[_] || !u && f && l && sa(f, l, d, b))
2168
2177
  continue;
2169
- const T = bo(t, y, _);
2170
- T && (p[_] = T);
2178
+ const w = _o(t, y, _);
2179
+ w && (p[_] = w);
2171
2180
  }
2172
2181
  return p;
2173
2182
  }
2174
- function da(t) {
2183
+ function fa(t) {
2175
2184
  var e;
2176
2185
  const n = (e = t.$) === null || e === void 0 ? void 0 : e.order;
2177
2186
  return n && n[Object.keys(n)[0]] || "asc";
@@ -2181,11 +2190,11 @@ function $i(t) {
2181
2190
  const i = (e = t.$) === null || e === void 0 ? void 0 : e.offset, s = (n = t.$) === null || n === void 0 ? void 0 : n.before, o = (r = t.$) === null || r === void 0 ? void 0 : r.after;
2182
2191
  return !i && !s && !o;
2183
2192
  }
2184
- function fa(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
2193
+ function la(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
2185
2194
  var o, a, u, d, c;
2186
2195
  if (!$i(r) && (!s || !s["start-cursor"]))
2187
2196
  return [];
2188
- const f = Qo(Xo(t, e, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), l = ea($t, e, n), p = (a = r.$) === null || a === void 0 ? void 0 : a.fields, y = ca(t, {
2197
+ const f = Ho(ea(t, e, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), l = ta($t, e, n), p = (a = r.$) === null || a === void 0 ? void 0 : a.fields, y = da(t, {
2189
2198
  etype: e,
2190
2199
  pageInfo: s,
2191
2200
  form: r,
@@ -2198,9 +2207,9 @@ function fa(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
2198
2207
  }
2199
2208
  return y;
2200
2209
  }
2201
- function la(t, e) {
2210
+ function ha(t, e) {
2202
2211
  try {
2203
- return fa(t, e);
2212
+ return la(t, e);
2204
2213
  } catch (n) {
2205
2214
  if (n instanceof Ne)
2206
2215
  return {};
@@ -2208,10 +2217,10 @@ function la(t, e) {
2208
2217
  }
2209
2218
  }
2210
2219
  function Di(t, e) {
2211
- const n = la(t, e);
2212
- return na($t, t, e, n);
2220
+ const n = ha(t, e);
2221
+ return ra($t, t, e, n);
2213
2222
  }
2214
- function ha(t) {
2223
+ function pa(t) {
2215
2224
  const e = {};
2216
2225
  for (const [n, r] of Object.entries(t))
2217
2226
  e[n] = {
@@ -2231,9 +2240,9 @@ function Ui({ store: t, pageInfo: e, aggregate: n }, r) {
2231
2240
  pageInfo: e == null ? void 0 : e[u]
2232
2241
  })), a;
2233
2242
  }, {}) };
2234
- return e && (s.pageInfo = ha(e)), n && (s.aggregate = n), s;
2243
+ return e && (s.pageInfo = pa(e)), n && (s.aggregate = n), s;
2235
2244
  }
2236
- function pa() {
2245
+ function ya() {
2237
2246
  const e = {
2238
2247
  __etype: 1,
2239
2248
  __ops: 1,
@@ -2247,7 +2256,7 @@ function pa() {
2247
2256
  };
2248
2257
  return new Set(Object.keys(e));
2249
2258
  }
2250
- const ya = pa();
2259
+ const ba = ya();
2251
2260
  function pn(t, e, n) {
2252
2261
  const r = {
2253
2262
  __etype: t,
@@ -2259,7 +2268,7 @@ function pn(t, e, n) {
2259
2268
  return n;
2260
2269
  if (s === "__etype")
2261
2270
  return t;
2262
- if (ya.has(s))
2271
+ if (ba.has(s))
2263
2272
  return (o, a) => pn(t, e, [
2264
2273
  ...n,
2265
2274
  a ? [s, t, e, o, a] : [s, t, e, o]
@@ -2267,7 +2276,7 @@ function pn(t, e, n) {
2267
2276
  }
2268
2277
  });
2269
2278
  }
2270
- function Fc(t, e) {
2279
+ function Nc(t, e) {
2271
2280
  return `lookup__${t}__${JSON.stringify(e)}`;
2272
2281
  }
2273
2282
  function Mt(t) {
@@ -2277,7 +2286,7 @@ function Li(t) {
2277
2286
  const [e, n, ...r] = t.split("__");
2278
2287
  return [n, JSON.parse(r.join("__"))];
2279
2288
  }
2280
- function ba(t) {
2289
+ function _a(t) {
2281
2290
  return new Proxy({
2282
2291
  __etype: t
2283
2292
  }, {
@@ -2292,15 +2301,15 @@ function ba(t) {
2292
2301
  function zn() {
2293
2302
  return new Proxy({}, {
2294
2303
  get(t, e) {
2295
- return ba(e);
2304
+ return _a(e);
2296
2305
  }
2297
2306
  });
2298
2307
  }
2299
- const Nc = zn();
2300
- function _a(t) {
2308
+ const Kc = zn();
2309
+ function ga(t) {
2301
2310
  return t.__ops;
2302
2311
  }
2303
- function ga(t, e) {
2312
+ function Ta(t, e) {
2304
2313
  const { attrIdMap: n, refSwapAttrIds: r } = t, i = [];
2305
2314
  for (const o of e) {
2306
2315
  const a = n[o];
@@ -2353,7 +2362,7 @@ function bn(t) {
2353
2362
  throw new Error(`${t} is not a valid lookup attribute.`);
2354
2363
  return e;
2355
2364
  }
2356
- function Ta(t, e, n) {
2365
+ function ma(t, e, n) {
2357
2366
  if (!yn(t, e, n))
2358
2367
  return V(t, e, n);
2359
2368
  const r = bn(n), i = V(t, e, r) || Ae(t, e, r);
@@ -2368,7 +2377,7 @@ function ee(t, e, n) {
2368
2377
  const r = _n(n);
2369
2378
  if (r === null)
2370
2379
  return n;
2371
- const [i, s] = r, o = Ta(t, e, i);
2380
+ const [i, s] = r, o = ma(t, e, i);
2372
2381
  if (!o || !o["unique?"])
2373
2382
  throw new Error(`${i} is not a unique attribute.`);
2374
2383
  return [o.id, s];
@@ -2382,7 +2391,7 @@ function Fi(t, e, n, r) {
2382
2391
  i
2383
2392
  ]].concat(r) : r;
2384
2393
  }
2385
- function ma({ attrs: t }, [e, n, r]) {
2394
+ function va({ attrs: t }, [e, n, r]) {
2386
2395
  const i = Object.entries(r).flatMap(([s, o]) => {
2387
2396
  const a = Array.isArray(o) ? o : [o], u = V(t, e, s), d = Ae(t, e, s);
2388
2397
  return a.map((c) => u ? [
@@ -2399,7 +2408,7 @@ function ma({ attrs: t }, [e, n, r]) {
2399
2408
  });
2400
2409
  return Fi(t, e, n, i);
2401
2410
  }
2402
- function va({ attrs: t }, [e, n, r]) {
2411
+ function Sa({ attrs: t }, [e, n, r]) {
2403
2412
  const i = Object.entries(r).flatMap(([s, o]) => {
2404
2413
  const a = Array.isArray(o) ? o : [o], u = V(t, e, s), d = Ae(t, e, s);
2405
2414
  return a.map((c) => u ? [
@@ -2416,7 +2425,7 @@ function va({ attrs: t }, [e, n, r]) {
2416
2425
  });
2417
2426
  return Fi(t, e, n, i);
2418
2427
  }
2419
- function Sa(t, e, n) {
2428
+ function Oa(t, e, n) {
2420
2429
  if (Array.isArray(n)) {
2421
2430
  const [r, i] = n;
2422
2431
  for (const s of t || []) {
@@ -2439,16 +2448,16 @@ function Sa(t, e, n) {
2439
2448
  return !1;
2440
2449
  }
2441
2450
  function Ni({ stores: t, attrs: e }, [n, r, i, s]) {
2442
- return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : Sa(t, n, r) ? { mode: "update" } : null;
2451
+ return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : Oa(t, n, r) ? { mode: "update" } : null;
2443
2452
  }
2444
- function Oa(t, e) {
2453
+ function Ea(t, e) {
2445
2454
  const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Fn(o), d = ee(r, i, s);
2446
2455
  return [["id", d]].concat(Object.entries(u)).map(([f, l]) => {
2447
2456
  const p = V(r, i, f);
2448
2457
  return p["checked-data-type"] === "date" && t.useDateObjects && (l = xt(l)), ["add-triple", d, p.id, l, { mode: "create" }];
2449
2458
  });
2450
2459
  }
2451
- function Ea(t, e) {
2460
+ function Aa(t, e) {
2452
2461
  const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Fn(o), d = ee(r, i, s), c = Ni(t, [i, d, o, a]);
2453
2462
  return [["id", d]].concat(Object.entries(u)).map(([l, p]) => {
2454
2463
  const y = V(r, i, l);
@@ -2461,10 +2470,10 @@ function Ea(t, e) {
2461
2470
  ];
2462
2471
  });
2463
2472
  }
2464
- function Aa({ attrs: t }, [e, n]) {
2473
+ function ka({ attrs: t }, [e, n]) {
2465
2474
  return [["delete-entity", ee(t, e, n), e]];
2466
2475
  }
2467
- function ka(t, e) {
2476
+ function ja(t, e) {
2468
2477
  const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Fn(o), d = ee(r, i, s), c = Ni(t, [i, d, o, a]), f = Object.entries(u).map(([p, y]) => {
2469
2478
  const b = V(r, i, p);
2470
2479
  return [
@@ -2483,38 +2492,38 @@ function ka(t, e) {
2483
2492
  ...c ? [c] : []
2484
2493
  ]].concat(f);
2485
2494
  }
2486
- function ja({ attrs: t }, [e, n, r]) {
2495
+ function Ca({ attrs: t }, [e, n, r]) {
2487
2496
  return [["rule-params", ee(t, e, n), e, r]];
2488
2497
  }
2489
- function Ca(t) {
2498
+ function Pa(t) {
2490
2499
  const [e, n, r, i, s] = t;
2491
2500
  if (!i)
2492
2501
  return t;
2493
2502
  const o = Object.assign({}, i);
2494
2503
  return delete o.id, [e, n, r, o, ...s ? [s] : []];
2495
2504
  }
2496
- function Pa(t, e) {
2497
- const [n, ...r] = Ca(e);
2505
+ function Ia(t, e) {
2506
+ const [n, ...r] = Pa(e);
2498
2507
  switch (n) {
2499
2508
  case "merge":
2500
- return ka(t, r);
2509
+ return ja(t, r);
2501
2510
  case "create":
2502
- return Oa(t, r);
2503
- case "update":
2504
2511
  return Ea(t, r);
2512
+ case "update":
2513
+ return Aa(t, r);
2505
2514
  case "link":
2506
- return ma(t, r);
2507
- case "unlink":
2508
2515
  return va(t, r);
2516
+ case "unlink":
2517
+ return Sa(t, r);
2509
2518
  case "delete":
2510
- return Aa(t, r);
2519
+ return ka(t, r);
2511
2520
  case "ruleParams":
2512
- return ja(t, r);
2521
+ return Ca(t, r);
2513
2522
  default:
2514
2523
  throw new Error(`unsupported action ${n}`);
2515
2524
  }
2516
2525
  }
2517
- function Ia(t) {
2526
+ function Ma(t) {
2518
2527
  switch (t) {
2519
2528
  case "string":
2520
2529
  case "date":
@@ -2525,29 +2534,29 @@ function Ia(t) {
2525
2534
  return;
2526
2535
  }
2527
2536
  }
2528
- function Ma(t, e, n) {
2537
+ function Ra(t, e, n) {
2529
2538
  var r, i;
2530
2539
  const s = (i = (r = t.entities[e]) === null || r === void 0 ? void 0 : r.attrs) === null || i === void 0 ? void 0 : i[n];
2531
2540
  if (n === "id")
2532
2541
  return null;
2533
2542
  if (!s)
2534
2543
  throw new Error(`${e}.${n} does not exist in your schema`);
2535
- const { unique: o, indexed: a } = s == null ? void 0 : s.config, u = Ia(s == null ? void 0 : s.valueType);
2544
+ const { unique: o, indexed: a } = s == null ? void 0 : s.config, u = Ma(s == null ? void 0 : s.valueType);
2536
2545
  return {
2537
2546
  "index?": a,
2538
2547
  "unique?": o,
2539
2548
  "checked-data-type": u
2540
2549
  };
2541
2550
  }
2542
- function wt(t, e, n, r) {
2543
- const i = t ? Ma(t, e, n) : null, s = K(), a = [K(), e, n];
2551
+ function Tt(t, e, n, r) {
2552
+ const i = t ? Ra(t, e, n) : null, s = K(), a = [K(), e, n];
2544
2553
  return Object.assign(Object.assign({ id: s, "forward-identity": a, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
2545
2554
  }
2546
- function Ra(t, e, n) {
2555
+ function xa(t, e, n) {
2547
2556
  return Object.values(t.links).find((i) => i.forward.on === e && i.forward.label === n || i.reverse.on === e && i.reverse.label === n);
2548
2557
  }
2549
- function xa(t, e, n) {
2550
- const r = Ra(t, e, n);
2558
+ function $a(t, e, n) {
2559
+ const r = xa(t, e, n);
2551
2560
  if (!r)
2552
2561
  throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
2553
2562
  const { forward: i, reverse: s } = r;
@@ -2561,10 +2570,10 @@ function xa(t, e, n) {
2561
2570
  };
2562
2571
  }
2563
2572
  function Mr(t, e, n, r) {
2564
- const i = t ? xa(t, e, n) : null, s = K(), o = [K(), e, n], a = [K(), n, e];
2573
+ const i = t ? $a(t, e, n) : null, s = K(), o = [K(), e, n], a = [K(), n, e];
2565
2574
  return Object.assign(Object.assign({ id: s, "forward-identity": o, "reverse-identity": a, "value-type": "ref", cardinality: "many", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
2566
2575
  }
2567
- const $a = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Da = /* @__PURE__ */ new Set(["link", "unlink"]), Ua = /* @__PURE__ */ new Set(["create", "update", "merge"]), La = /* @__PURE__ */ new Set([
2576
+ const Da = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Ua = /* @__PURE__ */ new Set(["link", "unlink"]), La = /* @__PURE__ */ new Set(["create", "update", "merge"]), Fa = /* @__PURE__ */ new Set([
2568
2577
  "link",
2569
2578
  "unlink",
2570
2579
  "create",
@@ -2572,10 +2581,10 @@ const $a = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
2572
2581
  "merge",
2573
2582
  "delete",
2574
2583
  "ruleParams"
2575
- ]), gn = { "unique?": !0, "index?": !0 }, Fa = Object.assign(Object.assign({}, gn), { cardinality: "one" });
2576
- function Na(t) {
2584
+ ]), gn = { "unique?": !0, "index?": !0 }, Na = Object.assign(Object.assign({}, gn), { cardinality: "one" });
2585
+ function Ka(t) {
2577
2586
  const e = [], [n, r, i, s] = t;
2578
- if (!La.has(n))
2587
+ if (!Fa.has(n))
2579
2588
  return e;
2580
2589
  const o = _n(i);
2581
2590
  if (o && e.push({ etype: r, lookupPair: o }), n === "link")
@@ -2592,7 +2601,7 @@ function Na(t) {
2592
2601
  }
2593
2602
  return e;
2594
2603
  }
2595
- function Ka({ attrs: t, schema: e }, n) {
2604
+ function qa({ attrs: t, schema: e }, n) {
2596
2605
  var r, i;
2597
2606
  const [s, o, a] = [/* @__PURE__ */ new Set(), Object.assign({}, t), []];
2598
2607
  function u(f) {
@@ -2603,47 +2612,47 @@ function Ka({ attrs: t, schema: e }, n) {
2603
2612
  }
2604
2613
  function c(f, l) {
2605
2614
  const p = V(o, f, l), y = Ae(o, f, l);
2606
- d(p), d(y), !p && !y && u(Mr(e, f, l, Fa));
2615
+ d(p), d(y), !p && !y && u(Mr(e, f, l, Na));
2607
2616
  }
2608
2617
  for (const f of n)
2609
- for (const { etype: l, lookupPair: p, linkLabel: y } of Na(f)) {
2618
+ for (const { etype: l, lookupPair: p, linkLabel: y } of Ka(f)) {
2610
2619
  const b = p[0];
2611
2620
  if (y) {
2612
2621
  c(l, y);
2613
- const _ = V(o, l, y), T = Ae(o, l, y);
2614
- d(_), d(T);
2615
- const g = ((r = _ == null ? void 0 : _["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = T == null ? void 0 : T["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
2622
+ const _ = V(o, l, y), w = Ae(o, l, y);
2623
+ d(_), d(w);
2624
+ const g = ((r = _ == null ? void 0 : _["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = w == null ? void 0 : w["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
2616
2625
  if (yn(o, g, b))
2617
2626
  c(g, bn(b));
2618
2627
  else {
2619
2628
  const m = V(o, g, b);
2620
- m || u(wt(e, g, b, gn)), d(m);
2629
+ m || u(Tt(e, g, b, gn)), d(m);
2621
2630
  }
2622
2631
  } else if (yn(o, l, b))
2623
2632
  c(l, bn(b));
2624
2633
  else {
2625
2634
  const _ = V(o, l, b);
2626
- _ || u(wt(e, l, b, gn)), d(_);
2635
+ _ || u(Tt(e, l, b, gn)), d(_);
2627
2636
  }
2628
2637
  }
2629
2638
  for (const f of n) {
2630
2639
  const [l, p, y, b] = f;
2631
- if ($a.has(l)) {
2640
+ if (Da.has(l)) {
2632
2641
  const _ = V(o, p, "id");
2633
- d(_), _ || u(wt(e, p, "id", { "unique?": !0 }));
2634
- for (const T of Object.keys(b)) {
2635
- const g = V(o, p, T);
2636
- if (d(g), Ua.has(l) && (g || u(wt(e, p, T, T === "id" ? { "unique?": !0 } : null))), Da.has(l)) {
2637
- const m = Ae(o, p, T);
2638
- !g && !m && u(Mr(e, p, T)), d(m);
2642
+ d(_), _ || u(Tt(e, p, "id", { "unique?": !0 }));
2643
+ for (const w of Object.keys(b)) {
2644
+ const g = V(o, p, w);
2645
+ if (d(g), La.has(l) && (g || u(Tt(e, p, w, w === "id" ? { "unique?": !0 } : null))), Ua.has(l)) {
2646
+ const m = Ae(o, p, w);
2647
+ !g && !m && u(Mr(e, p, w)), d(m);
2639
2648
  }
2640
2649
  }
2641
2650
  }
2642
2651
  }
2643
2652
  return [o, a];
2644
2653
  }
2645
- function qa(t, e) {
2646
- const r = (Array.isArray(e) ? e : [e]).flatMap((u) => _a(u)), [i, s] = Ka(t, r), o = Object.assign(Object.assign({}, t), { attrs: i }), a = r.flatMap((u) => Pa(o, u));
2654
+ function Wa(t, e) {
2655
+ const r = (Array.isArray(e) ? e : [e]).flatMap((u) => ga(u)), [i, s] = qa(t, r), o = Object.assign(Object.assign({}, t), { attrs: i }), a = r.flatMap((u) => Ia(o, u));
2647
2656
  return [...s, ...a];
2648
2657
  }
2649
2658
  var de = function(t, e, n, r) {
@@ -2677,11 +2686,11 @@ function Rr(t, e) {
2677
2686
  typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
2678
2687
  }
2679
2688
  const it = "__meta";
2680
- class Wa {
2689
+ class za {
2681
2690
  constructor(e, n) {
2682
2691
  }
2683
2692
  }
2684
- class wn {
2693
+ class Tn {
2685
2694
  constructor(e) {
2686
2695
  var n, r;
2687
2696
  this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
@@ -2952,13 +2961,13 @@ var pe = function(t, e, n, r) {
2952
2961
  d((r = r.apply(t, e || [])).next());
2953
2962
  });
2954
2963
  };
2955
- const za = 6, Va = ["kv", "querySubs", "syncSubs"];
2956
- function Ba(t) {
2964
+ const Va = 6, Ba = ["kv", "querySubs", "syncSubs"];
2965
+ function Ga(t) {
2957
2966
  return function(n) {
2958
2967
  console.error("Error in IndexedDB event", { source: t, event: n });
2959
2968
  };
2960
2969
  }
2961
- function Ga(t) {
2970
+ function Qa(t) {
2962
2971
  return pe(this, void 0, void 0, function* () {
2963
2972
  return new Promise((e) => {
2964
2973
  const n = indexedDB.open(t);
@@ -2974,7 +2983,7 @@ function Ga(t) {
2974
2983
  });
2975
2984
  });
2976
2985
  }
2977
- function Qa(t, e, n) {
2986
+ function Ha(t, e, n) {
2978
2987
  return pe(this, void 0, void 0, function* () {
2979
2988
  const r = (
2980
2989
  // Backwards compatibility for older versions where we JSON.stringified before storing
@@ -2996,8 +3005,8 @@ function Qa(t, e, n) {
2996
3005
  };
2997
3006
  f[y] = g;
2998
3007
  }
2999
- const T = n.put(_, y);
3000
- i.add(T);
3008
+ const w = n.put(_, y);
3009
+ i.add(w);
3001
3010
  }
3002
3011
  const l = { objects: f }, p = n.put(l, it);
3003
3012
  i.add(p);
@@ -3018,9 +3027,9 @@ function xr(t, e, n) {
3018
3027
  });
3019
3028
  });
3020
3029
  }
3021
- function Ha(t, e) {
3030
+ function Ya(t, e) {
3022
3031
  return pe(this, void 0, void 0, function* () {
3023
- const n = yield Ga(`instant_${t}_5`);
3032
+ const n = yield Qa(`instant_${t}_5`);
3024
3033
  if (!n)
3025
3034
  return;
3026
3035
  const r = yield new Promise((c, f) => {
@@ -3032,8 +3041,8 @@ function Ha(t, e) {
3032
3041
  y.onsuccess = () => {
3033
3042
  const _ = y.result;
3034
3043
  if (_) {
3035
- const T = _.key, g = _.value;
3036
- b.push([T, g]), _.continue();
3044
+ const w = _.key, g = _.value;
3045
+ b.push([w, g]), _.continue();
3037
3046
  } else
3038
3047
  c(b);
3039
3048
  }, y.onerror = (_) => {
@@ -3043,7 +3052,7 @@ function Ha(t, e) {
3043
3052
  for (const [c, f] of r)
3044
3053
  switch (c) {
3045
3054
  case "querySubs": {
3046
- const l = Qa(c, f, o);
3055
+ const l = Ha(c, f, o);
3047
3056
  a.push(l);
3048
3057
  break;
3049
3058
  }
@@ -3066,9 +3075,9 @@ function Ha(t, e) {
3066
3075
  });
3067
3076
  }
3068
3077
  const $r = /* @__PURE__ */ new Map();
3069
- class Ki extends Wa {
3078
+ class Ki extends za {
3070
3079
  constructor(e, n) {
3071
- super(e, n), this.dbName = `instant_${e}_${za}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
3080
+ super(e, n), this.dbName = `instant_${e}_${Va}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
3072
3081
  }
3073
3082
  _init() {
3074
3083
  return new Promise((e, n) => {
@@ -3079,8 +3088,8 @@ class Ki extends Wa {
3079
3088
  }, i.onsuccess = (s) => {
3080
3089
  const a = s.target.result;
3081
3090
  if (r) {
3082
- const u = Ha(this._appId, a).catch((d) => {
3083
- Ba("Error upgrading store from version 5 to 6.")(d);
3091
+ const u = Ya(this._appId, a).catch((d) => {
3092
+ Ga("Error upgrading store from version 5 to 6.")(d);
3084
3093
  });
3085
3094
  $r.set(this.dbName, u), u.then(() => e(a)).catch(() => e(a));
3086
3095
  } else {
@@ -3094,7 +3103,7 @@ class Ki extends Wa {
3094
3103
  }
3095
3104
  _upgradeStore(e) {
3096
3105
  const r = e.target.result;
3097
- for (const i of Va)
3106
+ for (const i of Ba)
3098
3107
  r.objectStoreNames.contains(i) || r.createObjectStore(i);
3099
3108
  }
3100
3109
  getItem(e) {
@@ -3169,7 +3178,7 @@ class Ki extends Wa {
3169
3178
  });
3170
3179
  }
3171
3180
  }
3172
- var Ya = function(t, e, n, r) {
3181
+ var Ja = function(t, e, n, r) {
3173
3182
  function i(s) {
3174
3183
  return s instanceof n ? s : new n(function(o) {
3175
3184
  o(s);
@@ -3198,7 +3207,7 @@ var Ya = function(t, e, n, r) {
3198
3207
  };
3199
3208
  class qi {
3200
3209
  static getIsOnline() {
3201
- return Ya(this, void 0, void 0, function* () {
3210
+ return Ja(this, void 0, void 0, function* () {
3202
3211
  return navigator.onLine;
3203
3212
  });
3204
3213
  }
@@ -3223,7 +3232,7 @@ class Ke extends Error {
3223
3232
  return "InstantError";
3224
3233
  }
3225
3234
  }
3226
- var Ja = function(t, e, n, r) {
3235
+ var Za = function(t, e, n, r) {
3227
3236
  function i(s) {
3228
3237
  return s instanceof n ? s : new n(function(o) {
3229
3238
  o(s);
@@ -3263,7 +3272,7 @@ class Dt extends Ke {
3263
3272
  }
3264
3273
  }
3265
3274
  function ue(t, e) {
3266
- return Ja(this, void 0, void 0, function* () {
3275
+ return Za(this, void 0, void 0, function* () {
3267
3276
  const n = yield fetch(t, e), r = yield n.json();
3268
3277
  return n.status === 200 ? Promise.resolve(r) : Promise.reject(new Dt({ status: n.status, body: r }));
3269
3278
  });
@@ -3295,14 +3304,14 @@ var ze = function(t, e, n, r) {
3295
3304
  d((r = r.apply(t, e || [])).next());
3296
3305
  });
3297
3306
  };
3298
- function Za({ apiURI: t, appId: e, email: n }) {
3307
+ function Xa({ apiURI: t, appId: e, email: n }) {
3299
3308
  return ue(`${t}/runtime/auth/send_magic_code`, {
3300
3309
  method: "POST",
3301
3310
  headers: { "content-type": "application/json" },
3302
3311
  body: JSON.stringify({ "app-id": e, email: n })
3303
3312
  });
3304
3313
  }
3305
- function Xa(t) {
3314
+ function eu(t) {
3306
3315
  return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
3307
3316
  return yield ue(`${e}/runtime/auth/verify_magic_code`, {
3308
3317
  method: "POST",
@@ -3315,7 +3324,7 @@ function Xa(t) {
3315
3324
  });
3316
3325
  });
3317
3326
  }
3318
- function eu(t) {
3327
+ function tu(t) {
3319
3328
  return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3320
3329
  return yield ue(`${e}/runtime/auth/verify_refresh_token`, {
3321
3330
  method: "POST",
@@ -3327,7 +3336,7 @@ function eu(t) {
3327
3336
  });
3328
3337
  });
3329
3338
  }
3330
- function tu(t) {
3339
+ function nu(t) {
3331
3340
  return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
3332
3341
  return yield ue(`${e}/runtime/auth/sign_in_guest`, {
3333
3342
  method: "POST",
@@ -3352,7 +3361,7 @@ function Dr(t) {
3352
3361
  });
3353
3362
  });
3354
3363
  }
3355
- function nu(t) {
3364
+ function ru(t) {
3356
3365
  return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
3357
3366
  return yield ue(`${e}/runtime/oauth/id_token`, {
3358
3367
  method: "POST",
@@ -3367,7 +3376,7 @@ function nu(t) {
3367
3376
  });
3368
3377
  });
3369
3378
  }
3370
- function ru(t) {
3379
+ function iu(t) {
3371
3380
  return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3372
3381
  return yield ue(`${e}/runtime/signout`, {
3373
3382
  method: "POST",
@@ -3408,7 +3417,7 @@ var ft = function(t, e, n, r) {
3408
3417
  d((r = r.apply(t, e || [])).next());
3409
3418
  });
3410
3419
  };
3411
- function iu(t) {
3420
+ function su(t) {
3412
3421
  return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: a }) {
3413
3422
  const u = {
3414
3423
  app_id: n,
@@ -3423,7 +3432,7 @@ function iu(t) {
3423
3432
  });
3424
3433
  });
3425
3434
  }
3426
- function su(t) {
3435
+ function ou(t) {
3427
3436
  return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
3428
3437
  const { data: s } = yield ue(`${e}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
3429
3438
  method: "DELETE",
@@ -3435,7 +3444,7 @@ function su(t) {
3435
3444
  return s;
3436
3445
  });
3437
3446
  }
3438
- function ou(t) {
3447
+ function au(t) {
3439
3448
  return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
3440
3449
  const { data: o } = yield ue(`${e}/storage/signed-upload-url`, {
3441
3450
  method: "POST",
@@ -3451,7 +3460,7 @@ function ou(t) {
3451
3460
  return o;
3452
3461
  });
3453
3462
  }
3454
- function au(t, e) {
3463
+ function uu(t, e) {
3455
3464
  return ft(this, void 0, void 0, function* () {
3456
3465
  return (yield fetch(t, {
3457
3466
  method: "PUT",
@@ -3462,7 +3471,7 @@ function au(t, e) {
3462
3471
  })).ok;
3463
3472
  });
3464
3473
  }
3465
- function uu(t) {
3474
+ function cu(t) {
3466
3475
  return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
3467
3476
  const { data: s } = yield ue(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
3468
3477
  method: "GET",
@@ -3484,7 +3493,7 @@ function Ur(t, e) {
3484
3493
  n[r] = t[r];
3485
3494
  }), n;
3486
3495
  }
3487
- function cu(t, e, n) {
3496
+ function du(t, e, n) {
3488
3497
  var r, i;
3489
3498
  const s = {
3490
3499
  peers: {}
@@ -3502,7 +3511,7 @@ function cu(t, e, n) {
3502
3511
  }
3503
3512
  return s;
3504
3513
  }
3505
- function du(t, e) {
3514
+ function fu(t, e) {
3506
3515
  if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !vr(t.user, e.user)) || !gi(t.peers, e.peers))
3507
3516
  return !0;
3508
3517
  for (const r of Object.keys(t.peers))
@@ -3550,8 +3559,8 @@ function Nr(t) {
3550
3559
  }, e;
3551
3560
  }, {});
3552
3561
  }
3553
- const Bn = "v0.22.76-experimental.drewh-explorer-component.19938835959.1";
3554
- function fu(t, e) {
3562
+ const Bn = "v0.22.76-experimental.fix-date.19939483252.1";
3563
+ function lu(t, e) {
3555
3564
  return {
3556
3565
  info: t ? (...n) => console.info(...n, e()) : () => {
3557
3566
  },
@@ -3635,7 +3644,7 @@ const Kr = [
3635
3644
  "before",
3636
3645
  "fields",
3637
3646
  "aggregate"
3638
- ], lu = (t) => t.valueType || "unknown", Bi = (t, e, n = !1) => {
3647
+ ], hu = (t) => t.valueType || "unknown", Bi = (t, e, n = !1) => {
3639
3648
  if (n || t == null)
3640
3649
  return !0;
3641
3650
  switch (e) {
@@ -3650,7 +3659,7 @@ const Kr = [
3650
3659
  default:
3651
3660
  return !0;
3652
3661
  }
3653
- }, hu = (t, e, n, r, i, s, o) => {
3662
+ }, pu = (t, e, n, r, i, s, o) => {
3654
3663
  const a = s.valueType === "json", u = (d, c, f) => {
3655
3664
  if (!Bi(f, c, a))
3656
3665
  throw new R(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
@@ -3683,16 +3692,16 @@ const Kr = [
3683
3692
  throw new R(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
3684
3693
  }
3685
3694
  }, Ue = (t, e, n, r, i) => {
3686
- const s = lu(n), o = n.valueType === "json";
3695
+ const s = hu(n), o = n.valueType === "json";
3687
3696
  if (typeof t == "object" && t !== null && !Array.isArray(t)) {
3688
3697
  if (o)
3689
3698
  return;
3690
3699
  const u = t;
3691
3700
  for (const [d, c] of Object.entries(u))
3692
- hu(d, c, s, e, r, n, `${i}.${d}`);
3701
+ pu(d, c, s, e, r, n, `${i}.${d}`);
3693
3702
  } else if (!Bi(t, s, o))
3694
3703
  throw new R(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
3695
- }, pu = (t, e, n, r, i) => {
3704
+ }, yu = (t, e, n, r, i) => {
3696
3705
  const s = t.split(".");
3697
3706
  if (s.length < 2)
3698
3707
  throw new R(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
@@ -3742,7 +3751,7 @@ const Kr = [
3742
3751
  continue;
3743
3752
  }
3744
3753
  if (i.includes(".")) {
3745
- pu(i, s, e, n, `${r}.${i}`);
3754
+ yu(i, s, e, n, `${r}.${i}`);
3746
3755
  continue;
3747
3756
  }
3748
3757
  const o = n.entities[e];
@@ -3762,7 +3771,7 @@ const Kr = [
3762
3771
  Ue(s, i, d, e, `${r}.${i}`);
3763
3772
  }
3764
3773
  }
3765
- }, yu = (t, e, n, r, i = 0) => {
3774
+ }, bu = (t, e, n, r, i = 0) => {
3766
3775
  for (const o of Object.keys(t))
3767
3776
  if (!Kr.includes(o))
3768
3777
  throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Kr.join(", ")}. Found: ${o}`, r);
@@ -3801,7 +3810,7 @@ const Kr = [
3801
3810
  const a = t[o];
3802
3811
  if (typeof a != "object" || a === null)
3803
3812
  throw new R(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
3804
- yu(a, e, n, `${r}.$`, i);
3813
+ bu(a, e, n, `${r}.$`, i);
3805
3814
  }
3806
3815
  }, qr = (t, e) => {
3807
3816
  if (typeof t != "object" || t === null)
@@ -3828,19 +3837,19 @@ class ie extends Error {
3828
3837
  super(e), this.name = "TransactionValidationError";
3829
3838
  }
3830
3839
  }
3831
- const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`Entity '${t}' does not exist in schema. Available entities: ${Hi(e)}`), zr = {
3840
+ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", _u = (t, e) => new ie(`Entity '${t}' does not exist in schema. Available entities: ${Hi(e)}`), zr = {
3832
3841
  string: (t) => typeof t == "string",
3833
3842
  number: (t) => typeof t == "number" && !isNaN(t),
3834
3843
  boolean: (t) => typeof t == "boolean",
3835
3844
  date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
3836
3845
  json: () => !0
3837
- }, _u = (t, e) => {
3846
+ }, gu = (t, e) => {
3838
3847
  var n, r;
3839
3848
  return t == null ? !0 : (r = (n = zr[e.valueType]) === null || n === void 0 ? void 0 : n.call(zr, t)) !== null && r !== void 0 ? r : !1;
3840
3849
  }, Yi = (t, e) => {
3841
3850
  const n = e.entities[t];
3842
3851
  if (!n)
3843
- throw bu(t, Object.keys(e.entities));
3852
+ throw _u(t, Object.keys(e.entities));
3844
3853
  return n;
3845
3854
  }, Jt = (t, e, n) => {
3846
3855
  const r = Yi(t, n);
@@ -3850,7 +3859,7 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3850
3859
  if (i === "id")
3851
3860
  continue;
3852
3861
  const o = r.attrs[i];
3853
- if (o && !_u(s, o))
3862
+ if (o && !gu(s, o))
3854
3863
  throw new ie(`Invalid value for attribute '${i}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof s}`);
3855
3864
  }
3856
3865
  }, Vr = (t, e, n) => {
@@ -3871,7 +3880,7 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3871
3880
  throw new ie(`Invalid UUID in link '${i}' for entity '${t}'. Expected a UUID, but received: ${s}`);
3872
3881
  }
3873
3882
  }
3874
- }, gu = {
3883
+ }, Tu = {
3875
3884
  create: Jt,
3876
3885
  update: Jt,
3877
3886
  merge: Jt,
@@ -3887,9 +3896,9 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3887
3896
  throw new ie(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
3888
3897
  if (typeof r != "string")
3889
3898
  throw new ie(`Entity name must be a string, but received: ${typeof r}`);
3890
- const o = gu[n];
3899
+ const o = Tu[n];
3891
3900
  o && s !== void 0 && o(r, s, e);
3892
- }, Tu = (t, e) => {
3901
+ }, mu = (t, e) => {
3893
3902
  const n = Array.isArray(t) ? t : [t];
3894
3903
  for (const r of n) {
3895
3904
  if (!r || typeof r != "object")
@@ -3961,7 +3970,7 @@ class Gr {
3961
3970
  return this.conn.send(JSON.stringify(e));
3962
3971
  }
3963
3972
  }
3964
- class mu {
3973
+ class vu {
3965
3974
  constructor(e, n) {
3966
3975
  this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${Ji++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
3967
3976
  this.initParams || this.handleError();
@@ -4074,14 +4083,14 @@ var Qr = function(t, e, n, r) {
4074
4083
  d((r = r.apply(t, e || [])).next());
4075
4084
  });
4076
4085
  };
4077
- function vu(t, e) {
4086
+ function Su(t, e) {
4078
4087
  const n = t.values;
4079
4088
  if (n)
4080
4089
  for (const r of n.entities || [])
4081
4090
  r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store = Oi(r.store);
4082
4091
  return t;
4083
4092
  }
4084
- function Su(t, e) {
4093
+ function Ou(t, e) {
4085
4094
  var n, r;
4086
4095
  if (!((n = e.values) === null || n === void 0) && n.entities) {
4087
4096
  const i = [];
@@ -4093,7 +4102,7 @@ function Su(t, e) {
4093
4102
  } else
4094
4103
  return e;
4095
4104
  }
4096
- function Ou(t, e, n) {
4105
+ function Eu(t, e, n) {
4097
4106
  var r, i;
4098
4107
  const s = (r = e == null ? void 0 : e.state) === null || r === void 0 ? void 0 : r.txId, o = (i = n == null ? void 0 : n.state) === null || i === void 0 ? void 0 : i.txId;
4099
4108
  return s && (!o || s > o) ? e : o && (!s || o > s) ? n : e || n;
@@ -4103,7 +4112,7 @@ function Zt(t, e) {
4103
4112
  }
4104
4113
  function Hr(t, e, n) {
4105
4114
  var r;
4106
- const i = (r = we(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
4115
+ const i = (r = Te(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
4107
4116
  if (!i)
4108
4117
  return -1;
4109
4118
  const s = We(e.eav, [n, i, n]);
@@ -4120,7 +4129,7 @@ function Yr(t, e) {
4120
4129
  break;
4121
4130
  }
4122
4131
  }
4123
- function Eu(t, e) {
4132
+ function Au(t, e) {
4124
4133
  var n, r, i, s;
4125
4134
  const o = {};
4126
4135
  for (const { action: a, triple: u } of e) {
@@ -4145,17 +4154,17 @@ function Eu(t, e) {
4145
4154
  }
4146
4155
  return o;
4147
4156
  }
4148
- function Tt(t, e) {
4157
+ function wt(t, e) {
4149
4158
  return { [t.table]: e.map((n) => n.entity) };
4150
4159
  }
4151
- function Au(t, e) {
4160
+ function ku(t, e) {
4152
4161
  var n;
4153
4162
  if (t.orderFieldType)
4154
4163
  return t.orderFieldType;
4155
- const r = t.orderField === "serverCreatedAt" ? "number" : (n = we(e([]), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
4164
+ const r = t.orderField === "serverCreatedAt" ? "number" : (n = Te(e([]), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
4156
4165
  return t.orderFieldType = r, r;
4157
4166
  }
4158
- function ku(t, e, n) {
4167
+ function ju(t, e, n) {
4159
4168
  const r = e;
4160
4169
  if (t.orderField === "serverCreatedAt") {
4161
4170
  n.sort(t.orderDirection === "asc" ? function(o, a) {
@@ -4176,13 +4185,13 @@ var ve;
4176
4185
  (function(t) {
4177
4186
  t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
4178
4187
  })(ve || (ve = {}));
4179
- class ju {
4188
+ class Cu {
4180
4189
  constructor(e, n, r, i, s) {
4181
- this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new wn({
4190
+ this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Tn({
4182
4191
  persister: n,
4183
- merge: Ou,
4184
- serialize: Su,
4185
- parse: (o, a) => vu(a, this.config.useDateObjects),
4192
+ merge: Eu,
4193
+ serialize: Ou,
4194
+ parse: (o, a) => Su(a, this.config.useDateObjects),
4186
4195
  objectSize: (o) => {
4187
4196
  var a;
4188
4197
  return ((a = o.values) === null || a === void 0 ? void 0 : a.entities.length) || 0;
@@ -4246,7 +4255,7 @@ class ju {
4246
4255
  if (u && u.state && u.state.txId) {
4247
4256
  this.sendResync(u, u.state, u.state.txId), !((i = u.values) === null || i === void 0) && i.entities && r && r({
4248
4257
  type: ve.LoadFromStorage,
4249
- data: Tt(u, (s = u.values) === null || s === void 0 ? void 0 : s.entities)
4258
+ data: wt(u, (s = u.values) === null || s === void 0 ? void 0 : s.entities)
4250
4259
  });
4251
4260
  return;
4252
4261
  }
@@ -4321,7 +4330,7 @@ class ju {
4321
4330
  c[s] = a, c[s].updatedAt = Date.now();
4322
4331
  }), a.values && this.notifyCbs(s, {
4323
4332
  type: ve.InitialSyncBatch,
4324
- data: Tt(a, a.values.entities),
4333
+ data: wt(a, a.values.entities),
4325
4334
  batch: o
4326
4335
  });
4327
4336
  }
@@ -4346,7 +4355,7 @@ class ju {
4346
4355
  const s = this.subs.currentValue[i];
4347
4356
  s && this.notifyCbs(i, {
4348
4357
  type: ve.InitialSyncComplete,
4349
- data: Tt(s, ((n = s.values) === null || n === void 0 ? void 0 : n.entities) || [])
4358
+ data: wt(s, ((n = s.values) === null || n === void 0 ? void 0 : n.entities) || [])
4350
4359
  });
4351
4360
  }
4352
4361
  onSyncUpdateTriples(e) {
@@ -4384,9 +4393,9 @@ class ju {
4384
4393
  e: for (const [g, m] of Object.entries(f))
4385
4394
  for (let E = 0; E < p.length; E++) {
4386
4395
  const S = p[E];
4387
- if (oo(S.store, g)) {
4396
+ if (ao(S.store, g)) {
4388
4397
  Yr(S.store, m);
4389
- const I = Zt(a, S.store), x = Eu(S.store, m)[g];
4398
+ const I = Zt(a, S.store), x = Au(S.store, m)[g];
4390
4399
  I ? (y.push({
4391
4400
  oldEntity: S.entity,
4392
4401
  newEntity: I,
@@ -4417,10 +4426,10 @@ class ju {
4417
4426
  const _ = [];
4418
4427
  for (const g of c.sort().reverse())
4419
4428
  _.push(p[g].entity), p.splice(g, 1);
4420
- const T = Au(a, this.createStore);
4421
- ku(a, T, p), this.notifyCbs(o, {
4429
+ const w = ku(a, this.createStore);
4430
+ ju(a, w, p), this.notifyCbs(o, {
4422
4431
  type: ve.SyncTransaction,
4423
- data: Tt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
4432
+ data: wt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
4424
4433
  added: b,
4425
4434
  removed: _,
4426
4435
  updated: y
@@ -4485,7 +4494,7 @@ var F = function(t, e, n, r) {
4485
4494
  }
4486
4495
  d((r = r.apply(t, e || [])).next());
4487
4496
  });
4488
- }, Cu = function(t, e) {
4497
+ }, Pu = function(t, e) {
4489
4498
  var n = {};
4490
4499
  for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
4491
4500
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
@@ -4499,23 +4508,23 @@ const le = {
4499
4508
  AUTHENTICATED: "authenticated",
4500
4509
  CLOSED: "closed",
4501
4510
  ERRORED: "errored"
4502
- }, Pu = 3e4, Iu = 3e4, Mu = 200, Ru = {
4511
+ }, Iu = 3e4, Mu = 3e4, Ru = 200, xu = {
4503
4512
  apiURI: "https://api.instantdb.com",
4504
4513
  websocketURI: "wss://api.instantdb.com/runtime/session"
4505
4514
  }, Xt = "_instant_oauth_redirect", Qe = "currentUser";
4506
- function xu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
4515
+ function $u({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
4507
4516
  if (!i)
4508
4517
  return new Gr(`${r}?app_id=${e}`);
4509
4518
  switch (t) {
4510
4519
  case "ws":
4511
4520
  return new Gr(`${r}?app_id=${e}`);
4512
4521
  case "sse":
4513
- return new mu(i, `${n}/runtime/sse?app_id=${e}`);
4522
+ return new vu(i, `${n}/runtime/sse?app_id=${e}`);
4514
4523
  default:
4515
4524
  throw new Error("Unknown transport type " + t);
4516
4525
  }
4517
4526
  }
4518
- function $u() {
4527
+ function Du() {
4519
4528
  return typeof window < "u" || typeof chrome < "u";
4520
4529
  }
4521
4530
  const Jr = {
@@ -4524,7 +4533,7 @@ const Jr = {
4524
4533
  "refresh-presence": !0,
4525
4534
  "patch-presence": !0
4526
4535
  };
4527
- function Du(t, e) {
4536
+ function Uu(t, e) {
4528
4537
  var n;
4529
4538
  const r = typeof t == "string" ? JSON.parse(t) : t;
4530
4539
  if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
@@ -4533,12 +4542,12 @@ function Du(t, e) {
4533
4542
  }
4534
4543
  return r;
4535
4544
  }
4536
- function Uu(t, e) {
4545
+ function Lu(t, e) {
4537
4546
  var n;
4538
4547
  const r = Object.assign({}, e);
4539
4548
  return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: Si(e.result.store) })), r;
4540
4549
  }
4541
- function Lu(t, e) {
4550
+ function Fu(t, e) {
4542
4551
  switch (t) {
4543
4552
  case "pendingMutations":
4544
4553
  return new Map(typeof e == "string" ? JSON.parse(e) : e);
@@ -4546,7 +4555,7 @@ function Lu(t, e) {
4546
4555
  return e;
4547
4556
  }
4548
4557
  }
4549
- function Fu(t, e) {
4558
+ function Nu(t, e) {
4550
4559
  switch (t) {
4551
4560
  case "pendingMutations":
4552
4561
  return [...e.entries()];
@@ -4554,7 +4563,7 @@ function Fu(t, e) {
4554
4563
  return e;
4555
4564
  }
4556
4565
  }
4557
- function Nu(t, e, n) {
4566
+ function Ku(t, e, n) {
4558
4567
  const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
4559
4568
  return r && !i && n && (n.result = r), n || e;
4560
4569
  }
@@ -4564,7 +4573,7 @@ function Zr(t) {
4564
4573
  return a == u ? r < s ? -1 : r > s ? 1 : 0 : a - u;
4565
4574
  });
4566
4575
  }
4567
- class Ku {
4576
+ class qu {
4568
4577
  constructor(e, n = Ki, r = qi, i, s) {
4569
4578
  var o, a, u;
4570
4579
  if (this._isOnline = !0, this._isShutdown = !1, this.status = le.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (d, c, f) => {
@@ -4597,9 +4606,9 @@ class Ku {
4597
4606
  }, this.notifyQueryError = (d, c) => {
4598
4607
  (this.queryCbs[d] || []).forEach((l) => l.cb({ error: c }));
4599
4608
  }, this.pushTx = (d) => {
4600
- this.config.disableValidation || Tu(d, this.config.schema);
4609
+ this.config.disableValidation || mu(d, this.config.schema);
4601
4610
  try {
4602
- const c = qa({
4611
+ const c = Wa({
4603
4612
  attrs: this.optimisticAttrs(),
4604
4613
  schema: this.config.schema,
4605
4614
  stores: Object.values(this.querySubs.currentValue).map((f) => {
@@ -4688,7 +4697,7 @@ class Ku {
4688
4697
  return;
4689
4698
  }
4690
4699
  this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
4691
- }, this._EventSource = s, this.config = Object.assign(Object.assign({}, Ru), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (a = this.config.pendingTxCleanupTimeout) !== null && a !== void 0 ? a : Iu, this._pendingMutationCleanupThreshold = (u = this.config.pendingMutationCleanupThreshold) !== null && u !== void 0 ? u : Mu, this._log = fu(e.verbose || Vn || Wi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Bn }), this.config.schema && (this._linkIndex = Nr(this.config.schema)), !!$u()) {
4700
+ }, this._EventSource = s, this.config = Object.assign(Object.assign({}, xu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (a = this.config.pendingTxCleanupTimeout) !== null && a !== void 0 ? a : Mu, this._pendingMutationCleanupThreshold = (u = this.config.pendingMutationCleanupThreshold) !== null && u !== void 0 ? u : Ru, this._log = lu(e.verbose || Vn || Wi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Bn }), this.config.schema && (this._linkIndex = Nr(this.config.schema)), !!Du()) {
4692
4701
  if (!e.appId)
4693
4702
  throw new Error("Instant must be initialized with an appId.");
4694
4703
  if (!Fe(e.appId))
@@ -4703,7 +4712,7 @@ class Ku {
4703
4712
  } catch (f) {
4704
4713
  this._log.error("[error] handle broadcast channel", f);
4705
4714
  }
4706
- }))), this._initStorage(n), this._syncTable = new ju(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
4715
+ }))), this._initStorage(n), this._syncTable = new Cu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
4707
4716
  useDateObjects: this.config.useDateObjects
4708
4717
  }, this._log, (d) => Et(this.attrs, d, this.config.enableCardinalityInference, this._linkIndex, this.config.useDateObjects)), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
4709
4718
  this._isOnline = d, this._startSocket(), r.listen((c) => {
@@ -4726,11 +4735,11 @@ class Ku {
4726
4735
  this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
4727
4736
  }
4728
4737
  _initStorage(e) {
4729
- this.querySubs = new wn({
4738
+ this.querySubs = new Tn({
4730
4739
  persister: new e(this.config.appId, "querySubs"),
4731
- merge: Nu,
4732
- serialize: Uu,
4733
- parse: (n, r) => Du(r, this.config.useDateObjects),
4740
+ merge: Ku,
4741
+ serialize: Lu,
4742
+ parse: (n, r) => Uu(r, this.config.useDateObjects),
4734
4743
  // objectSize
4735
4744
  objectSize: (n) => {
4736
4745
  var r, i, s, o;
@@ -4746,11 +4755,11 @@ class Ku {
4746
4755
  maxSize: 1e6
4747
4756
  // 1 million triples
4748
4757
  }
4749
- }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new wn({
4758
+ }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Tn({
4750
4759
  persister: new e(this.config.appId, "kv"),
4751
4760
  merge: this._onMergeKv,
4752
- serialize: Fu,
4753
- parse: Lu,
4761
+ serialize: Nu,
4762
+ parse: Fu,
4754
4763
  objectSize: () => 0,
4755
4764
  logger: this._log,
4756
4765
  saveThrottleMs: 100,
@@ -4781,7 +4790,7 @@ class Ku {
4781
4790
  if (s)
4782
4791
  i.resolve({ status: e, eventId: n });
4783
4792
  else if (r != null && r.type) {
4784
- const { status: o } = r, a = Cu(r, ["status"]);
4793
+ const { status: o } = r, a = Pu(r, ["status"]);
4785
4794
  i.reject(new Dt({
4786
4795
  // @ts-expect-error body.type is not constant typed
4787
4796
  body: a,
@@ -4822,7 +4831,7 @@ class Ku {
4822
4831
  const { q: l, result: p } = n, y = z(l);
4823
4832
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
4824
4833
  break;
4825
- const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, T = Fr(p), g = Et(this.attrs, T, d, this._linkIndex, this.config.useDateObjects);
4834
+ const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, w = Fr(p), g = Et(this.attrs, w, d, this._linkIndex, this.config.useDateObjects);
4826
4835
  this.querySubs.updateInPlace((m) => {
4827
4836
  if (!m[y]) {
4828
4837
  this._log.info("Missing value in querySubs", { hash: y, q: l });
@@ -4860,12 +4869,12 @@ class Ku {
4860
4869
  b !== this._pendingMutations() && this.kv.updateInPlace((g) => {
4861
4870
  g.pendingMutations = b;
4862
4871
  });
4863
- const _ = Zr(b.entries()), T = l.map((g) => {
4872
+ const _ = Zr(b.entries()), w = l.map((g) => {
4864
4873
  var m, E, S, I;
4865
4874
  const x = g["instaql-query"], B = g["instaql-result"], Ve = z(x), lt = Fr(B), Ft = Et(this.attrs, lt, d, this._linkIndex, this.config.useDateObjects), Nt = this._applyOptimisticUpdates(Ft, _, y), ht = (E = (m = B == null ? void 0 : B[0]) === null || m === void 0 ? void 0 : m.data) === null || E === void 0 ? void 0 : E["page-info"], ce = (I = (S = B == null ? void 0 : B[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
4866
4875
  return { q: x, hash: Ve, store: Nt, pageInfo: ht, aggregate: ce };
4867
4876
  });
4868
- T.forEach(({ hash: g, q: m, store: E, pageInfo: S, aggregate: I }) => {
4877
+ w.forEach(({ hash: g, q: m, store: E, pageInfo: S, aggregate: I }) => {
4869
4878
  this.querySubs.updateInPlace((x) => {
4870
4879
  if (!x[g]) {
4871
4880
  this._log.error("Missing value in querySubs", { hash: g, q: m });
@@ -4873,7 +4882,7 @@ class Ku {
4873
4882
  }
4874
4883
  x[g].result = { store: E, pageInfo: S, aggregate: I, processedTxId: y };
4875
4884
  });
4876
- }), this._cleanupPendingMutationsQueries(), T.forEach(({ hash: g }) => {
4885
+ }), this._cleanupPendingMutationsQueries(), w.forEach(({ hash: g }) => {
4877
4886
  this.notifyOne(g);
4878
4887
  });
4879
4888
  break;
@@ -4884,10 +4893,10 @@ class Ku {
4884
4893
  const b = this._rewriteMutations(this.attrs, this._pendingMutations()).get(l);
4885
4894
  if (!b)
4886
4895
  break;
4887
- this._updatePendingMutations((T) => {
4888
- T.set(l, Object.assign(Object.assign({}, T.get(l)), { "tx-id": p, confirmed: Date.now() }));
4896
+ this._updatePendingMutations((w) => {
4897
+ w.set(l, Object.assign(Object.assign({}, w.get(l)), { "tx-id": p, confirmed: Date.now() }));
4889
4898
  });
4890
- const _ = b["tx-steps"].filter(([T, ...g]) => T === "add-attr").map(([T, g]) => g).concat(Object.values(this.attrs));
4899
+ const _ = b["tx-steps"].filter(([w, ...g]) => w === "add-attr").map(([w, g]) => g).concat(Object.values(this.attrs));
4891
4900
  this._setAttrs(_), this._finishTransaction("synced", l), this._cleanupPendingMutationsTimeout();
4892
4901
  break;
4893
4902
  }
@@ -5040,7 +5049,7 @@ class Ku {
5040
5049
  if (!this.querySubs)
5041
5050
  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;
5042
5051
  const s = z(e), o = this._startQuerySub(e, s);
5043
- return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), Pu), i.promise;
5052
+ 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")), Iu), i.promise;
5044
5053
  }
5045
5054
  _completeQueryOnce(e, n, r) {
5046
5055
  this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
@@ -5084,15 +5093,15 @@ class Ku {
5084
5093
  for (const p of c) {
5085
5094
  const [y] = p;
5086
5095
  if (y === "add-attr") {
5087
- const [_, T] = p, g = i(T);
5088
- if (g && T.id !== g.id) {
5089
- o.attrIdMap[T.id] = g.id, a = !0;
5096
+ const [_, w] = p, g = i(w);
5097
+ if (g && w.id !== g.id) {
5098
+ o.attrIdMap[w.id] = g.id, a = !0;
5090
5099
  continue;
5091
5100
  }
5092
- if (T["value-type"] === "ref") {
5093
- const m = s(T);
5101
+ if (w["value-type"] === "ref") {
5102
+ const m = s(w);
5094
5103
  if (m) {
5095
- o.attrIdMap[T.id] = m.id, o.refSwapAttrIds.add(T.id), a = !0;
5104
+ o.attrIdMap[w.id] = m.id, o.refSwapAttrIds.add(w.id), a = !0;
5096
5105
  continue;
5097
5106
  }
5098
5107
  }
@@ -5101,7 +5110,7 @@ class Ku {
5101
5110
  a = !0;
5102
5111
  continue;
5103
5112
  }
5104
- const b = a ? ga(o, p) : p;
5113
+ const b = a ? Ta(o, p) : p;
5105
5114
  l.push(b);
5106
5115
  }
5107
5116
  return a ? l : c;
@@ -5258,7 +5267,7 @@ class Ku {
5258
5267
  return;
5259
5268
  }
5260
5269
  const e = this._transport;
5261
- this._transport = xu({
5270
+ this._transport = $u({
5262
5271
  transportType: this._transportType,
5263
5272
  appId: this.config.appId,
5264
5273
  apiURI: this.config.apiURI,
@@ -5461,7 +5470,7 @@ class Ku {
5461
5470
  }), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
5462
5471
  }
5463
5472
  sendMagicCode({ email: e }) {
5464
- return Za({
5473
+ return Xa({
5465
5474
  apiURI: this.config.apiURI,
5466
5475
  appId: this.config.appId,
5467
5476
  email: e
@@ -5470,7 +5479,7 @@ class Ku {
5470
5479
  signInWithMagicCode(e) {
5471
5480
  return F(this, arguments, void 0, function* ({ email: n, code: r }) {
5472
5481
  var i;
5473
- const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield Xa({
5482
+ const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield eu({
5474
5483
  apiURI: this.config.apiURI,
5475
5484
  appId: this.config.appId,
5476
5485
  email: n,
@@ -5482,7 +5491,7 @@ class Ku {
5482
5491
  }
5483
5492
  signInWithCustomToken(e) {
5484
5493
  return F(this, void 0, void 0, function* () {
5485
- const n = yield eu({
5494
+ const n = yield tu({
5486
5495
  apiURI: this.config.apiURI,
5487
5496
  appId: this.config.appId,
5488
5497
  refreshToken: e
@@ -5492,7 +5501,7 @@ class Ku {
5492
5501
  }
5493
5502
  signInAsGuest() {
5494
5503
  return F(this, void 0, void 0, function* () {
5495
- const e = yield tu({
5504
+ const e = yield nu({
5496
5505
  apiURI: this.config.apiURI,
5497
5506
  appId: this.config.appId
5498
5507
  });
@@ -5508,7 +5517,7 @@ class Ku {
5508
5517
  this._log.info("[auth-invalidate] skipped invalidateToken");
5509
5518
  return;
5510
5519
  }
5511
- ru({
5520
+ iu({
5512
5521
  apiURI: this.config.apiURI,
5513
5522
  appId: this.config.appId,
5514
5523
  refreshToken: i
@@ -5566,7 +5575,7 @@ class Ku {
5566
5575
  signInWithIdToken(e) {
5567
5576
  return F(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
5568
5577
  var s;
5569
- const o = yield this.getCurrentUser(), a = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, u = yield nu({
5578
+ const o = yield this.getCurrentUser(), a = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, u = yield ru({
5570
5579
  apiURI: this.config.apiURI,
5571
5580
  appId: this.config.appId,
5572
5581
  idToken: n,
@@ -5607,7 +5616,7 @@ class Ku {
5607
5616
  // TODO: look into typing again
5608
5617
  getPresence(e, n, r = {}) {
5609
5618
  const i = this._rooms[n], s = this._presence[n];
5610
- return !i || !s || !s.result ? null : Object.assign(Object.assign({}, cu(s.result, r, this._sessionId)), { isLoading: !i.isConnected, error: i.error });
5619
+ return !i || !s || !s.result ? null : Object.assign(Object.assign({}, du(s.result, r, this._sessionId)), { isLoading: !i.isConnected, error: i.error });
5611
5620
  }
5612
5621
  // TODO: look into typing again
5613
5622
  publishPresence(e, n, r) {
@@ -5657,7 +5666,7 @@ class Ku {
5657
5666
  }
5658
5667
  _notifyPresenceSub(e, n) {
5659
5668
  const r = this.getPresence("", e, n);
5660
- r && (n.prev && !du(r, n.prev) || (n.prev = r, n.cb(r)));
5669
+ r && (n.prev && !fu(r, n.prev) || (n.prev = r, n.cb(r)));
5661
5670
  }
5662
5671
  _patchPresencePeers(e, n) {
5663
5672
  var r, i, s;
@@ -5674,7 +5683,7 @@ class Ku {
5674
5683
  Sr(d, c, l);
5675
5684
  break;
5676
5685
  case "-":
5677
- Ti(d, c);
5686
+ wi(d, c);
5678
5687
  break;
5679
5688
  }
5680
5689
  delete d[this._sessionId];
@@ -5731,14 +5740,14 @@ class Ku {
5731
5740
  return F(this, void 0, void 0, function* () {
5732
5741
  var i;
5733
5742
  const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
5734
- return iu(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
5743
+ return su(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
5735
5744
  });
5736
5745
  }
5737
5746
  deleteFile(e) {
5738
5747
  return F(this, void 0, void 0, function* () {
5739
5748
  var n;
5740
5749
  const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
5741
- return yield su({
5750
+ return yield ou({
5742
5751
  apiURI: this.config.apiURI,
5743
5752
  appId: this.config.appId,
5744
5753
  path: e,
@@ -5751,20 +5760,20 @@ class Ku {
5751
5760
  upload(e, n) {
5752
5761
  return F(this, void 0, void 0, function* () {
5753
5762
  var r;
5754
- const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name, a = yield ou({
5763
+ const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name, a = yield au({
5755
5764
  apiURI: this.config.apiURI,
5756
5765
  appId: this.config.appId,
5757
5766
  fileName: o,
5758
5767
  refreshToken: s
5759
5768
  });
5760
- return yield au(a, n);
5769
+ return yield uu(a, n);
5761
5770
  });
5762
5771
  }
5763
5772
  getDownloadUrl(e) {
5764
5773
  return F(this, void 0, void 0, function* () {
5765
5774
  var n;
5766
5775
  const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
5767
- return yield uu({
5776
+ return yield cu({
5768
5777
  apiURI: this.config.apiURI,
5769
5778
  appId: this.config.appId,
5770
5779
  path: e,
@@ -5773,7 +5782,7 @@ class Ku {
5773
5782
  });
5774
5783
  }
5775
5784
  }
5776
- function qu(t, e) {
5785
+ function Wu(t, e) {
5777
5786
  return new Lt(
5778
5787
  Zi(t, e),
5779
5788
  // (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
@@ -5785,25 +5794,25 @@ function qu(t, e) {
5785
5794
  void 0
5786
5795
  );
5787
5796
  }
5788
- function Wu(t) {
5797
+ function zu(t) {
5789
5798
  return new Ut(t, {});
5790
5799
  }
5791
- function zu() {
5800
+ function Vu() {
5792
5801
  return new H("string", !0, !1);
5793
5802
  }
5794
- function Vu() {
5803
+ function Bu() {
5795
5804
  return new H("number", !0, !1);
5796
5805
  }
5797
- function Bu() {
5806
+ function Gu() {
5798
5807
  return new H("boolean", !0, !1);
5799
5808
  }
5800
- function Gu() {
5809
+ function Qu() {
5801
5810
  return new H("date", !0, !1);
5802
5811
  }
5803
- function Qu() {
5812
+ function Hu() {
5804
5813
  return new H("json", !0, !1);
5805
5814
  }
5806
- function Hu() {
5815
+ function Yu() {
5807
5816
  return new H("json", !0, !1);
5808
5817
  }
5809
5818
  function Zi(t, e) {
@@ -5822,7 +5831,7 @@ function Zi(t, e) {
5822
5831
  new Ut(d.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
5823
5832
  ]));
5824
5833
  }
5825
- function Yu({ entities: t, links: e, rooms: n }) {
5834
+ function Ju({ entities: t, links: e, rooms: n }) {
5826
5835
  const r = e ?? {}, i = n ?? {};
5827
5836
  return new Lt(
5828
5837
  Zi(t, r),
@@ -5835,23 +5844,23 @@ function Yu({ entities: t, links: e, rooms: n }) {
5835
5844
  i
5836
5845
  );
5837
5846
  }
5838
- const Kc = {
5847
+ const qc = {
5839
5848
  // constructs
5840
- graph: qu,
5841
- schema: Yu,
5842
- entity: Wu,
5849
+ graph: Wu,
5850
+ schema: Ju,
5851
+ entity: zu,
5843
5852
  // value types
5844
- string: zu,
5845
- number: Vu,
5846
- boolean: Bu,
5847
- date: Gu,
5848
- json: Qu,
5849
- any: Hu
5853
+ string: Vu,
5854
+ number: Bu,
5855
+ boolean: Gu,
5856
+ date: Qu,
5857
+ json: Hu,
5858
+ any: Yu
5850
5859
  };
5851
5860
  let mt;
5852
- function Ju(t, e) {
5861
+ function Zu(t, e) {
5853
5862
  mt == null || mt.dispose();
5854
- const n = rc(e), r = ec(e, a), i = Xu(Zu(t));
5863
+ const n = ic(e), r = tc(e, a), i = ec(Xu(t));
5855
5864
  function s(c) {
5856
5865
  var f;
5857
5866
  c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && a();
@@ -5873,10 +5882,10 @@ function Ju(t, e) {
5873
5882
  }
5874
5883
  return d();
5875
5884
  }
5876
- function Zu(t) {
5885
+ function Xu(t) {
5877
5886
  return `${Vn || zi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
5878
5887
  }
5879
- function Xu(t) {
5888
+ function ec(t) {
5880
5889
  const e = document.createElement("iframe");
5881
5890
  return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
5882
5891
  width: "100%",
@@ -5885,7 +5894,7 @@ function Xu(t) {
5885
5894
  border: "none"
5886
5895
  }), { element: e };
5887
5896
  }
5888
- function ec(t, e) {
5897
+ function tc(t, e) {
5889
5898
  const n = `
5890
5899
  <svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
5891
5900
  <rect width="512" height="512" fill="black"/>
@@ -5895,7 +5904,7 @@ function ec(t, e) {
5895
5904
  return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
5896
5905
  // pos
5897
5906
  position: "fixed"
5898
- }, tc(t.position)), {
5907
+ }, nc(t.position)), {
5899
5908
  height: "32px",
5900
5909
  width: "32px",
5901
5910
  // layout
@@ -5910,7 +5919,7 @@ function ec(t, e) {
5910
5919
  cursor: "pointer"
5911
5920
  })), r.addEventListener("click", e), { element: r };
5912
5921
  }
5913
- function tc(t) {
5922
+ function nc(t) {
5914
5923
  switch (t) {
5915
5924
  case "bottom-left":
5916
5925
  return { bottom: "24px", left: "24px" };
@@ -5922,7 +5931,7 @@ function tc(t) {
5922
5931
  return { top: "24px", left: "24px" };
5923
5932
  }
5924
5933
  }
5925
- function nc(t) {
5934
+ function rc(t) {
5926
5935
  switch (t) {
5927
5936
  case "bottom-left":
5928
5937
  return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
@@ -5934,47 +5943,47 @@ function nc(t) {
5934
5943
  return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
5935
5944
  }
5936
5945
  }
5937
- function rc(t) {
5946
+ function ic(t) {
5938
5947
  const e = document.createElement("div");
5939
- Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, nc(t.position)), { display: "block", borderRadius: "4px", border: "1px #ccc solid", boxShadow: "0px 0px 8px #00000044", backgroundColor: "#eee", zIndex: "999990" })), e.style.display = "none", e.className = "instant-devtool-container";
5948
+ Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, rc(t.position)), { display: "block", borderRadius: "4px", border: "1px #ccc solid", boxShadow: "0px 0px 8px #00000044", backgroundColor: "#eee", zIndex: "999990" })), e.style.display = "none", e.className = "instant-devtool-container";
5940
5949
  function n() {
5941
5950
  return e.style.display !== "none";
5942
5951
  }
5943
5952
  return { element: e, isVisible: n };
5944
5953
  }
5945
- const ic = {
5954
+ const sc = {
5946
5955
  apiURI: "https://api.instantdb.com",
5947
5956
  websocketURI: "wss://api.instantdb.com/runtime/session"
5948
5957
  };
5949
- function sc() {
5958
+ function oc() {
5950
5959
  var t;
5951
5960
  return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
5952
5961
  }
5953
- function oc() {
5962
+ function ac() {
5954
5963
  var t;
5955
5964
  return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
5956
5965
  }
5957
- function Tn(t) {
5966
+ function wn(t) {
5958
5967
  const e = t.__adminToken;
5959
5968
  return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
5960
5969
  }
5961
- const mn = oc(), Xr = sc();
5962
- class ac {
5970
+ const mn = ac(), Xr = oc();
5971
+ class uc {
5963
5972
  constructor(e) {
5964
5973
  this.db = e, this.sendMagicCode = (n) => this.db.sendMagicCode(n), this.signInWithMagicCode = (n) => this.db.signInWithMagicCode(n), this.signInWithToken = (n) => this.db.signInWithCustomToken(n), this.signInAsGuest = () => this.db.signInAsGuest(), this.createAuthorizationURL = (n) => this.db.createAuthorizationURL(n), this.signInWithIdToken = (n) => this.db.signInWithIdToken(n), this.exchangeOAuthCode = (n) => this.db.exchangeCodeForToken(n), this.issuerURI = () => this.db.issuerURI(), this.signOut = (n = { invalidateToken: !0 }) => this.db.signOut(n);
5965
5974
  }
5966
5975
  }
5967
- class uc {
5976
+ class cc {
5968
5977
  constructor(e) {
5969
5978
  this.db = e, this.uploadFile = (n, r, i = {}) => this.db.uploadFile(n, r, i), this.delete = (n) => this.db.deleteFile(n), this.upload = (n, r) => this.db.upload(n, r), this.put = this.upload, this.getDownloadUrl = (n) => this.db.getDownloadUrl(n);
5970
5979
  }
5971
5980
  }
5972
- function cc(t) {
5981
+ function dc(t) {
5973
5982
  return JSON.parse(JSON.stringify(t));
5974
5983
  }
5975
- class dc {
5984
+ class fc {
5976
5985
  constructor(e) {
5977
- this.tx = zn(), this._reactor = e, this.auth = new ac(this._reactor), this.storage = new uc(this._reactor);
5986
+ this.tx = zn(), this._reactor = e, this.auth = new uc(this._reactor), this.storage = new cc(this._reactor);
5978
5987
  }
5979
5988
  /**
5980
5989
  * Use this to write data! You can create, update, delete, and link objects
@@ -6115,7 +6124,7 @@ class dc {
6115
6124
  };
6116
6125
  }
6117
6126
  shutdown() {
6118
- delete mn[Tn(this._reactor.config)], this._reactor.shutdown();
6127
+ delete mn[wn(this._reactor.config)], this._reactor.shutdown();
6119
6128
  }
6120
6129
  /**
6121
6130
  * Use this for one-off queries.
@@ -6157,22 +6166,22 @@ function ei(t) {
6157
6166
  const n = z(t);
6158
6167
  return Xr.set(t, n), n;
6159
6168
  }
6160
- function fc(t, e) {
6169
+ function lc(t, e) {
6161
6170
  return ei(t._reactor.config.schema) !== ei(e);
6162
6171
  }
6163
- function lc(t, e, n, r, i) {
6172
+ function hc(t, e, n, r, i) {
6164
6173
  var s;
6165
- const o = Object.assign(Object.assign({}, t), { useDateObjects: (s = t.useDateObjects) !== null && s !== void 0 ? s : !1 }), a = mn[Tn(o)];
6174
+ const o = Object.assign(Object.assign({}, t), { useDateObjects: (s = t.useDateObjects) !== null && s !== void 0 ? s : !1 }), a = mn[wn(o)];
6166
6175
  if (a)
6167
- return fc(a, o.schema) && a._reactor.updateSchema(o.schema), a;
6168
- const u = new Ku(Object.assign(Object.assign(Object.assign({}, ic), o), { cardinalityInference: !!o.schema }), e || Ki, n || qi, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Bn }), i), d = new dc(u);
6169
- return mn[Tn(o)] = d, hc(o.appId, o.devtool), d;
6176
+ return lc(a, o.schema) && a._reactor.updateSchema(o.schema), a;
6177
+ const u = new qu(Object.assign(Object.assign(Object.assign({}, sc), o), { cardinalityInference: !!o.schema }), e || Ki, n || qi, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Bn }), i), d = new fc(u);
6178
+ return mn[wn(o)] = d, pc(o.appId, o.devtool), d;
6170
6179
  }
6171
- function hc(t, e) {
6180
+ function pc(t, e) {
6172
6181
  if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
6173
6182
  return;
6174
6183
  const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
6175
- n.allowedHosts.includes(window.location.hostname) && Ju(t, n);
6184
+ n.allowedHosts.includes(window.location.hostname) && Zu(t, n);
6176
6185
  }
6177
6186
  var vn = { exports: {} }, He = {};
6178
6187
  /**
@@ -6185,7 +6194,7 @@ var vn = { exports: {} }, He = {};
6185
6194
  * LICENSE file in the root directory of this source tree.
6186
6195
  */
6187
6196
  var ti;
6188
- function pc() {
6197
+ function yc() {
6189
6198
  if (ti) return He;
6190
6199
  ti = 1;
6191
6200
  var t = ci, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
@@ -6199,7 +6208,7 @@ function pc() {
6199
6208
  return He.Fragment = n, He.jsx = o, He.jsxs = o, He;
6200
6209
  }
6201
6210
  var Ye = {}, ni;
6202
- function yc() {
6211
+ function bc() {
6203
6212
  if (ni) return Ye;
6204
6213
  ni = 1;
6205
6214
  var t = {};
@@ -6214,28 +6223,28 @@ function yc() {
6214
6223
  */
6215
6224
  return t.NODE_ENV !== "production" && function() {
6216
6225
  var e = ci, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, _ = "@@iterator";
6217
- function T(h) {
6226
+ function w(h) {
6218
6227
  if (h === null || typeof h != "object")
6219
6228
  return null;
6220
- var w = b && h[b] || h[_];
6221
- return typeof w == "function" ? w : null;
6229
+ var T = b && h[b] || h[_];
6230
+ return typeof T == "function" ? T : null;
6222
6231
  }
6223
6232
  var g = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
6224
6233
  function m(h) {
6225
6234
  {
6226
- for (var w = arguments.length, v = new Array(w > 1 ? w - 1 : 0), O = 1; O < w; O++)
6235
+ for (var T = arguments.length, v = new Array(T > 1 ? T - 1 : 0), O = 1; O < T; O++)
6227
6236
  v[O - 1] = arguments[O];
6228
6237
  E("error", h, v);
6229
6238
  }
6230
6239
  }
6231
- function E(h, w, v) {
6240
+ function E(h, T, v) {
6232
6241
  {
6233
6242
  var O = g.ReactDebugCurrentFrame, P = O.getStackAddendum();
6234
- P !== "" && (w += "%s", v = v.concat([P]));
6243
+ P !== "" && (T += "%s", v = v.concat([P]));
6235
6244
  var M = v.map(function(C) {
6236
6245
  return String(C);
6237
6246
  });
6238
- M.unshift("Warning: " + w), Function.prototype.apply.call(console[h], console, M);
6247
+ M.unshift("Warning: " + T), Function.prototype.apply.call(console[h], console, M);
6239
6248
  }
6240
6249
  }
6241
6250
  var S = !1, I = !1, x = !1, B = !1, Ve = !1, lt;
@@ -6247,11 +6256,11 @@ function yc() {
6247
6256
  // with.
6248
6257
  h.$$typeof === lt || h.getModuleId !== void 0));
6249
6258
  }
6250
- function Nt(h, w, v) {
6259
+ function Nt(h, T, v) {
6251
6260
  var O = h.displayName;
6252
6261
  if (O)
6253
6262
  return O;
6254
- var P = w.displayName || w.name || "";
6263
+ var P = T.displayName || T.name || "";
6255
6264
  return P !== "" ? v + "(" + P + ")" : v;
6256
6265
  }
6257
6266
  function ht(h) {
@@ -6281,8 +6290,8 @@ function yc() {
6281
6290
  if (typeof h == "object")
6282
6291
  switch (h.$$typeof) {
6283
6292
  case u:
6284
- var w = h;
6285
- return ht(w) + ".Consumer";
6293
+ var T = h;
6294
+ return ht(T) + ".Consumer";
6286
6295
  case a:
6287
6296
  var v = h;
6288
6297
  return ht(v._context) + ".Provider";
@@ -6302,7 +6311,7 @@ function yc() {
6302
6311
  }
6303
6312
  return null;
6304
6313
  }
6305
- var Te = Object.assign, Be = 0, Hn, Yn, Jn, Zn, Xn, er, tr;
6314
+ var we = Object.assign, Be = 0, Hn, Yn, Jn, Zn, Xn, er, tr;
6306
6315
  function nr() {
6307
6316
  }
6308
6317
  nr.__reactDisabledLog = !0;
@@ -6338,25 +6347,25 @@ function yc() {
6338
6347
  writable: !0
6339
6348
  };
6340
6349
  Object.defineProperties(console, {
6341
- log: Te({}, h, {
6350
+ log: we({}, h, {
6342
6351
  value: Hn
6343
6352
  }),
6344
- info: Te({}, h, {
6353
+ info: we({}, h, {
6345
6354
  value: Yn
6346
6355
  }),
6347
- warn: Te({}, h, {
6356
+ warn: we({}, h, {
6348
6357
  value: Jn
6349
6358
  }),
6350
- error: Te({}, h, {
6359
+ error: we({}, h, {
6351
6360
  value: Zn
6352
6361
  }),
6353
- group: Te({}, h, {
6362
+ group: we({}, h, {
6354
6363
  value: Xn
6355
6364
  }),
6356
- groupCollapsed: Te({}, h, {
6365
+ groupCollapsed: we({}, h, {
6357
6366
  value: er
6358
6367
  }),
6359
- groupEnd: Te({}, h, {
6368
+ groupEnd: we({}, h, {
6360
6369
  value: tr
6361
6370
  })
6362
6371
  });
@@ -6365,7 +6374,7 @@ function yc() {
6365
6374
  }
6366
6375
  }
6367
6376
  var Kt = g.ReactCurrentDispatcher, qt;
6368
- function pt(h, w, v) {
6377
+ function pt(h, T, v) {
6369
6378
  {
6370
6379
  if (qt === void 0)
6371
6380
  try {
@@ -6383,7 +6392,7 @@ function yc() {
6383
6392
  var ns = typeof WeakMap == "function" ? WeakMap : Map;
6384
6393
  yt = new ns();
6385
6394
  }
6386
- function rr(h, w) {
6395
+ function rr(h, T) {
6387
6396
  if (!h || Wt)
6388
6397
  return "";
6389
6398
  {
@@ -6398,7 +6407,7 @@ function yc() {
6398
6407
  var M;
6399
6408
  M = Kt.current, Kt.current = null, es();
6400
6409
  try {
6401
- if (w) {
6410
+ if (T) {
6402
6411
  var C = function() {
6403
6412
  throw Error();
6404
6413
  };
@@ -6454,14 +6463,14 @@ function yc() {
6454
6463
  var Ie = h ? h.displayName || h.name : "", me = Ie ? pt(Ie) : "";
6455
6464
  return typeof h == "function" && yt.set(h, me), me;
6456
6465
  }
6457
- function rs(h, w, v) {
6466
+ function rs(h, T, v) {
6458
6467
  return rr(h, !1);
6459
6468
  }
6460
6469
  function is(h) {
6461
- var w = h.prototype;
6462
- return !!(w && w.isReactComponent);
6470
+ var T = h.prototype;
6471
+ return !!(T && T.isReactComponent);
6463
6472
  }
6464
- function bt(h, w, v) {
6473
+ function bt(h, T, v) {
6465
6474
  if (h == null)
6466
6475
  return "";
6467
6476
  if (typeof h == "function")
@@ -6479,11 +6488,11 @@ function yc() {
6479
6488
  case d:
6480
6489
  return rs(h.render);
6481
6490
  case l:
6482
- return bt(h.type, w, v);
6491
+ return bt(h.type, T, v);
6483
6492
  case p: {
6484
6493
  var O = h, P = O._payload, M = O._init;
6485
6494
  try {
6486
- return bt(M(P), w, v);
6495
+ return bt(M(P), T, v);
6487
6496
  } catch {
6488
6497
  }
6489
6498
  }
@@ -6493,12 +6502,12 @@ function yc() {
6493
6502
  var Ge = Object.prototype.hasOwnProperty, ir = {}, sr = g.ReactDebugCurrentFrame;
6494
6503
  function _t(h) {
6495
6504
  if (h) {
6496
- var w = h._owner, v = bt(h.type, h._source, w ? w.type : null);
6505
+ var T = h._owner, v = bt(h.type, h._source, T ? T.type : null);
6497
6506
  sr.setExtraStackFrame(v);
6498
6507
  } else
6499
6508
  sr.setExtraStackFrame(null);
6500
6509
  }
6501
- function ss(h, w, v, O, P) {
6510
+ function ss(h, T, v, O, P) {
6502
6511
  {
6503
6512
  var M = Function.call.bind(Ge);
6504
6513
  for (var C in h)
@@ -6509,7 +6518,7 @@ function yc() {
6509
6518
  var G = Error((O || "React class") + ": " + v + " type `" + C + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[C] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
6510
6519
  throw G.name = "Invariant Violation", G;
6511
6520
  }
6512
- k = h[C](w, C, O, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
6521
+ k = h[C](T, C, O, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
6513
6522
  } catch (D) {
6514
6523
  k = D;
6515
6524
  }
@@ -6523,7 +6532,7 @@ function yc() {
6523
6532
  }
6524
6533
  function as(h) {
6525
6534
  {
6526
- var w = typeof Symbol == "function" && Symbol.toStringTag, v = w && h[Symbol.toStringTag] || h.constructor.name || "Object";
6535
+ var T = typeof Symbol == "function" && Symbol.toStringTag, v = T && h[Symbol.toStringTag] || h.constructor.name || "Object";
6527
6536
  return v;
6528
6537
  }
6529
6538
  }
@@ -6549,27 +6558,27 @@ function yc() {
6549
6558
  }, cr, dr;
6550
6559
  function ds(h) {
6551
6560
  if (Ge.call(h, "ref")) {
6552
- var w = Object.getOwnPropertyDescriptor(h, "ref").get;
6553
- if (w && w.isReactWarning)
6561
+ var T = Object.getOwnPropertyDescriptor(h, "ref").get;
6562
+ if (T && T.isReactWarning)
6554
6563
  return !1;
6555
6564
  }
6556
6565
  return h.ref !== void 0;
6557
6566
  }
6558
6567
  function fs(h) {
6559
6568
  if (Ge.call(h, "key")) {
6560
- var w = Object.getOwnPropertyDescriptor(h, "key").get;
6561
- if (w && w.isReactWarning)
6569
+ var T = Object.getOwnPropertyDescriptor(h, "key").get;
6570
+ if (T && T.isReactWarning)
6562
6571
  return !1;
6563
6572
  }
6564
6573
  return h.key !== void 0;
6565
6574
  }
6566
- function ls(h, w) {
6575
+ function ls(h, T) {
6567
6576
  typeof h.ref == "string" && ur.current;
6568
6577
  }
6569
- function hs(h, w) {
6578
+ function hs(h, T) {
6570
6579
  {
6571
6580
  var v = function() {
6572
- cr || (cr = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", w));
6581
+ cr || (cr = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
6573
6582
  };
6574
6583
  v.isReactWarning = !0, Object.defineProperty(h, "key", {
6575
6584
  get: v,
@@ -6577,10 +6586,10 @@ function yc() {
6577
6586
  });
6578
6587
  }
6579
6588
  }
6580
- function ps(h, w) {
6589
+ function ps(h, T) {
6581
6590
  {
6582
6591
  var v = function() {
6583
- dr || (dr = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", w));
6592
+ dr || (dr = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
6584
6593
  };
6585
6594
  v.isReactWarning = !0, Object.defineProperty(h, "ref", {
6586
6595
  get: v,
@@ -6588,13 +6597,13 @@ function yc() {
6588
6597
  });
6589
6598
  }
6590
6599
  }
6591
- var ys = function(h, w, v, O, P, M, C) {
6600
+ var ys = function(h, T, v, O, P, M, C) {
6592
6601
  var k = {
6593
6602
  // This tag allows us to uniquely identify this as a React Element
6594
6603
  $$typeof: n,
6595
6604
  // Built-in properties that belong on the element
6596
6605
  type: h,
6597
- key: w,
6606
+ key: T,
6598
6607
  ref: v,
6599
6608
  props: C,
6600
6609
  // Record the component responsible for creating this element.
@@ -6617,12 +6626,12 @@ function yc() {
6617
6626
  value: P
6618
6627
  }), Object.freeze && (Object.freeze(k.props), Object.freeze(k)), k;
6619
6628
  };
6620
- function bs(h, w, v, O, P) {
6629
+ function bs(h, T, v, O, P) {
6621
6630
  {
6622
6631
  var M, C = {}, k = null, G = null;
6623
- v !== void 0 && (ar(v), k = "" + v), fs(w) && (ar(w.key), k = "" + w.key), ds(w) && (G = w.ref, ls(w, P));
6624
- for (M in w)
6625
- Ge.call(w, M) && !cs.hasOwnProperty(M) && (C[M] = w[M]);
6632
+ v !== void 0 && (ar(v), k = "" + v), fs(T) && (ar(T.key), k = "" + T.key), ds(T) && (G = T.ref, ls(T, P));
6633
+ for (M in T)
6634
+ Ge.call(T, M) && !cs.hasOwnProperty(M) && (C[M] = T[M]);
6626
6635
  if (h && h.defaultProps) {
6627
6636
  var D = h.defaultProps;
6628
6637
  for (M in D)
@@ -6638,7 +6647,7 @@ function yc() {
6638
6647
  var Vt = g.ReactCurrentOwner, fr = g.ReactDebugCurrentFrame;
6639
6648
  function Pe(h) {
6640
6649
  if (h) {
6641
- var w = h._owner, v = bt(h.type, h._source, w ? w.type : null);
6650
+ var T = h._owner, v = bt(h.type, h._source, T ? T.type : null);
6642
6651
  fr.setExtraStackFrame(v);
6643
6652
  } else
6644
6653
  fr.setExtraStackFrame(null);
@@ -6666,22 +6675,22 @@ Check the render method of \`` + h + "`.";
6666
6675
  var hr = {};
6667
6676
  function gs(h) {
6668
6677
  {
6669
- var w = lr();
6670
- if (!w) {
6678
+ var T = lr();
6679
+ if (!T) {
6671
6680
  var v = typeof h == "string" ? h : h.displayName || h.name;
6672
- v && (w = `
6681
+ v && (T = `
6673
6682
 
6674
6683
  Check the top-level render call using <` + v + ">.");
6675
6684
  }
6676
- return w;
6685
+ return T;
6677
6686
  }
6678
6687
  }
6679
- function pr(h, w) {
6688
+ function pr(h, T) {
6680
6689
  {
6681
6690
  if (!h._store || h._store.validated || h.key != null)
6682
6691
  return;
6683
6692
  h._store.validated = !0;
6684
- var v = gs(w);
6693
+ var v = gs(T);
6685
6694
  if (hr[v])
6686
6695
  return;
6687
6696
  hr[v] = !0;
@@ -6689,54 +6698,54 @@ Check the top-level render call using <` + v + ">.");
6689
6698
  h && h._owner && h._owner !== Vt.current && (O = " It was passed a child from " + ce(h._owner.type) + "."), Pe(h), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', v, O), Pe(null);
6690
6699
  }
6691
6700
  }
6692
- function yr(h, w) {
6701
+ function yr(h, T) {
6693
6702
  {
6694
6703
  if (typeof h != "object")
6695
6704
  return;
6696
6705
  if (zt(h))
6697
6706
  for (var v = 0; v < h.length; v++) {
6698
6707
  var O = h[v];
6699
- Gt(O) && pr(O, w);
6708
+ Gt(O) && pr(O, T);
6700
6709
  }
6701
6710
  else if (Gt(h))
6702
6711
  h._store && (h._store.validated = !0);
6703
6712
  else if (h) {
6704
- var P = T(h);
6713
+ var P = w(h);
6705
6714
  if (typeof P == "function" && P !== h.entries)
6706
6715
  for (var M = P.call(h), C; !(C = M.next()).done; )
6707
- Gt(C.value) && pr(C.value, w);
6716
+ Gt(C.value) && pr(C.value, T);
6708
6717
  }
6709
6718
  }
6710
6719
  }
6711
- function ws(h) {
6720
+ function Ts(h) {
6712
6721
  {
6713
- var w = h.type;
6714
- if (w == null || typeof w == "string")
6722
+ var T = h.type;
6723
+ if (T == null || typeof T == "string")
6715
6724
  return;
6716
6725
  var v;
6717
- if (typeof w == "function")
6718
- v = w.propTypes;
6719
- else if (typeof w == "object" && (w.$$typeof === d || // Note: Memo only checks outer props here.
6726
+ if (typeof T == "function")
6727
+ v = T.propTypes;
6728
+ else if (typeof T == "object" && (T.$$typeof === d || // Note: Memo only checks outer props here.
6720
6729
  // Inner props are checked in the reconciler.
6721
- w.$$typeof === l))
6722
- v = w.propTypes;
6730
+ T.$$typeof === l))
6731
+ v = T.propTypes;
6723
6732
  else
6724
6733
  return;
6725
6734
  if (v) {
6726
- var O = ce(w);
6735
+ var O = ce(T);
6727
6736
  ss(v, h.props, "prop", O, h);
6728
- } else if (w.PropTypes !== void 0 && !Bt) {
6737
+ } else if (T.PropTypes !== void 0 && !Bt) {
6729
6738
  Bt = !0;
6730
- var P = ce(w);
6739
+ var P = ce(T);
6731
6740
  m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", P || "Unknown");
6732
6741
  }
6733
- typeof w.getDefaultProps == "function" && !w.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
6742
+ typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
6734
6743
  }
6735
6744
  }
6736
- function Ts(h) {
6745
+ function ws(h) {
6737
6746
  {
6738
- for (var w = Object.keys(h.props), v = 0; v < w.length; v++) {
6739
- var O = w[v];
6747
+ for (var T = Object.keys(h.props), v = 0; v < T.length; v++) {
6748
+ var O = T[v];
6740
6749
  if (O !== "children" && O !== "key") {
6741
6750
  Pe(h), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", O), Pe(null);
6742
6751
  break;
@@ -6746,7 +6755,7 @@ Check the top-level render call using <` + v + ">.");
6746
6755
  }
6747
6756
  }
6748
6757
  var br = {};
6749
- function _r(h, w, v, O, P, M) {
6758
+ function _r(h, T, v, O, P, M) {
6750
6759
  {
6751
6760
  var C = Ft(h);
6752
6761
  if (!C) {
@@ -6757,11 +6766,11 @@ Check the top-level render call using <` + v + ">.");
6757
6766
  var D;
6758
6767
  h === null ? D = "null" : zt(h) ? D = "array" : h !== void 0 && h.$$typeof === n ? (D = "<" + (ce(h.type) || "Unknown") + " />", k = " Did you accidentally export a JSX literal instead of a component?") : D = typeof h, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", D, k);
6759
6768
  }
6760
- var L = bs(h, w, v, P, M);
6769
+ var L = bs(h, T, v, P, M);
6761
6770
  if (L == null)
6762
6771
  return L;
6763
6772
  if (C) {
6764
- var re = w.children;
6773
+ var re = T.children;
6765
6774
  if (re !== void 0)
6766
6775
  if (O)
6767
6776
  if (zt(re)) {
@@ -6773,8 +6782,8 @@ Check the top-level render call using <` + v + ">.");
6773
6782
  else
6774
6783
  yr(re, h);
6775
6784
  }
6776
- if (Ge.call(w, "key")) {
6777
- var me = ce(h), Y = Object.keys(w).filter(function(As) {
6785
+ if (Ge.call(T, "key")) {
6786
+ var me = ce(h), Y = Object.keys(T).filter(function(As) {
6778
6787
  return As !== "key";
6779
6788
  }), Qt = Y.length > 0 ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}";
6780
6789
  if (!br[me + Qt]) {
@@ -6787,23 +6796,23 @@ React keys must be passed directly to JSX without using spread:
6787
6796
  <%s key={someKey} {...props} />`, Qt, me, Es, me), br[me + Qt] = !0;
6788
6797
  }
6789
6798
  }
6790
- return h === i ? Ts(L) : ws(L), L;
6799
+ return h === i ? ws(L) : Ts(L), L;
6791
6800
  }
6792
6801
  }
6793
- function ms(h, w, v) {
6794
- return _r(h, w, v, !0);
6802
+ function ms(h, T, v) {
6803
+ return _r(h, T, v, !0);
6795
6804
  }
6796
- function vs(h, w, v) {
6797
- return _r(h, w, v, !1);
6805
+ function vs(h, T, v) {
6806
+ return _r(h, T, v, !1);
6798
6807
  }
6799
6808
  var Ss = vs, Os = ms;
6800
6809
  Ye.Fragment = i, Ye.jsx = Ss, Ye.jsxs = Os;
6801
6810
  }(), Ye;
6802
6811
  }
6803
- var bc = {};
6804
- bc.NODE_ENV === "production" ? vn.exports = pc() : vn.exports = yc();
6812
+ var _c = {};
6813
+ _c.NODE_ENV === "production" ? vn.exports = yc() : vn.exports = bc();
6805
6814
  var W = vn.exports;
6806
- const _c = {
6815
+ const gc = {
6807
6816
  isLoading: !0,
6808
6817
  data: void 0,
6809
6818
  pageInfo: void 0,
@@ -6812,9 +6821,9 @@ const _c = {
6812
6821
  function ri(t) {
6813
6822
  return Object.assign({ isLoading: !t, data: void 0, pageInfo: void 0, error: void 0 }, t || {});
6814
6823
  }
6815
- function gc(t, e, n) {
6824
+ function Tc(t, e, n) {
6816
6825
  e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
6817
- const r = e ? cc(e) : null, i = z(r), s = at(ri(t._reactor.getPreviousResult(r))), o = ge(
6826
+ const r = e ? dc(e) : null, i = z(r), s = at(ri(t._reactor.getPreviousResult(r))), o = ge(
6818
6827
  (u) => (s.current = ri(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (c) => {
6819
6828
  s.current = Object.assign({
6820
6829
  isLoading: !c,
@@ -6830,7 +6839,7 @@ function gc(t, e, n) {
6830
6839
  // Build a new subscribe function if the query changes
6831
6840
  [i]
6832
6841
  );
6833
- return { state: tn(o, () => s.current, () => _c), query: r };
6842
+ return { state: tn(o, () => s.current, () => gc), query: r };
6834
6843
  }
6835
6844
  function wc() {
6836
6845
  const t = at(null);
@@ -6845,14 +6854,14 @@ function wc() {
6845
6854
  }
6846
6855
  return { set: e, clear: n };
6847
6856
  }
6848
- const Tc = 1e3;
6849
- function mc(t, e, n) {
6857
+ const mc = 1e3;
6858
+ function vc(t, e, n) {
6850
6859
  const r = at(n);
6851
6860
  r.current = n, ke(() => t.core._reactor.subscribeTopic(t.id, e, (s, o) => {
6852
6861
  r.current(s, o);
6853
6862
  }), [t.id, e]);
6854
6863
  }
6855
- function vc(t, e) {
6864
+ function Sc(t, e) {
6856
6865
  return ke(() => t.core._reactor.joinRoom(t.id), [t.id]), ge((r) => {
6857
6866
  t.core._reactor.publishTopic({
6858
6867
  roomType: t.type,
@@ -6862,7 +6871,7 @@ function vc(t, e) {
6862
6871
  });
6863
6872
  }, [t.id, e]);
6864
6873
  }
6865
- function Sc(t, e = {}) {
6874
+ function Oc(t, e = {}) {
6866
6875
  var n, r;
6867
6876
  const [i, s] = di(() => {
6868
6877
  var u;
@@ -6879,10 +6888,10 @@ function Sc(t, e = {}) {
6879
6888
  }, [t.type, t.id]);
6880
6889
  return nn(() => Object.assign(Object.assign({}, i), { publishPresence: o }), [i, o]);
6881
6890
  }
6882
- function Oc(t, e, n) {
6891
+ function Ec(t, e, n) {
6883
6892
  ke(() => t.core._reactor.joinRoom(t.id, e), [t.id]), ke(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
6884
6893
  }
6885
- function Ec(t, e, n = {}) {
6894
+ function Ac(t, e, n = {}) {
6886
6895
  const r = wc(), i = Se.usePresence(t, {
6887
6896
  keys: [e]
6888
6897
  }), s = nn(() => {
@@ -6893,7 +6902,7 @@ function Ec(t, e, n = {}) {
6893
6902
  var f;
6894
6903
  t.core._reactor.publishPresence(t.type, t.id, {
6895
6904
  [e]: c
6896
- }), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f : Tc, () => {
6905
+ }), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f : mc, () => {
6897
6906
  t.core._reactor.publishPresence(t.type, t.id, {
6898
6907
  [e]: null
6899
6908
  });
@@ -6911,20 +6920,20 @@ function Ec(t, e, n = {}) {
6911
6920
  };
6912
6921
  }
6913
6922
  const Se = {
6914
- useTopicEffect: mc,
6915
- usePublishTopic: vc,
6916
- usePresence: Sc,
6917
- useSyncPresence: Oc,
6918
- useTypingIndicator: Ec
6923
+ useTopicEffect: vc,
6924
+ usePublishTopic: Sc,
6925
+ usePresence: Oc,
6926
+ useSyncPresence: Ec,
6927
+ useTypingIndicator: Ac
6919
6928
  };
6920
- class Ac {
6929
+ class kc {
6921
6930
  constructor(e, n, r) {
6922
6931
  this.useTopicEffect = (i, s) => {
6923
6932
  Se.useTopicEffect(this, i, s);
6924
6933
  }, this.usePublishTopic = (i) => Se.usePublishTopic(this, i), this.usePresence = (i = {}) => Se.usePresence(this, i), this.useSyncPresence = (i, s) => Se.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => Se.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
6925
6934
  }
6926
6935
  }
6927
- var kc = function(t, e, n, r) {
6936
+ var jc = function(t, e, n, r) {
6928
6937
  function i(s) {
6929
6938
  return s instanceof n ? s : new n(function(o) {
6930
6939
  o(s);
@@ -6951,26 +6960,26 @@ var kc = function(t, e, n, r) {
6951
6960
  d((r = r.apply(t, e || [])).next());
6952
6961
  });
6953
6962
  };
6954
- const jc = {
6963
+ const Cc = {
6955
6964
  isLoading: !0,
6956
6965
  user: void 0,
6957
6966
  error: void 0
6958
6967
  };
6959
- class Cc {
6968
+ class Pc {
6960
6969
  constructor(e, n) {
6961
6970
  this.tx = zn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
6962
6971
  const [i, s] = di(null);
6963
6972
  return ke(() => {
6964
- kc(this, void 0, void 0, function* () {
6973
+ jc(this, void 0, void 0, function* () {
6965
6974
  const a = yield this.getLocalId(r);
6966
6975
  s(a);
6967
6976
  });
6968
6977
  }, [r]), i;
6969
- }, this.rooms = Se, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => gc(this.core, r, i).state, this.useAuth = () => {
6978
+ }, this.rooms = Se, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => Tc(this.core, r, i).state, this.useAuth = () => {
6970
6979
  const r = at(this.core._reactor._currentUserCached), i = ge((o) => this.core.subscribeAuth((u) => {
6971
6980
  r.current = Object.assign({ isLoading: !1 }, u), o();
6972
6981
  }), []);
6973
- return tn(i, () => r.current, () => jc);
6982
+ return tn(i, () => r.current, () => Cc);
6974
6983
  }, this.useUser = () => {
6975
6984
  const { user: r } = this.useAuth();
6976
6985
  if (!r)
@@ -6992,7 +7001,7 @@ class Cc {
6992
7001
  }, this.SignedOut = ({ children: r }) => {
6993
7002
  const i = this.useAuth();
6994
7003
  return i.isLoading || i.error || i.user ? null : W.jsx(W.Fragment, { children: r });
6995
- }, this.core = lc(
7004
+ }, this.core = hc(
6996
7005
  e,
6997
7006
  // @ts-expect-error because TS can't resolve subclass statics
6998
7007
  this.constructor.Storage,
@@ -7016,7 +7025,7 @@ class Cc {
7016
7025
  * const { peers } = db.rooms.usePresence(room);
7017
7026
  */
7018
7027
  room(e = "_defaultRoomType", n = "_defaultRoomId") {
7019
- return new Ac(this.core, e, n);
7028
+ return new kc(this.core, e, n);
7020
7029
  }
7021
7030
  /**
7022
7031
  * One time query for the logged in state. This is useful
@@ -7039,7 +7048,7 @@ class ii extends Error {
7039
7048
  }
7040
7049
  function en(t) {
7041
7050
  }
7042
- function Pc(t) {
7051
+ function Ic(t) {
7043
7052
  if (typeof t == "function")
7044
7053
  throw new TypeError(
7045
7054
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
@@ -7047,8 +7056,8 @@ function Pc(t) {
7047
7056
  const { onEvent: e = en, onError: n = en, onRetry: r = en, onComment: i } = t;
7048
7057
  let s = "", o = !0, a, u = "", d = "";
7049
7058
  function c(b) {
7050
- const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [T, g] = Ic(`${s}${_}`);
7051
- for (const m of T)
7059
+ const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, g] = Mc(`${s}${_}`);
7060
+ for (const m of w)
7052
7061
  f(m);
7053
7062
  s = g, o = !1;
7054
7063
  }
@@ -7063,13 +7072,13 @@ function Pc(t) {
7063
7072
  }
7064
7073
  const _ = b.indexOf(":");
7065
7074
  if (_ !== -1) {
7066
- const T = b.slice(0, _), g = b[_ + 1] === " " ? 2 : 1, m = b.slice(_ + g);
7067
- l(T, m, b);
7075
+ const w = b.slice(0, _), g = b[_ + 1] === " " ? 2 : 1, m = b.slice(_ + g);
7076
+ l(w, m, b);
7068
7077
  return;
7069
7078
  }
7070
7079
  l(b, "", b);
7071
7080
  }
7072
- function l(b, _, T) {
7081
+ function l(b, _, w) {
7073
7082
  switch (b) {
7074
7083
  case "event":
7075
7084
  d = _;
@@ -7086,7 +7095,7 @@ function Pc(t) {
7086
7095
  new ii(`Invalid \`retry\` value: "${_}"`, {
7087
7096
  type: "invalid-retry",
7088
7097
  value: _,
7089
- line: T
7098
+ line: w
7090
7099
  })
7091
7100
  );
7092
7101
  break;
@@ -7094,7 +7103,7 @@ function Pc(t) {
7094
7103
  n(
7095
7104
  new ii(
7096
7105
  `Unknown field "${b.length > 20 ? `${b.slice(0, 20)}…` : b}"`,
7097
- { type: "unknown-field", field: b, value: _, line: T }
7106
+ { type: "unknown-field", field: b, value: _, line: w }
7098
7107
  )
7099
7108
  );
7100
7109
  break;
@@ -7115,7 +7124,7 @@ function Pc(t) {
7115
7124
  }
7116
7125
  return { feed: c, reset: y };
7117
7126
  }
7118
- function Ic(t) {
7127
+ function Mc(t) {
7119
7128
  const e = [];
7120
7129
  let n = "", r = 0;
7121
7130
  for (; r < t.length; ) {
@@ -7175,7 +7184,7 @@ class si extends Event {
7175
7184
  return e(oi(this), n);
7176
7185
  }
7177
7186
  }
7178
- function Mc(t) {
7187
+ function Rc(t) {
7179
7188
  const e = globalThis.DOMException;
7180
7189
  return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
7181
7190
  }
@@ -7247,13 +7256,13 @@ class kt extends EventTarget {
7247
7256
  if (e instanceof URL)
7248
7257
  $(this, Oe, e);
7249
7258
  else if (typeof e == "string")
7250
- $(this, Oe, new URL(e, Rc()));
7259
+ $(this, Oe, new URL(e, xc()));
7251
7260
  else
7252
7261
  throw new Error("Invalid URL");
7253
7262
  } catch {
7254
- throw Mc("An invalid or illegal string was specified");
7263
+ throw Rc("An invalid or illegal string was specified");
7255
7264
  }
7256
- $(this, xe, Pc({
7265
+ $(this, xe, Ic({
7257
7266
  onEvent: A(this, kn),
7258
7267
  onRetry: A(this, jn)
7259
7268
  })), $(this, J, this.CONNECTING), $(this, st, 3e3), $(this, Rt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, At, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), he(this, se, On).call(this);
@@ -7396,15 +7405,15 @@ kt.OPEN = 1, /**
7396
7405
  * @public
7397
7406
  */
7398
7407
  kt.CLOSED = 2;
7399
- function Rc() {
7408
+ function xc() {
7400
7409
  const t = "document" in globalThis ? globalThis.document : void 0;
7401
7410
  return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
7402
7411
  }
7403
- const Qn = class Qn extends Cc {
7412
+ const Qn = class Qn extends Pc {
7404
7413
  };
7405
7414
  Qn.EventSourceImpl = kt;
7406
7415
  let In = Qn;
7407
- function xc(t) {
7416
+ function $c(t) {
7408
7417
  const e = {
7409
7418
  ...t,
7410
7419
  useDateObjects: t.useDateObjects ?? !1
@@ -7413,8 +7422,8 @@ function xc(t) {
7413
7422
  "@instantdb/react": Bn
7414
7423
  });
7415
7424
  }
7416
- const qc = xc;
7417
- function Wc({
7425
+ const Wc = $c;
7426
+ function zc({
7418
7427
  as: t = "div",
7419
7428
  spaceId: e,
7420
7429
  room: n,
@@ -7461,7 +7470,7 @@ function Wc({
7461
7470
  p(E, m);
7462
7471
  }
7463
7472
  }
7464
- function T(g) {
7473
+ function w(g) {
7465
7474
  f.publishPresence({
7466
7475
  [c]: void 0
7467
7476
  });
@@ -7472,7 +7481,7 @@ function Wc({
7472
7481
  onMouseMove: y,
7473
7482
  onMouseOut: b,
7474
7483
  onTouchMove: _,
7475
- onTouchEnd: T,
7484
+ onTouchEnd: w,
7476
7485
  className: r,
7477
7486
  style: {
7478
7487
  position: "relative",
@@ -7486,8 +7495,8 @@ function Wc({
7486
7495
  {
7487
7496
  style: {
7488
7497
  ...ui,
7489
- ...Dc,
7490
- zIndex: d !== void 0 ? d : Uc
7498
+ ...Uc,
7499
+ zIndex: d !== void 0 ? d : Lc
7491
7500
  },
7492
7501
  children: Object.entries(f.peers).map(([g, m]) => {
7493
7502
  const E = m[c];
@@ -7503,7 +7512,7 @@ function Wc({
7503
7512
  children: a ? a({
7504
7513
  color: E.color,
7505
7514
  presence: l == null ? void 0 : l.peers[g]
7506
- }) : /* @__PURE__ */ W.jsx($c, { ...E })
7515
+ }) : /* @__PURE__ */ W.jsx(Dc, { ...E })
7507
7516
  },
7508
7517
  g
7509
7518
  ) : null;
@@ -7514,7 +7523,7 @@ function Wc({
7514
7523
  ]
7515
7524
  );
7516
7525
  }
7517
- function $c({ color: t }) {
7526
+ function Dc({ color: t }) {
7518
7527
  const n = t || "black";
7519
7528
  return /* @__PURE__ */ W.jsxs(
7520
7529
  "svg",
@@ -7567,21 +7576,21 @@ const ui = {
7567
7576
  left: 0,
7568
7577
  bottom: 0,
7569
7578
  right: 0
7570
- }, Dc = {
7579
+ }, Uc = {
7571
7580
  overflow: "hidden",
7572
7581
  pointerEvents: "none",
7573
7582
  userSelect: "none"
7574
- }, Uc = 99999;
7583
+ }, Lc = 99999;
7575
7584
  export {
7576
- Wc as Cursors,
7585
+ zc as Cursors,
7577
7586
  Dt as InstantAPIError,
7578
- Cc as InstantReactAbstractDatabase,
7587
+ Pc as InstantReactAbstractDatabase,
7579
7588
  In as InstantReactWebDatabase,
7580
7589
  ve as SyncTableCallbackEventType,
7581
- Kc as i,
7590
+ qc as i,
7582
7591
  K as id,
7583
- xc as init,
7584
- qc as init_experimental,
7585
- Fc as lookup,
7586
- Nc as tx
7592
+ $c as init,
7593
+ Wc as init_experimental,
7594
+ Nc as lookup,
7595
+ Kc as tx
7587
7596
  };