@instantdb/react 1.0.2 → 1.0.3-branch-idb-fix.24363677444.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.
@@ -2,7 +2,7 @@ var Mi = Object.defineProperty;
2
2
  var Ri = (n, e, t) => e in n ? Mi(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
3
  var p = (n, e, t) => Ri(n, typeof e != "symbol" ? e + "" : e, t);
4
4
  import fs, { useRef as $e, useCallback as Me, useSyncExternalStore as qt, useEffect as We, useMemo as mn, useState as ds, createElement as ji } from "react";
5
- function se(n) {
5
+ function ee(n) {
6
6
  if (typeof n == "number")
7
7
  return (Math.abs(n * 2654435761) >>> 0).toString(16);
8
8
  if (typeof n == "boolean")
@@ -21,7 +21,7 @@ function se(n) {
21
21
  let e = 2166136261;
22
22
  for (let t = 0; t < n.length; t++) {
23
23
  e ^= (t + 1) * 2654435761;
24
- const r = se(n[t]);
24
+ const r = ee(n[t]);
25
25
  for (let s = 0; s < r.length; s++)
26
26
  e ^= r.charCodeAt(s), e *= 16777619, e = e >>> 0;
27
27
  }
@@ -34,20 +34,20 @@ function se(n) {
34
34
  const s = t[r];
35
35
  if (n[s] === void 0)
36
36
  continue;
37
- const i = se(s);
37
+ const i = ee(s);
38
38
  e ^= parseInt(i, 16), e *= 16777619, e = e >>> 0;
39
- const o = se(n[s]);
39
+ const o = ee(n[s]);
40
40
  e ^= parseInt(o, 16), e *= 16777619, e = e >>> 0;
41
41
  }
42
42
  return e.toString(16);
43
43
  }
44
- return se(String(n));
44
+ return ee(String(n));
45
45
  }
46
- const te = {
46
+ const Z = {
47
47
  Remove: "remove",
48
48
  Replace: "replace",
49
49
  Add: "add"
50
- }, hs = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), xi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Dt = Symbol.iterator, we = {
50
+ }, hs = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), xi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Dt = Symbol.iterator, me = {
51
51
  mutable: "mutable",
52
52
  immutable: "immutable"
53
53
  }, Qn = {};
@@ -71,7 +71,7 @@ function Bn(n) {
71
71
  function Gn(n) {
72
72
  return Object.getPrototypeOf(n) === Map.prototype;
73
73
  }
74
- function me(n) {
74
+ function _e(n) {
75
75
  var e;
76
76
  return (e = n.copy) !== null && e !== void 0 ? e : n.original;
77
77
  }
@@ -86,11 +86,11 @@ function Hn(n) {
86
86
  const t = D(n);
87
87
  return t ? (e = t.copy) !== null && e !== void 0 ? e : t.original : n;
88
88
  }
89
- function ke(n, e) {
89
+ function Oe(n, e) {
90
90
  if (!n || typeof n != "object")
91
91
  return !1;
92
92
  let t;
93
- return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, we)) === we.immutable || typeof t == "function");
93
+ return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, me)) === me.immutable || typeof t == "function");
94
94
  }
