@instantdb/react-common 1.0.2 → 1.0.3-branch-idb-fix.24363677444.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,54 +41,54 @@ function Bs() {
41
41
  * LICENSE file in the root directory of this source tree.
42
42
  */
43
43
  return n.NODE_ENV !== "production" && function() {
44
- var e = kr, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, w = "@@iterator";
44
+ var e = kr, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), _ = Symbol.iterator, T = "@@iterator";
45
45
  function S(d) {
46
46
  if (d === null || typeof d != "object")
47
47
  return null;
48
- var m = g && d[g] || d[w];
49
- return typeof m == "function" ? m : null;
48
+ var w = _ && d[_] || d[T];
49
+ return typeof w == "function" ? w : null;
50
50
  }
51
- var _ = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
52
- function T(d) {
51
+ var g = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
52
+ function m(d) {
53
53
  {
54
- for (var m = arguments.length, v = new Array(m > 1 ? m - 1 : 0), I = 1; I < m; I++)
55
- v[I - 1] = arguments[I];
56
- M("error", d, v);
54
+ for (var w = arguments.length, A = new Array(w > 1 ? w - 1 : 0), C = 1; C < w; C++)
55
+ A[C - 1] = arguments[C];
56
+ P("error", d, A);
57
57
  }
58
58
  }
59
- function M(d, m, v) {
59
+ function P(d, w, A) {
60
60
  {
61
- var I = _.ReactDebugCurrentFrame, W = I.getStackAddendum();
62
- W !== "" && (m += "%s", v = v.concat([W]));
63
- var V = v.map(function(D) {
61
+ var C = g.ReactDebugCurrentFrame, L = C.getStackAddendum();
62
+ L !== "" && (w += "%s", A = A.concat([L]));
63
+ var N = A.map(function(D) {
64
64
  return String(D);
65
65
  });
66
- V.unshift("Warning: " + m), Function.prototype.apply.call(console[d], console, V);
66
+ N.unshift("Warning: " + w), Function.prototype.apply.call(console[d], console, N);
67
67
  }
68
68
  }
69
- var O = !1, F = !1, P = !1, C = !1, G = !1, N;
70
- N = Symbol.for("react.module.reference");
71
- function B(d) {
72
- return !!(typeof d == "string" || typeof d == "function" || d === s || d === o || G || d === i || d === l || d === f || C || d === b || O || F || P || 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
69
+ var v = !1, I = !1, x = !1, F = !1, V = !1, fe;
70
+ fe = Symbol.for("react.module.reference");
71
+ function we(d) {
72
+ return !!(typeof d == "string" || typeof d == "function" || d === s || d === o || V || d === i || d === l || d === f || F || d === b || v || I || x || 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
73
73
  // types supported by any Flight configuration anywhere since
74
74
  // we don't know which Flight build this will end up being used
75
75
  // with.
76
- d.$$typeof === N || d.getModuleId !== void 0));
76
+ d.$$typeof === fe || d.getModuleId !== void 0));
77
77
  }
78
- function z(d, m, v) {
79
- var I = d.displayName;
80
- if (I)
81
- return I;
82
- var W = m.displayName || m.name || "";
83
- return W !== "" ? v + "(" + W + ")" : v;
78
+ function ee(d, w, A) {
79
+ var C = d.displayName;
80
+ if (C)
81
+ return C;
82
+ var L = w.displayName || w.name || "";
83
+ return L !== "" ? A + "(" + L + ")" : A;
84
84
  }
85
- function ee(d) {
85
+ function te(d) {
86
86
  return d.displayName || "Context";
87
87
  }
88
- function q(d) {
88
+ function Q(d) {
89
89
  if (d == null)
90
90
  return null;
91
- if (typeof d.tag == "number" && T("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof d == "function")
91
+ 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")
92
92
  return d.displayName || d.name || null;
93
93
  if (typeof d == "string")
94
94
  return d;
@@ -109,20 +109,20 @@ function Bs() {
109
109
  if (typeof d == "object")
110
110
  switch (d.$$typeof) {
111
111
  case c:
112
- var m = d;
113
- return ee(m) + ".Consumer";
112
+ var w = d;
113
+ return te(w) + ".Consumer";
114
114
  case a:
115
- var v = d;
116
- return ee(v._context) + ".Provider";
115
+ var A = d;
116
+ return te(A._context) + ".Provider";
117
117
  case u:
118
- return z(d, d.render, "ForwardRef");
118
+ return ee(d, d.render, "ForwardRef");
119
119
  case h:
120
- var I = d.displayName || null;
121
- return I !== null ? I : q(d.type) || "Memo";
120
+ var C = d.displayName || null;
121
+ return C !== null ? C : Q(d.type) || "Memo";
122
122
  case y: {
123
- var W = d, V = W._payload, D = W._init;
123
+ var L = d, N = L._payload, D = L._init;
124
124
  try {
125
- return q(D(V));
125
+ return Q(D(N));
126
126
  } catch {
127
127
  return null;
128
128
  }
@@ -130,18 +130,18 @@ function Bs() {
130
130
  }
131
131
  return null;
132
132
  }
133
- var E = Object.assign, j = 0, R, U, L, A, k, K, H;
134
- function Y() {
133
+ var E = Object.assign, R = 0, M, q, W, O, k, U, z;
134
+ function G() {
135
135
  }
136
- Y.__reactDisabledLog = !0;
137
- function oe() {
136
+ G.__reactDisabledLog = !0;
137
+ function re() {
138
138
  {
139
- if (j === 0) {
140
- R = console.log, U = console.info, L = console.warn, A = console.error, k = console.group, K = console.groupCollapsed, H = console.groupEnd;
139
+ if (R === 0) {
140
+ M = console.log, q = console.info, W = console.warn, O = console.error, k = console.group, U = console.groupCollapsed, z = console.groupEnd;
141
141
  var d = {
142
142
  configurable: !0,
143
143
  enumerable: !0,
144
- value: Y,
144
+ value: G,
145
145
  writable: !0
146
146
  };
147
147
  Object.defineProperties(console, {
@@ -154,12 +154,12 @@ function Bs() {
154
154
  groupEnd: d
155
155
  });
156
156
  }
157
- j++;
157
+ R++;
158
158
  }
159
159
  }
160
160
  function Be() {
161
161
  {
162
- if (j--, j === 0) {
162
+ if (R--, R === 0) {
163
163
  var d = {
164
164
  configurable: !0,
165
165
  enumerable: !0,
@@ -167,66 +167,66 @@ function Bs() {
167
167
  };
168
168
  Object.defineProperties(console, {
169
169
  log: E({}, d, {
170
- value: R
170
+ value: M
171
171
  }),
172
172
  info: E({}, d, {
173
- value: U
173
+ value: q
174
174
  }),
175
175
  warn: E({}, d, {
176
- value: L
176
+ value: W
177
177
  }),
178
178
  error: E({}, d, {
179
- value: A
179
+ value: O
180
180
  }),
181
181
  group: E({}, d, {
182
182
  value: k
183
183
  }),
184
184
  groupCollapsed: E({}, d, {
185
- value: K
185
+ value: U
186
186
  }),
187
187
  groupEnd: E({}, d, {
188
- value: H
188
+ value: z
189
189
  })
190
190
  });
191
191
  }
192
- j < 0 && T("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
192
+ R < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
193
193
  }
194
194
  }
195
- var ge = _.ReactCurrentDispatcher, Mt;
196
- function ct(d, m, v) {
195
+ var be = g.ReactCurrentDispatcher, Rt;
196
+ function ct(d, w, A) {
197
197
  {
198
- if (Mt === void 0)
198
+ if (Rt === void 0)
199
199
  try {
200
200
  throw Error();
201
- } catch (W) {
202
- var I = W.stack.trim().match(/\n( *(at )?)/);
203
- Mt = I && I[1] || "";
201
+ } catch (L) {
202
+ var C = L.stack.trim().match(/\n( *(at )?)/);
203
+ Rt = C && C[1] || "";
204
204
  }
205
205
  return `
206
- ` + Mt + d;
206
+ ` + Rt + d;
207
207
  }
208
208
  }
209
- var Rt = !1, ut;
209
+ var Mt = !1, ut;
210
210
  {
211
211
  var ms = typeof WeakMap == "function" ? WeakMap : Map;
212
212
  ut = new ms();
213
213
  }
214
- function kn(d, m) {
215
- if (!d || Rt)
214
+ function kn(d, w) {
215
+ if (!d || Mt)
216
216
  return "";
217
217
  {
218
- var v = ut.get(d);
219
- if (v !== void 0)
220
- return v;
218
+ var A = ut.get(d);
219
+ if (A !== void 0)
220
+ return A;
221
221
  }
222
- var I;
223
- Rt = !0;
224
- var W = Error.prepareStackTrace;
222
+ var C;
223
+ Mt = !0;
224
+ var L = Error.prepareStackTrace;
225
225
  Error.prepareStackTrace = void 0;
226
- var V;
227
- V = ge.current, ge.current = null, oe();
226
+ var N;
227
+ N = be.current, be.current = null, re();
228
228
  try {
229
- if (m) {
229
+ if (w) {
230
230
  var D = function() {
231
231
  throw Error();
232
232
  };
@@ -237,59 +237,59 @@ function Bs() {
237
237
  }), typeof Reflect == "object" && Reflect.construct) {
238
238
  try {
239
239
  Reflect.construct(D, []);
240
- } catch (ue) {
241
- I = ue;
240
+ } catch (ae) {
241
+ C = ae;
242
242
  }
243
243
  Reflect.construct(d, [], D);
244
244
  } else {
245
245
  try {
246
246
  D.call();
247
- } catch (ue) {
248
- I = ue;
247
+ } catch (ae) {
248
+ C = ae;
249
249
  }
250
250
  d.call(D.prototype);
251
251
  }
252
252
  } else {
253
253
  try {
254
254
  throw Error();
255
- } catch (ue) {
256
- I = ue;
255
+ } catch (ae) {
256
+ C = ae;
257
257
  }
258
258
  d();
259
259
  }
260
- } catch (ue) {
261
- if (ue && I && typeof ue.stack == "string") {
262
- for (var $ = ue.stack.split(`
263
- `), ae = I.stack.split(`
264
- `), Z = $.length - 1, te = ae.length - 1; Z >= 1 && te >= 0 && $[Z] !== ae[te]; )
265
- te--;
266
- for (; Z >= 1 && te >= 0; Z--, te--)
267
- if ($[Z] !== ae[te]) {
268
- if (Z !== 1 || te !== 1)
260
+ } catch (ae) {
261
+ if (ae && C && typeof ae.stack == "string") {
262
+ for (var j = ae.stack.split(`
263
+ `), se = C.stack.split(`
264
+ `), H = j.length - 1, Y = se.length - 1; H >= 1 && Y >= 0 && j[H] !== se[Y]; )
265
+ Y--;
266
+ for (; H >= 1 && Y >= 0; H--, Y--)
267
+ if (j[H] !== se[Y]) {
268
+ if (H !== 1 || Y !== 1)
269
269
  do
270
- if (Z--, te--, te < 0 || $[Z] !== ae[te]) {
271
- var ye = `
272
- ` + $[Z].replace(" at new ", " at ");
273
- return d.displayName && ye.includes("<anonymous>") && (ye = ye.replace("<anonymous>", d.displayName)), typeof d == "function" && ut.set(d, ye), ye;
270
+ if (H--, Y--, Y < 0 || j[H] !== se[Y]) {
271
+ var pe = `
272
+ ` + j[H].replace(" at new ", " at ");
273
+ return d.displayName && pe.includes("<anonymous>") && (pe = pe.replace("<anonymous>", d.displayName)), typeof d == "function" && ut.set(d, pe), pe;
274
274
  }
275
- while (Z >= 1 && te >= 0);
275
+ while (H >= 1 && Y >= 0);
276
276
  break;
277
277
  }
278
278
  }
279
279
  } finally {
280
- Rt = !1, ge.current = V, Be(), Error.prepareStackTrace = W;
280
+ Mt = !1, be.current = N, Be(), Error.prepareStackTrace = L;
281
281
  }
282
282
  var Le = d ? d.displayName || d.name : "", Ce = Le ? ct(Le) : "";
283
283
  return typeof d == "function" && ut.set(d, Ce), Ce;
284
284
  }
285
- function ws(d, m, v) {
285
+ function ws(d, w, A) {
286
286
  return kn(d, !1);
287
287
  }
288
288
  function Ts(d) {
289
- var m = d.prototype;
290
- return !!(m && m.isReactComponent);
289
+ var w = d.prototype;
290
+ return !!(w && w.isReactComponent);
291
291
  }
292
- function lt(d, m, v) {
292
+ function lt(d, w, A) {
293
293
  if (d == null)
294
294
  return "";
295
295
  if (typeof d == "function")
@@ -307,41 +307,41 @@ function Bs() {
307
307
  case u:
308
308
  return ws(d.render);
309
309
  case h:
310
- return lt(d.type, m, v);
310
+ return lt(d.type, w, A);
311
311
  case y: {
312
- var I = d, W = I._payload, V = I._init;
312
+ var C = d, L = C._payload, N = C._init;
313
313
  try {
314
- return lt(V(W), m, v);
314
+ return lt(N(L), w, A);
315
315
  } catch {
316
316
  }
317
317
  }
318
318
  }
319
319
  return "";
320
320
  }
321
- var Ge = Object.prototype.hasOwnProperty, Cn = {}, In = _.ReactDebugCurrentFrame;
321
+ var Ge = Object.prototype.hasOwnProperty, Cn = {}, In = g.ReactDebugCurrentFrame;
322
322
  function ft(d) {
323
323
  if (d) {
324
- var m = d._owner, v = lt(d.type, d._source, m ? m.type : null);
325
- In.setExtraStackFrame(v);
324
+ var w = d._owner, A = lt(d.type, d._source, w ? w.type : null);
325
+ In.setExtraStackFrame(A);
326
326
  } else
327
327
  In.setExtraStackFrame(null);
328
328
  }
329
- function Ss(d, m, v, I, W) {
329
+ function Ss(d, w, A, C, L) {
330
330
  {
331
- var V = Function.call.bind(Ge);
331
+ var N = Function.call.bind(Ge);
332
332
  for (var D in d)
333
- if (V(d, D)) {
334
- var $ = void 0;
333
+ if (N(d, D)) {
334
+ var j = void 0;
335
335
  try {
336
336
  if (typeof d[D] != "function") {
337
- var ae = Error((I || "React class") + ": " + v + " type `" + D + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof d[D] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
338
- throw ae.name = "Invariant Violation", ae;
337
+ var se = Error((C || "React class") + ": " + A + " type `" + D + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof d[D] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
338
+ throw se.name = "Invariant Violation", se;
339
339
  }
340
- $ = d[D](m, D, I, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
341
- } catch (Z) {
342
- $ = Z;
340
+ j = d[D](w, D, C, A, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
341
+ } catch (H) {
342
+ j = H;
343
343
  }
344
- $ && !($ instanceof Error) && (ft(W), T("%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).", I || "React class", v, D, typeof $), ft(null)), $ instanceof Error && !($.message in Cn) && (Cn[$.message] = !0, ft(W), T("Failed %s type: %s", v, $.message), ft(null));
344
+ j && !(j instanceof Error) && (ft(L), 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).", C || "React class", A, D, typeof j), ft(null)), j instanceof Error && !(j.message in Cn) && (Cn[j.message] = !0, ft(L), m("Failed %s type: %s", A, j.message), ft(null));
345
345
  }
346
346
  }
347
347
  }
@@ -351,8 +351,8 @@ function Bs() {
351
351
  }
352
352
  function As(d) {
353
353
  {
354
- var m = typeof Symbol == "function" && Symbol.toStringTag, v = m && d[Symbol.toStringTag] || d.constructor.name || "Object";
355
- return v;
354
+ var w = typeof Symbol == "function" && Symbol.toStringTag, A = w && d[Symbol.toStringTag] || d.constructor.name || "Object";
355
+ return A;
356
356
  }
357
357
  }
358
358
  function Os(d) {
@@ -365,11 +365,11 @@ function Bs() {
365
365
  function Pn(d) {
366
366
  return "" + d;
367
367
  }
368
- function Mn(d) {
368
+ function Rn(d) {
369
369
  if (Os(d))
370
- return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", As(d)), Pn(d);
370
+ return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", As(d)), Pn(d);
371
371
  }
372
- var Rn = _.ReactCurrentOwner, Es = {
372
+ var Mn = g.ReactCurrentOwner, Es = {
373
373
  key: !0,
374
374
  ref: !0,
375
375
  __self: !0,
@@ -377,97 +377,97 @@ function Bs() {
377
377
  }, jn, $n;
378
378
  function ks(d) {
379
379
  if (Ge.call(d, "ref")) {
380
- var m = Object.getOwnPropertyDescriptor(d, "ref").get;
381
- if (m && m.isReactWarning)
380
+ var w = Object.getOwnPropertyDescriptor(d, "ref").get;
381
+ if (w && w.isReactWarning)
382
382
  return !1;
383
383
  }
384
384
  return d.ref !== void 0;
385
385
  }
386
386
  function Cs(d) {
387
387
  if (Ge.call(d, "key")) {
388
- var m = Object.getOwnPropertyDescriptor(d, "key").get;
389
- if (m && m.isReactWarning)
388
+ var w = Object.getOwnPropertyDescriptor(d, "key").get;
389
+ if (w && w.isReactWarning)
390
390
  return !1;
391
391
  }
392
392
  return d.key !== void 0;
393
393
  }
394
- function Is(d, m) {
395
- typeof d.ref == "string" && Rn.current;
394
+ function Is(d, w) {
395
+ typeof d.ref == "string" && Mn.current;
396
396
  }
397
- function Ps(d, m) {
397
+ function Ps(d, w) {
398
398
  {
399
- var v = function() {
400
- jn || (jn = !0, T("%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)", m));
399
+ var A = function() {
400
+ jn || (jn = !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)", w));
401
401
  };
402
- v.isReactWarning = !0, Object.defineProperty(d, "key", {
403
- get: v,
402
+ A.isReactWarning = !0, Object.defineProperty(d, "key", {
403
+ get: A,
404
404
  configurable: !0
405
405
  });
406
406
  }
407
407
  }
408
- function Ms(d, m) {
408
+ function Rs(d, w) {
409
409
  {
410
- var v = function() {
411
- $n || ($n = !0, T("%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)", m));
410
+ var A = function() {
411
+ $n || ($n = !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)", w));
412
412
  };
413
- v.isReactWarning = !0, Object.defineProperty(d, "ref", {
414
- get: v,
413
+ A.isReactWarning = !0, Object.defineProperty(d, "ref", {
414
+ get: A,
415
415
  configurable: !0
416
416
  });
417
417
  }
418
418
  }
419
- var Rs = function(d, m, v, I, W, V, D) {
420
- var $ = {
419
+ var Ms = function(d, w, A, C, L, N, D) {
420
+ var j = {
421
421
  // This tag allows us to uniquely identify this as a React Element
422
422
  $$typeof: t,
423
423
  // Built-in properties that belong on the element
424
424
  type: d,
425
- key: m,
426
- ref: v,
425
+ key: w,
426
+ ref: A,
427
427
  props: D,
428
428
  // Record the component responsible for creating this element.
429
- _owner: V
429
+ _owner: N
430
430
  };
431
- return $._store = {}, Object.defineProperty($._store, "validated", {
431
+ return j._store = {}, Object.defineProperty(j._store, "validated", {
432
432
  configurable: !1,
433
433
  enumerable: !1,
434
434
  writable: !0,
435
435
  value: !1
436
- }), Object.defineProperty($, "_self", {
436
+ }), Object.defineProperty(j, "_self", {
437
437
  configurable: !1,
438
438
  enumerable: !1,
439
439
  writable: !1,
440
- value: I
441
- }), Object.defineProperty($, "_source", {
440
+ value: C
441
+ }), Object.defineProperty(j, "_source", {
442
442
  configurable: !1,
443
443
  enumerable: !1,
444
444
  writable: !1,
445
- value: W
446
- }), Object.freeze && (Object.freeze($.props), Object.freeze($)), $;
445
+ value: L
446
+ }), Object.freeze && (Object.freeze(j.props), Object.freeze(j)), j;
447
447
  };
448
- function js(d, m, v, I, W) {
448
+ function js(d, w, A, C, L) {
449
449
  {
450
- var V, D = {}, $ = null, ae = null;
451
- v !== void 0 && (Mn(v), $ = "" + v), Cs(m) && (Mn(m.key), $ = "" + m.key), ks(m) && (ae = m.ref, Is(m, W));
452
- for (V in m)
453
- Ge.call(m, V) && !Es.hasOwnProperty(V) && (D[V] = m[V]);
450
+ var N, D = {}, j = null, se = null;
451
+ A !== void 0 && (Rn(A), j = "" + A), Cs(w) && (Rn(w.key), j = "" + w.key), ks(w) && (se = w.ref, Is(w, L));
452
+ for (N in w)
453
+ Ge.call(w, N) && !Es.hasOwnProperty(N) && (D[N] = w[N]);
454
454
  if (d && d.defaultProps) {
455
- var Z = d.defaultProps;
456
- for (V in Z)
457
- D[V] === void 0 && (D[V] = Z[V]);
455
+ var H = d.defaultProps;
456
+ for (N in H)
457
+ D[N] === void 0 && (D[N] = H[N]);
458
458
  }
459
- if ($ || ae) {
460
- var te = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
461
- $ && Ps(D, te), ae && Ms(D, te);
459
+ if (j || se) {
460
+ var Y = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
461
+ j && Ps(D, Y), se && Rs(D, Y);
462
462
  }
463
- return Rs(d, $, ae, W, I, Rn.current, D);
463
+ return Ms(d, j, se, L, C, Mn.current, D);
464
464
  }
465
465
  }
466
- var $t = _.ReactCurrentOwner, xn = _.ReactDebugCurrentFrame;
466
+ var $t = g.ReactCurrentOwner, xn = g.ReactDebugCurrentFrame;
467
467
  function Ue(d) {
468
468
  if (d) {
469
- var m = d._owner, v = lt(d.type, d._source, m ? m.type : null);
470
- xn.setExtraStackFrame(v);
469
+ var w = d._owner, A = lt(d.type, d._source, w ? w.type : null);
470
+ xn.setExtraStackFrame(A);
471
471
  } else
472
472
  xn.setExtraStackFrame(null);
473
473
  }
@@ -479,7 +479,7 @@ function Bs() {
479
479
  function Dn() {
480
480
  {
481
481
  if ($t.current) {
482
- var d = q($t.current.type);
482
+ var d = Q($t.current.type);
483
483
  if (d)
484
484
  return `
485
485
 
@@ -494,120 +494,120 @@ Check the render method of \`` + d + "`.";
494
494
  var Un = {};
495
495
  function xs(d) {
496
496
  {
497
- var m = Dn();
498
- if (!m) {
499
- var v = typeof d == "string" ? d : d.displayName || d.name;
500
- v && (m = `
497
+ var w = Dn();
498
+ if (!w) {
499
+ var A = typeof d == "string" ? d : d.displayName || d.name;
500
+ A && (w = `
501
501
 
502
- Check the top-level render call using <` + v + ">.");
502
+ Check the top-level render call using <` + A + ">.");
503
503
  }
504
- return m;
504
+ return w;
505
505
  }
506
506
  }
507
- function Ln(d, m) {
507
+ function Ln(d, w) {
508
508
  {
509
509
  if (!d._store || d._store.validated || d.key != null)
510
510
  return;
511
511
  d._store.validated = !0;
512
- var v = xs(m);
513
- if (Un[v])
512
+ var A = xs(w);
513
+ if (Un[A])
514
514
  return;
515
- Un[v] = !0;
516
- var I = "";
517
- d && d._owner && d._owner !== $t.current && (I = " It was passed a child from " + q(d._owner.type) + "."), Ue(d), T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', v, I), Ue(null);
515
+ Un[A] = !0;
516
+ var C = "";
517
+ d && d._owner && d._owner !== $t.current && (C = " It was passed a child from " + Q(d._owner.type) + "."), Ue(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.', A, C), Ue(null);
518
518
  }
519
519
  }
520
- function Fn(d, m) {
520
+ function Fn(d, w) {
521
521
  {
522
522
  if (typeof d != "object")
523
523
  return;
524
524
  if (jt(d))
525
- for (var v = 0; v < d.length; v++) {
526
- var I = d[v];
527
- Dt(I) && Ln(I, m);
525
+ for (var A = 0; A < d.length; A++) {
526
+ var C = d[A];
527
+ Dt(C) && Ln(C, w);
528
528
  }
529
529
  else if (Dt(d))
530
530
  d._store && (d._store.validated = !0);
531
531
  else if (d) {
532
- var W = S(d);
533
- if (typeof W == "function" && W !== d.entries)
534
- for (var V = W.call(d), D; !(D = V.next()).done; )
535
- Dt(D.value) && Ln(D.value, m);
532
+ var L = S(d);
533
+ if (typeof L == "function" && L !== d.entries)
534
+ for (var N = L.call(d), D; !(D = N.next()).done; )
535
+ Dt(D.value) && Ln(D.value, w);
536
536
  }
537
537
  }
538
538
  }
539
539
  function Ds(d) {
540
540
  {
541
- var m = d.type;
542
- if (m == null || typeof m == "string")
541
+ var w = d.type;
542
+ if (w == null || typeof w == "string")
543
543
  return;
544
- var v;
545
- if (typeof m == "function")
546
- v = m.propTypes;
547
- else if (typeof m == "object" && (m.$$typeof === u || // Note: Memo only checks outer props here.
544
+ var A;
545
+ if (typeof w == "function")
546
+ A = w.propTypes;
547
+ else if (typeof w == "object" && (w.$$typeof === u || // Note: Memo only checks outer props here.
548
548
  // Inner props are checked in the reconciler.
549
- m.$$typeof === h))
550
- v = m.propTypes;
549
+ w.$$typeof === h))
550
+ A = w.propTypes;
551
551
  else
552
552
  return;
553
- if (v) {
554
- var I = q(m);
555
- Ss(v, d.props, "prop", I, d);
556
- } else if (m.PropTypes !== void 0 && !xt) {
553
+ if (A) {
554
+ var C = Q(w);
555
+ Ss(A, d.props, "prop", C, d);
556
+ } else if (w.PropTypes !== void 0 && !xt) {
557
557
  xt = !0;
558
- var W = q(m);
559
- T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", W || "Unknown");
558
+ var L = Q(w);
559
+ m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", L || "Unknown");
560
560
  }
561
- typeof m.getDefaultProps == "function" && !m.getDefaultProps.isReactClassApproved && T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
561
+ typeof w.getDefaultProps == "function" && !w.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
562
562
  }
563
563
  }
564
564
  function Us(d) {
565
565
  {
566
- for (var m = Object.keys(d.props), v = 0; v < m.length; v++) {
567
- var I = m[v];
568
- if (I !== "children" && I !== "key") {
569
- Ue(d), T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", I), Ue(null);
566
+ for (var w = Object.keys(d.props), A = 0; A < w.length; A++) {
567
+ var C = w[A];
568
+ if (C !== "children" && C !== "key") {
569
+ Ue(d), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", C), Ue(null);
570
570
  break;
571
571
  }
572
572
  }
573
- d.ref !== null && (Ue(d), T("Invalid attribute `ref` supplied to `React.Fragment`."), Ue(null));
573
+ d.ref !== null && (Ue(d), m("Invalid attribute `ref` supplied to `React.Fragment`."), Ue(null));
574
574
  }
575
575
  }
576
576
  var Nn = {};
577
- function Kn(d, m, v, I, W, V) {
577
+ function Kn(d, w, A, C, L, N) {
578
578
  {
579
- var D = B(d);
579
+ var D = we(d);
580
580
  if (!D) {
581
- var $ = "";
582
- (d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && ($ += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
583
- var ae = $s();
584
- ae ? $ += ae : $ += Dn();
585
- var Z;
586
- d === null ? Z = "null" : jt(d) ? Z = "array" : d !== void 0 && d.$$typeof === t ? (Z = "<" + (q(d.type) || "Unknown") + " />", $ = " Did you accidentally export a JSX literal instead of a component?") : Z = typeof d, T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Z, $);
581
+ var j = "";
582
+ (d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && (j += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
583
+ var se = $s();
584
+ se ? j += se : j += Dn();
585
+ var H;
586
+ d === null ? H = "null" : jt(d) ? H = "array" : d !== void 0 && d.$$typeof === t ? (H = "<" + (Q(d.type) || "Unknown") + " />", j = " Did you accidentally export a JSX literal instead of a component?") : H = 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", H, j);
587
587
  }
588
- var te = js(d, m, v, W, V);
589
- if (te == null)
590
- return te;
588
+ var Y = js(d, w, A, L, N);
589
+ if (Y == null)
590
+ return Y;
591
591
  if (D) {
592
- var ye = m.children;
593
- if (ye !== void 0)
594
- if (I)
595
- if (jt(ye)) {
596
- for (var Le = 0; Le < ye.length; Le++)
597
- Fn(ye[Le], d);
598
- Object.freeze && Object.freeze(ye);
592
+ var pe = w.children;
593
+ if (pe !== void 0)
594
+ if (C)
595
+ if (jt(pe)) {
596
+ for (var Le = 0; Le < pe.length; Le++)
597
+ Fn(pe[Le], d);
598
+ Object.freeze && Object.freeze(pe);
599
599
  } else
600
- T("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
600
+ 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.");
601
601
  else
602
- Fn(ye, d);
602
+ Fn(pe, d);
603
603
  }
604
- if (Ge.call(m, "key")) {
605
- var Ce = q(d), ue = Object.keys(m).filter(function(Ws) {
604
+ if (Ge.call(w, "key")) {
605
+ var Ce = Q(d), ae = Object.keys(w).filter(function(Ws) {
606
606
  return Ws !== "key";
607
- }), Ut = ue.length > 0 ? "{key: someKey, " + ue.join(": ..., ") + ": ...}" : "{key: someKey}";
607
+ }), Ut = ae.length > 0 ? "{key: someKey, " + ae.join(": ..., ") + ": ...}" : "{key: someKey}";
608
608
  if (!Nn[Ce + Ut]) {
609
- var qs = ue.length > 0 ? "{" + ue.join(": ..., ") + ": ...}" : "{}";
610
- T(`A props object containing a "key" prop is being spread into JSX:
609
+ var qs = ae.length > 0 ? "{" + ae.join(": ..., ") + ": ...}" : "{}";
610
+ m(`A props object containing a "key" prop is being spread into JSX:
611
611
  let props = %s;
612
612
  <%s {...props} />
613
613
  React keys must be passed directly to JSX without using spread:
@@ -615,14 +615,14 @@ React keys must be passed directly to JSX without using spread:
615
615
  <%s key={someKey} {...props} />`, Ut, Ce, qs, Ce), Nn[Ce + Ut] = !0;
616
616
  }
617
617
  }
618
- return d === s ? Us(te) : Ds(te), te;
618
+ return d === s ? Us(Y) : Ds(Y), Y;
619
619
  }
620
620
  }
621
- function Ls(d, m, v) {
622
- return Kn(d, m, v, !0);
621
+ function Ls(d, w, A) {
622
+ return Kn(d, w, A, !0);
623
623
  }
624
- function Fs(d, m, v) {
625
- return Kn(d, m, v, !1);
624
+ function Fs(d, w, A) {
625
+ return Kn(d, w, A, !1);
626
626
  }
627
627
  var Ns = Fs, Ks = Ls;
628
628
  Je.Fragment = s, Je.jsx = Ns, Je.jsxs = Ks;
@@ -631,7 +631,7 @@ React keys must be passed directly to JSX without using spread:
631
631
  var Gs = {};
632
632
  Gs.NODE_ENV === "production" ? Ht.exports = Qs() : Ht.exports = Bs();
633
633
  var dt = Ht.exports;
634
- function ne(n) {
634
+ function Z(n) {
635
635
  if (typeof n == "number")
636
636
  return (Math.abs(n * 2654435761) >>> 0).toString(16);
637
637
  if (typeof n == "boolean")
@@ -650,7 +650,7 @@ function ne(n) {
650
650
  let e = 2166136261;
651
651
  for (let t = 0; t < n.length; t++) {
652
652
  e ^= (t + 1) * 2654435761;
653
- const r = ne(n[t]);
653
+ const r = Z(n[t]);
654
654
  for (let s = 0; s < r.length; s++)
655
655
  e ^= r.charCodeAt(s), e *= 16777619, e = e >>> 0;
656
656
  }
@@ -663,20 +663,20 @@ function ne(n) {
663
663
  const s = t[r];
664
664
  if (n[s] === void 0)
665
665
  continue;
666
- const i = ne(s);
666
+ const i = Z(s);
667
667
  e ^= parseInt(i, 16), e *= 16777619, e = e >>> 0;
668
- const o = ne(n[s]);
668
+ const o = Z(n[s]);
669
669
  e ^= parseInt(o, 16), e *= 16777619, e = e >>> 0;
670
670
  }
671
671
  return e.toString(16);
672
672
  }
673
- return ne(String(n));
673
+ return Z(String(n));
674
674
  }
675
- const X = {
675
+ const J = {
676
676
  Remove: "remove",
677
677
  Replace: "replace",
678
678
  Add: "add"
679
- }, Ir = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Hs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), _t = Symbol.iterator, pe = {
679
+ }, Ir = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Hs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), _t = Symbol.iterator, he = {
680
680
  mutable: "mutable",
681
681
  immutable: "immutable"
682
682
  }, pn = {};
@@ -700,30 +700,30 @@ function yn(n) {
700
700
  function bn(n) {
701
701
  return Object.getPrototypeOf(n) === Map.prototype;
702
702
  }
703
- function he(n) {
703
+ function de(n) {
704
704
  var e;
705
705
  return (e = n.copy) !== null && e !== void 0 ? e : n.original;
706
706
  }
707
707
  function $e(n) {
708
- return !!x(n);
708
+ return !!$(n);
709
709
  }
710
- function x(n) {
710
+ function $(n) {
711
711
  return typeof n != "object" ? null : n == null ? void 0 : n[Ir];
712
712
  }
713
713
  function gn(n) {
714
714
  var e;
715
- const t = x(n);
715
+ const t = $(n);
716
716
  return t ? (e = t.copy) !== null && e !== void 0 ? e : t.original : n;
717
717
  }
718
- function me(n, e) {
718
+ function _e(n, e) {
719
719
  if (!n || typeof n != "object")
720
720
  return !1;
721
721
  let t;
722
- return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, pe)) === pe.immutable || typeof t == "function");
722
+ return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, he)) === he.immutable || typeof t == "function");
723
723
  }
724
724
  function Pr(n, e = []) {
725
725
  if (Object.hasOwnProperty.call(n, "key")) {
726
- const t = n.parent.copy, r = x(Ee(t, n.key));
726
+ const t = n.parent.copy, r = $(Ee(t, n.key));
727
727
  if (r !== null && (r == null ? void 0 : r.original) !== n.original)
728
728
  return null;
729
729
  const s = n.parent.type === 3, i = s ? Array.from(n.parent.setMap.keys()).indexOf(n.key) : n.key;
@@ -751,8 +751,8 @@ function ot(n, e, t) {
751
751
  xe(n) === 2 ? n.set(e, t) : n[e] = t;
752
752
  }
753
753
  function Lt(n, e) {
754
- const t = x(n);
755
- return (t ? he(t) : n)[e];
754
+ const t = $(n);
755
+ return (t ? de(t) : n)[e];
756
756
  }
757
757
  function Oe(n, e) {
758
758
  return n === e ? n !== 0 || 1 / n === 1 / e : n !== n && e !== e;
@@ -762,7 +762,7 @@ function Jt(n) {
762
762
  for (; n.finalities.revoke.length > 0; )
763
763
  n.finalities.revoke.pop()();
764
764
  }
765
- function Me(n, e) {
765
+ function Re(n, e) {
766
766
  return e ? n : [""].concat(n).map((t) => {
767
767
  const r = `${t}`;
768
768
  return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
@@ -793,7 +793,7 @@ function Ys(n) {
793
793
  }), e;
794
794
  }
795
795
  const Zs = Object.prototype.propertyIsEnumerable;
796
- function Mr(n, e) {
796
+ function Rr(n, e) {
797
797
  let t;
798
798
  if (Array.isArray(n))
799
799
  return Array.prototype.concat.call(n);
@@ -809,8 +809,8 @@ function Mr(n, e) {
809
809
  return new r(n);
810
810
  }
811
811
  return new Map(n);
812
- } else if (e != null && e.mark && (t = e.mark(n, pe), t !== void 0) && t !== pe.mutable) {
813
- if (t === pe.immutable)
812
+ } else if (e != null && e.mark && (t = e.mark(n, he), t !== void 0) && t !== he.mutable) {
813
+ if (t === he.immutable)
814
814
  return Ys(n);
815
815
  if (typeof t == "function") {
816
816
  if (e.enablePatches || e.enableAutoFreeze)
@@ -828,11 +828,11 @@ function Mr(n, e) {
828
828
  } else
829
829
  throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
830
830
  }
831
- function ce(n) {
832
- n.copy || (n.copy = Mr(n.original, n.options));
831
+ function ie(n) {
832
+ n.copy || (n.copy = Rr(n.original, n.options));
833
833
  }
834
834
  function Ze(n) {
835
- if (!me(n))
835
+ if (!_e(n))
836
836
  return gn(n);
837
837
  if (Array.isArray(n))
838
838
  return n.map(Ze);
@@ -929,19 +929,19 @@ function _n(n, e) {
929
929
  } else
930
930
  n.forEach((r, s) => e(s, r, n));
931
931
  }
932
- function Rr(n, e, t) {
933
- if ($e(n) || !me(n, t) || e.has(n) || Object.isFrozen(n))
932
+ function Mr(n, e, t) {
933
+ if ($e(n) || !_e(n, t) || e.has(n) || Object.isFrozen(n))
934
934
  return;
935
935
  const r = n instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
936
936
  if (e.add(n), _n(n, (i, o) => {
937
937
  var a;
938
938
  if ($e(o)) {
939
- const c = x(o);
940
- ce(c);
939
+ const c = $(o);
940
+ ie(c);
941
941
  const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
942
942
  ot(r ? s : n, i, u);
943
943
  } else
944
- Rr(o, e, t);
944
+ Mr(o, e, t);
945
945
  }), s) {
946
946
  const i = n, o = Array.from(i);
947
947
  i.clear(), o.forEach((a) => {
@@ -951,7 +951,7 @@ function Rr(n, e, t) {
951
951
  }
952
952
  function Xs(n, e) {
953
953
  const t = n.type === 3 ? n.setMap : n.copy;
954
- n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && Rr(Ee(t, e), n.finalities.handledSet, n.options);
954
+ n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && Mr(Ee(t, e), n.finalities.handledSet, n.options);
955
955
  }
956
956
  function Yt(n) {
957
957
  n.type === 3 && n.copy && (n.copy.clear(), n.setMap.forEach((e) => {
@@ -968,7 +968,7 @@ function Zt(n, e, t, r) {
968
968
  }
969
969
  }
970
970
  function mn(n, e, t, r) {
971
- const s = x(t);
971
+ const s = $(t);
972
972
  s && (s.callbacks || (s.callbacks = []), s.callbacks.push((i, o) => {
973
973
  var a;
974
974
  const c = n.type === 3 ? n.setMap : n.copy;
@@ -976,7 +976,7 @@ function mn(n, e, t, r) {
976
976
  let u = s.original;
977
977
  s.copy && (u = s.copy), Yt(n), Zt(n, r, i, o), n.options.enableAutoFreeze && (n.options.updatedValues = (a = n.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), n.options.updatedValues.set(u, s.original)), ot(c, e, u);
978
978
  }
979
- }), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), me(t, n.options) && n.finalities.draft.push(() => {
979
+ }), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), _e(t, n.options) && n.finalities.draft.push(() => {
980
980
  const i = n.type === 3 ? n.setMap : n.copy;
981
981
  Oe(Ee(i, e), t) && Xs(n, e);
982
982
  });
@@ -986,23 +986,23 @@ function ei(n, e, t, r, s) {
986
986
  c.length < i.length && ([i, c] = [c, i], [t, r] = [r, t]);
987
987
  for (let u = 0; u < i.length; u += 1)
988
988
  if (o.get(u.toString()) && c[u] !== i[u]) {
989
- const l = e.concat([u]), f = Me(l, s);
989
+ const l = e.concat([u]), f = Re(l, s);
990
990
  t.push({
991
- op: X.Replace,
991
+ op: J.Replace,
992
992
  path: f,
993
993
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
994
994
  value: mt(c[u])
995
995
  }), r.push({
996
- op: X.Replace,
996
+ op: J.Replace,
997
997
  path: f,
998
998
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
999
999
  value: mt(i[u])
1000
1000
  });
1001
1001
  }
1002
1002
  for (let u = i.length; u < c.length; u += 1) {
1003
- const l = e.concat([u]), f = Me(l, s);
1003
+ const l = e.concat([u]), f = Re(l, s);
1004
1004
  t.push({
1005
- op: X.Add,
1005
+ op: J.Add,
1006
1006
  path: f,
1007
1007
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
1008
1008
  value: mt(c[u])
@@ -1011,17 +1011,17 @@ function ei(n, e, t, r, s) {
1011
1011
  if (i.length < c.length) {
1012
1012
  const { arrayLengthAssignment: u = !0 } = a.enablePatches;
1013
1013
  if (u) {
1014
- const l = e.concat(["length"]), f = Me(l, s);
1014
+ const l = e.concat(["length"]), f = Re(l, s);
1015
1015
  r.push({
1016
- op: X.Replace,
1016
+ op: J.Replace,
1017
1017
  path: f,
1018
1018
  value: i.length
1019
1019
  });
1020
1020
  } else
1021
1021
  for (let l = c.length; i.length < l; l -= 1) {
1022
- const f = e.concat([l - 1]), h = Me(f, s);
1022
+ const f = e.concat([l - 1]), h = Re(f, s);
1023
1023
  r.push({
1024
- op: X.Remove,
1024
+ op: J.Remove,
1025
1025
  path: h
1026
1026
  });
1027
1027
  }
@@ -1029,24 +1029,24 @@ function ei(n, e, t, r, s) {
1029
1029
  }
1030
1030
  function ti({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
1031
1031
  t.forEach((a, c) => {
1032
- const u = Ee(n, c), l = mt(Ee(e, c)), f = a ? rt(n, c) ? X.Replace : X.Add : X.Remove;
1033
- if (Oe(u, l) && f === X.Replace)
1032
+ const u = Ee(n, c), l = mt(Ee(e, c)), f = a ? rt(n, c) ? J.Replace : J.Add : J.Remove;
1033
+ if (Oe(u, l) && f === J.Replace)
1034
1034
  return;
1035
- const h = r.concat(c), y = Me(h, o);
1036
- s.push(f === X.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === X.Add ? { op: X.Remove, path: y } : f === X.Remove ? { op: X.Add, path: y, value: u } : { op: X.Replace, path: y, value: u });
1035
+ const h = r.concat(c), y = Re(h, o);
1036
+ s.push(f === J.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === J.Add ? { op: J.Remove, path: y } : f === J.Remove ? { op: J.Add, path: y, value: u } : { op: J.Replace, path: y, value: u });
1037
1037
  });
1038
1038
  }
1039
1039
  function ni({ original: n, copy: e }, t, r, s, i) {
1040
1040
  let o = 0;
1041
1041
  n.forEach((a) => {
1042
1042
  if (!e.has(a)) {
1043
- const c = t.concat([o]), u = Me(c, i);
1043
+ const c = t.concat([o]), u = Re(c, i);
1044
1044
  r.push({
1045
- op: X.Remove,
1045
+ op: J.Remove,
1046
1046
  path: u,
1047
1047
  value: a
1048
1048
  }), s.unshift({
1049
- op: X.Add,
1049
+ op: J.Add,
1050
1050
  path: u,
1051
1051
  value: a
1052
1052
  });
@@ -1054,13 +1054,13 @@ function ni({ original: n, copy: e }, t, r, s, i) {
1054
1054
  o += 1;
1055
1055
  }), o = 0, e.forEach((a) => {
1056
1056
  if (!n.has(a)) {
1057
- const c = t.concat([o]), u = Me(c, i);
1057
+ const c = t.concat([o]), u = Re(c, i);
1058
1058
  r.push({
1059
- op: X.Add,
1059
+ op: J.Add,
1060
1060
  path: u,
1061
1061
  value: a
1062
1062
  }), s.unshift({
1063
- op: X.Remove,
1063
+ op: J.Remove,
1064
1064
  path: u,
1065
1065
  value: a
1066
1066
  });
@@ -1081,44 +1081,44 @@ function it(n, e, t, r) {
1081
1081
  }
1082
1082
  }
1083
1083
  const vt = (n, e, t = !1) => {
1084
- if (typeof n == "object" && n !== null && (!me(n, e) || t))
1084
+ if (typeof n == "object" && n !== null && (!_e(n, e) || t))
1085
1085
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
1086
1086
  }, Xt = {
1087
1087
  get size() {
1088
- return he(x(this)).size;
1088
+ return de($(this)).size;
1089
1089
  },
1090
1090
  has(n) {
1091
- return he(x(this)).has(n);
1091
+ return de($(this)).has(n);
1092
1092
  },
1093
1093
  set(n, e) {
1094
- const t = x(this), r = he(t);
1095
- return (!r.has(n) || !Oe(r.get(n), e)) && (ce(t), Se(t), t.assignedMap.set(n, !0), t.copy.set(n, e), mn(t, n, e, it)), this;
1094
+ const t = $(this), r = de(t);
1095
+ return (!r.has(n) || !Oe(r.get(n), e)) && (ie(t), Se(t), t.assignedMap.set(n, !0), t.copy.set(n, e), mn(t, n, e, it)), this;
1096
1096
  },
1097
1097
  delete(n) {
1098
1098
  if (!this.has(n))
1099
1099
  return !1;
1100
- const e = x(this);
1101
- return ce(e), Se(e), e.original.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.copy.delete(n), !0;
1100
+ const e = $(this);
1101
+ return ie(e), Se(e), e.original.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.copy.delete(n), !0;
1102
1102
  },
1103
1103
  clear() {
1104
- const n = x(this);
1104
+ const n = $(this);
1105
1105
  if (this.size) {
1106
- ce(n), Se(n), n.assignedMap = /* @__PURE__ */ new Map();
1106
+ ie(n), Se(n), n.assignedMap = /* @__PURE__ */ new Map();
1107
1107
  for (const [e] of n.original)
1108
1108
  n.assignedMap.set(e, !1);
1109
1109
  n.copy.clear();
1110
1110
  }
1111
1111
  },
1112
1112
  forEach(n, e) {
1113
- const t = x(this);
1114
- he(t).forEach((r, s) => {
1113
+ const t = $(this);
1114
+ de(t).forEach((r, s) => {
1115
1115
  n.call(e, this.get(s), s, this);
1116
1116
  });
1117
1117
  },
1118
1118
  get(n) {
1119
1119
  var e, t;
1120
- const r = x(this), s = he(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, pe)) === pe.mutable;
1121
- if (r.options.strict && vt(s, r.options, i), i || r.finalized || !me(s, r.options) || s !== r.original.get(n))
1120
+ const r = $(this), s = de(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, he)) === he.mutable;
1121
+ if (r.options.strict && vt(s, r.options, i), i || r.finalized || !_e(s, r.options) || s !== r.original.get(n))
1122
1122
  return s;
1123
1123
  const o = pn.createDraft({
1124
1124
  original: s,
@@ -1127,10 +1127,10 @@ const vt = (n, e, t = !1) => {
1127
1127
  finalities: r.finalities,
1128
1128
  options: r.options
1129
1129
  });
1130
- return ce(r), r.copy.set(n, o), o;
1130
+ return ie(r), r.copy.set(n, o), o;
1131
1131
  },
1132
1132
  keys() {
1133
- return he(x(this)).keys();
1133
+ return de($(this)).keys();
1134
1134
  },
1135
1135
  values() {
1136
1136
  const n = this.keys();
@@ -1171,8 +1171,8 @@ const vt = (n, e, t = !1) => {
1171
1171
  return i;
1172
1172
  const o = i.value;
1173
1173
  let a = n.setMap.get(o);
1174
- const c = x(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, pe)) === pe.mutable;
1175
- if (n.options.strict && vt(o, n.options, u), !u && !c && me(o, n.options) && !n.finalized && n.original.has(o)) {
1174
+ const c = $(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, he)) === he.mutable;
1175
+ if (n.options.strict && vt(o, n.options, u), !u && !c && _e(o, n.options) && !n.finalized && n.original.has(o)) {
1176
1176
  const l = pn.createDraft({
1177
1177
  original: o,
1178
1178
  parentDraft: n,
@@ -1188,40 +1188,40 @@ const vt = (n, e, t = !1) => {
1188
1188
  };
1189
1189
  }, At = {
1190
1190
  get size() {
1191
- return x(this).setMap.size;
1191
+ return $(this).setMap.size;
1192
1192
  },
1193
1193
  has(n) {
1194
- const e = x(this);
1194
+ const e = $(this);
1195
1195
  if (e.setMap.has(n))
1196
1196
  return !0;
1197
- ce(e);
1198
- const t = x(n);
1197
+ ie(e);
1198
+ const t = $(n);
1199
1199
  return !!(t && e.setMap.has(t.original));
1200
1200
  },
1201
1201
  add(n) {
1202
- const e = x(this);
1203
- return this.has(n) || (ce(e), Se(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), mn(e, n, n, it)), this;
1202
+ const e = $(this);
1203
+ return this.has(n) || (ie(e), Se(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), mn(e, n, n, it)), this;
1204
1204
  },
1205
1205
  delete(n) {
1206
1206
  if (!this.has(n))
1207
1207
  return !1;
1208
- const e = x(this);
1209
- ce(e), Se(e);
1210
- const t = x(n);
1208
+ const e = $(this);
1209
+ ie(e), Se(e);
1210
+ const t = $(n);
1211
1211
  return t && e.setMap.has(t.original) ? (e.assignedMap.set(t.original, !1), e.setMap.delete(t.original)) : (!t && e.setMap.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.setMap.delete(n));
1212
1212
  },
1213
1213
  clear() {
1214
1214
  if (!this.size)
1215
1215
  return;
1216
- const n = x(this);
1217
- ce(n), Se(n);
1216
+ const n = $(this);
1217
+ ie(n), Se(n);
1218
1218
  for (const e of n.original)
1219
1219
  n.assignedMap.set(e, !1);
1220
1220
  n.setMap.clear();
1221
1221
  },
1222
1222
  values() {
1223
- const n = x(this);
1224
- ce(n);
1223
+ const n = $(this);
1224
+ ie(n);
1225
1225
  const e = n.setMap.keys();
1226
1226
  return {
1227
1227
  [Symbol.iterator]: () => this.values(),
@@ -1229,8 +1229,8 @@ const vt = (n, e, t = !1) => {
1229
1229
  };
1230
1230
  },
1231
1231
  entries() {
1232
- const n = x(this);
1233
- ce(n);
1232
+ const n = $(this);
1233
+ ie(n);
1234
1234
  const e = n.setMap.keys();
1235
1235
  return {
1236
1236
  [Symbol.iterator]: () => this.entries(),
@@ -1286,10 +1286,10 @@ const si = Reflect.ownKeys(At), jr = /* @__PURE__ */ new WeakSet(), $r = {
1286
1286
  let o;
1287
1287
  if (n.options.mark) {
1288
1288
  const u = e === "size" && (n.original instanceof Map || n.original instanceof Set) ? Reflect.get(n.original, e) : Reflect.get(n.original, e, t);
1289
- if (o = n.options.mark(u, pe), o === pe.mutable)
1289
+ if (o = n.options.mark(u, he), o === he.mutable)
1290
1290
  return n.options.strict && vt(u, n.options, !0), u;
1291
1291
  }
1292
- const a = he(n);
1292
+ const a = de(n);
1293
1293
  if (a instanceof Map && ri.includes(e)) {
1294
1294
  if (e === "size")
1295
1295
  return Object.getOwnPropertyDescriptor(Xt, "size").get.call(n.proxy);
@@ -1312,18 +1312,18 @@ const si = Reflect.ownKeys(At), jr = /* @__PURE__ */ new WeakSet(), $r = {
1312
1312
  ) : void 0;
1313
1313
  }
1314
1314
  const c = a[e];
1315
- if (n.options.strict && vt(c, n.options), n.finalized || !me(c, n.options))
1315
+ if (n.options.strict && vt(c, n.options), n.finalized || !_e(c, n.options))
1316
1316
  return c;
1317
1317
  if (c === Lt(n.original, e)) {
1318
- if (ce(n), n.copy[e] = wn({
1318
+ if (ie(n), n.copy[e] = wn({
1319
1319
  original: n.original[e],
1320
1320
  parentDraft: n,
1321
1321
  key: n.type === 1 ? Number(e) : e,
1322
1322
  finalities: n.finalities,
1323
1323
  options: n.options
1324
1324
  }), typeof o == "function") {
1325
- const u = x(n.copy[e]);
1326
- return ce(u), Se(u), u.copy;
1325
+ const u = $(n.copy[e]);
1326
+ return ie(u), Se(u), u.copy;
1327
1327
  }
1328
1328
  return n.copy[e];
1329
1329
  }
@@ -1336,20 +1336,20 @@ const si = Reflect.ownKeys(At), jr = /* @__PURE__ */ new WeakSet(), $r = {
1336
1336
  let s;
1337
1337
  if (n.type === 1 && e !== "length" && !(Number.isInteger(s = Number(e)) && s >= 0 && (e === 0 || s === 0 || String(s) === String(e))))
1338
1338
  throw new Error("Only supports setting array indices and the 'length' property.");
1339
- const i = zn(he(n), e);
1339
+ const i = zn(de(n), e);
1340
1340
  if (i != null && i.set)
1341
1341
  return i.set.call(n.proxy, t), !0;
1342
- const o = Lt(he(n), e), a = x(o);
1343
- return a && Oe(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Oe(t, o) && (t !== void 0 || rt(n.original, e)) || (ce(n), Se(n), rt(n.original, e) && Oe(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, mn(n, e, t, it)), !0);
1342
+ const o = Lt(de(n), e), a = $(o);
1343
+ return a && Oe(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Oe(t, o) && (t !== void 0 || rt(n.original, e)) || (ie(n), Se(n), rt(n.original, e) && Oe(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, mn(n, e, t, it)), !0);
1344
1344
  },
1345
1345
  has(n, e) {
1346
- return e in he(n);
1346
+ return e in de(n);
1347
1347
  },
1348
1348
  ownKeys(n) {
1349
- return Reflect.ownKeys(he(n));
1349
+ return Reflect.ownKeys(de(n));
1350
1350
  },
1351
1351
  getOwnPropertyDescriptor(n, e) {
1352
- const t = he(n), r = Reflect.getOwnPropertyDescriptor(t, e);
1352
+ const t = de(n), r = Reflect.getOwnPropertyDescriptor(t, e);
1353
1353
  return r && {
1354
1354
  writable: !0,
1355
1355
  configurable: n.type !== 1 || e !== "length",
@@ -1368,7 +1368,7 @@ const si = Reflect.ownKeys(At), jr = /* @__PURE__ */ new WeakSet(), $r = {
1368
1368
  },
1369
1369
  deleteProperty(n, e) {
1370
1370
  var t;
1371
- return n.type === 1 ? $r.set.call(this, n, e, void 0, n.proxy) : (Lt(n.original, e) !== void 0 || e in n.original ? (ce(n), Se(n), n.assignedMap.set(e, !1)) : (n.assignedMap = (t = n.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), n.assignedMap.delete(e)), n.copy && delete n.copy[e], !0);
1371
+ return n.type === 1 ? $r.set.call(this, n, e, void 0, n.proxy) : (Lt(n.original, e) !== void 0 || e in n.original ? (ie(n), Se(n), n.assignedMap.set(e, !1)) : (n.assignedMap = (t = n.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), n.assignedMap.delete(e)), n.copy && delete n.copy[e], !0);
1372
1372
  }
1373
1373
  };
1374
1374
  function wn(n) {
@@ -1390,19 +1390,19 @@ function wn(n) {
1390
1390
  const l = t;
1391
1391
  l.finalities.draft.push((f, h) => {
1392
1392
  var y, b;
1393
- const g = x(c);
1394
- let w = l.type === 3 ? l.setMap : l.copy;
1395
- const S = Ee(w, r), _ = x(S);
1396
- if (_) {
1397
- let T = _.original;
1398
- _.operated && (T = gn(S)), Yt(_), Zt(_, it, f, h), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(T, _.original)), ot(w, r, T);
1393
+ const _ = $(c);
1394
+ let T = l.type === 3 ? l.setMap : l.copy;
1395
+ const S = Ee(T, r), g = $(S);
1396
+ if (g) {
1397
+ let m = g.original;
1398
+ g.operated && (m = gn(S)), Yt(g), Zt(g, it, 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, g.original)), ot(T, r, m);
1399
1399
  }
1400
- (b = g.callbacks) === null || b === void 0 || b.forEach((T) => {
1401
- T(f, h);
1400
+ (b = _.callbacks) === null || b === void 0 || b.forEach((m) => {
1401
+ m(f, h);
1402
1402
  });
1403
1403
  });
1404
1404
  } else {
1405
- const l = x(c);
1405
+ const l = $(c);
1406
1406
  l.finalities.draft.push((f, h) => {
1407
1407
  Yt(l), Zt(l, it, f, h);
1408
1408
  });
@@ -1412,15 +1412,15 @@ function wn(n) {
1412
1412
  pn.createDraft = wn;
1413
1413
  function ii(n, e, t, r, s) {
1414
1414
  var i;
1415
- const o = x(n), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : n, c = !!e.length;
1415
+ const o = $(n), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : n, c = !!e.length;
1416
1416
  if (o != null && o.operated)
1417
1417
  for (; o.finalities.draft.length > 0; )
1418
1418
  o.finalities.draft.pop()(t, r);
1419
1419
  const u = c ? e[0] : o ? o.operated ? o.copy : o.original : n;
1420
1420
  return o && Jt(o), s && Ke(u, u, o == null ? void 0 : o.options.updatedValues), [
1421
1421
  u,
1422
- t && c ? [{ op: X.Replace, path: [], value: e[0] }] : t,
1423
- r && c ? [{ op: X.Replace, path: [], value: a }] : r
1422
+ t && c ? [{ op: J.Replace, path: [], value: e[0] }] : t,
1423
+ r && c ? [{ op: J.Replace, path: [], value: a }] : r
1424
1424
  ];
1425
1425
  }
1426
1426
  function oi(n, e) {
@@ -1432,7 +1432,7 @@ function oi(n, e) {
1432
1432
  };
1433
1433
  let s, i;
1434
1434
  e.enablePatches && (s = [], i = []);
1435
- const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, pe)) === pe.mutable || !me(n, e) ? n : wn({
1435
+ const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, he)) === he.mutable || !_e(n, e) ? n : wn({
1436
1436
  original: n,
1437
1437
  parentDraft: null,
1438
1438
  finalities: r,
@@ -1449,7 +1449,7 @@ function oi(n, e) {
1449
1449
  function en(n) {
1450
1450
  const { rootDraft: e, value: t, useRawReturn: r = !1, isRoot: s = !0 } = n;
1451
1451
  _n(t, (i, o, a) => {
1452
- const c = x(o);
1452
+ const c = $(o);
1453
1453
  if (c && e && c.finalities === e.finalities) {
1454
1454
  n.isContainDraft = !0;
1455
1455
  const u = c.original;
@@ -1463,15 +1463,15 @@ function en(n) {
1463
1463
  }
1464
1464
  function xr(n) {
1465
1465
  var e;
1466
- const t = x(n);
1467
- if (!me(n, t == null ? void 0 : t.options))
1466
+ const t = $(n);
1467
+ if (!_e(n, t == null ? void 0 : t.options))
1468
1468
  return n;
1469
1469
  const r = xe(n);
1470
1470
  if (t && !t.operated)
1471
1471
  return t.original;
1472
1472
  let s;
1473
1473
  function i() {
1474
- s = r === 2 ? bn(n) ? new Map(n) : new (Object.getPrototypeOf(n)).constructor(n) : r === 3 ? Array.from(t.setMap.values()) : Mr(n, t == null ? void 0 : t.options);
1474
+ s = r === 2 ? bn(n) ? new Map(n) : new (Object.getPrototypeOf(n)).constructor(n) : r === 3 ? Array.from(t.setMap.values()) : Rr(n, t == null ? void 0 : t.options);
1475
1475
  }
1476
1476
  if (t) {
1477
1477
  t.finalized = !0;
@@ -1501,72 +1501,72 @@ function Bn(n) {
1501
1501
  const ai = (n) => function e(t, r, s) {
1502
1502
  var i, o, a;
1503
1503
  if (typeof t == "function" && typeof r != "function")
1504
- return function(O, ...F) {
1505
- return e(O, (P) => t.call(this, P, ...F), r);
1504
+ return function(v, ...I) {
1505
+ return e(v, (x) => t.call(this, x, ...I), r);
1506
1506
  };
1507
1507
  const c = t, u = r;
1508
1508
  let l = s;
1509
1509
  if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
1510
1510
  throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
1511
1511
  l = Object.assign(Object.assign({}, n), l);
1512
- const f = $e(c) ? Bn(c) : c, h = Array.isArray(l.mark) ? (O, F) => {
1513
- for (const P of l.mark) {
1514
- if (typeof P != "function")
1515
- throw new Error(`Invalid mark: ${P}, 'mark' should be a function.`);
1516
- const C = P(O, F);
1517
- if (C)
1518
- return C;
1519
- }
1520
- } : l.mark, y = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, b = (o = l.strict) !== null && o !== void 0 ? o : !1, w = {
1512
+ const f = $e(c) ? Bn(c) : c, h = Array.isArray(l.mark) ? (v, I) => {
1513
+ for (const x of l.mark) {
1514
+ if (typeof x != "function")
1515
+ throw new Error(`Invalid mark: ${x}, 'mark' should be a function.`);
1516
+ const F = x(v, I);
1517
+ if (F)
1518
+ return F;
1519
+ }
1520
+ } : l.mark, y = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, b = (o = l.strict) !== null && o !== void 0 ? o : !1, T = {
1521
1521
  enableAutoFreeze: (a = l.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
1522
1522
  mark: h,
1523
1523
  strict: b,
1524
1524
  enablePatches: y
1525
1525
  };
1526
- if (!me(f, w) && typeof f == "object" && f !== null)
1526
+ if (!_e(f, T) && typeof f == "object" && f !== null)
1527
1527
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
1528
- const [S, _] = oi(f, w);
1528
+ const [S, g] = oi(f, T);
1529
1529
  if (typeof r != "function") {
1530
- if (!me(f, w))
1530
+ if (!_e(f, T))
1531
1531
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
1532
- return [S, _];
1532
+ return [S, g];
1533
1533
  }
1534
- let T;
1534
+ let m;
1535
1535
  try {
1536
- T = u(S);
1537
- } catch (O) {
1538
- throw Jt(x(S)), O;
1539
- }
1540
- const M = (O) => {
1541
- const F = x(S);
1542
- if (!$e(O)) {
1543
- if (O !== void 0 && !Oe(O, S) && (F != null && F.operated))
1536
+ m = u(S);
1537
+ } catch (v) {
1538
+ throw Jt($(S)), v;
1539
+ }
1540
+ const P = (v) => {
1541
+ const I = $(S);
1542
+ if (!$e(v)) {
1543
+ if (v !== void 0 && !Oe(v, S) && (I != null && I.operated))
1544
1544
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
1545
- const C = O == null ? void 0 : O[Hs];
1546
- if (C) {
1547
- const G = C[0];
1548
- return w.strict && typeof O == "object" && O !== null && en({
1549
- rootDraft: F,
1550
- value: O,
1545
+ const F = v == null ? void 0 : v[Hs];
1546
+ if (F) {
1547
+ const V = F[0];
1548
+ return T.strict && typeof v == "object" && v !== null && en({
1549
+ rootDraft: I,
1550
+ value: v,
1551
1551
  useRawReturn: !0
1552
- }), _([G]);
1552
+ }), g([V]);
1553
1553
  }
1554
- if (O !== void 0)
1555
- return typeof O == "object" && O !== null && en({ rootDraft: F, value: O }), _([O]);
1556
- }
1557
- if (O === S || O === void 0)
1558
- return _([]);
1559
- const P = x(O);
1560
- if (w === P.options) {
1561
- if (P.operated)
1554
+ if (v !== void 0)
1555
+ return typeof v == "object" && v !== null && en({ rootDraft: I, value: v }), g([v]);
1556
+ }
1557
+ if (v === S || v === void 0)
1558
+ return g([]);
1559
+ const x = $(v);
1560
+ if (T === x.options) {
1561
+ if (x.operated)
1562
1562
  throw new Error("Cannot return a modified child draft.");
1563
- return _([Bn(O)]);
1563
+ return g([Bn(v)]);
1564
1564
  }
1565
- return _([O]);
1565
+ return g([v]);
1566
1566
  };
1567
- return T instanceof Promise ? T.then(M, (O) => {
1568
- throw Jt(x(S)), O;
1569
- }) : M(T);
1567
+ return m instanceof Promise ? m.then(P, (v) => {
1568
+ throw Jt($(S)), v;
1569
+ }) : P(m);
1570
1570
  }, Ot = ai();
1571
1571
  Object.prototype.constructor.toString();
1572
1572
  function Dr(n, e) {
@@ -1966,7 +1966,7 @@ function Ct(n) {
1966
1966
  throw new Error(`Invalid date value \`${n}\`. Expected a date, number, or string, got type ${typeof n}.`);
1967
1967
  }
1968
1968
  }
1969
- class Re {
1969
+ class Me {
1970
1970
  constructor(e, t) {
1971
1971
  p(this, "attrs");
1972
1972
  p(this, "linkIndex");
@@ -1999,7 +1999,7 @@ class Re {
1999
1999
  for (const e of Object.values(this.attrs))
2000
2000
  if (vn(e)) {
2001
2001
  const [t, r, s] = e["forward-identity"];
2002
- le(this.blobAttrs, [r, s], e);
2002
+ ce(this.blobAttrs, [r, s], e);
2003
2003
  }
2004
2004
  return this._blobAttrs;
2005
2005
  }
@@ -2010,7 +2010,7 @@ class Re {
2010
2010
  for (const e of Object.values(this.attrs))
2011
2011
  if (e["primary?"]) {
2012
2012
  const [t, r] = e["forward-identity"];
2013
- le(this._primaryKeys, [r], e);
2013
+ ce(this._primaryKeys, [r], e);
2014
2014
  }
2015
2015
  return this._primaryKeys;
2016
2016
  }
@@ -2020,7 +2020,7 @@ class Re {
2020
2020
  this._forwardIdents = /* @__PURE__ */ new Map();
2021
2021
  for (const e of Object.values(this.attrs)) {
2022
2022
  const t = e["forward-identity"], [r, s, i] = t;
2023
- le(this._forwardIdents, [s, i], e);
2023
+ ce(this._forwardIdents, [s, i], e);
2024
2024
  }
2025
2025
  return this._forwardIdents;
2026
2026
  }
@@ -2032,7 +2032,7 @@ class Re {
2032
2032
  const t = e["reverse-identity"];
2033
2033
  if (t) {
2034
2034
  const [r, s, i] = t;
2035
- le(this._revIdents, [s, i], e);
2035
+ ce(this._revIdents, [s, i], e);
2036
2036
  }
2037
2037
  }
2038
2038
  return this._revIdents;
@@ -2053,7 +2053,7 @@ function vn(n) {
2053
2053
  function Qe(n, e) {
2054
2054
  return e.reduce((t, r) => t && t.get(r), n);
2055
2055
  }
2056
- function _e(n, e) {
2056
+ function ge(n, e) {
2057
2057
  if (e.length === 0)
2058
2058
  throw new Error("path must have at least one element");
2059
2059
  if (e.length === 1) {
@@ -2061,9 +2061,9 @@ function _e(n, e) {
2061
2061
  return;
2062
2062
  }
2063
2063
  const [t, ...r] = e;
2064
- n.has(t) && _e(n.get(t), r);
2064
+ n.has(t) && ge(n.get(t), r);
2065
2065
  }
2066
- function le(n, e, t) {
2066
+ function ce(n, e, t) {
2067
2067
  let r = n;
2068
2068
  const s = e.length - 1;
2069
2069
  for (let i = 0; i < s; i++) {
@@ -2082,13 +2082,13 @@ function Fr(n, e, t) {
2082
2082
  console.warn("no such attr", c, a);
2083
2083
  continue;
2084
2084
  }
2085
- l["checked-data-type"] === "date" && t && (u = Ct(u), o[2] = u), Sn(l) && le(i, [u, c, a], o), le(r, [a, c, u], o), le(s, [c, a, u], o);
2085
+ l["checked-data-type"] === "date" && t && (u = Ct(u), o[2] = u), Sn(l) && ce(i, [u, c, a], o), ce(r, [a, c, u], o), ce(s, [c, a, u], o);
2086
2086
  }
2087
2087
  return { eav: r, aev: s, vae: i };
2088
2088
  }
2089
2089
  function Nr(n) {
2090
2090
  return {
2091
- triples: fe(n.eav, 3),
2091
+ triples: ue(n.eav, 3),
2092
2092
  cardinalityInference: n.cardinalityInference,
2093
2093
  useDateObjects: n.useDateObjects,
2094
2094
  version: 1
@@ -2099,9 +2099,9 @@ function Kr(n, e) {
2099
2099
  }
2100
2100
  function qr(n, e) {
2101
2101
  if (n)
2102
- return new Re(n.attrs, n.linkIndex);
2102
+ return new Me(n.attrs, n.linkIndex);
2103
2103
  if (e && "__type" in e)
2104
- return new Re(e.attrs, e.linkIndex);
2104
+ return new Me(e.attrs, e.linkIndex);
2105
2105
  }
2106
2106
  function Ci(n, e) {
2107
2107
  return Qe(n.eav, [e]) !== void 0;
@@ -2117,7 +2117,7 @@ function at(n, e) {
2117
2117
  const [o, a] = e[0], c = n.aev.get(o);
2118
2118
  if (!c)
2119
2119
  return null;
2120
- t = (s = fe(c, 2).find((l) => l[2] === a)) == null ? void 0 : s[0];
2120
+ t = (s = ue(c, 2).find((l) => l[2] === a)) == null ? void 0 : s[0];
2121
2121
  } else
2122
2122
  t = e[0];
2123
2123
  if (!t)
@@ -2127,7 +2127,7 @@ function at(n, e) {
2127
2127
  const [o, a] = r, c = n.aev.get(o);
2128
2128
  if (!c)
2129
2129
  return null;
2130
- const l = (i = fe(c, 2).find((g) => g[2] === a)) == null ? void 0 : i[0];
2130
+ const l = (i = ue(c, 2).find((_) => _[2] === a)) == null ? void 0 : i[0];
2131
2131
  if (!l)
2132
2132
  return null;
2133
2133
  const [f, h, y, ...b] = e;
@@ -2142,7 +2142,7 @@ function Wr(n, e, t) {
2142
2142
  if (!r)
2143
2143
  return;
2144
2144
  const [s, i, o] = r, a = e.getAttr(i);
2145
- a && (_e(n.eav, [s, i, o]), _e(n.aev, [i, s, o]), Sn(a) && _e(n.vae, [o, i, s]));
2145
+ a && (ge(n.eav, [s, i, o]), ge(n.aev, [i, s, o]), Sn(a) && ge(n.vae, [o, i, s]));
2146
2146
  }
2147
2147
  let Ii = 0;
2148
2148
  function zr(n, e, t) {
@@ -2161,7 +2161,7 @@ function Vr(n, e, t) {
2161
2161
  return;
2162
2162
  a["checked-data-type"] === "date" && n.useDateObjects && (o = Ct(o));
2163
2163
  const c = Qe(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? zr(n, a, r), l = [s, i, o, u];
2164
- ki(a) ? (le(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (le(n.eav, [s, i, o], l), le(n.aev, [i, s, o], l)), Sn(a) && le(n.vae, [o, i, s], l);
2164
+ ki(a) ? (ce(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), ce(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (ce(n.eav, [s, i, o], l), ce(n.aev, [i, s, o], l)), Sn(a) && ce(n.vae, [o, i, s], l);
2165
2165
  }
2166
2166
  function Pi(n, e, t) {
2167
2167
  var y;
@@ -2185,7 +2185,7 @@ function Pi(n, e, t) {
2185
2185
  f,
2186
2186
  zr(n, a, u)
2187
2187
  ];
2188
- le(n.eav, [s, i], /* @__PURE__ */ new Map([[f, h]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[f, h]]));
2188
+ ce(n.eav, [s, i], /* @__PURE__ */ new Map([[f, h]])), ce(n.aev, [i, s], /* @__PURE__ */ new Map([[f, h]]));
2189
2189
  }
2190
2190
  function nn(n, e, t) {
2191
2191
  var u, l;
@@ -2196,23 +2196,23 @@ function nn(n, e, t) {
2196
2196
  if (a) {
2197
2197
  for (const f of a.keys()) {
2198
2198
  const h = e.getAttr(f);
2199
- h && h["on-delete-reverse"] === "cascade" && fe(a.get(f), 1).forEach(([y, b, g]) => {
2200
- var w;
2201
- return nn(n, e, [g, (w = h["reverse-identity"]) == null ? void 0 : w[1]]);
2199
+ h && h["on-delete-reverse"] === "cascade" && ue(a.get(f), 1).forEach(([y, b, _]) => {
2200
+ var T;
2201
+ return nn(n, e, [_, (T = h["reverse-identity"]) == null ? void 0 : T[1]]);
2202
2202
  }), // Fall back to deleting everything if we've rehydrated tx-steps from
2203
2203
  // the store that didn't set `etype` in deleteEntity
2204
2204
  (!s || // If we don't know about the attr, let's just get rid of it
2205
2205
  !h || // Make sure it matches the etype
2206
- ((u = h["forward-identity"]) == null ? void 0 : u[1]) === s) && (_e(n.aev, [f, o]), _e(n.eav, [o, f]));
2206
+ ((u = h["forward-identity"]) == null ? void 0 : u[1]) === s) && (ge(n.aev, [f, o]), ge(n.eav, [o, f]));
2207
2207
  }
2208
- a.size === 0 && _e(n.eav, [o]);
2208
+ a.size === 0 && ge(n.eav, [o]);
2209
2209
  }
2210
- const c = n.vae.get(o) && fe(n.vae.get(o), 2);
2210
+ const c = n.vae.get(o) && ue(n.vae.get(o), 2);
2211
2211
  c && c.forEach((f) => {
2212
- var w, S, _;
2213
- const [h, y, b] = f, g = e.getAttr(y);
2214
- (!s || !g || ((w = g["reverse-identity"]) == null ? void 0 : w[1]) === s) && (_e(n.eav, [h, y, b]), _e(n.aev, [y, h, b]), _e(n.vae, [b, y, h])), g && g["on-delete"] === "cascade" && ((S = g["reverse-identity"]) == null ? void 0 : S[1]) === s && nn(n, e, [h, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
2215
- }), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && _e(n.vae, [o]);
2212
+ var T, S, g;
2213
+ const [h, y, b] = f, _ = e.getAttr(y);
2214
+ (!s || !_ || ((T = _["reverse-identity"]) == null ? void 0 : T[1]) === s) && (ge(n.eav, [h, y, b]), ge(n.aev, [y, h, b]), ge(n.vae, [b, y, h])), _ && _["on-delete"] === "cascade" && ((S = _["reverse-identity"]) == null ? void 0 : S[1]) === s && nn(n, e, [h, (g = _["forward-identity"]) == null ? void 0 : g[1]]);
2215
+ }), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && ge(n.vae, [o]);
2216
2216
  }
2217
2217
  function Qr(n, e, t) {
2218
2218
  const r = Fr(e, t, n.useDateObjects);
@@ -2220,13 +2220,13 @@ function Qr(n, e, t) {
2220
2220
  n[s] = r[s];
2221
2221
  });
2222
2222
  }
2223
- function Mi(n, [e]) {
2223
+ function Ri(n, [e]) {
2224
2224
  n.addAttr(e);
2225
2225
  }
2226
2226
  function Br(n) {
2227
- return fe(n.eav, 3);
2227
+ return ue(n.eav, 3);
2228
2228
  }
2229
- function Ri(n, e, [t]) {
2229
+ function Mi(n, e, [t]) {
2230
2230
  if (!e.getAttr(t))
2231
2231
  return;
2232
2232
  const r = Br(n).filter(([s, i]) => i !== t);
@@ -2251,10 +2251,10 @@ function $i(n, e, t) {
2251
2251
  nn(n, e, s);
2252
2252
  break;
2253
2253
  case "add-attr":
2254
- Mi(e, s);
2254
+ Ri(e, s);
2255
2255
  break;
2256
2256
  case "delete-attr":
2257
- Ri(n, e, s);
2257
+ Mi(n, e, s);
2258
2258
  break;
2259
2259
  case "update-attr":
2260
2260
  ji(n, e, s);
@@ -2267,7 +2267,7 @@ function $i(n, e, t) {
2267
2267
  throw new Error(`unhandled transaction action: ${r}`);
2268
2268
  }
2269
2269
  }
2270
- function fe(n, e, t = []) {
2270
+ function ue(n, e, t = []) {
2271
2271
  if (!n || e === 0)
2272
2272
  return t;
2273
2273
  if (e === 1) {
@@ -2276,7 +2276,7 @@ function fe(n, e, t = []) {
2276
2276
  return t;
2277
2277
  }
2278
2278
  for (const r of n.values())
2279
- fe(r, e - 1, t);
2279
+ ue(r, e - 1, t);
2280
2280
  return t;
2281
2281
  }
2282
2282
  function ht(n, e, t) {
@@ -2304,7 +2304,7 @@ function ht(n, e, t) {
2304
2304
  return r;
2305
2305
  }
2306
2306
  if (t != null && t.$comparator)
2307
- return fe(e, 1).filter(t.$op);
2307
+ return ue(e, 1).filter(t.$op);
2308
2308
  const s = t.in || t.$in || [t];
2309
2309
  for (const o of s) {
2310
2310
  const a = e.get(o);
@@ -2321,11 +2321,11 @@ function Di(n, [e, t, r]) {
2321
2321
  switch (xi(e, t, r)) {
2322
2322
  case "e": {
2323
2323
  const a = n.eav.get(e);
2324
- return fe(a, 2);
2324
+ return ue(a, 2);
2325
2325
  }
2326
2326
  case "ea": {
2327
2327
  const a = (i = n.eav.get(e)) == null ? void 0 : i.get(t);
2328
- return fe(a, 1);
2328
+ return ue(a, 1);
2329
2329
  }
2330
2330
  case "eav": {
2331
2331
  const a = (o = n.eav.get(e)) == null ? void 0 : o.get(t);
@@ -2342,7 +2342,7 @@ function Di(n, [e, t, r]) {
2342
2342
  }
2343
2343
  case "a": {
2344
2344
  const a = n.aev.get(t);
2345
- return fe(a, 2);
2345
+ return ue(a, 2);
2346
2346
  }
2347
2347
  case "av": {
2348
2348
  const a = n.aev.get(t);
@@ -2361,7 +2361,7 @@ function Di(n, [e, t, r]) {
2361
2361
  return a;
2362
2362
  }
2363
2363
  default:
2364
- return fe(n.eav, 3);
2364
+ return ue(n.eav, 3);
2365
2365
  }
2366
2366
  }
2367
2367
  function Ui(n, e, t) {
@@ -2370,13 +2370,13 @@ function Ui(n, e, t) {
2370
2370
  if (!e)
2371
2371
  return r;
2372
2372
  for (const [i, o] of e.entries()) {
2373
- const a = (s = n.eav.get(t)) == null ? void 0 : s.get(o.id), c = fe(a, 1);
2373
+ const a = (s = n.eav.get(t)) == null ? void 0 : s.get(o.id), c = ue(a, 1);
2374
2374
  for (const u of c)
2375
2375
  r[i] = u[2];
2376
2376
  }
2377
2377
  return r;
2378
2378
  }
2379
- function re(n, e, t) {
2379
+ function X(n, e, t) {
2380
2380
  var r;
2381
2381
  return (r = n.forwardIdents.get(e)) == null ? void 0 : r.get(t);
2382
2382
  }
@@ -2425,7 +2425,7 @@ function Ni(n, e, t) {
2425
2425
  });
2426
2426
  }, {
2427
2427
  mark: (s) => {
2428
- if (s instanceof Re)
2428
+ if (s instanceof Me)
2429
2429
  return "immutable";
2430
2430
  }
2431
2431
  });
@@ -2496,11 +2496,11 @@ const Yi = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a
2496
2496
  function ze(n) {
2497
2497
  return typeof n == "string" && Yi.test(n);
2498
2498
  }
2499
- const se = [];
2499
+ const ne = [];
2500
2500
  for (let n = 0; n < 256; ++n)
2501
- se.push((n + 256).toString(16).slice(1));
2501
+ ne.push((n + 256).toString(16).slice(1));
2502
2502
  function Zi(n, e = 0) {
2503
- return (se[n[e + 0]] + se[n[e + 1]] + se[n[e + 2]] + se[n[e + 3]] + "-" + se[n[e + 4]] + se[n[e + 5]] + "-" + se[n[e + 6]] + se[n[e + 7]] + "-" + se[n[e + 8]] + se[n[e + 9]] + "-" + se[n[e + 10]] + se[n[e + 11]] + se[n[e + 12]] + se[n[e + 13]] + se[n[e + 14]] + se[n[e + 15]]).toLowerCase();
2503
+ return (ne[n[e + 0]] + ne[n[e + 1]] + ne[n[e + 2]] + ne[n[e + 3]] + "-" + ne[n[e + 4]] + ne[n[e + 5]] + "-" + ne[n[e + 6]] + ne[n[e + 7]] + "-" + ne[n[e + 8]] + ne[n[e + 9]] + "-" + ne[n[e + 10]] + ne[n[e + 11]] + ne[n[e + 12]] + ne[n[e + 13]] + ne[n[e + 14]] + ne[n[e + 15]]).toLowerCase();
2504
2504
  }
2505
2505
  let Ft;
2506
2506
  const Xi = new Uint8Array(16);
@@ -2541,7 +2541,7 @@ function ro(n, e) {
2541
2541
  function so(n, e) {
2542
2542
  return ro(Xn(n), Xn(e));
2543
2543
  }
2544
- function J() {
2544
+ function B() {
2545
2545
  return no();
2546
2546
  }
2547
2547
  function io(n, e) {
@@ -2590,7 +2590,7 @@ function ho(n, e, t) {
2590
2590
  return n.map((r) => r === e ? t : r);
2591
2591
  }
2592
2592
  function Jr(n, e, t, r, s) {
2593
- const i = re(e, t, s), o = De(e, t, s), a = i || o;
2593
+ const i = X(e, t, s), o = De(e, t, s), a = i || o;
2594
2594
  if (!a)
2595
2595
  throw new Ve(`Could not find attr for ${[t, s]}`);
2596
2596
  if (a["value-type"] !== "ref")
@@ -2679,11 +2679,11 @@ function po(n, e) {
2679
2679
  return e;
2680
2680
  }
2681
2681
  function yo(n, e, t, r, s, i) {
2682
- const o = re(e, t, s), a = De(e, t, s), c = o || a;
2682
+ const o = X(e, t, s), a = De(e, t, s), c = o || a;
2683
2683
  if (!c)
2684
2684
  throw new Ve(`No attr for etype = ${t} label = ${s}`);
2685
2685
  if (i != null && i.hasOwnProperty("$isNull")) {
2686
- const u = re(e, t, "id");
2686
+ const u = X(e, t, "id");
2687
2687
  if (!u)
2688
2688
  throw new Ve(`No attr for etype = ${t} label = id`);
2689
2689
  return [
@@ -2702,8 +2702,8 @@ function yo(n, e, t, r, s, i) {
2702
2702
  }
2703
2703
  function bo(n, e, t, r, s) {
2704
2704
  const [i, o, a] = s.reduce((c, u) => {
2705
- const [l, f, h] = c, [y, b, g] = Jr(n, e, l, f, u);
2706
- return [y, b, [...h, g]];
2705
+ const [l, f, h] = c, [y, b, _] = Jr(n, e, l, f, u);
2706
+ return [y, b, [...h, _]];
2707
2707
  }, [t, r, []]);
2708
2708
  return [i, o, a];
2709
2709
  }
@@ -2789,20 +2789,20 @@ function Oo(n, e, t, { etype: r, level: s, form: i }, o) {
2789
2789
  const a = Object.keys(i).filter((c) => c !== "$");
2790
2790
  return a.length ? Object.entries(o).map(function([u, l]) {
2791
2791
  return a.map(function(y) {
2792
- var g, w, S;
2793
- const b = !!(e.cardinalityInference && ((S = (w = (g = t.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : w[y]) != null && S.isSingular));
2792
+ var _, T, S;
2793
+ const b = !!(e.cardinalityInference && ((S = (T = (_ = t.linkIndex) == null ? void 0 : _[r]) == null ? void 0 : T[y]) != null && S.isSingular));
2794
2794
  try {
2795
- const [_, T, M] = Ao(n, t, r, s, y, u), O = es(e, t, {
2796
- etype: _,
2797
- level: T,
2795
+ const [g, m, P] = Ao(n, t, r, s, y, u), v = es(e, t, {
2796
+ etype: g,
2797
+ level: m,
2798
2798
  form: i[y],
2799
- join: M
2800
- }), F = b ? O[0] : O;
2801
- return { [y]: F };
2802
- } catch (_) {
2803
- if (_ instanceof Ve)
2799
+ join: P
2800
+ }), I = b ? v[0] : v;
2801
+ return { [y]: I };
2802
+ } catch (g) {
2803
+ if (g instanceof Ve)
2804
2804
  return { [y]: b ? void 0 : [] };
2805
- throw _;
2805
+ throw g;
2806
2806
  }
2807
2807
  }).reduce(function(y, b) {
2808
2808
  return { ...y, ...b };
@@ -2843,55 +2843,55 @@ function Io(n, e) {
2843
2843
  }
2844
2844
  function Po(n, e, t) {
2845
2845
  const r = Object.keys(t)[0];
2846
- return re(n, e, r);
2846
+ return X(n, e, r);
2847
2847
  }
2848
- function Mo(n, e, t, r) {
2848
+ function Ro(n, e, t, r) {
2849
2849
  if (t)
2850
2850
  return Io(n, t);
2851
2851
  if (r)
2852
2852
  return Po(n, e, r);
2853
2853
  }
2854
- function Ro(n, e, t) {
2854
+ function Mo(n, e, t) {
2855
2855
  var s, i;
2856
2856
  if (!Array.isArray(t.fields))
2857
2857
  return Li(n, e);
2858
2858
  const r = /* @__PURE__ */ new Map();
2859
2859
  for (const o of t.fields) {
2860
- const a = re(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
2860
+ const a = X(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
2861
2861
  c && vn(a) && r.set(c, a);
2862
2862
  }
2863
2863
  if (!r.has("id")) {
2864
- const o = re(n, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
2864
+ const o = X(n, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
2865
2865
  a && r.set(a, o);
2866
2866
  }
2867
2867
  return r;
2868
2868
  }
2869
2869
  function jo(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
2870
- var g, w;
2871
- const o = (g = i == null ? void 0 : i.$) == null ? void 0 : g.order, a = Xr(i), c = $o(i);
2870
+ var _, T;
2871
+ const o = (_ = i == null ? void 0 : i.$) == null ? void 0 : _.order, a = Xr(i), c = $o(i);
2872
2872
  let u = Hi(n, s);
2873
- const l = r == null ? void 0 : r["start-cursor"], f = r == null ? void 0 : r["end-cursor"], h = Mo(e, t, l, o);
2874
- if (h && ((w = h == null ? void 0 : h["forward-identity"]) == null ? void 0 : w[2]) !== "id") {
2875
- const S = h["checked-data-type"] === "date", _ = h.id;
2876
- u = u.map(([T]) => {
2877
- var O, F, P, C, G;
2878
- let M = (G = (C = (P = (F = (O = n.eav.get(T)) == null ? void 0 : O.get(_)) == null ? void 0 : F.values()) == null ? void 0 : P.next()) == null ? void 0 : C.value) == null ? void 0 : G[2];
2879
- return S && (M = on(M)), [T, M];
2873
+ const l = r == null ? void 0 : r["start-cursor"], f = r == null ? void 0 : r["end-cursor"], h = Ro(e, t, l, o);
2874
+ if (h && ((T = h == null ? void 0 : h["forward-identity"]) == null ? void 0 : T[2]) !== "id") {
2875
+ const S = h["checked-data-type"] === "date", g = h.id;
2876
+ u = u.map(([m]) => {
2877
+ var v, I, x, F, V;
2878
+ let P = (V = (F = (x = (I = (v = n.eav.get(m)) == null ? void 0 : v.get(g)) == null ? void 0 : I.values()) == null ? void 0 : x.next()) == null ? void 0 : F.value) == null ? void 0 : V[2];
2879
+ return S && (P = on(P)), [m, P];
2880
2880
  });
2881
2881
  }
2882
- u.sort(c === "asc" ? function(_, T) {
2883
- return Et(_, T, h == null ? void 0 : h["checked-data-type"]);
2884
- } : function(_, T) {
2885
- return Et(T, _, h == null ? void 0 : h["checked-data-type"]);
2882
+ u.sort(c === "asc" ? function(g, m) {
2883
+ return Et(g, m, h == null ? void 0 : h["checked-data-type"]);
2884
+ } : function(g, m) {
2885
+ return Et(m, g, h == null ? void 0 : h["checked-data-type"]);
2886
2886
  });
2887
2887
  let y = {};
2888
- const b = Ro(e, t, s);
2888
+ const b = Mo(e, t, s);
2889
2889
  for (const S of u) {
2890
- const [_] = S;
2891
- if (y[_] || !a && l && h && ko(l, h, c, S) || !a && f && h && Co(f, h, c, S))
2890
+ const [g] = S;
2891
+ if (y[g] || !a && l && h && ko(l, h, c, S) || !a && f && h && Co(f, h, c, S))
2892
2892
  continue;
2893
- const T = Ui(n, b, _);
2894
- T && (y[_] = T);
2893
+ const m = Ui(n, b, g);
2894
+ m && (y[g] = m);
2895
2895
  }
2896
2896
  return y;
2897
2897
  }
@@ -2906,7 +2906,7 @@ function Xr(n) {
2906
2906
  return !e && !t && !r;
2907
2907
  }
2908
2908
  function xo(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
2909
- var h, y, b, g, w;
2909
+ var h, y, b, _, T;
2910
2910
  if (!Xr(s) && (!o || !o["start-cursor"]))
2911
2911
  return [];
2912
2912
  const a = go(So(e, t, r, (h = s.$) == null ? void 0 : h.where), i), c = vo(It, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = jo(n, e, {
@@ -2914,7 +2914,7 @@ function xo(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
2914
2914
  pageInfo: o,
2915
2915
  form: s,
2916
2916
  dq: { where: a, find: c, fields: u }
2917
- }), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((w = s.$) == null ? void 0 : w.last);
2917
+ }), f = ((b = s.$) == null ? void 0 : b.limit) || ((_ = s.$) == null ? void 0 : _.first) || ((T = s.$) == null ? void 0 : T.last);
2918
2918
  if (f != null) {
2919
2919
  r > 0 && co && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
2920
2920
  const S = Object.entries(l);
@@ -3056,7 +3056,7 @@ function zo(n) {
3056
3056
  function Vo(n, e, t) {
3057
3057
  return t.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
3058
3058
  // before assuming it's a ref lookup.
3059
- !re(n, e, t);
3059
+ !X(n, e, t);
3060
3060
  }
3061
3061
  function cn(n) {
3062
3062
  const [e, t, ...r] = n.split(".");
@@ -3066,8 +3066,8 @@ function cn(n) {
3066
3066
  }
3067
3067
  function Qo(n, e, t) {
3068
3068
  if (!Vo(n, e, t))
3069
- return re(n, e, t);
3070
- const r = cn(t), s = re(n, e, r) || De(n, e, r);
3069
+ return X(n, e, t);
3070
+ const r = cn(t), s = X(n, e, r) || De(n, e, r);
3071
3071
  if (s && s["value-type"] !== "ref")
3072
3072
  throw new Error(`${t} does not reference a valid link attribute.`);
3073
3073
  return s;
@@ -3075,7 +3075,7 @@ function Qo(n, e, t) {
3075
3075
  function un(n) {
3076
3076
  return typeof n == "string" && !kt(n) ? null : typeof n == "string" && kt(n) ? an(n) : zo(n);
3077
3077
  }
3078
- function de(n, e, t) {
3078
+ function le(n, e, t) {
3079
3079
  const r = un(t);
3080
3080
  if (r === null)
3081
3081
  return t;
@@ -3086,52 +3086,52 @@ function de(n, e, t) {
3086
3086
  }
3087
3087
  function ns(n, e, t, r) {
3088
3088
  var o;
3089
- const s = de(n, e, t);
3089
+ const s = le(n, e, t);
3090
3090
  return Array.isArray(s) ? [[
3091
3091
  "add-triple",
3092
3092
  s,
3093
- (o = re(n, e, "id")) == null ? void 0 : o.id,
3093
+ (o = X(n, e, "id")) == null ? void 0 : o.id,
3094
3094
  s
3095
3095
  ]].concat(r) : r;
3096
3096
  }
3097
3097
  function Bo({ attrsStore: n }, [e, t, r]) {
3098
3098
  const s = Object.entries(r).flatMap(([i, o]) => {
3099
- const a = Array.isArray(o) ? o : [o], c = re(n, e, i), u = De(n, e, i);
3099
+ const a = Array.isArray(o) ? o : [o], c = X(n, e, i), u = De(n, e, i);
3100
3100
  return a.map((l) => c ? [
3101
3101
  "add-triple",
3102
- de(n, e, t),
3102
+ le(n, e, t),
3103
3103
  c.id,
3104
3104
  // Uses `!` because if we get here, we should have created the attr if it doesn't
3105
3105
  // already exist
3106
- de(n, c["reverse-identity"][1], l)
3106
+ le(n, c["reverse-identity"][1], l)
3107
3107
  ] : [
3108
3108
  "add-triple",
3109
3109
  // Uses `!` because if we get here, we should have created the attr if it doesn't
3110
3110
  // already exist
3111
- de(n, u["forward-identity"][1], l),
3111
+ le(n, u["forward-identity"][1], l),
3112
3112
  u == null ? void 0 : u.id,
3113
- de(n, e, t)
3113
+ le(n, e, t)
3114
3114
  ]);
3115
3115
  });
3116
3116
  return ns(n, e, t, s);
3117
3117
  }
3118
3118
  function Go({ attrsStore: n }, [e, t, r]) {
3119
3119
  const s = Object.entries(r).flatMap(([i, o]) => {
3120
- const a = Array.isArray(o) ? o : [o], c = re(n, e, i), u = De(n, e, i);
3120
+ const a = Array.isArray(o) ? o : [o], c = X(n, e, i), u = De(n, e, i);
3121
3121
  return a.map((l) => c ? [
3122
3122
  "retract-triple",
3123
- de(n, e, t),
3123
+ le(n, e, t),
3124
3124
  c.id,
3125
3125
  // Uses `!` because if we get here, we should have created the attr if it doesn't
3126
3126
  // already exist
3127
- de(n, c["reverse-identity"][1], l)
3127
+ le(n, c["reverse-identity"][1], l)
3128
3128
  ] : [
3129
3129
  "retract-triple",
3130
3130
  // Uses `!` because if we get here, we should have created the attr if it doesn't
3131
3131
  // already exist
3132
- de(n, u["forward-identity"][1], l),
3132
+ le(n, u["forward-identity"][1], l),
3133
3133
  u.id,
3134
- de(n, e, t)
3134
+ le(n, e, t)
3135
3135
  ]);
3136
3136
  });
3137
3137
  return ns(n, e, t, s);
@@ -3143,7 +3143,7 @@ function Ho(n, e, t, r) {
3143
3143
  for (const a of n || []) {
3144
3144
  const c = a == null ? void 0 : a.aev.get(i);
3145
3145
  if (c) {
3146
- for (const [u, l, f] of fe(c, 2))
3146
+ for (const [u, l, f] of ue(c, 2))
3147
3147
  if (f === o)
3148
3148
  return !0;
3149
3149
  }
@@ -3163,16 +3163,16 @@ function rs({ stores: n, attrsStore: e }, [t, r, s, i]) {
3163
3163
  return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : Ho(n, e, t, r) ? { mode: "update" } : null;
3164
3164
  }
3165
3165
  function Jo(n, e) {
3166
- const { attrsStore: t } = n, [r, s, i, o] = e, a = Tn(i), c = de(t, r, s);
3166
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = Tn(i), c = le(t, r, s);
3167
3167
  return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
3168
- const h = re(t, r, l);
3168
+ const h = X(t, r, l);
3169
3169
  return h["checked-data-type"] === "date" && n.useDateObjects && (f = Ct(f)), ["add-triple", c, h.id, f, { mode: "create" }];
3170
3170
  });
3171
3171
  }
3172
3172
  function Yo(n, e) {
3173
- const { attrsStore: t } = n, [r, s, i, o] = e, a = Tn(i), c = de(t, r, s), u = rs(n, [r, c, i, o]);
3173
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = Tn(i), c = le(t, r, s), u = rs(n, [r, c, i, o]);
3174
3174
  return [["id", c]].concat(Object.entries(a)).map(([f, h]) => {
3175
- const y = re(t, r, f);
3175
+ const y = X(t, r, f);
3176
3176
  return y["checked-data-type"] === "date" && n.useDateObjects && (h = Ct(h)), [
3177
3177
  "add-triple",
3178
3178
  c,
@@ -3183,11 +3183,11 @@ function Yo(n, e) {
3183
3183
  });
3184
3184
  }
3185
3185
  function Zo({ attrsStore: n }, [e, t]) {
3186
- return [["delete-entity", de(n, e, t), e]];
3186
+ return [["delete-entity", le(n, e, t), e]];
3187
3187
  }
3188
3188
  function Xo(n, e) {
3189
- const { attrsStore: t } = n, [r, s, i, o] = e, a = Tn(i), c = de(t, r, s), u = rs(n, [r, c, i, o]), l = Object.entries(a).map(([h, y]) => {
3190
- const b = re(t, r, h);
3189
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = Tn(i), c = le(t, r, s), u = rs(n, [r, c, i, o]), l = Object.entries(a).map(([h, y]) => {
3190
+ const b = X(t, r, h);
3191
3191
  return [
3192
3192
  "deep-merge-triple",
3193
3193
  c,
@@ -3199,13 +3199,13 @@ function Xo(n, e) {
3199
3199
  return [[
3200
3200
  "add-triple",
3201
3201
  c,
3202
- re(t, r, "id").id,
3202
+ X(t, r, "id").id,
3203
3203
  c,
3204
3204
  ...u ? [u] : []
3205
3205
  ]].concat(l);
3206
3206
  }
3207
3207
  function ea({ attrsStore: n }, [e, t, r]) {
3208
- return [["rule-params", de(n, e, t), e, r]];
3208
+ return [["rule-params", le(n, e, t), e, r]];
3209
3209
  }
3210
3210
  function ta(n) {
3211
3211
  const [e, t, r, s, i] = n;
@@ -3261,7 +3261,7 @@ function sa(n, e, t) {
3261
3261
  };
3262
3262
  }
3263
3263
  function pt(n, e, t, r) {
3264
- const s = n ? sa(n, e, t) : null, i = J(), a = [J(), e, t];
3264
+ const s = n ? sa(n, e, t) : null, i = B(), a = [B(), e, t];
3265
3265
  return {
3266
3266
  id: i,
3267
3267
  "forward-identity": a,
@@ -3283,8 +3283,8 @@ function oa(n, e, t) {
3283
3283
  throw new Error(`Couldn't find the link ${e}.${t} in your schema`);
3284
3284
  const { forward: s, reverse: i } = r;
3285
3285
  return {
3286
- "forward-identity": [J(), s.on, s.label],
3287
- "reverse-identity": [J(), i.on, i.label],
3286
+ "forward-identity": [B(), s.on, s.label],
3287
+ "reverse-identity": [B(), i.on, i.label],
3288
3288
  cardinality: s.has === "one" ? "one" : "many",
3289
3289
  "unique?": i.has === "one",
3290
3290
  "on-delete": s.onDelete,
@@ -3292,7 +3292,7 @@ function oa(n, e, t) {
3292
3292
  };
3293
3293
  }
3294
3294
  function sr(n, e, t, r) {
3295
- const s = n ? oa(n, e, t) : null, i = J(), o = [J(), e, t], a = [J(), t, e];
3295
+ const s = n ? oa(n, e, t) : null, i = B(), o = [B(), e, t], a = [B(), t, e];
3296
3296
  return {
3297
3297
  id: i,
3298
3298
  // @ts-ignore: ts thinks it's any[]
@@ -3343,13 +3343,13 @@ function da(n) {
3343
3343
  function ha({ attrsStore: n, schema: e }, t) {
3344
3344
  var h, y;
3345
3345
  const r = /* @__PURE__ */ new Set(), s = [], i = [];
3346
- function o(b, g) {
3347
- return re(n, b, g) || s.find((w) => w["forward-identity"][1] === b && w["forward-identity"][2] === g);
3346
+ function o(b, _) {
3347
+ return X(n, b, _) || s.find((T) => T["forward-identity"][1] === b && T["forward-identity"][2] === _);
3348
3348
  }
3349
- function a(b, g) {
3350
- return De(n, b, g) || s.find((w) => {
3351
- var S, _;
3352
- return ((S = w["reverse-identity"]) == null ? void 0 : S[1]) === b && ((_ = w["reverse-identity"]) == null ? void 0 : _[2]) === g;
3349
+ function a(b, _) {
3350
+ return De(n, b, _) || s.find((T) => {
3351
+ var S, g;
3352
+ return ((S = T["reverse-identity"]) == null ? void 0 : S[1]) === b && ((g = T["reverse-identity"]) == null ? void 0 : g[2]) === _;
3353
3353
  });
3354
3354
  }
3355
3355
  function c(b) {
@@ -3358,55 +3358,55 @@ function ha({ attrsStore: n, schema: e }, t) {
3358
3358
  function u(b) {
3359
3359
  b && "isUnsynced" in b && b.isUnsynced && !r.has(b.id) && (s.push(b), i.push(["add-attr", b]), r.add(b.id));
3360
3360
  }
3361
- function l(b, g) {
3362
- return g.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
3361
+ function l(b, _) {
3362
+ return _.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
3363
3363
  // before assuming it's a ref lookup.
3364
- !o(b, g);
3364
+ !o(b, _);
3365
3365
  }
3366
- function f(b, g) {
3367
- const w = o(b, g), S = a(b, g);
3368
- u(w), u(S), !w && !S && c(sr(e, b, g, fa));
3366
+ function f(b, _) {
3367
+ const T = o(b, _), S = a(b, _);
3368
+ u(T), u(S), !T && !S && c(sr(e, b, _, fa));
3369
3369
  }
3370
3370
  for (const b of t)
3371
- for (const { etype: g, lookupPair: w, linkLabel: S } of da(b)) {
3372
- const _ = w[0];
3371
+ for (const { etype: _, lookupPair: T, linkLabel: S } of da(b)) {
3372
+ const g = T[0];
3373
3373
  if (S) {
3374
- f(g, S);
3375
- const T = o(g, S), M = a(g, S);
3376
- u(T), u(M);
3377
- const O = ((h = T == null ? void 0 : T["reverse-identity"]) == null ? void 0 : h[1]) || ((y = M == null ? void 0 : M["forward-identity"]) == null ? void 0 : y[1]) || S;
3378
- if (l(O, _))
3379
- f(O, cn(_));
3374
+ f(_, S);
3375
+ const m = o(_, S), P = a(_, S);
3376
+ u(m), u(P);
3377
+ const v = ((h = m == null ? void 0 : m["reverse-identity"]) == null ? void 0 : h[1]) || ((y = P == null ? void 0 : P["forward-identity"]) == null ? void 0 : y[1]) || S;
3378
+ if (l(v, g))
3379
+ f(v, cn(g));
3380
3380
  else {
3381
- const F = o(O, _);
3382
- F || c(pt(e, O, _, ln)), u(F);
3381
+ const I = o(v, g);
3382
+ I || c(pt(e, v, g, ln)), u(I);
3383
3383
  }
3384
- } else if (l(g, _))
3385
- f(g, cn(_));
3384
+ } else if (l(_, g))
3385
+ f(_, cn(g));
3386
3386
  else {
3387
- const T = o(g, _);
3388
- T || c(pt(e, g, _, ln)), u(T);
3387
+ const m = o(_, g);
3388
+ m || c(pt(e, _, g, ln)), u(m);
3389
3389
  }
3390
3390
  }
3391
3391
  for (const b of t) {
3392
- const [g, w, S, _] = b;
3393
- if (aa.has(g)) {
3394
- const T = o(w, "id");
3395
- u(T), T || c(pt(e, w, "id", { "unique?": !0 }));
3396
- for (const M of Object.keys(_)) {
3397
- const O = o(w, M);
3398
- if (u(O), ua.has(g) && (O || c(pt(e, w, M, M === "id" ? { "unique?": !0 } : null))), ca.has(g)) {
3399
- const F = a(w, M);
3400
- !O && !F && c(sr(e, w, M)), u(F);
3392
+ const [_, T, S, g] = b;
3393
+ if (aa.has(_)) {
3394
+ const m = o(T, "id");
3395
+ u(m), m || c(pt(e, T, "id", { "unique?": !0 }));
3396
+ for (const P of Object.keys(g)) {
3397
+ const v = o(T, P);
3398
+ if (u(v), ua.has(_) && (v || c(pt(e, T, P, P === "id" ? { "unique?": !0 } : null))), ca.has(_)) {
3399
+ const I = a(T, P);
3400
+ !v && !I && c(sr(e, T, P)), u(I);
3401
3401
  }
3402
3402
  }
3403
3403
  }
3404
3404
  }
3405
3405
  if (s.length) {
3406
3406
  const b = { ...n.attrs };
3407
- for (const g of s)
3408
- b[g.id] = g;
3409
- return [new Re(b, n.linkIndex), i];
3407
+ for (const _ of s)
3408
+ b[_.id] = _;
3409
+ return [new Me(b, n.linkIndex), i];
3410
3410
  }
3411
3411
  return [n, i];
3412
3412
  }
@@ -3594,13 +3594,13 @@ class fn {
3594
3594
  for (const [h, y] of Object.entries(r.objects))
3595
3595
  !t.has(h) && y.updatedAt < o - this._gcOpts.maxAgeMs && (s.push(this._persister.removeItem(h)), delete r.objects[h], i.removed.push(h), i.removedOldCount++);
3596
3596
  const a = Object.entries(r.objects);
3597
- a.sort(([h, y], [b, g]) => y.updatedAt - g.updatedAt);
3597
+ a.sort(([h, y], [b, _]) => y.updatedAt - _.updatedAt);
3598
3598
  const c = a.filter(([h]) => !t.has(h));
3599
3599
  if (a.length > this._gcOpts.maxEntries)
3600
3600
  for (const [h] of c.slice(0, a.length - this._gcOpts.maxEntries))
3601
3601
  s.push(this._persister.removeItem(h)), delete r.objects[h], i.removed.push(h), i.removedThresholdCount++;
3602
3602
  const u = Object.entries(r.objects);
3603
- u.sort(([h, y], [b, g]) => y.updatedAt - g.updatedAt);
3603
+ u.sort(([h, y], [b, _]) => y.updatedAt - _.updatedAt);
3604
3604
  const l = u.filter(([h]) => !t.has(h));
3605
3605
  let f = u.reduce((h, [y, b]) => h + b.size, 0);
3606
3606
  for (; f > 0 && f > this._gcOpts.maxSize && l.length; ) {
@@ -3702,17 +3702,17 @@ async function wa(n, e, t) {
3702
3702
  var l, f, h;
3703
3703
  const a = {};
3704
3704
  for (const [y, b] of Object.entries(r)) {
3705
- const g = typeof b == "string" ? JSON.parse(b) : b;
3706
- if (g.lastAccessed) {
3705
+ const _ = typeof b == "string" ? JSON.parse(b) : b;
3706
+ if (_.lastAccessed) {
3707
3707
  const S = {
3708
- createdAt: g.lastAccessed,
3709
- updatedAt: g.lastAccessed,
3710
- size: ((h = (f = (l = g.result) == null ? void 0 : l.store) == null ? void 0 : f.triples) == null ? void 0 : h.length) ?? 0
3708
+ createdAt: _.lastAccessed,
3709
+ updatedAt: _.lastAccessed,
3710
+ size: ((h = (f = (l = _.result) == null ? void 0 : l.store) == null ? void 0 : f.triples) == null ? void 0 : h.length) ?? 0
3711
3711
  };
3712
3712
  a[y] = S;
3713
3713
  }
3714
- const w = t.put(g, y);
3715
- s.add(w);
3714
+ const T = t.put(_, y);
3715
+ s.add(T);
3716
3716
  }
3717
3717
  const c = { objects: a }, u = t.put(c, qe);
3718
3718
  s.add(u);
@@ -3736,19 +3736,19 @@ async function Ta(n, e) {
3736
3736
  return;
3737
3737
  const r = await new Promise((l, f) => {
3738
3738
  const b = t.transaction(["kv"], "readonly").objectStore("kv").openCursor();
3739
- b.onerror = (w) => {
3740
- f(w);
3739
+ b.onerror = (T) => {
3740
+ f(T);
3741
3741
  };
3742
- const g = [];
3742
+ const _ = [];
3743
3743
  b.onsuccess = () => {
3744
- const w = b.result;
3745
- if (w) {
3746
- const S = w.key, _ = w.value;
3747
- g.push([S, _]), w.continue();
3744
+ const T = b.result;
3745
+ if (T) {
3746
+ const S = T.key, g = T.value;
3747
+ _.push([S, g]), T.continue();
3748
3748
  } else
3749
- l(g);
3750
- }, b.onerror = (w) => {
3751
- f(w);
3749
+ l(_);
3750
+ }, b.onerror = (T) => {
3751
+ f(T);
3752
3752
  };
3753
3753
  }), s = e.transaction(["kv", "querySubs"], "readwrite"), i = s.objectStore("kv"), o = s.objectStore("querySubs"), a = [], c = { objects: {} };
3754
3754
  for (const [l, f] of r)
@@ -3794,7 +3794,11 @@ class ss extends ya {
3794
3794
  r(o);
3795
3795
  }, i.onsuccess = (o) => {
3796
3796
  const c = o.target.result;
3797
- if (s) {
3797
+ if (c.onclose = () => {
3798
+ this._dbPromise = this._init();
3799
+ }, c.onversionchange = () => {
3800
+ c.close();
3801
+ }, s) {
3798
3802
  const u = Ta(this._appId, c).catch((l) => {
3799
3803
  _a("Error upgrading store from version 5 to 6.")(l);
3800
3804
  });
@@ -3813,66 +3817,62 @@ class ss extends ya {
3813
3817
  for (const i of ga)
3814
3818
  s.objectStoreNames.contains(i) || s.createObjectStore(i);
3815
3819
  }
3820
+ // Browsers can close IndexedDB connections unexpectedly (backgrounded tabs,
3821
+ // memory pressure, cross-tab version changes, etc.), causing
3822
+ // `db.transaction()` to throw InvalidStateError. This helper catches that
3823
+ // error and retries once with a fresh connection.
3824
+ async _withRetry(t) {
3825
+ try {
3826
+ const r = await this._dbPromise;
3827
+ return await t(r);
3828
+ } catch (r) {
3829
+ if (r instanceof DOMException && r.name === "InvalidStateError") {
3830
+ this._dbPromise = this._init();
3831
+ const s = await this._dbPromise;
3832
+ return await t(s);
3833
+ }
3834
+ throw r;
3835
+ }
3836
+ }
3816
3837
  async getItem(t) {
3817
- const r = await this._dbPromise;
3818
- return new Promise((s, i) => {
3838
+ return this._withRetry((r) => new Promise((s, i) => {
3819
3839
  const c = r.transaction([this._storeName], "readonly").objectStore(this._storeName).get(t);
3820
- c.onerror = (u) => {
3821
- i(u);
3822
- }, c.onsuccess = (u) => {
3840
+ c.onerror = () => {
3841
+ i(c.error);
3842
+ }, c.onsuccess = () => {
3823
3843
  c.result ? s(c.result) : s(null);
3824
3844
  };
3825
- });
3845
+ }));
3826
3846
  }
3827
3847
  async setItem(t, r) {
3828
- const s = await this._dbPromise;
3829
- return new Promise((i, o) => {
3830
- const u = s.transaction([this._storeName], "readwrite").objectStore(this._storeName).put(r, t);
3831
- u.onerror = (l) => {
3832
- o(l);
3833
- }, u.onsuccess = (l) => {
3834
- i();
3835
- };
3836
- });
3848
+ return this._withRetry((s) => new Promise((i, o) => {
3849
+ const a = s.transaction([this._storeName], "readwrite");
3850
+ a.objectStore(this._storeName).put(r, t), a.oncomplete = () => i(), a.onerror = () => o(a.error), a.onabort = () => o(a.error);
3851
+ }));
3837
3852
  }
3838
- // Performs all writes in a transaction so that all succeed or none succeed.
3839
3853
  async multiSet(t) {
3840
- const r = await this._dbPromise;
3841
- return new Promise((s, i) => {
3842
- const o = r.transaction([this._storeName], "readwrite"), a = o.objectStore(this._storeName), c = /* @__PURE__ */ new Set();
3843
- for (const [u, l] of t) {
3844
- const f = a.put(l, u);
3845
- c.add(f);
3846
- }
3847
- for (const u of c)
3848
- u.onerror = (l) => {
3849
- o.abort(), i(l);
3850
- }, u.onsuccess = (l) => {
3851
- c.delete(u), c.size === 0 && s();
3852
- };
3853
- });
3854
+ return this._withRetry((r) => new Promise((s, i) => {
3855
+ const o = r.transaction([this._storeName], "readwrite"), a = o.objectStore(this._storeName);
3856
+ for (const [c, u] of t)
3857
+ a.put(u, c);
3858
+ o.oncomplete = () => s(), o.onerror = () => i(o.error), o.onabort = () => i(o.error);
3859
+ }));
3854
3860
  }
3855
3861
  async removeItem(t) {
3856
- const r = await this._dbPromise;
3857
- return new Promise((s, i) => {
3858
- const c = r.transaction([this._storeName], "readwrite").objectStore(this._storeName).delete(t);
3859
- c.onerror = (u) => {
3860
- i(u);
3861
- }, c.onsuccess = (u) => {
3862
- s();
3863
- };
3864
- });
3862
+ return this._withRetry((r) => new Promise((s, i) => {
3863
+ const o = r.transaction([this._storeName], "readwrite");
3864
+ o.objectStore(this._storeName).delete(t), o.oncomplete = () => s(), o.onerror = () => i(o.error), o.onabort = () => i(o.error);
3865
+ }));
3865
3866
  }
3866
3867
  async getAllKeys() {
3867
- const t = await this._dbPromise;
3868
- return new Promise((r, s) => {
3868
+ return this._withRetry((t) => new Promise((r, s) => {
3869
3869
  const a = t.transaction([this._storeName], "readonly").objectStore(this._storeName).getAllKeys();
3870
- a.onerror = (c) => {
3871
- s(c);
3872
- }, a.onsuccess = (c) => {
3873
- r(a.result.filter((u) => typeof u == "string"));
3870
+ a.onerror = () => {
3871
+ s(a.error);
3872
+ }, a.onsuccess = () => {
3873
+ r(a.result.filter((c) => typeof c == "string"));
3874
3874
  };
3875
- });
3875
+ }));
3876
3876
  }
3877
3877
  }
3878
3878
  class is {
@@ -3890,20 +3890,20 @@ class is {
3890
3890
  };
3891
3891
  }
3892
3892
  }
3893
- class ie extends Error {
3893
+ class oe extends Error {
3894
3894
  constructor(t, r, s) {
3895
3895
  super(t);
3896
3896
  p(this, "hint");
3897
3897
  p(this, "traceId");
3898
3898
  this.hint = r, s && (this.traceId = s);
3899
3899
  const i = new.target.prototype;
3900
- Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, ie), this.name = "InstantError";
3900
+ Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, oe), this.name = "InstantError";
3901
3901
  }
3902
3902
  get [Symbol.toStringTag]() {
3903
3903
  return "InstantError";
3904
3904
  }
3905
3905
  }
3906
- class Pt extends ie {
3906
+ class Pt extends oe {
3907
3907
  constructor(t) {
3908
3908
  var i;
3909
3909
  const r = ((i = t.body) == null ? void 0 : i.message) || `API Error (${t.status})`;
@@ -3917,19 +3917,19 @@ class Pt extends ie {
3917
3917
  return "InstantAPIError";
3918
3918
  }
3919
3919
  }
3920
- async function we(n, e) {
3920
+ async function me(n, e) {
3921
3921
  const t = await fetch(n, e), r = await t.json();
3922
3922
  return t.status === 200 ? Promise.resolve(r) : Promise.reject(new Pt({ status: t.status, body: r }));
3923
3923
  }
3924
3924
  function Sa({ apiURI: n, appId: e, email: t }) {
3925
- return we(`${n}/runtime/auth/send_magic_code`, {
3925
+ return me(`${n}/runtime/auth/send_magic_code`, {
3926
3926
  method: "POST",
3927
3927
  headers: { "content-type": "application/json" },
3928
3928
  body: JSON.stringify({ "app-id": e, email: t })
3929
3929
  });
3930
3930
  }
3931
3931
  async function va({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, extraFields: i }) {
3932
- return await we(`${n}/runtime/auth/verify_magic_code`, {
3932
+ return await me(`${n}/runtime/auth/verify_magic_code`, {
3933
3933
  method: "POST",
3934
3934
  headers: { "content-type": "application/json" },
3935
3935
  body: JSON.stringify({
@@ -3942,7 +3942,7 @@ async function va({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, ext
3942
3942
  });
3943
3943
  }
3944
3944
  async function Aa({ apiURI: n, appId: e, refreshToken: t }) {
3945
- return await we(`${n}/runtime/auth/verify_refresh_token`, {
3945
+ return await me(`${n}/runtime/auth/verify_refresh_token`, {
3946
3946
  method: "POST",
3947
3947
  headers: { "content-type": "application/json" },
3948
3948
  body: JSON.stringify({
@@ -3952,7 +3952,7 @@ async function Aa({ apiURI: n, appId: e, refreshToken: t }) {
3952
3952
  });
3953
3953
  }
3954
3954
  async function Oa({ apiURI: n, appId: e }) {
3955
- return await we(`${n}/runtime/auth/sign_in_guest`, {
3955
+ return await me(`${n}/runtime/auth/sign_in_guest`, {
3956
3956
  method: "POST",
3957
3957
  headers: { "content-type": "application/json" },
3958
3958
  body: JSON.stringify({
@@ -3961,7 +3961,7 @@ async function Oa({ apiURI: n, appId: e }) {
3961
3961
  });
3962
3962
  }
3963
3963
  async function cr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken: s, extraFields: i }) {
3964
- return await we(`${n}/runtime/oauth/token`, {
3964
+ return await me(`${n}/runtime/oauth/token`, {
3965
3965
  method: "POST",
3966
3966
  headers: { "content-type": "application/json" },
3967
3967
  body: JSON.stringify({
@@ -3974,7 +3974,7 @@ async function cr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken:
3974
3974
  });
3975
3975
  }
3976
3976
  async function Ea({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, refreshToken: i, extraFields: o }) {
3977
- return await we(`${n}/runtime/oauth/id_token`, {
3977
+ return await me(`${n}/runtime/oauth/id_token`, {
3978
3978
  method: "POST",
3979
3979
  headers: { "content-type": "application/json" },
3980
3980
  body: JSON.stringify({
@@ -3988,7 +3988,7 @@ async function Ea({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
3988
3988
  });
3989
3989
  }
3990
3990
  async function ka({ apiURI: n, appId: e, refreshToken: t }) {
3991
- return await we(`${n}/runtime/signout`, {
3991
+ return await me(`${n}/runtime/signout`, {
3992
3992
  method: "POST",
3993
3993
  headers: {
3994
3994
  "content-type": "application/json"
@@ -4006,14 +4006,14 @@ async function Ca({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, cont
4006
4006
  authorization: `Bearer ${s}`,
4007
4007
  "content-type": i || r.type
4008
4008
  };
4009
- return o && (a["content-disposition"] = o), await we(`${n}/storage/upload`, {
4009
+ return o && (a["content-disposition"] = o), await me(`${n}/storage/upload`, {
4010
4010
  method: "PUT",
4011
4011
  headers: a,
4012
4012
  body: r
4013
4013
  });
4014
4014
  }
4015
4015
  async function Ia({ apiURI: n, appId: e, path: t, refreshToken: r }) {
4016
- const { data: s } = await we(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
4016
+ const { data: s } = await me(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
4017
4017
  method: "DELETE",
4018
4018
  headers: {
4019
4019
  "content-type": "application/json",
@@ -4023,7 +4023,7 @@ async function Ia({ apiURI: n, appId: e, path: t, refreshToken: r }) {
4023
4023
  return s;
4024
4024
  }
4025
4025
  async function Pa({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
4026
- const { data: i } = await we(`${n}/storage/signed-upload-url`, {
4026
+ const { data: i } = await me(`${n}/storage/signed-upload-url`, {
4027
4027
  method: "POST",
4028
4028
  headers: {
4029
4029
  "content-type": "application/json",
@@ -4036,7 +4036,7 @@ async function Pa({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata:
4036
4036
  });
4037
4037
  return i;
4038
4038
  }
4039
- async function Ma(n, e) {
4039
+ async function Ra(n, e) {
4040
4040
  return (await fetch(n, {
4041
4041
  method: "PUT",
4042
4042
  body: e,
@@ -4045,8 +4045,8 @@ async function Ma(n, e) {
4045
4045
  }
4046
4046
  })).ok;
4047
4047
  }
4048
- async function Ra({ apiURI: n, appId: e, path: t, refreshToken: r }) {
4049
- const { data: s } = await we(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
4048
+ async function Ma({ apiURI: n, appId: e, path: t, refreshToken: r }) {
4049
+ const { data: s } = await me(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
4050
4050
  method: "GET",
4051
4051
  headers: {
4052
4052
  "content-type": "application/json",
@@ -4133,7 +4133,7 @@ function dr(n) {
4133
4133
  }, e;
4134
4134
  }, {});
4135
4135
  }
4136
- const us = "v1.0.2";
4136
+ const us = "v1.0.3-branch-idb-fix.24363677444.1";
4137
4137
  function xa(n, e) {
4138
4138
  return {
4139
4139
  info: n ? (...t) => console.info(...t, e()) : () => {
@@ -4177,7 +4177,7 @@ class ve {
4177
4177
  });
4178
4178
  }
4179
4179
  }
4180
- class Q extends Error {
4180
+ class K extends Error {
4181
4181
  constructor(e, t) {
4182
4182
  const r = t ? `At path '${t}': ${e}` : e;
4183
4183
  super(r), this.name = "QueryValidationError";
@@ -4214,13 +4214,13 @@ const hr = [
4214
4214
  }, Ua = (n, e, t, r, s, i, o) => {
4215
4215
  const a = i.valueType === "json", c = (u, l, f) => {
4216
4216
  if (!ls(f, l, a))
4217
- throw new Q(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`, o);
4217
+ throw new K(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`, o);
4218
4218
  };
4219
4219
  switch (n) {
4220
4220
  case "in":
4221
4221
  case "$in":
4222
4222
  if (!Array.isArray(e))
4223
- throw new Q(`Operator '${n}' for attribute '${r}' in entity '${s}' must be an array, but received: ${typeof e}`, o);
4223
+ throw new K(`Operator '${n}' for attribute '${r}' in entity '${s}' must be an array, but received: ${typeof e}`, o);
4224
4224
  for (const u of e)
4225
4225
  c(n, t, u);
4226
4226
  break;
@@ -4235,13 +4235,13 @@ const hr = [
4235
4235
  case "$like":
4236
4236
  case "$ilike":
4237
4237
  if (c(n, "string", e), n === "$ilike" && !i.isIndexed)
4238
- throw new Q(`Operator '${n}' can only be used with indexed attributes, but '${r}' in entity '${s}' is not indexed`, o);
4238
+ throw new K(`Operator '${n}' can only be used with indexed attributes, but '${r}' in entity '${s}' is not indexed`, o);
4239
4239
  break;
4240
4240
  case "$isNull":
4241
4241
  c(n, "boolean", e);
4242
4242
  break;
4243
4243
  default:
4244
- throw new Q(`Unknown operator '${n}' for attribute '${r}' in entity '${s}'`, o);
4244
+ throw new K(`Unknown operator '${n}' for attribute '${r}' in entity '${s}'`, o);
4245
4245
  }
4246
4246
  }, We = (n, e, t, r, s) => {
4247
4247
  const i = Da(t), o = t.valueType === "json";
@@ -4252,42 +4252,42 @@ const hr = [
4252
4252
  for (const [u, l] of Object.entries(c))
4253
4253
  Ua(u, l, i, e, r, t, `${s}.${u}`);
4254
4254
  } else if (!ls(n, i, o))
4255
- throw new Q(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof n}`, s);
4255
+ throw new K(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof n}`, s);
4256
4256
  }, La = (n, e, t, r, s) => {
4257
4257
  const i = n.split(".");
4258
4258
  if (i.length < 2)
4259
- throw new Q(`Invalid dot notation path '${n}'. Must contain at least one dot.`, s);
4259
+ throw new K(`Invalid dot notation path '${n}'. Must contain at least one dot.`, s);
4260
4260
  let o = t;
4261
4261
  for (let l = 0; l < i.length - 1; l++) {
4262
4262
  const f = i[l], h = r.entities[o];
4263
4263
  if (!h)
4264
- throw new Q(`Entity '${o}' does not exist in schema while traversing dot notation path '${n}'.`, s);
4264
+ throw new K(`Entity '${o}' does not exist in schema while traversing dot notation path '${n}'.`, s);
4265
4265
  const y = h.links[f];
4266
4266
  if (!y) {
4267
4267
  const b = Object.keys(h.links);
4268
- throw new Q(`Link '${f}' does not exist on entity '${o}' in dot notation path '${n}'. Available links: ${b.length > 0 ? b.join(", ") : "none"}`, s);
4268
+ throw new K(`Link '${f}' does not exist on entity '${o}' in dot notation path '${n}'. Available links: ${b.length > 0 ? b.join(", ") : "none"}`, s);
4269
4269
  }
4270
4270
  o = y.entityName;
4271
4271
  }
4272
4272
  const a = i[i.length - 1], c = r.entities[o];
4273
4273
  if (!c)
4274
- throw new Q(`Target entity '${o}' does not exist in schema for dot notation path '${n}'.`, s);
4274
+ throw new K(`Target entity '${o}' does not exist in schema for dot notation path '${n}'.`, s);
4275
4275
  if (a === "id") {
4276
4276
  if (typeof e == "string" && !ze(e))
4277
- throw new Q(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
4277
+ throw new K(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
4278
4278
  We(e, n, new ve("string", !1, !0), t, s);
4279
4279
  return;
4280
4280
  }
4281
4281
  const u = c.attrs[a];
4282
4282
  if (Object.keys(c.links).includes(a)) {
4283
4283
  if (typeof e == "string" && !ze(e))
4284
- throw new Q(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
4284
+ throw new K(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
4285
4285
  We(e, n, new ve("string", !1, !0), t, s);
4286
4286
  return;
4287
4287
  }
4288
4288
  if (!u) {
4289
4289
  const l = Object.keys(c.attrs);
4290
- throw new Q(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${n}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
4290
+ throw new K(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${n}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
4291
4291
  }
4292
4292
  We(e, n, u, t, s);
4293
4293
  }, fs = (n, e, t, r) => {
@@ -4312,13 +4312,13 @@ const hr = [
4312
4312
  const a = o.attrs[s], c = o.links[s];
4313
4313
  if (!a && !c) {
4314
4314
  const u = Object.keys(o.attrs), l = Object.keys(o.links);
4315
- throw new Q(`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}`);
4315
+ throw new K(`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}`);
4316
4316
  }
4317
4317
  if (a)
4318
4318
  We(i, s, a, e, `${r}.${s}`);
4319
4319
  else if (c) {
4320
4320
  if (typeof i == "string" && !ze(i))
4321
- throw new Q(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
4321
+ throw new K(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
4322
4322
  const u = new ve("string", !1, !0);
4323
4323
  We(i, s, u, e, `${r}.${s}`);
4324
4324
  }
@@ -4326,7 +4326,7 @@ const hr = [
4326
4326
  }, Fa = (n, e, t, r, s = 0) => {
4327
4327
  for (const o of Object.keys(n))
4328
4328
  if (!hr.includes(o))
4329
- throw new Q(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${hr.join(", ")}. Found: ${o}`, r);
4329
+ throw new K(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${hr.join(", ")}. Found: ${o}`, r);
4330
4330
  const i = [
4331
4331
  // 'limit', // only supported client side
4332
4332
  "offset",
@@ -4339,21 +4339,21 @@ const hr = [
4339
4339
  ];
4340
4340
  for (const o of i)
4341
4341
  if (n[o] !== void 0 && s > 0)
4342
- throw new Q(`'${o}' can only be used on top-level namespaces. It cannot be used in nested queries.`, r);
4342
+ throw new K(`'${o}' can only be used on top-level namespaces. It cannot be used in nested queries.`, r);
4343
4343
  if (n.where && t) {
4344
4344
  if (typeof n.where != "object" || n.where === null)
4345
- throw new Q(`'where' clause must be an object in entity '${e}', but received: ${typeof n.where}`, r ? `${r}.where` : void 0);
4345
+ throw new K(`'where' clause must be an object in entity '${e}', but received: ${typeof n.where}`, r ? `${r}.where` : void 0);
4346
4346
  fs(n.where, e, t, r ? `${r}.where` : "where");
4347
4347
  }
4348
4348
  }, ds = (n, e, t, r, s = 0) => {
4349
4349
  var i;
4350
4350
  if (!n || typeof n != "object")
4351
- throw new Q(`Query part for entity '${e}' must be an object, but received: ${typeof n}`, r);
4351
+ throw new K(`Query part for entity '${e}' must be an object, but received: ${typeof n}`, r);
4352
4352
  for (const o of Object.keys(n))
4353
4353
  if (o !== "$") {
4354
4354
  if (t && !(o in t.entities[e].links)) {
4355
4355
  const c = Object.keys(t.entities[e].links);
4356
- throw new Q(`Link '${o}' does not exist on entity '${e}'. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${o}`);
4356
+ throw new K(`Link '${o}' does not exist on entity '${e}'. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${o}`);
4357
4357
  }
4358
4358
  const a = n[o];
4359
4359
  if (typeof a == "object" && a !== null) {
@@ -4363,35 +4363,35 @@ const hr = [
4363
4363
  } else {
4364
4364
  const a = n[o];
4365
4365
  if (typeof a != "object" || a === null)
4366
- throw new Q(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
4366
+ throw new K(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
4367
4367
  Fa(a, e, t, `${r}.$`, s);
4368
4368
  }
4369
4369
  }, pr = (n, e) => {
4370
4370
  if (typeof n != "object" || n === null)
4371
- throw new Q(`Query must be an object, but received: ${typeof n}${n === null ? " (null)" : ""}`);
4371
+ throw new K(`Query must be an object, but received: ${typeof n}${n === null ? " (null)" : ""}`);
4372
4372
  if (Array.isArray(n))
4373
- throw new Q(`Query must be an object, but received: ${typeof n}`);
4373
+ throw new K(`Query must be an object, but received: ${typeof n}`);
4374
4374
  const t = n;
4375
4375
  for (const r of Object.keys(t)) {
4376
4376
  if (Array.isArray(n[r]))
4377
- throw new Q(`Query keys must be strings, but found key of type: ${typeof r}`, r);
4377
+ throw new K(`Query keys must be strings, but found key of type: ${typeof r}`, r);
4378
4378
  if (typeof r != "string")
4379
- throw new Q(`Query keys must be strings, but found key of type: ${typeof r}`, r);
4379
+ throw new K(`Query keys must be strings, but found key of type: ${typeof r}`, r);
4380
4380
  if (r !== "$$ruleParams") {
4381
4381
  if (e && !e.entities[r]) {
4382
4382
  const s = Object.keys(e.entities);
4383
- throw new Q(`Entity '${r}' does not exist in schema. Available entities: ${s.length > 0 ? s.join(", ") : "none"}`, r);
4383
+ throw new K(`Entity '${r}' does not exist in schema. Available entities: ${s.length > 0 ? s.join(", ") : "none"}`, r);
4384
4384
  }
4385
4385
  ds(t[r], r, e, r, 0);
4386
4386
  }
4387
4387
  }
4388
4388
  }, yr = (n) => typeof n != "string" ? !1 : kt(n) ? !0 : ze(n);
4389
- class be extends Error {
4389
+ class ye extends Error {
4390
4390
  constructor(e) {
4391
4391
  super(e), this.name = "TransactionValidationError";
4392
4392
  }
4393
4393
  }
4394
- const hs = (n) => n.length > 0 ? n.join(", ") : "none", Na = (n, e) => new be(`Entity '${n}' does not exist in schema. Available entities: ${hs(e)}`), Nt = {
4394
+ const hs = (n) => n.length > 0 ? n.join(", ") : "none", Na = (n, e) => new ye(`Entity '${n}' does not exist in schema. Available entities: ${hs(e)}`), Nt = {
4395
4395
  string: (n) => typeof n == "string",
4396
4396
  number: (n) => typeof n == "number" && !isNaN(n),
4397
4397
  boolean: (n) => typeof n == "boolean",
@@ -4408,30 +4408,30 @@ const hs = (n) => n.length > 0 ? n.join(", ") : "none", Na = (n, e) => new be(`E
4408
4408
  }, Kt = (n, e, t) => {
4409
4409
  const r = ps(n, t);
4410
4410
  if (typeof e != "object" || e === null)
4411
- throw new be(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
4411
+ throw new ye(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
4412
4412
  for (const [s, i] of Object.entries(e)) {
4413
4413
  if (s === "id")
4414
4414
  continue;
4415
4415
  const o = r.attrs[s];
4416
4416
  if (o && !Ka(i, o))
4417
- throw new be(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
4417
+ throw new ye(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
4418
4418
  }
4419
4419
  }, br = (n, e, t) => {
4420
4420
  const r = ps(n, t);
4421
4421
  if (typeof e != "object" || e === null)
4422
- throw new be(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
4422
+ throw new ye(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
4423
4423
  for (const [s, i] of Object.entries(e)) {
4424
4424
  if (!r.links[s]) {
4425
4425
  const a = Object.keys(r.links);
4426
- throw new be(`Link '${s}' does not exist on entity '${n}'. Available links: ${hs(a)}`);
4426
+ throw new ye(`Link '${s}' does not exist on entity '${n}'. Available links: ${hs(a)}`);
4427
4427
  }
4428
4428
  if (i != null) {
4429
4429
  if (Array.isArray(i)) {
4430
4430
  for (const a of i)
4431
4431
  if (!yr(a))
4432
- throw new be(`Invalid entity ID in link '${s}' for entity '${n}'. Expected a UUID or a lookup, but received: ${a}`);
4432
+ throw new ye(`Invalid entity ID in link '${s}' for entity '${n}'. Expected a UUID or a lookup, but received: ${a}`);
4433
4433
  } else if (!yr(i))
4434
- throw new be(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
4434
+ throw new ye(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
4435
4435
  }
4436
4436
  }
4437
4437
  }, qa = {
@@ -4447,21 +4447,21 @@ const hs = (n) => n.length > 0 ? n.join(", ") : "none", Na = (n, e) => new be(`E
4447
4447
  return;
4448
4448
  const [t, r, s, i] = n;
4449
4449
  if (!Array.isArray(s) && !ze(s))
4450
- throw new be(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
4450
+ throw new ye(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
4451
4451
  if (typeof r != "string")
4452
- throw new be(`Entity name must be a string, but received: ${typeof r}`);
4452
+ throw new ye(`Entity name must be a string, but received: ${typeof r}`);
4453
4453
  const o = qa[t];
4454
4454
  o && i !== void 0 && o(r, i, e);
4455
4455
  }, za = (n, e) => {
4456
4456
  const t = Array.isArray(n) ? n : [n];
4457
4457
  for (const r of t) {
4458
4458
  if (!r || typeof r != "object")
4459
- throw new be(`Transaction chunk must be an object, but received: ${typeof r}`);
4459
+ throw new ye(`Transaction chunk must be an object, but received: ${typeof r}`);
4460
4460
  if (!Array.isArray(r.__ops))
4461
- throw new be(`Transaction chunk must have __ops array, but received: ${typeof r.__ops}`);
4461
+ throw new ye(`Transaction chunk must have __ops array, but received: ${typeof r.__ops}`);
4462
4462
  for (const s of r.__ops) {
4463
4463
  if (!Array.isArray(s))
4464
- throw new be(`Transaction operation must be an array, but received: ${typeof s}`);
4464
+ throw new ye(`Transaction operation must be an array, but received: ${typeof s}`);
4465
4465
  Wa(s, e);
4466
4466
  }
4467
4467
  }
@@ -4636,7 +4636,7 @@ function qt(n, e, t) {
4636
4636
  }
4637
4637
  function _r(n, e, t, r) {
4638
4638
  var o;
4639
- const s = (o = re(t, n.table, "id")) == null ? void 0 : o.id;
4639
+ const s = (o = X(t, n.table, "id")) == null ? void 0 : o.id;
4640
4640
  if (!s)
4641
4641
  return -1;
4642
4642
  const i = Qe(e.eav, [r, s, r]);
@@ -4685,7 +4685,7 @@ function Ja(n, e) {
4685
4685
  var r;
4686
4686
  if (n.orderFieldType)
4687
4687
  return n.orderFieldType;
4688
- const t = n.orderField === "serverCreatedAt" ? "number" : (r = re(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
4688
+ const t = n.orderField === "serverCreatedAt" ? "number" : (r = X(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
4689
4689
  return n.orderFieldType = t, t;
4690
4690
  }
4691
4691
  function Ya(n, e, t) {
@@ -4744,7 +4744,7 @@ class Za {
4744
4744
  this.subs.flush();
4745
4745
  }
4746
4746
  subscribe(e, t) {
4747
- const r = ne(e);
4747
+ const r = Z(e);
4748
4748
  return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(t), this.initSubscription(e, r, t), (s) => {
4749
4749
  this.unsubscribe(r, t, s == null ? void 0 : s.keepSubscription);
4750
4750
  };
@@ -4760,7 +4760,7 @@ class Za {
4760
4760
  }
4761
4761
  }
4762
4762
  sendStart(e) {
4763
- this.trySend(J(), {
4763
+ this.trySend(B(), {
4764
4764
  op: "start-sync",
4765
4765
  q: e
4766
4766
  });
@@ -4774,7 +4774,7 @@ class Za {
4774
4774
  });
4775
4775
  }
4776
4776
  sendRemove(e, t) {
4777
- this.trySend(J(), {
4777
+ this.trySend(B(), {
4778
4778
  op: "remove-sync",
4779
4779
  "subscription-id": e.subscriptionId,
4780
4780
  "keep-subscription": t
@@ -4812,7 +4812,7 @@ class Za {
4812
4812
  }
4813
4813
  }
4814
4814
  onStartSyncOk(e) {
4815
- const t = e["subscription-id"], r = e.q, s = ne(r);
4815
+ const t = e["subscription-id"], r = e.q, s = Z(r);
4816
4816
  this.idToHash[t] = s, this.subs.updateInPlace((i) => {
4817
4817
  const o = i[s];
4818
4818
  if (!o)
@@ -4906,9 +4906,9 @@ class Za {
4906
4906
  continue;
4907
4907
  i.txId = a["tx-id"];
4908
4908
  const c = [], u = {};
4909
- for (const w of a.changes) {
4910
- const S = u[w.triple[0]] ?? [];
4911
- u[w.triple[0]] = S, S.push(w);
4909
+ for (const T of a.changes) {
4910
+ const S = u[T.triple[0]] ?? [];
4911
+ u[T.triple[0]] = S, S.push(T);
4912
4912
  }
4913
4913
  const l = s.values ?? {
4914
4914
  entities: [],
@@ -4916,44 +4916,44 @@ class Za {
4916
4916
  }, f = l.entities;
4917
4917
  s.values = l;
4918
4918
  const h = [];
4919
- e: for (const [w, S] of Object.entries(u))
4920
- for (let _ = 0; _ < f.length; _++) {
4921
- const T = f[_];
4922
- if (Ci(T.store, w)) {
4923
- mr(T.store, l.attrsStore, S);
4924
- const M = qt(s, T.store, l.attrsStore), O = Ha(T.store, l.attrsStore, S)[w];
4925
- M ? (h.push({
4926
- oldEntity: T.entity,
4927
- newEntity: M,
4928
- changedFields: O || {}
4929
- }), T.entity = M) : c.push(_), delete u[w];
4919
+ e: for (const [T, S] of Object.entries(u))
4920
+ for (let g = 0; g < f.length; g++) {
4921
+ const m = f[g];
4922
+ if (Ci(m.store, T)) {
4923
+ mr(m.store, l.attrsStore, S);
4924
+ const P = qt(s, m.store, l.attrsStore), v = Ha(m.store, l.attrsStore, S)[T];
4925
+ P ? (h.push({
4926
+ oldEntity: m.entity,
4927
+ newEntity: P,
4928
+ changedFields: v || {}
4929
+ }), m.entity = P) : c.push(g), delete u[T];
4930
4930
  continue e;
4931
4931
  }
4932
4932
  }
4933
4933
  const y = [];
4934
- for (const [w, S] of Object.entries(u)) {
4935
- const _ = this.createStore([]);
4936
- mr(_, l.attrsStore, S);
4937
- const T = qt(s, _, l.attrsStore);
4938
- if (!T) {
4934
+ for (const [T, S] of Object.entries(u)) {
4935
+ const g = this.createStore([]);
4936
+ mr(g, l.attrsStore, S);
4937
+ const m = qt(s, g, l.attrsStore);
4938
+ if (!m) {
4939
4939
  this.log.error("No entity found after applying change", {
4940
4940
  sub: s,
4941
4941
  changes: S,
4942
- store: _
4942
+ store: g
4943
4943
  });
4944
4944
  continue;
4945
4945
  }
4946
4946
  f.push({
4947
- store: _,
4948
- entity: T,
4949
- serverCreatedAt: _r(s, _, l.attrsStore, T.id)
4950
- }), y.push(T);
4947
+ store: g,
4948
+ entity: m,
4949
+ serverCreatedAt: _r(s, g, l.attrsStore, m.id)
4950
+ }), y.push(m);
4951
4951
  }
4952
4952
  const b = [];
4953
- for (const w of c.sort().reverse())
4954
- b.push(f[w].entity), f.splice(w, 1);
4955
- const g = Ja(s, this.getAttrs);
4956
- Ya(s, g, f), this.notifyCbs(r, {
4953
+ for (const T of c.sort().reverse())
4954
+ b.push(f[T].entity), f.splice(T, 1);
4955
+ const _ = Ja(s, this.getAttrs);
4956
+ Ya(s, _, f), this.notifyCbs(r, {
4957
4957
  type: Ie.SyncTransaction,
4958
4958
  data: yt(s, (o = s.values) == null ? void 0 : o.entities),
4959
4959
  added: y,
@@ -4977,7 +4977,7 @@ class Za {
4977
4977
  }
4978
4978
  }
4979
4979
  onStartSyncError(e) {
4980
- const t = ne(e["original-event"].q), r = {
4980
+ const t = Z(e["original-event"].q), r = {
4981
4981
  message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
4982
4982
  status: e.status,
4983
4983
  type: e.type,
@@ -4997,197 +4997,197 @@ class Za {
4997
4997
  function Xa({ WStream: n, opts: e, startStream: t, appendStream: r, registerStream: s }) {
4998
4998
  const i = e.clientId;
4999
4999
  let o = null, a = null, c = null;
5000
- const u = J();
5000
+ const u = B();
5001
5001
  let l = !1, f = !1;
5002
5002
  const h = [], y = [], b = [];
5003
- let g = !1, w = 0, S = 0;
5004
- const _ = [], T = new TextEncoder();
5005
- function M() {
5003
+ let _ = !1, T = 0, S = 0;
5004
+ const g = [], m = new TextEncoder();
5005
+ function P() {
5006
5006
  f = !0;
5007
- for (const A of h)
5008
- A(a ?? void 0);
5007
+ for (const O of h)
5008
+ O(a ?? void 0);
5009
5009
  }
5010
- function O(A) {
5011
- return h.push(A), f && A(a ?? void 0), () => {
5012
- const k = h.indexOf(A);
5010
+ function v(O) {
5011
+ return h.push(O), f && O(a ?? void 0), () => {
5012
+ const k = h.indexOf(O);
5013
5013
  k !== -1 && h.splice(k, 1);
5014
5014
  };
5015
5015
  }
5016
- function F(A) {
5017
- return b.push(A), () => {
5018
- const k = b.indexOf(A);
5016
+ function I(O) {
5017
+ return b.push(O), () => {
5018
+ const k = b.indexOf(O);
5019
5019
  k !== -1 && b.splice(k, 1);
5020
5020
  };
5021
5021
  }
5022
- e.waitUntil && e.waitUntil(new Promise((A) => {
5023
- b.push(A);
5022
+ e.waitUntil && e.waitUntil(new Promise((O) => {
5023
+ b.push(O);
5024
5024
  }));
5025
- function P() {
5026
- for (const A of b)
5025
+ function x() {
5026
+ for (const O of b)
5027
5027
  try {
5028
- A();
5028
+ O();
5029
5029
  } catch {
5030
5030
  }
5031
5031
  }
5032
- function C(A) {
5033
- return y.push(A), o && A(o), () => {
5034
- const k = y.indexOf(A);
5032
+ function F(O) {
5033
+ return y.push(O), o && O(o), () => {
5034
+ const k = y.indexOf(O);
5035
5035
  k !== -1 && y.splice(k, 1);
5036
5036
  };
5037
5037
  }
5038
- function G(A) {
5039
- o = A;
5038
+ function V(O) {
5039
+ o = O;
5040
5040
  for (const k of y)
5041
5041
  k(o);
5042
5042
  }
5043
- function N() {
5044
- g = !0;
5043
+ function fe() {
5044
+ _ = !0;
5045
5045
  }
5046
- function B(A) {
5047
- let k = w, K = 0, H = 0;
5048
- for (const { byteLen: Y } of _) {
5049
- const oe = k + Y;
5050
- if (oe > A)
5046
+ function we(O) {
5047
+ let k = T, U = 0, z = 0;
5048
+ for (const { byteLen: G } of g) {
5049
+ const re = k + G;
5050
+ if (re > O)
5051
5051
  break;
5052
- k = oe, K++, H += Y;
5052
+ k = re, U++, z += G;
5053
5053
  }
5054
- K > 0 && (w += H, S -= H, _.splice(0, K));
5054
+ U > 0 && (T += z, S -= z, g.splice(0, U));
5055
5055
  }
5056
- function z(A, k) {
5057
- a = k, M(), A.error(k), P();
5056
+ function ee(O, k) {
5057
+ a = k, P(), O.error(k), x();
5058
5058
  }
5059
- async function ee() {
5060
- const A = await t({
5059
+ async function te() {
5060
+ const O = await t({
5061
5061
  clientId: i,
5062
5062
  reconnectToken: u,
5063
5063
  ruleParams: e.ruleParams
5064
5064
  });
5065
- switch (A.type) {
5065
+ switch (O.type) {
5066
5066
  case "ok": {
5067
- const { streamId: k, offset: K } = A;
5068
- o = k, B(K), _.length && r({
5067
+ const { streamId: k, offset: U } = O;
5068
+ o = k, we(U), g.length && r({
5069
5069
  streamId: k,
5070
- chunks: _.map((H) => H.chunk),
5071
- offset: w
5072
- }), g = !1;
5070
+ chunks: g.map((z) => z.chunk),
5071
+ offset: T
5072
+ }), _ = !1;
5073
5073
  break;
5074
5074
  }
5075
5075
  case "disconnect": {
5076
- N();
5076
+ fe();
5077
5077
  break;
5078
5078
  }
5079
5079
  case "error": {
5080
- c && z(c, A.error);
5080
+ c && ee(c, O.error);
5081
5081
  break;
5082
5082
  }
5083
5083
  }
5084
5084
  }
5085
- function q() {
5086
- N(), ee();
5085
+ function Q() {
5086
+ fe(), te();
5087
5087
  }
5088
- function E({ offset: A, done: k }) {
5089
- B(A), k && (l = !0, P());
5088
+ function E({ offset: O, done: k }) {
5089
+ we(O), k && (l = !0, x());
5090
5090
  }
5091
- function j(A) {
5092
- return l ? (z(A, new ie("Stream has been closed.")), null) : o || (z(A, new ie("Stream has not been initialized.")), null);
5091
+ function R(O) {
5092
+ return l ? (ee(O, new oe("Stream has been closed.")), null) : o || (ee(O, new oe("Stream has not been initialized.")), null);
5093
5093
  }
5094
- async function R(A) {
5095
- c = A;
5096
- let k = !0, K = 0;
5094
+ async function M(O) {
5095
+ c = O;
5096
+ let k = !0, U = 0;
5097
5097
  for (; k; ) {
5098
- let H = Date.now() + Math.min(15e3, 500 * (K - 1));
5098
+ let z = Date.now() + Math.min(15e3, 500 * (U - 1));
5099
5099
  k = !1;
5100
- const Y = await t({
5100
+ const G = await t({
5101
5101
  clientId: e.clientId,
5102
5102
  reconnectToken: u,
5103
5103
  ruleParams: e.ruleParams
5104
5104
  });
5105
- switch (Y.type) {
5105
+ switch (G.type) {
5106
5106
  case "ok": {
5107
- const { streamId: oe, offset: Be } = Y;
5107
+ const { streamId: re, offset: Be } = G;
5108
5108
  if (Be !== 0) {
5109
- const ge = new ie("Write stream is corrupted");
5110
- z(A, ge);
5109
+ const be = new oe("Write stream is corrupted");
5110
+ ee(O, be);
5111
5111
  return;
5112
5112
  }
5113
- G(oe), s(oe, {
5114
- onDisconnect: N,
5113
+ V(re), s(re, {
5114
+ onDisconnect: fe,
5115
5115
  onFlush: E,
5116
- onConnectionReconnect: ee,
5117
- onAppendFailed: q
5118
- }), g = !1;
5116
+ onConnectionReconnect: te,
5117
+ onAppendFailed: Q
5118
+ }), _ = !1;
5119
5119
  return;
5120
5120
  }
5121
5121
  case "disconnect": {
5122
- k = !0, N(), K++, await new Promise((oe) => {
5123
- setTimeout(oe, Math.max(0, H - Date.now()));
5122
+ k = !0, fe(), U++, await new Promise((re) => {
5123
+ setTimeout(re, Math.max(0, z - Date.now()));
5124
5124
  });
5125
5125
  break;
5126
5126
  }
5127
5127
  case "error": {
5128
- z(A, Y.error);
5128
+ ee(O, G.error);
5129
5129
  return;
5130
5130
  }
5131
5131
  }
5132
5132
  }
5133
5133
  }
5134
- class U extends n {
5135
- constructor(k, K) {
5136
- super(k, K);
5134
+ class q extends n {
5135
+ constructor(k, U) {
5136
+ super(k, U);
5137
5137
  }
5138
5138
  async streamId() {
5139
- return o || new Promise((k, K) => {
5140
- const H = [], Y = () => {
5141
- for (const ge of H)
5142
- ge();
5143
- }, oe = (ge) => {
5144
- k(ge), Y();
5145
- }, Be = (ge) => {
5146
- K(ge || new ie("Stream is closed.")), Y();
5139
+ return o || new Promise((k, U) => {
5140
+ const z = [], G = () => {
5141
+ for (const be of z)
5142
+ be();
5143
+ }, re = (be) => {
5144
+ k(be), G();
5145
+ }, Be = (be) => {
5146
+ U(be || new oe("Stream is closed.")), G();
5147
5147
  };
5148
- H.push(C(oe)), H.push(O(Be));
5148
+ z.push(F(re)), z.push(v(Be));
5149
5149
  });
5150
5150
  }
5151
5151
  }
5152
5152
  return {
5153
- stream: new U({
5153
+ stream: new q({
5154
5154
  // TODO(dww): accept a storage so that write streams can survive across
5155
5155
  // browser restarts
5156
- async start(A) {
5156
+ async start(O) {
5157
5157
  try {
5158
- await R(A);
5158
+ await M(O);
5159
5159
  } catch (k) {
5160
- z(A, k);
5160
+ ee(O, k);
5161
5161
  }
5162
5162
  },
5163
- write(A, k) {
5164
- const K = j(k);
5165
- if (K) {
5166
- const H = T.encode(A).length;
5167
- _.push({ chunk: A, byteLen: H });
5168
- const Y = w + S;
5169
- S += H, g || r({ streamId: K, chunks: [A], offset: Y });
5163
+ write(O, k) {
5164
+ const U = R(k);
5165
+ if (U) {
5166
+ const z = m.encode(O).length;
5167
+ g.push({ chunk: O, byteLen: z });
5168
+ const G = T + S;
5169
+ S += z, _ || r({ streamId: U, chunks: [O], offset: G });
5170
5170
  }
5171
5171
  },
5172
5172
  close() {
5173
5173
  o ? r({
5174
5174
  streamId: o,
5175
5175
  chunks: [],
5176
- offset: w + S,
5176
+ offset: T + S,
5177
5177
  isDone: !0
5178
- }) : P(), M();
5178
+ }) : x(), P();
5179
5179
  },
5180
- abort(A) {
5180
+ abort(O) {
5181
5181
  o ? r({
5182
5182
  streamId: o,
5183
5183
  chunks: [],
5184
- offset: w + S,
5184
+ offset: T + S,
5185
5185
  isDone: !0,
5186
- abortReason: A
5187
- }) : P(), M();
5186
+ abortReason: O
5187
+ }) : x(), P();
5188
5188
  }
5189
5189
  }),
5190
- addCompleteCb: F,
5190
+ addCompleteCb: I,
5191
5191
  closed() {
5192
5192
  return f;
5193
5193
  }
@@ -5231,155 +5231,123 @@ function tc({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
5231
5231
  let s = e.byteOffset || 0, i = !1;
5232
5232
  const o = new TextDecoder("utf-8"), a = new TextEncoder();
5233
5233
  let c, u = !1;
5234
- const l = [], f = [];
5235
- let h = null, y = null;
5236
- function b(P) {
5234
+ const l = [];
5235
+ function f() {
5237
5236
  u = !0;
5238
- for (const C of l)
5239
- C(P);
5237
+ for (const g of l)
5238
+ g();
5240
5239
  }
5241
- function g(P) {
5242
- return l.push(P), () => {
5243
- const C = l.indexOf(P);
5244
- C !== -1 && l.splice(C, 1);
5240
+ function h(g) {
5241
+ return l.push(g), () => {
5242
+ const m = l.indexOf(g);
5243
+ m !== -1 && l.splice(m, 1);
5245
5244
  };
5246
5245
  }
5247
- function w(P) {
5248
- return f.push(P), h && P(h), () => {
5249
- const C = f.indexOf(P);
5250
- C !== -1 && f.splice(C, 1);
5251
- };
5246
+ function y(g, m) {
5247
+ g.error(m), f();
5252
5248
  }
5253
- function S(P, C) {
5254
- y = C, P.error(C), b(C);
5255
- }
5256
- let _ = 0;
5257
- async function T(P, C) {
5258
- c = J();
5259
- const G = { ...P || {}, eventId: c };
5260
- for await (const N of t(G)) {
5249
+ let b = 0;
5250
+ async function _(g, m) {
5251
+ c = B();
5252
+ const P = { ...g || {}, eventId: c };
5253
+ for await (const v of t(P)) {
5261
5254
  if (i)
5262
5255
  return;
5263
- if (N.type === "reconnect")
5256
+ if (v.type === "reconnect")
5264
5257
  return { retry: !0 };
5265
- if (N.type === "error") {
5266
- S(C, N.error);
5258
+ if (v.type === "error") {
5259
+ y(m, v.error);
5267
5260
  return;
5268
5261
  }
5269
- if (N.offset > s) {
5270
- S(C, new ie("Stream is corrupted.")), i = !0;
5262
+ if (v.offset > s) {
5263
+ y(m, new oe("Stream is corrupted.")), i = !0;
5271
5264
  return;
5272
5265
  }
5273
- h = N.streamId;
5274
- for (const z of f)
5275
- z(h);
5276
- let B = s - N.offset;
5277
- if (N.files && N.files.length) {
5278
- const z = new AbortController();
5279
- let ee = fetch(N.files[0].url, {
5280
- signal: z.signal
5266
+ let I = s - v.offset;
5267
+ if (v.files && v.files.length) {
5268
+ const x = new AbortController();
5269
+ let F = fetch(v.files[0].url, {
5270
+ signal: x.signal
5281
5271
  });
5282
- for (let q = 0; q < N.files.length; q++) {
5283
- const E = N.files[q + 1], R = await ee;
5284
- if (E && (ee = fetch(E.url, { signal: z.signal })), !R.ok) {
5285
- if (_++, _ > 10) {
5286
- S(C, new ie("Unable to process stream."));
5272
+ for (let V = 0; V < v.files.length; V++) {
5273
+ const fe = v.files[V + 1], ee = await F;
5274
+ if (fe && (F = fetch(fe.url, { signal: x.signal })), !ee.ok) {
5275
+ if (b++, b > 10) {
5276
+ y(m, new oe("Unable to process stream."));
5287
5277
  return;
5288
5278
  }
5289
5279
  return { retry: !0 };
5290
5280
  }
5291
- if (R.body) {
5292
- const U = R.body.getReader();
5281
+ if (ee.body) {
5282
+ const te = ee.body.getReader();
5293
5283
  try {
5294
5284
  for (; ; ) {
5295
- const { done: L, value: A } = await U.read();
5296
- if (L)
5285
+ const { done: Q, value: E } = await te.read();
5286
+ if (Q)
5297
5287
  break;
5298
5288
  if (i) {
5299
- z.abort();
5289
+ x.abort();
5300
5290
  return;
5301
5291
  }
5302
- let k = A;
5303
- if (B > 0 && (k = A.subarray(B), B -= A.length - k.length), !k.length)
5292
+ let R = E;
5293
+ if (I > 0 && (R = E.subarray(I), I -= E.length - R.length), !R.length)
5304
5294
  continue;
5305
- s += k.length;
5306
- const K = o.decode(k);
5307
- C.enqueue(K);
5295
+ s += R.length;
5296
+ const M = o.decode(R);
5297
+ m.enqueue(M);
5308
5298
  }
5309
5299
  } finally {
5310
- U.releaseLock();
5300
+ te.releaseLock();
5311
5301
  }
5312
5302
  } else {
5313
- const U = await R.arrayBuffer();
5314
- let L = U;
5303
+ const te = await ee.arrayBuffer();
5304
+ let Q = te;
5315
5305
  if (i) {
5316
- z.abort();
5306
+ x.abort();
5317
5307
  return;
5318
5308
  }
5319
- if (B > 0 && (L = new Uint8Array(U).subarray(B), B -= U.byteLength - L.length), !L.byteLength)
5309
+ if (I > 0 && (Q = new Uint8Array(te).subarray(I), I -= te.byteLength - Q.length), !Q.byteLength)
5320
5310
  continue;
5321
- s += L.byteLength;
5322
- const A = o.decode(L);
5323
- C.enqueue(A);
5311
+ s += Q.byteLength;
5312
+ const E = o.decode(Q);
5313
+ m.enqueue(E);
5324
5314
  }
5325
5315
  }
5326
5316
  }
5327
- if (_ = 0, N.content) {
5328
- let z = N.content, ee = a.encode(N.content);
5329
- if (B > 0) {
5330
- const q = ee.subarray(B);
5331
- if (B -= ee.length - q.length, !q.length)
5317
+ if (b = 0, v.content) {
5318
+ let x = v.content, F = a.encode(v.content);
5319
+ if (I > 0) {
5320
+ const V = F.subarray(I);
5321
+ if (I -= F.length - V.length, !V.length)
5332
5322
  continue;
5333
- ee = q, z = o.decode(q);
5323
+ F = V, x = o.decode(V);
5334
5324
  }
5335
- s += ee.length, C.enqueue(z);
5325
+ s += F.length, m.enqueue(x);
5336
5326
  }
5337
5327
  }
5338
5328
  }
5339
- async function M(P) {
5340
- let C = !0, G = 0;
5341
- for (; C; ) {
5342
- C = !1;
5343
- let N = Date.now() + Math.min(15e3, 500 * (G - 1));
5344
- const B = await T({ ...e, offset: s }, P);
5345
- B != null && B.retry && (C = !0, G++, N < Date.now() - 3e5 && (G = 0), await new Promise((z) => {
5346
- setTimeout(z, Math.max(0, N - Date.now()));
5329
+ async function T(g) {
5330
+ let m = !0, P = 0;
5331
+ for (; m; ) {
5332
+ m = !1;
5333
+ let v = Date.now() + Math.min(15e3, 500 * (P - 1));
5334
+ const I = await _({ ...e, offset: s }, g);
5335
+ I != null && I.retry && (m = !0, P++, v < Date.now() - 3e5 && (P = 0), await new Promise((x) => {
5336
+ setTimeout(x, Math.max(0, v - Date.now()));
5347
5337
  }));
5348
5338
  }
5349
- !i && !u && (P.close(), b());
5350
- }
5351
- class O extends n {
5352
- constructor(C, G) {
5353
- super(C, G);
5354
- }
5355
- async streamId() {
5356
- if (h)
5357
- return h;
5358
- if (y)
5359
- throw y;
5360
- return new Promise((C, G) => {
5361
- const N = [], B = () => {
5362
- for (const q of N)
5363
- q();
5364
- }, z = (q) => {
5365
- C(q), B();
5366
- }, ee = (q) => {
5367
- G(q || new ie("Stream is closed.")), B();
5368
- };
5369
- N.push(w(z)), N.push(g(ee));
5370
- });
5371
- }
5339
+ !i && !u && (g.close(), f());
5372
5340
  }
5373
5341
  return {
5374
- stream: new O({
5375
- start(P) {
5376
- M(P);
5342
+ stream: new n({
5343
+ start(g) {
5344
+ T(g);
5377
5345
  },
5378
- cancel(P) {
5379
- i = !0, c && r({ eventId: c }), b();
5346
+ cancel(g) {
5347
+ i = !0, c && r({ eventId: c }), f();
5380
5348
  }
5381
5349
  }),
5382
- addCloseCb: g,
5350
+ addCloseCb: h,
5383
5351
  closed() {
5384
5352
  return u;
5385
5353
  }
@@ -5421,7 +5389,7 @@ class nc {
5421
5389
  }), t;
5422
5390
  }
5423
5391
  startWriteStream(e) {
5424
- const t = J();
5392
+ const t = B();
5425
5393
  let r = null;
5426
5394
  const s = new Promise((o) => {
5427
5395
  r = o;
@@ -5445,7 +5413,7 @@ class nc {
5445
5413
  offset: s,
5446
5414
  done: !!r
5447
5415
  };
5448
- i && (o["abort-reason"] = i), this.trySend(J(), o);
5416
+ i && (o["abort-reason"] = i), this.trySend(B(), o);
5449
5417
  }
5450
5418
  onAppendFailed(e) {
5451
5419
  const t = this.writeStreams[e["stream-id"]];
@@ -5480,9 +5448,10 @@ class nc {
5480
5448
  op: "unsubscribe-stream",
5481
5449
  "subscribe-event-id": e
5482
5450
  };
5483
- this.trySend(J(), t), delete this.readStreamIterators[e];
5451
+ this.trySend(B(), t), delete this.readStreamIterators[e];
5484
5452
  }
5485
5453
  onStreamAppend(e) {
5454
+ var s;
5486
5455
  const t = e["client-event-id"], r = this.readStreamIterators[t];
5487
5456
  if (!r) {
5488
5457
  this.log.info("No iterator for read stream", e);
@@ -5491,16 +5460,15 @@ class nc {
5491
5460
  if (e.error) {
5492
5461
  e.retry ? r.push({ type: "reconnect" }) : r.push({
5493
5462
  type: "error",
5494
- error: new ie(e.error)
5463
+ error: new oe(e.error)
5495
5464
  }), r.close(), delete this.readStreamIterators[t];
5496
5465
  return;
5497
5466
  }
5498
- r.push({
5467
+ ((s = e.files) != null && s.length || e.content) && r.push({
5499
5468
  type: "append",
5500
5469
  offset: e.offset,
5501
5470
  files: e.files,
5502
- content: e.content,
5503
- streamId: e["stream-id"]
5471
+ content: e.content
5504
5472
  }), e.done && (r.close(), delete this.readStreamIterators[t]);
5505
5473
  }
5506
5474
  onConnectionStatusChange(e) {
@@ -5529,7 +5497,7 @@ class nc {
5529
5497
  const r = e["client-event-id"], s = this.startWriteStreamCbs[r];
5530
5498
  s && (s({
5531
5499
  type: "error",
5532
- error: new ie(e.message || "Unknown error", e.hint)
5500
+ error: new oe(e.message || "Unknown error", e.hint)
5533
5501
  }), delete this.startWriteStreamCbs[r]);
5534
5502
  break;
5535
5503
  }
@@ -5537,7 +5505,7 @@ class nc {
5537
5505
  const r = e["client-event-id"], s = this.readStreamIterators[r];
5538
5506
  s && (s.push({
5539
5507
  type: "error",
5540
- error: new ie(e.message || "Unknown error", e.hint)
5508
+ error: new oe(e.message || "Unknown error", e.hint)
5541
5509
  }), s.close(), delete this.readStreamIterators[r]);
5542
5510
  break;
5543
5511
  }
@@ -5712,7 +5680,7 @@ class yc {
5712
5680
  // Queries
5713
5681
  p(this, "getPreviousResult", (e) => {
5714
5682
  var r;
5715
- const t = ne(e);
5683
+ const t = Z(e);
5716
5684
  return (r = this.dataForQuery(t)) == null ? void 0 : r.data;
5717
5685
  });
5718
5686
  /** Re-run instaql and call all callbacks with new data */
@@ -5755,7 +5723,7 @@ class yc {
5755
5723
  * @returns
5756
5724
  */
5757
5725
  p(this, "pushOps", (e, t) => {
5758
- const r = J(), s = [...this._pendingMutations().values()], i = Math.max(0, ...s.map((c) => c.order || 0)) + 1, o = {
5726
+ const r = B(), s = [...this._pendingMutations().values()], i = Math.max(0, ...s.map((c) => c.order || 0)) + 1, o = {
5759
5727
  op: "transact",
5760
5728
  "tx-steps": e,
5761
5729
  created: Date.now(),
@@ -5776,7 +5744,7 @@ class yc {
5776
5744
  }
5777
5745
  this._log.info("[socket][open]", this._transport.id), this._setStatus(Te.OPENED), this.getCurrentUser().then((r) => {
5778
5746
  var s;
5779
- this._trySend(J(), {
5747
+ this._trySend(B(), {
5780
5748
  op: "init",
5781
5749
  "app-id": this.config.appId,
5782
5750
  "refresh-token": (s = r.user) == null ? void 0 : s.refresh_token,
@@ -5966,7 +5934,7 @@ class yc {
5966
5934
  status: o ?? 0
5967
5935
  }));
5968
5936
  } else
5969
- s.reject(new ie((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint));
5937
+ s.reject(new oe((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint));
5970
5938
  }
5971
5939
  _setStatus(e, t) {
5972
5940
  this.status = e, this._errorMessage = t, this.notifyConnectionStatusSubs(e), this._instantStream.onConnectionStatusChange(e);
@@ -5990,7 +5958,7 @@ class yc {
5990
5958
  _addQueryData(e, t, r) {
5991
5959
  if (!this.attrs)
5992
5960
  throw new Error("Attrs in reactor have not been set");
5993
- const s = ne(e), i = this.ensureAttrs(), o = et(this.attrs, t.triples, r, this.config.useDateObjects);
5961
+ const s = Z(e), i = this.ensureAttrs(), o = et(this.attrs, t.triples, r, this.config.useDateObjects);
5994
5962
  this.querySubs.updateInPlace((a) => {
5995
5963
  a[s] = {
5996
5964
  result: {
@@ -6011,33 +5979,33 @@ class yc {
6011
5979
  case "init-ok": {
6012
5980
  this._setStatus(Te.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(t.attrs), this._flushPendingMessages(), this._sessionId = t["session-id"];
6013
5981
  for (const y of Object.keys(this._rooms)) {
6014
- 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;
6015
- this._tryJoinRoom(g, y, b);
5982
+ const b = (i = (s = this._presence[y]) == null ? void 0 : s.result) == null ? void 0 : i.user, _ = (o = this._rooms[y]) == null ? void 0 : o.roomType;
5983
+ this._tryJoinRoom(_, y, b);
6016
5984
  }
6017
5985
  break;
6018
5986
  }
6019
5987
  case "add-query-exists": {
6020
- this.notifyOneQueryOnce(ne(t.q));
5988
+ this.notifyOneQueryOnce(Z(t.q));
6021
5989
  break;
6022
5990
  }
6023
5991
  case "add-query-ok": {
6024
- const { q: y, result: b } = t, g = ne(y);
6025
- if (!this._hasQueryListeners() && !this.querySubs.currentValue[g])
5992
+ const { q: y, result: b } = t, _ = Z(y);
5993
+ if (!this._hasQueryListeners() && !this.querySubs.currentValue[_])
6026
5994
  break;
6027
- 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, _ = fr(b), T = this.ensureAttrs(), M = et(T, _, r, this.config.useDateObjects);
6028
- this.querySubs.updateInPlace((O) => {
6029
- if (!O[g]) {
6030
- this._log.info("Missing value in querySubs", { hash: g, q: y });
5995
+ const T = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, g = fr(b), m = this.ensureAttrs(), P = et(m, g, r, this.config.useDateObjects);
5996
+ this.querySubs.updateInPlace((v) => {
5997
+ if (!v[_]) {
5998
+ this._log.info("Missing value in querySubs", { hash: _, q: y });
6031
5999
  return;
6032
6000
  }
6033
- O[g].result = {
6034
- store: M,
6035
- attrsStore: T,
6036
- pageInfo: w,
6001
+ v[_].result = {
6002
+ store: P,
6003
+ attrsStore: m,
6004
+ pageInfo: T,
6037
6005
  aggregate: S,
6038
6006
  processedTxId: t["processed-tx-id"]
6039
6007
  };
6040
- }), this._cleanupPendingMutationsQueries(), this.notifyOne(g), this.notifyOneQueryOnce(g), this._cleanupPendingMutationsTimeout();
6008
+ }), this._cleanupPendingMutationsQueries(), this.notifyOne(_), this.notifyOneQueryOnce(_), this._cleanupPendingMutationsTimeout();
6041
6009
  break;
6042
6010
  }
6043
6011
  case "start-sync-ok": {
@@ -6073,65 +6041,65 @@ class yc {
6073
6041
  break;
6074
6042
  }
6075
6043
  case "refresh-ok": {
6076
- const { computations: y, attrs: b } = t, g = t["processed-tx-id"];
6044
+ const { computations: y, attrs: b } = t, _ = t["processed-tx-id"];
6077
6045
  b && this._setAttrs(b), this._cleanupPendingMutationsTimeout();
6078
- const w = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), g);
6079
- w !== this._pendingMutations() && this.kv.updateInPlace((T) => {
6080
- T.pendingMutations = w;
6046
+ const T = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), _);
6047
+ T !== this._pendingMutations() && this.kv.updateInPlace((m) => {
6048
+ m.pendingMutations = T;
6081
6049
  });
6082
- const S = Vt(w.entries()), _ = y.map((T) => {
6083
- var q, E, j, R;
6084
- const M = T["instaql-query"], O = T["instaql-result"], F = ne(M), P = fr(O), C = this.ensureAttrs(), G = et(C, P, r, this.config.useDateObjects), { store: N, attrsStore: B } = this._applyOptimisticUpdates(G, C, S, g), z = (E = (q = O == null ? void 0 : O[0]) == null ? void 0 : q.data) == null ? void 0 : E["page-info"], ee = (R = (j = O == null ? void 0 : O[0]) == null ? void 0 : j.data) == null ? void 0 : R.aggregate;
6050
+ const S = Vt(T.entries()), g = y.map((m) => {
6051
+ var Q, E, R, M;
6052
+ const P = m["instaql-query"], v = m["instaql-result"], I = Z(P), x = fr(v), F = this.ensureAttrs(), V = et(F, x, r, this.config.useDateObjects), { store: fe, attrsStore: we } = this._applyOptimisticUpdates(V, F, S, _), ee = (E = (Q = v == null ? void 0 : v[0]) == null ? void 0 : Q.data) == null ? void 0 : E["page-info"], te = (M = (R = v == null ? void 0 : v[0]) == null ? void 0 : R.data) == null ? void 0 : M.aggregate;
6085
6053
  return {
6086
- q: M,
6087
- hash: F,
6088
- store: N,
6089
- attrsStore: B,
6090
- pageInfo: z,
6091
- aggregate: ee
6054
+ q: P,
6055
+ hash: I,
6056
+ store: fe,
6057
+ attrsStore: we,
6058
+ pageInfo: ee,
6059
+ aggregate: te
6092
6060
  };
6093
6061
  });
6094
- _.forEach(({ hash: T, q: M, store: O, attrsStore: F, pageInfo: P, aggregate: C }) => {
6095
- this.querySubs.updateInPlace((G) => {
6096
- if (!G[T]) {
6097
- this._log.error("Missing value in querySubs", { hash: T, q: M });
6062
+ g.forEach(({ hash: m, q: P, store: v, attrsStore: I, pageInfo: x, aggregate: F }) => {
6063
+ this.querySubs.updateInPlace((V) => {
6064
+ if (!V[m]) {
6065
+ this._log.error("Missing value in querySubs", { hash: m, q: P });
6098
6066
  return;
6099
6067
  }
6100
- G[T].result = {
6101
- store: O,
6102
- attrsStore: F,
6103
- pageInfo: P,
6104
- aggregate: C,
6105
- processedTxId: g
6068
+ V[m].result = {
6069
+ store: v,
6070
+ attrsStore: I,
6071
+ pageInfo: x,
6072
+ aggregate: F,
6073
+ processedTxId: _
6106
6074
  };
6107
6075
  });
6108
- }), this._cleanupPendingMutationsQueries(), _.forEach(({ hash: T }) => {
6109
- this.notifyOne(T);
6076
+ }), this._cleanupPendingMutationsQueries(), g.forEach(({ hash: m }) => {
6077
+ this.notifyOne(m);
6110
6078
  });
6111
6079
  break;
6112
6080
  }
6113
6081
  case "transact-ok": {
6114
6082
  const { "client-event-id": y, "tx-id": b } = t;
6115
6083
  this._inFlightMutationEventIds.delete(y);
6116
- const w = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations()).get(y);
6117
- if (!w)
6084
+ const T = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations()).get(y);
6085
+ if (!T)
6118
6086
  break;
6119
- this._updatePendingMutations((_) => {
6120
- _.set(y, {
6121
- ..._.get(y),
6087
+ this._updatePendingMutations((g) => {
6088
+ g.set(y, {
6089
+ ...g.get(y),
6122
6090
  "tx-id": b,
6123
6091
  confirmed: Date.now()
6124
6092
  });
6125
6093
  });
6126
6094
  const S = [];
6127
- for (const _ of w["tx-steps"])
6128
- if (_[0] === "add-attr") {
6129
- const T = _[1];
6130
- S.push(T);
6095
+ for (const g of T["tx-steps"])
6096
+ if (g[0] === "add-attr") {
6097
+ const m = g[1];
6098
+ S.push(m);
6131
6099
  }
6132
6100
  if (S.length) {
6133
- const _ = Object.values(this.ensureAttrs().attrs);
6134
- this._setAttrs([..._, ...S]);
6101
+ const g = Object.values(this.ensureAttrs().attrs);
6102
+ this._setAttrs([...g, ...S]);
6135
6103
  }
6136
6104
  this._finishTransaction("synced", y), this._cleanupPendingMutationsTimeout();
6137
6105
  break;
@@ -6221,8 +6189,8 @@ class yc {
6221
6189
  return;
6222
6190
  }
6223
6191
  if ((a = e["original-event"]) != null && a.hasOwnProperty("q") && ((c = e["original-event"]) == null ? void 0 : c.op) === "add-query") {
6224
- const y = (u = e["original-event"]) == null ? void 0 : u.q, b = ne(y);
6225
- this.notifyQueryError(ne(y), s), this.notifyQueryOnceError(y, b, t, s);
6192
+ const y = (u = e["original-event"]) == null ? void 0 : u.q, b = Z(y);
6193
+ this.notifyQueryError(Z(y), s), this.notifyQueryOnceError(y, b, t, s);
6226
6194
  return;
6227
6195
  }
6228
6196
  if (((l = e["original-event"]) == null ? void 0 : l.op) === "init") {
@@ -6260,10 +6228,10 @@ class yc {
6260
6228
  i && (i.dfd.reject(s), this._completeQueryOnce(e, t, i.dfd));
6261
6229
  }
6262
6230
  _setAttrs(e) {
6263
- this.attrs = new Re(e.reduce((t, r) => (t[r.id] = r, t), {}), this._linkIndex), this.notifyAttrsSubs();
6231
+ this.attrs = new Me(e.reduce((t, r) => (t[r.id] = r, t), {}), this._linkIndex), this.notifyAttrsSubs();
6264
6232
  }
6265
6233
  _startQuerySub(e, t) {
6266
- const r = J();
6234
+ const r = B();
6267
6235
  return this.querySubs.updateInPlace((s) => {
6268
6236
  s[t] = s[t] || { q: e, result: null, eventId: r }, s[t].lastAccessed = Date.now();
6269
6237
  }), this._trySendAuthed(r, { op: "add-query", q: e }), r;
@@ -6283,7 +6251,7 @@ class yc {
6283
6251
  */
6284
6252
  subscribeQuery(e, t, r) {
6285
6253
  this.config.disableValidation || pr(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
6286
- const s = ne(e), i = this.getPreviousResult(e);
6254
+ const s = Z(e), i = this.getPreviousResult(e);
6287
6255
  return i && t(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: t }), this._startQuerySub(e, s), () => {
6288
6256
  this._unsubQuery(e, s, t);
6289
6257
  };
@@ -6295,7 +6263,7 @@ class yc {
6295
6263
  return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
6296
6264
  if (!this.querySubs)
6297
6265
  return r.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), r.promise;
6298
- const s = ne(e), i = this._startQuerySub(e, s);
6266
+ const s = Z(e), i = this._startQuerySub(e, s);
6299
6267
  return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")), rc), r.promise;
6300
6268
  }
6301
6269
  _completeQueryOnce(e, t, r) {
@@ -6309,7 +6277,7 @@ class yc {
6309
6277
  return !!((t = this.queryCbs[e]) != null && t.length || (r = this.queryOnceDfds[e]) != null && r.length);
6310
6278
  }
6311
6279
  _cleanupQuery(e, t) {
6312
- this._hasQueryListeners(t) || (delete this.queryCbs[t], delete this.queryOnceDfds[t], delete this._dataForQueryCache[t], this.querySubs.unloadKey(t), this._trySendAuthed(J(), { op: "remove-query", q: e }));
6280
+ this._hasQueryListeners(t) || (delete this.queryCbs[t], delete this.queryOnceDfds[t], delete this._dataForQueryCache[t], this.querySubs.unloadKey(t), this._trySendAuthed(B(), { op: "remove-query", q: e }));
6313
6281
  }
6314
6282
  // When we `pushTx`, it's possible that we don't yet have `this.attrs`
6315
6283
  // This means that `tx-steps` in `pendingMutations` will include `add-attr`
@@ -6335,7 +6303,7 @@ class yc {
6335
6303
  return /* @__PURE__ */ new Map();
6336
6304
  const s = (l) => {
6337
6305
  const [f, h, y] = l["forward-identity"];
6338
- return re(e, h, y);
6306
+ return X(e, h, y);
6339
6307
  }, i = (l) => {
6340
6308
  const [f, h, y] = l["forward-identity"];
6341
6309
  return De(e, h, y);
@@ -6346,15 +6314,15 @@ class yc {
6346
6314
  for (const y of l) {
6347
6315
  const [b] = y;
6348
6316
  if (b === "add-attr") {
6349
- const [w, S] = y, _ = s(S);
6350
- if (_ && S.id !== _.id) {
6351
- o.attrIdMap[S.id] = _.id, a = !0;
6317
+ const [T, S] = y, g = s(S);
6318
+ if (g && S.id !== g.id) {
6319
+ o.attrIdMap[S.id] = g.id, a = !0;
6352
6320
  continue;
6353
6321
  }
6354
6322
  if (S["value-type"] === "ref") {
6355
- const T = i(S);
6356
- if (T) {
6357
- o.attrIdMap[S.id] = T.id, o.refSwapAttrIds.add(S.id), a = !0;
6323
+ const m = i(S);
6324
+ if (m) {
6325
+ o.attrIdMap[S.id] = m.id, o.refSwapAttrIds.add(S.id), a = !0;
6358
6326
  continue;
6359
6327
  }
6360
6328
  }
@@ -6363,8 +6331,8 @@ class yc {
6363
6331
  a = !0;
6364
6332
  continue;
6365
6333
  }
6366
- const g = a ? Wo(o, y) : y;
6367
- h.push(g);
6334
+ const _ = a ? Wo(o, y) : y;
6335
+ h.push(_);
6368
6336
  }
6369
6337
  return a ? h : l;
6370
6338
  }, u = /* @__PURE__ */ new Map();
@@ -6394,13 +6362,13 @@ class yc {
6394
6362
  r.push(u);
6395
6363
  }
6396
6364
  if (!t.size && !r.length)
6397
- return this.attrs || new Re({}, this._linkIndex);
6365
+ return this.attrs || new Me({}, this._linkIndex);
6398
6366
  const s = { ...((o = this.attrs) == null ? void 0 : o.attrs) || {} };
6399
6367
  for (const a of r)
6400
6368
  s[a.id] = a;
6401
6369
  for (const a of t)
6402
6370
  delete s[a];
6403
- return new Re(s, this._linkIndex);
6371
+ return new Me(s, this._linkIndex);
6404
6372
  }
6405
6373
  /** Runs instaql on a query and a store */
6406
6374
  dataForQuery(e, t = !0) {
@@ -6416,10 +6384,10 @@ class yc {
6416
6384
  if (l && s === l.querySubVersion && o === l.pendingMutationsVersion)
6417
6385
  return l;
6418
6386
  let f = u.store, h = u.attrsStore;
6419
- const { pageInfo: y, aggregate: b, processedTxId: g } = u, w = this._rewriteMutationsSorted(h, a);
6387
+ const { pageInfo: y, aggregate: b, processedTxId: _ } = u, T = this._rewriteMutationsSorted(h, a);
6420
6388
  if (t) {
6421
- const _ = this._applyOptimisticUpdates(f, h, w, g);
6422
- f = _.store, h = _.attrsStore;
6389
+ const g = this._applyOptimisticUpdates(f, h, T, _);
6390
+ f = g.store, h = g.attrsStore;
6423
6391
  }
6424
6392
  return { data: ts({ store: f, attrsStore: h, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
6425
6393
  }
@@ -6567,7 +6535,7 @@ class yc {
6567
6535
  const r = await this.kv.waitForKeyToLoad(t);
6568
6536
  if (r)
6569
6537
  return r;
6570
- const s = J();
6538
+ const s = B();
6571
6539
  return this.kv.updateInPlace((i) => {
6572
6540
  i[t] || (i[t] = s);
6573
6541
  }), await this.kv.waitForKeyToLoad(t);
@@ -6654,7 +6622,7 @@ class yc {
6654
6622
  async getAuth() {
6655
6623
  const { user: e, error: t } = await this.getCurrentUser();
6656
6624
  if (t)
6657
- throw new ie("Could not get current user: " + t.message);
6625
+ throw new oe("Could not get current user: " + t.message);
6658
6626
  return e ?? null;
6659
6627
  }
6660
6628
  subscribeConnectionStatus(e) {
@@ -6947,14 +6915,14 @@ class yc {
6947
6915
  i.result.user = o, s.isConnected && (this._trySetPresence(t, o), this._notifyPresenceSubs(t));
6948
6916
  }
6949
6917
  _trySetPresence(e, t) {
6950
- this._trySendAuthed(J(), {
6918
+ this._trySendAuthed(B(), {
6951
6919
  op: "set-presence",
6952
6920
  "room-id": e,
6953
6921
  data: t
6954
6922
  });
6955
6923
  }
6956
6924
  _tryJoinRoom(e, t, r) {
6957
- this._trySendAuthed(J(), {
6925
+ this._trySendAuthed(B(), {
6958
6926
  op: "join-room",
6959
6927
  "room-type": e,
6960
6928
  "room-id": t,
@@ -6962,7 +6930,7 @@ class yc {
6962
6930
  }), delete this._roomsPendingLeave[t];
6963
6931
  }
6964
6932
  _tryLeaveRoom(e) {
6965
- this._trySendAuthed(J(), { op: "leave-room", "room-id": e });
6933
+ this._trySendAuthed(B(), { op: "leave-room", "room-id": e });
6966
6934
  }
6967
6935
  _trySetRoomConnected(e, t) {
6968
6936
  const r = this._rooms[e];
@@ -7036,7 +7004,7 @@ class yc {
7036
7004
  }
7037
7005
  }
7038
7006
  _tryBroadcast(e, t, r, s) {
7039
- this._trySendAuthed(J(), {
7007
+ this._trySendAuthed(B(), {
7040
7008
  op: "client-broadcast",
7041
7009
  "room-id": e,
7042
7010
  roomType: t,
@@ -7053,8 +7021,8 @@ class yc {
7053
7021
  _notifyBroadcastSubs(e, t, r) {
7054
7022
  var s, i, o;
7055
7023
  (o = (i = (s = this._broadcastSubs) == null ? void 0 : s[e]) == null ? void 0 : i[t]) == null || o.forEach((a) => {
7056
- var l, f, h, y, b, g;
7057
- const c = (l = r.data) == null ? void 0 : l.data, u = r.data["peer-id"] === this._sessionId ? (h = (f = this._presence[e]) == null ? void 0 : f.result) == null ? void 0 : h.user : (g = (b = (y = this._presence[e]) == null ? void 0 : y.result) == null ? void 0 : b.peers) == null ? void 0 : g[r.data["peer-id"]];
7024
+ var l, f, h, y, b, _;
7025
+ const c = (l = r.data) == null ? void 0 : l.data, u = r.data["peer-id"] === this._sessionId ? (h = (f = this._presence[e]) == null ? void 0 : f.result) == null ? void 0 : h.user : (_ = (b = (y = this._presence[e]) == null ? void 0 : y.result) == null ? void 0 : b.peers) == null ? void 0 : _[r.data["peer-id"]];
7058
7026
  return a(c, u);
7059
7027
  });
7060
7028
  }
@@ -7092,12 +7060,12 @@ class yc {
7092
7060
  fileName: i,
7093
7061
  refreshToken: s
7094
7062
  });
7095
- return await Ma(o, t);
7063
+ return await Ra(o, t);
7096
7064
  }
7097
7065
  async getDownloadUrl(e) {
7098
7066
  var i;
7099
7067
  const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token;
7100
- return await Ra({
7068
+ return await Ma({
7101
7069
  apiURI: this.config.apiURI,
7102
7070
  appId: this.config.appId,
7103
7071
  path: e,
@@ -7242,200 +7210,200 @@ const vc = (n) => JSON.stringify(n), nt = (n, e = !1) => JSON.stringify([n, e]),
7242
7210
  ];
7243
7211
  return { chunks: t, data: r };
7244
7212
  }, Qt = ["bootstrap", "bootstrap", "bootstrap", 1], kc = (n, e, t, r) => {
7245
- var B, z, ee, q;
7246
- const { entityName: s, entityQuery: i } = gs(e), o = ((B = i.$) == null ? void 0 : B.limit) || 10, a = s, c = bs((z = i.$) == null ? void 0 : z.order), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
7247
- let h = !1, y = !0, b = null, g = null;
7248
- const w = (E) => {
7213
+ var we, ee, te, Q;
7214
+ const { entityName: s, entityQuery: i } = gs(e), o = ((we = i.$) == null ? void 0 : we.limit) || 10, a = s, c = bs((ee = i.$) == null ? void 0 : ee.order), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
7215
+ let h = !1, y = !0, b = null, _ = null;
7216
+ const T = (E) => {
7249
7217
  t({ error: E, data: void 0, canLoadNextPage: !1 });
7250
7218
  }, S = () => {
7251
7219
  if (!y)
7252
7220
  return;
7253
- const { chunks: E, data: j } = Ec(u, l);
7221
+ const { chunks: E, data: R } = Ec(u, l);
7254
7222
  t({
7255
- data: { [a]: j },
7223
+ data: { [a]: R },
7256
7224
  // @ts-expect-error hidden debug variable
7257
7225
  chunks: E,
7258
7226
  canLoadNextPage: Oc(u)
7259
7227
  });
7260
- }, _ = (E, j) => {
7261
- u.set(nt(E, j.afterInclusive), j), S();
7262
- }, T = (E, j) => {
7263
- l.set(nt(E), j), C(), S();
7264
- }, M = (E, j) => {
7265
- var A, k;
7266
- const { cursor: R } = Tr(E), U = f.get(Ne("reverse", R));
7267
- U == null || U();
7268
- const L = n.subscribeQuery({
7228
+ }, g = (E, R) => {
7229
+ u.set(nt(E, R.afterInclusive), R), S();
7230
+ }, m = (E, R) => {
7231
+ l.set(nt(E), R), F(), S();
7232
+ }, P = (E, R) => {
7233
+ var O, k;
7234
+ const { cursor: M } = Tr(E), q = f.get(Ne("reverse", M));
7235
+ q == null || q();
7236
+ const W = n.subscribeQuery({
7269
7237
  [a]: {
7270
7238
  ...i,
7271
7239
  $: {
7272
- after: R,
7273
- before: j.endCursor,
7240
+ after: M,
7241
+ before: R.endCursor,
7274
7242
  beforeInclusive: !0,
7275
- where: (A = i.$) == null ? void 0 : A.where,
7243
+ where: (O = i.$) == null ? void 0 : O.where,
7276
7244
  fields: (k = i.$) == null ? void 0 : k.fields,
7277
7245
  order: Sr(c)
7278
7246
  }
7279
7247
  }
7280
- }, (K) => {
7281
- if (K.error)
7282
- return w(K.error);
7283
- const H = K.data[a], Y = K.pageInfo[a];
7284
- Ye(H && Y, "Expected query subscription to contain rows and pageInfo"), T(R, {
7285
- data: H,
7248
+ }, (U) => {
7249
+ if (U.error)
7250
+ return T(U.error);
7251
+ const z = U.data[a], G = U.pageInfo[a];
7252
+ Ye(z && G, "Expected query subscription to contain rows and pageInfo"), m(M, {
7253
+ data: z,
7286
7254
  status: "frozen",
7287
- hasMore: Y.hasNextPage,
7288
- endCursor: Y.endCursor
7255
+ hasMore: G.hasNextPage,
7256
+ endCursor: G.endCursor
7289
7257
  });
7290
7258
  }, r);
7291
- f.set(Ne("reverse", R), L);
7292
- }, O = (E) => {
7293
- var R, U;
7294
- const j = n.subscribeQuery({
7259
+ f.set(Ne("reverse", M), W);
7260
+ }, v = (E) => {
7261
+ var M, q;
7262
+ const R = n.subscribeQuery({
7295
7263
  [a]: {
7296
7264
  ...i,
7297
7265
  $: {
7298
7266
  limit: o,
7299
7267
  after: E,
7300
- where: (R = i.$) == null ? void 0 : R.where,
7301
- fields: (U = i.$) == null ? void 0 : U.fields,
7268
+ where: (M = i.$) == null ? void 0 : M.where,
7269
+ fields: (q = i.$) == null ? void 0 : q.fields,
7302
7270
  order: Sr(c)
7303
7271
  }
7304
7272
  }
7305
- }, (L) => {
7306
- if (L.error)
7307
- return w(L.error);
7308
- const A = L.data[a], k = L.pageInfo[a];
7309
- Ye(A && k, "Expected rows and pageInfo"), T(E, {
7310
- data: A,
7273
+ }, (W) => {
7274
+ if (W.error)
7275
+ return T(W.error);
7276
+ const O = W.data[a], k = W.pageInfo[a];
7277
+ Ye(O && k, "Expected rows and pageInfo"), m(E, {
7278
+ data: O,
7311
7279
  status: "bootstrapping",
7312
7280
  hasMore: k.hasNextPage,
7313
7281
  endCursor: k.endCursor
7314
7282
  });
7315
7283
  }, r);
7316
- f.set(Ne("reverse", E), j);
7317
- }, F = (E, j = !1) => {
7318
- var U, L;
7319
- const R = n.subscribeQuery({
7284
+ f.set(Ne("reverse", E), R);
7285
+ }, I = (E, R = !1) => {
7286
+ var q, W;
7287
+ const M = n.subscribeQuery({
7320
7288
  [a]: {
7321
7289
  ...i,
7322
7290
  $: {
7323
7291
  limit: o,
7324
7292
  after: E,
7325
- afterInclusive: j,
7326
- where: (U = i.$) == null ? void 0 : U.where,
7327
- fields: (L = i.$) == null ? void 0 : L.fields,
7293
+ afterInclusive: R,
7294
+ where: (q = i.$) == null ? void 0 : q.where,
7295
+ fields: (W = i.$) == null ? void 0 : W.fields,
7328
7296
  order: c
7329
7297
  }
7330
7298
  }
7331
- }, (A) => {
7332
- if (A.error)
7333
- return w(A.error);
7334
- const k = A.data[a], K = A.pageInfo[a];
7335
- Ye(k && K, "Page info and rows"), _(E, {
7299
+ }, (O) => {
7300
+ if (O.error)
7301
+ return T(O.error);
7302
+ const k = O.data[a], U = O.pageInfo[a];
7303
+ Ye(k && U, "Page info and rows"), g(E, {
7336
7304
  data: k,
7337
7305
  status: "bootstrapping",
7338
- hasMore: K.hasNextPage,
7339
- endCursor: K.endCursor,
7340
- afterInclusive: j
7306
+ hasMore: U.hasNextPage,
7307
+ endCursor: U.endCursor,
7308
+ afterInclusive: R
7341
7309
  });
7342
7310
  }, r);
7343
- f.set(Ne("forward", E, j), R);
7344
- }, P = (E, j = !1) => {
7345
- var k, K;
7346
- const R = nt(E, j), U = f.get(Ne("forward", E, j));
7347
- U == null || U();
7348
- const L = u.get(R);
7349
- if (!(L != null && L.endCursor))
7311
+ f.set(Ne("forward", E, R), M);
7312
+ }, x = (E, R = !1) => {
7313
+ var k, U;
7314
+ const M = nt(E, R), q = f.get(Ne("forward", E, R));
7315
+ q == null || q();
7316
+ const W = u.get(M);
7317
+ if (!(W != null && W.endCursor))
7350
7318
  return;
7351
- const A = n.subscribeQuery({
7319
+ const O = n.subscribeQuery({
7352
7320
  [a]: {
7353
7321
  ...i,
7354
7322
  $: {
7355
7323
  after: E,
7356
- afterInclusive: L.afterInclusive,
7357
- before: L.endCursor,
7324
+ afterInclusive: W.afterInclusive,
7325
+ before: W.endCursor,
7358
7326
  beforeInclusive: !0,
7359
7327
  where: (k = i.$) == null ? void 0 : k.where,
7360
- fields: (K = i.$) == null ? void 0 : K.fields,
7328
+ fields: (U = i.$) == null ? void 0 : U.fields,
7361
7329
  order: c
7362
7330
  }
7363
7331
  }
7364
- }, (H) => {
7365
- if (H.error)
7366
- return w(H.error);
7367
- const Y = H.data[a], oe = H.pageInfo[a];
7368
- Ye(Y && oe, "Expected rows and pageInfo"), _(E, {
7369
- data: Y,
7332
+ }, (z) => {
7333
+ if (z.error)
7334
+ return T(z.error);
7335
+ const G = z.data[a], re = z.pageInfo[a];
7336
+ Ye(G && re, "Expected rows and pageInfo"), g(E, {
7337
+ data: G,
7370
7338
  status: "frozen",
7371
- hasMore: oe.hasNextPage,
7372
- endCursor: oe.endCursor,
7373
- afterInclusive: L.afterInclusive
7339
+ hasMore: re.hasNextPage,
7340
+ endCursor: re.endCursor,
7341
+ afterInclusive: W.afterInclusive
7374
7342
  });
7375
7343
  }, r);
7376
- f.set(Ne("forward", E, j), A);
7377
- }, C = () => {
7344
+ f.set(Ne("forward", E, R), O);
7345
+ }, F = () => {
7378
7346
  const E = Array.from(l.entries()).at(-1);
7379
7347
  if (!E)
7380
7348
  return;
7381
- const [j, R] = E;
7382
- if (!(R != null && R.hasMore) || !Ac(R))
7349
+ const [R, M] = E;
7350
+ if (!(M != null && M.hasMore) || !Ac(M))
7383
7351
  return;
7384
- const U = `${j}:${vc(R.endCursor)}`;
7385
- U != b && (b = U, M(j, R), O(R.endCursor));
7386
- }, G = () => {
7352
+ const q = `${R}:${vc(M.endCursor)}`;
7353
+ q != b && (b = q, P(R, M), v(M.endCursor));
7354
+ }, V = () => {
7387
7355
  const E = Array.from(u.entries()).at(-1);
7388
7356
  if (!E)
7389
7357
  return;
7390
- const [j, R] = E;
7391
- if (!R.endCursor)
7358
+ const [R, M] = E;
7359
+ if (!M.endCursor)
7392
7360
  return;
7393
- const { cursor: U, afterInclusive: L } = Tr(j);
7394
- P(U, L), F(R.endCursor);
7361
+ const { cursor: q, afterInclusive: W } = Tr(R);
7362
+ x(q, W), I(M.endCursor);
7395
7363
  };
7396
- return g = n.subscribeQuery({
7364
+ return _ = n.subscribeQuery({
7397
7365
  [a]: {
7398
7366
  ...i,
7399
7367
  $: {
7400
7368
  limit: o,
7401
- where: (ee = i.$) == null ? void 0 : ee.where,
7402
- fields: (q = i.$) == null ? void 0 : q.fields,
7369
+ where: (te = i.$) == null ? void 0 : te.where,
7370
+ fields: (Q = i.$) == null ? void 0 : Q.fields,
7403
7371
  order: c
7404
7372
  }
7405
7373
  }
7406
7374
  }, async (E) => {
7407
- var L;
7375
+ var W;
7408
7376
  if (h)
7409
7377
  return;
7410
7378
  if (E.error)
7411
- return w(E.error);
7412
- const j = E.pageInfo[a], R = (L = E == null ? void 0 : E.data) == null ? void 0 : L[a];
7413
- if (Ye(R && j, "Expected rows and pageInfo"), R.length < o) {
7414
- _(Qt, {
7415
- data: R,
7379
+ return T(E.error);
7380
+ const R = E.pageInfo[a], M = (W = E == null ? void 0 : E.data) == null ? void 0 : W[a];
7381
+ if (Ye(M && R, "Expected rows and pageInfo"), M.length < o) {
7382
+ g(Qt, {
7383
+ data: M,
7416
7384
  status: "pre-bootstrap"
7417
7385
  });
7418
7386
  return;
7419
7387
  }
7420
- const U = j.startCursor;
7421
- if (!U) {
7422
- _(Qt, {
7423
- data: R,
7388
+ const q = R.startCursor;
7389
+ if (!q) {
7390
+ g(Qt, {
7391
+ data: M,
7424
7392
  status: "pre-bootstrap"
7425
7393
  });
7426
7394
  return;
7427
7395
  }
7428
- u.delete(nt(Qt)), F(U, !0), O(j.startCursor), h = !0;
7396
+ u.delete(nt(Qt)), I(q, !0), v(R.startCursor), h = !0;
7429
7397
  }, r), {
7430
7398
  unsubscribe: () => {
7431
7399
  if (y) {
7432
- y = !1, g == null || g(), g = null;
7400
+ y = !1, _ == null || _(), _ = null;
7433
7401
  for (const E of f.values())
7434
7402
  E == null || E();
7435
7403
  f.clear();
7436
7404
  }
7437
7405
  },
7438
- loadNextPage: G
7406
+ loadNextPage: V
7439
7407
  };
7440
7408
  }, Cc = (n, e, t) => {
7441
7409
  var u, l, f, h;
@@ -7469,10 +7437,10 @@ const vc = (n) => JSON.stringify(n), nt = (n, e = !1) => JSON.stringify([n, e]),
7469
7437
  };
7470
7438
  }, gs = (n) => {
7471
7439
  if (Object.keys(n).length !== 1)
7472
- throw new Q("subscribeInfiniteQuery expects exactly one entity");
7440
+ throw new K("subscribeInfiniteQuery expects exactly one entity");
7473
7441
  const [t, r] = Object.entries(n)[0];
7474
7442
  if (!t || !r)
7475
- throw new Q("No query provided for infinite query");
7443
+ throw new K("No query provided for infinite query");
7476
7444
  return { entityName: t, entityQuery: r };
7477
7445
  }, Ic = {
7478
7446
  apiURI: "https://api.instantdb.com",
@@ -7481,15 +7449,15 @@ const vc = (n) => JSON.stringify(n), nt = (n, e = !1) => JSON.stringify([n, e]),
7481
7449
  function Pc() {
7482
7450
  return globalThis.__instantDbSchemaHashStore = globalThis.__instantDbSchemaHashStore ?? /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
7483
7451
  }
7484
- function Mc() {
7452
+ function Rc() {
7485
7453
  return globalThis.__instantDbStore = globalThis.__instantDbStore ?? {}, globalThis.__instantDbStore;
7486
7454
  }
7487
7455
  function dn(n) {
7488
7456
  const e = n.__adminToken, t = n.__extraDedupeKey;
7489
7457
  return n.appId + "_" + (n.websocketURI || "default_ws_uri") + "_" + (n.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + n.useDateObjects + "_" + (t || "");
7490
7458
  }
7491
- const hn = Mc(), vr = Pc();
7492
- class Rc {
7459
+ const hn = Rc(), vr = Pc();
7460
+ class Mc {
7493
7461
  constructor(e) {
7494
7462
  p(this, "db");
7495
7463
  /**
@@ -7700,7 +7668,7 @@ class xc {
7700
7668
  p(this, "storage");
7701
7669
  p(this, "streams");
7702
7670
  p(this, "tx", On());
7703
- this._reactor = e, this.auth = new Rc(this._reactor), this.storage = new jc(this._reactor), this.streams = new $c(this._reactor);
7671
+ this._reactor = e, this.auth = new Mc(this._reactor), this.storage = new jc(this._reactor), this.streams = new $c(this._reactor);
7704
7672
  }
7705
7673
  /**
7706
7674
  * Use this to write data! You can create, update, delete, and link objects
@@ -7902,7 +7870,7 @@ function Ar(n) {
7902
7870
  const e = vr.get(n);
7903
7871
  if (e)
7904
7872
  return e;
7905
- const t = ne(n);
7873
+ const t = Z(n);
7906
7874
  return vr.set(n, t), t;
7907
7875
  }
7908
7876
  function Dc(n, e) {
@@ -7951,7 +7919,7 @@ function Er(n) {
7951
7919
  }
7952
7920
  function Fc(n, e, t, r) {
7953
7921
  e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
7954
- const s = e ? _s(e) : null, i = ne(s), o = ke(
7922
+ const s = e ? _s(e) : null, i = Z(s), o = ke(
7955
7923
  Er(n._reactor.getPreviousResult(s))
7956
7924
  ), a = ke(Or), c = Ae(
7957
7925
  (l) => (o.current = Er(
@@ -7995,7 +7963,7 @@ function Kc({
7995
7963
  query: e,
7996
7964
  opts: t
7997
7965
  }) {
7998
- const r = ke(null), s = ne(e), i = ne(t), o = Cc(n, e, t), a = ke({
7966
+ const r = ke(null), s = Z(e), i = Z(t), o = Cc(n, e, t), a = ke({
7999
7967
  ...o,
8000
7968
  isLoading: !o.data && !o.error
8001
7969
  }), c = Ae(
@@ -8387,7 +8355,7 @@ class Bt {
8387
8355
  p(this, "useUser", () => {
8388
8356
  const { user: e } = this.useAuth();
8389
8357
  if (!e)
8390
- throw new ie(
8358
+ throw new oe(
8391
8359
  "useUser must be used within an auth-protected route"
8392
8360
  );
8393
8361
  return e;