@instantdb/react-common 0.22.105-experimental.tx-id-to-lsn.21084598140.1 → 0.22.106-experimental.drewh-typesafe-lookup-syntax.21150920929.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  var Ms = Object.defineProperty;
2
2
  var js = (t, e, n) => e in t ? Ms(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
3
  var p = (t, e, n) => js(t, typeof e != "symbol" ? e + "" : e, n);
4
- import yr, { useRef as Ke, useCallback as le, useSyncExternalStore as It, useEffect as be, useMemo as Mt, useState as br } from "react";
5
- var jt = { exports: {} }, Me = {};
4
+ import br, { useRef as Ke, useCallback as le, useSyncExternalStore as Mt, useEffect as be, useMemo as jt, useState as _r } from "react";
5
+ var Rt = { exports: {} }, Me = {};
6
6
  /**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.min.js
@@ -12,11 +12,11 @@ var jt = { exports: {} }, Me = {};
12
12
  * This source code is licensed under the MIT license found in the
13
13
  * LICENSE file in the root directory of this source tree.
14
14
  */
15
- var Rn;
15
+ var $n;
16
16
  function Rs() {
17
- if (Rn) return Me;
18
- Rn = 1;
19
- var t = yr, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
17
+ if ($n) return Me;
18
+ $n = 1;
19
+ var t = br, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = t.__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
21
  var l, d = {}, h = null, y = null;
22
22
  u !== void 0 && (h = "" + u), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (y = c.ref);
@@ -26,10 +26,10 @@ function Rs() {
26
26
  }
27
27
  return Me.Fragment = n, Me.jsx = o, Me.jsxs = o, Me;
28
28
  }
29
- var je = {}, $n;
29
+ var je = {}, Dn;
30
30
  function $s() {
31
- if ($n) return je;
32
- $n = 1;
31
+ if (Dn) return je;
32
+ Dn = 1;
33
33
  var t = {};
34
34
  /**
35
35
  * @license React
@@ -41,7 +41,7 @@ function $s() {
41
41
  * LICENSE file in the root directory of this source tree.
42
42
  */
43
43
  return t.NODE_ENV !== "production" && function() {
44
- var e = yr, n = 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"), d = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, w = "@@iterator";
44
+ var e = br, n = 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"), d = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, w = "@@iterator";
45
45
  function m(f) {
46
46
  if (f === null || typeof f != "object")
47
47
  return null;
@@ -68,14 +68,14 @@ function $s() {
68
68
  }
69
69
  var A = !1, j = !1, L = !1, q = !1, Pe = !1, We;
70
70
  We = Symbol.for("react.module.reference");
71
- function dt(f) {
71
+ function ht(f) {
72
72
  return !!(typeof f == "string" || typeof f == "function" || f === s || f === o || Pe || f === i || f === l || f === d || q || f === b || A || j || L || typeof f == "object" && f !== null && (f.$$typeof === y || f.$$typeof === h || f.$$typeof === a || f.$$typeof === c || f.$$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
76
  f.$$typeof === We || f.getModuleId !== void 0));
77
77
  }
78
- function ht(f, _, S) {
78
+ function pt(f, _, S) {
79
79
  var O = f.displayName;
80
80
  if (O)
81
81
  return O;
@@ -115,7 +115,7 @@ function $s() {
115
115
  var S = f;
116
116
  return Ce(S._context) + ".Provider";
117
117
  case u:
118
- return ht(f, f.render, "ForwardRef");
118
+ return pt(f, f.render, "ForwardRef");
119
119
  case h:
120
120
  var O = f.displayName || null;
121
121
  return O !== null ? O : X(f.type) || "Memo";
@@ -130,18 +130,18 @@ function $s() {
130
130
  }
131
131
  return null;
132
132
  }
133
- var re = Object.assign, ue = 0, ln, fn, dn, hn, pn, yn, bn;
134
- function _n() {
133
+ var re = Object.assign, ue = 0, fn, dn, hn, pn, yn, bn, _n;
134
+ function gn() {
135
135
  }
136
- _n.__reactDisabledLog = !0;
136
+ gn.__reactDisabledLog = !0;
137
137
  function ss() {
138
138
  {
139
139
  if (ue === 0) {
140
- ln = console.log, fn = console.info, dn = console.warn, hn = console.error, pn = console.group, yn = console.groupCollapsed, bn = console.groupEnd;
140
+ fn = console.log, dn = console.info, hn = console.warn, pn = console.error, yn = console.group, bn = console.groupCollapsed, _n = console.groupEnd;
141
141
  var f = {
142
142
  configurable: !0,
143
143
  enumerable: !0,
144
- value: _n,
144
+ value: gn,
145
145
  writable: !0
146
146
  };
147
147
  Object.defineProperties(console, {
@@ -167,52 +167,52 @@ function $s() {
167
167
  };
168
168
  Object.defineProperties(console, {
169
169
  log: re({}, f, {
170
- value: ln
170
+ value: fn
171
171
  }),
172
172
  info: re({}, f, {
173
- value: fn
173
+ value: dn
174
174
  }),
175
175
  warn: re({}, f, {
176
- value: dn
176
+ value: hn
177
177
  }),
178
178
  error: re({}, f, {
179
- value: hn
179
+ value: pn
180
180
  }),
181
181
  group: re({}, f, {
182
- value: pn
182
+ value: yn
183
183
  }),
184
184
  groupCollapsed: re({}, f, {
185
- value: yn
185
+ value: bn
186
186
  }),
187
187
  groupEnd: re({}, f, {
188
- value: bn
188
+ value: _n
189
189
  })
190
190
  });
191
191
  }
192
192
  ue < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
193
193
  }
194
194
  }
195
- var pt = T.ReactCurrentDispatcher, yt;
195
+ var yt = T.ReactCurrentDispatcher, bt;
196
196
  function Qe(f, _, S) {
197
197
  {
198
- if (yt === void 0)
198
+ if (bt === void 0)
199
199
  try {
200
200
  throw Error();
201
201
  } catch (I) {
202
202
  var O = I.stack.trim().match(/\n( *(at )?)/);
203
- yt = O && O[1] || "";
203
+ bt = O && O[1] || "";
204
204
  }
205
205
  return `
206
- ` + yt + f;
206
+ ` + bt + f;
207
207
  }
208
208
  }
209
- var bt = !1, Be;
209
+ var _t = !1, Be;
210
210
  {
211
211
  var os = typeof WeakMap == "function" ? WeakMap : Map;
212
212
  Be = new os();
213
213
  }
214
- function gn(f, _) {
215
- if (!f || bt)
214
+ function Tn(f, _) {
215
+ if (!f || _t)
216
216
  return "";
217
217
  {
218
218
  var S = Be.get(f);
@@ -220,11 +220,11 @@ function $s() {
220
220
  return S;
221
221
  }
222
222
  var O;
223
- bt = !0;
223
+ _t = !0;
224
224
  var I = Error.prepareStackTrace;
225
225
  Error.prepareStackTrace = void 0;
226
226
  var M;
227
- M = pt.current, pt.current = null, ss();
227
+ M = yt.current, yt.current = null, ss();
228
228
  try {
229
229
  if (_) {
230
230
  var C = function() {
@@ -277,13 +277,13 @@ function $s() {
277
277
  }
278
278
  }
279
279
  } finally {
280
- bt = !1, pt.current = M, is(), Error.prepareStackTrace = I;
280
+ _t = !1, yt.current = M, is(), Error.prepareStackTrace = I;
281
281
  }
282
282
  var me = f ? f.displayName || f.name : "", fe = me ? Qe(me) : "";
283
283
  return typeof f == "function" && Be.set(f, fe), fe;
284
284
  }
285
285
  function as(f, _, S) {
286
- return gn(f, !1);
286
+ return Tn(f, !1);
287
287
  }
288
288
  function cs(f) {
289
289
  var _ = f.prototype;
@@ -293,7 +293,7 @@ function $s() {
293
293
  if (f == null)
294
294
  return "";
295
295
  if (typeof f == "function")
296
- return gn(f, cs(f));
296
+ return Tn(f, cs(f));
297
297
  if (typeof f == "string")
298
298
  return Qe(f);
299
299
  switch (f) {
@@ -318,13 +318,13 @@ function $s() {
318
318
  }
319
319
  return "";
320
320
  }
321
- var Ie = Object.prototype.hasOwnProperty, Tn = {}, wn = T.ReactDebugCurrentFrame;
321
+ var Ie = Object.prototype.hasOwnProperty, wn = {}, mn = T.ReactDebugCurrentFrame;
322
322
  function He(f) {
323
323
  if (f) {
324
324
  var _ = f._owner, S = Ge(f.type, f._source, _ ? _.type : null);
325
- wn.setExtraStackFrame(S);
325
+ mn.setExtraStackFrame(S);
326
326
  } else
327
- wn.setExtraStackFrame(null);
327
+ mn.setExtraStackFrame(null);
328
328
  }
329
329
  function us(f, _, S, O, I) {
330
330
  {
@@ -341,12 +341,12 @@ function $s() {
341
341
  } catch ($) {
342
342
  k = $;
343
343
  }
344
- k && !(k instanceof Error) && (He(I), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", S, C, typeof k), He(null)), k instanceof Error && !(k.message in Tn) && (Tn[k.message] = !0, He(I), v("Failed %s type: %s", S, k.message), He(null));
344
+ k && !(k instanceof Error) && (He(I), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", S, C, typeof k), He(null)), k instanceof Error && !(k.message in wn) && (wn[k.message] = !0, He(I), v("Failed %s type: %s", S, k.message), He(null));
345
345
  }
346
346
  }
347
347
  }
348
348
  var ls = Array.isArray;
349
- function _t(f) {
349
+ function gt(f) {
350
350
  return ls(f);
351
351
  }
352
352
  function fs(f) {
@@ -357,24 +357,24 @@ function $s() {
357
357
  }
358
358
  function ds(f) {
359
359
  try {
360
- return mn(f), !1;
360
+ return Sn(f), !1;
361
361
  } catch {
362
362
  return !0;
363
363
  }
364
364
  }
365
- function mn(f) {
365
+ function Sn(f) {
366
366
  return "" + f;
367
367
  }
368
- function Sn(f) {
368
+ function vn(f) {
369
369
  if (ds(f))
370
- return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", fs(f)), mn(f);
370
+ return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", fs(f)), Sn(f);
371
371
  }
372
- var vn = T.ReactCurrentOwner, hs = {
372
+ var An = T.ReactCurrentOwner, hs = {
373
373
  key: !0,
374
374
  ref: !0,
375
375
  __self: !0,
376
376
  __source: !0
377
- }, An, On;
377
+ }, On, En;
378
378
  function ps(f) {
379
379
  if (Ie.call(f, "ref")) {
380
380
  var _ = Object.getOwnPropertyDescriptor(f, "ref").get;
@@ -392,12 +392,12 @@ function $s() {
392
392
  return f.key !== void 0;
393
393
  }
394
394
  function bs(f, _) {
395
- typeof f.ref == "string" && vn.current;
395
+ typeof f.ref == "string" && An.current;
396
396
  }
397
397
  function _s(f, _) {
398
398
  {
399
399
  var S = function() {
400
- An || (An = !0, v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", _));
400
+ On || (On = !0, v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", _));
401
401
  };
402
402
  S.isReactWarning = !0, Object.defineProperty(f, "key", {
403
403
  get: S,
@@ -408,7 +408,7 @@ function $s() {
408
408
  function gs(f, _) {
409
409
  {
410
410
  var S = function() {
411
- On || (On = !0, v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", _));
411
+ En || (En = !0, v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", _));
412
412
  };
413
413
  S.isReactWarning = !0, Object.defineProperty(f, "ref", {
414
414
  get: S,
@@ -448,7 +448,7 @@ function $s() {
448
448
  function ws(f, _, S, O, I) {
449
449
  {
450
450
  var M, C = {}, k = null, z = null;
451
- S !== void 0 && (Sn(S), k = "" + S), ys(_) && (Sn(_.key), k = "" + _.key), ps(_) && (z = _.ref, bs(_, I));
451
+ S !== void 0 && (vn(S), k = "" + S), ys(_) && (vn(_.key), k = "" + _.key), ps(_) && (z = _.ref, bs(_, I));
452
452
  for (M in _)
453
453
  Ie.call(_, M) && !hs.hasOwnProperty(M) && (C[M] = _[M]);
454
454
  if (f && f.defaultProps) {
@@ -460,26 +460,26 @@ function $s() {
460
460
  var x = typeof f == "function" ? f.displayName || f.name || "Unknown" : f;
461
461
  k && _s(C, x), z && gs(C, x);
462
462
  }
463
- return Ts(f, k, z, I, O, vn.current, C);
463
+ return Ts(f, k, z, I, O, An.current, C);
464
464
  }
465
465
  }
466
- var gt = T.ReactCurrentOwner, En = T.ReactDebugCurrentFrame;
466
+ var Tt = T.ReactCurrentOwner, kn = T.ReactDebugCurrentFrame;
467
467
  function we(f) {
468
468
  if (f) {
469
469
  var _ = f._owner, S = Ge(f.type, f._source, _ ? _.type : null);
470
- En.setExtraStackFrame(S);
470
+ kn.setExtraStackFrame(S);
471
471
  } else
472
- En.setExtraStackFrame(null);
472
+ kn.setExtraStackFrame(null);
473
473
  }
474
- var Tt;
475
- Tt = !1;
476
- function wt(f) {
474
+ var wt;
475
+ wt = !1;
476
+ function mt(f) {
477
477
  return typeof f == "object" && f !== null && f.$$typeof === n;
478
478
  }
479
- function kn() {
479
+ function Pn() {
480
480
  {
481
- if (gt.current) {
482
- var f = X(gt.current.type);
481
+ if (Tt.current) {
482
+ var f = X(Tt.current.type);
483
483
  if (f)
484
484
  return `
485
485
 
@@ -491,10 +491,10 @@ Check the render method of \`` + f + "`.";
491
491
  function ms(f) {
492
492
  return "";
493
493
  }
494
- var Pn = {};
494
+ var Cn = {};
495
495
  function Ss(f) {
496
496
  {
497
- var _ = kn();
497
+ var _ = Pn();
498
498
  if (!_) {
499
499
  var S = typeof f == "string" ? f : f.displayName || f.name;
500
500
  S && (_ = `
@@ -504,35 +504,35 @@ Check the top-level render call using <` + S + ">.");
504
504
  return _;
505
505
  }
506
506
  }
507
- function Cn(f, _) {
507
+ function In(f, _) {
508
508
  {
509
509
  if (!f._store || f._store.validated || f.key != null)
510
510
  return;
511
511
  f._store.validated = !0;
512
512
  var S = Ss(_);
513
- if (Pn[S])
513
+ if (Cn[S])
514
514
  return;
515
- Pn[S] = !0;
515
+ Cn[S] = !0;
516
516
  var O = "";
517
- f && f._owner && f._owner !== gt.current && (O = " It was passed a child from " + X(f._owner.type) + "."), we(f), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', S, O), we(null);
517
+ f && f._owner && f._owner !== Tt.current && (O = " It was passed a child from " + X(f._owner.type) + "."), we(f), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', S, O), we(null);
518
518
  }
519
519
  }
520
- function In(f, _) {
520
+ function Mn(f, _) {
521
521
  {
522
522
  if (typeof f != "object")
523
523
  return;
524
- if (_t(f))
524
+ if (gt(f))
525
525
  for (var S = 0; S < f.length; S++) {
526
526
  var O = f[S];
527
- wt(O) && Cn(O, _);
527
+ mt(O) && In(O, _);
528
528
  }
529
- else if (wt(f))
529
+ else if (mt(f))
530
530
  f._store && (f._store.validated = !0);
531
531
  else if (f) {
532
532
  var I = m(f);
533
533
  if (typeof I == "function" && I !== f.entries)
534
534
  for (var M = I.call(f), C; !(C = M.next()).done; )
535
- wt(C.value) && Cn(C.value, _);
535
+ mt(C.value) && In(C.value, _);
536
536
  }
537
537
  }
538
538
  }
@@ -553,8 +553,8 @@ Check the top-level render call using <` + S + ">.");
553
553
  if (S) {
554
554
  var O = X(_);
555
555
  us(S, f.props, "prop", O, f);
556
- } else if (_.PropTypes !== void 0 && !Tt) {
557
- Tt = !0;
556
+ } else if (_.PropTypes !== void 0 && !wt) {
557
+ wt = !0;
558
558
  var I = X(_);
559
559
  v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", I || "Unknown");
560
560
  }
@@ -573,17 +573,17 @@ Check the top-level render call using <` + S + ">.");
573
573
  f.ref !== null && (we(f), v("Invalid attribute `ref` supplied to `React.Fragment`."), we(null));
574
574
  }
575
575
  }
576
- var Mn = {};
577
- function jn(f, _, S, O, I, M) {
576
+ var jn = {};
577
+ function Rn(f, _, S, O, I, M) {
578
578
  {
579
- var C = dt(f);
579
+ var C = ht(f);
580
580
  if (!C) {
581
581
  var k = "";
582
582
  (f === void 0 || typeof f == "object" && f !== null && Object.keys(f).length === 0) && (k += " 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 z = ms();
584
- z ? k += z : k += kn();
584
+ z ? k += z : k += Pn();
585
585
  var $;
586
- f === null ? $ = "null" : _t(f) ? $ = "array" : f !== void 0 && f.$$typeof === n ? ($ = "<" + (X(f.type) || "Unknown") + " />", k = " Did you accidentally export a JSX literal instead of a component?") : $ = typeof f, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", $, k);
586
+ f === null ? $ = "null" : gt(f) ? $ = "array" : f !== void 0 && f.$$typeof === n ? ($ = "<" + (X(f.type) || "Unknown") + " />", k = " Did you accidentally export a JSX literal instead of a component?") : $ = typeof f, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", $, k);
587
587
  }
588
588
  var x = ws(f, _, S, I, M);
589
589
  if (x == null)
@@ -592,45 +592,45 @@ Check the top-level render call using <` + S + ">.");
592
592
  var Y = _.children;
593
593
  if (Y !== void 0)
594
594
  if (O)
595
- if (_t(Y)) {
595
+ if (gt(Y)) {
596
596
  for (var me = 0; me < Y.length; me++)
597
- In(Y[me], f);
597
+ Mn(Y[me], f);
598
598
  Object.freeze && Object.freeze(Y);
599
599
  } else
600
600
  v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
601
601
  else
602
- In(Y, f);
602
+ Mn(Y, f);
603
603
  }
604
604
  if (Ie.call(_, "key")) {
605
605
  var fe = X(f), W = Object.keys(_).filter(function(Is) {
606
606
  return Is !== "key";
607
- }), mt = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
608
- if (!Mn[fe + mt]) {
607
+ }), St = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
608
+ if (!jn[fe + St]) {
609
609
  var Cs = W.length > 0 ? "{" + W.join(": ..., ") + ": ...}" : "{}";
610
610
  v(`A props object containing a "key" prop is being spread into JSX:
611
611
  let props = %s;
612
612
  <%s {...props} />
613
613
  React keys must be passed directly to JSX without using spread:
614
614
  let props = %s;
615
- <%s key={someKey} {...props} />`, mt, fe, Cs, fe), Mn[fe + mt] = !0;
615
+ <%s key={someKey} {...props} />`, St, fe, Cs, fe), jn[fe + St] = !0;
616
616
  }
617
617
  }
618
618
  return f === s ? As(x) : vs(x), x;
619
619
  }
620
620
  }
621
621
  function Os(f, _, S) {
622
- return jn(f, _, S, !0);
622
+ return Rn(f, _, S, !0);
623
623
  }
624
624
  function Es(f, _, S) {
625
- return jn(f, _, S, !1);
625
+ return Rn(f, _, S, !1);
626
626
  }
627
627
  var ks = Es, Ps = Os;
628
628
  je.Fragment = s, je.jsx = ks, je.jsxs = Ps;
629
629
  }(), je;
630
630
  }
631
631
  var Ds = {};
632
- Ds.NODE_ENV === "production" ? jt.exports = Rs() : jt.exports = $s();
633
- var Je = jt.exports;
632
+ Ds.NODE_ENV === "production" ? Rt.exports = Rs() : Rt.exports = $s();
633
+ var Je = Rt.exports;
634
634
  function F(t) {
635
635
  if (typeof t == "number")
636
636
  return (Math.abs(t * 2654435761) >>> 0).toString(16);
@@ -673,14 +673,14 @@ const D = {
673
673
  Remove: "remove",
674
674
  Replace: "replace",
675
675
  Add: "add"
676
- }, _r = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), xs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), tt = Symbol.iterator, J = {
676
+ }, gr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), xs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), tt = Symbol.iterator, J = {
677
677
  mutable: "mutable",
678
678
  immutable: "immutable"
679
- }, Jt = {};
679
+ }, Yt = {};
680
680
  function Le(t, e) {
681
681
  return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
682
682
  }
683
- function Dn(t, e) {
683
+ function xn(t, e) {
684
684
  if (e in t) {
685
685
  let n = Reflect.getPrototypeOf(t);
686
686
  for (; n; ) {
@@ -691,10 +691,10 @@ function Dn(t, e) {
691
691
  }
692
692
  }
693
693
  }
694
- function Yt(t) {
694
+ function Zt(t) {
695
695
  return Object.getPrototypeOf(t) === Set.prototype;
696
696
  }
697
- function Zt(t) {
697
+ function Xt(t) {
698
698
  return Object.getPrototypeOf(t) === Map.prototype;
699
699
  }
700
700
  function H(t) {
@@ -705,9 +705,9 @@ function _e(t) {
705
705
  return !!P(t);
706
706
  }
707
707
  function P(t) {
708
- return typeof t != "object" ? null : t == null ? void 0 : t[_r];
708
+ return typeof t != "object" ? null : t == null ? void 0 : t[gr];
709
709
  }
710
- function Xt(t) {
710
+ function en(t) {
711
711
  var e;
712
712
  const n = P(t);
713
713
  return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
@@ -718,7 +718,7 @@ function te(t, e) {
718
718
  let n;
719
719
  return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((n = e.mark(t, J)) === J.immutable || typeof n == "function");
720
720
  }
721
- function gr(t, e = []) {
721
+ function Tr(t, e = []) {
722
722
  if (Object.hasOwnProperty.call(t, "key")) {
723
723
  const n = t.parent.copy, r = P(ce(n, t.key));
724
724
  if (r !== null && (r == null ? void 0 : r.original) !== t.original)
@@ -729,7 +729,7 @@ function gr(t, e = []) {
729
729
  e.push(i);
730
730
  }
731
731
  if (t.parent)
732
- return gr(t.parent, e);
732
+ return Tr(t.parent, e);
733
733
  e.reverse();
734
734
  try {
735
735
  Us(t.copy, e);
@@ -747,14 +747,14 @@ function ce(t, e) {
747
747
  function ze(t, e, n) {
748
748
  ge(t) === 2 ? t.set(e, n) : t[e] = n;
749
749
  }
750
- function St(t, e) {
750
+ function vt(t, e) {
751
751
  const n = P(t);
752
752
  return (n ? H(n) : t)[e];
753
753
  }
754
754
  function ae(t, e) {
755
755
  return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
756
756
  }
757
- function Rt(t) {
757
+ function $t(t) {
758
758
  if (t)
759
759
  for (; t.finalities.revoke.length > 0; )
760
760
  t.finalities.revoke.pop()();
@@ -790,18 +790,18 @@ function Ls(t) {
790
790
  }), e;
791
791
  }
792
792
  const Fs = Object.prototype.propertyIsEnumerable;
793
- function Tr(t, e) {
793
+ function wr(t, e) {
794
794
  let n;
795
795
  if (Array.isArray(t))
796
796
  return Array.prototype.concat.call(t);
797
797
  if (t instanceof Set) {
798
- if (!Yt(t)) {
798
+ if (!Zt(t)) {
799
799
  const r = Object.getPrototypeOf(t).constructor;
800
800
  return new r(t.values());
801
801
  }
802
802
  return Set.prototype.difference ? Set.prototype.difference.call(t, /* @__PURE__ */ new Set()) : new Set(t.values());
803
803
  } else if (t instanceof Map) {
804
- if (!Zt(t)) {
804
+ if (!Xt(t)) {
805
805
  const r = Object.getPrototypeOf(t).constructor;
806
806
  return new r(t);
807
807
  }
@@ -826,11 +826,11 @@ function Tr(t, e) {
826
826
  throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
827
827
  }
828
828
  function V(t) {
829
- t.copy || (t.copy = Tr(t.original, t.options));
829
+ t.copy || (t.copy = wr(t.original, t.options));
830
830
  }
831
831
  function $e(t) {
832
832
  if (!te(t))
833
- return Xt(t);
833
+ return en(t);
834
834
  if (Array.isArray(t))
835
835
  return t.map($e);
836
836
  if (t instanceof Map) {
@@ -838,7 +838,7 @@ function $e(t) {
838
838
  r,
839
839
  $e(s)
840
840
  ]);
841
- if (!Zt(t)) {
841
+ if (!Xt(t)) {
842
842
  const r = Object.getPrototypeOf(t).constructor;
843
843
  return new r(n);
844
844
  }
@@ -846,7 +846,7 @@ function $e(t) {
846
846
  }
847
847
  if (t instanceof Set) {
848
848
  const n = Array.from(t).map($e);
849
- if (!Yt(t)) {
849
+ if (!Zt(t)) {
850
850
  const r = Object.getPrototypeOf(t).constructor;
851
851
  return new r(n);
852
852
  }
@@ -864,7 +864,7 @@ function se(t) {
864
864
  var e;
865
865
  t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && se(t.parent));
866
866
  }
867
- function xn() {
867
+ function Un() {
868
868
  throw new Error("Cannot modify frozen object");
869
869
  }
870
870
  function Se(t, e, n, r, s) {
@@ -892,12 +892,12 @@ function Se(t, e, n, r, s) {
892
892
  case 2:
893
893
  for (const [a, c] of t)
894
894
  Se(a, a, n, r, s), Se(c, a, n, r, s);
895
- t.set = t.clear = t.delete = xn;
895
+ t.set = t.clear = t.delete = Un;
896
896
  break;
897
897
  case 3:
898
898
  for (const a of t)
899
899
  Se(a, a, n, r, s);
900
- t.add = t.clear = t.delete = xn;
900
+ t.add = t.clear = t.delete = Un;
901
901
  break;
902
902
  case 1:
903
903
  Object.freeze(t);
@@ -913,7 +913,7 @@ function Se(t, e, n, r, s) {
913
913
  }
914
914
  r.pop(), s.pop();
915
915
  }
916
- function en(t, e) {
916
+ function tn(t, e) {
917
917
  const n = ge(t);
918
918
  if (n === 0)
919
919
  Reflect.ownKeys(t).forEach((r) => {
@@ -926,11 +926,11 @@ function en(t, e) {
926
926
  } else
927
927
  t.forEach((r, s) => e(s, r, t));
928
928
  }
929
- function wr(t, e, n) {
929
+ function mr(t, e, n) {
930
930
  if (_e(t) || !te(t, n) || e.has(t) || Object.isFrozen(t))
931
931
  return;
932
932
  const r = t instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
933
- if (e.add(t), en(t, (i, o) => {
933
+ if (e.add(t), tn(t, (i, o) => {
934
934
  var a;
935
935
  if (_e(o)) {
936
936
  const c = P(o);
@@ -938,7 +938,7 @@ function wr(t, e, n) {
938
938
  const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
939
939
  ze(r ? s : t, i, u);
940
940
  } else
941
- wr(o, e, n);
941
+ mr(o, e, n);
942
942
  }), s) {
943
943
  const i = t, o = Array.from(i);
944
944
  i.clear(), o.forEach((a) => {
@@ -948,30 +948,30 @@ function wr(t, e, n) {
948
948
  }
949
949
  function Ns(t, e) {
950
950
  const n = t.type === 3 ? t.setMap : t.copy;
951
- t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && wr(ce(n, e), t.finalities.handledSet, t.options);
951
+ t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && mr(ce(n, e), t.finalities.handledSet, t.options);
952
952
  }
953
- function $t(t) {
953
+ function Dt(t) {
954
954
  t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
955
- t.copy.add(Xt(e));
955
+ t.copy.add(en(e));
956
956
  }));
957
957
  }
958
- function Dt(t, e, n, r) {
958
+ function xt(t, e, n, r) {
959
959
  if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
960
960
  if (n && r) {
961
- const i = gr(t);
961
+ const i = Tr(t);
962
962
  i && e(t, i, n, r);
963
963
  }
964
964
  t.finalized = !0;
965
965
  }
966
966
  }
967
- function tn(t, e, n, r) {
967
+ function nn(t, e, n, r) {
968
968
  const s = P(n);
969
969
  s && (s.callbacks || (s.callbacks = []), s.callbacks.push((i, o) => {
970
970
  var a;
971
971
  const c = t.type === 3 ? t.setMap : t.copy;
972
972
  if (ae(ce(c, e), n)) {
973
973
  let u = s.original;
974
- s.copy && (u = s.copy), $t(t), Dt(t, r, i, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(u, s.original)), ze(c, e, u);
974
+ s.copy && (u = s.copy), Dt(t), xt(t, r, i, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(u, s.original)), ze(c, e, u);
975
975
  }
976
976
  }), t.options.enableAutoFreeze && s.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), te(n, t.options) && t.finalities.draft.push(() => {
977
977
  const i = t.type === 3 ? t.setMap : t.copy;
@@ -1077,10 +1077,10 @@ function qe(t, e, n, r) {
1077
1077
  return zs(t, e, n, r, s);
1078
1078
  }
1079
1079
  }
1080
- const st = (t, e, n = !1) => {
1080
+ const it = (t, e, n = !1) => {
1081
1081
  if (typeof t == "object" && t !== null && (!te(t, e) || n))
1082
1082
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
1083
- }, xt = {
1083
+ }, Ut = {
1084
1084
  get size() {
1085
1085
  return H(P(this)).size;
1086
1086
  },
@@ -1089,7 +1089,7 @@ const st = (t, e, n = !1) => {
1089
1089
  },
1090
1090
  set(t, e) {
1091
1091
  const n = P(this), r = H(n);
1092
- return (!r.has(t) || !ae(r.get(t), e)) && (V(n), se(n), n.assignedMap.set(t, !0), n.copy.set(t, e), tn(n, t, e, qe)), this;
1092
+ return (!r.has(t) || !ae(r.get(t), e)) && (V(n), se(n), n.assignedMap.set(t, !0), n.copy.set(t, e), nn(n, t, e, qe)), this;
1093
1093
  },
1094
1094
  delete(t) {
1095
1095
  if (!this.has(t))
@@ -1115,9 +1115,9 @@ const st = (t, e, n = !1) => {
1115
1115
  get(t) {
1116
1116
  var e, n;
1117
1117
  const r = P(this), s = H(r).get(t), i = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, s, J)) === J.mutable;
1118
- if (r.options.strict && st(s, r.options, i), i || r.finalized || !te(s, r.options) || s !== r.original.get(t))
1118
+ if (r.options.strict && it(s, r.options, i), i || r.finalized || !te(s, r.options) || s !== r.original.get(t))
1119
1119
  return s;
1120
- const o = Jt.createDraft({
1120
+ const o = Yt.createDraft({
1121
1121
  original: s,
1122
1122
  parentDraft: r,
1123
1123
  key: t,
@@ -1161,7 +1161,7 @@ const st = (t, e, n = !1) => {
1161
1161
  [tt]() {
1162
1162
  return this.entries();
1163
1163
  }
1164
- }, Vs = Reflect.ownKeys(xt), Un = (t, e, { isValuesIterator: n }) => () => {
1164
+ }, Vs = Reflect.ownKeys(Ut), Ln = (t, e, { isValuesIterator: n }) => () => {
1165
1165
  var r, s;
1166
1166
  const i = e.next();
1167
1167
  if (i.done)
@@ -1169,8 +1169,8 @@ const st = (t, e, n = !1) => {
1169
1169
  const o = i.value;
1170
1170
  let a = t.setMap.get(o);
1171
1171
  const c = P(a), u = ((s = (r = t.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, J)) === J.mutable;
1172
- if (t.options.strict && st(o, t.options, u), !u && !c && te(o, t.options) && !t.finalized && t.original.has(o)) {
1173
- const l = Jt.createDraft({
1172
+ if (t.options.strict && it(o, t.options, u), !u && !c && te(o, t.options) && !t.finalized && t.original.has(o)) {
1173
+ const l = Yt.createDraft({
1174
1174
  original: o,
1175
1175
  parentDraft: t,
1176
1176
  key: o,
@@ -1183,7 +1183,7 @@ const st = (t, e, n = !1) => {
1183
1183
  done: !1,
1184
1184
  value: n ? a : [a, a]
1185
1185
  };
1186
- }, it = {
1186
+ }, ot = {
1187
1187
  get size() {
1188
1188
  return P(this).setMap.size;
1189
1189
  },
@@ -1197,7 +1197,7 @@ const st = (t, e, n = !1) => {
1197
1197
  },
1198
1198
  add(t) {
1199
1199
  const e = P(this);
1200
- return this.has(t) || (V(e), se(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), tn(e, t, t, qe)), this;
1200
+ return this.has(t) || (V(e), se(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), nn(e, t, t, qe)), this;
1201
1201
  },
1202
1202
  delete(t) {
1203
1203
  if (!this.has(t))
@@ -1222,7 +1222,7 @@ const st = (t, e, n = !1) => {
1222
1222
  const e = t.setMap.keys();
1223
1223
  return {
1224
1224
  [Symbol.iterator]: () => this.values(),
1225
- next: Un(t, e, { isValuesIterator: !0 })
1225
+ next: Ln(t, e, { isValuesIterator: !0 })
1226
1226
  };
1227
1227
  },
1228
1228
  entries() {
@@ -1231,7 +1231,7 @@ const st = (t, e, n = !1) => {
1231
1231
  const e = t.setMap.keys();
1232
1232
  return {
1233
1233
  [Symbol.iterator]: () => this.entries(),
1234
- next: Un(t, e, {
1234
+ next: Ln(t, e, {
1235
1235
  isValuesIterator: !1
1236
1236
  })
1237
1237
  };
@@ -1249,7 +1249,7 @@ const st = (t, e, n = !1) => {
1249
1249
  t.call(e, r.value, r.value, this), r = n.next();
1250
1250
  }
1251
1251
  };
1252
- Set.prototype.difference && Object.assign(it, {
1252
+ Set.prototype.difference && Object.assign(ot, {
1253
1253
  intersection(t) {
1254
1254
  return Set.prototype.intersection.call(new Set(this.values()), t);
1255
1255
  },
@@ -1272,47 +1272,47 @@ Set.prototype.difference && Object.assign(it, {
1272
1272
  return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
1273
1273
  }
1274
1274
  });
1275
- const Ws = Reflect.ownKeys(it), mr = /* @__PURE__ */ new WeakSet(), Sr = {
1275
+ const Ws = Reflect.ownKeys(ot), Sr = /* @__PURE__ */ new WeakSet(), vr = {
1276
1276
  get(t, e, n) {
1277
1277
  var r, s;
1278
1278
  const i = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
1279
- if (i && mr.has(i))
1279
+ if (i && Sr.has(i))
1280
1280
  return i;
1281
- if (e === _r)
1281
+ if (e === gr)
1282
1282
  return t;
1283
1283
  let o;
1284
1284
  if (t.options.mark) {
1285
1285
  const u = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, n);
1286
1286
  if (o = t.options.mark(u, J), o === J.mutable)
1287
- return t.options.strict && st(u, t.options, !0), u;
1287
+ return t.options.strict && it(u, t.options, !0), u;
1288
1288
  }
1289
1289
  const a = H(t);
1290
1290
  if (a instanceof Map && Vs.includes(e)) {
1291
1291
  if (e === "size")
1292
- return Object.getOwnPropertyDescriptor(xt, "size").get.call(t.proxy);
1293
- const u = xt[e];
1292
+ return Object.getOwnPropertyDescriptor(Ut, "size").get.call(t.proxy);
1293
+ const u = Ut[e];
1294
1294
  if (u)
1295
1295
  return u.bind(t.proxy);
1296
1296
  }
1297
1297
  if (a instanceof Set && Ws.includes(e)) {
1298
1298
  if (e === "size")
1299
- return Object.getOwnPropertyDescriptor(it, "size").get.call(t.proxy);
1300
- const u = it[e];
1299
+ return Object.getOwnPropertyDescriptor(ot, "size").get.call(t.proxy);
1300
+ const u = ot[e];
1301
1301
  if (u)
1302
1302
  return u.bind(t.proxy);
1303
1303
  }
1304
1304
  if (!Le(a, e)) {
1305
- const u = Dn(a, e);
1305
+ const u = xn(a, e);
1306
1306
  return u ? "value" in u ? u.value : (
1307
1307
  // !case: support for getter
1308
1308
  (s = u.get) === null || s === void 0 ? void 0 : s.call(t.proxy)
1309
1309
  ) : void 0;
1310
1310
  }
1311
1311
  const c = a[e];
1312
- if (t.options.strict && st(c, t.options), t.finalized || !te(c, t.options))
1312
+ if (t.options.strict && it(c, t.options), t.finalized || !te(c, t.options))
1313
1313
  return c;
1314
- if (c === St(t.original, e)) {
1315
- if (V(t), t.copy[e] = nn({
1314
+ if (c === vt(t.original, e)) {
1315
+ if (V(t), t.copy[e] = rn({
1316
1316
  original: t.original[e],
1317
1317
  parentDraft: t,
1318
1318
  key: t.type === 1 ? Number(e) : e,
@@ -1333,11 +1333,11 @@ const Ws = Reflect.ownKeys(it), mr = /* @__PURE__ */ new WeakSet(), Sr = {
1333
1333
  let s;
1334
1334
  if (t.type === 1 && e !== "length" && !(Number.isInteger(s = Number(e)) && s >= 0 && (e === 0 || s === 0 || String(s) === String(e))))
1335
1335
  throw new Error("Only supports setting array indices and the 'length' property.");
1336
- const i = Dn(H(t), e);
1336
+ const i = xn(H(t), e);
1337
1337
  if (i != null && i.set)
1338
1338
  return i.set.call(t.proxy, n), !0;
1339
- const o = St(H(t), e), a = P(o);
1340
- return a && ae(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ae(n, o) && (n !== void 0 || Le(t.original, e)) || (V(t), se(t), Le(t.original, e) && ae(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, tn(t, e, n, qe)), !0);
1339
+ const o = vt(H(t), e), a = P(o);
1340
+ return a && ae(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ae(n, o) && (n !== void 0 || Le(t.original, e)) || (V(t), se(t), Le(t.original, e) && ae(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, nn(t, e, n, qe)), !0);
1341
1341
  },
1342
1342
  has(t, e) {
1343
1343
  return e in H(t);
@@ -1365,10 +1365,10 @@ const Ws = Reflect.ownKeys(it), mr = /* @__PURE__ */ new WeakSet(), Sr = {
1365
1365
  },
1366
1366
  deleteProperty(t, e) {
1367
1367
  var n;
1368
- return t.type === 1 ? Sr.set.call(this, t, e, void 0, t.proxy) : (St(t.original, e) !== void 0 || e in t.original ? (V(t), se(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
1368
+ return t.type === 1 ? vr.set.call(this, t, e, void 0, t.proxy) : (vt(t.original, e) !== void 0 || e in t.original ? (V(t), se(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
1369
1369
  }
1370
1370
  };
1371
- function nn(t) {
1371
+ function rn(t) {
1372
1372
  const { original: e, parentDraft: n, key: r, finalities: s, options: i } = t, o = ge(e), a = {
1373
1373
  type: o,
1374
1374
  finalized: !1,
@@ -1382,8 +1382,8 @@ function nn(t) {
1382
1382
  setMap: o === 3 ? new Map(e.entries()) : void 0
1383
1383
  };
1384
1384
  (r || "key" in t) && (a.key = r);
1385
- const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, Sr);
1386
- if (s.revoke.push(u), mr.add(c), a.proxy = c, n) {
1385
+ const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, vr);
1386
+ if (s.revoke.push(u), Sr.add(c), a.proxy = c, n) {
1387
1387
  const l = n;
1388
1388
  l.finalities.draft.push((d, h) => {
1389
1389
  var y, b;
@@ -1392,7 +1392,7 @@ function nn(t) {
1392
1392
  const m = ce(w, r), T = P(m);
1393
1393
  if (T) {
1394
1394
  let v = T.original;
1395
- T.operated && (v = Xt(m)), $t(T), Dt(T, qe, d, h), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(v, T.original)), ze(w, r, v);
1395
+ T.operated && (v = en(m)), Dt(T), xt(T, qe, d, h), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(v, T.original)), ze(w, r, v);
1396
1396
  }
1397
1397
  (b = g.callbacks) === null || b === void 0 || b.forEach((v) => {
1398
1398
  v(d, h);
@@ -1401,12 +1401,12 @@ function nn(t) {
1401
1401
  } else {
1402
1402
  const l = P(c);
1403
1403
  l.finalities.draft.push((d, h) => {
1404
- $t(l), Dt(l, qe, d, h);
1404
+ Dt(l), xt(l, qe, d, h);
1405
1405
  });
1406
1406
  }
1407
1407
  return c;
1408
1408
  }
1409
- Jt.createDraft = nn;
1409
+ Yt.createDraft = rn;
1410
1410
  function Qs(t, e, n, r, s) {
1411
1411
  var i;
1412
1412
  const o = P(t), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : t, c = !!e.length;
@@ -1414,7 +1414,7 @@ function Qs(t, e, n, r, s) {
1414
1414
  for (; o.finalities.draft.length > 0; )
1415
1415
  o.finalities.draft.pop()(n, r);
1416
1416
  const u = c ? e[0] : o ? o.operated ? o.copy : o.original : t;
1417
- return o && Rt(o), s && Se(u, u, o == null ? void 0 : o.options.updatedValues), [
1417
+ return o && $t(o), s && Se(u, u, o == null ? void 0 : o.options.updatedValues), [
1418
1418
  u,
1419
1419
  n && c ? [{ op: D.Replace, path: [], value: e[0] }] : n,
1420
1420
  r && c ? [{ op: D.Replace, path: [], value: a }] : r
@@ -1429,7 +1429,7 @@ function Bs(t, e) {
1429
1429
  };
1430
1430
  let s, i;
1431
1431
  e.enablePatches && (s = [], i = []);
1432
- const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, J)) === J.mutable || !te(t, e) ? t : nn({
1432
+ const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, J)) === J.mutable || !te(t, e) ? t : rn({
1433
1433
  original: t,
1434
1434
  parentDraft: null,
1435
1435
  finalities: r,
@@ -1443,9 +1443,9 @@ function Bs(t, e) {
1443
1443
  }
1444
1444
  ];
1445
1445
  }
1446
- function Ut(t) {
1446
+ function Lt(t) {
1447
1447
  const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: s = !0 } = t;
1448
- en(n, (i, o, a) => {
1448
+ tn(n, (i, o, a) => {
1449
1449
  const c = P(o);
1450
1450
  if (c && e && c.finalities === e.finalities) {
1451
1451
  t.isContainDraft = !0;
@@ -1455,10 +1455,10 @@ function Ut(t) {
1455
1455
  a.clear(), l.forEach((d) => a.add(i === d ? u : d));
1456
1456
  } else
1457
1457
  ze(a, i, u);
1458
- } else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, Ut(t));
1458
+ } else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, Lt(t));
1459
1459
  }), s && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
1460
1460
  }
1461
- function vr(t) {
1461
+ function Ar(t) {
1462
1462
  var e;
1463
1463
  const n = P(t);
1464
1464
  if (!te(t, n == null ? void 0 : n.options))
@@ -1468,7 +1468,7 @@ function vr(t) {
1468
1468
  return n.original;
1469
1469
  let s;
1470
1470
  function i() {
1471
- s = r === 2 ? Zt(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : Tr(t, n == null ? void 0 : n.options);
1471
+ s = r === 2 ? Xt(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : wr(t, n == null ? void 0 : n.options);
1472
1472
  }
1473
1473
  if (n) {
1474
1474
  n.finalized = !0;
@@ -1479,21 +1479,21 @@ function vr(t) {
1479
1479
  }
1480
1480
  } else
1481
1481
  s = t;
1482
- if (en(s, (o, a) => {
1482
+ if (tn(s, (o, a) => {
1483
1483
  if (n && ae(ce(n.original, o), a))
1484
1484
  return;
1485
- const c = vr(a);
1485
+ const c = Ar(a);
1486
1486
  c !== a && (s === t && i(), ze(s, o, c));
1487
1487
  }), r === 3) {
1488
1488
  const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : s;
1489
- return Yt(o) ? new Set(s) : new (Object.getPrototypeOf(o)).constructor(s);
1489
+ return Zt(o) ? new Set(s) : new (Object.getPrototypeOf(o)).constructor(s);
1490
1490
  }
1491
1491
  return s;
1492
1492
  }
1493
- function Ln(t) {
1493
+ function Fn(t) {
1494
1494
  if (!_e(t))
1495
1495
  throw new Error(`current() is only used for Draft, parameter: ${t}`);
1496
- return vr(t);
1496
+ return Ar(t);
1497
1497
  }
1498
1498
  const Gs = (t) => function e(n, r, s) {
1499
1499
  var i, o, a;
@@ -1506,7 +1506,7 @@ const Gs = (t) => function e(n, r, s) {
1506
1506
  if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
1507
1507
  throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
1508
1508
  l = Object.assign(Object.assign({}, t), l);
1509
- const d = _e(c) ? Ln(c) : c, h = Array.isArray(l.mark) ? (A, j) => {
1509
+ const d = _e(c) ? Fn(c) : c, h = Array.isArray(l.mark) ? (A, j) => {
1510
1510
  for (const L of l.mark) {
1511
1511
  if (typeof L != "function")
1512
1512
  throw new Error(`Invalid mark: ${L}, 'mark' should be a function.`);
@@ -1532,7 +1532,7 @@ const Gs = (t) => function e(n, r, s) {
1532
1532
  try {
1533
1533
  v = u(m);
1534
1534
  } catch (A) {
1535
- throw Rt(P(m)), A;
1535
+ throw $t(P(m)), A;
1536
1536
  }
1537
1537
  const E = (A) => {
1538
1538
  const j = P(m);
@@ -1542,14 +1542,14 @@ const Gs = (t) => function e(n, r, s) {
1542
1542
  const q = A == null ? void 0 : A[xs];
1543
1543
  if (q) {
1544
1544
  const Pe = q[0];
1545
- return w.strict && typeof A == "object" && A !== null && Ut({
1545
+ return w.strict && typeof A == "object" && A !== null && Lt({
1546
1546
  rootDraft: j,
1547
1547
  value: A,
1548
1548
  useRawReturn: !0
1549
1549
  }), T([Pe]);
1550
1550
  }
1551
1551
  if (A !== void 0)
1552
- return typeof A == "object" && A !== null && Ut({ rootDraft: j, value: A }), T([A]);
1552
+ return typeof A == "object" && A !== null && Lt({ rootDraft: j, value: A }), T([A]);
1553
1553
  }
1554
1554
  if (A === m || A === void 0)
1555
1555
  return T([]);
@@ -1557,26 +1557,26 @@ const Gs = (t) => function e(n, r, s) {
1557
1557
  if (w === L.options) {
1558
1558
  if (L.operated)
1559
1559
  throw new Error("Cannot return a modified child draft.");
1560
- return T([Ln(A)]);
1560
+ return T([Fn(A)]);
1561
1561
  }
1562
1562
  return T([A]);
1563
1563
  };
1564
1564
  return v instanceof Promise ? v.then(E, (A) => {
1565
- throw Rt(P(m)), A;
1565
+ throw $t(P(m)), A;
1566
1566
  }) : E(v);
1567
- }, ot = Gs();
1567
+ }, at = Gs();
1568
1568
  Object.prototype.constructor.toString();
1569
- function Ar(t, e) {
1569
+ function Or(t, e) {
1570
1570
  const n = Object.keys(t), r = Object.keys(e);
1571
1571
  return n.length === r.length && Object.keys(t).every((s) => e.hasOwnProperty(s));
1572
1572
  }
1573
- function Fn(t, e) {
1573
+ function Nn(t, e) {
1574
1574
  return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((n) => e.hasOwnProperty(n) && t[n] === e[n]);
1575
1575
  }
1576
1576
  function rt(t, e) {
1577
- return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : Ar(t, e) ? Object.keys(t).every((n) => rt(t[n], e[n])) : !1;
1577
+ return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : Or(t, e) ? Object.keys(t).every((n) => rt(t[n], e[n])) : !1;
1578
1578
  }
1579
- function rn(t) {
1579
+ function sn(t) {
1580
1580
  if (!De(t))
1581
1581
  return t;
1582
1582
  const e = {};
@@ -1584,7 +1584,7 @@ function rn(t) {
1584
1584
  r !== void 0 && (e[n] = r);
1585
1585
  return e;
1586
1586
  }
1587
- function Or(t, e) {
1587
+ function Er(t, e) {
1588
1588
  if (!De(t) || !De(e))
1589
1589
  return e;
1590
1590
  const n = { ...t };
@@ -1596,7 +1596,7 @@ function Or(t, e) {
1596
1596
  continue;
1597
1597
  }
1598
1598
  const s = De(t[r]) && De(e[r]);
1599
- n[r] = s ? Or(t[r], e[r]) : e[r];
1599
+ n[r] = s ? Er(t[r], e[r]) : e[r];
1600
1600
  }
1601
1601
  return n;
1602
1602
  }
@@ -1614,7 +1614,7 @@ function Hs(t, e, n) {
1614
1614
  const s = e[e.length - 1];
1615
1615
  Array.isArray(r) && typeof s == "number" ? r.splice(s, 0, n) : r[s] = n;
1616
1616
  }
1617
- function Nn(t, e, n) {
1617
+ function Kn(t, e, n) {
1618
1618
  if (!t || e.length === 0)
1619
1619
  return;
1620
1620
  let r = t || {};
@@ -1624,7 +1624,7 @@ function Nn(t, e, n) {
1624
1624
  }
1625
1625
  r[e[e.length - 1]] = n;
1626
1626
  }
1627
- function Er(t, e) {
1627
+ function kr(t, e) {
1628
1628
  if (!t || e.length === 0)
1629
1629
  return;
1630
1630
  const [n, ...r] = e;
@@ -1633,13 +1633,13 @@ function Er(t, e) {
1633
1633
  Array.isArray(t) ? t.splice(n, 1) : delete t[n];
1634
1634
  return;
1635
1635
  }
1636
- Er(t[n], r), Js(t[n]) && delete t[n];
1636
+ kr(t[n], r), Js(t[n]) && delete t[n];
1637
1637
  }
1638
1638
  }
1639
1639
  function Js(t) {
1640
1640
  return t && Object.keys(t).length === 0;
1641
1641
  }
1642
- const Kn = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|WAST|WAKT|WADT|VUT|VOLT|VLAT|VLAST|VET|UZT|UZST|UYT|UYST|UTC|UT|ULAT|ULAST|UCT|TVT|TRUT|TOT|TMT|TKT|TJT|TFT|TAHT|SGT|SCT|SAST|SADT|RET|PYT|PYST|PWT|PST|PONT|PMST|PMDT|PKT|PKST|PHT|PGT|PETT|PETST|PET|PDT|OMST|OMSST|NZT|NZST|NZDT|NUT|NST|NPT|NOVT|NOVST|NFT|NDT|MYT|MVT|MUT|MUST|MST|MSK|MSD|MPT|MMT|MHT|MEZ|METDST|MET|MESZ|MEST|MDT|MAWT|MART|MAGT|MAGST|LKT|LINT|LIGT|LHST|LHDT|KST|KRAT|KRAST|KOST|KGT|KGST|KDT|JST|JAYT|IST|IRT|IRKT|IRKST|IOT|IDT|ICT|HST|HKT|GYT|GMT|GILT|GFT|GET|GEST|GAMT|GALT|FNT|FNST|FKT|FKST|FJT|FJST|FET|EST|EGT|EGST|EETDST|EET|EEST|EDT|EAT|EAST|EASST|DDUT|DAVT|CXT|CST|COT|CLT|CLST|CKT|CHUT|CHAST|CHADT|CETDST|CET|CEST|CDT|CCT|CAST|CADT|BTT|BST|BRT|BRST|BRA|BOT|BORT|BNT|BDT|BDST|AZT|AZST|AZOT|AZOST|AWST|AWSST|AST|ART|ARST|ANAT|ANAST|AMT|AMST|ALMT|ALMST|AKST|AKDT|AFT|AEST|AESST|AEDT|ADT|ACWST|ACT|ACST|ACSST|ACDT$/, Ys = {
1642
+ const qn = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|WAST|WAKT|WADT|VUT|VOLT|VLAT|VLAST|VET|UZT|UZST|UYT|UYST|UTC|UT|ULAT|ULAST|UCT|TVT|TRUT|TOT|TMT|TKT|TJT|TFT|TAHT|SGT|SCT|SAST|SADT|RET|PYT|PYST|PWT|PST|PONT|PMST|PMDT|PKT|PKST|PHT|PGT|PETT|PETST|PET|PDT|OMST|OMSST|NZT|NZST|NZDT|NUT|NST|NPT|NOVT|NOVST|NFT|NDT|MYT|MVT|MUT|MUST|MST|MSK|MSD|MPT|MMT|MHT|MEZ|METDST|MET|MESZ|MEST|MDT|MAWT|MART|MAGT|MAGST|LKT|LINT|LIGT|LHST|LHDT|KST|KRAT|KRAST|KOST|KGT|KGST|KDT|JST|JAYT|IST|IRT|IRKT|IRKST|IOT|IDT|ICT|HST|HKT|GYT|GMT|GILT|GFT|GET|GEST|GAMT|GALT|FNT|FNST|FKT|FKST|FJT|FJST|FET|EST|EGT|EGST|EETDST|EET|EEST|EDT|EAT|EAST|EASST|DDUT|DAVT|CXT|CST|COT|CLT|CLST|CKT|CHUT|CHAST|CHADT|CETDST|CET|CEST|CDT|CCT|CAST|CADT|BTT|BST|BRT|BRST|BRA|BOT|BORT|BNT|BDT|BDST|AZT|AZST|AZOT|AZOST|AWST|AWSST|AST|ART|ARST|ANAT|ANAST|AMT|AMST|ALMT|ALMST|AKST|AKDT|AFT|AEST|AESST|AEDT|ADT|ACWST|ACT|ACST|ACSST|ACDT$/, Ys = {
1643
1643
  ZULU: 0,
1644
1644
  YEKT: 18e3,
1645
1645
  YEKST: 21600,
@@ -1903,10 +1903,10 @@ function ui(t) {
1903
1903
  }
1904
1904
  }
1905
1905
  function li(t) {
1906
- const e = t.match(Kn);
1906
+ const e = t.match(qn);
1907
1907
  if (!e)
1908
1908
  return null;
1909
- const [n] = e, r = Ys[n], s = new Date(t.replace(Kn, "Z"));
1909
+ const [n] = e, r = Ys[n], s = new Date(t.replace(qn, "Z"));
1910
1910
  return new Date(s.getTime() - r * 1e3);
1911
1911
  }
1912
1912
  const fi = [
@@ -1931,7 +1931,7 @@ function di(t, e) {
1931
1931
  return null;
1932
1932
  }
1933
1933
  }
1934
- function Lt(t) {
1934
+ function Ft(t) {
1935
1935
  for (const e of fi) {
1936
1936
  const n = di(e, t);
1937
1937
  if (n)
@@ -1942,19 +1942,19 @@ function Lt(t) {
1942
1942
  function hi(t) {
1943
1943
  try {
1944
1944
  const e = JSON.parse(t);
1945
- return typeof e == "string" ? Lt(e) : null;
1945
+ return typeof e == "string" ? Ft(e) : null;
1946
1946
  } catch {
1947
1947
  return null;
1948
1948
  }
1949
1949
  }
1950
- function ut(t) {
1950
+ function lt(t) {
1951
1951
  if (t !== void 0) {
1952
1952
  if (t === null)
1953
1953
  return null;
1954
1954
  if (t instanceof Date)
1955
1955
  return t;
1956
1956
  if (typeof t == "string") {
1957
- const e = Lt(t) || hi(t) || Lt(t.trim());
1957
+ const e = Ft(t) || hi(t) || Ft(t.trim());
1958
1958
  if (!e)
1959
1959
  throw new Error(`Unable to parse \`${t}\` as a date.`);
1960
1960
  return e;
@@ -1994,7 +1994,7 @@ class ye {
1994
1994
  return this._blobAttrs;
1995
1995
  this._blobAttrs = /* @__PURE__ */ new Map();
1996
1996
  for (const e of Object.values(this.attrs))
1997
- if (on(e)) {
1997
+ if (an(e)) {
1998
1998
  const [n, r, s] = e["forward-identity"];
1999
1999
  Q(this.blobAttrs, [r, s], e);
2000
2000
  }
@@ -2041,10 +2041,10 @@ class ye {
2041
2041
  function pi(t) {
2042
2042
  return t.cardinality === "one";
2043
2043
  }
2044
- function sn(t) {
2044
+ function on(t) {
2045
2045
  return t["value-type"] === "ref";
2046
2046
  }
2047
- function on(t) {
2047
+ function an(t) {
2048
2048
  return t["value-type"] === "blob";
2049
2049
  }
2050
2050
  function ke(t, e) {
@@ -2070,7 +2070,7 @@ function Q(t, e, n) {
2070
2070
  }
2071
2071
  s > -1 && r.set(e[s], n);
2072
2072
  }
2073
- function kr(t, e, n) {
2073
+ function Pr(t, e, n) {
2074
2074
  const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
2075
2075
  for (const o of e) {
2076
2076
  let [a, c, u] = o;
@@ -2079,11 +2079,11 @@ function kr(t, e, n) {
2079
2079
  console.warn("no such attr", c, a);
2080
2080
  continue;
2081
2081
  }
2082
- l["checked-data-type"] === "date" && n && (u = ut(u), o[2] = u), sn(l) && Q(i, [u, c, a], o), Q(r, [a, c, u], o), Q(s, [c, a, u], o);
2082
+ l["checked-data-type"] === "date" && n && (u = lt(u), o[2] = u), on(l) && Q(i, [u, c, a], o), Q(r, [a, c, u], o), Q(s, [c, a, u], o);
2083
2083
  }
2084
2084
  return { eav: r, aev: s, vae: i };
2085
2085
  }
2086
- function Pr(t) {
2086
+ function Cr(t) {
2087
2087
  return {
2088
2088
  triples: B(t.eav, 3),
2089
2089
  cardinalityInference: t.cardinalityInference,
@@ -2091,10 +2091,10 @@ function Pr(t) {
2091
2091
  version: 1
2092
2092
  };
2093
2093
  }
2094
- function Cr(t, e) {
2094
+ function Ir(t, e) {
2095
2095
  return xe(t, e.triples, e.cardinalityInference, e.useDateObjects);
2096
2096
  }
2097
- function Ir(t, e) {
2097
+ function Mr(t, e) {
2098
2098
  if (t)
2099
2099
  return new ye(t.attrs, t.linkIndex);
2100
2100
  if (e && "__type" in e)
@@ -2104,7 +2104,7 @@ function yi(t, e) {
2104
2104
  return ke(t.eav, [e]) !== void 0;
2105
2105
  }
2106
2106
  function xe(t, e, n, r) {
2107
- const s = kr(t, e, r);
2107
+ const s = Pr(t, e, r);
2108
2108
  return s.cardinalityInference = n, s.useDateObjects = r, s;
2109
2109
  }
2110
2110
  function Ve(t, e) {
@@ -2134,21 +2134,21 @@ function Ve(t, e) {
2134
2134
  return [n, ...a];
2135
2135
  }
2136
2136
  }
2137
- function Mr(t, e, n) {
2137
+ function jr(t, e, n) {
2138
2138
  const r = Ve(t, n);
2139
2139
  if (!r)
2140
2140
  return;
2141
2141
  const [s, i, o] = r, a = e.getAttr(i);
2142
- a && (ee(t.eav, [s, i, o]), ee(t.aev, [i, s, o]), sn(a) && ee(t.vae, [o, i, s]));
2142
+ a && (ee(t.eav, [s, i, o]), ee(t.aev, [i, s, o]), on(a) && ee(t.vae, [o, i, s]));
2143
2143
  }
2144
2144
  let bi = 0;
2145
- function jr(t, e, n) {
2145
+ function Rr(t, e, n) {
2146
2146
  const [r, s, i] = n;
2147
2147
  let o;
2148
2148
  const a = ke(t.eav, [r, s, i]);
2149
2149
  return a && (o = a[3]), o || Date.now() * 10 + bi++;
2150
2150
  }
2151
- function Rr(t, e, n) {
2151
+ function $r(t, e, n) {
2152
2152
  const r = Ve(t, n);
2153
2153
  if (!r)
2154
2154
  return;
@@ -2156,9 +2156,9 @@ function Rr(t, e, n) {
2156
2156
  const a = e.getAttr(i);
2157
2157
  if (!a)
2158
2158
  return;
2159
- a["checked-data-type"] === "date" && t.useDateObjects && (o = ut(o));
2160
- const c = ke(t.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? jr(t, a, r), l = [s, i, o, u];
2161
- pi(a) ? (Q(t.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), Q(t.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (Q(t.eav, [s, i, o], l), Q(t.aev, [i, s, o], l)), sn(a) && Q(t.vae, [o, i, s], l);
2159
+ a["checked-data-type"] === "date" && t.useDateObjects && (o = lt(o));
2160
+ const c = ke(t.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? Rr(t, a, r), l = [s, i, o, u];
2161
+ pi(a) ? (Q(t.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), Q(t.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (Q(t.eav, [s, i, o], l), Q(t.aev, [i, s, o], l)), on(a) && Q(t.vae, [o, i, s], l);
2162
2162
  }
2163
2163
  function _i(t, e, n) {
2164
2164
  var y;
@@ -2168,7 +2168,7 @@ function _i(t, e, n) {
2168
2168
  const [s, i, o] = r, a = e.getAttr(i);
2169
2169
  if (!a)
2170
2170
  return;
2171
- if (!on(a))
2171
+ if (!an(a))
2172
2172
  throw new Error("merge operation is not supported for links");
2173
2173
  const c = ke(t.eav, [s, i]);
2174
2174
  if (!c)
@@ -2176,15 +2176,15 @@ function _i(t, e, n) {
2176
2176
  const u = (y = c.values().next()) == null ? void 0 : y.value;
2177
2177
  if (!u)
2178
2178
  return;
2179
- const l = u[2], d = Or(l, o), h = [
2179
+ const l = u[2], d = Er(l, o), h = [
2180
2180
  s,
2181
2181
  i,
2182
2182
  d,
2183
- jr(t, a, u)
2183
+ Rr(t, a, u)
2184
2184
  ];
2185
2185
  Q(t.eav, [s, i], /* @__PURE__ */ new Map([[d, h]])), Q(t.aev, [i, s], /* @__PURE__ */ new Map([[d, h]]));
2186
2186
  }
2187
- function Ft(t, e, n) {
2187
+ function Nt(t, e, n) {
2188
2188
  var u, l;
2189
2189
  const [r, s] = n, i = Ve(t, [r]);
2190
2190
  if (!i)
@@ -2195,7 +2195,7 @@ function Ft(t, e, n) {
2195
2195
  const h = e.getAttr(d);
2196
2196
  h && h["on-delete-reverse"] === "cascade" && B(a.get(d), 1).forEach(([y, b, g]) => {
2197
2197
  var w;
2198
- return Ft(t, e, [g, (w = h["reverse-identity"]) == null ? void 0 : w[1]]);
2198
+ return Nt(t, e, [g, (w = h["reverse-identity"]) == null ? void 0 : w[1]]);
2199
2199
  }), // Fall back to deleting everything if we've rehydrated tx-steps from
2200
2200
  // the store that didn't set `etype` in deleteEntity
2201
2201
  (!s || // If we don't know about the attr, let's just get rid of it
@@ -2208,11 +2208,11 @@ function Ft(t, e, n) {
2208
2208
  c && c.forEach((d) => {
2209
2209
  var w, m, T;
2210
2210
  const [h, y, b] = d, g = e.getAttr(y);
2211
- (!s || !g || ((w = g["reverse-identity"]) == null ? void 0 : w[1]) === s) && (ee(t.eav, [h, y, b]), ee(t.aev, [y, h, b]), ee(t.vae, [b, y, h])), g && g["on-delete"] === "cascade" && ((m = g["reverse-identity"]) == null ? void 0 : m[1]) === s && Ft(t, e, [h, (T = g["forward-identity"]) == null ? void 0 : T[1]]);
2211
+ (!s || !g || ((w = g["reverse-identity"]) == null ? void 0 : w[1]) === s) && (ee(t.eav, [h, y, b]), ee(t.aev, [y, h, b]), ee(t.vae, [b, y, h])), g && g["on-delete"] === "cascade" && ((m = g["reverse-identity"]) == null ? void 0 : m[1]) === s && Nt(t, e, [h, (T = g["forward-identity"]) == null ? void 0 : T[1]]);
2212
2212
  }), ((l = t.vae.get(o)) == null ? void 0 : l.size) === 0 && ee(t.vae, [o]);
2213
2213
  }
2214
- function $r(t, e, n) {
2215
- const r = kr(e, n, t.useDateObjects);
2214
+ function Dr(t, e, n) {
2215
+ const r = Pr(e, n, t.useDateObjects);
2216
2216
  Object.keys(r).forEach((s) => {
2217
2217
  t[s] = r[s];
2218
2218
  });
@@ -2220,32 +2220,32 @@ function $r(t, e, n) {
2220
2220
  function gi(t, [e]) {
2221
2221
  t.addAttr(e);
2222
2222
  }
2223
- function Dr(t) {
2223
+ function xr(t) {
2224
2224
  return B(t.eav, 3);
2225
2225
  }
2226
2226
  function Ti(t, e, [n]) {
2227
2227
  if (!e.getAttr(n))
2228
2228
  return;
2229
- const r = Dr(t).filter(([s, i]) => i !== n);
2230
- e.deleteAttr(n), $r(t, e, r);
2229
+ const r = xr(t).filter(([s, i]) => i !== n);
2230
+ e.deleteAttr(n), Dr(t, e, r);
2231
2231
  }
2232
2232
  function wi(t, e, [n]) {
2233
- e.getAttr(n.id) && (e.updateAttr(n), $r(t, e, Dr(t)));
2233
+ e.getAttr(n.id) && (e.updateAttr(n), Dr(t, e, xr(t)));
2234
2234
  }
2235
2235
  function mi(t, e, n) {
2236
2236
  const [r, ...s] = n;
2237
2237
  switch (r) {
2238
2238
  case "add-triple":
2239
- Rr(t, e, s);
2239
+ $r(t, e, s);
2240
2240
  break;
2241
2241
  case "deep-merge-triple":
2242
2242
  _i(t, e, s);
2243
2243
  break;
2244
2244
  case "retract-triple":
2245
- Mr(t, e, s);
2245
+ jr(t, e, s);
2246
2246
  break;
2247
2247
  case "delete-entity":
2248
- Ft(t, e, s);
2248
+ Nt(t, e, s);
2249
2249
  break;
2250
2250
  case "add-attr":
2251
2251
  gi(e, s);
@@ -2384,7 +2384,7 @@ function Te(t, e, n) {
2384
2384
  function Oi(t, e) {
2385
2385
  return t.blobAttrs.get(e);
2386
2386
  }
2387
- function xr(t, e) {
2387
+ function Ur(t, e) {
2388
2388
  var r;
2389
2389
  const n = t.primaryKeys.get(e);
2390
2390
  return n || ((r = t.forwardIdents.get(e)) == null ? void 0 : r.get("id"));
@@ -2407,7 +2407,7 @@ function ki(t, e, n) {
2407
2407
  let l = !1;
2408
2408
  const d = e.getAttr(o);
2409
2409
  if (d) {
2410
- const h = xr(e, d["forward-identity"][1]);
2410
+ const h = Ur(e, d["forward-identity"][1]);
2411
2411
  l = !!Ei(t, e, [
2412
2412
  i,
2413
2413
  h == null ? void 0 : h.id,
@@ -2416,7 +2416,7 @@ function ki(t, e, n) {
2416
2416
  }
2417
2417
  return !(u === "create" && l || u === "update" && !l);
2418
2418
  });
2419
- return ot({ store: t, attrsStore: e }, (s) => {
2419
+ return at({ store: t, attrsStore: e }, (s) => {
2420
2420
  r.forEach((i) => {
2421
2421
  mi(s.store, s.attrsStore, i);
2422
2422
  });
@@ -2433,19 +2433,19 @@ function Pi(t) {
2433
2433
  function Ci(t, e, n) {
2434
2434
  if (n.hasOwnProperty(t)) {
2435
2435
  const r = n[t];
2436
- return Ur(r, e, n);
2436
+ return Lr(r, e, n);
2437
2437
  }
2438
2438
  return { ...n, [t]: e };
2439
2439
  }
2440
- function qn(t, e, n) {
2440
+ function zn(t, e, n) {
2441
2441
  return t === e ? n : null;
2442
2442
  }
2443
2443
  function Ii(t) {
2444
2444
  switch (typeof t) {
2445
2445
  case "string":
2446
- return t.startsWith("?") ? Ci : qn;
2446
+ return t.startsWith("?") ? Ci : zn;
2447
2447
  default:
2448
- return qn;
2448
+ return zn;
2449
2449
  }
2450
2450
  }
2451
2451
  const Mi = [
@@ -2462,32 +2462,32 @@ function ji(t) {
2462
2462
  return !0;
2463
2463
  return !1;
2464
2464
  }
2465
- function Ur(t, e, n) {
2465
+ function Lr(t, e, n) {
2466
2466
  return n ? typeof t == "object" ? ji(t) ? n : null : Ii(t)(t, e, n) : null;
2467
2467
  }
2468
2468
  function Ri(t, e, n) {
2469
2469
  return t.reduce((r, s, i) => {
2470
2470
  const o = e[i];
2471
- return Ur(s, o, r);
2471
+ return Lr(s, o, r);
2472
2472
  }, n);
2473
2473
  }
2474
2474
  function $i(t, e, n) {
2475
2475
  return Ui(t, e, n).map((r) => Ri(e, r, n)).filter((r) => r);
2476
2476
  }
2477
2477
  function Di(t, e, n) {
2478
- return e.or ? e.or.patterns.flatMap((r) => Nt(t, r, n)) : e.and ? e.and.patterns.reduce((r, s) => Nt(t, s, r), n) : n.flatMap((r) => $i(t, e, r));
2478
+ return e.or ? e.or.patterns.flatMap((r) => Kt(t, r, n)) : e.and ? e.and.patterns.reduce((r, s) => Kt(t, s, r), n) : n.flatMap((r) => $i(t, e, r));
2479
2479
  }
2480
- function Nt(t, e, n = [{}]) {
2480
+ function Kt(t, e, n = [{}]) {
2481
2481
  return e.reduce((r, s) => Di(t, s, r), n);
2482
2482
  }
2483
- function an(t, e) {
2484
- return Array.isArray(e) ? e.map((n) => an(t, n)) : Pi(e) ? t[e] : e;
2483
+ function cn(t, e) {
2484
+ return Array.isArray(e) ? e.map((n) => cn(t, n)) : Pi(e) ? t[e] : e;
2485
2485
  }
2486
2486
  function xi(t, { find: e, where: n }) {
2487
- return Nt(t, n).map((s) => an(s, e));
2487
+ return Kt(t, n).map((s) => cn(s, e));
2488
2488
  }
2489
2489
  function Ui(t, e, n) {
2490
- return vi(t, an(n, e));
2490
+ return vi(t, cn(n, e));
2491
2491
  }
2492
2492
  const Li = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
2493
2493
  function Ae(t) {
@@ -2499,28 +2499,28 @@ for (let t = 0; t < 256; ++t)
2499
2499
  function Fi(t, e = 0) {
2500
2500
  return (K[t[e + 0]] + K[t[e + 1]] + K[t[e + 2]] + K[t[e + 3]] + "-" + K[t[e + 4]] + K[t[e + 5]] + "-" + K[t[e + 6]] + K[t[e + 7]] + "-" + K[t[e + 8]] + K[t[e + 9]] + "-" + K[t[e + 10]] + K[t[e + 11]] + K[t[e + 12]] + K[t[e + 13]] + K[t[e + 14]] + K[t[e + 15]]).toLowerCase();
2501
2501
  }
2502
- let vt;
2502
+ let At;
2503
2503
  const Ni = new Uint8Array(16);
2504
2504
  function Ki() {
2505
- if (!vt) {
2505
+ if (!At) {
2506
2506
  if (typeof crypto > "u" || !crypto.getRandomValues)
2507
2507
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
2508
- vt = crypto.getRandomValues.bind(crypto);
2508
+ At = crypto.getRandomValues.bind(crypto);
2509
2509
  }
2510
- return vt(Ni);
2510
+ return At(Ni);
2511
2511
  }
2512
- const qi = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), zn = { randomUUID: qi };
2512
+ const qi = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Vn = { randomUUID: qi };
2513
2513
  function zi(t, e, n) {
2514
2514
  var s;
2515
- if (zn.randomUUID && !t)
2516
- return zn.randomUUID();
2515
+ if (Vn.randomUUID && !t)
2516
+ return Vn.randomUUID();
2517
2517
  t = t || {};
2518
2518
  const r = t.random ?? ((s = t.rng) == null ? void 0 : s.call(t)) ?? Ki();
2519
2519
  if (r.length < 16)
2520
2520
  throw new Error("Random bytes length must be >= 16");
2521
2521
  return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Fi(r);
2522
2522
  }
2523
- function Vn(t) {
2523
+ function Wn(t) {
2524
2524
  const e = t.replace(/-/g, ""), n = [];
2525
2525
  for (let r = 0; r < e.length; r += 2)
2526
2526
  n.push(parseInt(e.substring(r, r + 2), 16));
@@ -2536,7 +2536,7 @@ function Vi(t, e) {
2536
2536
  return 0;
2537
2537
  }
2538
2538
  function Wi(t, e) {
2539
- return Vi(Vn(t), Vn(e));
2539
+ return Vi(Wn(t), Wn(e));
2540
2540
  }
2541
2541
  function N() {
2542
2542
  return zi();
@@ -2556,9 +2556,9 @@ function Bi() {
2556
2556
  const Gi = Bi();
2557
2557
  let Hi = 0;
2558
2558
  function Fe(t) {
2559
- return lt(`_${t}`, Hi++);
2559
+ return ft(`_${t}`, Hi++);
2560
2560
  }
2561
- function lt(t, e) {
2561
+ function ft(t, e) {
2562
2562
  return `?${t}-${e}`;
2563
2563
  }
2564
2564
  class Oe extends Error {
@@ -2567,12 +2567,12 @@ class Oe extends Error {
2567
2567
  }
2568
2568
  }
2569
2569
  function Ji(t, e) {
2570
- const n = xr(t, e);
2570
+ const n = Ur(t, e);
2571
2571
  if (!n)
2572
2572
  throw new Oe(`Could not find id attr for ${e}`);
2573
2573
  return n;
2574
2574
  }
2575
- function Wn(t, e, n, r) {
2575
+ function Qn(t, e, n, r) {
2576
2576
  return [Yi(t, e, n, r)];
2577
2577
  }
2578
2578
  function Yi(t, e, n, r) {
@@ -2586,7 +2586,7 @@ function Yi(t, e, n, r) {
2586
2586
  function Zi(t, e, n) {
2587
2587
  return t.map((r) => r === e ? n : r);
2588
2588
  }
2589
- function Lr(t, e, n, r, s) {
2589
+ function Fr(t, e, n, r, s) {
2590
2590
  const i = U(e, n, s), o = Te(e, n, s), a = i || o;
2591
2591
  if (!a)
2592
2592
  throw new Oe(`Could not find attr for ${[n, s]}`);
@@ -2605,7 +2605,7 @@ function Lr(t, e, n, r, s) {
2605
2605
  ];
2606
2606
  return [i ? d : u, h, y, a, !!i];
2607
2607
  }
2608
- function Qn(t, e) {
2608
+ function Bn(t, e) {
2609
2609
  if (typeof e != "string")
2610
2610
  return function(o) {
2611
2611
  return !1;
@@ -2656,7 +2656,7 @@ function Xi(t, e) {
2656
2656
  }
2657
2657
  };
2658
2658
  if (e.hasOwnProperty("$like")) {
2659
- const r = Qn(!0, e.$like);
2659
+ const r = Bn(!0, e.$like);
2660
2660
  return {
2661
2661
  $comparator: !0,
2662
2662
  $op: function(i) {
@@ -2665,7 +2665,7 @@ function Xi(t, e) {
2665
2665
  };
2666
2666
  }
2667
2667
  if (e.hasOwnProperty("$ilike")) {
2668
- const r = Qn(!1, e.$ilike);
2668
+ const r = Bn(!1, e.$ilike);
2669
2669
  return {
2670
2670
  $comparator: !0,
2671
2671
  $op: function(i) {
@@ -2699,12 +2699,12 @@ function eo(t, e, n, r, s, i) {
2699
2699
  }
2700
2700
  function to(t, e, n, r, s) {
2701
2701
  const [i, o, a] = s.reduce((c, u) => {
2702
- const [l, d, h] = c, [y, b, g] = Lr(t, e, l, d, u);
2702
+ const [l, d, h] = c, [y, b, g] = Fr(t, e, l, d, u);
2703
2703
  return [y, b, [...h, g]];
2704
2704
  }, [n, r, []]);
2705
2705
  return [i, o, a];
2706
2706
  }
2707
- function Kt(t, e, n, r, s, i) {
2707
+ function qt(t, e, n, r, s, i) {
2708
2708
  const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = to(t, e, n, r, o), d = eo(t, e, c, u, a, i);
2709
2709
  return l.concat([d]);
2710
2710
  }
@@ -2723,10 +2723,10 @@ function io(t, e, n) {
2723
2723
  return e == i ? i : `${i}-${n}`;
2724
2724
  };
2725
2725
  }
2726
- function Bn(t, e, n, r, s, i) {
2726
+ function Gn(t, e, n, r, s, i) {
2727
2727
  const o = t(r, s), a = i.map((c, u) => {
2728
2728
  const l = io(t, o, u);
2729
- return Fr(l, n, r, s, c);
2729
+ return Nr(l, n, r, s, c);
2730
2730
  });
2731
2731
  return { [e]: { patterns: a, joinSym: o } };
2732
2732
  }
@@ -2736,22 +2736,22 @@ function oo(t) {
2736
2736
  e.push(t.slice(0, n));
2737
2737
  return e;
2738
2738
  }
2739
- function Gn(t, e, n, r, s) {
2740
- return oo(s).map((i) => Kt(t, e, n, r, i, {
2739
+ function Hn(t, e, n, r, s) {
2740
+ return oo(s).map((i) => qt(t, e, n, r, i, {
2741
2741
  $isNull: !0
2742
2742
  }));
2743
2743
  }
2744
- function Fr(t, e, n, r, s) {
2744
+ function Nr(t, e, n, r, s) {
2745
2745
  return Object.entries(s).flatMap(([i, o]) => {
2746
2746
  if (ro([i, o]))
2747
- return Bn(t, "or", e, n, r, o);
2747
+ return Gn(t, "or", e, n, r, o);
2748
2748
  if (so([i, o]))
2749
- return Bn(t, "and", e, n, r, o);
2749
+ return Gn(t, "and", e, n, r, o);
2750
2750
  if (i === "$entityIdStartsWith")
2751
2751
  return [];
2752
2752
  const a = i.split(".");
2753
2753
  if (o != null && o.hasOwnProperty("$ne") && (o = { ...o, $not: o.$ne }, delete o.$ne), o != null && o.hasOwnProperty("$not")) {
2754
- const c = Kt(t, e, n, r, a, o), u = Gn(t, e, n, r, a);
2754
+ const c = qt(t, e, n, r, a, o), u = Hn(t, e, n, r, a);
2755
2755
  return [
2756
2756
  {
2757
2757
  or: {
@@ -2764,22 +2764,22 @@ function Fr(t, e, n, r, s) {
2764
2764
  return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && a.length > 1 ? [
2765
2765
  {
2766
2766
  or: {
2767
- patterns: Gn(t, e, n, r, a),
2767
+ patterns: Hn(t, e, n, r, a),
2768
2768
  joinSym: t(n, r)
2769
2769
  }
2770
2770
  }
2771
- ] : Kt(t, e, n, r, a, o);
2771
+ ] : qt(t, e, n, r, a, o);
2772
2772
  });
2773
2773
  }
2774
2774
  function ao(t, e, n, r) {
2775
- const s = lt;
2776
- return r ? Fr(s, t, e, n, r).concat(Wn(s, t, e, n)) : Wn(s, t, e, n);
2775
+ const s = ft;
2776
+ return r ? Nr(s, t, e, n, r).concat(Qn(s, t, e, n)) : Qn(s, t, e, n);
2777
2777
  }
2778
2778
  function co(t, e, n) {
2779
2779
  return [t(e, n), t("time", n)];
2780
2780
  }
2781
2781
  function uo(t, e, n, r, s, i) {
2782
- const [o, a, c, u, l] = Lr(t, e, n, r, s), d = Zi(c, t(n, r), i);
2782
+ const [o, a, c, u, l] = Fr(t, e, n, r, s), d = Zi(c, t(n, r), i);
2783
2783
  return [o, a, d, u, l];
2784
2784
  }
2785
2785
  function lo(t, e, n, { etype: r, level: s, form: i }, o) {
@@ -2789,7 +2789,7 @@ function lo(t, e, n, { etype: r, level: s, form: i }, o) {
2789
2789
  var g, w, m;
2790
2790
  const b = !!(e.cardinalityInference && ((m = (w = (g = n.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : w[y]) != null && m.isSingular));
2791
2791
  try {
2792
- const [T, v, E] = uo(t, n, r, s, y, u), A = Kr(e, n, {
2792
+ const [T, v, E] = uo(t, n, r, s, y, u), A = qr(e, n, {
2793
2793
  etype: T,
2794
2794
  level: v,
2795
2795
  form: i[y],
@@ -2812,19 +2812,19 @@ function fo(t, e, n) {
2812
2812
  function Ue(t, e, n, r, s) {
2813
2813
  return e === r || e == null && r == null ? Wi(t, n) : r == null ? 1 : e == null ? -1 : fo(e, r, s);
2814
2814
  }
2815
- function at([t, e], [n, r], s) {
2815
+ function ct([t, e], [n, r], s) {
2816
2816
  return Ue(t, e, n, r, s);
2817
2817
  }
2818
- function qt(t) {
2818
+ function zt(t) {
2819
2819
  return t == null ? t : new Date(t).getTime();
2820
2820
  }
2821
2821
  function ho(t, e, n, r) {
2822
2822
  var b;
2823
2823
  const [s, i, o, a] = t, c = n === "desc" ? 1 : -1;
2824
2824
  if (((b = e["forward-identity"]) == null ? void 0 : b[2]) === "id")
2825
- return at(r, [s, a], null) === c;
2826
- const [u, l] = r, d = e["checked-data-type"], h = d === "date" ? qt(l) : l, y = d === "date" ? qt(o) : o;
2827
- return at([u, h], [s, y], d) === c;
2825
+ return ct(r, [s, a], null) === c;
2826
+ const [u, l] = r, d = e["checked-data-type"], h = d === "date" ? zt(l) : l, y = d === "date" ? zt(o) : o;
2827
+ return ct([u, h], [s, y], d) === c;
2828
2828
  }
2829
2829
  function po(t, e) {
2830
2830
  const n = e[1];
@@ -2847,7 +2847,7 @@ function _o(t, e, n) {
2847
2847
  const r = /* @__PURE__ */ new Map();
2848
2848
  for (const o of n.fields) {
2849
2849
  const a = U(t, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
2850
- c && on(a) && r.set(c, a);
2850
+ c && an(a) && r.set(c, a);
2851
2851
  }
2852
2852
  if (!r.has("id")) {
2853
2853
  const o = U(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
@@ -2857,7 +2857,7 @@ function _o(t, e, n) {
2857
2857
  }
2858
2858
  function go(t, e, { etype: n, pageInfo: r, dq: s, form: i }) {
2859
2859
  var b, g;
2860
- const o = (b = i == null ? void 0 : i.$) == null ? void 0 : b.order, a = Nr(i), c = To(i);
2860
+ const o = (b = i == null ? void 0 : i.$) == null ? void 0 : b.order, a = Kr(i), c = To(i);
2861
2861
  let u = xi(t, s);
2862
2862
  const l = r == null ? void 0 : r["start-cursor"], d = bo(e, n, l, o);
2863
2863
  if (d && ((g = d == null ? void 0 : d["forward-identity"]) == null ? void 0 : g[2]) !== "id") {
@@ -2865,13 +2865,13 @@ function go(t, e, { etype: n, pageInfo: r, dq: s, form: i }) {
2865
2865
  u = u.map(([T]) => {
2866
2866
  var E, A, j, L, q;
2867
2867
  let v = (q = (L = (j = (A = (E = t.eav.get(T)) == null ? void 0 : E.get(m)) == null ? void 0 : A.values()) == null ? void 0 : j.next()) == null ? void 0 : L.value) == null ? void 0 : q[2];
2868
- return w && (v = qt(v)), [T, v];
2868
+ return w && (v = zt(v)), [T, v];
2869
2869
  });
2870
2870
  }
2871
2871
  u.sort(c === "asc" ? function(m, T) {
2872
- return at(m, T, d == null ? void 0 : d["checked-data-type"]);
2872
+ return ct(m, T, d == null ? void 0 : d["checked-data-type"]);
2873
2873
  } : function(m, T) {
2874
- return at(T, m, d == null ? void 0 : d["checked-data-type"]);
2874
+ return ct(T, m, d == null ? void 0 : d["checked-data-type"]);
2875
2875
  });
2876
2876
  let h = {};
2877
2877
  const y = _o(e, n, s);
@@ -2889,16 +2889,16 @@ function To(t) {
2889
2889
  const e = (n = t.$) == null ? void 0 : n.order;
2890
2890
  return e && e[Object.keys(e)[0]] || "asc";
2891
2891
  }
2892
- function Nr(t) {
2892
+ function Kr(t) {
2893
2893
  var s, i, o;
2894
2894
  const e = (s = t.$) == null ? void 0 : s.offset, n = (i = t.$) == null ? void 0 : i.before, r = (o = t.$) == null ? void 0 : o.after;
2895
2895
  return !e && !n && !r;
2896
2896
  }
2897
2897
  function wo(t, e, { etype: n, level: r, form: s, join: i, pageInfo: o }) {
2898
2898
  var h, y, b, g, w;
2899
- if (!Nr(s) && (!o || !o["start-cursor"]))
2899
+ if (!Kr(s) && (!o || !o["start-cursor"]))
2900
2900
  return [];
2901
- const a = no(ao(e, n, r, (h = s.$) == null ? void 0 : h.where), i), c = co(lt, n, r), u = (y = s.$) == null ? void 0 : y.fields, l = go(t, e, {
2901
+ const a = no(ao(e, n, r, (h = s.$) == null ? void 0 : h.where), i), c = co(ft, n, r), u = (y = s.$) == null ? void 0 : y.fields, l = go(t, e, {
2902
2902
  etype: n,
2903
2903
  pageInfo: o,
2904
2904
  form: s,
@@ -2920,9 +2920,9 @@ function mo(t, e, n) {
2920
2920
  throw r;
2921
2921
  }
2922
2922
  }
2923
- function Kr(t, e, n) {
2923
+ function qr(t, e, n) {
2924
2924
  const r = mo(t, e, n);
2925
- return lo(lt, t, e, n, r);
2925
+ return lo(ft, t, e, n, r);
2926
2926
  }
2927
2927
  function So(t) {
2928
2928
  const e = {};
@@ -2935,9 +2935,9 @@ function So(t) {
2935
2935
  };
2936
2936
  return e;
2937
2937
  }
2938
- function qr({ store: t, attrsStore: e, pageInfo: n, aggregate: r }, s) {
2938
+ function zr({ store: t, attrsStore: e, pageInfo: n, aggregate: r }, s) {
2939
2939
  const o = { data: Object.keys(s).reduce(function(c, u) {
2940
- return r != null && r[u] || u === "$$ruleParams" || (c[u] = Kr(t, e, {
2940
+ return r != null && r[u] || u === "$$ruleParams" || (c[u] = qr(t, e, {
2941
2941
  etype: u,
2942
2942
  form: s[u],
2943
2943
  level: 0,
@@ -2961,7 +2961,7 @@ function vo() {
2961
2961
  return new Set(Object.keys(e));
2962
2962
  }
2963
2963
  const Ao = vo();
2964
- function zt(t, e, n) {
2964
+ function st(t, e, n) {
2965
2965
  const r = {
2966
2966
  __etype: t,
2967
2967
  __ops: n
@@ -2973,44 +2973,49 @@ function zt(t, e, n) {
2973
2973
  if (i === "__etype")
2974
2974
  return t;
2975
2975
  if (Ao.has(i))
2976
- return (o, a) => zt(t, e, [
2976
+ return (o, a) => st(t, e, [
2977
2977
  ...n,
2978
2978
  a ? [i, t, e, o, a] : [i, t, e, o]
2979
2979
  ]);
2980
2980
  }
2981
2981
  });
2982
2982
  }
2983
- function ct(t) {
2983
+ function Oo(t, e) {
2984
+ return `lookup__${t}__${JSON.stringify(e)}`;
2985
+ }
2986
+ function ut(t) {
2984
2987
  return t.startsWith("lookup__");
2985
2988
  }
2986
- function zr(t) {
2989
+ function Vt(t) {
2987
2990
  const [e, n, ...r] = t.split("__");
2988
2991
  return [n, JSON.parse(r.join("__"))];
2989
2992
  }
2990
- function Oo(t) {
2993
+ function Eo(t) {
2991
2994
  return new Proxy({
2992
2995
  __etype: t
2993
2996
  }, {
2994
2997
  get(e, n) {
2998
+ if (n === "lookup")
2999
+ return (s, i) => st(t, Vt(Oo(s, i)), []);
2995
3000
  if (n === "__etype")
2996
3001
  return t;
2997
3002
  const r = n;
2998
- return ct(r) ? zt(t, zr(r), []) : zt(t, r, []);
3003
+ return ut(r) ? st(t, Vt(r), []) : st(t, r, []);
2999
3004
  }
3000
3005
  });
3001
3006
  }
3002
- function cn() {
3007
+ function un() {
3003
3008
  return new Proxy({}, {
3004
3009
  get(t, e) {
3005
- return Oo(e);
3010
+ return Eo(e);
3006
3011
  }
3007
3012
  });
3008
3013
  }
3009
- cn();
3010
- function Eo(t) {
3014
+ un();
3015
+ function ko(t) {
3011
3016
  return t.__ops;
3012
3017
  }
3013
- function ko(t, e) {
3018
+ function Po(t, e) {
3014
3019
  const { attrIdMap: n, refSwapAttrIds: r } = t, s = [];
3015
3020
  for (const o of e) {
3016
3021
  const a = n[o];
@@ -3029,7 +3034,7 @@ function ko(t, e) {
3029
3034
  }
3030
3035
  return s;
3031
3036
  }
3032
- function Po(t) {
3037
+ function Co(t) {
3033
3038
  if (Array.isArray(t))
3034
3039
  return t;
3035
3040
  const e = Object.entries(t);
@@ -3037,33 +3042,33 @@ function Po(t) {
3037
3042
  throw new Error("lookup must be an object with a single unique attr and value.");
3038
3043
  return e[0];
3039
3044
  }
3040
- function Co(t, e, n) {
3045
+ function Io(t, e, n) {
3041
3046
  return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
3042
3047
  // before assuming it's a ref lookup.
3043
3048
  !U(t, e, n);
3044
3049
  }
3045
- function Vt(t) {
3050
+ function Wt(t) {
3046
3051
  const [e, n, ...r] = t.split(".");
3047
3052
  if (r.length > 0 || n !== "id")
3048
3053
  throw new Error(`${t} is not a valid lookup attribute.`);
3049
3054
  return e;
3050
3055
  }
3051
- function Io(t, e, n) {
3052
- if (!Co(t, e, n))
3056
+ function Mo(t, e, n) {
3057
+ if (!Io(t, e, n))
3053
3058
  return U(t, e, n);
3054
- const r = Vt(n), s = U(t, e, r) || Te(t, e, r);
3059
+ const r = Wt(n), s = U(t, e, r) || Te(t, e, r);
3055
3060
  if (s && s["value-type"] !== "ref")
3056
3061
  throw new Error(`${n} does not reference a valid link attribute.`);
3057
3062
  return s;
3058
3063
  }
3059
- function Wt(t) {
3060
- return typeof t == "string" && !ct(t) ? null : typeof t == "string" && ct(t) ? zr(t) : Po(t);
3064
+ function Qt(t) {
3065
+ return typeof t == "string" && !ut(t) ? null : typeof t == "string" && ut(t) ? Vt(t) : Co(t);
3061
3066
  }
3062
3067
  function G(t, e, n) {
3063
- const r = Wt(n);
3068
+ const r = Qt(n);
3064
3069
  if (r === null)
3065
3070
  return n;
3066
- const [s, i] = r, o = Io(t, e, s);
3071
+ const [s, i] = r, o = Mo(t, e, s);
3067
3072
  if (!o || !o["unique?"])
3068
3073
  throw new Error(`${s} is not a unique attribute.`);
3069
3074
  return [o.id, i];
@@ -3078,7 +3083,7 @@ function Vr(t, e, n, r) {
3078
3083
  s
3079
3084
  ]].concat(r) : r;
3080
3085
  }
3081
- function Mo({ attrsStore: t }, [e, n, r]) {
3086
+ function jo({ attrsStore: t }, [e, n, r]) {
3082
3087
  const s = Object.entries(r).flatMap(([i, o]) => {
3083
3088
  const a = Array.isArray(o) ? o : [o], c = U(t, e, i), u = Te(t, e, i);
3084
3089
  return a.map((l) => c ? [
@@ -3099,7 +3104,7 @@ function Mo({ attrsStore: t }, [e, n, r]) {
3099
3104
  });
3100
3105
  return Vr(t, e, n, s);
3101
3106
  }
3102
- function jo({ attrsStore: t }, [e, n, r]) {
3107
+ function Ro({ attrsStore: t }, [e, n, r]) {
3103
3108
  const s = Object.entries(r).flatMap(([i, o]) => {
3104
3109
  const a = Array.isArray(o) ? o : [o], c = U(t, e, i), u = Te(t, e, i);
3105
3110
  return a.map((l) => c ? [
@@ -3120,7 +3125,7 @@ function jo({ attrsStore: t }, [e, n, r]) {
3120
3125
  });
3121
3126
  return Vr(t, e, n, s);
3122
3127
  }
3123
- function Ro(t, e, n, r) {
3128
+ function $o(t, e, n, r) {
3124
3129
  var s;
3125
3130
  if (Array.isArray(r)) {
3126
3131
  const [i, o] = r;
@@ -3144,20 +3149,20 @@ function Ro(t, e, n, r) {
3144
3149
  return !1;
3145
3150
  }
3146
3151
  function Wr({ stores: t, attrsStore: e }, [n, r, s, i]) {
3147
- return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : Ro(t, e, n, r) ? { mode: "update" } : null;
3152
+ return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : $o(t, e, n, r) ? { mode: "update" } : null;
3148
3153
  }
3149
- function $o(t, e) {
3150
- const { attrsStore: n } = t, [r, s, i, o] = e, a = rn(i), c = G(n, r, s);
3154
+ function Do(t, e) {
3155
+ const { attrsStore: n } = t, [r, s, i, o] = e, a = sn(i), c = G(n, r, s);
3151
3156
  return [["id", c]].concat(Object.entries(a)).map(([l, d]) => {
3152
3157
  const h = U(n, r, l);
3153
- return h["checked-data-type"] === "date" && t.useDateObjects && (d = ut(d)), ["add-triple", c, h.id, d, { mode: "create" }];
3158
+ return h["checked-data-type"] === "date" && t.useDateObjects && (d = lt(d)), ["add-triple", c, h.id, d, { mode: "create" }];
3154
3159
  });
3155
3160
  }
3156
- function Do(t, e) {
3157
- const { attrsStore: n } = t, [r, s, i, o] = e, a = rn(i), c = G(n, r, s), u = Wr(t, [r, c, i, o]);
3161
+ function xo(t, e) {
3162
+ const { attrsStore: n } = t, [r, s, i, o] = e, a = sn(i), c = G(n, r, s), u = Wr(t, [r, c, i, o]);
3158
3163
  return [["id", c]].concat(Object.entries(a)).map(([d, h]) => {
3159
3164
  const y = U(n, r, d);
3160
- return y["checked-data-type"] === "date" && t.useDateObjects && (h = ut(h)), [
3165
+ return y["checked-data-type"] === "date" && t.useDateObjects && (h = lt(h)), [
3161
3166
  "add-triple",
3162
3167
  c,
3163
3168
  y.id,
@@ -3166,11 +3171,11 @@ function Do(t, e) {
3166
3171
  ];
3167
3172
  });
3168
3173
  }
3169
- function xo({ attrsStore: t }, [e, n]) {
3174
+ function Uo({ attrsStore: t }, [e, n]) {
3170
3175
  return [["delete-entity", G(t, e, n), e]];
3171
3176
  }
3172
- function Uo(t, e) {
3173
- const { attrsStore: n } = t, [r, s, i, o] = e, a = rn(i), c = G(n, r, s), u = Wr(t, [r, c, i, o]), l = Object.entries(a).map(([h, y]) => {
3177
+ function Lo(t, e) {
3178
+ const { attrsStore: n } = t, [r, s, i, o] = e, a = sn(i), c = G(n, r, s), u = Wr(t, [r, c, i, o]), l = Object.entries(a).map(([h, y]) => {
3174
3179
  const b = U(n, r, h);
3175
3180
  return [
3176
3181
  "deep-merge-triple",
@@ -3188,38 +3193,38 @@ function Uo(t, e) {
3188
3193
  ...u ? [u] : []
3189
3194
  ]].concat(l);
3190
3195
  }
3191
- function Lo({ attrsStore: t }, [e, n, r]) {
3196
+ function Fo({ attrsStore: t }, [e, n, r]) {
3192
3197
  return [["rule-params", G(t, e, n), e, r]];
3193
3198
  }
3194
- function Fo(t) {
3199
+ function No(t) {
3195
3200
  const [e, n, r, s, i] = t;
3196
3201
  if (!s)
3197
3202
  return t;
3198
3203
  const o = { ...s };
3199
3204
  return delete o.id, [e, n, r, o, ...i ? [i] : []];
3200
3205
  }
3201
- function No(t, e) {
3202
- const [n, ...r] = Fo(e);
3206
+ function Ko(t, e) {
3207
+ const [n, ...r] = No(e);
3203
3208
  switch (n) {
3204
3209
  case "merge":
3205
- return Uo(t, r);
3210
+ return Lo(t, r);
3206
3211
  case "create":
3207
- return $o(t, r);
3208
- case "update":
3209
3212
  return Do(t, r);
3213
+ case "update":
3214
+ return xo(t, r);
3210
3215
  case "link":
3211
- return Mo(t, r);
3212
- case "unlink":
3213
3216
  return jo(t, r);
3217
+ case "unlink":
3218
+ return Ro(t, r);
3214
3219
  case "delete":
3215
- return xo(t, r);
3220
+ return Uo(t, r);
3216
3221
  case "ruleParams":
3217
- return Lo(t, r);
3222
+ return Fo(t, r);
3218
3223
  default:
3219
3224
  throw new Error(`unsupported action ${n}`);
3220
3225
  }
3221
3226
  }
3222
- function Ko(t) {
3227
+ function qo(t) {
3223
3228
  switch (t) {
3224
3229
  case "string":
3225
3230
  case "date":
@@ -3230,14 +3235,14 @@ function Ko(t) {
3230
3235
  return;
3231
3236
  }
3232
3237
  }
3233
- function qo(t, e, n) {
3238
+ function zo(t, e, n) {
3234
3239
  var a, c;
3235
3240
  const r = (c = (a = t.entities[e]) == null ? void 0 : a.attrs) == null ? void 0 : c[n];
3236
3241
  if (n === "id")
3237
3242
  return null;
3238
3243
  if (!r)
3239
3244
  throw new Error(`${e}.${n} does not exist in your schema`);
3240
- const { unique: s, indexed: i } = r == null ? void 0 : r.config, o = Ko(r == null ? void 0 : r.valueType);
3245
+ const { unique: s, indexed: i } = r == null ? void 0 : r.config, o = qo(r == null ? void 0 : r.valueType);
3241
3246
  return {
3242
3247
  "index?": i,
3243
3248
  "unique?": s,
@@ -3245,7 +3250,7 @@ function qo(t, e, n) {
3245
3250
  };
3246
3251
  }
3247
3252
  function Ze(t, e, n, r) {
3248
- const s = t ? qo(t, e, n) : null, i = N(), a = [N(), e, n];
3253
+ const s = t ? zo(t, e, n) : null, i = N(), a = [N(), e, n];
3249
3254
  return {
3250
3255
  id: i,
3251
3256
  "forward-identity": a,
@@ -3258,11 +3263,11 @@ function Ze(t, e, n, r) {
3258
3263
  ...r || {}
3259
3264
  };
3260
3265
  }
3261
- function zo(t, e, n) {
3266
+ function Vo(t, e, n) {
3262
3267
  return Object.values(t.links).find((i) => i.forward.on === e && i.forward.label === n || i.reverse.on === e && i.reverse.label === n);
3263
3268
  }
3264
- function Vo(t, e, n) {
3265
- const r = zo(t, e, n);
3269
+ function Wo(t, e, n) {
3270
+ const r = Vo(t, e, n);
3266
3271
  if (!r)
3267
3272
  throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
3268
3273
  const { forward: s, reverse: i } = r;
@@ -3275,8 +3280,8 @@ function Vo(t, e, n) {
3275
3280
  "on-delete-reverse": i.onDelete
3276
3281
  };
3277
3282
  }
3278
- function Hn(t, e, n, r) {
3279
- const s = t ? Vo(t, e, n) : null, i = N(), o = [N(), e, n], a = [N(), n, e];
3283
+ function Jn(t, e, n, r) {
3284
+ const s = t ? Wo(t, e, n) : null, i = N(), o = [N(), e, n], a = [N(), n, e];
3280
3285
  return {
3281
3286
  id: i,
3282
3287
  // @ts-ignore: ts thinks it's any[]
@@ -3293,7 +3298,7 @@ function Hn(t, e, n, r) {
3293
3298
  ...r || {}
3294
3299
  };
3295
3300
  }
3296
- const Wo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Qo = /* @__PURE__ */ new Set(["link", "unlink"]), Bo = /* @__PURE__ */ new Set(["create", "update", "merge"]), Go = /* @__PURE__ */ new Set([
3301
+ const Qo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Bo = /* @__PURE__ */ new Set(["link", "unlink"]), Go = /* @__PURE__ */ new Set(["create", "update", "merge"]), Ho = /* @__PURE__ */ new Set([
3297
3302
  "link",
3298
3303
  "unlink",
3299
3304
  "create",
@@ -3301,20 +3306,20 @@ const Wo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
3301
3306
  "merge",
3302
3307
  "delete",
3303
3308
  "ruleParams"
3304
- ]), Qt = { "unique?": !0, "index?": !0 }, Ho = {
3305
- ...Qt,
3309
+ ]), Bt = { "unique?": !0, "index?": !0 }, Jo = {
3310
+ ...Bt,
3306
3311
  cardinality: "one"
3307
3312
  };
3308
- function Jo(t) {
3313
+ function Yo(t) {
3309
3314
  const e = [], [n, r, s, i] = t;
3310
- if (!Go.has(n))
3315
+ if (!Ho.has(n))
3311
3316
  return e;
3312
- const o = Wt(s);
3317
+ const o = Qt(s);
3313
3318
  if (o && e.push({ etype: r, lookupPair: o }), n === "link")
3314
3319
  for (const [a, c] of Object.entries(i)) {
3315
3320
  const u = Array.isArray(c) ? c : [c];
3316
3321
  for (const l of u) {
3317
- const d = Wt(l);
3322
+ const d = Qt(l);
3318
3323
  d && e.push({
3319
3324
  etype: r,
3320
3325
  lookupPair: d,
@@ -3324,7 +3329,7 @@ function Jo(t) {
3324
3329
  }
3325
3330
  return e;
3326
3331
  }
3327
- function Yo({ attrsStore: t, schema: e }, n) {
3332
+ function Zo({ attrsStore: t, schema: e }, n) {
3328
3333
  var h, y;
3329
3334
  const r = /* @__PURE__ */ new Set(), s = [], i = [];
3330
3335
  function o(b, g) {
@@ -3349,10 +3354,10 @@ function Yo({ attrsStore: t, schema: e }, n) {
3349
3354
  }
3350
3355
  function d(b, g) {
3351
3356
  const w = o(b, g), m = a(b, g);
3352
- u(w), u(m), !w && !m && c(Hn(e, b, g, Ho));
3357
+ u(w), u(m), !w && !m && c(Jn(e, b, g, Jo));
3353
3358
  }
3354
3359
  for (const b of n)
3355
- for (const { etype: g, lookupPair: w, linkLabel: m } of Jo(b)) {
3360
+ for (const { etype: g, lookupPair: w, linkLabel: m } of Yo(b)) {
3356
3361
  const T = w[0];
3357
3362
  if (m) {
3358
3363
  d(g, m);
@@ -3360,28 +3365,28 @@ function Yo({ attrsStore: t, schema: e }, n) {
3360
3365
  u(v), u(E);
3361
3366
  const A = ((h = v == null ? void 0 : v["reverse-identity"]) == null ? void 0 : h[1]) || ((y = E == null ? void 0 : E["forward-identity"]) == null ? void 0 : y[1]) || m;
3362
3367
  if (l(A, T))
3363
- d(A, Vt(T));
3368
+ d(A, Wt(T));
3364
3369
  else {
3365
3370
  const j = o(A, T);
3366
- j || c(Ze(e, A, T, Qt)), u(j);
3371
+ j || c(Ze(e, A, T, Bt)), u(j);
3367
3372
  }
3368
3373
  } else if (l(g, T))
3369
- d(g, Vt(T));
3374
+ d(g, Wt(T));
3370
3375
  else {
3371
3376
  const v = o(g, T);
3372
- v || c(Ze(e, g, T, Qt)), u(v);
3377
+ v || c(Ze(e, g, T, Bt)), u(v);
3373
3378
  }
3374
3379
  }
3375
3380
  for (const b of n) {
3376
3381
  const [g, w, m, T] = b;
3377
- if (Wo.has(g)) {
3382
+ if (Qo.has(g)) {
3378
3383
  const v = o(w, "id");
3379
3384
  u(v), v || c(Ze(e, w, "id", { "unique?": !0 }));
3380
3385
  for (const E of Object.keys(T)) {
3381
3386
  const A = o(w, E);
3382
- if (u(A), Bo.has(g) && (A || c(Ze(e, w, E, E === "id" ? { "unique?": !0 } : null))), Qo.has(g)) {
3387
+ if (u(A), Go.has(g) && (A || c(Ze(e, w, E, E === "id" ? { "unique?": !0 } : null))), Bo.has(g)) {
3383
3388
  const j = a(w, E);
3384
- !A && !j && c(Hn(e, w, E)), u(j);
3389
+ !A && !j && c(Jn(e, w, E)), u(j);
3385
3390
  }
3386
3391
  }
3387
3392
  }
@@ -3394,19 +3399,19 @@ function Yo({ attrsStore: t, schema: e }, n) {
3394
3399
  }
3395
3400
  return [t, i];
3396
3401
  }
3397
- function Zo(t, e) {
3398
- const r = (Array.isArray(e) ? e : [e]).flatMap((c) => Eo(c)), [s, i] = Yo(t, r), o = { ...t, attrsStore: s }, a = r.flatMap((c) => No(o, c));
3402
+ function Xo(t, e) {
3403
+ const r = (Array.isArray(e) ? e : [e]).flatMap((c) => ko(c)), [s, i] = Zo(t, r), o = { ...t, attrsStore: s }, a = r.flatMap((c) => Ko(o, c));
3399
3404
  return [...i, ...a];
3400
3405
  }
3401
- function Jn(t, e) {
3406
+ function Yn(t, e) {
3402
3407
  typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
3403
3408
  }
3404
3409
  const Ne = "__meta";
3405
- class Xo {
3410
+ class ea {
3406
3411
  constructor(e, n) {
3407
3412
  }
3408
3413
  }
3409
- class Bt {
3414
+ class Gt {
3410
3415
  constructor(e) {
3411
3416
  p(this, "currentValue");
3412
3417
  p(this, "_subs", []);
@@ -3599,7 +3604,7 @@ class Bt {
3599
3604
  gc() {
3600
3605
  this._nextGc || (this._nextGc = setTimeout(
3601
3606
  () => {
3602
- Jn(() => {
3607
+ Yn(() => {
3603
3608
  this._nextGc = null, this._gc();
3604
3609
  }, 30 * 1e3);
3605
3610
  },
@@ -3614,7 +3619,7 @@ class Bt {
3614
3619
  return;
3615
3620
  }
3616
3621
  this._nextSave = setTimeout(() => {
3617
- Jn(() => {
3622
+ Yn(() => {
3618
3623
  this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
3619
3624
  }, this._idleCallbackMaxWaitMs);
3620
3625
  }, this._saveThrottleMs);
@@ -3628,7 +3633,7 @@ class Bt {
3628
3633
  // so that we know which entries we need to persist to the store.
3629
3634
  updateInPlace(e) {
3630
3635
  this._version++;
3631
- const [n, r] = ot(this.currentValue, e, {
3636
+ const [n, r] = at(this.currentValue, e, {
3632
3637
  enablePatches: !0
3633
3638
  });
3634
3639
  for (const s of r) {
@@ -3646,13 +3651,13 @@ class Bt {
3646
3651
  };
3647
3652
  }
3648
3653
  }
3649
- const ea = 6, ta = ["kv", "querySubs", "syncSubs"];
3650
- function na(t) {
3654
+ const ta = 6, na = ["kv", "querySubs", "syncSubs"];
3655
+ function ra(t) {
3651
3656
  return function(n) {
3652
3657
  console.error("Error in IndexedDB event", { source: t, event: n });
3653
3658
  };
3654
3659
  }
3655
- async function ra(t) {
3660
+ async function sa(t) {
3656
3661
  return new Promise((e) => {
3657
3662
  const n = indexedDB.open(t);
3658
3663
  n.onerror = (r) => {
@@ -3666,7 +3671,7 @@ async function ra(t) {
3666
3671
  };
3667
3672
  });
3668
3673
  }
3669
- async function sa(t, e, n) {
3674
+ async function ia(t, e, n) {
3670
3675
  const r = (
3671
3676
  // Backwards compatibility for older versions where we JSON.stringified before storing
3672
3677
  typeof e == "string" ? JSON.parse(e) : e
@@ -3700,14 +3705,14 @@ async function sa(t, e, n) {
3700
3705
  };
3701
3706
  });
3702
3707
  }
3703
- async function Yn(t, e, n) {
3708
+ async function Zn(t, e, n) {
3704
3709
  const r = n.put(e, t);
3705
3710
  return new Promise((s, i) => {
3706
3711
  r.onsuccess = () => s(), r.onerror = (o) => i(o);
3707
3712
  });
3708
3713
  }
3709
- async function ia(t, e) {
3710
- const n = await ra(`instant_${t}_5`);
3714
+ async function oa(t, e) {
3715
+ const n = await sa(`instant_${t}_5`);
3711
3716
  if (!n)
3712
3717
  return;
3713
3718
  const r = await new Promise((l, d) => {
@@ -3730,12 +3735,12 @@ async function ia(t, e) {
3730
3735
  for (const [l, d] of r)
3731
3736
  switch (l) {
3732
3737
  case "querySubs": {
3733
- const h = sa(l, d, o);
3738
+ const h = ia(l, d, o);
3734
3739
  a.push(h);
3735
3740
  break;
3736
3741
  }
3737
3742
  default: {
3738
- const h = Yn(l, d, i);
3743
+ const h = Zn(l, d, i);
3739
3744
  a.push(h);
3740
3745
  const y = {
3741
3746
  createdAt: Date.now(),
@@ -3746,13 +3751,13 @@ async function ia(t, e) {
3746
3751
  break;
3747
3752
  }
3748
3753
  }
3749
- const u = Yn(Ne, c, i);
3754
+ const u = Zn(Ne, c, i);
3750
3755
  a.push(u), await Promise.all(a), await new Promise((l, d) => {
3751
3756
  s.oncomplete = (h) => l(h), s.onerror = (h) => d(h), s.onabort = (h) => d(h);
3752
3757
  });
3753
3758
  }
3754
- const Zn = /* @__PURE__ */ new Map();
3755
- class Qr extends Xo {
3759
+ const Xn = /* @__PURE__ */ new Map();
3760
+ class Qr extends ea {
3756
3761
  constructor(n, r) {
3757
3762
  super(n, r);
3758
3763
  p(this, "dbName");
@@ -3760,7 +3765,7 @@ class Qr extends Xo {
3760
3765
  p(this, "_appId");
3761
3766
  p(this, "_prefix");
3762
3767
  p(this, "_dbPromise");
3763
- this.dbName = `instant_${n}_${ea}`, this._storeName = r, this._appId = n, this._dbPromise = this._init();
3768
+ this.dbName = `instant_${n}_${ta}`, this._storeName = r, this._appId = n, this._dbPromise = this._init();
3764
3769
  }
3765
3770
  _init() {
3766
3771
  return new Promise((n, r) => {
@@ -3771,12 +3776,12 @@ class Qr extends Xo {
3771
3776
  }, i.onsuccess = (o) => {
3772
3777
  const c = o.target.result;
3773
3778
  if (s) {
3774
- const u = ia(this._appId, c).catch((l) => {
3775
- na("Error upgrading store from version 5 to 6.")(l);
3779
+ const u = oa(this._appId, c).catch((l) => {
3780
+ ra("Error upgrading store from version 5 to 6.")(l);
3776
3781
  });
3777
- Zn.set(this.dbName, u), u.then(() => n(c)).catch(() => n(c));
3782
+ Xn.set(this.dbName, u), u.then(() => n(c)).catch(() => n(c));
3778
3783
  } else {
3779
- const u = Zn.get(this.dbName);
3784
+ const u = Xn.get(this.dbName);
3780
3785
  u ? u.then(() => n(c)).catch(() => n(c)) : n(c);
3781
3786
  }
3782
3787
  }, i.onupgradeneeded = (o) => {
@@ -3786,7 +3791,7 @@ class Qr extends Xo {
3786
3791
  }
3787
3792
  _upgradeStore(n) {
3788
3793
  const s = n.target.result;
3789
- for (const i of ta)
3794
+ for (const i of na)
3790
3795
  s.objectStoreNames.contains(i) || s.createObjectStore(i);
3791
3796
  }
3792
3797
  async getItem(n) {
@@ -3878,7 +3883,7 @@ class Ee extends Error {
3878
3883
  return "InstantError";
3879
3884
  }
3880
3885
  }
3881
- class ft extends Ee {
3886
+ class dt extends Ee {
3882
3887
  constructor(n) {
3883
3888
  var i;
3884
3889
  const r = ((i = n.body) == null ? void 0 : i.message) || `API Error (${n.status})`;
@@ -3886,7 +3891,7 @@ class ft extends Ee {
3886
3891
  p(this, "body");
3887
3892
  p(this, "status");
3888
3893
  const s = new.target.prototype;
3889
- Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, ft), this.name = "InstantAPIError", this.status = n.status, this.body = n.body;
3894
+ Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, dt), this.name = "InstantAPIError", this.status = n.status, this.body = n.body;
3890
3895
  }
3891
3896
  get [Symbol.toStringTag]() {
3892
3897
  return "InstantAPIError";
@@ -3894,16 +3899,16 @@ class ft extends Ee {
3894
3899
  }
3895
3900
  async function ne(t, e) {
3896
3901
  const n = await fetch(t, e), r = await n.json();
3897
- return n.status === 200 ? Promise.resolve(r) : Promise.reject(new ft({ status: n.status, body: r }));
3902
+ return n.status === 200 ? Promise.resolve(r) : Promise.reject(new dt({ status: n.status, body: r }));
3898
3903
  }
3899
- function oa({ apiURI: t, appId: e, email: n }) {
3904
+ function aa({ apiURI: t, appId: e, email: n }) {
3900
3905
  return ne(`${t}/runtime/auth/send_magic_code`, {
3901
3906
  method: "POST",
3902
3907
  headers: { "content-type": "application/json" },
3903
3908
  body: JSON.stringify({ "app-id": e, email: n })
3904
3909
  });
3905
3910
  }
3906
- async function aa({ apiURI: t, appId: e, email: n, code: r, refreshToken: s }) {
3911
+ async function ca({ apiURI: t, appId: e, email: n, code: r, refreshToken: s }) {
3907
3912
  return await ne(`${t}/runtime/auth/verify_magic_code`, {
3908
3913
  method: "POST",
3909
3914
  headers: { "content-type": "application/json" },
@@ -3915,7 +3920,7 @@ async function aa({ apiURI: t, appId: e, email: n, code: r, refreshToken: s }) {
3915
3920
  })
3916
3921
  });
3917
3922
  }
3918
- async function ca({ apiURI: t, appId: e, refreshToken: n }) {
3923
+ async function ua({ apiURI: t, appId: e, refreshToken: n }) {
3919
3924
  return await ne(`${t}/runtime/auth/verify_refresh_token`, {
3920
3925
  method: "POST",
3921
3926
  headers: { "content-type": "application/json" },
@@ -3925,7 +3930,7 @@ async function ca({ apiURI: t, appId: e, refreshToken: n }) {
3925
3930
  })
3926
3931
  });
3927
3932
  }
3928
- async function ua({ apiURI: t, appId: e }) {
3933
+ async function la({ apiURI: t, appId: e }) {
3929
3934
  return await ne(`${t}/runtime/auth/sign_in_guest`, {
3930
3935
  method: "POST",
3931
3936
  headers: { "content-type": "application/json" },
@@ -3934,7 +3939,7 @@ async function ua({ apiURI: t, appId: e }) {
3934
3939
  })
3935
3940
  });
3936
3941
  }
3937
- async function Xn({ apiURI: t, appId: e, code: n, codeVerifier: r, refreshToken: s }) {
3942
+ async function er({ apiURI: t, appId: e, code: n, codeVerifier: r, refreshToken: s }) {
3938
3943
  return await ne(`${t}/runtime/oauth/token`, {
3939
3944
  method: "POST",
3940
3945
  headers: { "content-type": "application/json" },
@@ -3946,7 +3951,7 @@ async function Xn({ apiURI: t, appId: e, code: n, codeVerifier: r, refreshToken:
3946
3951
  })
3947
3952
  });
3948
3953
  }
3949
- async function la({ apiURI: t, appId: e, nonce: n, idToken: r, clientName: s, refreshToken: i }) {
3954
+ async function fa({ apiURI: t, appId: e, nonce: n, idToken: r, clientName: s, refreshToken: i }) {
3950
3955
  return await ne(`${t}/runtime/oauth/id_token`, {
3951
3956
  method: "POST",
3952
3957
  headers: { "content-type": "application/json" },
@@ -3959,7 +3964,7 @@ async function la({ apiURI: t, appId: e, nonce: n, idToken: r, clientName: s, re
3959
3964
  })
3960
3965
  });
3961
3966
  }
3962
- async function fa({ apiURI: t, appId: e, refreshToken: n }) {
3967
+ async function da({ apiURI: t, appId: e, refreshToken: n }) {
3963
3968
  return await ne(`${t}/runtime/signout`, {
3964
3969
  method: "POST",
3965
3970
  headers: {
@@ -3971,7 +3976,7 @@ async function fa({ apiURI: t, appId: e, refreshToken: n }) {
3971
3976
  })
3972
3977
  });
3973
3978
  }
3974
- async function da({ apiURI: t, appId: e, path: n, file: r, refreshToken: s, contentType: i, contentDisposition: o }) {
3979
+ async function ha({ apiURI: t, appId: e, path: n, file: r, refreshToken: s, contentType: i, contentDisposition: o }) {
3975
3980
  const a = {
3976
3981
  app_id: e,
3977
3982
  path: n,
@@ -3984,7 +3989,7 @@ async function da({ apiURI: t, appId: e, path: n, file: r, refreshToken: s, cont
3984
3989
  body: r
3985
3990
  });
3986
3991
  }
3987
- async function ha({ apiURI: t, appId: e, path: n, refreshToken: r }) {
3992
+ async function pa({ apiURI: t, appId: e, path: n, refreshToken: r }) {
3988
3993
  const { data: s } = await ne(`${t}/storage/files?app_id=${e}&filename=${encodeURIComponent(n)}`, {
3989
3994
  method: "DELETE",
3990
3995
  headers: {
@@ -3994,7 +3999,7 @@ async function ha({ apiURI: t, appId: e, path: n, refreshToken: r }) {
3994
3999
  });
3995
4000
  return s;
3996
4001
  }
3997
- async function pa({ apiURI: t, appId: e, fileName: n, refreshToken: r, metadata: s = {} }) {
4002
+ async function ya({ apiURI: t, appId: e, fileName: n, refreshToken: r, metadata: s = {} }) {
3998
4003
  const { data: i } = await ne(`${t}/storage/signed-upload-url`, {
3999
4004
  method: "POST",
4000
4005
  headers: {
@@ -4008,7 +4013,7 @@ async function pa({ apiURI: t, appId: e, fileName: n, refreshToken: r, metadata:
4008
4013
  });
4009
4014
  return i;
4010
4015
  }
4011
- async function ya(t, e) {
4016
+ async function ba(t, e) {
4012
4017
  return (await fetch(t, {
4013
4018
  method: "PUT",
4014
4019
  body: e,
@@ -4017,7 +4022,7 @@ async function ya(t, e) {
4017
4022
  }
4018
4023
  })).ok;
4019
4024
  }
4020
- async function ba({ apiURI: t, appId: e, path: n, refreshToken: r }) {
4025
+ async function _a({ apiURI: t, appId: e, path: n, refreshToken: r }) {
4021
4026
  const { data: s } = await ne(`${t}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(n)}`, {
4022
4027
  method: "GET",
4023
4028
  headers: {
@@ -4027,9 +4032,9 @@ async function ba({ apiURI: t, appId: e, path: n, refreshToken: r }) {
4027
4032
  });
4028
4033
  return s;
4029
4034
  }
4030
- let un = !1, Gr = !1, Hr = !1;
4031
- typeof window < "u" && typeof window.localStorage < "u" && (un = !!window.localStorage.getItem("devBackend"), Gr = !!window.localStorage.getItem("__instantLogging"), Hr = !!window.localStorage.getItem("__devtoolLocalDash"));
4032
- function er(t, e) {
4035
+ let ln = !1, Gr = !1, Hr = !1;
4036
+ typeof window < "u" && typeof window.localStorage < "u" && (ln = !!window.localStorage.getItem("devBackend"), Gr = !!window.localStorage.getItem("__instantLogging"), Hr = !!window.localStorage.getItem("__devtoolLocalDash"));
4037
+ function tr(t, e) {
4033
4038
  if (!e)
4034
4039
  return t;
4035
4040
  const n = {};
@@ -4037,32 +4042,32 @@ function er(t, e) {
4037
4042
  n[r] = t[r];
4038
4043
  }), n;
4039
4044
  }
4040
- function _a(t, e, n) {
4045
+ function ga(t, e, n) {
4041
4046
  const r = {
4042
4047
  peers: {}
4043
4048
  };
4044
4049
  if (e && "user" in e ? e.user : !0) {
4045
- const i = er(t.user ?? {}, e == null ? void 0 : e.keys);
4050
+ const i = tr(t.user ?? {}, e == null ? void 0 : e.keys);
4046
4051
  r.user = { ...i, peerId: n };
4047
4052
  }
4048
4053
  for (const i of Object.keys(t.peers ?? {})) {
4049
4054
  const o = (e == null ? void 0 : e.peers) === void 0, a = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(i));
4050
4055
  if (o || a) {
4051
- const c = er(t.peers[i], e == null ? void 0 : e.keys);
4056
+ const c = tr(t.peers[i], e == null ? void 0 : e.keys);
4052
4057
  r.peers[i] = { ...c, peerId: i };
4053
4058
  }
4054
4059
  }
4055
4060
  return r;
4056
4061
  }
4057
- function ga(t, e) {
4058
- if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !Fn(t.user, e.user)) || !Ar(t.peers, e.peers))
4062
+ function Ta(t, e) {
4063
+ if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !Nn(t.user, e.user)) || !Or(t.peers, e.peers))
4059
4064
  return !0;
4060
4065
  for (const r of Object.keys(t.peers))
4061
- if (!Fn(t.peers[r], e.peers[r]))
4066
+ if (!Nn(t.peers[r], e.peers[r]))
4062
4067
  return !0;
4063
4068
  return !1;
4064
4069
  }
4065
- class tr {
4070
+ class nr {
4066
4071
  constructor() {
4067
4072
  p(this, "promise");
4068
4073
  p(this, "_resolve");
@@ -4087,11 +4092,11 @@ function Jr(t, e = []) {
4087
4092
  Jr(n["child-nodes"], e);
4088
4093
  });
4089
4094
  }
4090
- function nr(t) {
4095
+ function rr(t) {
4091
4096
  const e = [];
4092
4097
  return Jr(t, e), e;
4093
4098
  }
4094
- function rr(t) {
4099
+ function sr(t) {
4095
4100
  return Object.values(t.links).reduce((e, n) => {
4096
4101
  var r, s;
4097
4102
  return e[r = n.forward.on] ?? (e[r] = {}), e[n.forward.on][n.forward.label] = {
@@ -4105,8 +4110,8 @@ function rr(t) {
4105
4110
  }, e;
4106
4111
  }, {});
4107
4112
  }
4108
- const Yr = "v0.22.105-experimental.tx-id-to-lsn.21084598140.1";
4109
- function Ta(t, e) {
4113
+ const Yr = "v0.22.106-experimental.drewh-typesafe-lookup-syntax.21150920929.1";
4114
+ function wa(t, e) {
4110
4115
  return {
4111
4116
  info: t ? (...n) => console.info(...n, e()) : () => {
4112
4117
  },
@@ -4155,7 +4160,7 @@ class R extends Error {
4155
4160
  super(r), this.name = "QueryValidationError";
4156
4161
  }
4157
4162
  }
4158
- const sr = [
4163
+ const ir = [
4159
4164
  "where",
4160
4165
  "order",
4161
4166
  "limit",
@@ -4166,7 +4171,7 @@ const sr = [
4166
4171
  "before",
4167
4172
  "fields",
4168
4173
  "aggregate"
4169
- ], wa = (t) => t.valueType || "unknown", Zr = (t, e, n = !1) => {
4174
+ ], ma = (t) => t.valueType || "unknown", Zr = (t, e, n = !1) => {
4170
4175
  if (n || t == null)
4171
4176
  return !0;
4172
4177
  switch (e) {
@@ -4181,7 +4186,7 @@ const sr = [
4181
4186
  default:
4182
4187
  return !0;
4183
4188
  }
4184
- }, ma = (t, e, n, r, s, i, o) => {
4189
+ }, Sa = (t, e, n, r, s, i, o) => {
4185
4190
  const a = i.valueType === "json", c = (u, l, d) => {
4186
4191
  if (!Zr(d, l, a))
4187
4192
  throw new R(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof d}`, o);
@@ -4214,16 +4219,16 @@ const sr = [
4214
4219
  throw new R(`Unknown operator '${t}' for attribute '${r}' in entity '${s}'`, o);
4215
4220
  }
4216
4221
  }, ve = (t, e, n, r, s) => {
4217
- const i = wa(n), o = n.valueType === "json";
4222
+ const i = ma(n), o = n.valueType === "json";
4218
4223
  if (typeof t == "object" && t !== null && !Array.isArray(t)) {
4219
4224
  if (o)
4220
4225
  return;
4221
4226
  const c = t;
4222
4227
  for (const [u, l] of Object.entries(c))
4223
- ma(u, l, i, e, r, n, `${s}.${u}`);
4228
+ Sa(u, l, i, e, r, n, `${s}.${u}`);
4224
4229
  } else if (!Zr(t, i, o))
4225
4230
  throw new R(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof t}`, s);
4226
- }, Sa = (t, e, n, r, s) => {
4231
+ }, va = (t, e, n, r, s) => {
4227
4232
  const i = t.split(".");
4228
4233
  if (i.length < 2)
4229
4234
  throw new R(`Invalid dot notation path '${t}'. Must contain at least one dot.`, s);
@@ -4273,7 +4278,7 @@ const sr = [
4273
4278
  continue;
4274
4279
  }
4275
4280
  if (s.includes(".")) {
4276
- Sa(s, i, e, n, `${r}.${s}`);
4281
+ va(s, i, e, n, `${r}.${s}`);
4277
4282
  continue;
4278
4283
  }
4279
4284
  const o = n.entities[e];
@@ -4293,10 +4298,10 @@ const sr = [
4293
4298
  ve(i, s, u, e, `${r}.${s}`);
4294
4299
  }
4295
4300
  }
4296
- }, va = (t, e, n, r, s = 0) => {
4301
+ }, Aa = (t, e, n, r, s = 0) => {
4297
4302
  for (const o of Object.keys(t))
4298
- if (!sr.includes(o))
4299
- throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${sr.join(", ")}. Found: ${o}`, r);
4303
+ if (!ir.includes(o))
4304
+ throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${ir.join(", ")}. Found: ${o}`, r);
4300
4305
  const i = [
4301
4306
  // 'limit', // only supported client side
4302
4307
  "offset",
@@ -4332,9 +4337,9 @@ const sr = [
4332
4337
  const a = t[o];
4333
4338
  if (typeof a != "object" || a === null)
4334
4339
  throw new R(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
4335
- va(a, e, n, `${r}.$`, s);
4340
+ Aa(a, e, n, `${r}.$`, s);
4336
4341
  }
4337
- }, ir = (t, e) => {
4342
+ }, or = (t, e) => {
4338
4343
  if (typeof t != "object" || t === null)
4339
4344
  throw new R(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
4340
4345
  if (Array.isArray(t))
@@ -4353,27 +4358,27 @@ const sr = [
4353
4358
  es(n[r], r, e, r, 0);
4354
4359
  }
4355
4360
  }
4356
- }, or = (t) => typeof t != "string" ? !1 : ct(t) ? !0 : Ae(t);
4361
+ }, ar = (t) => typeof t != "string" ? !1 : ut(t) ? !0 : Ae(t);
4357
4362
  class Z extends Error {
4358
4363
  constructor(e) {
4359
4364
  super(e), this.name = "TransactionValidationError";
4360
4365
  }
4361
4366
  }
4362
- const ts = (t) => t.length > 0 ? t.join(", ") : "none", Aa = (t, e) => new Z(`Entity '${t}' does not exist in schema. Available entities: ${ts(e)}`), At = {
4367
+ const ts = (t) => t.length > 0 ? t.join(", ") : "none", Oa = (t, e) => new Z(`Entity '${t}' does not exist in schema. Available entities: ${ts(e)}`), Ot = {
4363
4368
  string: (t) => typeof t == "string",
4364
4369
  number: (t) => typeof t == "number" && !isNaN(t),
4365
4370
  boolean: (t) => typeof t == "boolean",
4366
4371
  date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
4367
4372
  json: () => !0
4368
- }, Oa = (t, e) => {
4373
+ }, Ea = (t, e) => {
4369
4374
  var n;
4370
- return t == null ? !0 : ((n = At[e.valueType]) == null ? void 0 : n.call(At, t)) ?? !1;
4375
+ return t == null ? !0 : ((n = Ot[e.valueType]) == null ? void 0 : n.call(Ot, t)) ?? !1;
4371
4376
  }, ns = (t, e) => {
4372
4377
  const n = e.entities[t];
4373
4378
  if (!n)
4374
- throw Aa(t, Object.keys(e.entities));
4379
+ throw Oa(t, Object.keys(e.entities));
4375
4380
  return n;
4376
- }, Ot = (t, e, n) => {
4381
+ }, Et = (t, e, n) => {
4377
4382
  const r = ns(t, n);
4378
4383
  if (typeof e != "object" || e === null)
4379
4384
  throw new Z(`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`);
@@ -4381,10 +4386,10 @@ const ts = (t) => t.length > 0 ? t.join(", ") : "none", Aa = (t, e) => new Z(`En
4381
4386
  if (s === "id")
4382
4387
  continue;
4383
4388
  const o = r.attrs[s];
4384
- if (o && !Oa(i, o))
4389
+ if (o && !Ea(i, o))
4385
4390
  throw new Z(`Invalid value for attribute '${s}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof i}`);
4386
4391
  }
4387
- }, ar = (t, e, n) => {
4392
+ }, cr = (t, e, n) => {
4388
4393
  const r = ns(t, n);
4389
4394
  if (typeof e != "object" || e === null)
4390
4395
  throw new Z(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
@@ -4396,21 +4401,21 @@ const ts = (t) => t.length > 0 ? t.join(", ") : "none", Aa = (t, e) => new Z(`En
4396
4401
  if (i != null) {
4397
4402
  if (Array.isArray(i)) {
4398
4403
  for (const a of i)
4399
- if (!or(a))
4404
+ if (!ar(a))
4400
4405
  throw new Z(`Invalid entity ID in link '${s}' for entity '${t}'. Expected a UUID or a lookup, but received: ${a}`);
4401
- } else if (!or(i))
4406
+ } else if (!ar(i))
4402
4407
  throw new Z(`Invalid UUID in link '${s}' for entity '${t}'. Expected a UUID, but received: ${i}`);
4403
4408
  }
4404
4409
  }
4405
- }, Ea = {
4406
- create: Ot,
4407
- update: Ot,
4408
- merge: Ot,
4409
- link: ar,
4410
- unlink: ar,
4410
+ }, ka = {
4411
+ create: Et,
4412
+ update: Et,
4413
+ merge: Et,
4414
+ link: cr,
4415
+ unlink: cr,
4411
4416
  delete: () => {
4412
4417
  }
4413
- }, ka = (t, e) => {
4418
+ }, Pa = (t, e) => {
4414
4419
  if (!e)
4415
4420
  return;
4416
4421
  const [n, r, s, i] = t;
@@ -4418,9 +4423,9 @@ const ts = (t) => t.length > 0 ? t.join(", ") : "none", Aa = (t, e) => new Z(`En
4418
4423
  throw new Z(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
4419
4424
  if (typeof r != "string")
4420
4425
  throw new Z(`Entity name must be a string, but received: ${typeof r}`);
4421
- const o = Ea[n];
4426
+ const o = ka[n];
4422
4427
  o && i !== void 0 && o(r, i, e);
4423
- }, Pa = (t, e) => {
4428
+ }, Ca = (t, e) => {
4424
4429
  const n = Array.isArray(t) ? t : [t];
4425
4430
  for (const r of n) {
4426
4431
  if (!r || typeof r != "object")
@@ -4430,12 +4435,12 @@ const ts = (t) => t.length > 0 ? t.join(", ") : "none", Aa = (t, e) => new Z(`En
4430
4435
  for (const s of r.__ops) {
4431
4436
  if (!Array.isArray(s))
4432
4437
  throw new Z(`Transaction operation must be an array, but received: ${typeof s}`);
4433
- ka(s, e);
4438
+ Pa(s, e);
4434
4439
  }
4435
4440
  }
4436
4441
  };
4437
4442
  let rs = 0;
4438
- class cr {
4443
+ class ur {
4439
4444
  constructor(e) {
4440
4445
  p(this, "type", "ws");
4441
4446
  p(this, "conn");
@@ -4470,7 +4475,7 @@ class cr {
4470
4475
  return this.conn.send(JSON.stringify(e));
4471
4476
  }
4472
4477
  }
4473
- class Ca {
4478
+ class Ia {
4474
4479
  constructor(e, n) {
4475
4480
  p(this, "type", "sse");
4476
4481
  p(this, "initParams", null);
@@ -4566,24 +4571,24 @@ class Ca {
4566
4571
  this.handleClose();
4567
4572
  }
4568
4573
  }
4569
- function Ia(t, e) {
4574
+ function Ma(t, e) {
4570
4575
  const n = t.values;
4571
4576
  if (n) {
4572
- const r = Ir(n.attrsStore, null);
4577
+ const r = Mr(n.attrsStore, null);
4573
4578
  if (r) {
4574
4579
  for (const s of n.entities || [])
4575
- s.store.useDateObjects = e, s.store = Cr(r, s.store);
4580
+ s.store.useDateObjects = e, s.store = Ir(r, s.store);
4576
4581
  n.attrsStore = r;
4577
4582
  }
4578
4583
  }
4579
4584
  return t;
4580
4585
  }
4581
- function Ma(t, e) {
4586
+ function ja(t, e) {
4582
4587
  var n;
4583
4588
  if (e.values) {
4584
4589
  const r = [];
4585
4590
  for (const s of (n = e.values) == null ? void 0 : n.entities) {
4586
- const i = Pr(s.store);
4591
+ const i = Cr(s.store);
4587
4592
  r.push({ ...s, store: i });
4588
4593
  }
4589
4594
  return {
@@ -4593,15 +4598,15 @@ function Ma(t, e) {
4593
4598
  } else
4594
4599
  return e;
4595
4600
  }
4596
- function ja(t, e, n) {
4601
+ function Ra(t, e, n) {
4597
4602
  var i, o;
4598
4603
  const r = (i = e == null ? void 0 : e.state) == null ? void 0 : i.txId, s = (o = n == null ? void 0 : n.state) == null ? void 0 : o.txId;
4599
4604
  return r && (!s || r > s) ? e : s && (!r || s > r) ? n : e || n;
4600
4605
  }
4601
- function Et(t, e, n) {
4602
- return qr({ store: e, attrsStore: n, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
4606
+ function kt(t, e, n) {
4607
+ return zr({ store: e, attrsStore: n, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
4603
4608
  }
4604
- function ur(t, e, n, r) {
4609
+ function lr(t, e, n, r) {
4605
4610
  var o;
4606
4611
  const s = (o = U(n, t.table, "id")) == null ? void 0 : o.id;
4607
4612
  if (!s)
@@ -4609,18 +4614,18 @@ function ur(t, e, n, r) {
4609
4614
  const i = ke(e.eav, [r, s, r]);
4610
4615
  return i ? i[3] : -1;
4611
4616
  }
4612
- function lr(t, e, n) {
4617
+ function fr(t, e, n) {
4613
4618
  for (const { action: r, triple: s } of n)
4614
4619
  switch (r) {
4615
4620
  case "added":
4616
- Rr(t, e, s);
4621
+ $r(t, e, s);
4617
4622
  break;
4618
4623
  case "removed":
4619
- Mr(t, e, s);
4624
+ jr(t, e, s);
4620
4625
  break;
4621
4626
  }
4622
4627
  }
4623
- function Ra(t, e, n) {
4628
+ function $a(t, e, n) {
4624
4629
  var s, i;
4625
4630
  const r = {};
4626
4631
  for (const { action: o, triple: a } of n) {
@@ -4648,14 +4653,14 @@ function Ra(t, e, n) {
4648
4653
  function Xe(t, e) {
4649
4654
  return { [t.table]: e.map((n) => n.entity) };
4650
4655
  }
4651
- function $a(t, e) {
4656
+ function Da(t, e) {
4652
4657
  var r;
4653
4658
  if (t.orderFieldType)
4654
4659
  return t.orderFieldType;
4655
4660
  const n = t.orderField === "serverCreatedAt" ? "number" : (r = U(e(), t.table, t.orderField)) == null ? void 0 : r["checked-data-type"];
4656
4661
  return t.orderFieldType = n, n;
4657
4662
  }
4658
- function Da(t, e, n) {
4663
+ function xa(t, e, n) {
4659
4664
  const r = e;
4660
4665
  if (t.orderField === "serverCreatedAt") {
4661
4666
  n.sort(t.orderDirection === "asc" ? function(o, a) {
@@ -4676,7 +4681,7 @@ var de;
4676
4681
  (function(t) {
4677
4682
  t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
4678
4683
  })(de || (de = {}));
4679
- class xa {
4684
+ class Ua {
4680
4685
  constructor(e, n, r, s, i, o) {
4681
4686
  p(this, "trySend");
4682
4687
  p(this, "subs");
@@ -4687,11 +4692,11 @@ class xa {
4687
4692
  p(this, "log");
4688
4693
  p(this, "createStore");
4689
4694
  p(this, "getAttrs");
4690
- this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new Bt({
4695
+ this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new Gt({
4691
4696
  persister: n,
4692
- merge: ja,
4693
- serialize: Ma,
4694
- parse: (a, c) => Ia(c, this.config.useDateObjects),
4697
+ merge: Ra,
4698
+ serialize: ja,
4699
+ parse: (a, c) => Ma(c, this.config.useDateObjects),
4695
4700
  objectSize: (a) => {
4696
4701
  var c;
4697
4702
  return ((c = a.values) == null ? void 0 : c.entities.length) || 0;
@@ -4812,11 +4817,11 @@ class xa {
4812
4817
  o.values = a;
4813
4818
  const c = a.entities;
4814
4819
  for (const u of r) {
4815
- const l = this.createStore(u), d = Et(o, l, a.attrsStore);
4820
+ const l = this.createStore(u), d = kt(o, l, a.attrsStore);
4816
4821
  c.push({
4817
4822
  store: l,
4818
4823
  entity: d,
4819
- serverCreatedAt: ur(o, l, a.attrsStore, d.id)
4824
+ serverCreatedAt: lr(o, l, a.attrsStore, d.id)
4820
4825
  }), i.push(d);
4821
4826
  }
4822
4827
  this.subs.updateInPlace((u) => {
@@ -4887,8 +4892,8 @@ class xa {
4887
4892
  for (let T = 0; T < d.length; T++) {
4888
4893
  const v = d[T];
4889
4894
  if (yi(v.store, w)) {
4890
- lr(v.store, l.attrsStore, m);
4891
- const E = Et(s, v.store, l.attrsStore), A = Ra(v.store, l.attrsStore, m)[w];
4895
+ fr(v.store, l.attrsStore, m);
4896
+ const E = kt(s, v.store, l.attrsStore), A = $a(v.store, l.attrsStore, m)[w];
4892
4897
  E ? (h.push({
4893
4898
  oldEntity: v.entity,
4894
4899
  newEntity: E,
@@ -4900,8 +4905,8 @@ class xa {
4900
4905
  const y = [];
4901
4906
  for (const [w, m] of Object.entries(u)) {
4902
4907
  const T = this.createStore([]);
4903
- lr(T, l.attrsStore, m);
4904
- const v = Et(s, T, l.attrsStore);
4908
+ fr(T, l.attrsStore, m);
4909
+ const v = kt(s, T, l.attrsStore);
4905
4910
  if (!v) {
4906
4911
  this.log.error("No entity found after applying change", {
4907
4912
  sub: s,
@@ -4913,14 +4918,14 @@ class xa {
4913
4918
  d.push({
4914
4919
  store: T,
4915
4920
  entity: v,
4916
- serverCreatedAt: ur(s, T, l.attrsStore, v.id)
4921
+ serverCreatedAt: lr(s, T, l.attrsStore, v.id)
4917
4922
  }), y.push(v);
4918
4923
  }
4919
4924
  const b = [];
4920
4925
  for (const w of c.sort().reverse())
4921
4926
  b.push(d[w].entity), d.splice(w, 1);
4922
- const g = $a(s, this.getAttrs);
4923
- Da(s, g, d), this.notifyCbs(r, {
4927
+ const g = Da(s, this.getAttrs);
4928
+ xa(s, g, d), this.notifyCbs(r, {
4924
4929
  type: de.SyncTransaction,
4925
4930
  data: Xe(s, (o = s.values) == null ? void 0 : o.entities),
4926
4931
  added: y,
@@ -4967,39 +4972,39 @@ const ie = {
4967
4972
  AUTHENTICATED: "authenticated",
4968
4973
  CLOSED: "closed",
4969
4974
  ERRORED: "errored"
4970
- }, Ua = 3e4, La = 3e4, Fa = 200, Na = 1e3 * 60, Ka = {
4975
+ }, La = 3e4, Fa = 3e4, Na = 200, Ka = 1e3 * 60, qa = {
4971
4976
  apiURI: "https://api.instantdb.com",
4972
4977
  websocketURI: "wss://api.instantdb.com/runtime/session"
4973
- }, kt = "_instant_oauth_redirect", Re = "currentUser";
4974
- function qa({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: s }) {
4978
+ }, Pt = "_instant_oauth_redirect", Re = "currentUser";
4979
+ function za({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: s }) {
4975
4980
  if (!s)
4976
- return new cr(`${r}?app_id=${e}`);
4981
+ return new ur(`${r}?app_id=${e}`);
4977
4982
  switch (t) {
4978
4983
  case "ws":
4979
- return new cr(`${r}?app_id=${e}`);
4984
+ return new ur(`${r}?app_id=${e}`);
4980
4985
  case "sse":
4981
- return new Ca(s, `${n}/runtime/sse?app_id=${e}`);
4986
+ return new Ia(s, `${n}/runtime/sse?app_id=${e}`);
4982
4987
  default:
4983
4988
  throw new Error("Unknown transport type " + t);
4984
4989
  }
4985
4990
  }
4986
- function za() {
4991
+ function Va() {
4987
4992
  return typeof window < "u" || typeof chrome < "u";
4988
4993
  }
4989
- const fr = {
4994
+ const dr = {
4990
4995
  "set-presence": !0,
4991
4996
  "set-presence-ok": !0,
4992
4997
  "refresh-presence": !0,
4993
4998
  "patch-presence": !0
4994
4999
  };
4995
- function Va(t, e) {
5000
+ function Wa(t, e) {
4996
5001
  var r;
4997
5002
  const n = typeof t == "string" ? JSON.parse(t) : t;
4998
5003
  if ((r = n == null ? void 0 : n.result) != null && r.store) {
4999
- const s = Ir(n.result.attrsStore, n.result.store);
5004
+ const s = Mr(n.result.attrsStore, n.result.store);
5000
5005
  if (s) {
5001
5006
  const i = n.result.store;
5002
- n.result.store = Cr(s, {
5007
+ n.result.store = Ir(s, {
5003
5008
  ...i,
5004
5009
  useDateObjects: e
5005
5010
  }), n.result.attrsStore = s;
@@ -5007,7 +5012,7 @@ function Va(t, e) {
5007
5012
  }
5008
5013
  return n;
5009
5014
  }
5010
- function Wa(t, e) {
5015
+ function Qa(t, e) {
5011
5016
  const { result: n, ...r } = e, s = (
5012
5017
  /** @type {import('./reactorTypes.ts').QuerySubInStorage} */
5013
5018
  r
@@ -5015,14 +5020,14 @@ function Wa(t, e) {
5015
5020
  if (n) {
5016
5021
  const i = {
5017
5022
  ...n,
5018
- store: Pr(n.store),
5023
+ store: Cr(n.store),
5019
5024
  attrsStore: n.attrsStore.toJSON()
5020
5025
  };
5021
5026
  s.result = i;
5022
5027
  }
5023
5028
  return s;
5024
5029
  }
5025
- function Qa(t, e) {
5030
+ function Ba(t, e) {
5026
5031
  switch (t) {
5027
5032
  case "pendingMutations":
5028
5033
  return new Map(typeof e == "string" ? JSON.parse(e) : e);
@@ -5030,7 +5035,7 @@ function Qa(t, e) {
5030
5035
  return e;
5031
5036
  }
5032
5037
  }
5033
- function Ba(t, e) {
5038
+ function Ga(t, e) {
5034
5039
  switch (t) {
5035
5040
  case "pendingMutations":
5036
5041
  return [...e.entries()];
@@ -5038,17 +5043,17 @@ function Ba(t, e) {
5038
5043
  return e;
5039
5044
  }
5040
5045
  }
5041
- function Ga(t, e, n) {
5046
+ function Ha(t, e, n) {
5042
5047
  const r = e == null ? void 0 : e.result, s = n == null ? void 0 : n.result;
5043
5048
  return r && !s && n && (n.result = r), n || e;
5044
5049
  }
5045
- function Pt(t) {
5050
+ function Ct(t) {
5046
5051
  return [...t].sort((e, n) => {
5047
5052
  const [r, s] = e, [i, o] = n, a = s.order || 0, c = o.order || 0;
5048
5053
  return a == c ? r < i ? -1 : r > i ? 1 : 0 : a - c;
5049
5054
  });
5050
5055
  }
5051
- class Ha {
5056
+ class Ja {
5052
5057
  constructor(e, n = Qr, r = Br, s, i) {
5053
5058
  /** @type {s.AttrsStore | undefined} */
5054
5059
  p(this, "attrs");
@@ -5143,9 +5148,9 @@ class Ha {
5143
5148
  });
5144
5149
  /** Applies transactions locally and sends transact message to server */
5145
5150
  p(this, "pushTx", (e) => {
5146
- this.config.disableValidation || Pa(e, this.config.schema);
5151
+ this.config.disableValidation || Ca(e, this.config.schema);
5147
5152
  try {
5148
- const n = Zo({
5153
+ const n = Xo({
5149
5154
  attrsStore: this.optimisticAttrs(),
5150
5155
  schema: this.config.schema,
5151
5156
  stores: Object.values(this.querySubs.currentValue).map((r) => {
@@ -5175,7 +5180,7 @@ class Ha {
5175
5180
  this._updatePendingMutations((c) => {
5176
5181
  c.set(r, o);
5177
5182
  });
5178
- const a = new tr();
5183
+ const a = new nr();
5179
5184
  return this.mutationDeferredStore.set(r, a), this._sendMutation(r, o), this.notifyAll(), a.promise;
5180
5185
  });
5181
5186
  p(this, "_transportOnOpen", (e) => {
@@ -5246,7 +5251,7 @@ class Ha {
5246
5251
  }
5247
5252
  this._log.info("[socket][close]", n.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
5248
5253
  });
5249
- if (this._EventSource = i, this.config = { ...Ka, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? La, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Fa, this._log = Ta(e.verbose || un || Gr, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": Yr }, this.config.schema && (this._linkIndex = rr(this.config.schema)), !!za()) {
5254
+ if (this._EventSource = i, this.config = { ...qa, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Fa, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Na, this._log = wa(e.verbose || ln || Gr, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": Yr }, this.config.schema && (this._linkIndex = sr(this.config.schema)), !!Va()) {
5250
5255
  if (!e.appId)
5251
5256
  throw new Error("Instant must be initialized with an appId.");
5252
5257
  if (!Ae(e.appId))
@@ -5261,14 +5266,14 @@ class Ha {
5261
5266
  } catch (c) {
5262
5267
  this._log.error("[error] handle broadcast channel", c);
5263
5268
  }
5264
- })), this._initStorage(n), this._syncTable = new xa(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
5269
+ })), this._initStorage(n), this._syncTable = new Ua(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
5265
5270
  useDateObjects: this.config.useDateObjects
5266
5271
  }, this._log, (o) => xe(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser().then((o) => {
5267
5272
  this.syncUserToEndpoint(o.user);
5268
5273
  }), setInterval(async () => {
5269
5274
  const o = await this.getCurrentUser();
5270
5275
  this.syncUserToEndpoint(o.user);
5271
- }, Na), r.getIsOnline().then((o) => {
5276
+ }, Ka), r.getIsOnline().then((o) => {
5272
5277
  this._isOnline = o, this._startSocket(), r.listen((a) => {
5273
5278
  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", ie.CLOSED), this._setStatus(ie.CLOSED)));
5274
5279
  });
@@ -5285,7 +5290,7 @@ class Ha {
5285
5290
  ...this.config,
5286
5291
  schema: e,
5287
5292
  cardinalityInference: !!e
5288
- }, this._linkIndex = e ? rr(this.config.schema) : null;
5293
+ }, this._linkIndex = e ? sr(this.config.schema) : null;
5289
5294
  }
5290
5295
  _reactorStats() {
5291
5296
  return {
@@ -5298,11 +5303,11 @@ class Ha {
5298
5303
  this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
5299
5304
  }
5300
5305
  _initStorage(e) {
5301
- this.querySubs = new Bt({
5306
+ this.querySubs = new Gt({
5302
5307
  persister: new e(this.config.appId, "querySubs"),
5303
- merge: Ga,
5304
- serialize: Wa,
5305
- parse: (n, r) => Va(r, this.config.useDateObjects),
5308
+ merge: Ha,
5309
+ serialize: Qa,
5310
+ parse: (n, r) => Wa(r, this.config.useDateObjects),
5306
5311
  // objectSize
5307
5312
  objectSize: (n) => {
5308
5313
  var r, s, i;
@@ -5318,11 +5323,11 @@ class Ha {
5318
5323
  maxSize: 1e6
5319
5324
  // 1 million triples
5320
5325
  }
5321
- }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Bt({
5326
+ }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Gt({
5322
5327
  persister: new e(this.config.appId, "kv"),
5323
5328
  merge: this._onMergeKv,
5324
- serialize: Ba,
5325
- parse: Qa,
5329
+ serialize: Ga,
5330
+ parse: Ba,
5326
5331
  objectSize: () => 0,
5327
5332
  logger: this._log,
5328
5333
  saveThrottleMs: 100,
@@ -5354,7 +5359,7 @@ class Ha {
5354
5359
  s.resolve({ status: e, eventId: n });
5355
5360
  else if (r != null && r.type) {
5356
5361
  const { status: o, ...a } = r;
5357
- s.reject(new ft({
5362
+ s.reject(new dt({
5358
5363
  // @ts-expect-error body.type is not constant typed
5359
5364
  body: a,
5360
5365
  status: o ?? 0
@@ -5401,7 +5406,7 @@ class Ha {
5401
5406
  _handleReceive(e, n) {
5402
5407
  var s, i, o, a, c, u;
5403
5408
  const r = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
5404
- switch (fr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
5409
+ switch (dr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
5405
5410
  case "init-ok": {
5406
5411
  this._setStatus(ie.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
5407
5412
  for (const h of Object.keys(this._rooms)) {
@@ -5418,7 +5423,7 @@ class Ha {
5418
5423
  const { q: h, result: y } = n, b = F(h);
5419
5424
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[b])
5420
5425
  break;
5421
- const g = (a = (o = y == null ? void 0 : y[0]) == null ? void 0 : o.data) == null ? void 0 : a["page-info"], w = (u = (c = y == null ? void 0 : y[0]) == null ? void 0 : c.data) == null ? void 0 : u.aggregate, m = nr(y), T = this.ensureAttrs(), v = xe(T, m, r, this.config.useDateObjects);
5426
+ const g = (a = (o = y == null ? void 0 : y[0]) == null ? void 0 : o.data) == null ? void 0 : a["page-info"], w = (u = (c = y == null ? void 0 : y[0]) == null ? void 0 : c.data) == null ? void 0 : u.aggregate, m = rr(y), T = this.ensureAttrs(), v = xe(T, m, r, this.config.useDateObjects);
5422
5427
  this.querySubs.updateInPlace((E) => {
5423
5428
  if (!E[b]) {
5424
5429
  this._log.info("Missing value in querySubs", { hash: b, q: h });
@@ -5457,16 +5462,16 @@ class Ha {
5457
5462
  g !== this._pendingMutations() && this.kv.updateInPlace((T) => {
5458
5463
  T.pendingMutations = g;
5459
5464
  });
5460
- const w = Pt(g.entries()), m = h.map((T) => {
5465
+ const w = Ct(g.entries()), m = h.map((T) => {
5461
5466
  var Ce, X, re, ue;
5462
- const v = T["instaql-query"], E = T["instaql-result"], A = F(v), j = nr(E), L = this.ensureAttrs(), q = xe(L, j, r, this.config.useDateObjects), { store: Pe, attrsStore: We } = this._applyOptimisticUpdates(q, L, w, b), dt = (X = (Ce = E == null ? void 0 : E[0]) == null ? void 0 : Ce.data) == null ? void 0 : X["page-info"], ht = (ue = (re = E == null ? void 0 : E[0]) == null ? void 0 : re.data) == null ? void 0 : ue.aggregate;
5467
+ const v = T["instaql-query"], E = T["instaql-result"], A = F(v), j = rr(E), L = this.ensureAttrs(), q = xe(L, j, r, this.config.useDateObjects), { store: Pe, attrsStore: We } = this._applyOptimisticUpdates(q, L, w, b), ht = (X = (Ce = E == null ? void 0 : E[0]) == null ? void 0 : Ce.data) == null ? void 0 : X["page-info"], pt = (ue = (re = E == null ? void 0 : E[0]) == null ? void 0 : re.data) == null ? void 0 : ue.aggregate;
5463
5468
  return {
5464
5469
  q: v,
5465
5470
  hash: A,
5466
5471
  store: Pe,
5467
5472
  attrsStore: We,
5468
- pageInfo: dt,
5469
- aggregate: ht
5473
+ pageInfo: ht,
5474
+ aggregate: pt
5470
5475
  };
5471
5476
  });
5472
5477
  m.forEach(({ hash: T, q: v, store: E, attrsStore: A, pageInfo: j, aggregate: L }) => {
@@ -5645,21 +5650,21 @@ class Ha {
5645
5650
  * Returns an unsubscribe function
5646
5651
  */
5647
5652
  subscribeQuery(e, n, r) {
5648
- this.config.disableValidation || ir(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
5653
+ this.config.disableValidation || or(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
5649
5654
  const s = F(e), i = this.getPreviousResult(e);
5650
5655
  return i && n(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: n }), this._startQuerySub(e, s), () => {
5651
5656
  this._unsubQuery(e, s, n);
5652
5657
  };
5653
5658
  }
5654
5659
  queryOnce(e, n) {
5655
- this.config.disableValidation || ir(e, this.config.schema), n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
5656
- const r = new tr();
5660
+ this.config.disableValidation || or(e, this.config.schema), n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
5661
+ const r = new nr();
5657
5662
  if (!this._isOnline)
5658
5663
  return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
5659
5664
  if (!this.querySubs)
5660
5665
  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;
5661
5666
  const s = F(e), i = this._startQuerySub(e, s);
5662
- 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")), Ua), r.promise;
5667
+ 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")), La), r.promise;
5663
5668
  }
5664
5669
  _completeQueryOnce(e, n, r) {
5665
5670
  this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((s) => s.dfd !== r), this._cleanupQuery(e, n));
@@ -5726,7 +5731,7 @@ class Ha {
5726
5731
  a = !0;
5727
5732
  continue;
5728
5733
  }
5729
- const g = a ? ko(o, y) : y;
5734
+ const g = a ? Po(o, y) : y;
5730
5735
  h.push(g);
5731
5736
  }
5732
5737
  return a ? h : l;
@@ -5739,7 +5744,7 @@ class Ha {
5739
5744
  return a ? u : n;
5740
5745
  }
5741
5746
  _rewriteMutationsSorted(e, n) {
5742
- return Pt(this._rewriteMutations(e, n).entries());
5747
+ return Ct(this._rewriteMutations(e, n).entries());
5743
5748
  }
5744
5749
  // ---------------------------
5745
5750
  // Transact
@@ -5784,7 +5789,7 @@ class Ha {
5784
5789
  const T = this._applyOptimisticUpdates(d, h, w, g);
5785
5790
  d = T.store, h = T.attrsStore;
5786
5791
  }
5787
- return { data: qr({ store: d, attrsStore: h, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
5792
+ return { data: zr({ store: d, attrsStore: h, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
5788
5793
  }
5789
5794
  _applyOptimisticUpdates(e, n, r, s) {
5790
5795
  for (const [i, o] of r)
@@ -5848,7 +5853,7 @@ class Ha {
5848
5853
  const r = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations());
5849
5854
  r !== this._pendingMutations() && this.kv.updateInPlace((i) => {
5850
5855
  i.pendingMutations = r;
5851
- }), Pt(r.entries()).forEach(([i, o]) => {
5856
+ }), Ct(r.entries()).forEach(([i, o]) => {
5852
5857
  o["tx-id"] || this._sendMutation(i, o);
5853
5858
  }), this._syncTable.flushPending();
5854
5859
  }
@@ -5883,7 +5888,7 @@ class Ha {
5883
5888
  }
5884
5889
  _trySend(e, n, r) {
5885
5890
  if (this._transport.isOpen()) {
5886
- switch (fr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
5891
+ switch (dr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
5887
5892
  case "transact": {
5888
5893
  this._inFlightMutationEventIds.add(e);
5889
5894
  break;
@@ -5904,7 +5909,7 @@ class Ha {
5904
5909
  return;
5905
5910
  }
5906
5911
  const e = this._transport;
5907
- this._transport = qa({
5912
+ this._transport = za({
5908
5913
  transportType: this._transportType,
5909
5914
  appId: this.config.appId,
5910
5915
  apiURI: this.config.apiURI,
@@ -5938,9 +5943,9 @@ class Ha {
5938
5943
  if (typeof URL > "u")
5939
5944
  return;
5940
5945
  const e = new URL(window.location.href);
5941
- if (e.searchParams.get(kt)) {
5946
+ if (e.searchParams.get(Pt)) {
5942
5947
  const n = e.toString();
5943
- e.searchParams.delete(kt), e.searchParams.delete("code"), e.searchParams.delete("error");
5948
+ e.searchParams.delete(Pt), e.searchParams.delete("code"), e.searchParams.delete("error");
5944
5949
  const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
5945
5950
  if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
5946
5951
  typeof navigation == "object" && // @ts-ignore (waiting for ts support)
@@ -5964,7 +5969,7 @@ class Ha {
5964
5969
  if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
5965
5970
  return null;
5966
5971
  const e = new URLSearchParams(window.location.search);
5967
- if (!e.get(kt))
5972
+ if (!e.get(Pt))
5968
5973
  return null;
5969
5974
  const n = e.get("error");
5970
5975
  if (n)
@@ -5974,7 +5979,7 @@ class Ha {
5974
5979
  return null;
5975
5980
  this._replaceUrlAfterOAuth();
5976
5981
  try {
5977
- const c = await this._getCurrentUser(), u = (c == null ? void 0 : c.type) === "guest", { user: l } = await Xn({
5982
+ const c = await this._getCurrentUser(), u = (c == null ? void 0 : c.type) === "guest", { user: l } = await er({
5978
5983
  apiURI: this.config.apiURI,
5979
5984
  appId: this.config.appId,
5980
5985
  code: r,
@@ -6111,7 +6116,7 @@ class Ha {
6111
6116
  }), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
6112
6117
  }
6113
6118
  sendMagicCode({ email: e }) {
6114
- return oa({
6119
+ return aa({
6115
6120
  apiURI: this.config.apiURI,
6116
6121
  appId: this.config.appId,
6117
6122
  email: e
@@ -6119,7 +6124,7 @@ class Ha {
6119
6124
  }
6120
6125
  async signInWithMagicCode({ email: e, code: n }) {
6121
6126
  var o;
6122
- const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await aa({
6127
+ const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await ca({
6123
6128
  apiURI: this.config.apiURI,
6124
6129
  appId: this.config.appId,
6125
6130
  email: e,
@@ -6129,7 +6134,7 @@ class Ha {
6129
6134
  return await this.changeCurrentUser(i.user), i;
6130
6135
  }
6131
6136
  async signInWithCustomToken(e) {
6132
- const n = await ca({
6137
+ const n = await ua({
6133
6138
  apiURI: this.config.apiURI,
6134
6139
  appId: this.config.appId,
6135
6140
  refreshToken: e
@@ -6137,7 +6142,7 @@ class Ha {
6137
6142
  return await this.changeCurrentUser(n.user), n;
6138
6143
  }
6139
6144
  async signInAsGuest() {
6140
- const e = await ua({
6145
+ const e = await la({
6141
6146
  apiURI: this.config.apiURI,
6142
6147
  appId: this.config.appId
6143
6148
  });
@@ -6152,7 +6157,7 @@ class Ha {
6152
6157
  this._log.info("[auth-invalidate] skipped invalidateToken");
6153
6158
  return;
6154
6159
  }
6155
- fa({
6160
+ da({
6156
6161
  apiURI: this.config.apiURI,
6157
6162
  appId: this.config.appId,
6158
6163
  refreshToken: r
@@ -6184,7 +6189,7 @@ class Ha {
6184
6189
  */
6185
6190
  async exchangeCodeForToken({ code: e, codeVerifier: n }) {
6186
6191
  var o;
6187
- const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await Xn({
6192
+ const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await er({
6188
6193
  apiURI: this.config.apiURI,
6189
6194
  appId: this.config.appId,
6190
6195
  code: e,
@@ -6205,7 +6210,7 @@ class Ha {
6205
6210
  */
6206
6211
  async signInWithIdToken({ idToken: e, clientName: n, nonce: r }) {
6207
6212
  var a;
6208
- const s = await this.getCurrentUser(), i = (a = s == null ? void 0 : s.user) == null ? void 0 : a.refresh_token, o = await la({
6213
+ const s = await this.getCurrentUser(), i = (a = s == null ? void 0 : s.user) == null ? void 0 : a.refresh_token, o = await fa({
6209
6214
  apiURI: this.config.apiURI,
6210
6215
  appId: this.config.appId,
6211
6216
  idToken: e,
@@ -6246,7 +6251,7 @@ class Ha {
6246
6251
  getPresence(e, n, r = {}) {
6247
6252
  const s = this._rooms[n], i = this._presence[n];
6248
6253
  return !s || !i || !i.result ? null : {
6249
- ..._a(i.result, r, this._sessionId),
6254
+ ...ga(i.result, r, this._sessionId),
6250
6255
  isLoading: !s.isConnected,
6251
6256
  error: s.error
6252
6257
  };
@@ -6302,24 +6307,24 @@ class Ha {
6302
6307
  }
6303
6308
  _notifyPresenceSub(e, n) {
6304
6309
  const r = this.getPresence("", e, n);
6305
- r && (n.prev && !ga(r, n.prev) || (n.prev = r, n.cb(r)));
6310
+ r && (n.prev && !Ta(r, n.prev) || (n.prev = r, n.cb(r)));
6306
6311
  }
6307
6312
  _patchPresencePeers(e, n) {
6308
6313
  var o, a, c;
6309
6314
  const r = ((a = (o = this._presence[e]) == null ? void 0 : o.result) == null ? void 0 : a.peers) || {};
6310
6315
  let s = Object.fromEntries(Object.entries(r).map(([u, l]) => [u, { data: l }]));
6311
6316
  (c = this._presence[e]) == null || c.result;
6312
- const i = ot(s, (u) => {
6317
+ const i = at(s, (u) => {
6313
6318
  for (let [l, d, h] of n)
6314
6319
  switch (d) {
6315
6320
  case "+":
6316
6321
  Hs(u, l, h);
6317
6322
  break;
6318
6323
  case "r":
6319
- Nn(u, l, h);
6324
+ Kn(u, l, h);
6320
6325
  break;
6321
6326
  case "-":
6322
- Er(u, l);
6327
+ kr(u, l);
6323
6328
  break;
6324
6329
  }
6325
6330
  delete u[this._sessionId];
@@ -6330,8 +6335,8 @@ class Ha {
6330
6335
  const r = { ...n };
6331
6336
  delete r[this._sessionId];
6332
6337
  const s = Object.fromEntries(Object.entries(r).map(([i, o]) => [i, o.data]));
6333
- this._presence = ot(this._presence, (i) => {
6334
- Nn(i, [e, "result", "peers"], s);
6338
+ this._presence = at(this._presence, (i) => {
6339
+ Kn(i, [e, "result", "peers"], s);
6335
6340
  });
6336
6341
  }
6337
6342
  // --------
@@ -6374,7 +6379,7 @@ class Ha {
6374
6379
  async uploadFile(e, n, r) {
6375
6380
  var o;
6376
6381
  const s = await this.getCurrentUser(), i = (o = s == null ? void 0 : s.user) == null ? void 0 : o.refresh_token;
6377
- return da({
6382
+ return ha({
6378
6383
  ...r,
6379
6384
  apiURI: this.config.apiURI,
6380
6385
  appId: this.config.appId,
@@ -6386,7 +6391,7 @@ class Ha {
6386
6391
  async deleteFile(e) {
6387
6392
  var i;
6388
6393
  const n = await this.getCurrentUser(), r = (i = n == null ? void 0 : n.user) == null ? void 0 : i.refresh_token;
6389
- return await ha({
6394
+ return await pa({
6390
6395
  apiURI: this.config.apiURI,
6391
6396
  appId: this.config.appId,
6392
6397
  path: e,
@@ -6397,18 +6402,18 @@ class Ha {
6397
6402
  // ---------------------------------
6398
6403
  async upload(e, n) {
6399
6404
  var c;
6400
- const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || n.name, o = await pa({
6405
+ const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || n.name, o = await ya({
6401
6406
  apiURI: this.config.apiURI,
6402
6407
  appId: this.config.appId,
6403
6408
  fileName: i,
6404
6409
  refreshToken: s
6405
6410
  });
6406
- return await ya(o, n);
6411
+ return await ba(o, n);
6407
6412
  }
6408
6413
  async getDownloadUrl(e) {
6409
6414
  var i;
6410
6415
  const n = await this.getCurrentUser(), r = (i = n == null ? void 0 : n.user) == null ? void 0 : i.refresh_token;
6411
- return await ba({
6416
+ return await _a({
6412
6417
  apiURI: this.config.apiURI,
6413
6418
  appId: this.config.appId,
6414
6419
  path: e,
@@ -6417,9 +6422,9 @@ class Ha {
6417
6422
  }
6418
6423
  }
6419
6424
  let et;
6420
- function Ja(t, e) {
6425
+ function Ya(t, e) {
6421
6426
  et == null || et.dispose();
6422
- const n = nc(e), r = Xa(e, a), s = Za(Ya(t));
6427
+ const n = rc(e), r = ec(e, a), s = Xa(Za(t));
6423
6428
  function i(l) {
6424
6429
  var d;
6425
6430
  l.source === s.element.contentWindow && ((d = l.data) == null ? void 0 : d.type) === "close" && n.isVisible() && a();
@@ -6441,10 +6446,10 @@ function Ja(t, e) {
6441
6446
  }
6442
6447
  return u();
6443
6448
  }
6444
- function Ya(t) {
6445
- return `${un || Hr ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
6446
- }
6447
6449
  function Za(t) {
6450
+ return `${ln || Hr ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
6451
+ }
6452
+ function Xa(t) {
6448
6453
  const e = document.createElement("iframe");
6449
6454
  return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
6450
6455
  width: "100%",
@@ -6453,7 +6458,7 @@ function Za(t) {
6453
6458
  border: "none"
6454
6459
  }), { element: e };
6455
6460
  }
6456
- function Xa(t, e) {
6461
+ function ec(t, e) {
6457
6462
  const n = `
6458
6463
  <svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
6459
6464
  <rect width="512" height="512" fill="black"/>
@@ -6463,7 +6468,7 @@ function Xa(t, e) {
6463
6468
  return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, {
6464
6469
  // pos
6465
6470
  position: "fixed",
6466
- ...ec(t.position),
6471
+ ...tc(t.position),
6467
6472
  height: "32px",
6468
6473
  width: "32px",
6469
6474
  // layout
@@ -6478,7 +6483,7 @@ function Xa(t, e) {
6478
6483
  cursor: "pointer"
6479
6484
  }), r.addEventListener("click", e), { element: r };
6480
6485
  }
6481
- function ec(t) {
6486
+ function tc(t) {
6482
6487
  switch (t) {
6483
6488
  case "bottom-left":
6484
6489
  return { bottom: "24px", left: "24px" };
@@ -6490,7 +6495,7 @@ function ec(t) {
6490
6495
  return { top: "24px", left: "24px" };
6491
6496
  }
6492
6497
  }
6493
- function tc(t) {
6498
+ function nc(t) {
6494
6499
  switch (t) {
6495
6500
  case "bottom-left":
6496
6501
  return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
@@ -6502,11 +6507,11 @@ function tc(t) {
6502
6507
  return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
6503
6508
  }
6504
6509
  }
6505
- function nc(t) {
6510
+ function rc(t) {
6506
6511
  const e = document.createElement("div");
6507
6512
  Object.assign(e.style, {
6508
6513
  position: "fixed",
6509
- ...tc(t.position),
6514
+ ...nc(t.position),
6510
6515
  display: "block",
6511
6516
  borderRadius: "4px",
6512
6517
  border: "1px #ccc solid",
@@ -6519,22 +6524,22 @@ function nc(t) {
6519
6524
  }
6520
6525
  return { element: e, isVisible: n };
6521
6526
  }
6522
- const rc = {
6527
+ const sc = {
6523
6528
  apiURI: "https://api.instantdb.com",
6524
6529
  websocketURI: "wss://api.instantdb.com/runtime/session"
6525
6530
  };
6526
- function sc() {
6531
+ function ic() {
6527
6532
  return globalThis.__instantDbSchemaHashStore = globalThis.__instantDbSchemaHashStore ?? /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
6528
6533
  }
6529
- function ic() {
6534
+ function oc() {
6530
6535
  return globalThis.__instantDbStore = globalThis.__instantDbStore ?? {}, globalThis.__instantDbStore;
6531
6536
  }
6532
- function Gt(t) {
6537
+ function Ht(t) {
6533
6538
  const e = t.__adminToken;
6534
6539
  return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
6535
6540
  }
6536
- const Ht = ic(), dr = sc();
6537
- class oc {
6541
+ const Jt = oc(), hr = ic();
6542
+ class ac {
6538
6543
  constructor(e) {
6539
6544
  p(this, "db");
6540
6545
  /**
@@ -6651,7 +6656,7 @@ class oc {
6651
6656
  this.db = e;
6652
6657
  }
6653
6658
  }
6654
- class ac {
6659
+ class cc {
6655
6660
  constructor(e) {
6656
6661
  p(this, "db");
6657
6662
  /**
@@ -6700,16 +6705,16 @@ class ac {
6700
6705
  this.db = e;
6701
6706
  }
6702
6707
  }
6703
- function cc(t) {
6708
+ function uc(t) {
6704
6709
  return JSON.parse(JSON.stringify(t));
6705
6710
  }
6706
- class uc {
6711
+ class lc {
6707
6712
  constructor(e) {
6708
6713
  p(this, "_reactor");
6709
6714
  p(this, "auth");
6710
6715
  p(this, "storage");
6711
- p(this, "tx", cn());
6712
- this._reactor = e, this.auth = new oc(this._reactor), this.storage = new ac(this._reactor);
6716
+ p(this, "tx", un());
6717
+ this._reactor = e, this.auth = new ac(this._reactor), this.storage = new cc(this._reactor);
6713
6718
  }
6714
6719
  /**
6715
6720
  * Use this to write data! You can create, update, delete, and link objects
@@ -6850,7 +6855,7 @@ class uc {
6850
6855
  };
6851
6856
  }
6852
6857
  shutdown() {
6853
- delete Ht[Gt(this._reactor.config)], this._reactor.shutdown();
6858
+ delete Jt[Ht(this._reactor.config)], this._reactor.shutdown();
6854
6859
  }
6855
6860
  /**
6856
6861
  * Use this for one-off queries.
@@ -6883,35 +6888,35 @@ class uc {
6883
6888
  return this._reactor.subscribeTable(e, n);
6884
6889
  }
6885
6890
  }
6886
- function hr(t) {
6891
+ function pr(t) {
6887
6892
  if (!t)
6888
6893
  return "0";
6889
- const e = dr.get(t);
6894
+ const e = hr.get(t);
6890
6895
  if (e)
6891
6896
  return e;
6892
6897
  const n = F(t);
6893
- return dr.set(t, n), n;
6898
+ return hr.set(t, n), n;
6894
6899
  }
6895
- function lc(t, e) {
6896
- return hr(t._reactor.config.schema) !== hr(e);
6900
+ function fc(t, e) {
6901
+ return pr(t._reactor.config.schema) !== pr(e);
6897
6902
  }
6898
- function fc(t, e, n, r, s) {
6903
+ function dc(t, e, n, r, s) {
6899
6904
  var u;
6900
6905
  const i = {
6901
6906
  ...t,
6902
6907
  appId: (u = t.appId) == null ? void 0 : u.trim(),
6903
6908
  useDateObjects: t.useDateObjects ?? !1
6904
- }, o = Ht[Gt(i)];
6909
+ }, o = Jt[Ht(i)];
6905
6910
  if (o)
6906
- return lc(o, i.schema) && o._reactor.updateSchema(i.schema), o;
6907
- const a = new Ha({
6908
- ...rc,
6911
+ return fc(o, i.schema) && o._reactor.updateSchema(i.schema), o;
6912
+ const a = new Ja({
6913
+ ...sc,
6909
6914
  ...i,
6910
6915
  cardinalityInference: !!i.schema
6911
- }, e || Qr, n || Br, { ...r || {}, "@instantdb/core": Yr }, s), c = new uc(a);
6912
- return Ht[Gt(i)] = c, dc(i.appId, i.devtool), c;
6916
+ }, e || Qr, n || Br, { ...r || {}, "@instantdb/core": Yr }, s), c = new lc(a);
6917
+ return Jt[Ht(i)] = c, hc(i.appId, i.devtool), c;
6913
6918
  }
6914
- function dc(t, e) {
6919
+ function hc(t, e) {
6915
6920
  if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
6916
6921
  return;
6917
6922
  const n = {
@@ -6919,15 +6924,15 @@ function dc(t, e) {
6919
6924
  allowedHosts: ["localhost"],
6920
6925
  ...typeof e == "object" ? e : {}
6921
6926
  };
6922
- n.allowedHosts.includes(window.location.hostname) && Ja(t, n);
6927
+ n.allowedHosts.includes(window.location.hostname) && Ya(t, n);
6923
6928
  }
6924
- const hc = {
6929
+ const pc = {
6925
6930
  isLoading: !0,
6926
6931
  data: void 0,
6927
6932
  pageInfo: void 0,
6928
6933
  error: void 0
6929
6934
  };
6930
- function pr(t) {
6935
+ function yr(t) {
6931
6936
  return {
6932
6937
  isLoading: !t,
6933
6938
  data: void 0,
@@ -6936,12 +6941,12 @@ function pr(t) {
6936
6941
  ...t || {}
6937
6942
  };
6938
6943
  }
6939
- function pc(t, e, n) {
6944
+ function yc(t, e, n) {
6940
6945
  e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
6941
- const r = e ? cc(e) : null, s = F(r), i = Ke(
6942
- pr(t._reactor.getPreviousResult(r))
6946
+ const r = e ? uc(e) : null, s = F(r), i = Ke(
6947
+ yr(t._reactor.getPreviousResult(r))
6943
6948
  ), o = le(
6944
- (c) => (i.current = pr(
6949
+ (c) => (i.current = yr(
6945
6950
  t._reactor.getPreviousResult(r)
6946
6951
  ), c(), r ? t.subscribeQuery(r, (l) => {
6947
6952
  i.current = {
@@ -6959,13 +6964,13 @@ function pc(t, e, n) {
6959
6964
  // Build a new subscribe function if the query changes
6960
6965
  [s]
6961
6966
  );
6962
- return { state: It(
6967
+ return { state: Mt(
6963
6968
  o,
6964
6969
  () => i.current,
6965
- () => hc
6970
+ () => pc
6966
6971
  ), query: r };
6967
6972
  }
6968
- function yc() {
6973
+ function bc() {
6969
6974
  const t = Ke(null);
6970
6975
  be(() => {
6971
6976
  n();
@@ -6978,8 +6983,8 @@ function yc() {
6978
6983
  }
6979
6984
  return { set: e, clear: n };
6980
6985
  }
6981
- const bc = 1e3;
6982
- function _c(t, e, n) {
6986
+ const _c = 1e3;
6987
+ function gc(t, e, n) {
6983
6988
  const r = Ke(n);
6984
6989
  r.current = n, be(() => t.core._reactor.subscribeTopic(
6985
6990
  t.id,
@@ -6989,7 +6994,7 @@ function _c(t, e, n) {
6989
6994
  }
6990
6995
  ), [t.id, e]);
6991
6996
  }
6992
- function gc(t, e) {
6997
+ function Tc(t, e) {
6993
6998
  return be(() => t.core._reactor.joinRoom(t.id), [t.id]), le(
6994
6999
  (r) => {
6995
7000
  t.core._reactor.publishTopic({
@@ -7002,9 +7007,9 @@ function gc(t, e) {
7002
7007
  [t.id, e]
7003
7008
  );
7004
7009
  }
7005
- function Tc(t, e = {}) {
7010
+ function wc(t, e = {}) {
7006
7011
  var o, a;
7007
- const [n, r] = br(() => t.core._reactor.getPresence(t.type, t.id, e) ?? {
7012
+ const [n, r] = _r(() => t.core._reactor.getPresence(t.type, t.id, e) ?? {
7008
7013
  peers: {},
7009
7014
  isLoading: !0
7010
7015
  });
@@ -7022,18 +7027,18 @@ function Tc(t, e = {}) {
7022
7027
  },
7023
7028
  [t.type, t.id]
7024
7029
  );
7025
- return Mt(() => ({
7030
+ return jt(() => ({
7026
7031
  ...n,
7027
7032
  publishPresence: s
7028
7033
  }), [n, s]);
7029
7034
  }
7030
- function wc(t, e, n) {
7035
+ function mc(t, e, n) {
7031
7036
  be(() => t.core._reactor.joinRoom(t.id, e), [t.id]), be(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
7032
7037
  }
7033
- function mc(t, e, n = {}) {
7034
- const r = yc(), s = he.usePresence(t, {
7038
+ function Sc(t, e, n = {}) {
7039
+ const r = bc(), s = he.usePresence(t, {
7035
7040
  keys: [e]
7036
- }), i = Mt(() => {
7041
+ }), i = jt(() => {
7037
7042
  const l = t._core._reactor.getPresence(
7038
7043
  t.type,
7039
7044
  t.id
@@ -7045,7 +7050,7 @@ function mc(t, e, n = {}) {
7045
7050
  (l) => {
7046
7051
  t.core._reactor.publishPresence(t.type, t.id, {
7047
7052
  [e]: l
7048
- }), l && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? bc, () => {
7053
+ }), l && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? _c, () => {
7049
7054
  t.core._reactor.publishPresence(t.type, t.id, {
7050
7055
  [e]: null
7051
7056
  });
@@ -7060,7 +7065,7 @@ function mc(t, e, n = {}) {
7060
7065
  [n.stopOnEnter, o]
7061
7066
  ), c = le(() => {
7062
7067
  o(!1);
7063
- }, [o]), u = Mt(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
7068
+ }, [o]), u = jt(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
7064
7069
  return {
7065
7070
  active: i,
7066
7071
  setActive: o,
@@ -7068,13 +7073,13 @@ function mc(t, e, n = {}) {
7068
7073
  };
7069
7074
  }
7070
7075
  const he = {
7071
- useTopicEffect: _c,
7072
- usePublishTopic: gc,
7073
- usePresence: Tc,
7074
- useSyncPresence: wc,
7075
- useTypingIndicator: mc
7076
+ useTopicEffect: gc,
7077
+ usePublishTopic: Tc,
7078
+ usePresence: wc,
7079
+ useSyncPresence: mc,
7080
+ useTypingIndicator: Sc
7076
7081
  };
7077
- class Sc {
7082
+ class vc {
7078
7083
  constructor(e, n, r) {
7079
7084
  p(this, "core");
7080
7085
  /** @deprecated use `core` instead */
@@ -7161,14 +7166,14 @@ class Sc {
7161
7166
  this.core = e, this._core = this.core, this.type = n, this.id = r;
7162
7167
  }
7163
7168
  }
7164
- const vc = {
7169
+ const Ac = {
7165
7170
  isLoading: !0,
7166
7171
  user: void 0,
7167
7172
  error: void 0
7168
7173
  };
7169
- class Ct {
7174
+ class It {
7170
7175
  constructor(e, n) {
7171
- p(this, "tx", cn());
7176
+ p(this, "tx", un());
7172
7177
  p(this, "auth");
7173
7178
  p(this, "storage");
7174
7179
  p(this, "core");
@@ -7196,7 +7201,7 @@ class Ct {
7196
7201
  * console.log('Device ID:', deviceId)
7197
7202
  */
7198
7203
  p(this, "useLocalId", (e) => {
7199
- const [n, r] = br(null);
7204
+ const [n, r] = _r(null);
7200
7205
  return be(() => {
7201
7206
  (async () => {
7202
7207
  const i = await this.getLocalId(e);
@@ -7264,7 +7269,7 @@ class Ct {
7264
7269
  * auth.user ? { goals: {} } : null,
7265
7270
  * );
7266
7271
  */
7267
- p(this, "useQuery", (e, n) => pc(this.core, e, n).state);
7272
+ p(this, "useQuery", (e, n) => yc(this.core, e, n).state);
7268
7273
  /**
7269
7274
  * Listen for the logged in state. This is useful
7270
7275
  * for deciding when to show a login screen.
@@ -7344,7 +7349,7 @@ class Ct {
7344
7349
  ), n = le((s) => this.core.subscribeConnectionStatus((o) => {
7345
7350
  o !== e.current && (e.current = o, s());
7346
7351
  }), []);
7347
- return It(
7352
+ return Mt(
7348
7353
  n,
7349
7354
  () => e.current,
7350
7355
  // For SSR, always return 'connecting' as the initial state
@@ -7393,7 +7398,7 @@ class Ct {
7393
7398
  const n = this.useAuth();
7394
7399
  return n.isLoading || n.error || n.user ? null : /* @__PURE__ */ Je.jsx(Je.Fragment, { children: e });
7395
7400
  });
7396
- this.core = fc(
7401
+ this.core = dc(
7397
7402
  e,
7398
7403
  // @ts-expect-error because TS can't resolve subclass statics
7399
7404
  this.constructor.Storage,
@@ -7417,7 +7422,7 @@ class Ct {
7417
7422
  * const { peers } = db.rooms.usePresence(room);
7418
7423
  */
7419
7424
  room(e = "_defaultRoomType", n = "_defaultRoomId") {
7420
- return new Sc(this.core, e, n);
7425
+ return new vc(this.core, e, n);
7421
7426
  }
7422
7427
  _useAuth() {
7423
7428
  const e = Ke(
@@ -7425,10 +7430,10 @@ class Ct {
7425
7430
  ), n = le((s) => this.core.subscribeAuth((o) => {
7426
7431
  e.current = { isLoading: !1, ...o }, s();
7427
7432
  }), []);
7428
- return It(
7433
+ return Mt(
7429
7434
  n,
7430
7435
  () => e.current,
7431
- () => vc
7436
+ () => Ac
7432
7437
  );
7433
7438
  }
7434
7439
  /**
@@ -7445,7 +7450,7 @@ class Ct {
7445
7450
  return this.core.getAuth();
7446
7451
  }
7447
7452
  }
7448
- p(Ct, "Storage"), p(Ct, "NetworkListener"), p(Ct, "EventSourceImpl");
7453
+ p(It, "Storage"), p(It, "NetworkListener"), p(It, "EventSourceImpl");
7449
7454
  export {
7450
- Ct as InstantReactAbstractDatabase
7455
+ It as InstantReactAbstractDatabase
7451
7456
  };