@instantdb/react-common 0.22.149 → 0.22.150

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.
@@ -58,31 +58,31 @@ function Ds() {
58
58
  }
59
59
  function C(d, m, A) {
60
60
  {
61
- var E = _.ReactDebugCurrentFrame, j = E.getStackAddendum();
62
- j !== "" && (m += "%s", A = A.concat([j]));
61
+ var E = _.ReactDebugCurrentFrame, D = E.getStackAddendum();
62
+ D !== "" && (m += "%s", A = A.concat([D]));
63
63
  var $ = A.map(function(R) {
64
64
  return String(R);
65
65
  });
66
66
  $.unshift("Warning: " + m), Function.prototype.apply.call(console[d], console, $);
67
67
  }
68
68
  }
69
- var v = !1, k = !1, D = !1, x = !1, N = !1, ye;
70
- ye = Symbol.for("react.module.reference");
71
- function le(d) {
72
- return !!(typeof d == "string" || typeof d == "function" || d === s || d === o || N || d === i || d === l || d === f || x || d === b || v || k || D || typeof d == "object" && d !== null && (d.$$typeof === y || d.$$typeof === p || d.$$typeof === a || d.$$typeof === c || d.$$typeof === u || // This needs to include all possible module reference object
69
+ var v = !1, k = !1, j = !1, x = !1, z = !1, ce;
70
+ ce = Symbol.for("react.module.reference");
71
+ function ve(d) {
72
+ return !!(typeof d == "string" || typeof d == "function" || d === s || d === o || z || d === i || d === l || d === f || x || d === b || v || k || j || typeof d == "object" && d !== null && (d.$$typeof === y || d.$$typeof === p || 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 === ye || d.getModuleId !== void 0));
76
+ d.$$typeof === ce || d.getModuleId !== void 0));
77
77
  }
78
- function fe(d, m, A) {
78
+ function J(d, m, A) {
79
79
  var E = d.displayName;
80
80
  if (E)
81
81
  return E;
82
- var j = m.displayName || m.name || "";
83
- return j !== "" ? A + "(" + j + ")" : A;
82
+ var D = m.displayName || m.name || "";
83
+ return D !== "" ? A + "(" + D + ")" : A;
84
84
  }
85
- function X(d) {
85
+ function Y(d) {
86
86
  return d.displayName || "Context";
87
87
  }
88
88
  function U(d) {
@@ -110,17 +110,17 @@ function Ds() {
110
110
  switch (d.$$typeof) {
111
111
  case c:
112
112
  var m = d;
113
- return X(m) + ".Consumer";
113
+ return Y(m) + ".Consumer";
114
114
  case a:
115
115
  var A = d;
116
- return X(A._context) + ".Provider";
116
+ return Y(A._context) + ".Provider";
117
117
  case u:
118
- return fe(d, d.render, "ForwardRef");
118
+ return J(d, d.render, "ForwardRef");
119
119
  case p:
120
120
  var E = d.displayName || null;
121
121
  return E !== null ? E : U(d.type) || "Memo";
122
122
  case y: {
123
- var j = d, $ = j._payload, R = j._init;
123
+ var D = d, $ = D._payload, R = D._init;
124
124
  try {
125
125
  return U(R($));
126
126
  } catch {
@@ -130,18 +130,18 @@ function Ds() {
130
130
  }
131
131
  return null;
132
132
  }
133
- var H = Object.assign, be = 0, ve, At, O, I, V, Q, ee;
134
- function ae() {
133
+ var H = Object.assign, be = 0, Ae, rt, Ot, O, I, V, Q;
134
+ function te() {
135
135
  }
136
- ae.__reactDisabledLog = !0;
137
- function qe() {
136
+ te.__reactDisabledLog = !0;
137
+ function fe() {
138
138
  {
139
139
  if (be === 0) {
140
- ve = console.log, At = console.info, O = console.warn, I = console.error, V = console.group, Q = console.groupCollapsed, ee = console.groupEnd;
140
+ Ae = console.log, rt = console.info, Ot = console.warn, O = console.error, I = console.group, V = console.groupCollapsed, Q = console.groupEnd;
141
141
  var d = {
142
142
  configurable: !0,
143
143
  enumerable: !0,
144
- value: ae,
144
+ value: te,
145
145
  writable: !0
146
146
  };
147
147
  Object.defineProperties(console, {
@@ -157,7 +157,7 @@ function Ds() {
157
157
  be++;
158
158
  }
159
159
  }
160
- function Ae() {
160
+ function qe() {
161
161
  {
162
162
  if (be--, be === 0) {
163
163
  var d = {
@@ -167,64 +167,64 @@ function Ds() {
167
167
  };
168
168
  Object.defineProperties(console, {
169
169
  log: H({}, d, {
170
- value: ve
170
+ value: Ae
171
171
  }),
172
172
  info: H({}, d, {
173
- value: At
173
+ value: rt
174
174
  }),
175
175
  warn: H({}, d, {
176
- value: O
176
+ value: Ot
177
177
  }),
178
178
  error: H({}, d, {
179
- value: I
179
+ value: O
180
180
  }),
181
181
  group: H({}, d, {
182
- value: V
182
+ value: I
183
183
  }),
184
184
  groupCollapsed: H({}, d, {
185
- value: Q
185
+ value: V
186
186
  }),
187
187
  groupEnd: H({}, d, {
188
- value: ee
188
+ value: Q
189
189
  })
190
190
  });
191
191
  }
192
192
  be < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
193
193
  }
194
194
  }
195
- var Ot = _.ReactCurrentDispatcher, Et;
196
- function rt(d, m, A) {
195
+ var de = _.ReactCurrentDispatcher, Et;
196
+ function st(d, m, A) {
197
197
  {
198
198
  if (Et === void 0)
199
199
  try {
200
200
  throw Error();
201
- } catch (j) {
202
- var E = j.stack.trim().match(/\n( *(at )?)/);
201
+ } catch (D) {
202
+ var E = D.stack.trim().match(/\n( *(at )?)/);
203
203
  Et = E && E[1] || "";
204
204
  }
205
205
  return `
206
206
  ` + Et + d;
207
207
  }
208
208
  }
209
- var kt = !1, st;
209
+ var kt = !1, it;
210
210
  {
211
211
  var os = typeof WeakMap == "function" ? WeakMap : Map;
212
- st = new os();
212
+ it = new os();
213
213
  }
214
214
  function Tn(d, m) {
215
215
  if (!d || kt)
216
216
  return "";
217
217
  {
218
- var A = st.get(d);
218
+ var A = it.get(d);
219
219
  if (A !== void 0)
220
220
  return A;
221
221
  }
222
222
  var E;
223
223
  kt = !0;
224
- var j = Error.prepareStackTrace;
224
+ var D = Error.prepareStackTrace;
225
225
  Error.prepareStackTrace = void 0;
226
226
  var $;
227
- $ = Ot.current, Ot.current = null, qe();
227
+ $ = de.current, de.current = null, fe();
228
228
  try {
229
229
  if (m) {
230
230
  var R = function() {
@@ -237,50 +237,50 @@ function Ds() {
237
237
  }), typeof Reflect == "object" && Reflect.construct) {
238
238
  try {
239
239
  Reflect.construct(R, []);
240
- } catch (te) {
241
- E = te;
240
+ } catch (ne) {
241
+ E = ne;
242
242
  }
243
243
  Reflect.construct(d, [], R);
244
244
  } else {
245
245
  try {
246
246
  R.call();
247
- } catch (te) {
248
- E = te;
247
+ } catch (ne) {
248
+ E = ne;
249
249
  }
250
250
  d.call(R.prototype);
251
251
  }
252
252
  } else {
253
253
  try {
254
254
  throw Error();
255
- } catch (te) {
256
- E = te;
255
+ } catch (ne) {
256
+ E = ne;
257
257
  }
258
258
  d();
259
259
  }
260
- } catch (te) {
261
- if (te && E && typeof te.stack == "string") {
262
- for (var P = te.stack.split(`
263
- `), J = E.stack.split(`
264
- `), K = P.length - 1, W = J.length - 1; K >= 1 && W >= 0 && P[K] !== J[W]; )
265
- W--;
266
- for (; K >= 1 && W >= 0; K--, W--)
267
- if (P[K] !== J[W]) {
268
- if (K !== 1 || W !== 1)
260
+ } catch (ne) {
261
+ if (ne && E && typeof ne.stack == "string") {
262
+ for (var P = ne.stack.split(`
263
+ `), Z = E.stack.split(`
264
+ `), N = P.length - 1, q = Z.length - 1; N >= 1 && q >= 0 && P[N] !== Z[q]; )
265
+ q--;
266
+ for (; N >= 1 && q >= 0; N--, q--)
267
+ if (P[N] !== Z[q]) {
268
+ if (N !== 1 || q !== 1)
269
269
  do
270
- if (K--, W--, W < 0 || P[K] !== J[W]) {
271
- var ce = `
272
- ` + P[K].replace(" at new ", " at ");
273
- return d.displayName && ce.includes("<anonymous>") && (ce = ce.replace("<anonymous>", d.displayName)), typeof d == "function" && st.set(d, ce), ce;
270
+ if (N--, q--, q < 0 || P[N] !== Z[q]) {
271
+ var ue = `
272
+ ` + P[N].replace(" at new ", " at ");
273
+ return d.displayName && ue.includes("<anonymous>") && (ue = ue.replace("<anonymous>", d.displayName)), typeof d == "function" && it.set(d, ue), ue;
274
274
  }
275
- while (K >= 1 && W >= 0);
275
+ while (N >= 1 && q >= 0);
276
276
  break;
277
277
  }
278
278
  }
279
279
  } finally {
280
- kt = !1, Ot.current = $, Ae(), Error.prepareStackTrace = j;
280
+ kt = !1, de.current = $, qe(), Error.prepareStackTrace = D;
281
281
  }
282
- var $e = d ? d.displayName || d.name : "", Oe = $e ? rt($e) : "";
283
- return typeof d == "function" && st.set(d, Oe), Oe;
282
+ var $e = d ? d.displayName || d.name : "", Oe = $e ? st($e) : "";
283
+ return typeof d == "function" && it.set(d, Oe), Oe;
284
284
  }
285
285
  function as(d, m, A) {
286
286
  return Tn(d, !1);
@@ -289,29 +289,29 @@ function Ds() {
289
289
  var m = d.prototype;
290
290
  return !!(m && m.isReactComponent);
291
291
  }
292
- function it(d, m, A) {
292
+ function ot(d, m, A) {
293
293
  if (d == null)
294
294
  return "";
295
295
  if (typeof d == "function")
296
296
  return Tn(d, cs(d));
297
297
  if (typeof d == "string")
298
- return rt(d);
298
+ return st(d);
299
299
  switch (d) {
300
300
  case l:
301
- return rt("Suspense");
301
+ return st("Suspense");
302
302
  case f:
303
- return rt("SuspenseList");
303
+ return st("SuspenseList");
304
304
  }
305
305
  if (typeof d == "object")
306
306
  switch (d.$$typeof) {
307
307
  case u:
308
308
  return as(d.render);
309
309
  case p:
310
- return it(d.type, m, A);
310
+ return ot(d.type, m, A);
311
311
  case y: {
312
- var E = d, j = E._payload, $ = E._init;
312
+ var E = d, D = E._payload, $ = E._init;
313
313
  try {
314
- return it($(j), m, A);
314
+ return ot($(D), m, A);
315
315
  } catch {
316
316
  }
317
317
  }
@@ -319,14 +319,14 @@ function Ds() {
319
319
  return "";
320
320
  }
321
321
  var We = Object.prototype.hasOwnProperty, Sn = {}, vn = _.ReactDebugCurrentFrame;
322
- function ot(d) {
322
+ function at(d) {
323
323
  if (d) {
324
- var m = d._owner, A = it(d.type, d._source, m ? m.type : null);
324
+ var m = d._owner, A = ot(d.type, d._source, m ? m.type : null);
325
325
  vn.setExtraStackFrame(A);
326
326
  } else
327
327
  vn.setExtraStackFrame(null);
328
328
  }
329
- function us(d, m, A, E, j) {
329
+ function us(d, m, A, E, D) {
330
330
  {
331
331
  var $ = Function.call.bind(We);
332
332
  for (var R in d)
@@ -334,14 +334,14 @@ function Ds() {
334
334
  var P = void 0;
335
335
  try {
336
336
  if (typeof d[R] != "function") {
337
- var J = Error((E || "React class") + ": " + A + " type `" + R + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof d[R] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
338
- throw J.name = "Invariant Violation", J;
337
+ var Z = Error((E || "React class") + ": " + A + " type `" + R + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof d[R] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
338
+ throw Z.name = "Invariant Violation", Z;
339
339
  }
340
340
  P = d[R](m, R, E, A, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
341
- } catch (K) {
342
- P = K;
341
+ } catch (N) {
342
+ P = N;
343
343
  }
344
- P && !(P instanceof Error) && (ot(j), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", E || "React class", A, R, typeof P), ot(null)), P instanceof Error && !(P.message in Sn) && (Sn[P.message] = !0, ot(j), w("Failed %s type: %s", A, P.message), ot(null));
344
+ P && !(P instanceof Error) && (at(D), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", E || "React class", A, R, typeof P), at(null)), P instanceof Error && !(P.message in Sn) && (Sn[P.message] = !0, at(D), w("Failed %s type: %s", A, P.message), at(null));
345
345
  }
346
346
  }
347
347
  }
@@ -416,7 +416,7 @@ function Ds() {
416
416
  });
417
417
  }
418
418
  }
419
- var ms = function(d, m, A, E, j, $, R) {
419
+ var ms = function(d, m, A, E, D, $, R) {
420
420
  var P = {
421
421
  // This tag allows us to uniquely identify this as a React Element
422
422
  $$typeof: t,
@@ -442,31 +442,31 @@ function Ds() {
442
442
  configurable: !1,
443
443
  enumerable: !1,
444
444
  writable: !1,
445
- value: j
445
+ value: D
446
446
  }), Object.freeze && (Object.freeze(P.props), Object.freeze(P)), P;
447
447
  };
448
- function ws(d, m, A, E, j) {
448
+ function ws(d, m, A, E, D) {
449
449
  {
450
- var $, R = {}, P = null, J = null;
451
- A !== void 0 && (On(A), P = "" + A), ys(m) && (On(m.key), P = "" + m.key), ps(m) && (J = m.ref, bs(m, j));
450
+ var $, R = {}, P = null, Z = null;
451
+ A !== void 0 && (On(A), P = "" + A), ys(m) && (On(m.key), P = "" + m.key), ps(m) && (Z = m.ref, bs(m, D));
452
452
  for ($ in m)
453
453
  We.call(m, $) && !hs.hasOwnProperty($) && (R[$] = m[$]);
454
454
  if (d && d.defaultProps) {
455
- var K = d.defaultProps;
456
- for ($ in K)
457
- R[$] === void 0 && (R[$] = K[$]);
455
+ var N = d.defaultProps;
456
+ for ($ in N)
457
+ R[$] === void 0 && (R[$] = N[$]);
458
458
  }
459
- if (P || J) {
460
- var W = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
461
- P && _s(R, W), J && gs(R, W);
459
+ if (P || Z) {
460
+ var q = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
461
+ P && _s(R, q), Z && gs(R, q);
462
462
  }
463
- return ms(d, P, J, j, E, En.current, R);
463
+ return ms(d, P, Z, D, E, En.current, R);
464
464
  }
465
465
  }
466
466
  var It = _.ReactCurrentOwner, In = _.ReactDebugCurrentFrame;
467
467
  function De(d) {
468
468
  if (d) {
469
- var m = d._owner, A = it(d.type, d._source, m ? m.type : null);
469
+ var m = d._owner, A = ot(d.type, d._source, m ? m.type : null);
470
470
  In.setExtraStackFrame(A);
471
471
  } else
472
472
  In.setExtraStackFrame(null);
@@ -529,9 +529,9 @@ Check the top-level render call using <` + A + ">.");
529
529
  else if (Mt(d))
530
530
  d._store && (d._store.validated = !0);
531
531
  else if (d) {
532
- var j = S(d);
533
- if (typeof j == "function" && j !== d.entries)
534
- for (var $ = j.call(d), R; !(R = $.next()).done; )
532
+ var D = S(d);
533
+ if (typeof D == "function" && D !== d.entries)
534
+ for (var $ = D.call(d), R; !(R = $.next()).done; )
535
535
  Mt(R.value) && Rn(R.value, m);
536
536
  }
537
537
  }
@@ -555,8 +555,8 @@ Check the top-level render call using <` + A + ">.");
555
555
  us(A, d.props, "prop", E, d);
556
556
  } else if (m.PropTypes !== void 0 && !Pt) {
557
557
  Pt = !0;
558
- var j = U(m);
559
- w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", j || "Unknown");
558
+ var D = U(m);
559
+ w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", D || "Unknown");
560
560
  }
561
561
  typeof m.getDefaultProps == "function" && !m.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
562
562
  }
@@ -574,39 +574,39 @@ Check the top-level render call using <` + A + ">.");
574
574
  }
575
575
  }
576
576
  var Dn = {};
577
- function $n(d, m, A, E, j, $) {
577
+ function $n(d, m, A, E, D, $) {
578
578
  {
579
- var R = le(d);
579
+ var R = ve(d);
580
580
  if (!R) {
581
581
  var P = "";
582
582
  (d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && (P += " 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 J = Ts();
584
- J ? P += J : P += Pn();
585
- var K;
586
- d === null ? K = "null" : Ct(d) ? K = "array" : d !== void 0 && d.$$typeof === t ? (K = "<" + (U(d.type) || "Unknown") + " />", P = " Did you accidentally export a JSX literal instead of a component?") : K = typeof d, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", K, P);
583
+ var Z = Ts();
584
+ Z ? P += Z : P += Pn();
585
+ var N;
586
+ d === null ? N = "null" : Ct(d) ? N = "array" : d !== void 0 && d.$$typeof === t ? (N = "<" + (U(d.type) || "Unknown") + " />", P = " Did you accidentally export a JSX literal instead of a component?") : N = typeof d, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", N, P);
587
587
  }
588
- var W = ws(d, m, A, j, $);
589
- if (W == null)
590
- return W;
588
+ var q = ws(d, m, A, D, $);
589
+ if (q == null)
590
+ return q;
591
591
  if (R) {
592
- var ce = m.children;
593
- if (ce !== void 0)
592
+ var ue = m.children;
593
+ if (ue !== void 0)
594
594
  if (E)
595
- if (Ct(ce)) {
596
- for (var $e = 0; $e < ce.length; $e++)
597
- jn(ce[$e], d);
598
- Object.freeze && Object.freeze(ce);
595
+ if (Ct(ue)) {
596
+ for (var $e = 0; $e < ue.length; $e++)
597
+ jn(ue[$e], d);
598
+ Object.freeze && Object.freeze(ue);
599
599
  } else
600
600
  w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
601
601
  else
602
- jn(ce, d);
602
+ jn(ue, d);
603
603
  }
604
604
  if (We.call(m, "key")) {
605
- var Oe = U(d), te = Object.keys(m).filter(function(Ps) {
605
+ var Oe = U(d), ne = Object.keys(m).filter(function(Ps) {
606
606
  return Ps !== "key";
607
- }), Rt = te.length > 0 ? "{key: someKey, " + te.join(": ..., ") + ": ...}" : "{key: someKey}";
607
+ }), Rt = ne.length > 0 ? "{key: someKey, " + ne.join(": ..., ") + ": ...}" : "{key: someKey}";
608
608
  if (!Dn[Oe + Rt]) {
609
- var Is = te.length > 0 ? "{" + te.join(": ..., ") + ": ...}" : "{}";
609
+ var Is = ne.length > 0 ? "{" + ne.join(": ..., ") + ": ...}" : "{}";
610
610
  w(`A props object containing a "key" prop is being spread into JSX:
611
611
  let props = %s;
612
612
  <%s {...props} />
@@ -615,7 +615,7 @@ React keys must be passed directly to JSX without using spread:
615
615
  <%s key={someKey} {...props} />`, Rt, Oe, Is, Oe), Dn[Oe + Rt] = !0;
616
616
  }
617
617
  }
618
- return d === s ? As(W) : vs(W), W;
618
+ return d === s ? As(q) : vs(q), q;
619
619
  }
620
620
  }
621
621
  function Os(d, m, A) {
@@ -630,7 +630,7 @@ React keys must be passed directly to JSX without using spread:
630
630
  }
631
631
  var $s = {};
632
632
  $s.NODE_ENV === "production" ? Wt.exports = js() : Wt.exports = Ds();
633
- var at = Wt.exports;
633
+ var ct = Wt.exports;
634
634
  function B(n) {
635
635
  if (typeof n == "number")
636
636
  return (Math.abs(n * 2654435761) >>> 0).toString(16);
@@ -669,11 +669,11 @@ function B(n) {
669
669
  }
670
670
  return B(String(n));
671
671
  }
672
- const q = {
672
+ const K = {
673
673
  Remove: "remove",
674
674
  Replace: "replace",
675
675
  Add: "add"
676
- }, wr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), xs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), dt = Symbol.iterator, oe = {
676
+ }, wr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), xs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), ht = Symbol.iterator, ae = {
677
677
  mutable: "mutable",
678
678
  immutable: "immutable"
679
679
  }, cn = {};
@@ -697,7 +697,7 @@ function un(n) {
697
697
  function ln(n) {
698
698
  return Object.getPrototypeOf(n) === Map.prototype;
699
699
  }
700
- function ie(n) {
700
+ function oe(n) {
701
701
  var e;
702
702
  return (e = n.copy) !== null && e !== void 0 ? e : n.original;
703
703
  }
@@ -712,11 +712,11 @@ function fn(n) {
712
712
  const t = M(n);
713
713
  return t ? (e = t.copy) !== null && e !== void 0 ? e : t.original : n;
714
714
  }
715
- function he(n, e) {
715
+ function pe(n, e) {
716
716
  if (!n || typeof n != "object")
717
717
  return !1;
718
718
  let t;
719
- return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, oe)) === oe.immutable || typeof t == "function");
719
+ return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, ae)) === ae.immutable || typeof t == "function");
720
720
  }
721
721
  function Tr(n, e = []) {
722
722
  if (Object.hasOwnProperty.call(n, "key")) {
@@ -749,7 +749,7 @@ function tt(n, e, t) {
749
749
  }
750
750
  function jt(n, e) {
751
751
  const t = M(n);
752
- return (t ? ie(t) : n)[e];
752
+ return (t ? oe(t) : n)[e];
753
753
  }
754
754
  function we(n, e) {
755
755
  return n === e ? n !== 0 || 1 / n === 1 / e : n !== n && e !== e;
@@ -806,8 +806,8 @@ function Sr(n, e) {
806
806
  return new r(n);
807
807
  }
808
808
  return new Map(n);
809
- } else if (e != null && e.mark && (t = e.mark(n, oe), t !== void 0) && t !== oe.mutable) {
810
- if (t === oe.immutable)
809
+ } else if (e != null && e.mark && (t = e.mark(n, ae), t !== void 0) && t !== ae.mutable) {
810
+ if (t === ae.immutable)
811
811
  return Ls(n);
812
812
  if (typeof t == "function") {
813
813
  if (e.enablePatches || e.enableAutoFreeze)
@@ -825,11 +825,11 @@ function Sr(n, e) {
825
825
  } else
826
826
  throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
827
827
  }
828
- function Y(n) {
828
+ function X(n) {
829
829
  n.copy || (n.copy = Sr(n.original, n.options));
830
830
  }
831
831
  function Be(n) {
832
- if (!he(n))
832
+ if (!pe(n))
833
833
  return fn(n);
834
834
  if (Array.isArray(n))
835
835
  return n.map(Be);
@@ -857,7 +857,7 @@ function Be(n) {
857
857
  e[t] = Be(n[t]);
858
858
  return e;
859
859
  }
860
- function ht(n) {
860
+ function pt(n) {
861
861
  return Me(n) ? Be(n) : n;
862
862
  }
863
863
  function ge(n) {
@@ -927,14 +927,14 @@ function dn(n, e) {
927
927
  n.forEach((r, s) => e(s, r, n));
928
928
  }
929
929
  function vr(n, e, t) {
930
- if (Me(n) || !he(n, t) || e.has(n) || Object.isFrozen(n))
930
+ if (Me(n) || !pe(n, t) || e.has(n) || Object.isFrozen(n))
931
931
  return;
932
932
  const r = n instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
933
933
  if (e.add(n), dn(n, (i, o) => {
934
934
  var a;
935
935
  if (Me(o)) {
936
936
  const c = M(o);
937
- Y(c);
937
+ X(c);
938
938
  const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
939
939
  tt(r ? s : n, i, u);
940
940
  } else
@@ -973,7 +973,7 @@ function hn(n, e, t, r) {
973
973
  let u = s.original;
974
974
  s.copy && (u = s.copy), Vt(n), Bt(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)), tt(c, e, u);
975
975
  }
976
- }), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), he(t, n.options) && n.finalities.draft.push(() => {
976
+ }), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), pe(t, n.options) && n.finalities.draft.push(() => {
977
977
  const i = n.type === 3 ? n.setMap : n.copy;
978
978
  we(Te(i, e), t) && Ns(n, e);
979
979
  });
@@ -985,24 +985,24 @@ function Ks(n, e, t, r, s) {
985
985
  if (o.get(u.toString()) && c[u] !== i[u]) {
986
986
  const l = e.concat([u]), f = Ce(l, s);
987
987
  t.push({
988
- op: q.Replace,
988
+ op: K.Replace,
989
989
  path: f,
990
990
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
991
- value: ht(c[u])
991
+ value: pt(c[u])
992
992
  }), r.push({
993
- op: q.Replace,
993
+ op: K.Replace,
994
994
  path: f,
995
995
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
996
- value: ht(i[u])
996
+ value: pt(i[u])
997
997
  });
998
998
  }
999
999
  for (let u = i.length; u < c.length; u += 1) {
1000
1000
  const l = e.concat([u]), f = Ce(l, s);
1001
1001
  t.push({
1002
- op: q.Add,
1002
+ op: K.Add,
1003
1003
  path: f,
1004
1004
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
1005
- value: ht(c[u])
1005
+ value: pt(c[u])
1006
1006
  });
1007
1007
  }
1008
1008
  if (i.length < c.length) {
@@ -1010,7 +1010,7 @@ function Ks(n, e, t, r, s) {
1010
1010
  if (u) {
1011
1011
  const l = e.concat(["length"]), f = Ce(l, s);
1012
1012
  r.push({
1013
- op: q.Replace,
1013
+ op: K.Replace,
1014
1014
  path: f,
1015
1015
  value: i.length
1016
1016
  });
@@ -1018,7 +1018,7 @@ function Ks(n, e, t, r, s) {
1018
1018
  for (let l = c.length; i.length < l; l -= 1) {
1019
1019
  const f = e.concat([l - 1]), p = Ce(f, s);
1020
1020
  r.push({
1021
- op: q.Remove,
1021
+ op: K.Remove,
1022
1022
  path: p
1023
1023
  });
1024
1024
  }
@@ -1026,11 +1026,11 @@ function Ks(n, e, t, r, s) {
1026
1026
  }
1027
1027
  function qs({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
1028
1028
  t.forEach((a, c) => {
1029
- const u = Te(n, c), l = ht(Te(e, c)), f = a ? Je(n, c) ? q.Replace : q.Add : q.Remove;
1030
- if (we(u, l) && f === q.Replace)
1029
+ const u = Te(n, c), l = pt(Te(e, c)), f = a ? Je(n, c) ? K.Replace : K.Add : K.Remove;
1030
+ if (we(u, l) && f === K.Replace)
1031
1031
  return;
1032
1032
  const p = r.concat(c), y = Ce(p, o);
1033
- s.push(f === q.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === q.Add ? { op: q.Remove, path: y } : f === q.Remove ? { op: q.Add, path: y, value: u } : { op: q.Replace, path: y, value: u });
1033
+ s.push(f === K.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === K.Add ? { op: K.Remove, path: y } : f === K.Remove ? { op: K.Add, path: y, value: u } : { op: K.Replace, path: y, value: u });
1034
1034
  });
1035
1035
  }
1036
1036
  function Ws({ original: n, copy: e }, t, r, s, i) {
@@ -1039,11 +1039,11 @@ function Ws({ original: n, copy: e }, t, r, s, i) {
1039
1039
  if (!e.has(a)) {
1040
1040
  const c = t.concat([o]), u = Ce(c, i);
1041
1041
  r.push({
1042
- op: q.Remove,
1042
+ op: K.Remove,
1043
1043
  path: u,
1044
1044
  value: a
1045
1045
  }), s.unshift({
1046
- op: q.Add,
1046
+ op: K.Add,
1047
1047
  path: u,
1048
1048
  value: a
1049
1049
  });
@@ -1053,11 +1053,11 @@ function Ws({ original: n, copy: e }, t, r, s, i) {
1053
1053
  if (!n.has(a)) {
1054
1054
  const c = t.concat([o]), u = Ce(c, i);
1055
1055
  r.push({
1056
- op: q.Add,
1056
+ op: K.Add,
1057
1057
  path: u,
1058
1058
  value: a
1059
1059
  }), s.unshift({
1060
- op: q.Remove,
1060
+ op: K.Remove,
1061
1061
  path: u,
1062
1062
  value: a
1063
1063
  });
@@ -1077,30 +1077,30 @@ function et(n, e, t, r) {
1077
1077
  return Ws(n, e, t, r, s);
1078
1078
  }
1079
1079
  }
1080
- const bt = (n, e, t = !1) => {
1081
- if (typeof n == "object" && n !== null && (!he(n, e) || t))
1080
+ const _t = (n, e, t = !1) => {
1081
+ if (typeof n == "object" && n !== null && (!pe(n, e) || t))
1082
1082
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
1083
1083
  }, Qt = {
1084
1084
  get size() {
1085
- return ie(M(this)).size;
1085
+ return oe(M(this)).size;
1086
1086
  },
1087
1087
  has(n) {
1088
- return ie(M(this)).has(n);
1088
+ return oe(M(this)).has(n);
1089
1089
  },
1090
1090
  set(n, e) {
1091
- const t = M(this), r = ie(t);
1092
- return (!r.has(n) || !we(r.get(n), e)) && (Y(t), ge(t), t.assignedMap.set(n, !0), t.copy.set(n, e), hn(t, n, e, et)), this;
1091
+ const t = M(this), r = oe(t);
1092
+ return (!r.has(n) || !we(r.get(n), e)) && (X(t), ge(t), t.assignedMap.set(n, !0), t.copy.set(n, e), hn(t, n, e, et)), this;
1093
1093
  },
1094
1094
  delete(n) {
1095
1095
  if (!this.has(n))
1096
1096
  return !1;
1097
1097
  const e = M(this);
1098
- return Y(e), ge(e), e.original.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.copy.delete(n), !0;
1098
+ return X(e), ge(e), e.original.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.copy.delete(n), !0;
1099
1099
  },
1100
1100
  clear() {
1101
1101
  const n = M(this);
1102
1102
  if (this.size) {
1103
- Y(n), ge(n), n.assignedMap = /* @__PURE__ */ new Map();
1103
+ X(n), ge(n), n.assignedMap = /* @__PURE__ */ new Map();
1104
1104
  for (const [e] of n.original)
1105
1105
  n.assignedMap.set(e, !1);
1106
1106
  n.copy.clear();
@@ -1108,14 +1108,14 @@ const bt = (n, e, t = !1) => {
1108
1108
  },
1109
1109
  forEach(n, e) {
1110
1110
  const t = M(this);
1111
- ie(t).forEach((r, s) => {
1111
+ oe(t).forEach((r, s) => {
1112
1112
  n.call(e, this.get(s), s, this);
1113
1113
  });
1114
1114
  },
1115
1115
  get(n) {
1116
1116
  var e, t;
1117
- const r = M(this), s = ie(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, oe)) === oe.mutable;
1118
- if (r.options.strict && bt(s, r.options, i), i || r.finalized || !he(s, r.options) || s !== r.original.get(n))
1117
+ const r = M(this), s = oe(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, ae)) === ae.mutable;
1118
+ if (r.options.strict && _t(s, r.options, i), i || r.finalized || !pe(s, r.options) || s !== r.original.get(n))
1119
1119
  return s;
1120
1120
  const o = cn.createDraft({
1121
1121
  original: s,
@@ -1124,15 +1124,15 @@ const bt = (n, e, t = !1) => {
1124
1124
  finalities: r.finalities,
1125
1125
  options: r.options
1126
1126
  });
1127
- return Y(r), r.copy.set(n, o), o;
1127
+ return X(r), r.copy.set(n, o), o;
1128
1128
  },
1129
1129
  keys() {
1130
- return ie(M(this)).keys();
1130
+ return oe(M(this)).keys();
1131
1131
  },
1132
1132
  values() {
1133
1133
  const n = this.keys();
1134
1134
  return {
1135
- [dt]: () => this.values(),
1135
+ [ht]: () => this.values(),
1136
1136
  next: () => {
1137
1137
  const e = n.next();
1138
1138
  return e.done ? e : {
@@ -1145,7 +1145,7 @@ const bt = (n, e, t = !1) => {
1145
1145
  entries() {
1146
1146
  const n = this.keys();
1147
1147
  return {
1148
- [dt]: () => this.entries(),
1148
+ [ht]: () => this.entries(),
1149
1149
  next: () => {
1150
1150
  const e = n.next();
1151
1151
  if (e.done)
@@ -1158,7 +1158,7 @@ const bt = (n, e, t = !1) => {
1158
1158
  }
1159
1159
  };
1160
1160
  },
1161
- [dt]() {
1161
+ [ht]() {
1162
1162
  return this.entries();
1163
1163
  }
1164
1164
  }, zs = Reflect.ownKeys(Qt), Nn = (n, e, { isValuesIterator: t }) => () => {
@@ -1168,8 +1168,8 @@ const bt = (n, e, t = !1) => {
1168
1168
  return i;
1169
1169
  const o = i.value;
1170
1170
  let a = n.setMap.get(o);
1171
- const c = M(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, oe)) === oe.mutable;
1172
- if (n.options.strict && bt(o, n.options, u), !u && !c && he(o, n.options) && !n.finalized && n.original.has(o)) {
1171
+ const c = M(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, ae)) === ae.mutable;
1172
+ if (n.options.strict && _t(o, n.options, u), !u && !c && pe(o, n.options) && !n.finalized && n.original.has(o)) {
1173
1173
  const l = cn.createDraft({
1174
1174
  original: o,
1175
1175
  parentDraft: n,
@@ -1183,7 +1183,7 @@ const bt = (n, e, t = !1) => {
1183
1183
  done: !1,
1184
1184
  value: t ? a : [a, a]
1185
1185
  };
1186
- }, _t = {
1186
+ }, gt = {
1187
1187
  get size() {
1188
1188
  return M(this).setMap.size;
1189
1189
  },
@@ -1191,19 +1191,19 @@ const bt = (n, e, t = !1) => {
1191
1191
  const e = M(this);
1192
1192
  if (e.setMap.has(n))
1193
1193
  return !0;
1194
- Y(e);
1194
+ X(e);
1195
1195
  const t = M(n);
1196
1196
  return !!(t && e.setMap.has(t.original));
1197
1197
  },
1198
1198
  add(n) {
1199
1199
  const e = M(this);
1200
- return this.has(n) || (Y(e), ge(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), hn(e, n, n, et)), this;
1200
+ return this.has(n) || (X(e), ge(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), hn(e, n, n, et)), this;
1201
1201
  },
1202
1202
  delete(n) {
1203
1203
  if (!this.has(n))
1204
1204
  return !1;
1205
1205
  const e = M(this);
1206
- Y(e), ge(e);
1206
+ X(e), ge(e);
1207
1207
  const t = M(n);
1208
1208
  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));
1209
1209
  },
@@ -1211,14 +1211,14 @@ const bt = (n, e, t = !1) => {
1211
1211
  if (!this.size)
1212
1212
  return;
1213
1213
  const n = M(this);
1214
- Y(n), ge(n);
1214
+ X(n), ge(n);
1215
1215
  for (const e of n.original)
1216
1216
  n.assignedMap.set(e, !1);
1217
1217
  n.setMap.clear();
1218
1218
  },
1219
1219
  values() {
1220
1220
  const n = M(this);
1221
- Y(n);
1221
+ X(n);
1222
1222
  const e = n.setMap.keys();
1223
1223
  return {
1224
1224
  [Symbol.iterator]: () => this.values(),
@@ -1227,7 +1227,7 @@ const bt = (n, e, t = !1) => {
1227
1227
  },
1228
1228
  entries() {
1229
1229
  const n = M(this);
1230
- Y(n);
1230
+ X(n);
1231
1231
  const e = n.setMap.keys();
1232
1232
  return {
1233
1233
  [Symbol.iterator]: () => this.entries(),
@@ -1239,7 +1239,7 @@ const bt = (n, e, t = !1) => {
1239
1239
  keys() {
1240
1240
  return this.values();
1241
1241
  },
1242
- [dt]() {
1242
+ [ht]() {
1243
1243
  return this.values();
1244
1244
  },
1245
1245
  forEach(n, e) {
@@ -1249,7 +1249,7 @@ const bt = (n, e, t = !1) => {
1249
1249
  n.call(e, r.value, r.value, this), r = t.next();
1250
1250
  }
1251
1251
  };
1252
- Set.prototype.difference && Object.assign(_t, {
1252
+ Set.prototype.difference && Object.assign(gt, {
1253
1253
  intersection(n) {
1254
1254
  return Set.prototype.intersection.call(new Set(this.values()), n);
1255
1255
  },
@@ -1272,7 +1272,7 @@ Set.prototype.difference && Object.assign(_t, {
1272
1272
  return Set.prototype.isDisjointFrom.call(new Set(this.values()), n);
1273
1273
  }
1274
1274
  });
1275
- const Vs = Reflect.ownKeys(_t), Ar = /* @__PURE__ */ new WeakSet(), Or = {
1275
+ const Vs = Reflect.ownKeys(gt), Ar = /* @__PURE__ */ new WeakSet(), Or = {
1276
1276
  get(n, e, t) {
1277
1277
  var r, s;
1278
1278
  const i = (r = n.copy) === null || r === void 0 ? void 0 : r[e];
@@ -1283,10 +1283,10 @@ const Vs = Reflect.ownKeys(_t), Ar = /* @__PURE__ */ new WeakSet(), Or = {
1283
1283
  let o;
1284
1284
  if (n.options.mark) {
1285
1285
  const u = e === "size" && (n.original instanceof Map || n.original instanceof Set) ? Reflect.get(n.original, e) : Reflect.get(n.original, e, t);
1286
- if (o = n.options.mark(u, oe), o === oe.mutable)
1287
- return n.options.strict && bt(u, n.options, !0), u;
1286
+ if (o = n.options.mark(u, ae), o === ae.mutable)
1287
+ return n.options.strict && _t(u, n.options, !0), u;
1288
1288
  }
1289
- const a = ie(n);
1289
+ const a = oe(n);
1290
1290
  if (a instanceof Map && zs.includes(e)) {
1291
1291
  if (e === "size")
1292
1292
  return Object.getOwnPropertyDescriptor(Qt, "size").get.call(n.proxy);
@@ -1296,8 +1296,8 @@ const Vs = Reflect.ownKeys(_t), Ar = /* @__PURE__ */ new WeakSet(), Or = {
1296
1296
  }
1297
1297
  if (a instanceof Set && Vs.includes(e)) {
1298
1298
  if (e === "size")
1299
- return Object.getOwnPropertyDescriptor(_t, "size").get.call(n.proxy);
1300
- const u = _t[e];
1299
+ return Object.getOwnPropertyDescriptor(gt, "size").get.call(n.proxy);
1300
+ const u = gt[e];
1301
1301
  if (u)
1302
1302
  return u.bind(n.proxy);
1303
1303
  }
@@ -1309,10 +1309,10 @@ const Vs = Reflect.ownKeys(_t), Ar = /* @__PURE__ */ new WeakSet(), Or = {
1309
1309
  ) : void 0;
1310
1310
  }
1311
1311
  const c = a[e];
1312
- if (n.options.strict && bt(c, n.options), n.finalized || !he(c, n.options))
1312
+ if (n.options.strict && _t(c, n.options), n.finalized || !pe(c, n.options))
1313
1313
  return c;
1314
1314
  if (c === jt(n.original, e)) {
1315
- if (Y(n), n.copy[e] = pn({
1315
+ if (X(n), n.copy[e] = pn({
1316
1316
  original: n.original[e],
1317
1317
  parentDraft: n,
1318
1318
  key: n.type === 1 ? Number(e) : e,
@@ -1320,7 +1320,7 @@ const Vs = Reflect.ownKeys(_t), Ar = /* @__PURE__ */ new WeakSet(), Or = {
1320
1320
  options: n.options
1321
1321
  }), typeof o == "function") {
1322
1322
  const u = M(n.copy[e]);
1323
- return Y(u), ge(u), u.copy;
1323
+ return X(u), ge(u), u.copy;
1324
1324
  }
1325
1325
  return n.copy[e];
1326
1326
  }
@@ -1333,20 +1333,20 @@ const Vs = Reflect.ownKeys(_t), Ar = /* @__PURE__ */ new WeakSet(), Or = {
1333
1333
  let s;
1334
1334
  if (n.type === 1 && e !== "length" && !(Number.isInteger(s = Number(e)) && s >= 0 && (e === 0 || s === 0 || String(s) === String(e))))
1335
1335
  throw new Error("Only supports setting array indices and the 'length' property.");
1336
- const i = Ln(ie(n), e);
1336
+ const i = Ln(oe(n), e);
1337
1337
  if (i != null && i.set)
1338
1338
  return i.set.call(n.proxy, t), !0;
1339
- const o = jt(ie(n), e), a = M(o);
1340
- return a && we(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) : (we(t, o) && (t !== void 0 || Je(n.original, e)) || (Y(n), ge(n), Je(n.original, e) && we(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, hn(n, e, t, et)), !0);
1339
+ const o = jt(oe(n), e), a = M(o);
1340
+ return a && we(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) : (we(t, o) && (t !== void 0 || Je(n.original, e)) || (X(n), ge(n), Je(n.original, e) && we(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, hn(n, e, t, et)), !0);
1341
1341
  },
1342
1342
  has(n, e) {
1343
- return e in ie(n);
1343
+ return e in oe(n);
1344
1344
  },
1345
1345
  ownKeys(n) {
1346
- return Reflect.ownKeys(ie(n));
1346
+ return Reflect.ownKeys(oe(n));
1347
1347
  },
1348
1348
  getOwnPropertyDescriptor(n, e) {
1349
- const t = ie(n), r = Reflect.getOwnPropertyDescriptor(t, e);
1349
+ const t = oe(n), r = Reflect.getOwnPropertyDescriptor(t, e);
1350
1350
  return r && {
1351
1351
  writable: !0,
1352
1352
  configurable: n.type !== 1 || e !== "length",
@@ -1365,7 +1365,7 @@ const Vs = Reflect.ownKeys(_t), Ar = /* @__PURE__ */ new WeakSet(), Or = {
1365
1365
  },
1366
1366
  deleteProperty(n, e) {
1367
1367
  var t;
1368
- return n.type === 1 ? Or.set.call(this, n, e, void 0, n.proxy) : (jt(n.original, e) !== void 0 || e in n.original ? (Y(n), ge(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);
1368
+ return n.type === 1 ? Or.set.call(this, n, e, void 0, n.proxy) : (jt(n.original, e) !== void 0 || e in n.original ? (X(n), ge(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);
1369
1369
  }
1370
1370
  };
1371
1371
  function pn(n) {
@@ -1416,8 +1416,8 @@ function Bs(n, e, t, r, s) {
1416
1416
  const u = c ? e[0] : o ? o.operated ? o.copy : o.original : n;
1417
1417
  return o && zt(o), s && Ue(u, u, o == null ? void 0 : o.options.updatedValues), [
1418
1418
  u,
1419
- t && c ? [{ op: q.Replace, path: [], value: e[0] }] : t,
1420
- r && c ? [{ op: q.Replace, path: [], value: a }] : r
1419
+ t && c ? [{ op: K.Replace, path: [], value: e[0] }] : t,
1420
+ r && c ? [{ op: K.Replace, path: [], value: a }] : r
1421
1421
  ];
1422
1422
  }
1423
1423
  function Qs(n, e) {
@@ -1429,7 +1429,7 @@ function Qs(n, e) {
1429
1429
  };
1430
1430
  let s, i;
1431
1431
  e.enablePatches && (s = [], i = []);
1432
- const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, oe)) === oe.mutable || !he(n, e) ? n : pn({
1432
+ const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, ae)) === ae.mutable || !pe(n, e) ? n : pn({
1433
1433
  original: n,
1434
1434
  parentDraft: null,
1435
1435
  finalities: r,
@@ -1461,7 +1461,7 @@ function Gt(n) {
1461
1461
  function Er(n) {
1462
1462
  var e;
1463
1463
  const t = M(n);
1464
- if (!he(n, t == null ? void 0 : t.options))
1464
+ if (!pe(n, t == null ? void 0 : t.options))
1465
1465
  return n;
1466
1466
  const r = Re(n);
1467
1467
  if (t && !t.operated)
@@ -1499,7 +1499,7 @@ const Gs = (n) => function e(t, r, s) {
1499
1499
  var i, o, a;
1500
1500
  if (typeof t == "function" && typeof r != "function")
1501
1501
  return function(v, ...k) {
1502
- return e(v, (D) => t.call(this, D, ...k), r);
1502
+ return e(v, (j) => t.call(this, j, ...k), r);
1503
1503
  };
1504
1504
  const c = t, u = r;
1505
1505
  let l = s;
@@ -1507,10 +1507,10 @@ const Gs = (n) => function e(t, r, s) {
1507
1507
  throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
1508
1508
  l = Object.assign(Object.assign({}, n), l);
1509
1509
  const f = Me(c) ? Kn(c) : c, p = Array.isArray(l.mark) ? (v, k) => {
1510
- for (const D of l.mark) {
1511
- if (typeof D != "function")
1512
- throw new Error(`Invalid mark: ${D}, 'mark' should be a function.`);
1513
- const x = D(v, k);
1510
+ for (const j of l.mark) {
1511
+ if (typeof j != "function")
1512
+ throw new Error(`Invalid mark: ${j}, 'mark' should be a function.`);
1513
+ const x = j(v, k);
1514
1514
  if (x)
1515
1515
  return x;
1516
1516
  }
@@ -1520,11 +1520,11 @@ const Gs = (n) => function e(t, r, s) {
1520
1520
  strict: b,
1521
1521
  enablePatches: y
1522
1522
  };
1523
- if (!he(f, T) && typeof f == "object" && f !== null)
1523
+ if (!pe(f, T) && typeof f == "object" && f !== null)
1524
1524
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
1525
1525
  const [S, _] = Qs(f, T);
1526
1526
  if (typeof r != "function") {
1527
- if (!he(f, T))
1527
+ if (!pe(f, T))
1528
1528
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
1529
1529
  return [S, _];
1530
1530
  }
@@ -1541,21 +1541,21 @@ const Gs = (n) => function e(t, r, s) {
1541
1541
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
1542
1542
  const x = v == null ? void 0 : v[xs];
1543
1543
  if (x) {
1544
- const N = x[0];
1544
+ const z = x[0];
1545
1545
  return T.strict && typeof v == "object" && v !== null && Gt({
1546
1546
  rootDraft: k,
1547
1547
  value: v,
1548
1548
  useRawReturn: !0
1549
- }), _([N]);
1549
+ }), _([z]);
1550
1550
  }
1551
1551
  if (v !== void 0)
1552
1552
  return typeof v == "object" && v !== null && Gt({ rootDraft: k, value: v }), _([v]);
1553
1553
  }
1554
1554
  if (v === S || v === void 0)
1555
1555
  return _([]);
1556
- const D = M(v);
1557
- if (T === D.options) {
1558
- if (D.operated)
1556
+ const j = M(v);
1557
+ if (T === j.options) {
1558
+ if (j.operated)
1559
1559
  throw new Error("Cannot return a modified child draft.");
1560
1560
  return _([Kn(v)]);
1561
1561
  }
@@ -1564,7 +1564,7 @@ const Gs = (n) => function e(t, r, s) {
1564
1564
  return w instanceof Promise ? w.then(C, (v) => {
1565
1565
  throw zt(M(S)), v;
1566
1566
  }) : C(w);
1567
- }, gt = Gs();
1567
+ }, mt = Gs();
1568
1568
  Object.prototype.constructor.toString();
1569
1569
  function kr(n, e) {
1570
1570
  const t = Object.keys(n), r = Object.keys(e);
@@ -1573,8 +1573,8 @@ function kr(n, e) {
1573
1573
  function qn(n, e) {
1574
1574
  return Object.keys(n).length === Object.keys(e).length && Object.keys(n).every((t) => e.hasOwnProperty(t) && n[t] === e[t]);
1575
1575
  }
1576
- function pt(n, e) {
1577
- return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : kr(n, e) ? Object.keys(n).every((t) => pt(n[t], e[t])) : !1;
1576
+ function yt(n, e) {
1577
+ return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : kr(n, e) ? Object.keys(n).every((t) => yt(n[t], e[t])) : !1;
1578
1578
  }
1579
1579
  function yn(n) {
1580
1580
  if (!Qe(n))
@@ -1947,7 +1947,7 @@ function hi(n) {
1947
1947
  return null;
1948
1948
  }
1949
1949
  }
1950
- function Tt(n) {
1950
+ function St(n) {
1951
1951
  if (n !== void 0) {
1952
1952
  if (n === null)
1953
1953
  return null;
@@ -1996,7 +1996,7 @@ class Ie {
1996
1996
  for (const e of Object.values(this.attrs))
1997
1997
  if (_n(e)) {
1998
1998
  const [t, r, s] = e["forward-identity"];
1999
- ne(this.blobAttrs, [r, s], e);
1999
+ re(this.blobAttrs, [r, s], e);
2000
2000
  }
2001
2001
  return this._blobAttrs;
2002
2002
  }
@@ -2007,7 +2007,7 @@ class Ie {
2007
2007
  for (const e of Object.values(this.attrs))
2008
2008
  if (e["primary?"]) {
2009
2009
  const [t, r] = e["forward-identity"];
2010
- ne(this._primaryKeys, [r], e);
2010
+ re(this._primaryKeys, [r], e);
2011
2011
  }
2012
2012
  return this._primaryKeys;
2013
2013
  }
@@ -2017,7 +2017,7 @@ class Ie {
2017
2017
  this._forwardIdents = /* @__PURE__ */ new Map();
2018
2018
  for (const e of Object.values(this.attrs)) {
2019
2019
  const t = e["forward-identity"], [r, s, i] = t;
2020
- ne(this._forwardIdents, [s, i], e);
2020
+ re(this._forwardIdents, [s, i], e);
2021
2021
  }
2022
2022
  return this._forwardIdents;
2023
2023
  }
@@ -2029,7 +2029,7 @@ class Ie {
2029
2029
  const t = e["reverse-identity"];
2030
2030
  if (t) {
2031
2031
  const [r, s, i] = t;
2032
- ne(this._revIdents, [s, i], e);
2032
+ re(this._revIdents, [s, i], e);
2033
2033
  }
2034
2034
  }
2035
2035
  return this._revIdents;
@@ -2050,7 +2050,7 @@ function _n(n) {
2050
2050
  function Ke(n, e) {
2051
2051
  return e.reduce((t, r) => t && t.get(r), n);
2052
2052
  }
2053
- function de(n, e) {
2053
+ function he(n, e) {
2054
2054
  if (e.length === 0)
2055
2055
  throw new Error("path must have at least one element");
2056
2056
  if (e.length === 1) {
@@ -2058,9 +2058,9 @@ function de(n, e) {
2058
2058
  return;
2059
2059
  }
2060
2060
  const [t, ...r] = e;
2061
- n.has(t) && de(n.get(t), r);
2061
+ n.has(t) && he(n.get(t), r);
2062
2062
  }
2063
- function ne(n, e, t) {
2063
+ function re(n, e, t) {
2064
2064
  let r = n;
2065
2065
  const s = e.length - 1;
2066
2066
  for (let i = 0; i < s; i++) {
@@ -2079,13 +2079,13 @@ function Pr(n, e, t) {
2079
2079
  console.warn("no such attr", c, a);
2080
2080
  continue;
2081
2081
  }
2082
- l["checked-data-type"] === "date" && t && (u = Tt(u), o[2] = u), bn(l) && ne(i, [u, c, a], o), ne(r, [a, c, u], o), ne(s, [c, a, u], o);
2082
+ l["checked-data-type"] === "date" && t && (u = St(u), o[2] = u), bn(l) && re(i, [u, c, a], o), re(r, [a, c, u], o), re(s, [c, a, u], o);
2083
2083
  }
2084
2084
  return { eav: r, aev: s, vae: i };
2085
2085
  }
2086
2086
  function Mr(n) {
2087
2087
  return {
2088
- triples: re(n.eav, 3),
2088
+ triples: se(n.eav, 3),
2089
2089
  cardinalityInference: n.cardinalityInference,
2090
2090
  useDateObjects: n.useDateObjects,
2091
2091
  version: 1
@@ -2114,7 +2114,7 @@ function nt(n, e) {
2114
2114
  const [o, a] = e[0], c = n.aev.get(o);
2115
2115
  if (!c)
2116
2116
  return null;
2117
- t = (s = re(c, 2).find((l) => l[2] === a)) == null ? void 0 : s[0];
2117
+ t = (s = se(c, 2).find((l) => l[2] === a)) == null ? void 0 : s[0];
2118
2118
  } else
2119
2119
  t = e[0];
2120
2120
  if (!t)
@@ -2124,7 +2124,7 @@ function nt(n, e) {
2124
2124
  const [o, a] = r, c = n.aev.get(o);
2125
2125
  if (!c)
2126
2126
  return null;
2127
- const l = (i = re(c, 2).find((g) => g[2] === a)) == null ? void 0 : i[0];
2127
+ const l = (i = se(c, 2).find((g) => g[2] === a)) == null ? void 0 : i[0];
2128
2128
  if (!l)
2129
2129
  return null;
2130
2130
  const [f, p, y, ...b] = e;
@@ -2139,7 +2139,7 @@ function Dr(n, e, t) {
2139
2139
  if (!r)
2140
2140
  return;
2141
2141
  const [s, i, o] = r, a = e.getAttr(i);
2142
- a && (de(n.eav, [s, i, o]), de(n.aev, [i, s, o]), bn(a) && de(n.vae, [o, i, s]));
2142
+ a && (he(n.eav, [s, i, o]), he(n.aev, [i, s, o]), bn(a) && he(n.vae, [o, i, s]));
2143
2143
  }
2144
2144
  let bi = 0;
2145
2145
  function $r(n, e, t) {
@@ -2156,9 +2156,9 @@ function xr(n, e, t) {
2156
2156
  const a = e.getAttr(i);
2157
2157
  if (!a)
2158
2158
  return;
2159
- a["checked-data-type"] === "date" && n.useDateObjects && (o = Tt(o));
2159
+ a["checked-data-type"] === "date" && n.useDateObjects && (o = St(o));
2160
2160
  const c = Ke(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? $r(n, a, r), l = [s, i, o, u];
2161
- pi(a) ? (ne(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), ne(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (ne(n.eav, [s, i, o], l), ne(n.aev, [i, s, o], l)), bn(a) && ne(n.vae, [o, i, s], l);
2161
+ pi(a) ? (re(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), re(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (re(n.eav, [s, i, o], l), re(n.aev, [i, s, o], l)), bn(a) && re(n.vae, [o, i, s], l);
2162
2162
  }
2163
2163
  function _i(n, e, t) {
2164
2164
  var y;
@@ -2182,7 +2182,7 @@ function _i(n, e, t) {
2182
2182
  f,
2183
2183
  $r(n, a, u)
2184
2184
  ];
2185
- ne(n.eav, [s, i], /* @__PURE__ */ new Map([[f, p]])), ne(n.aev, [i, s], /* @__PURE__ */ new Map([[f, p]]));
2185
+ re(n.eav, [s, i], /* @__PURE__ */ new Map([[f, p]])), re(n.aev, [i, s], /* @__PURE__ */ new Map([[f, p]]));
2186
2186
  }
2187
2187
  function Jt(n, e, t) {
2188
2188
  var u, l;
@@ -2193,23 +2193,23 @@ function Jt(n, e, t) {
2193
2193
  if (a) {
2194
2194
  for (const f of a.keys()) {
2195
2195
  const p = e.getAttr(f);
2196
- p && p["on-delete-reverse"] === "cascade" && re(a.get(f), 1).forEach(([y, b, g]) => {
2196
+ p && p["on-delete-reverse"] === "cascade" && se(a.get(f), 1).forEach(([y, b, g]) => {
2197
2197
  var T;
2198
2198
  return Jt(n, e, [g, (T = p["reverse-identity"]) == null ? void 0 : T[1]]);
2199
2199
  }), // Fall back to deleting everything if we've rehydrated tx-steps from
2200
2200
  // the store that didn't set `etype` in deleteEntity
2201
2201
  (!s || // If we don't know about the attr, let's just get rid of it
2202
2202
  !p || // Make sure it matches the etype
2203
- ((u = p["forward-identity"]) == null ? void 0 : u[1]) === s) && (de(n.aev, [f, o]), de(n.eav, [o, f]));
2203
+ ((u = p["forward-identity"]) == null ? void 0 : u[1]) === s) && (he(n.aev, [f, o]), he(n.eav, [o, f]));
2204
2204
  }
2205
- a.size === 0 && de(n.eav, [o]);
2205
+ a.size === 0 && he(n.eav, [o]);
2206
2206
  }
2207
- const c = n.vae.get(o) && re(n.vae.get(o), 2);
2207
+ const c = n.vae.get(o) && se(n.vae.get(o), 2);
2208
2208
  c && c.forEach((f) => {
2209
2209
  var T, S, _;
2210
2210
  const [p, y, b] = f, g = e.getAttr(y);
2211
- (!s || !g || ((T = g["reverse-identity"]) == null ? void 0 : T[1]) === s) && (de(n.eav, [p, y, b]), de(n.aev, [y, p, b]), de(n.vae, [b, y, p])), g && g["on-delete"] === "cascade" && ((S = g["reverse-identity"]) == null ? void 0 : S[1]) === s && Jt(n, e, [p, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
2212
- }), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && de(n.vae, [o]);
2211
+ (!s || !g || ((T = g["reverse-identity"]) == null ? void 0 : T[1]) === s) && (he(n.eav, [p, y, b]), he(n.aev, [y, p, b]), he(n.vae, [b, y, p])), g && g["on-delete"] === "cascade" && ((S = g["reverse-identity"]) == null ? void 0 : S[1]) === s && Jt(n, e, [p, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
2212
+ }), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && he(n.vae, [o]);
2213
2213
  }
2214
2214
  function Ur(n, e, t) {
2215
2215
  const r = Pr(e, t, n.useDateObjects);
@@ -2221,7 +2221,7 @@ function gi(n, [e]) {
2221
2221
  n.addAttr(e);
2222
2222
  }
2223
2223
  function Lr(n) {
2224
- return re(n.eav, 3);
2224
+ return se(n.eav, 3);
2225
2225
  }
2226
2226
  function mi(n, e, [t]) {
2227
2227
  if (!e.getAttr(t))
@@ -2264,7 +2264,7 @@ function Ti(n, e, t) {
2264
2264
  throw new Error(`unhandled transaction action: ${r}`);
2265
2265
  }
2266
2266
  }
2267
- function re(n, e, t = []) {
2267
+ function se(n, e, t = []) {
2268
2268
  if (!n || e === 0)
2269
2269
  return t;
2270
2270
  if (e === 1) {
@@ -2273,10 +2273,10 @@ function re(n, e, t = []) {
2273
2273
  return t;
2274
2274
  }
2275
2275
  for (const r of n.values())
2276
- re(r, e - 1, t);
2276
+ se(r, e - 1, t);
2277
2277
  return t;
2278
2278
  }
2279
- function ct(n, e, t) {
2279
+ function ut(n, e, t) {
2280
2280
  var i;
2281
2281
  const r = [];
2282
2282
  if (t != null && t.hasOwnProperty("$not")) {
@@ -2301,7 +2301,7 @@ function ct(n, e, t) {
2301
2301
  return r;
2302
2302
  }
2303
2303
  if (t != null && t.$comparator)
2304
- return re(e, 1).filter(t.$op);
2304
+ return se(e, 1).filter(t.$op);
2305
2305
  const s = t.in || t.$in || [t];
2306
2306
  for (const o of s) {
2307
2307
  const a = e.get(o);
@@ -2318,15 +2318,15 @@ function vi(n, [e, t, r]) {
2318
2318
  switch (Si(e, t, r)) {
2319
2319
  case "e": {
2320
2320
  const a = n.eav.get(e);
2321
- return re(a, 2);
2321
+ return se(a, 2);
2322
2322
  }
2323
2323
  case "ea": {
2324
2324
  const a = (i = n.eav.get(e)) == null ? void 0 : i.get(t);
2325
- return re(a, 1);
2325
+ return se(a, 1);
2326
2326
  }
2327
2327
  case "eav": {
2328
2328
  const a = (o = n.eav.get(e)) == null ? void 0 : o.get(t);
2329
- return a ? ct(n, a, r) : [];
2329
+ return a ? ut(n, a, r) : [];
2330
2330
  }
2331
2331
  case "ev": {
2332
2332
  const a = n.eav.get(e);
@@ -2334,12 +2334,12 @@ function vi(n, [e, t, r]) {
2334
2334
  return [];
2335
2335
  const c = [];
2336
2336
  for (const u of a.values())
2337
- c.push(...ct(n, u, r));
2337
+ c.push(...ut(n, u, r));
2338
2338
  return c;
2339
2339
  }
2340
2340
  case "a": {
2341
2341
  const a = n.aev.get(t);
2342
- return re(a, 2);
2342
+ return se(a, 2);
2343
2343
  }
2344
2344
  case "av": {
2345
2345
  const a = n.aev.get(t);
@@ -2347,18 +2347,18 @@ function vi(n, [e, t, r]) {
2347
2347
  return [];
2348
2348
  const c = [];
2349
2349
  for (const u of a.values())
2350
- c.push(...ct(n, u, r));
2350
+ c.push(...ut(n, u, r));
2351
2351
  return c;
2352
2352
  }
2353
2353
  case "v": {
2354
2354
  const a = [];
2355
2355
  for (const c of n.eav.values())
2356
2356
  for (const u of c.values())
2357
- a.push(...ct(n, u, r));
2357
+ a.push(...ut(n, u, r));
2358
2358
  return a;
2359
2359
  }
2360
2360
  default:
2361
- return re(n.eav, 3);
2361
+ return se(n.eav, 3);
2362
2362
  }
2363
2363
  }
2364
2364
  function Ai(n, e, t) {
@@ -2367,13 +2367,13 @@ function Ai(n, e, t) {
2367
2367
  if (!e)
2368
2368
  return r;
2369
2369
  for (const [i, o] of e.entries()) {
2370
- const a = (s = n.eav.get(t)) == null ? void 0 : s.get(o.id), c = re(a, 1);
2370
+ const a = (s = n.eav.get(t)) == null ? void 0 : s.get(o.id), c = se(a, 1);
2371
2371
  for (const u of c)
2372
2372
  r[i] = u[2];
2373
2373
  }
2374
2374
  return r;
2375
2375
  }
2376
- function z(n, e, t) {
2376
+ function W(n, e, t) {
2377
2377
  var r;
2378
2378
  return (r = n.forwardIdents.get(e)) == null ? void 0 : r.get(t);
2379
2379
  }
@@ -2416,7 +2416,7 @@ function ki(n, e, t) {
2416
2416
  }
2417
2417
  return !(u === "create" && l || u === "update" && !l);
2418
2418
  });
2419
- return gt({ store: n, attrsStore: e }, (s) => {
2419
+ return mt({ store: n, attrsStore: e }, (s) => {
2420
2420
  r.forEach((i) => {
2421
2421
  Ti(s.store, s.attrsStore, i);
2422
2422
  });
@@ -2556,9 +2556,9 @@ function Qi() {
2556
2556
  const Gi = Qi();
2557
2557
  let Hi = !0, Ji = 0;
2558
2558
  function Ye(n) {
2559
- return St(`_${n}`, Ji++);
2559
+ return vt(`_${n}`, Ji++);
2560
2560
  }
2561
- function St(n, e) {
2561
+ function vt(n, e) {
2562
2562
  return `?${n}-${e}`;
2563
2563
  }
2564
2564
  class Ne extends Error {
@@ -2587,7 +2587,7 @@ function Xi(n, e, t) {
2587
2587
  return n.map((r) => r === e ? t : r);
2588
2588
  }
2589
2589
  function Kr(n, e, t, r, s) {
2590
- const i = z(e, t, s), o = je(e, t, s), a = i || o;
2590
+ const i = W(e, t, s), o = je(e, t, s), a = i || o;
2591
2591
  if (!a)
2592
2592
  throw new Ne(`Could not find attr for ${[t, s]}`);
2593
2593
  if (a["value-type"] !== "ref")
@@ -2676,11 +2676,11 @@ function eo(n, e) {
2676
2676
  return e;
2677
2677
  }
2678
2678
  function to(n, e, t, r, s, i) {
2679
- const o = z(e, t, s), a = je(e, t, s), c = o || a;
2679
+ const o = W(e, t, s), a = je(e, t, s), c = o || a;
2680
2680
  if (!c)
2681
2681
  throw new Ne(`No attr for etype = ${t} label = ${s}`);
2682
2682
  if (i != null && i.hasOwnProperty("$isNull")) {
2683
- const u = z(e, t, "id");
2683
+ const u = W(e, t, "id");
2684
2684
  if (!u)
2685
2685
  throw new Ne(`No attr for etype = ${t} label = id`);
2686
2686
  return [
@@ -2772,7 +2772,7 @@ function qr(n, e, t, r, s) {
2772
2772
  });
2773
2773
  }
2774
2774
  function co(n, e, t, r) {
2775
- const s = St;
2775
+ const s = vt;
2776
2776
  return r ? qr(s, n, e, t, r).concat(Gn(s, n, e, t)) : Gn(s, n, e, t);
2777
2777
  }
2778
2778
  function uo(n, e, t) {
@@ -2812,7 +2812,7 @@ function ho(n, e, t) {
2812
2812
  function He(n, e, t, r, s) {
2813
2813
  return e === r || e == null && r == null ? Vi(n, t) : r == null ? 1 : e == null ? -1 : ho(e, r, s);
2814
2814
  }
2815
- function mt([n, e], [t, r], s) {
2815
+ function wt([n, e], [t, r], s) {
2816
2816
  return He(n, e, t, r, s);
2817
2817
  }
2818
2818
  function Xt(n) {
@@ -2822,9 +2822,9 @@ function po(n, e, t, r) {
2822
2822
  var b;
2823
2823
  const [s, i, o, a] = n, c = t === "desc" ? 1 : -1;
2824
2824
  if (((b = e["forward-identity"]) == null ? void 0 : b[2]) === "id")
2825
- return mt(r, [s, a], null) === c;
2825
+ return wt(r, [s, a], null) === c;
2826
2826
  const [u, l] = r, f = e["checked-data-type"], p = f === "date" ? Xt(l) : l, y = f === "date" ? Xt(o) : o;
2827
- return mt([u, p], [s, y], f) === c;
2827
+ return wt([u, p], [s, y], f) === c;
2828
2828
  }
2829
2829
  function yo(n, e) {
2830
2830
  const t = e[1];
@@ -2832,7 +2832,7 @@ function yo(n, e) {
2832
2832
  }
2833
2833
  function bo(n, e, t) {
2834
2834
  const r = Object.keys(t)[0];
2835
- return z(n, e, r);
2835
+ return W(n, e, r);
2836
2836
  }
2837
2837
  function _o(n, e, t, r) {
2838
2838
  if (t)
@@ -2846,11 +2846,11 @@ function go(n, e, t) {
2846
2846
  return Oi(n, e);
2847
2847
  const r = /* @__PURE__ */ new Map();
2848
2848
  for (const o of t.fields) {
2849
- const a = z(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
2849
+ const a = W(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
2850
2850
  c && _n(a) && r.set(c, a);
2851
2851
  }
2852
2852
  if (!r.has("id")) {
2853
- const o = z(n, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
2853
+ const o = W(n, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
2854
2854
  a && r.set(a, o);
2855
2855
  }
2856
2856
  return r;
@@ -2863,15 +2863,15 @@ function mo(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
2863
2863
  if (f && ((g = f == null ? void 0 : f["forward-identity"]) == null ? void 0 : g[2]) !== "id") {
2864
2864
  const T = f["checked-data-type"] === "date", S = f.id;
2865
2865
  u = u.map(([_]) => {
2866
- var C, v, k, D, x;
2867
- let w = (x = (D = (k = (v = (C = n.eav.get(_)) == null ? void 0 : C.get(S)) == null ? void 0 : v.values()) == null ? void 0 : k.next()) == null ? void 0 : D.value) == null ? void 0 : x[2];
2866
+ var C, v, k, j, x;
2867
+ let w = (x = (j = (k = (v = (C = n.eav.get(_)) == null ? void 0 : C.get(S)) == null ? void 0 : v.values()) == null ? void 0 : k.next()) == null ? void 0 : j.value) == null ? void 0 : x[2];
2868
2868
  return T && (w = Xt(w)), [_, w];
2869
2869
  });
2870
2870
  }
2871
2871
  u.sort(c === "asc" ? function(S, _) {
2872
- return mt(S, _, f == null ? void 0 : f["checked-data-type"]);
2872
+ return wt(S, _, f == null ? void 0 : f["checked-data-type"]);
2873
2873
  } : function(S, _) {
2874
- return mt(_, S, f == null ? void 0 : f["checked-data-type"]);
2874
+ return wt(_, S, f == null ? void 0 : f["checked-data-type"]);
2875
2875
  });
2876
2876
  let p = {};
2877
2877
  const y = go(e, t, s);
@@ -2898,7 +2898,7 @@ function To(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
2898
2898
  var p, y, b, g, T;
2899
2899
  if (!Wr(s) && (!o || !o["start-cursor"]))
2900
2900
  return [];
2901
- const a = ro(co(e, t, r, (p = s.$) == null ? void 0 : p.where), i), c = uo(St, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = mo(n, e, {
2901
+ const a = ro(co(e, t, r, (p = s.$) == null ? void 0 : p.where), i), c = uo(vt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = mo(n, e, {
2902
2902
  etype: t,
2903
2903
  pageInfo: o,
2904
2904
  form: s,
@@ -2922,7 +2922,7 @@ function So(n, e, t) {
2922
2922
  }
2923
2923
  function zr(n, e, t) {
2924
2924
  const r = So(n, e, t);
2925
- return fo(St, n, e, t, r);
2925
+ return fo(vt, n, e, t, r);
2926
2926
  }
2927
2927
  function vo(n) {
2928
2928
  const e = {};
@@ -2961,7 +2961,7 @@ function Ao() {
2961
2961
  return new Set(Object.keys(e));
2962
2962
  }
2963
2963
  const Oo = Ao();
2964
- function yt(n, e, t) {
2964
+ function bt(n, e, t) {
2965
2965
  const r = {
2966
2966
  __etype: n,
2967
2967
  __ops: t
@@ -2973,7 +2973,7 @@ function yt(n, e, t) {
2973
2973
  if (i === "__etype")
2974
2974
  return n;
2975
2975
  if (Oo.has(i))
2976
- return (o, a) => yt(n, e, [
2976
+ return (o, a) => bt(n, e, [
2977
2977
  ...t,
2978
2978
  a ? [i, n, e, o, a] : [i, n, e, o]
2979
2979
  ]);
@@ -2983,7 +2983,7 @@ function yt(n, e, t) {
2983
2983
  function Eo(n, e) {
2984
2984
  return `lookup__${n}__${JSON.stringify(e)}`;
2985
2985
  }
2986
- function wt(n) {
2986
+ function Tt(n) {
2987
2987
  return n.startsWith("lookup__");
2988
2988
  }
2989
2989
  function en(n) {
@@ -2996,11 +2996,11 @@ function ko(n) {
2996
2996
  }, {
2997
2997
  get(e, t) {
2998
2998
  if (t === "lookup")
2999
- return (s, i) => yt(n, en(Eo(s, i)), []);
2999
+ return (s, i) => bt(n, en(Eo(s, i)), []);
3000
3000
  if (t === "__etype")
3001
3001
  return n;
3002
3002
  const r = t;
3003
- return wt(r) ? yt(n, en(r), []) : yt(n, r, []);
3003
+ return Tt(r) ? bt(n, en(r), []) : bt(n, r, []);
3004
3004
  }
3005
3005
  });
3006
3006
  }
@@ -3045,7 +3045,7 @@ function Po(n) {
3045
3045
  function Mo(n, e, t) {
3046
3046
  return t.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
3047
3047
  // before assuming it's a ref lookup.
3048
- !z(n, e, t);
3048
+ !W(n, e, t);
3049
3049
  }
3050
3050
  function tn(n) {
3051
3051
  const [e, t, ...r] = n.split(".");
@@ -3055,16 +3055,16 @@ function tn(n) {
3055
3055
  }
3056
3056
  function Ro(n, e, t) {
3057
3057
  if (!Mo(n, e, t))
3058
- return z(n, e, t);
3059
- const r = tn(t), s = z(n, e, r) || je(n, e, r);
3058
+ return W(n, e, t);
3059
+ const r = tn(t), s = W(n, e, r) || je(n, e, r);
3060
3060
  if (s && s["value-type"] !== "ref")
3061
3061
  throw new Error(`${t} does not reference a valid link attribute.`);
3062
3062
  return s;
3063
3063
  }
3064
3064
  function nn(n) {
3065
- return typeof n == "string" && !wt(n) ? null : typeof n == "string" && wt(n) ? en(n) : Po(n);
3065
+ return typeof n == "string" && !Tt(n) ? null : typeof n == "string" && Tt(n) ? en(n) : Po(n);
3066
3066
  }
3067
- function se(n, e, t) {
3067
+ function ie(n, e, t) {
3068
3068
  const r = nn(t);
3069
3069
  if (r === null)
3070
3070
  return t;
@@ -3075,52 +3075,52 @@ function se(n, e, t) {
3075
3075
  }
3076
3076
  function Br(n, e, t, r) {
3077
3077
  var o;
3078
- const s = se(n, e, t);
3078
+ const s = ie(n, e, t);
3079
3079
  return Array.isArray(s) ? [[
3080
3080
  "add-triple",
3081
3081
  s,
3082
- (o = z(n, e, "id")) == null ? void 0 : o.id,
3082
+ (o = W(n, e, "id")) == null ? void 0 : o.id,
3083
3083
  s
3084
3084
  ]].concat(r) : r;
3085
3085
  }
3086
3086
  function jo({ attrsStore: n }, [e, t, r]) {
3087
3087
  const s = Object.entries(r).flatMap(([i, o]) => {
3088
- const a = Array.isArray(o) ? o : [o], c = z(n, e, i), u = je(n, e, i);
3088
+ const a = Array.isArray(o) ? o : [o], c = W(n, e, i), u = je(n, e, i);
3089
3089
  return a.map((l) => c ? [
3090
3090
  "add-triple",
3091
- se(n, e, t),
3091
+ ie(n, e, t),
3092
3092
  c.id,
3093
3093
  // Uses `!` because if we get here, we should have created the attr if it doesn't
3094
3094
  // already exist
3095
- se(n, c["reverse-identity"][1], l)
3095
+ ie(n, c["reverse-identity"][1], l)
3096
3096
  ] : [
3097
3097
  "add-triple",
3098
3098
  // Uses `!` because if we get here, we should have created the attr if it doesn't
3099
3099
  // already exist
3100
- se(n, u["forward-identity"][1], l),
3100
+ ie(n, u["forward-identity"][1], l),
3101
3101
  u == null ? void 0 : u.id,
3102
- se(n, e, t)
3102
+ ie(n, e, t)
3103
3103
  ]);
3104
3104
  });
3105
3105
  return Br(n, e, t, s);
3106
3106
  }
3107
3107
  function Do({ attrsStore: n }, [e, t, r]) {
3108
3108
  const s = Object.entries(r).flatMap(([i, o]) => {
3109
- const a = Array.isArray(o) ? o : [o], c = z(n, e, i), u = je(n, e, i);
3109
+ const a = Array.isArray(o) ? o : [o], c = W(n, e, i), u = je(n, e, i);
3110
3110
  return a.map((l) => c ? [
3111
3111
  "retract-triple",
3112
- se(n, e, t),
3112
+ ie(n, e, t),
3113
3113
  c.id,
3114
3114
  // Uses `!` because if we get here, we should have created the attr if it doesn't
3115
3115
  // already exist
3116
- se(n, c["reverse-identity"][1], l)
3116
+ ie(n, c["reverse-identity"][1], l)
3117
3117
  ] : [
3118
3118
  "retract-triple",
3119
3119
  // Uses `!` because if we get here, we should have created the attr if it doesn't
3120
3120
  // already exist
3121
- se(n, u["forward-identity"][1], l),
3121
+ ie(n, u["forward-identity"][1], l),
3122
3122
  u.id,
3123
- se(n, e, t)
3123
+ ie(n, e, t)
3124
3124
  ]);
3125
3125
  });
3126
3126
  return Br(n, e, t, s);
@@ -3132,7 +3132,7 @@ function $o(n, e, t, r) {
3132
3132
  for (const a of n || []) {
3133
3133
  const c = a == null ? void 0 : a.aev.get(i);
3134
3134
  if (c) {
3135
- for (const [u, l, f] of re(c, 2))
3135
+ for (const [u, l, f] of se(c, 2))
3136
3136
  if (f === o)
3137
3137
  return !0;
3138
3138
  }
@@ -3152,17 +3152,17 @@ function Qr({ stores: n, attrsStore: e }, [t, r, s, i]) {
3152
3152
  return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : $o(n, e, t, r) ? { mode: "update" } : null;
3153
3153
  }
3154
3154
  function xo(n, e) {
3155
- const { attrsStore: t } = n, [r, s, i, o] = e, a = yn(i), c = se(t, r, s);
3155
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = yn(i), c = ie(t, r, s);
3156
3156
  return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
3157
- const p = z(t, r, l);
3158
- return p["checked-data-type"] === "date" && n.useDateObjects && (f = Tt(f)), ["add-triple", c, p.id, f, { mode: "create" }];
3157
+ const p = W(t, r, l);
3158
+ return p["checked-data-type"] === "date" && n.useDateObjects && (f = St(f)), ["add-triple", c, p.id, f, { mode: "create" }];
3159
3159
  });
3160
3160
  }
3161
3161
  function Uo(n, e) {
3162
- const { attrsStore: t } = n, [r, s, i, o] = e, a = yn(i), c = se(t, r, s), u = Qr(n, [r, c, i, o]);
3162
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = yn(i), c = ie(t, r, s), u = Qr(n, [r, c, i, o]);
3163
3163
  return [["id", c]].concat(Object.entries(a)).map(([f, p]) => {
3164
- const y = z(t, r, f);
3165
- return y["checked-data-type"] === "date" && n.useDateObjects && (p = Tt(p)), [
3164
+ const y = W(t, r, f);
3165
+ return y["checked-data-type"] === "date" && n.useDateObjects && (p = St(p)), [
3166
3166
  "add-triple",
3167
3167
  c,
3168
3168
  y.id,
@@ -3172,11 +3172,11 @@ function Uo(n, e) {
3172
3172
  });
3173
3173
  }
3174
3174
  function Lo({ attrsStore: n }, [e, t]) {
3175
- return [["delete-entity", se(n, e, t), e]];
3175
+ return [["delete-entity", ie(n, e, t), e]];
3176
3176
  }
3177
3177
  function Fo(n, e) {
3178
- const { attrsStore: t } = n, [r, s, i, o] = e, a = yn(i), c = se(t, r, s), u = Qr(n, [r, c, i, o]), l = Object.entries(a).map(([p, y]) => {
3179
- const b = z(t, r, p);
3178
+ const { attrsStore: t } = n, [r, s, i, o] = e, a = yn(i), c = ie(t, r, s), u = Qr(n, [r, c, i, o]), l = Object.entries(a).map(([p, y]) => {
3179
+ const b = W(t, r, p);
3180
3180
  return [
3181
3181
  "deep-merge-triple",
3182
3182
  c,
@@ -3188,13 +3188,13 @@ function Fo(n, e) {
3188
3188
  return [[
3189
3189
  "add-triple",
3190
3190
  c,
3191
- z(t, r, "id").id,
3191
+ W(t, r, "id").id,
3192
3192
  c,
3193
3193
  ...u ? [u] : []
3194
3194
  ]].concat(l);
3195
3195
  }
3196
3196
  function No({ attrsStore: n }, [e, t, r]) {
3197
- return [["rule-params", se(n, e, t), e, r]];
3197
+ return [["rule-params", ie(n, e, t), e, r]];
3198
3198
  }
3199
3199
  function Ko(n) {
3200
3200
  const [e, t, r, s, i] = n;
@@ -3249,7 +3249,7 @@ function zo(n, e, t) {
3249
3249
  "checked-data-type": o
3250
3250
  };
3251
3251
  }
3252
- function ut(n, e, t, r) {
3252
+ function lt(n, e, t, r) {
3253
3253
  const s = n ? zo(n, e, t) : null, i = F(), a = [F(), e, t];
3254
3254
  return {
3255
3255
  id: i,
@@ -3333,7 +3333,7 @@ function Xo({ attrsStore: n, schema: e }, t) {
3333
3333
  var p, y;
3334
3334
  const r = /* @__PURE__ */ new Set(), s = [], i = [];
3335
3335
  function o(b, g) {
3336
- return z(n, b, g) || s.find((T) => T["forward-identity"][1] === b && T["forward-identity"][2] === g);
3336
+ return W(n, b, g) || s.find((T) => T["forward-identity"][1] === b && T["forward-identity"][2] === g);
3337
3337
  }
3338
3338
  function a(b, g) {
3339
3339
  return je(n, b, g) || s.find((T) => {
@@ -3368,23 +3368,23 @@ function Xo({ attrsStore: n, schema: e }, t) {
3368
3368
  f(v, tn(_));
3369
3369
  else {
3370
3370
  const k = o(v, _);
3371
- k || c(ut(e, v, _, rn)), u(k);
3371
+ k || c(lt(e, v, _, rn)), u(k);
3372
3372
  }
3373
3373
  } else if (l(g, _))
3374
3374
  f(g, tn(_));
3375
3375
  else {
3376
3376
  const w = o(g, _);
3377
- w || c(ut(e, g, _, rn)), u(w);
3377
+ w || c(lt(e, g, _, rn)), u(w);
3378
3378
  }
3379
3379
  }
3380
3380
  for (const b of t) {
3381
3381
  const [g, T, S, _] = b;
3382
3382
  if (Qo.has(g)) {
3383
3383
  const w = o(T, "id");
3384
- u(w), w || c(ut(e, T, "id", { "unique?": !0 }));
3384
+ u(w), w || c(lt(e, T, "id", { "unique?": !0 }));
3385
3385
  for (const C of Object.keys(_)) {
3386
3386
  const v = o(T, C);
3387
- if (u(v), Ho.has(g) && (v || c(ut(e, T, C, C === "id" ? { "unique?": !0 } : null))), Go.has(g)) {
3387
+ if (u(v), Ho.has(g) && (v || c(lt(e, T, C, C === "id" ? { "unique?": !0 } : null))), Go.has(g)) {
3388
3388
  const k = a(T, C);
3389
3389
  !v && !k && c(Zn(e, T, C)), u(k);
3390
3390
  }
@@ -3633,7 +3633,7 @@ class sn {
3633
3633
  // so that we know which entries we need to persist to the store.
3634
3634
  updateInPlace(e) {
3635
3635
  this._version++;
3636
- const [t, r] = gt(this.currentValue, e, {
3636
+ const [t, r] = mt(this.currentValue, e, {
3637
3637
  enablePatches: !0
3638
3638
  });
3639
3639
  for (const s of r) {
@@ -3871,19 +3871,19 @@ class Hr {
3871
3871
  };
3872
3872
  }
3873
3873
  }
3874
- class Z extends Error {
3874
+ class ee extends Error {
3875
3875
  constructor(t, r) {
3876
3876
  super(t);
3877
3877
  h(this, "hint");
3878
3878
  this.hint = r;
3879
3879
  const s = new.target.prototype;
3880
- Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, Z), this.name = "InstantError";
3880
+ Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, ee), this.name = "InstantError";
3881
3881
  }
3882
3882
  get [Symbol.toStringTag]() {
3883
3883
  return "InstantError";
3884
3884
  }
3885
3885
  }
3886
- class vt extends Z {
3886
+ class At extends ee {
3887
3887
  constructor(t) {
3888
3888
  var i;
3889
3889
  const r = ((i = t.body) == null ? void 0 : i.message) || `API Error (${t.status})`;
@@ -3891,25 +3891,25 @@ class vt extends Z {
3891
3891
  h(this, "body");
3892
3892
  h(this, "status");
3893
3893
  const s = new.target.prototype;
3894
- Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, vt), this.name = "InstantAPIError", this.status = t.status, this.body = t.body;
3894
+ Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, At), this.name = "InstantAPIError", this.status = t.status, this.body = t.body;
3895
3895
  }
3896
3896
  get [Symbol.toStringTag]() {
3897
3897
  return "InstantAPIError";
3898
3898
  }
3899
3899
  }
3900
- async function pe(n, e) {
3900
+ async function ye(n, e) {
3901
3901
  const t = await fetch(n, e), r = await t.json();
3902
- return t.status === 200 ? Promise.resolve(r) : Promise.reject(new vt({ status: t.status, body: r }));
3902
+ return t.status === 200 ? Promise.resolve(r) : Promise.reject(new At({ status: t.status, body: r }));
3903
3903
  }
3904
3904
  function ca({ apiURI: n, appId: e, email: t }) {
3905
- return pe(`${n}/runtime/auth/send_magic_code`, {
3905
+ return ye(`${n}/runtime/auth/send_magic_code`, {
3906
3906
  method: "POST",
3907
3907
  headers: { "content-type": "application/json" },
3908
3908
  body: JSON.stringify({ "app-id": e, email: t })
3909
3909
  });
3910
3910
  }
3911
3911
  async function ua({ apiURI: n, appId: e, email: t, code: r, refreshToken: s }) {
3912
- return await pe(`${n}/runtime/auth/verify_magic_code`, {
3912
+ return await ye(`${n}/runtime/auth/verify_magic_code`, {
3913
3913
  method: "POST",
3914
3914
  headers: { "content-type": "application/json" },
3915
3915
  body: JSON.stringify({
@@ -3921,7 +3921,7 @@ async function ua({ apiURI: n, appId: e, email: t, code: r, refreshToken: s }) {
3921
3921
  });
3922
3922
  }
3923
3923
  async function la({ apiURI: n, appId: e, refreshToken: t }) {
3924
- return await pe(`${n}/runtime/auth/verify_refresh_token`, {
3924
+ return await ye(`${n}/runtime/auth/verify_refresh_token`, {
3925
3925
  method: "POST",
3926
3926
  headers: { "content-type": "application/json" },
3927
3927
  body: JSON.stringify({
@@ -3931,7 +3931,7 @@ async function la({ apiURI: n, appId: e, refreshToken: t }) {
3931
3931
  });
3932
3932
  }
3933
3933
  async function fa({ apiURI: n, appId: e }) {
3934
- return await pe(`${n}/runtime/auth/sign_in_guest`, {
3934
+ return await ye(`${n}/runtime/auth/sign_in_guest`, {
3935
3935
  method: "POST",
3936
3936
  headers: { "content-type": "application/json" },
3937
3937
  body: JSON.stringify({
@@ -3940,7 +3940,7 @@ async function fa({ apiURI: n, appId: e }) {
3940
3940
  });
3941
3941
  }
3942
3942
  async function nr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken: s }) {
3943
- return await pe(`${n}/runtime/oauth/token`, {
3943
+ return await ye(`${n}/runtime/oauth/token`, {
3944
3944
  method: "POST",
3945
3945
  headers: { "content-type": "application/json" },
3946
3946
  body: JSON.stringify({
@@ -3952,7 +3952,7 @@ async function nr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken:
3952
3952
  });
3953
3953
  }
3954
3954
  async function da({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, refreshToken: i }) {
3955
- return await pe(`${n}/runtime/oauth/id_token`, {
3955
+ return await ye(`${n}/runtime/oauth/id_token`, {
3956
3956
  method: "POST",
3957
3957
  headers: { "content-type": "application/json" },
3958
3958
  body: JSON.stringify({
@@ -3965,7 +3965,7 @@ async function da({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
3965
3965
  });
3966
3966
  }
3967
3967
  async function ha({ apiURI: n, appId: e, refreshToken: t }) {
3968
- return await pe(`${n}/runtime/signout`, {
3968
+ return await ye(`${n}/runtime/signout`, {
3969
3969
  method: "POST",
3970
3970
  headers: {
3971
3971
  "content-type": "application/json"
@@ -3983,14 +3983,14 @@ async function pa({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, cont
3983
3983
  authorization: `Bearer ${s}`,
3984
3984
  "content-type": i || r.type
3985
3985
  };
3986
- return o && (a["content-disposition"] = o), await pe(`${n}/storage/upload`, {
3986
+ return o && (a["content-disposition"] = o), await ye(`${n}/storage/upload`, {
3987
3987
  method: "PUT",
3988
3988
  headers: a,
3989
3989
  body: r
3990
3990
  });
3991
3991
  }
3992
3992
  async function ya({ apiURI: n, appId: e, path: t, refreshToken: r }) {
3993
- const { data: s } = await pe(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
3993
+ const { data: s } = await ye(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
3994
3994
  method: "DELETE",
3995
3995
  headers: {
3996
3996
  "content-type": "application/json",
@@ -4000,7 +4000,7 @@ async function ya({ apiURI: n, appId: e, path: t, refreshToken: r }) {
4000
4000
  return s;
4001
4001
  }
4002
4002
  async function ba({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
4003
- const { data: i } = await pe(`${n}/storage/signed-upload-url`, {
4003
+ const { data: i } = await ye(`${n}/storage/signed-upload-url`, {
4004
4004
  method: "POST",
4005
4005
  headers: {
4006
4006
  "content-type": "application/json",
@@ -4023,7 +4023,7 @@ async function _a(n, e) {
4023
4023
  })).ok;
4024
4024
  }
4025
4025
  async function ga({ apiURI: n, appId: e, path: t, refreshToken: r }) {
4026
- const { data: s } = await pe(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
4026
+ const { data: s } = await ye(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
4027
4027
  method: "GET",
4028
4028
  headers: {
4029
4029
  "content-type": "application/json",
@@ -4110,7 +4110,7 @@ function or(n) {
4110
4110
  }, e;
4111
4111
  }, {});
4112
4112
  }
4113
- const Xr = "v0.22.149";
4113
+ const Xr = "v0.22.150";
4114
4114
  function Ta(n, e) {
4115
4115
  return {
4116
4116
  info: n ? (...t) => console.info(...t, e()) : () => {
@@ -4358,13 +4358,13 @@ const ar = [
4358
4358
  ns(t[r], r, e, r, 0);
4359
4359
  }
4360
4360
  }
4361
- }, ur = (n) => typeof n != "string" ? !1 : wt(n) ? !0 : Fe(n);
4362
- class ue extends Error {
4361
+ }, ur = (n) => typeof n != "string" ? !1 : Tt(n) ? !0 : Fe(n);
4362
+ class le extends Error {
4363
4363
  constructor(e) {
4364
4364
  super(e), this.name = "TransactionValidationError";
4365
4365
  }
4366
4366
  }
4367
- const rs = (n) => n.length > 0 ? n.join(", ") : "none", Ea = (n, e) => new ue(`Entity '${n}' does not exist in schema. Available entities: ${rs(e)}`), $t = {
4367
+ const rs = (n) => n.length > 0 ? n.join(", ") : "none", Ea = (n, e) => new le(`Entity '${n}' does not exist in schema. Available entities: ${rs(e)}`), $t = {
4368
4368
  string: (n) => typeof n == "string",
4369
4369
  number: (n) => typeof n == "number" && !isNaN(n),
4370
4370
  boolean: (n) => typeof n == "boolean",
@@ -4381,30 +4381,30 @@ const rs = (n) => n.length > 0 ? n.join(", ") : "none", Ea = (n, e) => new ue(`E
4381
4381
  }, xt = (n, e, t) => {
4382
4382
  const r = ss(n, t);
4383
4383
  if (typeof e != "object" || e === null)
4384
- throw new ue(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
4384
+ throw new le(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
4385
4385
  for (const [s, i] of Object.entries(e)) {
4386
4386
  if (s === "id")
4387
4387
  continue;
4388
4388
  const o = r.attrs[s];
4389
4389
  if (o && !ka(i, o))
4390
- throw new ue(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
4390
+ throw new le(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
4391
4391
  }
4392
4392
  }, lr = (n, e, t) => {
4393
4393
  const r = ss(n, t);
4394
4394
  if (typeof e != "object" || e === null)
4395
- throw new ue(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
4395
+ throw new le(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
4396
4396
  for (const [s, i] of Object.entries(e)) {
4397
4397
  if (!r.links[s]) {
4398
4398
  const a = Object.keys(r.links);
4399
- throw new ue(`Link '${s}' does not exist on entity '${n}'. Available links: ${rs(a)}`);
4399
+ throw new le(`Link '${s}' does not exist on entity '${n}'. Available links: ${rs(a)}`);
4400
4400
  }
4401
4401
  if (i != null) {
4402
4402
  if (Array.isArray(i)) {
4403
4403
  for (const a of i)
4404
4404
  if (!ur(a))
4405
- throw new ue(`Invalid entity ID in link '${s}' for entity '${n}'. Expected a UUID or a lookup, but received: ${a}`);
4405
+ throw new le(`Invalid entity ID in link '${s}' for entity '${n}'. Expected a UUID or a lookup, but received: ${a}`);
4406
4406
  } else if (!ur(i))
4407
- throw new ue(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
4407
+ throw new le(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
4408
4408
  }
4409
4409
  }
4410
4410
  }, Ca = {
@@ -4420,21 +4420,21 @@ const rs = (n) => n.length > 0 ? n.join(", ") : "none", Ea = (n, e) => new ue(`E
4420
4420
  return;
4421
4421
  const [t, r, s, i] = n;
4422
4422
  if (!Array.isArray(s) && !Fe(s))
4423
- throw new ue(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
4423
+ throw new le(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
4424
4424
  if (typeof r != "string")
4425
- throw new ue(`Entity name must be a string, but received: ${typeof r}`);
4425
+ throw new le(`Entity name must be a string, but received: ${typeof r}`);
4426
4426
  const o = Ca[t];
4427
4427
  o && i !== void 0 && o(r, i, e);
4428
4428
  }, Pa = (n, e) => {
4429
4429
  const t = Array.isArray(n) ? n : [n];
4430
4430
  for (const r of t) {
4431
4431
  if (!r || typeof r != "object")
4432
- throw new ue(`Transaction chunk must be an object, but received: ${typeof r}`);
4432
+ throw new le(`Transaction chunk must be an object, but received: ${typeof r}`);
4433
4433
  if (!Array.isArray(r.__ops))
4434
- throw new ue(`Transaction chunk must have __ops array, but received: ${typeof r.__ops}`);
4434
+ throw new le(`Transaction chunk must have __ops array, but received: ${typeof r.__ops}`);
4435
4435
  for (const s of r.__ops) {
4436
4436
  if (!Array.isArray(s))
4437
- throw new ue(`Transaction operation must be an array, but received: ${typeof s}`);
4437
+ throw new le(`Transaction operation must be an array, but received: ${typeof s}`);
4438
4438
  Ia(s, e);
4439
4439
  }
4440
4440
  }
@@ -4609,7 +4609,7 @@ function Ut(n, e, t) {
4609
4609
  }
4610
4610
  function dr(n, e, t, r) {
4611
4611
  var o;
4612
- const s = (o = z(t, n.table, "id")) == null ? void 0 : o.id;
4612
+ const s = (o = W(t, n.table, "id")) == null ? void 0 : o.id;
4613
4613
  if (!s)
4614
4614
  return -1;
4615
4615
  const i = Ke(e.eav, [r, s, r]);
@@ -4651,14 +4651,14 @@ function $a(n, e, t) {
4651
4651
  u === l && delete a[c];
4652
4652
  return r;
4653
4653
  }
4654
- function lt(n, e) {
4654
+ function ft(n, e) {
4655
4655
  return { [n.table]: e.map((t) => t.entity) };
4656
4656
  }
4657
4657
  function xa(n, e) {
4658
4658
  var r;
4659
4659
  if (n.orderFieldType)
4660
4660
  return n.orderFieldType;
4661
- const t = n.orderField === "serverCreatedAt" ? "number" : (r = z(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
4661
+ const t = n.orderField === "serverCreatedAt" ? "number" : (r = W(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
4662
4662
  return n.orderFieldType = t, t;
4663
4663
  }
4664
4664
  function Ua(n, e, t) {
@@ -4760,7 +4760,7 @@ class La {
4760
4760
  if (s && s.state && s.state.txId) {
4761
4761
  this.sendResync(s, s.state, s.state.txId), (u = s.values) != null && u.entities && r && r({
4762
4762
  type: Ee.LoadFromStorage,
4763
- data: lt(s, (l = s.values) == null ? void 0 : l.entities)
4763
+ data: ft(s, (l = s.values) == null ? void 0 : l.entities)
4764
4764
  });
4765
4765
  return;
4766
4766
  }
@@ -4829,7 +4829,7 @@ class La {
4829
4829
  u[s] = o, u[s].updatedAt = Date.now();
4830
4830
  }), o.values && this.notifyCbs(s, {
4831
4831
  type: Ee.InitialSyncBatch,
4832
- data: lt(o, o.values.entities),
4832
+ data: ft(o, o.values.entities),
4833
4833
  batch: i
4834
4834
  });
4835
4835
  }
@@ -4854,7 +4854,7 @@ class La {
4854
4854
  const s = this.subs.currentValue[r];
4855
4855
  s && this.notifyCbs(r, {
4856
4856
  type: Ee.InitialSyncComplete,
4857
- data: lt(s, ((i = s.values) == null ? void 0 : i.entities) || [])
4857
+ data: ft(s, ((i = s.values) == null ? void 0 : i.entities) || [])
4858
4858
  });
4859
4859
  }
4860
4860
  onSyncUpdateTriples(e) {
@@ -4928,7 +4928,7 @@ class La {
4928
4928
  const g = xa(s, this.getAttrs);
4929
4929
  Ua(s, g, f), this.notifyCbs(r, {
4930
4930
  type: Ee.SyncTransaction,
4931
- data: lt(s, (o = s.values) == null ? void 0 : o.entities),
4931
+ data: ft(s, (o = s.values) == null ? void 0 : o.entities),
4932
4932
  added: y,
4933
4933
  removed: b,
4934
4934
  updated: p
@@ -4969,200 +4969,200 @@ class La {
4969
4969
  }
4970
4970
  function Fa({ WStream: n, opts: e, startStream: t, appendStream: r, registerStream: s }) {
4971
4971
  const i = e.clientId;
4972
- let o = null, a = null;
4973
- const c = F();
4974
- let u = !1, l = !1;
4975
- const f = [], p = [], y = [];
4976
- let b = !1, g = 0, T = 0;
4977
- const S = [], _ = new TextEncoder();
4978
- function w() {
4979
- l = !0;
4980
- for (const O of f)
4981
- O();
4982
- }
4983
- function C(O) {
4984
- return f.push(O), () => {
4985
- const I = f.indexOf(O);
4986
- I !== -1 && f.splice(I, 1);
4987
- };
4972
+ let o = null, a = null, c = null;
4973
+ const u = F();
4974
+ let l = !1, f = !1;
4975
+ const p = [], y = [], b = [];
4976
+ let g = !1, T = 0, S = 0;
4977
+ const _ = [], w = new TextEncoder();
4978
+ function C() {
4979
+ f = !0;
4980
+ for (const O of p)
4981
+ O(a ?? void 0);
4988
4982
  }
4989
4983
  function v(O) {
4990
- return y.push(O), () => {
4991
- const I = y.indexOf(O);
4992
- I !== -1 && y.splice(I, 1);
4984
+ return p.push(O), f && O(a ?? void 0), () => {
4985
+ const I = p.indexOf(O);
4986
+ I !== -1 && p.splice(I, 1);
4987
+ };
4988
+ }
4989
+ function k(O) {
4990
+ return b.push(O), () => {
4991
+ const I = b.indexOf(O);
4992
+ I !== -1 && b.splice(I, 1);
4993
4993
  };
4994
4994
  }
4995
4995
  e.waitUntil && e.waitUntil(new Promise((O) => {
4996
- y.push(O);
4996
+ b.push(O);
4997
4997
  }));
4998
- function k() {
4999
- for (const O of y)
4998
+ function j() {
4999
+ for (const O of b)
5000
5000
  try {
5001
5001
  O();
5002
5002
  } catch {
5003
5003
  }
5004
5004
  }
5005
- function D(O) {
5006
- return p.push(O), () => {
5007
- const I = p.indexOf(O);
5008
- I !== -1 && p.splice(I, 1);
5005
+ function x(O) {
5006
+ return y.push(O), o && O(o), () => {
5007
+ const I = y.indexOf(O);
5008
+ I !== -1 && y.splice(I, 1);
5009
5009
  };
5010
5010
  }
5011
- function x(O) {
5011
+ function z(O) {
5012
5012
  o = O;
5013
- for (const I of p)
5013
+ for (const I of y)
5014
5014
  I(o);
5015
5015
  }
5016
- function N() {
5017
- b = !0;
5016
+ function ce() {
5017
+ g = !0;
5018
5018
  }
5019
- function ye(O) {
5020
- let I = g, V = 0, Q = 0;
5021
- for (const { byteLen: ee } of S) {
5022
- const ae = I + ee;
5023
- if (ae > O)
5019
+ function ve(O) {
5020
+ let I = T, V = 0, Q = 0;
5021
+ for (const { byteLen: te } of _) {
5022
+ const fe = I + te;
5023
+ if (fe > O)
5024
5024
  break;
5025
- I = ae, V++, Q += ee;
5025
+ I = fe, V++, Q += te;
5026
5026
  }
5027
- V > 0 && (g += Q, T -= Q, S.splice(0, V));
5027
+ V > 0 && (T += Q, S -= Q, _.splice(0, V));
5028
5028
  }
5029
- function le(O, I) {
5030
- w(), O.error(I), k();
5029
+ function J(O, I) {
5030
+ a = I, C(), O.error(I), j();
5031
5031
  }
5032
- async function fe() {
5032
+ async function Y() {
5033
5033
  const O = await t({
5034
5034
  clientId: i,
5035
- reconnectToken: c,
5035
+ reconnectToken: u,
5036
5036
  ruleParams: e.ruleParams
5037
5037
  });
5038
5038
  switch (O.type) {
5039
5039
  case "ok": {
5040
5040
  const { streamId: I, offset: V } = O;
5041
- o = I, ye(V), S.length && r({
5041
+ o = I, ve(V), _.length && r({
5042
5042
  streamId: I,
5043
- chunks: S.map((Q) => Q.chunk),
5044
- offset: g
5045
- }), b = !1;
5043
+ chunks: _.map((Q) => Q.chunk),
5044
+ offset: T
5045
+ }), g = !1;
5046
5046
  break;
5047
5047
  }
5048
5048
  case "disconnect": {
5049
- N();
5049
+ ce();
5050
5050
  break;
5051
5051
  }
5052
5052
  case "error": {
5053
- a && le(a, O.error);
5053
+ c && J(c, O.error);
5054
5054
  break;
5055
5055
  }
5056
5056
  }
5057
5057
  }
5058
- function X() {
5059
- N(), fe();
5058
+ function U() {
5059
+ ce(), Y();
5060
5060
  }
5061
- function U({ offset: O, done: I }) {
5062
- ye(O), I && (u = !0, k());
5061
+ function H({ offset: O, done: I }) {
5062
+ ve(O), I && (l = !0, j());
5063
5063
  }
5064
- function H(O) {
5065
- return u ? (le(O, new Z("Stream has been closed.")), null) : o || (le(O, new Z("Stream has not been initialized.")), null);
5064
+ function be(O) {
5065
+ return l ? (J(O, new ee("Stream has been closed.")), null) : o || (J(O, new ee("Stream has not been initialized.")), null);
5066
5066
  }
5067
- async function be(O) {
5068
- a = O;
5067
+ async function Ae(O) {
5068
+ c = O;
5069
5069
  let I = !0, V = 0;
5070
5070
  for (; I; ) {
5071
5071
  let Q = Date.now() + Math.min(15e3, 500 * (V - 1));
5072
5072
  I = !1;
5073
- const ee = await t({
5073
+ const te = await t({
5074
5074
  clientId: e.clientId,
5075
- reconnectToken: c,
5075
+ reconnectToken: u,
5076
5076
  ruleParams: e.ruleParams
5077
5077
  });
5078
- switch (ee.type) {
5078
+ switch (te.type) {
5079
5079
  case "ok": {
5080
- const { streamId: ae, offset: qe } = ee;
5080
+ const { streamId: fe, offset: qe } = te;
5081
5081
  if (qe !== 0) {
5082
- const Ae = new Z("Write stream is corrupted");
5083
- le(O, Ae);
5082
+ const de = new ee("Write stream is corrupted");
5083
+ J(O, de);
5084
5084
  return;
5085
5085
  }
5086
- x(ae), s(ae, {
5087
- onDisconnect: N,
5088
- onFlush: U,
5089
- onConnectionReconnect: fe,
5090
- onAppendFailed: X
5091
- }), b = !1;
5086
+ z(fe), s(fe, {
5087
+ onDisconnect: ce,
5088
+ onFlush: H,
5089
+ onConnectionReconnect: Y,
5090
+ onAppendFailed: U
5091
+ }), g = !1;
5092
5092
  return;
5093
5093
  }
5094
5094
  case "disconnect": {
5095
- I = !0, N(), V++, await new Promise((ae) => {
5096
- setTimeout(ae, Math.max(0, Q - Date.now()));
5095
+ I = !0, ce(), V++, await new Promise((fe) => {
5096
+ setTimeout(fe, Math.max(0, Q - Date.now()));
5097
5097
  });
5098
5098
  break;
5099
5099
  }
5100
5100
  case "error": {
5101
- le(O, ee.error);
5101
+ J(O, te.error);
5102
5102
  return;
5103
5103
  }
5104
5104
  }
5105
5105
  }
5106
5106
  }
5107
- class ve extends n {
5107
+ class rt extends n {
5108
5108
  constructor(I, V) {
5109
5109
  super(I, V);
5110
5110
  }
5111
5111
  async streamId() {
5112
5112
  return o || new Promise((I, V) => {
5113
- const Q = [], ee = () => {
5114
- for (const Ae of Q)
5115
- Ae();
5116
- }, ae = (Ae) => {
5117
- I(Ae), ee();
5118
- }, qe = () => {
5119
- V(new Z("Stream is closed.")), ee();
5113
+ const Q = [], te = () => {
5114
+ for (const de of Q)
5115
+ de();
5116
+ }, fe = (de) => {
5117
+ I(de), te();
5118
+ }, qe = (de) => {
5119
+ V(de || new ee("Stream is closed.")), te();
5120
5120
  };
5121
- Q.push(D(ae)), Q.push(C(qe));
5121
+ Q.push(x(fe)), Q.push(v(qe));
5122
5122
  });
5123
5123
  }
5124
5124
  }
5125
5125
  return {
5126
- stream: new ve({
5126
+ stream: new rt({
5127
5127
  // TODO(dww): accept a storage so that write streams can survive across
5128
5128
  // browser restarts
5129
5129
  async start(O) {
5130
5130
  try {
5131
- await be(O);
5131
+ await Ae(O);
5132
5132
  } catch (I) {
5133
- le(O, I);
5133
+ J(O, I);
5134
5134
  }
5135
5135
  },
5136
5136
  write(O, I) {
5137
- const V = H(I);
5137
+ const V = be(I);
5138
5138
  if (V) {
5139
- const Q = _.encode(O).length;
5140
- S.push({ chunk: O, byteLen: Q });
5141
- const ee = g + T;
5142
- T += Q, b || r({ streamId: V, chunks: [O], offset: ee });
5139
+ const Q = w.encode(O).length;
5140
+ _.push({ chunk: O, byteLen: Q });
5141
+ const te = T + S;
5142
+ S += Q, g || r({ streamId: V, chunks: [O], offset: te });
5143
5143
  }
5144
5144
  },
5145
5145
  close() {
5146
5146
  o ? r({
5147
5147
  streamId: o,
5148
5148
  chunks: [],
5149
- offset: g + T,
5149
+ offset: T + S,
5150
5150
  isDone: !0
5151
- }) : k(), w();
5151
+ }) : j(), C();
5152
5152
  },
5153
5153
  abort(O) {
5154
5154
  o ? r({
5155
5155
  streamId: o,
5156
5156
  chunks: [],
5157
- offset: g + T,
5157
+ offset: T + S,
5158
5158
  isDone: !0,
5159
5159
  abortReason: O
5160
- }) : k(), w();
5160
+ }) : j(), C();
5161
5161
  }
5162
5162
  }),
5163
- addCompleteCb: v,
5163
+ addCompleteCb: k,
5164
5164
  closed() {
5165
- return l;
5165
+ return f;
5166
5166
  }
5167
5167
  };
5168
5168
  }
@@ -5233,45 +5233,45 @@ function Ka({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
5233
5233
  return;
5234
5234
  }
5235
5235
  if (v.offset > s) {
5236
- y(w, new Z("Stream is corrupted.")), i = !0;
5236
+ y(w, new ee("Stream is corrupted.")), i = !0;
5237
5237
  return;
5238
5238
  }
5239
5239
  let k = s - v.offset;
5240
5240
  if (v.files && v.files.length) {
5241
- const D = new AbortController();
5241
+ const j = new AbortController();
5242
5242
  let x = fetch(v.files[0].url, {
5243
- signal: D.signal
5243
+ signal: j.signal
5244
5244
  });
5245
- for (let N = 0; N < v.files.length; N++) {
5246
- const ye = v.files[N + 1], fe = await x;
5247
- if (ye && (x = fetch(ye.url, { signal: D.signal })), !fe.ok) {
5245
+ for (let z = 0; z < v.files.length; z++) {
5246
+ const ce = v.files[z + 1], J = await x;
5247
+ if (ce && (x = fetch(ce.url, { signal: j.signal })), !J.ok) {
5248
5248
  if (b++, b > 10) {
5249
- y(w, new Z("Unable to process stream."));
5249
+ y(w, new ee("Unable to process stream."));
5250
5250
  return;
5251
5251
  }
5252
5252
  return { retry: !0 };
5253
5253
  }
5254
- if (fe.body)
5255
- for await (const X of fe.body) {
5254
+ if (J.body)
5255
+ for await (const Y of J.body) {
5256
5256
  if (i) {
5257
- D.abort();
5257
+ j.abort();
5258
5258
  return;
5259
5259
  }
5260
- let U = X;
5261
- if (k > 0 && (U = X.subarray(k), k -= X.length - U.length), !U.length)
5260
+ let U = Y;
5261
+ if (k > 0 && (U = Y.subarray(k), k -= Y.length - U.length), !U.length)
5262
5262
  continue;
5263
5263
  s += U.length;
5264
5264
  const H = o.decode(U);
5265
5265
  w.enqueue(H);
5266
5266
  }
5267
5267
  else {
5268
- const X = await fe.arrayBuffer();
5269
- let U = X;
5268
+ const Y = await J.arrayBuffer();
5269
+ let U = Y;
5270
5270
  if (i) {
5271
- D.abort();
5271
+ j.abort();
5272
5272
  return;
5273
5273
  }
5274
- if (k > 0 && (U = new Uint8Array(X).subarray(k), k -= X.byteLength - U.length), !U.byteLength)
5274
+ if (k > 0 && (U = new Uint8Array(Y).subarray(k), k -= Y.byteLength - U.length), !U.byteLength)
5275
5275
  continue;
5276
5276
  s += U.byteLength;
5277
5277
  const H = o.decode(U);
@@ -5280,14 +5280,14 @@ function Ka({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
5280
5280
  }
5281
5281
  }
5282
5282
  if (b = 0, v.content) {
5283
- let D = v.content, x = a.encode(v.content);
5283
+ let j = v.content, x = a.encode(v.content);
5284
5284
  if (k > 0) {
5285
- const N = x.subarray(k);
5286
- if (k -= x.length - N.length, !N.length)
5285
+ const z = x.subarray(k);
5286
+ if (k -= x.length - z.length, !z.length)
5287
5287
  continue;
5288
- x = N, D = o.decode(N);
5288
+ x = z, j = o.decode(z);
5289
5289
  }
5290
- s += x.length, w.enqueue(D);
5290
+ s += x.length, w.enqueue(j);
5291
5291
  }
5292
5292
  }
5293
5293
  }
@@ -5297,8 +5297,8 @@ function Ka({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
5297
5297
  w = !1;
5298
5298
  let v = Date.now() + Math.min(15e3, 500 * (C - 1));
5299
5299
  const k = await g({ ...e, offset: s }, _);
5300
- k != null && k.retry && (w = !0, C++, v < Date.now() - 3e5 && (C = 0), await new Promise((D) => {
5301
- setTimeout(D, Math.max(0, v - Date.now()));
5300
+ k != null && k.retry && (w = !0, C++, v < Date.now() - 3e5 && (C = 0), await new Promise((j) => {
5301
+ setTimeout(j, Math.max(0, v - Date.now()));
5302
5302
  }));
5303
5303
  }
5304
5304
  !i && !u && (_.close(), f());
@@ -5425,7 +5425,7 @@ class qa {
5425
5425
  if (e.error) {
5426
5426
  e.retry ? r.push({ type: "reconnect" }) : r.push({
5427
5427
  type: "error",
5428
- error: new Z(e.error)
5428
+ error: new ee(e.error)
5429
5429
  }), r.close(), delete this.readStreamIterators[t];
5430
5430
  return;
5431
5431
  }
@@ -5462,7 +5462,7 @@ class qa {
5462
5462
  const r = e["client-event-id"], s = this.startWriteStreamCbs[r];
5463
5463
  s && (s({
5464
5464
  type: "error",
5465
- error: new Z(e.message || "Unknown error", e.hint)
5465
+ error: new ee(e.message || "Unknown error", e.hint)
5466
5466
  }), delete this.startWriteStreamCbs[r]);
5467
5467
  break;
5468
5468
  }
@@ -5470,7 +5470,7 @@ class qa {
5470
5470
  const r = e["client-event-id"], s = this.readStreamIterators[r];
5471
5471
  s && (s.push({
5472
5472
  type: "error",
5473
- error: new Z(e.message || "Unknown error", e.hint)
5473
+ error: new ee(e.message || "Unknown error", e.hint)
5474
5474
  }), s.close(), delete this.readStreamIterators[r]);
5475
5475
  break;
5476
5476
  }
@@ -5650,7 +5650,7 @@ class tc {
5650
5650
  h(this, "notifyOne", (e) => {
5651
5651
  var i;
5652
5652
  const t = this.queryCbs[e] ?? [], r = (i = this._dataForQueryCache[e]) == null ? void 0 : i.data, s = this.dataForQuery(e);
5653
- s != null && s.data && (this._dataForQueryCache[e] = s, !pt(s.data, r) && t.forEach((o) => o.cb(s.data)));
5653
+ s != null && s.data && (this._dataForQueryCache[e] = s, !yt(s.data, r) && t.forEach((o) => o.cb(s.data)));
5654
5654
  });
5655
5655
  h(this, "notifyOneQueryOnce", (e) => {
5656
5656
  var s;
@@ -5884,13 +5884,13 @@ class tc {
5884
5884
  s.resolve({ status: e, eventId: t });
5885
5885
  else if (r != null && r.type) {
5886
5886
  const { status: o, ...a } = r;
5887
- s.reject(new vt({
5887
+ s.reject(new At({
5888
5888
  // @ts-expect-error body.type is not constant typed
5889
5889
  body: a,
5890
5890
  status: o ?? 0
5891
5891
  }));
5892
5892
  } else
5893
- s.reject(new Z((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint));
5893
+ s.reject(new ee((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint));
5894
5894
  }
5895
5895
  _setStatus(e, t) {
5896
5896
  this.status = e, this._errorMessage = t, this.notifyConnectionStatusSubs(e), this._instantStream.onConnectionStatusChange(e);
@@ -6004,27 +6004,27 @@ class tc {
6004
6004
  w.pendingMutations = T;
6005
6005
  });
6006
6006
  const S = Ft(T.entries()), _ = y.map((w) => {
6007
- var U, H, be, ve;
6008
- const C = w["instaql-query"], v = w["instaql-result"], k = B(C), D = ir(v), x = this.ensureAttrs(), N = Ge(x, D, r, this.config.useDateObjects), { store: ye, attrsStore: le } = this._applyOptimisticUpdates(N, x, S, g), fe = (H = (U = v == null ? void 0 : v[0]) == null ? void 0 : U.data) == null ? void 0 : H["page-info"], X = (ve = (be = v == null ? void 0 : v[0]) == null ? void 0 : be.data) == null ? void 0 : ve.aggregate;
6007
+ var U, H, be, Ae;
6008
+ const C = w["instaql-query"], v = w["instaql-result"], k = B(C), j = ir(v), x = this.ensureAttrs(), z = Ge(x, j, r, this.config.useDateObjects), { store: ce, attrsStore: ve } = this._applyOptimisticUpdates(z, x, S, g), J = (H = (U = v == null ? void 0 : v[0]) == null ? void 0 : U.data) == null ? void 0 : H["page-info"], Y = (Ae = (be = v == null ? void 0 : v[0]) == null ? void 0 : be.data) == null ? void 0 : Ae.aggregate;
6009
6009
  return {
6010
6010
  q: C,
6011
6011
  hash: k,
6012
- store: ye,
6013
- attrsStore: le,
6014
- pageInfo: fe,
6015
- aggregate: X
6012
+ store: ce,
6013
+ attrsStore: ve,
6014
+ pageInfo: J,
6015
+ aggregate: Y
6016
6016
  };
6017
6017
  });
6018
- _.forEach(({ hash: w, q: C, store: v, attrsStore: k, pageInfo: D, aggregate: x }) => {
6019
- this.querySubs.updateInPlace((N) => {
6020
- if (!N[w]) {
6018
+ _.forEach(({ hash: w, q: C, store: v, attrsStore: k, pageInfo: j, aggregate: x }) => {
6019
+ this.querySubs.updateInPlace((z) => {
6020
+ if (!z[w]) {
6021
6021
  this._log.error("Missing value in querySubs", { hash: w, q: C });
6022
6022
  return;
6023
6023
  }
6024
- N[w].result = {
6024
+ z[w].result = {
6025
6025
  store: v,
6026
6026
  attrsStore: k,
6027
- pageInfo: D,
6027
+ pageInfo: j,
6028
6028
  aggregate: x,
6029
6029
  processedTxId: g
6030
6030
  };
@@ -6259,7 +6259,7 @@ class tc {
6259
6259
  return /* @__PURE__ */ new Map();
6260
6260
  const s = (l) => {
6261
6261
  const [f, p, y] = l["forward-identity"];
6262
- return z(e, p, y);
6262
+ return W(e, p, y);
6263
6263
  }, i = (l) => {
6264
6264
  const [f, p, y] = l["forward-identity"];
6265
6265
  return je(e, p, y);
@@ -6563,7 +6563,7 @@ class tc {
6563
6563
  t.isLoading || e(this._currentUserCached);
6564
6564
  let r = !1;
6565
6565
  return this.getCurrentUser().then((s) => {
6566
- r || pt(s, t) || e(s);
6566
+ r || yt(s, t) || e(s);
6567
6567
  }), () => {
6568
6568
  r = !0, this.authCbs = this.authCbs.filter((s) => s !== e);
6569
6569
  };
@@ -6571,7 +6571,7 @@ class tc {
6571
6571
  async getAuth() {
6572
6572
  const { user: e, error: t } = await this.getCurrentUser();
6573
6573
  if (t)
6574
- throw new Z("Could not get current user: " + t.message);
6574
+ throw new ee("Could not get current user: " + t.message);
6575
6575
  return e ?? null;
6576
6576
  }
6577
6577
  subscribeConnectionStatus(e) {
@@ -6647,7 +6647,7 @@ class tc {
6647
6647
  async changeCurrentUser(e) {
6648
6648
  var r;
6649
6649
  const { user: t } = await this.getCurrentUser();
6650
- if (!pt(t, e)) {
6650
+ if (!yt(t, e)) {
6651
6651
  await this.setCurrentUser(e), await this.updateUser(e);
6652
6652
  try {
6653
6653
  await this.kv.flush(), (r = this._broadcastChannel) == null || r.postMessage({ type: "auth" });
@@ -6894,7 +6894,7 @@ class tc {
6894
6894
  const r = ((a = (o = this._presence[e]) == null ? void 0 : o.result) == null ? void 0 : a.peers) || {};
6895
6895
  let s = Object.fromEntries(Object.entries(r).map(([u, l]) => [u, { data: l }]));
6896
6896
  (c = this._presence[e]) == null || c.result;
6897
- const i = gt(s, (u) => {
6897
+ const i = mt(s, (u) => {
6898
6898
  for (let [l, f, p] of t)
6899
6899
  switch (f) {
6900
6900
  case "+":
@@ -6915,7 +6915,7 @@ class tc {
6915
6915
  const r = { ...t };
6916
6916
  delete r[this._sessionId];
6917
6917
  const s = Object.fromEntries(Object.entries(r).map(([i, o]) => [i, o.data]));
6918
- this._presence = gt(this._presence, (i) => {
6918
+ this._presence = mt(this._presence, (i) => {
6919
6919
  Wn(i, [e, "result", "peers"], s);
6920
6920
  });
6921
6921
  }
@@ -7001,9 +7001,9 @@ class tc {
7001
7001
  });
7002
7002
  }
7003
7003
  }
7004
- let ft;
7004
+ let dt;
7005
7005
  function nc(n, e) {
7006
- ft == null || ft.dispose();
7006
+ dt == null || dt.dispose();
7007
7007
  const t = cc(e), r = ic(e, a), s = sc(rc(n));
7008
7008
  function i(l) {
7009
7009
  var f;
@@ -7020,7 +7020,7 @@ function nc(n, e) {
7020
7020
  t.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", i);
7021
7021
  }
7022
7022
  function u() {
7023
- document.body.appendChild(t.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", i), ft = {
7023
+ document.body.appendChild(t.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", i), dt = {
7024
7024
  dispose: c
7025
7025
  };
7026
7026
  }
@@ -7937,7 +7937,7 @@ class Nt {
7937
7937
  h(this, "useUser", () => {
7938
7938
  const { user: e } = this.useAuth();
7939
7939
  if (!e)
7940
- throw new Z(
7940
+ throw new ee(
7941
7941
  "useUser must be used within an auth-protected route"
7942
7942
  );
7943
7943
  return e;
@@ -8003,7 +8003,7 @@ class Nt {
8003
8003
  */
8004
8004
  h(this, "SignedIn", ({ children: e }) => {
8005
8005
  const t = this.useAuth();
8006
- return t.isLoading || t.error || !t.user ? null : /* @__PURE__ */ at.jsx(at.Fragment, { children: e });
8006
+ return t.isLoading || t.error || !t.user ? null : /* @__PURE__ */ ct.jsx(ct.Fragment, { children: e });
8007
8007
  });
8008
8008
  /**
8009
8009
  * Only render children if the user is signed out.
@@ -8017,7 +8017,7 @@ class Nt {
8017
8017
  */
8018
8018
  h(this, "SignedOut", ({ children: e }) => {
8019
8019
  const t = this.useAuth();
8020
- return t.isLoading || t.error || t.user ? null : /* @__PURE__ */ at.jsx(at.Fragment, { children: e });
8020
+ return t.isLoading || t.error || t.user ? null : /* @__PURE__ */ ct.jsx(ct.Fragment, { children: e });
8021
8021
  });
8022
8022
  this.core = gc(
8023
8023
  e,