@instantdb/react-common 0.22.88-experimental.drewh-entity-caching.20249092034.1 → 0.22.88-experimental.drewh-fix-explorer.20249092035.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import Or, { useRef as ze, useCallback as de, useSyncExternalStore as Rt, useEffect as ge, useMemo as $t, useState as Er } from "react";
2
- var xt = { exports: {} }, $e = {};
1
+ import Sr, { useRef as ze, useCallback as de, useSyncExternalStore as Mt, useEffect as ge, useMemo as Rt, useState as Or } from "react";
2
+ var $t = { exports: {} }, $e = {};
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.min.js
@@ -9,11 +9,11 @@ var xt = { exports: {} }, $e = {};
9
9
  * This source code is licensed under the MIT license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
- var Ln;
13
- function Ki() {
14
- if (Ln) return $e;
15
- Ln = 1;
16
- var t = Or, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
12
+ var Un;
13
+ function Ni() {
14
+ if (Un) return $e;
15
+ Un = 1;
16
+ var t = Sr, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
17
17
  function o(u, a, d) {
18
18
  var c, f = {}, l = null, p = null;
19
19
  d !== void 0 && (l = "" + d), a.key !== void 0 && (l = "" + a.key), a.ref !== void 0 && (p = a.ref);
@@ -23,10 +23,10 @@ function Ki() {
23
23
  }
24
24
  return $e.Fragment = n, $e.jsx = o, $e.jsxs = o, $e;
25
25
  }
26
- var xe = {}, Fn;
27
- function qi() {
28
- if (Fn) return xe;
29
- Fn = 1;
26
+ var xe = {}, Ln;
27
+ function Ki() {
28
+ if (Ln) return xe;
29
+ Ln = 1;
30
30
  var t = {};
31
31
  /**
32
32
  * @license React
@@ -38,7 +38,7 @@ function qi() {
38
38
  * LICENSE file in the root directory of this source tree.
39
39
  */
40
40
  return t.NODE_ENV !== "production" && function() {
41
- var e = Or, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), a = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, g = "@@iterator";
41
+ var e = Sr, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), a = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, g = "@@iterator";
42
42
  function m(h) {
43
43
  if (h === null || typeof h != "object")
44
44
  return null;
@@ -127,18 +127,18 @@ function qi() {
127
127
  }
128
128
  return null;
129
129
  }
130
- var le = Object.assign, Me = 0, yn, bn, _n, gn, Tn, mn, wn;
131
- function vn() {
130
+ var le = Object.assign, Me = 0, pn, yn, bn, _n, gn, Tn, mn;
131
+ function wn() {
132
132
  }
133
- vn.__reactDisabledLog = !0;
134
- function pi() {
133
+ wn.__reactDisabledLog = !0;
134
+ function hi() {
135
135
  {
136
136
  if (Me === 0) {
137
- yn = console.log, bn = console.info, _n = console.warn, gn = console.error, Tn = console.group, mn = console.groupCollapsed, wn = console.groupEnd;
137
+ pn = console.log, yn = console.info, bn = console.warn, _n = console.error, gn = console.group, Tn = console.groupCollapsed, mn = console.groupEnd;
138
138
  var h = {
139
139
  configurable: !0,
140
140
  enumerable: !0,
141
- value: vn,
141
+ value: wn,
142
142
  writable: !0
143
143
  };
144
144
  Object.defineProperties(console, {
@@ -154,7 +154,7 @@ function qi() {
154
154
  Me++;
155
155
  }
156
156
  }
157
- function yi() {
157
+ function pi() {
158
158
  {
159
159
  if (Me--, Me === 0) {
160
160
  var h = {
@@ -164,25 +164,25 @@ function qi() {
164
164
  };
165
165
  Object.defineProperties(console, {
166
166
  log: le({}, h, {
167
- value: yn
167
+ value: pn
168
168
  }),
169
169
  info: le({}, h, {
170
- value: bn
170
+ value: yn
171
171
  }),
172
172
  warn: le({}, h, {
173
- value: _n
173
+ value: bn
174
174
  }),
175
175
  error: le({}, h, {
176
- value: gn
176
+ value: _n
177
177
  }),
178
178
  group: le({}, h, {
179
- value: Tn
179
+ value: gn
180
180
  }),
181
181
  groupCollapsed: le({}, h, {
182
- value: mn
182
+ value: Tn
183
183
  }),
184
184
  groupEnd: le({}, h, {
185
- value: wn
185
+ value: mn
186
186
  })
187
187
  });
188
188
  }
@@ -205,10 +205,10 @@ function qi() {
205
205
  }
206
206
  var wt = !1, Je;
207
207
  {
208
- var bi = typeof WeakMap == "function" ? WeakMap : Map;
209
- Je = new bi();
208
+ var yi = typeof WeakMap == "function" ? WeakMap : Map;
209
+ Je = new yi();
210
210
  }
211
- function Sn(h, _) {
211
+ function vn(h, _) {
212
212
  if (!h || wt)
213
213
  return "";
214
214
  {
@@ -221,7 +221,7 @@ function qi() {
221
221
  var C = Error.prepareStackTrace;
222
222
  Error.prepareStackTrace = void 0;
223
223
  var P;
224
- P = Tt.current, Tt.current = null, pi();
224
+ P = Tt.current, Tt.current = null, hi();
225
225
  try {
226
226
  if (_) {
227
227
  var j = function() {
@@ -274,15 +274,15 @@ function qi() {
274
274
  }
275
275
  }
276
276
  } finally {
277
- wt = !1, Tt.current = P, yi(), Error.prepareStackTrace = C;
277
+ wt = !1, Tt.current = P, pi(), Error.prepareStackTrace = C;
278
278
  }
279
279
  var ve = h ? h.displayName || h.name : "", he = ve ? Ye(ve) : "";
280
280
  return typeof h == "function" && Je.set(h, he), he;
281
281
  }
282
- function _i(h, _, w) {
283
- return Sn(h, !1);
282
+ function bi(h, _, w) {
283
+ return vn(h, !1);
284
284
  }
285
- function gi(h) {
285
+ function _i(h) {
286
286
  var _ = h.prototype;
287
287
  return !!(_ && _.isReactComponent);
288
288
  }
@@ -290,7 +290,7 @@ function qi() {
290
290
  if (h == null)
291
291
  return "";
292
292
  if (typeof h == "function")
293
- return Sn(h, gi(h));
293
+ return vn(h, _i(h));
294
294
  if (typeof h == "string")
295
295
  return Ye(h);
296
296
  switch (h) {
@@ -302,7 +302,7 @@ function qi() {
302
302
  if (typeof h == "object")
303
303
  switch (h.$$typeof) {
304
304
  case d:
305
- return _i(h.render);
305
+ return bi(h.render);
306
306
  case l:
307
307
  return Ze(h.type, _, w);
308
308
  case p: {
@@ -315,15 +315,15 @@ function qi() {
315
315
  }
316
316
  return "";
317
317
  }
318
- var Re = Object.prototype.hasOwnProperty, On = {}, En = T.ReactDebugCurrentFrame;
318
+ var Re = Object.prototype.hasOwnProperty, Sn = {}, On = T.ReactDebugCurrentFrame;
319
319
  function Xe(h) {
320
320
  if (h) {
321
321
  var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
322
- En.setExtraStackFrame(w);
322
+ On.setExtraStackFrame(w);
323
323
  } else
324
- En.setExtraStackFrame(null);
324
+ On.setExtraStackFrame(null);
325
325
  }
326
- function Ti(h, _, w, O, C) {
326
+ function gi(h, _, w, O, C) {
327
327
  {
328
328
  var P = Function.call.bind(Re);
329
329
  for (var j in h)
@@ -338,41 +338,41 @@ function qi() {
338
338
  } catch ($) {
339
339
  E = $;
340
340
  }
341
- E && !(E instanceof Error) && (Xe(C), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", w, j, typeof E), Xe(null)), E instanceof Error && !(E.message in On) && (On[E.message] = !0, Xe(C), v("Failed %s type: %s", w, E.message), Xe(null));
341
+ E && !(E instanceof Error) && (Xe(C), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", w, j, typeof E), Xe(null)), E instanceof Error && !(E.message in Sn) && (Sn[E.message] = !0, Xe(C), v("Failed %s type: %s", w, E.message), Xe(null));
342
342
  }
343
343
  }
344
344
  }
345
- var mi = Array.isArray;
345
+ var Ti = Array.isArray;
346
346
  function vt(h) {
347
- return mi(h);
347
+ return Ti(h);
348
348
  }
349
- function wi(h) {
349
+ function mi(h) {
350
350
  {
351
351
  var _ = typeof Symbol == "function" && Symbol.toStringTag, w = _ && h[Symbol.toStringTag] || h.constructor.name || "Object";
352
352
  return w;
353
353
  }
354
354
  }
355
- function vi(h) {
355
+ function wi(h) {
356
356
  try {
357
- return An(h), !1;
357
+ return En(h), !1;
358
358
  } catch {
359
359
  return !0;
360
360
  }
361
361
  }
362
- function An(h) {
362
+ function En(h) {
363
363
  return "" + h;
364
364
  }
365
- function jn(h) {
366
- if (vi(h))
367
- return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", wi(h)), An(h);
365
+ function An(h) {
366
+ if (wi(h))
367
+ return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", mi(h)), En(h);
368
368
  }
369
- var kn = T.ReactCurrentOwner, Si = {
369
+ var jn = T.ReactCurrentOwner, vi = {
370
370
  key: !0,
371
371
  ref: !0,
372
372
  __self: !0,
373
373
  __source: !0
374
- }, Cn, Pn;
375
- function Oi(h) {
374
+ }, kn, Cn;
375
+ function Si(h) {
376
376
  if (Re.call(h, "ref")) {
377
377
  var _ = Object.getOwnPropertyDescriptor(h, "ref").get;
378
378
  if (_ && _.isReactWarning)
@@ -380,7 +380,7 @@ function qi() {
380
380
  }
381
381
  return h.ref !== void 0;
382
382
  }
383
- function Ei(h) {
383
+ function Oi(h) {
384
384
  if (Re.call(h, "key")) {
385
385
  var _ = Object.getOwnPropertyDescriptor(h, "key").get;
386
386
  if (_ && _.isReactWarning)
@@ -388,13 +388,13 @@ function qi() {
388
388
  }
389
389
  return h.key !== void 0;
390
390
  }
391
- function Ai(h, _) {
392
- typeof h.ref == "string" && kn.current;
391
+ function Ei(h, _) {
392
+ typeof h.ref == "string" && jn.current;
393
393
  }
394
- function ji(h, _) {
394
+ function Ai(h, _) {
395
395
  {
396
396
  var w = function() {
397
- Cn || (Cn = !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)", _));
397
+ kn || (kn = !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)", _));
398
398
  };
399
399
  w.isReactWarning = !0, Object.defineProperty(h, "key", {
400
400
  get: w,
@@ -402,10 +402,10 @@ function qi() {
402
402
  });
403
403
  }
404
404
  }
405
- function ki(h, _) {
405
+ function ji(h, _) {
406
406
  {
407
407
  var w = function() {
408
- Pn || (Pn = !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)", _));
408
+ Cn || (Cn = !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)", _));
409
409
  };
410
410
  w.isReactWarning = !0, Object.defineProperty(h, "ref", {
411
411
  get: w,
@@ -413,7 +413,7 @@ function qi() {
413
413
  });
414
414
  }
415
415
  }
416
- var Ci = function(h, _, w, O, C, P, j) {
416
+ var ki = function(h, _, w, O, C, P, j) {
417
417
  var E = {
418
418
  // This tag allows us to uniquely identify this as a React Element
419
419
  $$typeof: n,
@@ -442,12 +442,12 @@ function qi() {
442
442
  value: C
443
443
  }), Object.freeze && (Object.freeze(E.props), Object.freeze(E)), E;
444
444
  };
445
- function Pi(h, _, w, O, C) {
445
+ function Ci(h, _, w, O, C) {
446
446
  {
447
447
  var P, j = {}, E = null, z = null;
448
- w !== void 0 && (jn(w), E = "" + w), Ei(_) && (jn(_.key), E = "" + _.key), Oi(_) && (z = _.ref, Ai(_, C));
448
+ w !== void 0 && (An(w), E = "" + w), Oi(_) && (An(_.key), E = "" + _.key), Si(_) && (z = _.ref, Ei(_, C));
449
449
  for (P in _)
450
- Re.call(_, P) && !Si.hasOwnProperty(P) && (j[P] = _[P]);
450
+ Re.call(_, P) && !vi.hasOwnProperty(P) && (j[P] = _[P]);
451
451
  if (h && h.defaultProps) {
452
452
  var $ = h.defaultProps;
453
453
  for (P in $)
@@ -455,25 +455,25 @@ function qi() {
455
455
  }
456
456
  if (E || z) {
457
457
  var D = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
458
- E && ji(j, D), z && ki(j, D);
458
+ E && Ai(j, D), z && ji(j, D);
459
459
  }
460
- return Ci(h, E, z, C, O, kn.current, j);
460
+ return ki(h, E, z, C, O, jn.current, j);
461
461
  }
462
462
  }
463
- var St = T.ReactCurrentOwner, In = T.ReactDebugCurrentFrame;
463
+ var St = T.ReactCurrentOwner, Pn = T.ReactDebugCurrentFrame;
464
464
  function we(h) {
465
465
  if (h) {
466
466
  var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
467
- In.setExtraStackFrame(w);
467
+ Pn.setExtraStackFrame(w);
468
468
  } else
469
- In.setExtraStackFrame(null);
469
+ Pn.setExtraStackFrame(null);
470
470
  }
471
471
  var Ot;
472
472
  Ot = !1;
473
473
  function Et(h) {
474
474
  return typeof h == "object" && h !== null && h.$$typeof === n;
475
475
  }
476
- function Mn() {
476
+ function In() {
477
477
  {
478
478
  if (St.current) {
479
479
  var h = ne(St.current.type);
@@ -485,13 +485,13 @@ Check the render method of \`` + h + "`.";
485
485
  return "";
486
486
  }
487
487
  }
488
- function Ii(h) {
488
+ function Pi(h) {
489
489
  return "";
490
490
  }
491
- var Rn = {};
492
- function Mi(h) {
491
+ var Mn = {};
492
+ function Ii(h) {
493
493
  {
494
- var _ = Mn();
494
+ var _ = In();
495
495
  if (!_) {
496
496
  var w = typeof h == "string" ? h : h.displayName || h.name;
497
497
  w && (_ = `
@@ -501,27 +501,27 @@ Check the top-level render call using <` + w + ">.");
501
501
  return _;
502
502
  }
503
503
  }
504
- function $n(h, _) {
504
+ function Rn(h, _) {
505
505
  {
506
506
  if (!h._store || h._store.validated || h.key != null)
507
507
  return;
508
508
  h._store.validated = !0;
509
- var w = Mi(_);
510
- if (Rn[w])
509
+ var w = Ii(_);
510
+ if (Mn[w])
511
511
  return;
512
- Rn[w] = !0;
512
+ Mn[w] = !0;
513
513
  var O = "";
514
514
  h && h._owner && h._owner !== St.current && (O = " It was passed a child from " + ne(h._owner.type) + "."), we(h), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', w, O), we(null);
515
515
  }
516
516
  }
517
- function xn(h, _) {
517
+ function $n(h, _) {
518
518
  {
519
519
  if (typeof h != "object")
520
520
  return;
521
521
  if (vt(h))
522
522
  for (var w = 0; w < h.length; w++) {
523
523
  var O = h[w];
524
- Et(O) && $n(O, _);
524
+ Et(O) && Rn(O, _);
525
525
  }
526
526
  else if (Et(h))
527
527
  h._store && (h._store.validated = !0);
@@ -529,11 +529,11 @@ Check the top-level render call using <` + w + ">.");
529
529
  var C = m(h);
530
530
  if (typeof C == "function" && C !== h.entries)
531
531
  for (var P = C.call(h), j; !(j = P.next()).done; )
532
- Et(j.value) && $n(j.value, _);
532
+ Et(j.value) && Rn(j.value, _);
533
533
  }
534
534
  }
535
535
  }
536
- function Ri(h) {
536
+ function Mi(h) {
537
537
  {
538
538
  var _ = h.type;
539
539
  if (_ == null || typeof _ == "string")
@@ -549,7 +549,7 @@ Check the top-level render call using <` + w + ">.");
549
549
  return;
550
550
  if (w) {
551
551
  var O = ne(_);
552
- Ti(w, h.props, "prop", O, h);
552
+ gi(w, h.props, "prop", O, h);
553
553
  } else if (_.PropTypes !== void 0 && !Ot) {
554
554
  Ot = !0;
555
555
  var C = ne(_);
@@ -558,7 +558,7 @@ Check the top-level render call using <` + w + ">.");
558
558
  typeof _.getDefaultProps == "function" && !_.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
559
559
  }
560
560
  }
561
- function $i(h) {
561
+ function Ri(h) {
562
562
  {
563
563
  for (var _ = Object.keys(h.props), w = 0; w < _.length; w++) {
564
564
  var O = _[w];
@@ -570,19 +570,19 @@ Check the top-level render call using <` + w + ">.");
570
570
  h.ref !== null && (we(h), v("Invalid attribute `ref` supplied to `React.Fragment`."), we(null));
571
571
  }
572
572
  }
573
- var Dn = {};
574
- function Un(h, _, w, O, C, P) {
573
+ var xn = {};
574
+ function Dn(h, _, w, O, C, P) {
575
575
  {
576
576
  var j = _t(h);
577
577
  if (!j) {
578
578
  var E = "";
579
579
  (h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (E += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
580
- var z = Ii();
581
- z ? E += z : E += Mn();
580
+ var z = Pi();
581
+ z ? E += z : E += In();
582
582
  var $;
583
583
  h === null ? $ = "null" : vt(h) ? $ = "array" : h !== void 0 && h.$$typeof === n ? ($ = "<" + (ne(h.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : $ = typeof h, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", $, E);
584
584
  }
585
- var D = Pi(h, _, w, C, P);
585
+ var D = Ci(h, _, w, C, P);
586
586
  if (D == null)
587
587
  return D;
588
588
  if (j) {
@@ -591,43 +591,43 @@ Check the top-level render call using <` + w + ">.");
591
591
  if (O)
592
592
  if (vt(J)) {
593
593
  for (var ve = 0; ve < J.length; ve++)
594
- xn(J[ve], h);
594
+ $n(J[ve], h);
595
595
  Object.freeze && Object.freeze(J);
596
596
  } else
597
597
  v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
598
598
  else
599
- xn(J, h);
599
+ $n(J, h);
600
600
  }
601
601
  if (Re.call(_, "key")) {
602
- var he = ne(h), W = Object.keys(_).filter(function(Ni) {
603
- return Ni !== "key";
602
+ var he = ne(h), W = Object.keys(_).filter(function(Fi) {
603
+ return Fi !== "key";
604
604
  }), At = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
605
- if (!Dn[he + At]) {
606
- var Fi = W.length > 0 ? "{" + W.join(": ..., ") + ": ...}" : "{}";
605
+ if (!xn[he + At]) {
606
+ var Li = W.length > 0 ? "{" + W.join(": ..., ") + ": ...}" : "{}";
607
607
  v(`A props object containing a "key" prop is being spread into JSX:
608
608
  let props = %s;
609
609
  <%s {...props} />
610
610
  React keys must be passed directly to JSX without using spread:
611
611
  let props = %s;
612
- <%s key={someKey} {...props} />`, At, he, Fi, he), Dn[he + At] = !0;
612
+ <%s key={someKey} {...props} />`, At, he, Li, he), xn[he + At] = !0;
613
613
  }
614
614
  }
615
- return h === i ? $i(D) : Ri(D), D;
615
+ return h === i ? Ri(D) : Mi(D), D;
616
616
  }
617
617
  }
618
- function xi(h, _, w) {
619
- return Un(h, _, w, !0);
618
+ function $i(h, _, w) {
619
+ return Dn(h, _, w, !0);
620
620
  }
621
- function Di(h, _, w) {
622
- return Un(h, _, w, !1);
621
+ function xi(h, _, w) {
622
+ return Dn(h, _, w, !1);
623
623
  }
624
- var Ui = Di, Li = xi;
625
- xe.Fragment = i, xe.jsx = Ui, xe.jsxs = Li;
624
+ var Di = xi, Ui = $i;
625
+ xe.Fragment = i, xe.jsx = Di, xe.jsxs = Ui;
626
626
  }(), xe;
627
627
  }
628
- var zi = {};
629
- zi.NODE_ENV === "production" ? xt.exports = Ki() : xt.exports = qi();
630
- var et = xt.exports;
628
+ var qi = {};
629
+ qi.NODE_ENV === "production" ? $t.exports = Ni() : $t.exports = Ki();
630
+ var et = $t.exports;
631
631
  function N(t) {
632
632
  if (typeof t == "number")
633
633
  return (Math.abs(t * 2654435761) >>> 0).toString(16);
@@ -670,14 +670,14 @@ const x = {
670
670
  Remove: "remove",
671
671
  Replace: "replace",
672
672
  Add: "add"
673
- }, Ar = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Vi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), st = Symbol.iterator, Y = {
673
+ }, Er = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), zi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), st = Symbol.iterator, Y = {
674
674
  mutable: "mutable",
675
675
  immutable: "immutable"
676
- }, en = {};
676
+ }, Xt = {};
677
677
  function Ne(t, e) {
678
678
  return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
679
679
  }
680
- function Nn(t, e) {
680
+ function Fn(t, e) {
681
681
  if (e in t) {
682
682
  let n = Reflect.getPrototypeOf(t);
683
683
  for (; n; ) {
@@ -688,10 +688,10 @@ function Nn(t, e) {
688
688
  }
689
689
  }
690
690
  }
691
- function tn(t) {
691
+ function en(t) {
692
692
  return Object.getPrototypeOf(t) === Set.prototype;
693
693
  }
694
- function nn(t) {
694
+ function tn(t) {
695
695
  return Object.getPrototypeOf(t) === Map.prototype;
696
696
  }
697
697
  function H(t) {
@@ -702,9 +702,9 @@ function Te(t) {
702
702
  return !!A(t);
703
703
  }
704
704
  function A(t) {
705
- return typeof t != "object" ? null : t == null ? void 0 : t[Ar];
705
+ return typeof t != "object" ? null : t == null ? void 0 : t[Er];
706
706
  }
707
- function rn(t) {
707
+ function nn(t) {
708
708
  var e;
709
709
  const n = A(t);
710
710
  return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
@@ -715,7 +715,7 @@ function ee(t, e) {
715
715
  let n;
716
716
  return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((n = e.mark(t, Y)) === Y.immutable || typeof n == "function");
717
717
  }
718
- function jr(t, e = []) {
718
+ function Ar(t, e = []) {
719
719
  if (Object.hasOwnProperty.call(t, "key")) {
720
720
  const n = t.parent.copy, r = A(ce(n, t.key));
721
721
  if (r !== null && (r == null ? void 0 : r.original) !== t.original)
@@ -726,10 +726,10 @@ function jr(t, e = []) {
726
726
  e.push(s);
727
727
  }
728
728
  if (t.parent)
729
- return jr(t.parent, e);
729
+ return Ar(t.parent, e);
730
730
  e.reverse();
731
731
  try {
732
- Wi(t.copy, e);
732
+ Vi(t.copy, e);
733
733
  } catch {
734
734
  return null;
735
735
  }
@@ -751,7 +751,7 @@ function jt(t, e) {
751
751
  function ae(t, e) {
752
752
  return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
753
753
  }
754
- function Dt(t) {
754
+ function xt(t) {
755
755
  if (t)
756
756
  for (; t.finalities.revoke.length > 0; )
757
757
  t.finalities.revoke.pop()();
@@ -762,7 +762,7 @@ function be(t, e) {
762
762
  return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
763
763
  }).join("/");
764
764
  }
765
- function Wi(t, e) {
765
+ function Vi(t, e) {
766
766
  for (let n = 0; n < e.length - 1; n += 1) {
767
767
  const r = e[n];
768
768
  if (t = ce(me(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
@@ -770,7 +770,7 @@ function Wi(t, e) {
770
770
  }
771
771
  return t;
772
772
  }
773
- function Bi(t) {
773
+ function Wi(t) {
774
774
  const e = Object.create(Object.getPrototypeOf(t));
775
775
  return Reflect.ownKeys(t).forEach((n) => {
776
776
  let r = Reflect.getOwnPropertyDescriptor(t, n);
@@ -786,26 +786,26 @@ function Bi(t) {
786
786
  }), Reflect.defineProperty(e, n, r);
787
787
  }), e;
788
788
  }
789
- const Gi = Object.prototype.propertyIsEnumerable;
790
- function kr(t, e) {
789
+ const Bi = Object.prototype.propertyIsEnumerable;
790
+ function jr(t, e) {
791
791
  let n;
792
792
  if (Array.isArray(t))
793
793
  return Array.prototype.concat.call(t);
794
794
  if (t instanceof Set) {
795
- if (!tn(t)) {
795
+ if (!en(t)) {
796
796
  const r = Object.getPrototypeOf(t).constructor;
797
797
  return new r(t.values());
798
798
  }
799
799
  return Set.prototype.difference ? Set.prototype.difference.call(t, /* @__PURE__ */ new Set()) : new Set(t.values());
800
800
  } else if (t instanceof Map) {
801
- if (!nn(t)) {
801
+ if (!tn(t)) {
802
802
  const r = Object.getPrototypeOf(t).constructor;
803
803
  return new r(t);
804
804
  }
805
805
  return new Map(t);
806
806
  } else if (e != null && e.mark && (n = e.mark(t, Y), n !== void 0) && n !== Y.mutable) {
807
807
  if (n === Y.immutable)
808
- return Bi(t);
808
+ return Wi(t);
809
809
  if (typeof n == "function") {
810
810
  if (e.enablePatches || e.enableAutoFreeze)
811
811
  throw new Error("You can't use mark and patches or auto freeze together.");
@@ -817,17 +817,17 @@ function kr(t, e) {
817
817
  return Object.keys(t).forEach((i) => {
818
818
  r[i] = t[i];
819
819
  }), Object.getOwnPropertySymbols(t).forEach((i) => {
820
- Gi.call(t, i) && (r[i] = t[i]);
820
+ Bi.call(t, i) && (r[i] = t[i]);
821
821
  }), r;
822
822
  } else
823
823
  throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
824
824
  }
825
825
  function V(t) {
826
- t.copy || (t.copy = kr(t.original, t.options));
826
+ t.copy || (t.copy = jr(t.original, t.options));
827
827
  }
828
828
  function Ue(t) {
829
829
  if (!ee(t))
830
- return rn(t);
830
+ return nn(t);
831
831
  if (Array.isArray(t))
832
832
  return t.map(Ue);
833
833
  if (t instanceof Map) {
@@ -835,7 +835,7 @@ function Ue(t) {
835
835
  r,
836
836
  Ue(i)
837
837
  ]);
838
- if (!nn(t)) {
838
+ if (!tn(t)) {
839
839
  const r = Object.getPrototypeOf(t).constructor;
840
840
  return new r(n);
841
841
  }
@@ -843,7 +843,7 @@ function Ue(t) {
843
843
  }
844
844
  if (t instanceof Set) {
845
845
  const n = Array.from(t).map(Ue);
846
- if (!tn(t)) {
846
+ if (!en(t)) {
847
847
  const r = Object.getPrototypeOf(t).constructor;
848
848
  return new r(n);
849
849
  }
@@ -861,7 +861,7 @@ function ie(t) {
861
861
  var e;
862
862
  t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && ie(t.parent));
863
863
  }
864
- function Kn() {
864
+ function Nn() {
865
865
  throw new Error("Cannot modify frozen object");
866
866
  }
867
867
  function Se(t, e, n, r, i) {
@@ -889,12 +889,12 @@ function Se(t, e, n, r, i) {
889
889
  case 2:
890
890
  for (const [u, a] of t)
891
891
  Se(u, u, n, r, i), Se(a, u, n, r, i);
892
- t.set = t.clear = t.delete = Kn;
892
+ t.set = t.clear = t.delete = Nn;
893
893
  break;
894
894
  case 3:
895
895
  for (const u of t)
896
896
  Se(u, u, n, r, i);
897
- t.add = t.clear = t.delete = Kn;
897
+ t.add = t.clear = t.delete = Nn;
898
898
  break;
899
899
  case 1:
900
900
  Object.freeze(t);
@@ -910,7 +910,7 @@ function Se(t, e, n, r, i) {
910
910
  }
911
911
  r.pop(), i.pop();
912
912
  }
913
- function sn(t, e) {
913
+ function rn(t, e) {
914
914
  const n = me(t);
915
915
  if (n === 0)
916
916
  Reflect.ownKeys(t).forEach((r) => {
@@ -923,11 +923,11 @@ function sn(t, e) {
923
923
  } else
924
924
  t.forEach((r, i) => e(i, r, t));
925
925
  }
926
- function Cr(t, e, n) {
926
+ function kr(t, e, n) {
927
927
  if (Te(t) || !ee(t, n) || e.has(t) || Object.isFrozen(t))
928
928
  return;
929
929
  const r = t instanceof Set, i = r ? /* @__PURE__ */ new Map() : void 0;
930
- if (e.add(t), sn(t, (s, o) => {
930
+ if (e.add(t), rn(t, (s, o) => {
931
931
  var u;
932
932
  if (Te(o)) {
933
933
  const a = A(o);
@@ -935,7 +935,7 @@ function Cr(t, e, n) {
935
935
  const d = !((u = a.assignedMap) === null || u === void 0) && u.size || a.operated ? a.copy : a.original;
936
936
  We(r ? i : t, s, d);
937
937
  } else
938
- Cr(o, e, n);
938
+ kr(o, e, n);
939
939
  }), i) {
940
940
  const s = t, o = Array.from(s);
941
941
  s.clear(), o.forEach((u) => {
@@ -943,39 +943,39 @@ function Cr(t, e, n) {
943
943
  });
944
944
  }
945
945
  }
946
- function Qi(t, e) {
946
+ function Gi(t, e) {
947
947
  const n = t.type === 3 ? t.setMap : t.copy;
948
- t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && Cr(ce(n, e), t.finalities.handledSet, t.options);
948
+ t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && kr(ce(n, e), t.finalities.handledSet, t.options);
949
949
  }
950
- function Ut(t) {
950
+ function Dt(t) {
951
951
  t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
952
- t.copy.add(rn(e));
952
+ t.copy.add(nn(e));
953
953
  }));
954
954
  }
955
- function Lt(t, e, n, r) {
955
+ function Ut(t, e, n, r) {
956
956
  if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
957
957
  if (n && r) {
958
- const s = jr(t);
958
+ const s = Ar(t);
959
959
  s && e(t, s, n, r);
960
960
  }
961
961
  t.finalized = !0;
962
962
  }
963
963
  }
964
- function on(t, e, n, r) {
964
+ function sn(t, e, n, r) {
965
965
  const i = A(n);
966
966
  i && (i.callbacks || (i.callbacks = []), i.callbacks.push((s, o) => {
967
967
  var u;
968
968
  const a = t.type === 3 ? t.setMap : t.copy;
969
969
  if (ae(ce(a, e), n)) {
970
970
  let d = i.original;
971
- i.copy && (d = i.copy), Ut(t), Lt(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (u = t.options.updatedValues) !== null && u !== void 0 ? u : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)), We(a, e, d);
971
+ i.copy && (d = i.copy), Dt(t), Ut(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (u = t.options.updatedValues) !== null && u !== void 0 ? u : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)), We(a, e, d);
972
972
  }
973
973
  }), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ee(n, t.options) && t.finalities.draft.push(() => {
974
974
  const s = t.type === 3 ? t.setMap : t.copy;
975
- ae(ce(s, e), n) && Qi(t, e);
975
+ ae(ce(s, e), n) && Gi(t, e);
976
976
  });
977
977
  }
978
- function Hi(t, e, n, r, i) {
978
+ function Qi(t, e, n, r, i) {
979
979
  let { original: s, assignedMap: o, options: u } = t, a = t.copy;
980
980
  a.length < s.length && ([s, a] = [a, s], [n, r] = [r, n]);
981
981
  for (let d = 0; d < s.length; d += 1)
@@ -1021,7 +1021,7 @@ function Hi(t, e, n, r, i) {
1021
1021
  }
1022
1022
  }
1023
1023
  }
1024
- function Yi({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
1024
+ function Hi({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
1025
1025
  n.forEach((u, a) => {
1026
1026
  const d = ce(t, a), c = ot(ce(e, a)), f = u ? Ne(t, a) ? x.Replace : x.Add : x.Remove;
1027
1027
  if (ae(d, c) && f === x.Replace)
@@ -1030,7 +1030,7 @@ function Yi({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
1030
1030
  i.push(f === x.Remove ? { op: f, path: p } : { op: f, path: p, value: c }), s.push(f === x.Add ? { op: x.Remove, path: p } : f === x.Remove ? { op: x.Add, path: p, value: d } : { op: x.Replace, path: p, value: d });
1031
1031
  });
1032
1032
  }
1033
- function Ji({ original: t, copy: e }, n, r, i, s) {
1033
+ function Yi({ original: t, copy: e }, n, r, i, s) {
1034
1034
  let o = 0;
1035
1035
  t.forEach((u) => {
1036
1036
  if (!e.has(u)) {
@@ -1067,17 +1067,17 @@ function Ve(t, e, n, r) {
1067
1067
  switch (t.type) {
1068
1068
  case 0:
1069
1069
  case 2:
1070
- return Yi(t, e, n, r, i);
1071
- case 1:
1072
1070
  return Hi(t, e, n, r, i);
1071
+ case 1:
1072
+ return Qi(t, e, n, r, i);
1073
1073
  case 3:
1074
- return Ji(t, e, n, r, i);
1074
+ return Yi(t, e, n, r, i);
1075
1075
  }
1076
1076
  }
1077
1077
  const ct = (t, e, n = !1) => {
1078
1078
  if (typeof t == "object" && t !== null && (!ee(t, e) || n))
1079
1079
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
1080
- }, Ft = {
1080
+ }, Lt = {
1081
1081
  get size() {
1082
1082
  return H(A(this)).size;
1083
1083
  },
@@ -1086,7 +1086,7 @@ const ct = (t, e, n = !1) => {
1086
1086
  },
1087
1087
  set(t, e) {
1088
1088
  const n = A(this), r = H(n);
1089
- return (!r.has(t) || !ae(r.get(t), e)) && (V(n), ie(n), n.assignedMap.set(t, !0), n.copy.set(t, e), on(n, t, e, Ve)), this;
1089
+ return (!r.has(t) || !ae(r.get(t), e)) && (V(n), ie(n), n.assignedMap.set(t, !0), n.copy.set(t, e), sn(n, t, e, Ve)), this;
1090
1090
  },
1091
1091
  delete(t) {
1092
1092
  if (!this.has(t))
@@ -1114,7 +1114,7 @@ const ct = (t, e, n = !1) => {
1114
1114
  const r = A(this), i = H(r).get(t), s = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, i, Y)) === Y.mutable;
1115
1115
  if (r.options.strict && ct(i, r.options, s), s || r.finalized || !ee(i, r.options) || i !== r.original.get(t))
1116
1116
  return i;
1117
- const o = en.createDraft({
1117
+ const o = Xt.createDraft({
1118
1118
  original: i,
1119
1119
  parentDraft: r,
1120
1120
  key: t,
@@ -1158,7 +1158,7 @@ const ct = (t, e, n = !1) => {
1158
1158
  [st]() {
1159
1159
  return this.entries();
1160
1160
  }
1161
- }, Zi = Reflect.ownKeys(Ft), qn = (t, e, { isValuesIterator: n }) => () => {
1161
+ }, Ji = Reflect.ownKeys(Lt), Kn = (t, e, { isValuesIterator: n }) => () => {
1162
1162
  var r, i;
1163
1163
  const s = e.next();
1164
1164
  if (s.done)
@@ -1167,7 +1167,7 @@ const ct = (t, e, n = !1) => {
1167
1167
  let u = t.setMap.get(o);
1168
1168
  const a = A(u), d = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, u, Y)) === Y.mutable;
1169
1169
  if (t.options.strict && ct(o, t.options, d), !d && !a && ee(o, t.options) && !t.finalized && t.original.has(o)) {
1170
- const c = en.createDraft({
1170
+ const c = Xt.createDraft({
1171
1171
  original: o,
1172
1172
  parentDraft: t,
1173
1173
  key: o,
@@ -1194,7 +1194,7 @@ const ct = (t, e, n = !1) => {
1194
1194
  },
1195
1195
  add(t) {
1196
1196
  const e = A(this);
1197
- return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), on(e, t, t, Ve)), this;
1197
+ return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), sn(e, t, t, Ve)), this;
1198
1198
  },
1199
1199
  delete(t) {
1200
1200
  if (!this.has(t))
@@ -1219,7 +1219,7 @@ const ct = (t, e, n = !1) => {
1219
1219
  const e = t.setMap.keys();
1220
1220
  return {
1221
1221
  [Symbol.iterator]: () => this.values(),
1222
- next: qn(t, e, { isValuesIterator: !0 })
1222
+ next: Kn(t, e, { isValuesIterator: !0 })
1223
1223
  };
1224
1224
  },
1225
1225
  entries() {
@@ -1228,7 +1228,7 @@ const ct = (t, e, n = !1) => {
1228
1228
  const e = t.setMap.keys();
1229
1229
  return {
1230
1230
  [Symbol.iterator]: () => this.entries(),
1231
- next: qn(t, e, {
1231
+ next: Kn(t, e, {
1232
1232
  isValuesIterator: !1
1233
1233
  })
1234
1234
  };
@@ -1269,13 +1269,13 @@ Set.prototype.difference && Object.assign(dt, {
1269
1269
  return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
1270
1270
  }
1271
1271
  });
1272
- const Xi = Reflect.ownKeys(dt), Pr = /* @__PURE__ */ new WeakSet(), Ir = {
1272
+ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
1273
1273
  get(t, e, n) {
1274
1274
  var r, i;
1275
1275
  const s = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
1276
- if (s && Pr.has(s))
1276
+ if (s && Cr.has(s))
1277
1277
  return s;
1278
- if (e === Ar)
1278
+ if (e === Er)
1279
1279
  return t;
1280
1280
  let o;
1281
1281
  if (t.options.mark) {
@@ -1284,14 +1284,14 @@ const Xi = Reflect.ownKeys(dt), Pr = /* @__PURE__ */ new WeakSet(), Ir = {
1284
1284
  return t.options.strict && ct(d, t.options, !0), d;
1285
1285
  }
1286
1286
  const u = H(t);
1287
- if (u instanceof Map && Zi.includes(e)) {
1287
+ if (u instanceof Map && Ji.includes(e)) {
1288
1288
  if (e === "size")
1289
- return Object.getOwnPropertyDescriptor(Ft, "size").get.call(t.proxy);
1290
- const d = Ft[e];
1289
+ return Object.getOwnPropertyDescriptor(Lt, "size").get.call(t.proxy);
1290
+ const d = Lt[e];
1291
1291
  if (d)
1292
1292
  return d.bind(t.proxy);
1293
1293
  }
1294
- if (u instanceof Set && Xi.includes(e)) {
1294
+ if (u instanceof Set && Zi.includes(e)) {
1295
1295
  if (e === "size")
1296
1296
  return Object.getOwnPropertyDescriptor(dt, "size").get.call(t.proxy);
1297
1297
  const d = dt[e];
@@ -1299,7 +1299,7 @@ const Xi = Reflect.ownKeys(dt), Pr = /* @__PURE__ */ new WeakSet(), Ir = {
1299
1299
  return d.bind(t.proxy);
1300
1300
  }
1301
1301
  if (!Ne(u, e)) {
1302
- const d = Nn(u, e);
1302
+ const d = Fn(u, e);
1303
1303
  return d ? "value" in d ? d.value : (
1304
1304
  // !case: support for getter
1305
1305
  (i = d.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
@@ -1309,7 +1309,7 @@ const Xi = Reflect.ownKeys(dt), Pr = /* @__PURE__ */ new WeakSet(), Ir = {
1309
1309
  if (t.options.strict && ct(a, t.options), t.finalized || !ee(a, t.options))
1310
1310
  return a;
1311
1311
  if (a === jt(t.original, e)) {
1312
- if (V(t), t.copy[e] = un({
1312
+ if (V(t), t.copy[e] = on({
1313
1313
  original: t.original[e],
1314
1314
  parentDraft: t,
1315
1315
  key: t.type === 1 ? Number(e) : e,
@@ -1330,11 +1330,11 @@ const Xi = Reflect.ownKeys(dt), Pr = /* @__PURE__ */ new WeakSet(), Ir = {
1330
1330
  let i;
1331
1331
  if (t.type === 1 && e !== "length" && !(Number.isInteger(i = Number(e)) && i >= 0 && (e === 0 || i === 0 || String(i) === String(e))))
1332
1332
  throw new Error("Only supports setting array indices and the 'length' property.");
1333
- const s = Nn(H(t), e);
1333
+ const s = Fn(H(t), e);
1334
1334
  if (s != null && s.set)
1335
1335
  return s.set.call(t.proxy, n), !0;
1336
1336
  const o = jt(H(t), e), u = A(o);
1337
- return u && ae(u.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ae(n, o) && (n !== void 0 || Ne(t.original, e)) || (V(t), ie(t), Ne(t.original, e) && ae(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, on(t, e, n, Ve)), !0);
1337
+ return u && ae(u.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ae(n, o) && (n !== void 0 || Ne(t.original, e)) || (V(t), ie(t), Ne(t.original, e) && ae(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, sn(t, e, n, Ve)), !0);
1338
1338
  },
1339
1339
  has(t, e) {
1340
1340
  return e in H(t);
@@ -1362,10 +1362,10 @@ const Xi = Reflect.ownKeys(dt), Pr = /* @__PURE__ */ new WeakSet(), Ir = {
1362
1362
  },
1363
1363
  deleteProperty(t, e) {
1364
1364
  var n;
1365
- return t.type === 1 ? Ir.set.call(this, t, e, void 0, t.proxy) : (jt(t.original, e) !== void 0 || e in t.original ? (V(t), ie(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);
1365
+ return t.type === 1 ? Pr.set.call(this, t, e, void 0, t.proxy) : (jt(t.original, e) !== void 0 || e in t.original ? (V(t), ie(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);
1366
1366
  }
1367
1367
  };
1368
- function un(t) {
1368
+ function on(t) {
1369
1369
  const { original: e, parentDraft: n, key: r, finalities: i, options: s } = t, o = me(e), u = {
1370
1370
  type: o,
1371
1371
  finalized: !1,
@@ -1379,8 +1379,8 @@ function un(t) {
1379
1379
  setMap: o === 3 ? new Map(e.entries()) : void 0
1380
1380
  };
1381
1381
  (r || "key" in t) && (u.key = r);
1382
- const { proxy: a, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], u) : u, Ir);
1383
- if (i.revoke.push(d), Pr.add(a), u.proxy = a, n) {
1382
+ const { proxy: a, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], u) : u, Pr);
1383
+ if (i.revoke.push(d), Cr.add(a), u.proxy = a, n) {
1384
1384
  const c = n;
1385
1385
  c.finalities.draft.push((f, l) => {
1386
1386
  var p, y;
@@ -1389,7 +1389,7 @@ function un(t) {
1389
1389
  const m = ce(g, r), T = A(m);
1390
1390
  if (T) {
1391
1391
  let v = T.original;
1392
- T.operated && (v = rn(m)), Ut(T), Lt(T, Ve, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(v, T.original)), We(g, r, v);
1392
+ T.operated && (v = nn(m)), Dt(T), Ut(T, Ve, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(v, T.original)), We(g, r, v);
1393
1393
  }
1394
1394
  (y = b.callbacks) === null || y === void 0 || y.forEach((v) => {
1395
1395
  v(f, l);
@@ -1398,26 +1398,26 @@ function un(t) {
1398
1398
  } else {
1399
1399
  const c = A(a);
1400
1400
  c.finalities.draft.push((f, l) => {
1401
- Ut(c), Lt(c, Ve, f, l);
1401
+ Dt(c), Ut(c, Ve, f, l);
1402
1402
  });
1403
1403
  }
1404
1404
  return a;
1405
1405
  }
1406
- en.createDraft = un;
1407
- function es(t, e, n, r, i) {
1406
+ Xt.createDraft = on;
1407
+ function Xi(t, e, n, r, i) {
1408
1408
  var s;
1409
1409
  const o = A(t), u = (s = o == null ? void 0 : o.original) !== null && s !== void 0 ? s : t, a = !!e.length;
1410
1410
  if (o != null && o.operated)
1411
1411
  for (; o.finalities.draft.length > 0; )
1412
1412
  o.finalities.draft.pop()(n, r);
1413
1413
  const d = a ? e[0] : o ? o.operated ? o.copy : o.original : t;
1414
- return o && Dt(o), i && Se(d, d, o == null ? void 0 : o.options.updatedValues), [
1414
+ return o && xt(o), i && Se(d, d, o == null ? void 0 : o.options.updatedValues), [
1415
1415
  d,
1416
1416
  n && a ? [{ op: x.Replace, path: [], value: e[0] }] : n,
1417
1417
  r && a ? [{ op: x.Replace, path: [], value: u }] : r
1418
1418
  ];
1419
1419
  }
1420
- function ts(t, e) {
1420
+ function es(t, e) {
1421
1421
  var n;
1422
1422
  const r = {
1423
1423
  draft: [],
@@ -1426,7 +1426,7 @@ function ts(t, e) {
1426
1426
  };
1427
1427
  let i, s;
1428
1428
  e.enablePatches && (i = [], s = []);
1429
- const u = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, Y)) === Y.mutable || !ee(t, e) ? t : un({
1429
+ const u = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, Y)) === Y.mutable || !ee(t, e) ? t : on({
1430
1430
  original: t,
1431
1431
  parentDraft: null,
1432
1432
  finalities: r,
@@ -1435,14 +1435,14 @@ function ts(t, e) {
1435
1435
  return [
1436
1436
  u,
1437
1437
  (a = []) => {
1438
- const [d, c, f] = es(u, a, i, s, e.enableAutoFreeze);
1438
+ const [d, c, f] = Xi(u, a, i, s, e.enableAutoFreeze);
1439
1439
  return e.enablePatches ? [d, c, f] : d;
1440
1440
  }
1441
1441
  ];
1442
1442
  }
1443
- function Nt(t) {
1443
+ function Ft(t) {
1444
1444
  const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: i = !0 } = t;
1445
- sn(n, (s, o, u) => {
1445
+ rn(n, (s, o, u) => {
1446
1446
  const a = A(o);
1447
1447
  if (a && e && a.finalities === e.finalities) {
1448
1448
  t.isContainDraft = !0;
@@ -1452,10 +1452,10 @@ function Nt(t) {
1452
1452
  u.clear(), c.forEach((f) => u.add(s === f ? d : f));
1453
1453
  } else
1454
1454
  We(u, s, d);
1455
- } else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, Nt(t));
1455
+ } else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, Ft(t));
1456
1456
  }), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
1457
1457
  }
1458
- function Mr(t) {
1458
+ function Ir(t) {
1459
1459
  var e;
1460
1460
  const n = A(t);
1461
1461
  if (!ee(t, n == null ? void 0 : n.options))
@@ -1465,7 +1465,7 @@ function Mr(t) {
1465
1465
  return n.original;
1466
1466
  let i;
1467
1467
  function s() {
1468
- i = r === 2 ? nn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : kr(t, n == null ? void 0 : n.options);
1468
+ i = r === 2 ? tn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : jr(t, n == null ? void 0 : n.options);
1469
1469
  }
1470
1470
  if (n) {
1471
1471
  n.finalized = !0;
@@ -1476,23 +1476,23 @@ function Mr(t) {
1476
1476
  }
1477
1477
  } else
1478
1478
  i = t;
1479
- if (sn(i, (o, u) => {
1479
+ if (rn(i, (o, u) => {
1480
1480
  if (n && ae(ce(n.original, o), u))
1481
1481
  return;
1482
- const a = Mr(u);
1482
+ const a = Ir(u);
1483
1483
  a !== u && (i === t && s(), We(i, o, a));
1484
1484
  }), r === 3) {
1485
1485
  const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : i;
1486
- return tn(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
1486
+ return en(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
1487
1487
  }
1488
1488
  return i;
1489
1489
  }
1490
- function zn(t) {
1490
+ function qn(t) {
1491
1491
  if (!Te(t))
1492
1492
  throw new Error(`current() is only used for Draft, parameter: ${t}`);
1493
- return Mr(t);
1493
+ return Ir(t);
1494
1494
  }
1495
- const ns = (t) => function e(n, r, i) {
1495
+ const ts = (t) => function e(n, r, i) {
1496
1496
  var s, o, u;
1497
1497
  if (typeof n == "function" && typeof r != "function")
1498
1498
  return function(S, ...I) {
@@ -1503,7 +1503,7 @@ const ns = (t) => function e(n, r, i) {
1503
1503
  if (typeof r != "function" && (c = r), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
1504
1504
  throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
1505
1505
  c = Object.assign(Object.assign({}, t), c);
1506
- const f = Te(a) ? zn(a) : a, l = Array.isArray(c.mark) ? (S, I) => {
1506
+ const f = Te(a) ? qn(a) : a, l = Array.isArray(c.mark) ? (S, I) => {
1507
1507
  for (const R of c.mark) {
1508
1508
  if (typeof R != "function")
1509
1509
  throw new Error(`Invalid mark: ${R}, 'mark' should be a function.`);
@@ -1519,7 +1519,7 @@ const ns = (t) => function e(n, r, i) {
1519
1519
  };
1520
1520
  if (!ee(f, g) && typeof f == "object" && f !== null)
1521
1521
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
1522
- const [m, T] = ts(f, g);
1522
+ const [m, T] = es(f, g);
1523
1523
  if (typeof r != "function") {
1524
1524
  if (!ee(f, g))
1525
1525
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
@@ -1529,24 +1529,24 @@ const ns = (t) => function e(n, r, i) {
1529
1529
  try {
1530
1530
  v = d(m);
1531
1531
  } catch (S) {
1532
- throw Dt(A(m)), S;
1532
+ throw xt(A(m)), S;
1533
1533
  }
1534
1534
  const k = (S) => {
1535
1535
  const I = A(m);
1536
1536
  if (!Te(S)) {
1537
1537
  if (S !== void 0 && !ae(S, m) && (I != null && I.operated))
1538
1538
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
1539
- const q = S == null ? void 0 : S[Vi];
1539
+ const q = S == null ? void 0 : S[zi];
1540
1540
  if (q) {
1541
1541
  const Ie = q[0];
1542
- return g.strict && typeof S == "object" && S !== null && Nt({
1542
+ return g.strict && typeof S == "object" && S !== null && Ft({
1543
1543
  rootDraft: I,
1544
1544
  value: S,
1545
1545
  useRawReturn: !0
1546
1546
  }), T([Ie]);
1547
1547
  }
1548
1548
  if (S !== void 0)
1549
- return typeof S == "object" && S !== null && Nt({ rootDraft: I, value: S }), T([S]);
1549
+ return typeof S == "object" && S !== null && Ft({ rootDraft: I, value: S }), T([S]);
1550
1550
  }
1551
1551
  if (S === m || S === void 0)
1552
1552
  return T([]);
@@ -1554,26 +1554,26 @@ const ns = (t) => function e(n, r, i) {
1554
1554
  if (g === R.options) {
1555
1555
  if (R.operated)
1556
1556
  throw new Error("Cannot return a modified child draft.");
1557
- return T([zn(S)]);
1557
+ return T([qn(S)]);
1558
1558
  }
1559
1559
  return T([S]);
1560
1560
  };
1561
1561
  return v instanceof Promise ? v.then(k, (S) => {
1562
- throw Dt(A(m)), S;
1562
+ throw xt(A(m)), S;
1563
1563
  }) : k(v);
1564
- }, ft = ns();
1564
+ }, ft = ts();
1565
1565
  Object.prototype.constructor.toString();
1566
- function Rr(t, e) {
1566
+ function Mr(t, e) {
1567
1567
  const n = Object.keys(t), r = Object.keys(e);
1568
1568
  return n.length === r.length && Object.keys(t).every((i) => e.hasOwnProperty(i));
1569
1569
  }
1570
- function Vn(t, e) {
1570
+ function zn(t, e) {
1571
1571
  return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((n) => e.hasOwnProperty(n) && t[n] === e[n]);
1572
1572
  }
1573
1573
  function ut(t, e) {
1574
- return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : Rr(t, e) ? Object.keys(t).every((n) => ut(t[n], e[n])) : !1;
1574
+ return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : Mr(t, e) ? Object.keys(t).every((n) => ut(t[n], e[n])) : !1;
1575
1575
  }
1576
- function an(t) {
1576
+ function un(t) {
1577
1577
  if (!Le(t))
1578
1578
  return t;
1579
1579
  const e = {};
@@ -1581,7 +1581,7 @@ function an(t) {
1581
1581
  r !== void 0 && (e[n] = r);
1582
1582
  return e;
1583
1583
  }
1584
- function $r(t, e) {
1584
+ function Rr(t, e) {
1585
1585
  if (!Le(t) || !Le(e))
1586
1586
  return e;
1587
1587
  const n = Object.assign({}, t);
@@ -1593,14 +1593,14 @@ function $r(t, e) {
1593
1593
  continue;
1594
1594
  }
1595
1595
  const i = Le(t[r]) && Le(e[r]);
1596
- n[r] = i ? $r(t[r], e[r]) : e[r];
1596
+ n[r] = i ? Rr(t[r], e[r]) : e[r];
1597
1597
  }
1598
1598
  return n;
1599
1599
  }
1600
1600
  function Le(t) {
1601
1601
  return typeof t == "object" && t !== null && !Array.isArray(t);
1602
1602
  }
1603
- function rs(t, e, n) {
1603
+ function ns(t, e, n) {
1604
1604
  if (!t || e.length === 0)
1605
1605
  return;
1606
1606
  let r = t || {};
@@ -1611,7 +1611,7 @@ function rs(t, e, n) {
1611
1611
  const i = e[e.length - 1];
1612
1612
  Array.isArray(r) && typeof i == "number" ? r.splice(i, 0, n) : r[i] = n;
1613
1613
  }
1614
- function Wn(t, e, n) {
1614
+ function Vn(t, e, n) {
1615
1615
  if (!t || e.length === 0)
1616
1616
  return;
1617
1617
  let r = t || {};
@@ -1621,7 +1621,7 @@ function Wn(t, e, n) {
1621
1621
  }
1622
1622
  r[e[e.length - 1]] = n;
1623
1623
  }
1624
- function xr(t, e) {
1624
+ function $r(t, e) {
1625
1625
  if (!t || e.length === 0)
1626
1626
  return;
1627
1627
  const [n, ...r] = e;
@@ -1630,13 +1630,13 @@ function xr(t, e) {
1630
1630
  Array.isArray(t) ? t.splice(n, 1) : delete t[n];
1631
1631
  return;
1632
1632
  }
1633
- xr(t[n], r), is(t[n]) && delete t[n];
1633
+ $r(t[n], r), rs(t[n]) && delete t[n];
1634
1634
  }
1635
1635
  }
1636
- function is(t) {
1636
+ function rs(t) {
1637
1637
  return t && Object.keys(t).length === 0;
1638
1638
  }
1639
- const Bn = /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$/, ss = {
1639
+ const Wn = /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$/, is = {
1640
1640
  ZULU: 0,
1641
1641
  YEKT: 18e3,
1642
1642
  YEKST: 21600,
@@ -1832,39 +1832,39 @@ const Bn = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
1832
1832
  ACSST: 37800,
1833
1833
  ACDT: 37800
1834
1834
  };
1835
- function os(t) {
1835
+ function ss(t) {
1836
1836
  return new Date(t);
1837
1837
  }
1838
- function us(t) {
1838
+ function os(t) {
1839
1839
  return /* @__PURE__ */ new Date(t + "Z");
1840
1840
  }
1841
- const as = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
1842
- function cs(t) {
1843
- const e = t.match(as);
1841
+ const us = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
1842
+ function as(t) {
1843
+ const e = t.match(us);
1844
1844
  if (!e)
1845
1845
  return null;
1846
1846
  const [n, r, i, s] = e;
1847
1847
  return r <= 0 || i <= 0 || s <= 0 ? null : r > 999 ? new Date(Date.UTC(r, i - 1, s, 0, 0, 0, 0)) : new Date(Date.UTC(s, r - 1, i, 0, 0, 0, 0));
1848
1848
  }
1849
- function ds(t) {
1849
+ function cs(t) {
1850
1850
  const [e, n] = t.split(" ");
1851
1851
  return /* @__PURE__ */ new Date(e + "T" + n + "Z");
1852
1852
  }
1853
- function fs(t) {
1853
+ function ds(t) {
1854
1854
  const [e, n] = t.split(" ");
1855
1855
  return /* @__PURE__ */ new Date(e + "T" + n + "Z");
1856
1856
  }
1857
- function ls(t) {
1857
+ function fs(t) {
1858
1858
  return new Date(t);
1859
1859
  }
1860
- function hs(t) {
1860
+ function ls(t) {
1861
1861
  const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
1862
1862
  if (!t.match(e))
1863
1863
  throw new Error(`Unable to parse \`${t}\` as a date.`);
1864
1864
  const r = /* @__PURE__ */ new Date(t + " UTC");
1865
1865
  return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate(), 0, 0, 0, 0));
1866
1866
  }
1867
- function ps(t) {
1867
+ function hs(t) {
1868
1868
  const e = /^(.+T.+)([+-])(\d{2})$/, n = t.match(e);
1869
1869
  if (n) {
1870
1870
  const [, r, i, s] = n, o = `${r}${i}${s}:00`;
@@ -1872,7 +1872,7 @@ function ps(t) {
1872
1872
  }
1873
1873
  return null;
1874
1874
  }
1875
- function ys(t) {
1875
+ function ps(t) {
1876
1876
  const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, n = t.match(e);
1877
1877
  if (n) {
1878
1878
  const [, r, i, s, o, u] = n, a = i.padStart(2, "0"), d = s.padStart(2, "0"), c = `${r}-${a}-${d}T${u}`;
@@ -1880,14 +1880,14 @@ function ys(t) {
1880
1880
  }
1881
1881
  return null;
1882
1882
  }
1883
- function bs(t) {
1883
+ function ys(t) {
1884
1884
  const [e, n] = t.split(", "), [r, i, s] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
1885
1885
  if (!o)
1886
1886
  throw new Error(`Unable to parse time from: ${t}`);
1887
1887
  let [, u, a, d, c] = o;
1888
1888
  return u = Number(u), a = Number(a), d = Number(d), c === "PM" && u !== 12 ? u += 12 : c === "AM" && u === 12 && (u = 0), new Date(Date.UTC(s, r - 1, i, u, a, d));
1889
1889
  }
1890
- function _s(t) {
1890
+ function bs(t) {
1891
1891
  switch (t) {
1892
1892
  case "epoch":
1893
1893
  return /* @__PURE__ */ new Date(0);
@@ -1899,28 +1899,28 @@ function _s(t) {
1899
1899
  return null;
1900
1900
  }
1901
1901
  }
1902
- function gs(t) {
1903
- const e = t.match(Bn);
1902
+ function _s(t) {
1903
+ const e = t.match(Wn);
1904
1904
  if (!e)
1905
1905
  return null;
1906
- const [n] = e, r = ss[n], i = new Date(t.replace(Bn, "Z"));
1906
+ const [n] = e, r = is[n], i = new Date(t.replace(Wn, "Z"));
1907
1907
  return new Date(i.getTime() - r * 1e3);
1908
1908
  }
1909
- const Ts = [
1910
- cs,
1909
+ const gs = [
1910
+ as,
1911
+ ds,
1912
+ ls,
1913
+ ys,
1911
1914
  fs,
1915
+ os,
1912
1916
  hs,
1917
+ cs,
1918
+ ss,
1913
1919
  bs,
1914
- ls,
1915
- us,
1916
- ps,
1917
- ds,
1918
- os,
1919
1920
  _s,
1920
- gs,
1921
- ys
1921
+ ps
1922
1922
  ];
1923
- function ms(t, e) {
1923
+ function Ts(t, e) {
1924
1924
  try {
1925
1925
  const n = t(e);
1926
1926
  return n instanceof Date && !isNaN(n.getTime()) ? n : null;
@@ -1928,18 +1928,18 @@ function ms(t, e) {
1928
1928
  return null;
1929
1929
  }
1930
1930
  }
1931
- function Kt(t) {
1932
- for (const e of Ts) {
1933
- const n = ms(e, t);
1931
+ function Nt(t) {
1932
+ for (const e of gs) {
1933
+ const n = Ts(e, t);
1934
1934
  if (n)
1935
1935
  return n;
1936
1936
  }
1937
1937
  return null;
1938
1938
  }
1939
- function ws(t) {
1939
+ function ms(t) {
1940
1940
  try {
1941
1941
  const e = JSON.parse(t);
1942
- return typeof e == "string" ? Kt(e) : null;
1942
+ return typeof e == "string" ? Nt(e) : null;
1943
1943
  } catch {
1944
1944
  return null;
1945
1945
  }
@@ -1951,7 +1951,7 @@ function pt(t) {
1951
1951
  if (t instanceof Date)
1952
1952
  return t;
1953
1953
  if (typeof t == "string") {
1954
- const e = Kt(t) || ws(t) || Kt(t.trim());
1954
+ const e = Nt(t) || ms(t) || Nt(t.trim());
1955
1955
  if (!e)
1956
1956
  throw new Error(`Unable to parse \`${t}\` as a date.`);
1957
1957
  return e;
@@ -1960,13 +1960,13 @@ function pt(t) {
1960
1960
  throw new Error(`Invalid date value \`${t}\`. Expected a date, number, or string, got type ${typeof t}.`);
1961
1961
  }
1962
1962
  }
1963
- function vs(t) {
1963
+ function ws(t) {
1964
1964
  return t.cardinality === "one";
1965
1965
  }
1966
- function cn(t) {
1966
+ function an(t) {
1967
1967
  return t["value-type"] === "ref";
1968
1968
  }
1969
- function dn(t) {
1969
+ function cn(t) {
1970
1970
  return t["value-type"] === "blob";
1971
1971
  }
1972
1972
  function ke(t, e) {
@@ -1996,7 +1996,7 @@ function B(t, e, n) {
1996
1996
  let s = t.get(r);
1997
1997
  s || (s = /* @__PURE__ */ new Map(), t.set(r, s)), B(s, i, n);
1998
1998
  }
1999
- function Dr(t, e, n) {
1999
+ function xr(t, e, n) {
2000
2000
  const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
2001
2001
  for (const o of e) {
2002
2002
  let [u, a, d, c] = o;
@@ -2005,22 +2005,22 @@ function Dr(t, e, n) {
2005
2005
  console.warn("no such attr", u, t);
2006
2006
  continue;
2007
2007
  }
2008
- f["checked-data-type"] === "date" && n && (d = pt(d), o[2] = d), cn(f) && B(s, [d, a, u], o), B(r, [u, a, d], o), B(i, [a, u, d], o);
2008
+ f["checked-data-type"] === "date" && n && (d = pt(d), o[2] = d), an(f) && B(s, [d, a, u], o), B(r, [u, a, d], o), B(i, [a, u, d], o);
2009
2009
  }
2010
2010
  return { eav: r, aev: i, vae: s };
2011
2011
  }
2012
- function Ur(t) {
2012
+ function Dr(t) {
2013
2013
  const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
2014
2014
  for (const s of Object.values(t)) {
2015
2015
  const o = s["forward-identity"], [u, a, d] = o, c = s["reverse-identity"];
2016
- if (B(r, [a, d], s), dn(s) && B(e, [a, d], s), s["primary?"] && B(n, [a], s), c) {
2016
+ if (B(r, [a, d], s), cn(s) && B(e, [a, d], s), s["primary?"] && B(n, [a], s), c) {
2017
2017
  const [f, l, p] = c;
2018
2018
  B(i, [l, p], s);
2019
2019
  }
2020
2020
  }
2021
2021
  return { blobAttrs: e, primaryKeys: n, forwardIdents: r, revIdents: i };
2022
2022
  }
2023
- function Lr(t) {
2023
+ function Ur(t) {
2024
2024
  return {
2025
2025
  __type: t.__type,
2026
2026
  attrs: t.attrs,
@@ -2030,18 +2030,18 @@ function Lr(t) {
2030
2030
  useDateObjects: t.useDateObjects
2031
2031
  };
2032
2032
  }
2033
- function Fr(t) {
2033
+ function Lr(t) {
2034
2034
  return at(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
2035
2035
  }
2036
- function Ss(t, e) {
2036
+ function vs(t, e) {
2037
2037
  return Ce(t.eav, [e]) !== void 0;
2038
2038
  }
2039
- function fn(t) {
2040
- t.attrIndexes = Ur(t.attrs);
2039
+ function dn(t) {
2040
+ t.attrIndexes = Dr(t.attrs);
2041
2041
  }
2042
2042
  function at(t, e, n, r, i) {
2043
- const s = Dr(t, e, i);
2044
- return s.useDateObjects = i, s.attrs = t, s.attrIndexes = Ur(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
2043
+ const s = xr(t, e, i);
2044
+ return s.useDateObjects = i, s.attrs = t, s.attrIndexes = Dr(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
2045
2045
  }
2046
2046
  function Be(t, e) {
2047
2047
  var n, r;
@@ -2070,21 +2070,21 @@ function Be(t, e) {
2070
2070
  return [i, ...u];
2071
2071
  }
2072
2072
  }
2073
- function Nr(t, e) {
2073
+ function Fr(t, e) {
2074
2074
  const n = Be(t, e);
2075
2075
  if (!n)
2076
2076
  return;
2077
2077
  const [r, i, s] = n, o = ke(t.attrs, i);
2078
- o && (X(t.eav, [r, i, s]), X(t.aev, [i, r, s]), cn(o) && X(t.vae, [s, i, r]));
2078
+ o && (X(t.eav, [r, i, s]), X(t.aev, [i, r, s]), an(o) && X(t.vae, [s, i, r]));
2079
2079
  }
2080
- let Os = 0;
2081
- function Kr(t, e, n) {
2080
+ let Ss = 0;
2081
+ function Nr(t, e, n) {
2082
2082
  const [r, i, s] = n;
2083
2083
  let o;
2084
2084
  const u = Ce(t.eav, [r, i, s]);
2085
- return u && (o = u[3]), o || Date.now() * 10 + Os++;
2085
+ return u && (o = u[3]), o || Date.now() * 10 + Ss++;
2086
2086
  }
2087
- function qr(t, e) {
2087
+ function Kr(t, e) {
2088
2088
  var n;
2089
2089
  const r = Be(t, e);
2090
2090
  if (!r)
@@ -2094,10 +2094,10 @@ function qr(t, e) {
2094
2094
  if (!u)
2095
2095
  return;
2096
2096
  u["checked-data-type"] === "date" && t.useDateObjects && (o = pt(o));
2097
- const a = Ce(t.eav, [i, s, o]), d = (n = a == null ? void 0 : a[3]) !== null && n !== void 0 ? n : Kr(t, u, r), c = [i, s, o, d];
2098
- vs(u) ? (B(t.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), B(t.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (B(t.eav, [i, s, o], c), B(t.aev, [s, i, o], c)), cn(u) && B(t.vae, [o, s, i], c);
2097
+ const a = Ce(t.eav, [i, s, o]), d = (n = a == null ? void 0 : a[3]) !== null && n !== void 0 ? n : Nr(t, u, r), c = [i, s, o, d];
2098
+ ws(u) ? (B(t.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), B(t.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (B(t.eav, [i, s, o], c), B(t.aev, [s, i, o], c)), an(u) && B(t.vae, [o, s, i], c);
2099
2099
  }
2100
- function Es(t, e) {
2100
+ function Os(t, e) {
2101
2101
  var n;
2102
2102
  const r = Be(t, e);
2103
2103
  if (!r)
@@ -2105,7 +2105,7 @@ function Es(t, e) {
2105
2105
  const [i, s, o] = r, u = ke(t.attrs, s);
2106
2106
  if (!u)
2107
2107
  return;
2108
- if (!dn(u))
2108
+ if (!cn(u))
2109
2109
  throw new Error("merge operation is not supported for links");
2110
2110
  const a = Ce(t.eav, [i, s]);
2111
2111
  if (!a)
@@ -2113,15 +2113,15 @@ function Es(t, e) {
2113
2113
  const d = (n = a.values().next()) === null || n === void 0 ? void 0 : n.value;
2114
2114
  if (!d)
2115
2115
  return;
2116
- const c = d[2], f = $r(c, o), l = [
2116
+ const c = d[2], f = Rr(c, o), l = [
2117
2117
  i,
2118
2118
  s,
2119
2119
  f,
2120
- Kr(t, u, d)
2120
+ Nr(t, u, d)
2121
2121
  ];
2122
2122
  B(t.eav, [i, s], /* @__PURE__ */ new Map([[f, l]]));
2123
2123
  }
2124
- function qt(t, e) {
2124
+ function Kt(t, e) {
2125
2125
  var n, r;
2126
2126
  const [i, s] = e, o = Be(t, [i]);
2127
2127
  if (!o)
@@ -2132,7 +2132,7 @@ function qt(t, e) {
2132
2132
  const f = t.attrs[c];
2133
2133
  f && f["on-delete-reverse"] === "cascade" && G(a.get(c), 1).forEach(([l, p, y]) => {
2134
2134
  var b;
2135
- return qt(t, [y, (b = f["reverse-identity"]) === null || b === void 0 ? void 0 : b[1]]);
2135
+ return Kt(t, [y, (b = f["reverse-identity"]) === null || b === void 0 ? void 0 : b[1]]);
2136
2136
  }), // Fall back to deleting everything if we've rehydrated tx-steps from
2137
2137
  // the store that didn't set `etype` in deleteEntity
2138
2138
  (!s || // If we don't know about the attr, let's just get rid of it
@@ -2145,54 +2145,54 @@ function qt(t, e) {
2145
2145
  d && d.forEach((c) => {
2146
2146
  var f, l, p;
2147
2147
  const [y, b, g] = c, m = t.attrs[b];
2148
- (!s || !m || ((f = m["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (X(t.eav, [y, b, g]), X(t.aev, [b, y, g]), X(t.vae, [g, b, y])), m && m["on-delete"] === "cascade" && ((l = m["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && qt(t, [y, (p = m["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
2148
+ (!s || !m || ((f = m["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (X(t.eav, [y, b, g]), X(t.aev, [b, y, g]), X(t.vae, [g, b, y])), m && m["on-delete"] === "cascade" && ((l = m["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && Kt(t, [y, (p = m["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
2149
2149
  }), ((r = t.vae.get(u)) === null || r === void 0 ? void 0 : r.size) === 0 && X(t.vae, [u]);
2150
2150
  }
2151
- function zr(t, e) {
2152
- const n = Dr(t.attrs, e, t.useDateObjects);
2151
+ function qr(t, e) {
2152
+ const n = xr(t.attrs, e, t.useDateObjects);
2153
2153
  Object.keys(n).forEach((r) => {
2154
2154
  t[r] = n[r];
2155
2155
  });
2156
2156
  }
2157
- function As(t, [e]) {
2158
- t.attrs[e.id] = e, fn(t);
2157
+ function Es(t, [e]) {
2158
+ t.attrs[e.id] = e, dn(t);
2159
2159
  }
2160
- function Vr(t) {
2160
+ function zr(t) {
2161
2161
  return G(t.eav, 3);
2162
2162
  }
2163
- function js(t, [e]) {
2163
+ function As(t, [e]) {
2164
2164
  if (!t.attrs[e])
2165
2165
  return;
2166
- const n = Vr(t).filter(([r, i]) => i !== e);
2167
- delete t.attrs[e], fn(t), zr(t, n);
2166
+ const n = zr(t).filter(([r, i]) => i !== e);
2167
+ delete t.attrs[e], dn(t), qr(t, n);
2168
2168
  }
2169
- function ks(t, [e]) {
2169
+ function js(t, [e]) {
2170
2170
  const n = t.attrs[e.id];
2171
- n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), fn(t), zr(t, Vr(t)));
2171
+ n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), dn(t), qr(t, zr(t)));
2172
2172
  }
2173
- function Cs(t, e) {
2173
+ function ks(t, e) {
2174
2174
  const [n, ...r] = e;
2175
2175
  switch (n) {
2176
2176
  case "add-triple":
2177
- qr(t, r);
2177
+ Kr(t, r);
2178
2178
  break;
2179
2179
  case "deep-merge-triple":
2180
- Es(t, r);
2180
+ Os(t, r);
2181
2181
  break;
2182
2182
  case "retract-triple":
2183
- Nr(t, r);
2183
+ Fr(t, r);
2184
2184
  break;
2185
2185
  case "delete-entity":
2186
- qt(t, r);
2186
+ Kt(t, r);
2187
2187
  break;
2188
2188
  case "add-attr":
2189
- As(t, r);
2189
+ Es(t, r);
2190
2190
  break;
2191
2191
  case "delete-attr":
2192
- js(t, r);
2192
+ As(t, r);
2193
2193
  break;
2194
2194
  case "update-attr":
2195
- ks(t, r);
2195
+ js(t, r);
2196
2196
  break;
2197
2197
  case "restore-attr":
2198
2198
  break;
@@ -2247,13 +2247,13 @@ function tt(t, e, n) {
2247
2247
  }
2248
2248
  return i;
2249
2249
  }
2250
- function Ps(t, e, n) {
2250
+ function Cs(t, e, n) {
2251
2251
  let r = "";
2252
2252
  return t !== void 0 && (r += "e"), e !== void 0 && (r += "a"), n !== void 0 && (r += "v"), r;
2253
2253
  }
2254
- function Is(t, [e, n, r]) {
2254
+ function Ps(t, [e, n, r]) {
2255
2255
  var i, s;
2256
- switch (Ps(e, n, r)) {
2256
+ switch (Cs(e, n, r)) {
2257
2257
  case "e": {
2258
2258
  const u = t.eav.get(e);
2259
2259
  return G(u, 2);
@@ -2299,11 +2299,8 @@ function Is(t, [e, n, r]) {
2299
2299
  return G(t.eav, 3);
2300
2300
  }
2301
2301
  }
2302
- const kt = {};
2303
- function Ms(t, e, n) {
2302
+ function Is(t, e, n) {
2304
2303
  var r;
2305
- if (kt[n])
2306
- return kt[n];
2307
2304
  const i = {};
2308
2305
  if (!e)
2309
2306
  return i;
@@ -2312,25 +2309,25 @@ function Ms(t, e, n) {
2312
2309
  for (const d of a)
2313
2310
  i[s] = d[2];
2314
2311
  }
2315
- return kt[n] = i, i;
2312
+ return i;
2316
2313
  }
2317
2314
  function fe(t, e, n) {
2318
2315
  var r;
2319
2316
  return (r = t.attrIndexes.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
2320
2317
  }
2321
- function Wr(t, e, n) {
2318
+ function Vr(t, e, n) {
2322
2319
  var r;
2323
2320
  return (r = t.attrIndexes.revIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
2324
2321
  }
2325
- function Rs(t, e) {
2322
+ function Ms(t, e) {
2326
2323
  return t.attrIndexes.blobAttrs.get(e);
2327
2324
  }
2328
- function Br(t, e) {
2325
+ function Wr(t, e) {
2329
2326
  var n;
2330
2327
  const r = t.attrIndexes.primaryKeys.get(e);
2331
2328
  return r || ((n = t.attrIndexes.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
2332
2329
  }
2333
- function $s(t, e) {
2330
+ function Rs(t, e) {
2334
2331
  const n = Be(t, e);
2335
2332
  if (!n)
2336
2333
  return;
@@ -2338,7 +2335,7 @@ function $s(t, e) {
2338
2335
  if (ke(t.attrs, i))
2339
2336
  return Ce(t.eav, [r, i]);
2340
2337
  }
2341
- function xs(t, e) {
2338
+ function $s(t, e) {
2342
2339
  const n = e.filter(([r, i, s, o, u]) => {
2343
2340
  if (r !== "add-triple" && r !== "deep-merge-triple")
2344
2341
  return !0;
@@ -2348,8 +2345,8 @@ function xs(t, e) {
2348
2345
  let d = !1;
2349
2346
  const c = ke(t.attrs, s);
2350
2347
  if (c) {
2351
- const f = Br(t, c["forward-identity"][1]);
2352
- d = !!$s(t, [
2348
+ const f = Wr(t, c["forward-identity"][1]);
2349
+ d = !!Rs(t, [
2353
2350
  i,
2354
2351
  f == null ? void 0 : f.id,
2355
2352
  i
@@ -2359,32 +2356,32 @@ function xs(t, e) {
2359
2356
  });
2360
2357
  return ft(t, (r) => {
2361
2358
  n.forEach((i) => {
2362
- Cs(r, i);
2359
+ ks(r, i);
2363
2360
  });
2364
2361
  });
2365
2362
  }
2366
- function Ds(t) {
2363
+ function xs(t) {
2367
2364
  return typeof t == "string" && t.startsWith("?");
2368
2365
  }
2369
- function Us(t, e, n) {
2366
+ function Ds(t, e, n) {
2370
2367
  if (n.hasOwnProperty(t)) {
2371
2368
  const r = n[t];
2372
- return Gr(r, e, n);
2369
+ return Br(r, e, n);
2373
2370
  }
2374
2371
  return Object.assign(Object.assign({}, n), { [t]: e });
2375
2372
  }
2376
- function Gn(t, e, n) {
2373
+ function Bn(t, e, n) {
2377
2374
  return t === e ? n : null;
2378
2375
  }
2379
- function Ls(t) {
2376
+ function Us(t) {
2380
2377
  switch (typeof t) {
2381
2378
  case "string":
2382
- return t.startsWith("?") ? Us : Gn;
2379
+ return t.startsWith("?") ? Ds : Bn;
2383
2380
  default:
2384
- return Gn;
2381
+ return Bn;
2385
2382
  }
2386
2383
  }
2387
- const Fs = [
2384
+ const Ls = [
2388
2385
  "in",
2389
2386
  "$in",
2390
2387
  "$not",
@@ -2392,77 +2389,77 @@ const Fs = [
2392
2389
  "$comparator"
2393
2390
  // covers all of $gt, $lt, etc.
2394
2391
  ];
2395
- function Ns(t) {
2396
- for (const e of Fs)
2392
+ function Fs(t) {
2393
+ for (const e of Ls)
2397
2394
  if (t.hasOwnProperty(e))
2398
2395
  return !0;
2399
2396
  return !1;
2400
2397
  }
2401
- function Gr(t, e, n) {
2402
- return n ? typeof t == "object" ? Ns(t) ? n : null : Ls(t)(t, e, n) : null;
2398
+ function Br(t, e, n) {
2399
+ return n ? typeof t == "object" ? Fs(t) ? n : null : Us(t)(t, e, n) : null;
2403
2400
  }
2404
- function Ks(t, e, n) {
2401
+ function Ns(t, e, n) {
2405
2402
  return t.reduce((r, i, s) => {
2406
2403
  const o = e[s];
2407
- return Gr(i, o, r);
2404
+ return Br(i, o, r);
2408
2405
  }, n);
2409
2406
  }
2410
- function qs(t, e, n) {
2411
- return Ws(t, e, n).map((r) => Ks(e, r, n)).filter((r) => r);
2407
+ function Ks(t, e, n) {
2408
+ return Vs(t, e, n).map((r) => Ns(e, r, n)).filter((r) => r);
2412
2409
  }
2413
- function zs(t, e, n) {
2414
- return e.or ? e.or.patterns.flatMap((r) => zt(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => zt(t, i, r), n) : n.flatMap((r) => qs(t, e, r));
2410
+ function qs(t, e, n) {
2411
+ return e.or ? e.or.patterns.flatMap((r) => qt(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => qt(t, i, r), n) : n.flatMap((r) => Ks(t, e, r));
2415
2412
  }
2416
- function zt(t, e, n = [{}]) {
2417
- return e.reduce((r, i) => zs(t, i, r), n);
2413
+ function qt(t, e, n = [{}]) {
2414
+ return e.reduce((r, i) => qs(t, i, r), n);
2418
2415
  }
2419
- function ln(t, e) {
2420
- return Array.isArray(e) ? e.map((n) => ln(t, n)) : Ds(e) ? t[e] : e;
2416
+ function fn(t, e) {
2417
+ return Array.isArray(e) ? e.map((n) => fn(t, n)) : xs(e) ? t[e] : e;
2421
2418
  }
2422
- function Vs(t, { find: e, where: n }) {
2423
- return zt(t, n).map((i) => ln(i, e));
2419
+ function zs(t, { find: e, where: n }) {
2420
+ return qt(t, n).map((i) => fn(i, e));
2424
2421
  }
2425
- function Ws(t, e, n) {
2426
- return Is(t, ln(n, e));
2422
+ function Vs(t, e, n) {
2423
+ return Ps(t, fn(n, e));
2427
2424
  }
2428
- const Bs = /^(?:[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;
2425
+ const Ws = /^(?:[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;
2429
2426
  function Ee(t) {
2430
- return typeof t == "string" && Bs.test(t);
2427
+ return typeof t == "string" && Ws.test(t);
2431
2428
  }
2432
2429
  const F = [];
2433
2430
  for (let t = 0; t < 256; ++t)
2434
2431
  F.push((t + 256).toString(16).slice(1));
2435
- function Gs(t, e = 0) {
2432
+ function Bs(t, e = 0) {
2436
2433
  return (F[t[e + 0]] + F[t[e + 1]] + F[t[e + 2]] + F[t[e + 3]] + "-" + F[t[e + 4]] + F[t[e + 5]] + "-" + F[t[e + 6]] + F[t[e + 7]] + "-" + F[t[e + 8]] + F[t[e + 9]] + "-" + F[t[e + 10]] + F[t[e + 11]] + F[t[e + 12]] + F[t[e + 13]] + F[t[e + 14]] + F[t[e + 15]]).toLowerCase();
2437
2434
  }
2438
- let Ct;
2439
- const Qs = new Uint8Array(16);
2440
- function Hs() {
2441
- if (!Ct) {
2435
+ let kt;
2436
+ const Gs = new Uint8Array(16);
2437
+ function Qs() {
2438
+ if (!kt) {
2442
2439
  if (typeof crypto > "u" || !crypto.getRandomValues)
2443
2440
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
2444
- Ct = crypto.getRandomValues.bind(crypto);
2441
+ kt = crypto.getRandomValues.bind(crypto);
2445
2442
  }
2446
- return Ct(Qs);
2443
+ return kt(Gs);
2447
2444
  }
2448
- const Ys = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Qn = { randomUUID: Ys };
2449
- function Js(t, e, n) {
2445
+ const Hs = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Gn = { randomUUID: Hs };
2446
+ function Ys(t, e, n) {
2450
2447
  var i;
2451
- if (Qn.randomUUID && !t)
2452
- return Qn.randomUUID();
2448
+ if (Gn.randomUUID && !t)
2449
+ return Gn.randomUUID();
2453
2450
  t = t || {};
2454
- const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? Hs();
2451
+ const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? Qs();
2455
2452
  if (r.length < 16)
2456
2453
  throw new Error("Random bytes length must be >= 16");
2457
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Gs(r);
2454
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Bs(r);
2458
2455
  }
2459
- function Hn(t) {
2456
+ function Qn(t) {
2460
2457
  const e = t.replace(/-/g, ""), n = [];
2461
2458
  for (let r = 0; r < e.length; r += 2)
2462
2459
  n.push(parseInt(e.substring(r, r + 2), 16));
2463
2460
  return n;
2464
2461
  }
2465
- function Zs(t, e) {
2462
+ function Js(t, e) {
2466
2463
  for (let n = 0; n < t.length; n++) {
2467
2464
  if (t[n] < e[n])
2468
2465
  return -1;
@@ -2471,17 +2468,17 @@ function Zs(t, e) {
2471
2468
  }
2472
2469
  return 0;
2473
2470
  }
2474
- function Xs(t, e) {
2475
- return Zs(Hn(t), Hn(e));
2471
+ function Zs(t, e) {
2472
+ return Js(Qn(t), Qn(e));
2476
2473
  }
2477
2474
  function L() {
2478
- return Js();
2475
+ return Ys();
2479
2476
  }
2480
- function eo(t, e) {
2477
+ function Xs(t, e) {
2481
2478
  return t.localeCompare(e);
2482
2479
  }
2483
- function to() {
2484
- let t = eo;
2480
+ function eo() {
2481
+ let t = Xs;
2485
2482
  if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
2486
2483
  try {
2487
2484
  t = Intl.Collator("en-US").compare;
@@ -2489,10 +2486,10 @@ function to() {
2489
2486
  }
2490
2487
  return t;
2491
2488
  }
2492
- const no = to();
2493
- let ro = 0;
2489
+ const to = eo();
2490
+ let no = 0;
2494
2491
  function Ke(t) {
2495
- return yt(`_${t}`, ro++);
2492
+ return yt(`_${t}`, no++);
2496
2493
  }
2497
2494
  function yt(t, e) {
2498
2495
  return `?${t}-${e}`;
@@ -2502,28 +2499,28 @@ class Ae extends Error {
2502
2499
  super(e), this.name = "AttrNotFoundError";
2503
2500
  }
2504
2501
  }
2505
- function io(t, e) {
2506
- const n = Br(t, e);
2502
+ function ro(t, e) {
2503
+ const n = Wr(t, e);
2507
2504
  if (!n)
2508
2505
  throw new Ae(`Could not find id attr for ${e}`);
2509
2506
  return n;
2510
2507
  }
2511
- function Yn(t, e, n, r) {
2512
- return [so(t, e, n, r)];
2508
+ function Hn(t, e, n, r) {
2509
+ return [io(t, e, n, r)];
2513
2510
  }
2514
- function so(t, e, n, r) {
2511
+ function io(t, e, n, r) {
2515
2512
  return [
2516
2513
  t(n, r),
2517
- io(e, n).id,
2514
+ ro(e, n).id,
2518
2515
  t(n, r),
2519
2516
  t("time", r)
2520
2517
  ];
2521
2518
  }
2522
- function oo(t, e, n) {
2519
+ function so(t, e, n) {
2523
2520
  return t.map((r) => r === e ? n : r);
2524
2521
  }
2525
- function Qr(t, e, n, r, i) {
2526
- const s = fe(e, n, i), o = Wr(e, n, i), u = s || o;
2522
+ function Gr(t, e, n, r, i) {
2523
+ const s = fe(e, n, i), o = Vr(e, n, i), u = s || o;
2527
2524
  if (!u)
2528
2525
  throw new Ae(`Could not find attr for ${[n, i]}`);
2529
2526
  if (u["value-type"] !== "ref")
@@ -2541,7 +2538,7 @@ function Qr(t, e, n, r, i) {
2541
2538
  ];
2542
2539
  return [s ? f : d, l, p, u, !!s];
2543
2540
  }
2544
- function Jn(t, e) {
2541
+ function Yn(t, e) {
2545
2542
  if (typeof e != "string")
2546
2543
  return function(o) {
2547
2544
  return !1;
@@ -2551,7 +2548,7 @@ function Jn(t, e) {
2551
2548
  return typeof o != "string" ? !1 : i.test(o);
2552
2549
  };
2553
2550
  }
2554
- function uo(t, e) {
2551
+ function oo(t, e) {
2555
2552
  if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
2556
2553
  return e;
2557
2554
  const n = t["checked-data-type"] === "date";
@@ -2592,7 +2589,7 @@ function uo(t, e) {
2592
2589
  }
2593
2590
  };
2594
2591
  if (e.hasOwnProperty("$like")) {
2595
- const r = Jn(!0, e.$like);
2592
+ const r = Yn(!0, e.$like);
2596
2593
  return {
2597
2594
  $comparator: !0,
2598
2595
  $op: function(s) {
@@ -2601,7 +2598,7 @@ function uo(t, e) {
2601
2598
  };
2602
2599
  }
2603
2600
  if (e.hasOwnProperty("$ilike")) {
2604
- const r = Jn(!1, e.$ilike);
2601
+ const r = Yn(!1, e.$ilike);
2605
2602
  return {
2606
2603
  $comparator: !0,
2607
2604
  $op: function(s) {
@@ -2611,8 +2608,8 @@ function uo(t, e) {
2611
2608
  }
2612
2609
  return e;
2613
2610
  }
2614
- function ao(t, e, n, r, i, s) {
2615
- const o = fe(e, n, i), u = Wr(e, n, i), a = o || u;
2611
+ function uo(t, e, n, r, i, s) {
2612
+ const o = fe(e, n, i), u = Vr(e, n, i), a = o || u;
2616
2613
  if (!a)
2617
2614
  throw new Ae(`No attr for etype = ${n} label = ${i}`);
2618
2615
  if (s != null && s.hasOwnProperty("$isNull")) {
@@ -2629,63 +2626,63 @@ function ao(t, e, n, r, i, s) {
2629
2626
  return o ? [
2630
2627
  t(n, r),
2631
2628
  a.id,
2632
- uo(a, s),
2629
+ oo(a, s),
2633
2630
  Ke("time")
2634
2631
  ] : [s, a.id, t(n, r), Ke("time")];
2635
2632
  }
2636
- function co(t, e, n, r, i) {
2633
+ function ao(t, e, n, r, i) {
2637
2634
  const [s, o, u] = i.reduce((a, d) => {
2638
- const [c, f, l] = a, [p, y, b] = Qr(t, e, c, f, d);
2635
+ const [c, f, l] = a, [p, y, b] = Gr(t, e, c, f, d);
2639
2636
  return [p, y, [...l, b]];
2640
2637
  }, [n, r, []]);
2641
2638
  return [s, o, u];
2642
2639
  }
2643
- function Vt(t, e, n, r, i, s) {
2644
- const o = i.slice(0, i.length - 1), u = i[i.length - 1], [a, d, c] = co(t, e, n, r, o), f = ao(t, e, a, d, u, s);
2640
+ function zt(t, e, n, r, i, s) {
2641
+ const o = i.slice(0, i.length - 1), u = i[i.length - 1], [a, d, c] = ao(t, e, n, r, o), f = uo(t, e, a, d, u, s);
2645
2642
  return c.concat([f]);
2646
2643
  }
2647
- function fo(t, e) {
2644
+ function co(t, e) {
2648
2645
  return e ? [e].concat(t) : t;
2649
2646
  }
2650
- function lo([t, e]) {
2647
+ function fo([t, e]) {
2651
2648
  return t === "or" && Array.isArray(e);
2652
2649
  }
2653
- function ho([t, e]) {
2650
+ function lo([t, e]) {
2654
2651
  return t === "and" && Array.isArray(e);
2655
2652
  }
2656
- function po(t, e, n) {
2653
+ function ho(t, e, n) {
2657
2654
  return (r, i) => {
2658
2655
  const s = t(r, i);
2659
2656
  return e == s ? s : `${s}-${n}`;
2660
2657
  };
2661
2658
  }
2662
- function Zn(t, e, n, r, i, s) {
2659
+ function Jn(t, e, n, r, i, s) {
2663
2660
  const o = t(r, i), u = s.map((a, d) => {
2664
- const c = po(t, o, d);
2665
- return Hr(c, n, r, i, a);
2661
+ const c = ho(t, o, d);
2662
+ return Qr(c, n, r, i, a);
2666
2663
  });
2667
2664
  return { [e]: { patterns: u, joinSym: o } };
2668
2665
  }
2669
- function yo(t) {
2666
+ function po(t) {
2670
2667
  const e = [];
2671
2668
  for (let n = 1; n <= t.length; n++)
2672
2669
  e.push(t.slice(0, n));
2673
2670
  return e;
2674
2671
  }
2675
- function Xn(t, e, n, r, i) {
2676
- return yo(i).map((s) => Vt(t, e, n, r, s, { $isNull: !0 }));
2672
+ function Zn(t, e, n, r, i) {
2673
+ return po(i).map((s) => zt(t, e, n, r, s, { $isNull: !0 }));
2677
2674
  }
2678
- function Hr(t, e, n, r, i) {
2675
+ function Qr(t, e, n, r, i) {
2679
2676
  return Object.entries(i).flatMap(([s, o]) => {
2677
+ if (fo([s, o]))
2678
+ return Jn(t, "or", e, n, r, o);
2680
2679
  if (lo([s, o]))
2681
- return Zn(t, "or", e, n, r, o);
2682
- if (ho([s, o]))
2683
- return Zn(t, "and", e, n, r, o);
2680
+ return Jn(t, "and", e, n, r, o);
2684
2681
  if (s === "$entityIdStartsWith")
2685
2682
  return [];
2686
2683
  const u = s.split(".");
2687
2684
  if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
2688
- const a = Vt(t, e, n, r, u, o), d = Xn(t, e, n, r, u);
2685
+ const a = zt(t, e, n, r, u, o), d = Zn(t, e, n, r, u);
2689
2686
  return [
2690
2687
  {
2691
2688
  or: {
@@ -2698,32 +2695,32 @@ function Hr(t, e, n, r, i) {
2698
2695
  return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && u.length > 1 ? [
2699
2696
  {
2700
2697
  or: {
2701
- patterns: Xn(t, e, n, r, u),
2698
+ patterns: Zn(t, e, n, r, u),
2702
2699
  joinSym: t(n, r)
2703
2700
  }
2704
2701
  }
2705
- ] : Vt(t, e, n, r, u, o);
2702
+ ] : zt(t, e, n, r, u, o);
2706
2703
  });
2707
2704
  }
2708
- function bo(t, e, n, r) {
2705
+ function yo(t, e, n, r) {
2709
2706
  const i = yt;
2710
- return r ? Hr(i, t, e, n, r).concat(Yn(i, t, e, n)) : Yn(i, t, e, n);
2707
+ return r ? Qr(i, t, e, n, r).concat(Hn(i, t, e, n)) : Hn(i, t, e, n);
2711
2708
  }
2712
- function _o(t, e, n) {
2709
+ function bo(t, e, n) {
2713
2710
  return [t(e, n), t("time", n)];
2714
2711
  }
2715
- function go(t, e, n, r, i, s) {
2716
- const [o, u, a, d, c] = Qr(t, e, n, r, i), f = oo(a, t(n, r), s);
2712
+ function _o(t, e, n, r, i, s) {
2713
+ const [o, u, a, d, c] = Gr(t, e, n, r, i), f = so(a, t(n, r), s);
2717
2714
  return [o, u, f, d, c];
2718
2715
  }
2719
- function To(t, e, { etype: n, level: r, form: i }, s) {
2716
+ function go(t, e, { etype: n, level: r, form: i }, s) {
2720
2717
  const o = Object.keys(i).filter((u) => u !== "$");
2721
2718
  return o.length ? Object.entries(s).map(function([a, d]) {
2722
2719
  return o.map(function(l) {
2723
2720
  var p, y, b;
2724
2721
  const g = !!(e.cardinalityInference && (!((b = (y = (p = e.linkIndex) === null || p === void 0 ? void 0 : p[n]) === null || y === void 0 ? void 0 : y[l]) === null || b === void 0) && b.isSingular));
2725
2722
  try {
2726
- const [m, T, v] = go(t, e, n, r, l, a), k = Jr(e, {
2723
+ const [m, T, v] = _o(t, e, n, r, l, a), k = Yr(e, {
2727
2724
  etype: m,
2728
2725
  level: T,
2729
2726
  form: i[l],
@@ -2740,48 +2737,48 @@ function To(t, e, { etype: n, level: r, form: i }, s) {
2740
2737
  }, d);
2741
2738
  }) : Object.values(s);
2742
2739
  }
2743
- function mo(t, e, n) {
2744
- return n === "string" ? no(t, e) : t > e ? 1 : -1;
2740
+ function To(t, e, n) {
2741
+ return n === "string" ? to(t, e) : t > e ? 1 : -1;
2745
2742
  }
2746
2743
  function Fe(t, e, n, r, i) {
2747
- return e === r || e == null && r == null ? Xs(t, n) : r == null ? 1 : e == null ? -1 : mo(e, r, i);
2744
+ return e === r || e == null && r == null ? Zs(t, n) : r == null ? 1 : e == null ? -1 : To(e, r, i);
2748
2745
  }
2749
2746
  function lt([t, e], [n, r], i) {
2750
2747
  return Fe(t, e, n, r, i);
2751
2748
  }
2752
- function Wt(t) {
2749
+ function Vt(t) {
2753
2750
  return t == null ? t : new Date(t).getTime();
2754
2751
  }
2755
- function wo(t, e, n, r) {
2752
+ function mo(t, e, n, r) {
2756
2753
  var i;
2757
2754
  const [s, o, u, a] = t, d = n === "desc" ? 1 : -1;
2758
2755
  if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
2759
2756
  return lt(r, [s, a], null) === d;
2760
- const [c, f] = r, l = e["checked-data-type"], p = l === "date" ? Wt(f) : f, y = l === "date" ? Wt(u) : u;
2757
+ const [c, f] = r, l = e["checked-data-type"], p = l === "date" ? Vt(f) : f, y = l === "date" ? Vt(u) : u;
2761
2758
  return lt([c, p], [s, y], l) === d;
2762
2759
  }
2763
- function vo(t, e) {
2760
+ function wo(t, e) {
2764
2761
  const n = e[1];
2765
2762
  return t.attrs[n];
2766
2763
  }
2767
- function So(t, e, n) {
2764
+ function vo(t, e, n) {
2768
2765
  const r = Object.keys(n)[0];
2769
2766
  return fe(t, e, r);
2770
2767
  }
2771
- function Oo(t, e, n, r) {
2768
+ function So(t, e, n, r) {
2772
2769
  if (n)
2773
- return vo(t, n);
2770
+ return wo(t, n);
2774
2771
  if (r)
2775
- return So(t, e, r);
2772
+ return vo(t, e, r);
2776
2773
  }
2777
- function Eo(t, e, n) {
2774
+ function Oo(t, e, n) {
2778
2775
  var r, i;
2779
2776
  if (!Array.isArray(n.fields))
2780
- return Rs(t, e);
2777
+ return Ms(t, e);
2781
2778
  const s = /* @__PURE__ */ new Map();
2782
2779
  for (const o of n.fields) {
2783
2780
  const u = fe(t, e, o), a = (r = u == null ? void 0 : u["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
2784
- a && dn(u) && s.set(a, u);
2781
+ a && cn(u) && s.set(a, u);
2785
2782
  }
2786
2783
  if (!s.has("id")) {
2787
2784
  const o = fe(t, e, "id"), u = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
@@ -2789,17 +2786,17 @@ function Eo(t, e, n) {
2789
2786
  }
2790
2787
  return s;
2791
2788
  }
2792
- function Ao(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2789
+ function Eo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2793
2790
  var s, o;
2794
- const u = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, a = Yr(i), d = jo(i);
2795
- let c = Vs(t, r);
2796
- const f = n == null ? void 0 : n["start-cursor"], l = Oo(t, e, f, u);
2791
+ const u = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, a = Hr(i), d = Ao(i);
2792
+ let c = zs(t, r);
2793
+ const f = n == null ? void 0 : n["start-cursor"], l = So(t, e, f, u);
2797
2794
  if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
2798
2795
  const b = l["checked-data-type"] === "date", g = l.id;
2799
2796
  c = c.map(([m]) => {
2800
2797
  var T, v, k, S, I;
2801
2798
  let R = (I = (S = (k = (v = (T = t.eav.get(m)) === null || T === void 0 ? void 0 : T.get(g)) === null || v === void 0 ? void 0 : v.values()) === null || k === void 0 ? void 0 : k.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
2802
- return b && (R = Wt(R)), [m, R];
2799
+ return b && (R = Vt(R)), [m, R];
2803
2800
  });
2804
2801
  }
2805
2802
  c.sort(d === "asc" ? function(g, m) {
@@ -2808,31 +2805,31 @@ function Ao(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2808
2805
  return lt(m, g, l == null ? void 0 : l["checked-data-type"]);
2809
2806
  });
2810
2807
  let p = {};
2811
- const y = Eo(t, e, r);
2808
+ const y = Oo(t, e, r);
2812
2809
  for (const b of c) {
2813
2810
  const [g] = b;
2814
- if (p[g] || !a && f && l && wo(f, l, d, b))
2811
+ if (p[g] || !a && f && l && mo(f, l, d, b))
2815
2812
  continue;
2816
- const m = Ms(t, y, g);
2813
+ const m = Is(t, y, g);
2817
2814
  m && (p[g] = m);
2818
2815
  }
2819
2816
  return p;
2820
2817
  }
2821
- function jo(t) {
2818
+ function Ao(t) {
2822
2819
  var e;
2823
2820
  const n = (e = t.$) === null || e === void 0 ? void 0 : e.order;
2824
2821
  return n && n[Object.keys(n)[0]] || "asc";
2825
2822
  }
2826
- function Yr(t) {
2823
+ function Hr(t) {
2827
2824
  var e, n, r;
2828
2825
  const i = (e = t.$) === null || e === void 0 ? void 0 : e.offset, s = (n = t.$) === null || n === void 0 ? void 0 : n.before, o = (r = t.$) === null || r === void 0 ? void 0 : r.after;
2829
2826
  return !i && !s && !o;
2830
2827
  }
2831
- function ko(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
2828
+ function jo(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
2832
2829
  var o, u, a, d, c;
2833
- if (!Yr(r) && (!s || !s["start-cursor"]))
2830
+ if (!Hr(r) && (!s || !s["start-cursor"]))
2834
2831
  return [];
2835
- const f = fo(bo(t, e, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), l = _o(yt, e, n), p = (u = r.$) === null || u === void 0 ? void 0 : u.fields, y = Ao(t, {
2832
+ const f = co(yo(t, e, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), l = bo(yt, e, n), p = (u = r.$) === null || u === void 0 ? void 0 : u.fields, y = Eo(t, {
2836
2833
  etype: e,
2837
2834
  pageInfo: s,
2838
2835
  form: r,
@@ -2845,20 +2842,20 @@ function ko(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
2845
2842
  }
2846
2843
  return y;
2847
2844
  }
2848
- function Co(t, e) {
2845
+ function ko(t, e) {
2849
2846
  try {
2850
- return ko(t, e);
2847
+ return jo(t, e);
2851
2848
  } catch (n) {
2852
2849
  if (n instanceof Ae)
2853
2850
  return {};
2854
2851
  throw n;
2855
2852
  }
2856
2853
  }
2857
- function Jr(t, e) {
2858
- const n = Co(t, e);
2859
- return To(yt, t, e, n);
2854
+ function Yr(t, e) {
2855
+ const n = ko(t, e);
2856
+ return go(yt, t, e, n);
2860
2857
  }
2861
- function Po(t) {
2858
+ function Co(t) {
2862
2859
  const e = {};
2863
2860
  for (const [n, r] of Object.entries(t))
2864
2861
  e[n] = {
@@ -2869,18 +2866,18 @@ function Po(t) {
2869
2866
  };
2870
2867
  return e;
2871
2868
  }
2872
- function Zr({ store: t, pageInfo: e, aggregate: n }, r) {
2869
+ function Jr({ store: t, pageInfo: e, aggregate: n }, r) {
2873
2870
  const s = { data: Object.keys(r).reduce(function(u, a) {
2874
- return n != null && n[a] || a === "$$ruleParams" || (u[a] = Jr(t, {
2871
+ return n != null && n[a] || a === "$$ruleParams" || (u[a] = Yr(t, {
2875
2872
  etype: a,
2876
2873
  form: r[a],
2877
2874
  level: 0,
2878
2875
  pageInfo: e == null ? void 0 : e[a]
2879
2876
  })), u;
2880
2877
  }, {}) };
2881
- return e && (s.pageInfo = Po(e)), n && (s.aggregate = n), s;
2878
+ return e && (s.pageInfo = Co(e)), n && (s.aggregate = n), s;
2882
2879
  }
2883
- function Io() {
2880
+ function Po() {
2884
2881
  const e = {
2885
2882
  __etype: 1,
2886
2883
  __ops: 1,
@@ -2894,8 +2891,8 @@ function Io() {
2894
2891
  };
2895
2892
  return new Set(Object.keys(e));
2896
2893
  }
2897
- const Mo = Io();
2898
- function Bt(t, e, n) {
2894
+ const Io = Po();
2895
+ function Wt(t, e, n) {
2899
2896
  const r = {
2900
2897
  __etype: t,
2901
2898
  __ops: n
@@ -2906,8 +2903,8 @@ function Bt(t, e, n) {
2906
2903
  return n;
2907
2904
  if (s === "__etype")
2908
2905
  return t;
2909
- if (Mo.has(s))
2910
- return (o, u) => Bt(t, e, [
2906
+ if (Io.has(s))
2907
+ return (o, u) => Wt(t, e, [
2911
2908
  ...n,
2912
2909
  u ? [s, t, e, o, u] : [s, t, e, o]
2913
2910
  ]);
@@ -2917,11 +2914,11 @@ function Bt(t, e, n) {
2917
2914
  function ht(t) {
2918
2915
  return t.startsWith("lookup__");
2919
2916
  }
2920
- function Xr(t) {
2917
+ function Zr(t) {
2921
2918
  const [e, n, ...r] = t.split("__");
2922
2919
  return [n, JSON.parse(r.join("__"))];
2923
2920
  }
2924
- function Ro(t) {
2921
+ function Mo(t) {
2925
2922
  return new Proxy({
2926
2923
  __etype: t
2927
2924
  }, {
@@ -2929,22 +2926,22 @@ function Ro(t) {
2929
2926
  if (n === "__etype")
2930
2927
  return t;
2931
2928
  const r = n;
2932
- return ht(r) ? Bt(t, Xr(r), []) : Bt(t, r, []);
2929
+ return ht(r) ? Wt(t, Zr(r), []) : Wt(t, r, []);
2933
2930
  }
2934
2931
  });
2935
2932
  }
2936
- function hn() {
2933
+ function ln() {
2937
2934
  return new Proxy({}, {
2938
2935
  get(t, e) {
2939
- return Ro(e);
2936
+ return Mo(e);
2940
2937
  }
2941
2938
  });
2942
2939
  }
2943
- hn();
2944
- function $o(t) {
2940
+ ln();
2941
+ function Ro(t) {
2945
2942
  return t.__ops;
2946
2943
  }
2947
- function xo(t, e) {
2944
+ function $o(t, e) {
2948
2945
  const { attrIdMap: n, refSwapAttrIds: r } = t, i = [];
2949
2946
  for (const o of e) {
2950
2947
  const u = n[o];
@@ -2978,7 +2975,7 @@ function _e(t, e, n) {
2978
2975
  return o === e && u === n;
2979
2976
  });
2980
2977
  }
2981
- function Do(t) {
2978
+ function xo(t) {
2982
2979
  if (Array.isArray(t))
2983
2980
  return t;
2984
2981
  const e = Object.entries(t);
@@ -2986,38 +2983,38 @@ function Do(t) {
2986
2983
  throw new Error("lookup must be an object with a single unique attr and value.");
2987
2984
  return e[0];
2988
2985
  }
2989
- function Gt(t, e, n) {
2986
+ function Bt(t, e, n) {
2990
2987
  return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
2991
2988
  // before assuming it's a ref lookup.
2992
2989
  !K(t, e, n);
2993
2990
  }
2994
- function Qt(t) {
2991
+ function Gt(t) {
2995
2992
  const [e, n, ...r] = t.split(".");
2996
2993
  if (r.length > 0 || n !== "id")
2997
2994
  throw new Error(`${t} is not a valid lookup attribute.`);
2998
2995
  return e;
2999
2996
  }
3000
- function Uo(t, e, n) {
3001
- if (!Gt(t, e, n))
2997
+ function Do(t, e, n) {
2998
+ if (!Bt(t, e, n))
3002
2999
  return K(t, e, n);
3003
- const r = Qt(n), i = K(t, e, r) || _e(t, e, r);
3000
+ const r = Gt(n), i = K(t, e, r) || _e(t, e, r);
3004
3001
  if (i && i["value-type"] !== "ref")
3005
3002
  throw new Error(`${n} does not reference a valid link attribute.`);
3006
3003
  return i;
3007
3004
  }
3008
- function Ht(t) {
3009
- return typeof t == "string" && !ht(t) ? null : typeof t == "string" && ht(t) ? Xr(t) : Do(t);
3005
+ function Qt(t) {
3006
+ return typeof t == "string" && !ht(t) ? null : typeof t == "string" && ht(t) ? Zr(t) : xo(t);
3010
3007
  }
3011
3008
  function Q(t, e, n) {
3012
- const r = Ht(n);
3009
+ const r = Qt(n);
3013
3010
  if (r === null)
3014
3011
  return n;
3015
- const [i, s] = r, o = Uo(t, e, i);
3012
+ const [i, s] = r, o = Do(t, e, i);
3016
3013
  if (!o || !o["unique?"])
3017
3014
  throw new Error(`${i} is not a unique attribute.`);
3018
3015
  return [o.id, s];
3019
3016
  }
3020
- function ei(t, e, n, r) {
3017
+ function Xr(t, e, n, r) {
3021
3018
  const i = Q(t, e, n);
3022
3019
  return Array.isArray(i) ? [[
3023
3020
  "add-triple",
@@ -3026,7 +3023,7 @@ function ei(t, e, n, r) {
3026
3023
  i
3027
3024
  ]].concat(r) : r;
3028
3025
  }
3029
- function Lo({ attrs: t }, [e, n, r]) {
3026
+ function Uo({ attrs: t }, [e, n, r]) {
3030
3027
  const i = Object.entries(r).flatMap(([s, o]) => {
3031
3028
  const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = _e(t, e, s);
3032
3029
  return u.map((c) => a ? [
@@ -3041,9 +3038,9 @@ function Lo({ attrs: t }, [e, n, r]) {
3041
3038
  Q(t, e, n)
3042
3039
  ]);
3043
3040
  });
3044
- return ei(t, e, n, i);
3041
+ return Xr(t, e, n, i);
3045
3042
  }
3046
- function Fo({ attrs: t }, [e, n, r]) {
3043
+ function Lo({ attrs: t }, [e, n, r]) {
3047
3044
  const i = Object.entries(r).flatMap(([s, o]) => {
3048
3045
  const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = _e(t, e, s);
3049
3046
  return u.map((c) => a ? [
@@ -3058,9 +3055,9 @@ function Fo({ attrs: t }, [e, n, r]) {
3058
3055
  Q(t, e, n)
3059
3056
  ]);
3060
3057
  });
3061
- return ei(t, e, n, i);
3058
+ return Xr(t, e, n, i);
3062
3059
  }
3063
- function No(t, e, n) {
3060
+ function Fo(t, e, n) {
3064
3061
  if (Array.isArray(n)) {
3065
3062
  const [r, i] = n;
3066
3063
  for (const s of t || []) {
@@ -3082,18 +3079,18 @@ function No(t, e, n) {
3082
3079
  }
3083
3080
  return !1;
3084
3081
  }
3085
- function ti({ stores: t, attrs: e }, [n, r, i, s]) {
3086
- return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : No(t, n, r) ? { mode: "update" } : null;
3082
+ function ei({ stores: t, attrs: e }, [n, r, i, s]) {
3083
+ return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : Fo(t, n, r) ? { mode: "update" } : null;
3087
3084
  }
3088
- function Ko(t, e) {
3089
- const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = an(o), d = Q(r, i, s);
3085
+ function No(t, e) {
3086
+ const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = un(o), d = Q(r, i, s);
3090
3087
  return [["id", d]].concat(Object.entries(a)).map(([f, l]) => {
3091
3088
  const p = K(r, i, f);
3092
3089
  return p["checked-data-type"] === "date" && t.useDateObjects && (l = pt(l)), ["add-triple", d, p.id, l, { mode: "create" }];
3093
3090
  });
3094
3091
  }
3095
- function qo(t, e) {
3096
- const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = an(o), d = Q(r, i, s), c = ti(t, [i, d, o, u]);
3092
+ function Ko(t, e) {
3093
+ const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = un(o), d = Q(r, i, s), c = ei(t, [i, d, o, u]);
3097
3094
  return [["id", d]].concat(Object.entries(a)).map(([l, p]) => {
3098
3095
  const y = K(r, i, l);
3099
3096
  return y["checked-data-type"] === "date" && t.useDateObjects && (p = pt(p)), [
@@ -3105,11 +3102,11 @@ function qo(t, e) {
3105
3102
  ];
3106
3103
  });
3107
3104
  }
3108
- function zo({ attrs: t }, [e, n]) {
3105
+ function qo({ attrs: t }, [e, n]) {
3109
3106
  return [["delete-entity", Q(t, e, n), e]];
3110
3107
  }
3111
- function Vo(t, e) {
3112
- const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = an(o), d = Q(r, i, s), c = ti(t, [i, d, o, u]), f = Object.entries(a).map(([p, y]) => {
3108
+ function zo(t, e) {
3109
+ const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = un(o), d = Q(r, i, s), c = ei(t, [i, d, o, u]), f = Object.entries(a).map(([p, y]) => {
3113
3110
  const b = K(r, i, p);
3114
3111
  return [
3115
3112
  "deep-merge-triple",
@@ -3127,38 +3124,38 @@ function Vo(t, e) {
3127
3124
  ...c ? [c] : []
3128
3125
  ]].concat(f);
3129
3126
  }
3130
- function Wo({ attrs: t }, [e, n, r]) {
3127
+ function Vo({ attrs: t }, [e, n, r]) {
3131
3128
  return [["rule-params", Q(t, e, n), e, r]];
3132
3129
  }
3133
- function Bo(t) {
3130
+ function Wo(t) {
3134
3131
  const [e, n, r, i, s] = t;
3135
3132
  if (!i)
3136
3133
  return t;
3137
3134
  const o = Object.assign({}, i);
3138
3135
  return delete o.id, [e, n, r, o, ...s ? [s] : []];
3139
3136
  }
3140
- function Go(t, e) {
3141
- const [n, ...r] = Bo(e);
3137
+ function Bo(t, e) {
3138
+ const [n, ...r] = Wo(e);
3142
3139
  switch (n) {
3143
3140
  case "merge":
3144
- return Vo(t, r);
3141
+ return zo(t, r);
3145
3142
  case "create":
3146
- return Ko(t, r);
3143
+ return No(t, r);
3147
3144
  case "update":
3148
- return qo(t, r);
3145
+ return Ko(t, r);
3149
3146
  case "link":
3150
- return Lo(t, r);
3147
+ return Uo(t, r);
3151
3148
  case "unlink":
3152
- return Fo(t, r);
3149
+ return Lo(t, r);
3153
3150
  case "delete":
3154
- return zo(t, r);
3151
+ return qo(t, r);
3155
3152
  case "ruleParams":
3156
- return Wo(t, r);
3153
+ return Vo(t, r);
3157
3154
  default:
3158
3155
  throw new Error(`unsupported action ${n}`);
3159
3156
  }
3160
3157
  }
3161
- function Qo(t) {
3158
+ function Go(t) {
3162
3159
  switch (t) {
3163
3160
  case "string":
3164
3161
  case "date":
@@ -3169,14 +3166,14 @@ function Qo(t) {
3169
3166
  return;
3170
3167
  }
3171
3168
  }
3172
- function Ho(t, e, n) {
3169
+ function Qo(t, e, n) {
3173
3170
  var r, i;
3174
3171
  const s = (i = (r = t.entities[e]) === null || r === void 0 ? void 0 : r.attrs) === null || i === void 0 ? void 0 : i[n];
3175
3172
  if (n === "id")
3176
3173
  return null;
3177
3174
  if (!s)
3178
3175
  throw new Error(`${e}.${n} does not exist in your schema`);
3179
- const { unique: o, indexed: u } = s == null ? void 0 : s.config, a = Qo(s == null ? void 0 : s.valueType);
3176
+ const { unique: o, indexed: u } = s == null ? void 0 : s.config, a = Go(s == null ? void 0 : s.valueType);
3180
3177
  return {
3181
3178
  "index?": u,
3182
3179
  "unique?": o,
@@ -3184,14 +3181,14 @@ function Ho(t, e, n) {
3184
3181
  };
3185
3182
  }
3186
3183
  function nt(t, e, n, r) {
3187
- const i = t ? Ho(t, e, n) : null, s = L(), u = [L(), e, n];
3184
+ const i = t ? Qo(t, e, n) : null, s = L(), u = [L(), e, n];
3188
3185
  return Object.assign(Object.assign({ id: s, "forward-identity": u, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
3189
3186
  }
3190
- function Yo(t, e, n) {
3187
+ function Ho(t, e, n) {
3191
3188
  return Object.values(t.links).find((i) => i.forward.on === e && i.forward.label === n || i.reverse.on === e && i.reverse.label === n);
3192
3189
  }
3193
- function Jo(t, e, n) {
3194
- const r = Yo(t, e, n);
3190
+ function Yo(t, e, n) {
3191
+ const r = Ho(t, e, n);
3195
3192
  if (!r)
3196
3193
  throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
3197
3194
  const { forward: i, reverse: s } = r;
@@ -3204,11 +3201,11 @@ function Jo(t, e, n) {
3204
3201
  "on-delete-reverse": s.onDelete
3205
3202
  };
3206
3203
  }
3207
- function er(t, e, n, r) {
3208
- const i = t ? Jo(t, e, n) : null, s = L(), o = [L(), e, n], u = [L(), n, e];
3204
+ function Xn(t, e, n, r) {
3205
+ const i = t ? Yo(t, e, n) : null, s = L(), o = [L(), e, n], u = [L(), n, e];
3209
3206
  return Object.assign(Object.assign({ id: s, "forward-identity": o, "reverse-identity": u, "value-type": "ref", cardinality: "many", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
3210
3207
  }
3211
- const Zo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Xo = /* @__PURE__ */ new Set(["link", "unlink"]), eu = /* @__PURE__ */ new Set(["create", "update", "merge"]), tu = /* @__PURE__ */ new Set([
3208
+ const Jo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Zo = /* @__PURE__ */ new Set(["link", "unlink"]), Xo = /* @__PURE__ */ new Set(["create", "update", "merge"]), eu = /* @__PURE__ */ new Set([
3212
3209
  "link",
3213
3210
  "unlink",
3214
3211
  "create",
@@ -3216,17 +3213,17 @@ const Zo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
3216
3213
  "merge",
3217
3214
  "delete",
3218
3215
  "ruleParams"
3219
- ]), Yt = { "unique?": !0, "index?": !0 }, nu = Object.assign(Object.assign({}, Yt), { cardinality: "one" });
3220
- function ru(t) {
3216
+ ]), Ht = { "unique?": !0, "index?": !0 }, tu = Object.assign(Object.assign({}, Ht), { cardinality: "one" });
3217
+ function nu(t) {
3221
3218
  const e = [], [n, r, i, s] = t;
3222
- if (!tu.has(n))
3219
+ if (!eu.has(n))
3223
3220
  return e;
3224
- const o = Ht(i);
3221
+ const o = Qt(i);
3225
3222
  if (o && e.push({ etype: r, lookupPair: o }), n === "link")
3226
3223
  for (const [u, a] of Object.entries(s)) {
3227
3224
  const d = Array.isArray(a) ? a : [a];
3228
3225
  for (const c of d) {
3229
- const f = Ht(c);
3226
+ const f = Qt(c);
3230
3227
  f && e.push({
3231
3228
  etype: r,
3232
3229
  lookupPair: f,
@@ -3236,7 +3233,7 @@ function ru(t) {
3236
3233
  }
3237
3234
  return e;
3238
3235
  }
3239
- function iu({ attrs: t, schema: e }, n) {
3236
+ function ru({ attrs: t, schema: e }, n) {
3240
3237
  var r, i;
3241
3238
  const [s, o, u] = [/* @__PURE__ */ new Set(), Object.assign({}, t), []];
3242
3239
  function a(f) {
@@ -3247,47 +3244,47 @@ function iu({ attrs: t, schema: e }, n) {
3247
3244
  }
3248
3245
  function c(f, l) {
3249
3246
  const p = K(o, f, l), y = _e(o, f, l);
3250
- d(p), d(y), !p && !y && a(er(e, f, l, nu));
3247
+ d(p), d(y), !p && !y && a(Xn(e, f, l, tu));
3251
3248
  }
3252
3249
  for (const f of n)
3253
- for (const { etype: l, lookupPair: p, linkLabel: y } of ru(f)) {
3250
+ for (const { etype: l, lookupPair: p, linkLabel: y } of nu(f)) {
3254
3251
  const b = p[0];
3255
3252
  if (y) {
3256
3253
  c(l, y);
3257
3254
  const g = K(o, l, y), m = _e(o, l, y);
3258
3255
  d(g), d(m);
3259
3256
  const T = ((r = g == null ? void 0 : g["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = m == null ? void 0 : m["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
3260
- if (Gt(o, T, b))
3261
- c(T, Qt(b));
3257
+ if (Bt(o, T, b))
3258
+ c(T, Gt(b));
3262
3259
  else {
3263
3260
  const v = K(o, T, b);
3264
- v || a(nt(e, T, b, Yt)), d(v);
3261
+ v || a(nt(e, T, b, Ht)), d(v);
3265
3262
  }
3266
- } else if (Gt(o, l, b))
3267
- c(l, Qt(b));
3263
+ } else if (Bt(o, l, b))
3264
+ c(l, Gt(b));
3268
3265
  else {
3269
3266
  const g = K(o, l, b);
3270
- g || a(nt(e, l, b, Yt)), d(g);
3267
+ g || a(nt(e, l, b, Ht)), d(g);
3271
3268
  }
3272
3269
  }
3273
3270
  for (const f of n) {
3274
3271
  const [l, p, y, b] = f;
3275
- if (Zo.has(l)) {
3272
+ if (Jo.has(l)) {
3276
3273
  const g = K(o, p, "id");
3277
3274
  d(g), g || a(nt(e, p, "id", { "unique?": !0 }));
3278
3275
  for (const m of Object.keys(b)) {
3279
3276
  const T = K(o, p, m);
3280
- if (d(T), eu.has(l) && (T || a(nt(e, p, m, m === "id" ? { "unique?": !0 } : null))), Xo.has(l)) {
3277
+ if (d(T), Xo.has(l) && (T || a(nt(e, p, m, m === "id" ? { "unique?": !0 } : null))), Zo.has(l)) {
3281
3278
  const v = _e(o, p, m);
3282
- !T && !v && a(er(e, p, m)), d(v);
3279
+ !T && !v && a(Xn(e, p, m)), d(v);
3283
3280
  }
3284
3281
  }
3285
3282
  }
3286
3283
  }
3287
3284
  return [o, u];
3288
3285
  }
3289
- function su(t, e) {
3290
- const r = (Array.isArray(e) ? e : [e]).flatMap((a) => $o(a)), [i, s] = iu(t, r), o = Object.assign(Object.assign({}, t), { attrs: i }), u = r.flatMap((a) => Go(o, a));
3286
+ function iu(t, e) {
3287
+ const r = (Array.isArray(e) ? e : [e]).flatMap((a) => Ro(a)), [i, s] = ru(t, r), o = Object.assign(Object.assign({}, t), { attrs: i }), u = r.flatMap((a) => Bo(o, a));
3291
3288
  return [...s, ...u];
3292
3289
  }
3293
3290
  var re = function(t, e, n, r) {
@@ -3317,15 +3314,15 @@ var re = function(t, e, n, r) {
3317
3314
  d((r = r.apply(t, e || [])).next());
3318
3315
  });
3319
3316
  };
3320
- function tr(t, e) {
3317
+ function er(t, e) {
3321
3318
  typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
3322
3319
  }
3323
3320
  const qe = "__meta";
3324
- class ou {
3321
+ class su {
3325
3322
  constructor(e, n) {
3326
3323
  }
3327
3324
  }
3328
- class Jt {
3325
+ class Yt {
3329
3326
  constructor(e) {
3330
3327
  var n, r;
3331
3328
  this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
@@ -3519,7 +3516,7 @@ class Jt {
3519
3516
  gc() {
3520
3517
  this._nextGc || (this._nextGc = setTimeout(
3521
3518
  () => {
3522
- tr(() => {
3519
+ er(() => {
3523
3520
  this._nextGc = null, this._gc();
3524
3521
  }, 30 * 1e3);
3525
3522
  },
@@ -3534,7 +3531,7 @@ class Jt {
3534
3531
  return;
3535
3532
  }
3536
3533
  this._nextSave = setTimeout(() => {
3537
- tr(() => {
3534
+ er(() => {
3538
3535
  this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
3539
3536
  }, this._idleCallbackMaxWaitMs);
3540
3537
  }, this._saveThrottleMs);
@@ -3593,13 +3590,13 @@ var oe = function(t, e, n, r) {
3593
3590
  d((r = r.apply(t, e || [])).next());
3594
3591
  });
3595
3592
  };
3596
- const uu = 6, au = ["kv", "querySubs", "syncSubs"];
3597
- function cu(t) {
3593
+ const ou = 6, uu = ["kv", "querySubs", "syncSubs"];
3594
+ function au(t) {
3598
3595
  return function(n) {
3599
3596
  console.error("Error in IndexedDB event", { source: t, event: n });
3600
3597
  };
3601
3598
  }
3602
- function du(t) {
3599
+ function cu(t) {
3603
3600
  return oe(this, void 0, void 0, function* () {
3604
3601
  return new Promise((e) => {
3605
3602
  const n = indexedDB.open(t);
@@ -3615,7 +3612,7 @@ function du(t) {
3615
3612
  });
3616
3613
  });
3617
3614
  }
3618
- function fu(t, e, n) {
3615
+ function du(t, e, n) {
3619
3616
  return oe(this, void 0, void 0, function* () {
3620
3617
  const r = (
3621
3618
  // Backwards compatibility for older versions where we JSON.stringified before storing
@@ -3651,7 +3648,7 @@ function fu(t, e, n) {
3651
3648
  });
3652
3649
  });
3653
3650
  }
3654
- function nr(t, e, n) {
3651
+ function tr(t, e, n) {
3655
3652
  return oe(this, void 0, void 0, function* () {
3656
3653
  const r = n.put(e, t);
3657
3654
  return new Promise((i, s) => {
@@ -3659,9 +3656,9 @@ function nr(t, e, n) {
3659
3656
  });
3660
3657
  });
3661
3658
  }
3662
- function lu(t, e) {
3659
+ function fu(t, e) {
3663
3660
  return oe(this, void 0, void 0, function* () {
3664
- const n = yield du(`instant_${t}_5`);
3661
+ const n = yield cu(`instant_${t}_5`);
3665
3662
  if (!n)
3666
3663
  return;
3667
3664
  const r = yield new Promise((c, f) => {
@@ -3684,12 +3681,12 @@ function lu(t, e) {
3684
3681
  for (const [c, f] of r)
3685
3682
  switch (c) {
3686
3683
  case "querySubs": {
3687
- const l = fu(c, f, o);
3684
+ const l = du(c, f, o);
3688
3685
  u.push(l);
3689
3686
  break;
3690
3687
  }
3691
3688
  default: {
3692
- const l = nr(c, f, s);
3689
+ const l = tr(c, f, s);
3693
3690
  u.push(l);
3694
3691
  const p = {
3695
3692
  createdAt: Date.now(),
@@ -3700,16 +3697,16 @@ function lu(t, e) {
3700
3697
  break;
3701
3698
  }
3702
3699
  }
3703
- const d = nr(qe, a, s);
3700
+ const d = tr(qe, a, s);
3704
3701
  u.push(d), yield Promise.all(u), yield new Promise((c, f) => {
3705
3702
  i.oncomplete = (l) => c(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
3706
3703
  });
3707
3704
  });
3708
3705
  }
3709
- const rr = /* @__PURE__ */ new Map();
3710
- class ni extends ou {
3706
+ const nr = /* @__PURE__ */ new Map();
3707
+ class ti extends su {
3711
3708
  constructor(e, n) {
3712
- super(e, n), this.dbName = `instant_${e}_${uu}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
3709
+ super(e, n), this.dbName = `instant_${e}_${ou}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
3713
3710
  }
3714
3711
  _init() {
3715
3712
  return new Promise((e, n) => {
@@ -3720,12 +3717,12 @@ class ni extends ou {
3720
3717
  }, i.onsuccess = (s) => {
3721
3718
  const u = s.target.result;
3722
3719
  if (r) {
3723
- const a = lu(this._appId, u).catch((d) => {
3724
- cu("Error upgrading store from version 5 to 6.")(d);
3720
+ const a = fu(this._appId, u).catch((d) => {
3721
+ au("Error upgrading store from version 5 to 6.")(d);
3725
3722
  });
3726
- rr.set(this.dbName, a), a.then(() => e(u)).catch(() => e(u));
3723
+ nr.set(this.dbName, a), a.then(() => e(u)).catch(() => e(u));
3727
3724
  } else {
3728
- const a = rr.get(this.dbName);
3725
+ const a = nr.get(this.dbName);
3729
3726
  a ? a.then(() => e(u)).catch(() => e(u)) : e(u);
3730
3727
  }
3731
3728
  }, i.onupgradeneeded = (s) => {
@@ -3735,7 +3732,7 @@ class ni extends ou {
3735
3732
  }
3736
3733
  _upgradeStore(e) {
3737
3734
  const r = e.target.result;
3738
- for (const i of au)
3735
+ for (const i of uu)
3739
3736
  r.objectStoreNames.contains(i) || r.createObjectStore(i);
3740
3737
  }
3741
3738
  getItem(e) {
@@ -3810,7 +3807,7 @@ class ni extends ou {
3810
3807
  });
3811
3808
  }
3812
3809
  }
3813
- var hu = function(t, e, n, r) {
3810
+ var lu = function(t, e, n, r) {
3814
3811
  function i(s) {
3815
3812
  return s instanceof n ? s : new n(function(o) {
3816
3813
  o(s);
@@ -3837,9 +3834,9 @@ var hu = function(t, e, n, r) {
3837
3834
  d((r = r.apply(t, e || [])).next());
3838
3835
  });
3839
3836
  };
3840
- class ri {
3837
+ class ni {
3841
3838
  static getIsOnline() {
3842
- return hu(this, void 0, void 0, function* () {
3839
+ return lu(this, void 0, void 0, function* () {
3843
3840
  return navigator.onLine;
3844
3841
  });
3845
3842
  }
@@ -3864,7 +3861,7 @@ class je extends Error {
3864
3861
  return "InstantError";
3865
3862
  }
3866
3863
  }
3867
- var pu = function(t, e, n, r) {
3864
+ var hu = function(t, e, n, r) {
3868
3865
  function i(s) {
3869
3866
  return s instanceof n ? s : new n(function(o) {
3870
3867
  o(s);
@@ -3904,7 +3901,7 @@ class bt extends je {
3904
3901
  }
3905
3902
  }
3906
3903
  function te(t, e) {
3907
- return pu(this, void 0, void 0, function* () {
3904
+ return hu(this, void 0, void 0, function* () {
3908
3905
  const n = yield fetch(t, e), r = yield n.json();
3909
3906
  return n.status === 200 ? Promise.resolve(r) : Promise.reject(new bt({ status: n.status, body: r }));
3910
3907
  });
@@ -3936,14 +3933,14 @@ var Pe = function(t, e, n, r) {
3936
3933
  d((r = r.apply(t, e || [])).next());
3937
3934
  });
3938
3935
  };
3939
- function yu({ apiURI: t, appId: e, email: n }) {
3936
+ function pu({ apiURI: t, appId: e, email: n }) {
3940
3937
  return te(`${t}/runtime/auth/send_magic_code`, {
3941
3938
  method: "POST",
3942
3939
  headers: { "content-type": "application/json" },
3943
3940
  body: JSON.stringify({ "app-id": e, email: n })
3944
3941
  });
3945
3942
  }
3946
- function bu(t) {
3943
+ function yu(t) {
3947
3944
  return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
3948
3945
  return yield te(`${e}/runtime/auth/verify_magic_code`, {
3949
3946
  method: "POST",
@@ -3956,7 +3953,7 @@ function bu(t) {
3956
3953
  });
3957
3954
  });
3958
3955
  }
3959
- function _u(t) {
3956
+ function bu(t) {
3960
3957
  return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3961
3958
  return yield te(`${e}/runtime/auth/verify_refresh_token`, {
3962
3959
  method: "POST",
@@ -3968,7 +3965,7 @@ function _u(t) {
3968
3965
  });
3969
3966
  });
3970
3967
  }
3971
- function gu(t) {
3968
+ function _u(t) {
3972
3969
  return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
3973
3970
  return yield te(`${e}/runtime/auth/sign_in_guest`, {
3974
3971
  method: "POST",
@@ -3979,7 +3976,7 @@ function gu(t) {
3979
3976
  });
3980
3977
  });
3981
3978
  }
3982
- function ir(t) {
3979
+ function rr(t) {
3983
3980
  return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
3984
3981
  return yield te(`${e}/runtime/oauth/token`, {
3985
3982
  method: "POST",
@@ -3993,7 +3990,7 @@ function ir(t) {
3993
3990
  });
3994
3991
  });
3995
3992
  }
3996
- function Tu(t) {
3993
+ function gu(t) {
3997
3994
  return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
3998
3995
  return yield te(`${e}/runtime/oauth/id_token`, {
3999
3996
  method: "POST",
@@ -4008,7 +4005,7 @@ function Tu(t) {
4008
4005
  });
4009
4006
  });
4010
4007
  }
4011
- function mu(t) {
4008
+ function Tu(t) {
4012
4009
  return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
4013
4010
  return yield te(`${e}/runtime/signout`, {
4014
4011
  method: "POST",
@@ -4049,7 +4046,7 @@ var Ge = function(t, e, n, r) {
4049
4046
  d((r = r.apply(t, e || [])).next());
4050
4047
  });
4051
4048
  };
4052
- function wu(t) {
4049
+ function mu(t) {
4053
4050
  return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: u }) {
4054
4051
  const a = {
4055
4052
  app_id: n,
@@ -4064,7 +4061,7 @@ function wu(t) {
4064
4061
  });
4065
4062
  });
4066
4063
  }
4067
- function vu(t) {
4064
+ function wu(t) {
4068
4065
  return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
4069
4066
  const { data: s } = yield te(`${e}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
4070
4067
  method: "DELETE",
@@ -4076,7 +4073,7 @@ function vu(t) {
4076
4073
  return s;
4077
4074
  });
4078
4075
  }
4079
- function Su(t) {
4076
+ function vu(t) {
4080
4077
  return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
4081
4078
  const { data: o } = yield te(`${e}/storage/signed-upload-url`, {
4082
4079
  method: "POST",
@@ -4092,7 +4089,7 @@ function Su(t) {
4092
4089
  return o;
4093
4090
  });
4094
4091
  }
4095
- function Ou(t, e) {
4092
+ function Su(t, e) {
4096
4093
  return Ge(this, void 0, void 0, function* () {
4097
4094
  return (yield fetch(t, {
4098
4095
  method: "PUT",
@@ -4103,7 +4100,7 @@ function Ou(t, e) {
4103
4100
  })).ok;
4104
4101
  });
4105
4102
  }
4106
- function Eu(t) {
4103
+ function Ou(t) {
4107
4104
  return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
4108
4105
  const { data: s } = yield te(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
4109
4106
  method: "GET",
@@ -4115,9 +4112,9 @@ function Eu(t) {
4115
4112
  return s;
4116
4113
  });
4117
4114
  }
4118
- let pn = !1, ii = !1, si = !1;
4119
- typeof window < "u" && typeof window.localStorage < "u" && (pn = !!window.localStorage.getItem("devBackend"), ii = !!window.localStorage.getItem("__instantLogging"), si = !!window.localStorage.getItem("__devtoolLocalDash"));
4120
- function sr(t, e) {
4115
+ let hn = !1, ri = !1, ii = !1;
4116
+ typeof window < "u" && typeof window.localStorage < "u" && (hn = !!window.localStorage.getItem("devBackend"), ri = !!window.localStorage.getItem("__instantLogging"), ii = !!window.localStorage.getItem("__devtoolLocalDash"));
4117
+ function ir(t, e) {
4121
4118
  if (!e)
4122
4119
  return t;
4123
4120
  const n = {};
@@ -4125,33 +4122,33 @@ function sr(t, e) {
4125
4122
  n[r] = t[r];
4126
4123
  }), n;
4127
4124
  }
4128
- function Au(t, e, n) {
4125
+ function Eu(t, e, n) {
4129
4126
  var r, i;
4130
4127
  const s = {
4131
4128
  peers: {}
4132
4129
  };
4133
4130
  if (e && "user" in e ? e.user : !0) {
4134
- const u = sr((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
4131
+ const u = ir((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
4135
4132
  s.user = Object.assign(Object.assign({}, u), { peerId: n });
4136
4133
  }
4137
4134
  for (const u of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
4138
4135
  const a = (e == null ? void 0 : e.peers) === void 0, d = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(u));
4139
4136
  if (a || d) {
4140
- const c = sr(t.peers[u], e == null ? void 0 : e.keys);
4137
+ const c = ir(t.peers[u], e == null ? void 0 : e.keys);
4141
4138
  s.peers[u] = Object.assign(Object.assign({}, c), { peerId: u });
4142
4139
  }
4143
4140
  }
4144
4141
  return s;
4145
4142
  }
4146
- function ju(t, e) {
4147
- if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !Vn(t.user, e.user)) || !Rr(t.peers, e.peers))
4143
+ function Au(t, e) {
4144
+ if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !zn(t.user, e.user)) || !Mr(t.peers, e.peers))
4148
4145
  return !0;
4149
4146
  for (const r of Object.keys(t.peers))
4150
- if (!Vn(t.peers[r], e.peers[r]))
4147
+ if (!zn(t.peers[r], e.peers[r]))
4151
4148
  return !0;
4152
4149
  return !1;
4153
4150
  }
4154
- class or {
4151
+ class sr {
4155
4152
  constructor() {
4156
4153
  this.promise = new Promise((e, n) => {
4157
4154
  this._resolve = e, this._reject = n;
@@ -4164,20 +4161,20 @@ class or {
4164
4161
  this._reject(e);
4165
4162
  }
4166
4163
  }
4167
- function oi(t, e = []) {
4164
+ function si(t, e = []) {
4168
4165
  t.forEach((n) => {
4169
4166
  const { data: r } = n, { "datalog-result": i } = r, { "join-rows": s } = i;
4170
4167
  for (const o of s)
4171
4168
  for (const u of o)
4172
4169
  e.push(u);
4173
- oi(n["child-nodes"], e);
4170
+ si(n["child-nodes"], e);
4174
4171
  });
4175
4172
  }
4176
- function ur(t) {
4173
+ function or(t) {
4177
4174
  const e = [];
4178
- return oi(t, e), e;
4175
+ return si(t, e), e;
4179
4176
  }
4180
- function ar(t) {
4177
+ function ur(t) {
4181
4178
  return Object.values(t.links).reduce((e, n) => {
4182
4179
  var r, i, s, o;
4183
4180
  return (r = e[s = n.forward.on]) !== null && r !== void 0 || (e[s] = {}), e[n.forward.on][n.forward.label] = {
@@ -4191,8 +4188,8 @@ function ar(t) {
4191
4188
  }, e;
4192
4189
  }, {});
4193
4190
  }
4194
- const ui = "v0.22.88-experimental.drewh-entity-caching.20249092034.1";
4195
- function ku(t, e) {
4191
+ const oi = "v0.22.88-experimental.drewh-fix-explorer.20249092035.1";
4192
+ function ju(t, e) {
4196
4193
  return {
4197
4194
  info: t ? (...n) => console.info(...n, e()) : () => {
4198
4195
  },
@@ -4230,7 +4227,7 @@ class M extends Error {
4230
4227
  super(r), this.name = "QueryValidationError";
4231
4228
  }
4232
4229
  }
4233
- const cr = [
4230
+ const ar = [
4234
4231
  "where",
4235
4232
  "order",
4236
4233
  "limit",
@@ -4241,7 +4238,7 @@ const cr = [
4241
4238
  "before",
4242
4239
  "fields",
4243
4240
  "aggregate"
4244
- ], Cu = (t) => t.valueType || "unknown", ai = (t, e, n = !1) => {
4241
+ ], ku = (t) => t.valueType || "unknown", ui = (t, e, n = !1) => {
4245
4242
  if (n || t == null)
4246
4243
  return !0;
4247
4244
  switch (e) {
@@ -4256,9 +4253,9 @@ const cr = [
4256
4253
  default:
4257
4254
  return !0;
4258
4255
  }
4259
- }, Pu = (t, e, n, r, i, s, o) => {
4256
+ }, Cu = (t, e, n, r, i, s, o) => {
4260
4257
  const u = s.valueType === "json", a = (d, c, f) => {
4261
- if (!ai(f, c, u))
4258
+ if (!ui(f, c, u))
4262
4259
  throw new M(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
4263
4260
  };
4264
4261
  switch (t) {
@@ -4289,16 +4286,16 @@ const cr = [
4289
4286
  throw new M(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
4290
4287
  }
4291
4288
  }, Oe = (t, e, n, r, i) => {
4292
- const s = Cu(n), o = n.valueType === "json";
4289
+ const s = ku(n), o = n.valueType === "json";
4293
4290
  if (typeof t == "object" && t !== null && !Array.isArray(t)) {
4294
4291
  if (o)
4295
4292
  return;
4296
4293
  const a = t;
4297
4294
  for (const [d, c] of Object.entries(a))
4298
- Pu(d, c, s, e, r, n, `${i}.${d}`);
4299
- } else if (!ai(t, s, o))
4295
+ Cu(d, c, s, e, r, n, `${i}.${d}`);
4296
+ } else if (!ui(t, s, o))
4300
4297
  throw new M(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
4301
- }, Iu = (t, e, n, r, i) => {
4298
+ }, Pu = (t, e, n, r, i) => {
4302
4299
  const s = t.split(".");
4303
4300
  if (s.length < 2)
4304
4301
  throw new M(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
@@ -4335,12 +4332,12 @@ const cr = [
4335
4332
  throw new M(`Attribute '${u}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
4336
4333
  }
4337
4334
  Oe(e, t, d, n, i);
4338
- }, ci = (t, e, n, r) => {
4335
+ }, ai = (t, e, n, r) => {
4339
4336
  for (const [i, s] of Object.entries(t)) {
4340
4337
  if (i === "or" || i === "and") {
4341
4338
  if (Array.isArray(s))
4342
4339
  for (const d of s)
4343
- typeof d == "object" && d !== null && ci(d, e, n, `${r}.${i}[${d}]`);
4340
+ typeof d == "object" && d !== null && ai(d, e, n, `${r}.${i}[${d}]`);
4344
4341
  continue;
4345
4342
  }
4346
4343
  if (i === "id") {
@@ -4348,7 +4345,7 @@ const cr = [
4348
4345
  continue;
4349
4346
  }
4350
4347
  if (i.includes(".")) {
4351
- Iu(i, s, e, n, `${r}.${i}`);
4348
+ Pu(i, s, e, n, `${r}.${i}`);
4352
4349
  continue;
4353
4350
  }
4354
4351
  const o = n.entities[e];
@@ -4368,10 +4365,10 @@ const cr = [
4368
4365
  Oe(s, i, d, e, `${r}.${i}`);
4369
4366
  }
4370
4367
  }
4371
- }, Mu = (t, e, n, r, i = 0) => {
4368
+ }, Iu = (t, e, n, r, i = 0) => {
4372
4369
  for (const o of Object.keys(t))
4373
- if (!cr.includes(o))
4374
- throw new M(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${cr.join(", ")}. Found: ${o}`, r);
4370
+ if (!ar.includes(o))
4371
+ throw new M(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${ar.join(", ")}. Found: ${o}`, r);
4375
4372
  const s = [
4376
4373
  // 'limit', // only supported client side
4377
4374
  "offset",
@@ -4386,9 +4383,9 @@ const cr = [
4386
4383
  if (t.where && n) {
4387
4384
  if (typeof t.where != "object" || t.where === null)
4388
4385
  throw new M(`'where' clause must be an object in entity '${e}', but received: ${typeof t.where}`, r ? `${r}.where` : void 0);
4389
- ci(t.where, e, n, r ? `${r}.where` : "where");
4386
+ ai(t.where, e, n, r ? `${r}.where` : "where");
4390
4387
  }
4391
- }, di = (t, e, n, r, i = 0) => {
4388
+ }, ci = (t, e, n, r, i = 0) => {
4392
4389
  var s;
4393
4390
  if (!t || typeof t != "object")
4394
4391
  throw new M(`Query part for entity '${e}' must be an object, but received: ${typeof t}`, r);
@@ -4401,15 +4398,15 @@ const cr = [
4401
4398
  const u = t[o];
4402
4399
  if (typeof u == "object" && u !== null) {
4403
4400
  const a = (s = n == null ? void 0 : n.entities[e].links[o]) === null || s === void 0 ? void 0 : s.entityName;
4404
- a && di(u, a, n, `${r}.${o}`, i + 1);
4401
+ a && ci(u, a, n, `${r}.${o}`, i + 1);
4405
4402
  }
4406
4403
  } else {
4407
4404
  const u = t[o];
4408
4405
  if (typeof u != "object" || u === null)
4409
4406
  throw new M(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof u}`, `${r}.$`);
4410
- Mu(u, e, n, `${r}.$`, i);
4407
+ Iu(u, e, n, `${r}.$`, i);
4411
4408
  }
4412
- }, dr = (t, e) => {
4409
+ }, cr = (t, e) => {
4413
4410
  if (typeof t != "object" || t === null)
4414
4411
  throw new M(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
4415
4412
  if (Array.isArray(t))
@@ -4425,67 +4422,67 @@ const cr = [
4425
4422
  const i = Object.keys(e.entities);
4426
4423
  throw new M(`Entity '${r}' does not exist in schema. Available entities: ${i.length > 0 ? i.join(", ") : "none"}`, r);
4427
4424
  }
4428
- di(n[r], r, e, r, 0);
4425
+ ci(n[r], r, e, r, 0);
4429
4426
  }
4430
4427
  }
4431
- }, fr = (t) => typeof t != "string" ? !1 : ht(t) ? !0 : Ee(t);
4428
+ }, dr = (t) => typeof t != "string" ? !1 : ht(t) ? !0 : Ee(t);
4432
4429
  class Z extends Error {
4433
4430
  constructor(e) {
4434
4431
  super(e), this.name = "TransactionValidationError";
4435
4432
  }
4436
4433
  }
4437
- const fi = (t) => t.length > 0 ? t.join(", ") : "none", Ru = (t, e) => new Z(`Entity '${t}' does not exist in schema. Available entities: ${fi(e)}`), lr = {
4434
+ const di = (t) => t.length > 0 ? t.join(", ") : "none", Mu = (t, e) => new Z(`Entity '${t}' does not exist in schema. Available entities: ${di(e)}`), fr = {
4438
4435
  string: (t) => typeof t == "string",
4439
4436
  number: (t) => typeof t == "number" && !isNaN(t),
4440
4437
  boolean: (t) => typeof t == "boolean",
4441
4438
  date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
4442
4439
  json: () => !0
4443
- }, $u = (t, e) => {
4440
+ }, Ru = (t, e) => {
4444
4441
  var n, r;
4445
- return t == null ? !0 : (r = (n = lr[e.valueType]) === null || n === void 0 ? void 0 : n.call(lr, t)) !== null && r !== void 0 ? r : !1;
4446
- }, li = (t, e) => {
4442
+ return t == null ? !0 : (r = (n = fr[e.valueType]) === null || n === void 0 ? void 0 : n.call(fr, t)) !== null && r !== void 0 ? r : !1;
4443
+ }, fi = (t, e) => {
4447
4444
  const n = e.entities[t];
4448
4445
  if (!n)
4449
- throw Ru(t, Object.keys(e.entities));
4446
+ throw Mu(t, Object.keys(e.entities));
4450
4447
  return n;
4451
- }, Pt = (t, e, n) => {
4452
- const r = li(t, n);
4448
+ }, Ct = (t, e, n) => {
4449
+ const r = fi(t, n);
4453
4450
  if (typeof e != "object" || e === null)
4454
4451
  throw new Z(`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`);
4455
4452
  for (const [i, s] of Object.entries(e)) {
4456
4453
  if (i === "id")
4457
4454
  continue;
4458
4455
  const o = r.attrs[i];
4459
- if (o && !$u(s, o))
4456
+ if (o && !Ru(s, o))
4460
4457
  throw new Z(`Invalid value for attribute '${i}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof s}`);
4461
4458
  }
4462
- }, hr = (t, e, n) => {
4463
- const r = li(t, n);
4459
+ }, lr = (t, e, n) => {
4460
+ const r = fi(t, n);
4464
4461
  if (typeof e != "object" || e === null)
4465
4462
  throw new Z(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
4466
4463
  for (const [i, s] of Object.entries(e)) {
4467
4464
  if (!r.links[i]) {
4468
4465
  const u = Object.keys(r.links);
4469
- throw new Z(`Link '${i}' does not exist on entity '${t}'. Available links: ${fi(u)}`);
4466
+ throw new Z(`Link '${i}' does not exist on entity '${t}'. Available links: ${di(u)}`);
4470
4467
  }
4471
4468
  if (s != null) {
4472
4469
  if (Array.isArray(s)) {
4473
4470
  for (const u of s)
4474
- if (!fr(u))
4471
+ if (!dr(u))
4475
4472
  throw new Z(`Invalid entity ID in link '${i}' for entity '${t}'. Expected a UUID or a lookup, but received: ${u}`);
4476
- } else if (!fr(s))
4473
+ } else if (!dr(s))
4477
4474
  throw new Z(`Invalid UUID in link '${i}' for entity '${t}'. Expected a UUID, but received: ${s}`);
4478
4475
  }
4479
4476
  }
4480
- }, xu = {
4481
- create: Pt,
4482
- update: Pt,
4483
- merge: Pt,
4484
- link: hr,
4485
- unlink: hr,
4477
+ }, $u = {
4478
+ create: Ct,
4479
+ update: Ct,
4480
+ merge: Ct,
4481
+ link: lr,
4482
+ unlink: lr,
4486
4483
  delete: () => {
4487
4484
  }
4488
- }, Du = (t, e) => {
4485
+ }, xu = (t, e) => {
4489
4486
  if (!e)
4490
4487
  return;
4491
4488
  const [n, r, i, s] = t;
@@ -4493,9 +4490,9 @@ const fi = (t) => t.length > 0 ? t.join(", ") : "none", Ru = (t, e) => new Z(`En
4493
4490
  throw new Z(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
4494
4491
  if (typeof r != "string")
4495
4492
  throw new Z(`Entity name must be a string, but received: ${typeof r}`);
4496
- const o = xu[n];
4493
+ const o = $u[n];
4497
4494
  o && s !== void 0 && o(r, s, e);
4498
- }, Uu = (t, e) => {
4495
+ }, Du = (t, e) => {
4499
4496
  const n = Array.isArray(t) ? t : [t];
4500
4497
  for (const r of n) {
4501
4498
  if (!r || typeof r != "object")
@@ -4505,11 +4502,11 @@ const fi = (t) => t.length > 0 ? t.join(", ") : "none", Ru = (t, e) => new Z(`En
4505
4502
  for (const i of r.__ops) {
4506
4503
  if (!Array.isArray(i))
4507
4504
  throw new Z(`Transaction operation must be an array, but received: ${typeof i}`);
4508
- Du(i, e);
4505
+ xu(i, e);
4509
4506
  }
4510
4507
  }
4511
4508
  };
4512
- var pr = function(t, e, n, r) {
4509
+ var hr = function(t, e, n, r) {
4513
4510
  function i(s) {
4514
4511
  return s instanceof n ? s : new n(function(o) {
4515
4512
  o(s);
@@ -4536,10 +4533,10 @@ var pr = function(t, e, n, r) {
4536
4533
  d((r = r.apply(t, e || [])).next());
4537
4534
  });
4538
4535
  };
4539
- let hi = 0;
4540
- class yr {
4536
+ let li = 0;
4537
+ class pr {
4541
4538
  constructor(e) {
4542
- this.type = "ws", this.id = `${this.type}_${hi++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
4539
+ this.type = "ws", this.id = `${this.type}_${li++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
4543
4540
  this.onopen && this.onopen({ target: this });
4544
4541
  }, this.conn.onmessage = (n) => {
4545
4542
  this.onmessage && this.onmessage({
@@ -4567,9 +4564,9 @@ class yr {
4567
4564
  return this.conn.send(JSON.stringify(e));
4568
4565
  }
4569
4566
  }
4570
- class Lu {
4567
+ class Uu {
4571
4568
  constructor(e, n) {
4572
- this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${hi++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
4569
+ this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${li++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
4573
4570
  this.initParams || this.handleError();
4574
4571
  }, 1e4), this.conn.onmessage = (r) => {
4575
4572
  const i = JSON.parse(r.data);
@@ -4608,7 +4605,7 @@ class Lu {
4608
4605
  this.conn.close(), this.onclose && !this.closeFired && (this.closeFired = !0, this.onclose({ target: this }));
4609
4606
  }
4610
4607
  postMessages(e) {
4611
- return pr(this, void 0, void 0, function* () {
4608
+ return hr(this, void 0, void 0, function* () {
4612
4609
  var n, r, i;
4613
4610
  try {
4614
4611
  (yield fetch(this.url, {
@@ -4627,7 +4624,7 @@ class Lu {
4627
4624
  });
4628
4625
  }
4629
4626
  flushQueue() {
4630
- return pr(this, void 0, void 0, function* () {
4627
+ return hr(this, void 0, void 0, function* () {
4631
4628
  if (this.sendPromise || !this.sendQueue.length)
4632
4629
  return;
4633
4630
  const e = this.sendQueue;
@@ -4653,7 +4650,7 @@ class Lu {
4653
4650
  this.handleClose();
4654
4651
  }
4655
4652
  }
4656
- var br = function(t, e, n, r) {
4653
+ var yr = function(t, e, n, r) {
4657
4654
  function i(s) {
4658
4655
  return s instanceof n ? s : new n(function(o) {
4659
4656
  o(s);
@@ -4680,34 +4677,34 @@ var br = function(t, e, n, r) {
4680
4677
  d((r = r.apply(t, e || [])).next());
4681
4678
  });
4682
4679
  };
4683
- function Fu(t, e) {
4680
+ function Lu(t, e) {
4684
4681
  const n = t.values;
4685
4682
  if (n)
4686
4683
  for (const r of n.entities || [])
4687
- r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store = Fr(r.store);
4684
+ r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store = Lr(r.store);
4688
4685
  return t;
4689
4686
  }
4690
- function Nu(t, e) {
4687
+ function Fu(t, e) {
4691
4688
  var n, r;
4692
4689
  if (!((n = e.values) === null || n === void 0) && n.entities) {
4693
4690
  const i = [];
4694
4691
  for (const s of (r = e.values) === null || r === void 0 ? void 0 : r.entities) {
4695
- const o = Lr(s.store);
4692
+ const o = Ur(s.store);
4696
4693
  delete o.attrs, i.push(Object.assign(Object.assign({}, s), { store: o }));
4697
4694
  }
4698
4695
  return Object.assign(Object.assign({}, e), { values: Object.assign(Object.assign({}, e.values), { entities: i }) });
4699
4696
  } else
4700
4697
  return e;
4701
4698
  }
4702
- function Ku(t, e, n) {
4699
+ function Nu(t, e, n) {
4703
4700
  var r, i;
4704
4701
  const s = (r = e == null ? void 0 : e.state) === null || r === void 0 ? void 0 : r.txId, o = (i = n == null ? void 0 : n.state) === null || i === void 0 ? void 0 : i.txId;
4705
4702
  return s && (!o || s > o) ? e : o && (!s || o > s) ? n : e || n;
4706
4703
  }
4707
- function It(t, e) {
4708
- return Zr({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
4704
+ function Pt(t, e) {
4705
+ return Jr({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
4709
4706
  }
4710
- function _r(t, e, n) {
4707
+ function br(t, e, n) {
4711
4708
  var r;
4712
4709
  const i = (r = fe(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
4713
4710
  if (!i)
@@ -4715,18 +4712,18 @@ function _r(t, e, n) {
4715
4712
  const s = Ce(e.eav, [n, i, n]);
4716
4713
  return s ? s[3] : -1;
4717
4714
  }
4718
- function gr(t, e) {
4715
+ function _r(t, e) {
4719
4716
  for (const { action: n, triple: r } of e)
4720
4717
  switch (n) {
4721
4718
  case "added":
4722
- qr(t, r);
4719
+ Kr(t, r);
4723
4720
  break;
4724
4721
  case "removed":
4725
- Nr(t, r);
4722
+ Fr(t, r);
4726
4723
  break;
4727
4724
  }
4728
4725
  }
4729
- function qu(t, e) {
4726
+ function Ku(t, e) {
4730
4727
  var n, r, i, s;
4731
4728
  const o = {};
4732
4729
  for (const { action: u, triple: a } of e) {
@@ -4754,14 +4751,14 @@ function qu(t, e) {
4754
4751
  function rt(t, e) {
4755
4752
  return { [t.table]: e.map((n) => n.entity) };
4756
4753
  }
4757
- function zu(t, e) {
4754
+ function qu(t, e) {
4758
4755
  var n;
4759
4756
  if (t.orderFieldType)
4760
4757
  return t.orderFieldType;
4761
4758
  const r = t.orderField === "serverCreatedAt" ? "number" : (n = fe(e([]), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
4762
4759
  return t.orderFieldType = r, r;
4763
4760
  }
4764
- function Vu(t, e, n) {
4761
+ function zu(t, e, n) {
4765
4762
  const r = e;
4766
4763
  if (t.orderField === "serverCreatedAt") {
4767
4764
  n.sort(t.orderDirection === "asc" ? function(o, u) {
@@ -4782,13 +4779,13 @@ var pe;
4782
4779
  (function(t) {
4783
4780
  t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
4784
4781
  })(pe || (pe = {}));
4785
- class Wu {
4782
+ class Vu {
4786
4783
  constructor(e, n, r, i, s) {
4787
- this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Jt({
4784
+ this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Yt({
4788
4785
  persister: n,
4789
- merge: Ku,
4790
- serialize: Nu,
4791
- parse: (o, u) => Fu(u, this.config.useDateObjects),
4786
+ merge: Nu,
4787
+ serialize: Fu,
4788
+ parse: (o, u) => Lu(u, this.config.useDateObjects),
4792
4789
  objectSize: (o) => {
4793
4790
  var u;
4794
4791
  return ((u = o.values) === null || u === void 0 ? void 0 : u.entities.length) || 0;
@@ -4845,7 +4842,7 @@ class Wu {
4845
4842
  });
4846
4843
  }
4847
4844
  initSubscription(e, n, r) {
4848
- return br(this, void 0, void 0, function* () {
4845
+ return yr(this, void 0, void 0, function* () {
4849
4846
  var i, s, o, u;
4850
4847
  yield this.subs.waitForKeyToLoad(n);
4851
4848
  const a = this.subs.currentValue[n];
@@ -4871,7 +4868,7 @@ class Wu {
4871
4868
  });
4872
4869
  }
4873
4870
  flushPending() {
4874
- return br(this, void 0, void 0, function* () {
4871
+ return yr(this, void 0, void 0, function* () {
4875
4872
  for (const e of Object.keys(this.callbacks)) {
4876
4873
  yield this.subs.waitForKeyToLoad(e);
4877
4874
  const n = this.subs.currentValue[e];
@@ -4916,11 +4913,11 @@ class Wu {
4916
4913
  for (const c of i) {
4917
4914
  const f = this.createStore(c);
4918
4915
  a.attrs = f.attrs;
4919
- const l = It(u, f);
4916
+ const l = Pt(u, f);
4920
4917
  d.push({
4921
4918
  store: f,
4922
4919
  entity: l,
4923
- serverCreatedAt: _r(u, f, l.id)
4920
+ serverCreatedAt: br(u, f, l.id)
4924
4921
  }), o.push(l);
4925
4922
  }
4926
4923
  this.subs.updateInPlace((c) => {
@@ -4990,9 +4987,9 @@ class Wu {
4990
4987
  e: for (const [T, v] of Object.entries(f))
4991
4988
  for (let k = 0; k < p.length; k++) {
4992
4989
  const S = p[k];
4993
- if (Ss(S.store, T)) {
4994
- gr(S.store, v);
4995
- const I = It(u, S.store), R = qu(S.store, v)[T];
4990
+ if (vs(S.store, T)) {
4991
+ _r(S.store, v);
4992
+ const I = Pt(u, S.store), R = Ku(S.store, v)[T];
4996
4993
  I ? (y.push({
4997
4994
  oldEntity: S.entity,
4998
4995
  newEntity: I,
@@ -5004,8 +5001,8 @@ class Wu {
5004
5001
  const b = [];
5005
5002
  for (const [T, v] of Object.entries(f)) {
5006
5003
  const k = this.createStore([]);
5007
- l.attrs = k.attrs, gr(k, v);
5008
- const S = It(u, k);
5004
+ l.attrs = k.attrs, _r(k, v);
5005
+ const S = Pt(u, k);
5009
5006
  if (!S) {
5010
5007
  this.log.error("No entity found after applying change", {
5011
5008
  sub: u,
@@ -5017,14 +5014,14 @@ class Wu {
5017
5014
  p.push({
5018
5015
  store: k,
5019
5016
  entity: S,
5020
- serverCreatedAt: _r(u, k, S.id)
5017
+ serverCreatedAt: br(u, k, S.id)
5021
5018
  }), b.push(S);
5022
5019
  }
5023
5020
  const g = [];
5024
5021
  for (const T of c.sort().reverse())
5025
5022
  g.push(p[T].entity), p.splice(T, 1);
5026
- const m = zu(u, this.createStore);
5027
- Vu(u, m, p), this.notifyCbs(o, {
5023
+ const m = qu(u, this.createStore);
5024
+ zu(u, m, p), this.notifyCbs(o, {
5028
5025
  type: pe.SyncTransaction,
5029
5026
  data: rt(u, (i = u.values) === null || i === void 0 ? void 0 : i.entities),
5030
5027
  added: b,
@@ -5091,7 +5088,7 @@ var U = function(t, e, n, r) {
5091
5088
  }
5092
5089
  d((r = r.apply(t, e || [])).next());
5093
5090
  });
5094
- }, Bu = function(t, e) {
5091
+ }, Wu = function(t, e) {
5095
5092
  var n = {};
5096
5093
  for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
5097
5094
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
@@ -5105,46 +5102,46 @@ const se = {
5105
5102
  AUTHENTICATED: "authenticated",
5106
5103
  CLOSED: "closed",
5107
5104
  ERRORED: "errored"
5108
- }, Gu = 3e4, Qu = 3e4, Hu = 200, Yu = {
5105
+ }, Bu = 3e4, Gu = 3e4, Qu = 200, Hu = {
5109
5106
  apiURI: "https://api.instantdb.com",
5110
5107
  websocketURI: "wss://api.instantdb.com/runtime/session"
5111
- }, Mt = "_instant_oauth_redirect", De = "currentUser";
5112
- function Ju({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
5108
+ }, It = "_instant_oauth_redirect", De = "currentUser";
5109
+ function Yu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
5113
5110
  if (!i)
5114
- return new yr(`${r}?app_id=${e}`);
5111
+ return new pr(`${r}?app_id=${e}`);
5115
5112
  switch (t) {
5116
5113
  case "ws":
5117
- return new yr(`${r}?app_id=${e}`);
5114
+ return new pr(`${r}?app_id=${e}`);
5118
5115
  case "sse":
5119
- return new Lu(i, `${n}/runtime/sse?app_id=${e}`);
5116
+ return new Uu(i, `${n}/runtime/sse?app_id=${e}`);
5120
5117
  default:
5121
5118
  throw new Error("Unknown transport type " + t);
5122
5119
  }
5123
5120
  }
5124
- function Zu() {
5121
+ function Ju() {
5125
5122
  return typeof window < "u" || typeof chrome < "u";
5126
5123
  }
5127
- const Tr = {
5124
+ const gr = {
5128
5125
  "set-presence": !0,
5129
5126
  "set-presence-ok": !0,
5130
5127
  "refresh-presence": !0,
5131
5128
  "patch-presence": !0
5132
5129
  };
5133
- function Xu(t, e) {
5130
+ function Zu(t, e) {
5134
5131
  var n;
5135
5132
  const r = typeof t == "string" ? JSON.parse(t) : t;
5136
5133
  if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
5137
5134
  const i = r.result.store;
5138
- r.result.store = Fr(Object.assign(Object.assign({}, i), { useDateObjects: e }));
5135
+ r.result.store = Lr(Object.assign(Object.assign({}, i), { useDateObjects: e }));
5139
5136
  }
5140
5137
  return r;
5141
5138
  }
5142
- function ea(t, e) {
5139
+ function Xu(t, e) {
5143
5140
  var n;
5144
5141
  const r = Object.assign({}, e);
5145
- return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: Lr(e.result.store) })), r;
5142
+ return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: Ur(e.result.store) })), r;
5146
5143
  }
5147
- function ta(t, e) {
5144
+ function ea(t, e) {
5148
5145
  switch (t) {
5149
5146
  case "pendingMutations":
5150
5147
  return new Map(typeof e == "string" ? JSON.parse(e) : e);
@@ -5152,7 +5149,7 @@ function ta(t, e) {
5152
5149
  return e;
5153
5150
  }
5154
5151
  }
5155
- function na(t, e) {
5152
+ function ta(t, e) {
5156
5153
  switch (t) {
5157
5154
  case "pendingMutations":
5158
5155
  return [...e.entries()];
@@ -5160,18 +5157,18 @@ function na(t, e) {
5160
5157
  return e;
5161
5158
  }
5162
5159
  }
5163
- function ra(t, e, n) {
5160
+ function na(t, e, n) {
5164
5161
  const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
5165
5162
  return r && !i && n && (n.result = r), n || e;
5166
5163
  }
5167
- function mr(t) {
5164
+ function Tr(t) {
5168
5165
  return [...t].sort((e, n) => {
5169
5166
  const [r, i] = e, [s, o] = n, u = i.order || 0, a = o.order || 0;
5170
5167
  return u == a ? r < s ? -1 : r > s ? 1 : 0 : u - a;
5171
5168
  });
5172
5169
  }
5173
- class ia {
5174
- constructor(e, n = ni, r = ri, i, s) {
5170
+ class ra {
5171
+ constructor(e, n = ti, r = ni, i, s) {
5175
5172
  var o, u, a;
5176
5173
  if (this._isOnline = !0, this._isShutdown = !1, this.status = se.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (d, c, f) => {
5177
5174
  var l, p;
@@ -5203,9 +5200,9 @@ class ia {
5203
5200
  }, this.notifyQueryError = (d, c) => {
5204
5201
  (this.queryCbs[d] || []).forEach((l) => l.cb({ error: c }));
5205
5202
  }, this.pushTx = (d) => {
5206
- this.config.disableValidation || Uu(d, this.config.schema);
5203
+ this.config.disableValidation || Du(d, this.config.schema);
5207
5204
  try {
5208
- const c = su({
5205
+ const c = iu({
5209
5206
  attrs: this.optimisticAttrs(),
5210
5207
  schema: this.config.schema,
5211
5208
  stores: Object.values(this.querySubs.currentValue).map((f) => {
@@ -5229,7 +5226,7 @@ class ia {
5229
5226
  this._updatePendingMutations((g) => {
5230
5227
  g.set(f, y);
5231
5228
  });
5232
- const b = new or();
5229
+ const b = new sr();
5233
5230
  return this.mutationDeferredStore.set(f, b), this._sendMutation(f, y), this.notifyAll(), b.promise;
5234
5231
  }, this._transportOnOpen = (d) => {
5235
5232
  const c = d.target;
@@ -5294,7 +5291,7 @@ class ia {
5294
5291
  return;
5295
5292
  }
5296
5293
  this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
5297
- }, this._EventSource = s, this.config = Object.assign(Object.assign({}, Yu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Qu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Hu, this._log = ku(e.verbose || pn || ii, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": ui }), this.config.schema && (this._linkIndex = ar(this.config.schema)), !!Zu()) {
5294
+ }, this._EventSource = s, this.config = Object.assign(Object.assign({}, Hu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Gu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Qu, this._log = ju(e.verbose || hn || ri, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": oi }), this.config.schema && (this._linkIndex = ur(this.config.schema)), !!Ju()) {
5298
5295
  if (!e.appId)
5299
5296
  throw new Error("Instant must be initialized with an appId.");
5300
5297
  if (!Ee(e.appId))
@@ -5309,7 +5306,7 @@ class ia {
5309
5306
  } catch (f) {
5310
5307
  this._log.error("[error] handle broadcast channel", f);
5311
5308
  }
5312
- }))), this._initStorage(n), this._syncTable = new Wu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
5309
+ }))), this._initStorage(n), this._syncTable = new Vu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
5313
5310
  useDateObjects: this.config.useDateObjects
5314
5311
  }, this._log, (d) => at(this.attrs, d, this.config.enableCardinalityInference, this._linkIndex, this.config.useDateObjects)), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
5315
5312
  this._isOnline = d, this._startSocket(), r.listen((c) => {
@@ -5319,7 +5316,7 @@ class ia {
5319
5316
  }
5320
5317
  }
5321
5318
  updateSchema(e) {
5322
- this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ? ar(this.config.schema) : null;
5319
+ this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ? ur(this.config.schema) : null;
5323
5320
  }
5324
5321
  _reactorStats() {
5325
5322
  return {
@@ -5332,11 +5329,11 @@ class ia {
5332
5329
  this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
5333
5330
  }
5334
5331
  _initStorage(e) {
5335
- this.querySubs = new Jt({
5332
+ this.querySubs = new Yt({
5336
5333
  persister: new e(this.config.appId, "querySubs"),
5337
- merge: ra,
5338
- serialize: ea,
5339
- parse: (n, r) => Xu(r, this.config.useDateObjects),
5334
+ merge: na,
5335
+ serialize: Xu,
5336
+ parse: (n, r) => Zu(r, this.config.useDateObjects),
5340
5337
  // objectSize
5341
5338
  objectSize: (n) => {
5342
5339
  var r, i, s, o;
@@ -5352,11 +5349,11 @@ class ia {
5352
5349
  maxSize: 1e6
5353
5350
  // 1 million triples
5354
5351
  }
5355
- }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Jt({
5352
+ }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Yt({
5356
5353
  persister: new e(this.config.appId, "kv"),
5357
5354
  merge: this._onMergeKv,
5358
- serialize: na,
5359
- parse: ta,
5355
+ serialize: ta,
5356
+ parse: ea,
5360
5357
  objectSize: () => 0,
5361
5358
  logger: this._log,
5362
5359
  saveThrottleMs: 100,
@@ -5387,7 +5384,7 @@ class ia {
5387
5384
  if (s)
5388
5385
  i.resolve({ status: e, eventId: n });
5389
5386
  else if (r != null && r.type) {
5390
- const { status: o } = r, u = Bu(r, ["status"]);
5387
+ const { status: o } = r, u = Wu(r, ["status"]);
5391
5388
  i.reject(new bt({
5392
5389
  // @ts-expect-error body.type is not constant typed
5393
5390
  body: u,
@@ -5411,7 +5408,7 @@ class ia {
5411
5408
  _handleReceive(e, n) {
5412
5409
  var r, i, s, o, u, a;
5413
5410
  const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
5414
- switch (Tr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
5411
+ switch (gr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
5415
5412
  case "init-ok": {
5416
5413
  this._setStatus(se.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
5417
5414
  for (const l of Object.keys(this._rooms)) {
@@ -5428,7 +5425,7 @@ class ia {
5428
5425
  const { q: l, result: p } = n, y = N(l);
5429
5426
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
5430
5427
  break;
5431
- const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], g = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, m = ur(p), T = at(this.attrs, m, d, this._linkIndex, this.config.useDateObjects);
5428
+ const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], g = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, m = or(p), T = at(this.attrs, m, d, this._linkIndex, this.config.useDateObjects);
5432
5429
  this.querySubs.updateInPlace((v) => {
5433
5430
  if (!v[y]) {
5434
5431
  this._log.info("Missing value in querySubs", { hash: y, q: l });
@@ -5466,9 +5463,9 @@ class ia {
5466
5463
  b !== this._pendingMutations() && this.kv.updateInPlace((T) => {
5467
5464
  T.pendingMutations = b;
5468
5465
  });
5469
- const g = mr(b.entries()), m = l.map((T) => {
5466
+ const g = Tr(b.entries()), m = l.map((T) => {
5470
5467
  var v, k, S, I;
5471
- const R = T["instaql-query"], q = T["instaql-result"], Ie = N(R), Qe = ur(q), _t = at(this.attrs, Qe, d, this._linkIndex, this.config.useDateObjects), gt = this._applyOptimisticUpdates(_t, g, y), He = (k = (v = q == null ? void 0 : q[0]) === null || v === void 0 ? void 0 : v.data) === null || k === void 0 ? void 0 : k["page-info"], ne = (I = (S = q == null ? void 0 : q[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
5468
+ const R = T["instaql-query"], q = T["instaql-result"], Ie = N(R), Qe = or(q), _t = at(this.attrs, Qe, d, this._linkIndex, this.config.useDateObjects), gt = this._applyOptimisticUpdates(_t, g, y), He = (k = (v = q == null ? void 0 : q[0]) === null || v === void 0 ? void 0 : v.data) === null || k === void 0 ? void 0 : k["page-info"], ne = (I = (S = q == null ? void 0 : q[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
5472
5469
  return { q: R, hash: Ie, store: gt, pageInfo: He, aggregate: ne };
5473
5470
  });
5474
5471
  m.forEach(({ hash: T, q: v, store: k, pageInfo: S, aggregate: I }) => {
@@ -5631,7 +5628,7 @@ class ia {
5631
5628
  */
5632
5629
  subscribeQuery(e, n, r) {
5633
5630
  var i;
5634
- this.config.disableValidation || dr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
5631
+ this.config.disableValidation || cr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
5635
5632
  const s = N(e), o = this.getPreviousResult(e);
5636
5633
  return o && n(o), this.queryCbs[s] = (i = this.queryCbs[s]) !== null && i !== void 0 ? i : [], this.queryCbs[s].push({ q: e, cb: n }), this._startQuerySub(e, s), () => {
5637
5634
  this._unsubQuery(e, s, n);
@@ -5639,14 +5636,14 @@ class ia {
5639
5636
  }
5640
5637
  queryOnce(e, n) {
5641
5638
  var r;
5642
- this.config.disableValidation || dr(e, this.config.schema), n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
5643
- const i = new or();
5639
+ this.config.disableValidation || cr(e, this.config.schema), n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
5640
+ const i = new sr();
5644
5641
  if (!this._isOnline)
5645
5642
  return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
5646
5643
  if (!this.querySubs)
5647
5644
  return i.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), i.promise;
5648
5645
  const s = N(e), o = this._startQuerySub(e, s);
5649
- return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), Gu), i.promise;
5646
+ return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), Bu), i.promise;
5650
5647
  }
5651
5648
  _completeQueryOnce(e, n, r) {
5652
5649
  this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
@@ -5707,7 +5704,7 @@ class ia {
5707
5704
  u = !0;
5708
5705
  continue;
5709
5706
  }
5710
- const b = u ? xo(o, p) : p;
5707
+ const b = u ? $o(o, p) : p;
5711
5708
  l.push(b);
5712
5709
  }
5713
5710
  return u ? l : c;
@@ -5717,7 +5714,7 @@ class ia {
5717
5714
  return u ? d : n;
5718
5715
  }
5719
5716
  _rewriteMutationsSorted(e, n) {
5720
- return mr(this._rewriteMutations(e, n).entries());
5717
+ return Tr(this._rewriteMutations(e, n).entries());
5721
5718
  }
5722
5719
  // ---------------------------
5723
5720
  // Transact
@@ -5751,11 +5748,11 @@ class ia {
5751
5748
  if (d && r === d.querySubVersion && s === d.pendingMutationsVersion)
5752
5749
  return d;
5753
5750
  const { store: c, pageInfo: f, aggregate: l, processedTxId: p } = a, y = this._rewriteMutationsSorted(c.attrs, o), b = this._applyOptimisticUpdates(c, y, p);
5754
- return { data: Zr({ store: b, pageInfo: f, aggregate: l }, u), querySubVersion: r, pendingMutationsVersion: s };
5751
+ return { data: Jr({ store: b, pageInfo: f, aggregate: l }, u), querySubVersion: r, pendingMutationsVersion: s };
5755
5752
  }
5756
5753
  _applyOptimisticUpdates(e, n, r) {
5757
5754
  for (const [i, s] of n)
5758
- (!s["tx-id"] || r && s["tx-id"] > r) && (e = xs(e, s["tx-steps"]));
5755
+ (!s["tx-id"] || r && s["tx-id"] > r) && (e = $s(e, s["tx-steps"]));
5759
5756
  return e;
5760
5757
  }
5761
5758
  /** Re-compute all subscriptions */
@@ -5843,7 +5840,7 @@ class ia {
5843
5840
  }
5844
5841
  _trySend(e, n, r) {
5845
5842
  if (this._transport.isOpen()) {
5846
- switch (Tr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
5843
+ switch (gr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
5847
5844
  case "transact": {
5848
5845
  this._inFlightMutationEventIds.add(e);
5849
5846
  break;
@@ -5864,7 +5861,7 @@ class ia {
5864
5861
  return;
5865
5862
  }
5866
5863
  const e = this._transport;
5867
- this._transport = Ju({
5864
+ this._transport = Yu({
5868
5865
  transportType: this._transportType,
5869
5866
  appId: this.config.appId,
5870
5867
  apiURI: this.config.apiURI,
@@ -5900,9 +5897,9 @@ class ia {
5900
5897
  if (typeof URL > "u")
5901
5898
  return;
5902
5899
  const e = new URL(window.location.href);
5903
- if (e.searchParams.get(Mt)) {
5900
+ if (e.searchParams.get(It)) {
5904
5901
  const n = e.toString();
5905
- e.searchParams.delete(Mt), e.searchParams.delete("code"), e.searchParams.delete("error");
5902
+ e.searchParams.delete(It), e.searchParams.delete("code"), e.searchParams.delete("error");
5906
5903
  const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
5907
5904
  if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
5908
5905
  typeof navigation == "object" && // @ts-ignore (waiting for ts support)
@@ -5927,7 +5924,7 @@ class ia {
5927
5924
  if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
5928
5925
  return null;
5929
5926
  const s = new URLSearchParams(window.location.search);
5930
- if (!s.get(Mt))
5927
+ if (!s.get(It))
5931
5928
  return null;
5932
5929
  const o = s.get("error");
5933
5930
  if (o)
@@ -5937,7 +5934,7 @@ class ia {
5937
5934
  return null;
5938
5935
  this._replaceUrlAfterOAuth();
5939
5936
  try {
5940
- const a = yield this._getCurrentUser(), d = (a == null ? void 0 : a.type) === "guest", { user: c } = yield ir({
5937
+ const a = yield this._getCurrentUser(), d = (a == null ? void 0 : a.type) === "guest", { user: c } = yield rr({
5941
5938
  apiURI: this.config.apiURI,
5942
5939
  appId: this.config.appId,
5943
5940
  code: u,
@@ -6067,7 +6064,7 @@ class ia {
6067
6064
  }), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
6068
6065
  }
6069
6066
  sendMagicCode({ email: e }) {
6070
- return yu({
6067
+ return pu({
6071
6068
  apiURI: this.config.apiURI,
6072
6069
  appId: this.config.appId,
6073
6070
  email: e
@@ -6076,7 +6073,7 @@ class ia {
6076
6073
  signInWithMagicCode(e) {
6077
6074
  return U(this, arguments, void 0, function* ({ email: n, code: r }) {
6078
6075
  var i;
6079
- const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield bu({
6076
+ const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield yu({
6080
6077
  apiURI: this.config.apiURI,
6081
6078
  appId: this.config.appId,
6082
6079
  email: n,
@@ -6088,7 +6085,7 @@ class ia {
6088
6085
  }
6089
6086
  signInWithCustomToken(e) {
6090
6087
  return U(this, void 0, void 0, function* () {
6091
- const n = yield _u({
6088
+ const n = yield bu({
6092
6089
  apiURI: this.config.apiURI,
6093
6090
  appId: this.config.appId,
6094
6091
  refreshToken: e
@@ -6098,7 +6095,7 @@ class ia {
6098
6095
  }
6099
6096
  signInAsGuest() {
6100
6097
  return U(this, void 0, void 0, function* () {
6101
- const e = yield gu({
6098
+ const e = yield _u({
6102
6099
  apiURI: this.config.apiURI,
6103
6100
  appId: this.config.appId
6104
6101
  });
@@ -6114,7 +6111,7 @@ class ia {
6114
6111
  this._log.info("[auth-invalidate] skipped invalidateToken");
6115
6112
  return;
6116
6113
  }
6117
- mu({
6114
+ Tu({
6118
6115
  apiURI: this.config.apiURI,
6119
6116
  appId: this.config.appId,
6120
6117
  refreshToken: i
@@ -6149,7 +6146,7 @@ class ia {
6149
6146
  exchangeCodeForToken(e) {
6150
6147
  return U(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
6151
6148
  var i;
6152
- const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield ir({
6149
+ const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield rr({
6153
6150
  apiURI: this.config.apiURI,
6154
6151
  appId: this.config.appId,
6155
6152
  code: n,
@@ -6172,7 +6169,7 @@ class ia {
6172
6169
  signInWithIdToken(e) {
6173
6170
  return U(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
6174
6171
  var s;
6175
- const o = yield this.getCurrentUser(), u = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, a = yield Tu({
6172
+ const o = yield this.getCurrentUser(), u = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, a = yield gu({
6176
6173
  apiURI: this.config.apiURI,
6177
6174
  appId: this.config.appId,
6178
6175
  idToken: n,
@@ -6213,7 +6210,7 @@ class ia {
6213
6210
  // TODO: look into typing again
6214
6211
  getPresence(e, n, r = {}) {
6215
6212
  const i = this._rooms[n], s = this._presence[n];
6216
- return !i || !s || !s.result ? null : Object.assign(Object.assign({}, Au(s.result, r, this._sessionId)), { isLoading: !i.isConnected, error: i.error });
6213
+ return !i || !s || !s.result ? null : Object.assign(Object.assign({}, Eu(s.result, r, this._sessionId)), { isLoading: !i.isConnected, error: i.error });
6217
6214
  }
6218
6215
  // TODO: look into typing again
6219
6216
  publishPresence(e, n, r) {
@@ -6263,7 +6260,7 @@ class ia {
6263
6260
  }
6264
6261
  _notifyPresenceSub(e, n) {
6265
6262
  const r = this.getPresence("", e, n);
6266
- r && (n.prev && !ju(r, n.prev) || (n.prev = r, n.cb(r)));
6263
+ r && (n.prev && !Au(r, n.prev) || (n.prev = r, n.cb(r)));
6267
6264
  }
6268
6265
  _patchPresencePeers(e, n) {
6269
6266
  var r, i, s;
@@ -6274,13 +6271,13 @@ class ia {
6274
6271
  for (let [c, f, l] of n)
6275
6272
  switch (f) {
6276
6273
  case "+":
6277
- rs(d, c, l);
6274
+ ns(d, c, l);
6278
6275
  break;
6279
6276
  case "r":
6280
- Wn(d, c, l);
6277
+ Vn(d, c, l);
6281
6278
  break;
6282
6279
  case "-":
6283
- xr(d, c);
6280
+ $r(d, c);
6284
6281
  break;
6285
6282
  }
6286
6283
  delete d[this._sessionId];
@@ -6292,7 +6289,7 @@ class ia {
6292
6289
  delete r[this._sessionId];
6293
6290
  const i = Object.fromEntries(Object.entries(r).map(([s, o]) => [s, o.data]));
6294
6291
  this._presence = ft(this._presence, (s) => {
6295
- Wn(s, [e, "result", "peers"], i);
6292
+ Vn(s, [e, "result", "peers"], i);
6296
6293
  });
6297
6294
  }
6298
6295
  // --------
@@ -6337,14 +6334,14 @@ class ia {
6337
6334
  return U(this, void 0, void 0, function* () {
6338
6335
  var i;
6339
6336
  const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
6340
- return wu(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
6337
+ return mu(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
6341
6338
  });
6342
6339
  }
6343
6340
  deleteFile(e) {
6344
6341
  return U(this, void 0, void 0, function* () {
6345
6342
  var n;
6346
6343
  const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
6347
- return yield vu({
6344
+ return yield wu({
6348
6345
  apiURI: this.config.apiURI,
6349
6346
  appId: this.config.appId,
6350
6347
  path: e,
@@ -6357,20 +6354,20 @@ class ia {
6357
6354
  upload(e, n) {
6358
6355
  return U(this, void 0, void 0, function* () {
6359
6356
  var r;
6360
- const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name, u = yield Su({
6357
+ const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name, u = yield vu({
6361
6358
  apiURI: this.config.apiURI,
6362
6359
  appId: this.config.appId,
6363
6360
  fileName: o,
6364
6361
  refreshToken: s
6365
6362
  });
6366
- return yield Ou(u, n);
6363
+ return yield Su(u, n);
6367
6364
  });
6368
6365
  }
6369
6366
  getDownloadUrl(e) {
6370
6367
  return U(this, void 0, void 0, function* () {
6371
6368
  var n;
6372
6369
  const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
6373
- return yield Eu({
6370
+ return yield Ou({
6374
6371
  apiURI: this.config.apiURI,
6375
6372
  appId: this.config.appId,
6376
6373
  path: e,
@@ -6380,9 +6377,9 @@ class ia {
6380
6377
  }
6381
6378
  }
6382
6379
  let it;
6383
- function sa(t, e) {
6380
+ function ia(t, e) {
6384
6381
  it == null || it.dispose();
6385
- const n = fa(e), r = aa(e, u), i = ua(oa(t));
6382
+ const n = da(e), r = ua(e, u), i = oa(sa(t));
6386
6383
  function s(c) {
6387
6384
  var f;
6388
6385
  c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && u();
@@ -6404,10 +6401,10 @@ function sa(t, e) {
6404
6401
  }
6405
6402
  return d();
6406
6403
  }
6407
- function oa(t) {
6408
- return `${pn || si ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
6404
+ function sa(t) {
6405
+ return `${hn || ii ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
6409
6406
  }
6410
- function ua(t) {
6407
+ function oa(t) {
6411
6408
  const e = document.createElement("iframe");
6412
6409
  return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
6413
6410
  width: "100%",
@@ -6416,7 +6413,7 @@ function ua(t) {
6416
6413
  border: "none"
6417
6414
  }), { element: e };
6418
6415
  }
6419
- function aa(t, e) {
6416
+ function ua(t, e) {
6420
6417
  const n = `
6421
6418
  <svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
6422
6419
  <rect width="512" height="512" fill="black"/>
@@ -6426,7 +6423,7 @@ function aa(t, e) {
6426
6423
  return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
6427
6424
  // pos
6428
6425
  position: "fixed"
6429
- }, ca(t.position)), {
6426
+ }, aa(t.position)), {
6430
6427
  height: "32px",
6431
6428
  width: "32px",
6432
6429
  // layout
@@ -6441,7 +6438,7 @@ function aa(t, e) {
6441
6438
  cursor: "pointer"
6442
6439
  })), r.addEventListener("click", e), { element: r };
6443
6440
  }
6444
- function ca(t) {
6441
+ function aa(t) {
6445
6442
  switch (t) {
6446
6443
  case "bottom-left":
6447
6444
  return { bottom: "24px", left: "24px" };
@@ -6453,7 +6450,7 @@ function ca(t) {
6453
6450
  return { top: "24px", left: "24px" };
6454
6451
  }
6455
6452
  }
6456
- function da(t) {
6453
+ function ca(t) {
6457
6454
  switch (t) {
6458
6455
  case "bottom-left":
6459
6456
  return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
@@ -6465,47 +6462,47 @@ function da(t) {
6465
6462
  return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
6466
6463
  }
6467
6464
  }
6468
- function fa(t) {
6465
+ function da(t) {
6469
6466
  const e = document.createElement("div");
6470
- Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, da(t.position)), { display: "block", borderRadius: "4px", border: "1px #ccc solid", boxShadow: "0px 0px 8px #00000044", backgroundColor: "#eee", zIndex: "999990" })), e.style.display = "none", e.className = "instant-devtool-container";
6467
+ Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, ca(t.position)), { display: "block", borderRadius: "4px", border: "1px #ccc solid", boxShadow: "0px 0px 8px #00000044", backgroundColor: "#eee", zIndex: "999990" })), e.style.display = "none", e.className = "instant-devtool-container";
6471
6468
  function n() {
6472
6469
  return e.style.display !== "none";
6473
6470
  }
6474
6471
  return { element: e, isVisible: n };
6475
6472
  }
6476
- const la = {
6473
+ const fa = {
6477
6474
  apiURI: "https://api.instantdb.com",
6478
6475
  websocketURI: "wss://api.instantdb.com/runtime/session"
6479
6476
  };
6480
- function ha() {
6477
+ function la() {
6481
6478
  var t;
6482
6479
  return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
6483
6480
  }
6484
- function pa() {
6481
+ function ha() {
6485
6482
  var t;
6486
6483
  return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
6487
6484
  }
6488
- function Zt(t) {
6485
+ function Jt(t) {
6489
6486
  const e = t.__adminToken;
6490
6487
  return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
6491
6488
  }
6492
- const Xt = pa(), wr = ha();
6493
- class ya {
6489
+ const Zt = ha(), mr = la();
6490
+ class pa {
6494
6491
  constructor(e) {
6495
6492
  this.db = e, this.sendMagicCode = (n) => this.db.sendMagicCode(n), this.signInWithMagicCode = (n) => this.db.signInWithMagicCode(n), this.signInWithToken = (n) => this.db.signInWithCustomToken(n), this.signInAsGuest = () => this.db.signInAsGuest(), this.createAuthorizationURL = (n) => this.db.createAuthorizationURL(n), this.signInWithIdToken = (n) => this.db.signInWithIdToken(n), this.exchangeOAuthCode = (n) => this.db.exchangeCodeForToken(n), this.issuerURI = () => this.db.issuerURI(), this.signOut = (n = { invalidateToken: !0 }) => this.db.signOut(n);
6496
6493
  }
6497
6494
  }
6498
- class ba {
6495
+ class ya {
6499
6496
  constructor(e) {
6500
6497
  this.db = e, this.uploadFile = (n, r, i = {}) => this.db.uploadFile(n, r, i), this.delete = (n) => this.db.deleteFile(n), this.upload = (n, r) => this.db.upload(n, r), this.put = this.upload, this.getDownloadUrl = (n) => this.db.getDownloadUrl(n);
6501
6498
  }
6502
6499
  }
6503
- function _a(t) {
6500
+ function ba(t) {
6504
6501
  return JSON.parse(JSON.stringify(t));
6505
6502
  }
6506
- class ga {
6503
+ class _a {
6507
6504
  constructor(e) {
6508
- this.tx = hn(), this._reactor = e, this.auth = new ya(this._reactor), this.storage = new ba(this._reactor);
6505
+ this.tx = ln(), this._reactor = e, this.auth = new pa(this._reactor), this.storage = new ya(this._reactor);
6509
6506
  }
6510
6507
  /**
6511
6508
  * Use this to write data! You can create, update, delete, and link objects
@@ -6646,7 +6643,7 @@ class ga {
6646
6643
  };
6647
6644
  }
6648
6645
  shutdown() {
6649
- delete Xt[Zt(this._reactor.config)], this._reactor.shutdown();
6646
+ delete Zt[Jt(this._reactor.config)], this._reactor.shutdown();
6650
6647
  }
6651
6648
  /**
6652
6649
  * Use this for one-off queries.
@@ -6679,39 +6676,39 @@ class ga {
6679
6676
  return this._reactor.subscribeTable(e, n);
6680
6677
  }
6681
6678
  }
6682
- function vr(t) {
6679
+ function wr(t) {
6683
6680
  if (!t)
6684
6681
  return "0";
6685
- const e = wr.get(t);
6682
+ const e = mr.get(t);
6686
6683
  if (e)
6687
6684
  return e;
6688
6685
  const n = N(t);
6689
- return wr.set(t, n), n;
6686
+ return mr.set(t, n), n;
6690
6687
  }
6691
- function Ta(t, e) {
6692
- return vr(t._reactor.config.schema) !== vr(e);
6688
+ function ga(t, e) {
6689
+ return wr(t._reactor.config.schema) !== wr(e);
6693
6690
  }
6694
- function ma(t, e, n, r, i) {
6691
+ function Ta(t, e, n, r, i) {
6695
6692
  var s;
6696
- const o = Object.assign(Object.assign({}, t), { useDateObjects: (s = t.useDateObjects) !== null && s !== void 0 ? s : !1 }), u = Xt[Zt(o)];
6693
+ const o = Object.assign(Object.assign({}, t), { useDateObjects: (s = t.useDateObjects) !== null && s !== void 0 ? s : !1 }), u = Zt[Jt(o)];
6697
6694
  if (u)
6698
- return Ta(u, o.schema) && u._reactor.updateSchema(o.schema), u;
6699
- const a = new ia(Object.assign(Object.assign(Object.assign({}, la), o), { cardinalityInference: !!o.schema }), e || ni, n || ri, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": ui }), i), d = new ga(a);
6700
- return Xt[Zt(o)] = d, wa(o.appId, o.devtool), d;
6695
+ return ga(u, o.schema) && u._reactor.updateSchema(o.schema), u;
6696
+ const a = new ra(Object.assign(Object.assign(Object.assign({}, fa), o), { cardinalityInference: !!o.schema }), e || ti, n || ni, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": oi }), i), d = new _a(a);
6697
+ return Zt[Jt(o)] = d, ma(o.appId, o.devtool), d;
6701
6698
  }
6702
- function wa(t, e) {
6699
+ function ma(t, e) {
6703
6700
  if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
6704
6701
  return;
6705
6702
  const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
6706
- n.allowedHosts.includes(window.location.hostname) && sa(t, n);
6703
+ n.allowedHosts.includes(window.location.hostname) && ia(t, n);
6707
6704
  }
6708
- const va = {
6705
+ const wa = {
6709
6706
  isLoading: !0,
6710
6707
  data: void 0,
6711
6708
  pageInfo: void 0,
6712
6709
  error: void 0
6713
6710
  };
6714
- function Sr(t) {
6711
+ function vr(t) {
6715
6712
  return {
6716
6713
  isLoading: !t,
6717
6714
  data: void 0,
@@ -6720,12 +6717,12 @@ function Sr(t) {
6720
6717
  ...t || {}
6721
6718
  };
6722
6719
  }
6723
- function Sa(t, e, n) {
6720
+ function va(t, e, n) {
6724
6721
  e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
6725
- const r = e ? _a(e) : null, i = N(r), s = ze(
6726
- Sr(t._reactor.getPreviousResult(r))
6722
+ const r = e ? ba(e) : null, i = N(r), s = ze(
6723
+ vr(t._reactor.getPreviousResult(r))
6727
6724
  ), o = de(
6728
- (a) => (s.current = Sr(
6725
+ (a) => (s.current = vr(
6729
6726
  t._reactor.getPreviousResult(r)
6730
6727
  ), r ? t.subscribeQuery(r, (c) => {
6731
6728
  s.current = {
@@ -6743,13 +6740,13 @@ function Sa(t, e, n) {
6743
6740
  // Build a new subscribe function if the query changes
6744
6741
  [i]
6745
6742
  );
6746
- return { state: Rt(
6743
+ return { state: Mt(
6747
6744
  o,
6748
6745
  () => s.current,
6749
- () => va
6746
+ () => wa
6750
6747
  ), query: r };
6751
6748
  }
6752
- function Oa() {
6749
+ function Sa() {
6753
6750
  const t = ze(null);
6754
6751
  ge(() => {
6755
6752
  n();
@@ -6762,8 +6759,8 @@ function Oa() {
6762
6759
  }
6763
6760
  return { set: e, clear: n };
6764
6761
  }
6765
- const Ea = 1e3;
6766
- function Aa(t, e, n) {
6762
+ const Oa = 1e3;
6763
+ function Ea(t, e, n) {
6767
6764
  const r = ze(n);
6768
6765
  r.current = n, ge(() => t.core._reactor.subscribeTopic(
6769
6766
  t.id,
@@ -6773,7 +6770,7 @@ function Aa(t, e, n) {
6773
6770
  }
6774
6771
  ), [t.id, e]);
6775
6772
  }
6776
- function ja(t, e) {
6773
+ function Aa(t, e) {
6777
6774
  return ge(() => t.core._reactor.joinRoom(t.id), [t.id]), de(
6778
6775
  (r) => {
6779
6776
  t.core._reactor.publishTopic({
@@ -6786,9 +6783,9 @@ function ja(t, e) {
6786
6783
  [t.id, e]
6787
6784
  );
6788
6785
  }
6789
- function ka(t, e = {}) {
6786
+ function ja(t, e = {}) {
6790
6787
  var o, u;
6791
- const [n, r] = Er(() => t.core._reactor.getPresence(t.type, t.id, e) ?? {
6788
+ const [n, r] = Or(() => t.core._reactor.getPresence(t.type, t.id, e) ?? {
6792
6789
  peers: {},
6793
6790
  isLoading: !0
6794
6791
  });
@@ -6806,18 +6803,18 @@ function ka(t, e = {}) {
6806
6803
  },
6807
6804
  [t.type, t.id]
6808
6805
  );
6809
- return $t(() => ({
6806
+ return Rt(() => ({
6810
6807
  ...n,
6811
6808
  publishPresence: i
6812
6809
  }), [n, i]);
6813
6810
  }
6814
- function Ca(t, e, n) {
6811
+ function ka(t, e, n) {
6815
6812
  ge(() => t.core._reactor.joinRoom(t.id, e), [t.id]), ge(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
6816
6813
  }
6817
- function Pa(t, e, n = {}) {
6818
- const r = Oa(), i = ye.usePresence(t, {
6814
+ function Ca(t, e, n = {}) {
6815
+ const r = Sa(), i = ye.usePresence(t, {
6819
6816
  keys: [e]
6820
- }), s = $t(() => {
6817
+ }), s = Rt(() => {
6821
6818
  const c = t._core._reactor.getPresence(
6822
6819
  t.type,
6823
6820
  t.id
@@ -6829,7 +6826,7 @@ function Pa(t, e, n = {}) {
6829
6826
  (c) => {
6830
6827
  t.core._reactor.publishPresence(t.type, t.id, {
6831
6828
  [e]: c
6832
- }), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? Ea, () => {
6829
+ }), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? Oa, () => {
6833
6830
  t.core._reactor.publishPresence(t.type, t.id, {
6834
6831
  [e]: null
6835
6832
  });
@@ -6844,7 +6841,7 @@ function Pa(t, e, n = {}) {
6844
6841
  [n.stopOnEnter, o]
6845
6842
  ), a = de(() => {
6846
6843
  o(!1);
6847
- }, [o]), d = $t(() => ({ onKeyDown: u, onBlur: a }), [u, a]);
6844
+ }, [o]), d = Rt(() => ({ onKeyDown: u, onBlur: a }), [u, a]);
6848
6845
  return {
6849
6846
  active: s,
6850
6847
  setActive: o,
@@ -6852,44 +6849,44 @@ function Pa(t, e, n = {}) {
6852
6849
  };
6853
6850
  }
6854
6851
  const ye = {
6855
- useTopicEffect: Aa,
6856
- usePublishTopic: ja,
6857
- usePresence: ka,
6858
- useSyncPresence: Ca,
6859
- useTypingIndicator: Pa
6852
+ useTopicEffect: Ea,
6853
+ usePublishTopic: Aa,
6854
+ usePresence: ja,
6855
+ useSyncPresence: ka,
6856
+ useTypingIndicator: Ca
6860
6857
  };
6861
- class Ia {
6858
+ class Pa {
6862
6859
  constructor(e, n, r) {
6863
6860
  this.useTopicEffect = (i, s) => {
6864
6861
  ye.useTopicEffect(this, i, s);
6865
6862
  }, this.usePublishTopic = (i) => ye.usePublishTopic(this, i), this.usePresence = (i = {}) => ye.usePresence(this, i), this.useSyncPresence = (i, s) => ye.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => ye.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
6866
6863
  }
6867
6864
  }
6868
- const Ma = {
6865
+ const Ia = {
6869
6866
  isLoading: !0,
6870
6867
  user: void 0,
6871
6868
  error: void 0
6872
6869
  };
6873
- class $a {
6870
+ class Ra {
6874
6871
  constructor(e, n) {
6875
- this.tx = hn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
6876
- const [i, s] = Er(null);
6872
+ this.tx = ln(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
6873
+ const [i, s] = Or(null);
6877
6874
  return ge(() => {
6878
6875
  (async () => {
6879
6876
  const u = await this.getLocalId(r);
6880
6877
  s(u);
6881
6878
  })();
6882
6879
  }, [r]), i;
6883
- }, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => Sa(this.core, r, i).state, this.useAuth = () => {
6880
+ }, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => va(this.core, r, i).state, this.useAuth = () => {
6884
6881
  const r = ze(
6885
6882
  this.core._reactor._currentUserCached
6886
6883
  ), i = de((o) => this.core.subscribeAuth((a) => {
6887
6884
  r.current = { isLoading: !1, ...a }, o();
6888
6885
  }), []);
6889
- return Rt(
6886
+ return Mt(
6890
6887
  i,
6891
6888
  () => r.current,
6892
- () => Ma
6889
+ () => Ia
6893
6890
  );
6894
6891
  }, this.useUser = () => {
6895
6892
  const { user: r } = this.useAuth();
@@ -6904,7 +6901,7 @@ class $a {
6904
6901
  ), i = de((o) => this.core.subscribeConnectionStatus((a) => {
6905
6902
  a !== r.current && (r.current = a, o());
6906
6903
  }), []);
6907
- return Rt(
6904
+ return Mt(
6908
6905
  i,
6909
6906
  () => r.current,
6910
6907
  // For SSR, always return 'connecting' as the initial state
@@ -6916,7 +6913,7 @@ class $a {
6916
6913
  }, this.SignedOut = ({ children: r }) => {
6917
6914
  const i = this.useAuth();
6918
6915
  return i.isLoading || i.error || i.user ? null : /* @__PURE__ */ et.jsx(et.Fragment, { children: r });
6919
- }, this.core = ma(
6916
+ }, this.core = Ta(
6920
6917
  e,
6921
6918
  // @ts-expect-error because TS can't resolve subclass statics
6922
6919
  this.constructor.Storage,
@@ -6940,7 +6937,7 @@ class $a {
6940
6937
  * const { peers } = db.rooms.usePresence(room);
6941
6938
  */
6942
6939
  room(e = "_defaultRoomType", n = "_defaultRoomId") {
6943
- return new Ia(this.core, e, n);
6940
+ return new Pa(this.core, e, n);
6944
6941
  }
6945
6942
  /**
6946
6943
  * One time query for the logged in state. This is useful
@@ -6957,5 +6954,5 @@ class $a {
6957
6954
  }
6958
6955
  }
6959
6956
  export {
6960
- $a as InstantReactAbstractDatabase
6957
+ Ra as InstantReactAbstractDatabase
6961
6958
  };