@instantdb/react 0.22.84-experimental.drewh-entity-caching.20110692986.1 → 0.22.84-experimental.drewh-explorer-component.20110693133.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,4 +1,4 @@
1
- import di, { useRef as at, useCallback as ge, useSyncExternalStore as nn, useEffect as je, useMemo as rn, useState as fi, createElement as ks } from "react";
1
+ import ci, { useRef as at, useCallback as ge, useSyncExternalStore as tn, useEffect as je, useMemo as nn, useState as di, createElement as js } from "react";
2
2
  function z(t) {
3
3
  if (typeof t == "number")
4
4
  return (Math.abs(t * 2654435761) >>> 0).toString(16);
@@ -41,14 +41,14 @@ const U = {
41
41
  Remove: "remove",
42
42
  Replace: "replace",
43
43
  Add: "add"
44
- }, li = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Cs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), vt = Symbol.iterator, ne = {
44
+ }, fi = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), ks = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), vt = Symbol.iterator, ne = {
45
45
  mutable: "mutable",
46
46
  immutable: "immutable"
47
- }, Rn = {};
47
+ }, Mn = {};
48
48
  function nt(t, e) {
49
49
  return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
50
50
  }
51
- function Tr(t, e) {
51
+ function gr(t, e) {
52
52
  if (e in t) {
53
53
  let n = Reflect.getPrototypeOf(t);
54
54
  for (; n; ) {
@@ -59,10 +59,10 @@ function Tr(t, e) {
59
59
  }
60
60
  }
61
61
  }
62
- function xn(t) {
62
+ function Rn(t) {
63
63
  return Object.getPrototypeOf(t) === Set.prototype;
64
64
  }
65
- function $n(t) {
65
+ function xn(t) {
66
66
  return Object.getPrototypeOf(t) === Map.prototype;
67
67
  }
68
68
  function te(t) {
@@ -73,9 +73,9 @@ function ke(t) {
73
73
  return !!k(t);
74
74
  }
75
75
  function k(t) {
76
- return typeof t != "object" ? null : t == null ? void 0 : t[li];
76
+ return typeof t != "object" ? null : t == null ? void 0 : t[fi];
77
77
  }
78
- function Dn(t) {
78
+ function $n(t) {
79
79
  var e;
80
80
  const n = k(t);
81
81
  return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
@@ -86,7 +86,7 @@ function ae(t, e) {
86
86
  let n;
87
87
  return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((n = e.mark(t, ne)) === ne.immutable || typeof n == "function");
88
88
  }
89
- function hi(t, e = []) {
89
+ function li(t, e = []) {
90
90
  if (Object.hasOwnProperty.call(t, "key")) {
91
91
  const n = t.parent.copy, r = k(be(n, t.key));
92
92
  if (r !== null && (r == null ? void 0 : r.original) !== t.original)
@@ -97,10 +97,10 @@ function hi(t, e = []) {
97
97
  e.push(s);
98
98
  }
99
99
  if (t.parent)
100
- return hi(t.parent, e);
100
+ return li(t.parent, e);
101
101
  e.reverse();
102
102
  try {
103
- Ps(t.copy, e);
103
+ Cs(t.copy, e);
104
104
  } catch {
105
105
  return null;
106
106
  }
@@ -122,7 +122,7 @@ function Ht(t, e) {
122
122
  function ye(t, e) {
123
123
  return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
124
124
  }
125
- function sn(t) {
125
+ function rn(t) {
126
126
  if (t)
127
127
  for (; t.finalities.revoke.length > 0; )
128
128
  t.finalities.revoke.pop()();
@@ -133,7 +133,7 @@ function Ee(t, e) {
133
133
  return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
134
134
  }).join("/");
135
135
  }
136
- function Ps(t, e) {
136
+ function Cs(t, e) {
137
137
  for (let n = 0; n < e.length - 1; n += 1) {
138
138
  const r = e[n];
139
139
  if (t = be(Ce(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
@@ -141,7 +141,7 @@ function Ps(t, e) {
141
141
  }
142
142
  return t;
143
143
  }
144
- function Is(t) {
144
+ function Ps(t) {
145
145
  const e = Object.create(Object.getPrototypeOf(t));
146
146
  return Reflect.ownKeys(t).forEach((n) => {
147
147
  let r = Reflect.getOwnPropertyDescriptor(t, n);
@@ -157,26 +157,26 @@ function Is(t) {
157
157
  }), Reflect.defineProperty(e, n, r);
158
158
  }), e;
159
159
  }
160
- const Ms = Object.prototype.propertyIsEnumerable;
161
- function pi(t, e) {
160
+ const Is = Object.prototype.propertyIsEnumerable;
161
+ function hi(t, e) {
162
162
  let n;
163
163
  if (Array.isArray(t))
164
164
  return Array.prototype.concat.call(t);
165
165
  if (t instanceof Set) {
166
- if (!xn(t)) {
166
+ if (!Rn(t)) {
167
167
  const r = Object.getPrototypeOf(t).constructor;
168
168
  return new r(t.values());
169
169
  }
170
170
  return Set.prototype.difference ? Set.prototype.difference.call(t, /* @__PURE__ */ new Set()) : new Set(t.values());
171
171
  } else if (t instanceof Map) {
172
- if (!$n(t)) {
172
+ if (!xn(t)) {
173
173
  const r = Object.getPrototypeOf(t).constructor;
174
174
  return new r(t);
175
175
  }
176
176
  return new Map(t);
177
177
  } else if (e != null && e.mark && (n = e.mark(t, ne), n !== void 0) && n !== ne.mutable) {
178
178
  if (n === ne.immutable)
179
- return Is(t);
179
+ return Ps(t);
180
180
  if (typeof n == "function") {
181
181
  if (e.enablePatches || e.enableAutoFreeze)
182
182
  throw new Error("You can't use mark and patches or auto freeze together.");
@@ -188,17 +188,17 @@ function pi(t, e) {
188
188
  return Object.keys(t).forEach((i) => {
189
189
  r[i] = t[i];
190
190
  }), Object.getOwnPropertySymbols(t).forEach((i) => {
191
- Ms.call(t, i) && (r[i] = t[i]);
191
+ Is.call(t, i) && (r[i] = t[i]);
192
192
  }), r;
193
193
  } else
194
194
  throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
195
195
  }
196
196
  function Q(t) {
197
- t.copy || (t.copy = pi(t.original, t.options));
197
+ t.copy || (t.copy = hi(t.original, t.options));
198
198
  }
199
199
  function Je(t) {
200
200
  if (!ae(t))
201
- return Dn(t);
201
+ return $n(t);
202
202
  if (Array.isArray(t))
203
203
  return t.map(Je);
204
204
  if (t instanceof Map) {
@@ -206,7 +206,7 @@ function Je(t) {
206
206
  r,
207
207
  Je(i)
208
208
  ]);
209
- if (!$n(t)) {
209
+ if (!xn(t)) {
210
210
  const r = Object.getPrototypeOf(t).constructor;
211
211
  return new r(n);
212
212
  }
@@ -214,7 +214,7 @@ function Je(t) {
214
214
  }
215
215
  if (t instanceof Set) {
216
216
  const n = Array.from(t).map(Je);
217
- if (!xn(t)) {
217
+ if (!Rn(t)) {
218
218
  const r = Object.getPrototypeOf(t).constructor;
219
219
  return new r(n);
220
220
  }
@@ -232,7 +232,7 @@ function fe(t) {
232
232
  var e;
233
233
  t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && fe(t.parent));
234
234
  }
235
- function wr() {
235
+ function Tr() {
236
236
  throw new Error("Cannot modify frozen object");
237
237
  }
238
238
  function Me(t, e, n, r, i) {
@@ -260,12 +260,12 @@ function Me(t, e, n, r, i) {
260
260
  case 2:
261
261
  for (const [a, u] of t)
262
262
  Me(a, a, n, r, i), Me(u, a, n, r, i);
263
- t.set = t.clear = t.delete = wr;
263
+ t.set = t.clear = t.delete = Tr;
264
264
  break;
265
265
  case 3:
266
266
  for (const a of t)
267
267
  Me(a, a, n, r, i);
268
- t.add = t.clear = t.delete = wr;
268
+ t.add = t.clear = t.delete = Tr;
269
269
  break;
270
270
  case 1:
271
271
  Object.freeze(t);
@@ -281,7 +281,7 @@ function Me(t, e, n, r, i) {
281
281
  }
282
282
  r.pop(), i.pop();
283
283
  }
284
- function Un(t, e) {
284
+ function Dn(t, e) {
285
285
  const n = Ce(t);
286
286
  if (n === 0)
287
287
  Reflect.ownKeys(t).forEach((r) => {
@@ -294,11 +294,11 @@ function Un(t, e) {
294
294
  } else
295
295
  t.forEach((r, i) => e(i, r, t));
296
296
  }
297
- function yi(t, e, n) {
297
+ function pi(t, e, n) {
298
298
  if (ke(t) || !ae(t, n) || e.has(t) || Object.isFrozen(t))
299
299
  return;
300
300
  const r = t instanceof Set, i = r ? /* @__PURE__ */ new Map() : void 0;
301
- if (e.add(t), Un(t, (s, o) => {
301
+ if (e.add(t), Dn(t, (s, o) => {
302
302
  var a;
303
303
  if (ke(o)) {
304
304
  const u = k(o);
@@ -306,7 +306,7 @@ function yi(t, e, n) {
306
306
  const c = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
307
307
  ct(r ? i : t, s, c);
308
308
  } else
309
- yi(o, e, n);
309
+ pi(o, e, n);
310
310
  }), i) {
311
311
  const s = t, o = Array.from(s);
312
312
  s.clear(), o.forEach((a) => {
@@ -314,39 +314,39 @@ function yi(t, e, n) {
314
314
  });
315
315
  }
316
316
  }
317
- function Rs(t, e) {
317
+ function Ms(t, e) {
318
318
  const n = t.type === 3 ? t.setMap : t.copy;
319
- t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && yi(be(n, e), t.finalities.handledSet, t.options);
319
+ t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && pi(be(n, e), t.finalities.handledSet, t.options);
320
320
  }
321
- function on(t) {
321
+ function sn(t) {
322
322
  t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
323
- t.copy.add(Dn(e));
323
+ t.copy.add($n(e));
324
324
  }));
325
325
  }
326
- function an(t, e, n, r) {
326
+ function on(t, e, n, r) {
327
327
  if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
328
328
  if (n && r) {
329
- const s = hi(t);
329
+ const s = li(t);
330
330
  s && e(t, s, n, r);
331
331
  }
332
332
  t.finalized = !0;
333
333
  }
334
334
  }
335
- function Ln(t, e, n, r) {
335
+ function Un(t, e, n, r) {
336
336
  const i = k(n);
337
337
  i && (i.callbacks || (i.callbacks = []), i.callbacks.push((s, o) => {
338
338
  var a;
339
339
  const u = t.type === 3 ? t.setMap : t.copy;
340
340
  if (ye(be(u, e), n)) {
341
341
  let c = i.original;
342
- i.copy && (c = i.copy), on(t), an(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(c, i.original)), ct(u, e, c);
342
+ i.copy && (c = i.copy), sn(t), on(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(c, i.original)), ct(u, e, c);
343
343
  }
344
344
  }), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ae(n, t.options) && t.finalities.draft.push(() => {
345
345
  const s = t.type === 3 ? t.setMap : t.copy;
346
- ye(be(s, e), n) && Rs(t, e);
346
+ ye(be(s, e), n) && Ms(t, e);
347
347
  });
348
348
  }
349
- function xs(t, e, n, r, i) {
349
+ function Rs(t, e, n, r, i) {
350
350
  let { original: s, assignedMap: o, options: a } = t, u = t.copy;
351
351
  u.length < s.length && ([s, u] = [u, s], [n, r] = [r, n]);
352
352
  for (let c = 0; c < s.length; c += 1)
@@ -392,7 +392,7 @@ function xs(t, e, n, r, i) {
392
392
  }
393
393
  }
394
394
  }
395
- function $s({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
395
+ function xs({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
396
396
  n.forEach((a, u) => {
397
397
  const c = be(t, u), d = St(be(e, u)), f = a ? nt(t, u) ? U.Replace : U.Add : U.Remove;
398
398
  if (ye(c, d) && f === U.Replace)
@@ -401,7 +401,7 @@ function $s({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
401
401
  i.push(f === U.Remove ? { op: f, path: p } : { op: f, path: p, value: d }), s.push(f === U.Add ? { op: U.Remove, path: p } : f === U.Remove ? { op: U.Add, path: p, value: c } : { op: U.Replace, path: p, value: c });
402
402
  });
403
403
  }
404
- function Ds({ original: t, copy: e }, n, r, i, s) {
404
+ function $s({ original: t, copy: e }, n, r, i, s) {
405
405
  let o = 0;
406
406
  t.forEach((a) => {
407
407
  if (!e.has(a)) {
@@ -438,17 +438,17 @@ function ut(t, e, n, r) {
438
438
  switch (t.type) {
439
439
  case 0:
440
440
  case 2:
441
- return $s(t, e, n, r, i);
442
- case 1:
443
441
  return xs(t, e, n, r, i);
442
+ case 1:
443
+ return Rs(t, e, n, r, i);
444
444
  case 3:
445
- return Ds(t, e, n, r, i);
445
+ return $s(t, e, n, r, i);
446
446
  }
447
447
  }
448
448
  const kt = (t, e, n = !1) => {
449
449
  if (typeof t == "object" && t !== null && (!ae(t, e) || n))
450
450
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
451
- }, un = {
451
+ }, an = {
452
452
  get size() {
453
453
  return te(k(this)).size;
454
454
  },
@@ -457,7 +457,7 @@ const kt = (t, e, n = !1) => {
457
457
  },
458
458
  set(t, e) {
459
459
  const n = k(this), r = te(n);
460
- return (!r.has(t) || !ye(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), Ln(n, t, e, ut)), this;
460
+ return (!r.has(t) || !ye(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), Un(n, t, e, ut)), this;
461
461
  },
462
462
  delete(t) {
463
463
  if (!this.has(t))
@@ -485,7 +485,7 @@ const kt = (t, e, n = !1) => {
485
485
  const r = k(this), i = te(r).get(t), s = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, i, ne)) === ne.mutable;
486
486
  if (r.options.strict && kt(i, r.options, s), s || r.finalized || !ae(i, r.options) || i !== r.original.get(t))
487
487
  return i;
488
- const o = Rn.createDraft({
488
+ const o = Mn.createDraft({
489
489
  original: i,
490
490
  parentDraft: r,
491
491
  key: t,
@@ -529,7 +529,7 @@ const kt = (t, e, n = !1) => {
529
529
  [vt]() {
530
530
  return this.entries();
531
531
  }
532
- }, Us = Reflect.ownKeys(un), mr = (t, e, { isValuesIterator: n }) => () => {
532
+ }, Ds = Reflect.ownKeys(an), wr = (t, e, { isValuesIterator: n }) => () => {
533
533
  var r, i;
534
534
  const s = e.next();
535
535
  if (s.done)
@@ -538,7 +538,7 @@ const kt = (t, e, n = !1) => {
538
538
  let a = t.setMap.get(o);
539
539
  const u = k(a), c = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, a, ne)) === ne.mutable;
540
540
  if (t.options.strict && kt(o, t.options, c), !c && !u && ae(o, t.options) && !t.finalized && t.original.has(o)) {
541
- const d = Rn.createDraft({
541
+ const d = Mn.createDraft({
542
542
  original: o,
543
543
  parentDraft: t,
544
544
  key: o,
@@ -565,7 +565,7 @@ const kt = (t, e, n = !1) => {
565
565
  },
566
566
  add(t) {
567
567
  const e = k(this);
568
- return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Ln(e, t, t, ut)), this;
568
+ return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Un(e, t, t, ut)), this;
569
569
  },
570
570
  delete(t) {
571
571
  if (!this.has(t))
@@ -590,7 +590,7 @@ const kt = (t, e, n = !1) => {
590
590
  const e = t.setMap.keys();
591
591
  return {
592
592
  [Symbol.iterator]: () => this.values(),
593
- next: mr(t, e, { isValuesIterator: !0 })
593
+ next: wr(t, e, { isValuesIterator: !0 })
594
594
  };
595
595
  },
596
596
  entries() {
@@ -599,7 +599,7 @@ const kt = (t, e, n = !1) => {
599
599
  const e = t.setMap.keys();
600
600
  return {
601
601
  [Symbol.iterator]: () => this.entries(),
602
- next: mr(t, e, {
602
+ next: wr(t, e, {
603
603
  isValuesIterator: !1
604
604
  })
605
605
  };
@@ -640,13 +640,13 @@ Set.prototype.difference && Object.assign(Ct, {
640
640
  return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
641
641
  }
642
642
  });
643
- const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
643
+ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
644
644
  get(t, e, n) {
645
645
  var r, i;
646
646
  const s = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
647
- if (s && bi.has(s))
647
+ if (s && yi.has(s))
648
648
  return s;
649
- if (e === li)
649
+ if (e === fi)
650
650
  return t;
651
651
  let o;
652
652
  if (t.options.mark) {
@@ -655,14 +655,14 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
655
655
  return t.options.strict && kt(c, t.options, !0), c;
656
656
  }
657
657
  const a = te(t);
658
- if (a instanceof Map && Us.includes(e)) {
658
+ if (a instanceof Map && Ds.includes(e)) {
659
659
  if (e === "size")
660
- return Object.getOwnPropertyDescriptor(un, "size").get.call(t.proxy);
661
- const c = un[e];
660
+ return Object.getOwnPropertyDescriptor(an, "size").get.call(t.proxy);
661
+ const c = an[e];
662
662
  if (c)
663
663
  return c.bind(t.proxy);
664
664
  }
665
- if (a instanceof Set && Ls.includes(e)) {
665
+ if (a instanceof Set && Us.includes(e)) {
666
666
  if (e === "size")
667
667
  return Object.getOwnPropertyDescriptor(Ct, "size").get.call(t.proxy);
668
668
  const c = Ct[e];
@@ -670,7 +670,7 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
670
670
  return c.bind(t.proxy);
671
671
  }
672
672
  if (!nt(a, e)) {
673
- const c = Tr(a, e);
673
+ const c = gr(a, e);
674
674
  return c ? "value" in c ? c.value : (
675
675
  // !case: support for getter
676
676
  (i = c.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
@@ -680,7 +680,7 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
680
680
  if (t.options.strict && kt(u, t.options), t.finalized || !ae(u, t.options))
681
681
  return u;
682
682
  if (u === Ht(t.original, e)) {
683
- if (Q(t), t.copy[e] = Fn({
683
+ if (Q(t), t.copy[e] = Ln({
684
684
  original: t.original[e],
685
685
  parentDraft: t,
686
686
  key: t.type === 1 ? Number(e) : e,
@@ -701,11 +701,11 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
701
701
  let i;
702
702
  if (t.type === 1 && e !== "length" && !(Number.isInteger(i = Number(e)) && i >= 0 && (e === 0 || i === 0 || String(i) === String(e))))
703
703
  throw new Error("Only supports setting array indices and the 'length' property.");
704
- const s = Tr(te(t), e);
704
+ const s = gr(te(t), e);
705
705
  if (s != null && s.set)
706
706
  return s.set.call(t.proxy, n), !0;
707
707
  const o = Ht(te(t), e), a = k(o);
708
- return a && ye(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ye(n, o) && (n !== void 0 || nt(t.original, e)) || (Q(t), fe(t), nt(t.original, e) && ye(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, Ln(t, e, n, ut)), !0);
708
+ return a && ye(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ye(n, o) && (n !== void 0 || nt(t.original, e)) || (Q(t), fe(t), nt(t.original, e) && ye(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, Un(t, e, n, ut)), !0);
709
709
  },
710
710
  has(t, e) {
711
711
  return e in te(t);
@@ -733,10 +733,10 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
733
733
  },
734
734
  deleteProperty(t, e) {
735
735
  var n;
736
- return t.type === 1 ? _i.set.call(this, t, e, void 0, t.proxy) : (Ht(t.original, e) !== void 0 || e in t.original ? (Q(t), fe(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);
736
+ return t.type === 1 ? bi.set.call(this, t, e, void 0, t.proxy) : (Ht(t.original, e) !== void 0 || e in t.original ? (Q(t), fe(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);
737
737
  }
738
738
  };
739
- function Fn(t) {
739
+ function Ln(t) {
740
740
  const { original: e, parentDraft: n, key: r, finalities: i, options: s } = t, o = Ce(e), a = {
741
741
  type: o,
742
742
  finalized: !1,
@@ -750,8 +750,8 @@ function Fn(t) {
750
750
  setMap: o === 3 ? new Map(e.entries()) : void 0
751
751
  };
752
752
  (r || "key" in t) && (a.key = r);
753
- const { proxy: u, revoke: c } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, _i);
754
- if (i.revoke.push(c), bi.add(u), a.proxy = u, n) {
753
+ const { proxy: u, revoke: c } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, bi);
754
+ if (i.revoke.push(c), yi.add(u), a.proxy = u, n) {
755
755
  const d = n;
756
756
  d.finalities.draft.push((f, l) => {
757
757
  var p, y;
@@ -760,7 +760,7 @@ function Fn(t) {
760
760
  const w = be(_, r), g = k(w);
761
761
  if (g) {
762
762
  let m = g.original;
763
- g.operated && (m = Dn(w)), on(g), an(g, ut, f, l), d.options.enableAutoFreeze && (d.options.updatedValues = (p = d.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), d.options.updatedValues.set(m, g.original)), ct(_, r, m);
763
+ g.operated && (m = $n(w)), sn(g), on(g, ut, f, l), d.options.enableAutoFreeze && (d.options.updatedValues = (p = d.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), d.options.updatedValues.set(m, g.original)), ct(_, r, m);
764
764
  }
765
765
  (y = b.callbacks) === null || y === void 0 || y.forEach((m) => {
766
766
  m(f, l);
@@ -769,26 +769,26 @@ function Fn(t) {
769
769
  } else {
770
770
  const d = k(u);
771
771
  d.finalities.draft.push((f, l) => {
772
- on(d), an(d, ut, f, l);
772
+ sn(d), on(d, ut, f, l);
773
773
  });
774
774
  }
775
775
  return u;
776
776
  }
777
- Rn.createDraft = Fn;
778
- function Fs(t, e, n, r, i) {
777
+ Mn.createDraft = Ln;
778
+ function Ls(t, e, n, r, i) {
779
779
  var s;
780
780
  const o = k(t), a = (s = o == null ? void 0 : o.original) !== null && s !== void 0 ? s : t, u = !!e.length;
781
781
  if (o != null && o.operated)
782
782
  for (; o.finalities.draft.length > 0; )
783
783
  o.finalities.draft.pop()(n, r);
784
784
  const c = u ? e[0] : o ? o.operated ? o.copy : o.original : t;
785
- return o && sn(o), i && Me(c, c, o == null ? void 0 : o.options.updatedValues), [
785
+ return o && rn(o), i && Me(c, c, o == null ? void 0 : o.options.updatedValues), [
786
786
  c,
787
787
  n && u ? [{ op: U.Replace, path: [], value: e[0] }] : n,
788
788
  r && u ? [{ op: U.Replace, path: [], value: a }] : r
789
789
  ];
790
790
  }
791
- function Ns(t, e) {
791
+ function Fs(t, e) {
792
792
  var n;
793
793
  const r = {
794
794
  draft: [],
@@ -797,7 +797,7 @@ function Ns(t, e) {
797
797
  };
798
798
  let i, s;
799
799
  e.enablePatches && (i = [], s = []);
800
- const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, ne)) === ne.mutable || !ae(t, e) ? t : Fn({
800
+ const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, ne)) === ne.mutable || !ae(t, e) ? t : Ln({
801
801
  original: t,
802
802
  parentDraft: null,
803
803
  finalities: r,
@@ -806,14 +806,14 @@ function Ns(t, e) {
806
806
  return [
807
807
  a,
808
808
  (u = []) => {
809
- const [c, d, f] = Fs(a, u, i, s, e.enableAutoFreeze);
809
+ const [c, d, f] = Ls(a, u, i, s, e.enableAutoFreeze);
810
810
  return e.enablePatches ? [c, d, f] : c;
811
811
  }
812
812
  ];
813
813
  }
814
- function cn(t) {
814
+ function un(t) {
815
815
  const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: i = !0 } = t;
816
- Un(n, (s, o, a) => {
816
+ Dn(n, (s, o, a) => {
817
817
  const u = k(o);
818
818
  if (u && e && u.finalities === e.finalities) {
819
819
  t.isContainDraft = !0;
@@ -823,10 +823,10 @@ function cn(t) {
823
823
  a.clear(), d.forEach((f) => a.add(s === f ? c : f));
824
824
  } else
825
825
  ct(a, s, c);
826
- } else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, cn(t));
826
+ } else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, un(t));
827
827
  }), 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."));
828
828
  }
829
- function gi(t) {
829
+ function _i(t) {
830
830
  var e;
831
831
  const n = k(t);
832
832
  if (!ae(t, n == null ? void 0 : n.options))
@@ -836,7 +836,7 @@ function gi(t) {
836
836
  return n.original;
837
837
  let i;
838
838
  function s() {
839
- i = r === 2 ? $n(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : pi(t, n == null ? void 0 : n.options);
839
+ i = r === 2 ? xn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : hi(t, n == null ? void 0 : n.options);
840
840
  }
841
841
  if (n) {
842
842
  n.finalized = !0;
@@ -847,23 +847,23 @@ function gi(t) {
847
847
  }
848
848
  } else
849
849
  i = t;
850
- if (Un(i, (o, a) => {
850
+ if (Dn(i, (o, a) => {
851
851
  if (n && ye(be(n.original, o), a))
852
852
  return;
853
- const u = gi(a);
853
+ const u = _i(a);
854
854
  u !== a && (i === t && s(), ct(i, o, u));
855
855
  }), r === 3) {
856
856
  const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : i;
857
- return xn(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
857
+ return Rn(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
858
858
  }
859
859
  return i;
860
860
  }
861
- function vr(t) {
861
+ function mr(t) {
862
862
  if (!ke(t))
863
863
  throw new Error(`current() is only used for Draft, parameter: ${t}`);
864
- return gi(t);
864
+ return _i(t);
865
865
  }
866
- const Ks = (t) => function e(n, r, i) {
866
+ const Ns = (t) => function e(n, r, i) {
867
867
  var s, o, a;
868
868
  if (typeof n == "function" && typeof r != "function")
869
869
  return function(S, ...I) {
@@ -874,7 +874,7 @@ const Ks = (t) => function e(n, r, i) {
874
874
  if (typeof r != "function" && (d = r), d !== void 0 && Object.prototype.toString.call(d) !== "[object Object]")
875
875
  throw new Error(`Invalid options: ${d}, 'options' should be an object.`);
876
876
  d = Object.assign(Object.assign({}, t), d);
877
- const f = ke(u) ? vr(u) : u, l = Array.isArray(d.mark) ? (S, I) => {
877
+ const f = ke(u) ? mr(u) : u, l = Array.isArray(d.mark) ? (S, I) => {
878
878
  for (const x of d.mark) {
879
879
  if (typeof x != "function")
880
880
  throw new Error(`Invalid mark: ${x}, 'mark' should be a function.`);
@@ -890,7 +890,7 @@ const Ks = (t) => function e(n, r, i) {
890
890
  };
891
891
  if (!ae(f, _) && typeof f == "object" && f !== null)
892
892
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
893
- const [w, g] = Ns(f, _);
893
+ const [w, g] = Fs(f, _);
894
894
  if (typeof r != "function") {
895
895
  if (!ae(f, _))
896
896
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
@@ -900,24 +900,24 @@ const Ks = (t) => function e(n, r, i) {
900
900
  try {
901
901
  m = c(w);
902
902
  } catch (S) {
903
- throw sn(k(w)), S;
903
+ throw rn(k(w)), S;
904
904
  }
905
905
  const E = (S) => {
906
906
  const I = k(w);
907
907
  if (!ke(S)) {
908
908
  if (S !== void 0 && !ye(S, w) && (I != null && I.operated))
909
909
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
910
- const B = S == null ? void 0 : S[Cs];
910
+ const B = S == null ? void 0 : S[ks];
911
911
  if (B) {
912
912
  const Ve = B[0];
913
- return _.strict && typeof S == "object" && S !== null && cn({
913
+ return _.strict && typeof S == "object" && S !== null && un({
914
914
  rootDraft: I,
915
915
  value: S,
916
916
  useRawReturn: !0
917
917
  }), g([Ve]);
918
918
  }
919
919
  if (S !== void 0)
920
- return typeof S == "object" && S !== null && cn({ rootDraft: I, value: S }), g([S]);
920
+ return typeof S == "object" && S !== null && un({ rootDraft: I, value: S }), g([S]);
921
921
  }
922
922
  if (S === w || S === void 0)
923
923
  return g([]);
@@ -925,26 +925,26 @@ const Ks = (t) => function e(n, r, i) {
925
925
  if (_ === x.options) {
926
926
  if (x.operated)
927
927
  throw new Error("Cannot return a modified child draft.");
928
- return g([vr(S)]);
928
+ return g([mr(S)]);
929
929
  }
930
930
  return g([S]);
931
931
  };
932
932
  return m instanceof Promise ? m.then(E, (S) => {
933
- throw sn(k(w)), S;
933
+ throw rn(k(w)), S;
934
934
  }) : E(m);
935
- }, Pt = Ks();
935
+ }, Pt = Ns();
936
936
  Object.prototype.constructor.toString();
937
- function Ti(t, e) {
937
+ function gi(t, e) {
938
938
  const n = Object.keys(t), r = Object.keys(e);
939
939
  return n.length === r.length && Object.keys(t).every((i) => e.hasOwnProperty(i));
940
940
  }
941
- function Sr(t, e) {
941
+ function vr(t, e) {
942
942
  return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((n) => e.hasOwnProperty(n) && t[n] === e[n]);
943
943
  }
944
944
  function Ot(t, e) {
945
- return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : Ti(t, e) ? Object.keys(t).every((n) => Ot(t[n], e[n])) : !1;
945
+ return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : gi(t, e) ? Object.keys(t).every((n) => Ot(t[n], e[n])) : !1;
946
946
  }
947
- function Nn(t) {
947
+ function Fn(t) {
948
948
  if (!Ze(t))
949
949
  return t;
950
950
  const e = {};
@@ -952,7 +952,7 @@ function Nn(t) {
952
952
  r !== void 0 && (e[n] = r);
953
953
  return e;
954
954
  }
955
- function wi(t, e) {
955
+ function Ti(t, e) {
956
956
  if (!Ze(t) || !Ze(e))
957
957
  return e;
958
958
  const n = Object.assign({}, t);
@@ -964,14 +964,14 @@ function wi(t, e) {
964
964
  continue;
965
965
  }
966
966
  const i = Ze(t[r]) && Ze(e[r]);
967
- n[r] = i ? wi(t[r], e[r]) : e[r];
967
+ n[r] = i ? Ti(t[r], e[r]) : e[r];
968
968
  }
969
969
  return n;
970
970
  }
971
971
  function Ze(t) {
972
972
  return typeof t == "object" && t !== null && !Array.isArray(t);
973
973
  }
974
- function qs(t, e, n) {
974
+ function Ks(t, e, n) {
975
975
  if (!t || e.length === 0)
976
976
  return;
977
977
  let r = t || {};
@@ -982,7 +982,7 @@ function qs(t, e, n) {
982
982
  const i = e[e.length - 1];
983
983
  Array.isArray(r) && typeof i == "number" ? r.splice(i, 0, n) : r[i] = n;
984
984
  }
985
- function Or(t, e, n) {
985
+ function Sr(t, e, n) {
986
986
  if (!t || e.length === 0)
987
987
  return;
988
988
  let r = t || {};
@@ -992,7 +992,7 @@ function Or(t, e, n) {
992
992
  }
993
993
  r[e[e.length - 1]] = n;
994
994
  }
995
- function mi(t, e) {
995
+ function wi(t, e) {
996
996
  if (!t || e.length === 0)
997
997
  return;
998
998
  const [n, ...r] = e;
@@ -1001,13 +1001,13 @@ function mi(t, e) {
1001
1001
  Array.isArray(t) ? t.splice(n, 1) : delete t[n];
1002
1002
  return;
1003
1003
  }
1004
- mi(t[n], r), Ws(t[n]) && delete t[n];
1004
+ wi(t[n], r), qs(t[n]) && delete t[n];
1005
1005
  }
1006
1006
  }
1007
- function Ws(t) {
1007
+ function qs(t) {
1008
1008
  return t && Object.keys(t).length === 0;
1009
1009
  }
1010
- const Er = /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$/, zs = {
1010
+ const Or = /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$/, Ws = {
1011
1011
  ZULU: 0,
1012
1012
  YEKT: 18e3,
1013
1013
  YEKST: 21600,
@@ -1203,39 +1203,39 @@ const Er = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
1203
1203
  ACSST: 37800,
1204
1204
  ACDT: 37800
1205
1205
  };
1206
- function Vs(t) {
1206
+ function zs(t) {
1207
1207
  return new Date(t);
1208
1208
  }
1209
- function Bs(t) {
1209
+ function Vs(t) {
1210
1210
  return /* @__PURE__ */ new Date(t + "Z");
1211
1211
  }
1212
- const Gs = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
1213
- function Qs(t) {
1214
- const e = t.match(Gs);
1212
+ const Bs = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
1213
+ function Gs(t) {
1214
+ const e = t.match(Bs);
1215
1215
  if (!e)
1216
1216
  return null;
1217
1217
  const [n, r, i, s] = e;
1218
1218
  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));
1219
1219
  }
1220
- function Hs(t) {
1220
+ function Qs(t) {
1221
1221
  const [e, n] = t.split(" ");
1222
1222
  return /* @__PURE__ */ new Date(e + "T" + n + "Z");
1223
1223
  }
1224
- function Ys(t) {
1224
+ function Hs(t) {
1225
1225
  const [e, n] = t.split(" ");
1226
1226
  return /* @__PURE__ */ new Date(e + "T" + n + "Z");
1227
1227
  }
1228
- function Js(t) {
1228
+ function Ys(t) {
1229
1229
  return new Date(t);
1230
1230
  }
1231
- function Zs(t) {
1231
+ function Js(t) {
1232
1232
  const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
1233
1233
  if (!t.match(e))
1234
1234
  throw new Error(`Unable to parse \`${t}\` as a date.`);
1235
1235
  const r = /* @__PURE__ */ new Date(t + " UTC");
1236
1236
  return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate(), 0, 0, 0, 0));
1237
1237
  }
1238
- function Xs(t) {
1238
+ function Zs(t) {
1239
1239
  const e = /^(.+T.+)([+-])(\d{2})$/, n = t.match(e);
1240
1240
  if (n) {
1241
1241
  const [, r, i, s] = n, o = `${r}${i}${s}:00`;
@@ -1243,7 +1243,7 @@ function Xs(t) {
1243
1243
  }
1244
1244
  return null;
1245
1245
  }
1246
- function eo(t) {
1246
+ function Xs(t) {
1247
1247
  const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, n = t.match(e);
1248
1248
  if (n) {
1249
1249
  const [, r, i, s, o, a] = n, u = i.padStart(2, "0"), c = s.padStart(2, "0"), d = `${r}-${u}-${c}T${a}`;
@@ -1251,14 +1251,14 @@ function eo(t) {
1251
1251
  }
1252
1252
  return null;
1253
1253
  }
1254
- function to(t) {
1254
+ function eo(t) {
1255
1255
  const [e, n] = t.split(", "), [r, i, s] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
1256
1256
  if (!o)
1257
1257
  throw new Error(`Unable to parse time from: ${t}`);
1258
1258
  let [, a, u, c, d] = o;
1259
1259
  return a = Number(a), u = Number(u), c = Number(c), d === "PM" && a !== 12 ? a += 12 : d === "AM" && a === 12 && (a = 0), new Date(Date.UTC(s, r - 1, i, a, u, c));
1260
1260
  }
1261
- function no(t) {
1261
+ function to(t) {
1262
1262
  switch (t) {
1263
1263
  case "epoch":
1264
1264
  return /* @__PURE__ */ new Date(0);
@@ -1270,28 +1270,28 @@ function no(t) {
1270
1270
  return null;
1271
1271
  }
1272
1272
  }
1273
- function ro(t) {
1274
- const e = t.match(Er);
1273
+ function no(t) {
1274
+ const e = t.match(Or);
1275
1275
  if (!e)
1276
1276
  return null;
1277
- const [n] = e, r = zs[n], i = new Date(t.replace(Er, "Z"));
1277
+ const [n] = e, r = Ws[n], i = new Date(t.replace(Or, "Z"));
1278
1278
  return new Date(i.getTime() - r * 1e3);
1279
1279
  }
1280
- const io = [
1281
- Qs,
1280
+ const ro = [
1281
+ Gs,
1282
+ Hs,
1283
+ Js,
1284
+ eo,
1282
1285
  Ys,
1286
+ Vs,
1283
1287
  Zs,
1288
+ Qs,
1289
+ zs,
1284
1290
  to,
1285
- Js,
1286
- Bs,
1287
- Xs,
1288
- Hs,
1289
- Vs,
1290
1291
  no,
1291
- ro,
1292
- eo
1292
+ Xs
1293
1293
  ];
1294
- function so(t, e) {
1294
+ function io(t, e) {
1295
1295
  try {
1296
1296
  const n = t(e);
1297
1297
  return n instanceof Date && !isNaN(n.getTime()) ? n : null;
@@ -1299,18 +1299,18 @@ function so(t, e) {
1299
1299
  return null;
1300
1300
  }
1301
1301
  }
1302
- function dn(t) {
1303
- for (const e of io) {
1304
- const n = so(e, t);
1302
+ function cn(t) {
1303
+ for (const e of ro) {
1304
+ const n = io(e, t);
1305
1305
  if (n)
1306
1306
  return n;
1307
1307
  }
1308
1308
  return null;
1309
1309
  }
1310
- function oo(t) {
1310
+ function so(t) {
1311
1311
  try {
1312
1312
  const e = JSON.parse(t);
1313
- return typeof e == "string" ? dn(e) : null;
1313
+ return typeof e == "string" ? cn(e) : null;
1314
1314
  } catch {
1315
1315
  return null;
1316
1316
  }
@@ -1322,7 +1322,7 @@ function xt(t) {
1322
1322
  if (t instanceof Date)
1323
1323
  return t;
1324
1324
  if (typeof t == "string") {
1325
- const e = dn(t) || oo(t) || dn(t.trim());
1325
+ const e = cn(t) || so(t) || cn(t.trim());
1326
1326
  if (!e)
1327
1327
  throw new Error(`Unable to parse \`${t}\` as a date.`);
1328
1328
  return e;
@@ -1331,13 +1331,13 @@ function xt(t) {
1331
1331
  throw new Error(`Invalid date value \`${t}\`. Expected a date, number, or string, got type ${typeof t}.`);
1332
1332
  }
1333
1333
  }
1334
- function ao(t) {
1334
+ function oo(t) {
1335
1335
  return t.cardinality === "one";
1336
1336
  }
1337
- function Kn(t) {
1337
+ function Nn(t) {
1338
1338
  return t["value-type"] === "ref";
1339
1339
  }
1340
- function qn(t) {
1340
+ function Kn(t) {
1341
1341
  return t["value-type"] === "blob";
1342
1342
  }
1343
1343
  function qe(t, e) {
@@ -1367,7 +1367,7 @@ function Z(t, e, n) {
1367
1367
  let s = t.get(r);
1368
1368
  s || (s = /* @__PURE__ */ new Map(), t.set(r, s)), Z(s, i, n);
1369
1369
  }
1370
- function vi(t, e, n) {
1370
+ function mi(t, e, n) {
1371
1371
  const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1372
1372
  for (const o of e) {
1373
1373
  let [a, u, c, d] = o;
@@ -1376,22 +1376,22 @@ function vi(t, e, n) {
1376
1376
  console.warn("no such attr", a, t);
1377
1377
  continue;
1378
1378
  }
1379
- f["checked-data-type"] === "date" && n && (c = xt(c), o[2] = c), Kn(f) && Z(s, [c, u, a], o), Z(r, [a, u, c], o), Z(i, [u, a, c], o);
1379
+ f["checked-data-type"] === "date" && n && (c = xt(c), o[2] = c), Nn(f) && Z(s, [c, u, a], o), Z(r, [a, u, c], o), Z(i, [u, a, c], o);
1380
1380
  }
1381
1381
  return { eav: r, aev: i, vae: s };
1382
1382
  }
1383
- function Si(t) {
1383
+ function vi(t) {
1384
1384
  const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
1385
1385
  for (const s of Object.values(t)) {
1386
1386
  const o = s["forward-identity"], [a, u, c] = o, d = s["reverse-identity"];
1387
- if (Z(r, [u, c], s), qn(s) && Z(e, [u, c], s), s["primary?"] && Z(n, [u], s), d) {
1387
+ if (Z(r, [u, c], s), Kn(s) && Z(e, [u, c], s), s["primary?"] && Z(n, [u], s), d) {
1388
1388
  const [f, l, p] = d;
1389
1389
  Z(i, [l, p], s);
1390
1390
  }
1391
1391
  }
1392
1392
  return { blobAttrs: e, primaryKeys: n, forwardIdents: r, revIdents: i };
1393
1393
  }
1394
- function Oi(t) {
1394
+ function Si(t) {
1395
1395
  return {
1396
1396
  __type: t.__type,
1397
1397
  attrs: t.attrs,
@@ -1401,18 +1401,18 @@ function Oi(t) {
1401
1401
  useDateObjects: t.useDateObjects
1402
1402
  };
1403
1403
  }
1404
- function Ei(t) {
1404
+ function Oi(t) {
1405
1405
  return Et(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
1406
1406
  }
1407
- function uo(t, e) {
1407
+ function ao(t, e) {
1408
1408
  return We(t.eav, [e]) !== void 0;
1409
1409
  }
1410
- function Wn(t) {
1411
- t.attrIndexes = Si(t.attrs);
1410
+ function qn(t) {
1411
+ t.attrIndexes = vi(t.attrs);
1412
1412
  }
1413
1413
  function Et(t, e, n, r, i) {
1414
- const s = vi(t, e, i);
1415
- return s.useDateObjects = i, s.attrs = t, s.attrIndexes = Si(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
1414
+ const s = mi(t, e, i);
1415
+ return s.useDateObjects = i, s.attrs = t, s.attrIndexes = vi(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
1416
1416
  }
1417
1417
  function dt(t, e) {
1418
1418
  var n, r;
@@ -1441,21 +1441,21 @@ function dt(t, e) {
1441
1441
  return [i, ...a];
1442
1442
  }
1443
1443
  }
1444
- function Ai(t, e) {
1444
+ function Ei(t, e) {
1445
1445
  const n = dt(t, e);
1446
1446
  if (!n)
1447
1447
  return;
1448
1448
  const [r, i, s] = n, o = qe(t.attrs, i);
1449
- o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]), Kn(o) && oe(t.vae, [s, i, r]));
1449
+ o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]), Nn(o) && oe(t.vae, [s, i, r]));
1450
1450
  }
1451
- let co = 0;
1452
- function ji(t, e, n) {
1451
+ let uo = 0;
1452
+ function Ai(t, e, n) {
1453
1453
  const [r, i, s] = n;
1454
1454
  let o;
1455
1455
  const a = We(t.eav, [r, i, s]);
1456
- return a && (o = a[3]), o || Date.now() * 10 + co++;
1456
+ return a && (o = a[3]), o || Date.now() * 10 + uo++;
1457
1457
  }
1458
- function ki(t, e) {
1458
+ function ji(t, e) {
1459
1459
  var n;
1460
1460
  const r = dt(t, e);
1461
1461
  if (!r)
@@ -1465,10 +1465,10 @@ function ki(t, e) {
1465
1465
  if (!a)
1466
1466
  return;
1467
1467
  a["checked-data-type"] === "date" && t.useDateObjects && (o = xt(o));
1468
- const u = We(t.eav, [i, s, o]), c = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n : ji(t, a, r), d = [i, s, o, c];
1469
- ao(a) ? (Z(t.eav, [i, s], /* @__PURE__ */ new Map([[o, d]])), Z(t.aev, [s, i], /* @__PURE__ */ new Map([[o, d]]))) : (Z(t.eav, [i, s, o], d), Z(t.aev, [s, i, o], d)), Kn(a) && Z(t.vae, [o, s, i], d);
1468
+ const u = We(t.eav, [i, s, o]), c = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n : Ai(t, a, r), d = [i, s, o, c];
1469
+ oo(a) ? (Z(t.eav, [i, s], /* @__PURE__ */ new Map([[o, d]])), Z(t.aev, [s, i], /* @__PURE__ */ new Map([[o, d]]))) : (Z(t.eav, [i, s, o], d), Z(t.aev, [s, i, o], d)), Nn(a) && Z(t.vae, [o, s, i], d);
1470
1470
  }
1471
- function fo(t, e) {
1471
+ function co(t, e) {
1472
1472
  var n;
1473
1473
  const r = dt(t, e);
1474
1474
  if (!r)
@@ -1476,7 +1476,7 @@ function fo(t, e) {
1476
1476
  const [i, s, o] = r, a = qe(t.attrs, s);
1477
1477
  if (!a)
1478
1478
  return;
1479
- if (!qn(a))
1479
+ if (!Kn(a))
1480
1480
  throw new Error("merge operation is not supported for links");
1481
1481
  const u = We(t.eav, [i, s]);
1482
1482
  if (!u)
@@ -1484,15 +1484,15 @@ function fo(t, e) {
1484
1484
  const c = (n = u.values().next()) === null || n === void 0 ? void 0 : n.value;
1485
1485
  if (!c)
1486
1486
  return;
1487
- const d = c[2], f = wi(d, o), l = [
1487
+ const d = c[2], f = Ti(d, o), l = [
1488
1488
  i,
1489
1489
  s,
1490
1490
  f,
1491
- ji(t, a, c)
1491
+ Ai(t, a, c)
1492
1492
  ];
1493
1493
  Z(t.eav, [i, s], /* @__PURE__ */ new Map([[f, l]]));
1494
1494
  }
1495
- function fn(t, e) {
1495
+ function dn(t, e) {
1496
1496
  var n, r;
1497
1497
  const [i, s] = e, o = dt(t, [i]);
1498
1498
  if (!o)
@@ -1503,7 +1503,7 @@ function fn(t, e) {
1503
1503
  const f = t.attrs[d];
1504
1504
  f && f["on-delete-reverse"] === "cascade" && X(u.get(d), 1).forEach(([l, p, y]) => {
1505
1505
  var b;
1506
- return fn(t, [y, (b = f["reverse-identity"]) === null || b === void 0 ? void 0 : b[1]]);
1506
+ return dn(t, [y, (b = f["reverse-identity"]) === null || b === void 0 ? void 0 : b[1]]);
1507
1507
  }), // Fall back to deleting everything if we've rehydrated tx-steps from
1508
1508
  // the store that didn't set `etype` in deleteEntity
1509
1509
  (!s || // If we don't know about the attr, let's just get rid of it
@@ -1516,54 +1516,54 @@ function fn(t, e) {
1516
1516
  c && c.forEach((d) => {
1517
1517
  var f, l, p;
1518
1518
  const [y, b, _] = d, w = t.attrs[b];
1519
- (!s || !w || ((f = w["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (oe(t.eav, [y, b, _]), oe(t.aev, [b, y, _]), oe(t.vae, [_, b, y])), w && w["on-delete"] === "cascade" && ((l = w["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && fn(t, [y, (p = w["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
1519
+ (!s || !w || ((f = w["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (oe(t.eav, [y, b, _]), oe(t.aev, [b, y, _]), oe(t.vae, [_, b, y])), w && w["on-delete"] === "cascade" && ((l = w["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && dn(t, [y, (p = w["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
1520
1520
  }), ((r = t.vae.get(a)) === null || r === void 0 ? void 0 : r.size) === 0 && oe(t.vae, [a]);
1521
1521
  }
1522
- function Ci(t, e) {
1523
- const n = vi(t.attrs, e, t.useDateObjects);
1522
+ function ki(t, e) {
1523
+ const n = mi(t.attrs, e, t.useDateObjects);
1524
1524
  Object.keys(n).forEach((r) => {
1525
1525
  t[r] = n[r];
1526
1526
  });
1527
1527
  }
1528
- function lo(t, [e]) {
1529
- t.attrs[e.id] = e, Wn(t);
1528
+ function fo(t, [e]) {
1529
+ t.attrs[e.id] = e, qn(t);
1530
1530
  }
1531
- function Pi(t) {
1531
+ function Ci(t) {
1532
1532
  return X(t.eav, 3);
1533
1533
  }
1534
- function ho(t, [e]) {
1534
+ function lo(t, [e]) {
1535
1535
  if (!t.attrs[e])
1536
1536
  return;
1537
- const n = Pi(t).filter(([r, i]) => i !== e);
1538
- delete t.attrs[e], Wn(t), Ci(t, n);
1537
+ const n = Ci(t).filter(([r, i]) => i !== e);
1538
+ delete t.attrs[e], qn(t), ki(t, n);
1539
1539
  }
1540
- function po(t, [e]) {
1540
+ function ho(t, [e]) {
1541
1541
  const n = t.attrs[e.id];
1542
- n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), Wn(t), Ci(t, Pi(t)));
1542
+ n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), qn(t), ki(t, Ci(t)));
1543
1543
  }
1544
- function yo(t, e) {
1544
+ function po(t, e) {
1545
1545
  const [n, ...r] = e;
1546
1546
  switch (n) {
1547
1547
  case "add-triple":
1548
- ki(t, r);
1548
+ ji(t, r);
1549
1549
  break;
1550
1550
  case "deep-merge-triple":
1551
- fo(t, r);
1551
+ co(t, r);
1552
1552
  break;
1553
1553
  case "retract-triple":
1554
- Ai(t, r);
1554
+ Ei(t, r);
1555
1555
  break;
1556
1556
  case "delete-entity":
1557
- fn(t, r);
1557
+ dn(t, r);
1558
1558
  break;
1559
1559
  case "add-attr":
1560
- lo(t, r);
1560
+ fo(t, r);
1561
1561
  break;
1562
1562
  case "delete-attr":
1563
- ho(t, r);
1563
+ lo(t, r);
1564
1564
  break;
1565
1565
  case "update-attr":
1566
- po(t, r);
1566
+ ho(t, r);
1567
1567
  break;
1568
1568
  case "restore-attr":
1569
1569
  break;
@@ -1618,13 +1618,13 @@ function gt(t, e, n) {
1618
1618
  }
1619
1619
  return i;
1620
1620
  }
1621
- function bo(t, e, n) {
1621
+ function yo(t, e, n) {
1622
1622
  let r = "";
1623
1623
  return t !== void 0 && (r += "e"), e !== void 0 && (r += "a"), n !== void 0 && (r += "v"), r;
1624
1624
  }
1625
- function _o(t, [e, n, r]) {
1625
+ function bo(t, [e, n, r]) {
1626
1626
  var i, s;
1627
- switch (bo(e, n, r)) {
1627
+ switch (yo(e, n, r)) {
1628
1628
  case "e": {
1629
1629
  const a = t.eav.get(e);
1630
1630
  return X(a, 2);
@@ -1670,36 +1670,33 @@ function _o(t, [e, n, r]) {
1670
1670
  return X(t.eav, 3);
1671
1671
  }
1672
1672
  }
1673
- const Yt = {};
1674
- function go(t, e, n) {
1673
+ function _o(t, e, n) {
1675
1674
  var r;
1676
- if (Yt[n])
1677
- return Yt[n];
1678
1675
  const i = {};
1679
1676
  for (const [s, o] of e.entries()) {
1680
1677
  const a = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), u = X(a, 1);
1681
1678
  for (const c of u)
1682
1679
  i[s] = c[2];
1683
1680
  }
1684
- return Yt[n] = i, i;
1681
+ return i;
1685
1682
  }
1686
1683
  function Te(t, e, n) {
1687
1684
  var r;
1688
1685
  return (r = t.attrIndexes.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
1689
1686
  }
1690
- function Ii(t, e, n) {
1687
+ function Pi(t, e, n) {
1691
1688
  var r;
1692
1689
  return (r = t.attrIndexes.revIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
1693
1690
  }
1694
- function To(t, e) {
1691
+ function go(t, e) {
1695
1692
  return t.attrIndexes.blobAttrs.get(e);
1696
1693
  }
1697
- function Mi(t, e) {
1694
+ function Ii(t, e) {
1698
1695
  var n;
1699
1696
  const r = t.attrIndexes.primaryKeys.get(e);
1700
1697
  return r || ((n = t.attrIndexes.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
1701
1698
  }
1702
- function wo(t, e) {
1699
+ function To(t, e) {
1703
1700
  const n = dt(t, e);
1704
1701
  if (!n)
1705
1702
  return;
@@ -1707,7 +1704,7 @@ function wo(t, e) {
1707
1704
  if (qe(t.attrs, i))
1708
1705
  return We(t.eav, [r, i]);
1709
1706
  }
1710
- function mo(t, e) {
1707
+ function wo(t, e) {
1711
1708
  const n = e.filter(([r, i, s, o, a]) => {
1712
1709
  if (r !== "add-triple" && r !== "deep-merge-triple")
1713
1710
  return !0;
@@ -1717,8 +1714,8 @@ function mo(t, e) {
1717
1714
  let c = !1;
1718
1715
  const d = qe(t.attrs, s);
1719
1716
  if (d) {
1720
- const f = Mi(t, d["forward-identity"][1]);
1721
- c = !!wo(t, [
1717
+ const f = Ii(t, d["forward-identity"][1]);
1718
+ c = !!To(t, [
1722
1719
  i,
1723
1720
  f == null ? void 0 : f.id,
1724
1721
  i
@@ -1728,32 +1725,32 @@ function mo(t, e) {
1728
1725
  });
1729
1726
  return Pt(t, (r) => {
1730
1727
  n.forEach((i) => {
1731
- yo(r, i);
1728
+ po(r, i);
1732
1729
  });
1733
1730
  });
1734
1731
  }
1735
- function vo(t) {
1732
+ function mo(t) {
1736
1733
  return typeof t == "string" && t.startsWith("?");
1737
1734
  }
1738
- function So(t, e, n) {
1735
+ function vo(t, e, n) {
1739
1736
  if (n.hasOwnProperty(t)) {
1740
1737
  const r = n[t];
1741
- return Ri(r, e, n);
1738
+ return Mi(r, e, n);
1742
1739
  }
1743
1740
  return Object.assign(Object.assign({}, n), { [t]: e });
1744
1741
  }
1745
- function Ar(t, e, n) {
1742
+ function Er(t, e, n) {
1746
1743
  return t === e ? n : null;
1747
1744
  }
1748
- function Oo(t) {
1745
+ function So(t) {
1749
1746
  switch (typeof t) {
1750
1747
  case "string":
1751
- return t.startsWith("?") ? So : Ar;
1748
+ return t.startsWith("?") ? vo : Er;
1752
1749
  default:
1753
- return Ar;
1750
+ return Er;
1754
1751
  }
1755
1752
  }
1756
- const Eo = [
1753
+ const Oo = [
1757
1754
  "in",
1758
1755
  "$in",
1759
1756
  "$not",
@@ -1761,77 +1758,77 @@ const Eo = [
1761
1758
  "$comparator"
1762
1759
  // covers all of $gt, $lt, etc.
1763
1760
  ];
1764
- function Ao(t) {
1765
- for (const e of Eo)
1761
+ function Eo(t) {
1762
+ for (const e of Oo)
1766
1763
  if (t.hasOwnProperty(e))
1767
1764
  return !0;
1768
1765
  return !1;
1769
1766
  }
1770
- function Ri(t, e, n) {
1771
- return n ? typeof t == "object" ? Ao(t) ? n : null : Oo(t)(t, e, n) : null;
1767
+ function Mi(t, e, n) {
1768
+ return n ? typeof t == "object" ? Eo(t) ? n : null : So(t)(t, e, n) : null;
1772
1769
  }
1773
- function jo(t, e, n) {
1770
+ function Ao(t, e, n) {
1774
1771
  return t.reduce((r, i, s) => {
1775
1772
  const o = e[s];
1776
- return Ri(i, o, r);
1773
+ return Mi(i, o, r);
1777
1774
  }, n);
1778
1775
  }
1779
- function ko(t, e, n) {
1780
- return Io(t, e, n).map((r) => jo(e, r, n)).filter((r) => r);
1776
+ function jo(t, e, n) {
1777
+ return Po(t, e, n).map((r) => Ao(e, r, n)).filter((r) => r);
1781
1778
  }
1782
- function Co(t, e, n) {
1783
- return e.or ? e.or.patterns.flatMap((r) => ln(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => ln(t, i, r), n) : n.flatMap((r) => ko(t, e, r));
1779
+ function ko(t, e, n) {
1780
+ return e.or ? e.or.patterns.flatMap((r) => fn(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => fn(t, i, r), n) : n.flatMap((r) => jo(t, e, r));
1784
1781
  }
1785
- function ln(t, e, n = [{}]) {
1786
- return e.reduce((r, i) => Co(t, i, r), n);
1782
+ function fn(t, e, n = [{}]) {
1783
+ return e.reduce((r, i) => ko(t, i, r), n);
1787
1784
  }
1788
- function zn(t, e) {
1789
- return Array.isArray(e) ? e.map((n) => zn(t, n)) : vo(e) ? t[e] : e;
1785
+ function Wn(t, e) {
1786
+ return Array.isArray(e) ? e.map((n) => Wn(t, n)) : mo(e) ? t[e] : e;
1790
1787
  }
1791
- function Po(t, { find: e, where: n }) {
1792
- return ln(t, n).map((i) => zn(i, e));
1788
+ function Co(t, { find: e, where: n }) {
1789
+ return fn(t, n).map((i) => Wn(i, e));
1793
1790
  }
1794
- function Io(t, e, n) {
1795
- return _o(t, zn(n, e));
1791
+ function Po(t, e, n) {
1792
+ return bo(t, Wn(n, e));
1796
1793
  }
1797
- const Mo = /^(?:[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;
1794
+ const Io = /^(?:[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;
1798
1795
  function Fe(t) {
1799
- return typeof t == "string" && Mo.test(t);
1796
+ return typeof t == "string" && Io.test(t);
1800
1797
  }
1801
1798
  const q = [];
1802
1799
  for (let t = 0; t < 256; ++t)
1803
1800
  q.push((t + 256).toString(16).slice(1));
1804
- function Ro(t, e = 0) {
1801
+ function Mo(t, e = 0) {
1805
1802
  return (q[t[e + 0]] + q[t[e + 1]] + q[t[e + 2]] + q[t[e + 3]] + "-" + q[t[e + 4]] + q[t[e + 5]] + "-" + q[t[e + 6]] + q[t[e + 7]] + "-" + q[t[e + 8]] + q[t[e + 9]] + "-" + q[t[e + 10]] + q[t[e + 11]] + q[t[e + 12]] + q[t[e + 13]] + q[t[e + 14]] + q[t[e + 15]]).toLowerCase();
1806
1803
  }
1807
- let Jt;
1808
- const xo = new Uint8Array(16);
1809
- function $o() {
1810
- if (!Jt) {
1804
+ let Yt;
1805
+ const Ro = new Uint8Array(16);
1806
+ function xo() {
1807
+ if (!Yt) {
1811
1808
  if (typeof crypto > "u" || !crypto.getRandomValues)
1812
1809
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1813
- Jt = crypto.getRandomValues.bind(crypto);
1810
+ Yt = crypto.getRandomValues.bind(crypto);
1814
1811
  }
1815
- return Jt(xo);
1812
+ return Yt(Ro);
1816
1813
  }
1817
- const Do = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), jr = { randomUUID: Do };
1818
- function Uo(t, e, n) {
1814
+ const $o = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ar = { randomUUID: $o };
1815
+ function Do(t, e, n) {
1819
1816
  var i;
1820
- if (jr.randomUUID && !t)
1821
- return jr.randomUUID();
1817
+ if (Ar.randomUUID && !t)
1818
+ return Ar.randomUUID();
1822
1819
  t = t || {};
1823
- const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? $o();
1820
+ const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? xo();
1824
1821
  if (r.length < 16)
1825
1822
  throw new Error("Random bytes length must be >= 16");
1826
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Ro(r);
1823
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Mo(r);
1827
1824
  }
1828
- function kr(t) {
1825
+ function jr(t) {
1829
1826
  const e = t.replace(/-/g, ""), n = [];
1830
1827
  for (let r = 0; r < e.length; r += 2)
1831
1828
  n.push(parseInt(e.substring(r, r + 2), 16));
1832
1829
  return n;
1833
1830
  }
1834
- function Lo(t, e) {
1831
+ function Uo(t, e) {
1835
1832
  for (let n = 0; n < t.length; n++) {
1836
1833
  if (t[n] < e[n])
1837
1834
  return -1;
@@ -1840,17 +1837,17 @@ function Lo(t, e) {
1840
1837
  }
1841
1838
  return 0;
1842
1839
  }
1843
- function Fo(t, e) {
1844
- return Lo(kr(t), kr(e));
1840
+ function Lo(t, e) {
1841
+ return Uo(jr(t), jr(e));
1845
1842
  }
1846
1843
  function K() {
1847
- return Uo();
1844
+ return Do();
1848
1845
  }
1849
- function No(t, e) {
1846
+ function Fo(t, e) {
1850
1847
  return t.localeCompare(e);
1851
1848
  }
1852
- function Ko() {
1853
- let t = No;
1849
+ function No() {
1850
+ let t = Fo;
1854
1851
  if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
1855
1852
  try {
1856
1853
  t = Intl.Collator("en-US").compare;
@@ -1858,10 +1855,10 @@ function Ko() {
1858
1855
  }
1859
1856
  return t;
1860
1857
  }
1861
- const qo = Ko();
1862
- let Wo = 0;
1858
+ const Ko = No();
1859
+ let qo = 0;
1863
1860
  function rt(t) {
1864
- return $t(`_${t}`, Wo++);
1861
+ return $t(`_${t}`, qo++);
1865
1862
  }
1866
1863
  function $t(t, e) {
1867
1864
  return `?${t}-${e}`;
@@ -1871,28 +1868,28 @@ class Ne extends Error {
1871
1868
  super(e), this.name = "AttrNotFoundError";
1872
1869
  }
1873
1870
  }
1874
- function zo(t, e) {
1875
- const n = Mi(t, e);
1871
+ function Wo(t, e) {
1872
+ const n = Ii(t, e);
1876
1873
  if (!n)
1877
1874
  throw new Ne(`Could not find id attr for ${e}`);
1878
1875
  return n;
1879
1876
  }
1880
- function Cr(t, e, n, r) {
1881
- return [Vo(t, e, n, r)];
1877
+ function kr(t, e, n, r) {
1878
+ return [zo(t, e, n, r)];
1882
1879
  }
1883
- function Vo(t, e, n, r) {
1880
+ function zo(t, e, n, r) {
1884
1881
  return [
1885
1882
  t(n, r),
1886
- zo(e, n).id,
1883
+ Wo(e, n).id,
1887
1884
  t(n, r),
1888
1885
  t("time", r)
1889
1886
  ];
1890
1887
  }
1891
- function Bo(t, e, n) {
1888
+ function Vo(t, e, n) {
1892
1889
  return t.map((r) => r === e ? n : r);
1893
1890
  }
1894
- function xi(t, e, n, r, i) {
1895
- const s = Te(e, n, i), o = Ii(e, n, i), a = s || o;
1891
+ function Ri(t, e, n, r, i) {
1892
+ const s = Te(e, n, i), o = Pi(e, n, i), a = s || o;
1896
1893
  if (!a)
1897
1894
  throw new Ne(`Could not find attr for ${[n, i]}`);
1898
1895
  if (a["value-type"] !== "ref")
@@ -1910,7 +1907,7 @@ function xi(t, e, n, r, i) {
1910
1907
  ];
1911
1908
  return [s ? f : c, l, p, a, !!s];
1912
1909
  }
1913
- function Pr(t, e) {
1910
+ function Cr(t, e) {
1914
1911
  if (typeof e != "string")
1915
1912
  return function(o) {
1916
1913
  return !1;
@@ -1920,7 +1917,7 @@ function Pr(t, e) {
1920
1917
  return typeof o != "string" ? !1 : i.test(o);
1921
1918
  };
1922
1919
  }
1923
- function Go(t, e) {
1920
+ function Bo(t, e) {
1924
1921
  if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
1925
1922
  return e;
1926
1923
  const n = t["checked-data-type"] === "date";
@@ -1961,7 +1958,7 @@ function Go(t, e) {
1961
1958
  }
1962
1959
  };
1963
1960
  if (e.hasOwnProperty("$like")) {
1964
- const r = Pr(!0, e.$like);
1961
+ const r = Cr(!0, e.$like);
1965
1962
  return {
1966
1963
  $comparator: !0,
1967
1964
  $op: function(s) {
@@ -1970,7 +1967,7 @@ function Go(t, e) {
1970
1967
  };
1971
1968
  }
1972
1969
  if (e.hasOwnProperty("$ilike")) {
1973
- const r = Pr(!1, e.$ilike);
1970
+ const r = Cr(!1, e.$ilike);
1974
1971
  return {
1975
1972
  $comparator: !0,
1976
1973
  $op: function(s) {
@@ -1980,8 +1977,8 @@ function Go(t, e) {
1980
1977
  }
1981
1978
  return e;
1982
1979
  }
1983
- function Qo(t, e, n, r, i, s) {
1984
- const o = Te(e, n, i), a = Ii(e, n, i), u = o || a;
1980
+ function Go(t, e, n, r, i, s) {
1981
+ const o = Te(e, n, i), a = Pi(e, n, i), u = o || a;
1985
1982
  if (!u)
1986
1983
  throw new Ne(`No attr for etype = ${n} label = ${i}`);
1987
1984
  if (s != null && s.hasOwnProperty("$isNull")) {
@@ -1998,63 +1995,63 @@ function Qo(t, e, n, r, i, s) {
1998
1995
  return o ? [
1999
1996
  t(n, r),
2000
1997
  u.id,
2001
- Go(u, s),
1998
+ Bo(u, s),
2002
1999
  rt("time")
2003
2000
  ] : [s, u.id, t(n, r), rt("time")];
2004
2001
  }
2005
- function Ho(t, e, n, r, i) {
2002
+ function Qo(t, e, n, r, i) {
2006
2003
  const [s, o, a] = i.reduce((u, c) => {
2007
- const [d, f, l] = u, [p, y, b] = xi(t, e, d, f, c);
2004
+ const [d, f, l] = u, [p, y, b] = Ri(t, e, d, f, c);
2008
2005
  return [p, y, [...l, b]];
2009
2006
  }, [n, r, []]);
2010
2007
  return [s, o, a];
2011
2008
  }
2012
- function hn(t, e, n, r, i, s) {
2013
- const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, c, d] = Ho(t, e, n, r, o), f = Qo(t, e, u, c, a, s);
2009
+ function ln(t, e, n, r, i, s) {
2010
+ const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, c, d] = Qo(t, e, n, r, o), f = Go(t, e, u, c, a, s);
2014
2011
  return d.concat([f]);
2015
2012
  }
2016
- function Yo(t, e) {
2013
+ function Ho(t, e) {
2017
2014
  return e ? [e].concat(t) : t;
2018
2015
  }
2019
- function Jo([t, e]) {
2016
+ function Yo([t, e]) {
2020
2017
  return t === "or" && Array.isArray(e);
2021
2018
  }
2022
- function Zo([t, e]) {
2019
+ function Jo([t, e]) {
2023
2020
  return t === "and" && Array.isArray(e);
2024
2021
  }
2025
- function Xo(t, e, n) {
2022
+ function Zo(t, e, n) {
2026
2023
  return (r, i) => {
2027
2024
  const s = t(r, i);
2028
2025
  return e == s ? s : `${s}-${n}`;
2029
2026
  };
2030
2027
  }
2031
- function Ir(t, e, n, r, i, s) {
2028
+ function Pr(t, e, n, r, i, s) {
2032
2029
  const o = t(r, i), a = s.map((u, c) => {
2033
- const d = Xo(t, o, c);
2034
- return $i(d, n, r, i, u);
2030
+ const d = Zo(t, o, c);
2031
+ return xi(d, n, r, i, u);
2035
2032
  });
2036
2033
  return { [e]: { patterns: a, joinSym: o } };
2037
2034
  }
2038
- function ea(t) {
2035
+ function Xo(t) {
2039
2036
  const e = [];
2040
2037
  for (let n = 1; n <= t.length; n++)
2041
2038
  e.push(t.slice(0, n));
2042
2039
  return e;
2043
2040
  }
2044
- function Mr(t, e, n, r, i) {
2045
- return ea(i).map((s) => hn(t, e, n, r, s, { $isNull: !0 }));
2041
+ function Ir(t, e, n, r, i) {
2042
+ return Xo(i).map((s) => ln(t, e, n, r, s, { $isNull: !0 }));
2046
2043
  }
2047
- function $i(t, e, n, r, i) {
2044
+ function xi(t, e, n, r, i) {
2048
2045
  return Object.entries(i).flatMap(([s, o]) => {
2046
+ if (Yo([s, o]))
2047
+ return Pr(t, "or", e, n, r, o);
2049
2048
  if (Jo([s, o]))
2050
- return Ir(t, "or", e, n, r, o);
2051
- if (Zo([s, o]))
2052
- return Ir(t, "and", e, n, r, o);
2049
+ return Pr(t, "and", e, n, r, o);
2053
2050
  if (s === "$entityIdStartsWith")
2054
2051
  return [];
2055
2052
  const a = s.split(".");
2056
2053
  if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
2057
- const u = hn(t, e, n, r, a, o), c = Mr(t, e, n, r, a);
2054
+ const u = ln(t, e, n, r, a, o), c = Ir(t, e, n, r, a);
2058
2055
  return [
2059
2056
  {
2060
2057
  or: {
@@ -2067,32 +2064,32 @@ function $i(t, e, n, r, i) {
2067
2064
  return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && a.length > 1 ? [
2068
2065
  {
2069
2066
  or: {
2070
- patterns: Mr(t, e, n, r, a),
2067
+ patterns: Ir(t, e, n, r, a),
2071
2068
  joinSym: t(n, r)
2072
2069
  }
2073
2070
  }
2074
- ] : hn(t, e, n, r, a, o);
2071
+ ] : ln(t, e, n, r, a, o);
2075
2072
  });
2076
2073
  }
2077
- function ta(t, e, n, r) {
2074
+ function ea(t, e, n, r) {
2078
2075
  const i = $t;
2079
- return r ? $i(i, t, e, n, r).concat(Cr(i, t, e, n)) : Cr(i, t, e, n);
2076
+ return r ? xi(i, t, e, n, r).concat(kr(i, t, e, n)) : kr(i, t, e, n);
2080
2077
  }
2081
- function na(t, e, n) {
2078
+ function ta(t, e, n) {
2082
2079
  return [t(e, n), t("time", n)];
2083
2080
  }
2084
- function ra(t, e, n, r, i, s) {
2085
- const [o, a, u, c, d] = xi(t, e, n, r, i), f = Bo(u, t(n, r), s);
2081
+ function na(t, e, n, r, i, s) {
2082
+ const [o, a, u, c, d] = Ri(t, e, n, r, i), f = Vo(u, t(n, r), s);
2086
2083
  return [o, a, f, c, d];
2087
2084
  }
2088
- function ia(t, e, { etype: n, level: r, form: i }, s) {
2085
+ function ra(t, e, { etype: n, level: r, form: i }, s) {
2089
2086
  const o = Object.keys(i).filter((a) => a !== "$");
2090
2087
  return o.length ? Object.entries(s).map(function([u, c]) {
2091
2088
  return o.map(function(l) {
2092
2089
  var p, y, b;
2093
2090
  const _ = !!(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));
2094
2091
  try {
2095
- const [w, g, m] = ra(t, e, n, r, l, u), E = Ui(e, {
2092
+ const [w, g, m] = na(t, e, n, r, l, u), E = Di(e, {
2096
2093
  etype: w,
2097
2094
  level: g,
2098
2095
  form: i[l],
@@ -2109,48 +2106,48 @@ function ia(t, e, { etype: n, level: r, form: i }, s) {
2109
2106
  }, c);
2110
2107
  }) : Object.values(s);
2111
2108
  }
2112
- function sa(t, e, n) {
2113
- return n === "string" ? qo(t, e) : t > e ? 1 : -1;
2109
+ function ia(t, e, n) {
2110
+ return n === "string" ? Ko(t, e) : t > e ? 1 : -1;
2114
2111
  }
2115
2112
  function Xe(t, e, n, r, i) {
2116
- return e === r || e == null && r == null ? Fo(t, n) : r == null ? 1 : e == null ? -1 : sa(e, r, i);
2113
+ return e === r || e == null && r == null ? Lo(t, n) : r == null ? 1 : e == null ? -1 : ia(e, r, i);
2117
2114
  }
2118
2115
  function It([t, e], [n, r], i) {
2119
2116
  return Xe(t, e, n, r, i);
2120
2117
  }
2121
- function pn(t) {
2118
+ function hn(t) {
2122
2119
  return t == null ? t : new Date(t).getTime();
2123
2120
  }
2124
- function oa(t, e, n, r) {
2121
+ function sa(t, e, n, r) {
2125
2122
  var i;
2126
2123
  const [s, o, a, u] = t, c = n === "desc" ? 1 : -1;
2127
2124
  if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
2128
2125
  return It(r, [s, u], null) === c;
2129
- const [d, f] = r, l = e["checked-data-type"], p = l === "date" ? pn(f) : f, y = l === "date" ? pn(a) : a;
2126
+ const [d, f] = r, l = e["checked-data-type"], p = l === "date" ? hn(f) : f, y = l === "date" ? hn(a) : a;
2130
2127
  return It([d, p], [s, y], l) === c;
2131
2128
  }
2132
- function aa(t, e) {
2129
+ function oa(t, e) {
2133
2130
  const n = e[1];
2134
2131
  return t.attrs[n];
2135
2132
  }
2136
- function ua(t, e, n) {
2133
+ function aa(t, e, n) {
2137
2134
  const r = Object.keys(n)[0];
2138
2135
  return Te(t, e, r);
2139
2136
  }
2140
- function ca(t, e, n, r) {
2137
+ function ua(t, e, n, r) {
2141
2138
  if (n)
2142
- return aa(t, n);
2139
+ return oa(t, n);
2143
2140
  if (r)
2144
- return ua(t, e, r);
2141
+ return aa(t, e, r);
2145
2142
  }
2146
- function da(t, e, n) {
2143
+ function ca(t, e, n) {
2147
2144
  var r, i;
2148
2145
  if (!Array.isArray(n.fields))
2149
- return To(t, e);
2146
+ return go(t, e);
2150
2147
  const s = /* @__PURE__ */ new Map();
2151
2148
  for (const o of n.fields) {
2152
2149
  const a = Te(t, e, o), u = (r = a == null ? void 0 : a["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
2153
- u && qn(a) && s.set(u, a);
2150
+ u && Kn(a) && s.set(u, a);
2154
2151
  }
2155
2152
  if (!s.has("id")) {
2156
2153
  const o = Te(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
@@ -2158,17 +2155,17 @@ function da(t, e, n) {
2158
2155
  }
2159
2156
  return s;
2160
2157
  }
2161
- function fa(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2158
+ function da(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2162
2159
  var s, o;
2163
- const a = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, u = Di(i), c = la(i);
2164
- let d = Po(t, r);
2165
- const f = n == null ? void 0 : n["start-cursor"], l = ca(t, e, f, a);
2160
+ const a = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, u = $i(i), c = fa(i);
2161
+ let d = Co(t, r);
2162
+ const f = n == null ? void 0 : n["start-cursor"], l = ua(t, e, f, a);
2166
2163
  if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
2167
2164
  const b = l["checked-data-type"] === "date", _ = l.id;
2168
2165
  d = d.map(([w]) => {
2169
2166
  var g, m, E, S, I;
2170
2167
  let x = (I = (S = (E = (m = (g = t.eav.get(w)) === null || g === void 0 ? void 0 : g.get(_)) === null || m === void 0 ? void 0 : m.values()) === null || E === void 0 ? void 0 : E.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
2171
- return b && (x = pn(x)), [w, x];
2168
+ return b && (x = hn(x)), [w, x];
2172
2169
  });
2173
2170
  }
2174
2171
  d.sort(c === "asc" ? function(_, w) {
@@ -2177,31 +2174,31 @@ function fa(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2177
2174
  return It(w, _, l == null ? void 0 : l["checked-data-type"]);
2178
2175
  });
2179
2176
  let p = {};
2180
- const y = da(t, e, r);
2177
+ const y = ca(t, e, r);
2181
2178
  for (const b of d) {
2182
2179
  const [_] = b;
2183
- if (p[_] || !u && f && l && oa(f, l, c, b))
2180
+ if (p[_] || !u && f && l && sa(f, l, c, b))
2184
2181
  continue;
2185
- const w = go(t, y, _);
2182
+ const w = _o(t, y, _);
2186
2183
  w && (p[_] = w);
2187
2184
  }
2188
2185
  return p;
2189
2186
  }
2190
- function la(t) {
2187
+ function fa(t) {
2191
2188
  var e;
2192
2189
  const n = (e = t.$) === null || e === void 0 ? void 0 : e.order;
2193
2190
  return n && n[Object.keys(n)[0]] || "asc";
2194
2191
  }
2195
- function Di(t) {
2192
+ function $i(t) {
2196
2193
  var e, n, r;
2197
2194
  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;
2198
2195
  return !i && !s && !o;
2199
2196
  }
2200
- function ha(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
2197
+ function la(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
2201
2198
  var o, a, u, c, d;
2202
- if (!Di(r) && (!s || !s["start-cursor"]))
2199
+ if (!$i(r) && (!s || !s["start-cursor"]))
2203
2200
  return [];
2204
- const f = Yo(ta(t, e, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), l = na($t, e, n), p = (a = r.$) === null || a === void 0 ? void 0 : a.fields, y = fa(t, {
2201
+ const f = Ho(ea(t, e, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), l = ta($t, e, n), p = (a = r.$) === null || a === void 0 ? void 0 : a.fields, y = da(t, {
2205
2202
  etype: e,
2206
2203
  pageInfo: s,
2207
2204
  form: r,
@@ -2214,20 +2211,20 @@ function ha(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
2214
2211
  }
2215
2212
  return y;
2216
2213
  }
2217
- function pa(t, e) {
2214
+ function ha(t, e) {
2218
2215
  try {
2219
- return ha(t, e);
2216
+ return la(t, e);
2220
2217
  } catch (n) {
2221
2218
  if (n instanceof Ne)
2222
2219
  return {};
2223
2220
  throw n;
2224
2221
  }
2225
2222
  }
2226
- function Ui(t, e) {
2227
- const n = pa(t, e);
2228
- return ia($t, t, e, n);
2223
+ function Di(t, e) {
2224
+ const n = ha(t, e);
2225
+ return ra($t, t, e, n);
2229
2226
  }
2230
- function ya(t) {
2227
+ function pa(t) {
2231
2228
  const e = {};
2232
2229
  for (const [n, r] of Object.entries(t))
2233
2230
  e[n] = {
@@ -2238,18 +2235,18 @@ function ya(t) {
2238
2235
  };
2239
2236
  return e;
2240
2237
  }
2241
- function Li({ store: t, pageInfo: e, aggregate: n }, r) {
2238
+ function Ui({ store: t, pageInfo: e, aggregate: n }, r) {
2242
2239
  const s = { data: Object.keys(r).reduce(function(a, u) {
2243
- return n != null && n[u] || u === "$$ruleParams" || (a[u] = Ui(t, {
2240
+ return n != null && n[u] || u === "$$ruleParams" || (a[u] = Di(t, {
2244
2241
  etype: u,
2245
2242
  form: r[u],
2246
2243
  level: 0,
2247
2244
  pageInfo: e == null ? void 0 : e[u]
2248
2245
  })), a;
2249
2246
  }, {}) };
2250
- return e && (s.pageInfo = ya(e)), n && (s.aggregate = n), s;
2247
+ return e && (s.pageInfo = pa(e)), n && (s.aggregate = n), s;
2251
2248
  }
2252
- function ba() {
2249
+ function ya() {
2253
2250
  const e = {
2254
2251
  __etype: 1,
2255
2252
  __ops: 1,
@@ -2263,8 +2260,8 @@ function ba() {
2263
2260
  };
2264
2261
  return new Set(Object.keys(e));
2265
2262
  }
2266
- const _a = ba();
2267
- function yn(t, e, n) {
2263
+ const ba = ya();
2264
+ function pn(t, e, n) {
2268
2265
  const r = {
2269
2266
  __etype: t,
2270
2267
  __ops: n
@@ -2275,25 +2272,25 @@ function yn(t, e, n) {
2275
2272
  return n;
2276
2273
  if (s === "__etype")
2277
2274
  return t;
2278
- if (_a.has(s))
2279
- return (o, a) => yn(t, e, [
2275
+ if (ba.has(s))
2276
+ return (o, a) => pn(t, e, [
2280
2277
  ...n,
2281
2278
  a ? [s, t, e, o, a] : [s, t, e, o]
2282
2279
  ]);
2283
2280
  }
2284
2281
  });
2285
2282
  }
2286
- function Kc(t, e) {
2283
+ function Nc(t, e) {
2287
2284
  return `lookup__${t}__${JSON.stringify(e)}`;
2288
2285
  }
2289
2286
  function Mt(t) {
2290
2287
  return t.startsWith("lookup__");
2291
2288
  }
2292
- function Fi(t) {
2289
+ function Li(t) {
2293
2290
  const [e, n, ...r] = t.split("__");
2294
2291
  return [n, JSON.parse(r.join("__"))];
2295
2292
  }
2296
- function ga(t) {
2293
+ function _a(t) {
2297
2294
  return new Proxy({
2298
2295
  __etype: t
2299
2296
  }, {
@@ -2301,22 +2298,22 @@ function ga(t) {
2301
2298
  if (n === "__etype")
2302
2299
  return t;
2303
2300
  const r = n;
2304
- return Mt(r) ? yn(t, Fi(r), []) : yn(t, r, []);
2301
+ return Mt(r) ? pn(t, Li(r), []) : pn(t, r, []);
2305
2302
  }
2306
2303
  });
2307
2304
  }
2308
- function Vn() {
2305
+ function zn() {
2309
2306
  return new Proxy({}, {
2310
2307
  get(t, e) {
2311
- return ga(e);
2308
+ return _a(e);
2312
2309
  }
2313
2310
  });
2314
2311
  }
2315
- const qc = Vn();
2316
- function Ta(t) {
2312
+ const Kc = zn();
2313
+ function ga(t) {
2317
2314
  return t.__ops;
2318
2315
  }
2319
- function wa(t, e) {
2316
+ function Ta(t, e) {
2320
2317
  const { attrIdMap: n, refSwapAttrIds: r } = t, i = [];
2321
2318
  for (const o of e) {
2322
2319
  const a = n[o];
@@ -2350,7 +2347,7 @@ function Ae(t, e, n) {
2350
2347
  return o === e && a === n;
2351
2348
  });
2352
2349
  }
2353
- function ma(t) {
2350
+ function wa(t) {
2354
2351
  if (Array.isArray(t))
2355
2352
  return t;
2356
2353
  const e = Object.entries(t);
@@ -2358,38 +2355,38 @@ function ma(t) {
2358
2355
  throw new Error("lookup must be an object with a single unique attr and value.");
2359
2356
  return e[0];
2360
2357
  }
2361
- function bn(t, e, n) {
2358
+ function yn(t, e, n) {
2362
2359
  return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
2363
2360
  // before assuming it's a ref lookup.
2364
2361
  !V(t, e, n);
2365
2362
  }
2366
- function _n(t) {
2363
+ function bn(t) {
2367
2364
  const [e, n, ...r] = t.split(".");
2368
2365
  if (r.length > 0 || n !== "id")
2369
2366
  throw new Error(`${t} is not a valid lookup attribute.`);
2370
2367
  return e;
2371
2368
  }
2372
- function va(t, e, n) {
2373
- if (!bn(t, e, n))
2369
+ function ma(t, e, n) {
2370
+ if (!yn(t, e, n))
2374
2371
  return V(t, e, n);
2375
- const r = _n(n), i = V(t, e, r) || Ae(t, e, r);
2372
+ const r = bn(n), i = V(t, e, r) || Ae(t, e, r);
2376
2373
  if (i && i["value-type"] !== "ref")
2377
2374
  throw new Error(`${n} does not reference a valid link attribute.`);
2378
2375
  return i;
2379
2376
  }
2380
- function gn(t) {
2381
- return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? Fi(t) : ma(t);
2377
+ function _n(t) {
2378
+ return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? Li(t) : wa(t);
2382
2379
  }
2383
2380
  function ee(t, e, n) {
2384
- const r = gn(n);
2381
+ const r = _n(n);
2385
2382
  if (r === null)
2386
2383
  return n;
2387
- const [i, s] = r, o = va(t, e, i);
2384
+ const [i, s] = r, o = ma(t, e, i);
2388
2385
  if (!o || !o["unique?"])
2389
2386
  throw new Error(`${i} is not a unique attribute.`);
2390
2387
  return [o.id, s];
2391
2388
  }
2392
- function Ni(t, e, n, r) {
2389
+ function Fi(t, e, n, r) {
2393
2390
  const i = ee(t, e, n);
2394
2391
  return Array.isArray(i) ? [[
2395
2392
  "add-triple",
@@ -2398,7 +2395,7 @@ function Ni(t, e, n, r) {
2398
2395
  i
2399
2396
  ]].concat(r) : r;
2400
2397
  }
2401
- function Sa({ attrs: t }, [e, n, r]) {
2398
+ function va({ attrs: t }, [e, n, r]) {
2402
2399
  const i = Object.entries(r).flatMap(([s, o]) => {
2403
2400
  const a = Array.isArray(o) ? o : [o], u = V(t, e, s), c = Ae(t, e, s);
2404
2401
  return a.map((d) => u ? [
@@ -2413,9 +2410,9 @@ function Sa({ attrs: t }, [e, n, r]) {
2413
2410
  ee(t, e, n)
2414
2411
  ]);
2415
2412
  });
2416
- return Ni(t, e, n, i);
2413
+ return Fi(t, e, n, i);
2417
2414
  }
2418
- function Oa({ attrs: t }, [e, n, r]) {
2415
+ function Sa({ attrs: t }, [e, n, r]) {
2419
2416
  const i = Object.entries(r).flatMap(([s, o]) => {
2420
2417
  const a = Array.isArray(o) ? o : [o], u = V(t, e, s), c = Ae(t, e, s);
2421
2418
  return a.map((d) => u ? [
@@ -2430,9 +2427,9 @@ function Oa({ attrs: t }, [e, n, r]) {
2430
2427
  ee(t, e, n)
2431
2428
  ]);
2432
2429
  });
2433
- return Ni(t, e, n, i);
2430
+ return Fi(t, e, n, i);
2434
2431
  }
2435
- function Ea(t, e, n) {
2432
+ function Oa(t, e, n) {
2436
2433
  if (Array.isArray(n)) {
2437
2434
  const [r, i] = n;
2438
2435
  for (const s of t || []) {
@@ -2454,18 +2451,18 @@ function Ea(t, e, n) {
2454
2451
  }
2455
2452
  return !1;
2456
2453
  }
2457
- function Ki({ stores: t, attrs: e }, [n, r, i, s]) {
2458
- return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : Ea(t, n, r) ? { mode: "update" } : null;
2454
+ function Ni({ stores: t, attrs: e }, [n, r, i, s]) {
2455
+ return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : Oa(t, n, r) ? { mode: "update" } : null;
2459
2456
  }
2460
- function Aa(t, e) {
2461
- const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Nn(o), c = ee(r, i, s);
2457
+ function Ea(t, e) {
2458
+ const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Fn(o), c = ee(r, i, s);
2462
2459
  return [["id", c]].concat(Object.entries(u)).map(([f, l]) => {
2463
2460
  const p = V(r, i, f);
2464
2461
  return p["checked-data-type"] === "date" && t.useDateObjects && (l = xt(l)), ["add-triple", c, p.id, l, { mode: "create" }];
2465
2462
  });
2466
2463
  }
2467
- function ja(t, e) {
2468
- const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Nn(o), c = ee(r, i, s), d = Ki(t, [i, c, o, a]);
2464
+ function Aa(t, e) {
2465
+ const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Fn(o), c = ee(r, i, s), d = Ni(t, [i, c, o, a]);
2469
2466
  return [["id", c]].concat(Object.entries(u)).map(([l, p]) => {
2470
2467
  const y = V(r, i, l);
2471
2468
  return y["checked-data-type"] === "date" && t.useDateObjects && (p = xt(p)), [
@@ -2477,11 +2474,11 @@ function ja(t, e) {
2477
2474
  ];
2478
2475
  });
2479
2476
  }
2480
- function ka({ attrs: t }, [e, n]) {
2477
+ function ja({ attrs: t }, [e, n]) {
2481
2478
  return [["delete-entity", ee(t, e, n), e]];
2482
2479
  }
2483
- function Ca(t, e) {
2484
- const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Nn(o), c = ee(r, i, s), d = Ki(t, [i, c, o, a]), f = Object.entries(u).map(([p, y]) => {
2480
+ function ka(t, e) {
2481
+ const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Fn(o), c = ee(r, i, s), d = Ni(t, [i, c, o, a]), f = Object.entries(u).map(([p, y]) => {
2485
2482
  const b = V(r, i, p);
2486
2483
  return [
2487
2484
  "deep-merge-triple",
@@ -2499,38 +2496,38 @@ function Ca(t, e) {
2499
2496
  ...d ? [d] : []
2500
2497
  ]].concat(f);
2501
2498
  }
2502
- function Pa({ attrs: t }, [e, n, r]) {
2499
+ function Ca({ attrs: t }, [e, n, r]) {
2503
2500
  return [["rule-params", ee(t, e, n), e, r]];
2504
2501
  }
2505
- function Ia(t) {
2502
+ function Pa(t) {
2506
2503
  const [e, n, r, i, s] = t;
2507
2504
  if (!i)
2508
2505
  return t;
2509
2506
  const o = Object.assign({}, i);
2510
2507
  return delete o.id, [e, n, r, o, ...s ? [s] : []];
2511
2508
  }
2512
- function Ma(t, e) {
2513
- const [n, ...r] = Ia(e);
2509
+ function Ia(t, e) {
2510
+ const [n, ...r] = Pa(e);
2514
2511
  switch (n) {
2515
2512
  case "merge":
2516
- return Ca(t, r);
2513
+ return ka(t, r);
2517
2514
  case "create":
2518
- return Aa(t, r);
2515
+ return Ea(t, r);
2519
2516
  case "update":
2520
- return ja(t, r);
2517
+ return Aa(t, r);
2521
2518
  case "link":
2522
- return Sa(t, r);
2519
+ return va(t, r);
2523
2520
  case "unlink":
2524
- return Oa(t, r);
2521
+ return Sa(t, r);
2525
2522
  case "delete":
2526
- return ka(t, r);
2523
+ return ja(t, r);
2527
2524
  case "ruleParams":
2528
- return Pa(t, r);
2525
+ return Ca(t, r);
2529
2526
  default:
2530
2527
  throw new Error(`unsupported action ${n}`);
2531
2528
  }
2532
2529
  }
2533
- function Ra(t) {
2530
+ function Ma(t) {
2534
2531
  switch (t) {
2535
2532
  case "string":
2536
2533
  case "date":
@@ -2541,14 +2538,14 @@ function Ra(t) {
2541
2538
  return;
2542
2539
  }
2543
2540
  }
2544
- function xa(t, e, n) {
2541
+ function Ra(t, e, n) {
2545
2542
  var r, i;
2546
2543
  const s = (i = (r = t.entities[e]) === null || r === void 0 ? void 0 : r.attrs) === null || i === void 0 ? void 0 : i[n];
2547
2544
  if (n === "id")
2548
2545
  return null;
2549
2546
  if (!s)
2550
2547
  throw new Error(`${e}.${n} does not exist in your schema`);
2551
- const { unique: o, indexed: a } = s == null ? void 0 : s.config, u = Ra(s == null ? void 0 : s.valueType);
2548
+ const { unique: o, indexed: a } = s == null ? void 0 : s.config, u = Ma(s == null ? void 0 : s.valueType);
2552
2549
  return {
2553
2550
  "index?": a,
2554
2551
  "unique?": o,
@@ -2556,14 +2553,14 @@ function xa(t, e, n) {
2556
2553
  };
2557
2554
  }
2558
2555
  function Tt(t, e, n, r) {
2559
- const i = t ? xa(t, e, n) : null, s = K(), a = [K(), e, n];
2556
+ const i = t ? Ra(t, e, n) : null, s = K(), a = [K(), e, n];
2560
2557
  return Object.assign(Object.assign({ id: s, "forward-identity": a, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
2561
2558
  }
2562
- function $a(t, e, n) {
2559
+ function xa(t, e, n) {
2563
2560
  return Object.values(t.links).find((i) => i.forward.on === e && i.forward.label === n || i.reverse.on === e && i.reverse.label === n);
2564
2561
  }
2565
- function Da(t, e, n) {
2566
- const r = $a(t, e, n);
2562
+ function $a(t, e, n) {
2563
+ const r = xa(t, e, n);
2567
2564
  if (!r)
2568
2565
  throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
2569
2566
  const { forward: i, reverse: s } = r;
@@ -2576,11 +2573,11 @@ function Da(t, e, n) {
2576
2573
  "on-delete-reverse": s.onDelete
2577
2574
  };
2578
2575
  }
2579
- function Rr(t, e, n, r) {
2580
- const i = t ? Da(t, e, n) : null, s = K(), o = [K(), e, n], a = [K(), n, e];
2576
+ function Mr(t, e, n, r) {
2577
+ const i = t ? $a(t, e, n) : null, s = K(), o = [K(), e, n], a = [K(), n, e];
2581
2578
  return Object.assign(Object.assign({ id: s, "forward-identity": o, "reverse-identity": a, "value-type": "ref", cardinality: "many", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
2582
2579
  }
2583
- const Ua = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), La = /* @__PURE__ */ new Set(["link", "unlink"]), Fa = /* @__PURE__ */ new Set(["create", "update", "merge"]), Na = /* @__PURE__ */ new Set([
2580
+ const Da = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Ua = /* @__PURE__ */ new Set(["link", "unlink"]), La = /* @__PURE__ */ new Set(["create", "update", "merge"]), Fa = /* @__PURE__ */ new Set([
2584
2581
  "link",
2585
2582
  "unlink",
2586
2583
  "create",
@@ -2588,17 +2585,17 @@ const Ua = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
2588
2585
  "merge",
2589
2586
  "delete",
2590
2587
  "ruleParams"
2591
- ]), Tn = { "unique?": !0, "index?": !0 }, Ka = Object.assign(Object.assign({}, Tn), { cardinality: "one" });
2592
- function qa(t) {
2588
+ ]), gn = { "unique?": !0, "index?": !0 }, Na = Object.assign(Object.assign({}, gn), { cardinality: "one" });
2589
+ function Ka(t) {
2593
2590
  const e = [], [n, r, i, s] = t;
2594
- if (!Na.has(n))
2591
+ if (!Fa.has(n))
2595
2592
  return e;
2596
- const o = gn(i);
2593
+ const o = _n(i);
2597
2594
  if (o && e.push({ etype: r, lookupPair: o }), n === "link")
2598
2595
  for (const [a, u] of Object.entries(s)) {
2599
2596
  const c = Array.isArray(u) ? u : [u];
2600
2597
  for (const d of c) {
2601
- const f = gn(d);
2598
+ const f = _n(d);
2602
2599
  f && e.push({
2603
2600
  etype: r,
2604
2601
  lookupPair: f,
@@ -2608,7 +2605,7 @@ function qa(t) {
2608
2605
  }
2609
2606
  return e;
2610
2607
  }
2611
- function Wa({ attrs: t, schema: e }, n) {
2608
+ function qa({ attrs: t, schema: e }, n) {
2612
2609
  var r, i;
2613
2610
  const [s, o, a] = [/* @__PURE__ */ new Set(), Object.assign({}, t), []];
2614
2611
  function u(f) {
@@ -2619,47 +2616,47 @@ function Wa({ attrs: t, schema: e }, n) {
2619
2616
  }
2620
2617
  function d(f, l) {
2621
2618
  const p = V(o, f, l), y = Ae(o, f, l);
2622
- c(p), c(y), !p && !y && u(Rr(e, f, l, Ka));
2619
+ c(p), c(y), !p && !y && u(Mr(e, f, l, Na));
2623
2620
  }
2624
2621
  for (const f of n)
2625
- for (const { etype: l, lookupPair: p, linkLabel: y } of qa(f)) {
2622
+ for (const { etype: l, lookupPair: p, linkLabel: y } of Ka(f)) {
2626
2623
  const b = p[0];
2627
2624
  if (y) {
2628
2625
  d(l, y);
2629
2626
  const _ = V(o, l, y), w = Ae(o, l, y);
2630
2627
  c(_), c(w);
2631
2628
  const g = ((r = _ == null ? void 0 : _["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = w == null ? void 0 : w["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
2632
- if (bn(o, g, b))
2633
- d(g, _n(b));
2629
+ if (yn(o, g, b))
2630
+ d(g, bn(b));
2634
2631
  else {
2635
2632
  const m = V(o, g, b);
2636
- m || u(Tt(e, g, b, Tn)), c(m);
2633
+ m || u(Tt(e, g, b, gn)), c(m);
2637
2634
  }
2638
- } else if (bn(o, l, b))
2639
- d(l, _n(b));
2635
+ } else if (yn(o, l, b))
2636
+ d(l, bn(b));
2640
2637
  else {
2641
2638
  const _ = V(o, l, b);
2642
- _ || u(Tt(e, l, b, Tn)), c(_);
2639
+ _ || u(Tt(e, l, b, gn)), c(_);
2643
2640
  }
2644
2641
  }
2645
2642
  for (const f of n) {
2646
2643
  const [l, p, y, b] = f;
2647
- if (Ua.has(l)) {
2644
+ if (Da.has(l)) {
2648
2645
  const _ = V(o, p, "id");
2649
2646
  c(_), _ || u(Tt(e, p, "id", { "unique?": !0 }));
2650
2647
  for (const w of Object.keys(b)) {
2651
2648
  const g = V(o, p, w);
2652
- if (c(g), Fa.has(l) && (g || u(Tt(e, p, w, w === "id" ? { "unique?": !0 } : null))), La.has(l)) {
2649
+ if (c(g), La.has(l) && (g || u(Tt(e, p, w, w === "id" ? { "unique?": !0 } : null))), Ua.has(l)) {
2653
2650
  const m = Ae(o, p, w);
2654
- !g && !m && u(Rr(e, p, w)), c(m);
2651
+ !g && !m && u(Mr(e, p, w)), c(m);
2655
2652
  }
2656
2653
  }
2657
2654
  }
2658
2655
  }
2659
2656
  return [o, a];
2660
2657
  }
2661
- function za(t, e) {
2662
- const r = (Array.isArray(e) ? e : [e]).flatMap((u) => Ta(u)), [i, s] = Wa(t, r), o = Object.assign(Object.assign({}, t), { attrs: i }), a = r.flatMap((u) => Ma(o, u));
2658
+ function Wa(t, e) {
2659
+ const r = (Array.isArray(e) ? e : [e]).flatMap((u) => ga(u)), [i, s] = qa(t, r), o = Object.assign(Object.assign({}, t), { attrs: i }), a = r.flatMap((u) => Ia(o, u));
2663
2660
  return [...s, ...a];
2664
2661
  }
2665
2662
  var de = function(t, e, n, r) {
@@ -2689,15 +2686,15 @@ var de = function(t, e, n, r) {
2689
2686
  c((r = r.apply(t, e || [])).next());
2690
2687
  });
2691
2688
  };
2692
- function xr(t, e) {
2689
+ function Rr(t, e) {
2693
2690
  typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
2694
2691
  }
2695
2692
  const it = "__meta";
2696
- class Va {
2693
+ class za {
2697
2694
  constructor(e, n) {
2698
2695
  }
2699
2696
  }
2700
- class wn {
2697
+ class Tn {
2701
2698
  constructor(e) {
2702
2699
  var n, r;
2703
2700
  this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
@@ -2891,7 +2888,7 @@ class wn {
2891
2888
  gc() {
2892
2889
  this._nextGc || (this._nextGc = setTimeout(
2893
2890
  () => {
2894
- xr(() => {
2891
+ Rr(() => {
2895
2892
  this._nextGc = null, this._gc();
2896
2893
  }, 30 * 1e3);
2897
2894
  },
@@ -2906,7 +2903,7 @@ class wn {
2906
2903
  return;
2907
2904
  }
2908
2905
  this._nextSave = setTimeout(() => {
2909
- xr(() => {
2906
+ Rr(() => {
2910
2907
  this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
2911
2908
  }, this._idleCallbackMaxWaitMs);
2912
2909
  }, this._saveThrottleMs);
@@ -2965,13 +2962,13 @@ var pe = function(t, e, n, r) {
2965
2962
  c((r = r.apply(t, e || [])).next());
2966
2963
  });
2967
2964
  };
2968
- const Ba = 6, Ga = ["kv", "querySubs", "syncSubs"];
2969
- function Qa(t) {
2965
+ const Va = 6, Ba = ["kv", "querySubs", "syncSubs"];
2966
+ function Ga(t) {
2970
2967
  return function(n) {
2971
2968
  console.error("Error in IndexedDB event", { source: t, event: n });
2972
2969
  };
2973
2970
  }
2974
- function Ha(t) {
2971
+ function Qa(t) {
2975
2972
  return pe(this, void 0, void 0, function* () {
2976
2973
  return new Promise((e) => {
2977
2974
  const n = indexedDB.open(t);
@@ -2987,7 +2984,7 @@ function Ha(t) {
2987
2984
  });
2988
2985
  });
2989
2986
  }
2990
- function Ya(t, e, n) {
2987
+ function Ha(t, e, n) {
2991
2988
  return pe(this, void 0, void 0, function* () {
2992
2989
  const r = (
2993
2990
  // Backwards compatibility for older versions where we JSON.stringified before storing
@@ -3023,7 +3020,7 @@ function Ya(t, e, n) {
3023
3020
  });
3024
3021
  });
3025
3022
  }
3026
- function $r(t, e, n) {
3023
+ function xr(t, e, n) {
3027
3024
  return pe(this, void 0, void 0, function* () {
3028
3025
  const r = n.put(e, t);
3029
3026
  return new Promise((i, s) => {
@@ -3031,9 +3028,9 @@ function $r(t, e, n) {
3031
3028
  });
3032
3029
  });
3033
3030
  }
3034
- function Ja(t, e) {
3031
+ function Ya(t, e) {
3035
3032
  return pe(this, void 0, void 0, function* () {
3036
- const n = yield Ha(`instant_${t}_5`);
3033
+ const n = yield Qa(`instant_${t}_5`);
3037
3034
  if (!n)
3038
3035
  return;
3039
3036
  const r = yield new Promise((d, f) => {
@@ -3056,12 +3053,12 @@ function Ja(t, e) {
3056
3053
  for (const [d, f] of r)
3057
3054
  switch (d) {
3058
3055
  case "querySubs": {
3059
- const l = Ya(d, f, o);
3056
+ const l = Ha(d, f, o);
3060
3057
  a.push(l);
3061
3058
  break;
3062
3059
  }
3063
3060
  default: {
3064
- const l = $r(d, f, s);
3061
+ const l = xr(d, f, s);
3065
3062
  a.push(l);
3066
3063
  const p = {
3067
3064
  createdAt: Date.now(),
@@ -3072,16 +3069,16 @@ function Ja(t, e) {
3072
3069
  break;
3073
3070
  }
3074
3071
  }
3075
- const c = $r(it, u, s);
3072
+ const c = xr(it, u, s);
3076
3073
  a.push(c), yield Promise.all(a), yield new Promise((d, f) => {
3077
3074
  i.oncomplete = (l) => d(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
3078
3075
  });
3079
3076
  });
3080
3077
  }
3081
- const Dr = /* @__PURE__ */ new Map();
3082
- class qi extends Va {
3078
+ const $r = /* @__PURE__ */ new Map();
3079
+ class Ki extends za {
3083
3080
  constructor(e, n) {
3084
- super(e, n), this.dbName = `instant_${e}_${Ba}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
3081
+ super(e, n), this.dbName = `instant_${e}_${Va}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
3085
3082
  }
3086
3083
  _init() {
3087
3084
  return new Promise((e, n) => {
@@ -3092,12 +3089,12 @@ class qi extends Va {
3092
3089
  }, i.onsuccess = (s) => {
3093
3090
  const a = s.target.result;
3094
3091
  if (r) {
3095
- const u = Ja(this._appId, a).catch((c) => {
3096
- Qa("Error upgrading store from version 5 to 6.")(c);
3092
+ const u = Ya(this._appId, a).catch((c) => {
3093
+ Ga("Error upgrading store from version 5 to 6.")(c);
3097
3094
  });
3098
- Dr.set(this.dbName, u), u.then(() => e(a)).catch(() => e(a));
3095
+ $r.set(this.dbName, u), u.then(() => e(a)).catch(() => e(a));
3099
3096
  } else {
3100
- const u = Dr.get(this.dbName);
3097
+ const u = $r.get(this.dbName);
3101
3098
  u ? u.then(() => e(a)).catch(() => e(a)) : e(a);
3102
3099
  }
3103
3100
  }, i.onupgradeneeded = (s) => {
@@ -3107,7 +3104,7 @@ class qi extends Va {
3107
3104
  }
3108
3105
  _upgradeStore(e) {
3109
3106
  const r = e.target.result;
3110
- for (const i of Ga)
3107
+ for (const i of Ba)
3111
3108
  r.objectStoreNames.contains(i) || r.createObjectStore(i);
3112
3109
  }
3113
3110
  getItem(e) {
@@ -3182,7 +3179,7 @@ class qi extends Va {
3182
3179
  });
3183
3180
  }
3184
3181
  }
3185
- var Za = function(t, e, n, r) {
3182
+ var Ja = function(t, e, n, r) {
3186
3183
  function i(s) {
3187
3184
  return s instanceof n ? s : new n(function(o) {
3188
3185
  o(s);
@@ -3209,9 +3206,9 @@ var Za = function(t, e, n, r) {
3209
3206
  c((r = r.apply(t, e || [])).next());
3210
3207
  });
3211
3208
  };
3212
- class Wi {
3209
+ class qi {
3213
3210
  static getIsOnline() {
3214
- return Za(this, void 0, void 0, function* () {
3211
+ return Ja(this, void 0, void 0, function* () {
3215
3212
  return navigator.onLine;
3216
3213
  });
3217
3214
  }
@@ -3236,7 +3233,7 @@ class Ke extends Error {
3236
3233
  return "InstantError";
3237
3234
  }
3238
3235
  }
3239
- var Xa = function(t, e, n, r) {
3236
+ var Za = function(t, e, n, r) {
3240
3237
  function i(s) {
3241
3238
  return s instanceof n ? s : new n(function(o) {
3242
3239
  o(s);
@@ -3276,7 +3273,7 @@ class Dt extends Ke {
3276
3273
  }
3277
3274
  }
3278
3275
  function ue(t, e) {
3279
- return Xa(this, void 0, void 0, function* () {
3276
+ return Za(this, void 0, void 0, function* () {
3280
3277
  const n = yield fetch(t, e), r = yield n.json();
3281
3278
  return n.status === 200 ? Promise.resolve(r) : Promise.reject(new Dt({ status: n.status, body: r }));
3282
3279
  });
@@ -3308,14 +3305,14 @@ var ze = function(t, e, n, r) {
3308
3305
  c((r = r.apply(t, e || [])).next());
3309
3306
  });
3310
3307
  };
3311
- function eu({ apiURI: t, appId: e, email: n }) {
3308
+ function Xa({ apiURI: t, appId: e, email: n }) {
3312
3309
  return ue(`${t}/runtime/auth/send_magic_code`, {
3313
3310
  method: "POST",
3314
3311
  headers: { "content-type": "application/json" },
3315
3312
  body: JSON.stringify({ "app-id": e, email: n })
3316
3313
  });
3317
3314
  }
3318
- function tu(t) {
3315
+ function eu(t) {
3319
3316
  return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
3320
3317
  return yield ue(`${e}/runtime/auth/verify_magic_code`, {
3321
3318
  method: "POST",
@@ -3328,7 +3325,7 @@ function tu(t) {
3328
3325
  });
3329
3326
  });
3330
3327
  }
3331
- function nu(t) {
3328
+ function tu(t) {
3332
3329
  return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3333
3330
  return yield ue(`${e}/runtime/auth/verify_refresh_token`, {
3334
3331
  method: "POST",
@@ -3340,7 +3337,7 @@ function nu(t) {
3340
3337
  });
3341
3338
  });
3342
3339
  }
3343
- function ru(t) {
3340
+ function nu(t) {
3344
3341
  return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
3345
3342
  return yield ue(`${e}/runtime/auth/sign_in_guest`, {
3346
3343
  method: "POST",
@@ -3351,7 +3348,7 @@ function ru(t) {
3351
3348
  });
3352
3349
  });
3353
3350
  }
3354
- function Ur(t) {
3351
+ function Dr(t) {
3355
3352
  return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
3356
3353
  return yield ue(`${e}/runtime/oauth/token`, {
3357
3354
  method: "POST",
@@ -3365,7 +3362,7 @@ function Ur(t) {
3365
3362
  });
3366
3363
  });
3367
3364
  }
3368
- function iu(t) {
3365
+ function ru(t) {
3369
3366
  return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
3370
3367
  return yield ue(`${e}/runtime/oauth/id_token`, {
3371
3368
  method: "POST",
@@ -3380,7 +3377,7 @@ function iu(t) {
3380
3377
  });
3381
3378
  });
3382
3379
  }
3383
- function su(t) {
3380
+ function iu(t) {
3384
3381
  return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3385
3382
  return yield ue(`${e}/runtime/signout`, {
3386
3383
  method: "POST",
@@ -3421,7 +3418,7 @@ var ft = function(t, e, n, r) {
3421
3418
  c((r = r.apply(t, e || [])).next());
3422
3419
  });
3423
3420
  };
3424
- function ou(t) {
3421
+ function su(t) {
3425
3422
  return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: a }) {
3426
3423
  const u = {
3427
3424
  app_id: n,
@@ -3436,7 +3433,7 @@ function ou(t) {
3436
3433
  });
3437
3434
  });
3438
3435
  }
3439
- function au(t) {
3436
+ function ou(t) {
3440
3437
  return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
3441
3438
  const { data: s } = yield ue(`${e}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
3442
3439
  method: "DELETE",
@@ -3448,7 +3445,7 @@ function au(t) {
3448
3445
  return s;
3449
3446
  });
3450
3447
  }
3451
- function uu(t) {
3448
+ function au(t) {
3452
3449
  return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
3453
3450
  const { data: o } = yield ue(`${e}/storage/signed-upload-url`, {
3454
3451
  method: "POST",
@@ -3464,7 +3461,7 @@ function uu(t) {
3464
3461
  return o;
3465
3462
  });
3466
3463
  }
3467
- function cu(t, e) {
3464
+ function uu(t, e) {
3468
3465
  return ft(this, void 0, void 0, function* () {
3469
3466
  return (yield fetch(t, {
3470
3467
  method: "PUT",
@@ -3475,7 +3472,7 @@ function cu(t, e) {
3475
3472
  })).ok;
3476
3473
  });
3477
3474
  }
3478
- function du(t) {
3475
+ function cu(t) {
3479
3476
  return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
3480
3477
  const { data: s } = yield ue(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
3481
3478
  method: "GET",
@@ -3487,9 +3484,9 @@ function du(t) {
3487
3484
  return s;
3488
3485
  });
3489
3486
  }
3490
- let Bn = !1, zi = !1, Vi = !1;
3491
- typeof window < "u" && typeof window.localStorage < "u" && (Bn = !!window.localStorage.getItem("devBackend"), zi = !!window.localStorage.getItem("__instantLogging"), Vi = !!window.localStorage.getItem("__devtoolLocalDash"));
3492
- function Lr(t, e) {
3487
+ let Vn = !1, Wi = !1, zi = !1;
3488
+ typeof window < "u" && typeof window.localStorage < "u" && (Vn = !!window.localStorage.getItem("devBackend"), Wi = !!window.localStorage.getItem("__instantLogging"), zi = !!window.localStorage.getItem("__devtoolLocalDash"));
3489
+ function Ur(t, e) {
3493
3490
  if (!e)
3494
3491
  return t;
3495
3492
  const n = {};
@@ -3497,33 +3494,33 @@ function Lr(t, e) {
3497
3494
  n[r] = t[r];
3498
3495
  }), n;
3499
3496
  }
3500
- function fu(t, e, n) {
3497
+ function du(t, e, n) {
3501
3498
  var r, i;
3502
3499
  const s = {
3503
3500
  peers: {}
3504
3501
  };
3505
3502
  if (e && "user" in e ? e.user : !0) {
3506
- const a = Lr((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
3503
+ const a = Ur((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
3507
3504
  s.user = Object.assign(Object.assign({}, a), { peerId: n });
3508
3505
  }
3509
3506
  for (const a of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
3510
3507
  const u = (e == null ? void 0 : e.peers) === void 0, c = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(a));
3511
3508
  if (u || c) {
3512
- const d = Lr(t.peers[a], e == null ? void 0 : e.keys);
3509
+ const d = Ur(t.peers[a], e == null ? void 0 : e.keys);
3513
3510
  s.peers[a] = Object.assign(Object.assign({}, d), { peerId: a });
3514
3511
  }
3515
3512
  }
3516
3513
  return s;
3517
3514
  }
3518
- function lu(t, e) {
3519
- if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !Sr(t.user, e.user)) || !Ti(t.peers, e.peers))
3515
+ function fu(t, e) {
3516
+ if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !vr(t.user, e.user)) || !gi(t.peers, e.peers))
3520
3517
  return !0;
3521
3518
  for (const r of Object.keys(t.peers))
3522
- if (!Sr(t.peers[r], e.peers[r]))
3519
+ if (!vr(t.peers[r], e.peers[r]))
3523
3520
  return !0;
3524
3521
  return !1;
3525
3522
  }
3526
- class Fr {
3523
+ class Lr {
3527
3524
  constructor() {
3528
3525
  this.promise = new Promise((e, n) => {
3529
3526
  this._resolve = e, this._reject = n;
@@ -3536,20 +3533,20 @@ class Fr {
3536
3533
  this._reject(e);
3537
3534
  }
3538
3535
  }
3539
- function Bi(t, e = []) {
3536
+ function Vi(t, e = []) {
3540
3537
  t.forEach((n) => {
3541
3538
  const { data: r } = n, { "datalog-result": i } = r, { "join-rows": s } = i;
3542
3539
  for (const o of s)
3543
3540
  for (const a of o)
3544
3541
  e.push(a);
3545
- Bi(n["child-nodes"], e);
3542
+ Vi(n["child-nodes"], e);
3546
3543
  });
3547
3544
  }
3548
- function Nr(t) {
3545
+ function Fr(t) {
3549
3546
  const e = [];
3550
- return Bi(t, e), e;
3547
+ return Vi(t, e), e;
3551
3548
  }
3552
- function Kr(t) {
3549
+ function Nr(t) {
3553
3550
  return Object.values(t.links).reduce((e, n) => {
3554
3551
  var r, i, s, o;
3555
3552
  return (r = e[s = n.forward.on]) !== null && r !== void 0 || (e[s] = {}), e[n.forward.on][n.forward.label] = {
@@ -3563,8 +3560,8 @@ function Kr(t) {
3563
3560
  }, e;
3564
3561
  }, {});
3565
3562
  }
3566
- const Gn = "v0.22.84-experimental.drewh-entity-caching.20110692986.1";
3567
- function hu(t, e) {
3563
+ const Bn = "v0.22.84-experimental.drewh-explorer-component.20110693133.1";
3564
+ function lu(t, e) {
3568
3565
  return {
3569
3566
  info: t ? (...n) => console.info(...n, e()) : () => {
3570
3567
  },
@@ -3637,7 +3634,7 @@ class R extends Error {
3637
3634
  super(r), this.name = "QueryValidationError";
3638
3635
  }
3639
3636
  }
3640
- const qr = [
3637
+ const Kr = [
3641
3638
  "where",
3642
3639
  "order",
3643
3640
  "limit",
@@ -3648,7 +3645,7 @@ const qr = [
3648
3645
  "before",
3649
3646
  "fields",
3650
3647
  "aggregate"
3651
- ], pu = (t) => t.valueType || "unknown", Gi = (t, e, n = !1) => {
3648
+ ], hu = (t) => t.valueType || "unknown", Bi = (t, e, n = !1) => {
3652
3649
  if (n || t == null)
3653
3650
  return !0;
3654
3651
  switch (e) {
@@ -3663,9 +3660,9 @@ const qr = [
3663
3660
  default:
3664
3661
  return !0;
3665
3662
  }
3666
- }, yu = (t, e, n, r, i, s, o) => {
3663
+ }, pu = (t, e, n, r, i, s, o) => {
3667
3664
  const a = s.valueType === "json", u = (c, d, f) => {
3668
- if (!Gi(f, d, a))
3665
+ if (!Bi(f, d, a))
3669
3666
  throw new R(`Invalid value for operator '${c}' on attribute '${r}' in entity '${i}'. Expected ${d}, but received: ${typeof f}`, o);
3670
3667
  };
3671
3668
  switch (t) {
@@ -3696,16 +3693,16 @@ const qr = [
3696
3693
  throw new R(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
3697
3694
  }
3698
3695
  }, Ue = (t, e, n, r, i) => {
3699
- const s = pu(n), o = n.valueType === "json";
3696
+ const s = hu(n), o = n.valueType === "json";
3700
3697
  if (typeof t == "object" && t !== null && !Array.isArray(t)) {
3701
3698
  if (o)
3702
3699
  return;
3703
3700
  const u = t;
3704
3701
  for (const [c, d] of Object.entries(u))
3705
- yu(c, d, s, e, r, n, `${i}.${c}`);
3706
- } else if (!Gi(t, s, o))
3702
+ pu(c, d, s, e, r, n, `${i}.${c}`);
3703
+ } else if (!Bi(t, s, o))
3707
3704
  throw new R(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
3708
- }, bu = (t, e, n, r, i) => {
3705
+ }, yu = (t, e, n, r, i) => {
3709
3706
  const s = t.split(".");
3710
3707
  if (s.length < 2)
3711
3708
  throw new R(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
@@ -3742,12 +3739,12 @@ const qr = [
3742
3739
  throw new R(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${d.length > 0 ? d.join(", ") + ", id" : "id"}`, i);
3743
3740
  }
3744
3741
  Ue(e, t, c, n, i);
3745
- }, Qi = (t, e, n, r) => {
3742
+ }, Gi = (t, e, n, r) => {
3746
3743
  for (const [i, s] of Object.entries(t)) {
3747
3744
  if (i === "or" || i === "and") {
3748
3745
  if (Array.isArray(s))
3749
3746
  for (const c of s)
3750
- typeof c == "object" && c !== null && Qi(c, e, n, `${r}.${i}[${c}]`);
3747
+ typeof c == "object" && c !== null && Gi(c, e, n, `${r}.${i}[${c}]`);
3751
3748
  continue;
3752
3749
  }
3753
3750
  if (i === "id") {
@@ -3755,7 +3752,7 @@ const qr = [
3755
3752
  continue;
3756
3753
  }
3757
3754
  if (i.includes(".")) {
3758
- bu(i, s, e, n, `${r}.${i}`);
3755
+ yu(i, s, e, n, `${r}.${i}`);
3759
3756
  continue;
3760
3757
  }
3761
3758
  const o = n.entities[e];
@@ -3775,10 +3772,10 @@ const qr = [
3775
3772
  Ue(s, i, c, e, `${r}.${i}`);
3776
3773
  }
3777
3774
  }
3778
- }, _u = (t, e, n, r, i = 0) => {
3775
+ }, bu = (t, e, n, r, i = 0) => {
3779
3776
  for (const o of Object.keys(t))
3780
- if (!qr.includes(o))
3781
- throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${qr.join(", ")}. Found: ${o}`, r);
3777
+ if (!Kr.includes(o))
3778
+ throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Kr.join(", ")}. Found: ${o}`, r);
3782
3779
  const s = [
3783
3780
  // 'limit', // only supported client side
3784
3781
  "offset",
@@ -3793,9 +3790,9 @@ const qr = [
3793
3790
  if (t.where && n) {
3794
3791
  if (typeof t.where != "object" || t.where === null)
3795
3792
  throw new R(`'where' clause must be an object in entity '${e}', but received: ${typeof t.where}`, r ? `${r}.where` : void 0);
3796
- Qi(t.where, e, n, r ? `${r}.where` : "where");
3793
+ Gi(t.where, e, n, r ? `${r}.where` : "where");
3797
3794
  }
3798
- }, Hi = (t, e, n, r, i = 0) => {
3795
+ }, Qi = (t, e, n, r, i = 0) => {
3799
3796
  var s;
3800
3797
  if (!t || typeof t != "object")
3801
3798
  throw new R(`Query part for entity '${e}' must be an object, but received: ${typeof t}`, r);
@@ -3808,15 +3805,15 @@ const qr = [
3808
3805
  const a = t[o];
3809
3806
  if (typeof a == "object" && a !== null) {
3810
3807
  const u = (s = n == null ? void 0 : n.entities[e].links[o]) === null || s === void 0 ? void 0 : s.entityName;
3811
- u && Hi(a, u, n, `${r}.${o}`, i + 1);
3808
+ u && Qi(a, u, n, `${r}.${o}`, i + 1);
3812
3809
  }
3813
3810
  } else {
3814
3811
  const a = t[o];
3815
3812
  if (typeof a != "object" || a === null)
3816
3813
  throw new R(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
3817
- _u(a, e, n, `${r}.$`, i);
3814
+ bu(a, e, n, `${r}.$`, i);
3818
3815
  }
3819
- }, Wr = (t, e) => {
3816
+ }, qr = (t, e) => {
3820
3817
  if (typeof t != "object" || t === null)
3821
3818
  throw new R(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
3822
3819
  if (Array.isArray(t))
@@ -3832,67 +3829,67 @@ const qr = [
3832
3829
  const i = Object.keys(e.entities);
3833
3830
  throw new R(`Entity '${r}' does not exist in schema. Available entities: ${i.length > 0 ? i.join(", ") : "none"}`, r);
3834
3831
  }
3835
- Hi(n[r], r, e, r, 0);
3832
+ Qi(n[r], r, e, r, 0);
3836
3833
  }
3837
3834
  }
3838
- }, zr = (t) => typeof t != "string" ? !1 : Mt(t) ? !0 : Fe(t);
3835
+ }, Wr = (t) => typeof t != "string" ? !1 : Mt(t) ? !0 : Fe(t);
3839
3836
  class ie extends Error {
3840
3837
  constructor(e) {
3841
3838
  super(e), this.name = "TransactionValidationError";
3842
3839
  }
3843
3840
  }
3844
- const Yi = (t) => t.length > 0 ? t.join(", ") : "none", gu = (t, e) => new ie(`Entity '${t}' does not exist in schema. Available entities: ${Yi(e)}`), Vr = {
3841
+ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", _u = (t, e) => new ie(`Entity '${t}' does not exist in schema. Available entities: ${Hi(e)}`), zr = {
3845
3842
  string: (t) => typeof t == "string",
3846
3843
  number: (t) => typeof t == "number" && !isNaN(t),
3847
3844
  boolean: (t) => typeof t == "boolean",
3848
3845
  date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
3849
3846
  json: () => !0
3850
- }, Tu = (t, e) => {
3847
+ }, gu = (t, e) => {
3851
3848
  var n, r;
3852
- return t == null ? !0 : (r = (n = Vr[e.valueType]) === null || n === void 0 ? void 0 : n.call(Vr, t)) !== null && r !== void 0 ? r : !1;
3853
- }, Ji = (t, e) => {
3849
+ return t == null ? !0 : (r = (n = zr[e.valueType]) === null || n === void 0 ? void 0 : n.call(zr, t)) !== null && r !== void 0 ? r : !1;
3850
+ }, Yi = (t, e) => {
3854
3851
  const n = e.entities[t];
3855
3852
  if (!n)
3856
- throw gu(t, Object.keys(e.entities));
3853
+ throw _u(t, Object.keys(e.entities));
3857
3854
  return n;
3858
- }, Zt = (t, e, n) => {
3859
- const r = Ji(t, n);
3855
+ }, Jt = (t, e, n) => {
3856
+ const r = Yi(t, n);
3860
3857
  if (typeof e != "object" || e === null)
3861
3858
  throw new ie(`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`);
3862
3859
  for (const [i, s] of Object.entries(e)) {
3863
3860
  if (i === "id")
3864
3861
  continue;
3865
3862
  const o = r.attrs[i];
3866
- if (o && !Tu(s, o))
3863
+ if (o && !gu(s, o))
3867
3864
  throw new ie(`Invalid value for attribute '${i}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof s}`);
3868
3865
  }
3869
- }, Br = (t, e, n) => {
3870
- const r = Ji(t, n);
3866
+ }, Vr = (t, e, n) => {
3867
+ const r = Yi(t, n);
3871
3868
  if (typeof e != "object" || e === null)
3872
3869
  throw new ie(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
3873
3870
  for (const [i, s] of Object.entries(e)) {
3874
3871
  if (!r.links[i]) {
3875
3872
  const a = Object.keys(r.links);
3876
- throw new ie(`Link '${i}' does not exist on entity '${t}'. Available links: ${Yi(a)}`);
3873
+ throw new ie(`Link '${i}' does not exist on entity '${t}'. Available links: ${Hi(a)}`);
3877
3874
  }
3878
3875
  if (s != null) {
3879
3876
  if (Array.isArray(s)) {
3880
3877
  for (const a of s)
3881
- if (!zr(a))
3878
+ if (!Wr(a))
3882
3879
  throw new ie(`Invalid entity ID in link '${i}' for entity '${t}'. Expected a UUID or a lookup, but received: ${a}`);
3883
- } else if (!zr(s))
3880
+ } else if (!Wr(s))
3884
3881
  throw new ie(`Invalid UUID in link '${i}' for entity '${t}'. Expected a UUID, but received: ${s}`);
3885
3882
  }
3886
3883
  }
3887
- }, wu = {
3888
- create: Zt,
3889
- update: Zt,
3890
- merge: Zt,
3891
- link: Br,
3892
- unlink: Br,
3884
+ }, Tu = {
3885
+ create: Jt,
3886
+ update: Jt,
3887
+ merge: Jt,
3888
+ link: Vr,
3889
+ unlink: Vr,
3893
3890
  delete: () => {
3894
3891
  }
3895
- }, mu = (t, e) => {
3892
+ }, wu = (t, e) => {
3896
3893
  if (!e)
3897
3894
  return;
3898
3895
  const [n, r, i, s] = t;
@@ -3900,9 +3897,9 @@ const Yi = (t) => t.length > 0 ? t.join(", ") : "none", gu = (t, e) => new ie(`E
3900
3897
  throw new ie(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
3901
3898
  if (typeof r != "string")
3902
3899
  throw new ie(`Entity name must be a string, but received: ${typeof r}`);
3903
- const o = wu[n];
3900
+ const o = Tu[n];
3904
3901
  o && s !== void 0 && o(r, s, e);
3905
- }, vu = (t, e) => {
3902
+ }, mu = (t, e) => {
3906
3903
  const n = Array.isArray(t) ? t : [t];
3907
3904
  for (const r of n) {
3908
3905
  if (!r || typeof r != "object")
@@ -3912,11 +3909,11 @@ const Yi = (t) => t.length > 0 ? t.join(", ") : "none", gu = (t, e) => new ie(`E
3912
3909
  for (const i of r.__ops) {
3913
3910
  if (!Array.isArray(i))
3914
3911
  throw new ie(`Transaction operation must be an array, but received: ${typeof i}`);
3915
- mu(i, e);
3912
+ wu(i, e);
3916
3913
  }
3917
3914
  }
3918
3915
  };
3919
- var Gr = function(t, e, n, r) {
3916
+ var Br = function(t, e, n, r) {
3920
3917
  function i(s) {
3921
3918
  return s instanceof n ? s : new n(function(o) {
3922
3919
  o(s);
@@ -3943,10 +3940,10 @@ var Gr = function(t, e, n, r) {
3943
3940
  c((r = r.apply(t, e || [])).next());
3944
3941
  });
3945
3942
  };
3946
- let Zi = 0;
3947
- class Qr {
3943
+ let Ji = 0;
3944
+ class Gr {
3948
3945
  constructor(e) {
3949
- this.type = "ws", this.id = `${this.type}_${Zi++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
3946
+ this.type = "ws", this.id = `${this.type}_${Ji++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
3950
3947
  this.onopen && this.onopen({ target: this });
3951
3948
  }, this.conn.onmessage = (n) => {
3952
3949
  this.onmessage && this.onmessage({
@@ -3974,9 +3971,9 @@ class Qr {
3974
3971
  return this.conn.send(JSON.stringify(e));
3975
3972
  }
3976
3973
  }
3977
- class Su {
3974
+ class vu {
3978
3975
  constructor(e, n) {
3979
- this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${Zi++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
3976
+ this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${Ji++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
3980
3977
  this.initParams || this.handleError();
3981
3978
  }, 1e4), this.conn.onmessage = (r) => {
3982
3979
  const i = JSON.parse(r.data);
@@ -4015,7 +4012,7 @@ class Su {
4015
4012
  this.conn.close(), this.onclose && !this.closeFired && (this.closeFired = !0, this.onclose({ target: this }));
4016
4013
  }
4017
4014
  postMessages(e) {
4018
- return Gr(this, void 0, void 0, function* () {
4015
+ return Br(this, void 0, void 0, function* () {
4019
4016
  var n, r, i;
4020
4017
  try {
4021
4018
  (yield fetch(this.url, {
@@ -4034,7 +4031,7 @@ class Su {
4034
4031
  });
4035
4032
  }
4036
4033
  flushQueue() {
4037
- return Gr(this, void 0, void 0, function* () {
4034
+ return Br(this, void 0, void 0, function* () {
4038
4035
  if (this.sendPromise || !this.sendQueue.length)
4039
4036
  return;
4040
4037
  const e = this.sendQueue;
@@ -4060,7 +4057,7 @@ class Su {
4060
4057
  this.handleClose();
4061
4058
  }
4062
4059
  }
4063
- var Hr = function(t, e, n, r) {
4060
+ var Qr = function(t, e, n, r) {
4064
4061
  function i(s) {
4065
4062
  return s instanceof n ? s : new n(function(o) {
4066
4063
  o(s);
@@ -4087,34 +4084,34 @@ var Hr = function(t, e, n, r) {
4087
4084
  c((r = r.apply(t, e || [])).next());
4088
4085
  });
4089
4086
  };
4090
- function Ou(t, e) {
4087
+ function Su(t, e) {
4091
4088
  const n = t.values;
4092
4089
  if (n)
4093
4090
  for (const r of n.entities || [])
4094
- r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store = Ei(r.store);
4091
+ r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store = Oi(r.store);
4095
4092
  return t;
4096
4093
  }
4097
- function Eu(t, e) {
4094
+ function Ou(t, e) {
4098
4095
  var n, r;
4099
4096
  if (!((n = e.values) === null || n === void 0) && n.entities) {
4100
4097
  const i = [];
4101
4098
  for (const s of (r = e.values) === null || r === void 0 ? void 0 : r.entities) {
4102
- const o = Oi(s.store);
4099
+ const o = Si(s.store);
4103
4100
  delete o.attrs, i.push(Object.assign(Object.assign({}, s), { store: o }));
4104
4101
  }
4105
4102
  return Object.assign(Object.assign({}, e), { values: Object.assign(Object.assign({}, e.values), { entities: i }) });
4106
4103
  } else
4107
4104
  return e;
4108
4105
  }
4109
- function Au(t, e, n) {
4106
+ function Eu(t, e, n) {
4110
4107
  var r, i;
4111
4108
  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;
4112
4109
  return s && (!o || s > o) ? e : o && (!s || o > s) ? n : e || n;
4113
4110
  }
4114
- function Xt(t, e) {
4115
- return Li({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
4111
+ function Zt(t, e) {
4112
+ return Ui({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
4116
4113
  }
4117
- function Yr(t, e, n) {
4114
+ function Hr(t, e, n) {
4118
4115
  var r;
4119
4116
  const i = (r = Te(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
4120
4117
  if (!i)
@@ -4122,18 +4119,18 @@ function Yr(t, e, n) {
4122
4119
  const s = We(e.eav, [n, i, n]);
4123
4120
  return s ? s[3] : -1;
4124
4121
  }
4125
- function Jr(t, e) {
4122
+ function Yr(t, e) {
4126
4123
  for (const { action: n, triple: r } of e)
4127
4124
  switch (n) {
4128
4125
  case "added":
4129
- ki(t, r);
4126
+ ji(t, r);
4130
4127
  break;
4131
4128
  case "removed":
4132
- Ai(t, r);
4129
+ Ei(t, r);
4133
4130
  break;
4134
4131
  }
4135
4132
  }
4136
- function ju(t, e) {
4133
+ function Au(t, e) {
4137
4134
  var n, r, i, s;
4138
4135
  const o = {};
4139
4136
  for (const { action: a, triple: u } of e) {
@@ -4161,14 +4158,14 @@ function ju(t, e) {
4161
4158
  function wt(t, e) {
4162
4159
  return { [t.table]: e.map((n) => n.entity) };
4163
4160
  }
4164
- function ku(t, e) {
4161
+ function ju(t, e) {
4165
4162
  var n;
4166
4163
  if (t.orderFieldType)
4167
4164
  return t.orderFieldType;
4168
4165
  const r = t.orderField === "serverCreatedAt" ? "number" : (n = Te(e([]), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
4169
4166
  return t.orderFieldType = r, r;
4170
4167
  }
4171
- function Cu(t, e, n) {
4168
+ function ku(t, e, n) {
4172
4169
  const r = e;
4173
4170
  if (t.orderField === "serverCreatedAt") {
4174
4171
  n.sort(t.orderDirection === "asc" ? function(o, a) {
@@ -4189,13 +4186,13 @@ var ve;
4189
4186
  (function(t) {
4190
4187
  t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
4191
4188
  })(ve || (ve = {}));
4192
- class Pu {
4189
+ class Cu {
4193
4190
  constructor(e, n, r, i, s) {
4194
- this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new wn({
4191
+ this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Tn({
4195
4192
  persister: n,
4196
- merge: Au,
4197
- serialize: Eu,
4198
- parse: (o, a) => Ou(a, this.config.useDateObjects),
4193
+ merge: Eu,
4194
+ serialize: Ou,
4195
+ parse: (o, a) => Su(a, this.config.useDateObjects),
4199
4196
  objectSize: (o) => {
4200
4197
  var a;
4201
4198
  return ((a = o.values) === null || a === void 0 ? void 0 : a.entities.length) || 0;
@@ -4252,7 +4249,7 @@ class Pu {
4252
4249
  });
4253
4250
  }
4254
4251
  initSubscription(e, n, r) {
4255
- return Hr(this, void 0, void 0, function* () {
4252
+ return Qr(this, void 0, void 0, function* () {
4256
4253
  var i, s, o, a;
4257
4254
  yield this.subs.waitForKeyToLoad(n);
4258
4255
  const u = this.subs.currentValue[n];
@@ -4278,7 +4275,7 @@ class Pu {
4278
4275
  });
4279
4276
  }
4280
4277
  flushPending() {
4281
- return Hr(this, void 0, void 0, function* () {
4278
+ return Qr(this, void 0, void 0, function* () {
4282
4279
  for (const e of Object.keys(this.callbacks)) {
4283
4280
  yield this.subs.waitForKeyToLoad(e);
4284
4281
  const n = this.subs.currentValue[e];
@@ -4323,11 +4320,11 @@ class Pu {
4323
4320
  for (const d of i) {
4324
4321
  const f = this.createStore(d);
4325
4322
  u.attrs = f.attrs;
4326
- const l = Xt(a, f);
4323
+ const l = Zt(a, f);
4327
4324
  c.push({
4328
4325
  store: f,
4329
4326
  entity: l,
4330
- serverCreatedAt: Yr(a, f, l.id)
4327
+ serverCreatedAt: Hr(a, f, l.id)
4331
4328
  }), o.push(l);
4332
4329
  }
4333
4330
  this.subs.updateInPlace((d) => {
@@ -4397,9 +4394,9 @@ class Pu {
4397
4394
  e: for (const [g, m] of Object.entries(f))
4398
4395
  for (let E = 0; E < p.length; E++) {
4399
4396
  const S = p[E];
4400
- if (uo(S.store, g)) {
4401
- Jr(S.store, m);
4402
- const I = Xt(a, S.store), x = ju(S.store, m)[g];
4397
+ if (ao(S.store, g)) {
4398
+ Yr(S.store, m);
4399
+ const I = Zt(a, S.store), x = Au(S.store, m)[g];
4403
4400
  I ? (y.push({
4404
4401
  oldEntity: S.entity,
4405
4402
  newEntity: I,
@@ -4411,8 +4408,8 @@ class Pu {
4411
4408
  const b = [];
4412
4409
  for (const [g, m] of Object.entries(f)) {
4413
4410
  const E = this.createStore([]);
4414
- l.attrs = E.attrs, Jr(E, m);
4415
- const S = Xt(a, E);
4411
+ l.attrs = E.attrs, Yr(E, m);
4412
+ const S = Zt(a, E);
4416
4413
  if (!S) {
4417
4414
  this.log.error("No entity found after applying change", {
4418
4415
  sub: a,
@@ -4424,14 +4421,14 @@ class Pu {
4424
4421
  p.push({
4425
4422
  store: E,
4426
4423
  entity: S,
4427
- serverCreatedAt: Yr(a, E, S.id)
4424
+ serverCreatedAt: Hr(a, E, S.id)
4428
4425
  }), b.push(S);
4429
4426
  }
4430
4427
  const _ = [];
4431
4428
  for (const g of d.sort().reverse())
4432
4429
  _.push(p[g].entity), p.splice(g, 1);
4433
- const w = ku(a, this.createStore);
4434
- Cu(a, w, p), this.notifyCbs(o, {
4430
+ const w = ju(a, this.createStore);
4431
+ ku(a, w, p), this.notifyCbs(o, {
4435
4432
  type: ve.SyncTransaction,
4436
4433
  data: wt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
4437
4434
  added: b,
@@ -4498,7 +4495,7 @@ var F = function(t, e, n, r) {
4498
4495
  }
4499
4496
  c((r = r.apply(t, e || [])).next());
4500
4497
  });
4501
- }, Iu = function(t, e) {
4498
+ }, Pu = function(t, e) {
4502
4499
  var n = {};
4503
4500
  for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
4504
4501
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
@@ -4512,46 +4509,46 @@ const le = {
4512
4509
  AUTHENTICATED: "authenticated",
4513
4510
  CLOSED: "closed",
4514
4511
  ERRORED: "errored"
4515
- }, Mu = 3e4, Ru = 3e4, xu = 200, $u = {
4512
+ }, Iu = 3e4, Mu = 3e4, Ru = 200, xu = {
4516
4513
  apiURI: "https://api.instantdb.com",
4517
4514
  websocketURI: "wss://api.instantdb.com/runtime/session"
4518
- }, en = "_instant_oauth_redirect", Qe = "currentUser";
4519
- function Du({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
4515
+ }, Xt = "_instant_oauth_redirect", Qe = "currentUser";
4516
+ function $u({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
4520
4517
  if (!i)
4521
- return new Qr(`${r}?app_id=${e}`);
4518
+ return new Gr(`${r}?app_id=${e}`);
4522
4519
  switch (t) {
4523
4520
  case "ws":
4524
- return new Qr(`${r}?app_id=${e}`);
4521
+ return new Gr(`${r}?app_id=${e}`);
4525
4522
  case "sse":
4526
- return new Su(i, `${n}/runtime/sse?app_id=${e}`);
4523
+ return new vu(i, `${n}/runtime/sse?app_id=${e}`);
4527
4524
  default:
4528
4525
  throw new Error("Unknown transport type " + t);
4529
4526
  }
4530
4527
  }
4531
- function Uu() {
4528
+ function Du() {
4532
4529
  return typeof window < "u" || typeof chrome < "u";
4533
4530
  }
4534
- const Zr = {
4531
+ const Jr = {
4535
4532
  "set-presence": !0,
4536
4533
  "set-presence-ok": !0,
4537
4534
  "refresh-presence": !0,
4538
4535
  "patch-presence": !0
4539
4536
  };
4540
- function Lu(t, e) {
4537
+ function Uu(t, e) {
4541
4538
  var n;
4542
4539
  const r = typeof t == "string" ? JSON.parse(t) : t;
4543
4540
  if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
4544
4541
  const i = r.result.store;
4545
- r.result.store = Ei(Object.assign(Object.assign({}, i), { useDateObjects: e }));
4542
+ r.result.store = Oi(Object.assign(Object.assign({}, i), { useDateObjects: e }));
4546
4543
  }
4547
4544
  return r;
4548
4545
  }
4549
- function Fu(t, e) {
4546
+ function Lu(t, e) {
4550
4547
  var n;
4551
4548
  const r = Object.assign({}, e);
4552
- return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: Oi(e.result.store) })), r;
4549
+ return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: Si(e.result.store) })), r;
4553
4550
  }
4554
- function Nu(t, e) {
4551
+ function Fu(t, e) {
4555
4552
  switch (t) {
4556
4553
  case "pendingMutations":
4557
4554
  return new Map(typeof e == "string" ? JSON.parse(e) : e);
@@ -4559,7 +4556,7 @@ function Nu(t, e) {
4559
4556
  return e;
4560
4557
  }
4561
4558
  }
4562
- function Ku(t, e) {
4559
+ function Nu(t, e) {
4563
4560
  switch (t) {
4564
4561
  case "pendingMutations":
4565
4562
  return [...e.entries()];
@@ -4567,18 +4564,18 @@ function Ku(t, e) {
4567
4564
  return e;
4568
4565
  }
4569
4566
  }
4570
- function qu(t, e, n) {
4567
+ function Ku(t, e, n) {
4571
4568
  const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
4572
4569
  return r && !i && n && (n.result = r), n || e;
4573
4570
  }
4574
- function Xr(t) {
4571
+ function Zr(t) {
4575
4572
  return [...t].sort((e, n) => {
4576
4573
  const [r, i] = e, [s, o] = n, a = i.order || 0, u = o.order || 0;
4577
4574
  return a == u ? r < s ? -1 : r > s ? 1 : 0 : a - u;
4578
4575
  });
4579
4576
  }
4580
- class Wu {
4581
- constructor(e, n = qi, r = Wi, i, s) {
4577
+ class qu {
4578
+ constructor(e, n = Ki, r = qi, i, s) {
4582
4579
  var o, a, u;
4583
4580
  if (this._isOnline = !0, this._isShutdown = !1, this.status = le.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 = (c, d, f) => {
4584
4581
  var l, p;
@@ -4610,9 +4607,9 @@ class Wu {
4610
4607
  }, this.notifyQueryError = (c, d) => {
4611
4608
  (this.queryCbs[c] || []).forEach((l) => l.cb({ error: d }));
4612
4609
  }, this.pushTx = (c) => {
4613
- this.config.disableValidation || vu(c, this.config.schema);
4610
+ this.config.disableValidation || mu(c, this.config.schema);
4614
4611
  try {
4615
- const d = za({
4612
+ const d = Wa({
4616
4613
  attrs: this.optimisticAttrs(),
4617
4614
  schema: this.config.schema,
4618
4615
  stores: Object.values(this.querySubs.currentValue).map((f) => {
@@ -4636,7 +4633,7 @@ class Wu {
4636
4633
  this._updatePendingMutations((_) => {
4637
4634
  _.set(f, y);
4638
4635
  });
4639
- const b = new Fr();
4636
+ const b = new Lr();
4640
4637
  return this.mutationDeferredStore.set(f, b), this._sendMutation(f, y), this.notifyAll(), b.promise;
4641
4638
  }, this._transportOnOpen = (c) => {
4642
4639
  const d = c.target;
@@ -4701,7 +4698,7 @@ class Wu {
4701
4698
  return;
4702
4699
  }
4703
4700
  this._log.info("[socket][close]", d.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
4704
- }, this._EventSource = s, this.config = Object.assign(Object.assign({}, $u), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (a = this.config.pendingTxCleanupTimeout) !== null && a !== void 0 ? a : Ru, this._pendingMutationCleanupThreshold = (u = this.config.pendingMutationCleanupThreshold) !== null && u !== void 0 ? u : xu, this._log = hu(e.verbose || Bn || zi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Gn }), this.config.schema && (this._linkIndex = Kr(this.config.schema)), !!Uu()) {
4701
+ }, this._EventSource = s, this.config = Object.assign(Object.assign({}, xu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (a = this.config.pendingTxCleanupTimeout) !== null && a !== void 0 ? a : Mu, this._pendingMutationCleanupThreshold = (u = this.config.pendingMutationCleanupThreshold) !== null && u !== void 0 ? u : Ru, this._log = lu(e.verbose || Vn || Wi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Bn }), this.config.schema && (this._linkIndex = Nr(this.config.schema)), !!Du()) {
4705
4702
  if (!e.appId)
4706
4703
  throw new Error("Instant must be initialized with an appId.");
4707
4704
  if (!Fe(e.appId))
@@ -4716,7 +4713,7 @@ class Wu {
4716
4713
  } catch (f) {
4717
4714
  this._log.error("[error] handle broadcast channel", f);
4718
4715
  }
4719
- }))), this._initStorage(n), this._syncTable = new Pu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
4716
+ }))), this._initStorage(n), this._syncTable = new Cu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
4720
4717
  useDateObjects: this.config.useDateObjects
4721
4718
  }, this._log, (c) => Et(this.attrs, c, this.config.enableCardinalityInference, this._linkIndex, this.config.useDateObjects)), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((c) => {
4722
4719
  this._isOnline = c, this._startSocket(), r.listen((d) => {
@@ -4726,7 +4723,7 @@ class Wu {
4726
4723
  }
4727
4724
  }
4728
4725
  updateSchema(e) {
4729
- this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ? Kr(this.config.schema) : null;
4726
+ this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ? Nr(this.config.schema) : null;
4730
4727
  }
4731
4728
  _reactorStats() {
4732
4729
  return {
@@ -4739,11 +4736,11 @@ class Wu {
4739
4736
  this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
4740
4737
  }
4741
4738
  _initStorage(e) {
4742
- this.querySubs = new wn({
4739
+ this.querySubs = new Tn({
4743
4740
  persister: new e(this.config.appId, "querySubs"),
4744
- merge: qu,
4745
- serialize: Fu,
4746
- parse: (n, r) => Lu(r, this.config.useDateObjects),
4741
+ merge: Ku,
4742
+ serialize: Lu,
4743
+ parse: (n, r) => Uu(r, this.config.useDateObjects),
4747
4744
  // objectSize
4748
4745
  objectSize: (n) => {
4749
4746
  var r, i, s, o;
@@ -4759,11 +4756,11 @@ class Wu {
4759
4756
  maxSize: 1e6
4760
4757
  // 1 million triples
4761
4758
  }
4762
- }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new wn({
4759
+ }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Tn({
4763
4760
  persister: new e(this.config.appId, "kv"),
4764
4761
  merge: this._onMergeKv,
4765
- serialize: Ku,
4766
- parse: Nu,
4762
+ serialize: Nu,
4763
+ parse: Fu,
4767
4764
  objectSize: () => 0,
4768
4765
  logger: this._log,
4769
4766
  saveThrottleMs: 100,
@@ -4794,7 +4791,7 @@ class Wu {
4794
4791
  if (s)
4795
4792
  i.resolve({ status: e, eventId: n });
4796
4793
  else if (r != null && r.type) {
4797
- const { status: o } = r, a = Iu(r, ["status"]);
4794
+ const { status: o } = r, a = Pu(r, ["status"]);
4798
4795
  i.reject(new Dt({
4799
4796
  // @ts-expect-error body.type is not constant typed
4800
4797
  body: a,
@@ -4818,7 +4815,7 @@ class Wu {
4818
4815
  _handleReceive(e, n) {
4819
4816
  var r, i, s, o, a, u;
4820
4817
  const c = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
4821
- switch (Zr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
4818
+ switch (Jr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
4822
4819
  case "init-ok": {
4823
4820
  this._setStatus(le.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
4824
4821
  for (const l of Object.keys(this._rooms)) {
@@ -4835,7 +4832,7 @@ class Wu {
4835
4832
  const { q: l, result: p } = n, y = z(l);
4836
4833
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
4837
4834
  break;
4838
- 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"], _ = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, w = Nr(p), g = Et(this.attrs, w, c, this._linkIndex, this.config.useDateObjects);
4835
+ 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"], _ = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, w = Fr(p), g = Et(this.attrs, w, c, this._linkIndex, this.config.useDateObjects);
4839
4836
  this.querySubs.updateInPlace((m) => {
4840
4837
  if (!m[y]) {
4841
4838
  this._log.info("Missing value in querySubs", { hash: y, q: l });
@@ -4873,9 +4870,9 @@ class Wu {
4873
4870
  b !== this._pendingMutations() && this.kv.updateInPlace((g) => {
4874
4871
  g.pendingMutations = b;
4875
4872
  });
4876
- const _ = Xr(b.entries()), w = l.map((g) => {
4873
+ const _ = Zr(b.entries()), w = l.map((g) => {
4877
4874
  var m, E, S, I;
4878
- const x = g["instaql-query"], B = g["instaql-result"], Ve = z(x), lt = Nr(B), Ft = Et(this.attrs, lt, c, this._linkIndex, this.config.useDateObjects), Nt = this._applyOptimisticUpdates(Ft, _, y), ht = (E = (m = B == null ? void 0 : B[0]) === null || m === void 0 ? void 0 : m.data) === null || E === void 0 ? void 0 : E["page-info"], ce = (I = (S = B == null ? void 0 : B[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
4875
+ const x = g["instaql-query"], B = g["instaql-result"], Ve = z(x), lt = Fr(B), Ft = Et(this.attrs, lt, c, this._linkIndex, this.config.useDateObjects), Nt = this._applyOptimisticUpdates(Ft, _, y), ht = (E = (m = B == null ? void 0 : B[0]) === null || m === void 0 ? void 0 : m.data) === null || E === void 0 ? void 0 : E["page-info"], ce = (I = (S = B == null ? void 0 : B[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
4879
4876
  return { q: x, hash: Ve, store: Nt, pageInfo: ht, aggregate: ce };
4880
4877
  });
4881
4878
  w.forEach(({ hash: g, q: m, store: E, pageInfo: S, aggregate: I }) => {
@@ -5038,7 +5035,7 @@ class Wu {
5038
5035
  */
5039
5036
  subscribeQuery(e, n, r) {
5040
5037
  var i;
5041
- this.config.disableValidation || Wr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
5038
+ this.config.disableValidation || qr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
5042
5039
  const s = z(e), o = this.getPreviousResult(e);
5043
5040
  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), () => {
5044
5041
  this._unsubQuery(e, s, n);
@@ -5046,14 +5043,14 @@ class Wu {
5046
5043
  }
5047
5044
  queryOnce(e, n) {
5048
5045
  var r;
5049
- this.config.disableValidation || Wr(e, this.config.schema), n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
5050
- const i = new Fr();
5046
+ this.config.disableValidation || qr(e, this.config.schema), n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
5047
+ const i = new Lr();
5051
5048
  if (!this._isOnline)
5052
5049
  return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
5053
5050
  if (!this.querySubs)
5054
5051
  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;
5055
5052
  const s = z(e), o = this._startQuerySub(e, s);
5056
- 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")), Mu), i.promise;
5053
+ 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")), Iu), i.promise;
5057
5054
  }
5058
5055
  _completeQueryOnce(e, n, r) {
5059
5056
  this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
@@ -5114,7 +5111,7 @@ class Wu {
5114
5111
  a = !0;
5115
5112
  continue;
5116
5113
  }
5117
- const b = a ? wa(o, p) : p;
5114
+ const b = a ? Ta(o, p) : p;
5118
5115
  l.push(b);
5119
5116
  }
5120
5117
  return a ? l : d;
@@ -5124,7 +5121,7 @@ class Wu {
5124
5121
  return a ? c : n;
5125
5122
  }
5126
5123
  _rewriteMutationsSorted(e, n) {
5127
- return Xr(this._rewriteMutations(e, n).entries());
5124
+ return Zr(this._rewriteMutations(e, n).entries());
5128
5125
  }
5129
5126
  // ---------------------------
5130
5127
  // Transact
@@ -5158,11 +5155,11 @@ class Wu {
5158
5155
  if (c && r === c.querySubVersion && s === c.pendingMutationsVersion)
5159
5156
  return c;
5160
5157
  const { store: d, pageInfo: f, aggregate: l, processedTxId: p } = u, y = this._rewriteMutationsSorted(d.attrs, o), b = this._applyOptimisticUpdates(d, y, p);
5161
- return { data: Li({ store: b, pageInfo: f, aggregate: l }, a), querySubVersion: r, pendingMutationsVersion: s };
5158
+ return { data: Ui({ store: b, pageInfo: f, aggregate: l }, a), querySubVersion: r, pendingMutationsVersion: s };
5162
5159
  }
5163
5160
  _applyOptimisticUpdates(e, n, r) {
5164
5161
  for (const [i, s] of n)
5165
- (!s["tx-id"] || r && s["tx-id"] > r) && (e = mo(e, s["tx-steps"]));
5162
+ (!s["tx-id"] || r && s["tx-id"] > r) && (e = wo(e, s["tx-steps"]));
5166
5163
  return e;
5167
5164
  }
5168
5165
  /** Re-compute all subscriptions */
@@ -5250,7 +5247,7 @@ class Wu {
5250
5247
  }
5251
5248
  _trySend(e, n, r) {
5252
5249
  if (this._transport.isOpen()) {
5253
- switch (Zr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
5250
+ switch (Jr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
5254
5251
  case "transact": {
5255
5252
  this._inFlightMutationEventIds.add(e);
5256
5253
  break;
@@ -5271,7 +5268,7 @@ class Wu {
5271
5268
  return;
5272
5269
  }
5273
5270
  const e = this._transport;
5274
- this._transport = Du({
5271
+ this._transport = $u({
5275
5272
  transportType: this._transportType,
5276
5273
  appId: this.config.appId,
5277
5274
  apiURI: this.config.apiURI,
@@ -5307,9 +5304,9 @@ class Wu {
5307
5304
  if (typeof URL > "u")
5308
5305
  return;
5309
5306
  const e = new URL(window.location.href);
5310
- if (e.searchParams.get(en)) {
5307
+ if (e.searchParams.get(Xt)) {
5311
5308
  const n = e.toString();
5312
- e.searchParams.delete(en), e.searchParams.delete("code"), e.searchParams.delete("error");
5309
+ e.searchParams.delete(Xt), e.searchParams.delete("code"), e.searchParams.delete("error");
5313
5310
  const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
5314
5311
  if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
5315
5312
  typeof navigation == "object" && // @ts-ignore (waiting for ts support)
@@ -5334,7 +5331,7 @@ class Wu {
5334
5331
  if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
5335
5332
  return null;
5336
5333
  const s = new URLSearchParams(window.location.search);
5337
- if (!s.get(en))
5334
+ if (!s.get(Xt))
5338
5335
  return null;
5339
5336
  const o = s.get("error");
5340
5337
  if (o)
@@ -5344,7 +5341,7 @@ class Wu {
5344
5341
  return null;
5345
5342
  this._replaceUrlAfterOAuth();
5346
5343
  try {
5347
- const u = yield this._getCurrentUser(), c = (u == null ? void 0 : u.type) === "guest", { user: d } = yield Ur({
5344
+ const u = yield this._getCurrentUser(), c = (u == null ? void 0 : u.type) === "guest", { user: d } = yield Dr({
5348
5345
  apiURI: this.config.apiURI,
5349
5346
  appId: this.config.appId,
5350
5347
  code: a,
@@ -5474,7 +5471,7 @@ class Wu {
5474
5471
  }), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
5475
5472
  }
5476
5473
  sendMagicCode({ email: e }) {
5477
- return eu({
5474
+ return Xa({
5478
5475
  apiURI: this.config.apiURI,
5479
5476
  appId: this.config.appId,
5480
5477
  email: e
@@ -5483,7 +5480,7 @@ class Wu {
5483
5480
  signInWithMagicCode(e) {
5484
5481
  return F(this, arguments, void 0, function* ({ email: n, code: r }) {
5485
5482
  var i;
5486
- const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield tu({
5483
+ const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield eu({
5487
5484
  apiURI: this.config.apiURI,
5488
5485
  appId: this.config.appId,
5489
5486
  email: n,
@@ -5495,7 +5492,7 @@ class Wu {
5495
5492
  }
5496
5493
  signInWithCustomToken(e) {
5497
5494
  return F(this, void 0, void 0, function* () {
5498
- const n = yield nu({
5495
+ const n = yield tu({
5499
5496
  apiURI: this.config.apiURI,
5500
5497
  appId: this.config.appId,
5501
5498
  refreshToken: e
@@ -5505,7 +5502,7 @@ class Wu {
5505
5502
  }
5506
5503
  signInAsGuest() {
5507
5504
  return F(this, void 0, void 0, function* () {
5508
- const e = yield ru({
5505
+ const e = yield nu({
5509
5506
  apiURI: this.config.apiURI,
5510
5507
  appId: this.config.appId
5511
5508
  });
@@ -5521,7 +5518,7 @@ class Wu {
5521
5518
  this._log.info("[auth-invalidate] skipped invalidateToken");
5522
5519
  return;
5523
5520
  }
5524
- su({
5521
+ iu({
5525
5522
  apiURI: this.config.apiURI,
5526
5523
  appId: this.config.appId,
5527
5524
  refreshToken: i
@@ -5556,7 +5553,7 @@ class Wu {
5556
5553
  exchangeCodeForToken(e) {
5557
5554
  return F(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
5558
5555
  var i;
5559
- const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield Ur({
5556
+ const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield Dr({
5560
5557
  apiURI: this.config.apiURI,
5561
5558
  appId: this.config.appId,
5562
5559
  code: n,
@@ -5579,7 +5576,7 @@ class Wu {
5579
5576
  signInWithIdToken(e) {
5580
5577
  return F(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
5581
5578
  var s;
5582
- const o = yield this.getCurrentUser(), a = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, u = yield iu({
5579
+ const o = yield this.getCurrentUser(), a = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, u = yield ru({
5583
5580
  apiURI: this.config.apiURI,
5584
5581
  appId: this.config.appId,
5585
5582
  idToken: n,
@@ -5620,7 +5617,7 @@ class Wu {
5620
5617
  // TODO: look into typing again
5621
5618
  getPresence(e, n, r = {}) {
5622
5619
  const i = this._rooms[n], s = this._presence[n];
5623
- return !i || !s || !s.result ? null : Object.assign(Object.assign({}, fu(s.result, r, this._sessionId)), { isLoading: !i.isConnected, error: i.error });
5620
+ return !i || !s || !s.result ? null : Object.assign(Object.assign({}, du(s.result, r, this._sessionId)), { isLoading: !i.isConnected, error: i.error });
5624
5621
  }
5625
5622
  // TODO: look into typing again
5626
5623
  publishPresence(e, n, r) {
@@ -5670,7 +5667,7 @@ class Wu {
5670
5667
  }
5671
5668
  _notifyPresenceSub(e, n) {
5672
5669
  const r = this.getPresence("", e, n);
5673
- r && (n.prev && !lu(r, n.prev) || (n.prev = r, n.cb(r)));
5670
+ r && (n.prev && !fu(r, n.prev) || (n.prev = r, n.cb(r)));
5674
5671
  }
5675
5672
  _patchPresencePeers(e, n) {
5676
5673
  var r, i, s;
@@ -5681,13 +5678,13 @@ class Wu {
5681
5678
  for (let [d, f, l] of n)
5682
5679
  switch (f) {
5683
5680
  case "+":
5684
- qs(c, d, l);
5681
+ Ks(c, d, l);
5685
5682
  break;
5686
5683
  case "r":
5687
- Or(c, d, l);
5684
+ Sr(c, d, l);
5688
5685
  break;
5689
5686
  case "-":
5690
- mi(c, d);
5687
+ wi(c, d);
5691
5688
  break;
5692
5689
  }
5693
5690
  delete c[this._sessionId];
@@ -5699,7 +5696,7 @@ class Wu {
5699
5696
  delete r[this._sessionId];
5700
5697
  const i = Object.fromEntries(Object.entries(r).map(([s, o]) => [s, o.data]));
5701
5698
  this._presence = Pt(this._presence, (s) => {
5702
- Or(s, [e, "result", "peers"], i);
5699
+ Sr(s, [e, "result", "peers"], i);
5703
5700
  });
5704
5701
  }
5705
5702
  // --------
@@ -5744,14 +5741,14 @@ class Wu {
5744
5741
  return F(this, void 0, void 0, function* () {
5745
5742
  var i;
5746
5743
  const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
5747
- return ou(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
5744
+ return su(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
5748
5745
  });
5749
5746
  }
5750
5747
  deleteFile(e) {
5751
5748
  return F(this, void 0, void 0, function* () {
5752
5749
  var n;
5753
5750
  const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
5754
- return yield au({
5751
+ return yield ou({
5755
5752
  apiURI: this.config.apiURI,
5756
5753
  appId: this.config.appId,
5757
5754
  path: e,
@@ -5764,20 +5761,20 @@ class Wu {
5764
5761
  upload(e, n) {
5765
5762
  return F(this, void 0, void 0, function* () {
5766
5763
  var r;
5767
- 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, a = yield uu({
5764
+ 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, a = yield au({
5768
5765
  apiURI: this.config.apiURI,
5769
5766
  appId: this.config.appId,
5770
5767
  fileName: o,
5771
5768
  refreshToken: s
5772
5769
  });
5773
- return yield cu(a, n);
5770
+ return yield uu(a, n);
5774
5771
  });
5775
5772
  }
5776
5773
  getDownloadUrl(e) {
5777
5774
  return F(this, void 0, void 0, function* () {
5778
5775
  var n;
5779
5776
  const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
5780
- return yield du({
5777
+ return yield cu({
5781
5778
  apiURI: this.config.apiURI,
5782
5779
  appId: this.config.appId,
5783
5780
  path: e,
@@ -5786,9 +5783,9 @@ class Wu {
5786
5783
  });
5787
5784
  }
5788
5785
  }
5789
- function zu(t, e) {
5786
+ function Wu(t, e) {
5790
5787
  return new Lt(
5791
- Xi(t, e),
5788
+ Zi(t, e),
5792
5789
  // (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
5793
5790
  // type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
5794
5791
  // EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
@@ -5798,28 +5795,28 @@ function zu(t, e) {
5798
5795
  void 0
5799
5796
  );
5800
5797
  }
5801
- function Vu(t) {
5798
+ function zu(t) {
5802
5799
  return new Ut(t, {});
5803
5800
  }
5804
- function Bu() {
5801
+ function Vu() {
5805
5802
  return new H("string", !0, !1);
5806
5803
  }
5807
- function Gu() {
5804
+ function Bu() {
5808
5805
  return new H("number", !0, !1);
5809
5806
  }
5810
- function Qu() {
5807
+ function Gu() {
5811
5808
  return new H("boolean", !0, !1);
5812
5809
  }
5813
- function Hu() {
5810
+ function Qu() {
5814
5811
  return new H("date", !0, !1);
5815
5812
  }
5816
- function Yu() {
5813
+ function Hu() {
5817
5814
  return new H("json", !0, !1);
5818
5815
  }
5819
- function Ju() {
5816
+ function Yu() {
5820
5817
  return new H("json", !0, !1);
5821
5818
  }
5822
- function Xi(t, e) {
5819
+ function Zi(t, e) {
5823
5820
  var n, r, i, s;
5824
5821
  const o = { fwd: {}, rev: {} };
5825
5822
  for (const u of Object.values(e))
@@ -5835,10 +5832,10 @@ function Xi(t, e) {
5835
5832
  new Ut(c.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
5836
5833
  ]));
5837
5834
  }
5838
- function Zu({ entities: t, links: e, rooms: n }) {
5835
+ function Ju({ entities: t, links: e, rooms: n }) {
5839
5836
  const r = e ?? {}, i = n ?? {};
5840
5837
  return new Lt(
5841
- Xi(t, r),
5838
+ Zi(t, r),
5842
5839
  // (XXX): LinksDef<any> stems from TypeScript's inability to reconcile the
5843
5840
  // type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
5844
5841
  // EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
@@ -5848,23 +5845,23 @@ function Zu({ entities: t, links: e, rooms: n }) {
5848
5845
  i
5849
5846
  );
5850
5847
  }
5851
- const Wc = {
5848
+ const qc = {
5852
5849
  // constructs
5853
- graph: zu,
5854
- schema: Zu,
5855
- entity: Vu,
5850
+ graph: Wu,
5851
+ schema: Ju,
5852
+ entity: zu,
5856
5853
  // value types
5857
- string: Bu,
5858
- number: Gu,
5859
- boolean: Qu,
5860
- date: Hu,
5861
- json: Yu,
5862
- any: Ju
5854
+ string: Vu,
5855
+ number: Bu,
5856
+ boolean: Gu,
5857
+ date: Qu,
5858
+ json: Hu,
5859
+ any: Yu
5863
5860
  };
5864
5861
  let mt;
5865
- function Xu(t, e) {
5862
+ function Zu(t, e) {
5866
5863
  mt == null || mt.dispose();
5867
- const n = sc(e), r = nc(e, a), i = tc(ec(t));
5864
+ const n = ic(e), r = tc(e, a), i = ec(Xu(t));
5868
5865
  function s(d) {
5869
5866
  var f;
5870
5867
  d.source === i.element.contentWindow && ((f = d.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && a();
@@ -5886,10 +5883,10 @@ function Xu(t, e) {
5886
5883
  }
5887
5884
  return c();
5888
5885
  }
5889
- function ec(t) {
5890
- return `${Bn || Vi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
5886
+ function Xu(t) {
5887
+ return `${Vn || zi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
5891
5888
  }
5892
- function tc(t) {
5889
+ function ec(t) {
5893
5890
  const e = document.createElement("iframe");
5894
5891
  return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
5895
5892
  width: "100%",
@@ -5898,7 +5895,7 @@ function tc(t) {
5898
5895
  border: "none"
5899
5896
  }), { element: e };
5900
5897
  }
5901
- function nc(t, e) {
5898
+ function tc(t, e) {
5902
5899
  const n = `
5903
5900
  <svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
5904
5901
  <rect width="512" height="512" fill="black"/>
@@ -5908,7 +5905,7 @@ function nc(t, e) {
5908
5905
  return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
5909
5906
  // pos
5910
5907
  position: "fixed"
5911
- }, rc(t.position)), {
5908
+ }, nc(t.position)), {
5912
5909
  height: "32px",
5913
5910
  width: "32px",
5914
5911
  // layout
@@ -5923,7 +5920,7 @@ function nc(t, e) {
5923
5920
  cursor: "pointer"
5924
5921
  })), r.addEventListener("click", e), { element: r };
5925
5922
  }
5926
- function rc(t) {
5923
+ function nc(t) {
5927
5924
  switch (t) {
5928
5925
  case "bottom-left":
5929
5926
  return { bottom: "24px", left: "24px" };
@@ -5935,7 +5932,7 @@ function rc(t) {
5935
5932
  return { top: "24px", left: "24px" };
5936
5933
  }
5937
5934
  }
5938
- function ic(t) {
5935
+ function rc(t) {
5939
5936
  switch (t) {
5940
5937
  case "bottom-left":
5941
5938
  return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
@@ -5947,47 +5944,47 @@ function ic(t) {
5947
5944
  return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
5948
5945
  }
5949
5946
  }
5950
- function sc(t) {
5947
+ function ic(t) {
5951
5948
  const e = document.createElement("div");
5952
- Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, ic(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";
5949
+ Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, rc(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";
5953
5950
  function n() {
5954
5951
  return e.style.display !== "none";
5955
5952
  }
5956
5953
  return { element: e, isVisible: n };
5957
5954
  }
5958
- const oc = {
5955
+ const sc = {
5959
5956
  apiURI: "https://api.instantdb.com",
5960
5957
  websocketURI: "wss://api.instantdb.com/runtime/session"
5961
5958
  };
5962
- function ac() {
5959
+ function oc() {
5963
5960
  var t;
5964
5961
  return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
5965
5962
  }
5966
- function uc() {
5963
+ function ac() {
5967
5964
  var t;
5968
5965
  return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
5969
5966
  }
5970
- function mn(t) {
5967
+ function wn(t) {
5971
5968
  const e = t.__adminToken;
5972
5969
  return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
5973
5970
  }
5974
- const vn = uc(), ei = ac();
5975
- class cc {
5971
+ const mn = ac(), Xr = oc();
5972
+ class uc {
5976
5973
  constructor(e) {
5977
5974
  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);
5978
5975
  }
5979
5976
  }
5980
- class dc {
5977
+ class cc {
5981
5978
  constructor(e) {
5982
5979
  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);
5983
5980
  }
5984
5981
  }
5985
- function fc(t) {
5982
+ function dc(t) {
5986
5983
  return JSON.parse(JSON.stringify(t));
5987
5984
  }
5988
- class lc {
5985
+ class fc {
5989
5986
  constructor(e) {
5990
- this.tx = Vn(), this._reactor = e, this.auth = new cc(this._reactor), this.storage = new dc(this._reactor);
5987
+ this.tx = zn(), this._reactor = e, this.auth = new uc(this._reactor), this.storage = new cc(this._reactor);
5991
5988
  }
5992
5989
  /**
5993
5990
  * Use this to write data! You can create, update, delete, and link objects
@@ -6128,7 +6125,7 @@ class lc {
6128
6125
  };
6129
6126
  }
6130
6127
  shutdown() {
6131
- delete vn[mn(this._reactor.config)], this._reactor.shutdown();
6128
+ delete mn[wn(this._reactor.config)], this._reactor.shutdown();
6132
6129
  }
6133
6130
  /**
6134
6131
  * Use this for one-off queries.
@@ -6161,33 +6158,33 @@ class lc {
6161
6158
  return this._reactor.subscribeTable(e, n);
6162
6159
  }
6163
6160
  }
6164
- function ti(t) {
6161
+ function ei(t) {
6165
6162
  if (!t)
6166
6163
  return "0";
6167
- const e = ei.get(t);
6164
+ const e = Xr.get(t);
6168
6165
  if (e)
6169
6166
  return e;
6170
6167
  const n = z(t);
6171
- return ei.set(t, n), n;
6168
+ return Xr.set(t, n), n;
6172
6169
  }
6173
- function hc(t, e) {
6174
- return ti(t._reactor.config.schema) !== ti(e);
6170
+ function lc(t, e) {
6171
+ return ei(t._reactor.config.schema) !== ei(e);
6175
6172
  }
6176
- function pc(t, e, n, r, i) {
6173
+ function hc(t, e, n, r, i) {
6177
6174
  var s;
6178
- const o = Object.assign(Object.assign({}, t), { useDateObjects: (s = t.useDateObjects) !== null && s !== void 0 ? s : !1 }), a = vn[mn(o)];
6175
+ const o = Object.assign(Object.assign({}, t), { useDateObjects: (s = t.useDateObjects) !== null && s !== void 0 ? s : !1 }), a = mn[wn(o)];
6179
6176
  if (a)
6180
- return hc(a, o.schema) && a._reactor.updateSchema(o.schema), a;
6181
- const u = new Wu(Object.assign(Object.assign(Object.assign({}, oc), o), { cardinalityInference: !!o.schema }), e || qi, n || Wi, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Gn }), i), c = new lc(u);
6182
- return vn[mn(o)] = c, yc(o.appId, o.devtool), c;
6177
+ return lc(a, o.schema) && a._reactor.updateSchema(o.schema), a;
6178
+ const u = new qu(Object.assign(Object.assign(Object.assign({}, sc), o), { cardinalityInference: !!o.schema }), e || Ki, n || qi, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Bn }), i), c = new fc(u);
6179
+ return mn[wn(o)] = c, pc(o.appId, o.devtool), c;
6183
6180
  }
6184
- function yc(t, e) {
6181
+ function pc(t, e) {
6185
6182
  if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
6186
6183
  return;
6187
6184
  const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
6188
- n.allowedHosts.includes(window.location.hostname) && Xu(t, n);
6185
+ n.allowedHosts.includes(window.location.hostname) && Zu(t, n);
6189
6186
  }
6190
- var Sn = { exports: {} }, He = {};
6187
+ var vn = { exports: {} }, He = {};
6191
6188
  /**
6192
6189
  * @license React
6193
6190
  * react-jsx-runtime.production.min.js
@@ -6197,11 +6194,11 @@ var Sn = { exports: {} }, He = {};
6197
6194
  * This source code is licensed under the MIT license found in the
6198
6195
  * LICENSE file in the root directory of this source tree.
6199
6196
  */
6200
- var ni;
6201
- function bc() {
6202
- if (ni) return He;
6203
- ni = 1;
6204
- var t = di, 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 };
6197
+ var ti;
6198
+ function yc() {
6199
+ if (ti) return He;
6200
+ ti = 1;
6201
+ var t = ci, 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 };
6205
6202
  function o(a, u, c) {
6206
6203
  var d, f = {}, l = null, p = null;
6207
6204
  c !== void 0 && (l = "" + c), u.key !== void 0 && (l = "" + u.key), u.ref !== void 0 && (p = u.ref);
@@ -6211,10 +6208,10 @@ function bc() {
6211
6208
  }
6212
6209
  return He.Fragment = n, He.jsx = o, He.jsxs = o, He;
6213
6210
  }
6214
- var Ye = {}, ri;
6215
- function _c() {
6216
- if (ri) return Ye;
6217
- ri = 1;
6211
+ var Ye = {}, ni;
6212
+ function bc() {
6213
+ if (ni) return Ye;
6214
+ ni = 1;
6218
6215
  var t = {};
6219
6216
  /**
6220
6217
  * @license React
@@ -6226,7 +6223,7 @@ function _c() {
6226
6223
  * LICENSE file in the root directory of this source tree.
6227
6224
  */
6228
6225
  return t.NODE_ENV !== "production" && function() {
6229
- var e = di, 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"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), d = 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, _ = "@@iterator";
6226
+ var e = ci, 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"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), d = 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, _ = "@@iterator";
6230
6227
  function w(h) {
6231
6228
  if (h === null || typeof h != "object")
6232
6229
  return null;
@@ -6315,18 +6312,18 @@ function _c() {
6315
6312
  }
6316
6313
  return null;
6317
6314
  }
6318
- var we = Object.assign, Be = 0, Yn, Jn, Zn, Xn, er, tr, nr;
6319
- function rr() {
6315
+ var we = Object.assign, Be = 0, Hn, Yn, Jn, Zn, Xn, er, tr;
6316
+ function nr() {
6320
6317
  }
6321
- rr.__reactDisabledLog = !0;
6322
- function ts() {
6318
+ nr.__reactDisabledLog = !0;
6319
+ function es() {
6323
6320
  {
6324
6321
  if (Be === 0) {
6325
- Yn = console.log, Jn = console.info, Zn = console.warn, Xn = console.error, er = console.group, tr = console.groupCollapsed, nr = console.groupEnd;
6322
+ Hn = console.log, Yn = console.info, Jn = console.warn, Zn = console.error, Xn = console.group, er = console.groupCollapsed, tr = console.groupEnd;
6326
6323
  var h = {
6327
6324
  configurable: !0,
6328
6325
  enumerable: !0,
6329
- value: rr,
6326
+ value: nr,
6330
6327
  writable: !0
6331
6328
  };
6332
6329
  Object.defineProperties(console, {
@@ -6342,7 +6339,7 @@ function _c() {
6342
6339
  Be++;
6343
6340
  }
6344
6341
  }
6345
- function ns() {
6342
+ function ts() {
6346
6343
  {
6347
6344
  if (Be--, Be === 0) {
6348
6345
  var h = {
@@ -6352,25 +6349,25 @@ function _c() {
6352
6349
  };
6353
6350
  Object.defineProperties(console, {
6354
6351
  log: we({}, h, {
6355
- value: Yn
6352
+ value: Hn
6356
6353
  }),
6357
6354
  info: we({}, h, {
6358
- value: Jn
6355
+ value: Yn
6359
6356
  }),
6360
6357
  warn: we({}, h, {
6361
- value: Zn
6358
+ value: Jn
6362
6359
  }),
6363
6360
  error: we({}, h, {
6364
- value: Xn
6361
+ value: Zn
6365
6362
  }),
6366
6363
  group: we({}, h, {
6367
- value: er
6364
+ value: Xn
6368
6365
  }),
6369
6366
  groupCollapsed: we({}, h, {
6370
- value: tr
6367
+ value: er
6371
6368
  }),
6372
6369
  groupEnd: we({}, h, {
6373
- value: nr
6370
+ value: tr
6374
6371
  })
6375
6372
  });
6376
6373
  }
@@ -6393,10 +6390,10 @@ function _c() {
6393
6390
  }
6394
6391
  var Wt = !1, yt;
6395
6392
  {
6396
- var rs = typeof WeakMap == "function" ? WeakMap : Map;
6397
- yt = new rs();
6393
+ var ns = typeof WeakMap == "function" ? WeakMap : Map;
6394
+ yt = new ns();
6398
6395
  }
6399
- function ir(h, T) {
6396
+ function rr(h, T) {
6400
6397
  if (!h || Wt)
6401
6398
  return "";
6402
6399
  {
@@ -6409,7 +6406,7 @@ function _c() {
6409
6406
  var P = Error.prepareStackTrace;
6410
6407
  Error.prepareStackTrace = void 0;
6411
6408
  var M;
6412
- M = Kt.current, Kt.current = null, ts();
6409
+ M = Kt.current, Kt.current = null, es();
6413
6410
  try {
6414
6411
  if (T) {
6415
6412
  var C = function() {
@@ -6462,15 +6459,15 @@ function _c() {
6462
6459
  }
6463
6460
  }
6464
6461
  } finally {
6465
- Wt = !1, Kt.current = M, ns(), Error.prepareStackTrace = P;
6462
+ Wt = !1, Kt.current = M, ts(), Error.prepareStackTrace = P;
6466
6463
  }
6467
6464
  var Ie = h ? h.displayName || h.name : "", me = Ie ? pt(Ie) : "";
6468
6465
  return typeof h == "function" && yt.set(h, me), me;
6469
6466
  }
6470
- function is(h, T, v) {
6471
- return ir(h, !1);
6467
+ function rs(h, T, v) {
6468
+ return rr(h, !1);
6472
6469
  }
6473
- function ss(h) {
6470
+ function is(h) {
6474
6471
  var T = h.prototype;
6475
6472
  return !!(T && T.isReactComponent);
6476
6473
  }
@@ -6478,7 +6475,7 @@ function _c() {
6478
6475
  if (h == null)
6479
6476
  return "";
6480
6477
  if (typeof h == "function")
6481
- return ir(h, ss(h));
6478
+ return rr(h, is(h));
6482
6479
  if (typeof h == "string")
6483
6480
  return pt(h);
6484
6481
  switch (h) {
@@ -6490,7 +6487,7 @@ function _c() {
6490
6487
  if (typeof h == "object")
6491
6488
  switch (h.$$typeof) {
6492
6489
  case c:
6493
- return is(h.render);
6490
+ return rs(h.render);
6494
6491
  case l:
6495
6492
  return bt(h.type, T, v);
6496
6493
  case p: {
@@ -6503,15 +6500,15 @@ function _c() {
6503
6500
  }
6504
6501
  return "";
6505
6502
  }
6506
- var Ge = Object.prototype.hasOwnProperty, sr = {}, or = g.ReactDebugCurrentFrame;
6503
+ var Ge = Object.prototype.hasOwnProperty, ir = {}, sr = g.ReactDebugCurrentFrame;
6507
6504
  function _t(h) {
6508
6505
  if (h) {
6509
6506
  var T = h._owner, v = bt(h.type, h._source, T ? T.type : null);
6510
- or.setExtraStackFrame(v);
6507
+ sr.setExtraStackFrame(v);
6511
6508
  } else
6512
- or.setExtraStackFrame(null);
6509
+ sr.setExtraStackFrame(null);
6513
6510
  }
6514
- function os(h, T, v, O, P) {
6511
+ function ss(h, T, v, O, P) {
6515
6512
  {
6516
6513
  var M = Function.call.bind(Ge);
6517
6514
  for (var C in h)
@@ -6526,41 +6523,41 @@ function _c() {
6526
6523
  } catch (D) {
6527
6524
  j = D;
6528
6525
  }
6529
- j && !(j instanceof Error) && (_t(P), m("%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", v, C, typeof j), _t(null)), j instanceof Error && !(j.message in sr) && (sr[j.message] = !0, _t(P), m("Failed %s type: %s", v, j.message), _t(null));
6526
+ j && !(j instanceof Error) && (_t(P), m("%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", v, C, typeof j), _t(null)), j instanceof Error && !(j.message in ir) && (ir[j.message] = !0, _t(P), m("Failed %s type: %s", v, j.message), _t(null));
6530
6527
  }
6531
6528
  }
6532
6529
  }
6533
- var as = Array.isArray;
6530
+ var os = Array.isArray;
6534
6531
  function zt(h) {
6535
- return as(h);
6532
+ return os(h);
6536
6533
  }
6537
- function us(h) {
6534
+ function as(h) {
6538
6535
  {
6539
6536
  var T = typeof Symbol == "function" && Symbol.toStringTag, v = T && h[Symbol.toStringTag] || h.constructor.name || "Object";
6540
6537
  return v;
6541
6538
  }
6542
6539
  }
6543
- function cs(h) {
6540
+ function us(h) {
6544
6541
  try {
6545
- return ar(h), !1;
6542
+ return or(h), !1;
6546
6543
  } catch {
6547
6544
  return !0;
6548
6545
  }
6549
6546
  }
6550
- function ar(h) {
6547
+ function or(h) {
6551
6548
  return "" + h;
6552
6549
  }
6553
- function ur(h) {
6554
- if (cs(h))
6555
- return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", us(h)), ar(h);
6550
+ function ar(h) {
6551
+ if (us(h))
6552
+ return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", as(h)), or(h);
6556
6553
  }
6557
- var cr = g.ReactCurrentOwner, ds = {
6554
+ var ur = g.ReactCurrentOwner, cs = {
6558
6555
  key: !0,
6559
6556
  ref: !0,
6560
6557
  __self: !0,
6561
6558
  __source: !0
6562
- }, dr, fr;
6563
- function fs(h) {
6559
+ }, cr, dr;
6560
+ function ds(h) {
6564
6561
  if (Ge.call(h, "ref")) {
6565
6562
  var T = Object.getOwnPropertyDescriptor(h, "ref").get;
6566
6563
  if (T && T.isReactWarning)
@@ -6568,7 +6565,7 @@ function _c() {
6568
6565
  }
6569
6566
  return h.ref !== void 0;
6570
6567
  }
6571
- function ls(h) {
6568
+ function fs(h) {
6572
6569
  if (Ge.call(h, "key")) {
6573
6570
  var T = Object.getOwnPropertyDescriptor(h, "key").get;
6574
6571
  if (T && T.isReactWarning)
@@ -6576,13 +6573,13 @@ function _c() {
6576
6573
  }
6577
6574
  return h.key !== void 0;
6578
6575
  }
6579
- function hs(h, T) {
6580
- typeof h.ref == "string" && cr.current;
6576
+ function ls(h, T) {
6577
+ typeof h.ref == "string" && ur.current;
6581
6578
  }
6582
- function ps(h, T) {
6579
+ function hs(h, T) {
6583
6580
  {
6584
6581
  var v = function() {
6585
- dr || (dr = !0, m("%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)", T));
6582
+ cr || (cr = !0, m("%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)", T));
6586
6583
  };
6587
6584
  v.isReactWarning = !0, Object.defineProperty(h, "key", {
6588
6585
  get: v,
@@ -6590,10 +6587,10 @@ function _c() {
6590
6587
  });
6591
6588
  }
6592
6589
  }
6593
- function ys(h, T) {
6590
+ function ps(h, T) {
6594
6591
  {
6595
6592
  var v = function() {
6596
- fr || (fr = !0, m("%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)", T));
6593
+ dr || (dr = !0, m("%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)", T));
6597
6594
  };
6598
6595
  v.isReactWarning = !0, Object.defineProperty(h, "ref", {
6599
6596
  get: v,
@@ -6601,7 +6598,7 @@ function _c() {
6601
6598
  });
6602
6599
  }
6603
6600
  }
6604
- var bs = function(h, T, v, O, P, M, C) {
6601
+ var ys = function(h, T, v, O, P, M, C) {
6605
6602
  var j = {
6606
6603
  // This tag allows us to uniquely identify this as a React Element
6607
6604
  $$typeof: n,
@@ -6630,12 +6627,12 @@ function _c() {
6630
6627
  value: P
6631
6628
  }), Object.freeze && (Object.freeze(j.props), Object.freeze(j)), j;
6632
6629
  };
6633
- function _s(h, T, v, O, P) {
6630
+ function bs(h, T, v, O, P) {
6634
6631
  {
6635
6632
  var M, C = {}, j = null, G = null;
6636
- v !== void 0 && (ur(v), j = "" + v), ls(T) && (ur(T.key), j = "" + T.key), fs(T) && (G = T.ref, hs(T, P));
6633
+ v !== void 0 && (ar(v), j = "" + v), fs(T) && (ar(T.key), j = "" + T.key), ds(T) && (G = T.ref, ls(T, P));
6637
6634
  for (M in T)
6638
- Ge.call(T, M) && !ds.hasOwnProperty(M) && (C[M] = T[M]);
6635
+ Ge.call(T, M) && !cs.hasOwnProperty(M) && (C[M] = T[M]);
6639
6636
  if (h && h.defaultProps) {
6640
6637
  var D = h.defaultProps;
6641
6638
  for (M in D)
@@ -6643,25 +6640,25 @@ function _c() {
6643
6640
  }
6644
6641
  if (j || G) {
6645
6642
  var L = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
6646
- j && ps(C, L), G && ys(C, L);
6643
+ j && hs(C, L), G && ps(C, L);
6647
6644
  }
6648
- return bs(h, j, G, P, O, cr.current, C);
6645
+ return ys(h, j, G, P, O, ur.current, C);
6649
6646
  }
6650
6647
  }
6651
- var Vt = g.ReactCurrentOwner, lr = g.ReactDebugCurrentFrame;
6648
+ var Vt = g.ReactCurrentOwner, fr = g.ReactDebugCurrentFrame;
6652
6649
  function Pe(h) {
6653
6650
  if (h) {
6654
6651
  var T = h._owner, v = bt(h.type, h._source, T ? T.type : null);
6655
- lr.setExtraStackFrame(v);
6652
+ fr.setExtraStackFrame(v);
6656
6653
  } else
6657
- lr.setExtraStackFrame(null);
6654
+ fr.setExtraStackFrame(null);
6658
6655
  }
6659
6656
  var Bt;
6660
6657
  Bt = !1;
6661
6658
  function Gt(h) {
6662
6659
  return typeof h == "object" && h !== null && h.$$typeof === n;
6663
6660
  }
6664
- function hr() {
6661
+ function lr() {
6665
6662
  {
6666
6663
  if (Vt.current) {
6667
6664
  var h = ce(Vt.current.type);
@@ -6673,13 +6670,13 @@ Check the render method of \`` + h + "`.";
6673
6670
  return "";
6674
6671
  }
6675
6672
  }
6676
- function gs(h) {
6673
+ function _s(h) {
6677
6674
  return "";
6678
6675
  }
6679
- var pr = {};
6680
- function Ts(h) {
6676
+ var hr = {};
6677
+ function gs(h) {
6681
6678
  {
6682
- var T = hr();
6679
+ var T = lr();
6683
6680
  if (!T) {
6684
6681
  var v = typeof h == "string" ? h : h.displayName || h.name;
6685
6682
  v && (T = `
@@ -6689,27 +6686,27 @@ Check the top-level render call using <` + v + ">.");
6689
6686
  return T;
6690
6687
  }
6691
6688
  }
6692
- function yr(h, T) {
6689
+ function pr(h, T) {
6693
6690
  {
6694
6691
  if (!h._store || h._store.validated || h.key != null)
6695
6692
  return;
6696
6693
  h._store.validated = !0;
6697
- var v = Ts(T);
6698
- if (pr[v])
6694
+ var v = gs(T);
6695
+ if (hr[v])
6699
6696
  return;
6700
- pr[v] = !0;
6697
+ hr[v] = !0;
6701
6698
  var O = "";
6702
6699
  h && h._owner && h._owner !== Vt.current && (O = " It was passed a child from " + ce(h._owner.type) + "."), Pe(h), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', v, O), Pe(null);
6703
6700
  }
6704
6701
  }
6705
- function br(h, T) {
6702
+ function yr(h, T) {
6706
6703
  {
6707
6704
  if (typeof h != "object")
6708
6705
  return;
6709
6706
  if (zt(h))
6710
6707
  for (var v = 0; v < h.length; v++) {
6711
6708
  var O = h[v];
6712
- Gt(O) && yr(O, T);
6709
+ Gt(O) && pr(O, T);
6713
6710
  }
6714
6711
  else if (Gt(h))
6715
6712
  h._store && (h._store.validated = !0);
@@ -6717,11 +6714,11 @@ Check the top-level render call using <` + v + ">.");
6717
6714
  var P = w(h);
6718
6715
  if (typeof P == "function" && P !== h.entries)
6719
6716
  for (var M = P.call(h), C; !(C = M.next()).done; )
6720
- Gt(C.value) && yr(C.value, T);
6717
+ Gt(C.value) && pr(C.value, T);
6721
6718
  }
6722
6719
  }
6723
6720
  }
6724
- function ws(h) {
6721
+ function Ts(h) {
6725
6722
  {
6726
6723
  var T = h.type;
6727
6724
  if (T == null || typeof T == "string")
@@ -6737,7 +6734,7 @@ Check the top-level render call using <` + v + ">.");
6737
6734
  return;
6738
6735
  if (v) {
6739
6736
  var O = ce(T);
6740
- os(v, h.props, "prop", O, h);
6737
+ ss(v, h.props, "prop", O, h);
6741
6738
  } else if (T.PropTypes !== void 0 && !Bt) {
6742
6739
  Bt = !0;
6743
6740
  var P = ce(T);
@@ -6746,7 +6743,7 @@ Check the top-level render call using <` + v + ">.");
6746
6743
  typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
6747
6744
  }
6748
6745
  }
6749
- function ms(h) {
6746
+ function ws(h) {
6750
6747
  {
6751
6748
  for (var T = Object.keys(h.props), v = 0; v < T.length; v++) {
6752
6749
  var O = T[v];
@@ -6758,19 +6755,19 @@ Check the top-level render call using <` + v + ">.");
6758
6755
  h.ref !== null && (Pe(h), m("Invalid attribute `ref` supplied to `React.Fragment`."), Pe(null));
6759
6756
  }
6760
6757
  }
6761
- var _r = {};
6762
- function gr(h, T, v, O, P, M) {
6758
+ var br = {};
6759
+ function _r(h, T, v, O, P, M) {
6763
6760
  {
6764
6761
  var C = Ft(h);
6765
6762
  if (!C) {
6766
6763
  var j = "";
6767
6764
  (h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (j += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
6768
- var G = gs();
6769
- G ? j += G : j += hr();
6765
+ var G = _s();
6766
+ G ? j += G : j += lr();
6770
6767
  var D;
6771
6768
  h === null ? D = "null" : zt(h) ? D = "array" : h !== void 0 && h.$$typeof === n ? (D = "<" + (ce(h.type) || "Unknown") + " />", j = " Did you accidentally export a JSX literal instead of a component?") : D = typeof h, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", D, j);
6772
6769
  }
6773
- var L = _s(h, T, v, P, M);
6770
+ var L = bs(h, T, v, P, M);
6774
6771
  if (L == null)
6775
6772
  return L;
6776
6773
  if (C) {
@@ -6779,56 +6776,56 @@ Check the top-level render call using <` + v + ">.");
6779
6776
  if (O)
6780
6777
  if (zt(re)) {
6781
6778
  for (var Ie = 0; Ie < re.length; Ie++)
6782
- br(re[Ie], h);
6779
+ yr(re[Ie], h);
6783
6780
  Object.freeze && Object.freeze(re);
6784
6781
  } else
6785
6782
  m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
6786
6783
  else
6787
- br(re, h);
6784
+ yr(re, h);
6788
6785
  }
6789
6786
  if (Ge.call(T, "key")) {
6790
- var me = ce(h), Y = Object.keys(T).filter(function(js) {
6791
- return js !== "key";
6787
+ var me = ce(h), Y = Object.keys(T).filter(function(As) {
6788
+ return As !== "key";
6792
6789
  }), Qt = Y.length > 0 ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}";
6793
- if (!_r[me + Qt]) {
6794
- var As = Y.length > 0 ? "{" + Y.join(": ..., ") + ": ...}" : "{}";
6790
+ if (!br[me + Qt]) {
6791
+ var Es = Y.length > 0 ? "{" + Y.join(": ..., ") + ": ...}" : "{}";
6795
6792
  m(`A props object containing a "key" prop is being spread into JSX:
6796
6793
  let props = %s;
6797
6794
  <%s {...props} />
6798
6795
  React keys must be passed directly to JSX without using spread:
6799
6796
  let props = %s;
6800
- <%s key={someKey} {...props} />`, Qt, me, As, me), _r[me + Qt] = !0;
6797
+ <%s key={someKey} {...props} />`, Qt, me, Es, me), br[me + Qt] = !0;
6801
6798
  }
6802
6799
  }
6803
- return h === i ? ms(L) : ws(L), L;
6800
+ return h === i ? ws(L) : Ts(L), L;
6804
6801
  }
6805
6802
  }
6806
- function vs(h, T, v) {
6807
- return gr(h, T, v, !0);
6803
+ function ms(h, T, v) {
6804
+ return _r(h, T, v, !0);
6808
6805
  }
6809
- function Ss(h, T, v) {
6810
- return gr(h, T, v, !1);
6806
+ function vs(h, T, v) {
6807
+ return _r(h, T, v, !1);
6811
6808
  }
6812
- var Os = Ss, Es = vs;
6813
- Ye.Fragment = i, Ye.jsx = Os, Ye.jsxs = Es;
6809
+ var Ss = vs, Os = ms;
6810
+ Ye.Fragment = i, Ye.jsx = Ss, Ye.jsxs = Os;
6814
6811
  }(), Ye;
6815
6812
  }
6816
- var gc = {};
6817
- gc.NODE_ENV === "production" ? Sn.exports = bc() : Sn.exports = _c();
6818
- var W = Sn.exports;
6819
- const Tc = {
6813
+ var _c = {};
6814
+ _c.NODE_ENV === "production" ? vn.exports = yc() : vn.exports = bc();
6815
+ var W = vn.exports;
6816
+ const gc = {
6820
6817
  isLoading: !0,
6821
6818
  data: void 0,
6822
6819
  pageInfo: void 0,
6823
6820
  error: void 0
6824
6821
  };
6825
- function ii(t) {
6822
+ function ri(t) {
6826
6823
  return Object.assign({ isLoading: !t, data: void 0, pageInfo: void 0, error: void 0 }, t || {});
6827
6824
  }
6828
- function wc(t, e, n) {
6825
+ function Tc(t, e, n) {
6829
6826
  e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
6830
- const r = e ? fc(e) : null, i = z(r), s = at(ii(t._reactor.getPreviousResult(r))), o = ge(
6831
- (u) => (s.current = ii(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (d) => {
6827
+ const r = e ? dc(e) : null, i = z(r), s = at(ri(t._reactor.getPreviousResult(r))), o = ge(
6828
+ (u) => (s.current = ri(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (d) => {
6832
6829
  s.current = Object.assign({
6833
6830
  isLoading: !d,
6834
6831
  // @ts-expect-error: ts thinks this will always be overwritten
@@ -6843,9 +6840,9 @@ function wc(t, e, n) {
6843
6840
  // Build a new subscribe function if the query changes
6844
6841
  [i]
6845
6842
  );
6846
- return { state: nn(o, () => s.current, () => Tc), query: r };
6843
+ return { state: tn(o, () => s.current, () => gc), query: r };
6847
6844
  }
6848
- function mc() {
6845
+ function wc() {
6849
6846
  const t = at(null);
6850
6847
  je(() => {
6851
6848
  n();
@@ -6858,14 +6855,14 @@ function mc() {
6858
6855
  }
6859
6856
  return { set: e, clear: n };
6860
6857
  }
6861
- const vc = 1e3;
6862
- function Sc(t, e, n) {
6858
+ const mc = 1e3;
6859
+ function vc(t, e, n) {
6863
6860
  const r = at(n);
6864
6861
  r.current = n, je(() => t.core._reactor.subscribeTopic(t.id, e, (s, o) => {
6865
6862
  r.current(s, o);
6866
6863
  }), [t.id, e]);
6867
6864
  }
6868
- function Oc(t, e) {
6865
+ function Sc(t, e) {
6869
6866
  return je(() => t.core._reactor.joinRoom(t.id), [t.id]), ge((r) => {
6870
6867
  t.core._reactor.publishTopic({
6871
6868
  roomType: t.type,
@@ -6875,9 +6872,9 @@ function Oc(t, e) {
6875
6872
  });
6876
6873
  }, [t.id, e]);
6877
6874
  }
6878
- function Ec(t, e = {}) {
6875
+ function Oc(t, e = {}) {
6879
6876
  var n, r;
6880
- const [i, s] = fi(() => {
6877
+ const [i, s] = di(() => {
6881
6878
  var u;
6882
6879
  return (u = t.core._reactor.getPresence(t.type, t.id, e)) !== null && u !== void 0 ? u : {
6883
6880
  peers: {},
@@ -6890,15 +6887,15 @@ function Ec(t, e = {}) {
6890
6887
  const o = ge((u) => {
6891
6888
  t.core._reactor.publishPresence(t.type, t.id, u);
6892
6889
  }, [t.type, t.id]);
6893
- return rn(() => Object.assign(Object.assign({}, i), { publishPresence: o }), [i, o]);
6890
+ return nn(() => Object.assign(Object.assign({}, i), { publishPresence: o }), [i, o]);
6894
6891
  }
6895
- function Ac(t, e, n) {
6892
+ function Ec(t, e, n) {
6896
6893
  je(() => t.core._reactor.joinRoom(t.id, e), [t.id]), je(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
6897
6894
  }
6898
- function jc(t, e, n = {}) {
6899
- const r = mc(), i = Se.usePresence(t, {
6895
+ function Ac(t, e, n = {}) {
6896
+ const r = wc(), i = Se.usePresence(t, {
6900
6897
  keys: [e]
6901
- }), s = rn(() => {
6898
+ }), s = nn(() => {
6902
6899
  var d;
6903
6900
  const f = t._core._reactor.getPresence(t.type, t.id);
6904
6901
  return n != null && n.writeOnly ? [] : Object.values((d = f == null ? void 0 : f.peers) !== null && d !== void 0 ? d : {}).filter((l) => l[e] === !0);
@@ -6906,7 +6903,7 @@ function jc(t, e, n = {}) {
6906
6903
  var f;
6907
6904
  t.core._reactor.publishPresence(t.type, t.id, {
6908
6905
  [e]: d
6909
- }), d && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f : vc, () => {
6906
+ }), d && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f : mc, () => {
6910
6907
  t.core._reactor.publishPresence(t.type, t.id, {
6911
6908
  [e]: null
6912
6909
  });
@@ -6916,7 +6913,7 @@ function jc(t, e, n = {}) {
6916
6913
  o(l);
6917
6914
  }, [n.stopOnEnter, o]), u = ge(() => {
6918
6915
  o(!1);
6919
- }, [o]), c = rn(() => ({ onKeyDown: a, onBlur: u }), [a, u]);
6916
+ }, [o]), c = nn(() => ({ onKeyDown: a, onBlur: u }), [a, u]);
6920
6917
  return {
6921
6918
  active: s,
6922
6919
  setActive: o,
@@ -6924,20 +6921,20 @@ function jc(t, e, n = {}) {
6924
6921
  };
6925
6922
  }
6926
6923
  const Se = {
6927
- useTopicEffect: Sc,
6928
- usePublishTopic: Oc,
6929
- usePresence: Ec,
6930
- useSyncPresence: Ac,
6931
- useTypingIndicator: jc
6924
+ useTopicEffect: vc,
6925
+ usePublishTopic: Sc,
6926
+ usePresence: Oc,
6927
+ useSyncPresence: Ec,
6928
+ useTypingIndicator: Ac
6932
6929
  };
6933
- class kc {
6930
+ class jc {
6934
6931
  constructor(e, n, r) {
6935
6932
  this.useTopicEffect = (i, s) => {
6936
6933
  Se.useTopicEffect(this, i, s);
6937
6934
  }, this.usePublishTopic = (i) => Se.usePublishTopic(this, i), this.usePresence = (i = {}) => Se.usePresence(this, i), this.useSyncPresence = (i, s) => Se.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => Se.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
6938
6935
  }
6939
6936
  }
6940
- var Cc = function(t, e, n, r) {
6937
+ var kc = function(t, e, n, r) {
6941
6938
  function i(s) {
6942
6939
  return s instanceof n ? s : new n(function(o) {
6943
6940
  o(s);
@@ -6964,26 +6961,26 @@ var Cc = function(t, e, n, r) {
6964
6961
  c((r = r.apply(t, e || [])).next());
6965
6962
  });
6966
6963
  };
6967
- const Pc = {
6964
+ const Cc = {
6968
6965
  isLoading: !0,
6969
6966
  user: void 0,
6970
6967
  error: void 0
6971
6968
  };
6972
- class Ic {
6969
+ class Pc {
6973
6970
  constructor(e, n) {
6974
- this.tx = Vn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
6975
- const [i, s] = fi(null);
6971
+ this.tx = zn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
6972
+ const [i, s] = di(null);
6976
6973
  return je(() => {
6977
- Cc(this, void 0, void 0, function* () {
6974
+ kc(this, void 0, void 0, function* () {
6978
6975
  const a = yield this.getLocalId(r);
6979
6976
  s(a);
6980
6977
  });
6981
6978
  }, [r]), i;
6982
- }, this.rooms = Se, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => wc(this.core, r, i).state, this.useAuth = () => {
6979
+ }, this.rooms = Se, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => Tc(this.core, r, i).state, this.useAuth = () => {
6983
6980
  const r = at(this.core._reactor._currentUserCached), i = ge((o) => this.core.subscribeAuth((u) => {
6984
6981
  r.current = Object.assign({ isLoading: !1 }, u), o();
6985
6982
  }), []);
6986
- return nn(i, () => r.current, () => Pc);
6983
+ return tn(i, () => r.current, () => Cc);
6987
6984
  }, this.useUser = () => {
6988
6985
  const { user: r } = this.useAuth();
6989
6986
  if (!r)
@@ -6993,7 +6990,7 @@ class Ic {
6993
6990
  const r = at(this.core._reactor.status), i = ge((o) => this.core.subscribeConnectionStatus((u) => {
6994
6991
  u !== r.current && (r.current = u, o());
6995
6992
  }), []);
6996
- return nn(
6993
+ return tn(
6997
6994
  i,
6998
6995
  () => r.current,
6999
6996
  // For SSR, always return 'connecting' as the initial state
@@ -7005,7 +7002,7 @@ class Ic {
7005
7002
  }, this.SignedOut = ({ children: r }) => {
7006
7003
  const i = this.useAuth();
7007
7004
  return i.isLoading || i.error || i.user ? null : W.jsx(W.Fragment, { children: r });
7008
- }, this.core = pc(
7005
+ }, this.core = hc(
7009
7006
  e,
7010
7007
  // @ts-expect-error because TS can't resolve subclass statics
7011
7008
  this.constructor.Storage,
@@ -7029,7 +7026,7 @@ class Ic {
7029
7026
  * const { peers } = db.rooms.usePresence(room);
7030
7027
  */
7031
7028
  room(e = "_defaultRoomType", n = "_defaultRoomId") {
7032
- return new kc(this.core, e, n);
7029
+ return new jc(this.core, e, n);
7033
7030
  }
7034
7031
  /**
7035
7032
  * One time query for the logged in state. This is useful
@@ -7045,22 +7042,22 @@ class Ic {
7045
7042
  return this.core.getAuth();
7046
7043
  }
7047
7044
  }
7048
- class si extends Error {
7045
+ class ii extends Error {
7049
7046
  constructor(e, n) {
7050
7047
  super(e), this.name = "ParseError", this.type = n.type, this.field = n.field, this.value = n.value, this.line = n.line;
7051
7048
  }
7052
7049
  }
7053
- function tn(t) {
7050
+ function en(t) {
7054
7051
  }
7055
- function Mc(t) {
7052
+ function Ic(t) {
7056
7053
  if (typeof t == "function")
7057
7054
  throw new TypeError(
7058
7055
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
7059
7056
  );
7060
- const { onEvent: e = tn, onError: n = tn, onRetry: r = tn, onComment: i } = t;
7057
+ const { onEvent: e = en, onError: n = en, onRetry: r = en, onComment: i } = t;
7061
7058
  let s = "", o = !0, a, u = "", c = "";
7062
7059
  function d(b) {
7063
- const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, g] = Rc(`${s}${_}`);
7060
+ const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, g] = Mc(`${s}${_}`);
7064
7061
  for (const m of w)
7065
7062
  f(m);
7066
7063
  s = g, o = !1;
@@ -7096,7 +7093,7 @@ function Mc(t) {
7096
7093
  break;
7097
7094
  case "retry":
7098
7095
  /^\d+$/.test(_) ? r(parseInt(_, 10)) : n(
7099
- new si(`Invalid \`retry\` value: "${_}"`, {
7096
+ new ii(`Invalid \`retry\` value: "${_}"`, {
7100
7097
  type: "invalid-retry",
7101
7098
  value: _,
7102
7099
  line: w
@@ -7105,7 +7102,7 @@ function Mc(t) {
7105
7102
  break;
7106
7103
  default:
7107
7104
  n(
7108
- new si(
7105
+ new ii(
7109
7106
  `Unknown field "${b.length > 20 ? `${b.slice(0, 20)}…` : b}"`,
7110
7107
  { type: "unknown-field", field: b, value: _, line: w }
7111
7108
  )
@@ -7128,7 +7125,7 @@ function Mc(t) {
7128
7125
  }
7129
7126
  return { feed: d, reset: y };
7130
7127
  }
7131
- function Rc(t) {
7128
+ function Mc(t) {
7132
7129
  const e = [];
7133
7130
  let n = "", r = 0;
7134
7131
  for (; r < t.length; ) {
@@ -7146,7 +7143,7 @@ function Rc(t) {
7146
7143
  }
7147
7144
  return [e, n];
7148
7145
  }
7149
- class oi extends Event {
7146
+ class si extends Event {
7150
7147
  /**
7151
7148
  * Constructs a new `ErrorEvent` instance. This is typically not called directly,
7152
7149
  * but rather emitted by the `EventSource` object when an error occurs.
@@ -7171,7 +7168,7 @@ class oi extends Event {
7171
7168
  * @returns A string representation of the error
7172
7169
  */
7173
7170
  [Symbol.for("nodejs.util.inspect.custom")](e, n, r) {
7174
- return r(ai(this), n);
7171
+ return r(oi(this), n);
7175
7172
  }
7176
7173
  /**
7177
7174
  * Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
@@ -7185,17 +7182,17 @@ class oi extends Event {
7185
7182
  * @returns A string representation of the error
7186
7183
  */
7187
7184
  [Symbol.for("Deno.customInspect")](e, n) {
7188
- return e(ai(this), n);
7185
+ return e(oi(this), n);
7189
7186
  }
7190
7187
  }
7191
- function xc(t) {
7188
+ function Rc(t) {
7192
7189
  const e = globalThis.DOMException;
7193
7190
  return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
7194
7191
  }
7195
- function On(t) {
7196
- return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(On).join(", ") : "cause" in t && t.cause instanceof Error ? `${t}: ${On(t.cause)}` : t.message : `${t}`;
7192
+ function Sn(t) {
7193
+ return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(Sn).join(", ") : "cause" in t && t.cause instanceof Error ? `${t}: ${Sn(t.cause)}` : t.message : `${t}`;
7197
7194
  }
7198
- function ai(t) {
7195
+ function oi(t) {
7199
7196
  return {
7200
7197
  type: t.type,
7201
7198
  message: t.message,
@@ -7205,13 +7202,13 @@ function ai(t) {
7205
7202
  timeStamp: t.timeStamp
7206
7203
  };
7207
7204
  }
7208
- var es = (t) => {
7205
+ var Xi = (t) => {
7209
7206
  throw TypeError(t);
7210
- }, Qn = (t, e, n) => e.has(t) || es("Cannot " + n), A = (t, e, n) => (Qn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), N = (t, e, n) => e.has(t) ? es("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Qn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (Qn(t, e, "access private method"), n), J, Oe, Re, At, Rt, st, De, ot, _e, xe, Le, $e, et, se, En, An, jn, ui, kn, Cn, tt, Pn, In;
7207
+ }, Gn = (t, e, n) => e.has(t) || Xi("Cannot " + n), A = (t, e, n) => (Gn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), N = (t, e, n) => e.has(t) ? Xi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Gn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (Gn(t, e, "access private method"), n), J, Oe, Re, At, Rt, st, De, ot, _e, xe, Le, $e, et, se, On, En, An, ai, jn, kn, tt, Cn, Pn;
7211
7208
  class jt extends EventTarget {
7212
7209
  constructor(e, n) {
7213
7210
  var r, i;
7214
- super(), N(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, N(this, J), N(this, Oe), N(this, Re), N(this, At), N(this, Rt), N(this, st), N(this, De), N(this, ot, null), N(this, _e), N(this, xe), N(this, Le, null), N(this, $e, null), N(this, et, null), N(this, An, async (s) => {
7211
+ super(), N(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, N(this, J), N(this, Oe), N(this, Re), N(this, At), N(this, Rt), N(this, st), N(this, De), N(this, ot, null), N(this, _e), N(this, xe), N(this, Le, null), N(this, $e, null), N(this, et, null), N(this, En, async (s) => {
7215
7212
  var o;
7216
7213
  A(this, xe).reset();
7217
7214
  const { body: a, redirected: u, status: c, headers: d } = s;
@@ -7239,11 +7236,11 @@ class jt extends EventTarget {
7239
7236
  let y = !0;
7240
7237
  do {
7241
7238
  const { done: b, value: _ } = await p.read();
7242
- _ && A(this, xe).feed(l.decode(_, { stream: !b })), b && (y = !1, A(this, xe).reset(), he(this, se, Pn).call(this));
7239
+ _ && A(this, xe).feed(l.decode(_, { stream: !b })), b && (y = !1, A(this, xe).reset(), he(this, se, Cn).call(this));
7243
7240
  } while (y);
7241
+ }), N(this, An, (s) => {
7242
+ $(this, _e, void 0), !(s.name === "AbortError" || s.type === "aborted") && he(this, se, Cn).call(this, Sn(s));
7244
7243
  }), N(this, jn, (s) => {
7245
- $(this, _e, void 0), !(s.name === "AbortError" || s.type === "aborted") && he(this, se, Pn).call(this, On(s));
7246
- }), N(this, kn, (s) => {
7247
7244
  typeof s.id == "string" && $(this, ot, s.id);
7248
7245
  const o = new MessageEvent(s.event || "message", {
7249
7246
  data: s.data,
@@ -7251,25 +7248,25 @@ class jt extends EventTarget {
7251
7248
  lastEventId: s.id || ""
7252
7249
  });
7253
7250
  A(this, $e) && (!s.event || s.event === "message") && A(this, $e).call(this, o), this.dispatchEvent(o);
7254
- }), N(this, Cn, (s) => {
7251
+ }), N(this, kn, (s) => {
7255
7252
  $(this, st, s);
7256
- }), N(this, In, () => {
7257
- $(this, De, void 0), A(this, J) === this.CONNECTING && he(this, se, En).call(this);
7253
+ }), N(this, Pn, () => {
7254
+ $(this, De, void 0), A(this, J) === this.CONNECTING && he(this, se, On).call(this);
7258
7255
  });
7259
7256
  try {
7260
7257
  if (e instanceof URL)
7261
7258
  $(this, Oe, e);
7262
7259
  else if (typeof e == "string")
7263
- $(this, Oe, new URL(e, $c()));
7260
+ $(this, Oe, new URL(e, xc()));
7264
7261
  else
7265
7262
  throw new Error("Invalid URL");
7266
7263
  } catch {
7267
- throw xc("An invalid or illegal string was specified");
7264
+ throw Rc("An invalid or illegal string was specified");
7268
7265
  }
7269
- $(this, xe, Mc({
7270
- onEvent: A(this, kn),
7271
- onRetry: A(this, Cn)
7272
- })), $(this, J, this.CONNECTING), $(this, st, 3e3), $(this, Rt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, At, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), he(this, se, En).call(this);
7266
+ $(this, xe, Ic({
7267
+ onEvent: A(this, jn),
7268
+ onRetry: A(this, kn)
7269
+ })), $(this, J, this.CONNECTING), $(this, st, 3e3), $(this, Rt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, At, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), he(this, se, On).call(this);
7273
7270
  }
7274
7271
  /**
7275
7272
  * Returns the state of this EventSource object's connection. It can have the values described below.
@@ -7347,15 +7344,15 @@ J = /* @__PURE__ */ new WeakMap(), Oe = /* @__PURE__ */ new WeakMap(), Re = /* @
7347
7344
  *
7348
7345
  * @internal
7349
7346
  */
7350
- En = function() {
7351
- $(this, J, this.CONNECTING), $(this, _e, new AbortController()), A(this, Rt)(A(this, Oe), he(this, se, ui).call(this)).then(A(this, An)).catch(A(this, jn));
7352
- }, An = /* @__PURE__ */ new WeakMap(), jn = /* @__PURE__ */ new WeakMap(), /**
7347
+ On = function() {
7348
+ $(this, J, this.CONNECTING), $(this, _e, new AbortController()), A(this, Rt)(A(this, Oe), he(this, se, ai).call(this)).then(A(this, En)).catch(A(this, An));
7349
+ }, En = /* @__PURE__ */ new WeakMap(), An = /* @__PURE__ */ new WeakMap(), /**
7353
7350
  * Get request options for the `fetch()` request
7354
7351
  *
7355
7352
  * @returns The request options
7356
7353
  * @internal
7357
7354
  */
7358
- ui = function() {
7355
+ ai = function() {
7359
7356
  var t;
7360
7357
  const e = {
7361
7358
  // [spec] Let `corsAttributeState` be `Anonymous`…
@@ -7367,7 +7364,7 @@ ui = function() {
7367
7364
  signal: (t = A(this, _e)) == null ? void 0 : t.signal
7368
7365
  };
7369
7366
  return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
7370
- }, kn = /* @__PURE__ */ new WeakMap(), Cn = /* @__PURE__ */ new WeakMap(), /**
7367
+ }, jn = /* @__PURE__ */ new WeakMap(), kn = /* @__PURE__ */ new WeakMap(), /**
7371
7368
  * Handles the process referred to in the EventSource specification as "failing a connection".
7372
7369
  *
7373
7370
  * @param error - The error causing the connection to fail
@@ -7377,7 +7374,7 @@ ui = function() {
7377
7374
  tt = function(t, e) {
7378
7375
  var n;
7379
7376
  A(this, J) !== this.CLOSED && $(this, J, this.CLOSED);
7380
- const r = new oi("error", { code: e, message: t });
7377
+ const r = new si("error", { code: e, message: t });
7381
7378
  (n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r);
7382
7379
  }, /**
7383
7380
  * Schedules a reconnection attempt against the EventSource endpoint.
@@ -7386,14 +7383,14 @@ tt = function(t, e) {
7386
7383
  * @param code - The HTTP status code, if available
7387
7384
  * @internal
7388
7385
  */
7389
- Pn = function(t, e) {
7386
+ Cn = function(t, e) {
7390
7387
  var n;
7391
7388
  if (A(this, J) === this.CLOSED)
7392
7389
  return;
7393
7390
  $(this, J, this.CONNECTING);
7394
- const r = new oi("error", { code: e, message: t });
7395
- (n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r), $(this, De, setTimeout(A(this, In), A(this, st)));
7396
- }, In = /* @__PURE__ */ new WeakMap(), /**
7391
+ const r = new si("error", { code: e, message: t });
7392
+ (n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r), $(this, De, setTimeout(A(this, Pn), A(this, st)));
7393
+ }, Pn = /* @__PURE__ */ new WeakMap(), /**
7397
7394
  * ReadyState representing an EventSource currently trying to connect
7398
7395
  *
7399
7396
  * @public
@@ -7409,25 +7406,25 @@ jt.OPEN = 1, /**
7409
7406
  * @public
7410
7407
  */
7411
7408
  jt.CLOSED = 2;
7412
- function $c() {
7409
+ function xc() {
7413
7410
  const t = "document" in globalThis ? globalThis.document : void 0;
7414
7411
  return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
7415
7412
  }
7416
- const Hn = class Hn extends Ic {
7413
+ const Qn = class Qn extends Pc {
7417
7414
  };
7418
- Hn.EventSourceImpl = jt;
7419
- let Mn = Hn;
7420
- function Dc(t) {
7415
+ Qn.EventSourceImpl = jt;
7416
+ let In = Qn;
7417
+ function $c(t) {
7421
7418
  const e = {
7422
7419
  ...t,
7423
7420
  useDateObjects: t.useDateObjects ?? !1
7424
7421
  };
7425
- return new Mn(e, {
7426
- "@instantdb/react": Gn
7422
+ return new In(e, {
7423
+ "@instantdb/react": Bn
7427
7424
  });
7428
7425
  }
7429
- const zc = Dc;
7430
- function Vc({
7426
+ const Wc = $c;
7427
+ function zc({
7431
7428
  as: t = "div",
7432
7429
  spaceId: e,
7433
7430
  room: n,
@@ -7479,7 +7476,7 @@ function Vc({
7479
7476
  [d]: void 0
7480
7477
  });
7481
7478
  }
7482
- return ks(
7479
+ return js(
7483
7480
  t,
7484
7481
  {
7485
7482
  onMouseMove: y,
@@ -7498,9 +7495,9 @@ function Vc({
7498
7495
  "div",
7499
7496
  {
7500
7497
  style: {
7501
- ...ci,
7502
- ...Lc,
7503
- zIndex: c !== void 0 ? c : Fc
7498
+ ...ui,
7499
+ ...Uc,
7500
+ zIndex: c !== void 0 ? c : Lc
7504
7501
  },
7505
7502
  children: Object.entries(f.peers).map(([g, m]) => {
7506
7503
  const E = m[d];
@@ -7508,7 +7505,7 @@ function Vc({
7508
7505
  "div",
7509
7506
  {
7510
7507
  style: {
7511
- ...ci,
7508
+ ...ui,
7512
7509
  transform: `translate(${E.xPercent}%, ${E.yPercent}%)`,
7513
7510
  transformOrigin: "0 0",
7514
7511
  transition: "transform 100ms"
@@ -7516,7 +7513,7 @@ function Vc({
7516
7513
  children: a ? a({
7517
7514
  color: E.color,
7518
7515
  presence: l == null ? void 0 : l.peers[g]
7519
- }) : /* @__PURE__ */ W.jsx(Uc, { ...E })
7516
+ }) : /* @__PURE__ */ W.jsx(Dc, { ...E })
7520
7517
  },
7521
7518
  g
7522
7519
  ) : null;
@@ -7527,7 +7524,7 @@ function Vc({
7527
7524
  ]
7528
7525
  );
7529
7526
  }
7530
- function Uc({ color: t }) {
7527
+ function Dc({ color: t }) {
7531
7528
  const n = t || "black";
7532
7529
  return /* @__PURE__ */ W.jsxs(
7533
7530
  "svg",
@@ -7574,27 +7571,27 @@ function Uc({ color: t }) {
7574
7571
  }
7575
7572
  );
7576
7573
  }
7577
- const ci = {
7574
+ const ui = {
7578
7575
  position: "absolute",
7579
7576
  top: 0,
7580
7577
  left: 0,
7581
7578
  bottom: 0,
7582
7579
  right: 0
7583
- }, Lc = {
7580
+ }, Uc = {
7584
7581
  overflow: "hidden",
7585
7582
  pointerEvents: "none",
7586
7583
  userSelect: "none"
7587
- }, Fc = 99999;
7584
+ }, Lc = 99999;
7588
7585
  export {
7589
- Vc as Cursors,
7586
+ zc as Cursors,
7590
7587
  Dt as InstantAPIError,
7591
- Ic as InstantReactAbstractDatabase,
7592
- Mn as InstantReactWebDatabase,
7588
+ Pc as InstantReactAbstractDatabase,
7589
+ In as InstantReactWebDatabase,
7593
7590
  ve as SyncTableCallbackEventType,
7594
- Wc as i,
7591
+ qc as i,
7595
7592
  K as id,
7596
- Dc as init,
7597
- zc as init_experimental,
7598
- Kc as lookup,
7599
- qc as tx
7593
+ $c as init,
7594
+ Wc as init_experimental,
7595
+ Nc as lookup,
7596
+ Kc as tx
7600
7597
  };