@instantdb/react 0.22.86-experimental.split-store.20178922132.1 → 0.22.86-experimental.split-store.20183617880.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import oi, { useRef as ot, useCallback as ge, useSyncExternalStore as en, useEffect as Ee, useMemo as tn, useState as ai, createElement as Os } from "react";
1
+ import oi, { useRef as ot, useCallback as we, useSyncExternalStore as en, useEffect as ke, useMemo as tn, useState as ai, createElement as Os } from "react";
2
2
  function B(t) {
3
3
  if (typeof t == "number")
4
4
  return (Math.abs(t * 2654435761) >>> 0).toString(16);
@@ -37,11 +37,11 @@ function B(t) {
37
37
  }
38
38
  return B(String(t));
39
39
  }
40
- const U = {
40
+ const L = {
41
41
  Remove: "remove",
42
42
  Replace: "replace",
43
43
  Add: "add"
44
- }, ui = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Es = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), mt = Symbol.iterator, ne = {
44
+ }, ui = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Es = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), vt = Symbol.iterator, ne = {
45
45
  mutable: "mutable",
46
46
  immutable: "immutable"
47
47
  }, In = {};
@@ -69,7 +69,7 @@ function te(t) {
69
69
  var e;
70
70
  return (e = t.copy) !== null && e !== void 0 ? e : t.original;
71
71
  }