95
95
  function ps(n, e = []) {
96
96
  if (Object.hasOwnProperty.call(n, "key")) {
@@ -123,7 +123,7 @@ function Et(n, e, t) {
123
123
  }
124
124
  function un(n, e) {
125
125
  const t = D(n);
126
- return (t ? me(t) : n)[e];
126
+ return (t ? _e(t) : n)[e];
127
127
  }
128
128
  function Re(n, e) {
129
129
  return n === e ? n !== 0 || 1 / n === 1 / e : n !== n && e !== e;
@@ -180,8 +180,8 @@ function ys(n, e) {
180
180
  return new r(n);
181
181
  }
182
182
  return new Map(n);
183
- } else if (e != null && e.mark && (t = e.mark(n, we), t !== void 0) && t !== we.mutable) {
184
- if (t === we.immutable)
183
+ } else if (e != null && e.mark && (t = e.mark(n, me), t !== void 0) && t !== me.mutable) {
184
+ if (t === me.immutable)
185
185
  return Di(n);
186
186
  if (typeof t == "function") {
187
187
  if (e.enablePatches || e.enableAutoFreeze)
@@ -199,11 +199,11 @@ function ys(n, e) {
199
199
  } else
200
200
  throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
201
201
  }
202
- function de(n) {
202
+ function ue(n) {
203
203
  n.copy || (n.copy = ys(n.original, n.options));
204
204
  }
205
205
  function dt(n) {
206
- if (!ke(n))
206
+ if (!Oe(n))
207
207
  return Hn(n);
208
208
  if (Array.isArray(n))
209
209
  return n.map(dt);
@@ -301,14 +301,14 @@ function Jn(n, e) {
301
301
  n.forEach((r, s) => e(s, r, n));
302
302
  }
303
303
  function bs(n, e, t) {
304
- if (qe(n) || !ke(n, t) || e.has(n) || Object.isFrozen(n))
304
+ if (qe(n) || !Oe(n, t) || e.has(n) || Object.isFrozen(n))
305
305
  return;
306
306
  const r = n instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
307
307
  if (e.add(n), Jn(n, (i, o) => {
308
308
  var a;
309
309
  if (qe(o)) {
310
310
  const c = D(o);
311
- de(c);
311
+ ue(c);
312
312
  const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
313
313
  Et(r ? s : n, i, u);
314
314
  } else
@@ -347,7 +347,7 @@ function Yn(n, e, t, r) {
347
347
  let u = s.original;
348
348
  s.copy && (u = s.copy), Tn(n), Sn(n, r, i, o), n.options.enableAutoFreeze && (n.options.updatedValues = (a = n.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), n.options.updatedValues.set(u, s.original)), Et(c, e, u);
349
349
  }
350
- }), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), ke(t, n.options) && n.finalities.draft.push(() => {
350
+ }), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), Oe(t, n.options) && n.finalities.draft.push(() => {
351
351
  const i = n.type === 3 ? n.setMap : n.copy;
352
352
  Re(je(i, e), t) && Li(n, e);
353
353
  });
@@ -359,12 +359,12 @@ function Fi(n, e, t, r, s) {
359
359
  if (o.get(u.toString()) && c[u] !== i[u]) {
360
360
  const l = e.concat([u]), f = Ne(l, s);
361
361
  t.push({
362
- op: te.Replace,
362
+ op: Z.Replace,
363
363
  path: f,
364
364
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
365
365
  value: Ut(c[u])
366
366
  }), r.push({
367
- op: te.Replace,
367
+ op: Z.Replace,
368
368
  path: f,
369
369
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
370
370
  value: Ut(i[u])
@@ -373,7 +373,7 @@ function Fi(n, e, t, r, s) {
373
373
  for (let u = i.length; u < c.length; u += 1) {
374
374
  const l = e.concat([u]), f = Ne(l, s);
375
375
  t.push({
376
- op: te.Add,
376
+ op: Z.Add,
377
377
  path: f,
378
378
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
379
379
  value: Ut(c[u])
@@ -384,7 +384,7 @@ function Fi(n, e, t, r, s) {
384
384
  if (u) {
385
385
  const l = e.concat(["length"]), f = Ne(l, s);
386
386
  r.push({
387
- op: te.Replace,
387
+ op: Z.Replace,
388
388
  path: f,
389
389
  value: i.length
390
390
  });
@@ -392,7 +392,7 @@ function Fi(n, e, t, r, s) {
392
392
  for (let l = c.length; i.length < l; l -= 1) {
393
393
  const f = e.concat([l - 1]), d = Ne(f, s);
394
394
  r.push({
395
- op: te.Remove,
395
+ op: Z.Remove,
396
396
  path: d
397
397
  });
398
398
  }
@@ -400,11 +400,11 @@ function Fi(n, e, t, r, s) {
400
400
  }
401
401
  function Ni({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
402
402
  t.forEach((a, c) => {
403
- const u = je(n, c), l = Ut(je(e, c)), f = a ? mt(n, c) ? te.Replace : te.Add : te.Remove;
404
- if (Re(u, l) && f === te.Replace)
403
+ const u = je(n, c), l = Ut(je(e, c)), f = a ? mt(n, c) ? Z.Replace : Z.Add : Z.Remove;
404
+ if (Re(u, l) && f === Z.Replace)
405
405
  return;
406
406
  const d = r.concat(c), y = Ne(d, o);
407
- s.push(f === te.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === te.Add ? { op: te.Remove, path: y } : f === te.Remove ? { op: te.Add, path: y, value: u } : { op: te.Replace, path: y, value: u });
407
+ s.push(f === Z.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === Z.Add ? { op: Z.Remove, path: y } : f === Z.Remove ? { op: Z.Add, path: y, value: u } : { op: Z.Replace, path: y, value: u });
408
408
  });
409
409
  }
410
410
  function Ki({ original: n, copy: e }, t, r, s, i) {
@@ -413,11 +413,11 @@ function Ki({ original: n, copy: e }, t, r, s, i) {
413
413
  if (!e.has(a)) {
414
414
  const c = t.concat([o]), u = Ne(c, i);
415
415
  r.push({
416
- op: te.Remove,
416
+ op: Z.Remove,
417
417
  path: u,
418
418
  value: a
419
419
  }), s.unshift({
420
- op: te.Add,
420
+ op: Z.Add,
421
421
  path: u,
422
422
  value: a
423
423
  });
@@ -427,11 +427,11 @@ function Ki({ original: n, copy: e }, t, r, s, i) {
427
427
  if (!n.has(a)) {
428
428
  const c = t.concat([o]), u = Ne(c, i);
429
429
  r.push({
430
- op: te.Add,
430
+ op: Z.Add,
431
431
  path: u,
432
432
  value: a
433
433
  }), s.unshift({
434
- op: te.Remove,
434
+ op: Z.Remove,
435
435
  path: u,
436
436
  value: a
437
437
  });
@@ -452,29 +452,29 @@ function vt(n, e, t, r) {
452
452
  }
453
453
  }
454
454
  const zt = (n, e, t = !1) => {
455
- if (typeof n == "object" && n !== null && (!ke(n, e) || t))
455
+ if (typeof n == "object" && n !== null && (!Oe(n, e) || t))
456
456
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
457
457
  }, vn = {
458
458
  get size() {
459
- return me(D(this)).size;
459
+ return _e(D(this)).size;
460
460
  },
461
461
  has(n) {
462
- return me(D(this)).has(n);
462
+ return _e(D(this)).has(n);
463
463
  },
464
464
  set(n, e) {
465
- const t = D(this), r = me(t);
466
- return (!r.has(n) || !Re(r.get(n), e)) && (de(t), Ie(t), t.assignedMap.set(n, !0), t.copy.set(n, e), Yn(t, n, e, vt)), this;
465
+ const t = D(this), r = _e(t);
466
+ return (!r.has(n) || !Re(r.get(n), e)) && (ue(t), Ie(t), t.assignedMap.set(n, !0), t.copy.set(n, e), Yn(t, n, e, vt)), this;
467
467
  },
468
468
  delete(n) {
469
469
  if (!this.has(n))
470
470
  return !1;
471
471
  const e = D(this);
472
- return de(e), Ie(e), e.original.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.copy.delete(n), !0;
472
+ return ue(e), Ie(e), e.original.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.copy.delete(n), !0;
473
473
  },
474
474
  clear() {
475
475
  const n = D(this);
476
476
  if (this.size) {
477
- de(n), Ie(n), n.assignedMap = /* @__PURE__ */ new Map();
477
+ ue(n), Ie(n), n.assignedMap = /* @__PURE__ */ new Map();
478
478
  for (const [e] of n.original)
479
479
  n.assignedMap.set(e, !1);
480
480
  n.copy.clear();
@@ -482,14 +482,14 @@ const zt = (n, e, t = !1) => {
482
482
  },
483
483
  forEach(n, e) {
484
484
  const t = D(this);
485
- me(t).forEach((r, s) => {
485
+ _e(t).forEach((r, s) => {
486
486
  n.call(e, this.get(s), s, this);
487
487
  });
488
488
  },
489
489
  get(n) {
490
490
  var e, t;
491
- const r = D(this), s = me(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, we)) === we.mutable;
492
- if (r.options.strict && zt(s, r.options, i), i || r.finalized || !ke(s, r.options) || s !== r.original.get(n))
491
+ const r = D(this), s = _e(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, me)) === me.mutable;
492
+ if (r.options.strict && zt(s, r.options, i), i || r.finalized || !Oe(s, r.options) || s !== r.original.get(n))
493
493
  return s;
494
494
  const o = Qn.createDraft({
495
495
  original: s,
@@ -498,10 +498,10 @@ const zt = (n, e, t = !1) => {
498
498
  finalities: r.finalities,
499
499
  options: r.options
500
500
  });
501
- return de(r), r.copy.set(n, o), o;
501
+ return ue(r), r.copy.set(n, o), o;
502
502
  },
503
503
  keys() {
504
- return me(D(this)).keys();
504
+ return _e(D(this)).keys();
505
505
  },
506
506
  values() {
507
507
  const n = this.keys();
@@ -542,8 +542,8 @@ const zt = (n, e, t = !1) => {
542
542
  return i;
543
543
  const o = i.value;
544
544
  let a = n.setMap.get(o);
545
- const c = D(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, we)) === we.mutable;
546
- if (n.options.strict && zt(o, n.options, u), !u && !c && ke(o, n.options) && !n.finalized && n.original.has(o)) {
545
+ const c = D(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, me)) === me.mutable;
546
+ if (n.options.strict && zt(o, n.options, u), !u && !c && Oe(o, n.options) && !n.finalized && n.original.has(o)) {
547
547
  const l = Qn.createDraft({
548
548
  original: o,
549
549
  parentDraft: n,
@@ -565,19 +565,19 @@ const zt = (n, e, t = !1) => {
565
565
  const e = D(this);
566
566
  if (e.setMap.has(n))
567
567
  return !0;
568
- de(e);
568
+ ue(e);
569
569
  const t = D(n);
570
570
  return !!(t && e.setMap.has(t.original));
571
571
  },
572
572
  add(n) {
573
573
  const e = D(this);
574
- return this.has(n) || (de(e), Ie(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), Yn(e, n, n, vt)), this;
574
+ return this.has(n) || (ue(e), Ie(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), Yn(e, n, n, vt)), this;
575
575
  },
576
576
  delete(n) {
577
577
  if (!this.has(n))
578
578
  return !1;
579
579
  const e = D(this);
580
- de(e), Ie(e);
580
+ ue(e), Ie(e);
581
581
  const t = D(n);
582
582
  return t && e.setMap.has(t.original) ? (e.assignedMap.set(t.original, !1), e.setMap.delete(t.original)) : (!t && e.setMap.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.setMap.delete(n));
583
583
  },
@@ -585,14 +585,14 @@ const zt = (n, e, t = !1) => {
585
585
  if (!this.size)
586
586
  return;
587
587
  const n = D(this);
588
- de(n), Ie(n);
588
+ ue(n), Ie(n);
589
589
  for (const e of n.original)
590
590
  n.assignedMap.set(e, !1);
591
591
  n.setMap.clear();
592
592
  },
593
593
  values() {
594
594
  const n = D(this);
595
- de(n);
595
+ ue(n);
596
596
  const e = n.setMap.keys();
597
597
  return {
598
598
  [Symbol.iterator]: () => this.values(),
@@ -601,7 +601,7 @@ const zt = (n, e, t = !1) => {
601
601
  },
602
602
  entries() {
603
603
  const n = D(this);
604
- de(n);
604
+ ue(n);
605
605
  const e = n.setMap.keys();
606
606
  return {
607
607
  [Symbol.iterator]: () => this.entries(),
@@ -657,10 +657,10 @@ const qi = Reflect.ownKeys(Vt), gs = /* @__PURE__ */ new WeakSet(), _s = {
657
657
  let o;
658
658
  if (n.options.mark) {
659
659
  const u = e === "size" && (n.original instanceof Map || n.original instanceof Set) ? Reflect.get(n.original, e) : Reflect.get(n.original, e, t);
660
- if (o = n.options.mark(u, we), o === we.mutable)
660
+ if (o = n.options.mark(u, me), o === me.mutable)
661
661
  return n.options.strict && zt(u, n.options, !0), u;
662
662
  }
663
- const a = me(n);
663
+ const a = _e(n);
664
664
  if (a instanceof Map && Wi.includes(e)) {
665
665
  if (e === "size")
666
666
  return Object.getOwnPropertyDescriptor(vn, "size").get.call(n.proxy);
@@ -683,10 +683,10 @@ const qi = Reflect.ownKeys(Vt), gs = /* @__PURE__ */ new WeakSet(), _s = {
683
683
  ) : void 0;
684
684
  }
685
685
  const c = a[e];
686
- if (n.options.strict && zt(c, n.options), n.finalized || !ke(c, n.options))
686
+ if (n.options.strict && zt(c, n.options), n.finalized || !Oe(c, n.options))
687
687
  return c;
688
688
  if (c === un(n.original, e)) {
689
- if (de(n), n.copy[e] = Zn({
689
+ if (ue(n), n.copy[e] = Zn({
690
690
  original: n.original[e],
691
691
  parentDraft: n,
692
692
  key: n.type === 1 ? Number(e) : e,
@@ -694,7 +694,7 @@ const qi = Reflect.ownKeys(Vt), gs = /* @__PURE__ */ new WeakSet(), _s = {
694
694
  options: n.options
695
695
  }), typeof o == "function") {
696
696
  const u = D(n.copy[e]);
697
- return de(u), Ie(u), u.copy;
697
+ return ue(u), Ie(u), u.copy;
698
698
  }
699
699
  return n.copy[e];
700
700
  }
@@ -707,20 +707,20 @@ const qi = Reflect.ownKeys(Vt), gs = /* @__PURE__ */ new WeakSet(), _s = {
707
707
  let s;
708
708
  if (n.type === 1 && e !== "length" && !(Number.isInteger(s = Number(e)) && s >= 0 && (e === 0 || s === 0 || String(s) === String(e))))
709
709
  throw new Error("Only supports setting array indices and the 'length' property.");
710
- const i = Sr(me(n), e);
710
+ const i = Sr(_e(n), e);
711
711
  if (i != null && i.set)
712
712
  return i.set.call(n.proxy, t), !0;
713
- const o = un(me(n), e), a = D(o);
714
- return a && Re(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Re(t, o) && (t !== void 0 || mt(n.original, e)) || (de(n), Ie(n), mt(n.original, e) && Re(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, Yn(n, e, t, vt)), !0);
713
+ const o = un(_e(n), e), a = D(o);
714
+ return a && Re(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Re(t, o) && (t !== void 0 || mt(n.original, e)) || (ue(n), Ie(n), mt(n.original, e) && Re(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, Yn(n, e, t, vt)), !0);
715
715
  },
716
716
  has(n, e) {
717
- return e in me(n);
717
+ return e in _e(n);
718
718
  },
719
719
  ownKeys(n) {
720
- return Reflect.ownKeys(me(n));
720
+ return Reflect.ownKeys(_e(n));
721
721
  },
722
722
  getOwnPropertyDescriptor(n, e) {
723
- const t = me(n), r = Reflect.getOwnPropertyDescriptor(t, e);
723
+ const t = _e(n), r = Reflect.getOwnPropertyDescriptor(t, e);
724
724
  return r && {
725
725
  writable: !0,
726
726
  configurable: n.type !== 1 || e !== "length",
@@ -739,7 +739,7 @@ const qi = Reflect.ownKeys(Vt), gs = /* @__PURE__ */ new WeakSet(), _s = {
739
739
  },
740
740
  deleteProperty(n, e) {
741
741
  var t;
742
- return n.type === 1 ? _s.set.call(this, n, e, void 0, n.proxy) : (un(n.original, e) !== void 0 || e in n.original ? (de(n), Ie(n), n.assignedMap.set(e, !1)) : (n.assignedMap = (t = n.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), n.assignedMap.delete(e)), n.copy && delete n.copy[e], !0);
742
+ return n.type === 1 ? _s.set.call(this, n, e, void 0, n.proxy) : (un(n.original, e) !== void 0 || e in n.original ? (ue(n), Ie(n), n.assignedMap.set(e, !1)) : (n.assignedMap = (t = n.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), n.assignedMap.delete(e)), n.copy && delete n.copy[e], !0);
743
743
  }
744
744
  };
745
745
  function Zn(n) {
@@ -762,14 +762,14 @@ function Zn(n) {
762
762
  l.finalities.draft.push((f, d) => {
763
763
  var y, b;
764
764
  const g = D(c);
765
- let m = l.type === 3 ? l.setMap : l.copy;
766
- const S = je(m, r), _ = D(S);
765
+ let w = l.type === 3 ? l.setMap : l.copy;
766
+ const S = je(w, r), _ = D(S);
767
767
  if (_) {
768
- let w = _.original;
769
- _.operated && (w = Hn(S)), Tn(_), Sn(_, vt, f, d), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(w, _.original)), Et(m, r, w);
768
+ let m = _.original;
769
+ _.operated && (m = Hn(S)), Tn(_), Sn(_, vt, f, d), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(m, _.original)), Et(w, r, m);
770
770
  }
771
- (b = g.callbacks) === null || b === void 0 || b.forEach((w) => {
772
- w(f, d);
771
+ (b = g.callbacks) === null || b === void 0 || b.forEach((m) => {
772
+ m(f, d);
773
773
  });
774
774
  });
775
775
  } else {
@@ -790,8 +790,8 @@ function zi(n, e, t, r, s) {
790
790
  const u = c ? e[0] : o ? o.operated ? o.copy : o.original : n;
791
791
  return o && wn(o), s && Je(u, u, o == null ? void 0 : o.options.updatedValues), [
792
792
  u,
793
- t && c ? [{ op: te.Replace, path: [], value: e[0] }] : t,
794
- r && c ? [{ op: te.Replace, path: [], value: a }] : r
793
+ t && c ? [{ op: Z.Replace, path: [], value: e[0] }] : t,
794
+ r && c ? [{ op: Z.Replace, path: [], value: a }] : r
795
795
  ];
796
796
  }
797
797
  function Vi(n, e) {
@@ -803,7 +803,7 @@ function Vi(n, e) {
803
803
  };
804
804
  let s, i;
805
805
  e.enablePatches && (s = [], i = []);
806
- const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, we)) === we.mutable || !ke(n, e) ? n : Zn({
806
+ const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, me)) === me.mutable || !Oe(n, e) ? n : Zn({
807
807
  original: n,
808
808
  parentDraft: null,
809
809
  finalities: r,
@@ -835,7 +835,7 @@ function En(n) {
835
835
  function ms(n) {
836
836
  var e;
837
837
  const t = D(n);
838
- if (!ke(n, t == null ? void 0 : t.options))
838
+ if (!Oe(n, t == null ? void 0 : t.options))
839
839
  return n;
840
840
  const r = ze(n);
841
841
  if (t && !t.operated)
@@ -872,72 +872,72 @@ function Or(n) {
872
872
  const Qi = (n) => function e(t, r, s) {
873
873
  var i, o, a;
874
874
  if (typeof t == "function" && typeof r != "function")
875
- return function(v, ...U) {
876
- return e(v, (I) => t.call(this, I, ...U), r);
875
+ return function(v, ...I) {
876
+ return e(v, (x) => t.call(this, x, ...I), r);
877
877
  };
878
878
  const c = t, u = r;
879
879
  let l = s;
880
880
  if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
881
881
  throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
882
882
  l = Object.assign(Object.assign({}, n), l);
883
- const f = qe(c) ? Or(c) : c, d = Array.isArray(l.mark) ? (v, U) => {
884
- for (const I of l.mark) {
885
- if (typeof I != "function")
886
- throw new Error(`Invalid mark: ${I}, 'mark' should be a function.`);
887
- const P = I(v, U);
888
- if (P)
889
- return P;
890
- }
891
- } : l.mark, y = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, b = (o = l.strict) !== null && o !== void 0 ? o : !1, m = {
883
+ const f = qe(c) ? Or(c) : c, d = Array.isArray(l.mark) ? (v, I) => {
884
+ for (const x of l.mark) {
885
+ if (typeof x != "function")
886
+ throw new Error(`Invalid mark: ${x}, 'mark' should be a function.`);
887
+ const N = x(v, I);
888
+ if (N)
889
+ return N;
890
+ }
891
+ } : l.mark, y = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, b = (o = l.strict) !== null && o !== void 0 ? o : !1, w = {
892
892
  enableAutoFreeze: (a = l.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
893
893
  mark: d,
894
894
  strict: b,
895
895
  enablePatches: y
896
896
  };
897
- if (!ke(f, m) && typeof f == "object" && f !== null)
897
+ if (!Oe(f, w) && typeof f == "object" && f !== null)
898
898
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
899
- const [S, _] = Vi(f, m);
899
+ const [S, _] = Vi(f, w);
900
900
  if (typeof r != "function") {
901
- if (!ke(f, m))
901
+ if (!Oe(f, w))
902
902
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
903
903
  return [S, _];
904
904
  }
905
- let w;
905
+ let m;
906
906
  try {
907
- w = u(S);
907
+ m = u(S);
908
908
  } catch (v) {
909
909
  throw wn(D(S)), v;
910
910
  }
911
- const C = (v) => {
912
- const U = D(S);
911
+ const A = (v) => {
912
+ const I = D(S);
913
913
  if (!qe(v)) {
914
- if (v !== void 0 && !Re(v, S) && (U != null && U.operated))
914
+ if (v !== void 0 && !Re(v, S) && (I != null && I.operated))
915
915
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
916
- const P = v == null ? void 0 : v[xi];
917
- if (P) {
918
- const H = P[0];
919
- return m.strict && typeof v == "object" && v !== null && En({
920
- rootDraft: U,
916
+ const N = v == null ? void 0 : v[xi];
917
+ if (N) {
918
+ const Q = N[0];
919
+ return w.strict && typeof v == "object" && v !== null && En({
920
+ rootDraft: I,
921
921
  value: v,
922
922
  useRawReturn: !0
923
- }), _([H]);
923
+ }), _([Q]);
924
924
  }
925
925
  if (v !== void 0)
926
- return typeof v == "object" && v !== null && En({ rootDraft: U, value: v }), _([v]);
926
+ return typeof v == "object" && v !== null && En({ rootDraft: I, value: v }), _([v]);
927
927
  }
928
928
  if (v === S || v === void 0)
929
929
  return _([]);
930
- const I = D(v);
931
- if (m === I.options) {
932
- if (I.operated)
930
+ const x = D(v);
931
+ if (w === x.options) {
932
+ if (x.operated)
933
933
  throw new Error("Cannot return a modified child draft.");
934
934
  return _([Or(v)]);
935
935
  }
936
936
  return _([v]);
937
937
  };
938
- return w instanceof Promise ? w.then(C, (v) => {
938
+ return m instanceof Promise ? m.then(A, (v) => {
939
939
  throw wn(D(S)), v;
940
- }) : C(w);
940
+ }) : A(m);
941
941
  }, Qt = Qi();
942
942
  Object.prototype.constructor.toString();
943
943
  function ws(n, e) {
@@ -1370,7 +1370,7 @@ class Ke {
1370
1370
  for (const e of Object.values(this.attrs))
1371
1371
  if (tr(e)) {
1372
1372
  const [t, r, s] = e["forward-identity"];
1373
- be(this.blobAttrs, [r, s], e);
1373
+ pe(this.blobAttrs, [r, s], e);
1374
1374
  }
1375
1375
  return this._blobAttrs;
1376
1376
  }
@@ -1381,7 +1381,7 @@ class Ke {
1381
1381
  for (const e of Object.values(this.attrs))
1382
1382
  if (e["primary?"]) {
1383
1383
  const [t, r] = e["forward-identity"];
1384
- be(this._primaryKeys, [r], e);
1384
+ pe(this._primaryKeys, [r], e);
1385
1385
  }
1386
1386
  return this._primaryKeys;
1387
1387
  }
@@ -1391,7 +1391,7 @@ class Ke {
1391
1391
  this._forwardIdents = /* @__PURE__ */ new Map();
1392
1392
  for (const e of Object.values(this.attrs)) {
1393
1393
  const t = e["forward-identity"], [r, s, i] = t;
1394
- be(this._forwardIdents, [s, i], e);
1394
+ pe(this._forwardIdents, [s, i], e);
1395
1395
  }
1396
1396
  return this._forwardIdents;
1397
1397
  }
@@ -1403,7 +1403,7 @@ class Ke {
1403
1403
  const t = e["reverse-identity"];
1404
1404
  if (t) {
1405
1405
  const [r, s, i] = t;
1406
- be(this._revIdents, [s, i], e);
1406
+ pe(this._revIdents, [s, i], e);
1407
1407
  }
1408
1408
  }
1409
1409
  return this._revIdents;
@@ -1424,7 +1424,7 @@ function tr(n) {
1424
1424
  function ot(n, e) {
1425
1425
  return e.reduce((t, r) => t && t.get(r), n);
1426
1426
  }
1427
- function Oe(n, e) {
1427
+ function Ee(n, e) {
1428
1428
  if (e.length === 0)
1429
1429
  throw new Error("path must have at least one element");
1430
1430
  if (e.length === 1) {
@@ -1432,9 +1432,9 @@ function Oe(n, e) {
1432
1432
  return;
1433
1433
  }
1434
1434
  const [t, ...r] = e;
1435
- n.has(t) && Oe(n.get(t), r);
1435
+ n.has(t) && Ee(n.get(t), r);
1436
1436
  }
1437
- function be(n, e, t) {
1437
+ function pe(n, e, t) {
1438
1438
  let r = n;
1439
1439
  const s = e.length - 1;
1440
1440
  for (let i = 0; i < s; i++) {
@@ -1453,13 +1453,13 @@ function vs(n, e, t) {
1453
1453
  console.warn("no such attr", c, a);
1454
1454
  continue;
1455
1455
  }
1456
- l["checked-data-type"] === "date" && t && (u = Jt(u), o[2] = u), er(l) && be(i, [u, c, a], o), be(r, [a, c, u], o), be(s, [c, a, u], o);
1456
+ l["checked-data-type"] === "date" && t && (u = Jt(u), o[2] = u), er(l) && pe(i, [u, c, a], o), pe(r, [a, c, u], o), pe(s, [c, a, u], o);
1457
1457
  }
1458
1458
  return { eav: r, aev: s, vae: i };
1459
1459
  }
1460
1460
  function Es(n) {
1461
1461
  return {
1462
- triples: ge(n.eav, 3),
1462
+ triples: ye(n.eav, 3),
1463
1463
  cardinalityInference: n.cardinalityInference,
1464
1464
  useDateObjects: n.useDateObjects,
1465
1465
  version: 1
@@ -1488,7 +1488,7 @@ function Ot(n, e) {
1488
1488
  const [o, a] = e[0], c = n.aev.get(o);
1489
1489
  if (!c)
1490
1490
  return null;
1491
- t = (s = ge(c, 2).find((l) => l[2] === a)) == null ? void 0 : s[0];
1491
+ t = (s = ye(c, 2).find((l) => l[2] === a)) == null ? void 0 : s[0];
1492
1492
  } else
1493
1493
  t = e[0];
1494
1494
  if (!t)
@@ -1498,7 +1498,7 @@ function Ot(n, e) {
1498
1498
  const [o, a] = r, c = n.aev.get(o);
1499
1499
  if (!c)
1500
1500
  return null;
1501
- const l = (i = ge(c, 2).find((g) => g[2] === a)) == null ? void 0 : i[0];
1501
+ const l = (i = ye(c, 2).find((g) => g[2] === a)) == null ? void 0 : i[0];
1502
1502
  if (!l)
1503
1503
  return null;
1504
1504
  const [f, d, y, ...b] = e;
@@ -1513,7 +1513,7 @@ function As(n, e, t) {
1513
1513
  if (!r)
1514
1514
  return;
1515
1515
  const [s, i, o] = r, a = e.getAttr(i);
1516
- a && (Oe(n.eav, [s, i, o]), Oe(n.aev, [i, s, o]), er(a) && Oe(n.vae, [o, i, s]));
1516
+ a && (Ee(n.eav, [s, i, o]), Ee(n.aev, [i, s, o]), er(a) && Ee(n.vae, [o, i, s]));
1517
1517
  }
1518
1518
  let yo = 0;
1519
1519
  function Cs(n, e, t) {
@@ -1532,7 +1532,7 @@ function Is(n, e, t) {
1532
1532
  return;
1533
1533
  a["checked-data-type"] === "date" && n.useDateObjects && (o = Jt(o));
1534
1534
  const c = ot(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? Cs(n, a, r), l = [s, i, o, u];
1535
- ho(a) ? (be(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), be(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (be(n.eav, [s, i, o], l), be(n.aev, [i, s, o], l)), er(a) && be(n.vae, [o, i, s], l);
1535
+ ho(a) ? (pe(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), pe(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (pe(n.eav, [s, i, o], l), pe(n.aev, [i, s, o], l)), er(a) && pe(n.vae, [o, i, s], l);
1536
1536
  }
1537
1537
  function bo(n, e, t) {
1538
1538
  var y;
@@ -1556,7 +1556,7 @@ function bo(n, e, t) {
1556
1556
  f,
1557
1557
  Cs(n, a, u)
1558
1558
  ];
1559
- be(n.eav, [s, i], /* @__PURE__ */ new Map([[f, d]])), be(n.aev, [i, s], /* @__PURE__ */ new Map([[f, d]]));
1559
+ pe(n.eav, [s, i], /* @__PURE__ */ new Map([[f, d]])), pe(n.aev, [i, s], /* @__PURE__ */ new Map([[f, d]]));
1560
1560
  }
1561
1561
  function kn(n, e, t) {
1562
1562
  var u, l;
@@ -1567,23 +1567,23 @@ function kn(n, e, t) {
1567
1567
  if (a) {
1568
1568
  for (const f of a.keys()) {
1569
1569
  const d = e.getAttr(f);
1570
- d && d["on-delete-reverse"] === "cascade" && ge(a.get(f), 1).forEach(([y, b, g]) => {
1571
- var m;
1572
- return kn(n, e, [g, (m = d["reverse-identity"]) == null ? void 0 : m[1]]);
1570
+ d && d["on-delete-reverse"] === "cascade" && ye(a.get(f), 1).forEach(([y, b, g]) => {
1571
+ var w;
1572
+ return kn(n, e, [g, (w = d["reverse-identity"]) == null ? void 0 : w[1]]);
1573
1573
  }), // Fall back to deleting everything if we've rehydrated tx-steps from
1574
1574
  // the store that didn't set `etype` in deleteEntity
1575
1575
  (!s || // If we don't know about the attr, let's just get rid of it
1576
1576
  !d || // Make sure it matches the etype
1577
- ((u = d["forward-identity"]) == null ? void 0 : u[1]) === s) && (Oe(n.aev, [f, o]), Oe(n.eav, [o, f]));
1577
+ ((u = d["forward-identity"]) == null ? void 0 : u[1]) === s) && (Ee(n.aev, [f, o]), Ee(n.eav, [o, f]));
1578
1578
  }
1579
- a.size === 0 && Oe(n.eav, [o]);
1579
+ a.size === 0 && Ee(n.eav, [o]);
1580
1580
  }
1581
- const c = n.vae.get(o) && ge(n.vae.get(o), 2);
1581
+ const c = n.vae.get(o) && ye(n.vae.get(o), 2);
1582
1582
  c && c.forEach((f) => {
1583
- var m, S, _;
1583
+ var w, S, _;
1584
1584
  const [d, y, b] = f, g = e.getAttr(y);
1585
- (!s || !g || ((m = g["reverse-identity"]) == null ? void 0 : m[1]) === s) && (Oe(n.eav, [d, y, b]), Oe(n.aev, [y, d, b]), Oe(n.vae, [b, y, d])), g && g["on-delete"] === "cascade" && ((S = g["reverse-identity"]) == null ? void 0 : S[1]) === s && kn(n, e, [d, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
1586
- }), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && Oe(n.vae, [o]);
1585
+ (!s || !g || ((w = g["reverse-identity"]) == null ? void 0 : w[1]) === s) && (Ee(n.eav, [d, y, b]), Ee(n.aev, [y, d, b]), Ee(n.vae, [b, y, d])), g && g["on-delete"] === "cascade" && ((S = g["reverse-identity"]) == null ? void 0 : S[1]) === s && kn(n, e, [d, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
1586
+ }), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && Ee(n.vae, [o]);
1587
1587
  }
1588
1588
  function Ps(n, e, t) {
1589
1589
  const r = vs(e, t, n.useDateObjects);
@@ -1595,7 +1595,7 @@ function go(n, [e]) {
1595
1595
  n.addAttr(e);
1596
1596
  }
1597
1597
  function Ms(n) {
1598
- return ge(n.eav, 3);
1598
+ return ye(n.eav, 3);
1599
1599
  }
1600
1600
  function _o(n, e, [t]) {
1601
1601
  if (!e.getAttr(t))
@@ -1638,7 +1638,7 @@ function wo(n, e, t) {
1638
1638
  throw new Error(`unhandled transaction action: ${r}`);
1639
1639
  }
1640
1640
  }
1641
- function ge(n, e, t = []) {
1641
+ function ye(n, e, t = []) {
1642
1642
  if (!n || e === 0)
1643
1643
  return t;
1644
1644
  if (e === 1) {
@@ -1647,7 +1647,7 @@ function ge(n, e, t = []) {
1647
1647
  return t;
1648
1648
  }
1649
1649
  for (const r of n.values())
1650
- ge(r, e - 1, t);
1650
+ ye(r, e - 1, t);
1651
1651
  return t;
1652
1652
  }
1653
1653
  function Pt(n, e, t) {
@@ -1675,7 +1675,7 @@ function Pt(n, e, t) {
1675
1675
  return r;
1676
1676
  }
1677
1677
  if (t != null && t.$comparator)
1678
- return ge(e, 1).filter(t.$op);
1678
+ return ye(e, 1).filter(t.$op);
1679
1679
  const s = t.in || t.$in || [t];
1680
1680
  for (const o of s) {
1681
1681
  const a = e.get(o);
@@ -1692,11 +1692,11 @@ function So(n, [e, t, r]) {
1692
1692
  switch (To(e, t, r)) {
1693
1693
  case "e": {
1694
1694
  const a = n.eav.get(e);
1695
- return ge(a, 2);
1695
+ return ye(a, 2);
1696
1696
  }
1697
1697
  case "ea": {
1698
1698
  const a = (i = n.eav.get(e)) == null ? void 0 : i.get(t);
1699
- return ge(a, 1);
1699
+ return ye(a, 1);
1700
1700
  }
1701
1701
  case "eav": {
1702
1702
  const a = (o = n.eav.get(e)) == null ? void 0 : o.get(t);
@@ -1713,7 +1713,7 @@ function So(n, [e, t, r]) {
1713
1713
  }
1714
1714
  case "a": {
1715
1715
  const a = n.aev.get(t);
1716
- return ge(a, 2);
1716
+ return ye(a, 2);
1717
1717
  }
1718
1718
  case "av": {
1719
1719
  const a = n.aev.get(t);
@@ -1732,7 +1732,7 @@ function So(n, [e, t, r]) {
1732
1732
  return a;
1733
1733
  }
1734
1734
  default:
1735
- return ge(n.eav, 3);
1735
+ return ye(n.eav, 3);
1736
1736
  }
1737
1737
  }
1738
1738
  function vo(n, e, t) {
@@ -1741,13 +1741,13 @@ function vo(n, e, t) {
1741
1741
  if (!e)
1742
1742
  return r;
1743
1743
  for (const [i, o] of e.entries()) {
1744
- const a = (s = n.eav.get(t)) == null ? void 0 : s.get(o.id), c = ge(a, 1);
1744
+ const a = (s = n.eav.get(t)) == null ? void 0 : s.get(o.id), c = ye(a, 1);
1745
1745
  for (const u of c)
1746
1746
  r[i] = u[2];
1747
1747
  }
1748
1748
  return r;
1749
1749
  }
1750
- function ie(n, e, t) {
1750
+ function te(n, e, t) {
1751
1751
  var r;
1752
1752
  return (r = n.forwardIdents.get(e)) == null ? void 0 : r.get(t);
1753
1753
  }
@@ -1867,11 +1867,11 @@ const Uo = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a
1867
1867
  function st(n) {
1868
1868
  return typeof n == "string" && Uo.test(n);
1869
1869
  }
1870
- const ae = [];
1870
+ const ie = [];
1871
1871
  for (let n = 0; n < 256; ++n)
1872
- ae.push((n + 256).toString(16).slice(1));
1872
+ ie.push((n + 256).toString(16).slice(1));
1873
1873
  function Lo(n, e = 0) {
1874
- return (ae[n[e + 0]] + ae[n[e + 1]] + ae[n[e + 2]] + ae[n[e + 3]] + "-" + ae[n[e + 4]] + ae[n[e + 5]] + "-" + ae[n[e + 6]] + ae[n[e + 7]] + "-" + ae[n[e + 8]] + ae[n[e + 9]] + "-" + ae[n[e + 10]] + ae[n[e + 11]] + ae[n[e + 12]] + ae[n[e + 13]] + ae[n[e + 14]] + ae[n[e + 15]]).toLowerCase();
1874
+ return (ie[n[e + 0]] + ie[n[e + 1]] + ie[n[e + 2]] + ie[n[e + 3]] + "-" + ie[n[e + 4]] + ie[n[e + 5]] + "-" + ie[n[e + 6]] + ie[n[e + 7]] + "-" + ie[n[e + 8]] + ie[n[e + 9]] + "-" + ie[n[e + 10]] + ie[n[e + 11]] + ie[n[e + 12]] + ie[n[e + 13]] + ie[n[e + 14]] + ie[n[e + 15]]).toLowerCase();
1875
1875
  }
1876
1876
  let ln;
1877
1877
  const Fo = new Uint8Array(16);
@@ -1912,7 +1912,7 @@ function qo(n, e) {
1912
1912
  function zo(n, e) {
1913
1913
  return qo(Mr(n), Mr(e));
1914
1914
  }
1915
- function Z() {
1915
+ function H() {
1916
1916
  return Wo();
1917
1917
  }
1918
1918
  function Vo(n, e) {
@@ -1965,7 +1965,7 @@ function Yo(n, e, t) {
1965
1965
  return n.map((r) => r === e ? t : r);
1966
1966
  }
1967
1967
  function $s(n, e, t, r, s) {
1968
- const i = ie(e, t, s), o = Ve(e, t, s), a = i || o;
1968
+ const i = te(e, t, s), o = Ve(e, t, s), a = i || o;
1969
1969
  if (!a)
1970
1970
  throw new it(`Could not find attr for ${[t, s]}`);
1971
1971
  if (a["value-type"] !== "ref")
@@ -2054,11 +2054,11 @@ function Zo(n, e) {
2054
2054
  return e;
2055
2055
  }
2056
2056
  function Xo(n, e, t, r, s, i) {
2057
- const o = ie(e, t, s), a = Ve(e, t, s), c = o || a;
2057
+ const o = te(e, t, s), a = Ve(e, t, s), c = o || a;
2058
2058
  if (!c)
2059
2059
  throw new it(`No attr for etype = ${t} label = ${s}`);
2060
2060
  if (i != null && i.hasOwnProperty("$isNull")) {
2061
- const u = ie(e, t, "id");
2061
+ const u = te(e, t, "id");
2062
2062
  if (!u)
2063
2063
  throw new it(`No attr for etype = ${t} label = id`);
2064
2064
  return [
@@ -2164,16 +2164,16 @@ function ua(n, e, t, { etype: r, level: s, form: i }, o) {
2164
2164
  const a = Object.keys(i).filter((c) => c !== "$");
2165
2165
  return a.length ? Object.entries(o).map(function([u, l]) {
2166
2166
  return a.map(function(y) {
2167
- var g, m, S;
2168
- const b = !!(e.cardinalityInference && ((S = (m = (g = t.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : m[y]) != null && S.isSingular));
2167
+ var g, w, S;
2168
+ const b = !!(e.cardinalityInference && ((S = (w = (g = t.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : w[y]) != null && S.isSingular));
2169
2169
  try {
2170
- const [_, w, C] = ca(n, t, r, s, y, u), v = Fs(e, t, {
2170
+ const [_, m, A] = ca(n, t, r, s, y, u), v = Fs(e, t, {
2171
2171
  etype: _,
2172
- level: w,
2172
+ level: m,
2173
2173
  form: i[y],
2174
- join: C
2175
- }), U = b ? v[0] : v;
2176
- return { [y]: U };
2174
+ join: A
2175
+ }), I = b ? v[0] : v;
2176
+ return { [y]: I };
2177
2177
  } catch (_) {
2178
2178
  if (_ instanceof it)
2179
2179
  return { [y]: b ? void 0 : [] };
@@ -2218,7 +2218,7 @@ function ha(n, e) {
2218
2218
  }
2219
2219
  function pa(n, e, t) {
2220
2220
  const r = Object.keys(t)[0];
2221
- return ie(n, e, r);
2221
+ return te(n, e, r);
2222
2222
  }
2223
2223
  function ya(n, e, t, r) {
2224
2224
  if (t)
@@ -2232,32 +2232,32 @@ function ba(n, e, t) {
2232
2232
  return Eo(n, e);
2233
2233
  const r = /* @__PURE__ */ new Map();
2234
2234
  for (const o of t.fields) {
2235
- const a = ie(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
2235
+ const a = te(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
2236
2236
  c && tr(a) && r.set(c, a);
2237
2237
  }
2238
2238
  if (!r.has("id")) {
2239
- const o = ie(n, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
2239
+ const o = te(n, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
2240
2240
  a && r.set(a, o);
2241
2241
  }
2242
2242
  return r;
2243
2243
  }
2244
2244
  function ga(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
2245
- var g, m;
2245
+ var g, w;
2246
2246
  const o = (g = i == null ? void 0 : i.$) == null ? void 0 : g.order, a = Ls(i), c = _a(i);
2247
2247
  let u = $o(n, s);
2248
2248
  const l = r == null ? void 0 : r["start-cursor"], f = r == null ? void 0 : r["end-cursor"], d = ya(e, t, l, o);
2249
- if (d && ((m = d == null ? void 0 : d["forward-identity"]) == null ? void 0 : m[2]) !== "id") {
2249
+ if (d && ((w = d == null ? void 0 : d["forward-identity"]) == null ? void 0 : w[2]) !== "id") {
2250
2250
  const S = d["checked-data-type"] === "date", _ = d.id;
2251
- u = u.map(([w]) => {
2252
- var v, U, I, P, H;
2253
- let C = (H = (P = (I = (U = (v = n.eav.get(w)) == null ? void 0 : v.get(_)) == null ? void 0 : U.values()) == null ? void 0 : I.next()) == null ? void 0 : P.value) == null ? void 0 : H[2];
2254
- return S && (C = In(C)), [w, C];
2251
+ u = u.map(([m]) => {
2252
+ var v, I, x, N, Q;
2253
+ let A = (Q = (N = (x = (I = (v = n.eav.get(m)) == null ? void 0 : v.get(_)) == null ? void 0 : I.values()) == null ? void 0 : x.next()) == null ? void 0 : N.value) == null ? void 0 : Q[2];
2254
+ return S && (A = In(A)), [m, A];
2255
2255
  });
2256
2256
  }
2257
- u.sort(c === "asc" ? function(_, w) {
2258
- return Bt(_, w, d == null ? void 0 : d["checked-data-type"]);
2259
- } : function(_, w) {
2260
- return Bt(w, _, d == null ? void 0 : d["checked-data-type"]);
2257
+ u.sort(c === "asc" ? function(_, m) {
2258
+ return Bt(_, m, d == null ? void 0 : d["checked-data-type"]);
2259
+ } : function(_, m) {
2260
+ return Bt(m, _, d == null ? void 0 : d["checked-data-type"]);
2261
2261
  });
2262
2262
  let y = {};
2263
2263
  const b = ba(e, t, s);
@@ -2265,8 +2265,8 @@ function ga(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
2265
2265
  const [_] = S;
2266
2266
  if (y[_] || !a && l && d && fa(l, d, c, S) || !a && f && d && da(f, d, c, S))
2267
2267
  continue;
2268
- const w = vo(n, b, _);
2269
- w && (y[_] = w);
2268
+ const m = vo(n, b, _);
2269
+ m && (y[_] = m);
2270
2270
  }
2271
2271
  return y;
2272
2272
  }
@@ -2281,7 +2281,7 @@ function Ls(n) {
2281
2281
  return !e && !t && !r;
2282
2282
  }
2283
2283
  function ma(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
2284
- var d, y, b, g, m;
2284
+ var d, y, b, g, w;
2285
2285
  if (!Ls(s) && (!o || !o["start-cursor"]))
2286
2286
  return [];
2287
2287
  const a = ta(oa(e, t, r, (d = s.$) == null ? void 0 : d.where), i), c = aa(Yt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = ga(n, e, {
@@ -2289,7 +2289,7 @@ function ma(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
2289
2289
  pageInfo: o,
2290
2290
  form: s,
2291
2291
  dq: { where: a, find: c, fields: u }
2292
- }), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((m = s.$) == null ? void 0 : m.last);
2292
+ }), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((w = s.$) == null ? void 0 : w.last);
2293
2293
  if (f != null) {
2294
2294
  r > 0 && xs && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
2295
2295
  const S = Object.entries(l);
@@ -2431,7 +2431,7 @@ function Ca(n) {
2431
2431
  function Ia(n, e, t) {
2432
2432
  return t.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
2433
2433
  // before assuming it's a ref lookup.
2434
- !ie(n, e, t);
2434
+ !te(n, e, t);
2435
2435
  }
2436
2436
  function Mn(n) {
2437
2437
  const [e, t, ...r] = n.split(".");
@@ -2441,8 +2441,8 @@ function Mn(n) {
2441
2441
  }
2442
2442
  function Pa(n, e, t) {
2443
2443
  if (!Ia(n, e, t))
2444
- return ie(n, e, t);
2445
- const r = Mn(t), s = ie(n, e, r) || Ve(n, e, r);
2444
+ return te(n, e, t);
2445
+ const r = Mn(t), s = te(n, e, r) || Ve(n, e, r);
2446
2446
  if (s && s["value-type"] !== "ref")
2447
2447
  throw new Error(`${t} does not reference a valid link attribute.`);
2448
2448
  return s;
@@ -2450,7 +2450,7 @@ function Pa(n, e, t) {
2450
2450
  function Rn(n) {
2451
2451
  return typeof n == "string" && !Gt(n) ? null : typeof n == "string" && Gt(n) ? Pn(n) : Ca(n);
2452
2452
  }
2453
- function _e(n, e, t) {
2453
+ function be(n, e, t) {
2454
2454
  const r = Rn(t);
2455
2455
  if (r === null)
2456
2456
  return t;
@@ -2461,52 +2461,52 @@ function _e(n, e, t) {
2461
2461
  }
2462
2462
  function Ks(n, e, t, r) {
2463
2463
  var o;
2464
- const s = _e(n, e, t);
2464
+ const s = be(n, e, t);
2465
2465
  return Array.isArray(s) ? [[
2466
2466
  "add-triple",
2467
2467
  s,
2468
- (o = ie(n, e, "id")) == null ? void 0 : o.id,
2468
+ (o = te(n, e, "id")) == null ? void 0 : o.id,
2469
2469
  s
2470
2470
  ]].concat(r) : r;
2471
2471
  }
2472
2472
  function Ma({ attrsStore: n }, [e, t, r]) {
2473
2473
  const s = Object.entries(r).flatMap(([i, o]) => {
2474
- const a = Array.isArray(o) ? o : [o], c = ie(n, e, i), u = Ve(n, e, i);
2474
+ const a = Array.isArray(o) ? o : [o], c = te(n, e, i), u = Ve(n, e, i);
2475
2475
  return a.map((l) => c ? [
2476
2476
  "add-triple",
2477
- _e(n, e, t),
2477
+ be(n, e, t),
2478
2478
  c.id,
2479
2479
  // Uses `!` because if we get here, we should have created the attr if it doesn't
2480
2480
  // already exist
2481
- _e(n, c["reverse-identity"][1], l)
2481
+ be(n, c["reverse-identity"][1], l)
2482
2482
  ] : [
2483
2483
  "add-triple",
2484
2484
  // Uses `!` because if we get here, we should have created the attr if it doesn't
2485
2485
  // already exist
2486
- _e(n, u["forward-identity"][1], l),
2486
+ be(n, u["forward-identity"][1], l),
2487
2487
  u == null ? void 0 : u.id,
2488
- _e(n, e, t)
2488
+ be(n, e, t)
2489
2489
  ]);
2490
2490
  });
2491
2491
  return Ks(n, e, t, s);
2492
2492
  }
2493
2493
  function Ra({ attrsStore: n }, [e, t, r]) {
2494
2494
  const s = Object.entries(r).flatMap(([i, o]) => {
2495
- const a = Array.isArray(o) ? o : [o], c = ie(n, e, i), u = Ve(n, e, i);
2495
+ const a = Array.isArray(o) ? o : [o], c = te(n, e, i), u = Ve(n, e, i);
2496
2496
  return a.map((l) => c ? [
2497
2497
  "retract-triple",
2498
- _e(n, e, t),
2498
+ be(n, e, t),
2499
2499
  c.id,
2500
2500
  // Uses `!` because if we get here, we should have created the attr if it doesn't
2501
2501
  // already exist
2502
- _e(n, c["reverse-identity"][1], l)
2502
+ be(n, c["reverse-identity"][1], l)
2503
2503
  ] : [
2504
2504
  "retract-triple",
2505
2505
  // Uses `!` because if we get here, we should have created the attr if it doesn't
2506
2506
  // already exist
2507
- _e(n, u["forward-identity"][1], l),
2507
+ be(n, u["forward-identity"][1], l),
2508
2508
  u.id,
2509
- _e(n, e, t)
2509
+ be(n, e, t)
2510
2510
  ]);
2511
2511
  });
2512
2512
  return Ks(n, e, t, s);
@@ -2518,7 +2518,7 @@ function ja(n, e, t, r) {
2518
2518
  for (const a of n || []) {
2519
2519
  const c = a == null ? void 0 : a.aev.get(i);
2520
2520
  if (c) {
2521
- for (const [u, l, f] of ge(c, 2))
2521
+ for (const [u, l, f] of ye(c, 2))
2522
2522
  if (f === o)
2523
2523
  return !0;
2524
2524
  }
@@ -2538,16 +2538,16 @@ function Ws({ stores: n, attrsStore: e }, [t, r, s, i]) {
2538
2538
  return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : ja(n, e, t, r) ? { mode: "update" } : null;
2539
2539
  }
2540
2540
  function xa(n, e) {
2541
- const { attrsStore: t } = n, [r, s, i, o] = e, a = Xn(i), c = _e(t, r, s);
2541
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = Xn(i), c = be(t, r, s);
2542
2542
  return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
2543
- const d = ie(t, r, l);
2543
+ const d = te(t, r, l);
2544
2544
  return d["checked-data-type"] === "date" && n.useDateObjects && (f = Jt(f)), ["add-triple", c, d.id, f, { mode: "create" }];
2545
2545
  });
2546
2546
  }
2547
2547
  function $a(n, e) {
2548
- const { attrsStore: t } = n, [r, s, i, o] = e, a = Xn(i), c = _e(t, r, s), u = Ws(n, [r, c, i, o]);
2548
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = Xn(i), c = be(t, r, s), u = Ws(n, [r, c, i, o]);
2549
2549
  return [["id", c]].concat(Object.entries(a)).map(([f, d]) => {
2550
- const y = ie(t, r, f);
2550
+ const y = te(t, r, f);
2551
2551
  return y["checked-data-type"] === "date" && n.useDateObjects && (d = Jt(d)), [
2552
2552
  "add-triple",
2553
2553
  c,
@@ -2558,11 +2558,11 @@ function $a(n, e) {
2558
2558
  });
2559
2559
  }
2560
2560
  function Da({ attrsStore: n }, [e, t]) {
2561
- return [["delete-entity", _e(n, e, t), e]];
2561
+ return [["delete-entity", be(n, e, t), e]];
2562
2562
  }
2563
2563
  function Ua(n, e) {
2564
- const { attrsStore: t } = n, [r, s, i, o] = e, a = Xn(i), c = _e(t, r, s), u = Ws(n, [r, c, i, o]), l = Object.entries(a).map(([d, y]) => {
2565
- const b = ie(t, r, d);
2564
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = Xn(i), c = be(t, r, s), u = Ws(n, [r, c, i, o]), l = Object.entries(a).map(([d, y]) => {
2565
+ const b = te(t, r, d);
2566
2566
  return [
2567
2567
  "deep-merge-triple",
2568
2568
  c,
@@ -2574,13 +2574,13 @@ function Ua(n, e) {
2574
2574
  return [[
2575
2575
  "add-triple",
2576
2576
  c,
2577
- ie(t, r, "id").id,
2577
+ te(t, r, "id").id,
2578
2578
  c,
2579
2579
  ...u ? [u] : []
2580
2580
  ]].concat(l);
2581
2581
  }
2582
2582
  function La({ attrsStore: n }, [e, t, r]) {
2583
- return [["rule-params", _e(n, e, t), e, r]];
2583
+ return [["rule-params", be(n, e, t), e, r]];
2584
2584
  }
2585
2585
  function Fa(n) {
2586
2586
  const [e, t, r, s, i] = n;
@@ -2636,7 +2636,7 @@ function Wa(n, e, t) {
2636
2636
  };
2637
2637
  }
2638
2638
  function Mt(n, e, t, r) {
2639
- const s = n ? Wa(n, e, t) : null, i = Z(), a = [Z(), e, t];
2639
+ const s = n ? Wa(n, e, t) : null, i = H(), a = [H(), e, t];
2640
2640
  return {
2641
2641
  id: i,
2642
2642
  "forward-identity": a,
@@ -2658,8 +2658,8 @@ function za(n, e, t) {
2658
2658
  throw new Error(`Couldn't find the link ${e}.${t} in your schema`);
2659
2659
  const { forward: s, reverse: i } = r;
2660
2660
  return {
2661
- "forward-identity": [Z(), s.on, s.label],
2662
- "reverse-identity": [Z(), i.on, i.label],
2661
+ "forward-identity": [H(), s.on, s.label],
2662
+ "reverse-identity": [H(), i.on, i.label],
2663
2663
  cardinality: s.has === "one" ? "one" : "many",
2664
2664
  "unique?": i.has === "one",
2665
2665
  "on-delete": s.onDelete,
@@ -2667,7 +2667,7 @@ function za(n, e, t) {
2667
2667
  };
2668
2668
  }
2669
2669
  function Dr(n, e, t, r) {
2670
- const s = n ? za(n, e, t) : null, i = Z(), o = [Z(), e, t], a = [Z(), t, e];
2670
+ const s = n ? za(n, e, t) : null, i = H(), o = [H(), e, t], a = [H(), t, e];
2671
2671
  return {
2672
2672
  id: i,
2673
2673
  // @ts-ignore: ts thinks it's any[]
@@ -2719,12 +2719,12 @@ function Ya({ attrsStore: n, schema: e }, t) {
2719
2719
  var d, y;
2720
2720
  const r = /* @__PURE__ */ new Set(), s = [], i = [];
2721
2721
  function o(b, g) {
2722
- return ie(n, b, g) || s.find((m) => m["forward-identity"][1] === b && m["forward-identity"][2] === g);
2722
+ return te(n, b, g) || s.find((w) => w["forward-identity"][1] === b && w["forward-identity"][2] === g);
2723
2723
  }
2724
2724
  function a(b, g) {
2725
- return Ve(n, b, g) || s.find((m) => {
2725
+ return Ve(n, b, g) || s.find((w) => {
2726
2726
  var S, _;
2727
- return ((S = m["reverse-identity"]) == null ? void 0 : S[1]) === b && ((_ = m["reverse-identity"]) == null ? void 0 : _[2]) === g;
2727
+ return ((S = w["reverse-identity"]) == null ? void 0 : S[1]) === b && ((_ = w["reverse-identity"]) == null ? void 0 : _[2]) === g;
2728
2728
  });
2729
2729
  }
2730
2730
  function c(b) {
@@ -2739,40 +2739,40 @@ function Ya({ attrsStore: n, schema: e }, t) {
2739
2739
  !o(b, g);
2740
2740
  }
2741
2741
  function f(b, g) {
2742
- const m = o(b, g), S = a(b, g);
2743
- u(m), u(S), !m && !S && c(Dr(e, b, g, Ha));
2742
+ const w = o(b, g), S = a(b, g);
2743
+ u(w), u(S), !w && !S && c(Dr(e, b, g, Ha));
2744
2744
  }
2745
2745
  for (const b of t)
2746
- for (const { etype: g, lookupPair: m, linkLabel: S } of Ja(b)) {
2747
- const _ = m[0];
2746
+ for (const { etype: g, lookupPair: w, linkLabel: S } of Ja(b)) {
2747
+ const _ = w[0];
2748
2748
  if (S) {
2749
2749
  f(g, S);
2750
- const w = o(g, S), C = a(g, S);
2751
- u(w), u(C);
2752
- const v = ((d = w == null ? void 0 : w["reverse-identity"]) == null ? void 0 : d[1]) || ((y = C == null ? void 0 : C["forward-identity"]) == null ? void 0 : y[1]) || S;
2750
+ const m = o(g, S), A = a(g, S);
2751
+ u(m), u(A);
2752
+ const v = ((d = m == null ? void 0 : m["reverse-identity"]) == null ? void 0 : d[1]) || ((y = A == null ? void 0 : A["forward-identity"]) == null ? void 0 : y[1]) || S;
2753
2753
  if (l(v, _))
2754
2754
  f(v, Mn(_));
2755
2755
  else {
2756
- const U = o(v, _);
2757
- U || c(Mt(e, v, _, jn)), u(U);
2756
+ const I = o(v, _);
2757
+ I || c(Mt(e, v, _, jn)), u(I);
2758
2758
  }
2759
2759
  } else if (l(g, _))
2760
2760
  f(g, Mn(_));
2761
2761
  else {
2762
- const w = o(g, _);
2763
- w || c(Mt(e, g, _, jn)), u(w);
2762
+ const m = o(g, _);
2763
+ m || c(Mt(e, g, _, jn)), u(m);
2764
2764
  }
2765
2765
  }
2766
2766
  for (const b of t) {
2767
- const [g, m, S, _] = b;
2767
+ const [g, w, S, _] = b;
2768
2768
  if (Va.has(g)) {
2769
- const w = o(m, "id");
2770
- u(w), w || c(Mt(e, m, "id", { "unique?": !0 }));
2771
- for (const C of Object.keys(_)) {
2772
- const v = o(m, C);
2773
- if (u(v), Ba.has(g) && (v || c(Mt(e, m, C, C === "id" ? { "unique?": !0 } : null))), Qa.has(g)) {
2774
- const U = a(m, C);
2775
- !v && !U && c(Dr(e, m, C)), u(U);
2769
+ const m = o(w, "id");
2770
+ u(m), m || c(Mt(e, w, "id", { "unique?": !0 }));
2771
+ for (const A of Object.keys(_)) {
2772
+ const v = o(w, A);
2773
+ if (u(v), Ba.has(g) && (v || c(Mt(e, w, A, A === "id" ? { "unique?": !0 } : null))), Qa.has(g)) {
2774
+ const I = a(w, A);
2775
+ !v && !I && c(Dr(e, w, A)), u(I);
2776
2776
  }
2777
2777
  }
2778
2778
  }
@@ -3086,8 +3086,8 @@ async function sc(n, e, t) {
3086
3086
  };
3087
3087
  a[y] = S;
3088
3088
  }
3089
- const m = t.put(g, y);
3090
- s.add(m);
3089
+ const w = t.put(g, y);
3090
+ s.add(w);
3091
3091
  }
3092
3092
  const c = { objects: a }, u = t.put(c, et);
3093
3093
  s.add(u);
@@ -3111,19 +3111,19 @@ async function ic(n, e) {
3111
3111
  return;
3112
3112
  const r = await new Promise((l, f) => {
3113
3113
  const b = t.transaction(["kv"], "readonly").objectStore("kv").openCursor();
3114
- b.onerror = (m) => {
3115
- f(m);
3114
+ b.onerror = (w) => {
3115
+ f(w);
3116
3116
  };
3117
3117
  const g = [];
3118
3118
  b.onsuccess = () => {
3119
- const m = b.result;
3120
- if (m) {
3121
- const S = m.key, _ = m.value;
3122
- g.push([S, _]), m.continue();
3119
+ const w = b.result;
3120
+ if (w) {
3121
+ const S = w.key, _ = w.value;
3122
+ g.push([S, _]), w.continue();
3123
3123
  } else
3124
3124
  l(g);
3125
- }, b.onerror = (m) => {
3126
- f(m);
3125
+ }, b.onerror = (w) => {
3126
+ f(w);
3127
3127
  };
3128
3128
  }), s = e.transaction(["kv", "querySubs"], "readwrite"), i = s.objectStore("kv"), o = s.objectStore("querySubs"), a = [], c = { objects: {} };
3129
3129
  for (const [l, f] of r)
@@ -3169,7 +3169,11 @@ class qs extends Xa {
3169
3169
  r(o);
3170
3170
  }, i.onsuccess = (o) => {
3171
3171
  const c = o.target.result;
3172
- if (s) {
3172
+ if (c.onclose = () => {
3173
+ this._dbPromise = this._init();
3174
+ }, c.onversionchange = () => {
3175
+ c.close();
3176
+ }, s) {
3173
3177
  const u = ic(this._appId, c).catch((l) => {
3174
3178
  nc("Error upgrading store from version 5 to 6.")(l);
3175
3179
  });
@@ -3188,66 +3192,62 @@ class qs extends Xa {
3188
3192
  for (const i of tc)
3189
3193
  s.objectStoreNames.contains(i) || s.createObjectStore(i);
3190
3194
  }
3195
+ // Browsers can close IndexedDB connections unexpectedly (backgrounded tabs,
3196
+ // memory pressure, cross-tab version changes, etc.), causing
3197
+ // `db.transaction()` to throw InvalidStateError. This helper catches that
3198
+ // error and retries once with a fresh connection.
3199
+ async _withRetry(t) {
3200
+ try {
3201
+ const r = await this._dbPromise;
3202
+ return await t(r);
3203
+ } catch (r) {
3204
+ if (r instanceof DOMException && r.name === "InvalidStateError") {
3205
+ this._dbPromise = this._init();
3206
+ const s = await this._dbPromise;
3207
+ return await t(s);
3208
+ }
3209
+ throw r;
3210
+ }
3211
+ }
3191
3212
  async getItem(t) {
3192
- const r = await this._dbPromise;
3193
- return new Promise((s, i) => {
3213
+ return this._withRetry((r) => new Promise((s, i) => {
3194
3214
  const c = r.transaction([this._storeName], "readonly").objectStore(this._storeName).get(t);
3195
- c.onerror = (u) => {
3196
- i(u);
3197
- }, c.onsuccess = (u) => {
3215
+ c.onerror = () => {
3216
+ i(c.error);
3217
+ }, c.onsuccess = () => {
3198
3218
  c.result ? s(c.result) : s(null);
3199
3219
  };
3200
- });
3220
+ }));
3201
3221
  }
3202
3222
  async setItem(t, r) {
3203
- const s = await this._dbPromise;
3204
- return new Promise((i, o) => {
3205
- const u = s.transaction([this._storeName], "readwrite").objectStore(this._storeName).put(r, t);
3206
- u.onerror = (l) => {
3207
- o(l);
3208
- }, u.onsuccess = (l) => {
3209
- i();
3210
- };
3211
- });
3223
+ return this._withRetry((s) => new Promise((i, o) => {
3224
+ const a = s.transaction([this._storeName], "readwrite");
3225
+ a.objectStore(this._storeName).put(r, t), a.oncomplete = () => i(), a.onerror = () => o(a.error), a.onabort = () => o(a.error);
3226
+ }));
3212
3227
  }
3213
- // Performs all writes in a transaction so that all succeed or none succeed.
3214
3228
  async multiSet(t) {
3215
- const r = await this._dbPromise;
3216
- return new Promise((s, i) => {
3217
- const o = r.transaction([this._storeName], "readwrite"), a = o.objectStore(this._storeName), c = /* @__PURE__ */ new Set();
3218
- for (const [u, l] of t) {
3219
- const f = a.put(l, u);
3220
- c.add(f);
3221
- }
3222
- for (const u of c)
3223
- u.onerror = (l) => {
3224
- o.abort(), i(l);
3225
- }, u.onsuccess = (l) => {
3226
- c.delete(u), c.size === 0 && s();
3227
- };
3228
- });
3229
+ return this._withRetry((r) => new Promise((s, i) => {
3230
+ const o = r.transaction([this._storeName], "readwrite"), a = o.objectStore(this._storeName);
3231
+ for (const [c, u] of t)
3232
+ a.put(u, c);
3233
+ o.oncomplete = () => s(), o.onerror = () => i(o.error), o.onabort = () => i(o.error);
3234
+ }));
3229
3235
  }
3230
3236
  async removeItem(t) {
3231
- const r = await this._dbPromise;
3232
- return new Promise((s, i) => {
3233
- const c = r.transaction([this._storeName], "readwrite").objectStore(this._storeName).delete(t);
3234
- c.onerror = (u) => {
3235
- i(u);
3236
- }, c.onsuccess = (u) => {
3237
- s();
3238
- };
3239
- });
3237
+ return this._withRetry((r) => new Promise((s, i) => {
3238
+ const o = r.transaction([this._storeName], "readwrite");
3239
+ o.objectStore(this._storeName).delete(t), o.oncomplete = () => s(), o.onerror = () => i(o.error), o.onabort = () => i(o.error);
3240
+ }));
3240
3241
  }
3241
3242
  async getAllKeys() {
3242
- const t = await this._dbPromise;
3243
- return new Promise((r, s) => {
3243
+ return this._withRetry((t) => new Promise((r, s) => {
3244
3244
  const a = t.transaction([this._storeName], "readonly").objectStore(this._storeName).getAllKeys();
3245
- a.onerror = (c) => {
3246
- s(c);
3247
- }, a.onsuccess = (c) => {
3248
- r(a.result.filter((u) => typeof u == "string"));
3245
+ a.onerror = () => {
3246
+ s(a.error);
3247
+ }, a.onsuccess = () => {
3248
+ r(a.result.filter((c) => typeof c == "string"));
3249
3249
  };
3250
- });
3250
+ }));
3251
3251
  }
3252
3252
  }
3253
3253
  class zs {
@@ -3265,20 +3265,20 @@ class zs {
3265
3265
  };
3266
3266
  }
3267
3267
  }
3268
- class ue extends Error {
3268
+ class le extends Error {
3269
3269
  constructor(t, r, s) {
3270
3270
  super(t);
3271
3271
  p(this, "hint");
3272
3272
  p(this, "traceId");
3273
3273
  this.hint = r, s && (this.traceId = s);
3274
3274
  const i = new.target.prototype;
3275
- Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, ue), this.name = "InstantError";
3275
+ Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, le), this.name = "InstantError";
3276
3276
  }
3277
3277
  get [Symbol.toStringTag]() {
3278
3278
  return "InstantError";
3279
3279
  }
3280
3280
  }
3281
- class Zt extends ue {
3281
+ class Zt extends le {
3282
3282
  constructor(t) {
3283
3283
  var i;
3284
3284
  const r = ((i = t.body) == null ? void 0 : i.message) || `API Error (${t.status})`;
@@ -3292,19 +3292,19 @@ class Zt extends ue {
3292
3292
  return "InstantAPIError";
3293
3293
  }
3294
3294
  }
3295
- async function Ae(n, e) {
3295
+ async function ke(n, e) {
3296
3296
  const t = await fetch(n, e), r = await t.json();
3297
3297
  return t.status === 200 ? Promise.resolve(r) : Promise.reject(new Zt({ status: t.status, body: r }));
3298
3298
  }
3299
3299
  function oc({ apiURI: n, appId: e, email: t }) {
3300
- return Ae(`${n}/runtime/auth/send_magic_code`, {
3300
+ return ke(`${n}/runtime/auth/send_magic_code`, {
3301
3301
  method: "POST",
3302
3302
  headers: { "content-type": "application/json" },
3303
3303
  body: JSON.stringify({ "app-id": e, email: t })
3304
3304
  });
3305
3305
  }
3306
3306
  async function ac({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, extraFields: i }) {
3307
- return await Ae(`${n}/runtime/auth/verify_magic_code`, {
3307
+ return await ke(`${n}/runtime/auth/verify_magic_code`, {
3308
3308
  method: "POST",
3309
3309
  headers: { "content-type": "application/json" },
3310
3310
  body: JSON.stringify({
@@ -3317,7 +3317,7 @@ async function ac({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, ext
3317
3317
  });
3318
3318
  }
3319
3319
  async function cc({ apiURI: n, appId: e, refreshToken: t }) {
3320
- return await Ae(`${n}/runtime/auth/verify_refresh_token`, {
3320
+ return await ke(`${n}/runtime/auth/verify_refresh_token`, {
3321
3321
  method: "POST",
3322
3322
  headers: { "content-type": "application/json" },
3323
3323
  body: JSON.stringify({
@@ -3327,7 +3327,7 @@ async function cc({ apiURI: n, appId: e, refreshToken: t }) {
3327
3327
  });
3328
3328
  }
3329
3329
  async function uc({ apiURI: n, appId: e }) {
3330
- return await Ae(`${n}/runtime/auth/sign_in_guest`, {
3330
+ return await ke(`${n}/runtime/auth/sign_in_guest`, {
3331
3331
  method: "POST",
3332
3332
  headers: { "content-type": "application/json" },
3333
3333
  body: JSON.stringify({
@@ -3336,7 +3336,7 @@ async function uc({ apiURI: n, appId: e }) {
3336
3336
  });
3337
3337
  }
3338
3338
  async function Nr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken: s, extraFields: i }) {
3339
- return await Ae(`${n}/runtime/oauth/token`, {
3339
+ return await ke(`${n}/runtime/oauth/token`, {
3340
3340
  method: "POST",
3341
3341
  headers: { "content-type": "application/json" },
3342
3342
  body: JSON.stringify({
@@ -3349,7 +3349,7 @@ async function Nr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken:
3349
3349
  });
3350
3350
  }
3351
3351
  async function lc({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, refreshToken: i, extraFields: o }) {
3352
- return await Ae(`${n}/runtime/oauth/id_token`, {
3352
+ return await ke(`${n}/runtime/oauth/id_token`, {
3353
3353
  method: "POST",
3354
3354
  headers: { "content-type": "application/json" },
3355
3355
  body: JSON.stringify({
@@ -3363,7 +3363,7 @@ async function lc({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
3363
3363
  });
3364
3364
  }
3365
3365
  async function fc({ apiURI: n, appId: e, refreshToken: t }) {
3366
- return await Ae(`${n}/runtime/signout`, {
3366
+ return await ke(`${n}/runtime/signout`, {
3367
3367
  method: "POST",
3368
3368
  headers: {
3369
3369
  "content-type": "application/json"
@@ -3381,14 +3381,14 @@ async function dc({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, cont
3381
3381
  authorization: `Bearer ${s}`,
3382
3382
  "content-type": i || r.type
3383
3383
  };
3384
- return o && (a["content-disposition"] = o), await Ae(`${n}/storage/upload`, {
3384
+ return o && (a["content-disposition"] = o), await ke(`${n}/storage/upload`, {
3385
3385
  method: "PUT",
3386
3386
  headers: a,
3387
3387
  body: r
3388
3388
  });
3389
3389
  }
3390
3390
  async function hc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
3391
- const { data: s } = await Ae(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
3391
+ const { data: s } = await ke(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
3392
3392
  method: "DELETE",
3393
3393
  headers: {
3394
3394
  "content-type": "application/json",
@@ -3398,7 +3398,7 @@ async function hc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
3398
3398
  return s;
3399
3399
  }
3400
3400
  async function pc({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
3401
- const { data: i } = await Ae(`${n}/storage/signed-upload-url`, {
3401
+ const { data: i } = await ke(`${n}/storage/signed-upload-url`, {
3402
3402
  method: "POST",
3403
3403
  headers: {
3404
3404
  "content-type": "application/json",
@@ -3421,7 +3421,7 @@ async function yc(n, e) {
3421
3421
  })).ok;
3422
3422
  }
3423
3423
  async function bc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
3424
- const { data: s } = await Ae(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
3424
+ const { data: s } = await ke(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
3425
3425
  method: "GET",
3426
3426
  headers: {
3427
3427
  "content-type": "application/json",
@@ -3508,7 +3508,7 @@ function zr(n) {
3508
3508
  }, e;
3509
3509
  }, {});
3510
3510
  }
3511
- const ir = "v1.0.2";
3511
+ const ir = "v1.0.3-branch-idb-fix.24363677444.1";
3512
3512
  function mc(n, e) {
3513
3513
  return {
3514
3514
  info: n ? (...t) => console.info(...t, e()) : () => {
@@ -3519,7 +3519,7 @@ function mc(n, e) {
3519
3519
  }
3520
3520
  };
3521
3521
  }
3522
- class he {
3522
+ class fe {
3523
3523
  constructor(e, t, r, s = { indexed: !1, unique: !1 }) {
3524
3524
  p(this, "valueType");
3525
3525
  p(this, "required");
@@ -3534,19 +3534,19 @@ class he {
3534
3534
  * and enforced for backend
3535
3535
  */
3536
3536
  clientRequired() {
3537
- return new he(this.valueType, !1, this.isIndexed, this.config);
3537
+ return new fe(this.valueType, !1, this.isIndexed, this.config);
3538
3538
  }
3539
3539
  optional() {
3540
- return new he(this.valueType, !1, this.isIndexed, this.config);
3540
+ return new fe(this.valueType, !1, this.isIndexed, this.config);
3541
3541
  }
3542
3542
  unique() {
3543
- return new he(this.valueType, this.required, this.isIndexed, {
3543
+ return new fe(this.valueType, this.required, this.isIndexed, {
3544
3544
  ...this.config,
3545
3545
  unique: !0
3546
3546
  });
3547
3547
  }
3548
3548
  indexed() {
3549
- return new he(this.valueType, this.required, !0, {
3549
+ return new fe(this.valueType, this.required, !0, {
3550
3550
  ...this.config,
3551
3551
  indexed: !0
3552
3552
  });
@@ -3592,7 +3592,7 @@ class en {
3592
3592
  return new en(this.entities, this.links, {});
3593
3593
  }
3594
3594
  }
3595
- class B extends Error {
3595
+ class W extends Error {
3596
3596
  constructor(e, t) {
3597
3597
  const r = t ? `At path '${t}': ${e}` : e;
3598
3598
  super(r), this.name = "QueryValidationError";
@@ -3629,13 +3629,13 @@ const Vr = [
3629
3629
  }, Tc = (n, e, t, r, s, i, o) => {
3630
3630
  const a = i.valueType === "json", c = (u, l, f) => {
3631
3631
  if (!Gs(f, l, a))
3632
- throw new B(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`, o);
3632
+ throw new W(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`, o);
3633
3633
  };
3634
3634
  switch (n) {
3635
3635
  case "in":
3636
3636
  case "$in":
3637
3637
  if (!Array.isArray(e))
3638
- throw new B(`Operator '${n}' for attribute '${r}' in entity '${s}' must be an array, but received: ${typeof e}`, o);
3638
+ throw new W(`Operator '${n}' for attribute '${r}' in entity '${s}' must be an array, but received: ${typeof e}`, o);
3639
3639
  for (const u of e)
3640
3640
  c(n, t, u);
3641
3641
  break;
@@ -3650,13 +3650,13 @@ const Vr = [
3650
3650
  case "$like":
3651
3651
  case "$ilike":
3652
3652
  if (c(n, "string", e), n === "$ilike" && !i.isIndexed)
3653
- throw new B(`Operator '${n}' can only be used with indexed attributes, but '${r}' in entity '${s}' is not indexed`, o);
3653
+ throw new W(`Operator '${n}' can only be used with indexed attributes, but '${r}' in entity '${s}' is not indexed`, o);
3654
3654
  break;
3655
3655
  case "$isNull":
3656
3656
  c(n, "boolean", e);
3657
3657
  break;
3658
3658
  default:
3659
- throw new B(`Unknown operator '${n}' for attribute '${r}' in entity '${s}'`, o);
3659
+ throw new W(`Unknown operator '${n}' for attribute '${r}' in entity '${s}'`, o);
3660
3660
  }
3661
3661
  }, nt = (n, e, t, r, s) => {
3662
3662
  const i = wc(t), o = t.valueType === "json";
@@ -3667,42 +3667,42 @@ const Vr = [
3667
3667
  for (const [u, l] of Object.entries(c))
3668
3668
  Tc(u, l, i, e, r, t, `${s}.${u}`);
3669
3669
  } else if (!Gs(n, i, o))
3670
- throw new B(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof n}`, s);
3670
+ throw new W(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof n}`, s);
3671
3671
  }, Sc = (n, e, t, r, s) => {
3672
3672
  const i = n.split(".");
3673
3673
  if (i.length < 2)
3674
- throw new B(`Invalid dot notation path '${n}'. Must contain at least one dot.`, s);
3674
+ throw new W(`Invalid dot notation path '${n}'. Must contain at least one dot.`, s);
3675
3675
  let o = t;
3676
3676
  for (let l = 0; l < i.length - 1; l++) {
3677
3677
  const f = i[l], d = r.entities[o];
3678
3678
  if (!d)
3679
- throw new B(`Entity '${o}' does not exist in schema while traversing dot notation path '${n}'.`, s);
3679
+ throw new W(`Entity '${o}' does not exist in schema while traversing dot notation path '${n}'.`, s);
3680
3680
  const y = d.links[f];
3681
3681
  if (!y) {
3682
3682
  const b = Object.keys(d.links);
3683
- throw new B(`Link '${f}' does not exist on entity '${o}' in dot notation path '${n}'. Available links: ${b.length > 0 ? b.join(", ") : "none"}`, s);
3683
+ throw new W(`Link '${f}' does not exist on entity '${o}' in dot notation path '${n}'. Available links: ${b.length > 0 ? b.join(", ") : "none"}`, s);
3684
3684
  }
3685
3685
  o = y.entityName;
3686
3686
  }
3687
3687
  const a = i[i.length - 1], c = r.entities[o];
3688
3688
  if (!c)
3689
- throw new B(`Target entity '${o}' does not exist in schema for dot notation path '${n}'.`, s);
3689
+ throw new W(`Target entity '${o}' does not exist in schema for dot notation path '${n}'.`, s);
3690
3690
  if (a === "id") {
3691
3691
  if (typeof e == "string" && !st(e))
3692
- throw new B(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
3693
- nt(e, n, new he("string", !1, !0), t, s);
3692
+ throw new W(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
3693
+ nt(e, n, new fe("string", !1, !0), t, s);
3694
3694
  return;
3695
3695
  }
3696
3696
  const u = c.attrs[a];
3697
3697
  if (Object.keys(c.links).includes(a)) {
3698
3698
  if (typeof e == "string" && !st(e))
3699
- throw new B(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
3700
- nt(e, n, new he("string", !1, !0), t, s);
3699
+ throw new W(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
3700
+ nt(e, n, new fe("string", !1, !0), t, s);
3701
3701
  return;
3702
3702
  }
3703
3703
  if (!u) {
3704
3704
  const l = Object.keys(c.attrs);
3705
- throw new B(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${n}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
3705
+ throw new W(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${n}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
3706
3706
  }
3707
3707
  nt(e, n, u, t, s);
3708
3708
  }, Hs = (n, e, t, r) => {
@@ -3714,7 +3714,7 @@ const Vr = [
3714
3714
  continue;
3715
3715
  }
3716
3716
  if (s === "id") {
3717
- nt(i, "id", new he("string", !1, !0), e, `${r}.id`);
3717
+ nt(i, "id", new fe("string", !1, !0), e, `${r}.id`);
3718
3718
  continue;
3719
3719
  }
3720
3720
  if (s.includes(".")) {
@@ -3727,21 +3727,21 @@ const Vr = [
3727
3727
  const a = o.attrs[s], c = o.links[s];
3728
3728
  if (!a && !c) {
3729
3729
  const u = Object.keys(o.attrs), l = Object.keys(o.links);
3730
- throw new B(`Attribute or link '${s}' does not exist on entity '${e}'. Available attributes: ${u.length > 0 ? u.join(", ") : "none"}. Available links: ${l.length > 0 ? l.join(", ") : "none"}`, `${r}.${s}`);
3730
+ throw new W(`Attribute or link '${s}' does not exist on entity '${e}'. Available attributes: ${u.length > 0 ? u.join(", ") : "none"}. Available links: ${l.length > 0 ? l.join(", ") : "none"}`, `${r}.${s}`);
3731
3731
  }
3732
3732
  if (a)
3733
3733
  nt(i, s, a, e, `${r}.${s}`);
3734
3734
  else if (c) {
3735
3735
  if (typeof i == "string" && !st(i))
3736
- throw new B(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
3737
- const u = new he("string", !1, !0);
3736
+ throw new W(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
3737
+ const u = new fe("string", !1, !0);
3738
3738
  nt(i, s, u, e, `${r}.${s}`);
3739
3739
  }
3740
3740
  }
3741
3741
  }, vc = (n, e, t, r, s = 0) => {
3742
3742
  for (const o of Object.keys(n))
3743
3743
  if (!Vr.includes(o))
3744
- throw new B(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Vr.join(", ")}. Found: ${o}`, r);
3744
+ throw new W(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Vr.join(", ")}. Found: ${o}`, r);
3745
3745
  const i = [
3746
3746
  // 'limit', // only supported client side
3747
3747
  "offset",
@@ -3754,21 +3754,21 @@ const Vr = [
3754
3754
  ];
3755
3755
  for (const o of i)
3756
3756
  if (n[o] !== void 0 && s > 0)
3757
- throw new B(`'${o}' can only be used on top-level namespaces. It cannot be used in nested queries.`, r);
3757
+ throw new W(`'${o}' can only be used on top-level namespaces. It cannot be used in nested queries.`, r);
3758
3758
  if (n.where && t) {
3759
3759
  if (typeof n.where != "object" || n.where === null)
3760
- throw new B(`'where' clause must be an object in entity '${e}', but received: ${typeof n.where}`, r ? `${r}.where` : void 0);
3760
+ throw new W(`'where' clause must be an object in entity '${e}', but received: ${typeof n.where}`, r ? `${r}.where` : void 0);
3761
3761
  Hs(n.where, e, t, r ? `${r}.where` : "where");
3762
3762
  }
3763
3763
  }, Js = (n, e, t, r, s = 0) => {
3764
3764
  var i;
3765
3765
  if (!n || typeof n != "object")
3766
- throw new B(`Query part for entity '${e}' must be an object, but received: ${typeof n}`, r);
3766
+ throw new W(`Query part for entity '${e}' must be an object, but received: ${typeof n}`, r);
3767
3767
  for (const o of Object.keys(n))
3768
3768
  if (o !== "$") {
3769
3769
  if (t && !(o in t.entities[e].links)) {
3770
3770
  const c = Object.keys(t.entities[e].links);
3771
- throw new B(`Link '${o}' does not exist on entity '${e}'. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${o}`);
3771
+ throw new W(`Link '${o}' does not exist on entity '${e}'. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${o}`);
3772
3772
  }
3773
3773
  const a = n[o];
3774
3774
  if (typeof a == "object" && a !== null) {
@@ -3778,35 +3778,35 @@ const Vr = [
3778
3778
  } else {
3779
3779
  const a = n[o];
3780
3780
  if (typeof a != "object" || a === null)
3781
- throw new B(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
3781
+ throw new W(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
3782
3782
  vc(a, e, t, `${r}.$`, s);
3783
3783
  }
3784
3784
  }, Qr = (n, e) => {
3785
3785
  if (typeof n != "object" || n === null)
3786
- throw new B(`Query must be an object, but received: ${typeof n}${n === null ? " (null)" : ""}`);
3786
+ throw new W(`Query must be an object, but received: ${typeof n}${n === null ? " (null)" : ""}`);
3787
3787
  if (Array.isArray(n))
3788
- throw new B(`Query must be an object, but received: ${typeof n}`);
3788
+ throw new W(`Query must be an object, but received: ${typeof n}`);
3789
3789
  const t = n;
3790
3790
  for (const r of Object.keys(t)) {
3791
3791
  if (Array.isArray(n[r]))
3792
- throw new B(`Query keys must be strings, but found key of type: ${typeof r}`, r);
3792
+ throw new W(`Query keys must be strings, but found key of type: ${typeof r}`, r);
3793
3793
  if (typeof r != "string")
3794
- throw new B(`Query keys must be strings, but found key of type: ${typeof r}`, r);
3794
+ throw new W(`Query keys must be strings, but found key of type: ${typeof r}`, r);
3795
3795
  if (r !== "$$ruleParams") {
3796
3796
  if (e && !e.entities[r]) {
3797
3797
  const s = Object.keys(e.entities);
3798
- throw new B(`Entity '${r}' does not exist in schema. Available entities: ${s.length > 0 ? s.join(", ") : "none"}`, r);
3798
+ throw new W(`Entity '${r}' does not exist in schema. Available entities: ${s.length > 0 ? s.join(", ") : "none"}`, r);
3799
3799
  }
3800
3800
  Js(t[r], r, e, r, 0);
3801
3801
  }
3802
3802
  }
3803
3803
  }, Br = (n) => typeof n != "string" ? !1 : Gt(n) ? !0 : st(n);
3804
- class Se extends Error {
3804
+ class Te extends Error {
3805
3805
  constructor(e) {
3806
3806
  super(e), this.name = "TransactionValidationError";
3807
3807
  }
3808
3808
  }
3809
- const Ys = (n) => n.length > 0 ? n.join(", ") : "none", Ec = (n, e) => new Se(`Entity '${n}' does not exist in schema. Available entities: ${Ys(e)}`), fn = {
3809
+ const Ys = (n) => n.length > 0 ? n.join(", ") : "none", Ec = (n, e) => new Te(`Entity '${n}' does not exist in schema. Available entities: ${Ys(e)}`), fn = {
3810
3810
  string: (n) => typeof n == "string",
3811
3811
  number: (n) => typeof n == "number" && !isNaN(n),
3812
3812
  boolean: (n) => typeof n == "boolean",
@@ -3823,30 +3823,30 @@ const Ys = (n) => n.length > 0 ? n.join(", ") : "none", Ec = (n, e) => new Se(`E
3823
3823
  }, dn = (n, e, t) => {
3824
3824
  const r = Zs(n, t);
3825
3825
  if (typeof e != "object" || e === null)
3826
- throw new Se(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
3826
+ throw new Te(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
3827
3827
  for (const [s, i] of Object.entries(e)) {
3828
3828
  if (s === "id")
3829
3829
  continue;
3830
3830
  const o = r.attrs[s];
3831
3831
  if (o && !Oc(i, o))
3832
- throw new Se(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
3832
+ throw new Te(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
3833
3833
  }
3834
3834
  }, Gr = (n, e, t) => {
3835
3835
  const r = Zs(n, t);
3836
3836
  if (typeof e != "object" || e === null)
3837
- throw new Se(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
3837
+ throw new Te(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
3838
3838
  for (const [s, i] of Object.entries(e)) {
3839
3839
  if (!r.links[s]) {
3840
3840
  const a = Object.keys(r.links);
3841
- throw new Se(`Link '${s}' does not exist on entity '${n}'. Available links: ${Ys(a)}`);
3841
+ throw new Te(`Link '${s}' does not exist on entity '${n}'. Available links: ${Ys(a)}`);
3842
3842
  }
3843
3843
  if (i != null) {
3844
3844
  if (Array.isArray(i)) {
3845
3845
  for (const a of i)
3846
3846
  if (!Br(a))
3847
- throw new Se(`Invalid entity ID in link '${s}' for entity '${n}'. Expected a UUID or a lookup, but received: ${a}`);
3847
+ throw new Te(`Invalid entity ID in link '${s}' for entity '${n}'. Expected a UUID or a lookup, but received: ${a}`);
3848
3848
  } else if (!Br(i))
3849
- throw new Se(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
3849
+ throw new Te(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
3850
3850
  }
3851
3851
  }
3852
3852
  }, kc = {
@@ -3862,21 +3862,21 @@ const Ys = (n) => n.length > 0 ? n.join(", ") : "none", Ec = (n, e) => new Se(`E
3862
3862
  return;
3863
3863
  const [t, r, s, i] = n;
3864
3864
  if (!Array.isArray(s) && !st(s))
3865
- throw new Se(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
3865
+ throw new Te(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
3866
3866
  if (typeof r != "string")
3867
- throw new Se(`Entity name must be a string, but received: ${typeof r}`);
3867
+ throw new Te(`Entity name must be a string, but received: ${typeof r}`);
3868
3868
  const o = kc[t];
3869
3869
  o && i !== void 0 && o(r, i, e);
3870
3870
  }, Cc = (n, e) => {
3871
3871
  const t = Array.isArray(n) ? n : [n];
3872
3872
  for (const r of t) {
3873
3873
  if (!r || typeof r != "object")
3874
- throw new Se(`Transaction chunk must be an object, but received: ${typeof r}`);
3874
+ throw new Te(`Transaction chunk must be an object, but received: ${typeof r}`);
3875
3875
  if (!Array.isArray(r.__ops))
3876
- throw new Se(`Transaction chunk must have __ops array, but received: ${typeof r.__ops}`);
3876
+ throw new Te(`Transaction chunk must have __ops array, but received: ${typeof r.__ops}`);
3877
3877
  for (const s of r.__ops) {
3878
3878
  if (!Array.isArray(s))
3879
- throw new Se(`Transaction operation must be an array, but received: ${typeof s}`);
3879
+ throw new Te(`Transaction operation must be an array, but received: ${typeof s}`);
3880
3880
  Ac(s, e);
3881
3881
  }
3882
3882
  }
@@ -4051,7 +4051,7 @@ function hn(n, e, t) {
4051
4051
  }
4052
4052
  function Jr(n, e, t, r) {
4053
4053
  var o;
4054
- const s = (o = ie(t, n.table, "id")) == null ? void 0 : o.id;
4054
+ const s = (o = te(t, n.table, "id")) == null ? void 0 : o.id;
4055
4055
  if (!s)
4056
4056
  return -1;
4057
4057
  const i = ot(e.eav, [r, s, r]);
@@ -4100,7 +4100,7 @@ function xc(n, e) {
4100
4100
  var r;
4101
4101
  if (n.orderFieldType)
4102
4102
  return n.orderFieldType;
4103
- const t = n.orderField === "serverCreatedAt" ? "number" : (r = ie(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
4103
+ const t = n.orderField === "serverCreatedAt" ? "number" : (r = te(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
4104
4104
  return n.orderFieldType = t, t;
4105
4105
  }
4106
4106
  function $c(n, e, t) {
@@ -4159,7 +4159,7 @@ class Dc {
4159
4159
  this.subs.flush();
4160
4160
  }
4161
4161
  subscribe(e, t) {
4162
- const r = se(e);
4162
+ const r = ee(e);
4163
4163
  return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(t), this.initSubscription(e, r, t), (s) => {
4164
4164
  this.unsubscribe(r, t, s == null ? void 0 : s.keepSubscription);
4165
4165
  };
@@ -4175,7 +4175,7 @@ class Dc {
4175
4175
  }
4176
4176
  }
4177
4177
  sendStart(e) {
4178
- this.trySend(Z(), {
4178
+ this.trySend(H(), {
4179
4179
  op: "start-sync",
4180
4180
  q: e
4181
4181
  });
@@ -4189,7 +4189,7 @@ class Dc {
4189
4189
  });
4190
4190
  }
4191
4191
  sendRemove(e, t) {
4192
- this.trySend(Z(), {
4192
+ this.trySend(H(), {
4193
4193
  op: "remove-sync",
4194
4194
  "subscription-id": e.subscriptionId,
4195
4195
  "keep-subscription": t
@@ -4227,7 +4227,7 @@ class Dc {
4227
4227
  }
4228
4228
  }
4229
4229
  onStartSyncOk(e) {
4230
- const t = e["subscription-id"], r = e.q, s = se(r);
4230
+ const t = e["subscription-id"], r = e.q, s = ee(r);
4231
4231
  this.idToHash[t] = s, this.subs.updateInPlace((i) => {
4232
4232
  const o = i[s];
4233
4233
  if (!o)
@@ -4321,9 +4321,9 @@ class Dc {
4321
4321
  continue;
4322
4322
  i.txId = a["tx-id"];
4323
4323
  const c = [], u = {};
4324
- for (const m of a.changes) {
4325
- const S = u[m.triple[0]] ?? [];
4326
- u[m.triple[0]] = S, S.push(m);
4324
+ for (const w of a.changes) {
4325
+ const S = u[w.triple[0]] ?? [];
4326
+ u[w.triple[0]] = S, S.push(w);
4327
4327
  }
4328
4328
  const l = s.values ?? {
4329
4329
  entities: [],
@@ -4331,26 +4331,26 @@ class Dc {
4331
4331
  }, f = l.entities;
4332
4332
  s.values = l;
4333
4333
  const d = [];
4334
- e: for (const [m, S] of Object.entries(u))
4334
+ e: for (const [w, S] of Object.entries(u))
4335
4335
  for (let _ = 0; _ < f.length; _++) {
4336
- const w = f[_];
4337
- if (po(w.store, m)) {
4338
- Yr(w.store, l.attrsStore, S);
4339
- const C = hn(s, w.store, l.attrsStore), v = jc(w.store, l.attrsStore, S)[m];
4340
- C ? (d.push({
4341
- oldEntity: w.entity,
4342
- newEntity: C,
4336
+ const m = f[_];
4337
+ if (po(m.store, w)) {
4338
+ Yr(m.store, l.attrsStore, S);
4339
+ const A = hn(s, m.store, l.attrsStore), v = jc(m.store, l.attrsStore, S)[w];
4340
+ A ? (d.push({
4341
+ oldEntity: m.entity,
4342
+ newEntity: A,
4343
4343
  changedFields: v || {}
4344
- }), w.entity = C) : c.push(_), delete u[m];
4344
+ }), m.entity = A) : c.push(_), delete u[w];
4345
4345
  continue e;
4346
4346
  }
4347
4347
  }
4348
4348
  const y = [];
4349
- for (const [m, S] of Object.entries(u)) {
4349
+ for (const [w, S] of Object.entries(u)) {
4350
4350
  const _ = this.createStore([]);
4351
4351
  Yr(_, l.attrsStore, S);
4352
- const w = hn(s, _, l.attrsStore);
4353
- if (!w) {
4352
+ const m = hn(s, _, l.attrsStore);
4353
+ if (!m) {
4354
4354
  this.log.error("No entity found after applying change", {
4355
4355
  sub: s,
4356
4356
  changes: S,
@@ -4360,13 +4360,13 @@ class Dc {
4360
4360
  }
4361
4361
  f.push({
4362
4362
  store: _,
4363
- entity: w,
4364
- serverCreatedAt: Jr(s, _, l.attrsStore, w.id)
4365
- }), y.push(w);
4363
+ entity: m,
4364
+ serverCreatedAt: Jr(s, _, l.attrsStore, m.id)
4365
+ }), y.push(m);
4366
4366
  }
4367
4367
  const b = [];
4368
- for (const m of c.sort().reverse())
4369
- b.push(f[m].entity), f.splice(m, 1);
4368
+ for (const w of c.sort().reverse())
4369
+ b.push(f[w].entity), f.splice(w, 1);
4370
4370
  const g = xc(s, this.getAttrs);
4371
4371
  $c(s, g, f), this.notifyCbs(r, {
4372
4372
  type: Ue.SyncTransaction,
@@ -4392,7 +4392,7 @@ class Dc {
4392
4392
  }
4393
4393
  }
4394
4394
  onStartSyncError(e) {
4395
- const t = se(e["original-event"].q), r = {
4395
+ const t = ee(e["original-event"].q), r = {
4396
4396
  message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
4397
4397
  status: e.status,
4398
4398
  type: e.type,
@@ -4412,66 +4412,66 @@ class Dc {
4412
4412
  function Uc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStream: s }) {
4413
4413
  const i = e.clientId;
4414
4414
  let o = null, a = null, c = null;
4415
- const u = Z();
4415
+ const u = H();
4416
4416
  let l = !1, f = !1;
4417
4417
  const d = [], y = [], b = [];
4418
- let g = !1, m = 0, S = 0;
4419
- const _ = [], w = new TextEncoder();
4420
- function C() {
4418
+ let g = !1, w = 0, S = 0;
4419
+ const _ = [], m = new TextEncoder();
4420
+ function A() {
4421
4421
  f = !0;
4422
4422
  for (const O of d)
4423
4423
  O(a ?? void 0);
4424
4424
  }
4425
4425
  function v(O) {
4426
4426
  return d.push(O), f && O(a ?? void 0), () => {
4427
- const A = d.indexOf(O);
4428
- A !== -1 && d.splice(A, 1);
4427
+ const C = d.indexOf(O);
4428
+ C !== -1 && d.splice(C, 1);
4429
4429
  };
4430
4430
  }
4431
- function U(O) {
4431
+ function I(O) {
4432
4432
  return b.push(O), () => {
4433
- const A = b.indexOf(O);
4434
- A !== -1 && b.splice(A, 1);
4433
+ const C = b.indexOf(O);
4434
+ C !== -1 && b.splice(C, 1);
4435
4435
  };
4436
4436
  }
4437
4437
  e.waitUntil && e.waitUntil(new Promise((O) => {
4438
4438
  b.push(O);
4439
4439
  }));
4440
- function I() {
4440
+ function x() {
4441
4441
  for (const O of b)
4442
4442
  try {
4443
4443
  O();
4444
4444
  } catch {
4445
4445
  }
4446
4446
  }
4447
- function P(O) {
4447
+ function N(O) {
4448
4448
  return y.push(O), o && O(o), () => {
4449
- const A = y.indexOf(O);
4450
- A !== -1 && y.splice(A, 1);
4449
+ const C = y.indexOf(O);
4450
+ C !== -1 && y.splice(C, 1);
4451
4451
  };
4452
4452
  }
4453
- function H(O) {
4453
+ function Q(O) {
4454
4454
  o = O;
4455
- for (const A of y)
4456
- A(o);
4455
+ for (const C of y)
4456
+ C(o);
4457
4457
  }
4458
- function K() {
4458
+ function ge() {
4459
4459
  g = !0;
4460
4460
  }
4461
- function G(O) {
4462
- let A = m, W = 0, J = 0;
4463
- for (const { byteLen: X } of _) {
4464
- const le = A + X;
4465
- if (le > O)
4461
+ function Ae(O) {
4462
+ let C = w, L = 0, V = 0;
4463
+ for (const { byteLen: J } of _) {
4464
+ const ae = C + J;
4465
+ if (ae > O)
4466
4466
  break;
4467
- A = le, W++, J += X;
4467
+ C = ae, L++, V += J;
4468
4468
  }
4469
- W > 0 && (m += J, S -= J, _.splice(0, W));
4469
+ L > 0 && (w += V, S -= V, _.splice(0, L));
4470
4470
  }
4471
- function V(O, A) {
4472
- a = A, C(), O.error(A), I();
4471
+ function re(O, C) {
4472
+ a = C, A(), O.error(C), x();
4473
4473
  }
4474
- async function ne() {
4474
+ async function se() {
4475
4475
  const O = await t({
4476
4476
  clientId: i,
4477
4477
  reconnectToken: u,
@@ -4479,130 +4479,130 @@ function Uc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
4479
4479
  });
4480
4480
  switch (O.type) {
4481
4481
  case "ok": {
4482
- const { streamId: A, offset: W } = O;
4483
- o = A, G(W), _.length && r({
4484
- streamId: A,
4485
- chunks: _.map((J) => J.chunk),
4486
- offset: m
4482
+ const { streamId: C, offset: L } = O;
4483
+ o = C, Ae(L), _.length && r({
4484
+ streamId: C,
4485
+ chunks: _.map((V) => V.chunk),
4486
+ offset: w
4487
4487
  }), g = !1;
4488
4488
  break;
4489
4489
  }
4490
4490
  case "disconnect": {
4491
- K();
4491
+ ge();
4492
4492
  break;
4493
4493
  }
4494
4494
  case "error": {
4495
- c && V(c, O.error);
4495
+ c && re(c, O.error);
4496
4496
  break;
4497
4497
  }
4498
4498
  }
4499
4499
  }
4500
- function q() {
4501
- K(), ne();
4500
+ function B() {
4501
+ ge(), se();
4502
4502
  }
4503
- function k({ offset: O, done: A }) {
4504
- G(O), A && (l = !0, I());
4503
+ function k({ offset: O, done: C }) {
4504
+ Ae(O), C && (l = !0, x());
4505
4505
  }
4506
- function j(O) {
4507
- return l ? (V(O, new ue("Stream has been closed.")), null) : o || (V(O, new ue("Stream has not been initialized.")), null);
4506
+ function M(O) {
4507
+ return l ? (re(O, new le("Stream has been closed.")), null) : o || (re(O, new le("Stream has not been initialized.")), null);
4508
4508
  }
4509
4509
  async function R(O) {
4510
4510
  c = O;
4511
- let A = !0, W = 0;
4512
- for (; A; ) {
4513
- let J = Date.now() + Math.min(15e3, 500 * (W - 1));
4514
- A = !1;
4515
- const X = await t({
4511
+ let C = !0, L = 0;
4512
+ for (; C; ) {
4513
+ let V = Date.now() + Math.min(15e3, 500 * (L - 1));
4514
+ C = !1;
4515
+ const J = await t({
4516
4516
  clientId: e.clientId,
4517
4517
  reconnectToken: u,
4518
4518
  ruleParams: e.ruleParams
4519
4519
  });
4520
- switch (X.type) {
4520
+ switch (J.type) {
4521
4521
  case "ok": {
4522
- const { streamId: le, offset: at } = X;
4522
+ const { streamId: ae, offset: at } = J;
4523
4523
  if (at !== 0) {
4524
- const ve = new ue("Write stream is corrupted");
4525
- V(O, ve);
4524
+ const Se = new le("Write stream is corrupted");
4525
+ re(O, Se);
4526
4526
  return;
4527
4527
  }
4528
- H(le), s(le, {
4529
- onDisconnect: K,
4528
+ Q(ae), s(ae, {
4529
+ onDisconnect: ge,
4530
4530
  onFlush: k,
4531
- onConnectionReconnect: ne,
4532
- onAppendFailed: q
4531
+ onConnectionReconnect: se,
4532
+ onAppendFailed: B
4533
4533
  }), g = !1;
4534
4534
  return;
4535
4535
  }
4536
4536
  case "disconnect": {
4537
- A = !0, K(), W++, await new Promise((le) => {
4538
- setTimeout(le, Math.max(0, J - Date.now()));
4537
+ C = !0, ge(), L++, await new Promise((ae) => {
4538
+ setTimeout(ae, Math.max(0, V - Date.now()));
4539
4539
  });
4540
4540
  break;
4541
4541
  }
4542
4542
  case "error": {
4543
- V(O, X.error);
4543
+ re(O, J.error);
4544
4544
  return;
4545
4545
  }
4546
4546
  }
4547
4547
  }
4548
4548
  }
4549
- class F extends n {
4550
- constructor(A, W) {
4551
- super(A, W);
4549
+ class q extends n {
4550
+ constructor(C, L) {
4551
+ super(C, L);
4552
4552
  }
4553
4553
  async streamId() {
4554
- return o || new Promise((A, W) => {
4555
- const J = [], X = () => {
4556
- for (const ve of J)
4557
- ve();
4558
- }, le = (ve) => {
4559
- A(ve), X();
4560
- }, at = (ve) => {
4561
- W(ve || new ue("Stream is closed.")), X();
4554
+ return o || new Promise((C, L) => {
4555
+ const V = [], J = () => {
4556
+ for (const Se of V)
4557
+ Se();
4558
+ }, ae = (Se) => {
4559
+ C(Se), J();
4560
+ }, at = (Se) => {
4561
+ L(Se || new le("Stream is closed.")), J();
4562
4562
  };
4563
- J.push(P(le)), J.push(v(at));
4563
+ V.push(N(ae)), V.push(v(at));
4564
4564
  });
4565
4565
  }
4566
4566
  }
4567
4567
  return {
4568
- stream: new F({
4568
+ stream: new q({
4569
4569
  // TODO(dww): accept a storage so that write streams can survive across
4570
4570
  // browser restarts
4571
4571
  async start(O) {
4572
4572
  try {
4573
4573
  await R(O);
4574
- } catch (A) {
4575
- V(O, A);
4574
+ } catch (C) {
4575
+ re(O, C);
4576
4576
  }
4577
4577
  },
4578
- write(O, A) {
4579
- const W = j(A);
4580
- if (W) {
4581
- const J = w.encode(O).length;
4582
- _.push({ chunk: O, byteLen: J });
4583
- const X = m + S;
4584
- S += J, g || r({ streamId: W, chunks: [O], offset: X });
4578
+ write(O, C) {
4579
+ const L = M(C);
4580
+ if (L) {
4581
+ const V = m.encode(O).length;
4582
+ _.push({ chunk: O, byteLen: V });
4583
+ const J = w + S;
4584
+ S += V, g || r({ streamId: L, chunks: [O], offset: J });
4585
4585
  }
4586
4586
  },
4587
4587
  close() {
4588
4588
  o ? r({
4589
4589
  streamId: o,
4590
4590
  chunks: [],
4591
- offset: m + S,
4591
+ offset: w + S,
4592
4592
  isDone: !0
4593
- }) : I(), C();
4593
+ }) : x(), A();
4594
4594
  },
4595
4595
  abort(O) {
4596
4596
  o ? r({
4597
4597
  streamId: o,
4598
4598
  chunks: [],
4599
- offset: m + S,
4599
+ offset: w + S,
4600
4600
  isDone: !0,
4601
4601
  abortReason: O
4602
- }) : I(), C();
4602
+ }) : x(), A();
4603
4603
  }
4604
4604
  }),
4605
- addCompleteCb: U,
4605
+ addCompleteCb: I,
4606
4606
  closed() {
4607
4607
  return f;
4608
4608
  }
@@ -4646,155 +4646,123 @@ function Fc({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
4646
4646
  let s = e.byteOffset || 0, i = !1;
4647
4647
  const o = new TextDecoder("utf-8"), a = new TextEncoder();
4648
4648
  let c, u = !1;
4649
- const l = [], f = [];
4650
- let d = null, y = null;
4651
- function b(I) {
4649
+ const l = [];
4650
+ function f() {
4652
4651
  u = !0;
4653
- for (const P of l)
4654
- P(I);
4655
- }
4656
- function g(I) {
4657
- return l.push(I), () => {
4658
- const P = l.indexOf(I);
4659
- P !== -1 && l.splice(P, 1);
4660
- };
4652
+ for (const _ of l)
4653
+ _();
4661
4654
  }
4662
- function m(I) {
4663
- return f.push(I), d && I(d), () => {
4664
- const P = f.indexOf(I);
4665
- P !== -1 && f.splice(P, 1);
4655
+ function d(_) {
4656
+ return l.push(_), () => {
4657
+ const m = l.indexOf(_);
4658
+ m !== -1 && l.splice(m, 1);
4666
4659
  };
4667
4660
  }
4668
- function S(I, P) {
4669
- y = P, I.error(P), b(P);
4661
+ function y(_, m) {
4662
+ _.error(m), f();
4670
4663
  }
4671
- let _ = 0;
4672
- async function w(I, P) {
4673
- c = Z();
4674
- const H = { ...I || {}, eventId: c };
4675
- for await (const K of t(H)) {
4664
+ let b = 0;
4665
+ async function g(_, m) {
4666
+ c = H();
4667
+ const A = { ..._ || {}, eventId: c };
4668
+ for await (const v of t(A)) {
4676
4669
  if (i)
4677
4670
  return;
4678
- if (K.type === "reconnect")
4671
+ if (v.type === "reconnect")
4679
4672
  return { retry: !0 };
4680
- if (K.type === "error") {
4681
- S(P, K.error);
4673
+ if (v.type === "error") {
4674
+ y(m, v.error);
4682
4675
  return;
4683
4676
  }
4684
- if (K.offset > s) {
4685
- S(P, new ue("Stream is corrupted.")), i = !0;
4677
+ if (v.offset > s) {
4678
+ y(m, new le("Stream is corrupted.")), i = !0;
4686
4679
  return;
4687
4680
  }
4688
- d = K.streamId;
4689
- for (const V of f)
4690
- V(d);
4691
- let G = s - K.offset;
4692
- if (K.files && K.files.length) {
4693
- const V = new AbortController();
4694
- let ne = fetch(K.files[0].url, {
4695
- signal: V.signal
4681
+ let I = s - v.offset;
4682
+ if (v.files && v.files.length) {
4683
+ const x = new AbortController();
4684
+ let N = fetch(v.files[0].url, {
4685
+ signal: x.signal
4696
4686
  });
4697
- for (let q = 0; q < K.files.length; q++) {
4698
- const k = K.files[q + 1], R = await ne;
4699
- if (k && (ne = fetch(k.url, { signal: V.signal })), !R.ok) {
4700
- if (_++, _ > 10) {
4701
- S(P, new ue("Unable to process stream."));
4687
+ for (let Q = 0; Q < v.files.length; Q++) {
4688
+ const ge = v.files[Q + 1], re = await N;
4689
+ if (ge && (N = fetch(ge.url, { signal: x.signal })), !re.ok) {
4690
+ if (b++, b > 10) {
4691
+ y(m, new le("Unable to process stream."));
4702
4692
  return;
4703
4693
  }
4704
4694
  return { retry: !0 };
4705
4695
  }
4706
- if (R.body) {
4707
- const F = R.body.getReader();
4696
+ if (re.body) {
4697
+ const se = re.body.getReader();
4708
4698
  try {
4709
4699
  for (; ; ) {
4710
- const { done: N, value: O } = await F.read();
4711
- if (N)
4700
+ const { done: B, value: k } = await se.read();
4701
+ if (B)
4712
4702
  break;
4713
4703
  if (i) {
4714
- V.abort();
4704
+ x.abort();
4715
4705
  return;
4716
4706
  }
4717
- let A = O;
4718
- if (G > 0 && (A = O.subarray(G), G -= O.length - A.length), !A.length)
4707
+ let M = k;
4708
+ if (I > 0 && (M = k.subarray(I), I -= k.length - M.length), !M.length)
4719
4709
  continue;
4720
- s += A.length;
4721
- const W = o.decode(A);
4722
- P.enqueue(W);
4710
+ s += M.length;
4711
+ const R = o.decode(M);
4712
+ m.enqueue(R);
4723
4713
  }
4724
4714
  } finally {
4725
- F.releaseLock();
4715
+ se.releaseLock();
4726
4716
  }
4727
4717
  } else {
4728
- const F = await R.arrayBuffer();
4729
- let N = F;
4718
+ const se = await re.arrayBuffer();
4719
+ let B = se;
4730
4720
  if (i) {
4731
- V.abort();
4721
+ x.abort();
4732
4722
  return;
4733
4723
  }
4734
- if (G > 0 && (N = new Uint8Array(F).subarray(G), G -= F.byteLength - N.length), !N.byteLength)
4724
+ if (I > 0 && (B = new Uint8Array(se).subarray(I), I -= se.byteLength - B.length), !B.byteLength)
4735
4725
  continue;
4736
- s += N.byteLength;
4737
- const O = o.decode(N);
4738
- P.enqueue(O);
4726
+ s += B.byteLength;
4727
+ const k = o.decode(B);
4728
+ m.enqueue(k);
4739
4729
  }
4740
4730
  }
4741
4731
  }
4742
- if (_ = 0, K.content) {
4743
- let V = K.content, ne = a.encode(K.content);
4744
- if (G > 0) {
4745
- const q = ne.subarray(G);
4746
- if (G -= ne.length - q.length, !q.length)
4732
+ if (b = 0, v.content) {
4733
+ let x = v.content, N = a.encode(v.content);
4734
+ if (I > 0) {
4735
+ const Q = N.subarray(I);
4736
+ if (I -= N.length - Q.length, !Q.length)
4747
4737
  continue;
4748
- ne = q, V = o.decode(q);
4738
+ N = Q, x = o.decode(Q);
4749
4739
  }
4750
- s += ne.length, P.enqueue(V);
4740
+ s += N.length, m.enqueue(x);
4751
4741
  }
4752
4742
  }
4753
4743
  }
4754
- async function C(I) {
4755
- let P = !0, H = 0;
4756
- for (; P; ) {
4757
- P = !1;
4758
- let K = Date.now() + Math.min(15e3, 500 * (H - 1));
4759
- const G = await w({ ...e, offset: s }, I);
4760
- G != null && G.retry && (P = !0, H++, K < Date.now() - 3e5 && (H = 0), await new Promise((V) => {
4761
- setTimeout(V, Math.max(0, K - Date.now()));
4744
+ async function w(_) {
4745
+ let m = !0, A = 0;
4746
+ for (; m; ) {
4747
+ m = !1;
4748
+ let v = Date.now() + Math.min(15e3, 500 * (A - 1));
4749
+ const I = await g({ ...e, offset: s }, _);
4750
+ I != null && I.retry && (m = !0, A++, v < Date.now() - 3e5 && (A = 0), await new Promise((x) => {
4751
+ setTimeout(x, Math.max(0, v - Date.now()));
4762
4752
  }));
4763
4753
  }
4764
- !i && !u && (I.close(), b());
4765
- }
4766
- class v extends n {
4767
- constructor(P, H) {
4768
- super(P, H);
4769
- }
4770
- async streamId() {
4771
- if (d)
4772
- return d;
4773
- if (y)
4774
- throw y;
4775
- return new Promise((P, H) => {
4776
- const K = [], G = () => {
4777
- for (const q of K)
4778
- q();
4779
- }, V = (q) => {
4780
- P(q), G();
4781
- }, ne = (q) => {
4782
- H(q || new ue("Stream is closed.")), G();
4783
- };
4784
- K.push(m(V)), K.push(g(ne));
4785
- });
4786
- }
4754
+ !i && !u && (_.close(), f());
4787
4755
  }
4788
4756
  return {
4789
- stream: new v({
4790
- start(I) {
4791
- C(I);
4757
+ stream: new n({
4758
+ start(_) {
4759
+ w(_);
4792
4760
  },
4793
- cancel(I) {
4794
- i = !0, c && r({ eventId: c }), b();
4761
+ cancel(_) {
4762
+ i = !0, c && r({ eventId: c }), f();
4795
4763
  }
4796
4764
  }),
4797
- addCloseCb: g,
4765
+ addCloseCb: d,
4798
4766
  closed() {
4799
4767
  return u;
4800
4768
  }
@@ -4836,7 +4804,7 @@ class Nc {
4836
4804
  }), t;
4837
4805
  }
4838
4806
  startWriteStream(e) {
4839
- const t = Z();
4807
+ const t = H();
4840
4808
  let r = null;
4841
4809
  const s = new Promise((o) => {
4842
4810
  r = o;
@@ -4860,7 +4828,7 @@ class Nc {
4860
4828
  offset: s,
4861
4829
  done: !!r
4862
4830
  };
4863
- i && (o["abort-reason"] = i), this.trySend(Z(), o);
4831
+ i && (o["abort-reason"] = i), this.trySend(H(), o);
4864
4832
  }
4865
4833
  onAppendFailed(e) {
4866
4834
  const t = this.writeStreams[e["stream-id"]];
@@ -4895,9 +4863,10 @@ class Nc {
4895
4863
  op: "unsubscribe-stream",
4896
4864
  "subscribe-event-id": e
4897
4865
  };
4898
- this.trySend(Z(), t), delete this.readStreamIterators[e];
4866
+ this.trySend(H(), t), delete this.readStreamIterators[e];
4899
4867
  }
4900
4868
  onStreamAppend(e) {
4869
+ var s;
4901
4870
  const t = e["client-event-id"], r = this.readStreamIterators[t];
4902
4871
  if (!r) {
4903
4872
  this.log.info("No iterator for read stream", e);
@@ -4906,16 +4875,15 @@ class Nc {
4906
4875
  if (e.error) {
4907
4876
  e.retry ? r.push({ type: "reconnect" }) : r.push({
4908
4877
  type: "error",
4909
- error: new ue(e.error)
4878
+ error: new le(e.error)
4910
4879
  }), r.close(), delete this.readStreamIterators[t];
4911
4880
  return;
4912
4881
  }
4913
- r.push({
4882
+ ((s = e.files) != null && s.length || e.content) && r.push({
4914
4883
  type: "append",
4915
4884
  offset: e.offset,
4916
4885
  files: e.files,
4917
- content: e.content,
4918
- streamId: e["stream-id"]
4886
+ content: e.content
4919
4887
  }), e.done && (r.close(), delete this.readStreamIterators[t]);
4920
4888
  }
4921
4889
  onConnectionStatusChange(e) {
@@ -4944,7 +4912,7 @@ class Nc {
4944
4912
  const r = e["client-event-id"], s = this.startWriteStreamCbs[r];
4945
4913
  s && (s({
4946
4914
  type: "error",
4947
- error: new ue(e.message || "Unknown error", e.hint)
4915
+ error: new le(e.message || "Unknown error", e.hint)
4948
4916
  }), delete this.startWriteStreamCbs[r]);
4949
4917
  break;
4950
4918
  }
@@ -4952,7 +4920,7 @@ class Nc {
4952
4920
  const r = e["client-event-id"], s = this.readStreamIterators[r];
4953
4921
  s && (s.push({
4954
4922
  type: "error",
4955
- error: new ue(e.message || "Unknown error", e.hint)
4923
+ error: new le(e.message || "Unknown error", e.hint)
4956
4924
  }), s.close(), delete this.readStreamIterators[r]);
4957
4925
  break;
4958
4926
  }
@@ -5127,7 +5095,7 @@ class Xc {
5127
5095
  // Queries
5128
5096
  p(this, "getPreviousResult", (e) => {
5129
5097
  var r;
5130
- const t = se(e);
5098
+ const t = ee(e);
5131
5099
  return (r = this.dataForQuery(t)) == null ? void 0 : r.data;
5132
5100
  });
5133
5101
  /** Re-run instaql and call all callbacks with new data */
@@ -5170,7 +5138,7 @@ class Xc {
5170
5138
  * @returns
5171
5139
  */
5172
5140
  p(this, "pushOps", (e, t) => {
5173
- const r = Z(), s = [...this._pendingMutations().values()], i = Math.max(0, ...s.map((c) => c.order || 0)) + 1, o = {
5141
+ const r = H(), s = [...this._pendingMutations().values()], i = Math.max(0, ...s.map((c) => c.order || 0)) + 1, o = {
5174
5142
  op: "transact",
5175
5143
  "tx-steps": e,
5176
5144
  created: Date.now(),
@@ -5191,7 +5159,7 @@ class Xc {
5191
5159
  }
5192
5160
  this._log.info("[socket][open]", this._transport.id), this._setStatus(Ce.OPENED), this.getCurrentUser().then((r) => {
5193
5161
  var s;
5194
- this._trySend(Z(), {
5162
+ this._trySend(H(), {
5195
5163
  op: "init",
5196
5164
  "app-id": this.config.appId,
5197
5165
  "refresh-token": (s = r.user) == null ? void 0 : s.refresh_token,
@@ -5381,7 +5349,7 @@ class Xc {
5381
5349
  status: o ?? 0
5382
5350
  }));
5383
5351
  } else
5384
- s.reject(new ue((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint));
5352
+ s.reject(new le((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint));
5385
5353
  }
5386
5354
  _setStatus(e, t) {
5387
5355
  this.status = e, this._errorMessage = t, this.notifyConnectionStatusSubs(e), this._instantStream.onConnectionStatusChange(e);
@@ -5405,7 +5373,7 @@ class Xc {
5405
5373
  _addQueryData(e, t, r) {
5406
5374
  if (!this.attrs)
5407
5375
  throw new Error("Attrs in reactor have not been set");
5408
- const s = se(e), i = this.ensureAttrs(), o = pt(this.attrs, t.triples, r, this.config.useDateObjects);
5376
+ const s = ee(e), i = this.ensureAttrs(), o = pt(this.attrs, t.triples, r, this.config.useDateObjects);
5409
5377
  this.querySubs.updateInPlace((a) => {
5410
5378
  a[s] = {
5411
5379
  result: {
@@ -5432,23 +5400,23 @@ class Xc {
5432
5400
  break;
5433
5401
  }
5434
5402
  case "add-query-exists": {
5435
- this.notifyOneQueryOnce(se(t.q));
5403
+ this.notifyOneQueryOnce(ee(t.q));
5436
5404
  break;
5437
5405
  }
5438
5406
  case "add-query-ok": {
5439
- const { q: y, result: b } = t, g = se(y);
5407
+ const { q: y, result: b } = t, g = ee(y);
5440
5408
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[g])
5441
5409
  break;
5442
- const m = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, _ = qr(b), w = this.ensureAttrs(), C = pt(w, _, r, this.config.useDateObjects);
5410
+ const w = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, _ = qr(b), m = this.ensureAttrs(), A = pt(m, _, r, this.config.useDateObjects);
5443
5411
  this.querySubs.updateInPlace((v) => {
5444
5412
  if (!v[g]) {
5445
5413
  this._log.info("Missing value in querySubs", { hash: g, q: y });
5446
5414
  return;
5447
5415
  }
5448
5416
  v[g].result = {
5449
- store: C,
5450
- attrsStore: w,
5451
- pageInfo: m,
5417
+ store: A,
5418
+ attrsStore: m,
5419
+ pageInfo: w,
5452
5420
  aggregate: S,
5453
5421
  processedTxId: t["processed-tx-id"]
5454
5422
  };
@@ -5490,46 +5458,46 @@ class Xc {
5490
5458
  case "refresh-ok": {
5491
5459
  const { computations: y, attrs: b } = t, g = t["processed-tx-id"];
5492
5460
  b && this._setAttrs(b), this._cleanupPendingMutationsTimeout();
5493
- const m = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), g);
5494
- m !== this._pendingMutations() && this.kv.updateInPlace((w) => {
5495
- w.pendingMutations = m;
5461
+ const w = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), g);
5462
+ w !== this._pendingMutations() && this.kv.updateInPlace((m) => {
5463
+ m.pendingMutations = w;
5496
5464
  });
5497
- const S = bn(m.entries()), _ = y.map((w) => {
5498
- var q, k, j, R;
5499
- const C = w["instaql-query"], v = w["instaql-result"], U = se(C), I = qr(v), P = this.ensureAttrs(), H = pt(P, I, r, this.config.useDateObjects), { store: K, attrsStore: G } = this._applyOptimisticUpdates(H, P, S, g), V = (k = (q = v == null ? void 0 : v[0]) == null ? void 0 : q.data) == null ? void 0 : k["page-info"], ne = (R = (j = v == null ? void 0 : v[0]) == null ? void 0 : j.data) == null ? void 0 : R.aggregate;
5465
+ const S = bn(w.entries()), _ = y.map((m) => {
5466
+ var B, k, M, R;
5467
+ const A = m["instaql-query"], v = m["instaql-result"], I = ee(A), x = qr(v), N = this.ensureAttrs(), Q = pt(N, x, r, this.config.useDateObjects), { store: ge, attrsStore: Ae } = this._applyOptimisticUpdates(Q, N, S, g), re = (k = (B = v == null ? void 0 : v[0]) == null ? void 0 : B.data) == null ? void 0 : k["page-info"], se = (R = (M = v == null ? void 0 : v[0]) == null ? void 0 : M.data) == null ? void 0 : R.aggregate;
5500
5468
  return {
5501
- q: C,
5502
- hash: U,
5503
- store: K,
5504
- attrsStore: G,
5505
- pageInfo: V,
5506
- aggregate: ne
5469
+ q: A,
5470
+ hash: I,
5471
+ store: ge,
5472
+ attrsStore: Ae,
5473
+ pageInfo: re,
5474
+ aggregate: se
5507
5475
  };
5508
5476
  });
5509
- _.forEach(({ hash: w, q: C, store: v, attrsStore: U, pageInfo: I, aggregate: P }) => {
5510
- this.querySubs.updateInPlace((H) => {
5511
- if (!H[w]) {
5512
- this._log.error("Missing value in querySubs", { hash: w, q: C });
5477
+ _.forEach(({ hash: m, q: A, store: v, attrsStore: I, pageInfo: x, aggregate: N }) => {
5478
+ this.querySubs.updateInPlace((Q) => {
5479
+ if (!Q[m]) {
5480
+ this._log.error("Missing value in querySubs", { hash: m, q: A });
5513
5481
  return;
5514
5482
  }
5515
- H[w].result = {
5483
+ Q[m].result = {
5516
5484
  store: v,
5517
- attrsStore: U,
5518
- pageInfo: I,
5519
- aggregate: P,
5485
+ attrsStore: I,
5486
+ pageInfo: x,
5487
+ aggregate: N,
5520
5488
  processedTxId: g
5521
5489
  };
5522
5490
  });
5523
- }), this._cleanupPendingMutationsQueries(), _.forEach(({ hash: w }) => {
5524
- this.notifyOne(w);
5491
+ }), this._cleanupPendingMutationsQueries(), _.forEach(({ hash: m }) => {
5492
+ this.notifyOne(m);
5525
5493
  });
5526
5494
  break;
5527
5495
  }
5528
5496
  case "transact-ok": {
5529
5497
  const { "client-event-id": y, "tx-id": b } = t;
5530
5498
  this._inFlightMutationEventIds.delete(y);
5531
- const m = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations()).get(y);
5532
- if (!m)
5499
+ const w = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations()).get(y);
5500
+ if (!w)
5533
5501
  break;
5534
5502
  this._updatePendingMutations((_) => {
5535
5503
  _.set(y, {
@@ -5539,10 +5507,10 @@ class Xc {
5539
5507
  });
5540
5508
  });
5541
5509
  const S = [];
5542
- for (const _ of m["tx-steps"])
5510
+ for (const _ of w["tx-steps"])
5543
5511
  if (_[0] === "add-attr") {
5544
- const w = _[1];
5545
- S.push(w);
5512
+ const m = _[1];
5513
+ S.push(m);
5546
5514
  }
5547
5515
  if (S.length) {
5548
5516
  const _ = Object.values(this.ensureAttrs().attrs);
@@ -5636,8 +5604,8 @@ class Xc {
5636
5604
  return;
5637
5605
  }
5638
5606
  if ((a = e["original-event"]) != null && a.hasOwnProperty("q") && ((c = e["original-event"]) == null ? void 0 : c.op) === "add-query") {
5639
- const y = (u = e["original-event"]) == null ? void 0 : u.q, b = se(y);
5640
- this.notifyQueryError(se(y), s), this.notifyQueryOnceError(y, b, t, s);
5607
+ const y = (u = e["original-event"]) == null ? void 0 : u.q, b = ee(y);
5608
+ this.notifyQueryError(ee(y), s), this.notifyQueryOnceError(y, b, t, s);
5641
5609
  return;
5642
5610
  }
5643
5611
  if (((l = e["original-event"]) == null ? void 0 : l.op) === "init") {
@@ -5678,7 +5646,7 @@ class Xc {
5678
5646
  this.attrs = new Ke(e.reduce((t, r) => (t[r.id] = r, t), {}), this._linkIndex), this.notifyAttrsSubs();
5679
5647
  }
5680
5648
  _startQuerySub(e, t) {
5681
- const r = Z();
5649
+ const r = H();
5682
5650
  return this.querySubs.updateInPlace((s) => {
5683
5651
  s[t] = s[t] || { q: e, result: null, eventId: r }, s[t].lastAccessed = Date.now();
5684
5652
  }), this._trySendAuthed(r, { op: "add-query", q: e }), r;
@@ -5698,7 +5666,7 @@ class Xc {
5698
5666
  */
5699
5667
  subscribeQuery(e, t, r) {
5700
5668
  this.config.disableValidation || Qr(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
5701
- const s = se(e), i = this.getPreviousResult(e);
5669
+ const s = ee(e), i = this.getPreviousResult(e);
5702
5670
  return i && t(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: t }), this._startQuerySub(e, s), () => {
5703
5671
  this._unsubQuery(e, s, t);
5704
5672
  };
@@ -5710,7 +5678,7 @@ class Xc {
5710
5678
  return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
5711
5679
  if (!this.querySubs)
5712
5680
  return r.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), r.promise;
5713
- const s = se(e), i = this._startQuerySub(e, s);
5681
+ const s = ee(e), i = this._startQuerySub(e, s);
5714
5682
  return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")), Kc), r.promise;
5715
5683
  }
5716
5684
  _completeQueryOnce(e, t, r) {
@@ -5724,7 +5692,7 @@ class Xc {
5724
5692
  return !!((t = this.queryCbs[e]) != null && t.length || (r = this.queryOnceDfds[e]) != null && r.length);
5725
5693
  }
5726
5694
  _cleanupQuery(e, t) {
5727
- this._hasQueryListeners(t) || (delete this.queryCbs[t], delete this.queryOnceDfds[t], delete this._dataForQueryCache[t], this.querySubs.unloadKey(t), this._trySendAuthed(Z(), { op: "remove-query", q: e }));
5695
+ this._hasQueryListeners(t) || (delete this.queryCbs[t], delete this.queryOnceDfds[t], delete this._dataForQueryCache[t], this.querySubs.unloadKey(t), this._trySendAuthed(H(), { op: "remove-query", q: e }));
5728
5696
  }
5729
5697
  // When we `pushTx`, it's possible that we don't yet have `this.attrs`
5730
5698
  // This means that `tx-steps` in `pendingMutations` will include `add-attr`
@@ -5750,7 +5718,7 @@ class Xc {
5750
5718
  return /* @__PURE__ */ new Map();
5751
5719
  const s = (l) => {
5752
5720
  const [f, d, y] = l["forward-identity"];
5753
- return ie(e, d, y);
5721
+ return te(e, d, y);
5754
5722
  }, i = (l) => {
5755
5723
  const [f, d, y] = l["forward-identity"];
5756
5724
  return Ve(e, d, y);
@@ -5761,15 +5729,15 @@ class Xc {
5761
5729
  for (const y of l) {
5762
5730
  const [b] = y;
5763
5731
  if (b === "add-attr") {
5764
- const [m, S] = y, _ = s(S);
5732
+ const [w, S] = y, _ = s(S);
5765
5733
  if (_ && S.id !== _.id) {
5766
5734
  o.attrIdMap[S.id] = _.id, a = !0;
5767
5735
  continue;
5768
5736
  }
5769
5737
  if (S["value-type"] === "ref") {
5770
- const w = i(S);
5771
- if (w) {
5772
- o.attrIdMap[S.id] = w.id, o.refSwapAttrIds.add(S.id), a = !0;
5738
+ const m = i(S);
5739
+ if (m) {
5740
+ o.attrIdMap[S.id] = m.id, o.refSwapAttrIds.add(S.id), a = !0;
5773
5741
  continue;
5774
5742
  }
5775
5743
  }
@@ -5831,9 +5799,9 @@ class Xc {
5831
5799
  if (l && s === l.querySubVersion && o === l.pendingMutationsVersion)
5832
5800
  return l;
5833
5801
  let f = u.store, d = u.attrsStore;
5834
- const { pageInfo: y, aggregate: b, processedTxId: g } = u, m = this._rewriteMutationsSorted(d, a);
5802
+ const { pageInfo: y, aggregate: b, processedTxId: g } = u, w = this._rewriteMutationsSorted(d, a);
5835
5803
  if (t) {
5836
- const _ = this._applyOptimisticUpdates(f, d, m, g);
5804
+ const _ = this._applyOptimisticUpdates(f, d, w, g);
5837
5805
  f = _.store, d = _.attrsStore;
5838
5806
  }
5839
5807
  return { data: Ns({ store: f, attrsStore: d, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
@@ -5982,7 +5950,7 @@ class Xc {
5982
5950
  const r = await this.kv.waitForKeyToLoad(t);
5983
5951
  if (r)
5984
5952
  return r;
5985
- const s = Z();
5953
+ const s = H();
5986
5954
  return this.kv.updateInPlace((i) => {
5987
5955
  i[t] || (i[t] = s);
5988
5956
  }), await this.kv.waitForKeyToLoad(t);
@@ -6069,7 +6037,7 @@ class Xc {
6069
6037
  async getAuth() {
6070
6038
  const { user: e, error: t } = await this.getCurrentUser();
6071
6039
  if (t)
6072
- throw new ue("Could not get current user: " + t.message);
6040
+ throw new le("Could not get current user: " + t.message);
6073
6041
  return e ?? null;
6074
6042
  }
6075
6043
  subscribeConnectionStatus(e) {
@@ -6362,14 +6330,14 @@ class Xc {
6362
6330
  i.result.user = o, s.isConnected && (this._trySetPresence(t, o), this._notifyPresenceSubs(t));
6363
6331
  }
6364
6332
  _trySetPresence(e, t) {
6365
- this._trySendAuthed(Z(), {
6333
+ this._trySendAuthed(H(), {
6366
6334
  op: "set-presence",
6367
6335
  "room-id": e,
6368
6336
  data: t
6369
6337
  });
6370
6338
  }
6371
6339
  _tryJoinRoom(e, t, r) {
6372
- this._trySendAuthed(Z(), {
6340
+ this._trySendAuthed(H(), {
6373
6341
  op: "join-room",
6374
6342
  "room-type": e,
6375
6343
  "room-id": t,
@@ -6377,7 +6345,7 @@ class Xc {
6377
6345
  }), delete this._roomsPendingLeave[t];
6378
6346
  }
6379
6347
  _tryLeaveRoom(e) {
6380
- this._trySendAuthed(Z(), { op: "leave-room", "room-id": e });
6348
+ this._trySendAuthed(H(), { op: "leave-room", "room-id": e });
6381
6349
  }
6382
6350
  _trySetRoomConnected(e, t) {
6383
6351
  const r = this._rooms[e];
@@ -6451,7 +6419,7 @@ class Xc {
6451
6419
  }
6452
6420
  }
6453
6421
  _tryBroadcast(e, t, r, s) {
6454
- this._trySendAuthed(Z(), {
6422
+ this._trySendAuthed(H(), {
6455
6423
  op: "client-broadcast",
6456
6424
  "room-id": e,
6457
6425
  roomType: t,
@@ -6536,22 +6504,22 @@ function tu(n) {
6536
6504
  return new Xt(n, {});
6537
6505
  }
6538
6506
  function nu() {
6539
- return new he("string", !0, !1);
6507
+ return new fe("string", !0, !1);
6540
6508
  }
6541
6509
  function ru() {
6542
- return new he("number", !0, !1);
6510
+ return new fe("number", !0, !1);
6543
6511
  }
6544
6512
  function su() {
6545
- return new he("boolean", !0, !1);
6513
+ return new fe("boolean", !0, !1);
6546
6514
  }
6547
6515
  function iu() {
6548
- return new he("date", !0, !1);
6516
+ return new fe("date", !0, !1);
6549
6517
  }
6550
6518
  function ou() {
6551
- return new he("json", !0, !1);
6519
+ return new fe("json", !0, !1);
6552
6520
  }
6553
6521
  function au() {
6554
- return new he("json", !0, !1);
6522
+ return new fe("json", !0, !1);
6555
6523
  }
6556
6524
  function ei(n, e) {
6557
6525
  var s, i, o, a;
@@ -6776,190 +6744,190 @@ const gu = (n) => JSON.stringify(n), bt = (n, e = !1) => JSON.stringify([n, e]),
6776
6744
  ];
6777
6745
  return { chunks: t, data: r };
6778
6746
  }, gn = ["bootstrap", "bootstrap", "bootstrap", 1], Tu = (n, e, t, r) => {
6779
- var G, V, ne, q;
6780
- const { entityName: s, entityQuery: i } = ni(e), o = ((G = i.$) == null ? void 0 : G.limit) || 10, a = s, c = ti((V = i.$) == null ? void 0 : V.order), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
6747
+ var Ae, re, se, B;
6748
+ const { entityName: s, entityQuery: i } = ni(e), o = ((Ae = i.$) == null ? void 0 : Ae.limit) || 10, a = s, c = ti((re = i.$) == null ? void 0 : re.order), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
6781
6749
  let d = !1, y = !0, b = null, g = null;
6782
- const m = (k) => {
6750
+ const w = (k) => {
6783
6751
  t({ error: k, data: void 0, canLoadNextPage: !1 });
6784
6752
  }, S = () => {
6785
6753
  if (!y)
6786
6754
  return;
6787
- const { chunks: k, data: j } = wu(u, l);
6755
+ const { chunks: k, data: M } = wu(u, l);
6788
6756
  t({
6789
- data: { [a]: j },
6757
+ data: { [a]: M },
6790
6758
  // @ts-expect-error hidden debug variable
6791
6759
  chunks: k,
6792
6760
  canLoadNextPage: mu(u)
6793
6761
  });
6794
- }, _ = (k, j) => {
6795
- u.set(bt(k, j.afterInclusive), j), S();
6796
- }, w = (k, j) => {
6797
- l.set(bt(k), j), P(), S();
6798
- }, C = (k, j) => {
6799
- var O, A;
6800
- const { cursor: R } = Xr(k), F = f.get(He("reverse", R));
6801
- F == null || F();
6802
- const N = n.subscribeQuery({
6762
+ }, _ = (k, M) => {
6763
+ u.set(bt(k, M.afterInclusive), M), S();
6764
+ }, m = (k, M) => {
6765
+ l.set(bt(k), M), N(), S();
6766
+ }, A = (k, M) => {
6767
+ var O, C;
6768
+ const { cursor: R } = Xr(k), q = f.get(He("reverse", R));
6769
+ q == null || q();
6770
+ const z = n.subscribeQuery({
6803
6771
  [a]: {
6804
6772
  ...i,
6805
6773
  $: {
6806
6774
  after: R,
6807
- before: j.endCursor,
6775
+ before: M.endCursor,
6808
6776
  beforeInclusive: !0,
6809
6777
  where: (O = i.$) == null ? void 0 : O.where,
6810
- fields: (A = i.$) == null ? void 0 : A.fields,
6778
+ fields: (C = i.$) == null ? void 0 : C.fields,
6811
6779
  order: es(c)
6812
6780
  }
6813
6781
  }
6814
- }, (W) => {
6815
- if (W.error)
6816
- return m(W.error);
6817
- const J = W.data[a], X = W.pageInfo[a];
6818
- ut(J && X, "Expected query subscription to contain rows and pageInfo"), w(R, {
6819
- data: J,
6782
+ }, (L) => {
6783
+ if (L.error)
6784
+ return w(L.error);
6785
+ const V = L.data[a], J = L.pageInfo[a];
6786
+ ut(V && J, "Expected query subscription to contain rows and pageInfo"), m(R, {
6787
+ data: V,
6820
6788
  status: "frozen",
6821
- hasMore: X.hasNextPage,
6822
- endCursor: X.endCursor
6789
+ hasMore: J.hasNextPage,
6790
+ endCursor: J.endCursor
6823
6791
  });
6824
6792
  }, r);
6825
- f.set(He("reverse", R), N);
6793
+ f.set(He("reverse", R), z);
6826
6794
  }, v = (k) => {
6827
- var R, F;
6828
- const j = n.subscribeQuery({
6795
+ var R, q;
6796
+ const M = n.subscribeQuery({
6829
6797
  [a]: {
6830
6798
  ...i,
6831
6799
  $: {
6832
6800
  limit: o,
6833
6801
  after: k,
6834
6802
  where: (R = i.$) == null ? void 0 : R.where,
6835
- fields: (F = i.$) == null ? void 0 : F.fields,
6803
+ fields: (q = i.$) == null ? void 0 : q.fields,
6836
6804
  order: es(c)
6837
6805
  }
6838
6806
  }
6839
- }, (N) => {
6840
- if (N.error)
6841
- return m(N.error);
6842
- const O = N.data[a], A = N.pageInfo[a];
6843
- ut(O && A, "Expected rows and pageInfo"), w(k, {
6807
+ }, (z) => {
6808
+ if (z.error)
6809
+ return w(z.error);
6810
+ const O = z.data[a], C = z.pageInfo[a];
6811
+ ut(O && C, "Expected rows and pageInfo"), m(k, {
6844
6812
  data: O,
6845
6813
  status: "bootstrapping",
6846
- hasMore: A.hasNextPage,
6847
- endCursor: A.endCursor
6814
+ hasMore: C.hasNextPage,
6815
+ endCursor: C.endCursor
6848
6816
  });
6849
6817
  }, r);
6850
- f.set(He("reverse", k), j);
6851
- }, U = (k, j = !1) => {
6852
- var F, N;
6818
+ f.set(He("reverse", k), M);
6819
+ }, I = (k, M = !1) => {
6820
+ var q, z;
6853
6821
  const R = n.subscribeQuery({
6854
6822
  [a]: {
6855
6823
  ...i,
6856
6824
  $: {
6857
6825
  limit: o,
6858
6826
  after: k,
6859
- afterInclusive: j,
6860
- where: (F = i.$) == null ? void 0 : F.where,
6861
- fields: (N = i.$) == null ? void 0 : N.fields,
6827
+ afterInclusive: M,
6828
+ where: (q = i.$) == null ? void 0 : q.where,
6829
+ fields: (z = i.$) == null ? void 0 : z.fields,
6862
6830
  order: c
6863
6831
  }
6864
6832
  }
6865
6833
  }, (O) => {
6866
6834
  if (O.error)
6867
- return m(O.error);
6868
- const A = O.data[a], W = O.pageInfo[a];
6869
- ut(A && W, "Page info and rows"), _(k, {
6870
- data: A,
6835
+ return w(O.error);
6836
+ const C = O.data[a], L = O.pageInfo[a];
6837
+ ut(C && L, "Page info and rows"), _(k, {
6838
+ data: C,
6871
6839
  status: "bootstrapping",
6872
- hasMore: W.hasNextPage,
6873
- endCursor: W.endCursor,
6874
- afterInclusive: j
6840
+ hasMore: L.hasNextPage,
6841
+ endCursor: L.endCursor,
6842
+ afterInclusive: M
6875
6843
  });
6876
6844
  }, r);
6877
- f.set(He("forward", k, j), R);
6878
- }, I = (k, j = !1) => {
6879
- var A, W;
6880
- const R = bt(k, j), F = f.get(He("forward", k, j));
6881
- F == null || F();
6882
- const N = u.get(R);
6883
- if (!(N != null && N.endCursor))
6845
+ f.set(He("forward", k, M), R);
6846
+ }, x = (k, M = !1) => {
6847
+ var C, L;
6848
+ const R = bt(k, M), q = f.get(He("forward", k, M));
6849
+ q == null || q();
6850
+ const z = u.get(R);
6851
+ if (!(z != null && z.endCursor))
6884
6852
  return;
6885
6853
  const O = n.subscribeQuery({
6886
6854
  [a]: {
6887
6855
  ...i,
6888
6856
  $: {
6889
6857
  after: k,
6890
- afterInclusive: N.afterInclusive,
6891
- before: N.endCursor,
6858
+ afterInclusive: z.afterInclusive,
6859
+ before: z.endCursor,
6892
6860
  beforeInclusive: !0,
6893
- where: (A = i.$) == null ? void 0 : A.where,
6894
- fields: (W = i.$) == null ? void 0 : W.fields,
6861
+ where: (C = i.$) == null ? void 0 : C.where,
6862
+ fields: (L = i.$) == null ? void 0 : L.fields,
6895
6863
  order: c
6896
6864
  }
6897
6865
  }
6898
- }, (J) => {
6899
- if (J.error)
6900
- return m(J.error);
6901
- const X = J.data[a], le = J.pageInfo[a];
6902
- ut(X && le, "Expected rows and pageInfo"), _(k, {
6903
- data: X,
6866
+ }, (V) => {
6867
+ if (V.error)
6868
+ return w(V.error);
6869
+ const J = V.data[a], ae = V.pageInfo[a];
6870
+ ut(J && ae, "Expected rows and pageInfo"), _(k, {
6871
+ data: J,
6904
6872
  status: "frozen",
6905
- hasMore: le.hasNextPage,
6906
- endCursor: le.endCursor,
6907
- afterInclusive: N.afterInclusive
6873
+ hasMore: ae.hasNextPage,
6874
+ endCursor: ae.endCursor,
6875
+ afterInclusive: z.afterInclusive
6908
6876
  });
6909
6877
  }, r);
6910
- f.set(He("forward", k, j), O);
6911
- }, P = () => {
6878
+ f.set(He("forward", k, M), O);
6879
+ }, N = () => {
6912
6880
  const k = Array.from(l.entries()).at(-1);
6913
6881
  if (!k)
6914
6882
  return;
6915
- const [j, R] = k;
6883
+ const [M, R] = k;
6916
6884
  if (!(R != null && R.hasMore) || !_u(R))
6917
6885
  return;
6918
- const F = `${j}:${gu(R.endCursor)}`;
6919
- F != b && (b = F, C(j, R), v(R.endCursor));
6920
- }, H = () => {
6886
+ const q = `${M}:${gu(R.endCursor)}`;
6887
+ q != b && (b = q, A(M, R), v(R.endCursor));
6888
+ }, Q = () => {
6921
6889
  const k = Array.from(u.entries()).at(-1);
6922
6890
  if (!k)
6923
6891
  return;
6924
- const [j, R] = k;
6892
+ const [M, R] = k;
6925
6893
  if (!R.endCursor)
6926
6894
  return;
6927
- const { cursor: F, afterInclusive: N } = Xr(j);
6928
- I(F, N), U(R.endCursor);
6895
+ const { cursor: q, afterInclusive: z } = Xr(M);
6896
+ x(q, z), I(R.endCursor);
6929
6897
  };
6930
6898
  return g = n.subscribeQuery({
6931
6899
  [a]: {
6932
6900
  ...i,
6933
6901
  $: {
6934
6902
  limit: o,
6935
- where: (ne = i.$) == null ? void 0 : ne.where,
6936
- fields: (q = i.$) == null ? void 0 : q.fields,
6903
+ where: (se = i.$) == null ? void 0 : se.where,
6904
+ fields: (B = i.$) == null ? void 0 : B.fields,
6937
6905
  order: c
6938
6906
  }
6939
6907
  }
6940
6908
  }, async (k) => {
6941
- var N;
6909
+ var z;
6942
6910
  if (d)
6943
6911
  return;
6944
6912
  if (k.error)
6945
- return m(k.error);
6946
- const j = k.pageInfo[a], R = (N = k == null ? void 0 : k.data) == null ? void 0 : N[a];
6947
- if (ut(R && j, "Expected rows and pageInfo"), R.length < o) {
6913
+ return w(k.error);
6914
+ const M = k.pageInfo[a], R = (z = k == null ? void 0 : k.data) == null ? void 0 : z[a];
6915
+ if (ut(R && M, "Expected rows and pageInfo"), R.length < o) {
6948
6916
  _(gn, {
6949
6917
  data: R,
6950
6918
  status: "pre-bootstrap"
6951
6919
  });
6952
6920
  return;
6953
6921
  }
6954
- const F = j.startCursor;
6955
- if (!F) {
6922
+ const q = M.startCursor;
6923
+ if (!q) {
6956
6924
  _(gn, {
6957
6925
  data: R,
6958
6926
  status: "pre-bootstrap"
6959
6927
  });
6960
6928
  return;
6961
6929
  }
6962
- u.delete(bt(gn)), U(F, !0), v(j.startCursor), d = !0;
6930
+ u.delete(bt(gn)), I(q, !0), v(M.startCursor), d = !0;
6963
6931
  }, r), {
6964
6932
  unsubscribe: () => {
6965
6933
  if (y) {
@@ -6969,7 +6937,7 @@ const gu = (n) => JSON.stringify(n), bt = (n, e = !1) => JSON.stringify([n, e]),
6969
6937
  f.clear();
6970
6938
  }
6971
6939
  },
6972
- loadNextPage: H
6940
+ loadNextPage: Q
6973
6941
  };
6974
6942
  }, Su = (n, e, t) => {
6975
6943
  var u, l, f, d;
@@ -7003,10 +6971,10 @@ const gu = (n) => JSON.stringify(n), bt = (n, e = !1) => JSON.stringify([n, e]),
7003
6971
  };
7004
6972
  }, ni = (n) => {
7005
6973
  if (Object.keys(n).length !== 1)
7006
- throw new B("subscribeInfiniteQuery expects exactly one entity");
6974
+ throw new W("subscribeInfiniteQuery expects exactly one entity");
7007
6975
  const [t, r] = Object.entries(n)[0];
7008
6976
  if (!t || !r)
7009
- throw new B("No query provided for infinite query");
6977
+ throw new W("No query provided for infinite query");
7010
6978
  return { entityName: t, entityQuery: r };
7011
6979
  }, vu = {
7012
6980
  apiURI: "https://api.instantdb.com",
@@ -7436,7 +7404,7 @@ function ns(n) {
7436
7404
  const e = ts.get(n);
7437
7405
  if (e)
7438
7406
  return e;
7439
- const t = se(n);
7407
+ const t = ee(n);
7440
7408
  return ts.set(n, t), t;
7441
7409
  }
7442
7410
  function Pu(n, e) {
@@ -7507,54 +7475,54 @@ function xu() {
7507
7475
  * LICENSE file in the root directory of this source tree.
7508
7476
  */
7509
7477
  return n.NODE_ENV !== "production" && function() {
7510
- var e = fs, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, m = "@@iterator";
7478
+ var e = fs, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, w = "@@iterator";
7511
7479
  function S(h) {
7512
7480
  if (h === null || typeof h != "object")
7513
7481
  return null;
7514
- var T = g && h[g] || h[m];
7482
+ var T = g && h[g] || h[w];
7515
7483
  return typeof T == "function" ? T : null;
7516
7484
  }
7517
7485
  var _ = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
7518
- function w(h) {
7486
+ function m(h) {
7519
7487
  {
7520
- for (var T = arguments.length, E = new Array(T > 1 ? T - 1 : 0), M = 1; M < T; M++)
7521
- E[M - 1] = arguments[M];
7522
- C("error", h, E);
7488
+ for (var T = arguments.length, E = new Array(T > 1 ? T - 1 : 0), P = 1; P < T; P++)
7489
+ E[P - 1] = arguments[P];
7490
+ A("error", h, E);
7523
7491
  }
7524
7492
  }
7525
- function C(h, T, E) {
7493
+ function A(h, T, E) {
7526
7494
  {
7527
- var M = _.ReactDebugCurrentFrame, z = M.getStackAddendum();
7528
- z !== "" && (T += "%s", E = E.concat([z]));
7529
- var Q = E.map(function(L) {
7530
- return String(L);
7495
+ var P = _.ReactDebugCurrentFrame, F = P.getStackAddendum();
7496
+ F !== "" && (T += "%s", E = E.concat([F]));
7497
+ var K = E.map(function(U) {
7498
+ return String(U);
7531
7499
  });
7532
- Q.unshift("Warning: " + T), Function.prototype.apply.call(console[h], console, Q);
7500
+ K.unshift("Warning: " + T), Function.prototype.apply.call(console[h], console, K);
7533
7501
  }
7534
7502
  }
7535
- var v = !1, U = !1, I = !1, P = !1, H = !1, K;
7536
- K = Symbol.for("react.module.reference");
7537
- function G(h) {
7538
- return !!(typeof h == "string" || typeof h == "function" || h === s || h === o || H || h === i || h === l || h === f || P || h === b || v || U || I || typeof h == "object" && h !== null && (h.$$typeof === y || h.$$typeof === d || h.$$typeof === a || h.$$typeof === c || h.$$typeof === u || // This needs to include all possible module reference object
7503
+ var v = !1, I = !1, x = !1, N = !1, Q = !1, ge;
7504
+ ge = Symbol.for("react.module.reference");
7505
+ function Ae(h) {
7506
+ return !!(typeof h == "string" || typeof h == "function" || h === s || h === o || Q || h === i || h === l || h === f || N || h === b || v || I || x || typeof h == "object" && h !== null && (h.$$typeof === y || h.$$typeof === d || h.$$typeof === a || h.$$typeof === c || h.$$typeof === u || // This needs to include all possible module reference object
7539
7507
  // types supported by any Flight configuration anywhere since
7540
7508
  // we don't know which Flight build this will end up being used
7541
7509
  // with.
7542
- h.$$typeof === K || h.getModuleId !== void 0));
7510
+ h.$$typeof === ge || h.getModuleId !== void 0));
7543
7511
  }
7544
- function V(h, T, E) {
7545
- var M = h.displayName;
7546
- if (M)
7547
- return M;
7548
- var z = T.displayName || T.name || "";
7549
- return z !== "" ? E + "(" + z + ")" : E;
7512
+ function re(h, T, E) {
7513
+ var P = h.displayName;
7514
+ if (P)
7515
+ return P;
7516
+ var F = T.displayName || T.name || "";
7517
+ return F !== "" ? E + "(" + F + ")" : E;
7550
7518
  }
7551
- function ne(h) {
7519
+ function se(h) {
7552
7520
  return h.displayName || "Context";
7553
7521
  }
7554
- function q(h) {
7522
+ function B(h) {
7555
7523
  if (h == null)
7556
7524
  return null;
7557
- if (typeof h.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof h == "function")
7525
+ if (typeof h.tag == "number" && m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof h == "function")
7558
7526
  return h.displayName || h.name || null;
7559
7527
  if (typeof h == "string")
7560
7528
  return h;
@@ -7576,19 +7544,19 @@ function xu() {
7576
7544
  switch (h.$$typeof) {
7577
7545
  case c:
7578
7546
  var T = h;
7579
- return ne(T) + ".Consumer";
7547
+ return se(T) + ".Consumer";
7580
7548
  case a:
7581
7549
  var E = h;
7582
- return ne(E._context) + ".Provider";
7550
+ return se(E._context) + ".Provider";
7583
7551
  case u:
7584
- return V(h, h.render, "ForwardRef");
7552
+ return re(h, h.render, "ForwardRef");
7585
7553
  case d:
7586
- var M = h.displayName || null;
7587
- return M !== null ? M : q(h.type) || "Memo";
7554
+ var P = h.displayName || null;
7555
+ return P !== null ? P : B(h.type) || "Memo";
7588
7556
  case y: {
7589
- var z = h, Q = z._payload, L = z._init;
7557
+ var F = h, K = F._payload, U = F._init;
7590
7558
  try {
7591
- return q(L(Q));
7559
+ return B(U(K));
7592
7560
  } catch {
7593
7561
  return null;
7594
7562
  }
@@ -7596,18 +7564,18 @@ function xu() {
7596
7564
  }
7597
7565
  return null;
7598
7566
  }
7599
- var k = Object.assign, j = 0, R, F, N, O, A, W, J;
7600
- function X() {
7567
+ var k = Object.assign, M = 0, R, q, z, O, C, L, V;
7568
+ function J() {
7601
7569
  }
7602
- X.__reactDisabledLog = !0;
7603
- function le() {
7570
+ J.__reactDisabledLog = !0;
7571
+ function ae() {
7604
7572
  {
7605
- if (j === 0) {
7606
- R = console.log, F = console.info, N = console.warn, O = console.error, A = console.group, W = console.groupCollapsed, J = console.groupEnd;
7573
+ if (M === 0) {
7574
+ R = console.log, q = console.info, z = console.warn, O = console.error, C = console.group, L = console.groupCollapsed, V = console.groupEnd;
7607
7575
  var h = {
7608
7576
  configurable: !0,
7609
7577
  enumerable: !0,
7610
- value: X,
7578
+ value: J,
7611
7579
  writable: !0
7612
7580
  };
7613
7581
  Object.defineProperties(console, {
@@ -7620,12 +7588,12 @@ function xu() {
7620
7588
  groupEnd: h
7621
7589
  });
7622
7590
  }
7623
- j++;
7591
+ M++;
7624
7592
  }
7625
7593
  }
7626
7594
  function at() {
7627
7595
  {
7628
- if (j--, j === 0) {
7596
+ if (M--, M === 0) {
7629
7597
  var h = {
7630
7598
  configurable: !0,
7631
7599
  enumerable: !0,
@@ -7636,37 +7604,37 @@ function xu() {
7636
7604
  value: R
7637
7605
  }),
7638
7606
  info: k({}, h, {
7639
- value: F
7607
+ value: q
7640
7608
  }),
7641
7609
  warn: k({}, h, {
7642
- value: N
7610
+ value: z
7643
7611
  }),
7644
7612
  error: k({}, h, {
7645
7613
  value: O
7646
7614
  }),
7647
7615
  group: k({}, h, {
7648
- value: A
7616
+ value: C
7649
7617
  }),
7650
7618
  groupCollapsed: k({}, h, {
7651
- value: W
7619
+ value: L
7652
7620
  }),
7653
7621
  groupEnd: k({}, h, {
7654
- value: J
7622
+ value: V
7655
7623
  })
7656
7624
  });
7657
7625
  }
7658
- j < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
7626
+ M < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
7659
7627
  }
7660
7628
  }
7661
- var ve = _.ReactCurrentDispatcher, tn;
7629
+ var Se = _.ReactCurrentDispatcher, tn;
7662
7630
  function kt(h, T, E) {
7663
7631
  {
7664
7632
  if (tn === void 0)
7665
7633
  try {
7666
7634
  throw Error();
7667
- } catch (z) {
7668
- var M = z.stack.trim().match(/\n( *(at )?)/);
7669
- tn = M && M[1] || "";
7635
+ } catch (F) {
7636
+ var P = F.stack.trim().match(/\n( *(at )?)/);
7637
+ tn = P && P[1] || "";
7670
7638
  }
7671
7639
  return `
7672
7640
  ` + tn + h;
@@ -7685,65 +7653,65 @@ function xu() {
7685
7653
  if (E !== void 0)
7686
7654
  return E;
7687
7655
  }
7688
- var M;
7656
+ var P;
7689
7657
  nn = !0;
7690
- var z = Error.prepareStackTrace;
7658
+ var F = Error.prepareStackTrace;
7691
7659
  Error.prepareStackTrace = void 0;
7692
- var Q;
7693
- Q = ve.current, ve.current = null, le();
7660
+ var K;
7661
+ K = Se.current, Se.current = null, ae();
7694
7662
  try {
7695
7663
  if (T) {
7696
- var L = function() {
7664
+ var U = function() {
7697
7665
  throw Error();
7698
7666
  };
7699
- if (Object.defineProperty(L.prototype, "props", {
7667
+ if (Object.defineProperty(U.prototype, "props", {
7700
7668
  set: function() {
7701
7669
  throw Error();
7702
7670
  }
7703
7671
  }), typeof Reflect == "object" && Reflect.construct) {
7704
7672
  try {
7705
- Reflect.construct(L, []);
7706
- } catch (pe) {
7707
- M = pe;
7673
+ Reflect.construct(U, []);
7674
+ } catch (de) {
7675
+ P = de;
7708
7676
  }
7709
- Reflect.construct(h, [], L);
7677
+ Reflect.construct(h, [], U);
7710
7678
  } else {
7711
7679
  try {
7712
- L.call();
7713
- } catch (pe) {
7714
- M = pe;
7680
+ U.call();
7681
+ } catch (de) {
7682
+ P = de;
7715
7683
  }
7716
- h.call(L.prototype);
7684
+ h.call(U.prototype);
7717
7685
  }
7718
7686
  } else {
7719
7687
  try {
7720
7688
  throw Error();
7721
- } catch (pe) {
7722
- M = pe;
7689
+ } catch (de) {
7690
+ P = de;
7723
7691
  }
7724
7692
  h();
7725
7693
  }
7726
- } catch (pe) {
7727
- if (pe && M && typeof pe.stack == "string") {
7728
- for (var $ = pe.stack.split(`
7729
- `), fe = M.stack.split(`
7730
- `), ee = $.length - 1, re = fe.length - 1; ee >= 1 && re >= 0 && $[ee] !== fe[re]; )
7731
- re--;
7732
- for (; ee >= 1 && re >= 0; ee--, re--)
7733
- if ($[ee] !== fe[re]) {
7734
- if (ee !== 1 || re !== 1)
7694
+ } catch (de) {
7695
+ if (de && P && typeof de.stack == "string") {
7696
+ for (var $ = de.stack.split(`
7697
+ `), ce = P.stack.split(`
7698
+ `), Y = $.length - 1, X = ce.length - 1; Y >= 1 && X >= 0 && $[Y] !== ce[X]; )
7699
+ X--;
7700
+ for (; Y >= 1 && X >= 0; Y--, X--)
7701
+ if ($[Y] !== ce[X]) {
7702
+ if (Y !== 1 || X !== 1)
7735
7703
  do
7736
- if (ee--, re--, re < 0 || $[ee] !== fe[re]) {
7737
- var Te = `
7738
- ` + $[ee].replace(" at new ", " at ");
7739
- return h.displayName && Te.includes("<anonymous>") && (Te = Te.replace("<anonymous>", h.displayName)), typeof h == "function" && At.set(h, Te), Te;
7704
+ if (Y--, X--, X < 0 || $[Y] !== ce[X]) {
7705
+ var we = `
7706
+ ` + $[Y].replace(" at new ", " at ");
7707
+ return h.displayName && we.includes("<anonymous>") && (we = we.replace("<anonymous>", h.displayName)), typeof h == "function" && At.set(h, we), we;
7740
7708
  }
7741
- while (ee >= 1 && re >= 0);
7709
+ while (Y >= 1 && X >= 0);
7742
7710
  break;
7743
7711
  }
7744
7712
  }
7745
7713
  } finally {
7746
- nn = !1, ve.current = Q, at(), Error.prepareStackTrace = z;
7714
+ nn = !1, Se.current = K, at(), Error.prepareStackTrace = F;
7747
7715
  }
7748
7716
  var Be = h ? h.displayName || h.name : "", De = Be ? kt(Be) : "";
7749
7717
  return typeof h == "function" && At.set(h, De), De;
@@ -7775,9 +7743,9 @@ function xu() {
7775
7743
  case d:
7776
7744
  return Ct(h.type, T, E);
7777
7745
  case y: {
7778
- var M = h, z = M._payload, Q = M._init;
7746
+ var P = h, F = P._payload, K = P._init;
7779
7747
  try {
7780
- return Ct(Q(z), T, E);
7748
+ return Ct(K(F), T, E);
7781
7749
  } catch {
7782
7750
  }
7783
7751
  }
@@ -7792,22 +7760,22 @@ function xu() {
7792
7760
  } else
7793
7761
  ur.setExtraStackFrame(null);
7794
7762
  }
7795
- function ui(h, T, E, M, z) {
7763
+ function ui(h, T, E, P, F) {
7796
7764
  {
7797
- var Q = Function.call.bind(ct);
7798
- for (var L in h)
7799
- if (Q(h, L)) {
7765
+ var K = Function.call.bind(ct);
7766
+ for (var U in h)
7767
+ if (K(h, U)) {
7800
7768
  var $ = void 0;
7801
7769
  try {
7802
- if (typeof h[L] != "function") {
7803
- var fe = Error((M || "React class") + ": " + E + " type `" + L + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[L] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
7804
- throw fe.name = "Invariant Violation", fe;
7770
+ if (typeof h[U] != "function") {
7771
+ var ce = Error((P || "React class") + ": " + E + " type `" + U + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[U] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
7772
+ throw ce.name = "Invariant Violation", ce;
7805
7773
  }
7806
- $ = h[L](T, L, M, E, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
7807
- } catch (ee) {
7808
- $ = ee;
7774
+ $ = h[U](T, U, P, E, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
7775
+ } catch (Y) {
7776
+ $ = Y;
7809
7777
  }
7810
- $ && !($ instanceof Error) && (It(z), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", M || "React class", E, L, typeof $), It(null)), $ instanceof Error && !($.message in cr) && (cr[$.message] = !0, It(z), w("Failed %s type: %s", E, $.message), It(null));
7778
+ $ && !($ instanceof Error) && (It(F), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", P || "React class", E, U, typeof $), It(null)), $ instanceof Error && !($.message in cr) && (cr[$.message] = !0, It(F), m("Failed %s type: %s", E, $.message), It(null));
7811
7779
  }
7812
7780
  }
7813
7781
  }
@@ -7833,7 +7801,7 @@ function xu() {
7833
7801
  }
7834
7802
  function fr(h) {
7835
7803
  if (di(h))
7836
- return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", fi(h)), lr(h);
7804
+ return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", fi(h)), lr(h);
7837
7805
  }
7838
7806
  var dr = _.ReactCurrentOwner, hi = {
7839
7807
  key: !0,
@@ -7863,7 +7831,7 @@ function xu() {
7863
7831
  function gi(h, T) {
7864
7832
  {
7865
7833
  var E = function() {
7866
- hr || (hr = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
7834
+ hr || (hr = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
7867
7835
  };
7868
7836
  E.isReactWarning = !0, Object.defineProperty(h, "key", {
7869
7837
  get: E,
@@ -7874,7 +7842,7 @@ function xu() {
7874
7842
  function _i(h, T) {
7875
7843
  {
7876
7844
  var E = function() {
7877
- pr || (pr = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
7845
+ pr || (pr = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
7878
7846
  };
7879
7847
  E.isReactWarning = !0, Object.defineProperty(h, "ref", {
7880
7848
  get: E,
@@ -7882,7 +7850,7 @@ function xu() {
7882
7850
  });
7883
7851
  }
7884
7852
  }
7885
- var mi = function(h, T, E, M, z, Q, L) {
7853
+ var mi = function(h, T, E, P, F, K, U) {
7886
7854
  var $ = {
7887
7855
  // This tag allows us to uniquely identify this as a React Element
7888
7856
  $$typeof: t,
@@ -7890,9 +7858,9 @@ function xu() {
7890
7858
  type: h,
7891
7859
  key: T,
7892
7860
  ref: E,
7893
- props: L,
7861
+ props: U,
7894
7862
  // Record the component responsible for creating this element.
7895
- _owner: Q
7863
+ _owner: K
7896
7864
  };
7897
7865
  return $._store = {}, Object.defineProperty($._store, "validated", {
7898
7866
  configurable: !1,
@@ -7903,30 +7871,30 @@ function xu() {
7903
7871
  configurable: !1,
7904
7872
  enumerable: !1,
7905
7873
  writable: !1,
7906
- value: M
7874
+ value: P
7907
7875
  }), Object.defineProperty($, "_source", {
7908
7876
  configurable: !1,
7909
7877
  enumerable: !1,
7910
7878
  writable: !1,
7911
- value: z
7879
+ value: F
7912
7880
  }), Object.freeze && (Object.freeze($.props), Object.freeze($)), $;
7913
7881
  };
7914
- function wi(h, T, E, M, z) {
7882
+ function wi(h, T, E, P, F) {
7915
7883
  {
7916
- var Q, L = {}, $ = null, fe = null;
7917
- E !== void 0 && (fr(E), $ = "" + E), yi(T) && (fr(T.key), $ = "" + T.key), pi(T) && (fe = T.ref, bi(T, z));
7918
- for (Q in T)
7919
- ct.call(T, Q) && !hi.hasOwnProperty(Q) && (L[Q] = T[Q]);
7884
+ var K, U = {}, $ = null, ce = null;
7885
+ E !== void 0 && (fr(E), $ = "" + E), yi(T) && (fr(T.key), $ = "" + T.key), pi(T) && (ce = T.ref, bi(T, F));
7886
+ for (K in T)
7887
+ ct.call(T, K) && !hi.hasOwnProperty(K) && (U[K] = T[K]);
7920
7888
  if (h && h.defaultProps) {
7921
- var ee = h.defaultProps;
7922
- for (Q in ee)
7923
- L[Q] === void 0 && (L[Q] = ee[Q]);
7889
+ var Y = h.defaultProps;
7890
+ for (K in Y)
7891
+ U[K] === void 0 && (U[K] = Y[K]);
7924
7892
  }
7925
- if ($ || fe) {
7926
- var re = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
7927
- $ && gi(L, re), fe && _i(L, re);
7893
+ if ($ || ce) {
7894
+ var X = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
7895
+ $ && gi(U, X), ce && _i(U, X);
7928
7896
  }
7929
- return mi(h, $, fe, z, M, dr.current, L);
7897
+ return mi(h, $, ce, F, P, dr.current, U);
7930
7898
  }
7931
7899
  }
7932
7900
  var sn = _.ReactCurrentOwner, yr = _.ReactDebugCurrentFrame;
@@ -7945,7 +7913,7 @@ function xu() {
7945
7913
  function br() {
7946
7914
  {
7947
7915
  if (sn.current) {
7948
- var h = q(sn.current.type);
7916
+ var h = B(sn.current.type);
7949
7917
  if (h)
7950
7918
  return `
7951
7919
 
@@ -7979,8 +7947,8 @@ Check the top-level render call using <` + E + ">.");
7979
7947
  if (gr[E])
7980
7948
  return;
7981
7949
  gr[E] = !0;
7982
- var M = "";
7983
- h && h._owner && h._owner !== sn.current && (M = " It was passed a child from " + q(h._owner.type) + "."), Qe(h), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', E, M), Qe(null);
7950
+ var P = "";
7951
+ h && h._owner && h._owner !== sn.current && (P = " It was passed a child from " + B(h._owner.type) + "."), Qe(h), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', E, P), Qe(null);
7984
7952
  }
7985
7953
  }
7986
7954
  function mr(h, T) {
@@ -7989,16 +7957,16 @@ Check the top-level render call using <` + E + ">.");
7989
7957
  return;
7990
7958
  if (rn(h))
7991
7959
  for (var E = 0; E < h.length; E++) {
7992
- var M = h[E];
7993
- an(M) && _r(M, T);
7960
+ var P = h[E];
7961
+ an(P) && _r(P, T);
7994
7962
  }
7995
7963
  else if (an(h))
7996
7964
  h._store && (h._store.validated = !0);
7997
7965
  else if (h) {
7998
- var z = S(h);
7999
- if (typeof z == "function" && z !== h.entries)
8000
- for (var Q = z.call(h), L; !(L = Q.next()).done; )
8001
- an(L.value) && _r(L.value, T);
7966
+ var F = S(h);
7967
+ if (typeof F == "function" && F !== h.entries)
7968
+ for (var K = F.call(h), U; !(U = K.next()).done; )
7969
+ an(U.value) && _r(U.value, T);
8002
7970
  }
8003
7971
  }
8004
7972
  }
@@ -8017,63 +7985,63 @@ Check the top-level render call using <` + E + ">.");
8017
7985
  else
8018
7986
  return;
8019
7987
  if (E) {
8020
- var M = q(T);
8021
- ui(E, h.props, "prop", M, h);
7988
+ var P = B(T);
7989
+ ui(E, h.props, "prop", P, h);
8022
7990
  } else if (T.PropTypes !== void 0 && !on) {
8023
7991
  on = !0;
8024
- var z = q(T);
8025
- w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", z || "Unknown");
7992
+ var F = B(T);
7993
+ m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", F || "Unknown");
8026
7994
  }
8027
- typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
7995
+ typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
8028
7996
  }
8029
7997
  }
8030
7998
  function Ei(h) {
8031
7999
  {
8032
8000
  for (var T = Object.keys(h.props), E = 0; E < T.length; E++) {
8033
- var M = T[E];
8034
- if (M !== "children" && M !== "key") {
8035
- Qe(h), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", M), Qe(null);
8001
+ var P = T[E];
8002
+ if (P !== "children" && P !== "key") {
8003
+ Qe(h), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", P), Qe(null);
8036
8004
  break;
8037
8005
  }
8038
8006
  }
8039
- h.ref !== null && (Qe(h), w("Invalid attribute `ref` supplied to `React.Fragment`."), Qe(null));
8007
+ h.ref !== null && (Qe(h), m("Invalid attribute `ref` supplied to `React.Fragment`."), Qe(null));
8040
8008
  }
8041
8009
  }
8042
8010
  var wr = {};
8043
- function Tr(h, T, E, M, z, Q) {
8011
+ function Tr(h, T, E, P, F, K) {
8044
8012
  {
8045
- var L = G(h);
8046
- if (!L) {
8013
+ var U = Ae(h);
8014
+ if (!U) {
8047
8015
  var $ = "";
8048
8016
  (h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && ($ += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
8049
- var fe = Ti();
8050
- fe ? $ += fe : $ += br();
8051
- var ee;
8052
- h === null ? ee = "null" : rn(h) ? ee = "array" : h !== void 0 && h.$$typeof === t ? (ee = "<" + (q(h.type) || "Unknown") + " />", $ = " Did you accidentally export a JSX literal instead of a component?") : ee = typeof h, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ee, $);
8017
+ var ce = Ti();
8018
+ ce ? $ += ce : $ += br();
8019
+ var Y;
8020
+ h === null ? Y = "null" : rn(h) ? Y = "array" : h !== void 0 && h.$$typeof === t ? (Y = "<" + (B(h.type) || "Unknown") + " />", $ = " Did you accidentally export a JSX literal instead of a component?") : Y = typeof h, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Y, $);
8053
8021
  }
8054
- var re = wi(h, T, E, z, Q);
8055
- if (re == null)
8056
- return re;
8057
- if (L) {
8058
- var Te = T.children;
8059
- if (Te !== void 0)
8060
- if (M)
8061
- if (rn(Te)) {
8062
- for (var Be = 0; Be < Te.length; Be++)
8063
- mr(Te[Be], h);
8064
- Object.freeze && Object.freeze(Te);
8022
+ var X = wi(h, T, E, F, K);
8023
+ if (X == null)
8024
+ return X;
8025
+ if (U) {
8026
+ var we = T.children;
8027
+ if (we !== void 0)
8028
+ if (P)
8029
+ if (rn(we)) {
8030
+ for (var Be = 0; Be < we.length; Be++)
8031
+ mr(we[Be], h);
8032
+ Object.freeze && Object.freeze(we);
8065
8033
  } else
8066
- w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
8034
+ m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
8067
8035
  else
8068
- mr(Te, h);
8036
+ mr(we, h);
8069
8037
  }
8070
8038
  if (ct.call(T, "key")) {
8071
- var De = q(h), pe = Object.keys(T).filter(function(Pi) {
8039
+ var De = B(h), de = Object.keys(T).filter(function(Pi) {
8072
8040
  return Pi !== "key";
8073
- }), cn = pe.length > 0 ? "{key: someKey, " + pe.join(": ..., ") + ": ...}" : "{key: someKey}";
8041
+ }), cn = de.length > 0 ? "{key: someKey, " + de.join(": ..., ") + ": ...}" : "{key: someKey}";
8074
8042
  if (!wr[De + cn]) {
8075
- var Ii = pe.length > 0 ? "{" + pe.join(": ..., ") + ": ...}" : "{}";
8076
- w(`A props object containing a "key" prop is being spread into JSX:
8043
+ var Ii = de.length > 0 ? "{" + de.join(": ..., ") + ": ...}" : "{}";
8044
+ m(`A props object containing a "key" prop is being spread into JSX:
8077
8045
  let props = %s;
8078
8046
  <%s {...props} />
8079
8047
  React keys must be passed directly to JSX without using spread:
@@ -8081,7 +8049,7 @@ React keys must be passed directly to JSX without using spread:
8081
8049
  <%s key={someKey} {...props} />`, cn, De, Ii, De), wr[De + cn] = !0;
8082
8050
  }
8083
8051
  }
8084
- return h === s ? Ei(re) : vi(re), re;
8052
+ return h === s ? Ei(X) : vi(X), X;
8085
8053
  }
8086
8054
  }
8087
8055
  function Oi(h, T, E) {
@@ -8096,7 +8064,7 @@ React keys must be passed directly to JSX without using spread:
8096
8064
  }
8097
8065
  var $u = {};
8098
8066
  $u.NODE_ENV === "production" ? Un.exports = ju() : Un.exports = xu();
8099
- var ce = Un.exports;
8067
+ var oe = Un.exports;
8100
8068
  const Du = {
8101
8069
  isLoading: !0,
8102
8070
  data: void 0,
@@ -8114,7 +8082,7 @@ function is(n) {
8114
8082
  }
8115
8083
  function Uu(n, e, t, r) {
8116
8084
  e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
8117
- const s = e ? ri(e) : null, i = se(s), o = $e(is(n._reactor.getPreviousResult(s))), a = $e(Du), c = Me(
8085
+ const s = e ? ri(e) : null, i = ee(s), o = $e(is(n._reactor.getPreviousResult(s))), a = $e(Du), c = Me(
8118
8086
  (l) => (o.current = is(n._reactor.getPreviousResult(s)), l(), s ? n.subscribeQuery(s, (d) => {
8119
8087
  o.current = {
8120
8088
  isLoading: !d,
@@ -8140,7 +8108,7 @@ const Lu = {
8140
8108
  canLoadNextPage: !1
8141
8109
  };
8142
8110
  function Fu({ core: n, query: e, opts: t }) {
8143
- const r = $e(null), s = se(e), i = se(t), o = Su(n, e, t), a = $e({
8111
+ const r = $e(null), s = ee(e), i = ee(t), o = Su(n, e, t), a = $e({
8144
8112
  ...o,
8145
8113
  isLoading: !o.data && !o.error
8146
8114
  }), c = Me((f) => {
@@ -8491,7 +8459,7 @@ class Nt {
8491
8459
  p(this, "useUser", () => {
8492
8460
  const { user: e } = this.useAuth();
8493
8461
  if (!e)
8494
- throw new ue("useUser must be used within an auth-protected route");
8462
+ throw new le("useUser must be used within an auth-protected route");
8495
8463
  return e;
8496
8464
  });
8497
8465
  /**
@@ -8581,7 +8549,7 @@ class Nt {
8581
8549
  */
8582
8550
  p(this, "SignedIn", ({ children: e }) => {
8583
8551
  const t = this.useAuth();
8584
- return t.isLoading || t.error || !t.user ? null : ce.jsx(ce.Fragment, { children: e });
8552
+ return t.isLoading || t.error || !t.user ? null : oe.jsx(oe.Fragment, { children: e });
8585
8553
  });
8586
8554
  /**
8587
8555
  * Only render children if the user is signed out.
@@ -8595,7 +8563,7 @@ class Nt {
8595
8563
  */
8596
8564
  p(this, "SignedOut", ({ children: e }) => {
8597
8565
  const t = this.useAuth();
8598
- return t.isLoading || t.error || t.user ? null : ce.jsx(ce.Fragment, { children: e });
8566
+ return t.isLoading || t.error || t.user ? null : oe.jsx(oe.Fragment, { children: e });
8599
8567
  });
8600
8568
  this.core = Mu(
8601
8569
  e,
@@ -8659,9 +8627,9 @@ function Hu(n) {
8659
8627
  const { onEvent: e = _n, onError: t = _n, onRetry: r = _n, onComment: s } = n;
8660
8628
  let i = "", o = !0, a, c = "", u = "";
8661
8629
  function l(g) {
8662
- const m = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [S, _] = Ju(`${i}${m}`);
8663
- for (const w of S)
8664
- f(w);
8630
+ const w = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [S, _] = Ju(`${i}${w}`);
8631
+ for (const m of S)
8632
+ f(m);
8665
8633
  i = _, o = !1;
8666
8634
  }
8667
8635
  function f(g) {
@@ -8673,31 +8641,31 @@ function Hu(n) {
8673
8641
  s && s(g.slice(g.startsWith(": ") ? 2 : 1));
8674
8642
  return;
8675
8643
  }
8676
- const m = g.indexOf(":");
8677
- if (m !== -1) {
8678
- const S = g.slice(0, m), _ = g[m + 1] === " " ? 2 : 1, w = g.slice(m + _);
8679
- d(S, w, g);
8644
+ const w = g.indexOf(":");
8645
+ if (w !== -1) {
8646
+ const S = g.slice(0, w), _ = g[w + 1] === " " ? 2 : 1, m = g.slice(w + _);
8647
+ d(S, m, g);
8680
8648
  return;
8681
8649
  }
8682
8650
  d(g, "", g);
8683
8651
  }
8684
- function d(g, m, S) {
8652
+ function d(g, w, S) {
8685
8653
  switch (g) {
8686
8654
  case "event":
8687
- u = m;
8655
+ u = w;
8688
8656
  break;
8689
8657
  case "data":
8690
- c = `${c}${m}
8658
+ c = `${c}${w}
8691
8659
  `;
8692
8660
  break;
8693
8661
  case "id":
8694
- a = m.includes("\0") ? void 0 : m;
8662
+ a = w.includes("\0") ? void 0 : w;
8695
8663
  break;
8696
8664
  case "retry":
8697
- /^\d+$/.test(m) ? r(parseInt(m, 10)) : t(
8698
- new os(`Invalid \`retry\` value: "${m}"`, {
8665
+ /^\d+$/.test(w) ? r(parseInt(w, 10)) : t(
8666
+ new os(`Invalid \`retry\` value: "${w}"`, {
8699
8667
  type: "invalid-retry",
8700
- value: m,
8668
+ value: w,
8701
8669
  line: S
8702
8670
  })
8703
8671
  );
@@ -8706,7 +8674,7 @@ function Hu(n) {
8706
8674
  t(
8707
8675
  new os(
8708
8676
  `Unknown field "${g.length > 20 ? `${g.slice(0, 20)}…` : g}"`,
8709
- { type: "unknown-field", field: g, value: m, line: S }
8677
+ { type: "unknown-field", field: g, value: w, line: S }
8710
8678
  )
8711
8679
  );
8712
8680
  break;
@@ -8806,69 +8774,69 @@ function cs(n) {
8806
8774
  }
8807
8775
  var si = (n) => {
8808
8776
  throw TypeError(n);
8809
- }, or = (n, e, t) => e.has(n) || si("Cannot " + t), x = (n, e, t) => (or(n, e, "read from private field"), t ? t.call(n) : e.get(n)), oe = (n, e, t) => e.has(n) ? si("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), Y = (n, e, t, r) => (or(n, e, "write to private field"), e.set(n, t), t), Pe = (n, e, t) => (or(n, e, "access private method"), t), ye, Fe, Ye, Kt, Ht, Tt, tt, St, xe, Ze, rt, Xe, gt, Ee, Fn, Nn, Kn, us, Wn, qn, _t, zn, Vn;
8777
+ }, or = (n, e, t) => e.has(n) || si("Cannot " + t), j = (n, e, t) => (or(n, e, "read from private field"), t ? t.call(n) : e.get(n)), ne = (n, e, t) => e.has(n) ? si("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), G = (n, e, t, r) => (or(n, e, "write to private field"), e.set(n, t), t), Pe = (n, e, t) => (or(n, e, "access private method"), t), he, Fe, Ye, Kt, Ht, Tt, tt, St, xe, Ze, rt, Xe, gt, ve, Fn, Nn, Kn, us, Wn, qn, _t, zn, Vn;
8810
8778
  class Wt extends EventTarget {
8811
8779
  constructor(e, t) {
8812
8780
  var r, s;
8813
- super(), oe(this, Ee), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, oe(this, ye), oe(this, Fe), oe(this, Ye), oe(this, Kt), oe(this, Ht), oe(this, Tt), oe(this, tt), oe(this, St, null), oe(this, xe), oe(this, Ze), oe(this, rt, null), oe(this, Xe, null), oe(this, gt, null), oe(this, Nn, async (i) => {
8781
+ super(), ne(this, ve), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, ne(this, he), ne(this, Fe), ne(this, Ye), ne(this, Kt), ne(this, Ht), ne(this, Tt), ne(this, tt), ne(this, St, null), ne(this, xe), ne(this, Ze), ne(this, rt, null), ne(this, Xe, null), ne(this, gt, null), ne(this, Nn, async (i) => {
8814
8782
  var o;
8815
- x(this, Ze).reset();
8783
+ j(this, Ze).reset();
8816
8784
  const { body: a, redirected: c, status: u, headers: l } = i;
8817
8785
  if (u === 204) {
8818
- Pe(this, Ee, _t).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
8786
+ Pe(this, ve, _t).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
8819
8787
  return;
8820
8788
  }
8821
- if (c ? Y(this, Ye, new URL(i.url)) : Y(this, Ye, void 0), u !== 200) {
8822
- Pe(this, Ee, _t).call(this, `Non-200 status code (${u})`, u);
8789
+ if (c ? G(this, Ye, new URL(i.url)) : G(this, Ye, void 0), u !== 200) {
8790
+ Pe(this, ve, _t).call(this, `Non-200 status code (${u})`, u);
8823
8791
  return;
8824
8792
  }
8825
8793
  if (!(l.get("content-type") || "").startsWith("text/event-stream")) {
8826
- Pe(this, Ee, _t).call(this, 'Invalid content type, expected "text/event-stream"', u);
8794
+ Pe(this, ve, _t).call(this, 'Invalid content type, expected "text/event-stream"', u);
8827
8795
  return;
8828
8796
  }
8829
- if (x(this, ye) === this.CLOSED)
8797
+ if (j(this, he) === this.CLOSED)
8830
8798
  return;
8831
- Y(this, ye, this.OPEN);
8799
+ G(this, he, this.OPEN);
8832
8800
  const f = new Event("open");
8833
- if ((o = x(this, gt)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
8834
- Pe(this, Ee, _t).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
8801
+ if ((o = j(this, gt)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
8802
+ Pe(this, ve, _t).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
8835
8803
  return;
8836
8804
  }
8837
8805
  const d = new TextDecoder(), y = a.getReader();
8838
8806
  let b = !0;
8839
8807
  do {
8840
- const { done: g, value: m } = await y.read();
8841
- m && x(this, Ze).feed(d.decode(m, { stream: !g })), g && (b = !1, x(this, Ze).reset(), Pe(this, Ee, zn).call(this));
8808
+ const { done: g, value: w } = await y.read();
8809
+ w && j(this, Ze).feed(d.decode(w, { stream: !g })), g && (b = !1, j(this, Ze).reset(), Pe(this, ve, zn).call(this));
8842
8810
  } while (b);
8843
- }), oe(this, Kn, (i) => {
8844
- Y(this, xe, void 0), !(i.name === "AbortError" || i.type === "aborted") && Pe(this, Ee, zn).call(this, Ln(i));
8845
- }), oe(this, Wn, (i) => {
8846
- typeof i.id == "string" && Y(this, St, i.id);
8811
+ }), ne(this, Kn, (i) => {
8812
+ G(this, xe, void 0), !(i.name === "AbortError" || i.type === "aborted") && Pe(this, ve, zn).call(this, Ln(i));
8813
+ }), ne(this, Wn, (i) => {
8814
+ typeof i.id == "string" && G(this, St, i.id);
8847
8815
  const o = new MessageEvent(i.event || "message", {
8848
8816
  data: i.data,
8849
- origin: x(this, Ye) ? x(this, Ye).origin : x(this, Fe).origin,
8817
+ origin: j(this, Ye) ? j(this, Ye).origin : j(this, Fe).origin,
8850
8818
  lastEventId: i.id || ""
8851
8819
  });
8852
- x(this, Xe) && (!i.event || i.event === "message") && x(this, Xe).call(this, o), this.dispatchEvent(o);
8853
- }), oe(this, qn, (i) => {
8854
- Y(this, Tt, i);
8855
- }), oe(this, Vn, () => {
8856
- Y(this, tt, void 0), x(this, ye) === this.CONNECTING && Pe(this, Ee, Fn).call(this);
8820
+ j(this, Xe) && (!i.event || i.event === "message") && j(this, Xe).call(this, o), this.dispatchEvent(o);
8821
+ }), ne(this, qn, (i) => {
8822
+ G(this, Tt, i);
8823
+ }), ne(this, Vn, () => {
8824
+ G(this, tt, void 0), j(this, he) === this.CONNECTING && Pe(this, ve, Fn).call(this);
8857
8825
  });
8858
8826
  try {
8859
8827
  if (e instanceof URL)
8860
- Y(this, Fe, e);
8828
+ G(this, Fe, e);
8861
8829
  else if (typeof e == "string")
8862
- Y(this, Fe, new URL(e, Zu()));
8830
+ G(this, Fe, new URL(e, Zu()));
8863
8831
  else
8864
8832
  throw new Error("Invalid URL");
8865
8833
  } catch {
8866
8834
  throw Yu("An invalid or illegal string was specified");
8867
8835
  }
8868
- Y(this, Ze, Hu({
8869
- onEvent: x(this, Wn),
8870
- onRetry: x(this, qn)
8871
- })), Y(this, ye, this.CONNECTING), Y(this, Tt, 3e3), Y(this, Ht, (r = t == null ? void 0 : t.fetch) != null ? r : globalThis.fetch), Y(this, Kt, (s = t == null ? void 0 : t.withCredentials) != null ? s : !1), Pe(this, Ee, Fn).call(this);
8836
+ G(this, Ze, Hu({
8837
+ onEvent: j(this, Wn),
8838
+ onRetry: j(this, qn)
8839
+ })), G(this, he, this.CONNECTING), G(this, Tt, 3e3), G(this, Ht, (r = t == null ? void 0 : t.fetch) != null ? r : globalThis.fetch), G(this, Kt, (s = t == null ? void 0 : t.withCredentials) != null ? s : !1), Pe(this, ve, Fn).call(this);
8872
8840
  }
8873
8841
  /**
8874
8842
  * Returns the state of this EventSource object's connection. It can have the values described below.
@@ -8881,7 +8849,7 @@ class Wt extends EventTarget {
8881
8849
  * @public
8882
8850
  */
8883
8851
  get readyState() {
8884
- return x(this, ye);
8852
+ return j(this, he);
8885
8853
  }
8886
8854
  /**
8887
8855
  * Returns the URL providing the event stream.
@@ -8891,7 +8859,7 @@ class Wt extends EventTarget {
8891
8859
  * @public
8892
8860
  */
8893
8861
  get url() {
8894
- return x(this, Fe).href;
8862
+ return j(this, Fe).href;
8895
8863
  }
8896
8864
  /**
8897
8865
  * Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
@@ -8899,28 +8867,28 @@ class Wt extends EventTarget {
8899
8867
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
8900
8868
  */
8901
8869
  get withCredentials() {
8902
- return x(this, Kt);
8870
+ return j(this, Kt);
8903
8871
  }
8904
8872
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
8905
8873
  get onerror() {
8906
- return x(this, rt);
8874
+ return j(this, rt);
8907
8875
  }
8908
8876
  set onerror(e) {
8909
- Y(this, rt, e);
8877
+ G(this, rt, e);
8910
8878
  }
8911
8879
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
8912
8880
  get onmessage() {
8913
- return x(this, Xe);
8881
+ return j(this, Xe);
8914
8882
  }
8915
8883
  set onmessage(e) {
8916
- Y(this, Xe, e);
8884
+ G(this, Xe, e);
8917
8885
  }
8918
8886
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
8919
8887
  get onopen() {
8920
- return x(this, gt);
8888
+ return j(this, gt);
8921
8889
  }
8922
8890
  set onopen(e) {
8923
- Y(this, gt, e);
8891
+ G(this, gt, e);
8924
8892
  }
8925
8893
  addEventListener(e, t, r) {
8926
8894
  const s = t;
@@ -8938,16 +8906,16 @@ class Wt extends EventTarget {
8938
8906
  * @public
8939
8907
  */
8940
8908
  close() {
8941
- x(this, tt) && clearTimeout(x(this, tt)), x(this, ye) !== this.CLOSED && (x(this, xe) && x(this, xe).abort(), Y(this, ye, this.CLOSED), Y(this, xe, void 0));
8909
+ j(this, tt) && clearTimeout(j(this, tt)), j(this, he) !== this.CLOSED && (j(this, xe) && j(this, xe).abort(), G(this, he, this.CLOSED), G(this, xe, void 0));
8942
8910
  }
8943
8911
  }
8944
- ye = /* @__PURE__ */ new WeakMap(), Fe = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), Kt = /* @__PURE__ */ new WeakMap(), Ht = /* @__PURE__ */ new WeakMap(), Tt = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), Ee = /* @__PURE__ */ new WeakSet(), /**
8912
+ he = /* @__PURE__ */ new WeakMap(), Fe = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), Kt = /* @__PURE__ */ new WeakMap(), Ht = /* @__PURE__ */ new WeakMap(), Tt = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakSet(), /**
8945
8913
  * Connect to the given URL and start receiving events
8946
8914
  *
8947
8915
  * @internal
8948
8916
  */
8949
8917
  Fn = function() {
8950
- Y(this, ye, this.CONNECTING), Y(this, xe, new AbortController()), x(this, Ht)(x(this, Fe), Pe(this, Ee, us).call(this)).then(x(this, Nn)).catch(x(this, Kn));
8918
+ G(this, he, this.CONNECTING), G(this, xe, new AbortController()), j(this, Ht)(j(this, Fe), Pe(this, ve, us).call(this)).then(j(this, Nn)).catch(j(this, Kn));
8951
8919
  }, Nn = /* @__PURE__ */ new WeakMap(), Kn = /* @__PURE__ */ new WeakMap(), /**
8952
8920
  * Get request options for the `fetch()` request
8953
8921
  *
@@ -8961,9 +8929,9 @@ us = function() {
8961
8929
  // [spec] …will have their mode set to "cors"…
8962
8930
  mode: "cors",
8963
8931
  redirect: "follow",
8964
- headers: { Accept: "text/event-stream", ...x(this, St) ? { "Last-Event-ID": x(this, St) } : void 0 },
8932
+ headers: { Accept: "text/event-stream", ...j(this, St) ? { "Last-Event-ID": j(this, St) } : void 0 },
8965
8933
  cache: "no-store",
8966
- signal: (n = x(this, xe)) == null ? void 0 : n.signal
8934
+ signal: (n = j(this, xe)) == null ? void 0 : n.signal
8967
8935
  };
8968
8936
  return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
8969
8937
  }, Wn = /* @__PURE__ */ new WeakMap(), qn = /* @__PURE__ */ new WeakMap(), /**
@@ -8975,9 +8943,9 @@ us = function() {
8975
8943
  */
8976
8944
  _t = function(n, e) {
8977
8945
  var t;
8978
- x(this, ye) !== this.CLOSED && Y(this, ye, this.CLOSED);
8946
+ j(this, he) !== this.CLOSED && G(this, he, this.CLOSED);
8979
8947
  const r = new as("error", { code: e, message: n });
8980
- (t = x(this, rt)) == null || t.call(this, r), this.dispatchEvent(r);
8948
+ (t = j(this, rt)) == null || t.call(this, r), this.dispatchEvent(r);
8981
8949
  }, /**
8982
8950
  * Schedules a reconnection attempt against the EventSource endpoint.
8983
8951
  *
@@ -8987,11 +8955,11 @@ _t = function(n, e) {
8987
8955
  */
8988
8956
  zn = function(n, e) {
8989
8957
  var t;
8990
- if (x(this, ye) === this.CLOSED)
8958
+ if (j(this, he) === this.CLOSED)
8991
8959
  return;
8992
- Y(this, ye, this.CONNECTING);
8960
+ G(this, he, this.CONNECTING);
8993
8961
  const r = new as("error", { code: e, message: n });
8994
- (t = x(this, rt)) == null || t.call(this, r), this.dispatchEvent(r), Y(this, tt, setTimeout(x(this, Vn), x(this, Tt)));
8962
+ (t = j(this, rt)) == null || t.call(this, r), this.dispatchEvent(r), G(this, tt, setTimeout(j(this, Vn), j(this, Tt)));
8995
8963
  }, Vn = /* @__PURE__ */ new WeakMap(), /**
8996
8964
  * ReadyState representing an EventSource currently trying to connect
8997
8965
  *
@@ -9040,36 +9008,36 @@ function ll({
9040
9008
  const l = e || `cursors-space-default--${String(t.type)}-${t.id}`, f = t.usePresence({
9041
9009
  keys: [l]
9042
9010
  }), d = t._core._reactor.getPresence(t.type, t.id);
9043
- function y(_, w) {
9044
- const C = w.clientX, v = w.clientY, U = (C - _.left) / _.width * 100, I = (v - _.top) / _.height * 100;
9011
+ function y(_, m) {
9012
+ const A = m.clientX, v = m.clientY, I = (A - _.left) / _.width * 100, x = (v - _.top) / _.height * 100;
9045
9013
  f.publishPresence({
9046
9014
  [l]: {
9047
- x: C,
9015
+ x: A,
9048
9016
  y: v,
9049
- xPercent: U,
9050
- yPercent: I,
9017
+ xPercent: I,
9018
+ yPercent: x,
9051
9019
  color: i
9052
9020
  }
9053
9021
  });
9054
9022
  }
9055
9023
  function b(_) {
9056
9024
  c || _.stopPropagation();
9057
- const w = _.currentTarget.getBoundingClientRect();
9058
- y(w, _);
9025
+ const m = _.currentTarget.getBoundingClientRect();
9026
+ y(m, _);
9059
9027
  }
9060
9028
  function g(_) {
9061
9029
  f.publishPresence({
9062
9030
  [l]: void 0
9063
9031
  });
9064
9032
  }
9065
- function m(_) {
9033
+ function w(_) {
9066
9034
  if (_.touches.length !== 1)
9067
9035
  return;
9068
- const w = _.touches[0];
9069
- if (w.target instanceof Element) {
9036
+ const m = _.touches[0];
9037
+ if (m.target instanceof Element) {
9070
9038
  c || _.stopPropagation();
9071
- const C = w.target.getBoundingClientRect();
9072
- y(C, w);
9039
+ const A = m.target.getBoundingClientRect();
9040
+ y(A, m);
9073
9041
  }
9074
9042
  }
9075
9043
  function S(_) {
@@ -9082,7 +9050,7 @@ function ll({
9082
9050
  {
9083
9051
  onMouseMove: b,
9084
9052
  onMouseOut: g,
9085
- onTouchMove: m,
9053
+ onTouchMove: w,
9086
9054
  onTouchEnd: S,
9087
9055
  className: r,
9088
9056
  style: {
@@ -9092,7 +9060,7 @@ function ll({
9092
9060
  },
9093
9061
  [
9094
9062
  o,
9095
- /* @__PURE__ */ ce.jsx(
9063
+ /* @__PURE__ */ oe.jsx(
9096
9064
  "div",
9097
9065
  {
9098
9066
  style: {
@@ -9100,21 +9068,21 @@ function ll({
9100
9068
  ...tl,
9101
9069
  zIndex: u !== void 0 ? u : nl
9102
9070
  },
9103
- children: Object.entries(f.peers).map(([_, w]) => {
9104
- const C = w[l];
9105
- return C ? /* @__PURE__ */ ce.jsx(
9071
+ children: Object.entries(f.peers).map(([_, m]) => {
9072
+ const A = m[l];
9073
+ return A ? /* @__PURE__ */ oe.jsx(
9106
9074
  "div",
9107
9075
  {
9108
9076
  style: {
9109
9077
  ...ls,
9110
- transform: `translate(${C.xPercent}%, ${C.yPercent}%)`,
9078
+ transform: `translate(${A.xPercent}%, ${A.yPercent}%)`,
9111
9079
  transformOrigin: "0 0",
9112
9080
  transition: "transform 100ms"
9113
9081
  },
9114
9082
  children: a ? a({
9115
- color: C.color,
9083
+ color: A.color,
9116
9084
  presence: d == null ? void 0 : d.peers[_]
9117
- }) : /* @__PURE__ */ ce.jsx(el, { ...C })
9085
+ }) : /* @__PURE__ */ oe.jsx(el, { ...A })
9118
9086
  },
9119
9087
  _
9120
9088
  ) : null;
@@ -9127,7 +9095,7 @@ function ll({
9127
9095
  }
9128
9096
  function el({ color: n }) {
9129
9097
  const t = n || "black";
9130
- return /* @__PURE__ */ ce.jsxs(
9098
+ return /* @__PURE__ */ oe.jsxs(
9131
9099
  "svg",
9132
9100
  {
9133
9101
  style: { height: 35, width: 35 },
@@ -9135,36 +9103,36 @@ function el({ color: n }) {
9135
9103
  fill: "none",
9136
9104
  xmlns: "http://www.w3.org/2000/svg",
9137
9105
  children: [
9138
- /* @__PURE__ */ ce.jsxs(
9106
+ /* @__PURE__ */ oe.jsxs(
9139
9107
  "g",
9140
9108
  {
9141
9109
  fill: "rgba(0,0,0,.2)",
9142
9110
  transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
9143
9111
  children: [
9144
- /* @__PURE__ */ ce.jsx("path", { d: "m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z" }),
9145
- /* @__PURE__ */ ce.jsx("path", { d: "m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z" })
9112
+ /* @__PURE__ */ oe.jsx("path", { d: "m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z" }),
9113
+ /* @__PURE__ */ oe.jsx("path", { d: "m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z" })
9146
9114
  ]
9147
9115
  }
9148
9116
  ),
9149
- /* @__PURE__ */ ce.jsxs(
9117
+ /* @__PURE__ */ oe.jsxs(
9150
9118
  "g",
9151
9119
  {
9152
9120
  fill: "white",
9153
9121
  transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
9154
9122
  children: [
9155
- /* @__PURE__ */ ce.jsx("path", { d: "m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z" }),
9156
- /* @__PURE__ */ ce.jsx("path", { d: "m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z" })
9123
+ /* @__PURE__ */ oe.jsx("path", { d: "m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z" }),
9124
+ /* @__PURE__ */ oe.jsx("path", { d: "m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z" })
9157
9125
  ]
9158
9126
  }
9159
9127
  ),
9160
- /* @__PURE__ */ ce.jsxs(
9128
+ /* @__PURE__ */ oe.jsxs(
9161
9129
  "g",
9162
9130
  {
9163
9131
  fill: t,
9164
9132
  transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
9165
9133
  children: [
9166
- /* @__PURE__ */ ce.jsx("path", { d: "m19.751 24.4155-1.844.774-3.1-7.374 1.841-.775z" }),
9167
- /* @__PURE__ */ ce.jsx("path", { d: "m13 10.814v11.188l2.969-2.866.428-.139h4.768z" })
9134
+ /* @__PURE__ */ oe.jsx("path", { d: "m19.751 24.4155-1.844.774-3.1-7.374 1.841-.775z" }),
9135
+ /* @__PURE__ */ oe.jsx("path", { d: "m13 10.814v11.188l2.969-2.866.428-.139h4.768z" })
9168
9136
  ]
9169
9137
  }
9170
9138
  )
@@ -9192,7 +9160,7 @@ export {
9192
9160
  Ue as SyncTableCallbackEventType,
9193
9161
  cl as createInstantRouteHandler,
9194
9162
  al as i,
9195
- Z as id,
9163
+ H as id,
9196
9164
  Xu as init,
9197
9165
  ul as init_experimental,
9198
9166
  Ea as lookup,