@instantdb/react-common 1.0.50-branch-log-dashboard-login-code.29876046282.1 → 1.0.50

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,7 +1,7 @@
1
1
  var Gs = Object.defineProperty;
2
2
  var Hs = (n, e, t) => e in n ? Gs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
3
  var p = (n, e, t) => Hs(n, typeof e != "symbol" ? e + "" : e, t);
4
- import Rr, { useRef as Oe, useCallback as Te, useSyncExternalStore as st, useEffect as je, useMemo as Jt, useState as Mr } from "react";
4
+ import Mr, { useRef as ke, useCallback as Ae, useSyncExternalStore as At, useEffect as je, useMemo as Jt, useState as Rr } from "react";
5
5
  var Yt = { exports: {} }, Je = {};
6
6
  /**
7
7
  * @license React
@@ -16,13 +16,13 @@ var zn;
16
16
  function Js() {
17
17
  if (zn) return Je;
18
18
  zn = 1;
19
- var n = Rr, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
19
+ var n = Mr, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
20
20
  function o(a, c, u) {
21
- var l, f = {}, h = null, b = null;
22
- u !== void 0 && (h = "" + u), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (b = c.ref);
21
+ var l, f = {}, h = null, y = null;
22
+ u !== void 0 && (h = "" + u), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (y = c.ref);
23
23
  for (l in c) r.call(c, l) && !i.hasOwnProperty(l) && (f[l] = c[l]);
24
24
  if (a && a.defaultProps) for (l in c = a.defaultProps, c) f[l] === void 0 && (f[l] = c[l]);
25
- return { $$typeof: e, type: a, key: h, ref: b, props: f, _owner: s.current };
25
+ return { $$typeof: e, type: a, key: h, ref: y, props: f, _owner: s.current };
26
26
  }
27
27
  return Je.Fragment = t, Je.jsx = o, Je.jsxs = o, Je;
28
28
  }
@@ -41,39 +41,39 @@ function Ys() {
41
41
  * LICENSE file in the root directory of this source tree.
42
42
  */
43
43
  return n.NODE_ENV !== "production" && function() {
44
- var e = Rr, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), g = Symbol.iterator, _ = "@@iterator";
44
+ var e = Mr, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, m = "@@iterator";
45
45
  function S(d) {
46
46
  if (d === null || typeof d != "object")
47
47
  return null;
48
- var w = g && d[g] || d[_];
48
+ var w = g && d[g] || d[m];
49
49
  return typeof w == "function" ? w : null;
50
50
  }
51
- var m = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
51
+ var _ = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
52
52
  function T(d) {
53
53
  {
54
54
  for (var w = arguments.length, v = new Array(w > 1 ? w - 1 : 0), I = 1; I < w; I++)
55
55
  v[I - 1] = arguments[I];
56
- C("error", d, v);
56
+ M("error", d, v);
57
57
  }
58
58
  }