72
- function Ae(t) {
72
+ function je(t) {
73
73
  return !!j(t);
74
74
  }
75
75
  function j(t) {
@@ -88,7 +88,7 @@ function ae(t, e) {
88
88
  }
89
89
  function ci(t, e = []) {
90
90
  if (Object.hasOwnProperty.call(t, "key")) {
91
- const n = t.parent.copy, r = j(be(n, t.key));
91
+ const n = t.parent.copy, r = j(_e(n, t.key));
92
92
  if (r !== null && (r == null ? void 0 : r.original) !== t.original)
93
93
  return null;
94
94
  const i = t.parent.type === 3, s = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
@@ -106,20 +106,20 @@ function ci(t, e = []) {
106
106
  }
107
107
  return e;
108
108
  }
109
- function ke(t) {
109
+ function Ce(t) {
110
110
  return Array.isArray(t) ? 1 : t instanceof Map ? 2 : t instanceof Set ? 3 : 0;
111
111
  }
112
- function be(t, e) {
113
- return ke(t) === 2 ? t.get(e) : t[e];
112
+ function _e(t, e) {
113
+ return Ce(t) === 2 ? t.get(e) : t[e];
114
114
  }
115
115
  function ut(t, e, n) {
116
- ke(t) === 2 ? t.set(e, n) : t[e] = n;
116
+ Ce(t) === 2 ? t.set(e, n) : t[e] = n;
117
117
  }
118
118
  function Qt(t, e) {
119
119
  const n = j(t);
120
120
  return (n ? te(n) : t)[e];
121
121
  }
122
- function ye(t, e) {
122
+ function be(t, e) {
123
123
  return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
124
124
  }
125
125
  function nn(t) {
@@ -127,7 +127,7 @@ function nn(t) {
127
127
  for (; t.finalities.revoke.length > 0; )
128
128
  t.finalities.revoke.pop()();
129
129
  }
130
- function Oe(t, e) {
130
+ function Ee(t, e) {
131
131
  return e ? t : [""].concat(t).map((n) => {
132
132
  const r = `${n}`;
133
133
  return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
@@ -136,7 +136,7 @@ function Oe(t, e) {
136
136
  function As(t, e) {
137
137
  for (let n = 0; n < e.length - 1; n += 1) {
138
138
  const r = e[n];
139
- if (t = be(ke(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
139
+ if (t = _e(Ce(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
140
140
  throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
141
141
  }
142
142
  return t;
@@ -225,8 +225,8 @@ function Ye(t) {
225
225
  e[n] = Ye(t[n]);
226
226
  return e;
227
227
  }
228
- function vt(t) {
229
- return Ae(t) ? Ye(t) : t;
228
+ function St(t) {
229
+ return je(t) ? Ye(t) : t;
230
230
  }
231
231
  function fe(t) {
232
232
  var e;
@@ -235,7 +235,7 @@ function fe(t) {
235
235
  function br() {
236
236
  throw new Error("Cannot modify frozen object");
237
237
  }
238
- function Pe(t, e, n, r, i) {
238
+ function Re(t, e, n, r, i) {
239
239
  {
240
240
  n = n ?? /* @__PURE__ */ new WeakMap(), r = r ?? [], i = i ?? [];
241
241
  const o = n.has(t) ? n.get(t) : t;
@@ -252,37 +252,37 @@ function Pe(t, e, n, r, i) {
252
252
  } else
253
253
  r.push(o);
254
254
  }
255
- if (Object.isFrozen(t) || Ae(t)) {
255
+ if (Object.isFrozen(t) || je(t)) {
256
256
  r.pop(), i.pop();
257
257
  return;
258
258
  }
259
- switch (ke(t)) {
259
+ switch (Ce(t)) {
260
260
  case 2:
261
261
  for (const [a, u] of t)
262
- Pe(a, a, n, r, i), Pe(u, a, n, r, i);
262
+ Re(a, a, n, r, i), Re(u, a, n, r, i);
263
263
  t.set = t.clear = t.delete = br;
264
264
  break;
265
265
  case 3:
266
266
  for (const a of t)
267
- Pe(a, a, n, r, i);
267
+ Re(a, a, n, r, i);
268
268
  t.add = t.clear = t.delete = br;
269
269
  break;
270
270
  case 1:
271
271
  Object.freeze(t);
272
272
  let o = 0;
273
273
  for (const a of t)
274
- Pe(a, o, n, r, i), o += 1;
274
+ Re(a, o, n, r, i), o += 1;
275
275
  break;
276
276
  default:
277
277
  Object.freeze(t), Object.keys(t).forEach((a) => {
278
278
  const u = t[a];
279
- Pe(u, a, n, r, i);
279
+ Re(u, a, n, r, i);
280
280
  });
281
281
  }
282
282
  r.pop(), i.pop();
283
283
  }
284
284
  function xn(t, e) {
285
- const n = ke(t);
285
+ const n = Ce(t);
286
286
  if (n === 0)
287
287
  Reflect.ownKeys(t).forEach((r) => {
288
288
  e(r, t[r], t);
@@ -295,12 +295,12 @@ function xn(t, e) {
295
295
  t.forEach((r, i) => e(i, r, t));
296
296
  }
297
297
  function fi(t, e, n) {
298
- if (Ae(t) || !ae(t, n) || e.has(t) || Object.isFrozen(t))
298
+ if (je(t) || !ae(t, n) || e.has(t) || Object.isFrozen(t))
299
299
  return;
300
300
  const r = t instanceof Set, i = r ? /* @__PURE__ */ new Map() : void 0;
301
301
  if (e.add(t), xn(t, (s, o) => {
302
302
  var a;
303
- if (Ae(o)) {
303
+ if (je(o)) {
304
304
  const u = j(o);
305
305
  Q(u);
306
306
  const c = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
@@ -316,7 +316,7 @@ function fi(t, e, n) {
316
316
  }
317
317
  function Cs(t, e) {
318
318
  const n = t.type === 3 ? t.setMap : t.copy;
319
- t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && fi(be(n, e), t.finalities.handledSet, t.options);
319
+ t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && fi(_e(n, e), t.finalities.handledSet, t.options);
320
320
  }
321
321
  function rn(t) {
322
322
  t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
@@ -337,13 +337,13 @@ function $n(t, e, n, r) {
337
337
  i && (i.callbacks || (i.callbacks = []), i.callbacks.push((s, o) => {
338
338
  var a;
339
339
  const u = t.type === 3 ? t.setMap : t.copy;
340
- if (ye(be(u, e), n)) {
340
+ if (be(_e(u, e), n)) {
341
341
  let c = i.original;
342
342
  i.copy && (c = i.copy), rn(t), sn(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(c, i.original)), ut(u, e, c);
343
343
  }
344
344
  }), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ae(n, t.options) && t.finalities.draft.push(() => {
345
345
  const s = t.type === 3 ? t.setMap : t.copy;
346
- ye(be(s, e), n) && Cs(t, e);
346
+ be(_e(s, e), n) && Cs(t, e);
347
347
  });
348
348
  }
349
349
  function Is(t, e, n, r, i) {
@@ -351,42 +351,42 @@ function Is(t, e, n, r, i) {
351
351
  u.length < s.length && ([s, u] = [u, s], [n, r] = [r, n]);
352
352
  for (let c = 0; c < s.length; c += 1)
353
353
  if (o.get(c.toString()) && u[c] !== s[c]) {
354
- const d = e.concat([c]), f = Oe(d, i);
354
+ const d = e.concat([c]), f = Ee(d, i);
355
355
  n.push({
356
- op: U.Replace,
356
+ op: L.Replace,
357
357
  path: f,
358
358
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
359
- value: vt(u[c])
359
+ value: St(u[c])
360
360
  }), r.push({
361
- op: U.Replace,
361
+ op: L.Replace,
362
362
  path: f,
363
363
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
364
- value: vt(s[c])
364
+ value: St(s[c])
365
365
  });
366
366
  }
367
367
  for (let c = s.length; c < u.length; c += 1) {
368
- const d = e.concat([c]), f = Oe(d, i);
368
+ const d = e.concat([c]), f = Ee(d, i);
369
369
  n.push({
370
- op: U.Add,
370
+ op: L.Add,
371
371
  path: f,
372
372
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
373
- value: vt(u[c])
373
+ value: St(u[c])
374
374
  });
375
375
  }
376
376
  if (s.length < u.length) {
377
377
  const { arrayLengthAssignment: c = !0 } = a.enablePatches;
378
378
  if (c) {
379
- const d = e.concat(["length"]), f = Oe(d, i);
379
+ const d = e.concat(["length"]), f = Ee(d, i);
380
380
  r.push({
381
- op: U.Replace,
381
+ op: L.Replace,
382
382
  path: f,
383
383
  value: s.length
384
384
  });
385
385
  } else
386
386
  for (let d = u.length; s.length < d; d -= 1) {
387
- const f = e.concat([d - 1]), l = Oe(f, i);
387
+ const f = e.concat([d - 1]), l = Ee(f, i);
388
388
  r.push({
389
- op: U.Remove,
389
+ op: L.Remove,
390
390
  path: l
391
391
  });
392
392
  }
@@ -394,24 +394,24 @@ function Is(t, e, n, r, i) {
394
394
  }
395
395
  function Ps({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
396
396
  n.forEach((a, u) => {
397
- const c = be(t, u), d = vt(be(e, u)), f = a ? tt(t, u) ? U.Replace : U.Add : U.Remove;
398
- if (ye(c, d) && f === U.Replace)
397
+ const c = _e(t, u), d = St(_e(e, u)), f = a ? tt(t, u) ? L.Replace : L.Add : L.Remove;
398
+ if (be(c, d) && f === L.Replace)
399
399
  return;
400
- const l = r.concat(u), p = Oe(l, o);
401
- i.push(f === U.Remove ? { op: f, path: p } : { op: f, path: p, value: d }), s.push(f === U.Add ? { op: U.Remove, path: p } : f === U.Remove ? { op: U.Add, path: p, value: c } : { op: U.Replace, path: p, value: c });
400
+ const l = r.concat(u), p = Ee(l, o);
401
+ i.push(f === L.Remove ? { op: f, path: p } : { op: f, path: p, value: d }), s.push(f === L.Add ? { op: L.Remove, path: p } : f === L.Remove ? { op: L.Add, path: p, value: c } : { op: L.Replace, path: p, value: c });
402
402
  });
403
403
  }
404
404
  function Ms({ original: t, copy: e }, n, r, i, s) {
405
405
  let o = 0;
406
406
  t.forEach((a) => {
407
407
  if (!e.has(a)) {
408
- const u = n.concat([o]), c = Oe(u, s);
408
+ const u = n.concat([o]), c = Ee(u, s);
409
409
  r.push({
410
- op: U.Remove,
410
+ op: L.Remove,
411
411
  path: c,
412
412
  value: a
413
413
  }), i.unshift({
414
- op: U.Add,
414
+ op: L.Add,
415
415
  path: c,
416
416
  value: a
417
417
  });
@@ -419,13 +419,13 @@ function Ms({ original: t, copy: e }, n, r, i, s) {
419
419
  o += 1;
420
420
  }), o = 0, e.forEach((a) => {
421
421
  if (!t.has(a)) {
422
- const u = n.concat([o]), c = Oe(u, s);
422
+ const u = n.concat([o]), c = Ee(u, s);
423
423
  r.push({
424
- op: U.Add,
424
+ op: L.Add,
425
425
  path: c,
426
426
  value: a
427
427
  }), i.unshift({
428
- op: U.Remove,
428
+ op: L.Remove,
429
429
  path: c,
430
430
  value: a
431
431
  });
@@ -445,7 +445,7 @@ function at(t, e, n, r) {
445
445
  return Ms(t, e, n, r, i);
446
446
  }
447
447
  }
448
- const kt = (t, e, n = !1) => {
448
+ const jt = (t, e, n = !1) => {
449
449
  if (typeof t == "object" && t !== null && (!ae(t, e) || n))
450
450
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
451
451
  }, on = {
@@ -457,7 +457,7 @@ const kt = (t, e, n = !1) => {
457
457
  },
458
458
  set(t, e) {
459
459
  const n = j(this), r = te(n);
460
- return (!r.has(t) || !ye(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), $n(n, t, e, at)), this;
460
+ return (!r.has(t) || !be(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), $n(n, t, e, at)), this;
461
461
  },
462
462
  delete(t) {
463
463
  if (!this.has(t))
@@ -483,7 +483,7 @@ const kt = (t, e, n = !1) => {
483
483
  get(t) {
484
484
  var e, n;
485
485
  const r = j(this), i = te(r).get(t), s = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, i, ne)) === ne.mutable;
486
- if (r.options.strict && kt(i, r.options, s), s || r.finalized || !ae(i, r.options) || i !== r.original.get(t))
486
+ if (r.options.strict && jt(i, r.options, s), s || r.finalized || !ae(i, r.options) || i !== r.original.get(t))
487
487
  return i;
488
488
  const o = In.createDraft({
489
489
  original: i,
@@ -500,7 +500,7 @@ const kt = (t, e, n = !1) => {
500
500
  values() {
501
501
  const t = this.keys();
502
502
  return {
503
- [mt]: () => this.values(),
503
+ [vt]: () => this.values(),
504
504
  next: () => {
505
505
  const e = t.next();
506
506
  return e.done ? e : {
@@ -513,7 +513,7 @@ const kt = (t, e, n = !1) => {
513
513
  entries() {
514
514
  const t = this.keys();
515
515
  return {
516
- [mt]: () => this.entries(),
516
+ [vt]: () => this.entries(),
517
517
  next: () => {
518
518
  const e = t.next();
519
519
  if (e.done)
@@ -526,7 +526,7 @@ const kt = (t, e, n = !1) => {
526
526
  }
527
527
  };
528
528
  },
529
- [mt]() {
529
+ [vt]() {
530
530
  return this.entries();
531
531
  }
532
532
  }, Rs = Reflect.ownKeys(on), _r = (t, e, { isValuesIterator: n }) => () => {
@@ -537,7 +537,7 @@ const kt = (t, e, n = !1) => {
537
537
  const o = s.value;
538
538
  let a = t.setMap.get(o);
539
539
  const u = j(a), c = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, a, ne)) === ne.mutable;
540
- if (t.options.strict && kt(o, t.options, c), !c && !u && ae(o, t.options) && !t.finalized && t.original.has(o)) {
540
+ if (t.options.strict && jt(o, t.options, c), !c && !u && ae(o, t.options) && !t.finalized && t.original.has(o)) {
541
541
  const d = In.createDraft({
542
542
  original: o,
543
543
  parentDraft: t,
@@ -551,7 +551,7 @@ const kt = (t, e, n = !1) => {
551
551
  done: !1,
552
552
  value: n ? a : [a, a]
553
553
  };
554
- }, jt = {
554
+ }, Ct = {
555
555
  get size() {
556
556
  return j(this).setMap.size;
557
557
  },
@@ -607,7 +607,7 @@ const kt = (t, e, n = !1) => {
607
607
  keys() {
608
608
  return this.values();
609
609
  },
610
- [mt]() {
610
+ [vt]() {
611
611
  return this.values();
612
612
  },
613
613
  forEach(t, e) {
@@ -617,7 +617,7 @@ const kt = (t, e, n = !1) => {
617
617
  t.call(e, r.value, r.value, this), r = n.next();
618
618
  }
619
619
  };
620
- Set.prototype.difference && Object.assign(jt, {
620
+ Set.prototype.difference && Object.assign(Ct, {
621
621
  intersection(t) {
622
622
  return Set.prototype.intersection.call(new Set(this.values()), t);
623
623
  },
@@ -640,7 +640,7 @@ Set.prototype.difference && Object.assign(jt, {
640
640
  return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
641
641
  }
642
642
  });
643
- const xs = Reflect.ownKeys(jt), li = /* @__PURE__ */ new WeakSet(), hi = {
643
+ const xs = Reflect.ownKeys(Ct), li = /* @__PURE__ */ new WeakSet(), hi = {
644
644
  get(t, e, n) {
645
645
  var r, i;
646
646
  const s = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
@@ -652,7 +652,7 @@ const xs = Reflect.ownKeys(jt), li = /* @__PURE__ */ new WeakSet(), hi = {
652
652
  if (t.options.mark) {
653
653
  const c = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, n);
654
654
  if (o = t.options.mark(c, ne), o === ne.mutable)
655
- return t.options.strict && kt(c, t.options, !0), c;
655
+ return t.options.strict && jt(c, t.options, !0), c;
656
656
  }
657
657
  const a = te(t);
658
658
  if (a instanceof Map && Rs.includes(e)) {
@@ -664,8 +664,8 @@ const xs = Reflect.ownKeys(jt), li = /* @__PURE__ */ new WeakSet(), hi = {
664
664
  }
665
665
  if (a instanceof Set && xs.includes(e)) {
666
666
  if (e === "size")
667
- return Object.getOwnPropertyDescriptor(jt, "size").get.call(t.proxy);
668
- const c = jt[e];
667
+ return Object.getOwnPropertyDescriptor(Ct, "size").get.call(t.proxy);
668
+ const c = Ct[e];
669
669
  if (c)
670
670
  return c.bind(t.proxy);
671
671
  }
@@ -677,7 +677,7 @@ const xs = Reflect.ownKeys(jt), li = /* @__PURE__ */ new WeakSet(), hi = {
677
677
  ) : void 0;
678
678
  }
679
679
  const u = a[e];
680
- if (t.options.strict && kt(u, t.options), t.finalized || !ae(u, t.options))
680
+ if (t.options.strict && jt(u, t.options), t.finalized || !ae(u, t.options))
681
681
  return u;
682
682
  if (u === Qt(t.original, e)) {
683
683
  if (Q(t), t.copy[e] = Dn({
@@ -705,7 +705,7 @@ const xs = Reflect.ownKeys(jt), li = /* @__PURE__ */ new WeakSet(), hi = {
705
705
  if (s != null && s.set)
706
706
  return s.set.call(t.proxy, n), !0;
707
707
  const o = Qt(te(t), e), a = j(o);
708
- return a && ye(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ye(n, o) && (n !== void 0 || tt(t.original, e)) || (Q(t), fe(t), tt(t.original, e) && ye(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, $n(t, e, n, at)), !0);
708
+ return a && be(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (be(n, o) && (n !== void 0 || tt(t.original, e)) || (Q(t), fe(t), tt(t.original, e) && be(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, $n(t, e, n, at)), !0);
709
709
  },
710
710
  has(t, e) {
711
711
  return e in te(t);
@@ -737,7 +737,7 @@ const xs = Reflect.ownKeys(jt), li = /* @__PURE__ */ new WeakSet(), hi = {
737
737
  }
738
738
  };
739
739
  function Dn(t) {
740
- const { original: e, parentDraft: n, key: r, finalities: i, options: s } = t, o = ke(e), a = {
740
+ const { original: e, parentDraft: n, key: r, finalities: i, options: s } = t, o = Ce(e), a = {
741
741
  type: o,
742
742
  finalized: !1,
743
743
  parent: n,
@@ -757,7 +757,7 @@ function Dn(t) {
757
757
  var p, y;
758
758
  const b = j(u);
759
759
  let _ = d.type === 3 ? d.setMap : d.copy;
760
- const T = be(_, r), g = j(T);
760
+ const T = _e(_, r), g = j(T);
761
761
  if (g) {
762
762
  let m = g.original;
763
763
  g.operated && (m = Rn(T)), rn(g), sn(g, at, f, l), d.options.enableAutoFreeze && (d.options.updatedValues = (p = d.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), d.options.updatedValues.set(m, g.original)), ut(_, r, m);
@@ -782,10 +782,10 @@ function $s(t, e, n, r, i) {
782
782
  for (; o.finalities.draft.length > 0; )
783
783
  o.finalities.draft.pop()(n, r);
784
784
  const c = u ? e[0] : o ? o.operated ? o.copy : o.original : t;
785
- return o && nn(o), i && Pe(c, c, o == null ? void 0 : o.options.updatedValues), [
785
+ return o && nn(o), i && Re(c, c, o == null ? void 0 : o.options.updatedValues), [
786
786
  c,
787
- n && u ? [{ op: U.Replace, path: [], value: e[0] }] : n,
788
- r && u ? [{ op: U.Replace, path: [], value: a }] : r
787
+ n && u ? [{ op: L.Replace, path: [], value: e[0] }] : n,
788
+ r && u ? [{ op: L.Replace, path: [], value: a }] : r
789
789
  ];
790
790
  }
791
791
  function Ds(t, e) {
@@ -831,7 +831,7 @@ function pi(t) {
831
831
  const n = j(t);
832
832
  if (!ae(t, n == null ? void 0 : n.options))
833
833
  return t;
834
- const r = ke(t);
834
+ const r = Ce(t);
835
835
  if (n && !n.operated)
836
836
  return n.original;
837
837
  let i;
@@ -848,7 +848,7 @@ function pi(t) {
848
848
  } else
849
849
  i = t;
850
850
  if (xn(i, (o, a) => {
851
- if (n && ye(be(n.original, o), a))
851
+ if (n && be(_e(n.original, o), a))
852
852
  return;
853
853
  const u = pi(a);
854
854
  u !== a && (i === t && s(), ut(i, o, u));
@@ -859,7 +859,7 @@ function pi(t) {
859
859
  return i;
860
860
  }
861
861
  function gr(t) {
862
- if (!Ae(t))
862
+ if (!je(t))
863
863
  throw new Error(`current() is only used for Draft, parameter: ${t}`);
864
864
  return pi(t);
865
865
  }
@@ -867,20 +867,20 @@ const Us = (t) => function e(n, r, i) {
867
867
  var s, o, a;
868
868
  if (typeof n == "function" && typeof r != "function")
869
869
  return function(S, ...C) {
870
- return e(S, (x) => n.call(this, x, ...C), r);
870
+ return e(S, ($) => n.call(this, $, ...C), r);
871
871
  };
872
872
  const u = n, c = r;
873
873
  let d = i;
874
874
  if (typeof r != "function" && (d = r), d !== void 0 && Object.prototype.toString.call(d) !== "[object Object]")
875
875
  throw new Error(`Invalid options: ${d}, 'options' should be an object.`);
876
876
  d = Object.assign(Object.assign({}, t), d);
877
- const f = Ae(u) ? gr(u) : u, l = Array.isArray(d.mark) ? (S, C) => {
878
- for (const x of d.mark) {
879
- if (typeof x != "function")
880
- throw new Error(`Invalid mark: ${x}, 'mark' should be a function.`);
881
- const K = x(S, C);
882
- if (K)
883
- return K;
877
+ const f = je(u) ? gr(u) : u, l = Array.isArray(d.mark) ? (S, C) => {
878
+ for (const $ of d.mark) {
879
+ if (typeof $ != "function")
880
+ throw new Error(`Invalid mark: ${$}, 'mark' should be a function.`);
881
+ const D = $(S, C);
882
+ if (D)
883
+ return D;
884
884
  }
885
885
  } : d.mark, p = (s = d.enablePatches) !== null && s !== void 0 ? s : !1, y = (o = d.strict) !== null && o !== void 0 ? o : !1, _ = {
886
886
  enableAutoFreeze: (a = d.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
@@ -904,26 +904,26 @@ const Us = (t) => function e(n, r, i) {
904
904
  }
905
905
  const O = (S) => {
906
906
  const C = j(T);
907
- if (!Ae(S)) {
908
- if (S !== void 0 && !ye(S, T) && (C != null && C.operated))
907
+ if (!je(S)) {
908
+ if (S !== void 0 && !be(S, T) && (C != null && C.operated))
909
909
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
910
- const K = S == null ? void 0 : S[Es];
911
- if (K) {
912
- const ze = K[0];
910
+ const D = S == null ? void 0 : S[Es];
911
+ if (D) {
912
+ const Ve = D[0];
913
913
  return _.strict && typeof S == "object" && S !== null && an({
914
914
  rootDraft: C,
915
915
  value: S,
916
916
  useRawReturn: !0
917
- }), g([ze]);
917
+ }), g([Ve]);
918
918
  }
919
919
  if (S !== void 0)
920
920
  return typeof S == "object" && S !== null && an({ rootDraft: C, value: S }), g([S]);
921
921
  }
922
922
  if (S === T || S === void 0)
923
923
  return g([]);
924
- const x = j(S);
925
- if (_ === x.options) {
926
- if (x.operated)
924
+ const $ = j(S);
925
+ if (_ === $.options) {
926
+ if ($.operated)
927
927
  throw new Error("Cannot return a modified child draft.");
928
928
  return g([gr(S)]);
929
929
  }
@@ -932,7 +932,7 @@ const Us = (t) => function e(n, r, i) {
932
932
  return m instanceof Promise ? m.then(O, (S) => {
933
933
  throw nn(j(T)), S;
934
934
  }) : O(m);
935
- }, Ct = Us();
935
+ }, It = Us();
936
936
  Object.prototype.constructor.toString();
937
937
  function yi(t, e) {
938
938
  const n = Object.keys(t), r = Object.keys(e);
@@ -941,8 +941,8 @@ function yi(t, e) {
941
941
  function wr(t, e) {
942
942
  return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((n) => e.hasOwnProperty(n) && t[n] === e[n]);
943
943
  }
944
- function St(t, e) {
945
- return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : yi(t, e) ? Object.keys(t).every((n) => St(t[n], e[n])) : !1;
944
+ function Ot(t, e) {
945
+ return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : yi(t, e) ? Object.keys(t).every((n) => Ot(t[n], e[n])) : !1;
946
946
  }
947
947
  function Un(t) {
948
948
  if (!Je(t))
@@ -1315,7 +1315,7 @@ function no(t) {
1315
1315
  return null;
1316
1316
  }
1317
1317
  }
1318
- function Rt(t) {
1318
+ function xt(t) {
1319
1319
  if (t !== void 0) {
1320
1320
  if (t === null)
1321
1321
  return null;
@@ -1331,9 +1331,9 @@ function Rt(t) {
1331
1331
  throw new Error(`Invalid date value \`${t}\`. Expected a date, number, or string, got type ${typeof t}.`);
1332
1332
  }
1333
1333
  }
1334
- class De {
1334
+ class Ae {
1335
1335
  constructor(e, n) {
1336
- this._blobAttrs = null, this._primaryKeys = null, this._forwardIdents = null, this._revIdents = null, console.log("attrs init", new Error("trace")), this.attrs = e, this.linkIndex = n;
1336
+ this._blobAttrs = null, this._primaryKeys = null, this._forwardIdents = null, this._revIdents = null, this.attrs = e, this.linkIndex = n;
1337
1337
  }
1338
1338
  resetAttrIndexes() {
1339
1339
  this._blobAttrs = null, this._primaryKeys = null, this._forwardIdents = null, this._revIdents = null;
@@ -1411,7 +1411,7 @@ function Ln(t) {
1411
1411
  function Fn(t) {
1412
1412
  return t["value-type"] === "blob";
1413
1413
  }
1414
- function qe(t, e) {
1414
+ function We(t, e) {
1415
1415
  return e.reduce((n, r) => n && n.get(r), t);
1416
1416
  }
1417
1417
  function oe(t, e) {
@@ -1444,7 +1444,7 @@ function gi(t, e, n) {
1444
1444
  console.warn("no such attr", u, a);
1445
1445
  continue;
1446
1446
  }
1447
- d["checked-data-type"] === "date" && n && (c = Rt(c), o[2] = c), Ln(d) && Z(s, [c, u, a], o), Z(r, [a, u, c], o), Z(i, [u, a, c], o);
1447
+ d["checked-data-type"] === "date" && n && (c = xt(c), o[2] = c), Ln(d) && Z(s, [c, u, a], o), Z(r, [a, u, c], o), Z(i, [u, a, c], o);
1448
1448
  }
1449
1449
  return { eav: r, aev: i, vae: s };
1450
1450
  }
@@ -1457,18 +1457,18 @@ function wi(t) {
1457
1457
  };
1458
1458
  }
1459
1459
  function Ti(t, e) {
1460
- return Ot(t, e.triples, e.cardinalityInference, e.useDateObjects);
1460
+ return Et(t, e.triples, e.cardinalityInference, e.useDateObjects);
1461
1461
  }
1462
1462
  function mi(t, e) {
1463
1463
  if (t)
1464
- return new De(t.attrs, t.linkIndex);
1464
+ return new Ae(t.attrs, t.linkIndex);
1465
1465
  if (e && "__type" in e)
1466
- return new De(e.attrs, e.linkIndex);
1466
+ return new Ae(e.attrs, e.linkIndex);
1467
1467
  }
1468
1468
  function io(t, e) {
1469
- return qe(t.eav, [e]) !== void 0;
1469
+ return We(t.eav, [e]) !== void 0;
1470
1470
  }
1471
- function Ot(t, e, n, r) {
1471
+ function Et(t, e, n, r) {
1472
1472
  const i = gi(t, e, r);
1473
1473
  return i.cardinalityInference = n, i.useDateObjects = r, i;
1474
1474
  }
@@ -1510,7 +1510,7 @@ let so = 0;
1510
1510
  function Si(t, e, n) {
1511
1511
  const [r, i, s] = n;
1512
1512
  let o;
1513
- const a = qe(t.eav, [r, i, s]);
1513
+ const a = We(t.eav, [r, i, s]);
1514
1514
  return a && (o = a[3]), o || Date.now() * 10 + so++;
1515
1515
  }
1516
1516
  function Oi(t, e, n) {
@@ -1522,8 +1522,8 @@ function Oi(t, e, n) {
1522
1522
  const u = e.getAttr(o);
1523
1523
  if (!u)
1524
1524
  return;
1525
- u["checked-data-type"] === "date" && t.useDateObjects && (a = Rt(a));
1526
- const c = qe(t.eav, [s, o, a]), d = (r = c == null ? void 0 : c[3]) !== null && r !== void 0 ? r : Si(t, u, i), f = [s, o, a, d];
1525
+ u["checked-data-type"] === "date" && t.useDateObjects && (a = xt(a));
1526
+ const c = We(t.eav, [s, o, a]), d = (r = c == null ? void 0 : c[3]) !== null && r !== void 0 ? r : Si(t, u, i), f = [s, o, a, d];
1527
1527
  ro(u) ? (Z(t.eav, [s, o], /* @__PURE__ */ new Map([[a, f]])), Z(t.aev, [o, s], /* @__PURE__ */ new Map([[a, f]]))) : (Z(t.eav, [s, o, a], f), Z(t.aev, [o, s, a], f)), Ln(u) && Z(t.vae, [a, o, s], f);
1528
1528
  }
1529
1529
  function oo(t, e, n) {
@@ -1536,7 +1536,7 @@ function oo(t, e, n) {
1536
1536
  return;
1537
1537
  if (!Fn(u))
1538
1538
  throw new Error("merge operation is not supported for links");
1539
- const c = qe(t.eav, [s, o]);
1539
+ const c = We(t.eav, [s, o]);
1540
1540
  if (!c)
1541
1541
  return;
1542
1542
  const d = (r = c.values().next()) === null || r === void 0 ? void 0 : r.value;
@@ -1642,7 +1642,7 @@ function X(t, e, n = []) {
1642
1642
  X(r, e - 1, n);
1643
1643
  return n;
1644
1644
  }
1645
- function _t(t, e, n) {
1645
+ function gt(t, e, n) {
1646
1646
  var r;
1647
1647
  const i = [];
1648
1648
  if (n != null && n.hasOwnProperty("$not")) {
@@ -1692,7 +1692,7 @@ function ho(t, [e, n, r]) {
1692
1692
  }
1693
1693
  case "eav": {
1694
1694
  const a = (s = t.eav.get(e)) === null || s === void 0 ? void 0 : s.get(n);
1695
- return a ? _t(t, a, r) : [];
1695
+ return a ? gt(t, a, r) : [];
1696
1696
  }
1697
1697
  case "ev": {
1698
1698
  const a = t.eav.get(e);
@@ -1700,7 +1700,7 @@ function ho(t, [e, n, r]) {
1700
1700
  return [];
1701
1701
  const u = [];
1702
1702
  for (const c of a.values())
1703
- u.push(..._t(t, c, r));
1703
+ u.push(...gt(t, c, r));
1704
1704
  return u;
1705
1705
  }
1706
1706
  case "a": {
@@ -1713,14 +1713,14 @@ function ho(t, [e, n, r]) {
1713
1713
  return [];
1714
1714
  const u = [];
1715
1715
  for (const c of a.values())
1716
- u.push(..._t(t, c, r));
1716
+ u.push(...gt(t, c, r));
1717
1717
  return u;
1718
1718
  }
1719
1719
  case "v": {
1720
1720
  const a = [];
1721
1721
  for (const u of t.eav.values())
1722
1722
  for (const c of u.values())
1723
- a.push(..._t(t, c, r));
1723
+ a.push(...gt(t, c, r));
1724
1724
  return a;
1725
1725
  }
1726
1726
  default:
@@ -1739,11 +1739,11 @@ function po(t, e, n) {
1739
1739
  }
1740
1740
  return i;
1741
1741
  }
1742
- function N(t, e, n) {
1742
+ function K(t, e, n) {
1743
1743
  var r;
1744
1744
  return (r = t.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
1745
1745
  }
1746
- function je(t, e, n) {
1746
+ function Ie(t, e, n) {
1747
1747
  var r;
1748
1748
  return (r = t.revIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
1749
1749
  }
@@ -1761,7 +1761,7 @@ function bo(t, e, n) {
1761
1761
  return;
1762
1762
  const [i, s, o] = r;
1763
1763
  if (e.getAttr(s))
1764
- return qe(t.eav, [i, s]);
1764
+ return We(t.eav, [i, s]);
1765
1765
  }
1766
1766
  function _o(t, e, n) {
1767
1767
  const r = n.filter(([i, s, o, a, u]) => {
@@ -1782,10 +1782,15 @@ function _o(t, e, n) {
1782
1782
  }
1783
1783
  return !(c === "create" && d || c === "update" && !d);
1784
1784
  });
1785
- return Ct(t, (i) => {
1785
+ return It({ store: t, attrsStore: e }, (i) => {
1786
1786
  r.forEach((s) => {
1787
- fo(i, e, s);
1787
+ fo(i.store, i.attrsStore, s);
1788
1788
  });
1789
+ }, {
1790
+ mark: (i) => {
1791
+ if (i instanceof Ae)
1792
+ return "immutable";
1793
+ }
1789
1794
  });
1790
1795
  }
1791
1796
  function go(t) {
@@ -1851,7 +1856,7 @@ function ko(t, e, n) {
1851
1856
  return ho(t, Nn(n, e));
1852
1857
  }
1853
1858
  const jo = /^(?:[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;
1854
- function Fe(t) {
1859
+ function Ne(t) {
1855
1860
  return typeof t == "string" && jo.test(t);
1856
1861
  }
1857
1862
  const z = [];
@@ -1917,12 +1922,12 @@ function Uo() {
1917
1922
  const Lo = Uo();
1918
1923
  let Fo = 0;
1919
1924
  function nt(t) {
1920
- return xt(`_${t}`, Fo++);
1925
+ return $t(`_${t}`, Fo++);
1921
1926
  }
1922
- function xt(t, e) {
1927
+ function $t(t, e) {
1923
1928
  return `?${t}-${e}`;
1924
1929
  }
1925
- class Ne extends Error {
1930
+ class Ke extends Error {
1926
1931
  constructor(e) {
1927
1932
  super(e), this.name = "AttrNotFoundError";
1928
1933
  }
@@ -1930,7 +1935,7 @@ class Ne extends Error {
1930
1935
  function No(t, e) {
1931
1936
  const n = ki(t, e);
1932
1937
  if (!n)
1933
- throw new Ne(`Could not find id attr for ${e}`);
1938
+ throw new Ke(`Could not find id attr for ${e}`);
1934
1939
  return n;
1935
1940
  }
1936
1941
  function Er(t, e, n, r) {
@@ -1948,9 +1953,9 @@ function qo(t, e, n) {
1948
1953
  return t.map((r) => r === e ? n : r);
1949
1954
  }
1950
1955
  function Ci(t, e, n, r, i) {
1951
- const s = N(e, n, i), o = je(e, n, i), a = s || o;
1956
+ const s = K(e, n, i), o = Ie(e, n, i), a = s || o;
1952
1957
  if (!a)
1953
- throw new Ne(`Could not find attr for ${[n, i]}`);
1958
+ throw new Ke(`Could not find attr for ${[n, i]}`);
1954
1959
  if (a["value-type"] !== "ref")
1955
1960
  throw new Error(`Attr ${a.id} is not a ref`);
1956
1961
  const [u, c] = a["forward-identity"], [d, f] = a["reverse-identity"], l = r + 1, p = s ? [
@@ -2037,13 +2042,13 @@ function Wo(t, e) {
2037
2042
  return e;
2038
2043
  }
2039
2044
  function zo(t, e, n, r, i, s) {
2040
- const o = N(e, n, i), a = je(e, n, i), u = o || a;
2045
+ const o = K(e, n, i), a = Ie(e, n, i), u = o || a;
2041
2046
  if (!u)
2042
- throw new Ne(`No attr for etype = ${n} label = ${i}`);
2047
+ throw new Ke(`No attr for etype = ${n} label = ${i}`);
2043
2048
  if (s != null && s.hasOwnProperty("$isNull")) {
2044
- const c = N(e, n, "id");
2049
+ const c = K(e, n, "id");
2045
2050
  if (!c)
2046
- throw new Ne(`No attr for etype = ${n} label = id`);
2051
+ throw new Ke(`No attr for etype = ${n} label = id`);
2047
2052
  return [
2048
2053
  t(n, r),
2049
2054
  c.id,
@@ -2133,7 +2138,7 @@ function Ii(t, e, n, r, i) {
2133
2138
  });
2134
2139
  }
2135
2140
  function Jo(t, e, n, r) {
2136
- const i = xt;
2141
+ const i = $t;
2137
2142
  return r ? Ii(i, t, e, n, r).concat(Er(i, t, e, n)) : Er(i, t, e, n);
2138
2143
  }
2139
2144
  function Zo(t, e, n) {
@@ -2158,7 +2163,7 @@ function ea(t, e, n, { etype: r, level: i, form: s }, o) {
2158
2163
  }), C = T ? S[0] : S;
2159
2164
  return { [p]: C };
2160
2165
  } catch (g) {
2161
- if (g instanceof Ne)
2166
+ if (g instanceof Ke)
2162
2167
  return { [p]: T ? void 0 : [] };
2163
2168
  throw g;
2164
2169
  }
@@ -2173,7 +2178,7 @@ function ta(t, e, n) {
2173
2178
  function Ze(t, e, n, r, i) {
2174
2179
  return e === r || e == null && r == null ? $o(t, n) : r == null ? 1 : e == null ? -1 : ta(e, r, i);
2175
2180
  }
2176
- function It([t, e], [n, r], i) {
2181
+ function Pt([t, e], [n, r], i) {
2177
2182
  return Ze(t, e, n, r, i);
2178
2183
  }
2179
2184
  function ln(t) {
@@ -2183,9 +2188,9 @@ function na(t, e, n, r) {
2183
2188
  var i;
2184
2189
  const [s, o, a, u] = t, c = n === "desc" ? 1 : -1;
2185
2190
  if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
2186
- return It(r, [s, u], null) === c;
2191
+ return Pt(r, [s, u], null) === c;
2187
2192
  const [d, f] = r, l = e["checked-data-type"], p = l === "date" ? ln(f) : f, y = l === "date" ? ln(a) : a;
2188
- return It([d, p], [s, y], l) === c;
2193
+ return Pt([d, p], [s, y], l) === c;
2189
2194
  }
2190
2195
  function ra(t, e) {
2191
2196
  const n = e[1];
@@ -2193,7 +2198,7 @@ function ra(t, e) {
2193
2198
  }
2194
2199
  function ia(t, e, n) {
2195
2200
  const r = Object.keys(n)[0];
2196
- return N(t, e, r);
2201
+ return K(t, e, r);
2197
2202
  }
2198
2203
  function sa(t, e, n, r) {
2199
2204
  if (n)
@@ -2207,11 +2212,11 @@ function oa(t, e, n) {
2207
2212
  return yo(t, e);
2208
2213
  const s = /* @__PURE__ */ new Map();
2209
2214
  for (const o of n.fields) {
2210
- const a = N(t, e, o), u = (r = a == null ? void 0 : a["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
2215
+ const a = K(t, e, o), u = (r = a == null ? void 0 : a["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
2211
2216
  u && Fn(a) && s.set(u, a);
2212
2217
  }
2213
2218
  if (!s.has("id")) {
2214
- const o = N(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
2219
+ const o = K(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
2215
2220
  a && s.set(a, o);
2216
2221
  }
2217
2222
  return s;
@@ -2224,15 +2229,15 @@ function aa(t, e, { etype: n, pageInfo: r, dq: i, form: s }) {
2224
2229
  if (p && ((a = p == null ? void 0 : p["forward-identity"]) === null || a === void 0 ? void 0 : a[2]) !== "id") {
2225
2230
  const _ = p["checked-data-type"] === "date", T = p.id;
2226
2231
  f = f.map(([g]) => {
2227
- var m, O, S, C, x;
2228
- let K = (x = (C = (S = (O = (m = t.eav.get(g)) === null || m === void 0 ? void 0 : m.get(T)) === null || O === void 0 ? void 0 : O.values()) === null || S === void 0 ? void 0 : S.next()) === null || C === void 0 ? void 0 : C.value) === null || x === void 0 ? void 0 : x[2];
2229
- return _ && (K = ln(K)), [g, K];
2232
+ var m, O, S, C, $;
2233
+ let D = ($ = (C = (S = (O = (m = t.eav.get(g)) === null || m === void 0 ? void 0 : m.get(T)) === null || O === void 0 ? void 0 : O.values()) === null || S === void 0 ? void 0 : S.next()) === null || C === void 0 ? void 0 : C.value) === null || $ === void 0 ? void 0 : $[2];
2234
+ return _ && (D = ln(D)), [g, D];
2230
2235
  });
2231
2236
  }
2232
2237
  f.sort(d === "asc" ? function(T, g) {
2233
- return It(T, g, p == null ? void 0 : p["checked-data-type"]);
2238
+ return Pt(T, g, p == null ? void 0 : p["checked-data-type"]);
2234
2239
  } : function(T, g) {
2235
- return It(g, T, p == null ? void 0 : p["checked-data-type"]);
2240
+ return Pt(g, T, p == null ? void 0 : p["checked-data-type"]);
2236
2241
  });
2237
2242
  let y = {};
2238
2243
  const b = oa(e, n, i);
@@ -2259,7 +2264,7 @@ function ca(t, e, { etype: n, level: r, form: i, join: s, pageInfo: o }) {
2259
2264
  var a, u, c, d, f;
2260
2265
  if (!Pi(i) && (!o || !o["start-cursor"]))
2261
2266
  return [];
2262
- const l = Bo(Jo(e, n, r, (a = i.$) === null || a === void 0 ? void 0 : a.where), s), p = Zo(xt, n, r), y = (u = i.$) === null || u === void 0 ? void 0 : u.fields, b = aa(t, e, {
2267
+ const l = Bo(Jo(e, n, r, (a = i.$) === null || a === void 0 ? void 0 : a.where), s), p = Zo($t, n, r), y = (u = i.$) === null || u === void 0 ? void 0 : u.fields, b = aa(t, e, {
2263
2268
  etype: n,
2264
2269
  pageInfo: o,
2265
2270
  form: i,
@@ -2276,14 +2281,14 @@ function da(t, e, n) {
2276
2281
  try {
2277
2282
  return ca(t, e, n);
2278
2283
  } catch (r) {
2279
- if (r instanceof Ne)
2284
+ if (r instanceof Ke)
2280
2285
  return {};
2281
2286
  throw r;
2282
2287
  }
2283
2288
  }
2284
2289
  function Mi(t, e, n) {
2285
2290
  const r = da(t, e, n);
2286
- return ea(xt, t, e, n, r);
2291
+ return ea($t, t, e, n, r);
2287
2292
  }
2288
2293
  function fa(t) {
2289
2294
  const e = {};
@@ -2344,7 +2349,7 @@ function hn(t, e, n) {
2344
2349
  function Uc(t, e) {
2345
2350
  return `lookup__${t}__${JSON.stringify(e)}`;
2346
2351
  }
2347
- function Pt(t) {
2352
+ function Mt(t) {
2348
2353
  return t.startsWith("lookup__");
2349
2354
  }
2350
2355
  function xi(t) {
@@ -2359,7 +2364,7 @@ function pa(t) {
2359
2364
  if (n === "__etype")
2360
2365
  return t;
2361
2366
  const r = n;
2362
- return Pt(r) ? hn(t, xi(r), []) : hn(t, r, []);
2367
+ return Mt(r) ? hn(t, xi(r), []) : hn(t, r, []);
2363
2368
  }
2364
2369
  });
2365
2370
  }
@@ -2404,7 +2409,7 @@ function _a(t) {
2404
2409
  function ga(t, e, n) {
2405
2410
  return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
2406
2411
  // before assuming it's a ref lookup.
2407
- !N(t, e, n);
2412
+ !K(t, e, n);
2408
2413
  }
2409
2414
  function pn(t) {
2410
2415
  const [e, n, ...r] = t.split(".");
@@ -2414,14 +2419,14 @@ function pn(t) {
2414
2419
  }
2415
2420
  function wa(t, e, n) {
2416
2421
  if (!ga(t, e, n))
2417
- return N(t, e, n);
2418
- const r = pn(n), i = N(t, e, r) || je(t, e, r);
2422
+ return K(t, e, n);
2423
+ const r = pn(n), i = K(t, e, r) || Ie(t, e, r);
2419
2424
  if (i && i["value-type"] !== "ref")
2420
2425
  throw new Error(`${n} does not reference a valid link attribute.`);
2421
2426
  return i;
2422
2427
  }
2423
2428
  function yn(t) {
2424
- return typeof t == "string" && !Pt(t) ? null : typeof t == "string" && Pt(t) ? xi(t) : _a(t);
2429
+ return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? xi(t) : _a(t);
2425
2430
  }
2426
2431
  function ee(t, e, n) {
2427
2432
  const r = yn(n);
@@ -2438,13 +2443,13 @@ function $i(t, e, n, r) {
2438
2443
  return Array.isArray(s) ? [[
2439
2444
  "add-triple",
2440
2445
  s,
2441
- (i = N(t, e, "id")) === null || i === void 0 ? void 0 : i.id,
2446
+ (i = K(t, e, "id")) === null || i === void 0 ? void 0 : i.id,
2442
2447
  s
2443
2448
  ]].concat(r) : r;
2444
2449
  }
2445
2450
  function Ta({ attrsStore: t }, [e, n, r]) {
2446
2451
  const i = Object.entries(r).flatMap(([s, o]) => {
2447
- const a = Array.isArray(o) ? o : [o], u = N(t, e, s), c = je(t, e, s);
2452
+ const a = Array.isArray(o) ? o : [o], u = K(t, e, s), c = Ie(t, e, s);
2448
2453
  return a.map((d) => u ? [
2449
2454
  "add-triple",
2450
2455
  ee(t, e, n),
@@ -2463,7 +2468,7 @@ function Ta({ attrsStore: t }, [e, n, r]) {
2463
2468
  }
2464
2469
  function ma({ attrsStore: t }, [e, n, r]) {
2465
2470
  const i = Object.entries(r).flatMap(([s, o]) => {
2466
- const a = Array.isArray(o) ? o : [o], u = N(t, e, s), c = je(t, e, s);
2471
+ const a = Array.isArray(o) ? o : [o], u = K(t, e, s), c = Ie(t, e, s);
2467
2472
  return a.map((d) => u ? [
2468
2473
  "retract-triple",
2469
2474
  ee(t, e, n),
@@ -2509,15 +2514,15 @@ function Di({ stores: t, attrsStore: e }, [n, r, i, s]) {
2509
2514
  function Sa(t, e) {
2510
2515
  const { attrsStore: n } = t, [r, i, s, o] = e, a = Un(s), u = ee(n, r, i);
2511
2516
  return [["id", u]].concat(Object.entries(a)).map(([d, f]) => {
2512
- const l = N(n, r, d);
2513
- return l["checked-data-type"] === "date" && t.useDateObjects && (f = Rt(f)), ["add-triple", u, l.id, f, { mode: "create" }];
2517
+ const l = K(n, r, d);
2518
+ return l["checked-data-type"] === "date" && t.useDateObjects && (f = xt(f)), ["add-triple", u, l.id, f, { mode: "create" }];
2514
2519
  });
2515
2520
  }
2516
2521
  function Oa(t, e) {
2517
2522
  const { attrsStore: n } = t, [r, i, s, o] = e, a = Un(s), u = ee(n, r, i), c = Di(t, [r, u, s, o]);
2518
2523
  return [["id", u]].concat(Object.entries(a)).map(([f, l]) => {
2519
- const p = N(n, r, f);
2520
- return p["checked-data-type"] === "date" && t.useDateObjects && (l = Rt(l)), [
2524
+ const p = K(n, r, f);
2525
+ return p["checked-data-type"] === "date" && t.useDateObjects && (l = xt(l)), [
2521
2526
  "add-triple",
2522
2527
  u,
2523
2528
  p.id,
@@ -2531,7 +2536,7 @@ function Ea({ attrsStore: t }, [e, n]) {
2531
2536
  }
2532
2537
  function Aa(t, e) {
2533
2538
  const { attrsStore: n } = t, [r, i, s, o] = e, a = Un(s), u = ee(n, r, i), c = Di(t, [r, u, s, o]), d = Object.entries(a).map(([l, p]) => {
2534
- const y = N(n, r, l);
2539
+ const y = K(n, r, l);
2535
2540
  return [
2536
2541
  "deep-merge-triple",
2537
2542
  u,
@@ -2543,7 +2548,7 @@ function Aa(t, e) {
2543
2548
  return [[
2544
2549
  "add-triple",
2545
2550
  u,
2546
- N(n, r, "id").id,
2551
+ K(n, r, "id").id,
2547
2552
  u,
2548
2553
  ...c ? [c] : []
2549
2554
  ]].concat(d);
@@ -2604,7 +2609,7 @@ function Pa(t, e, n) {
2604
2609
  "checked-data-type": u
2605
2610
  };
2606
2611
  }
2607
- function gt(t, e, n, r) {
2612
+ function wt(t, e, n, r) {
2608
2613
  const i = t ? Pa(t, e, n) : null, s = W(), a = [W(), e, n];
2609
2614
  return Object.assign(Object.assign({ id: s, "forward-identity": a, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
2610
2615
  }
@@ -2673,10 +2678,10 @@ function Na({ attrsStore: t, schema: e }, n) {
2673
2678
  var r, i;
2674
2679
  const s = /* @__PURE__ */ new Set(), o = [], a = [];
2675
2680
  function u(y, b) {
2676
- return N(t, y, b) || o.find((_) => _["forward-identity"][1] === y && _["forward-identity"][2] === b);
2681
+ return K(t, y, b) || o.find((_) => _["forward-identity"][1] === y && _["forward-identity"][2] === b);
2677
2682
  }
2678
2683
  function c(y, b) {
2679
- return je(t, y, b) || o.find((_) => {
2684
+ return Ie(t, y, b) || o.find((_) => {
2680
2685
  var T, g;
2681
2686
  return ((T = _["reverse-identity"]) === null || T === void 0 ? void 0 : T[1]) === y && ((g = _["reverse-identity"]) === null || g === void 0 ? void 0 : g[2]) === b;
2682
2687
  });
@@ -2690,7 +2695,7 @@ function Na({ attrsStore: t, schema: e }, n) {
2690
2695
  function l(y, b) {
2691
2696
  return b.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
2692
2697
  // before assuming it's a ref lookup.
2693
- !c(y, b);
2698
+ !u(y, b);
2694
2699
  }
2695
2700
  function p(y, b) {
2696
2701
  const _ = u(y, b), T = c(y, b);
@@ -2708,23 +2713,23 @@ function Na({ attrsStore: t, schema: e }, n) {
2708
2713
  p(S, pn(g));
2709
2714
  else {
2710
2715
  const C = u(S, g);
2711
- C || d(gt(e, S, g, bn)), f(C);
2716
+ C || d(wt(e, S, g, bn)), f(C);
2712
2717
  }
2713
2718
  } else if (l(b, g))
2714
2719
  p(b, pn(g));
2715
2720
  else {
2716
2721
  const m = u(b, g);
2717
- m || d(gt(e, b, g, bn)), f(m);
2722
+ m || d(wt(e, b, g, bn)), f(m);
2718
2723
  }
2719
2724
  }
2720
2725
  for (const y of n) {
2721
2726
  const [b, _, T, g] = y;
2722
2727
  if (xa.has(b)) {
2723
2728
  const m = u(_, "id");
2724
- f(m), m || d(gt(e, _, "id", { "unique?": !0 }));
2729
+ f(m), m || d(wt(e, _, "id", { "unique?": !0 }));
2725
2730
  for (const O of Object.keys(g)) {
2726
2731
  const S = u(_, O);
2727
- if (f(S), Da.has(b) && (S || d(gt(e, _, O, O === "id" ? { "unique?": !0 } : null))), $a.has(b)) {
2732
+ if (f(S), Da.has(b) && (S || d(wt(e, _, O, O === "id" ? { "unique?": !0 } : null))), $a.has(b)) {
2728
2733
  const C = c(_, O);
2729
2734
  !S && !C && d(Cr(e, _, O)), f(C);
2730
2735
  }
@@ -2735,7 +2740,7 @@ function Na({ attrsStore: t, schema: e }, n) {
2735
2740
  const y = Object.assign({}, t.attrs);
2736
2741
  for (const b of o)
2737
2742
  y[b.id] = b;
2738
- return [new De(y, t.linkIndex), a];
2743
+ return [new Ae(y, t.linkIndex), a];
2739
2744
  }
2740
2745
  return [t, a];
2741
2746
  }
@@ -3001,7 +3006,7 @@ class _n {
3001
3006
  // so that we know which entries we need to persist to the store.
3002
3007
  updateInPlace(e) {
3003
3008
  this._version++;
3004
- const [n, r] = Ct(this.currentValue, e, {
3009
+ const [n, r] = It(this.currentValue, e, {
3005
3010
  enablePatches: !0
3006
3011
  });
3007
3012
  for (const i of r) {
@@ -3019,7 +3024,7 @@ class _n {
3019
3024
  };
3020
3025
  }
3021
3026
  }
3022
- var pe = function(t, e, n, r) {
3027
+ var ye = function(t, e, n, r) {
3023
3028
  function i(s) {
3024
3029
  return s instanceof n ? s : new n(function(o) {
3025
3030
  o(s);
@@ -3053,7 +3058,7 @@ function Va(t) {
3053
3058
  };
3054
3059
  }
3055
3060
  function Ba(t) {
3056
- return pe(this, void 0, void 0, function* () {
3061
+ return ye(this, void 0, void 0, function* () {
3057
3062
  return new Promise((e) => {
3058
3063
  const n = indexedDB.open(t);
3059
3064
  n.onerror = (r) => {
@@ -3069,7 +3074,7 @@ function Ba(t) {
3069
3074
  });
3070
3075
  }
3071
3076
  function Ga(t, e, n) {
3072
- return pe(this, void 0, void 0, function* () {
3077
+ return ye(this, void 0, void 0, function* () {
3073
3078
  const r = (
3074
3079
  // Backwards compatibility for older versions where we JSON.stringified before storing
3075
3080
  typeof e == "string" ? JSON.parse(e) : e
@@ -3105,7 +3110,7 @@ function Ga(t, e, n) {
3105
3110
  });
3106
3111
  }
3107
3112
  function Pr(t, e, n) {
3108
- return pe(this, void 0, void 0, function* () {
3113
+ return ye(this, void 0, void 0, function* () {
3109
3114
  const r = n.put(e, t);
3110
3115
  return new Promise((i, s) => {
3111
3116
  r.onsuccess = () => i(), r.onerror = (o) => s(o);
@@ -3113,7 +3118,7 @@ function Pr(t, e, n) {
3113
3118
  });
3114
3119
  }
3115
3120
  function Qa(t, e) {
3116
- return pe(this, void 0, void 0, function* () {
3121
+ return ye(this, void 0, void 0, function* () {
3117
3122
  const n = yield Ba(`instant_${t}_5`);
3118
3123
  if (!n)
3119
3124
  return;
@@ -3192,7 +3197,7 @@ class Ui extends qa {
3192
3197
  r.objectStoreNames.contains(i) || r.createObjectStore(i);
3193
3198
  }
3194
3199
  getItem(e) {
3195
- return pe(this, void 0, void 0, function* () {
3200
+ return ye(this, void 0, void 0, function* () {
3196
3201
  const n = yield this._dbPromise;
3197
3202
  return new Promise((r, i) => {
3198
3203
  const a = n.transaction([this._storeName], "readonly").objectStore(this._storeName).get(e);
@@ -3205,7 +3210,7 @@ class Ui extends qa {
3205
3210
  });
3206
3211
  }
3207
3212
  setItem(e, n) {
3208
- return pe(this, void 0, void 0, function* () {
3213
+ return ye(this, void 0, void 0, function* () {
3209
3214
  const r = yield this._dbPromise;
3210
3215
  return new Promise((i, s) => {
3211
3216
  const u = r.transaction([this._storeName], "readwrite").objectStore(this._storeName).put(n, e);
@@ -3219,7 +3224,7 @@ class Ui extends qa {
3219
3224
  }
3220
3225
  // Performs all writes in a transaction so that all succeed or none succeed.
3221
3226
  multiSet(e) {
3222
- return pe(this, void 0, void 0, function* () {
3227
+ return ye(this, void 0, void 0, function* () {
3223
3228
  const n = yield this._dbPromise;
3224
3229
  return new Promise((r, i) => {
3225
3230
  const s = n.transaction([this._storeName], "readwrite"), o = s.objectStore(this._storeName), a = /* @__PURE__ */ new Set();
@@ -3237,7 +3242,7 @@ class Ui extends qa {
3237
3242
  });
3238
3243
  }
3239
3244
  removeItem(e) {
3240
- return pe(this, void 0, void 0, function* () {
3245
+ return ye(this, void 0, void 0, function* () {
3241
3246
  const n = yield this._dbPromise;
3242
3247
  return new Promise((r, i) => {
3243
3248
  const a = n.transaction([this._storeName], "readwrite").objectStore(this._storeName).delete(e);
@@ -3250,7 +3255,7 @@ class Ui extends qa {
3250
3255
  });
3251
3256
  }
3252
3257
  getAllKeys() {
3253
- return pe(this, void 0, void 0, function* () {
3258
+ return ye(this, void 0, void 0, function* () {
3254
3259
  const e = yield this._dbPromise;
3255
3260
  return new Promise((n, r) => {
3256
3261
  const o = e.transaction([this._storeName], "readonly").objectStore(this._storeName).getAllKeys();
@@ -3307,11 +3312,11 @@ class Li {
3307
3312
  };
3308
3313
  }
3309
3314
  }
3310
- class Ke extends Error {
3315
+ class qe extends Error {
3311
3316
  constructor(e, n) {
3312
3317
  super(e), this.hint = n;
3313
3318
  const r = new.target.prototype;
3314
- Object.setPrototypeOf && Object.setPrototypeOf(this, r), Error.captureStackTrace && Error.captureStackTrace(this, Ke), this.name = "InstantError";
3319
+ Object.setPrototypeOf && Object.setPrototypeOf(this, r), Error.captureStackTrace && Error.captureStackTrace(this, qe), this.name = "InstantError";
3315
3320
  }
3316
3321
  get [Symbol.toStringTag]() {
3317
3322
  return "InstantError";
@@ -3344,13 +3349,13 @@ var Ya = function(t, e, n, r) {
3344
3349
  c((r = r.apply(t, e || [])).next());
3345
3350
  });
3346
3351
  };
3347
- class $t extends Ke {
3352
+ class Dt extends qe {
3348
3353
  constructor(e) {
3349
3354
  var n;
3350
3355
  const r = ((n = e.body) === null || n === void 0 ? void 0 : n.message) || `API Error (${e.status})`;
3351
3356
  super(r, e.body.hint);
3352
3357
  const i = new.target.prototype;
3353
- Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, $t), this.name = "InstantAPIError", this.status = e.status, this.body = e.body;
3358
+ Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, Dt), this.name = "InstantAPIError", this.status = e.status, this.body = e.body;
3354
3359
  }
3355
3360
  get [Symbol.toStringTag]() {
3356
3361
  return "InstantAPIError";
@@ -3359,10 +3364,10 @@ class $t extends Ke {
3359
3364
  function ue(t, e) {
3360
3365
  return Ya(this, void 0, void 0, function* () {
3361
3366
  const n = yield fetch(t, e), r = yield n.json();
3362
- return n.status === 200 ? Promise.resolve(r) : Promise.reject(new $t({ status: n.status, body: r }));
3367
+ return n.status === 200 ? Promise.resolve(r) : Promise.reject(new Dt({ status: n.status, body: r }));
3363
3368
  });
3364
3369
  }
3365
- var We = function(t, e, n, r) {
3370
+ var ze = function(t, e, n, r) {
3366
3371
  function i(s) {
3367
3372
  return s instanceof n ? s : new n(function(o) {
3368
3373
  o(s);
@@ -3397,7 +3402,7 @@ function Ja({ apiURI: t, appId: e, email: n }) {
3397
3402
  });
3398
3403
  }
3399
3404
  function Za(t) {
3400
- return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
3405
+ return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
3401
3406
  return yield ue(`${e}/runtime/auth/verify_magic_code`, {
3402
3407
  method: "POST",
3403
3408
  headers: { "content-type": "application/json" },
@@ -3410,7 +3415,7 @@ function Za(t) {
3410
3415
  });
3411
3416
  }
3412
3417
  function Xa(t) {
3413
- return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3418
+ return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3414
3419
  return yield ue(`${e}/runtime/auth/verify_refresh_token`, {
3415
3420
  method: "POST",
3416
3421
  headers: { "content-type": "application/json" },
@@ -3422,7 +3427,7 @@ function Xa(t) {
3422
3427
  });
3423
3428
  }
3424
3429
  function eu(t) {
3425
- return We(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
3430
+ return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
3426
3431
  return yield ue(`${e}/runtime/auth/sign_in_guest`, {
3427
3432
  method: "POST",
3428
3433
  headers: { "content-type": "application/json" },
@@ -3433,7 +3438,7 @@ function eu(t) {
3433
3438
  });
3434
3439
  }
3435
3440
  function Rr(t) {
3436
- return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
3441
+ return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
3437
3442
  return yield ue(`${e}/runtime/oauth/token`, {
3438
3443
  method: "POST",
3439
3444
  headers: { "content-type": "application/json" },
@@ -3447,7 +3452,7 @@ function Rr(t) {
3447
3452
  });
3448
3453
  }
3449
3454
  function tu(t) {
3450
- return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
3455
+ return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
3451
3456
  return yield ue(`${e}/runtime/oauth/id_token`, {
3452
3457
  method: "POST",
3453
3458
  headers: { "content-type": "application/json" },
@@ -3462,7 +3467,7 @@ function tu(t) {
3462
3467
  });
3463
3468
  }
3464
3469
  function nu(t) {
3465
- return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3470
+ return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
3466
3471
  return yield ue(`${e}/runtime/signout`, {
3467
3472
  method: "POST",
3468
3473
  headers: {
@@ -3644,7 +3649,7 @@ function Ur(t) {
3644
3649
  }, e;
3645
3650
  }, {});
3646
3651
  }
3647
- const Wn = "v0.22.86-experimental.split-store.20178922132.1";
3652
+ const Wn = "v0.22.86-experimental.split-store.20183617880.1";
3648
3653
  function du(t, e) {
3649
3654
  return {
3650
3655
  info: t ? (...n) => console.info(...n, e()) : () => {
@@ -3677,15 +3682,15 @@ class H {
3677
3682
  return new H(this.valueType, this.required, !0, Object.assign(Object.assign({}, this.config), { indexed: !0 }));
3678
3683
  }
3679
3684
  }
3680
- class Dt {
3685
+ class Ut {
3681
3686
  constructor(e, n) {
3682
3687
  this.attrs = e, this.links = n;
3683
3688
  }
3684
3689
  asType() {
3685
- return new Dt(this.attrs, this.links);
3690
+ return new Ut(this.attrs, this.links);
3686
3691
  }
3687
3692
  }
3688
- class Ut {
3693
+ class Lt {
3689
3694
  constructor(e, n, r) {
3690
3695
  this.entities = e, this.links = n, this.rooms = r;
3691
3696
  }
@@ -3709,7 +3714,7 @@ class Ut {
3709
3714
  * @see https://instantdb.com/docs/presence-and-topics#typesafety
3710
3715
  */
3711
3716
  withRoomSchema() {
3712
- return new Ut(this.entities, this.links, {});
3717
+ return new Lt(this.entities, this.links, {});
3713
3718
  }
3714
3719
  }
3715
3720
  class R extends Error {
@@ -3776,7 +3781,7 @@ const Lr = [
3776
3781
  default:
3777
3782
  throw new R(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
3778
3783
  }
3779
- }, Ue = (t, e, n, r, i) => {
3784
+ }, Le = (t, e, n, r, i) => {
3780
3785
  const s = fu(n), o = n.valueType === "json";
3781
3786
  if (typeof t == "object" && t !== null && !Array.isArray(t)) {
3782
3787
  if (o)
@@ -3806,23 +3811,23 @@ const Lr = [
3806
3811
  if (!u)
3807
3812
  throw new R(`Target entity '${o}' does not exist in schema for dot notation path '${t}'.`, i);
3808
3813
  if (a === "id") {
3809
- if (typeof e == "string" && !Fe(e))
3814
+ if (typeof e == "string" && !Ne(e))
3810
3815
  throw new R(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, i);
3811
- Ue(e, t, new H("string", !1, !0), n, i);
3816
+ Le(e, t, new H("string", !1, !0), n, i);
3812
3817
  return;
3813
3818
  }
3814
3819
  const c = u.attrs[a];
3815
3820
  if (Object.keys(u.links).includes(a)) {
3816
- if (typeof e == "string" && !Fe(e))
3821
+ if (typeof e == "string" && !Ne(e))
3817
3822
  throw new R(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
3818
- Ue(e, t, new H("string", !1, !0), n, i);
3823
+ Le(e, t, new H("string", !1, !0), n, i);
3819
3824
  return;
3820
3825
  }
3821
3826
  if (!c) {
3822
3827
  const d = Object.keys(u.attrs);
3823
3828
  throw new R(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${d.length > 0 ? d.join(", ") + ", id" : "id"}`, i);
3824
3829
  }
3825
- Ue(e, t, c, n, i);
3830
+ Le(e, t, c, n, i);
3826
3831
  }, Wi = (t, e, n, r) => {
3827
3832
  for (const [i, s] of Object.entries(t)) {
3828
3833
  if (i === "or" || i === "and") {
@@ -3832,7 +3837,7 @@ const Lr = [
3832
3837
  continue;
3833
3838
  }
3834
3839
  if (i === "id") {
3835
- Ue(s, "id", new H("string", !1, !0), e, `${r}.id`);
3840
+ Le(s, "id", new H("string", !1, !0), e, `${r}.id`);
3836
3841
  continue;
3837
3842
  }
3838
3843
  if (i.includes(".")) {
@@ -3848,12 +3853,12 @@ const Lr = [
3848
3853
  throw new R(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${c.length > 0 ? c.join(", ") : "none"}. Available links: ${d.length > 0 ? d.join(", ") : "none"}`, `${r}.${i}`);
3849
3854
  }
3850
3855
  if (a)
3851
- Ue(s, i, a, e, `${r}.${i}`);
3856
+ Le(s, i, a, e, `${r}.${i}`);
3852
3857
  else if (u) {
3853
- if (typeof s == "string" && !Fe(s))
3858
+ if (typeof s == "string" && !Ne(s))
3854
3859
  throw new R(`Invalid value for link '${i}' in entity '${e}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
3855
3860
  const c = new H("string", !1, !0);
3856
- Ue(s, i, c, e, `${r}.${i}`);
3861
+ Le(s, i, c, e, `${r}.${i}`);
3857
3862
  }
3858
3863
  }
3859
3864
  }, pu = (t, e, n, r, i = 0) => {
@@ -3916,7 +3921,7 @@ const Lr = [
3916
3921
  zi(n[r], r, e, r, 0);
3917
3922
  }
3918
3923
  }
3919
- }, Nr = (t) => typeof t != "string" ? !1 : Pt(t) ? !0 : Fe(t);
3924
+ }, Nr = (t) => typeof t != "string" ? !1 : Mt(t) ? !0 : Ne(t);
3920
3925
  class ie extends Error {
3921
3926
  constructor(e) {
3922
3927
  super(e), this.name = "TransactionValidationError";
@@ -3977,7 +3982,7 @@ const Vi = (t) => t.length > 0 ? t.join(", ") : "none", yu = (t, e) => new ie(`E
3977
3982
  if (!e)
3978
3983
  return;
3979
3984
  const [n, r, i, s] = t;
3980
- if (!Array.isArray(i) && !Fe(i))
3985
+ if (!Array.isArray(i) && !Ne(i))
3981
3986
  throw new ie(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
3982
3987
  if (typeof r != "string")
3983
3988
  throw new ie(`Entity name must be a string, but received: ${typeof r}`);
@@ -4202,10 +4207,10 @@ function Jt(t, e, n) {
4202
4207
  }
4203
4208
  function Br(t, e, n, r) {
4204
4209
  var i;
4205
- const s = (i = N(n, t.table, "id")) === null || i === void 0 ? void 0 : i.id;
4210
+ const s = (i = K(n, t.table, "id")) === null || i === void 0 ? void 0 : i.id;
4206
4211
  if (!s)
4207
4212
  return -1;
4208
- const o = qe(e.eav, [r, s, r]);
4213
+ const o = We(e.eav, [r, s, r]);
4209
4214
  return o ? o[3] : -1;
4210
4215
  }
4211
4216
  function Gr(t, e, n) {
@@ -4244,14 +4249,14 @@ function Ou(t, e, n) {
4244
4249
  }
4245
4250
  return a;
4246
4251
  }
4247
- function wt(t, e) {
4252
+ function Tt(t, e) {
4248
4253
  return { [t.table]: e.map((n) => n.entity) };
4249
4254
  }
4250
4255
  function Eu(t, e) {
4251
4256
  var n;
4252
4257
  if (t.orderFieldType)
4253
4258
  return t.orderFieldType;
4254
- const r = t.orderField === "serverCreatedAt" ? "number" : (n = N(e(), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
4259
+ const r = t.orderField === "serverCreatedAt" ? "number" : (n = K(e(), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
4255
4260
  return t.orderFieldType = r, r;
4256
4261
  }
4257
4262
  function Au(t, e, n) {
@@ -4271,10 +4276,10 @@ function Au(t, e, n) {
4271
4276
  return Ze(a.entity.id, a.entity[i], o.entity.id, o.entity[i], r);
4272
4277
  });
4273
4278
  }
4274
- var me;
4279
+ var ve;
4275
4280
  (function(t) {
4276
4281
  t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
4277
- })(me || (me = {}));
4282
+ })(ve || (ve = {}));
4278
4283
  class ku {
4279
4284
  constructor(e, n, r, i, s, o) {
4280
4285
  this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.getAttrs = o, this.subs = new _n({
@@ -4344,8 +4349,8 @@ class ku {
4344
4349
  const u = this.subs.currentValue[n];
4345
4350
  if (u && u.state && u.state.txId) {
4346
4351
  this.sendResync(u, u.state, u.state.txId), !((i = u.values) === null || i === void 0) && i.entities && r && r({
4347
- type: me.LoadFromStorage,
4348
- data: wt(u, (s = u.values) === null || s === void 0 ? void 0 : s.entities)
4352
+ type: ve.LoadFromStorage,
4353
+ data: Tt(u, (s = u.values) === null || s === void 0 ? void 0 : s.entities)
4349
4354
  });
4350
4355
  return;
4351
4356
  }
@@ -4417,8 +4422,8 @@ class ku {
4417
4422
  this.subs.updateInPlace((d) => {
4418
4423
  d[s] = a, d[s].updatedAt = Date.now();
4419
4424
  }), a.values && this.notifyCbs(s, {
4420
- type: me.InitialSyncBatch,
4421
- data: wt(a, a.values.entities),
4425
+ type: ve.InitialSyncBatch,
4426
+ data: Tt(a, a.values.entities),
4422
4427
  batch: o
4423
4428
  });
4424
4429
  }
@@ -4442,8 +4447,8 @@ class ku {
4442
4447
  });
4443
4448
  const s = this.subs.currentValue[i];
4444
4449
  s && this.notifyCbs(i, {
4445
- type: me.InitialSyncComplete,
4446
- data: wt(s, ((n = s.values) === null || n === void 0 ? void 0 : n.entities) || [])
4450
+ type: ve.InitialSyncComplete,
4451
+ data: Tt(s, ((n = s.values) === null || n === void 0 ? void 0 : n.entities) || [])
4447
4452
  });
4448
4453
  }
4449
4454
  onSyncUpdateTriples(e) {
@@ -4483,11 +4488,11 @@ class ku {
4483
4488
  const S = p[O];
4484
4489
  if (io(S.store, g)) {
4485
4490
  Gr(S.store, l.attrsStore, m);
4486
- const C = Jt(a, S.store, l.attrsStore), x = Ou(S.store, l.attrsStore, m)[g];
4491
+ const C = Jt(a, S.store, l.attrsStore), $ = Ou(S.store, l.attrsStore, m)[g];
4487
4492
  C ? (y.push({
4488
4493
  oldEntity: S.entity,
4489
4494
  newEntity: C,
4490
- changedFields: x || {}
4495
+ changedFields: $ || {}
4491
4496
  }), S.entity = C) : d.push(O), delete f[g];
4492
4497
  continue e;
4493
4498
  }
@@ -4516,8 +4521,8 @@ class ku {
4516
4521
  _.push(p[g].entity), p.splice(g, 1);
4517
4522
  const T = Eu(a, this.getAttrs);
4518
4523
  Au(a, T, p), this.notifyCbs(o, {
4519
- type: me.SyncTransaction,
4520
- data: wt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
4524
+ type: ve.SyncTransaction,
4525
+ data: Tt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
4521
4526
  added: b,
4522
4527
  removed: _,
4523
4528
  updated: y
@@ -4546,7 +4551,7 @@ class ku {
4546
4551
  hint: e.hint
4547
4552
  }, i = Object.keys(e["original-event"].q)[0];
4548
4553
  this.notifyCbs(n, {
4549
- type: me.Error,
4554
+ type: ve.Error,
4550
4555
  data: { [i]: [] },
4551
4556
  error: r
4552
4557
  });
@@ -4556,7 +4561,7 @@ class ku {
4556
4561
  r && this.initSubscription(r.query, r.hash);
4557
4562
  }
4558
4563
  }
4559
- var F = function(t, e, n, r) {
4564
+ var N = function(t, e, n, r) {
4560
4565
  function i(s) {
4561
4566
  return s instanceof n ? s : new n(function(o) {
4562
4567
  o(s);
@@ -4590,7 +4595,7 @@ var F = function(t, e, n, r) {
4590
4595
  e.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[i]) && (n[r[i]] = t[r[i]]);
4591
4596
  return n;
4592
4597
  };
4593
- const le = {
4598
+ const he = {
4594
4599
  CONNECTING: "connecting",
4595
4600
  OPENED: "opened",
4596
4601
  AUTHENTICATED: "authenticated",
@@ -4670,7 +4675,7 @@ function Hr(t) {
4670
4675
  class Fu {
4671
4676
  constructor(e, n = Ui, r = Li, i, s) {
4672
4677
  var o, a, u;
4673
- if (this._isOnline = !0, this._isShutdown = !1, this.status = le.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (c, d, f) => {
4678
+ if (this._isOnline = !0, this._isShutdown = !1, this.status = he.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (c, d, f) => {
4674
4679
  var l, p;
4675
4680
  switch (c) {
4676
4681
  case "pendingMutations": {
@@ -4690,7 +4695,7 @@ class Fu {
4690
4695
  }, this.notifyOne = (c) => {
4691
4696
  var d, f;
4692
4697
  const l = (d = this.queryCbs[c]) !== null && d !== void 0 ? d : [], p = (f = this._dataForQueryCache[c]) === null || f === void 0 ? void 0 : f.data, y = this.dataForQuery(c);
4693
- y != null && y.data && (this._dataForQueryCache[c] = y, !St(y.data, p) && l.forEach((b) => b.cb(y.data)));
4698
+ y != null && y.data && (this._dataForQueryCache[c] = y, !Ot(y.data, p) && l.forEach((b) => b.cb(y.data)));
4694
4699
  }, this.notifyOneQueryOnce = (c) => {
4695
4700
  var d, f;
4696
4701
  const l = (d = this.queryOnceDfds[c]) !== null && d !== void 0 ? d : [], p = (f = this.dataForQuery(c)) === null || f === void 0 ? void 0 : f.data;
@@ -4734,7 +4739,7 @@ class Fu {
4734
4739
  this._log.info("[socket][open]", d.id, "skip; this is no longer the current transport");
4735
4740
  return;
4736
4741
  }
4737
- this._log.info("[socket][open]", this._transport.id), this._setStatus(le.OPENED), this.getCurrentUser().then((f) => {
4742
+ this._log.info("[socket][open]", this._transport.id), this._setStatus(he.OPENED), this.getCurrentUser().then((f) => {
4738
4743
  var l;
4739
4744
  this._trySend(W(), {
4740
4745
  op: "init",
@@ -4783,7 +4788,7 @@ class Fu {
4783
4788
  this._log.info("[socket][close]", d.id, "skip; this is no longer the current transport");
4784
4789
  return;
4785
4790
  }
4786
- this._setStatus(le.CLOSED);
4791
+ this._setStatus(he.CLOSED);
4787
4792
  for (const f of Object.values(this._rooms))
4788
4793
  f.isConnected = !1;
4789
4794
  if (this._isShutdown) {
@@ -4794,9 +4799,9 @@ class Fu {
4794
4799
  }, this._EventSource = s, this.config = Object.assign(Object.assign({}, Pu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (a = this.config.pendingTxCleanupTimeout) !== null && a !== void 0 ? a : Cu, this._pendingMutationCleanupThreshold = (u = this.config.pendingMutationCleanupThreshold) !== null && u !== void 0 ? u : Iu, this._log = du(e.verbose || qn || Fi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Wn }), this.config.schema && (this._linkIndex = Ur(this.config.schema)), !!Ru()) {
4795
4800
  if (!e.appId)
4796
4801
  throw new Error("Instant must be initialized with an appId.");
4797
- if (!Fe(e.appId))
4802
+ if (!Ne(e.appId))
4798
4803
  throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
4799
- typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (c) => F(this, void 0, void 0, function* () {
4804
+ typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (c) => N(this, void 0, void 0, function* () {
4800
4805
  var d;
4801
4806
  try {
4802
4807
  if (((d = c.data) === null || d === void 0 ? void 0 : d.type) === "auth") {
@@ -4808,9 +4813,9 @@ class Fu {
4808
4813
  }
4809
4814
  }))), this._initStorage(n), this._syncTable = new ku(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
4810
4815
  useDateObjects: this.config.useDateObjects
4811
- }, this._log, (c) => Ot(this.ensureAttrs(), c, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((c) => {
4816
+ }, this._log, (c) => Et(this.ensureAttrs(), c, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((c) => {
4812
4817
  this._isOnline = c, this._startSocket(), r.listen((d) => {
4813
- d !== this._isOnline && (this._log.info("[network] online =", d), this._isOnline = d, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", le.CLOSED), this._setStatus(le.CLOSED)));
4818
+ d !== this._isOnline && (this._log.info("[network] online =", d), this._isOnline = d, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", he.CLOSED), this._setStatus(he.CLOSED)));
4814
4819
  });
4815
4820
  }), typeof addEventListener < "u" && (this._beforeUnload = this._beforeUnload.bind(this), addEventListener("beforeunload", this._beforeUnload));
4816
4821
  }
@@ -4890,13 +4895,13 @@ class Fu {
4890
4895
  i.resolve({ status: e, eventId: n });
4891
4896
  else if (r != null && r.type) {
4892
4897
  const { status: o } = r, a = Qi(r, ["status"]);
4893
- i.reject(new $t({
4898
+ i.reject(new Dt({
4894
4899
  // @ts-expect-error body.type is not constant typed
4895
4900
  body: a,
4896
4901
  status: o ?? 0
4897
4902
  }));
4898
4903
  } else
4899
- i.reject(new Ke((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint));
4904
+ i.reject(new qe((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint));
4900
4905
  }
4901
4906
  _setStatus(e, n) {
4902
4907
  this.status = e, this._errorMessage = n, this.notifyConnectionStatusSubs(e);
@@ -4915,7 +4920,7 @@ class Fu {
4915
4920
  const c = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
4916
4921
  switch (Qr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
4917
4922
  case "init-ok": {
4918
- this._setStatus(le.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
4923
+ this._setStatus(he.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
4919
4924
  for (const l of Object.keys(this._rooms)) {
4920
4925
  const p = (i = (r = this._presence[l]) === null || r === void 0 ? void 0 : r.result) === null || i === void 0 ? void 0 : i.user;
4921
4926
  this._tryJoinRoom(l, p);
@@ -4930,7 +4935,7 @@ class Fu {
4930
4935
  const { q: l, result: p } = n, y = B(l);
4931
4936
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
4932
4937
  break;
4933
- const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, T = Dr(p), g = Ot(this.ensureAttrs(), T, c, this.config.useDateObjects);
4938
+ const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, T = Dr(p), g = Et(this.ensureAttrs(), T, c, this.config.useDateObjects);
4934
4939
  this.querySubs.updateInPlace((m) => {
4935
4940
  if (!m[y]) {
4936
4941
  this._log.info("Missing value in querySubs", { hash: y, q: l });
@@ -4971,20 +4976,27 @@ class Fu {
4971
4976
  });
4972
4977
  const _ = Hr(b.entries()), T = l.map((g) => {
4973
4978
  var m, O, S, C;
4974
- const x = g["instaql-query"], K = g["instaql-result"], ze = B(x), ft = Dr(K), Lt = Ot(this.ensureAttrs(), ft, c, this.config.useDateObjects), Ft = this._applyOptimisticUpdates(Lt, this.ensureAttrs(), _, y), lt = (O = (m = K == null ? void 0 : K[0]) === null || m === void 0 ? void 0 : m.data) === null || O === void 0 ? void 0 : O["page-info"], ce = (C = (S = K == null ? void 0 : K[0]) === null || S === void 0 ? void 0 : S.data) === null || C === void 0 ? void 0 : C.aggregate;
4975
- return { q: x, hash: ze, store: Ft, pageInfo: lt, aggregate: ce };
4979
+ const $ = g["instaql-query"], D = g["instaql-result"], Ve = B($), ft = Dr(D), lt = this.ensureAttrs(), Ft = Et(lt, ft, c, this.config.useDateObjects), { store: ht, attrsStore: ce } = this._applyOptimisticUpdates(Ft, lt, _, y), le = (O = (m = D == null ? void 0 : D[0]) === null || m === void 0 ? void 0 : m.data) === null || O === void 0 ? void 0 : O["page-info"], Te = (C = (S = D == null ? void 0 : D[0]) === null || S === void 0 ? void 0 : S.data) === null || C === void 0 ? void 0 : C.aggregate;
4980
+ return {
4981
+ q: $,
4982
+ hash: Ve,
4983
+ store: ht,
4984
+ attrsStore: ce,
4985
+ pageInfo: le,
4986
+ aggregate: Te
4987
+ };
4976
4988
  });
4977
- T.forEach(({ hash: g, q: m, store: O, pageInfo: S, aggregate: C }) => {
4978
- this.querySubs.updateInPlace((x) => {
4979
- if (!x[g]) {
4989
+ T.forEach(({ hash: g, q: m, store: O, attrsStore: S, pageInfo: C, aggregate: $ }) => {
4990
+ this.querySubs.updateInPlace((D) => {
4991
+ if (!D[g]) {
4980
4992
  this._log.error("Missing value in querySubs", { hash: g, q: m });
4981
4993
  return;
4982
4994
  }
4983
- x[g].result = {
4995
+ D[g].result = {
4984
4996
  store: O,
4985
- attrsStore: this.ensureAttrs(),
4986
- pageInfo: S,
4987
- aggregate: C,
4997
+ attrsStore: S,
4998
+ pageInfo: C,
4999
+ aggregate: $,
4988
5000
  processedTxId: y
4989
5001
  };
4990
5002
  });
@@ -5105,7 +5117,7 @@ class Fu {
5105
5117
  this.changeCurrentUser(null);
5106
5118
  return;
5107
5119
  }
5108
- this._setStatus(le.ERRORED, f), this.notifyAll();
5120
+ this._setStatus(he.ERRORED, f), this.notifyAll();
5109
5121
  return;
5110
5122
  }
5111
5123
  if (((a = e["original-event"]) === null || a === void 0 ? void 0 : a.op) === "resync-table") {
@@ -5126,7 +5138,7 @@ class Fu {
5126
5138
  o && (o.dfd.reject(i), this._completeQueryOnce(e, n, o.dfd));
5127
5139
  }
5128
5140
  _setAttrs(e) {
5129
- this.attrs = new De(e.reduce((n, r) => (n[r.id] = r, n), {}), this._linkIndex), this.notifyAttrsSubs();
5141
+ this.attrs = new Ae(e.reduce((n, r) => (n[r.id] = r, n), {}), this._linkIndex), this.notifyAttrsSubs();
5130
5142
  }
5131
5143
  _startQuerySub(e, n) {
5132
5144
  const r = W();
@@ -5203,10 +5215,10 @@ class Fu {
5203
5215
  return /* @__PURE__ */ new Map();
5204
5216
  const i = (d) => {
5205
5217
  const [f, l, p] = d["forward-identity"];
5206
- return N(e, l, p);
5218
+ return K(e, l, p);
5207
5219
  }, s = (d) => {
5208
5220
  const [f, l, p] = d["forward-identity"];
5209
- return je(e, l, p);
5221
+ return Ie(e, l, p);
5210
5222
  }, o = { attrIdMap: {}, refSwapAttrIds: /* @__PURE__ */ new Set() };
5211
5223
  let a = !1;
5212
5224
  const u = (d, f) => {
@@ -5259,13 +5271,13 @@ class Fu {
5259
5271
  s.push(c);
5260
5272
  }
5261
5273
  if (!i.size && !s.length)
5262
- return this.attrs || new De({}, this._linkIndex);
5274
+ return this.attrs || new Ae({}, this._linkIndex);
5263
5275
  const o = Object.assign({}, ((n = this.attrs) === null || n === void 0 ? void 0 : n.attrs) || {});
5264
5276
  for (const a of s)
5265
5277
  o[a.id] = a;
5266
5278
  for (const a of i)
5267
5279
  delete o[a];
5268
- return new De(o, this._linkIndex);
5280
+ return new Ae(o, this._linkIndex);
5269
5281
  }
5270
5282
  /** Runs instaql on a query and a store */
5271
5283
  dataForQuery(e) {
@@ -5280,13 +5292,16 @@ class Fu {
5280
5292
  const c = this._dataForQueryCache[e];
5281
5293
  if (c && r === c.querySubVersion && s === c.pendingMutationsVersion)
5282
5294
  return c;
5283
- const { store: d, attrsStore: f, pageInfo: l, aggregate: p, processedTxId: y } = u, b = this._rewriteMutationsSorted(f, o), _ = this._applyOptimisticUpdates(d, f, b, y);
5284
- return { data: Ri({ store: _, attrsStore: f, pageInfo: l, aggregate: p }, a), querySubVersion: r, pendingMutationsVersion: s };
5295
+ const { store: d, attrsStore: f, pageInfo: l, aggregate: p, processedTxId: y } = u, b = this._rewriteMutationsSorted(f, o), { store: _, attrsStore: T } = this._applyOptimisticUpdates(d, f, b, y);
5296
+ return { data: Ri({ store: _, attrsStore: T, pageInfo: l, aggregate: p }, a), querySubVersion: r, pendingMutationsVersion: s };
5285
5297
  }
5286
5298
  _applyOptimisticUpdates(e, n, r, i) {
5287
5299
  for (const [s, o] of r)
5288
- (!o["tx-id"] || i && o["tx-id"] > i) && (e = _o(e, n, o["tx-steps"]));
5289
- return e;
5300
+ if (!o["tx-id"] || i && o["tx-id"] > i) {
5301
+ const a = _o(e, n, o["tx-steps"]);
5302
+ e = a.store, n = a.attrsStore;
5303
+ }
5304
+ return { store: e, attrsStore: n };
5290
5305
  }
5291
5306
  /** Re-compute all subscriptions */
5292
5307
  notifyAll() {
@@ -5315,7 +5330,7 @@ class Fu {
5315
5330
  });
5316
5331
  return;
5317
5332
  }
5318
- if (this.status !== le.AUTHENTICATED) {
5333
+ if (this.status !== he.AUTHENTICATED) {
5319
5334
  this._finishTransaction("enqueued", e);
5320
5335
  return;
5321
5336
  }
@@ -5369,7 +5384,7 @@ class Fu {
5369
5384
  });
5370
5385
  }
5371
5386
  _trySendAuthed(...e) {
5372
- this.status === le.AUTHENTICATED && this._trySend(...e);
5387
+ this.status === he.AUTHENTICATED && this._trySend(...e);
5373
5388
  }
5374
5389
  _trySend(e, n, r) {
5375
5390
  if (this._transport.isOpen()) {
@@ -5411,7 +5426,7 @@ class Fu {
5411
5426
  *
5412
5427
  */
5413
5428
  getLocalId(e) {
5414
- return F(this, void 0, void 0, function* () {
5429
+ return N(this, void 0, void 0, function* () {
5415
5430
  const n = `localToken_${e}`;
5416
5431
  if (this.kv.currentValue[n])
5417
5432
  return this.kv.currentValue[n];
@@ -5452,7 +5467,7 @@ class Fu {
5452
5467
  * @returns Promise<null | {error: {message: string}}>
5453
5468
  */
5454
5469
  _oauthLoginInit() {
5455
- return F(this, void 0, void 0, function* () {
5470
+ return N(this, void 0, void 0, function* () {
5456
5471
  var e, n, r, i;
5457
5472
  if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
5458
5473
  return null;
@@ -5480,7 +5495,7 @@ class Fu {
5480
5495
  });
5481
5496
  }
5482
5497
  _waitForOAuthCallbackResponse() {
5483
- return F(this, void 0, void 0, function* () {
5498
+ return N(this, void 0, void 0, function* () {
5484
5499
  return yield this._oauthCallbackResponse;
5485
5500
  });
5486
5501
  }
@@ -5495,16 +5510,16 @@ class Fu {
5495
5510
  n.isLoading || e(this._currentUserCached);
5496
5511
  let r = !1;
5497
5512
  return this.getCurrentUser().then((i) => {
5498
- r || St(i, n) || e(i);
5513
+ r || Ot(i, n) || e(i);
5499
5514
  }), () => {
5500
5515
  r = !0, this.authCbs = this.authCbs.filter((i) => i !== e);
5501
5516
  };
5502
5517
  }
5503
5518
  getAuth() {
5504
- return F(this, void 0, void 0, function* () {
5519
+ return N(this, void 0, void 0, function* () {
5505
5520
  const { user: e, error: n } = yield this.getCurrentUser();
5506
5521
  if (n)
5507
- throw new Ke("Could not get current user: " + n.message);
5522
+ throw new qe("Could not get current user: " + n.message);
5508
5523
  return e;
5509
5524
  });
5510
5525
  }
@@ -5534,7 +5549,7 @@ class Fu {
5534
5549
  this.connectionStatusCbs.forEach((n) => n(e));
5535
5550
  }
5536
5551
  setCurrentUser(e) {
5537
- return F(this, void 0, void 0, function* () {
5552
+ return N(this, void 0, void 0, function* () {
5538
5553
  this.kv.updateInPlace((n) => {
5539
5554
  n[Ge] = e;
5540
5555
  }), yield this.kv.waitForKeyToLoad(Ge);
@@ -5544,13 +5559,13 @@ class Fu {
5544
5559
  return this._currentUserCached;
5545
5560
  }
5546
5561
  _getCurrentUser() {
5547
- return F(this, void 0, void 0, function* () {
5562
+ return N(this, void 0, void 0, function* () {
5548
5563
  const e = yield this.kv.waitForKeyToLoad(Ge);
5549
5564
  return typeof e == "string" ? JSON.parse(e) : e;
5550
5565
  });
5551
5566
  }
5552
5567
  getCurrentUser() {
5553
- return F(this, void 0, void 0, function* () {
5568
+ return N(this, void 0, void 0, function* () {
5554
5569
  const e = yield this._waitForOAuthCallbackResponse();
5555
5570
  if (e != null && e.error) {
5556
5571
  const n = { error: e.error, user: void 0 };
@@ -5569,16 +5584,16 @@ class Fu {
5569
5584
  });
5570
5585
  }
5571
5586
  _hasCurrentUser() {
5572
- return F(this, void 0, void 0, function* () {
5587
+ return N(this, void 0, void 0, function* () {
5573
5588
  const e = yield this.kv.waitForKeyToLoad(Ge);
5574
5589
  return typeof e == "string" ? JSON.parse(e) != null : e != null;
5575
5590
  });
5576
5591
  }
5577
5592
  changeCurrentUser(e) {
5578
- return F(this, void 0, void 0, function* () {
5593
+ return N(this, void 0, void 0, function* () {
5579
5594
  var n;
5580
5595
  const { user: r } = yield this.getCurrentUser();
5581
- if (!St(r, e)) {
5596
+ if (!Ot(r, e)) {
5582
5597
  yield this.setCurrentUser(e), this.updateUser(e);
5583
5598
  try {
5584
5599
  (n = this._broadcastChannel) === null || n === void 0 || n.postMessage({ type: "auth" });
@@ -5604,7 +5619,7 @@ class Fu {
5604
5619
  });
5605
5620
  }
5606
5621
  signInWithMagicCode(e) {
5607
- return F(this, arguments, void 0, function* ({ email: n, code: r }) {
5622
+ return N(this, arguments, void 0, function* ({ email: n, code: r }) {
5608
5623
  var i;
5609
5624
  const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield Za({
5610
5625
  apiURI: this.config.apiURI,
@@ -5617,7 +5632,7 @@ class Fu {
5617
5632
  });
5618
5633
  }
5619
5634
  signInWithCustomToken(e) {
5620
- return F(this, void 0, void 0, function* () {
5635
+ return N(this, void 0, void 0, function* () {
5621
5636
  const n = yield Xa({
5622
5637
  apiURI: this.config.apiURI,
5623
5638
  appId: this.config.appId,
@@ -5627,7 +5642,7 @@ class Fu {
5627
5642
  });
5628
5643
  }
5629
5644
  signInAsGuest() {
5630
- return F(this, void 0, void 0, function* () {
5645
+ return N(this, void 0, void 0, function* () {
5631
5646
  const e = yield eu({
5632
5647
  apiURI: this.config.apiURI,
5633
5648
  appId: this.config.appId
@@ -5654,7 +5669,7 @@ class Fu {
5654
5669
  });
5655
5670
  }
5656
5671
  signOut(e) {
5657
- return F(this, void 0, void 0, function* () {
5672
+ return N(this, void 0, void 0, function* () {
5658
5673
  const n = yield this.getCurrentUser();
5659
5674
  this.potentiallyInvalidateToken(n, e), yield this.changeCurrentUser(null);
5660
5675
  });
@@ -5677,7 +5692,7 @@ class Fu {
5677
5692
  * @param {string} [params.codeVerifier] - The code verifier used to generate the code challenge.
5678
5693
  */
5679
5694
  exchangeCodeForToken(e) {
5680
- return F(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
5695
+ return N(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
5681
5696
  var i;
5682
5697
  const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield Rr({
5683
5698
  apiURI: this.config.apiURI,
@@ -5700,7 +5715,7 @@ class Fu {
5700
5715
  * @param {string | null | undefined} [params.nonce] - The nonce used when requesting the id_token from the external service
5701
5716
  */
5702
5717
  signInWithIdToken(e) {
5703
- return F(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
5718
+ return N(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
5704
5719
  var s;
5705
5720
  const o = yield this.getCurrentUser(), a = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, u = yield tu({
5706
5721
  apiURI: this.config.apiURI,
@@ -5800,7 +5815,7 @@ class Fu {
5800
5815
  const o = ((i = (r = this._presence[e]) === null || r === void 0 ? void 0 : r.result) === null || i === void 0 ? void 0 : i.peers) || {};
5801
5816
  let a = Object.fromEntries(Object.entries(o).map(([c, d]) => [c, { data: d }]));
5802
5817
  (s = this._presence[e]) === null || s === void 0 || s.result;
5803
- const u = Ct(a, (c) => {
5818
+ const u = It(a, (c) => {
5804
5819
  for (let [d, f, l] of n)
5805
5820
  switch (f) {
5806
5821
  case "+":
@@ -5821,7 +5836,7 @@ class Fu {
5821
5836
  const r = Object.assign({}, n);
5822
5837
  delete r[this._sessionId];
5823
5838
  const i = Object.fromEntries(Object.entries(r).map(([s, o]) => [s, o.data]));
5824
- this._presence = Ct(this._presence, (s) => {
5839
+ this._presence = It(this._presence, (s) => {
5825
5840
  Tr(s, [e, "result", "peers"], i);
5826
5841
  });
5827
5842
  }
@@ -5864,14 +5879,14 @@ class Fu {
5864
5879
  // --------
5865
5880
  // Storage
5866
5881
  uploadFile(e, n, r) {
5867
- return F(this, void 0, void 0, function* () {
5882
+ return N(this, void 0, void 0, function* () {
5868
5883
  var i;
5869
5884
  const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
5870
5885
  return ru(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
5871
5886
  });
5872
5887
  }
5873
5888
  deleteFile(e) {
5874
- return F(this, void 0, void 0, function* () {
5889
+ return N(this, void 0, void 0, function* () {
5875
5890
  var n;
5876
5891
  const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
5877
5892
  return yield iu({
@@ -5885,7 +5900,7 @@ class Fu {
5885
5900
  // Deprecated Storage API (Jan 2025)
5886
5901
  // ---------------------------------
5887
5902
  upload(e, n) {
5888
- return F(this, void 0, void 0, function* () {
5903
+ return N(this, void 0, void 0, function* () {
5889
5904
  var r;
5890
5905
  const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name, a = yield su({
5891
5906
  apiURI: this.config.apiURI,
@@ -5897,7 +5912,7 @@ class Fu {
5897
5912
  });
5898
5913
  }
5899
5914
  getDownloadUrl(e) {
5900
- return F(this, void 0, void 0, function* () {
5915
+ return N(this, void 0, void 0, function* () {
5901
5916
  var n;
5902
5917
  const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
5903
5918
  return yield au({
@@ -5910,7 +5925,7 @@ class Fu {
5910
5925
  }
5911
5926
  }
5912
5927
  function Nu(t, e) {
5913
- return new Ut(
5928
+ return new Lt(
5914
5929
  Hi(t, e),
5915
5930
  // (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
5916
5931
  // type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
@@ -5922,7 +5937,7 @@ function Nu(t, e) {
5922
5937
  );
5923
5938
  }
5924
5939
  function Ku(t) {
5925
- return new Dt(t, {});
5940
+ return new Ut(t, {});
5926
5941
  }
5927
5942
  function qu() {
5928
5943
  return new H("string", !0, !1);
@@ -5955,12 +5970,12 @@ function Hi(t, e) {
5955
5970
  };
5956
5971
  return Object.fromEntries(Object.entries(t).map(([u, c]) => [
5957
5972
  u,
5958
- new Dt(c.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
5973
+ new Ut(c.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
5959
5974
  ]));
5960
5975
  }
5961
5976
  function Qu({ entities: t, links: e, rooms: n }) {
5962
5977
  const r = e ?? {}, i = n ?? {};
5963
- return new Ut(
5978
+ return new Lt(
5964
5979
  Hi(t, r),
5965
5980
  // (XXX): LinksDef<any> stems from TypeScript's inability to reconcile the
5966
5981
  // type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
@@ -5984,9 +5999,9 @@ const Fc = {
5984
5999
  json: Bu,
5985
6000
  any: Gu
5986
6001
  };
5987
- let Tt;
6002
+ let mt;
5988
6003
  function Hu(t, e) {
5989
- Tt == null || Tt.dispose();
6004
+ mt == null || mt.dispose();
5990
6005
  const n = tc(e), r = Zu(e, a), i = Ju(Yu(t));
5991
6006
  function s(d) {
5992
6007
  var f;
@@ -6003,7 +6018,7 @@ function Hu(t, e) {
6003
6018
  n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", s);
6004
6019
  }
6005
6020
  function c() {
6006
- document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), Tt = {
6021
+ document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), mt = {
6007
6022
  dispose: u
6008
6023
  };
6009
6024
  }
@@ -6374,10 +6389,10 @@ function hc() {
6374
6389
  M.unshift("Warning: " + w), Function.prototype.apply.call(console[h], console, M);
6375
6390
  }
6376
6391
  }
6377
- var S = !1, C = !1, x = !1, K = !1, ze = !1, ft;
6392
+ var S = !1, C = !1, $ = !1, D = !1, Ve = !1, ft;
6378
6393
  ft = Symbol.for("react.module.reference");
6379
- function Lt(h) {
6380
- return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || ze || h === s || h === d || h === f || K || h === y || S || C || x || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof === a || h.$$typeof === u || h.$$typeof === c || // This needs to include all possible module reference object
6394
+ function lt(h) {
6395
+ return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Ve || h === s || h === d || h === f || D || h === y || S || C || $ || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof === a || h.$$typeof === u || h.$$typeof === c || // This needs to include all possible module reference object
6381
6396
  // types supported by any Flight configuration anywhere since
6382
6397
  // we don't know which Flight build this will end up being used
6383
6398
  // with.
@@ -6390,7 +6405,7 @@ function hc() {
6390
6405
  var P = w.displayName || w.name || "";
6391
6406
  return P !== "" ? v + "(" + P + ")" : v;
6392
6407
  }
6393
- function lt(h) {
6408
+ function ht(h) {
6394
6409
  return h.displayName || "Context";
6395
6410
  }
6396
6411
  function ce(h) {
@@ -6418,10 +6433,10 @@ function hc() {
6418
6433
  switch (h.$$typeof) {
6419
6434
  case u:
6420
6435
  var w = h;
6421
- return lt(w) + ".Consumer";
6436
+ return ht(w) + ".Consumer";
6422
6437
  case a:
6423
6438
  var v = h;
6424
- return lt(v._context) + ".Provider";
6439
+ return ht(v._context) + ".Provider";
6425
6440
  case c:
6426
6441
  return Ft(h, h.render, "ForwardRef");
6427
6442
  case l:
@@ -6438,13 +6453,13 @@ function hc() {
6438
6453
  }
6439
6454
  return null;
6440
6455
  }
6441
- var we = Object.assign, Ve = 0, Bn, Gn, Qn, Hn, Yn, Jn, Zn;
6456
+ var le = Object.assign, Te = 0, Bn, Gn, Qn, Hn, Yn, Jn, Zn;
6442
6457
  function Xn() {
6443
6458
  }
6444
6459
  Xn.__reactDisabledLog = !0;
6445
6460
  function Ji() {
6446
6461
  {
6447
- if (Ve === 0) {
6462
+ if (Te === 0) {
6448
6463
  Bn = console.log, Gn = console.info, Qn = console.warn, Hn = console.error, Yn = console.group, Jn = console.groupCollapsed, Zn = console.groupEnd;
6449
6464
  var h = {
6450
6465
  configurable: !0,
@@ -6462,46 +6477,46 @@ function hc() {
6462
6477
  groupEnd: h
6463
6478
  });
6464
6479
  }
6465
- Ve++;
6480
+ Te++;
6466
6481
  }
6467
6482
  }
6468
6483
  function Zi() {
6469
6484
  {
6470
- if (Ve--, Ve === 0) {
6485
+ if (Te--, Te === 0) {
6471
6486
  var h = {
6472
6487
  configurable: !0,
6473
6488
  enumerable: !0,
6474
6489
  writable: !0
6475
6490
  };
6476
6491
  Object.defineProperties(console, {
6477
- log: we({}, h, {
6492
+ log: le({}, h, {
6478
6493
  value: Bn
6479
6494
  }),
6480
- info: we({}, h, {
6495
+ info: le({}, h, {
6481
6496
  value: Gn
6482
6497
  }),
6483
- warn: we({}, h, {
6498
+ warn: le({}, h, {
6484
6499
  value: Qn
6485
6500
  }),
6486
- error: we({}, h, {
6501
+ error: le({}, h, {
6487
6502
  value: Hn
6488
6503
  }),
6489
- group: we({}, h, {
6504
+ group: le({}, h, {
6490
6505
  value: Yn
6491
6506
  }),
6492
- groupCollapsed: we({}, h, {
6507
+ groupCollapsed: le({}, h, {
6493
6508
  value: Jn
6494
6509
  }),
6495
- groupEnd: we({}, h, {
6510
+ groupEnd: le({}, h, {
6496
6511
  value: Zn
6497
6512
  })
6498
6513
  });
6499
6514
  }
6500
- Ve < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
6515
+ Te < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
6501
6516
  }
6502
6517
  }
6503
6518
  var Nt = g.ReactCurrentDispatcher, Kt;
6504
- function ht(h, w, v) {
6519
+ function pt(h, w, v) {
6505
6520
  {
6506
6521
  if (Kt === void 0)
6507
6522
  try {
@@ -6514,16 +6529,16 @@ function hc() {
6514
6529
  ` + Kt + h;
6515
6530
  }
6516
6531
  }
6517
- var qt = !1, pt;
6532
+ var qt = !1, yt;
6518
6533
  {
6519
6534
  var Xi = typeof WeakMap == "function" ? WeakMap : Map;
6520
- pt = new Xi();
6535
+ yt = new Xi();
6521
6536
  }
6522
6537
  function er(h, w) {
6523
6538
  if (!h || qt)
6524
6539
  return "";
6525
6540
  {
6526
- var v = pt.get(h);
6541
+ var v = yt.get(h);
6527
6542
  if (v !== void 0)
6528
6543
  return v;
6529
6544
  }
@@ -6569,26 +6584,26 @@ function hc() {
6569
6584
  if (Y && E && typeof Y.stack == "string") {
6570
6585
  for (var k = Y.stack.split(`
6571
6586
  `), G = E.stack.split(`
6572
- `), D = k.length - 1, L = G.length - 1; D >= 1 && L >= 0 && k[D] !== G[L]; )
6573
- L--;
6574
- for (; D >= 1 && L >= 0; D--, L--)
6575
- if (k[D] !== G[L]) {
6576
- if (D !== 1 || L !== 1)
6587
+ `), U = k.length - 1, F = G.length - 1; U >= 1 && F >= 0 && k[U] !== G[F]; )
6588
+ F--;
6589
+ for (; U >= 1 && F >= 0; U--, F--)
6590
+ if (k[U] !== G[F]) {
6591
+ if (U !== 1 || F !== 1)
6577
6592
  do
6578
- if (D--, L--, L < 0 || k[D] !== G[L]) {
6593
+ if (U--, F--, F < 0 || k[U] !== G[F]) {
6579
6594
  var re = `
6580
- ` + k[D].replace(" at new ", " at ");
6581
- return h.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", h.displayName)), typeof h == "function" && pt.set(h, re), re;
6595
+ ` + k[U].replace(" at new ", " at ");
6596
+ return h.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", h.displayName)), typeof h == "function" && yt.set(h, re), re;
6582
6597
  }
6583
- while (D >= 1 && L >= 0);
6598
+ while (U >= 1 && F >= 0);
6584
6599
  break;
6585
6600
  }
6586
6601
  }
6587
6602
  } finally {
6588
6603
  qt = !1, Nt.current = M, Zi(), Error.prepareStackTrace = P;
6589
6604
  }
6590
- var Ie = h ? h.displayName || h.name : "", Te = Ie ? ht(Ie) : "";
6591
- return typeof h == "function" && pt.set(h, Te), Te;
6605
+ var Me = h ? h.displayName || h.name : "", me = Me ? pt(Me) : "";
6606
+ return typeof h == "function" && yt.set(h, me), me;
6592
6607
  }
6593
6608
  function es(h, w, v) {
6594
6609
  return er(h, !1);
@@ -6597,29 +6612,29 @@ function hc() {
6597
6612
  var w = h.prototype;
6598
6613
  return !!(w && w.isReactComponent);
6599
6614
  }
6600
- function yt(h, w, v) {
6615
+ function bt(h, w, v) {
6601
6616
  if (h == null)
6602
6617
  return "";
6603
6618
  if (typeof h == "function")
6604
6619
  return er(h, ts(h));
6605
6620
  if (typeof h == "string")
6606
- return ht(h);
6621
+ return pt(h);
6607
6622
  switch (h) {
6608
6623
  case d:
6609
- return ht("Suspense");
6624
+ return pt("Suspense");
6610
6625
  case f:
6611
- return ht("SuspenseList");
6626
+ return pt("SuspenseList");
6612
6627
  }
6613
6628
  if (typeof h == "object")
6614
6629
  switch (h.$$typeof) {
6615
6630
  case c:
6616
6631
  return es(h.render);
6617
6632
  case l:
6618
- return yt(h.type, w, v);
6633
+ return bt(h.type, w, v);
6619
6634
  case p: {
6620
6635
  var E = h, P = E._payload, M = E._init;
6621
6636
  try {
6622
- return yt(M(P), w, v);
6637
+ return bt(M(P), w, v);
6623
6638
  } catch {
6624
6639
  }
6625
6640
  }
@@ -6627,9 +6642,9 @@ function hc() {
6627
6642
  return "";
6628
6643
  }
6629
6644
  var Be = Object.prototype.hasOwnProperty, tr = {}, nr = g.ReactDebugCurrentFrame;
6630
- function bt(h) {
6645
+ function _t(h) {
6631
6646
  if (h) {
6632
- var w = h._owner, v = yt(h.type, h._source, w ? w.type : null);
6647
+ var w = h._owner, v = bt(h.type, h._source, w ? w.type : null);
6633
6648
  nr.setExtraStackFrame(v);
6634
6649
  } else
6635
6650
  nr.setExtraStackFrame(null);
@@ -6646,10 +6661,10 @@ function hc() {
6646
6661
  throw G.name = "Invariant Violation", G;
6647
6662
  }
6648
6663
  k = h[I](w, I, E, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
6649
- } catch (D) {
6650
- k = D;
6664
+ } catch (U) {
6665
+ k = U;
6651
6666
  }
6652
- k && !(k instanceof Error) && (bt(P), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", E || "React class", v, I, typeof k), bt(null)), k instanceof Error && !(k.message in tr) && (tr[k.message] = !0, bt(P), m("Failed %s type: %s", v, k.message), bt(null));
6667
+ k && !(k instanceof Error) && (_t(P), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", E || "React class", v, I, typeof k), _t(null)), k instanceof Error && !(k.message in tr) && (tr[k.message] = !0, _t(P), m("Failed %s type: %s", v, k.message), _t(null));
6653
6668
  }
6654
6669
  }
6655
6670
  }
@@ -6760,21 +6775,21 @@ function hc() {
6760
6775
  for (M in w)
6761
6776
  Be.call(w, M) && !os.hasOwnProperty(M) && (I[M] = w[M]);
6762
6777
  if (h && h.defaultProps) {
6763
- var D = h.defaultProps;
6764
- for (M in D)
6765
- I[M] === void 0 && (I[M] = D[M]);
6778
+ var U = h.defaultProps;
6779
+ for (M in U)
6780
+ I[M] === void 0 && (I[M] = U[M]);
6766
6781
  }
6767
6782
  if (k || G) {
6768
- var L = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
6769
- k && ds(I, L), G && fs(I, L);
6783
+ var F = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
6784
+ k && ds(I, F), G && fs(I, F);
6770
6785
  }
6771
6786
  return ls(h, k, G, P, E, sr.current, I);
6772
6787
  }
6773
6788
  }
6774
6789
  var zt = g.ReactCurrentOwner, ur = g.ReactDebugCurrentFrame;
6775
- function Ce(h) {
6790
+ function Pe(h) {
6776
6791
  if (h) {
6777
- var w = h._owner, v = yt(h.type, h._source, w ? w.type : null);
6792
+ var w = h._owner, v = bt(h.type, h._source, w ? w.type : null);
6778
6793
  ur.setExtraStackFrame(v);
6779
6794
  } else
6780
6795
  ur.setExtraStackFrame(null);
@@ -6822,7 +6837,7 @@ Check the top-level render call using <` + v + ">.");
6822
6837
  return;
6823
6838
  dr[v] = !0;
6824
6839
  var E = "";
6825
- h && h._owner && h._owner !== zt.current && (E = " It was passed a child from " + ce(h._owner.type) + "."), Ce(h), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', v, E), Ce(null);
6840
+ h && h._owner && h._owner !== zt.current && (E = " It was passed a child from " + ce(h._owner.type) + "."), Pe(h), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', v, E), Pe(null);
6826
6841
  }
6827
6842
  }
6828
6843
  function lr(h, w) {
@@ -6874,35 +6889,35 @@ Check the top-level render call using <` + v + ">.");
6874
6889
  for (var w = Object.keys(h.props), v = 0; v < w.length; v++) {
6875
6890
  var E = w[v];
6876
6891
  if (E !== "children" && E !== "key") {
6877
- Ce(h), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", E), Ce(null);
6892
+ Pe(h), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", E), Pe(null);
6878
6893
  break;
6879
6894
  }
6880
6895
  }
6881
- h.ref !== null && (Ce(h), m("Invalid attribute `ref` supplied to `React.Fragment`."), Ce(null));
6896
+ h.ref !== null && (Pe(h), m("Invalid attribute `ref` supplied to `React.Fragment`."), Pe(null));
6882
6897
  }
6883
6898
  }
6884
6899
  var hr = {};
6885
6900
  function pr(h, w, v, E, P, M) {
6886
6901
  {
6887
- var I = Lt(h);
6902
+ var I = lt(h);
6888
6903
  if (!I) {
6889
6904
  var k = "";
6890
6905
  (h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (k += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
6891
6906
  var G = ps();
6892
6907
  G ? k += G : k += cr();
6893
- var D;
6894
- h === null ? D = "null" : Wt(h) ? D = "array" : h !== void 0 && h.$$typeof === n ? (D = "<" + (ce(h.type) || "Unknown") + " />", k = " Did you accidentally export a JSX literal instead of a component?") : D = typeof h, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", D, k);
6908
+ var U;
6909
+ h === null ? U = "null" : Wt(h) ? U = "array" : h !== void 0 && h.$$typeof === n ? (U = "<" + (ce(h.type) || "Unknown") + " />", k = " Did you accidentally export a JSX literal instead of a component?") : U = typeof h, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", U, k);
6895
6910
  }
6896
- var L = hs(h, w, v, P, M);
6897
- if (L == null)
6898
- return L;
6911
+ var F = hs(h, w, v, P, M);
6912
+ if (F == null)
6913
+ return F;
6899
6914
  if (I) {
6900
6915
  var re = w.children;
6901
6916
  if (re !== void 0)
6902
6917
  if (E)
6903
6918
  if (Wt(re)) {
6904
- for (var Ie = 0; Ie < re.length; Ie++)
6905
- lr(re[Ie], h);
6919
+ for (var Me = 0; Me < re.length; Me++)
6920
+ lr(re[Me], h);
6906
6921
  Object.freeze && Object.freeze(re);
6907
6922
  } else
6908
6923
  m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
@@ -6910,20 +6925,20 @@ Check the top-level render call using <` + v + ">.");
6910
6925
  lr(re, h);
6911
6926
  }
6912
6927
  if (Be.call(w, "key")) {
6913
- var Te = ce(h), Y = Object.keys(w).filter(function(Ss) {
6928
+ var me = ce(h), Y = Object.keys(w).filter(function(Ss) {
6914
6929
  return Ss !== "key";
6915
6930
  }), Gt = Y.length > 0 ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}";
6916
- if (!hr[Te + Gt]) {
6931
+ if (!hr[me + Gt]) {
6917
6932
  var vs = Y.length > 0 ? "{" + Y.join(": ..., ") + ": ...}" : "{}";
6918
6933
  m(`A props object containing a "key" prop is being spread into JSX:
6919
6934
  let props = %s;
6920
6935
  <%s {...props} />
6921
6936
  React keys must be passed directly to JSX without using spread:
6922
6937
  let props = %s;
6923
- <%s key={someKey} {...props} />`, Gt, Te, vs, Te), hr[Te + Gt] = !0;
6938
+ <%s key={someKey} {...props} />`, Gt, me, vs, me), hr[me + Gt] = !0;
6924
6939
  }
6925
6940
  }
6926
- return h === i ? _s(L) : bs(L), L;
6941
+ return h === i ? _s(F) : bs(F), F;
6927
6942
  }
6928
6943
  }
6929
6944
  function gs(h, w, v) {
@@ -6950,7 +6965,7 @@ function ei(t) {
6950
6965
  }
6951
6966
  function bc(t, e, n) {
6952
6967
  e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
6953
- const r = e ? ac(e) : null, i = B(r), s = ot(ei(t._reactor.getPreviousResult(r))), o = ge(
6968
+ const r = e ? ac(e) : null, i = B(r), s = ot(ei(t._reactor.getPreviousResult(r))), o = we(
6954
6969
  (u) => (s.current = ei(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (d) => {
6955
6970
  s.current = Object.assign({
6956
6971
  isLoading: !d,
@@ -6970,7 +6985,7 @@ function bc(t, e, n) {
6970
6985
  }
6971
6986
  function _c() {
6972
6987
  const t = ot(null);
6973
- Ee(() => {
6988
+ ke(() => {
6974
6989
  n();
6975
6990
  }, []);
6976
6991
  function e(r, i) {
@@ -6984,12 +6999,12 @@ function _c() {
6984
6999
  const gc = 1e3;
6985
7000
  function wc(t, e, n) {
6986
7001
  const r = ot(n);
6987
- r.current = n, Ee(() => t.core._reactor.subscribeTopic(t.id, e, (s, o) => {
7002
+ r.current = n, ke(() => t.core._reactor.subscribeTopic(t.id, e, (s, o) => {
6988
7003
  r.current(s, o);
6989
7004
  }), [t.id, e]);
6990
7005
  }
6991
7006
  function Tc(t, e) {
6992
- return Ee(() => t.core._reactor.joinRoom(t.id), [t.id]), ge((r) => {
7007
+ return ke(() => t.core._reactor.joinRoom(t.id), [t.id]), we((r) => {
6993
7008
  t.core._reactor.publishTopic({
6994
7009
  roomType: t.type,
6995
7010
  roomId: t.id,
@@ -7007,25 +7022,25 @@ function mc(t, e = {}) {
7007
7022
  isLoading: !0
7008
7023
  };
7009
7024
  });
7010
- Ee(() => t.core._reactor.subscribePresence(t.type, t.id, e, (c) => {
7025
+ ke(() => t.core._reactor.subscribePresence(t.type, t.id, e, (c) => {
7011
7026
  s(c);
7012
7027
  }), [t.id, e.user, (n = e.peers) === null || n === void 0 ? void 0 : n.join(), (r = e.keys) === null || r === void 0 ? void 0 : r.join()]);
7013
- const o = ge((u) => {
7028
+ const o = we((u) => {
7014
7029
  t.core._reactor.publishPresence(t.type, t.id, u);
7015
7030
  }, [t.type, t.id]);
7016
7031
  return tn(() => Object.assign(Object.assign({}, i), { publishPresence: o }), [i, o]);
7017
7032
  }
7018
7033
  function vc(t, e, n) {
7019
- Ee(() => t.core._reactor.joinRoom(t.id, e), [t.id]), Ee(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
7034
+ ke(() => t.core._reactor.joinRoom(t.id, e), [t.id]), ke(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
7020
7035
  }
7021
7036
  function Sc(t, e, n = {}) {
7022
- const r = _c(), i = ve.usePresence(t, {
7037
+ const r = _c(), i = Se.usePresence(t, {
7023
7038
  keys: [e]
7024
7039
  }), s = tn(() => {
7025
7040
  var d;
7026
7041
  const f = t._core._reactor.getPresence(t.type, t.id);
7027
7042
  return n != null && n.writeOnly ? [] : Object.values((d = f == null ? void 0 : f.peers) !== null && d !== void 0 ? d : {}).filter((l) => l[e] === !0);
7028
- }, [n == null ? void 0 : n.writeOnly, i]), o = ge((d) => {
7043
+ }, [n == null ? void 0 : n.writeOnly, i]), o = we((d) => {
7029
7044
  var f;
7030
7045
  t.core._reactor.publishPresence(t.type, t.id, {
7031
7046
  [e]: d
@@ -7034,10 +7049,10 @@ function Sc(t, e, n = {}) {
7034
7049
  [e]: null
7035
7050
  });
7036
7051
  }));
7037
- }, [t.type, t.id, e, n == null ? void 0 : n.timeout, r]), a = ge((d) => {
7052
+ }, [t.type, t.id, e, n == null ? void 0 : n.timeout, r]), a = we((d) => {
7038
7053
  const l = !((n == null ? void 0 : n.stopOnEnter) && d.key === "Enter");
7039
7054
  o(l);
7040
- }, [n.stopOnEnter, o]), u = ge(() => {
7055
+ }, [n.stopOnEnter, o]), u = we(() => {
7041
7056
  o(!1);
7042
7057
  }, [o]), c = tn(() => ({ onKeyDown: a, onBlur: u }), [a, u]);
7043
7058
  return {
@@ -7046,7 +7061,7 @@ function Sc(t, e, n = {}) {
7046
7061
  inputProps: c
7047
7062
  };
7048
7063
  }
7049
- const ve = {
7064
+ const Se = {
7050
7065
  useTopicEffect: wc,
7051
7066
  usePublishTopic: Tc,
7052
7067
  usePresence: mc,
@@ -7056,8 +7071,8 @@ const ve = {
7056
7071
  class Oc {
7057
7072
  constructor(e, n, r) {
7058
7073
  this.useTopicEffect = (i, s) => {
7059
- ve.useTopicEffect(this, i, s);
7060
- }, this.usePublishTopic = (i) => ve.usePublishTopic(this, i), this.usePresence = (i = {}) => ve.usePresence(this, i), this.useSyncPresence = (i, s) => ve.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => ve.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
7074
+ Se.useTopicEffect(this, i, s);
7075
+ }, this.usePublishTopic = (i) => Se.usePublishTopic(this, i), this.usePresence = (i = {}) => Se.usePresence(this, i), this.useSyncPresence = (i, s) => Se.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => Se.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
7061
7076
  }
7062
7077
  }
7063
7078
  var Ec = function(t, e, n, r) {
@@ -7096,24 +7111,24 @@ class kc {
7096
7111
  constructor(e, n) {
7097
7112
  this.tx = Kn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
7098
7113
  const [i, s] = ai(null);
7099
- return Ee(() => {
7114
+ return ke(() => {
7100
7115
  Ec(this, void 0, void 0, function* () {
7101
7116
  const a = yield this.getLocalId(r);
7102
7117
  s(a);
7103
7118
  });
7104
7119
  }, [r]), i;
7105
- }, this.rooms = ve, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => bc(this.core, r, i).state, this.useAuth = () => {
7106
- const r = ot(this.core._reactor._currentUserCached), i = ge((o) => this.core.subscribeAuth((u) => {
7120
+ }, this.rooms = Se, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => bc(this.core, r, i).state, this.useAuth = () => {
7121
+ const r = ot(this.core._reactor._currentUserCached), i = we((o) => this.core.subscribeAuth((u) => {
7107
7122
  r.current = Object.assign({ isLoading: !1 }, u), o();
7108
7123
  }), []);
7109
7124
  return en(i, () => r.current, () => Ac);
7110
7125
  }, this.useUser = () => {
7111
7126
  const { user: r } = this.useAuth();
7112
7127
  if (!r)
7113
- throw new Ke("useUser must be used within an auth-protected route");
7128
+ throw new qe("useUser must be used within an auth-protected route");
7114
7129
  return r;
7115
7130
  }, this.useConnectionStatus = () => {
7116
- const r = ot(this.core._reactor.status), i = ge((o) => this.core.subscribeConnectionStatus((u) => {
7131
+ const r = ot(this.core._reactor.status), i = we((o) => this.core.subscribeConnectionStatus((u) => {
7117
7132
  u !== r.current && (r.current = u, o());
7118
7133
  }), []);
7119
7134
  return en(
@@ -7330,69 +7345,69 @@ function ri(t) {
7330
7345
  }
7331
7346
  var Yi = (t) => {
7332
7347
  throw TypeError(t);
7333
- }, zn = (t, e, n) => e.has(t) || Yi("Cannot " + n), A = (t, e, n) => (zn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), q = (t, e, n) => e.has(t) ? Yi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (zn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (zn(t, e, "access private method"), n), J, Se, Me, Et, Mt, it, $e, st, _e, Re, Le, xe, Xe, se, vn, Sn, On, ii, En, An, et, kn, jn;
7334
- class At extends EventTarget {
7348
+ }, zn = (t, e, n) => e.has(t) || Yi("Cannot " + n), A = (t, e, n) => (zn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), q = (t, e, n) => e.has(t) ? Yi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), x = (t, e, n, r) => (zn(t, e, "write to private field"), e.set(t, n), n), pe = (t, e, n) => (zn(t, e, "access private method"), n), J, Oe, xe, At, Rt, it, Ue, st, ge, $e, Fe, De, Xe, se, vn, Sn, On, ii, En, An, et, kn, jn;
7349
+ class kt extends EventTarget {
7335
7350
  constructor(e, n) {
7336
7351
  var r, i;
7337
- super(), q(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, q(this, J), q(this, Se), q(this, Me), q(this, Et), q(this, Mt), q(this, it), q(this, $e), q(this, st, null), q(this, _e), q(this, Re), q(this, Le, null), q(this, xe, null), q(this, Xe, null), q(this, Sn, async (s) => {
7352
+ super(), q(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, q(this, J), q(this, Oe), q(this, xe), q(this, At), q(this, Rt), q(this, it), q(this, Ue), q(this, st, null), q(this, ge), q(this, $e), q(this, Fe, null), q(this, De, null), q(this, Xe, null), q(this, Sn, async (s) => {
7338
7353
  var o;
7339
- A(this, Re).reset();
7354
+ A(this, $e).reset();
7340
7355
  const { body: a, redirected: u, status: c, headers: d } = s;
7341
7356
  if (c === 204) {
7342
- he(this, se, et).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
7357
+ pe(this, se, et).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
7343
7358
  return;
7344
7359
  }
7345
- if (u ? $(this, Me, new URL(s.url)) : $(this, Me, void 0), c !== 200) {
7346
- he(this, se, et).call(this, `Non-200 status code (${c})`, c);
7360
+ if (u ? x(this, xe, new URL(s.url)) : x(this, xe, void 0), c !== 200) {
7361
+ pe(this, se, et).call(this, `Non-200 status code (${c})`, c);
7347
7362
  return;
7348
7363
  }
7349
7364
  if (!(d.get("content-type") || "").startsWith("text/event-stream")) {
7350
- he(this, se, et).call(this, 'Invalid content type, expected "text/event-stream"', c);
7365
+ pe(this, se, et).call(this, 'Invalid content type, expected "text/event-stream"', c);
7351
7366
  return;
7352
7367
  }
7353
7368
  if (A(this, J) === this.CLOSED)
7354
7369
  return;
7355
- $(this, J, this.OPEN);
7370
+ x(this, J, this.OPEN);
7356
7371
  const f = new Event("open");
7357
7372
  if ((o = A(this, Xe)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
7358
- he(this, se, et).call(this, "Invalid response body, expected a web ReadableStream", c), this.close();
7373
+ pe(this, se, et).call(this, "Invalid response body, expected a web ReadableStream", c), this.close();
7359
7374
  return;
7360
7375
  }
7361
7376
  const l = new TextDecoder(), p = a.getReader();
7362
7377
  let y = !0;
7363
7378
  do {
7364
7379
  const { done: b, value: _ } = await p.read();
7365
- _ && A(this, Re).feed(l.decode(_, { stream: !b })), b && (y = !1, A(this, Re).reset(), he(this, se, kn).call(this));
7380
+ _ && A(this, $e).feed(l.decode(_, { stream: !b })), b && (y = !1, A(this, $e).reset(), pe(this, se, kn).call(this));
7366
7381
  } while (y);
7367
7382
  }), q(this, On, (s) => {
7368
- $(this, _e, void 0), !(s.name === "AbortError" || s.type === "aborted") && he(this, se, kn).call(this, mn(s));
7383
+ x(this, ge, void 0), !(s.name === "AbortError" || s.type === "aborted") && pe(this, se, kn).call(this, mn(s));
7369
7384
  }), q(this, En, (s) => {
7370
- typeof s.id == "string" && $(this, st, s.id);
7385
+ typeof s.id == "string" && x(this, st, s.id);
7371
7386
  const o = new MessageEvent(s.event || "message", {
7372
7387
  data: s.data,
7373
- origin: A(this, Me) ? A(this, Me).origin : A(this, Se).origin,
7388
+ origin: A(this, xe) ? A(this, xe).origin : A(this, Oe).origin,
7374
7389
  lastEventId: s.id || ""
7375
7390
  });
7376
- A(this, xe) && (!s.event || s.event === "message") && A(this, xe).call(this, o), this.dispatchEvent(o);
7391
+ A(this, De) && (!s.event || s.event === "message") && A(this, De).call(this, o), this.dispatchEvent(o);
7377
7392
  }), q(this, An, (s) => {
7378
- $(this, it, s);
7393
+ x(this, it, s);
7379
7394
  }), q(this, jn, () => {
7380
- $(this, $e, void 0), A(this, J) === this.CONNECTING && he(this, se, vn).call(this);
7395
+ x(this, Ue, void 0), A(this, J) === this.CONNECTING && pe(this, se, vn).call(this);
7381
7396
  });
7382
7397
  try {
7383
7398
  if (e instanceof URL)
7384
- $(this, Se, e);
7399
+ x(this, Oe, e);
7385
7400
  else if (typeof e == "string")
7386
- $(this, Se, new URL(e, Pc()));
7401
+ x(this, Oe, new URL(e, Pc()));
7387
7402
  else
7388
7403
  throw new Error("Invalid URL");
7389
7404
  } catch {
7390
7405
  throw Ic("An invalid or illegal string was specified");
7391
7406
  }
7392
- $(this, Re, jc({
7407
+ x(this, $e, jc({
7393
7408
  onEvent: A(this, En),
7394
7409
  onRetry: A(this, An)
7395
- })), $(this, J, this.CONNECTING), $(this, it, 3e3), $(this, Mt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, Et, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), he(this, se, vn).call(this);
7410
+ })), x(this, J, this.CONNECTING), x(this, it, 3e3), x(this, Rt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), x(this, At, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), pe(this, se, vn).call(this);
7396
7411
  }
7397
7412
  /**
7398
7413
  * Returns the state of this EventSource object's connection. It can have the values described below.
@@ -7415,7 +7430,7 @@ class At extends EventTarget {
7415
7430
  * @public
7416
7431
  */
7417
7432
  get url() {
7418
- return A(this, Se).href;
7433
+ return A(this, Oe).href;
7419
7434
  }
7420
7435
  /**
7421
7436
  * Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
@@ -7423,28 +7438,28 @@ class At extends EventTarget {
7423
7438
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
7424
7439
  */
7425
7440
  get withCredentials() {
7426
- return A(this, Et);
7441
+ return A(this, At);
7427
7442
  }
7428
7443
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
7429
7444
  get onerror() {
7430
- return A(this, Le);
7445
+ return A(this, Fe);
7431
7446
  }
7432
7447
  set onerror(e) {
7433
- $(this, Le, e);
7448
+ x(this, Fe, e);
7434
7449
  }
7435
7450
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
7436
7451
  get onmessage() {
7437
- return A(this, xe);
7452
+ return A(this, De);
7438
7453
  }
7439
7454
  set onmessage(e) {
7440
- $(this, xe, e);
7455
+ x(this, De, e);
7441
7456
  }
7442
7457
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
7443
7458
  get onopen() {
7444
7459
  return A(this, Xe);
7445
7460
  }
7446
7461
  set onopen(e) {
7447
- $(this, Xe, e);
7462
+ x(this, Xe, e);
7448
7463
  }
7449
7464
  addEventListener(e, n, r) {
7450
7465
  const i = n;
@@ -7462,16 +7477,16 @@ class At extends EventTarget {
7462
7477
  * @public
7463
7478
  */
7464
7479
  close() {
7465
- A(this, $e) && clearTimeout(A(this, $e)), A(this, J) !== this.CLOSED && (A(this, _e) && A(this, _e).abort(), $(this, J, this.CLOSED), $(this, _e, void 0));
7480
+ A(this, Ue) && clearTimeout(A(this, Ue)), A(this, J) !== this.CLOSED && (A(this, ge) && A(this, ge).abort(), x(this, J, this.CLOSED), x(this, ge, void 0));
7466
7481
  }
7467
7482
  }
7468
- J = /* @__PURE__ */ new WeakMap(), Se = /* @__PURE__ */ new WeakMap(), Me = /* @__PURE__ */ new WeakMap(), Et = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), _e = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), Le = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakSet(), /**
7483
+ J = /* @__PURE__ */ new WeakMap(), Oe = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap(), Rt = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakMap(), Ue = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), Fe = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakSet(), /**
7469
7484
  * Connect to the given URL and start receiving events
7470
7485
  *
7471
7486
  * @internal
7472
7487
  */
7473
7488
  vn = function() {
7474
- $(this, J, this.CONNECTING), $(this, _e, new AbortController()), A(this, Mt)(A(this, Se), he(this, se, ii).call(this)).then(A(this, Sn)).catch(A(this, On));
7489
+ x(this, J, this.CONNECTING), x(this, ge, new AbortController()), A(this, Rt)(A(this, Oe), pe(this, se, ii).call(this)).then(A(this, Sn)).catch(A(this, On));
7475
7490
  }, Sn = /* @__PURE__ */ new WeakMap(), On = /* @__PURE__ */ new WeakMap(), /**
7476
7491
  * Get request options for the `fetch()` request
7477
7492
  *
@@ -7487,7 +7502,7 @@ ii = function() {
7487
7502
  redirect: "follow",
7488
7503
  headers: { Accept: "text/event-stream", ...A(this, st) ? { "Last-Event-ID": A(this, st) } : void 0 },
7489
7504
  cache: "no-store",
7490
- signal: (t = A(this, _e)) == null ? void 0 : t.signal
7505
+ signal: (t = A(this, ge)) == null ? void 0 : t.signal
7491
7506
  };
7492
7507
  return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
7493
7508
  }, En = /* @__PURE__ */ new WeakMap(), An = /* @__PURE__ */ new WeakMap(), /**
@@ -7499,9 +7514,9 @@ ii = function() {
7499
7514
  */
7500
7515
  et = function(t, e) {
7501
7516
  var n;
7502
- A(this, J) !== this.CLOSED && $(this, J, this.CLOSED);
7517
+ A(this, J) !== this.CLOSED && x(this, J, this.CLOSED);
7503
7518
  const r = new ni("error", { code: e, message: t });
7504
- (n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r);
7519
+ (n = A(this, Fe)) == null || n.call(this, r), this.dispatchEvent(r);
7505
7520
  }, /**
7506
7521
  * Schedules a reconnection attempt against the EventSource endpoint.
7507
7522
  *
@@ -7513,32 +7528,32 @@ kn = function(t, e) {
7513
7528
  var n;
7514
7529
  if (A(this, J) === this.CLOSED)
7515
7530
  return;
7516
- $(this, J, this.CONNECTING);
7531
+ x(this, J, this.CONNECTING);
7517
7532
  const r = new ni("error", { code: e, message: t });
7518
- (n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r), $(this, $e, setTimeout(A(this, jn), A(this, it)));
7533
+ (n = A(this, Fe)) == null || n.call(this, r), this.dispatchEvent(r), x(this, Ue, setTimeout(A(this, jn), A(this, it)));
7519
7534
  }, jn = /* @__PURE__ */ new WeakMap(), /**
7520
7535
  * ReadyState representing an EventSource currently trying to connect
7521
7536
  *
7522
7537
  * @public
7523
7538
  */
7524
- At.CONNECTING = 0, /**
7539
+ kt.CONNECTING = 0, /**
7525
7540
  * ReadyState representing an EventSource connection that is open (eg connected)
7526
7541
  *
7527
7542
  * @public
7528
7543
  */
7529
- At.OPEN = 1, /**
7544
+ kt.OPEN = 1, /**
7530
7545
  * ReadyState representing an EventSource connection that is closed (eg disconnected)
7531
7546
  *
7532
7547
  * @public
7533
7548
  */
7534
- At.CLOSED = 2;
7549
+ kt.CLOSED = 2;
7535
7550
  function Pc() {
7536
7551
  const t = "document" in globalThis ? globalThis.document : void 0;
7537
7552
  return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
7538
7553
  }
7539
7554
  const Vn = class Vn extends kc {
7540
7555
  };
7541
- Vn.EventSourceImpl = At;
7556
+ Vn.EventSourceImpl = kt;
7542
7557
  let Cn = Vn;
7543
7558
  function Mc(t) {
7544
7559
  const e = {
@@ -7566,13 +7581,13 @@ function Kc({
7566
7581
  keys: [d]
7567
7582
  }), l = n._core._reactor.getPresence(n.type, n.id);
7568
7583
  function p(g, m) {
7569
- const O = m.clientX, S = m.clientY, C = (O - g.left) / g.width * 100, x = (S - g.top) / g.height * 100;
7584
+ const O = m.clientX, S = m.clientY, C = (O - g.left) / g.width * 100, $ = (S - g.top) / g.height * 100;
7570
7585
  f.publishPresence({
7571
7586
  [d]: {
7572
7587
  x: O,
7573
7588
  y: S,
7574
7589
  xPercent: C,
7575
- yPercent: x,
7590
+ yPercent: $,
7576
7591
  color: s
7577
7592
  }
7578
7593
  });
@@ -7710,10 +7725,10 @@ const si = {
7710
7725
  }, $c = 99999;
7711
7726
  export {
7712
7727
  Kc as Cursors,
7713
- $t as InstantAPIError,
7728
+ Dt as InstantAPIError,
7714
7729
  kc as InstantReactAbstractDatabase,
7715
7730
  Cn as InstantReactWebDatabase,
7716
- me as SyncTableCallbackEventType,
7731
+ ve as SyncTableCallbackEventType,
7717
7732
  Fc as i,
7718
7733
  W as id,
7719
7734
  Mc as init,