@instantdb/react 0.22.88-experimental.drewh-entity-caching.20249092034.1 → 0.22.88-experimental.drewh-fix-explorer.20249092035.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 +886 -889
- package/dist/standalone/index.umd.cjs +13 -13
- package/package.json +4 -4
package/dist/standalone/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ci, { useRef as at, useCallback as ge, useSyncExternalStore as tn, useEffect as je, useMemo as nn, useState as di, createElement as js } from "react";
|
|
2
2
|
function z(t) {
|
|
3
3
|
if (typeof t == "number")
|
|
4
4
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
@@ -41,14 +41,14 @@ const U = {
|
|
|
41
41
|
Remove: "remove",
|
|
42
42
|
Replace: "replace",
|
|
43
43
|
Add: "add"
|
|
44
|
-
},
|
|
44
|
+
}, fi = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), ks = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), vt = Symbol.iterator, ne = {
|
|
45
45
|
mutable: "mutable",
|
|
46
46
|
immutable: "immutable"
|
|
47
|
-
},
|
|
47
|
+
}, Mn = {};
|
|
48
48
|
function nt(t, e) {
|
|
49
49
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function gr(t, e) {
|
|
52
52
|
if (e in t) {
|
|
53
53
|
let n = Reflect.getPrototypeOf(t);
|
|
54
54
|
for (; n; ) {
|
|
@@ -59,10 +59,10 @@ function Tr(t, e) {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function Rn(t) {
|
|
63
63
|
return Object.getPrototypeOf(t) === Set.prototype;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function xn(t) {
|
|
66
66
|
return Object.getPrototypeOf(t) === Map.prototype;
|
|
67
67
|
}
|
|
68
68
|
function te(t) {
|
|
@@ -73,9 +73,9 @@ function ke(t) {
|
|
|
73
73
|
return !!k(t);
|
|
74
74
|
}
|
|
75
75
|
function k(t) {
|
|
76
|
-
return typeof t != "object" ? null : t == null ? void 0 : t[
|
|
76
|
+
return typeof t != "object" ? null : t == null ? void 0 : t[fi];
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function $n(t) {
|
|
79
79
|
var e;
|
|
80
80
|
const n = k(t);
|
|
81
81
|
return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
|
|
@@ -86,7 +86,7 @@ function ae(t, e) {
|
|
|
86
86
|
let n;
|
|
87
87
|
return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((n = e.mark(t, ne)) === ne.immutable || typeof n == "function");
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function li(t, e = []) {
|
|
90
90
|
if (Object.hasOwnProperty.call(t, "key")) {
|
|
91
91
|
const n = t.parent.copy, r = k(be(n, t.key));
|
|
92
92
|
if (r !== null && (r == null ? void 0 : r.original) !== t.original)
|
|
@@ -97,10 +97,10 @@ function hi(t, e = []) {
|
|
|
97
97
|
e.push(s);
|
|
98
98
|
}
|
|
99
99
|
if (t.parent)
|
|
100
|
-
return
|
|
100
|
+
return li(t.parent, e);
|
|
101
101
|
e.reverse();
|
|
102
102
|
try {
|
|
103
|
-
|
|
103
|
+
Cs(t.copy, e);
|
|
104
104
|
} catch {
|
|
105
105
|
return null;
|
|
106
106
|
}
|
|
@@ -122,7 +122,7 @@ function Ht(t, e) {
|
|
|
122
122
|
function ye(t, e) {
|
|
123
123
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function rn(t) {
|
|
126
126
|
if (t)
|
|
127
127
|
for (; t.finalities.revoke.length > 0; )
|
|
128
128
|
t.finalities.revoke.pop()();
|
|
@@ -133,7 +133,7 @@ function Ee(t, e) {
|
|
|
133
133
|
return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
134
134
|
}).join("/");
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function Cs(t, e) {
|
|
137
137
|
for (let n = 0; n < e.length - 1; n += 1) {
|
|
138
138
|
const r = e[n];
|
|
139
139
|
if (t = be(Ce(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
|
|
@@ -141,7 +141,7 @@ function Ps(t, e) {
|
|
|
141
141
|
}
|
|
142
142
|
return t;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function Ps(t) {
|
|
145
145
|
const e = Object.create(Object.getPrototypeOf(t));
|
|
146
146
|
return Reflect.ownKeys(t).forEach((n) => {
|
|
147
147
|
let r = Reflect.getOwnPropertyDescriptor(t, n);
|
|
@@ -157,26 +157,26 @@ function Is(t) {
|
|
|
157
157
|
}), Reflect.defineProperty(e, n, r);
|
|
158
158
|
}), e;
|
|
159
159
|
}
|
|
160
|
-
const
|
|
161
|
-
function
|
|
160
|
+
const Is = Object.prototype.propertyIsEnumerable;
|
|
161
|
+
function hi(t, e) {
|
|
162
162
|
let n;
|
|
163
163
|
if (Array.isArray(t))
|
|
164
164
|
return Array.prototype.concat.call(t);
|
|
165
165
|
if (t instanceof Set) {
|
|
166
|
-
if (!
|
|
166
|
+
if (!Rn(t)) {
|
|
167
167
|
const r = Object.getPrototypeOf(t).constructor;
|
|
168
168
|
return new r(t.values());
|
|
169
169
|
}
|
|
170
170
|
return Set.prototype.difference ? Set.prototype.difference.call(t, /* @__PURE__ */ new Set()) : new Set(t.values());
|
|
171
171
|
} else if (t instanceof Map) {
|
|
172
|
-
if (
|
|
172
|
+
if (!xn(t)) {
|
|
173
173
|
const r = Object.getPrototypeOf(t).constructor;
|
|
174
174
|
return new r(t);
|
|
175
175
|
}
|
|
176
176
|
return new Map(t);
|
|
177
177
|
} else if (e != null && e.mark && (n = e.mark(t, ne), n !== void 0) && n !== ne.mutable) {
|
|
178
178
|
if (n === ne.immutable)
|
|
179
|
-
return
|
|
179
|
+
return Ps(t);
|
|
180
180
|
if (typeof n == "function") {
|
|
181
181
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
182
182
|
throw new Error("You can't use mark and patches or auto freeze together.");
|
|
@@ -188,17 +188,17 @@ function pi(t, e) {
|
|
|
188
188
|
return Object.keys(t).forEach((i) => {
|
|
189
189
|
r[i] = t[i];
|
|
190
190
|
}), Object.getOwnPropertySymbols(t).forEach((i) => {
|
|
191
|
-
|
|
191
|
+
Is.call(t, i) && (r[i] = t[i]);
|
|
192
192
|
}), r;
|
|
193
193
|
} else
|
|
194
194
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
195
195
|
}
|
|
196
196
|
function Q(t) {
|
|
197
|
-
t.copy || (t.copy =
|
|
197
|
+
t.copy || (t.copy = hi(t.original, t.options));
|
|
198
198
|
}
|
|
199
199
|
function Je(t) {
|
|
200
200
|
if (!ae(t))
|
|
201
|
-
return
|
|
201
|
+
return $n(t);
|
|
202
202
|
if (Array.isArray(t))
|
|
203
203
|
return t.map(Je);
|
|
204
204
|
if (t instanceof Map) {
|
|
@@ -206,7 +206,7 @@ function Je(t) {
|
|
|
206
206
|
r,
|
|
207
207
|
Je(i)
|
|
208
208
|
]);
|
|
209
|
-
if (
|
|
209
|
+
if (!xn(t)) {
|
|
210
210
|
const r = Object.getPrototypeOf(t).constructor;
|
|
211
211
|
return new r(n);
|
|
212
212
|
}
|
|
@@ -214,7 +214,7 @@ function Je(t) {
|
|
|
214
214
|
}
|
|
215
215
|
if (t instanceof Set) {
|
|
216
216
|
const n = Array.from(t).map(Je);
|
|
217
|
-
if (!
|
|
217
|
+
if (!Rn(t)) {
|
|
218
218
|
const r = Object.getPrototypeOf(t).constructor;
|
|
219
219
|
return new r(n);
|
|
220
220
|
}
|
|
@@ -232,7 +232,7 @@ function fe(t) {
|
|
|
232
232
|
var e;
|
|
233
233
|
t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && fe(t.parent));
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function Tr() {
|
|
236
236
|
throw new Error("Cannot modify frozen object");
|
|
237
237
|
}
|
|
238
238
|
function Me(t, e, n, r, i) {
|
|
@@ -260,12 +260,12 @@ function Me(t, e, n, r, i) {
|
|
|
260
260
|
case 2:
|
|
261
261
|
for (const [a, u] of t)
|
|
262
262
|
Me(a, a, n, r, i), Me(u, a, n, r, i);
|
|
263
|
-
t.set = t.clear = t.delete =
|
|
263
|
+
t.set = t.clear = t.delete = Tr;
|
|
264
264
|
break;
|
|
265
265
|
case 3:
|
|
266
266
|
for (const a of t)
|
|
267
267
|
Me(a, a, n, r, i);
|
|
268
|
-
t.add = t.clear = t.delete =
|
|
268
|
+
t.add = t.clear = t.delete = Tr;
|
|
269
269
|
break;
|
|
270
270
|
case 1:
|
|
271
271
|
Object.freeze(t);
|
|
@@ -281,7 +281,7 @@ function Me(t, e, n, r, i) {
|
|
|
281
281
|
}
|
|
282
282
|
r.pop(), i.pop();
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function Dn(t, e) {
|
|
285
285
|
const n = Ce(t);
|
|
286
286
|
if (n === 0)
|
|
287
287
|
Reflect.ownKeys(t).forEach((r) => {
|
|
@@ -294,11 +294,11 @@ function Un(t, e) {
|
|
|
294
294
|
} else
|
|
295
295
|
t.forEach((r, i) => e(i, r, t));
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function pi(t, e, n) {
|
|
298
298
|
if (ke(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
|
-
if (e.add(t),
|
|
301
|
+
if (e.add(t), Dn(t, (s, o) => {
|
|
302
302
|
var a;
|
|
303
303
|
if (ke(o)) {
|
|
304
304
|
const u = k(o);
|
|
@@ -306,7 +306,7 @@ function yi(t, e, n) {
|
|
|
306
306
|
const c = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
|
|
307
307
|
ct(r ? i : t, s, c);
|
|
308
308
|
} else
|
|
309
|
-
|
|
309
|
+
pi(o, e, n);
|
|
310
310
|
}), i) {
|
|
311
311
|
const s = t, o = Array.from(s);
|
|
312
312
|
s.clear(), o.forEach((a) => {
|
|
@@ -314,39 +314,39 @@ function yi(t, e, n) {
|
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function Ms(t, e) {
|
|
318
318
|
const n = t.type === 3 ? t.setMap : t.copy;
|
|
319
|
-
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n &&
|
|
319
|
+
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && pi(be(n, e), t.finalities.handledSet, t.options);
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function sn(t) {
|
|
322
322
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
323
|
-
t.copy.add(
|
|
323
|
+
t.copy.add($n(e));
|
|
324
324
|
}));
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function on(t, e, n, r) {
|
|
327
327
|
if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
|
|
328
328
|
if (n && r) {
|
|
329
|
-
const s =
|
|
329
|
+
const s = li(t);
|
|
330
330
|
s && e(t, s, n, r);
|
|
331
331
|
}
|
|
332
332
|
t.finalized = !0;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function Un(t, e, n, r) {
|
|
336
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;
|
|
340
340
|
if (ye(be(u, e), n)) {
|
|
341
341
|
let c = i.original;
|
|
342
|
-
i.copy && (c = i.copy),
|
|
342
|
+
i.copy && (c = i.copy), sn(t), on(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)), ct(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
|
-
ye(be(s, e), n) &&
|
|
346
|
+
ye(be(s, e), n) && Ms(t, e);
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function Rs(t, e, n, r, i) {
|
|
350
350
|
let { original: s, assignedMap: o, options: a } = t, u = t.copy;
|
|
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)
|
|
@@ -392,7 +392,7 @@ function xs(t, e, n, r, i) {
|
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
function
|
|
395
|
+
function xs({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
396
396
|
n.forEach((a, u) => {
|
|
397
397
|
const c = be(t, u), d = St(be(e, u)), f = a ? nt(t, u) ? U.Replace : U.Add : U.Remove;
|
|
398
398
|
if (ye(c, d) && f === U.Replace)
|
|
@@ -401,7 +401,7 @@ function $s({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
|
401
401
|
i.push(f === U.Remove ? { op: f, path: p } : { op: f, path: p, value: d }), s.push(f === U.Add ? { op: U.Remove, path: p } : f === U.Remove ? { op: U.Add, path: p, value: c } : { op: U.Replace, path: p, value: c });
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function $s({ original: t, copy: e }, n, r, i, s) {
|
|
405
405
|
let o = 0;
|
|
406
406
|
t.forEach((a) => {
|
|
407
407
|
if (!e.has(a)) {
|
|
@@ -438,17 +438,17 @@ function ut(t, e, n, r) {
|
|
|
438
438
|
switch (t.type) {
|
|
439
439
|
case 0:
|
|
440
440
|
case 2:
|
|
441
|
-
return $s(t, e, n, r, i);
|
|
442
|
-
case 1:
|
|
443
441
|
return xs(t, e, n, r, i);
|
|
442
|
+
case 1:
|
|
443
|
+
return Rs(t, e, n, r, i);
|
|
444
444
|
case 3:
|
|
445
|
-
return
|
|
445
|
+
return $s(t, e, n, r, i);
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
const kt = (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
|
+
}, an = {
|
|
452
452
|
get size() {
|
|
453
453
|
return te(k(this)).size;
|
|
454
454
|
},
|
|
@@ -457,7 +457,7 @@ const kt = (t, e, n = !1) => {
|
|
|
457
457
|
},
|
|
458
458
|
set(t, e) {
|
|
459
459
|
const n = k(this), r = te(n);
|
|
460
|
-
return (!r.has(t) || !ye(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e),
|
|
460
|
+
return (!r.has(t) || !ye(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), Un(n, t, e, ut)), this;
|
|
461
461
|
},
|
|
462
462
|
delete(t) {
|
|
463
463
|
if (!this.has(t))
|
|
@@ -485,7 +485,7 @@ const kt = (t, e, n = !1) => {
|
|
|
485
485
|
const r = k(this), i = te(r).get(t), s = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, i, ne)) === ne.mutable;
|
|
486
486
|
if (r.options.strict && kt(i, r.options, s), s || r.finalized || !ae(i, r.options) || i !== r.original.get(t))
|
|
487
487
|
return i;
|
|
488
|
-
const o =
|
|
488
|
+
const o = Mn.createDraft({
|
|
489
489
|
original: i,
|
|
490
490
|
parentDraft: r,
|
|
491
491
|
key: t,
|
|
@@ -529,7 +529,7 @@ const kt = (t, e, n = !1) => {
|
|
|
529
529
|
[vt]() {
|
|
530
530
|
return this.entries();
|
|
531
531
|
}
|
|
532
|
-
},
|
|
532
|
+
}, Ds = Reflect.ownKeys(an), wr = (t, e, { isValuesIterator: n }) => () => {
|
|
533
533
|
var r, i;
|
|
534
534
|
const s = e.next();
|
|
535
535
|
if (s.done)
|
|
@@ -538,7 +538,7 @@ const kt = (t, e, n = !1) => {
|
|
|
538
538
|
let a = t.setMap.get(o);
|
|
539
539
|
const u = k(a), c = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, a, ne)) === ne.mutable;
|
|
540
540
|
if (t.options.strict && kt(o, t.options, c), !c && !u && ae(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
541
|
-
const d =
|
|
541
|
+
const d = Mn.createDraft({
|
|
542
542
|
original: o,
|
|
543
543
|
parentDraft: t,
|
|
544
544
|
key: o,
|
|
@@ -565,7 +565,7 @@ const kt = (t, e, n = !1) => {
|
|
|
565
565
|
},
|
|
566
566
|
add(t) {
|
|
567
567
|
const e = k(this);
|
|
568
|
-
return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t),
|
|
568
|
+
return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Un(e, t, t, ut)), this;
|
|
569
569
|
},
|
|
570
570
|
delete(t) {
|
|
571
571
|
if (!this.has(t))
|
|
@@ -590,7 +590,7 @@ const kt = (t, e, n = !1) => {
|
|
|
590
590
|
const e = t.setMap.keys();
|
|
591
591
|
return {
|
|
592
592
|
[Symbol.iterator]: () => this.values(),
|
|
593
|
-
next:
|
|
593
|
+
next: wr(t, e, { isValuesIterator: !0 })
|
|
594
594
|
};
|
|
595
595
|
},
|
|
596
596
|
entries() {
|
|
@@ -599,7 +599,7 @@ const kt = (t, e, n = !1) => {
|
|
|
599
599
|
const e = t.setMap.keys();
|
|
600
600
|
return {
|
|
601
601
|
[Symbol.iterator]: () => this.entries(),
|
|
602
|
-
next:
|
|
602
|
+
next: wr(t, e, {
|
|
603
603
|
isValuesIterator: !1
|
|
604
604
|
})
|
|
605
605
|
};
|
|
@@ -640,13 +640,13 @@ Set.prototype.difference && Object.assign(Ct, {
|
|
|
640
640
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
|
|
641
641
|
}
|
|
642
642
|
});
|
|
643
|
-
const
|
|
643
|
+
const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
|
|
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];
|
|
647
|
-
if (s &&
|
|
647
|
+
if (s && yi.has(s))
|
|
648
648
|
return s;
|
|
649
|
-
if (e ===
|
|
649
|
+
if (e === fi)
|
|
650
650
|
return t;
|
|
651
651
|
let o;
|
|
652
652
|
if (t.options.mark) {
|
|
@@ -655,14 +655,14 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
|
|
|
655
655
|
return t.options.strict && kt(c, t.options, !0), c;
|
|
656
656
|
}
|
|
657
657
|
const a = te(t);
|
|
658
|
-
if (a instanceof Map &&
|
|
658
|
+
if (a instanceof Map && Ds.includes(e)) {
|
|
659
659
|
if (e === "size")
|
|
660
|
-
return Object.getOwnPropertyDescriptor(
|
|
661
|
-
const c =
|
|
660
|
+
return Object.getOwnPropertyDescriptor(an, "size").get.call(t.proxy);
|
|
661
|
+
const c = an[e];
|
|
662
662
|
if (c)
|
|
663
663
|
return c.bind(t.proxy);
|
|
664
664
|
}
|
|
665
|
-
if (a instanceof Set &&
|
|
665
|
+
if (a instanceof Set && Us.includes(e)) {
|
|
666
666
|
if (e === "size")
|
|
667
667
|
return Object.getOwnPropertyDescriptor(Ct, "size").get.call(t.proxy);
|
|
668
668
|
const c = Ct[e];
|
|
@@ -670,7 +670,7 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
|
|
|
670
670
|
return c.bind(t.proxy);
|
|
671
671
|
}
|
|
672
672
|
if (!nt(a, e)) {
|
|
673
|
-
const c =
|
|
673
|
+
const c = gr(a, e);
|
|
674
674
|
return c ? "value" in c ? c.value : (
|
|
675
675
|
// !case: support for getter
|
|
676
676
|
(i = c.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
|
|
@@ -680,7 +680,7 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
|
|
|
680
680
|
if (t.options.strict && kt(u, t.options), t.finalized || !ae(u, t.options))
|
|
681
681
|
return u;
|
|
682
682
|
if (u === Ht(t.original, e)) {
|
|
683
|
-
if (Q(t), t.copy[e] =
|
|
683
|
+
if (Q(t), t.copy[e] = Ln({
|
|
684
684
|
original: t.original[e],
|
|
685
685
|
parentDraft: t,
|
|
686
686
|
key: t.type === 1 ? Number(e) : e,
|
|
@@ -701,11 +701,11 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
|
|
|
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 =
|
|
704
|
+
const s = gr(te(t), e);
|
|
705
705
|
if (s != null && s.set)
|
|
706
706
|
return s.set.call(t.proxy, n), !0;
|
|
707
707
|
const o = Ht(te(t), e), a = k(o);
|
|
708
|
-
return a && ye(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) : (ye(n, o) && (n !== void 0 || nt(t.original, e)) || (Q(t), fe(t), nt(t.original, e) && ye(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n,
|
|
708
|
+
return a && ye(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) : (ye(n, o) && (n !== void 0 || nt(t.original, e)) || (Q(t), fe(t), nt(t.original, e) && ye(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, Un(t, e, n, ut)), !0);
|
|
709
709
|
},
|
|
710
710
|
has(t, e) {
|
|
711
711
|
return e in te(t);
|
|
@@ -733,10 +733,10 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
|
|
|
733
733
|
},
|
|
734
734
|
deleteProperty(t, e) {
|
|
735
735
|
var n;
|
|
736
|
-
return t.type === 1 ?
|
|
736
|
+
return t.type === 1 ? bi.set.call(this, t, e, void 0, t.proxy) : (Ht(t.original, e) !== void 0 || e in t.original ? (Q(t), fe(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
|
|
737
737
|
}
|
|
738
738
|
};
|
|
739
|
-
function
|
|
739
|
+
function Ln(t) {
|
|
740
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,
|
|
@@ -750,8 +750,8 @@ function Fn(t) {
|
|
|
750
750
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
751
751
|
};
|
|
752
752
|
(r || "key" in t) && (a.key = r);
|
|
753
|
-
const { proxy: u, revoke: c } = Proxy.revocable(o === 1 ? Object.assign([], a) : a,
|
|
754
|
-
if (i.revoke.push(c),
|
|
753
|
+
const { proxy: u, revoke: c } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, bi);
|
|
754
|
+
if (i.revoke.push(c), yi.add(u), a.proxy = u, n) {
|
|
755
755
|
const d = n;
|
|
756
756
|
d.finalities.draft.push((f, l) => {
|
|
757
757
|
var p, y;
|
|
@@ -760,7 +760,7 @@ function Fn(t) {
|
|
|
760
760
|
const w = be(_, r), g = k(w);
|
|
761
761
|
if (g) {
|
|
762
762
|
let m = g.original;
|
|
763
|
-
g.operated && (m =
|
|
763
|
+
g.operated && (m = $n(w)), sn(g), on(g, ut, 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)), ct(_, r, m);
|
|
764
764
|
}
|
|
765
765
|
(y = b.callbacks) === null || y === void 0 || y.forEach((m) => {
|
|
766
766
|
m(f, l);
|
|
@@ -769,26 +769,26 @@ function Fn(t) {
|
|
|
769
769
|
} else {
|
|
770
770
|
const d = k(u);
|
|
771
771
|
d.finalities.draft.push((f, l) => {
|
|
772
|
-
|
|
772
|
+
sn(d), on(d, ut, f, l);
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
775
|
return u;
|
|
776
776
|
}
|
|
777
|
-
|
|
778
|
-
function
|
|
777
|
+
Mn.createDraft = Ln;
|
|
778
|
+
function Ls(t, e, n, r, i) {
|
|
779
779
|
var s;
|
|
780
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);
|
|
784
784
|
const c = u ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
785
|
-
return o &&
|
|
785
|
+
return o && rn(o), i && Me(c, c, o == null ? void 0 : o.options.updatedValues), [
|
|
786
786
|
c,
|
|
787
787
|
n && u ? [{ op: U.Replace, path: [], value: e[0] }] : n,
|
|
788
788
|
r && u ? [{ op: U.Replace, path: [], value: a }] : r
|
|
789
789
|
];
|
|
790
790
|
}
|
|
791
|
-
function
|
|
791
|
+
function Fs(t, e) {
|
|
792
792
|
var n;
|
|
793
793
|
const r = {
|
|
794
794
|
draft: [],
|
|
@@ -797,7 +797,7 @@ function Ns(t, e) {
|
|
|
797
797
|
};
|
|
798
798
|
let i, s;
|
|
799
799
|
e.enablePatches && (i = [], s = []);
|
|
800
|
-
const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, ne)) === ne.mutable || !ae(t, e) ? t :
|
|
800
|
+
const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, ne)) === ne.mutable || !ae(t, e) ? t : Ln({
|
|
801
801
|
original: t,
|
|
802
802
|
parentDraft: null,
|
|
803
803
|
finalities: r,
|
|
@@ -806,14 +806,14 @@ function Ns(t, e) {
|
|
|
806
806
|
return [
|
|
807
807
|
a,
|
|
808
808
|
(u = []) => {
|
|
809
|
-
const [c, d, f] =
|
|
809
|
+
const [c, d, f] = Ls(a, u, i, s, e.enableAutoFreeze);
|
|
810
810
|
return e.enablePatches ? [c, d, f] : c;
|
|
811
811
|
}
|
|
812
812
|
];
|
|
813
813
|
}
|
|
814
|
-
function
|
|
814
|
+
function un(t) {
|
|
815
815
|
const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: i = !0 } = t;
|
|
816
|
-
|
|
816
|
+
Dn(n, (s, o, a) => {
|
|
817
817
|
const u = k(o);
|
|
818
818
|
if (u && e && u.finalities === e.finalities) {
|
|
819
819
|
t.isContainDraft = !0;
|
|
@@ -823,10 +823,10 @@ function cn(t) {
|
|
|
823
823
|
a.clear(), d.forEach((f) => a.add(s === f ? c : f));
|
|
824
824
|
} else
|
|
825
825
|
ct(a, s, c);
|
|
826
|
-
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1,
|
|
826
|
+
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, un(t));
|
|
827
827
|
}), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
828
828
|
}
|
|
829
|
-
function
|
|
829
|
+
function _i(t) {
|
|
830
830
|
var e;
|
|
831
831
|
const n = k(t);
|
|
832
832
|
if (!ae(t, n == null ? void 0 : n.options))
|
|
@@ -836,7 +836,7 @@ function gi(t) {
|
|
|
836
836
|
return n.original;
|
|
837
837
|
let i;
|
|
838
838
|
function s() {
|
|
839
|
-
i = r === 2 ?
|
|
839
|
+
i = r === 2 ? xn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : hi(t, n == null ? void 0 : n.options);
|
|
840
840
|
}
|
|
841
841
|
if (n) {
|
|
842
842
|
n.finalized = !0;
|
|
@@ -847,23 +847,23 @@ function gi(t) {
|
|
|
847
847
|
}
|
|
848
848
|
} else
|
|
849
849
|
i = t;
|
|
850
|
-
if (
|
|
850
|
+
if (Dn(i, (o, a) => {
|
|
851
851
|
if (n && ye(be(n.original, o), a))
|
|
852
852
|
return;
|
|
853
|
-
const u =
|
|
853
|
+
const u = _i(a);
|
|
854
854
|
u !== a && (i === t && s(), ct(i, o, u));
|
|
855
855
|
}), r === 3) {
|
|
856
856
|
const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : i;
|
|
857
|
-
return
|
|
857
|
+
return Rn(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
|
|
858
858
|
}
|
|
859
859
|
return i;
|
|
860
860
|
}
|
|
861
|
-
function
|
|
861
|
+
function mr(t) {
|
|
862
862
|
if (!ke(t))
|
|
863
863
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
864
|
-
return
|
|
864
|
+
return _i(t);
|
|
865
865
|
}
|
|
866
|
-
const
|
|
866
|
+
const Ns = (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, ...I) {
|
|
@@ -874,7 +874,7 @@ const Ks = (t) => function e(n, r, 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 = ke(u) ?
|
|
877
|
+
const f = ke(u) ? mr(u) : u, l = Array.isArray(d.mark) ? (S, I) => {
|
|
878
878
|
for (const x of d.mark) {
|
|
879
879
|
if (typeof x != "function")
|
|
880
880
|
throw new Error(`Invalid mark: ${x}, 'mark' should be a function.`);
|
|
@@ -890,7 +890,7 @@ const Ks = (t) => function e(n, r, i) {
|
|
|
890
890
|
};
|
|
891
891
|
if (!ae(f, _) && typeof f == "object" && f !== null)
|
|
892
892
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
893
|
-
const [w, g] =
|
|
893
|
+
const [w, g] = Fs(f, _);
|
|
894
894
|
if (typeof r != "function") {
|
|
895
895
|
if (!ae(f, _))
|
|
896
896
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
@@ -900,24 +900,24 @@ const Ks = (t) => function e(n, r, i) {
|
|
|
900
900
|
try {
|
|
901
901
|
m = c(w);
|
|
902
902
|
} catch (S) {
|
|
903
|
-
throw
|
|
903
|
+
throw rn(k(w)), S;
|
|
904
904
|
}
|
|
905
905
|
const E = (S) => {
|
|
906
906
|
const I = k(w);
|
|
907
907
|
if (!ke(S)) {
|
|
908
908
|
if (S !== void 0 && !ye(S, w) && (I != null && I.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 B = S == null ? void 0 : S[
|
|
910
|
+
const B = S == null ? void 0 : S[ks];
|
|
911
911
|
if (B) {
|
|
912
912
|
const Ve = B[0];
|
|
913
|
-
return _.strict && typeof S == "object" && S !== null &&
|
|
913
|
+
return _.strict && typeof S == "object" && S !== null && un({
|
|
914
914
|
rootDraft: I,
|
|
915
915
|
value: S,
|
|
916
916
|
useRawReturn: !0
|
|
917
917
|
}), g([Ve]);
|
|
918
918
|
}
|
|
919
919
|
if (S !== void 0)
|
|
920
|
-
return typeof S == "object" && S !== null &&
|
|
920
|
+
return typeof S == "object" && S !== null && un({ rootDraft: I, value: S }), g([S]);
|
|
921
921
|
}
|
|
922
922
|
if (S === w || S === void 0)
|
|
923
923
|
return g([]);
|
|
@@ -925,26 +925,26 @@ const Ks = (t) => function e(n, r, i) {
|
|
|
925
925
|
if (_ === x.options) {
|
|
926
926
|
if (x.operated)
|
|
927
927
|
throw new Error("Cannot return a modified child draft.");
|
|
928
|
-
return g([
|
|
928
|
+
return g([mr(S)]);
|
|
929
929
|
}
|
|
930
930
|
return g([S]);
|
|
931
931
|
};
|
|
932
932
|
return m instanceof Promise ? m.then(E, (S) => {
|
|
933
|
-
throw
|
|
933
|
+
throw rn(k(w)), S;
|
|
934
934
|
}) : E(m);
|
|
935
|
-
}, Pt =
|
|
935
|
+
}, Pt = Ns();
|
|
936
936
|
Object.prototype.constructor.toString();
|
|
937
|
-
function
|
|
937
|
+
function gi(t, e) {
|
|
938
938
|
const n = Object.keys(t), r = Object.keys(e);
|
|
939
939
|
return n.length === r.length && Object.keys(t).every((i) => e.hasOwnProperty(i));
|
|
940
940
|
}
|
|
941
|
-
function
|
|
941
|
+
function vr(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
944
|
function Ot(t, e) {
|
|
945
|
-
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e :
|
|
945
|
+
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : gi(t, e) ? Object.keys(t).every((n) => Ot(t[n], e[n])) : !1;
|
|
946
946
|
}
|
|
947
|
-
function
|
|
947
|
+
function Fn(t) {
|
|
948
948
|
if (!Ze(t))
|
|
949
949
|
return t;
|
|
950
950
|
const e = {};
|
|
@@ -952,7 +952,7 @@ function Nn(t) {
|
|
|
952
952
|
r !== void 0 && (e[n] = r);
|
|
953
953
|
return e;
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function Ti(t, e) {
|
|
956
956
|
if (!Ze(t) || !Ze(e))
|
|
957
957
|
return e;
|
|
958
958
|
const n = Object.assign({}, t);
|
|
@@ -964,14 +964,14 @@ function wi(t, e) {
|
|
|
964
964
|
continue;
|
|
965
965
|
}
|
|
966
966
|
const i = Ze(t[r]) && Ze(e[r]);
|
|
967
|
-
n[r] = i ?
|
|
967
|
+
n[r] = i ? Ti(t[r], e[r]) : e[r];
|
|
968
968
|
}
|
|
969
969
|
return n;
|
|
970
970
|
}
|
|
971
971
|
function Ze(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 || {};
|
|
@@ -982,7 +982,7 @@ function qs(t, e, n) {
|
|
|
982
982
|
const i = e[e.length - 1];
|
|
983
983
|
Array.isArray(r) && typeof i == "number" ? r.splice(i, 0, n) : r[i] = n;
|
|
984
984
|
}
|
|
985
|
-
function
|
|
985
|
+
function Sr(t, e, n) {
|
|
986
986
|
if (!t || e.length === 0)
|
|
987
987
|
return;
|
|
988
988
|
let r = t || {};
|
|
@@ -992,7 +992,7 @@ function Or(t, e, n) {
|
|
|
992
992
|
}
|
|
993
993
|
r[e[e.length - 1]] = n;
|
|
994
994
|
}
|
|
995
|
-
function
|
|
995
|
+
function wi(t, e) {
|
|
996
996
|
if (!t || e.length === 0)
|
|
997
997
|
return;
|
|
998
998
|
const [n, ...r] = e;
|
|
@@ -1001,13 +1001,13 @@ function mi(t, e) {
|
|
|
1001
1001
|
Array.isArray(t) ? t.splice(n, 1) : delete t[n];
|
|
1002
1002
|
return;
|
|
1003
1003
|
}
|
|
1004
|
-
|
|
1004
|
+
wi(t[n], r), qs(t[n]) && delete t[n];
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function qs(t) {
|
|
1008
1008
|
return t && Object.keys(t).length === 0;
|
|
1009
1009
|
}
|
|
1010
|
-
const
|
|
1010
|
+
const Or = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|WAST|WAKT|WADT|VUT|VOLT|VLAT|VLAST|VET|UZT|UZST|UYT|UYST|UTC|UT|ULAT|ULAST|UCT|TVT|TRUT|TOT|TMT|TKT|TJT|TFT|TAHT|SGT|SCT|SAST|SADT|RET|PYT|PYST|PWT|PST|PONT|PMST|PMDT|PKT|PKST|PHT|PGT|PETT|PETST|PET|PDT|OMST|OMSST|NZT|NZST|NZDT|NUT|NST|NPT|NOVT|NOVST|NFT|NDT|MYT|MVT|MUT|MUST|MST|MSK|MSD|MPT|MMT|MHT|MEZ|METDST|MET|MESZ|MEST|MDT|MAWT|MART|MAGT|MAGST|LKT|LINT|LIGT|LHST|LHDT|KST|KRAT|KRAST|KOST|KGT|KGST|KDT|JST|JAYT|IST|IRT|IRKT|IRKST|IOT|IDT|ICT|HST|HKT|GYT|GMT|GILT|GFT|GET|GEST|GAMT|GALT|FNT|FNST|FKT|FKST|FJT|FJST|FET|EST|EGT|EGST|EETDST|EET|EEST|EDT|EAT|EAST|EASST|DDUT|DAVT|CXT|CST|COT|CLT|CLST|CKT|CHUT|CHAST|CHADT|CETDST|CET|CEST|CDT|CCT|CAST|CADT|BTT|BST|BRT|BRST|BRA|BOT|BORT|BNT|BDT|BDST|AZT|AZST|AZOT|AZOST|AWST|AWSST|AST|ART|ARST|ANAT|ANAST|AMT|AMST|ALMT|ALMST|AKST|AKDT|AFT|AEST|AESST|AEDT|ADT|ACWST|ACT|ACST|ACSST|ACDT$/, Ws = {
|
|
1011
1011
|
ZULU: 0,
|
|
1012
1012
|
YEKT: 18e3,
|
|
1013
1013
|
YEKST: 21600,
|
|
@@ -1203,39 +1203,39 @@ const Er = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
|
|
|
1203
1203
|
ACSST: 37800,
|
|
1204
1204
|
ACDT: 37800
|
|
1205
1205
|
};
|
|
1206
|
-
function
|
|
1206
|
+
function zs(t) {
|
|
1207
1207
|
return new Date(t);
|
|
1208
1208
|
}
|
|
1209
|
-
function
|
|
1209
|
+
function Vs(t) {
|
|
1210
1210
|
return /* @__PURE__ */ new Date(t + "Z");
|
|
1211
1211
|
}
|
|
1212
|
-
const
|
|
1213
|
-
function
|
|
1214
|
-
const e = t.match(
|
|
1212
|
+
const Bs = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
|
|
1213
|
+
function Gs(t) {
|
|
1214
|
+
const e = t.match(Bs);
|
|
1215
1215
|
if (!e)
|
|
1216
1216
|
return null;
|
|
1217
1217
|
const [n, r, i, s] = e;
|
|
1218
1218
|
return r <= 0 || i <= 0 || s <= 0 ? null : r > 999 ? new Date(Date.UTC(r, i - 1, s, 0, 0, 0, 0)) : new Date(Date.UTC(s, r - 1, i, 0, 0, 0, 0));
|
|
1219
1219
|
}
|
|
1220
|
-
function
|
|
1220
|
+
function Qs(t) {
|
|
1221
1221
|
const [e, n] = t.split(" ");
|
|
1222
1222
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1223
1223
|
}
|
|
1224
|
-
function
|
|
1224
|
+
function Hs(t) {
|
|
1225
1225
|
const [e, n] = t.split(" ");
|
|
1226
1226
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1227
1227
|
}
|
|
1228
|
-
function
|
|
1228
|
+
function Ys(t) {
|
|
1229
1229
|
return new Date(t);
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1231
|
+
function Js(t) {
|
|
1232
1232
|
const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
|
|
1233
1233
|
if (!t.match(e))
|
|
1234
1234
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1235
1235
|
const r = /* @__PURE__ */ new Date(t + " UTC");
|
|
1236
1236
|
return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate(), 0, 0, 0, 0));
|
|
1237
1237
|
}
|
|
1238
|
-
function
|
|
1238
|
+
function Zs(t) {
|
|
1239
1239
|
const e = /^(.+T.+)([+-])(\d{2})$/, n = t.match(e);
|
|
1240
1240
|
if (n) {
|
|
1241
1241
|
const [, r, i, s] = n, o = `${r}${i}${s}:00`;
|
|
@@ -1243,7 +1243,7 @@ function Xs(t) {
|
|
|
1243
1243
|
}
|
|
1244
1244
|
return null;
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function Xs(t) {
|
|
1247
1247
|
const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, n = t.match(e);
|
|
1248
1248
|
if (n) {
|
|
1249
1249
|
const [, r, i, s, o, a] = n, u = i.padStart(2, "0"), c = s.padStart(2, "0"), d = `${r}-${u}-${c}T${a}`;
|
|
@@ -1251,14 +1251,14 @@ function eo(t) {
|
|
|
1251
1251
|
}
|
|
1252
1252
|
return null;
|
|
1253
1253
|
}
|
|
1254
|
-
function
|
|
1254
|
+
function eo(t) {
|
|
1255
1255
|
const [e, n] = t.split(", "), [r, i, s] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1256
1256
|
if (!o)
|
|
1257
1257
|
throw new Error(`Unable to parse time from: ${t}`);
|
|
1258
1258
|
let [, a, u, c, d] = o;
|
|
1259
1259
|
return a = Number(a), u = Number(u), c = Number(c), d === "PM" && a !== 12 ? a += 12 : d === "AM" && a === 12 && (a = 0), new Date(Date.UTC(s, r - 1, i, a, u, c));
|
|
1260
1260
|
}
|
|
1261
|
-
function
|
|
1261
|
+
function to(t) {
|
|
1262
1262
|
switch (t) {
|
|
1263
1263
|
case "epoch":
|
|
1264
1264
|
return /* @__PURE__ */ new Date(0);
|
|
@@ -1270,28 +1270,28 @@ function no(t) {
|
|
|
1270
1270
|
return null;
|
|
1271
1271
|
}
|
|
1272
1272
|
}
|
|
1273
|
-
function
|
|
1274
|
-
const e = t.match(
|
|
1273
|
+
function no(t) {
|
|
1274
|
+
const e = t.match(Or);
|
|
1275
1275
|
if (!e)
|
|
1276
1276
|
return null;
|
|
1277
|
-
const [n] = e, r =
|
|
1277
|
+
const [n] = e, r = Ws[n], i = new Date(t.replace(Or, "Z"));
|
|
1278
1278
|
return new Date(i.getTime() - r * 1e3);
|
|
1279
1279
|
}
|
|
1280
|
-
const
|
|
1281
|
-
|
|
1280
|
+
const ro = [
|
|
1281
|
+
Gs,
|
|
1282
|
+
Hs,
|
|
1283
|
+
Js,
|
|
1284
|
+
eo,
|
|
1282
1285
|
Ys,
|
|
1286
|
+
Vs,
|
|
1283
1287
|
Zs,
|
|
1288
|
+
Qs,
|
|
1289
|
+
zs,
|
|
1284
1290
|
to,
|
|
1285
|
-
Js,
|
|
1286
|
-
Bs,
|
|
1287
|
-
Xs,
|
|
1288
|
-
Hs,
|
|
1289
|
-
Vs,
|
|
1290
1291
|
no,
|
|
1291
|
-
|
|
1292
|
-
eo
|
|
1292
|
+
Xs
|
|
1293
1293
|
];
|
|
1294
|
-
function
|
|
1294
|
+
function io(t, e) {
|
|
1295
1295
|
try {
|
|
1296
1296
|
const n = t(e);
|
|
1297
1297
|
return n instanceof Date && !isNaN(n.getTime()) ? n : null;
|
|
@@ -1299,18 +1299,18 @@ function so(t, e) {
|
|
|
1299
1299
|
return null;
|
|
1300
1300
|
}
|
|
1301
1301
|
}
|
|
1302
|
-
function
|
|
1303
|
-
for (const e of
|
|
1304
|
-
const n =
|
|
1302
|
+
function cn(t) {
|
|
1303
|
+
for (const e of ro) {
|
|
1304
|
+
const n = io(e, t);
|
|
1305
1305
|
if (n)
|
|
1306
1306
|
return n;
|
|
1307
1307
|
}
|
|
1308
1308
|
return null;
|
|
1309
1309
|
}
|
|
1310
|
-
function
|
|
1310
|
+
function so(t) {
|
|
1311
1311
|
try {
|
|
1312
1312
|
const e = JSON.parse(t);
|
|
1313
|
-
return typeof e == "string" ?
|
|
1313
|
+
return typeof e == "string" ? cn(e) : null;
|
|
1314
1314
|
} catch {
|
|
1315
1315
|
return null;
|
|
1316
1316
|
}
|
|
@@ -1322,7 +1322,7 @@ function xt(t) {
|
|
|
1322
1322
|
if (t instanceof Date)
|
|
1323
1323
|
return t;
|
|
1324
1324
|
if (typeof t == "string") {
|
|
1325
|
-
const e =
|
|
1325
|
+
const e = cn(t) || so(t) || cn(t.trim());
|
|
1326
1326
|
if (!e)
|
|
1327
1327
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1328
1328
|
return e;
|
|
@@ -1331,13 +1331,13 @@ function xt(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
|
-
function
|
|
1334
|
+
function oo(t) {
|
|
1335
1335
|
return t.cardinality === "one";
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1337
|
+
function Nn(t) {
|
|
1338
1338
|
return t["value-type"] === "ref";
|
|
1339
1339
|
}
|
|
1340
|
-
function
|
|
1340
|
+
function Kn(t) {
|
|
1341
1341
|
return t["value-type"] === "blob";
|
|
1342
1342
|
}
|
|
1343
1343
|
function qe(t, e) {
|
|
@@ -1367,7 +1367,7 @@ function Z(t, e, n) {
|
|
|
1367
1367
|
let s = t.get(r);
|
|
1368
1368
|
s || (s = /* @__PURE__ */ new Map(), t.set(r, s)), Z(s, i, n);
|
|
1369
1369
|
}
|
|
1370
|
-
function
|
|
1370
|
+
function mi(t, e, n) {
|
|
1371
1371
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
1372
1372
|
for (const o of e) {
|
|
1373
1373
|
let [a, u, c, d] = o;
|
|
@@ -1376,22 +1376,22 @@ function vi(t, e, n) {
|
|
|
1376
1376
|
console.warn("no such attr", a, t);
|
|
1377
1377
|
continue;
|
|
1378
1378
|
}
|
|
1379
|
-
f["checked-data-type"] === "date" && n && (c = xt(c), o[2] = c),
|
|
1379
|
+
f["checked-data-type"] === "date" && n && (c = xt(c), o[2] = c), Nn(f) && Z(s, [c, u, a], o), Z(r, [a, u, c], o), Z(i, [u, a, c], o);
|
|
1380
1380
|
}
|
|
1381
1381
|
return { eav: r, aev: i, vae: s };
|
|
1382
1382
|
}
|
|
1383
|
-
function
|
|
1383
|
+
function vi(t) {
|
|
1384
1384
|
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
1385
1385
|
for (const s of Object.values(t)) {
|
|
1386
1386
|
const o = s["forward-identity"], [a, u, c] = o, d = s["reverse-identity"];
|
|
1387
|
-
if (Z(r, [u, c], s),
|
|
1387
|
+
if (Z(r, [u, c], s), Kn(s) && Z(e, [u, c], s), s["primary?"] && Z(n, [u], s), d) {
|
|
1388
1388
|
const [f, l, p] = d;
|
|
1389
1389
|
Z(i, [l, p], s);
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
1392
|
return { blobAttrs: e, primaryKeys: n, forwardIdents: r, revIdents: i };
|
|
1393
1393
|
}
|
|
1394
|
-
function
|
|
1394
|
+
function Si(t) {
|
|
1395
1395
|
return {
|
|
1396
1396
|
__type: t.__type,
|
|
1397
1397
|
attrs: t.attrs,
|
|
@@ -1401,18 +1401,18 @@ function Oi(t) {
|
|
|
1401
1401
|
useDateObjects: t.useDateObjects
|
|
1402
1402
|
};
|
|
1403
1403
|
}
|
|
1404
|
-
function
|
|
1404
|
+
function Oi(t) {
|
|
1405
1405
|
return Et(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
|
|
1406
1406
|
}
|
|
1407
|
-
function
|
|
1407
|
+
function ao(t, e) {
|
|
1408
1408
|
return We(t.eav, [e]) !== void 0;
|
|
1409
1409
|
}
|
|
1410
|
-
function
|
|
1411
|
-
t.attrIndexes =
|
|
1410
|
+
function qn(t) {
|
|
1411
|
+
t.attrIndexes = vi(t.attrs);
|
|
1412
1412
|
}
|
|
1413
1413
|
function Et(t, e, n, r, i) {
|
|
1414
|
-
const s =
|
|
1415
|
-
return s.useDateObjects = i, s.attrs = t, s.attrIndexes =
|
|
1414
|
+
const s = mi(t, e, i);
|
|
1415
|
+
return s.useDateObjects = i, s.attrs = t, s.attrIndexes = vi(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
|
|
1416
1416
|
}
|
|
1417
1417
|
function dt(t, e) {
|
|
1418
1418
|
var n, r;
|
|
@@ -1441,21 +1441,21 @@ function dt(t, e) {
|
|
|
1441
1441
|
return [i, ...a];
|
|
1442
1442
|
}
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1444
|
+
function Ei(t, e) {
|
|
1445
1445
|
const n = dt(t, e);
|
|
1446
1446
|
if (!n)
|
|
1447
1447
|
return;
|
|
1448
1448
|
const [r, i, s] = n, o = qe(t.attrs, i);
|
|
1449
|
-
o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]),
|
|
1449
|
+
o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]), Nn(o) && oe(t.vae, [s, i, r]));
|
|
1450
1450
|
}
|
|
1451
|
-
let
|
|
1452
|
-
function
|
|
1451
|
+
let uo = 0;
|
|
1452
|
+
function Ai(t, e, n) {
|
|
1453
1453
|
const [r, i, s] = n;
|
|
1454
1454
|
let o;
|
|
1455
1455
|
const a = We(t.eav, [r, i, s]);
|
|
1456
|
-
return a && (o = a[3]), o || Date.now() * 10 +
|
|
1456
|
+
return a && (o = a[3]), o || Date.now() * 10 + uo++;
|
|
1457
1457
|
}
|
|
1458
|
-
function
|
|
1458
|
+
function ji(t, e) {
|
|
1459
1459
|
var n;
|
|
1460
1460
|
const r = dt(t, e);
|
|
1461
1461
|
if (!r)
|
|
@@ -1465,10 +1465,10 @@ function ki(t, e) {
|
|
|
1465
1465
|
if (!a)
|
|
1466
1466
|
return;
|
|
1467
1467
|
a["checked-data-type"] === "date" && t.useDateObjects && (o = xt(o));
|
|
1468
|
-
const u = We(t.eav, [i, s, o]), c = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n :
|
|
1469
|
-
|
|
1468
|
+
const u = We(t.eav, [i, s, o]), c = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n : Ai(t, a, r), d = [i, s, o, c];
|
|
1469
|
+
oo(a) ? (Z(t.eav, [i, s], /* @__PURE__ */ new Map([[o, d]])), Z(t.aev, [s, i], /* @__PURE__ */ new Map([[o, d]]))) : (Z(t.eav, [i, s, o], d), Z(t.aev, [s, i, o], d)), Nn(a) && Z(t.vae, [o, s, i], d);
|
|
1470
1470
|
}
|
|
1471
|
-
function
|
|
1471
|
+
function co(t, e) {
|
|
1472
1472
|
var n;
|
|
1473
1473
|
const r = dt(t, e);
|
|
1474
1474
|
if (!r)
|
|
@@ -1476,7 +1476,7 @@ function fo(t, e) {
|
|
|
1476
1476
|
const [i, s, o] = r, a = qe(t.attrs, s);
|
|
1477
1477
|
if (!a)
|
|
1478
1478
|
return;
|
|
1479
|
-
if (!
|
|
1479
|
+
if (!Kn(a))
|
|
1480
1480
|
throw new Error("merge operation is not supported for links");
|
|
1481
1481
|
const u = We(t.eav, [i, s]);
|
|
1482
1482
|
if (!u)
|
|
@@ -1484,15 +1484,15 @@ function fo(t, e) {
|
|
|
1484
1484
|
const c = (n = u.values().next()) === null || n === void 0 ? void 0 : n.value;
|
|
1485
1485
|
if (!c)
|
|
1486
1486
|
return;
|
|
1487
|
-
const d = c[2], f =
|
|
1487
|
+
const d = c[2], f = Ti(d, o), l = [
|
|
1488
1488
|
i,
|
|
1489
1489
|
s,
|
|
1490
1490
|
f,
|
|
1491
|
-
|
|
1491
|
+
Ai(t, a, c)
|
|
1492
1492
|
];
|
|
1493
1493
|
Z(t.eav, [i, s], /* @__PURE__ */ new Map([[f, l]]));
|
|
1494
1494
|
}
|
|
1495
|
-
function
|
|
1495
|
+
function dn(t, e) {
|
|
1496
1496
|
var n, r;
|
|
1497
1497
|
const [i, s] = e, o = dt(t, [i]);
|
|
1498
1498
|
if (!o)
|
|
@@ -1503,7 +1503,7 @@ function fn(t, e) {
|
|
|
1503
1503
|
const f = t.attrs[d];
|
|
1504
1504
|
f && f["on-delete-reverse"] === "cascade" && X(u.get(d), 1).forEach(([l, p, y]) => {
|
|
1505
1505
|
var b;
|
|
1506
|
-
return
|
|
1506
|
+
return dn(t, [y, (b = f["reverse-identity"]) === null || b === void 0 ? void 0 : b[1]]);
|
|
1507
1507
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
1508
1508
|
// the store that didn't set `etype` in deleteEntity
|
|
1509
1509
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
@@ -1516,54 +1516,54 @@ function fn(t, e) {
|
|
|
1516
1516
|
c && c.forEach((d) => {
|
|
1517
1517
|
var f, l, p;
|
|
1518
1518
|
const [y, b, _] = d, w = t.attrs[b];
|
|
1519
|
-
(!s || !w || ((f = w["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (oe(t.eav, [y, b, _]), oe(t.aev, [b, y, _]), oe(t.vae, [_, b, y])), w && w["on-delete"] === "cascade" && ((l = w["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s &&
|
|
1519
|
+
(!s || !w || ((f = w["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (oe(t.eav, [y, b, _]), oe(t.aev, [b, y, _]), oe(t.vae, [_, b, y])), w && w["on-delete"] === "cascade" && ((l = w["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && dn(t, [y, (p = w["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
|
|
1520
1520
|
}), ((r = t.vae.get(a)) === null || r === void 0 ? void 0 : r.size) === 0 && oe(t.vae, [a]);
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1523
|
-
const n =
|
|
1522
|
+
function ki(t, e) {
|
|
1523
|
+
const n = mi(t.attrs, e, t.useDateObjects);
|
|
1524
1524
|
Object.keys(n).forEach((r) => {
|
|
1525
1525
|
t[r] = n[r];
|
|
1526
1526
|
});
|
|
1527
1527
|
}
|
|
1528
|
-
function
|
|
1529
|
-
t.attrs[e.id] = e,
|
|
1528
|
+
function fo(t, [e]) {
|
|
1529
|
+
t.attrs[e.id] = e, qn(t);
|
|
1530
1530
|
}
|
|
1531
|
-
function
|
|
1531
|
+
function Ci(t) {
|
|
1532
1532
|
return X(t.eav, 3);
|
|
1533
1533
|
}
|
|
1534
|
-
function
|
|
1534
|
+
function lo(t, [e]) {
|
|
1535
1535
|
if (!t.attrs[e])
|
|
1536
1536
|
return;
|
|
1537
|
-
const n =
|
|
1538
|
-
delete t.attrs[e],
|
|
1537
|
+
const n = Ci(t).filter(([r, i]) => i !== e);
|
|
1538
|
+
delete t.attrs[e], qn(t), ki(t, n);
|
|
1539
1539
|
}
|
|
1540
|
-
function
|
|
1540
|
+
function ho(t, [e]) {
|
|
1541
1541
|
const n = t.attrs[e.id];
|
|
1542
|
-
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e),
|
|
1542
|
+
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), qn(t), ki(t, Ci(t)));
|
|
1543
1543
|
}
|
|
1544
|
-
function
|
|
1544
|
+
function po(t, e) {
|
|
1545
1545
|
const [n, ...r] = e;
|
|
1546
1546
|
switch (n) {
|
|
1547
1547
|
case "add-triple":
|
|
1548
|
-
|
|
1548
|
+
ji(t, r);
|
|
1549
1549
|
break;
|
|
1550
1550
|
case "deep-merge-triple":
|
|
1551
|
-
|
|
1551
|
+
co(t, r);
|
|
1552
1552
|
break;
|
|
1553
1553
|
case "retract-triple":
|
|
1554
|
-
|
|
1554
|
+
Ei(t, r);
|
|
1555
1555
|
break;
|
|
1556
1556
|
case "delete-entity":
|
|
1557
|
-
|
|
1557
|
+
dn(t, r);
|
|
1558
1558
|
break;
|
|
1559
1559
|
case "add-attr":
|
|
1560
|
-
|
|
1560
|
+
fo(t, r);
|
|
1561
1561
|
break;
|
|
1562
1562
|
case "delete-attr":
|
|
1563
|
-
|
|
1563
|
+
lo(t, r);
|
|
1564
1564
|
break;
|
|
1565
1565
|
case "update-attr":
|
|
1566
|
-
|
|
1566
|
+
ho(t, r);
|
|
1567
1567
|
break;
|
|
1568
1568
|
case "restore-attr":
|
|
1569
1569
|
break;
|
|
@@ -1618,13 +1618,13 @@ function gt(t, e, n) {
|
|
|
1618
1618
|
}
|
|
1619
1619
|
return i;
|
|
1620
1620
|
}
|
|
1621
|
-
function
|
|
1621
|
+
function yo(t, e, n) {
|
|
1622
1622
|
let r = "";
|
|
1623
1623
|
return t !== void 0 && (r += "e"), e !== void 0 && (r += "a"), n !== void 0 && (r += "v"), r;
|
|
1624
1624
|
}
|
|
1625
|
-
function
|
|
1625
|
+
function bo(t, [e, n, r]) {
|
|
1626
1626
|
var i, s;
|
|
1627
|
-
switch (
|
|
1627
|
+
switch (yo(e, n, r)) {
|
|
1628
1628
|
case "e": {
|
|
1629
1629
|
const a = t.eav.get(e);
|
|
1630
1630
|
return X(a, 2);
|
|
@@ -1670,11 +1670,8 @@ function _o(t, [e, n, r]) {
|
|
|
1670
1670
|
return X(t.eav, 3);
|
|
1671
1671
|
}
|
|
1672
1672
|
}
|
|
1673
|
-
|
|
1674
|
-
function go(t, e, n) {
|
|
1673
|
+
function _o(t, e, n) {
|
|
1675
1674
|
var r;
|
|
1676
|
-
if (Yt[n])
|
|
1677
|
-
return Yt[n];
|
|
1678
1675
|
const i = {};
|
|
1679
1676
|
if (!e)
|
|
1680
1677
|
return i;
|
|
@@ -1683,25 +1680,25 @@ function go(t, e, n) {
|
|
|
1683
1680
|
for (const c of u)
|
|
1684
1681
|
i[s] = c[2];
|
|
1685
1682
|
}
|
|
1686
|
-
return
|
|
1683
|
+
return i;
|
|
1687
1684
|
}
|
|
1688
1685
|
function Te(t, e, n) {
|
|
1689
1686
|
var r;
|
|
1690
1687
|
return (r = t.attrIndexes.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
1691
1688
|
}
|
|
1692
|
-
function
|
|
1689
|
+
function Pi(t, e, n) {
|
|
1693
1690
|
var r;
|
|
1694
1691
|
return (r = t.attrIndexes.revIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
1695
1692
|
}
|
|
1696
|
-
function
|
|
1693
|
+
function go(t, e) {
|
|
1697
1694
|
return t.attrIndexes.blobAttrs.get(e);
|
|
1698
1695
|
}
|
|
1699
|
-
function
|
|
1696
|
+
function Ii(t, e) {
|
|
1700
1697
|
var n;
|
|
1701
1698
|
const r = t.attrIndexes.primaryKeys.get(e);
|
|
1702
1699
|
return r || ((n = t.attrIndexes.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
|
|
1703
1700
|
}
|
|
1704
|
-
function
|
|
1701
|
+
function To(t, e) {
|
|
1705
1702
|
const n = dt(t, e);
|
|
1706
1703
|
if (!n)
|
|
1707
1704
|
return;
|
|
@@ -1709,7 +1706,7 @@ function wo(t, e) {
|
|
|
1709
1706
|
if (qe(t.attrs, i))
|
|
1710
1707
|
return We(t.eav, [r, i]);
|
|
1711
1708
|
}
|
|
1712
|
-
function
|
|
1709
|
+
function wo(t, e) {
|
|
1713
1710
|
const n = e.filter(([r, i, s, o, a]) => {
|
|
1714
1711
|
if (r !== "add-triple" && r !== "deep-merge-triple")
|
|
1715
1712
|
return !0;
|
|
@@ -1719,8 +1716,8 @@ function mo(t, e) {
|
|
|
1719
1716
|
let c = !1;
|
|
1720
1717
|
const d = qe(t.attrs, s);
|
|
1721
1718
|
if (d) {
|
|
1722
|
-
const f =
|
|
1723
|
-
c = !!
|
|
1719
|
+
const f = Ii(t, d["forward-identity"][1]);
|
|
1720
|
+
c = !!To(t, [
|
|
1724
1721
|
i,
|
|
1725
1722
|
f == null ? void 0 : f.id,
|
|
1726
1723
|
i
|
|
@@ -1730,32 +1727,32 @@ function mo(t, e) {
|
|
|
1730
1727
|
});
|
|
1731
1728
|
return Pt(t, (r) => {
|
|
1732
1729
|
n.forEach((i) => {
|
|
1733
|
-
|
|
1730
|
+
po(r, i);
|
|
1734
1731
|
});
|
|
1735
1732
|
});
|
|
1736
1733
|
}
|
|
1737
|
-
function
|
|
1734
|
+
function mo(t) {
|
|
1738
1735
|
return typeof t == "string" && t.startsWith("?");
|
|
1739
1736
|
}
|
|
1740
|
-
function
|
|
1737
|
+
function vo(t, e, n) {
|
|
1741
1738
|
if (n.hasOwnProperty(t)) {
|
|
1742
1739
|
const r = n[t];
|
|
1743
|
-
return
|
|
1740
|
+
return Mi(r, e, n);
|
|
1744
1741
|
}
|
|
1745
1742
|
return Object.assign(Object.assign({}, n), { [t]: e });
|
|
1746
1743
|
}
|
|
1747
|
-
function
|
|
1744
|
+
function Er(t, e, n) {
|
|
1748
1745
|
return t === e ? n : null;
|
|
1749
1746
|
}
|
|
1750
|
-
function
|
|
1747
|
+
function So(t) {
|
|
1751
1748
|
switch (typeof t) {
|
|
1752
1749
|
case "string":
|
|
1753
|
-
return t.startsWith("?") ?
|
|
1750
|
+
return t.startsWith("?") ? vo : Er;
|
|
1754
1751
|
default:
|
|
1755
|
-
return
|
|
1752
|
+
return Er;
|
|
1756
1753
|
}
|
|
1757
1754
|
}
|
|
1758
|
-
const
|
|
1755
|
+
const Oo = [
|
|
1759
1756
|
"in",
|
|
1760
1757
|
"$in",
|
|
1761
1758
|
"$not",
|
|
@@ -1763,77 +1760,77 @@ const Eo = [
|
|
|
1763
1760
|
"$comparator"
|
|
1764
1761
|
// covers all of $gt, $lt, etc.
|
|
1765
1762
|
];
|
|
1766
|
-
function
|
|
1767
|
-
for (const e of
|
|
1763
|
+
function Eo(t) {
|
|
1764
|
+
for (const e of Oo)
|
|
1768
1765
|
if (t.hasOwnProperty(e))
|
|
1769
1766
|
return !0;
|
|
1770
1767
|
return !1;
|
|
1771
1768
|
}
|
|
1772
|
-
function
|
|
1773
|
-
return n ? typeof t == "object" ?
|
|
1769
|
+
function Mi(t, e, n) {
|
|
1770
|
+
return n ? typeof t == "object" ? Eo(t) ? n : null : So(t)(t, e, n) : null;
|
|
1774
1771
|
}
|
|
1775
|
-
function
|
|
1772
|
+
function Ao(t, e, n) {
|
|
1776
1773
|
return t.reduce((r, i, s) => {
|
|
1777
1774
|
const o = e[s];
|
|
1778
|
-
return
|
|
1775
|
+
return Mi(i, o, r);
|
|
1779
1776
|
}, n);
|
|
1780
1777
|
}
|
|
1781
|
-
function
|
|
1782
|
-
return
|
|
1778
|
+
function jo(t, e, n) {
|
|
1779
|
+
return Po(t, e, n).map((r) => Ao(e, r, n)).filter((r) => r);
|
|
1783
1780
|
}
|
|
1784
|
-
function
|
|
1785
|
-
return e.or ? e.or.patterns.flatMap((r) =>
|
|
1781
|
+
function ko(t, e, n) {
|
|
1782
|
+
return e.or ? e.or.patterns.flatMap((r) => fn(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => fn(t, i, r), n) : n.flatMap((r) => jo(t, e, r));
|
|
1786
1783
|
}
|
|
1787
|
-
function
|
|
1788
|
-
return e.reduce((r, i) =>
|
|
1784
|
+
function fn(t, e, n = [{}]) {
|
|
1785
|
+
return e.reduce((r, i) => ko(t, i, r), n);
|
|
1789
1786
|
}
|
|
1790
|
-
function
|
|
1791
|
-
return Array.isArray(e) ? e.map((n) =>
|
|
1787
|
+
function Wn(t, e) {
|
|
1788
|
+
return Array.isArray(e) ? e.map((n) => Wn(t, n)) : mo(e) ? t[e] : e;
|
|
1792
1789
|
}
|
|
1793
|
-
function
|
|
1794
|
-
return
|
|
1790
|
+
function Co(t, { find: e, where: n }) {
|
|
1791
|
+
return fn(t, n).map((i) => Wn(i, e));
|
|
1795
1792
|
}
|
|
1796
|
-
function
|
|
1797
|
-
return
|
|
1793
|
+
function Po(t, e, n) {
|
|
1794
|
+
return bo(t, Wn(n, e));
|
|
1798
1795
|
}
|
|
1799
|
-
const
|
|
1796
|
+
const Io = /^(?:[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;
|
|
1800
1797
|
function Fe(t) {
|
|
1801
|
-
return typeof t == "string" &&
|
|
1798
|
+
return typeof t == "string" && Io.test(t);
|
|
1802
1799
|
}
|
|
1803
1800
|
const q = [];
|
|
1804
1801
|
for (let t = 0; t < 256; ++t)
|
|
1805
1802
|
q.push((t + 256).toString(16).slice(1));
|
|
1806
|
-
function
|
|
1803
|
+
function Mo(t, e = 0) {
|
|
1807
1804
|
return (q[t[e + 0]] + q[t[e + 1]] + q[t[e + 2]] + q[t[e + 3]] + "-" + q[t[e + 4]] + q[t[e + 5]] + "-" + q[t[e + 6]] + q[t[e + 7]] + "-" + q[t[e + 8]] + q[t[e + 9]] + "-" + q[t[e + 10]] + q[t[e + 11]] + q[t[e + 12]] + q[t[e + 13]] + q[t[e + 14]] + q[t[e + 15]]).toLowerCase();
|
|
1808
1805
|
}
|
|
1809
|
-
let
|
|
1810
|
-
const
|
|
1811
|
-
function
|
|
1812
|
-
if (!
|
|
1806
|
+
let Yt;
|
|
1807
|
+
const Ro = new Uint8Array(16);
|
|
1808
|
+
function xo() {
|
|
1809
|
+
if (!Yt) {
|
|
1813
1810
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1814
1811
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1815
|
-
|
|
1812
|
+
Yt = crypto.getRandomValues.bind(crypto);
|
|
1816
1813
|
}
|
|
1817
|
-
return
|
|
1814
|
+
return Yt(Ro);
|
|
1818
1815
|
}
|
|
1819
|
-
const
|
|
1820
|
-
function
|
|
1816
|
+
const $o = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ar = { randomUUID: $o };
|
|
1817
|
+
function Do(t, e, n) {
|
|
1821
1818
|
var i;
|
|
1822
|
-
if (
|
|
1823
|
-
return
|
|
1819
|
+
if (Ar.randomUUID && !t)
|
|
1820
|
+
return Ar.randomUUID();
|
|
1824
1821
|
t = t || {};
|
|
1825
|
-
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ??
|
|
1822
|
+
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? xo();
|
|
1826
1823
|
if (r.length < 16)
|
|
1827
1824
|
throw new Error("Random bytes length must be >= 16");
|
|
1828
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1825
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Mo(r);
|
|
1829
1826
|
}
|
|
1830
|
-
function
|
|
1827
|
+
function jr(t) {
|
|
1831
1828
|
const e = t.replace(/-/g, ""), n = [];
|
|
1832
1829
|
for (let r = 0; r < e.length; r += 2)
|
|
1833
1830
|
n.push(parseInt(e.substring(r, r + 2), 16));
|
|
1834
1831
|
return n;
|
|
1835
1832
|
}
|
|
1836
|
-
function
|
|
1833
|
+
function Uo(t, e) {
|
|
1837
1834
|
for (let n = 0; n < t.length; n++) {
|
|
1838
1835
|
if (t[n] < e[n])
|
|
1839
1836
|
return -1;
|
|
@@ -1842,17 +1839,17 @@ function Lo(t, e) {
|
|
|
1842
1839
|
}
|
|
1843
1840
|
return 0;
|
|
1844
1841
|
}
|
|
1845
|
-
function
|
|
1846
|
-
return
|
|
1842
|
+
function Lo(t, e) {
|
|
1843
|
+
return Uo(jr(t), jr(e));
|
|
1847
1844
|
}
|
|
1848
1845
|
function K() {
|
|
1849
|
-
return
|
|
1846
|
+
return Do();
|
|
1850
1847
|
}
|
|
1851
|
-
function
|
|
1848
|
+
function Fo(t, e) {
|
|
1852
1849
|
return t.localeCompare(e);
|
|
1853
1850
|
}
|
|
1854
|
-
function
|
|
1855
|
-
let t =
|
|
1851
|
+
function No() {
|
|
1852
|
+
let t = Fo;
|
|
1856
1853
|
if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
|
|
1857
1854
|
try {
|
|
1858
1855
|
t = Intl.Collator("en-US").compare;
|
|
@@ -1860,10 +1857,10 @@ function Ko() {
|
|
|
1860
1857
|
}
|
|
1861
1858
|
return t;
|
|
1862
1859
|
}
|
|
1863
|
-
const
|
|
1864
|
-
let
|
|
1860
|
+
const Ko = No();
|
|
1861
|
+
let qo = 0;
|
|
1865
1862
|
function rt(t) {
|
|
1866
|
-
return $t(`_${t}`,
|
|
1863
|
+
return $t(`_${t}`, qo++);
|
|
1867
1864
|
}
|
|
1868
1865
|
function $t(t, e) {
|
|
1869
1866
|
return `?${t}-${e}`;
|
|
@@ -1873,28 +1870,28 @@ class Ne extends Error {
|
|
|
1873
1870
|
super(e), this.name = "AttrNotFoundError";
|
|
1874
1871
|
}
|
|
1875
1872
|
}
|
|
1876
|
-
function
|
|
1877
|
-
const n =
|
|
1873
|
+
function Wo(t, e) {
|
|
1874
|
+
const n = Ii(t, e);
|
|
1878
1875
|
if (!n)
|
|
1879
1876
|
throw new Ne(`Could not find id attr for ${e}`);
|
|
1880
1877
|
return n;
|
|
1881
1878
|
}
|
|
1882
|
-
function
|
|
1883
|
-
return [
|
|
1879
|
+
function kr(t, e, n, r) {
|
|
1880
|
+
return [zo(t, e, n, r)];
|
|
1884
1881
|
}
|
|
1885
|
-
function
|
|
1882
|
+
function zo(t, e, n, r) {
|
|
1886
1883
|
return [
|
|
1887
1884
|
t(n, r),
|
|
1888
|
-
|
|
1885
|
+
Wo(e, n).id,
|
|
1889
1886
|
t(n, r),
|
|
1890
1887
|
t("time", r)
|
|
1891
1888
|
];
|
|
1892
1889
|
}
|
|
1893
|
-
function
|
|
1890
|
+
function Vo(t, e, n) {
|
|
1894
1891
|
return t.map((r) => r === e ? n : r);
|
|
1895
1892
|
}
|
|
1896
|
-
function
|
|
1897
|
-
const s = Te(e, n, i), o =
|
|
1893
|
+
function Ri(t, e, n, r, i) {
|
|
1894
|
+
const s = Te(e, n, i), o = Pi(e, n, i), a = s || o;
|
|
1898
1895
|
if (!a)
|
|
1899
1896
|
throw new Ne(`Could not find attr for ${[n, i]}`);
|
|
1900
1897
|
if (a["value-type"] !== "ref")
|
|
@@ -1912,7 +1909,7 @@ function xi(t, e, n, r, i) {
|
|
|
1912
1909
|
];
|
|
1913
1910
|
return [s ? f : c, l, p, a, !!s];
|
|
1914
1911
|
}
|
|
1915
|
-
function
|
|
1912
|
+
function Cr(t, e) {
|
|
1916
1913
|
if (typeof e != "string")
|
|
1917
1914
|
return function(o) {
|
|
1918
1915
|
return !1;
|
|
@@ -1922,7 +1919,7 @@ function Pr(t, e) {
|
|
|
1922
1919
|
return typeof o != "string" ? !1 : i.test(o);
|
|
1923
1920
|
};
|
|
1924
1921
|
}
|
|
1925
|
-
function
|
|
1922
|
+
function Bo(t, e) {
|
|
1926
1923
|
if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
|
|
1927
1924
|
return e;
|
|
1928
1925
|
const n = t["checked-data-type"] === "date";
|
|
@@ -1963,7 +1960,7 @@ function Go(t, e) {
|
|
|
1963
1960
|
}
|
|
1964
1961
|
};
|
|
1965
1962
|
if (e.hasOwnProperty("$like")) {
|
|
1966
|
-
const r =
|
|
1963
|
+
const r = Cr(!0, e.$like);
|
|
1967
1964
|
return {
|
|
1968
1965
|
$comparator: !0,
|
|
1969
1966
|
$op: function(s) {
|
|
@@ -1972,7 +1969,7 @@ function Go(t, e) {
|
|
|
1972
1969
|
};
|
|
1973
1970
|
}
|
|
1974
1971
|
if (e.hasOwnProperty("$ilike")) {
|
|
1975
|
-
const r =
|
|
1972
|
+
const r = Cr(!1, e.$ilike);
|
|
1976
1973
|
return {
|
|
1977
1974
|
$comparator: !0,
|
|
1978
1975
|
$op: function(s) {
|
|
@@ -1982,8 +1979,8 @@ function Go(t, e) {
|
|
|
1982
1979
|
}
|
|
1983
1980
|
return e;
|
|
1984
1981
|
}
|
|
1985
|
-
function
|
|
1986
|
-
const o = Te(e, n, i), a =
|
|
1982
|
+
function Go(t, e, n, r, i, s) {
|
|
1983
|
+
const o = Te(e, n, i), a = Pi(e, n, i), u = o || a;
|
|
1987
1984
|
if (!u)
|
|
1988
1985
|
throw new Ne(`No attr for etype = ${n} label = ${i}`);
|
|
1989
1986
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
@@ -2000,63 +1997,63 @@ function Qo(t, e, n, r, i, s) {
|
|
|
2000
1997
|
return o ? [
|
|
2001
1998
|
t(n, r),
|
|
2002
1999
|
u.id,
|
|
2003
|
-
|
|
2000
|
+
Bo(u, s),
|
|
2004
2001
|
rt("time")
|
|
2005
2002
|
] : [s, u.id, t(n, r), rt("time")];
|
|
2006
2003
|
}
|
|
2007
|
-
function
|
|
2004
|
+
function Qo(t, e, n, r, i) {
|
|
2008
2005
|
const [s, o, a] = i.reduce((u, c) => {
|
|
2009
|
-
const [d, f, l] = u, [p, y, b] =
|
|
2006
|
+
const [d, f, l] = u, [p, y, b] = Ri(t, e, d, f, c);
|
|
2010
2007
|
return [p, y, [...l, b]];
|
|
2011
2008
|
}, [n, r, []]);
|
|
2012
2009
|
return [s, o, a];
|
|
2013
2010
|
}
|
|
2014
|
-
function
|
|
2015
|
-
const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, c, d] =
|
|
2011
|
+
function ln(t, e, n, r, i, s) {
|
|
2012
|
+
const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, c, d] = Qo(t, e, n, r, o), f = Go(t, e, u, c, a, s);
|
|
2016
2013
|
return d.concat([f]);
|
|
2017
2014
|
}
|
|
2018
|
-
function
|
|
2015
|
+
function Ho(t, e) {
|
|
2019
2016
|
return e ? [e].concat(t) : t;
|
|
2020
2017
|
}
|
|
2021
|
-
function
|
|
2018
|
+
function Yo([t, e]) {
|
|
2022
2019
|
return t === "or" && Array.isArray(e);
|
|
2023
2020
|
}
|
|
2024
|
-
function
|
|
2021
|
+
function Jo([t, e]) {
|
|
2025
2022
|
return t === "and" && Array.isArray(e);
|
|
2026
2023
|
}
|
|
2027
|
-
function
|
|
2024
|
+
function Zo(t, e, n) {
|
|
2028
2025
|
return (r, i) => {
|
|
2029
2026
|
const s = t(r, i);
|
|
2030
2027
|
return e == s ? s : `${s}-${n}`;
|
|
2031
2028
|
};
|
|
2032
2029
|
}
|
|
2033
|
-
function
|
|
2030
|
+
function Pr(t, e, n, r, i, s) {
|
|
2034
2031
|
const o = t(r, i), a = s.map((u, c) => {
|
|
2035
|
-
const d =
|
|
2036
|
-
return
|
|
2032
|
+
const d = Zo(t, o, c);
|
|
2033
|
+
return xi(d, n, r, i, u);
|
|
2037
2034
|
});
|
|
2038
2035
|
return { [e]: { patterns: a, joinSym: o } };
|
|
2039
2036
|
}
|
|
2040
|
-
function
|
|
2037
|
+
function Xo(t) {
|
|
2041
2038
|
const e = [];
|
|
2042
2039
|
for (let n = 1; n <= t.length; n++)
|
|
2043
2040
|
e.push(t.slice(0, n));
|
|
2044
2041
|
return e;
|
|
2045
2042
|
}
|
|
2046
|
-
function
|
|
2047
|
-
return
|
|
2043
|
+
function Ir(t, e, n, r, i) {
|
|
2044
|
+
return Xo(i).map((s) => ln(t, e, n, r, s, { $isNull: !0 }));
|
|
2048
2045
|
}
|
|
2049
|
-
function
|
|
2046
|
+
function xi(t, e, n, r, i) {
|
|
2050
2047
|
return Object.entries(i).flatMap(([s, o]) => {
|
|
2048
|
+
if (Yo([s, o]))
|
|
2049
|
+
return Pr(t, "or", e, n, r, o);
|
|
2051
2050
|
if (Jo([s, o]))
|
|
2052
|
-
return
|
|
2053
|
-
if (Zo([s, o]))
|
|
2054
|
-
return Ir(t, "and", e, n, r, o);
|
|
2051
|
+
return Pr(t, "and", e, n, r, o);
|
|
2055
2052
|
if (s === "$entityIdStartsWith")
|
|
2056
2053
|
return [];
|
|
2057
2054
|
const a = s.split(".");
|
|
2058
2055
|
if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2059
|
-
const u =
|
|
2056
|
+
const u = ln(t, e, n, r, a, o), c = Ir(t, e, n, r, a);
|
|
2060
2057
|
return [
|
|
2061
2058
|
{
|
|
2062
2059
|
or: {
|
|
@@ -2069,32 +2066,32 @@ function $i(t, e, n, r, i) {
|
|
|
2069
2066
|
return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && a.length > 1 ? [
|
|
2070
2067
|
{
|
|
2071
2068
|
or: {
|
|
2072
|
-
patterns:
|
|
2069
|
+
patterns: Ir(t, e, n, r, a),
|
|
2073
2070
|
joinSym: t(n, r)
|
|
2074
2071
|
}
|
|
2075
2072
|
}
|
|
2076
|
-
] :
|
|
2073
|
+
] : ln(t, e, n, r, a, o);
|
|
2077
2074
|
});
|
|
2078
2075
|
}
|
|
2079
|
-
function
|
|
2076
|
+
function ea(t, e, n, r) {
|
|
2080
2077
|
const i = $t;
|
|
2081
|
-
return r ?
|
|
2078
|
+
return r ? xi(i, t, e, n, r).concat(kr(i, t, e, n)) : kr(i, t, e, n);
|
|
2082
2079
|
}
|
|
2083
|
-
function
|
|
2080
|
+
function ta(t, e, n) {
|
|
2084
2081
|
return [t(e, n), t("time", n)];
|
|
2085
2082
|
}
|
|
2086
|
-
function
|
|
2087
|
-
const [o, a, u, c, d] =
|
|
2083
|
+
function na(t, e, n, r, i, s) {
|
|
2084
|
+
const [o, a, u, c, d] = Ri(t, e, n, r, i), f = Vo(u, t(n, r), s);
|
|
2088
2085
|
return [o, a, f, c, d];
|
|
2089
2086
|
}
|
|
2090
|
-
function
|
|
2087
|
+
function ra(t, e, { etype: n, level: r, form: i }, s) {
|
|
2091
2088
|
const o = Object.keys(i).filter((a) => a !== "$");
|
|
2092
2089
|
return o.length ? Object.entries(s).map(function([u, c]) {
|
|
2093
2090
|
return o.map(function(l) {
|
|
2094
2091
|
var p, y, b;
|
|
2095
2092
|
const _ = !!(e.cardinalityInference && (!((b = (y = (p = e.linkIndex) === null || p === void 0 ? void 0 : p[n]) === null || y === void 0 ? void 0 : y[l]) === null || b === void 0) && b.isSingular));
|
|
2096
2093
|
try {
|
|
2097
|
-
const [w, g, m] =
|
|
2094
|
+
const [w, g, m] = na(t, e, n, r, l, u), E = Di(e, {
|
|
2098
2095
|
etype: w,
|
|
2099
2096
|
level: g,
|
|
2100
2097
|
form: i[l],
|
|
@@ -2111,48 +2108,48 @@ function ia(t, e, { etype: n, level: r, form: i }, s) {
|
|
|
2111
2108
|
}, c);
|
|
2112
2109
|
}) : Object.values(s);
|
|
2113
2110
|
}
|
|
2114
|
-
function
|
|
2115
|
-
return n === "string" ?
|
|
2111
|
+
function ia(t, e, n) {
|
|
2112
|
+
return n === "string" ? Ko(t, e) : t > e ? 1 : -1;
|
|
2116
2113
|
}
|
|
2117
2114
|
function Xe(t, e, n, r, i) {
|
|
2118
|
-
return e === r || e == null && r == null ?
|
|
2115
|
+
return e === r || e == null && r == null ? Lo(t, n) : r == null ? 1 : e == null ? -1 : ia(e, r, i);
|
|
2119
2116
|
}
|
|
2120
2117
|
function It([t, e], [n, r], i) {
|
|
2121
2118
|
return Xe(t, e, n, r, i);
|
|
2122
2119
|
}
|
|
2123
|
-
function
|
|
2120
|
+
function hn(t) {
|
|
2124
2121
|
return t == null ? t : new Date(t).getTime();
|
|
2125
2122
|
}
|
|
2126
|
-
function
|
|
2123
|
+
function sa(t, e, n, r) {
|
|
2127
2124
|
var i;
|
|
2128
2125
|
const [s, o, a, u] = t, c = n === "desc" ? 1 : -1;
|
|
2129
2126
|
if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
|
|
2130
2127
|
return It(r, [s, u], null) === c;
|
|
2131
|
-
const [d, f] = r, l = e["checked-data-type"], p = l === "date" ?
|
|
2128
|
+
const [d, f] = r, l = e["checked-data-type"], p = l === "date" ? hn(f) : f, y = l === "date" ? hn(a) : a;
|
|
2132
2129
|
return It([d, p], [s, y], l) === c;
|
|
2133
2130
|
}
|
|
2134
|
-
function
|
|
2131
|
+
function oa(t, e) {
|
|
2135
2132
|
const n = e[1];
|
|
2136
2133
|
return t.attrs[n];
|
|
2137
2134
|
}
|
|
2138
|
-
function
|
|
2135
|
+
function aa(t, e, n) {
|
|
2139
2136
|
const r = Object.keys(n)[0];
|
|
2140
2137
|
return Te(t, e, r);
|
|
2141
2138
|
}
|
|
2142
|
-
function
|
|
2139
|
+
function ua(t, e, n, r) {
|
|
2143
2140
|
if (n)
|
|
2144
|
-
return
|
|
2141
|
+
return oa(t, n);
|
|
2145
2142
|
if (r)
|
|
2146
|
-
return
|
|
2143
|
+
return aa(t, e, r);
|
|
2147
2144
|
}
|
|
2148
|
-
function
|
|
2145
|
+
function ca(t, e, n) {
|
|
2149
2146
|
var r, i;
|
|
2150
2147
|
if (!Array.isArray(n.fields))
|
|
2151
|
-
return
|
|
2148
|
+
return go(t, e);
|
|
2152
2149
|
const s = /* @__PURE__ */ new Map();
|
|
2153
2150
|
for (const o of n.fields) {
|
|
2154
2151
|
const a = Te(t, e, o), u = (r = a == null ? void 0 : a["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
|
|
2155
|
-
u &&
|
|
2152
|
+
u && Kn(a) && s.set(u, a);
|
|
2156
2153
|
}
|
|
2157
2154
|
if (!s.has("id")) {
|
|
2158
2155
|
const o = Te(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
|
|
@@ -2160,17 +2157,17 @@ function da(t, e, n) {
|
|
|
2160
2157
|
}
|
|
2161
2158
|
return s;
|
|
2162
2159
|
}
|
|
2163
|
-
function
|
|
2160
|
+
function da(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
2164
2161
|
var s, o;
|
|
2165
|
-
const a = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, u =
|
|
2166
|
-
let d =
|
|
2167
|
-
const f = n == null ? void 0 : n["start-cursor"], l =
|
|
2162
|
+
const a = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, u = $i(i), c = fa(i);
|
|
2163
|
+
let d = Co(t, r);
|
|
2164
|
+
const f = n == null ? void 0 : n["start-cursor"], l = ua(t, e, f, a);
|
|
2168
2165
|
if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
|
|
2169
2166
|
const b = l["checked-data-type"] === "date", _ = l.id;
|
|
2170
2167
|
d = d.map(([w]) => {
|
|
2171
2168
|
var g, m, E, S, I;
|
|
2172
2169
|
let x = (I = (S = (E = (m = (g = t.eav.get(w)) === null || g === void 0 ? void 0 : g.get(_)) === null || m === void 0 ? void 0 : m.values()) === null || E === void 0 ? void 0 : E.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
|
|
2173
|
-
return b && (x =
|
|
2170
|
+
return b && (x = hn(x)), [w, x];
|
|
2174
2171
|
});
|
|
2175
2172
|
}
|
|
2176
2173
|
d.sort(c === "asc" ? function(_, w) {
|
|
@@ -2179,31 +2176,31 @@ function fa(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
|
2179
2176
|
return It(w, _, l == null ? void 0 : l["checked-data-type"]);
|
|
2180
2177
|
});
|
|
2181
2178
|
let p = {};
|
|
2182
|
-
const y =
|
|
2179
|
+
const y = ca(t, e, r);
|
|
2183
2180
|
for (const b of d) {
|
|
2184
2181
|
const [_] = b;
|
|
2185
|
-
if (p[_] || !u && f && l &&
|
|
2182
|
+
if (p[_] || !u && f && l && sa(f, l, c, b))
|
|
2186
2183
|
continue;
|
|
2187
|
-
const w =
|
|
2184
|
+
const w = _o(t, y, _);
|
|
2188
2185
|
w && (p[_] = w);
|
|
2189
2186
|
}
|
|
2190
2187
|
return p;
|
|
2191
2188
|
}
|
|
2192
|
-
function
|
|
2189
|
+
function fa(t) {
|
|
2193
2190
|
var e;
|
|
2194
2191
|
const n = (e = t.$) === null || e === void 0 ? void 0 : e.order;
|
|
2195
2192
|
return n && n[Object.keys(n)[0]] || "asc";
|
|
2196
2193
|
}
|
|
2197
|
-
function
|
|
2194
|
+
function $i(t) {
|
|
2198
2195
|
var e, n, r;
|
|
2199
2196
|
const i = (e = t.$) === null || e === void 0 ? void 0 : e.offset, s = (n = t.$) === null || n === void 0 ? void 0 : n.before, o = (r = t.$) === null || r === void 0 ? void 0 : r.after;
|
|
2200
2197
|
return !i && !s && !o;
|
|
2201
2198
|
}
|
|
2202
|
-
function
|
|
2199
|
+
function la(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
2203
2200
|
var o, a, u, c, d;
|
|
2204
|
-
if (
|
|
2201
|
+
if (!$i(r) && (!s || !s["start-cursor"]))
|
|
2205
2202
|
return [];
|
|
2206
|
-
const f =
|
|
2203
|
+
const f = Ho(ea(t, e, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), l = ta($t, e, n), p = (a = r.$) === null || a === void 0 ? void 0 : a.fields, y = da(t, {
|
|
2207
2204
|
etype: e,
|
|
2208
2205
|
pageInfo: s,
|
|
2209
2206
|
form: r,
|
|
@@ -2216,20 +2213,20 @@ function ha(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
|
2216
2213
|
}
|
|
2217
2214
|
return y;
|
|
2218
2215
|
}
|
|
2219
|
-
function
|
|
2216
|
+
function ha(t, e) {
|
|
2220
2217
|
try {
|
|
2221
|
-
return
|
|
2218
|
+
return la(t, e);
|
|
2222
2219
|
} catch (n) {
|
|
2223
2220
|
if (n instanceof Ne)
|
|
2224
2221
|
return {};
|
|
2225
2222
|
throw n;
|
|
2226
2223
|
}
|
|
2227
2224
|
}
|
|
2228
|
-
function
|
|
2229
|
-
const n =
|
|
2230
|
-
return
|
|
2225
|
+
function Di(t, e) {
|
|
2226
|
+
const n = ha(t, e);
|
|
2227
|
+
return ra($t, t, e, n);
|
|
2231
2228
|
}
|
|
2232
|
-
function
|
|
2229
|
+
function pa(t) {
|
|
2233
2230
|
const e = {};
|
|
2234
2231
|
for (const [n, r] of Object.entries(t))
|
|
2235
2232
|
e[n] = {
|
|
@@ -2240,18 +2237,18 @@ function ya(t) {
|
|
|
2240
2237
|
};
|
|
2241
2238
|
return e;
|
|
2242
2239
|
}
|
|
2243
|
-
function
|
|
2240
|
+
function Ui({ store: t, pageInfo: e, aggregate: n }, r) {
|
|
2244
2241
|
const s = { data: Object.keys(r).reduce(function(a, u) {
|
|
2245
|
-
return n != null && n[u] || u === "$$ruleParams" || (a[u] =
|
|
2242
|
+
return n != null && n[u] || u === "$$ruleParams" || (a[u] = Di(t, {
|
|
2246
2243
|
etype: u,
|
|
2247
2244
|
form: r[u],
|
|
2248
2245
|
level: 0,
|
|
2249
2246
|
pageInfo: e == null ? void 0 : e[u]
|
|
2250
2247
|
})), a;
|
|
2251
2248
|
}, {}) };
|
|
2252
|
-
return e && (s.pageInfo =
|
|
2249
|
+
return e && (s.pageInfo = pa(e)), n && (s.aggregate = n), s;
|
|
2253
2250
|
}
|
|
2254
|
-
function
|
|
2251
|
+
function ya() {
|
|
2255
2252
|
const e = {
|
|
2256
2253
|
__etype: 1,
|
|
2257
2254
|
__ops: 1,
|
|
@@ -2265,8 +2262,8 @@ function ba() {
|
|
|
2265
2262
|
};
|
|
2266
2263
|
return new Set(Object.keys(e));
|
|
2267
2264
|
}
|
|
2268
|
-
const
|
|
2269
|
-
function
|
|
2265
|
+
const ba = ya();
|
|
2266
|
+
function pn(t, e, n) {
|
|
2270
2267
|
const r = {
|
|
2271
2268
|
__etype: t,
|
|
2272
2269
|
__ops: n
|
|
@@ -2277,25 +2274,25 @@ function yn(t, e, n) {
|
|
|
2277
2274
|
return n;
|
|
2278
2275
|
if (s === "__etype")
|
|
2279
2276
|
return t;
|
|
2280
|
-
if (
|
|
2281
|
-
return (o, a) =>
|
|
2277
|
+
if (ba.has(s))
|
|
2278
|
+
return (o, a) => pn(t, e, [
|
|
2282
2279
|
...n,
|
|
2283
2280
|
a ? [s, t, e, o, a] : [s, t, e, o]
|
|
2284
2281
|
]);
|
|
2285
2282
|
}
|
|
2286
2283
|
});
|
|
2287
2284
|
}
|
|
2288
|
-
function
|
|
2285
|
+
function Nc(t, e) {
|
|
2289
2286
|
return `lookup__${t}__${JSON.stringify(e)}`;
|
|
2290
2287
|
}
|
|
2291
2288
|
function Mt(t) {
|
|
2292
2289
|
return t.startsWith("lookup__");
|
|
2293
2290
|
}
|
|
2294
|
-
function
|
|
2291
|
+
function Li(t) {
|
|
2295
2292
|
const [e, n, ...r] = t.split("__");
|
|
2296
2293
|
return [n, JSON.parse(r.join("__"))];
|
|
2297
2294
|
}
|
|
2298
|
-
function
|
|
2295
|
+
function _a(t) {
|
|
2299
2296
|
return new Proxy({
|
|
2300
2297
|
__etype: t
|
|
2301
2298
|
}, {
|
|
@@ -2303,22 +2300,22 @@ function ga(t) {
|
|
|
2303
2300
|
if (n === "__etype")
|
|
2304
2301
|
return t;
|
|
2305
2302
|
const r = n;
|
|
2306
|
-
return Mt(r) ?
|
|
2303
|
+
return Mt(r) ? pn(t, Li(r), []) : pn(t, r, []);
|
|
2307
2304
|
}
|
|
2308
2305
|
});
|
|
2309
2306
|
}
|
|
2310
|
-
function
|
|
2307
|
+
function zn() {
|
|
2311
2308
|
return new Proxy({}, {
|
|
2312
2309
|
get(t, e) {
|
|
2313
|
-
return
|
|
2310
|
+
return _a(e);
|
|
2314
2311
|
}
|
|
2315
2312
|
});
|
|
2316
2313
|
}
|
|
2317
|
-
const
|
|
2318
|
-
function
|
|
2314
|
+
const Kc = zn();
|
|
2315
|
+
function ga(t) {
|
|
2319
2316
|
return t.__ops;
|
|
2320
2317
|
}
|
|
2321
|
-
function
|
|
2318
|
+
function Ta(t, e) {
|
|
2322
2319
|
const { attrIdMap: n, refSwapAttrIds: r } = t, i = [];
|
|
2323
2320
|
for (const o of e) {
|
|
2324
2321
|
const a = n[o];
|
|
@@ -2352,7 +2349,7 @@ function Ae(t, e, n) {
|
|
|
2352
2349
|
return o === e && a === n;
|
|
2353
2350
|
});
|
|
2354
2351
|
}
|
|
2355
|
-
function
|
|
2352
|
+
function wa(t) {
|
|
2356
2353
|
if (Array.isArray(t))
|
|
2357
2354
|
return t;
|
|
2358
2355
|
const e = Object.entries(t);
|
|
@@ -2360,38 +2357,38 @@ function ma(t) {
|
|
|
2360
2357
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
2361
2358
|
return e[0];
|
|
2362
2359
|
}
|
|
2363
|
-
function
|
|
2360
|
+
function yn(t, e, n) {
|
|
2364
2361
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2365
2362
|
// before assuming it's a ref lookup.
|
|
2366
2363
|
!V(t, e, n);
|
|
2367
2364
|
}
|
|
2368
|
-
function
|
|
2365
|
+
function bn(t) {
|
|
2369
2366
|
const [e, n, ...r] = t.split(".");
|
|
2370
2367
|
if (r.length > 0 || n !== "id")
|
|
2371
2368
|
throw new Error(`${t} is not a valid lookup attribute.`);
|
|
2372
2369
|
return e;
|
|
2373
2370
|
}
|
|
2374
|
-
function
|
|
2375
|
-
if (!
|
|
2371
|
+
function ma(t, e, n) {
|
|
2372
|
+
if (!yn(t, e, n))
|
|
2376
2373
|
return V(t, e, n);
|
|
2377
|
-
const r =
|
|
2374
|
+
const r = bn(n), i = V(t, e, r) || Ae(t, e, r);
|
|
2378
2375
|
if (i && i["value-type"] !== "ref")
|
|
2379
2376
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
2380
2377
|
return i;
|
|
2381
2378
|
}
|
|
2382
|
-
function
|
|
2383
|
-
return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ?
|
|
2379
|
+
function _n(t) {
|
|
2380
|
+
return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? Li(t) : wa(t);
|
|
2384
2381
|
}
|
|
2385
2382
|
function ee(t, e, n) {
|
|
2386
|
-
const r =
|
|
2383
|
+
const r = _n(n);
|
|
2387
2384
|
if (r === null)
|
|
2388
2385
|
return n;
|
|
2389
|
-
const [i, s] = r, o =
|
|
2386
|
+
const [i, s] = r, o = ma(t, e, i);
|
|
2390
2387
|
if (!o || !o["unique?"])
|
|
2391
2388
|
throw new Error(`${i} is not a unique attribute.`);
|
|
2392
2389
|
return [o.id, s];
|
|
2393
2390
|
}
|
|
2394
|
-
function
|
|
2391
|
+
function Fi(t, e, n, r) {
|
|
2395
2392
|
const i = ee(t, e, n);
|
|
2396
2393
|
return Array.isArray(i) ? [[
|
|
2397
2394
|
"add-triple",
|
|
@@ -2400,7 +2397,7 @@ function Ni(t, e, n, r) {
|
|
|
2400
2397
|
i
|
|
2401
2398
|
]].concat(r) : r;
|
|
2402
2399
|
}
|
|
2403
|
-
function
|
|
2400
|
+
function va({ attrs: t }, [e, n, r]) {
|
|
2404
2401
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
2405
2402
|
const a = Array.isArray(o) ? o : [o], u = V(t, e, s), c = Ae(t, e, s);
|
|
2406
2403
|
return a.map((d) => u ? [
|
|
@@ -2415,9 +2412,9 @@ function Sa({ attrs: t }, [e, n, r]) {
|
|
|
2415
2412
|
ee(t, e, n)
|
|
2416
2413
|
]);
|
|
2417
2414
|
});
|
|
2418
|
-
return
|
|
2415
|
+
return Fi(t, e, n, i);
|
|
2419
2416
|
}
|
|
2420
|
-
function
|
|
2417
|
+
function Sa({ attrs: t }, [e, n, r]) {
|
|
2421
2418
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
2422
2419
|
const a = Array.isArray(o) ? o : [o], u = V(t, e, s), c = Ae(t, e, s);
|
|
2423
2420
|
return a.map((d) => u ? [
|
|
@@ -2432,9 +2429,9 @@ function Oa({ attrs: t }, [e, n, r]) {
|
|
|
2432
2429
|
ee(t, e, n)
|
|
2433
2430
|
]);
|
|
2434
2431
|
});
|
|
2435
|
-
return
|
|
2432
|
+
return Fi(t, e, n, i);
|
|
2436
2433
|
}
|
|
2437
|
-
function
|
|
2434
|
+
function Oa(t, e, n) {
|
|
2438
2435
|
if (Array.isArray(n)) {
|
|
2439
2436
|
const [r, i] = n;
|
|
2440
2437
|
for (const s of t || []) {
|
|
@@ -2456,18 +2453,18 @@ function Ea(t, e, n) {
|
|
|
2456
2453
|
}
|
|
2457
2454
|
return !1;
|
|
2458
2455
|
}
|
|
2459
|
-
function
|
|
2460
|
-
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null :
|
|
2456
|
+
function Ni({ stores: t, attrs: e }, [n, r, i, s]) {
|
|
2457
|
+
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : Oa(t, n, r) ? { mode: "update" } : null;
|
|
2461
2458
|
}
|
|
2462
|
-
function
|
|
2463
|
-
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u =
|
|
2459
|
+
function Ea(t, e) {
|
|
2460
|
+
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Fn(o), c = ee(r, i, s);
|
|
2464
2461
|
return [["id", c]].concat(Object.entries(u)).map(([f, l]) => {
|
|
2465
2462
|
const p = V(r, i, f);
|
|
2466
2463
|
return p["checked-data-type"] === "date" && t.useDateObjects && (l = xt(l)), ["add-triple", c, p.id, l, { mode: "create" }];
|
|
2467
2464
|
});
|
|
2468
2465
|
}
|
|
2469
|
-
function
|
|
2470
|
-
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u =
|
|
2466
|
+
function Aa(t, e) {
|
|
2467
|
+
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Fn(o), c = ee(r, i, s), d = Ni(t, [i, c, o, a]);
|
|
2471
2468
|
return [["id", c]].concat(Object.entries(u)).map(([l, p]) => {
|
|
2472
2469
|
const y = V(r, i, l);
|
|
2473
2470
|
return y["checked-data-type"] === "date" && t.useDateObjects && (p = xt(p)), [
|
|
@@ -2479,11 +2476,11 @@ function ja(t, e) {
|
|
|
2479
2476
|
];
|
|
2480
2477
|
});
|
|
2481
2478
|
}
|
|
2482
|
-
function
|
|
2479
|
+
function ja({ attrs: t }, [e, n]) {
|
|
2483
2480
|
return [["delete-entity", ee(t, e, n), e]];
|
|
2484
2481
|
}
|
|
2485
|
-
function
|
|
2486
|
-
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u =
|
|
2482
|
+
function ka(t, e) {
|
|
2483
|
+
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Fn(o), c = ee(r, i, s), d = Ni(t, [i, c, o, a]), f = Object.entries(u).map(([p, y]) => {
|
|
2487
2484
|
const b = V(r, i, p);
|
|
2488
2485
|
return [
|
|
2489
2486
|
"deep-merge-triple",
|
|
@@ -2501,38 +2498,38 @@ function Ca(t, e) {
|
|
|
2501
2498
|
...d ? [d] : []
|
|
2502
2499
|
]].concat(f);
|
|
2503
2500
|
}
|
|
2504
|
-
function
|
|
2501
|
+
function Ca({ attrs: t }, [e, n, r]) {
|
|
2505
2502
|
return [["rule-params", ee(t, e, n), e, r]];
|
|
2506
2503
|
}
|
|
2507
|
-
function
|
|
2504
|
+
function Pa(t) {
|
|
2508
2505
|
const [e, n, r, i, s] = t;
|
|
2509
2506
|
if (!i)
|
|
2510
2507
|
return t;
|
|
2511
2508
|
const o = Object.assign({}, i);
|
|
2512
2509
|
return delete o.id, [e, n, r, o, ...s ? [s] : []];
|
|
2513
2510
|
}
|
|
2514
|
-
function
|
|
2515
|
-
const [n, ...r] =
|
|
2511
|
+
function Ia(t, e) {
|
|
2512
|
+
const [n, ...r] = Pa(e);
|
|
2516
2513
|
switch (n) {
|
|
2517
2514
|
case "merge":
|
|
2518
|
-
return
|
|
2515
|
+
return ka(t, r);
|
|
2519
2516
|
case "create":
|
|
2520
|
-
return
|
|
2517
|
+
return Ea(t, r);
|
|
2521
2518
|
case "update":
|
|
2522
|
-
return
|
|
2519
|
+
return Aa(t, r);
|
|
2523
2520
|
case "link":
|
|
2524
|
-
return
|
|
2521
|
+
return va(t, r);
|
|
2525
2522
|
case "unlink":
|
|
2526
|
-
return
|
|
2523
|
+
return Sa(t, r);
|
|
2527
2524
|
case "delete":
|
|
2528
|
-
return
|
|
2525
|
+
return ja(t, r);
|
|
2529
2526
|
case "ruleParams":
|
|
2530
|
-
return
|
|
2527
|
+
return Ca(t, r);
|
|
2531
2528
|
default:
|
|
2532
2529
|
throw new Error(`unsupported action ${n}`);
|
|
2533
2530
|
}
|
|
2534
2531
|
}
|
|
2535
|
-
function
|
|
2532
|
+
function Ma(t) {
|
|
2536
2533
|
switch (t) {
|
|
2537
2534
|
case "string":
|
|
2538
2535
|
case "date":
|
|
@@ -2543,14 +2540,14 @@ function Ra(t) {
|
|
|
2543
2540
|
return;
|
|
2544
2541
|
}
|
|
2545
2542
|
}
|
|
2546
|
-
function
|
|
2543
|
+
function Ra(t, e, n) {
|
|
2547
2544
|
var r, i;
|
|
2548
2545
|
const s = (i = (r = t.entities[e]) === null || r === void 0 ? void 0 : r.attrs) === null || i === void 0 ? void 0 : i[n];
|
|
2549
2546
|
if (n === "id")
|
|
2550
2547
|
return null;
|
|
2551
2548
|
if (!s)
|
|
2552
2549
|
throw new Error(`${e}.${n} does not exist in your schema`);
|
|
2553
|
-
const { unique: o, indexed: a } = s == null ? void 0 : s.config, u =
|
|
2550
|
+
const { unique: o, indexed: a } = s == null ? void 0 : s.config, u = Ma(s == null ? void 0 : s.valueType);
|
|
2554
2551
|
return {
|
|
2555
2552
|
"index?": a,
|
|
2556
2553
|
"unique?": o,
|
|
@@ -2558,14 +2555,14 @@ function xa(t, e, n) {
|
|
|
2558
2555
|
};
|
|
2559
2556
|
}
|
|
2560
2557
|
function Tt(t, e, n, r) {
|
|
2561
|
-
const i = t ?
|
|
2558
|
+
const i = t ? Ra(t, e, n) : null, s = K(), a = [K(), e, n];
|
|
2562
2559
|
return Object.assign(Object.assign({ id: s, "forward-identity": a, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
2563
2560
|
}
|
|
2564
|
-
function
|
|
2561
|
+
function xa(t, e, n) {
|
|
2565
2562
|
return Object.values(t.links).find((i) => i.forward.on === e && i.forward.label === n || i.reverse.on === e && i.reverse.label === n);
|
|
2566
2563
|
}
|
|
2567
|
-
function
|
|
2568
|
-
const r =
|
|
2564
|
+
function $a(t, e, n) {
|
|
2565
|
+
const r = xa(t, e, n);
|
|
2569
2566
|
if (!r)
|
|
2570
2567
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
2571
2568
|
const { forward: i, reverse: s } = r;
|
|
@@ -2578,11 +2575,11 @@ function Da(t, e, n) {
|
|
|
2578
2575
|
"on-delete-reverse": s.onDelete
|
|
2579
2576
|
};
|
|
2580
2577
|
}
|
|
2581
|
-
function
|
|
2582
|
-
const i = t ?
|
|
2578
|
+
function Mr(t, e, n, r) {
|
|
2579
|
+
const i = t ? $a(t, e, n) : null, s = K(), o = [K(), e, n], a = [K(), n, e];
|
|
2583
2580
|
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 || {});
|
|
2584
2581
|
}
|
|
2585
|
-
const
|
|
2582
|
+
const Da = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Ua = /* @__PURE__ */ new Set(["link", "unlink"]), La = /* @__PURE__ */ new Set(["create", "update", "merge"]), Fa = /* @__PURE__ */ new Set([
|
|
2586
2583
|
"link",
|
|
2587
2584
|
"unlink",
|
|
2588
2585
|
"create",
|
|
@@ -2590,17 +2587,17 @@ const Ua = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
2590
2587
|
"merge",
|
|
2591
2588
|
"delete",
|
|
2592
2589
|
"ruleParams"
|
|
2593
|
-
]),
|
|
2594
|
-
function
|
|
2590
|
+
]), gn = { "unique?": !0, "index?": !0 }, Na = Object.assign(Object.assign({}, gn), { cardinality: "one" });
|
|
2591
|
+
function Ka(t) {
|
|
2595
2592
|
const e = [], [n, r, i, s] = t;
|
|
2596
|
-
if (!
|
|
2593
|
+
if (!Fa.has(n))
|
|
2597
2594
|
return e;
|
|
2598
|
-
const o =
|
|
2595
|
+
const o = _n(i);
|
|
2599
2596
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
2600
2597
|
for (const [a, u] of Object.entries(s)) {
|
|
2601
2598
|
const c = Array.isArray(u) ? u : [u];
|
|
2602
2599
|
for (const d of c) {
|
|
2603
|
-
const f =
|
|
2600
|
+
const f = _n(d);
|
|
2604
2601
|
f && e.push({
|
|
2605
2602
|
etype: r,
|
|
2606
2603
|
lookupPair: f,
|
|
@@ -2610,7 +2607,7 @@ function qa(t) {
|
|
|
2610
2607
|
}
|
|
2611
2608
|
return e;
|
|
2612
2609
|
}
|
|
2613
|
-
function
|
|
2610
|
+
function qa({ attrs: t, schema: e }, n) {
|
|
2614
2611
|
var r, i;
|
|
2615
2612
|
const [s, o, a] = [/* @__PURE__ */ new Set(), Object.assign({}, t), []];
|
|
2616
2613
|
function u(f) {
|
|
@@ -2621,47 +2618,47 @@ function Wa({ attrs: t, schema: e }, n) {
|
|
|
2621
2618
|
}
|
|
2622
2619
|
function d(f, l) {
|
|
2623
2620
|
const p = V(o, f, l), y = Ae(o, f, l);
|
|
2624
|
-
c(p), c(y), !p && !y && u(
|
|
2621
|
+
c(p), c(y), !p && !y && u(Mr(e, f, l, Na));
|
|
2625
2622
|
}
|
|
2626
2623
|
for (const f of n)
|
|
2627
|
-
for (const { etype: l, lookupPair: p, linkLabel: y } of
|
|
2624
|
+
for (const { etype: l, lookupPair: p, linkLabel: y } of Ka(f)) {
|
|
2628
2625
|
const b = p[0];
|
|
2629
2626
|
if (y) {
|
|
2630
2627
|
d(l, y);
|
|
2631
2628
|
const _ = V(o, l, y), w = Ae(o, l, y);
|
|
2632
2629
|
c(_), c(w);
|
|
2633
2630
|
const g = ((r = _ == null ? void 0 : _["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = w == null ? void 0 : w["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
|
|
2634
|
-
if (
|
|
2635
|
-
d(g,
|
|
2631
|
+
if (yn(o, g, b))
|
|
2632
|
+
d(g, bn(b));
|
|
2636
2633
|
else {
|
|
2637
2634
|
const m = V(o, g, b);
|
|
2638
|
-
m || u(Tt(e, g, b,
|
|
2635
|
+
m || u(Tt(e, g, b, gn)), c(m);
|
|
2639
2636
|
}
|
|
2640
|
-
} else if (
|
|
2641
|
-
d(l,
|
|
2637
|
+
} else if (yn(o, l, b))
|
|
2638
|
+
d(l, bn(b));
|
|
2642
2639
|
else {
|
|
2643
2640
|
const _ = V(o, l, b);
|
|
2644
|
-
_ || u(Tt(e, l, b,
|
|
2641
|
+
_ || u(Tt(e, l, b, gn)), c(_);
|
|
2645
2642
|
}
|
|
2646
2643
|
}
|
|
2647
2644
|
for (const f of n) {
|
|
2648
2645
|
const [l, p, y, b] = f;
|
|
2649
|
-
if (
|
|
2646
|
+
if (Da.has(l)) {
|
|
2650
2647
|
const _ = V(o, p, "id");
|
|
2651
2648
|
c(_), _ || u(Tt(e, p, "id", { "unique?": !0 }));
|
|
2652
2649
|
for (const w of Object.keys(b)) {
|
|
2653
2650
|
const g = V(o, p, w);
|
|
2654
|
-
if (c(g),
|
|
2651
|
+
if (c(g), La.has(l) && (g || u(Tt(e, p, w, w === "id" ? { "unique?": !0 } : null))), Ua.has(l)) {
|
|
2655
2652
|
const m = Ae(o, p, w);
|
|
2656
|
-
!g && !m && u(
|
|
2653
|
+
!g && !m && u(Mr(e, p, w)), c(m);
|
|
2657
2654
|
}
|
|
2658
2655
|
}
|
|
2659
2656
|
}
|
|
2660
2657
|
}
|
|
2661
2658
|
return [o, a];
|
|
2662
2659
|
}
|
|
2663
|
-
function
|
|
2664
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((u) =>
|
|
2660
|
+
function Wa(t, e) {
|
|
2661
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((u) => ga(u)), [i, s] = qa(t, r), o = Object.assign(Object.assign({}, t), { attrs: i }), a = r.flatMap((u) => Ia(o, u));
|
|
2665
2662
|
return [...s, ...a];
|
|
2666
2663
|
}
|
|
2667
2664
|
var de = function(t, e, n, r) {
|
|
@@ -2691,15 +2688,15 @@ var de = function(t, e, n, r) {
|
|
|
2691
2688
|
c((r = r.apply(t, e || [])).next());
|
|
2692
2689
|
});
|
|
2693
2690
|
};
|
|
2694
|
-
function
|
|
2691
|
+
function Rr(t, e) {
|
|
2695
2692
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
2696
2693
|
}
|
|
2697
2694
|
const it = "__meta";
|
|
2698
|
-
class
|
|
2695
|
+
class za {
|
|
2699
2696
|
constructor(e, n) {
|
|
2700
2697
|
}
|
|
2701
2698
|
}
|
|
2702
|
-
class
|
|
2699
|
+
class Tn {
|
|
2703
2700
|
constructor(e) {
|
|
2704
2701
|
var n, r;
|
|
2705
2702
|
this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
|
|
@@ -2893,7 +2890,7 @@ class wn {
|
|
|
2893
2890
|
gc() {
|
|
2894
2891
|
this._nextGc || (this._nextGc = setTimeout(
|
|
2895
2892
|
() => {
|
|
2896
|
-
|
|
2893
|
+
Rr(() => {
|
|
2897
2894
|
this._nextGc = null, this._gc();
|
|
2898
2895
|
}, 30 * 1e3);
|
|
2899
2896
|
},
|
|
@@ -2908,7 +2905,7 @@ class wn {
|
|
|
2908
2905
|
return;
|
|
2909
2906
|
}
|
|
2910
2907
|
this._nextSave = setTimeout(() => {
|
|
2911
|
-
|
|
2908
|
+
Rr(() => {
|
|
2912
2909
|
this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
|
|
2913
2910
|
}, this._idleCallbackMaxWaitMs);
|
|
2914
2911
|
}, this._saveThrottleMs);
|
|
@@ -2967,13 +2964,13 @@ var pe = function(t, e, n, r) {
|
|
|
2967
2964
|
c((r = r.apply(t, e || [])).next());
|
|
2968
2965
|
});
|
|
2969
2966
|
};
|
|
2970
|
-
const
|
|
2971
|
-
function
|
|
2967
|
+
const Va = 6, Ba = ["kv", "querySubs", "syncSubs"];
|
|
2968
|
+
function Ga(t) {
|
|
2972
2969
|
return function(n) {
|
|
2973
2970
|
console.error("Error in IndexedDB event", { source: t, event: n });
|
|
2974
2971
|
};
|
|
2975
2972
|
}
|
|
2976
|
-
function
|
|
2973
|
+
function Qa(t) {
|
|
2977
2974
|
return pe(this, void 0, void 0, function* () {
|
|
2978
2975
|
return new Promise((e) => {
|
|
2979
2976
|
const n = indexedDB.open(t);
|
|
@@ -2989,7 +2986,7 @@ function Ha(t) {
|
|
|
2989
2986
|
});
|
|
2990
2987
|
});
|
|
2991
2988
|
}
|
|
2992
|
-
function
|
|
2989
|
+
function Ha(t, e, n) {
|
|
2993
2990
|
return pe(this, void 0, void 0, function* () {
|
|
2994
2991
|
const r = (
|
|
2995
2992
|
// Backwards compatibility for older versions where we JSON.stringified before storing
|
|
@@ -3025,7 +3022,7 @@ function Ya(t, e, n) {
|
|
|
3025
3022
|
});
|
|
3026
3023
|
});
|
|
3027
3024
|
}
|
|
3028
|
-
function
|
|
3025
|
+
function xr(t, e, n) {
|
|
3029
3026
|
return pe(this, void 0, void 0, function* () {
|
|
3030
3027
|
const r = n.put(e, t);
|
|
3031
3028
|
return new Promise((i, s) => {
|
|
@@ -3033,9 +3030,9 @@ function $r(t, e, n) {
|
|
|
3033
3030
|
});
|
|
3034
3031
|
});
|
|
3035
3032
|
}
|
|
3036
|
-
function
|
|
3033
|
+
function Ya(t, e) {
|
|
3037
3034
|
return pe(this, void 0, void 0, function* () {
|
|
3038
|
-
const n = yield
|
|
3035
|
+
const n = yield Qa(`instant_${t}_5`);
|
|
3039
3036
|
if (!n)
|
|
3040
3037
|
return;
|
|
3041
3038
|
const r = yield new Promise((d, f) => {
|
|
@@ -3058,12 +3055,12 @@ function Ja(t, e) {
|
|
|
3058
3055
|
for (const [d, f] of r)
|
|
3059
3056
|
switch (d) {
|
|
3060
3057
|
case "querySubs": {
|
|
3061
|
-
const l =
|
|
3058
|
+
const l = Ha(d, f, o);
|
|
3062
3059
|
a.push(l);
|
|
3063
3060
|
break;
|
|
3064
3061
|
}
|
|
3065
3062
|
default: {
|
|
3066
|
-
const l =
|
|
3063
|
+
const l = xr(d, f, s);
|
|
3067
3064
|
a.push(l);
|
|
3068
3065
|
const p = {
|
|
3069
3066
|
createdAt: Date.now(),
|
|
@@ -3074,16 +3071,16 @@ function Ja(t, e) {
|
|
|
3074
3071
|
break;
|
|
3075
3072
|
}
|
|
3076
3073
|
}
|
|
3077
|
-
const c =
|
|
3074
|
+
const c = xr(it, u, s);
|
|
3078
3075
|
a.push(c), yield Promise.all(a), yield new Promise((d, f) => {
|
|
3079
3076
|
i.oncomplete = (l) => d(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
|
|
3080
3077
|
});
|
|
3081
3078
|
});
|
|
3082
3079
|
}
|
|
3083
|
-
const
|
|
3084
|
-
class
|
|
3080
|
+
const $r = /* @__PURE__ */ new Map();
|
|
3081
|
+
class Ki extends za {
|
|
3085
3082
|
constructor(e, n) {
|
|
3086
|
-
super(e, n), this.dbName = `instant_${e}_${
|
|
3083
|
+
super(e, n), this.dbName = `instant_${e}_${Va}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
|
|
3087
3084
|
}
|
|
3088
3085
|
_init() {
|
|
3089
3086
|
return new Promise((e, n) => {
|
|
@@ -3094,12 +3091,12 @@ class qi extends Va {
|
|
|
3094
3091
|
}, i.onsuccess = (s) => {
|
|
3095
3092
|
const a = s.target.result;
|
|
3096
3093
|
if (r) {
|
|
3097
|
-
const u =
|
|
3098
|
-
|
|
3094
|
+
const u = Ya(this._appId, a).catch((c) => {
|
|
3095
|
+
Ga("Error upgrading store from version 5 to 6.")(c);
|
|
3099
3096
|
});
|
|
3100
|
-
|
|
3097
|
+
$r.set(this.dbName, u), u.then(() => e(a)).catch(() => e(a));
|
|
3101
3098
|
} else {
|
|
3102
|
-
const u =
|
|
3099
|
+
const u = $r.get(this.dbName);
|
|
3103
3100
|
u ? u.then(() => e(a)).catch(() => e(a)) : e(a);
|
|
3104
3101
|
}
|
|
3105
3102
|
}, i.onupgradeneeded = (s) => {
|
|
@@ -3109,7 +3106,7 @@ class qi extends Va {
|
|
|
3109
3106
|
}
|
|
3110
3107
|
_upgradeStore(e) {
|
|
3111
3108
|
const r = e.target.result;
|
|
3112
|
-
for (const i of
|
|
3109
|
+
for (const i of Ba)
|
|
3113
3110
|
r.objectStoreNames.contains(i) || r.createObjectStore(i);
|
|
3114
3111
|
}
|
|
3115
3112
|
getItem(e) {
|
|
@@ -3184,7 +3181,7 @@ class qi extends Va {
|
|
|
3184
3181
|
});
|
|
3185
3182
|
}
|
|
3186
3183
|
}
|
|
3187
|
-
var
|
|
3184
|
+
var Ja = function(t, e, n, r) {
|
|
3188
3185
|
function i(s) {
|
|
3189
3186
|
return s instanceof n ? s : new n(function(o) {
|
|
3190
3187
|
o(s);
|
|
@@ -3211,9 +3208,9 @@ var Za = function(t, e, n, r) {
|
|
|
3211
3208
|
c((r = r.apply(t, e || [])).next());
|
|
3212
3209
|
});
|
|
3213
3210
|
};
|
|
3214
|
-
class
|
|
3211
|
+
class qi {
|
|
3215
3212
|
static getIsOnline() {
|
|
3216
|
-
return
|
|
3213
|
+
return Ja(this, void 0, void 0, function* () {
|
|
3217
3214
|
return navigator.onLine;
|
|
3218
3215
|
});
|
|
3219
3216
|
}
|
|
@@ -3238,7 +3235,7 @@ class Ke extends Error {
|
|
|
3238
3235
|
return "InstantError";
|
|
3239
3236
|
}
|
|
3240
3237
|
}
|
|
3241
|
-
var
|
|
3238
|
+
var Za = function(t, e, n, r) {
|
|
3242
3239
|
function i(s) {
|
|
3243
3240
|
return s instanceof n ? s : new n(function(o) {
|
|
3244
3241
|
o(s);
|
|
@@ -3278,7 +3275,7 @@ class Dt extends Ke {
|
|
|
3278
3275
|
}
|
|
3279
3276
|
}
|
|
3280
3277
|
function ue(t, e) {
|
|
3281
|
-
return
|
|
3278
|
+
return Za(this, void 0, void 0, function* () {
|
|
3282
3279
|
const n = yield fetch(t, e), r = yield n.json();
|
|
3283
3280
|
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new Dt({ status: n.status, body: r }));
|
|
3284
3281
|
});
|
|
@@ -3310,14 +3307,14 @@ var ze = function(t, e, n, r) {
|
|
|
3310
3307
|
c((r = r.apply(t, e || [])).next());
|
|
3311
3308
|
});
|
|
3312
3309
|
};
|
|
3313
|
-
function
|
|
3310
|
+
function Xa({ apiURI: t, appId: e, email: n }) {
|
|
3314
3311
|
return ue(`${t}/runtime/auth/send_magic_code`, {
|
|
3315
3312
|
method: "POST",
|
|
3316
3313
|
headers: { "content-type": "application/json" },
|
|
3317
3314
|
body: JSON.stringify({ "app-id": e, email: n })
|
|
3318
3315
|
});
|
|
3319
3316
|
}
|
|
3320
|
-
function
|
|
3317
|
+
function eu(t) {
|
|
3321
3318
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
|
|
3322
3319
|
return yield ue(`${e}/runtime/auth/verify_magic_code`, {
|
|
3323
3320
|
method: "POST",
|
|
@@ -3330,7 +3327,7 @@ function tu(t) {
|
|
|
3330
3327
|
});
|
|
3331
3328
|
});
|
|
3332
3329
|
}
|
|
3333
|
-
function
|
|
3330
|
+
function tu(t) {
|
|
3334
3331
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3335
3332
|
return yield ue(`${e}/runtime/auth/verify_refresh_token`, {
|
|
3336
3333
|
method: "POST",
|
|
@@ -3342,7 +3339,7 @@ function nu(t) {
|
|
|
3342
3339
|
});
|
|
3343
3340
|
});
|
|
3344
3341
|
}
|
|
3345
|
-
function
|
|
3342
|
+
function nu(t) {
|
|
3346
3343
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
|
|
3347
3344
|
return yield ue(`${e}/runtime/auth/sign_in_guest`, {
|
|
3348
3345
|
method: "POST",
|
|
@@ -3353,7 +3350,7 @@ function ru(t) {
|
|
|
3353
3350
|
});
|
|
3354
3351
|
});
|
|
3355
3352
|
}
|
|
3356
|
-
function
|
|
3353
|
+
function Dr(t) {
|
|
3357
3354
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
3358
3355
|
return yield ue(`${e}/runtime/oauth/token`, {
|
|
3359
3356
|
method: "POST",
|
|
@@ -3367,7 +3364,7 @@ function Ur(t) {
|
|
|
3367
3364
|
});
|
|
3368
3365
|
});
|
|
3369
3366
|
}
|
|
3370
|
-
function
|
|
3367
|
+
function ru(t) {
|
|
3371
3368
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
|
|
3372
3369
|
return yield ue(`${e}/runtime/oauth/id_token`, {
|
|
3373
3370
|
method: "POST",
|
|
@@ -3382,7 +3379,7 @@ function iu(t) {
|
|
|
3382
3379
|
});
|
|
3383
3380
|
});
|
|
3384
3381
|
}
|
|
3385
|
-
function
|
|
3382
|
+
function iu(t) {
|
|
3386
3383
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3387
3384
|
return yield ue(`${e}/runtime/signout`, {
|
|
3388
3385
|
method: "POST",
|
|
@@ -3423,7 +3420,7 @@ var ft = function(t, e, n, r) {
|
|
|
3423
3420
|
c((r = r.apply(t, e || [])).next());
|
|
3424
3421
|
});
|
|
3425
3422
|
};
|
|
3426
|
-
function
|
|
3423
|
+
function su(t) {
|
|
3427
3424
|
return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: a }) {
|
|
3428
3425
|
const u = {
|
|
3429
3426
|
app_id: n,
|
|
@@ -3438,7 +3435,7 @@ function ou(t) {
|
|
|
3438
3435
|
});
|
|
3439
3436
|
});
|
|
3440
3437
|
}
|
|
3441
|
-
function
|
|
3438
|
+
function ou(t) {
|
|
3442
3439
|
return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
3443
3440
|
const { data: s } = yield ue(`${e}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3444
3441
|
method: "DELETE",
|
|
@@ -3450,7 +3447,7 @@ function au(t) {
|
|
|
3450
3447
|
return s;
|
|
3451
3448
|
});
|
|
3452
3449
|
}
|
|
3453
|
-
function
|
|
3450
|
+
function au(t) {
|
|
3454
3451
|
return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
|
|
3455
3452
|
const { data: o } = yield ue(`${e}/storage/signed-upload-url`, {
|
|
3456
3453
|
method: "POST",
|
|
@@ -3466,7 +3463,7 @@ function uu(t) {
|
|
|
3466
3463
|
return o;
|
|
3467
3464
|
});
|
|
3468
3465
|
}
|
|
3469
|
-
function
|
|
3466
|
+
function uu(t, e) {
|
|
3470
3467
|
return ft(this, void 0, void 0, function* () {
|
|
3471
3468
|
return (yield fetch(t, {
|
|
3472
3469
|
method: "PUT",
|
|
@@ -3477,7 +3474,7 @@ function cu(t, e) {
|
|
|
3477
3474
|
})).ok;
|
|
3478
3475
|
});
|
|
3479
3476
|
}
|
|
3480
|
-
function
|
|
3477
|
+
function cu(t) {
|
|
3481
3478
|
return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
3482
3479
|
const { data: s } = yield ue(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3483
3480
|
method: "GET",
|
|
@@ -3489,9 +3486,9 @@ function du(t) {
|
|
|
3489
3486
|
return s;
|
|
3490
3487
|
});
|
|
3491
3488
|
}
|
|
3492
|
-
let
|
|
3493
|
-
typeof window < "u" && typeof window.localStorage < "u" && (
|
|
3494
|
-
function
|
|
3489
|
+
let Vn = !1, Wi = !1, zi = !1;
|
|
3490
|
+
typeof window < "u" && typeof window.localStorage < "u" && (Vn = !!window.localStorage.getItem("devBackend"), Wi = !!window.localStorage.getItem("__instantLogging"), zi = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
3491
|
+
function Ur(t, e) {
|
|
3495
3492
|
if (!e)
|
|
3496
3493
|
return t;
|
|
3497
3494
|
const n = {};
|
|
@@ -3499,33 +3496,33 @@ function Lr(t, e) {
|
|
|
3499
3496
|
n[r] = t[r];
|
|
3500
3497
|
}), n;
|
|
3501
3498
|
}
|
|
3502
|
-
function
|
|
3499
|
+
function du(t, e, n) {
|
|
3503
3500
|
var r, i;
|
|
3504
3501
|
const s = {
|
|
3505
3502
|
peers: {}
|
|
3506
3503
|
};
|
|
3507
3504
|
if (e && "user" in e ? e.user : !0) {
|
|
3508
|
-
const a =
|
|
3505
|
+
const a = Ur((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
|
|
3509
3506
|
s.user = Object.assign(Object.assign({}, a), { peerId: n });
|
|
3510
3507
|
}
|
|
3511
3508
|
for (const a of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
|
|
3512
3509
|
const u = (e == null ? void 0 : e.peers) === void 0, c = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(a));
|
|
3513
3510
|
if (u || c) {
|
|
3514
|
-
const d =
|
|
3511
|
+
const d = Ur(t.peers[a], e == null ? void 0 : e.keys);
|
|
3515
3512
|
s.peers[a] = Object.assign(Object.assign({}, d), { peerId: a });
|
|
3516
3513
|
}
|
|
3517
3514
|
}
|
|
3518
3515
|
return s;
|
|
3519
3516
|
}
|
|
3520
|
-
function
|
|
3521
|
-
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !
|
|
3517
|
+
function fu(t, e) {
|
|
3518
|
+
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !vr(t.user, e.user)) || !gi(t.peers, e.peers))
|
|
3522
3519
|
return !0;
|
|
3523
3520
|
for (const r of Object.keys(t.peers))
|
|
3524
|
-
if (!
|
|
3521
|
+
if (!vr(t.peers[r], e.peers[r]))
|
|
3525
3522
|
return !0;
|
|
3526
3523
|
return !1;
|
|
3527
3524
|
}
|
|
3528
|
-
class
|
|
3525
|
+
class Lr {
|
|
3529
3526
|
constructor() {
|
|
3530
3527
|
this.promise = new Promise((e, n) => {
|
|
3531
3528
|
this._resolve = e, this._reject = n;
|
|
@@ -3538,20 +3535,20 @@ class Fr {
|
|
|
3538
3535
|
this._reject(e);
|
|
3539
3536
|
}
|
|
3540
3537
|
}
|
|
3541
|
-
function
|
|
3538
|
+
function Vi(t, e = []) {
|
|
3542
3539
|
t.forEach((n) => {
|
|
3543
3540
|
const { data: r } = n, { "datalog-result": i } = r, { "join-rows": s } = i;
|
|
3544
3541
|
for (const o of s)
|
|
3545
3542
|
for (const a of o)
|
|
3546
3543
|
e.push(a);
|
|
3547
|
-
|
|
3544
|
+
Vi(n["child-nodes"], e);
|
|
3548
3545
|
});
|
|
3549
3546
|
}
|
|
3550
|
-
function
|
|
3547
|
+
function Fr(t) {
|
|
3551
3548
|
const e = [];
|
|
3552
|
-
return
|
|
3549
|
+
return Vi(t, e), e;
|
|
3553
3550
|
}
|
|
3554
|
-
function
|
|
3551
|
+
function Nr(t) {
|
|
3555
3552
|
return Object.values(t.links).reduce((e, n) => {
|
|
3556
3553
|
var r, i, s, o;
|
|
3557
3554
|
return (r = e[s = n.forward.on]) !== null && r !== void 0 || (e[s] = {}), e[n.forward.on][n.forward.label] = {
|
|
@@ -3565,8 +3562,8 @@ function Kr(t) {
|
|
|
3565
3562
|
}, e;
|
|
3566
3563
|
}, {});
|
|
3567
3564
|
}
|
|
3568
|
-
const
|
|
3569
|
-
function
|
|
3565
|
+
const Bn = "v0.22.88-experimental.drewh-fix-explorer.20249092035.1";
|
|
3566
|
+
function lu(t, e) {
|
|
3570
3567
|
return {
|
|
3571
3568
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
3572
3569
|
},
|
|
@@ -3639,7 +3636,7 @@ class R extends Error {
|
|
|
3639
3636
|
super(r), this.name = "QueryValidationError";
|
|
3640
3637
|
}
|
|
3641
3638
|
}
|
|
3642
|
-
const
|
|
3639
|
+
const Kr = [
|
|
3643
3640
|
"where",
|
|
3644
3641
|
"order",
|
|
3645
3642
|
"limit",
|
|
@@ -3650,7 +3647,7 @@ const qr = [
|
|
|
3650
3647
|
"before",
|
|
3651
3648
|
"fields",
|
|
3652
3649
|
"aggregate"
|
|
3653
|
-
],
|
|
3650
|
+
], hu = (t) => t.valueType || "unknown", Bi = (t, e, n = !1) => {
|
|
3654
3651
|
if (n || t == null)
|
|
3655
3652
|
return !0;
|
|
3656
3653
|
switch (e) {
|
|
@@ -3665,9 +3662,9 @@ const qr = [
|
|
|
3665
3662
|
default:
|
|
3666
3663
|
return !0;
|
|
3667
3664
|
}
|
|
3668
|
-
},
|
|
3665
|
+
}, pu = (t, e, n, r, i, s, o) => {
|
|
3669
3666
|
const a = s.valueType === "json", u = (c, d, f) => {
|
|
3670
|
-
if (!
|
|
3667
|
+
if (!Bi(f, d, a))
|
|
3671
3668
|
throw new R(`Invalid value for operator '${c}' on attribute '${r}' in entity '${i}'. Expected ${d}, but received: ${typeof f}`, o);
|
|
3672
3669
|
};
|
|
3673
3670
|
switch (t) {
|
|
@@ -3698,16 +3695,16 @@ const qr = [
|
|
|
3698
3695
|
throw new R(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
|
|
3699
3696
|
}
|
|
3700
3697
|
}, Ue = (t, e, n, r, i) => {
|
|
3701
|
-
const s =
|
|
3698
|
+
const s = hu(n), o = n.valueType === "json";
|
|
3702
3699
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
3703
3700
|
if (o)
|
|
3704
3701
|
return;
|
|
3705
3702
|
const u = t;
|
|
3706
3703
|
for (const [c, d] of Object.entries(u))
|
|
3707
|
-
|
|
3708
|
-
} else if (!
|
|
3704
|
+
pu(c, d, s, e, r, n, `${i}.${c}`);
|
|
3705
|
+
} else if (!Bi(t, s, o))
|
|
3709
3706
|
throw new R(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
|
|
3710
|
-
},
|
|
3707
|
+
}, yu = (t, e, n, r, i) => {
|
|
3711
3708
|
const s = t.split(".");
|
|
3712
3709
|
if (s.length < 2)
|
|
3713
3710
|
throw new R(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
|
|
@@ -3744,12 +3741,12 @@ const qr = [
|
|
|
3744
3741
|
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);
|
|
3745
3742
|
}
|
|
3746
3743
|
Ue(e, t, c, n, i);
|
|
3747
|
-
},
|
|
3744
|
+
}, Gi = (t, e, n, r) => {
|
|
3748
3745
|
for (const [i, s] of Object.entries(t)) {
|
|
3749
3746
|
if (i === "or" || i === "and") {
|
|
3750
3747
|
if (Array.isArray(s))
|
|
3751
3748
|
for (const c of s)
|
|
3752
|
-
typeof c == "object" && c !== null &&
|
|
3749
|
+
typeof c == "object" && c !== null && Gi(c, e, n, `${r}.${i}[${c}]`);
|
|
3753
3750
|
continue;
|
|
3754
3751
|
}
|
|
3755
3752
|
if (i === "id") {
|
|
@@ -3757,7 +3754,7 @@ const qr = [
|
|
|
3757
3754
|
continue;
|
|
3758
3755
|
}
|
|
3759
3756
|
if (i.includes(".")) {
|
|
3760
|
-
|
|
3757
|
+
yu(i, s, e, n, `${r}.${i}`);
|
|
3761
3758
|
continue;
|
|
3762
3759
|
}
|
|
3763
3760
|
const o = n.entities[e];
|
|
@@ -3777,10 +3774,10 @@ const qr = [
|
|
|
3777
3774
|
Ue(s, i, c, e, `${r}.${i}`);
|
|
3778
3775
|
}
|
|
3779
3776
|
}
|
|
3780
|
-
},
|
|
3777
|
+
}, bu = (t, e, n, r, i = 0) => {
|
|
3781
3778
|
for (const o of Object.keys(t))
|
|
3782
|
-
if (!
|
|
3783
|
-
throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${
|
|
3779
|
+
if (!Kr.includes(o))
|
|
3780
|
+
throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Kr.join(", ")}. Found: ${o}`, r);
|
|
3784
3781
|
const s = [
|
|
3785
3782
|
// 'limit', // only supported client side
|
|
3786
3783
|
"offset",
|
|
@@ -3795,9 +3792,9 @@ const qr = [
|
|
|
3795
3792
|
if (t.where && n) {
|
|
3796
3793
|
if (typeof t.where != "object" || t.where === null)
|
|
3797
3794
|
throw new R(`'where' clause must be an object in entity '${e}', but received: ${typeof t.where}`, r ? `${r}.where` : void 0);
|
|
3798
|
-
|
|
3795
|
+
Gi(t.where, e, n, r ? `${r}.where` : "where");
|
|
3799
3796
|
}
|
|
3800
|
-
},
|
|
3797
|
+
}, Qi = (t, e, n, r, i = 0) => {
|
|
3801
3798
|
var s;
|
|
3802
3799
|
if (!t || typeof t != "object")
|
|
3803
3800
|
throw new R(`Query part for entity '${e}' must be an object, but received: ${typeof t}`, r);
|
|
@@ -3810,15 +3807,15 @@ const qr = [
|
|
|
3810
3807
|
const a = t[o];
|
|
3811
3808
|
if (typeof a == "object" && a !== null) {
|
|
3812
3809
|
const u = (s = n == null ? void 0 : n.entities[e].links[o]) === null || s === void 0 ? void 0 : s.entityName;
|
|
3813
|
-
u &&
|
|
3810
|
+
u && Qi(a, u, n, `${r}.${o}`, i + 1);
|
|
3814
3811
|
}
|
|
3815
3812
|
} else {
|
|
3816
3813
|
const a = t[o];
|
|
3817
3814
|
if (typeof a != "object" || a === null)
|
|
3818
3815
|
throw new R(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
3819
|
-
|
|
3816
|
+
bu(a, e, n, `${r}.$`, i);
|
|
3820
3817
|
}
|
|
3821
|
-
},
|
|
3818
|
+
}, qr = (t, e) => {
|
|
3822
3819
|
if (typeof t != "object" || t === null)
|
|
3823
3820
|
throw new R(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
|
|
3824
3821
|
if (Array.isArray(t))
|
|
@@ -3834,67 +3831,67 @@ const qr = [
|
|
|
3834
3831
|
const i = Object.keys(e.entities);
|
|
3835
3832
|
throw new R(`Entity '${r}' does not exist in schema. Available entities: ${i.length > 0 ? i.join(", ") : "none"}`, r);
|
|
3836
3833
|
}
|
|
3837
|
-
|
|
3834
|
+
Qi(n[r], r, e, r, 0);
|
|
3838
3835
|
}
|
|
3839
3836
|
}
|
|
3840
|
-
},
|
|
3837
|
+
}, Wr = (t) => typeof t != "string" ? !1 : Mt(t) ? !0 : Fe(t);
|
|
3841
3838
|
class ie extends Error {
|
|
3842
3839
|
constructor(e) {
|
|
3843
3840
|
super(e), this.name = "TransactionValidationError";
|
|
3844
3841
|
}
|
|
3845
3842
|
}
|
|
3846
|
-
const
|
|
3843
|
+
const Hi = (t) => t.length > 0 ? t.join(", ") : "none", _u = (t, e) => new ie(`Entity '${t}' does not exist in schema. Available entities: ${Hi(e)}`), zr = {
|
|
3847
3844
|
string: (t) => typeof t == "string",
|
|
3848
3845
|
number: (t) => typeof t == "number" && !isNaN(t),
|
|
3849
3846
|
boolean: (t) => typeof t == "boolean",
|
|
3850
3847
|
date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
|
|
3851
3848
|
json: () => !0
|
|
3852
|
-
},
|
|
3849
|
+
}, gu = (t, e) => {
|
|
3853
3850
|
var n, r;
|
|
3854
|
-
return t == null ? !0 : (r = (n =
|
|
3855
|
-
},
|
|
3851
|
+
return t == null ? !0 : (r = (n = zr[e.valueType]) === null || n === void 0 ? void 0 : n.call(zr, t)) !== null && r !== void 0 ? r : !1;
|
|
3852
|
+
}, Yi = (t, e) => {
|
|
3856
3853
|
const n = e.entities[t];
|
|
3857
3854
|
if (!n)
|
|
3858
|
-
throw
|
|
3855
|
+
throw _u(t, Object.keys(e.entities));
|
|
3859
3856
|
return n;
|
|
3860
|
-
},
|
|
3861
|
-
const r =
|
|
3857
|
+
}, Jt = (t, e, n) => {
|
|
3858
|
+
const r = Yi(t, n);
|
|
3862
3859
|
if (typeof e != "object" || e === null)
|
|
3863
3860
|
throw new ie(`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
3864
3861
|
for (const [i, s] of Object.entries(e)) {
|
|
3865
3862
|
if (i === "id")
|
|
3866
3863
|
continue;
|
|
3867
3864
|
const o = r.attrs[i];
|
|
3868
|
-
if (o && !
|
|
3865
|
+
if (o && !gu(s, o))
|
|
3869
3866
|
throw new ie(`Invalid value for attribute '${i}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof s}`);
|
|
3870
3867
|
}
|
|
3871
|
-
},
|
|
3872
|
-
const r =
|
|
3868
|
+
}, Vr = (t, e, n) => {
|
|
3869
|
+
const r = Yi(t, n);
|
|
3873
3870
|
if (typeof e != "object" || e === null)
|
|
3874
3871
|
throw new ie(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
3875
3872
|
for (const [i, s] of Object.entries(e)) {
|
|
3876
3873
|
if (!r.links[i]) {
|
|
3877
3874
|
const a = Object.keys(r.links);
|
|
3878
|
-
throw new ie(`Link '${i}' does not exist on entity '${t}'. Available links: ${
|
|
3875
|
+
throw new ie(`Link '${i}' does not exist on entity '${t}'. Available links: ${Hi(a)}`);
|
|
3879
3876
|
}
|
|
3880
3877
|
if (s != null) {
|
|
3881
3878
|
if (Array.isArray(s)) {
|
|
3882
3879
|
for (const a of s)
|
|
3883
|
-
if (!
|
|
3880
|
+
if (!Wr(a))
|
|
3884
3881
|
throw new ie(`Invalid entity ID in link '${i}' for entity '${t}'. Expected a UUID or a lookup, but received: ${a}`);
|
|
3885
|
-
} else if (!
|
|
3882
|
+
} else if (!Wr(s))
|
|
3886
3883
|
throw new ie(`Invalid UUID in link '${i}' for entity '${t}'. Expected a UUID, but received: ${s}`);
|
|
3887
3884
|
}
|
|
3888
3885
|
}
|
|
3889
|
-
},
|
|
3890
|
-
create:
|
|
3891
|
-
update:
|
|
3892
|
-
merge:
|
|
3893
|
-
link:
|
|
3894
|
-
unlink:
|
|
3886
|
+
}, Tu = {
|
|
3887
|
+
create: Jt,
|
|
3888
|
+
update: Jt,
|
|
3889
|
+
merge: Jt,
|
|
3890
|
+
link: Vr,
|
|
3891
|
+
unlink: Vr,
|
|
3895
3892
|
delete: () => {
|
|
3896
3893
|
}
|
|
3897
|
-
},
|
|
3894
|
+
}, wu = (t, e) => {
|
|
3898
3895
|
if (!e)
|
|
3899
3896
|
return;
|
|
3900
3897
|
const [n, r, i, s] = t;
|
|
@@ -3902,9 +3899,9 @@ const Yi = (t) => t.length > 0 ? t.join(", ") : "none", gu = (t, e) => new ie(`E
|
|
|
3902
3899
|
throw new ie(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
|
|
3903
3900
|
if (typeof r != "string")
|
|
3904
3901
|
throw new ie(`Entity name must be a string, but received: ${typeof r}`);
|
|
3905
|
-
const o =
|
|
3902
|
+
const o = Tu[n];
|
|
3906
3903
|
o && s !== void 0 && o(r, s, e);
|
|
3907
|
-
},
|
|
3904
|
+
}, mu = (t, e) => {
|
|
3908
3905
|
const n = Array.isArray(t) ? t : [t];
|
|
3909
3906
|
for (const r of n) {
|
|
3910
3907
|
if (!r || typeof r != "object")
|
|
@@ -3914,11 +3911,11 @@ const Yi = (t) => t.length > 0 ? t.join(", ") : "none", gu = (t, e) => new ie(`E
|
|
|
3914
3911
|
for (const i of r.__ops) {
|
|
3915
3912
|
if (!Array.isArray(i))
|
|
3916
3913
|
throw new ie(`Transaction operation must be an array, but received: ${typeof i}`);
|
|
3917
|
-
|
|
3914
|
+
wu(i, e);
|
|
3918
3915
|
}
|
|
3919
3916
|
}
|
|
3920
3917
|
};
|
|
3921
|
-
var
|
|
3918
|
+
var Br = function(t, e, n, r) {
|
|
3922
3919
|
function i(s) {
|
|
3923
3920
|
return s instanceof n ? s : new n(function(o) {
|
|
3924
3921
|
o(s);
|
|
@@ -3945,10 +3942,10 @@ var Gr = function(t, e, n, r) {
|
|
|
3945
3942
|
c((r = r.apply(t, e || [])).next());
|
|
3946
3943
|
});
|
|
3947
3944
|
};
|
|
3948
|
-
let
|
|
3949
|
-
class
|
|
3945
|
+
let Ji = 0;
|
|
3946
|
+
class Gr {
|
|
3950
3947
|
constructor(e) {
|
|
3951
|
-
this.type = "ws", this.id = `${this.type}_${
|
|
3948
|
+
this.type = "ws", this.id = `${this.type}_${Ji++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
|
|
3952
3949
|
this.onopen && this.onopen({ target: this });
|
|
3953
3950
|
}, this.conn.onmessage = (n) => {
|
|
3954
3951
|
this.onmessage && this.onmessage({
|
|
@@ -3976,9 +3973,9 @@ class Qr {
|
|
|
3976
3973
|
return this.conn.send(JSON.stringify(e));
|
|
3977
3974
|
}
|
|
3978
3975
|
}
|
|
3979
|
-
class
|
|
3976
|
+
class vu {
|
|
3980
3977
|
constructor(e, n) {
|
|
3981
|
-
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${
|
|
3978
|
+
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${Ji++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
|
|
3982
3979
|
this.initParams || this.handleError();
|
|
3983
3980
|
}, 1e4), this.conn.onmessage = (r) => {
|
|
3984
3981
|
const i = JSON.parse(r.data);
|
|
@@ -4017,7 +4014,7 @@ class Su {
|
|
|
4017
4014
|
this.conn.close(), this.onclose && !this.closeFired && (this.closeFired = !0, this.onclose({ target: this }));
|
|
4018
4015
|
}
|
|
4019
4016
|
postMessages(e) {
|
|
4020
|
-
return
|
|
4017
|
+
return Br(this, void 0, void 0, function* () {
|
|
4021
4018
|
var n, r, i;
|
|
4022
4019
|
try {
|
|
4023
4020
|
(yield fetch(this.url, {
|
|
@@ -4036,7 +4033,7 @@ class Su {
|
|
|
4036
4033
|
});
|
|
4037
4034
|
}
|
|
4038
4035
|
flushQueue() {
|
|
4039
|
-
return
|
|
4036
|
+
return Br(this, void 0, void 0, function* () {
|
|
4040
4037
|
if (this.sendPromise || !this.sendQueue.length)
|
|
4041
4038
|
return;
|
|
4042
4039
|
const e = this.sendQueue;
|
|
@@ -4062,7 +4059,7 @@ class Su {
|
|
|
4062
4059
|
this.handleClose();
|
|
4063
4060
|
}
|
|
4064
4061
|
}
|
|
4065
|
-
var
|
|
4062
|
+
var Qr = function(t, e, n, r) {
|
|
4066
4063
|
function i(s) {
|
|
4067
4064
|
return s instanceof n ? s : new n(function(o) {
|
|
4068
4065
|
o(s);
|
|
@@ -4089,34 +4086,34 @@ var Hr = function(t, e, n, r) {
|
|
|
4089
4086
|
c((r = r.apply(t, e || [])).next());
|
|
4090
4087
|
});
|
|
4091
4088
|
};
|
|
4092
|
-
function
|
|
4089
|
+
function Su(t, e) {
|
|
4093
4090
|
const n = t.values;
|
|
4094
4091
|
if (n)
|
|
4095
4092
|
for (const r of n.entities || [])
|
|
4096
|
-
r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store =
|
|
4093
|
+
r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store = Oi(r.store);
|
|
4097
4094
|
return t;
|
|
4098
4095
|
}
|
|
4099
|
-
function
|
|
4096
|
+
function Ou(t, e) {
|
|
4100
4097
|
var n, r;
|
|
4101
4098
|
if (!((n = e.values) === null || n === void 0) && n.entities) {
|
|
4102
4099
|
const i = [];
|
|
4103
4100
|
for (const s of (r = e.values) === null || r === void 0 ? void 0 : r.entities) {
|
|
4104
|
-
const o =
|
|
4101
|
+
const o = Si(s.store);
|
|
4105
4102
|
delete o.attrs, i.push(Object.assign(Object.assign({}, s), { store: o }));
|
|
4106
4103
|
}
|
|
4107
4104
|
return Object.assign(Object.assign({}, e), { values: Object.assign(Object.assign({}, e.values), { entities: i }) });
|
|
4108
4105
|
} else
|
|
4109
4106
|
return e;
|
|
4110
4107
|
}
|
|
4111
|
-
function
|
|
4108
|
+
function Eu(t, e, n) {
|
|
4112
4109
|
var r, i;
|
|
4113
4110
|
const s = (r = e == null ? void 0 : e.state) === null || r === void 0 ? void 0 : r.txId, o = (i = n == null ? void 0 : n.state) === null || i === void 0 ? void 0 : i.txId;
|
|
4114
4111
|
return s && (!o || s > o) ? e : o && (!s || o > s) ? n : e || n;
|
|
4115
4112
|
}
|
|
4116
|
-
function
|
|
4117
|
-
return
|
|
4113
|
+
function Zt(t, e) {
|
|
4114
|
+
return Ui({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4118
4115
|
}
|
|
4119
|
-
function
|
|
4116
|
+
function Hr(t, e, n) {
|
|
4120
4117
|
var r;
|
|
4121
4118
|
const i = (r = Te(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
|
|
4122
4119
|
if (!i)
|
|
@@ -4124,18 +4121,18 @@ function Yr(t, e, n) {
|
|
|
4124
4121
|
const s = We(e.eav, [n, i, n]);
|
|
4125
4122
|
return s ? s[3] : -1;
|
|
4126
4123
|
}
|
|
4127
|
-
function
|
|
4124
|
+
function Yr(t, e) {
|
|
4128
4125
|
for (const { action: n, triple: r } of e)
|
|
4129
4126
|
switch (n) {
|
|
4130
4127
|
case "added":
|
|
4131
|
-
|
|
4128
|
+
ji(t, r);
|
|
4132
4129
|
break;
|
|
4133
4130
|
case "removed":
|
|
4134
|
-
|
|
4131
|
+
Ei(t, r);
|
|
4135
4132
|
break;
|
|
4136
4133
|
}
|
|
4137
4134
|
}
|
|
4138
|
-
function
|
|
4135
|
+
function Au(t, e) {
|
|
4139
4136
|
var n, r, i, s;
|
|
4140
4137
|
const o = {};
|
|
4141
4138
|
for (const { action: a, triple: u } of e) {
|
|
@@ -4163,14 +4160,14 @@ function ju(t, e) {
|
|
|
4163
4160
|
function wt(t, e) {
|
|
4164
4161
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4165
4162
|
}
|
|
4166
|
-
function
|
|
4163
|
+
function ju(t, e) {
|
|
4167
4164
|
var n;
|
|
4168
4165
|
if (t.orderFieldType)
|
|
4169
4166
|
return t.orderFieldType;
|
|
4170
4167
|
const r = t.orderField === "serverCreatedAt" ? "number" : (n = Te(e([]), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
|
|
4171
4168
|
return t.orderFieldType = r, r;
|
|
4172
4169
|
}
|
|
4173
|
-
function
|
|
4170
|
+
function ku(t, e, n) {
|
|
4174
4171
|
const r = e;
|
|
4175
4172
|
if (t.orderField === "serverCreatedAt") {
|
|
4176
4173
|
n.sort(t.orderDirection === "asc" ? function(o, a) {
|
|
@@ -4191,13 +4188,13 @@ var ve;
|
|
|
4191
4188
|
(function(t) {
|
|
4192
4189
|
t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
|
|
4193
4190
|
})(ve || (ve = {}));
|
|
4194
|
-
class
|
|
4191
|
+
class Cu {
|
|
4195
4192
|
constructor(e, n, r, i, s) {
|
|
4196
|
-
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new
|
|
4193
|
+
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Tn({
|
|
4197
4194
|
persister: n,
|
|
4198
|
-
merge:
|
|
4199
|
-
serialize:
|
|
4200
|
-
parse: (o, a) =>
|
|
4195
|
+
merge: Eu,
|
|
4196
|
+
serialize: Ou,
|
|
4197
|
+
parse: (o, a) => Su(a, this.config.useDateObjects),
|
|
4201
4198
|
objectSize: (o) => {
|
|
4202
4199
|
var a;
|
|
4203
4200
|
return ((a = o.values) === null || a === void 0 ? void 0 : a.entities.length) || 0;
|
|
@@ -4254,7 +4251,7 @@ class Pu {
|
|
|
4254
4251
|
});
|
|
4255
4252
|
}
|
|
4256
4253
|
initSubscription(e, n, r) {
|
|
4257
|
-
return
|
|
4254
|
+
return Qr(this, void 0, void 0, function* () {
|
|
4258
4255
|
var i, s, o, a;
|
|
4259
4256
|
yield this.subs.waitForKeyToLoad(n);
|
|
4260
4257
|
const u = this.subs.currentValue[n];
|
|
@@ -4280,7 +4277,7 @@ class Pu {
|
|
|
4280
4277
|
});
|
|
4281
4278
|
}
|
|
4282
4279
|
flushPending() {
|
|
4283
|
-
return
|
|
4280
|
+
return Qr(this, void 0, void 0, function* () {
|
|
4284
4281
|
for (const e of Object.keys(this.callbacks)) {
|
|
4285
4282
|
yield this.subs.waitForKeyToLoad(e);
|
|
4286
4283
|
const n = this.subs.currentValue[e];
|
|
@@ -4325,11 +4322,11 @@ class Pu {
|
|
|
4325
4322
|
for (const d of i) {
|
|
4326
4323
|
const f = this.createStore(d);
|
|
4327
4324
|
u.attrs = f.attrs;
|
|
4328
|
-
const l =
|
|
4325
|
+
const l = Zt(a, f);
|
|
4329
4326
|
c.push({
|
|
4330
4327
|
store: f,
|
|
4331
4328
|
entity: l,
|
|
4332
|
-
serverCreatedAt:
|
|
4329
|
+
serverCreatedAt: Hr(a, f, l.id)
|
|
4333
4330
|
}), o.push(l);
|
|
4334
4331
|
}
|
|
4335
4332
|
this.subs.updateInPlace((d) => {
|
|
@@ -4399,9 +4396,9 @@ class Pu {
|
|
|
4399
4396
|
e: for (const [g, m] of Object.entries(f))
|
|
4400
4397
|
for (let E = 0; E < p.length; E++) {
|
|
4401
4398
|
const S = p[E];
|
|
4402
|
-
if (
|
|
4403
|
-
|
|
4404
|
-
const I =
|
|
4399
|
+
if (ao(S.store, g)) {
|
|
4400
|
+
Yr(S.store, m);
|
|
4401
|
+
const I = Zt(a, S.store), x = Au(S.store, m)[g];
|
|
4405
4402
|
I ? (y.push({
|
|
4406
4403
|
oldEntity: S.entity,
|
|
4407
4404
|
newEntity: I,
|
|
@@ -4413,8 +4410,8 @@ class Pu {
|
|
|
4413
4410
|
const b = [];
|
|
4414
4411
|
for (const [g, m] of Object.entries(f)) {
|
|
4415
4412
|
const E = this.createStore([]);
|
|
4416
|
-
l.attrs = E.attrs,
|
|
4417
|
-
const S =
|
|
4413
|
+
l.attrs = E.attrs, Yr(E, m);
|
|
4414
|
+
const S = Zt(a, E);
|
|
4418
4415
|
if (!S) {
|
|
4419
4416
|
this.log.error("No entity found after applying change", {
|
|
4420
4417
|
sub: a,
|
|
@@ -4426,14 +4423,14 @@ class Pu {
|
|
|
4426
4423
|
p.push({
|
|
4427
4424
|
store: E,
|
|
4428
4425
|
entity: S,
|
|
4429
|
-
serverCreatedAt:
|
|
4426
|
+
serverCreatedAt: Hr(a, E, S.id)
|
|
4430
4427
|
}), b.push(S);
|
|
4431
4428
|
}
|
|
4432
4429
|
const _ = [];
|
|
4433
4430
|
for (const g of d.sort().reverse())
|
|
4434
4431
|
_.push(p[g].entity), p.splice(g, 1);
|
|
4435
|
-
const w =
|
|
4436
|
-
|
|
4432
|
+
const w = ju(a, this.createStore);
|
|
4433
|
+
ku(a, w, p), this.notifyCbs(o, {
|
|
4437
4434
|
type: ve.SyncTransaction,
|
|
4438
4435
|
data: wt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
|
|
4439
4436
|
added: b,
|
|
@@ -4500,7 +4497,7 @@ var F = function(t, e, n, r) {
|
|
|
4500
4497
|
}
|
|
4501
4498
|
c((r = r.apply(t, e || [])).next());
|
|
4502
4499
|
});
|
|
4503
|
-
},
|
|
4500
|
+
}, Pu = function(t, e) {
|
|
4504
4501
|
var n = {};
|
|
4505
4502
|
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
4506
4503
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -4514,46 +4511,46 @@ const le = {
|
|
|
4514
4511
|
AUTHENTICATED: "authenticated",
|
|
4515
4512
|
CLOSED: "closed",
|
|
4516
4513
|
ERRORED: "errored"
|
|
4517
|
-
},
|
|
4514
|
+
}, Iu = 3e4, Mu = 3e4, Ru = 200, xu = {
|
|
4518
4515
|
apiURI: "https://api.instantdb.com",
|
|
4519
4516
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
4520
|
-
},
|
|
4521
|
-
function
|
|
4517
|
+
}, Xt = "_instant_oauth_redirect", Qe = "currentUser";
|
|
4518
|
+
function $u({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
4522
4519
|
if (!i)
|
|
4523
|
-
return new
|
|
4520
|
+
return new Gr(`${r}?app_id=${e}`);
|
|
4524
4521
|
switch (t) {
|
|
4525
4522
|
case "ws":
|
|
4526
|
-
return new
|
|
4523
|
+
return new Gr(`${r}?app_id=${e}`);
|
|
4527
4524
|
case "sse":
|
|
4528
|
-
return new
|
|
4525
|
+
return new vu(i, `${n}/runtime/sse?app_id=${e}`);
|
|
4529
4526
|
default:
|
|
4530
4527
|
throw new Error("Unknown transport type " + t);
|
|
4531
4528
|
}
|
|
4532
4529
|
}
|
|
4533
|
-
function
|
|
4530
|
+
function Du() {
|
|
4534
4531
|
return typeof window < "u" || typeof chrome < "u";
|
|
4535
4532
|
}
|
|
4536
|
-
const
|
|
4533
|
+
const Jr = {
|
|
4537
4534
|
"set-presence": !0,
|
|
4538
4535
|
"set-presence-ok": !0,
|
|
4539
4536
|
"refresh-presence": !0,
|
|
4540
4537
|
"patch-presence": !0
|
|
4541
4538
|
};
|
|
4542
|
-
function
|
|
4539
|
+
function Uu(t, e) {
|
|
4543
4540
|
var n;
|
|
4544
4541
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
4545
4542
|
if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
|
|
4546
4543
|
const i = r.result.store;
|
|
4547
|
-
r.result.store =
|
|
4544
|
+
r.result.store = Oi(Object.assign(Object.assign({}, i), { useDateObjects: e }));
|
|
4548
4545
|
}
|
|
4549
4546
|
return r;
|
|
4550
4547
|
}
|
|
4551
|
-
function
|
|
4548
|
+
function Lu(t, e) {
|
|
4552
4549
|
var n;
|
|
4553
4550
|
const r = Object.assign({}, e);
|
|
4554
|
-
return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store:
|
|
4551
|
+
return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: Si(e.result.store) })), r;
|
|
4555
4552
|
}
|
|
4556
|
-
function
|
|
4553
|
+
function Fu(t, e) {
|
|
4557
4554
|
switch (t) {
|
|
4558
4555
|
case "pendingMutations":
|
|
4559
4556
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -4561,7 +4558,7 @@ function Nu(t, e) {
|
|
|
4561
4558
|
return e;
|
|
4562
4559
|
}
|
|
4563
4560
|
}
|
|
4564
|
-
function
|
|
4561
|
+
function Nu(t, e) {
|
|
4565
4562
|
switch (t) {
|
|
4566
4563
|
case "pendingMutations":
|
|
4567
4564
|
return [...e.entries()];
|
|
@@ -4569,18 +4566,18 @@ function Ku(t, e) {
|
|
|
4569
4566
|
return e;
|
|
4570
4567
|
}
|
|
4571
4568
|
}
|
|
4572
|
-
function
|
|
4569
|
+
function Ku(t, e, n) {
|
|
4573
4570
|
const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
|
|
4574
4571
|
return r && !i && n && (n.result = r), n || e;
|
|
4575
4572
|
}
|
|
4576
|
-
function
|
|
4573
|
+
function Zr(t) {
|
|
4577
4574
|
return [...t].sort((e, n) => {
|
|
4578
4575
|
const [r, i] = e, [s, o] = n, a = i.order || 0, u = o.order || 0;
|
|
4579
4576
|
return a == u ? r < s ? -1 : r > s ? 1 : 0 : a - u;
|
|
4580
4577
|
});
|
|
4581
4578
|
}
|
|
4582
|
-
class
|
|
4583
|
-
constructor(e, n =
|
|
4579
|
+
class qu {
|
|
4580
|
+
constructor(e, n = Ki, r = qi, i, s) {
|
|
4584
4581
|
var o, a, u;
|
|
4585
4582
|
if (this._isOnline = !0, this._isShutdown = !1, this.status = le.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) => {
|
|
4586
4583
|
var l, p;
|
|
@@ -4612,9 +4609,9 @@ class Wu {
|
|
|
4612
4609
|
}, this.notifyQueryError = (c, d) => {
|
|
4613
4610
|
(this.queryCbs[c] || []).forEach((l) => l.cb({ error: d }));
|
|
4614
4611
|
}, this.pushTx = (c) => {
|
|
4615
|
-
this.config.disableValidation ||
|
|
4612
|
+
this.config.disableValidation || mu(c, this.config.schema);
|
|
4616
4613
|
try {
|
|
4617
|
-
const d =
|
|
4614
|
+
const d = Wa({
|
|
4618
4615
|
attrs: this.optimisticAttrs(),
|
|
4619
4616
|
schema: this.config.schema,
|
|
4620
4617
|
stores: Object.values(this.querySubs.currentValue).map((f) => {
|
|
@@ -4638,7 +4635,7 @@ class Wu {
|
|
|
4638
4635
|
this._updatePendingMutations((_) => {
|
|
4639
4636
|
_.set(f, y);
|
|
4640
4637
|
});
|
|
4641
|
-
const b = new
|
|
4638
|
+
const b = new Lr();
|
|
4642
4639
|
return this.mutationDeferredStore.set(f, b), this._sendMutation(f, y), this.notifyAll(), b.promise;
|
|
4643
4640
|
}, this._transportOnOpen = (c) => {
|
|
4644
4641
|
const d = c.target;
|
|
@@ -4703,7 +4700,7 @@ class Wu {
|
|
|
4703
4700
|
return;
|
|
4704
4701
|
}
|
|
4705
4702
|
this._log.info("[socket][close]", d.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
4706
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({},
|
|
4703
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, xu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (a = this.config.pendingTxCleanupTimeout) !== null && a !== void 0 ? a : Mu, this._pendingMutationCleanupThreshold = (u = this.config.pendingMutationCleanupThreshold) !== null && u !== void 0 ? u : Ru, this._log = lu(e.verbose || Vn || Wi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Bn }), this.config.schema && (this._linkIndex = Nr(this.config.schema)), !!Du()) {
|
|
4707
4704
|
if (!e.appId)
|
|
4708
4705
|
throw new Error("Instant must be initialized with an appId.");
|
|
4709
4706
|
if (!Fe(e.appId))
|
|
@@ -4718,7 +4715,7 @@ class Wu {
|
|
|
4718
4715
|
} catch (f) {
|
|
4719
4716
|
this._log.error("[error] handle broadcast channel", f);
|
|
4720
4717
|
}
|
|
4721
|
-
}))), this._initStorage(n), this._syncTable = new
|
|
4718
|
+
}))), this._initStorage(n), this._syncTable = new Cu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
4722
4719
|
useDateObjects: this.config.useDateObjects
|
|
4723
4720
|
}, this._log, (c) => Et(this.attrs, c, this.config.enableCardinalityInference, this._linkIndex, this.config.useDateObjects)), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((c) => {
|
|
4724
4721
|
this._isOnline = c, this._startSocket(), r.listen((d) => {
|
|
@@ -4728,7 +4725,7 @@ class Wu {
|
|
|
4728
4725
|
}
|
|
4729
4726
|
}
|
|
4730
4727
|
updateSchema(e) {
|
|
4731
|
-
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ?
|
|
4728
|
+
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ? Nr(this.config.schema) : null;
|
|
4732
4729
|
}
|
|
4733
4730
|
_reactorStats() {
|
|
4734
4731
|
return {
|
|
@@ -4741,11 +4738,11 @@ class Wu {
|
|
|
4741
4738
|
this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
|
|
4742
4739
|
}
|
|
4743
4740
|
_initStorage(e) {
|
|
4744
|
-
this.querySubs = new
|
|
4741
|
+
this.querySubs = new Tn({
|
|
4745
4742
|
persister: new e(this.config.appId, "querySubs"),
|
|
4746
|
-
merge:
|
|
4747
|
-
serialize:
|
|
4748
|
-
parse: (n, r) =>
|
|
4743
|
+
merge: Ku,
|
|
4744
|
+
serialize: Lu,
|
|
4745
|
+
parse: (n, r) => Uu(r, this.config.useDateObjects),
|
|
4749
4746
|
// objectSize
|
|
4750
4747
|
objectSize: (n) => {
|
|
4751
4748
|
var r, i, s, o;
|
|
@@ -4761,11 +4758,11 @@ class Wu {
|
|
|
4761
4758
|
maxSize: 1e6
|
|
4762
4759
|
// 1 million triples
|
|
4763
4760
|
}
|
|
4764
|
-
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new
|
|
4761
|
+
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Tn({
|
|
4765
4762
|
persister: new e(this.config.appId, "kv"),
|
|
4766
4763
|
merge: this._onMergeKv,
|
|
4767
|
-
serialize:
|
|
4768
|
-
parse:
|
|
4764
|
+
serialize: Nu,
|
|
4765
|
+
parse: Fu,
|
|
4769
4766
|
objectSize: () => 0,
|
|
4770
4767
|
logger: this._log,
|
|
4771
4768
|
saveThrottleMs: 100,
|
|
@@ -4796,7 +4793,7 @@ class Wu {
|
|
|
4796
4793
|
if (s)
|
|
4797
4794
|
i.resolve({ status: e, eventId: n });
|
|
4798
4795
|
else if (r != null && r.type) {
|
|
4799
|
-
const { status: o } = r, a =
|
|
4796
|
+
const { status: o } = r, a = Pu(r, ["status"]);
|
|
4800
4797
|
i.reject(new Dt({
|
|
4801
4798
|
// @ts-expect-error body.type is not constant typed
|
|
4802
4799
|
body: a,
|
|
@@ -4820,7 +4817,7 @@ class Wu {
|
|
|
4820
4817
|
_handleReceive(e, n) {
|
|
4821
4818
|
var r, i, s, o, a, u;
|
|
4822
4819
|
const c = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
4823
|
-
switch (
|
|
4820
|
+
switch (Jr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
4824
4821
|
case "init-ok": {
|
|
4825
4822
|
this._setStatus(le.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
4826
4823
|
for (const l of Object.keys(this._rooms)) {
|
|
@@ -4837,7 +4834,7 @@ class Wu {
|
|
|
4837
4834
|
const { q: l, result: p } = n, y = z(l);
|
|
4838
4835
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
4839
4836
|
break;
|
|
4840
|
-
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, w =
|
|
4837
|
+
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, w = Fr(p), g = Et(this.attrs, w, c, this._linkIndex, this.config.useDateObjects);
|
|
4841
4838
|
this.querySubs.updateInPlace((m) => {
|
|
4842
4839
|
if (!m[y]) {
|
|
4843
4840
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
@@ -4875,9 +4872,9 @@ class Wu {
|
|
|
4875
4872
|
b !== this._pendingMutations() && this.kv.updateInPlace((g) => {
|
|
4876
4873
|
g.pendingMutations = b;
|
|
4877
4874
|
});
|
|
4878
|
-
const _ =
|
|
4875
|
+
const _ = Zr(b.entries()), w = l.map((g) => {
|
|
4879
4876
|
var m, E, S, I;
|
|
4880
|
-
const x = g["instaql-query"], B = g["instaql-result"], Ve = z(x), lt =
|
|
4877
|
+
const x = g["instaql-query"], B = g["instaql-result"], Ve = z(x), lt = Fr(B), Ft = Et(this.attrs, lt, c, this._linkIndex, this.config.useDateObjects), Nt = this._applyOptimisticUpdates(Ft, _, y), ht = (E = (m = B == null ? void 0 : B[0]) === null || m === void 0 ? void 0 : m.data) === null || E === void 0 ? void 0 : E["page-info"], ce = (I = (S = B == null ? void 0 : B[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
|
|
4881
4878
|
return { q: x, hash: Ve, store: Nt, pageInfo: ht, aggregate: ce };
|
|
4882
4879
|
});
|
|
4883
4880
|
w.forEach(({ hash: g, q: m, store: E, pageInfo: S, aggregate: I }) => {
|
|
@@ -5040,7 +5037,7 @@ class Wu {
|
|
|
5040
5037
|
*/
|
|
5041
5038
|
subscribeQuery(e, n, r) {
|
|
5042
5039
|
var i;
|
|
5043
|
-
this.config.disableValidation ||
|
|
5040
|
+
this.config.disableValidation || qr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
|
|
5044
5041
|
const s = z(e), o = this.getPreviousResult(e);
|
|
5045
5042
|
return o && n(o), this.queryCbs[s] = (i = this.queryCbs[s]) !== null && i !== void 0 ? i : [], this.queryCbs[s].push({ q: e, cb: n }), this._startQuerySub(e, s), () => {
|
|
5046
5043
|
this._unsubQuery(e, s, n);
|
|
@@ -5048,14 +5045,14 @@ class Wu {
|
|
|
5048
5045
|
}
|
|
5049
5046
|
queryOnce(e, n) {
|
|
5050
5047
|
var r;
|
|
5051
|
-
this.config.disableValidation ||
|
|
5052
|
-
const i = new
|
|
5048
|
+
this.config.disableValidation || qr(e, this.config.schema), n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
5049
|
+
const i = new Lr();
|
|
5053
5050
|
if (!this._isOnline)
|
|
5054
5051
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
5055
5052
|
if (!this.querySubs)
|
|
5056
5053
|
return i.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), i.promise;
|
|
5057
5054
|
const s = z(e), o = this._startQuerySub(e, s);
|
|
5058
|
-
return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")),
|
|
5055
|
+
return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), Iu), i.promise;
|
|
5059
5056
|
}
|
|
5060
5057
|
_completeQueryOnce(e, n, r) {
|
|
5061
5058
|
this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
|
|
@@ -5116,7 +5113,7 @@ class Wu {
|
|
|
5116
5113
|
a = !0;
|
|
5117
5114
|
continue;
|
|
5118
5115
|
}
|
|
5119
|
-
const b = a ?
|
|
5116
|
+
const b = a ? Ta(o, p) : p;
|
|
5120
5117
|
l.push(b);
|
|
5121
5118
|
}
|
|
5122
5119
|
return a ? l : d;
|
|
@@ -5126,7 +5123,7 @@ class Wu {
|
|
|
5126
5123
|
return a ? c : n;
|
|
5127
5124
|
}
|
|
5128
5125
|
_rewriteMutationsSorted(e, n) {
|
|
5129
|
-
return
|
|
5126
|
+
return Zr(this._rewriteMutations(e, n).entries());
|
|
5130
5127
|
}
|
|
5131
5128
|
// ---------------------------
|
|
5132
5129
|
// Transact
|
|
@@ -5160,11 +5157,11 @@ class Wu {
|
|
|
5160
5157
|
if (c && r === c.querySubVersion && s === c.pendingMutationsVersion)
|
|
5161
5158
|
return c;
|
|
5162
5159
|
const { store: d, pageInfo: f, aggregate: l, processedTxId: p } = u, y = this._rewriteMutationsSorted(d.attrs, o), b = this._applyOptimisticUpdates(d, y, p);
|
|
5163
|
-
return { data:
|
|
5160
|
+
return { data: Ui({ store: b, pageInfo: f, aggregate: l }, a), querySubVersion: r, pendingMutationsVersion: s };
|
|
5164
5161
|
}
|
|
5165
5162
|
_applyOptimisticUpdates(e, n, r) {
|
|
5166
5163
|
for (const [i, s] of n)
|
|
5167
|
-
(!s["tx-id"] || r && s["tx-id"] > r) && (e =
|
|
5164
|
+
(!s["tx-id"] || r && s["tx-id"] > r) && (e = wo(e, s["tx-steps"]));
|
|
5168
5165
|
return e;
|
|
5169
5166
|
}
|
|
5170
5167
|
/** Re-compute all subscriptions */
|
|
@@ -5252,7 +5249,7 @@ class Wu {
|
|
|
5252
5249
|
}
|
|
5253
5250
|
_trySend(e, n, r) {
|
|
5254
5251
|
if (this._transport.isOpen()) {
|
|
5255
|
-
switch (
|
|
5252
|
+
switch (Jr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
|
|
5256
5253
|
case "transact": {
|
|
5257
5254
|
this._inFlightMutationEventIds.add(e);
|
|
5258
5255
|
break;
|
|
@@ -5273,7 +5270,7 @@ class Wu {
|
|
|
5273
5270
|
return;
|
|
5274
5271
|
}
|
|
5275
5272
|
const e = this._transport;
|
|
5276
|
-
this._transport =
|
|
5273
|
+
this._transport = $u({
|
|
5277
5274
|
transportType: this._transportType,
|
|
5278
5275
|
appId: this.config.appId,
|
|
5279
5276
|
apiURI: this.config.apiURI,
|
|
@@ -5309,9 +5306,9 @@ class Wu {
|
|
|
5309
5306
|
if (typeof URL > "u")
|
|
5310
5307
|
return;
|
|
5311
5308
|
const e = new URL(window.location.href);
|
|
5312
|
-
if (e.searchParams.get(
|
|
5309
|
+
if (e.searchParams.get(Xt)) {
|
|
5313
5310
|
const n = e.toString();
|
|
5314
|
-
e.searchParams.delete(
|
|
5311
|
+
e.searchParams.delete(Xt), e.searchParams.delete("code"), e.searchParams.delete("error");
|
|
5315
5312
|
const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
|
|
5316
5313
|
if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
|
|
5317
5314
|
typeof navigation == "object" && // @ts-ignore (waiting for ts support)
|
|
@@ -5336,7 +5333,7 @@ class Wu {
|
|
|
5336
5333
|
if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
|
|
5337
5334
|
return null;
|
|
5338
5335
|
const s = new URLSearchParams(window.location.search);
|
|
5339
|
-
if (!s.get(
|
|
5336
|
+
if (!s.get(Xt))
|
|
5340
5337
|
return null;
|
|
5341
5338
|
const o = s.get("error");
|
|
5342
5339
|
if (o)
|
|
@@ -5346,7 +5343,7 @@ class Wu {
|
|
|
5346
5343
|
return null;
|
|
5347
5344
|
this._replaceUrlAfterOAuth();
|
|
5348
5345
|
try {
|
|
5349
|
-
const u = yield this._getCurrentUser(), c = (u == null ? void 0 : u.type) === "guest", { user: d } = yield
|
|
5346
|
+
const u = yield this._getCurrentUser(), c = (u == null ? void 0 : u.type) === "guest", { user: d } = yield Dr({
|
|
5350
5347
|
apiURI: this.config.apiURI,
|
|
5351
5348
|
appId: this.config.appId,
|
|
5352
5349
|
code: a,
|
|
@@ -5476,7 +5473,7 @@ class Wu {
|
|
|
5476
5473
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
|
|
5477
5474
|
}
|
|
5478
5475
|
sendMagicCode({ email: e }) {
|
|
5479
|
-
return
|
|
5476
|
+
return Xa({
|
|
5480
5477
|
apiURI: this.config.apiURI,
|
|
5481
5478
|
appId: this.config.appId,
|
|
5482
5479
|
email: e
|
|
@@ -5485,7 +5482,7 @@ class Wu {
|
|
|
5485
5482
|
signInWithMagicCode(e) {
|
|
5486
5483
|
return F(this, arguments, void 0, function* ({ email: n, code: r }) {
|
|
5487
5484
|
var i;
|
|
5488
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield
|
|
5485
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield eu({
|
|
5489
5486
|
apiURI: this.config.apiURI,
|
|
5490
5487
|
appId: this.config.appId,
|
|
5491
5488
|
email: n,
|
|
@@ -5497,7 +5494,7 @@ class Wu {
|
|
|
5497
5494
|
}
|
|
5498
5495
|
signInWithCustomToken(e) {
|
|
5499
5496
|
return F(this, void 0, void 0, function* () {
|
|
5500
|
-
const n = yield
|
|
5497
|
+
const n = yield tu({
|
|
5501
5498
|
apiURI: this.config.apiURI,
|
|
5502
5499
|
appId: this.config.appId,
|
|
5503
5500
|
refreshToken: e
|
|
@@ -5507,7 +5504,7 @@ class Wu {
|
|
|
5507
5504
|
}
|
|
5508
5505
|
signInAsGuest() {
|
|
5509
5506
|
return F(this, void 0, void 0, function* () {
|
|
5510
|
-
const e = yield
|
|
5507
|
+
const e = yield nu({
|
|
5511
5508
|
apiURI: this.config.apiURI,
|
|
5512
5509
|
appId: this.config.appId
|
|
5513
5510
|
});
|
|
@@ -5523,7 +5520,7 @@ class Wu {
|
|
|
5523
5520
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
5524
5521
|
return;
|
|
5525
5522
|
}
|
|
5526
|
-
|
|
5523
|
+
iu({
|
|
5527
5524
|
apiURI: this.config.apiURI,
|
|
5528
5525
|
appId: this.config.appId,
|
|
5529
5526
|
refreshToken: i
|
|
@@ -5558,7 +5555,7 @@ class Wu {
|
|
|
5558
5555
|
exchangeCodeForToken(e) {
|
|
5559
5556
|
return F(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
|
|
5560
5557
|
var i;
|
|
5561
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield
|
|
5558
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield Dr({
|
|
5562
5559
|
apiURI: this.config.apiURI,
|
|
5563
5560
|
appId: this.config.appId,
|
|
5564
5561
|
code: n,
|
|
@@ -5581,7 +5578,7 @@ class Wu {
|
|
|
5581
5578
|
signInWithIdToken(e) {
|
|
5582
5579
|
return F(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
|
|
5583
5580
|
var s;
|
|
5584
|
-
const o = yield this.getCurrentUser(), a = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, u = yield
|
|
5581
|
+
const o = yield this.getCurrentUser(), a = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, u = yield ru({
|
|
5585
5582
|
apiURI: this.config.apiURI,
|
|
5586
5583
|
appId: this.config.appId,
|
|
5587
5584
|
idToken: n,
|
|
@@ -5622,7 +5619,7 @@ class Wu {
|
|
|
5622
5619
|
// TODO: look into typing again
|
|
5623
5620
|
getPresence(e, n, r = {}) {
|
|
5624
5621
|
const i = this._rooms[n], s = this._presence[n];
|
|
5625
|
-
return !i || !s || !s.result ? null : Object.assign(Object.assign({},
|
|
5622
|
+
return !i || !s || !s.result ? null : Object.assign(Object.assign({}, du(s.result, r, this._sessionId)), { isLoading: !i.isConnected, error: i.error });
|
|
5626
5623
|
}
|
|
5627
5624
|
// TODO: look into typing again
|
|
5628
5625
|
publishPresence(e, n, r) {
|
|
@@ -5672,7 +5669,7 @@ class Wu {
|
|
|
5672
5669
|
}
|
|
5673
5670
|
_notifyPresenceSub(e, n) {
|
|
5674
5671
|
const r = this.getPresence("", e, n);
|
|
5675
|
-
r && (n.prev && !
|
|
5672
|
+
r && (n.prev && !fu(r, n.prev) || (n.prev = r, n.cb(r)));
|
|
5676
5673
|
}
|
|
5677
5674
|
_patchPresencePeers(e, n) {
|
|
5678
5675
|
var r, i, s;
|
|
@@ -5683,13 +5680,13 @@ class Wu {
|
|
|
5683
5680
|
for (let [d, f, l] of n)
|
|
5684
5681
|
switch (f) {
|
|
5685
5682
|
case "+":
|
|
5686
|
-
|
|
5683
|
+
Ks(c, d, l);
|
|
5687
5684
|
break;
|
|
5688
5685
|
case "r":
|
|
5689
|
-
|
|
5686
|
+
Sr(c, d, l);
|
|
5690
5687
|
break;
|
|
5691
5688
|
case "-":
|
|
5692
|
-
|
|
5689
|
+
wi(c, d);
|
|
5693
5690
|
break;
|
|
5694
5691
|
}
|
|
5695
5692
|
delete c[this._sessionId];
|
|
@@ -5701,7 +5698,7 @@ class Wu {
|
|
|
5701
5698
|
delete r[this._sessionId];
|
|
5702
5699
|
const i = Object.fromEntries(Object.entries(r).map(([s, o]) => [s, o.data]));
|
|
5703
5700
|
this._presence = Pt(this._presence, (s) => {
|
|
5704
|
-
|
|
5701
|
+
Sr(s, [e, "result", "peers"], i);
|
|
5705
5702
|
});
|
|
5706
5703
|
}
|
|
5707
5704
|
// --------
|
|
@@ -5746,14 +5743,14 @@ class Wu {
|
|
|
5746
5743
|
return F(this, void 0, void 0, function* () {
|
|
5747
5744
|
var i;
|
|
5748
5745
|
const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
|
|
5749
|
-
return
|
|
5746
|
+
return su(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
|
|
5750
5747
|
});
|
|
5751
5748
|
}
|
|
5752
5749
|
deleteFile(e) {
|
|
5753
5750
|
return F(this, void 0, void 0, function* () {
|
|
5754
5751
|
var n;
|
|
5755
5752
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
5756
|
-
return yield
|
|
5753
|
+
return yield ou({
|
|
5757
5754
|
apiURI: this.config.apiURI,
|
|
5758
5755
|
appId: this.config.appId,
|
|
5759
5756
|
path: e,
|
|
@@ -5766,20 +5763,20 @@ class Wu {
|
|
|
5766
5763
|
upload(e, n) {
|
|
5767
5764
|
return F(this, void 0, void 0, function* () {
|
|
5768
5765
|
var r;
|
|
5769
|
-
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
|
|
5766
|
+
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 au({
|
|
5770
5767
|
apiURI: this.config.apiURI,
|
|
5771
5768
|
appId: this.config.appId,
|
|
5772
5769
|
fileName: o,
|
|
5773
5770
|
refreshToken: s
|
|
5774
5771
|
});
|
|
5775
|
-
return yield
|
|
5772
|
+
return yield uu(a, n);
|
|
5776
5773
|
});
|
|
5777
5774
|
}
|
|
5778
5775
|
getDownloadUrl(e) {
|
|
5779
5776
|
return F(this, void 0, void 0, function* () {
|
|
5780
5777
|
var n;
|
|
5781
5778
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
5782
|
-
return yield
|
|
5779
|
+
return yield cu({
|
|
5783
5780
|
apiURI: this.config.apiURI,
|
|
5784
5781
|
appId: this.config.appId,
|
|
5785
5782
|
path: e,
|
|
@@ -5788,9 +5785,9 @@ class Wu {
|
|
|
5788
5785
|
});
|
|
5789
5786
|
}
|
|
5790
5787
|
}
|
|
5791
|
-
function
|
|
5788
|
+
function Wu(t, e) {
|
|
5792
5789
|
return new Lt(
|
|
5793
|
-
|
|
5790
|
+
Zi(t, e),
|
|
5794
5791
|
// (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
|
|
5795
5792
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
5796
5793
|
// EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
|
|
@@ -5800,28 +5797,28 @@ function zu(t, e) {
|
|
|
5800
5797
|
void 0
|
|
5801
5798
|
);
|
|
5802
5799
|
}
|
|
5803
|
-
function
|
|
5800
|
+
function zu(t) {
|
|
5804
5801
|
return new Ut(t, {});
|
|
5805
5802
|
}
|
|
5806
|
-
function
|
|
5803
|
+
function Vu() {
|
|
5807
5804
|
return new H("string", !0, !1);
|
|
5808
5805
|
}
|
|
5809
|
-
function
|
|
5806
|
+
function Bu() {
|
|
5810
5807
|
return new H("number", !0, !1);
|
|
5811
5808
|
}
|
|
5812
|
-
function
|
|
5809
|
+
function Gu() {
|
|
5813
5810
|
return new H("boolean", !0, !1);
|
|
5814
5811
|
}
|
|
5815
|
-
function
|
|
5812
|
+
function Qu() {
|
|
5816
5813
|
return new H("date", !0, !1);
|
|
5817
5814
|
}
|
|
5818
|
-
function
|
|
5815
|
+
function Hu() {
|
|
5819
5816
|
return new H("json", !0, !1);
|
|
5820
5817
|
}
|
|
5821
|
-
function
|
|
5818
|
+
function Yu() {
|
|
5822
5819
|
return new H("json", !0, !1);
|
|
5823
5820
|
}
|
|
5824
|
-
function
|
|
5821
|
+
function Zi(t, e) {
|
|
5825
5822
|
var n, r, i, s;
|
|
5826
5823
|
const o = { fwd: {}, rev: {} };
|
|
5827
5824
|
for (const u of Object.values(e))
|
|
@@ -5837,10 +5834,10 @@ function Xi(t, e) {
|
|
|
5837
5834
|
new Ut(c.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
|
|
5838
5835
|
]));
|
|
5839
5836
|
}
|
|
5840
|
-
function
|
|
5837
|
+
function Ju({ entities: t, links: e, rooms: n }) {
|
|
5841
5838
|
const r = e ?? {}, i = n ?? {};
|
|
5842
5839
|
return new Lt(
|
|
5843
|
-
|
|
5840
|
+
Zi(t, r),
|
|
5844
5841
|
// (XXX): LinksDef<any> stems from TypeScript's inability to reconcile the
|
|
5845
5842
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
5846
5843
|
// EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
|
|
@@ -5850,23 +5847,23 @@ function Zu({ entities: t, links: e, rooms: n }) {
|
|
|
5850
5847
|
i
|
|
5851
5848
|
);
|
|
5852
5849
|
}
|
|
5853
|
-
const
|
|
5850
|
+
const qc = {
|
|
5854
5851
|
// constructs
|
|
5855
|
-
graph:
|
|
5856
|
-
schema:
|
|
5857
|
-
entity:
|
|
5852
|
+
graph: Wu,
|
|
5853
|
+
schema: Ju,
|
|
5854
|
+
entity: zu,
|
|
5858
5855
|
// value types
|
|
5859
|
-
string:
|
|
5860
|
-
number:
|
|
5861
|
-
boolean:
|
|
5862
|
-
date:
|
|
5863
|
-
json:
|
|
5864
|
-
any:
|
|
5856
|
+
string: Vu,
|
|
5857
|
+
number: Bu,
|
|
5858
|
+
boolean: Gu,
|
|
5859
|
+
date: Qu,
|
|
5860
|
+
json: Hu,
|
|
5861
|
+
any: Yu
|
|
5865
5862
|
};
|
|
5866
5863
|
let mt;
|
|
5867
|
-
function
|
|
5864
|
+
function Zu(t, e) {
|
|
5868
5865
|
mt == null || mt.dispose();
|
|
5869
|
-
const n =
|
|
5866
|
+
const n = ic(e), r = tc(e, a), i = ec(Xu(t));
|
|
5870
5867
|
function s(d) {
|
|
5871
5868
|
var f;
|
|
5872
5869
|
d.source === i.element.contentWindow && ((f = d.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && a();
|
|
@@ -5888,10 +5885,10 @@ function Xu(t, e) {
|
|
|
5888
5885
|
}
|
|
5889
5886
|
return c();
|
|
5890
5887
|
}
|
|
5891
|
-
function
|
|
5892
|
-
return `${
|
|
5888
|
+
function Xu(t) {
|
|
5889
|
+
return `${Vn || zi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
5893
5890
|
}
|
|
5894
|
-
function
|
|
5891
|
+
function ec(t) {
|
|
5895
5892
|
const e = document.createElement("iframe");
|
|
5896
5893
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
5897
5894
|
width: "100%",
|
|
@@ -5900,7 +5897,7 @@ function tc(t) {
|
|
|
5900
5897
|
border: "none"
|
|
5901
5898
|
}), { element: e };
|
|
5902
5899
|
}
|
|
5903
|
-
function
|
|
5900
|
+
function tc(t, e) {
|
|
5904
5901
|
const n = `
|
|
5905
5902
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5906
5903
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -5910,7 +5907,7 @@ function nc(t, e) {
|
|
|
5910
5907
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
|
|
5911
5908
|
// pos
|
|
5912
5909
|
position: "fixed"
|
|
5913
|
-
},
|
|
5910
|
+
}, nc(t.position)), {
|
|
5914
5911
|
height: "32px",
|
|
5915
5912
|
width: "32px",
|
|
5916
5913
|
// layout
|
|
@@ -5925,7 +5922,7 @@ function nc(t, e) {
|
|
|
5925
5922
|
cursor: "pointer"
|
|
5926
5923
|
})), r.addEventListener("click", e), { element: r };
|
|
5927
5924
|
}
|
|
5928
|
-
function
|
|
5925
|
+
function nc(t) {
|
|
5929
5926
|
switch (t) {
|
|
5930
5927
|
case "bottom-left":
|
|
5931
5928
|
return { bottom: "24px", left: "24px" };
|
|
@@ -5937,7 +5934,7 @@ function rc(t) {
|
|
|
5937
5934
|
return { top: "24px", left: "24px" };
|
|
5938
5935
|
}
|
|
5939
5936
|
}
|
|
5940
|
-
function
|
|
5937
|
+
function rc(t) {
|
|
5941
5938
|
switch (t) {
|
|
5942
5939
|
case "bottom-left":
|
|
5943
5940
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -5949,47 +5946,47 @@ function ic(t) {
|
|
|
5949
5946
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
5950
5947
|
}
|
|
5951
5948
|
}
|
|
5952
|
-
function
|
|
5949
|
+
function ic(t) {
|
|
5953
5950
|
const e = document.createElement("div");
|
|
5954
|
-
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" },
|
|
5951
|
+
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, rc(t.position)), { display: "block", borderRadius: "4px", border: "1px #ccc solid", boxShadow: "0px 0px 8px #00000044", backgroundColor: "#eee", zIndex: "999990" })), e.style.display = "none", e.className = "instant-devtool-container";
|
|
5955
5952
|
function n() {
|
|
5956
5953
|
return e.style.display !== "none";
|
|
5957
5954
|
}
|
|
5958
5955
|
return { element: e, isVisible: n };
|
|
5959
5956
|
}
|
|
5960
|
-
const
|
|
5957
|
+
const sc = {
|
|
5961
5958
|
apiURI: "https://api.instantdb.com",
|
|
5962
5959
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5963
5960
|
};
|
|
5964
|
-
function
|
|
5961
|
+
function oc() {
|
|
5965
5962
|
var t;
|
|
5966
5963
|
return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
5967
5964
|
}
|
|
5968
|
-
function
|
|
5965
|
+
function ac() {
|
|
5969
5966
|
var t;
|
|
5970
5967
|
return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
|
|
5971
5968
|
}
|
|
5972
|
-
function
|
|
5969
|
+
function wn(t) {
|
|
5973
5970
|
const e = t.__adminToken;
|
|
5974
5971
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
5975
5972
|
}
|
|
5976
|
-
const
|
|
5977
|
-
class
|
|
5973
|
+
const mn = ac(), Xr = oc();
|
|
5974
|
+
class uc {
|
|
5978
5975
|
constructor(e) {
|
|
5979
5976
|
this.db = e, this.sendMagicCode = (n) => this.db.sendMagicCode(n), this.signInWithMagicCode = (n) => this.db.signInWithMagicCode(n), this.signInWithToken = (n) => this.db.signInWithCustomToken(n), this.signInAsGuest = () => this.db.signInAsGuest(), this.createAuthorizationURL = (n) => this.db.createAuthorizationURL(n), this.signInWithIdToken = (n) => this.db.signInWithIdToken(n), this.exchangeOAuthCode = (n) => this.db.exchangeCodeForToken(n), this.issuerURI = () => this.db.issuerURI(), this.signOut = (n = { invalidateToken: !0 }) => this.db.signOut(n);
|
|
5980
5977
|
}
|
|
5981
5978
|
}
|
|
5982
|
-
class
|
|
5979
|
+
class cc {
|
|
5983
5980
|
constructor(e) {
|
|
5984
5981
|
this.db = e, this.uploadFile = (n, r, i = {}) => this.db.uploadFile(n, r, i), this.delete = (n) => this.db.deleteFile(n), this.upload = (n, r) => this.db.upload(n, r), this.put = this.upload, this.getDownloadUrl = (n) => this.db.getDownloadUrl(n);
|
|
5985
5982
|
}
|
|
5986
5983
|
}
|
|
5987
|
-
function
|
|
5984
|
+
function dc(t) {
|
|
5988
5985
|
return JSON.parse(JSON.stringify(t));
|
|
5989
5986
|
}
|
|
5990
|
-
class
|
|
5987
|
+
class fc {
|
|
5991
5988
|
constructor(e) {
|
|
5992
|
-
this.tx =
|
|
5989
|
+
this.tx = zn(), this._reactor = e, this.auth = new uc(this._reactor), this.storage = new cc(this._reactor);
|
|
5993
5990
|
}
|
|
5994
5991
|
/**
|
|
5995
5992
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6130,7 +6127,7 @@ class lc {
|
|
|
6130
6127
|
};
|
|
6131
6128
|
}
|
|
6132
6129
|
shutdown() {
|
|
6133
|
-
delete
|
|
6130
|
+
delete mn[wn(this._reactor.config)], this._reactor.shutdown();
|
|
6134
6131
|
}
|
|
6135
6132
|
/**
|
|
6136
6133
|
* Use this for one-off queries.
|
|
@@ -6163,33 +6160,33 @@ class lc {
|
|
|
6163
6160
|
return this._reactor.subscribeTable(e, n);
|
|
6164
6161
|
}
|
|
6165
6162
|
}
|
|
6166
|
-
function
|
|
6163
|
+
function ei(t) {
|
|
6167
6164
|
if (!t)
|
|
6168
6165
|
return "0";
|
|
6169
|
-
const e =
|
|
6166
|
+
const e = Xr.get(t);
|
|
6170
6167
|
if (e)
|
|
6171
6168
|
return e;
|
|
6172
6169
|
const n = z(t);
|
|
6173
|
-
return
|
|
6170
|
+
return Xr.set(t, n), n;
|
|
6174
6171
|
}
|
|
6175
|
-
function
|
|
6176
|
-
return
|
|
6172
|
+
function lc(t, e) {
|
|
6173
|
+
return ei(t._reactor.config.schema) !== ei(e);
|
|
6177
6174
|
}
|
|
6178
|
-
function
|
|
6175
|
+
function hc(t, e, n, r, i) {
|
|
6179
6176
|
var s;
|
|
6180
|
-
const o = Object.assign(Object.assign({}, t), { useDateObjects: (s = t.useDateObjects) !== null && s !== void 0 ? s : !1 }), a =
|
|
6177
|
+
const o = Object.assign(Object.assign({}, t), { useDateObjects: (s = t.useDateObjects) !== null && s !== void 0 ? s : !1 }), a = mn[wn(o)];
|
|
6181
6178
|
if (a)
|
|
6182
|
-
return
|
|
6183
|
-
const u = new
|
|
6184
|
-
return
|
|
6179
|
+
return lc(a, o.schema) && a._reactor.updateSchema(o.schema), a;
|
|
6180
|
+
const u = new qu(Object.assign(Object.assign(Object.assign({}, sc), o), { cardinalityInference: !!o.schema }), e || Ki, n || qi, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Bn }), i), c = new fc(u);
|
|
6181
|
+
return mn[wn(o)] = c, pc(o.appId, o.devtool), c;
|
|
6185
6182
|
}
|
|
6186
|
-
function
|
|
6183
|
+
function pc(t, e) {
|
|
6187
6184
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6188
6185
|
return;
|
|
6189
6186
|
const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
|
|
6190
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6187
|
+
n.allowedHosts.includes(window.location.hostname) && Zu(t, n);
|
|
6191
6188
|
}
|
|
6192
|
-
var
|
|
6189
|
+
var vn = { exports: {} }, He = {};
|
|
6193
6190
|
/**
|
|
6194
6191
|
* @license React
|
|
6195
6192
|
* react-jsx-runtime.production.min.js
|
|
@@ -6199,11 +6196,11 @@ var Sn = { exports: {} }, He = {};
|
|
|
6199
6196
|
* This source code is licensed under the MIT license found in the
|
|
6200
6197
|
* LICENSE file in the root directory of this source tree.
|
|
6201
6198
|
*/
|
|
6202
|
-
var
|
|
6203
|
-
function
|
|
6204
|
-
if (
|
|
6205
|
-
|
|
6206
|
-
var t =
|
|
6199
|
+
var ti;
|
|
6200
|
+
function yc() {
|
|
6201
|
+
if (ti) return He;
|
|
6202
|
+
ti = 1;
|
|
6203
|
+
var t = ci, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
6207
6204
|
function o(a, u, c) {
|
|
6208
6205
|
var d, f = {}, l = null, p = null;
|
|
6209
6206
|
c !== void 0 && (l = "" + c), u.key !== void 0 && (l = "" + u.key), u.ref !== void 0 && (p = u.ref);
|
|
@@ -6213,10 +6210,10 @@ function bc() {
|
|
|
6213
6210
|
}
|
|
6214
6211
|
return He.Fragment = n, He.jsx = o, He.jsxs = o, He;
|
|
6215
6212
|
}
|
|
6216
|
-
var Ye = {},
|
|
6217
|
-
function
|
|
6218
|
-
if (
|
|
6219
|
-
|
|
6213
|
+
var Ye = {}, ni;
|
|
6214
|
+
function bc() {
|
|
6215
|
+
if (ni) return Ye;
|
|
6216
|
+
ni = 1;
|
|
6220
6217
|
var t = {};
|
|
6221
6218
|
/**
|
|
6222
6219
|
* @license React
|
|
@@ -6228,7 +6225,7 @@ function _c() {
|
|
|
6228
6225
|
* LICENSE file in the root directory of this source tree.
|
|
6229
6226
|
*/
|
|
6230
6227
|
return t.NODE_ENV !== "production" && function() {
|
|
6231
|
-
var e =
|
|
6228
|
+
var e = ci, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, _ = "@@iterator";
|
|
6232
6229
|
function w(h) {
|
|
6233
6230
|
if (h === null || typeof h != "object")
|
|
6234
6231
|
return null;
|
|
@@ -6317,18 +6314,18 @@ function _c() {
|
|
|
6317
6314
|
}
|
|
6318
6315
|
return null;
|
|
6319
6316
|
}
|
|
6320
|
-
var we = Object.assign, Be = 0, Yn, Jn, Zn, Xn, er, tr
|
|
6321
|
-
function
|
|
6317
|
+
var we = Object.assign, Be = 0, Hn, Yn, Jn, Zn, Xn, er, tr;
|
|
6318
|
+
function nr() {
|
|
6322
6319
|
}
|
|
6323
|
-
|
|
6324
|
-
function
|
|
6320
|
+
nr.__reactDisabledLog = !0;
|
|
6321
|
+
function es() {
|
|
6325
6322
|
{
|
|
6326
6323
|
if (Be === 0) {
|
|
6327
|
-
|
|
6324
|
+
Hn = console.log, Yn = console.info, Jn = console.warn, Zn = console.error, Xn = console.group, er = console.groupCollapsed, tr = console.groupEnd;
|
|
6328
6325
|
var h = {
|
|
6329
6326
|
configurable: !0,
|
|
6330
6327
|
enumerable: !0,
|
|
6331
|
-
value:
|
|
6328
|
+
value: nr,
|
|
6332
6329
|
writable: !0
|
|
6333
6330
|
};
|
|
6334
6331
|
Object.defineProperties(console, {
|
|
@@ -6344,7 +6341,7 @@ function _c() {
|
|
|
6344
6341
|
Be++;
|
|
6345
6342
|
}
|
|
6346
6343
|
}
|
|
6347
|
-
function
|
|
6344
|
+
function ts() {
|
|
6348
6345
|
{
|
|
6349
6346
|
if (Be--, Be === 0) {
|
|
6350
6347
|
var h = {
|
|
@@ -6354,25 +6351,25 @@ function _c() {
|
|
|
6354
6351
|
};
|
|
6355
6352
|
Object.defineProperties(console, {
|
|
6356
6353
|
log: we({}, h, {
|
|
6357
|
-
value:
|
|
6354
|
+
value: Hn
|
|
6358
6355
|
}),
|
|
6359
6356
|
info: we({}, h, {
|
|
6360
|
-
value:
|
|
6357
|
+
value: Yn
|
|
6361
6358
|
}),
|
|
6362
6359
|
warn: we({}, h, {
|
|
6363
|
-
value:
|
|
6360
|
+
value: Jn
|
|
6364
6361
|
}),
|
|
6365
6362
|
error: we({}, h, {
|
|
6366
|
-
value:
|
|
6363
|
+
value: Zn
|
|
6367
6364
|
}),
|
|
6368
6365
|
group: we({}, h, {
|
|
6369
|
-
value:
|
|
6366
|
+
value: Xn
|
|
6370
6367
|
}),
|
|
6371
6368
|
groupCollapsed: we({}, h, {
|
|
6372
|
-
value:
|
|
6369
|
+
value: er
|
|
6373
6370
|
}),
|
|
6374
6371
|
groupEnd: we({}, h, {
|
|
6375
|
-
value:
|
|
6372
|
+
value: tr
|
|
6376
6373
|
})
|
|
6377
6374
|
});
|
|
6378
6375
|
}
|
|
@@ -6395,10 +6392,10 @@ function _c() {
|
|
|
6395
6392
|
}
|
|
6396
6393
|
var Wt = !1, yt;
|
|
6397
6394
|
{
|
|
6398
|
-
var
|
|
6399
|
-
yt = new
|
|
6395
|
+
var ns = typeof WeakMap == "function" ? WeakMap : Map;
|
|
6396
|
+
yt = new ns();
|
|
6400
6397
|
}
|
|
6401
|
-
function
|
|
6398
|
+
function rr(h, T) {
|
|
6402
6399
|
if (!h || Wt)
|
|
6403
6400
|
return "";
|
|
6404
6401
|
{
|
|
@@ -6411,7 +6408,7 @@ function _c() {
|
|
|
6411
6408
|
var P = Error.prepareStackTrace;
|
|
6412
6409
|
Error.prepareStackTrace = void 0;
|
|
6413
6410
|
var M;
|
|
6414
|
-
M = Kt.current, Kt.current = null,
|
|
6411
|
+
M = Kt.current, Kt.current = null, es();
|
|
6415
6412
|
try {
|
|
6416
6413
|
if (T) {
|
|
6417
6414
|
var C = function() {
|
|
@@ -6464,15 +6461,15 @@ function _c() {
|
|
|
6464
6461
|
}
|
|
6465
6462
|
}
|
|
6466
6463
|
} finally {
|
|
6467
|
-
Wt = !1, Kt.current = M,
|
|
6464
|
+
Wt = !1, Kt.current = M, ts(), Error.prepareStackTrace = P;
|
|
6468
6465
|
}
|
|
6469
6466
|
var Ie = h ? h.displayName || h.name : "", me = Ie ? pt(Ie) : "";
|
|
6470
6467
|
return typeof h == "function" && yt.set(h, me), me;
|
|
6471
6468
|
}
|
|
6472
|
-
function
|
|
6473
|
-
return
|
|
6469
|
+
function rs(h, T, v) {
|
|
6470
|
+
return rr(h, !1);
|
|
6474
6471
|
}
|
|
6475
|
-
function
|
|
6472
|
+
function is(h) {
|
|
6476
6473
|
var T = h.prototype;
|
|
6477
6474
|
return !!(T && T.isReactComponent);
|
|
6478
6475
|
}
|
|
@@ -6480,7 +6477,7 @@ function _c() {
|
|
|
6480
6477
|
if (h == null)
|
|
6481
6478
|
return "";
|
|
6482
6479
|
if (typeof h == "function")
|
|
6483
|
-
return
|
|
6480
|
+
return rr(h, is(h));
|
|
6484
6481
|
if (typeof h == "string")
|
|
6485
6482
|
return pt(h);
|
|
6486
6483
|
switch (h) {
|
|
@@ -6492,7 +6489,7 @@ function _c() {
|
|
|
6492
6489
|
if (typeof h == "object")
|
|
6493
6490
|
switch (h.$$typeof) {
|
|
6494
6491
|
case c:
|
|
6495
|
-
return
|
|
6492
|
+
return rs(h.render);
|
|
6496
6493
|
case l:
|
|
6497
6494
|
return bt(h.type, T, v);
|
|
6498
6495
|
case p: {
|
|
@@ -6505,15 +6502,15 @@ function _c() {
|
|
|
6505
6502
|
}
|
|
6506
6503
|
return "";
|
|
6507
6504
|
}
|
|
6508
|
-
var Ge = Object.prototype.hasOwnProperty,
|
|
6505
|
+
var Ge = Object.prototype.hasOwnProperty, ir = {}, sr = g.ReactDebugCurrentFrame;
|
|
6509
6506
|
function _t(h) {
|
|
6510
6507
|
if (h) {
|
|
6511
6508
|
var T = h._owner, v = bt(h.type, h._source, T ? T.type : null);
|
|
6512
|
-
|
|
6509
|
+
sr.setExtraStackFrame(v);
|
|
6513
6510
|
} else
|
|
6514
|
-
|
|
6511
|
+
sr.setExtraStackFrame(null);
|
|
6515
6512
|
}
|
|
6516
|
-
function
|
|
6513
|
+
function ss(h, T, v, O, P) {
|
|
6517
6514
|
{
|
|
6518
6515
|
var M = Function.call.bind(Ge);
|
|
6519
6516
|
for (var C in h)
|
|
@@ -6528,41 +6525,41 @@ function _c() {
|
|
|
6528
6525
|
} catch (D) {
|
|
6529
6526
|
j = D;
|
|
6530
6527
|
}
|
|
6531
|
-
j && !(j 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).", O || "React class", v, C, typeof j), _t(null)), j instanceof Error && !(j.message in
|
|
6528
|
+
j && !(j 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).", O || "React class", v, C, typeof j), _t(null)), j instanceof Error && !(j.message in ir) && (ir[j.message] = !0, _t(P), m("Failed %s type: %s", v, j.message), _t(null));
|
|
6532
6529
|
}
|
|
6533
6530
|
}
|
|
6534
6531
|
}
|
|
6535
|
-
var
|
|
6532
|
+
var os = Array.isArray;
|
|
6536
6533
|
function zt(h) {
|
|
6537
|
-
return
|
|
6534
|
+
return os(h);
|
|
6538
6535
|
}
|
|
6539
|
-
function
|
|
6536
|
+
function as(h) {
|
|
6540
6537
|
{
|
|
6541
6538
|
var T = typeof Symbol == "function" && Symbol.toStringTag, v = T && h[Symbol.toStringTag] || h.constructor.name || "Object";
|
|
6542
6539
|
return v;
|
|
6543
6540
|
}
|
|
6544
6541
|
}
|
|
6545
|
-
function
|
|
6542
|
+
function us(h) {
|
|
6546
6543
|
try {
|
|
6547
|
-
return
|
|
6544
|
+
return or(h), !1;
|
|
6548
6545
|
} catch {
|
|
6549
6546
|
return !0;
|
|
6550
6547
|
}
|
|
6551
6548
|
}
|
|
6552
|
-
function
|
|
6549
|
+
function or(h) {
|
|
6553
6550
|
return "" + h;
|
|
6554
6551
|
}
|
|
6555
|
-
function
|
|
6556
|
-
if (
|
|
6557
|
-
return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
6552
|
+
function ar(h) {
|
|
6553
|
+
if (us(h))
|
|
6554
|
+
return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", as(h)), or(h);
|
|
6558
6555
|
}
|
|
6559
|
-
var
|
|
6556
|
+
var ur = g.ReactCurrentOwner, cs = {
|
|
6560
6557
|
key: !0,
|
|
6561
6558
|
ref: !0,
|
|
6562
6559
|
__self: !0,
|
|
6563
6560
|
__source: !0
|
|
6564
|
-
},
|
|
6565
|
-
function
|
|
6561
|
+
}, cr, dr;
|
|
6562
|
+
function ds(h) {
|
|
6566
6563
|
if (Ge.call(h, "ref")) {
|
|
6567
6564
|
var T = Object.getOwnPropertyDescriptor(h, "ref").get;
|
|
6568
6565
|
if (T && T.isReactWarning)
|
|
@@ -6570,7 +6567,7 @@ function _c() {
|
|
|
6570
6567
|
}
|
|
6571
6568
|
return h.ref !== void 0;
|
|
6572
6569
|
}
|
|
6573
|
-
function
|
|
6570
|
+
function fs(h) {
|
|
6574
6571
|
if (Ge.call(h, "key")) {
|
|
6575
6572
|
var T = Object.getOwnPropertyDescriptor(h, "key").get;
|
|
6576
6573
|
if (T && T.isReactWarning)
|
|
@@ -6578,13 +6575,13 @@ function _c() {
|
|
|
6578
6575
|
}
|
|
6579
6576
|
return h.key !== void 0;
|
|
6580
6577
|
}
|
|
6581
|
-
function
|
|
6582
|
-
typeof h.ref == "string" &&
|
|
6578
|
+
function ls(h, T) {
|
|
6579
|
+
typeof h.ref == "string" && ur.current;
|
|
6583
6580
|
}
|
|
6584
|
-
function
|
|
6581
|
+
function hs(h, T) {
|
|
6585
6582
|
{
|
|
6586
6583
|
var v = function() {
|
|
6587
|
-
|
|
6584
|
+
cr || (cr = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
|
|
6588
6585
|
};
|
|
6589
6586
|
v.isReactWarning = !0, Object.defineProperty(h, "key", {
|
|
6590
6587
|
get: v,
|
|
@@ -6592,10 +6589,10 @@ function _c() {
|
|
|
6592
6589
|
});
|
|
6593
6590
|
}
|
|
6594
6591
|
}
|
|
6595
|
-
function
|
|
6592
|
+
function ps(h, T) {
|
|
6596
6593
|
{
|
|
6597
6594
|
var v = function() {
|
|
6598
|
-
|
|
6595
|
+
dr || (dr = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
|
|
6599
6596
|
};
|
|
6600
6597
|
v.isReactWarning = !0, Object.defineProperty(h, "ref", {
|
|
6601
6598
|
get: v,
|
|
@@ -6603,7 +6600,7 @@ function _c() {
|
|
|
6603
6600
|
});
|
|
6604
6601
|
}
|
|
6605
6602
|
}
|
|
6606
|
-
var
|
|
6603
|
+
var ys = function(h, T, v, O, P, M, C) {
|
|
6607
6604
|
var j = {
|
|
6608
6605
|
// This tag allows us to uniquely identify this as a React Element
|
|
6609
6606
|
$$typeof: n,
|
|
@@ -6632,12 +6629,12 @@ function _c() {
|
|
|
6632
6629
|
value: P
|
|
6633
6630
|
}), Object.freeze && (Object.freeze(j.props), Object.freeze(j)), j;
|
|
6634
6631
|
};
|
|
6635
|
-
function
|
|
6632
|
+
function bs(h, T, v, O, P) {
|
|
6636
6633
|
{
|
|
6637
6634
|
var M, C = {}, j = null, G = null;
|
|
6638
|
-
v !== void 0 && (
|
|
6635
|
+
v !== void 0 && (ar(v), j = "" + v), fs(T) && (ar(T.key), j = "" + T.key), ds(T) && (G = T.ref, ls(T, P));
|
|
6639
6636
|
for (M in T)
|
|
6640
|
-
Ge.call(T, M) && !
|
|
6637
|
+
Ge.call(T, M) && !cs.hasOwnProperty(M) && (C[M] = T[M]);
|
|
6641
6638
|
if (h && h.defaultProps) {
|
|
6642
6639
|
var D = h.defaultProps;
|
|
6643
6640
|
for (M in D)
|
|
@@ -6645,25 +6642,25 @@ function _c() {
|
|
|
6645
6642
|
}
|
|
6646
6643
|
if (j || G) {
|
|
6647
6644
|
var L = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
6648
|
-
j &&
|
|
6645
|
+
j && hs(C, L), G && ps(C, L);
|
|
6649
6646
|
}
|
|
6650
|
-
return
|
|
6647
|
+
return ys(h, j, G, P, O, ur.current, C);
|
|
6651
6648
|
}
|
|
6652
6649
|
}
|
|
6653
|
-
var Vt = g.ReactCurrentOwner,
|
|
6650
|
+
var Vt = g.ReactCurrentOwner, fr = g.ReactDebugCurrentFrame;
|
|
6654
6651
|
function Pe(h) {
|
|
6655
6652
|
if (h) {
|
|
6656
6653
|
var T = h._owner, v = bt(h.type, h._source, T ? T.type : null);
|
|
6657
|
-
|
|
6654
|
+
fr.setExtraStackFrame(v);
|
|
6658
6655
|
} else
|
|
6659
|
-
|
|
6656
|
+
fr.setExtraStackFrame(null);
|
|
6660
6657
|
}
|
|
6661
6658
|
var Bt;
|
|
6662
6659
|
Bt = !1;
|
|
6663
6660
|
function Gt(h) {
|
|
6664
6661
|
return typeof h == "object" && h !== null && h.$$typeof === n;
|
|
6665
6662
|
}
|
|
6666
|
-
function
|
|
6663
|
+
function lr() {
|
|
6667
6664
|
{
|
|
6668
6665
|
if (Vt.current) {
|
|
6669
6666
|
var h = ce(Vt.current.type);
|
|
@@ -6675,13 +6672,13 @@ Check the render method of \`` + h + "`.";
|
|
|
6675
6672
|
return "";
|
|
6676
6673
|
}
|
|
6677
6674
|
}
|
|
6678
|
-
function
|
|
6675
|
+
function _s(h) {
|
|
6679
6676
|
return "";
|
|
6680
6677
|
}
|
|
6681
|
-
var
|
|
6682
|
-
function
|
|
6678
|
+
var hr = {};
|
|
6679
|
+
function gs(h) {
|
|
6683
6680
|
{
|
|
6684
|
-
var T =
|
|
6681
|
+
var T = lr();
|
|
6685
6682
|
if (!T) {
|
|
6686
6683
|
var v = typeof h == "string" ? h : h.displayName || h.name;
|
|
6687
6684
|
v && (T = `
|
|
@@ -6691,27 +6688,27 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6691
6688
|
return T;
|
|
6692
6689
|
}
|
|
6693
6690
|
}
|
|
6694
|
-
function
|
|
6691
|
+
function pr(h, T) {
|
|
6695
6692
|
{
|
|
6696
6693
|
if (!h._store || h._store.validated || h.key != null)
|
|
6697
6694
|
return;
|
|
6698
6695
|
h._store.validated = !0;
|
|
6699
|
-
var v =
|
|
6700
|
-
if (
|
|
6696
|
+
var v = gs(T);
|
|
6697
|
+
if (hr[v])
|
|
6701
6698
|
return;
|
|
6702
|
-
|
|
6699
|
+
hr[v] = !0;
|
|
6703
6700
|
var O = "";
|
|
6704
6701
|
h && h._owner && h._owner !== Vt.current && (O = " 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, O), Pe(null);
|
|
6705
6702
|
}
|
|
6706
6703
|
}
|
|
6707
|
-
function
|
|
6704
|
+
function yr(h, T) {
|
|
6708
6705
|
{
|
|
6709
6706
|
if (typeof h != "object")
|
|
6710
6707
|
return;
|
|
6711
6708
|
if (zt(h))
|
|
6712
6709
|
for (var v = 0; v < h.length; v++) {
|
|
6713
6710
|
var O = h[v];
|
|
6714
|
-
Gt(O) &&
|
|
6711
|
+
Gt(O) && pr(O, T);
|
|
6715
6712
|
}
|
|
6716
6713
|
else if (Gt(h))
|
|
6717
6714
|
h._store && (h._store.validated = !0);
|
|
@@ -6719,11 +6716,11 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6719
6716
|
var P = w(h);
|
|
6720
6717
|
if (typeof P == "function" && P !== h.entries)
|
|
6721
6718
|
for (var M = P.call(h), C; !(C = M.next()).done; )
|
|
6722
|
-
Gt(C.value) &&
|
|
6719
|
+
Gt(C.value) && pr(C.value, T);
|
|
6723
6720
|
}
|
|
6724
6721
|
}
|
|
6725
6722
|
}
|
|
6726
|
-
function
|
|
6723
|
+
function Ts(h) {
|
|
6727
6724
|
{
|
|
6728
6725
|
var T = h.type;
|
|
6729
6726
|
if (T == null || typeof T == "string")
|
|
@@ -6739,7 +6736,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6739
6736
|
return;
|
|
6740
6737
|
if (v) {
|
|
6741
6738
|
var O = ce(T);
|
|
6742
|
-
|
|
6739
|
+
ss(v, h.props, "prop", O, h);
|
|
6743
6740
|
} else if (T.PropTypes !== void 0 && !Bt) {
|
|
6744
6741
|
Bt = !0;
|
|
6745
6742
|
var P = ce(T);
|
|
@@ -6748,7 +6745,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6748
6745
|
typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
6749
6746
|
}
|
|
6750
6747
|
}
|
|
6751
|
-
function
|
|
6748
|
+
function ws(h) {
|
|
6752
6749
|
{
|
|
6753
6750
|
for (var T = Object.keys(h.props), v = 0; v < T.length; v++) {
|
|
6754
6751
|
var O = T[v];
|
|
@@ -6760,19 +6757,19 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6760
6757
|
h.ref !== null && (Pe(h), m("Invalid attribute `ref` supplied to `React.Fragment`."), Pe(null));
|
|
6761
6758
|
}
|
|
6762
6759
|
}
|
|
6763
|
-
var
|
|
6764
|
-
function
|
|
6760
|
+
var br = {};
|
|
6761
|
+
function _r(h, T, v, O, P, M) {
|
|
6765
6762
|
{
|
|
6766
6763
|
var C = Ft(h);
|
|
6767
6764
|
if (!C) {
|
|
6768
6765
|
var j = "";
|
|
6769
6766
|
(h === void 0 || typeof h == "object" && h !== null && Object.keys(h).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.");
|
|
6770
|
-
var G =
|
|
6771
|
-
G ? j += G : j +=
|
|
6767
|
+
var G = _s();
|
|
6768
|
+
G ? j += G : j += lr();
|
|
6772
6769
|
var D;
|
|
6773
6770
|
h === null ? D = "null" : zt(h) ? D = "array" : h !== void 0 && h.$$typeof === n ? (D = "<" + (ce(h.type) || "Unknown") + " />", j = " Did you accidentally export a JSX literal instead of a component?") : D = 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", D, j);
|
|
6774
6771
|
}
|
|
6775
|
-
var L =
|
|
6772
|
+
var L = bs(h, T, v, P, M);
|
|
6776
6773
|
if (L == null)
|
|
6777
6774
|
return L;
|
|
6778
6775
|
if (C) {
|
|
@@ -6781,56 +6778,56 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6781
6778
|
if (O)
|
|
6782
6779
|
if (zt(re)) {
|
|
6783
6780
|
for (var Ie = 0; Ie < re.length; Ie++)
|
|
6784
|
-
|
|
6781
|
+
yr(re[Ie], h);
|
|
6785
6782
|
Object.freeze && Object.freeze(re);
|
|
6786
6783
|
} else
|
|
6787
6784
|
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.");
|
|
6788
6785
|
else
|
|
6789
|
-
|
|
6786
|
+
yr(re, h);
|
|
6790
6787
|
}
|
|
6791
6788
|
if (Ge.call(T, "key")) {
|
|
6792
|
-
var me = ce(h), Y = Object.keys(T).filter(function(
|
|
6793
|
-
return
|
|
6789
|
+
var me = ce(h), Y = Object.keys(T).filter(function(As) {
|
|
6790
|
+
return As !== "key";
|
|
6794
6791
|
}), Qt = Y.length > 0 ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
6795
|
-
if (!
|
|
6796
|
-
var
|
|
6792
|
+
if (!br[me + Qt]) {
|
|
6793
|
+
var Es = Y.length > 0 ? "{" + Y.join(": ..., ") + ": ...}" : "{}";
|
|
6797
6794
|
m(`A props object containing a "key" prop is being spread into JSX:
|
|
6798
6795
|
let props = %s;
|
|
6799
6796
|
<%s {...props} />
|
|
6800
6797
|
React keys must be passed directly to JSX without using spread:
|
|
6801
6798
|
let props = %s;
|
|
6802
|
-
<%s key={someKey} {...props} />`, Qt, me,
|
|
6799
|
+
<%s key={someKey} {...props} />`, Qt, me, Es, me), br[me + Qt] = !0;
|
|
6803
6800
|
}
|
|
6804
6801
|
}
|
|
6805
|
-
return h === i ?
|
|
6802
|
+
return h === i ? ws(L) : Ts(L), L;
|
|
6806
6803
|
}
|
|
6807
6804
|
}
|
|
6808
|
-
function
|
|
6809
|
-
return
|
|
6805
|
+
function ms(h, T, v) {
|
|
6806
|
+
return _r(h, T, v, !0);
|
|
6810
6807
|
}
|
|
6811
|
-
function
|
|
6812
|
-
return
|
|
6808
|
+
function vs(h, T, v) {
|
|
6809
|
+
return _r(h, T, v, !1);
|
|
6813
6810
|
}
|
|
6814
|
-
var
|
|
6815
|
-
Ye.Fragment = i, Ye.jsx =
|
|
6811
|
+
var Ss = vs, Os = ms;
|
|
6812
|
+
Ye.Fragment = i, Ye.jsx = Ss, Ye.jsxs = Os;
|
|
6816
6813
|
}(), Ye;
|
|
6817
6814
|
}
|
|
6818
|
-
var
|
|
6819
|
-
|
|
6820
|
-
var W =
|
|
6821
|
-
const
|
|
6815
|
+
var _c = {};
|
|
6816
|
+
_c.NODE_ENV === "production" ? vn.exports = yc() : vn.exports = bc();
|
|
6817
|
+
var W = vn.exports;
|
|
6818
|
+
const gc = {
|
|
6822
6819
|
isLoading: !0,
|
|
6823
6820
|
data: void 0,
|
|
6824
6821
|
pageInfo: void 0,
|
|
6825
6822
|
error: void 0
|
|
6826
6823
|
};
|
|
6827
|
-
function
|
|
6824
|
+
function ri(t) {
|
|
6828
6825
|
return Object.assign({ isLoading: !t, data: void 0, pageInfo: void 0, error: void 0 }, t || {});
|
|
6829
6826
|
}
|
|
6830
|
-
function
|
|
6827
|
+
function Tc(t, e, n) {
|
|
6831
6828
|
e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
6832
|
-
const r = e ?
|
|
6833
|
-
(u) => (s.current =
|
|
6829
|
+
const r = e ? dc(e) : null, i = z(r), s = at(ri(t._reactor.getPreviousResult(r))), o = ge(
|
|
6830
|
+
(u) => (s.current = ri(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (d) => {
|
|
6834
6831
|
s.current = Object.assign({
|
|
6835
6832
|
isLoading: !d,
|
|
6836
6833
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
@@ -6845,9 +6842,9 @@ function wc(t, e, n) {
|
|
|
6845
6842
|
// Build a new subscribe function if the query changes
|
|
6846
6843
|
[i]
|
|
6847
6844
|
);
|
|
6848
|
-
return { state:
|
|
6845
|
+
return { state: tn(o, () => s.current, () => gc), query: r };
|
|
6849
6846
|
}
|
|
6850
|
-
function
|
|
6847
|
+
function wc() {
|
|
6851
6848
|
const t = at(null);
|
|
6852
6849
|
je(() => {
|
|
6853
6850
|
n();
|
|
@@ -6860,14 +6857,14 @@ function mc() {
|
|
|
6860
6857
|
}
|
|
6861
6858
|
return { set: e, clear: n };
|
|
6862
6859
|
}
|
|
6863
|
-
const
|
|
6864
|
-
function
|
|
6860
|
+
const mc = 1e3;
|
|
6861
|
+
function vc(t, e, n) {
|
|
6865
6862
|
const r = at(n);
|
|
6866
6863
|
r.current = n, je(() => t.core._reactor.subscribeTopic(t.id, e, (s, o) => {
|
|
6867
6864
|
r.current(s, o);
|
|
6868
6865
|
}), [t.id, e]);
|
|
6869
6866
|
}
|
|
6870
|
-
function
|
|
6867
|
+
function Sc(t, e) {
|
|
6871
6868
|
return je(() => t.core._reactor.joinRoom(t.id), [t.id]), ge((r) => {
|
|
6872
6869
|
t.core._reactor.publishTopic({
|
|
6873
6870
|
roomType: t.type,
|
|
@@ -6877,9 +6874,9 @@ function Oc(t, e) {
|
|
|
6877
6874
|
});
|
|
6878
6875
|
}, [t.id, e]);
|
|
6879
6876
|
}
|
|
6880
|
-
function
|
|
6877
|
+
function Oc(t, e = {}) {
|
|
6881
6878
|
var n, r;
|
|
6882
|
-
const [i, s] =
|
|
6879
|
+
const [i, s] = di(() => {
|
|
6883
6880
|
var u;
|
|
6884
6881
|
return (u = t.core._reactor.getPresence(t.type, t.id, e)) !== null && u !== void 0 ? u : {
|
|
6885
6882
|
peers: {},
|
|
@@ -6892,15 +6889,15 @@ function Ec(t, e = {}) {
|
|
|
6892
6889
|
const o = ge((u) => {
|
|
6893
6890
|
t.core._reactor.publishPresence(t.type, t.id, u);
|
|
6894
6891
|
}, [t.type, t.id]);
|
|
6895
|
-
return
|
|
6892
|
+
return nn(() => Object.assign(Object.assign({}, i), { publishPresence: o }), [i, o]);
|
|
6896
6893
|
}
|
|
6897
|
-
function
|
|
6894
|
+
function Ec(t, e, n) {
|
|
6898
6895
|
je(() => t.core._reactor.joinRoom(t.id, e), [t.id]), je(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
|
|
6899
6896
|
}
|
|
6900
|
-
function
|
|
6901
|
-
const r =
|
|
6897
|
+
function Ac(t, e, n = {}) {
|
|
6898
|
+
const r = wc(), i = Se.usePresence(t, {
|
|
6902
6899
|
keys: [e]
|
|
6903
|
-
}), s =
|
|
6900
|
+
}), s = nn(() => {
|
|
6904
6901
|
var d;
|
|
6905
6902
|
const f = t._core._reactor.getPresence(t.type, t.id);
|
|
6906
6903
|
return n != null && n.writeOnly ? [] : Object.values((d = f == null ? void 0 : f.peers) !== null && d !== void 0 ? d : {}).filter((l) => l[e] === !0);
|
|
@@ -6908,7 +6905,7 @@ function jc(t, e, n = {}) {
|
|
|
6908
6905
|
var f;
|
|
6909
6906
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6910
6907
|
[e]: d
|
|
6911
|
-
}), d && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f :
|
|
6908
|
+
}), d && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f : mc, () => {
|
|
6912
6909
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6913
6910
|
[e]: null
|
|
6914
6911
|
});
|
|
@@ -6918,7 +6915,7 @@ function jc(t, e, n = {}) {
|
|
|
6918
6915
|
o(l);
|
|
6919
6916
|
}, [n.stopOnEnter, o]), u = ge(() => {
|
|
6920
6917
|
o(!1);
|
|
6921
|
-
}, [o]), c =
|
|
6918
|
+
}, [o]), c = nn(() => ({ onKeyDown: a, onBlur: u }), [a, u]);
|
|
6922
6919
|
return {
|
|
6923
6920
|
active: s,
|
|
6924
6921
|
setActive: o,
|
|
@@ -6926,20 +6923,20 @@ function jc(t, e, n = {}) {
|
|
|
6926
6923
|
};
|
|
6927
6924
|
}
|
|
6928
6925
|
const Se = {
|
|
6929
|
-
useTopicEffect:
|
|
6930
|
-
usePublishTopic:
|
|
6931
|
-
usePresence:
|
|
6932
|
-
useSyncPresence:
|
|
6933
|
-
useTypingIndicator:
|
|
6926
|
+
useTopicEffect: vc,
|
|
6927
|
+
usePublishTopic: Sc,
|
|
6928
|
+
usePresence: Oc,
|
|
6929
|
+
useSyncPresence: Ec,
|
|
6930
|
+
useTypingIndicator: Ac
|
|
6934
6931
|
};
|
|
6935
|
-
class
|
|
6932
|
+
class jc {
|
|
6936
6933
|
constructor(e, n, r) {
|
|
6937
6934
|
this.useTopicEffect = (i, s) => {
|
|
6938
6935
|
Se.useTopicEffect(this, i, s);
|
|
6939
6936
|
}, 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;
|
|
6940
6937
|
}
|
|
6941
6938
|
}
|
|
6942
|
-
var
|
|
6939
|
+
var kc = function(t, e, n, r) {
|
|
6943
6940
|
function i(s) {
|
|
6944
6941
|
return s instanceof n ? s : new n(function(o) {
|
|
6945
6942
|
o(s);
|
|
@@ -6966,26 +6963,26 @@ var Cc = function(t, e, n, r) {
|
|
|
6966
6963
|
c((r = r.apply(t, e || [])).next());
|
|
6967
6964
|
});
|
|
6968
6965
|
};
|
|
6969
|
-
const
|
|
6966
|
+
const Cc = {
|
|
6970
6967
|
isLoading: !0,
|
|
6971
6968
|
user: void 0,
|
|
6972
6969
|
error: void 0
|
|
6973
6970
|
};
|
|
6974
|
-
class
|
|
6971
|
+
class Pc {
|
|
6975
6972
|
constructor(e, n) {
|
|
6976
|
-
this.tx =
|
|
6977
|
-
const [i, s] =
|
|
6973
|
+
this.tx = zn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
6974
|
+
const [i, s] = di(null);
|
|
6978
6975
|
return je(() => {
|
|
6979
|
-
|
|
6976
|
+
kc(this, void 0, void 0, function* () {
|
|
6980
6977
|
const a = yield this.getLocalId(r);
|
|
6981
6978
|
s(a);
|
|
6982
6979
|
});
|
|
6983
6980
|
}, [r]), i;
|
|
6984
|
-
}, this.rooms = Se, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) =>
|
|
6981
|
+
}, this.rooms = Se, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => Tc(this.core, r, i).state, this.useAuth = () => {
|
|
6985
6982
|
const r = at(this.core._reactor._currentUserCached), i = ge((o) => this.core.subscribeAuth((u) => {
|
|
6986
6983
|
r.current = Object.assign({ isLoading: !1 }, u), o();
|
|
6987
6984
|
}), []);
|
|
6988
|
-
return
|
|
6985
|
+
return tn(i, () => r.current, () => Cc);
|
|
6989
6986
|
}, this.useUser = () => {
|
|
6990
6987
|
const { user: r } = this.useAuth();
|
|
6991
6988
|
if (!r)
|
|
@@ -6995,7 +6992,7 @@ class Ic {
|
|
|
6995
6992
|
const r = at(this.core._reactor.status), i = ge((o) => this.core.subscribeConnectionStatus((u) => {
|
|
6996
6993
|
u !== r.current && (r.current = u, o());
|
|
6997
6994
|
}), []);
|
|
6998
|
-
return
|
|
6995
|
+
return tn(
|
|
6999
6996
|
i,
|
|
7000
6997
|
() => r.current,
|
|
7001
6998
|
// For SSR, always return 'connecting' as the initial state
|
|
@@ -7007,7 +7004,7 @@ class Ic {
|
|
|
7007
7004
|
}, this.SignedOut = ({ children: r }) => {
|
|
7008
7005
|
const i = this.useAuth();
|
|
7009
7006
|
return i.isLoading || i.error || i.user ? null : W.jsx(W.Fragment, { children: r });
|
|
7010
|
-
}, this.core =
|
|
7007
|
+
}, this.core = hc(
|
|
7011
7008
|
e,
|
|
7012
7009
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
7013
7010
|
this.constructor.Storage,
|
|
@@ -7031,7 +7028,7 @@ class Ic {
|
|
|
7031
7028
|
* const { peers } = db.rooms.usePresence(room);
|
|
7032
7029
|
*/
|
|
7033
7030
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
7034
|
-
return new
|
|
7031
|
+
return new jc(this.core, e, n);
|
|
7035
7032
|
}
|
|
7036
7033
|
/**
|
|
7037
7034
|
* One time query for the logged in state. This is useful
|
|
@@ -7047,22 +7044,22 @@ class Ic {
|
|
|
7047
7044
|
return this.core.getAuth();
|
|
7048
7045
|
}
|
|
7049
7046
|
}
|
|
7050
|
-
class
|
|
7047
|
+
class ii extends Error {
|
|
7051
7048
|
constructor(e, n) {
|
|
7052
7049
|
super(e), this.name = "ParseError", this.type = n.type, this.field = n.field, this.value = n.value, this.line = n.line;
|
|
7053
7050
|
}
|
|
7054
7051
|
}
|
|
7055
|
-
function
|
|
7052
|
+
function en(t) {
|
|
7056
7053
|
}
|
|
7057
|
-
function
|
|
7054
|
+
function Ic(t) {
|
|
7058
7055
|
if (typeof t == "function")
|
|
7059
7056
|
throw new TypeError(
|
|
7060
7057
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
7061
7058
|
);
|
|
7062
|
-
const { onEvent: e =
|
|
7059
|
+
const { onEvent: e = en, onError: n = en, onRetry: r = en, onComment: i } = t;
|
|
7063
7060
|
let s = "", o = !0, a, u = "", c = "";
|
|
7064
7061
|
function d(b) {
|
|
7065
|
-
const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, g] =
|
|
7062
|
+
const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, g] = Mc(`${s}${_}`);
|
|
7066
7063
|
for (const m of w)
|
|
7067
7064
|
f(m);
|
|
7068
7065
|
s = g, o = !1;
|
|
@@ -7098,7 +7095,7 @@ function Mc(t) {
|
|
|
7098
7095
|
break;
|
|
7099
7096
|
case "retry":
|
|
7100
7097
|
/^\d+$/.test(_) ? r(parseInt(_, 10)) : n(
|
|
7101
|
-
new
|
|
7098
|
+
new ii(`Invalid \`retry\` value: "${_}"`, {
|
|
7102
7099
|
type: "invalid-retry",
|
|
7103
7100
|
value: _,
|
|
7104
7101
|
line: w
|
|
@@ -7107,7 +7104,7 @@ function Mc(t) {
|
|
|
7107
7104
|
break;
|
|
7108
7105
|
default:
|
|
7109
7106
|
n(
|
|
7110
|
-
new
|
|
7107
|
+
new ii(
|
|
7111
7108
|
`Unknown field "${b.length > 20 ? `${b.slice(0, 20)}…` : b}"`,
|
|
7112
7109
|
{ type: "unknown-field", field: b, value: _, line: w }
|
|
7113
7110
|
)
|
|
@@ -7130,7 +7127,7 @@ function Mc(t) {
|
|
|
7130
7127
|
}
|
|
7131
7128
|
return { feed: d, reset: y };
|
|
7132
7129
|
}
|
|
7133
|
-
function
|
|
7130
|
+
function Mc(t) {
|
|
7134
7131
|
const e = [];
|
|
7135
7132
|
let n = "", r = 0;
|
|
7136
7133
|
for (; r < t.length; ) {
|
|
@@ -7148,7 +7145,7 @@ function Rc(t) {
|
|
|
7148
7145
|
}
|
|
7149
7146
|
return [e, n];
|
|
7150
7147
|
}
|
|
7151
|
-
class
|
|
7148
|
+
class si extends Event {
|
|
7152
7149
|
/**
|
|
7153
7150
|
* Constructs a new `ErrorEvent` instance. This is typically not called directly,
|
|
7154
7151
|
* but rather emitted by the `EventSource` object when an error occurs.
|
|
@@ -7173,7 +7170,7 @@ class oi extends Event {
|
|
|
7173
7170
|
* @returns A string representation of the error
|
|
7174
7171
|
*/
|
|
7175
7172
|
[Symbol.for("nodejs.util.inspect.custom")](e, n, r) {
|
|
7176
|
-
return r(
|
|
7173
|
+
return r(oi(this), n);
|
|
7177
7174
|
}
|
|
7178
7175
|
/**
|
|
7179
7176
|
* Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
@@ -7187,17 +7184,17 @@ class oi extends Event {
|
|
|
7187
7184
|
* @returns A string representation of the error
|
|
7188
7185
|
*/
|
|
7189
7186
|
[Symbol.for("Deno.customInspect")](e, n) {
|
|
7190
|
-
return e(
|
|
7187
|
+
return e(oi(this), n);
|
|
7191
7188
|
}
|
|
7192
7189
|
}
|
|
7193
|
-
function
|
|
7190
|
+
function Rc(t) {
|
|
7194
7191
|
const e = globalThis.DOMException;
|
|
7195
7192
|
return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
|
|
7196
7193
|
}
|
|
7197
|
-
function
|
|
7198
|
-
return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(
|
|
7194
|
+
function Sn(t) {
|
|
7195
|
+
return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(Sn).join(", ") : "cause" in t && t.cause instanceof Error ? `${t}: ${Sn(t.cause)}` : t.message : `${t}`;
|
|
7199
7196
|
}
|
|
7200
|
-
function
|
|
7197
|
+
function oi(t) {
|
|
7201
7198
|
return {
|
|
7202
7199
|
type: t.type,
|
|
7203
7200
|
message: t.message,
|
|
@@ -7207,13 +7204,13 @@ function ai(t) {
|
|
|
7207
7204
|
timeStamp: t.timeStamp
|
|
7208
7205
|
};
|
|
7209
7206
|
}
|
|
7210
|
-
var
|
|
7207
|
+
var Xi = (t) => {
|
|
7211
7208
|
throw TypeError(t);
|
|
7212
|
-
},
|
|
7209
|
+
}, Gn = (t, e, n) => e.has(t) || Xi("Cannot " + n), A = (t, e, n) => (Gn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), N = (t, e, n) => e.has(t) ? Xi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Gn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (Gn(t, e, "access private method"), n), J, Oe, Re, At, Rt, st, De, ot, _e, xe, Le, $e, et, se, On, En, An, ai, jn, kn, tt, Cn, Pn;
|
|
7213
7210
|
class jt extends EventTarget {
|
|
7214
7211
|
constructor(e, n) {
|
|
7215
7212
|
var r, i;
|
|
7216
|
-
super(), N(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, N(this, J), N(this, Oe), N(this, Re), N(this, At), N(this, Rt), N(this, st), N(this, De), N(this, ot, null), N(this, _e), N(this, xe), N(this, Le, null), N(this, $e, null), N(this, et, null), N(this,
|
|
7213
|
+
super(), N(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, N(this, J), N(this, Oe), N(this, Re), N(this, At), N(this, Rt), N(this, st), N(this, De), N(this, ot, null), N(this, _e), N(this, xe), N(this, Le, null), N(this, $e, null), N(this, et, null), N(this, En, async (s) => {
|
|
7217
7214
|
var o;
|
|
7218
7215
|
A(this, xe).reset();
|
|
7219
7216
|
const { body: a, redirected: u, status: c, headers: d } = s;
|
|
@@ -7241,11 +7238,11 @@ class jt extends EventTarget {
|
|
|
7241
7238
|
let y = !0;
|
|
7242
7239
|
do {
|
|
7243
7240
|
const { done: b, value: _ } = await p.read();
|
|
7244
|
-
_ && A(this, xe).feed(l.decode(_, { stream: !b })), b && (y = !1, A(this, xe).reset(), he(this, se,
|
|
7241
|
+
_ && A(this, xe).feed(l.decode(_, { stream: !b })), b && (y = !1, A(this, xe).reset(), he(this, se, Cn).call(this));
|
|
7245
7242
|
} while (y);
|
|
7243
|
+
}), N(this, An, (s) => {
|
|
7244
|
+
$(this, _e, void 0), !(s.name === "AbortError" || s.type === "aborted") && he(this, se, Cn).call(this, Sn(s));
|
|
7246
7245
|
}), N(this, jn, (s) => {
|
|
7247
|
-
$(this, _e, void 0), !(s.name === "AbortError" || s.type === "aborted") && he(this, se, Pn).call(this, On(s));
|
|
7248
|
-
}), N(this, kn, (s) => {
|
|
7249
7246
|
typeof s.id == "string" && $(this, ot, s.id);
|
|
7250
7247
|
const o = new MessageEvent(s.event || "message", {
|
|
7251
7248
|
data: s.data,
|
|
@@ -7253,25 +7250,25 @@ class jt extends EventTarget {
|
|
|
7253
7250
|
lastEventId: s.id || ""
|
|
7254
7251
|
});
|
|
7255
7252
|
A(this, $e) && (!s.event || s.event === "message") && A(this, $e).call(this, o), this.dispatchEvent(o);
|
|
7256
|
-
}), N(this,
|
|
7253
|
+
}), N(this, kn, (s) => {
|
|
7257
7254
|
$(this, st, s);
|
|
7258
|
-
}), N(this,
|
|
7259
|
-
$(this, De, void 0), A(this, J) === this.CONNECTING && he(this, se,
|
|
7255
|
+
}), N(this, Pn, () => {
|
|
7256
|
+
$(this, De, void 0), A(this, J) === this.CONNECTING && he(this, se, On).call(this);
|
|
7260
7257
|
});
|
|
7261
7258
|
try {
|
|
7262
7259
|
if (e instanceof URL)
|
|
7263
7260
|
$(this, Oe, e);
|
|
7264
7261
|
else if (typeof e == "string")
|
|
7265
|
-
$(this, Oe, new URL(e,
|
|
7262
|
+
$(this, Oe, new URL(e, xc()));
|
|
7266
7263
|
else
|
|
7267
7264
|
throw new Error("Invalid URL");
|
|
7268
7265
|
} catch {
|
|
7269
|
-
throw
|
|
7266
|
+
throw Rc("An invalid or illegal string was specified");
|
|
7270
7267
|
}
|
|
7271
|
-
$(this, xe,
|
|
7272
|
-
onEvent: A(this,
|
|
7273
|
-
onRetry: A(this,
|
|
7274
|
-
})), $(this, J, this.CONNECTING), $(this, st, 3e3), $(this, Rt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, At, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), he(this, se,
|
|
7268
|
+
$(this, xe, Ic({
|
|
7269
|
+
onEvent: A(this, jn),
|
|
7270
|
+
onRetry: A(this, kn)
|
|
7271
|
+
})), $(this, J, this.CONNECTING), $(this, st, 3e3), $(this, Rt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, At, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), he(this, se, On).call(this);
|
|
7275
7272
|
}
|
|
7276
7273
|
/**
|
|
7277
7274
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -7349,15 +7346,15 @@ J = /* @__PURE__ */ new WeakMap(), Oe = /* @__PURE__ */ new WeakMap(), Re = /* @
|
|
|
7349
7346
|
*
|
|
7350
7347
|
* @internal
|
|
7351
7348
|
*/
|
|
7352
|
-
|
|
7353
|
-
$(this, J, this.CONNECTING), $(this, _e, new AbortController()), A(this, Rt)(A(this, Oe), he(this, se,
|
|
7354
|
-
},
|
|
7349
|
+
On = function() {
|
|
7350
|
+
$(this, J, this.CONNECTING), $(this, _e, new AbortController()), A(this, Rt)(A(this, Oe), he(this, se, ai).call(this)).then(A(this, En)).catch(A(this, An));
|
|
7351
|
+
}, En = /* @__PURE__ */ new WeakMap(), An = /* @__PURE__ */ new WeakMap(), /**
|
|
7355
7352
|
* Get request options for the `fetch()` request
|
|
7356
7353
|
*
|
|
7357
7354
|
* @returns The request options
|
|
7358
7355
|
* @internal
|
|
7359
7356
|
*/
|
|
7360
|
-
|
|
7357
|
+
ai = function() {
|
|
7361
7358
|
var t;
|
|
7362
7359
|
const e = {
|
|
7363
7360
|
// [spec] Let `corsAttributeState` be `Anonymous`…
|
|
@@ -7369,7 +7366,7 @@ ui = function() {
|
|
|
7369
7366
|
signal: (t = A(this, _e)) == null ? void 0 : t.signal
|
|
7370
7367
|
};
|
|
7371
7368
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
7372
|
-
},
|
|
7369
|
+
}, jn = /* @__PURE__ */ new WeakMap(), kn = /* @__PURE__ */ new WeakMap(), /**
|
|
7373
7370
|
* Handles the process referred to in the EventSource specification as "failing a connection".
|
|
7374
7371
|
*
|
|
7375
7372
|
* @param error - The error causing the connection to fail
|
|
@@ -7379,7 +7376,7 @@ ui = function() {
|
|
|
7379
7376
|
tt = function(t, e) {
|
|
7380
7377
|
var n;
|
|
7381
7378
|
A(this, J) !== this.CLOSED && $(this, J, this.CLOSED);
|
|
7382
|
-
const r = new
|
|
7379
|
+
const r = new si("error", { code: e, message: t });
|
|
7383
7380
|
(n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r);
|
|
7384
7381
|
}, /**
|
|
7385
7382
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
@@ -7388,14 +7385,14 @@ tt = function(t, e) {
|
|
|
7388
7385
|
* @param code - The HTTP status code, if available
|
|
7389
7386
|
* @internal
|
|
7390
7387
|
*/
|
|
7391
|
-
|
|
7388
|
+
Cn = function(t, e) {
|
|
7392
7389
|
var n;
|
|
7393
7390
|
if (A(this, J) === this.CLOSED)
|
|
7394
7391
|
return;
|
|
7395
7392
|
$(this, J, this.CONNECTING);
|
|
7396
|
-
const r = new
|
|
7397
|
-
(n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r), $(this, De, setTimeout(A(this,
|
|
7398
|
-
},
|
|
7393
|
+
const r = new si("error", { code: e, message: t });
|
|
7394
|
+
(n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r), $(this, De, setTimeout(A(this, Pn), A(this, st)));
|
|
7395
|
+
}, Pn = /* @__PURE__ */ new WeakMap(), /**
|
|
7399
7396
|
* ReadyState representing an EventSource currently trying to connect
|
|
7400
7397
|
*
|
|
7401
7398
|
* @public
|
|
@@ -7411,25 +7408,25 @@ jt.OPEN = 1, /**
|
|
|
7411
7408
|
* @public
|
|
7412
7409
|
*/
|
|
7413
7410
|
jt.CLOSED = 2;
|
|
7414
|
-
function
|
|
7411
|
+
function xc() {
|
|
7415
7412
|
const t = "document" in globalThis ? globalThis.document : void 0;
|
|
7416
7413
|
return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
|
|
7417
7414
|
}
|
|
7418
|
-
const
|
|
7415
|
+
const Qn = class Qn extends Pc {
|
|
7419
7416
|
};
|
|
7420
|
-
|
|
7421
|
-
let
|
|
7422
|
-
function
|
|
7417
|
+
Qn.EventSourceImpl = jt;
|
|
7418
|
+
let In = Qn;
|
|
7419
|
+
function $c(t) {
|
|
7423
7420
|
const e = {
|
|
7424
7421
|
...t,
|
|
7425
7422
|
useDateObjects: t.useDateObjects ?? !1
|
|
7426
7423
|
};
|
|
7427
|
-
return new
|
|
7428
|
-
"@instantdb/react":
|
|
7424
|
+
return new In(e, {
|
|
7425
|
+
"@instantdb/react": Bn
|
|
7429
7426
|
});
|
|
7430
7427
|
}
|
|
7431
|
-
const
|
|
7432
|
-
function
|
|
7428
|
+
const Wc = $c;
|
|
7429
|
+
function zc({
|
|
7433
7430
|
as: t = "div",
|
|
7434
7431
|
spaceId: e,
|
|
7435
7432
|
room: n,
|
|
@@ -7481,7 +7478,7 @@ function Vc({
|
|
|
7481
7478
|
[d]: void 0
|
|
7482
7479
|
});
|
|
7483
7480
|
}
|
|
7484
|
-
return
|
|
7481
|
+
return js(
|
|
7485
7482
|
t,
|
|
7486
7483
|
{
|
|
7487
7484
|
onMouseMove: y,
|
|
@@ -7500,9 +7497,9 @@ function Vc({
|
|
|
7500
7497
|
"div",
|
|
7501
7498
|
{
|
|
7502
7499
|
style: {
|
|
7503
|
-
...
|
|
7504
|
-
...
|
|
7505
|
-
zIndex: c !== void 0 ? c :
|
|
7500
|
+
...ui,
|
|
7501
|
+
...Uc,
|
|
7502
|
+
zIndex: c !== void 0 ? c : Lc
|
|
7506
7503
|
},
|
|
7507
7504
|
children: Object.entries(f.peers).map(([g, m]) => {
|
|
7508
7505
|
const E = m[d];
|
|
@@ -7510,7 +7507,7 @@ function Vc({
|
|
|
7510
7507
|
"div",
|
|
7511
7508
|
{
|
|
7512
7509
|
style: {
|
|
7513
|
-
...
|
|
7510
|
+
...ui,
|
|
7514
7511
|
transform: `translate(${E.xPercent}%, ${E.yPercent}%)`,
|
|
7515
7512
|
transformOrigin: "0 0",
|
|
7516
7513
|
transition: "transform 100ms"
|
|
@@ -7518,7 +7515,7 @@ function Vc({
|
|
|
7518
7515
|
children: a ? a({
|
|
7519
7516
|
color: E.color,
|
|
7520
7517
|
presence: l == null ? void 0 : l.peers[g]
|
|
7521
|
-
}) : /* @__PURE__ */ W.jsx(
|
|
7518
|
+
}) : /* @__PURE__ */ W.jsx(Dc, { ...E })
|
|
7522
7519
|
},
|
|
7523
7520
|
g
|
|
7524
7521
|
) : null;
|
|
@@ -7529,7 +7526,7 @@ function Vc({
|
|
|
7529
7526
|
]
|
|
7530
7527
|
);
|
|
7531
7528
|
}
|
|
7532
|
-
function
|
|
7529
|
+
function Dc({ color: t }) {
|
|
7533
7530
|
const n = t || "black";
|
|
7534
7531
|
return /* @__PURE__ */ W.jsxs(
|
|
7535
7532
|
"svg",
|
|
@@ -7576,27 +7573,27 @@ function Uc({ color: t }) {
|
|
|
7576
7573
|
}
|
|
7577
7574
|
);
|
|
7578
7575
|
}
|
|
7579
|
-
const
|
|
7576
|
+
const ui = {
|
|
7580
7577
|
position: "absolute",
|
|
7581
7578
|
top: 0,
|
|
7582
7579
|
left: 0,
|
|
7583
7580
|
bottom: 0,
|
|
7584
7581
|
right: 0
|
|
7585
|
-
},
|
|
7582
|
+
}, Uc = {
|
|
7586
7583
|
overflow: "hidden",
|
|
7587
7584
|
pointerEvents: "none",
|
|
7588
7585
|
userSelect: "none"
|
|
7589
|
-
},
|
|
7586
|
+
}, Lc = 99999;
|
|
7590
7587
|
export {
|
|
7591
|
-
|
|
7588
|
+
zc as Cursors,
|
|
7592
7589
|
Dt as InstantAPIError,
|
|
7593
|
-
|
|
7594
|
-
|
|
7590
|
+
Pc as InstantReactAbstractDatabase,
|
|
7591
|
+
In as InstantReactWebDatabase,
|
|
7595
7592
|
ve as SyncTableCallbackEventType,
|
|
7596
|
-
|
|
7593
|
+
qc as i,
|
|
7597
7594
|
K as id,
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7595
|
+
$c as init,
|
|
7596
|
+
Wc as init_experimental,
|
|
7597
|
+
Nc as lookup,
|
|
7598
|
+
Kc as tx
|
|
7602
7599
|
};
|