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