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