@instantdb/react 0.22.131 → 0.22.132

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  var _i = Object.defineProperty;
2
2
  var wi = (t, e, n) => e in t ? _i(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
3
  var p = (t, e, n) => wi(t, typeof e != "symbol" ? e + "" : e, n);
4
- import ts, { useRef as it, useCallback as _e, useSyncExternalStore as tn, useEffect as Oe, useMemo as nn, useState as ns, createElement as Ti } from "react";
4
+ import ts, { useRef as it, useCallback as we, useSyncExternalStore as nn, useEffect as Ae, useMemo as rn, useState as ns, createElement as Ti } from "react";
5
5
  function q(t) {
6
6
  if (typeof t == "number")
7
7
  return (Math.abs(t * 2654435761) >>> 0).toString(16);
@@ -44,10 +44,10 @@ const U = {
44
44
  Remove: "remove",
45
45
  Replace: "replace",
46
46
  Add: "add"
47
- }, rs = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), mi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), wt = Symbol.iterator, ne = {
47
+ }, rs = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), mi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Tt = Symbol.iterator, ne = {
48
48
  mutable: "mutable",
49
49
  immutable: "immutable"
50
- }, In = {};
50
+ }, Mn = {};
51
51
  function et(t, e) {
52
52
  return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
53
53
  }
@@ -62,23 +62,23 @@ function pr(t, e) {
62
62
  }
63
63
  }
64
64
  }
