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