@instantdb/react 0.22.157-branch-extra-fields.23026294545.1 → 0.22.157-branch-cli-link-required.23069467657.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,7 +1,7 @@
1
- var wi = Object.defineProperty;
2
- var Ti = (n, e, t) => e in n ? wi(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var h = (n, e, t) => Ti(n, typeof e != "symbol" ? e + "" : e, t);
4
- import ss, { useRef as Xe, useCallback as Me, useSyncExternalStore as hn, useEffect as Fe, useMemo as pn, useState as is, createElement as Si } from "react";
1
+ var mi = Object.defineProperty;
2
+ var wi = (n, e, t) => e in n ? mi(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var h = (n, e, t) => wi(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import rs, { useRef as Xe, useCallback as Me, useSyncExternalStore as dn, useEffect as Fe, useMemo as hn, useState as ss, createElement as Ti } from "react";
5
5
  function J(n) {
6
6
  if (typeof n == "number")
7
7
  return (Math.abs(n * 2654435761) >>> 0).toString(16);
@@ -44,14 +44,14 @@ const q = {
44
44
  Remove: "remove",
45
45
  Replace: "replace",
46
46
  Add: "add"
47
- }, os = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), vi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Mt = Symbol.iterator, pe = {
47
+ }, is = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Si = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Mt = Symbol.iterator, pe = {
48
48
  mutable: "mutable",
49
49
  immutable: "immutable"
50
- }, Wn = {};
50
+ }, Nn = {};
51
51
  function ht(n, e) {
52
52
  return n instanceof Map ? n.has(e) : Object.prototype.hasOwnProperty.call(n, e);
53
53
  }
54
- function gr(n, e) {
54
+ function br(n, e) {
55
55
  if (e in n) {
56
56
  let t = Reflect.getPrototypeOf(n);
57
57
  for (; t; ) {
@@ -62,10 +62,10 @@ function gr(n, e) {
62
62
  }
63
63
  }
64
64
  }
65
- function Kn(n) {
65
+ function Wn(n) {
66
66
  return Object.getPrototypeOf(n) === Set.prototype;
67
67
  }
68
- function qn(n) {
68
+ function Kn(n) {
69
69
  return Object.getPrototypeOf(n) === Map.prototype;
70
70
  }
71
71
  function he(n) {
@@ -76,9 +76,9 @@ function Ne(n) {
76
76
  return !!R(n);
77
77
  }
78
78
  function R(n) {
79
- return typeof n != "object" ? null : n == null ? void 0 : n[os];
79
+ return typeof n != "object" ? null : n == null ? void 0 : n[is];
80
80
  }
81
- function zn(n) {
81
+ function qn(n) {
82
82
  var e;
83
83
  const t = R(n);
84
84
  return t ? (e = t.copy) !== null && e !== void 0 ? e : t.original : n;
@@ -89,7 +89,7 @@ function Se(n, e) {
89
89
  let t;
90
90
  return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, pe)) === pe.immutable || typeof t == "function");
91
91
  }
92
- function as(n, e = []) {
92
+ function os(n, e = []) {
93
93
  if (Object.hasOwnProperty.call(n, "key")) {
94
94
  const t = n.parent.copy, r = R(Ie(t, n.key));
95
95
  if (r !== null && (r == null ? void 0 : r.original) !== n.original)
@@ -100,10 +100,10 @@ function as(n, e = []) {
100
100
  e.push(i);
101
101
  }
102
102
  if (n.parent)
103
- return as(n.parent, e);
103
+ return os(n.parent, e);
104
104
  e.reverse();
105
105
  try {
106
- Ei(n.copy, e);
106
+ vi(n.copy, e);
107
107
  } catch {
108
108
  return null;
109
109
  }
@@ -125,7 +125,7 @@ function rn(n, e) {
125
125
  function Ce(n, e) {
126
126
  return n === e ? n !== 0 || 1 / n === 1 / e : n !== n && e !== e;
127
127
  }
128
- function yn(n) {
128
+ function pn(n) {
129
129
  if (n)
130
130
  for (; n.finalities.revoke.length > 0; )
131
131
  n.finalities.revoke.pop()();
@@ -136,7 +136,7 @@ function Ue(n, e) {
136
136
  return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
137
137
  }).join("/");
138
138
  }
139
- function Ei(n, e) {
139
+ function vi(n, e) {
140
140
  for (let t = 0; t < e.length - 1; t += 1) {
141
141
  const r = e[t];
142
142
  if (n = Ie(We(n) === 3 ? Array.from(n) : n, r), typeof n != "object")
@@ -144,7 +144,7 @@ function Ei(n, e) {
144
144
  }
145
145
  return n;
146
146
  }
147
- function Oi(n) {
147
+ function Ei(n) {
148
148
  const e = Object.create(Object.getPrototypeOf(n));
149
149
  return Reflect.ownKeys(n).forEach((t) => {
150
150
  let r = Reflect.getOwnPropertyDescriptor(n, t);
@@ -160,26 +160,26 @@ function Oi(n) {
160
160
  }), Reflect.defineProperty(e, t, r);
161
161
  }), e;
162
162
  }
163
- const ki = Object.prototype.propertyIsEnumerable;
164
- function cs(n, e) {
163
+ const Oi = Object.prototype.propertyIsEnumerable;
164
+ function as(n, e) {
165
165
  let t;
166
166
  if (Array.isArray(n))
167
167
  return Array.prototype.concat.call(n);
168
168
  if (n instanceof Set) {
169
- if (!Kn(n)) {
169
+ if (!Wn(n)) {
170
170
  const r = Object.getPrototypeOf(n).constructor;
171
171
  return new r(n.values());
172
172
  }
173
173
  return Set.prototype.difference ? Set.prototype.difference.call(n, /* @__PURE__ */ new Set()) : new Set(n.values());
174
174
  } else if (n instanceof Map) {
175
- if (!qn(n)) {
175
+ if (!Kn(n)) {
176
176
  const r = Object.getPrototypeOf(n).constructor;
177
177
  return new r(n);
178
178
  }
179
179
  return new Map(n);
180
180
  } else if (e != null && e.mark && (t = e.mark(n, pe), t !== void 0) && t !== pe.mutable) {
181
181
  if (t === pe.immutable)
182
- return Oi(n);
182
+ return Ei(n);
183
183
  if (typeof t == "function") {
184
184
  if (e.enablePatches || e.enableAutoFreeze)
185
185
  throw new Error("You can't use mark and patches or auto freeze together.");
@@ -191,17 +191,17 @@ function cs(n, e) {
191
191
  return Object.keys(n).forEach((s) => {
192
192
  r[s] = n[s];
193
193
  }), Object.getOwnPropertySymbols(n).forEach((s) => {
194
- ki.call(n, s) && (r[s] = n[s]);
194
+ Oi.call(n, s) && (r[s] = n[s]);
195
195
  }), r;
196
196
  } else
197
197
  throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
198
198
  }
199
199
  function re(n) {
200
- n.copy || (n.copy = cs(n.original, n.options));
200
+ n.copy || (n.copy = as(n.original, n.options));
201
201
  }
202
202
  function at(n) {
203
203
  if (!Se(n))
204
- return zn(n);
204
+ return qn(n);
205
205
  if (Array.isArray(n))
206
206
  return n.map(at);
207
207
  if (n instanceof Map) {
@@ -209,7 +209,7 @@ function at(n) {
209
209
  r,
210
210
  at(s)
211
211
  ]);
212
- if (!qn(n)) {
212
+ if (!Kn(n)) {
213
213
  const r = Object.getPrototypeOf(n).constructor;
214
214
  return new r(t);
215
215
  }
@@ -217,7 +217,7 @@ function at(n) {
217
217
  }
218
218
  if (n instanceof Set) {
219
219
  const t = Array.from(n).map(at);
220
- if (!Kn(n)) {
220
+ if (!Wn(n)) {
221
221
  const r = Object.getPrototypeOf(n).constructor;
222
222
  return new r(t);
223
223
  }
@@ -235,7 +235,7 @@ function Oe(n) {
235
235
  var e;
236
236
  n.assignedMap = (e = n.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), n.operated || (n.operated = !0, n.parent && Oe(n.parent));
237
237
  }
238
- function _r() {
238
+ function gr() {
239
239
  throw new Error("Cannot modify frozen object");
240
240
  }
241
241
  function Be(n, e, t, r, s) {
@@ -263,12 +263,12 @@ function Be(n, e, t, r, s) {
263
263
  case 2:
264
264
  for (const [a, c] of n)
265
265
  Be(a, a, t, r, s), Be(c, a, t, r, s);
266
- n.set = n.clear = n.delete = _r;
266
+ n.set = n.clear = n.delete = gr;
267
267
  break;
268
268
  case 3:
269
269
  for (const a of n)
270
270
  Be(a, a, t, r, s);
271
- n.add = n.clear = n.delete = _r;
271
+ n.add = n.clear = n.delete = gr;
272
272
  break;
273
273
  case 1:
274
274
  Object.freeze(n);
@@ -284,7 +284,7 @@ function Be(n, e, t, r, s) {
284
284
  }
285
285
  r.pop(), s.pop();
286
286
  }
287
- function Vn(n, e) {
287
+ function zn(n, e) {
288
288
  const t = We(n);
289
289
  if (t === 0)
290
290
  Reflect.ownKeys(n).forEach((r) => {
@@ -297,11 +297,11 @@ function Vn(n, e) {
297
297
  } else
298
298
  n.forEach((r, s) => e(s, r, n));
299
299
  }
300
- function us(n, e, t) {
300
+ function cs(n, e, t) {
301
301
  if (Ne(n) || !Se(n, t) || e.has(n) || Object.isFrozen(n))
302
302
  return;
303
303
  const r = n instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
304
- if (e.add(n), Vn(n, (i, o) => {
304
+ if (e.add(n), zn(n, (i, o) => {
305
305
  var a;
306
306
  if (Ne(o)) {
307
307
  const c = R(o);
@@ -309,7 +309,7 @@ function us(n, e, t) {
309
309
  const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
310
310
  mt(r ? s : n, i, u);
311
311
  } else
312
- us(o, e, t);
312
+ cs(o, e, t);
313
313
  }), s) {
314
314
  const i = n, o = Array.from(i);
315
315
  i.clear(), o.forEach((a) => {
@@ -317,39 +317,39 @@ function us(n, e, t) {
317
317
  });
318
318
  }
319
319
  }
320
- function Ai(n, e) {
320
+ function ki(n, e) {
321
321
  const t = n.type === 3 ? n.setMap : n.copy;
322
- n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && us(Ie(t, e), n.finalities.handledSet, n.options);
322
+ n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && cs(Ie(t, e), n.finalities.handledSet, n.options);
323
323
  }
324
- function bn(n) {
324
+ function yn(n) {
325
325
  n.type === 3 && n.copy && (n.copy.clear(), n.setMap.forEach((e) => {
326
- n.copy.add(zn(e));
326
+ n.copy.add(qn(e));
327
327
  }));
328
328
  }
329
- function gn(n, e, t, r) {
329
+ function bn(n, e, t, r) {
330
330
  if (n.operated && n.assignedMap && n.assignedMap.size > 0 && !n.finalized) {
331
331
  if (t && r) {
332
- const i = as(n);
332
+ const i = os(n);
333
333
  i && e(n, i, t, r);
334
334
  }
335
335
  n.finalized = !0;
336
336
  }
337
337
  }
338
- function Bn(n, e, t, r) {
338
+ function Vn(n, e, t, r) {
339
339
  const s = R(t);
340
340
  s && (s.callbacks || (s.callbacks = []), s.callbacks.push((i, o) => {
341
341
  var a;
342
342
  const c = n.type === 3 ? n.setMap : n.copy;
343
343
  if (Ce(Ie(c, e), t)) {
344
344
  let u = s.original;
345
- s.copy && (u = s.copy), bn(n), gn(n, r, i, o), n.options.enableAutoFreeze && (n.options.updatedValues = (a = n.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), n.options.updatedValues.set(u, s.original)), mt(c, e, u);
345
+ s.copy && (u = s.copy), yn(n), bn(n, r, i, o), n.options.enableAutoFreeze && (n.options.updatedValues = (a = n.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), n.options.updatedValues.set(u, s.original)), mt(c, e, u);
346
346
  }
347
347
  }), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), Se(t, n.options) && n.finalities.draft.push(() => {
348
348
  const i = n.type === 3 ? n.setMap : n.copy;
349
- Ce(Ie(i, e), t) && Ai(n, e);
349
+ Ce(Ie(i, e), t) && ki(n, e);
350
350
  });
351
351
  }
352
- function Ci(n, e, t, r, s) {
352
+ function Ai(n, e, t, r, s) {
353
353
  let { original: i, assignedMap: o, options: a } = n, c = n.copy;
354
354
  c.length < i.length && ([i, c] = [c, i], [t, r] = [r, t]);
355
355
  for (let u = 0; u < i.length; u += 1)
@@ -395,7 +395,7 @@ function Ci(n, e, t, r, s) {
395
395
  }
396
396
  }
397
397
  }
398
- function Ii({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
398
+ function Ci({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
399
399
  t.forEach((a, c) => {
400
400
  const u = Ie(n, c), l = Rt(Ie(e, c)), f = a ? ht(n, c) ? q.Replace : q.Add : q.Remove;
401
401
  if (Ce(u, l) && f === q.Replace)
@@ -404,7 +404,7 @@ function Ii({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
404
404
  s.push(f === q.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === q.Add ? { op: q.Remove, path: y } : f === q.Remove ? { op: q.Add, path: y, value: u } : { op: q.Replace, path: y, value: u });
405
405
  });
406
406
  }
407
- function Pi({ original: n, copy: e }, t, r, s, i) {
407
+ function Ii({ original: n, copy: e }, t, r, s, i) {
408
408
  let o = 0;
409
409
  n.forEach((a) => {
410
410
  if (!e.has(a)) {
@@ -441,17 +441,17 @@ function _t(n, e, t, r) {
441
441
  switch (n.type) {
442
442
  case 0:
443
443
  case 2:
444
- return Ii(n, e, t, r, s);
445
- case 1:
446
444
  return Ci(n, e, t, r, s);
445
+ case 1:
446
+ return Ai(n, e, t, r, s);
447
447
  case 3:
448
- return Pi(n, e, t, r, s);
448
+ return Ii(n, e, t, r, s);
449
449
  }
450
450
  }
451
451
  const Lt = (n, e, t = !1) => {
452
452
  if (typeof n == "object" && n !== null && (!Se(n, e) || t))
453
453
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
454
- }, _n = {
454
+ }, gn = {
455
455
  get size() {
456
456
  return he(R(this)).size;
457
457
  },
@@ -460,7 +460,7 @@ const Lt = (n, e, t = !1) => {
460
460
  },
461
461
  set(n, e) {
462
462
  const t = R(this), r = he(t);
463
- return (!r.has(n) || !Ce(r.get(n), e)) && (re(t), Oe(t), t.assignedMap.set(n, !0), t.copy.set(n, e), Bn(t, n, e, _t)), this;
463
+ return (!r.has(n) || !Ce(r.get(n), e)) && (re(t), Oe(t), t.assignedMap.set(n, !0), t.copy.set(n, e), Vn(t, n, e, _t)), this;
464
464
  },
465
465
  delete(n) {
466
466
  if (!this.has(n))
@@ -488,7 +488,7 @@ const Lt = (n, e, t = !1) => {
488
488
  const r = R(this), s = he(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, pe)) === pe.mutable;
489
489
  if (r.options.strict && Lt(s, r.options, i), i || r.finalized || !Se(s, r.options) || s !== r.original.get(n))
490
490
  return s;
491
- const o = Wn.createDraft({
491
+ const o = Nn.createDraft({
492
492
  original: s,
493
493
  parentDraft: r,
494
494
  key: n,
@@ -532,7 +532,7 @@ const Lt = (n, e, t = !1) => {
532
532
  [Mt]() {
533
533
  return this.entries();
534
534
  }
535
- }, Mi = Reflect.ownKeys(_n), mr = (n, e, { isValuesIterator: t }) => () => {
535
+ }, Pi = Reflect.ownKeys(gn), _r = (n, e, { isValuesIterator: t }) => () => {
536
536
  var r, s;
537
537
  const i = e.next();
538
538
  if (i.done)
@@ -541,7 +541,7 @@ const Lt = (n, e, t = !1) => {
541
541
  let a = n.setMap.get(o);
542
542
  const c = R(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, pe)) === pe.mutable;
543
543
  if (n.options.strict && Lt(o, n.options, u), !u && !c && Se(o, n.options) && !n.finalized && n.original.has(o)) {
544
- const l = Wn.createDraft({
544
+ const l = Nn.createDraft({
545
545
  original: o,
546
546
  parentDraft: n,
547
547
  key: o,
@@ -568,7 +568,7 @@ const Lt = (n, e, t = !1) => {
568
568
  },
569
569
  add(n) {
570
570
  const e = R(this);
571
- return this.has(n) || (re(e), Oe(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), Bn(e, n, n, _t)), this;
571
+ return this.has(n) || (re(e), Oe(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), Vn(e, n, n, _t)), this;
572
572
  },
573
573
  delete(n) {
574
574
  if (!this.has(n))
@@ -593,7 +593,7 @@ const Lt = (n, e, t = !1) => {
593
593
  const e = n.setMap.keys();
594
594
  return {
595
595
  [Symbol.iterator]: () => this.values(),
596
- next: mr(n, e, { isValuesIterator: !0 })
596
+ next: _r(n, e, { isValuesIterator: !0 })
597
597
  };
598
598
  },
599
599
  entries() {
@@ -602,7 +602,7 @@ const Lt = (n, e, t = !1) => {
602
602
  const e = n.setMap.keys();
603
603
  return {
604
604
  [Symbol.iterator]: () => this.entries(),
605
- next: mr(n, e, {
605
+ next: _r(n, e, {
606
606
  isValuesIterator: !1
607
607
  })
608
608
  };
@@ -643,13 +643,13 @@ Set.prototype.difference && Object.assign(Ft, {
643
643
  return Set.prototype.isDisjointFrom.call(new Set(this.values()), n);
644
644
  }
645
645
  });
646
- const Ri = Reflect.ownKeys(Ft), ls = /* @__PURE__ */ new WeakSet(), fs = {
646
+ const Mi = Reflect.ownKeys(Ft), us = /* @__PURE__ */ new WeakSet(), ls = {
647
647
  get(n, e, t) {
648
648
  var r, s;
649
649
  const i = (r = n.copy) === null || r === void 0 ? void 0 : r[e];
650
- if (i && ls.has(i))
650
+ if (i && us.has(i))
651
651
  return i;
652
- if (e === os)
652
+ if (e === is)
653
653
  return n;
654
654
  let o;
655
655
  if (n.options.mark) {
@@ -658,14 +658,14 @@ const Ri = Reflect.ownKeys(Ft), ls = /* @__PURE__ */ new WeakSet(), fs = {
658
658
  return n.options.strict && Lt(u, n.options, !0), u;
659
659
  }
660
660
  const a = he(n);
661
- if (a instanceof Map && Mi.includes(e)) {
661
+ if (a instanceof Map && Pi.includes(e)) {
662
662
  if (e === "size")
663
- return Object.getOwnPropertyDescriptor(_n, "size").get.call(n.proxy);
664
- const u = _n[e];
663
+ return Object.getOwnPropertyDescriptor(gn, "size").get.call(n.proxy);
664
+ const u = gn[e];
665
665
  if (u)
666
666
  return u.bind(n.proxy);
667
667
  }
668
- if (a instanceof Set && Ri.includes(e)) {
668
+ if (a instanceof Set && Mi.includes(e)) {
669
669
  if (e === "size")
670
670
  return Object.getOwnPropertyDescriptor(Ft, "size").get.call(n.proxy);
671
671
  const u = Ft[e];
@@ -673,7 +673,7 @@ const Ri = Reflect.ownKeys(Ft), ls = /* @__PURE__ */ new WeakSet(), fs = {
673
673
  return u.bind(n.proxy);
674
674
  }
675
675
  if (!ht(a, e)) {
676
- const u = gr(a, e);
676
+ const u = br(a, e);
677
677
  return u ? "value" in u ? u.value : (
678
678
  // !case: support for getter
679
679
  (s = u.get) === null || s === void 0 ? void 0 : s.call(n.proxy)
@@ -683,7 +683,7 @@ const Ri = Reflect.ownKeys(Ft), ls = /* @__PURE__ */ new WeakSet(), fs = {
683
683
  if (n.options.strict && Lt(c, n.options), n.finalized || !Se(c, n.options))
684
684
  return c;
685
685
  if (c === rn(n.original, e)) {
686
- if (re(n), n.copy[e] = Gn({
686
+ if (re(n), n.copy[e] = Bn({
687
687
  original: n.original[e],
688
688
  parentDraft: n,
689
689
  key: n.type === 1 ? Number(e) : e,
@@ -704,11 +704,11 @@ const Ri = Reflect.ownKeys(Ft), ls = /* @__PURE__ */ new WeakSet(), fs = {
704
704
  let s;
705
705
  if (n.type === 1 && e !== "length" && !(Number.isInteger(s = Number(e)) && s >= 0 && (e === 0 || s === 0 || String(s) === String(e))))
706
706
  throw new Error("Only supports setting array indices and the 'length' property.");
707
- const i = gr(he(n), e);
707
+ const i = br(he(n), e);
708
708
  if (i != null && i.set)
709
709
  return i.set.call(n.proxy, t), !0;
710
710
  const o = rn(he(n), e), a = R(o);
711
- return a && Ce(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Ce(t, o) && (t !== void 0 || ht(n.original, e)) || (re(n), Oe(n), ht(n.original, e) && Ce(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, Bn(n, e, t, _t)), !0);
711
+ return a && Ce(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Ce(t, o) && (t !== void 0 || ht(n.original, e)) || (re(n), Oe(n), ht(n.original, e) && Ce(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, Vn(n, e, t, _t)), !0);
712
712
  },
713
713
  has(n, e) {
714
714
  return e in he(n);
@@ -736,10 +736,10 @@ const Ri = Reflect.ownKeys(Ft), ls = /* @__PURE__ */ new WeakSet(), fs = {
736
736
  },
737
737
  deleteProperty(n, e) {
738
738
  var t;
739
- return n.type === 1 ? fs.set.call(this, n, e, void 0, n.proxy) : (rn(n.original, e) !== void 0 || e in n.original ? (re(n), Oe(n), n.assignedMap.set(e, !1)) : (n.assignedMap = (t = n.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), n.assignedMap.delete(e)), n.copy && delete n.copy[e], !0);
739
+ return n.type === 1 ? ls.set.call(this, n, e, void 0, n.proxy) : (rn(n.original, e) !== void 0 || e in n.original ? (re(n), Oe(n), n.assignedMap.set(e, !1)) : (n.assignedMap = (t = n.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), n.assignedMap.delete(e)), n.copy && delete n.copy[e], !0);
740
740
  }
741
741
  };
742
- function Gn(n) {
742
+ function Bn(n) {
743
743
  const { original: e, parentDraft: t, key: r, finalities: s, options: i } = n, o = We(e), a = {
744
744
  type: o,
745
745
  finalized: !1,
@@ -753,8 +753,8 @@ function Gn(n) {
753
753
  setMap: o === 3 ? new Map(e.entries()) : void 0
754
754
  };
755
755
  (r || "key" in n) && (a.key = r);
756
- const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, fs);
757
- if (s.revoke.push(u), ls.add(c), a.proxy = c, t) {
756
+ const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, ls);
757
+ if (s.revoke.push(u), us.add(c), a.proxy = c, t) {
758
758
  const l = t;
759
759
  l.finalities.draft.push((f, p) => {
760
760
  var y, b;
@@ -763,7 +763,7 @@ function Gn(n) {
763
763
  const S = Ie(m, r), g = R(S);
764
764
  if (g) {
765
765
  let w = g.original;
766
- g.operated && (w = zn(S)), bn(g), gn(g, _t, f, p), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(w, g.original)), mt(m, r, w);
766
+ g.operated && (w = qn(S)), yn(g), bn(g, _t, f, p), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(w, g.original)), mt(m, r, w);
767
767
  }
768
768
  (b = _.callbacks) === null || b === void 0 || b.forEach((w) => {
769
769
  w(f, p);
@@ -772,26 +772,26 @@ function Gn(n) {
772
772
  } else {
773
773
  const l = R(c);
774
774
  l.finalities.draft.push((f, p) => {
775
- bn(l), gn(l, _t, f, p);
775
+ yn(l), bn(l, _t, f, p);
776
776
  });
777
777
  }
778
778
  return c;
779
779
  }
780
- Wn.createDraft = Gn;
781
- function ji(n, e, t, r, s) {
780
+ Nn.createDraft = Bn;
781
+ function Ri(n, e, t, r, s) {
782
782
  var i;
783
783
  const o = R(n), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : n, c = !!e.length;
784
784
  if (o != null && o.operated)
785
785
  for (; o.finalities.draft.length > 0; )
786
786
  o.finalities.draft.pop()(t, r);
787
787
  const u = c ? e[0] : o ? o.operated ? o.copy : o.original : n;
788
- return o && yn(o), s && Be(u, u, o == null ? void 0 : o.options.updatedValues), [
788
+ return o && pn(o), s && Be(u, u, o == null ? void 0 : o.options.updatedValues), [
789
789
  u,
790
790
  t && c ? [{ op: q.Replace, path: [], value: e[0] }] : t,
791
791
  r && c ? [{ op: q.Replace, path: [], value: a }] : r
792
792
  ];
793
793
  }
794
- function xi(n, e) {
794
+ function ji(n, e) {
795
795
  var t;
796
796
  const r = {
797
797
  draft: [],
@@ -800,7 +800,7 @@ function xi(n, e) {
800
800
  };
801
801
  let s, i;
802
802
  e.enablePatches && (s = [], i = []);
803
- const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, pe)) === pe.mutable || !Se(n, e) ? n : Gn({
803
+ const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, pe)) === pe.mutable || !Se(n, e) ? n : Bn({
804
804
  original: n,
805
805
  parentDraft: null,
806
806
  finalities: r,
@@ -809,14 +809,14 @@ function xi(n, e) {
809
809
  return [
810
810
  a,
811
811
  (c = []) => {
812
- const [u, l, f] = ji(a, c, s, i, e.enableAutoFreeze);
812
+ const [u, l, f] = Ri(a, c, s, i, e.enableAutoFreeze);
813
813
  return e.enablePatches ? [u, l, f] : u;
814
814
  }
815
815
  ];
816
816
  }
817
- function mn(n) {
817
+ function _n(n) {
818
818
  const { rootDraft: e, value: t, useRawReturn: r = !1, isRoot: s = !0 } = n;
819
- Vn(t, (i, o, a) => {
819
+ zn(t, (i, o, a) => {
820
820
  const c = R(o);
821
821
  if (c && e && c.finalities === e.finalities) {
822
822
  n.isContainDraft = !0;
@@ -826,10 +826,10 @@ function mn(n) {
826
826
  a.clear(), l.forEach((f) => a.add(i === f ? u : f));
827
827
  } else
828
828
  mt(a, i, u);
829
- } else typeof o == "object" && o !== null && (n.value = o, n.isRoot = !1, mn(n));
829
+ } else typeof o == "object" && o !== null && (n.value = o, n.isRoot = !1, _n(n));
830
830
  }), s && (n.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
831
831
  }
832
- function ds(n) {
832
+ function fs(n) {
833
833
  var e;
834
834
  const t = R(n);
835
835
  if (!Se(n, t == null ? void 0 : t.options))
@@ -839,7 +839,7 @@ function ds(n) {
839
839
  return t.original;
840
840
  let s;
841
841
  function i() {
842
- s = r === 2 ? qn(n) ? new Map(n) : new (Object.getPrototypeOf(n)).constructor(n) : r === 3 ? Array.from(t.setMap.values()) : cs(n, t == null ? void 0 : t.options);
842
+ s = r === 2 ? Kn(n) ? new Map(n) : new (Object.getPrototypeOf(n)).constructor(n) : r === 3 ? Array.from(t.setMap.values()) : as(n, t == null ? void 0 : t.options);
843
843
  }
844
844
  if (t) {
845
845
  t.finalized = !0;
@@ -850,23 +850,23 @@ function ds(n) {
850
850
  }
851
851
  } else
852
852
  s = n;
853
- if (Vn(s, (o, a) => {
853
+ if (zn(s, (o, a) => {
854
854
  if (t && Ce(Ie(t.original, o), a))
855
855
  return;
856
- const c = ds(a);
856
+ const c = fs(a);
857
857
  c !== a && (s === n && i(), mt(s, o, c));
858
858
  }), r === 3) {
859
859
  const o = (e = t == null ? void 0 : t.original) !== null && e !== void 0 ? e : s;
860
- return Kn(o) ? new Set(s) : new (Object.getPrototypeOf(o)).constructor(s);
860
+ return Wn(o) ? new Set(s) : new (Object.getPrototypeOf(o)).constructor(s);
861
861
  }
862
862
  return s;
863
863
  }
864
- function wr(n) {
864
+ function mr(n) {
865
865
  if (!Ne(n))
866
866
  throw new Error(`current() is only used for Draft, parameter: ${n}`);
867
- return ds(n);
867
+ return fs(n);
868
868
  }
869
- const $i = (n) => function e(t, r, s) {
869
+ const xi = (n) => function e(t, r, s) {
870
870
  var i, o, a;
871
871
  if (typeof t == "function" && typeof r != "function")
872
872
  return function(v, ...C) {
@@ -877,7 +877,7 @@ const $i = (n) => function e(t, r, s) {
877
877
  if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
878
878
  throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
879
879
  l = Object.assign(Object.assign({}, n), l);
880
- const f = Ne(c) ? wr(c) : c, p = Array.isArray(l.mark) ? (v, C) => {
880
+ const f = Ne(c) ? mr(c) : c, p = Array.isArray(l.mark) ? (v, C) => {
881
881
  for (const j of l.mark) {
882
882
  if (typeof j != "function")
883
883
  throw new Error(`Invalid mark: ${j}, 'mark' should be a function.`);
@@ -893,7 +893,7 @@ const $i = (n) => function e(t, r, s) {
893
893
  };
894
894
  if (!Se(f, m) && typeof f == "object" && f !== null)
895
895
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
896
- const [S, g] = xi(f, m);
896
+ const [S, g] = ji(f, m);
897
897
  if (typeof r != "function") {
898
898
  if (!Se(f, m))
899
899
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
@@ -903,24 +903,24 @@ const $i = (n) => function e(t, r, s) {
903
903
  try {
904
904
  w = u(S);
905
905
  } catch (v) {
906
- throw yn(R(S)), v;
906
+ throw pn(R(S)), v;
907
907
  }
908
908
  const O = (v) => {
909
909
  const C = R(S);
910
910
  if (!Ne(v)) {
911
911
  if (v !== void 0 && !Ce(v, S) && (C != null && C.operated))
912
912
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
913
- const U = v == null ? void 0 : v[vi];
913
+ const U = v == null ? void 0 : v[Si];
914
914
  if (U) {
915
915
  const B = U[0];
916
- return m.strict && typeof v == "object" && v !== null && mn({
916
+ return m.strict && typeof v == "object" && v !== null && _n({
917
917
  rootDraft: C,
918
918
  value: v,
919
919
  useRawReturn: !0
920
920
  }), g([B]);
921
921
  }
922
922
  if (v !== void 0)
923
- return typeof v == "object" && v !== null && mn({ rootDraft: C, value: v }), g([v]);
923
+ return typeof v == "object" && v !== null && _n({ rootDraft: C, value: v }), g([v]);
924
924
  }
925
925
  if (v === S || v === void 0)
926
926
  return g([]);
@@ -928,26 +928,26 @@ const $i = (n) => function e(t, r, s) {
928
928
  if (m === j.options) {
929
929
  if (j.operated)
930
930
  throw new Error("Cannot return a modified child draft.");
931
- return g([wr(v)]);
931
+ return g([mr(v)]);
932
932
  }
933
933
  return g([v]);
934
934
  };
935
935
  return w instanceof Promise ? w.then(O, (v) => {
936
- throw yn(R(S)), v;
936
+ throw pn(R(S)), v;
937
937
  }) : O(w);
938
- }, Nt = $i();
938
+ }, Nt = xi();
939
939
  Object.prototype.constructor.toString();
940
- function hs(n, e) {
940
+ function ds(n, e) {
941
941
  const t = Object.keys(n), r = Object.keys(e);
942
942
  return t.length === r.length && Object.keys(n).every((s) => e.hasOwnProperty(s));
943
943
  }
944
- function Tr(n, e) {
944
+ function wr(n, e) {
945
945
  return Object.keys(n).length === Object.keys(e).length && Object.keys(n).every((t) => e.hasOwnProperty(t) && n[t] === e[t]);
946
946
  }
947
947
  function jt(n, e) {
948
- return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : hs(n, e) ? Object.keys(n).every((t) => jt(n[t], e[t])) : !1;
948
+ return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : ds(n, e) ? Object.keys(n).every((t) => jt(n[t], e[t])) : !1;
949
949
  }
950
- function Qn(n) {
950
+ function Gn(n) {
951
951
  if (!ct(n))
952
952
  return n;
953
953
  const e = {};
@@ -955,7 +955,7 @@ function Qn(n) {
955
955
  r !== void 0 && (e[t] = r);
956
956
  return e;
957
957
  }
958
- function ps(n, e) {
958
+ function hs(n, e) {
959
959
  if (!ct(n) || !ct(e))
960
960
  return e;
961
961
  const t = { ...n };
@@ -967,14 +967,14 @@ function ps(n, e) {
967
967
  continue;
968
968
  }
969
969
  const s = ct(n[r]) && ct(e[r]);
970
- t[r] = s ? ps(n[r], e[r]) : e[r];
970
+ t[r] = s ? hs(n[r], e[r]) : e[r];
971
971
  }
972
972
  return t;
973
973
  }
974
974
  function ct(n) {
975
975
  return typeof n == "object" && n !== null && !Array.isArray(n);
976
976
  }
977
- function Di(n, e, t) {
977
+ function $i(n, e, t) {
978
978
  if (!n || e.length === 0)
979
979
  return;
980
980
  let r = n || {};
@@ -985,7 +985,7 @@ function Di(n, e, t) {
985
985
  const s = e[e.length - 1];
986
986
  Array.isArray(r) && typeof s == "number" ? r.splice(s, 0, t) : r[s] = t;
987
987
  }
988
- function Sr(n, e, t) {
988
+ function Tr(n, e, t) {
989
989
  if (!n || e.length === 0)
990
990
  return;
991
991
  let r = n || {};
@@ -995,7 +995,7 @@ function Sr(n, e, t) {
995
995
  }
996
996
  r[e[e.length - 1]] = t;
997
997
  }
998
- function ys(n, e) {
998
+ function ps(n, e) {
999
999
  if (!n || e.length === 0)
1000
1000
  return;
1001
1001
  const [t, ...r] = e;
@@ -1004,13 +1004,13 @@ function ys(n, e) {
1004
1004
  Array.isArray(n) ? n.splice(t, 1) : delete n[t];
1005
1005
  return;
1006
1006
  }
1007
- ys(n[t], r), Ui(n[t]) && delete n[t];
1007
+ ps(n[t], r), Di(n[t]) && delete n[t];
1008
1008
  }
1009
1009
  }
1010
- function Ui(n) {
1010
+ function Di(n) {
1011
1011
  return n && Object.keys(n).length === 0;
1012
1012
  }
1013
- const vr = /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$/, Li = {
1013
+ const Sr = /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$/, Ui = {
1014
1014
  ZULU: 0,
1015
1015
  YEKT: 18e3,
1016
1016
  YEKST: 21600,
@@ -1206,39 +1206,39 @@ const vr = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
1206
1206
  ACSST: 37800,
1207
1207
  ACDT: 37800
1208
1208
  };
1209
- function Fi(n) {
1209
+ function Li(n) {
1210
1210
  return new Date(n);
1211
1211
  }
1212
- function Ni(n) {
1212
+ function Fi(n) {
1213
1213
  return /* @__PURE__ */ new Date(n + "Z");
1214
1214
  }
1215
- const Wi = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
1216
- function Ki(n) {
1217
- const e = n.match(Wi);
1215
+ const Ni = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
1216
+ function Wi(n) {
1217
+ const e = n.match(Ni);
1218
1218
  if (!e)
1219
1219
  return null;
1220
1220
  const [t, r, s, i] = e;
1221
1221
  return r <= 0 || s <= 0 || i <= 0 ? null : r > 999 ? new Date(Date.UTC(r, s - 1, i, 0, 0, 0, 0)) : new Date(Date.UTC(i, r - 1, s, 0, 0, 0, 0));
1222
1222
  }
1223
- function qi(n) {
1223
+ function Ki(n) {
1224
1224
  const [e, t] = n.split(" ");
1225
1225
  return /* @__PURE__ */ new Date(e + "T" + t + "Z");
1226
1226
  }
1227
- function zi(n) {
1227
+ function qi(n) {
1228
1228
  const [e, t] = n.split(" ");
1229
1229
  return /* @__PURE__ */ new Date(e + "T" + t + "Z");
1230
1230
  }
1231
- function Vi(n) {
1231
+ function zi(n) {
1232
1232
  return new Date(n);
1233
1233
  }
1234
- function Bi(n) {
1234
+ function Vi(n) {
1235
1235
  const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
1236
1236
  if (!n.match(e))
1237
1237
  throw new Error(`Unable to parse \`${n}\` as a date.`);
1238
1238
  const r = /* @__PURE__ */ new Date(n + " UTC");
1239
1239
  return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate(), 0, 0, 0, 0));
1240
1240
  }
1241
- function Gi(n) {
1241
+ function Bi(n) {
1242
1242
  const e = /^(.+T.+)([+-])(\d{2})$/, t = n.match(e);
1243
1243
  if (t) {
1244
1244
  const [, r, s, i] = t, o = `${r}${s}${i}:00`;
@@ -1246,7 +1246,7 @@ function Gi(n) {
1246
1246
  }
1247
1247
  return null;
1248
1248
  }
1249
- function Qi(n) {
1249
+ function Gi(n) {
1250
1250
  const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, t = n.match(e);
1251
1251
  if (t) {
1252
1252
  const [, r, s, i, o, a] = t, c = s.padStart(2, "0"), u = i.padStart(2, "0"), l = `${r}-${c}-${u}T${a}`;
@@ -1254,14 +1254,14 @@ function Qi(n) {
1254
1254
  }
1255
1255
  return null;
1256
1256
  }
1257
- function Hi(n) {
1257
+ function Qi(n) {
1258
1258
  const [e, t] = n.split(", "), [r, s, i] = e.split("/").map(Number), o = t.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
1259
1259
  if (!o)
1260
1260
  throw new Error(`Unable to parse time from: ${n}`);
1261
1261
  let [, a, c, u, l] = o;
1262
1262
  return a = Number(a), c = Number(c), u = Number(u), l === "PM" && a !== 12 ? a += 12 : l === "AM" && a === 12 && (a = 0), new Date(Date.UTC(i, r - 1, s, a, c, u));
1263
1263
  }
1264
- function Ji(n) {
1264
+ function Hi(n) {
1265
1265
  switch (n) {
1266
1266
  case "epoch":
1267
1267
  return /* @__PURE__ */ new Date(0);
@@ -1273,28 +1273,28 @@ function Ji(n) {
1273
1273
  return null;
1274
1274
  }
1275
1275
  }
1276
- function Yi(n) {
1277
- const e = n.match(vr);
1276
+ function Ji(n) {
1277
+ const e = n.match(Sr);
1278
1278
  if (!e)
1279
1279
  return null;
1280
- const [t] = e, r = Li[t], s = new Date(n.replace(vr, "Z"));
1280
+ const [t] = e, r = Ui[t], s = new Date(n.replace(Sr, "Z"));
1281
1281
  return new Date(s.getTime() - r * 1e3);
1282
1282
  }
1283
- const Zi = [
1284
- Ki,
1283
+ const Yi = [
1284
+ Wi,
1285
+ qi,
1286
+ Vi,
1287
+ Qi,
1285
1288
  zi,
1289
+ Fi,
1286
1290
  Bi,
1291
+ Ki,
1292
+ Li,
1287
1293
  Hi,
1288
- Vi,
1289
- Ni,
1290
- Gi,
1291
- qi,
1292
- Fi,
1293
1294
  Ji,
1294
- Yi,
1295
- Qi
1295
+ Gi
1296
1296
  ];
1297
- function Xi(n, e) {
1297
+ function Zi(n, e) {
1298
1298
  try {
1299
1299
  const t = n(e);
1300
1300
  return t instanceof Date && !isNaN(t.getTime()) ? t : null;
@@ -1302,18 +1302,18 @@ function Xi(n, e) {
1302
1302
  return null;
1303
1303
  }
1304
1304
  }
1305
- function wn(n) {
1306
- for (const e of Zi) {
1307
- const t = Xi(e, n);
1305
+ function mn(n) {
1306
+ for (const e of Yi) {
1307
+ const t = Zi(e, n);
1308
1308
  if (t)
1309
1309
  return t;
1310
1310
  }
1311
1311
  return null;
1312
1312
  }
1313
- function eo(n) {
1313
+ function Xi(n) {
1314
1314
  try {
1315
1315
  const e = JSON.parse(n);
1316
- return typeof e == "string" ? wn(e) : null;
1316
+ return typeof e == "string" ? mn(e) : null;
1317
1317
  } catch {
1318
1318
  return null;
1319
1319
  }
@@ -1325,7 +1325,7 @@ function zt(n) {
1325
1325
  if (n instanceof Date)
1326
1326
  return n;
1327
1327
  if (typeof n == "string") {
1328
- const e = wn(n) || eo(n) || wn(n.trim());
1328
+ const e = mn(n) || Xi(n) || mn(n.trim());
1329
1329
  if (!e)
1330
1330
  throw new Error(`Unable to parse \`${n}\` as a date.`);
1331
1331
  return e;
@@ -1365,7 +1365,7 @@ class Le {
1365
1365
  return this._blobAttrs;
1366
1366
  this._blobAttrs = /* @__PURE__ */ new Map();
1367
1367
  for (const e of Object.values(this.attrs))
1368
- if (Jn(e)) {
1368
+ if (Hn(e)) {
1369
1369
  const [t, r, s] = e["forward-identity"];
1370
1370
  le(this.blobAttrs, [r, s], e);
1371
1371
  }
@@ -1409,13 +1409,13 @@ class Le {
1409
1409
  return { attrs: this.attrs, linkIndex: this.linkIndex };
1410
1410
  }
1411
1411
  }
1412
- function to(n) {
1412
+ function eo(n) {
1413
1413
  return n.cardinality === "one";
1414
1414
  }
1415
- function Hn(n) {
1415
+ function Qn(n) {
1416
1416
  return n["value-type"] === "ref";
1417
1417
  }
1418
- function Jn(n) {
1418
+ function Hn(n) {
1419
1419
  return n["value-type"] === "blob";
1420
1420
  }
1421
1421
  function nt(n, e) {
@@ -1441,7 +1441,7 @@ function le(n, e, t) {
1441
1441
  }
1442
1442
  s > -1 && r.set(e[s], t);
1443
1443
  }
1444
- function bs(n, e, t) {
1444
+ function ys(n, e, t) {
1445
1445
  const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
1446
1446
  for (const o of e) {
1447
1447
  let [a, c, u] = o;
@@ -1450,11 +1450,11 @@ function bs(n, e, t) {
1450
1450
  console.warn("no such attr", c, a);
1451
1451
  continue;
1452
1452
  }
1453
- l["checked-data-type"] === "date" && t && (u = zt(u), o[2] = u), Hn(l) && le(i, [u, c, a], o), le(r, [a, c, u], o), le(s, [c, a, u], o);
1453
+ l["checked-data-type"] === "date" && t && (u = zt(u), o[2] = u), Qn(l) && le(i, [u, c, a], o), le(r, [a, c, u], o), le(s, [c, a, u], o);
1454
1454
  }
1455
1455
  return { eav: r, aev: s, vae: i };
1456
1456
  }
1457
- function gs(n) {
1457
+ function bs(n) {
1458
1458
  return {
1459
1459
  triples: fe(n.eav, 3),
1460
1460
  cardinalityInference: n.cardinalityInference,
@@ -1462,20 +1462,20 @@ function gs(n) {
1462
1462
  version: 1
1463
1463
  };
1464
1464
  }
1465
- function _s(n, e) {
1465
+ function gs(n, e) {
1466
1466
  return ut(n, e.triples, e.cardinalityInference, e.useDateObjects);
1467
1467
  }
1468
- function ms(n, e) {
1468
+ function _s(n, e) {
1469
1469
  if (n)
1470
1470
  return new Le(n.attrs, n.linkIndex);
1471
1471
  if (e && "__type" in e)
1472
1472
  return new Le(e.attrs, e.linkIndex);
1473
1473
  }
1474
- function no(n, e) {
1474
+ function to(n, e) {
1475
1475
  return nt(n.eav, [e]) !== void 0;
1476
1476
  }
1477
1477
  function ut(n, e, t, r) {
1478
- const s = bs(n, e, r);
1478
+ const s = ys(n, e, r);
1479
1479
  return s.cardinalityInference = t, s.useDateObjects = r, s;
1480
1480
  }
1481
1481
  function wt(n, e) {
@@ -1505,21 +1505,21 @@ function wt(n, e) {
1505
1505
  return [t, ...a];
1506
1506
  }
1507
1507
  }
1508
- function ws(n, e, t) {
1508
+ function ms(n, e, t) {
1509
1509
  const r = wt(n, t);
1510
1510
  if (!r)
1511
1511
  return;
1512
1512
  const [s, i, o] = r, a = e.getAttr(i);
1513
- a && (Te(n.eav, [s, i, o]), Te(n.aev, [i, s, o]), Hn(a) && Te(n.vae, [o, i, s]));
1513
+ a && (Te(n.eav, [s, i, o]), Te(n.aev, [i, s, o]), Qn(a) && Te(n.vae, [o, i, s]));
1514
1514
  }
1515
- let ro = 0;
1516
- function Ts(n, e, t) {
1515
+ let no = 0;
1516
+ function ws(n, e, t) {
1517
1517
  const [r, s, i] = t;
1518
1518
  let o;
1519
1519
  const a = nt(n.eav, [r, s, i]);
1520
- return a && (o = a[3]), o || Date.now() * 10 + ro++;
1520
+ return a && (o = a[3]), o || Date.now() * 10 + no++;
1521
1521
  }
1522
- function Ss(n, e, t) {
1522
+ function Ts(n, e, t) {
1523
1523
  const r = wt(n, t);
1524
1524
  if (!r)
1525
1525
  return;
@@ -1528,10 +1528,10 @@ function Ss(n, e, t) {
1528
1528
  if (!a)
1529
1529
  return;
1530
1530
  a["checked-data-type"] === "date" && n.useDateObjects && (o = zt(o));
1531
- const c = nt(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? Ts(n, a, r), l = [s, i, o, u];
1532
- to(a) ? (le(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (le(n.eav, [s, i, o], l), le(n.aev, [i, s, o], l)), Hn(a) && le(n.vae, [o, i, s], l);
1531
+ const c = nt(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? ws(n, a, r), l = [s, i, o, u];
1532
+ eo(a) ? (le(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (le(n.eav, [s, i, o], l), le(n.aev, [i, s, o], l)), Qn(a) && le(n.vae, [o, i, s], l);
1533
1533
  }
1534
- function so(n, e, t) {
1534
+ function ro(n, e, t) {
1535
1535
  var y;
1536
1536
  const r = wt(n, t);
1537
1537
  if (!r)
@@ -1539,7 +1539,7 @@ function so(n, e, t) {
1539
1539
  const [s, i, o] = r, a = e.getAttr(i);
1540
1540
  if (!a)
1541
1541
  return;
1542
- if (!Jn(a))
1542
+ if (!Hn(a))
1543
1543
  throw new Error("merge operation is not supported for links");
1544
1544
  const c = nt(n.eav, [s, i]);
1545
1545
  if (!c)
@@ -1547,15 +1547,15 @@ function so(n, e, t) {
1547
1547
  const u = (y = c.values().next()) == null ? void 0 : y.value;
1548
1548
  if (!u)
1549
1549
  return;
1550
- const l = u[2], f = ps(l, o), p = [
1550
+ const l = u[2], f = hs(l, o), p = [
1551
1551
  s,
1552
1552
  i,
1553
1553
  f,
1554
- Ts(n, a, u)
1554
+ ws(n, a, u)
1555
1555
  ];
1556
1556
  le(n.eav, [s, i], /* @__PURE__ */ new Map([[f, p]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[f, p]]));
1557
1557
  }
1558
- function Tn(n, e, t) {
1558
+ function wn(n, e, t) {
1559
1559
  var u, l;
1560
1560
  const [r, s] = t, i = wt(n, [r]);
1561
1561
  if (!i)
@@ -1566,7 +1566,7 @@ function Tn(n, e, t) {
1566
1566
  const p = e.getAttr(f);
1567
1567
  p && p["on-delete-reverse"] === "cascade" && fe(a.get(f), 1).forEach(([y, b, _]) => {
1568
1568
  var m;
1569
- return Tn(n, e, [_, (m = p["reverse-identity"]) == null ? void 0 : m[1]]);
1569
+ return wn(n, e, [_, (m = p["reverse-identity"]) == null ? void 0 : m[1]]);
1570
1570
  }), // Fall back to deleting everything if we've rehydrated tx-steps from
1571
1571
  // the store that didn't set `etype` in deleteEntity
1572
1572
  (!s || // If we don't know about the attr, let's just get rid of it
@@ -1579,53 +1579,53 @@ function Tn(n, e, t) {
1579
1579
  c && c.forEach((f) => {
1580
1580
  var m, S, g;
1581
1581
  const [p, y, b] = f, _ = e.getAttr(y);
1582
- (!s || !_ || ((m = _["reverse-identity"]) == null ? void 0 : m[1]) === s) && (Te(n.eav, [p, y, b]), Te(n.aev, [y, p, b]), Te(n.vae, [b, y, p])), _ && _["on-delete"] === "cascade" && ((S = _["reverse-identity"]) == null ? void 0 : S[1]) === s && Tn(n, e, [p, (g = _["forward-identity"]) == null ? void 0 : g[1]]);
1582
+ (!s || !_ || ((m = _["reverse-identity"]) == null ? void 0 : m[1]) === s) && (Te(n.eav, [p, y, b]), Te(n.aev, [y, p, b]), Te(n.vae, [b, y, p])), _ && _["on-delete"] === "cascade" && ((S = _["reverse-identity"]) == null ? void 0 : S[1]) === s && wn(n, e, [p, (g = _["forward-identity"]) == null ? void 0 : g[1]]);
1583
1583
  }), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && Te(n.vae, [o]);
1584
1584
  }
1585
- function vs(n, e, t) {
1586
- const r = bs(e, t, n.useDateObjects);
1585
+ function Ss(n, e, t) {
1586
+ const r = ys(e, t, n.useDateObjects);
1587
1587
  Object.keys(r).forEach((s) => {
1588
1588
  n[s] = r[s];
1589
1589
  });
1590
1590
  }
1591
- function io(n, [e]) {
1591
+ function so(n, [e]) {
1592
1592
  n.addAttr(e);
1593
1593
  }
1594
- function Es(n) {
1594
+ function vs(n) {
1595
1595
  return fe(n.eav, 3);
1596
1596
  }
1597
- function oo(n, e, [t]) {
1597
+ function io(n, e, [t]) {
1598
1598
  if (!e.getAttr(t))
1599
1599
  return;
1600
- const r = Es(n).filter(([s, i]) => i !== t);
1601
- e.deleteAttr(t), vs(n, e, r);
1600
+ const r = vs(n).filter(([s, i]) => i !== t);
1601
+ e.deleteAttr(t), Ss(n, e, r);
1602
1602
  }
1603
- function ao(n, e, [t]) {
1604
- e.getAttr(t.id) && (e.updateAttr(t), vs(n, e, Es(n)));
1603
+ function oo(n, e, [t]) {
1604
+ e.getAttr(t.id) && (e.updateAttr(t), Ss(n, e, vs(n)));
1605
1605
  }
1606
- function co(n, e, t) {
1606
+ function ao(n, e, t) {
1607
1607
  const [r, ...s] = t;
1608
1608
  switch (r) {
1609
1609
  case "add-triple":
1610
- Ss(n, e, s);
1610
+ Ts(n, e, s);
1611
1611
  break;
1612
1612
  case "deep-merge-triple":
1613
- so(n, e, s);
1613
+ ro(n, e, s);
1614
1614
  break;
1615
1615
  case "retract-triple":
1616
- ws(n, e, s);
1616
+ ms(n, e, s);
1617
1617
  break;
1618
1618
  case "delete-entity":
1619
- Tn(n, e, s);
1619
+ wn(n, e, s);
1620
1620
  break;
1621
1621
  case "add-attr":
1622
- io(e, s);
1622
+ so(e, s);
1623
1623
  break;
1624
1624
  case "delete-attr":
1625
- oo(n, e, s);
1625
+ io(n, e, s);
1626
1626
  break;
1627
1627
  case "update-attr":
1628
- ao(n, e, s);
1628
+ oo(n, e, s);
1629
1629
  break;
1630
1630
  case "restore-attr":
1631
1631
  break;
@@ -1680,13 +1680,13 @@ function kt(n, e, t) {
1680
1680
  }
1681
1681
  return r;
1682
1682
  }
1683
- function uo(n, e, t) {
1683
+ function co(n, e, t) {
1684
1684
  let r = "";
1685
1685
  return n !== void 0 && (r += "e"), e !== void 0 && (r += "a"), t !== void 0 && (r += "v"), r;
1686
1686
  }
1687
- function lo(n, [e, t, r]) {
1687
+ function uo(n, [e, t, r]) {
1688
1688
  var i, o;
1689
- switch (uo(e, t, r)) {
1689
+ switch (co(e, t, r)) {
1690
1690
  case "e": {
1691
1691
  const a = n.eav.get(e);
1692
1692
  return fe(a, 2);
@@ -1732,7 +1732,7 @@ function lo(n, [e, t, r]) {
1732
1732
  return fe(n.eav, 3);
1733
1733
  }
1734
1734
  }
1735
- function fo(n, e, t) {
1735
+ function lo(n, e, t) {
1736
1736
  var s;
1737
1737
  const r = {};
1738
1738
  if (!e)
@@ -1752,15 +1752,15 @@ function Ke(n, e, t) {
1752
1752
  var r;
1753
1753
  return (r = n.revIdents.get(e)) == null ? void 0 : r.get(t);
1754
1754
  }
1755
- function ho(n, e) {
1755
+ function fo(n, e) {
1756
1756
  return n.blobAttrs.get(e);
1757
1757
  }
1758
- function Os(n, e) {
1758
+ function Es(n, e) {
1759
1759
  var r;
1760
1760
  const t = n.primaryKeys.get(e);
1761
1761
  return t || ((r = n.forwardIdents.get(e)) == null ? void 0 : r.get("id"));
1762
1762
  }
1763
- function po(n, e, t) {
1763
+ function ho(n, e, t) {
1764
1764
  const r = wt(n, t);
1765
1765
  if (!r)
1766
1766
  return;
@@ -1768,7 +1768,7 @@ function po(n, e, t) {
1768
1768
  if (e.getAttr(i))
1769
1769
  return nt(n.eav, [s, i]);
1770
1770
  }
1771
- function yo(n, e, t) {
1771
+ function po(n, e, t) {
1772
1772
  const r = t.filter(([s, i, o, a, c]) => {
1773
1773
  if (s !== "add-triple" && s !== "deep-merge-triple")
1774
1774
  return !0;
@@ -1778,8 +1778,8 @@ function yo(n, e, t) {
1778
1778
  let l = !1;
1779
1779
  const f = e.getAttr(o);
1780
1780
  if (f) {
1781
- const p = Os(e, f["forward-identity"][1]);
1782
- l = !!po(n, e, [
1781
+ const p = Es(e, f["forward-identity"][1]);
1782
+ l = !!ho(n, e, [
1783
1783
  i,
1784
1784
  p == null ? void 0 : p.id,
1785
1785
  i
@@ -1789,7 +1789,7 @@ function yo(n, e, t) {
1789
1789
  });
1790
1790
  return Nt({ store: n, attrsStore: e }, (s) => {
1791
1791
  r.forEach((i) => {
1792
- co(s.store, s.attrsStore, i);
1792
+ ao(s.store, s.attrsStore, i);
1793
1793
  });
1794
1794
  }, {
1795
1795
  mark: (s) => {
@@ -1798,28 +1798,28 @@ function yo(n, e, t) {
1798
1798
  }
1799
1799
  });
1800
1800
  }
1801
- function bo(n) {
1801
+ function yo(n) {
1802
1802
  return typeof n == "string" && n.startsWith("?");
1803
1803
  }
1804
- function go(n, e, t) {
1804
+ function bo(n, e, t) {
1805
1805
  if (t.hasOwnProperty(n)) {
1806
1806
  const r = t[n];
1807
- return ks(r, e, t);
1807
+ return Os(r, e, t);
1808
1808
  }
1809
1809
  return { ...t, [n]: e };
1810
1810
  }
1811
- function Er(n, e, t) {
1811
+ function vr(n, e, t) {
1812
1812
  return n === e ? t : null;
1813
1813
  }
1814
- function _o(n) {
1814
+ function go(n) {
1815
1815
  switch (typeof n) {
1816
1816
  case "string":
1817
- return n.startsWith("?") ? go : Er;
1817
+ return n.startsWith("?") ? bo : vr;
1818
1818
  default:
1819
- return Er;
1819
+ return vr;
1820
1820
  }
1821
1821
  }
1822
- const mo = [
1822
+ const _o = [
1823
1823
  "in",
1824
1824
  "$in",
1825
1825
  "$not",
@@ -1827,77 +1827,77 @@ const mo = [
1827
1827
  "$comparator"
1828
1828
  // covers all of $gt, $lt, etc.
1829
1829
  ];
1830
- function wo(n) {
1831
- for (const e of mo)
1830
+ function mo(n) {
1831
+ for (const e of _o)
1832
1832
  if (n.hasOwnProperty(e))
1833
1833
  return !0;
1834
1834
  return !1;
1835
1835
  }
1836
- function ks(n, e, t) {
1837
- return t ? typeof n == "object" ? wo(n) ? t : null : _o(n)(n, e, t) : null;
1836
+ function Os(n, e, t) {
1837
+ return t ? typeof n == "object" ? mo(n) ? t : null : go(n)(n, e, t) : null;
1838
1838
  }
1839
- function To(n, e, t) {
1839
+ function wo(n, e, t) {
1840
1840
  return n.reduce((r, s, i) => {
1841
1841
  const o = e[i];
1842
- return ks(s, o, r);
1842
+ return Os(s, o, r);
1843
1843
  }, t);
1844
1844
  }
1845
- function So(n, e, t) {
1846
- return Oo(n, e, t).map((r) => To(e, r, t)).filter((r) => r);
1845
+ function To(n, e, t) {
1846
+ return Eo(n, e, t).map((r) => wo(e, r, t)).filter((r) => r);
1847
1847
  }
1848
- function vo(n, e, t) {
1849
- return e.or ? e.or.patterns.flatMap((r) => Sn(n, r, t)) : e.and ? e.and.patterns.reduce((r, s) => Sn(n, s, r), t) : t.flatMap((r) => So(n, e, r));
1848
+ function So(n, e, t) {
1849
+ return e.or ? e.or.patterns.flatMap((r) => Tn(n, r, t)) : e.and ? e.and.patterns.reduce((r, s) => Tn(n, s, r), t) : t.flatMap((r) => To(n, e, r));
1850
1850
  }
1851
- function Sn(n, e, t = [{}]) {
1852
- return e.reduce((r, s) => vo(n, s, r), t);
1851
+ function Tn(n, e, t = [{}]) {
1852
+ return e.reduce((r, s) => So(n, s, r), t);
1853
1853
  }
1854
- function Yn(n, e) {
1855
- return Array.isArray(e) ? e.map((t) => Yn(n, t)) : bo(e) ? n[e] : e;
1854
+ function Jn(n, e) {
1855
+ return Array.isArray(e) ? e.map((t) => Jn(n, t)) : yo(e) ? n[e] : e;
1856
1856
  }
1857
- function Eo(n, { find: e, where: t }) {
1858
- return Sn(n, t).map((s) => Yn(s, e));
1857
+ function vo(n, { find: e, where: t }) {
1858
+ return Tn(n, t).map((s) => Jn(s, e));
1859
1859
  }
1860
- function Oo(n, e, t) {
1861
- return lo(n, Yn(t, e));
1860
+ function Eo(n, e, t) {
1861
+ return uo(n, Jn(t, e));
1862
1862
  }
1863
- const ko = /^(?:[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;
1863
+ const Oo = /^(?:[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;
1864
1864
  function et(n) {
1865
- return typeof n == "string" && ko.test(n);
1865
+ return typeof n == "string" && Oo.test(n);
1866
1866
  }
1867
1867
  const Z = [];
1868
1868
  for (let n = 0; n < 256; ++n)
1869
1869
  Z.push((n + 256).toString(16).slice(1));
1870
- function Ao(n, e = 0) {
1870
+ function ko(n, e = 0) {
1871
1871
  return (Z[n[e + 0]] + Z[n[e + 1]] + Z[n[e + 2]] + Z[n[e + 3]] + "-" + Z[n[e + 4]] + Z[n[e + 5]] + "-" + Z[n[e + 6]] + Z[n[e + 7]] + "-" + Z[n[e + 8]] + Z[n[e + 9]] + "-" + Z[n[e + 10]] + Z[n[e + 11]] + Z[n[e + 12]] + Z[n[e + 13]] + Z[n[e + 14]] + Z[n[e + 15]]).toLowerCase();
1872
1872
  }
1873
1873
  let sn;
1874
- const Co = new Uint8Array(16);
1875
- function Io() {
1874
+ const Ao = new Uint8Array(16);
1875
+ function Co() {
1876
1876
  if (!sn) {
1877
1877
  if (typeof crypto > "u" || !crypto.getRandomValues)
1878
1878
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1879
1879
  sn = crypto.getRandomValues.bind(crypto);
1880
1880
  }
1881
- return sn(Co);
1881
+ return sn(Ao);
1882
1882
  }
1883
- const Po = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Or = { randomUUID: Po };
1884
- function Mo(n, e, t) {
1883
+ const Io = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Er = { randomUUID: Io };
1884
+ function Po(n, e, t) {
1885
1885
  var s;
1886
- if (Or.randomUUID && !n)
1887
- return Or.randomUUID();
1886
+ if (Er.randomUUID && !n)
1887
+ return Er.randomUUID();
1888
1888
  n = n || {};
1889
- const r = n.random ?? ((s = n.rng) == null ? void 0 : s.call(n)) ?? Io();
1889
+ const r = n.random ?? ((s = n.rng) == null ? void 0 : s.call(n)) ?? Co();
1890
1890
  if (r.length < 16)
1891
1891
  throw new Error("Random bytes length must be >= 16");
1892
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Ao(r);
1892
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, ko(r);
1893
1893
  }
1894
- function kr(n) {
1894
+ function Or(n) {
1895
1895
  const e = n.replace(/-/g, ""), t = [];
1896
1896
  for (let r = 0; r < e.length; r += 2)
1897
1897
  t.push(parseInt(e.substring(r, r + 2), 16));
1898
1898
  return t;
1899
1899
  }
1900
- function Ro(n, e) {
1900
+ function Mo(n, e) {
1901
1901
  for (let t = 0; t < n.length; t++) {
1902
1902
  if (n[t] < e[t])
1903
1903
  return -1;
@@ -1906,17 +1906,17 @@ function Ro(n, e) {
1906
1906
  }
1907
1907
  return 0;
1908
1908
  }
1909
- function jo(n, e) {
1910
- return Ro(kr(n), kr(e));
1909
+ function Ro(n, e) {
1910
+ return Mo(Or(n), Or(e));
1911
1911
  }
1912
1912
  function N() {
1913
- return Mo();
1913
+ return Po();
1914
1914
  }
1915
- function xo(n, e) {
1915
+ function jo(n, e) {
1916
1916
  return n.localeCompare(e);
1917
1917
  }
1918
- function $o() {
1919
- let n = xo;
1918
+ function xo() {
1919
+ let n = jo;
1920
1920
  if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
1921
1921
  try {
1922
1922
  n = Intl.Collator("en-US").compare;
@@ -1924,14 +1924,14 @@ function $o() {
1924
1924
  }
1925
1925
  return n;
1926
1926
  }
1927
- const Do = $o();
1928
- let As = !0;
1929
- const Nu = (n) => {
1930
- As = n;
1927
+ const $o = xo();
1928
+ let ks = !0;
1929
+ const Fu = (n) => {
1930
+ ks = n;
1931
1931
  };
1932
- let Uo = 0;
1932
+ let Do = 0;
1933
1933
  function pt(n) {
1934
- return Vt(`_${n}`, Uo++);
1934
+ return Vt(`_${n}`, Do++);
1935
1935
  }
1936
1936
  function Vt(n, e) {
1937
1937
  return `?${n}-${e}`;
@@ -1941,27 +1941,27 @@ class tt extends Error {
1941
1941
  super(e), this.name = "AttrNotFoundError";
1942
1942
  }
1943
1943
  }
1944
- function Lo(n, e) {
1945
- const t = Os(n, e);
1944
+ function Uo(n, e) {
1945
+ const t = Es(n, e);
1946
1946
  if (!t)
1947
1947
  throw new tt(`Could not find id attr for ${e}`);
1948
1948
  return t;
1949
1949
  }
1950
- function Ar(n, e, t, r) {
1951
- return [Fo(n, e, t, r)];
1950
+ function kr(n, e, t, r) {
1951
+ return [Lo(n, e, t, r)];
1952
1952
  }
1953
- function Fo(n, e, t, r) {
1953
+ function Lo(n, e, t, r) {
1954
1954
  return [
1955
1955
  n(t, r),
1956
- Lo(e, t).id,
1956
+ Uo(e, t).id,
1957
1957
  n(t, r),
1958
1958
  n("time", r)
1959
1959
  ];
1960
1960
  }
1961
- function No(n, e, t) {
1961
+ function Fo(n, e, t) {
1962
1962
  return n.map((r) => r === e ? t : r);
1963
1963
  }
1964
- function Cs(n, e, t, r, s) {
1964
+ function As(n, e, t, r, s) {
1965
1965
  const i = V(e, t, s), o = Ke(e, t, s), a = i || o;
1966
1966
  if (!a)
1967
1967
  throw new tt(`Could not find attr for ${[t, s]}`);
@@ -1980,7 +1980,7 @@ function Cs(n, e, t, r, s) {
1980
1980
  ];
1981
1981
  return [i ? f : u, p, y, a, !!i];
1982
1982
  }
1983
- function Cr(n, e) {
1983
+ function Ar(n, e) {
1984
1984
  if (typeof e != "string")
1985
1985
  return function(o) {
1986
1986
  return !1;
@@ -1990,7 +1990,7 @@ function Cr(n, e) {
1990
1990
  return typeof o != "string" ? !1 : s.test(o);
1991
1991
  };
1992
1992
  }
1993
- function Wo(n, e) {
1993
+ function No(n, e) {
1994
1994
  if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
1995
1995
  return e;
1996
1996
  const t = n["checked-data-type"] === "date";
@@ -2031,7 +2031,7 @@ function Wo(n, e) {
2031
2031
  }
2032
2032
  };
2033
2033
  if (e.hasOwnProperty("$like")) {
2034
- const r = Cr(!0, e.$like);
2034
+ const r = Ar(!0, e.$like);
2035
2035
  return {
2036
2036
  $comparator: !0,
2037
2037
  $op: function(i) {
@@ -2040,7 +2040,7 @@ function Wo(n, e) {
2040
2040
  };
2041
2041
  }
2042
2042
  if (e.hasOwnProperty("$ilike")) {
2043
- const r = Cr(!1, e.$ilike);
2043
+ const r = Ar(!1, e.$ilike);
2044
2044
  return {
2045
2045
  $comparator: !0,
2046
2046
  $op: function(i) {
@@ -2050,7 +2050,7 @@ function Wo(n, e) {
2050
2050
  }
2051
2051
  return e;
2052
2052
  }
2053
- function Ko(n, e, t, r, s, i) {
2053
+ function Wo(n, e, t, r, s, i) {
2054
2054
  const o = V(e, t, s), a = Ke(e, t, s), c = o || a;
2055
2055
  if (!c)
2056
2056
  throw new tt(`No attr for etype = ${t} label = ${s}`);
@@ -2068,65 +2068,65 @@ function Ko(n, e, t, r, s, i) {
2068
2068
  return o ? [
2069
2069
  n(t, r),
2070
2070
  c.id,
2071
- Wo(c, i),
2071
+ No(c, i),
2072
2072
  pt("time")
2073
2073
  ] : [i, c.id, n(t, r), pt("time")];
2074
2074
  }
2075
- function qo(n, e, t, r, s) {
2075
+ function Ko(n, e, t, r, s) {
2076
2076
  const [i, o, a] = s.reduce((c, u) => {
2077
- const [l, f, p] = c, [y, b, _] = Cs(n, e, l, f, u);
2077
+ const [l, f, p] = c, [y, b, _] = As(n, e, l, f, u);
2078
2078
  return [y, b, [...p, _]];
2079
2079
  }, [t, r, []]);
2080
2080
  return [i, o, a];
2081
2081
  }
2082
- function vn(n, e, t, r, s, i) {
2083
- const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = qo(n, e, t, r, o), f = Ko(n, e, c, u, a, i);
2082
+ function Sn(n, e, t, r, s, i) {
2083
+ const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = Ko(n, e, t, r, o), f = Wo(n, e, c, u, a, i);
2084
2084
  return l.concat([f]);
2085
2085
  }
2086
- function zo(n, e) {
2086
+ function qo(n, e) {
2087
2087
  return e ? [e].concat(n) : n;
2088
2088
  }
2089
- function Vo([n, e]) {
2089
+ function zo([n, e]) {
2090
2090
  return n === "or" && Array.isArray(e);
2091
2091
  }
2092
- function Bo([n, e]) {
2092
+ function Vo([n, e]) {
2093
2093
  return n === "and" && Array.isArray(e);
2094
2094
  }
2095
- function Go(n, e, t) {
2095
+ function Bo(n, e, t) {
2096
2096
  return (r, s) => {
2097
2097
  const i = n(r, s);
2098
2098
  return e == i ? i : `${i}-${t}`;
2099
2099
  };
2100
2100
  }
2101
- function Ir(n, e, t, r, s, i) {
2101
+ function Cr(n, e, t, r, s, i) {
2102
2102
  const o = n(r, s), a = i.map((c, u) => {
2103
- const l = Go(n, o, u);
2104
- return Is(l, t, r, s, c);
2103
+ const l = Bo(n, o, u);
2104
+ return Cs(l, t, r, s, c);
2105
2105
  });
2106
2106
  return { [e]: { patterns: a, joinSym: o } };
2107
2107
  }
2108
- function Qo(n) {
2108
+ function Go(n) {
2109
2109
  const e = [];
2110
2110
  for (let t = 1; t <= n.length; t++)
2111
2111
  e.push(n.slice(0, t));
2112
2112
  return e;
2113
2113
  }
2114
- function Pr(n, e, t, r, s) {
2115
- return Qo(s).map((i) => vn(n, e, t, r, i, {
2114
+ function Ir(n, e, t, r, s) {
2115
+ return Go(s).map((i) => Sn(n, e, t, r, i, {
2116
2116
  $isNull: !0
2117
2117
  }));
2118
2118
  }
2119
- function Is(n, e, t, r, s) {
2119
+ function Cs(n, e, t, r, s) {
2120
2120
  return Object.entries(s).flatMap(([i, o]) => {
2121
+ if (zo([i, o]))
2122
+ return Cr(n, "or", e, t, r, o);
2121
2123
  if (Vo([i, o]))
2122
- return Ir(n, "or", e, t, r, o);
2123
- if (Bo([i, o]))
2124
- return Ir(n, "and", e, t, r, o);
2124
+ return Cr(n, "and", e, t, r, o);
2125
2125
  if (i === "$entityIdStartsWith")
2126
2126
  return [];
2127
2127
  const a = i.split(".");
2128
2128
  if (o != null && o.hasOwnProperty("$ne") && (o = { ...o, $not: o.$ne }, delete o.$ne), o != null && o.hasOwnProperty("$not")) {
2129
- const c = vn(n, e, t, r, a, o), u = Pr(n, e, t, r, a);
2129
+ const c = Sn(n, e, t, r, a, o), u = Ir(n, e, t, r, a);
2130
2130
  return [
2131
2131
  {
2132
2132
  or: {
@@ -2139,32 +2139,32 @@ function Is(n, e, t, r, s) {
2139
2139
  return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && a.length > 1 ? [
2140
2140
  {
2141
2141
  or: {
2142
- patterns: Pr(n, e, t, r, a),
2142
+ patterns: Ir(n, e, t, r, a),
2143
2143
  joinSym: n(t, r)
2144
2144
  }
2145
2145
  }
2146
- ] : vn(n, e, t, r, a, o);
2146
+ ] : Sn(n, e, t, r, a, o);
2147
2147
  });
2148
2148
  }
2149
- function Ho(n, e, t, r) {
2149
+ function Qo(n, e, t, r) {
2150
2150
  const s = Vt;
2151
- return r ? Is(s, n, e, t, r).concat(Ar(s, n, e, t)) : Ar(s, n, e, t);
2151
+ return r ? Cs(s, n, e, t, r).concat(kr(s, n, e, t)) : kr(s, n, e, t);
2152
2152
  }
2153
- function Jo(n, e, t) {
2153
+ function Ho(n, e, t) {
2154
2154
  return [n(e, t), n("time", t)];
2155
2155
  }
2156
- function Yo(n, e, t, r, s, i) {
2157
- const [o, a, c, u, l] = Cs(n, e, t, r, s), f = No(c, n(t, r), i);
2156
+ function Jo(n, e, t, r, s, i) {
2157
+ const [o, a, c, u, l] = As(n, e, t, r, s), f = Fo(c, n(t, r), i);
2158
2158
  return [o, a, f, u, l];
2159
2159
  }
2160
- function Zo(n, e, t, { etype: r, level: s, form: i }, o) {
2160
+ function Yo(n, e, t, { etype: r, level: s, form: i }, o) {
2161
2161
  const a = Object.keys(i).filter((c) => c !== "$");
2162
2162
  return a.length ? Object.entries(o).map(function([u, l]) {
2163
2163
  return a.map(function(y) {
2164
2164
  var _, m, S;
2165
2165
  const b = !!(e.cardinalityInference && ((S = (m = (_ = t.linkIndex) == null ? void 0 : _[r]) == null ? void 0 : m[y]) != null && S.isSingular));
2166
2166
  try {
2167
- const [g, w, O] = Yo(n, t, r, s, y, u), v = Ms(e, t, {
2167
+ const [g, w, O] = Jo(n, t, r, s, y, u), v = Ps(e, t, {
2168
2168
  etype: g,
2169
2169
  level: w,
2170
2170
  form: i[y],
@@ -2181,48 +2181,48 @@ function Zo(n, e, t, { etype: r, level: s, form: i }, o) {
2181
2181
  }, l);
2182
2182
  }) : Object.values(o);
2183
2183
  }
2184
- function Xo(n, e, t) {
2185
- return t === "string" ? Do(n, e) : n > e ? 1 : -1;
2184
+ function Zo(n, e, t) {
2185
+ return t === "string" ? $o(n, e) : n > e ? 1 : -1;
2186
2186
  }
2187
2187
  function lt(n, e, t, r, s) {
2188
- return e === r || e == null && r == null ? jo(n, t) : r == null ? 1 : e == null ? -1 : Xo(e, r, s);
2188
+ return e === r || e == null && r == null ? Ro(n, t) : r == null ? 1 : e == null ? -1 : Zo(e, r, s);
2189
2189
  }
2190
2190
  function Wt([n, e], [t, r], s) {
2191
2191
  return lt(n, e, t, r, s);
2192
2192
  }
2193
- function En(n) {
2193
+ function vn(n) {
2194
2194
  return n == null ? n : new Date(n).getTime();
2195
2195
  }
2196
- function ea(n, e, t, r) {
2196
+ function Xo(n, e, t, r) {
2197
2197
  var b;
2198
2198
  const [s, i, o, a] = n, c = t === "desc" ? 1 : -1;
2199
2199
  if (((b = e["forward-identity"]) == null ? void 0 : b[2]) === "id")
2200
2200
  return Wt(r, [s, a], null) === c;
2201
- const [u, l] = r, f = e["checked-data-type"], p = f === "date" ? En(l) : l, y = f === "date" ? En(o) : o;
2201
+ const [u, l] = r, f = e["checked-data-type"], p = f === "date" ? vn(l) : l, y = f === "date" ? vn(o) : o;
2202
2202
  return Wt([u, p], [s, y], f) === c;
2203
2203
  }
2204
- function ta(n, e) {
2204
+ function ea(n, e) {
2205
2205
  const t = e[1];
2206
2206
  return n.getAttr(t);
2207
2207
  }
2208
- function na(n, e, t) {
2208
+ function ta(n, e, t) {
2209
2209
  const r = Object.keys(t)[0];
2210
2210
  return V(n, e, r);
2211
2211
  }
2212
- function ra(n, e, t, r) {
2212
+ function na(n, e, t, r) {
2213
2213
  if (t)
2214
- return ta(n, t);
2214
+ return ea(n, t);
2215
2215
  if (r)
2216
- return na(n, e, r);
2216
+ return ta(n, e, r);
2217
2217
  }
2218
- function sa(n, e, t) {
2218
+ function ra(n, e, t) {
2219
2219
  var s, i;
2220
2220
  if (!Array.isArray(t.fields))
2221
- return ho(n, e);
2221
+ return fo(n, e);
2222
2222
  const r = /* @__PURE__ */ new Map();
2223
2223
  for (const o of t.fields) {
2224
2224
  const a = V(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
2225
- c && Jn(a) && r.set(c, a);
2225
+ c && Hn(a) && r.set(c, a);
2226
2226
  }
2227
2227
  if (!r.has("id")) {
2228
2228
  const o = V(n, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
@@ -2230,17 +2230,17 @@ function sa(n, e, t) {
2230
2230
  }
2231
2231
  return r;
2232
2232
  }
2233
- function ia(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
2233
+ function sa(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
2234
2234
  var b, _;
2235
- const o = (b = i == null ? void 0 : i.$) == null ? void 0 : b.order, a = Ps(i), c = oa(i);
2236
- let u = Eo(n, s);
2237
- const l = r == null ? void 0 : r["start-cursor"], f = ra(e, t, l, o);
2235
+ const o = (b = i == null ? void 0 : i.$) == null ? void 0 : b.order, a = Is(i), c = ia(i);
2236
+ let u = vo(n, s);
2237
+ const l = r == null ? void 0 : r["start-cursor"], f = na(e, t, l, o);
2238
2238
  if (f && ((_ = f == null ? void 0 : f["forward-identity"]) == null ? void 0 : _[2]) !== "id") {
2239
2239
  const m = f["checked-data-type"] === "date", S = f.id;
2240
2240
  u = u.map(([g]) => {
2241
2241
  var O, v, C, j, U;
2242
2242
  let w = (U = (j = (C = (v = (O = n.eav.get(g)) == null ? void 0 : O.get(S)) == null ? void 0 : v.values()) == null ? void 0 : C.next()) == null ? void 0 : j.value) == null ? void 0 : U[2];
2243
- return m && (w = En(w)), [g, w];
2243
+ return m && (w = vn(w)), [g, w];
2244
2244
  });
2245
2245
  }
2246
2246
  u.sort(c === "asc" ? function(S, g) {
@@ -2249,57 +2249,57 @@ function ia(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
2249
2249
  return Wt(g, S, f == null ? void 0 : f["checked-data-type"]);
2250
2250
  });
2251
2251
  let p = {};
2252
- const y = sa(e, t, s);
2252
+ const y = ra(e, t, s);
2253
2253
  for (const m of u) {
2254
2254
  const [S] = m;
2255
- if (p[S] || !a && l && f && ea(l, f, c, m))
2255
+ if (p[S] || !a && l && f && Xo(l, f, c, m))
2256
2256
  continue;
2257
- const g = fo(n, y, S);
2257
+ const g = lo(n, y, S);
2258
2258
  g && (p[S] = g);
2259
2259
  }
2260
2260
  return p;
2261
2261
  }
2262
- function oa(n) {
2262
+ function ia(n) {
2263
2263
  var t;
2264
2264
  const e = (t = n.$) == null ? void 0 : t.order;
2265
2265
  return e && e[Object.keys(e)[0]] || "asc";
2266
2266
  }
2267
- function Ps(n) {
2267
+ function Is(n) {
2268
2268
  var s, i, o;
2269
2269
  const e = (s = n.$) == null ? void 0 : s.offset, t = (i = n.$) == null ? void 0 : i.before, r = (o = n.$) == null ? void 0 : o.after;
2270
2270
  return !e && !t && !r;
2271
2271
  }
2272
- function aa(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
2272
+ function oa(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
2273
2273
  var p, y, b, _, m;
2274
- if (!Ps(s) && (!o || !o["start-cursor"]))
2274
+ if (!Is(s) && (!o || !o["start-cursor"]))
2275
2275
  return [];
2276
- const a = zo(Ho(e, t, r, (p = s.$) == null ? void 0 : p.where), i), c = Jo(Vt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = ia(n, e, {
2276
+ const a = qo(Qo(e, t, r, (p = s.$) == null ? void 0 : p.where), i), c = Ho(Vt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = sa(n, e, {
2277
2277
  etype: t,
2278
2278
  pageInfo: o,
2279
2279
  form: s,
2280
2280
  dq: { where: a, find: c, fields: u }
2281
2281
  }), f = ((b = s.$) == null ? void 0 : b.limit) || ((_ = s.$) == null ? void 0 : _.first) || ((m = s.$) == null ? void 0 : m.last);
2282
2282
  if (f != null) {
2283
- r > 0 && As && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
2283
+ r > 0 && ks && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
2284
2284
  const S = Object.entries(l);
2285
2285
  return S.length <= f ? l : Object.fromEntries(S.slice(0, f));
2286
2286
  }
2287
2287
  return l;
2288
2288
  }
2289
- function ca(n, e, t) {
2289
+ function aa(n, e, t) {
2290
2290
  try {
2291
- return aa(n, e, t);
2291
+ return oa(n, e, t);
2292
2292
  } catch (r) {
2293
2293
  if (r instanceof tt)
2294
2294
  return {};
2295
2295
  throw r;
2296
2296
  }
2297
2297
  }
2298
- function Ms(n, e, t) {
2299
- const r = ca(n, e, t);
2300
- return Zo(Vt, n, e, t, r);
2298
+ function Ps(n, e, t) {
2299
+ const r = aa(n, e, t);
2300
+ return Yo(Vt, n, e, t, r);
2301
2301
  }
2302
- function ua(n) {
2302
+ function ca(n) {
2303
2303
  const e = {};
2304
2304
  for (const [t, r] of Object.entries(n))
2305
2305
  e[t] = {
@@ -2310,18 +2310,18 @@ function ua(n) {
2310
2310
  };
2311
2311
  return e;
2312
2312
  }
2313
- function Rs({ store: n, attrsStore: e, pageInfo: t, aggregate: r }, s) {
2313
+ function Ms({ store: n, attrsStore: e, pageInfo: t, aggregate: r }, s) {
2314
2314
  const o = { data: Object.keys(s).reduce(function(c, u) {
2315
- return r != null && r[u] || u === "$$ruleParams" || (c[u] = Ms(n, e, {
2315
+ return r != null && r[u] || u === "$$ruleParams" || (c[u] = Ps(n, e, {
2316
2316
  etype: u,
2317
2317
  form: s[u],
2318
2318
  level: 0,
2319
2319
  pageInfo: t == null ? void 0 : t[u]
2320
2320
  })), c;
2321
2321
  }, {}) };
2322
- return t && (o.pageInfo = ua(t)), r && (o.aggregate = r), o;
2322
+ return t && (o.pageInfo = ca(t)), r && (o.aggregate = r), o;
2323
2323
  }
2324
- function la() {
2324
+ function ua() {
2325
2325
  const e = {
2326
2326
  __etype: 1,
2327
2327
  __ops: 1,
@@ -2335,7 +2335,7 @@ function la() {
2335
2335
  };
2336
2336
  return new Set(Object.keys(e));
2337
2337
  }
2338
- const fa = la();
2338
+ const la = ua();
2339
2339
  function xt(n, e, t) {
2340
2340
  const r = {
2341
2341
  __etype: n,
@@ -2347,7 +2347,7 @@ function xt(n, e, t) {
2347
2347
  return t;
2348
2348
  if (i === "__etype")
2349
2349
  return n;
2350
- if (fa.has(i))
2350
+ if (la.has(i))
2351
2351
  return (o, a) => xt(n, e, [
2352
2352
  ...t,
2353
2353
  a ? [i, n, e, o, a] : [i, n, e, o]
@@ -2355,42 +2355,42 @@ function xt(n, e, t) {
2355
2355
  }
2356
2356
  });
2357
2357
  }
2358
- function da(n, e) {
2358
+ function fa(n, e) {
2359
2359
  return `lookup__${n}__${JSON.stringify(e)}`;
2360
2360
  }
2361
2361
  function Kt(n) {
2362
2362
  return n.startsWith("lookup__");
2363
2363
  }
2364
- function On(n) {
2364
+ function En(n) {
2365
2365
  const [e, t, ...r] = n.split("__");
2366
2366
  return [t, JSON.parse(r.join("__"))];
2367
2367
  }
2368
- function ha(n) {
2368
+ function da(n) {
2369
2369
  return new Proxy({
2370
2370
  __etype: n
2371
2371
  }, {
2372
2372
  get(e, t) {
2373
2373
  if (t === "lookup")
2374
- return (s, i) => xt(n, On(da(s, i)), []);
2374
+ return (s, i) => xt(n, En(fa(s, i)), []);
2375
2375
  if (t === "__etype")
2376
2376
  return n;
2377
2377
  const r = t;
2378
- return Kt(r) ? xt(n, On(r), []) : xt(n, r, []);
2378
+ return Kt(r) ? xt(n, En(r), []) : xt(n, r, []);
2379
2379
  }
2380
2380
  });
2381
2381
  }
2382
- function Zn() {
2382
+ function Yn() {
2383
2383
  return new Proxy({}, {
2384
2384
  get(n, e) {
2385
- return ha(e);
2385
+ return da(e);
2386
2386
  }
2387
2387
  });
2388
2388
  }
2389
- const Wu = Zn();
2390
- function pa(n) {
2389
+ const Nu = Yn();
2390
+ function ha(n) {
2391
2391
  return n.__ops;
2392
2392
  }
2393
- function ya(n, e) {
2393
+ function pa(n, e) {
2394
2394
  const { attrIdMap: t, refSwapAttrIds: r } = n, s = [];
2395
2395
  for (const o of e) {
2396
2396
  const a = t[o];
@@ -2409,7 +2409,7 @@ function ya(n, e) {
2409
2409
  }
2410
2410
  return s;
2411
2411
  }
2412
- function ba(n) {
2412
+ function ya(n) {
2413
2413
  if (Array.isArray(n))
2414
2414
  return n;
2415
2415
  const e = Object.entries(n);
@@ -2417,38 +2417,38 @@ function ba(n) {
2417
2417
  throw new Error("lookup must be an object with a single unique attr and value.");
2418
2418
  return e[0];
2419
2419
  }
2420
- function ga(n, e, t) {
2420
+ function ba(n, e, t) {
2421
2421
  return t.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
2422
2422
  // before assuming it's a ref lookup.
2423
2423
  !V(n, e, t);
2424
2424
  }
2425
- function kn(n) {
2425
+ function On(n) {
2426
2426
  const [e, t, ...r] = n.split(".");
2427
2427
  if (r.length > 0 || t !== "id")
2428
2428
  throw new Error(`${n} is not a valid lookup attribute.`);
2429
2429
  return e;
2430
2430
  }
2431
- function _a(n, e, t) {
2432
- if (!ga(n, e, t))
2431
+ function ga(n, e, t) {
2432
+ if (!ba(n, e, t))
2433
2433
  return V(n, e, t);
2434
- const r = kn(t), s = V(n, e, r) || Ke(n, e, r);
2434
+ const r = On(t), s = V(n, e, r) || Ke(n, e, r);
2435
2435
  if (s && s["value-type"] !== "ref")
2436
2436
  throw new Error(`${t} does not reference a valid link attribute.`);
2437
2437
  return s;
2438
2438
  }
2439
- function An(n) {
2440
- return typeof n == "string" && !Kt(n) ? null : typeof n == "string" && Kt(n) ? On(n) : ba(n);
2439
+ function kn(n) {
2440
+ return typeof n == "string" && !Kt(n) ? null : typeof n == "string" && Kt(n) ? En(n) : ya(n);
2441
2441
  }
2442
2442
  function de(n, e, t) {
2443
- const r = An(t);
2443
+ const r = kn(t);
2444
2444
  if (r === null)
2445
2445
  return t;
2446
- const [s, i] = r, o = _a(n, e, s);
2446
+ const [s, i] = r, o = ga(n, e, s);
2447
2447
  if (!o || !o["unique?"])
2448
2448
  throw new Error(`${s} is not a unique attribute.`);
2449
2449
  return [o.id, i];
2450
2450
  }
2451
- function js(n, e, t, r) {
2451
+ function Rs(n, e, t, r) {
2452
2452
  var o;
2453
2453
  const s = de(n, e, t);
2454
2454
  return Array.isArray(s) ? [[
@@ -2458,7 +2458,7 @@ function js(n, e, t, r) {
2458
2458
  s
2459
2459
  ]].concat(r) : r;
2460
2460
  }
2461
- function ma({ attrsStore: n }, [e, t, r]) {
2461
+ function _a({ attrsStore: n }, [e, t, r]) {
2462
2462
  const s = Object.entries(r).flatMap(([i, o]) => {
2463
2463
  const a = Array.isArray(o) ? o : [o], c = V(n, e, i), u = Ke(n, e, i);
2464
2464
  return a.map((l) => c ? [
@@ -2477,9 +2477,9 @@ function ma({ attrsStore: n }, [e, t, r]) {
2477
2477
  de(n, e, t)
2478
2478
  ]);
2479
2479
  });
2480
- return js(n, e, t, s);
2480
+ return Rs(n, e, t, s);
2481
2481
  }
2482
- function wa({ attrsStore: n }, [e, t, r]) {
2482
+ function ma({ attrsStore: n }, [e, t, r]) {
2483
2483
  const s = Object.entries(r).flatMap(([i, o]) => {
2484
2484
  const a = Array.isArray(o) ? o : [o], c = V(n, e, i), u = Ke(n, e, i);
2485
2485
  return a.map((l) => c ? [
@@ -2498,9 +2498,9 @@ function wa({ attrsStore: n }, [e, t, r]) {
2498
2498
  de(n, e, t)
2499
2499
  ]);
2500
2500
  });
2501
- return js(n, e, t, s);
2501
+ return Rs(n, e, t, s);
2502
2502
  }
2503
- function Ta(n, e, t, r) {
2503
+ function wa(n, e, t, r) {
2504
2504
  var s;
2505
2505
  if (Array.isArray(r)) {
2506
2506
  const [i, o] = r;
@@ -2523,18 +2523,18 @@ function Ta(n, e, t, r) {
2523
2523
  }
2524
2524
  return !1;
2525
2525
  }
2526
- function xs({ stores: n, attrsStore: e }, [t, r, s, i]) {
2527
- return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : Ta(n, e, t, r) ? { mode: "update" } : null;
2526
+ function js({ stores: n, attrsStore: e }, [t, r, s, i]) {
2527
+ return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : wa(n, e, t, r) ? { mode: "update" } : null;
2528
2528
  }
2529
- function Sa(n, e) {
2530
- const { attrsStore: t } = n, [r, s, i, o] = e, a = Qn(i), c = de(t, r, s);
2529
+ function Ta(n, e) {
2530
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = Gn(i), c = de(t, r, s);
2531
2531
  return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
2532
2532
  const p = V(t, r, l);
2533
2533
  return p["checked-data-type"] === "date" && n.useDateObjects && (f = zt(f)), ["add-triple", c, p.id, f, { mode: "create" }];
2534
2534
  });
2535
2535
  }
2536
- function va(n, e) {
2537
- const { attrsStore: t } = n, [r, s, i, o] = e, a = Qn(i), c = de(t, r, s), u = xs(n, [r, c, i, o]);
2536
+ function Sa(n, e) {
2537
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = Gn(i), c = de(t, r, s), u = js(n, [r, c, i, o]);
2538
2538
  return [["id", c]].concat(Object.entries(a)).map(([f, p]) => {
2539
2539
  const y = V(t, r, f);
2540
2540
  return y["checked-data-type"] === "date" && n.useDateObjects && (p = zt(p)), [
@@ -2546,11 +2546,11 @@ function va(n, e) {
2546
2546
  ];
2547
2547
  });
2548
2548
  }
2549
- function Ea({ attrsStore: n }, [e, t]) {
2549
+ function va({ attrsStore: n }, [e, t]) {
2550
2550
  return [["delete-entity", de(n, e, t), e]];
2551
2551
  }
2552
- function Oa(n, e) {
2553
- const { attrsStore: t } = n, [r, s, i, o] = e, a = Qn(i), c = de(t, r, s), u = xs(n, [r, c, i, o]), l = Object.entries(a).map(([p, y]) => {
2552
+ function Ea(n, e) {
2553
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = Gn(i), c = de(t, r, s), u = js(n, [r, c, i, o]), l = Object.entries(a).map(([p, y]) => {
2554
2554
  const b = V(t, r, p);
2555
2555
  return [
2556
2556
  "deep-merge-triple",
@@ -2568,38 +2568,38 @@ function Oa(n, e) {
2568
2568
  ...u ? [u] : []
2569
2569
  ]].concat(l);
2570
2570
  }
2571
- function ka({ attrsStore: n }, [e, t, r]) {
2571
+ function Oa({ attrsStore: n }, [e, t, r]) {
2572
2572
  return [["rule-params", de(n, e, t), e, r]];
2573
2573
  }
2574
- function Aa(n) {
2574
+ function ka(n) {
2575
2575
  const [e, t, r, s, i] = n;
2576
2576
  if (!s)
2577
2577
  return n;
2578
2578
  const o = { ...s };
2579
2579
  return delete o.id, [e, t, r, o, ...i ? [i] : []];
2580
2580
  }
2581
- function Ca(n, e) {
2582
- const [t, ...r] = Aa(e);
2581
+ function Aa(n, e) {
2582
+ const [t, ...r] = ka(e);
2583
2583
  switch (t) {
2584
2584
  case "merge":
2585
- return Oa(n, r);
2585
+ return Ea(n, r);
2586
2586
  case "create":
2587
- return Sa(n, r);
2587
+ return Ta(n, r);
2588
2588
  case "update":
2589
- return va(n, r);
2589
+ return Sa(n, r);
2590
2590
  case "link":
2591
- return ma(n, r);
2591
+ return _a(n, r);
2592
2592
  case "unlink":
2593
- return wa(n, r);
2593
+ return ma(n, r);
2594
2594
  case "delete":
2595
- return Ea(n, r);
2595
+ return va(n, r);
2596
2596
  case "ruleParams":
2597
- return ka(n, r);
2597
+ return Oa(n, r);
2598
2598
  default:
2599
2599
  throw new Error(`unsupported action ${t}`);
2600
2600
  }
2601
2601
  }
2602
- function Ia(n) {
2602
+ function Ca(n) {
2603
2603
  switch (n) {
2604
2604
  case "string":
2605
2605
  case "date":
@@ -2610,14 +2610,14 @@ function Ia(n) {
2610
2610
  return;
2611
2611
  }
2612
2612
  }
2613
- function Pa(n, e, t) {
2613
+ function Ia(n, e, t) {
2614
2614
  var a, c;
2615
2615
  const r = (c = (a = n.entities[e]) == null ? void 0 : a.attrs) == null ? void 0 : c[t];
2616
2616
  if (t === "id")
2617
2617
  return null;
2618
2618
  if (!r)
2619
2619
  throw new Error(`${e}.${t} does not exist in your schema`);
2620
- const { unique: s, indexed: i } = r == null ? void 0 : r.config, o = Ia(r == null ? void 0 : r.valueType);
2620
+ const { unique: s, indexed: i } = r == null ? void 0 : r.config, o = Ca(r == null ? void 0 : r.valueType);
2621
2621
  return {
2622
2622
  "index?": i,
2623
2623
  "unique?": s,
@@ -2625,7 +2625,7 @@ function Pa(n, e, t) {
2625
2625
  };
2626
2626
  }
2627
2627
  function At(n, e, t, r) {
2628
- const s = n ? Pa(n, e, t) : null, i = N(), a = [N(), e, t];
2628
+ const s = n ? Ia(n, e, t) : null, i = N(), a = [N(), e, t];
2629
2629
  return {
2630
2630
  id: i,
2631
2631
  "forward-identity": a,
@@ -2638,11 +2638,11 @@ function At(n, e, t, r) {
2638
2638
  ...r || {}
2639
2639
  };
2640
2640
  }
2641
- function Ma(n, e, t) {
2641
+ function Pa(n, e, t) {
2642
2642
  return Object.values(n.links).find((i) => i.forward.on === e && i.forward.label === t || i.reverse.on === e && i.reverse.label === t);
2643
2643
  }
2644
- function Ra(n, e, t) {
2645
- const r = Ma(n, e, t);
2644
+ function Ma(n, e, t) {
2645
+ const r = Pa(n, e, t);
2646
2646
  if (!r)
2647
2647
  throw new Error(`Couldn't find the link ${e}.${t} in your schema`);
2648
2648
  const { forward: s, reverse: i } = r;
@@ -2655,8 +2655,8 @@ function Ra(n, e, t) {
2655
2655
  "on-delete-reverse": i.onDelete
2656
2656
  };
2657
2657
  }
2658
- function Mr(n, e, t, r) {
2659
- const s = n ? Ra(n, e, t) : null, i = N(), o = [N(), e, t], a = [N(), t, e];
2658
+ function Pr(n, e, t, r) {
2659
+ const s = n ? Ma(n, e, t) : null, i = N(), o = [N(), e, t], a = [N(), t, e];
2660
2660
  return {
2661
2661
  id: i,
2662
2662
  // @ts-ignore: ts thinks it's any[]
@@ -2673,7 +2673,7 @@ function Mr(n, e, t, r) {
2673
2673
  ...r || {}
2674
2674
  };
2675
2675
  }
2676
- const ja = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), xa = /* @__PURE__ */ new Set(["link", "unlink"]), $a = /* @__PURE__ */ new Set(["create", "update", "merge"]), Da = /* @__PURE__ */ new Set([
2676
+ const Ra = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), ja = /* @__PURE__ */ new Set(["link", "unlink"]), xa = /* @__PURE__ */ new Set(["create", "update", "merge"]), $a = /* @__PURE__ */ new Set([
2677
2677
  "link",
2678
2678
  "unlink",
2679
2679
  "create",
@@ -2681,20 +2681,20 @@ const ja = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
2681
2681
  "merge",
2682
2682
  "delete",
2683
2683
  "ruleParams"
2684
- ]), Cn = { "unique?": !0, "index?": !0 }, Ua = {
2685
- ...Cn,
2684
+ ]), An = { "unique?": !0, "index?": !0 }, Da = {
2685
+ ...An,
2686
2686
  cardinality: "one"
2687
2687
  };
2688
- function La(n) {
2688
+ function Ua(n) {
2689
2689
  const e = [], [t, r, s, i] = n;
2690
- if (!Da.has(t))
2690
+ if (!$a.has(t))
2691
2691
  return e;
2692
- const o = An(s);
2692
+ const o = kn(s);
2693
2693
  if (o && e.push({ etype: r, lookupPair: o }), t === "link")
2694
2694
  for (const [a, c] of Object.entries(i)) {
2695
2695
  const u = Array.isArray(c) ? c : [c];
2696
2696
  for (const l of u) {
2697
- const f = An(l);
2697
+ const f = kn(l);
2698
2698
  f && e.push({
2699
2699
  etype: r,
2700
2700
  lookupPair: f,
@@ -2704,7 +2704,7 @@ function La(n) {
2704
2704
  }
2705
2705
  return e;
2706
2706
  }
2707
- function Fa({ attrsStore: n, schema: e }, t) {
2707
+ function La({ attrsStore: n, schema: e }, t) {
2708
2708
  var p, y;
2709
2709
  const r = /* @__PURE__ */ new Set(), s = [], i = [];
2710
2710
  function o(b, _) {
@@ -2729,10 +2729,10 @@ function Fa({ attrsStore: n, schema: e }, t) {
2729
2729
  }
2730
2730
  function f(b, _) {
2731
2731
  const m = o(b, _), S = a(b, _);
2732
- u(m), u(S), !m && !S && c(Mr(e, b, _, Ua));
2732
+ u(m), u(S), !m && !S && c(Pr(e, b, _, Da));
2733
2733
  }
2734
2734
  for (const b of t)
2735
- for (const { etype: _, lookupPair: m, linkLabel: S } of La(b)) {
2735
+ for (const { etype: _, lookupPair: m, linkLabel: S } of Ua(b)) {
2736
2736
  const g = m[0];
2737
2737
  if (S) {
2738
2738
  f(_, S);
@@ -2740,28 +2740,28 @@ function Fa({ attrsStore: n, schema: e }, t) {
2740
2740
  u(w), u(O);
2741
2741
  const v = ((p = w == null ? void 0 : w["reverse-identity"]) == null ? void 0 : p[1]) || ((y = O == null ? void 0 : O["forward-identity"]) == null ? void 0 : y[1]) || S;
2742
2742
  if (l(v, g))
2743
- f(v, kn(g));
2743
+ f(v, On(g));
2744
2744
  else {
2745
2745
  const C = o(v, g);
2746
- C || c(At(e, v, g, Cn)), u(C);
2746
+ C || c(At(e, v, g, An)), u(C);
2747
2747
  }
2748
2748
  } else if (l(_, g))
2749
- f(_, kn(g));
2749
+ f(_, On(g));
2750
2750
  else {
2751
2751
  const w = o(_, g);
2752
- w || c(At(e, _, g, Cn)), u(w);
2752
+ w || c(At(e, _, g, An)), u(w);
2753
2753
  }
2754
2754
  }
2755
2755
  for (const b of t) {
2756
2756
  const [_, m, S, g] = b;
2757
- if (ja.has(_)) {
2757
+ if (Ra.has(_)) {
2758
2758
  const w = o(m, "id");
2759
2759
  u(w), w || c(At(e, m, "id", { "unique?": !0 }));
2760
2760
  for (const O of Object.keys(g)) {
2761
2761
  const v = o(m, O);
2762
- if (u(v), $a.has(_) && (v || c(At(e, m, O, O === "id" ? { "unique?": !0 } : null))), xa.has(_)) {
2762
+ if (u(v), xa.has(_) && (v || c(At(e, m, O, O === "id" ? { "unique?": !0 } : null))), ja.has(_)) {
2763
2763
  const C = a(m, O);
2764
- !v && !C && c(Mr(e, m, O)), u(C);
2764
+ !v && !C && c(Pr(e, m, O)), u(C);
2765
2765
  }
2766
2766
  }
2767
2767
  }
@@ -2774,19 +2774,19 @@ function Fa({ attrsStore: n, schema: e }, t) {
2774
2774
  }
2775
2775
  return [n, i];
2776
2776
  }
2777
- function Na(n, e) {
2778
- const r = (Array.isArray(e) ? e : [e]).flatMap((c) => pa(c)), [s, i] = Fa(n, r), o = { ...n, attrsStore: s }, a = r.flatMap((c) => Ca(o, c));
2777
+ function Fa(n, e) {
2778
+ const r = (Array.isArray(e) ? e : [e]).flatMap((c) => ha(c)), [s, i] = La(n, r), o = { ...n, attrsStore: s }, a = r.flatMap((c) => Aa(o, c));
2779
2779
  return [...i, ...a];
2780
2780
  }
2781
- function Rr(n, e) {
2781
+ function Mr(n, e) {
2782
2782
  typeof requestIdleCallback > "u" ? n() : requestIdleCallback(n, { timeout: e });
2783
2783
  }
2784
2784
  const yt = "__meta";
2785
- class Wa {
2785
+ class Na {
2786
2786
  constructor(e, t) {
2787
2787
  }
2788
2788
  }
2789
- class In {
2789
+ class Cn {
2790
2790
  constructor(e) {
2791
2791
  h(this, "currentValue");
2792
2792
  h(this, "_subs", []);
@@ -2979,7 +2979,7 @@ class In {
2979
2979
  gc() {
2980
2980
  this._nextGc || (this._nextGc = setTimeout(
2981
2981
  () => {
2982
- Rr(() => {
2982
+ Mr(() => {
2983
2983
  this._nextGc = null, this._gc();
2984
2984
  }, 30 * 1e3);
2985
2985
  },
@@ -2994,7 +2994,7 @@ class In {
2994
2994
  return;
2995
2995
  }
2996
2996
  this._nextSave = setTimeout(() => {
2997
- Rr(() => {
2997
+ Mr(() => {
2998
2998
  this._nextSave = null, this._writeToStorage(e).then(t).catch(r);
2999
2999
  }, this._idleCallbackMaxWaitMs);
3000
3000
  }, this._saveThrottleMs);
@@ -3026,13 +3026,13 @@ class In {
3026
3026
  };
3027
3027
  }
3028
3028
  }
3029
- const Ka = 6, qa = ["kv", "querySubs", "syncSubs"];
3030
- function za(n) {
3029
+ const Wa = 6, Ka = ["kv", "querySubs", "syncSubs"];
3030
+ function qa(n) {
3031
3031
  return function(t) {
3032
3032
  console.error("Error in IndexedDB event", { source: n, event: t });
3033
3033
  };
3034
3034
  }
3035
- async function Va(n) {
3035
+ async function za(n) {
3036
3036
  return new Promise((e) => {
3037
3037
  const t = indexedDB.open(n);
3038
3038
  t.onerror = (r) => {
@@ -3046,7 +3046,7 @@ async function Va(n) {
3046
3046
  };
3047
3047
  });
3048
3048
  }
3049
- async function Ba(n, e, t) {
3049
+ async function Va(n, e, t) {
3050
3050
  const r = (
3051
3051
  // Backwards compatibility for older versions where we JSON.stringified before storing
3052
3052
  typeof e == "string" ? JSON.parse(e) : e
@@ -3080,14 +3080,14 @@ async function Ba(n, e, t) {
3080
3080
  };
3081
3081
  });
3082
3082
  }
3083
- async function jr(n, e, t) {
3083
+ async function Rr(n, e, t) {
3084
3084
  const r = t.put(e, n);
3085
3085
  return new Promise((s, i) => {
3086
3086
  r.onsuccess = () => s(), r.onerror = (o) => i(o);
3087
3087
  });
3088
3088
  }
3089
- async function Ga(n, e) {
3090
- const t = await Va(`instant_${n}_5`);
3089
+ async function Ba(n, e) {
3090
+ const t = await za(`instant_${n}_5`);
3091
3091
  if (!t)
3092
3092
  return;
3093
3093
  const r = await new Promise((l, f) => {
@@ -3110,12 +3110,12 @@ async function Ga(n, e) {
3110
3110
  for (const [l, f] of r)
3111
3111
  switch (l) {
3112
3112
  case "querySubs": {
3113
- const p = Ba(l, f, o);
3113
+ const p = Va(l, f, o);
3114
3114
  a.push(p);
3115
3115
  break;
3116
3116
  }
3117
3117
  default: {
3118
- const p = jr(l, f, i);
3118
+ const p = Rr(l, f, i);
3119
3119
  a.push(p);
3120
3120
  const y = {
3121
3121
  createdAt: Date.now(),
@@ -3126,13 +3126,13 @@ async function Ga(n, e) {
3126
3126
  break;
3127
3127
  }
3128
3128
  }
3129
- const u = jr(yt, c, i);
3129
+ const u = Rr(yt, c, i);
3130
3130
  a.push(u), await Promise.all(a), await new Promise((l, f) => {
3131
3131
  s.oncomplete = (p) => l(p), s.onerror = (p) => f(p), s.onabort = (p) => f(p);
3132
3132
  });
3133
3133
  }
3134
- const xr = /* @__PURE__ */ new Map();
3135
- class $s extends Wa {
3134
+ const jr = /* @__PURE__ */ new Map();
3135
+ class xs extends Na {
3136
3136
  constructor(t, r) {
3137
3137
  super(t, r);
3138
3138
  h(this, "dbName");
@@ -3140,7 +3140,7 @@ class $s extends Wa {
3140
3140
  h(this, "_appId");
3141
3141
  h(this, "_prefix");
3142
3142
  h(this, "_dbPromise");
3143
- this.dbName = `instant_${t}_${Ka}`, this._storeName = r, this._appId = t, this._dbPromise = this._init();
3143
+ this.dbName = `instant_${t}_${Wa}`, this._storeName = r, this._appId = t, this._dbPromise = this._init();
3144
3144
  }
3145
3145
  _init() {
3146
3146
  return new Promise((t, r) => {
@@ -3151,12 +3151,12 @@ class $s extends Wa {
3151
3151
  }, i.onsuccess = (o) => {
3152
3152
  const c = o.target.result;
3153
3153
  if (s) {
3154
- const u = Ga(this._appId, c).catch((l) => {
3155
- za("Error upgrading store from version 5 to 6.")(l);
3154
+ const u = Ba(this._appId, c).catch((l) => {
3155
+ qa("Error upgrading store from version 5 to 6.")(l);
3156
3156
  });
3157
- xr.set(this.dbName, u), u.then(() => t(c)).catch(() => t(c));
3157
+ jr.set(this.dbName, u), u.then(() => t(c)).catch(() => t(c));
3158
3158
  } else {
3159
- const u = xr.get(this.dbName);
3159
+ const u = jr.get(this.dbName);
3160
3160
  u ? u.then(() => t(c)).catch(() => t(c)) : t(c);
3161
3161
  }
3162
3162
  }, i.onupgradeneeded = (o) => {
@@ -3166,7 +3166,7 @@ class $s extends Wa {
3166
3166
  }
3167
3167
  _upgradeStore(t) {
3168
3168
  const s = t.target.result;
3169
- for (const i of qa)
3169
+ for (const i of Ka)
3170
3170
  s.objectStoreNames.contains(i) || s.createObjectStore(i);
3171
3171
  }
3172
3172
  async getItem(t) {
@@ -3231,7 +3231,7 @@ class $s extends Wa {
3231
3231
  });
3232
3232
  }
3233
3233
  }
3234
- class Ds {
3234
+ class $s {
3235
3235
  static async getIsOnline() {
3236
3236
  return navigator.onLine;
3237
3237
  }
@@ -3277,14 +3277,14 @@ async function ve(n, e) {
3277
3277
  const t = await fetch(n, e), r = await t.json();
3278
3278
  return t.status === 200 ? Promise.resolve(r) : Promise.reject(new Bt({ status: t.status, body: r }));
3279
3279
  }
3280
- function Qa({ apiURI: n, appId: e, email: t }) {
3280
+ function Ga({ apiURI: n, appId: e, email: t }) {
3281
3281
  return ve(`${n}/runtime/auth/send_magic_code`, {
3282
3282
  method: "POST",
3283
3283
  headers: { "content-type": "application/json" },
3284
3284
  body: JSON.stringify({ "app-id": e, email: t })
3285
3285
  });
3286
3286
  }
3287
- async function Ha({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, extraFields: i }) {
3287
+ async function Qa({ apiURI: n, appId: e, email: t, code: r, refreshToken: s }) {
3288
3288
  return await ve(`${n}/runtime/auth/verify_magic_code`, {
3289
3289
  method: "POST",
3290
3290
  headers: { "content-type": "application/json" },
@@ -3292,12 +3292,11 @@ async function Ha({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, ext
3292
3292
  "app-id": e,
3293
3293
  email: t,
3294
3294
  code: r,
3295
- ...s ? { "refresh-token": s } : {},
3296
- ...i ? { "extra-fields": i } : {}
3295
+ ...s ? { "refresh-token": s } : {}
3297
3296
  })
3298
3297
  });
3299
3298
  }
3300
- async function Ja({ apiURI: n, appId: e, refreshToken: t }) {
3299
+ async function Ha({ apiURI: n, appId: e, refreshToken: t }) {
3301
3300
  return await ve(`${n}/runtime/auth/verify_refresh_token`, {
3302
3301
  method: "POST",
3303
3302
  headers: { "content-type": "application/json" },
@@ -3307,7 +3306,7 @@ async function Ja({ apiURI: n, appId: e, refreshToken: t }) {
3307
3306
  })
3308
3307
  });
3309
3308
  }
3310
- async function Ya({ apiURI: n, appId: e }) {
3309
+ async function Ja({ apiURI: n, appId: e }) {
3311
3310
  return await ve(`${n}/runtime/auth/sign_in_guest`, {
3312
3311
  method: "POST",
3313
3312
  headers: { "content-type": "application/json" },
@@ -3316,7 +3315,7 @@ async function Ya({ apiURI: n, appId: e }) {
3316
3315
  })
3317
3316
  });
3318
3317
  }
3319
- async function $r({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken: s, extraFields: i }) {
3318
+ async function xr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken: s }) {
3320
3319
  return await ve(`${n}/runtime/oauth/token`, {
3321
3320
  method: "POST",
3322
3321
  headers: { "content-type": "application/json" },
@@ -3324,12 +3323,11 @@ async function $r({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken:
3324
3323
  app_id: e,
3325
3324
  code: t,
3326
3325
  code_verifier: r,
3327
- refresh_token: s,
3328
- ...i ? { extra_fields: i } : {}
3326
+ refresh_token: s
3329
3327
  })
3330
3328
  });
3331
3329
  }
3332
- async function Za({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, refreshToken: i, extraFields: o }) {
3330
+ async function Ya({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, refreshToken: i }) {
3333
3331
  return await ve(`${n}/runtime/oauth/id_token`, {
3334
3332
  method: "POST",
3335
3333
  headers: { "content-type": "application/json" },
@@ -3338,12 +3336,11 @@ async function Za({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
3338
3336
  nonce: t,
3339
3337
  id_token: r,
3340
3338
  client_name: s,
3341
- refresh_token: i,
3342
- ...o ? { extra_fields: o } : {}
3339
+ refresh_token: i
3343
3340
  })
3344
3341
  });
3345
3342
  }
3346
- async function Xa({ apiURI: n, appId: e, refreshToken: t }) {
3343
+ async function Za({ apiURI: n, appId: e, refreshToken: t }) {
3347
3344
  return await ve(`${n}/runtime/signout`, {
3348
3345
  method: "POST",
3349
3346
  headers: {
@@ -3355,7 +3352,7 @@ async function Xa({ apiURI: n, appId: e, refreshToken: t }) {
3355
3352
  })
3356
3353
  });
3357
3354
  }
3358
- async function ec({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, contentType: i, contentDisposition: o }) {
3355
+ async function Xa({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, contentType: i, contentDisposition: o }) {
3359
3356
  const a = {
3360
3357
  app_id: e,
3361
3358
  path: t,
@@ -3368,7 +3365,7 @@ async function ec({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, cont
3368
3365
  body: r
3369
3366
  });
3370
3367
  }
3371
- async function tc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
3368
+ async function ec({ apiURI: n, appId: e, path: t, refreshToken: r }) {
3372
3369
  const { data: s } = await ve(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
3373
3370
  method: "DELETE",
3374
3371
  headers: {
@@ -3378,7 +3375,7 @@ async function tc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
3378
3375
  });
3379
3376
  return s;
3380
3377
  }
3381
- async function nc({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
3378
+ async function tc({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
3382
3379
  const { data: i } = await ve(`${n}/storage/signed-upload-url`, {
3383
3380
  method: "POST",
3384
3381
  headers: {
@@ -3392,7 +3389,7 @@ async function nc({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata:
3392
3389
  });
3393
3390
  return i;
3394
3391
  }
3395
- async function rc(n, e) {
3392
+ async function nc(n, e) {
3396
3393
  return (await fetch(n, {
3397
3394
  method: "PUT",
3398
3395
  body: e,
@@ -3401,7 +3398,7 @@ async function rc(n, e) {
3401
3398
  }
3402
3399
  })).ok;
3403
3400
  }
3404
- async function sc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
3401
+ async function rc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
3405
3402
  const { data: s } = await ve(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
3406
3403
  method: "GET",
3407
3404
  headers: {
@@ -3411,9 +3408,9 @@ async function sc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
3411
3408
  });
3412
3409
  return s;
3413
3410
  }
3414
- let Xn = !1, Us = !1, Ls = !1;
3415
- typeof window < "u" && typeof window.localStorage < "u" && (Xn = !!window.localStorage.getItem("devBackend"), Us = !!window.localStorage.getItem("__instantLogging"), Ls = !!window.localStorage.getItem("__devtoolLocalDash"));
3416
- function Dr(n, e) {
3411
+ let Zn = !1, Ds = !1, Us = !1;
3412
+ typeof window < "u" && typeof window.localStorage < "u" && (Zn = !!window.localStorage.getItem("devBackend"), Ds = !!window.localStorage.getItem("__instantLogging"), Us = !!window.localStorage.getItem("__devtoolLocalDash"));
3413
+ function $r(n, e) {
3417
3414
  if (!e)
3418
3415
  return n;
3419
3416
  const t = {};
@@ -3421,32 +3418,32 @@ function Dr(n, e) {
3421
3418
  t[r] = n[r];
3422
3419
  }), t;
3423
3420
  }
3424
- function ic(n, e, t) {
3421
+ function sc(n, e, t) {
3425
3422
  const r = {
3426
3423
  peers: {}
3427
3424
  };
3428
3425
  if (e && "user" in e ? e.user : !0) {
3429
- const i = Dr(n.user ?? {}, e == null ? void 0 : e.keys);
3426
+ const i = $r(n.user ?? {}, e == null ? void 0 : e.keys);
3430
3427
  r.user = { ...i, peerId: t };
3431
3428
  }
3432
3429
  for (const i of Object.keys(n.peers ?? {})) {
3433
3430
  const o = (e == null ? void 0 : e.peers) === void 0, a = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(i));
3434
3431
  if (o || a) {
3435
- const c = Dr(n.peers[i], e == null ? void 0 : e.keys);
3432
+ const c = $r(n.peers[i], e == null ? void 0 : e.keys);
3436
3433
  r.peers[i] = { ...c, peerId: i };
3437
3434
  }
3438
3435
  }
3439
3436
  return r;
3440
3437
  }
3441
- function oc(n, e) {
3442
- if (n.isLoading !== e.isLoading || n.error !== e.error || (n.user || e.user) && (!n.user || !e.user || !Tr(n.user, e.user)) || !hs(n.peers, e.peers))
3438
+ function ic(n, e) {
3439
+ if (n.isLoading !== e.isLoading || n.error !== e.error || (n.user || e.user) && (!n.user || !e.user || !wr(n.user, e.user)) || !ds(n.peers, e.peers))
3443
3440
  return !0;
3444
3441
  for (const r of Object.keys(n.peers))
3445
- if (!Tr(n.peers[r], e.peers[r]))
3442
+ if (!wr(n.peers[r], e.peers[r]))
3446
3443
  return !0;
3447
3444
  return !1;
3448
3445
  }
3449
- class Ur {
3446
+ class Dr {
3450
3447
  constructor() {
3451
3448
  h(this, "promise");
3452
3449
  h(this, "_resolve");
@@ -3462,20 +3459,20 @@ class Ur {
3462
3459
  this._reject(e);
3463
3460
  }
3464
3461
  }
3465
- function Fs(n, e = []) {
3462
+ function Ls(n, e = []) {
3466
3463
  n.forEach((t) => {
3467
3464
  const { data: r } = t, { "datalog-result": s } = r, { "join-rows": i } = s;
3468
3465
  for (const o of i)
3469
3466
  for (const a of o)
3470
3467
  e.push(a);
3471
- Fs(t["child-nodes"], e);
3468
+ Ls(t["child-nodes"], e);
3472
3469
  });
3473
3470
  }
3474
- function Lr(n) {
3471
+ function Ur(n) {
3475
3472
  const e = [];
3476
- return Fs(n, e), e;
3473
+ return Ls(n, e), e;
3477
3474
  }
3478
- function Fr(n) {
3475
+ function Lr(n) {
3479
3476
  return Object.values(n.links).reduce((e, t) => {
3480
3477
  var r, s;
3481
3478
  return e[r = t.forward.on] ?? (e[r] = {}), e[t.forward.on][t.forward.label] = {
@@ -3489,8 +3486,8 @@ function Fr(n) {
3489
3486
  }, e;
3490
3487
  }, {});
3491
3488
  }
3492
- const er = "v0.22.157-branch-extra-fields.23026294545.1";
3493
- function ac(n, e) {
3489
+ const Xn = "v0.22.157-branch-cli-link-required.23069467657.1";
3490
+ function oc(n, e) {
3494
3491
  return {
3495
3492
  info: n ? (...t) => console.info(...t, e()) : () => {
3496
3493
  },
@@ -3579,7 +3576,7 @@ class L extends Error {
3579
3576
  super(r), this.name = "QueryValidationError";
3580
3577
  }
3581
3578
  }
3582
- const Nr = [
3579
+ const Fr = [
3583
3580
  "where",
3584
3581
  "order",
3585
3582
  "limit",
@@ -3590,7 +3587,7 @@ const Nr = [
3590
3587
  "before",
3591
3588
  "fields",
3592
3589
  "aggregate"
3593
- ], cc = (n) => n.valueType || "unknown", Ns = (n, e, t = !1) => {
3590
+ ], ac = (n) => n.valueType || "unknown", Fs = (n, e, t = !1) => {
3594
3591
  if (t || n == null)
3595
3592
  return !0;
3596
3593
  switch (e) {
@@ -3605,9 +3602,9 @@ const Nr = [
3605
3602
  default:
3606
3603
  return !0;
3607
3604
  }
3608
- }, uc = (n, e, t, r, s, i, o) => {
3605
+ }, cc = (n, e, t, r, s, i, o) => {
3609
3606
  const a = i.valueType === "json", c = (u, l, f) => {
3610
- if (!Ns(f, l, a))
3607
+ if (!Fs(f, l, a))
3611
3608
  throw new L(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`, o);
3612
3609
  };
3613
3610
  switch (n) {
@@ -3638,16 +3635,16 @@ const Nr = [
3638
3635
  throw new L(`Unknown operator '${n}' for attribute '${r}' in entity '${s}'`, o);
3639
3636
  }
3640
3637
  }, Ye = (n, e, t, r, s) => {
3641
- const i = cc(t), o = t.valueType === "json";
3638
+ const i = ac(t), o = t.valueType === "json";
3642
3639
  if (typeof n == "object" && n !== null && !Array.isArray(n)) {
3643
3640
  if (o)
3644
3641
  return;
3645
3642
  const c = n;
3646
3643
  for (const [u, l] of Object.entries(c))
3647
- uc(u, l, i, e, r, t, `${s}.${u}`);
3648
- } else if (!Ns(n, i, o))
3644
+ cc(u, l, i, e, r, t, `${s}.${u}`);
3645
+ } else if (!Fs(n, i, o))
3649
3646
  throw new L(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof n}`, s);
3650
- }, lc = (n, e, t, r, s) => {
3647
+ }, uc = (n, e, t, r, s) => {
3651
3648
  const i = n.split(".");
3652
3649
  if (i.length < 2)
3653
3650
  throw new L(`Invalid dot notation path '${n}'. Must contain at least one dot.`, s);
@@ -3684,12 +3681,12 @@ const Nr = [
3684
3681
  throw new L(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${n}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
3685
3682
  }
3686
3683
  Ye(e, n, u, t, s);
3687
- }, Ws = (n, e, t, r) => {
3684
+ }, Ns = (n, e, t, r) => {
3688
3685
  for (const [s, i] of Object.entries(n)) {
3689
3686
  if (s === "or" || s === "and") {
3690
3687
  if (Array.isArray(i))
3691
3688
  for (const u of i)
3692
- typeof u == "object" && u !== null && Ws(u, e, t, `${r}.${s}[${u}]`);
3689
+ typeof u == "object" && u !== null && Ns(u, e, t, `${r}.${s}[${u}]`);
3693
3690
  continue;
3694
3691
  }
3695
3692
  if (s === "id") {
@@ -3697,7 +3694,7 @@ const Nr = [
3697
3694
  continue;
3698
3695
  }
3699
3696
  if (s.includes(".")) {
3700
- lc(s, i, e, t, `${r}.${s}`);
3697
+ uc(s, i, e, t, `${r}.${s}`);
3701
3698
  continue;
3702
3699
  }
3703
3700
  const o = t.entities[e];
@@ -3717,10 +3714,10 @@ const Nr = [
3717
3714
  Ye(i, s, u, e, `${r}.${s}`);
3718
3715
  }
3719
3716
  }
3720
- }, fc = (n, e, t, r, s = 0) => {
3717
+ }, lc = (n, e, t, r, s = 0) => {
3721
3718
  for (const o of Object.keys(n))
3722
- if (!Nr.includes(o))
3723
- throw new L(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Nr.join(", ")}. Found: ${o}`, r);
3719
+ if (!Fr.includes(o))
3720
+ throw new L(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Fr.join(", ")}. Found: ${o}`, r);
3724
3721
  const i = [
3725
3722
  // 'limit', // only supported client side
3726
3723
  "offset",
@@ -3735,9 +3732,9 @@ const Nr = [
3735
3732
  if (n.where && t) {
3736
3733
  if (typeof n.where != "object" || n.where === null)
3737
3734
  throw new L(`'where' clause must be an object in entity '${e}', but received: ${typeof n.where}`, r ? `${r}.where` : void 0);
3738
- Ws(n.where, e, t, r ? `${r}.where` : "where");
3735
+ Ns(n.where, e, t, r ? `${r}.where` : "where");
3739
3736
  }
3740
- }, Ks = (n, e, t, r, s = 0) => {
3737
+ }, Ws = (n, e, t, r, s = 0) => {
3741
3738
  var i;
3742
3739
  if (!n || typeof n != "object")
3743
3740
  throw new L(`Query part for entity '${e}' must be an object, but received: ${typeof n}`, r);
@@ -3750,15 +3747,15 @@ const Nr = [
3750
3747
  const a = n[o];
3751
3748
  if (typeof a == "object" && a !== null) {
3752
3749
  const c = (i = t == null ? void 0 : t.entities[e].links[o]) == null ? void 0 : i.entityName;
3753
- c && Ks(a, c, t, `${r}.${o}`, s + 1);
3750
+ c && Ws(a, c, t, `${r}.${o}`, s + 1);
3754
3751
  }
3755
3752
  } else {
3756
3753
  const a = n[o];
3757
3754
  if (typeof a != "object" || a === null)
3758
3755
  throw new L(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
3759
- fc(a, e, t, `${r}.$`, s);
3756
+ lc(a, e, t, `${r}.$`, s);
3760
3757
  }
3761
- }, Wr = (n, e) => {
3758
+ }, Nr = (n, e) => {
3762
3759
  if (typeof n != "object" || n === null)
3763
3760
  throw new L(`Query must be an object, but received: ${typeof n}${n === null ? " (null)" : ""}`);
3764
3761
  if (Array.isArray(n))
@@ -3774,67 +3771,67 @@ const Nr = [
3774
3771
  const s = Object.keys(e.entities);
3775
3772
  throw new L(`Entity '${r}' does not exist in schema. Available entities: ${s.length > 0 ? s.join(", ") : "none"}`, r);
3776
3773
  }
3777
- Ks(t[r], r, e, r, 0);
3774
+ Ws(t[r], r, e, r, 0);
3778
3775
  }
3779
3776
  }
3780
- }, Kr = (n) => typeof n != "string" ? !1 : Kt(n) ? !0 : et(n);
3777
+ }, Wr = (n) => typeof n != "string" ? !1 : Kt(n) ? !0 : et(n);
3781
3778
  class ge extends Error {
3782
3779
  constructor(e) {
3783
3780
  super(e), this.name = "TransactionValidationError";
3784
3781
  }
3785
3782
  }
3786
- const qs = (n) => n.length > 0 ? n.join(", ") : "none", dc = (n, e) => new ge(`Entity '${n}' does not exist in schema. Available entities: ${qs(e)}`), on = {
3783
+ const Ks = (n) => n.length > 0 ? n.join(", ") : "none", fc = (n, e) => new ge(`Entity '${n}' does not exist in schema. Available entities: ${Ks(e)}`), on = {
3787
3784
  string: (n) => typeof n == "string",
3788
3785
  number: (n) => typeof n == "number" && !isNaN(n),
3789
3786
  boolean: (n) => typeof n == "boolean",
3790
3787
  date: (n) => n instanceof Date || typeof n == "string" || typeof n == "number",
3791
3788
  json: () => !0
3792
- }, hc = (n, e) => {
3789
+ }, dc = (n, e) => {
3793
3790
  var t;
3794
3791
  return n == null ? !0 : ((t = on[e.valueType]) == null ? void 0 : t.call(on, n)) ?? !1;
3795
- }, zs = (n, e) => {
3792
+ }, qs = (n, e) => {
3796
3793
  const t = e.entities[n];
3797
3794
  if (!t)
3798
- throw dc(n, Object.keys(e.entities));
3795
+ throw fc(n, Object.keys(e.entities));
3799
3796
  return t;
3800
3797
  }, an = (n, e, t) => {
3801
- const r = zs(n, t);
3798
+ const r = qs(n, t);
3802
3799
  if (typeof e != "object" || e === null)
3803
3800
  throw new ge(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
3804
3801
  for (const [s, i] of Object.entries(e)) {
3805
3802
  if (s === "id")
3806
3803
  continue;
3807
3804
  const o = r.attrs[s];
3808
- if (o && !hc(i, o))
3805
+ if (o && !dc(i, o))
3809
3806
  throw new ge(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
3810
3807
  }
3811
- }, qr = (n, e, t) => {
3812
- const r = zs(n, t);
3808
+ }, Kr = (n, e, t) => {
3809
+ const r = qs(n, t);
3813
3810
  if (typeof e != "object" || e === null)
3814
3811
  throw new ge(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
3815
3812
  for (const [s, i] of Object.entries(e)) {
3816
3813
  if (!r.links[s]) {
3817
3814
  const a = Object.keys(r.links);
3818
- throw new ge(`Link '${s}' does not exist on entity '${n}'. Available links: ${qs(a)}`);
3815
+ throw new ge(`Link '${s}' does not exist on entity '${n}'. Available links: ${Ks(a)}`);
3819
3816
  }
3820
3817
  if (i != null) {
3821
3818
  if (Array.isArray(i)) {
3822
3819
  for (const a of i)
3823
- if (!Kr(a))
3820
+ if (!Wr(a))
3824
3821
  throw new ge(`Invalid entity ID in link '${s}' for entity '${n}'. Expected a UUID or a lookup, but received: ${a}`);
3825
- } else if (!Kr(i))
3822
+ } else if (!Wr(i))
3826
3823
  throw new ge(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
3827
3824
  }
3828
3825
  }
3829
- }, pc = {
3826
+ }, hc = {
3830
3827
  create: an,
3831
3828
  update: an,
3832
3829
  merge: an,
3833
- link: qr,
3834
- unlink: qr,
3830
+ link: Kr,
3831
+ unlink: Kr,
3835
3832
  delete: () => {
3836
3833
  }
3837
- }, yc = (n, e) => {
3834
+ }, pc = (n, e) => {
3838
3835
  if (!e)
3839
3836
  return;
3840
3837
  const [t, r, s, i] = n;
@@ -3842,9 +3839,9 @@ const qs = (n) => n.length > 0 ? n.join(", ") : "none", dc = (n, e) => new ge(`E
3842
3839
  throw new ge(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
3843
3840
  if (typeof r != "string")
3844
3841
  throw new ge(`Entity name must be a string, but received: ${typeof r}`);
3845
- const o = pc[t];
3842
+ const o = hc[t];
3846
3843
  o && i !== void 0 && o(r, i, e);
3847
- }, bc = (n, e) => {
3844
+ }, yc = (n, e) => {
3848
3845
  const t = Array.isArray(n) ? n : [n];
3849
3846
  for (const r of t) {
3850
3847
  if (!r || typeof r != "object")
@@ -3854,12 +3851,12 @@ const qs = (n) => n.length > 0 ? n.join(", ") : "none", dc = (n, e) => new ge(`E
3854
3851
  for (const s of r.__ops) {
3855
3852
  if (!Array.isArray(s))
3856
3853
  throw new ge(`Transaction operation must be an array, but received: ${typeof s}`);
3857
- yc(s, e);
3854
+ pc(s, e);
3858
3855
  }
3859
3856
  }
3860
3857
  };
3861
- let Vs = 0;
3862
- class zr {
3858
+ let zs = 0;
3859
+ class qr {
3863
3860
  constructor(e) {
3864
3861
  h(this, "type", "ws");
3865
3862
  h(this, "conn");
@@ -3868,7 +3865,7 @@ class zr {
3868
3865
  h(this, "onmessage");
3869
3866
  h(this, "onclose");
3870
3867
  h(this, "onerror");
3871
- this.id = `${this.type}_${Vs++}`, this.conn = new WebSocket(e), this.conn.onopen = (t) => {
3868
+ this.id = `${this.type}_${zs++}`, this.conn = new WebSocket(e), this.conn.onopen = (t) => {
3872
3869
  this.onopen && this.onopen({ target: this });
3873
3870
  }, this.conn.onmessage = (t) => {
3874
3871
  this.onmessage && this.onmessage({
@@ -3894,7 +3891,7 @@ class zr {
3894
3891
  return this.conn.send(JSON.stringify(e));
3895
3892
  }
3896
3893
  }
3897
- class gc {
3894
+ class bc {
3898
3895
  constructor(e, t, r) {
3899
3896
  h(this, "type", "sse");
3900
3897
  h(this, "initParams", null);
@@ -3911,7 +3908,7 @@ class gc {
3911
3908
  h(this, "onmessage");
3912
3909
  h(this, "onclose");
3913
3910
  h(this, "onerror");
3914
- this.id = `${this.type}_${Vs++}`, this.url = t, this.messageUrl = r || this.url, this.ES = e, this.conn = new e(t), this.sseInitTimeout = setTimeout(() => {
3911
+ this.id = `${this.type}_${zs++}`, this.url = t, this.messageUrl = r || this.url, this.ES = e, this.conn = new e(t), this.sseInitTimeout = setTimeout(() => {
3915
3912
  this.initParams || this.handleError();
3916
3913
  }, 1e4), this.conn.onmessage = (s) => {
3917
3914
  const i = JSON.parse(s.data);
@@ -3991,24 +3988,24 @@ class gc {
3991
3988
  this.handleClose();
3992
3989
  }
3993
3990
  }
3994
- function _c(n, e) {
3991
+ function gc(n, e) {
3995
3992
  const t = n.values;
3996
3993
  if (t) {
3997
- const r = ms(t.attrsStore, null);
3994
+ const r = _s(t.attrsStore, null);
3998
3995
  if (r) {
3999
3996
  for (const s of t.entities || [])
4000
- s.store.useDateObjects = e, s.store = _s(r, s.store);
3997
+ s.store.useDateObjects = e, s.store = gs(r, s.store);
4001
3998
  t.attrsStore = r;
4002
3999
  }
4003
4000
  }
4004
4001
  return n;
4005
4002
  }
4006
- function mc(n, e) {
4003
+ function _c(n, e) {
4007
4004
  var t;
4008
4005
  if (e.values) {
4009
4006
  const r = [];
4010
4007
  for (const s of (t = e.values) == null ? void 0 : t.entities) {
4011
- const i = gs(s.store);
4008
+ const i = bs(s.store);
4012
4009
  r.push({ ...s, store: i });
4013
4010
  }
4014
4011
  return {
@@ -4018,15 +4015,15 @@ function mc(n, e) {
4018
4015
  } else
4019
4016
  return e;
4020
4017
  }
4021
- function wc(n, e, t) {
4018
+ function mc(n, e, t) {
4022
4019
  var i, o;
4023
4020
  const r = (i = e == null ? void 0 : e.state) == null ? void 0 : i.txId, s = (o = t == null ? void 0 : t.state) == null ? void 0 : o.txId;
4024
4021
  return r && (!s || r > s) ? e : s && (!r || s > r) ? t : e || t;
4025
4022
  }
4026
4023
  function cn(n, e, t) {
4027
- return Rs({ store: e, attrsStore: t, pageInfo: null, aggregate: null }, n.query).data[n.table][0];
4024
+ return Ms({ store: e, attrsStore: t, pageInfo: null, aggregate: null }, n.query).data[n.table][0];
4028
4025
  }
4029
- function Vr(n, e, t, r) {
4026
+ function zr(n, e, t, r) {
4030
4027
  var o;
4031
4028
  const s = (o = V(t, n.table, "id")) == null ? void 0 : o.id;
4032
4029
  if (!s)
@@ -4034,18 +4031,18 @@ function Vr(n, e, t, r) {
4034
4031
  const i = nt(e.eav, [r, s, r]);
4035
4032
  return i ? i[3] : -1;
4036
4033
  }
4037
- function Br(n, e, t) {
4034
+ function Vr(n, e, t) {
4038
4035
  for (const { action: r, triple: s } of t)
4039
4036
  switch (r) {
4040
4037
  case "added":
4041
- Ss(n, e, s);
4038
+ Ts(n, e, s);
4042
4039
  break;
4043
4040
  case "removed":
4044
- ws(n, e, s);
4041
+ ms(n, e, s);
4045
4042
  break;
4046
4043
  }
4047
4044
  }
4048
- function Tc(n, e, t) {
4045
+ function wc(n, e, t) {
4049
4046
  var s, i;
4050
4047
  const r = {};
4051
4048
  for (const { action: o, triple: a } of t) {
@@ -4073,14 +4070,14 @@ function Tc(n, e, t) {
4073
4070
  function Ct(n, e) {
4074
4071
  return { [n.table]: e.map((t) => t.entity) };
4075
4072
  }
4076
- function Sc(n, e) {
4073
+ function Tc(n, e) {
4077
4074
  var r;
4078
4075
  if (n.orderFieldType)
4079
4076
  return n.orderFieldType;
4080
4077
  const t = n.orderField === "serverCreatedAt" ? "number" : (r = V(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
4081
4078
  return n.orderFieldType = t, t;
4082
4079
  }
4083
- function vc(n, e, t) {
4080
+ function Sc(n, e, t) {
4084
4081
  const r = e;
4085
4082
  if (n.orderField === "serverCreatedAt") {
4086
4083
  t.sort(n.orderDirection === "asc" ? function(o, a) {
@@ -4101,7 +4098,7 @@ var xe;
4101
4098
  (function(n) {
4102
4099
  n.InitialSyncBatch = "InitialSyncBatch", n.InitialSyncComplete = "InitialSyncComplete", n.LoadFromStorage = "LoadFromStorage", n.SyncTransaction = "SyncTransaction", n.Error = "Error";
4103
4100
  })(xe || (xe = {}));
4104
- class Ec {
4101
+ class vc {
4105
4102
  constructor(e, t, r, s, i, o) {
4106
4103
  h(this, "trySend");
4107
4104
  h(this, "subs");
@@ -4112,11 +4109,11 @@ class Ec {
4112
4109
  h(this, "log");
4113
4110
  h(this, "createStore");
4114
4111
  h(this, "getAttrs");
4115
- this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new In({
4112
+ this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new Cn({
4116
4113
  persister: t,
4117
- merge: wc,
4118
- serialize: mc,
4119
- parse: (a, c) => _c(c, this.config.useDateObjects),
4114
+ merge: mc,
4115
+ serialize: _c,
4116
+ parse: (a, c) => gc(c, this.config.useDateObjects),
4120
4117
  objectSize: (a) => {
4121
4118
  var c;
4122
4119
  return ((c = a.values) == null ? void 0 : c.entities.length) || 0;
@@ -4241,7 +4238,7 @@ class Ec {
4241
4238
  c.push({
4242
4239
  store: l,
4243
4240
  entity: f,
4244
- serverCreatedAt: Vr(o, l, a.attrsStore, f.id)
4241
+ serverCreatedAt: zr(o, l, a.attrsStore, f.id)
4245
4242
  }), i.push(f);
4246
4243
  }
4247
4244
  this.subs.updateInPlace((u) => {
@@ -4311,9 +4308,9 @@ class Ec {
4311
4308
  e: for (const [m, S] of Object.entries(u))
4312
4309
  for (let g = 0; g < f.length; g++) {
4313
4310
  const w = f[g];
4314
- if (no(w.store, m)) {
4315
- Br(w.store, l.attrsStore, S);
4316
- const O = cn(s, w.store, l.attrsStore), v = Tc(w.store, l.attrsStore, S)[m];
4311
+ if (to(w.store, m)) {
4312
+ Vr(w.store, l.attrsStore, S);
4313
+ const O = cn(s, w.store, l.attrsStore), v = wc(w.store, l.attrsStore, S)[m];
4317
4314
  O ? (p.push({
4318
4315
  oldEntity: w.entity,
4319
4316
  newEntity: O,
@@ -4325,7 +4322,7 @@ class Ec {
4325
4322
  const y = [];
4326
4323
  for (const [m, S] of Object.entries(u)) {
4327
4324
  const g = this.createStore([]);
4328
- Br(g, l.attrsStore, S);
4325
+ Vr(g, l.attrsStore, S);
4329
4326
  const w = cn(s, g, l.attrsStore);
4330
4327
  if (!w) {
4331
4328
  this.log.error("No entity found after applying change", {
@@ -4338,14 +4335,14 @@ class Ec {
4338
4335
  f.push({
4339
4336
  store: g,
4340
4337
  entity: w,
4341
- serverCreatedAt: Vr(s, g, l.attrsStore, w.id)
4338
+ serverCreatedAt: zr(s, g, l.attrsStore, w.id)
4342
4339
  }), y.push(w);
4343
4340
  }
4344
4341
  const b = [];
4345
4342
  for (const m of c.sort().reverse())
4346
4343
  b.push(f[m].entity), f.splice(m, 1);
4347
- const _ = Sc(s, this.getAttrs);
4348
- vc(s, _, f), this.notifyCbs(r, {
4344
+ const _ = Tc(s, this.getAttrs);
4345
+ Sc(s, _, f), this.notifyCbs(r, {
4349
4346
  type: xe.SyncTransaction,
4350
4347
  data: Ct(s, (o = s.values) == null ? void 0 : o.entities),
4351
4348
  added: y,
@@ -4386,7 +4383,7 @@ class Ec {
4386
4383
  r && this.initSubscription(r.query, r.hash);
4387
4384
  }
4388
4385
  }
4389
- function Oc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStream: s }) {
4386
+ function Ec({ WStream: n, opts: e, startStream: t, appendStream: r, registerStream: s }) {
4390
4387
  const i = e.clientId;
4391
4388
  let o = null, a = null, c = null;
4392
4389
  const u = N();
@@ -4585,7 +4582,7 @@ function Oc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
4585
4582
  }
4586
4583
  };
4587
4584
  }
4588
- class kc {
4585
+ class Oc {
4589
4586
  constructor() {
4590
4587
  h(this, "items", []);
4591
4588
  h(this, "resolvers", []);
@@ -4619,7 +4616,7 @@ class kc {
4619
4616
  }
4620
4617
  }
4621
4618
  }
4622
- function Ac({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
4619
+ function kc({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
4623
4620
  let s = e.byteOffset || 0, i = !1;
4624
4621
  const o = new TextDecoder("utf-8"), a = new TextEncoder();
4625
4622
  let c, u = !1;
@@ -4745,7 +4742,7 @@ function Ac({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
4745
4742
  }
4746
4743
  };
4747
4744
  }
4748
- class Cc {
4745
+ class Ac {
4749
4746
  constructor({ WStream: e, RStream: t, trySend: r, log: s }) {
4750
4747
  h(this, "trySend");
4751
4748
  h(this, "WStream");
@@ -4758,7 +4755,7 @@ class Cc {
4758
4755
  this.WStream = e, this.RStream = t, this.trySend = r, this.log = s;
4759
4756
  }
4760
4757
  createWriteStream(e) {
4761
- const { stream: t, addCompleteCb: r } = Oc({
4758
+ const { stream: t, addCompleteCb: r } = Ec({
4762
4759
  WStream: this.WStream,
4763
4760
  startStream: this.startWriteStream.bind(this),
4764
4761
  appendStream: this.appendStream.bind(this),
@@ -4770,7 +4767,7 @@ class Cc {
4770
4767
  }), t;
4771
4768
  }
4772
4769
  createReadStream(e) {
4773
- const { stream: t, addCloseCb: r } = Ac({
4770
+ const { stream: t, addCloseCb: r } = kc({
4774
4771
  RStream: this.RStream,
4775
4772
  opts: e,
4776
4773
  startStream: this.startReadStream.bind(this),
@@ -4832,7 +4829,7 @@ class Cc {
4832
4829
  if (!r && !t)
4833
4830
  throw new Error("Must provide one of streamId or clientId to subscribe to the stream.");
4834
4831
  r && (o["stream-id"] = r), t && (o["client-id"] = t), s && (o.offset = s), i && (o["rule-params"] = i);
4835
- const a = new kc();
4832
+ const a = new Oc();
4836
4833
  return this.readStreamIterators[e] = a, this.trySend(e, o), a;
4837
4834
  }
4838
4835
  cancelReadStream({ eventId: e }) {
@@ -4913,39 +4910,39 @@ const Ee = {
4913
4910
  AUTHENTICATED: "authenticated",
4914
4911
  CLOSED: "closed",
4915
4912
  ERRORED: "errored"
4916
- }, Ic = 3e4, Pc = 3e4, Mc = 200, Rc = 1e3 * 60, jc = {
4913
+ }, Cc = 3e4, Ic = 3e4, Pc = 200, Mc = 1e3 * 60, Rc = {
4917
4914
  apiURI: "https://api.instantdb.com",
4918
4915
  websocketURI: "wss://api.instantdb.com/runtime/session"
4919
- }, un = "_instant_oauth_redirect", ln = "oauthExtraFields", Ve = "currentUser";
4920
- function xc({ transportType: n, appId: e, apiURI: t, wsURI: r, EventSourceImpl: s }) {
4916
+ }, un = "_instant_oauth_redirect", Ve = "currentUser";
4917
+ function jc({ transportType: n, appId: e, apiURI: t, wsURI: r, EventSourceImpl: s }) {
4921
4918
  if (!s)
4922
- return new zr(`${r}?app_id=${e}`);
4919
+ return new qr(`${r}?app_id=${e}`);
4923
4920
  switch (n) {
4924
4921
  case "ws":
4925
- return new zr(`${r}?app_id=${e}`);
4922
+ return new qr(`${r}?app_id=${e}`);
4926
4923
  case "sse":
4927
- return new gc(s, `${t}/runtime/sse?app_id=${e}`);
4924
+ return new bc(s, `${t}/runtime/sse?app_id=${e}`);
4928
4925
  default:
4929
4926
  throw new Error("Unknown transport type " + n);
4930
4927
  }
4931
4928
  }
4932
- function $c() {
4929
+ function xc() {
4933
4930
  return typeof window < "u" || typeof chrome < "u";
4934
4931
  }
4935
- const Gr = {
4932
+ const Br = {
4936
4933
  "set-presence": !0,
4937
4934
  "set-presence-ok": !0,
4938
4935
  "refresh-presence": !0,
4939
4936
  "patch-presence": !0
4940
4937
  };
4941
- function Dc(n, e) {
4938
+ function $c(n, e) {
4942
4939
  var r;
4943
4940
  const t = typeof n == "string" ? JSON.parse(n) : n;
4944
4941
  if ((r = t == null ? void 0 : t.result) != null && r.store) {
4945
- const s = ms(t.result.attrsStore, t.result.store);
4942
+ const s = _s(t.result.attrsStore, t.result.store);
4946
4943
  if (s) {
4947
4944
  const i = t.result.store;
4948
- t.result.store = _s(s, {
4945
+ t.result.store = gs(s, {
4949
4946
  ...i,
4950
4947
  useDateObjects: e
4951
4948
  }), t.result.attrsStore = s;
@@ -4953,7 +4950,7 @@ function Dc(n, e) {
4953
4950
  }
4954
4951
  return t;
4955
4952
  }
4956
- function Uc(n, e) {
4953
+ function Dc(n, e) {
4957
4954
  const { result: t, ...r } = e, s = (
4958
4955
  /** @type {import('./reactorTypes.ts').QuerySubInStorage} */
4959
4956
  r
@@ -4961,14 +4958,14 @@ function Uc(n, e) {
4961
4958
  if (t) {
4962
4959
  const i = {
4963
4960
  ...t,
4964
- store: gs(t.store),
4961
+ store: bs(t.store),
4965
4962
  attrsStore: t.attrsStore.toJSON()
4966
4963
  };
4967
4964
  s.result = i;
4968
4965
  }
4969
4966
  return s;
4970
4967
  }
4971
- function Lc(n, e) {
4968
+ function Uc(n, e) {
4972
4969
  switch (n) {
4973
4970
  case "pendingMutations":
4974
4971
  return new Map(typeof e == "string" ? JSON.parse(e) : e);
@@ -4976,7 +4973,7 @@ function Lc(n, e) {
4976
4973
  return e;
4977
4974
  }
4978
4975
  }
4979
- function Fc(n, e) {
4976
+ function Lc(n, e) {
4980
4977
  switch (n) {
4981
4978
  case "pendingMutations":
4982
4979
  return [...e.entries()];
@@ -4984,18 +4981,18 @@ function Fc(n, e) {
4984
4981
  return e;
4985
4982
  }
4986
4983
  }
4987
- function Nc(n, e, t) {
4984
+ function Fc(n, e, t) {
4988
4985
  const r = e == null ? void 0 : e.result, s = t == null ? void 0 : t.result;
4989
4986
  return r && !s && t && (t.result = r), t || e;
4990
4987
  }
4991
- function fn(n) {
4988
+ function ln(n) {
4992
4989
  return [...n].sort((e, t) => {
4993
4990
  const [r, s] = e, [i, o] = t, a = s.order || 0, c = o.order || 0;
4994
4991
  return a == c ? r < i ? -1 : r > i ? 1 : 0 : a - c;
4995
4992
  });
4996
4993
  }
4997
- class Wc {
4998
- constructor(e, t = $s, r = Ds, s, i) {
4994
+ class Nc {
4995
+ constructor(e, t = xs, r = $s, s, i) {
4999
4996
  /** @type {s.AttrsStore | undefined} */
5000
4997
  h(this, "attrs");
5001
4998
  h(this, "_isOnline", !0);
@@ -5093,9 +5090,9 @@ class Wc {
5093
5090
  });
5094
5091
  /** Applies transactions locally and sends transact message to server */
5095
5092
  h(this, "pushTx", (e) => {
5096
- this.config.disableValidation || bc(e, this.config.schema);
5093
+ this.config.disableValidation || yc(e, this.config.schema);
5097
5094
  try {
5098
- const t = Na({
5095
+ const t = Fa({
5099
5096
  attrsStore: this.optimisticAttrs(),
5100
5097
  schema: this.config.schema,
5101
5098
  stores: Object.values(this.querySubs.currentValue).map((r) => {
@@ -5125,7 +5122,7 @@ class Wc {
5125
5122
  this._updatePendingMutations((c) => {
5126
5123
  c.set(r, o);
5127
5124
  });
5128
- const a = new Ur();
5125
+ const a = new Dr();
5129
5126
  return this.mutationDeferredStore.set(r, a), this._sendMutation(r, o), this.notifyAll(), a.promise;
5130
5127
  });
5131
5128
  h(this, "_transportOnOpen", (e) => {
@@ -5196,7 +5193,7 @@ class Wc {
5196
5193
  }
5197
5194
  this._log.info("[socket][close]", t.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
5198
5195
  });
5199
- if (this._EventSource = i, this.config = { ...jc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Pc, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Mc, this._log = ac(e.verbose || Xn || Us, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": er }, this.config.schema && (this._linkIndex = Fr(this.config.schema)), !!$c()) {
5196
+ if (this._EventSource = i, this.config = { ...Rc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Ic, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Pc, this._log = oc(e.verbose || Zn || Ds, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": Xn }, this.config.schema && (this._linkIndex = Lr(this.config.schema)), !!xc()) {
5200
5197
  if (!e.appId)
5201
5198
  throw new Error("Instant must be initialized with an appId.");
5202
5199
  if (!et(e.appId))
@@ -5215,9 +5212,9 @@ class Wc {
5215
5212
  } catch (c) {
5216
5213
  this._log.error("[error] handle broadcast channel", c);
5217
5214
  }
5218
- })), this._initStorage(t), this._syncTable = new Ec(this._trySendAuthed.bind(this), new t(this.config.appId, "syncSubs"), {
5215
+ })), this._initStorage(t), this._syncTable = new vc(this._trySendAuthed.bind(this), new t(this.config.appId, "syncSubs"), {
5219
5216
  useDateObjects: this.config.useDateObjects
5220
- }, this._log, (o) => ut(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new Cc({
5217
+ }, this._log, (o) => ut(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new Ac({
5221
5218
  WStream: this.config.WritableStream || WritableStream,
5222
5219
  RStream: this.config.ReadableStream || ReadableStream,
5223
5220
  trySend: this._trySendAuthed.bind(this),
@@ -5227,7 +5224,7 @@ class Wc {
5227
5224
  }), setInterval(async () => {
5228
5225
  const o = await this.getCurrentUser();
5229
5226
  this.syncUserToEndpoint(o.user);
5230
- }, Rc), r.getIsOnline().then((o) => {
5227
+ }, Mc), r.getIsOnline().then((o) => {
5231
5228
  this._isOnline = o, this._startSocket(), r.listen((a) => {
5232
5229
  a !== this._isOnline && (this._log.info("[network] online =", a), this._isOnline = a, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", Ee.CLOSED), this._setStatus(Ee.CLOSED)));
5233
5230
  });
@@ -5251,7 +5248,7 @@ class Wc {
5251
5248
  ...this.config,
5252
5249
  schema: e,
5253
5250
  cardinalityInference: !!e
5254
- }, this._linkIndex = e ? Fr(this.config.schema) : null;
5251
+ }, this._linkIndex = e ? Lr(this.config.schema) : null;
5255
5252
  }
5256
5253
  _reactorStats() {
5257
5254
  return {
@@ -5264,11 +5261,11 @@ class Wc {
5264
5261
  this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
5265
5262
  }
5266
5263
  _initStorage(e) {
5267
- this.querySubs = new In({
5264
+ this.querySubs = new Cn({
5268
5265
  persister: new e(this.config.appId, "querySubs"),
5269
- merge: Nc,
5270
- serialize: Uc,
5271
- parse: (t, r) => Dc(r, this.config.useDateObjects),
5266
+ merge: Fc,
5267
+ serialize: Dc,
5268
+ parse: (t, r) => $c(r, this.config.useDateObjects),
5272
5269
  // objectSize
5273
5270
  objectSize: (t) => {
5274
5271
  var r, s, i;
@@ -5284,11 +5281,11 @@ class Wc {
5284
5281
  maxSize: 1e6
5285
5282
  // 1 million triples
5286
5283
  }
5287
- }), this.querySubs.onKeyLoaded = (t) => this._onQuerySubLoaded(t), this.kv = new In({
5284
+ }), this.querySubs.onKeyLoaded = (t) => this._onQuerySubLoaded(t), this.kv = new Cn({
5288
5285
  persister: new e(this.config.appId, "kv"),
5289
5286
  merge: this._onMergeKv,
5290
- serialize: Fc,
5291
- parse: Lc,
5287
+ serialize: Lc,
5288
+ parse: Uc,
5292
5289
  objectSize: () => 0,
5293
5290
  logger: this._log,
5294
5291
  saveThrottleMs: 100,
@@ -5367,7 +5364,7 @@ class Wc {
5367
5364
  _handleReceive(e, t) {
5368
5365
  var s, i, o, a, c, u, l;
5369
5366
  const r = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
5370
- switch (Gr[t.op] || this._log.info("[receive]", e, t.op, t), t.op) {
5367
+ switch (Br[t.op] || this._log.info("[receive]", e, t.op, t), t.op) {
5371
5368
  case "init-ok": {
5372
5369
  this._setStatus(Ee.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(t.attrs), this._flushPendingMessages(), this._sessionId = t["session-id"];
5373
5370
  for (const y of Object.keys(this._rooms)) {
@@ -5384,7 +5381,7 @@ class Wc {
5384
5381
  const { q: y, result: b } = t, _ = J(y);
5385
5382
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[_])
5386
5383
  break;
5387
- const m = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, g = Lr(b), w = this.ensureAttrs(), O = ut(w, g, r, this.config.useDateObjects);
5384
+ const m = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, g = Ur(b), w = this.ensureAttrs(), O = ut(w, g, r, this.config.useDateObjects);
5388
5385
  this.querySubs.updateInPlace((v) => {
5389
5386
  if (!v[_]) {
5390
5387
  this._log.info("Missing value in querySubs", { hash: _, q: y });
@@ -5439,9 +5436,9 @@ class Wc {
5439
5436
  m !== this._pendingMutations() && this.kv.updateInPlace((w) => {
5440
5437
  w.pendingMutations = m;
5441
5438
  });
5442
- const S = fn(m.entries()), g = y.map((w) => {
5439
+ const S = ln(m.entries()), g = y.map((w) => {
5443
5440
  var W, Q, ee, ke;
5444
- const O = w["instaql-query"], v = w["instaql-result"], C = J(O), j = Lr(v), U = this.ensureAttrs(), B = ut(U, j, r, this.config.useDateObjects), { store: ye, attrsStore: Re } = this._applyOptimisticUpdates(B, U, S, _), te = (Q = (W = v == null ? void 0 : v[0]) == null ? void 0 : W.data) == null ? void 0 : Q["page-info"], oe = (ke = (ee = v == null ? void 0 : v[0]) == null ? void 0 : ee.data) == null ? void 0 : ke.aggregate;
5441
+ const O = w["instaql-query"], v = w["instaql-result"], C = J(O), j = Ur(v), U = this.ensureAttrs(), B = ut(U, j, r, this.config.useDateObjects), { store: ye, attrsStore: Re } = this._applyOptimisticUpdates(B, U, S, _), te = (Q = (W = v == null ? void 0 : v[0]) == null ? void 0 : W.data) == null ? void 0 : Q["page-info"], oe = (ke = (ee = v == null ? void 0 : v[0]) == null ? void 0 : ee.data) == null ? void 0 : ke.aggregate;
5445
5442
  return {
5446
5443
  q: O,
5447
5444
  hash: C,
@@ -5642,21 +5639,21 @@ class Wc {
5642
5639
  * Returns an unsubscribe function
5643
5640
  */
5644
5641
  subscribeQuery(e, t, r) {
5645
- this.config.disableValidation || Wr(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
5642
+ this.config.disableValidation || Nr(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
5646
5643
  const s = J(e), i = this.getPreviousResult(e);
5647
5644
  return i && t(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: t }), this._startQuerySub(e, s), () => {
5648
5645
  this._unsubQuery(e, s, t);
5649
5646
  };
5650
5647
  }
5651
5648
  queryOnce(e, t) {
5652
- this.config.disableValidation || Wr(e, this.config.schema), t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
5653
- const r = new Ur();
5649
+ this.config.disableValidation || Nr(e, this.config.schema), t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
5650
+ const r = new Dr();
5654
5651
  if (!this._isOnline)
5655
5652
  return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
5656
5653
  if (!this.querySubs)
5657
5654
  return r.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), r.promise;
5658
5655
  const s = J(e), i = this._startQuerySub(e, s);
5659
- return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")), Ic), r.promise;
5656
+ return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")), Cc), r.promise;
5660
5657
  }
5661
5658
  _completeQueryOnce(e, t, r) {
5662
5659
  this.queryOnceDfds[t] && (this.queryOnceDfds[t] = this.queryOnceDfds[t].filter((s) => s.dfd !== r), this._cleanupQuery(e, t));
@@ -5723,7 +5720,7 @@ class Wc {
5723
5720
  a = !0;
5724
5721
  continue;
5725
5722
  }
5726
- const _ = a ? ya(o, y) : y;
5723
+ const _ = a ? pa(o, y) : y;
5727
5724
  p.push(_);
5728
5725
  }
5729
5726
  return a ? p : l;
@@ -5736,7 +5733,7 @@ class Wc {
5736
5733
  return a ? u : t;
5737
5734
  }
5738
5735
  _rewriteMutationsSorted(e, t) {
5739
- return fn(this._rewriteMutations(e, t).entries());
5736
+ return ln(this._rewriteMutations(e, t).entries());
5740
5737
  }
5741
5738
  // ---------------------------
5742
5739
  // Transact
@@ -5781,12 +5778,12 @@ class Wc {
5781
5778
  const g = this._applyOptimisticUpdates(f, p, m, _);
5782
5779
  f = g.store, p = g.attrsStore;
5783
5780
  }
5784
- return { data: Rs({ store: f, attrsStore: p, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
5781
+ return { data: Ms({ store: f, attrsStore: p, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
5785
5782
  }
5786
5783
  _applyOptimisticUpdates(e, t, r, s) {
5787
5784
  for (const [i, o] of r)
5788
5785
  if (!o["tx-id"] || s && o["tx-id"] > s) {
5789
- const a = yo(e, t, o["tx-steps"]);
5786
+ const a = po(e, t, o["tx-steps"]);
5790
5787
  e = a.store, t = a.attrsStore;
5791
5788
  }
5792
5789
  return { store: e, attrsStore: t };
@@ -5845,7 +5842,7 @@ class Wc {
5845
5842
  const r = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations());
5846
5843
  r !== this._pendingMutations() && this.kv.updateInPlace((i) => {
5847
5844
  i.pendingMutations = r;
5848
- }), fn(r.entries()).forEach(([i, o]) => {
5845
+ }), ln(r.entries()).forEach(([i, o]) => {
5849
5846
  o["tx-id"] || this._sendMutation(i, o);
5850
5847
  }), this._syncTable.flushPending();
5851
5848
  }
@@ -5880,7 +5877,7 @@ class Wc {
5880
5877
  }
5881
5878
  _trySend(e, t, r) {
5882
5879
  if (this._transport.isOpen()) {
5883
- switch (Gr[t.op] || this._log.info("[send]", this._transport.id, t.op, {
5880
+ switch (Br[t.op] || this._log.info("[send]", this._transport.id, t.op, {
5884
5881
  "client-event-id": e,
5885
5882
  ...t
5886
5883
  }), t.op) {
@@ -5904,7 +5901,7 @@ class Wc {
5904
5901
  return;
5905
5902
  }
5906
5903
  const e = this._transport;
5907
- this._transport = xc({
5904
+ this._transport = jc({
5908
5905
  transportType: this._transportType,
5909
5906
  appId: this.config.appId,
5910
5907
  apiURI: this.config.apiURI,
@@ -5974,18 +5971,13 @@ class Wc {
5974
5971
  return null;
5975
5972
  this._replaceUrlAfterOAuth();
5976
5973
  try {
5977
- const c = await this.kv.waitForKeyToLoad(ln);
5978
- c && this.kv.updateInPlace((p) => {
5979
- delete p[ln];
5980
- });
5981
- const u = await this._getCurrentUser(), l = (u == null ? void 0 : u.type) === "guest", { user: f } = await $r({
5974
+ const c = await this._getCurrentUser(), u = (c == null ? void 0 : c.type) === "guest", { user: l } = await xr({
5982
5975
  apiURI: this.config.apiURI,
5983
5976
  appId: this.config.appId,
5984
5977
  code: r,
5985
- refreshToken: l ? u.refresh_token : void 0,
5986
- extraFields: c
5978
+ refreshToken: u ? c.refresh_token : void 0
5987
5979
  });
5988
- return this.setCurrentUser(f), null;
5980
+ return this.setCurrentUser(l), null;
5989
5981
  } catch (c) {
5990
5982
  return ((s = c == null ? void 0 : c.body) == null ? void 0 : s.type) === "record-not-found" && ((o = (i = c == null ? void 0 : c.body) == null ? void 0 : i.hint) == null ? void 0 : o["record-type"]) === "app-oauth-code" && await this._hasCurrentUser() ? null : { error: { message: ((a = c == null ? void 0 : c.body) == null ? void 0 : a.message) || "Error logging in." } };
5991
5983
  }
@@ -6129,26 +6121,25 @@ class Wc {
6129
6121
  }), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(t);
6130
6122
  }
6131
6123
  sendMagicCode({ email: e }) {
6132
- return Qa({
6124
+ return Ga({
6133
6125
  apiURI: this.config.apiURI,
6134
6126
  appId: this.config.appId,
6135
6127
  email: e
6136
6128
  });
6137
6129
  }
6138
- async signInWithMagicCode(e) {
6139
- var i, o;
6140
- const t = await this.getCurrentUser(), r = ((i = t == null ? void 0 : t.user) == null ? void 0 : i.type) === "guest", s = await Ha({
6130
+ async signInWithMagicCode({ email: e, code: t }) {
6131
+ var o, a;
6132
+ const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await Qa({
6141
6133
  apiURI: this.config.apiURI,
6142
6134
  appId: this.config.appId,
6143
- email: e.email,
6144
- code: e.code,
6145
- refreshToken: r ? (o = t == null ? void 0 : t.user) == null ? void 0 : o.refresh_token : void 0,
6146
- extraFields: e.extraFields
6135
+ email: e,
6136
+ code: t,
6137
+ refreshToken: s ? (a = r == null ? void 0 : r.user) == null ? void 0 : a.refresh_token : void 0
6147
6138
  });
6148
- return await this.changeCurrentUser(s.user), s;
6139
+ return await this.changeCurrentUser(i.user), i;
6149
6140
  }
6150
6141
  async signInWithCustomToken(e) {
6151
- const t = await Ja({
6142
+ const t = await Ha({
6152
6143
  apiURI: this.config.apiURI,
6153
6144
  appId: this.config.appId,
6154
6145
  refreshToken: e
@@ -6156,7 +6147,7 @@ class Wc {
6156
6147
  return await this.changeCurrentUser(t.user), t;
6157
6148
  }
6158
6149
  async signInAsGuest() {
6159
- const e = await Ya({
6150
+ const e = await Ja({
6160
6151
  apiURI: this.config.apiURI,
6161
6152
  appId: this.config.appId
6162
6153
  });
@@ -6171,7 +6162,7 @@ class Wc {
6171
6162
  this._log.info("[auth-invalidate] skipped invalidateToken");
6172
6163
  return;
6173
6164
  }
6174
- Xa({
6165
+ Za({
6175
6166
  apiURI: this.config.apiURI,
6176
6167
  appId: this.config.appId,
6177
6168
  refreshToken: r
@@ -6190,33 +6181,27 @@ class Wc {
6190
6181
  * @param {Object} params - The parameters to create the authorization URL.
6191
6182
  * @param {string} params.clientName - The name of the client requesting authorization.
6192
6183
  * @param {string} params.redirectURL - The URL to redirect users to after authorization.
6193
- * @param {Record<string, any>} [params.extraFields] - Extra fields to write to $users on creation
6194
6184
  * @returns {string} The created authorization URL.
6195
6185
  */
6196
- createAuthorizationURL({ clientName: e, redirectURL: t, extraFields: r }) {
6197
- r && this.kv.updateInPlace((o) => {
6198
- o[ln] = r;
6199
- });
6200
- const { apiURI: s, appId: i } = this.config;
6201
- return `${s}/runtime/oauth/start?app_id=${i}&client_name=${e}&redirect_uri=${t}`;
6186
+ createAuthorizationURL({ clientName: e, redirectURL: t }) {
6187
+ const { apiURI: r, appId: s } = this.config;
6188
+ return `${r}/runtime/oauth/start?app_id=${s}&client_name=${e}&redirect_uri=${t}`;
6202
6189
  }
6203
6190
  /**
6204
6191
  * @param {Object} params
6205
6192
  * @param {string} params.code - The code received from the OAuth service.
6206
6193
  * @param {string} [params.codeVerifier] - The code verifier used to generate the code challenge.
6207
- * @param {Record<string, any>} [params.extraFields] - Extra fields to write to $users on creation
6208
6194
  */
6209
- async exchangeCodeForToken({ code: e, codeVerifier: t, extraFields: r }) {
6210
- var a, c;
6211
- const s = await this.getCurrentUser(), i = ((a = s == null ? void 0 : s.user) == null ? void 0 : a.type) === "guest", o = await $r({
6195
+ async exchangeCodeForToken({ code: e, codeVerifier: t }) {
6196
+ var o, a;
6197
+ const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await xr({
6212
6198
  apiURI: this.config.apiURI,
6213
6199
  appId: this.config.appId,
6214
6200
  code: e,
6215
6201
  codeVerifier: t,
6216
- refreshToken: i ? (c = s == null ? void 0 : s.user) == null ? void 0 : c.refresh_token : void 0,
6217
- extraFields: r
6202
+ refreshToken: s ? (a = r == null ? void 0 : r.user) == null ? void 0 : a.refresh_token : void 0
6218
6203
  });
6219
- return await this.changeCurrentUser(o.user), o;
6204
+ return await this.changeCurrentUser(i.user), i;
6220
6205
  }
6221
6206
  issuerURI() {
6222
6207
  const { apiURI: e, appId: t } = this.config;
@@ -6227,20 +6212,18 @@ class Wc {
6227
6212
  * @param {string} params.clientName - The name of the client requesting authorization.
6228
6213
  * @param {string} params.idToken - The id_token from the external service
6229
6214
  * @param {string | null | undefined} [params.nonce] - The nonce used when requesting the id_token from the external service
6230
- * @param {Record<string, any>} [params.extraFields] - Extra fields to write to $users on creation
6231
6215
  */
6232
- async signInWithIdToken(e) {
6233
- var i;
6234
- const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token, s = await Za({
6216
+ async signInWithIdToken({ idToken: e, clientName: t, nonce: r }) {
6217
+ var a;
6218
+ const s = await this.getCurrentUser(), i = (a = s == null ? void 0 : s.user) == null ? void 0 : a.refresh_token, o = await Ya({
6235
6219
  apiURI: this.config.apiURI,
6236
6220
  appId: this.config.appId,
6237
- idToken: e.idToken,
6238
- clientName: e.clientName,
6239
- nonce: e.nonce,
6240
- refreshToken: r,
6241
- extraFields: e.extraFields
6221
+ idToken: e,
6222
+ clientName: t,
6223
+ nonce: r,
6224
+ refreshToken: i
6242
6225
  });
6243
- return await this.changeCurrentUser(s.user), s;
6226
+ return await this.changeCurrentUser(o.user), o;
6244
6227
  }
6245
6228
  // --------
6246
6229
  // Rooms
@@ -6275,7 +6258,7 @@ class Wc {
6275
6258
  getPresence(e, t, r = {}) {
6276
6259
  const s = this._rooms[t], i = this._presence[t];
6277
6260
  return !s || !i || !i.result ? null : {
6278
- ...ic(i.result, r, this._sessionId),
6261
+ ...sc(i.result, r, this._sessionId),
6279
6262
  isLoading: !s.isConnected,
6280
6263
  error: s.error
6281
6264
  };
@@ -6337,7 +6320,7 @@ class Wc {
6337
6320
  }
6338
6321
  _notifyPresenceSub(e, t) {
6339
6322
  const r = this.getPresence("", e, t);
6340
- r && (t.prev && !oc(r, t.prev) || (t.prev = r, t.cb(r)));
6323
+ r && (t.prev && !ic(r, t.prev) || (t.prev = r, t.cb(r)));
6341
6324
  }
6342
6325
  _patchPresencePeers(e, t) {
6343
6326
  var o, a, c;
@@ -6348,13 +6331,13 @@ class Wc {
6348
6331
  for (let [l, f, p] of t)
6349
6332
  switch (f) {
6350
6333
  case "+":
6351
- Di(u, l, p);
6334
+ $i(u, l, p);
6352
6335
  break;
6353
6336
  case "r":
6354
- Sr(u, l, p);
6337
+ Tr(u, l, p);
6355
6338
  break;
6356
6339
  case "-":
6357
- ys(u, l);
6340
+ ps(u, l);
6358
6341
  break;
6359
6342
  }
6360
6343
  delete u[this._sessionId];
@@ -6366,7 +6349,7 @@ class Wc {
6366
6349
  delete r[this._sessionId];
6367
6350
  const s = Object.fromEntries(Object.entries(r).map(([i, o]) => [i, o.data]));
6368
6351
  this._presence = Nt(this._presence, (i) => {
6369
- Sr(i, [e, "result", "peers"], s);
6352
+ Tr(i, [e, "result", "peers"], s);
6370
6353
  });
6371
6354
  }
6372
6355
  // --------
@@ -6409,7 +6392,7 @@ class Wc {
6409
6392
  async uploadFile(e, t, r) {
6410
6393
  var o;
6411
6394
  const s = await this.getCurrentUser(), i = (o = s == null ? void 0 : s.user) == null ? void 0 : o.refresh_token;
6412
- return ec({
6395
+ return Xa({
6413
6396
  ...r,
6414
6397
  apiURI: this.config.apiURI,
6415
6398
  appId: this.config.appId,
@@ -6421,7 +6404,7 @@ class Wc {
6421
6404
  async deleteFile(e) {
6422
6405
  var i;
6423
6406
  const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token;
6424
- return await tc({
6407
+ return await ec({
6425
6408
  apiURI: this.config.apiURI,
6426
6409
  appId: this.config.appId,
6427
6410
  path: e,
@@ -6432,18 +6415,18 @@ class Wc {
6432
6415
  // ---------------------------------
6433
6416
  async upload(e, t) {
6434
6417
  var c;
6435
- const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || t.name, o = await nc({
6418
+ const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || t.name, o = await tc({
6436
6419
  apiURI: this.config.apiURI,
6437
6420
  appId: this.config.appId,
6438
6421
  fileName: i,
6439
6422
  refreshToken: s
6440
6423
  });
6441
- return await rc(o, t);
6424
+ return await nc(o, t);
6442
6425
  }
6443
6426
  async getDownloadUrl(e) {
6444
6427
  var i;
6445
6428
  const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token;
6446
- return await sc({
6429
+ return await rc({
6447
6430
  apiURI: this.config.apiURI,
6448
6431
  appId: this.config.appId,
6449
6432
  path: e,
@@ -6451,9 +6434,9 @@ class Wc {
6451
6434
  });
6452
6435
  }
6453
6436
  }
6454
- function Kc(n, e) {
6437
+ function Wc(n, e) {
6455
6438
  return new Qt(
6456
- Bs(n, e),
6439
+ Vs(n, e),
6457
6440
  // (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
6458
6441
  // type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
6459
6442
  // EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
@@ -6463,28 +6446,28 @@ function Kc(n, e) {
6463
6446
  void 0
6464
6447
  );
6465
6448
  }
6466
- function qc(n) {
6449
+ function Kc(n) {
6467
6450
  return new Gt(n, {});
6468
6451
  }
6469
- function zc() {
6452
+ function qc() {
6470
6453
  return new ie("string", !0, !1);
6471
6454
  }
6472
- function Vc() {
6455
+ function zc() {
6473
6456
  return new ie("number", !0, !1);
6474
6457
  }
6475
- function Bc() {
6458
+ function Vc() {
6476
6459
  return new ie("boolean", !0, !1);
6477
6460
  }
6478
- function Gc() {
6461
+ function Bc() {
6479
6462
  return new ie("date", !0, !1);
6480
6463
  }
6481
- function Qc() {
6464
+ function Gc() {
6482
6465
  return new ie("json", !0, !1);
6483
6466
  }
6484
- function Hc() {
6467
+ function Qc() {
6485
6468
  return new ie("json", !0, !1);
6486
6469
  }
6487
- function Bs(n, e) {
6470
+ function Vs(n, e) {
6488
6471
  var s, i, o, a;
6489
6472
  const t = { fwd: {}, rev: {} };
6490
6473
  for (const c of Object.values(e))
@@ -6503,10 +6486,10 @@ function Bs(n, e) {
6503
6486
  })
6504
6487
  ]));
6505
6488
  }
6506
- function Jc({ entities: n, links: e, rooms: t }) {
6489
+ function Hc({ entities: n, links: e, rooms: t }) {
6507
6490
  const r = e ?? {}, s = t ?? {};
6508
6491
  return new Qt(
6509
- Bs(n, r),
6492
+ Vs(n, r),
6510
6493
  // (XXX): LinksDef<any> stems from TypeScript's inability to reconcile the
6511
6494
  // type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
6512
6495
  // EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
@@ -6516,23 +6499,23 @@ function Jc({ entities: n, links: e, rooms: t }) {
6516
6499
  s
6517
6500
  );
6518
6501
  }
6519
- const Ku = {
6502
+ const Wu = {
6520
6503
  // constructs
6521
- graph: Kc,
6522
- schema: Jc,
6523
- entity: qc,
6504
+ graph: Wc,
6505
+ schema: Hc,
6506
+ entity: Kc,
6524
6507
  // value types
6525
- string: zc,
6526
- number: Vc,
6527
- boolean: Bc,
6528
- date: Gc,
6529
- json: Qc,
6530
- any: Hc
6508
+ string: qc,
6509
+ number: zc,
6510
+ boolean: Vc,
6511
+ date: Bc,
6512
+ json: Gc,
6513
+ any: Qc
6531
6514
  };
6532
6515
  let It;
6533
- function Yc(n, e) {
6516
+ function Jc(n, e) {
6534
6517
  It == null || It.dispose();
6535
- const t = ru(e), r = eu(e, a), s = Xc(Zc(n));
6518
+ const t = nu(e), r = Xc(e, a), s = Zc(Yc(n));
6536
6519
  function i(l) {
6537
6520
  var f;
6538
6521
  l.source === s.element.contentWindow && ((f = l.data) == null ? void 0 : f.type) === "close" && t.isVisible() && a();
@@ -6554,10 +6537,10 @@ function Yc(n, e) {
6554
6537
  }
6555
6538
  return u();
6556
6539
  }
6557
- function Zc(n) {
6558
- return `${Xn || Ls ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${n}`;
6540
+ function Yc(n) {
6541
+ return `${Zn || Us ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${n}`;
6559
6542
  }
6560
- function Xc(n) {
6543
+ function Zc(n) {
6561
6544
  const e = document.createElement("iframe");
6562
6545
  return e.src = n, e.className = "instant-devtool-iframe", Object.assign(e.style, {
6563
6546
  width: "100%",
@@ -6566,7 +6549,7 @@ function Xc(n) {
6566
6549
  border: "none"
6567
6550
  }), { element: e };
6568
6551
  }
6569
- function eu(n, e) {
6552
+ function Xc(n, e) {
6570
6553
  const t = `
6571
6554
  <svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
6572
6555
  <rect width="512" height="512" fill="black"/>
@@ -6576,7 +6559,7 @@ function eu(n, e) {
6576
6559
  return r.innerHTML = t, r.className = "instant-devtool-toggler", Object.assign(r.style, {
6577
6560
  // pos
6578
6561
  position: "fixed",
6579
- ...tu(n.position),
6562
+ ...eu(n.position),
6580
6563
  height: "32px",
6581
6564
  width: "32px",
6582
6565
  // layout
@@ -6591,7 +6574,7 @@ function eu(n, e) {
6591
6574
  cursor: "pointer"
6592
6575
  }), r.addEventListener("click", e), { element: r };
6593
6576
  }
6594
- function tu(n) {
6577
+ function eu(n) {
6595
6578
  switch (n) {
6596
6579
  case "bottom-left":
6597
6580
  return { bottom: "24px", left: "24px" };
@@ -6603,7 +6586,7 @@ function tu(n) {
6603
6586
  return { top: "24px", left: "24px" };
6604
6587
  }
6605
6588
  }
6606
- function nu(n) {
6589
+ function tu(n) {
6607
6590
  switch (n) {
6608
6591
  case "bottom-left":
6609
6592
  return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
@@ -6615,11 +6598,11 @@ function nu(n) {
6615
6598
  return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
6616
6599
  }
6617
6600
  }
6618
- function ru(n) {
6601
+ function nu(n) {
6619
6602
  const e = document.createElement("div");
6620
6603
  Object.assign(e.style, {
6621
6604
  position: "fixed",
6622
- ...nu(n.position),
6605
+ ...tu(n.position),
6623
6606
  display: "block",
6624
6607
  borderRadius: "4px",
6625
6608
  border: "1px #ccc solid",
@@ -6632,7 +6615,7 @@ function ru(n) {
6632
6615
  }
6633
6616
  return { element: e, isVisible: t };
6634
6617
  }
6635
- function su(n, e) {
6618
+ function ru(n, e) {
6636
6619
  return e && e.refresh_token ? new Response(JSON.stringify({ ok: !0 }), {
6637
6620
  headers: {
6638
6621
  "Content-Type": "application/json",
@@ -6653,7 +6636,7 @@ function Pt(n, e) {
6653
6636
  headers: { "Content-Type": "application/json" }
6654
6637
  });
6655
6638
  }
6656
- const qu = (n) => ({
6639
+ const Ku = (n) => ({
6657
6640
  POST: async (e) => {
6658
6641
  let t;
6659
6642
  try {
@@ -6667,27 +6650,27 @@ const qu = (n) => ({
6667
6650
  return Pt(403, "App ID mismatch");
6668
6651
  switch (t.type) {
6669
6652
  case "sync-user":
6670
- return su(n, t.user ?? null);
6653
+ return ru(n, t.user ?? null);
6671
6654
  default:
6672
6655
  return Pt(400, `Unknown type: ${t.type}`);
6673
6656
  }
6674
6657
  }
6675
- }), iu = {
6658
+ }), su = {
6676
6659
  apiURI: "https://api.instantdb.com",
6677
6660
  websocketURI: "wss://api.instantdb.com/runtime/session"
6678
6661
  };
6679
- function ou() {
6662
+ function iu() {
6680
6663
  return globalThis.__instantDbSchemaHashStore = globalThis.__instantDbSchemaHashStore ?? /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
6681
6664
  }
6682
- function au() {
6665
+ function ou() {
6683
6666
  return globalThis.__instantDbStore = globalThis.__instantDbStore ?? {}, globalThis.__instantDbStore;
6684
6667
  }
6685
- function Pn(n) {
6668
+ function In(n) {
6686
6669
  const e = n.__adminToken;
6687
6670
  return n.appId + "_" + (n.websocketURI || "default_ws_uri") + "_" + (n.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + n.useDateObjects;
6688
6671
  }
6689
- const Mn = au(), Qr = ou();
6690
- class cu {
6672
+ const Pn = ou(), Gr = iu();
6673
+ class au {
6691
6674
  constructor(e) {
6692
6675
  h(this, "db");
6693
6676
  /**
@@ -6804,7 +6787,7 @@ class cu {
6804
6787
  this.db = e;
6805
6788
  }
6806
6789
  }
6807
- class uu {
6790
+ class cu {
6808
6791
  constructor(e) {
6809
6792
  h(this, "db");
6810
6793
  /**
@@ -6862,7 +6845,7 @@ class uu {
6862
6845
  this.db = e;
6863
6846
  }
6864
6847
  }
6865
- class lu {
6848
+ class uu {
6866
6849
  constructor(e) {
6867
6850
  h(this, "db");
6868
6851
  /**
@@ -6888,17 +6871,17 @@ class lu {
6888
6871
  this.db = e;
6889
6872
  }
6890
6873
  }
6891
- function fu(n) {
6874
+ function lu(n) {
6892
6875
  return JSON.parse(JSON.stringify(n));
6893
6876
  }
6894
- class du {
6877
+ class fu {
6895
6878
  constructor(e) {
6896
6879
  h(this, "_reactor");
6897
6880
  h(this, "auth");
6898
6881
  h(this, "storage");
6899
6882
  h(this, "streams");
6900
- h(this, "tx", Zn());
6901
- this._reactor = e, this.auth = new cu(this._reactor), this.storage = new uu(this._reactor), this.streams = new lu(this._reactor);
6883
+ h(this, "tx", Yn());
6884
+ this._reactor = e, this.auth = new au(this._reactor), this.storage = new cu(this._reactor), this.streams = new uu(this._reactor);
6902
6885
  }
6903
6886
  /**
6904
6887
  * Use this to write data! You can create, update, delete, and link objects
@@ -7039,7 +7022,7 @@ class du {
7039
7022
  };
7040
7023
  }
7041
7024
  shutdown() {
7042
- delete Mn[Pn(this._reactor.config)], this._reactor.shutdown();
7025
+ delete Pn[In(this._reactor.config)], this._reactor.shutdown();
7043
7026
  }
7044
7027
  /**
7045
7028
  * Use this for one-off queries.
@@ -7072,35 +7055,35 @@ class du {
7072
7055
  return this._reactor.subscribeTable(e, t);
7073
7056
  }
7074
7057
  }
7075
- function Hr(n) {
7058
+ function Qr(n) {
7076
7059
  if (!n)
7077
7060
  return "0";
7078
- const e = Qr.get(n);
7061
+ const e = Gr.get(n);
7079
7062
  if (e)
7080
7063
  return e;
7081
7064
  const t = J(n);
7082
- return Qr.set(n, t), t;
7065
+ return Gr.set(n, t), t;
7083
7066
  }
7084
- function hu(n, e) {
7085
- return Hr(n._reactor.config.schema) !== Hr(e);
7067
+ function du(n, e) {
7068
+ return Qr(n._reactor.config.schema) !== Qr(e);
7086
7069
  }
7087
- function pu(n, e, t, r, s) {
7070
+ function hu(n, e, t, r, s) {
7088
7071
  var u;
7089
7072
  const i = {
7090
7073
  ...n,
7091
7074
  appId: (u = n.appId) == null ? void 0 : u.trim(),
7092
7075
  useDateObjects: n.useDateObjects ?? !1
7093
- }, o = Mn[Pn(i)];
7076
+ }, o = Pn[In(i)];
7094
7077
  if (o)
7095
- return hu(o, i.schema) && o._reactor.updateSchema(i.schema), o;
7096
- const a = new Wc({
7097
- ...iu,
7078
+ return du(o, i.schema) && o._reactor.updateSchema(i.schema), o;
7079
+ const a = new Nc({
7080
+ ...su,
7098
7081
  ...i,
7099
7082
  cardinalityInference: !!i.schema
7100
- }, e || $s, t || Ds, { ...r || {}, "@instantdb/core": er }, s), c = new du(a);
7101
- return Mn[Pn(i)] = c, yu(i.appId, i.devtool), c;
7083
+ }, e || xs, t || $s, { ...r || {}, "@instantdb/core": Xn }, s), c = new fu(a);
7084
+ return Pn[In(i)] = c, pu(i.appId, i.devtool), c;
7102
7085
  }
7103
- function yu(n, e) {
7086
+ function pu(n, e) {
7104
7087
  if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
7105
7088
  return;
7106
7089
  const t = {
@@ -7108,9 +7091,9 @@ function yu(n, e) {
7108
7091
  allowedHosts: ["localhost"],
7109
7092
  ...typeof e == "object" ? e : {}
7110
7093
  };
7111
- t.allowedHosts.includes(window.location.hostname) && Yc(n, t);
7094
+ t.allowedHosts.includes(window.location.hostname) && Jc(n, t);
7112
7095
  }
7113
- var Rn = { exports: {} }, it = {};
7096
+ var Mn = { exports: {} }, it = {};
7114
7097
  /**
7115
7098
  * @license React
7116
7099
  * react-jsx-runtime.production.min.js
@@ -7120,11 +7103,11 @@ var Rn = { exports: {} }, it = {};
7120
7103
  * This source code is licensed under the MIT license found in the
7121
7104
  * LICENSE file in the root directory of this source tree.
7122
7105
  */
7123
- var Jr;
7124
- function bu() {
7125
- if (Jr) return it;
7126
- Jr = 1;
7127
- var n = ss, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
7106
+ var Hr;
7107
+ function yu() {
7108
+ if (Hr) return it;
7109
+ Hr = 1;
7110
+ var n = rs, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
7128
7111
  function o(a, c, u) {
7129
7112
  var l, f = {}, p = null, y = null;
7130
7113
  u !== void 0 && (p = "" + u), c.key !== void 0 && (p = "" + c.key), c.ref !== void 0 && (y = c.ref);
@@ -7134,10 +7117,10 @@ function bu() {
7134
7117
  }
7135
7118
  return it.Fragment = t, it.jsx = o, it.jsxs = o, it;
7136
7119
  }
7137
- var ot = {}, Yr;
7138
- function gu() {
7139
- if (Yr) return ot;
7140
- Yr = 1;
7120
+ var ot = {}, Jr;
7121
+ function bu() {
7122
+ if (Jr) return ot;
7123
+ Jr = 1;
7141
7124
  var n = {};
7142
7125
  /**
7143
7126
  * @license React
@@ -7149,7 +7132,7 @@ function gu() {
7149
7132
  * LICENSE file in the root directory of this source tree.
7150
7133
  */
7151
7134
  return n.NODE_ENV !== "production" && function() {
7152
- var e = ss, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), _ = Symbol.iterator, m = "@@iterator";
7135
+ var e = rs, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), _ = Symbol.iterator, m = "@@iterator";
7153
7136
  function S(d) {
7154
7137
  if (d === null || typeof d != "object")
7155
7138
  return null;
@@ -7316,10 +7299,10 @@ function gu() {
7316
7299
  }
7317
7300
  var Yt = !1, vt;
7318
7301
  {
7319
- var Hs = typeof WeakMap == "function" ? WeakMap : Map;
7320
- vt = new Hs();
7302
+ var Qs = typeof WeakMap == "function" ? WeakMap : Map;
7303
+ vt = new Qs();
7321
7304
  }
7322
- function nr(d, T) {
7305
+ function tr(d, T) {
7323
7306
  if (!d || Yt)
7324
7307
  return "";
7325
7308
  {
@@ -7390,10 +7373,10 @@ function gu() {
7390
7373
  var ze = d ? d.displayName || d.name : "", je = ze ? St(ze) : "";
7391
7374
  return typeof d == "function" && vt.set(d, je), je;
7392
7375
  }
7393
- function Js(d, T, E) {
7394
- return nr(d, !1);
7376
+ function Hs(d, T, E) {
7377
+ return tr(d, !1);
7395
7378
  }
7396
- function Ys(d) {
7379
+ function Js(d) {
7397
7380
  var T = d.prototype;
7398
7381
  return !!(T && T.isReactComponent);
7399
7382
  }
@@ -7401,7 +7384,7 @@ function gu() {
7401
7384
  if (d == null)
7402
7385
  return "";
7403
7386
  if (typeof d == "function")
7404
- return nr(d, Ys(d));
7387
+ return tr(d, Js(d));
7405
7388
  if (typeof d == "string")
7406
7389
  return St(d);
7407
7390
  switch (d) {
@@ -7413,7 +7396,7 @@ function gu() {
7413
7396
  if (typeof d == "object")
7414
7397
  switch (d.$$typeof) {
7415
7398
  case u:
7416
- return Js(d.render);
7399
+ return Hs(d.render);
7417
7400
  case p:
7418
7401
  return Et(d.type, T, E);
7419
7402
  case y: {
@@ -7426,15 +7409,15 @@ function gu() {
7426
7409
  }
7427
7410
  return "";
7428
7411
  }
7429
- var st = Object.prototype.hasOwnProperty, rr = {}, sr = g.ReactDebugCurrentFrame;
7412
+ var st = Object.prototype.hasOwnProperty, nr = {}, rr = g.ReactDebugCurrentFrame;
7430
7413
  function Ot(d) {
7431
7414
  if (d) {
7432
7415
  var T = d._owner, E = Et(d.type, d._source, T ? T.type : null);
7433
- sr.setExtraStackFrame(E);
7416
+ rr.setExtraStackFrame(E);
7434
7417
  } else
7435
- sr.setExtraStackFrame(null);
7418
+ rr.setExtraStackFrame(null);
7436
7419
  }
7437
- function Zs(d, T, E, A, $) {
7420
+ function Ys(d, T, E, A, $) {
7438
7421
  {
7439
7422
  var D = Function.call.bind(st);
7440
7423
  for (var x in d)
@@ -7449,41 +7432,41 @@ function gu() {
7449
7432
  } catch (K) {
7450
7433
  M = K;
7451
7434
  }
7452
- M && !(M instanceof Error) && (Ot($), w("%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).", A || "React class", E, x, typeof M), Ot(null)), M instanceof Error && !(M.message in rr) && (rr[M.message] = !0, Ot($), w("Failed %s type: %s", E, M.message), Ot(null));
7435
+ M && !(M instanceof Error) && (Ot($), w("%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).", A || "React class", E, x, typeof M), Ot(null)), M instanceof Error && !(M.message in nr) && (nr[M.message] = !0, Ot($), w("Failed %s type: %s", E, M.message), Ot(null));
7453
7436
  }
7454
7437
  }
7455
7438
  }
7456
- var Xs = Array.isArray;
7439
+ var Zs = Array.isArray;
7457
7440
  function Zt(d) {
7458
- return Xs(d);
7441
+ return Zs(d);
7459
7442
  }
7460
- function ei(d) {
7443
+ function Xs(d) {
7461
7444
  {
7462
7445
  var T = typeof Symbol == "function" && Symbol.toStringTag, E = T && d[Symbol.toStringTag] || d.constructor.name || "Object";
7463
7446
  return E;
7464
7447
  }
7465
7448
  }
7466
- function ti(d) {
7449
+ function ei(d) {
7467
7450
  try {
7468
- return ir(d), !1;
7451
+ return sr(d), !1;
7469
7452
  } catch {
7470
7453
  return !0;
7471
7454
  }
7472
7455
  }
7473
- function ir(d) {
7456
+ function sr(d) {
7474
7457
  return "" + d;
7475
7458
  }
7476
- function or(d) {
7477
- if (ti(d))
7478
- return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ei(d)), ir(d);
7459
+ function ir(d) {
7460
+ if (ei(d))
7461
+ return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Xs(d)), sr(d);
7479
7462
  }
7480
- var ar = g.ReactCurrentOwner, ni = {
7463
+ var or = g.ReactCurrentOwner, ti = {
7481
7464
  key: !0,
7482
7465
  ref: !0,
7483
7466
  __self: !0,
7484
7467
  __source: !0
7485
- }, cr, ur;
7486
- function ri(d) {
7468
+ }, ar, cr;
7469
+ function ni(d) {
7487
7470
  if (st.call(d, "ref")) {
7488
7471
  var T = Object.getOwnPropertyDescriptor(d, "ref").get;
7489
7472
  if (T && T.isReactWarning)
@@ -7491,7 +7474,7 @@ function gu() {
7491
7474
  }
7492
7475
  return d.ref !== void 0;
7493
7476
  }
7494
- function si(d) {
7477
+ function ri(d) {
7495
7478
  if (st.call(d, "key")) {
7496
7479
  var T = Object.getOwnPropertyDescriptor(d, "key").get;
7497
7480
  if (T && T.isReactWarning)
@@ -7499,13 +7482,13 @@ function gu() {
7499
7482
  }
7500
7483
  return d.key !== void 0;
7501
7484
  }
7502
- function ii(d, T) {
7503
- typeof d.ref == "string" && ar.current;
7485
+ function si(d, T) {
7486
+ typeof d.ref == "string" && or.current;
7504
7487
  }
7505
- function oi(d, T) {
7488
+ function ii(d, T) {
7506
7489
  {
7507
7490
  var E = function() {
7508
- cr || (cr = !0, w("%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));
7491
+ ar || (ar = !0, w("%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));
7509
7492
  };
7510
7493
  E.isReactWarning = !0, Object.defineProperty(d, "key", {
7511
7494
  get: E,
@@ -7513,10 +7496,10 @@ function gu() {
7513
7496
  });
7514
7497
  }
7515
7498
  }
7516
- function ai(d, T) {
7499
+ function oi(d, T) {
7517
7500
  {
7518
7501
  var E = function() {
7519
- ur || (ur = !0, w("%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));
7502
+ cr || (cr = !0, w("%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));
7520
7503
  };
7521
7504
  E.isReactWarning = !0, Object.defineProperty(d, "ref", {
7522
7505
  get: E,
@@ -7524,7 +7507,7 @@ function gu() {
7524
7507
  });
7525
7508
  }
7526
7509
  }
7527
- var ci = function(d, T, E, A, $, D, x) {
7510
+ var ai = function(d, T, E, A, $, D, x) {
7528
7511
  var M = {
7529
7512
  // This tag allows us to uniquely identify this as a React Element
7530
7513
  $$typeof: t,
@@ -7553,12 +7536,12 @@ function gu() {
7553
7536
  value: $
7554
7537
  }), Object.freeze && (Object.freeze(M.props), Object.freeze(M)), M;
7555
7538
  };
7556
- function ui(d, T, E, A, $) {
7539
+ function ci(d, T, E, A, $) {
7557
7540
  {
7558
7541
  var D, x = {}, M = null, ne = null;
7559
- E !== void 0 && (or(E), M = "" + E), si(T) && (or(T.key), M = "" + T.key), ri(T) && (ne = T.ref, ii(T, $));
7542
+ E !== void 0 && (ir(E), M = "" + E), ri(T) && (ir(T.key), M = "" + T.key), ni(T) && (ne = T.ref, si(T, $));
7560
7543
  for (D in T)
7561
- st.call(T, D) && !ni.hasOwnProperty(D) && (x[D] = T[D]);
7544
+ st.call(T, D) && !ti.hasOwnProperty(D) && (x[D] = T[D]);
7562
7545
  if (d && d.defaultProps) {
7563
7546
  var K = d.defaultProps;
7564
7547
  for (D in K)
@@ -7566,25 +7549,25 @@ function gu() {
7566
7549
  }
7567
7550
  if (M || ne) {
7568
7551
  var z = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
7569
- M && oi(x, z), ne && ai(x, z);
7552
+ M && ii(x, z), ne && oi(x, z);
7570
7553
  }
7571
- return ci(d, M, ne, $, A, ar.current, x);
7554
+ return ai(d, M, ne, $, A, or.current, x);
7572
7555
  }
7573
7556
  }
7574
- var Xt = g.ReactCurrentOwner, lr = g.ReactDebugCurrentFrame;
7557
+ var Xt = g.ReactCurrentOwner, ur = g.ReactDebugCurrentFrame;
7575
7558
  function qe(d) {
7576
7559
  if (d) {
7577
7560
  var T = d._owner, E = Et(d.type, d._source, T ? T.type : null);
7578
- lr.setExtraStackFrame(E);
7561
+ ur.setExtraStackFrame(E);
7579
7562
  } else
7580
- lr.setExtraStackFrame(null);
7563
+ ur.setExtraStackFrame(null);
7581
7564
  }
7582
7565
  var en;
7583
7566
  en = !1;
7584
7567
  function tn(d) {
7585
7568
  return typeof d == "object" && d !== null && d.$$typeof === t;
7586
7569
  }
7587
- function fr() {
7570
+ function lr() {
7588
7571
  {
7589
7572
  if (Xt.current) {
7590
7573
  var d = W(Xt.current.type);
@@ -7596,13 +7579,13 @@ Check the render method of \`` + d + "`.";
7596
7579
  return "";
7597
7580
  }
7598
7581
  }
7599
- function li(d) {
7582
+ function ui(d) {
7600
7583
  return "";
7601
7584
  }
7602
- var dr = {};
7603
- function fi(d) {
7585
+ var fr = {};
7586
+ function li(d) {
7604
7587
  {
7605
- var T = fr();
7588
+ var T = lr();
7606
7589
  if (!T) {
7607
7590
  var E = typeof d == "string" ? d : d.displayName || d.name;
7608
7591
  E && (T = `
@@ -7612,27 +7595,27 @@ Check the top-level render call using <` + E + ">.");
7612
7595
  return T;
7613
7596
  }
7614
7597
  }
7615
- function hr(d, T) {
7598
+ function dr(d, T) {
7616
7599
  {
7617
7600
  if (!d._store || d._store.validated || d.key != null)
7618
7601
  return;
7619
7602
  d._store.validated = !0;
7620
- var E = fi(T);
7621
- if (dr[E])
7603
+ var E = li(T);
7604
+ if (fr[E])
7622
7605
  return;
7623
- dr[E] = !0;
7606
+ fr[E] = !0;
7624
7607
  var A = "";
7625
7608
  d && d._owner && d._owner !== Xt.current && (A = " It was passed a child from " + W(d._owner.type) + "."), qe(d), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', E, A), qe(null);
7626
7609
  }
7627
7610
  }
7628
- function pr(d, T) {
7611
+ function hr(d, T) {
7629
7612
  {
7630
7613
  if (typeof d != "object")
7631
7614
  return;
7632
7615
  if (Zt(d))
7633
7616
  for (var E = 0; E < d.length; E++) {
7634
7617
  var A = d[E];
7635
- tn(A) && hr(A, T);
7618
+ tn(A) && dr(A, T);
7636
7619
  }
7637
7620
  else if (tn(d))
7638
7621
  d._store && (d._store.validated = !0);
@@ -7640,11 +7623,11 @@ Check the top-level render call using <` + E + ">.");
7640
7623
  var $ = S(d);
7641
7624
  if (typeof $ == "function" && $ !== d.entries)
7642
7625
  for (var D = $.call(d), x; !(x = D.next()).done; )
7643
- tn(x.value) && hr(x.value, T);
7626
+ tn(x.value) && dr(x.value, T);
7644
7627
  }
7645
7628
  }
7646
7629
  }
7647
- function di(d) {
7630
+ function fi(d) {
7648
7631
  {
7649
7632
  var T = d.type;
7650
7633
  if (T == null || typeof T == "string")
@@ -7660,7 +7643,7 @@ Check the top-level render call using <` + E + ">.");
7660
7643
  return;
7661
7644
  if (E) {
7662
7645
  var A = W(T);
7663
- Zs(E, d.props, "prop", A, d);
7646
+ Ys(E, d.props, "prop", A, d);
7664
7647
  } else if (T.PropTypes !== void 0 && !en) {
7665
7648
  en = !0;
7666
7649
  var $ = W(T);
@@ -7669,7 +7652,7 @@ Check the top-level render call using <` + E + ">.");
7669
7652
  typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
7670
7653
  }
7671
7654
  }
7672
- function hi(d) {
7655
+ function di(d) {
7673
7656
  {
7674
7657
  for (var T = Object.keys(d.props), E = 0; E < T.length; E++) {
7675
7658
  var A = T[E];
@@ -7681,19 +7664,19 @@ Check the top-level render call using <` + E + ">.");
7681
7664
  d.ref !== null && (qe(d), w("Invalid attribute `ref` supplied to `React.Fragment`."), qe(null));
7682
7665
  }
7683
7666
  }
7684
- var yr = {};
7685
- function br(d, T, E, A, $, D) {
7667
+ var pr = {};
7668
+ function yr(d, T, E, A, $, D) {
7686
7669
  {
7687
7670
  var x = Re(d);
7688
7671
  if (!x) {
7689
7672
  var M = "";
7690
7673
  (d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && (M += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
7691
- var ne = li();
7692
- ne ? M += ne : M += fr();
7674
+ var ne = ui();
7675
+ ne ? M += ne : M += lr();
7693
7676
  var K;
7694
7677
  d === null ? K = "null" : Zt(d) ? K = "array" : d !== void 0 && d.$$typeof === t ? (K = "<" + (W(d.type) || "Unknown") + " />", M = " Did you accidentally export a JSX literal instead of a component?") : K = typeof d, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", K, M);
7695
7678
  }
7696
- var z = ui(d, T, E, $, D);
7679
+ var z = ci(d, T, E, $, D);
7697
7680
  if (z == null)
7698
7681
  return z;
7699
7682
  if (x) {
@@ -7702,50 +7685,50 @@ Check the top-level render call using <` + E + ">.");
7702
7685
  if (A)
7703
7686
  if (Zt(be)) {
7704
7687
  for (var ze = 0; ze < be.length; ze++)
7705
- pr(be[ze], d);
7688
+ hr(be[ze], d);
7706
7689
  Object.freeze && Object.freeze(be);
7707
7690
  } else
7708
7691
  w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
7709
7692
  else
7710
- pr(be, d);
7693
+ hr(be, d);
7711
7694
  }
7712
7695
  if (st.call(T, "key")) {
7713
- var je = W(d), ce = Object.keys(T).filter(function(mi) {
7714
- return mi !== "key";
7696
+ var je = W(d), ce = Object.keys(T).filter(function(_i) {
7697
+ return _i !== "key";
7715
7698
  }), nn = ce.length > 0 ? "{key: someKey, " + ce.join(": ..., ") + ": ...}" : "{key: someKey}";
7716
- if (!yr[je + nn]) {
7717
- var _i = ce.length > 0 ? "{" + ce.join(": ..., ") + ": ...}" : "{}";
7699
+ if (!pr[je + nn]) {
7700
+ var gi = ce.length > 0 ? "{" + ce.join(": ..., ") + ": ...}" : "{}";
7718
7701
  w(`A props object containing a "key" prop is being spread into JSX:
7719
7702
  let props = %s;
7720
7703
  <%s {...props} />
7721
7704
  React keys must be passed directly to JSX without using spread:
7722
7705
  let props = %s;
7723
- <%s key={someKey} {...props} />`, nn, je, _i, je), yr[je + nn] = !0;
7706
+ <%s key={someKey} {...props} />`, nn, je, gi, je), pr[je + nn] = !0;
7724
7707
  }
7725
7708
  }
7726
- return d === s ? hi(z) : di(z), z;
7709
+ return d === s ? di(z) : fi(z), z;
7727
7710
  }
7728
7711
  }
7729
- function pi(d, T, E) {
7730
- return br(d, T, E, !0);
7712
+ function hi(d, T, E) {
7713
+ return yr(d, T, E, !0);
7731
7714
  }
7732
- function yi(d, T, E) {
7733
- return br(d, T, E, !1);
7715
+ function pi(d, T, E) {
7716
+ return yr(d, T, E, !1);
7734
7717
  }
7735
- var bi = yi, gi = pi;
7736
- ot.Fragment = s, ot.jsx = bi, ot.jsxs = gi;
7718
+ var yi = pi, bi = hi;
7719
+ ot.Fragment = s, ot.jsx = yi, ot.jsxs = bi;
7737
7720
  }(), ot;
7738
7721
  }
7739
- var _u = {};
7740
- _u.NODE_ENV === "production" ? Rn.exports = bu() : Rn.exports = gu();
7741
- var X = Rn.exports;
7742
- const mu = {
7722
+ var gu = {};
7723
+ gu.NODE_ENV === "production" ? Mn.exports = yu() : Mn.exports = bu();
7724
+ var X = Mn.exports;
7725
+ const _u = {
7743
7726
  isLoading: !0,
7744
7727
  data: void 0,
7745
7728
  pageInfo: void 0,
7746
7729
  error: void 0
7747
7730
  };
7748
- function Zr(n) {
7731
+ function Yr(n) {
7749
7732
  return {
7750
7733
  isLoading: !n,
7751
7734
  data: void 0,
@@ -7754,10 +7737,10 @@ function Zr(n) {
7754
7737
  ...n || {}
7755
7738
  };
7756
7739
  }
7757
- function wu(n, e, t, r) {
7740
+ function mu(n, e, t, r) {
7758
7741
  e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
7759
- const s = e ? fu(e) : null, i = J(s), o = Xe(Zr(n._reactor.getPreviousResult(s))), a = Xe(mu), c = Me(
7760
- (l) => (o.current = Zr(n._reactor.getPreviousResult(s)), l(), s ? n.subscribeQuery(s, (p) => {
7742
+ const s = e ? lu(e) : null, i = J(s), o = Xe(Yr(n._reactor.getPreviousResult(s))), a = Xe(_u), c = Me(
7743
+ (l) => (o.current = Yr(n._reactor.getPreviousResult(s)), l(), s ? n.subscribeQuery(s, (p) => {
7761
7744
  o.current = {
7762
7745
  isLoading: !p,
7763
7746
  // @ts-expect-error: ts thinks this will always be overwritten
@@ -7773,9 +7756,9 @@ function wu(n, e, t, r) {
7773
7756
  // Build a new subscribe function if the query changes
7774
7757
  [i]
7775
7758
  );
7776
- return { state: hn(c, () => o.current, () => a.current), query: s, queryHash: i };
7759
+ return { state: dn(c, () => o.current, () => a.current), query: s, queryHash: i };
7777
7760
  }
7778
- function Tu() {
7761
+ function wu() {
7779
7762
  const n = Xe(null);
7780
7763
  Fe(() => {
7781
7764
  t();
@@ -7788,14 +7771,14 @@ function Tu() {
7788
7771
  }
7789
7772
  return { set: e, clear: t };
7790
7773
  }
7791
- const Su = 1e3;
7792
- function vu(n, e, t) {
7774
+ const Tu = 1e3;
7775
+ function Su(n, e, t) {
7793
7776
  const r = Xe(t);
7794
7777
  r.current = t, Fe(() => n.core._reactor.subscribeTopic(n.type, n.id, e, (i, o) => {
7795
7778
  r.current(i, o);
7796
7779
  }), [n.id, e]);
7797
7780
  }
7798
- function Eu(n, e) {
7781
+ function vu(n, e) {
7799
7782
  return Fe(() => n.core._reactor.joinRoom(n.type, n.id), [n.id]), Me((r) => {
7800
7783
  n.core._reactor.publishTopic({
7801
7784
  roomType: n.type,
@@ -7805,9 +7788,9 @@ function Eu(n, e) {
7805
7788
  });
7806
7789
  }, [n.id, e]);
7807
7790
  }
7808
- function Ou(n, e = {}) {
7791
+ function Eu(n, e = {}) {
7809
7792
  var o, a;
7810
- const [t, r] = is(() => n.core._reactor.getPresence(n.type, n.id, e) ?? {
7793
+ const [t, r] = ss(() => n.core._reactor.getPresence(n.type, n.id, e) ?? {
7811
7794
  peers: {},
7812
7795
  isLoading: !0
7813
7796
  });
@@ -7817,24 +7800,24 @@ function Ou(n, e = {}) {
7817
7800
  const s = Me((c) => {
7818
7801
  n.core._reactor.publishPresence(n.type, n.id, c);
7819
7802
  }, [n.type, n.id]);
7820
- return pn(() => ({
7803
+ return hn(() => ({
7821
7804
  ...t,
7822
7805
  publishPresence: s
7823
7806
  }), [t, s]);
7824
7807
  }
7825
- function ku(n, e, t) {
7808
+ function Ou(n, e, t) {
7826
7809
  Fe(() => n.core._reactor.joinRoom(n.type, n.id, e), [n.id]), Fe(() => n.core._reactor.publishPresence(n.type, n.id, e), [n.type, n.id, t ?? JSON.stringify(e)]);
7827
7810
  }
7828
- function Au(n, e, t = {}) {
7829
- const r = Tu(), s = $e.usePresence(n, {
7811
+ function ku(n, e, t = {}) {
7812
+ const r = wu(), s = $e.usePresence(n, {
7830
7813
  keys: [e]
7831
- }), i = pn(() => {
7814
+ }), i = hn(() => {
7832
7815
  const l = n._core._reactor.getPresence(n.type, n.id);
7833
7816
  return t != null && t.writeOnly ? [] : Object.values((l == null ? void 0 : l.peers) ?? {}).filter((f) => f[e] === !0);
7834
7817
  }, [t == null ? void 0 : t.writeOnly, s]), o = Me((l) => {
7835
7818
  n.core._reactor.publishPresence(n.type, n.id, {
7836
7819
  [e]: l
7837
- }), l && ((t == null ? void 0 : t.timeout) === null || (t == null ? void 0 : t.timeout) === 0 || r.set((t == null ? void 0 : t.timeout) ?? Su, () => {
7820
+ }), l && ((t == null ? void 0 : t.timeout) === null || (t == null ? void 0 : t.timeout) === 0 || r.set((t == null ? void 0 : t.timeout) ?? Tu, () => {
7838
7821
  n.core._reactor.publishPresence(n.type, n.id, {
7839
7822
  [e]: null
7840
7823
  });
@@ -7844,7 +7827,7 @@ function Au(n, e, t = {}) {
7844
7827
  o(p);
7845
7828
  }, [t.stopOnEnter, o]), c = Me(() => {
7846
7829
  o(!1);
7847
- }, [o]), u = pn(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
7830
+ }, [o]), u = hn(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
7848
7831
  return {
7849
7832
  active: i,
7850
7833
  setActive: o,
@@ -7852,13 +7835,13 @@ function Au(n, e, t = {}) {
7852
7835
  };
7853
7836
  }
7854
7837
  const $e = {
7855
- useTopicEffect: vu,
7856
- usePublishTopic: Eu,
7857
- usePresence: Ou,
7858
- useSyncPresence: ku,
7859
- useTypingIndicator: Au
7838
+ useTopicEffect: Su,
7839
+ usePublishTopic: vu,
7840
+ usePresence: Eu,
7841
+ useSyncPresence: Ou,
7842
+ useTypingIndicator: ku
7860
7843
  };
7861
- class Cu {
7844
+ class Au {
7862
7845
  constructor(e, t, r) {
7863
7846
  h(this, "core");
7864
7847
  /** @deprecated use `core` instead */
@@ -7945,14 +7928,14 @@ class Cu {
7945
7928
  this.core = e, this._core = this.core, this.type = t, this.id = r;
7946
7929
  }
7947
7930
  }
7948
- const Iu = {
7931
+ const Cu = {
7949
7932
  isLoading: !0,
7950
7933
  user: void 0,
7951
7934
  error: void 0
7952
7935
  };
7953
7936
  class $t {
7954
7937
  constructor(e, t) {
7955
- h(this, "tx", Zn());
7938
+ h(this, "tx", Yn());
7956
7939
  h(this, "auth");
7957
7940
  h(this, "storage");
7958
7941
  h(this, "streams");
@@ -7981,7 +7964,7 @@ class $t {
7981
7964
  * console.log('Device ID:', deviceId)
7982
7965
  */
7983
7966
  h(this, "useLocalId", (e) => {
7984
- const [t, r] = is(null);
7967
+ const [t, r] = ss(null);
7985
7968
  return Fe(() => {
7986
7969
  (async () => {
7987
7970
  const i = await this.getLocalId(e);
@@ -8049,7 +8032,7 @@ class $t {
8049
8032
  * auth.user ? { goals: {} } : null,
8050
8033
  * );
8051
8034
  */
8052
- h(this, "useQuery", (e, t) => wu(this.core, e, t).state);
8035
+ h(this, "useQuery", (e, t) => mu(this.core, e, t).state);
8053
8036
  /**
8054
8037
  * Listen for the logged in state. This is useful
8055
8038
  * for deciding when to show a login screen.
@@ -8125,7 +8108,7 @@ class $t {
8125
8108
  const e = Xe(this.core._reactor.status), t = Me((s) => this.core.subscribeConnectionStatus((o) => {
8126
8109
  o !== e.current && (e.current = o, s());
8127
8110
  }), []);
8128
- return hn(
8111
+ return dn(
8129
8112
  t,
8130
8113
  () => e.current,
8131
8114
  // For SSR, always return 'connecting' as the initial state
@@ -8174,7 +8157,7 @@ class $t {
8174
8157
  const t = this.useAuth();
8175
8158
  return t.isLoading || t.error || t.user ? null : X.jsx(X.Fragment, { children: e });
8176
8159
  });
8177
- this.core = pu(
8160
+ this.core = hu(
8178
8161
  e,
8179
8162
  // @ts-expect-error because TS can't resolve subclass statics
8180
8163
  e.Store || this.constructor.Store,
@@ -8198,13 +8181,13 @@ class $t {
8198
8181
  * const { peers } = db.rooms.usePresence(room);
8199
8182
  */
8200
8183
  room(e = "_defaultRoomType", t = "_defaultRoomId") {
8201
- return new Cu(this.core, e, t);
8184
+ return new Au(this.core, e, t);
8202
8185
  }
8203
8186
  _useAuth() {
8204
8187
  const e = Xe(this.core._reactor._currentUserCached), t = Me((s) => this.core.subscribeAuth((o) => {
8205
8188
  e.current = { isLoading: !1, ...o }, s();
8206
8189
  }), []);
8207
- return hn(t, () => e.current, () => Iu);
8190
+ return dn(t, () => e.current, () => Cu);
8208
8191
  }
8209
8192
  /**
8210
8193
  * One time query for the logged in state. This is useful
@@ -8221,22 +8204,22 @@ class $t {
8221
8204
  }
8222
8205
  }
8223
8206
  h($t, "Store"), h($t, "NetworkListener"), h($t, "EventSourceImpl");
8224
- class Xr extends Error {
8207
+ class Zr extends Error {
8225
8208
  constructor(e, t) {
8226
8209
  super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
8227
8210
  }
8228
8211
  }
8229
- function dn(n) {
8212
+ function fn(n) {
8230
8213
  }
8231
- function Pu(n) {
8214
+ function Iu(n) {
8232
8215
  if (typeof n == "function")
8233
8216
  throw new TypeError(
8234
8217
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
8235
8218
  );
8236
- const { onEvent: e = dn, onError: t = dn, onRetry: r = dn, onComment: s } = n;
8219
+ const { onEvent: e = fn, onError: t = fn, onRetry: r = fn, onComment: s } = n;
8237
8220
  let i = "", o = !0, a, c = "", u = "";
8238
8221
  function l(_) {
8239
- const m = o ? _.replace(/^\xEF\xBB\xBF/, "") : _, [S, g] = Mu(`${i}${m}`);
8222
+ const m = o ? _.replace(/^\xEF\xBB\xBF/, "") : _, [S, g] = Pu(`${i}${m}`);
8240
8223
  for (const w of S)
8241
8224
  f(w);
8242
8225
  i = g, o = !1;
@@ -8272,7 +8255,7 @@ function Pu(n) {
8272
8255
  break;
8273
8256
  case "retry":
8274
8257
  /^\d+$/.test(m) ? r(parseInt(m, 10)) : t(
8275
- new Xr(`Invalid \`retry\` value: "${m}"`, {
8258
+ new Zr(`Invalid \`retry\` value: "${m}"`, {
8276
8259
  type: "invalid-retry",
8277
8260
  value: m,
8278
8261
  line: S
@@ -8281,7 +8264,7 @@ function Pu(n) {
8281
8264
  break;
8282
8265
  default:
8283
8266
  t(
8284
- new Xr(
8267
+ new Zr(
8285
8268
  `Unknown field "${_.length > 20 ? `${_.slice(0, 20)}…` : _}"`,
8286
8269
  { type: "unknown-field", field: _, value: m, line: S }
8287
8270
  )
@@ -8304,7 +8287,7 @@ function Pu(n) {
8304
8287
  }
8305
8288
  return { feed: l, reset: b };
8306
8289
  }
8307
- function Mu(n) {
8290
+ function Pu(n) {
8308
8291
  const e = [];
8309
8292
  let t = "", r = 0;
8310
8293
  for (; r < n.length; ) {
@@ -8322,7 +8305,7 @@ function Mu(n) {
8322
8305
  }
8323
8306
  return [e, t];
8324
8307
  }
8325
- class es extends Event {
8308
+ class Xr extends Event {
8326
8309
  /**
8327
8310
  * Constructs a new `ErrorEvent` instance. This is typically not called directly,
8328
8311
  * but rather emitted by the `EventSource` object when an error occurs.
@@ -8347,7 +8330,7 @@ class es extends Event {
8347
8330
  * @returns A string representation of the error
8348
8331
  */
8349
8332
  [Symbol.for("nodejs.util.inspect.custom")](e, t, r) {
8350
- return r(ts(this), t);
8333
+ return r(es(this), t);
8351
8334
  }
8352
8335
  /**
8353
8336
  * Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
@@ -8361,17 +8344,17 @@ class es extends Event {
8361
8344
  * @returns A string representation of the error
8362
8345
  */
8363
8346
  [Symbol.for("Deno.customInspect")](e, t) {
8364
- return e(ts(this), t);
8347
+ return e(es(this), t);
8365
8348
  }
8366
8349
  }
8367
- function Ru(n) {
8350
+ function Mu(n) {
8368
8351
  const e = globalThis.DOMException;
8369
8352
  return typeof e == "function" ? new e(n, "SyntaxError") : new SyntaxError(n);
8370
8353
  }
8371
- function jn(n) {
8372
- return n instanceof Error ? "errors" in n && Array.isArray(n.errors) ? n.errors.map(jn).join(", ") : "cause" in n && n.cause instanceof Error ? `${n}: ${jn(n.cause)}` : n.message : `${n}`;
8354
+ function Rn(n) {
8355
+ return n instanceof Error ? "errors" in n && Array.isArray(n.errors) ? n.errors.map(Rn).join(", ") : "cause" in n && n.cause instanceof Error ? `${n}: ${Rn(n.cause)}` : n.message : `${n}`;
8373
8356
  }
8374
- function ts(n) {
8357
+ function es(n) {
8375
8358
  return {
8376
8359
  type: n.type,
8377
8360
  message: n.message,
@@ -8381,13 +8364,13 @@ function ts(n) {
8381
8364
  timeStamp: n.timeStamp
8382
8365
  };
8383
8366
  }
8384
- var Gs = (n) => {
8367
+ var Bs = (n) => {
8385
8368
  throw TypeError(n);
8386
- }, tr = (n, e, t) => e.has(n) || Gs("Cannot " + t), P = (n, e, t) => (tr(n, e, "read from private field"), t ? t.call(n) : e.get(n)), G = (n, e, t) => e.has(n) ? Gs("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), F = (n, e, t, r) => (tr(n, e, "write to private field"), e.set(n, t), t), Ae = (n, e, t) => (tr(n, e, "access private method"), t), ue, De, Ge, Dt, qt, bt, Je, gt, Pe, Qe, Ze, He, ft, we, xn, $n, Dn, ns, Un, Ln, dt, Fn, Nn;
8369
+ }, er = (n, e, t) => e.has(n) || Bs("Cannot " + t), P = (n, e, t) => (er(n, e, "read from private field"), t ? t.call(n) : e.get(n)), G = (n, e, t) => e.has(n) ? Bs("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), F = (n, e, t, r) => (er(n, e, "write to private field"), e.set(n, t), t), Ae = (n, e, t) => (er(n, e, "access private method"), t), ue, De, Ge, Dt, qt, bt, Je, gt, Pe, Qe, Ze, He, ft, we, jn, xn, $n, ts, Dn, Un, dt, Ln, Fn;
8387
8370
  class Ut extends EventTarget {
8388
8371
  constructor(e, t) {
8389
8372
  var r, s;
8390
- super(), G(this, we), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, G(this, ue), G(this, De), G(this, Ge), G(this, Dt), G(this, qt), G(this, bt), G(this, Je), G(this, gt, null), G(this, Pe), G(this, Qe), G(this, Ze, null), G(this, He, null), G(this, ft, null), G(this, $n, async (i) => {
8373
+ super(), G(this, we), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, G(this, ue), G(this, De), G(this, Ge), G(this, Dt), G(this, qt), G(this, bt), G(this, Je), G(this, gt, null), G(this, Pe), G(this, Qe), G(this, Ze, null), G(this, He, null), G(this, ft, null), G(this, xn, async (i) => {
8391
8374
  var o;
8392
8375
  P(this, Qe).reset();
8393
8376
  const { body: a, redirected: c, status: u, headers: l } = i;
@@ -8415,11 +8398,11 @@ class Ut extends EventTarget {
8415
8398
  let b = !0;
8416
8399
  do {
8417
8400
  const { done: _, value: m } = await y.read();
8418
- m && P(this, Qe).feed(p.decode(m, { stream: !_ })), _ && (b = !1, P(this, Qe).reset(), Ae(this, we, Fn).call(this));
8401
+ m && P(this, Qe).feed(p.decode(m, { stream: !_ })), _ && (b = !1, P(this, Qe).reset(), Ae(this, we, Ln).call(this));
8419
8402
  } while (b);
8403
+ }), G(this, $n, (i) => {
8404
+ F(this, Pe, void 0), !(i.name === "AbortError" || i.type === "aborted") && Ae(this, we, Ln).call(this, Rn(i));
8420
8405
  }), G(this, Dn, (i) => {
8421
- F(this, Pe, void 0), !(i.name === "AbortError" || i.type === "aborted") && Ae(this, we, Fn).call(this, jn(i));
8422
- }), G(this, Un, (i) => {
8423
8406
  typeof i.id == "string" && F(this, gt, i.id);
8424
8407
  const o = new MessageEvent(i.event || "message", {
8425
8408
  data: i.data,
@@ -8427,25 +8410,25 @@ class Ut extends EventTarget {
8427
8410
  lastEventId: i.id || ""
8428
8411
  });
8429
8412
  P(this, He) && (!i.event || i.event === "message") && P(this, He).call(this, o), this.dispatchEvent(o);
8430
- }), G(this, Ln, (i) => {
8413
+ }), G(this, Un, (i) => {
8431
8414
  F(this, bt, i);
8432
- }), G(this, Nn, () => {
8433
- F(this, Je, void 0), P(this, ue) === this.CONNECTING && Ae(this, we, xn).call(this);
8415
+ }), G(this, Fn, () => {
8416
+ F(this, Je, void 0), P(this, ue) === this.CONNECTING && Ae(this, we, jn).call(this);
8434
8417
  });
8435
8418
  try {
8436
8419
  if (e instanceof URL)
8437
8420
  F(this, De, e);
8438
8421
  else if (typeof e == "string")
8439
- F(this, De, new URL(e, ju()));
8422
+ F(this, De, new URL(e, Ru()));
8440
8423
  else
8441
8424
  throw new Error("Invalid URL");
8442
8425
  } catch {
8443
- throw Ru("An invalid or illegal string was specified");
8426
+ throw Mu("An invalid or illegal string was specified");
8444
8427
  }
8445
- F(this, Qe, Pu({
8446
- onEvent: P(this, Un),
8447
- onRetry: P(this, Ln)
8448
- })), F(this, ue, this.CONNECTING), F(this, bt, 3e3), F(this, qt, (r = t == null ? void 0 : t.fetch) != null ? r : globalThis.fetch), F(this, Dt, (s = t == null ? void 0 : t.withCredentials) != null ? s : !1), Ae(this, we, xn).call(this);
8428
+ F(this, Qe, Iu({
8429
+ onEvent: P(this, Dn),
8430
+ onRetry: P(this, Un)
8431
+ })), F(this, ue, this.CONNECTING), F(this, bt, 3e3), F(this, qt, (r = t == null ? void 0 : t.fetch) != null ? r : globalThis.fetch), F(this, Dt, (s = t == null ? void 0 : t.withCredentials) != null ? s : !1), Ae(this, we, jn).call(this);
8449
8432
  }
8450
8433
  /**
8451
8434
  * Returns the state of this EventSource object's connection. It can have the values described below.
@@ -8523,15 +8506,15 @@ ue = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), Ge = /*
8523
8506
  *
8524
8507
  * @internal
8525
8508
  */
8526
- xn = function() {
8527
- F(this, ue, this.CONNECTING), F(this, Pe, new AbortController()), P(this, qt)(P(this, De), Ae(this, we, ns).call(this)).then(P(this, $n)).catch(P(this, Dn));
8528
- }, $n = /* @__PURE__ */ new WeakMap(), Dn = /* @__PURE__ */ new WeakMap(), /**
8509
+ jn = function() {
8510
+ F(this, ue, this.CONNECTING), F(this, Pe, new AbortController()), P(this, qt)(P(this, De), Ae(this, we, ts).call(this)).then(P(this, xn)).catch(P(this, $n));
8511
+ }, xn = /* @__PURE__ */ new WeakMap(), $n = /* @__PURE__ */ new WeakMap(), /**
8529
8512
  * Get request options for the `fetch()` request
8530
8513
  *
8531
8514
  * @returns The request options
8532
8515
  * @internal
8533
8516
  */
8534
- ns = function() {
8517
+ ts = function() {
8535
8518
  var n;
8536
8519
  const e = {
8537
8520
  // [spec] Let `corsAttributeState` be `Anonymous`…
@@ -8543,7 +8526,7 @@ ns = function() {
8543
8526
  signal: (n = P(this, Pe)) == null ? void 0 : n.signal
8544
8527
  };
8545
8528
  return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
8546
- }, Un = /* @__PURE__ */ new WeakMap(), Ln = /* @__PURE__ */ new WeakMap(), /**
8529
+ }, Dn = /* @__PURE__ */ new WeakMap(), Un = /* @__PURE__ */ new WeakMap(), /**
8547
8530
  * Handles the process referred to in the EventSource specification as "failing a connection".
8548
8531
  *
8549
8532
  * @param error - The error causing the connection to fail
@@ -8553,7 +8536,7 @@ ns = function() {
8553
8536
  dt = function(n, e) {
8554
8537
  var t;
8555
8538
  P(this, ue) !== this.CLOSED && F(this, ue, this.CLOSED);
8556
- const r = new es("error", { code: e, message: n });
8539
+ const r = new Xr("error", { code: e, message: n });
8557
8540
  (t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r);
8558
8541
  }, /**
8559
8542
  * Schedules a reconnection attempt against the EventSource endpoint.
@@ -8562,14 +8545,14 @@ dt = function(n, e) {
8562
8545
  * @param code - The HTTP status code, if available
8563
8546
  * @internal
8564
8547
  */
8565
- Fn = function(n, e) {
8548
+ Ln = function(n, e) {
8566
8549
  var t;
8567
8550
  if (P(this, ue) === this.CLOSED)
8568
8551
  return;
8569
8552
  F(this, ue, this.CONNECTING);
8570
- const r = new es("error", { code: e, message: n });
8571
- (t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r), F(this, Je, setTimeout(P(this, Nn), P(this, bt)));
8572
- }, Nn = /* @__PURE__ */ new WeakMap(), /**
8553
+ const r = new Xr("error", { code: e, message: n });
8554
+ (t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r), F(this, Je, setTimeout(P(this, Fn), P(this, bt)));
8555
+ }, Fn = /* @__PURE__ */ new WeakMap(), /**
8573
8556
  * ReadyState representing an EventSource currently trying to connect
8574
8557
  *
8575
8558
  * @public
@@ -8585,24 +8568,24 @@ Ut.OPEN = 1, /**
8585
8568
  * @public
8586
8569
  */
8587
8570
  Ut.CLOSED = 2;
8588
- function ju() {
8571
+ function Ru() {
8589
8572
  const n = "document" in globalThis ? globalThis.document : void 0;
8590
8573
  return n && typeof n == "object" && "baseURI" in n && typeof n.baseURI == "string" ? n.baseURI : void 0;
8591
8574
  }
8592
- class Qs extends $t {
8575
+ class Gs extends $t {
8593
8576
  }
8594
- h(Qs, "EventSourceImpl", Ut);
8595
- function xu(n) {
8577
+ h(Gs, "EventSourceImpl", Ut);
8578
+ function ju(n) {
8596
8579
  const e = {
8597
8580
  ...n,
8598
8581
  useDateObjects: n.useDateObjects ?? !1
8599
8582
  };
8600
- return new Qs(e, {
8601
- "@instantdb/react": er
8583
+ return new Gs(e, {
8584
+ "@instantdb/react": Xn
8602
8585
  });
8603
8586
  }
8604
- const zu = xu;
8605
- function Vu({
8587
+ const qu = ju;
8588
+ function zu({
8606
8589
  as: n = "div",
8607
8590
  spaceId: e,
8608
8591
  room: t,
@@ -8654,7 +8637,7 @@ function Vu({
8654
8637
  [l]: void 0
8655
8638
  });
8656
8639
  }
8657
- return Si(
8640
+ return Ti(
8658
8641
  n,
8659
8642
  {
8660
8643
  onMouseMove: b,
@@ -8673,9 +8656,9 @@ function Vu({
8673
8656
  "div",
8674
8657
  {
8675
8658
  style: {
8676
- ...rs,
8677
- ...Du,
8678
- zIndex: u !== void 0 ? u : Uu
8659
+ ...ns,
8660
+ ...$u,
8661
+ zIndex: u !== void 0 ? u : Du
8679
8662
  },
8680
8663
  children: Object.entries(f.peers).map(([g, w]) => {
8681
8664
  const O = w[l];
@@ -8683,7 +8666,7 @@ function Vu({
8683
8666
  "div",
8684
8667
  {
8685
8668
  style: {
8686
- ...rs,
8669
+ ...ns,
8687
8670
  transform: `translate(${O.xPercent}%, ${O.yPercent}%)`,
8688
8671
  transformOrigin: "0 0",
8689
8672
  transition: "transform 100ms"
@@ -8691,7 +8674,7 @@ function Vu({
8691
8674
  children: a ? a({
8692
8675
  color: O.color,
8693
8676
  presence: p == null ? void 0 : p.peers[g]
8694
- }) : /* @__PURE__ */ X.jsx($u, { ...O })
8677
+ }) : /* @__PURE__ */ X.jsx(xu, { ...O })
8695
8678
  },
8696
8679
  g
8697
8680
  ) : null;
@@ -8702,7 +8685,7 @@ function Vu({
8702
8685
  ]
8703
8686
  );
8704
8687
  }
8705
- function $u({ color: n }) {
8688
+ function xu({ color: n }) {
8706
8689
  const t = n || "black";
8707
8690
  return /* @__PURE__ */ X.jsxs(
8708
8691
  "svg",
@@ -8749,30 +8732,30 @@ function $u({ color: n }) {
8749
8732
  }
8750
8733
  );
8751
8734
  }
8752
- const rs = {
8735
+ const ns = {
8753
8736
  position: "absolute",
8754
8737
  top: 0,
8755
8738
  left: 0,
8756
8739
  bottom: 0,
8757
8740
  right: 0
8758
- }, Du = {
8741
+ }, $u = {
8759
8742
  overflow: "hidden",
8760
8743
  pointerEvents: "none",
8761
8744
  userSelect: "none"
8762
- }, Uu = 99999;
8745
+ }, Du = 99999;
8763
8746
  export {
8764
- Vu as Cursors,
8747
+ zu as Cursors,
8765
8748
  Bt as InstantAPIError,
8766
8749
  $t as InstantReactAbstractDatabase,
8767
- Qs as InstantReactWebDatabase,
8768
- Wa as StoreInterface,
8750
+ Gs as InstantReactWebDatabase,
8751
+ Na as StoreInterface,
8769
8752
  xe as SyncTableCallbackEventType,
8770
- qu as createInstantRouteHandler,
8771
- Ku as i,
8753
+ Ku as createInstantRouteHandler,
8754
+ Wu as i,
8772
8755
  N as id,
8773
- xu as init,
8774
- zu as init_experimental,
8775
- da as lookup,
8776
- Nu as setInstantWarningsEnabled,
8777
- Wu as tx
8756
+ ju as init,
8757
+ qu as init_experimental,
8758
+ fa as lookup,
8759
+ Fu as setInstantWarningsEnabled,
8760
+ Nu as tx
8778
8761
  };