59
- function C(d, w, v) {
59
+ function M(d, w, v) {
60
60
  {
61
- var I = m.ReactDebugCurrentFrame, W = I.getStackAddendum();
61
+ var I = _.ReactDebugCurrentFrame, W = I.getStackAddendum();
62
62
  W !== "" && (w += "%s", v = v.concat([W]));
63
- var V = v.map(function(F) {
64
- return String(F);
63
+ var V = v.map(function(D) {
64
+ return String(D);
65
65
  });
66
66
  V.unshift("Warning: " + w), Function.prototype.apply.call(console[d], console, V);
67
67
  }
68
68
  }
69
- var O = !1, M = !1, R = !1, P = !1, G = !1, L;
70
- L = Symbol.for("react.module.reference");
69
+ var O = !1, F = !1, P = !1, C = !1, G = !1, N;
70
+ N = Symbol.for("react.module.reference");
71
71
  function B(d) {
72
- return !!(typeof d == "string" || typeof d == "function" || d === s || d === o || G || d === i || d === l || d === f || P || d === y || O || M || R || typeof d == "object" && d !== null && (d.$$typeof === b || d.$$typeof === h || d.$$typeof === a || d.$$typeof === c || d.$$typeof === u || // This needs to include all possible module reference object
72
+ return !!(typeof d == "string" || typeof d == "function" || d === s || d === o || G || d === i || d === l || d === f || C || d === b || O || F || P || typeof d == "object" && d !== null && (d.$$typeof === y || d.$$typeof === h || d.$$typeof === a || d.$$typeof === c || d.$$typeof === u || // This needs to include all possible module reference object
73
73
  // types supported by any Flight configuration anywhere since
74
74
  // we don't know which Flight build this will end up being used
75
75
  // with.
76
- d.$$typeof === L || d.getModuleId !== void 0));
76
+ d.$$typeof === N || d.getModuleId !== void 0));
77
77
  }
78
78
  function z(d, w, v) {
79
79
  var I = d.displayName;
@@ -119,10 +119,10 @@ function Ys() {
119
119
  case h:
120
120
  var I = d.displayName || null;
121
121
  return I !== null ? I : q(d.type) || "Memo";
122
- case b: {
123
- var W = d, V = W._payload, F = W._init;
122
+ case y: {
123
+ var W = d, V = W._payload, D = W._init;
124
124
  try {
125
- return q(F(V));
125
+ return q(D(V));
126
126
  } catch {
127
127
  return null;
128
128
  }
@@ -130,14 +130,14 @@ function Ys() {
130
130
  }
131
131
  return null;
132
132
  }
133
- var E = Object.assign, $ = 0, j, x, N, A, k, K, H;
133
+ var E = Object.assign, j = 0, R, U, L, A, k, K, H;
134
134
  function Y() {
135
135
  }
136
136
  Y.__reactDisabledLog = !0;
137
137
  function oe() {
138
138
  {
139
- if ($ === 0) {
140
- j = console.log, x = console.info, N = console.warn, A = console.error, k = console.group, K = console.groupCollapsed, H = console.groupEnd;
139
+ if (j === 0) {
140
+ R = console.log, U = console.info, L = console.warn, A = console.error, k = console.group, K = console.groupCollapsed, H = console.groupEnd;
141
141
  var d = {
142
142
  configurable: !0,
143
143
  enumerable: !0,
@@ -154,12 +154,12 @@ function Ys() {
154
154
  groupEnd: d
155
155
  });
156
156
  }
157
- $++;
157
+ j++;
158
158
  }
159
159
  }
160
160
  function Ge() {
161
161
  {
162
- if ($--, $ === 0) {
162
+ if (j--, j === 0) {
163
163
  var d = {
164
164
  configurable: !0,
165
165
  enumerable: !0,
@@ -167,13 +167,13 @@ function Ys() {
167
167
  };
168
168
  Object.defineProperties(console, {
169
169
  log: E({}, d, {
170
- value: j
170
+ value: R
171
171
  }),
172
172
  info: E({}, d, {
173
- value: x
173
+ value: U
174
174
  }),
175
175
  warn: E({}, d, {
176
- value: N
176
+ value: L
177
177
  }),
178
178
  error: E({}, d, {
179
179
  value: A
@@ -189,11 +189,11 @@ function Ys() {
189
189
  })
190
190
  });
191
191
  }
192
- $ < 0 && T("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
192
+ j < 0 && T("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
193
193
  }
194
194
  }
195
- var ge = m.ReactCurrentDispatcher, jt;
196
- function lt(d, w, v) {
195
+ var ge = _.ReactCurrentDispatcher, jt;
196
+ function ut(d, w, v) {
197
197
  {
198
198
  if (jt === void 0)
199
199
  try {
@@ -206,16 +206,16 @@ function Ys() {
206
206
  ` + jt + d;
207
207
  }
208
208
  }
209
- var $t = !1, ft;
209
+ var $t = !1, lt;
210
210
  {
211
211
  var vs = typeof WeakMap == "function" ? WeakMap : Map;
212
- ft = new vs();
212
+ lt = new vs();
213
213
  }
214
214
  function In(d, w) {
215
215
  if (!d || $t)
216
216
  return "";
217
217
  {
218
- var v = ft.get(d);
218
+ var v = lt.get(d);
219
219
  if (v !== void 0)
220
220
  return v;
221
221
  }
@@ -227,27 +227,27 @@ function Ys() {
227
227
  V = ge.current, ge.current = null, oe();
228
228
  try {
229
229
  if (w) {
230
- var F = function() {
230
+ var D = function() {
231
231
  throw Error();
232
232
  };
233
- if (Object.defineProperty(F.prototype, "props", {
233
+ if (Object.defineProperty(D.prototype, "props", {
234
234
  set: function() {
235
235
  throw Error();
236
236
  }
237
237
  }), typeof Reflect == "object" && Reflect.construct) {
238
238
  try {
239
- Reflect.construct(F, []);
239
+ Reflect.construct(D, []);
240
240
  } catch (ue) {
241
241
  I = ue;
242
242
  }
243
- Reflect.construct(d, [], F);
243
+ Reflect.construct(d, [], D);
244
244
  } else {
245
245
  try {
246
- F.call();
246
+ D.call();
247
247
  } catch (ue) {
248
248
  I = ue;
249
249
  }
250
- d.call(F.prototype);
250
+ d.call(D.prototype);
251
251
  }
252
252
  } else {
253
253
  try {
@@ -259,18 +259,18 @@ function Ys() {
259
259
  }
260
260
  } catch (ue) {
261
261
  if (ue && I && typeof ue.stack == "string") {
262
- for (var D = ue.stack.split(`
262
+ for (var $ = ue.stack.split(`
263
263
  `), ae = I.stack.split(`
264
- `), Z = D.length - 1, te = ae.length - 1; Z >= 1 && te >= 0 && D[Z] !== ae[te]; )
264
+ `), Z = $.length - 1, te = ae.length - 1; Z >= 1 && te >= 0 && $[Z] !== ae[te]; )
265
265
  te--;
266
266
  for (; Z >= 1 && te >= 0; Z--, te--)
267
- if (D[Z] !== ae[te]) {
267
+ if ($[Z] !== ae[te]) {
268
268
  if (Z !== 1 || te !== 1)
269
269
  do
270
- if (Z--, te--, te < 0 || D[Z] !== ae[te]) {
270
+ if (Z--, te--, te < 0 || $[Z] !== ae[te]) {
271
271
  var ye = `
272
- ` + D[Z].replace(" at new ", " at ");
273
- return d.displayName && ye.includes("<anonymous>") && (ye = ye.replace("<anonymous>", d.displayName)), typeof d == "function" && ft.set(d, ye), ye;
272
+ ` + $[Z].replace(" at new ", " at ");
273
+ return d.displayName && ye.includes("<anonymous>") && (ye = ye.replace("<anonymous>", d.displayName)), typeof d == "function" && lt.set(d, ye), ye;
274
274
  }
275
275
  while (Z >= 1 && te >= 0);
276
276
  break;
@@ -279,8 +279,8 @@ function Ys() {
279
279
  } finally {
280
280
  $t = !1, ge.current = V, Ge(), Error.prepareStackTrace = W;
281
281
  }
282
- var Le = d ? d.displayName || d.name : "", Ce = Le ? lt(Le) : "";
283
- return typeof d == "function" && ft.set(d, Ce), Ce;
282
+ var Le = d ? d.displayName || d.name : "", Ce = Le ? ut(Le) : "";
283
+ return typeof d == "function" && lt.set(d, Ce), Ce;
284
284
  }
285
285
  function As(d, w, v) {
286
286
  return In(d, !1);
@@ -289,59 +289,59 @@ function Ys() {
289
289
  var w = d.prototype;
290
290
  return !!(w && w.isReactComponent);
291
291
  }
292
- function dt(d, w, v) {
292
+ function ft(d, w, v) {
293
293
  if (d == null)
294
294
  return "";
295
295
  if (typeof d == "function")
296
296
  return In(d, Os(d));
297
297
  if (typeof d == "string")
298
- return lt(d);
298
+ return ut(d);
299
299
  switch (d) {
300
300
  case l:
301
- return lt("Suspense");
301
+ return ut("Suspense");
302
302
  case f:
303
- return lt("SuspenseList");
303
+ return ut("SuspenseList");
304
304
  }
305
305
  if (typeof d == "object")
306
306
  switch (d.$$typeof) {
307
307
  case u:
308
308
  return As(d.render);
309
309
  case h:
310
- return dt(d.type, w, v);
311
- case b: {
310
+ return ft(d.type, w, v);
311
+ case y: {
312
312
  var I = d, W = I._payload, V = I._init;
313
313
  try {
314
- return dt(V(W), w, v);
314
+ return ft(V(W), w, v);
315
315
  } catch {
316
316
  }
317
317
  }
318
318
  }
319
319
  return "";
320
320
  }
321
- var He = Object.prototype.hasOwnProperty, Pn = {}, Rn = m.ReactDebugCurrentFrame;
322
- function ht(d) {
321
+ var He = Object.prototype.hasOwnProperty, Pn = {}, Mn = _.ReactDebugCurrentFrame;
322
+ function dt(d) {
323
323
  if (d) {
324
- var w = d._owner, v = dt(d.type, d._source, w ? w.type : null);
325
- Rn.setExtraStackFrame(v);
324
+ var w = d._owner, v = ft(d.type, d._source, w ? w.type : null);
325
+ Mn.setExtraStackFrame(v);
326
326
  } else
327
- Rn.setExtraStackFrame(null);
327
+ Mn.setExtraStackFrame(null);
328
328
  }
329
329
  function Es(d, w, v, I, W) {
330
330
  {
331
331
  var V = Function.call.bind(He);
332
- for (var F in d)
333
- if (V(d, F)) {
334
- var D = void 0;
332
+ for (var D in d)
333
+ if (V(d, D)) {
334
+ var $ = void 0;
335
335
  try {
336
- if (typeof d[F] != "function") {
337
- var ae = Error((I || "React class") + ": " + v + " type `" + F + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof d[F] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
336
+ if (typeof d[D] != "function") {
337
+ var ae = Error((I || "React class") + ": " + v + " type `" + D + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof d[D] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
338
338
  throw ae.name = "Invariant Violation", ae;
339
339
  }
340
- D = d[F](w, F, I, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
340
+ $ = d[D](w, D, I, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
341
341
  } catch (Z) {
342
- D = Z;
342
+ $ = Z;
343
343
  }
344
- D && !(D instanceof Error) && (ht(W), T("%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).", I || "React class", v, F, typeof D), ht(null)), D instanceof Error && !(D.message in Pn) && (Pn[D.message] = !0, ht(W), T("Failed %s type: %s", v, D.message), ht(null));
344
+ $ && !($ instanceof Error) && (dt(W), T("%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).", I || "React class", v, D, typeof $), dt(null)), $ instanceof Error && !($.message in Pn) && (Pn[$.message] = !0, dt(W), T("Failed %s type: %s", v, $.message), dt(null));
345
345
  }
346
346
  }
347
347
  }
@@ -357,25 +357,25 @@ function Ys() {
357
357
  }
358
358
  function Is(d) {
359
359
  try {
360
- return Mn(d), !1;
360
+ return Rn(d), !1;
361
361
  } catch {
362
362
  return !0;
363
363
  }
364
364
  }
365
- function Mn(d) {
365
+ function Rn(d) {
366
366
  return "" + d;
367
367
  }
368
368
  function jn(d) {
369
369
  if (Is(d))
370
- return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Cs(d)), Mn(d);
370
+ return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Cs(d)), Rn(d);
371
371
  }
372
- var $n = m.ReactCurrentOwner, Ps = {
372
+ var $n = _.ReactCurrentOwner, Ps = {
373
373
  key: !0,
374
374
  ref: !0,
375
375
  __self: !0,
376
376
  __source: !0
377
377
  }, xn, Dn;
378
- function Rs(d) {
378
+ function Ms(d) {
379
379
  if (He.call(d, "ref")) {
380
380
  var w = Object.getOwnPropertyDescriptor(d, "ref").get;
381
381
  if (w && w.isReactWarning)
@@ -383,7 +383,7 @@ function Ys() {
383
383
  }
384
384
  return d.ref !== void 0;
385
385
  }
386
- function Ms(d) {
386
+ function Rs(d) {
387
387
  if (He.call(d, "key")) {
388
388
  var w = Object.getOwnPropertyDescriptor(d, "key").get;
389
389
  if (w && w.isReactWarning)
@@ -416,57 +416,57 @@ function Ys() {
416
416
  });
417
417
  }
418
418
  }
419
- var Ds = function(d, w, v, I, W, V, F) {
420
- var D = {
419
+ var Ds = function(d, w, v, I, W, V, D) {
420
+ var $ = {
421
421
  // This tag allows us to uniquely identify this as a React Element
422
422
  $$typeof: t,
423
423
  // Built-in properties that belong on the element
424
424
  type: d,
425
425
  key: w,
426
426
  ref: v,
427
- props: F,
427
+ props: D,
428
428
  // Record the component responsible for creating this element.
429
429
  _owner: V
430
430
  };
431
- return D._store = {}, Object.defineProperty(D._store, "validated", {
431
+ return $._store = {}, Object.defineProperty($._store, "validated", {
432
432
  configurable: !1,
433
433
  enumerable: !1,
434
434
  writable: !0,
435
435
  value: !1
436
- }), Object.defineProperty(D, "_self", {
436
+ }), Object.defineProperty($, "_self", {
437
437
  configurable: !1,
438
438
  enumerable: !1,
439
439
  writable: !1,
440
440
  value: I
441
- }), Object.defineProperty(D, "_source", {
441
+ }), Object.defineProperty($, "_source", {
442
442
  configurable: !1,
443
443
  enumerable: !1,
444
444
  writable: !1,
445
445
  value: W
446
- }), Object.freeze && (Object.freeze(D.props), Object.freeze(D)), D;
446
+ }), Object.freeze && (Object.freeze($.props), Object.freeze($)), $;
447
447
  };
448
448
  function Us(d, w, v, I, W) {
449
449
  {
450
- var V, F = {}, D = null, ae = null;
451
- v !== void 0 && (jn(v), D = "" + v), Ms(w) && (jn(w.key), D = "" + w.key), Rs(w) && (ae = w.ref, js(w, W));
450
+ var V, D = {}, $ = null, ae = null;
451
+ v !== void 0 && (jn(v), $ = "" + v), Rs(w) && (jn(w.key), $ = "" + w.key), Ms(w) && (ae = w.ref, js(w, W));
452
452
  for (V in w)
453
- He.call(w, V) && !Ps.hasOwnProperty(V) && (F[V] = w[V]);
453
+ He.call(w, V) && !Ps.hasOwnProperty(V) && (D[V] = w[V]);
454
454
  if (d && d.defaultProps) {
455
455
  var Z = d.defaultProps;
456
456
  for (V in Z)
457
- F[V] === void 0 && (F[V] = Z[V]);
457
+ D[V] === void 0 && (D[V] = Z[V]);
458
458
  }
459
- if (D || ae) {
459
+ if ($ || ae) {
460
460
  var te = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
461
- D && $s(F, te), ae && xs(F, te);
461
+ $ && $s(D, te), ae && xs(D, te);
462
462
  }
463
- return Ds(d, D, ae, W, I, $n.current, F);
463
+ return Ds(d, $, ae, W, I, $n.current, D);
464
464
  }
465
465
  }
466
- var Dt = m.ReactCurrentOwner, Un = m.ReactDebugCurrentFrame;
466
+ var Dt = _.ReactCurrentOwner, Un = _.ReactDebugCurrentFrame;
467
467
  function Ue(d) {
468
468
  if (d) {
469
- var w = d._owner, v = dt(d.type, d._source, w ? w.type : null);
469
+ var w = d._owner, v = ft(d.type, d._source, w ? w.type : null);
470
470
  Un.setExtraStackFrame(v);
471
471
  } else
472
472
  Un.setExtraStackFrame(null);
@@ -531,8 +531,8 @@ Check the top-level render call using <` + v + ">.");
531
531
  else if (d) {
532
532
  var W = S(d);
533
533
  if (typeof W == "function" && W !== d.entries)
534
- for (var V = W.call(d), F; !(F = V.next()).done; )
535
- Lt(F.value) && Nn(F.value, w);
534
+ for (var V = W.call(d), D; !(D = V.next()).done; )
535
+ Lt(D.value) && Nn(D.value, w);
536
536
  }
537
537
  }
538
538
  }
@@ -576,19 +576,19 @@ Check the top-level render call using <` + v + ">.");
576
576
  var qn = {};
577
577
  function Wn(d, w, v, I, W, V) {
578
578
  {
579
- var F = B(d);
580
- if (!F) {
581
- var D = "";
582
- (d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && (D += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
579
+ var D = B(d);
580
+ if (!D) {
581
+ var $ = "";
582
+ (d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && ($ += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
583
583
  var ae = Ls();
584
- ae ? D += ae : D += Ln();
584
+ ae ? $ += ae : $ += Ln();
585
585
  var Z;
586
- d === null ? Z = "null" : xt(d) ? Z = "array" : d !== void 0 && d.$$typeof === t ? (Z = "<" + (q(d.type) || "Unknown") + " />", D = " Did you accidentally export a JSX literal instead of a component?") : Z = typeof d, T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Z, D);
586
+ d === null ? Z = "null" : xt(d) ? Z = "array" : d !== void 0 && d.$$typeof === t ? (Z = "<" + (q(d.type) || "Unknown") + " />", $ = " Did you accidentally export a JSX literal instead of a component?") : Z = typeof d, T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Z, $);
587
587
  }
588
588
  var te = Us(d, w, v, W, V);
589
589
  if (te == null)
590
590
  return te;
591
- if (F) {
591
+ if (D) {
592
592
  var ye = w.children;
593
593
  if (ye !== void 0)
594
594
  if (I)
@@ -630,9 +630,9 @@ React keys must be passed directly to JSX without using spread:
630
630
  }
631
631
  var Zs = {};
632
632
  Zs.NODE_ENV === "production" ? Yt.exports = Js() : Yt.exports = Ys();
633
- var pt = Yt.exports;
634
- function ie(n) {
635
- const e = wt(n);
633
+ var ht = Yt.exports;
634
+ function se(n) {
635
+ const e = mt(n);
636
636
  let t = 3735928559 ^ e.length, r = 1103547991 ^ e.length;
637
637
  for (let s = 0; s < e.length; s++) {
638
638
  const i = e.charCodeAt(s);
@@ -640,13 +640,13 @@ function ie(n) {
640
640
  }
641
641
  return t = Math.imul(t ^ t >>> 16, 2246822507) ^ Math.imul(r ^ r >>> 13, 3266489909), r = Math.imul(r ^ r >>> 16, 2246822507) ^ Math.imul(t ^ t >>> 13, 3266489909), `${(r >>> 0).toString(16).padStart(8, "0")}${(t >>> 0).toString(16).padStart(8, "0")}`;
642
642
  }
643
- function wt(n) {
643
+ function mt(n) {
644
644
  if (n && typeof n.toJSON == "function")
645
- return wt(n.toJSON());
645
+ return mt(n.toJSON());
646
646
  if (Array.isArray(n)) {
647
647
  let e = "[";
648
648
  for (let t = 0; t < n.length; t++)
649
- t > 0 && (e += ","), e += wt(n[t]);
649
+ t > 0 && (e += ","), e += mt(n[t]);
650
650
  return e + "]";
651
651
  }
652
652
  if (n && typeof n == "object") {
@@ -655,7 +655,7 @@ function wt(n) {
655
655
  let t = "{", r = !0;
656
656
  for (let s = 0; s < e.length; s++) {
657
657
  const i = e[s], o = n[i];
658
- o !== void 0 && (r || (t += ","), t += JSON.stringify(i) + ":" + wt(o), r = !1);
658
+ o !== void 0 && (r || (t += ","), t += JSON.stringify(i) + ":" + mt(o), r = !1);
659
659
  }
660
660
  return t + "}";
661
661
  }
@@ -706,11 +706,11 @@ const X = {
706
706
  Remove: "remove",
707
707
  Replace: "replace",
708
708
  Add: "add"
709
- }, jr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Xs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), St = Symbol.iterator, pe = {
709
+ }, jr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Xs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), wt = Symbol.iterator, pe = {
710
710
  mutable: "mutable",
711
711
  immutable: "immutable"
712
712
  }, bn = {};
713
- function it(n, e) {
713
+ function st(n, e) {
714
714
  return n instanceof Map ? n.has(e) : Object.prototype.hasOwnProperty.call(n, e);
715
715
  }
716
716
  function Qn(n, e) {
@@ -735,14 +735,14 @@ function he(n) {
735
735
  return (e = n.copy) !== null && e !== void 0 ? e : n.original;
736
736
  }
737
737
  function $e(n) {
738
- return !!U(n);
738
+ return !!x(n);
739
739
  }
740
- function U(n) {
740
+ function x(n) {
741
741
  return typeof n != "object" ? null : n == null ? void 0 : n[jr];
742
742
  }
743
743
  function mn(n) {
744
744
  var e;
745
- const t = U(n);
745
+ const t = x(n);
746
746
  return t ? (e = t.copy) !== null && e !== void 0 ? e : t.original : n;
747
747
  }
748
748
  function me(n, e) {
@@ -753,11 +753,11 @@ function me(n, e) {
753
753
  }
754
754
  function $r(n, e = []) {
755
755
  if (Object.hasOwnProperty.call(n, "key")) {
756
- const t = n.parent.copy, r = U(ke(t, n.key));
756
+ const t = n.parent.copy, r = x(Ee(t, n.key));
757
757
  if (r !== null && (r == null ? void 0 : r.original) !== n.original)
758
758
  return null;
759
759
  const s = n.parent.type === 3, i = s ? Array.from(n.parent.setMap.keys()).indexOf(n.key) : n.key;
760
- if (!(s && t.size > i || it(t, i)))
760
+ if (!(s && t.size > i || st(t, i)))
761
761
  return null;
762
762
  e.push(i);
763
763
  }
@@ -774,17 +774,17 @@ function $r(n, e = []) {
774
774
  function xe(n) {
775
775
  return Array.isArray(n) ? 1 : n instanceof Map ? 2 : n instanceof Set ? 3 : 0;
776
776
  }
777
- function ke(n, e) {
777
+ function Ee(n, e) {
778
778
  return xe(n) === 2 ? n.get(e) : n[e];
779
779
  }
780
- function ct(n, e, t) {
780
+ function at(n, e, t) {
781
781
  xe(n) === 2 ? n.set(e, t) : n[e] = t;
782
782
  }
783
783
  function Nt(n, e) {
784
- const t = U(n);
784
+ const t = x(n);
785
785
  return (t ? he(t) : n)[e];
786
786
  }
787
- function Ee(n, e) {
787
+ function Oe(n, e) {
788
788
  return n === e ? n !== 0 || 1 / n === 1 / e : n !== n && e !== e;
789
789
  }
790
790
  function Zt(n) {
@@ -792,7 +792,7 @@ function Zt(n) {
792
792
  for (; n.finalities.revoke.length > 0; )
793
793
  n.finalities.revoke.pop()();
794
794
  }
795
- function Re(n, e) {
795
+ function Me(n, e) {
796
796
  return e ? n : [""].concat(n).map((t) => {
797
797
  const r = `${t}`;
798
798
  return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
@@ -801,7 +801,7 @@ function Re(n, e) {
801
801
  function ei(n, e) {
802
802
  for (let t = 0; t < e.length - 1; t += 1) {
803
803
  const r = e[t];
804
- if (n = ke(xe(n) === 3 ? Array.from(n) : n, r), typeof n != "object")
804
+ if (n = Ee(xe(n) === 3 ? Array.from(n) : n, r), typeof n != "object")
805
805
  throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
806
806
  }
807
807
  return n;
@@ -893,9 +893,9 @@ function Xe(n) {
893
893
  function Tt(n) {
894
894
  return $e(n) ? Xe(n) : n;
895
895
  }
896
- function ve(n) {
896
+ function Se(n) {
897
897
  var e;
898
- n.assignedMap = (e = n.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), n.operated || (n.operated = !0, n.parent && ve(n.parent));
898
+ n.assignedMap = (e = n.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), n.operated || (n.operated = !0, n.parent && Se(n.parent));
899
899
  }
900
900
  function Bn() {
901
901
  throw new Error("Cannot modify frozen object");
@@ -966,10 +966,10 @@ function Dr(n, e, t) {
966
966
  if (e.add(n), wn(n, (i, o) => {
967
967
  var a;
968
968
  if ($e(o)) {
969
- const c = U(o);
969
+ const c = x(o);
970
970
  ce(c);
971
971
  const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
972
- ct(r ? s : n, i, u);
972
+ at(r ? s : n, i, u);
973
973
  } else
974
974
  Dr(o, e, t);
975
975
  }), s) {
@@ -981,7 +981,7 @@ function Dr(n, e, t) {
981
981
  }
982
982
  function ri(n, e) {
983
983
  const t = n.type === 3 ? n.setMap : n.copy;
984
- n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && Dr(ke(t, e), n.finalities.handledSet, n.options);
984
+ n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && Dr(Ee(t, e), n.finalities.handledSet, n.options);
985
985
  }
986
986
  function Xt(n) {
987
987
  n.type === 3 && n.copy && (n.copy.clear(), n.setMap.forEach((e) => {
@@ -997,18 +997,18 @@ function en(n, e, t, r) {
997
997
  n.finalized = !0;
998
998
  }
999
999
  }
1000
- function Sn(n, e, t, r) {
1001
- const s = U(t);
1000
+ function Tn(n, e, t, r) {
1001
+ const s = x(t);
1002
1002
  s && (s.callbacks || (s.callbacks = []), s.callbacks.push((i, o) => {
1003
1003
  var a;
1004
1004
  const c = n.type === 3 ? n.setMap : n.copy;
1005
- if (Ee(ke(c, e), t)) {
1005
+ if (Oe(Ee(c, e), t)) {
1006
1006
  let u = s.original;
1007
- s.copy && (u = s.copy), Xt(n), en(n, r, i, o), n.options.enableAutoFreeze && (n.options.updatedValues = (a = n.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), n.options.updatedValues.set(u, s.original)), ct(c, e, u);
1007
+ s.copy && (u = s.copy), Xt(n), en(n, r, i, o), n.options.enableAutoFreeze && (n.options.updatedValues = (a = n.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), n.options.updatedValues.set(u, s.original)), at(c, e, u);
1008
1008
  }
1009
1009
  }), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), me(t, n.options) && n.finalities.draft.push(() => {
1010
1010
  const i = n.type === 3 ? n.setMap : n.copy;
1011
- Ee(ke(i, e), t) && ri(n, e);
1011
+ Oe(Ee(i, e), t) && ri(n, e);
1012
1012
  });
1013
1013
  }
1014
1014
  function si(n, e, t, r, s) {
@@ -1016,7 +1016,7 @@ function si(n, e, t, r, s) {
1016
1016
  c.length < i.length && ([i, c] = [c, i], [t, r] = [r, t]);
1017
1017
  for (let u = 0; u < i.length; u += 1)
1018
1018
  if (o.get(u.toString()) && c[u] !== i[u]) {
1019
- const l = e.concat([u]), f = Re(l, s);
1019
+ const l = e.concat([u]), f = Me(l, s);
1020
1020
  t.push({
1021
1021
  op: X.Replace,
1022
1022
  path: f,
@@ -1030,7 +1030,7 @@ function si(n, e, t, r, s) {
1030
1030
  });
1031
1031
  }
1032
1032
  for (let u = i.length; u < c.length; u += 1) {
1033
- const l = e.concat([u]), f = Re(l, s);
1033
+ const l = e.concat([u]), f = Me(l, s);
1034
1034
  t.push({
1035
1035
  op: X.Add,
1036
1036
  path: f,
@@ -1041,7 +1041,7 @@ function si(n, e, t, r, s) {
1041
1041
  if (i.length < c.length) {
1042
1042
  const { arrayLengthAssignment: u = !0 } = a.enablePatches;
1043
1043
  if (u) {
1044
- const l = e.concat(["length"]), f = Re(l, s);
1044
+ const l = e.concat(["length"]), f = Me(l, s);
1045
1045
  r.push({
1046
1046
  op: X.Replace,
1047
1047
  path: f,
@@ -1049,7 +1049,7 @@ function si(n, e, t, r, s) {
1049
1049
  });
1050
1050
  } else
1051
1051
  for (let l = c.length; i.length < l; l -= 1) {
1052
- const f = e.concat([l - 1]), h = Re(f, s);
1052
+ const f = e.concat([l - 1]), h = Me(f, s);
1053
1053
  r.push({
1054
1054
  op: X.Remove,
1055
1055
  path: h
@@ -1059,18 +1059,18 @@ function si(n, e, t, r, s) {
1059
1059
  }
1060
1060
  function ii({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
1061
1061
  t.forEach((a, c) => {
1062
- const u = ke(n, c), l = Tt(ke(e, c)), f = a ? it(n, c) ? X.Replace : X.Add : X.Remove;
1063
- if (Ee(u, l) && f === X.Replace)
1062
+ const u = Ee(n, c), l = Tt(Ee(e, c)), f = a ? st(n, c) ? X.Replace : X.Add : X.Remove;
1063
+ if (Oe(u, l) && f === X.Replace)
1064
1064
  return;
1065
- const h = r.concat(c), b = Re(h, o);
1066
- s.push(f === X.Remove ? { op: f, path: b } : { op: f, path: b, value: l }), i.push(f === X.Add ? { op: X.Remove, path: b } : f === X.Remove ? { op: X.Add, path: b, value: u } : { op: X.Replace, path: b, value: u });
1065
+ const h = r.concat(c), y = Me(h, o);
1066
+ s.push(f === X.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === X.Add ? { op: X.Remove, path: y } : f === X.Remove ? { op: X.Add, path: y, value: u } : { op: X.Replace, path: y, value: u });
1067
1067
  });
1068
1068
  }
1069
1069
  function oi({ original: n, copy: e }, t, r, s, i) {
1070
1070
  let o = 0;
1071
1071
  n.forEach((a) => {
1072
1072
  if (!e.has(a)) {
1073
- const c = t.concat([o]), u = Re(c, i);
1073
+ const c = t.concat([o]), u = Me(c, i);
1074
1074
  r.push({
1075
1075
  op: X.Remove,
1076
1076
  path: u,
@@ -1084,7 +1084,7 @@ function oi({ original: n, copy: e }, t, r, s, i) {
1084
1084
  o += 1;
1085
1085
  }), o = 0, e.forEach((a) => {
1086
1086
  if (!n.has(a)) {
1087
- const c = t.concat([o]), u = Re(c, i);
1087
+ const c = t.concat([o]), u = Me(c, i);
1088
1088
  r.push({
1089
1089
  op: X.Add,
1090
1090
  path: u,
@@ -1098,7 +1098,7 @@ function oi({ original: n, copy: e }, t, r, s, i) {
1098
1098
  o += 1;
1099
1099
  });
1100
1100
  }
1101
- function at(n, e, t, r) {
1101
+ function ot(n, e, t, r) {
1102
1102
  const { pathAsArray: s = !0 } = n.options.enablePatches;
1103
1103
  switch (n.type) {
1104
1104
  case 0:
@@ -1115,39 +1115,39 @@ const Ot = (n, e, t = !1) => {
1115
1115
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
1116
1116
  }, tn = {
1117
1117
  get size() {
1118
- return he(U(this)).size;
1118
+ return he(x(this)).size;
1119
1119
  },
1120
1120
  has(n) {
1121
- return he(U(this)).has(n);
1121
+ return he(x(this)).has(n);
1122
1122
  },
1123
1123
  set(n, e) {
1124
- const t = U(this), r = he(t);
1125
- return (!r.has(n) || !Ee(r.get(n), e)) && (ce(t), ve(t), t.assignedMap.set(n, !0), t.copy.set(n, e), Sn(t, n, e, at)), this;
1124
+ const t = x(this), r = he(t);
1125
+ return (!r.has(n) || !Oe(r.get(n), e)) && (ce(t), Se(t), t.assignedMap.set(n, !0), t.copy.set(n, e), Tn(t, n, e, ot)), this;
1126
1126
  },
1127
1127
  delete(n) {
1128
1128
  if (!this.has(n))
1129
1129
  return !1;
1130
- const e = U(this);
1131
- return ce(e), ve(e), e.original.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.copy.delete(n), !0;
1130
+ const e = x(this);
1131
+ return ce(e), Se(e), e.original.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.copy.delete(n), !0;
1132
1132
  },
1133
1133
  clear() {
1134
- const n = U(this);
1134
+ const n = x(this);
1135
1135
  if (this.size) {
1136
- ce(n), ve(n), n.assignedMap = /* @__PURE__ */ new Map();
1136
+ ce(n), Se(n), n.assignedMap = /* @__PURE__ */ new Map();
1137
1137
  for (const [e] of n.original)
1138
1138
  n.assignedMap.set(e, !1);
1139
1139
  n.copy.clear();
1140
1140
  }
1141
1141
  },
1142
1142
  forEach(n, e) {
1143
- const t = U(this);
1143
+ const t = x(this);
1144
1144
  he(t).forEach((r, s) => {
1145
1145
  n.call(e, this.get(s), s, this);
1146
1146
  });
1147
1147
  },
1148
1148
  get(n) {
1149
1149
  var e, t;
1150
- const r = U(this), s = he(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, pe)) === pe.mutable;
1150
+ const r = x(this), s = he(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, pe)) === pe.mutable;
1151
1151
  if (r.options.strict && Ot(s, r.options, i), i || r.finalized || !me(s, r.options) || s !== r.original.get(n))
1152
1152
  return s;
1153
1153
  const o = bn.createDraft({
@@ -1160,12 +1160,12 @@ const Ot = (n, e, t = !1) => {
1160
1160
  return ce(r), r.copy.set(n, o), o;
1161
1161
  },
1162
1162
  keys() {
1163
- return he(U(this)).keys();
1163
+ return he(x(this)).keys();
1164
1164
  },
1165
1165
  values() {
1166
1166
  const n = this.keys();
1167
1167
  return {
1168
- [St]: () => this.values(),
1168
+ [wt]: () => this.values(),
1169
1169
  next: () => {
1170
1170
  const e = n.next();
1171
1171
  return e.done ? e : {
@@ -1178,7 +1178,7 @@ const Ot = (n, e, t = !1) => {
1178
1178
  entries() {
1179
1179
  const n = this.keys();
1180
1180
  return {
1181
- [St]: () => this.entries(),
1181
+ [wt]: () => this.entries(),
1182
1182
  next: () => {
1183
1183
  const e = n.next();
1184
1184
  if (e.done)
@@ -1191,7 +1191,7 @@ const Ot = (n, e, t = !1) => {
1191
1191
  }
1192
1192
  };
1193
1193
  },
1194
- [St]() {
1194
+ [wt]() {
1195
1195
  return this.entries();
1196
1196
  }
1197
1197
  }, ai = Reflect.ownKeys(tn), Gn = (n, e, { isValuesIterator: t }) => () => {
@@ -1201,7 +1201,7 @@ const Ot = (n, e, t = !1) => {
1201
1201
  return i;
1202
1202
  const o = i.value;
1203
1203
  let a = n.setMap.get(o);
1204
- const c = U(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, pe)) === pe.mutable;
1204
+ const c = x(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, pe)) === pe.mutable;
1205
1205
  if (n.options.strict && Ot(o, n.options, u), !u && !c && me(o, n.options) && !n.finalized && n.original.has(o)) {
1206
1206
  const l = bn.createDraft({
1207
1207
  original: o,
@@ -1218,39 +1218,39 @@ const Ot = (n, e, t = !1) => {
1218
1218
  };
1219
1219
  }, Et = {
1220
1220
  get size() {
1221
- return U(this).setMap.size;
1221
+ return x(this).setMap.size;
1222
1222
  },
1223
1223
  has(n) {
1224
- const e = U(this);
1224
+ const e = x(this);
1225
1225
  if (e.setMap.has(n))
1226
1226
  return !0;
1227
1227
  ce(e);
1228
- const t = U(n);
1228
+ const t = x(n);
1229
1229
  return !!(t && e.setMap.has(t.original));
1230
1230
  },
1231
1231
  add(n) {
1232
- const e = U(this);
1233
- return this.has(n) || (ce(e), ve(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), Sn(e, n, n, at)), this;
1232
+ const e = x(this);
1233
+ return this.has(n) || (ce(e), Se(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), Tn(e, n, n, ot)), this;
1234
1234
  },
1235
1235
  delete(n) {
1236
1236
  if (!this.has(n))
1237
1237
  return !1;
1238
- const e = U(this);
1239
- ce(e), ve(e);
1240
- const t = U(n);
1238
+ const e = x(this);
1239
+ ce(e), Se(e);
1240
+ const t = x(n);
1241
1241
  return t && e.setMap.has(t.original) ? (e.assignedMap.set(t.original, !1), e.setMap.delete(t.original)) : (!t && e.setMap.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.setMap.delete(n));
1242
1242
  },
1243
1243
  clear() {
1244
1244
  if (!this.size)
1245
1245
  return;
1246
- const n = U(this);
1247
- ce(n), ve(n);
1246
+ const n = x(this);
1247
+ ce(n), Se(n);
1248
1248
  for (const e of n.original)
1249
1249
  n.assignedMap.set(e, !1);
1250
1250
  n.setMap.clear();
1251
1251
  },
1252
1252
  values() {
1253
- const n = U(this);
1253
+ const n = x(this);
1254
1254
  ce(n);
1255
1255
  const e = n.setMap.keys();
1256
1256
  return {
@@ -1259,7 +1259,7 @@ const Ot = (n, e, t = !1) => {
1259
1259
  };
1260
1260
  },
1261
1261
  entries() {
1262
- const n = U(this);
1262
+ const n = x(this);
1263
1263
  ce(n);
1264
1264
  const e = n.setMap.keys();
1265
1265
  return {
@@ -1272,7 +1272,7 @@ const Ot = (n, e, t = !1) => {
1272
1272
  keys() {
1273
1273
  return this.values();
1274
1274
  },
1275
- [St]() {
1275
+ [wt]() {
1276
1276
  return this.values();
1277
1277
  },
1278
1278
  forEach(n, e) {
@@ -1334,7 +1334,7 @@ const ci = Reflect.ownKeys(Et), Ur = /* @__PURE__ */ new WeakSet(), Lr = {
1334
1334
  if (u)
1335
1335
  return u.bind(n.proxy);
1336
1336
  }
1337
- if (!it(a, e)) {
1337
+ if (!st(a, e)) {
1338
1338
  const u = Qn(a, e);
1339
1339
  return u ? "value" in u ? u.value : (
1340
1340
  // !case: support for getter
@@ -1345,15 +1345,15 @@ const ci = Reflect.ownKeys(Et), Ur = /* @__PURE__ */ new WeakSet(), Lr = {
1345
1345
  if (n.options.strict && Ot(c, n.options), n.finalized || !me(c, n.options))
1346
1346
  return c;
1347
1347
  if (c === Nt(n.original, e)) {
1348
- if (ce(n), n.copy[e] = Tn({
1348
+ if (ce(n), n.copy[e] = Sn({
1349
1349
  original: n.original[e],
1350
1350
  parentDraft: n,
1351
1351
  key: n.type === 1 ? Number(e) : e,
1352
1352
  finalities: n.finalities,
1353
1353
  options: n.options
1354
1354
  }), typeof o == "function") {
1355
- const u = U(n.copy[e]);
1356
- return ce(u), ve(u), u.copy;
1355
+ const u = x(n.copy[e]);
1356
+ return ce(u), Se(u), u.copy;
1357
1357
  }
1358
1358
  return n.copy[e];
1359
1359
  }
@@ -1369,8 +1369,8 @@ const ci = Reflect.ownKeys(Et), Ur = /* @__PURE__ */ new WeakSet(), Lr = {
1369
1369
  const i = Qn(he(n), e);
1370
1370
  if (i != null && i.set)
1371
1371
  return i.set.call(n.proxy, t), !0;
1372
- const o = Nt(he(n), e), a = U(o);
1373
- return a && Ee(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Ee(t, o) && (t !== void 0 || it(n.original, e)) || (ce(n), ve(n), it(n.original, e) && Ee(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, Sn(n, e, t, at)), !0);
1372
+ const o = Nt(he(n), e), a = x(o);
1373
+ return a && Oe(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Oe(t, o) && (t !== void 0 || st(n.original, e)) || (ce(n), Se(n), st(n.original, e) && Oe(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, Tn(n, e, t, ot)), !0);
1374
1374
  },
1375
1375
  has(n, e) {
1376
1376
  return e in he(n);
@@ -1398,10 +1398,10 @@ const ci = Reflect.ownKeys(Et), Ur = /* @__PURE__ */ new WeakSet(), Lr = {
1398
1398
  },
1399
1399
  deleteProperty(n, e) {
1400
1400
  var t;
1401
- return n.type === 1 ? Lr.set.call(this, n, e, void 0, n.proxy) : (Nt(n.original, e) !== void 0 || e in n.original ? (ce(n), ve(n), n.assignedMap.set(e, !1)) : (n.assignedMap = (t = n.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), n.assignedMap.delete(e)), n.copy && delete n.copy[e], !0);
1401
+ return n.type === 1 ? Lr.set.call(this, n, e, void 0, n.proxy) : (Nt(n.original, e) !== void 0 || e in n.original ? (ce(n), Se(n), n.assignedMap.set(e, !1)) : (n.assignedMap = (t = n.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), n.assignedMap.delete(e)), n.copy && delete n.copy[e], !0);
1402
1402
  }
1403
1403
  };
1404
- function Tn(n) {
1404
+ function Sn(n) {
1405
1405
  const { original: e, parentDraft: t, key: r, finalities: s, options: i } = n, o = xe(e), a = {
1406
1406
  type: o,
1407
1407
  finalized: !1,
@@ -1419,30 +1419,30 @@ function Tn(n) {
1419
1419
  if (s.revoke.push(u), Ur.add(c), a.proxy = c, t) {
1420
1420
  const l = t;
1421
1421
  l.finalities.draft.push((f, h) => {
1422
- var b, y;
1423
- const g = U(c);
1424
- let _ = l.type === 3 ? l.setMap : l.copy;
1425
- const S = ke(_, r), m = U(S);
1426
- if (m) {
1427
- let T = m.original;
1428
- m.operated && (T = mn(S)), Xt(m), en(m, at, f, h), l.options.enableAutoFreeze && (l.options.updatedValues = (b = l.options.updatedValues) !== null && b !== void 0 ? b : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(T, m.original)), ct(_, r, T);
1422
+ var y, b;
1423
+ const g = x(c);
1424
+ let m = l.type === 3 ? l.setMap : l.copy;
1425
+ const S = Ee(m, r), _ = x(S);
1426
+ if (_) {
1427
+ let T = _.original;
1428
+ _.operated && (T = mn(S)), Xt(_), en(_, ot, f, h), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(T, _.original)), at(m, r, T);
1429
1429
  }
1430
- (y = g.callbacks) === null || y === void 0 || y.forEach((T) => {
1430
+ (b = g.callbacks) === null || b === void 0 || b.forEach((T) => {
1431
1431
  T(f, h);
1432
1432
  });
1433
1433
  });
1434
1434
  } else {
1435
- const l = U(c);
1435
+ const l = x(c);
1436
1436
  l.finalities.draft.push((f, h) => {
1437
- Xt(l), en(l, at, f, h);
1437
+ Xt(l), en(l, ot, f, h);
1438
1438
  });
1439
1439
  }
1440
1440
  return c;
1441
1441
  }
1442
- bn.createDraft = Tn;
1442
+ bn.createDraft = Sn;
1443
1443
  function ui(n, e, t, r, s) {
1444
1444
  var i;
1445
- const o = U(n), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : n, c = !!e.length;
1445
+ const o = x(n), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : n, c = !!e.length;
1446
1446
  if (o != null && o.operated)
1447
1447
  for (; o.finalities.draft.length > 0; )
1448
1448
  o.finalities.draft.pop()(t, r);
@@ -1462,7 +1462,7 @@ function li(n, e) {
1462
1462
  };
1463
1463
  let s, i;
1464
1464
  e.enablePatches && (s = [], i = []);
1465
- const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, pe)) === pe.mutable || !me(n, e) ? n : Tn({
1465
+ const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, pe)) === pe.mutable || !me(n, e) ? n : Sn({
1466
1466
  original: n,
1467
1467
  parentDraft: null,
1468
1468
  finalities: r,
@@ -1479,7 +1479,7 @@ function li(n, e) {
1479
1479
  function nn(n) {
1480
1480
  const { rootDraft: e, value: t, useRawReturn: r = !1, isRoot: s = !0 } = n;
1481
1481
  wn(t, (i, o, a) => {
1482
- const c = U(o);
1482
+ const c = x(o);
1483
1483
  if (c && e && c.finalities === e.finalities) {
1484
1484
  n.isContainDraft = !0;
1485
1485
  const u = c.original;
@@ -1487,13 +1487,13 @@ function nn(n) {
1487
1487
  const l = Array.from(a);
1488
1488
  a.clear(), l.forEach((f) => a.add(i === f ? u : f));
1489
1489
  } else
1490
- ct(a, i, u);
1490
+ at(a, i, u);
1491
1491
  } else typeof o == "object" && o !== null && (n.value = o, n.isRoot = !1, nn(n));
1492
1492
  }), s && (n.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."));
1493
1493
  }
1494
1494
  function Fr(n) {
1495
1495
  var e;
1496
- const t = U(n);
1496
+ const t = x(n);
1497
1497
  if (!me(n, t == null ? void 0 : t.options))
1498
1498
  return n;
1499
1499
  const r = xe(n);
@@ -1513,10 +1513,10 @@ function Fr(n) {
1513
1513
  } else
1514
1514
  s = n;
1515
1515
  if (wn(s, (o, a) => {
1516
- if (t && Ee(ke(t.original, o), a))
1516
+ if (t && Oe(Ee(t.original, o), a))
1517
1517
  return;
1518
1518
  const c = Fr(a);
1519
- c !== a && (s === n && i(), ct(s, o, c));
1519
+ c !== a && (s === n && i(), at(s, o, c));
1520
1520
  }), r === 3) {
1521
1521
  const o = (e = t == null ? void 0 : t.original) !== null && e !== void 0 ? e : s;
1522
1522
  return gn(o) ? new Set(s) : new (Object.getPrototypeOf(o)).constructor(s);
@@ -1531,72 +1531,72 @@ function Hn(n) {
1531
1531
  const fi = (n) => function e(t, r, s) {
1532
1532
  var i, o, a;
1533
1533
  if (typeof t == "function" && typeof r != "function")
1534
- return function(O, ...M) {
1535
- return e(O, (R) => t.call(this, R, ...M), r);
1534
+ return function(O, ...F) {
1535
+ return e(O, (P) => t.call(this, P, ...F), r);
1536
1536
  };
1537
1537
  const c = t, u = r;
1538
1538
  let l = s;
1539
1539
  if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
1540
1540
  throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
1541
1541
  l = Object.assign(Object.assign({}, n), l);
1542
- const f = $e(c) ? Hn(c) : c, h = Array.isArray(l.mark) ? (O, M) => {
1543
- for (const R of l.mark) {
1544
- if (typeof R != "function")
1545
- throw new Error(`Invalid mark: ${R}, 'mark' should be a function.`);
1546
- const P = R(O, M);
1547
- if (P)
1548
- return P;
1549
- }
1550
- } : l.mark, b = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, y = (o = l.strict) !== null && o !== void 0 ? o : !1, _ = {
1542
+ const f = $e(c) ? Hn(c) : c, h = Array.isArray(l.mark) ? (O, F) => {
1543
+ for (const P of l.mark) {
1544
+ if (typeof P != "function")
1545
+ throw new Error(`Invalid mark: ${P}, 'mark' should be a function.`);
1546
+ const C = P(O, F);
1547
+ if (C)
1548
+ return C;
1549
+ }
1550
+ } : l.mark, y = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, b = (o = l.strict) !== null && o !== void 0 ? o : !1, m = {
1551
1551
  enableAutoFreeze: (a = l.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
1552
1552
  mark: h,
1553
- strict: y,
1554
- enablePatches: b
1553
+ strict: b,
1554
+ enablePatches: y
1555
1555
  };
1556
- if (!me(f, _) && typeof f == "object" && f !== null)
1556
+ if (!me(f, m) && typeof f == "object" && f !== null)
1557
1557
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
1558
- const [S, m] = li(f, _);
1558
+ const [S, _] = li(f, m);
1559
1559
  if (typeof r != "function") {
1560
- if (!me(f, _))
1560
+ if (!me(f, m))
1561
1561
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
1562
- return [S, m];
1562
+ return [S, _];
1563
1563
  }
1564
1564
  let T;
1565
1565
  try {
1566
1566
  T = u(S);
1567
1567
  } catch (O) {
1568
- throw Zt(U(S)), O;
1568
+ throw Zt(x(S)), O;
1569
1569
  }
1570
- const C = (O) => {
1571
- const M = U(S);
1570
+ const M = (O) => {
1571
+ const F = x(S);
1572
1572
  if (!$e(O)) {
1573
- if (O !== void 0 && !Ee(O, S) && (M != null && M.operated))
1573
+ if (O !== void 0 && !Oe(O, S) && (F != null && F.operated))
1574
1574
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
1575
- const P = O == null ? void 0 : O[Xs];
1576
- if (P) {
1577
- const G = P[0];
1578
- return _.strict && typeof O == "object" && O !== null && nn({
1579
- rootDraft: M,
1575
+ const C = O == null ? void 0 : O[Xs];
1576
+ if (C) {
1577
+ const G = C[0];
1578
+ return m.strict && typeof O == "object" && O !== null && nn({
1579
+ rootDraft: F,
1580
1580
  value: O,
1581
1581
  useRawReturn: !0
1582
- }), m([G]);
1582
+ }), _([G]);
1583
1583
  }
1584
1584
  if (O !== void 0)
1585
- return typeof O == "object" && O !== null && nn({ rootDraft: M, value: O }), m([O]);
1585
+ return typeof O == "object" && O !== null && nn({ rootDraft: F, value: O }), _([O]);
1586
1586
  }
1587
1587
  if (O === S || O === void 0)
1588
- return m([]);
1589
- const R = U(O);
1590
- if (_ === R.options) {
1591
- if (R.operated)
1588
+ return _([]);
1589
+ const P = x(O);
1590
+ if (m === P.options) {
1591
+ if (P.operated)
1592
1592
  throw new Error("Cannot return a modified child draft.");
1593
- return m([Hn(O)]);
1593
+ return _([Hn(O)]);
1594
1594
  }
1595
- return m([O]);
1595
+ return _([O]);
1596
1596
  };
1597
- return T instanceof Promise ? T.then(C, (O) => {
1598
- throw Zt(U(S)), O;
1599
- }) : C(T);
1597
+ return T instanceof Promise ? T.then(M, (O) => {
1598
+ throw Zt(x(S)), O;
1599
+ }) : M(T);
1600
1600
  }, kt = fi();
1601
1601
  Object.prototype.constructor.toString();
1602
1602
  function Nr(n, e) {
@@ -1606,8 +1606,8 @@ function Nr(n, e) {
1606
1606
  function Jn(n, e) {
1607
1607
  return Object.keys(n).length === Object.keys(e).length && Object.keys(n).every((t) => e.hasOwnProperty(t) && n[t] === e[t]);
1608
1608
  }
1609
- function vt(n, e) {
1610
- return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : Nr(n, e) ? Object.keys(n).every((t) => vt(n[t], e[t])) : !1;
1609
+ function St(n, e) {
1610
+ return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : Nr(n, e) ? Object.keys(n).every((t) => St(n[t], e[t])) : !1;
1611
1611
  }
1612
1612
  function vn(n) {
1613
1613
  if (!et(n))
@@ -1890,10 +1890,10 @@ function wi(n) {
1890
1890
  const [e, t] = n.split(" ");
1891
1891
  return /* @__PURE__ */ new Date(e + "T" + t + "Z");
1892
1892
  }
1893
- function Si(n) {
1893
+ function Ti(n) {
1894
1894
  return new Date(n);
1895
1895
  }
1896
- function Ti(n) {
1896
+ function Si(n) {
1897
1897
  const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
1898
1898
  if (!n.match(e))
1899
1899
  throw new Error(`Unable to parse \`${n}\` as a date.`);
@@ -1912,10 +1912,10 @@ function Ai(n) {
1912
1912
  const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(\d{1,2})(?::(\d{1,2}))?(?::(\d{1,2}))?(.*)$/, t = n.match(e);
1913
1913
  if (t) {
1914
1914
  const [, r, s, i, o, a, c, u, l] = t, f = s.padStart(2, "0"), h = i.padStart(2, "0");
1915
- let b = a.padStart(2, "0");
1916
- c !== void 0 && (b += `:${c.padStart(2, "0")}`), u !== void 0 && (b += `:${u.padStart(2, "0")}`);
1917
- const y = `${r}-${f}-${h}T${b}${l}`;
1918
- return new Date(y);
1915
+ let y = a.padStart(2, "0");
1916
+ c !== void 0 && (y += `:${c.padStart(2, "0")}`), u !== void 0 && (y += `:${u.padStart(2, "0")}`);
1917
+ const b = `${r}-${f}-${h}T${y}${l}`;
1918
+ return new Date(b);
1919
1919
  }
1920
1920
  return null;
1921
1921
  }
@@ -1948,7 +1948,7 @@ function ki(n) {
1948
1948
  const Ci = [
1949
1949
  _i,
1950
1950
  wi,
1951
- Ti,
1951
+ Si,
1952
1952
  Oi,
1953
1953
  bi,
1954
1954
  vi,
@@ -1957,7 +1957,7 @@ const Ci = [
1957
1957
  Ei,
1958
1958
  ki,
1959
1959
  Ai,
1960
- Si
1960
+ Ti
1961
1961
  ];
1962
1962
  function Ii(n, e) {
1963
1963
  try {
@@ -1999,7 +1999,7 @@ function Pt(n) {
1999
1999
  throw new Error(`Invalid date value \`${n}\`. Expected a date, number, or string, got type ${typeof n}.`);
2000
2000
  }
2001
2001
  }
2002
- class Me {
2002
+ class Re {
2003
2003
  constructor(e, t) {
2004
2004
  p(this, "attrs");
2005
2005
  p(this, "linkIndex");
@@ -2074,7 +2074,7 @@ class Me {
2074
2074
  return { attrs: this.attrs, linkIndex: this.linkIndex };
2075
2075
  }
2076
2076
  }
2077
- function Ri(n) {
2077
+ function Mi(n) {
2078
2078
  return n.cardinality === "one";
2079
2079
  }
2080
2080
  function An(n) {
@@ -2132,18 +2132,18 @@ function Vr(n, e) {
2132
2132
  }
2133
2133
  function Qr(n, e) {
2134
2134
  if (n)
2135
- return new Me(n.attrs, n.linkIndex);
2135
+ return new Re(n.attrs, n.linkIndex);
2136
2136
  if (e && "__type" in e)
2137
- return new Me(e.attrs, e.linkIndex);
2137
+ return new Re(e.attrs, e.linkIndex);
2138
2138
  }
2139
- function Mi(n, e) {
2139
+ function Ri(n, e) {
2140
2140
  return Be(n.eav, [e]) !== void 0;
2141
2141
  }
2142
2142
  function tt(n, e, t, r) {
2143
2143
  const s = Wr(n, e, r);
2144
2144
  return s.cardinalityInference = t, s.useDateObjects = r, s;
2145
2145
  }
2146
- function ut(n, e) {
2146
+ function ct(n, e) {
2147
2147
  var s, i;
2148
2148
  let t;
2149
2149
  if (Array.isArray(e[0])) {
@@ -2163,15 +2163,15 @@ function ut(n, e) {
2163
2163
  const l = (i = fe(c, 2).find((g) => g[2] === a)) == null ? void 0 : i[0];
2164
2164
  if (!l)
2165
2165
  return null;
2166
- const [f, h, b, ...y] = e;
2167
- return [t, h, l, ...y];
2166
+ const [f, h, y, ...b] = e;
2167
+ return [t, h, l, ...b];
2168
2168
  } else {
2169
2169
  const [o, ...a] = e;
2170
2170
  return [t, ...a];
2171
2171
  }
2172
2172
  }
2173
2173
  function Br(n, e, t) {
2174
- const r = ut(n, t);
2174
+ const r = ct(n, t);
2175
2175
  if (!r)
2176
2176
  return;
2177
2177
  const [s, i, o] = r, a = e.getAttr(i);
@@ -2185,7 +2185,7 @@ function Gr(n, e, t) {
2185
2185
  return a && (o = a[3]), o || Date.now() * 10 + ji++;
2186
2186
  }
2187
2187
  function Hr(n, e, t) {
2188
- const r = ut(n, t);
2188
+ const r = ct(n, t);
2189
2189
  if (!r)
2190
2190
  return;
2191
2191
  let [s, i, o] = r;
@@ -2194,11 +2194,11 @@ function Hr(n, e, t) {
2194
2194
  return;
2195
2195
  a["checked-data-type"] === "date" && n.useDateObjects && (o = Pt(o));
2196
2196
  const c = Be(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? Gr(n, a, r), l = [s, i, o, u];
2197
- Ri(a) ? (le(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (le(n.eav, [s, i, o], l), le(n.aev, [i, s, o], l)), An(a) && le(n.vae, [o, i, s], l);
2197
+ Mi(a) ? (le(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (le(n.eav, [s, i, o], l), le(n.aev, [i, s, o], l)), An(a) && le(n.vae, [o, i, s], l);
2198
2198
  }
2199
2199
  function $i(n, e, t) {
2200
- var b;
2201
- const r = ut(n, t);
2200
+ var y;
2201
+ const r = ct(n, t);
2202
2202
  if (!r)
2203
2203
  return;
2204
2204
  const [s, i, o] = r, a = e.getAttr(i);
@@ -2209,7 +2209,7 @@ function $i(n, e, t) {
2209
2209
  const c = Be(n.eav, [s, i]);
2210
2210
  if (!c)
2211
2211
  return;
2212
- const u = (b = c.values().next()) == null ? void 0 : b.value;
2212
+ const u = (y = c.values().next()) == null ? void 0 : y.value;
2213
2213
  if (!u)
2214
2214
  return;
2215
2215
  const l = u[2], f = Kr(l, o), h = [
@@ -2222,16 +2222,16 @@ function $i(n, e, t) {
2222
2222
  }
2223
2223
  function sn(n, e, t) {
2224
2224
  var u, l;
2225
- const [r, s] = t, i = ut(n, [r]);
2225
+ const [r, s] = t, i = ct(n, [r]);
2226
2226
  if (!i)
2227
2227
  return;
2228
2228
  const [o] = i, a = n.eav.get(o);
2229
2229
  if (a) {
2230
2230
  for (const f of a.keys()) {
2231
2231
  const h = e.getAttr(f);
2232
- h && h["on-delete-reverse"] === "cascade" && fe(a.get(f), 1).forEach(([b, y, g]) => {
2233
- var _;
2234
- return sn(n, e, [g, (_ = h["reverse-identity"]) == null ? void 0 : _[1]]);
2232
+ h && h["on-delete-reverse"] === "cascade" && fe(a.get(f), 1).forEach(([y, b, g]) => {
2233
+ var m;
2234
+ return sn(n, e, [g, (m = h["reverse-identity"]) == null ? void 0 : m[1]]);
2235
2235
  }), // Fall back to deleting everything if we've rehydrated tx-steps from
2236
2236
  // the store that didn't set `etype` in deleteEntity
2237
2237
  (!s || // If we don't know about the attr, let's just get rid of it
@@ -2242,9 +2242,9 @@ function sn(n, e, t) {
2242
2242
  }
2243
2243
  const c = n.vae.get(o) && fe(n.vae.get(o), 2);
2244
2244
  c && c.forEach((f) => {
2245
- var _, S, m;
2246
- const [h, b, y] = f, g = e.getAttr(b);
2247
- (!s || !g || ((_ = g["reverse-identity"]) == null ? void 0 : _[1]) === s) && (_e(n.eav, [h, b, y]), _e(n.aev, [b, h, y]), _e(n.vae, [y, b, h])), g && g["on-delete"] === "cascade" && ((S = g["reverse-identity"]) == null ? void 0 : S[1]) === s && sn(n, e, [h, (m = g["forward-identity"]) == null ? void 0 : m[1]]);
2245
+ var m, S, _;
2246
+ const [h, y, b] = f, g = e.getAttr(y);
2247
+ (!s || !g || ((m = g["reverse-identity"]) == null ? void 0 : m[1]) === s) && (_e(n.eav, [h, y, b]), _e(n.aev, [y, h, b]), _e(n.vae, [b, y, h])), g && g["on-delete"] === "cascade" && ((S = g["reverse-identity"]) == null ? void 0 : S[1]) === s && sn(n, e, [h, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
2248
2248
  }), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && _e(n.vae, [o]);
2249
2249
  }
2250
2250
  function Jr(n, e, t) {
@@ -2312,7 +2312,7 @@ function fe(n, e, t = []) {
2312
2312
  fe(r, e - 1, t);
2313
2313
  return t;
2314
2314
  }
2315
- function yt(n, e, t) {
2315
+ function pt(n, e, t) {
2316
2316
  var i;
2317
2317
  const r = [];
2318
2318
  if (t != null && t.hasOwnProperty("$not")) {
@@ -2362,7 +2362,7 @@ function Ni(n, [e, t, r]) {
2362
2362
  }
2363
2363
  case "eav": {
2364
2364
  const a = (o = n.eav.get(e)) == null ? void 0 : o.get(t);
2365
- return a ? yt(n, a, r) : [];
2365
+ return a ? pt(n, a, r) : [];
2366
2366
  }
2367
2367
  case "ev": {
2368
2368
  const a = n.eav.get(e);
@@ -2370,7 +2370,7 @@ function Ni(n, [e, t, r]) {
2370
2370
  return [];
2371
2371
  const c = [];
2372
2372
  for (const u of a.values())
2373
- c.push(...yt(n, u, r));
2373
+ c.push(...pt(n, u, r));
2374
2374
  return c;
2375
2375
  }
2376
2376
  case "a": {
@@ -2383,14 +2383,14 @@ function Ni(n, [e, t, r]) {
2383
2383
  return [];
2384
2384
  const c = [];
2385
2385
  for (const u of a.values())
2386
- c.push(...yt(n, u, r));
2386
+ c.push(...pt(n, u, r));
2387
2387
  return c;
2388
2388
  }
2389
2389
  case "v": {
2390
2390
  const a = [];
2391
2391
  for (const c of n.eav.values())
2392
2392
  for (const u of c.values())
2393
- a.push(...yt(n, u, r));
2393
+ a.push(...pt(n, u, r));
2394
2394
  return a;
2395
2395
  }
2396
2396
  default:
@@ -2426,7 +2426,7 @@ function Zr(n, e) {
2426
2426
  return t || ((r = n.forwardIdents.get(e)) == null ? void 0 : r.get("id"));
2427
2427
  }
2428
2428
  function Wi(n, e, t) {
2429
- const r = ut(n, t);
2429
+ const r = ct(n, t);
2430
2430
  if (!r)
2431
2431
  return;
2432
2432
  const [s, i, o] = r;
@@ -2458,7 +2458,7 @@ function zi(n, e, t) {
2458
2458
  });
2459
2459
  }, {
2460
2460
  mark: (s) => {
2461
- if (s instanceof Me)
2461
+ if (s instanceof Re)
2462
2462
  return "immutable";
2463
2463
  }
2464
2464
  });
@@ -2529,11 +2529,11 @@ const to = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a
2529
2529
  function Ve(n) {
2530
2530
  return typeof n == "string" && to.test(n);
2531
2531
  }
2532
- const se = [];
2532
+ const re = [];
2533
2533
  for (let n = 0; n < 256; ++n)
2534
- se.push((n + 256).toString(16).slice(1));
2534
+ re.push((n + 256).toString(16).slice(1));
2535
2535
  function no(n, e = 0) {
2536
- return (se[n[e + 0]] + se[n[e + 1]] + se[n[e + 2]] + se[n[e + 3]] + "-" + se[n[e + 4]] + se[n[e + 5]] + "-" + se[n[e + 6]] + se[n[e + 7]] + "-" + se[n[e + 8]] + se[n[e + 9]] + "-" + se[n[e + 10]] + se[n[e + 11]] + se[n[e + 12]] + se[n[e + 13]] + se[n[e + 14]] + se[n[e + 15]]).toLowerCase();
2536
+ return (re[n[e + 0]] + re[n[e + 1]] + re[n[e + 2]] + re[n[e + 3]] + "-" + re[n[e + 4]] + re[n[e + 5]] + "-" + re[n[e + 6]] + re[n[e + 7]] + "-" + re[n[e + 8]] + re[n[e + 9]] + "-" + re[n[e + 10]] + re[n[e + 11]] + re[n[e + 12]] + re[n[e + 13]] + re[n[e + 14]] + re[n[e + 15]]).toLowerCase();
2537
2537
  }
2538
2538
  let Kt;
2539
2539
  const ro = new Uint8Array(16);
@@ -2591,10 +2591,10 @@ function lo() {
2591
2591
  }
2592
2592
  const fo = lo();
2593
2593
  let ho = !0, po = 0;
2594
- function ot(n) {
2595
- return Rt(`_${n}`, po++);
2594
+ function it(n) {
2595
+ return Mt(`_${n}`, po++);
2596
2596
  }
2597
- function Rt(n, e) {
2597
+ function Mt(n, e) {
2598
2598
  return `?${n}-${e}`;
2599
2599
  }
2600
2600
  class Qe extends Error {
@@ -2628,18 +2628,18 @@ function es(n, e, t, r, s) {
2628
2628
  throw new Qe(`Could not find attr for ${[t, s]}`);
2629
2629
  if (a["value-type"] !== "ref")
2630
2630
  throw new Error(`Attr ${a.id} is not a ref`);
2631
- const [c, u] = a["forward-identity"], [l, f] = a["reverse-identity"], h = r + 1, b = i ? [
2631
+ const [c, u] = a["forward-identity"], [l, f] = a["reverse-identity"], h = r + 1, y = i ? [
2632
2632
  n(u, r),
2633
2633
  a.id,
2634
2634
  n(f, h),
2635
- ot("time")
2635
+ it("time")
2636
2636
  ] : [
2637
2637
  n(u, h),
2638
2638
  a.id,
2639
2639
  n(f, r),
2640
- ot("time")
2640
+ it("time")
2641
2641
  ];
2642
- return [i ? f : u, h, b, a, !!i];
2642
+ return [i ? f : u, h, y, a, !!i];
2643
2643
  }
2644
2644
  function rr(n, e) {
2645
2645
  if (typeof e != "string")
@@ -2723,20 +2723,20 @@ function mo(n, e, t, r, s, i) {
2723
2723
  n(t, r),
2724
2724
  u.id,
2725
2725
  { $isNull: { attrId: c.id, isNull: i.$isNull, reverse: !o } },
2726
- ot("time")
2726
+ it("time")
2727
2727
  ];
2728
2728
  }
2729
2729
  return o ? [
2730
2730
  n(t, r),
2731
2731
  c.id,
2732
2732
  _o(c, i),
2733
- ot("time")
2734
- ] : [i, c.id, n(t, r), ot("time")];
2733
+ it("time")
2734
+ ] : [i, c.id, n(t, r), it("time")];
2735
2735
  }
2736
2736
  function wo(n, e, t, r, s) {
2737
2737
  const [i, o, a] = s.reduce((c, u) => {
2738
- const [l, f, h] = c, [b, y, g] = es(n, e, l, f, u);
2739
- return [b, y, [...h, g]];
2738
+ const [l, f, h] = c, [y, b, g] = es(n, e, l, f, u);
2739
+ return [y, b, [...h, g]];
2740
2740
  }, [t, r, []]);
2741
2741
  return [i, o, a];
2742
2742
  }
@@ -2744,10 +2744,10 @@ function an(n, e, t, r, s, i) {
2744
2744
  const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = wo(n, e, t, r, o), f = mo(n, e, c, u, a, i);
2745
2745
  return l.concat([f]);
2746
2746
  }
2747
- function So(n, e) {
2747
+ function To(n, e) {
2748
2748
  return e ? [e].concat(n) : n;
2749
2749
  }
2750
- function To([n, e]) {
2750
+ function So([n, e]) {
2751
2751
  return n === "or" && Array.isArray(e);
2752
2752
  }
2753
2753
  function vo([n, e]) {
@@ -2779,7 +2779,7 @@ function ir(n, e, t, r, s) {
2779
2779
  }
2780
2780
  function ts(n, e, t, r, s) {
2781
2781
  return Object.entries(s).flatMap(([i, o]) => {
2782
- if (To([i, o]))
2782
+ if (So([i, o]))
2783
2783
  return sr(n, "or", e, t, r, o);
2784
2784
  if (vo([i, o]))
2785
2785
  return sr(n, "and", e, t, r, o);
@@ -2808,7 +2808,7 @@ function ts(n, e, t, r, s) {
2808
2808
  });
2809
2809
  }
2810
2810
  function Eo(n, e, t, r) {
2811
- const s = Rt;
2811
+ const s = Mt;
2812
2812
  return r ? ts(s, n, e, t, r).concat(nr(s, n, e, t)) : nr(s, n, e, t);
2813
2813
  }
2814
2814
  function ko(n, e, t) {
@@ -2821,24 +2821,24 @@ function Co(n, e, t, r, s, i) {
2821
2821
  function Io(n, e, t, { etype: r, level: s, form: i }, o) {
2822
2822
  const a = Object.keys(i).filter((c) => c !== "$");
2823
2823
  return a.length ? Object.entries(o).map(function([u, l]) {
2824
- return a.map(function(b) {
2825
- var g, _, S;
2826
- const y = !!(e.cardinalityInference && ((S = (_ = (g = t.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : _[b]) != null && S.isSingular));
2824
+ return a.map(function(y) {
2825
+ var g, m, S;
2826
+ const b = !!(e.cardinalityInference && ((S = (m = (g = t.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : m[y]) != null && S.isSingular));
2827
2827
  try {
2828
- const [m, T, C] = Co(n, t, r, s, b, u), O = ss(e, t, {
2829
- etype: m,
2828
+ const [_, T, M] = Co(n, t, r, s, y, u), O = ss(e, t, {
2829
+ etype: _,
2830
2830
  level: T,
2831
- form: i[b],
2832
- join: C
2833
- }), M = y ? O[0] : O;
2834
- return { [b]: M };
2835
- } catch (m) {
2836
- if (m instanceof Qe)
2837
- return { [b]: y ? void 0 : [] };
2838
- throw m;
2831
+ form: i[y],
2832
+ join: M
2833
+ }), F = b ? O[0] : O;
2834
+ return { [y]: F };
2835
+ } catch (_) {
2836
+ if (_ instanceof Qe)
2837
+ return { [y]: b ? void 0 : [] };
2838
+ throw _;
2839
2839
  }
2840
- }).reduce(function(b, y) {
2841
- return { ...b, ...y };
2840
+ }).reduce(function(y, b) {
2841
+ return { ...y, ...b };
2842
2842
  }, l);
2843
2843
  }) : Object.values(o);
2844
2844
  }
@@ -2862,11 +2862,11 @@ function ns(n, e, t) {
2862
2862
  const [a, c] = t, u = e["checked-data-type"], l = u === "date" ? cn(c) : c, f = u === "date" ? cn(i) : i;
2863
2863
  return Ct([a, l], [r, f], u);
2864
2864
  }
2865
- function Ro(n, e, t, r) {
2865
+ function Mo(n, e, t, r) {
2866
2866
  const s = ns(n, e, r);
2867
2867
  return t === "desc" ? s > 0 : s < 0;
2868
2868
  }
2869
- function Mo(n, e, t, r) {
2869
+ function Ro(n, e, t, r) {
2870
2870
  const s = ns(n, e, r);
2871
2871
  return t === "desc" ? s < 0 : s > 0;
2872
2872
  }
@@ -2900,33 +2900,33 @@ function Do(n, e, t) {
2900
2900
  return r;
2901
2901
  }
2902
2902
  function Uo(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
2903
- var g, _;
2903
+ var g, m;
2904
2904
  const o = (g = i == null ? void 0 : i.$) == null ? void 0 : g.order, a = rs(i), c = Lo(i);
2905
2905
  let u = Xi(n, s);
2906
2906
  const l = r == null ? void 0 : r["start-cursor"], f = r == null ? void 0 : r["end-cursor"], h = xo(e, t, l, o);
2907
- if (h && ((_ = h == null ? void 0 : h["forward-identity"]) == null ? void 0 : _[2]) !== "id") {
2908
- const S = h["checked-data-type"] === "date", m = h.id;
2907
+ if (h && ((m = h == null ? void 0 : h["forward-identity"]) == null ? void 0 : m[2]) !== "id") {
2908
+ const S = h["checked-data-type"] === "date", _ = h.id;
2909
2909
  u = u.map(([T]) => {
2910
- var O, M, R, P, G;
2911
- let C = (G = (P = (R = (M = (O = n.eav.get(T)) == null ? void 0 : O.get(m)) == null ? void 0 : M.values()) == null ? void 0 : R.next()) == null ? void 0 : P.value) == null ? void 0 : G[2];
2912
- return S && (C = cn(C)), [T, C];
2910
+ var O, F, P, C, G;
2911
+ let M = (G = (C = (P = (F = (O = n.eav.get(T)) == null ? void 0 : O.get(_)) == null ? void 0 : F.values()) == null ? void 0 : P.next()) == null ? void 0 : C.value) == null ? void 0 : G[2];
2912
+ return S && (M = cn(M)), [T, M];
2913
2913
  });
2914
2914
  }
2915
- u.sort(c === "asc" ? function(m, T) {
2916
- return Ct(m, T, h == null ? void 0 : h["checked-data-type"]);
2917
- } : function(m, T) {
2918
- return Ct(T, m, h == null ? void 0 : h["checked-data-type"]);
2915
+ u.sort(c === "asc" ? function(_, T) {
2916
+ return Ct(_, T, h == null ? void 0 : h["checked-data-type"]);
2917
+ } : function(_, T) {
2918
+ return Ct(T, _, h == null ? void 0 : h["checked-data-type"]);
2919
2919
  });
2920
- let b = {};
2921
- const y = Do(e, t, s);
2920
+ let y = {};
2921
+ const b = Do(e, t, s);
2922
2922
  for (const S of u) {
2923
- const [m] = S;
2924
- if (b[m] || !a && l && h && Ro(l, h, c, S) || !a && f && h && Mo(f, h, c, S))
2923
+ const [_] = S;
2924
+ if (y[_] || !a && l && h && Mo(l, h, c, S) || !a && f && h && Ro(f, h, c, S))
2925
2925
  continue;
2926
- const T = Ki(n, y, m);
2927
- T && (b[m] = T);
2926
+ const T = Ki(n, b, _);
2927
+ T && (y[_] = T);
2928
2928
  }
2929
- return b;
2929
+ return y;
2930
2930
  }
2931
2931
  function Lo(n) {
2932
2932
  var t;
@@ -2939,15 +2939,15 @@ function rs(n) {
2939
2939
  return !e && !t && !r;
2940
2940
  }
2941
2941
  function Fo(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
2942
- var h, b, y, g, _;
2942
+ var h, y, b, g, m;
2943
2943
  if (!rs(s) && (!o || !o["start-cursor"]))
2944
2944
  return [];
2945
- const a = So(Eo(e, t, r, (h = s.$) == null ? void 0 : h.where), i), c = ko(Rt, t, r), u = (b = s.$) == null ? void 0 : b.fields, l = Uo(n, e, {
2945
+ const a = To(Eo(e, t, r, (h = s.$) == null ? void 0 : h.where), i), c = ko(Mt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = Uo(n, e, {
2946
2946
  etype: t,
2947
2947
  pageInfo: o,
2948
2948
  form: s,
2949
2949
  dq: { where: a, find: c, fields: u }
2950
- }), f = ((y = s.$) == null ? void 0 : y.limit) || ((g = s.$) == null ? void 0 : g.first) || ((_ = s.$) == null ? void 0 : _.last);
2950
+ }), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((m = s.$) == null ? void 0 : m.last);
2951
2951
  if (f != null) {
2952
2952
  r > 0 && ho && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
2953
2953
  const S = Object.entries(l);
@@ -2966,7 +2966,7 @@ function No(n, e, t) {
2966
2966
  }
2967
2967
  function ss(n, e, t) {
2968
2968
  const r = No(n, e, t);
2969
- return Io(Rt, n, e, t, r);
2969
+ return Io(Mt, n, e, t, r);
2970
2970
  }
2971
2971
  function Ko(n) {
2972
2972
  const e = {};
@@ -3005,7 +3005,7 @@ function qo() {
3005
3005
  return new Set(Object.keys(e));
3006
3006
  }
3007
3007
  const Wo = qo();
3008
- function At(n, e, t) {
3008
+ function vt(n, e, t) {
3009
3009
  const r = {
3010
3010
  __etype: n,
3011
3011
  __ops: t
@@ -3017,7 +3017,7 @@ function At(n, e, t) {
3017
3017
  if (i === "__etype")
3018
3018
  return n;
3019
3019
  if (Wo.has(i))
3020
- return (o, a) => At(n, e, [
3020
+ return (o, a) => vt(n, e, [
3021
3021
  ...t,
3022
3022
  a ? [i, n, e, o, a] : [i, n, e, o]
3023
3023
  ]);
@@ -3040,11 +3040,11 @@ function Vo(n) {
3040
3040
  }, {
3041
3041
  get(e, t) {
3042
3042
  if (t === "lookup")
3043
- return (s, i) => At(n, un(zo(s, i)), []);
3043
+ return (s, i) => vt(n, un(zo(s, i)), []);
3044
3044
  if (t === "__etype")
3045
3045
  return n;
3046
3046
  const r = t;
3047
- return It(r) ? At(n, un(r), []) : At(n, r, []);
3047
+ return It(r) ? vt(n, un(r), []) : vt(n, r, []);
3048
3048
  }
3049
3049
  });
3050
3050
  }
@@ -3205,11 +3205,11 @@ function ea(n, e) {
3205
3205
  function ta(n, e) {
3206
3206
  const { attrsStore: t } = n, [r, s, i, o] = e, a = vn(i), c = de(t, r, s), u = as(n, [r, c, i, o]);
3207
3207
  return [["id", c]].concat(Object.entries(a)).map(([f, h]) => {
3208
- const b = ne(t, r, f);
3209
- return b["checked-data-type"] === "date" && n.useDateObjects && (h = Pt(h)), [
3208
+ const y = ne(t, r, f);
3209
+ return y["checked-data-type"] === "date" && n.useDateObjects && (h = Pt(h)), [
3210
3210
  "add-triple",
3211
3211
  c,
3212
- b.id,
3212
+ y.id,
3213
3213
  h,
3214
3214
  ...u ? [u] : []
3215
3215
  ];
@@ -3219,13 +3219,13 @@ function na({ attrsStore: n }, [e, t]) {
3219
3219
  return [["delete-entity", de(n, e, t), e]];
3220
3220
  }
3221
3221
  function ra(n, e) {
3222
- const { attrsStore: t } = n, [r, s, i, o] = e, a = vn(i), c = de(t, r, s), u = as(n, [r, c, i, o]), l = Object.entries(a).map(([h, b]) => {
3223
- const y = ne(t, r, h);
3222
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = vn(i), c = de(t, r, s), u = as(n, [r, c, i, o]), l = Object.entries(a).map(([h, y]) => {
3223
+ const b = ne(t, r, h);
3224
3224
  return [
3225
3225
  "deep-merge-triple",
3226
3226
  c,
3227
- y.id,
3228
- b,
3227
+ b.id,
3228
+ y,
3229
3229
  ...u ? [u] : []
3230
3230
  ];
3231
3231
  });
@@ -3293,7 +3293,7 @@ function ca(n, e, t) {
3293
3293
  "checked-data-type": o
3294
3294
  };
3295
3295
  }
3296
- function bt(n, e, t, r) {
3296
+ function yt(n, e, t, r) {
3297
3297
  const s = n ? ca(n, e, t) : null, i = J(), a = [J(), e, t];
3298
3298
  return {
3299
3299
  id: i,
@@ -3374,72 +3374,72 @@ function ba(n) {
3374
3374
  return e;
3375
3375
  }
3376
3376
  function ga({ attrsStore: n, schema: e }, t) {
3377
- var h, b;
3377
+ var h, y;
3378
3378
  const r = /* @__PURE__ */ new Set(), s = [], i = [];
3379
- function o(y, g) {
3380
- return ne(n, y, g) || s.find((_) => _["forward-identity"][1] === y && _["forward-identity"][2] === g);
3379
+ function o(b, g) {
3380
+ return ne(n, b, g) || s.find((m) => m["forward-identity"][1] === b && m["forward-identity"][2] === g);
3381
3381
  }
3382
- function a(y, g) {
3383
- return De(n, y, g) || s.find((_) => {
3384
- var S, m;
3385
- return ((S = _["reverse-identity"]) == null ? void 0 : S[1]) === y && ((m = _["reverse-identity"]) == null ? void 0 : m[2]) === g;
3382
+ function a(b, g) {
3383
+ return De(n, b, g) || s.find((m) => {
3384
+ var S, _;
3385
+ return ((S = m["reverse-identity"]) == null ? void 0 : S[1]) === b && ((_ = m["reverse-identity"]) == null ? void 0 : _[2]) === g;
3386
3386
  });
3387
3387
  }
3388
- function c(y) {
3389
- s.push(y), i.push(["add-attr", y]), r.add(y.id);
3388
+ function c(b) {
3389
+ s.push(b), i.push(["add-attr", b]), r.add(b.id);
3390
3390
  }
3391
- function u(y) {
3392
- y && "isUnsynced" in y && y.isUnsynced && !r.has(y.id) && (s.push(y), i.push(["add-attr", y]), r.add(y.id));
3391
+ function u(b) {
3392
+ b && "isUnsynced" in b && b.isUnsynced && !r.has(b.id) && (s.push(b), i.push(["add-attr", b]), r.add(b.id));
3393
3393
  }
3394
- function l(y, g) {
3394
+ function l(b, g) {
3395
3395
  return g.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
3396
3396
  // before assuming it's a ref lookup.
3397
- !o(y, g);
3397
+ !o(b, g);
3398
3398
  }
3399
- function f(y, g) {
3400
- const _ = o(y, g), S = a(y, g);
3401
- u(_), u(S), !_ && !S && c(or(e, y, g, ya));
3399
+ function f(b, g) {
3400
+ const m = o(b, g), S = a(b, g);
3401
+ u(m), u(S), !m && !S && c(or(e, b, g, ya));
3402
3402
  }
3403
- for (const y of t)
3404
- for (const { etype: g, lookupPair: _, linkLabel: S } of ba(y)) {
3405
- const m = _[0];
3403
+ for (const b of t)
3404
+ for (const { etype: g, lookupPair: m, linkLabel: S } of ba(b)) {
3405
+ const _ = m[0];
3406
3406
  if (S) {
3407
3407
  f(g, S);
3408
- const T = o(g, S), C = a(g, S);
3409
- u(T), u(C);
3410
- const O = ((h = T == null ? void 0 : T["reverse-identity"]) == null ? void 0 : h[1]) || ((b = C == null ? void 0 : C["forward-identity"]) == null ? void 0 : b[1]) || S;
3411
- if (l(O, m))
3412
- f(O, ln(m));
3408
+ const T = o(g, S), M = a(g, S);
3409
+ u(T), u(M);
3410
+ const O = ((h = T == null ? void 0 : T["reverse-identity"]) == null ? void 0 : h[1]) || ((y = M == null ? void 0 : M["forward-identity"]) == null ? void 0 : y[1]) || S;
3411
+ if (l(O, _))
3412
+ f(O, ln(_));
3413
3413
  else {
3414
- const M = o(O, m);
3415
- M || c(bt(e, O, m, dn)), u(M);
3414
+ const F = o(O, _);
3415
+ F || c(yt(e, O, _, dn)), u(F);
3416
3416
  }
3417
- } else if (l(g, m))
3418
- f(g, ln(m));
3417
+ } else if (l(g, _))
3418
+ f(g, ln(_));
3419
3419
  else {
3420
- const T = o(g, m);
3421
- T || c(bt(e, g, m, dn)), u(T);
3420
+ const T = o(g, _);
3421
+ T || c(yt(e, g, _, dn)), u(T);
3422
3422
  }
3423
3423
  }
3424
- for (const y of t) {
3425
- const [g, _, S, m] = y;
3424
+ for (const b of t) {
3425
+ const [g, m, S, _] = b;
3426
3426
  if (fa.has(g)) {
3427
- const T = o(_, "id");
3428
- u(T), T || c(bt(e, _, "id", { "unique?": !0 }));
3429
- for (const C of Object.keys(m)) {
3430
- const O = o(_, C);
3431
- if (u(O), ha.has(g) && (O || c(bt(e, _, C, C === "id" ? { "unique?": !0 } : null))), da.has(g)) {
3432
- const M = a(_, C);
3433
- !O && !M && c(or(e, _, C)), u(M);
3427
+ const T = o(m, "id");
3428
+ u(T), T || c(yt(e, m, "id", { "unique?": !0 }));
3429
+ for (const M of Object.keys(_)) {
3430
+ const O = o(m, M);
3431
+ if (u(O), ha.has(g) && (O || c(yt(e, m, M, M === "id" ? { "unique?": !0 } : null))), da.has(g)) {
3432
+ const F = a(m, M);
3433
+ !O && !F && c(or(e, m, M)), u(F);
3434
3434
  }
3435
3435
  }
3436
3436
  }
3437
3437
  }
3438
3438
  if (s.length) {
3439
- const y = { ...n.attrs };
3439
+ const b = { ...n.attrs };
3440
3440
  for (const g of s)
3441
- y[g.id] = g;
3442
- return [new Me(y, n.linkIndex), i];
3441
+ b[g.id] = g;
3442
+ return [new Re(b, n.linkIndex), i];
3443
3443
  }
3444
3444
  return [n, i];
3445
3445
  }
@@ -3555,10 +3555,10 @@ class hn {
3555
3555
  _writeToStorage(e) {
3556
3556
  const t = [], r = e == null ? void 0 : e.skipGc;
3557
3557
  if (this._meta.isLoading) {
3558
- const f = new Promise((h, b) => {
3559
- setTimeout(() => this._enqueuePersist(e ? { ...e, attempts: (e.attempts || 0) + 1 } : { attempts: 1 }).then(h).catch(b), 10 + ((e == null ? void 0 : e.attempts) ?? 0) * 1e3);
3558
+ const f = new Promise((h, y) => {
3559
+ setTimeout(() => this._enqueuePersist(e ? { ...e, attempts: (e.attempts || 0) + 1 } : { attempts: 1 }).then(h).catch(y), 10 + ((e == null ? void 0 : e.attempts) ?? 0) * 1e3);
3560
3560
  });
3561
- return t.push(f), Promise.all(t).then((h) => h.reduce((b, y) => b + y, 0));
3561
+ return t.push(f), Promise.all(t).then((h) => h.reduce((y, b) => y + b, 0));
3562
3562
  }
3563
3563
  const s = this._meta.value;
3564
3564
  if (!s)
@@ -3576,12 +3576,12 @@ class hn {
3576
3576
  if (this._loadedKeys.has(f)) {
3577
3577
  const h = this.serialize(f, this.currentValue[f]);
3578
3578
  c.push([f, h]);
3579
- const b = this._objectSize(h), y = u[f] ?? {
3579
+ const y = this._objectSize(h), b = u[f] ?? {
3580
3580
  createdAt: Date.now(),
3581
3581
  updatedAt: Date.now(),
3582
- size: b
3582
+ size: y
3583
3583
  };
3584
- y.updatedAt = Date.now(), y.size = b, u[f] = y, this._pendingSaveKeys.delete(f);
3584
+ b.updatedAt = Date.now(), b.size = y, u[f] = b, this._pendingSaveKeys.delete(f);
3585
3585
  } else
3586
3586
  a.push(f);
3587
3587
  const l = this._persister.multiSet(c);
@@ -3590,7 +3590,7 @@ class hn {
3590
3590
  const h = this._loadKey(f).then(() => this._enqueuePersist(e));
3591
3591
  t.push(h);
3592
3592
  }
3593
- return r || this.gc(), Promise.all(t).then((f) => f.reduce((h, b) => h + b, 0));
3593
+ return r || this.gc(), Promise.all(t).then((f) => f.reduce((h, y) => h + y, 0));
3594
3594
  }
3595
3595
  async flush() {
3596
3596
  return this._nextSave ? (clearTimeout(this._nextSave), this._nextSave = null, this._writeToStorage()) : void 0;
@@ -3624,21 +3624,21 @@ class hn {
3624
3624
  for (const h of e)
3625
3625
  t.has(h) || h in r.objects || (this._log.info("Lost track of key in meta", h), s.push(this._persister.removeItem(h)), i.removed.push(h), i.removedMissingCount++);
3626
3626
  const o = Date.now();
3627
- for (const [h, b] of Object.entries(r.objects))
3628
- !t.has(h) && b.updatedAt < o - this._gcOpts.maxAgeMs && (s.push(this._persister.removeItem(h)), delete r.objects[h], i.removed.push(h), i.removedOldCount++);
3627
+ for (const [h, y] of Object.entries(r.objects))
3628
+ !t.has(h) && y.updatedAt < o - this._gcOpts.maxAgeMs && (s.push(this._persister.removeItem(h)), delete r.objects[h], i.removed.push(h), i.removedOldCount++);
3629
3629
  const a = Object.entries(r.objects);
3630
- a.sort(([h, b], [y, g]) => b.updatedAt - g.updatedAt);
3630
+ a.sort(([h, y], [b, g]) => y.updatedAt - g.updatedAt);
3631
3631
  const c = a.filter(([h]) => !t.has(h));
3632
3632
  if (a.length > this._gcOpts.maxEntries)
3633
3633
  for (const [h] of c.slice(0, a.length - this._gcOpts.maxEntries))
3634
3634
  s.push(this._persister.removeItem(h)), delete r.objects[h], i.removed.push(h), i.removedThresholdCount++;
3635
3635
  const u = Object.entries(r.objects);
3636
- u.sort(([h, b], [y, g]) => b.updatedAt - g.updatedAt);
3636
+ u.sort(([h, y], [b, g]) => y.updatedAt - g.updatedAt);
3637
3637
  const l = u.filter(([h]) => !t.has(h));
3638
- let f = u.reduce((h, [b, y]) => h + y.size, 0);
3638
+ let f = u.reduce((h, [y, b]) => h + b.size, 0);
3639
3639
  for (; f > 0 && f > this._gcOpts.maxSize && l.length; ) {
3640
- const [[h, b]] = l.splice(0, 1);
3641
- f -= b.size, s.push(this._persister.removeItem(h)), delete r.objects[h], i.removed.push(h), i.removedSizeCount++;
3640
+ const [[h, y]] = l.splice(0, 1);
3641
+ f -= y.size, s.push(this._persister.removeItem(h)), delete r.objects[h], i.removed.push(h), i.removedSizeCount++;
3642
3642
  }
3643
3643
  for (const h of Object.keys(r.objects))
3644
3644
  !e.has(h) && !t.has(h) && delete r.objects[h];
@@ -3703,8 +3703,8 @@ class hn {
3703
3703
  e && await this._enqueuePersist();
3704
3704
  }
3705
3705
  }
3706
- const wa = 6, Sa = ["kv", "querySubs", "syncSubs"];
3707
- function Ta(n) {
3706
+ const wa = 6, Ta = ["kv", "querySubs", "syncSubs"];
3707
+ function Sa(n) {
3708
3708
  return function(t) {
3709
3709
  console.error("Error in IndexedDB event", { source: n, event: t });
3710
3710
  };
@@ -3734,26 +3734,26 @@ async function Aa(n, e, t) {
3734
3734
  return new Promise((i, o) => {
3735
3735
  var l, f, h;
3736
3736
  const a = {};
3737
- for (const [b, y] of Object.entries(r)) {
3738
- const g = typeof y == "string" ? JSON.parse(y) : y;
3737
+ for (const [y, b] of Object.entries(r)) {
3738
+ const g = typeof b == "string" ? JSON.parse(b) : b;
3739
3739
  if (g.lastAccessed) {
3740
3740
  const S = {
3741
3741
  createdAt: g.lastAccessed,
3742
3742
  updatedAt: g.lastAccessed,
3743
3743
  size: ((h = (f = (l = g.result) == null ? void 0 : l.store) == null ? void 0 : f.triples) == null ? void 0 : h.length) ?? 0
3744
3744
  };
3745
- a[b] = S;
3745
+ a[y] = S;
3746
3746
  }
3747
- const _ = t.put(g, b);
3748
- s.add(_);
3747
+ const m = t.put(g, y);
3748
+ s.add(m);
3749
3749
  }
3750
3750
  const c = { objects: a }, u = t.put(c, We);
3751
3751
  s.add(u);
3752
- for (const b of s)
3753
- b.onsuccess = () => {
3754
- s.delete(b), s.size === 0 && i();
3755
- }, b.onerror = (y) => {
3756
- o(y);
3752
+ for (const y of s)
3753
+ y.onsuccess = () => {
3754
+ s.delete(y), s.size === 0 && i();
3755
+ }, y.onerror = (b) => {
3756
+ o(b);
3757
3757
  };
3758
3758
  });
3759
3759
  }
@@ -3768,20 +3768,20 @@ async function Oa(n, e) {
3768
3768
  if (!t)
3769
3769
  return;
3770
3770
  const r = await new Promise((l, f) => {
3771
- const y = t.transaction(["kv"], "readonly").objectStore("kv").openCursor();
3772
- y.onerror = (_) => {
3773
- f(_);
3771
+ const b = t.transaction(["kv"], "readonly").objectStore("kv").openCursor();
3772
+ b.onerror = (m) => {
3773
+ f(m);
3774
3774
  };
3775
3775
  const g = [];
3776
- y.onsuccess = () => {
3777
- const _ = y.result;
3778
- if (_) {
3779
- const S = _.key, m = _.value;
3780
- g.push([S, m]), _.continue();
3776
+ b.onsuccess = () => {
3777
+ const m = b.result;
3778
+ if (m) {
3779
+ const S = m.key, _ = m.value;
3780
+ g.push([S, _]), m.continue();
3781
3781
  } else
3782
3782
  l(g);
3783
- }, y.onerror = (_) => {
3784
- f(_);
3783
+ }, b.onerror = (m) => {
3784
+ f(m);
3785
3785
  };
3786
3786
  }), s = e.transaction(["kv", "querySubs"], "readwrite"), i = s.objectStore("kv"), o = s.objectStore("querySubs"), a = [], c = { objects: {} };
3787
3787
  for (const [l, f] of r)
@@ -3794,12 +3794,12 @@ async function Oa(n, e) {
3794
3794
  default: {
3795
3795
  const h = cr(l, f, i);
3796
3796
  a.push(h);
3797
- const b = {
3797
+ const y = {
3798
3798
  createdAt: Date.now(),
3799
3799
  updatedAt: Date.now(),
3800
3800
  size: 0
3801
3801
  };
3802
- c.objects[l] = b;
3802
+ c.objects[l] = y;
3803
3803
  break;
3804
3804
  }
3805
3805
  }
@@ -3833,7 +3833,7 @@ class cs extends ma {
3833
3833
  c.close();
3834
3834
  }, s) {
3835
3835
  const u = Oa(this._appId, c).catch((l) => {
3836
- Ta("Error upgrading store from version 5 to 6.")(l);
3836
+ Sa("Error upgrading store from version 5 to 6.")(l);
3837
3837
  });
3838
3838
  ur.set(this.dbName, u), u.then(() => t(c)).catch(() => t(c));
3839
3839
  } else {
@@ -3847,7 +3847,7 @@ class cs extends ma {
3847
3847
  }
3848
3848
  _upgradeStore(t) {
3849
3849
  const s = t.target.result;
3850
- for (const i of Sa)
3850
+ for (const i of Ta)
3851
3851
  s.objectStoreNames.contains(i) || s.createObjectStore(i);
3852
3852
  }
3853
3853
  // Browsers can close IndexedDB connections unexpectedly (backgrounded tabs,
@@ -3923,20 +3923,20 @@ class us {
3923
3923
  };
3924
3924
  }
3925
3925
  }
3926
- class re extends Error {
3926
+ class ie extends Error {
3927
3927
  constructor(t, r, s) {
3928
3928
  super(t);
3929
3929
  p(this, "hint");
3930
3930
  p(this, "traceId");
3931
3931
  this.hint = r, s && (this.traceId = s);
3932
3932
  const i = new.target.prototype;
3933
- Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, re), this.name = "InstantError";
3933
+ Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, ie), this.name = "InstantError";
3934
3934
  }
3935
3935
  get [Symbol.toStringTag]() {
3936
3936
  return "InstantError";
3937
3937
  }
3938
3938
  }
3939
- class Mt extends re {
3939
+ class Rt extends ie {
3940
3940
  constructor(t) {
3941
3941
  var i, o;
3942
3942
  const r = ((i = t.body) == null ? void 0 : i.message) || `API Error (${t.status})`;
@@ -3944,7 +3944,7 @@ class Mt extends re {
3944
3944
  p(this, "body");
3945
3945
  p(this, "status");
3946
3946
  const s = new.target.prototype;
3947
- Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, Mt), this.name = "InstantAPIError", this.status = t.status, this.body = t.body;
3947
+ Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, Rt), this.name = "InstantAPIError", this.status = t.status, this.body = t.body;
3948
3948
  }
3949
3949
  get [Symbol.toStringTag]() {
3950
3950
  return "InstantAPIError";
@@ -3952,7 +3952,7 @@ class Mt extends re {
3952
3952
  }
3953
3953
  async function we(n, e) {
3954
3954
  const t = await fetch(n, e), r = await t.json();
3955
- return t.status === 200 ? Promise.resolve(r) : Promise.reject(new Mt({ status: t.status, body: r }));
3955
+ return t.status === 200 ? Promise.resolve(r) : Promise.reject(new Rt({ status: t.status, body: r }));
3956
3956
  }
3957
3957
  function Ea({ apiURI: n, appId: e, email: t }) {
3958
3958
  return we(`${n}/runtime/auth/send_magic_code`, {
@@ -4020,7 +4020,7 @@ async function Pa({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
4020
4020
  })
4021
4021
  });
4022
4022
  }
4023
- async function Ra({ apiURI: n, appId: e, refreshToken: t }) {
4023
+ async function Ma({ apiURI: n, appId: e, refreshToken: t }) {
4024
4024
  return await we(`${n}/runtime/signout`, {
4025
4025
  method: "POST",
4026
4026
  headers: {
@@ -4032,7 +4032,7 @@ async function Ra({ apiURI: n, appId: e, refreshToken: t }) {
4032
4032
  })
4033
4033
  });
4034
4034
  }
4035
- async function Ma({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, contentType: i, contentDisposition: o }) {
4035
+ async function Ra({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, contentType: i, contentDisposition: o }) {
4036
4036
  const a = {
4037
4037
  app_id: e,
4038
4038
  path: t,
@@ -4166,7 +4166,7 @@ function pr(n) {
4166
4166
  }, e;
4167
4167
  }, {});
4168
4168
  }
4169
- const hs = "v1.0.50-branch-log-dashboard-login-code.29876046282.1";
4169
+ const hs = "v1.0.50";
4170
4170
  function Fa(n, e, t = console) {
4171
4171
  return {
4172
4172
  info: n ? (...r) => t.info(...r, e()) : () => {
@@ -4177,7 +4177,7 @@ function Fa(n, e, t = console) {
4177
4177
  }
4178
4178
  };
4179
4179
  }
4180
- class Ae {
4180
+ class ve {
4181
4181
  constructor(e, t, r, s = { indexed: !1, unique: !1 }) {
4182
4182
  p(this, "valueType");
4183
4183
  p(this, "required");
@@ -4192,19 +4192,19 @@ class Ae {
4192
4192
  * and enforced for backend
4193
4193
  */
4194
4194
  clientRequired() {
4195
- return new Ae(this.valueType, !1, this.isIndexed, this.config);
4195
+ return new ve(this.valueType, !1, this.isIndexed, this.config);
4196
4196
  }
4197
4197
  optional() {
4198
- return new Ae(this.valueType, !1, this.isIndexed, this.config);
4198
+ return new ve(this.valueType, !1, this.isIndexed, this.config);
4199
4199
  }
4200
4200
  unique() {
4201
- return new Ae(this.valueType, this.required, this.isIndexed, {
4201
+ return new ve(this.valueType, this.required, this.isIndexed, {
4202
4202
  ...this.config,
4203
4203
  unique: !0
4204
4204
  });
4205
4205
  }
4206
4206
  indexed() {
4207
- return new Ae(this.valueType, this.required, !0, {
4207
+ return new ve(this.valueType, this.required, !0, {
4208
4208
  ...this.config,
4209
4209
  indexed: !0
4210
4210
  });
@@ -4295,12 +4295,12 @@ const yr = [
4295
4295
  const f = i[l], h = r.entities[o];
4296
4296
  if (!h)
4297
4297
  throw new Q(`Entity '${o}' does not exist in schema while traversing dot notation path '${n}'.`, s);
4298
- const b = h.links[f];
4299
- if (!b) {
4300
- const y = Object.keys(h.links);
4301
- throw new Q(`Link '${f}' does not exist on entity '${o}' in dot notation path '${n}'. Available links: ${y.length > 0 ? y.join(", ") : "none"}`, s);
4298
+ const y = h.links[f];
4299
+ if (!y) {
4300
+ const b = Object.keys(h.links);
4301
+ throw new Q(`Link '${f}' does not exist on entity '${o}' in dot notation path '${n}'. Available links: ${b.length > 0 ? b.join(", ") : "none"}`, s);
4302
4302
  }
4303
- o = b.entityName;
4303
+ o = y.entityName;
4304
4304
  }
4305
4305
  const a = i[i.length - 1], c = r.entities[o];
4306
4306
  if (!c)
@@ -4308,14 +4308,14 @@ const yr = [
4308
4308
  if (a === "id") {
4309
4309
  if (typeof e == "string" && !Ve(e))
4310
4310
  throw new Q(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
4311
- ze(e, n, new Ae("string", !1, !0), t, s);
4311
+ ze(e, n, new ve("string", !1, !0), t, s);
4312
4312
  return;
4313
4313
  }
4314
4314
  const u = c.attrs[a];
4315
4315
  if (Object.keys(c.links).includes(a)) {
4316
4316
  if (typeof e == "string" && !Ve(e))
4317
4317
  throw new Q(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
4318
- ze(e, n, new Ae("string", !1, !0), t, s);
4318
+ ze(e, n, new ve("string", !1, !0), t, s);
4319
4319
  return;
4320
4320
  }
4321
4321
  if (!u) {
@@ -4332,7 +4332,7 @@ const yr = [
4332
4332
  continue;
4333
4333
  }
4334
4334
  if (s === "id") {
4335
- ze(i, "id", new Ae("string", !1, !0), e, `${r}.id`);
4335
+ ze(i, "id", new ve("string", !1, !0), e, `${r}.id`);
4336
4336
  continue;
4337
4337
  }
4338
4338
  if (s.includes(".")) {
@@ -4352,7 +4352,7 @@ const yr = [
4352
4352
  else if (c) {
4353
4353
  if (typeof i == "string" && !Ve(i))
4354
4354
  throw new Q(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
4355
- const u = new Ae("string", !1, !0);
4355
+ const u = new ve("string", !1, !0);
4356
4356
  ze(i, s, u, e, `${r}.${s}`);
4357
4357
  }
4358
4358
  }
@@ -4675,7 +4675,7 @@ function wr(n, e, t, r) {
4675
4675
  const i = Be(e.eav, [r, s, r]);
4676
4676
  return i ? i[3] : -1;
4677
4677
  }
4678
- function Sr(n, e, t) {
4678
+ function Tr(n, e, t) {
4679
4679
  for (const { action: r, triple: s } of t)
4680
4680
  switch (r) {
4681
4681
  case "added":
@@ -4695,23 +4695,23 @@ function Xa(n, e, t) {
4695
4695
  continue;
4696
4696
  const h = r[c] ?? {};
4697
4697
  r[c] = h;
4698
- const b = h[f] ?? {};
4698
+ const y = h[f] ?? {};
4699
4699
  switch (o) {
4700
4700
  case "added":
4701
- b.newValue = l;
4701
+ y.newValue = l;
4702
4702
  break;
4703
4703
  case "removed":
4704
- b.oldValue === void 0 && (b.oldValue = l);
4704
+ y.oldValue === void 0 && (y.oldValue = l);
4705
4705
  break;
4706
4706
  }
4707
- h[f] = b;
4707
+ h[f] = y;
4708
4708
  }
4709
4709
  for (const [o, a] of Object.entries(r))
4710
4710
  for (const [c, { oldValue: u, newValue: l }] of Object.entries(a))
4711
4711
  u === l && delete a[c];
4712
4712
  return r;
4713
4713
  }
4714
- function gt(n, e) {
4714
+ function bt(n, e) {
4715
4715
  return { [n.table]: e.map((t) => t.entity) };
4716
4716
  }
4717
4717
  function ec(n, e) {
@@ -4777,7 +4777,7 @@ class nc {
4777
4777
  this.subs.flush();
4778
4778
  }
4779
4779
  subscribe(e, t) {
4780
- const r = ie(e);
4780
+ const r = se(e);
4781
4781
  return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(t), this.initSubscription(e, r, t), (s) => {
4782
4782
  this.unsubscribe(r, t, s == null ? void 0 : s.keepSubscription);
4783
4783
  };
@@ -4820,13 +4820,13 @@ class nc {
4820
4820
  if (s && s.state && s.state.txId) {
4821
4821
  this.sendResync(s, s.state, s.state.txId), (u = s.values) != null && u.entities && r && r({
4822
4822
  type: Ie.LoadFromStorage,
4823
- data: gt(s, (l = s.values) == null ? void 0 : l.entities)
4823
+ data: bt(s, (l = s.values) == null ? void 0 : l.entities)
4824
4824
  });
4825
4825
  return;
4826
4826
  }
4827
4827
  const i = Object.keys(e)[0], o = ((h = (f = e[i]) == null ? void 0 : f.$) == null ? void 0 : h.order) || { serverCreatedAt: "asc" }, [a, c] = Object.entries(o)[0];
4828
- this.subs.updateInPlace((b) => {
4829
- b[t] = {
4828
+ this.subs.updateInPlace((y) => {
4829
+ y[t] = {
4830
4830
  query: e,
4831
4831
  hash: t,
4832
4832
  table: i,
@@ -4845,7 +4845,7 @@ class nc {
4845
4845
  }
4846
4846
  }
4847
4847
  onStartSyncOk(e) {
4848
- const t = e["subscription-id"], r = e.q, s = ie(r);
4848
+ const t = e["subscription-id"], r = e.q, s = se(r);
4849
4849
  this.idToHash[t] = s, this.subs.updateInPlace((i) => {
4850
4850
  const o = i[s];
4851
4851
  if (!o)
@@ -4889,7 +4889,7 @@ class nc {
4889
4889
  u[s] = o, u[s].updatedAt = Date.now();
4890
4890
  }), o.values && this.notifyCbs(s, {
4891
4891
  type: Ie.InitialSyncBatch,
4892
- data: gt(o, o.values.entities),
4892
+ data: bt(o, o.values.entities),
4893
4893
  batch: i
4894
4894
  });
4895
4895
  }
@@ -4914,7 +4914,7 @@ class nc {
4914
4914
  const s = this.subs.currentValue[r];
4915
4915
  s && this.notifyCbs(r, {
4916
4916
  type: Ie.InitialSyncComplete,
4917
- data: gt(s, ((i = s.values) == null ? void 0 : i.entities) || [])
4917
+ data: bt(s, ((i = s.values) == null ? void 0 : i.entities) || [])
4918
4918
  });
4919
4919
  }
4920
4920
  onSyncUpdateTriples(e) {
@@ -4939,9 +4939,9 @@ class nc {
4939
4939
  continue;
4940
4940
  i.txId = a["tx-id"];
4941
4941
  const c = [], u = {};
4942
- for (const _ of a.changes) {
4943
- const S = u[_.triple[0]] ?? [];
4944
- u[_.triple[0]] = S, S.push(_);
4942
+ for (const m of a.changes) {
4943
+ const S = u[m.triple[0]] ?? [];
4944
+ u[m.triple[0]] = S, S.push(m);
4945
4945
  }
4946
4946
  const l = s.values ?? {
4947
4947
  entities: [],
@@ -4949,48 +4949,48 @@ class nc {
4949
4949
  }, f = l.entities;
4950
4950
  s.values = l;
4951
4951
  const h = [];
4952
- e: for (const [_, S] of Object.entries(u))
4953
- for (let m = 0; m < f.length; m++) {
4954
- const T = f[m];
4955
- if (Mi(T.store, _)) {
4956
- Sr(T.store, l.attrsStore, S);
4957
- const C = zt(s, T.store, l.attrsStore), O = Xa(T.store, l.attrsStore, S)[_];
4958
- C ? (h.push({
4952
+ e: for (const [m, S] of Object.entries(u))
4953
+ for (let _ = 0; _ < f.length; _++) {
4954
+ const T = f[_];
4955
+ if (Ri(T.store, m)) {
4956
+ Tr(T.store, l.attrsStore, S);
4957
+ const M = zt(s, T.store, l.attrsStore), O = Xa(T.store, l.attrsStore, S)[m];
4958
+ M ? (h.push({
4959
4959
  oldEntity: T.entity,
4960
- newEntity: C,
4960
+ newEntity: M,
4961
4961
  changedFields: O || {}
4962
- }), T.entity = C) : c.push(m), delete u[_];
4962
+ }), T.entity = M) : c.push(_), delete u[m];
4963
4963
  continue e;
4964
4964
  }
4965
4965
  }
4966
- const b = [];
4967
- for (const [_, S] of Object.entries(u)) {
4968
- const m = this.createStore([]);
4969
- Sr(m, l.attrsStore, S);
4970
- const T = zt(s, m, l.attrsStore);
4966
+ const y = [];
4967
+ for (const [m, S] of Object.entries(u)) {
4968
+ const _ = this.createStore([]);
4969
+ Tr(_, l.attrsStore, S);
4970
+ const T = zt(s, _, l.attrsStore);
4971
4971
  if (!T) {
4972
4972
  this.log.error("No entity found after applying change", {
4973
4973
  sub: s,
4974
4974
  changes: S,
4975
- store: m
4975
+ store: _
4976
4976
  });
4977
4977
  continue;
4978
4978
  }
4979
4979
  f.push({
4980
- store: m,
4980
+ store: _,
4981
4981
  entity: T,
4982
- serverCreatedAt: wr(s, m, l.attrsStore, T.id)
4983
- }), b.push(T);
4982
+ serverCreatedAt: wr(s, _, l.attrsStore, T.id)
4983
+ }), y.push(T);
4984
4984
  }
4985
- const y = [];
4986
- for (const _ of c.sort().reverse())
4987
- y.push(f[_].entity), f.splice(_, 1);
4985
+ const b = [];
4986
+ for (const m of c.sort().reverse())
4987
+ b.push(f[m].entity), f.splice(m, 1);
4988
4988
  const g = ec(s, this.getAttrs);
4989
4989
  tc(s, g, f), this.notifyCbs(r, {
4990
4990
  type: Ie.SyncTransaction,
4991
- data: gt(s, (o = s.values) == null ? void 0 : o.entities),
4992
- added: b,
4993
- removed: y,
4991
+ data: bt(s, (o = s.values) == null ? void 0 : o.entities),
4992
+ added: y,
4993
+ removed: b,
4994
4994
  updated: h
4995
4995
  });
4996
4996
  }
@@ -5010,7 +5010,7 @@ class nc {
5010
5010
  }
5011
5011
  }
5012
5012
  onStartSyncError(e) {
5013
- const t = ie(e["original-event"].q), r = {
5013
+ const t = se(e["original-event"].q), r = {
5014
5014
  message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
5015
5015
  status: e.status,
5016
5016
  type: e.type,
@@ -5032,10 +5032,10 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5032
5032
  let o = null, a = null, c = null;
5033
5033
  const u = J();
5034
5034
  let l = !1, f = !1;
5035
- const h = [], b = [], y = [];
5036
- let g = !1, _ = 0, S = 0;
5037
- const m = [], T = new TextEncoder();
5038
- function C() {
5035
+ const h = [], y = [], b = [];
5036
+ let g = !1, m = 0, S = 0;
5037
+ const _ = [], T = new TextEncoder();
5038
+ function M() {
5039
5039
  f = !0;
5040
5040
  for (const A of h)
5041
5041
  A(a ?? void 0);
@@ -5046,48 +5046,48 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5046
5046
  k !== -1 && h.splice(k, 1);
5047
5047
  };
5048
5048
  }
5049
- function M(A) {
5050
- return y.push(A), () => {
5051
- const k = y.indexOf(A);
5052
- k !== -1 && y.splice(k, 1);
5049
+ function F(A) {
5050
+ return b.push(A), () => {
5051
+ const k = b.indexOf(A);
5052
+ k !== -1 && b.splice(k, 1);
5053
5053
  };
5054
5054
  }
5055
5055
  e.waitUntil && e.waitUntil(new Promise((A) => {
5056
- y.push(A);
5056
+ b.push(A);
5057
5057
  }));
5058
- function R() {
5059
- for (const A of y)
5058
+ function P() {
5059
+ for (const A of b)
5060
5060
  try {
5061
5061
  A();
5062
5062
  } catch {
5063
5063
  }
5064
5064
  }
5065
- function P(A) {
5066
- return b.push(A), o && A(o), () => {
5067
- const k = b.indexOf(A);
5068
- k !== -1 && b.splice(k, 1);
5065
+ function C(A) {
5066
+ return y.push(A), o && A(o), () => {
5067
+ const k = y.indexOf(A);
5068
+ k !== -1 && y.splice(k, 1);
5069
5069
  };
5070
5070
  }
5071
5071
  function G(A) {
5072
5072
  o = A;
5073
- for (const k of b)
5073
+ for (const k of y)
5074
5074
  k(o);
5075
5075
  }
5076
- function L() {
5076
+ function N() {
5077
5077
  g = !0;
5078
5078
  }
5079
5079
  function B(A) {
5080
- let k = _, K = 0, H = 0;
5081
- for (const { byteLen: Y } of m) {
5080
+ let k = m, K = 0, H = 0;
5081
+ for (const { byteLen: Y } of _) {
5082
5082
  const oe = k + Y;
5083
5083
  if (oe > A)
5084
5084
  break;
5085
5085
  k = oe, K++, H += Y;
5086
5086
  }
5087
- K > 0 && (_ += H, S -= H, m.splice(0, K));
5087
+ K > 0 && (m += H, S -= H, _.splice(0, K));
5088
5088
  }
5089
5089
  function z(A, k) {
5090
- a = k, C(), A.error(k), R();
5090
+ a = k, M(), A.error(k), P();
5091
5091
  }
5092
5092
  async function ee() {
5093
5093
  const A = await t({
@@ -5098,15 +5098,15 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5098
5098
  switch (A.type) {
5099
5099
  case "ok": {
5100
5100
  const { streamId: k, offset: K } = A;
5101
- o = k, B(K), m.length && r({
5101
+ o = k, B(K), _.length && r({
5102
5102
  streamId: k,
5103
- chunks: m.map((H) => H.chunk),
5104
- offset: _
5103
+ chunks: _.map((H) => H.chunk),
5104
+ offset: m
5105
5105
  }), g = !1;
5106
5106
  break;
5107
5107
  }
5108
5108
  case "disconnect": {
5109
- L();
5109
+ N();
5110
5110
  break;
5111
5111
  }
5112
5112
  case "error": {
@@ -5116,15 +5116,15 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5116
5116
  }
5117
5117
  }
5118
5118
  function q() {
5119
- L(), ee();
5119
+ N(), ee();
5120
5120
  }
5121
5121
  function E({ offset: A, done: k }) {
5122
- B(A), k && (l = !0, R());
5122
+ B(A), k && (l = !0, P());
5123
5123
  }
5124
- function $(A) {
5125
- return l ? (z(A, new re("Stream has been closed.")), null) : o || (z(A, new re("Stream has not been initialized.")), null);
5124
+ function j(A) {
5125
+ return l ? (z(A, new ie("Stream has been closed.")), null) : o || (z(A, new ie("Stream has not been initialized.")), null);
5126
5126
  }
5127
- async function j(A) {
5127
+ async function R(A) {
5128
5128
  c = A;
5129
5129
  let k = !0, K = 0;
5130
5130
  for (; k; ) {
@@ -5139,12 +5139,12 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5139
5139
  case "ok": {
5140
5140
  const { streamId: oe, offset: Ge } = Y;
5141
5141
  if (Ge !== 0) {
5142
- const ge = new re("Write stream is corrupted");
5142
+ const ge = new ie("Write stream is corrupted");
5143
5143
  z(A, ge);
5144
5144
  return;
5145
5145
  }
5146
5146
  G(oe), s(oe, {
5147
- onDisconnect: L,
5147
+ onDisconnect: N,
5148
5148
  onFlush: E,
5149
5149
  onConnectionReconnect: ee,
5150
5150
  onAppendFailed: q
@@ -5152,7 +5152,7 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5152
5152
  return;
5153
5153
  }
5154
5154
  case "disconnect": {
5155
- k = !0, L(), K++, await new Promise((oe) => {
5155
+ k = !0, N(), K++, await new Promise((oe) => {
5156
5156
  setTimeout(oe, Math.max(0, H - Date.now()));
5157
5157
  });
5158
5158
  break;
@@ -5164,7 +5164,7 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5164
5164
  }
5165
5165
  }
5166
5166
  }
5167
- class x extends n {
5167
+ class U extends n {
5168
5168
  constructor(k, K) {
5169
5169
  super(k, K);
5170
5170
  }
@@ -5176,29 +5176,29 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5176
5176
  }, oe = (ge) => {
5177
5177
  k(ge), Y();
5178
5178
  }, Ge = (ge) => {
5179
- K(ge || new re("Stream is closed.")), Y();
5179
+ K(ge || new ie("Stream is closed.")), Y();
5180
5180
  };
5181
- H.push(P(oe)), H.push(O(Ge));
5181
+ H.push(C(oe)), H.push(O(Ge));
5182
5182
  });
5183
5183
  }
5184
5184
  }
5185
5185
  return {
5186
- stream: new x({
5186
+ stream: new U({
5187
5187
  // TODO(dww): accept a storage so that write streams can survive across
5188
5188
  // browser restarts
5189
5189
  async start(A) {
5190
5190
  try {
5191
- await j(A);
5191
+ await R(A);
5192
5192
  } catch (k) {
5193
5193
  z(A, k);
5194
5194
  }
5195
5195
  },
5196
5196
  write(A, k) {
5197
- const K = $(k);
5197
+ const K = j(k);
5198
5198
  if (K) {
5199
5199
  const H = T.encode(A).length;
5200
- m.push({ chunk: A, byteLen: H });
5201
- const Y = _ + S;
5200
+ _.push({ chunk: A, byteLen: H });
5201
+ const Y = m + S;
5202
5202
  S += H, g || r({ streamId: K, chunks: [A], offset: Y });
5203
5203
  }
5204
5204
  },
@@ -5206,21 +5206,21 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5206
5206
  o ? r({
5207
5207
  streamId: o,
5208
5208
  chunks: [],
5209
- offset: _ + S,
5209
+ offset: m + S,
5210
5210
  isDone: !0
5211
- }) : R(), C();
5211
+ }) : P(), M();
5212
5212
  },
5213
5213
  abort(A) {
5214
5214
  o ? r({
5215
5215
  streamId: o,
5216
5216
  chunks: [],
5217
- offset: _ + S,
5217
+ offset: m + S,
5218
5218
  isDone: !0,
5219
5219
  abortReason: A
5220
- }) : R(), C();
5220
+ }) : P(), M();
5221
5221
  }
5222
5222
  }),
5223
- addCompleteCb: M,
5223
+ addCompleteCb: F,
5224
5224
  closed() {
5225
5225
  return f;
5226
5226
  }
@@ -5265,68 +5265,68 @@ function ic({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
5265
5265
  const o = new TextDecoder("utf-8"), a = new TextEncoder();
5266
5266
  let c, u = !1;
5267
5267
  const l = [], f = [];
5268
- let h = null, b = null;
5269
- function y(R) {
5268
+ let h = null, y = null;
5269
+ function b(P) {
5270
5270
  u = !0;
5271
- for (const P of l)
5272
- P(R);
5271
+ for (const C of l)
5272
+ C(P);
5273
5273
  }
5274
- function g(R) {
5275
- return l.push(R), () => {
5276
- const P = l.indexOf(R);
5277
- P !== -1 && l.splice(P, 1);
5274
+ function g(P) {
5275
+ return l.push(P), () => {
5276
+ const C = l.indexOf(P);
5277
+ C !== -1 && l.splice(C, 1);
5278
5278
  };
5279
5279
  }
5280
- function _(R) {
5281
- return f.push(R), h && R(h), () => {
5282
- const P = f.indexOf(R);
5283
- P !== -1 && f.splice(P, 1);
5280
+ function m(P) {
5281
+ return f.push(P), h && P(h), () => {
5282
+ const C = f.indexOf(P);
5283
+ C !== -1 && f.splice(C, 1);
5284
5284
  };
5285
5285
  }
5286
- function S(R, P) {
5287
- b = P, R.error(P), y(P);
5286
+ function S(P, C) {
5287
+ y = C, P.error(C), b(C);
5288
5288
  }
5289
- let m = 0;
5290
- async function T(R, P) {
5289
+ let _ = 0;
5290
+ async function T(P, C) {
5291
5291
  c = J();
5292
- const G = { ...R || {}, eventId: c };
5293
- for await (const L of t(G)) {
5292
+ const G = { ...P || {}, eventId: c };
5293
+ for await (const N of t(G)) {
5294
5294
  if (i)
5295
5295
  return;
5296
- if (L.type === "reconnect")
5296
+ if (N.type === "reconnect")
5297
5297
  return { retry: !0 };
5298
- if (L.type === "error") {
5299
- S(P, L.error);
5298
+ if (N.type === "error") {
5299
+ S(C, N.error);
5300
5300
  return;
5301
5301
  }
5302
- if (L.offset > s) {
5303
- S(P, new re("Stream is corrupted.")), i = !0;
5302
+ if (N.offset > s) {
5303
+ S(C, new ie("Stream is corrupted.")), i = !0;
5304
5304
  return;
5305
5305
  }
5306
- h = L.streamId;
5306
+ h = N.streamId;
5307
5307
  for (const z of f)
5308
5308
  z(h);
5309
- let B = s - L.offset;
5310
- if (L.files && L.files.length) {
5309
+ let B = s - N.offset;
5310
+ if (N.files && N.files.length) {
5311
5311
  const z = new AbortController();
5312
- let ee = fetch(L.files[0].url, {
5312
+ let ee = fetch(N.files[0].url, {
5313
5313
  signal: z.signal
5314
5314
  });
5315
- for (let q = 0; q < L.files.length; q++) {
5316
- const E = L.files[q + 1], j = await ee;
5317
- if (E && (ee = fetch(E.url, { signal: z.signal })), !j.ok) {
5318
- if (m++, m > 10) {
5319
- S(P, new re("Unable to process stream."));
5315
+ for (let q = 0; q < N.files.length; q++) {
5316
+ const E = N.files[q + 1], R = await ee;
5317
+ if (E && (ee = fetch(E.url, { signal: z.signal })), !R.ok) {
5318
+ if (_++, _ > 10) {
5319
+ S(C, new ie("Unable to process stream."));
5320
5320
  return;
5321
5321
  }
5322
5322
  return { retry: !0 };
5323
5323
  }
5324
- if (j.body) {
5325
- const x = j.body.getReader();
5324
+ if (R.body) {
5325
+ const U = R.body.getReader();
5326
5326
  try {
5327
5327
  for (; ; ) {
5328
- const { done: N, value: A } = await x.read();
5329
- if (N)
5328
+ const { done: L, value: A } = await U.read();
5329
+ if (L)
5330
5330
  break;
5331
5331
  if (i) {
5332
5332
  z.abort();
@@ -5337,79 +5337,79 @@ function ic({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
5337
5337
  continue;
5338
5338
  s += k.length;
5339
5339
  const K = o.decode(k);
5340
- P.enqueue(K);
5340
+ C.enqueue(K);
5341
5341
  }
5342
5342
  } finally {
5343
- x.releaseLock();
5343
+ U.releaseLock();
5344
5344
  }
5345
5345
  } else {
5346
- const x = await j.arrayBuffer();
5347
- let N = x;
5346
+ const U = await R.arrayBuffer();
5347
+ let L = U;
5348
5348
  if (i) {
5349
5349
  z.abort();
5350
5350
  return;
5351
5351
  }
5352
- if (B > 0 && (N = new Uint8Array(x).subarray(B), B -= x.byteLength - N.length), !N.byteLength)
5352
+ if (B > 0 && (L = new Uint8Array(U).subarray(B), B -= U.byteLength - L.length), !L.byteLength)
5353
5353
  continue;
5354
- s += N.byteLength;
5355
- const A = o.decode(N);
5356
- P.enqueue(A);
5354
+ s += L.byteLength;
5355
+ const A = o.decode(L);
5356
+ C.enqueue(A);
5357
5357
  }
5358
5358
  }
5359
5359
  }
5360
- if (m = 0, L.content) {
5361
- let z = L.content, ee = a.encode(L.content);
5360
+ if (_ = 0, N.content) {
5361
+ let z = N.content, ee = a.encode(N.content);
5362
5362
  if (B > 0) {
5363
5363
  const q = ee.subarray(B);
5364
5364
  if (B -= ee.length - q.length, !q.length)
5365
5365
  continue;
5366
5366
  ee = q, z = o.decode(q);
5367
5367
  }
5368
- s += ee.length, P.enqueue(z);
5368
+ s += ee.length, C.enqueue(z);
5369
5369
  }
5370
5370
  }
5371
5371
  }
5372
- async function C(R) {
5373
- let P = !0, G = 0;
5374
- for (; P; ) {
5375
- P = !1;
5376
- let L = Date.now() + Math.min(15e3, 500 * (G - 1));
5377
- const B = await T({ ...e, offset: s }, R);
5378
- B != null && B.retry && (P = !0, G++, L < Date.now() - 3e5 && (G = 0), await new Promise((z) => {
5379
- setTimeout(z, Math.max(0, L - Date.now()));
5372
+ async function M(P) {
5373
+ let C = !0, G = 0;
5374
+ for (; C; ) {
5375
+ C = !1;
5376
+ let N = Date.now() + Math.min(15e3, 500 * (G - 1));
5377
+ const B = await T({ ...e, offset: s }, P);
5378
+ B != null && B.retry && (C = !0, G++, N < Date.now() - 3e5 && (G = 0), await new Promise((z) => {
5379
+ setTimeout(z, Math.max(0, N - Date.now()));
5380
5380
  }));
5381
5381
  }
5382
- !i && !u && (R.close(), y());
5382
+ !i && !u && (P.close(), b());
5383
5383
  }
5384
5384
  class O extends n {
5385
- constructor(P, G) {
5386
- super(P, G);
5385
+ constructor(C, G) {
5386
+ super(C, G);
5387
5387
  }
5388
5388
  async streamId() {
5389
5389
  if (h)
5390
5390
  return h;
5391
- if (b)
5392
- throw b;
5393
- return new Promise((P, G) => {
5394
- const L = [], B = () => {
5395
- for (const q of L)
5391
+ if (y)
5392
+ throw y;
5393
+ return new Promise((C, G) => {
5394
+ const N = [], B = () => {
5395
+ for (const q of N)
5396
5396
  q();
5397
5397
  }, z = (q) => {
5398
- P(q), B();
5398
+ C(q), B();
5399
5399
  }, ee = (q) => {
5400
- G(q || new re("Stream is closed.")), B();
5400
+ G(q || new ie("Stream is closed.")), B();
5401
5401
  };
5402
- L.push(_(z)), L.push(g(ee));
5402
+ N.push(m(z)), N.push(g(ee));
5403
5403
  });
5404
5404
  }
5405
5405
  }
5406
5406
  return {
5407
5407
  stream: new O({
5408
- start(R) {
5409
- C(R);
5408
+ start(P) {
5409
+ M(P);
5410
5410
  },
5411
- cancel(R) {
5412
- i = !0, c && r({ eventId: c }), y();
5411
+ cancel(P) {
5412
+ i = !0, c && r({ eventId: c }), b();
5413
5413
  }
5414
5414
  }),
5415
5415
  addCloseCb: g,
@@ -5524,7 +5524,7 @@ class oc {
5524
5524
  if (e.error) {
5525
5525
  e.retry ? r.push({ type: "reconnect" }) : r.push({
5526
5526
  type: "error",
5527
- error: new re(e.error)
5527
+ error: new ie(e.error)
5528
5528
  }), r.close(), delete this.readStreamIterators[t];
5529
5529
  return;
5530
5530
  }
@@ -5539,7 +5539,7 @@ class oc {
5539
5539
  onConnectionStatusChange(e) {
5540
5540
  for (const t of Object.values(this.startWriteStreamCbs))
5541
5541
  t({ type: "disconnect" });
5542
- if (this.startWriteStreamCbs = {}, e !== Se.AUTHENTICATED)
5542
+ if (this.startWriteStreamCbs = {}, e !== Te.AUTHENTICATED)
5543
5543
  for (const { onDisconnect: t } of Object.values(this.writeStreams))
5544
5544
  t();
5545
5545
  else {
@@ -5562,7 +5562,7 @@ class oc {
5562
5562
  const r = e["client-event-id"], s = this.startWriteStreamCbs[r];
5563
5563
  s && (s({
5564
5564
  type: "error",
5565
- error: new re(e.message || "Unknown error", e.hint)
5565
+ error: new ie(e.message || "Unknown error", e.hint)
5566
5566
  }), delete this.startWriteStreamCbs[r]);
5567
5567
  break;
5568
5568
  }
@@ -5570,7 +5570,7 @@ class oc {
5570
5570
  const r = e["client-event-id"], s = this.readStreamIterators[r];
5571
5571
  s && (s.push({
5572
5572
  type: "error",
5573
- error: new re(e.message || "Unknown error", e.hint)
5573
+ error: new ie(e.message || "Unknown error", e.hint)
5574
5574
  }), s.close(), delete this.readStreamIterators[r]);
5575
5575
  break;
5576
5576
  }
@@ -5580,16 +5580,16 @@ class oc {
5580
5580
  return this.activeStreams.size > 0;
5581
5581
  }
5582
5582
  }
5583
- const Se = {
5583
+ const Te = {
5584
5584
  CONNECTING: "connecting",
5585
5585
  OPENED: "opened",
5586
5586
  AUTHENTICATED: "authenticated",
5587
5587
  CLOSED: "closed",
5588
5588
  ERRORED: "errored"
5589
- }, ac = 3e4, cc = 3e4, uc = 200, lc = 1e3 * 60, fc = lc * 60 * 24, Tr = "lastSyncedUserCookie", dc = {
5589
+ }, ac = 3e4, cc = 3e4, uc = 200, lc = 1e3 * 60, fc = lc * 60 * 24, Sr = "lastSyncedUserCookie", dc = {
5590
5590
  apiURI: "https://api.instantdb.com",
5591
5591
  websocketURI: "wss://api.instantdb.com/runtime/session"
5592
- }, Vt = "_instant_oauth_redirect", Qt = "_instant_extra_fields_id", _t = "oauthExtraFields", Fe = "currentUser";
5592
+ }, Vt = "_instant_oauth_redirect", Qt = "_instant_extra_fields_id", gt = "oauthExtraFields", Fe = "currentUser";
5593
5593
  function hc({ transportType: n, appId: e, apiURI: t, wsURI: r, EventSourceImpl: s }) {
5594
5594
  if (!s)
5595
5595
  return new mr(`${r}?app_id=${e}`);
@@ -5673,7 +5673,7 @@ class wc {
5673
5673
  p(this, "attrs");
5674
5674
  p(this, "_isOnline", !0);
5675
5675
  p(this, "_isShutdown", !1);
5676
- p(this, "status", Se.CONNECTING);
5676
+ p(this, "status", Te.CONNECTING);
5677
5677
  /** @type {PersistedObject<string, QuerySub, QuerySubInStorage>} */
5678
5678
  p(this, "querySubs");
5679
5679
  /** @type {PersistedObject} */
@@ -5690,13 +5690,6 @@ class wc {
5690
5690
  p(this, "attrsCbs", []);
5691
5691
  p(this, "mutationErrorCbs", []);
5692
5692
  p(this, "connectionStatusCbs", []);
5693
- p(this, "appStatusCbs", []);
5694
- /**
5695
- * Carries the raw server status off the public type: `disabled` is an
5696
- * operator-level state we don't surface to apps.
5697
- * @type {import('./clientTypes.ts').AppStatusState & { status?: 'active' | 'read-only' | 'disabled' }}
5698
- */
5699
- p(this, "_appStatusState", { isLoading: !0, isReadOnly: void 0 });
5700
5693
  p(this, "config");
5701
5694
  p(this, "mutationDeferredStore", /* @__PURE__ */ new Map());
5702
5695
  p(this, "_reconnectTimeoutId", null);
@@ -5752,14 +5745,14 @@ class wc {
5752
5745
  // Queries
5753
5746
  p(this, "getPreviousResult", (e) => {
5754
5747
  var r;
5755
- const t = ie(e);
5748
+ const t = se(e);
5756
5749
  return (r = this.dataForQuery(t)) == null ? void 0 : r.data;
5757
5750
  });
5758
5751
  /** Re-run instaql and call all callbacks with new data */
5759
5752
  p(this, "notifyOne", (e) => {
5760
5753
  var i;
5761
5754
  const t = this.queryCbs[e] ?? [], r = (i = this._dataForQueryCache[e]) == null ? void 0 : i.data, s = this.dataForQuery(e);
5762
- s != null && s.data && (this._dataForQueryCache[e] = s, !vt(s.data, r) && t.forEach((o) => o.cb(s.data)));
5755
+ s != null && s.data && (this._dataForQueryCache[e] = s, !St(s.data, r) && t.forEach((o) => o.cb(s.data)));
5763
5756
  });
5764
5757
  p(this, "notifyOneQueryOnce", (e) => {
5765
5758
  var s;
@@ -5769,16 +5762,10 @@ class wc {
5769
5762
  });
5770
5763
  });
5771
5764
  p(this, "notifyQueryError", (e, t) => {
5772
- delete this._dataForQueryCache[e], (this.queryCbs[e] || []).forEach((s) => s.cb({ error: t }));
5765
+ (this.queryCbs[e] || []).forEach((s) => s.cb({ error: t }));
5773
5766
  });
5774
5767
  /** Applies transactions locally and sends transact message to server */
5775
5768
  p(this, "pushTx", (e) => {
5776
- if (this._appStatusState.isReadOnly)
5777
- return Promise.reject(this._appStatusState.status === "disabled" ? new re("This app is currently disabled.", {
5778
- status: "disabled"
5779
- }) : new re("This app is in read-only mode.", {
5780
- status: "read-only"
5781
- }));
5782
5769
  this.config.disableValidation || Ga(e, this.config.schema);
5783
5770
  try {
5784
5771
  const t = _a({
@@ -5820,7 +5807,7 @@ class wc {
5820
5807
  this._log.info("[socket][open]", t.id, "skip; this is no longer the current transport");
5821
5808
  return;
5822
5809
  }
5823
- this._log.info("[socket][open]", this._transport.id), this._setStatus(Se.OPENED), this.getCurrentUser().then((r) => {
5810
+ this._log.info("[socket][open]", this._transport.id), this._setStatus(Te.OPENED), this.getCurrentUser().then((r) => {
5824
5811
  var s;
5825
5812
  this._trySend(J(), {
5826
5813
  op: "init",
@@ -5873,7 +5860,7 @@ class wc {
5873
5860
  this._log.info("[socket][close]", t.id, "skip; this is no longer the current transport");
5874
5861
  return;
5875
5862
  }
5876
- this._setStatus(Se.CLOSED);
5863
+ this._setStatus(Te.CLOSED);
5877
5864
  for (const r of Object.values(this._rooms))
5878
5865
  r.isConnected = !1;
5879
5866
  if (this._isShutdown) {
@@ -5910,7 +5897,7 @@ class wc {
5910
5897
  log: this._log
5911
5898
  }), this._oauthCallbackResponse = this._oauthLoginInit(), this.setupUserSyncTimer(), r.getIsOnline().then((o) => {
5912
5899
  this._isOnline = o, this._startSocket(), r.listen((a) => {
5913
- a !== this._isOnline && (this._log.info("[network] online =", a), this._isOnline = a, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", Se.CLOSED), this._setStatus(Se.CLOSED)));
5900
+ a !== this._isOnline && (this._log.info("[network] online =", a), this._isOnline = a, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", Te.CLOSED), this._setStatus(Te.CLOSED)));
5914
5901
  });
5915
5902
  }), typeof addEventListener < "u" && (this._beforeUnload = this._beforeUnload.bind(this), addEventListener("beforeunload", this._beforeUnload));
5916
5903
  }
@@ -6001,13 +5988,13 @@ class wc {
6001
5988
  s.resolve({ status: e, eventId: t });
6002
5989
  else if (r != null && r.type) {
6003
5990
  const { status: o, ...a } = r;
6004
- s.reject(new Mt({
5991
+ s.reject(new Rt({
6005
5992
  // @ts-expect-error body.type is not constant typed
6006
5993
  body: a,
6007
5994
  status: o ?? 0
6008
5995
  }));
6009
5996
  } else
6010
- s.reject(new re((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint, r == null ? void 0 : r.traceId));
5997
+ s.reject(new ie((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint, r == null ? void 0 : r.traceId));
6011
5998
  }
6012
5999
  _setStatus(e, t) {
6013
6000
  this.status = e, this._errorMessage = t, this.notifyConnectionStatusSubs(e), this._instantStream.onConnectionStatusChange(e);
@@ -6031,7 +6018,7 @@ class wc {
6031
6018
  _addQueryData(e, t, r) {
6032
6019
  if (!this.attrs)
6033
6020
  throw new Error("Attrs in reactor have not been set");
6034
- const s = ie(e), i = this.ensureAttrs(), o = tt(this.attrs, t.triples, r, this.config.useDateObjects);
6021
+ const s = se(e), i = this.ensureAttrs(), o = tt(this.attrs, t.triples, r, this.config.useDateObjects);
6035
6022
  this.querySubs.updateInPlace((a) => {
6036
6023
  a[s] = {
6037
6024
  result: {
@@ -6046,39 +6033,39 @@ class wc {
6046
6033
  }), this._cleanupPendingMutationsQueries(), this.notifyOne(s), this.notifyOneQueryOnce(s), this._cleanupPendingMutationsTimeout();
6047
6034
  }
6048
6035
  _handleReceive(e, t) {
6049
- var s, i, o, a, c, u, l, f;
6036
+ var s, i, o, a, c, u, l;
6050
6037
  const r = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
6051
6038
  switch (vr[t.op] || this._log.info("[receive]", e, t.op, t), t.op) {
6052
6039
  case "init-ok": {
6053
- this._setStatus(Se.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAppStatus(((s = t["app-status"]) == null ? void 0 : s.status) ?? "active"), this._setAttrs(t.attrs), this._flushPendingMessages(), this._sessionId = t["session-id"];
6040
+ this._setStatus(Te.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(t.attrs), this._flushPendingMessages(), this._sessionId = t["session-id"];
6054
6041
  for (const y of Object.keys(this._rooms)) {
6055
- const g = (o = (i = this._presence[y]) == null ? void 0 : i.result) == null ? void 0 : o.user, _ = (a = this._rooms[y]) == null ? void 0 : a.roomType;
6056
- this._tryJoinRoom(_, y, g);
6042
+ const b = (i = (s = this._presence[y]) == null ? void 0 : s.result) == null ? void 0 : i.user, g = (o = this._rooms[y]) == null ? void 0 : o.roomType;
6043
+ this._tryJoinRoom(g, y, b);
6057
6044
  }
6058
6045
  break;
6059
6046
  }
6060
6047
  case "add-query-exists": {
6061
- this.notifyOneQueryOnce(ie(t.q));
6048
+ this.notifyOneQueryOnce(se(t.q));
6062
6049
  break;
6063
6050
  }
6064
6051
  case "add-query-ok": {
6065
- const { q: y, result: g } = t, _ = ie(y);
6066
- if (!this._hasQueryListeners() && !this.querySubs.currentValue[_])
6052
+ const { q: y, result: b } = t, g = se(y);
6053
+ if (!this._hasQueryListeners() && !this.querySubs.currentValue[g])
6067
6054
  break;
6068
- const S = (u = (c = g == null ? void 0 : g[0]) == null ? void 0 : c.data) == null ? void 0 : u["page-info"], m = (f = (l = g == null ? void 0 : g[0]) == null ? void 0 : l.data) == null ? void 0 : f.aggregate, T = hr(g), C = this.ensureAttrs(), O = tt(C, T, r, this.config.useDateObjects);
6069
- this.querySubs.updateInPlace((M) => {
6070
- if (!M[_]) {
6071
- this._log.info("Missing value in querySubs", { hash: _, q: y });
6055
+ const m = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, _ = hr(b), T = this.ensureAttrs(), M = tt(T, _, r, this.config.useDateObjects);
6056
+ this.querySubs.updateInPlace((O) => {
6057
+ if (!O[g]) {
6058
+ this._log.info("Missing value in querySubs", { hash: g, q: y });
6072
6059
  return;
6073
6060
  }
6074
- M[_].result = {
6075
- store: O,
6076
- attrsStore: C,
6077
- pageInfo: S,
6078
- aggregate: m,
6061
+ O[g].result = {
6062
+ store: M,
6063
+ attrsStore: T,
6064
+ pageInfo: m,
6065
+ aggregate: S,
6079
6066
  processedTxId: t["processed-tx-id"]
6080
6067
  };
6081
- }), this._cleanupPendingMutationsQueries(), this.notifyOne(_), this.notifyOneQueryOnce(_), this._cleanupPendingMutationsTimeout();
6068
+ }), this._cleanupPendingMutationsQueries(), this.notifyOne(g), this.notifyOneQueryOnce(g), this._cleanupPendingMutationsTimeout();
6082
6069
  break;
6083
6070
  }
6084
6071
  case "start-sync-ok": {
@@ -6114,65 +6101,65 @@ class wc {
6114
6101
  break;
6115
6102
  }
6116
6103
  case "refresh-ok": {
6117
- const { computations: y, attrs: g } = t, _ = t["processed-tx-id"];
6118
- g && this._setAttrs(g), this._cleanupPendingMutationsTimeout();
6119
- const S = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), _);
6120
- S !== this._pendingMutations() && this.kv.updateInPlace((C) => {
6121
- C.pendingMutations = S;
6104
+ const { computations: y, attrs: b } = t, g = t["processed-tx-id"];
6105
+ b && this._setAttrs(b), this._cleanupPendingMutationsTimeout();
6106
+ const m = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), g);
6107
+ m !== this._pendingMutations() && this.kv.updateInPlace((T) => {
6108
+ T.pendingMutations = m;
6122
6109
  });
6123
- const m = Bt(S.entries()), T = y.map((C) => {
6124
- var E, $, j, x;
6125
- const O = C["instaql-query"], M = C["instaql-result"], R = ie(O), P = hr(M), G = this.ensureAttrs(), L = tt(G, P, r, this.config.useDateObjects), { store: B, attrsStore: z } = this._applyOptimisticUpdates(L, G, m, _), ee = ($ = (E = M == null ? void 0 : M[0]) == null ? void 0 : E.data) == null ? void 0 : $["page-info"], q = (x = (j = M == null ? void 0 : M[0]) == null ? void 0 : j.data) == null ? void 0 : x.aggregate;
6110
+ const S = Bt(m.entries()), _ = y.map((T) => {
6111
+ var q, E, j, R;
6112
+ const M = T["instaql-query"], O = T["instaql-result"], F = se(M), P = hr(O), C = this.ensureAttrs(), G = tt(C, P, r, this.config.useDateObjects), { store: N, attrsStore: B } = this._applyOptimisticUpdates(G, C, S, g), z = (E = (q = O == null ? void 0 : O[0]) == null ? void 0 : q.data) == null ? void 0 : E["page-info"], ee = (R = (j = O == null ? void 0 : O[0]) == null ? void 0 : j.data) == null ? void 0 : R.aggregate;
6126
6113
  return {
6127
- q: O,
6128
- hash: R,
6129
- store: B,
6130
- attrsStore: z,
6131
- pageInfo: ee,
6132
- aggregate: q
6114
+ q: M,
6115
+ hash: F,
6116
+ store: N,
6117
+ attrsStore: B,
6118
+ pageInfo: z,
6119
+ aggregate: ee
6133
6120
  };
6134
6121
  });
6135
- T.forEach(({ hash: C, q: O, store: M, attrsStore: R, pageInfo: P, aggregate: G }) => {
6136
- this.querySubs.updateInPlace((L) => {
6137
- if (!L[C]) {
6138
- this._log.error("Missing value in querySubs", { hash: C, q: O });
6122
+ _.forEach(({ hash: T, q: M, store: O, attrsStore: F, pageInfo: P, aggregate: C }) => {
6123
+ this.querySubs.updateInPlace((G) => {
6124
+ if (!G[T]) {
6125
+ this._log.error("Missing value in querySubs", { hash: T, q: M });
6139
6126
  return;
6140
6127
  }
6141
- L[C].result = {
6142
- store: M,
6143
- attrsStore: R,
6128
+ G[T].result = {
6129
+ store: O,
6130
+ attrsStore: F,
6144
6131
  pageInfo: P,
6145
- aggregate: G,
6146
- processedTxId: _
6132
+ aggregate: C,
6133
+ processedTxId: g
6147
6134
  };
6148
6135
  });
6149
- }), this._cleanupPendingMutationsQueries(), T.forEach(({ hash: C }) => {
6150
- this.notifyOne(C);
6136
+ }), this._cleanupPendingMutationsQueries(), _.forEach(({ hash: T }) => {
6137
+ this.notifyOne(T);
6151
6138
  });
6152
6139
  break;
6153
6140
  }
6154
6141
  case "transact-ok": {
6155
- const { "client-event-id": y, "tx-id": g } = t;
6142
+ const { "client-event-id": y, "tx-id": b } = t;
6156
6143
  this._inFlightMutationEventIds.delete(y);
6157
- const S = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations()).get(y);
6158
- if (!S)
6144
+ const m = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations()).get(y);
6145
+ if (!m)
6159
6146
  break;
6160
- this._updatePendingMutations((T) => {
6161
- T.set(y, {
6162
- ...T.get(y),
6163
- "tx-id": g,
6147
+ this._updatePendingMutations((_) => {
6148
+ _.set(y, {
6149
+ ..._.get(y),
6150
+ "tx-id": b,
6164
6151
  confirmed: Date.now()
6165
6152
  });
6166
6153
  });
6167
- const m = [];
6168
- for (const T of S["tx-steps"])
6169
- if (T[0] === "add-attr") {
6170
- const C = T[1];
6171
- m.push(C);
6154
+ const S = [];
6155
+ for (const _ of m["tx-steps"])
6156
+ if (_[0] === "add-attr") {
6157
+ const T = _[1];
6158
+ S.push(T);
6172
6159
  }
6173
- if (m.length) {
6174
- const T = Object.values(this.ensureAttrs().attrs);
6175
- this._setAttrs([...T, ...m]);
6160
+ if (S.length) {
6161
+ const _ = Object.values(this.ensureAttrs().attrs);
6162
+ this._setAttrs([..._, ...S]);
6176
6163
  }
6177
6164
  this._finishTransaction("synced", y), this._cleanupPendingMutationsTimeout();
6178
6165
  break;
@@ -6188,8 +6175,8 @@ class wc {
6188
6175
  break;
6189
6176
  }
6190
6177
  case "server-broadcast": {
6191
- const y = t["room-id"], g = t.topic;
6192
- this._trySetRoomConnected(y, !0), this._notifyBroadcastSubs(y, g, t);
6178
+ const y = t["room-id"], b = t.topic;
6179
+ this._trySetRoomConnected(y, !0), this._notifyBroadcastSubs(y, b, t);
6193
6180
  break;
6194
6181
  }
6195
6182
  case "join-room-ok": {
@@ -6206,21 +6193,9 @@ class wc {
6206
6193
  this._trySetRoomConnected(y, !1);
6207
6194
  break;
6208
6195
  }
6209
- case "app-status-changed": {
6210
- const y = this._appStatusState.status;
6211
- if (this._setAppStatus(t.status), t.status === "disabled" && y !== "disabled") {
6212
- const g = {
6213
- message: "This app is currently disabled.",
6214
- hint: { status: "disabled" }
6215
- };
6216
- Object.keys(this.queryCbs).forEach((_) => this.notifyQueryError(_, g));
6217
- }
6218
- y === "disabled" && t.status !== "disabled" && this._startSocket();
6219
- break;
6220
- }
6221
6196
  case "join-room-error":
6222
- const h = t["room-id"], b = this._rooms[h];
6223
- b && (b.error = t.error), this._notifyPresenceSubs(h);
6197
+ const f = t["room-id"], h = this._rooms[f];
6198
+ h && (h.error = t.error), this._notifyPresenceSubs(f);
6224
6199
  break;
6225
6200
  case "error":
6226
6201
  this._handleReceiveError(t);
@@ -6263,7 +6238,7 @@ class wc {
6263
6238
  }
6264
6239
  }
6265
6240
  _handleReceiveError(e) {
6266
- var a, c, u, l, f, h, b, y;
6241
+ var a, c, u, l, f, h, y, b;
6267
6242
  this._log.info("error", e);
6268
6243
  const t = e["client-event-id"];
6269
6244
  this._inFlightMutationEventIds.delete(t);
@@ -6271,27 +6246,27 @@ class wc {
6271
6246
  message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa."
6272
6247
  };
6273
6248
  if (e.hint && (s.hint = e.hint), e["trace-id"] || (a = e["original-event"]) != null && a["trace-id"]) {
6274
- const _ = [e["trace-id"], (c = e["original-event"]) == null ? void 0 : c["trace-id"]].filter(Boolean).join(",");
6275
- s.traceId = _;
6249
+ const m = [e["trace-id"], (c = e["original-event"]) == null ? void 0 : c["trace-id"]].filter(Boolean).join(",");
6250
+ s.traceId = m;
6276
6251
  }
6277
6252
  if (r) {
6278
6253
  this._handleMutationError("error", t, s);
6279
6254
  return;
6280
6255
  }
6281
6256
  if ((u = e["original-event"]) != null && u.hasOwnProperty("q") && ((l = e["original-event"]) == null ? void 0 : l.op) === "add-query") {
6282
- const g = (f = e["original-event"]) == null ? void 0 : f.q, _ = ie(g);
6283
- this.notifyQueryError(ie(g), s), this.notifyQueryOnceError(g, _, t, s);
6257
+ const g = (f = e["original-event"]) == null ? void 0 : f.q, m = se(g);
6258
+ this.notifyQueryError(se(g), s), this.notifyQueryOnceError(g, m, t, s);
6284
6259
  return;
6285
6260
  }
6286
6261
  if (((h = e["original-event"]) == null ? void 0 : h.op) === "init") {
6287
- if (e.type === "record-not-found" && ((b = e.hint) == null ? void 0 : b["record-type"]) === "app-user") {
6262
+ if (e.type === "record-not-found" && ((y = e.hint) == null ? void 0 : y["record-type"]) === "app-user") {
6288
6263
  this.changeCurrentUser(null);
6289
6264
  return;
6290
6265
  }
6291
- this._setStatus(Se.ERRORED, s), this.notifyAll();
6266
+ this._setStatus(Te.ERRORED, s), this.notifyAll();
6292
6267
  return;
6293
6268
  }
6294
- switch ((y = e["original-event"]) == null ? void 0 : y.op) {
6269
+ switch ((b = e["original-event"]) == null ? void 0 : b.op) {
6295
6270
  case "resync-table": {
6296
6271
  this._syncTable.onResyncError(e);
6297
6272
  return;
@@ -6318,7 +6293,7 @@ class wc {
6318
6293
  i && (i.dfd.reject(s), this._completeQueryOnce(e, t, i.dfd));
6319
6294
  }
6320
6295
  _setAttrs(e) {
6321
- this.attrs = new Me(e.reduce((t, r) => (t[r.id] = r, t), {}), this._linkIndex), this.notifyAttrsSubs();
6296
+ this.attrs = new Re(e.reduce((t, r) => (t[r.id] = r, t), {}), this._linkIndex), this.notifyAttrsSubs();
6322
6297
  }
6323
6298
  _startQuerySub(e, t) {
6324
6299
  const r = J();
@@ -6363,7 +6338,7 @@ class wc {
6363
6338
  */
6364
6339
  subscribeQuery(e, t, r) {
6365
6340
  this.config.disableValidation || br(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
6366
- const s = ie(e), i = this.getPreviousResult(e);
6341
+ const s = se(e), i = this.getPreviousResult(e);
6367
6342
  return i && t(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: t }), this._startQuerySub(e, s), () => {
6368
6343
  this._unsubQuery(e, s, t);
6369
6344
  };
@@ -6375,7 +6350,7 @@ class wc {
6375
6350
  return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
6376
6351
  if (!this.querySubs)
6377
6352
  return r.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), r.promise;
6378
- const s = ie(e), i = this._startQuerySub(e, s);
6353
+ const s = se(e), i = this._startQuerySub(e, s);
6379
6354
  return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")), ac), r.promise;
6380
6355
  }
6381
6356
  _completeQueryOnce(e, t, r) {
@@ -6414,21 +6389,21 @@ class wc {
6414
6389
  if (!t)
6415
6390
  return /* @__PURE__ */ new Map();
6416
6391
  const s = (l) => {
6417
- const [f, h, b] = l["forward-identity"];
6418
- return ne(e, h, b);
6392
+ const [f, h, y] = l["forward-identity"];
6393
+ return ne(e, h, y);
6419
6394
  }, i = (l) => {
6420
- const [f, h, b] = l["forward-identity"];
6421
- return De(e, h, b);
6395
+ const [f, h, y] = l["forward-identity"];
6396
+ return De(e, h, y);
6422
6397
  }, o = { attrIdMap: {}, refSwapAttrIds: /* @__PURE__ */ new Set() };
6423
6398
  let a = !1;
6424
6399
  const c = (l, f) => {
6425
6400
  const h = [];
6426
- for (const b of l) {
6427
- const [y] = b;
6428
- if (y === "add-attr") {
6429
- const [_, S] = b, m = s(S);
6430
- if (m && S.id !== m.id) {
6431
- o.attrIdMap[S.id] = m.id, a = !0;
6401
+ for (const y of l) {
6402
+ const [b] = y;
6403
+ if (b === "add-attr") {
6404
+ const [m, S] = y, _ = s(S);
6405
+ if (_ && S.id !== _.id) {
6406
+ o.attrIdMap[S.id] = _.id, a = !0;
6432
6407
  continue;
6433
6408
  }
6434
6409
  if (S["value-type"] === "ref") {
@@ -6439,11 +6414,11 @@ class wc {
6439
6414
  }
6440
6415
  }
6441
6416
  }
6442
- if (r && f && r >= f && y === "add-attr" || y === "update-attr" || y === "delete-attr") {
6417
+ if (r && f && r >= f && b === "add-attr" || b === "update-attr" || b === "delete-attr") {
6443
6418
  a = !0;
6444
6419
  continue;
6445
6420
  }
6446
- const g = a ? Bo(o, b) : b;
6421
+ const g = a ? Bo(o, y) : y;
6447
6422
  h.push(g);
6448
6423
  }
6449
6424
  return a ? h : l;
@@ -6474,13 +6449,13 @@ class wc {
6474
6449
  r.push(u);
6475
6450
  }
6476
6451
  if (!t.size && !r.length)
6477
- return this.attrs || new Me({}, this._linkIndex);
6452
+ return this.attrs || new Re({}, this._linkIndex);
6478
6453
  const s = { ...((o = this.attrs) == null ? void 0 : o.attrs) || {} };
6479
6454
  for (const a of r)
6480
6455
  s[a.id] = a;
6481
6456
  for (const a of t)
6482
6457
  delete s[a];
6483
- return new Me(s, this._linkIndex);
6458
+ return new Re(s, this._linkIndex);
6484
6459
  }
6485
6460
  /** Runs instaql on a query and a store */
6486
6461
  dataForQuery(e, t = !0) {
@@ -6496,12 +6471,12 @@ class wc {
6496
6471
  if (l && s === l.querySubVersion && o === l.pendingMutationsVersion)
6497
6472
  return l;
6498
6473
  let f = u.store, h = u.attrsStore;
6499
- const { pageInfo: b, aggregate: y, processedTxId: g } = u, _ = this._rewriteMutationsSorted(h, a);
6474
+ const { pageInfo: y, aggregate: b, processedTxId: g } = u, m = this._rewriteMutationsSorted(h, a);
6500
6475
  if (t) {
6501
- const m = this._applyOptimisticUpdates(f, h, _, g);
6502
- f = m.store, h = m.attrsStore;
6476
+ const _ = this._applyOptimisticUpdates(f, h, m, g);
6477
+ f = _.store, h = _.attrsStore;
6503
6478
  }
6504
- return { data: is({ store: f, attrsStore: h, pageInfo: b, aggregate: y }, c), querySubVersion: s, pendingMutationsVersion: o };
6479
+ return { data: is({ store: f, attrsStore: h, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
6505
6480
  }
6506
6481
  _applyOptimisticUpdates(e, t, r, s) {
6507
6482
  for (const [i, o] of r)
@@ -6538,7 +6513,7 @@ class wc {
6538
6513
  });
6539
6514
  return;
6540
6515
  }
6541
- if (this.status !== Se.AUTHENTICATED) {
6516
+ if (this.status !== Te.AUTHENTICATED) {
6542
6517
  this._finishTransaction("enqueued", e);
6543
6518
  return;
6544
6519
  }
@@ -6596,7 +6571,7 @@ class wc {
6596
6571
  });
6597
6572
  }
6598
6573
  _trySendAuthed(...e) {
6599
- this.status === Se.AUTHENTICATED && this._trySend(...e);
6574
+ this.status === Te.AUTHENTICATED && this._trySend(...e);
6600
6575
  }
6601
6576
  _trySend(e, t, r) {
6602
6577
  if (this._transport.isOpen()) {
@@ -6696,18 +6671,18 @@ class wc {
6696
6671
  this._replaceUrlAfterOAuth();
6697
6672
  try {
6698
6673
  let u;
6699
- const l = await this.kv.waitForKeyToLoad(_t);
6700
- s && l && (u = l[s]), l && this.kv.updateInPlace((y) => {
6701
- delete y[_t];
6674
+ const l = await this.kv.waitForKeyToLoad(gt);
6675
+ s && l && (u = l[s]), l && this.kv.updateInPlace((b) => {
6676
+ delete b[gt];
6702
6677
  });
6703
- const f = await this._getCurrentUser(), h = (f == null ? void 0 : f.type) === "guest", { user: b } = await lr({
6678
+ const f = await this._getCurrentUser(), h = (f == null ? void 0 : f.type) === "guest", { user: y } = await lr({
6704
6679
  apiURI: this.config.apiURI,
6705
6680
  appId: this.config.appId,
6706
6681
  code: r,
6707
6682
  refreshToken: h ? f.refresh_token : void 0,
6708
6683
  extraFields: u
6709
6684
  });
6710
- return this.setCurrentUser(b), null;
6685
+ return this.setCurrentUser(y), null;
6711
6686
  } catch (u) {
6712
6687
  return ((i = u == null ? void 0 : u.body) == null ? void 0 : i.type) === "record-not-found" && ((a = (o = u == null ? void 0 : u.body) == null ? void 0 : o.hint) == null ? void 0 : a["record-type"]) === "app-oauth-code" && await this._hasCurrentUser() ? null : { error: { message: ((c = u == null ? void 0 : u.body) == null ? void 0 : c.message) || "Error logging in." } };
6713
6688
  }
@@ -6726,7 +6701,7 @@ class wc {
6726
6701
  t.isLoading || e(this._currentUserCached);
6727
6702
  let r = !1;
6728
6703
  return this.getCurrentUser().then((s) => {
6729
- r || vt(s, t) || e(s);
6704
+ r || St(s, t) || e(s);
6730
6705
  }), () => {
6731
6706
  r = !0, this.authCbs = this.authCbs.filter((s) => s !== e);
6732
6707
  };
@@ -6734,7 +6709,7 @@ class wc {
6734
6709
  async getAuth() {
6735
6710
  const { user: e, error: t } = await this.getCurrentUser();
6736
6711
  if (t)
6737
- throw new re("Could not get current user: " + t.message);
6712
+ throw new ie("Could not get current user: " + t.message);
6738
6713
  return e ?? null;
6739
6714
  }
6740
6715
  subscribeConnectionStatus(e) {
@@ -6742,21 +6717,6 @@ class wc {
6742
6717
  this.connectionStatusCbs = this.connectionStatusCbs.filter((t) => t !== e);
6743
6718
  };
6744
6719
  }
6745
- /**
6746
- * @param {'active' | 'read-only' | 'disabled' | undefined} status
6747
- */
6748
- _setAppStatus(e) {
6749
- !e || e === this._appStatusState.status || (this._appStatusState = {
6750
- isLoading: !1,
6751
- isReadOnly: e !== "active",
6752
- status: e
6753
- }, this.notifyAppStatusSubs(this._appStatusState));
6754
- }
6755
- subscribeAppStatus(e) {
6756
- return this.appStatusCbs.push(e), e(this._appStatusState), () => {
6757
- this.appStatusCbs = this.appStatusCbs.filter((t) => t !== e);
6758
- };
6759
- }
6760
6720
  subscribeAttrs(e) {
6761
6721
  return this.attrsCbs.push(e), this.attrs && e(this.attrs.attrs), () => {
6762
6722
  this.attrsCbs = this.attrsCbs.filter((t) => t !== e);
@@ -6777,9 +6737,6 @@ class wc {
6777
6737
  notifyConnectionStatusSubs(e) {
6778
6738
  this.connectionStatusCbs.forEach((t) => t(e));
6779
6739
  }
6780
- notifyAppStatusSubs(e) {
6781
- this.appStatusCbs.forEach((t) => t(e));
6782
- }
6783
6740
  async setCurrentUser(e) {
6784
6741
  this.kv.updateInPlace((t) => {
6785
6742
  t[Fe] = e;
@@ -6828,7 +6785,7 @@ class wc {
6828
6785
  async changeCurrentUser(e) {
6829
6786
  var r;
6830
6787
  const { user: t } = await this.getCurrentUser();
6831
- if (!vt(t, e)) {
6788
+ if (!St(t, e)) {
6832
6789
  this._frameworkClient = null, await this.setCurrentUser(e), await this.updateUser(e);
6833
6790
  try {
6834
6791
  await this.kv.flush(), (r = this._broadcastChannel) == null || r.postMessage({ type: "auth" });
@@ -6840,7 +6797,7 @@ class wc {
6840
6797
  async setupUserSyncTimer() {
6841
6798
  if (this.config.firstPartyPath)
6842
6799
  try {
6843
- const e = await this.kv.waitForKeyToLoad(Tr), t = e ? new Date(e).getTime() : 0;
6800
+ const e = await this.kv.waitForKeyToLoad(Sr), t = e ? new Date(e).getTime() : 0;
6844
6801
  if (!(!Number.isFinite(t) || Date.now() - t >= fc))
6845
6802
  return;
6846
6803
  const { user: s } = await this.getCurrentUser();
@@ -6869,7 +6826,7 @@ class wc {
6869
6826
  this._log.error("Error syncing user with external endpoint", t);
6870
6827
  }
6871
6828
  this.kv.updateInPlace((t) => {
6872
- t[Tr] = (/* @__PURE__ */ new Date()).toISOString();
6829
+ t[Sr] = (/* @__PURE__ */ new Date()).toISOString();
6873
6830
  });
6874
6831
  }
6875
6832
  }
@@ -6936,7 +6893,7 @@ class wc {
6936
6893
  this._log.info("[auth-invalidate] skipped invalidateToken");
6937
6894
  return;
6938
6895
  }
6939
- Ra({
6896
+ Ma({
6940
6897
  apiURI: this.config.apiURI,
6941
6898
  appId: this.config.appId,
6942
6899
  refreshToken: r
@@ -6964,8 +6921,8 @@ class wc {
6964
6921
  if (r) {
6965
6922
  const a = `${Math.random().toString(36).slice(2)}`;
6966
6923
  this.kv.updateInPlace((c) => {
6967
- const u = c[_t] || {};
6968
- u[a] = r, c[_t] = u;
6924
+ const u = c[gt] || {};
6925
+ u[a] = r, c[gt] = u;
6969
6926
  }), o = `${t}${t.includes("?") ? "&" : "?"}${Qt}=${a}`;
6970
6927
  }
6971
6928
  return `${s}/runtime/oauth/start?app_id=${i}&client_name=${e}&redirect_uri=${encodeURIComponent(o)}`;
@@ -7169,8 +7126,8 @@ class wc {
7169
7126
  _notifyBroadcastSubs(e, t, r) {
7170
7127
  var s, i, o;
7171
7128
  (o = (i = (s = this._broadcastSubs) == null ? void 0 : s[e]) == null ? void 0 : i[t]) == null || o.forEach((a) => {
7172
- var l, f, h, b, y, g;
7173
- const c = (l = r.data) == null ? void 0 : l.data, u = r.data["peer-id"] === this._sessionId ? (h = (f = this._presence[e]) == null ? void 0 : f.result) == null ? void 0 : h.user : (g = (y = (b = this._presence[e]) == null ? void 0 : b.result) == null ? void 0 : y.peers) == null ? void 0 : g[r.data["peer-id"]];
7129
+ var l, f, h, y, b, g;
7130
+ const c = (l = r.data) == null ? void 0 : l.data, u = r.data["peer-id"] === this._sessionId ? (h = (f = this._presence[e]) == null ? void 0 : f.result) == null ? void 0 : h.user : (g = (b = (y = this._presence[e]) == null ? void 0 : y.result) == null ? void 0 : b.peers) == null ? void 0 : g[r.data["peer-id"]];
7174
7131
  return a(c, u);
7175
7132
  });
7176
7133
  }
@@ -7179,7 +7136,7 @@ class wc {
7179
7136
  async uploadFile(e, t, r) {
7180
7137
  var o;
7181
7138
  const s = await this.getCurrentUser(), i = (o = s == null ? void 0 : s.user) == null ? void 0 : o.refresh_token;
7182
- return Ma({
7139
+ return Ra({
7183
7140
  ...r,
7184
7141
  apiURI: this.config.apiURI,
7185
7142
  appId: this.config.appId,
@@ -7221,10 +7178,10 @@ class wc {
7221
7178
  });
7222
7179
  }
7223
7180
  }
7224
- let mt;
7225
- function Sc(n, e) {
7226
- mt == null || mt.dispose();
7227
- const t = kc(e), r = Ac(e, a), s = vc(Tc(n));
7181
+ let _t;
7182
+ function Tc(n, e) {
7183
+ _t == null || _t.dispose();
7184
+ const t = kc(e), r = Ac(e, a), s = vc(Sc(n));
7228
7185
  function i(l) {
7229
7186
  var f;
7230
7187
  l.source === s.element.contentWindow && ((f = l.data) == null ? void 0 : f.type) === "close" && t.isVisible() && a();
@@ -7240,13 +7197,13 @@ function Sc(n, e) {
7240
7197
  t.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", i);
7241
7198
  }
7242
7199
  function u() {
7243
- document.body.appendChild(t.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", i), mt = {
7200
+ document.body.appendChild(t.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", i), _t = {
7244
7201
  dispose: c
7245
7202
  };
7246
7203
  }
7247
7204
  return u();
7248
7205
  }
7249
- function Tc(n) {
7206
+ function Sc(n) {
7250
7207
  return `${Cn || fs ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${n}`;
7251
7208
  }
7252
7209
  function vc(n) {
@@ -7348,7 +7305,7 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7348
7305
  };
7349
7306
  }, ws = (n) => n && Object.keys(n).length > 0 ? n : {
7350
7307
  serverCreatedAt: "asc"
7351
- }, Rc = (n, e) => {
7308
+ }, Mc = (n, e) => {
7352
7309
  const t = [
7353
7310
  ...Array.from(e.values()).slice().reverse(),
7354
7311
  ...Array.from(n.values())
@@ -7357,36 +7314,36 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7357
7314
  ...Array.from(n.values()).flatMap((s) => s.data)
7358
7315
  ];
7359
7316
  return { chunks: t, data: r };
7360
- }, Gt = ["bootstrap", "bootstrap", "bootstrap", 1], Mc = (n, e, t, r) => {
7317
+ }, Gt = ["bootstrap", "bootstrap", "bootstrap", 1], Rc = (n, e, t, r) => {
7361
7318
  var B, z, ee, q;
7362
- const { entityName: s, entityQuery: i } = Ss(e), o = ((B = i.$) == null ? void 0 : B.limit) || 10, a = s, c = ws((z = i.$) == null ? void 0 : z.order), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
7363
- let h = !1, b = !0, y = null, g = null;
7364
- const _ = (E) => {
7319
+ const { entityName: s, entityQuery: i } = Ts(e), o = ((B = i.$) == null ? void 0 : B.limit) || 10, a = s, c = ws((z = i.$) == null ? void 0 : z.order), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
7320
+ let h = !1, y = !0, b = null, g = null;
7321
+ const m = (E) => {
7365
7322
  t({ error: E, data: void 0, canLoadNextPage: !1 });
7366
7323
  }, S = () => {
7367
- if (!b)
7324
+ if (!y)
7368
7325
  return;
7369
- const { chunks: E, data: $ } = Rc(u, l);
7326
+ const { chunks: E, data: j } = Mc(u, l);
7370
7327
  t({
7371
- data: { [a]: $ },
7328
+ data: { [a]: j },
7372
7329
  // @ts-expect-error hidden debug variable
7373
7330
  chunks: E,
7374
7331
  canLoadNextPage: Pc(u)
7375
7332
  });
7376
- }, m = (E, $) => {
7377
- u.set(rt(E, $.afterInclusive), $), S();
7378
- }, T = (E, $) => {
7379
- l.set(rt(E), $), P(), S();
7380
- }, C = (E, $) => {
7333
+ }, _ = (E, j) => {
7334
+ u.set(rt(E, j.afterInclusive), j), S();
7335
+ }, T = (E, j) => {
7336
+ l.set(rt(E), j), C(), S();
7337
+ }, M = (E, j) => {
7381
7338
  var A, k;
7382
- const { cursor: j } = Ar(E), x = f.get(Ne("reverse", j));
7383
- x == null || x();
7384
- const N = n.subscribeQuery({
7339
+ const { cursor: R } = Ar(E), U = f.get(Ne("reverse", R));
7340
+ U == null || U();
7341
+ const L = n.subscribeQuery({
7385
7342
  [a]: {
7386
7343
  ...i,
7387
7344
  $: {
7388
- after: j,
7389
- before: $.endCursor,
7345
+ after: R,
7346
+ before: j.endCursor,
7390
7347
  beforeInclusive: !0,
7391
7348
  where: (A = i.$) == null ? void 0 : A.where,
7392
7349
  fields: (k = i.$) == null ? void 0 : k.fields,
@@ -7395,33 +7352,33 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7395
7352
  }
7396
7353
  }, (K) => {
7397
7354
  if (K.error)
7398
- return _(K.error);
7355
+ return m(K.error);
7399
7356
  const H = K.data[a], Y = K.pageInfo[a];
7400
- Ze(H && Y, "Expected query subscription to contain rows and pageInfo"), T(j, {
7357
+ Ze(H && Y, "Expected query subscription to contain rows and pageInfo"), T(R, {
7401
7358
  data: H,
7402
7359
  status: "frozen",
7403
7360
  hasMore: Y.hasNextPage,
7404
7361
  endCursor: Y.endCursor
7405
7362
  });
7406
7363
  }, r);
7407
- f.set(Ne("reverse", j), N);
7364
+ f.set(Ne("reverse", R), L);
7408
7365
  }, O = (E) => {
7409
- var j, x;
7410
- const $ = n.subscribeQuery({
7366
+ var R, U;
7367
+ const j = n.subscribeQuery({
7411
7368
  [a]: {
7412
7369
  ...i,
7413
7370
  $: {
7414
7371
  limit: o,
7415
7372
  after: E,
7416
- where: (j = i.$) == null ? void 0 : j.where,
7417
- fields: (x = i.$) == null ? void 0 : x.fields,
7373
+ where: (R = i.$) == null ? void 0 : R.where,
7374
+ fields: (U = i.$) == null ? void 0 : U.fields,
7418
7375
  order: Or(c)
7419
7376
  }
7420
7377
  }
7421
- }, (N) => {
7422
- if (N.error)
7423
- return _(N.error);
7424
- const A = N.data[a], k = N.pageInfo[a];
7378
+ }, (L) => {
7379
+ if (L.error)
7380
+ return m(L.error);
7381
+ const A = L.data[a], k = L.pageInfo[a];
7425
7382
  Ze(A && k, "Expected rows and pageInfo"), T(E, {
7426
7383
  data: A,
7427
7384
  status: "bootstrapping",
@@ -7429,48 +7386,48 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7429
7386
  endCursor: k.endCursor
7430
7387
  });
7431
7388
  }, r);
7432
- f.set(Ne("reverse", E), $);
7433
- }, M = (E, $ = !1) => {
7434
- var x, N;
7435
- const j = n.subscribeQuery({
7389
+ f.set(Ne("reverse", E), j);
7390
+ }, F = (E, j = !1) => {
7391
+ var U, L;
7392
+ const R = n.subscribeQuery({
7436
7393
  [a]: {
7437
7394
  ...i,
7438
7395
  $: {
7439
7396
  limit: o,
7440
7397
  after: E,
7441
- afterInclusive: $,
7442
- where: (x = i.$) == null ? void 0 : x.where,
7443
- fields: (N = i.$) == null ? void 0 : N.fields,
7398
+ afterInclusive: j,
7399
+ where: (U = i.$) == null ? void 0 : U.where,
7400
+ fields: (L = i.$) == null ? void 0 : L.fields,
7444
7401
  order: c
7445
7402
  }
7446
7403
  }
7447
7404
  }, (A) => {
7448
7405
  if (A.error)
7449
- return _(A.error);
7406
+ return m(A.error);
7450
7407
  const k = A.data[a], K = A.pageInfo[a];
7451
- Ze(k && K, "Page info and rows"), m(E, {
7408
+ Ze(k && K, "Page info and rows"), _(E, {
7452
7409
  data: k,
7453
7410
  status: "bootstrapping",
7454
7411
  hasMore: K.hasNextPage,
7455
7412
  endCursor: K.endCursor,
7456
- afterInclusive: $
7413
+ afterInclusive: j
7457
7414
  });
7458
7415
  }, r);
7459
- f.set(Ne("forward", E, $), j);
7460
- }, R = (E, $ = !1) => {
7416
+ f.set(Ne("forward", E, j), R);
7417
+ }, P = (E, j = !1) => {
7461
7418
  var k, K;
7462
- const j = rt(E, $), x = f.get(Ne("forward", E, $));
7463
- x == null || x();
7464
- const N = u.get(j);
7465
- if (!(N != null && N.endCursor))
7419
+ const R = rt(E, j), U = f.get(Ne("forward", E, j));
7420
+ U == null || U();
7421
+ const L = u.get(R);
7422
+ if (!(L != null && L.endCursor))
7466
7423
  return;
7467
7424
  const A = n.subscribeQuery({
7468
7425
  [a]: {
7469
7426
  ...i,
7470
7427
  $: {
7471
7428
  after: E,
7472
- afterInclusive: N.afterInclusive,
7473
- before: N.endCursor,
7429
+ afterInclusive: L.afterInclusive,
7430
+ before: L.endCursor,
7474
7431
  beforeInclusive: !0,
7475
7432
  where: (k = i.$) == null ? void 0 : k.where,
7476
7433
  fields: (K = i.$) == null ? void 0 : K.fields,
@@ -7479,35 +7436,35 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7479
7436
  }
7480
7437
  }, (H) => {
7481
7438
  if (H.error)
7482
- return _(H.error);
7439
+ return m(H.error);
7483
7440
  const Y = H.data[a], oe = H.pageInfo[a];
7484
- Ze(Y && oe, "Expected rows and pageInfo"), m(E, {
7441
+ Ze(Y && oe, "Expected rows and pageInfo"), _(E, {
7485
7442
  data: Y,
7486
7443
  status: "frozen",
7487
7444
  hasMore: oe.hasNextPage,
7488
7445
  endCursor: oe.endCursor,
7489
- afterInclusive: N.afterInclusive
7446
+ afterInclusive: L.afterInclusive
7490
7447
  });
7491
7448
  }, r);
7492
- f.set(Ne("forward", E, $), A);
7493
- }, P = () => {
7449
+ f.set(Ne("forward", E, j), A);
7450
+ }, C = () => {
7494
7451
  const E = Array.from(l.entries()).at(-1);
7495
7452
  if (!E)
7496
7453
  return;
7497
- const [$, j] = E;
7498
- if (!(j != null && j.hasMore) || !Ic(j))
7454
+ const [j, R] = E;
7455
+ if (!(R != null && R.hasMore) || !Ic(R))
7499
7456
  return;
7500
- const x = `${$}:${Cc(j.endCursor)}`;
7501
- x != y && (y = x, C($, j), O(j.endCursor));
7457
+ const U = `${j}:${Cc(R.endCursor)}`;
7458
+ U != b && (b = U, M(j, R), O(R.endCursor));
7502
7459
  }, G = () => {
7503
7460
  const E = Array.from(u.entries()).at(-1);
7504
7461
  if (!E)
7505
7462
  return;
7506
- const [$, j] = E;
7507
- if (!j.endCursor)
7463
+ const [j, R] = E;
7464
+ if (!R.endCursor)
7508
7465
  return;
7509
- const { cursor: x, afterInclusive: N } = Ar($);
7510
- R(x, N), M(j.endCursor);
7466
+ const { cursor: U, afterInclusive: L } = Ar(j);
7467
+ P(U, L), F(R.endCursor);
7511
7468
  };
7512
7469
  return g = n.subscribeQuery({
7513
7470
  [a]: {
@@ -7520,32 +7477,32 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7520
7477
  }
7521
7478
  }
7522
7479
  }, async (E) => {
7523
- var N;
7480
+ var L;
7524
7481
  if (h)
7525
7482
  return;
7526
7483
  if (E.error)
7527
- return _(E.error);
7528
- const $ = E.pageInfo[a], j = (N = E == null ? void 0 : E.data) == null ? void 0 : N[a];
7529
- if (Ze(j && $, "Expected rows and pageInfo"), j.length < o) {
7530
- m(Gt, {
7531
- data: j,
7484
+ return m(E.error);
7485
+ const j = E.pageInfo[a], R = (L = E == null ? void 0 : E.data) == null ? void 0 : L[a];
7486
+ if (Ze(R && j, "Expected rows and pageInfo"), R.length < o) {
7487
+ _(Gt, {
7488
+ data: R,
7532
7489
  status: "pre-bootstrap"
7533
7490
  });
7534
7491
  return;
7535
7492
  }
7536
- const x = $.startCursor;
7537
- if (!x) {
7538
- m(Gt, {
7539
- data: j,
7493
+ const U = j.startCursor;
7494
+ if (!U) {
7495
+ _(Gt, {
7496
+ data: R,
7540
7497
  status: "pre-bootstrap"
7541
7498
  });
7542
7499
  return;
7543
7500
  }
7544
- u.delete(rt(Gt)), M(x, !0), O($.startCursor), h = !0;
7501
+ u.delete(rt(Gt)), F(U, !0), O(j.startCursor), h = !0;
7545
7502
  }, r), {
7546
7503
  unsubscribe: () => {
7547
- if (b) {
7548
- b = !1, g == null || g(), g = null;
7504
+ if (y) {
7505
+ y = !1, g == null || g(), g = null;
7549
7506
  for (const E of f.values())
7550
7507
  E == null || E();
7551
7508
  f.clear();
@@ -7561,8 +7518,8 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7561
7518
  data: void 0,
7562
7519
  error: void 0
7563
7520
  };
7564
- const { entityName: r, entityQuery: s } = Ss(e), i = ((u = s.$) == null ? void 0 : u.limit) || 10, o = ws((l = s.$) == null ? void 0 : l.order);
7565
- let a = e ? Ts({
7521
+ const { entityName: r, entityQuery: s } = Ts(e), i = ((u = s.$) == null ? void 0 : u.limit) || 10, o = ws((l = s.$) == null ? void 0 : l.order);
7522
+ let a = e ? Ss({
7566
7523
  [r]: {
7567
7524
  ...s,
7568
7525
  $: {
@@ -7583,7 +7540,7 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7583
7540
  data: (c == null ? void 0 : c.data) || void 0,
7584
7541
  error: void 0
7585
7542
  };
7586
- }, Ss = (n) => {
7543
+ }, Ts = (n) => {
7587
7544
  if (Object.keys(n).length !== 1)
7588
7545
  throw new Q("subscribeInfiniteQuery expects exactly one entity");
7589
7546
  const [t, r] = Object.entries(n)[0];
@@ -7806,7 +7763,7 @@ class Lc {
7806
7763
  this.db = e;
7807
7764
  }
7808
7765
  }
7809
- function Ts(n) {
7766
+ function Ss(n) {
7810
7767
  return JSON.parse(JSON.stringify(n));
7811
7768
  }
7812
7769
  class Fc {
@@ -7894,7 +7851,7 @@ class Fc {
7894
7851
  * });
7895
7852
  */
7896
7853
  subscribeInfiniteQuery(e, t, r) {
7897
- return Mc(this, e, t, r);
7854
+ return Rc(this, e, t, r);
7898
7855
  }
7899
7856
  /**
7900
7857
  * Listen for the logged in state. This is useful
@@ -7950,20 +7907,6 @@ class Fc {
7950
7907
  subscribeConnectionStatus(e) {
7951
7908
  return this._reactor.subscribeConnectionStatus(e);
7952
7909
  }
7953
- /**
7954
- * Observe the app's maintenance-mode state. While read-only, reads and
7955
- * live queries keep working but writes are rejected. The callback fires
7956
- * immediately with the current state and again on every change.
7957
- *
7958
- * @example
7959
- * const unsub = db.subscribeAppStatus(({ isLoading, isReadOnly }) => {
7960
- * if (isLoading) return;
7961
- * if (isReadOnly) showMaintenanceBanner();
7962
- * });
7963
- */
7964
- subscribeAppStatus(e) {
7965
- return this._reactor.subscribeAppStatus(e);
7966
- }
7967
7910
  /**
7968
7911
  * Join a room to publish and subscribe to topics and presence.
7969
7912
  *
@@ -8032,7 +7975,7 @@ function Cr(n) {
8032
7975
  const e = kr.get(n);
8033
7976
  if (e)
8034
7977
  return e;
8035
- const t = ie(n);
7978
+ const t = se(n);
8036
7979
  return kr.set(n, t), t;
8037
7980
  }
8038
7981
  function Nc(n, e) {
@@ -8062,7 +8005,7 @@ function qc(n, e) {
8062
8005
  allowedHosts: ["localhost"],
8063
8006
  ...typeof e == "object" ? e : {}
8064
8007
  };
8065
- t.allowedHosts.includes(window.location.hostname) && Sc(n, t);
8008
+ t.allowedHosts.includes(window.location.hostname) && Tc(n, t);
8066
8009
  }
8067
8010
  const Ir = {
8068
8011
  isLoading: !0,
@@ -8081,9 +8024,9 @@ function Pr(n) {
8081
8024
  }
8082
8025
  function Wc(n, e, t, r) {
8083
8026
  e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
8084
- const s = e ? Ts(e) : null, i = ie(s), o = Oe(
8027
+ const s = e ? Ss(e) : null, i = se(s), o = ke(
8085
8028
  Pr(n._reactor.getPreviousResult(s))
8086
- ), a = Oe(Ir), c = Te(
8029
+ ), a = ke(Ir), c = Ae(
8087
8030
  (l) => (o.current = Pr(
8088
8031
  n._reactor.getPreviousResult(s)
8089
8032
  ), l(), s ? n.subscribeQuery(s, (h) => {
@@ -8102,7 +8045,7 @@ function Wc(n, e, t, r) {
8102
8045
  // Build a new subscribe function if the query changes
8103
8046
  [i]
8104
8047
  );
8105
- return { state: st(
8048
+ return { state: At(
8106
8049
  c,
8107
8050
  () => o.current,
8108
8051
  () => {
@@ -8125,10 +8068,10 @@ function Vc({
8125
8068
  query: e,
8126
8069
  opts: t
8127
8070
  }) {
8128
- const r = Oe(null), s = ie(e), i = ie(t), o = Er(n, e, t), a = Oe({
8071
+ const r = ke(null), s = se(e), i = se(t), o = Er(n, e, t), a = ke({
8129
8072
  ...o,
8130
8073
  isLoading: !o.data && !o.error
8131
- }), c = Te(
8074
+ }), c = Ae(
8132
8075
  (f) => {
8133
8076
  r.current = null;
8134
8077
  const h = Er(n, e, t);
@@ -8138,24 +8081,24 @@ function Vc({
8138
8081
  }, f(), !e)
8139
8082
  return () => {
8140
8083
  };
8141
- const b = n.subscribeInfiniteQuery(
8084
+ const y = n.subscribeInfiniteQuery(
8142
8085
  e,
8143
- (y) => {
8086
+ (b) => {
8144
8087
  a.current = {
8145
- ...y,
8088
+ ...b,
8146
8089
  isLoading: !1
8147
8090
  }, f();
8148
8091
  },
8149
8092
  t
8150
8093
  );
8151
- return r.current = b, () => {
8152
- b.unsubscribe(), r.current === b && (r.current = null);
8094
+ return r.current = y, () => {
8095
+ y.unsubscribe(), r.current === y && (r.current = null);
8153
8096
  };
8154
8097
  },
8155
8098
  [s, i]
8156
8099
  );
8157
8100
  return {
8158
- ...st(
8101
+ ...At(
8159
8102
  c,
8160
8103
  () => a.current,
8161
8104
  () => zc
@@ -8167,7 +8110,7 @@ function Vc({
8167
8110
  };
8168
8111
  }
8169
8112
  function Qc() {
8170
- const n = Oe(null);
8113
+ const n = ke(null);
8171
8114
  je(() => {
8172
8115
  t();
8173
8116
  }, []);
@@ -8181,7 +8124,7 @@ function Qc() {
8181
8124
  }
8182
8125
  const Bc = 1e3;
8183
8126
  function Gc(n, e, t) {
8184
- const r = Oe(t);
8127
+ const r = ke(t);
8185
8128
  r.current = t, je(() => n.core._reactor.subscribeTopic(
8186
8129
  n.type,
8187
8130
  n.id,
@@ -8192,7 +8135,7 @@ function Gc(n, e, t) {
8192
8135
  ), [n.id, e]);
8193
8136
  }
8194
8137
  function Hc(n, e) {
8195
- return je(() => n.core._reactor.joinRoom(n.type, n.id), [n.id]), Te(
8138
+ return je(() => n.core._reactor.joinRoom(n.type, n.id), [n.id]), Ae(
8196
8139
  (r) => {
8197
8140
  n.core._reactor.publishTopic({
8198
8141
  roomType: n.type,
@@ -8206,7 +8149,7 @@ function Hc(n, e) {
8206
8149
  }
8207
8150
  function Jc(n, e = {}) {
8208
8151
  var o, a;
8209
- const [t, r] = Mr(() => n.core._reactor.getPresence(n.type, n.id, e) ?? {
8152
+ const [t, r] = Rr(() => n.core._reactor.getPresence(n.type, n.id, e) ?? {
8210
8153
  peers: {},
8211
8154
  isLoading: !0
8212
8155
  });
@@ -8218,7 +8161,7 @@ function Jc(n, e = {}) {
8218
8161
  r(u);
8219
8162
  }
8220
8163
  ), [n.id, e.user, (o = e.peers) == null ? void 0 : o.join(), (a = e.keys) == null ? void 0 : a.join()]);
8221
- const s = Te(
8164
+ const s = Ae(
8222
8165
  (c) => {
8223
8166
  n.core._reactor.publishPresence(n.type, n.id, c);
8224
8167
  },
@@ -8246,7 +8189,7 @@ function Zc(n, e, t = {}) {
8246
8189
  return t != null && t.writeOnly ? [] : Object.values((l == null ? void 0 : l.peers) ?? {}).filter(
8247
8190
  (f) => f[e] === !0
8248
8191
  );
8249
- }, [t == null ? void 0 : t.writeOnly, s]), o = Te(
8192
+ }, [t == null ? void 0 : t.writeOnly, s]), o = Ae(
8250
8193
  (l) => {
8251
8194
  n.core._reactor.publishPresence(n.type, n.id, {
8252
8195
  [e]: l
@@ -8257,13 +8200,13 @@ function Zc(n, e, t = {}) {
8257
8200
  }));
8258
8201
  },
8259
8202
  [n.type, n.id, e, t == null ? void 0 : t.timeout, r]
8260
- ), a = Te(
8203
+ ), a = Ae(
8261
8204
  (l) => {
8262
8205
  const h = !((t == null ? void 0 : t.stopOnEnter) && l.key === "Enter");
8263
8206
  o(h);
8264
8207
  },
8265
8208
  [t.stopOnEnter, o]
8266
- ), c = Te(() => {
8209
+ ), c = Ae(() => {
8267
8210
  o(!1);
8268
8211
  }, [o]), u = Jt(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
8269
8212
  return {
@@ -8370,9 +8313,6 @@ const eu = {
8370
8313
  isLoading: !0,
8371
8314
  user: void 0,
8372
8315
  error: void 0
8373
- }, tu = {
8374
- isLoading: !0,
8375
- isReadOnly: void 0
8376
8316
  };
8377
8317
  class Ht {
8378
8318
  constructor(e, t) {
@@ -8405,7 +8345,7 @@ class Ht {
8405
8345
  * console.log('Device ID:', deviceId)
8406
8346
  */
8407
8347
  p(this, "useLocalId", (e) => {
8408
- const [t, r] = Mr(null);
8348
+ const [t, r] = Rr(null);
8409
8349
  return je(() => {
8410
8350
  (async () => {
8411
8351
  const i = await this.getLocalId(e);
@@ -8520,7 +8460,7 @@ class Ht {
8520
8460
  p(this, "useUser", () => {
8521
8461
  const { user: e } = this.useAuth();
8522
8462
  if (!e)
8523
- throw new re(
8463
+ throw new ie(
8524
8464
  "useUser must be used within an auth-protected route"
8525
8465
  );
8526
8466
  return e;
@@ -8548,40 +8488,18 @@ class Ht {
8548
8488
  * }
8549
8489
  */
8550
8490
  p(this, "useConnectionStatus", () => {
8551
- const e = Oe(
8491
+ const e = ke(
8552
8492
  this.core._reactor.status
8553
- ), t = Te((s) => this.core.subscribeConnectionStatus((o) => {
8493
+ ), t = Ae((s) => this.core.subscribeConnectionStatus((o) => {
8554
8494
  o !== e.current && (e.current = o, s());
8555
8495
  }), []);
8556
- return st(
8496
+ return At(
8557
8497
  t,
8558
8498
  () => e.current,
8559
8499
  // For SSR, always return 'connecting' as the initial state
8560
8500
  () => "connecting"
8561
8501
  );
8562
8502
  });
8563
- /**
8564
- * Observe the app's maintenance-mode state. While read-only, reads and
8565
- * live queries keep working but writes are rejected.
8566
- *
8567
- * @example
8568
- * function App() {
8569
- * const { isLoading, isReadOnly } = db.useAppStatus()
8570
- * if (isLoading) return null
8571
- * if (isReadOnly) return <MaintenanceBanner />
8572
- * // ...
8573
- * }
8574
- */
8575
- p(this, "useAppStatus", () => {
8576
- const e = Oe(this.core._reactor._appStatusState), t = Te((s) => this.core.subscribeAppStatus((i) => {
8577
- (i.isLoading !== e.current.isLoading || i.isReadOnly !== e.current.isReadOnly) && (e.current = i, s());
8578
- }), []);
8579
- return st(
8580
- t,
8581
- () => e.current,
8582
- () => tu
8583
- );
8584
- });
8585
8503
  /**
8586
8504
  * Use this for one-off queries.
8587
8505
  * Returns local data if available, otherwise fetches from the server.
@@ -8636,7 +8554,7 @@ class Ht {
8636
8554
  */
8637
8555
  p(this, "SignedIn", ({ children: e }) => {
8638
8556
  const t = this.useAuth();
8639
- return t.isLoading || t.error || !t.user ? null : /* @__PURE__ */ pt.jsx(pt.Fragment, { children: e });
8557
+ return t.isLoading || t.error || !t.user ? null : /* @__PURE__ */ ht.jsx(ht.Fragment, { children: e });
8640
8558
  });
8641
8559
  /**
8642
8560
  * Only render children if the user is signed out.
@@ -8650,7 +8568,7 @@ class Ht {
8650
8568
  */
8651
8569
  p(this, "SignedOut", ({ children: e }) => {
8652
8570
  const t = this.useAuth();
8653
- return t.isLoading || t.error || t.user ? null : /* @__PURE__ */ pt.jsx(pt.Fragment, { children: e });
8571
+ return t.isLoading || t.error || t.user ? null : /* @__PURE__ */ ht.jsx(ht.Fragment, { children: e });
8654
8572
  });
8655
8573
  this.core = Kc(
8656
8574
  e,
@@ -8679,12 +8597,12 @@ class Ht {
8679
8597
  return new Xc(this.core, e, t);
8680
8598
  }
8681
8599
  _useAuth() {
8682
- const e = Oe(
8600
+ const e = ke(
8683
8601
  this.core._reactor._currentUserCached
8684
- ), t = Te((s) => this.core.subscribeAuth((o) => {
8602
+ ), t = Ae((s) => this.core.subscribeAuth((o) => {
8685
8603
  e.current = { isLoading: !1, ...o }, s();
8686
8604
  }), []);
8687
- return st(
8605
+ return At(
8688
8606
  t,
8689
8607
  () => e.current,
8690
8608
  () => eu