@instantdb/react 0.22.65 → 0.22.66-experimental.drewh-entity-caching.19584095731.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 +889 -886
- 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 di, { useRef as at, useCallback as ge, useSyncExternalStore as rn, useEffect as ke, useMemo as sn, useState as fi, 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
|
+
}, li = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Cs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), vt = Symbol.iterator, ne = {
|
|
45
45
|
mutable: "mutable",
|
|
46
46
|
immutable: "immutable"
|
|
47
|
-
},
|
|
47
|
+
}, xn = {};
|
|
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 wr(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 $n(t) {
|
|
63
63
|
return Object.getPrototypeOf(t) === Set.prototype;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function Dn(t) {
|
|
66
66
|
return Object.getPrototypeOf(t) === Map.prototype;
|
|
67
67
|
}
|
|
68
68
|
function te(t) {
|
|
@@ -73,9 +73,9 @@ function je(t) {
|
|
|
73
73
|
return !!j(t);
|
|
74
74
|
}
|
|
75
75
|
function j(t) {
|
|
76
|
-
return typeof t != "object" ? null : t == null ? void 0 : t[
|
|
76
|
+
return typeof t != "object" ? null : t == null ? void 0 : t[li];
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function Un(t) {
|
|
79
79
|
var e;
|
|
80
80
|
const n = j(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 hi(t, e = []) {
|
|
90
90
|
if (Object.hasOwnProperty.call(t, "key")) {
|
|
91
91
|
const n = t.parent.copy, r = j(be(n, t.key));
|
|
92
92
|
if (r !== null && (r == null ? void 0 : r.original) !== t.original)
|
|
@@ -97,10 +97,10 @@ function li(t, e = []) {
|
|
|
97
97
|
e.push(s);
|
|
98
98
|
}
|
|
99
99
|
if (t.parent)
|
|
100
|
-
return
|
|
100
|
+
return hi(t.parent, e);
|
|
101
101
|
e.reverse();
|
|
102
102
|
try {
|
|
103
|
-
|
|
103
|
+
Ps(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 on(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 Ps(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 Cs(t, e) {
|
|
|
141
141
|
}
|
|
142
142
|
return t;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function Is(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 Ps(t) {
|
|
|
157
157
|
}), Reflect.defineProperty(e, n, r);
|
|
158
158
|
}), e;
|
|
159
159
|
}
|
|
160
|
-
const
|
|
161
|
-
function
|
|
160
|
+
const Ms = Object.prototype.propertyIsEnumerable;
|
|
161
|
+
function pi(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 (!$n(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 (!Dn(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 Is(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 hi(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
|
+
Ms.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 = pi(t.original, t.options));
|
|
198
198
|
}
|
|
199
199
|
function Je(t) {
|
|
200
200
|
if (!ae(t))
|
|
201
|
-
return
|
|
201
|
+
return Un(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 (!Dn(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 (!$n(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 mr() {
|
|
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 = mr;
|
|
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 = mr;
|
|
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 Ln(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 yi(t, e, n) {
|
|
298
298
|
if (je(t) || !ae(t, n) || e.has(t) || Object.isFrozen(t))
|
|
299
299
|
return;
|
|
300
300
|
const r = t instanceof Set, i = r ? /* @__PURE__ */ new Map() : void 0;
|
|
301
|
-
if (e.add(t),
|
|
301
|
+
if (e.add(t), Ln(t, (s, o) => {
|
|
302
302
|
var a;
|
|
303
303
|
if (je(o)) {
|
|
304
304
|
const u = j(o);
|
|
@@ -306,7 +306,7 @@ function pi(t, e, n) {
|
|
|
306
306
|
const d = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
|
|
307
307
|
ct(r ? i : t, s, d);
|
|
308
308
|
} else
|
|
309
|
-
|
|
309
|
+
yi(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 pi(t, e, n) {
|
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function Rs(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 && yi(be(n, e), t.finalities.handledSet, t.options);
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function an(t) {
|
|
322
322
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
323
|
-
t.copy.add(
|
|
323
|
+
t.copy.add(Un(e));
|
|
324
324
|
}));
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function un(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 = hi(t);
|
|
330
330
|
s && e(t, s, n, r);
|
|
331
331
|
}
|
|
332
332
|
t.finalized = !0;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function Fn(t, e, n, r) {
|
|
336
336
|
const i = j(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 d = i.original;
|
|
342
|
-
i.copy && (d = i.copy),
|
|
342
|
+
i.copy && (d = i.copy), an(t), un(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(d, i.original)), ct(u, e, d);
|
|
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) && Rs(t, e);
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function xs(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 d = 0; d < s.length; d += 1)
|
|
@@ -392,7 +392,7 @@ function Rs(t, e, n, r, i) {
|
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
function
|
|
395
|
+
function $s({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
396
396
|
n.forEach((a, u) => {
|
|
397
397
|
const d = be(t, u), c = St(be(e, u)), f = a ? nt(t, u) ? U.Replace : U.Add : U.Remove;
|
|
398
398
|
if (ye(d, c) && f === U.Replace)
|
|
@@ -401,7 +401,7 @@ function xs({ 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: c }), s.push(f === U.Add ? { op: U.Remove, path: p } : f === U.Remove ? { op: U.Add, path: p, value: d } : { op: U.Replace, path: p, value: d });
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function Ds({ 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
|
|
441
|
+
return $s(t, e, n, r, i);
|
|
442
442
|
case 1:
|
|
443
|
-
return
|
|
443
|
+
return xs(t, e, n, r, i);
|
|
444
444
|
case 3:
|
|
445
|
-
return
|
|
445
|
+
return Ds(t, e, n, r, i);
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
const jt = (t, e, n = !1) => {
|
|
449
449
|
if (typeof t == "object" && t !== null && (!ae(t, e) || n))
|
|
450
450
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
451
|
-
},
|
|
451
|
+
}, cn = {
|
|
452
452
|
get size() {
|
|
453
453
|
return te(j(this)).size;
|
|
454
454
|
},
|
|
@@ -457,7 +457,7 @@ const jt = (t, e, n = !1) => {
|
|
|
457
457
|
},
|
|
458
458
|
set(t, e) {
|
|
459
459
|
const n = j(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), Fn(n, t, e, ut)), this;
|
|
461
461
|
},
|
|
462
462
|
delete(t) {
|
|
463
463
|
if (!this.has(t))
|
|
@@ -485,7 +485,7 @@ const jt = (t, e, n = !1) => {
|
|
|
485
485
|
const r = j(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 && jt(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 = xn.createDraft({
|
|
489
489
|
original: i,
|
|
490
490
|
parentDraft: r,
|
|
491
491
|
key: t,
|
|
@@ -529,7 +529,7 @@ const jt = (t, e, n = !1) => {
|
|
|
529
529
|
[vt]() {
|
|
530
530
|
return this.entries();
|
|
531
531
|
}
|
|
532
|
-
},
|
|
532
|
+
}, Us = Reflect.ownKeys(cn), vr = (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 jt = (t, e, n = !1) => {
|
|
|
538
538
|
let a = t.setMap.get(o);
|
|
539
539
|
const u = j(a), d = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, a, ne)) === ne.mutable;
|
|
540
540
|
if (t.options.strict && jt(o, t.options, d), !d && !u && ae(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
541
|
-
const c =
|
|
541
|
+
const c = xn.createDraft({
|
|
542
542
|
original: o,
|
|
543
543
|
parentDraft: t,
|
|
544
544
|
key: o,
|
|
@@ -565,7 +565,7 @@ const jt = (t, e, n = !1) => {
|
|
|
565
565
|
},
|
|
566
566
|
add(t) {
|
|
567
567
|
const e = j(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), Fn(e, t, t, ut)), this;
|
|
569
569
|
},
|
|
570
570
|
delete(t) {
|
|
571
571
|
if (!this.has(t))
|
|
@@ -590,7 +590,7 @@ const jt = (t, e, n = !1) => {
|
|
|
590
590
|
const e = t.setMap.keys();
|
|
591
591
|
return {
|
|
592
592
|
[Symbol.iterator]: () => this.values(),
|
|
593
|
-
next:
|
|
593
|
+
next: vr(t, e, { isValuesIterator: !0 })
|
|
594
594
|
};
|
|
595
595
|
},
|
|
596
596
|
entries() {
|
|
@@ -599,7 +599,7 @@ const jt = (t, e, n = !1) => {
|
|
|
599
599
|
const e = t.setMap.keys();
|
|
600
600
|
return {
|
|
601
601
|
[Symbol.iterator]: () => this.entries(),
|
|
602
|
-
next:
|
|
602
|
+
next: vr(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 Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
|
|
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 && bi.has(s))
|
|
648
648
|
return s;
|
|
649
|
-
if (e ===
|
|
649
|
+
if (e === li)
|
|
650
650
|
return t;
|
|
651
651
|
let o;
|
|
652
652
|
if (t.options.mark) {
|
|
@@ -655,14 +655,14 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
|
|
|
655
655
|
return t.options.strict && jt(d, t.options, !0), d;
|
|
656
656
|
}
|
|
657
657
|
const a = te(t);
|
|
658
|
-
if (a instanceof Map &&
|
|
658
|
+
if (a instanceof Map && Us.includes(e)) {
|
|
659
659
|
if (e === "size")
|
|
660
|
-
return Object.getOwnPropertyDescriptor(
|
|
661
|
-
const d =
|
|
660
|
+
return Object.getOwnPropertyDescriptor(cn, "size").get.call(t.proxy);
|
|
661
|
+
const d = cn[e];
|
|
662
662
|
if (d)
|
|
663
663
|
return d.bind(t.proxy);
|
|
664
664
|
}
|
|
665
|
-
if (a instanceof Set &&
|
|
665
|
+
if (a instanceof Set && Ls.includes(e)) {
|
|
666
666
|
if (e === "size")
|
|
667
667
|
return Object.getOwnPropertyDescriptor(Ct, "size").get.call(t.proxy);
|
|
668
668
|
const d = Ct[e];
|
|
@@ -670,7 +670,7 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
|
|
|
670
670
|
return d.bind(t.proxy);
|
|
671
671
|
}
|
|
672
672
|
if (!nt(a, e)) {
|
|
673
|
-
const d =
|
|
673
|
+
const d = wr(a, e);
|
|
674
674
|
return d ? "value" in d ? d.value : (
|
|
675
675
|
// !case: support for getter
|
|
676
676
|
(i = d.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
|
|
@@ -680,7 +680,7 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
|
|
|
680
680
|
if (t.options.strict && jt(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] = Nn({
|
|
684
684
|
original: t.original[e],
|
|
685
685
|
parentDraft: t,
|
|
686
686
|
key: t.type === 1 ? Number(e) : e,
|
|
@@ -701,11 +701,11 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
|
|
|
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 = wr(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 = j(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, Fn(t, e, n, ut)), !0);
|
|
709
709
|
},
|
|
710
710
|
has(t, e) {
|
|
711
711
|
return e in te(t);
|
|
@@ -733,10 +733,10 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
|
|
|
733
733
|
},
|
|
734
734
|
deleteProperty(t, e) {
|
|
735
735
|
var n;
|
|
736
|
-
return t.type === 1 ?
|
|
736
|
+
return t.type === 1 ? _i.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 Nn(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: d } = Proxy.revocable(o === 1 ? Object.assign([], a) : a,
|
|
754
|
-
if (i.revoke.push(d),
|
|
753
|
+
const { proxy: u, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, _i);
|
|
754
|
+
if (i.revoke.push(d), bi.add(u), a.proxy = u, n) {
|
|
755
755
|
const c = n;
|
|
756
756
|
c.finalities.draft.push((f, l) => {
|
|
757
757
|
var p, y;
|
|
@@ -760,7 +760,7 @@ function Fn(t) {
|
|
|
760
760
|
const w = be(_, r), g = j(w);
|
|
761
761
|
if (g) {
|
|
762
762
|
let m = g.original;
|
|
763
|
-
g.operated && (m =
|
|
763
|
+
g.operated && (m = Un(w)), an(g), un(g, ut, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.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 c = j(u);
|
|
771
771
|
c.finalities.draft.push((f, l) => {
|
|
772
|
-
|
|
772
|
+
an(c), un(c, ut, f, l);
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
775
|
return u;
|
|
776
776
|
}
|
|
777
|
-
|
|
778
|
-
function
|
|
777
|
+
xn.createDraft = Nn;
|
|
778
|
+
function Fs(t, e, n, r, i) {
|
|
779
779
|
var s;
|
|
780
780
|
const o = j(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 d = u ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
785
|
-
return o &&
|
|
785
|
+
return o && on(o), i && Me(d, d, o == null ? void 0 : o.options.updatedValues), [
|
|
786
786
|
d,
|
|
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 Ns(t, e) {
|
|
792
792
|
var n;
|
|
793
793
|
const r = {
|
|
794
794
|
draft: [],
|
|
@@ -797,7 +797,7 @@ function Fs(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 : Nn({
|
|
801
801
|
original: t,
|
|
802
802
|
parentDraft: null,
|
|
803
803
|
finalities: r,
|
|
@@ -806,14 +806,14 @@ function Fs(t, e) {
|
|
|
806
806
|
return [
|
|
807
807
|
a,
|
|
808
808
|
(u = []) => {
|
|
809
|
-
const [d, c, f] =
|
|
809
|
+
const [d, c, f] = Fs(a, u, i, s, e.enableAutoFreeze);
|
|
810
810
|
return e.enablePatches ? [d, c, f] : d;
|
|
811
811
|
}
|
|
812
812
|
];
|
|
813
813
|
}
|
|
814
|
-
function
|
|
814
|
+
function dn(t) {
|
|
815
815
|
const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: i = !0 } = t;
|
|
816
|
-
|
|
816
|
+
Ln(n, (s, o, a) => {
|
|
817
817
|
const u = j(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(), c.forEach((f) => a.add(s === f ? d : f));
|
|
824
824
|
} else
|
|
825
825
|
ct(a, s, d);
|
|
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, dn(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 gi(t) {
|
|
830
830
|
var e;
|
|
831
831
|
const n = j(t);
|
|
832
832
|
if (!ae(t, n == null ? void 0 : n.options))
|
|
@@ -836,7 +836,7 @@ function _i(t) {
|
|
|
836
836
|
return n.original;
|
|
837
837
|
let i;
|
|
838
838
|
function s() {
|
|
839
|
-
i = r === 2 ?
|
|
839
|
+
i = r === 2 ? Dn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : pi(t, n == null ? void 0 : n.options);
|
|
840
840
|
}
|
|
841
841
|
if (n) {
|
|
842
842
|
n.finalized = !0;
|
|
@@ -847,23 +847,23 @@ function _i(t) {
|
|
|
847
847
|
}
|
|
848
848
|
} else
|
|
849
849
|
i = t;
|
|
850
|
-
if (
|
|
850
|
+
if (Ln(i, (o, a) => {
|
|
851
851
|
if (n && ye(be(n.original, o), a))
|
|
852
852
|
return;
|
|
853
|
-
const u =
|
|
853
|
+
const u = gi(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 $n(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
|
|
858
858
|
}
|
|
859
859
|
return i;
|
|
860
860
|
}
|
|
861
|
-
function
|
|
861
|
+
function Sr(t) {
|
|
862
862
|
if (!je(t))
|
|
863
863
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
864
|
-
return
|
|
864
|
+
return gi(t);
|
|
865
865
|
}
|
|
866
|
-
const
|
|
866
|
+
const Ks = (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 Ns = (t) => function e(n, r, i) {
|
|
|
874
874
|
if (typeof r != "function" && (c = r), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
|
|
875
875
|
throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
|
|
876
876
|
c = Object.assign(Object.assign({}, t), c);
|
|
877
|
-
const f = je(u) ?
|
|
877
|
+
const f = je(u) ? Sr(u) : u, l = Array.isArray(c.mark) ? (S, I) => {
|
|
878
878
|
for (const x of c.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 Ns = (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] = Ns(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 Ns = (t) => function e(n, r, i) {
|
|
|
900
900
|
try {
|
|
901
901
|
m = d(w);
|
|
902
902
|
} catch (S) {
|
|
903
|
-
throw
|
|
903
|
+
throw on(j(w)), S;
|
|
904
904
|
}
|
|
905
905
|
const E = (S) => {
|
|
906
906
|
const I = j(w);
|
|
907
907
|
if (!je(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[Cs];
|
|
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 && dn({
|
|
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 && dn({ 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 Ns = (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([Sr(S)]);
|
|
929
929
|
}
|
|
930
930
|
return g([S]);
|
|
931
931
|
};
|
|
932
932
|
return m instanceof Promise ? m.then(E, (S) => {
|
|
933
|
-
throw
|
|
933
|
+
throw on(j(w)), S;
|
|
934
934
|
}) : E(m);
|
|
935
|
-
}, Pt =
|
|
935
|
+
}, Pt = Ks();
|
|
936
936
|
Object.prototype.constructor.toString();
|
|
937
|
-
function
|
|
937
|
+
function Ti(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 Or(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 : Ti(t, e) ? Object.keys(t).every((n) => Ot(t[n], e[n])) : !1;
|
|
946
946
|
}
|
|
947
|
-
function
|
|
947
|
+
function Kn(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 wi(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 Ti(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 ? wi(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 qs(t, e, n) {
|
|
975
975
|
if (!t || e.length === 0)
|
|
976
976
|
return;
|
|
977
977
|
let r = t || {};
|
|
@@ -982,7 +982,7 @@ function Ks(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 Er(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 mi(t, e) {
|
|
996
996
|
if (!t || e.length === 0)
|
|
997
997
|
return;
|
|
998
998
|
const [n, ...r] = e;
|
|
@@ -1001,13 +1001,13 @@ function wi(t, e) {
|
|
|
1001
1001
|
Array.isArray(t) ? t.splice(n, 1) : delete t[n];
|
|
1002
1002
|
return;
|
|
1003
1003
|
}
|
|
1004
|
-
|
|
1004
|
+
mi(t[n], r), Ws(t[n]) && delete t[n];
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function Ws(t) {
|
|
1008
1008
|
return t && Object.keys(t).length === 0;
|
|
1009
1009
|
}
|
|
1010
|
-
const
|
|
1010
|
+
const Ar = /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$/, zs = {
|
|
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 Vs(t) {
|
|
1207
1207
|
return new Date(t);
|
|
1208
1208
|
}
|
|
1209
|
-
function
|
|
1209
|
+
function Bs(t) {
|
|
1210
1210
|
return /* @__PURE__ */ new Date(t + "Z");
|
|
1211
1211
|
}
|
|
1212
|
-
const
|
|
1213
|
-
function
|
|
1214
|
-
const e = t.match(
|
|
1212
|
+
const Gs = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
|
|
1213
|
+
function Qs(t) {
|
|
1214
|
+
const e = t.match(Gs);
|
|
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 Hs(t) {
|
|
1221
1221
|
const [e, n] = t.split(" ");
|
|
1222
1222
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1223
1223
|
}
|
|
1224
|
-
function
|
|
1224
|
+
function Ys(t) {
|
|
1225
1225
|
const [e, n] = t.split(" ");
|
|
1226
1226
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1227
1227
|
}
|
|
1228
|
-
function
|
|
1228
|
+
function Js(t) {
|
|
1229
1229
|
return new Date(t);
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1231
|
+
function Zs(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 Xs(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,14 +1243,14 @@ function Zs(t) {
|
|
|
1243
1243
|
}
|
|
1244
1244
|
return null;
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function eo(t) {
|
|
1247
1247
|
const [e, n] = t.split(", "), [r, i, s] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1248
1248
|
if (!o)
|
|
1249
1249
|
throw new Error(`Unable to parse time from: ${t}`);
|
|
1250
1250
|
let [, a, u, d, c] = o;
|
|
1251
1251
|
return a = Number(a), u = Number(u), d = Number(d), c === "PM" && a !== 12 ? a += 12 : c === "AM" && a === 12 && (a = 0), new Date(Date.UTC(s, r - 1, i, a, u, d));
|
|
1252
1252
|
}
|
|
1253
|
-
function
|
|
1253
|
+
function to(t) {
|
|
1254
1254
|
switch (t) {
|
|
1255
1255
|
case "epoch":
|
|
1256
1256
|
return /* @__PURE__ */ new Date(0);
|
|
@@ -1262,27 +1262,27 @@ function eo(t) {
|
|
|
1262
1262
|
return null;
|
|
1263
1263
|
}
|
|
1264
1264
|
}
|
|
1265
|
-
function
|
|
1266
|
-
const e = t.match(
|
|
1265
|
+
function no(t) {
|
|
1266
|
+
const e = t.match(Ar);
|
|
1267
1267
|
if (!e)
|
|
1268
1268
|
return null;
|
|
1269
|
-
const [n] = e, r =
|
|
1269
|
+
const [n] = e, r = zs[n], i = new Date(t.replace(Ar, "Z"));
|
|
1270
1270
|
return new Date(i.getTime() - r * 1e3);
|
|
1271
1271
|
}
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1274
|
-
Hs,
|
|
1275
|
-
Js,
|
|
1276
|
-
Xs,
|
|
1272
|
+
const ro = [
|
|
1273
|
+
Qs,
|
|
1277
1274
|
Ys,
|
|
1278
|
-
Vs,
|
|
1279
1275
|
Zs,
|
|
1280
|
-
Qs,
|
|
1281
|
-
zs,
|
|
1282
1276
|
eo,
|
|
1283
|
-
|
|
1277
|
+
Js,
|
|
1278
|
+
Bs,
|
|
1279
|
+
Xs,
|
|
1280
|
+
Hs,
|
|
1281
|
+
Vs,
|
|
1282
|
+
to,
|
|
1283
|
+
no
|
|
1284
1284
|
];
|
|
1285
|
-
function
|
|
1285
|
+
function io(t, e) {
|
|
1286
1286
|
try {
|
|
1287
1287
|
const n = t(e);
|
|
1288
1288
|
return n instanceof Date && !isNaN(n.getTime()) ? n : null;
|
|
@@ -1290,18 +1290,18 @@ function ro(t, e) {
|
|
|
1290
1290
|
return null;
|
|
1291
1291
|
}
|
|
1292
1292
|
}
|
|
1293
|
-
function
|
|
1294
|
-
for (const e of
|
|
1295
|
-
const n =
|
|
1293
|
+
function fn(t) {
|
|
1294
|
+
for (const e of ro) {
|
|
1295
|
+
const n = io(e, t);
|
|
1296
1296
|
if (n)
|
|
1297
1297
|
return n;
|
|
1298
1298
|
}
|
|
1299
1299
|
return null;
|
|
1300
1300
|
}
|
|
1301
|
-
function
|
|
1301
|
+
function so(t) {
|
|
1302
1302
|
try {
|
|
1303
1303
|
const e = JSON.parse(t);
|
|
1304
|
-
return typeof e == "string" ?
|
|
1304
|
+
return typeof e == "string" ? fn(e) : null;
|
|
1305
1305
|
} catch {
|
|
1306
1306
|
return null;
|
|
1307
1307
|
}
|
|
@@ -1313,7 +1313,7 @@ function xt(t) {
|
|
|
1313
1313
|
if (t instanceof Date)
|
|
1314
1314
|
return t;
|
|
1315
1315
|
if (typeof t == "string") {
|
|
1316
|
-
const e =
|
|
1316
|
+
const e = fn(t) || so(t) || fn(t.trim());
|
|
1317
1317
|
if (!e)
|
|
1318
1318
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1319
1319
|
return e;
|
|
@@ -1322,13 +1322,13 @@ function xt(t) {
|
|
|
1322
1322
|
throw new Error(`Invalid date value \`${t}\`. Expected a date, number, or string, got type ${typeof t}.`);
|
|
1323
1323
|
}
|
|
1324
1324
|
}
|
|
1325
|
-
function
|
|
1325
|
+
function oo(t) {
|
|
1326
1326
|
return t.cardinality === "one";
|
|
1327
1327
|
}
|
|
1328
|
-
function
|
|
1328
|
+
function qn(t) {
|
|
1329
1329
|
return t["value-type"] === "ref";
|
|
1330
1330
|
}
|
|
1331
|
-
function
|
|
1331
|
+
function Wn(t) {
|
|
1332
1332
|
return t["value-type"] === "blob";
|
|
1333
1333
|
}
|
|
1334
1334
|
function qe(t, e) {
|
|
@@ -1358,7 +1358,7 @@ function Z(t, e, n) {
|
|
|
1358
1358
|
let s = t.get(r);
|
|
1359
1359
|
s || (s = /* @__PURE__ */ new Map(), t.set(r, s)), Z(s, i, n);
|
|
1360
1360
|
}
|
|
1361
|
-
function
|
|
1361
|
+
function vi(t, e, n) {
|
|
1362
1362
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
1363
1363
|
for (const o of e) {
|
|
1364
1364
|
let [a, u, d, c] = o;
|
|
@@ -1367,22 +1367,22 @@ function mi(t, e, n) {
|
|
|
1367
1367
|
console.warn("no such attr", a, t);
|
|
1368
1368
|
continue;
|
|
1369
1369
|
}
|
|
1370
|
-
f["checked-data-type"] === "date" && n && (d = xt(d), o[2] = d),
|
|
1370
|
+
f["checked-data-type"] === "date" && n && (d = xt(d), o[2] = d), qn(f) && Z(s, [d, u, a], o), Z(r, [a, u, d], o), Z(i, [u, a, d], o);
|
|
1371
1371
|
}
|
|
1372
1372
|
return { eav: r, aev: i, vae: s };
|
|
1373
1373
|
}
|
|
1374
|
-
function
|
|
1374
|
+
function Si(t) {
|
|
1375
1375
|
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
1376
1376
|
for (const s of Object.values(t)) {
|
|
1377
1377
|
const o = s["forward-identity"], [a, u, d] = o, c = s["reverse-identity"];
|
|
1378
|
-
if (Z(r, [u, d], s),
|
|
1378
|
+
if (Z(r, [u, d], s), Wn(s) && Z(e, [u, d], s), s["primary?"] && Z(n, [u], s), c) {
|
|
1379
1379
|
const [f, l, p] = c;
|
|
1380
1380
|
Z(i, [l, p], s);
|
|
1381
1381
|
}
|
|
1382
1382
|
}
|
|
1383
1383
|
return { blobAttrs: e, primaryKeys: n, forwardIdents: r, revIdents: i };
|
|
1384
1384
|
}
|
|
1385
|
-
function
|
|
1385
|
+
function Oi(t) {
|
|
1386
1386
|
return {
|
|
1387
1387
|
__type: t.__type,
|
|
1388
1388
|
attrs: t.attrs,
|
|
@@ -1392,18 +1392,18 @@ function Si(t) {
|
|
|
1392
1392
|
useDateObjects: t.useDateObjects
|
|
1393
1393
|
};
|
|
1394
1394
|
}
|
|
1395
|
-
function
|
|
1395
|
+
function Ei(t) {
|
|
1396
1396
|
return Et(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
|
|
1397
1397
|
}
|
|
1398
|
-
function
|
|
1398
|
+
function ao(t, e) {
|
|
1399
1399
|
return We(t.eav, [e]) !== void 0;
|
|
1400
1400
|
}
|
|
1401
|
-
function
|
|
1402
|
-
t.attrIndexes =
|
|
1401
|
+
function zn(t) {
|
|
1402
|
+
t.attrIndexes = Si(t.attrs);
|
|
1403
1403
|
}
|
|
1404
1404
|
function Et(t, e, n, r, i) {
|
|
1405
|
-
const s =
|
|
1406
|
-
return s.useDateObjects = i, s.attrs = t, s.attrIndexes =
|
|
1405
|
+
const s = vi(t, e, i);
|
|
1406
|
+
return s.useDateObjects = i, s.attrs = t, s.attrIndexes = Si(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
|
|
1407
1407
|
}
|
|
1408
1408
|
function dt(t, e) {
|
|
1409
1409
|
var n, r;
|
|
@@ -1432,21 +1432,21 @@ function dt(t, e) {
|
|
|
1432
1432
|
return [i, ...a];
|
|
1433
1433
|
}
|
|
1434
1434
|
}
|
|
1435
|
-
function
|
|
1435
|
+
function Ai(t, e) {
|
|
1436
1436
|
const n = dt(t, e);
|
|
1437
1437
|
if (!n)
|
|
1438
1438
|
return;
|
|
1439
1439
|
const [r, i, s] = n, o = qe(t.attrs, i);
|
|
1440
|
-
o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]),
|
|
1440
|
+
o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]), qn(o) && oe(t.vae, [s, i, r]));
|
|
1441
1441
|
}
|
|
1442
|
-
let
|
|
1443
|
-
function
|
|
1442
|
+
let uo = 0;
|
|
1443
|
+
function ki(t, e, n) {
|
|
1444
1444
|
const [r, i, s] = n;
|
|
1445
1445
|
let o;
|
|
1446
1446
|
const a = We(t.ea, [r, i, s]);
|
|
1447
|
-
return a && (o = a[3]), o || Date.now() * 10 +
|
|
1447
|
+
return a && (o = a[3]), o || Date.now() * 10 + uo++;
|
|
1448
1448
|
}
|
|
1449
|
-
function
|
|
1449
|
+
function ji(t, e) {
|
|
1450
1450
|
var n;
|
|
1451
1451
|
const r = dt(t, e);
|
|
1452
1452
|
if (!r)
|
|
@@ -1456,10 +1456,10 @@ function ki(t, e) {
|
|
|
1456
1456
|
if (!a)
|
|
1457
1457
|
return;
|
|
1458
1458
|
a["checked-data-type"] === "date" && t.useDateObjects && (o = xt(o));
|
|
1459
|
-
const u = We(t.eav, [i, s, o]), d = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n :
|
|
1460
|
-
|
|
1459
|
+
const u = We(t.eav, [i, s, o]), d = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n : ki(t, a, r), c = [i, s, o, d];
|
|
1460
|
+
oo(a) ? (Z(t.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), Z(t.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (Z(t.eav, [i, s, o], c), Z(t.aev, [s, i, o], c)), qn(a) && Z(t.vae, [o, s, i], c);
|
|
1461
1461
|
}
|
|
1462
|
-
function
|
|
1462
|
+
function co(t, e) {
|
|
1463
1463
|
var n;
|
|
1464
1464
|
const r = dt(t, e);
|
|
1465
1465
|
if (!r)
|
|
@@ -1467,7 +1467,7 @@ function uo(t, e) {
|
|
|
1467
1467
|
const [i, s, o] = r, a = qe(t.attrs, s);
|
|
1468
1468
|
if (!a)
|
|
1469
1469
|
return;
|
|
1470
|
-
if (!
|
|
1470
|
+
if (!Wn(a))
|
|
1471
1471
|
throw new Error("merge operation is not supported for links");
|
|
1472
1472
|
const u = We(t.eav, [i, s]);
|
|
1473
1473
|
if (!u)
|
|
@@ -1475,15 +1475,15 @@ function uo(t, e) {
|
|
|
1475
1475
|
const d = (n = u.values().next()) === null || n === void 0 ? void 0 : n.value;
|
|
1476
1476
|
if (!d)
|
|
1477
1477
|
return;
|
|
1478
|
-
const c = d[2], f =
|
|
1478
|
+
const c = d[2], f = wi(c, o), l = [
|
|
1479
1479
|
i,
|
|
1480
1480
|
s,
|
|
1481
1481
|
f,
|
|
1482
|
-
|
|
1482
|
+
ki(t, a, d)
|
|
1483
1483
|
];
|
|
1484
1484
|
Z(t.eav, [i, s], /* @__PURE__ */ new Map([[f, l]]));
|
|
1485
1485
|
}
|
|
1486
|
-
function
|
|
1486
|
+
function ln(t, e) {
|
|
1487
1487
|
var n, r;
|
|
1488
1488
|
const [i, s] = e, o = dt(t, [i]);
|
|
1489
1489
|
if (!o)
|
|
@@ -1494,7 +1494,7 @@ function fn(t, e) {
|
|
|
1494
1494
|
const f = t.attrs[c];
|
|
1495
1495
|
f && f["on-delete-reverse"] === "cascade" && X(u.get(c), 1).forEach(([l, p, y]) => {
|
|
1496
1496
|
var b;
|
|
1497
|
-
return
|
|
1497
|
+
return ln(t, [y, (b = f["reverse-identity"]) === null || b === void 0 ? void 0 : b[1]]);
|
|
1498
1498
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
1499
1499
|
// the store that didn't set `etype` in deleteEntity
|
|
1500
1500
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
@@ -1507,54 +1507,54 @@ function fn(t, e) {
|
|
|
1507
1507
|
d && d.forEach((c) => {
|
|
1508
1508
|
var f, l, p;
|
|
1509
1509
|
const [y, b, _] = c, w = t.attrs[b];
|
|
1510
|
-
(!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 &&
|
|
1510
|
+
(!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 && ln(t, [y, (p = w["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
|
|
1511
1511
|
}), ((r = t.vae.get(a)) === null || r === void 0 ? void 0 : r.size) === 0 && oe(t.vae, [a]);
|
|
1512
1512
|
}
|
|
1513
|
-
function
|
|
1514
|
-
const n =
|
|
1513
|
+
function Ci(t, e) {
|
|
1514
|
+
const n = vi(t.attrs, e, t.useDateObjects);
|
|
1515
1515
|
Object.keys(n).forEach((r) => {
|
|
1516
1516
|
t[r] = n[r];
|
|
1517
1517
|
});
|
|
1518
1518
|
}
|
|
1519
|
-
function
|
|
1520
|
-
t.attrs[e.id] = e,
|
|
1519
|
+
function fo(t, [e]) {
|
|
1520
|
+
t.attrs[e.id] = e, zn(t);
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1522
|
+
function Pi(t) {
|
|
1523
1523
|
return X(t.eav, 3);
|
|
1524
1524
|
}
|
|
1525
|
-
function
|
|
1525
|
+
function lo(t, [e]) {
|
|
1526
1526
|
if (!t.attrs[e])
|
|
1527
1527
|
return;
|
|
1528
|
-
const n =
|
|
1529
|
-
delete t.attrs[e],
|
|
1528
|
+
const n = Pi(t).filter(([r, i]) => i !== e);
|
|
1529
|
+
delete t.attrs[e], zn(t), Ci(t, n);
|
|
1530
1530
|
}
|
|
1531
|
-
function
|
|
1531
|
+
function ho(t, [e]) {
|
|
1532
1532
|
const n = t.attrs[e.id];
|
|
1533
|
-
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e),
|
|
1533
|
+
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), zn(t), Ci(t, Pi(t)));
|
|
1534
1534
|
}
|
|
1535
|
-
function
|
|
1535
|
+
function po(t, e) {
|
|
1536
1536
|
const [n, ...r] = e;
|
|
1537
1537
|
switch (n) {
|
|
1538
1538
|
case "add-triple":
|
|
1539
|
-
|
|
1539
|
+
ji(t, r);
|
|
1540
1540
|
break;
|
|
1541
1541
|
case "deep-merge-triple":
|
|
1542
|
-
|
|
1542
|
+
co(t, r);
|
|
1543
1543
|
break;
|
|
1544
1544
|
case "retract-triple":
|
|
1545
|
-
|
|
1545
|
+
Ai(t, r);
|
|
1546
1546
|
break;
|
|
1547
1547
|
case "delete-entity":
|
|
1548
|
-
|
|
1548
|
+
ln(t, r);
|
|
1549
1549
|
break;
|
|
1550
1550
|
case "add-attr":
|
|
1551
|
-
|
|
1551
|
+
fo(t, r);
|
|
1552
1552
|
break;
|
|
1553
1553
|
case "delete-attr":
|
|
1554
|
-
|
|
1554
|
+
lo(t, r);
|
|
1555
1555
|
break;
|
|
1556
1556
|
case "update-attr":
|
|
1557
|
-
|
|
1557
|
+
ho(t, r);
|
|
1558
1558
|
break;
|
|
1559
1559
|
case "restore-attr":
|
|
1560
1560
|
break;
|
|
@@ -1609,13 +1609,13 @@ function gt(t, e, n) {
|
|
|
1609
1609
|
}
|
|
1610
1610
|
return s;
|
|
1611
1611
|
}
|
|
1612
|
-
function
|
|
1612
|
+
function yo(t, e, n) {
|
|
1613
1613
|
let r = "";
|
|
1614
1614
|
return t !== void 0 && (r += "e"), e !== void 0 && (r += "a"), n !== void 0 && (r += "v"), r;
|
|
1615
1615
|
}
|
|
1616
|
-
function
|
|
1616
|
+
function bo(t, [e, n, r]) {
|
|
1617
1617
|
var i, s;
|
|
1618
|
-
switch (
|
|
1618
|
+
switch (yo(e, n, r)) {
|
|
1619
1619
|
case "e": {
|
|
1620
1620
|
const a = t.eav.get(e);
|
|
1621
1621
|
return X(a, 2);
|
|
@@ -1661,33 +1661,36 @@ function yo(t, [e, n, r]) {
|
|
|
1661
1661
|
return X(t.eav, 3);
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
|
-
|
|
1664
|
+
const Yt = {};
|
|
1665
|
+
function _o(t, e, n) {
|
|
1665
1666
|
var r;
|
|
1667
|
+
if (Yt[n])
|
|
1668
|
+
return Yt[n];
|
|
1666
1669
|
const i = {};
|
|
1667
1670
|
for (const [s, o] of e.entries()) {
|
|
1668
1671
|
const a = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), u = X(a, 1);
|
|
1669
1672
|
for (const d of u)
|
|
1670
1673
|
i[s] = d[2];
|
|
1671
1674
|
}
|
|
1672
|
-
return i;
|
|
1675
|
+
return Yt[n] = i, i;
|
|
1673
1676
|
}
|
|
1674
1677
|
function Te(t, e, n) {
|
|
1675
1678
|
var r;
|
|
1676
1679
|
return (r = t.attrIndexes.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
1677
1680
|
}
|
|
1678
|
-
function
|
|
1681
|
+
function Ii(t, e, n) {
|
|
1679
1682
|
var r;
|
|
1680
1683
|
return (r = t.attrIndexes.revIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
1681
1684
|
}
|
|
1682
|
-
function
|
|
1685
|
+
function go(t, e) {
|
|
1683
1686
|
return t.attrIndexes.blobAttrs.get(e);
|
|
1684
1687
|
}
|
|
1685
|
-
function
|
|
1688
|
+
function Mi(t, e) {
|
|
1686
1689
|
var n;
|
|
1687
1690
|
const r = t.attrIndexes.primaryKeys.get(e);
|
|
1688
1691
|
return r || ((n = t.attrIndexes.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
|
|
1689
1692
|
}
|
|
1690
|
-
function
|
|
1693
|
+
function To(t, e) {
|
|
1691
1694
|
const n = dt(t, e);
|
|
1692
1695
|
if (!n)
|
|
1693
1696
|
return;
|
|
@@ -1695,7 +1698,7 @@ function go(t, e) {
|
|
|
1695
1698
|
if (qe(t.attrs, i))
|
|
1696
1699
|
return We(t.eav, [r, i]);
|
|
1697
1700
|
}
|
|
1698
|
-
function
|
|
1701
|
+
function wo(t, e) {
|
|
1699
1702
|
const n = e.filter(([r, i, s, o, a]) => {
|
|
1700
1703
|
if (r !== "add-triple" && r !== "deep-merge-triple")
|
|
1701
1704
|
return !0;
|
|
@@ -1705,39 +1708,39 @@ function To(t, e) {
|
|
|
1705
1708
|
let d = !1;
|
|
1706
1709
|
const c = qe(t.attrs, s);
|
|
1707
1710
|
if (c) {
|
|
1708
|
-
const f =
|
|
1709
|
-
d = !!
|
|
1711
|
+
const f = Mi(t, c["forward-identity"][1]);
|
|
1712
|
+
d = !!To(t, [i, f.id, i]);
|
|
1710
1713
|
}
|
|
1711
1714
|
return !(u === "create" && d || u === "update" && !d);
|
|
1712
1715
|
});
|
|
1713
1716
|
return Pt(t, (r) => {
|
|
1714
1717
|
n.forEach((i) => {
|
|
1715
|
-
|
|
1718
|
+
po(r, i);
|
|
1716
1719
|
});
|
|
1717
1720
|
});
|
|
1718
1721
|
}
|
|
1719
|
-
function
|
|
1722
|
+
function mo(t) {
|
|
1720
1723
|
return typeof t == "string" && t.startsWith("?");
|
|
1721
1724
|
}
|
|
1722
|
-
function
|
|
1725
|
+
function vo(t, e, n) {
|
|
1723
1726
|
if (n.hasOwnProperty(t)) {
|
|
1724
1727
|
const r = n[t];
|
|
1725
|
-
return
|
|
1728
|
+
return Ri(r, e, n);
|
|
1726
1729
|
}
|
|
1727
1730
|
return Object.assign(Object.assign({}, n), { [t]: e });
|
|
1728
1731
|
}
|
|
1729
|
-
function
|
|
1732
|
+
function kr(t, e, n) {
|
|
1730
1733
|
return t === e ? n : null;
|
|
1731
1734
|
}
|
|
1732
|
-
function
|
|
1735
|
+
function So(t) {
|
|
1733
1736
|
switch (typeof t) {
|
|
1734
1737
|
case "string":
|
|
1735
|
-
return t.startsWith("?") ?
|
|
1738
|
+
return t.startsWith("?") ? vo : kr;
|
|
1736
1739
|
default:
|
|
1737
|
-
return
|
|
1740
|
+
return kr;
|
|
1738
1741
|
}
|
|
1739
1742
|
}
|
|
1740
|
-
const
|
|
1743
|
+
const Oo = [
|
|
1741
1744
|
"in",
|
|
1742
1745
|
"$in",
|
|
1743
1746
|
"$not",
|
|
@@ -1745,77 +1748,77 @@ const So = [
|
|
|
1745
1748
|
"$comparator"
|
|
1746
1749
|
// covers all of $gt, $lt, etc.
|
|
1747
1750
|
];
|
|
1748
|
-
function
|
|
1749
|
-
for (const e of
|
|
1751
|
+
function Eo(t) {
|
|
1752
|
+
for (const e of Oo)
|
|
1750
1753
|
if (t.hasOwnProperty(e))
|
|
1751
1754
|
return !0;
|
|
1752
1755
|
return !1;
|
|
1753
1756
|
}
|
|
1754
|
-
function
|
|
1755
|
-
return n ? typeof t == "object" ?
|
|
1757
|
+
function Ri(t, e, n) {
|
|
1758
|
+
return n ? typeof t == "object" ? Eo(t) ? n : null : So(t)(t, e, n) : null;
|
|
1756
1759
|
}
|
|
1757
|
-
function
|
|
1760
|
+
function Ao(t, e, n) {
|
|
1758
1761
|
return t.reduce((r, i, s) => {
|
|
1759
1762
|
const o = e[s];
|
|
1760
|
-
return
|
|
1763
|
+
return Ri(i, o, r);
|
|
1761
1764
|
}, n);
|
|
1762
1765
|
}
|
|
1763
|
-
function Ao(t, e, n) {
|
|
1764
|
-
return Co(t, e, n).map((r) => Eo(e, r, n)).filter((r) => r);
|
|
1765
|
-
}
|
|
1766
1766
|
function ko(t, e, n) {
|
|
1767
|
-
return
|
|
1767
|
+
return Po(t, e, n).map((r) => Ao(e, r, n)).filter((r) => r);
|
|
1768
|
+
}
|
|
1769
|
+
function jo(t, e, n) {
|
|
1770
|
+
return e.or ? e.or.patterns.flatMap((r) => hn(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => hn(t, i, r), n) : n.flatMap((r) => ko(t, e, r));
|
|
1768
1771
|
}
|
|
1769
|
-
function
|
|
1770
|
-
return e.reduce((r, i) =>
|
|
1772
|
+
function hn(t, e, n = [{}]) {
|
|
1773
|
+
return e.reduce((r, i) => jo(t, i, r), n);
|
|
1771
1774
|
}
|
|
1772
|
-
function
|
|
1773
|
-
return Array.isArray(e) ? e.map((n) =>
|
|
1775
|
+
function Vn(t, e) {
|
|
1776
|
+
return Array.isArray(e) ? e.map((n) => Vn(t, n)) : mo(e) ? t[e] : e;
|
|
1774
1777
|
}
|
|
1775
|
-
function
|
|
1776
|
-
return
|
|
1778
|
+
function Co(t, { find: e, where: n }) {
|
|
1779
|
+
return hn(t, n).map((i) => Vn(i, e));
|
|
1777
1780
|
}
|
|
1778
|
-
function
|
|
1779
|
-
return
|
|
1781
|
+
function Po(t, e, n) {
|
|
1782
|
+
return bo(t, Vn(n, e));
|
|
1780
1783
|
}
|
|
1781
|
-
const
|
|
1784
|
+
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;
|
|
1782
1785
|
function Fe(t) {
|
|
1783
|
-
return typeof t == "string" &&
|
|
1786
|
+
return typeof t == "string" && Io.test(t);
|
|
1784
1787
|
}
|
|
1785
1788
|
const q = [];
|
|
1786
1789
|
for (let t = 0; t < 256; ++t)
|
|
1787
1790
|
q.push((t + 256).toString(16).slice(1));
|
|
1788
|
-
function
|
|
1791
|
+
function Mo(t, e = 0) {
|
|
1789
1792
|
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();
|
|
1790
1793
|
}
|
|
1791
|
-
let
|
|
1792
|
-
const
|
|
1793
|
-
function
|
|
1794
|
-
if (!
|
|
1794
|
+
let Jt;
|
|
1795
|
+
const Ro = new Uint8Array(16);
|
|
1796
|
+
function xo() {
|
|
1797
|
+
if (!Jt) {
|
|
1795
1798
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1796
1799
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1797
|
-
|
|
1800
|
+
Jt = crypto.getRandomValues.bind(crypto);
|
|
1798
1801
|
}
|
|
1799
|
-
return
|
|
1802
|
+
return Jt(Ro);
|
|
1800
1803
|
}
|
|
1801
|
-
const
|
|
1802
|
-
function
|
|
1804
|
+
const $o = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), jr = { randomUUID: $o };
|
|
1805
|
+
function Do(t, e, n) {
|
|
1803
1806
|
var i;
|
|
1804
|
-
if (
|
|
1805
|
-
return
|
|
1807
|
+
if (jr.randomUUID && !t)
|
|
1808
|
+
return jr.randomUUID();
|
|
1806
1809
|
t = t || {};
|
|
1807
|
-
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ??
|
|
1810
|
+
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? xo();
|
|
1808
1811
|
if (r.length < 16)
|
|
1809
1812
|
throw new Error("Random bytes length must be >= 16");
|
|
1810
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1813
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Mo(r);
|
|
1811
1814
|
}
|
|
1812
|
-
function
|
|
1815
|
+
function Cr(t) {
|
|
1813
1816
|
const e = t.replace(/-/g, ""), n = [];
|
|
1814
1817
|
for (let r = 0; r < e.length; r += 2)
|
|
1815
1818
|
n.push(parseInt(e.substring(r, r + 2), 16));
|
|
1816
1819
|
return n;
|
|
1817
1820
|
}
|
|
1818
|
-
function
|
|
1821
|
+
function Uo(t, e) {
|
|
1819
1822
|
for (let n = 0; n < t.length; n++) {
|
|
1820
1823
|
if (t[n] < e[n])
|
|
1821
1824
|
return -1;
|
|
@@ -1824,17 +1827,17 @@ function Do(t, e) {
|
|
|
1824
1827
|
}
|
|
1825
1828
|
return 0;
|
|
1826
1829
|
}
|
|
1827
|
-
function
|
|
1828
|
-
return
|
|
1830
|
+
function Lo(t, e) {
|
|
1831
|
+
return Uo(Cr(t), Cr(e));
|
|
1829
1832
|
}
|
|
1830
1833
|
function K() {
|
|
1831
|
-
return
|
|
1834
|
+
return Do();
|
|
1832
1835
|
}
|
|
1833
|
-
function
|
|
1836
|
+
function Fo(t, e) {
|
|
1834
1837
|
return t.localeCompare(e);
|
|
1835
1838
|
}
|
|
1836
|
-
function
|
|
1837
|
-
let t =
|
|
1839
|
+
function No() {
|
|
1840
|
+
let t = Fo;
|
|
1838
1841
|
if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
|
|
1839
1842
|
try {
|
|
1840
1843
|
t = Intl.Collator("en-US").compare;
|
|
@@ -1842,10 +1845,10 @@ function Fo() {
|
|
|
1842
1845
|
}
|
|
1843
1846
|
return t;
|
|
1844
1847
|
}
|
|
1845
|
-
const
|
|
1846
|
-
let
|
|
1848
|
+
const Ko = No();
|
|
1849
|
+
let qo = 0;
|
|
1847
1850
|
function rt(t) {
|
|
1848
|
-
return $t(`_${t}`,
|
|
1851
|
+
return $t(`_${t}`, qo++);
|
|
1849
1852
|
}
|
|
1850
1853
|
function $t(t, e) {
|
|
1851
1854
|
return `?${t}-${e}`;
|
|
@@ -1855,28 +1858,28 @@ class Ne extends Error {
|
|
|
1855
1858
|
super(e), this.name = "AttrNotFoundError";
|
|
1856
1859
|
}
|
|
1857
1860
|
}
|
|
1858
|
-
function
|
|
1859
|
-
const n =
|
|
1861
|
+
function Wo(t, e) {
|
|
1862
|
+
const n = Mi(t, e);
|
|
1860
1863
|
if (!n)
|
|
1861
1864
|
throw new Ne(`Could not find id attr for ${e}`);
|
|
1862
1865
|
return n;
|
|
1863
1866
|
}
|
|
1864
|
-
function
|
|
1865
|
-
return [
|
|
1867
|
+
function Pr(t, e, n, r) {
|
|
1868
|
+
return [zo(t, e, n, r)];
|
|
1866
1869
|
}
|
|
1867
|
-
function
|
|
1870
|
+
function zo(t, e, n, r) {
|
|
1868
1871
|
return [
|
|
1869
1872
|
t(n, r),
|
|
1870
|
-
|
|
1873
|
+
Wo(e, n).id,
|
|
1871
1874
|
t(n, r),
|
|
1872
1875
|
t("time", r)
|
|
1873
1876
|
];
|
|
1874
1877
|
}
|
|
1875
|
-
function
|
|
1878
|
+
function Vo(t, e, n) {
|
|
1876
1879
|
return t.map((r) => r === e ? n : r);
|
|
1877
1880
|
}
|
|
1878
|
-
function
|
|
1879
|
-
const s = Te(e, n, i), o =
|
|
1881
|
+
function xi(t, e, n, r, i) {
|
|
1882
|
+
const s = Te(e, n, i), o = Ii(e, n, i), a = s || o;
|
|
1880
1883
|
if (!a)
|
|
1881
1884
|
throw new Ne(`Could not find attr for ${[n, i]}`);
|
|
1882
1885
|
if (a["value-type"] !== "ref")
|
|
@@ -1894,7 +1897,7 @@ function Ri(t, e, n, r, i) {
|
|
|
1894
1897
|
];
|
|
1895
1898
|
return [s ? f : d, l, p, a, !!s];
|
|
1896
1899
|
}
|
|
1897
|
-
function
|
|
1900
|
+
function Ir(t, e) {
|
|
1898
1901
|
if (typeof e != "string")
|
|
1899
1902
|
return function(o) {
|
|
1900
1903
|
return !1;
|
|
@@ -1904,7 +1907,7 @@ function Pr(t, e) {
|
|
|
1904
1907
|
return typeof o != "string" ? !1 : i.test(o);
|
|
1905
1908
|
};
|
|
1906
1909
|
}
|
|
1907
|
-
function
|
|
1910
|
+
function Bo(t, e) {
|
|
1908
1911
|
if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
|
|
1909
1912
|
return e;
|
|
1910
1913
|
const n = t["checked-data-type"] === "date";
|
|
@@ -1945,7 +1948,7 @@ function Vo(t, e) {
|
|
|
1945
1948
|
}
|
|
1946
1949
|
};
|
|
1947
1950
|
if (e.hasOwnProperty("$like")) {
|
|
1948
|
-
const r =
|
|
1951
|
+
const r = Ir(!0, e.$like);
|
|
1949
1952
|
return {
|
|
1950
1953
|
$comparator: !0,
|
|
1951
1954
|
$op: function(s) {
|
|
@@ -1954,7 +1957,7 @@ function Vo(t, e) {
|
|
|
1954
1957
|
};
|
|
1955
1958
|
}
|
|
1956
1959
|
if (e.hasOwnProperty("$ilike")) {
|
|
1957
|
-
const r =
|
|
1960
|
+
const r = Ir(!1, e.$ilike);
|
|
1958
1961
|
return {
|
|
1959
1962
|
$comparator: !0,
|
|
1960
1963
|
$op: function(s) {
|
|
@@ -1964,8 +1967,8 @@ function Vo(t, e) {
|
|
|
1964
1967
|
}
|
|
1965
1968
|
return e;
|
|
1966
1969
|
}
|
|
1967
|
-
function
|
|
1968
|
-
const o = Te(e, n, i), a =
|
|
1970
|
+
function Go(t, e, n, r, i, s) {
|
|
1971
|
+
const o = Te(e, n, i), a = Ii(e, n, i), u = o || a;
|
|
1969
1972
|
if (!u)
|
|
1970
1973
|
throw new Ne(`No attr for etype = ${n} label = ${i}`);
|
|
1971
1974
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
@@ -1982,63 +1985,63 @@ function Bo(t, e, n, r, i, s) {
|
|
|
1982
1985
|
return o ? [
|
|
1983
1986
|
t(n, r),
|
|
1984
1987
|
u.id,
|
|
1985
|
-
|
|
1988
|
+
Bo(u, s),
|
|
1986
1989
|
rt("time")
|
|
1987
1990
|
] : [s, u.id, t(n, r), rt("time")];
|
|
1988
1991
|
}
|
|
1989
|
-
function
|
|
1992
|
+
function Qo(t, e, n, r, i) {
|
|
1990
1993
|
const [s, o, a] = i.reduce((u, d) => {
|
|
1991
|
-
const [c, f, l] = u, [p, y, b] =
|
|
1994
|
+
const [c, f, l] = u, [p, y, b] = xi(t, e, c, f, d);
|
|
1992
1995
|
return [p, y, [...l, b]];
|
|
1993
1996
|
}, [n, r, []]);
|
|
1994
1997
|
return [s, o, a];
|
|
1995
1998
|
}
|
|
1996
|
-
function
|
|
1997
|
-
const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, d, c] =
|
|
1999
|
+
function pn(t, e, n, r, i, s) {
|
|
2000
|
+
const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, d, c] = Qo(t, e, n, r, o), f = Go(t, e, u, d, a, s);
|
|
1998
2001
|
return c.concat([f]);
|
|
1999
2002
|
}
|
|
2000
|
-
function
|
|
2003
|
+
function Ho(t, e) {
|
|
2001
2004
|
return e ? [e].concat(t) : t;
|
|
2002
2005
|
}
|
|
2003
|
-
function
|
|
2006
|
+
function Yo([t, e]) {
|
|
2004
2007
|
return t === "or" && Array.isArray(e);
|
|
2005
2008
|
}
|
|
2006
|
-
function
|
|
2009
|
+
function Jo([t, e]) {
|
|
2007
2010
|
return t === "and" && Array.isArray(e);
|
|
2008
2011
|
}
|
|
2009
|
-
function
|
|
2012
|
+
function Zo(t, e, n) {
|
|
2010
2013
|
return (r, i) => {
|
|
2011
2014
|
const s = t(r, i);
|
|
2012
2015
|
return e == s ? s : `${s}-${n}`;
|
|
2013
2016
|
};
|
|
2014
2017
|
}
|
|
2015
|
-
function
|
|
2018
|
+
function Mr(t, e, n, r, i, s) {
|
|
2016
2019
|
const o = t(r, i), a = s.map((u, d) => {
|
|
2017
|
-
const c =
|
|
2018
|
-
return
|
|
2020
|
+
const c = Zo(t, o, d);
|
|
2021
|
+
return $i(c, n, r, i, u);
|
|
2019
2022
|
});
|
|
2020
2023
|
return { [e]: { patterns: a, joinSym: o } };
|
|
2021
2024
|
}
|
|
2022
|
-
function
|
|
2025
|
+
function Xo(t) {
|
|
2023
2026
|
const e = [];
|
|
2024
2027
|
for (let n = 1; n <= t.length; n++)
|
|
2025
2028
|
e.push(t.slice(0, n));
|
|
2026
2029
|
return e;
|
|
2027
2030
|
}
|
|
2028
|
-
function
|
|
2029
|
-
return
|
|
2031
|
+
function Rr(t, e, n, r, i) {
|
|
2032
|
+
return Xo(i).map((s) => pn(t, e, n, r, s, { $isNull: !0 }));
|
|
2030
2033
|
}
|
|
2031
|
-
function
|
|
2034
|
+
function $i(t, e, n, r, i) {
|
|
2032
2035
|
return Object.entries(i).flatMap(([s, o]) => {
|
|
2033
|
-
if (Ho([s, o]))
|
|
2034
|
-
return Ir(t, "or", e, n, r, o);
|
|
2035
2036
|
if (Yo([s, o]))
|
|
2036
|
-
return
|
|
2037
|
+
return Mr(t, "or", e, n, r, o);
|
|
2038
|
+
if (Jo([s, o]))
|
|
2039
|
+
return Mr(t, "and", e, n, r, o);
|
|
2037
2040
|
if (s === "$entityIdStartsWith")
|
|
2038
2041
|
return [];
|
|
2039
2042
|
const a = s.split(".");
|
|
2040
2043
|
if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2041
|
-
const u =
|
|
2044
|
+
const u = pn(t, e, n, r, a, o), d = Rr(t, e, n, r, a);
|
|
2042
2045
|
return [
|
|
2043
2046
|
{
|
|
2044
2047
|
or: {
|
|
@@ -2051,32 +2054,32 @@ function xi(t, e, n, r, i) {
|
|
|
2051
2054
|
return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && a.length > 1 ? [
|
|
2052
2055
|
{
|
|
2053
2056
|
or: {
|
|
2054
|
-
patterns:
|
|
2057
|
+
patterns: Rr(t, e, n, r, a),
|
|
2055
2058
|
joinSym: t(n, r)
|
|
2056
2059
|
}
|
|
2057
2060
|
}
|
|
2058
|
-
] :
|
|
2061
|
+
] : pn(t, e, n, r, a, o);
|
|
2059
2062
|
});
|
|
2060
2063
|
}
|
|
2061
|
-
function
|
|
2064
|
+
function ea(t, e, n, r) {
|
|
2062
2065
|
const i = $t;
|
|
2063
|
-
return r ?
|
|
2066
|
+
return r ? $i(i, t, e, n, r).concat(Pr(i, t, e, n)) : Pr(i, t, e, n);
|
|
2064
2067
|
}
|
|
2065
|
-
function
|
|
2068
|
+
function ta(t, e, n) {
|
|
2066
2069
|
return [t(e, n), t("time", n)];
|
|
2067
2070
|
}
|
|
2068
|
-
function
|
|
2069
|
-
const [o, a, u, d, c] =
|
|
2071
|
+
function na(t, e, n, r, i, s) {
|
|
2072
|
+
const [o, a, u, d, c] = xi(t, e, n, r, i), f = Vo(u, t(n, r), s);
|
|
2070
2073
|
return [o, a, f, d, c];
|
|
2071
2074
|
}
|
|
2072
|
-
function
|
|
2075
|
+
function ra(t, e, { etype: n, level: r, form: i }, s) {
|
|
2073
2076
|
const o = Object.keys(i).filter((a) => a !== "$");
|
|
2074
2077
|
return o.length ? Object.entries(s).map(function([u, d]) {
|
|
2075
2078
|
return o.map(function(l) {
|
|
2076
2079
|
var p, y, b;
|
|
2077
2080
|
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));
|
|
2078
2081
|
try {
|
|
2079
|
-
const [w, g, m] =
|
|
2082
|
+
const [w, g, m] = na(t, e, n, r, l, u), E = Ui(e, {
|
|
2080
2083
|
etype: w,
|
|
2081
2084
|
level: g,
|
|
2082
2085
|
form: i[l],
|
|
@@ -2093,48 +2096,48 @@ function na(t, e, { etype: n, level: r, form: i }, s) {
|
|
|
2093
2096
|
}, d);
|
|
2094
2097
|
}) : Object.values(s);
|
|
2095
2098
|
}
|
|
2096
|
-
function
|
|
2097
|
-
return n === "string" ?
|
|
2099
|
+
function ia(t, e, n) {
|
|
2100
|
+
return n === "string" ? Ko(t, e) : t > e ? 1 : -1;
|
|
2098
2101
|
}
|
|
2099
2102
|
function Xe(t, e, n, r, i) {
|
|
2100
|
-
return e === r || e == null && r == null ?
|
|
2103
|
+
return e === r || e == null && r == null ? Lo(t, n) : r == null ? 1 : e == null ? -1 : ia(e, r, i);
|
|
2101
2104
|
}
|
|
2102
2105
|
function It([t, e], [n, r], i) {
|
|
2103
2106
|
return Xe(t, e, n, r, i);
|
|
2104
2107
|
}
|
|
2105
|
-
function
|
|
2108
|
+
function yn(t) {
|
|
2106
2109
|
return t == null ? t : new Date(t).getTime();
|
|
2107
2110
|
}
|
|
2108
|
-
function
|
|
2111
|
+
function sa(t, e, n, r) {
|
|
2109
2112
|
var i;
|
|
2110
2113
|
const [s, o, a, u] = t, d = n === "desc" ? 1 : -1;
|
|
2111
2114
|
if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
|
|
2112
2115
|
return It(r, [s, u], null) === d;
|
|
2113
|
-
const [c, f] = r, l = e["checked-data-type"], p = l === "date" ?
|
|
2116
|
+
const [c, f] = r, l = e["checked-data-type"], p = l === "date" ? yn(f) : f, y = l === "date" ? yn(a) : a;
|
|
2114
2117
|
return It([c, p], [s, y], l) === d;
|
|
2115
2118
|
}
|
|
2116
|
-
function
|
|
2119
|
+
function oa(t, e) {
|
|
2117
2120
|
const n = e[1];
|
|
2118
2121
|
return t.attrs[n];
|
|
2119
2122
|
}
|
|
2120
|
-
function
|
|
2123
|
+
function aa(t, e, n) {
|
|
2121
2124
|
const r = Object.keys(n)[0];
|
|
2122
2125
|
return Te(t, e, r);
|
|
2123
2126
|
}
|
|
2124
|
-
function
|
|
2127
|
+
function ua(t, e, n, r) {
|
|
2125
2128
|
if (n)
|
|
2126
|
-
return
|
|
2129
|
+
return oa(t, n);
|
|
2127
2130
|
if (r)
|
|
2128
|
-
return
|
|
2131
|
+
return aa(t, e, r);
|
|
2129
2132
|
}
|
|
2130
|
-
function
|
|
2133
|
+
function ca(t, e, n) {
|
|
2131
2134
|
var r, i;
|
|
2132
2135
|
if (!Array.isArray(n.fields))
|
|
2133
|
-
return
|
|
2136
|
+
return go(t, e);
|
|
2134
2137
|
const s = /* @__PURE__ */ new Map();
|
|
2135
2138
|
for (const o of n.fields) {
|
|
2136
2139
|
const a = Te(t, e, o), u = (r = a == null ? void 0 : a["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
|
|
2137
|
-
u &&
|
|
2140
|
+
u && Wn(a) && s.set(u, a);
|
|
2138
2141
|
}
|
|
2139
2142
|
if (!s.has("id")) {
|
|
2140
2143
|
const o = Te(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
|
|
@@ -2142,17 +2145,17 @@ function ua(t, e, n) {
|
|
|
2142
2145
|
}
|
|
2143
2146
|
return s;
|
|
2144
2147
|
}
|
|
2145
|
-
function
|
|
2148
|
+
function da(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
2146
2149
|
var s, o;
|
|
2147
|
-
const a = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, u =
|
|
2148
|
-
let c =
|
|
2149
|
-
const f = n == null ? void 0 : n["start-cursor"], l =
|
|
2150
|
+
const a = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, u = Di(i), d = fa(i);
|
|
2151
|
+
let c = Co(t, r);
|
|
2152
|
+
const f = n == null ? void 0 : n["start-cursor"], l = ua(t, e, f, a);
|
|
2150
2153
|
if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
|
|
2151
2154
|
const b = l["checked-data-type"] === "date", _ = l.id;
|
|
2152
2155
|
c = c.map(([w]) => {
|
|
2153
2156
|
var g, m, E, S, I;
|
|
2154
2157
|
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];
|
|
2155
|
-
return b && (x =
|
|
2158
|
+
return b && (x = yn(x)), [w, x];
|
|
2156
2159
|
});
|
|
2157
2160
|
}
|
|
2158
2161
|
c.sort(d === "asc" ? function(_, w) {
|
|
@@ -2161,31 +2164,31 @@ function ca(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
|
2161
2164
|
return It(w, _, l == null ? void 0 : l["checked-data-type"]);
|
|
2162
2165
|
});
|
|
2163
2166
|
let p = {};
|
|
2164
|
-
const y =
|
|
2167
|
+
const y = ca(t, e, r);
|
|
2165
2168
|
for (const b of c) {
|
|
2166
2169
|
const [_] = b;
|
|
2167
|
-
if (p[_] || !u && f && l &&
|
|
2170
|
+
if (p[_] || !u && f && l && sa(f, l, d, b))
|
|
2168
2171
|
continue;
|
|
2169
|
-
const w =
|
|
2172
|
+
const w = _o(t, y, _);
|
|
2170
2173
|
w && (p[_] = w);
|
|
2171
2174
|
}
|
|
2172
2175
|
return p;
|
|
2173
2176
|
}
|
|
2174
|
-
function
|
|
2177
|
+
function fa(t) {
|
|
2175
2178
|
var e;
|
|
2176
2179
|
const n = (e = t.$) === null || e === void 0 ? void 0 : e.order;
|
|
2177
2180
|
return n && n[Object.keys(n)[0]] || "asc";
|
|
2178
2181
|
}
|
|
2179
|
-
function
|
|
2182
|
+
function Di(t) {
|
|
2180
2183
|
var e, n, r;
|
|
2181
2184
|
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;
|
|
2182
2185
|
return !i && !s && !o;
|
|
2183
2186
|
}
|
|
2184
|
-
function
|
|
2187
|
+
function la(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
2185
2188
|
var o, a, u, d, c;
|
|
2186
|
-
if (
|
|
2189
|
+
if (!Di(r) && (!s || !s["start-cursor"]))
|
|
2187
2190
|
return [];
|
|
2188
|
-
const f =
|
|
2191
|
+
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, {
|
|
2189
2192
|
etype: e,
|
|
2190
2193
|
pageInfo: s,
|
|
2191
2194
|
form: r,
|
|
@@ -2198,20 +2201,20 @@ function fa(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
|
2198
2201
|
}
|
|
2199
2202
|
return y;
|
|
2200
2203
|
}
|
|
2201
|
-
function
|
|
2204
|
+
function ha(t, e) {
|
|
2202
2205
|
try {
|
|
2203
|
-
return
|
|
2206
|
+
return la(t, e);
|
|
2204
2207
|
} catch (n) {
|
|
2205
2208
|
if (n instanceof Ne)
|
|
2206
2209
|
return {};
|
|
2207
2210
|
throw n;
|
|
2208
2211
|
}
|
|
2209
2212
|
}
|
|
2210
|
-
function
|
|
2211
|
-
const n =
|
|
2212
|
-
return
|
|
2213
|
+
function Ui(t, e) {
|
|
2214
|
+
const n = ha(t, e);
|
|
2215
|
+
return ra($t, t, e, n);
|
|
2213
2216
|
}
|
|
2214
|
-
function
|
|
2217
|
+
function pa(t) {
|
|
2215
2218
|
const e = {};
|
|
2216
2219
|
for (const [n, r] of Object.entries(t))
|
|
2217
2220
|
e[n] = {
|
|
@@ -2222,18 +2225,18 @@ function ha(t) {
|
|
|
2222
2225
|
};
|
|
2223
2226
|
return e;
|
|
2224
2227
|
}
|
|
2225
|
-
function
|
|
2228
|
+
function Li({ store: t, pageInfo: e, aggregate: n }, r) {
|
|
2226
2229
|
const s = { data: Object.keys(r).reduce(function(a, u) {
|
|
2227
|
-
return n != null && n[u] || u === "$$ruleParams" || (a[u] =
|
|
2230
|
+
return n != null && n[u] || u === "$$ruleParams" || (a[u] = Ui(t, {
|
|
2228
2231
|
etype: u,
|
|
2229
2232
|
form: r[u],
|
|
2230
2233
|
level: 0,
|
|
2231
2234
|
pageInfo: e == null ? void 0 : e[u]
|
|
2232
2235
|
})), a;
|
|
2233
2236
|
}, {}) };
|
|
2234
|
-
return e && (s.pageInfo =
|
|
2237
|
+
return e && (s.pageInfo = pa(e)), n && (s.aggregate = n), s;
|
|
2235
2238
|
}
|
|
2236
|
-
function
|
|
2239
|
+
function ya() {
|
|
2237
2240
|
const e = {
|
|
2238
2241
|
__etype: 1,
|
|
2239
2242
|
__ops: 1,
|
|
@@ -2247,8 +2250,8 @@ function pa() {
|
|
|
2247
2250
|
};
|
|
2248
2251
|
return new Set(Object.keys(e));
|
|
2249
2252
|
}
|
|
2250
|
-
const
|
|
2251
|
-
function
|
|
2253
|
+
const ba = ya();
|
|
2254
|
+
function bn(t, e, n) {
|
|
2252
2255
|
const r = {
|
|
2253
2256
|
__etype: t,
|
|
2254
2257
|
__ops: n
|
|
@@ -2259,25 +2262,25 @@ function yn(t, e, n) {
|
|
|
2259
2262
|
return n;
|
|
2260
2263
|
if (s === "__etype")
|
|
2261
2264
|
return t;
|
|
2262
|
-
if (
|
|
2263
|
-
return (o, a) =>
|
|
2265
|
+
if (ba.has(s))
|
|
2266
|
+
return (o, a) => bn(t, e, [
|
|
2264
2267
|
...n,
|
|
2265
2268
|
a ? [s, t, e, o, a] : [s, t, e, o]
|
|
2266
2269
|
]);
|
|
2267
2270
|
}
|
|
2268
2271
|
});
|
|
2269
2272
|
}
|
|
2270
|
-
function
|
|
2273
|
+
function Nc(t, e) {
|
|
2271
2274
|
return `lookup__${t}__${JSON.stringify(e)}`;
|
|
2272
2275
|
}
|
|
2273
2276
|
function Mt(t) {
|
|
2274
2277
|
return t.startsWith("lookup__");
|
|
2275
2278
|
}
|
|
2276
|
-
function
|
|
2279
|
+
function Fi(t) {
|
|
2277
2280
|
const [e, n, ...r] = t.split("__");
|
|
2278
2281
|
return [n, JSON.parse(r.join("__"))];
|
|
2279
2282
|
}
|
|
2280
|
-
function
|
|
2283
|
+
function _a(t) {
|
|
2281
2284
|
return new Proxy({
|
|
2282
2285
|
__etype: t
|
|
2283
2286
|
}, {
|
|
@@ -2285,22 +2288,22 @@ function ba(t) {
|
|
|
2285
2288
|
if (n === "__etype")
|
|
2286
2289
|
return t;
|
|
2287
2290
|
const r = n;
|
|
2288
|
-
return Mt(r) ?
|
|
2291
|
+
return Mt(r) ? bn(t, Fi(r), []) : bn(t, r, []);
|
|
2289
2292
|
}
|
|
2290
2293
|
});
|
|
2291
2294
|
}
|
|
2292
|
-
function
|
|
2295
|
+
function Bn() {
|
|
2293
2296
|
return new Proxy({}, {
|
|
2294
2297
|
get(t, e) {
|
|
2295
|
-
return
|
|
2298
|
+
return _a(e);
|
|
2296
2299
|
}
|
|
2297
2300
|
});
|
|
2298
2301
|
}
|
|
2299
|
-
const
|
|
2300
|
-
function
|
|
2302
|
+
const Kc = Bn();
|
|
2303
|
+
function ga(t) {
|
|
2301
2304
|
return t.__ops;
|
|
2302
2305
|
}
|
|
2303
|
-
function
|
|
2306
|
+
function Ta(t, e) {
|
|
2304
2307
|
const { attrIdMap: n, refSwapAttrIds: r } = t, i = [];
|
|
2305
2308
|
for (const o of e) {
|
|
2306
2309
|
const a = n[o];
|
|
@@ -2334,7 +2337,7 @@ function Ae(t, e, n) {
|
|
|
2334
2337
|
return o === e && a === n;
|
|
2335
2338
|
});
|
|
2336
2339
|
}
|
|
2337
|
-
function
|
|
2340
|
+
function wa(t) {
|
|
2338
2341
|
if (Array.isArray(t))
|
|
2339
2342
|
return t;
|
|
2340
2343
|
const e = Object.entries(t);
|
|
@@ -2342,38 +2345,38 @@ function Ta(t) {
|
|
|
2342
2345
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
2343
2346
|
return e[0];
|
|
2344
2347
|
}
|
|
2345
|
-
function
|
|
2348
|
+
function _n(t, e, n) {
|
|
2346
2349
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2347
2350
|
// before assuming it's a ref lookup.
|
|
2348
2351
|
!V(t, e, n);
|
|
2349
2352
|
}
|
|
2350
|
-
function
|
|
2353
|
+
function gn(t) {
|
|
2351
2354
|
const [e, n, ...r] = t.split(".");
|
|
2352
2355
|
if (r.length > 0 || n !== "id")
|
|
2353
2356
|
throw new Error(`${t} is not a valid lookup attribute.`);
|
|
2354
2357
|
return e;
|
|
2355
2358
|
}
|
|
2356
|
-
function
|
|
2357
|
-
if (!
|
|
2359
|
+
function ma(t, e, n) {
|
|
2360
|
+
if (!_n(t, e, n))
|
|
2358
2361
|
return V(t, e, n);
|
|
2359
|
-
const r =
|
|
2362
|
+
const r = gn(n), i = V(t, e, r) || Ae(t, e, r);
|
|
2360
2363
|
if (i && i["value-type"] !== "ref")
|
|
2361
2364
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
2362
2365
|
return i;
|
|
2363
2366
|
}
|
|
2364
|
-
function
|
|
2365
|
-
return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ?
|
|
2367
|
+
function Tn(t) {
|
|
2368
|
+
return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? Fi(t) : wa(t);
|
|
2366
2369
|
}
|
|
2367
2370
|
function ee(t, e, n) {
|
|
2368
|
-
const r =
|
|
2371
|
+
const r = Tn(n);
|
|
2369
2372
|
if (r === null)
|
|
2370
2373
|
return n;
|
|
2371
|
-
const [i, s] = r, o =
|
|
2374
|
+
const [i, s] = r, o = ma(t, e, i);
|
|
2372
2375
|
if (!o || !o["unique?"])
|
|
2373
2376
|
throw new Error(`${i} is not a unique attribute.`);
|
|
2374
2377
|
return [o.id, s];
|
|
2375
2378
|
}
|
|
2376
|
-
function
|
|
2379
|
+
function Ni(t, e, n, r) {
|
|
2377
2380
|
const i = ee(t, e, n);
|
|
2378
2381
|
return Array.isArray(i) ? [[
|
|
2379
2382
|
"add-triple",
|
|
@@ -2382,7 +2385,7 @@ function Fi(t, e, n, r) {
|
|
|
2382
2385
|
i
|
|
2383
2386
|
]].concat(r) : r;
|
|
2384
2387
|
}
|
|
2385
|
-
function
|
|
2388
|
+
function va({ attrs: t }, [e, n, r]) {
|
|
2386
2389
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
2387
2390
|
const a = Array.isArray(o) ? o : [o], u = V(t, e, s), d = Ae(t, e, s);
|
|
2388
2391
|
return a.map((c) => u ? [
|
|
@@ -2397,9 +2400,9 @@ function ma({ attrs: t }, [e, n, r]) {
|
|
|
2397
2400
|
ee(t, e, n)
|
|
2398
2401
|
]);
|
|
2399
2402
|
});
|
|
2400
|
-
return
|
|
2403
|
+
return Ni(t, e, n, i);
|
|
2401
2404
|
}
|
|
2402
|
-
function
|
|
2405
|
+
function Sa({ attrs: t }, [e, n, r]) {
|
|
2403
2406
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
2404
2407
|
const a = Array.isArray(o) ? o : [o], u = V(t, e, s), d = Ae(t, e, s);
|
|
2405
2408
|
return a.map((c) => u ? [
|
|
@@ -2414,9 +2417,9 @@ function va({ attrs: t }, [e, n, r]) {
|
|
|
2414
2417
|
ee(t, e, n)
|
|
2415
2418
|
]);
|
|
2416
2419
|
});
|
|
2417
|
-
return
|
|
2420
|
+
return Ni(t, e, n, i);
|
|
2418
2421
|
}
|
|
2419
|
-
function
|
|
2422
|
+
function Oa(t, e, n) {
|
|
2420
2423
|
if (Array.isArray(n)) {
|
|
2421
2424
|
const [r, i] = n;
|
|
2422
2425
|
for (const s of t || []) {
|
|
@@ -2438,18 +2441,18 @@ function Sa(t, e, n) {
|
|
|
2438
2441
|
}
|
|
2439
2442
|
return !1;
|
|
2440
2443
|
}
|
|
2441
|
-
function
|
|
2442
|
-
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null :
|
|
2444
|
+
function Ki({ stores: t, attrs: e }, [n, r, i, s]) {
|
|
2445
|
+
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;
|
|
2443
2446
|
}
|
|
2444
|
-
function
|
|
2445
|
-
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u =
|
|
2447
|
+
function Ea(t, e) {
|
|
2448
|
+
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Kn(o), d = ee(r, i, s);
|
|
2446
2449
|
return [["id", d]].concat(Object.entries(u)).map(([f, l]) => {
|
|
2447
2450
|
const p = V(r, i, f);
|
|
2448
2451
|
return p["checked-data-type"] === "date" && t.useDateObjects && (l = xt(l)), ["add-triple", d, p.id, l, { mode: "create" }];
|
|
2449
2452
|
});
|
|
2450
2453
|
}
|
|
2451
|
-
function
|
|
2452
|
-
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u =
|
|
2454
|
+
function Aa(t, e) {
|
|
2455
|
+
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Kn(o), d = ee(r, i, s), c = Ki(t, [i, d, o, a]);
|
|
2453
2456
|
return [["id", d]].concat(Object.entries(u)).map(([l, p]) => {
|
|
2454
2457
|
const y = V(r, i, l);
|
|
2455
2458
|
return y["checked-data-type"] === "date" && t.useDateObjects && (p = xt(p)), [
|
|
@@ -2461,11 +2464,11 @@ function Ea(t, e) {
|
|
|
2461
2464
|
];
|
|
2462
2465
|
});
|
|
2463
2466
|
}
|
|
2464
|
-
function
|
|
2467
|
+
function ka({ attrs: t }, [e, n]) {
|
|
2465
2468
|
return [["delete-entity", ee(t, e, n), e]];
|
|
2466
2469
|
}
|
|
2467
|
-
function
|
|
2468
|
-
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u =
|
|
2470
|
+
function ja(t, e) {
|
|
2471
|
+
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Kn(o), d = ee(r, i, s), c = Ki(t, [i, d, o, a]), f = Object.entries(u).map(([p, y]) => {
|
|
2469
2472
|
const b = V(r, i, p);
|
|
2470
2473
|
return [
|
|
2471
2474
|
"deep-merge-triple",
|
|
@@ -2483,38 +2486,38 @@ function ka(t, e) {
|
|
|
2483
2486
|
...c ? [c] : []
|
|
2484
2487
|
]].concat(f);
|
|
2485
2488
|
}
|
|
2486
|
-
function
|
|
2489
|
+
function Ca({ attrs: t }, [e, n, r]) {
|
|
2487
2490
|
return [["rule-params", ee(t, e, n), e, r]];
|
|
2488
2491
|
}
|
|
2489
|
-
function
|
|
2492
|
+
function Pa(t) {
|
|
2490
2493
|
const [e, n, r, i, s] = t;
|
|
2491
2494
|
if (!i)
|
|
2492
2495
|
return t;
|
|
2493
2496
|
const o = Object.assign({}, i);
|
|
2494
2497
|
return delete o.id, [e, n, r, o, ...s ? [s] : []];
|
|
2495
2498
|
}
|
|
2496
|
-
function
|
|
2497
|
-
const [n, ...r] =
|
|
2499
|
+
function Ia(t, e) {
|
|
2500
|
+
const [n, ...r] = Pa(e);
|
|
2498
2501
|
switch (n) {
|
|
2499
2502
|
case "merge":
|
|
2500
|
-
return
|
|
2503
|
+
return ja(t, r);
|
|
2501
2504
|
case "create":
|
|
2502
|
-
return Oa(t, r);
|
|
2503
|
-
case "update":
|
|
2504
2505
|
return Ea(t, r);
|
|
2506
|
+
case "update":
|
|
2507
|
+
return Aa(t, r);
|
|
2505
2508
|
case "link":
|
|
2506
|
-
return ma(t, r);
|
|
2507
|
-
case "unlink":
|
|
2508
2509
|
return va(t, r);
|
|
2510
|
+
case "unlink":
|
|
2511
|
+
return Sa(t, r);
|
|
2509
2512
|
case "delete":
|
|
2510
|
-
return
|
|
2513
|
+
return ka(t, r);
|
|
2511
2514
|
case "ruleParams":
|
|
2512
|
-
return
|
|
2515
|
+
return Ca(t, r);
|
|
2513
2516
|
default:
|
|
2514
2517
|
throw new Error(`unsupported action ${n}`);
|
|
2515
2518
|
}
|
|
2516
2519
|
}
|
|
2517
|
-
function
|
|
2520
|
+
function Ma(t) {
|
|
2518
2521
|
switch (t) {
|
|
2519
2522
|
case "string":
|
|
2520
2523
|
case "date":
|
|
@@ -2525,14 +2528,14 @@ function Ia(t) {
|
|
|
2525
2528
|
return;
|
|
2526
2529
|
}
|
|
2527
2530
|
}
|
|
2528
|
-
function
|
|
2531
|
+
function Ra(t, e, n) {
|
|
2529
2532
|
var r, i;
|
|
2530
2533
|
const s = (i = (r = t.entities[e]) === null || r === void 0 ? void 0 : r.attrs) === null || i === void 0 ? void 0 : i[n];
|
|
2531
2534
|
if (n === "id")
|
|
2532
2535
|
return null;
|
|
2533
2536
|
if (!s)
|
|
2534
2537
|
throw new Error(`${e}.${n} does not exist in your schema`);
|
|
2535
|
-
const { unique: o, indexed: a } = s == null ? void 0 : s.config, u =
|
|
2538
|
+
const { unique: o, indexed: a } = s == null ? void 0 : s.config, u = Ma(s == null ? void 0 : s.valueType);
|
|
2536
2539
|
return {
|
|
2537
2540
|
"index?": a,
|
|
2538
2541
|
"unique?": o,
|
|
@@ -2540,14 +2543,14 @@ function Ma(t, e, n) {
|
|
|
2540
2543
|
};
|
|
2541
2544
|
}
|
|
2542
2545
|
function Tt(t, e, n, r) {
|
|
2543
|
-
const i = t ?
|
|
2546
|
+
const i = t ? Ra(t, e, n) : null, s = K(), a = [K(), e, n];
|
|
2544
2547
|
return Object.assign(Object.assign({ id: s, "forward-identity": a, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
2545
2548
|
}
|
|
2546
|
-
function
|
|
2549
|
+
function xa(t, e, n) {
|
|
2547
2550
|
return Object.values(t.links).find((i) => i.forward.on === e && i.forward.label === n || i.reverse.on === e && i.reverse.label === n);
|
|
2548
2551
|
}
|
|
2549
|
-
function
|
|
2550
|
-
const r =
|
|
2552
|
+
function $a(t, e, n) {
|
|
2553
|
+
const r = xa(t, e, n);
|
|
2551
2554
|
if (!r)
|
|
2552
2555
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
2553
2556
|
const { forward: i, reverse: s } = r;
|
|
@@ -2560,11 +2563,11 @@ function xa(t, e, n) {
|
|
|
2560
2563
|
"on-delete-reverse": s.onDelete
|
|
2561
2564
|
};
|
|
2562
2565
|
}
|
|
2563
|
-
function
|
|
2564
|
-
const i = t ?
|
|
2566
|
+
function xr(t, e, n, r) {
|
|
2567
|
+
const i = t ? $a(t, e, n) : null, s = K(), o = [K(), e, n], a = [K(), n, e];
|
|
2565
2568
|
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 || {});
|
|
2566
2569
|
}
|
|
2567
|
-
const
|
|
2570
|
+
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([
|
|
2568
2571
|
"link",
|
|
2569
2572
|
"unlink",
|
|
2570
2573
|
"create",
|
|
@@ -2572,17 +2575,17 @@ const $a = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
2572
2575
|
"merge",
|
|
2573
2576
|
"delete",
|
|
2574
2577
|
"ruleParams"
|
|
2575
|
-
]),
|
|
2576
|
-
function
|
|
2578
|
+
]), wn = { "unique?": !0, "index?": !0 }, Na = Object.assign(Object.assign({}, wn), { cardinality: "one" });
|
|
2579
|
+
function Ka(t) {
|
|
2577
2580
|
const e = [], [n, r, i, s] = t;
|
|
2578
|
-
if (!
|
|
2581
|
+
if (!Fa.has(n))
|
|
2579
2582
|
return e;
|
|
2580
|
-
const o =
|
|
2583
|
+
const o = Tn(i);
|
|
2581
2584
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
2582
2585
|
for (const [a, u] of Object.entries(s)) {
|
|
2583
2586
|
const d = Array.isArray(u) ? u : [u];
|
|
2584
2587
|
for (const c of d) {
|
|
2585
|
-
const f =
|
|
2588
|
+
const f = Tn(c);
|
|
2586
2589
|
f && e.push({
|
|
2587
2590
|
etype: r,
|
|
2588
2591
|
lookupPair: f,
|
|
@@ -2592,7 +2595,7 @@ function Na(t) {
|
|
|
2592
2595
|
}
|
|
2593
2596
|
return e;
|
|
2594
2597
|
}
|
|
2595
|
-
function
|
|
2598
|
+
function qa({ attrs: t, schema: e }, n) {
|
|
2596
2599
|
var r, i;
|
|
2597
2600
|
const [s, o, a] = [/* @__PURE__ */ new Set(), Object.assign({}, t), []];
|
|
2598
2601
|
function u(f) {
|
|
@@ -2603,47 +2606,47 @@ function Ka({ attrs: t, schema: e }, n) {
|
|
|
2603
2606
|
}
|
|
2604
2607
|
function c(f, l) {
|
|
2605
2608
|
const p = V(o, f, l), y = Ae(o, f, l);
|
|
2606
|
-
d(p), d(y), !p && !y && u(
|
|
2609
|
+
d(p), d(y), !p && !y && u(xr(e, f, l, Na));
|
|
2607
2610
|
}
|
|
2608
2611
|
for (const f of n)
|
|
2609
|
-
for (const { etype: l, lookupPair: p, linkLabel: y } of
|
|
2612
|
+
for (const { etype: l, lookupPair: p, linkLabel: y } of Ka(f)) {
|
|
2610
2613
|
const b = p[0];
|
|
2611
2614
|
if (y) {
|
|
2612
2615
|
c(l, y);
|
|
2613
2616
|
const _ = V(o, l, y), w = Ae(o, l, y);
|
|
2614
2617
|
d(_), d(w);
|
|
2615
2618
|
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;
|
|
2616
|
-
if (
|
|
2617
|
-
c(g,
|
|
2619
|
+
if (_n(o, g, b))
|
|
2620
|
+
c(g, gn(b));
|
|
2618
2621
|
else {
|
|
2619
2622
|
const m = V(o, g, b);
|
|
2620
|
-
m || u(Tt(e, g, b,
|
|
2623
|
+
m || u(Tt(e, g, b, wn)), d(m);
|
|
2621
2624
|
}
|
|
2622
|
-
} else if (
|
|
2623
|
-
c(l,
|
|
2625
|
+
} else if (_n(o, l, b))
|
|
2626
|
+
c(l, gn(b));
|
|
2624
2627
|
else {
|
|
2625
2628
|
const _ = V(o, l, b);
|
|
2626
|
-
_ || u(Tt(e, l, b,
|
|
2629
|
+
_ || u(Tt(e, l, b, wn)), d(_);
|
|
2627
2630
|
}
|
|
2628
2631
|
}
|
|
2629
2632
|
for (const f of n) {
|
|
2630
2633
|
const [l, p, y, b] = f;
|
|
2631
|
-
if (
|
|
2634
|
+
if (Da.has(l)) {
|
|
2632
2635
|
const _ = V(o, p, "id");
|
|
2633
2636
|
d(_), _ || u(Tt(e, p, "id", { "unique?": !0 }));
|
|
2634
2637
|
for (const w of Object.keys(b)) {
|
|
2635
2638
|
const g = V(o, p, w);
|
|
2636
|
-
if (d(g),
|
|
2639
|
+
if (d(g), La.has(l) && (g || u(Tt(e, p, w, w === "id" ? { "unique?": !0 } : null))), Ua.has(l)) {
|
|
2637
2640
|
const m = Ae(o, p, w);
|
|
2638
|
-
!g && !m && u(
|
|
2641
|
+
!g && !m && u(xr(e, p, w)), d(m);
|
|
2639
2642
|
}
|
|
2640
2643
|
}
|
|
2641
2644
|
}
|
|
2642
2645
|
}
|
|
2643
2646
|
return [o, a];
|
|
2644
2647
|
}
|
|
2645
|
-
function
|
|
2646
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((u) =>
|
|
2648
|
+
function Wa(t, e) {
|
|
2649
|
+
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));
|
|
2647
2650
|
return [...s, ...a];
|
|
2648
2651
|
}
|
|
2649
2652
|
var de = function(t, e, n, r) {
|
|
@@ -2673,15 +2676,15 @@ var de = function(t, e, n, r) {
|
|
|
2673
2676
|
d((r = r.apply(t, e || [])).next());
|
|
2674
2677
|
});
|
|
2675
2678
|
};
|
|
2676
|
-
function
|
|
2679
|
+
function $r(t, e) {
|
|
2677
2680
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
2678
2681
|
}
|
|
2679
2682
|
const it = "__meta";
|
|
2680
|
-
class
|
|
2683
|
+
class za {
|
|
2681
2684
|
constructor(e, n) {
|
|
2682
2685
|
}
|
|
2683
2686
|
}
|
|
2684
|
-
class
|
|
2687
|
+
class mn {
|
|
2685
2688
|
constructor(e) {
|
|
2686
2689
|
var n, r;
|
|
2687
2690
|
this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
|
|
@@ -2875,7 +2878,7 @@ class wn {
|
|
|
2875
2878
|
gc() {
|
|
2876
2879
|
this._nextGc || (this._nextGc = setTimeout(
|
|
2877
2880
|
() => {
|
|
2878
|
-
|
|
2881
|
+
$r(() => {
|
|
2879
2882
|
this._nextGc = null, this._gc();
|
|
2880
2883
|
}, 30 * 1e3);
|
|
2881
2884
|
},
|
|
@@ -2890,7 +2893,7 @@ class wn {
|
|
|
2890
2893
|
return;
|
|
2891
2894
|
}
|
|
2892
2895
|
this._nextSave = setTimeout(() => {
|
|
2893
|
-
|
|
2896
|
+
$r(() => {
|
|
2894
2897
|
this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
|
|
2895
2898
|
}, this._idleCallbackMaxWaitMs);
|
|
2896
2899
|
}, this._saveThrottleMs);
|
|
@@ -2952,13 +2955,13 @@ var pe = function(t, e, n, r) {
|
|
|
2952
2955
|
d((r = r.apply(t, e || [])).next());
|
|
2953
2956
|
});
|
|
2954
2957
|
};
|
|
2955
|
-
const
|
|
2956
|
-
function
|
|
2958
|
+
const Va = 6, Ba = ["kv", "querySubs", "syncSubs"];
|
|
2959
|
+
function Ga(t) {
|
|
2957
2960
|
return function(n) {
|
|
2958
2961
|
console.error("Error in IndexedDB event", { source: t, event: n });
|
|
2959
2962
|
};
|
|
2960
2963
|
}
|
|
2961
|
-
function
|
|
2964
|
+
function Qa(t) {
|
|
2962
2965
|
return pe(this, void 0, void 0, function* () {
|
|
2963
2966
|
return new Promise((e) => {
|
|
2964
2967
|
const n = indexedDB.open(t);
|
|
@@ -2974,7 +2977,7 @@ function Ga(t) {
|
|
|
2974
2977
|
});
|
|
2975
2978
|
});
|
|
2976
2979
|
}
|
|
2977
|
-
function
|
|
2980
|
+
function Ha(t, e, n) {
|
|
2978
2981
|
return pe(this, void 0, void 0, function* () {
|
|
2979
2982
|
const r = (
|
|
2980
2983
|
// Backwards compatibility for older versions where we JSON.stringified before storing
|
|
@@ -3010,7 +3013,7 @@ function Qa(t, e, n) {
|
|
|
3010
3013
|
});
|
|
3011
3014
|
});
|
|
3012
3015
|
}
|
|
3013
|
-
function
|
|
3016
|
+
function Dr(t, e, n) {
|
|
3014
3017
|
return pe(this, void 0, void 0, function* () {
|
|
3015
3018
|
const r = n.put(e, t);
|
|
3016
3019
|
return new Promise((i, s) => {
|
|
@@ -3018,9 +3021,9 @@ function $r(t, e, n) {
|
|
|
3018
3021
|
});
|
|
3019
3022
|
});
|
|
3020
3023
|
}
|
|
3021
|
-
function
|
|
3024
|
+
function Ya(t, e) {
|
|
3022
3025
|
return pe(this, void 0, void 0, function* () {
|
|
3023
|
-
const n = yield
|
|
3026
|
+
const n = yield Qa(`instant_${t}_5`);
|
|
3024
3027
|
if (!n)
|
|
3025
3028
|
return;
|
|
3026
3029
|
const r = yield new Promise((c, f) => {
|
|
@@ -3043,12 +3046,12 @@ function Ha(t, e) {
|
|
|
3043
3046
|
for (const [c, f] of r)
|
|
3044
3047
|
switch (c) {
|
|
3045
3048
|
case "querySubs": {
|
|
3046
|
-
const l =
|
|
3049
|
+
const l = Ha(c, f, o);
|
|
3047
3050
|
a.push(l);
|
|
3048
3051
|
break;
|
|
3049
3052
|
}
|
|
3050
3053
|
default: {
|
|
3051
|
-
const l =
|
|
3054
|
+
const l = Dr(c, f, s);
|
|
3052
3055
|
a.push(l);
|
|
3053
3056
|
const p = {
|
|
3054
3057
|
createdAt: Date.now(),
|
|
@@ -3059,16 +3062,16 @@ function Ha(t, e) {
|
|
|
3059
3062
|
break;
|
|
3060
3063
|
}
|
|
3061
3064
|
}
|
|
3062
|
-
const d =
|
|
3065
|
+
const d = Dr(it, u, s);
|
|
3063
3066
|
a.push(d), yield Promise.all(a), yield new Promise((c, f) => {
|
|
3064
3067
|
i.oncomplete = (l) => c(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
|
|
3065
3068
|
});
|
|
3066
3069
|
});
|
|
3067
3070
|
}
|
|
3068
|
-
const
|
|
3069
|
-
class
|
|
3071
|
+
const Ur = /* @__PURE__ */ new Map();
|
|
3072
|
+
class qi extends za {
|
|
3070
3073
|
constructor(e, n) {
|
|
3071
|
-
super(e, n), this.dbName = `instant_${e}_${
|
|
3074
|
+
super(e, n), this.dbName = `instant_${e}_${Va}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
|
|
3072
3075
|
}
|
|
3073
3076
|
_init() {
|
|
3074
3077
|
return new Promise((e, n) => {
|
|
@@ -3079,12 +3082,12 @@ class Ki extends Wa {
|
|
|
3079
3082
|
}, i.onsuccess = (s) => {
|
|
3080
3083
|
const a = s.target.result;
|
|
3081
3084
|
if (r) {
|
|
3082
|
-
const u =
|
|
3083
|
-
|
|
3085
|
+
const u = Ya(this._appId, a).catch((d) => {
|
|
3086
|
+
Ga("Error upgrading store from version 5 to 6.")(d);
|
|
3084
3087
|
});
|
|
3085
|
-
|
|
3088
|
+
Ur.set(this.dbName, u), u.then(() => e(a)).catch(() => e(a));
|
|
3086
3089
|
} else {
|
|
3087
|
-
const u =
|
|
3090
|
+
const u = Ur.get(this.dbName);
|
|
3088
3091
|
u ? u.then(() => e(a)).catch(() => e(a)) : e(a);
|
|
3089
3092
|
}
|
|
3090
3093
|
}, i.onupgradeneeded = (s) => {
|
|
@@ -3094,7 +3097,7 @@ class Ki extends Wa {
|
|
|
3094
3097
|
}
|
|
3095
3098
|
_upgradeStore(e) {
|
|
3096
3099
|
const r = e.target.result;
|
|
3097
|
-
for (const i of
|
|
3100
|
+
for (const i of Ba)
|
|
3098
3101
|
r.objectStoreNames.contains(i) || r.createObjectStore(i);
|
|
3099
3102
|
}
|
|
3100
3103
|
getItem(e) {
|
|
@@ -3169,7 +3172,7 @@ class Ki extends Wa {
|
|
|
3169
3172
|
});
|
|
3170
3173
|
}
|
|
3171
3174
|
}
|
|
3172
|
-
var
|
|
3175
|
+
var Ja = function(t, e, n, r) {
|
|
3173
3176
|
function i(s) {
|
|
3174
3177
|
return s instanceof n ? s : new n(function(o) {
|
|
3175
3178
|
o(s);
|
|
@@ -3196,9 +3199,9 @@ var Ya = function(t, e, n, r) {
|
|
|
3196
3199
|
d((r = r.apply(t, e || [])).next());
|
|
3197
3200
|
});
|
|
3198
3201
|
};
|
|
3199
|
-
class
|
|
3202
|
+
class Wi {
|
|
3200
3203
|
static getIsOnline() {
|
|
3201
|
-
return
|
|
3204
|
+
return Ja(this, void 0, void 0, function* () {
|
|
3202
3205
|
return navigator.onLine;
|
|
3203
3206
|
});
|
|
3204
3207
|
}
|
|
@@ -3223,7 +3226,7 @@ class Ke extends Error {
|
|
|
3223
3226
|
return "InstantError";
|
|
3224
3227
|
}
|
|
3225
3228
|
}
|
|
3226
|
-
var
|
|
3229
|
+
var Za = function(t, e, n, r) {
|
|
3227
3230
|
function i(s) {
|
|
3228
3231
|
return s instanceof n ? s : new n(function(o) {
|
|
3229
3232
|
o(s);
|
|
@@ -3263,7 +3266,7 @@ class Dt extends Ke {
|
|
|
3263
3266
|
}
|
|
3264
3267
|
}
|
|
3265
3268
|
function ue(t, e) {
|
|
3266
|
-
return
|
|
3269
|
+
return Za(this, void 0, void 0, function* () {
|
|
3267
3270
|
const n = yield fetch(t, e), r = yield n.json();
|
|
3268
3271
|
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new Dt({ status: n.status, body: r }));
|
|
3269
3272
|
});
|
|
@@ -3295,14 +3298,14 @@ var ze = function(t, e, n, r) {
|
|
|
3295
3298
|
d((r = r.apply(t, e || [])).next());
|
|
3296
3299
|
});
|
|
3297
3300
|
};
|
|
3298
|
-
function
|
|
3301
|
+
function Xa({ apiURI: t, appId: e, email: n }) {
|
|
3299
3302
|
return ue(`${t}/runtime/auth/send_magic_code`, {
|
|
3300
3303
|
method: "POST",
|
|
3301
3304
|
headers: { "content-type": "application/json" },
|
|
3302
3305
|
body: JSON.stringify({ "app-id": e, email: n })
|
|
3303
3306
|
});
|
|
3304
3307
|
}
|
|
3305
|
-
function
|
|
3308
|
+
function eu(t) {
|
|
3306
3309
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
|
|
3307
3310
|
return yield ue(`${e}/runtime/auth/verify_magic_code`, {
|
|
3308
3311
|
method: "POST",
|
|
@@ -3315,7 +3318,7 @@ function Xa(t) {
|
|
|
3315
3318
|
});
|
|
3316
3319
|
});
|
|
3317
3320
|
}
|
|
3318
|
-
function
|
|
3321
|
+
function tu(t) {
|
|
3319
3322
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3320
3323
|
return yield ue(`${e}/runtime/auth/verify_refresh_token`, {
|
|
3321
3324
|
method: "POST",
|
|
@@ -3327,7 +3330,7 @@ function eu(t) {
|
|
|
3327
3330
|
});
|
|
3328
3331
|
});
|
|
3329
3332
|
}
|
|
3330
|
-
function
|
|
3333
|
+
function nu(t) {
|
|
3331
3334
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
|
|
3332
3335
|
return yield ue(`${e}/runtime/auth/sign_in_guest`, {
|
|
3333
3336
|
method: "POST",
|
|
@@ -3338,7 +3341,7 @@ function tu(t) {
|
|
|
3338
3341
|
});
|
|
3339
3342
|
});
|
|
3340
3343
|
}
|
|
3341
|
-
function
|
|
3344
|
+
function Lr(t) {
|
|
3342
3345
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
3343
3346
|
return yield ue(`${e}/runtime/oauth/token`, {
|
|
3344
3347
|
method: "POST",
|
|
@@ -3352,7 +3355,7 @@ function Ur(t) {
|
|
|
3352
3355
|
});
|
|
3353
3356
|
});
|
|
3354
3357
|
}
|
|
3355
|
-
function
|
|
3358
|
+
function ru(t) {
|
|
3356
3359
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
|
|
3357
3360
|
return yield ue(`${e}/runtime/oauth/id_token`, {
|
|
3358
3361
|
method: "POST",
|
|
@@ -3367,7 +3370,7 @@ function nu(t) {
|
|
|
3367
3370
|
});
|
|
3368
3371
|
});
|
|
3369
3372
|
}
|
|
3370
|
-
function
|
|
3373
|
+
function iu(t) {
|
|
3371
3374
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3372
3375
|
return yield ue(`${e}/runtime/signout`, {
|
|
3373
3376
|
method: "POST",
|
|
@@ -3408,7 +3411,7 @@ var ft = function(t, e, n, r) {
|
|
|
3408
3411
|
d((r = r.apply(t, e || [])).next());
|
|
3409
3412
|
});
|
|
3410
3413
|
};
|
|
3411
|
-
function
|
|
3414
|
+
function su(t) {
|
|
3412
3415
|
return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: a }) {
|
|
3413
3416
|
const u = {
|
|
3414
3417
|
app_id: n,
|
|
@@ -3423,7 +3426,7 @@ function iu(t) {
|
|
|
3423
3426
|
});
|
|
3424
3427
|
});
|
|
3425
3428
|
}
|
|
3426
|
-
function
|
|
3429
|
+
function ou(t) {
|
|
3427
3430
|
return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
3428
3431
|
const { data: s } = yield ue(`${e}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3429
3432
|
method: "DELETE",
|
|
@@ -3435,7 +3438,7 @@ function su(t) {
|
|
|
3435
3438
|
return s;
|
|
3436
3439
|
});
|
|
3437
3440
|
}
|
|
3438
|
-
function
|
|
3441
|
+
function au(t) {
|
|
3439
3442
|
return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
|
|
3440
3443
|
const { data: o } = yield ue(`${e}/storage/signed-upload-url`, {
|
|
3441
3444
|
method: "POST",
|
|
@@ -3451,7 +3454,7 @@ function ou(t) {
|
|
|
3451
3454
|
return o;
|
|
3452
3455
|
});
|
|
3453
3456
|
}
|
|
3454
|
-
function
|
|
3457
|
+
function uu(t, e) {
|
|
3455
3458
|
return ft(this, void 0, void 0, function* () {
|
|
3456
3459
|
return (yield fetch(t, {
|
|
3457
3460
|
method: "PUT",
|
|
@@ -3462,7 +3465,7 @@ function au(t, e) {
|
|
|
3462
3465
|
})).ok;
|
|
3463
3466
|
});
|
|
3464
3467
|
}
|
|
3465
|
-
function
|
|
3468
|
+
function cu(t) {
|
|
3466
3469
|
return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
3467
3470
|
const { data: s } = yield ue(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3468
3471
|
method: "GET",
|
|
@@ -3474,9 +3477,9 @@ function uu(t) {
|
|
|
3474
3477
|
return s;
|
|
3475
3478
|
});
|
|
3476
3479
|
}
|
|
3477
|
-
let
|
|
3478
|
-
typeof window < "u" && typeof window.localStorage < "u" && (
|
|
3479
|
-
function
|
|
3480
|
+
let Gn = !1, zi = !1, Vi = !1;
|
|
3481
|
+
typeof window < "u" && typeof window.localStorage < "u" && (Gn = !!window.localStorage.getItem("devBackend"), zi = !!window.localStorage.getItem("__instantLogging"), Vi = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
3482
|
+
function Fr(t, e) {
|
|
3480
3483
|
if (!e)
|
|
3481
3484
|
return t;
|
|
3482
3485
|
const n = {};
|
|
@@ -3484,33 +3487,33 @@ function Lr(t, e) {
|
|
|
3484
3487
|
n[r] = t[r];
|
|
3485
3488
|
}), n;
|
|
3486
3489
|
}
|
|
3487
|
-
function
|
|
3490
|
+
function du(t, e, n) {
|
|
3488
3491
|
var r, i;
|
|
3489
3492
|
const s = {
|
|
3490
3493
|
peers: {}
|
|
3491
3494
|
};
|
|
3492
3495
|
if (e && "user" in e ? e.user : !0) {
|
|
3493
|
-
const a =
|
|
3496
|
+
const a = Fr((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
|
|
3494
3497
|
s.user = Object.assign(Object.assign({}, a), { peerId: n });
|
|
3495
3498
|
}
|
|
3496
3499
|
for (const a of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
|
|
3497
3500
|
const u = (e == null ? void 0 : e.peers) === void 0, d = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(a));
|
|
3498
3501
|
if (u || d) {
|
|
3499
|
-
const c =
|
|
3502
|
+
const c = Fr(t.peers[a], e == null ? void 0 : e.keys);
|
|
3500
3503
|
s.peers[a] = Object.assign(Object.assign({}, c), { peerId: a });
|
|
3501
3504
|
}
|
|
3502
3505
|
}
|
|
3503
3506
|
return s;
|
|
3504
3507
|
}
|
|
3505
|
-
function
|
|
3506
|
-
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !
|
|
3508
|
+
function fu(t, e) {
|
|
3509
|
+
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !Or(t.user, e.user)) || !Ti(t.peers, e.peers))
|
|
3507
3510
|
return !0;
|
|
3508
3511
|
for (const r of Object.keys(t.peers))
|
|
3509
|
-
if (!
|
|
3512
|
+
if (!Or(t.peers[r], e.peers[r]))
|
|
3510
3513
|
return !0;
|
|
3511
3514
|
return !1;
|
|
3512
3515
|
}
|
|
3513
|
-
class
|
|
3516
|
+
class Nr {
|
|
3514
3517
|
constructor() {
|
|
3515
3518
|
this.promise = new Promise((e, n) => {
|
|
3516
3519
|
this._resolve = e, this._reject = n;
|
|
@@ -3523,20 +3526,20 @@ class Fr {
|
|
|
3523
3526
|
this._reject(e);
|
|
3524
3527
|
}
|
|
3525
3528
|
}
|
|
3526
|
-
function
|
|
3529
|
+
function Bi(t, e = []) {
|
|
3527
3530
|
t.forEach((n) => {
|
|
3528
3531
|
const { data: r } = n, { "datalog-result": i } = r, { "join-rows": s } = i;
|
|
3529
3532
|
for (const o of s)
|
|
3530
3533
|
for (const a of o)
|
|
3531
3534
|
e.push(a);
|
|
3532
|
-
|
|
3535
|
+
Bi(n["child-nodes"], e);
|
|
3533
3536
|
});
|
|
3534
3537
|
}
|
|
3535
|
-
function
|
|
3538
|
+
function Kr(t) {
|
|
3536
3539
|
const e = [];
|
|
3537
|
-
return
|
|
3540
|
+
return Bi(t, e), e;
|
|
3538
3541
|
}
|
|
3539
|
-
function
|
|
3542
|
+
function qr(t) {
|
|
3540
3543
|
return Object.values(t.links).reduce((e, n) => {
|
|
3541
3544
|
var r, i, s, o;
|
|
3542
3545
|
return (r = e[s = n.forward.on]) !== null && r !== void 0 || (e[s] = {}), e[n.forward.on][n.forward.label] = {
|
|
@@ -3550,8 +3553,8 @@ function Kr(t) {
|
|
|
3550
3553
|
}, e;
|
|
3551
3554
|
}, {});
|
|
3552
3555
|
}
|
|
3553
|
-
const
|
|
3554
|
-
function
|
|
3556
|
+
const Qn = "v0.22.66-experimental.drewh-entity-caching.19584095731.1";
|
|
3557
|
+
function lu(t, e) {
|
|
3555
3558
|
return {
|
|
3556
3559
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
3557
3560
|
},
|
|
@@ -3624,7 +3627,7 @@ class R extends Error {
|
|
|
3624
3627
|
super(r), this.name = "QueryValidationError";
|
|
3625
3628
|
}
|
|
3626
3629
|
}
|
|
3627
|
-
const
|
|
3630
|
+
const Wr = [
|
|
3628
3631
|
"where",
|
|
3629
3632
|
"order",
|
|
3630
3633
|
"limit",
|
|
@@ -3635,7 +3638,7 @@ const qr = [
|
|
|
3635
3638
|
"before",
|
|
3636
3639
|
"fields",
|
|
3637
3640
|
"aggregate"
|
|
3638
|
-
],
|
|
3641
|
+
], hu = (t) => t.valueType || "unknown", Gi = (t, e, n = !1) => {
|
|
3639
3642
|
if (n || t == null)
|
|
3640
3643
|
return !0;
|
|
3641
3644
|
switch (e) {
|
|
@@ -3650,9 +3653,9 @@ const qr = [
|
|
|
3650
3653
|
default:
|
|
3651
3654
|
return !0;
|
|
3652
3655
|
}
|
|
3653
|
-
},
|
|
3656
|
+
}, pu = (t, e, n, r, i, s, o) => {
|
|
3654
3657
|
const a = s.valueType === "json", u = (d, c, f) => {
|
|
3655
|
-
if (!
|
|
3658
|
+
if (!Gi(f, c, a))
|
|
3656
3659
|
throw new R(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
|
|
3657
3660
|
};
|
|
3658
3661
|
switch (t) {
|
|
@@ -3683,16 +3686,16 @@ const qr = [
|
|
|
3683
3686
|
throw new R(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
|
|
3684
3687
|
}
|
|
3685
3688
|
}, Ue = (t, e, n, r, i) => {
|
|
3686
|
-
const s =
|
|
3689
|
+
const s = hu(n), o = n.valueType === "json";
|
|
3687
3690
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
3688
3691
|
if (o)
|
|
3689
3692
|
return;
|
|
3690
3693
|
const u = t;
|
|
3691
3694
|
for (const [d, c] of Object.entries(u))
|
|
3692
|
-
|
|
3693
|
-
} else if (!
|
|
3695
|
+
pu(d, c, s, e, r, n, `${i}.${d}`);
|
|
3696
|
+
} else if (!Gi(t, s, o))
|
|
3694
3697
|
throw new R(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
|
|
3695
|
-
},
|
|
3698
|
+
}, yu = (t, e, n, r, i) => {
|
|
3696
3699
|
const s = t.split(".");
|
|
3697
3700
|
if (s.length < 2)
|
|
3698
3701
|
throw new R(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
|
|
@@ -3729,12 +3732,12 @@ const qr = [
|
|
|
3729
3732
|
throw new R(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
|
|
3730
3733
|
}
|
|
3731
3734
|
Ue(e, t, d, n, i);
|
|
3732
|
-
},
|
|
3735
|
+
}, Qi = (t, e, n, r) => {
|
|
3733
3736
|
for (const [i, s] of Object.entries(t)) {
|
|
3734
3737
|
if (i === "or" || i === "and") {
|
|
3735
3738
|
if (Array.isArray(s))
|
|
3736
3739
|
for (const d of s)
|
|
3737
|
-
typeof d == "object" && d !== null &&
|
|
3740
|
+
typeof d == "object" && d !== null && Qi(d, e, n, `${r}.${i}[${d}]`);
|
|
3738
3741
|
continue;
|
|
3739
3742
|
}
|
|
3740
3743
|
if (i === "id") {
|
|
@@ -3742,7 +3745,7 @@ const qr = [
|
|
|
3742
3745
|
continue;
|
|
3743
3746
|
}
|
|
3744
3747
|
if (i.includes(".")) {
|
|
3745
|
-
|
|
3748
|
+
yu(i, s, e, n, `${r}.${i}`);
|
|
3746
3749
|
continue;
|
|
3747
3750
|
}
|
|
3748
3751
|
const o = n.entities[e];
|
|
@@ -3762,10 +3765,10 @@ const qr = [
|
|
|
3762
3765
|
Ue(s, i, d, e, `${r}.${i}`);
|
|
3763
3766
|
}
|
|
3764
3767
|
}
|
|
3765
|
-
},
|
|
3768
|
+
}, bu = (t, e, n, r, i = 0) => {
|
|
3766
3769
|
for (const o of Object.keys(t))
|
|
3767
|
-
if (!
|
|
3768
|
-
throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${
|
|
3770
|
+
if (!Wr.includes(o))
|
|
3771
|
+
throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Wr.join(", ")}. Found: ${o}`, r);
|
|
3769
3772
|
const s = [
|
|
3770
3773
|
// 'limit', // only supported client side
|
|
3771
3774
|
"offset",
|
|
@@ -3780,9 +3783,9 @@ const qr = [
|
|
|
3780
3783
|
if (t.where && n) {
|
|
3781
3784
|
if (typeof t.where != "object" || t.where === null)
|
|
3782
3785
|
throw new R(`'where' clause must be an object in entity '${e}', but received: ${typeof t.where}`, r ? `${r}.where` : void 0);
|
|
3783
|
-
|
|
3786
|
+
Qi(t.where, e, n, r ? `${r}.where` : "where");
|
|
3784
3787
|
}
|
|
3785
|
-
},
|
|
3788
|
+
}, Hi = (t, e, n, r, i = 0) => {
|
|
3786
3789
|
var s;
|
|
3787
3790
|
if (!t || typeof t != "object")
|
|
3788
3791
|
throw new R(`Query part for entity '${e}' must be an object, but received: ${typeof t}`, r);
|
|
@@ -3795,15 +3798,15 @@ const qr = [
|
|
|
3795
3798
|
const a = t[o];
|
|
3796
3799
|
if (typeof a == "object" && a !== null) {
|
|
3797
3800
|
const u = (s = n == null ? void 0 : n.entities[e].links[o]) === null || s === void 0 ? void 0 : s.entityName;
|
|
3798
|
-
u &&
|
|
3801
|
+
u && Hi(a, u, n, `${r}.${o}`, i + 1);
|
|
3799
3802
|
}
|
|
3800
3803
|
} else {
|
|
3801
3804
|
const a = t[o];
|
|
3802
3805
|
if (typeof a != "object" || a === null)
|
|
3803
3806
|
throw new R(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
3804
|
-
|
|
3807
|
+
bu(a, e, n, `${r}.$`, i);
|
|
3805
3808
|
}
|
|
3806
|
-
},
|
|
3809
|
+
}, zr = (t, e) => {
|
|
3807
3810
|
if (typeof t != "object" || t === null)
|
|
3808
3811
|
throw new R(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
|
|
3809
3812
|
if (Array.isArray(t))
|
|
@@ -3819,67 +3822,67 @@ const qr = [
|
|
|
3819
3822
|
const i = Object.keys(e.entities);
|
|
3820
3823
|
throw new R(`Entity '${r}' does not exist in schema. Available entities: ${i.length > 0 ? i.join(", ") : "none"}`, r);
|
|
3821
3824
|
}
|
|
3822
|
-
|
|
3825
|
+
Hi(n[r], r, e, r, 0);
|
|
3823
3826
|
}
|
|
3824
3827
|
}
|
|
3825
|
-
},
|
|
3828
|
+
}, Vr = (t) => typeof t != "string" ? !1 : Mt(t) ? !0 : Fe(t);
|
|
3826
3829
|
class ie extends Error {
|
|
3827
3830
|
constructor(e) {
|
|
3828
3831
|
super(e), this.name = "TransactionValidationError";
|
|
3829
3832
|
}
|
|
3830
3833
|
}
|
|
3831
|
-
const
|
|
3834
|
+
const Yi = (t) => t.length > 0 ? t.join(", ") : "none", _u = (t, e) => new ie(`Entity '${t}' does not exist in schema. Available entities: ${Yi(e)}`), Br = {
|
|
3832
3835
|
string: (t) => typeof t == "string",
|
|
3833
3836
|
number: (t) => typeof t == "number" && !isNaN(t),
|
|
3834
3837
|
boolean: (t) => typeof t == "boolean",
|
|
3835
3838
|
date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
|
|
3836
3839
|
json: () => !0
|
|
3837
|
-
},
|
|
3840
|
+
}, gu = (t, e) => {
|
|
3838
3841
|
var n, r;
|
|
3839
|
-
return t == null ? !0 : (r = (n =
|
|
3840
|
-
},
|
|
3842
|
+
return t == null ? !0 : (r = (n = Br[e.valueType]) === null || n === void 0 ? void 0 : n.call(Br, t)) !== null && r !== void 0 ? r : !1;
|
|
3843
|
+
}, Ji = (t, e) => {
|
|
3841
3844
|
const n = e.entities[t];
|
|
3842
3845
|
if (!n)
|
|
3843
|
-
throw
|
|
3846
|
+
throw _u(t, Object.keys(e.entities));
|
|
3844
3847
|
return n;
|
|
3845
|
-
},
|
|
3846
|
-
const r =
|
|
3848
|
+
}, Zt = (t, e, n) => {
|
|
3849
|
+
const r = Ji(t, n);
|
|
3847
3850
|
if (typeof e != "object" || e === null)
|
|
3848
3851
|
throw new ie(`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
3849
3852
|
for (const [i, s] of Object.entries(e)) {
|
|
3850
3853
|
if (i === "id")
|
|
3851
3854
|
continue;
|
|
3852
3855
|
const o = r.attrs[i];
|
|
3853
|
-
if (o && !
|
|
3856
|
+
if (o && !gu(s, o))
|
|
3854
3857
|
throw new ie(`Invalid value for attribute '${i}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof s}`);
|
|
3855
3858
|
}
|
|
3856
|
-
},
|
|
3857
|
-
const r =
|
|
3859
|
+
}, Gr = (t, e, n) => {
|
|
3860
|
+
const r = Ji(t, n);
|
|
3858
3861
|
if (typeof e != "object" || e === null)
|
|
3859
3862
|
throw new ie(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
3860
3863
|
for (const [i, s] of Object.entries(e)) {
|
|
3861
3864
|
if (!r.links[i]) {
|
|
3862
3865
|
const a = Object.keys(r.links);
|
|
3863
|
-
throw new ie(`Link '${i}' does not exist on entity '${t}'. Available links: ${
|
|
3866
|
+
throw new ie(`Link '${i}' does not exist on entity '${t}'. Available links: ${Yi(a)}`);
|
|
3864
3867
|
}
|
|
3865
3868
|
if (s != null) {
|
|
3866
3869
|
if (Array.isArray(s)) {
|
|
3867
3870
|
for (const a of s)
|
|
3868
|
-
if (!
|
|
3871
|
+
if (!Vr(a))
|
|
3869
3872
|
throw new ie(`Invalid entity ID in link '${i}' for entity '${t}'. Expected a UUID or a lookup, but received: ${a}`);
|
|
3870
|
-
} else if (!
|
|
3873
|
+
} else if (!Vr(s))
|
|
3871
3874
|
throw new ie(`Invalid UUID in link '${i}' for entity '${t}'. Expected a UUID, but received: ${s}`);
|
|
3872
3875
|
}
|
|
3873
3876
|
}
|
|
3874
|
-
},
|
|
3875
|
-
create:
|
|
3876
|
-
update:
|
|
3877
|
-
merge:
|
|
3878
|
-
link:
|
|
3879
|
-
unlink:
|
|
3877
|
+
}, Tu = {
|
|
3878
|
+
create: Zt,
|
|
3879
|
+
update: Zt,
|
|
3880
|
+
merge: Zt,
|
|
3881
|
+
link: Gr,
|
|
3882
|
+
unlink: Gr,
|
|
3880
3883
|
delete: () => {
|
|
3881
3884
|
}
|
|
3882
|
-
},
|
|
3885
|
+
}, wu = (t, e) => {
|
|
3883
3886
|
if (!e)
|
|
3884
3887
|
return;
|
|
3885
3888
|
const [n, r, i, s] = t;
|
|
@@ -3887,9 +3890,9 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
|
|
|
3887
3890
|
throw new ie(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
|
|
3888
3891
|
if (typeof r != "string")
|
|
3889
3892
|
throw new ie(`Entity name must be a string, but received: ${typeof r}`);
|
|
3890
|
-
const o =
|
|
3893
|
+
const o = Tu[n];
|
|
3891
3894
|
o && s !== void 0 && o(r, s, e);
|
|
3892
|
-
},
|
|
3895
|
+
}, mu = (t, e) => {
|
|
3893
3896
|
const n = Array.isArray(t) ? t : [t];
|
|
3894
3897
|
for (const r of n) {
|
|
3895
3898
|
if (!r || typeof r != "object")
|
|
@@ -3899,11 +3902,11 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
|
|
|
3899
3902
|
for (const i of r.__ops) {
|
|
3900
3903
|
if (!Array.isArray(i))
|
|
3901
3904
|
throw new ie(`Transaction operation must be an array, but received: ${typeof i}`);
|
|
3902
|
-
|
|
3905
|
+
wu(i, e);
|
|
3903
3906
|
}
|
|
3904
3907
|
}
|
|
3905
3908
|
};
|
|
3906
|
-
var
|
|
3909
|
+
var Qr = function(t, e, n, r) {
|
|
3907
3910
|
function i(s) {
|
|
3908
3911
|
return s instanceof n ? s : new n(function(o) {
|
|
3909
3912
|
o(s);
|
|
@@ -3930,10 +3933,10 @@ var Gr = function(t, e, n, r) {
|
|
|
3930
3933
|
d((r = r.apply(t, e || [])).next());
|
|
3931
3934
|
});
|
|
3932
3935
|
};
|
|
3933
|
-
let
|
|
3934
|
-
class
|
|
3936
|
+
let Zi = 0;
|
|
3937
|
+
class Hr {
|
|
3935
3938
|
constructor(e) {
|
|
3936
|
-
this.type = "ws", this.id = `${this.type}_${
|
|
3939
|
+
this.type = "ws", this.id = `${this.type}_${Zi++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
|
|
3937
3940
|
this.onopen && this.onopen({ target: this });
|
|
3938
3941
|
}, this.conn.onmessage = (n) => {
|
|
3939
3942
|
this.onmessage && this.onmessage({
|
|
@@ -3961,9 +3964,9 @@ class Qr {
|
|
|
3961
3964
|
return this.conn.send(JSON.stringify(e));
|
|
3962
3965
|
}
|
|
3963
3966
|
}
|
|
3964
|
-
class
|
|
3967
|
+
class vu {
|
|
3965
3968
|
constructor(e, n) {
|
|
3966
|
-
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = null, this.id = `${this.type}_${
|
|
3969
|
+
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = null, this.id = `${this.type}_${Zi++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
|
|
3967
3970
|
this.initParams || this.handleError();
|
|
3968
3971
|
}, 1e4), this.conn.onmessage = (r) => {
|
|
3969
3972
|
const i = JSON.parse(r.data);
|
|
@@ -3995,7 +3998,7 @@ class mu {
|
|
|
3995
3998
|
this.conn.close(), this.onclose && !this.closeFired && (this.closeFired = !0, this.onclose({ target: this }));
|
|
3996
3999
|
}
|
|
3997
4000
|
postMessages(e) {
|
|
3998
|
-
return
|
|
4001
|
+
return Qr(this, void 0, void 0, function* () {
|
|
3999
4002
|
try {
|
|
4000
4003
|
(yield fetch(this.url, {
|
|
4001
4004
|
method: "POST",
|
|
@@ -4013,7 +4016,7 @@ class mu {
|
|
|
4013
4016
|
});
|
|
4014
4017
|
}
|
|
4015
4018
|
flushQueue() {
|
|
4016
|
-
return
|
|
4019
|
+
return Qr(this, void 0, void 0, function* () {
|
|
4017
4020
|
if (this.sendPromise || !this.sendQueue.length)
|
|
4018
4021
|
return;
|
|
4019
4022
|
const e = this.sendQueue;
|
|
@@ -4039,7 +4042,7 @@ class mu {
|
|
|
4039
4042
|
this.handleClose();
|
|
4040
4043
|
}
|
|
4041
4044
|
}
|
|
4042
|
-
var
|
|
4045
|
+
var Yr = function(t, e, n, r) {
|
|
4043
4046
|
function i(s) {
|
|
4044
4047
|
return s instanceof n ? s : new n(function(o) {
|
|
4045
4048
|
o(s);
|
|
@@ -4066,34 +4069,34 @@ var Hr = function(t, e, n, r) {
|
|
|
4066
4069
|
d((r = r.apply(t, e || [])).next());
|
|
4067
4070
|
});
|
|
4068
4071
|
};
|
|
4069
|
-
function
|
|
4072
|
+
function Su(t, e) {
|
|
4070
4073
|
const n = t.values;
|
|
4071
4074
|
if (n)
|
|
4072
4075
|
for (const r of n.entities || [])
|
|
4073
|
-
r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store =
|
|
4076
|
+
r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store = Ei(r.store);
|
|
4074
4077
|
return t;
|
|
4075
4078
|
}
|
|
4076
|
-
function
|
|
4079
|
+
function Ou(t, e) {
|
|
4077
4080
|
var n, r;
|
|
4078
4081
|
if (!((n = e.values) === null || n === void 0) && n.entities) {
|
|
4079
4082
|
const i = [];
|
|
4080
4083
|
for (const s of (r = e.values) === null || r === void 0 ? void 0 : r.entities) {
|
|
4081
|
-
const o =
|
|
4084
|
+
const o = Oi(s.store);
|
|
4082
4085
|
delete o.attrs, i.push(Object.assign(Object.assign({}, s), { store: o }));
|
|
4083
4086
|
}
|
|
4084
4087
|
return Object.assign(Object.assign({}, e), { values: Object.assign(Object.assign({}, e.values), { entities: i }) });
|
|
4085
4088
|
} else
|
|
4086
4089
|
return e;
|
|
4087
4090
|
}
|
|
4088
|
-
function
|
|
4091
|
+
function Eu(t, e, n) {
|
|
4089
4092
|
var r, i;
|
|
4090
4093
|
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;
|
|
4091
4094
|
return s && (!o || s > o) ? e : o && (!s || o > s) ? n : e || n;
|
|
4092
4095
|
}
|
|
4093
|
-
function
|
|
4094
|
-
return
|
|
4096
|
+
function Xt(t, e) {
|
|
4097
|
+
return Li({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4095
4098
|
}
|
|
4096
|
-
function
|
|
4099
|
+
function Jr(t, e, n) {
|
|
4097
4100
|
var r;
|
|
4098
4101
|
const i = (r = Te(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
|
|
4099
4102
|
if (!i)
|
|
@@ -4101,18 +4104,18 @@ function Yr(t, e, n) {
|
|
|
4101
4104
|
const s = We(e.eav, [n, i, n]);
|
|
4102
4105
|
return s ? s[3] : -1;
|
|
4103
4106
|
}
|
|
4104
|
-
function
|
|
4107
|
+
function Zr(t, e) {
|
|
4105
4108
|
for (const { action: n, triple: r } of e)
|
|
4106
4109
|
switch (n) {
|
|
4107
4110
|
case "added":
|
|
4108
|
-
|
|
4111
|
+
ji(t, r);
|
|
4109
4112
|
break;
|
|
4110
4113
|
case "removed":
|
|
4111
|
-
|
|
4114
|
+
Ai(t, r);
|
|
4112
4115
|
break;
|
|
4113
4116
|
}
|
|
4114
4117
|
}
|
|
4115
|
-
function
|
|
4118
|
+
function Au(t, e) {
|
|
4116
4119
|
var n, r, i, s;
|
|
4117
4120
|
const o = {};
|
|
4118
4121
|
for (const { action: a, triple: u } of e) {
|
|
@@ -4140,14 +4143,14 @@ function Eu(t, e) {
|
|
|
4140
4143
|
function wt(t, e) {
|
|
4141
4144
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4142
4145
|
}
|
|
4143
|
-
function
|
|
4146
|
+
function ku(t, e) {
|
|
4144
4147
|
var n;
|
|
4145
4148
|
if (t.orderFieldType)
|
|
4146
4149
|
return t.orderFieldType;
|
|
4147
4150
|
const r = t.orderField === "serverCreatedAt" ? "number" : (n = Te(e([]), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
|
|
4148
4151
|
return t.orderFieldType = r, r;
|
|
4149
4152
|
}
|
|
4150
|
-
function
|
|
4153
|
+
function ju(t, e, n) {
|
|
4151
4154
|
const r = e;
|
|
4152
4155
|
if (t.orderField === "serverCreatedAt") {
|
|
4153
4156
|
n.sort(t.orderDirection === "asc" ? function(o, a) {
|
|
@@ -4168,13 +4171,13 @@ var ve;
|
|
|
4168
4171
|
(function(t) {
|
|
4169
4172
|
t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
|
|
4170
4173
|
})(ve || (ve = {}));
|
|
4171
|
-
class
|
|
4174
|
+
class Cu {
|
|
4172
4175
|
constructor(e, n, r, i, s) {
|
|
4173
|
-
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new
|
|
4176
|
+
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new mn({
|
|
4174
4177
|
persister: n,
|
|
4175
|
-
merge:
|
|
4176
|
-
serialize:
|
|
4177
|
-
parse: (o, a) =>
|
|
4178
|
+
merge: Eu,
|
|
4179
|
+
serialize: Ou,
|
|
4180
|
+
parse: (o, a) => Su(a, this.config.useDateObjects),
|
|
4178
4181
|
objectSize: (o) => {
|
|
4179
4182
|
var a;
|
|
4180
4183
|
return ((a = o.values) === null || a === void 0 ? void 0 : a.entities.length) || 0;
|
|
@@ -4231,7 +4234,7 @@ class ju {
|
|
|
4231
4234
|
});
|
|
4232
4235
|
}
|
|
4233
4236
|
initSubscription(e, n, r) {
|
|
4234
|
-
return
|
|
4237
|
+
return Yr(this, void 0, void 0, function* () {
|
|
4235
4238
|
var i, s, o, a;
|
|
4236
4239
|
yield this.subs.waitForKeyToLoad(n);
|
|
4237
4240
|
const u = this.subs.currentValue[n];
|
|
@@ -4257,7 +4260,7 @@ class ju {
|
|
|
4257
4260
|
});
|
|
4258
4261
|
}
|
|
4259
4262
|
flushPending() {
|
|
4260
|
-
return
|
|
4263
|
+
return Yr(this, void 0, void 0, function* () {
|
|
4261
4264
|
for (const e of Object.keys(this.callbacks)) {
|
|
4262
4265
|
yield this.subs.waitForKeyToLoad(e);
|
|
4263
4266
|
const n = this.subs.currentValue[e];
|
|
@@ -4302,11 +4305,11 @@ class ju {
|
|
|
4302
4305
|
for (const c of i) {
|
|
4303
4306
|
const f = this.createStore(c);
|
|
4304
4307
|
u.attrs = f.attrs;
|
|
4305
|
-
const l =
|
|
4308
|
+
const l = Xt(a, f);
|
|
4306
4309
|
d.push({
|
|
4307
4310
|
store: f,
|
|
4308
4311
|
entity: l,
|
|
4309
|
-
serverCreatedAt:
|
|
4312
|
+
serverCreatedAt: Jr(a, f, l.id)
|
|
4310
4313
|
}), o.push(l);
|
|
4311
4314
|
}
|
|
4312
4315
|
this.subs.updateInPlace((c) => {
|
|
@@ -4376,9 +4379,9 @@ class ju {
|
|
|
4376
4379
|
e: for (const [g, m] of Object.entries(f))
|
|
4377
4380
|
for (let E = 0; E < p.length; E++) {
|
|
4378
4381
|
const S = p[E];
|
|
4379
|
-
if (
|
|
4380
|
-
|
|
4381
|
-
const I =
|
|
4382
|
+
if (ao(S.store, g)) {
|
|
4383
|
+
Zr(S.store, m);
|
|
4384
|
+
const I = Xt(a, S.store), x = Au(S.store, m)[g];
|
|
4382
4385
|
I ? (y.push({
|
|
4383
4386
|
oldEntity: S.entity,
|
|
4384
4387
|
newEntity: I,
|
|
@@ -4390,8 +4393,8 @@ class ju {
|
|
|
4390
4393
|
const b = [];
|
|
4391
4394
|
for (const [g, m] of Object.entries(f)) {
|
|
4392
4395
|
const E = this.createStore([]);
|
|
4393
|
-
l.attrs = E.attrs,
|
|
4394
|
-
const S =
|
|
4396
|
+
l.attrs = E.attrs, Zr(E, m);
|
|
4397
|
+
const S = Xt(a, E);
|
|
4395
4398
|
if (!S) {
|
|
4396
4399
|
this.log.error("No entity found after applying change", {
|
|
4397
4400
|
sub: a,
|
|
@@ -4403,14 +4406,14 @@ class ju {
|
|
|
4403
4406
|
p.push({
|
|
4404
4407
|
store: E,
|
|
4405
4408
|
entity: S,
|
|
4406
|
-
serverCreatedAt:
|
|
4409
|
+
serverCreatedAt: Jr(a, E, S.id)
|
|
4407
4410
|
}), b.push(S);
|
|
4408
4411
|
}
|
|
4409
4412
|
const _ = [];
|
|
4410
4413
|
for (const g of c.sort().reverse())
|
|
4411
4414
|
_.push(p[g].entity), p.splice(g, 1);
|
|
4412
|
-
const w =
|
|
4413
|
-
|
|
4415
|
+
const w = ku(a, this.createStore);
|
|
4416
|
+
ju(a, w, p), this.notifyCbs(o, {
|
|
4414
4417
|
type: ve.SyncTransaction,
|
|
4415
4418
|
data: wt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
|
|
4416
4419
|
added: b,
|
|
@@ -4477,7 +4480,7 @@ var F = function(t, e, n, r) {
|
|
|
4477
4480
|
}
|
|
4478
4481
|
d((r = r.apply(t, e || [])).next());
|
|
4479
4482
|
});
|
|
4480
|
-
},
|
|
4483
|
+
}, Pu = function(t, e) {
|
|
4481
4484
|
var n = {};
|
|
4482
4485
|
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
4483
4486
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -4491,46 +4494,46 @@ const le = {
|
|
|
4491
4494
|
AUTHENTICATED: "authenticated",
|
|
4492
4495
|
CLOSED: "closed",
|
|
4493
4496
|
ERRORED: "errored"
|
|
4494
|
-
},
|
|
4497
|
+
}, Iu = 3e4, Mu = 3e4, Ru = 200, xu = {
|
|
4495
4498
|
apiURI: "https://api.instantdb.com",
|
|
4496
4499
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
4497
|
-
},
|
|
4498
|
-
function
|
|
4500
|
+
}, en = "_instant_oauth_redirect", Qe = "currentUser";
|
|
4501
|
+
function $u({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
4499
4502
|
if (!i)
|
|
4500
|
-
return new
|
|
4503
|
+
return new Hr(`${r}?app_id=${e}`);
|
|
4501
4504
|
switch (t) {
|
|
4502
4505
|
case "ws":
|
|
4503
|
-
return new
|
|
4506
|
+
return new Hr(`${r}?app_id=${e}`);
|
|
4504
4507
|
case "sse":
|
|
4505
|
-
return new
|
|
4508
|
+
return new vu(i, `${n}/runtime/sse?app_id=${e}`);
|
|
4506
4509
|
default:
|
|
4507
4510
|
throw new Error("Unknown transport type " + t);
|
|
4508
4511
|
}
|
|
4509
4512
|
}
|
|
4510
|
-
function
|
|
4513
|
+
function Du() {
|
|
4511
4514
|
return typeof window < "u" || typeof chrome < "u";
|
|
4512
4515
|
}
|
|
4513
|
-
const
|
|
4516
|
+
const Xr = {
|
|
4514
4517
|
"set-presence": !0,
|
|
4515
4518
|
"set-presence-ok": !0,
|
|
4516
4519
|
"refresh-presence": !0,
|
|
4517
4520
|
"patch-presence": !0
|
|
4518
4521
|
};
|
|
4519
|
-
function
|
|
4522
|
+
function Uu(t, e) {
|
|
4520
4523
|
var n;
|
|
4521
4524
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
4522
4525
|
if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
|
|
4523
4526
|
const i = r.result.store;
|
|
4524
|
-
r.result.store =
|
|
4527
|
+
r.result.store = Ei(Object.assign(Object.assign({}, i), { useDateObjects: e }));
|
|
4525
4528
|
}
|
|
4526
4529
|
return r;
|
|
4527
4530
|
}
|
|
4528
|
-
function
|
|
4531
|
+
function Lu(t, e) {
|
|
4529
4532
|
var n;
|
|
4530
4533
|
const r = Object.assign({}, e);
|
|
4531
|
-
return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store:
|
|
4534
|
+
return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: Oi(e.result.store) })), r;
|
|
4532
4535
|
}
|
|
4533
|
-
function
|
|
4536
|
+
function Fu(t, e) {
|
|
4534
4537
|
switch (t) {
|
|
4535
4538
|
case "pendingMutations":
|
|
4536
4539
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -4538,7 +4541,7 @@ function Lu(t, e) {
|
|
|
4538
4541
|
return e;
|
|
4539
4542
|
}
|
|
4540
4543
|
}
|
|
4541
|
-
function
|
|
4544
|
+
function Nu(t, e) {
|
|
4542
4545
|
switch (t) {
|
|
4543
4546
|
case "pendingMutations":
|
|
4544
4547
|
return [...e.entries()];
|
|
@@ -4546,18 +4549,18 @@ function Fu(t, e) {
|
|
|
4546
4549
|
return e;
|
|
4547
4550
|
}
|
|
4548
4551
|
}
|
|
4549
|
-
function
|
|
4552
|
+
function Ku(t, e, n) {
|
|
4550
4553
|
const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
|
|
4551
4554
|
return r && !i && n && (n.result = r), n || e;
|
|
4552
4555
|
}
|
|
4553
|
-
function
|
|
4556
|
+
function ei(t) {
|
|
4554
4557
|
return [...t].sort((e, n) => {
|
|
4555
4558
|
const [r, i] = e, [s, o] = n, a = i.order || 0, u = o.order || 0;
|
|
4556
4559
|
return a == u ? r < s ? -1 : r > s ? 1 : 0 : a - u;
|
|
4557
4560
|
});
|
|
4558
4561
|
}
|
|
4559
|
-
class
|
|
4560
|
-
constructor(e, n =
|
|
4562
|
+
class qu {
|
|
4563
|
+
constructor(e, n = qi, r = Wi, i, s) {
|
|
4561
4564
|
var o, a, u;
|
|
4562
4565
|
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 = (d, c, f) => {
|
|
4563
4566
|
var l, p;
|
|
@@ -4588,9 +4591,9 @@ class Ku {
|
|
|
4588
4591
|
}, this.notifyQueryError = (d, c) => {
|
|
4589
4592
|
(this.queryCbs[d] || []).forEach((l) => l.cb({ error: c }));
|
|
4590
4593
|
}, this.pushTx = (d) => {
|
|
4591
|
-
this.config.disableValidation ||
|
|
4594
|
+
this.config.disableValidation || mu(d, this.config.schema);
|
|
4592
4595
|
try {
|
|
4593
|
-
const c =
|
|
4596
|
+
const c = Wa({
|
|
4594
4597
|
attrs: this.optimisticAttrs(),
|
|
4595
4598
|
schema: this.config.schema,
|
|
4596
4599
|
stores: Object.values(this.querySubs.currentValue).map((f) => {
|
|
@@ -4614,7 +4617,7 @@ class Ku {
|
|
|
4614
4617
|
this._updatePendingMutations((_) => {
|
|
4615
4618
|
_.set(f, y);
|
|
4616
4619
|
});
|
|
4617
|
-
const b = new
|
|
4620
|
+
const b = new Nr();
|
|
4618
4621
|
return this.mutationDeferredStore.set(f, b), this._sendMutation(f, y), this.notifyAll(), b.promise;
|
|
4619
4622
|
}, this._transportOnOpen = (d) => {
|
|
4620
4623
|
const c = d.target;
|
|
@@ -4675,7 +4678,7 @@ class Ku {
|
|
|
4675
4678
|
return;
|
|
4676
4679
|
}
|
|
4677
4680
|
this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
4678
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({},
|
|
4681
|
+
}, 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 || Gn || zi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Qn }), this.config.schema && (this._linkIndex = qr(this.config.schema)), !!Du()) {
|
|
4679
4682
|
if (!e.appId)
|
|
4680
4683
|
throw new Error("Instant must be initialized with an appId.");
|
|
4681
4684
|
if (!Fe(e.appId))
|
|
@@ -4690,7 +4693,7 @@ class Ku {
|
|
|
4690
4693
|
} catch (f) {
|
|
4691
4694
|
this._log.error("[error] handle broadcast channel", f);
|
|
4692
4695
|
}
|
|
4693
|
-
}))), this._initStorage(n), this._syncTable = new
|
|
4696
|
+
}))), this._initStorage(n), this._syncTable = new Cu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
4694
4697
|
useDateObjects: this.config.useDateObjects
|
|
4695
4698
|
}, this._log, (d) => Et(this.attrs, d, this.config.enableCardinalityInference, this._linkIndex, this.config.useDateObjects)), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
|
|
4696
4699
|
this._isOnline = d, this._startSocket(), r.listen((c) => {
|
|
@@ -4700,7 +4703,7 @@ class Ku {
|
|
|
4700
4703
|
}
|
|
4701
4704
|
}
|
|
4702
4705
|
updateSchema(e) {
|
|
4703
|
-
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ?
|
|
4706
|
+
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ? qr(this.config.schema) : null;
|
|
4704
4707
|
}
|
|
4705
4708
|
_reactorStats() {
|
|
4706
4709
|
return {
|
|
@@ -4713,11 +4716,11 @@ class Ku {
|
|
|
4713
4716
|
this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
|
|
4714
4717
|
}
|
|
4715
4718
|
_initStorage(e) {
|
|
4716
|
-
this.querySubs = new
|
|
4719
|
+
this.querySubs = new mn({
|
|
4717
4720
|
persister: new e(this.config.appId, "querySubs"),
|
|
4718
|
-
merge:
|
|
4719
|
-
serialize:
|
|
4720
|
-
parse: (n, r) =>
|
|
4721
|
+
merge: Ku,
|
|
4722
|
+
serialize: Lu,
|
|
4723
|
+
parse: (n, r) => Uu(r, this.config.useDateObjects),
|
|
4721
4724
|
// objectSize
|
|
4722
4725
|
objectSize: (n) => {
|
|
4723
4726
|
var r, i, s, o;
|
|
@@ -4733,11 +4736,11 @@ class Ku {
|
|
|
4733
4736
|
maxSize: 1e6
|
|
4734
4737
|
// 1 million triples
|
|
4735
4738
|
}
|
|
4736
|
-
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new
|
|
4739
|
+
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new mn({
|
|
4737
4740
|
persister: new e(this.config.appId, "kv"),
|
|
4738
4741
|
merge: this._onMergeKv,
|
|
4739
|
-
serialize:
|
|
4740
|
-
parse:
|
|
4742
|
+
serialize: Nu,
|
|
4743
|
+
parse: Fu,
|
|
4741
4744
|
objectSize: () => 0,
|
|
4742
4745
|
logger: this._log,
|
|
4743
4746
|
saveThrottleMs: 100,
|
|
@@ -4768,7 +4771,7 @@ class Ku {
|
|
|
4768
4771
|
if (s)
|
|
4769
4772
|
i.resolve({ status: e, eventId: n });
|
|
4770
4773
|
else if (r != null && r.type) {
|
|
4771
|
-
const { status: o } = r, a =
|
|
4774
|
+
const { status: o } = r, a = Pu(r, ["status"]);
|
|
4772
4775
|
i.reject(new Dt({
|
|
4773
4776
|
// @ts-expect-error body.type is not constant typed
|
|
4774
4777
|
body: a,
|
|
@@ -4792,7 +4795,7 @@ class Ku {
|
|
|
4792
4795
|
_handleReceive(e, n) {
|
|
4793
4796
|
var r, i, s, o, a, u;
|
|
4794
4797
|
const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
4795
|
-
switch (
|
|
4798
|
+
switch (Xr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
4796
4799
|
case "init-ok": {
|
|
4797
4800
|
this._setStatus(le.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
4798
4801
|
for (const l of Object.keys(this._rooms)) {
|
|
@@ -4809,7 +4812,7 @@ class Ku {
|
|
|
4809
4812
|
const { q: l, result: p } = n, y = z(l);
|
|
4810
4813
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
4811
4814
|
break;
|
|
4812
|
-
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 =
|
|
4815
|
+
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 = Kr(p), g = Et(this.attrs, w, d, this._linkIndex, this.config.useDateObjects);
|
|
4813
4816
|
this.querySubs.updateInPlace((m) => {
|
|
4814
4817
|
if (!m[y]) {
|
|
4815
4818
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
@@ -4847,9 +4850,9 @@ class Ku {
|
|
|
4847
4850
|
b !== this._pendingMutations() && this.kv.updateInPlace((g) => {
|
|
4848
4851
|
g.pendingMutations = b;
|
|
4849
4852
|
});
|
|
4850
|
-
const _ =
|
|
4853
|
+
const _ = ei(b.entries()), w = l.map((g) => {
|
|
4851
4854
|
var m, E, S, I;
|
|
4852
|
-
const x = g["instaql-query"], B = g["instaql-result"], Ve = z(x), lt =
|
|
4855
|
+
const x = g["instaql-query"], B = g["instaql-result"], Ve = z(x), lt = Kr(B), Ft = Et(this.attrs, lt, d, 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;
|
|
4853
4856
|
return { q: x, hash: Ve, store: Nt, pageInfo: ht, aggregate: ce };
|
|
4854
4857
|
});
|
|
4855
4858
|
w.forEach(({ hash: g, q: m, store: E, pageInfo: S, aggregate: I }) => {
|
|
@@ -5012,7 +5015,7 @@ class Ku {
|
|
|
5012
5015
|
*/
|
|
5013
5016
|
subscribeQuery(e, n, r) {
|
|
5014
5017
|
var i;
|
|
5015
|
-
this.config.disableValidation ||
|
|
5018
|
+
this.config.disableValidation || zr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
|
|
5016
5019
|
const s = z(e), o = this.getPreviousResult(e);
|
|
5017
5020
|
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), () => {
|
|
5018
5021
|
this._unsubQuery(e, s, n);
|
|
@@ -5020,14 +5023,14 @@ class Ku {
|
|
|
5020
5023
|
}
|
|
5021
5024
|
queryOnce(e, n) {
|
|
5022
5025
|
var r;
|
|
5023
|
-
this.config.disableValidation ||
|
|
5024
|
-
const i = new
|
|
5026
|
+
this.config.disableValidation || zr(e, this.config.schema), n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
5027
|
+
const i = new Nr();
|
|
5025
5028
|
if (!this._isOnline)
|
|
5026
5029
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
5027
5030
|
if (!this.querySubs)
|
|
5028
5031
|
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;
|
|
5029
5032
|
const s = z(e), o = this._startQuerySub(e, s);
|
|
5030
|
-
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")),
|
|
5033
|
+
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;
|
|
5031
5034
|
}
|
|
5032
5035
|
_completeQueryOnce(e, n, r) {
|
|
5033
5036
|
this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
|
|
@@ -5088,7 +5091,7 @@ class Ku {
|
|
|
5088
5091
|
a = !0;
|
|
5089
5092
|
continue;
|
|
5090
5093
|
}
|
|
5091
|
-
const b = a ?
|
|
5094
|
+
const b = a ? Ta(o, p) : p;
|
|
5092
5095
|
l.push(b);
|
|
5093
5096
|
}
|
|
5094
5097
|
return a ? l : c;
|
|
@@ -5098,7 +5101,7 @@ class Ku {
|
|
|
5098
5101
|
return a ? d : n;
|
|
5099
5102
|
}
|
|
5100
5103
|
_rewriteMutationsSorted(e, n) {
|
|
5101
|
-
return
|
|
5104
|
+
return ei(this._rewriteMutations(e, n).entries());
|
|
5102
5105
|
}
|
|
5103
5106
|
// ---------------------------
|
|
5104
5107
|
// Transact
|
|
@@ -5131,7 +5134,7 @@ class Ku {
|
|
|
5131
5134
|
const d = this._dataForQueryCache[e];
|
|
5132
5135
|
if (d && r === d.querySubVersion && s === d.pendingMutationsVersion)
|
|
5133
5136
|
return d.data;
|
|
5134
|
-
const { store: c, pageInfo: f, aggregate: l, processedTxId: p } = u, y = this._rewriteMutationsSorted(c.attrs, o), b = this._applyOptimisticUpdates(c, y, p), _ =
|
|
5137
|
+
const { store: c, pageInfo: f, aggregate: l, processedTxId: p } = u, y = this._rewriteMutationsSorted(c.attrs, o), b = this._applyOptimisticUpdates(c, y, p), _ = Li({ store: b, pageInfo: f, aggregate: l }, a);
|
|
5135
5138
|
return this._dataForQueryCache[e] = {
|
|
5136
5139
|
querySubVersion: r,
|
|
5137
5140
|
pendingMutationsVersion: s,
|
|
@@ -5140,7 +5143,7 @@ class Ku {
|
|
|
5140
5143
|
}
|
|
5141
5144
|
_applyOptimisticUpdates(e, n, r) {
|
|
5142
5145
|
for (const [i, s] of n)
|
|
5143
|
-
(!s["tx-id"] || r && s["tx-id"] > r) && (e =
|
|
5146
|
+
(!s["tx-id"] || r && s["tx-id"] > r) && (e = wo(e, s["tx-steps"]));
|
|
5144
5147
|
return e;
|
|
5145
5148
|
}
|
|
5146
5149
|
/** Re-compute all subscriptions */
|
|
@@ -5228,7 +5231,7 @@ class Ku {
|
|
|
5228
5231
|
}
|
|
5229
5232
|
_trySend(e, n, r) {
|
|
5230
5233
|
if (this._transport.isOpen()) {
|
|
5231
|
-
switch (
|
|
5234
|
+
switch (Xr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
|
|
5232
5235
|
case "transact": {
|
|
5233
5236
|
this._inFlightMutationEventIds.add(e);
|
|
5234
5237
|
break;
|
|
@@ -5249,7 +5252,7 @@ class Ku {
|
|
|
5249
5252
|
return;
|
|
5250
5253
|
}
|
|
5251
5254
|
const e = this._transport;
|
|
5252
|
-
this._transport =
|
|
5255
|
+
this._transport = $u({
|
|
5253
5256
|
transportType: this._transportType,
|
|
5254
5257
|
appId: this.config.appId,
|
|
5255
5258
|
apiURI: this.config.apiURI,
|
|
@@ -5285,9 +5288,9 @@ class Ku {
|
|
|
5285
5288
|
if (typeof URL > "u")
|
|
5286
5289
|
return;
|
|
5287
5290
|
const e = new URL(window.location.href);
|
|
5288
|
-
if (e.searchParams.get(
|
|
5291
|
+
if (e.searchParams.get(en)) {
|
|
5289
5292
|
const n = e.toString();
|
|
5290
|
-
e.searchParams.delete(
|
|
5293
|
+
e.searchParams.delete(en), e.searchParams.delete("code"), e.searchParams.delete("error");
|
|
5291
5294
|
const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
|
|
5292
5295
|
if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
|
|
5293
5296
|
typeof navigation == "object" && // @ts-ignore (waiting for ts support)
|
|
@@ -5312,7 +5315,7 @@ class Ku {
|
|
|
5312
5315
|
if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
|
|
5313
5316
|
return null;
|
|
5314
5317
|
const s = new URLSearchParams(window.location.search);
|
|
5315
|
-
if (!s.get(
|
|
5318
|
+
if (!s.get(en))
|
|
5316
5319
|
return null;
|
|
5317
5320
|
const o = s.get("error");
|
|
5318
5321
|
if (o)
|
|
@@ -5322,7 +5325,7 @@ class Ku {
|
|
|
5322
5325
|
return null;
|
|
5323
5326
|
this._replaceUrlAfterOAuth();
|
|
5324
5327
|
try {
|
|
5325
|
-
const u = yield this._getCurrentUser(), d = (u == null ? void 0 : u.type) === "guest", { user: c } = yield
|
|
5328
|
+
const u = yield this._getCurrentUser(), d = (u == null ? void 0 : u.type) === "guest", { user: c } = yield Lr({
|
|
5326
5329
|
apiURI: this.config.apiURI,
|
|
5327
5330
|
appId: this.config.appId,
|
|
5328
5331
|
code: a,
|
|
@@ -5452,7 +5455,7 @@ class Ku {
|
|
|
5452
5455
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
|
|
5453
5456
|
}
|
|
5454
5457
|
sendMagicCode({ email: e }) {
|
|
5455
|
-
return
|
|
5458
|
+
return Xa({
|
|
5456
5459
|
apiURI: this.config.apiURI,
|
|
5457
5460
|
appId: this.config.appId,
|
|
5458
5461
|
email: e
|
|
@@ -5461,7 +5464,7 @@ class Ku {
|
|
|
5461
5464
|
signInWithMagicCode(e) {
|
|
5462
5465
|
return F(this, arguments, void 0, function* ({ email: n, code: r }) {
|
|
5463
5466
|
var i;
|
|
5464
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield
|
|
5467
|
+
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({
|
|
5465
5468
|
apiURI: this.config.apiURI,
|
|
5466
5469
|
appId: this.config.appId,
|
|
5467
5470
|
email: n,
|
|
@@ -5473,7 +5476,7 @@ class Ku {
|
|
|
5473
5476
|
}
|
|
5474
5477
|
signInWithCustomToken(e) {
|
|
5475
5478
|
return F(this, void 0, void 0, function* () {
|
|
5476
|
-
const n = yield
|
|
5479
|
+
const n = yield tu({
|
|
5477
5480
|
apiURI: this.config.apiURI,
|
|
5478
5481
|
appId: this.config.appId,
|
|
5479
5482
|
refreshToken: e
|
|
@@ -5483,7 +5486,7 @@ class Ku {
|
|
|
5483
5486
|
}
|
|
5484
5487
|
signInAsGuest() {
|
|
5485
5488
|
return F(this, void 0, void 0, function* () {
|
|
5486
|
-
const e = yield
|
|
5489
|
+
const e = yield nu({
|
|
5487
5490
|
apiURI: this.config.apiURI,
|
|
5488
5491
|
appId: this.config.appId
|
|
5489
5492
|
});
|
|
@@ -5499,7 +5502,7 @@ class Ku {
|
|
|
5499
5502
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
5500
5503
|
return;
|
|
5501
5504
|
}
|
|
5502
|
-
|
|
5505
|
+
iu({
|
|
5503
5506
|
apiURI: this.config.apiURI,
|
|
5504
5507
|
appId: this.config.appId,
|
|
5505
5508
|
refreshToken: i
|
|
@@ -5534,7 +5537,7 @@ class Ku {
|
|
|
5534
5537
|
exchangeCodeForToken(e) {
|
|
5535
5538
|
return F(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
|
|
5536
5539
|
var i;
|
|
5537
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield
|
|
5540
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield Lr({
|
|
5538
5541
|
apiURI: this.config.apiURI,
|
|
5539
5542
|
appId: this.config.appId,
|
|
5540
5543
|
code: n,
|
|
@@ -5557,7 +5560,7 @@ class Ku {
|
|
|
5557
5560
|
signInWithIdToken(e) {
|
|
5558
5561
|
return F(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
|
|
5559
5562
|
var s;
|
|
5560
|
-
const o = yield this.getCurrentUser(), a = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, u = yield
|
|
5563
|
+
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({
|
|
5561
5564
|
apiURI: this.config.apiURI,
|
|
5562
5565
|
appId: this.config.appId,
|
|
5563
5566
|
idToken: n,
|
|
@@ -5598,7 +5601,7 @@ class Ku {
|
|
|
5598
5601
|
// TODO: look into typing again
|
|
5599
5602
|
getPresence(e, n, r = {}) {
|
|
5600
5603
|
const i = this._rooms[n], s = this._presence[n];
|
|
5601
|
-
return !i || !s || !s.result ? null : Object.assign(Object.assign({},
|
|
5604
|
+
return !i || !s || !s.result ? null : Object.assign(Object.assign({}, du(s.result, r, this._sessionId)), { isLoading: !i.isConnected, error: i.error });
|
|
5602
5605
|
}
|
|
5603
5606
|
// TODO: look into typing again
|
|
5604
5607
|
publishPresence(e, n, r) {
|
|
@@ -5648,7 +5651,7 @@ class Ku {
|
|
|
5648
5651
|
}
|
|
5649
5652
|
_notifyPresenceSub(e, n) {
|
|
5650
5653
|
const r = this.getPresence("", e, n);
|
|
5651
|
-
r && (n.prev && !
|
|
5654
|
+
r && (n.prev && !fu(r, n.prev) || (n.prev = r, n.cb(r)));
|
|
5652
5655
|
}
|
|
5653
5656
|
_patchPresencePeers(e, n) {
|
|
5654
5657
|
var r, i, s;
|
|
@@ -5659,13 +5662,13 @@ class Ku {
|
|
|
5659
5662
|
for (let [c, f, l] of n)
|
|
5660
5663
|
switch (f) {
|
|
5661
5664
|
case "+":
|
|
5662
|
-
|
|
5665
|
+
qs(d, c, l);
|
|
5663
5666
|
break;
|
|
5664
5667
|
case "r":
|
|
5665
|
-
|
|
5668
|
+
Er(d, c, l);
|
|
5666
5669
|
break;
|
|
5667
5670
|
case "-":
|
|
5668
|
-
|
|
5671
|
+
mi(d, c);
|
|
5669
5672
|
break;
|
|
5670
5673
|
}
|
|
5671
5674
|
delete d[this._sessionId];
|
|
@@ -5677,7 +5680,7 @@ class Ku {
|
|
|
5677
5680
|
delete r[this._sessionId];
|
|
5678
5681
|
const i = Object.fromEntries(Object.entries(r).map(([s, o]) => [s, o.data]));
|
|
5679
5682
|
this._presence = Pt(this._presence, (s) => {
|
|
5680
|
-
|
|
5683
|
+
Er(s, [e, "result", "peers"], i);
|
|
5681
5684
|
});
|
|
5682
5685
|
}
|
|
5683
5686
|
// --------
|
|
@@ -5722,14 +5725,14 @@ class Ku {
|
|
|
5722
5725
|
return F(this, void 0, void 0, function* () {
|
|
5723
5726
|
var i;
|
|
5724
5727
|
const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
|
|
5725
|
-
return
|
|
5728
|
+
return su(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
|
|
5726
5729
|
});
|
|
5727
5730
|
}
|
|
5728
5731
|
deleteFile(e) {
|
|
5729
5732
|
return F(this, void 0, void 0, function* () {
|
|
5730
5733
|
var n;
|
|
5731
5734
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
5732
|
-
return yield
|
|
5735
|
+
return yield ou({
|
|
5733
5736
|
apiURI: this.config.apiURI,
|
|
5734
5737
|
appId: this.config.appId,
|
|
5735
5738
|
path: e,
|
|
@@ -5742,20 +5745,20 @@ class Ku {
|
|
|
5742
5745
|
upload(e, n) {
|
|
5743
5746
|
return F(this, void 0, void 0, function* () {
|
|
5744
5747
|
var r;
|
|
5745
|
-
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
|
|
5748
|
+
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({
|
|
5746
5749
|
apiURI: this.config.apiURI,
|
|
5747
5750
|
appId: this.config.appId,
|
|
5748
5751
|
fileName: o,
|
|
5749
5752
|
refreshToken: s
|
|
5750
5753
|
});
|
|
5751
|
-
return yield
|
|
5754
|
+
return yield uu(a, n);
|
|
5752
5755
|
});
|
|
5753
5756
|
}
|
|
5754
5757
|
getDownloadUrl(e) {
|
|
5755
5758
|
return F(this, void 0, void 0, function* () {
|
|
5756
5759
|
var n;
|
|
5757
5760
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
5758
|
-
return yield
|
|
5761
|
+
return yield cu({
|
|
5759
5762
|
apiURI: this.config.apiURI,
|
|
5760
5763
|
appId: this.config.appId,
|
|
5761
5764
|
path: e,
|
|
@@ -5764,9 +5767,9 @@ class Ku {
|
|
|
5764
5767
|
});
|
|
5765
5768
|
}
|
|
5766
5769
|
}
|
|
5767
|
-
function
|
|
5770
|
+
function Wu(t, e) {
|
|
5768
5771
|
return new Lt(
|
|
5769
|
-
|
|
5772
|
+
Xi(t, e),
|
|
5770
5773
|
// (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
|
|
5771
5774
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
5772
5775
|
// EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
|
|
@@ -5776,28 +5779,28 @@ function qu(t, e) {
|
|
|
5776
5779
|
void 0
|
|
5777
5780
|
);
|
|
5778
5781
|
}
|
|
5779
|
-
function
|
|
5782
|
+
function zu(t) {
|
|
5780
5783
|
return new Ut(t, {});
|
|
5781
5784
|
}
|
|
5782
|
-
function
|
|
5785
|
+
function Vu() {
|
|
5783
5786
|
return new H("string", !0, !1);
|
|
5784
5787
|
}
|
|
5785
|
-
function
|
|
5788
|
+
function Bu() {
|
|
5786
5789
|
return new H("number", !0, !1);
|
|
5787
5790
|
}
|
|
5788
|
-
function
|
|
5791
|
+
function Gu() {
|
|
5789
5792
|
return new H("boolean", !0, !1);
|
|
5790
5793
|
}
|
|
5791
|
-
function
|
|
5794
|
+
function Qu() {
|
|
5792
5795
|
return new H("date", !0, !1);
|
|
5793
5796
|
}
|
|
5794
|
-
function
|
|
5797
|
+
function Hu() {
|
|
5795
5798
|
return new H("json", !0, !1);
|
|
5796
5799
|
}
|
|
5797
|
-
function
|
|
5800
|
+
function Yu() {
|
|
5798
5801
|
return new H("json", !0, !1);
|
|
5799
5802
|
}
|
|
5800
|
-
function
|
|
5803
|
+
function Xi(t, e) {
|
|
5801
5804
|
var n, r, i, s;
|
|
5802
5805
|
const o = { fwd: {}, rev: {} };
|
|
5803
5806
|
for (const u of Object.values(e))
|
|
@@ -5813,10 +5816,10 @@ function Zi(t, e) {
|
|
|
5813
5816
|
new Ut(d.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
|
|
5814
5817
|
]));
|
|
5815
5818
|
}
|
|
5816
|
-
function
|
|
5819
|
+
function Ju({ entities: t, links: e, rooms: n }) {
|
|
5817
5820
|
const r = e ?? {}, i = n ?? {};
|
|
5818
5821
|
return new Lt(
|
|
5819
|
-
|
|
5822
|
+
Xi(t, r),
|
|
5820
5823
|
// (XXX): LinksDef<any> stems from TypeScript's inability to reconcile the
|
|
5821
5824
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
5822
5825
|
// EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
|
|
@@ -5826,23 +5829,23 @@ function Yu({ entities: t, links: e, rooms: n }) {
|
|
|
5826
5829
|
i
|
|
5827
5830
|
);
|
|
5828
5831
|
}
|
|
5829
|
-
const
|
|
5832
|
+
const qc = {
|
|
5830
5833
|
// constructs
|
|
5831
|
-
graph:
|
|
5832
|
-
schema:
|
|
5833
|
-
entity:
|
|
5834
|
+
graph: Wu,
|
|
5835
|
+
schema: Ju,
|
|
5836
|
+
entity: zu,
|
|
5834
5837
|
// value types
|
|
5835
|
-
string:
|
|
5836
|
-
number:
|
|
5837
|
-
boolean:
|
|
5838
|
-
date:
|
|
5839
|
-
json:
|
|
5840
|
-
any:
|
|
5838
|
+
string: Vu,
|
|
5839
|
+
number: Bu,
|
|
5840
|
+
boolean: Gu,
|
|
5841
|
+
date: Qu,
|
|
5842
|
+
json: Hu,
|
|
5843
|
+
any: Yu
|
|
5841
5844
|
};
|
|
5842
5845
|
let mt;
|
|
5843
|
-
function
|
|
5846
|
+
function Zu(t, e) {
|
|
5844
5847
|
mt == null || mt.dispose();
|
|
5845
|
-
const n =
|
|
5848
|
+
const n = ic(e), r = tc(e, a), i = ec(Xu(t));
|
|
5846
5849
|
function s(c) {
|
|
5847
5850
|
var f;
|
|
5848
5851
|
c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && a();
|
|
@@ -5864,10 +5867,10 @@ function Ju(t, e) {
|
|
|
5864
5867
|
}
|
|
5865
5868
|
return d();
|
|
5866
5869
|
}
|
|
5867
|
-
function Zu(t) {
|
|
5868
|
-
return `${Bn || zi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
5869
|
-
}
|
|
5870
5870
|
function Xu(t) {
|
|
5871
|
+
return `${Gn || Vi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
5872
|
+
}
|
|
5873
|
+
function ec(t) {
|
|
5871
5874
|
const e = document.createElement("iframe");
|
|
5872
5875
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
5873
5876
|
width: "100%",
|
|
@@ -5876,7 +5879,7 @@ function Xu(t) {
|
|
|
5876
5879
|
border: "none"
|
|
5877
5880
|
}), { element: e };
|
|
5878
5881
|
}
|
|
5879
|
-
function
|
|
5882
|
+
function tc(t, e) {
|
|
5880
5883
|
const n = `
|
|
5881
5884
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5882
5885
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -5886,7 +5889,7 @@ function ec(t, e) {
|
|
|
5886
5889
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
|
|
5887
5890
|
// pos
|
|
5888
5891
|
position: "fixed"
|
|
5889
|
-
},
|
|
5892
|
+
}, nc(t.position)), {
|
|
5890
5893
|
height: "32px",
|
|
5891
5894
|
width: "32px",
|
|
5892
5895
|
// layout
|
|
@@ -5901,7 +5904,7 @@ function ec(t, e) {
|
|
|
5901
5904
|
cursor: "pointer"
|
|
5902
5905
|
})), r.addEventListener("click", e), { element: r };
|
|
5903
5906
|
}
|
|
5904
|
-
function
|
|
5907
|
+
function nc(t) {
|
|
5905
5908
|
switch (t) {
|
|
5906
5909
|
case "bottom-left":
|
|
5907
5910
|
return { bottom: "24px", left: "24px" };
|
|
@@ -5913,7 +5916,7 @@ function tc(t) {
|
|
|
5913
5916
|
return { top: "24px", left: "24px" };
|
|
5914
5917
|
}
|
|
5915
5918
|
}
|
|
5916
|
-
function
|
|
5919
|
+
function rc(t) {
|
|
5917
5920
|
switch (t) {
|
|
5918
5921
|
case "bottom-left":
|
|
5919
5922
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -5925,47 +5928,47 @@ function nc(t) {
|
|
|
5925
5928
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
5926
5929
|
}
|
|
5927
5930
|
}
|
|
5928
|
-
function
|
|
5931
|
+
function ic(t) {
|
|
5929
5932
|
const e = document.createElement("div");
|
|
5930
|
-
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" },
|
|
5933
|
+
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";
|
|
5931
5934
|
function n() {
|
|
5932
5935
|
return e.style.display !== "none";
|
|
5933
5936
|
}
|
|
5934
5937
|
return { element: e, isVisible: n };
|
|
5935
5938
|
}
|
|
5936
|
-
const
|
|
5939
|
+
const sc = {
|
|
5937
5940
|
apiURI: "https://api.instantdb.com",
|
|
5938
5941
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5939
5942
|
};
|
|
5940
|
-
function
|
|
5943
|
+
function oc() {
|
|
5941
5944
|
var t;
|
|
5942
5945
|
return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
5943
5946
|
}
|
|
5944
|
-
function
|
|
5947
|
+
function ac() {
|
|
5945
5948
|
var t;
|
|
5946
5949
|
return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
|
|
5947
5950
|
}
|
|
5948
|
-
function
|
|
5951
|
+
function vn(t) {
|
|
5949
5952
|
const e = t.__adminToken;
|
|
5950
5953
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
5951
5954
|
}
|
|
5952
|
-
const
|
|
5953
|
-
class
|
|
5955
|
+
const Sn = ac(), tn = oc();
|
|
5956
|
+
class uc {
|
|
5954
5957
|
constructor(e) {
|
|
5955
5958
|
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);
|
|
5956
5959
|
}
|
|
5957
5960
|
}
|
|
5958
|
-
class
|
|
5961
|
+
class cc {
|
|
5959
5962
|
constructor(e) {
|
|
5960
5963
|
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);
|
|
5961
5964
|
}
|
|
5962
5965
|
}
|
|
5963
|
-
function
|
|
5966
|
+
function dc(t) {
|
|
5964
5967
|
return JSON.parse(JSON.stringify(t));
|
|
5965
5968
|
}
|
|
5966
|
-
class
|
|
5969
|
+
class fc {
|
|
5967
5970
|
constructor(e) {
|
|
5968
|
-
this.tx =
|
|
5971
|
+
this.tx = Bn(), this._reactor = e, this.auth = new uc(this._reactor), this.storage = new cc(this._reactor);
|
|
5969
5972
|
}
|
|
5970
5973
|
/**
|
|
5971
5974
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6106,7 +6109,7 @@ class dc {
|
|
|
6106
6109
|
};
|
|
6107
6110
|
}
|
|
6108
6111
|
shutdown() {
|
|
6109
|
-
delete vn
|
|
6112
|
+
delete Sn[vn(this._reactor.config)], this._reactor.shutdown();
|
|
6110
6113
|
}
|
|
6111
6114
|
/**
|
|
6112
6115
|
* Use this for one-off queries.
|
|
@@ -6139,31 +6142,31 @@ class dc {
|
|
|
6139
6142
|
return this._reactor.subscribeTable(e, n);
|
|
6140
6143
|
}
|
|
6141
6144
|
}
|
|
6142
|
-
function
|
|
6145
|
+
function ti(t) {
|
|
6143
6146
|
if (!t)
|
|
6144
6147
|
return "0";
|
|
6145
|
-
if (
|
|
6146
|
-
return
|
|
6148
|
+
if (tn.get(t))
|
|
6149
|
+
return tn.get(t);
|
|
6147
6150
|
const e = z(t);
|
|
6148
|
-
return
|
|
6151
|
+
return tn.set(t, e), e;
|
|
6149
6152
|
}
|
|
6150
|
-
function
|
|
6151
|
-
return
|
|
6153
|
+
function lc(t, e) {
|
|
6154
|
+
return ti(t._reactor.config.schema) !== ti(e);
|
|
6152
6155
|
}
|
|
6153
|
-
function
|
|
6154
|
-
const s = vn
|
|
6156
|
+
function hc(t, e, n, r, i) {
|
|
6157
|
+
const s = Sn[vn(t)];
|
|
6155
6158
|
if (s)
|
|
6156
|
-
return
|
|
6157
|
-
const o = new
|
|
6158
|
-
return vn
|
|
6159
|
+
return lc(s, t.schema) && s._reactor.updateSchema(t.schema), s;
|
|
6160
|
+
const o = new qu(Object.assign(Object.assign(Object.assign({}, sc), t), { cardinalityInference: !!t.schema }), e || qi, n || Wi, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Qn }), i), a = new fc(o);
|
|
6161
|
+
return Sn[vn(t)] = a, pc(t.appId, t.devtool), a;
|
|
6159
6162
|
}
|
|
6160
|
-
function
|
|
6163
|
+
function pc(t, e) {
|
|
6161
6164
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6162
6165
|
return;
|
|
6163
6166
|
const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
|
|
6164
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6167
|
+
n.allowedHosts.includes(window.location.hostname) && Zu(t, n);
|
|
6165
6168
|
}
|
|
6166
|
-
var
|
|
6169
|
+
var On = { exports: {} }, He = {};
|
|
6167
6170
|
/**
|
|
6168
6171
|
* @license React
|
|
6169
6172
|
* react-jsx-runtime.production.min.js
|
|
@@ -6173,11 +6176,11 @@ var Sn = { exports: {} }, He = {};
|
|
|
6173
6176
|
* This source code is licensed under the MIT license found in the
|
|
6174
6177
|
* LICENSE file in the root directory of this source tree.
|
|
6175
6178
|
*/
|
|
6176
|
-
var
|
|
6177
|
-
function
|
|
6178
|
-
if (
|
|
6179
|
-
|
|
6180
|
-
var t =
|
|
6179
|
+
var ni;
|
|
6180
|
+
function yc() {
|
|
6181
|
+
if (ni) return He;
|
|
6182
|
+
ni = 1;
|
|
6183
|
+
var t = di, 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 };
|
|
6181
6184
|
function o(a, u, d) {
|
|
6182
6185
|
var c, f = {}, l = null, p = null;
|
|
6183
6186
|
d !== void 0 && (l = "" + d), u.key !== void 0 && (l = "" + u.key), u.ref !== void 0 && (p = u.ref);
|
|
@@ -6187,10 +6190,10 @@ function pc() {
|
|
|
6187
6190
|
}
|
|
6188
6191
|
return He.Fragment = n, He.jsx = o, He.jsxs = o, He;
|
|
6189
6192
|
}
|
|
6190
|
-
var Ye = {},
|
|
6191
|
-
function
|
|
6192
|
-
if (
|
|
6193
|
-
|
|
6193
|
+
var Ye = {}, ri;
|
|
6194
|
+
function bc() {
|
|
6195
|
+
if (ri) return Ye;
|
|
6196
|
+
ri = 1;
|
|
6194
6197
|
var t = {};
|
|
6195
6198
|
/**
|
|
6196
6199
|
* @license React
|
|
@@ -6202,7 +6205,7 @@ function yc() {
|
|
|
6202
6205
|
* LICENSE file in the root directory of this source tree.
|
|
6203
6206
|
*/
|
|
6204
6207
|
return t.NODE_ENV !== "production" && function() {
|
|
6205
|
-
var e =
|
|
6208
|
+
var e = di, 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"), d = Symbol.for("react.forward_ref"), c = 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";
|
|
6206
6209
|
function w(h) {
|
|
6207
6210
|
if (h === null || typeof h != "object")
|
|
6208
6211
|
return null;
|
|
@@ -6291,18 +6294,18 @@ function yc() {
|
|
|
6291
6294
|
}
|
|
6292
6295
|
return null;
|
|
6293
6296
|
}
|
|
6294
|
-
var we = Object.assign, Be = 0,
|
|
6295
|
-
function
|
|
6297
|
+
var we = Object.assign, Be = 0, Jn, Zn, Xn, er, tr, nr, rr;
|
|
6298
|
+
function ir() {
|
|
6296
6299
|
}
|
|
6297
|
-
|
|
6298
|
-
function
|
|
6300
|
+
ir.__reactDisabledLog = !0;
|
|
6301
|
+
function ts() {
|
|
6299
6302
|
{
|
|
6300
6303
|
if (Be === 0) {
|
|
6301
|
-
|
|
6304
|
+
Jn = console.log, Zn = console.info, Xn = console.warn, er = console.error, tr = console.group, nr = console.groupCollapsed, rr = console.groupEnd;
|
|
6302
6305
|
var h = {
|
|
6303
6306
|
configurable: !0,
|
|
6304
6307
|
enumerable: !0,
|
|
6305
|
-
value:
|
|
6308
|
+
value: ir,
|
|
6306
6309
|
writable: !0
|
|
6307
6310
|
};
|
|
6308
6311
|
Object.defineProperties(console, {
|
|
@@ -6318,7 +6321,7 @@ function yc() {
|
|
|
6318
6321
|
Be++;
|
|
6319
6322
|
}
|
|
6320
6323
|
}
|
|
6321
|
-
function
|
|
6324
|
+
function ns() {
|
|
6322
6325
|
{
|
|
6323
6326
|
if (Be--, Be === 0) {
|
|
6324
6327
|
var h = {
|
|
@@ -6328,25 +6331,25 @@ function yc() {
|
|
|
6328
6331
|
};
|
|
6329
6332
|
Object.defineProperties(console, {
|
|
6330
6333
|
log: we({}, h, {
|
|
6331
|
-
value:
|
|
6334
|
+
value: Jn
|
|
6332
6335
|
}),
|
|
6333
6336
|
info: we({}, h, {
|
|
6334
|
-
value:
|
|
6337
|
+
value: Zn
|
|
6335
6338
|
}),
|
|
6336
6339
|
warn: we({}, h, {
|
|
6337
|
-
value:
|
|
6340
|
+
value: Xn
|
|
6338
6341
|
}),
|
|
6339
6342
|
error: we({}, h, {
|
|
6340
|
-
value:
|
|
6343
|
+
value: er
|
|
6341
6344
|
}),
|
|
6342
6345
|
group: we({}, h, {
|
|
6343
|
-
value:
|
|
6346
|
+
value: tr
|
|
6344
6347
|
}),
|
|
6345
6348
|
groupCollapsed: we({}, h, {
|
|
6346
|
-
value:
|
|
6349
|
+
value: nr
|
|
6347
6350
|
}),
|
|
6348
6351
|
groupEnd: we({}, h, {
|
|
6349
|
-
value:
|
|
6352
|
+
value: rr
|
|
6350
6353
|
})
|
|
6351
6354
|
});
|
|
6352
6355
|
}
|
|
@@ -6369,10 +6372,10 @@ function yc() {
|
|
|
6369
6372
|
}
|
|
6370
6373
|
var Wt = !1, yt;
|
|
6371
6374
|
{
|
|
6372
|
-
var
|
|
6373
|
-
yt = new
|
|
6375
|
+
var rs = typeof WeakMap == "function" ? WeakMap : Map;
|
|
6376
|
+
yt = new rs();
|
|
6374
6377
|
}
|
|
6375
|
-
function
|
|
6378
|
+
function sr(h, T) {
|
|
6376
6379
|
if (!h || Wt)
|
|
6377
6380
|
return "";
|
|
6378
6381
|
{
|
|
@@ -6385,7 +6388,7 @@ function yc() {
|
|
|
6385
6388
|
var P = Error.prepareStackTrace;
|
|
6386
6389
|
Error.prepareStackTrace = void 0;
|
|
6387
6390
|
var M;
|
|
6388
|
-
M = Kt.current, Kt.current = null,
|
|
6391
|
+
M = Kt.current, Kt.current = null, ts();
|
|
6389
6392
|
try {
|
|
6390
6393
|
if (T) {
|
|
6391
6394
|
var C = function() {
|
|
@@ -6438,15 +6441,15 @@ function yc() {
|
|
|
6438
6441
|
}
|
|
6439
6442
|
}
|
|
6440
6443
|
} finally {
|
|
6441
|
-
Wt = !1, Kt.current = M,
|
|
6444
|
+
Wt = !1, Kt.current = M, ns(), Error.prepareStackTrace = P;
|
|
6442
6445
|
}
|
|
6443
6446
|
var Ie = h ? h.displayName || h.name : "", me = Ie ? pt(Ie) : "";
|
|
6444
6447
|
return typeof h == "function" && yt.set(h, me), me;
|
|
6445
6448
|
}
|
|
6446
|
-
function
|
|
6447
|
-
return
|
|
6449
|
+
function is(h, T, v) {
|
|
6450
|
+
return sr(h, !1);
|
|
6448
6451
|
}
|
|
6449
|
-
function
|
|
6452
|
+
function ss(h) {
|
|
6450
6453
|
var T = h.prototype;
|
|
6451
6454
|
return !!(T && T.isReactComponent);
|
|
6452
6455
|
}
|
|
@@ -6454,7 +6457,7 @@ function yc() {
|
|
|
6454
6457
|
if (h == null)
|
|
6455
6458
|
return "";
|
|
6456
6459
|
if (typeof h == "function")
|
|
6457
|
-
return
|
|
6460
|
+
return sr(h, ss(h));
|
|
6458
6461
|
if (typeof h == "string")
|
|
6459
6462
|
return pt(h);
|
|
6460
6463
|
switch (h) {
|
|
@@ -6466,7 +6469,7 @@ function yc() {
|
|
|
6466
6469
|
if (typeof h == "object")
|
|
6467
6470
|
switch (h.$$typeof) {
|
|
6468
6471
|
case d:
|
|
6469
|
-
return
|
|
6472
|
+
return is(h.render);
|
|
6470
6473
|
case l:
|
|
6471
6474
|
return bt(h.type, T, v);
|
|
6472
6475
|
case p: {
|
|
@@ -6479,15 +6482,15 @@ function yc() {
|
|
|
6479
6482
|
}
|
|
6480
6483
|
return "";
|
|
6481
6484
|
}
|
|
6482
|
-
var Ge = Object.prototype.hasOwnProperty,
|
|
6485
|
+
var Ge = Object.prototype.hasOwnProperty, or = {}, ar = g.ReactDebugCurrentFrame;
|
|
6483
6486
|
function _t(h) {
|
|
6484
6487
|
if (h) {
|
|
6485
6488
|
var T = h._owner, v = bt(h.type, h._source, T ? T.type : null);
|
|
6486
|
-
|
|
6489
|
+
ar.setExtraStackFrame(v);
|
|
6487
6490
|
} else
|
|
6488
|
-
|
|
6491
|
+
ar.setExtraStackFrame(null);
|
|
6489
6492
|
}
|
|
6490
|
-
function
|
|
6493
|
+
function os(h, T, v, O, P) {
|
|
6491
6494
|
{
|
|
6492
6495
|
var M = Function.call.bind(Ge);
|
|
6493
6496
|
for (var C in h)
|
|
@@ -6502,41 +6505,41 @@ function yc() {
|
|
|
6502
6505
|
} catch (D) {
|
|
6503
6506
|
k = D;
|
|
6504
6507
|
}
|
|
6505
|
-
k && !(k instanceof Error) && (_t(P), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", v, C, typeof k), _t(null)), k instanceof Error && !(k.message in
|
|
6508
|
+
k && !(k instanceof Error) && (_t(P), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", v, C, typeof k), _t(null)), k instanceof Error && !(k.message in or) && (or[k.message] = !0, _t(P), m("Failed %s type: %s", v, k.message), _t(null));
|
|
6506
6509
|
}
|
|
6507
6510
|
}
|
|
6508
6511
|
}
|
|
6509
|
-
var
|
|
6512
|
+
var as = Array.isArray;
|
|
6510
6513
|
function zt(h) {
|
|
6511
|
-
return
|
|
6514
|
+
return as(h);
|
|
6512
6515
|
}
|
|
6513
|
-
function
|
|
6516
|
+
function us(h) {
|
|
6514
6517
|
{
|
|
6515
6518
|
var T = typeof Symbol == "function" && Symbol.toStringTag, v = T && h[Symbol.toStringTag] || h.constructor.name || "Object";
|
|
6516
6519
|
return v;
|
|
6517
6520
|
}
|
|
6518
6521
|
}
|
|
6519
|
-
function
|
|
6522
|
+
function cs(h) {
|
|
6520
6523
|
try {
|
|
6521
|
-
return
|
|
6524
|
+
return ur(h), !1;
|
|
6522
6525
|
} catch {
|
|
6523
6526
|
return !0;
|
|
6524
6527
|
}
|
|
6525
6528
|
}
|
|
6526
|
-
function
|
|
6529
|
+
function ur(h) {
|
|
6527
6530
|
return "" + h;
|
|
6528
6531
|
}
|
|
6529
|
-
function
|
|
6530
|
-
if (
|
|
6531
|
-
return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
6532
|
+
function cr(h) {
|
|
6533
|
+
if (cs(h))
|
|
6534
|
+
return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", us(h)), ur(h);
|
|
6532
6535
|
}
|
|
6533
|
-
var
|
|
6536
|
+
var dr = g.ReactCurrentOwner, ds = {
|
|
6534
6537
|
key: !0,
|
|
6535
6538
|
ref: !0,
|
|
6536
6539
|
__self: !0,
|
|
6537
6540
|
__source: !0
|
|
6538
|
-
},
|
|
6539
|
-
function
|
|
6541
|
+
}, fr, lr;
|
|
6542
|
+
function fs(h) {
|
|
6540
6543
|
if (Ge.call(h, "ref")) {
|
|
6541
6544
|
var T = Object.getOwnPropertyDescriptor(h, "ref").get;
|
|
6542
6545
|
if (T && T.isReactWarning)
|
|
@@ -6544,7 +6547,7 @@ function yc() {
|
|
|
6544
6547
|
}
|
|
6545
6548
|
return h.ref !== void 0;
|
|
6546
6549
|
}
|
|
6547
|
-
function
|
|
6550
|
+
function ls(h) {
|
|
6548
6551
|
if (Ge.call(h, "key")) {
|
|
6549
6552
|
var T = Object.getOwnPropertyDescriptor(h, "key").get;
|
|
6550
6553
|
if (T && T.isReactWarning)
|
|
@@ -6552,13 +6555,13 @@ function yc() {
|
|
|
6552
6555
|
}
|
|
6553
6556
|
return h.key !== void 0;
|
|
6554
6557
|
}
|
|
6555
|
-
function ls(h, T) {
|
|
6556
|
-
typeof h.ref == "string" && cr.current;
|
|
6557
|
-
}
|
|
6558
6558
|
function hs(h, T) {
|
|
6559
|
+
typeof h.ref == "string" && dr.current;
|
|
6560
|
+
}
|
|
6561
|
+
function ps(h, T) {
|
|
6559
6562
|
{
|
|
6560
6563
|
var v = function() {
|
|
6561
|
-
|
|
6564
|
+
fr || (fr = !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));
|
|
6562
6565
|
};
|
|
6563
6566
|
v.isReactWarning = !0, Object.defineProperty(h, "key", {
|
|
6564
6567
|
get: v,
|
|
@@ -6566,10 +6569,10 @@ function yc() {
|
|
|
6566
6569
|
});
|
|
6567
6570
|
}
|
|
6568
6571
|
}
|
|
6569
|
-
function
|
|
6572
|
+
function ys(h, T) {
|
|
6570
6573
|
{
|
|
6571
6574
|
var v = function() {
|
|
6572
|
-
|
|
6575
|
+
lr || (lr = !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));
|
|
6573
6576
|
};
|
|
6574
6577
|
v.isReactWarning = !0, Object.defineProperty(h, "ref", {
|
|
6575
6578
|
get: v,
|
|
@@ -6577,7 +6580,7 @@ function yc() {
|
|
|
6577
6580
|
});
|
|
6578
6581
|
}
|
|
6579
6582
|
}
|
|
6580
|
-
var
|
|
6583
|
+
var bs = function(h, T, v, O, P, M, C) {
|
|
6581
6584
|
var k = {
|
|
6582
6585
|
// This tag allows us to uniquely identify this as a React Element
|
|
6583
6586
|
$$typeof: n,
|
|
@@ -6606,12 +6609,12 @@ function yc() {
|
|
|
6606
6609
|
value: P
|
|
6607
6610
|
}), Object.freeze && (Object.freeze(k.props), Object.freeze(k)), k;
|
|
6608
6611
|
};
|
|
6609
|
-
function
|
|
6612
|
+
function _s(h, T, v, O, P) {
|
|
6610
6613
|
{
|
|
6611
6614
|
var M, C = {}, k = null, G = null;
|
|
6612
|
-
v !== void 0 && (
|
|
6615
|
+
v !== void 0 && (cr(v), k = "" + v), ls(T) && (cr(T.key), k = "" + T.key), fs(T) && (G = T.ref, hs(T, P));
|
|
6613
6616
|
for (M in T)
|
|
6614
|
-
Ge.call(T, M) && !
|
|
6617
|
+
Ge.call(T, M) && !ds.hasOwnProperty(M) && (C[M] = T[M]);
|
|
6615
6618
|
if (h && h.defaultProps) {
|
|
6616
6619
|
var D = h.defaultProps;
|
|
6617
6620
|
for (M in D)
|
|
@@ -6619,25 +6622,25 @@ function yc() {
|
|
|
6619
6622
|
}
|
|
6620
6623
|
if (k || G) {
|
|
6621
6624
|
var L = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
6622
|
-
k &&
|
|
6625
|
+
k && ps(C, L), G && ys(C, L);
|
|
6623
6626
|
}
|
|
6624
|
-
return
|
|
6627
|
+
return bs(h, k, G, P, O, dr.current, C);
|
|
6625
6628
|
}
|
|
6626
6629
|
}
|
|
6627
|
-
var Vt = g.ReactCurrentOwner,
|
|
6630
|
+
var Vt = g.ReactCurrentOwner, hr = g.ReactDebugCurrentFrame;
|
|
6628
6631
|
function Pe(h) {
|
|
6629
6632
|
if (h) {
|
|
6630
6633
|
var T = h._owner, v = bt(h.type, h._source, T ? T.type : null);
|
|
6631
|
-
|
|
6634
|
+
hr.setExtraStackFrame(v);
|
|
6632
6635
|
} else
|
|
6633
|
-
|
|
6636
|
+
hr.setExtraStackFrame(null);
|
|
6634
6637
|
}
|
|
6635
6638
|
var Bt;
|
|
6636
6639
|
Bt = !1;
|
|
6637
6640
|
function Gt(h) {
|
|
6638
6641
|
return typeof h == "object" && h !== null && h.$$typeof === n;
|
|
6639
6642
|
}
|
|
6640
|
-
function
|
|
6643
|
+
function pr() {
|
|
6641
6644
|
{
|
|
6642
6645
|
if (Vt.current) {
|
|
6643
6646
|
var h = ce(Vt.current.type);
|
|
@@ -6649,13 +6652,13 @@ Check the render method of \`` + h + "`.";
|
|
|
6649
6652
|
return "";
|
|
6650
6653
|
}
|
|
6651
6654
|
}
|
|
6652
|
-
function
|
|
6655
|
+
function gs(h) {
|
|
6653
6656
|
return "";
|
|
6654
6657
|
}
|
|
6655
|
-
var
|
|
6656
|
-
function
|
|
6658
|
+
var yr = {};
|
|
6659
|
+
function Ts(h) {
|
|
6657
6660
|
{
|
|
6658
|
-
var T =
|
|
6661
|
+
var T = pr();
|
|
6659
6662
|
if (!T) {
|
|
6660
6663
|
var v = typeof h == "string" ? h : h.displayName || h.name;
|
|
6661
6664
|
v && (T = `
|
|
@@ -6665,27 +6668,27 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6665
6668
|
return T;
|
|
6666
6669
|
}
|
|
6667
6670
|
}
|
|
6668
|
-
function
|
|
6671
|
+
function br(h, T) {
|
|
6669
6672
|
{
|
|
6670
6673
|
if (!h._store || h._store.validated || h.key != null)
|
|
6671
6674
|
return;
|
|
6672
6675
|
h._store.validated = !0;
|
|
6673
|
-
var v =
|
|
6674
|
-
if (
|
|
6676
|
+
var v = Ts(T);
|
|
6677
|
+
if (yr[v])
|
|
6675
6678
|
return;
|
|
6676
|
-
|
|
6679
|
+
yr[v] = !0;
|
|
6677
6680
|
var O = "";
|
|
6678
6681
|
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);
|
|
6679
6682
|
}
|
|
6680
6683
|
}
|
|
6681
|
-
function
|
|
6684
|
+
function _r(h, T) {
|
|
6682
6685
|
{
|
|
6683
6686
|
if (typeof h != "object")
|
|
6684
6687
|
return;
|
|
6685
6688
|
if (zt(h))
|
|
6686
6689
|
for (var v = 0; v < h.length; v++) {
|
|
6687
6690
|
var O = h[v];
|
|
6688
|
-
Gt(O) &&
|
|
6691
|
+
Gt(O) && br(O, T);
|
|
6689
6692
|
}
|
|
6690
6693
|
else if (Gt(h))
|
|
6691
6694
|
h._store && (h._store.validated = !0);
|
|
@@ -6693,11 +6696,11 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6693
6696
|
var P = w(h);
|
|
6694
6697
|
if (typeof P == "function" && P !== h.entries)
|
|
6695
6698
|
for (var M = P.call(h), C; !(C = M.next()).done; )
|
|
6696
|
-
Gt(C.value) &&
|
|
6699
|
+
Gt(C.value) && br(C.value, T);
|
|
6697
6700
|
}
|
|
6698
6701
|
}
|
|
6699
6702
|
}
|
|
6700
|
-
function
|
|
6703
|
+
function ws(h) {
|
|
6701
6704
|
{
|
|
6702
6705
|
var T = h.type;
|
|
6703
6706
|
if (T == null || typeof T == "string")
|
|
@@ -6713,7 +6716,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6713
6716
|
return;
|
|
6714
6717
|
if (v) {
|
|
6715
6718
|
var O = ce(T);
|
|
6716
|
-
|
|
6719
|
+
os(v, h.props, "prop", O, h);
|
|
6717
6720
|
} else if (T.PropTypes !== void 0 && !Bt) {
|
|
6718
6721
|
Bt = !0;
|
|
6719
6722
|
var P = ce(T);
|
|
@@ -6722,7 +6725,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6722
6725
|
typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
6723
6726
|
}
|
|
6724
6727
|
}
|
|
6725
|
-
function
|
|
6728
|
+
function ms(h) {
|
|
6726
6729
|
{
|
|
6727
6730
|
for (var T = Object.keys(h.props), v = 0; v < T.length; v++) {
|
|
6728
6731
|
var O = T[v];
|
|
@@ -6734,19 +6737,19 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6734
6737
|
h.ref !== null && (Pe(h), m("Invalid attribute `ref` supplied to `React.Fragment`."), Pe(null));
|
|
6735
6738
|
}
|
|
6736
6739
|
}
|
|
6737
|
-
var
|
|
6738
|
-
function
|
|
6740
|
+
var gr = {};
|
|
6741
|
+
function Tr(h, T, v, O, P, M) {
|
|
6739
6742
|
{
|
|
6740
6743
|
var C = Ft(h);
|
|
6741
6744
|
if (!C) {
|
|
6742
6745
|
var k = "";
|
|
6743
6746
|
(h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (k += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
6744
|
-
var G =
|
|
6745
|
-
G ? k += G : k +=
|
|
6747
|
+
var G = gs();
|
|
6748
|
+
G ? k += G : k += pr();
|
|
6746
6749
|
var D;
|
|
6747
6750
|
h === null ? D = "null" : zt(h) ? D = "array" : h !== void 0 && h.$$typeof === n ? (D = "<" + (ce(h.type) || "Unknown") + " />", k = " 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, k);
|
|
6748
6751
|
}
|
|
6749
|
-
var L =
|
|
6752
|
+
var L = _s(h, T, v, P, M);
|
|
6750
6753
|
if (L == null)
|
|
6751
6754
|
return L;
|
|
6752
6755
|
if (C) {
|
|
@@ -6755,65 +6758,65 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6755
6758
|
if (O)
|
|
6756
6759
|
if (zt(re)) {
|
|
6757
6760
|
for (var Ie = 0; Ie < re.length; Ie++)
|
|
6758
|
-
|
|
6761
|
+
_r(re[Ie], h);
|
|
6759
6762
|
Object.freeze && Object.freeze(re);
|
|
6760
6763
|
} else
|
|
6761
6764
|
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.");
|
|
6762
6765
|
else
|
|
6763
|
-
|
|
6766
|
+
_r(re, h);
|
|
6764
6767
|
}
|
|
6765
6768
|
if (Ge.call(T, "key")) {
|
|
6766
|
-
var me = ce(h), Y = Object.keys(T).filter(function(
|
|
6767
|
-
return
|
|
6769
|
+
var me = ce(h), Y = Object.keys(T).filter(function(ks) {
|
|
6770
|
+
return ks !== "key";
|
|
6768
6771
|
}), Qt = Y.length > 0 ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
6769
|
-
if (!
|
|
6770
|
-
var
|
|
6772
|
+
if (!gr[me + Qt]) {
|
|
6773
|
+
var As = Y.length > 0 ? "{" + Y.join(": ..., ") + ": ...}" : "{}";
|
|
6771
6774
|
m(`A props object containing a "key" prop is being spread into JSX:
|
|
6772
6775
|
let props = %s;
|
|
6773
6776
|
<%s {...props} />
|
|
6774
6777
|
React keys must be passed directly to JSX without using spread:
|
|
6775
6778
|
let props = %s;
|
|
6776
|
-
<%s key={someKey} {...props} />`, Qt, me,
|
|
6779
|
+
<%s key={someKey} {...props} />`, Qt, me, As, me), gr[me + Qt] = !0;
|
|
6777
6780
|
}
|
|
6778
6781
|
}
|
|
6779
|
-
return h === i ?
|
|
6782
|
+
return h === i ? ms(L) : ws(L), L;
|
|
6780
6783
|
}
|
|
6781
6784
|
}
|
|
6782
|
-
function ms(h, T, v) {
|
|
6783
|
-
return gr(h, T, v, !0);
|
|
6784
|
-
}
|
|
6785
6785
|
function vs(h, T, v) {
|
|
6786
|
-
return
|
|
6786
|
+
return Tr(h, T, v, !0);
|
|
6787
|
+
}
|
|
6788
|
+
function Ss(h, T, v) {
|
|
6789
|
+
return Tr(h, T, v, !1);
|
|
6787
6790
|
}
|
|
6788
|
-
var
|
|
6789
|
-
Ye.Fragment = i, Ye.jsx =
|
|
6791
|
+
var Os = Ss, Es = vs;
|
|
6792
|
+
Ye.Fragment = i, Ye.jsx = Os, Ye.jsxs = Es;
|
|
6790
6793
|
}(), Ye;
|
|
6791
6794
|
}
|
|
6792
|
-
var
|
|
6793
|
-
|
|
6794
|
-
var W =
|
|
6795
|
-
const
|
|
6795
|
+
var _c = {};
|
|
6796
|
+
_c.NODE_ENV === "production" ? On.exports = yc() : On.exports = bc();
|
|
6797
|
+
var W = On.exports;
|
|
6798
|
+
const gc = {
|
|
6796
6799
|
isLoading: !0,
|
|
6797
6800
|
data: void 0,
|
|
6798
6801
|
pageInfo: void 0,
|
|
6799
6802
|
error: void 0
|
|
6800
6803
|
};
|
|
6801
|
-
function
|
|
6804
|
+
function ii(t) {
|
|
6802
6805
|
return Object.assign({ isLoading: !t, data: void 0, pageInfo: void 0, error: void 0 }, t || {});
|
|
6803
6806
|
}
|
|
6804
|
-
function
|
|
6807
|
+
function Tc(t, e, n) {
|
|
6805
6808
|
e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
6806
|
-
const r = e ?
|
|
6807
|
-
(u) => (s.current =
|
|
6809
|
+
const r = e ? dc(e) : null, i = z(r), s = at(ii(t._reactor.getPreviousResult(r))), o = ge(
|
|
6810
|
+
(u) => (s.current = ii(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (c) => {
|
|
6808
6811
|
s.current = Object.assign({ isLoading: !c, data: void 0, pageInfo: void 0, error: void 0 }, c), u();
|
|
6809
6812
|
}) : () => {
|
|
6810
6813
|
}),
|
|
6811
6814
|
// Build a new subscribe function if the query changes
|
|
6812
6815
|
[i]
|
|
6813
6816
|
);
|
|
6814
|
-
return { state:
|
|
6817
|
+
return { state: rn(o, () => s.current, () => gc), query: r };
|
|
6815
6818
|
}
|
|
6816
|
-
function
|
|
6819
|
+
function wc() {
|
|
6817
6820
|
const t = at(null);
|
|
6818
6821
|
ke(() => {
|
|
6819
6822
|
n();
|
|
@@ -6826,14 +6829,14 @@ function Tc() {
|
|
|
6826
6829
|
}
|
|
6827
6830
|
return { set: e, clear: n };
|
|
6828
6831
|
}
|
|
6829
|
-
const
|
|
6830
|
-
function
|
|
6832
|
+
const mc = 1e3;
|
|
6833
|
+
function vc(t, e, n) {
|
|
6831
6834
|
const r = at(n);
|
|
6832
6835
|
r.current = n, ke(() => t.core._reactor.subscribeTopic(t.id, e, (s, o) => {
|
|
6833
6836
|
r.current(s, o);
|
|
6834
6837
|
}), [t.id, e]);
|
|
6835
6838
|
}
|
|
6836
|
-
function
|
|
6839
|
+
function Sc(t, e) {
|
|
6837
6840
|
return ke(() => t.core._reactor.joinRoom(t.id), [t.id]), ge((r) => {
|
|
6838
6841
|
t.core._reactor.publishTopic({
|
|
6839
6842
|
roomType: t.type,
|
|
@@ -6843,9 +6846,9 @@ function vc(t, e) {
|
|
|
6843
6846
|
});
|
|
6844
6847
|
}, [t.id, e]);
|
|
6845
6848
|
}
|
|
6846
|
-
function
|
|
6849
|
+
function Oc(t, e = {}) {
|
|
6847
6850
|
var n, r;
|
|
6848
|
-
const [i, s] =
|
|
6851
|
+
const [i, s] = fi(() => {
|
|
6849
6852
|
var u;
|
|
6850
6853
|
return (u = t.core._reactor.getPresence(t.type, t.id, e)) !== null && u !== void 0 ? u : {
|
|
6851
6854
|
peers: {},
|
|
@@ -6858,15 +6861,15 @@ function Sc(t, e = {}) {
|
|
|
6858
6861
|
const o = ge((u) => {
|
|
6859
6862
|
t.core._reactor.publishPresence(t.type, t.id, u);
|
|
6860
6863
|
}, [t.type, t.id]);
|
|
6861
|
-
return
|
|
6864
|
+
return sn(() => Object.assign(Object.assign({}, i), { publishPresence: o }), [i, o]);
|
|
6862
6865
|
}
|
|
6863
|
-
function
|
|
6866
|
+
function Ec(t, e, n) {
|
|
6864
6867
|
ke(() => t.core._reactor.joinRoom(t.id, e), [t.id]), ke(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
|
|
6865
6868
|
}
|
|
6866
|
-
function
|
|
6867
|
-
const r =
|
|
6869
|
+
function Ac(t, e, n = {}) {
|
|
6870
|
+
const r = wc(), i = Se.usePresence(t, {
|
|
6868
6871
|
keys: [e]
|
|
6869
|
-
}), s =
|
|
6872
|
+
}), s = sn(() => {
|
|
6870
6873
|
var c;
|
|
6871
6874
|
const f = t._core._reactor.getPresence(t.type, t.id);
|
|
6872
6875
|
return n != null && n.writeOnly ? [] : Object.values((c = f == null ? void 0 : f.peers) !== null && c !== void 0 ? c : {}).filter((l) => l[e] === !0);
|
|
@@ -6874,7 +6877,7 @@ function Ec(t, e, n = {}) {
|
|
|
6874
6877
|
var f;
|
|
6875
6878
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6876
6879
|
[e]: c
|
|
6877
|
-
}), c && ((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 :
|
|
6880
|
+
}), c && ((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, () => {
|
|
6878
6881
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6879
6882
|
[e]: null
|
|
6880
6883
|
});
|
|
@@ -6884,7 +6887,7 @@ function Ec(t, e, n = {}) {
|
|
|
6884
6887
|
o(l);
|
|
6885
6888
|
}, [n.stopOnEnter, o]), u = ge(() => {
|
|
6886
6889
|
o(!1);
|
|
6887
|
-
}, [o]), d =
|
|
6890
|
+
}, [o]), d = sn(() => ({ onKeyDown: a, onBlur: u }), [a, u]);
|
|
6888
6891
|
return {
|
|
6889
6892
|
active: s,
|
|
6890
6893
|
setActive: o,
|
|
@@ -6892,20 +6895,20 @@ function Ec(t, e, n = {}) {
|
|
|
6892
6895
|
};
|
|
6893
6896
|
}
|
|
6894
6897
|
const Se = {
|
|
6895
|
-
useTopicEffect:
|
|
6896
|
-
usePublishTopic:
|
|
6897
|
-
usePresence:
|
|
6898
|
-
useSyncPresence:
|
|
6899
|
-
useTypingIndicator:
|
|
6898
|
+
useTopicEffect: vc,
|
|
6899
|
+
usePublishTopic: Sc,
|
|
6900
|
+
usePresence: Oc,
|
|
6901
|
+
useSyncPresence: Ec,
|
|
6902
|
+
useTypingIndicator: Ac
|
|
6900
6903
|
};
|
|
6901
|
-
class
|
|
6904
|
+
class kc {
|
|
6902
6905
|
constructor(e, n, r) {
|
|
6903
6906
|
this.useTopicEffect = (i, s) => {
|
|
6904
6907
|
Se.useTopicEffect(this, i, s);
|
|
6905
6908
|
}, 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;
|
|
6906
6909
|
}
|
|
6907
6910
|
}
|
|
6908
|
-
var
|
|
6911
|
+
var jc = function(t, e, n, r) {
|
|
6909
6912
|
function i(s) {
|
|
6910
6913
|
return s instanceof n ? s : new n(function(o) {
|
|
6911
6914
|
o(s);
|
|
@@ -6932,26 +6935,26 @@ var kc = function(t, e, n, r) {
|
|
|
6932
6935
|
d((r = r.apply(t, e || [])).next());
|
|
6933
6936
|
});
|
|
6934
6937
|
};
|
|
6935
|
-
const
|
|
6938
|
+
const Cc = {
|
|
6936
6939
|
isLoading: !0,
|
|
6937
6940
|
user: void 0,
|
|
6938
6941
|
error: void 0
|
|
6939
6942
|
};
|
|
6940
|
-
class
|
|
6943
|
+
class Pc {
|
|
6941
6944
|
constructor(e, n) {
|
|
6942
|
-
this.tx =
|
|
6943
|
-
const [i, s] =
|
|
6945
|
+
this.tx = Bn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
6946
|
+
const [i, s] = fi(null);
|
|
6944
6947
|
return ke(() => {
|
|
6945
|
-
|
|
6948
|
+
jc(this, void 0, void 0, function* () {
|
|
6946
6949
|
const a = yield this.getLocalId(r);
|
|
6947
6950
|
s(a);
|
|
6948
6951
|
});
|
|
6949
6952
|
}, [r]), i;
|
|
6950
|
-
}, this.rooms = Se, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) =>
|
|
6953
|
+
}, this.rooms = Se, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => Tc(this.core, r, i).state, this.useAuth = () => {
|
|
6951
6954
|
const r = at(this.core._reactor._currentUserCached), i = ge((o) => this.core.subscribeAuth((u) => {
|
|
6952
6955
|
r.current = Object.assign({ isLoading: !1 }, u), o();
|
|
6953
6956
|
}), []);
|
|
6954
|
-
return
|
|
6957
|
+
return rn(i, () => r.current, () => Cc);
|
|
6955
6958
|
}, this.useUser = () => {
|
|
6956
6959
|
const { user: r } = this.useAuth();
|
|
6957
6960
|
if (!r)
|
|
@@ -6961,7 +6964,7 @@ class Cc {
|
|
|
6961
6964
|
const r = at(this.core._reactor.status), i = ge((o) => this.core.subscribeConnectionStatus((u) => {
|
|
6962
6965
|
u !== r.current && (r.current = u, o());
|
|
6963
6966
|
}), []);
|
|
6964
|
-
return
|
|
6967
|
+
return rn(
|
|
6965
6968
|
i,
|
|
6966
6969
|
() => r.current,
|
|
6967
6970
|
// For SSR, always return 'connecting' as the initial state
|
|
@@ -6973,7 +6976,7 @@ class Cc {
|
|
|
6973
6976
|
}, this.SignedOut = ({ children: r }) => {
|
|
6974
6977
|
const i = this.useAuth();
|
|
6975
6978
|
return i.isLoading || i.error || i.user ? null : W.jsx(W.Fragment, { children: r });
|
|
6976
|
-
}, this.core =
|
|
6979
|
+
}, this.core = hc(
|
|
6977
6980
|
e,
|
|
6978
6981
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
6979
6982
|
this.constructor.Storage,
|
|
@@ -6997,7 +7000,7 @@ class Cc {
|
|
|
6997
7000
|
* const { peers } = db.rooms.usePresence(room);
|
|
6998
7001
|
*/
|
|
6999
7002
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
7000
|
-
return new
|
|
7003
|
+
return new kc(this.core, e, n);
|
|
7001
7004
|
}
|
|
7002
7005
|
/**
|
|
7003
7006
|
* One time query for the logged in state. This is useful
|
|
@@ -7013,22 +7016,22 @@ class Cc {
|
|
|
7013
7016
|
return this.core.getAuth();
|
|
7014
7017
|
}
|
|
7015
7018
|
}
|
|
7016
|
-
class
|
|
7019
|
+
class si extends Error {
|
|
7017
7020
|
constructor(e, n) {
|
|
7018
7021
|
super(e), this.name = "ParseError", this.type = n.type, this.field = n.field, this.value = n.value, this.line = n.line;
|
|
7019
7022
|
}
|
|
7020
7023
|
}
|
|
7021
|
-
function
|
|
7024
|
+
function nn(t) {
|
|
7022
7025
|
}
|
|
7023
|
-
function
|
|
7026
|
+
function Ic(t) {
|
|
7024
7027
|
if (typeof t == "function")
|
|
7025
7028
|
throw new TypeError(
|
|
7026
7029
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
7027
7030
|
);
|
|
7028
|
-
const { onEvent: e =
|
|
7031
|
+
const { onEvent: e = nn, onError: n = nn, onRetry: r = nn, onComment: i } = t;
|
|
7029
7032
|
let s = "", o = !0, a, u = "", d = "";
|
|
7030
7033
|
function c(b) {
|
|
7031
|
-
const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, g] =
|
|
7034
|
+
const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, g] = Mc(`${s}${_}`);
|
|
7032
7035
|
for (const m of w)
|
|
7033
7036
|
f(m);
|
|
7034
7037
|
s = g, o = !1;
|
|
@@ -7064,7 +7067,7 @@ function Pc(t) {
|
|
|
7064
7067
|
break;
|
|
7065
7068
|
case "retry":
|
|
7066
7069
|
/^\d+$/.test(_) ? r(parseInt(_, 10)) : n(
|
|
7067
|
-
new
|
|
7070
|
+
new si(`Invalid \`retry\` value: "${_}"`, {
|
|
7068
7071
|
type: "invalid-retry",
|
|
7069
7072
|
value: _,
|
|
7070
7073
|
line: w
|
|
@@ -7073,7 +7076,7 @@ function Pc(t) {
|
|
|
7073
7076
|
break;
|
|
7074
7077
|
default:
|
|
7075
7078
|
n(
|
|
7076
|
-
new
|
|
7079
|
+
new si(
|
|
7077
7080
|
`Unknown field "${b.length > 20 ? `${b.slice(0, 20)}…` : b}"`,
|
|
7078
7081
|
{ type: "unknown-field", field: b, value: _, line: w }
|
|
7079
7082
|
)
|
|
@@ -7096,7 +7099,7 @@ function Pc(t) {
|
|
|
7096
7099
|
}
|
|
7097
7100
|
return { feed: c, reset: y };
|
|
7098
7101
|
}
|
|
7099
|
-
function
|
|
7102
|
+
function Mc(t) {
|
|
7100
7103
|
const e = [];
|
|
7101
7104
|
let n = "", r = 0;
|
|
7102
7105
|
for (; r < t.length; ) {
|
|
@@ -7114,7 +7117,7 @@ function Ic(t) {
|
|
|
7114
7117
|
}
|
|
7115
7118
|
return [e, n];
|
|
7116
7119
|
}
|
|
7117
|
-
class
|
|
7120
|
+
class oi extends Event {
|
|
7118
7121
|
/**
|
|
7119
7122
|
* Constructs a new `ErrorEvent` instance. This is typically not called directly,
|
|
7120
7123
|
* but rather emitted by the `EventSource` object when an error occurs.
|
|
@@ -7139,7 +7142,7 @@ class si extends Event {
|
|
|
7139
7142
|
* @returns A string representation of the error
|
|
7140
7143
|
*/
|
|
7141
7144
|
[Symbol.for("nodejs.util.inspect.custom")](e, n, r) {
|
|
7142
|
-
return r(
|
|
7145
|
+
return r(ai(this), n);
|
|
7143
7146
|
}
|
|
7144
7147
|
/**
|
|
7145
7148
|
* Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
@@ -7153,17 +7156,17 @@ class si extends Event {
|
|
|
7153
7156
|
* @returns A string representation of the error
|
|
7154
7157
|
*/
|
|
7155
7158
|
[Symbol.for("Deno.customInspect")](e, n) {
|
|
7156
|
-
return e(
|
|
7159
|
+
return e(ai(this), n);
|
|
7157
7160
|
}
|
|
7158
7161
|
}
|
|
7159
|
-
function
|
|
7162
|
+
function Rc(t) {
|
|
7160
7163
|
const e = globalThis.DOMException;
|
|
7161
7164
|
return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
|
|
7162
7165
|
}
|
|
7163
|
-
function
|
|
7164
|
-
return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(
|
|
7166
|
+
function En(t) {
|
|
7167
|
+
return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(En).join(", ") : "cause" in t && t.cause instanceof Error ? `${t}: ${En(t.cause)}` : t.message : `${t}`;
|
|
7165
7168
|
}
|
|
7166
|
-
function
|
|
7169
|
+
function ai(t) {
|
|
7167
7170
|
return {
|
|
7168
7171
|
type: t.type,
|
|
7169
7172
|
message: t.message,
|
|
@@ -7173,13 +7176,13 @@ function oi(t) {
|
|
|
7173
7176
|
timeStamp: t.timeStamp
|
|
7174
7177
|
};
|
|
7175
7178
|
}
|
|
7176
|
-
var
|
|
7179
|
+
var es = (t) => {
|
|
7177
7180
|
throw TypeError(t);
|
|
7178
|
-
},
|
|
7181
|
+
}, Hn = (t, e, n) => e.has(t) || es("Cannot " + n), A = (t, e, n) => (Hn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), N = (t, e, n) => e.has(t) ? es("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Hn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (Hn(t, e, "access private method"), n), J, Oe, Re, At, Rt, st, De, ot, _e, xe, Le, $e, et, se, An, kn, jn, ui, Cn, Pn, tt, In, Mn;
|
|
7179
7182
|
class kt extends EventTarget {
|
|
7180
7183
|
constructor(e, n) {
|
|
7181
7184
|
var r, i;
|
|
7182
|
-
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,
|
|
7185
|
+
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, kn, async (s) => {
|
|
7183
7186
|
var o;
|
|
7184
7187
|
A(this, xe).reset();
|
|
7185
7188
|
const { body: a, redirected: u, status: d, headers: c } = s;
|
|
@@ -7207,11 +7210,11 @@ class kt extends EventTarget {
|
|
|
7207
7210
|
let y = !0;
|
|
7208
7211
|
do {
|
|
7209
7212
|
const { done: b, value: _ } = await p.read();
|
|
7210
|
-
_ && A(this, xe).feed(l.decode(_, { stream: !b })), b && (y = !1, A(this, xe).reset(), he(this, se,
|
|
7213
|
+
_ && A(this, xe).feed(l.decode(_, { stream: !b })), b && (y = !1, A(this, xe).reset(), he(this, se, In).call(this));
|
|
7211
7214
|
} while (y);
|
|
7212
|
-
}), N(this, kn, (s) => {
|
|
7213
|
-
$(this, _e, void 0), !(s.name === "AbortError" || s.type === "aborted") && he(this, se, Pn).call(this, On(s));
|
|
7214
7215
|
}), N(this, jn, (s) => {
|
|
7216
|
+
$(this, _e, void 0), !(s.name === "AbortError" || s.type === "aborted") && he(this, se, In).call(this, En(s));
|
|
7217
|
+
}), N(this, Cn, (s) => {
|
|
7215
7218
|
typeof s.id == "string" && $(this, ot, s.id);
|
|
7216
7219
|
const o = new MessageEvent(s.event || "message", {
|
|
7217
7220
|
data: s.data,
|
|
@@ -7219,25 +7222,25 @@ class kt extends EventTarget {
|
|
|
7219
7222
|
lastEventId: s.id || ""
|
|
7220
7223
|
});
|
|
7221
7224
|
A(this, $e) && (!s.event || s.event === "message") && A(this, $e).call(this, o), this.dispatchEvent(o);
|
|
7222
|
-
}), N(this,
|
|
7225
|
+
}), N(this, Pn, (s) => {
|
|
7223
7226
|
$(this, st, s);
|
|
7224
|
-
}), N(this,
|
|
7225
|
-
$(this, De, void 0), A(this, J) === this.CONNECTING && he(this, se,
|
|
7227
|
+
}), N(this, Mn, () => {
|
|
7228
|
+
$(this, De, void 0), A(this, J) === this.CONNECTING && he(this, se, An).call(this);
|
|
7226
7229
|
});
|
|
7227
7230
|
try {
|
|
7228
7231
|
if (e instanceof URL)
|
|
7229
7232
|
$(this, Oe, e);
|
|
7230
7233
|
else if (typeof e == "string")
|
|
7231
|
-
$(this, Oe, new URL(e,
|
|
7234
|
+
$(this, Oe, new URL(e, xc()));
|
|
7232
7235
|
else
|
|
7233
7236
|
throw new Error("Invalid URL");
|
|
7234
7237
|
} catch {
|
|
7235
|
-
throw
|
|
7238
|
+
throw Rc("An invalid or illegal string was specified");
|
|
7236
7239
|
}
|
|
7237
|
-
$(this, xe,
|
|
7238
|
-
onEvent: A(this,
|
|
7239
|
-
onRetry: A(this,
|
|
7240
|
-
})), $(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,
|
|
7240
|
+
$(this, xe, Ic({
|
|
7241
|
+
onEvent: A(this, Cn),
|
|
7242
|
+
onRetry: A(this, Pn)
|
|
7243
|
+
})), $(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, An).call(this);
|
|
7241
7244
|
}
|
|
7242
7245
|
/**
|
|
7243
7246
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -7315,15 +7318,15 @@ J = /* @__PURE__ */ new WeakMap(), Oe = /* @__PURE__ */ new WeakMap(), Re = /* @
|
|
|
7315
7318
|
*
|
|
7316
7319
|
* @internal
|
|
7317
7320
|
*/
|
|
7318
|
-
|
|
7319
|
-
$(this, J, this.CONNECTING), $(this, _e, new AbortController()), A(this, Rt)(A(this, Oe), he(this, se,
|
|
7320
|
-
},
|
|
7321
|
+
An = function() {
|
|
7322
|
+
$(this, J, this.CONNECTING), $(this, _e, new AbortController()), A(this, Rt)(A(this, Oe), he(this, se, ui).call(this)).then(A(this, kn)).catch(A(this, jn));
|
|
7323
|
+
}, kn = /* @__PURE__ */ new WeakMap(), jn = /* @__PURE__ */ new WeakMap(), /**
|
|
7321
7324
|
* Get request options for the `fetch()` request
|
|
7322
7325
|
*
|
|
7323
7326
|
* @returns The request options
|
|
7324
7327
|
* @internal
|
|
7325
7328
|
*/
|
|
7326
|
-
|
|
7329
|
+
ui = function() {
|
|
7327
7330
|
var t;
|
|
7328
7331
|
const e = {
|
|
7329
7332
|
// [spec] Let `corsAttributeState` be `Anonymous`…
|
|
@@ -7335,7 +7338,7 @@ ai = function() {
|
|
|
7335
7338
|
signal: (t = A(this, _e)) == null ? void 0 : t.signal
|
|
7336
7339
|
};
|
|
7337
7340
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
7338
|
-
},
|
|
7341
|
+
}, Cn = /* @__PURE__ */ new WeakMap(), Pn = /* @__PURE__ */ new WeakMap(), /**
|
|
7339
7342
|
* Handles the process referred to in the EventSource specification as "failing a connection".
|
|
7340
7343
|
*
|
|
7341
7344
|
* @param error - The error causing the connection to fail
|
|
@@ -7345,7 +7348,7 @@ ai = function() {
|
|
|
7345
7348
|
tt = function(t, e) {
|
|
7346
7349
|
var n;
|
|
7347
7350
|
A(this, J) !== this.CLOSED && $(this, J, this.CLOSED);
|
|
7348
|
-
const r = new
|
|
7351
|
+
const r = new oi("error", { code: e, message: t });
|
|
7349
7352
|
(n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r);
|
|
7350
7353
|
}, /**
|
|
7351
7354
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
@@ -7354,14 +7357,14 @@ tt = function(t, e) {
|
|
|
7354
7357
|
* @param code - The HTTP status code, if available
|
|
7355
7358
|
* @internal
|
|
7356
7359
|
*/
|
|
7357
|
-
|
|
7360
|
+
In = function(t, e) {
|
|
7358
7361
|
var n;
|
|
7359
7362
|
if (A(this, J) === this.CLOSED)
|
|
7360
7363
|
return;
|
|
7361
7364
|
$(this, J, this.CONNECTING);
|
|
7362
|
-
const r = new
|
|
7363
|
-
(n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r), $(this, De, setTimeout(A(this,
|
|
7364
|
-
},
|
|
7365
|
+
const r = new oi("error", { code: e, message: t });
|
|
7366
|
+
(n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r), $(this, De, setTimeout(A(this, Mn), A(this, st)));
|
|
7367
|
+
}, Mn = /* @__PURE__ */ new WeakMap(), /**
|
|
7365
7368
|
* ReadyState representing an EventSource currently trying to connect
|
|
7366
7369
|
*
|
|
7367
7370
|
* @public
|
|
@@ -7377,24 +7380,24 @@ kt.OPEN = 1, /**
|
|
|
7377
7380
|
* @public
|
|
7378
7381
|
*/
|
|
7379
7382
|
kt.CLOSED = 2;
|
|
7380
|
-
function
|
|
7383
|
+
function xc() {
|
|
7381
7384
|
const t = "document" in globalThis ? globalThis.document : void 0;
|
|
7382
7385
|
return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
|
|
7383
7386
|
}
|
|
7384
|
-
const
|
|
7387
|
+
const Yn = class Yn extends Pc {
|
|
7385
7388
|
};
|
|
7386
|
-
|
|
7387
|
-
let
|
|
7388
|
-
function
|
|
7389
|
-
return new
|
|
7389
|
+
Yn.EventSourceImpl = kt;
|
|
7390
|
+
let Rn = Yn;
|
|
7391
|
+
function $c(t) {
|
|
7392
|
+
return new Rn(
|
|
7390
7393
|
t,
|
|
7391
7394
|
{
|
|
7392
|
-
"@instantdb/react":
|
|
7395
|
+
"@instantdb/react": Qn
|
|
7393
7396
|
}
|
|
7394
7397
|
);
|
|
7395
7398
|
}
|
|
7396
|
-
const
|
|
7397
|
-
function
|
|
7399
|
+
const Wc = $c;
|
|
7400
|
+
function zc({
|
|
7398
7401
|
as: t = "div",
|
|
7399
7402
|
spaceId: e,
|
|
7400
7403
|
room: n,
|
|
@@ -7446,7 +7449,7 @@ function Wc({
|
|
|
7446
7449
|
[c]: void 0
|
|
7447
7450
|
});
|
|
7448
7451
|
}
|
|
7449
|
-
return
|
|
7452
|
+
return js(
|
|
7450
7453
|
t,
|
|
7451
7454
|
{
|
|
7452
7455
|
onMouseMove: y,
|
|
@@ -7465,9 +7468,9 @@ function Wc({
|
|
|
7465
7468
|
"div",
|
|
7466
7469
|
{
|
|
7467
7470
|
style: {
|
|
7468
|
-
...
|
|
7469
|
-
...
|
|
7470
|
-
zIndex: d !== void 0 ? d :
|
|
7471
|
+
...ci,
|
|
7472
|
+
...Uc,
|
|
7473
|
+
zIndex: d !== void 0 ? d : Lc
|
|
7471
7474
|
},
|
|
7472
7475
|
children: Object.entries(f.peers).map(([g, m]) => {
|
|
7473
7476
|
const E = m[c];
|
|
@@ -7475,7 +7478,7 @@ function Wc({
|
|
|
7475
7478
|
"div",
|
|
7476
7479
|
{
|
|
7477
7480
|
style: {
|
|
7478
|
-
...
|
|
7481
|
+
...ci,
|
|
7479
7482
|
transform: `translate(${E.xPercent}%, ${E.yPercent}%)`,
|
|
7480
7483
|
transformOrigin: "0 0",
|
|
7481
7484
|
transition: "transform 100ms"
|
|
@@ -7483,7 +7486,7 @@ function Wc({
|
|
|
7483
7486
|
children: a ? a({
|
|
7484
7487
|
color: E.color,
|
|
7485
7488
|
presence: l.peers[g]
|
|
7486
|
-
}) : /* @__PURE__ */ W.jsx(
|
|
7489
|
+
}) : /* @__PURE__ */ W.jsx(Dc, { ...E })
|
|
7487
7490
|
},
|
|
7488
7491
|
g
|
|
7489
7492
|
) : null;
|
|
@@ -7494,7 +7497,7 @@ function Wc({
|
|
|
7494
7497
|
]
|
|
7495
7498
|
);
|
|
7496
7499
|
}
|
|
7497
|
-
function
|
|
7500
|
+
function Dc({ color: t }) {
|
|
7498
7501
|
const n = t || "black";
|
|
7499
7502
|
return /* @__PURE__ */ W.jsxs(
|
|
7500
7503
|
"svg",
|
|
@@ -7541,27 +7544,27 @@ function $c({ color: t }) {
|
|
|
7541
7544
|
}
|
|
7542
7545
|
);
|
|
7543
7546
|
}
|
|
7544
|
-
const
|
|
7547
|
+
const ci = {
|
|
7545
7548
|
position: "absolute",
|
|
7546
7549
|
top: 0,
|
|
7547
7550
|
left: 0,
|
|
7548
7551
|
bottom: 0,
|
|
7549
7552
|
right: 0
|
|
7550
|
-
},
|
|
7553
|
+
}, Uc = {
|
|
7551
7554
|
overflow: "hidden",
|
|
7552
7555
|
pointerEvents: "none",
|
|
7553
7556
|
userSelect: "none"
|
|
7554
|
-
},
|
|
7557
|
+
}, Lc = 99999;
|
|
7555
7558
|
export {
|
|
7556
|
-
|
|
7559
|
+
zc as Cursors,
|
|
7557
7560
|
Dt as InstantAPIError,
|
|
7558
|
-
|
|
7559
|
-
|
|
7561
|
+
Pc as InstantReactAbstractDatabase,
|
|
7562
|
+
Rn as InstantReactWebDatabase,
|
|
7560
7563
|
ve as SyncTableCallbackEventType,
|
|
7561
|
-
|
|
7564
|
+
qc as i,
|
|
7562
7565
|
K as id,
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7566
|
+
$c as init,
|
|
7567
|
+
Wc as init_experimental,
|
|
7568
|
+
Nc as lookup,
|
|
7569
|
+
Kc as tx
|
|
7567
7570
|
};
|