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

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