@instantdb/react 0.22.76 → 0.22.77-experimental.fix-date.19939890312.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.
@@ -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)
@@ -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()) {
@@ -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;
@@ -1695,7 +1704,7 @@ function go(t, e) {
1695
1704
  if (qe(t.attrs, i))
1696
1705
  return We(t.eav, [r, i]);
1697
1706
  }
1698
- function To(t, e) {
1707
+ function wo(t, e) {
1699
1708
  const n = e.filter(([r, i, s, o, a]) => {
1700
1709
  if (r !== "add-triple" && r !== "deep-merge-triple")
1701
1710
  return !0;
@@ -1706,20 +1715,20 @@ function To(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 wo(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)) : wo(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,24 +1864,24 @@ 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) {
@@ -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,7 +1973,7 @@ function Vo(t, e) {
1964
1973
  }
1965
1974
  return e;
1966
1975
  }
1967
- function Bo(t, e, n, r, i, s) {
1976
+ function Go(t, e, n, r, i, s) {
1968
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}`);
@@ -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,25 +2067,25 @@ 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 [w, g, m] = ta(t, e, n, r, l, u), E = Di(e, {
2088
+ const [w, g, m] = na(t, e, n, r, l, u), E = Di(e, {
2080
2089
  etype: w,
2081
2090
  level: g,
2082
2091
  form: i[l],
@@ -2093,11 +2102,11 @@ function na(t, e, { etype: n, level: r, form: i }, s) {
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,24 +2122,24 @@ 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
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
2145
  const a = Te(t, e, o), u = (r = a == null ? void 0 : a["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
@@ -2142,11 +2151,11 @@ function ua(t, e, n) {
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
2161
  c = c.map(([w]) => {
@@ -2161,17 +2170,17 @@ function ca(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2161
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 w = bo(t, y, _);
2178
+ const w = _o(t, y, _);
2170
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];
@@ -2334,7 +2343,7 @@ function Ae(t, e, n) {
2334
2343
  return o === e && a === n;
2335
2344
  });
2336
2345
  }
2337
- function Ta(t) {
2346
+ function wa(t) {
2338
2347
  if (Array.isArray(t))
2339
2348
  return t;
2340
2349
  const e = Object.entries(t);
@@ -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 wa(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);
@@ -2362,13 +2371,13 @@ function wa(t, e, n) {
2362
2371
  return i;
2363
2372
  }
2364
2373
  function _n(t) {
2365
- return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? Li(t) : Ta(t);
2374
+ return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? Li(t) : wa(t);
2366
2375
  }
2367
2376
  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 = wa(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,14 +2534,14 @@ 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,
@@ -2540,14 +2549,14 @@ function Ma(t, e, n) {
2540
2549
  };
2541
2550
  }
2542
2551
  function Tt(t, e, n, r) {
2543
- const i = t ? Ma(t, e, n) : null, s = K(), a = [K(), e, n];
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,10 +2612,10 @@ 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);
@@ -2628,12 +2637,12 @@ function Ka({ attrs: t, schema: e }, n) {
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
2642
  d(_), _ || u(Tt(e, p, "id", { "unique?": !0 }));
2634
2643
  for (const w of Object.keys(b)) {
2635
2644
  const g = V(o, p, w);
2636
- if (d(g), Ua.has(l) && (g || u(Tt(e, p, w, w === "id" ? { "unique?": !0 } : null))), Da.has(l)) {
2645
+ if (d(g), La.has(l) && (g || u(Tt(e, p, w, w === "id" ? { "unique?": !0 } : null))), Ua.has(l)) {
2637
2646
  const m = Ae(o, p, w);
2638
2647
  !g && !m && u(Mr(e, p, w)), d(m);
2639
2648
  }
@@ -2642,8 +2651,8 @@ function Ka({ attrs: t, schema: e }, n) {
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,7 +2686,7 @@ 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
  }
@@ -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
@@ -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) => {
@@ -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";
3554
- function fu(t, e) {
3562
+ const Bn = "v0.22.77-experimental.fix-date.19939890312.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,
@@ -3879,7 +3888,7 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3879
3888
  unlink: Vr,
3880
3889
  delete: () => {
3881
3890
  }
3882
- }, Tu = (t, e) => {
3891
+ }, wu = (t, e) => {
3883
3892
  if (!e)
3884
3893
  return;
3885
3894
  const [n, r, i, s] = t;
@@ -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
- }, wu = (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")
@@ -3899,7 +3908,7 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3899
3908
  for (const i of r.__ops) {
3900
3909
  if (!Array.isArray(i))
3901
3910
  throw new ie(`Transaction operation must be an array, but received: ${typeof i}`);
3902
- Tu(i, e);
3911
+ wu(i, e);
3903
3912
  }
3904
3913
  }
3905
3914
  };
@@ -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;
@@ -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) {
@@ -4148,14 +4157,14 @@ function Eu(t, e) {
4148
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
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
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;
@@ -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,8 +4426,8 @@ 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 w = Au(a, this.createStore);
4421
- ku(a, w, 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
4432
  data: wt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
4424
4433
  added: b,
@@ -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 || wu(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) => {
@@ -4728,9 +4737,9 @@ class Ku {
4728
4737
  _initStorage(e) {
4729
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;
@@ -4749,8 +4758,8 @@ class Ku {
4749
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,
@@ -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));
@@ -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;
@@ -5149,7 +5158,7 @@ class Ku {
5149
5158
  }
5150
5159
  _applyOptimisticUpdates(e, n, r) {
5151
5160
  for (const [i, s] of n)
5152
- (!s["tx-id"] || r && s["tx-id"] > r) && (e = To(e, s["tx-steps"]));
5161
+ (!s["tx-id"] || r && s["tx-id"] > r) && (e = wo(e, s["tx-steps"]));
5153
5162
  return e;
5154
5163
  }
5155
5164
  /** Re-compute all subscriptions */
@@ -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;
@@ -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,23 +5943,23 @@ 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
  }
@@ -5958,23 +5967,23 @@ 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
@@ -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
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[wn(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 = {};
@@ -6800,10 +6809,10 @@ React keys must be passed directly to JSX without using spread:
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,9 +6839,9 @@ 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
- function Tc() {
6844
+ function wc() {
6836
6845
  const t = at(null);
6837
6846
  ke(() => {
6838
6847
  n();
@@ -6845,14 +6854,14 @@ function Tc() {
6845
6854
  }
6846
6855
  return { set: e, clear: n };
6847
6856
  }
6848
- const wc = 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,11 +6888,11 @@ 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 = {}) {
6886
- const r = Tc(), i = Se.usePresence(t, {
6894
+ function Ac(t, e, n = {}) {
6895
+ const r = wc(), i = Se.usePresence(t, {
6887
6896
  keys: [e]
6888
6897
  }), s = nn(() => {
6889
6898
  var c;
@@ -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 : wc, () => {
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,7 +7056,7 @@ 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, [w, g] = Ic(`${s}${_}`);
7059
+ const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, g] = Mc(`${s}${_}`);
7051
7060
  for (const m of w)
7052
7061
  f(m);
7053
7062
  s = g, o = !1;
@@ -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,
@@ -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
  };