@instantdb/react-common 0.22.60 → 0.22.61-experimental.delay-looking-at-store.19555739599.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import Sr, { useRef as ze, useCallback as de, useSyncExternalStore as Rt, useEffect as Te, useMemo as $t, useState as Or } from "react";
2
- var xt = { exports: {} }, $e = {};
1
+ import Sr, { useRef as Ve, useCallback as de, useSyncExternalStore as Rt, useEffect as Te, useMemo as $t, useState as Or } from "react";
2
+ var xt = { exports: {} }, xe = {};
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.min.js
@@ -11,7 +11,7 @@ var xt = { exports: {} }, $e = {};
11
11
  */
12
12
  var Ln;
13
13
  function Ni() {
14
- if (Ln) return $e;
14
+ if (Ln) return xe;
15
15
  Ln = 1;
16
16
  var t = Sr, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
17
17
  function o(u, a, d) {
@@ -21,11 +21,11 @@ function Ni() {
21
21
  if (u && u.defaultProps) for (c in a = u.defaultProps, a) f[c] === void 0 && (f[c] = a[c]);
22
22
  return { $$typeof: e, type: u, key: l, ref: p, props: f, _owner: i.current };
23
23
  }
24
- return $e.Fragment = n, $e.jsx = o, $e.jsxs = o, $e;
24
+ return xe.Fragment = n, xe.jsx = o, xe.jsxs = o, xe;
25
25
  }
26
- var xe = {}, Fn;
26
+ var De = {}, Fn;
27
27
  function Ki() {
28
- if (Fn) return xe;
28
+ if (Fn) return De;
29
29
  Fn = 1;
30
30
  var t = {};
31
31
  /**
@@ -39,23 +39,23 @@ function Ki() {
39
39
  */
40
40
  return t.NODE_ENV !== "production" && function() {
41
41
  var e = Sr, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), a = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, g = "@@iterator";
42
- function T(h) {
42
+ function m(h) {
43
43
  if (h === null || typeof h != "object")
44
44
  return null;
45
45
  var _ = b && h[b] || h[g];
46
46
  return typeof _ == "function" ? _ : null;
47
47
  }
48
- var m = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
48
+ var T = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
49
49
  function v(h) {
50
50
  {
51
- for (var _ = arguments.length, w = new Array(_ > 1 ? _ - 1 : 0), S = 1; S < _; S++)
52
- w[S - 1] = arguments[S];
51
+ for (var _ = arguments.length, w = new Array(_ > 1 ? _ - 1 : 0), O = 1; O < _; O++)
52
+ w[O - 1] = arguments[O];
53
53
  k("error", h, w);
54
54
  }
55
55
  }
56
56
  function k(h, _, w) {
57
57
  {
58
- var S = m.ReactDebugCurrentFrame, C = S.getStackAddendum();
58
+ var O = T.ReactDebugCurrentFrame, C = O.getStackAddendum();
59
59
  C !== "" && (_ += "%s", w = w.concat([C]));
60
60
  var P = w.map(function(j) {
61
61
  return String(j);
@@ -63,19 +63,19 @@ function Ki() {
63
63
  P.unshift("Warning: " + _), Function.prototype.apply.call(console[h], console, P);
64
64
  }
65
65
  }
66
- var O = !1, I = !1, R = !1, F = !1, le = !1, Qe;
67
- Qe = Symbol.for("react.module.reference");
66
+ var S = !1, I = !1, R = !1, F = !1, le = !1, ve;
67
+ ve = Symbol.for("react.module.reference");
68
68
  function _t(h) {
69
- return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || le || h === s || h === c || h === f || F || h === y || O || I || R || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof === u || h.$$typeof === a || h.$$typeof === d || // This needs to include all possible module reference object
69
+ return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || le || h === s || h === c || h === f || F || h === y || S || I || R || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof === u || h.$$typeof === a || h.$$typeof === d || // This needs to include all possible module reference object
70
70
  // types supported by any Flight configuration anywhere since
71
71
  // we don't know which Flight build this will end up being used
72
72
  // with.
73
- h.$$typeof === Qe || h.getModuleId !== void 0));
73
+ h.$$typeof === ve || h.getModuleId !== void 0));
74
74
  }
75
75
  function gt(h, _, w) {
76
- var S = h.displayName;
77
- if (S)
78
- return S;
76
+ var O = h.displayName;
77
+ if (O)
78
+ return O;
79
79
  var C = _.displayName || _.name || "";
80
80
  return C !== "" ? w + "(" + C + ")" : w;
81
81
  }
@@ -114,8 +114,8 @@ function Ki() {
114
114
  case d:
115
115
  return gt(h, h.render, "ForwardRef");
116
116
  case l:
117
- var S = h.displayName || null;
118
- return S !== null ? S : ne(h.type) || "Memo";
117
+ var O = h.displayName || null;
118
+ return O !== null ? O : ne(h.type) || "Memo";
119
119
  case p: {
120
120
  var C = h, P = C._payload, j = C._init;
121
121
  try {
@@ -127,13 +127,13 @@ function Ki() {
127
127
  }
128
128
  return null;
129
129
  }
130
- var he = Object.assign, Me = 0, yn, bn, _n, gn, Tn, mn, wn;
130
+ var he = Object.assign, Re = 0, yn, bn, _n, gn, Tn, mn, wn;
131
131
  function vn() {
132
132
  }
133
133
  vn.__reactDisabledLog = !0;
134
134
  function hi() {
135
135
  {
136
- if (Me === 0) {
136
+ if (Re === 0) {
137
137
  yn = console.log, bn = console.info, _n = console.warn, gn = console.error, Tn = console.group, mn = console.groupCollapsed, wn = console.groupEnd;
138
138
  var h = {
139
139
  configurable: !0,
@@ -151,12 +151,12 @@ function Ki() {
151
151
  groupEnd: h
152
152
  });
153
153
  }
154
- Me++;
154
+ Re++;
155
155
  }
156
156
  }
157
157
  function pi() {
158
158
  {
159
- if (Me--, Me === 0) {
159
+ if (Re--, Re === 0) {
160
160
  var h = {
161
161
  configurable: !0,
162
162
  enumerable: !0,
@@ -186,18 +186,18 @@ function Ki() {
186
186
  })
187
187
  });
188
188
  }
189
- Me < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
189
+ Re < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
190
190
  }
191
191
  }
192
- var Tt = m.ReactCurrentDispatcher, mt;
192
+ var Tt = T.ReactCurrentDispatcher, mt;
193
193
  function Ye(h, _, w) {
194
194
  {
195
195
  if (mt === void 0)
196
196
  try {
197
197
  throw Error();
198
198
  } catch (C) {
199
- var S = C.stack.trim().match(/\n( *(at )?)/);
200
- mt = S && S[1] || "";
199
+ var O = C.stack.trim().match(/\n( *(at )?)/);
200
+ mt = O && O[1] || "";
201
201
  }
202
202
  return `
203
203
  ` + mt + h;
@@ -216,7 +216,7 @@ function Ki() {
216
216
  if (w !== void 0)
217
217
  return w;
218
218
  }
219
- var S;
219
+ var O;
220
220
  wt = !0;
221
221
  var C = Error.prepareStackTrace;
222
222
  Error.prepareStackTrace = void 0;
@@ -235,14 +235,14 @@ function Ki() {
235
235
  try {
236
236
  Reflect.construct(j, []);
237
237
  } catch (W) {
238
- S = W;
238
+ O = W;
239
239
  }
240
240
  Reflect.construct(h, [], j);
241
241
  } else {
242
242
  try {
243
243
  j.call();
244
244
  } catch (W) {
245
- S = W;
245
+ O = W;
246
246
  }
247
247
  h.call(j.prototype);
248
248
  }
@@ -250,14 +250,14 @@ function Ki() {
250
250
  try {
251
251
  throw Error();
252
252
  } catch (W) {
253
- S = W;
253
+ O = W;
254
254
  }
255
255
  h();
256
256
  }
257
257
  } catch (W) {
258
- if (W && S && typeof W.stack == "string") {
258
+ if (W && O && typeof W.stack == "string") {
259
259
  for (var E = W.stack.split(`
260
- `), z = S.stack.split(`
260
+ `), z = O.stack.split(`
261
261
  `), $ = E.length - 1, D = z.length - 1; $ >= 1 && D >= 0 && E[$] !== z[D]; )
262
262
  D--;
263
263
  for (; $ >= 1 && D >= 0; $--, D--)
@@ -276,7 +276,7 @@ function Ki() {
276
276
  } finally {
277
277
  wt = !1, Tt.current = P, pi(), Error.prepareStackTrace = C;
278
278
  }
279
- var Se = h ? h.displayName || h.name : "", pe = Se ? Ye(Se) : "";
279
+ var Oe = h ? h.displayName || h.name : "", pe = Oe ? Ye(Oe) : "";
280
280
  return typeof h == "function" && Je.set(h, pe), pe;
281
281
  }
282
282
  function bi(h, _, w) {
@@ -306,7 +306,7 @@ function Ki() {
306
306
  case l:
307
307
  return Ze(h.type, _, w);
308
308
  case p: {
309
- var S = h, C = S._payload, P = S._init;
309
+ var O = h, C = O._payload, P = O._init;
310
310
  try {
311
311
  return Ze(P(C), _, w);
312
312
  } catch {
@@ -315,7 +315,7 @@ function Ki() {
315
315
  }
316
316
  return "";
317
317
  }
318
- var Re = Object.prototype.hasOwnProperty, On = {}, En = m.ReactDebugCurrentFrame;
318
+ var $e = Object.prototype.hasOwnProperty, On = {}, En = T.ReactDebugCurrentFrame;
319
319
  function Xe(h) {
320
320
  if (h) {
321
321
  var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
@@ -323,22 +323,22 @@ function Ki() {
323
323
  } else
324
324
  En.setExtraStackFrame(null);
325
325
  }
326
- function gi(h, _, w, S, C) {
326
+ function gi(h, _, w, O, C) {
327
327
  {
328
- var P = Function.call.bind(Re);
328
+ var P = Function.call.bind($e);
329
329
  for (var j in h)
330
330
  if (P(h, j)) {
331
331
  var E = void 0;
332
332
  try {
333
333
  if (typeof h[j] != "function") {
334
- var z = Error((S || "React class") + ": " + w + " type `" + j + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[j] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
334
+ var z = Error((O || "React class") + ": " + w + " type `" + j + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[j] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
335
335
  throw z.name = "Invariant Violation", z;
336
336
  }
337
- E = h[j](_, j, S, w, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
337
+ E = h[j](_, j, O, w, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
338
338
  } catch ($) {
339
339
  E = $;
340
340
  }
341
- E && !(E instanceof Error) && (Xe(C), v("%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).", S || "React class", w, j, typeof E), Xe(null)), E instanceof Error && !(E.message in On) && (On[E.message] = !0, Xe(C), v("Failed %s type: %s", w, E.message), Xe(null));
341
+ E && !(E instanceof Error) && (Xe(C), v("%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).", O || "React class", w, j, typeof E), Xe(null)), E instanceof Error && !(E.message in On) && (On[E.message] = !0, Xe(C), v("Failed %s type: %s", w, E.message), Xe(null));
342
342
  }
343
343
  }
344
344
  }
@@ -366,14 +366,14 @@ function Ki() {
366
366
  if (wi(h))
367
367
  return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", mi(h)), An(h);
368
368
  }
369
- var kn = m.ReactCurrentOwner, vi = {
369
+ var kn = T.ReactCurrentOwner, vi = {
370
370
  key: !0,
371
371
  ref: !0,
372
372
  __self: !0,
373
373
  __source: !0
374
374
  }, Cn, Pn;
375
375
  function Si(h) {
376
- if (Re.call(h, "ref")) {
376
+ if ($e.call(h, "ref")) {
377
377
  var _ = Object.getOwnPropertyDescriptor(h, "ref").get;
378
378
  if (_ && _.isReactWarning)
379
379
  return !1;
@@ -381,7 +381,7 @@ function Ki() {
381
381
  return h.ref !== void 0;
382
382
  }
383
383
  function Oi(h) {
384
- if (Re.call(h, "key")) {
384
+ if ($e.call(h, "key")) {
385
385
  var _ = Object.getOwnPropertyDescriptor(h, "key").get;
386
386
  if (_ && _.isReactWarning)
387
387
  return !1;
@@ -413,7 +413,7 @@ function Ki() {
413
413
  });
414
414
  }
415
415
  }
416
- var ki = function(h, _, w, S, C, P, j) {
416
+ var ki = function(h, _, w, O, C, P, j) {
417
417
  var E = {
418
418
  // This tag allows us to uniquely identify this as a React Element
419
419
  $$typeof: n,
@@ -434,7 +434,7 @@ function Ki() {
434
434
  configurable: !1,
435
435
  enumerable: !1,
436
436
  writable: !1,
437
- value: S
437
+ value: O
438
438
  }), Object.defineProperty(E, "_source", {
439
439
  configurable: !1,
440
440
  enumerable: !1,
@@ -442,12 +442,12 @@ function Ki() {
442
442
  value: C
443
443
  }), Object.freeze && (Object.freeze(E.props), Object.freeze(E)), E;
444
444
  };
445
- function Ci(h, _, w, S, C) {
445
+ function Ci(h, _, w, O, C) {
446
446
  {
447
447
  var P, j = {}, E = null, z = null;
448
448
  w !== void 0 && (jn(w), E = "" + w), Oi(_) && (jn(_.key), E = "" + _.key), Si(_) && (z = _.ref, Ei(_, C));
449
449
  for (P in _)
450
- Re.call(_, P) && !vi.hasOwnProperty(P) && (j[P] = _[P]);
450
+ $e.call(_, P) && !vi.hasOwnProperty(P) && (j[P] = _[P]);
451
451
  if (h && h.defaultProps) {
452
452
  var $ = h.defaultProps;
453
453
  for (P in $)
@@ -457,11 +457,11 @@ function Ki() {
457
457
  var D = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
458
458
  E && Ai(j, D), z && ji(j, D);
459
459
  }
460
- return ki(h, E, z, C, S, kn.current, j);
460
+ return ki(h, E, z, C, O, kn.current, j);
461
461
  }
462
462
  }
463
- var St = m.ReactCurrentOwner, In = m.ReactDebugCurrentFrame;
464
- function ve(h) {
463
+ var St = T.ReactCurrentOwner, In = T.ReactDebugCurrentFrame;
464
+ function Se(h) {
465
465
  if (h) {
466
466
  var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
467
467
  In.setExtraStackFrame(w);
@@ -510,8 +510,8 @@ Check the top-level render call using <` + w + ">.");
510
510
  if (Rn[w])
511
511
  return;
512
512
  Rn[w] = !0;
513
- var S = "";
514
- h && h._owner && h._owner !== St.current && (S = " It was passed a child from " + ne(h._owner.type) + "."), ve(h), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', w, S), ve(null);
513
+ var O = "";
514
+ h && h._owner && h._owner !== St.current && (O = " It was passed a child from " + ne(h._owner.type) + "."), Se(h), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', w, O), Se(null);
515
515
  }
516
516
  }
517
517
  function xn(h, _) {
@@ -520,13 +520,13 @@ Check the top-level render call using <` + w + ">.");
520
520
  return;
521
521
  if (vt(h))
522
522
  for (var w = 0; w < h.length; w++) {
523
- var S = h[w];
524
- Et(S) && $n(S, _);
523
+ var O = h[w];
524
+ Et(O) && $n(O, _);
525
525
  }
526
526
  else if (Et(h))
527
527
  h._store && (h._store.validated = !0);
528
528
  else if (h) {
529
- var C = T(h);
529
+ var C = m(h);
530
530
  if (typeof C == "function" && C !== h.entries)
531
531
  for (var P = C.call(h), j; !(j = P.next()).done; )
532
532
  Et(j.value) && $n(j.value, _);
@@ -548,8 +548,8 @@ Check the top-level render call using <` + w + ">.");
548
548
  else
549
549
  return;
550
550
  if (w) {
551
- var S = ne(_);
552
- gi(w, h.props, "prop", S, h);
551
+ var O = ne(_);
552
+ gi(w, h.props, "prop", O, h);
553
553
  } else if (_.PropTypes !== void 0 && !Ot) {
554
554
  Ot = !0;
555
555
  var C = ne(_);
@@ -561,17 +561,17 @@ Check the top-level render call using <` + w + ">.");
561
561
  function Ri(h) {
562
562
  {
563
563
  for (var _ = Object.keys(h.props), w = 0; w < _.length; w++) {
564
- var S = _[w];
565
- if (S !== "children" && S !== "key") {
566
- ve(h), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", S), ve(null);
564
+ var O = _[w];
565
+ if (O !== "children" && O !== "key") {
566
+ Se(h), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", O), Se(null);
567
567
  break;
568
568
  }
569
569
  }
570
- h.ref !== null && (ve(h), v("Invalid attribute `ref` supplied to `React.Fragment`."), ve(null));
570
+ h.ref !== null && (Se(h), v("Invalid attribute `ref` supplied to `React.Fragment`."), Se(null));
571
571
  }
572
572
  }
573
573
  var Dn = {};
574
- function Un(h, _, w, S, C, P) {
574
+ function Un(h, _, w, O, C, P) {
575
575
  {
576
576
  var j = _t(h);
577
577
  if (!j) {
@@ -588,17 +588,17 @@ Check the top-level render call using <` + w + ">.");
588
588
  if (j) {
589
589
  var J = _.children;
590
590
  if (J !== void 0)
591
- if (S)
591
+ if (O)
592
592
  if (vt(J)) {
593
- for (var Se = 0; Se < J.length; Se++)
594
- xn(J[Se], h);
593
+ for (var Oe = 0; Oe < J.length; Oe++)
594
+ xn(J[Oe], h);
595
595
  Object.freeze && Object.freeze(J);
596
596
  } else
597
597
  v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
598
598
  else
599
599
  xn(J, h);
600
600
  }
601
- if (Re.call(_, "key")) {
601
+ if ($e.call(_, "key")) {
602
602
  var pe = ne(h), W = Object.keys(_).filter(function(Fi) {
603
603
  return Fi !== "key";
604
604
  }), At = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
@@ -622,8 +622,8 @@ React keys must be passed directly to JSX without using spread:
622
622
  return Un(h, _, w, !1);
623
623
  }
624
624
  var Di = xi, Ui = $i;
625
- xe.Fragment = i, xe.jsx = Di, xe.jsxs = Ui;
626
- }(), xe;
625
+ De.Fragment = i, De.jsx = Di, De.jsxs = Ui;
626
+ }(), De;
627
627
  }
628
628
  var qi = {};
629
629
  qi.NODE_ENV === "production" ? xt.exports = Ni() : xt.exports = Ki();
@@ -674,7 +674,7 @@ const x = {
674
674
  mutable: "mutable",
675
675
  immutable: "immutable"
676
676
  }, en = {};
677
- function Ne(t, e) {
677
+ function Ke(t, e) {
678
678
  return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
679
679
  }
680
680
  function Nn(t, e) {
@@ -721,7 +721,7 @@ function Ar(t, e = []) {
721
721
  if (r !== null && (r == null ? void 0 : r.original) !== t.original)
722
722
  return null;
723
723
  const i = t.parent.type === 3, s = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
724
- if (!(i && n.size > s || Ne(n, s)))
724
+ if (!(i && n.size > s || Ke(n, s)))
725
725
  return null;
726
726
  e.push(s);
727
727
  }
@@ -741,7 +741,7 @@ function we(t) {
741
741
  function ce(t, e) {
742
742
  return we(t) === 2 ? t.get(e) : t[e];
743
743
  }
744
- function We(t, e, n) {
744
+ function Be(t, e, n) {
745
745
  we(t) === 2 ? t.set(e, n) : t[e] = n;
746
746
  }
747
747
  function jt(t, e) {
@@ -825,15 +825,15 @@ function jr(t, e) {
825
825
  function V(t) {
826
826
  t.copy || (t.copy = jr(t.original, t.options));
827
827
  }
828
- function Ue(t) {
828
+ function Le(t) {
829
829
  if (!ee(t))
830
830
  return rn(t);
831
831
  if (Array.isArray(t))
832
- return t.map(Ue);
832
+ return t.map(Le);
833
833
  if (t instanceof Map) {
834
834
  const n = Array.from(t.entries()).map(([r, i]) => [
835
835
  r,
836
- Ue(i)
836
+ Le(i)
837
837
  ]);
838
838
  if (!nn(t)) {
839
839
  const r = Object.getPrototypeOf(t).constructor;
@@ -842,7 +842,7 @@ function Ue(t) {
842
842
  return new Map(n);
843
843
  }
844
844
  if (t instanceof Set) {
845
- const n = Array.from(t).map(Ue);
845
+ const n = Array.from(t).map(Le);
846
846
  if (!tn(t)) {
847
847
  const r = Object.getPrototypeOf(t).constructor;
848
848
  return new r(n);
@@ -851,11 +851,11 @@ function Ue(t) {
851
851
  }
852
852
  const e = Object.create(Object.getPrototypeOf(t));
853
853
  for (const n in t)
854
- e[n] = Ue(t[n]);
854
+ e[n] = Le(t[n]);
855
855
  return e;
856
856
  }
857
857
  function ot(t) {
858
- return me(t) ? Ue(t) : t;
858
+ return me(t) ? Le(t) : t;
859
859
  }
860
860
  function ie(t) {
861
861
  var e;
@@ -864,7 +864,7 @@ function ie(t) {
864
864
  function Kn() {
865
865
  throw new Error("Cannot modify frozen object");
866
866
  }
867
- function Oe(t, e, n, r, i) {
867
+ function Ee(t, e, n, r, i) {
868
868
  {
869
869
  n = n ?? /* @__PURE__ */ new WeakMap(), r = r ?? [], i = i ?? [];
870
870
  const o = n.has(t) ? n.get(t) : t;
@@ -888,24 +888,24 @@ function Oe(t, e, n, r, i) {
888
888
  switch (we(t)) {
889
889
  case 2:
890
890
  for (const [u, a] of t)
891
- Oe(u, u, n, r, i), Oe(a, u, n, r, i);
891
+ Ee(u, u, n, r, i), Ee(a, u, n, r, i);
892
892
  t.set = t.clear = t.delete = Kn;
893
893
  break;
894
894
  case 3:
895
895
  for (const u of t)
896
- Oe(u, u, n, r, i);
896
+ Ee(u, u, n, r, i);
897
897
  t.add = t.clear = t.delete = Kn;
898
898
  break;
899
899
  case 1:
900
900
  Object.freeze(t);
901
901
  let o = 0;
902
902
  for (const u of t)
903
- Oe(u, o, n, r, i), o += 1;
903
+ Ee(u, o, n, r, i), o += 1;
904
904
  break;
905
905
  default:
906
906
  Object.freeze(t), Object.keys(t).forEach((u) => {
907
907
  const a = t[u];
908
- Oe(a, u, n, r, i);
908
+ Ee(a, u, n, r, i);
909
909
  });
910
910
  }
911
911
  r.pop(), i.pop();
@@ -933,7 +933,7 @@ function kr(t, e, n) {
933
933
  const a = A(o);
934
934
  V(a);
935
935
  const d = !((u = a.assignedMap) === null || u === void 0) && u.size || a.operated ? a.copy : a.original;
936
- We(r ? i : t, s, d);
936
+ Be(r ? i : t, s, d);
937
937
  } else
938
938
  kr(o, e, n);
939
939
  }), i) {
@@ -968,7 +968,7 @@ function on(t, e, n, r) {
968
968
  const a = t.type === 3 ? t.setMap : t.copy;
969
969
  if (ae(ce(a, e), n)) {
970
970
  let d = i.original;
971
- i.copy && (d = i.copy), Ut(t), Lt(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (u = t.options.updatedValues) !== null && u !== void 0 ? u : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)), We(a, e, d);
971
+ i.copy && (d = i.copy), Ut(t), Lt(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (u = t.options.updatedValues) !== null && u !== void 0 ? u : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)), Be(a, e, d);
972
972
  }
973
973
  }), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ee(n, t.options) && t.finalities.draft.push(() => {
974
974
  const s = t.type === 3 ? t.setMap : t.copy;
@@ -1023,7 +1023,7 @@ function Qi(t, e, n, r, i) {
1023
1023
  }
1024
1024
  function Hi({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
1025
1025
  n.forEach((u, a) => {
1026
- const d = ce(t, a), c = ot(ce(e, a)), f = u ? Ne(t, a) ? x.Replace : x.Add : x.Remove;
1026
+ const d = ce(t, a), c = ot(ce(e, a)), f = u ? Ke(t, a) ? x.Replace : x.Add : x.Remove;
1027
1027
  if (ae(d, c) && f === x.Replace)
1028
1028
  return;
1029
1029
  const l = r.concat(a), p = _e(l, o);
@@ -1062,7 +1062,7 @@ function Yi({ original: t, copy: e }, n, r, i, s) {
1062
1062
  o += 1;
1063
1063
  });
1064
1064
  }
1065
- function Ve(t, e, n, r) {
1065
+ function We(t, e, n, r) {
1066
1066
  const { pathAsArray: i = !0 } = t.options.enablePatches;
1067
1067
  switch (t.type) {
1068
1068
  case 0:
@@ -1086,7 +1086,7 @@ const ct = (t, e, n = !1) => {
1086
1086
  },
1087
1087
  set(t, e) {
1088
1088
  const n = A(this), r = H(n);
1089
- return (!r.has(t) || !ae(r.get(t), e)) && (V(n), ie(n), n.assignedMap.set(t, !0), n.copy.set(t, e), on(n, t, e, Ve)), this;
1089
+ return (!r.has(t) || !ae(r.get(t), e)) && (V(n), ie(n), n.assignedMap.set(t, !0), n.copy.set(t, e), on(n, t, e, We)), this;
1090
1090
  },
1091
1091
  delete(t) {
1092
1092
  if (!this.has(t))
@@ -1194,7 +1194,7 @@ const ct = (t, e, n = !1) => {
1194
1194
  },
1195
1195
  add(t) {
1196
1196
  const e = A(this);
1197
- return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), on(e, t, t, Ve)), this;
1197
+ return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), on(e, t, t, We)), this;
1198
1198
  },
1199
1199
  delete(t) {
1200
1200
  if (!this.has(t))
@@ -1298,7 +1298,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
1298
1298
  if (d)
1299
1299
  return d.bind(t.proxy);
1300
1300
  }
1301
- if (!Ne(u, e)) {
1301
+ if (!Ke(u, e)) {
1302
1302
  const d = Nn(u, e);
1303
1303
  return d ? "value" in d ? d.value : (
1304
1304
  // !case: support for getter
@@ -1334,7 +1334,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
1334
1334
  if (s != null && s.set)
1335
1335
  return s.set.call(t.proxy, n), !0;
1336
1336
  const o = jt(H(t), e), u = A(o);
1337
- return u && ae(u.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ae(n, o) && (n !== void 0 || Ne(t.original, e)) || (V(t), ie(t), Ne(t.original, e) && ae(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, on(t, e, n, Ve)), !0);
1337
+ return u && ae(u.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ae(n, o) && (n !== void 0 || Ke(t.original, e)) || (V(t), ie(t), Ke(t.original, e) && ae(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, on(t, e, n, We)), !0);
1338
1338
  },
1339
1339
  has(t, e) {
1340
1340
  return e in H(t);
@@ -1386,10 +1386,10 @@ function un(t) {
1386
1386
  var p, y;
1387
1387
  const b = A(a);
1388
1388
  let g = c.type === 3 ? c.setMap : c.copy;
1389
- const T = ce(g, r), m = A(T);
1390
- if (m) {
1391
- let v = m.original;
1392
- m.operated && (v = rn(T)), Ut(m), Lt(m, Ve, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(v, m.original)), We(g, r, v);
1389
+ const m = ce(g, r), T = A(m);
1390
+ if (T) {
1391
+ let v = T.original;
1392
+ T.operated && (v = rn(m)), Ut(T), Lt(T, We, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(v, T.original)), Be(g, r, v);
1393
1393
  }
1394
1394
  (y = b.callbacks) === null || y === void 0 || y.forEach((v) => {
1395
1395
  v(f, l);
@@ -1398,7 +1398,7 @@ function un(t) {
1398
1398
  } else {
1399
1399
  const c = A(a);
1400
1400
  c.finalities.draft.push((f, l) => {
1401
- Ut(c), Lt(c, Ve, f, l);
1401
+ Ut(c), Lt(c, We, f, l);
1402
1402
  });
1403
1403
  }
1404
1404
  return a;
@@ -1411,7 +1411,7 @@ function Xi(t, e, n, r, i) {
1411
1411
  for (; o.finalities.draft.length > 0; )
1412
1412
  o.finalities.draft.pop()(n, r);
1413
1413
  const d = a ? e[0] : o ? o.operated ? o.copy : o.original : t;
1414
- return o && Dt(o), i && Oe(d, d, o == null ? void 0 : o.options.updatedValues), [
1414
+ return o && Dt(o), i && Ee(d, d, o == null ? void 0 : o.options.updatedValues), [
1415
1415
  d,
1416
1416
  n && a ? [{ op: x.Replace, path: [], value: e[0] }] : n,
1417
1417
  r && a ? [{ op: x.Replace, path: [], value: u }] : r
@@ -1451,7 +1451,7 @@ function Nt(t) {
1451
1451
  const c = Array.from(u);
1452
1452
  u.clear(), c.forEach((f) => u.add(s === f ? d : f));
1453
1453
  } else
1454
- We(u, s, d);
1454
+ Be(u, s, d);
1455
1455
  } else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, Nt(t));
1456
1456
  }), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
1457
1457
  }
@@ -1480,7 +1480,7 @@ function Ir(t) {
1480
1480
  if (n && ae(ce(n.original, o), u))
1481
1481
  return;
1482
1482
  const a = Ir(u);
1483
- a !== u && (i === t && s(), We(i, o, a));
1483
+ a !== u && (i === t && s(), Be(i, o, a));
1484
1484
  }), r === 3) {
1485
1485
  const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : i;
1486
1486
  return tn(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
@@ -1495,19 +1495,19 @@ function zn(t) {
1495
1495
  const ts = (t) => function e(n, r, i) {
1496
1496
  var s, o, u;
1497
1497
  if (typeof n == "function" && typeof r != "function")
1498
- return function(O, ...I) {
1499
- return e(O, (R) => n.call(this, R, ...I), r);
1498
+ return function(S, ...I) {
1499
+ return e(S, (R) => n.call(this, R, ...I), r);
1500
1500
  };
1501
1501
  const a = n, d = r;
1502
1502
  let c = i;
1503
1503
  if (typeof r != "function" && (c = r), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
1504
1504
  throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
1505
1505
  c = Object.assign(Object.assign({}, t), c);
1506
- const f = me(a) ? zn(a) : a, l = Array.isArray(c.mark) ? (O, I) => {
1506
+ const f = me(a) ? zn(a) : a, l = Array.isArray(c.mark) ? (S, I) => {
1507
1507
  for (const R of c.mark) {
1508
1508
  if (typeof R != "function")
1509
1509
  throw new Error(`Invalid mark: ${R}, 'mark' should be a function.`);
1510
- const F = R(O, I);
1510
+ const F = R(S, I);
1511
1511
  if (F)
1512
1512
  return F;
1513
1513
  }
@@ -1519,47 +1519,47 @@ const ts = (t) => function e(n, r, i) {
1519
1519
  };
1520
1520
  if (!ee(f, g) && typeof f == "object" && f !== null)
1521
1521
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
1522
- const [T, m] = es(f, g);
1522
+ const [m, T] = es(f, g);
1523
1523
  if (typeof r != "function") {
1524
1524
  if (!ee(f, g))
1525
1525
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
1526
- return [T, m];
1526
+ return [m, T];
1527
1527
  }
1528
1528
  let v;
1529
1529
  try {
1530
- v = d(T);
1531
- } catch (O) {
1532
- throw Dt(A(T)), O;
1533
- }
1534
- const k = (O) => {
1535
- const I = A(T);
1536
- if (!me(O)) {
1537
- if (O !== void 0 && !ae(O, T) && (I != null && I.operated))
1530
+ v = d(m);
1531
+ } catch (S) {
1532
+ throw Dt(A(m)), S;
1533
+ }
1534
+ const k = (S) => {
1535
+ const I = A(m);
1536
+ if (!me(S)) {
1537
+ if (S !== void 0 && !ae(S, m) && (I != null && I.operated))
1538
1538
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
1539
- const F = O == null ? void 0 : O[zi];
1539
+ const F = S == null ? void 0 : S[zi];
1540
1540
  if (F) {
1541
1541
  const le = F[0];
1542
- return g.strict && typeof O == "object" && O !== null && Nt({
1542
+ return g.strict && typeof S == "object" && S !== null && Nt({
1543
1543
  rootDraft: I,
1544
- value: O,
1544
+ value: S,
1545
1545
  useRawReturn: !0
1546
- }), m([le]);
1546
+ }), T([le]);
1547
1547
  }
1548
- if (O !== void 0)
1549
- return typeof O == "object" && O !== null && Nt({ rootDraft: I, value: O }), m([O]);
1548
+ if (S !== void 0)
1549
+ return typeof S == "object" && S !== null && Nt({ rootDraft: I, value: S }), T([S]);
1550
1550
  }
1551
- if (O === T || O === void 0)
1552
- return m([]);
1553
- const R = A(O);
1551
+ if (S === m || S === void 0)
1552
+ return T([]);
1553
+ const R = A(S);
1554
1554
  if (g === R.options) {
1555
1555
  if (R.operated)
1556
1556
  throw new Error("Cannot return a modified child draft.");
1557
- return m([zn(O)]);
1557
+ return T([zn(S)]);
1558
1558
  }
1559
- return m([O]);
1559
+ return T([S]);
1560
1560
  };
1561
- return v instanceof Promise ? v.then(k, (O) => {
1562
- throw Dt(A(T)), O;
1561
+ return v instanceof Promise ? v.then(k, (S) => {
1562
+ throw Dt(A(m)), S;
1563
1563
  }) : k(v);
1564
1564
  }, ft = ts();
1565
1565
  Object.prototype.constructor.toString();
@@ -1574,7 +1574,7 @@ function ut(t, e) {
1574
1574
  return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : Mr(t, e) ? Object.keys(t).every((n) => ut(t[n], e[n])) : !1;
1575
1575
  }
1576
1576
  function an(t) {
1577
- if (!Le(t))
1577
+ if (!Fe(t))
1578
1578
  return t;
1579
1579
  const e = {};
1580
1580
  for (const [n, r] of Object.entries(t))
@@ -1582,7 +1582,7 @@ function an(t) {
1582
1582
  return e;
1583
1583
  }
1584
1584
  function Rr(t, e) {
1585
- if (!Le(t) || !Le(e))
1585
+ if (!Fe(t) || !Fe(e))
1586
1586
  return e;
1587
1587
  const n = Object.assign({}, t);
1588
1588
  for (const r of Object.keys(e)) {
@@ -1592,12 +1592,12 @@ function Rr(t, e) {
1592
1592
  delete n[r];
1593
1593
  continue;
1594
1594
  }
1595
- const i = Le(t[r]) && Le(e[r]);
1595
+ const i = Fe(t[r]) && Fe(e[r]);
1596
1596
  n[r] = i ? Rr(t[r], e[r]) : e[r];
1597
1597
  }
1598
1598
  return n;
1599
1599
  }
1600
- function Le(t) {
1600
+ function Fe(t) {
1601
1601
  return typeof t == "object" && t !== null && !Array.isArray(t);
1602
1602
  }
1603
1603
  function ns(t, e, n) {
@@ -1960,10 +1960,10 @@ function cn(t) {
1960
1960
  function dn(t) {
1961
1961
  return t["value-type"] === "blob";
1962
1962
  }
1963
- function Ce(t, e) {
1963
+ function Pe(t, e) {
1964
1964
  return t[e];
1965
1965
  }
1966
- function Pe(t, e) {
1966
+ function Ie(t, e) {
1967
1967
  return e.reduce((n, r) => n && n.get(r), t);
1968
1968
  }
1969
1969
  function X(t, e) {
@@ -1991,7 +1991,7 @@ function xr(t, e, n) {
1991
1991
  const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1992
1992
  for (const o of e) {
1993
1993
  let [u, a, d, c] = o;
1994
- const f = Ce(t, a);
1994
+ const f = Pe(t, a);
1995
1995
  if (!f) {
1996
1996
  console.warn("no such attr", u, t);
1997
1997
  continue;
@@ -2025,7 +2025,7 @@ function Lr(t) {
2025
2025
  return at(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
2026
2026
  }
2027
2027
  function ws(t, e) {
2028
- return Pe(t.eav, [e]) !== void 0;
2028
+ return Ie(t.eav, [e]) !== void 0;
2029
2029
  }
2030
2030
  function fn(t) {
2031
2031
  t.attrIndexes = Dr(t.attrs);
@@ -2034,7 +2034,7 @@ function at(t, e, n, r, i) {
2034
2034
  const s = xr(t, e, i);
2035
2035
  return s.useDateObjects = i, s.attrs = t, s.attrIndexes = Dr(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
2036
2036
  }
2037
- function Be(t, e) {
2037
+ function Ge(t, e) {
2038
2038
  var n, r;
2039
2039
  let i;
2040
2040
  if (Array.isArray(e[0])) {
@@ -2062,43 +2062,43 @@ function Be(t, e) {
2062
2062
  }
2063
2063
  }
2064
2064
  function Fr(t, e) {
2065
- const n = Be(t, e);
2065
+ const n = Ge(t, e);
2066
2066
  if (!n)
2067
2067
  return;
2068
- const [r, i, s] = n, o = Ce(t.attrs, i);
2068
+ const [r, i, s] = n, o = Pe(t.attrs, i);
2069
2069
  o && (X(t.eav, [r, i, s]), X(t.aev, [i, r, s]), cn(o) && X(t.vae, [s, i, r]));
2070
2070
  }
2071
2071
  let vs = 0;
2072
2072
  function Nr(t, e, n) {
2073
2073
  const [r, i, s] = n;
2074
2074
  let o;
2075
- const u = Pe(t.ea, [r, i, s]);
2075
+ const u = Ie(t.ea, [r, i, s]);
2076
2076
  return u && (o = u[3]), o || Date.now() * 10 + vs++;
2077
2077
  }
2078
2078
  function Kr(t, e) {
2079
2079
  var n;
2080
- const r = Be(t, e);
2080
+ const r = Ge(t, e);
2081
2081
  if (!r)
2082
2082
  return;
2083
2083
  let [i, s, o] = r;
2084
- const u = Ce(t.attrs, s);
2084
+ const u = Pe(t.attrs, s);
2085
2085
  if (!u)
2086
2086
  return;
2087
2087
  u["checked-data-type"] === "date" && t.useDateObjects && (o = pt(o));
2088
- const a = Pe(t.eav, [i, s, o]), d = (n = a == null ? void 0 : a[3]) !== null && n !== void 0 ? n : Nr(t, u, r), c = [i, s, o, d];
2088
+ const a = Ie(t.eav, [i, s, o]), d = (n = a == null ? void 0 : a[3]) !== null && n !== void 0 ? n : Nr(t, u, r), c = [i, s, o, d];
2089
2089
  ms(u) ? (B(t.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), B(t.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (B(t.eav, [i, s, o], c), B(t.aev, [s, i, o], c)), cn(u) && B(t.vae, [o, s, i], c);
2090
2090
  }
2091
2091
  function Ss(t, e) {
2092
2092
  var n;
2093
- const r = Be(t, e);
2093
+ const r = Ge(t, e);
2094
2094
  if (!r)
2095
2095
  return;
2096
- const [i, s, o] = r, u = Ce(t.attrs, s);
2096
+ const [i, s, o] = r, u = Pe(t.attrs, s);
2097
2097
  if (!u)
2098
2098
  return;
2099
2099
  if (!dn(u))
2100
2100
  throw new Error("merge operation is not supported for links");
2101
- const a = Pe(t.eav, [i, s]);
2101
+ const a = Ie(t.eav, [i, s]);
2102
2102
  if (!a)
2103
2103
  return;
2104
2104
  const d = (n = a.values().next()) === null || n === void 0 ? void 0 : n.value;
@@ -2114,7 +2114,7 @@ function Ss(t, e) {
2114
2114
  }
2115
2115
  function qt(t, e) {
2116
2116
  var n, r;
2117
- const [i, s] = e, o = Be(t, [i]);
2117
+ const [i, s] = e, o = Ge(t, [i]);
2118
2118
  if (!o)
2119
2119
  return;
2120
2120
  const [u] = o, a = t.eav.get(u);
@@ -2135,8 +2135,8 @@ function qt(t, e) {
2135
2135
  const d = t.vae.get(u) && G(t.vae.get(u), 2);
2136
2136
  d && d.forEach((c) => {
2137
2137
  var f, l, p;
2138
- const [y, b, g] = c, T = t.attrs[b];
2139
- (!s || !T || ((f = T["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (X(t.eav, [y, b, g]), X(t.aev, [b, y, g]), X(t.vae, [g, b, y])), T && T["on-delete"] === "cascade" && ((l = T["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && qt(t, [y, (p = T["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
2138
+ const [y, b, g] = c, m = t.attrs[b];
2139
+ (!s || !m || ((f = m["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (X(t.eav, [y, b, g]), X(t.aev, [b, y, g]), X(t.vae, [g, b, y])), m && m["on-delete"] === "cascade" && ((l = m["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && qt(t, [y, (p = m["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
2140
2140
  }), ((r = t.vae.get(u)) === null || r === void 0 ? void 0 : r.size) === 0 && X(t.vae, [u]);
2141
2141
  }
2142
2142
  function qr(t, e) {
@@ -2317,12 +2317,12 @@ function Wr(t, e) {
2317
2317
  return r || ((n = t.attrIndexes.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
2318
2318
  }
2319
2319
  function Ms(t, e) {
2320
- const n = Be(t, e);
2320
+ const n = Ge(t, e);
2321
2321
  if (!n)
2322
2322
  return;
2323
2323
  const [r, i, s] = n;
2324
- if (Ce(t.attrs, i))
2325
- return Pe(t.eav, [r, i]);
2324
+ if (Pe(t.attrs, i))
2325
+ return Ie(t.eav, [r, i]);
2326
2326
  }
2327
2327
  function Rs(t, e) {
2328
2328
  const n = e.filter(([r, i, s, o, u]) => {
@@ -2332,7 +2332,7 @@ function Rs(t, e) {
2332
2332
  if (a !== "create" && a !== "update")
2333
2333
  return !0;
2334
2334
  let d = !1;
2335
- const c = Ce(t.attrs, s);
2335
+ const c = Pe(t.attrs, s);
2336
2336
  if (c) {
2337
2337
  const f = Wr(t, c["forward-identity"][1]);
2338
2338
  d = !!Ms(t, [i, f.id, i]);
@@ -2408,7 +2408,7 @@ function zs(t, e, n) {
2408
2408
  return Cs(t, ln(n, e));
2409
2409
  }
2410
2410
  const Vs = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
2411
- function Ae(t) {
2411
+ function je(t) {
2412
2412
  return typeof t == "string" && Vs.test(t);
2413
2413
  }
2414
2414
  const N = [];
@@ -2473,13 +2473,13 @@ function Xs() {
2473
2473
  }
2474
2474
  const eo = Xs();
2475
2475
  let to = 0;
2476
- function Ke(t) {
2476
+ function qe(t) {
2477
2477
  return yt(`_${t}`, to++);
2478
2478
  }
2479
2479
  function yt(t, e) {
2480
2480
  return `?${t}-${e}`;
2481
2481
  }
2482
- class je extends Error {
2482
+ class ke extends Error {
2483
2483
  constructor(e) {
2484
2484
  super(e), this.name = "AttrNotFoundError";
2485
2485
  }
@@ -2487,7 +2487,7 @@ class je extends Error {
2487
2487
  function no(t, e) {
2488
2488
  const n = Wr(t, e);
2489
2489
  if (!n)
2490
- throw new je(`Could not find id attr for ${e}`);
2490
+ throw new ke(`Could not find id attr for ${e}`);
2491
2491
  return n;
2492
2492
  }
2493
2493
  function Yn(t, e, n, r) {
@@ -2507,19 +2507,19 @@ function io(t, e, n) {
2507
2507
  function Gr(t, e, n, r, i) {
2508
2508
  const s = fe(e, n, i), o = Vr(e, n, i), u = s || o;
2509
2509
  if (!u)
2510
- throw new je(`Could not find attr for ${[n, i]}`);
2510
+ throw new ke(`Could not find attr for ${[n, i]}`);
2511
2511
  if (u["value-type"] !== "ref")
2512
2512
  throw new Error(`Attr ${u.id} is not a ref`);
2513
2513
  const [a, d] = u["forward-identity"], [c, f] = u["reverse-identity"], l = r + 1, p = s ? [
2514
2514
  t(d, r),
2515
2515
  u.id,
2516
2516
  t(f, l),
2517
- Ke("time")
2517
+ qe("time")
2518
2518
  ] : [
2519
2519
  t(d, l),
2520
2520
  u.id,
2521
2521
  t(f, r),
2522
- Ke("time")
2522
+ qe("time")
2523
2523
  ];
2524
2524
  return [s ? f : d, l, p, u, !!s];
2525
2525
  }
@@ -2596,24 +2596,24 @@ function so(t, e) {
2596
2596
  function oo(t, e, n, r, i, s) {
2597
2597
  const o = fe(e, n, i), u = Vr(e, n, i), a = o || u;
2598
2598
  if (!a)
2599
- throw new je(`No attr for etype = ${n} label = ${i}`);
2599
+ throw new ke(`No attr for etype = ${n} label = ${i}`);
2600
2600
  if (s != null && s.hasOwnProperty("$isNull")) {
2601
2601
  const d = fe(e, n, "id");
2602
2602
  if (!d)
2603
- throw new je(`No attr for etype = ${n} label = id`);
2603
+ throw new ke(`No attr for etype = ${n} label = id`);
2604
2604
  return [
2605
2605
  t(n, r),
2606
2606
  d.id,
2607
2607
  { $isNull: { attrId: a.id, isNull: s.$isNull, reverse: !o } },
2608
- Ke("time")
2608
+ qe("time")
2609
2609
  ];
2610
2610
  }
2611
2611
  return o ? [
2612
2612
  t(n, r),
2613
2613
  a.id,
2614
2614
  so(a, s),
2615
- Ke("time")
2616
- ] : [s, a.id, t(n, r), Ke("time")];
2615
+ qe("time")
2616
+ ] : [s, a.id, t(n, r), qe("time")];
2617
2617
  }
2618
2618
  function uo(t, e, n, r, i) {
2619
2619
  const [s, o, u] = i.reduce((a, d) => {
@@ -2705,17 +2705,17 @@ function _o(t, e, { etype: n, level: r, form: i }, s) {
2705
2705
  var p, y, b;
2706
2706
  const g = !!(e.cardinalityInference && (!((b = (y = (p = e.linkIndex) === null || p === void 0 ? void 0 : p[n]) === null || y === void 0 ? void 0 : y[l]) === null || b === void 0) && b.isSingular));
2707
2707
  try {
2708
- const [T, m, v] = bo(t, e, n, r, l, a), k = Yr(e, {
2709
- etype: T,
2710
- level: m,
2708
+ const [m, T, v] = bo(t, e, n, r, l, a), k = Yr(e, {
2709
+ etype: m,
2710
+ level: T,
2711
2711
  form: i[l],
2712
2712
  join: v
2713
- }), O = g ? k[0] : k;
2714
- return { [l]: O };
2715
- } catch (T) {
2716
- if (T instanceof je)
2713
+ }), S = g ? k[0] : k;
2714
+ return { [l]: S };
2715
+ } catch (m) {
2716
+ if (m instanceof ke)
2717
2717
  return { [l]: g ? void 0 : [] };
2718
- throw T;
2718
+ throw m;
2719
2719
  }
2720
2720
  }).reduce(function(l, p) {
2721
2721
  return Object.assign(Object.assign({}, l), p);
@@ -2725,11 +2725,11 @@ function _o(t, e, { etype: n, level: r, form: i }, s) {
2725
2725
  function go(t, e, n) {
2726
2726
  return n === "string" ? eo(t, e) : t > e ? 1 : -1;
2727
2727
  }
2728
- function Fe(t, e, n, r, i) {
2728
+ function Ne(t, e, n, r, i) {
2729
2729
  return e === r || e == null && r == null ? Js(t, n) : r == null ? 1 : e == null ? -1 : go(e, r, i);
2730
2730
  }
2731
2731
  function lt([t, e], [n, r], i) {
2732
- return Fe(t, e, n, r, i);
2732
+ return Ne(t, e, n, r, i);
2733
2733
  }
2734
2734
  function Wt(t) {
2735
2735
  return t == null ? t : new Date(t).getTime();
@@ -2778,16 +2778,16 @@ function Oo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2778
2778
  const f = n == null ? void 0 : n["start-cursor"], l = vo(t, e, f, u);
2779
2779
  if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
2780
2780
  const b = l["checked-data-type"] === "date", g = l.id;
2781
- c = c.map(([T]) => {
2782
- var m, v, k, O, I;
2783
- let R = (I = (O = (k = (v = (m = t.eav.get(T)) === null || m === void 0 ? void 0 : m.get(g)) === null || v === void 0 ? void 0 : v.values()) === null || k === void 0 ? void 0 : k.next()) === null || O === void 0 ? void 0 : O.value) === null || I === void 0 ? void 0 : I[2];
2784
- return b && (R = Wt(R)), [T, R];
2781
+ c = c.map(([m]) => {
2782
+ var T, v, k, S, I;
2783
+ let R = (I = (S = (k = (v = (T = t.eav.get(m)) === null || T === void 0 ? void 0 : T.get(g)) === null || v === void 0 ? void 0 : v.values()) === null || k === void 0 ? void 0 : k.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
2784
+ return b && (R = Wt(R)), [m, R];
2785
2785
  });
2786
2786
  }
2787
- c.sort(d === "asc" ? function(g, T) {
2788
- return lt(g, T, l == null ? void 0 : l["checked-data-type"]);
2789
- } : function(g, T) {
2790
- return lt(T, g, l == null ? void 0 : l["checked-data-type"]);
2787
+ c.sort(d === "asc" ? function(g, m) {
2788
+ return lt(g, m, l == null ? void 0 : l["checked-data-type"]);
2789
+ } : function(g, m) {
2790
+ return lt(m, g, l == null ? void 0 : l["checked-data-type"]);
2791
2791
  });
2792
2792
  let p = {};
2793
2793
  const y = So(t, e, r);
@@ -2795,8 +2795,8 @@ function Oo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2795
2795
  const [g] = b;
2796
2796
  if (p[g] || !a && f && l && To(f, l, d, b))
2797
2797
  continue;
2798
- const T = Ps(t, y, g);
2799
- T && (p[g] = T);
2798
+ const m = Ps(t, y, g);
2799
+ m && (p[g] = m);
2800
2800
  }
2801
2801
  return p;
2802
2802
  }
@@ -2831,7 +2831,7 @@ function jo(t, e) {
2831
2831
  try {
2832
2832
  return Ao(t, e);
2833
2833
  } catch (n) {
2834
- if (n instanceof je)
2834
+ if (n instanceof ke)
2835
2835
  return {};
2836
2836
  throw n;
2837
2837
  }
@@ -3236,14 +3236,14 @@ function nu({ attrs: t, schema: e }, n) {
3236
3236
  const b = p[0];
3237
3237
  if (y) {
3238
3238
  c(l, y);
3239
- const g = q(o, l, y), T = ge(o, l, y);
3240
- d(g), d(T);
3241
- const m = ((r = g == null ? void 0 : g["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = T == null ? void 0 : T["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
3242
- if (Gt(o, m, b))
3243
- c(m, Qt(b));
3239
+ const g = q(o, l, y), m = ge(o, l, y);
3240
+ d(g), d(m);
3241
+ const T = ((r = g == null ? void 0 : g["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = m == null ? void 0 : m["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
3242
+ if (Gt(o, T, b))
3243
+ c(T, Qt(b));
3244
3244
  else {
3245
- const v = q(o, m, b);
3246
- v || a(nt(e, m, b, Yt)), d(v);
3245
+ const v = q(o, T, b);
3246
+ v || a(nt(e, T, b, Yt)), d(v);
3247
3247
  }
3248
3248
  } else if (Gt(o, l, b))
3249
3249
  c(l, Qt(b));
@@ -3257,11 +3257,11 @@ function nu({ attrs: t, schema: e }, n) {
3257
3257
  if (Yo.has(l)) {
3258
3258
  const g = q(o, p, "id");
3259
3259
  d(g), g || a(nt(e, p, "id", { "unique?": !0 }));
3260
- for (const T of Object.keys(b)) {
3261
- const m = q(o, p, T);
3262
- if (d(m), Zo.has(l) && (m || a(nt(e, p, T, T === "id" ? { "unique?": !0 } : null))), Jo.has(l)) {
3263
- const v = ge(o, p, T);
3264
- !m && !v && a(er(e, p, T)), d(v);
3260
+ for (const m of Object.keys(b)) {
3261
+ const T = q(o, p, m);
3262
+ if (d(T), Zo.has(l) && (T || a(nt(e, p, m, m === "id" ? { "unique?": !0 } : null))), Jo.has(l)) {
3263
+ const v = ge(o, p, m);
3264
+ !T && !v && a(er(e, p, m)), d(v);
3265
3265
  }
3266
3266
  }
3267
3267
  }
@@ -3302,7 +3302,7 @@ var re = function(t, e, n, r) {
3302
3302
  function tr(t, e) {
3303
3303
  typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
3304
3304
  }
3305
- const qe = "__meta";
3305
+ const ze = "__meta";
3306
3306
  class iu {
3307
3307
  constructor(e, n) {
3308
3308
  }
@@ -3323,7 +3323,7 @@ class Jt {
3323
3323
  var e, n, r;
3324
3324
  this._meta.loadingPromise && (yield this._meta.loadingPromise);
3325
3325
  try {
3326
- const i = this._persister.getItem(qe);
3326
+ const i = this._persister.getItem(ze);
3327
3327
  this._meta.loadingPromise = i;
3328
3328
  const s = yield i;
3329
3329
  this._meta.isLoading = !1, this._meta.error = null, this._meta.loadingPromise = null, this._meta.attempts = 0;
@@ -3416,7 +3416,7 @@ class Jt {
3416
3416
  const y = this._persister.removeItem(p);
3417
3417
  i.push(y.then(() => 1)), this._loadedKeys.delete(p), this._pendingSaveKeys.delete(p);
3418
3418
  }
3419
- const d = [], c = [[qe, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
3419
+ const d = [], c = [[ze, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
3420
3420
  o.objects = f;
3421
3421
  for (const p of a)
3422
3422
  if (this._loadedKeys.has(p)) {
@@ -3448,7 +3448,7 @@ class Jt {
3448
3448
  if (!this._gcOpts)
3449
3449
  return;
3450
3450
  const e = new Set(yield this._persister.getAllKeys());
3451
- e.delete(qe);
3451
+ e.delete(ze);
3452
3452
  const n = new Set(Object.keys(this.currentValue));
3453
3453
  for (const l of Object.keys(this._loadingKeys))
3454
3454
  n.add(l);
@@ -3611,17 +3611,17 @@ function cu(t, e, n) {
3611
3611
  for (const [y, b] of Object.entries(r)) {
3612
3612
  const g = typeof b == "string" ? JSON.parse(b) : b;
3613
3613
  if (g.lastAccessed) {
3614
- const m = {
3614
+ const T = {
3615
3615
  createdAt: g.lastAccessed,
3616
3616
  updatedAt: g.lastAccessed,
3617
3617
  size: (c = (d = (a = (u = g.result) === null || u === void 0 ? void 0 : u.store) === null || a === void 0 ? void 0 : a.triples) === null || d === void 0 ? void 0 : d.length) !== null && c !== void 0 ? c : 0
3618
3618
  };
3619
- f[y] = m;
3619
+ f[y] = T;
3620
3620
  }
3621
- const T = n.put(g, y);
3622
- i.add(T);
3621
+ const m = n.put(g, y);
3622
+ i.add(m);
3623
3623
  }
3624
- const l = { objects: f }, p = n.put(l, qe);
3624
+ const l = { objects: f }, p = n.put(l, ze);
3625
3625
  i.add(p);
3626
3626
  for (const y of i)
3627
3627
  y.onsuccess = () => {
@@ -3654,8 +3654,8 @@ function du(t, e) {
3654
3654
  y.onsuccess = () => {
3655
3655
  const g = y.result;
3656
3656
  if (g) {
3657
- const T = g.key, m = g.value;
3658
- b.push([T, m]), g.continue();
3657
+ const m = g.key, T = g.value;
3658
+ b.push([m, T]), g.continue();
3659
3659
  } else
3660
3660
  c(b);
3661
3661
  }, y.onerror = (g) => {
@@ -3681,7 +3681,7 @@ function du(t, e) {
3681
3681
  break;
3682
3682
  }
3683
3683
  }
3684
- const d = nr(qe, a, s);
3684
+ const d = nr(ze, a, s);
3685
3685
  u.push(d), yield Promise.all(u), yield new Promise((c, f) => {
3686
3686
  i.oncomplete = (l) => c(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
3687
3687
  });
@@ -3835,11 +3835,11 @@ class ni {
3835
3835
  };
3836
3836
  }
3837
3837
  }
3838
- class ke extends Error {
3838
+ class Ce extends Error {
3839
3839
  constructor(e, n) {
3840
3840
  super(e), this.hint = n;
3841
3841
  const r = new.target.prototype;
3842
- Object.setPrototypeOf && Object.setPrototypeOf(this, r), Error.captureStackTrace && Error.captureStackTrace(this, ke), this.name = "InstantError";
3842
+ Object.setPrototypeOf && Object.setPrototypeOf(this, r), Error.captureStackTrace && Error.captureStackTrace(this, Ce), this.name = "InstantError";
3843
3843
  }
3844
3844
  get [Symbol.toStringTag]() {
3845
3845
  return "InstantError";
@@ -3872,7 +3872,7 @@ var lu = function(t, e, n, r) {
3872
3872
  d((r = r.apply(t, e || [])).next());
3873
3873
  });
3874
3874
  };
3875
- class bt extends ke {
3875
+ class bt extends Ce {
3876
3876
  constructor(e) {
3877
3877
  var n;
3878
3878
  const r = ((n = e.body) === null || n === void 0 ? void 0 : n.message) || `API Error (${e.status})`;
@@ -3890,7 +3890,7 @@ function te(t, e) {
3890
3890
  return n.status === 200 ? Promise.resolve(r) : Promise.reject(new bt({ status: n.status, body: r }));
3891
3891
  });
3892
3892
  }
3893
- var Ie = function(t, e, n, r) {
3893
+ var Me = function(t, e, n, r) {
3894
3894
  function i(s) {
3895
3895
  return s instanceof n ? s : new n(function(o) {
3896
3896
  o(s);
@@ -3925,7 +3925,7 @@ function hu({ apiURI: t, appId: e, email: n }) {
3925
3925
  });
3926
3926
  }
3927
3927
  function pu(t) {
3928
- return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
3928
+ return Me(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
3929
3929
  return yield te(`${e}/runtime/auth/verify_magic_code`, {
3930
3930
  method: "POST",
3931
3931
  headers: { "content-type": "application/json" },
@@ -3938,7 +3938,7 @@ function pu(t) {
3938
3938
  });
3939
3939
  }
3940
3940
  function yu(t) {
3941
- return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3941
+ return Me(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3942
3942
  return yield te(`${e}/runtime/auth/verify_refresh_token`, {
3943
3943
  method: "POST",
3944
3944
  headers: { "content-type": "application/json" },
@@ -3950,7 +3950,7 @@ function yu(t) {
3950
3950
  });
3951
3951
  }
3952
3952
  function bu(t) {
3953
- return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
3953
+ return Me(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
3954
3954
  return yield te(`${e}/runtime/auth/sign_in_guest`, {
3955
3955
  method: "POST",
3956
3956
  headers: { "content-type": "application/json" },
@@ -3961,7 +3961,7 @@ function bu(t) {
3961
3961
  });
3962
3962
  }
3963
3963
  function ir(t) {
3964
- return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
3964
+ return Me(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
3965
3965
  return yield te(`${e}/runtime/oauth/token`, {
3966
3966
  method: "POST",
3967
3967
  headers: { "content-type": "application/json" },
@@ -3975,7 +3975,7 @@ function ir(t) {
3975
3975
  });
3976
3976
  }
3977
3977
  function _u(t) {
3978
- return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
3978
+ return Me(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
3979
3979
  return yield te(`${e}/runtime/oauth/id_token`, {
3980
3980
  method: "POST",
3981
3981
  headers: { "content-type": "application/json" },
@@ -3990,7 +3990,7 @@ function _u(t) {
3990
3990
  });
3991
3991
  }
3992
3992
  function gu(t) {
3993
- return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3993
+ return Me(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3994
3994
  return yield te(`${e}/runtime/signout`, {
3995
3995
  method: "POST",
3996
3996
  headers: {
@@ -4003,7 +4003,7 @@ function gu(t) {
4003
4003
  });
4004
4004
  });
4005
4005
  }
4006
- var Ge = function(t, e, n, r) {
4006
+ var Qe = function(t, e, n, r) {
4007
4007
  function i(s) {
4008
4008
  return s instanceof n ? s : new n(function(o) {
4009
4009
  o(s);
@@ -4031,7 +4031,7 @@ var Ge = function(t, e, n, r) {
4031
4031
  });
4032
4032
  };
4033
4033
  function Tu(t) {
4034
- return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: u }) {
4034
+ return Qe(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: u }) {
4035
4035
  const a = {
4036
4036
  app_id: n,
4037
4037
  path: r,
@@ -4046,7 +4046,7 @@ function Tu(t) {
4046
4046
  });
4047
4047
  }
4048
4048
  function mu(t) {
4049
- return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
4049
+ return Qe(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
4050
4050
  const { data: s } = yield te(`${e}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
4051
4051
  method: "DELETE",
4052
4052
  headers: {
@@ -4058,7 +4058,7 @@ function mu(t) {
4058
4058
  });
4059
4059
  }
4060
4060
  function wu(t) {
4061
- return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
4061
+ return Qe(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
4062
4062
  const { data: o } = yield te(`${e}/storage/signed-upload-url`, {
4063
4063
  method: "POST",
4064
4064
  headers: {
@@ -4074,7 +4074,7 @@ function wu(t) {
4074
4074
  });
4075
4075
  }
4076
4076
  function vu(t, e) {
4077
- return Ge(this, void 0, void 0, function* () {
4077
+ return Qe(this, void 0, void 0, function* () {
4078
4078
  return (yield fetch(t, {
4079
4079
  method: "PUT",
4080
4080
  body: e,
@@ -4085,7 +4085,7 @@ function vu(t, e) {
4085
4085
  });
4086
4086
  }
4087
4087
  function Su(t) {
4088
- return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
4088
+ return Qe(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
4089
4089
  const { data: s } = yield te(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
4090
4090
  method: "GET",
4091
4091
  headers: {
@@ -4172,7 +4172,7 @@ function ar(t) {
4172
4172
  }, e;
4173
4173
  }, {});
4174
4174
  }
4175
- const oi = "v0.22.60";
4175
+ const oi = "v0.22.61-experimental.delay-looking-at-store.19555739599.1";
4176
4176
  function Au(t, e) {
4177
4177
  return {
4178
4178
  info: t ? (...n) => console.info(...n, e()) : () => {
@@ -4269,7 +4269,7 @@ const cr = [
4269
4269
  default:
4270
4270
  throw new M(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
4271
4271
  }
4272
- }, Ee = (t, e, n, r, i) => {
4272
+ }, Ae = (t, e, n, r, i) => {
4273
4273
  const s = ju(n), o = n.valueType === "json";
4274
4274
  if (typeof t == "object" && t !== null && !Array.isArray(t)) {
4275
4275
  if (o)
@@ -4299,23 +4299,23 @@ const cr = [
4299
4299
  if (!a)
4300
4300
  throw new M(`Target entity '${o}' does not exist in schema for dot notation path '${t}'.`, i);
4301
4301
  if (u === "id") {
4302
- if (typeof e == "string" && !Ae(e))
4302
+ if (typeof e == "string" && !je(e))
4303
4303
  throw new M(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, i);
4304
- Ee(e, t, new ue("string", !1, !0), n, i);
4304
+ Ae(e, t, new ue("string", !1, !0), n, i);
4305
4305
  return;
4306
4306
  }
4307
4307
  const d = a.attrs[u];
4308
4308
  if (Object.keys(a.links).includes(u)) {
4309
- if (typeof e == "string" && !Ae(e))
4309
+ if (typeof e == "string" && !je(e))
4310
4310
  throw new M(`Invalid value for link '${u}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
4311
- Ee(e, t, new ue("string", !1, !0), n, i);
4311
+ Ae(e, t, new ue("string", !1, !0), n, i);
4312
4312
  return;
4313
4313
  }
4314
4314
  if (!d) {
4315
4315
  const c = Object.keys(a.attrs);
4316
4316
  throw new M(`Attribute '${u}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
4317
4317
  }
4318
- Ee(e, t, d, n, i);
4318
+ Ae(e, t, d, n, i);
4319
4319
  }, ai = (t, e, n, r) => {
4320
4320
  for (const [i, s] of Object.entries(t)) {
4321
4321
  if (i === "or" || i === "and") {
@@ -4325,7 +4325,7 @@ const cr = [
4325
4325
  continue;
4326
4326
  }
4327
4327
  if (i === "id") {
4328
- Ee(s, "id", new ue("string", !1, !0), e, `${r}.id`);
4328
+ Ae(s, "id", new ue("string", !1, !0), e, `${r}.id`);
4329
4329
  continue;
4330
4330
  }
4331
4331
  if (i.includes(".")) {
@@ -4341,12 +4341,12 @@ const cr = [
4341
4341
  throw new M(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${d.length > 0 ? d.join(", ") : "none"}. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${i}`);
4342
4342
  }
4343
4343
  if (u)
4344
- Ee(s, i, u, e, `${r}.${i}`);
4344
+ Ae(s, i, u, e, `${r}.${i}`);
4345
4345
  else if (a) {
4346
- if (typeof s == "string" && !Ae(s))
4346
+ if (typeof s == "string" && !je(s))
4347
4347
  throw new M(`Invalid value for link '${i}' in entity '${e}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
4348
4348
  const d = new ue("string", !1, !0);
4349
- Ee(s, i, d, e, `${r}.${i}`);
4349
+ Ae(s, i, d, e, `${r}.${i}`);
4350
4350
  }
4351
4351
  }
4352
4352
  }, Pu = (t, e, n, r, i = 0) => {
@@ -4409,7 +4409,7 @@ const cr = [
4409
4409
  ci(n[r], r, e, r, 0);
4410
4410
  }
4411
4411
  }
4412
- }, fr = (t) => typeof t != "string" ? !1 : ht(t) ? !0 : Ae(t);
4412
+ }, fr = (t) => typeof t != "string" ? !1 : ht(t) ? !0 : je(t);
4413
4413
  class Z extends Error {
4414
4414
  constructor(e) {
4415
4415
  super(e), this.name = "TransactionValidationError";
@@ -4470,7 +4470,7 @@ const di = (t) => t.length > 0 ? t.join(", ") : "none", Iu = (t, e) => new Z(`En
4470
4470
  if (!e)
4471
4471
  return;
4472
4472
  const [n, r, i, s] = t;
4473
- if (!Array.isArray(i) && !Ae(i))
4473
+ if (!Array.isArray(i) && !je(i))
4474
4474
  throw new Z(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
4475
4475
  if (typeof r != "string")
4476
4476
  throw new Z(`Entity name must be a string, but received: ${typeof r}`);
@@ -4684,7 +4684,7 @@ function _r(t, e, n) {
4684
4684
  const i = (r = fe(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
4685
4685
  if (!i)
4686
4686
  return -1;
4687
- const s = Pe(e.eav, [n, i, n]);
4687
+ const s = Ie(e.eav, [n, i, n]);
4688
4688
  return s ? s[3] : -1;
4689
4689
  }
4690
4690
  function gr(t, e) {
@@ -4723,27 +4723,34 @@ function rt(t, e) {
4723
4723
  return { [t.table]: e.map((n) => n.entity) };
4724
4724
  }
4725
4725
  function Ku(t, e) {
4726
- const n = t.orderFieldType;
4726
+ var n;
4727
+ if (t.orderFieldType)
4728
+ return t.orderFieldType;
4729
+ const r = t.orderField === "serverCreatedAt" ? "number" : (n = fe(e([]), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
4730
+ return t.orderFieldType = r, r;
4731
+ }
4732
+ function qu(t, e, n) {
4733
+ const r = e;
4727
4734
  if (t.orderField === "serverCreatedAt") {
4728
- e.sort(t.orderDirection === "asc" ? function(s, o) {
4729
- return Fe(s.entity.id, s.serverCreatedAt, o.entity.id, o.serverCreatedAt, n);
4730
- } : function(s, o) {
4731
- return Fe(o.entity.id, o.serverCreatedAt, s.entity.id, s.serverCreatedAt, n);
4735
+ n.sort(t.orderDirection === "asc" ? function(o, u) {
4736
+ return Ne(o.entity.id, o.serverCreatedAt, u.entity.id, u.serverCreatedAt, r);
4737
+ } : function(o, u) {
4738
+ return Ne(u.entity.id, u.serverCreatedAt, o.entity.id, o.serverCreatedAt, r);
4732
4739
  });
4733
4740
  return;
4734
4741
  }
4735
- const r = t.orderField;
4736
- e.sort(t.orderDirection === "asc" ? function(s, o) {
4737
- return Fe(s.entity.id, s.entity[r], o.entity.id, o.entity[r], n);
4738
- } : function(s, o) {
4739
- return Fe(o.entity.id, o.entity[r], s.entity.id, s.entity[r], n);
4742
+ const i = t.orderField;
4743
+ n.sort(t.orderDirection === "asc" ? function(o, u) {
4744
+ return Ne(o.entity.id, o.entity[i], u.entity.id, u.entity[i], r);
4745
+ } : function(o, u) {
4746
+ return Ne(u.entity.id, u.entity[i], o.entity.id, o.entity[i], r);
4740
4747
  });
4741
4748
  }
4742
4749
  var ye;
4743
4750
  (function(t) {
4744
4751
  t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
4745
4752
  })(ye || (ye = {}));
4746
- class qu {
4753
+ class zu {
4747
4754
  constructor(e, n, r, i, s) {
4748
4755
  this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Jt({
4749
4756
  persister: n,
@@ -4807,25 +4814,24 @@ class qu {
4807
4814
  }
4808
4815
  initSubscription(e, n, r) {
4809
4816
  return br(this, void 0, void 0, function* () {
4810
- var i, s, o, u, a;
4817
+ var i, s, o, u;
4811
4818
  yield this.subs.waitForKeyToLoad(n);
4812
- const d = this.subs.currentValue[n];
4813
- if (d && d.state && d.state.txId) {
4814
- this.sendResync(d, d.state), !((i = d.values) === null || i === void 0) && i.entities && r && (Object.keys(e)[0], r({
4819
+ const a = this.subs.currentValue[n];
4820
+ if (a && a.state && a.state.txId) {
4821
+ this.sendResync(a, a.state), !((i = a.values) === null || i === void 0) && i.entities && r && (Object.keys(e)[0], r({
4815
4822
  type: ye.LoadFromStorage,
4816
- data: rt(d, (s = d.values) === null || s === void 0 ? void 0 : s.entities)
4823
+ data: rt(a, (s = a.values) === null || s === void 0 ? void 0 : s.entities)
4817
4824
  }));
4818
4825
  return;
4819
4826
  }
4820
- const c = Object.keys(e)[0], f = ((u = (o = e[c]) === null || o === void 0 ? void 0 : o.$) === null || u === void 0 ? void 0 : u.order) || { serverCreatedAt: "asc" }, [l, p] = Object.entries(f)[0], y = l === "serverCreatedAt" ? "number" : (a = fe(this.createStore([]), c, l)) === null || a === void 0 ? void 0 : a["checked-data-type"];
4821
- this.subs.updateInPlace((b) => {
4822
- b[n] = {
4827
+ const d = Object.keys(e)[0], c = ((u = (o = e[d]) === null || o === void 0 ? void 0 : o.$) === null || u === void 0 ? void 0 : u.order) || { serverCreatedAt: "asc" }, [f, l] = Object.entries(c)[0];
4828
+ this.subs.updateInPlace((p) => {
4829
+ p[n] = {
4823
4830
  query: e,
4824
4831
  hash: n,
4825
- table: c,
4826
- orderDirection: p,
4827
- orderField: l,
4828
- orderFieldType: y,
4832
+ table: d,
4833
+ orderDirection: l,
4834
+ orderField: f,
4829
4835
  createdAt: Date.now(),
4830
4836
  updatedAt: Date.now()
4831
4837
  };
@@ -4940,8 +4946,8 @@ class qu {
4940
4946
  a.txId = d["tx-id"];
4941
4947
  const c = [], f = {};
4942
4948
  for (const T of d.changes) {
4943
- const m = (n = f[T.triple[0]]) !== null && n !== void 0 ? n : [];
4944
- f[T.triple[0]] = m, m.push(T);
4949
+ const v = (n = f[T.triple[0]]) !== null && n !== void 0 ? n : [];
4950
+ f[T.triple[0]] = v, v.push(T);
4945
4951
  }
4946
4952
  const l = (r = u.values) !== null && r !== void 0 ? r : {
4947
4953
  entities: [],
@@ -4949,43 +4955,44 @@ class qu {
4949
4955
  }, p = l.entities;
4950
4956
  u.values = l;
4951
4957
  const y = [];
4952
- e: for (const [T, m] of Object.entries(f))
4953
- for (const [v, k] of Object.entries(p))
4954
- if (ws(k.store, T)) {
4955
- gr(k.store, m);
4956
- const O = Pt(u, k.store), I = Nu(k.store, m)[T];
4957
- for (const [R, { oldValue: F, newValue: le }] of Object.entries(I || {}))
4958
- F === le && delete I[R];
4959
- O ? (y.push({
4960
- oldEntity: k.entity,
4961
- newEntity: O,
4962
- changedFields: I || {}
4963
- }), k.entity = O) : c.push(v), delete f[T];
4958
+ e: for (const [T, v] of Object.entries(f))
4959
+ for (const [k, S] of Object.entries(p))
4960
+ if (ws(S.store, T)) {
4961
+ gr(S.store, v);
4962
+ const I = Pt(u, S.store), R = Nu(S.store, v)[T];
4963
+ for (const [F, { oldValue: le, newValue: ve }] of Object.entries(R || {}))
4964
+ le === ve && delete R[F];
4965
+ I ? (y.push({
4966
+ oldEntity: S.entity,
4967
+ newEntity: I,
4968
+ changedFields: R || {}
4969
+ }), S.entity = I) : c.push(k), delete f[T];
4964
4970
  continue e;
4965
4971
  }
4966
4972
  const b = [];
4967
- for (const [T, m] of Object.entries(f)) {
4968
- const v = this.createStore([]);
4969
- l.attrs = v.attrs, gr(v, m);
4970
- const k = Pt(u, v);
4971
- if (!k) {
4973
+ for (const [T, v] of Object.entries(f)) {
4974
+ const k = this.createStore([]);
4975
+ l.attrs = k.attrs, gr(k, v);
4976
+ const S = Pt(u, k);
4977
+ if (!S) {
4972
4978
  this.log.error("No entity found after applying change", {
4973
4979
  sub: u,
4974
- changes: m,
4975
- store: v
4980
+ changes: v,
4981
+ store: k
4976
4982
  });
4977
4983
  continue;
4978
4984
  }
4979
4985
  p.push({
4980
- store: v,
4981
- entity: k,
4982
- serverCreatedAt: _r(u, v, k.id)
4983
- }), b.push(k);
4986
+ store: k,
4987
+ entity: S,
4988
+ serverCreatedAt: _r(u, k, S.id)
4989
+ }), b.push(S);
4984
4990
  }
4985
4991
  const g = [];
4986
4992
  for (const T of c.sort().reverse())
4987
4993
  g.push(p[T].entity), p.splice(T, 1);
4988
- Ku(u, p), this.notifyCbs(o, {
4994
+ const m = Ku(u, this.createStore);
4995
+ qu(u, m, p), this.notifyCbs(o, {
4989
4996
  type: ye.SyncTransaction,
4990
4997
  data: rt(u, (i = u.values) === null || i === void 0 ? void 0 : i.entities),
4991
4998
  added: b,
@@ -5052,7 +5059,7 @@ var U = function(t, e, n, r) {
5052
5059
  }
5053
5060
  d((r = r.apply(t, e || [])).next());
5054
5061
  });
5055
- }, zu = function(t, e) {
5062
+ }, Vu = function(t, e) {
5056
5063
  var n = {};
5057
5064
  for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
5058
5065
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
@@ -5066,11 +5073,11 @@ const se = {
5066
5073
  AUTHENTICATED: "authenticated",
5067
5074
  CLOSED: "closed",
5068
5075
  ERRORED: "errored"
5069
- }, Vu = 3e4, Wu = 3e4, Bu = 200, Gu = {
5076
+ }, Wu = 3e4, Bu = 3e4, Gu = 200, Qu = {
5070
5077
  apiURI: "https://api.instantdb.com",
5071
5078
  websocketURI: "wss://api.instantdb.com/runtime/session"
5072
- }, It = "_instant_oauth_redirect", De = "currentUser";
5073
- function Qu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
5079
+ }, It = "_instant_oauth_redirect", Ue = "currentUser";
5080
+ function Hu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
5074
5081
  if (!i)
5075
5082
  return new yr(`${r}?app_id=${e}`);
5076
5083
  switch (t) {
@@ -5082,7 +5089,7 @@ function Qu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl:
5082
5089
  throw new Error("Unknown transport type " + t);
5083
5090
  }
5084
5091
  }
5085
- function Hu() {
5092
+ function Yu() {
5086
5093
  return typeof window < "u" || typeof chrome < "u";
5087
5094
  }
5088
5095
  const Tr = {
@@ -5091,7 +5098,7 @@ const Tr = {
5091
5098
  "refresh-presence": !0,
5092
5099
  "patch-presence": !0
5093
5100
  };
5094
- function Yu(t, e) {
5101
+ function Ju(t, e) {
5095
5102
  var n;
5096
5103
  const r = typeof t == "string" ? JSON.parse(t) : t;
5097
5104
  if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
@@ -5100,12 +5107,12 @@ function Yu(t, e) {
5100
5107
  }
5101
5108
  return r;
5102
5109
  }
5103
- function Ju(t, e) {
5110
+ function Zu(t, e) {
5104
5111
  var n;
5105
5112
  const r = Object.assign({}, e);
5106
5113
  return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: Ur(e.result.store) })), r;
5107
5114
  }
5108
- function Zu(t, e) {
5115
+ function Xu(t, e) {
5109
5116
  switch (t) {
5110
5117
  case "pendingMutations":
5111
5118
  return new Map(typeof e == "string" ? JSON.parse(e) : e);
@@ -5113,7 +5120,7 @@ function Zu(t, e) {
5113
5120
  return e;
5114
5121
  }
5115
5122
  }
5116
- function Xu(t, e) {
5123
+ function ea(t, e) {
5117
5124
  switch (t) {
5118
5125
  case "pendingMutations":
5119
5126
  return [...e.entries()];
@@ -5121,7 +5128,7 @@ function Xu(t, e) {
5121
5128
  return e;
5122
5129
  }
5123
5130
  }
5124
- function ea(t, e, n) {
5131
+ function ta(t, e, n) {
5125
5132
  const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
5126
5133
  return r && !i && n && (n.result = r), n || e;
5127
5134
  }
@@ -5131,7 +5138,7 @@ function mr(t) {
5131
5138
  return u == a ? r < s ? -1 : r > s ? 1 : 0 : u - a;
5132
5139
  });
5133
5140
  }
5134
- class ta {
5141
+ class na {
5135
5142
  constructor(e, n = ti, r = ni, i, s) {
5136
5143
  var o, u, a;
5137
5144
  if (this._isOnline = !0, this._isShutdown = !1, this.status = se.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (d, c, f) => {
@@ -5139,9 +5146,9 @@ class ta {
5139
5146
  switch (d) {
5140
5147
  case "pendingMutations": {
5141
5148
  const y = (l = c == null ? void 0 : c.entries()) !== null && l !== void 0 ? l : [], b = (p = f == null ? void 0 : f.entries()) !== null && p !== void 0 ? p : [], g = new Map([...y, ...b]);
5142
- return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([m, v]) => {
5149
+ return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([T, v]) => {
5143
5150
  var k;
5144
- !(!((k = f == null ? void 0 : f.pendingMutations) === null || k === void 0) && k.has(m)) && !v["tx-id"] && this._sendMutation(m, v);
5151
+ !(!((k = f == null ? void 0 : f.pendingMutations) === null || k === void 0) && k.has(T)) && !v["tx-id"] && this._sendMutation(T, v);
5145
5152
  }), g;
5146
5153
  }
5147
5154
  default:
@@ -5250,10 +5257,10 @@ class ta {
5250
5257
  return;
5251
5258
  }
5252
5259
  this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
5253
- }, this._EventSource = s, this.config = Object.assign(Object.assign({}, Gu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Wu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Bu, this._log = Au(e.verbose || pn || ri, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": oi }), this.config.schema && (this._linkIndex = ar(this.config.schema)), !!Hu()) {
5260
+ }, this._EventSource = s, this.config = Object.assign(Object.assign({}, Qu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Bu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Gu, this._log = Au(e.verbose || pn || ri, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": oi }), this.config.schema && (this._linkIndex = ar(this.config.schema)), !!Yu()) {
5254
5261
  if (!e.appId)
5255
5262
  throw new Error("Instant must be initialized with an appId.");
5256
- if (!Ae(e.appId))
5263
+ if (!je(e.appId))
5257
5264
  throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
5258
5265
  typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) => U(this, void 0, void 0, function* () {
5259
5266
  var c;
@@ -5265,7 +5272,7 @@ class ta {
5265
5272
  } catch (f) {
5266
5273
  this._log.error("[error] handle broadcast channel", f);
5267
5274
  }
5268
- }))), this._initStorage(n), this._syncTable = new qu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
5275
+ }))), this._initStorage(n), this._syncTable = new zu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
5269
5276
  useDateObjects: this.config.useDateObjects
5270
5277
  }, this._log, (d) => at(this.attrs, d, this.config.enableCardinalityInference, this._linkIndex, this.config.useDateObjects)), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
5271
5278
  this._isOnline = d, this._startSocket(), r.listen((c) => {
@@ -5290,9 +5297,9 @@ class ta {
5290
5297
  _initStorage(e) {
5291
5298
  this.querySubs = new Jt({
5292
5299
  persister: new e(this.config.appId, "querySubs"),
5293
- merge: ea,
5294
- serialize: Ju,
5295
- parse: (n, r) => Yu(r, this.config.useDateObjects),
5300
+ merge: ta,
5301
+ serialize: Zu,
5302
+ parse: (n, r) => Ju(r, this.config.useDateObjects),
5296
5303
  // objectSize
5297
5304
  objectSize: (n) => {
5298
5305
  var r, i, s, o;
@@ -5311,8 +5318,8 @@ class ta {
5311
5318
  }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Jt({
5312
5319
  persister: new e(this.config.appId, "kv"),
5313
5320
  merge: this._onMergeKv,
5314
- serialize: Xu,
5315
- parse: Zu,
5321
+ serialize: ea,
5322
+ parse: Xu,
5316
5323
  objectSize: () => 0,
5317
5324
  logger: this._log,
5318
5325
  saveThrottleMs: 100,
@@ -5321,7 +5328,7 @@ class ta {
5321
5328
  gc: null
5322
5329
  }), this.kv.onKeyLoaded = (n) => {
5323
5330
  n === "pendingMutations" && this.notifyAll();
5324
- }, this.kv.waitForKeyToLoad("pendingMutations"), this.kv.waitForKeyToLoad(De), this._beforeUnloadCbs.push(() => {
5331
+ }, this.kv.waitForKeyToLoad("pendingMutations"), this.kv.waitForKeyToLoad(Ue), this._beforeUnloadCbs.push(() => {
5325
5332
  this.kv.flush(), this.querySubs.flush();
5326
5333
  });
5327
5334
  }
@@ -5343,14 +5350,14 @@ class ta {
5343
5350
  if (s)
5344
5351
  i.resolve({ status: e, eventId: n });
5345
5352
  else if (r.type) {
5346
- const { status: o } = r, u = zu(r, ["status"]);
5353
+ const { status: o } = r, u = Vu(r, ["status"]);
5347
5354
  i.reject(new bt({
5348
5355
  // @ts-expect-error body.type is not constant typed
5349
5356
  body: u,
5350
5357
  status: o
5351
5358
  }));
5352
5359
  } else
5353
- i.reject(new ke(r.message, r.hint));
5360
+ i.reject(new Ce(r.message, r.hint));
5354
5361
  }
5355
5362
  _setStatus(e, n) {
5356
5363
  this.status = e, this._errorMessage = n, this.notifyConnectionStatusSubs(e);
@@ -5384,14 +5391,14 @@ class ta {
5384
5391
  const { q: l, result: p } = n, y = K(l);
5385
5392
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
5386
5393
  break;
5387
- const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], g = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, T = ur(p), m = at(this.attrs, T, d, this._linkIndex, this.config.useDateObjects);
5394
+ const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], g = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, m = ur(p), T = at(this.attrs, m, d, this._linkIndex, this.config.useDateObjects);
5388
5395
  this.querySubs.updateInPlace((v) => {
5389
5396
  if (!v[y]) {
5390
5397
  this._log.info("Missing value in querySubs", { hash: y, q: l });
5391
5398
  return;
5392
5399
  }
5393
5400
  v[y].result = {
5394
- store: m,
5401
+ store: T,
5395
5402
  pageInfo: b,
5396
5403
  aggregate: g,
5397
5404
  processedTxId: n["processed-tx-id"]
@@ -5419,24 +5426,24 @@ class ta {
5419
5426
  const { computations: l, attrs: p } = n, y = n["processed-tx-id"];
5420
5427
  p && this._setAttrs(p), this._cleanupPendingMutationsTimeout();
5421
5428
  const b = this._rewriteMutations(this.attrs, this._pendingMutations(), y);
5422
- b !== this._pendingMutations() && this.kv.updateInPlace((m) => {
5423
- m.pendingMutations = b;
5429
+ b !== this._pendingMutations() && this.kv.updateInPlace((T) => {
5430
+ T.pendingMutations = b;
5424
5431
  });
5425
- const g = mr(b.entries()), T = l.map((m) => {
5426
- var v, k, O, I;
5427
- const R = m["instaql-query"], F = m["instaql-result"], le = K(R), Qe = ur(F), _t = at(this.attrs, Qe, d, this._linkIndex, this.config.useDateObjects), gt = this._applyOptimisticUpdates(_t, g, y), He = (k = (v = F == null ? void 0 : F[0]) === null || v === void 0 ? void 0 : v.data) === null || k === void 0 ? void 0 : k["page-info"], ne = (I = (O = F == null ? void 0 : F[0]) === null || O === void 0 ? void 0 : O.data) === null || I === void 0 ? void 0 : I.aggregate;
5432
+ const g = mr(b.entries()), m = l.map((T) => {
5433
+ var v, k, S, I;
5434
+ const R = T["instaql-query"], F = T["instaql-result"], le = K(R), ve = ur(F), _t = at(this.attrs, ve, d, this._linkIndex, this.config.useDateObjects), gt = this._applyOptimisticUpdates(_t, g, y), He = (k = (v = F == null ? void 0 : F[0]) === null || v === void 0 ? void 0 : v.data) === null || k === void 0 ? void 0 : k["page-info"], ne = (I = (S = F == null ? void 0 : F[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
5428
5435
  return { q: R, hash: le, store: gt, pageInfo: He, aggregate: ne };
5429
5436
  });
5430
- T.forEach(({ hash: m, q: v, store: k, pageInfo: O, aggregate: I }) => {
5437
+ m.forEach(({ hash: T, q: v, store: k, pageInfo: S, aggregate: I }) => {
5431
5438
  this.querySubs.updateInPlace((R) => {
5432
- if (!R[m]) {
5433
- this._log.error("Missing value in querySubs", { hash: m, q: v });
5439
+ if (!R[T]) {
5440
+ this._log.error("Missing value in querySubs", { hash: T, q: v });
5434
5441
  return;
5435
5442
  }
5436
- R[m].result = { store: k, pageInfo: O, aggregate: I, processedTxId: y };
5443
+ R[T].result = { store: k, pageInfo: S, aggregate: I, processedTxId: y };
5437
5444
  });
5438
- }), this._cleanupPendingMutationsQueries(), T.forEach(({ hash: m }) => {
5439
- this.notifyOne(m);
5445
+ }), this._cleanupPendingMutationsQueries(), m.forEach(({ hash: T }) => {
5446
+ this.notifyOne(T);
5440
5447
  });
5441
5448
  break;
5442
5449
  }
@@ -5446,10 +5453,10 @@ class ta {
5446
5453
  const b = this._rewriteMutations(this.attrs, this._pendingMutations()).get(l);
5447
5454
  if (!b)
5448
5455
  break;
5449
- this._updatePendingMutations((T) => {
5450
- T.set(l, Object.assign(Object.assign({}, T.get(l)), { "tx-id": p, confirmed: Date.now() }));
5456
+ this._updatePendingMutations((m) => {
5457
+ m.set(l, Object.assign(Object.assign({}, m.get(l)), { "tx-id": p, confirmed: Date.now() }));
5451
5458
  });
5452
- const g = b["tx-steps"].filter(([T, ...m]) => T === "add-attr").map(([T, m]) => m).concat(Object.values(this.attrs));
5459
+ const g = b["tx-steps"].filter(([m, ...T]) => m === "add-attr").map(([m, T]) => T).concat(Object.values(this.attrs));
5453
5460
  this._setAttrs(g), this._finishTransaction("synced", l), this._cleanupPendingMutationsTimeout();
5454
5461
  break;
5455
5462
  }
@@ -5602,7 +5609,7 @@ class ta {
5602
5609
  if (!this.querySubs)
5603
5610
  return i.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), i.promise;
5604
5611
  const s = K(e), o = this._startQuerySub(e, s);
5605
- return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), Vu), i.promise;
5612
+ return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), Wu), i.promise;
5606
5613
  }
5607
5614
  _completeQueryOnce(e, n, r) {
5608
5615
  this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
@@ -5646,15 +5653,15 @@ class ta {
5646
5653
  for (const p of c) {
5647
5654
  const [y] = p;
5648
5655
  if (y === "add-attr") {
5649
- const [g, T] = p, m = i(T);
5650
- if (m && T.id !== m.id) {
5651
- o.attrIdMap[T.id] = m.id, u = !0;
5656
+ const [g, m] = p, T = i(m);
5657
+ if (T && m.id !== T.id) {
5658
+ o.attrIdMap[m.id] = T.id, u = !0;
5652
5659
  continue;
5653
5660
  }
5654
- if (T["value-type"] === "ref") {
5655
- const v = s(T);
5661
+ if (m["value-type"] === "ref") {
5662
+ const v = s(m);
5656
5663
  if (v) {
5657
- o.attrIdMap[T.id] = v.id, o.refSwapAttrIds.add(T.id), u = !0;
5664
+ o.attrIdMap[m.id] = v.id, o.refSwapAttrIds.add(m.id), u = !0;
5658
5665
  continue;
5659
5666
  }
5660
5667
  }
@@ -5824,7 +5831,7 @@ class ta {
5824
5831
  return;
5825
5832
  }
5826
5833
  const e = this._transport;
5827
- this._transport = Qu({
5834
+ this._transport = Hu({
5828
5835
  transportType: this._transportType,
5829
5836
  appId: this.config.appId,
5830
5837
  apiURI: this.config.apiURI,
@@ -5934,7 +5941,7 @@ class ta {
5934
5941
  return U(this, void 0, void 0, function* () {
5935
5942
  const { user: e, error: n } = yield this.getCurrentUser();
5936
5943
  if (n)
5937
- throw new ke("Could not get current user: " + n.message);
5944
+ throw new Ce("Could not get current user: " + n.message);
5938
5945
  return e;
5939
5946
  });
5940
5947
  }
@@ -5966,8 +5973,8 @@ class ta {
5966
5973
  setCurrentUser(e) {
5967
5974
  return U(this, void 0, void 0, function* () {
5968
5975
  this.kv.updateInPlace((n) => {
5969
- n[De] = e;
5970
- }), yield this.kv.waitForKeyToLoad(De);
5976
+ n[Ue] = e;
5977
+ }), yield this.kv.waitForKeyToLoad(Ue);
5971
5978
  });
5972
5979
  }
5973
5980
  getCurrentUserCached() {
@@ -5975,7 +5982,7 @@ class ta {
5975
5982
  }
5976
5983
  _getCurrentUser() {
5977
5984
  return U(this, void 0, void 0, function* () {
5978
- const e = yield this.kv.waitForKeyToLoad(De);
5985
+ const e = yield this.kv.waitForKeyToLoad(Ue);
5979
5986
  return typeof e == "string" ? JSON.parse(e) : e;
5980
5987
  });
5981
5988
  }
@@ -6000,7 +6007,7 @@ class ta {
6000
6007
  }
6001
6008
  _hasCurrentUser() {
6002
6009
  return U(this, void 0, void 0, function* () {
6003
- const e = yield this.kv.waitForKeyToLoad(De);
6010
+ const e = yield this.kv.waitForKeyToLoad(Ue);
6004
6011
  return typeof e == "string" ? JSON.parse(e) != null : e != null;
6005
6012
  });
6006
6013
  }
@@ -6340,9 +6347,9 @@ class ta {
6340
6347
  }
6341
6348
  }
6342
6349
  let it;
6343
- function na(t, e) {
6350
+ function ra(t, e) {
6344
6351
  it == null || it.dispose();
6345
- const n = aa(e), r = sa(e, u), i = ia(ra(t));
6352
+ const n = ca(e), r = oa(e, u), i = sa(ia(t));
6346
6353
  function s(c) {
6347
6354
  var f;
6348
6355
  c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && u();
@@ -6364,10 +6371,10 @@ function na(t, e) {
6364
6371
  }
6365
6372
  return d();
6366
6373
  }
6367
- function ra(t) {
6374
+ function ia(t) {
6368
6375
  return `${pn || ii ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
6369
6376
  }
6370
- function ia(t) {
6377
+ function sa(t) {
6371
6378
  const e = document.createElement("iframe");
6372
6379
  return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
6373
6380
  width: "100%",
@@ -6376,7 +6383,7 @@ function ia(t) {
6376
6383
  border: "none"
6377
6384
  }), { element: e };
6378
6385
  }
6379
- function sa(t, e) {
6386
+ function oa(t, e) {
6380
6387
  const n = `
6381
6388
  <svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
6382
6389
  <rect width="512" height="512" fill="black"/>
@@ -6386,7 +6393,7 @@ function sa(t, e) {
6386
6393
  return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
6387
6394
  // pos
6388
6395
  position: "fixed"
6389
- }, oa(t.position)), {
6396
+ }, ua(t.position)), {
6390
6397
  height: "32px",
6391
6398
  width: "32px",
6392
6399
  // layout
@@ -6401,7 +6408,7 @@ function sa(t, e) {
6401
6408
  cursor: "pointer"
6402
6409
  })), r.addEventListener("click", e), { element: r };
6403
6410
  }
6404
- function oa(t) {
6411
+ function ua(t) {
6405
6412
  switch (t) {
6406
6413
  case "bottom-left":
6407
6414
  return { bottom: "24px", left: "24px" };
@@ -6413,7 +6420,7 @@ function oa(t) {
6413
6420
  return { top: "24px", left: "24px" };
6414
6421
  }
6415
6422
  }
6416
- function ua(t) {
6423
+ function aa(t) {
6417
6424
  switch (t) {
6418
6425
  case "bottom-left":
6419
6426
  return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
@@ -6425,23 +6432,23 @@ function ua(t) {
6425
6432
  return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
6426
6433
  }
6427
6434
  }
6428
- function aa(t) {
6435
+ function ca(t) {
6429
6436
  const e = document.createElement("div");
6430
- Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, ua(t.position)), { display: "block", borderRadius: "4px", border: "1px #ccc solid", boxShadow: "0px 0px 8px #00000044", backgroundColor: "#eee", zIndex: "999990" })), e.style.display = "none", e.className = "instant-devtool-container";
6437
+ Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, aa(t.position)), { display: "block", borderRadius: "4px", border: "1px #ccc solid", boxShadow: "0px 0px 8px #00000044", backgroundColor: "#eee", zIndex: "999990" })), e.style.display = "none", e.className = "instant-devtool-container";
6431
6438
  function n() {
6432
6439
  return e.style.display !== "none";
6433
6440
  }
6434
6441
  return { element: e, isVisible: n };
6435
6442
  }
6436
- const ca = {
6443
+ const da = {
6437
6444
  apiURI: "https://api.instantdb.com",
6438
6445
  websocketURI: "wss://api.instantdb.com/runtime/session"
6439
6446
  };
6440
- function da() {
6447
+ function fa() {
6441
6448
  var t;
6442
6449
  return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
6443
6450
  }
6444
- function fa() {
6451
+ function la() {
6445
6452
  var t;
6446
6453
  return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
6447
6454
  }
@@ -6449,23 +6456,23 @@ function Zt(t) {
6449
6456
  const e = t.__adminToken;
6450
6457
  return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
6451
6458
  }
6452
- const Xt = fa(), Mt = da();
6453
- class la {
6459
+ const Xt = la(), Mt = fa();
6460
+ class ha {
6454
6461
  constructor(e) {
6455
6462
  this.db = e, this.sendMagicCode = (n) => this.db.sendMagicCode(n), this.signInWithMagicCode = (n) => this.db.signInWithMagicCode(n), this.signInWithToken = (n) => this.db.signInWithCustomToken(n), this.signInAsGuest = () => this.db.signInAsGuest(), this.createAuthorizationURL = (n) => this.db.createAuthorizationURL(n), this.signInWithIdToken = (n) => this.db.signInWithIdToken(n), this.exchangeOAuthCode = (n) => this.db.exchangeCodeForToken(n), this.issuerURI = () => this.db.issuerURI(), this.signOut = (n = { invalidateToken: !0 }) => this.db.signOut(n);
6456
6463
  }
6457
6464
  }
6458
- class ha {
6465
+ class pa {
6459
6466
  constructor(e) {
6460
6467
  this.db = e, this.uploadFile = (n, r, i = {}) => this.db.uploadFile(n, r, i), this.delete = (n) => this.db.deleteFile(n), this.upload = (n, r) => this.db.upload(n, r), this.put = this.upload, this.getDownloadUrl = (n) => this.db.getDownloadUrl(n);
6461
6468
  }
6462
6469
  }
6463
- function pa(t) {
6470
+ function ya(t) {
6464
6471
  return JSON.parse(JSON.stringify(t));
6465
6472
  }
6466
- class ya {
6473
+ class ba {
6467
6474
  constructor(e) {
6468
- this.tx = hn(), this._reactor = e, this.auth = new la(this._reactor), this.storage = new ha(this._reactor);
6475
+ this.tx = hn(), this._reactor = e, this.auth = new ha(this._reactor), this.storage = new pa(this._reactor);
6469
6476
  }
6470
6477
  /**
6471
6478
  * Use this to write data! You can create, update, delete, and link objects
@@ -6647,23 +6654,23 @@ function wr(t) {
6647
6654
  const e = K(t);
6648
6655
  return Mt.set(t, e), e;
6649
6656
  }
6650
- function ba(t, e) {
6657
+ function _a(t, e) {
6651
6658
  return wr(t._reactor.config.schema) !== wr(e);
6652
6659
  }
6653
- function _a(t, e, n, r, i) {
6660
+ function ga(t, e, n, r, i) {
6654
6661
  const s = Xt[Zt(t)];
6655
6662
  if (s)
6656
- return ba(s, t.schema) && s._reactor.updateSchema(t.schema), s;
6657
- const o = new ta(Object.assign(Object.assign(Object.assign({}, ca), t), { cardinalityInference: !!t.schema }), e || ti, n || ni, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": oi }), i), u = new ya(o);
6658
- return Xt[Zt(t)] = u, ga(t.appId, t.devtool), u;
6663
+ return _a(s, t.schema) && s._reactor.updateSchema(t.schema), s;
6664
+ const o = new na(Object.assign(Object.assign(Object.assign({}, da), t), { cardinalityInference: !!t.schema }), e || ti, n || ni, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": oi }), i), u = new ba(o);
6665
+ return Xt[Zt(t)] = u, Ta(t.appId, t.devtool), u;
6659
6666
  }
6660
- function ga(t, e) {
6667
+ function Ta(t, e) {
6661
6668
  if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
6662
6669
  return;
6663
6670
  const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
6664
- n.allowedHosts.includes(window.location.hostname) && na(t, n);
6671
+ n.allowedHosts.includes(window.location.hostname) && ra(t, n);
6665
6672
  }
6666
- const Ta = {
6673
+ const ma = {
6667
6674
  isLoading: !0,
6668
6675
  data: void 0,
6669
6676
  pageInfo: void 0,
@@ -6678,9 +6685,9 @@ function vr(t) {
6678
6685
  ...t || {}
6679
6686
  };
6680
6687
  }
6681
- function ma(t, e, n) {
6688
+ function wa(t, e, n) {
6682
6689
  e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
6683
- const r = e ? pa(e) : null, i = K(r), s = ze(
6690
+ const r = e ? ya(e) : null, i = K(r), s = Ve(
6684
6691
  vr(t._reactor.getPreviousResult(r))
6685
6692
  ), o = de(
6686
6693
  (a) => (s.current = vr(
@@ -6701,11 +6708,11 @@ function ma(t, e, n) {
6701
6708
  return { state: Rt(
6702
6709
  o,
6703
6710
  () => s.current,
6704
- () => Ta
6711
+ () => ma
6705
6712
  ), query: r };
6706
6713
  }
6707
- function wa() {
6708
- const t = ze(null);
6714
+ function va() {
6715
+ const t = Ve(null);
6709
6716
  Te(() => {
6710
6717
  n();
6711
6718
  }, []);
@@ -6717,9 +6724,9 @@ function wa() {
6717
6724
  }
6718
6725
  return { set: e, clear: n };
6719
6726
  }
6720
- const va = 1e3;
6721
- function Sa(t, e, n) {
6722
- const r = ze(n);
6727
+ const Sa = 1e3;
6728
+ function Oa(t, e, n) {
6729
+ const r = Ve(n);
6723
6730
  r.current = n, Te(() => t.core._reactor.subscribeTopic(
6724
6731
  t.id,
6725
6732
  e,
@@ -6728,7 +6735,7 @@ function Sa(t, e, n) {
6728
6735
  }
6729
6736
  ), [t.id, e]);
6730
6737
  }
6731
- function Oa(t, e) {
6738
+ function Ea(t, e) {
6732
6739
  return Te(() => t.core._reactor.joinRoom(t.id), [t.id]), de(
6733
6740
  (r) => {
6734
6741
  t.core._reactor.publishTopic({
@@ -6741,7 +6748,7 @@ function Oa(t, e) {
6741
6748
  [t.id, e]
6742
6749
  );
6743
6750
  }
6744
- function Ea(t, e = {}) {
6751
+ function Aa(t, e = {}) {
6745
6752
  var o, u;
6746
6753
  const [n, r] = Or(() => t.core._reactor.getPresence(t.type, t.id, e) ?? {
6747
6754
  peers: {},
@@ -6766,11 +6773,11 @@ function Ea(t, e = {}) {
6766
6773
  publishPresence: i
6767
6774
  }), [n, i]);
6768
6775
  }
6769
- function Aa(t, e, n) {
6776
+ function ja(t, e, n) {
6770
6777
  Te(() => t.core._reactor.joinRoom(t.id, e), [t.id]), Te(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
6771
6778
  }
6772
- function ja(t, e, n = {}) {
6773
- const r = wa(), i = be.usePresence(t, {
6779
+ function ka(t, e, n = {}) {
6780
+ const r = va(), i = be.usePresence(t, {
6774
6781
  keys: [e]
6775
6782
  }), s = $t(() => {
6776
6783
  const c = t._core._reactor.getPresence(
@@ -6784,7 +6791,7 @@ function ja(t, e, n = {}) {
6784
6791
  (c) => {
6785
6792
  t.core._reactor.publishPresence(t.type, t.id, {
6786
6793
  [e]: c
6787
- }), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? va, () => {
6794
+ }), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? Sa, () => {
6788
6795
  t.core._reactor.publishPresence(t.type, t.id, {
6789
6796
  [e]: null
6790
6797
  });
@@ -6807,25 +6814,25 @@ function ja(t, e, n = {}) {
6807
6814
  };
6808
6815
  }
6809
6816
  const be = {
6810
- useTopicEffect: Sa,
6811
- usePublishTopic: Oa,
6812
- usePresence: Ea,
6813
- useSyncPresence: Aa,
6814
- useTypingIndicator: ja
6817
+ useTopicEffect: Oa,
6818
+ usePublishTopic: Ea,
6819
+ usePresence: Aa,
6820
+ useSyncPresence: ja,
6821
+ useTypingIndicator: ka
6815
6822
  };
6816
- class ka {
6823
+ class Ca {
6817
6824
  constructor(e, n, r) {
6818
6825
  this.useTopicEffect = (i, s) => {
6819
6826
  be.useTopicEffect(this, i, s);
6820
6827
  }, this.usePublishTopic = (i) => be.usePublishTopic(this, i), this.usePresence = (i = {}) => be.usePresence(this, i), this.useSyncPresence = (i, s) => be.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => be.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
6821
6828
  }
6822
6829
  }
6823
- const Ca = {
6830
+ const Pa = {
6824
6831
  isLoading: !0,
6825
6832
  user: void 0,
6826
6833
  error: void 0
6827
6834
  };
6828
- class Ia {
6835
+ class Ma {
6829
6836
  constructor(e, n) {
6830
6837
  this.tx = hn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
6831
6838
  const [i, s] = Or(null);
@@ -6835,12 +6842,12 @@ class Ia {
6835
6842
  s(u);
6836
6843
  })();
6837
6844
  }, [r]), i;
6838
- }, this.rooms = be, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => ma(
6845
+ }, this.rooms = be, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => wa(
6839
6846
  this.core,
6840
6847
  r,
6841
6848
  i
6842
6849
  ).state, this.useAuth = () => {
6843
- const r = ze(
6850
+ const r = Ve(
6844
6851
  this.core._reactor._currentUserCached
6845
6852
  ), i = de((o) => this.core.subscribeAuth((a) => {
6846
6853
  r.current = { isLoading: !1, ...a }, o();
@@ -6848,17 +6855,17 @@ class Ia {
6848
6855
  return Rt(
6849
6856
  i,
6850
6857
  () => r.current,
6851
- () => Ca
6858
+ () => Pa
6852
6859
  );
6853
6860
  }, this.useUser = () => {
6854
6861
  const { user: r } = this.useAuth();
6855
6862
  if (!r)
6856
- throw new ke(
6863
+ throw new Ce(
6857
6864
  "useUser must be used within an auth-protected route"
6858
6865
  );
6859
6866
  return r;
6860
6867
  }, this.useConnectionStatus = () => {
6861
- const r = ze(
6868
+ const r = Ve(
6862
6869
  this.core._reactor.status
6863
6870
  ), i = de((o) => this.core.subscribeConnectionStatus((a) => {
6864
6871
  a !== r.current && (r.current = a, o());
@@ -6875,7 +6882,7 @@ class Ia {
6875
6882
  }, this.SignedOut = ({ children: r }) => {
6876
6883
  const i = this.useAuth();
6877
6884
  return i.isLoading || i.error || i.user ? null : /* @__PURE__ */ et.jsx(et.Fragment, { children: r });
6878
- }, this.core = _a(
6885
+ }, this.core = ga(
6879
6886
  e,
6880
6887
  // @ts-expect-error because TS can't resolve subclass statics
6881
6888
  this.constructor.Storage,
@@ -6899,7 +6906,7 @@ class Ia {
6899
6906
  * const { peers } = db.rooms.usePresence(room);
6900
6907
  */
6901
6908
  room(e = "_defaultRoomType", n = "_defaultRoomId") {
6902
- return new ka(this.core, e, n);
6909
+ return new Ca(this.core, e, n);
6903
6910
  }
6904
6911
  /**
6905
6912
  * One time query for the logged in state. This is useful
@@ -6916,5 +6923,5 @@ class Ia {
6916
6923
  }
6917
6924
  }
6918
6925
  export {
6919
- Ia as InstantReactAbstractDatabase
6926
+ Ma as InstantReactAbstractDatabase
6920
6927
  };