@instantdb/react-common 0.22.84 → 0.22.85-experimental.drewh-entity-caching.20114568406.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 +801 -798
- package/dist/standalone/index.umd.cjs +9 -9
- package/package.json +3 -3
package/dist/standalone/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
1
|
+
import Or, { useRef as ze, useCallback as de, useSyncExternalStore as Rt, useEffect as ge, useMemo as $t, useState as Er } from "react";
|
|
2
|
+
var xt = { exports: {} }, $e = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.min.js
|
|
@@ -9,11 +9,11 @@ var $t = { exports: {} }, $e = {};
|
|
|
9
9
|
* This source code is licensed under the MIT license found in the
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
var t =
|
|
12
|
+
var Ln;
|
|
13
|
+
function Ki() {
|
|
14
|
+
if (Ln) return $e;
|
|
15
|
+
Ln = 1;
|
|
16
|
+
var t = Or, 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 };
|
|
17
17
|
function o(u, a, d) {
|
|
18
18
|
var c, f = {}, l = null, p = null;
|
|
19
19
|
d !== void 0 && (l = "" + d), a.key !== void 0 && (l = "" + a.key), a.ref !== void 0 && (p = a.ref);
|
|
@@ -23,10 +23,10 @@ function Ni() {
|
|
|
23
23
|
}
|
|
24
24
|
return $e.Fragment = n, $e.jsx = o, $e.jsxs = o, $e;
|
|
25
25
|
}
|
|
26
|
-
var xe = {},
|
|
27
|
-
function
|
|
28
|
-
if (
|
|
29
|
-
|
|
26
|
+
var xe = {}, Fn;
|
|
27
|
+
function qi() {
|
|
28
|
+
if (Fn) return xe;
|
|
29
|
+
Fn = 1;
|
|
30
30
|
var t = {};
|
|
31
31
|
/**
|
|
32
32
|
* @license React
|
|
@@ -38,7 +38,7 @@ function Ki() {
|
|
|
38
38
|
* LICENSE file in the root directory of this source tree.
|
|
39
39
|
*/
|
|
40
40
|
return t.NODE_ENV !== "production" && function() {
|
|
41
|
-
var e =
|
|
41
|
+
var e = Or, 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"), u = Symbol.for("react.provider"), a = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, g = "@@iterator";
|
|
42
42
|
function m(h) {
|
|
43
43
|
if (h === null || typeof h != "object")
|
|
44
44
|
return null;
|
|
@@ -127,18 +127,18 @@ function Ki() {
|
|
|
127
127
|
}
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
|
-
var le = Object.assign, Me = 0,
|
|
131
|
-
function
|
|
130
|
+
var le = Object.assign, Me = 0, yn, bn, _n, gn, Tn, mn, wn;
|
|
131
|
+
function vn() {
|
|
132
132
|
}
|
|
133
|
-
|
|
134
|
-
function
|
|
133
|
+
vn.__reactDisabledLog = !0;
|
|
134
|
+
function pi() {
|
|
135
135
|
{
|
|
136
136
|
if (Me === 0) {
|
|
137
|
-
|
|
137
|
+
yn = console.log, bn = console.info, _n = console.warn, gn = console.error, Tn = console.group, mn = console.groupCollapsed, wn = console.groupEnd;
|
|
138
138
|
var h = {
|
|
139
139
|
configurable: !0,
|
|
140
140
|
enumerable: !0,
|
|
141
|
-
value:
|
|
141
|
+
value: vn,
|
|
142
142
|
writable: !0
|
|
143
143
|
};
|
|
144
144
|
Object.defineProperties(console, {
|
|
@@ -154,7 +154,7 @@ function Ki() {
|
|
|
154
154
|
Me++;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function yi() {
|
|
158
158
|
{
|
|
159
159
|
if (Me--, Me === 0) {
|
|
160
160
|
var h = {
|
|
@@ -164,25 +164,25 @@ function Ki() {
|
|
|
164
164
|
};
|
|
165
165
|
Object.defineProperties(console, {
|
|
166
166
|
log: le({}, h, {
|
|
167
|
-
value:
|
|
167
|
+
value: yn
|
|
168
168
|
}),
|
|
169
169
|
info: le({}, h, {
|
|
170
|
-
value:
|
|
170
|
+
value: bn
|
|
171
171
|
}),
|
|
172
172
|
warn: le({}, h, {
|
|
173
|
-
value:
|
|
173
|
+
value: _n
|
|
174
174
|
}),
|
|
175
175
|
error: le({}, h, {
|
|
176
|
-
value:
|
|
176
|
+
value: gn
|
|
177
177
|
}),
|
|
178
178
|
group: le({}, h, {
|
|
179
|
-
value:
|
|
179
|
+
value: Tn
|
|
180
180
|
}),
|
|
181
181
|
groupCollapsed: le({}, h, {
|
|
182
|
-
value:
|
|
182
|
+
value: mn
|
|
183
183
|
}),
|
|
184
184
|
groupEnd: le({}, h, {
|
|
185
|
-
value:
|
|
185
|
+
value: wn
|
|
186
186
|
})
|
|
187
187
|
});
|
|
188
188
|
}
|
|
@@ -205,10 +205,10 @@ function Ki() {
|
|
|
205
205
|
}
|
|
206
206
|
var wt = !1, Je;
|
|
207
207
|
{
|
|
208
|
-
var
|
|
209
|
-
Je = new
|
|
208
|
+
var bi = typeof WeakMap == "function" ? WeakMap : Map;
|
|
209
|
+
Je = new bi();
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function Sn(h, _) {
|
|
212
212
|
if (!h || wt)
|
|
213
213
|
return "";
|
|
214
214
|
{
|
|
@@ -221,7 +221,7 @@ function Ki() {
|
|
|
221
221
|
var C = Error.prepareStackTrace;
|
|
222
222
|
Error.prepareStackTrace = void 0;
|
|
223
223
|
var P;
|
|
224
|
-
P = Tt.current, Tt.current = null,
|
|
224
|
+
P = Tt.current, Tt.current = null, pi();
|
|
225
225
|
try {
|
|
226
226
|
if (_) {
|
|
227
227
|
var j = function() {
|
|
@@ -274,15 +274,15 @@ function Ki() {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
} finally {
|
|
277
|
-
wt = !1, Tt.current = P,
|
|
277
|
+
wt = !1, Tt.current = P, yi(), Error.prepareStackTrace = C;
|
|
278
278
|
}
|
|
279
279
|
var ve = h ? h.displayName || h.name : "", he = ve ? Ye(ve) : "";
|
|
280
280
|
return typeof h == "function" && Je.set(h, he), he;
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
return
|
|
282
|
+
function _i(h, _, w) {
|
|
283
|
+
return Sn(h, !1);
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function gi(h) {
|
|
286
286
|
var _ = h.prototype;
|
|
287
287
|
return !!(_ && _.isReactComponent);
|
|
288
288
|
}
|
|
@@ -290,7 +290,7 @@ function Ki() {
|
|
|
290
290
|
if (h == null)
|
|
291
291
|
return "";
|
|
292
292
|
if (typeof h == "function")
|
|
293
|
-
return
|
|
293
|
+
return Sn(h, gi(h));
|
|
294
294
|
if (typeof h == "string")
|
|
295
295
|
return Ye(h);
|
|
296
296
|
switch (h) {
|
|
@@ -302,7 +302,7 @@ function Ki() {
|
|
|
302
302
|
if (typeof h == "object")
|
|
303
303
|
switch (h.$$typeof) {
|
|
304
304
|
case d:
|
|
305
|
-
return
|
|
305
|
+
return _i(h.render);
|
|
306
306
|
case l:
|
|
307
307
|
return Ze(h.type, _, w);
|
|
308
308
|
case p: {
|
|
@@ -315,15 +315,15 @@ function Ki() {
|
|
|
315
315
|
}
|
|
316
316
|
return "";
|
|
317
317
|
}
|
|
318
|
-
var Re = Object.prototype.hasOwnProperty,
|
|
318
|
+
var Re = Object.prototype.hasOwnProperty, On = {}, En = T.ReactDebugCurrentFrame;
|
|
319
319
|
function Xe(h) {
|
|
320
320
|
if (h) {
|
|
321
321
|
var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
|
|
322
|
-
|
|
322
|
+
En.setExtraStackFrame(w);
|
|
323
323
|
} else
|
|
324
|
-
|
|
324
|
+
En.setExtraStackFrame(null);
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function Ti(h, _, w, O, C) {
|
|
327
327
|
{
|
|
328
328
|
var P = Function.call.bind(Re);
|
|
329
329
|
for (var j in h)
|
|
@@ -338,41 +338,41 @@ function Ki() {
|
|
|
338
338
|
} catch ($) {
|
|
339
339
|
E = $;
|
|
340
340
|
}
|
|
341
|
-
E && !(E instanceof Error) && (Xe(C), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", w, j, typeof E), Xe(null)), E instanceof Error && !(E.message in
|
|
341
|
+
E && !(E instanceof Error) && (Xe(C), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", w, j, typeof E), Xe(null)), E instanceof Error && !(E.message in On) && (On[E.message] = !0, Xe(C), v("Failed %s type: %s", w, E.message), Xe(null));
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
var
|
|
345
|
+
var mi = Array.isArray;
|
|
346
346
|
function vt(h) {
|
|
347
|
-
return
|
|
347
|
+
return mi(h);
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function wi(h) {
|
|
350
350
|
{
|
|
351
351
|
var _ = typeof Symbol == "function" && Symbol.toStringTag, w = _ && h[Symbol.toStringTag] || h.constructor.name || "Object";
|
|
352
352
|
return w;
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function vi(h) {
|
|
356
356
|
try {
|
|
357
|
-
return
|
|
357
|
+
return An(h), !1;
|
|
358
358
|
} catch {
|
|
359
359
|
return !0;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
function
|
|
362
|
+
function An(h) {
|
|
363
363
|
return "" + h;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
366
|
-
if (
|
|
367
|
-
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
365
|
+
function jn(h) {
|
|
366
|
+
if (vi(h))
|
|
367
|
+
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", wi(h)), An(h);
|
|
368
368
|
}
|
|
369
|
-
var
|
|
369
|
+
var kn = T.ReactCurrentOwner, Si = {
|
|
370
370
|
key: !0,
|
|
371
371
|
ref: !0,
|
|
372
372
|
__self: !0,
|
|
373
373
|
__source: !0
|
|
374
|
-
},
|
|
375
|
-
function
|
|
374
|
+
}, Cn, Pn;
|
|
375
|
+
function Oi(h) {
|
|
376
376
|
if (Re.call(h, "ref")) {
|
|
377
377
|
var _ = Object.getOwnPropertyDescriptor(h, "ref").get;
|
|
378
378
|
if (_ && _.isReactWarning)
|
|
@@ -380,7 +380,7 @@ function Ki() {
|
|
|
380
380
|
}
|
|
381
381
|
return h.ref !== void 0;
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function Ei(h) {
|
|
384
384
|
if (Re.call(h, "key")) {
|
|
385
385
|
var _ = Object.getOwnPropertyDescriptor(h, "key").get;
|
|
386
386
|
if (_ && _.isReactWarning)
|
|
@@ -388,13 +388,13 @@ function Ki() {
|
|
|
388
388
|
}
|
|
389
389
|
return h.key !== void 0;
|
|
390
390
|
}
|
|
391
|
-
function Ei(h, _) {
|
|
392
|
-
typeof h.ref == "string" && jn.current;
|
|
393
|
-
}
|
|
394
391
|
function Ai(h, _) {
|
|
392
|
+
typeof h.ref == "string" && kn.current;
|
|
393
|
+
}
|
|
394
|
+
function ji(h, _) {
|
|
395
395
|
{
|
|
396
396
|
var w = function() {
|
|
397
|
-
|
|
397
|
+
Cn || (Cn = !0, v("%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)", _));
|
|
398
398
|
};
|
|
399
399
|
w.isReactWarning = !0, Object.defineProperty(h, "key", {
|
|
400
400
|
get: w,
|
|
@@ -402,10 +402,10 @@ function Ki() {
|
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function ki(h, _) {
|
|
406
406
|
{
|
|
407
407
|
var w = function() {
|
|
408
|
-
|
|
408
|
+
Pn || (Pn = !0, v("%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)", _));
|
|
409
409
|
};
|
|
410
410
|
w.isReactWarning = !0, Object.defineProperty(h, "ref", {
|
|
411
411
|
get: w,
|
|
@@ -413,7 +413,7 @@ function Ki() {
|
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
var
|
|
416
|
+
var Ci = function(h, _, w, O, C, P, j) {
|
|
417
417
|
var E = {
|
|
418
418
|
// This tag allows us to uniquely identify this as a React Element
|
|
419
419
|
$$typeof: n,
|
|
@@ -442,12 +442,12 @@ function Ki() {
|
|
|
442
442
|
value: C
|
|
443
443
|
}), Object.freeze && (Object.freeze(E.props), Object.freeze(E)), E;
|
|
444
444
|
};
|
|
445
|
-
function
|
|
445
|
+
function Pi(h, _, w, O, C) {
|
|
446
446
|
{
|
|
447
447
|
var P, j = {}, E = null, z = null;
|
|
448
|
-
w !== void 0 && (
|
|
448
|
+
w !== void 0 && (jn(w), E = "" + w), Ei(_) && (jn(_.key), E = "" + _.key), Oi(_) && (z = _.ref, Ai(_, C));
|
|
449
449
|
for (P in _)
|
|
450
|
-
Re.call(_, P) && !
|
|
450
|
+
Re.call(_, P) && !Si.hasOwnProperty(P) && (j[P] = _[P]);
|
|
451
451
|
if (h && h.defaultProps) {
|
|
452
452
|
var $ = h.defaultProps;
|
|
453
453
|
for (P in $)
|
|
@@ -455,25 +455,25 @@ function Ki() {
|
|
|
455
455
|
}
|
|
456
456
|
if (E || z) {
|
|
457
457
|
var D = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
458
|
-
E &&
|
|
458
|
+
E && ji(j, D), z && ki(j, D);
|
|
459
459
|
}
|
|
460
|
-
return
|
|
460
|
+
return Ci(h, E, z, C, O, kn.current, j);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
var St = T.ReactCurrentOwner,
|
|
463
|
+
var St = T.ReactCurrentOwner, In = T.ReactDebugCurrentFrame;
|
|
464
464
|
function we(h) {
|
|
465
465
|
if (h) {
|
|
466
466
|
var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
|
|
467
|
-
|
|
467
|
+
In.setExtraStackFrame(w);
|
|
468
468
|
} else
|
|
469
|
-
|
|
469
|
+
In.setExtraStackFrame(null);
|
|
470
470
|
}
|
|
471
471
|
var Ot;
|
|
472
472
|
Ot = !1;
|
|
473
473
|
function Et(h) {
|
|
474
474
|
return typeof h == "object" && h !== null && h.$$typeof === n;
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function Mn() {
|
|
477
477
|
{
|
|
478
478
|
if (St.current) {
|
|
479
479
|
var h = ne(St.current.type);
|
|
@@ -485,13 +485,13 @@ Check the render method of \`` + h + "`.";
|
|
|
485
485
|
return "";
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function Ii(h) {
|
|
489
489
|
return "";
|
|
490
490
|
}
|
|
491
|
-
var
|
|
492
|
-
function
|
|
491
|
+
var Rn = {};
|
|
492
|
+
function Mi(h) {
|
|
493
493
|
{
|
|
494
|
-
var _ =
|
|
494
|
+
var _ = Mn();
|
|
495
495
|
if (!_) {
|
|
496
496
|
var w = typeof h == "string" ? h : h.displayName || h.name;
|
|
497
497
|
w && (_ = `
|
|
@@ -501,27 +501,27 @@ Check the top-level render call using <` + w + ">.");
|
|
|
501
501
|
return _;
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function $n(h, _) {
|
|
505
505
|
{
|
|
506
506
|
if (!h._store || h._store.validated || h.key != null)
|
|
507
507
|
return;
|
|
508
508
|
h._store.validated = !0;
|
|
509
|
-
var w =
|
|
510
|
-
if (
|
|
509
|
+
var w = Mi(_);
|
|
510
|
+
if (Rn[w])
|
|
511
511
|
return;
|
|
512
|
-
|
|
512
|
+
Rn[w] = !0;
|
|
513
513
|
var O = "";
|
|
514
514
|
h && h._owner && h._owner !== St.current && (O = " It was passed a child from " + ne(h._owner.type) + "."), we(h), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', w, O), we(null);
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function xn(h, _) {
|
|
518
518
|
{
|
|
519
519
|
if (typeof h != "object")
|
|
520
520
|
return;
|
|
521
521
|
if (vt(h))
|
|
522
522
|
for (var w = 0; w < h.length; w++) {
|
|
523
523
|
var O = h[w];
|
|
524
|
-
Et(O) &&
|
|
524
|
+
Et(O) && $n(O, _);
|
|
525
525
|
}
|
|
526
526
|
else if (Et(h))
|
|
527
527
|
h._store && (h._store.validated = !0);
|
|
@@ -529,11 +529,11 @@ Check the top-level render call using <` + w + ">.");
|
|
|
529
529
|
var C = m(h);
|
|
530
530
|
if (typeof C == "function" && C !== h.entries)
|
|
531
531
|
for (var P = C.call(h), j; !(j = P.next()).done; )
|
|
532
|
-
Et(j.value) &&
|
|
532
|
+
Et(j.value) && $n(j.value, _);
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function Ri(h) {
|
|
537
537
|
{
|
|
538
538
|
var _ = h.type;
|
|
539
539
|
if (_ == null || typeof _ == "string")
|
|
@@ -549,7 +549,7 @@ Check the top-level render call using <` + w + ">.");
|
|
|
549
549
|
return;
|
|
550
550
|
if (w) {
|
|
551
551
|
var O = ne(_);
|
|
552
|
-
|
|
552
|
+
Ti(w, h.props, "prop", O, h);
|
|
553
553
|
} else if (_.PropTypes !== void 0 && !Ot) {
|
|
554
554
|
Ot = !0;
|
|
555
555
|
var C = ne(_);
|
|
@@ -558,7 +558,7 @@ Check the top-level render call using <` + w + ">.");
|
|
|
558
558
|
typeof _.getDefaultProps == "function" && !_.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function $i(h) {
|
|
562
562
|
{
|
|
563
563
|
for (var _ = Object.keys(h.props), w = 0; w < _.length; w++) {
|
|
564
564
|
var O = _[w];
|
|
@@ -570,19 +570,19 @@ Check the top-level render call using <` + w + ">.");
|
|
|
570
570
|
h.ref !== null && (we(h), v("Invalid attribute `ref` supplied to `React.Fragment`."), we(null));
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
|
-
var
|
|
574
|
-
function
|
|
573
|
+
var Dn = {};
|
|
574
|
+
function Un(h, _, w, O, C, P) {
|
|
575
575
|
{
|
|
576
576
|
var j = _t(h);
|
|
577
577
|
if (!j) {
|
|
578
578
|
var E = "";
|
|
579
579
|
(h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (E += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
580
|
-
var z =
|
|
581
|
-
z ? E += z : E +=
|
|
580
|
+
var z = Ii();
|
|
581
|
+
z ? E += z : E += Mn();
|
|
582
582
|
var $;
|
|
583
583
|
h === null ? $ = "null" : vt(h) ? $ = "array" : h !== void 0 && h.$$typeof === n ? ($ = "<" + (ne(h.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : $ = typeof h, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", $, E);
|
|
584
584
|
}
|
|
585
|
-
var D =
|
|
585
|
+
var D = Pi(h, _, w, C, P);
|
|
586
586
|
if (D == null)
|
|
587
587
|
return D;
|
|
588
588
|
if (j) {
|
|
@@ -591,43 +591,43 @@ Check the top-level render call using <` + w + ">.");
|
|
|
591
591
|
if (O)
|
|
592
592
|
if (vt(J)) {
|
|
593
593
|
for (var ve = 0; ve < J.length; ve++)
|
|
594
|
-
|
|
594
|
+
xn(J[ve], h);
|
|
595
595
|
Object.freeze && Object.freeze(J);
|
|
596
596
|
} else
|
|
597
597
|
v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
598
598
|
else
|
|
599
|
-
|
|
599
|
+
xn(J, h);
|
|
600
600
|
}
|
|
601
601
|
if (Re.call(_, "key")) {
|
|
602
|
-
var he = ne(h), W = Object.keys(_).filter(function(
|
|
603
|
-
return
|
|
602
|
+
var he = ne(h), W = Object.keys(_).filter(function(Ni) {
|
|
603
|
+
return Ni !== "key";
|
|
604
604
|
}), At = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
605
|
-
if (!
|
|
606
|
-
var
|
|
605
|
+
if (!Dn[he + At]) {
|
|
606
|
+
var Fi = W.length > 0 ? "{" + W.join(": ..., ") + ": ...}" : "{}";
|
|
607
607
|
v(`A props object containing a "key" prop is being spread into JSX:
|
|
608
608
|
let props = %s;
|
|
609
609
|
<%s {...props} />
|
|
610
610
|
React keys must be passed directly to JSX without using spread:
|
|
611
611
|
let props = %s;
|
|
612
|
-
<%s key={someKey} {...props} />`, At, he,
|
|
612
|
+
<%s key={someKey} {...props} />`, At, he, Fi, he), Dn[he + At] = !0;
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
|
-
return h === i ?
|
|
615
|
+
return h === i ? $i(D) : Ri(D), D;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
function $i(h, _, w) {
|
|
619
|
-
return Dn(h, _, w, !0);
|
|
620
|
-
}
|
|
621
618
|
function xi(h, _, w) {
|
|
622
|
-
return
|
|
619
|
+
return Un(h, _, w, !0);
|
|
620
|
+
}
|
|
621
|
+
function Di(h, _, w) {
|
|
622
|
+
return Un(h, _, w, !1);
|
|
623
623
|
}
|
|
624
|
-
var
|
|
625
|
-
xe.Fragment = i, xe.jsx =
|
|
624
|
+
var Ui = Di, Li = xi;
|
|
625
|
+
xe.Fragment = i, xe.jsx = Ui, xe.jsxs = Li;
|
|
626
626
|
}(), xe;
|
|
627
627
|
}
|
|
628
|
-
var
|
|
629
|
-
|
|
630
|
-
var et =
|
|
628
|
+
var zi = {};
|
|
629
|
+
zi.NODE_ENV === "production" ? xt.exports = Ki() : xt.exports = qi();
|
|
630
|
+
var et = xt.exports;
|
|
631
631
|
function N(t) {
|
|
632
632
|
if (typeof t == "number")
|
|
633
633
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
@@ -670,14 +670,14 @@ const x = {
|
|
|
670
670
|
Remove: "remove",
|
|
671
671
|
Replace: "replace",
|
|
672
672
|
Add: "add"
|
|
673
|
-
},
|
|
673
|
+
}, Ar = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Vi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), st = Symbol.iterator, Y = {
|
|
674
674
|
mutable: "mutable",
|
|
675
675
|
immutable: "immutable"
|
|
676
|
-
},
|
|
676
|
+
}, en = {};
|
|
677
677
|
function Ne(t, e) {
|
|
678
678
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function Nn(t, e) {
|
|
681
681
|
if (e in t) {
|
|
682
682
|
let n = Reflect.getPrototypeOf(t);
|
|
683
683
|
for (; n; ) {
|
|
@@ -688,10 +688,10 @@ function Fn(t, e) {
|
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function tn(t) {
|
|
692
692
|
return Object.getPrototypeOf(t) === Set.prototype;
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function nn(t) {
|
|
695
695
|
return Object.getPrototypeOf(t) === Map.prototype;
|
|
696
696
|
}
|
|
697
697
|
function H(t) {
|
|
@@ -702,9 +702,9 @@ function Te(t) {
|
|
|
702
702
|
return !!A(t);
|
|
703
703
|
}
|
|
704
704
|
function A(t) {
|
|
705
|
-
return typeof t != "object" ? null : t == null ? void 0 : t[
|
|
705
|
+
return typeof t != "object" ? null : t == null ? void 0 : t[Ar];
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function rn(t) {
|
|
708
708
|
var e;
|
|
709
709
|
const n = A(t);
|
|
710
710
|
return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
|
|
@@ -715,7 +715,7 @@ function ee(t, e) {
|
|
|
715
715
|
let n;
|
|
716
716
|
return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((n = e.mark(t, Y)) === Y.immutable || typeof n == "function");
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function jr(t, e = []) {
|
|
719
719
|
if (Object.hasOwnProperty.call(t, "key")) {
|
|
720
720
|
const n = t.parent.copy, r = A(ce(n, t.key));
|
|
721
721
|
if (r !== null && (r == null ? void 0 : r.original) !== t.original)
|
|
@@ -726,10 +726,10 @@ function Ar(t, e = []) {
|
|
|
726
726
|
e.push(s);
|
|
727
727
|
}
|
|
728
728
|
if (t.parent)
|
|
729
|
-
return
|
|
729
|
+
return jr(t.parent, e);
|
|
730
730
|
e.reverse();
|
|
731
731
|
try {
|
|
732
|
-
|
|
732
|
+
Wi(t.copy, e);
|
|
733
733
|
} catch {
|
|
734
734
|
return null;
|
|
735
735
|
}
|
|
@@ -751,7 +751,7 @@ function jt(t, e) {
|
|
|
751
751
|
function ae(t, e) {
|
|
752
752
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function Dt(t) {
|
|
755
755
|
if (t)
|
|
756
756
|
for (; t.finalities.revoke.length > 0; )
|
|
757
757
|
t.finalities.revoke.pop()();
|
|
@@ -762,7 +762,7 @@ function be(t, e) {
|
|
|
762
762
|
return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
763
763
|
}).join("/");
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function Wi(t, e) {
|
|
766
766
|
for (let n = 0; n < e.length - 1; n += 1) {
|
|
767
767
|
const r = e[n];
|
|
768
768
|
if (t = ce(me(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
|
|
@@ -770,7 +770,7 @@ function Vi(t, e) {
|
|
|
770
770
|
}
|
|
771
771
|
return t;
|
|
772
772
|
}
|
|
773
|
-
function
|
|
773
|
+
function Bi(t) {
|
|
774
774
|
const e = Object.create(Object.getPrototypeOf(t));
|
|
775
775
|
return Reflect.ownKeys(t).forEach((n) => {
|
|
776
776
|
let r = Reflect.getOwnPropertyDescriptor(t, n);
|
|
@@ -786,26 +786,26 @@ function Wi(t) {
|
|
|
786
786
|
}), Reflect.defineProperty(e, n, r);
|
|
787
787
|
}), e;
|
|
788
788
|
}
|
|
789
|
-
const
|
|
790
|
-
function
|
|
789
|
+
const Gi = Object.prototype.propertyIsEnumerable;
|
|
790
|
+
function kr(t, e) {
|
|
791
791
|
let n;
|
|
792
792
|
if (Array.isArray(t))
|
|
793
793
|
return Array.prototype.concat.call(t);
|
|
794
794
|
if (t instanceof Set) {
|
|
795
|
-
if (!
|
|
795
|
+
if (!tn(t)) {
|
|
796
796
|
const r = Object.getPrototypeOf(t).constructor;
|
|
797
797
|
return new r(t.values());
|
|
798
798
|
}
|
|
799
799
|
return Set.prototype.difference ? Set.prototype.difference.call(t, /* @__PURE__ */ new Set()) : new Set(t.values());
|
|
800
800
|
} else if (t instanceof Map) {
|
|
801
|
-
if (!
|
|
801
|
+
if (!nn(t)) {
|
|
802
802
|
const r = Object.getPrototypeOf(t).constructor;
|
|
803
803
|
return new r(t);
|
|
804
804
|
}
|
|
805
805
|
return new Map(t);
|
|
806
806
|
} else if (e != null && e.mark && (n = e.mark(t, Y), n !== void 0) && n !== Y.mutable) {
|
|
807
807
|
if (n === Y.immutable)
|
|
808
|
-
return
|
|
808
|
+
return Bi(t);
|
|
809
809
|
if (typeof n == "function") {
|
|
810
810
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
811
811
|
throw new Error("You can't use mark and patches or auto freeze together.");
|
|
@@ -817,17 +817,17 @@ function jr(t, e) {
|
|
|
817
817
|
return Object.keys(t).forEach((i) => {
|
|
818
818
|
r[i] = t[i];
|
|
819
819
|
}), Object.getOwnPropertySymbols(t).forEach((i) => {
|
|
820
|
-
|
|
820
|
+
Gi.call(t, i) && (r[i] = t[i]);
|
|
821
821
|
}), r;
|
|
822
822
|
} else
|
|
823
823
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
824
824
|
}
|
|
825
825
|
function V(t) {
|
|
826
|
-
t.copy || (t.copy =
|
|
826
|
+
t.copy || (t.copy = kr(t.original, t.options));
|
|
827
827
|
}
|
|
828
828
|
function Ue(t) {
|
|
829
829
|
if (!ee(t))
|
|
830
|
-
return
|
|
830
|
+
return rn(t);
|
|
831
831
|
if (Array.isArray(t))
|
|
832
832
|
return t.map(Ue);
|
|
833
833
|
if (t instanceof Map) {
|
|
@@ -835,7 +835,7 @@ function Ue(t) {
|
|
|
835
835
|
r,
|
|
836
836
|
Ue(i)
|
|
837
837
|
]);
|
|
838
|
-
if (!
|
|
838
|
+
if (!nn(t)) {
|
|
839
839
|
const r = Object.getPrototypeOf(t).constructor;
|
|
840
840
|
return new r(n);
|
|
841
841
|
}
|
|
@@ -843,7 +843,7 @@ function Ue(t) {
|
|
|
843
843
|
}
|
|
844
844
|
if (t instanceof Set) {
|
|
845
845
|
const n = Array.from(t).map(Ue);
|
|
846
|
-
if (!
|
|
846
|
+
if (!tn(t)) {
|
|
847
847
|
const r = Object.getPrototypeOf(t).constructor;
|
|
848
848
|
return new r(n);
|
|
849
849
|
}
|
|
@@ -861,7 +861,7 @@ function ie(t) {
|
|
|
861
861
|
var e;
|
|
862
862
|
t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && ie(t.parent));
|
|
863
863
|
}
|
|
864
|
-
function
|
|
864
|
+
function Kn() {
|
|
865
865
|
throw new Error("Cannot modify frozen object");
|
|
866
866
|
}
|
|
867
867
|
function Se(t, e, n, r, i) {
|
|
@@ -889,12 +889,12 @@ function Se(t, e, n, r, i) {
|
|
|
889
889
|
case 2:
|
|
890
890
|
for (const [u, a] of t)
|
|
891
891
|
Se(u, u, n, r, i), Se(a, u, n, r, i);
|
|
892
|
-
t.set = t.clear = t.delete =
|
|
892
|
+
t.set = t.clear = t.delete = Kn;
|
|
893
893
|
break;
|
|
894
894
|
case 3:
|
|
895
895
|
for (const u of t)
|
|
896
896
|
Se(u, u, n, r, i);
|
|
897
|
-
t.add = t.clear = t.delete =
|
|
897
|
+
t.add = t.clear = t.delete = Kn;
|
|
898
898
|
break;
|
|
899
899
|
case 1:
|
|
900
900
|
Object.freeze(t);
|
|
@@ -910,7 +910,7 @@ function Se(t, e, n, r, i) {
|
|
|
910
910
|
}
|
|
911
911
|
r.pop(), i.pop();
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function sn(t, e) {
|
|
914
914
|
const n = me(t);
|
|
915
915
|
if (n === 0)
|
|
916
916
|
Reflect.ownKeys(t).forEach((r) => {
|
|
@@ -923,11 +923,11 @@ function rn(t, e) {
|
|
|
923
923
|
} else
|
|
924
924
|
t.forEach((r, i) => e(i, r, t));
|
|
925
925
|
}
|
|
926
|
-
function
|
|
926
|
+
function Cr(t, e, n) {
|
|
927
927
|
if (Te(t) || !ee(t, n) || e.has(t) || Object.isFrozen(t))
|
|
928
928
|
return;
|
|
929
929
|
const r = t instanceof Set, i = r ? /* @__PURE__ */ new Map() : void 0;
|
|
930
|
-
if (e.add(t),
|
|
930
|
+
if (e.add(t), sn(t, (s, o) => {
|
|
931
931
|
var u;
|
|
932
932
|
if (Te(o)) {
|
|
933
933
|
const a = A(o);
|
|
@@ -935,7 +935,7 @@ function kr(t, e, n) {
|
|
|
935
935
|
const d = !((u = a.assignedMap) === null || u === void 0) && u.size || a.operated ? a.copy : a.original;
|
|
936
936
|
We(r ? i : t, s, d);
|
|
937
937
|
} else
|
|
938
|
-
|
|
938
|
+
Cr(o, e, n);
|
|
939
939
|
}), i) {
|
|
940
940
|
const s = t, o = Array.from(s);
|
|
941
941
|
s.clear(), o.forEach((u) => {
|
|
@@ -943,39 +943,39 @@ function kr(t, e, n) {
|
|
|
943
943
|
});
|
|
944
944
|
}
|
|
945
945
|
}
|
|
946
|
-
function
|
|
946
|
+
function Qi(t, e) {
|
|
947
947
|
const n = t.type === 3 ? t.setMap : t.copy;
|
|
948
|
-
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n &&
|
|
948
|
+
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && Cr(ce(n, e), t.finalities.handledSet, t.options);
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function Ut(t) {
|
|
951
951
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
952
|
-
t.copy.add(
|
|
952
|
+
t.copy.add(rn(e));
|
|
953
953
|
}));
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function Lt(t, e, n, r) {
|
|
956
956
|
if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
|
|
957
957
|
if (n && r) {
|
|
958
|
-
const s =
|
|
958
|
+
const s = jr(t);
|
|
959
959
|
s && e(t, s, n, r);
|
|
960
960
|
}
|
|
961
961
|
t.finalized = !0;
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
function
|
|
964
|
+
function on(t, e, n, r) {
|
|
965
965
|
const i = A(n);
|
|
966
966
|
i && (i.callbacks || (i.callbacks = []), i.callbacks.push((s, o) => {
|
|
967
967
|
var u;
|
|
968
968
|
const a = t.type === 3 ? t.setMap : t.copy;
|
|
969
969
|
if (ae(ce(a, e), n)) {
|
|
970
970
|
let d = i.original;
|
|
971
|
-
i.copy && (d = i.copy),
|
|
971
|
+
i.copy && (d = i.copy), Ut(t), Lt(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (u = t.options.updatedValues) !== null && u !== void 0 ? u : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)), We(a, e, d);
|
|
972
972
|
}
|
|
973
973
|
}), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ee(n, t.options) && t.finalities.draft.push(() => {
|
|
974
974
|
const s = t.type === 3 ? t.setMap : t.copy;
|
|
975
|
-
ae(ce(s, e), n) &&
|
|
975
|
+
ae(ce(s, e), n) && Qi(t, e);
|
|
976
976
|
});
|
|
977
977
|
}
|
|
978
|
-
function
|
|
978
|
+
function Hi(t, e, n, r, i) {
|
|
979
979
|
let { original: s, assignedMap: o, options: u } = t, a = t.copy;
|
|
980
980
|
a.length < s.length && ([s, a] = [a, s], [n, r] = [r, n]);
|
|
981
981
|
for (let d = 0; d < s.length; d += 1)
|
|
@@ -1021,7 +1021,7 @@ function Qi(t, e, n, r, i) {
|
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1024
|
+
function Yi({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
1025
1025
|
n.forEach((u, a) => {
|
|
1026
1026
|
const d = ce(t, a), c = ot(ce(e, a)), f = u ? Ne(t, a) ? x.Replace : x.Add : x.Remove;
|
|
1027
1027
|
if (ae(d, c) && f === x.Replace)
|
|
@@ -1030,7 +1030,7 @@ function Hi({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
|
1030
1030
|
i.push(f === x.Remove ? { op: f, path: p } : { op: f, path: p, value: c }), s.push(f === x.Add ? { op: x.Remove, path: p } : f === x.Remove ? { op: x.Add, path: p, value: d } : { op: x.Replace, path: p, value: d });
|
|
1031
1031
|
});
|
|
1032
1032
|
}
|
|
1033
|
-
function
|
|
1033
|
+
function Ji({ original: t, copy: e }, n, r, i, s) {
|
|
1034
1034
|
let o = 0;
|
|
1035
1035
|
t.forEach((u) => {
|
|
1036
1036
|
if (!e.has(u)) {
|
|
@@ -1067,17 +1067,17 @@ function Ve(t, e, n, r) {
|
|
|
1067
1067
|
switch (t.type) {
|
|
1068
1068
|
case 0:
|
|
1069
1069
|
case 2:
|
|
1070
|
-
return
|
|
1070
|
+
return Yi(t, e, n, r, i);
|
|
1071
1071
|
case 1:
|
|
1072
|
-
return
|
|
1072
|
+
return Hi(t, e, n, r, i);
|
|
1073
1073
|
case 3:
|
|
1074
|
-
return
|
|
1074
|
+
return Ji(t, e, n, r, i);
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
1077
|
const ct = (t, e, n = !1) => {
|
|
1078
1078
|
if (typeof t == "object" && t !== null && (!ee(t, e) || n))
|
|
1079
1079
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
1080
|
-
},
|
|
1080
|
+
}, Ft = {
|
|
1081
1081
|
get size() {
|
|
1082
1082
|
return H(A(this)).size;
|
|
1083
1083
|
},
|
|
@@ -1086,7 +1086,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1086
1086
|
},
|
|
1087
1087
|
set(t, e) {
|
|
1088
1088
|
const n = A(this), r = H(n);
|
|
1089
|
-
return (!r.has(t) || !ae(r.get(t), e)) && (V(n), ie(n), n.assignedMap.set(t, !0), n.copy.set(t, e),
|
|
1089
|
+
return (!r.has(t) || !ae(r.get(t), e)) && (V(n), ie(n), n.assignedMap.set(t, !0), n.copy.set(t, e), on(n, t, e, Ve)), this;
|
|
1090
1090
|
},
|
|
1091
1091
|
delete(t) {
|
|
1092
1092
|
if (!this.has(t))
|
|
@@ -1114,7 +1114,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1114
1114
|
const r = A(this), i = H(r).get(t), s = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, i, Y)) === Y.mutable;
|
|
1115
1115
|
if (r.options.strict && ct(i, r.options, s), s || r.finalized || !ee(i, r.options) || i !== r.original.get(t))
|
|
1116
1116
|
return i;
|
|
1117
|
-
const o =
|
|
1117
|
+
const o = en.createDraft({
|
|
1118
1118
|
original: i,
|
|
1119
1119
|
parentDraft: r,
|
|
1120
1120
|
key: t,
|
|
@@ -1158,7 +1158,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1158
1158
|
[st]() {
|
|
1159
1159
|
return this.entries();
|
|
1160
1160
|
}
|
|
1161
|
-
},
|
|
1161
|
+
}, Zi = Reflect.ownKeys(Ft), qn = (t, e, { isValuesIterator: n }) => () => {
|
|
1162
1162
|
var r, i;
|
|
1163
1163
|
const s = e.next();
|
|
1164
1164
|
if (s.done)
|
|
@@ -1167,7 +1167,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1167
1167
|
let u = t.setMap.get(o);
|
|
1168
1168
|
const a = A(u), d = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, u, Y)) === Y.mutable;
|
|
1169
1169
|
if (t.options.strict && ct(o, t.options, d), !d && !a && ee(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
1170
|
-
const c =
|
|
1170
|
+
const c = en.createDraft({
|
|
1171
1171
|
original: o,
|
|
1172
1172
|
parentDraft: t,
|
|
1173
1173
|
key: o,
|
|
@@ -1194,7 +1194,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1194
1194
|
},
|
|
1195
1195
|
add(t) {
|
|
1196
1196
|
const e = A(this);
|
|
1197
|
-
return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t),
|
|
1197
|
+
return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), on(e, t, t, Ve)), this;
|
|
1198
1198
|
},
|
|
1199
1199
|
delete(t) {
|
|
1200
1200
|
if (!this.has(t))
|
|
@@ -1219,7 +1219,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1219
1219
|
const e = t.setMap.keys();
|
|
1220
1220
|
return {
|
|
1221
1221
|
[Symbol.iterator]: () => this.values(),
|
|
1222
|
-
next:
|
|
1222
|
+
next: qn(t, e, { isValuesIterator: !0 })
|
|
1223
1223
|
};
|
|
1224
1224
|
},
|
|
1225
1225
|
entries() {
|
|
@@ -1228,7 +1228,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1228
1228
|
const e = t.setMap.keys();
|
|
1229
1229
|
return {
|
|
1230
1230
|
[Symbol.iterator]: () => this.entries(),
|
|
1231
|
-
next:
|
|
1231
|
+
next: qn(t, e, {
|
|
1232
1232
|
isValuesIterator: !1
|
|
1233
1233
|
})
|
|
1234
1234
|
};
|
|
@@ -1269,13 +1269,13 @@ Set.prototype.difference && Object.assign(dt, {
|
|
|
1269
1269
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
|
|
1270
1270
|
}
|
|
1271
1271
|
});
|
|
1272
|
-
const
|
|
1272
|
+
const Xi = Reflect.ownKeys(dt), Pr = /* @__PURE__ */ new WeakSet(), Ir = {
|
|
1273
1273
|
get(t, e, n) {
|
|
1274
1274
|
var r, i;
|
|
1275
1275
|
const s = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
|
|
1276
|
-
if (s &&
|
|
1276
|
+
if (s && Pr.has(s))
|
|
1277
1277
|
return s;
|
|
1278
|
-
if (e ===
|
|
1278
|
+
if (e === Ar)
|
|
1279
1279
|
return t;
|
|
1280
1280
|
let o;
|
|
1281
1281
|
if (t.options.mark) {
|
|
@@ -1284,14 +1284,14 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1284
1284
|
return t.options.strict && ct(d, t.options, !0), d;
|
|
1285
1285
|
}
|
|
1286
1286
|
const u = H(t);
|
|
1287
|
-
if (u instanceof Map &&
|
|
1287
|
+
if (u instanceof Map && Zi.includes(e)) {
|
|
1288
1288
|
if (e === "size")
|
|
1289
|
-
return Object.getOwnPropertyDescriptor(
|
|
1290
|
-
const d =
|
|
1289
|
+
return Object.getOwnPropertyDescriptor(Ft, "size").get.call(t.proxy);
|
|
1290
|
+
const d = Ft[e];
|
|
1291
1291
|
if (d)
|
|
1292
1292
|
return d.bind(t.proxy);
|
|
1293
1293
|
}
|
|
1294
|
-
if (u instanceof Set &&
|
|
1294
|
+
if (u instanceof Set && Xi.includes(e)) {
|
|
1295
1295
|
if (e === "size")
|
|
1296
1296
|
return Object.getOwnPropertyDescriptor(dt, "size").get.call(t.proxy);
|
|
1297
1297
|
const d = dt[e];
|
|
@@ -1299,7 +1299,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1299
1299
|
return d.bind(t.proxy);
|
|
1300
1300
|
}
|
|
1301
1301
|
if (!Ne(u, e)) {
|
|
1302
|
-
const d =
|
|
1302
|
+
const d = Nn(u, e);
|
|
1303
1303
|
return d ? "value" in d ? d.value : (
|
|
1304
1304
|
// !case: support for getter
|
|
1305
1305
|
(i = d.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
|
|
@@ -1309,7 +1309,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1309
1309
|
if (t.options.strict && ct(a, t.options), t.finalized || !ee(a, t.options))
|
|
1310
1310
|
return a;
|
|
1311
1311
|
if (a === jt(t.original, e)) {
|
|
1312
|
-
if (V(t), t.copy[e] =
|
|
1312
|
+
if (V(t), t.copy[e] = un({
|
|
1313
1313
|
original: t.original[e],
|
|
1314
1314
|
parentDraft: t,
|
|
1315
1315
|
key: t.type === 1 ? Number(e) : e,
|
|
@@ -1330,11 +1330,11 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1330
1330
|
let i;
|
|
1331
1331
|
if (t.type === 1 && e !== "length" && !(Number.isInteger(i = Number(e)) && i >= 0 && (e === 0 || i === 0 || String(i) === String(e))))
|
|
1332
1332
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
1333
|
-
const s =
|
|
1333
|
+
const s = Nn(H(t), e);
|
|
1334
1334
|
if (s != null && s.set)
|
|
1335
1335
|
return s.set.call(t.proxy, n), !0;
|
|
1336
1336
|
const o = jt(H(t), e), u = A(o);
|
|
1337
|
-
return u && ae(u.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) : (ae(n, o) && (n !== void 0 || Ne(t.original, e)) || (V(t), ie(t), Ne(t.original, e) && ae(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n,
|
|
1337
|
+
return u && ae(u.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) : (ae(n, o) && (n !== void 0 || Ne(t.original, e)) || (V(t), ie(t), Ne(t.original, e) && ae(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, on(t, e, n, Ve)), !0);
|
|
1338
1338
|
},
|
|
1339
1339
|
has(t, e) {
|
|
1340
1340
|
return e in H(t);
|
|
@@ -1362,10 +1362,10 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1362
1362
|
},
|
|
1363
1363
|
deleteProperty(t, e) {
|
|
1364
1364
|
var n;
|
|
1365
|
-
return t.type === 1 ?
|
|
1365
|
+
return t.type === 1 ? Ir.set.call(this, t, e, void 0, t.proxy) : (jt(t.original, e) !== void 0 || e in t.original ? (V(t), ie(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);
|
|
1366
1366
|
}
|
|
1367
1367
|
};
|
|
1368
|
-
function
|
|
1368
|
+
function un(t) {
|
|
1369
1369
|
const { original: e, parentDraft: n, key: r, finalities: i, options: s } = t, o = me(e), u = {
|
|
1370
1370
|
type: o,
|
|
1371
1371
|
finalized: !1,
|
|
@@ -1379,8 +1379,8 @@ function on(t) {
|
|
|
1379
1379
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
1380
1380
|
};
|
|
1381
1381
|
(r || "key" in t) && (u.key = r);
|
|
1382
|
-
const { proxy: a, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], u) : u,
|
|
1383
|
-
if (i.revoke.push(d),
|
|
1382
|
+
const { proxy: a, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], u) : u, Ir);
|
|
1383
|
+
if (i.revoke.push(d), Pr.add(a), u.proxy = a, n) {
|
|
1384
1384
|
const c = n;
|
|
1385
1385
|
c.finalities.draft.push((f, l) => {
|
|
1386
1386
|
var p, y;
|
|
@@ -1389,7 +1389,7 @@ function on(t) {
|
|
|
1389
1389
|
const m = ce(g, r), T = A(m);
|
|
1390
1390
|
if (T) {
|
|
1391
1391
|
let v = T.original;
|
|
1392
|
-
T.operated && (v =
|
|
1392
|
+
T.operated && (v = rn(m)), Ut(T), Lt(T, Ve, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(v, T.original)), We(g, r, v);
|
|
1393
1393
|
}
|
|
1394
1394
|
(y = b.callbacks) === null || y === void 0 || y.forEach((v) => {
|
|
1395
1395
|
v(f, l);
|
|
@@ -1398,26 +1398,26 @@ function on(t) {
|
|
|
1398
1398
|
} else {
|
|
1399
1399
|
const c = A(a);
|
|
1400
1400
|
c.finalities.draft.push((f, l) => {
|
|
1401
|
-
|
|
1401
|
+
Ut(c), Lt(c, Ve, f, l);
|
|
1402
1402
|
});
|
|
1403
1403
|
}
|
|
1404
1404
|
return a;
|
|
1405
1405
|
}
|
|
1406
|
-
|
|
1407
|
-
function
|
|
1406
|
+
en.createDraft = un;
|
|
1407
|
+
function es(t, e, n, r, i) {
|
|
1408
1408
|
var s;
|
|
1409
1409
|
const o = A(t), u = (s = o == null ? void 0 : o.original) !== null && s !== void 0 ? s : t, a = !!e.length;
|
|
1410
1410
|
if (o != null && o.operated)
|
|
1411
1411
|
for (; o.finalities.draft.length > 0; )
|
|
1412
1412
|
o.finalities.draft.pop()(n, r);
|
|
1413
1413
|
const d = a ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
1414
|
-
return o &&
|
|
1414
|
+
return o && Dt(o), i && Se(d, d, o == null ? void 0 : o.options.updatedValues), [
|
|
1415
1415
|
d,
|
|
1416
1416
|
n && a ? [{ op: x.Replace, path: [], value: e[0] }] : n,
|
|
1417
1417
|
r && a ? [{ op: x.Replace, path: [], value: u }] : r
|
|
1418
1418
|
];
|
|
1419
1419
|
}
|
|
1420
|
-
function
|
|
1420
|
+
function ts(t, e) {
|
|
1421
1421
|
var n;
|
|
1422
1422
|
const r = {
|
|
1423
1423
|
draft: [],
|
|
@@ -1426,7 +1426,7 @@ function es(t, e) {
|
|
|
1426
1426
|
};
|
|
1427
1427
|
let i, s;
|
|
1428
1428
|
e.enablePatches && (i = [], s = []);
|
|
1429
|
-
const u = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, Y)) === Y.mutable || !ee(t, e) ? t :
|
|
1429
|
+
const u = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, Y)) === Y.mutable || !ee(t, e) ? t : un({
|
|
1430
1430
|
original: t,
|
|
1431
1431
|
parentDraft: null,
|
|
1432
1432
|
finalities: r,
|
|
@@ -1435,14 +1435,14 @@ function es(t, e) {
|
|
|
1435
1435
|
return [
|
|
1436
1436
|
u,
|
|
1437
1437
|
(a = []) => {
|
|
1438
|
-
const [d, c, f] =
|
|
1438
|
+
const [d, c, f] = es(u, a, i, s, e.enableAutoFreeze);
|
|
1439
1439
|
return e.enablePatches ? [d, c, f] : d;
|
|
1440
1440
|
}
|
|
1441
1441
|
];
|
|
1442
1442
|
}
|
|
1443
|
-
function
|
|
1443
|
+
function Nt(t) {
|
|
1444
1444
|
const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: i = !0 } = t;
|
|
1445
|
-
|
|
1445
|
+
sn(n, (s, o, u) => {
|
|
1446
1446
|
const a = A(o);
|
|
1447
1447
|
if (a && e && a.finalities === e.finalities) {
|
|
1448
1448
|
t.isContainDraft = !0;
|
|
@@ -1452,10 +1452,10 @@ function Ft(t) {
|
|
|
1452
1452
|
u.clear(), c.forEach((f) => u.add(s === f ? d : f));
|
|
1453
1453
|
} else
|
|
1454
1454
|
We(u, s, d);
|
|
1455
|
-
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1,
|
|
1455
|
+
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, Nt(t));
|
|
1456
1456
|
}), 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."));
|
|
1457
1457
|
}
|
|
1458
|
-
function
|
|
1458
|
+
function Mr(t) {
|
|
1459
1459
|
var e;
|
|
1460
1460
|
const n = A(t);
|
|
1461
1461
|
if (!ee(t, n == null ? void 0 : n.options))
|
|
@@ -1465,7 +1465,7 @@ function Ir(t) {
|
|
|
1465
1465
|
return n.original;
|
|
1466
1466
|
let i;
|
|
1467
1467
|
function s() {
|
|
1468
|
-
i = r === 2 ?
|
|
1468
|
+
i = r === 2 ? nn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : kr(t, n == null ? void 0 : n.options);
|
|
1469
1469
|
}
|
|
1470
1470
|
if (n) {
|
|
1471
1471
|
n.finalized = !0;
|
|
@@ -1476,23 +1476,23 @@ function Ir(t) {
|
|
|
1476
1476
|
}
|
|
1477
1477
|
} else
|
|
1478
1478
|
i = t;
|
|
1479
|
-
if (
|
|
1479
|
+
if (sn(i, (o, u) => {
|
|
1480
1480
|
if (n && ae(ce(n.original, o), u))
|
|
1481
1481
|
return;
|
|
1482
|
-
const a =
|
|
1482
|
+
const a = Mr(u);
|
|
1483
1483
|
a !== u && (i === t && s(), We(i, o, a));
|
|
1484
1484
|
}), r === 3) {
|
|
1485
1485
|
const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : i;
|
|
1486
|
-
return
|
|
1486
|
+
return tn(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
|
|
1487
1487
|
}
|
|
1488
1488
|
return i;
|
|
1489
1489
|
}
|
|
1490
|
-
function
|
|
1490
|
+
function zn(t) {
|
|
1491
1491
|
if (!Te(t))
|
|
1492
1492
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
1493
|
-
return
|
|
1493
|
+
return Mr(t);
|
|
1494
1494
|
}
|
|
1495
|
-
const
|
|
1495
|
+
const ns = (t) => function e(n, r, i) {
|
|
1496
1496
|
var s, o, u;
|
|
1497
1497
|
if (typeof n == "function" && typeof r != "function")
|
|
1498
1498
|
return function(S, ...I) {
|
|
@@ -1503,7 +1503,7 @@ const ts = (t) => function e(n, r, i) {
|
|
|
1503
1503
|
if (typeof r != "function" && (c = r), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
|
|
1504
1504
|
throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
|
|
1505
1505
|
c = Object.assign(Object.assign({}, t), c);
|
|
1506
|
-
const f = Te(a) ?
|
|
1506
|
+
const f = Te(a) ? zn(a) : a, l = Array.isArray(c.mark) ? (S, I) => {
|
|
1507
1507
|
for (const R of c.mark) {
|
|
1508
1508
|
if (typeof R != "function")
|
|
1509
1509
|
throw new Error(`Invalid mark: ${R}, 'mark' should be a function.`);
|
|
@@ -1519,7 +1519,7 @@ const ts = (t) => function e(n, r, i) {
|
|
|
1519
1519
|
};
|
|
1520
1520
|
if (!ee(f, g) && typeof f == "object" && f !== null)
|
|
1521
1521
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1522
|
-
const [m, T] =
|
|
1522
|
+
const [m, T] = ts(f, g);
|
|
1523
1523
|
if (typeof r != "function") {
|
|
1524
1524
|
if (!ee(f, g))
|
|
1525
1525
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
@@ -1529,24 +1529,24 @@ const ts = (t) => function e(n, r, i) {
|
|
|
1529
1529
|
try {
|
|
1530
1530
|
v = d(m);
|
|
1531
1531
|
} catch (S) {
|
|
1532
|
-
throw
|
|
1532
|
+
throw Dt(A(m)), S;
|
|
1533
1533
|
}
|
|
1534
1534
|
const k = (S) => {
|
|
1535
1535
|
const I = A(m);
|
|
1536
1536
|
if (!Te(S)) {
|
|
1537
1537
|
if (S !== void 0 && !ae(S, m) && (I != null && I.operated))
|
|
1538
1538
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
1539
|
-
const q = S == null ? void 0 : S[
|
|
1539
|
+
const q = S == null ? void 0 : S[Vi];
|
|
1540
1540
|
if (q) {
|
|
1541
1541
|
const Ie = q[0];
|
|
1542
|
-
return g.strict && typeof S == "object" && S !== null &&
|
|
1542
|
+
return g.strict && typeof S == "object" && S !== null && Nt({
|
|
1543
1543
|
rootDraft: I,
|
|
1544
1544
|
value: S,
|
|
1545
1545
|
useRawReturn: !0
|
|
1546
1546
|
}), T([Ie]);
|
|
1547
1547
|
}
|
|
1548
1548
|
if (S !== void 0)
|
|
1549
|
-
return typeof S == "object" && S !== null &&
|
|
1549
|
+
return typeof S == "object" && S !== null && Nt({ rootDraft: I, value: S }), T([S]);
|
|
1550
1550
|
}
|
|
1551
1551
|
if (S === m || S === void 0)
|
|
1552
1552
|
return T([]);
|
|
@@ -1554,26 +1554,26 @@ const ts = (t) => function e(n, r, i) {
|
|
|
1554
1554
|
if (g === R.options) {
|
|
1555
1555
|
if (R.operated)
|
|
1556
1556
|
throw new Error("Cannot return a modified child draft.");
|
|
1557
|
-
return T([
|
|
1557
|
+
return T([zn(S)]);
|
|
1558
1558
|
}
|
|
1559
1559
|
return T([S]);
|
|
1560
1560
|
};
|
|
1561
1561
|
return v instanceof Promise ? v.then(k, (S) => {
|
|
1562
|
-
throw
|
|
1562
|
+
throw Dt(A(m)), S;
|
|
1563
1563
|
}) : k(v);
|
|
1564
|
-
}, ft =
|
|
1564
|
+
}, ft = ns();
|
|
1565
1565
|
Object.prototype.constructor.toString();
|
|
1566
|
-
function
|
|
1566
|
+
function Rr(t, e) {
|
|
1567
1567
|
const n = Object.keys(t), r = Object.keys(e);
|
|
1568
1568
|
return n.length === r.length && Object.keys(t).every((i) => e.hasOwnProperty(i));
|
|
1569
1569
|
}
|
|
1570
|
-
function
|
|
1570
|
+
function Vn(t, e) {
|
|
1571
1571
|
return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((n) => e.hasOwnProperty(n) && t[n] === e[n]);
|
|
1572
1572
|
}
|
|
1573
1573
|
function ut(t, e) {
|
|
1574
|
-
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e :
|
|
1574
|
+
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : Rr(t, e) ? Object.keys(t).every((n) => ut(t[n], e[n])) : !1;
|
|
1575
1575
|
}
|
|
1576
|
-
function
|
|
1576
|
+
function an(t) {
|
|
1577
1577
|
if (!Le(t))
|
|
1578
1578
|
return t;
|
|
1579
1579
|
const e = {};
|
|
@@ -1581,7 +1581,7 @@ function un(t) {
|
|
|
1581
1581
|
r !== void 0 && (e[n] = r);
|
|
1582
1582
|
return e;
|
|
1583
1583
|
}
|
|
1584
|
-
function
|
|
1584
|
+
function $r(t, e) {
|
|
1585
1585
|
if (!Le(t) || !Le(e))
|
|
1586
1586
|
return e;
|
|
1587
1587
|
const n = Object.assign({}, t);
|
|
@@ -1593,14 +1593,14 @@ function Rr(t, e) {
|
|
|
1593
1593
|
continue;
|
|
1594
1594
|
}
|
|
1595
1595
|
const i = Le(t[r]) && Le(e[r]);
|
|
1596
|
-
n[r] = i ?
|
|
1596
|
+
n[r] = i ? $r(t[r], e[r]) : e[r];
|
|
1597
1597
|
}
|
|
1598
1598
|
return n;
|
|
1599
1599
|
}
|
|
1600
1600
|
function Le(t) {
|
|
1601
1601
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
1602
1602
|
}
|
|
1603
|
-
function
|
|
1603
|
+
function rs(t, e, n) {
|
|
1604
1604
|
if (!t || e.length === 0)
|
|
1605
1605
|
return;
|
|
1606
1606
|
let r = t || {};
|
|
@@ -1611,7 +1611,7 @@ function ns(t, e, n) {
|
|
|
1611
1611
|
const i = e[e.length - 1];
|
|
1612
1612
|
Array.isArray(r) && typeof i == "number" ? r.splice(i, 0, n) : r[i] = n;
|
|
1613
1613
|
}
|
|
1614
|
-
function
|
|
1614
|
+
function Wn(t, e, n) {
|
|
1615
1615
|
if (!t || e.length === 0)
|
|
1616
1616
|
return;
|
|
1617
1617
|
let r = t || {};
|
|
@@ -1621,7 +1621,7 @@ function Vn(t, e, n) {
|
|
|
1621
1621
|
}
|
|
1622
1622
|
r[e[e.length - 1]] = n;
|
|
1623
1623
|
}
|
|
1624
|
-
function
|
|
1624
|
+
function xr(t, e) {
|
|
1625
1625
|
if (!t || e.length === 0)
|
|
1626
1626
|
return;
|
|
1627
1627
|
const [n, ...r] = e;
|
|
@@ -1630,13 +1630,13 @@ function $r(t, e) {
|
|
|
1630
1630
|
Array.isArray(t) ? t.splice(n, 1) : delete t[n];
|
|
1631
1631
|
return;
|
|
1632
1632
|
}
|
|
1633
|
-
|
|
1633
|
+
xr(t[n], r), is(t[n]) && delete t[n];
|
|
1634
1634
|
}
|
|
1635
1635
|
}
|
|
1636
|
-
function
|
|
1636
|
+
function is(t) {
|
|
1637
1637
|
return t && Object.keys(t).length === 0;
|
|
1638
1638
|
}
|
|
1639
|
-
const
|
|
1639
|
+
const Bn = /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$/, ss = {
|
|
1640
1640
|
ZULU: 0,
|
|
1641
1641
|
YEKT: 18e3,
|
|
1642
1642
|
YEKST: 21600,
|
|
@@ -1832,39 +1832,39 @@ const Wn = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
|
|
|
1832
1832
|
ACSST: 37800,
|
|
1833
1833
|
ACDT: 37800
|
|
1834
1834
|
};
|
|
1835
|
-
function
|
|
1835
|
+
function os(t) {
|
|
1836
1836
|
return new Date(t);
|
|
1837
1837
|
}
|
|
1838
|
-
function
|
|
1838
|
+
function us(t) {
|
|
1839
1839
|
return /* @__PURE__ */ new Date(t + "Z");
|
|
1840
1840
|
}
|
|
1841
|
-
const
|
|
1842
|
-
function
|
|
1843
|
-
const e = t.match(
|
|
1841
|
+
const as = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
|
|
1842
|
+
function cs(t) {
|
|
1843
|
+
const e = t.match(as);
|
|
1844
1844
|
if (!e)
|
|
1845
1845
|
return null;
|
|
1846
1846
|
const [n, r, i, s] = e;
|
|
1847
1847
|
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));
|
|
1848
1848
|
}
|
|
1849
|
-
function
|
|
1849
|
+
function ds(t) {
|
|
1850
1850
|
const [e, n] = t.split(" ");
|
|
1851
1851
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1852
1852
|
}
|
|
1853
|
-
function
|
|
1853
|
+
function fs(t) {
|
|
1854
1854
|
const [e, n] = t.split(" ");
|
|
1855
1855
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1856
1856
|
}
|
|
1857
|
-
function
|
|
1857
|
+
function ls(t) {
|
|
1858
1858
|
return new Date(t);
|
|
1859
1859
|
}
|
|
1860
|
-
function
|
|
1860
|
+
function hs(t) {
|
|
1861
1861
|
const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
|
|
1862
1862
|
if (!t.match(e))
|
|
1863
1863
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1864
1864
|
const r = /* @__PURE__ */ new Date(t + " UTC");
|
|
1865
1865
|
return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate(), 0, 0, 0, 0));
|
|
1866
1866
|
}
|
|
1867
|
-
function
|
|
1867
|
+
function ps(t) {
|
|
1868
1868
|
const e = /^(.+T.+)([+-])(\d{2})$/, n = t.match(e);
|
|
1869
1869
|
if (n) {
|
|
1870
1870
|
const [, r, i, s] = n, o = `${r}${i}${s}:00`;
|
|
@@ -1872,7 +1872,7 @@ function hs(t) {
|
|
|
1872
1872
|
}
|
|
1873
1873
|
return null;
|
|
1874
1874
|
}
|
|
1875
|
-
function
|
|
1875
|
+
function ys(t) {
|
|
1876
1876
|
const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, n = t.match(e);
|
|
1877
1877
|
if (n) {
|
|
1878
1878
|
const [, r, i, s, o, u] = n, a = i.padStart(2, "0"), d = s.padStart(2, "0"), c = `${r}-${a}-${d}T${u}`;
|
|
@@ -1880,14 +1880,14 @@ function ps(t) {
|
|
|
1880
1880
|
}
|
|
1881
1881
|
return null;
|
|
1882
1882
|
}
|
|
1883
|
-
function
|
|
1883
|
+
function bs(t) {
|
|
1884
1884
|
const [e, n] = t.split(", "), [r, i, s] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1885
1885
|
if (!o)
|
|
1886
1886
|
throw new Error(`Unable to parse time from: ${t}`);
|
|
1887
1887
|
let [, u, a, d, c] = o;
|
|
1888
1888
|
return u = Number(u), a = Number(a), d = Number(d), c === "PM" && u !== 12 ? u += 12 : c === "AM" && u === 12 && (u = 0), new Date(Date.UTC(s, r - 1, i, u, a, d));
|
|
1889
1889
|
}
|
|
1890
|
-
function
|
|
1890
|
+
function _s(t) {
|
|
1891
1891
|
switch (t) {
|
|
1892
1892
|
case "epoch":
|
|
1893
1893
|
return /* @__PURE__ */ new Date(0);
|
|
@@ -1899,28 +1899,28 @@ function bs(t) {
|
|
|
1899
1899
|
return null;
|
|
1900
1900
|
}
|
|
1901
1901
|
}
|
|
1902
|
-
function
|
|
1903
|
-
const e = t.match(
|
|
1902
|
+
function gs(t) {
|
|
1903
|
+
const e = t.match(Bn);
|
|
1904
1904
|
if (!e)
|
|
1905
1905
|
return null;
|
|
1906
|
-
const [n] = e, r =
|
|
1906
|
+
const [n] = e, r = ss[n], i = new Date(t.replace(Bn, "Z"));
|
|
1907
1907
|
return new Date(i.getTime() - r * 1e3);
|
|
1908
1908
|
}
|
|
1909
|
-
const
|
|
1910
|
-
|
|
1911
|
-
ds,
|
|
1912
|
-
ls,
|
|
1913
|
-
ys,
|
|
1909
|
+
const Ts = [
|
|
1910
|
+
cs,
|
|
1914
1911
|
fs,
|
|
1915
|
-
os,
|
|
1916
1912
|
hs,
|
|
1917
|
-
cs,
|
|
1918
|
-
ss,
|
|
1919
1913
|
bs,
|
|
1914
|
+
ls,
|
|
1915
|
+
us,
|
|
1916
|
+
ps,
|
|
1917
|
+
ds,
|
|
1918
|
+
os,
|
|
1920
1919
|
_s,
|
|
1921
|
-
|
|
1920
|
+
gs,
|
|
1921
|
+
ys
|
|
1922
1922
|
];
|
|
1923
|
-
function
|
|
1923
|
+
function ms(t, e) {
|
|
1924
1924
|
try {
|
|
1925
1925
|
const n = t(e);
|
|
1926
1926
|
return n instanceof Date && !isNaN(n.getTime()) ? n : null;
|
|
@@ -1928,18 +1928,18 @@ function Ts(t, e) {
|
|
|
1928
1928
|
return null;
|
|
1929
1929
|
}
|
|
1930
1930
|
}
|
|
1931
|
-
function
|
|
1932
|
-
for (const e of
|
|
1933
|
-
const n =
|
|
1931
|
+
function Kt(t) {
|
|
1932
|
+
for (const e of Ts) {
|
|
1933
|
+
const n = ms(e, t);
|
|
1934
1934
|
if (n)
|
|
1935
1935
|
return n;
|
|
1936
1936
|
}
|
|
1937
1937
|
return null;
|
|
1938
1938
|
}
|
|
1939
|
-
function
|
|
1939
|
+
function ws(t) {
|
|
1940
1940
|
try {
|
|
1941
1941
|
const e = JSON.parse(t);
|
|
1942
|
-
return typeof e == "string" ?
|
|
1942
|
+
return typeof e == "string" ? Kt(e) : null;
|
|
1943
1943
|
} catch {
|
|
1944
1944
|
return null;
|
|
1945
1945
|
}
|
|
@@ -1951,7 +1951,7 @@ function pt(t) {
|
|
|
1951
1951
|
if (t instanceof Date)
|
|
1952
1952
|
return t;
|
|
1953
1953
|
if (typeof t == "string") {
|
|
1954
|
-
const e =
|
|
1954
|
+
const e = Kt(t) || ws(t) || Kt(t.trim());
|
|
1955
1955
|
if (!e)
|
|
1956
1956
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1957
1957
|
return e;
|
|
@@ -1960,13 +1960,13 @@ function pt(t) {
|
|
|
1960
1960
|
throw new Error(`Invalid date value \`${t}\`. Expected a date, number, or string, got type ${typeof t}.`);
|
|
1961
1961
|
}
|
|
1962
1962
|
}
|
|
1963
|
-
function
|
|
1963
|
+
function vs(t) {
|
|
1964
1964
|
return t.cardinality === "one";
|
|
1965
1965
|
}
|
|
1966
|
-
function
|
|
1966
|
+
function cn(t) {
|
|
1967
1967
|
return t["value-type"] === "ref";
|
|
1968
1968
|
}
|
|
1969
|
-
function
|
|
1969
|
+
function dn(t) {
|
|
1970
1970
|
return t["value-type"] === "blob";
|
|
1971
1971
|
}
|
|
1972
1972
|
function ke(t, e) {
|
|
@@ -1996,7 +1996,7 @@ function B(t, e, n) {
|
|
|
1996
1996
|
let s = t.get(r);
|
|
1997
1997
|
s || (s = /* @__PURE__ */ new Map(), t.set(r, s)), B(s, i, n);
|
|
1998
1998
|
}
|
|
1999
|
-
function
|
|
1999
|
+
function Dr(t, e, n) {
|
|
2000
2000
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
2001
2001
|
for (const o of e) {
|
|
2002
2002
|
let [u, a, d, c] = o;
|
|
@@ -2005,22 +2005,22 @@ function xr(t, e, n) {
|
|
|
2005
2005
|
console.warn("no such attr", u, t);
|
|
2006
2006
|
continue;
|
|
2007
2007
|
}
|
|
2008
|
-
f["checked-data-type"] === "date" && n && (d = pt(d), o[2] = d),
|
|
2008
|
+
f["checked-data-type"] === "date" && n && (d = pt(d), o[2] = d), cn(f) && B(s, [d, a, u], o), B(r, [u, a, d], o), B(i, [a, u, d], o);
|
|
2009
2009
|
}
|
|
2010
2010
|
return { eav: r, aev: i, vae: s };
|
|
2011
2011
|
}
|
|
2012
|
-
function
|
|
2012
|
+
function Ur(t) {
|
|
2013
2013
|
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
2014
2014
|
for (const s of Object.values(t)) {
|
|
2015
2015
|
const o = s["forward-identity"], [u, a, d] = o, c = s["reverse-identity"];
|
|
2016
|
-
if (B(r, [a, d], s),
|
|
2016
|
+
if (B(r, [a, d], s), dn(s) && B(e, [a, d], s), s["primary?"] && B(n, [a], s), c) {
|
|
2017
2017
|
const [f, l, p] = c;
|
|
2018
2018
|
B(i, [l, p], s);
|
|
2019
2019
|
}
|
|
2020
2020
|
}
|
|
2021
2021
|
return { blobAttrs: e, primaryKeys: n, forwardIdents: r, revIdents: i };
|
|
2022
2022
|
}
|
|
2023
|
-
function
|
|
2023
|
+
function Lr(t) {
|
|
2024
2024
|
return {
|
|
2025
2025
|
__type: t.__type,
|
|
2026
2026
|
attrs: t.attrs,
|
|
@@ -2030,18 +2030,18 @@ function Ur(t) {
|
|
|
2030
2030
|
useDateObjects: t.useDateObjects
|
|
2031
2031
|
};
|
|
2032
2032
|
}
|
|
2033
|
-
function
|
|
2033
|
+
function Fr(t) {
|
|
2034
2034
|
return at(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
|
|
2035
2035
|
}
|
|
2036
|
-
function
|
|
2036
|
+
function Ss(t, e) {
|
|
2037
2037
|
return Ce(t.eav, [e]) !== void 0;
|
|
2038
2038
|
}
|
|
2039
|
-
function
|
|
2040
|
-
t.attrIndexes =
|
|
2039
|
+
function fn(t) {
|
|
2040
|
+
t.attrIndexes = Ur(t.attrs);
|
|
2041
2041
|
}
|
|
2042
2042
|
function at(t, e, n, r, i) {
|
|
2043
|
-
const s =
|
|
2044
|
-
return s.useDateObjects = i, s.attrs = t, s.attrIndexes =
|
|
2043
|
+
const s = Dr(t, e, i);
|
|
2044
|
+
return s.useDateObjects = i, s.attrs = t, s.attrIndexes = Ur(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
|
|
2045
2045
|
}
|
|
2046
2046
|
function Be(t, e) {
|
|
2047
2047
|
var n, r;
|
|
@@ -2070,21 +2070,21 @@ function Be(t, e) {
|
|
|
2070
2070
|
return [i, ...u];
|
|
2071
2071
|
}
|
|
2072
2072
|
}
|
|
2073
|
-
function
|
|
2073
|
+
function Nr(t, e) {
|
|
2074
2074
|
const n = Be(t, e);
|
|
2075
2075
|
if (!n)
|
|
2076
2076
|
return;
|
|
2077
2077
|
const [r, i, s] = n, o = ke(t.attrs, i);
|
|
2078
|
-
o && (X(t.eav, [r, i, s]), X(t.aev, [i, r, s]),
|
|
2078
|
+
o && (X(t.eav, [r, i, s]), X(t.aev, [i, r, s]), cn(o) && X(t.vae, [s, i, r]));
|
|
2079
2079
|
}
|
|
2080
|
-
let
|
|
2081
|
-
function
|
|
2080
|
+
let Os = 0;
|
|
2081
|
+
function Kr(t, e, n) {
|
|
2082
2082
|
const [r, i, s] = n;
|
|
2083
2083
|
let o;
|
|
2084
2084
|
const u = Ce(t.eav, [r, i, s]);
|
|
2085
|
-
return u && (o = u[3]), o || Date.now() * 10 +
|
|
2085
|
+
return u && (o = u[3]), o || Date.now() * 10 + Os++;
|
|
2086
2086
|
}
|
|
2087
|
-
function
|
|
2087
|
+
function qr(t, e) {
|
|
2088
2088
|
var n;
|
|
2089
2089
|
const r = Be(t, e);
|
|
2090
2090
|
if (!r)
|
|
@@ -2094,10 +2094,10 @@ function Kr(t, e) {
|
|
|
2094
2094
|
if (!u)
|
|
2095
2095
|
return;
|
|
2096
2096
|
u["checked-data-type"] === "date" && t.useDateObjects && (o = pt(o));
|
|
2097
|
-
const a = Ce(t.eav, [i, s, o]), d = (n = a == null ? void 0 : a[3]) !== null && n !== void 0 ? n :
|
|
2098
|
-
|
|
2097
|
+
const a = Ce(t.eav, [i, s, o]), d = (n = a == null ? void 0 : a[3]) !== null && n !== void 0 ? n : Kr(t, u, r), c = [i, s, o, d];
|
|
2098
|
+
vs(u) ? (B(t.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), B(t.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (B(t.eav, [i, s, o], c), B(t.aev, [s, i, o], c)), cn(u) && B(t.vae, [o, s, i], c);
|
|
2099
2099
|
}
|
|
2100
|
-
function
|
|
2100
|
+
function Es(t, e) {
|
|
2101
2101
|
var n;
|
|
2102
2102
|
const r = Be(t, e);
|
|
2103
2103
|
if (!r)
|
|
@@ -2105,7 +2105,7 @@ function Os(t, e) {
|
|
|
2105
2105
|
const [i, s, o] = r, u = ke(t.attrs, s);
|
|
2106
2106
|
if (!u)
|
|
2107
2107
|
return;
|
|
2108
|
-
if (!
|
|
2108
|
+
if (!dn(u))
|
|
2109
2109
|
throw new Error("merge operation is not supported for links");
|
|
2110
2110
|
const a = Ce(t.eav, [i, s]);
|
|
2111
2111
|
if (!a)
|
|
@@ -2113,15 +2113,15 @@ function Os(t, e) {
|
|
|
2113
2113
|
const d = (n = a.values().next()) === null || n === void 0 ? void 0 : n.value;
|
|
2114
2114
|
if (!d)
|
|
2115
2115
|
return;
|
|
2116
|
-
const c = d[2], f =
|
|
2116
|
+
const c = d[2], f = $r(c, o), l = [
|
|
2117
2117
|
i,
|
|
2118
2118
|
s,
|
|
2119
2119
|
f,
|
|
2120
|
-
|
|
2120
|
+
Kr(t, u, d)
|
|
2121
2121
|
];
|
|
2122
2122
|
B(t.eav, [i, s], /* @__PURE__ */ new Map([[f, l]]));
|
|
2123
2123
|
}
|
|
2124
|
-
function
|
|
2124
|
+
function qt(t, e) {
|
|
2125
2125
|
var n, r;
|
|
2126
2126
|
const [i, s] = e, o = Be(t, [i]);
|
|
2127
2127
|
if (!o)
|
|
@@ -2132,7 +2132,7 @@ function Kt(t, e) {
|
|
|
2132
2132
|
const f = t.attrs[c];
|
|
2133
2133
|
f && f["on-delete-reverse"] === "cascade" && G(a.get(c), 1).forEach(([l, p, y]) => {
|
|
2134
2134
|
var b;
|
|
2135
|
-
return
|
|
2135
|
+
return qt(t, [y, (b = f["reverse-identity"]) === null || b === void 0 ? void 0 : b[1]]);
|
|
2136
2136
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
2137
2137
|
// the store that didn't set `etype` in deleteEntity
|
|
2138
2138
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
@@ -2145,54 +2145,54 @@ function Kt(t, e) {
|
|
|
2145
2145
|
d && d.forEach((c) => {
|
|
2146
2146
|
var f, l, p;
|
|
2147
2147
|
const [y, b, g] = c, m = t.attrs[b];
|
|
2148
|
-
(!s || !m || ((f = m["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (X(t.eav, [y, b, g]), X(t.aev, [b, y, g]), X(t.vae, [g, b, y])), m && m["on-delete"] === "cascade" && ((l = m["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s &&
|
|
2148
|
+
(!s || !m || ((f = m["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (X(t.eav, [y, b, g]), X(t.aev, [b, y, g]), X(t.vae, [g, b, y])), m && m["on-delete"] === "cascade" && ((l = m["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && qt(t, [y, (p = m["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
|
|
2149
2149
|
}), ((r = t.vae.get(u)) === null || r === void 0 ? void 0 : r.size) === 0 && X(t.vae, [u]);
|
|
2150
2150
|
}
|
|
2151
|
-
function
|
|
2152
|
-
const n =
|
|
2151
|
+
function zr(t, e) {
|
|
2152
|
+
const n = Dr(t.attrs, e, t.useDateObjects);
|
|
2153
2153
|
Object.keys(n).forEach((r) => {
|
|
2154
2154
|
t[r] = n[r];
|
|
2155
2155
|
});
|
|
2156
2156
|
}
|
|
2157
|
-
function
|
|
2158
|
-
t.attrs[e.id] = e,
|
|
2157
|
+
function As(t, [e]) {
|
|
2158
|
+
t.attrs[e.id] = e, fn(t);
|
|
2159
2159
|
}
|
|
2160
|
-
function
|
|
2160
|
+
function Vr(t) {
|
|
2161
2161
|
return G(t.eav, 3);
|
|
2162
2162
|
}
|
|
2163
|
-
function
|
|
2163
|
+
function js(t, [e]) {
|
|
2164
2164
|
if (!t.attrs[e])
|
|
2165
2165
|
return;
|
|
2166
|
-
const n =
|
|
2167
|
-
delete t.attrs[e],
|
|
2166
|
+
const n = Vr(t).filter(([r, i]) => i !== e);
|
|
2167
|
+
delete t.attrs[e], fn(t), zr(t, n);
|
|
2168
2168
|
}
|
|
2169
|
-
function
|
|
2169
|
+
function ks(t, [e]) {
|
|
2170
2170
|
const n = t.attrs[e.id];
|
|
2171
|
-
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e),
|
|
2171
|
+
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), fn(t), zr(t, Vr(t)));
|
|
2172
2172
|
}
|
|
2173
|
-
function
|
|
2173
|
+
function Cs(t, e) {
|
|
2174
2174
|
const [n, ...r] = e;
|
|
2175
2175
|
switch (n) {
|
|
2176
2176
|
case "add-triple":
|
|
2177
|
-
|
|
2177
|
+
qr(t, r);
|
|
2178
2178
|
break;
|
|
2179
2179
|
case "deep-merge-triple":
|
|
2180
|
-
|
|
2180
|
+
Es(t, r);
|
|
2181
2181
|
break;
|
|
2182
2182
|
case "retract-triple":
|
|
2183
|
-
|
|
2183
|
+
Nr(t, r);
|
|
2184
2184
|
break;
|
|
2185
2185
|
case "delete-entity":
|
|
2186
|
-
|
|
2186
|
+
qt(t, r);
|
|
2187
2187
|
break;
|
|
2188
2188
|
case "add-attr":
|
|
2189
|
-
|
|
2189
|
+
As(t, r);
|
|
2190
2190
|
break;
|
|
2191
2191
|
case "delete-attr":
|
|
2192
|
-
|
|
2192
|
+
js(t, r);
|
|
2193
2193
|
break;
|
|
2194
2194
|
case "update-attr":
|
|
2195
|
-
|
|
2195
|
+
ks(t, r);
|
|
2196
2196
|
break;
|
|
2197
2197
|
case "restore-attr":
|
|
2198
2198
|
break;
|
|
@@ -2247,13 +2247,13 @@ function tt(t, e, n) {
|
|
|
2247
2247
|
}
|
|
2248
2248
|
return i;
|
|
2249
2249
|
}
|
|
2250
|
-
function
|
|
2250
|
+
function Ps(t, e, n) {
|
|
2251
2251
|
let r = "";
|
|
2252
2252
|
return t !== void 0 && (r += "e"), e !== void 0 && (r += "a"), n !== void 0 && (r += "v"), r;
|
|
2253
2253
|
}
|
|
2254
|
-
function
|
|
2254
|
+
function Is(t, [e, n, r]) {
|
|
2255
2255
|
var i, s;
|
|
2256
|
-
switch (
|
|
2256
|
+
switch (Ps(e, n, r)) {
|
|
2257
2257
|
case "e": {
|
|
2258
2258
|
const u = t.eav.get(e);
|
|
2259
2259
|
return G(u, 2);
|
|
@@ -2299,33 +2299,36 @@ function Ps(t, [e, n, r]) {
|
|
|
2299
2299
|
return G(t.eav, 3);
|
|
2300
2300
|
}
|
|
2301
2301
|
}
|
|
2302
|
-
|
|
2302
|
+
const kt = {};
|
|
2303
|
+
function Ms(t, e, n) {
|
|
2303
2304
|
var r;
|
|
2305
|
+
if (kt[n])
|
|
2306
|
+
return kt[n];
|
|
2304
2307
|
const i = {};
|
|
2305
2308
|
for (const [s, o] of e.entries()) {
|
|
2306
2309
|
const u = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), a = G(u, 1);
|
|
2307
2310
|
for (const d of a)
|
|
2308
2311
|
i[s] = d[2];
|
|
2309
2312
|
}
|
|
2310
|
-
return i;
|
|
2313
|
+
return kt[n] = i, i;
|
|
2311
2314
|
}
|
|
2312
2315
|
function fe(t, e, n) {
|
|
2313
2316
|
var r;
|
|
2314
2317
|
return (r = t.attrIndexes.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
2315
2318
|
}
|
|
2316
|
-
function
|
|
2319
|
+
function Wr(t, e, n) {
|
|
2317
2320
|
var r;
|
|
2318
2321
|
return (r = t.attrIndexes.revIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
2319
2322
|
}
|
|
2320
|
-
function
|
|
2323
|
+
function Rs(t, e) {
|
|
2321
2324
|
return t.attrIndexes.blobAttrs.get(e);
|
|
2322
2325
|
}
|
|
2323
|
-
function
|
|
2326
|
+
function Br(t, e) {
|
|
2324
2327
|
var n;
|
|
2325
2328
|
const r = t.attrIndexes.primaryKeys.get(e);
|
|
2326
2329
|
return r || ((n = t.attrIndexes.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
|
|
2327
2330
|
}
|
|
2328
|
-
function
|
|
2331
|
+
function $s(t, e) {
|
|
2329
2332
|
const n = Be(t, e);
|
|
2330
2333
|
if (!n)
|
|
2331
2334
|
return;
|
|
@@ -2333,7 +2336,7 @@ function Rs(t, e) {
|
|
|
2333
2336
|
if (ke(t.attrs, i))
|
|
2334
2337
|
return Ce(t.eav, [r, i]);
|
|
2335
2338
|
}
|
|
2336
|
-
function
|
|
2339
|
+
function xs(t, e) {
|
|
2337
2340
|
const n = e.filter(([r, i, s, o, u]) => {
|
|
2338
2341
|
if (r !== "add-triple" && r !== "deep-merge-triple")
|
|
2339
2342
|
return !0;
|
|
@@ -2343,8 +2346,8 @@ function $s(t, e) {
|
|
|
2343
2346
|
let d = !1;
|
|
2344
2347
|
const c = ke(t.attrs, s);
|
|
2345
2348
|
if (c) {
|
|
2346
|
-
const f =
|
|
2347
|
-
d =
|
|
2349
|
+
const f = Br(t, c["forward-identity"][1]);
|
|
2350
|
+
d = !!$s(t, [
|
|
2348
2351
|
i,
|
|
2349
2352
|
f == null ? void 0 : f.id,
|
|
2350
2353
|
i
|
|
@@ -2354,32 +2357,32 @@ function $s(t, e) {
|
|
|
2354
2357
|
});
|
|
2355
2358
|
return ft(t, (r) => {
|
|
2356
2359
|
n.forEach((i) => {
|
|
2357
|
-
|
|
2360
|
+
Cs(r, i);
|
|
2358
2361
|
});
|
|
2359
2362
|
});
|
|
2360
2363
|
}
|
|
2361
|
-
function
|
|
2364
|
+
function Ds(t) {
|
|
2362
2365
|
return typeof t == "string" && t.startsWith("?");
|
|
2363
2366
|
}
|
|
2364
|
-
function
|
|
2367
|
+
function Us(t, e, n) {
|
|
2365
2368
|
if (n.hasOwnProperty(t)) {
|
|
2366
2369
|
const r = n[t];
|
|
2367
|
-
return
|
|
2370
|
+
return Gr(r, e, n);
|
|
2368
2371
|
}
|
|
2369
2372
|
return Object.assign(Object.assign({}, n), { [t]: e });
|
|
2370
2373
|
}
|
|
2371
|
-
function
|
|
2374
|
+
function Gn(t, e, n) {
|
|
2372
2375
|
return t === e ? n : null;
|
|
2373
2376
|
}
|
|
2374
|
-
function
|
|
2377
|
+
function Ls(t) {
|
|
2375
2378
|
switch (typeof t) {
|
|
2376
2379
|
case "string":
|
|
2377
|
-
return t.startsWith("?") ?
|
|
2380
|
+
return t.startsWith("?") ? Us : Gn;
|
|
2378
2381
|
default:
|
|
2379
|
-
return
|
|
2382
|
+
return Gn;
|
|
2380
2383
|
}
|
|
2381
2384
|
}
|
|
2382
|
-
const
|
|
2385
|
+
const Fs = [
|
|
2383
2386
|
"in",
|
|
2384
2387
|
"$in",
|
|
2385
2388
|
"$not",
|
|
@@ -2387,77 +2390,77 @@ const Ls = [
|
|
|
2387
2390
|
"$comparator"
|
|
2388
2391
|
// covers all of $gt, $lt, etc.
|
|
2389
2392
|
];
|
|
2390
|
-
function
|
|
2391
|
-
for (const e of
|
|
2393
|
+
function Ns(t) {
|
|
2394
|
+
for (const e of Fs)
|
|
2392
2395
|
if (t.hasOwnProperty(e))
|
|
2393
2396
|
return !0;
|
|
2394
2397
|
return !1;
|
|
2395
2398
|
}
|
|
2396
|
-
function
|
|
2397
|
-
return n ? typeof t == "object" ?
|
|
2399
|
+
function Gr(t, e, n) {
|
|
2400
|
+
return n ? typeof t == "object" ? Ns(t) ? n : null : Ls(t)(t, e, n) : null;
|
|
2398
2401
|
}
|
|
2399
|
-
function
|
|
2402
|
+
function Ks(t, e, n) {
|
|
2400
2403
|
return t.reduce((r, i, s) => {
|
|
2401
2404
|
const o = e[s];
|
|
2402
|
-
return
|
|
2405
|
+
return Gr(i, o, r);
|
|
2403
2406
|
}, n);
|
|
2404
2407
|
}
|
|
2405
|
-
function Ks(t, e, n) {
|
|
2406
|
-
return Vs(t, e, n).map((r) => Ns(e, r, n)).filter((r) => r);
|
|
2407
|
-
}
|
|
2408
2408
|
function qs(t, e, n) {
|
|
2409
|
-
return
|
|
2409
|
+
return Ws(t, e, n).map((r) => Ks(e, r, n)).filter((r) => r);
|
|
2410
|
+
}
|
|
2411
|
+
function zs(t, e, n) {
|
|
2412
|
+
return e.or ? e.or.patterns.flatMap((r) => zt(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => zt(t, i, r), n) : n.flatMap((r) => qs(t, e, r));
|
|
2410
2413
|
}
|
|
2411
|
-
function
|
|
2412
|
-
return e.reduce((r, i) =>
|
|
2414
|
+
function zt(t, e, n = [{}]) {
|
|
2415
|
+
return e.reduce((r, i) => zs(t, i, r), n);
|
|
2413
2416
|
}
|
|
2414
|
-
function
|
|
2415
|
-
return Array.isArray(e) ? e.map((n) =>
|
|
2417
|
+
function ln(t, e) {
|
|
2418
|
+
return Array.isArray(e) ? e.map((n) => ln(t, n)) : Ds(e) ? t[e] : e;
|
|
2416
2419
|
}
|
|
2417
|
-
function
|
|
2418
|
-
return
|
|
2420
|
+
function Vs(t, { find: e, where: n }) {
|
|
2421
|
+
return zt(t, n).map((i) => ln(i, e));
|
|
2419
2422
|
}
|
|
2420
|
-
function
|
|
2421
|
-
return
|
|
2423
|
+
function Ws(t, e, n) {
|
|
2424
|
+
return Is(t, ln(n, e));
|
|
2422
2425
|
}
|
|
2423
|
-
const
|
|
2426
|
+
const Bs = /^(?:[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;
|
|
2424
2427
|
function Ee(t) {
|
|
2425
|
-
return typeof t == "string" &&
|
|
2428
|
+
return typeof t == "string" && Bs.test(t);
|
|
2426
2429
|
}
|
|
2427
2430
|
const F = [];
|
|
2428
2431
|
for (let t = 0; t < 256; ++t)
|
|
2429
2432
|
F.push((t + 256).toString(16).slice(1));
|
|
2430
|
-
function
|
|
2433
|
+
function Gs(t, e = 0) {
|
|
2431
2434
|
return (F[t[e + 0]] + F[t[e + 1]] + F[t[e + 2]] + F[t[e + 3]] + "-" + F[t[e + 4]] + F[t[e + 5]] + "-" + F[t[e + 6]] + F[t[e + 7]] + "-" + F[t[e + 8]] + F[t[e + 9]] + "-" + F[t[e + 10]] + F[t[e + 11]] + F[t[e + 12]] + F[t[e + 13]] + F[t[e + 14]] + F[t[e + 15]]).toLowerCase();
|
|
2432
2435
|
}
|
|
2433
|
-
let
|
|
2434
|
-
const
|
|
2435
|
-
function
|
|
2436
|
-
if (!
|
|
2436
|
+
let Ct;
|
|
2437
|
+
const Qs = new Uint8Array(16);
|
|
2438
|
+
function Hs() {
|
|
2439
|
+
if (!Ct) {
|
|
2437
2440
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
2438
2441
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
2439
|
-
|
|
2442
|
+
Ct = crypto.getRandomValues.bind(crypto);
|
|
2440
2443
|
}
|
|
2441
|
-
return
|
|
2444
|
+
return Ct(Qs);
|
|
2442
2445
|
}
|
|
2443
|
-
const
|
|
2444
|
-
function
|
|
2446
|
+
const Ys = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Qn = { randomUUID: Ys };
|
|
2447
|
+
function Js(t, e, n) {
|
|
2445
2448
|
var i;
|
|
2446
|
-
if (
|
|
2447
|
-
return
|
|
2449
|
+
if (Qn.randomUUID && !t)
|
|
2450
|
+
return Qn.randomUUID();
|
|
2448
2451
|
t = t || {};
|
|
2449
|
-
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ??
|
|
2452
|
+
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? Hs();
|
|
2450
2453
|
if (r.length < 16)
|
|
2451
2454
|
throw new Error("Random bytes length must be >= 16");
|
|
2452
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
2455
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Gs(r);
|
|
2453
2456
|
}
|
|
2454
|
-
function
|
|
2457
|
+
function Hn(t) {
|
|
2455
2458
|
const e = t.replace(/-/g, ""), n = [];
|
|
2456
2459
|
for (let r = 0; r < e.length; r += 2)
|
|
2457
2460
|
n.push(parseInt(e.substring(r, r + 2), 16));
|
|
2458
2461
|
return n;
|
|
2459
2462
|
}
|
|
2460
|
-
function
|
|
2463
|
+
function Zs(t, e) {
|
|
2461
2464
|
for (let n = 0; n < t.length; n++) {
|
|
2462
2465
|
if (t[n] < e[n])
|
|
2463
2466
|
return -1;
|
|
@@ -2466,17 +2469,17 @@ function Js(t, e) {
|
|
|
2466
2469
|
}
|
|
2467
2470
|
return 0;
|
|
2468
2471
|
}
|
|
2469
|
-
function
|
|
2470
|
-
return
|
|
2472
|
+
function Xs(t, e) {
|
|
2473
|
+
return Zs(Hn(t), Hn(e));
|
|
2471
2474
|
}
|
|
2472
2475
|
function L() {
|
|
2473
|
-
return
|
|
2476
|
+
return Js();
|
|
2474
2477
|
}
|
|
2475
|
-
function
|
|
2478
|
+
function eo(t, e) {
|
|
2476
2479
|
return t.localeCompare(e);
|
|
2477
2480
|
}
|
|
2478
|
-
function
|
|
2479
|
-
let t =
|
|
2481
|
+
function to() {
|
|
2482
|
+
let t = eo;
|
|
2480
2483
|
if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
|
|
2481
2484
|
try {
|
|
2482
2485
|
t = Intl.Collator("en-US").compare;
|
|
@@ -2484,10 +2487,10 @@ function eo() {
|
|
|
2484
2487
|
}
|
|
2485
2488
|
return t;
|
|
2486
2489
|
}
|
|
2487
|
-
const
|
|
2488
|
-
let
|
|
2490
|
+
const no = to();
|
|
2491
|
+
let ro = 0;
|
|
2489
2492
|
function Ke(t) {
|
|
2490
|
-
return yt(`_${t}`,
|
|
2493
|
+
return yt(`_${t}`, ro++);
|
|
2491
2494
|
}
|
|
2492
2495
|
function yt(t, e) {
|
|
2493
2496
|
return `?${t}-${e}`;
|
|
@@ -2497,28 +2500,28 @@ class Ae extends Error {
|
|
|
2497
2500
|
super(e), this.name = "AttrNotFoundError";
|
|
2498
2501
|
}
|
|
2499
2502
|
}
|
|
2500
|
-
function
|
|
2501
|
-
const n =
|
|
2503
|
+
function io(t, e) {
|
|
2504
|
+
const n = Br(t, e);
|
|
2502
2505
|
if (!n)
|
|
2503
2506
|
throw new Ae(`Could not find id attr for ${e}`);
|
|
2504
2507
|
return n;
|
|
2505
2508
|
}
|
|
2506
|
-
function
|
|
2507
|
-
return [
|
|
2509
|
+
function Yn(t, e, n, r) {
|
|
2510
|
+
return [so(t, e, n, r)];
|
|
2508
2511
|
}
|
|
2509
|
-
function
|
|
2512
|
+
function so(t, e, n, r) {
|
|
2510
2513
|
return [
|
|
2511
2514
|
t(n, r),
|
|
2512
|
-
|
|
2515
|
+
io(e, n).id,
|
|
2513
2516
|
t(n, r),
|
|
2514
2517
|
t("time", r)
|
|
2515
2518
|
];
|
|
2516
2519
|
}
|
|
2517
|
-
function
|
|
2520
|
+
function oo(t, e, n) {
|
|
2518
2521
|
return t.map((r) => r === e ? n : r);
|
|
2519
2522
|
}
|
|
2520
|
-
function
|
|
2521
|
-
const s = fe(e, n, i), o =
|
|
2523
|
+
function Qr(t, e, n, r, i) {
|
|
2524
|
+
const s = fe(e, n, i), o = Wr(e, n, i), u = s || o;
|
|
2522
2525
|
if (!u)
|
|
2523
2526
|
throw new Ae(`Could not find attr for ${[n, i]}`);
|
|
2524
2527
|
if (u["value-type"] !== "ref")
|
|
@@ -2536,7 +2539,7 @@ function Gr(t, e, n, r, i) {
|
|
|
2536
2539
|
];
|
|
2537
2540
|
return [s ? f : d, l, p, u, !!s];
|
|
2538
2541
|
}
|
|
2539
|
-
function
|
|
2542
|
+
function Jn(t, e) {
|
|
2540
2543
|
if (typeof e != "string")
|
|
2541
2544
|
return function(o) {
|
|
2542
2545
|
return !1;
|
|
@@ -2546,7 +2549,7 @@ function Yn(t, e) {
|
|
|
2546
2549
|
return typeof o != "string" ? !1 : i.test(o);
|
|
2547
2550
|
};
|
|
2548
2551
|
}
|
|
2549
|
-
function
|
|
2552
|
+
function uo(t, e) {
|
|
2550
2553
|
if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
|
|
2551
2554
|
return e;
|
|
2552
2555
|
const n = t["checked-data-type"] === "date";
|
|
@@ -2587,7 +2590,7 @@ function oo(t, e) {
|
|
|
2587
2590
|
}
|
|
2588
2591
|
};
|
|
2589
2592
|
if (e.hasOwnProperty("$like")) {
|
|
2590
|
-
const r =
|
|
2593
|
+
const r = Jn(!0, e.$like);
|
|
2591
2594
|
return {
|
|
2592
2595
|
$comparator: !0,
|
|
2593
2596
|
$op: function(s) {
|
|
@@ -2596,7 +2599,7 @@ function oo(t, e) {
|
|
|
2596
2599
|
};
|
|
2597
2600
|
}
|
|
2598
2601
|
if (e.hasOwnProperty("$ilike")) {
|
|
2599
|
-
const r =
|
|
2602
|
+
const r = Jn(!1, e.$ilike);
|
|
2600
2603
|
return {
|
|
2601
2604
|
$comparator: !0,
|
|
2602
2605
|
$op: function(s) {
|
|
@@ -2606,8 +2609,8 @@ function oo(t, e) {
|
|
|
2606
2609
|
}
|
|
2607
2610
|
return e;
|
|
2608
2611
|
}
|
|
2609
|
-
function
|
|
2610
|
-
const o = fe(e, n, i), u =
|
|
2612
|
+
function ao(t, e, n, r, i, s) {
|
|
2613
|
+
const o = fe(e, n, i), u = Wr(e, n, i), a = o || u;
|
|
2611
2614
|
if (!a)
|
|
2612
2615
|
throw new Ae(`No attr for etype = ${n} label = ${i}`);
|
|
2613
2616
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
@@ -2624,63 +2627,63 @@ function uo(t, e, n, r, i, s) {
|
|
|
2624
2627
|
return o ? [
|
|
2625
2628
|
t(n, r),
|
|
2626
2629
|
a.id,
|
|
2627
|
-
|
|
2630
|
+
uo(a, s),
|
|
2628
2631
|
Ke("time")
|
|
2629
2632
|
] : [s, a.id, t(n, r), Ke("time")];
|
|
2630
2633
|
}
|
|
2631
|
-
function
|
|
2634
|
+
function co(t, e, n, r, i) {
|
|
2632
2635
|
const [s, o, u] = i.reduce((a, d) => {
|
|
2633
|
-
const [c, f, l] = a, [p, y, b] =
|
|
2636
|
+
const [c, f, l] = a, [p, y, b] = Qr(t, e, c, f, d);
|
|
2634
2637
|
return [p, y, [...l, b]];
|
|
2635
2638
|
}, [n, r, []]);
|
|
2636
2639
|
return [s, o, u];
|
|
2637
2640
|
}
|
|
2638
|
-
function
|
|
2639
|
-
const o = i.slice(0, i.length - 1), u = i[i.length - 1], [a, d, c] =
|
|
2641
|
+
function Vt(t, e, n, r, i, s) {
|
|
2642
|
+
const o = i.slice(0, i.length - 1), u = i[i.length - 1], [a, d, c] = co(t, e, n, r, o), f = ao(t, e, a, d, u, s);
|
|
2640
2643
|
return c.concat([f]);
|
|
2641
2644
|
}
|
|
2642
|
-
function
|
|
2645
|
+
function fo(t, e) {
|
|
2643
2646
|
return e ? [e].concat(t) : t;
|
|
2644
2647
|
}
|
|
2645
|
-
function
|
|
2648
|
+
function lo([t, e]) {
|
|
2646
2649
|
return t === "or" && Array.isArray(e);
|
|
2647
2650
|
}
|
|
2648
|
-
function
|
|
2651
|
+
function ho([t, e]) {
|
|
2649
2652
|
return t === "and" && Array.isArray(e);
|
|
2650
2653
|
}
|
|
2651
|
-
function
|
|
2654
|
+
function po(t, e, n) {
|
|
2652
2655
|
return (r, i) => {
|
|
2653
2656
|
const s = t(r, i);
|
|
2654
2657
|
return e == s ? s : `${s}-${n}`;
|
|
2655
2658
|
};
|
|
2656
2659
|
}
|
|
2657
|
-
function
|
|
2660
|
+
function Zn(t, e, n, r, i, s) {
|
|
2658
2661
|
const o = t(r, i), u = s.map((a, d) => {
|
|
2659
|
-
const c =
|
|
2660
|
-
return
|
|
2662
|
+
const c = po(t, o, d);
|
|
2663
|
+
return Hr(c, n, r, i, a);
|
|
2661
2664
|
});
|
|
2662
2665
|
return { [e]: { patterns: u, joinSym: o } };
|
|
2663
2666
|
}
|
|
2664
|
-
function
|
|
2667
|
+
function yo(t) {
|
|
2665
2668
|
const e = [];
|
|
2666
2669
|
for (let n = 1; n <= t.length; n++)
|
|
2667
2670
|
e.push(t.slice(0, n));
|
|
2668
2671
|
return e;
|
|
2669
2672
|
}
|
|
2670
|
-
function
|
|
2671
|
-
return
|
|
2673
|
+
function Xn(t, e, n, r, i) {
|
|
2674
|
+
return yo(i).map((s) => Vt(t, e, n, r, s, { $isNull: !0 }));
|
|
2672
2675
|
}
|
|
2673
|
-
function
|
|
2676
|
+
function Hr(t, e, n, r, i) {
|
|
2674
2677
|
return Object.entries(i).flatMap(([s, o]) => {
|
|
2675
|
-
if (fo([s, o]))
|
|
2676
|
-
return Jn(t, "or", e, n, r, o);
|
|
2677
2678
|
if (lo([s, o]))
|
|
2678
|
-
return
|
|
2679
|
+
return Zn(t, "or", e, n, r, o);
|
|
2680
|
+
if (ho([s, o]))
|
|
2681
|
+
return Zn(t, "and", e, n, r, o);
|
|
2679
2682
|
if (s === "$entityIdStartsWith")
|
|
2680
2683
|
return [];
|
|
2681
2684
|
const u = s.split(".");
|
|
2682
2685
|
if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2683
|
-
const a =
|
|
2686
|
+
const a = Vt(t, e, n, r, u, o), d = Xn(t, e, n, r, u);
|
|
2684
2687
|
return [
|
|
2685
2688
|
{
|
|
2686
2689
|
or: {
|
|
@@ -2693,32 +2696,32 @@ function Qr(t, e, n, r, i) {
|
|
|
2693
2696
|
return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && u.length > 1 ? [
|
|
2694
2697
|
{
|
|
2695
2698
|
or: {
|
|
2696
|
-
patterns:
|
|
2699
|
+
patterns: Xn(t, e, n, r, u),
|
|
2697
2700
|
joinSym: t(n, r)
|
|
2698
2701
|
}
|
|
2699
2702
|
}
|
|
2700
|
-
] :
|
|
2703
|
+
] : Vt(t, e, n, r, u, o);
|
|
2701
2704
|
});
|
|
2702
2705
|
}
|
|
2703
|
-
function
|
|
2706
|
+
function bo(t, e, n, r) {
|
|
2704
2707
|
const i = yt;
|
|
2705
|
-
return r ?
|
|
2708
|
+
return r ? Hr(i, t, e, n, r).concat(Yn(i, t, e, n)) : Yn(i, t, e, n);
|
|
2706
2709
|
}
|
|
2707
|
-
function
|
|
2710
|
+
function _o(t, e, n) {
|
|
2708
2711
|
return [t(e, n), t("time", n)];
|
|
2709
2712
|
}
|
|
2710
|
-
function
|
|
2711
|
-
const [o, u, a, d, c] =
|
|
2713
|
+
function go(t, e, n, r, i, s) {
|
|
2714
|
+
const [o, u, a, d, c] = Qr(t, e, n, r, i), f = oo(a, t(n, r), s);
|
|
2712
2715
|
return [o, u, f, d, c];
|
|
2713
2716
|
}
|
|
2714
|
-
function
|
|
2717
|
+
function To(t, e, { etype: n, level: r, form: i }, s) {
|
|
2715
2718
|
const o = Object.keys(i).filter((u) => u !== "$");
|
|
2716
2719
|
return o.length ? Object.entries(s).map(function([a, d]) {
|
|
2717
2720
|
return o.map(function(l) {
|
|
2718
2721
|
var p, y, b;
|
|
2719
2722
|
const g = !!(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));
|
|
2720
2723
|
try {
|
|
2721
|
-
const [m, T, v] =
|
|
2724
|
+
const [m, T, v] = go(t, e, n, r, l, a), k = Jr(e, {
|
|
2722
2725
|
etype: m,
|
|
2723
2726
|
level: T,
|
|
2724
2727
|
form: i[l],
|
|
@@ -2735,48 +2738,48 @@ function go(t, e, { etype: n, level: r, form: i }, s) {
|
|
|
2735
2738
|
}, d);
|
|
2736
2739
|
}) : Object.values(s);
|
|
2737
2740
|
}
|
|
2738
|
-
function
|
|
2739
|
-
return n === "string" ?
|
|
2741
|
+
function mo(t, e, n) {
|
|
2742
|
+
return n === "string" ? no(t, e) : t > e ? 1 : -1;
|
|
2740
2743
|
}
|
|
2741
2744
|
function Fe(t, e, n, r, i) {
|
|
2742
|
-
return e === r || e == null && r == null ?
|
|
2745
|
+
return e === r || e == null && r == null ? Xs(t, n) : r == null ? 1 : e == null ? -1 : mo(e, r, i);
|
|
2743
2746
|
}
|
|
2744
2747
|
function lt([t, e], [n, r], i) {
|
|
2745
2748
|
return Fe(t, e, n, r, i);
|
|
2746
2749
|
}
|
|
2747
|
-
function
|
|
2750
|
+
function Wt(t) {
|
|
2748
2751
|
return t == null ? t : new Date(t).getTime();
|
|
2749
2752
|
}
|
|
2750
|
-
function
|
|
2753
|
+
function wo(t, e, n, r) {
|
|
2751
2754
|
var i;
|
|
2752
2755
|
const [s, o, u, a] = t, d = n === "desc" ? 1 : -1;
|
|
2753
2756
|
if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
|
|
2754
2757
|
return lt(r, [s, a], null) === d;
|
|
2755
|
-
const [c, f] = r, l = e["checked-data-type"], p = l === "date" ?
|
|
2758
|
+
const [c, f] = r, l = e["checked-data-type"], p = l === "date" ? Wt(f) : f, y = l === "date" ? Wt(u) : u;
|
|
2756
2759
|
return lt([c, p], [s, y], l) === d;
|
|
2757
2760
|
}
|
|
2758
|
-
function
|
|
2761
|
+
function vo(t, e) {
|
|
2759
2762
|
const n = e[1];
|
|
2760
2763
|
return t.attrs[n];
|
|
2761
2764
|
}
|
|
2762
|
-
function
|
|
2765
|
+
function So(t, e, n) {
|
|
2763
2766
|
const r = Object.keys(n)[0];
|
|
2764
2767
|
return fe(t, e, r);
|
|
2765
2768
|
}
|
|
2766
|
-
function
|
|
2769
|
+
function Oo(t, e, n, r) {
|
|
2767
2770
|
if (n)
|
|
2768
|
-
return
|
|
2771
|
+
return vo(t, n);
|
|
2769
2772
|
if (r)
|
|
2770
|
-
return
|
|
2773
|
+
return So(t, e, r);
|
|
2771
2774
|
}
|
|
2772
|
-
function
|
|
2775
|
+
function Eo(t, e, n) {
|
|
2773
2776
|
var r, i;
|
|
2774
2777
|
if (!Array.isArray(n.fields))
|
|
2775
|
-
return
|
|
2778
|
+
return Rs(t, e);
|
|
2776
2779
|
const s = /* @__PURE__ */ new Map();
|
|
2777
2780
|
for (const o of n.fields) {
|
|
2778
2781
|
const u = fe(t, e, o), a = (r = u == null ? void 0 : u["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
|
|
2779
|
-
a &&
|
|
2782
|
+
a && dn(u) && s.set(a, u);
|
|
2780
2783
|
}
|
|
2781
2784
|
if (!s.has("id")) {
|
|
2782
2785
|
const o = fe(t, e, "id"), u = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
|
|
@@ -2784,17 +2787,17 @@ function Oo(t, e, n) {
|
|
|
2784
2787
|
}
|
|
2785
2788
|
return s;
|
|
2786
2789
|
}
|
|
2787
|
-
function
|
|
2790
|
+
function Ao(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
2788
2791
|
var s, o;
|
|
2789
|
-
const u = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, a =
|
|
2790
|
-
let c =
|
|
2791
|
-
const f = n == null ? void 0 : n["start-cursor"], l =
|
|
2792
|
+
const u = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, a = Yr(i), d = jo(i);
|
|
2793
|
+
let c = Vs(t, r);
|
|
2794
|
+
const f = n == null ? void 0 : n["start-cursor"], l = Oo(t, e, f, u);
|
|
2792
2795
|
if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
|
|
2793
2796
|
const b = l["checked-data-type"] === "date", g = l.id;
|
|
2794
2797
|
c = c.map(([m]) => {
|
|
2795
2798
|
var T, v, k, S, I;
|
|
2796
2799
|
let R = (I = (S = (k = (v = (T = t.eav.get(m)) === null || T === void 0 ? void 0 : T.get(g)) === null || v === void 0 ? void 0 : v.values()) === null || k === void 0 ? void 0 : k.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
|
|
2797
|
-
return b && (R =
|
|
2800
|
+
return b && (R = Wt(R)), [m, R];
|
|
2798
2801
|
});
|
|
2799
2802
|
}
|
|
2800
2803
|
c.sort(d === "asc" ? function(g, m) {
|
|
@@ -2803,31 +2806,31 @@ function Eo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
|
2803
2806
|
return lt(m, g, l == null ? void 0 : l["checked-data-type"]);
|
|
2804
2807
|
});
|
|
2805
2808
|
let p = {};
|
|
2806
|
-
const y =
|
|
2809
|
+
const y = Eo(t, e, r);
|
|
2807
2810
|
for (const b of c) {
|
|
2808
2811
|
const [g] = b;
|
|
2809
|
-
if (p[g] || !a && f && l &&
|
|
2812
|
+
if (p[g] || !a && f && l && wo(f, l, d, b))
|
|
2810
2813
|
continue;
|
|
2811
|
-
const m =
|
|
2814
|
+
const m = Ms(t, y, g);
|
|
2812
2815
|
m && (p[g] = m);
|
|
2813
2816
|
}
|
|
2814
2817
|
return p;
|
|
2815
2818
|
}
|
|
2816
|
-
function
|
|
2819
|
+
function jo(t) {
|
|
2817
2820
|
var e;
|
|
2818
2821
|
const n = (e = t.$) === null || e === void 0 ? void 0 : e.order;
|
|
2819
2822
|
return n && n[Object.keys(n)[0]] || "asc";
|
|
2820
2823
|
}
|
|
2821
|
-
function
|
|
2824
|
+
function Yr(t) {
|
|
2822
2825
|
var e, n, r;
|
|
2823
2826
|
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;
|
|
2824
2827
|
return !i && !s && !o;
|
|
2825
2828
|
}
|
|
2826
|
-
function
|
|
2829
|
+
function ko(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
2827
2830
|
var o, u, a, d, c;
|
|
2828
|
-
if (!
|
|
2831
|
+
if (!Yr(r) && (!s || !s["start-cursor"]))
|
|
2829
2832
|
return [];
|
|
2830
|
-
const f =
|
|
2833
|
+
const f = fo(bo(t, e, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), l = _o(yt, e, n), p = (u = r.$) === null || u === void 0 ? void 0 : u.fields, y = Ao(t, {
|
|
2831
2834
|
etype: e,
|
|
2832
2835
|
pageInfo: s,
|
|
2833
2836
|
form: r,
|
|
@@ -2840,20 +2843,20 @@ function jo(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
|
2840
2843
|
}
|
|
2841
2844
|
return y;
|
|
2842
2845
|
}
|
|
2843
|
-
function
|
|
2846
|
+
function Co(t, e) {
|
|
2844
2847
|
try {
|
|
2845
|
-
return
|
|
2848
|
+
return ko(t, e);
|
|
2846
2849
|
} catch (n) {
|
|
2847
2850
|
if (n instanceof Ae)
|
|
2848
2851
|
return {};
|
|
2849
2852
|
throw n;
|
|
2850
2853
|
}
|
|
2851
2854
|
}
|
|
2852
|
-
function
|
|
2853
|
-
const n =
|
|
2854
|
-
return
|
|
2855
|
+
function Jr(t, e) {
|
|
2856
|
+
const n = Co(t, e);
|
|
2857
|
+
return To(yt, t, e, n);
|
|
2855
2858
|
}
|
|
2856
|
-
function
|
|
2859
|
+
function Po(t) {
|
|
2857
2860
|
const e = {};
|
|
2858
2861
|
for (const [n, r] of Object.entries(t))
|
|
2859
2862
|
e[n] = {
|
|
@@ -2864,18 +2867,18 @@ function Co(t) {
|
|
|
2864
2867
|
};
|
|
2865
2868
|
return e;
|
|
2866
2869
|
}
|
|
2867
|
-
function
|
|
2870
|
+
function Zr({ store: t, pageInfo: e, aggregate: n }, r) {
|
|
2868
2871
|
const s = { data: Object.keys(r).reduce(function(u, a) {
|
|
2869
|
-
return n != null && n[a] || a === "$$ruleParams" || (u[a] =
|
|
2872
|
+
return n != null && n[a] || a === "$$ruleParams" || (u[a] = Jr(t, {
|
|
2870
2873
|
etype: a,
|
|
2871
2874
|
form: r[a],
|
|
2872
2875
|
level: 0,
|
|
2873
2876
|
pageInfo: e == null ? void 0 : e[a]
|
|
2874
2877
|
})), u;
|
|
2875
2878
|
}, {}) };
|
|
2876
|
-
return e && (s.pageInfo =
|
|
2879
|
+
return e && (s.pageInfo = Po(e)), n && (s.aggregate = n), s;
|
|
2877
2880
|
}
|
|
2878
|
-
function
|
|
2881
|
+
function Io() {
|
|
2879
2882
|
const e = {
|
|
2880
2883
|
__etype: 1,
|
|
2881
2884
|
__ops: 1,
|
|
@@ -2889,8 +2892,8 @@ function Po() {
|
|
|
2889
2892
|
};
|
|
2890
2893
|
return new Set(Object.keys(e));
|
|
2891
2894
|
}
|
|
2892
|
-
const
|
|
2893
|
-
function
|
|
2895
|
+
const Mo = Io();
|
|
2896
|
+
function Bt(t, e, n) {
|
|
2894
2897
|
const r = {
|
|
2895
2898
|
__etype: t,
|
|
2896
2899
|
__ops: n
|
|
@@ -2901,8 +2904,8 @@ function Wt(t, e, n) {
|
|
|
2901
2904
|
return n;
|
|
2902
2905
|
if (s === "__etype")
|
|
2903
2906
|
return t;
|
|
2904
|
-
if (
|
|
2905
|
-
return (o, u) =>
|
|
2907
|
+
if (Mo.has(s))
|
|
2908
|
+
return (o, u) => Bt(t, e, [
|
|
2906
2909
|
...n,
|
|
2907
2910
|
u ? [s, t, e, o, u] : [s, t, e, o]
|
|
2908
2911
|
]);
|
|
@@ -2912,11 +2915,11 @@ function Wt(t, e, n) {
|
|
|
2912
2915
|
function ht(t) {
|
|
2913
2916
|
return t.startsWith("lookup__");
|
|
2914
2917
|
}
|
|
2915
|
-
function
|
|
2918
|
+
function Xr(t) {
|
|
2916
2919
|
const [e, n, ...r] = t.split("__");
|
|
2917
2920
|
return [n, JSON.parse(r.join("__"))];
|
|
2918
2921
|
}
|
|
2919
|
-
function
|
|
2922
|
+
function Ro(t) {
|
|
2920
2923
|
return new Proxy({
|
|
2921
2924
|
__etype: t
|
|
2922
2925
|
}, {
|
|
@@ -2924,22 +2927,22 @@ function Mo(t) {
|
|
|
2924
2927
|
if (n === "__etype")
|
|
2925
2928
|
return t;
|
|
2926
2929
|
const r = n;
|
|
2927
|
-
return ht(r) ?
|
|
2930
|
+
return ht(r) ? Bt(t, Xr(r), []) : Bt(t, r, []);
|
|
2928
2931
|
}
|
|
2929
2932
|
});
|
|
2930
2933
|
}
|
|
2931
|
-
function
|
|
2934
|
+
function hn() {
|
|
2932
2935
|
return new Proxy({}, {
|
|
2933
2936
|
get(t, e) {
|
|
2934
|
-
return
|
|
2937
|
+
return Ro(e);
|
|
2935
2938
|
}
|
|
2936
2939
|
});
|
|
2937
2940
|
}
|
|
2938
|
-
|
|
2939
|
-
function
|
|
2941
|
+
hn();
|
|
2942
|
+
function $o(t) {
|
|
2940
2943
|
return t.__ops;
|
|
2941
2944
|
}
|
|
2942
|
-
function
|
|
2945
|
+
function xo(t, e) {
|
|
2943
2946
|
const { attrIdMap: n, refSwapAttrIds: r } = t, i = [];
|
|
2944
2947
|
for (const o of e) {
|
|
2945
2948
|
const u = n[o];
|
|
@@ -2973,7 +2976,7 @@ function _e(t, e, n) {
|
|
|
2973
2976
|
return o === e && u === n;
|
|
2974
2977
|
});
|
|
2975
2978
|
}
|
|
2976
|
-
function
|
|
2979
|
+
function Do(t) {
|
|
2977
2980
|
if (Array.isArray(t))
|
|
2978
2981
|
return t;
|
|
2979
2982
|
const e = Object.entries(t);
|
|
@@ -2981,38 +2984,38 @@ function xo(t) {
|
|
|
2981
2984
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
2982
2985
|
return e[0];
|
|
2983
2986
|
}
|
|
2984
|
-
function
|
|
2987
|
+
function Gt(t, e, n) {
|
|
2985
2988
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2986
2989
|
// before assuming it's a ref lookup.
|
|
2987
2990
|
!K(t, e, n);
|
|
2988
2991
|
}
|
|
2989
|
-
function
|
|
2992
|
+
function Qt(t) {
|
|
2990
2993
|
const [e, n, ...r] = t.split(".");
|
|
2991
2994
|
if (r.length > 0 || n !== "id")
|
|
2992
2995
|
throw new Error(`${t} is not a valid lookup attribute.`);
|
|
2993
2996
|
return e;
|
|
2994
2997
|
}
|
|
2995
|
-
function
|
|
2996
|
-
if (!
|
|
2998
|
+
function Uo(t, e, n) {
|
|
2999
|
+
if (!Gt(t, e, n))
|
|
2997
3000
|
return K(t, e, n);
|
|
2998
|
-
const r =
|
|
3001
|
+
const r = Qt(n), i = K(t, e, r) || _e(t, e, r);
|
|
2999
3002
|
if (i && i["value-type"] !== "ref")
|
|
3000
3003
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
3001
3004
|
return i;
|
|
3002
3005
|
}
|
|
3003
|
-
function
|
|
3004
|
-
return typeof t == "string" && !ht(t) ? null : typeof t == "string" && ht(t) ?
|
|
3006
|
+
function Ht(t) {
|
|
3007
|
+
return typeof t == "string" && !ht(t) ? null : typeof t == "string" && ht(t) ? Xr(t) : Do(t);
|
|
3005
3008
|
}
|
|
3006
3009
|
function Q(t, e, n) {
|
|
3007
|
-
const r =
|
|
3010
|
+
const r = Ht(n);
|
|
3008
3011
|
if (r === null)
|
|
3009
3012
|
return n;
|
|
3010
|
-
const [i, s] = r, o =
|
|
3013
|
+
const [i, s] = r, o = Uo(t, e, i);
|
|
3011
3014
|
if (!o || !o["unique?"])
|
|
3012
3015
|
throw new Error(`${i} is not a unique attribute.`);
|
|
3013
3016
|
return [o.id, s];
|
|
3014
3017
|
}
|
|
3015
|
-
function
|
|
3018
|
+
function ei(t, e, n, r) {
|
|
3016
3019
|
const i = Q(t, e, n);
|
|
3017
3020
|
return Array.isArray(i) ? [[
|
|
3018
3021
|
"add-triple",
|
|
@@ -3021,7 +3024,7 @@ function Xr(t, e, n, r) {
|
|
|
3021
3024
|
i
|
|
3022
3025
|
]].concat(r) : r;
|
|
3023
3026
|
}
|
|
3024
|
-
function
|
|
3027
|
+
function Lo({ attrs: t }, [e, n, r]) {
|
|
3025
3028
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3026
3029
|
const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = _e(t, e, s);
|
|
3027
3030
|
return u.map((c) => a ? [
|
|
@@ -3036,9 +3039,9 @@ function Uo({ attrs: t }, [e, n, r]) {
|
|
|
3036
3039
|
Q(t, e, n)
|
|
3037
3040
|
]);
|
|
3038
3041
|
});
|
|
3039
|
-
return
|
|
3042
|
+
return ei(t, e, n, i);
|
|
3040
3043
|
}
|
|
3041
|
-
function
|
|
3044
|
+
function Fo({ attrs: t }, [e, n, r]) {
|
|
3042
3045
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3043
3046
|
const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = _e(t, e, s);
|
|
3044
3047
|
return u.map((c) => a ? [
|
|
@@ -3053,9 +3056,9 @@ function Lo({ attrs: t }, [e, n, r]) {
|
|
|
3053
3056
|
Q(t, e, n)
|
|
3054
3057
|
]);
|
|
3055
3058
|
});
|
|
3056
|
-
return
|
|
3059
|
+
return ei(t, e, n, i);
|
|
3057
3060
|
}
|
|
3058
|
-
function
|
|
3061
|
+
function No(t, e, n) {
|
|
3059
3062
|
if (Array.isArray(n)) {
|
|
3060
3063
|
const [r, i] = n;
|
|
3061
3064
|
for (const s of t || []) {
|
|
@@ -3077,18 +3080,18 @@ function Fo(t, e, n) {
|
|
|
3077
3080
|
}
|
|
3078
3081
|
return !1;
|
|
3079
3082
|
}
|
|
3080
|
-
function
|
|
3081
|
-
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null :
|
|
3083
|
+
function ti({ stores: t, attrs: e }, [n, r, i, s]) {
|
|
3084
|
+
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : No(t, n, r) ? { mode: "update" } : null;
|
|
3082
3085
|
}
|
|
3083
|
-
function
|
|
3084
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a =
|
|
3086
|
+
function Ko(t, e) {
|
|
3087
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = an(o), d = Q(r, i, s);
|
|
3085
3088
|
return [["id", d]].concat(Object.entries(a)).map(([f, l]) => {
|
|
3086
3089
|
const p = K(r, i, f);
|
|
3087
3090
|
return p["checked-data-type"] === "date" && t.useDateObjects && (l = pt(l)), ["add-triple", d, p.id, l, { mode: "create" }];
|
|
3088
3091
|
});
|
|
3089
3092
|
}
|
|
3090
|
-
function
|
|
3091
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a =
|
|
3093
|
+
function qo(t, e) {
|
|
3094
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = an(o), d = Q(r, i, s), c = ti(t, [i, d, o, u]);
|
|
3092
3095
|
return [["id", d]].concat(Object.entries(a)).map(([l, p]) => {
|
|
3093
3096
|
const y = K(r, i, l);
|
|
3094
3097
|
return y["checked-data-type"] === "date" && t.useDateObjects && (p = pt(p)), [
|
|
@@ -3100,11 +3103,11 @@ function Ko(t, e) {
|
|
|
3100
3103
|
];
|
|
3101
3104
|
});
|
|
3102
3105
|
}
|
|
3103
|
-
function
|
|
3106
|
+
function zo({ attrs: t }, [e, n]) {
|
|
3104
3107
|
return [["delete-entity", Q(t, e, n), e]];
|
|
3105
3108
|
}
|
|
3106
|
-
function
|
|
3107
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a =
|
|
3109
|
+
function Vo(t, e) {
|
|
3110
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = an(o), d = Q(r, i, s), c = ti(t, [i, d, o, u]), f = Object.entries(a).map(([p, y]) => {
|
|
3108
3111
|
const b = K(r, i, p);
|
|
3109
3112
|
return [
|
|
3110
3113
|
"deep-merge-triple",
|
|
@@ -3122,38 +3125,38 @@ function zo(t, e) {
|
|
|
3122
3125
|
...c ? [c] : []
|
|
3123
3126
|
]].concat(f);
|
|
3124
3127
|
}
|
|
3125
|
-
function
|
|
3128
|
+
function Wo({ attrs: t }, [e, n, r]) {
|
|
3126
3129
|
return [["rule-params", Q(t, e, n), e, r]];
|
|
3127
3130
|
}
|
|
3128
|
-
function
|
|
3131
|
+
function Bo(t) {
|
|
3129
3132
|
const [e, n, r, i, s] = t;
|
|
3130
3133
|
if (!i)
|
|
3131
3134
|
return t;
|
|
3132
3135
|
const o = Object.assign({}, i);
|
|
3133
3136
|
return delete o.id, [e, n, r, o, ...s ? [s] : []];
|
|
3134
3137
|
}
|
|
3135
|
-
function
|
|
3136
|
-
const [n, ...r] =
|
|
3138
|
+
function Go(t, e) {
|
|
3139
|
+
const [n, ...r] = Bo(e);
|
|
3137
3140
|
switch (n) {
|
|
3138
3141
|
case "merge":
|
|
3139
|
-
return
|
|
3142
|
+
return Vo(t, r);
|
|
3140
3143
|
case "create":
|
|
3141
|
-
return No(t, r);
|
|
3142
|
-
case "update":
|
|
3143
3144
|
return Ko(t, r);
|
|
3145
|
+
case "update":
|
|
3146
|
+
return qo(t, r);
|
|
3144
3147
|
case "link":
|
|
3145
|
-
return Uo(t, r);
|
|
3146
|
-
case "unlink":
|
|
3147
3148
|
return Lo(t, r);
|
|
3149
|
+
case "unlink":
|
|
3150
|
+
return Fo(t, r);
|
|
3148
3151
|
case "delete":
|
|
3149
|
-
return
|
|
3152
|
+
return zo(t, r);
|
|
3150
3153
|
case "ruleParams":
|
|
3151
|
-
return
|
|
3154
|
+
return Wo(t, r);
|
|
3152
3155
|
default:
|
|
3153
3156
|
throw new Error(`unsupported action ${n}`);
|
|
3154
3157
|
}
|
|
3155
3158
|
}
|
|
3156
|
-
function
|
|
3159
|
+
function Qo(t) {
|
|
3157
3160
|
switch (t) {
|
|
3158
3161
|
case "string":
|
|
3159
3162
|
case "date":
|
|
@@ -3164,14 +3167,14 @@ function Go(t) {
|
|
|
3164
3167
|
return;
|
|
3165
3168
|
}
|
|
3166
3169
|
}
|
|
3167
|
-
function
|
|
3170
|
+
function Ho(t, e, n) {
|
|
3168
3171
|
var r, i;
|
|
3169
3172
|
const s = (i = (r = t.entities[e]) === null || r === void 0 ? void 0 : r.attrs) === null || i === void 0 ? void 0 : i[n];
|
|
3170
3173
|
if (n === "id")
|
|
3171
3174
|
return null;
|
|
3172
3175
|
if (!s)
|
|
3173
3176
|
throw new Error(`${e}.${n} does not exist in your schema`);
|
|
3174
|
-
const { unique: o, indexed: u } = s == null ? void 0 : s.config, a =
|
|
3177
|
+
const { unique: o, indexed: u } = s == null ? void 0 : s.config, a = Qo(s == null ? void 0 : s.valueType);
|
|
3175
3178
|
return {
|
|
3176
3179
|
"index?": u,
|
|
3177
3180
|
"unique?": o,
|
|
@@ -3179,14 +3182,14 @@ function Qo(t, e, n) {
|
|
|
3179
3182
|
};
|
|
3180
3183
|
}
|
|
3181
3184
|
function nt(t, e, n, r) {
|
|
3182
|
-
const i = t ?
|
|
3185
|
+
const i = t ? Ho(t, e, n) : null, s = L(), u = [L(), e, n];
|
|
3183
3186
|
return Object.assign(Object.assign({ id: s, "forward-identity": u, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
3184
3187
|
}
|
|
3185
|
-
function
|
|
3188
|
+
function Yo(t, e, n) {
|
|
3186
3189
|
return Object.values(t.links).find((i) => i.forward.on === e && i.forward.label === n || i.reverse.on === e && i.reverse.label === n);
|
|
3187
3190
|
}
|
|
3188
|
-
function
|
|
3189
|
-
const r =
|
|
3191
|
+
function Jo(t, e, n) {
|
|
3192
|
+
const r = Yo(t, e, n);
|
|
3190
3193
|
if (!r)
|
|
3191
3194
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
3192
3195
|
const { forward: i, reverse: s } = r;
|
|
@@ -3199,11 +3202,11 @@ function Yo(t, e, n) {
|
|
|
3199
3202
|
"on-delete-reverse": s.onDelete
|
|
3200
3203
|
};
|
|
3201
3204
|
}
|
|
3202
|
-
function
|
|
3203
|
-
const i = t ?
|
|
3205
|
+
function er(t, e, n, r) {
|
|
3206
|
+
const i = t ? Jo(t, e, n) : null, s = L(), o = [L(), e, n], u = [L(), n, e];
|
|
3204
3207
|
return Object.assign(Object.assign({ id: s, "forward-identity": o, "reverse-identity": u, "value-type": "ref", cardinality: "many", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
3205
3208
|
}
|
|
3206
|
-
const
|
|
3209
|
+
const Zo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Xo = /* @__PURE__ */ new Set(["link", "unlink"]), eu = /* @__PURE__ */ new Set(["create", "update", "merge"]), tu = /* @__PURE__ */ new Set([
|
|
3207
3210
|
"link",
|
|
3208
3211
|
"unlink",
|
|
3209
3212
|
"create",
|
|
@@ -3211,17 +3214,17 @@ const Jo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
3211
3214
|
"merge",
|
|
3212
3215
|
"delete",
|
|
3213
3216
|
"ruleParams"
|
|
3214
|
-
]),
|
|
3215
|
-
function
|
|
3217
|
+
]), Yt = { "unique?": !0, "index?": !0 }, nu = Object.assign(Object.assign({}, Yt), { cardinality: "one" });
|
|
3218
|
+
function ru(t) {
|
|
3216
3219
|
const e = [], [n, r, i, s] = t;
|
|
3217
|
-
if (!
|
|
3220
|
+
if (!tu.has(n))
|
|
3218
3221
|
return e;
|
|
3219
|
-
const o =
|
|
3222
|
+
const o = Ht(i);
|
|
3220
3223
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
3221
3224
|
for (const [u, a] of Object.entries(s)) {
|
|
3222
3225
|
const d = Array.isArray(a) ? a : [a];
|
|
3223
3226
|
for (const c of d) {
|
|
3224
|
-
const f =
|
|
3227
|
+
const f = Ht(c);
|
|
3225
3228
|
f && e.push({
|
|
3226
3229
|
etype: r,
|
|
3227
3230
|
lookupPair: f,
|
|
@@ -3231,7 +3234,7 @@ function nu(t) {
|
|
|
3231
3234
|
}
|
|
3232
3235
|
return e;
|
|
3233
3236
|
}
|
|
3234
|
-
function
|
|
3237
|
+
function iu({ attrs: t, schema: e }, n) {
|
|
3235
3238
|
var r, i;
|
|
3236
3239
|
const [s, o, u] = [/* @__PURE__ */ new Set(), Object.assign({}, t), []];
|
|
3237
3240
|
function a(f) {
|
|
@@ -3242,47 +3245,47 @@ function ru({ attrs: t, schema: e }, n) {
|
|
|
3242
3245
|
}
|
|
3243
3246
|
function c(f, l) {
|
|
3244
3247
|
const p = K(o, f, l), y = _e(o, f, l);
|
|
3245
|
-
d(p), d(y), !p && !y && a(
|
|
3248
|
+
d(p), d(y), !p && !y && a(er(e, f, l, nu));
|
|
3246
3249
|
}
|
|
3247
3250
|
for (const f of n)
|
|
3248
|
-
for (const { etype: l, lookupPair: p, linkLabel: y } of
|
|
3251
|
+
for (const { etype: l, lookupPair: p, linkLabel: y } of ru(f)) {
|
|
3249
3252
|
const b = p[0];
|
|
3250
3253
|
if (y) {
|
|
3251
3254
|
c(l, y);
|
|
3252
3255
|
const g = K(o, l, y), m = _e(o, l, y);
|
|
3253
3256
|
d(g), d(m);
|
|
3254
3257
|
const T = ((r = g == null ? void 0 : g["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = m == null ? void 0 : m["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
|
|
3255
|
-
if (
|
|
3256
|
-
c(T,
|
|
3258
|
+
if (Gt(o, T, b))
|
|
3259
|
+
c(T, Qt(b));
|
|
3257
3260
|
else {
|
|
3258
3261
|
const v = K(o, T, b);
|
|
3259
|
-
v || a(nt(e, T, b,
|
|
3262
|
+
v || a(nt(e, T, b, Yt)), d(v);
|
|
3260
3263
|
}
|
|
3261
|
-
} else if (
|
|
3262
|
-
c(l,
|
|
3264
|
+
} else if (Gt(o, l, b))
|
|
3265
|
+
c(l, Qt(b));
|
|
3263
3266
|
else {
|
|
3264
3267
|
const g = K(o, l, b);
|
|
3265
|
-
g || a(nt(e, l, b,
|
|
3268
|
+
g || a(nt(e, l, b, Yt)), d(g);
|
|
3266
3269
|
}
|
|
3267
3270
|
}
|
|
3268
3271
|
for (const f of n) {
|
|
3269
3272
|
const [l, p, y, b] = f;
|
|
3270
|
-
if (
|
|
3273
|
+
if (Zo.has(l)) {
|
|
3271
3274
|
const g = K(o, p, "id");
|
|
3272
3275
|
d(g), g || a(nt(e, p, "id", { "unique?": !0 }));
|
|
3273
3276
|
for (const m of Object.keys(b)) {
|
|
3274
3277
|
const T = K(o, p, m);
|
|
3275
|
-
if (d(T),
|
|
3278
|
+
if (d(T), eu.has(l) && (T || a(nt(e, p, m, m === "id" ? { "unique?": !0 } : null))), Xo.has(l)) {
|
|
3276
3279
|
const v = _e(o, p, m);
|
|
3277
|
-
!T && !v && a(
|
|
3280
|
+
!T && !v && a(er(e, p, m)), d(v);
|
|
3278
3281
|
}
|
|
3279
3282
|
}
|
|
3280
3283
|
}
|
|
3281
3284
|
}
|
|
3282
3285
|
return [o, u];
|
|
3283
3286
|
}
|
|
3284
|
-
function
|
|
3285
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((a) =>
|
|
3287
|
+
function su(t, e) {
|
|
3288
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((a) => $o(a)), [i, s] = iu(t, r), o = Object.assign(Object.assign({}, t), { attrs: i }), u = r.flatMap((a) => Go(o, a));
|
|
3286
3289
|
return [...s, ...u];
|
|
3287
3290
|
}
|
|
3288
3291
|
var re = function(t, e, n, r) {
|
|
@@ -3312,15 +3315,15 @@ var re = function(t, e, n, r) {
|
|
|
3312
3315
|
d((r = r.apply(t, e || [])).next());
|
|
3313
3316
|
});
|
|
3314
3317
|
};
|
|
3315
|
-
function
|
|
3318
|
+
function tr(t, e) {
|
|
3316
3319
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
3317
3320
|
}
|
|
3318
3321
|
const qe = "__meta";
|
|
3319
|
-
class
|
|
3322
|
+
class ou {
|
|
3320
3323
|
constructor(e, n) {
|
|
3321
3324
|
}
|
|
3322
3325
|
}
|
|
3323
|
-
class
|
|
3326
|
+
class Jt {
|
|
3324
3327
|
constructor(e) {
|
|
3325
3328
|
var n, r;
|
|
3326
3329
|
this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
|
|
@@ -3514,7 +3517,7 @@ class Yt {
|
|
|
3514
3517
|
gc() {
|
|
3515
3518
|
this._nextGc || (this._nextGc = setTimeout(
|
|
3516
3519
|
() => {
|
|
3517
|
-
|
|
3520
|
+
tr(() => {
|
|
3518
3521
|
this._nextGc = null, this._gc();
|
|
3519
3522
|
}, 30 * 1e3);
|
|
3520
3523
|
},
|
|
@@ -3529,7 +3532,7 @@ class Yt {
|
|
|
3529
3532
|
return;
|
|
3530
3533
|
}
|
|
3531
3534
|
this._nextSave = setTimeout(() => {
|
|
3532
|
-
|
|
3535
|
+
tr(() => {
|
|
3533
3536
|
this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
|
|
3534
3537
|
}, this._idleCallbackMaxWaitMs);
|
|
3535
3538
|
}, this._saveThrottleMs);
|
|
@@ -3588,13 +3591,13 @@ var oe = function(t, e, n, r) {
|
|
|
3588
3591
|
d((r = r.apply(t, e || [])).next());
|
|
3589
3592
|
});
|
|
3590
3593
|
};
|
|
3591
|
-
const
|
|
3592
|
-
function
|
|
3594
|
+
const uu = 6, au = ["kv", "querySubs", "syncSubs"];
|
|
3595
|
+
function cu(t) {
|
|
3593
3596
|
return function(n) {
|
|
3594
3597
|
console.error("Error in IndexedDB event", { source: t, event: n });
|
|
3595
3598
|
};
|
|
3596
3599
|
}
|
|
3597
|
-
function
|
|
3600
|
+
function du(t) {
|
|
3598
3601
|
return oe(this, void 0, void 0, function* () {
|
|
3599
3602
|
return new Promise((e) => {
|
|
3600
3603
|
const n = indexedDB.open(t);
|
|
@@ -3610,7 +3613,7 @@ function cu(t) {
|
|
|
3610
3613
|
});
|
|
3611
3614
|
});
|
|
3612
3615
|
}
|
|
3613
|
-
function
|
|
3616
|
+
function fu(t, e, n) {
|
|
3614
3617
|
return oe(this, void 0, void 0, function* () {
|
|
3615
3618
|
const r = (
|
|
3616
3619
|
// Backwards compatibility for older versions where we JSON.stringified before storing
|
|
@@ -3646,7 +3649,7 @@ function du(t, e, n) {
|
|
|
3646
3649
|
});
|
|
3647
3650
|
});
|
|
3648
3651
|
}
|
|
3649
|
-
function
|
|
3652
|
+
function nr(t, e, n) {
|
|
3650
3653
|
return oe(this, void 0, void 0, function* () {
|
|
3651
3654
|
const r = n.put(e, t);
|
|
3652
3655
|
return new Promise((i, s) => {
|
|
@@ -3654,9 +3657,9 @@ function tr(t, e, n) {
|
|
|
3654
3657
|
});
|
|
3655
3658
|
});
|
|
3656
3659
|
}
|
|
3657
|
-
function
|
|
3660
|
+
function lu(t, e) {
|
|
3658
3661
|
return oe(this, void 0, void 0, function* () {
|
|
3659
|
-
const n = yield
|
|
3662
|
+
const n = yield du(`instant_${t}_5`);
|
|
3660
3663
|
if (!n)
|
|
3661
3664
|
return;
|
|
3662
3665
|
const r = yield new Promise((c, f) => {
|
|
@@ -3679,12 +3682,12 @@ function fu(t, e) {
|
|
|
3679
3682
|
for (const [c, f] of r)
|
|
3680
3683
|
switch (c) {
|
|
3681
3684
|
case "querySubs": {
|
|
3682
|
-
const l =
|
|
3685
|
+
const l = fu(c, f, o);
|
|
3683
3686
|
u.push(l);
|
|
3684
3687
|
break;
|
|
3685
3688
|
}
|
|
3686
3689
|
default: {
|
|
3687
|
-
const l =
|
|
3690
|
+
const l = nr(c, f, s);
|
|
3688
3691
|
u.push(l);
|
|
3689
3692
|
const p = {
|
|
3690
3693
|
createdAt: Date.now(),
|
|
@@ -3695,16 +3698,16 @@ function fu(t, e) {
|
|
|
3695
3698
|
break;
|
|
3696
3699
|
}
|
|
3697
3700
|
}
|
|
3698
|
-
const d =
|
|
3701
|
+
const d = nr(qe, a, s);
|
|
3699
3702
|
u.push(d), yield Promise.all(u), yield new Promise((c, f) => {
|
|
3700
3703
|
i.oncomplete = (l) => c(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
|
|
3701
3704
|
});
|
|
3702
3705
|
});
|
|
3703
3706
|
}
|
|
3704
|
-
const
|
|
3705
|
-
class
|
|
3707
|
+
const rr = /* @__PURE__ */ new Map();
|
|
3708
|
+
class ni extends ou {
|
|
3706
3709
|
constructor(e, n) {
|
|
3707
|
-
super(e, n), this.dbName = `instant_${e}_${
|
|
3710
|
+
super(e, n), this.dbName = `instant_${e}_${uu}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
|
|
3708
3711
|
}
|
|
3709
3712
|
_init() {
|
|
3710
3713
|
return new Promise((e, n) => {
|
|
@@ -3715,12 +3718,12 @@ class ti extends su {
|
|
|
3715
3718
|
}, i.onsuccess = (s) => {
|
|
3716
3719
|
const u = s.target.result;
|
|
3717
3720
|
if (r) {
|
|
3718
|
-
const a =
|
|
3719
|
-
|
|
3721
|
+
const a = lu(this._appId, u).catch((d) => {
|
|
3722
|
+
cu("Error upgrading store from version 5 to 6.")(d);
|
|
3720
3723
|
});
|
|
3721
|
-
|
|
3724
|
+
rr.set(this.dbName, a), a.then(() => e(u)).catch(() => e(u));
|
|
3722
3725
|
} else {
|
|
3723
|
-
const a =
|
|
3726
|
+
const a = rr.get(this.dbName);
|
|
3724
3727
|
a ? a.then(() => e(u)).catch(() => e(u)) : e(u);
|
|
3725
3728
|
}
|
|
3726
3729
|
}, i.onupgradeneeded = (s) => {
|
|
@@ -3730,7 +3733,7 @@ class ti extends su {
|
|
|
3730
3733
|
}
|
|
3731
3734
|
_upgradeStore(e) {
|
|
3732
3735
|
const r = e.target.result;
|
|
3733
|
-
for (const i of
|
|
3736
|
+
for (const i of au)
|
|
3734
3737
|
r.objectStoreNames.contains(i) || r.createObjectStore(i);
|
|
3735
3738
|
}
|
|
3736
3739
|
getItem(e) {
|
|
@@ -3805,7 +3808,7 @@ class ti extends su {
|
|
|
3805
3808
|
});
|
|
3806
3809
|
}
|
|
3807
3810
|
}
|
|
3808
|
-
var
|
|
3811
|
+
var hu = function(t, e, n, r) {
|
|
3809
3812
|
function i(s) {
|
|
3810
3813
|
return s instanceof n ? s : new n(function(o) {
|
|
3811
3814
|
o(s);
|
|
@@ -3832,9 +3835,9 @@ var lu = function(t, e, n, r) {
|
|
|
3832
3835
|
d((r = r.apply(t, e || [])).next());
|
|
3833
3836
|
});
|
|
3834
3837
|
};
|
|
3835
|
-
class
|
|
3838
|
+
class ri {
|
|
3836
3839
|
static getIsOnline() {
|
|
3837
|
-
return
|
|
3840
|
+
return hu(this, void 0, void 0, function* () {
|
|
3838
3841
|
return navigator.onLine;
|
|
3839
3842
|
});
|
|
3840
3843
|
}
|
|
@@ -3859,7 +3862,7 @@ class je extends Error {
|
|
|
3859
3862
|
return "InstantError";
|
|
3860
3863
|
}
|
|
3861
3864
|
}
|
|
3862
|
-
var
|
|
3865
|
+
var pu = function(t, e, n, r) {
|
|
3863
3866
|
function i(s) {
|
|
3864
3867
|
return s instanceof n ? s : new n(function(o) {
|
|
3865
3868
|
o(s);
|
|
@@ -3899,7 +3902,7 @@ class bt extends je {
|
|
|
3899
3902
|
}
|
|
3900
3903
|
}
|
|
3901
3904
|
function te(t, e) {
|
|
3902
|
-
return
|
|
3905
|
+
return pu(this, void 0, void 0, function* () {
|
|
3903
3906
|
const n = yield fetch(t, e), r = yield n.json();
|
|
3904
3907
|
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new bt({ status: n.status, body: r }));
|
|
3905
3908
|
});
|
|
@@ -3931,14 +3934,14 @@ var Pe = function(t, e, n, r) {
|
|
|
3931
3934
|
d((r = r.apply(t, e || [])).next());
|
|
3932
3935
|
});
|
|
3933
3936
|
};
|
|
3934
|
-
function
|
|
3937
|
+
function yu({ apiURI: t, appId: e, email: n }) {
|
|
3935
3938
|
return te(`${t}/runtime/auth/send_magic_code`, {
|
|
3936
3939
|
method: "POST",
|
|
3937
3940
|
headers: { "content-type": "application/json" },
|
|
3938
3941
|
body: JSON.stringify({ "app-id": e, email: n })
|
|
3939
3942
|
});
|
|
3940
3943
|
}
|
|
3941
|
-
function
|
|
3944
|
+
function bu(t) {
|
|
3942
3945
|
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
|
|
3943
3946
|
return yield te(`${e}/runtime/auth/verify_magic_code`, {
|
|
3944
3947
|
method: "POST",
|
|
@@ -3951,7 +3954,7 @@ function yu(t) {
|
|
|
3951
3954
|
});
|
|
3952
3955
|
});
|
|
3953
3956
|
}
|
|
3954
|
-
function
|
|
3957
|
+
function _u(t) {
|
|
3955
3958
|
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3956
3959
|
return yield te(`${e}/runtime/auth/verify_refresh_token`, {
|
|
3957
3960
|
method: "POST",
|
|
@@ -3963,7 +3966,7 @@ function bu(t) {
|
|
|
3963
3966
|
});
|
|
3964
3967
|
});
|
|
3965
3968
|
}
|
|
3966
|
-
function
|
|
3969
|
+
function gu(t) {
|
|
3967
3970
|
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
|
|
3968
3971
|
return yield te(`${e}/runtime/auth/sign_in_guest`, {
|
|
3969
3972
|
method: "POST",
|
|
@@ -3974,7 +3977,7 @@ function _u(t) {
|
|
|
3974
3977
|
});
|
|
3975
3978
|
});
|
|
3976
3979
|
}
|
|
3977
|
-
function
|
|
3980
|
+
function ir(t) {
|
|
3978
3981
|
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
3979
3982
|
return yield te(`${e}/runtime/oauth/token`, {
|
|
3980
3983
|
method: "POST",
|
|
@@ -3988,7 +3991,7 @@ function rr(t) {
|
|
|
3988
3991
|
});
|
|
3989
3992
|
});
|
|
3990
3993
|
}
|
|
3991
|
-
function
|
|
3994
|
+
function Tu(t) {
|
|
3992
3995
|
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
|
|
3993
3996
|
return yield te(`${e}/runtime/oauth/id_token`, {
|
|
3994
3997
|
method: "POST",
|
|
@@ -4003,7 +4006,7 @@ function gu(t) {
|
|
|
4003
4006
|
});
|
|
4004
4007
|
});
|
|
4005
4008
|
}
|
|
4006
|
-
function
|
|
4009
|
+
function mu(t) {
|
|
4007
4010
|
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
4008
4011
|
return yield te(`${e}/runtime/signout`, {
|
|
4009
4012
|
method: "POST",
|
|
@@ -4044,7 +4047,7 @@ var Ge = function(t, e, n, r) {
|
|
|
4044
4047
|
d((r = r.apply(t, e || [])).next());
|
|
4045
4048
|
});
|
|
4046
4049
|
};
|
|
4047
|
-
function
|
|
4050
|
+
function wu(t) {
|
|
4048
4051
|
return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: u }) {
|
|
4049
4052
|
const a = {
|
|
4050
4053
|
app_id: n,
|
|
@@ -4059,7 +4062,7 @@ function mu(t) {
|
|
|
4059
4062
|
});
|
|
4060
4063
|
});
|
|
4061
4064
|
}
|
|
4062
|
-
function
|
|
4065
|
+
function vu(t) {
|
|
4063
4066
|
return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
4064
4067
|
const { data: s } = yield te(`${e}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
4065
4068
|
method: "DELETE",
|
|
@@ -4071,7 +4074,7 @@ function wu(t) {
|
|
|
4071
4074
|
return s;
|
|
4072
4075
|
});
|
|
4073
4076
|
}
|
|
4074
|
-
function
|
|
4077
|
+
function Su(t) {
|
|
4075
4078
|
return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
|
|
4076
4079
|
const { data: o } = yield te(`${e}/storage/signed-upload-url`, {
|
|
4077
4080
|
method: "POST",
|
|
@@ -4087,7 +4090,7 @@ function vu(t) {
|
|
|
4087
4090
|
return o;
|
|
4088
4091
|
});
|
|
4089
4092
|
}
|
|
4090
|
-
function
|
|
4093
|
+
function Ou(t, e) {
|
|
4091
4094
|
return Ge(this, void 0, void 0, function* () {
|
|
4092
4095
|
return (yield fetch(t, {
|
|
4093
4096
|
method: "PUT",
|
|
@@ -4098,7 +4101,7 @@ function Su(t, e) {
|
|
|
4098
4101
|
})).ok;
|
|
4099
4102
|
});
|
|
4100
4103
|
}
|
|
4101
|
-
function
|
|
4104
|
+
function Eu(t) {
|
|
4102
4105
|
return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
4103
4106
|
const { data: s } = yield te(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
4104
4107
|
method: "GET",
|
|
@@ -4110,9 +4113,9 @@ function Ou(t) {
|
|
|
4110
4113
|
return s;
|
|
4111
4114
|
});
|
|
4112
4115
|
}
|
|
4113
|
-
let
|
|
4114
|
-
typeof window < "u" && typeof window.localStorage < "u" && (
|
|
4115
|
-
function
|
|
4116
|
+
let pn = !1, ii = !1, si = !1;
|
|
4117
|
+
typeof window < "u" && typeof window.localStorage < "u" && (pn = !!window.localStorage.getItem("devBackend"), ii = !!window.localStorage.getItem("__instantLogging"), si = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
4118
|
+
function sr(t, e) {
|
|
4116
4119
|
if (!e)
|
|
4117
4120
|
return t;
|
|
4118
4121
|
const n = {};
|
|
@@ -4120,33 +4123,33 @@ function ir(t, e) {
|
|
|
4120
4123
|
n[r] = t[r];
|
|
4121
4124
|
}), n;
|
|
4122
4125
|
}
|
|
4123
|
-
function
|
|
4126
|
+
function Au(t, e, n) {
|
|
4124
4127
|
var r, i;
|
|
4125
4128
|
const s = {
|
|
4126
4129
|
peers: {}
|
|
4127
4130
|
};
|
|
4128
4131
|
if (e && "user" in e ? e.user : !0) {
|
|
4129
|
-
const u =
|
|
4132
|
+
const u = sr((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
|
|
4130
4133
|
s.user = Object.assign(Object.assign({}, u), { peerId: n });
|
|
4131
4134
|
}
|
|
4132
4135
|
for (const u of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
|
|
4133
4136
|
const a = (e == null ? void 0 : e.peers) === void 0, d = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(u));
|
|
4134
4137
|
if (a || d) {
|
|
4135
|
-
const c =
|
|
4138
|
+
const c = sr(t.peers[u], e == null ? void 0 : e.keys);
|
|
4136
4139
|
s.peers[u] = Object.assign(Object.assign({}, c), { peerId: u });
|
|
4137
4140
|
}
|
|
4138
4141
|
}
|
|
4139
4142
|
return s;
|
|
4140
4143
|
}
|
|
4141
|
-
function
|
|
4142
|
-
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !
|
|
4144
|
+
function ju(t, e) {
|
|
4145
|
+
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !Vn(t.user, e.user)) || !Rr(t.peers, e.peers))
|
|
4143
4146
|
return !0;
|
|
4144
4147
|
for (const r of Object.keys(t.peers))
|
|
4145
|
-
if (!
|
|
4148
|
+
if (!Vn(t.peers[r], e.peers[r]))
|
|
4146
4149
|
return !0;
|
|
4147
4150
|
return !1;
|
|
4148
4151
|
}
|
|
4149
|
-
class
|
|
4152
|
+
class or {
|
|
4150
4153
|
constructor() {
|
|
4151
4154
|
this.promise = new Promise((e, n) => {
|
|
4152
4155
|
this._resolve = e, this._reject = n;
|
|
@@ -4159,20 +4162,20 @@ class sr {
|
|
|
4159
4162
|
this._reject(e);
|
|
4160
4163
|
}
|
|
4161
4164
|
}
|
|
4162
|
-
function
|
|
4165
|
+
function oi(t, e = []) {
|
|
4163
4166
|
t.forEach((n) => {
|
|
4164
4167
|
const { data: r } = n, { "datalog-result": i } = r, { "join-rows": s } = i;
|
|
4165
4168
|
for (const o of s)
|
|
4166
4169
|
for (const u of o)
|
|
4167
4170
|
e.push(u);
|
|
4168
|
-
|
|
4171
|
+
oi(n["child-nodes"], e);
|
|
4169
4172
|
});
|
|
4170
4173
|
}
|
|
4171
|
-
function
|
|
4174
|
+
function ur(t) {
|
|
4172
4175
|
const e = [];
|
|
4173
|
-
return
|
|
4176
|
+
return oi(t, e), e;
|
|
4174
4177
|
}
|
|
4175
|
-
function
|
|
4178
|
+
function ar(t) {
|
|
4176
4179
|
return Object.values(t.links).reduce((e, n) => {
|
|
4177
4180
|
var r, i, s, o;
|
|
4178
4181
|
return (r = e[s = n.forward.on]) !== null && r !== void 0 || (e[s] = {}), e[n.forward.on][n.forward.label] = {
|
|
@@ -4186,8 +4189,8 @@ function ur(t) {
|
|
|
4186
4189
|
}, e;
|
|
4187
4190
|
}, {});
|
|
4188
4191
|
}
|
|
4189
|
-
const
|
|
4190
|
-
function
|
|
4192
|
+
const ui = "v0.22.85-experimental.drewh-entity-caching.20114568406.1";
|
|
4193
|
+
function ku(t, e) {
|
|
4191
4194
|
return {
|
|
4192
4195
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
4193
4196
|
},
|
|
@@ -4225,7 +4228,7 @@ class M extends Error {
|
|
|
4225
4228
|
super(r), this.name = "QueryValidationError";
|
|
4226
4229
|
}
|
|
4227
4230
|
}
|
|
4228
|
-
const
|
|
4231
|
+
const cr = [
|
|
4229
4232
|
"where",
|
|
4230
4233
|
"order",
|
|
4231
4234
|
"limit",
|
|
@@ -4236,7 +4239,7 @@ const ar = [
|
|
|
4236
4239
|
"before",
|
|
4237
4240
|
"fields",
|
|
4238
4241
|
"aggregate"
|
|
4239
|
-
],
|
|
4242
|
+
], Cu = (t) => t.valueType || "unknown", ai = (t, e, n = !1) => {
|
|
4240
4243
|
if (n || t == null)
|
|
4241
4244
|
return !0;
|
|
4242
4245
|
switch (e) {
|
|
@@ -4251,9 +4254,9 @@ const ar = [
|
|
|
4251
4254
|
default:
|
|
4252
4255
|
return !0;
|
|
4253
4256
|
}
|
|
4254
|
-
},
|
|
4257
|
+
}, Pu = (t, e, n, r, i, s, o) => {
|
|
4255
4258
|
const u = s.valueType === "json", a = (d, c, f) => {
|
|
4256
|
-
if (!
|
|
4259
|
+
if (!ai(f, c, u))
|
|
4257
4260
|
throw new M(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
|
|
4258
4261
|
};
|
|
4259
4262
|
switch (t) {
|
|
@@ -4284,16 +4287,16 @@ const ar = [
|
|
|
4284
4287
|
throw new M(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
|
|
4285
4288
|
}
|
|
4286
4289
|
}, Oe = (t, e, n, r, i) => {
|
|
4287
|
-
const s =
|
|
4290
|
+
const s = Cu(n), o = n.valueType === "json";
|
|
4288
4291
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
4289
4292
|
if (o)
|
|
4290
4293
|
return;
|
|
4291
4294
|
const a = t;
|
|
4292
4295
|
for (const [d, c] of Object.entries(a))
|
|
4293
|
-
|
|
4294
|
-
} else if (!
|
|
4296
|
+
Pu(d, c, s, e, r, n, `${i}.${d}`);
|
|
4297
|
+
} else if (!ai(t, s, o))
|
|
4295
4298
|
throw new M(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
|
|
4296
|
-
},
|
|
4299
|
+
}, Iu = (t, e, n, r, i) => {
|
|
4297
4300
|
const s = t.split(".");
|
|
4298
4301
|
if (s.length < 2)
|
|
4299
4302
|
throw new M(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
|
|
@@ -4330,12 +4333,12 @@ const ar = [
|
|
|
4330
4333
|
throw new M(`Attribute '${u}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
|
|
4331
4334
|
}
|
|
4332
4335
|
Oe(e, t, d, n, i);
|
|
4333
|
-
},
|
|
4336
|
+
}, ci = (t, e, n, r) => {
|
|
4334
4337
|
for (const [i, s] of Object.entries(t)) {
|
|
4335
4338
|
if (i === "or" || i === "and") {
|
|
4336
4339
|
if (Array.isArray(s))
|
|
4337
4340
|
for (const d of s)
|
|
4338
|
-
typeof d == "object" && d !== null &&
|
|
4341
|
+
typeof d == "object" && d !== null && ci(d, e, n, `${r}.${i}[${d}]`);
|
|
4339
4342
|
continue;
|
|
4340
4343
|
}
|
|
4341
4344
|
if (i === "id") {
|
|
@@ -4343,7 +4346,7 @@ const ar = [
|
|
|
4343
4346
|
continue;
|
|
4344
4347
|
}
|
|
4345
4348
|
if (i.includes(".")) {
|
|
4346
|
-
|
|
4349
|
+
Iu(i, s, e, n, `${r}.${i}`);
|
|
4347
4350
|
continue;
|
|
4348
4351
|
}
|
|
4349
4352
|
const o = n.entities[e];
|
|
@@ -4363,10 +4366,10 @@ const ar = [
|
|
|
4363
4366
|
Oe(s, i, d, e, `${r}.${i}`);
|
|
4364
4367
|
}
|
|
4365
4368
|
}
|
|
4366
|
-
},
|
|
4369
|
+
}, Mu = (t, e, n, r, i = 0) => {
|
|
4367
4370
|
for (const o of Object.keys(t))
|
|
4368
|
-
if (!
|
|
4369
|
-
throw new M(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${
|
|
4371
|
+
if (!cr.includes(o))
|
|
4372
|
+
throw new M(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${cr.join(", ")}. Found: ${o}`, r);
|
|
4370
4373
|
const s = [
|
|
4371
4374
|
// 'limit', // only supported client side
|
|
4372
4375
|
"offset",
|
|
@@ -4381,9 +4384,9 @@ const ar = [
|
|
|
4381
4384
|
if (t.where && n) {
|
|
4382
4385
|
if (typeof t.where != "object" || t.where === null)
|
|
4383
4386
|
throw new M(`'where' clause must be an object in entity '${e}', but received: ${typeof t.where}`, r ? `${r}.where` : void 0);
|
|
4384
|
-
|
|
4387
|
+
ci(t.where, e, n, r ? `${r}.where` : "where");
|
|
4385
4388
|
}
|
|
4386
|
-
},
|
|
4389
|
+
}, di = (t, e, n, r, i = 0) => {
|
|
4387
4390
|
var s;
|
|
4388
4391
|
if (!t || typeof t != "object")
|
|
4389
4392
|
throw new M(`Query part for entity '${e}' must be an object, but received: ${typeof t}`, r);
|
|
@@ -4396,15 +4399,15 @@ const ar = [
|
|
|
4396
4399
|
const u = t[o];
|
|
4397
4400
|
if (typeof u == "object" && u !== null) {
|
|
4398
4401
|
const a = (s = n == null ? void 0 : n.entities[e].links[o]) === null || s === void 0 ? void 0 : s.entityName;
|
|
4399
|
-
a &&
|
|
4402
|
+
a && di(u, a, n, `${r}.${o}`, i + 1);
|
|
4400
4403
|
}
|
|
4401
4404
|
} else {
|
|
4402
4405
|
const u = t[o];
|
|
4403
4406
|
if (typeof u != "object" || u === null)
|
|
4404
4407
|
throw new M(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof u}`, `${r}.$`);
|
|
4405
|
-
|
|
4408
|
+
Mu(u, e, n, `${r}.$`, i);
|
|
4406
4409
|
}
|
|
4407
|
-
},
|
|
4410
|
+
}, dr = (t, e) => {
|
|
4408
4411
|
if (typeof t != "object" || t === null)
|
|
4409
4412
|
throw new M(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
|
|
4410
4413
|
if (Array.isArray(t))
|
|
@@ -4420,67 +4423,67 @@ const ar = [
|
|
|
4420
4423
|
const i = Object.keys(e.entities);
|
|
4421
4424
|
throw new M(`Entity '${r}' does not exist in schema. Available entities: ${i.length > 0 ? i.join(", ") : "none"}`, r);
|
|
4422
4425
|
}
|
|
4423
|
-
|
|
4426
|
+
di(n[r], r, e, r, 0);
|
|
4424
4427
|
}
|
|
4425
4428
|
}
|
|
4426
|
-
},
|
|
4429
|
+
}, fr = (t) => typeof t != "string" ? !1 : ht(t) ? !0 : Ee(t);
|
|
4427
4430
|
class Z extends Error {
|
|
4428
4431
|
constructor(e) {
|
|
4429
4432
|
super(e), this.name = "TransactionValidationError";
|
|
4430
4433
|
}
|
|
4431
4434
|
}
|
|
4432
|
-
const
|
|
4435
|
+
const fi = (t) => t.length > 0 ? t.join(", ") : "none", Ru = (t, e) => new Z(`Entity '${t}' does not exist in schema. Available entities: ${fi(e)}`), lr = {
|
|
4433
4436
|
string: (t) => typeof t == "string",
|
|
4434
4437
|
number: (t) => typeof t == "number" && !isNaN(t),
|
|
4435
4438
|
boolean: (t) => typeof t == "boolean",
|
|
4436
4439
|
date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
|
|
4437
4440
|
json: () => !0
|
|
4438
|
-
},
|
|
4441
|
+
}, $u = (t, e) => {
|
|
4439
4442
|
var n, r;
|
|
4440
|
-
return t == null ? !0 : (r = (n =
|
|
4441
|
-
},
|
|
4443
|
+
return t == null ? !0 : (r = (n = lr[e.valueType]) === null || n === void 0 ? void 0 : n.call(lr, t)) !== null && r !== void 0 ? r : !1;
|
|
4444
|
+
}, li = (t, e) => {
|
|
4442
4445
|
const n = e.entities[t];
|
|
4443
4446
|
if (!n)
|
|
4444
|
-
throw
|
|
4447
|
+
throw Ru(t, Object.keys(e.entities));
|
|
4445
4448
|
return n;
|
|
4446
|
-
},
|
|
4447
|
-
const r =
|
|
4449
|
+
}, Pt = (t, e, n) => {
|
|
4450
|
+
const r = li(t, n);
|
|
4448
4451
|
if (typeof e != "object" || e === null)
|
|
4449
4452
|
throw new Z(`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
4450
4453
|
for (const [i, s] of Object.entries(e)) {
|
|
4451
4454
|
if (i === "id")
|
|
4452
4455
|
continue;
|
|
4453
4456
|
const o = r.attrs[i];
|
|
4454
|
-
if (o &&
|
|
4457
|
+
if (o && !$u(s, o))
|
|
4455
4458
|
throw new Z(`Invalid value for attribute '${i}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof s}`);
|
|
4456
4459
|
}
|
|
4457
|
-
},
|
|
4458
|
-
const r =
|
|
4460
|
+
}, hr = (t, e, n) => {
|
|
4461
|
+
const r = li(t, n);
|
|
4459
4462
|
if (typeof e != "object" || e === null)
|
|
4460
4463
|
throw new Z(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
4461
4464
|
for (const [i, s] of Object.entries(e)) {
|
|
4462
4465
|
if (!r.links[i]) {
|
|
4463
4466
|
const u = Object.keys(r.links);
|
|
4464
|
-
throw new Z(`Link '${i}' does not exist on entity '${t}'. Available links: ${
|
|
4467
|
+
throw new Z(`Link '${i}' does not exist on entity '${t}'. Available links: ${fi(u)}`);
|
|
4465
4468
|
}
|
|
4466
4469
|
if (s != null) {
|
|
4467
4470
|
if (Array.isArray(s)) {
|
|
4468
4471
|
for (const u of s)
|
|
4469
|
-
if (!
|
|
4472
|
+
if (!fr(u))
|
|
4470
4473
|
throw new Z(`Invalid entity ID in link '${i}' for entity '${t}'. Expected a UUID or a lookup, but received: ${u}`);
|
|
4471
|
-
} else if (!
|
|
4474
|
+
} else if (!fr(s))
|
|
4472
4475
|
throw new Z(`Invalid UUID in link '${i}' for entity '${t}'. Expected a UUID, but received: ${s}`);
|
|
4473
4476
|
}
|
|
4474
4477
|
}
|
|
4475
|
-
},
|
|
4476
|
-
create:
|
|
4477
|
-
update:
|
|
4478
|
-
merge:
|
|
4479
|
-
link:
|
|
4480
|
-
unlink:
|
|
4478
|
+
}, xu = {
|
|
4479
|
+
create: Pt,
|
|
4480
|
+
update: Pt,
|
|
4481
|
+
merge: Pt,
|
|
4482
|
+
link: hr,
|
|
4483
|
+
unlink: hr,
|
|
4481
4484
|
delete: () => {
|
|
4482
4485
|
}
|
|
4483
|
-
},
|
|
4486
|
+
}, Du = (t, e) => {
|
|
4484
4487
|
if (!e)
|
|
4485
4488
|
return;
|
|
4486
4489
|
const [n, r, i, s] = t;
|
|
@@ -4488,9 +4491,9 @@ const di = (t) => t.length > 0 ? t.join(", ") : "none", Mu = (t, e) => new Z(`En
|
|
|
4488
4491
|
throw new Z(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
|
|
4489
4492
|
if (typeof r != "string")
|
|
4490
4493
|
throw new Z(`Entity name must be a string, but received: ${typeof r}`);
|
|
4491
|
-
const o =
|
|
4494
|
+
const o = xu[n];
|
|
4492
4495
|
o && s !== void 0 && o(r, s, e);
|
|
4493
|
-
},
|
|
4496
|
+
}, Uu = (t, e) => {
|
|
4494
4497
|
const n = Array.isArray(t) ? t : [t];
|
|
4495
4498
|
for (const r of n) {
|
|
4496
4499
|
if (!r || typeof r != "object")
|
|
@@ -4500,11 +4503,11 @@ const di = (t) => t.length > 0 ? t.join(", ") : "none", Mu = (t, e) => new Z(`En
|
|
|
4500
4503
|
for (const i of r.__ops) {
|
|
4501
4504
|
if (!Array.isArray(i))
|
|
4502
4505
|
throw new Z(`Transaction operation must be an array, but received: ${typeof i}`);
|
|
4503
|
-
|
|
4506
|
+
Du(i, e);
|
|
4504
4507
|
}
|
|
4505
4508
|
}
|
|
4506
4509
|
};
|
|
4507
|
-
var
|
|
4510
|
+
var pr = function(t, e, n, r) {
|
|
4508
4511
|
function i(s) {
|
|
4509
4512
|
return s instanceof n ? s : new n(function(o) {
|
|
4510
4513
|
o(s);
|
|
@@ -4531,10 +4534,10 @@ var hr = function(t, e, n, r) {
|
|
|
4531
4534
|
d((r = r.apply(t, e || [])).next());
|
|
4532
4535
|
});
|
|
4533
4536
|
};
|
|
4534
|
-
let
|
|
4535
|
-
class
|
|
4537
|
+
let hi = 0;
|
|
4538
|
+
class yr {
|
|
4536
4539
|
constructor(e) {
|
|
4537
|
-
this.type = "ws", this.id = `${this.type}_${
|
|
4540
|
+
this.type = "ws", this.id = `${this.type}_${hi++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
|
|
4538
4541
|
this.onopen && this.onopen({ target: this });
|
|
4539
4542
|
}, this.conn.onmessage = (n) => {
|
|
4540
4543
|
this.onmessage && this.onmessage({
|
|
@@ -4562,9 +4565,9 @@ class pr {
|
|
|
4562
4565
|
return this.conn.send(JSON.stringify(e));
|
|
4563
4566
|
}
|
|
4564
4567
|
}
|
|
4565
|
-
class
|
|
4568
|
+
class Lu {
|
|
4566
4569
|
constructor(e, n) {
|
|
4567
|
-
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${
|
|
4570
|
+
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${hi++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
|
|
4568
4571
|
this.initParams || this.handleError();
|
|
4569
4572
|
}, 1e4), this.conn.onmessage = (r) => {
|
|
4570
4573
|
const i = JSON.parse(r.data);
|
|
@@ -4603,7 +4606,7 @@ class Uu {
|
|
|
4603
4606
|
this.conn.close(), this.onclose && !this.closeFired && (this.closeFired = !0, this.onclose({ target: this }));
|
|
4604
4607
|
}
|
|
4605
4608
|
postMessages(e) {
|
|
4606
|
-
return
|
|
4609
|
+
return pr(this, void 0, void 0, function* () {
|
|
4607
4610
|
var n, r, i;
|
|
4608
4611
|
try {
|
|
4609
4612
|
(yield fetch(this.url, {
|
|
@@ -4622,7 +4625,7 @@ class Uu {
|
|
|
4622
4625
|
});
|
|
4623
4626
|
}
|
|
4624
4627
|
flushQueue() {
|
|
4625
|
-
return
|
|
4628
|
+
return pr(this, void 0, void 0, function* () {
|
|
4626
4629
|
if (this.sendPromise || !this.sendQueue.length)
|
|
4627
4630
|
return;
|
|
4628
4631
|
const e = this.sendQueue;
|
|
@@ -4648,7 +4651,7 @@ class Uu {
|
|
|
4648
4651
|
this.handleClose();
|
|
4649
4652
|
}
|
|
4650
4653
|
}
|
|
4651
|
-
var
|
|
4654
|
+
var br = function(t, e, n, r) {
|
|
4652
4655
|
function i(s) {
|
|
4653
4656
|
return s instanceof n ? s : new n(function(o) {
|
|
4654
4657
|
o(s);
|
|
@@ -4675,34 +4678,34 @@ var yr = function(t, e, n, r) {
|
|
|
4675
4678
|
d((r = r.apply(t, e || [])).next());
|
|
4676
4679
|
});
|
|
4677
4680
|
};
|
|
4678
|
-
function
|
|
4681
|
+
function Fu(t, e) {
|
|
4679
4682
|
const n = t.values;
|
|
4680
4683
|
if (n)
|
|
4681
4684
|
for (const r of n.entities || [])
|
|
4682
|
-
r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store =
|
|
4685
|
+
r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store = Fr(r.store);
|
|
4683
4686
|
return t;
|
|
4684
4687
|
}
|
|
4685
|
-
function
|
|
4688
|
+
function Nu(t, e) {
|
|
4686
4689
|
var n, r;
|
|
4687
4690
|
if (!((n = e.values) === null || n === void 0) && n.entities) {
|
|
4688
4691
|
const i = [];
|
|
4689
4692
|
for (const s of (r = e.values) === null || r === void 0 ? void 0 : r.entities) {
|
|
4690
|
-
const o =
|
|
4693
|
+
const o = Lr(s.store);
|
|
4691
4694
|
delete o.attrs, i.push(Object.assign(Object.assign({}, s), { store: o }));
|
|
4692
4695
|
}
|
|
4693
4696
|
return Object.assign(Object.assign({}, e), { values: Object.assign(Object.assign({}, e.values), { entities: i }) });
|
|
4694
4697
|
} else
|
|
4695
4698
|
return e;
|
|
4696
4699
|
}
|
|
4697
|
-
function
|
|
4700
|
+
function Ku(t, e, n) {
|
|
4698
4701
|
var r, i;
|
|
4699
4702
|
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;
|
|
4700
4703
|
return s && (!o || s > o) ? e : o && (!s || o > s) ? n : e || n;
|
|
4701
4704
|
}
|
|
4702
|
-
function
|
|
4703
|
-
return
|
|
4705
|
+
function It(t, e) {
|
|
4706
|
+
return Zr({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4704
4707
|
}
|
|
4705
|
-
function
|
|
4708
|
+
function _r(t, e, n) {
|
|
4706
4709
|
var r;
|
|
4707
4710
|
const i = (r = fe(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
|
|
4708
4711
|
if (!i)
|
|
@@ -4710,18 +4713,18 @@ function br(t, e, n) {
|
|
|
4710
4713
|
const s = Ce(e.eav, [n, i, n]);
|
|
4711
4714
|
return s ? s[3] : -1;
|
|
4712
4715
|
}
|
|
4713
|
-
function
|
|
4716
|
+
function gr(t, e) {
|
|
4714
4717
|
for (const { action: n, triple: r } of e)
|
|
4715
4718
|
switch (n) {
|
|
4716
4719
|
case "added":
|
|
4717
|
-
|
|
4720
|
+
qr(t, r);
|
|
4718
4721
|
break;
|
|
4719
4722
|
case "removed":
|
|
4720
|
-
|
|
4723
|
+
Nr(t, r);
|
|
4721
4724
|
break;
|
|
4722
4725
|
}
|
|
4723
4726
|
}
|
|
4724
|
-
function
|
|
4727
|
+
function qu(t, e) {
|
|
4725
4728
|
var n, r, i, s;
|
|
4726
4729
|
const o = {};
|
|
4727
4730
|
for (const { action: u, triple: a } of e) {
|
|
@@ -4749,14 +4752,14 @@ function Ku(t, e) {
|
|
|
4749
4752
|
function rt(t, e) {
|
|
4750
4753
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4751
4754
|
}
|
|
4752
|
-
function
|
|
4755
|
+
function zu(t, e) {
|
|
4753
4756
|
var n;
|
|
4754
4757
|
if (t.orderFieldType)
|
|
4755
4758
|
return t.orderFieldType;
|
|
4756
4759
|
const r = t.orderField === "serverCreatedAt" ? "number" : (n = fe(e([]), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
|
|
4757
4760
|
return t.orderFieldType = r, r;
|
|
4758
4761
|
}
|
|
4759
|
-
function
|
|
4762
|
+
function Vu(t, e, n) {
|
|
4760
4763
|
const r = e;
|
|
4761
4764
|
if (t.orderField === "serverCreatedAt") {
|
|
4762
4765
|
n.sort(t.orderDirection === "asc" ? function(o, u) {
|
|
@@ -4777,13 +4780,13 @@ var pe;
|
|
|
4777
4780
|
(function(t) {
|
|
4778
4781
|
t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
|
|
4779
4782
|
})(pe || (pe = {}));
|
|
4780
|
-
class
|
|
4783
|
+
class Wu {
|
|
4781
4784
|
constructor(e, n, r, i, s) {
|
|
4782
|
-
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new
|
|
4785
|
+
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Jt({
|
|
4783
4786
|
persister: n,
|
|
4784
|
-
merge:
|
|
4785
|
-
serialize:
|
|
4786
|
-
parse: (o, u) =>
|
|
4787
|
+
merge: Ku,
|
|
4788
|
+
serialize: Nu,
|
|
4789
|
+
parse: (o, u) => Fu(u, this.config.useDateObjects),
|
|
4787
4790
|
objectSize: (o) => {
|
|
4788
4791
|
var u;
|
|
4789
4792
|
return ((u = o.values) === null || u === void 0 ? void 0 : u.entities.length) || 0;
|
|
@@ -4840,7 +4843,7 @@ class Vu {
|
|
|
4840
4843
|
});
|
|
4841
4844
|
}
|
|
4842
4845
|
initSubscription(e, n, r) {
|
|
4843
|
-
return
|
|
4846
|
+
return br(this, void 0, void 0, function* () {
|
|
4844
4847
|
var i, s, o, u;
|
|
4845
4848
|
yield this.subs.waitForKeyToLoad(n);
|
|
4846
4849
|
const a = this.subs.currentValue[n];
|
|
@@ -4866,7 +4869,7 @@ class Vu {
|
|
|
4866
4869
|
});
|
|
4867
4870
|
}
|
|
4868
4871
|
flushPending() {
|
|
4869
|
-
return
|
|
4872
|
+
return br(this, void 0, void 0, function* () {
|
|
4870
4873
|
for (const e of Object.keys(this.callbacks)) {
|
|
4871
4874
|
yield this.subs.waitForKeyToLoad(e);
|
|
4872
4875
|
const n = this.subs.currentValue[e];
|
|
@@ -4911,11 +4914,11 @@ class Vu {
|
|
|
4911
4914
|
for (const c of i) {
|
|
4912
4915
|
const f = this.createStore(c);
|
|
4913
4916
|
a.attrs = f.attrs;
|
|
4914
|
-
const l =
|
|
4917
|
+
const l = It(u, f);
|
|
4915
4918
|
d.push({
|
|
4916
4919
|
store: f,
|
|
4917
4920
|
entity: l,
|
|
4918
|
-
serverCreatedAt:
|
|
4921
|
+
serverCreatedAt: _r(u, f, l.id)
|
|
4919
4922
|
}), o.push(l);
|
|
4920
4923
|
}
|
|
4921
4924
|
this.subs.updateInPlace((c) => {
|
|
@@ -4985,9 +4988,9 @@ class Vu {
|
|
|
4985
4988
|
e: for (const [T, v] of Object.entries(f))
|
|
4986
4989
|
for (let k = 0; k < p.length; k++) {
|
|
4987
4990
|
const S = p[k];
|
|
4988
|
-
if (
|
|
4989
|
-
|
|
4990
|
-
const I =
|
|
4991
|
+
if (Ss(S.store, T)) {
|
|
4992
|
+
gr(S.store, v);
|
|
4993
|
+
const I = It(u, S.store), R = qu(S.store, v)[T];
|
|
4991
4994
|
I ? (y.push({
|
|
4992
4995
|
oldEntity: S.entity,
|
|
4993
4996
|
newEntity: I,
|
|
@@ -4999,8 +5002,8 @@ class Vu {
|
|
|
4999
5002
|
const b = [];
|
|
5000
5003
|
for (const [T, v] of Object.entries(f)) {
|
|
5001
5004
|
const k = this.createStore([]);
|
|
5002
|
-
l.attrs = k.attrs,
|
|
5003
|
-
const S =
|
|
5005
|
+
l.attrs = k.attrs, gr(k, v);
|
|
5006
|
+
const S = It(u, k);
|
|
5004
5007
|
if (!S) {
|
|
5005
5008
|
this.log.error("No entity found after applying change", {
|
|
5006
5009
|
sub: u,
|
|
@@ -5012,14 +5015,14 @@ class Vu {
|
|
|
5012
5015
|
p.push({
|
|
5013
5016
|
store: k,
|
|
5014
5017
|
entity: S,
|
|
5015
|
-
serverCreatedAt:
|
|
5018
|
+
serverCreatedAt: _r(u, k, S.id)
|
|
5016
5019
|
}), b.push(S);
|
|
5017
5020
|
}
|
|
5018
5021
|
const g = [];
|
|
5019
5022
|
for (const T of c.sort().reverse())
|
|
5020
5023
|
g.push(p[T].entity), p.splice(T, 1);
|
|
5021
|
-
const m =
|
|
5022
|
-
|
|
5024
|
+
const m = zu(u, this.createStore);
|
|
5025
|
+
Vu(u, m, p), this.notifyCbs(o, {
|
|
5023
5026
|
type: pe.SyncTransaction,
|
|
5024
5027
|
data: rt(u, (i = u.values) === null || i === void 0 ? void 0 : i.entities),
|
|
5025
5028
|
added: b,
|
|
@@ -5086,7 +5089,7 @@ var U = function(t, e, n, r) {
|
|
|
5086
5089
|
}
|
|
5087
5090
|
d((r = r.apply(t, e || [])).next());
|
|
5088
5091
|
});
|
|
5089
|
-
},
|
|
5092
|
+
}, Bu = function(t, e) {
|
|
5090
5093
|
var n = {};
|
|
5091
5094
|
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
5092
5095
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -5100,46 +5103,46 @@ const se = {
|
|
|
5100
5103
|
AUTHENTICATED: "authenticated",
|
|
5101
5104
|
CLOSED: "closed",
|
|
5102
5105
|
ERRORED: "errored"
|
|
5103
|
-
},
|
|
5106
|
+
}, Gu = 3e4, Qu = 3e4, Hu = 200, Yu = {
|
|
5104
5107
|
apiURI: "https://api.instantdb.com",
|
|
5105
5108
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5106
|
-
},
|
|
5107
|
-
function
|
|
5109
|
+
}, Mt = "_instant_oauth_redirect", De = "currentUser";
|
|
5110
|
+
function Ju({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
5108
5111
|
if (!i)
|
|
5109
|
-
return new
|
|
5112
|
+
return new yr(`${r}?app_id=${e}`);
|
|
5110
5113
|
switch (t) {
|
|
5111
5114
|
case "ws":
|
|
5112
|
-
return new
|
|
5115
|
+
return new yr(`${r}?app_id=${e}`);
|
|
5113
5116
|
case "sse":
|
|
5114
|
-
return new
|
|
5117
|
+
return new Lu(i, `${n}/runtime/sse?app_id=${e}`);
|
|
5115
5118
|
default:
|
|
5116
5119
|
throw new Error("Unknown transport type " + t);
|
|
5117
5120
|
}
|
|
5118
5121
|
}
|
|
5119
|
-
function
|
|
5122
|
+
function Zu() {
|
|
5120
5123
|
return typeof window < "u" || typeof chrome < "u";
|
|
5121
5124
|
}
|
|
5122
|
-
const
|
|
5125
|
+
const Tr = {
|
|
5123
5126
|
"set-presence": !0,
|
|
5124
5127
|
"set-presence-ok": !0,
|
|
5125
5128
|
"refresh-presence": !0,
|
|
5126
5129
|
"patch-presence": !0
|
|
5127
5130
|
};
|
|
5128
|
-
function
|
|
5131
|
+
function Xu(t, e) {
|
|
5129
5132
|
var n;
|
|
5130
5133
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
5131
5134
|
if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
|
|
5132
5135
|
const i = r.result.store;
|
|
5133
|
-
r.result.store =
|
|
5136
|
+
r.result.store = Fr(Object.assign(Object.assign({}, i), { useDateObjects: e }));
|
|
5134
5137
|
}
|
|
5135
5138
|
return r;
|
|
5136
5139
|
}
|
|
5137
|
-
function
|
|
5140
|
+
function ea(t, e) {
|
|
5138
5141
|
var n;
|
|
5139
5142
|
const r = Object.assign({}, e);
|
|
5140
|
-
return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store:
|
|
5143
|
+
return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: Lr(e.result.store) })), r;
|
|
5141
5144
|
}
|
|
5142
|
-
function
|
|
5145
|
+
function ta(t, e) {
|
|
5143
5146
|
switch (t) {
|
|
5144
5147
|
case "pendingMutations":
|
|
5145
5148
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -5147,7 +5150,7 @@ function ea(t, e) {
|
|
|
5147
5150
|
return e;
|
|
5148
5151
|
}
|
|
5149
5152
|
}
|
|
5150
|
-
function
|
|
5153
|
+
function na(t, e) {
|
|
5151
5154
|
switch (t) {
|
|
5152
5155
|
case "pendingMutations":
|
|
5153
5156
|
return [...e.entries()];
|
|
@@ -5155,18 +5158,18 @@ function ta(t, e) {
|
|
|
5155
5158
|
return e;
|
|
5156
5159
|
}
|
|
5157
5160
|
}
|
|
5158
|
-
function
|
|
5161
|
+
function ra(t, e, n) {
|
|
5159
5162
|
const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
|
|
5160
5163
|
return r && !i && n && (n.result = r), n || e;
|
|
5161
5164
|
}
|
|
5162
|
-
function
|
|
5165
|
+
function mr(t) {
|
|
5163
5166
|
return [...t].sort((e, n) => {
|
|
5164
5167
|
const [r, i] = e, [s, o] = n, u = i.order || 0, a = o.order || 0;
|
|
5165
5168
|
return u == a ? r < s ? -1 : r > s ? 1 : 0 : u - a;
|
|
5166
5169
|
});
|
|
5167
5170
|
}
|
|
5168
|
-
class
|
|
5169
|
-
constructor(e, n =
|
|
5171
|
+
class ia {
|
|
5172
|
+
constructor(e, n = ni, r = ri, i, s) {
|
|
5170
5173
|
var o, u, a;
|
|
5171
5174
|
if (this._isOnline = !0, this._isShutdown = !1, this.status = se.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (d, c, f) => {
|
|
5172
5175
|
var l, p;
|
|
@@ -5198,9 +5201,9 @@ class ra {
|
|
|
5198
5201
|
}, this.notifyQueryError = (d, c) => {
|
|
5199
5202
|
(this.queryCbs[d] || []).forEach((l) => l.cb({ error: c }));
|
|
5200
5203
|
}, this.pushTx = (d) => {
|
|
5201
|
-
this.config.disableValidation ||
|
|
5204
|
+
this.config.disableValidation || Uu(d, this.config.schema);
|
|
5202
5205
|
try {
|
|
5203
|
-
const c =
|
|
5206
|
+
const c = su({
|
|
5204
5207
|
attrs: this.optimisticAttrs(),
|
|
5205
5208
|
schema: this.config.schema,
|
|
5206
5209
|
stores: Object.values(this.querySubs.currentValue).map((f) => {
|
|
@@ -5224,7 +5227,7 @@ class ra {
|
|
|
5224
5227
|
this._updatePendingMutations((g) => {
|
|
5225
5228
|
g.set(f, y);
|
|
5226
5229
|
});
|
|
5227
|
-
const b = new
|
|
5230
|
+
const b = new or();
|
|
5228
5231
|
return this.mutationDeferredStore.set(f, b), this._sendMutation(f, y), this.notifyAll(), b.promise;
|
|
5229
5232
|
}, this._transportOnOpen = (d) => {
|
|
5230
5233
|
const c = d.target;
|
|
@@ -5289,7 +5292,7 @@ class ra {
|
|
|
5289
5292
|
return;
|
|
5290
5293
|
}
|
|
5291
5294
|
this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
5292
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({},
|
|
5295
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Yu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Qu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Hu, this._log = ku(e.verbose || pn || ii, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": ui }), this.config.schema && (this._linkIndex = ar(this.config.schema)), !!Zu()) {
|
|
5293
5296
|
if (!e.appId)
|
|
5294
5297
|
throw new Error("Instant must be initialized with an appId.");
|
|
5295
5298
|
if (!Ee(e.appId))
|
|
@@ -5304,7 +5307,7 @@ class ra {
|
|
|
5304
5307
|
} catch (f) {
|
|
5305
5308
|
this._log.error("[error] handle broadcast channel", f);
|
|
5306
5309
|
}
|
|
5307
|
-
}))), this._initStorage(n), this._syncTable = new
|
|
5310
|
+
}))), this._initStorage(n), this._syncTable = new Wu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
5308
5311
|
useDateObjects: this.config.useDateObjects
|
|
5309
5312
|
}, this._log, (d) => at(this.attrs, d, this.config.enableCardinalityInference, this._linkIndex, this.config.useDateObjects)), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
|
|
5310
5313
|
this._isOnline = d, this._startSocket(), r.listen((c) => {
|
|
@@ -5314,7 +5317,7 @@ class ra {
|
|
|
5314
5317
|
}
|
|
5315
5318
|
}
|
|
5316
5319
|
updateSchema(e) {
|
|
5317
|
-
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ?
|
|
5320
|
+
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ? ar(this.config.schema) : null;
|
|
5318
5321
|
}
|
|
5319
5322
|
_reactorStats() {
|
|
5320
5323
|
return {
|
|
@@ -5327,11 +5330,11 @@ class ra {
|
|
|
5327
5330
|
this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
|
|
5328
5331
|
}
|
|
5329
5332
|
_initStorage(e) {
|
|
5330
|
-
this.querySubs = new
|
|
5333
|
+
this.querySubs = new Jt({
|
|
5331
5334
|
persister: new e(this.config.appId, "querySubs"),
|
|
5332
|
-
merge:
|
|
5333
|
-
serialize:
|
|
5334
|
-
parse: (n, r) =>
|
|
5335
|
+
merge: ra,
|
|
5336
|
+
serialize: ea,
|
|
5337
|
+
parse: (n, r) => Xu(r, this.config.useDateObjects),
|
|
5335
5338
|
// objectSize
|
|
5336
5339
|
objectSize: (n) => {
|
|
5337
5340
|
var r, i, s, o;
|
|
@@ -5347,11 +5350,11 @@ class ra {
|
|
|
5347
5350
|
maxSize: 1e6
|
|
5348
5351
|
// 1 million triples
|
|
5349
5352
|
}
|
|
5350
|
-
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new
|
|
5353
|
+
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Jt({
|
|
5351
5354
|
persister: new e(this.config.appId, "kv"),
|
|
5352
5355
|
merge: this._onMergeKv,
|
|
5353
|
-
serialize:
|
|
5354
|
-
parse:
|
|
5356
|
+
serialize: na,
|
|
5357
|
+
parse: ta,
|
|
5355
5358
|
objectSize: () => 0,
|
|
5356
5359
|
logger: this._log,
|
|
5357
5360
|
saveThrottleMs: 100,
|
|
@@ -5382,7 +5385,7 @@ class ra {
|
|
|
5382
5385
|
if (s)
|
|
5383
5386
|
i.resolve({ status: e, eventId: n });
|
|
5384
5387
|
else if (r != null && r.type) {
|
|
5385
|
-
const { status: o } = r, u =
|
|
5388
|
+
const { status: o } = r, u = Bu(r, ["status"]);
|
|
5386
5389
|
i.reject(new bt({
|
|
5387
5390
|
// @ts-expect-error body.type is not constant typed
|
|
5388
5391
|
body: u,
|
|
@@ -5406,7 +5409,7 @@ class ra {
|
|
|
5406
5409
|
_handleReceive(e, n) {
|
|
5407
5410
|
var r, i, s, o, u, a;
|
|
5408
5411
|
const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
5409
|
-
switch (
|
|
5412
|
+
switch (Tr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
5410
5413
|
case "init-ok": {
|
|
5411
5414
|
this._setStatus(se.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
5412
5415
|
for (const l of Object.keys(this._rooms)) {
|
|
@@ -5423,7 +5426,7 @@ class ra {
|
|
|
5423
5426
|
const { q: l, result: p } = n, y = N(l);
|
|
5424
5427
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
5425
5428
|
break;
|
|
5426
|
-
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"], g = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, m =
|
|
5429
|
+
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"], g = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, m = ur(p), T = at(this.attrs, m, d, this._linkIndex, this.config.useDateObjects);
|
|
5427
5430
|
this.querySubs.updateInPlace((v) => {
|
|
5428
5431
|
if (!v[y]) {
|
|
5429
5432
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
@@ -5461,9 +5464,9 @@ class ra {
|
|
|
5461
5464
|
b !== this._pendingMutations() && this.kv.updateInPlace((T) => {
|
|
5462
5465
|
T.pendingMutations = b;
|
|
5463
5466
|
});
|
|
5464
|
-
const g =
|
|
5467
|
+
const g = mr(b.entries()), m = l.map((T) => {
|
|
5465
5468
|
var v, k, S, I;
|
|
5466
|
-
const R = T["instaql-query"], q = T["instaql-result"], Ie = N(R), Qe =
|
|
5469
|
+
const R = T["instaql-query"], q = T["instaql-result"], Ie = N(R), Qe = ur(q), _t = at(this.attrs, Qe, d, this._linkIndex, this.config.useDateObjects), gt = this._applyOptimisticUpdates(_t, g, y), He = (k = (v = q == null ? void 0 : q[0]) === null || v === void 0 ? void 0 : v.data) === null || k === void 0 ? void 0 : k["page-info"], ne = (I = (S = q == null ? void 0 : q[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
|
|
5467
5470
|
return { q: R, hash: Ie, store: gt, pageInfo: He, aggregate: ne };
|
|
5468
5471
|
});
|
|
5469
5472
|
m.forEach(({ hash: T, q: v, store: k, pageInfo: S, aggregate: I }) => {
|
|
@@ -5626,7 +5629,7 @@ class ra {
|
|
|
5626
5629
|
*/
|
|
5627
5630
|
subscribeQuery(e, n, r) {
|
|
5628
5631
|
var i;
|
|
5629
|
-
this.config.disableValidation ||
|
|
5632
|
+
this.config.disableValidation || dr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
|
|
5630
5633
|
const s = N(e), o = this.getPreviousResult(e);
|
|
5631
5634
|
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), () => {
|
|
5632
5635
|
this._unsubQuery(e, s, n);
|
|
@@ -5634,14 +5637,14 @@ class ra {
|
|
|
5634
5637
|
}
|
|
5635
5638
|
queryOnce(e, n) {
|
|
5636
5639
|
var r;
|
|
5637
|
-
this.config.disableValidation ||
|
|
5638
|
-
const i = new
|
|
5640
|
+
this.config.disableValidation || dr(e, this.config.schema), n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
5641
|
+
const i = new or();
|
|
5639
5642
|
if (!this._isOnline)
|
|
5640
5643
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
5641
5644
|
if (!this.querySubs)
|
|
5642
5645
|
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;
|
|
5643
5646
|
const s = N(e), o = this._startQuerySub(e, s);
|
|
5644
|
-
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")),
|
|
5647
|
+
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")), Gu), i.promise;
|
|
5645
5648
|
}
|
|
5646
5649
|
_completeQueryOnce(e, n, r) {
|
|
5647
5650
|
this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
|
|
@@ -5702,7 +5705,7 @@ class ra {
|
|
|
5702
5705
|
u = !0;
|
|
5703
5706
|
continue;
|
|
5704
5707
|
}
|
|
5705
|
-
const b = u ?
|
|
5708
|
+
const b = u ? xo(o, p) : p;
|
|
5706
5709
|
l.push(b);
|
|
5707
5710
|
}
|
|
5708
5711
|
return u ? l : c;
|
|
@@ -5712,7 +5715,7 @@ class ra {
|
|
|
5712
5715
|
return u ? d : n;
|
|
5713
5716
|
}
|
|
5714
5717
|
_rewriteMutationsSorted(e, n) {
|
|
5715
|
-
return
|
|
5718
|
+
return mr(this._rewriteMutations(e, n).entries());
|
|
5716
5719
|
}
|
|
5717
5720
|
// ---------------------------
|
|
5718
5721
|
// Transact
|
|
@@ -5746,11 +5749,11 @@ class ra {
|
|
|
5746
5749
|
if (d && r === d.querySubVersion && s === d.pendingMutationsVersion)
|
|
5747
5750
|
return d;
|
|
5748
5751
|
const { store: c, pageInfo: f, aggregate: l, processedTxId: p } = a, y = this._rewriteMutationsSorted(c.attrs, o), b = this._applyOptimisticUpdates(c, y, p);
|
|
5749
|
-
return { data:
|
|
5752
|
+
return { data: Zr({ store: b, pageInfo: f, aggregate: l }, u), querySubVersion: r, pendingMutationsVersion: s };
|
|
5750
5753
|
}
|
|
5751
5754
|
_applyOptimisticUpdates(e, n, r) {
|
|
5752
5755
|
for (const [i, s] of n)
|
|
5753
|
-
(!s["tx-id"] || r && s["tx-id"] > r) && (e =
|
|
5756
|
+
(!s["tx-id"] || r && s["tx-id"] > r) && (e = xs(e, s["tx-steps"]));
|
|
5754
5757
|
return e;
|
|
5755
5758
|
}
|
|
5756
5759
|
/** Re-compute all subscriptions */
|
|
@@ -5838,7 +5841,7 @@ class ra {
|
|
|
5838
5841
|
}
|
|
5839
5842
|
_trySend(e, n, r) {
|
|
5840
5843
|
if (this._transport.isOpen()) {
|
|
5841
|
-
switch (
|
|
5844
|
+
switch (Tr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
|
|
5842
5845
|
case "transact": {
|
|
5843
5846
|
this._inFlightMutationEventIds.add(e);
|
|
5844
5847
|
break;
|
|
@@ -5859,7 +5862,7 @@ class ra {
|
|
|
5859
5862
|
return;
|
|
5860
5863
|
}
|
|
5861
5864
|
const e = this._transport;
|
|
5862
|
-
this._transport =
|
|
5865
|
+
this._transport = Ju({
|
|
5863
5866
|
transportType: this._transportType,
|
|
5864
5867
|
appId: this.config.appId,
|
|
5865
5868
|
apiURI: this.config.apiURI,
|
|
@@ -5895,9 +5898,9 @@ class ra {
|
|
|
5895
5898
|
if (typeof URL > "u")
|
|
5896
5899
|
return;
|
|
5897
5900
|
const e = new URL(window.location.href);
|
|
5898
|
-
if (e.searchParams.get(
|
|
5901
|
+
if (e.searchParams.get(Mt)) {
|
|
5899
5902
|
const n = e.toString();
|
|
5900
|
-
e.searchParams.delete(
|
|
5903
|
+
e.searchParams.delete(Mt), e.searchParams.delete("code"), e.searchParams.delete("error");
|
|
5901
5904
|
const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
|
|
5902
5905
|
if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
|
|
5903
5906
|
typeof navigation == "object" && // @ts-ignore (waiting for ts support)
|
|
@@ -5922,7 +5925,7 @@ class ra {
|
|
|
5922
5925
|
if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
|
|
5923
5926
|
return null;
|
|
5924
5927
|
const s = new URLSearchParams(window.location.search);
|
|
5925
|
-
if (!s.get(
|
|
5928
|
+
if (!s.get(Mt))
|
|
5926
5929
|
return null;
|
|
5927
5930
|
const o = s.get("error");
|
|
5928
5931
|
if (o)
|
|
@@ -5932,7 +5935,7 @@ class ra {
|
|
|
5932
5935
|
return null;
|
|
5933
5936
|
this._replaceUrlAfterOAuth();
|
|
5934
5937
|
try {
|
|
5935
|
-
const a = yield this._getCurrentUser(), d = (a == null ? void 0 : a.type) === "guest", { user: c } = yield
|
|
5938
|
+
const a = yield this._getCurrentUser(), d = (a == null ? void 0 : a.type) === "guest", { user: c } = yield ir({
|
|
5936
5939
|
apiURI: this.config.apiURI,
|
|
5937
5940
|
appId: this.config.appId,
|
|
5938
5941
|
code: u,
|
|
@@ -6062,7 +6065,7 @@ class ra {
|
|
|
6062
6065
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
|
|
6063
6066
|
}
|
|
6064
6067
|
sendMagicCode({ email: e }) {
|
|
6065
|
-
return
|
|
6068
|
+
return yu({
|
|
6066
6069
|
apiURI: this.config.apiURI,
|
|
6067
6070
|
appId: this.config.appId,
|
|
6068
6071
|
email: e
|
|
@@ -6071,7 +6074,7 @@ class ra {
|
|
|
6071
6074
|
signInWithMagicCode(e) {
|
|
6072
6075
|
return U(this, arguments, void 0, function* ({ email: n, code: r }) {
|
|
6073
6076
|
var i;
|
|
6074
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield
|
|
6077
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield bu({
|
|
6075
6078
|
apiURI: this.config.apiURI,
|
|
6076
6079
|
appId: this.config.appId,
|
|
6077
6080
|
email: n,
|
|
@@ -6083,7 +6086,7 @@ class ra {
|
|
|
6083
6086
|
}
|
|
6084
6087
|
signInWithCustomToken(e) {
|
|
6085
6088
|
return U(this, void 0, void 0, function* () {
|
|
6086
|
-
const n = yield
|
|
6089
|
+
const n = yield _u({
|
|
6087
6090
|
apiURI: this.config.apiURI,
|
|
6088
6091
|
appId: this.config.appId,
|
|
6089
6092
|
refreshToken: e
|
|
@@ -6093,7 +6096,7 @@ class ra {
|
|
|
6093
6096
|
}
|
|
6094
6097
|
signInAsGuest() {
|
|
6095
6098
|
return U(this, void 0, void 0, function* () {
|
|
6096
|
-
const e = yield
|
|
6099
|
+
const e = yield gu({
|
|
6097
6100
|
apiURI: this.config.apiURI,
|
|
6098
6101
|
appId: this.config.appId
|
|
6099
6102
|
});
|
|
@@ -6109,7 +6112,7 @@ class ra {
|
|
|
6109
6112
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
6110
6113
|
return;
|
|
6111
6114
|
}
|
|
6112
|
-
|
|
6115
|
+
mu({
|
|
6113
6116
|
apiURI: this.config.apiURI,
|
|
6114
6117
|
appId: this.config.appId,
|
|
6115
6118
|
refreshToken: i
|
|
@@ -6144,7 +6147,7 @@ class ra {
|
|
|
6144
6147
|
exchangeCodeForToken(e) {
|
|
6145
6148
|
return U(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
|
|
6146
6149
|
var i;
|
|
6147
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield
|
|
6150
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield ir({
|
|
6148
6151
|
apiURI: this.config.apiURI,
|
|
6149
6152
|
appId: this.config.appId,
|
|
6150
6153
|
code: n,
|
|
@@ -6167,7 +6170,7 @@ class ra {
|
|
|
6167
6170
|
signInWithIdToken(e) {
|
|
6168
6171
|
return U(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
|
|
6169
6172
|
var s;
|
|
6170
|
-
const o = yield this.getCurrentUser(), u = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, a = yield
|
|
6173
|
+
const o = yield this.getCurrentUser(), u = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, a = yield Tu({
|
|
6171
6174
|
apiURI: this.config.apiURI,
|
|
6172
6175
|
appId: this.config.appId,
|
|
6173
6176
|
idToken: n,
|
|
@@ -6208,7 +6211,7 @@ class ra {
|
|
|
6208
6211
|
// TODO: look into typing again
|
|
6209
6212
|
getPresence(e, n, r = {}) {
|
|
6210
6213
|
const i = this._rooms[n], s = this._presence[n];
|
|
6211
|
-
return !i || !s || !s.result ? null : Object.assign(Object.assign({},
|
|
6214
|
+
return !i || !s || !s.result ? null : Object.assign(Object.assign({}, Au(s.result, r, this._sessionId)), { isLoading: !i.isConnected, error: i.error });
|
|
6212
6215
|
}
|
|
6213
6216
|
// TODO: look into typing again
|
|
6214
6217
|
publishPresence(e, n, r) {
|
|
@@ -6258,7 +6261,7 @@ class ra {
|
|
|
6258
6261
|
}
|
|
6259
6262
|
_notifyPresenceSub(e, n) {
|
|
6260
6263
|
const r = this.getPresence("", e, n);
|
|
6261
|
-
r && (n.prev && !
|
|
6264
|
+
r && (n.prev && !ju(r, n.prev) || (n.prev = r, n.cb(r)));
|
|
6262
6265
|
}
|
|
6263
6266
|
_patchPresencePeers(e, n) {
|
|
6264
6267
|
var r, i, s;
|
|
@@ -6269,13 +6272,13 @@ class ra {
|
|
|
6269
6272
|
for (let [c, f, l] of n)
|
|
6270
6273
|
switch (f) {
|
|
6271
6274
|
case "+":
|
|
6272
|
-
|
|
6275
|
+
rs(d, c, l);
|
|
6273
6276
|
break;
|
|
6274
6277
|
case "r":
|
|
6275
|
-
|
|
6278
|
+
Wn(d, c, l);
|
|
6276
6279
|
break;
|
|
6277
6280
|
case "-":
|
|
6278
|
-
|
|
6281
|
+
xr(d, c);
|
|
6279
6282
|
break;
|
|
6280
6283
|
}
|
|
6281
6284
|
delete d[this._sessionId];
|
|
@@ -6287,7 +6290,7 @@ class ra {
|
|
|
6287
6290
|
delete r[this._sessionId];
|
|
6288
6291
|
const i = Object.fromEntries(Object.entries(r).map(([s, o]) => [s, o.data]));
|
|
6289
6292
|
this._presence = ft(this._presence, (s) => {
|
|
6290
|
-
|
|
6293
|
+
Wn(s, [e, "result", "peers"], i);
|
|
6291
6294
|
});
|
|
6292
6295
|
}
|
|
6293
6296
|
// --------
|
|
@@ -6332,14 +6335,14 @@ class ra {
|
|
|
6332
6335
|
return U(this, void 0, void 0, function* () {
|
|
6333
6336
|
var i;
|
|
6334
6337
|
const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
|
|
6335
|
-
return
|
|
6338
|
+
return wu(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
|
|
6336
6339
|
});
|
|
6337
6340
|
}
|
|
6338
6341
|
deleteFile(e) {
|
|
6339
6342
|
return U(this, void 0, void 0, function* () {
|
|
6340
6343
|
var n;
|
|
6341
6344
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
6342
|
-
return yield
|
|
6345
|
+
return yield vu({
|
|
6343
6346
|
apiURI: this.config.apiURI,
|
|
6344
6347
|
appId: this.config.appId,
|
|
6345
6348
|
path: e,
|
|
@@ -6352,20 +6355,20 @@ class ra {
|
|
|
6352
6355
|
upload(e, n) {
|
|
6353
6356
|
return U(this, void 0, void 0, function* () {
|
|
6354
6357
|
var r;
|
|
6355
|
-
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, u = yield
|
|
6358
|
+
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, u = yield Su({
|
|
6356
6359
|
apiURI: this.config.apiURI,
|
|
6357
6360
|
appId: this.config.appId,
|
|
6358
6361
|
fileName: o,
|
|
6359
6362
|
refreshToken: s
|
|
6360
6363
|
});
|
|
6361
|
-
return yield
|
|
6364
|
+
return yield Ou(u, n);
|
|
6362
6365
|
});
|
|
6363
6366
|
}
|
|
6364
6367
|
getDownloadUrl(e) {
|
|
6365
6368
|
return U(this, void 0, void 0, function* () {
|
|
6366
6369
|
var n;
|
|
6367
6370
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
6368
|
-
return yield
|
|
6371
|
+
return yield Eu({
|
|
6369
6372
|
apiURI: this.config.apiURI,
|
|
6370
6373
|
appId: this.config.appId,
|
|
6371
6374
|
path: e,
|
|
@@ -6375,9 +6378,9 @@ class ra {
|
|
|
6375
6378
|
}
|
|
6376
6379
|
}
|
|
6377
6380
|
let it;
|
|
6378
|
-
function
|
|
6381
|
+
function sa(t, e) {
|
|
6379
6382
|
it == null || it.dispose();
|
|
6380
|
-
const n =
|
|
6383
|
+
const n = fa(e), r = aa(e, u), i = ua(oa(t));
|
|
6381
6384
|
function s(c) {
|
|
6382
6385
|
var f;
|
|
6383
6386
|
c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && u();
|
|
@@ -6399,10 +6402,10 @@ function ia(t, e) {
|
|
|
6399
6402
|
}
|
|
6400
6403
|
return d();
|
|
6401
6404
|
}
|
|
6402
|
-
function sa(t) {
|
|
6403
|
-
return `${hn || ii ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
6404
|
-
}
|
|
6405
6405
|
function oa(t) {
|
|
6406
|
+
return `${pn || si ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
6407
|
+
}
|
|
6408
|
+
function ua(t) {
|
|
6406
6409
|
const e = document.createElement("iframe");
|
|
6407
6410
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
6408
6411
|
width: "100%",
|
|
@@ -6411,7 +6414,7 @@ function oa(t) {
|
|
|
6411
6414
|
border: "none"
|
|
6412
6415
|
}), { element: e };
|
|
6413
6416
|
}
|
|
6414
|
-
function
|
|
6417
|
+
function aa(t, e) {
|
|
6415
6418
|
const n = `
|
|
6416
6419
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6417
6420
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -6421,7 +6424,7 @@ function ua(t, e) {
|
|
|
6421
6424
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
|
|
6422
6425
|
// pos
|
|
6423
6426
|
position: "fixed"
|
|
6424
|
-
},
|
|
6427
|
+
}, ca(t.position)), {
|
|
6425
6428
|
height: "32px",
|
|
6426
6429
|
width: "32px",
|
|
6427
6430
|
// layout
|
|
@@ -6436,7 +6439,7 @@ function ua(t, e) {
|
|
|
6436
6439
|
cursor: "pointer"
|
|
6437
6440
|
})), r.addEventListener("click", e), { element: r };
|
|
6438
6441
|
}
|
|
6439
|
-
function
|
|
6442
|
+
function ca(t) {
|
|
6440
6443
|
switch (t) {
|
|
6441
6444
|
case "bottom-left":
|
|
6442
6445
|
return { bottom: "24px", left: "24px" };
|
|
@@ -6448,7 +6451,7 @@ function aa(t) {
|
|
|
6448
6451
|
return { top: "24px", left: "24px" };
|
|
6449
6452
|
}
|
|
6450
6453
|
}
|
|
6451
|
-
function
|
|
6454
|
+
function da(t) {
|
|
6452
6455
|
switch (t) {
|
|
6453
6456
|
case "bottom-left":
|
|
6454
6457
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -6460,47 +6463,47 @@ function ca(t) {
|
|
|
6460
6463
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
6461
6464
|
}
|
|
6462
6465
|
}
|
|
6463
|
-
function
|
|
6466
|
+
function fa(t) {
|
|
6464
6467
|
const e = document.createElement("div");
|
|
6465
|
-
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" },
|
|
6468
|
+
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, da(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";
|
|
6466
6469
|
function n() {
|
|
6467
6470
|
return e.style.display !== "none";
|
|
6468
6471
|
}
|
|
6469
6472
|
return { element: e, isVisible: n };
|
|
6470
6473
|
}
|
|
6471
|
-
const
|
|
6474
|
+
const la = {
|
|
6472
6475
|
apiURI: "https://api.instantdb.com",
|
|
6473
6476
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
6474
6477
|
};
|
|
6475
|
-
function
|
|
6478
|
+
function ha() {
|
|
6476
6479
|
var t;
|
|
6477
6480
|
return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
6478
6481
|
}
|
|
6479
|
-
function
|
|
6482
|
+
function pa() {
|
|
6480
6483
|
var t;
|
|
6481
6484
|
return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
|
|
6482
6485
|
}
|
|
6483
|
-
function
|
|
6486
|
+
function Zt(t) {
|
|
6484
6487
|
const e = t.__adminToken;
|
|
6485
6488
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
6486
6489
|
}
|
|
6487
|
-
const
|
|
6488
|
-
class
|
|
6490
|
+
const Xt = pa(), wr = ha();
|
|
6491
|
+
class ya {
|
|
6489
6492
|
constructor(e) {
|
|
6490
6493
|
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);
|
|
6491
6494
|
}
|
|
6492
6495
|
}
|
|
6493
|
-
class
|
|
6496
|
+
class ba {
|
|
6494
6497
|
constructor(e) {
|
|
6495
6498
|
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);
|
|
6496
6499
|
}
|
|
6497
6500
|
}
|
|
6498
|
-
function
|
|
6501
|
+
function _a(t) {
|
|
6499
6502
|
return JSON.parse(JSON.stringify(t));
|
|
6500
6503
|
}
|
|
6501
|
-
class
|
|
6504
|
+
class ga {
|
|
6502
6505
|
constructor(e) {
|
|
6503
|
-
this.tx =
|
|
6506
|
+
this.tx = hn(), this._reactor = e, this.auth = new ya(this._reactor), this.storage = new ba(this._reactor);
|
|
6504
6507
|
}
|
|
6505
6508
|
/**
|
|
6506
6509
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6641,7 +6644,7 @@ class _a {
|
|
|
6641
6644
|
};
|
|
6642
6645
|
}
|
|
6643
6646
|
shutdown() {
|
|
6644
|
-
delete Zt
|
|
6647
|
+
delete Xt[Zt(this._reactor.config)], this._reactor.shutdown();
|
|
6645
6648
|
}
|
|
6646
6649
|
/**
|
|
6647
6650
|
* Use this for one-off queries.
|
|
@@ -6674,39 +6677,39 @@ class _a {
|
|
|
6674
6677
|
return this._reactor.subscribeTable(e, n);
|
|
6675
6678
|
}
|
|
6676
6679
|
}
|
|
6677
|
-
function
|
|
6680
|
+
function vr(t) {
|
|
6678
6681
|
if (!t)
|
|
6679
6682
|
return "0";
|
|
6680
|
-
const e =
|
|
6683
|
+
const e = wr.get(t);
|
|
6681
6684
|
if (e)
|
|
6682
6685
|
return e;
|
|
6683
6686
|
const n = N(t);
|
|
6684
|
-
return
|
|
6687
|
+
return wr.set(t, n), n;
|
|
6685
6688
|
}
|
|
6686
|
-
function
|
|
6687
|
-
return
|
|
6689
|
+
function Ta(t, e) {
|
|
6690
|
+
return vr(t._reactor.config.schema) !== vr(e);
|
|
6688
6691
|
}
|
|
6689
|
-
function
|
|
6692
|
+
function ma(t, e, n, r, i) {
|
|
6690
6693
|
var s;
|
|
6691
|
-
const o = Object.assign(Object.assign({}, t), { useDateObjects: (s = t.useDateObjects) !== null && s !== void 0 ? s : !1 }), u = Zt
|
|
6694
|
+
const o = Object.assign(Object.assign({}, t), { useDateObjects: (s = t.useDateObjects) !== null && s !== void 0 ? s : !1 }), u = Xt[Zt(o)];
|
|
6692
6695
|
if (u)
|
|
6693
|
-
return
|
|
6694
|
-
const a = new
|
|
6695
|
-
return Zt
|
|
6696
|
+
return Ta(u, o.schema) && u._reactor.updateSchema(o.schema), u;
|
|
6697
|
+
const a = new ia(Object.assign(Object.assign(Object.assign({}, la), o), { cardinalityInference: !!o.schema }), e || ni, n || ri, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": ui }), i), d = new ga(a);
|
|
6698
|
+
return Xt[Zt(o)] = d, wa(o.appId, o.devtool), d;
|
|
6696
6699
|
}
|
|
6697
|
-
function
|
|
6700
|
+
function wa(t, e) {
|
|
6698
6701
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6699
6702
|
return;
|
|
6700
6703
|
const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
|
|
6701
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6704
|
+
n.allowedHosts.includes(window.location.hostname) && sa(t, n);
|
|
6702
6705
|
}
|
|
6703
|
-
const
|
|
6706
|
+
const va = {
|
|
6704
6707
|
isLoading: !0,
|
|
6705
6708
|
data: void 0,
|
|
6706
6709
|
pageInfo: void 0,
|
|
6707
6710
|
error: void 0
|
|
6708
6711
|
};
|
|
6709
|
-
function
|
|
6712
|
+
function Sr(t) {
|
|
6710
6713
|
return {
|
|
6711
6714
|
isLoading: !t,
|
|
6712
6715
|
data: void 0,
|
|
@@ -6715,12 +6718,12 @@ function vr(t) {
|
|
|
6715
6718
|
...t || {}
|
|
6716
6719
|
};
|
|
6717
6720
|
}
|
|
6718
|
-
function
|
|
6721
|
+
function Sa(t, e, n) {
|
|
6719
6722
|
e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
6720
|
-
const r = e ?
|
|
6721
|
-
|
|
6723
|
+
const r = e ? _a(e) : null, i = N(r), s = ze(
|
|
6724
|
+
Sr(t._reactor.getPreviousResult(r))
|
|
6722
6725
|
), o = de(
|
|
6723
|
-
(a) => (s.current =
|
|
6726
|
+
(a) => (s.current = Sr(
|
|
6724
6727
|
t._reactor.getPreviousResult(r)
|
|
6725
6728
|
), r ? t.subscribeQuery(r, (c) => {
|
|
6726
6729
|
s.current = {
|
|
@@ -6738,13 +6741,13 @@ function va(t, e, n) {
|
|
|
6738
6741
|
// Build a new subscribe function if the query changes
|
|
6739
6742
|
[i]
|
|
6740
6743
|
);
|
|
6741
|
-
return { state:
|
|
6744
|
+
return { state: Rt(
|
|
6742
6745
|
o,
|
|
6743
6746
|
() => s.current,
|
|
6744
|
-
() =>
|
|
6747
|
+
() => va
|
|
6745
6748
|
), query: r };
|
|
6746
6749
|
}
|
|
6747
|
-
function
|
|
6750
|
+
function Oa() {
|
|
6748
6751
|
const t = ze(null);
|
|
6749
6752
|
ge(() => {
|
|
6750
6753
|
n();
|
|
@@ -6757,8 +6760,8 @@ function Sa() {
|
|
|
6757
6760
|
}
|
|
6758
6761
|
return { set: e, clear: n };
|
|
6759
6762
|
}
|
|
6760
|
-
const
|
|
6761
|
-
function
|
|
6763
|
+
const Ea = 1e3;
|
|
6764
|
+
function Aa(t, e, n) {
|
|
6762
6765
|
const r = ze(n);
|
|
6763
6766
|
r.current = n, ge(() => t.core._reactor.subscribeTopic(
|
|
6764
6767
|
t.id,
|
|
@@ -6768,7 +6771,7 @@ function Ea(t, e, n) {
|
|
|
6768
6771
|
}
|
|
6769
6772
|
), [t.id, e]);
|
|
6770
6773
|
}
|
|
6771
|
-
function
|
|
6774
|
+
function ja(t, e) {
|
|
6772
6775
|
return ge(() => t.core._reactor.joinRoom(t.id), [t.id]), de(
|
|
6773
6776
|
(r) => {
|
|
6774
6777
|
t.core._reactor.publishTopic({
|
|
@@ -6781,9 +6784,9 @@ function Aa(t, e) {
|
|
|
6781
6784
|
[t.id, e]
|
|
6782
6785
|
);
|
|
6783
6786
|
}
|
|
6784
|
-
function
|
|
6787
|
+
function ka(t, e = {}) {
|
|
6785
6788
|
var o, u;
|
|
6786
|
-
const [n, r] =
|
|
6789
|
+
const [n, r] = Er(() => t.core._reactor.getPresence(t.type, t.id, e) ?? {
|
|
6787
6790
|
peers: {},
|
|
6788
6791
|
isLoading: !0
|
|
6789
6792
|
});
|
|
@@ -6801,18 +6804,18 @@ function ja(t, e = {}) {
|
|
|
6801
6804
|
},
|
|
6802
6805
|
[t.type, t.id]
|
|
6803
6806
|
);
|
|
6804
|
-
return
|
|
6807
|
+
return $t(() => ({
|
|
6805
6808
|
...n,
|
|
6806
6809
|
publishPresence: i
|
|
6807
6810
|
}), [n, i]);
|
|
6808
6811
|
}
|
|
6809
|
-
function
|
|
6812
|
+
function Ca(t, e, n) {
|
|
6810
6813
|
ge(() => t.core._reactor.joinRoom(t.id, e), [t.id]), ge(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
|
|
6811
6814
|
}
|
|
6812
|
-
function
|
|
6813
|
-
const r =
|
|
6815
|
+
function Pa(t, e, n = {}) {
|
|
6816
|
+
const r = Oa(), i = ye.usePresence(t, {
|
|
6814
6817
|
keys: [e]
|
|
6815
|
-
}), s =
|
|
6818
|
+
}), s = $t(() => {
|
|
6816
6819
|
const c = t._core._reactor.getPresence(
|
|
6817
6820
|
t.type,
|
|
6818
6821
|
t.id
|
|
@@ -6824,7 +6827,7 @@ function Ca(t, e, n = {}) {
|
|
|
6824
6827
|
(c) => {
|
|
6825
6828
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6826
6829
|
[e]: c
|
|
6827
|
-
}), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ??
|
|
6830
|
+
}), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? Ea, () => {
|
|
6828
6831
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6829
6832
|
[e]: null
|
|
6830
6833
|
});
|
|
@@ -6839,7 +6842,7 @@ function Ca(t, e, n = {}) {
|
|
|
6839
6842
|
[n.stopOnEnter, o]
|
|
6840
6843
|
), a = de(() => {
|
|
6841
6844
|
o(!1);
|
|
6842
|
-
}, [o]), d =
|
|
6845
|
+
}, [o]), d = $t(() => ({ onKeyDown: u, onBlur: a }), [u, a]);
|
|
6843
6846
|
return {
|
|
6844
6847
|
active: s,
|
|
6845
6848
|
setActive: o,
|
|
@@ -6847,44 +6850,44 @@ function Ca(t, e, n = {}) {
|
|
|
6847
6850
|
};
|
|
6848
6851
|
}
|
|
6849
6852
|
const ye = {
|
|
6850
|
-
useTopicEffect:
|
|
6851
|
-
usePublishTopic:
|
|
6852
|
-
usePresence:
|
|
6853
|
-
useSyncPresence:
|
|
6854
|
-
useTypingIndicator:
|
|
6853
|
+
useTopicEffect: Aa,
|
|
6854
|
+
usePublishTopic: ja,
|
|
6855
|
+
usePresence: ka,
|
|
6856
|
+
useSyncPresence: Ca,
|
|
6857
|
+
useTypingIndicator: Pa
|
|
6855
6858
|
};
|
|
6856
|
-
class
|
|
6859
|
+
class Ia {
|
|
6857
6860
|
constructor(e, n, r) {
|
|
6858
6861
|
this.useTopicEffect = (i, s) => {
|
|
6859
6862
|
ye.useTopicEffect(this, i, s);
|
|
6860
6863
|
}, this.usePublishTopic = (i) => ye.usePublishTopic(this, i), this.usePresence = (i = {}) => ye.usePresence(this, i), this.useSyncPresence = (i, s) => ye.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => ye.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
|
|
6861
6864
|
}
|
|
6862
6865
|
}
|
|
6863
|
-
const
|
|
6866
|
+
const Ma = {
|
|
6864
6867
|
isLoading: !0,
|
|
6865
6868
|
user: void 0,
|
|
6866
6869
|
error: void 0
|
|
6867
6870
|
};
|
|
6868
|
-
class
|
|
6871
|
+
class $a {
|
|
6869
6872
|
constructor(e, n) {
|
|
6870
|
-
this.tx =
|
|
6871
|
-
const [i, s] =
|
|
6873
|
+
this.tx = hn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
6874
|
+
const [i, s] = Er(null);
|
|
6872
6875
|
return ge(() => {
|
|
6873
6876
|
(async () => {
|
|
6874
6877
|
const u = await this.getLocalId(r);
|
|
6875
6878
|
s(u);
|
|
6876
6879
|
})();
|
|
6877
6880
|
}, [r]), i;
|
|
6878
|
-
}, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) =>
|
|
6881
|
+
}, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => Sa(this.core, r, i).state, this.useAuth = () => {
|
|
6879
6882
|
const r = ze(
|
|
6880
6883
|
this.core._reactor._currentUserCached
|
|
6881
6884
|
), i = de((o) => this.core.subscribeAuth((a) => {
|
|
6882
6885
|
r.current = { isLoading: !1, ...a }, o();
|
|
6883
6886
|
}), []);
|
|
6884
|
-
return
|
|
6887
|
+
return Rt(
|
|
6885
6888
|
i,
|
|
6886
6889
|
() => r.current,
|
|
6887
|
-
() =>
|
|
6890
|
+
() => Ma
|
|
6888
6891
|
);
|
|
6889
6892
|
}, this.useUser = () => {
|
|
6890
6893
|
const { user: r } = this.useAuth();
|
|
@@ -6899,7 +6902,7 @@ class Ra {
|
|
|
6899
6902
|
), i = de((o) => this.core.subscribeConnectionStatus((a) => {
|
|
6900
6903
|
a !== r.current && (r.current = a, o());
|
|
6901
6904
|
}), []);
|
|
6902
|
-
return
|
|
6905
|
+
return Rt(
|
|
6903
6906
|
i,
|
|
6904
6907
|
() => r.current,
|
|
6905
6908
|
// For SSR, always return 'connecting' as the initial state
|
|
@@ -6911,7 +6914,7 @@ class Ra {
|
|
|
6911
6914
|
}, this.SignedOut = ({ children: r }) => {
|
|
6912
6915
|
const i = this.useAuth();
|
|
6913
6916
|
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */ et.jsx(et.Fragment, { children: r });
|
|
6914
|
-
}, this.core =
|
|
6917
|
+
}, this.core = ma(
|
|
6915
6918
|
e,
|
|
6916
6919
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
6917
6920
|
this.constructor.Storage,
|
|
@@ -6935,7 +6938,7 @@ class Ra {
|
|
|
6935
6938
|
* const { peers } = db.rooms.usePresence(room);
|
|
6936
6939
|
*/
|
|
6937
6940
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
6938
|
-
return new
|
|
6941
|
+
return new Ia(this.core, e, n);
|
|
6939
6942
|
}
|
|
6940
6943
|
/**
|
|
6941
6944
|
* One time query for the logged in state. This is useful
|
|
@@ -6952,5 +6955,5 @@ class Ra {
|
|
|
6952
6955
|
}
|
|
6953
6956
|
}
|
|
6954
6957
|
export {
|
|
6955
|
-
|
|
6958
|
+
$a as InstantReactAbstractDatabase
|
|
6956
6959
|
};
|