65
- function Mn(t) {
65
+ function jn(t) {
66
66
  return Object.getPrototypeOf(t) === Set.prototype;
67
67
  }
68
- function jn(t) {
68
+ function Rn(t) {
69
69
  return Object.getPrototypeOf(t) === Map.prototype;
70
70
  }
71
71
  function te(t) {
72
72
  var e;
73
73
  return (e = t.copy) !== null && e !== void 0 ? e : t.original;
74
74
  }
75
- function Ae(t) {
75
+ function ke(t) {
76
76
  return !!P(t);
77
77
  }
78
78
  function P(t) {
79
79
  return typeof t != "object" ? null : t == null ? void 0 : t[rs];
80
80
  }
81
- function Rn(t) {
81
+ function xn(t) {
82
82
  var e;
83
83
  const n = P(t);
84
84
  return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
@@ -109,28 +109,28 @@ function ss(t, e = []) {
109
109
  }
110
110
  return e;
111
111
  }
112
- function ke(t) {
112
+ function Ce(t) {
113
113
  return Array.isArray(t) ? 1 : t instanceof Map ? 2 : t instanceof Set ? 3 : 0;
114
114
  }
115
115
  function ye(t, e) {
116
- return ke(t) === 2 ? t.get(e) : t[e];
116
+ return Ce(t) === 2 ? t.get(e) : t[e];
117
117
  }
118
118
  function at(t, e, n) {
119
- ke(t) === 2 ? t.set(e, n) : t[e] = n;
119
+ Ce(t) === 2 ? t.set(e, n) : t[e] = n;
120
120
  }
121
- function Gt(t, e) {
121
+ function Qt(t, e) {
122
122
  const n = P(t);
123
123
  return (n ? te(n) : t)[e];
124
124
  }
125
125
  function pe(t, e) {
126
126
  return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
127
127
  }
128
- function rn(t) {
128
+ function sn(t) {
129
129
  if (t)
130
130
  for (; t.finalities.revoke.length > 0; )
131
131
  t.finalities.revoke.pop()();
132
132
  }
133
- function ve(t, e) {
133
+ function Ee(t, e) {
134
134
  return e ? t : [""].concat(t).map((n) => {
135
135
  const r = `${n}`;
136
136
  return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
@@ -139,7 +139,7 @@ function ve(t, e) {
139
139
  function Si(t, e) {
140
140
  for (let n = 0; n < e.length - 1; n += 1) {
141
141
  const r = e[n];
142
- if (t = ye(ke(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
142
+ if (t = ye(Ce(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
143
143
  throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
144
144
  }
145
145
  return t;
@@ -166,13 +166,13 @@ function is(t, e) {
166
166
  if (Array.isArray(t))
167
167
  return Array.prototype.concat.call(t);
168
168
  if (t instanceof Set) {
169
- if (!Mn(t)) {
169
+ if (!jn(t)) {
170
170
  const r = Object.getPrototypeOf(t).constructor;
171
171
  return new r(t.values());
172
172
  }
173
173
  return Set.prototype.difference ? Set.prototype.difference.call(t, /* @__PURE__ */ new Set()) : new Set(t.values());
174
174
  } else if (t instanceof Map) {
175
- if (!jn(t)) {
175
+ if (!Rn(t)) {
176
176
  const r = Object.getPrototypeOf(t).constructor;
177
177
  return new r(t);
178
178
  }
@@ -201,7 +201,7 @@ function Q(t) {
201
201
  }
202
202
  function Qe(t) {
203
203
  if (!ce(t))
204
- return Rn(t);
204
+ return xn(t);
205
205
  if (Array.isArray(t))
206
206
  return t.map(Qe);
207
207
  if (t instanceof Map) {
@@ -209,7 +209,7 @@ function Qe(t) {
209
209
  r,
210
210
  Qe(s)
211
211
  ]);
212
- if (!jn(t)) {
212
+ if (!Rn(t)) {
213
213
  const r = Object.getPrototypeOf(t).constructor;
214
214
  return new r(n);
215
215
  }
@@ -217,7 +217,7 @@ function Qe(t) {
217
217
  }
218
218
  if (t instanceof Set) {
219
219
  const n = Array.from(t).map(Qe);
220
- if (!Mn(t)) {
220
+ if (!jn(t)) {
221
221
  const r = Object.getPrototypeOf(t).constructor;
222
222
  return new r(n);
223
223
  }
@@ -228,8 +228,8 @@ function Qe(t) {
228
228
  e[n] = Qe(t[n]);
229
229
  return e;
230
230
  }
231
- function Tt(t) {
232
- return Ae(t) ? Qe(t) : t;
231
+ function mt(t) {
232
+ return ke(t) ? Qe(t) : t;
233
233
  }
234
234
  function fe(t) {
235
235
  var e;
@@ -238,7 +238,7 @@ function fe(t) {
238
238
  function yr() {
239
239
  throw new Error("Cannot modify frozen object");
240
240
  }
241
- function Me(t, e, n, r, s) {
241
+ function je(t, e, n, r, s) {
242
242
  {
243
243
  n = n ?? /* @__PURE__ */ new WeakMap(), r = r ?? [], s = s ?? [];
244
244
  const o = n.has(t) ? n.get(t) : t;
@@ -255,37 +255,37 @@ function Me(t, e, n, r, s) {
255
255
  } else
256
256
  r.push(o);
257
257
  }
258
- if (Object.isFrozen(t) || Ae(t)) {
258
+ if (Object.isFrozen(t) || ke(t)) {
259
259
  r.pop(), s.pop();
260
260
  return;
261
261
  }
262
- switch (ke(t)) {
262
+ switch (Ce(t)) {
263
263
  case 2:
264
264
  for (const [a, c] of t)
265
- Me(a, a, n, r, s), Me(c, a, n, r, s);
265
+ je(a, a, n, r, s), je(c, a, n, r, s);
266
266
  t.set = t.clear = t.delete = yr;
267
267
  break;
268
268
  case 3:
269
269
  for (const a of t)
270
- Me(a, a, n, r, s);
270
+ je(a, a, n, r, s);
271
271
  t.add = t.clear = t.delete = yr;
272
272
  break;
273
273
  case 1:
274
274
  Object.freeze(t);
275
275
  let o = 0;
276
276
  for (const a of t)
277
- Me(a, o, n, r, s), o += 1;
277
+ je(a, o, n, r, s), o += 1;
278
278
  break;
279
279
  default:
280
280
  Object.freeze(t), Object.keys(t).forEach((a) => {
281
281
  const c = t[a];
282
- Me(c, a, n, r, s);
282
+ je(c, a, n, r, s);
283
283
  });
284
284
  }
285
285
  r.pop(), s.pop();
286
286
  }
287
- function xn(t, e) {
288
- const n = ke(t);
287
+ function $n(t, e) {
288
+ const n = Ce(t);
289
289
  if (n === 0)
290
290
  Reflect.ownKeys(t).forEach((r) => {
291
291
  e(r, t[r], t);
@@ -298,12 +298,12 @@ function xn(t, e) {
298
298
  t.forEach((r, s) => e(s, r, t));
299
299
  }
300
300
  function os(t, e, n) {
301
- if (Ae(t) || !ce(t, n) || e.has(t) || Object.isFrozen(t))
301
+ if (ke(t) || !ce(t, n) || e.has(t) || Object.isFrozen(t))
302
302
  return;
303
303
  const r = t instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
304
- if (e.add(t), xn(t, (i, o) => {
304
+ if (e.add(t), $n(t, (i, o) => {
305
305
  var a;
306
- if (Ae(o)) {
306
+ if (ke(o)) {
307
307
  const c = P(o);
308
308
  Q(c);
309
309
  const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
@@ -321,12 +321,12 @@ function Oi(t, e) {
321
321
  const n = t.type === 3 ? t.setMap : t.copy;
322
322
  t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && os(ye(n, e), t.finalities.handledSet, t.options);
323
323
  }
324
- function sn(t) {
324
+ function on(t) {
325
325
  t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
326
- t.copy.add(Rn(e));
326
+ t.copy.add(xn(e));
327
327
  }));
328
328
  }
329
- function on(t, e, n, r) {
329
+ function an(t, e, n, r) {
330
330
  if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
331
331
  if (n && r) {
332
332
  const i = ss(t);
@@ -335,14 +335,14 @@ function on(t, e, n, r) {
335
335
  t.finalized = !0;
336
336
  }
337
337
  }
338
- function $n(t, e, n, r) {
338
+ function Dn(t, e, n, r) {
339
339
  const s = P(n);
340
340
  s && (s.callbacks || (s.callbacks = []), s.callbacks.push((i, o) => {
341
341
  var a;
342
342
  const c = t.type === 3 ? t.setMap : t.copy;
343
343
  if (pe(ye(c, e), n)) {
344
344
  let u = s.original;
345
- s.copy && (u = s.copy), sn(t), on(t, r, i, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(u, s.original)), at(c, e, u);
345
+ s.copy && (u = s.copy), on(t), an(t, r, i, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(u, s.original)), at(c, e, u);
346
346
  }
347
347
  }), t.options.enableAutoFreeze && s.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ce(n, t.options) && t.finalities.draft.push(() => {
348
348
  const i = t.type === 3 ? t.setMap : t.copy;
@@ -354,32 +354,32 @@ function Ai(t, e, n, r, s) {
354
354
  c.length < i.length && ([i, c] = [c, i], [n, r] = [r, n]);
355
355
  for (let u = 0; u < i.length; u += 1)
356
356
  if (o.get(u.toString()) && c[u] !== i[u]) {
357
- const l = e.concat([u]), f = ve(l, s);
357
+ const l = e.concat([u]), f = Ee(l, s);
358
358
  n.push({
359
359
  op: U.Replace,
360
360
  path: f,
361
361
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
362
- value: Tt(c[u])
362
+ value: mt(c[u])
363
363
  }), r.push({
364
364
  op: U.Replace,
365
365
  path: f,
366
366
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
367
- value: Tt(i[u])
367
+ value: mt(i[u])
368
368
  });
369
369
  }
370
370
  for (let u = i.length; u < c.length; u += 1) {
371
- const l = e.concat([u]), f = ve(l, s);
371
+ const l = e.concat([u]), f = Ee(l, s);
372
372
  n.push({
373
373
  op: U.Add,
374
374
  path: f,
375
375
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
376
- value: Tt(c[u])
376
+ value: mt(c[u])
377
377
  });
378
378
  }
379
379
  if (i.length < c.length) {
380
380
  const { arrayLengthAssignment: u = !0 } = a.enablePatches;
381
381
  if (u) {
382
- const l = e.concat(["length"]), f = ve(l, s);
382
+ const l = e.concat(["length"]), f = Ee(l, s);
383
383
  r.push({
384
384
  op: U.Replace,
385
385
  path: f,
@@ -387,7 +387,7 @@ function Ai(t, e, n, r, s) {
387
387
  });
388
388
  } else
389
389
  for (let l = c.length; i.length < l; l -= 1) {
390
- const f = e.concat([l - 1]), h = ve(f, s);
390
+ const f = e.concat([l - 1]), h = Ee(f, s);
391
391
  r.push({
392
392
  op: U.Remove,
393
393
  path: h
@@ -397,10 +397,10 @@ function Ai(t, e, n, r, s) {
397
397
  }
398
398
  function ki({ original: t, copy: e, assignedMap: n }, r, s, i, o) {
399
399
  n.forEach((a, c) => {
400
- const u = ye(t, c), l = Tt(ye(e, c)), f = a ? et(t, c) ? U.Replace : U.Add : U.Remove;
400
+ const u = ye(t, c), l = mt(ye(e, c)), f = a ? et(t, c) ? U.Replace : U.Add : U.Remove;
401
401
  if (pe(u, l) && f === U.Replace)
402
402
  return;
403
- const h = r.concat(c), y = ve(h, o);
403
+ const h = r.concat(c), y = Ee(h, o);
404
404
  s.push(f === U.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === U.Add ? { op: U.Remove, path: y } : f === U.Remove ? { op: U.Add, path: y, value: u } : { op: U.Replace, path: y, value: u });
405
405
  });
406
406
  }
@@ -408,7 +408,7 @@ function Ci({ original: t, copy: e }, n, r, s, i) {
408
408
  let o = 0;
409
409
  t.forEach((a) => {
410
410
  if (!e.has(a)) {
411
- const c = n.concat([o]), u = ve(c, i);
411
+ const c = n.concat([o]), u = Ee(c, i);
412
412
  r.push({
413
413
  op: U.Remove,
414
414
  path: u,
@@ -422,7 +422,7 @@ function Ci({ original: t, copy: e }, n, r, s, i) {
422
422
  o += 1;
423
423
  }), o = 0, e.forEach((a) => {
424
424
  if (!t.has(a)) {
425
- const c = n.concat([o]), u = ve(c, i);
425
+ const c = n.concat([o]), u = Ee(c, i);
426
426
  r.push({
427
427
  op: U.Add,
428
428
  path: u,
@@ -448,10 +448,10 @@ function ot(t, e, n, r) {
448
448
  return Ci(t, e, n, r, s);
449
449
  }
450
450
  }
451
- const At = (t, e, n = !1) => {
451
+ const kt = (t, e, n = !1) => {
452
452
  if (typeof t == "object" && t !== null && (!ce(t, e) || n))
453
453
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
454
- }, an = {
454
+ }, cn = {
455
455
  get size() {
456
456
  return te(P(this)).size;
457
457
  },
@@ -460,7 +460,7 @@ const At = (t, e, n = !1) => {
460
460
  },
461
461
  set(t, e) {
462
462
  const n = P(this), r = te(n);
463
- return (!r.has(t) || !pe(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), $n(n, t, e, ot)), this;
463
+ return (!r.has(t) || !pe(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), Dn(n, t, e, ot)), this;
464
464
  },
465
465
  delete(t) {
466
466
  if (!this.has(t))
@@ -486,9 +486,9 @@ const At = (t, e, n = !1) => {
486
486
  get(t) {
487
487
  var e, n;
488
488
  const r = P(this), s = te(r).get(t), i = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, s, ne)) === ne.mutable;
489
- if (r.options.strict && At(s, r.options, i), i || r.finalized || !ce(s, r.options) || s !== r.original.get(t))
489
+ if (r.options.strict && kt(s, r.options, i), i || r.finalized || !ce(s, r.options) || s !== r.original.get(t))
490
490
  return s;
491
- const o = In.createDraft({
491
+ const o = Mn.createDraft({
492
492
  original: s,
493
493
  parentDraft: r,
494
494
  key: t,
@@ -503,7 +503,7 @@ const At = (t, e, n = !1) => {
503
503
  values() {
504
504
  const t = this.keys();
505
505
  return {
506
- [wt]: () => this.values(),
506
+ [Tt]: () => this.values(),
507
507
  next: () => {
508
508
  const e = t.next();
509
509
  return e.done ? e : {
@@ -516,7 +516,7 @@ const At = (t, e, n = !1) => {
516
516
  entries() {
517
517
  const t = this.keys();
518
518
  return {
519
- [wt]: () => this.entries(),
519
+ [Tt]: () => this.entries(),
520
520
  next: () => {
521
521
  const e = t.next();
522
522
  if (e.done)
@@ -529,10 +529,10 @@ const At = (t, e, n = !1) => {
529
529
  }
530
530
  };
531
531
  },
532
- [wt]() {
532
+ [Tt]() {
533
533
  return this.entries();
534
534
  }
535
- }, Pi = Reflect.ownKeys(an), br = (t, e, { isValuesIterator: n }) => () => {
535
+ }, Pi = Reflect.ownKeys(cn), br = (t, e, { isValuesIterator: n }) => () => {
536
536
  var r, s;
537
537
  const i = e.next();
538
538
  if (i.done)
@@ -540,8 +540,8 @@ const At = (t, e, n = !1) => {
540
540
  const o = i.value;
541
541
  let a = t.setMap.get(o);
542
542
  const c = P(a), u = ((s = (r = t.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, ne)) === ne.mutable;
543
- if (t.options.strict && At(o, t.options, u), !u && !c && ce(o, t.options) && !t.finalized && t.original.has(o)) {
544
- const l = In.createDraft({
543
+ if (t.options.strict && kt(o, t.options, u), !u && !c && ce(o, t.options) && !t.finalized && t.original.has(o)) {
544
+ const l = Mn.createDraft({
545
545
  original: o,
546
546
  parentDraft: t,
547
547
  key: o,
@@ -554,7 +554,7 @@ const At = (t, e, n = !1) => {
554
554
  done: !1,
555
555
  value: n ? a : [a, a]
556
556
  };
557
- }, kt = {
557
+ }, Ct = {
558
558
  get size() {
559
559
  return P(this).setMap.size;
560
560
  },
@@ -568,7 +568,7 @@ const At = (t, e, n = !1) => {
568
568
  },
569
569
  add(t) {
570
570
  const e = P(this);
571
- return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), $n(e, t, t, ot)), this;
571
+ return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Dn(e, t, t, ot)), this;
572
572
  },
573
573
  delete(t) {
574
574
  if (!this.has(t))
@@ -610,7 +610,7 @@ const At = (t, e, n = !1) => {
610
610
  keys() {
611
611
  return this.values();
612
612
  },
613
- [wt]() {
613
+ [Tt]() {
614
614
  return this.values();
615
615
  },
616
616
  forEach(t, e) {
@@ -620,7 +620,7 @@ const At = (t, e, n = !1) => {
620
620
  t.call(e, r.value, r.value, this), r = n.next();
621
621
  }
622
622
  };
623
- Set.prototype.difference && Object.assign(kt, {
623
+ Set.prototype.difference && Object.assign(Ct, {
624
624
  intersection(t) {
625
625
  return Set.prototype.intersection.call(new Set(this.values()), t);
626
626
  },
@@ -643,7 +643,7 @@ Set.prototype.difference && Object.assign(kt, {
643
643
  return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
644
644
  }
645
645
  });
646
- const Ii = Reflect.ownKeys(kt), as = /* @__PURE__ */ new WeakSet(), cs = {
646
+ const Ii = Reflect.ownKeys(Ct), as = /* @__PURE__ */ new WeakSet(), cs = {
647
647
  get(t, e, n) {
648
648
  var r, s;
649
649
  const i = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
@@ -655,20 +655,20 @@ const Ii = Reflect.ownKeys(kt), as = /* @__PURE__ */ new WeakSet(), cs = {
655
655
  if (t.options.mark) {
656
656
  const u = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, n);
657
657
  if (o = t.options.mark(u, ne), o === ne.mutable)
658
- return t.options.strict && At(u, t.options, !0), u;
658
+ return t.options.strict && kt(u, t.options, !0), u;
659
659
  }
660
660
  const a = te(t);
661
661
  if (a instanceof Map && Pi.includes(e)) {
662
662
  if (e === "size")
663
- return Object.getOwnPropertyDescriptor(an, "size").get.call(t.proxy);
664
- const u = an[e];
663
+ return Object.getOwnPropertyDescriptor(cn, "size").get.call(t.proxy);
664
+ const u = cn[e];
665
665
  if (u)
666
666
  return u.bind(t.proxy);
667
667
  }
668
668
  if (a instanceof Set && Ii.includes(e)) {
669
669
  if (e === "size")
670
- return Object.getOwnPropertyDescriptor(kt, "size").get.call(t.proxy);
671
- const u = kt[e];
670
+ return Object.getOwnPropertyDescriptor(Ct, "size").get.call(t.proxy);
671
+ const u = Ct[e];
672
672
  if (u)
673
673
  return u.bind(t.proxy);
674
674
  }
@@ -680,10 +680,10 @@ const Ii = Reflect.ownKeys(kt), as = /* @__PURE__ */ new WeakSet(), cs = {
680
680
  ) : void 0;
681
681
  }
682
682
  const c = a[e];
683
- if (t.options.strict && At(c, t.options), t.finalized || !ce(c, t.options))
683
+ if (t.options.strict && kt(c, t.options), t.finalized || !ce(c, t.options))
684
684
  return c;
685
- if (c === Gt(t.original, e)) {
686
- if (Q(t), t.copy[e] = Dn({
685
+ if (c === Qt(t.original, e)) {
686
+ if (Q(t), t.copy[e] = Un({
687
687
  original: t.original[e],
688
688
  parentDraft: t,
689
689
  key: t.type === 1 ? Number(e) : e,
@@ -707,8 +707,8 @@ const Ii = Reflect.ownKeys(kt), as = /* @__PURE__ */ new WeakSet(), cs = {
707
707
  const i = pr(te(t), e);
708
708
  if (i != null && i.set)
709
709
  return i.set.call(t.proxy, n), !0;
710
- const o = Gt(te(t), e), a = P(o);
711
- return a && pe(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) : (pe(n, o) && (n !== void 0 || et(t.original, e)) || (Q(t), fe(t), et(t.original, e) && pe(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, $n(t, e, n, ot)), !0);
710
+ const o = Qt(te(t), e), a = P(o);
711
+ return a && pe(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) : (pe(n, o) && (n !== void 0 || et(t.original, e)) || (Q(t), fe(t), et(t.original, e) && pe(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, Dn(t, e, n, ot)), !0);
712
712
  },
713
713
  has(t, e) {
714
714
  return e in te(t);
@@ -736,11 +736,11 @@ const Ii = Reflect.ownKeys(kt), as = /* @__PURE__ */ new WeakSet(), cs = {
736
736
  },
737
737
  deleteProperty(t, e) {
738
738
  var n;
739
- return t.type === 1 ? cs.set.call(this, t, e, void 0, t.proxy) : (Gt(t.original, e) !== void 0 || e in t.original ? (Q(t), fe(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
739
+ return t.type === 1 ? cs.set.call(this, t, e, void 0, t.proxy) : (Qt(t.original, e) !== void 0 || e in t.original ? (Q(t), fe(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
740
740
  }
741
741
  };
742
- function Dn(t) {
743
- const { original: e, parentDraft: n, key: r, finalities: s, options: i } = t, o = ke(e), a = {
742
+ function Un(t) {
743
+ const { original: e, parentDraft: n, key: r, finalities: s, options: i } = t, o = Ce(e), a = {
744
744
  type: o,
745
745
  finalized: !1,
746
746
  parent: n,
@@ -760,24 +760,24 @@ function Dn(t) {
760
760
  var y, b;
761
761
  const g = P(c);
762
762
  let w = l.type === 3 ? l.setMap : l.copy;
763
- const m = ye(w, r), _ = P(m);
763
+ const S = ye(w, r), _ = P(S);
764
764
  if (_) {
765
- let S = _.original;
766
- _.operated && (S = Rn(m)), sn(_), on(_, ot, f, h), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(S, _.original)), at(w, r, S);
765
+ let m = _.original;
766
+ _.operated && (m = xn(S)), on(_), an(_, ot, f, h), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(m, _.original)), at(w, r, m);
767
767
  }
768
- (b = g.callbacks) === null || b === void 0 || b.forEach((S) => {
769
- S(f, h);
768
+ (b = g.callbacks) === null || b === void 0 || b.forEach((m) => {
769
+ m(f, h);
770
770
  });
771
771
  });
772
772
  } else {
773
773
  const l = P(c);
774
774
  l.finalities.draft.push((f, h) => {
775
- sn(l), on(l, ot, f, h);
775
+ on(l), an(l, ot, f, h);
776
776
  });
777
777
  }
778
778
  return c;
779
779
  }
780
- In.createDraft = Dn;
780
+ Mn.createDraft = Un;
781
781
  function Mi(t, e, n, r, s) {
782
782
  var i;
783
783
  const o = P(t), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : t, c = !!e.length;
@@ -785,7 +785,7 @@ function Mi(t, e, n, r, s) {
785
785
  for (; o.finalities.draft.length > 0; )
786
786
  o.finalities.draft.pop()(n, r);
787
787
  const u = c ? e[0] : o ? o.operated ? o.copy : o.original : t;
788
- return o && rn(o), s && Me(u, u, o == null ? void 0 : o.options.updatedValues), [
788
+ return o && sn(o), s && je(u, u, o == null ? void 0 : o.options.updatedValues), [
789
789
  u,
790
790
  n && c ? [{ op: U.Replace, path: [], value: e[0] }] : n,
791
791
  r && c ? [{ op: U.Replace, path: [], value: a }] : r
@@ -800,7 +800,7 @@ function ji(t, e) {
800
800
  };
801
801
  let s, i;
802
802
  e.enablePatches && (s = [], i = []);
803
- const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, ne)) === ne.mutable || !ce(t, e) ? t : Dn({
803
+ const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, ne)) === ne.mutable || !ce(t, e) ? t : Un({
804
804
  original: t,
805
805
  parentDraft: null,
806
806
  finalities: r,
@@ -814,9 +814,9 @@ function ji(t, e) {
814
814
  }
815
815
  ];
816
816
  }
817
- function cn(t) {
817
+ function un(t) {
818
818
  const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: s = !0 } = t;
819
- xn(n, (i, o, a) => {
819
+ $n(n, (i, o, a) => {
820
820
  const c = P(o);
821
821
  if (c && e && c.finalities === e.finalities) {
822
822
  t.isContainDraft = !0;
@@ -826,7 +826,7 @@ function cn(t) {
826
826
  a.clear(), l.forEach((f) => a.add(i === f ? u : f));
827
827
  } else
828
828
  at(a, i, u);
829
- } else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, cn(t));
829
+ } else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, un(t));
830
830
  }), s && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
831
831
  }
832
832
  function us(t) {
@@ -834,12 +834,12 @@ function us(t) {
834
834
  const n = P(t);
835
835
  if (!ce(t, n == null ? void 0 : n.options))
836
836
  return t;
837
- const r = ke(t);
837
+ const r = Ce(t);
838
838
  if (n && !n.operated)
839
839
  return n.original;
840
840
  let s;
841
841
  function i() {
842
- s = r === 2 ? jn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : is(t, n == null ? void 0 : n.options);
842
+ s = r === 2 ? Rn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : is(t, n == null ? void 0 : n.options);
843
843
  }
844
844
  if (n) {
845
845
  n.finalized = !0;
@@ -850,19 +850,19 @@ function us(t) {
850
850
  }
851
851
  } else
852
852
  s = t;
853
- if (xn(s, (o, a) => {
853
+ if ($n(s, (o, a) => {
854
854
  if (n && pe(ye(n.original, o), a))
855
855
  return;
856
856
  const c = us(a);
857
857
  c !== a && (s === t && i(), at(s, o, c));
858
858
  }), r === 3) {
859
859
  const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : s;
860
- return Mn(o) ? new Set(s) : new (Object.getPrototypeOf(o)).constructor(s);
860
+ return jn(o) ? new Set(s) : new (Object.getPrototypeOf(o)).constructor(s);
861
861
  }
862
862
  return s;
863
863
  }
864
864
  function gr(t) {
865
- if (!Ae(t))
865
+ if (!ke(t))
866
866
  throw new Error(`current() is only used for Draft, parameter: ${t}`);
867
867
  return us(t);
868
868
  }
@@ -870,18 +870,18 @@ const Ri = (t) => function e(n, r, s) {
870
870
  var i, o, a;
871
871
  if (typeof n == "function" && typeof r != "function")
872
872
  return function(E, ...j) {
873
- return e(E, (L) => n.call(this, L, ...j), r);
873
+ return e(E, (N) => n.call(this, N, ...j), r);
874
874
  };
875
875
  const c = n, u = r;
876
876
  let l = s;
877
877
  if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
878
878
  throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
879
879
  l = Object.assign(Object.assign({}, t), l);
880
- const f = Ae(c) ? gr(c) : c, h = Array.isArray(l.mark) ? (E, j) => {
881
- for (const L of l.mark) {
882
- if (typeof L != "function")
883
- throw new Error(`Invalid mark: ${L}, 'mark' should be a function.`);
884
- const B = L(E, j);
880
+ const f = ke(c) ? gr(c) : c, h = Array.isArray(l.mark) ? (E, j) => {
881
+ for (const N of l.mark) {
882
+ if (typeof N != "function")
883
+ throw new Error(`Invalid mark: ${N}, 'mark' should be a function.`);
884
+ const B = N(E, j);
885
885
  if (B)
886
886
  return B;
887
887
  }
@@ -893,49 +893,49 @@ const Ri = (t) => function e(n, r, s) {
893
893
  };
894
894
  if (!ce(f, w) && typeof f == "object" && f !== null)
895
895
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
896
- const [m, _] = ji(f, w);
896
+ const [S, _] = ji(f, w);
897
897
  if (typeof r != "function") {
898
898
  if (!ce(f, w))
899
899
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
900
- return [m, _];
900
+ return [S, _];
901
901
  }
902
- let S;
902
+ let m;
903
903
  try {
904
- S = u(m);
904
+ m = u(S);
905
905
  } catch (E) {
906
- throw rn(P(m)), E;
906
+ throw sn(P(S)), E;
907
907
  }
908
- const O = (E) => {
909
- const j = P(m);
910
- if (!Ae(E)) {
911
- if (E !== void 0 && !pe(E, m) && (j != null && j.operated))
908
+ const A = (E) => {
909
+ const j = P(S);
910
+ if (!ke(E)) {
911
+ if (E !== void 0 && !pe(E, S) && (j != null && j.operated))
912
912
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
913
913
  const B = E == null ? void 0 : E[mi];
914
914
  if (B) {
915
- const qe = B[0];
916
- return w.strict && typeof E == "object" && E !== null && cn({
915
+ const be = B[0];
916
+ return w.strict && typeof E == "object" && E !== null && un({
917
917
  rootDraft: j,
918
918
  value: E,
919
919
  useRawReturn: !0
920
- }), _([qe]);
920
+ }), _([be]);
921
921
  }
922
922
  if (E !== void 0)
923
- return typeof E == "object" && E !== null && cn({ rootDraft: j, value: E }), _([E]);
923
+ return typeof E == "object" && E !== null && un({ rootDraft: j, value: E }), _([E]);
924
924
  }
925
- if (E === m || E === void 0)
925
+ if (E === S || E === void 0)
926
926
  return _([]);
927
- const L = P(E);
928
- if (w === L.options) {
929
- if (L.operated)
927
+ const N = P(E);
928
+ if (w === N.options) {
929
+ if (N.operated)
930
930
  throw new Error("Cannot return a modified child draft.");
931
931
  return _([gr(E)]);
932
932
  }
933
933
  return _([E]);
934
934
  };
935
- return S instanceof Promise ? S.then(O, (E) => {
936
- throw rn(P(m)), E;
937
- }) : O(S);
938
- }, Ct = Ri();
935
+ return m instanceof Promise ? m.then(A, (E) => {
936
+ throw sn(P(S)), E;
937
+ }) : A(m);
938
+ }, Pt = Ri();
939
939
  Object.prototype.constructor.toString();
940
940
  function ls(t, e) {
941
941
  const n = Object.keys(t), r = Object.keys(e);
@@ -944,10 +944,10 @@ function ls(t, e) {
944
944
  function _r(t, e) {
945
945
  return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((n) => e.hasOwnProperty(n) && t[n] === e[n]);
946
946
  }
947
- function mt(t, e) {
948
- return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : ls(t, e) ? Object.keys(t).every((n) => mt(t[n], e[n])) : !1;
947
+ function St(t, e) {
948
+ return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : ls(t, e) ? Object.keys(t).every((n) => St(t[n], e[n])) : !1;
949
949
  }
950
- function Un(t) {
950
+ function Ln(t) {
951
951
  if (!He(t))
952
952
  return t;
953
953
  const e = {};
@@ -1302,7 +1302,7 @@ function Yi(t, e) {
1302
1302
  return null;
1303
1303
  }
1304
1304
  }
1305
- function un(t) {
1305
+ function ln(t) {
1306
1306
  for (const e of Ji) {
1307
1307
  const n = Yi(e, t);
1308
1308
  if (n)
@@ -1313,19 +1313,19 @@ function un(t) {
1313
1313
  function Zi(t) {
1314
1314
  try {
1315
1315
  const e = JSON.parse(t);
1316
- return typeof e == "string" ? un(e) : null;
1316
+ return typeof e == "string" ? ln(e) : null;
1317
1317
  } catch {
1318
1318
  return null;
1319
1319
  }
1320
1320
  }
1321
- function jt(t) {
1321
+ function Rt(t) {
1322
1322
  if (t !== void 0) {
1323
1323
  if (t === null)
1324
1324
  return null;
1325
1325
  if (t instanceof Date)
1326
1326
  return t;
1327
1327
  if (typeof t == "string") {
1328
- const e = un(t) || Zi(t) || un(t.trim());
1328
+ const e = ln(t) || Zi(t) || ln(t.trim());
1329
1329
  if (!e)
1330
1330
  throw new Error(`Unable to parse \`${t}\` as a date.`);
1331
1331
  return e;
@@ -1334,7 +1334,7 @@ function jt(t) {
1334
1334
  throw new Error(`Invalid date value \`${t}\`. Expected a date, number, or string, got type ${typeof t}.`);
1335
1335
  }
1336
1336
  }
1337
- class Ee {
1337
+ class Oe {
1338
1338
  constructor(e, n) {
1339
1339
  p(this, "attrs");
1340
1340
  p(this, "linkIndex");
@@ -1365,7 +1365,7 @@ class Ee {
1365
1365
  return this._blobAttrs;
1366
1366
  this._blobAttrs = /* @__PURE__ */ new Map();
1367
1367
  for (const e of Object.values(this.attrs))
1368
- if (Fn(e)) {
1368
+ if (Nn(e)) {
1369
1369
  const [n, r, s] = e["forward-identity"];
1370
1370
  Z(this.blobAttrs, [r, s], e);
1371
1371
  }
@@ -1412,13 +1412,13 @@ class Ee {
1412
1412
  function Xi(t) {
1413
1413
  return t.cardinality === "one";
1414
1414
  }
1415
- function Ln(t) {
1415
+ function Fn(t) {
1416
1416
  return t["value-type"] === "ref";
1417
1417
  }
1418
- function Fn(t) {
1418
+ function Nn(t) {
1419
1419
  return t["value-type"] === "blob";
1420
1420
  }
1421
- function Ke(t, e) {
1421
+ function qe(t, e) {
1422
1422
  return e.reduce((n, r) => n && n.get(r), t);
1423
1423
  }
1424
1424
  function ae(t, e) {
@@ -1450,7 +1450,7 @@ function hs(t, e, n) {
1450
1450
  console.warn("no such attr", c, a);
1451
1451
  continue;
1452
1452
  }
1453
- l["checked-data-type"] === "date" && n && (u = jt(u), o[2] = u), Ln(l) && Z(i, [u, c, a], o), Z(r, [a, c, u], o), Z(s, [c, a, u], o);
1453
+ l["checked-data-type"] === "date" && n && (u = Rt(u), o[2] = u), Fn(l) && Z(i, [u, c, a], o), Z(r, [a, c, u], o), Z(s, [c, a, u], o);
1454
1454
  }
1455
1455
  return { eav: r, aev: s, vae: i };
1456
1456
  }
@@ -1467,12 +1467,12 @@ function ys(t, e) {
1467
1467
  }
1468
1468
  function bs(t, e) {
1469
1469
  if (t)
1470
- return new Ee(t.attrs, t.linkIndex);
1470
+ return new Oe(t.attrs, t.linkIndex);
1471
1471
  if (e && "__type" in e)
1472
- return new Ee(e.attrs, e.linkIndex);
1472
+ return new Oe(e.attrs, e.linkIndex);
1473
1473
  }
1474
1474
  function eo(t, e) {
1475
- return Ke(t.eav, [e]) !== void 0;
1475
+ return qe(t.eav, [e]) !== void 0;
1476
1476
  }
1477
1477
  function Je(t, e, n, r) {
1478
1478
  const s = hs(t, e, r);
@@ -1510,13 +1510,13 @@ function gs(t, e, n) {
1510
1510
  if (!r)
1511
1511
  return;
1512
1512
  const [s, i, o] = r, a = e.getAttr(i);
1513
- a && (ae(t.eav, [s, i, o]), ae(t.aev, [i, s, o]), Ln(a) && ae(t.vae, [o, i, s]));
1513
+ a && (ae(t.eav, [s, i, o]), ae(t.aev, [i, s, o]), Fn(a) && ae(t.vae, [o, i, s]));
1514
1514
  }
1515
1515
  let to = 0;
1516
1516
  function _s(t, e, n) {
1517
1517
  const [r, s, i] = n;
1518
1518
  let o;
1519
- const a = Ke(t.eav, [r, s, i]);
1519
+ const a = qe(t.eav, [r, s, i]);
1520
1520
  return a && (o = a[3]), o || Date.now() * 10 + to++;
1521
1521
  }
1522
1522
  function ws(t, e, n) {
@@ -1527,9 +1527,9 @@ function ws(t, e, n) {
1527
1527
  const a = e.getAttr(i);
1528
1528
  if (!a)
1529
1529
  return;
1530
- a["checked-data-type"] === "date" && t.useDateObjects && (o = jt(o));
1531
- const c = Ke(t.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? _s(t, a, r), l = [s, i, o, u];
1532
- Xi(a) ? (Z(t.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), Z(t.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (Z(t.eav, [s, i, o], l), Z(t.aev, [i, s, o], l)), Ln(a) && Z(t.vae, [o, i, s], l);
1530
+ a["checked-data-type"] === "date" && t.useDateObjects && (o = Rt(o));
1531
+ const c = qe(t.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? _s(t, a, r), l = [s, i, o, u];
1532
+ Xi(a) ? (Z(t.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), Z(t.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (Z(t.eav, [s, i, o], l), Z(t.aev, [i, s, o], l)), Fn(a) && Z(t.vae, [o, i, s], l);
1533
1533
  }
1534
1534
  function no(t, e, n) {
1535
1535
  var y;
@@ -1539,9 +1539,9 @@ function no(t, e, n) {
1539
1539
  const [s, i, o] = r, a = e.getAttr(i);
1540
1540
  if (!a)
1541
1541
  return;
1542
- if (!Fn(a))
1542
+ if (!Nn(a))
1543
1543
  throw new Error("merge operation is not supported for links");
1544
- const c = Ke(t.eav, [s, i]);
1544
+ const c = qe(t.eav, [s, i]);
1545
1545
  if (!c)
1546
1546
  return;
1547
1547
  const u = (y = c.values().next()) == null ? void 0 : y.value;
@@ -1555,7 +1555,7 @@ function no(t, e, n) {
1555
1555
  ];
1556
1556
  Z(t.eav, [s, i], /* @__PURE__ */ new Map([[f, h]])), Z(t.aev, [i, s], /* @__PURE__ */ new Map([[f, h]]));
1557
1557
  }
1558
- function ln(t, e, n) {
1558
+ function fn(t, e, n) {
1559
1559
  var u, l;
1560
1560
  const [r, s] = n, i = ct(t, [r]);
1561
1561
  if (!i)
@@ -1566,7 +1566,7 @@ function ln(t, e, n) {
1566
1566
  const h = e.getAttr(f);
1567
1567
  h && h["on-delete-reverse"] === "cascade" && X(a.get(f), 1).forEach(([y, b, g]) => {
1568
1568
  var w;
1569
- return ln(t, e, [g, (w = h["reverse-identity"]) == null ? void 0 : w[1]]);
1569
+ return fn(t, e, [g, (w = h["reverse-identity"]) == null ? void 0 : w[1]]);
1570
1570
  }), // Fall back to deleting everything if we've rehydrated tx-steps from
1571
1571
  // the store that didn't set `etype` in deleteEntity
1572
1572
  (!s || // If we don't know about the attr, let's just get rid of it
@@ -1577,9 +1577,9 @@ function ln(t, e, n) {
1577
1577
  }
1578
1578
  const c = t.vae.get(o) && X(t.vae.get(o), 2);
1579
1579
  c && c.forEach((f) => {
1580
- var w, m, _;
1580
+ var w, S, _;
1581
1581
  const [h, y, b] = f, g = e.getAttr(y);
1582
- (!s || !g || ((w = g["reverse-identity"]) == null ? void 0 : w[1]) === s) && (ae(t.eav, [h, y, b]), ae(t.aev, [y, h, b]), ae(t.vae, [b, y, h])), g && g["on-delete"] === "cascade" && ((m = g["reverse-identity"]) == null ? void 0 : m[1]) === s && ln(t, e, [h, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
1582
+ (!s || !g || ((w = g["reverse-identity"]) == null ? void 0 : w[1]) === s) && (ae(t.eav, [h, y, b]), ae(t.aev, [y, h, b]), ae(t.vae, [b, y, h])), g && g["on-delete"] === "cascade" && ((S = g["reverse-identity"]) == null ? void 0 : S[1]) === s && fn(t, e, [h, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
1583
1583
  }), ((l = t.vae.get(o)) == null ? void 0 : l.size) === 0 && ae(t.vae, [o]);
1584
1584
  }
1585
1585
  function Ts(t, e, n) {
@@ -1616,7 +1616,7 @@ function oo(t, e, n) {
1616
1616
  gs(t, e, s);
1617
1617
  break;
1618
1618
  case "delete-entity":
1619
- ln(t, e, s);
1619
+ fn(t, e, s);
1620
1620
  break;
1621
1621
  case "add-attr":
1622
1622
  ro(e, s);
@@ -1647,7 +1647,7 @@ function X(t, e, n = []) {
1647
1647
  X(r, e - 1, n);
1648
1648
  return n;
1649
1649
  }
1650
- function pt(t, e, n) {
1650
+ function yt(t, e, n) {
1651
1651
  var i;
1652
1652
  const r = [];
1653
1653
  if (n != null && n.hasOwnProperty("$not")) {
@@ -1697,7 +1697,7 @@ function co(t, [e, n, r]) {
1697
1697
  }
1698
1698
  case "eav": {
1699
1699
  const a = (o = t.eav.get(e)) == null ? void 0 : o.get(n);
1700
- return a ? pt(t, a, r) : [];
1700
+ return a ? yt(t, a, r) : [];
1701
1701
  }
1702
1702
  case "ev": {
1703
1703
  const a = t.eav.get(e);
@@ -1705,7 +1705,7 @@ function co(t, [e, n, r]) {
1705
1705
  return [];
1706
1706
  const c = [];
1707
1707
  for (const u of a.values())
1708
- c.push(...pt(t, u, r));
1708
+ c.push(...yt(t, u, r));
1709
1709
  return c;
1710
1710
  }
1711
1711
  case "a": {
@@ -1718,14 +1718,14 @@ function co(t, [e, n, r]) {
1718
1718
  return [];
1719
1719
  const c = [];
1720
1720
  for (const u of a.values())
1721
- c.push(...pt(t, u, r));
1721
+ c.push(...yt(t, u, r));
1722
1722
  return c;
1723
1723
  }
1724
1724
  case "v": {
1725
1725
  const a = [];
1726
1726
  for (const c of t.eav.values())
1727
1727
  for (const u of c.values())
1728
- a.push(...pt(t, u, r));
1728
+ a.push(...yt(t, u, r));
1729
1729
  return a;
1730
1730
  }
1731
1731
  default:
@@ -1744,11 +1744,11 @@ function uo(t, e, n) {
1744
1744
  }
1745
1745
  return r;
1746
1746
  }
1747
- function N(t, e, n) {
1747
+ function F(t, e, n) {
1748
1748
  var r;
1749
1749
  return (r = t.forwardIdents.get(e)) == null ? void 0 : r.get(n);
1750
1750
  }
1751
- function Ce(t, e, n) {
1751
+ function Pe(t, e, n) {
1752
1752
  var r;
1753
1753
  return (r = t.revIdents.get(e)) == null ? void 0 : r.get(n);
1754
1754
  }
@@ -1766,7 +1766,7 @@ function fo(t, e, n) {
1766
1766
  return;
1767
1767
  const [s, i, o] = r;
1768
1768
  if (e.getAttr(i))
1769
- return Ke(t.eav, [s, i]);
1769
+ return qe(t.eav, [s, i]);
1770
1770
  }
1771
1771
  function ho(t, e, n) {
1772
1772
  const r = n.filter(([s, i, o, a, c]) => {
@@ -1787,13 +1787,13 @@ function ho(t, e, n) {
1787
1787
  }
1788
1788
  return !(u === "create" && l || u === "update" && !l);
1789
1789
  });
1790
- return Ct({ store: t, attrsStore: e }, (s) => {
1790
+ return Pt({ store: t, attrsStore: e }, (s) => {
1791
1791
  r.forEach((i) => {
1792
1792
  oo(s.store, s.attrsStore, i);
1793
1793
  });
1794
1794
  }, {
1795
1795
  mark: (s) => {
1796
- if (s instanceof Ee)
1796
+ if (s instanceof Oe)
1797
1797
  return "immutable";
1798
1798
  }
1799
1799
  });
@@ -1846,22 +1846,22 @@ function To(t, e, n) {
1846
1846
  return vo(t, e, n).map((r) => wo(e, r, n)).filter((r) => r);
1847
1847
  }
1848
1848
  function mo(t, e, n) {
1849
- return e.or ? e.or.patterns.flatMap((r) => fn(t, r, n)) : e.and ? e.and.patterns.reduce((r, s) => fn(t, s, r), n) : n.flatMap((r) => To(t, e, r));
1849
+ return e.or ? e.or.patterns.flatMap((r) => dn(t, r, n)) : e.and ? e.and.patterns.reduce((r, s) => dn(t, s, r), n) : n.flatMap((r) => To(t, e, r));
1850
1850
  }
1851
- function fn(t, e, n = [{}]) {
1851
+ function dn(t, e, n = [{}]) {
1852
1852
  return e.reduce((r, s) => mo(t, s, r), n);
1853
1853
  }
1854
- function Nn(t, e) {
1855
- return Array.isArray(e) ? e.map((n) => Nn(t, n)) : po(e) ? t[e] : e;
1854
+ function Kn(t, e) {
1855
+ return Array.isArray(e) ? e.map((n) => Kn(t, n)) : po(e) ? t[e] : e;
1856
1856
  }
1857
1857
  function So(t, { find: e, where: n }) {
1858
- return fn(t, n).map((s) => Nn(s, e));
1858
+ return dn(t, n).map((s) => Kn(s, e));
1859
1859
  }
1860
1860
  function vo(t, e, n) {
1861
- return co(t, Nn(n, e));
1861
+ return co(t, Kn(n, e));
1862
1862
  }
1863
1863
  const Eo = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
1864
- function Le(t) {
1864
+ function Fe(t) {
1865
1865
  return typeof t == "string" && Eo.test(t);
1866
1866
  }
1867
1867
  const z = [];
@@ -1870,15 +1870,15 @@ for (let t = 0; t < 256; ++t)
1870
1870
  function Oo(t, e = 0) {
1871
1871
  return (z[t[e + 0]] + z[t[e + 1]] + z[t[e + 2]] + z[t[e + 3]] + "-" + z[t[e + 4]] + z[t[e + 5]] + "-" + z[t[e + 6]] + z[t[e + 7]] + "-" + z[t[e + 8]] + z[t[e + 9]] + "-" + z[t[e + 10]] + z[t[e + 11]] + z[t[e + 12]] + z[t[e + 13]] + z[t[e + 14]] + z[t[e + 15]]).toLowerCase();
1872
1872
  }
1873
- let Qt;
1873
+ let Ht;
1874
1874
  const Ao = new Uint8Array(16);
1875
1875
  function ko() {
1876
- if (!Qt) {
1876
+ if (!Ht) {
1877
1877
  if (typeof crypto > "u" || !crypto.getRandomValues)
1878
1878
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1879
- Qt = crypto.getRandomValues.bind(crypto);
1879
+ Ht = crypto.getRandomValues.bind(crypto);
1880
1880
  }
1881
- return Qt(Ao);
1881
+ return Ht(Ao);
1882
1882
  }
1883
1883
  const Co = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Sr = { randomUUID: Co };
1884
1884
  function Po(t, e, n) {
@@ -1927,12 +1927,12 @@ function Ro() {
1927
1927
  const xo = Ro();
1928
1928
  let $o = 0;
1929
1929
  function tt(t) {
1930
- return Rt(`_${t}`, $o++);
1930
+ return xt(`_${t}`, $o++);
1931
1931
  }
1932
- function Rt(t, e) {
1932
+ function xt(t, e) {
1933
1933
  return `?${t}-${e}`;
1934
1934
  }
1935
- class Fe extends Error {
1935
+ class Ne extends Error {
1936
1936
  constructor(e) {
1937
1937
  super(e), this.name = "AttrNotFoundError";
1938
1938
  }
@@ -1940,7 +1940,7 @@ class Fe extends Error {
1940
1940
  function Do(t, e) {
1941
1941
  const n = Ss(t, e);
1942
1942
  if (!n)
1943
- throw new Fe(`Could not find id attr for ${e}`);
1943
+ throw new Ne(`Could not find id attr for ${e}`);
1944
1944
  return n;
1945
1945
  }
1946
1946
  function Er(t, e, n, r) {
@@ -1958,9 +1958,9 @@ function Lo(t, e, n) {
1958
1958
  return t.map((r) => r === e ? n : r);
1959
1959
  }
1960
1960
  function Es(t, e, n, r, s) {
1961
- const i = N(e, n, s), o = Ce(e, n, s), a = i || o;
1961
+ const i = F(e, n, s), o = Pe(e, n, s), a = i || o;
1962
1962
  if (!a)
1963
- throw new Fe(`Could not find attr for ${[n, s]}`);
1963
+ throw new Ne(`Could not find attr for ${[n, s]}`);
1964
1964
  if (a["value-type"] !== "ref")
1965
1965
  throw new Error(`Attr ${a.id} is not a ref`);
1966
1966
  const [c, u] = a["forward-identity"], [l, f] = a["reverse-identity"], h = r + 1, y = i ? [
@@ -2047,13 +2047,13 @@ function Fo(t, e) {
2047
2047
  return e;
2048
2048
  }
2049
2049
  function No(t, e, n, r, s, i) {
2050
- const o = N(e, n, s), a = Ce(e, n, s), c = o || a;
2050
+ const o = F(e, n, s), a = Pe(e, n, s), c = o || a;
2051
2051
  if (!c)
2052
- throw new Fe(`No attr for etype = ${n} label = ${s}`);
2052
+ throw new Ne(`No attr for etype = ${n} label = ${s}`);
2053
2053
  if (i != null && i.hasOwnProperty("$isNull")) {
2054
- const u = N(e, n, "id");
2054
+ const u = F(e, n, "id");
2055
2055
  if (!u)
2056
- throw new Fe(`No attr for etype = ${n} label = id`);
2056
+ throw new Ne(`No attr for etype = ${n} label = id`);
2057
2057
  return [
2058
2058
  t(n, r),
2059
2059
  u.id,
@@ -2075,7 +2075,7 @@ function Ko(t, e, n, r, s) {
2075
2075
  }, [n, r, []]);
2076
2076
  return [i, o, a];
2077
2077
  }
2078
- function dn(t, e, n, r, s, i) {
2078
+ function hn(t, e, n, r, s, i) {
2079
2079
  const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = Ko(t, e, n, r, o), f = No(t, e, c, u, a, i);
2080
2080
  return l.concat([f]);
2081
2081
  }
@@ -2108,7 +2108,7 @@ function Bo(t) {
2108
2108
  return e;
2109
2109
  }
2110
2110
  function kr(t, e, n, r, s) {
2111
- return Bo(s).map((i) => dn(t, e, n, r, i, {
2111
+ return Bo(s).map((i) => hn(t, e, n, r, i, {
2112
2112
  $isNull: !0
2113
2113
  }));
2114
2114
  }
@@ -2122,7 +2122,7 @@ function Os(t, e, n, r, s) {
2122
2122
  return [];
2123
2123
  const a = i.split(".");
2124
2124
  if (o != null && o.hasOwnProperty("$ne") && (o = { ...o, $not: o.$ne }, delete o.$ne), o != null && o.hasOwnProperty("$not")) {
2125
- const c = dn(t, e, n, r, a, o), u = kr(t, e, n, r, a);
2125
+ const c = hn(t, e, n, r, a, o), u = kr(t, e, n, r, a);
2126
2126
  return [
2127
2127
  {
2128
2128
  or: {
@@ -2139,11 +2139,11 @@ function Os(t, e, n, r, s) {
2139
2139
  joinSym: t(n, r)
2140
2140
  }
2141
2141
  }
2142
- ] : dn(t, e, n, r, a, o);
2142
+ ] : hn(t, e, n, r, a, o);
2143
2143
  });
2144
2144
  }
2145
2145
  function Go(t, e, n, r) {
2146
- const s = Rt;
2146
+ const s = xt;
2147
2147
  return r ? Os(s, t, e, n, r).concat(Er(s, t, e, n)) : Er(s, t, e, n);
2148
2148
  }
2149
2149
  function Qo(t, e, n) {
@@ -2157,18 +2157,18 @@ function Jo(t, e, n, { etype: r, level: s, form: i }, o) {
2157
2157
  const a = Object.keys(i).filter((c) => c !== "$");
2158
2158
  return a.length ? Object.entries(o).map(function([u, l]) {
2159
2159
  return a.map(function(y) {
2160
- var g, w, m;
2161
- const b = !!(e.cardinalityInference && ((m = (w = (g = n.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : w[y]) != null && m.isSingular));
2160
+ var g, w, S;
2161
+ const b = !!(e.cardinalityInference && ((S = (w = (g = n.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : w[y]) != null && S.isSingular));
2162
2162
  try {
2163
- const [_, S, O] = Ho(t, n, r, s, y, u), E = ks(e, n, {
2163
+ const [_, m, A] = Ho(t, n, r, s, y, u), E = ks(e, n, {
2164
2164
  etype: _,
2165
- level: S,
2165
+ level: m,
2166
2166
  form: i[y],
2167
- join: O
2167
+ join: A
2168
2168
  }), j = b ? E[0] : E;
2169
2169
  return { [y]: j };
2170
2170
  } catch (_) {
2171
- if (_ instanceof Fe)
2171
+ if (_ instanceof Ne)
2172
2172
  return { [y]: b ? void 0 : [] };
2173
2173
  throw _;
2174
2174
  }
@@ -2183,19 +2183,19 @@ function Yo(t, e, n) {
2183
2183
  function Ye(t, e, n, r, s) {
2184
2184
  return e === r || e == null && r == null ? Mo(t, n) : r == null ? 1 : e == null ? -1 : Yo(e, r, s);
2185
2185
  }
2186
- function Pt([t, e], [n, r], s) {
2186
+ function It([t, e], [n, r], s) {
2187
2187
  return Ye(t, e, n, r, s);
2188
2188
  }
2189
- function hn(t) {
2189
+ function pn(t) {
2190
2190
  return t == null ? t : new Date(t).getTime();
2191
2191
  }
2192
2192
  function Zo(t, e, n, r) {
2193
2193
  var b;
2194
2194
  const [s, i, o, a] = t, c = n === "desc" ? 1 : -1;
2195
2195
  if (((b = e["forward-identity"]) == null ? void 0 : b[2]) === "id")
2196
- return Pt(r, [s, a], null) === c;
2197
- const [u, l] = r, f = e["checked-data-type"], h = f === "date" ? hn(l) : l, y = f === "date" ? hn(o) : o;
2198
- return Pt([u, h], [s, y], f) === c;
2196
+ return It(r, [s, a], null) === c;
2197
+ const [u, l] = r, f = e["checked-data-type"], h = f === "date" ? pn(l) : l, y = f === "date" ? pn(o) : o;
2198
+ return It([u, h], [s, y], f) === c;
2199
2199
  }
2200
2200
  function Xo(t, e) {
2201
2201
  const n = e[1];
@@ -2203,7 +2203,7 @@ function Xo(t, e) {
2203
2203
  }
2204
2204
  function ea(t, e, n) {
2205
2205
  const r = Object.keys(n)[0];
2206
- return N(t, e, r);
2206
+ return F(t, e, r);
2207
2207
  }
2208
2208
  function ta(t, e, n, r) {
2209
2209
  if (n)
@@ -2217,11 +2217,11 @@ function na(t, e, n) {
2217
2217
  return lo(t, e);
2218
2218
  const r = /* @__PURE__ */ new Map();
2219
2219
  for (const o of n.fields) {
2220
- const a = N(t, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
2221
- c && Fn(a) && r.set(c, a);
2220
+ const a = F(t, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
2221
+ c && Nn(a) && r.set(c, a);
2222
2222
  }
2223
2223
  if (!r.has("id")) {
2224
- const o = N(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
2224
+ const o = F(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
2225
2225
  a && r.set(a, o);
2226
2226
  }
2227
2227
  return r;
@@ -2232,26 +2232,26 @@ function ra(t, e, { etype: n, pageInfo: r, dq: s, form: i }) {
2232
2232
  let u = So(t, s);
2233
2233
  const l = r == null ? void 0 : r["start-cursor"], f = ta(e, n, l, o);
2234
2234
  if (f && ((g = f == null ? void 0 : f["forward-identity"]) == null ? void 0 : g[2]) !== "id") {
2235
- const w = f["checked-data-type"] === "date", m = f.id;
2235
+ const w = f["checked-data-type"] === "date", S = f.id;
2236
2236
  u = u.map(([_]) => {
2237
- var O, E, j, L, B;
2238
- let S = (B = (L = (j = (E = (O = t.eav.get(_)) == null ? void 0 : O.get(m)) == null ? void 0 : E.values()) == null ? void 0 : j.next()) == null ? void 0 : L.value) == null ? void 0 : B[2];
2239
- return w && (S = hn(S)), [_, S];
2237
+ var A, E, j, N, B;
2238
+ let m = (B = (N = (j = (E = (A = t.eav.get(_)) == null ? void 0 : A.get(S)) == null ? void 0 : E.values()) == null ? void 0 : j.next()) == null ? void 0 : N.value) == null ? void 0 : B[2];
2239
+ return w && (m = pn(m)), [_, m];
2240
2240
  });
2241
2241
  }
2242
- u.sort(c === "asc" ? function(m, _) {
2243
- return Pt(m, _, f == null ? void 0 : f["checked-data-type"]);
2244
- } : function(m, _) {
2245
- return Pt(_, m, f == null ? void 0 : f["checked-data-type"]);
2242
+ u.sort(c === "asc" ? function(S, _) {
2243
+ return It(S, _, f == null ? void 0 : f["checked-data-type"]);
2244
+ } : function(S, _) {
2245
+ return It(_, S, f == null ? void 0 : f["checked-data-type"]);
2246
2246
  });
2247
2247
  let h = {};
2248
2248
  const y = na(e, n, s);
2249
2249
  for (const w of u) {
2250
- const [m] = w;
2251
- if (h[m] || !a && l && f && Zo(l, f, c, w))
2250
+ const [S] = w;
2251
+ if (h[S] || !a && l && f && Zo(l, f, c, w))
2252
2252
  continue;
2253
- const _ = uo(t, y, m);
2254
- _ && (h[m] = _);
2253
+ const _ = uo(t, y, S);
2254
+ _ && (h[S] = _);
2255
2255
  }
2256
2256
  return h;
2257
2257
  }
@@ -2269,7 +2269,7 @@ function ia(t, e, { etype: n, level: r, form: s, join: i, pageInfo: o }) {
2269
2269
  var h, y, b, g, w;
2270
2270
  if (!As(s) && (!o || !o["start-cursor"]))
2271
2271
  return [];
2272
- const a = qo(Go(e, n, r, (h = s.$) == null ? void 0 : h.where), i), c = Qo(Rt, n, r), u = (y = s.$) == null ? void 0 : y.fields, l = ra(t, e, {
2272
+ const a = qo(Go(e, n, r, (h = s.$) == null ? void 0 : h.where), i), c = Qo(xt, n, r), u = (y = s.$) == null ? void 0 : y.fields, l = ra(t, e, {
2273
2273
  etype: n,
2274
2274
  pageInfo: o,
2275
2275
  form: s,
@@ -2277,8 +2277,8 @@ function ia(t, e, { etype: n, level: r, form: s, join: i, pageInfo: o }) {
2277
2277
  }), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((w = s.$) == null ? void 0 : w.last);
2278
2278
  if (f != null) {
2279
2279
  r > 0 && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
2280
- const m = Object.entries(l);
2281
- return m.length <= f ? l : Object.fromEntries(m.slice(0, f));
2280
+ const S = Object.entries(l);
2281
+ return S.length <= f ? l : Object.fromEntries(S.slice(0, f));
2282
2282
  }
2283
2283
  return l;
2284
2284
  }
@@ -2286,14 +2286,14 @@ function oa(t, e, n) {
2286
2286
  try {
2287
2287
  return ia(t, e, n);
2288
2288
  } catch (r) {
2289
- if (r instanceof Fe)
2289
+ if (r instanceof Ne)
2290
2290
  return {};
2291
2291
  throw r;
2292
2292
  }
2293
2293
  }
2294
2294
  function ks(t, e, n) {
2295
2295
  const r = oa(t, e, n);
2296
- return Jo(Rt, t, e, n, r);
2296
+ return Jo(xt, t, e, n, r);
2297
2297
  }
2298
2298
  function aa(t) {
2299
2299
  const e = {};
@@ -2332,7 +2332,7 @@ function ca() {
2332
2332
  return new Set(Object.keys(e));
2333
2333
  }
2334
2334
  const ua = ca();
2335
- function St(t, e, n) {
2335
+ function vt(t, e, n) {
2336
2336
  const r = {
2337
2337
  __etype: t,
2338
2338
  __ops: n
@@ -2344,7 +2344,7 @@ function St(t, e, n) {
2344
2344
  if (i === "__etype")
2345
2345
  return t;
2346
2346
  if (ua.has(i))
2347
- return (o, a) => St(t, e, [
2347
+ return (o, a) => vt(t, e, [
2348
2348
  ...n,
2349
2349
  a ? [i, t, e, o, a] : [i, t, e, o]
2350
2350
  ]);
@@ -2354,10 +2354,10 @@ function St(t, e, n) {
2354
2354
  function la(t, e) {
2355
2355
  return `lookup__${t}__${JSON.stringify(e)}`;
2356
2356
  }
2357
- function It(t) {
2357
+ function Mt(t) {
2358
2358
  return t.startsWith("lookup__");
2359
2359
  }
2360
- function pn(t) {
2360
+ function yn(t) {
2361
2361
  const [e, n, ...r] = t.split("__");
2362
2362
  return [n, JSON.parse(r.join("__"))];
2363
2363
  }
@@ -2367,22 +2367,22 @@ function fa(t) {
2367
2367
  }, {
2368
2368
  get(e, n) {
2369
2369
  if (n === "lookup")
2370
- return (s, i) => St(t, pn(la(s, i)), []);
2370
+ return (s, i) => vt(t, yn(la(s, i)), []);
2371
2371
  if (n === "__etype")
2372
2372
  return t;
2373
2373
  const r = n;
2374
- return It(r) ? St(t, pn(r), []) : St(t, r, []);
2374
+ return Mt(r) ? vt(t, yn(r), []) : vt(t, r, []);
2375
2375
  }
2376
2376
  });
2377
2377
  }
2378
- function Kn() {
2378
+ function qn() {
2379
2379
  return new Proxy({}, {
2380
2380
  get(t, e) {
2381
2381
  return fa(e);
2382
2382
  }
2383
2383
  });
2384
2384
  }
2385
- const Ru = Kn();
2385
+ const Ru = qn();
2386
2386
  function da(t) {
2387
2387
  return t.__ops;
2388
2388
  }
@@ -2416,9 +2416,9 @@ function pa(t) {
2416
2416
  function ya(t, e, n) {
2417
2417
  return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
2418
2418
  // before assuming it's a ref lookup.
2419
- !N(t, e, n);
2419
+ !F(t, e, n);
2420
2420
  }
2421
- function yn(t) {
2421
+ function bn(t) {
2422
2422
  const [e, n, ...r] = t.split(".");
2423
2423
  if (r.length > 0 || n !== "id")
2424
2424
  throw new Error(`${t} is not a valid lookup attribute.`);
@@ -2426,17 +2426,17 @@ function yn(t) {
2426
2426
  }
2427
2427
  function ba(t, e, n) {
2428
2428
  if (!ya(t, e, n))
2429
- return N(t, e, n);
2430
- const r = yn(n), s = N(t, e, r) || Ce(t, e, r);
2429
+ return F(t, e, n);
2430
+ const r = bn(n), s = F(t, e, r) || Pe(t, e, r);
2431
2431
  if (s && s["value-type"] !== "ref")
2432
2432
  throw new Error(`${n} does not reference a valid link attribute.`);
2433
2433
  return s;
2434
2434
  }
2435
- function bn(t) {
2436
- return typeof t == "string" && !It(t) ? null : typeof t == "string" && It(t) ? pn(t) : pa(t);
2435
+ function gn(t) {
2436
+ return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? yn(t) : pa(t);
2437
2437
  }
2438
2438
  function ee(t, e, n) {
2439
- const r = bn(n);
2439
+ const r = gn(n);
2440
2440
  if (r === null)
2441
2441
  return n;
2442
2442
  const [s, i] = r, o = ba(t, e, s);
@@ -2450,13 +2450,13 @@ function Ps(t, e, n, r) {
2450
2450
  return Array.isArray(s) ? [[
2451
2451
  "add-triple",
2452
2452
  s,
2453
- (o = N(t, e, "id")) == null ? void 0 : o.id,
2453
+ (o = F(t, e, "id")) == null ? void 0 : o.id,
2454
2454
  s
2455
2455
  ]].concat(r) : r;
2456
2456
  }
2457
2457
  function ga({ attrsStore: t }, [e, n, r]) {
2458
2458
  const s = Object.entries(r).flatMap(([i, o]) => {
2459
- const a = Array.isArray(o) ? o : [o], c = N(t, e, i), u = Ce(t, e, i);
2459
+ const a = Array.isArray(o) ? o : [o], c = F(t, e, i), u = Pe(t, e, i);
2460
2460
  return a.map((l) => c ? [
2461
2461
  "add-triple",
2462
2462
  ee(t, e, n),
@@ -2477,7 +2477,7 @@ function ga({ attrsStore: t }, [e, n, r]) {
2477
2477
  }
2478
2478
  function _a({ attrsStore: t }, [e, n, r]) {
2479
2479
  const s = Object.entries(r).flatMap(([i, o]) => {
2480
- const a = Array.isArray(o) ? o : [o], c = N(t, e, i), u = Ce(t, e, i);
2480
+ const a = Array.isArray(o) ? o : [o], c = F(t, e, i), u = Pe(t, e, i);
2481
2481
  return a.map((l) => c ? [
2482
2482
  "retract-triple",
2483
2483
  ee(t, e, n),
@@ -2523,17 +2523,17 @@ function Is({ stores: t, attrsStore: e }, [n, r, s, i]) {
2523
2523
  return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : wa(t, e, n, r) ? { mode: "update" } : null;
2524
2524
  }
2525
2525
  function Ta(t, e) {
2526
- const { attrsStore: n } = t, [r, s, i, o] = e, a = Un(i), c = ee(n, r, s);
2526
+ const { attrsStore: n } = t, [r, s, i, o] = e, a = Ln(i), c = ee(n, r, s);
2527
2527
  return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
2528
- const h = N(n, r, l);
2529
- return h["checked-data-type"] === "date" && t.useDateObjects && (f = jt(f)), ["add-triple", c, h.id, f, { mode: "create" }];
2528
+ const h = F(n, r, l);
2529
+ return h["checked-data-type"] === "date" && t.useDateObjects && (f = Rt(f)), ["add-triple", c, h.id, f, { mode: "create" }];
2530
2530
  });
2531
2531
  }
2532
2532
  function ma(t, e) {
2533
- const { attrsStore: n } = t, [r, s, i, o] = e, a = Un(i), c = ee(n, r, s), u = Is(t, [r, c, i, o]);
2533
+ const { attrsStore: n } = t, [r, s, i, o] = e, a = Ln(i), c = ee(n, r, s), u = Is(t, [r, c, i, o]);
2534
2534
  return [["id", c]].concat(Object.entries(a)).map(([f, h]) => {
2535
- const y = N(n, r, f);
2536
- return y["checked-data-type"] === "date" && t.useDateObjects && (h = jt(h)), [
2535
+ const y = F(n, r, f);
2536
+ return y["checked-data-type"] === "date" && t.useDateObjects && (h = Rt(h)), [
2537
2537
  "add-triple",
2538
2538
  c,
2539
2539
  y.id,
@@ -2546,8 +2546,8 @@ function Sa({ attrsStore: t }, [e, n]) {
2546
2546
  return [["delete-entity", ee(t, e, n), e]];
2547
2547
  }
2548
2548
  function va(t, e) {
2549
- const { attrsStore: n } = t, [r, s, i, o] = e, a = Un(i), c = ee(n, r, s), u = Is(t, [r, c, i, o]), l = Object.entries(a).map(([h, y]) => {
2550
- const b = N(n, r, h);
2549
+ const { attrsStore: n } = t, [r, s, i, o] = e, a = Ln(i), c = ee(n, r, s), u = Is(t, [r, c, i, o]), l = Object.entries(a).map(([h, y]) => {
2550
+ const b = F(n, r, h);
2551
2551
  return [
2552
2552
  "deep-merge-triple",
2553
2553
  c,
@@ -2559,7 +2559,7 @@ function va(t, e) {
2559
2559
  return [[
2560
2560
  "add-triple",
2561
2561
  c,
2562
- N(n, r, "id").id,
2562
+ F(n, r, "id").id,
2563
2563
  c,
2564
2564
  ...u ? [u] : []
2565
2565
  ]].concat(l);
@@ -2620,7 +2620,7 @@ function Ca(t, e, n) {
2620
2620
  "checked-data-type": o
2621
2621
  };
2622
2622
  }
2623
- function yt(t, e, n, r) {
2623
+ function bt(t, e, n, r) {
2624
2624
  const s = t ? Ca(t, e, n) : null, i = W(), a = [W(), e, n];
2625
2625
  return {
2626
2626
  id: i,
@@ -2677,20 +2677,20 @@ const Ma = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
2677
2677
  "merge",
2678
2678
  "delete",
2679
2679
  "ruleParams"
2680
- ]), gn = { "unique?": !0, "index?": !0 }, $a = {
2681
- ...gn,
2680
+ ]), _n = { "unique?": !0, "index?": !0 }, $a = {
2681
+ ..._n,
2682
2682
  cardinality: "one"
2683
2683
  };
2684
2684
  function Da(t) {
2685
2685
  const e = [], [n, r, s, i] = t;
2686
2686
  if (!xa.has(n))
2687
2687
  return e;
2688
- const o = bn(s);
2688
+ const o = gn(s);
2689
2689
  if (o && e.push({ etype: r, lookupPair: o }), n === "link")
2690
2690
  for (const [a, c] of Object.entries(i)) {
2691
2691
  const u = Array.isArray(c) ? c : [c];
2692
2692
  for (const l of u) {
2693
- const f = bn(l);
2693
+ const f = gn(l);
2694
2694
  f && e.push({
2695
2695
  etype: r,
2696
2696
  lookupPair: f,
@@ -2704,12 +2704,12 @@ function Ua({ attrsStore: t, schema: e }, n) {
2704
2704
  var h, y;
2705
2705
  const r = /* @__PURE__ */ new Set(), s = [], i = [];
2706
2706
  function o(b, g) {
2707
- return N(t, b, g) || s.find((w) => w["forward-identity"][1] === b && w["forward-identity"][2] === g);
2707
+ return F(t, b, g) || s.find((w) => w["forward-identity"][1] === b && w["forward-identity"][2] === g);
2708
2708
  }
2709
2709
  function a(b, g) {
2710
- return Ce(t, b, g) || s.find((w) => {
2711
- var m, _;
2712
- return ((m = w["reverse-identity"]) == null ? void 0 : m[1]) === b && ((_ = w["reverse-identity"]) == null ? void 0 : _[2]) === g;
2710
+ return Pe(t, b, g) || s.find((w) => {
2711
+ var S, _;
2712
+ return ((S = w["reverse-identity"]) == null ? void 0 : S[1]) === b && ((_ = w["reverse-identity"]) == null ? void 0 : _[2]) === g;
2713
2713
  });
2714
2714
  }
2715
2715
  function c(b) {
@@ -2724,40 +2724,40 @@ function Ua({ attrsStore: t, schema: e }, n) {
2724
2724
  !o(b, g);
2725
2725
  }
2726
2726
  function f(b, g) {
2727
- const w = o(b, g), m = a(b, g);
2728
- u(w), u(m), !w && !m && c(Cr(e, b, g, $a));
2727
+ const w = o(b, g), S = a(b, g);
2728
+ u(w), u(S), !w && !S && c(Cr(e, b, g, $a));
2729
2729
  }
2730
2730
  for (const b of n)
2731
- for (const { etype: g, lookupPair: w, linkLabel: m } of Da(b)) {
2731
+ for (const { etype: g, lookupPair: w, linkLabel: S } of Da(b)) {
2732
2732
  const _ = w[0];
2733
- if (m) {
2734
- f(g, m);
2735
- const S = o(g, m), O = a(g, m);
2736
- u(S), u(O);
2737
- const E = ((h = S == null ? void 0 : S["reverse-identity"]) == null ? void 0 : h[1]) || ((y = O == null ? void 0 : O["forward-identity"]) == null ? void 0 : y[1]) || m;
2733
+ if (S) {
2734
+ f(g, S);
2735
+ const m = o(g, S), A = a(g, S);
2736
+ u(m), u(A);
2737
+ const E = ((h = m == null ? void 0 : m["reverse-identity"]) == null ? void 0 : h[1]) || ((y = A == null ? void 0 : A["forward-identity"]) == null ? void 0 : y[1]) || S;
2738
2738
  if (l(E, _))
2739
- f(E, yn(_));
2739
+ f(E, bn(_));
2740
2740
  else {
2741
2741
  const j = o(E, _);
2742
- j || c(yt(e, E, _, gn)), u(j);
2742
+ j || c(bt(e, E, _, _n)), u(j);
2743
2743
  }
2744
2744
  } else if (l(g, _))
2745
- f(g, yn(_));
2745
+ f(g, bn(_));
2746
2746
  else {
2747
- const S = o(g, _);
2748
- S || c(yt(e, g, _, gn)), u(S);
2747
+ const m = o(g, _);
2748
+ m || c(bt(e, g, _, _n)), u(m);
2749
2749
  }
2750
2750
  }
2751
2751
  for (const b of n) {
2752
- const [g, w, m, _] = b;
2752
+ const [g, w, S, _] = b;
2753
2753
  if (Ma.has(g)) {
2754
- const S = o(w, "id");
2755
- u(S), S || c(yt(e, w, "id", { "unique?": !0 }));
2756
- for (const O of Object.keys(_)) {
2757
- const E = o(w, O);
2758
- if (u(E), Ra.has(g) && (E || c(yt(e, w, O, O === "id" ? { "unique?": !0 } : null))), ja.has(g)) {
2759
- const j = a(w, O);
2760
- !E && !j && c(Cr(e, w, O)), u(j);
2754
+ const m = o(w, "id");
2755
+ u(m), m || c(bt(e, w, "id", { "unique?": !0 }));
2756
+ for (const A of Object.keys(_)) {
2757
+ const E = o(w, A);
2758
+ if (u(E), Ra.has(g) && (E || c(bt(e, w, A, A === "id" ? { "unique?": !0 } : null))), ja.has(g)) {
2759
+ const j = a(w, A);
2760
+ !E && !j && c(Cr(e, w, A)), u(j);
2761
2761
  }
2762
2762
  }
2763
2763
  }
@@ -2766,7 +2766,7 @@ function Ua({ attrsStore: t, schema: e }, n) {
2766
2766
  const b = { ...t.attrs };
2767
2767
  for (const g of s)
2768
2768
  b[g.id] = g;
2769
- return [new Ee(b, t.linkIndex), i];
2769
+ return [new Oe(b, t.linkIndex), i];
2770
2770
  }
2771
2771
  return [t, i];
2772
2772
  }
@@ -2782,7 +2782,7 @@ class Fa {
2782
2782
  constructor(e, n) {
2783
2783
  }
2784
2784
  }
2785
- class _n {
2785
+ class wn {
2786
2786
  constructor(e) {
2787
2787
  p(this, "currentValue");
2788
2788
  p(this, "_subs", []);
@@ -3004,7 +3004,7 @@ class _n {
3004
3004
  // so that we know which entries we need to persist to the store.
3005
3005
  updateInPlace(e) {
3006
3006
  this._version++;
3007
- const [n, r] = Ct(this.currentValue, e, {
3007
+ const [n, r] = Pt(this.currentValue, e, {
3008
3008
  enablePatches: !0
3009
3009
  });
3010
3010
  for (const s of r) {
@@ -3056,12 +3056,12 @@ async function za(t, e, n) {
3056
3056
  for (const [y, b] of Object.entries(r)) {
3057
3057
  const g = typeof b == "string" ? JSON.parse(b) : b;
3058
3058
  if (g.lastAccessed) {
3059
- const m = {
3059
+ const S = {
3060
3060
  createdAt: g.lastAccessed,
3061
3061
  updatedAt: g.lastAccessed,
3062
3062
  size: ((h = (f = (l = g.result) == null ? void 0 : l.store) == null ? void 0 : f.triples) == null ? void 0 : h.length) ?? 0
3063
3063
  };
3064
- a[y] = m;
3064
+ a[y] = S;
3065
3065
  }
3066
3066
  const w = n.put(g, y);
3067
3067
  s.add(w);
@@ -3095,8 +3095,8 @@ async function Va(t, e) {
3095
3095
  b.onsuccess = () => {
3096
3096
  const w = b.result;
3097
3097
  if (w) {
3098
- const m = w.key, _ = w.value;
3099
- g.push([m, _]), w.continue();
3098
+ const S = w.key, _ = w.value;
3099
+ g.push([S, _]), w.continue();
3100
3100
  } else
3101
3101
  l(g);
3102
3102
  }, b.onerror = (w) => {
@@ -3242,19 +3242,19 @@ class js {
3242
3242
  };
3243
3243
  }
3244
3244
  }
3245
- class Ne extends Error {
3245
+ class Ke extends Error {
3246
3246
  constructor(n, r) {
3247
3247
  super(n);
3248
3248
  p(this, "hint");
3249
3249
  this.hint = r;
3250
3250
  const s = new.target.prototype;
3251
- Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, Ne), this.name = "InstantError";
3251
+ Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, Ke), this.name = "InstantError";
3252
3252
  }
3253
3253
  get [Symbol.toStringTag]() {
3254
3254
  return "InstantError";
3255
3255
  }
3256
3256
  }
3257
- class xt extends Ne {
3257
+ class $t extends Ke {
3258
3258
  constructor(n) {
3259
3259
  var i;
3260
3260
  const r = ((i = n.body) == null ? void 0 : i.message) || `API Error (${n.status})`;
@@ -3262,7 +3262,7 @@ class xt extends Ne {
3262
3262
  p(this, "body");
3263
3263
  p(this, "status");
3264
3264
  const s = new.target.prototype;
3265
- Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, xt), this.name = "InstantAPIError", this.status = n.status, this.body = n.body;
3265
+ Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, $t), this.name = "InstantAPIError", this.status = n.status, this.body = n.body;
3266
3266
  }
3267
3267
  get [Symbol.toStringTag]() {
3268
3268
  return "InstantAPIError";
@@ -3270,7 +3270,7 @@ class xt extends Ne {
3270
3270
  }
3271
3271
  async function ue(t, e) {
3272
3272
  const n = await fetch(t, e), r = await n.json();
3273
- return n.status === 200 ? Promise.resolve(r) : Promise.reject(new xt({ status: n.status, body: r }));
3273
+ return n.status === 200 ? Promise.resolve(r) : Promise.reject(new $t({ status: n.status, body: r }));
3274
3274
  }
3275
3275
  function Ba({ apiURI: t, appId: e, email: n }) {
3276
3276
  return ue(`${t}/runtime/auth/send_magic_code`, {
@@ -3403,8 +3403,8 @@ async function nc({ apiURI: t, appId: e, path: n, refreshToken: r }) {
3403
3403
  });
3404
3404
  return s;
3405
3405
  }
3406
- let qn = !1, Rs = !1, xs = !1;
3407
- typeof window < "u" && typeof window.localStorage < "u" && (qn = !!window.localStorage.getItem("devBackend"), Rs = !!window.localStorage.getItem("__instantLogging"), xs = !!window.localStorage.getItem("__devtoolLocalDash"));
3406
+ let Wn = !1, Rs = !1, xs = !1;
3407
+ typeof window < "u" && typeof window.localStorage < "u" && (Wn = !!window.localStorage.getItem("devBackend"), Rs = !!window.localStorage.getItem("__instantLogging"), xs = !!window.localStorage.getItem("__devtoolLocalDash"));
3408
3408
  function Rr(t, e) {
3409
3409
  if (!e)
3410
3410
  return t;
@@ -3481,7 +3481,7 @@ function Dr(t) {
3481
3481
  }, e;
3482
3482
  }, {});
3483
3483
  }
3484
- const Wn = "v0.22.131";
3484
+ const zn = "v0.22.132";
3485
3485
  function ic(t, e) {
3486
3486
  return {
3487
3487
  info: t ? (...n) => console.info(...n, e()) : () => {
@@ -3525,17 +3525,17 @@ class H {
3525
3525
  });
3526
3526
  }
3527
3527
  }
3528
- class $t {
3528
+ class Dt {
3529
3529
  constructor(e, n) {
3530
3530
  p(this, "attrs");
3531
3531
  p(this, "links");
3532
3532
  this.attrs = e, this.links = n;
3533
3533
  }
3534
3534
  asType() {
3535
- return new $t(this.attrs, this.links);
3535
+ return new Dt(this.attrs, this.links);
3536
3536
  }
3537
3537
  }
3538
- class Dt {
3538
+ class Ut {
3539
3539
  constructor(e, n, r) {
3540
3540
  p(this, "entities");
3541
3541
  p(this, "links");
@@ -3562,7 +3562,7 @@ class Dt {
3562
3562
  * @see https://instantdb.com/docs/presence-and-topics#typesafety
3563
3563
  */
3564
3564
  withRoomSchema() {
3565
- return new Dt(this.entities, this.links, {});
3565
+ return new Ut(this.entities, this.links, {});
3566
3566
  }
3567
3567
  }
3568
3568
  class x extends Error {
@@ -3629,7 +3629,7 @@ const Ur = [
3629
3629
  default:
3630
3630
  throw new x(`Unknown operator '${t}' for attribute '${r}' in entity '${s}'`, o);
3631
3631
  }
3632
- }, De = (t, e, n, r, s) => {
3632
+ }, Ue = (t, e, n, r, s) => {
3633
3633
  const i = oc(n), o = n.valueType === "json";
3634
3634
  if (typeof t == "object" && t !== null && !Array.isArray(t)) {
3635
3635
  if (o)
@@ -3659,23 +3659,23 @@ const Ur = [
3659
3659
  if (!c)
3660
3660
  throw new x(`Target entity '${o}' does not exist in schema for dot notation path '${t}'.`, s);
3661
3661
  if (a === "id") {
3662
- if (typeof e == "string" && !Le(e))
3662
+ if (typeof e == "string" && !Fe(e))
3663
3663
  throw new x(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
3664
- De(e, t, new H("string", !1, !0), n, s);
3664
+ Ue(e, t, new H("string", !1, !0), n, s);
3665
3665
  return;
3666
3666
  }
3667
3667
  const u = c.attrs[a];
3668
3668
  if (Object.keys(c.links).includes(a)) {
3669
- if (typeof e == "string" && !Le(e))
3669
+ if (typeof e == "string" && !Fe(e))
3670
3670
  throw new x(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
3671
- De(e, t, new H("string", !1, !0), n, s);
3671
+ Ue(e, t, new H("string", !1, !0), n, s);
3672
3672
  return;
3673
3673
  }
3674
3674
  if (!u) {
3675
3675
  const l = Object.keys(c.attrs);
3676
3676
  throw new x(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
3677
3677
  }
3678
- De(e, t, u, n, s);
3678
+ Ue(e, t, u, n, s);
3679
3679
  }, Us = (t, e, n, r) => {
3680
3680
  for (const [s, i] of Object.entries(t)) {
3681
3681
  if (s === "or" || s === "and") {
@@ -3685,7 +3685,7 @@ const Ur = [
3685
3685
  continue;
3686
3686
  }
3687
3687
  if (s === "id") {
3688
- De(i, "id", new H("string", !1, !0), e, `${r}.id`);
3688
+ Ue(i, "id", new H("string", !1, !0), e, `${r}.id`);
3689
3689
  continue;
3690
3690
  }
3691
3691
  if (s.includes(".")) {
@@ -3701,12 +3701,12 @@ const Ur = [
3701
3701
  throw new x(`Attribute or link '${s}' does not exist on entity '${e}'. Available attributes: ${u.length > 0 ? u.join(", ") : "none"}. Available links: ${l.length > 0 ? l.join(", ") : "none"}`, `${r}.${s}`);
3702
3702
  }
3703
3703
  if (a)
3704
- De(i, s, a, e, `${r}.${s}`);
3704
+ Ue(i, s, a, e, `${r}.${s}`);
3705
3705
  else if (c) {
3706
- if (typeof i == "string" && !Le(i))
3706
+ if (typeof i == "string" && !Fe(i))
3707
3707
  throw new x(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
3708
3708
  const u = new H("string", !1, !0);
3709
- De(i, s, u, e, `${r}.${s}`);
3709
+ Ue(i, s, u, e, `${r}.${s}`);
3710
3710
  }
3711
3711
  }
3712
3712
  }, uc = (t, e, n, r, s = 0) => {
@@ -3769,13 +3769,13 @@ const Ur = [
3769
3769
  Ls(n[r], r, e, r, 0);
3770
3770
  }
3771
3771
  }
3772
- }, Fr = (t) => typeof t != "string" ? !1 : It(t) ? !0 : Le(t);
3772
+ }, Fr = (t) => typeof t != "string" ? !1 : Mt(t) ? !0 : Fe(t);
3773
3773
  class se extends Error {
3774
3774
  constructor(e) {
3775
3775
  super(e), this.name = "TransactionValidationError";
3776
3776
  }
3777
3777
  }
3778
- const Fs = (t) => t.length > 0 ? t.join(", ") : "none", lc = (t, e) => new se(`Entity '${t}' does not exist in schema. Available entities: ${Fs(e)}`), Ht = {
3778
+ const Fs = (t) => t.length > 0 ? t.join(", ") : "none", lc = (t, e) => new se(`Entity '${t}' does not exist in schema. Available entities: ${Fs(e)}`), Jt = {
3779
3779
  string: (t) => typeof t == "string",
3780
3780
  number: (t) => typeof t == "number" && !isNaN(t),
3781
3781
  boolean: (t) => typeof t == "boolean",
@@ -3783,13 +3783,13 @@ const Fs = (t) => t.length > 0 ? t.join(", ") : "none", lc = (t, e) => new se(`E
3783
3783
  json: () => !0
3784
3784
  }, fc = (t, e) => {
3785
3785
  var n;
3786
- return t == null ? !0 : ((n = Ht[e.valueType]) == null ? void 0 : n.call(Ht, t)) ?? !1;
3786
+ return t == null ? !0 : ((n = Jt[e.valueType]) == null ? void 0 : n.call(Jt, t)) ?? !1;
3787
3787
  }, Ns = (t, e) => {
3788
3788
  const n = e.entities[t];
3789
3789
  if (!n)
3790
3790
  throw lc(t, Object.keys(e.entities));
3791
3791
  return n;
3792
- }, Jt = (t, e, n) => {
3792
+ }, Yt = (t, e, n) => {
3793
3793
  const r = Ns(t, n);
3794
3794
  if (typeof e != "object" || e === null)
3795
3795
  throw new se(`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`);
@@ -3819,9 +3819,9 @@ const Fs = (t) => t.length > 0 ? t.join(", ") : "none", lc = (t, e) => new se(`E
3819
3819
  }
3820
3820
  }
3821
3821
  }, dc = {
3822
- create: Jt,
3823
- update: Jt,
3824
- merge: Jt,
3822
+ create: Yt,
3823
+ update: Yt,
3824
+ merge: Yt,
3825
3825
  link: Nr,
3826
3826
  unlink: Nr,
3827
3827
  delete: () => {
@@ -3830,7 +3830,7 @@ const Fs = (t) => t.length > 0 ? t.join(", ") : "none", lc = (t, e) => new se(`E
3830
3830
  if (!e)
3831
3831
  return;
3832
3832
  const [n, r, s, i] = t;
3833
- if (!Array.isArray(s) && !Le(s))
3833
+ if (!Array.isArray(s) && !Fe(s))
3834
3834
  throw new se(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
3835
3835
  if (typeof r != "string")
3836
3836
  throw new se(`Entity name must be a string, but received: ${typeof r}`);
@@ -4014,15 +4014,15 @@ function _c(t, e, n) {
4014
4014
  const r = (i = e == null ? void 0 : e.state) == null ? void 0 : i.txId, s = (o = n == null ? void 0 : n.state) == null ? void 0 : o.txId;
4015
4015
  return r && (!s || r > s) ? e : s && (!r || s > r) ? n : e || n;
4016
4016
  }
4017
- function Yt(t, e, n) {
4017
+ function Zt(t, e, n) {
4018
4018
  return Cs({ store: e, attrsStore: n, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
4019
4019
  }
4020
4020
  function qr(t, e, n, r) {
4021
4021
  var o;
4022
- const s = (o = N(n, t.table, "id")) == null ? void 0 : o.id;
4022
+ const s = (o = F(n, t.table, "id")) == null ? void 0 : o.id;
4023
4023
  if (!s)
4024
4024
  return -1;
4025
- const i = Ke(e.eav, [r, s, r]);
4025
+ const i = qe(e.eav, [r, s, r]);
4026
4026
  return i ? i[3] : -1;
4027
4027
  }
4028
4028
  function Wr(t, e, n) {
@@ -4061,14 +4061,14 @@ function wc(t, e, n) {
4061
4061
  u === l && delete a[c];
4062
4062
  return r;
4063
4063
  }
4064
- function bt(t, e) {
4064
+ function gt(t, e) {
4065
4065
  return { [t.table]: e.map((n) => n.entity) };
4066
4066
  }
4067
4067
  function Tc(t, e) {
4068
4068
  var r;
4069
4069
  if (t.orderFieldType)
4070
4070
  return t.orderFieldType;
4071
- const n = t.orderField === "serverCreatedAt" ? "number" : (r = N(e(), t.table, t.orderField)) == null ? void 0 : r["checked-data-type"];
4071
+ const n = t.orderField === "serverCreatedAt" ? "number" : (r = F(e(), t.table, t.orderField)) == null ? void 0 : r["checked-data-type"];
4072
4072
  return t.orderFieldType = n, n;
4073
4073
  }
4074
4074
  function mc(t, e, n) {
@@ -4088,10 +4088,10 @@ function mc(t, e, n) {
4088
4088
  return Ye(a.entity.id, a.entity[s], o.entity.id, o.entity[s], r);
4089
4089
  });
4090
4090
  }
4091
- var Te;
4091
+ var me;
4092
4092
  (function(t) {
4093
4093
  t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
4094
- })(Te || (Te = {}));
4094
+ })(me || (me = {}));
4095
4095
  class Sc {
4096
4096
  constructor(e, n, r, s, i, o) {
4097
4097
  p(this, "trySend");
@@ -4103,7 +4103,7 @@ class Sc {
4103
4103
  p(this, "log");
4104
4104
  p(this, "createStore");
4105
4105
  p(this, "getAttrs");
4106
- this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new _n({
4106
+ this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new wn({
4107
4107
  persister: n,
4108
4108
  merge: _c,
4109
4109
  serialize: gc,
@@ -4169,8 +4169,8 @@ class Sc {
4169
4169
  const s = this.subs.currentValue[n];
4170
4170
  if (s && s.state && s.state.txId) {
4171
4171
  this.sendResync(s, s.state, s.state.txId), (u = s.values) != null && u.entities && r && r({
4172
- type: Te.LoadFromStorage,
4173
- data: bt(s, (l = s.values) == null ? void 0 : l.entities)
4172
+ type: me.LoadFromStorage,
4173
+ data: gt(s, (l = s.values) == null ? void 0 : l.entities)
4174
4174
  });
4175
4175
  return;
4176
4176
  }
@@ -4228,7 +4228,7 @@ class Sc {
4228
4228
  o.values = a;
4229
4229
  const c = a.entities;
4230
4230
  for (const u of r) {
4231
- const l = this.createStore(u), f = Yt(o, l, a.attrsStore);
4231
+ const l = this.createStore(u), f = Zt(o, l, a.attrsStore);
4232
4232
  c.push({
4233
4233
  store: l,
4234
4234
  entity: f,
@@ -4238,8 +4238,8 @@ class Sc {
4238
4238
  this.subs.updateInPlace((u) => {
4239
4239
  u[s] = o, u[s].updatedAt = Date.now();
4240
4240
  }), o.values && this.notifyCbs(s, {
4241
- type: Te.InitialSyncBatch,
4242
- data: bt(o, o.values.entities),
4241
+ type: me.InitialSyncBatch,
4242
+ data: gt(o, o.values.entities),
4243
4243
  batch: i
4244
4244
  });
4245
4245
  }
@@ -4263,8 +4263,8 @@ class Sc {
4263
4263
  });
4264
4264
  const s = this.subs.currentValue[r];
4265
4265
  s && this.notifyCbs(r, {
4266
- type: Te.InitialSyncComplete,
4267
- data: bt(s, ((i = s.values) == null ? void 0 : i.entities) || [])
4266
+ type: me.InitialSyncComplete,
4267
+ data: gt(s, ((i = s.values) == null ? void 0 : i.entities) || [])
4268
4268
  });
4269
4269
  }
4270
4270
  onSyncUpdateTriples(e) {
@@ -4290,8 +4290,8 @@ class Sc {
4290
4290
  i.txId = a["tx-id"];
4291
4291
  const c = [], u = {};
4292
4292
  for (const w of a.changes) {
4293
- const m = u[w.triple[0]] ?? [];
4294
- u[w.triple[0]] = m, m.push(w);
4293
+ const S = u[w.triple[0]] ?? [];
4294
+ u[w.triple[0]] = S, S.push(w);
4295
4295
  }
4296
4296
  const l = s.values ?? {
4297
4297
  entities: [],
@@ -4299,46 +4299,46 @@ class Sc {
4299
4299
  }, f = l.entities;
4300
4300
  s.values = l;
4301
4301
  const h = [];
4302
- e: for (const [w, m] of Object.entries(u))
4302
+ e: for (const [w, S] of Object.entries(u))
4303
4303
  for (let _ = 0; _ < f.length; _++) {
4304
- const S = f[_];
4305
- if (eo(S.store, w)) {
4306
- Wr(S.store, l.attrsStore, m);
4307
- const O = Yt(s, S.store, l.attrsStore), E = wc(S.store, l.attrsStore, m)[w];
4308
- O ? (h.push({
4309
- oldEntity: S.entity,
4310
- newEntity: O,
4304
+ const m = f[_];
4305
+ if (eo(m.store, w)) {
4306
+ Wr(m.store, l.attrsStore, S);
4307
+ const A = Zt(s, m.store, l.attrsStore), E = wc(m.store, l.attrsStore, S)[w];
4308
+ A ? (h.push({
4309
+ oldEntity: m.entity,
4310
+ newEntity: A,
4311
4311
  changedFields: E || {}
4312
- }), S.entity = O) : c.push(_), delete u[w];
4312
+ }), m.entity = A) : c.push(_), delete u[w];
4313
4313
  continue e;
4314
4314
  }
4315
4315
  }
4316
4316
  const y = [];
4317
- for (const [w, m] of Object.entries(u)) {
4317
+ for (const [w, S] of Object.entries(u)) {
4318
4318
  const _ = this.createStore([]);
4319
- Wr(_, l.attrsStore, m);
4320
- const S = Yt(s, _, l.attrsStore);
4321
- if (!S) {
4319
+ Wr(_, l.attrsStore, S);
4320
+ const m = Zt(s, _, l.attrsStore);
4321
+ if (!m) {
4322
4322
  this.log.error("No entity found after applying change", {
4323
4323
  sub: s,
4324
- changes: m,
4324
+ changes: S,
4325
4325
  store: _
4326
4326
  });
4327
4327
  continue;
4328
4328
  }
4329
4329
  f.push({
4330
4330
  store: _,
4331
- entity: S,
4332
- serverCreatedAt: qr(s, _, l.attrsStore, S.id)
4333
- }), y.push(S);
4331
+ entity: m,
4332
+ serverCreatedAt: qr(s, _, l.attrsStore, m.id)
4333
+ }), y.push(m);
4334
4334
  }
4335
4335
  const b = [];
4336
4336
  for (const w of c.sort().reverse())
4337
4337
  b.push(f[w].entity), f.splice(w, 1);
4338
4338
  const g = Tc(s, this.getAttrs);
4339
4339
  mc(s, g, f), this.notifyCbs(r, {
4340
- type: Te.SyncTransaction,
4341
- data: bt(s, (o = s.values) == null ? void 0 : o.entities),
4340
+ type: me.SyncTransaction,
4341
+ data: gt(s, (o = s.values) == null ? void 0 : o.entities),
4342
4342
  added: y,
4343
4343
  removed: b,
4344
4344
  updated: h
@@ -4367,7 +4367,7 @@ class Sc {
4367
4367
  hint: e.hint
4368
4368
  }, s = Object.keys(e["original-event"].q)[0];
4369
4369
  this.notifyCbs(n, {
4370
- type: Te.Error,
4370
+ type: me.Error,
4371
4371
  data: { [s]: [] },
4372
4372
  error: r
4373
4373
  });
@@ -4386,7 +4386,7 @@ const de = {
4386
4386
  }, vc = 3e4, Ec = 3e4, Oc = 200, Ac = 1e3 * 60, kc = {
4387
4387
  apiURI: "https://api.instantdb.com",
4388
4388
  websocketURI: "wss://api.instantdb.com/runtime/session"
4389
- }, Zt = "_instant_oauth_redirect", Ve = "currentUser";
4389
+ }, Xt = "_instant_oauth_redirect", Ve = "currentUser";
4390
4390
  function Cc({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: s }) {
4391
4391
  if (!s)
4392
4392
  return new Kr(`${r}?app_id=${e}`);
@@ -4458,7 +4458,7 @@ function xc(t, e, n) {
4458
4458
  const r = e == null ? void 0 : e.result, s = n == null ? void 0 : n.result;
4459
4459
  return r && !s && n && (n.result = r), n || e;
4460
4460
  }
4461
- function Xt(t) {
4461
+ function en(t) {
4462
4462
  return [...t].sort((e, n) => {
4463
4463
  const [r, s] = e, [i, o] = n, a = s.order || 0, c = o.order || 0;
4464
4464
  return a == c ? r < i ? -1 : r > i ? 1 : 0 : a - c;
@@ -4505,7 +4505,7 @@ class $c {
4505
4505
  p(this, "_linkIndex", null);
4506
4506
  /** @type BroadcastChannel | undefined */
4507
4507
  p(this, "_broadcastChannel");
4508
- /** @type {Record<string, {isConnected: boolean; error: any}>} */
4508
+ /** @type {Record<string, {roomType: string; isConnected: boolean; error: any}>} */
4509
4509
  p(this, "_rooms", {});
4510
4510
  /** @type {Record<string, boolean>} */
4511
4511
  p(this, "_roomsPendingLeave", {});
@@ -4545,7 +4545,7 @@ class $c {
4545
4545
  p(this, "notifyOne", (e) => {
4546
4546
  var i;
4547
4547
  const n = this.queryCbs[e] ?? [], r = (i = this._dataForQueryCache[e]) == null ? void 0 : i.data, s = this.dataForQuery(e);
4548
- s != null && s.data && (this._dataForQueryCache[e] = s, !mt(s.data, r) && n.forEach((o) => o.cb(s.data)));
4548
+ s != null && s.data && (this._dataForQueryCache[e] = s, !St(s.data, r) && n.forEach((o) => o.cb(s.data)));
4549
4549
  });
4550
4550
  p(this, "notifyOneQueryOnce", (e) => {
4551
4551
  var s;
@@ -4662,10 +4662,10 @@ class $c {
4662
4662
  }
4663
4663
  this._log.info("[socket][close]", n.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
4664
4664
  });
4665
- if (this._EventSource = i, this.config = { ...kc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Ec, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Oc, this._log = ic(e.verbose || qn || Rs, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": Wn }, this.config.schema && (this._linkIndex = Dr(this.config.schema)), !!Pc()) {
4665
+ if (this._EventSource = i, this.config = { ...kc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Ec, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Oc, this._log = ic(e.verbose || Wn || Rs, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": zn }, this.config.schema && (this._linkIndex = Dr(this.config.schema)), !!Pc()) {
4666
4666
  if (!e.appId)
4667
4667
  throw new Error("Instant must be initialized with an appId.");
4668
- if (!Le(e.appId))
4668
+ if (!Fe(e.appId))
4669
4669
  throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
4670
4670
  typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", async (o) => {
4671
4671
  var a;
@@ -4716,7 +4716,7 @@ class $c {
4716
4716
  this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
4717
4717
  }
4718
4718
  _initStorage(e) {
4719
- this.querySubs = new _n({
4719
+ this.querySubs = new wn({
4720
4720
  persister: new e(this.config.appId, "querySubs"),
4721
4721
  merge: xc,
4722
4722
  serialize: Mc,
@@ -4736,7 +4736,7 @@ class $c {
4736
4736
  maxSize: 1e6
4737
4737
  // 1 million triples
4738
4738
  }
4739
- }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new _n({
4739
+ }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new wn({
4740
4740
  persister: new e(this.config.appId, "kv"),
4741
4741
  merge: this._onMergeKv,
4742
4742
  serialize: Rc,
@@ -4772,13 +4772,13 @@ class $c {
4772
4772
  s.resolve({ status: e, eventId: n });
4773
4773
  else if (r != null && r.type) {
4774
4774
  const { status: o, ...a } = r;
4775
- s.reject(new xt({
4775
+ s.reject(new $t({
4776
4776
  // @ts-expect-error body.type is not constant typed
4777
4777
  body: a,
4778
4778
  status: o ?? 0
4779
4779
  }));
4780
4780
  } else
4781
- s.reject(new Ne((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint));
4781
+ s.reject(new Ke((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint));
4782
4782
  }
4783
4783
  _setStatus(e, n) {
4784
4784
  this.status = e, this._errorMessage = n, this.notifyConnectionStatusSubs(e);
@@ -4817,14 +4817,14 @@ class $c {
4817
4817
  }), this._cleanupPendingMutationsQueries(), this.notifyOne(s), this.notifyOneQueryOnce(s), this._cleanupPendingMutationsTimeout();
4818
4818
  }
4819
4819
  _handleReceive(e, n) {
4820
- var s, i, o, a, c, u;
4820
+ var s, i, o, a, c, u, l;
4821
4821
  const r = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
4822
4822
  switch (zr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
4823
4823
  case "init-ok": {
4824
4824
  this._setStatus(de.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
4825
- for (const h of Object.keys(this._rooms)) {
4826
- const y = (i = (s = this._presence[h]) == null ? void 0 : s.result) == null ? void 0 : i.user;
4827
- this._tryJoinRoom(h, y);
4825
+ for (const y of Object.keys(this._rooms)) {
4826
+ const b = (i = (s = this._presence[y]) == null ? void 0 : s.result) == null ? void 0 : i.user, g = (o = this._rooms[y]) == null ? void 0 : o.roomType;
4827
+ this._tryJoinRoom(g, y, b);
4828
4828
  }
4829
4829
  break;
4830
4830
  }
@@ -4833,23 +4833,23 @@ class $c {
4833
4833
  break;
4834
4834
  }
4835
4835
  case "add-query-ok": {
4836
- const { q: h, result: y } = n, b = q(h);
4837
- if (!this._hasQueryListeners() && !this.querySubs.currentValue[b])
4836
+ const { q: y, result: b } = n, g = q(y);
4837
+ if (!this._hasQueryListeners() && !this.querySubs.currentValue[g])
4838
4838
  break;
4839
- const g = (a = (o = y == null ? void 0 : y[0]) == null ? void 0 : o.data) == null ? void 0 : a["page-info"], w = (u = (c = y == null ? void 0 : y[0]) == null ? void 0 : c.data) == null ? void 0 : u.aggregate, m = $r(y), _ = this.ensureAttrs(), S = Je(_, m, r, this.config.useDateObjects);
4840
- this.querySubs.updateInPlace((O) => {
4841
- if (!O[b]) {
4842
- this._log.info("Missing value in querySubs", { hash: b, q: h });
4839
+ const w = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, _ = $r(b), m = this.ensureAttrs(), A = Je(m, _, r, this.config.useDateObjects);
4840
+ this.querySubs.updateInPlace((E) => {
4841
+ if (!E[g]) {
4842
+ this._log.info("Missing value in querySubs", { hash: g, q: y });
4843
4843
  return;
4844
4844
  }
4845
- O[b].result = {
4846
- store: S,
4847
- attrsStore: _,
4848
- pageInfo: g,
4849
- aggregate: w,
4845
+ E[g].result = {
4846
+ store: A,
4847
+ attrsStore: m,
4848
+ pageInfo: w,
4849
+ aggregate: S,
4850
4850
  processedTxId: n["processed-tx-id"]
4851
4851
  };
4852
- }), this._cleanupPendingMutationsQueries(), this.notifyOne(b), this.notifyOneQueryOnce(b), this._cleanupPendingMutationsTimeout();
4852
+ }), this._cleanupPendingMutationsQueries(), this.notifyOne(g), this.notifyOneQueryOnce(g), this._cleanupPendingMutationsTimeout();
4853
4853
  break;
4854
4854
  }
4855
4855
  case "start-sync-ok": {
@@ -4869,101 +4869,101 @@ class $c {
4869
4869
  break;
4870
4870
  }
4871
4871
  case "refresh-ok": {
4872
- const { computations: h, attrs: y } = n, b = n["processed-tx-id"];
4873
- y && this._setAttrs(y), this._cleanupPendingMutationsTimeout();
4874
- const g = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), b);
4875
- g !== this._pendingMutations() && this.kv.updateInPlace((_) => {
4876
- _.pendingMutations = g;
4872
+ const { computations: y, attrs: b } = n, g = n["processed-tx-id"];
4873
+ b && this._setAttrs(b), this._cleanupPendingMutationsTimeout();
4874
+ const w = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), g);
4875
+ w !== this._pendingMutations() && this.kv.updateInPlace((m) => {
4876
+ m.pendingMutations = w;
4877
4877
  });
4878
- const w = Xt(g.entries()), m = h.map((_) => {
4879
- var We, ie, le, be;
4880
- const S = _["instaql-query"], O = _["instaql-result"], E = q(S), j = $r(O), L = this.ensureAttrs(), B = Je(L, j, r, this.config.useDateObjects), { store: qe, attrsStore: ut } = this._applyOptimisticUpdates(B, L, w, b), Ut = (ie = (We = O == null ? void 0 : O[0]) == null ? void 0 : We.data) == null ? void 0 : ie["page-info"], Lt = (be = (le = O == null ? void 0 : O[0]) == null ? void 0 : le.data) == null ? void 0 : be.aggregate;
4878
+ const S = en(w.entries()), _ = y.map((m) => {
4879
+ var ie, le, ge, We;
4880
+ const A = m["instaql-query"], E = m["instaql-result"], j = q(A), N = $r(E), B = this.ensureAttrs(), be = Je(B, N, r, this.config.useDateObjects), { store: ut, attrsStore: Lt } = this._applyOptimisticUpdates(be, B, S, g), Ft = (le = (ie = E == null ? void 0 : E[0]) == null ? void 0 : ie.data) == null ? void 0 : le["page-info"], lt = (We = (ge = E == null ? void 0 : E[0]) == null ? void 0 : ge.data) == null ? void 0 : We.aggregate;
4881
4881
  return {
4882
- q: S,
4883
- hash: E,
4884
- store: qe,
4885
- attrsStore: ut,
4886
- pageInfo: Ut,
4887
- aggregate: Lt
4882
+ q: A,
4883
+ hash: j,
4884
+ store: ut,
4885
+ attrsStore: Lt,
4886
+ pageInfo: Ft,
4887
+ aggregate: lt
4888
4888
  };
4889
4889
  });
4890
- m.forEach(({ hash: _, q: S, store: O, attrsStore: E, pageInfo: j, aggregate: L }) => {
4891
- this.querySubs.updateInPlace((B) => {
4892
- if (!B[_]) {
4893
- this._log.error("Missing value in querySubs", { hash: _, q: S });
4890
+ _.forEach(({ hash: m, q: A, store: E, attrsStore: j, pageInfo: N, aggregate: B }) => {
4891
+ this.querySubs.updateInPlace((be) => {
4892
+ if (!be[m]) {
4893
+ this._log.error("Missing value in querySubs", { hash: m, q: A });
4894
4894
  return;
4895
4895
  }
4896
- B[_].result = {
4897
- store: O,
4898
- attrsStore: E,
4899
- pageInfo: j,
4900
- aggregate: L,
4901
- processedTxId: b
4896
+ be[m].result = {
4897
+ store: E,
4898
+ attrsStore: j,
4899
+ pageInfo: N,
4900
+ aggregate: B,
4901
+ processedTxId: g
4902
4902
  };
4903
4903
  });
4904
- }), this._cleanupPendingMutationsQueries(), m.forEach(({ hash: _ }) => {
4905
- this.notifyOne(_);
4904
+ }), this._cleanupPendingMutationsQueries(), _.forEach(({ hash: m }) => {
4905
+ this.notifyOne(m);
4906
4906
  });
4907
4907
  break;
4908
4908
  }
4909
4909
  case "transact-ok": {
4910
- const { "client-event-id": h, "tx-id": y } = n;
4911
- this._inFlightMutationEventIds.delete(h);
4912
- const g = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations()).get(h);
4913
- if (!g)
4910
+ const { "client-event-id": y, "tx-id": b } = n;
4911
+ this._inFlightMutationEventIds.delete(y);
4912
+ const w = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations()).get(y);
4913
+ if (!w)
4914
4914
  break;
4915
- this._updatePendingMutations((m) => {
4916
- m.set(h, {
4917
- ...m.get(h),
4918
- "tx-id": y,
4915
+ this._updatePendingMutations((_) => {
4916
+ _.set(y, {
4917
+ ..._.get(y),
4918
+ "tx-id": b,
4919
4919
  confirmed: Date.now()
4920
4920
  });
4921
4921
  });
4922
- const w = [];
4923
- for (const m of g["tx-steps"])
4924
- if (m[0] === "add-attr") {
4925
- const _ = m[1];
4926
- w.push(_);
4922
+ const S = [];
4923
+ for (const _ of w["tx-steps"])
4924
+ if (_[0] === "add-attr") {
4925
+ const m = _[1];
4926
+ S.push(m);
4927
4927
  }
4928
- if (w.length) {
4929
- const m = Object.values(this.ensureAttrs().attrs);
4930
- this._setAttrs([...m, ...w]);
4928
+ if (S.length) {
4929
+ const _ = Object.values(this.ensureAttrs().attrs);
4930
+ this._setAttrs([..._, ...S]);
4931
4931
  }
4932
- this._finishTransaction("synced", h), this._cleanupPendingMutationsTimeout();
4932
+ this._finishTransaction("synced", y), this._cleanupPendingMutationsTimeout();
4933
4933
  break;
4934
4934
  }
4935
4935
  case "patch-presence": {
4936
- const h = n["room-id"];
4937
- this._trySetRoomConnected(h, !0), this._patchPresencePeers(h, n.edits), this._notifyPresenceSubs(h);
4936
+ const y = n["room-id"];
4937
+ this._trySetRoomConnected(y, !0), this._patchPresencePeers(y, n.edits), this._notifyPresenceSubs(y);
4938
4938
  break;
4939
4939
  }
4940
4940
  case "refresh-presence": {
4941
- const h = n["room-id"];
4942
- this._trySetRoomConnected(h, !0), this._setPresencePeers(h, n.data), this._notifyPresenceSubs(h);
4941
+ const y = n["room-id"];
4942
+ this._trySetRoomConnected(y, !0), this._setPresencePeers(y, n.data), this._notifyPresenceSubs(y);
4943
4943
  break;
4944
4944
  }
4945
4945
  case "server-broadcast": {
4946
- const h = n["room-id"], y = n.topic;
4947
- this._trySetRoomConnected(h, !0), this._notifyBroadcastSubs(h, y, n);
4946
+ const y = n["room-id"], b = n.topic;
4947
+ this._trySetRoomConnected(y, !0), this._notifyBroadcastSubs(y, b, n);
4948
4948
  break;
4949
4949
  }
4950
4950
  case "join-room-ok": {
4951
- const h = n["room-id"];
4952
- if (!this._rooms[h]) {
4953
- this._roomsPendingLeave[h] && (this._tryLeaveRoom(h), delete this._roomsPendingLeave[h]);
4951
+ const y = n["room-id"];
4952
+ if (!this._rooms[y]) {
4953
+ this._roomsPendingLeave[y] && (this._tryLeaveRoom(y), delete this._roomsPendingLeave[y]);
4954
4954
  break;
4955
4955
  }
4956
- this._trySetRoomConnected(h, !0), this._flushEnqueuedRoomData(h);
4956
+ this._trySetRoomConnected(y, !0), this._flushEnqueuedRoomData(y);
4957
4957
  break;
4958
4958
  }
4959
4959
  case "leave-room-ok": {
4960
- const h = n["room-id"];
4961
- this._trySetRoomConnected(h, !1);
4960
+ const y = n["room-id"];
4961
+ this._trySetRoomConnected(y, !1);
4962
4962
  break;
4963
4963
  }
4964
4964
  case "join-room-error":
4965
- const l = n["room-id"], f = this._rooms[l];
4966
- f && (f.error = n.error), this._notifyPresenceSubs(l);
4965
+ const f = n["room-id"], h = this._rooms[f];
4966
+ h && (h.error = n.error), this._notifyPresenceSubs(f);
4967
4967
  break;
4968
4968
  case "error":
4969
4969
  this._handleReceiveError(n);
@@ -5041,7 +5041,7 @@ class $c {
5041
5041
  i && (i.dfd.reject(s), this._completeQueryOnce(e, n, i.dfd));
5042
5042
  }
5043
5043
  _setAttrs(e) {
5044
- this.attrs = new Ee(e.reduce((n, r) => (n[r.id] = r, n), {}), this._linkIndex), this.notifyAttrsSubs();
5044
+ this.attrs = new Oe(e.reduce((n, r) => (n[r.id] = r, n), {}), this._linkIndex), this.notifyAttrsSubs();
5045
5045
  }
5046
5046
  _startQuerySub(e, n) {
5047
5047
  const r = W();
@@ -5116,10 +5116,10 @@ class $c {
5116
5116
  return /* @__PURE__ */ new Map();
5117
5117
  const s = (l) => {
5118
5118
  const [f, h, y] = l["forward-identity"];
5119
- return N(e, h, y);
5119
+ return F(e, h, y);
5120
5120
  }, i = (l) => {
5121
5121
  const [f, h, y] = l["forward-identity"];
5122
- return Ce(e, h, y);
5122
+ return Pe(e, h, y);
5123
5123
  }, o = { attrIdMap: {}, refSwapAttrIds: /* @__PURE__ */ new Set() };
5124
5124
  let a = !1;
5125
5125
  const c = (l, f) => {
@@ -5127,15 +5127,15 @@ class $c {
5127
5127
  for (const y of l) {
5128
5128
  const [b] = y;
5129
5129
  if (b === "add-attr") {
5130
- const [w, m] = y, _ = s(m);
5131
- if (_ && m.id !== _.id) {
5132
- o.attrIdMap[m.id] = _.id, a = !0;
5130
+ const [w, S] = y, _ = s(S);
5131
+ if (_ && S.id !== _.id) {
5132
+ o.attrIdMap[S.id] = _.id, a = !0;
5133
5133
  continue;
5134
5134
  }
5135
- if (m["value-type"] === "ref") {
5136
- const S = i(m);
5137
- if (S) {
5138
- o.attrIdMap[m.id] = S.id, o.refSwapAttrIds.add(m.id), a = !0;
5135
+ if (S["value-type"] === "ref") {
5136
+ const m = i(S);
5137
+ if (m) {
5138
+ o.attrIdMap[S.id] = m.id, o.refSwapAttrIds.add(S.id), a = !0;
5139
5139
  continue;
5140
5140
  }
5141
5141
  }
@@ -5157,7 +5157,7 @@ class $c {
5157
5157
  return a ? u : n;
5158
5158
  }
5159
5159
  _rewriteMutationsSorted(e, n) {
5160
- return Xt(this._rewriteMutations(e, n).entries());
5160
+ return en(this._rewriteMutations(e, n).entries());
5161
5161
  }
5162
5162
  // ---------------------------
5163
5163
  // Transact
@@ -5175,13 +5175,13 @@ class $c {
5175
5175
  r.push(u);
5176
5176
  }
5177
5177
  if (!n.size && !r.length)
5178
- return this.attrs || new Ee({}, this._linkIndex);
5178
+ return this.attrs || new Oe({}, this._linkIndex);
5179
5179
  const s = { ...((o = this.attrs) == null ? void 0 : o.attrs) || {} };
5180
5180
  for (const a of r)
5181
5181
  s[a.id] = a;
5182
5182
  for (const a of n)
5183
5183
  delete s[a];
5184
- return new Ee(s, this._linkIndex);
5184
+ return new Oe(s, this._linkIndex);
5185
5185
  }
5186
5186
  /** Runs instaql on a query and a store */
5187
5187
  dataForQuery(e, n = !0) {
@@ -5266,7 +5266,7 @@ class $c {
5266
5266
  const r = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations());
5267
5267
  r !== this._pendingMutations() && this.kv.updateInPlace((i) => {
5268
5268
  i.pendingMutations = r;
5269
- }), Xt(r.entries()).forEach(([i, o]) => {
5269
+ }), en(r.entries()).forEach(([i, o]) => {
5270
5270
  o["tx-id"] || this._sendMutation(i, o);
5271
5271
  }), this._syncTable.flushPending();
5272
5272
  }
@@ -5356,9 +5356,9 @@ class $c {
5356
5356
  if (typeof URL > "u")
5357
5357
  return;
5358
5358
  const e = new URL(window.location.href);
5359
- if (e.searchParams.get(Zt)) {
5359
+ if (e.searchParams.get(Xt)) {
5360
5360
  const n = e.toString();
5361
- e.searchParams.delete(Zt), e.searchParams.delete("code"), e.searchParams.delete("error");
5361
+ e.searchParams.delete(Xt), e.searchParams.delete("code"), e.searchParams.delete("error");
5362
5362
  const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
5363
5363
  if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
5364
5364
  typeof navigation == "object" && // @ts-ignore (waiting for ts support)
@@ -5382,7 +5382,7 @@ class $c {
5382
5382
  if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
5383
5383
  return null;
5384
5384
  const e = new URLSearchParams(window.location.search);
5385
- if (!e.get(Zt))
5385
+ if (!e.get(Xt))
5386
5386
  return null;
5387
5387
  const n = e.get("error");
5388
5388
  if (n)
@@ -5417,7 +5417,7 @@ class $c {
5417
5417
  n.isLoading || e(this._currentUserCached);
5418
5418
  let r = !1;
5419
5419
  return this.getCurrentUser().then((s) => {
5420
- r || mt(s, n) || e(s);
5420
+ r || St(s, n) || e(s);
5421
5421
  }), () => {
5422
5422
  r = !0, this.authCbs = this.authCbs.filter((s) => s !== e);
5423
5423
  };
@@ -5425,7 +5425,7 @@ class $c {
5425
5425
  async getAuth() {
5426
5426
  const { user: e, error: n } = await this.getCurrentUser();
5427
5427
  if (n)
5428
- throw new Ne("Could not get current user: " + n.message);
5428
+ throw new Ke("Could not get current user: " + n.message);
5429
5429
  return e;
5430
5430
  }
5431
5431
  subscribeConnectionStatus(e) {
@@ -5492,7 +5492,7 @@ class $c {
5492
5492
  async changeCurrentUser(e) {
5493
5493
  var r;
5494
5494
  const { user: n } = await this.getCurrentUser();
5495
- if (!mt(n, e)) {
5495
+ if (!St(n, e)) {
5496
5496
  await this.setCurrentUser(e), await this.updateUser(e);
5497
5497
  try {
5498
5498
  (r = this._broadcastChannel) == null || r.postMessage({ type: "auth" });
@@ -5640,19 +5640,21 @@ class $c {
5640
5640
  // --------
5641
5641
  // Rooms
5642
5642
  /**
5643
+ * @param {string} roomType
5643
5644
  * @param {string} roomId
5644
5645
  * @param {any | null | undefined} [initialPresence] -- initial presence data to send when joining the room
5645
5646
  * @returns () => void
5646
5647
  */
5647
- joinRoom(e, n) {
5648
- let r = !1;
5649
- this._rooms[e] || (r = !0, this._rooms[e] = {
5648
+ joinRoom(e, n, r) {
5649
+ let s = !1;
5650
+ this._rooms[n] || (s = !0, this._rooms[n] = {
5651
+ roomType: e,
5650
5652
  isConnected: !1,
5651
5653
  error: void 0
5652
- }), this._presence[e] = this._presence[e] || {};
5653
- const s = this._presence[e].result;
5654
- return n && !s && (this._presence[e].result = this._presence[e].result || {}, this._presence[e].result.user = n, this._notifyPresenceSubs(e)), r && this._tryJoinRoom(e, n), () => {
5655
- this._cleanupRoom(e);
5654
+ }), this._presence[n] = this._presence[n] || {};
5655
+ const i = this._presence[n].result;
5656
+ return r && !i && (this._presence[n].result = this._presence[n].result || {}, this._presence[n].result.user = r, this._notifyPresenceSubs(n)), s && this._tryJoinRoom(e, n, r), () => {
5657
+ this._cleanupRoom(n);
5656
5658
  };
5657
5659
  }
5658
5660
  _cleanupRoom(e) {
@@ -5692,8 +5694,13 @@ class $c {
5692
5694
  data: n
5693
5695
  });
5694
5696
  }
5695
- _tryJoinRoom(e, n) {
5696
- this._trySendAuthed(W(), { op: "join-room", "room-id": e, data: n }), delete this._roomsPendingLeave[e];
5697
+ _tryJoinRoom(e, n, r) {
5698
+ this._trySendAuthed(W(), {
5699
+ op: "join-room",
5700
+ "room-type": e,
5701
+ "room-id": n,
5702
+ data: r
5703
+ }), delete this._roomsPendingLeave[n];
5697
5704
  }
5698
5705
  _tryLeaveRoom(e) {
5699
5706
  this._trySendAuthed(W(), { op: "leave-room", "room-id": e });
@@ -5705,6 +5712,7 @@ class $c {
5705
5712
  // TODO: look into typing again
5706
5713
  subscribePresence(e, n, r, s) {
5707
5714
  const i = this.joinRoom(
5715
+ e,
5708
5716
  n,
5709
5717
  // Oct 28, 2025
5710
5718
  // Note: initialData is deprecated.
@@ -5731,7 +5739,7 @@ class $c {
5731
5739
  const r = ((a = (o = this._presence[e]) == null ? void 0 : o.result) == null ? void 0 : a.peers) || {};
5732
5740
  let s = Object.fromEntries(Object.entries(r).map(([u, l]) => [u, { data: l }]));
5733
5741
  (c = this._presence[e]) == null || c.result;
5734
- const i = Ct(s, (u) => {
5742
+ const i = Pt(s, (u) => {
5735
5743
  for (let [l, f, h] of n)
5736
5744
  switch (f) {
5737
5745
  case "+":
@@ -5752,7 +5760,7 @@ class $c {
5752
5760
  const r = { ...n };
5753
5761
  delete r[this._sessionId];
5754
5762
  const s = Object.fromEntries(Object.entries(r).map(([i, o]) => [i, o.data]));
5755
- this._presence = Ct(this._presence, (i) => {
5763
+ this._presence = Pt(this._presence, (i) => {
5756
5764
  wr(i, [e, "result", "peers"], s);
5757
5765
  });
5758
5766
  }
@@ -5777,10 +5785,10 @@ class $c {
5777
5785
  data: s
5778
5786
  });
5779
5787
  }
5780
- subscribeTopic(e, n, r) {
5781
- const s = this.joinRoom(e);
5782
- return this._broadcastSubs[e] = this._broadcastSubs[e] || {}, this._broadcastSubs[e][n] = this._broadcastSubs[e][n] || [], this._broadcastSubs[e][n].push(r), this._presence[e] = this._presence[e] || {}, () => {
5783
- this._broadcastSubs[e][n] = this._broadcastSubs[e][n].filter((i) => i !== r), this._broadcastSubs[e][n].length || delete this._broadcastSubs[e][n], s();
5788
+ subscribeTopic(e, n, r, s) {
5789
+ const i = this.joinRoom(e, n);
5790
+ return this._broadcastSubs[n] = this._broadcastSubs[n] || {}, this._broadcastSubs[n][r] = this._broadcastSubs[n][r] || [], this._broadcastSubs[n][r].push(s), this._presence[n] = this._presence[n] || {}, () => {
5791
+ this._broadcastSubs[n][r] = this._broadcastSubs[n][r].filter((o) => o !== s), this._broadcastSubs[n][r].length || delete this._broadcastSubs[n][r], i();
5784
5792
  };
5785
5793
  }
5786
5794
  _notifyBroadcastSubs(e, n, r) {
@@ -5839,7 +5847,7 @@ class $c {
5839
5847
  }
5840
5848
  }
5841
5849
  function Dc(t, e) {
5842
- return new Dt(
5850
+ return new Ut(
5843
5851
  qs(t, e),
5844
5852
  // (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
5845
5853
  // type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
@@ -5851,7 +5859,7 @@ function Dc(t, e) {
5851
5859
  );
5852
5860
  }
5853
5861
  function Uc(t) {
5854
- return new $t(t, {});
5862
+ return new Dt(t, {});
5855
5863
  }
5856
5864
  function Lc() {
5857
5865
  return new H("string", !0, !1);
@@ -5884,7 +5892,7 @@ function qs(t, e) {
5884
5892
  };
5885
5893
  return Object.fromEntries(Object.entries(t).map(([c, u]) => [
5886
5894
  c,
5887
- new $t(u.attrs, {
5895
+ new Dt(u.attrs, {
5888
5896
  ...n.fwd[c],
5889
5897
  ...n.rev[c]
5890
5898
  })
@@ -5892,7 +5900,7 @@ function qs(t, e) {
5892
5900
  }
5893
5901
  function zc({ entities: t, links: e, rooms: n }) {
5894
5902
  const r = e ?? {}, s = n ?? {};
5895
- return new Dt(
5903
+ return new Ut(
5896
5904
  qs(t, r),
5897
5905
  // (XXX): LinksDef<any> stems from TypeScript's inability to reconcile the
5898
5906
  // type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
@@ -5916,9 +5924,9 @@ const xu = {
5916
5924
  json: qc,
5917
5925
  any: Wc
5918
5926
  };
5919
- let gt;
5927
+ let _t;
5920
5928
  function Vc(t, e) {
5921
- gt == null || gt.dispose();
5929
+ _t == null || _t.dispose();
5922
5930
  const n = Yc(e), r = Qc(e, a), s = Gc(Bc(t));
5923
5931
  function i(l) {
5924
5932
  var f;
@@ -5935,14 +5943,14 @@ function Vc(t, e) {
5935
5943
  n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", i);
5936
5944
  }
5937
5945
  function u() {
5938
- document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", i), gt = {
5946
+ document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", i), _t = {
5939
5947
  dispose: c
5940
5948
  };
5941
5949
  }
5942
5950
  return u();
5943
5951
  }
5944
5952
  function Bc(t) {
5945
- return `${qn || xs ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
5953
+ return `${Wn || xs ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
5946
5954
  }
5947
5955
  function Gc(t) {
5948
5956
  const e = document.createElement("iframe");
@@ -6034,7 +6042,7 @@ function Zc(t, e) {
6034
6042
  }
6035
6043
  });
6036
6044
  }
6037
- function _t(t, e) {
6045
+ function wt(t, e) {
6038
6046
  return new Response(JSON.stringify({ ok: !1, error: e }), {
6039
6047
  status: t,
6040
6048
  headers: { "Content-Type": "application/json" }
@@ -6046,17 +6054,17 @@ const $u = (t) => ({
6046
6054
  try {
6047
6055
  n = await e.json();
6048
6056
  } catch {
6049
- return _t(400, "Invalid JSON body");
6057
+ return wt(400, "Invalid JSON body");
6050
6058
  }
6051
6059
  if (!n.type)
6052
- return _t(400, 'Missing "type" field');
6060
+ return wt(400, 'Missing "type" field');
6053
6061
  if (n.appId !== t.appId)
6054
- return _t(403, "App ID mismatch");
6062
+ return wt(403, "App ID mismatch");
6055
6063
  switch (n.type) {
6056
6064
  case "sync-user":
6057
6065
  return Zc(t, n.user ?? null);
6058
6066
  default:
6059
- return _t(400, `Unknown type: ${n.type}`);
6067
+ return wt(400, `Unknown type: ${n.type}`);
6060
6068
  }
6061
6069
  }
6062
6070
  }), Xc = {
@@ -6069,11 +6077,11 @@ function eu() {
6069
6077
  function tu() {
6070
6078
  return globalThis.__instantDbStore = globalThis.__instantDbStore ?? {}, globalThis.__instantDbStore;
6071
6079
  }
6072
- function wn(t) {
6080
+ function Tn(t) {
6073
6081
  const e = t.__adminToken;
6074
6082
  return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
6075
6083
  }
6076
- const Tn = tu(), Vr = eu();
6084
+ const mn = tu(), Vr = eu();
6077
6085
  class nu {
6078
6086
  constructor(e) {
6079
6087
  p(this, "db");
@@ -6248,7 +6256,7 @@ class iu {
6248
6256
  p(this, "_reactor");
6249
6257
  p(this, "auth");
6250
6258
  p(this, "storage");
6251
- p(this, "tx", Kn());
6259
+ p(this, "tx", qn());
6252
6260
  this._reactor = e, this.auth = new nu(this._reactor), this.storage = new ru(this._reactor);
6253
6261
  }
6254
6262
  /**
@@ -6381,8 +6389,8 @@ class iu {
6381
6389
  */
6382
6390
  joinRoom(e = "_defaultRoomType", n = "_defaultRoomId", r) {
6383
6391
  return {
6384
- leaveRoom: this._reactor.joinRoom(n, r == null ? void 0 : r.initialPresence),
6385
- subscribeTopic: (i, o) => this._reactor.subscribeTopic(n, i, o),
6392
+ leaveRoom: this._reactor.joinRoom(e, n, r == null ? void 0 : r.initialPresence),
6393
+ subscribeTopic: (i, o) => this._reactor.subscribeTopic(e, n, i, o),
6386
6394
  subscribePresence: (i, o) => this._reactor.subscribePresence(e, n, i, o),
6387
6395
  publishTopic: (i, o) => this._reactor.publishTopic({ roomType: e, roomId: n, topic: i, data: o }),
6388
6396
  publishPresence: (i) => this._reactor.publishPresence(e, n, i),
@@ -6390,7 +6398,7 @@ class iu {
6390
6398
  };
6391
6399
  }
6392
6400
  shutdown() {
6393
- delete Tn[wn(this._reactor.config)], this._reactor.shutdown();
6401
+ delete mn[Tn(this._reactor.config)], this._reactor.shutdown();
6394
6402
  }
6395
6403
  /**
6396
6404
  * Use this for one-off queries.
@@ -6441,15 +6449,15 @@ function au(t, e, n, r, s) {
6441
6449
  ...t,
6442
6450
  appId: (u = t.appId) == null ? void 0 : u.trim(),
6443
6451
  useDateObjects: t.useDateObjects ?? !1
6444
- }, o = Tn[wn(i)];
6452
+ }, o = mn[Tn(i)];
6445
6453
  if (o)
6446
6454
  return ou(o, i.schema) && o._reactor.updateSchema(i.schema), o;
6447
6455
  const a = new $c({
6448
6456
  ...Xc,
6449
6457
  ...i,
6450
6458
  cardinalityInference: !!i.schema
6451
- }, e || Ms, n || js, { ...r || {}, "@instantdb/core": Wn }, s), c = new iu(a);
6452
- return Tn[wn(i)] = c, cu(i.appId, i.devtool), c;
6459
+ }, e || Ms, n || js, { ...r || {}, "@instantdb/core": zn }, s), c = new iu(a);
6460
+ return mn[Tn(i)] = c, cu(i.appId, i.devtool), c;
6453
6461
  }
6454
6462
  function cu(t, e) {
6455
6463
  if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
@@ -6461,7 +6469,7 @@ function cu(t, e) {
6461
6469
  };
6462
6470
  n.allowedHosts.includes(window.location.hostname) && Vc(t, n);
6463
6471
  }
6464
- var mn = { exports: {} }, Be = {};
6472
+ var Sn = { exports: {} }, Be = {};
6465
6473
  /**
6466
6474
  * @license React
6467
6475
  * react-jsx-runtime.production.min.js
@@ -6501,23 +6509,23 @@ function lu() {
6501
6509
  */
6502
6510
  return t.NODE_ENV !== "production" && function() {
6503
6511
  var e = ts, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, w = "@@iterator";
6504
- function m(d) {
6512
+ function S(d) {
6505
6513
  if (d === null || typeof d != "object")
6506
6514
  return null;
6507
6515
  var T = g && d[g] || d[w];
6508
6516
  return typeof T == "function" ? T : null;
6509
6517
  }
6510
6518
  var _ = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
6511
- function S(d) {
6519
+ function m(d) {
6512
6520
  {
6513
- for (var T = arguments.length, v = new Array(T > 1 ? T - 1 : 0), A = 1; A < T; A++)
6514
- v[A - 1] = arguments[A];
6515
- O("error", d, v);
6521
+ for (var T = arguments.length, v = new Array(T > 1 ? T - 1 : 0), O = 1; O < T; O++)
6522
+ v[O - 1] = arguments[O];
6523
+ A("error", d, v);
6516
6524
  }
6517
6525
  }
6518
- function O(d, T, v) {
6526
+ function A(d, T, v) {
6519
6527
  {
6520
- var A = _.ReactDebugCurrentFrame, M = A.getStackAddendum();
6528
+ var O = _.ReactDebugCurrentFrame, M = O.getStackAddendum();
6521
6529
  M !== "" && (T += "%s", v = v.concat([M]));
6522
6530
  var R = v.map(function(I) {
6523
6531
  return String(I);
@@ -6525,29 +6533,29 @@ function lu() {
6525
6533
  R.unshift("Warning: " + T), Function.prototype.apply.call(console[d], console, R);
6526
6534
  }
6527
6535
  }
6528
- var E = !1, j = !1, L = !1, B = !1, qe = !1, ut;
6536
+ var E = !1, j = !1, N = !1, B = !1, be = !1, ut;
6529
6537
  ut = Symbol.for("react.module.reference");
6530
- function Ut(d) {
6531
- return !!(typeof d == "string" || typeof d == "function" || d === s || d === o || qe || d === i || d === l || d === f || B || d === b || E || j || L || typeof d == "object" && d !== null && (d.$$typeof === y || d.$$typeof === h || d.$$typeof === a || d.$$typeof === c || d.$$typeof === u || // This needs to include all possible module reference object
6538
+ function Lt(d) {
6539
+ return !!(typeof d == "string" || typeof d == "function" || d === s || d === o || be || d === i || d === l || d === f || B || d === b || E || j || N || typeof d == "object" && d !== null && (d.$$typeof === y || d.$$typeof === h || d.$$typeof === a || d.$$typeof === c || d.$$typeof === u || // This needs to include all possible module reference object
6532
6540
  // types supported by any Flight configuration anywhere since
6533
6541
  // we don't know which Flight build this will end up being used
6534
6542
  // with.
6535
6543
  d.$$typeof === ut || d.getModuleId !== void 0));
6536
6544
  }
6537
- function Lt(d, T, v) {
6538
- var A = d.displayName;
6539
- if (A)
6540
- return A;
6545
+ function Ft(d, T, v) {
6546
+ var O = d.displayName;
6547
+ if (O)
6548
+ return O;
6541
6549
  var M = T.displayName || T.name || "";
6542
6550
  return M !== "" ? v + "(" + M + ")" : v;
6543
6551
  }
6544
- function We(d) {
6552
+ function lt(d) {
6545
6553
  return d.displayName || "Context";
6546
6554
  }
6547
6555
  function ie(d) {
6548
6556
  if (d == null)
6549
6557
  return null;
6550
- if (typeof d.tag == "number" && S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof d == "function")
6558
+ if (typeof d.tag == "number" && m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof d == "function")
6551
6559
  return d.displayName || d.name || null;
6552
6560
  if (typeof d == "string")
6553
6561
  return d;
@@ -6569,15 +6577,15 @@ function lu() {
6569
6577
  switch (d.$$typeof) {
6570
6578
  case c:
6571
6579
  var T = d;
6572
- return We(T) + ".Consumer";
6580
+ return lt(T) + ".Consumer";
6573
6581
  case a:
6574
6582
  var v = d;
6575
- return We(v._context) + ".Provider";
6583
+ return lt(v._context) + ".Provider";
6576
6584
  case u:
6577
- return Lt(d, d.render, "ForwardRef");
6585
+ return Ft(d, d.render, "ForwardRef");
6578
6586
  case h:
6579
- var A = d.displayName || null;
6580
- return A !== null ? A : ie(d.type) || "Memo";
6587
+ var O = d.displayName || null;
6588
+ return O !== null ? O : ie(d.type) || "Memo";
6581
6589
  case y: {
6582
6590
  var M = d, R = M._payload, I = M._init;
6583
6591
  try {
@@ -6589,14 +6597,14 @@ function lu() {
6589
6597
  }
6590
6598
  return null;
6591
6599
  }
6592
- var le = Object.assign, be = 0, Vn, Bn, Gn, Qn, Hn, Jn, Yn;
6600
+ var le = Object.assign, ge = 0, We, Bn, Gn, Qn, Hn, Jn, Yn;
6593
6601
  function Zn() {
6594
6602
  }
6595
6603
  Zn.__reactDisabledLog = !0;
6596
6604
  function Vs() {
6597
6605
  {
6598
- if (be === 0) {
6599
- Vn = console.log, Bn = console.info, Gn = console.warn, Qn = console.error, Hn = console.group, Jn = console.groupCollapsed, Yn = console.groupEnd;
6606
+ if (ge === 0) {
6607
+ We = console.log, Bn = console.info, Gn = console.warn, Qn = console.error, Hn = console.group, Jn = console.groupCollapsed, Yn = console.groupEnd;
6600
6608
  var d = {
6601
6609
  configurable: !0,
6602
6610
  enumerable: !0,
@@ -6613,12 +6621,12 @@ function lu() {
6613
6621
  groupEnd: d
6614
6622
  });
6615
6623
  }
6616
- be++;
6624
+ ge++;
6617
6625
  }
6618
6626
  }
6619
6627
  function Bs() {
6620
6628
  {
6621
- if (be--, be === 0) {
6629
+ if (ge--, ge === 0) {
6622
6630
  var d = {
6623
6631
  configurable: !0,
6624
6632
  enumerable: !0,
@@ -6626,7 +6634,7 @@ function lu() {
6626
6634
  };
6627
6635
  Object.defineProperties(console, {
6628
6636
  log: le({}, d, {
6629
- value: Vn
6637
+ value: We
6630
6638
  }),
6631
6639
  info: le({}, d, {
6632
6640
  value: Bn
@@ -6648,42 +6656,42 @@ function lu() {
6648
6656
  })
6649
6657
  });
6650
6658
  }
6651
- be < 0 && S("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
6659
+ ge < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
6652
6660
  }
6653
6661
  }
6654
- var Ft = _.ReactCurrentDispatcher, Nt;
6655
- function lt(d, T, v) {
6662
+ var Nt = _.ReactCurrentDispatcher, Kt;
6663
+ function ft(d, T, v) {
6656
6664
  {
6657
- if (Nt === void 0)
6665
+ if (Kt === void 0)
6658
6666
  try {
6659
6667
  throw Error();
6660
6668
  } catch (M) {
6661
- var A = M.stack.trim().match(/\n( *(at )?)/);
6662
- Nt = A && A[1] || "";
6669
+ var O = M.stack.trim().match(/\n( *(at )?)/);
6670
+ Kt = O && O[1] || "";
6663
6671
  }
6664
6672
  return `
6665
- ` + Nt + d;
6673
+ ` + Kt + d;
6666
6674
  }
6667
6675
  }
6668
- var Kt = !1, ft;
6676
+ var qt = !1, dt;
6669
6677
  {
6670
6678
  var Gs = typeof WeakMap == "function" ? WeakMap : Map;
6671
- ft = new Gs();
6679
+ dt = new Gs();
6672
6680
  }
6673
6681
  function Xn(d, T) {
6674
- if (!d || Kt)
6682
+ if (!d || qt)
6675
6683
  return "";
6676
6684
  {
6677
- var v = ft.get(d);
6685
+ var v = dt.get(d);
6678
6686
  if (v !== void 0)
6679
6687
  return v;
6680
6688
  }
6681
- var A;
6682
- Kt = !0;
6689
+ var O;
6690
+ qt = !0;
6683
6691
  var M = Error.prepareStackTrace;
6684
6692
  Error.prepareStackTrace = void 0;
6685
6693
  var R;
6686
- R = Ft.current, Ft.current = null, Vs();
6694
+ R = Nt.current, Nt.current = null, Vs();
6687
6695
  try {
6688
6696
  if (T) {
6689
6697
  var I = function() {
@@ -6697,14 +6705,14 @@ function lu() {
6697
6705
  try {
6698
6706
  Reflect.construct(I, []);
6699
6707
  } catch (J) {
6700
- A = J;
6708
+ O = J;
6701
6709
  }
6702
6710
  Reflect.construct(d, [], I);
6703
6711
  } else {
6704
6712
  try {
6705
6713
  I.call();
6706
6714
  } catch (J) {
6707
- A = J;
6715
+ O = J;
6708
6716
  }
6709
6717
  d.call(I.prototype);
6710
6718
  }
@@ -6712,34 +6720,34 @@ function lu() {
6712
6720
  try {
6713
6721
  throw Error();
6714
6722
  } catch (J) {
6715
- A = J;
6723
+ O = J;
6716
6724
  }
6717
6725
  d();
6718
6726
  }
6719
6727
  } catch (J) {
6720
- if (J && A && typeof J.stack == "string") {
6728
+ if (J && O && typeof J.stack == "string") {
6721
6729
  for (var C = J.stack.split(`
6722
- `), G = A.stack.split(`
6723
- `), D = C.length - 1, F = G.length - 1; D >= 1 && F >= 0 && C[D] !== G[F]; )
6724
- F--;
6725
- for (; D >= 1 && F >= 0; D--, F--)
6726
- if (C[D] !== G[F]) {
6727
- if (D !== 1 || F !== 1)
6730
+ `), G = O.stack.split(`
6731
+ `), D = C.length - 1, L = G.length - 1; D >= 1 && L >= 0 && C[D] !== G[L]; )
6732
+ L--;
6733
+ for (; D >= 1 && L >= 0; D--, L--)
6734
+ if (C[D] !== G[L]) {
6735
+ if (D !== 1 || L !== 1)
6728
6736
  do
6729
- if (D--, F--, F < 0 || C[D] !== G[F]) {
6737
+ if (D--, L--, L < 0 || C[D] !== G[L]) {
6730
6738
  var re = `
6731
6739
  ` + C[D].replace(" at new ", " at ");
6732
- return d.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", d.displayName)), typeof d == "function" && ft.set(d, re), re;
6740
+ return d.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", d.displayName)), typeof d == "function" && dt.set(d, re), re;
6733
6741
  }
6734
- while (D >= 1 && F >= 0);
6742
+ while (D >= 1 && L >= 0);
6735
6743
  break;
6736
6744
  }
6737
6745
  }
6738
6746
  } finally {
6739
- Kt = !1, Ft.current = R, Bs(), Error.prepareStackTrace = M;
6747
+ qt = !1, Nt.current = R, Bs(), Error.prepareStackTrace = M;
6740
6748
  }
6741
- var Ie = d ? d.displayName || d.name : "", we = Ie ? lt(Ie) : "";
6742
- return typeof d == "function" && ft.set(d, we), we;
6749
+ var Me = d ? d.displayName || d.name : "", Te = Me ? ft(Me) : "";
6750
+ return typeof d == "function" && dt.set(d, Te), Te;
6743
6751
  }
6744
6752
  function Qs(d, T, v) {
6745
6753
  return Xn(d, !1);
@@ -6748,29 +6756,29 @@ function lu() {
6748
6756
  var T = d.prototype;
6749
6757
  return !!(T && T.isReactComponent);
6750
6758
  }
6751
- function dt(d, T, v) {
6759
+ function ht(d, T, v) {
6752
6760
  if (d == null)
6753
6761
  return "";
6754
6762
  if (typeof d == "function")
6755
6763
  return Xn(d, Hs(d));
6756
6764
  if (typeof d == "string")
6757
- return lt(d);
6765
+ return ft(d);
6758
6766
  switch (d) {
6759
6767
  case l:
6760
- return lt("Suspense");
6768
+ return ft("Suspense");
6761
6769
  case f:
6762
- return lt("SuspenseList");
6770
+ return ft("SuspenseList");
6763
6771
  }
6764
6772
  if (typeof d == "object")
6765
6773
  switch (d.$$typeof) {
6766
6774
  case u:
6767
6775
  return Qs(d.render);
6768
6776
  case h:
6769
- return dt(d.type, T, v);
6777
+ return ht(d.type, T, v);
6770
6778
  case y: {
6771
- var A = d, M = A._payload, R = A._init;
6779
+ var O = d, M = O._payload, R = O._init;
6772
6780
  try {
6773
- return dt(R(M), T, v);
6781
+ return ht(R(M), T, v);
6774
6782
  } catch {
6775
6783
  }
6776
6784
  }
@@ -6778,14 +6786,14 @@ function lu() {
6778
6786
  return "";
6779
6787
  }
6780
6788
  var ze = Object.prototype.hasOwnProperty, er = {}, tr = _.ReactDebugCurrentFrame;
6781
- function ht(d) {
6789
+ function pt(d) {
6782
6790
  if (d) {
6783
- var T = d._owner, v = dt(d.type, d._source, T ? T.type : null);
6791
+ var T = d._owner, v = ht(d.type, d._source, T ? T.type : null);
6784
6792
  tr.setExtraStackFrame(v);
6785
6793
  } else
6786
6794
  tr.setExtraStackFrame(null);
6787
6795
  }
6788
- function Js(d, T, v, A, M) {
6796
+ function Js(d, T, v, O, M) {
6789
6797
  {
6790
6798
  var R = Function.call.bind(ze);
6791
6799
  for (var I in d)
@@ -6793,19 +6801,19 @@ function lu() {
6793
6801
  var C = void 0;
6794
6802
  try {
6795
6803
  if (typeof d[I] != "function") {
6796
- var G = Error((A || "React class") + ": " + v + " type `" + I + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof d[I] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
6804
+ var G = Error((O || "React class") + ": " + v + " type `" + I + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof d[I] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
6797
6805
  throw G.name = "Invariant Violation", G;
6798
6806
  }
6799
- C = d[I](T, I, A, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
6807
+ C = d[I](T, I, O, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
6800
6808
  } catch (D) {
6801
6809
  C = D;
6802
6810
  }
6803
- C && !(C instanceof Error) && (ht(M), S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", A || "React class", v, I, typeof C), ht(null)), C instanceof Error && !(C.message in er) && (er[C.message] = !0, ht(M), S("Failed %s type: %s", v, C.message), ht(null));
6811
+ C && !(C instanceof Error) && (pt(M), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", v, I, typeof C), pt(null)), C instanceof Error && !(C.message in er) && (er[C.message] = !0, pt(M), m("Failed %s type: %s", v, C.message), pt(null));
6804
6812
  }
6805
6813
  }
6806
6814
  }
6807
6815
  var Ys = Array.isArray;
6808
- function qt(d) {
6816
+ function Wt(d) {
6809
6817
  return Ys(d);
6810
6818
  }
6811
6819
  function Zs(d) {
@@ -6826,7 +6834,7 @@ function lu() {
6826
6834
  }
6827
6835
  function rr(d) {
6828
6836
  if (Xs(d))
6829
- return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Zs(d)), nr(d);
6837
+ return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Zs(d)), nr(d);
6830
6838
  }
6831
6839
  var sr = _.ReactCurrentOwner, ei = {
6832
6840
  key: !0,
@@ -6856,7 +6864,7 @@ function lu() {
6856
6864
  function si(d, T) {
6857
6865
  {
6858
6866
  var v = function() {
6859
- ir || (ir = !0, S("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
6867
+ ir || (ir = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
6860
6868
  };
6861
6869
  v.isReactWarning = !0, Object.defineProperty(d, "key", {
6862
6870
  get: v,
@@ -6867,7 +6875,7 @@ function lu() {
6867
6875
  function ii(d, T) {
6868
6876
  {
6869
6877
  var v = function() {
6870
- or || (or = !0, S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
6878
+ or || (or = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
6871
6879
  };
6872
6880
  v.isReactWarning = !0, Object.defineProperty(d, "ref", {
6873
6881
  get: v,
@@ -6875,7 +6883,7 @@ function lu() {
6875
6883
  });
6876
6884
  }
6877
6885
  }
6878
- var oi = function(d, T, v, A, M, R, I) {
6886
+ var oi = function(d, T, v, O, M, R, I) {
6879
6887
  var C = {
6880
6888
  // This tag allows us to uniquely identify this as a React Element
6881
6889
  $$typeof: n,
@@ -6896,7 +6904,7 @@ function lu() {
6896
6904
  configurable: !1,
6897
6905
  enumerable: !1,
6898
6906
  writable: !1,
6899
- value: A
6907
+ value: O
6900
6908
  }), Object.defineProperty(C, "_source", {
6901
6909
  configurable: !1,
6902
6910
  enumerable: !1,
@@ -6904,7 +6912,7 @@ function lu() {
6904
6912
  value: M
6905
6913
  }), Object.freeze && (Object.freeze(C.props), Object.freeze(C)), C;
6906
6914
  };
6907
- function ai(d, T, v, A, M) {
6915
+ function ai(d, T, v, O, M) {
6908
6916
  {
6909
6917
  var R, I = {}, C = null, G = null;
6910
6918
  v !== void 0 && (rr(v), C = "" + v), ni(T) && (rr(T.key), C = "" + T.key), ti(T) && (G = T.ref, ri(T, M));
@@ -6916,29 +6924,29 @@ function lu() {
6916
6924
  I[R] === void 0 && (I[R] = D[R]);
6917
6925
  }
6918
6926
  if (C || G) {
6919
- var F = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
6920
- C && si(I, F), G && ii(I, F);
6927
+ var L = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
6928
+ C && si(I, L), G && ii(I, L);
6921
6929
  }
6922
- return oi(d, C, G, M, A, sr.current, I);
6930
+ return oi(d, C, G, M, O, sr.current, I);
6923
6931
  }
6924
6932
  }
6925
- var Wt = _.ReactCurrentOwner, ar = _.ReactDebugCurrentFrame;
6926
- function Pe(d) {
6933
+ var zt = _.ReactCurrentOwner, ar = _.ReactDebugCurrentFrame;
6934
+ function Ie(d) {
6927
6935
  if (d) {
6928
- var T = d._owner, v = dt(d.type, d._source, T ? T.type : null);
6936
+ var T = d._owner, v = ht(d.type, d._source, T ? T.type : null);
6929
6937
  ar.setExtraStackFrame(v);
6930
6938
  } else
6931
6939
  ar.setExtraStackFrame(null);
6932
6940
  }
6933
- var zt;
6934
- zt = !1;
6935
- function Vt(d) {
6941
+ var Vt;
6942
+ Vt = !1;
6943
+ function Bt(d) {
6936
6944
  return typeof d == "object" && d !== null && d.$$typeof === n;
6937
6945
  }
6938
6946
  function cr() {
6939
6947
  {
6940
- if (Wt.current) {
6941
- var d = ie(Wt.current.type);
6948
+ if (zt.current) {
6949
+ var d = ie(zt.current.type);
6942
6950
  if (d)
6943
6951
  return `
6944
6952
 
@@ -6972,26 +6980,26 @@ Check the top-level render call using <` + v + ">.");
6972
6980
  if (ur[v])
6973
6981
  return;
6974
6982
  ur[v] = !0;
6975
- var A = "";
6976
- d && d._owner && d._owner !== Wt.current && (A = " It was passed a child from " + ie(d._owner.type) + "."), Pe(d), S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', v, A), Pe(null);
6983
+ var O = "";
6984
+ d && d._owner && d._owner !== zt.current && (O = " It was passed a child from " + ie(d._owner.type) + "."), Ie(d), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', v, O), Ie(null);
6977
6985
  }
6978
6986
  }
6979
6987
  function fr(d, T) {
6980
6988
  {
6981
6989
  if (typeof d != "object")
6982
6990
  return;
6983
- if (qt(d))
6991
+ if (Wt(d))
6984
6992
  for (var v = 0; v < d.length; v++) {
6985
- var A = d[v];
6986
- Vt(A) && lr(A, T);
6993
+ var O = d[v];
6994
+ Bt(O) && lr(O, T);
6987
6995
  }
6988
- else if (Vt(d))
6996
+ else if (Bt(d))
6989
6997
  d._store && (d._store.validated = !0);
6990
6998
  else if (d) {
6991
- var M = m(d);
6999
+ var M = S(d);
6992
7000
  if (typeof M == "function" && M !== d.entries)
6993
7001
  for (var R = M.call(d), I; !(I = R.next()).done; )
6994
- Vt(I.value) && lr(I.value, T);
7002
+ Bt(I.value) && lr(I.value, T);
6995
7003
  }
6996
7004
  }
6997
7005
  }
@@ -7010,71 +7018,71 @@ Check the top-level render call using <` + v + ">.");
7010
7018
  else
7011
7019
  return;
7012
7020
  if (v) {
7013
- var A = ie(T);
7014
- Js(v, d.props, "prop", A, d);
7015
- } else if (T.PropTypes !== void 0 && !zt) {
7016
- zt = !0;
7021
+ var O = ie(T);
7022
+ Js(v, d.props, "prop", O, d);
7023
+ } else if (T.PropTypes !== void 0 && !Vt) {
7024
+ Vt = !0;
7017
7025
  var M = ie(T);
7018
- S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", M || "Unknown");
7026
+ m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", M || "Unknown");
7019
7027
  }
7020
- typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
7028
+ typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
7021
7029
  }
7022
7030
  }
7023
7031
  function fi(d) {
7024
7032
  {
7025
7033
  for (var T = Object.keys(d.props), v = 0; v < T.length; v++) {
7026
- var A = T[v];
7027
- if (A !== "children" && A !== "key") {
7028
- Pe(d), S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", A), Pe(null);
7034
+ var O = T[v];
7035
+ if (O !== "children" && O !== "key") {
7036
+ Ie(d), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", O), Ie(null);
7029
7037
  break;
7030
7038
  }
7031
7039
  }
7032
- d.ref !== null && (Pe(d), S("Invalid attribute `ref` supplied to `React.Fragment`."), Pe(null));
7040
+ d.ref !== null && (Ie(d), m("Invalid attribute `ref` supplied to `React.Fragment`."), Ie(null));
7033
7041
  }
7034
7042
  }
7035
7043
  var dr = {};
7036
- function hr(d, T, v, A, M, R) {
7044
+ function hr(d, T, v, O, M, R) {
7037
7045
  {
7038
- var I = Ut(d);
7046
+ var I = Lt(d);
7039
7047
  if (!I) {
7040
7048
  var C = "";
7041
7049
  (d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && (C += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
7042
7050
  var G = ci();
7043
7051
  G ? C += G : C += cr();
7044
7052
  var D;
7045
- d === null ? D = "null" : qt(d) ? D = "array" : d !== void 0 && d.$$typeof === n ? (D = "<" + (ie(d.type) || "Unknown") + " />", C = " Did you accidentally export a JSX literal instead of a component?") : D = typeof d, S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", D, C);
7053
+ d === null ? D = "null" : Wt(d) ? D = "array" : d !== void 0 && d.$$typeof === n ? (D = "<" + (ie(d.type) || "Unknown") + " />", C = " Did you accidentally export a JSX literal instead of a component?") : D = typeof d, 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, C);
7046
7054
  }
7047
- var F = ai(d, T, v, M, R);
7048
- if (F == null)
7049
- return F;
7055
+ var L = ai(d, T, v, M, R);
7056
+ if (L == null)
7057
+ return L;
7050
7058
  if (I) {
7051
7059
  var re = T.children;
7052
7060
  if (re !== void 0)
7053
- if (A)
7054
- if (qt(re)) {
7055
- for (var Ie = 0; Ie < re.length; Ie++)
7056
- fr(re[Ie], d);
7061
+ if (O)
7062
+ if (Wt(re)) {
7063
+ for (var Me = 0; Me < re.length; Me++)
7064
+ fr(re[Me], d);
7057
7065
  Object.freeze && Object.freeze(re);
7058
7066
  } else
7059
- S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
7067
+ 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.");
7060
7068
  else
7061
7069
  fr(re, d);
7062
7070
  }
7063
7071
  if (ze.call(T, "key")) {
7064
- var we = ie(d), J = Object.keys(T).filter(function(gi) {
7072
+ var Te = ie(d), J = Object.keys(T).filter(function(gi) {
7065
7073
  return gi !== "key";
7066
- }), Bt = J.length > 0 ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}";
7067
- if (!dr[we + Bt]) {
7074
+ }), Gt = J.length > 0 ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}";
7075
+ if (!dr[Te + Gt]) {
7068
7076
  var bi = J.length > 0 ? "{" + J.join(": ..., ") + ": ...}" : "{}";
7069
- S(`A props object containing a "key" prop is being spread into JSX:
7077
+ m(`A props object containing a "key" prop is being spread into JSX:
7070
7078
  let props = %s;
7071
7079
  <%s {...props} />
7072
7080
  React keys must be passed directly to JSX without using spread:
7073
7081
  let props = %s;
7074
- <%s key={someKey} {...props} />`, Bt, we, bi, we), dr[we + Bt] = !0;
7082
+ <%s key={someKey} {...props} />`, Gt, Te, bi, Te), dr[Te + Gt] = !0;
7075
7083
  }
7076
7084
  }
7077
- return d === s ? fi(F) : li(F), F;
7085
+ return d === s ? fi(L) : li(L), L;
7078
7086
  }
7079
7087
  }
7080
7088
  function di(d, T, v) {
@@ -7088,8 +7096,8 @@ React keys must be passed directly to JSX without using spread:
7088
7096
  }(), Ge;
7089
7097
  }
7090
7098
  var fu = {};
7091
- fu.NODE_ENV === "production" ? mn.exports = uu() : mn.exports = lu();
7092
- var V = mn.exports;
7099
+ fu.NODE_ENV === "production" ? Sn.exports = uu() : Sn.exports = lu();
7100
+ var V = Sn.exports;
7093
7101
  const du = {
7094
7102
  isLoading: !0,
7095
7103
  data: void 0,
@@ -7107,7 +7115,7 @@ function Hr(t) {
7107
7115
  }
7108
7116
  function hu(t, e, n) {
7109
7117
  e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
7110
- const r = e ? su(e) : null, s = q(r), i = it(Hr(t._reactor.getPreviousResult(r))), o = _e(
7118
+ const r = e ? su(e) : null, s = q(r), i = it(Hr(t._reactor.getPreviousResult(r))), o = we(
7111
7119
  (c) => (i.current = Hr(t._reactor.getPreviousResult(r)), c(), r ? t.subscribeQuery(r, (l) => {
7112
7120
  i.current = {
7113
7121
  isLoading: !l,
@@ -7124,11 +7132,11 @@ function hu(t, e, n) {
7124
7132
  // Build a new subscribe function if the query changes
7125
7133
  [s]
7126
7134
  );
7127
- return { state: tn(o, () => i.current, () => du), query: r };
7135
+ return { state: nn(o, () => i.current, () => du), query: r };
7128
7136
  }
7129
7137
  function pu() {
7130
7138
  const t = it(null);
7131
- Oe(() => {
7139
+ Ae(() => {
7132
7140
  n();
7133
7141
  }, []);
7134
7142
  function e(r, s) {
@@ -7142,12 +7150,12 @@ function pu() {
7142
7150
  const yu = 1e3;
7143
7151
  function bu(t, e, n) {
7144
7152
  const r = it(n);
7145
- r.current = n, Oe(() => t.core._reactor.subscribeTopic(t.id, e, (i, o) => {
7153
+ r.current = n, Ae(() => t.core._reactor.subscribeTopic(t.type, t.id, e, (i, o) => {
7146
7154
  r.current(i, o);
7147
7155
  }), [t.id, e]);
7148
7156
  }
7149
7157
  function gu(t, e) {
7150
- return Oe(() => t.core._reactor.joinRoom(t.id), [t.id]), _e((r) => {
7158
+ return Ae(() => t.core._reactor.joinRoom(t.type, t.id), [t.id]), we((r) => {
7151
7159
  t.core._reactor.publishTopic({
7152
7160
  roomType: t.type,
7153
7161
  roomId: t.id,
@@ -7162,27 +7170,27 @@ function _u(t, e = {}) {
7162
7170
  peers: {},
7163
7171
  isLoading: !0
7164
7172
  });
7165
- Oe(() => t.core._reactor.subscribePresence(t.type, t.id, e, (u) => {
7173
+ Ae(() => t.core._reactor.subscribePresence(t.type, t.id, e, (u) => {
7166
7174
  r(u);
7167
7175
  }), [t.id, e.user, (o = e.peers) == null ? void 0 : o.join(), (a = e.keys) == null ? void 0 : a.join()]);
7168
- const s = _e((c) => {
7176
+ const s = we((c) => {
7169
7177
  t.core._reactor.publishPresence(t.type, t.id, c);
7170
7178
  }, [t.type, t.id]);
7171
- return nn(() => ({
7179
+ return rn(() => ({
7172
7180
  ...n,
7173
7181
  publishPresence: s
7174
7182
  }), [n, s]);
7175
7183
  }
7176
7184
  function wu(t, e, n) {
7177
- Oe(() => t.core._reactor.joinRoom(t.id, e), [t.id]), Oe(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
7185
+ Ae(() => t.core._reactor.joinRoom(t.type, t.id, e), [t.id]), Ae(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
7178
7186
  }
7179
7187
  function Tu(t, e, n = {}) {
7180
- const r = pu(), s = me.usePresence(t, {
7188
+ const r = pu(), s = Se.usePresence(t, {
7181
7189
  keys: [e]
7182
- }), i = nn(() => {
7190
+ }), i = rn(() => {
7183
7191
  const l = t._core._reactor.getPresence(t.type, t.id);
7184
7192
  return n != null && n.writeOnly ? [] : Object.values((l == null ? void 0 : l.peers) ?? {}).filter((f) => f[e] === !0);
7185
- }, [n == null ? void 0 : n.writeOnly, s]), o = _e((l) => {
7193
+ }, [n == null ? void 0 : n.writeOnly, s]), o = we((l) => {
7186
7194
  t.core._reactor.publishPresence(t.type, t.id, {
7187
7195
  [e]: l
7188
7196
  }), l && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? yu, () => {
@@ -7190,19 +7198,19 @@ function Tu(t, e, n = {}) {
7190
7198
  [e]: null
7191
7199
  });
7192
7200
  }));
7193
- }, [t.type, t.id, e, n == null ? void 0 : n.timeout, r]), a = _e((l) => {
7201
+ }, [t.type, t.id, e, n == null ? void 0 : n.timeout, r]), a = we((l) => {
7194
7202
  const h = !((n == null ? void 0 : n.stopOnEnter) && l.key === "Enter");
7195
7203
  o(h);
7196
- }, [n.stopOnEnter, o]), c = _e(() => {
7204
+ }, [n.stopOnEnter, o]), c = we(() => {
7197
7205
  o(!1);
7198
- }, [o]), u = nn(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
7206
+ }, [o]), u = rn(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
7199
7207
  return {
7200
7208
  active: i,
7201
7209
  setActive: o,
7202
7210
  inputProps: u
7203
7211
  };
7204
7212
  }
7205
- const me = {
7213
+ const Se = {
7206
7214
  useTopicEffect: bu,
7207
7215
  usePublishTopic: gu,
7208
7216
  usePresence: _u,
@@ -7231,7 +7239,7 @@ class mu {
7231
7239
  * db.rooms.useTopicEffect(room, 'emoji', (message, peer) => { });
7232
7240
  */
7233
7241
  p(this, "useTopicEffect", (e, n) => {
7234
- me.useTopicEffect(this, e, n);
7242
+ Se.useTopicEffect(this, e, n);
7235
7243
  });
7236
7244
  /**
7237
7245
  * @deprecated
@@ -7247,7 +7255,7 @@ class mu {
7247
7255
  * const room = db.room('chat', 'room-id');
7248
7256
  * const publish = db.rooms.usePublishTopic(room, 'emoji');
7249
7257
  */
7250
- p(this, "usePublishTopic", (e) => me.usePublishTopic(this, e));
7258
+ p(this, "usePublishTopic", (e) => Se.usePublishTopic(this, e));
7251
7259
  /**
7252
7260
  * @deprecated
7253
7261
  * `db.room(...).usePresence` is deprecated. You can replace it with `db.rooms.usePresence`.
@@ -7262,7 +7270,7 @@ class mu {
7262
7270
  * const room = db.room('chat', 'room-id');
7263
7271
  * const { peers } = db.rooms.usePresence(room, { keys: ["name", "avatar"] });
7264
7272
  */
7265
- p(this, "usePresence", (e = {}) => me.usePresence(this, e));
7273
+ p(this, "usePresence", (e = {}) => Se.usePresence(this, e));
7266
7274
  /**
7267
7275
  * @deprecated
7268
7276
  * `db.room(...).useSyncPresence` is deprecated. You can replace it with `db.rooms.useSyncPresence`.
@@ -7277,7 +7285,7 @@ class mu {
7277
7285
  * const room = db.room('chat', 'room-id');
7278
7286
  * db.rooms.useSyncPresence(room, { nickname });
7279
7287
  */
7280
- p(this, "useSyncPresence", (e, n) => me.useSyncPresence(this, e, n));
7288
+ p(this, "useSyncPresence", (e, n) => Se.useSyncPresence(this, e, n));
7281
7289
  /**
7282
7290
  * @deprecated
7283
7291
  * `db.room(...).useTypingIndicator` is deprecated. You can replace it with `db.rooms.useTypingIndicator`.
@@ -7292,7 +7300,7 @@ class mu {
7292
7300
  * const room = db.room('chat', 'room-id');
7293
7301
  * const typing = db.rooms.useTypingIndiactor(room, 'chat-input');
7294
7302
  */
7295
- p(this, "useTypingIndicator", (e, n = {}) => me.useTypingIndicator(this, e, n));
7303
+ p(this, "useTypingIndicator", (e, n = {}) => Se.useTypingIndicator(this, e, n));
7296
7304
  this.core = e, this._core = this.core, this.type = n, this.id = r;
7297
7305
  }
7298
7306
  }
@@ -7301,9 +7309,9 @@ const Su = {
7301
7309
  user: void 0,
7302
7310
  error: void 0
7303
7311
  };
7304
- class vt {
7312
+ class Et {
7305
7313
  constructor(e, n) {
7306
- p(this, "tx", Kn());
7314
+ p(this, "tx", qn());
7307
7315
  p(this, "auth");
7308
7316
  p(this, "storage");
7309
7317
  p(this, "core");
@@ -7332,7 +7340,7 @@ class vt {
7332
7340
  */
7333
7341
  p(this, "useLocalId", (e) => {
7334
7342
  const [n, r] = ns(null);
7335
- return Oe(() => {
7343
+ return Ae(() => {
7336
7344
  (async () => {
7337
7345
  const i = await this.getLocalId(e);
7338
7346
  r(i);
@@ -7350,7 +7358,7 @@ class vt {
7350
7358
  * const publish = db.rooms.usePublishTopic(room, 'emoji');
7351
7359
  * // ...
7352
7360
  */
7353
- p(this, "rooms", me);
7361
+ p(this, "rooms", Se);
7354
7362
  /**
7355
7363
  * Use this to write data! You can create, update, delete, and link objects
7356
7364
  *
@@ -7446,7 +7454,7 @@ class vt {
7446
7454
  p(this, "useUser", () => {
7447
7455
  const { user: e } = this.useAuth();
7448
7456
  if (!e)
7449
- throw new Ne("useUser must be used within an auth-protected route");
7457
+ throw new Ke("useUser must be used within an auth-protected route");
7450
7458
  return e;
7451
7459
  });
7452
7460
  /**
@@ -7472,10 +7480,10 @@ class vt {
7472
7480
  * }
7473
7481
  */
7474
7482
  p(this, "useConnectionStatus", () => {
7475
- const e = it(this.core._reactor.status), n = _e((s) => this.core.subscribeConnectionStatus((o) => {
7483
+ const e = it(this.core._reactor.status), n = we((s) => this.core.subscribeConnectionStatus((o) => {
7476
7484
  o !== e.current && (e.current = o, s());
7477
7485
  }), []);
7478
- return tn(
7486
+ return nn(
7479
7487
  n,
7480
7488
  () => e.current,
7481
7489
  // For SSR, always return 'connecting' as the initial state
@@ -7551,10 +7559,10 @@ class vt {
7551
7559
  return new mu(this.core, e, n);
7552
7560
  }
7553
7561
  _useAuth() {
7554
- const e = it(this.core._reactor._currentUserCached), n = _e((s) => this.core.subscribeAuth((o) => {
7562
+ const e = it(this.core._reactor._currentUserCached), n = we((s) => this.core.subscribeAuth((o) => {
7555
7563
  e.current = { isLoading: !1, ...o }, s();
7556
7564
  }), []);
7557
- return tn(n, () => e.current, () => Su);
7565
+ return nn(n, () => e.current, () => Su);
7558
7566
  }
7559
7567
  /**
7560
7568
  * One time query for the logged in state. This is useful
@@ -7570,25 +7578,25 @@ class vt {
7570
7578
  return this.core.getAuth();
7571
7579
  }
7572
7580
  }
7573
- p(vt, "Store"), p(vt, "NetworkListener"), p(vt, "EventSourceImpl");
7581
+ p(Et, "Store"), p(Et, "NetworkListener"), p(Et, "EventSourceImpl");
7574
7582
  class Jr extends Error {
7575
7583
  constructor(e, n) {
7576
7584
  super(e), this.name = "ParseError", this.type = n.type, this.field = n.field, this.value = n.value, this.line = n.line;
7577
7585
  }
7578
7586
  }
7579
- function en(t) {
7587
+ function tn(t) {
7580
7588
  }
7581
7589
  function vu(t) {
7582
7590
  if (typeof t == "function")
7583
7591
  throw new TypeError(
7584
7592
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
7585
7593
  );
7586
- const { onEvent: e = en, onError: n = en, onRetry: r = en, onComment: s } = t;
7594
+ const { onEvent: e = tn, onError: n = tn, onRetry: r = tn, onComment: s } = t;
7587
7595
  let i = "", o = !0, a, c = "", u = "";
7588
7596
  function l(g) {
7589
- const w = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [m, _] = Eu(`${i}${w}`);
7590
- for (const S of m)
7591
- f(S);
7597
+ const w = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [S, _] = Eu(`${i}${w}`);
7598
+ for (const m of S)
7599
+ f(m);
7592
7600
  i = _, o = !1;
7593
7601
  }
7594
7602
  function f(g) {
@@ -7602,13 +7610,13 @@ function vu(t) {
7602
7610
  }
7603
7611
  const w = g.indexOf(":");
7604
7612
  if (w !== -1) {
7605
- const m = g.slice(0, w), _ = g[w + 1] === " " ? 2 : 1, S = g.slice(w + _);
7606
- h(m, S, g);
7613
+ const S = g.slice(0, w), _ = g[w + 1] === " " ? 2 : 1, m = g.slice(w + _);
7614
+ h(S, m, g);
7607
7615
  return;
7608
7616
  }
7609
7617
  h(g, "", g);
7610
7618
  }
7611
- function h(g, w, m) {
7619
+ function h(g, w, S) {
7612
7620
  switch (g) {
7613
7621
  case "event":
7614
7622
  u = w;
@@ -7625,7 +7633,7 @@ function vu(t) {
7625
7633
  new Jr(`Invalid \`retry\` value: "${w}"`, {
7626
7634
  type: "invalid-retry",
7627
7635
  value: w,
7628
- line: m
7636
+ line: S
7629
7637
  })
7630
7638
  );
7631
7639
  break;
@@ -7633,7 +7641,7 @@ function vu(t) {
7633
7641
  n(
7634
7642
  new Jr(
7635
7643
  `Unknown field "${g.length > 20 ? `${g.slice(0, 20)}…` : g}"`,
7636
- { type: "unknown-field", field: g, value: w, line: m }
7644
+ { type: "unknown-field", field: g, value: w, line: S }
7637
7645
  )
7638
7646
  );
7639
7647
  break;
@@ -7718,8 +7726,8 @@ function Ou(t) {
7718
7726
  const e = globalThis.DOMException;
7719
7727
  return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
7720
7728
  }
7721
- function Sn(t) {
7722
- return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(Sn).join(", ") : "cause" in t && t.cause instanceof Error ? `${t}: ${Sn(t.cause)}` : t.message : `${t}`;
7729
+ function vn(t) {
7730
+ return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(vn).join(", ") : "cause" in t && t.cause instanceof Error ? `${t}: ${vn(t.cause)}` : t.message : `${t}`;
7723
7731
  }
7724
7732
  function Zr(t) {
7725
7733
  return {
@@ -7733,19 +7741,19 @@ function Zr(t) {
7733
7741
  }
7734
7742
  var Ws = (t) => {
7735
7743
  throw TypeError(t);
7736
- }, zn = (t, e, n) => e.has(t) || Ws("Cannot " + n), k = (t, e, n) => (zn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), K = (t, e, n) => e.has(t) ? Ws("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), Y, Se, je, Et, Mt, rt, $e, st, ge, Re, Ue, xe, Ze, oe, vn, En, On, Xr, An, kn, Xe, Cn, Pn;
7737
- class Ot extends EventTarget {
7744
+ }, Vn = (t, e, n) => e.has(t) || Ws("Cannot " + n), k = (t, e, n) => (Vn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), K = (t, e, n) => e.has(t) ? Ws("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Vn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (Vn(t, e, "access private method"), n), Y, ve, Re, Ot, jt, rt, De, st, _e, xe, Le, $e, Ze, oe, En, On, An, Xr, kn, Cn, Xe, Pn, In;
7745
+ class At extends EventTarget {
7738
7746
  constructor(e, n) {
7739
7747
  var r, s;
7740
- super(), K(this, oe), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, K(this, Y), K(this, Se), K(this, je), K(this, Et), K(this, Mt), K(this, rt), K(this, $e), K(this, st, null), K(this, ge), K(this, Re), K(this, Ue, null), K(this, xe, null), K(this, Ze, null), K(this, En, async (i) => {
7748
+ super(), K(this, oe), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, K(this, Y), K(this, ve), K(this, Re), K(this, Ot), K(this, jt), K(this, rt), K(this, De), K(this, st, null), K(this, _e), K(this, xe), K(this, Le, null), K(this, $e, null), K(this, Ze, null), K(this, On, async (i) => {
7741
7749
  var o;
7742
- k(this, Re).reset();
7750
+ k(this, xe).reset();
7743
7751
  const { body: a, redirected: c, status: u, headers: l } = i;
7744
7752
  if (u === 204) {
7745
7753
  he(this, oe, Xe).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
7746
7754
  return;
7747
7755
  }
7748
- if (c ? $(this, je, new URL(i.url)) : $(this, je, void 0), u !== 200) {
7756
+ if (c ? $(this, Re, new URL(i.url)) : $(this, Re, void 0), u !== 200) {
7749
7757
  he(this, oe, Xe).call(this, `Non-200 status code (${u})`, u);
7750
7758
  return;
7751
7759
  }
@@ -7765,37 +7773,37 @@ class Ot extends EventTarget {
7765
7773
  let b = !0;
7766
7774
  do {
7767
7775
  const { done: g, value: w } = await y.read();
7768
- w && k(this, Re).feed(h.decode(w, { stream: !g })), g && (b = !1, k(this, Re).reset(), he(this, oe, Cn).call(this));
7776
+ w && k(this, xe).feed(h.decode(w, { stream: !g })), g && (b = !1, k(this, xe).reset(), he(this, oe, Pn).call(this));
7769
7777
  } while (b);
7770
- }), K(this, On, (i) => {
7771
- $(this, ge, void 0), !(i.name === "AbortError" || i.type === "aborted") && he(this, oe, Cn).call(this, Sn(i));
7772
7778
  }), K(this, An, (i) => {
7779
+ $(this, _e, void 0), !(i.name === "AbortError" || i.type === "aborted") && he(this, oe, Pn).call(this, vn(i));
7780
+ }), K(this, kn, (i) => {
7773
7781
  typeof i.id == "string" && $(this, st, i.id);
7774
7782
  const o = new MessageEvent(i.event || "message", {
7775
7783
  data: i.data,
7776
- origin: k(this, je) ? k(this, je).origin : k(this, Se).origin,
7784
+ origin: k(this, Re) ? k(this, Re).origin : k(this, ve).origin,
7777
7785
  lastEventId: i.id || ""
7778
7786
  });
7779
- k(this, xe) && (!i.event || i.event === "message") && k(this, xe).call(this, o), this.dispatchEvent(o);
7780
- }), K(this, kn, (i) => {
7787
+ k(this, $e) && (!i.event || i.event === "message") && k(this, $e).call(this, o), this.dispatchEvent(o);
7788
+ }), K(this, Cn, (i) => {
7781
7789
  $(this, rt, i);
7782
- }), K(this, Pn, () => {
7783
- $(this, $e, void 0), k(this, Y) === this.CONNECTING && he(this, oe, vn).call(this);
7790
+ }), K(this, In, () => {
7791
+ $(this, De, void 0), k(this, Y) === this.CONNECTING && he(this, oe, En).call(this);
7784
7792
  });
7785
7793
  try {
7786
7794
  if (e instanceof URL)
7787
- $(this, Se, e);
7795
+ $(this, ve, e);
7788
7796
  else if (typeof e == "string")
7789
- $(this, Se, new URL(e, Au()));
7797
+ $(this, ve, new URL(e, Au()));
7790
7798
  else
7791
7799
  throw new Error("Invalid URL");
7792
7800
  } catch {
7793
7801
  throw Ou("An invalid or illegal string was specified");
7794
7802
  }
7795
- $(this, Re, vu({
7796
- onEvent: k(this, An),
7797
- onRetry: k(this, kn)
7798
- })), $(this, Y, this.CONNECTING), $(this, rt, 3e3), $(this, Mt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, Et, (s = n == null ? void 0 : n.withCredentials) != null ? s : !1), he(this, oe, vn).call(this);
7803
+ $(this, xe, vu({
7804
+ onEvent: k(this, kn),
7805
+ onRetry: k(this, Cn)
7806
+ })), $(this, Y, this.CONNECTING), $(this, rt, 3e3), $(this, jt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, Ot, (s = n == null ? void 0 : n.withCredentials) != null ? s : !1), he(this, oe, En).call(this);
7799
7807
  }
7800
7808
  /**
7801
7809
  * Returns the state of this EventSource object's connection. It can have the values described below.
@@ -7818,7 +7826,7 @@ class Ot extends EventTarget {
7818
7826
  * @public
7819
7827
  */
7820
7828
  get url() {
7821
- return k(this, Se).href;
7829
+ return k(this, ve).href;
7822
7830
  }
7823
7831
  /**
7824
7832
  * Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
@@ -7826,21 +7834,21 @@ class Ot extends EventTarget {
7826
7834
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
7827
7835
  */
7828
7836
  get withCredentials() {
7829
- return k(this, Et);
7837
+ return k(this, Ot);
7830
7838
  }
7831
7839
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
7832
7840
  get onerror() {
7833
- return k(this, Ue);
7841
+ return k(this, Le);
7834
7842
  }
7835
7843
  set onerror(e) {
7836
- $(this, Ue, e);
7844
+ $(this, Le, e);
7837
7845
  }
7838
7846
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
7839
7847
  get onmessage() {
7840
- return k(this, xe);
7848
+ return k(this, $e);
7841
7849
  }
7842
7850
  set onmessage(e) {
7843
- $(this, xe, e);
7851
+ $(this, $e, e);
7844
7852
  }
7845
7853
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
7846
7854
  get onopen() {
@@ -7865,17 +7873,17 @@ class Ot extends EventTarget {
7865
7873
  * @public
7866
7874
  */
7867
7875
  close() {
7868
- k(this, $e) && clearTimeout(k(this, $e)), k(this, Y) !== this.CLOSED && (k(this, ge) && k(this, ge).abort(), $(this, Y, this.CLOSED), $(this, ge, void 0));
7876
+ k(this, De) && clearTimeout(k(this, De)), k(this, Y) !== this.CLOSED && (k(this, _e) && k(this, _e).abort(), $(this, Y, this.CLOSED), $(this, _e, void 0));
7869
7877
  }
7870
7878
  }
7871
- Y = /* @__PURE__ */ new WeakMap(), Se = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap(), Et = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), Ue = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), oe = /* @__PURE__ */ new WeakSet(), /**
7879
+ Y = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), Ot = /* @__PURE__ */ new WeakMap(), jt = /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), _e = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), Le = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), oe = /* @__PURE__ */ new WeakSet(), /**
7872
7880
  * Connect to the given URL and start receiving events
7873
7881
  *
7874
7882
  * @internal
7875
7883
  */
7876
- vn = function() {
7877
- $(this, Y, this.CONNECTING), $(this, ge, new AbortController()), k(this, Mt)(k(this, Se), he(this, oe, Xr).call(this)).then(k(this, En)).catch(k(this, On));
7878
- }, En = /* @__PURE__ */ new WeakMap(), On = /* @__PURE__ */ new WeakMap(), /**
7884
+ En = function() {
7885
+ $(this, Y, this.CONNECTING), $(this, _e, new AbortController()), k(this, jt)(k(this, ve), he(this, oe, Xr).call(this)).then(k(this, On)).catch(k(this, An));
7886
+ }, On = /* @__PURE__ */ new WeakMap(), An = /* @__PURE__ */ new WeakMap(), /**
7879
7887
  * Get request options for the `fetch()` request
7880
7888
  *
7881
7889
  * @returns The request options
@@ -7890,10 +7898,10 @@ Xr = function() {
7890
7898
  redirect: "follow",
7891
7899
  headers: { Accept: "text/event-stream", ...k(this, st) ? { "Last-Event-ID": k(this, st) } : void 0 },
7892
7900
  cache: "no-store",
7893
- signal: (t = k(this, ge)) == null ? void 0 : t.signal
7901
+ signal: (t = k(this, _e)) == null ? void 0 : t.signal
7894
7902
  };
7895
7903
  return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
7896
- }, An = /* @__PURE__ */ new WeakMap(), kn = /* @__PURE__ */ new WeakMap(), /**
7904
+ }, kn = /* @__PURE__ */ new WeakMap(), Cn = /* @__PURE__ */ new WeakMap(), /**
7897
7905
  * Handles the process referred to in the EventSource specification as "failing a connection".
7898
7906
  *
7899
7907
  * @param error - The error causing the connection to fail
@@ -7904,7 +7912,7 @@ Xe = function(t, e) {
7904
7912
  var n;
7905
7913
  k(this, Y) !== this.CLOSED && $(this, Y, this.CLOSED);
7906
7914
  const r = new Yr("error", { code: e, message: t });
7907
- (n = k(this, Ue)) == null || n.call(this, r), this.dispatchEvent(r);
7915
+ (n = k(this, Le)) == null || n.call(this, r), this.dispatchEvent(r);
7908
7916
  }, /**
7909
7917
  * Schedules a reconnection attempt against the EventSource endpoint.
7910
7918
  *
@@ -7912,43 +7920,43 @@ Xe = function(t, e) {
7912
7920
  * @param code - The HTTP status code, if available
7913
7921
  * @internal
7914
7922
  */
7915
- Cn = function(t, e) {
7923
+ Pn = function(t, e) {
7916
7924
  var n;
7917
7925
  if (k(this, Y) === this.CLOSED)
7918
7926
  return;
7919
7927
  $(this, Y, this.CONNECTING);
7920
7928
  const r = new Yr("error", { code: e, message: t });
7921
- (n = k(this, Ue)) == null || n.call(this, r), this.dispatchEvent(r), $(this, $e, setTimeout(k(this, Pn), k(this, rt)));
7922
- }, Pn = /* @__PURE__ */ new WeakMap(), /**
7929
+ (n = k(this, Le)) == null || n.call(this, r), this.dispatchEvent(r), $(this, De, setTimeout(k(this, In), k(this, rt)));
7930
+ }, In = /* @__PURE__ */ new WeakMap(), /**
7923
7931
  * ReadyState representing an EventSource currently trying to connect
7924
7932
  *
7925
7933
  * @public
7926
7934
  */
7927
- Ot.CONNECTING = 0, /**
7935
+ At.CONNECTING = 0, /**
7928
7936
  * ReadyState representing an EventSource connection that is open (eg connected)
7929
7937
  *
7930
7938
  * @public
7931
7939
  */
7932
- Ot.OPEN = 1, /**
7940
+ At.OPEN = 1, /**
7933
7941
  * ReadyState representing an EventSource connection that is closed (eg disconnected)
7934
7942
  *
7935
7943
  * @public
7936
7944
  */
7937
- Ot.CLOSED = 2;
7945
+ At.CLOSED = 2;
7938
7946
  function Au() {
7939
7947
  const t = "document" in globalThis ? globalThis.document : void 0;
7940
7948
  return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
7941
7949
  }
7942
- class zs extends vt {
7950
+ class zs extends Et {
7943
7951
  }
7944
- p(zs, "EventSourceImpl", Ot);
7952
+ p(zs, "EventSourceImpl", At);
7945
7953
  function ku(t) {
7946
7954
  const e = {
7947
7955
  ...t,
7948
7956
  useDateObjects: t.useDateObjects ?? !1
7949
7957
  };
7950
7958
  return new zs(e, {
7951
- "@instantdb/react": Wn
7959
+ "@instantdb/react": zn
7952
7960
  });
7953
7961
  }
7954
7962
  const Du = ku;
@@ -7967,22 +7975,22 @@ function Uu({
7967
7975
  const l = e || `cursors-space-default--${String(n.type)}-${n.id}`, f = n.usePresence({
7968
7976
  keys: [l]
7969
7977
  }), h = n._core._reactor.getPresence(n.type, n.id);
7970
- function y(_, S) {
7971
- const O = S.clientX, E = S.clientY, j = (O - _.left) / _.width * 100, L = (E - _.top) / _.height * 100;
7978
+ function y(_, m) {
7979
+ const A = m.clientX, E = m.clientY, j = (A - _.left) / _.width * 100, N = (E - _.top) / _.height * 100;
7972
7980
  f.publishPresence({
7973
7981
  [l]: {
7974
- x: O,
7982
+ x: A,
7975
7983
  y: E,
7976
7984
  xPercent: j,
7977
- yPercent: L,
7985
+ yPercent: N,
7978
7986
  color: i
7979
7987
  }
7980
7988
  });
7981
7989
  }
7982
7990
  function b(_) {
7983
7991
  c || _.stopPropagation();
7984
- const S = _.currentTarget.getBoundingClientRect();
7985
- y(S, _);
7992
+ const m = _.currentTarget.getBoundingClientRect();
7993
+ y(m, _);
7986
7994
  }
7987
7995
  function g(_) {
7988
7996
  f.publishPresence({
@@ -7992,14 +8000,14 @@ function Uu({
7992
8000
  function w(_) {
7993
8001
  if (_.touches.length !== 1)
7994
8002
  return;
7995
- const S = _.touches[0];
7996
- if (S.target instanceof Element) {
8003
+ const m = _.touches[0];
8004
+ if (m.target instanceof Element) {
7997
8005
  c || _.stopPropagation();
7998
- const O = S.target.getBoundingClientRect();
7999
- y(O, S);
8006
+ const A = m.target.getBoundingClientRect();
8007
+ y(A, m);
8000
8008
  }
8001
8009
  }
8002
- function m(_) {
8010
+ function S(_) {
8003
8011
  f.publishPresence({
8004
8012
  [l]: void 0
8005
8013
  });
@@ -8010,7 +8018,7 @@ function Uu({
8010
8018
  onMouseMove: b,
8011
8019
  onMouseOut: g,
8012
8020
  onTouchMove: w,
8013
- onTouchEnd: m,
8021
+ onTouchEnd: S,
8014
8022
  className: r,
8015
8023
  style: {
8016
8024
  position: "relative",
@@ -8027,21 +8035,21 @@ function Uu({
8027
8035
  ...Pu,
8028
8036
  zIndex: u !== void 0 ? u : Iu
8029
8037
  },
8030
- children: Object.entries(f.peers).map(([_, S]) => {
8031
- const O = S[l];
8032
- return O ? /* @__PURE__ */ V.jsx(
8038
+ children: Object.entries(f.peers).map(([_, m]) => {
8039
+ const A = m[l];
8040
+ return A ? /* @__PURE__ */ V.jsx(
8033
8041
  "div",
8034
8042
  {
8035
8043
  style: {
8036
8044
  ...es,
8037
- transform: `translate(${O.xPercent}%, ${O.yPercent}%)`,
8045
+ transform: `translate(${A.xPercent}%, ${A.yPercent}%)`,
8038
8046
  transformOrigin: "0 0",
8039
8047
  transition: "transform 100ms"
8040
8048
  },
8041
8049
  children: a ? a({
8042
- color: O.color,
8050
+ color: A.color,
8043
8051
  presence: h == null ? void 0 : h.peers[_]
8044
- }) : /* @__PURE__ */ V.jsx(Cu, { ...O })
8052
+ }) : /* @__PURE__ */ V.jsx(Cu, { ...A })
8045
8053
  },
8046
8054
  _
8047
8055
  ) : null;
@@ -8112,11 +8120,11 @@ const es = {
8112
8120
  }, Iu = 99999;
8113
8121
  export {
8114
8122
  Uu as Cursors,
8115
- xt as InstantAPIError,
8116
- vt as InstantReactAbstractDatabase,
8123
+ $t as InstantAPIError,
8124
+ Et as InstantReactAbstractDatabase,
8117
8125
  zs as InstantReactWebDatabase,
8118
8126
  Fa as StoreInterface,
8119
- Te as SyncTableCallbackEventType,
8127
+ me as SyncTableCallbackEventType,
8120
8128
  $u as createInstantRouteHandler,
8121
8129
  xu as i,
8122
8130
  W as id,