@instantdb/react 0.22.49-experimental.persisted-object-2.19448260956.1 → 0.22.49-experimental.persisted-object-2.19448798235.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 +125 -117
- package/dist/standalone/index.umd.cjs +1 -1
- package/package.json +4 -4
package/dist/standalone/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ti, { useRef as
|
|
1
|
+
import ti, { useRef as kt, useCallback as Se, useSyncExternalStore as rn, useEffect as Pe, useMemo as sn, useState as ni, createElement as ps } from "react";
|
|
2
2
|
function X(t) {
|
|
3
3
|
if (typeof t == "number")
|
|
4
4
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
@@ -70,14 +70,14 @@ function ie(t) {
|
|
|
70
70
|
return (e = t.copy) !== null && e !== void 0 ? e : t.original;
|
|
71
71
|
}
|
|
72
72
|
function Me(t) {
|
|
73
|
-
return !!
|
|
73
|
+
return !!k(t);
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function k(t) {
|
|
76
76
|
return typeof t != "object" ? null : t == null ? void 0 : t[ri];
|
|
77
77
|
}
|
|
78
78
|
function Un(t) {
|
|
79
79
|
var e;
|
|
80
|
-
const n =
|
|
80
|
+
const n = k(t);
|
|
81
81
|
return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
|
|
82
82
|
}
|
|
83
83
|
function fe(t, e) {
|
|
@@ -88,7 +88,7 @@ function fe(t, e) {
|
|
|
88
88
|
}
|
|
89
89
|
function ii(t, e = []) {
|
|
90
90
|
if (Object.hasOwnProperty.call(t, "key")) {
|
|
91
|
-
const n = t.parent.copy, r =
|
|
91
|
+
const n = t.parent.copy, r = k(me(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;
|
|
@@ -116,7 +116,7 @@ function ut(t, e, n) {
|
|
|
116
116
|
Ie(t) === 2 ? t.set(e, n) : t[e] = n;
|
|
117
117
|
}
|
|
118
118
|
function Yt(t, e) {
|
|
119
|
-
const n =
|
|
119
|
+
const n = k(t);
|
|
120
120
|
return (n ? ie(n) : t)[e];
|
|
121
121
|
}
|
|
122
122
|
function ge(t, e) {
|
|
@@ -127,7 +127,7 @@ function on(t) {
|
|
|
127
127
|
for (; t.finalities.revoke.length > 0; )
|
|
128
128
|
t.finalities.revoke.pop()();
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function ke(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");
|
|
@@ -301,7 +301,7 @@ function oi(t, e, n) {
|
|
|
301
301
|
if (e.add(t), Ln(t, (s, o) => {
|
|
302
302
|
var a;
|
|
303
303
|
if (Me(o)) {
|
|
304
|
-
const u =
|
|
304
|
+
const u = k(o);
|
|
305
305
|
H(u);
|
|
306
306
|
const c = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
|
|
307
307
|
ut(r ? i : t, s, c);
|
|
@@ -333,7 +333,7 @@ function un(t, e, n, r) {
|
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
function Nn(t, e, n, r) {
|
|
336
|
-
const i =
|
|
336
|
+
const i = k(n);
|
|
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;
|
|
@@ -351,7 +351,7 @@ function ws(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 = ke(d, i);
|
|
355
355
|
n.push({
|
|
356
356
|
op: D.Replace,
|
|
357
357
|
path: f,
|
|
@@ -365,7 +365,7 @@ function ws(t, e, n, r, i) {
|
|
|
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 = ke(d, i);
|
|
369
369
|
n.push({
|
|
370
370
|
op: D.Add,
|
|
371
371
|
path: f,
|
|
@@ -376,7 +376,7 @@ function ws(t, e, n, r, i) {
|
|
|
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 = ke(d, i);
|
|
380
380
|
r.push({
|
|
381
381
|
op: D.Replace,
|
|
382
382
|
path: f,
|
|
@@ -384,7 +384,7 @@ function ws(t, e, n, r, i) {
|
|
|
384
384
|
});
|
|
385
385
|
} else
|
|
386
386
|
for (let d = u.length; s.length < d; d -= 1) {
|
|
387
|
-
const f = e.concat([d - 1]), h =
|
|
387
|
+
const f = e.concat([d - 1]), h = ke(f, i);
|
|
388
388
|
r.push({
|
|
389
389
|
op: D.Remove,
|
|
390
390
|
path: h
|
|
@@ -397,7 +397,7 @@ function Ts({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
|
397
397
|
const c = me(t, u), d = Ot(me(e, u)), f = a ? rt(t, u) ? D.Replace : D.Add : D.Remove;
|
|
398
398
|
if (ge(c, d) && f === D.Replace)
|
|
399
399
|
return;
|
|
400
|
-
const h = r.concat(u), p =
|
|
400
|
+
const h = r.concat(u), p = ke(h, o);
|
|
401
401
|
i.push(f === D.Remove ? { op: f, path: p } : { op: f, path: p, value: d }), s.push(f === D.Add ? { op: D.Remove, path: p } : f === D.Remove ? { op: D.Add, path: p, value: c } : { op: D.Replace, path: p, value: c });
|
|
402
402
|
});
|
|
403
403
|
}
|
|
@@ -405,7 +405,7 @@ function vs({ 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 = ke(u, s);
|
|
409
409
|
r.push({
|
|
410
410
|
op: D.Remove,
|
|
411
411
|
path: c,
|
|
@@ -419,7 +419,7 @@ function vs({ 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 = ke(u, s);
|
|
423
423
|
r.push({
|
|
424
424
|
op: D.Add,
|
|
425
425
|
path: c,
|
|
@@ -450,23 +450,23 @@ const Ct = (t, e, n = !1) => {
|
|
|
450
450
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
451
451
|
}, cn = {
|
|
452
452
|
get size() {
|
|
453
|
-
return ie(
|
|
453
|
+
return ie(k(this)).size;
|
|
454
454
|
},
|
|
455
455
|
has(t) {
|
|
456
|
-
return ie(
|
|
456
|
+
return ie(k(this)).has(t);
|
|
457
457
|
},
|
|
458
458
|
set(t, e) {
|
|
459
|
-
const n =
|
|
459
|
+
const n = k(this), r = ie(n);
|
|
460
460
|
return (!r.has(t) || !ge(r.get(t), e)) && (H(n), ye(n), n.assignedMap.set(t, !0), n.copy.set(t, e), Nn(n, t, e, at)), this;
|
|
461
461
|
},
|
|
462
462
|
delete(t) {
|
|
463
463
|
if (!this.has(t))
|
|
464
464
|
return !1;
|
|
465
|
-
const e =
|
|
465
|
+
const e = k(this);
|
|
466
466
|
return H(e), ye(e), e.original.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.copy.delete(t), !0;
|
|
467
467
|
},
|
|
468
468
|
clear() {
|
|
469
|
-
const t =
|
|
469
|
+
const t = k(this);
|
|
470
470
|
if (this.size) {
|
|
471
471
|
H(t), ye(t), t.assignedMap = /* @__PURE__ */ new Map();
|
|
472
472
|
for (const [e] of t.original)
|
|
@@ -475,14 +475,14 @@ const Ct = (t, e, n = !1) => {
|
|
|
475
475
|
}
|
|
476
476
|
},
|
|
477
477
|
forEach(t, e) {
|
|
478
|
-
const n =
|
|
478
|
+
const n = k(this);
|
|
479
479
|
ie(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 =
|
|
485
|
+
const r = k(this), i = ie(r).get(t), s = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, i, se)) === se.mutable;
|
|
486
486
|
if (r.options.strict && Ct(i, r.options, s), s || r.finalized || !fe(i, r.options) || i !== r.original.get(t))
|
|
487
487
|
return i;
|
|
488
488
|
const o = $n.createDraft({
|
|
@@ -495,7 +495,7 @@ const Ct = (t, e, n = !1) => {
|
|
|
495
495
|
return H(r), r.copy.set(t, o), o;
|
|
496
496
|
},
|
|
497
497
|
keys() {
|
|
498
|
-
return ie(
|
|
498
|
+
return ie(k(this)).keys();
|
|
499
499
|
},
|
|
500
500
|
values() {
|
|
501
501
|
const t = this.keys();
|
|
@@ -536,7 +536,7 @@ const Ct = (t, e, n = !1) => {
|
|
|
536
536
|
return s;
|
|
537
537
|
const o = s.value;
|
|
538
538
|
let a = t.setMap.get(o);
|
|
539
|
-
const u =
|
|
539
|
+
const u = k(a), c = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, a, se)) === se.mutable;
|
|
540
540
|
if (t.options.strict && Ct(o, t.options, c), !c && !u && fe(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
541
541
|
const d = $n.createDraft({
|
|
542
542
|
original: o,
|
|
@@ -553,39 +553,39 @@ const Ct = (t, e, n = !1) => {
|
|
|
553
553
|
};
|
|
554
554
|
}, Pt = {
|
|
555
555
|
get size() {
|
|
556
|
-
return
|
|
556
|
+
return k(this).setMap.size;
|
|
557
557
|
},
|
|
558
558
|
has(t) {
|
|
559
|
-
const e =
|
|
559
|
+
const e = k(this);
|
|
560
560
|
if (e.setMap.has(t))
|
|
561
561
|
return !0;
|
|
562
562
|
H(e);
|
|
563
|
-
const n =
|
|
563
|
+
const n = k(t);
|
|
564
564
|
return !!(n && e.setMap.has(n.original));
|
|
565
565
|
},
|
|
566
566
|
add(t) {
|
|
567
|
-
const e =
|
|
567
|
+
const e = k(this);
|
|
568
568
|
return this.has(t) || (H(e), ye(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Nn(e, t, t, at)), this;
|
|
569
569
|
},
|
|
570
570
|
delete(t) {
|
|
571
571
|
if (!this.has(t))
|
|
572
572
|
return !1;
|
|
573
|
-
const e =
|
|
573
|
+
const e = k(this);
|
|
574
574
|
H(e), ye(e);
|
|
575
|
-
const n =
|
|
575
|
+
const n = k(t);
|
|
576
576
|
return n && e.setMap.has(n.original) ? (e.assignedMap.set(n.original, !1), e.setMap.delete(n.original)) : (!n && e.setMap.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.setMap.delete(t));
|
|
577
577
|
},
|
|
578
578
|
clear() {
|
|
579
579
|
if (!this.size)
|
|
580
580
|
return;
|
|
581
|
-
const t =
|
|
581
|
+
const t = k(this);
|
|
582
582
|
H(t), ye(t);
|
|
583
583
|
for (const e of t.original)
|
|
584
584
|
t.assignedMap.set(e, !1);
|
|
585
585
|
t.setMap.clear();
|
|
586
586
|
},
|
|
587
587
|
values() {
|
|
588
|
-
const t =
|
|
588
|
+
const t = k(this);
|
|
589
589
|
H(t);
|
|
590
590
|
const e = t.setMap.keys();
|
|
591
591
|
return {
|
|
@@ -594,7 +594,7 @@ const Ct = (t, e, n = !1) => {
|
|
|
594
594
|
};
|
|
595
595
|
},
|
|
596
596
|
entries() {
|
|
597
|
-
const t =
|
|
597
|
+
const t = k(this);
|
|
598
598
|
H(t);
|
|
599
599
|
const e = t.setMap.keys();
|
|
600
600
|
return {
|
|
@@ -687,7 +687,7 @@ const Os = Reflect.ownKeys(Pt), ai = /* @__PURE__ */ new WeakSet(), ui = {
|
|
|
687
687
|
finalities: t.finalities,
|
|
688
688
|
options: t.options
|
|
689
689
|
}), typeof o == "function") {
|
|
690
|
-
const c =
|
|
690
|
+
const c = k(t.copy[e]);
|
|
691
691
|
return H(c), ye(c), c.copy;
|
|
692
692
|
}
|
|
693
693
|
return t.copy[e];
|
|
@@ -704,7 +704,7 @@ const Os = Reflect.ownKeys(Pt), ai = /* @__PURE__ */ new WeakSet(), ui = {
|
|
|
704
704
|
const s = yr(ie(t), e);
|
|
705
705
|
if (s != null && s.set)
|
|
706
706
|
return s.set.call(t.proxy, n), !0;
|
|
707
|
-
const o = Yt(ie(t), e), a =
|
|
707
|
+
const o = Yt(ie(t), e), a = k(o);
|
|
708
708
|
return a && ge(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) : (ge(n, o) && (n !== void 0 || rt(t.original, e)) || (H(t), ye(t), rt(t.original, e) && ge(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, Nn(t, e, n, at)), !0);
|
|
709
709
|
},
|
|
710
710
|
has(t, e) {
|
|
@@ -755,9 +755,9 @@ function Fn(t) {
|
|
|
755
755
|
const d = n;
|
|
756
756
|
d.finalities.draft.push((f, h) => {
|
|
757
757
|
var p, b;
|
|
758
|
-
const y =
|
|
758
|
+
const y = k(u);
|
|
759
759
|
let g = d.type === 3 ? d.setMap : d.copy;
|
|
760
|
-
const T = me(g, r), w =
|
|
760
|
+
const T = me(g, r), w = k(T);
|
|
761
761
|
if (w) {
|
|
762
762
|
let v = w.original;
|
|
763
763
|
w.operated && (v = Un(T)), an(w), un(w, at, f, h), d.options.enableAutoFreeze && (d.options.updatedValues = (p = d.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), d.options.updatedValues.set(v, w.original)), ut(g, r, v);
|
|
@@ -767,7 +767,7 @@ function Fn(t) {
|
|
|
767
767
|
});
|
|
768
768
|
});
|
|
769
769
|
} else {
|
|
770
|
-
const d =
|
|
770
|
+
const d = k(u);
|
|
771
771
|
d.finalities.draft.push((f, h) => {
|
|
772
772
|
an(d), un(d, at, f, h);
|
|
773
773
|
});
|
|
@@ -777,7 +777,7 @@ function Fn(t) {
|
|
|
777
777
|
$n.createDraft = Fn;
|
|
778
778
|
function Es(t, e, n, r, i) {
|
|
779
779
|
var s;
|
|
780
|
-
const o =
|
|
780
|
+
const o = k(t), a = (s = o == null ? void 0 : o.original) !== null && s !== void 0 ? s : t, u = !!e.length;
|
|
781
781
|
if (o != null && o.operated)
|
|
782
782
|
for (; o.finalities.draft.length > 0; )
|
|
783
783
|
o.finalities.draft.pop()(n, r);
|
|
@@ -814,7 +814,7 @@ function As(t, e) {
|
|
|
814
814
|
function dn(t) {
|
|
815
815
|
const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: i = !0 } = t;
|
|
816
816
|
Ln(n, (s, o, a) => {
|
|
817
|
-
const u =
|
|
817
|
+
const u = k(o);
|
|
818
818
|
if (u && e && u.finalities === e.finalities) {
|
|
819
819
|
t.isContainDraft = !0;
|
|
820
820
|
const c = u.original;
|
|
@@ -828,7 +828,7 @@ function dn(t) {
|
|
|
828
828
|
}
|
|
829
829
|
function ci(t) {
|
|
830
830
|
var e;
|
|
831
|
-
const n =
|
|
831
|
+
const n = k(t);
|
|
832
832
|
if (!fe(t, n == null ? void 0 : n.options))
|
|
833
833
|
return t;
|
|
834
834
|
const r = Ie(t);
|
|
@@ -863,7 +863,7 @@ function gr(t) {
|
|
|
863
863
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
864
864
|
return ci(t);
|
|
865
865
|
}
|
|
866
|
-
const
|
|
866
|
+
const js = (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(E, ...U) {
|
|
@@ -900,10 +900,10 @@ const ks = (t) => function e(n, r, i) {
|
|
|
900
900
|
try {
|
|
901
901
|
v = c(T);
|
|
902
902
|
} catch (E) {
|
|
903
|
-
throw on(
|
|
903
|
+
throw on(k(T)), E;
|
|
904
904
|
}
|
|
905
905
|
const P = (E) => {
|
|
906
|
-
const U =
|
|
906
|
+
const U = k(T);
|
|
907
907
|
if (!Me(E)) {
|
|
908
908
|
if (E !== void 0 && !ge(E, T) && (U != null && U.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.");
|
|
@@ -921,7 +921,7 @@ const ks = (t) => function e(n, r, i) {
|
|
|
921
921
|
}
|
|
922
922
|
if (E === T || E === void 0)
|
|
923
923
|
return w([]);
|
|
924
|
-
const F =
|
|
924
|
+
const F = k(E);
|
|
925
925
|
if (g === F.options) {
|
|
926
926
|
if (F.operated)
|
|
927
927
|
throw new Error("Cannot return a modified child draft.");
|
|
@@ -930,9 +930,9 @@ const ks = (t) => function e(n, r, i) {
|
|
|
930
930
|
return w([E]);
|
|
931
931
|
};
|
|
932
932
|
return v instanceof Promise ? v.then(P, (E) => {
|
|
933
|
-
throw on(
|
|
933
|
+
throw on(k(T)), E;
|
|
934
934
|
}) : P(v);
|
|
935
|
-
}, Mt =
|
|
935
|
+
}, Mt = js();
|
|
936
936
|
Object.prototype.constructor.toString();
|
|
937
937
|
function di(t, e) {
|
|
938
938
|
const n = Object.keys(t), r = Object.keys(e);
|
|
@@ -971,7 +971,7 @@ function fi(t, e) {
|
|
|
971
971
|
function et(t) {
|
|
972
972
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
973
973
|
}
|
|
974
|
-
function
|
|
974
|
+
function ks(t, e, n) {
|
|
975
975
|
if (!t || e.length === 0)
|
|
976
976
|
return;
|
|
977
977
|
let r = t || {};
|
|
@@ -1821,17 +1821,17 @@ function Ao(t, e) {
|
|
|
1821
1821
|
}
|
|
1822
1822
|
return 0;
|
|
1823
1823
|
}
|
|
1824
|
-
function
|
|
1824
|
+
function jo(t, e) {
|
|
1825
1825
|
return Ao(Or(t), Or(e));
|
|
1826
1826
|
}
|
|
1827
1827
|
function B() {
|
|
1828
1828
|
return Eo();
|
|
1829
1829
|
}
|
|
1830
|
-
function
|
|
1830
|
+
function ko(t, e) {
|
|
1831
1831
|
return t.localeCompare(e);
|
|
1832
1832
|
}
|
|
1833
1833
|
function Co() {
|
|
1834
|
-
let t =
|
|
1834
|
+
let t = ko;
|
|
1835
1835
|
if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
|
|
1836
1836
|
try {
|
|
1837
1837
|
t = Intl.Collator("en-US").compare;
|
|
@@ -2009,7 +2009,7 @@ function Ko(t, e, n) {
|
|
|
2009
2009
|
return e == s ? s : `${s}-${n}`;
|
|
2010
2010
|
};
|
|
2011
2011
|
}
|
|
2012
|
-
function
|
|
2012
|
+
function jr(t, e, n, r, i, s) {
|
|
2013
2013
|
const o = t(r, i), a = s.map((u, c) => {
|
|
2014
2014
|
const d = Ko(t, o, c);
|
|
2015
2015
|
return vi(d, n, r, i, u);
|
|
@@ -2022,20 +2022,20 @@ function Wo(t) {
|
|
|
2022
2022
|
e.push(t.slice(0, n));
|
|
2023
2023
|
return e;
|
|
2024
2024
|
}
|
|
2025
|
-
function
|
|
2025
|
+
function kr(t, e, n, r, i) {
|
|
2026
2026
|
return Wo(i).map((s) => yn(t, e, n, r, s, { $isNull: !0 }));
|
|
2027
2027
|
}
|
|
2028
2028
|
function vi(t, e, n, r, i) {
|
|
2029
2029
|
return Object.entries(i).flatMap(([s, o]) => {
|
|
2030
2030
|
if (No([s, o]))
|
|
2031
|
-
return
|
|
2031
|
+
return jr(t, "or", e, n, r, o);
|
|
2032
2032
|
if (Fo([s, o]))
|
|
2033
|
-
return
|
|
2033
|
+
return jr(t, "and", e, n, r, o);
|
|
2034
2034
|
if (s === "$entityIdStartsWith")
|
|
2035
2035
|
return [];
|
|
2036
2036
|
const a = s.split(".");
|
|
2037
2037
|
if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2038
|
-
const u = yn(t, e, n, r, a, o), c =
|
|
2038
|
+
const u = yn(t, e, n, r, a, o), c = kr(t, e, n, r, a);
|
|
2039
2039
|
return [
|
|
2040
2040
|
{
|
|
2041
2041
|
or: {
|
|
@@ -2048,7 +2048,7 @@ function vi(t, e, n, r, i) {
|
|
|
2048
2048
|
return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && a.length > 1 ? [
|
|
2049
2049
|
{
|
|
2050
2050
|
or: {
|
|
2051
|
-
patterns:
|
|
2051
|
+
patterns: kr(t, e, n, r, a),
|
|
2052
2052
|
joinSym: t(n, r)
|
|
2053
2053
|
}
|
|
2054
2054
|
}
|
|
@@ -2094,7 +2094,7 @@ function Bo(t, e, n) {
|
|
|
2094
2094
|
return n === "string" ? Po(t, e) : t > e ? 1 : -1;
|
|
2095
2095
|
}
|
|
2096
2096
|
function It([t, e], [n, r], i) {
|
|
2097
|
-
return e === r || e == null && r == null ?
|
|
2097
|
+
return e === r || e == null && r == null ? jo(t, n) : r == null ? 1 : e == null ? -1 : Bo(e, r, i);
|
|
2098
2098
|
}
|
|
2099
2099
|
function _n(t) {
|
|
2100
2100
|
return t == null ? t : new Date(t).getTime();
|
|
@@ -2432,7 +2432,7 @@ function pa(t, e, n) {
|
|
|
2432
2432
|
}
|
|
2433
2433
|
return !1;
|
|
2434
2434
|
}
|
|
2435
|
-
function
|
|
2435
|
+
function ji({ stores: t, attrs: e }, [n, r, i, s]) {
|
|
2436
2436
|
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : pa(t, n, r) ? { mode: "update" } : null;
|
|
2437
2437
|
}
|
|
2438
2438
|
function ya(t, e) {
|
|
@@ -2443,7 +2443,7 @@ function ya(t, e) {
|
|
|
2443
2443
|
});
|
|
2444
2444
|
}
|
|
2445
2445
|
function _a(t, e) {
|
|
2446
|
-
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Kn(o), c = re(r, i, s), d =
|
|
2446
|
+
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Kn(o), c = re(r, i, s), d = ji(t, [i, c, o, a]);
|
|
2447
2447
|
return [["id", c]].concat(Object.entries(u)).map(([h, p]) => {
|
|
2448
2448
|
const b = V(r, i, h);
|
|
2449
2449
|
return b["checked-data-type"] === "date" && t.useDateObjects && (p = xt(p)), [
|
|
@@ -2459,7 +2459,7 @@ function ba({ attrs: t }, [e, n]) {
|
|
|
2459
2459
|
return [["delete-entity", re(t, e, n), e]];
|
|
2460
2460
|
}
|
|
2461
2461
|
function ga(t, e) {
|
|
2462
|
-
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Kn(o), c = re(r, i, s), d =
|
|
2462
|
+
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Kn(o), c = re(r, i, s), d = ji(t, [i, c, o, a]), f = Object.entries(u).map(([p, b]) => {
|
|
2463
2463
|
const y = V(r, i, p);
|
|
2464
2464
|
return [
|
|
2465
2465
|
"deep-merge-triple",
|
|
@@ -2558,7 +2558,7 @@ function Cr(t, e, n, r) {
|
|
|
2558
2558
|
const i = t ? Ea(t, e, n) : null, s = B(), o = [B(), e, n], a = [B(), n, e];
|
|
2559
2559
|
return Object.assign(Object.assign({ id: s, "forward-identity": o, "reverse-identity": a, "value-type": "ref", cardinality: "many", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
2560
2560
|
}
|
|
2561
|
-
const Aa = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]),
|
|
2561
|
+
const Aa = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), ja = /* @__PURE__ */ new Set(["link", "unlink"]), ka = /* @__PURE__ */ new Set(["create", "update", "merge"]), Ca = /* @__PURE__ */ new Set([
|
|
2562
2562
|
"link",
|
|
2563
2563
|
"unlink",
|
|
2564
2564
|
"create",
|
|
@@ -2627,7 +2627,7 @@ function Ia({ attrs: t, schema: e }, n) {
|
|
|
2627
2627
|
c(g), g || u(Tt(e, p, "id", { "unique?": !0 }));
|
|
2628
2628
|
for (const T of Object.keys(y)) {
|
|
2629
2629
|
const w = V(o, p, T);
|
|
2630
|
-
if (c(w),
|
|
2630
|
+
if (c(w), ka.has(h) && (w || u(Tt(e, p, T, T === "id" ? { "unique?": !0 } : null))), ja.has(h)) {
|
|
2631
2631
|
const v = Ce(o, p, T);
|
|
2632
2632
|
!w && !v && u(Cr(e, p, T)), c(v);
|
|
2633
2633
|
}
|
|
@@ -2673,7 +2673,7 @@ function Jt(t) {
|
|
|
2673
2673
|
console.error("Error in IndexedDB event", { source: t, event: n });
|
|
2674
2674
|
};
|
|
2675
2675
|
}
|
|
2676
|
-
class
|
|
2676
|
+
class ki {
|
|
2677
2677
|
constructor(e, n) {
|
|
2678
2678
|
this.dbName = e, this._storeName = n, this._dbPromise = this._init();
|
|
2679
2679
|
}
|
|
@@ -3376,7 +3376,15 @@ class $r {
|
|
|
3376
3376
|
for (const i of Object.keys(n))
|
|
3377
3377
|
if (!n[i])
|
|
3378
3378
|
debugger;
|
|
3379
|
-
|
|
3379
|
+
this.currentValue = n, this._enqueuePersist();
|
|
3380
|
+
for (const i of this._subs)
|
|
3381
|
+
i(this.currentValue);
|
|
3382
|
+
return n;
|
|
3383
|
+
}
|
|
3384
|
+
subscribe(e) {
|
|
3385
|
+
return this._subs.push(e), e(this.currentValue), () => {
|
|
3386
|
+
this._subs = this._subs.filter((n) => n !== e);
|
|
3387
|
+
};
|
|
3380
3388
|
}
|
|
3381
3389
|
}
|
|
3382
3390
|
function Ii(t, e = []) {
|
|
@@ -3406,7 +3414,7 @@ function Dr(t) {
|
|
|
3406
3414
|
}, e;
|
|
3407
3415
|
}, {});
|
|
3408
3416
|
}
|
|
3409
|
-
const Qn = "v0.22.49-experimental.persisted-object-2.
|
|
3417
|
+
const Qn = "v0.22.49-experimental.persisted-object-2.19448798235.1";
|
|
3410
3418
|
function Ja(t, e) {
|
|
3411
3419
|
return {
|
|
3412
3420
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -3995,7 +4003,7 @@ function Vr(t) {
|
|
|
3995
4003
|
});
|
|
3996
4004
|
}
|
|
3997
4005
|
class mu {
|
|
3998
|
-
constructor(e, n =
|
|
4006
|
+
constructor(e, n = ki, r = Ci, i, s) {
|
|
3999
4007
|
var o, a, u;
|
|
4000
4008
|
if (this._isOnline = !0, this._isShutdown = !1, this.status = _e.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._onMergeQuerySub = (c, d, f) => {
|
|
4001
4009
|
const h = d == null ? void 0 : d.result, p = f == null ? void 0 : f.result;
|
|
@@ -4351,7 +4359,7 @@ class mu {
|
|
|
4351
4359
|
var i;
|
|
4352
4360
|
const s = (i = this.kv.currentValue.pendingMutations) === null || i === void 0 ? void 0 : i.get(n);
|
|
4353
4361
|
if (s && (e !== "timeout" || !s["tx-id"])) {
|
|
4354
|
-
this.
|
|
4362
|
+
this._updatePendingMutations((a) => (a.delete(n), a)), this._inFlightMutationEventIds.delete(n);
|
|
4355
4363
|
const o = {
|
|
4356
4364
|
message: r.message,
|
|
4357
4365
|
hint: r.hint
|
|
@@ -5054,7 +5062,7 @@ class mu {
|
|
|
5054
5062
|
for (let [d, f, h] of n)
|
|
5055
5063
|
switch (f) {
|
|
5056
5064
|
case "+":
|
|
5057
|
-
|
|
5065
|
+
ks(c, d, h);
|
|
5058
5066
|
break;
|
|
5059
5067
|
case "r":
|
|
5060
5068
|
wr(c, d, h);
|
|
@@ -5189,7 +5197,7 @@ function Eu() {
|
|
|
5189
5197
|
function Au() {
|
|
5190
5198
|
return new J("json", !0, !1);
|
|
5191
5199
|
}
|
|
5192
|
-
function
|
|
5200
|
+
function ju() {
|
|
5193
5201
|
return new J("json", !0, !1);
|
|
5194
5202
|
}
|
|
5195
5203
|
function Ni(t, e) {
|
|
@@ -5208,7 +5216,7 @@ function Ni(t, e) {
|
|
|
5208
5216
|
new Nt(c.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
|
|
5209
5217
|
]));
|
|
5210
5218
|
}
|
|
5211
|
-
function
|
|
5219
|
+
function ku({ entities: t, links: e, rooms: n }) {
|
|
5212
5220
|
const r = e ?? {}, i = n ?? {};
|
|
5213
5221
|
return new Ft(
|
|
5214
5222
|
Ni(t, r),
|
|
@@ -5224,7 +5232,7 @@ function ju({ entities: t, links: e, rooms: n }) {
|
|
|
5224
5232
|
const mc = {
|
|
5225
5233
|
// constructs
|
|
5226
5234
|
graph: wu,
|
|
5227
|
-
schema:
|
|
5235
|
+
schema: ku,
|
|
5228
5236
|
entity: Tu,
|
|
5229
5237
|
// value types
|
|
5230
5238
|
string: vu,
|
|
@@ -5232,7 +5240,7 @@ const mc = {
|
|
|
5232
5240
|
boolean: Ou,
|
|
5233
5241
|
date: Eu,
|
|
5234
5242
|
json: Au,
|
|
5235
|
-
any:
|
|
5243
|
+
any: ju
|
|
5236
5244
|
};
|
|
5237
5245
|
let vt;
|
|
5238
5246
|
function Cu(t, e) {
|
|
@@ -5535,7 +5543,7 @@ function zu(t, e, n, r, i) {
|
|
|
5535
5543
|
const s = Sn[vn(t)];
|
|
5536
5544
|
if (s)
|
|
5537
5545
|
return qu(s, t.schema) && s._reactor.updateSchema(t.schema), s;
|
|
5538
|
-
const o = new mu(Object.assign(Object.assign(Object.assign({}, Du), t), { cardinalityInference: !!t.schema }), e ||
|
|
5546
|
+
const o = new mu(Object.assign(Object.assign(Object.assign({}, Du), t), { cardinalityInference: !!t.schema }), e || ki, n || Ci, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Qn }), i), a = new Wu(o);
|
|
5539
5547
|
return Sn[vn(t)] = a, Vu(t.appId, t.devtool), a;
|
|
5540
5548
|
}
|
|
5541
5549
|
function Vu(t, e) {
|
|
@@ -5801,17 +5809,17 @@ function Bu() {
|
|
|
5801
5809
|
}
|
|
5802
5810
|
} catch (Z) {
|
|
5803
5811
|
if (Z && S && typeof Z.stack == "string") {
|
|
5804
|
-
for (var
|
|
5812
|
+
for (var j = Z.stack.split(`
|
|
5805
5813
|
`), Y = S.stack.split(`
|
|
5806
|
-
`), x =
|
|
5814
|
+
`), x = j.length - 1, L = Y.length - 1; x >= 1 && L >= 0 && j[x] !== Y[L]; )
|
|
5807
5815
|
L--;
|
|
5808
5816
|
for (; x >= 1 && L >= 0; x--, L--)
|
|
5809
|
-
if (
|
|
5817
|
+
if (j[x] !== Y[L]) {
|
|
5810
5818
|
if (x !== 1 || L !== 1)
|
|
5811
5819
|
do
|
|
5812
|
-
if (x--, L--, L < 0 ||
|
|
5820
|
+
if (x--, L--, L < 0 || j[x] !== Y[L]) {
|
|
5813
5821
|
var oe = `
|
|
5814
|
-
` +
|
|
5822
|
+
` + j[x].replace(" at new ", " at ");
|
|
5815
5823
|
return l.displayName && oe.includes("<anonymous>") && (oe = oe.replace("<anonymous>", l.displayName)), typeof l == "function" && bt.set(l, oe), oe;
|
|
5816
5824
|
}
|
|
5817
5825
|
while (x >= 1 && L >= 0);
|
|
@@ -5873,17 +5881,17 @@ function Bu() {
|
|
|
5873
5881
|
var I = Function.call.bind(Qe);
|
|
5874
5882
|
for (var C in l)
|
|
5875
5883
|
if (I(l, C)) {
|
|
5876
|
-
var
|
|
5884
|
+
var j = void 0;
|
|
5877
5885
|
try {
|
|
5878
5886
|
if (typeof l[C] != "function") {
|
|
5879
5887
|
var Y = Error((S || "React class") + ": " + m + " type `" + C + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof l[C] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
5880
5888
|
throw Y.name = "Invariant Violation", Y;
|
|
5881
5889
|
}
|
|
5882
|
-
|
|
5890
|
+
j = l[C](_, C, S, m, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
5883
5891
|
} catch (x) {
|
|
5884
|
-
|
|
5892
|
+
j = x;
|
|
5885
5893
|
}
|
|
5886
|
-
|
|
5894
|
+
j && !(j instanceof Error) && (mt(M), v("%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).", S || "React class", m, C, typeof j), mt(null)), j instanceof Error && !(j.message in tr) && (tr[j.message] = !0, mt(M), v("Failed %s type: %s", m, j.message), mt(null));
|
|
5887
5895
|
}
|
|
5888
5896
|
}
|
|
5889
5897
|
}
|
|
@@ -5959,7 +5967,7 @@ function Bu() {
|
|
|
5959
5967
|
}
|
|
5960
5968
|
}
|
|
5961
5969
|
var ns = function(l, _, m, S, M, I, C) {
|
|
5962
|
-
var
|
|
5970
|
+
var j = {
|
|
5963
5971
|
// This tag allows us to uniquely identify this as a React Element
|
|
5964
5972
|
$$typeof: n,
|
|
5965
5973
|
// Built-in properties that belong on the element
|
|
@@ -5970,27 +5978,27 @@ function Bu() {
|
|
|
5970
5978
|
// Record the component responsible for creating this element.
|
|
5971
5979
|
_owner: I
|
|
5972
5980
|
};
|
|
5973
|
-
return
|
|
5981
|
+
return j._store = {}, Object.defineProperty(j._store, "validated", {
|
|
5974
5982
|
configurable: !1,
|
|
5975
5983
|
enumerable: !1,
|
|
5976
5984
|
writable: !0,
|
|
5977
5985
|
value: !1
|
|
5978
|
-
}), Object.defineProperty(
|
|
5986
|
+
}), Object.defineProperty(j, "_self", {
|
|
5979
5987
|
configurable: !1,
|
|
5980
5988
|
enumerable: !1,
|
|
5981
5989
|
writable: !1,
|
|
5982
5990
|
value: S
|
|
5983
|
-
}), Object.defineProperty(
|
|
5991
|
+
}), Object.defineProperty(j, "_source", {
|
|
5984
5992
|
configurable: !1,
|
|
5985
5993
|
enumerable: !1,
|
|
5986
5994
|
writable: !1,
|
|
5987
5995
|
value: M
|
|
5988
|
-
}), Object.freeze && (Object.freeze(
|
|
5996
|
+
}), Object.freeze && (Object.freeze(j.props), Object.freeze(j)), j;
|
|
5989
5997
|
};
|
|
5990
5998
|
function rs(l, _, m, S, M) {
|
|
5991
5999
|
{
|
|
5992
|
-
var I, C = {},
|
|
5993
|
-
m !== void 0 && (ir(m),
|
|
6000
|
+
var I, C = {}, j = null, Y = null;
|
|
6001
|
+
m !== void 0 && (ir(m), j = "" + m), Zi(_) && (ir(_.key), j = "" + _.key), Ji(_) && (Y = _.ref, Xi(_, M));
|
|
5994
6002
|
for (I in _)
|
|
5995
6003
|
Qe.call(_, I) && !Hi.hasOwnProperty(I) && (C[I] = _[I]);
|
|
5996
6004
|
if (l && l.defaultProps) {
|
|
@@ -5998,11 +6006,11 @@ function Bu() {
|
|
|
5998
6006
|
for (I in x)
|
|
5999
6007
|
C[I] === void 0 && (C[I] = x[I]);
|
|
6000
6008
|
}
|
|
6001
|
-
if (
|
|
6009
|
+
if (j || Y) {
|
|
6002
6010
|
var L = typeof l == "function" ? l.displayName || l.name || "Unknown" : l;
|
|
6003
|
-
|
|
6011
|
+
j && es(C, L), Y && ts(C, L);
|
|
6004
6012
|
}
|
|
6005
|
-
return ns(l,
|
|
6013
|
+
return ns(l, j, Y, M, S, sr.current, C);
|
|
6006
6014
|
}
|
|
6007
6015
|
}
|
|
6008
6016
|
var Vt = w.ReactCurrentOwner, ur = w.ReactDebugCurrentFrame;
|
|
@@ -6120,12 +6128,12 @@ Check the top-level render call using <` + m + ">.");
|
|
|
6120
6128
|
{
|
|
6121
6129
|
var C = we(l);
|
|
6122
6130
|
if (!C) {
|
|
6123
|
-
var
|
|
6124
|
-
(l === void 0 || typeof l == "object" && l !== null && Object.keys(l).length === 0) && (
|
|
6131
|
+
var j = "";
|
|
6132
|
+
(l === void 0 || typeof l == "object" && l !== null && Object.keys(l).length === 0) && (j += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
6125
6133
|
var Y = is();
|
|
6126
|
-
Y ?
|
|
6134
|
+
Y ? j += Y : j += cr();
|
|
6127
6135
|
var x;
|
|
6128
|
-
l === null ? x = "null" : zt(l) ? x = "array" : l !== void 0 && l.$$typeof === n ? (x = "<" + (G(l.type) || "Unknown") + " />",
|
|
6136
|
+
l === null ? x = "null" : zt(l) ? x = "array" : l !== void 0 && l.$$typeof === n ? (x = "<" + (G(l.type) || "Unknown") + " />", j = " Did you accidentally export a JSX literal instead of a component?") : x = typeof l, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", x, j);
|
|
6129
6137
|
}
|
|
6130
6138
|
var L = rs(l, _, m, M, I);
|
|
6131
6139
|
if (L == null)
|
|
@@ -6184,7 +6192,7 @@ function Yr(t) {
|
|
|
6184
6192
|
}
|
|
6185
6193
|
function Hu(t, e, n) {
|
|
6186
6194
|
e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
6187
|
-
const r = e ? Ku(e) : null, i = X(r), s =
|
|
6195
|
+
const r = e ? Ku(e) : null, i = X(r), s = kt(Yr(t._reactor.getPreviousResult(r))), o = Se(
|
|
6188
6196
|
(u) => (s.current = Yr(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (d) => {
|
|
6189
6197
|
s.current = Object.assign({ isLoading: !d, data: void 0, pageInfo: void 0, error: void 0 }, d), u();
|
|
6190
6198
|
}) : () => {
|
|
@@ -6195,7 +6203,7 @@ function Hu(t, e, n) {
|
|
|
6195
6203
|
return { state: rn(o, () => s.current, () => Yu), query: r };
|
|
6196
6204
|
}
|
|
6197
6205
|
function Ju() {
|
|
6198
|
-
const t =
|
|
6206
|
+
const t = kt(null);
|
|
6199
6207
|
Pe(() => {
|
|
6200
6208
|
n();
|
|
6201
6209
|
}, []);
|
|
@@ -6328,7 +6336,7 @@ class ac {
|
|
|
6328
6336
|
});
|
|
6329
6337
|
}, [r]), i;
|
|
6330
6338
|
}, this.rooms = Ae, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => Hu(this.core, r, i).state, this.useAuth = () => {
|
|
6331
|
-
const r =
|
|
6339
|
+
const r = kt(this.core._reactor._currentUserCached), i = Se((o) => this.core.subscribeAuth((u) => {
|
|
6332
6340
|
r.current = Object.assign({ isLoading: !1 }, u), o();
|
|
6333
6341
|
}), []);
|
|
6334
6342
|
return rn(i, () => r.current, () => oc);
|
|
@@ -6338,7 +6346,7 @@ class ac {
|
|
|
6338
6346
|
throw new Ve("useUser must be used within an auth-protected route");
|
|
6339
6347
|
return r;
|
|
6340
6348
|
}, this.useConnectionStatus = () => {
|
|
6341
|
-
const r =
|
|
6349
|
+
const r = kt(this.core._reactor.status), i = Se((o) => this.core.subscribeConnectionStatus((u) => {
|
|
6342
6350
|
u !== r.current && (r.current = u, o());
|
|
6343
6351
|
}), []);
|
|
6344
6352
|
return rn(
|
|
@@ -6555,11 +6563,11 @@ function Zr(t) {
|
|
|
6555
6563
|
}
|
|
6556
6564
|
var Fi = (t) => {
|
|
6557
6565
|
throw TypeError(t);
|
|
6558
|
-
}, Yn = (t, e, n) => e.has(t) || Fi("Cannot " + n), A = (t, e, n) => (Yn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), K = (t, e, n) => e.has(t) ? Fi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Yn(t, e, "write to private field"), e.set(t, n), n), be = (t, e, n) => (Yn(t, e, "access private method"), n), ee,
|
|
6559
|
-
class
|
|
6566
|
+
}, Yn = (t, e, n) => e.has(t) || Fi("Cannot " + n), A = (t, e, n) => (Yn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), K = (t, e, n) => e.has(t) ? Fi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Yn(t, e, "write to private field"), e.set(t, n), n), be = (t, e, n) => (Yn(t, e, "access private method"), n), ee, je, De, At, $t, st, Ne, ot, ve, Ue, Ke, Le, tt, ce, An, jn, kn, Xr, Cn, Pn, nt, Mn, In;
|
|
6567
|
+
class jt extends EventTarget {
|
|
6560
6568
|
constructor(e, n) {
|
|
6561
6569
|
var r, i;
|
|
6562
|
-
super(), K(this, ce), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, K(this, ee), K(this,
|
|
6570
|
+
super(), K(this, ce), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, K(this, ee), K(this, je), K(this, De), K(this, At), K(this, $t), K(this, st), K(this, Ne), K(this, ot, null), K(this, ve), K(this, Ue), K(this, Ke, null), K(this, Le, null), K(this, tt, null), K(this, jn, async (s) => {
|
|
6563
6571
|
var o;
|
|
6564
6572
|
A(this, Ue).reset();
|
|
6565
6573
|
const { body: a, redirected: u, status: c, headers: d } = s;
|
|
@@ -6589,13 +6597,13 @@ class kt extends EventTarget {
|
|
|
6589
6597
|
const { done: y, value: g } = await p.read();
|
|
6590
6598
|
g && A(this, Ue).feed(h.decode(g, { stream: !y })), y && (b = !1, A(this, Ue).reset(), be(this, ce, Mn).call(this));
|
|
6591
6599
|
} while (b);
|
|
6592
|
-
}), K(this,
|
|
6600
|
+
}), K(this, kn, (s) => {
|
|
6593
6601
|
$(this, ve, void 0), !(s.name === "AbortError" || s.type === "aborted") && be(this, ce, Mn).call(this, En(s));
|
|
6594
6602
|
}), K(this, Cn, (s) => {
|
|
6595
6603
|
typeof s.id == "string" && $(this, ot, s.id);
|
|
6596
6604
|
const o = new MessageEvent(s.event || "message", {
|
|
6597
6605
|
data: s.data,
|
|
6598
|
-
origin: A(this, De) ? A(this, De).origin : A(this,
|
|
6606
|
+
origin: A(this, De) ? A(this, De).origin : A(this, je).origin,
|
|
6599
6607
|
lastEventId: s.id || ""
|
|
6600
6608
|
});
|
|
6601
6609
|
A(this, Le) && (!s.event || s.event === "message") && A(this, Le).call(this, o), this.dispatchEvent(o);
|
|
@@ -6606,9 +6614,9 @@ class kt extends EventTarget {
|
|
|
6606
6614
|
});
|
|
6607
6615
|
try {
|
|
6608
6616
|
if (e instanceof URL)
|
|
6609
|
-
$(this,
|
|
6617
|
+
$(this, je, e);
|
|
6610
6618
|
else if (typeof e == "string")
|
|
6611
|
-
$(this,
|
|
6619
|
+
$(this, je, new URL(e, fc()));
|
|
6612
6620
|
else
|
|
6613
6621
|
throw new Error("Invalid URL");
|
|
6614
6622
|
} catch {
|
|
@@ -6640,7 +6648,7 @@ class kt extends EventTarget {
|
|
|
6640
6648
|
* @public
|
|
6641
6649
|
*/
|
|
6642
6650
|
get url() {
|
|
6643
|
-
return A(this,
|
|
6651
|
+
return A(this, je).href;
|
|
6644
6652
|
}
|
|
6645
6653
|
/**
|
|
6646
6654
|
* Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
|
|
@@ -6690,14 +6698,14 @@ class kt extends EventTarget {
|
|
|
6690
6698
|
A(this, Ne) && clearTimeout(A(this, Ne)), A(this, ee) !== this.CLOSED && (A(this, ve) && A(this, ve).abort(), $(this, ee, this.CLOSED), $(this, ve, void 0));
|
|
6691
6699
|
}
|
|
6692
6700
|
}
|
|
6693
|
-
ee = /* @__PURE__ */ new WeakMap(),
|
|
6701
|
+
ee = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap(), $t = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), Ne = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakMap(), Ue = /* @__PURE__ */ new WeakMap(), Ke = /* @__PURE__ */ new WeakMap(), Le = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), ce = /* @__PURE__ */ new WeakSet(), /**
|
|
6694
6702
|
* Connect to the given URL and start receiving events
|
|
6695
6703
|
*
|
|
6696
6704
|
* @internal
|
|
6697
6705
|
*/
|
|
6698
6706
|
An = function() {
|
|
6699
|
-
$(this, ee, this.CONNECTING), $(this, ve, new AbortController()), A(this, $t)(A(this,
|
|
6700
|
-
},
|
|
6707
|
+
$(this, ee, this.CONNECTING), $(this, ve, new AbortController()), A(this, $t)(A(this, je), be(this, ce, Xr).call(this)).then(A(this, jn)).catch(A(this, kn));
|
|
6708
|
+
}, jn = /* @__PURE__ */ new WeakMap(), kn = /* @__PURE__ */ new WeakMap(), /**
|
|
6701
6709
|
* Get request options for the `fetch()` request
|
|
6702
6710
|
*
|
|
6703
6711
|
* @returns The request options
|
|
@@ -6746,24 +6754,24 @@ Mn = function(t, e) {
|
|
|
6746
6754
|
*
|
|
6747
6755
|
* @public
|
|
6748
6756
|
*/
|
|
6749
|
-
|
|
6757
|
+
jt.CONNECTING = 0, /**
|
|
6750
6758
|
* ReadyState representing an EventSource connection that is open (eg connected)
|
|
6751
6759
|
*
|
|
6752
6760
|
* @public
|
|
6753
6761
|
*/
|
|
6754
|
-
|
|
6762
|
+
jt.OPEN = 1, /**
|
|
6755
6763
|
* ReadyState representing an EventSource connection that is closed (eg disconnected)
|
|
6756
6764
|
*
|
|
6757
6765
|
* @public
|
|
6758
6766
|
*/
|
|
6759
|
-
|
|
6767
|
+
jt.CLOSED = 2;
|
|
6760
6768
|
function fc() {
|
|
6761
6769
|
const t = "document" in globalThis ? globalThis.document : void 0;
|
|
6762
6770
|
return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
|
|
6763
6771
|
}
|
|
6764
6772
|
const Hn = class Hn extends ac {
|
|
6765
6773
|
};
|
|
6766
|
-
Hn.EventSourceImpl =
|
|
6774
|
+
Hn.EventSourceImpl = jt;
|
|
6767
6775
|
let Rn = Hn;
|
|
6768
6776
|
function lc(t) {
|
|
6769
6777
|
return new Rn(
|