@instantdb/react-common 0.22.38 → 0.22.39
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 +861 -850
- package/dist/standalone/index.umd.cjs +12 -12
- package/package.json +3 -3
package/dist/standalone/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
1
|
+
import lr, { useRef as ut, useCallback as pe, useSyncExternalStore as kt, useEffect as we, useMemo as It, useState as hr } from "react";
|
|
2
|
+
var Mt = { exports: {} }, $e = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.min.js
|
|
@@ -9,11 +9,11 @@ var xt = { exports: {} }, De = {};
|
|
|
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
|
|
12
|
+
var In;
|
|
13
13
|
function Oi() {
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
var e =
|
|
14
|
+
if (In) return $e;
|
|
15
|
+
In = 1;
|
|
16
|
+
var e = lr, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = e.__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 = {}, h = null, p = null;
|
|
19
19
|
d !== void 0 && (h = "" + d), a.key !== void 0 && (h = "" + a.key), a.ref !== void 0 && (p = a.ref);
|
|
@@ -21,12 +21,12 @@ function Oi() {
|
|
|
21
21
|
if (u && u.defaultProps) for (c in a = u.defaultProps, a) f[c] === void 0 && (f[c] = a[c]);
|
|
22
22
|
return { $$typeof: t, type: u, key: h, ref: p, props: f, _owner: i.current };
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return $e.Fragment = n, $e.jsx = o, $e.jsxs = o, $e;
|
|
25
25
|
}
|
|
26
|
-
var
|
|
26
|
+
var De = {}, Mn;
|
|
27
27
|
function Ei() {
|
|
28
|
-
if (
|
|
29
|
-
|
|
28
|
+
if (Mn) return De;
|
|
29
|
+
Mn = 1;
|
|
30
30
|
var e = {};
|
|
31
31
|
/**
|
|
32
32
|
* @license React
|
|
@@ -38,7 +38,7 @@ function Ei() {
|
|
|
38
38
|
* LICENSE file in the root directory of this source tree.
|
|
39
39
|
*/
|
|
40
40
|
return e.NODE_ENV !== "production" && function() {
|
|
41
|
-
var t =
|
|
41
|
+
var t = lr, 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"), h = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, w = "@@iterator";
|
|
42
42
|
function T(l) {
|
|
43
43
|
if (l === null || typeof l != "object")
|
|
44
44
|
return null;
|
|
@@ -50,39 +50,39 @@ function Ei() {
|
|
|
50
50
|
{
|
|
51
51
|
for (var y = arguments.length, _ = new Array(y > 1 ? y - 1 : 0), v = 1; v < y; v++)
|
|
52
52
|
_[v - 1] = arguments[v];
|
|
53
|
-
|
|
53
|
+
W("error", l, _);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function W(l, y, _) {
|
|
57
57
|
{
|
|
58
|
-
var v = m.ReactDebugCurrentFrame,
|
|
59
|
-
|
|
60
|
-
var k = _.map(function(
|
|
61
|
-
return String(
|
|
58
|
+
var v = m.ReactDebugCurrentFrame, P = v.getStackAddendum();
|
|
59
|
+
P !== "" && (y += "%s", _ = _.concat([P]));
|
|
60
|
+
var k = _.map(function(j) {
|
|
61
|
+
return String(j);
|
|
62
62
|
});
|
|
63
63
|
k.unshift("Warning: " + y), Function.prototype.apply.call(console[l], console, k);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
function
|
|
69
|
-
return !!(typeof l == "string" || typeof l == "function" || l === i || l === o ||
|
|
66
|
+
var E = !1, x = !1, L = !1, oe = !1, O = !1, z;
|
|
67
|
+
z = Symbol.for("react.module.reference");
|
|
68
|
+
function he(l) {
|
|
69
|
+
return !!(typeof l == "string" || typeof l == "function" || l === i || l === o || O || l === s || l === c || l === f || oe || l === b || E || x || L || typeof l == "object" && l !== null && (l.$$typeof === p || l.$$typeof === h || l.$$typeof === u || l.$$typeof === a || l.$$typeof === d || // This needs to include all possible module reference object
|
|
70
70
|
// types supported by any Flight configuration anywhere since
|
|
71
71
|
// we don't know which Flight build this will end up being used
|
|
72
72
|
// with.
|
|
73
|
-
l.$$typeof ===
|
|
73
|
+
l.$$typeof === z || l.getModuleId !== void 0));
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function ue(l, y, _) {
|
|
76
76
|
var v = l.displayName;
|
|
77
77
|
if (v)
|
|
78
78
|
return v;
|
|
79
|
-
var
|
|
80
|
-
return
|
|
79
|
+
var P = y.displayName || y.name || "";
|
|
80
|
+
return P !== "" ? _ + "(" + P + ")" : _;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function ne(l) {
|
|
83
83
|
return l.displayName || "Context";
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function F(l) {
|
|
86
86
|
if (l == null)
|
|
87
87
|
return null;
|
|
88
88
|
if (typeof l.tag == "number" && S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof l == "function")
|
|
@@ -107,19 +107,19 @@ function Ei() {
|
|
|
107
107
|
switch (l.$$typeof) {
|
|
108
108
|
case a:
|
|
109
109
|
var y = l;
|
|
110
|
-
return
|
|
110
|
+
return ne(y) + ".Consumer";
|
|
111
111
|
case u:
|
|
112
112
|
var _ = l;
|
|
113
|
-
return
|
|
113
|
+
return ne(_._context) + ".Provider";
|
|
114
114
|
case d:
|
|
115
|
-
return
|
|
115
|
+
return ue(l, l.render, "ForwardRef");
|
|
116
116
|
case h:
|
|
117
117
|
var v = l.displayName || null;
|
|
118
|
-
return v !== null ? v :
|
|
118
|
+
return v !== null ? v : F(l.type) || "Memo";
|
|
119
119
|
case p: {
|
|
120
|
-
var
|
|
120
|
+
var P = l, k = P._payload, j = P._init;
|
|
121
121
|
try {
|
|
122
|
-
return
|
|
122
|
+
return F(j(k));
|
|
123
123
|
} catch {
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
@@ -127,18 +127,18 @@ function Ei() {
|
|
|
127
127
|
}
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
|
-
var
|
|
131
|
-
function
|
|
130
|
+
var U = Object.assign, ye = 0, Ke, Be, Qe, Ge, Ye, hn, pn;
|
|
131
|
+
function yn() {
|
|
132
132
|
}
|
|
133
|
-
|
|
134
|
-
function
|
|
133
|
+
yn.__reactDisabledLog = !0;
|
|
134
|
+
function Jr() {
|
|
135
135
|
{
|
|
136
|
-
if (
|
|
137
|
-
|
|
136
|
+
if (ye === 0) {
|
|
137
|
+
Ke = console.log, Be = console.info, Qe = console.warn, Ge = console.error, Ye = console.group, hn = console.groupCollapsed, pn = console.groupEnd;
|
|
138
138
|
var l = {
|
|
139
139
|
configurable: !0,
|
|
140
140
|
enumerable: !0,
|
|
141
|
-
value:
|
|
141
|
+
value: yn,
|
|
142
142
|
writable: !0
|
|
143
143
|
};
|
|
144
144
|
Object.defineProperties(console, {
|
|
@@ -151,100 +151,100 @@ function Ei() {
|
|
|
151
151
|
groupEnd: l
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
ye++;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
function Zr() {
|
|
158
158
|
{
|
|
159
|
-
if (
|
|
159
|
+
if (ye--, ye === 0) {
|
|
160
160
|
var l = {
|
|
161
161
|
configurable: !0,
|
|
162
162
|
enumerable: !0,
|
|
163
163
|
writable: !0
|
|
164
164
|
};
|
|
165
165
|
Object.defineProperties(console, {
|
|
166
|
-
log:
|
|
167
|
-
value:
|
|
166
|
+
log: U({}, l, {
|
|
167
|
+
value: Ke
|
|
168
168
|
}),
|
|
169
|
-
info:
|
|
170
|
-
value:
|
|
169
|
+
info: U({}, l, {
|
|
170
|
+
value: Be
|
|
171
171
|
}),
|
|
172
|
-
warn:
|
|
173
|
-
value:
|
|
172
|
+
warn: U({}, l, {
|
|
173
|
+
value: Qe
|
|
174
174
|
}),
|
|
175
|
-
error:
|
|
175
|
+
error: U({}, l, {
|
|
176
176
|
value: Ge
|
|
177
177
|
}),
|
|
178
|
-
group:
|
|
178
|
+
group: U({}, l, {
|
|
179
179
|
value: Ye
|
|
180
180
|
}),
|
|
181
|
-
groupCollapsed:
|
|
182
|
-
value:
|
|
181
|
+
groupCollapsed: U({}, l, {
|
|
182
|
+
value: hn
|
|
183
183
|
}),
|
|
184
|
-
groupEnd:
|
|
185
|
-
value:
|
|
184
|
+
groupEnd: U({}, l, {
|
|
185
|
+
value: pn
|
|
186
186
|
})
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
ye < 0 && S("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
var
|
|
193
|
-
function
|
|
192
|
+
var bt = m.ReactCurrentDispatcher, _t;
|
|
193
|
+
function He(l, y, _) {
|
|
194
194
|
{
|
|
195
|
-
if (
|
|
195
|
+
if (_t === void 0)
|
|
196
196
|
try {
|
|
197
197
|
throw Error();
|
|
198
|
-
} catch (
|
|
199
|
-
var v =
|
|
200
|
-
|
|
198
|
+
} catch (P) {
|
|
199
|
+
var v = P.stack.trim().match(/\n( *(at )?)/);
|
|
200
|
+
_t = v && v[1] || "";
|
|
201
201
|
}
|
|
202
202
|
return `
|
|
203
|
-
` +
|
|
203
|
+
` + _t + l;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
var
|
|
206
|
+
var gt = !1, Je;
|
|
207
207
|
{
|
|
208
208
|
var Xr = typeof WeakMap == "function" ? WeakMap : Map;
|
|
209
|
-
|
|
209
|
+
Je = new Xr();
|
|
210
210
|
}
|
|
211
|
-
function
|
|
212
|
-
if (!l ||
|
|
211
|
+
function bn(l, y) {
|
|
212
|
+
if (!l || gt)
|
|
213
213
|
return "";
|
|
214
214
|
{
|
|
215
|
-
var _ =
|
|
215
|
+
var _ = Je.get(l);
|
|
216
216
|
if (_ !== void 0)
|
|
217
217
|
return _;
|
|
218
218
|
}
|
|
219
219
|
var v;
|
|
220
|
-
|
|
221
|
-
var
|
|
220
|
+
gt = !0;
|
|
221
|
+
var P = Error.prepareStackTrace;
|
|
222
222
|
Error.prepareStackTrace = void 0;
|
|
223
223
|
var k;
|
|
224
|
-
k =
|
|
224
|
+
k = bt.current, bt.current = null, Jr();
|
|
225
225
|
try {
|
|
226
226
|
if (y) {
|
|
227
|
-
var
|
|
227
|
+
var j = function() {
|
|
228
228
|
throw Error();
|
|
229
229
|
};
|
|
230
|
-
if (Object.defineProperty(
|
|
230
|
+
if (Object.defineProperty(j.prototype, "props", {
|
|
231
231
|
set: function() {
|
|
232
232
|
throw Error();
|
|
233
233
|
}
|
|
234
234
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
235
235
|
try {
|
|
236
|
-
Reflect.construct(
|
|
236
|
+
Reflect.construct(j, []);
|
|
237
237
|
} catch (Q) {
|
|
238
238
|
v = Q;
|
|
239
239
|
}
|
|
240
|
-
Reflect.construct(l, [],
|
|
240
|
+
Reflect.construct(l, [], j);
|
|
241
241
|
} else {
|
|
242
242
|
try {
|
|
243
|
-
|
|
243
|
+
j.call();
|
|
244
244
|
} catch (Q) {
|
|
245
245
|
v = Q;
|
|
246
246
|
}
|
|
247
|
-
l.call(
|
|
247
|
+
l.call(j.prototype);
|
|
248
248
|
}
|
|
249
249
|
} else {
|
|
250
250
|
try {
|
|
@@ -256,94 +256,94 @@ function Ei() {
|
|
|
256
256
|
}
|
|
257
257
|
} catch (Q) {
|
|
258
258
|
if (Q && v && typeof Q.stack == "string") {
|
|
259
|
-
for (var
|
|
260
|
-
`),
|
|
261
|
-
`), M =
|
|
259
|
+
for (var A = Q.stack.split(`
|
|
260
|
+
`), K = v.stack.split(`
|
|
261
|
+
`), M = A.length - 1, $ = K.length - 1; M >= 1 && $ >= 0 && A[M] !== K[$]; )
|
|
262
262
|
$--;
|
|
263
263
|
for (; M >= 1 && $ >= 0; M--, $--)
|
|
264
|
-
if (
|
|
264
|
+
if (A[M] !== K[$]) {
|
|
265
265
|
if (M !== 1 || $ !== 1)
|
|
266
266
|
do
|
|
267
|
-
if (M--, $--, $ < 0 ||
|
|
268
|
-
var
|
|
269
|
-
` +
|
|
270
|
-
return l.displayName &&
|
|
267
|
+
if (M--, $--, $ < 0 || A[M] !== K[$]) {
|
|
268
|
+
var ee = `
|
|
269
|
+
` + A[M].replace(" at new ", " at ");
|
|
270
|
+
return l.displayName && ee.includes("<anonymous>") && (ee = ee.replace("<anonymous>", l.displayName)), typeof l == "function" && Je.set(l, ee), ee;
|
|
271
271
|
}
|
|
272
272
|
while (M >= 1 && $ >= 0);
|
|
273
273
|
break;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
} finally {
|
|
277
|
-
|
|
277
|
+
gt = !1, bt.current = k, Zr(), Error.prepareStackTrace = P;
|
|
278
278
|
}
|
|
279
|
-
var Oe = l ? l.displayName || l.name : "", be = Oe ?
|
|
280
|
-
return typeof l == "function" &&
|
|
279
|
+
var Oe = l ? l.displayName || l.name : "", be = Oe ? He(Oe) : "";
|
|
280
|
+
return typeof l == "function" && Je.set(l, be), be;
|
|
281
281
|
}
|
|
282
282
|
function ei(l, y, _) {
|
|
283
|
-
return
|
|
283
|
+
return bn(l, !1);
|
|
284
284
|
}
|
|
285
285
|
function ti(l) {
|
|
286
286
|
var y = l.prototype;
|
|
287
287
|
return !!(y && y.isReactComponent);
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function Ze(l, y, _) {
|
|
290
290
|
if (l == null)
|
|
291
291
|
return "";
|
|
292
292
|
if (typeof l == "function")
|
|
293
|
-
return
|
|
293
|
+
return bn(l, ti(l));
|
|
294
294
|
if (typeof l == "string")
|
|
295
|
-
return
|
|
295
|
+
return He(l);
|
|
296
296
|
switch (l) {
|
|
297
297
|
case c:
|
|
298
|
-
return
|
|
298
|
+
return He("Suspense");
|
|
299
299
|
case f:
|
|
300
|
-
return
|
|
300
|
+
return He("SuspenseList");
|
|
301
301
|
}
|
|
302
302
|
if (typeof l == "object")
|
|
303
303
|
switch (l.$$typeof) {
|
|
304
304
|
case d:
|
|
305
305
|
return ei(l.render);
|
|
306
306
|
case h:
|
|
307
|
-
return
|
|
307
|
+
return Ze(l.type, y, _);
|
|
308
308
|
case p: {
|
|
309
|
-
var v = l,
|
|
309
|
+
var v = l, P = v._payload, k = v._init;
|
|
310
310
|
try {
|
|
311
|
-
return
|
|
311
|
+
return Ze(k(P), y, _);
|
|
312
312
|
} catch {
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
return "";
|
|
317
317
|
}
|
|
318
|
-
var
|
|
319
|
-
function
|
|
318
|
+
var Re = Object.prototype.hasOwnProperty, _n = {}, gn = m.ReactDebugCurrentFrame;
|
|
319
|
+
function Xe(l) {
|
|
320
320
|
if (l) {
|
|
321
|
-
var y = l._owner, _ =
|
|
322
|
-
|
|
321
|
+
var y = l._owner, _ = Ze(l.type, l._source, y ? y.type : null);
|
|
322
|
+
gn.setExtraStackFrame(_);
|
|
323
323
|
} else
|
|
324
|
-
|
|
324
|
+
gn.setExtraStackFrame(null);
|
|
325
325
|
}
|
|
326
|
-
function ni(l, y, _, v,
|
|
326
|
+
function ni(l, y, _, v, P) {
|
|
327
327
|
{
|
|
328
|
-
var k = Function.call.bind(
|
|
329
|
-
for (var
|
|
330
|
-
if (k(l,
|
|
331
|
-
var
|
|
328
|
+
var k = Function.call.bind(Re);
|
|
329
|
+
for (var j in l)
|
|
330
|
+
if (k(l, j)) {
|
|
331
|
+
var A = void 0;
|
|
332
332
|
try {
|
|
333
|
-
if (typeof l[
|
|
334
|
-
var
|
|
335
|
-
throw
|
|
333
|
+
if (typeof l[j] != "function") {
|
|
334
|
+
var K = Error((v || "React class") + ": " + _ + " type `" + j + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof l[j] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
335
|
+
throw K.name = "Invariant Violation", K;
|
|
336
336
|
}
|
|
337
|
-
|
|
337
|
+
A = l[j](y, j, v, _, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
338
338
|
} catch (M) {
|
|
339
|
-
|
|
339
|
+
A = M;
|
|
340
340
|
}
|
|
341
|
-
|
|
341
|
+
A && !(A instanceof Error) && (Xe(P), S("%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).", v || "React class", _, j, typeof A), Xe(null)), A instanceof Error && !(A.message in _n) && (_n[A.message] = !0, Xe(P), S("Failed %s type: %s", _, A.message), Xe(null));
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
var ri = Array.isArray;
|
|
346
|
-
function
|
|
346
|
+
function Tt(l) {
|
|
347
347
|
return ri(l);
|
|
348
348
|
}
|
|
349
349
|
function ii(l) {
|
|
@@ -354,26 +354,26 @@ function Ei() {
|
|
|
354
354
|
}
|
|
355
355
|
function si(l) {
|
|
356
356
|
try {
|
|
357
|
-
return
|
|
357
|
+
return Tn(l), !1;
|
|
358
358
|
} catch {
|
|
359
359
|
return !0;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
function
|
|
362
|
+
function Tn(l) {
|
|
363
363
|
return "" + l;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function wn(l) {
|
|
366
366
|
if (si(l))
|
|
367
|
-
return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ii(l)),
|
|
367
|
+
return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ii(l)), Tn(l);
|
|
368
368
|
}
|
|
369
|
-
var
|
|
369
|
+
var mn = m.ReactCurrentOwner, oi = {
|
|
370
370
|
key: !0,
|
|
371
371
|
ref: !0,
|
|
372
372
|
__self: !0,
|
|
373
373
|
__source: !0
|
|
374
|
-
},
|
|
374
|
+
}, Sn, vn;
|
|
375
375
|
function ui(l) {
|
|
376
|
-
if (
|
|
376
|
+
if (Re.call(l, "ref")) {
|
|
377
377
|
var y = Object.getOwnPropertyDescriptor(l, "ref").get;
|
|
378
378
|
if (y && y.isReactWarning)
|
|
379
379
|
return !1;
|
|
@@ -381,7 +381,7 @@ function Ei() {
|
|
|
381
381
|
return l.ref !== void 0;
|
|
382
382
|
}
|
|
383
383
|
function ai(l) {
|
|
384
|
-
if (
|
|
384
|
+
if (Re.call(l, "key")) {
|
|
385
385
|
var y = Object.getOwnPropertyDescriptor(l, "key").get;
|
|
386
386
|
if (y && y.isReactWarning)
|
|
387
387
|
return !1;
|
|
@@ -389,12 +389,12 @@ function Ei() {
|
|
|
389
389
|
return l.key !== void 0;
|
|
390
390
|
}
|
|
391
391
|
function ci(l, y) {
|
|
392
|
-
typeof l.ref == "string" &&
|
|
392
|
+
typeof l.ref == "string" && mn.current;
|
|
393
393
|
}
|
|
394
394
|
function di(l, y) {
|
|
395
395
|
{
|
|
396
396
|
var _ = function() {
|
|
397
|
-
|
|
397
|
+
Sn || (Sn = !0, S("%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)", y));
|
|
398
398
|
};
|
|
399
399
|
_.isReactWarning = !0, Object.defineProperty(l, "key", {
|
|
400
400
|
get: _,
|
|
@@ -405,7 +405,7 @@ function Ei() {
|
|
|
405
405
|
function fi(l, y) {
|
|
406
406
|
{
|
|
407
407
|
var _ = function() {
|
|
408
|
-
|
|
408
|
+
vn || (vn = !0, S("%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)", y));
|
|
409
409
|
};
|
|
410
410
|
_.isReactWarning = !0, Object.defineProperty(l, "ref", {
|
|
411
411
|
get: _,
|
|
@@ -413,70 +413,70 @@ function Ei() {
|
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
var li = function(l, y, _, v,
|
|
417
|
-
var
|
|
416
|
+
var li = function(l, y, _, v, P, k, j) {
|
|
417
|
+
var A = {
|
|
418
418
|
// This tag allows us to uniquely identify this as a React Element
|
|
419
419
|
$$typeof: n,
|
|
420
420
|
// Built-in properties that belong on the element
|
|
421
421
|
type: l,
|
|
422
422
|
key: y,
|
|
423
423
|
ref: _,
|
|
424
|
-
props:
|
|
424
|
+
props: j,
|
|
425
425
|
// Record the component responsible for creating this element.
|
|
426
426
|
_owner: k
|
|
427
427
|
};
|
|
428
|
-
return
|
|
428
|
+
return A._store = {}, Object.defineProperty(A._store, "validated", {
|
|
429
429
|
configurable: !1,
|
|
430
430
|
enumerable: !1,
|
|
431
431
|
writable: !0,
|
|
432
432
|
value: !1
|
|
433
|
-
}), Object.defineProperty(
|
|
433
|
+
}), Object.defineProperty(A, "_self", {
|
|
434
434
|
configurable: !1,
|
|
435
435
|
enumerable: !1,
|
|
436
436
|
writable: !1,
|
|
437
437
|
value: v
|
|
438
|
-
}), Object.defineProperty(
|
|
438
|
+
}), Object.defineProperty(A, "_source", {
|
|
439
439
|
configurable: !1,
|
|
440
440
|
enumerable: !1,
|
|
441
441
|
writable: !1,
|
|
442
|
-
value:
|
|
443
|
-
}), Object.freeze && (Object.freeze(
|
|
442
|
+
value: P
|
|
443
|
+
}), Object.freeze && (Object.freeze(A.props), Object.freeze(A)), A;
|
|
444
444
|
};
|
|
445
|
-
function hi(l, y, _, v,
|
|
445
|
+
function hi(l, y, _, v, P) {
|
|
446
446
|
{
|
|
447
|
-
var k,
|
|
448
|
-
_ !== void 0 && (
|
|
447
|
+
var k, j = {}, A = null, K = null;
|
|
448
|
+
_ !== void 0 && (wn(_), A = "" + _), ai(y) && (wn(y.key), A = "" + y.key), ui(y) && (K = y.ref, ci(y, P));
|
|
449
449
|
for (k in y)
|
|
450
|
-
|
|
450
|
+
Re.call(y, k) && !oi.hasOwnProperty(k) && (j[k] = y[k]);
|
|
451
451
|
if (l && l.defaultProps) {
|
|
452
452
|
var M = l.defaultProps;
|
|
453
453
|
for (k in M)
|
|
454
|
-
|
|
454
|
+
j[k] === void 0 && (j[k] = M[k]);
|
|
455
455
|
}
|
|
456
|
-
if (
|
|
456
|
+
if (A || K) {
|
|
457
457
|
var $ = typeof l == "function" ? l.displayName || l.name || "Unknown" : l;
|
|
458
|
-
|
|
458
|
+
A && di(j, $), K && fi(j, $);
|
|
459
459
|
}
|
|
460
|
-
return li(l,
|
|
460
|
+
return li(l, A, K, P, v, mn.current, j);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
var
|
|
463
|
+
var wt = m.ReactCurrentOwner, On = m.ReactDebugCurrentFrame;
|
|
464
464
|
function ve(l) {
|
|
465
465
|
if (l) {
|
|
466
|
-
var y = l._owner, _ =
|
|
467
|
-
|
|
466
|
+
var y = l._owner, _ = Ze(l.type, l._source, y ? y.type : null);
|
|
467
|
+
On.setExtraStackFrame(_);
|
|
468
468
|
} else
|
|
469
|
-
|
|
469
|
+
On.setExtraStackFrame(null);
|
|
470
470
|
}
|
|
471
|
-
var
|
|
472
|
-
|
|
473
|
-
function
|
|
471
|
+
var mt;
|
|
472
|
+
mt = !1;
|
|
473
|
+
function St(l) {
|
|
474
474
|
return typeof l == "object" && l !== null && l.$$typeof === n;
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function En() {
|
|
477
477
|
{
|
|
478
|
-
if (
|
|
479
|
-
var l =
|
|
478
|
+
if (wt.current) {
|
|
479
|
+
var l = F(wt.current.type);
|
|
480
480
|
if (l)
|
|
481
481
|
return `
|
|
482
482
|
|
|
@@ -488,10 +488,10 @@ Check the render method of \`` + l + "`.";
|
|
|
488
488
|
function pi(l) {
|
|
489
489
|
return "";
|
|
490
490
|
}
|
|
491
|
-
var
|
|
491
|
+
var An = {};
|
|
492
492
|
function yi(l) {
|
|
493
493
|
{
|
|
494
|
-
var y =
|
|
494
|
+
var y = En();
|
|
495
495
|
if (!y) {
|
|
496
496
|
var _ = typeof l == "string" ? l : l.displayName || l.name;
|
|
497
497
|
_ && (y = `
|
|
@@ -501,35 +501,35 @@ Check the top-level render call using <` + _ + ">.");
|
|
|
501
501
|
return y;
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function Cn(l, y) {
|
|
505
505
|
{
|
|
506
506
|
if (!l._store || l._store.validated || l.key != null)
|
|
507
507
|
return;
|
|
508
508
|
l._store.validated = !0;
|
|
509
509
|
var _ = yi(y);
|
|
510
|
-
if (
|
|
510
|
+
if (An[_])
|
|
511
511
|
return;
|
|
512
|
-
|
|
512
|
+
An[_] = !0;
|
|
513
513
|
var v = "";
|
|
514
|
-
l && l._owner && l._owner !==
|
|
514
|
+
l && l._owner && l._owner !== wt.current && (v = " It was passed a child from " + F(l._owner.type) + "."), ve(l), S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', _, v), ve(null);
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function jn(l, y) {
|
|
518
518
|
{
|
|
519
519
|
if (typeof l != "object")
|
|
520
520
|
return;
|
|
521
|
-
if (
|
|
521
|
+
if (Tt(l))
|
|
522
522
|
for (var _ = 0; _ < l.length; _++) {
|
|
523
523
|
var v = l[_];
|
|
524
|
-
|
|
524
|
+
St(v) && Cn(v, y);
|
|
525
525
|
}
|
|
526
|
-
else if (
|
|
526
|
+
else if (St(l))
|
|
527
527
|
l._store && (l._store.validated = !0);
|
|
528
528
|
else if (l) {
|
|
529
|
-
var
|
|
530
|
-
if (typeof
|
|
531
|
-
for (var k =
|
|
532
|
-
|
|
529
|
+
var P = T(l);
|
|
530
|
+
if (typeof P == "function" && P !== l.entries)
|
|
531
|
+
for (var k = P.call(l), j; !(j = k.next()).done; )
|
|
532
|
+
St(j.value) && Cn(j.value, y);
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
535
|
}
|
|
@@ -548,12 +548,12 @@ Check the top-level render call using <` + _ + ">.");
|
|
|
548
548
|
else
|
|
549
549
|
return;
|
|
550
550
|
if (_) {
|
|
551
|
-
var v =
|
|
551
|
+
var v = F(y);
|
|
552
552
|
ni(_, l.props, "prop", v, l);
|
|
553
|
-
} else if (y.PropTypes !== void 0 && !
|
|
554
|
-
|
|
555
|
-
var
|
|
556
|
-
S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",
|
|
553
|
+
} else if (y.PropTypes !== void 0 && !mt) {
|
|
554
|
+
mt = !0;
|
|
555
|
+
var P = F(y);
|
|
556
|
+
S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", P || "Unknown");
|
|
557
557
|
}
|
|
558
558
|
typeof y.getDefaultProps == "function" && !y.getDefaultProps.isReactClassApproved && S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
559
559
|
}
|
|
@@ -570,64 +570,64 @@ Check the top-level render call using <` + _ + ">.");
|
|
|
570
570
|
l.ref !== null && (ve(l), S("Invalid attribute `ref` supplied to `React.Fragment`."), ve(null));
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
|
-
var
|
|
574
|
-
function
|
|
573
|
+
var Pn = {};
|
|
574
|
+
function kn(l, y, _, v, P, k) {
|
|
575
575
|
{
|
|
576
|
-
var
|
|
577
|
-
if (!
|
|
578
|
-
var
|
|
579
|
-
(l === void 0 || typeof l == "object" && l !== null && Object.keys(l).length === 0) && (
|
|
580
|
-
var
|
|
581
|
-
|
|
576
|
+
var j = he(l);
|
|
577
|
+
if (!j) {
|
|
578
|
+
var A = "";
|
|
579
|
+
(l === void 0 || typeof l == "object" && l !== null && Object.keys(l).length === 0) && (A += " 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 K = pi();
|
|
581
|
+
K ? A += K : A += En();
|
|
582
582
|
var M;
|
|
583
|
-
l === null ? M = "null" :
|
|
583
|
+
l === null ? M = "null" : Tt(l) ? M = "array" : l !== void 0 && l.$$typeof === n ? (M = "<" + (F(l.type) || "Unknown") + " />", A = " Did you accidentally export a JSX literal instead of a component?") : M = typeof l, S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", M, A);
|
|
584
584
|
}
|
|
585
|
-
var $ = hi(l, y, _,
|
|
585
|
+
var $ = hi(l, y, _, P, k);
|
|
586
586
|
if ($ == null)
|
|
587
587
|
return $;
|
|
588
|
-
if (
|
|
589
|
-
var
|
|
590
|
-
if (
|
|
588
|
+
if (j) {
|
|
589
|
+
var ee = y.children;
|
|
590
|
+
if (ee !== void 0)
|
|
591
591
|
if (v)
|
|
592
|
-
if (
|
|
593
|
-
for (var Oe = 0; Oe <
|
|
594
|
-
|
|
595
|
-
Object.freeze && Object.freeze(
|
|
592
|
+
if (Tt(ee)) {
|
|
593
|
+
for (var Oe = 0; Oe < ee.length; Oe++)
|
|
594
|
+
jn(ee[Oe], l);
|
|
595
|
+
Object.freeze && Object.freeze(ee);
|
|
596
596
|
} else
|
|
597
597
|
S("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
|
+
jn(ee, l);
|
|
600
600
|
}
|
|
601
|
-
if (
|
|
602
|
-
var be =
|
|
601
|
+
if (Re.call(y, "key")) {
|
|
602
|
+
var be = F(l), Q = Object.keys(y).filter(function(vi) {
|
|
603
603
|
return vi !== "key";
|
|
604
|
-
}),
|
|
605
|
-
if (!
|
|
604
|
+
}), vt = Q.length > 0 ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
605
|
+
if (!Pn[be + vt]) {
|
|
606
606
|
var Si = Q.length > 0 ? "{" + Q.join(": ..., ") + ": ...}" : "{}";
|
|
607
607
|
S(`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} />`,
|
|
612
|
+
<%s key={someKey} {...props} />`, vt, be, Si, be), Pn[be + vt] = !0;
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
return l === i ? _i($) : bi($), $;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
function gi(l, y, _) {
|
|
619
|
-
return
|
|
619
|
+
return kn(l, y, _, !0);
|
|
620
620
|
}
|
|
621
621
|
function Ti(l, y, _) {
|
|
622
|
-
return
|
|
622
|
+
return kn(l, y, _, !1);
|
|
623
623
|
}
|
|
624
624
|
var wi = Ti, mi = gi;
|
|
625
|
-
|
|
626
|
-
}(),
|
|
625
|
+
De.Fragment = i, De.jsx = wi, De.jsxs = mi;
|
|
626
|
+
}(), De;
|
|
627
627
|
}
|
|
628
628
|
var Ai = {};
|
|
629
|
-
Ai.NODE_ENV === "production" ?
|
|
630
|
-
var
|
|
629
|
+
Ai.NODE_ENV === "production" ? Mt.exports = Oi() : Mt.exports = Ei();
|
|
630
|
+
var et = Mt.exports;
|
|
631
631
|
function G(e) {
|
|
632
632
|
if (typeof e == "number")
|
|
633
633
|
return (Math.abs(e * 2654435761) >>> 0).toString(16);
|
|
@@ -670,14 +670,14 @@ const R = {
|
|
|
670
670
|
Remove: "remove",
|
|
671
671
|
Replace: "replace",
|
|
672
672
|
Add: "add"
|
|
673
|
-
},
|
|
673
|
+
}, pr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Ci = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), it = Symbol.iterator, X = {
|
|
674
674
|
mutable: "mutable",
|
|
675
675
|
immutable: "immutable"
|
|
676
|
-
},
|
|
677
|
-
function
|
|
676
|
+
}, Zt = {};
|
|
677
|
+
function Fe(e, t) {
|
|
678
678
|
return e instanceof Map ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function Rn(e, t) {
|
|
681
681
|
if (t in e) {
|
|
682
682
|
let n = Reflect.getPrototypeOf(e);
|
|
683
683
|
for (; n; ) {
|
|
@@ -688,45 +688,45 @@ function $n(e, t) {
|
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function Xt(e) {
|
|
692
692
|
return Object.getPrototypeOf(e) === Set.prototype;
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function en(e) {
|
|
695
695
|
return Object.getPrototypeOf(e) === Map.prototype;
|
|
696
696
|
}
|
|
697
|
-
function
|
|
697
|
+
function Z(e) {
|
|
698
698
|
var t;
|
|
699
699
|
return (t = e.copy) !== null && t !== void 0 ? t : e.original;
|
|
700
700
|
}
|
|
701
701
|
function me(e) {
|
|
702
|
-
return !!
|
|
702
|
+
return !!C(e);
|
|
703
703
|
}
|
|
704
|
-
function
|
|
705
|
-
return typeof e != "object" ? null : e == null ? void 0 : e[
|
|
704
|
+
function C(e) {
|
|
705
|
+
return typeof e != "object" ? null : e == null ? void 0 : e[pr];
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function tn(e) {
|
|
708
708
|
var t;
|
|
709
|
-
const n =
|
|
709
|
+
const n = C(e);
|
|
710
710
|
return n ? (t = n.copy) !== null && t !== void 0 ? t : n.original : e;
|
|
711
711
|
}
|
|
712
|
-
function
|
|
712
|
+
function ie(e, t) {
|
|
713
713
|
if (!e || typeof e != "object")
|
|
714
714
|
return !1;
|
|
715
715
|
let n;
|
|
716
|
-
return Object.getPrototypeOf(e) === Object.prototype || Array.isArray(e) || e instanceof Map || e instanceof Set || !!(t != null && t.mark) && ((n = t.mark(e,
|
|
716
|
+
return Object.getPrototypeOf(e) === Object.prototype || Array.isArray(e) || e instanceof Map || e instanceof Set || !!(t != null && t.mark) && ((n = t.mark(e, X)) === X.immutable || typeof n == "function");
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function yr(e, t = []) {
|
|
719
719
|
if (Object.hasOwnProperty.call(e, "key")) {
|
|
720
|
-
const n = e.parent.copy, r =
|
|
720
|
+
const n = e.parent.copy, r = C(le(n, e.key));
|
|
721
721
|
if (r !== null && (r == null ? void 0 : r.original) !== e.original)
|
|
722
722
|
return null;
|
|
723
723
|
const i = e.parent.type === 3, s = i ? Array.from(e.parent.setMap.keys()).indexOf(e.key) : e.key;
|
|
724
|
-
if (!(i && n.size > s ||
|
|
724
|
+
if (!(i && n.size > s || Fe(n, s)))
|
|
725
725
|
return null;
|
|
726
726
|
t.push(s);
|
|
727
727
|
}
|
|
728
728
|
if (e.parent)
|
|
729
|
-
return
|
|
729
|
+
return yr(e.parent, t);
|
|
730
730
|
t.reverse();
|
|
731
731
|
try {
|
|
732
732
|
ji(e.copy, t);
|
|
@@ -738,20 +738,20 @@ function br(e, t = []) {
|
|
|
738
738
|
function Se(e) {
|
|
739
739
|
return Array.isArray(e) ? 1 : e instanceof Map ? 2 : e instanceof Set ? 3 : 0;
|
|
740
740
|
}
|
|
741
|
-
function
|
|
741
|
+
function le(e, t) {
|
|
742
742
|
return Se(e) === 2 ? e.get(t) : e[t];
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function qe(e, t, n) {
|
|
745
745
|
Se(e) === 2 ? e.set(t, n) : e[t] = n;
|
|
746
746
|
}
|
|
747
|
-
function
|
|
748
|
-
const n =
|
|
749
|
-
return (n ?
|
|
747
|
+
function Ot(e, t) {
|
|
748
|
+
const n = C(e);
|
|
749
|
+
return (n ? Z(n) : e)[t];
|
|
750
750
|
}
|
|
751
|
-
function
|
|
751
|
+
function fe(e, t) {
|
|
752
752
|
return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function Rt(e) {
|
|
755
755
|
if (e)
|
|
756
756
|
for (; e.finalities.revoke.length > 0; )
|
|
757
757
|
e.finalities.revoke.pop()();
|
|
@@ -765,7 +765,7 @@ function ge(e, t) {
|
|
|
765
765
|
function ji(e, t) {
|
|
766
766
|
for (let n = 0; n < t.length - 1; n += 1) {
|
|
767
767
|
const r = t[n];
|
|
768
|
-
if (e =
|
|
768
|
+
if (e = le(Se(e) === 3 ? Array.from(e) : e, r), typeof e != "object")
|
|
769
769
|
throw new Error(`Cannot resolve patch at '${t.join("/")}'.`);
|
|
770
770
|
}
|
|
771
771
|
return e;
|
|
@@ -787,24 +787,24 @@ function Pi(e) {
|
|
|
787
787
|
}), t;
|
|
788
788
|
}
|
|
789
789
|
const ki = Object.prototype.propertyIsEnumerable;
|
|
790
|
-
function
|
|
790
|
+
function br(e, t) {
|
|
791
791
|
let n;
|
|
792
792
|
if (Array.isArray(e))
|
|
793
793
|
return Array.prototype.concat.call(e);
|
|
794
794
|
if (e instanceof Set) {
|
|
795
|
-
if (!
|
|
795
|
+
if (!Xt(e)) {
|
|
796
796
|
const r = Object.getPrototypeOf(e).constructor;
|
|
797
797
|
return new r(e.values());
|
|
798
798
|
}
|
|
799
799
|
return Set.prototype.difference ? Set.prototype.difference.call(e, /* @__PURE__ */ new Set()) : new Set(e.values());
|
|
800
800
|
} else if (e instanceof Map) {
|
|
801
|
-
if (!
|
|
801
|
+
if (!en(e)) {
|
|
802
802
|
const r = Object.getPrototypeOf(e).constructor;
|
|
803
803
|
return new r(e);
|
|
804
804
|
}
|
|
805
805
|
return new Map(e);
|
|
806
|
-
} else if (t != null && t.mark && (n = t.mark(e,
|
|
807
|
-
if (n ===
|
|
806
|
+
} else if (t != null && t.mark && (n = t.mark(e, X), n !== void 0) && n !== X.mutable) {
|
|
807
|
+
if (n === X.immutable)
|
|
808
808
|
return Pi(e);
|
|
809
809
|
if (typeof n == "function") {
|
|
810
810
|
if (t.enablePatches || t.enableAutoFreeze)
|
|
@@ -822,28 +822,28 @@ function _r(e, t) {
|
|
|
822
822
|
} else
|
|
823
823
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
824
824
|
}
|
|
825
|
-
function
|
|
826
|
-
e.copy || (e.copy =
|
|
825
|
+
function B(e) {
|
|
826
|
+
e.copy || (e.copy = br(e.original, e.options));
|
|
827
827
|
}
|
|
828
|
-
function
|
|
829
|
-
if (!
|
|
830
|
-
return
|
|
828
|
+
function Ue(e) {
|
|
829
|
+
if (!ie(e))
|
|
830
|
+
return tn(e);
|
|
831
831
|
if (Array.isArray(e))
|
|
832
|
-
return e.map(
|
|
832
|
+
return e.map(Ue);
|
|
833
833
|
if (e instanceof Map) {
|
|
834
834
|
const n = Array.from(e.entries()).map(([r, i]) => [
|
|
835
835
|
r,
|
|
836
|
-
|
|
836
|
+
Ue(i)
|
|
837
837
|
]);
|
|
838
|
-
if (!
|
|
838
|
+
if (!en(e)) {
|
|
839
839
|
const r = Object.getPrototypeOf(e).constructor;
|
|
840
840
|
return new r(n);
|
|
841
841
|
}
|
|
842
842
|
return new Map(n);
|
|
843
843
|
}
|
|
844
844
|
if (e instanceof Set) {
|
|
845
|
-
const n = Array.from(e).map(
|
|
846
|
-
if (!
|
|
845
|
+
const n = Array.from(e).map(Ue);
|
|
846
|
+
if (!Xt(e)) {
|
|
847
847
|
const r = Object.getPrototypeOf(e).constructor;
|
|
848
848
|
return new r(n);
|
|
849
849
|
}
|
|
@@ -851,17 +851,17 @@ function Le(e) {
|
|
|
851
851
|
}
|
|
852
852
|
const t = Object.create(Object.getPrototypeOf(e));
|
|
853
853
|
for (const n in e)
|
|
854
|
-
t[n] =
|
|
854
|
+
t[n] = Ue(e[n]);
|
|
855
855
|
return t;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
return me(e) ?
|
|
857
|
+
function st(e) {
|
|
858
|
+
return me(e) ? Ue(e) : e;
|
|
859
859
|
}
|
|
860
|
-
function
|
|
860
|
+
function ae(e) {
|
|
861
861
|
var t;
|
|
862
|
-
e.assignedMap = (t = e.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), e.operated || (e.operated = !0, e.parent &&
|
|
862
|
+
e.assignedMap = (t = e.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), e.operated || (e.operated = !0, e.parent && ae(e.parent));
|
|
863
863
|
}
|
|
864
|
-
function
|
|
864
|
+
function $n() {
|
|
865
865
|
throw new Error("Cannot modify frozen object");
|
|
866
866
|
}
|
|
867
867
|
function Ee(e, t, n, r, i) {
|
|
@@ -889,12 +889,12 @@ function Ee(e, t, n, r, i) {
|
|
|
889
889
|
case 2:
|
|
890
890
|
for (const [u, a] of e)
|
|
891
891
|
Ee(u, u, n, r, i), Ee(a, u, n, r, i);
|
|
892
|
-
e.set = e.clear = e.delete =
|
|
892
|
+
e.set = e.clear = e.delete = $n;
|
|
893
893
|
break;
|
|
894
894
|
case 3:
|
|
895
895
|
for (const u of e)
|
|
896
896
|
Ee(u, u, n, r, i);
|
|
897
|
-
e.add = e.clear = e.delete =
|
|
897
|
+
e.add = e.clear = e.delete = $n;
|
|
898
898
|
break;
|
|
899
899
|
case 1:
|
|
900
900
|
Object.freeze(e);
|
|
@@ -910,7 +910,7 @@ function Ee(e, t, n, r, i) {
|
|
|
910
910
|
}
|
|
911
911
|
r.pop(), i.pop();
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function nn(e, t) {
|
|
914
914
|
const n = Se(e);
|
|
915
915
|
if (n === 0)
|
|
916
916
|
Reflect.ownKeys(e).forEach((r) => {
|
|
@@ -923,19 +923,19 @@ function un(e, t) {
|
|
|
923
923
|
} else
|
|
924
924
|
e.forEach((r, i) => t(i, r, e));
|
|
925
925
|
}
|
|
926
|
-
function
|
|
927
|
-
if (me(e) || !
|
|
926
|
+
function _r(e, t, n) {
|
|
927
|
+
if (me(e) || !ie(e, n) || t.has(e) || Object.isFrozen(e))
|
|
928
928
|
return;
|
|
929
929
|
const r = e instanceof Set, i = r ? /* @__PURE__ */ new Map() : void 0;
|
|
930
|
-
if (t.add(e),
|
|
930
|
+
if (t.add(e), nn(e, (s, o) => {
|
|
931
931
|
var u;
|
|
932
932
|
if (me(o)) {
|
|
933
|
-
const a =
|
|
934
|
-
|
|
933
|
+
const a = C(o);
|
|
934
|
+
B(a);
|
|
935
935
|
const d = !((u = a.assignedMap) === null || u === void 0) && u.size || a.operated ? a.copy : a.original;
|
|
936
|
-
|
|
936
|
+
qe(r ? i : e, s, d);
|
|
937
937
|
} else
|
|
938
|
-
|
|
938
|
+
_r(o, t, n);
|
|
939
939
|
}), i) {
|
|
940
940
|
const s = e, o = Array.from(s);
|
|
941
941
|
s.clear(), o.forEach((u) => {
|
|
@@ -945,34 +945,34 @@ function gr(e, t, n) {
|
|
|
945
945
|
}
|
|
946
946
|
function Ii(e, t) {
|
|
947
947
|
const n = e.type === 3 ? e.setMap : e.copy;
|
|
948
|
-
e.finalities.revoke.length > 1 && e.assignedMap.get(t) && n &&
|
|
948
|
+
e.finalities.revoke.length > 1 && e.assignedMap.get(t) && n && _r(le(n, t), e.finalities.handledSet, e.options);
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function $t(e) {
|
|
951
951
|
e.type === 3 && e.copy && (e.copy.clear(), e.setMap.forEach((t) => {
|
|
952
|
-
e.copy.add(
|
|
952
|
+
e.copy.add(tn(t));
|
|
953
953
|
}));
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function Dt(e, t, n, r) {
|
|
956
956
|
if (e.operated && e.assignedMap && e.assignedMap.size > 0 && !e.finalized) {
|
|
957
957
|
if (n && r) {
|
|
958
|
-
const s =
|
|
958
|
+
const s = yr(e);
|
|
959
959
|
s && t(e, s, n, r);
|
|
960
960
|
}
|
|
961
961
|
e.finalized = !0;
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
function
|
|
965
|
-
const i =
|
|
964
|
+
function rn(e, t, n, r) {
|
|
965
|
+
const i = C(n);
|
|
966
966
|
i && (i.callbacks || (i.callbacks = []), i.callbacks.push((s, o) => {
|
|
967
967
|
var u;
|
|
968
968
|
const a = e.type === 3 ? e.setMap : e.copy;
|
|
969
|
-
if (
|
|
969
|
+
if (fe(le(a, t), n)) {
|
|
970
970
|
let d = i.original;
|
|
971
|
-
i.copy && (d = i.copy),
|
|
971
|
+
i.copy && (d = i.copy), $t(e), Dt(e, r, s, o), e.options.enableAutoFreeze && (e.options.updatedValues = (u = e.options.updatedValues) !== null && u !== void 0 ? u : /* @__PURE__ */ new WeakMap(), e.options.updatedValues.set(d, i.original)), qe(a, t, d);
|
|
972
972
|
}
|
|
973
|
-
}), e.options.enableAutoFreeze && i.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)),
|
|
973
|
+
}), e.options.enableAutoFreeze && i.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)), ie(n, e.options) && e.finalities.draft.push(() => {
|
|
974
974
|
const s = e.type === 3 ? e.setMap : e.copy;
|
|
975
|
-
|
|
975
|
+
fe(le(s, t), n) && Ii(e, t);
|
|
976
976
|
});
|
|
977
977
|
}
|
|
978
978
|
function Mi(e, t, n, r, i) {
|
|
@@ -985,12 +985,12 @@ function Mi(e, t, n, r, i) {
|
|
|
985
985
|
op: R.Replace,
|
|
986
986
|
path: f,
|
|
987
987
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
988
|
-
value:
|
|
988
|
+
value: st(a[d])
|
|
989
989
|
}), r.push({
|
|
990
990
|
op: R.Replace,
|
|
991
991
|
path: f,
|
|
992
992
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
993
|
-
value:
|
|
993
|
+
value: st(s[d])
|
|
994
994
|
});
|
|
995
995
|
}
|
|
996
996
|
for (let d = s.length; d < a.length; d += 1) {
|
|
@@ -999,7 +999,7 @@ function Mi(e, t, n, r, i) {
|
|
|
999
999
|
op: R.Add,
|
|
1000
1000
|
path: f,
|
|
1001
1001
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
1002
|
-
value:
|
|
1002
|
+
value: st(a[d])
|
|
1003
1003
|
});
|
|
1004
1004
|
}
|
|
1005
1005
|
if (s.length < a.length) {
|
|
@@ -1023,8 +1023,8 @@ function Mi(e, t, n, r, i) {
|
|
|
1023
1023
|
}
|
|
1024
1024
|
function Ri({ original: e, copy: t, assignedMap: n }, r, i, s, o) {
|
|
1025
1025
|
n.forEach((u, a) => {
|
|
1026
|
-
const d =
|
|
1027
|
-
if (
|
|
1026
|
+
const d = le(e, a), c = st(le(t, a)), f = u ? Fe(e, a) ? R.Replace : R.Add : R.Remove;
|
|
1027
|
+
if (fe(d, c) && f === R.Replace)
|
|
1028
1028
|
return;
|
|
1029
1029
|
const h = r.concat(a), p = ge(h, o);
|
|
1030
1030
|
i.push(f === R.Remove ? { op: f, path: p } : { op: f, path: p, value: c }), s.push(f === R.Add ? { op: R.Remove, path: p } : f === R.Remove ? { op: R.Add, path: p, value: d } : { op: R.Replace, path: p, value: d });
|
|
@@ -1062,7 +1062,7 @@ function $i({ original: e, copy: t }, n, r, i, s) {
|
|
|
1062
1062
|
o += 1;
|
|
1063
1063
|
});
|
|
1064
1064
|
}
|
|
1065
|
-
function
|
|
1065
|
+
function Ve(e, t, n, r) {
|
|
1066
1066
|
const { pathAsArray: i = !0 } = e.options.enablePatches;
|
|
1067
1067
|
switch (e.type) {
|
|
1068
1068
|
case 0:
|
|
@@ -1074,62 +1074,62 @@ function qe(e, t, n, r) {
|
|
|
1074
1074
|
return $i(e, t, n, r, i);
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
|
-
const
|
|
1078
|
-
if (typeof e == "object" && e !== null && (!
|
|
1077
|
+
const at = (e, t, n = !1) => {
|
|
1078
|
+
if (typeof e == "object" && e !== null && (!ie(e, t) || n))
|
|
1079
1079
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
1080
|
-
},
|
|
1080
|
+
}, xt = {
|
|
1081
1081
|
get size() {
|
|
1082
|
-
return
|
|
1082
|
+
return Z(C(this)).size;
|
|
1083
1083
|
},
|
|
1084
1084
|
has(e) {
|
|
1085
|
-
return
|
|
1085
|
+
return Z(C(this)).has(e);
|
|
1086
1086
|
},
|
|
1087
1087
|
set(e, t) {
|
|
1088
|
-
const n =
|
|
1089
|
-
return (!r.has(e) || !
|
|
1088
|
+
const n = C(this), r = Z(n);
|
|
1089
|
+
return (!r.has(e) || !fe(r.get(e), t)) && (B(n), ae(n), n.assignedMap.set(e, !0), n.copy.set(e, t), rn(n, e, t, Ve)), this;
|
|
1090
1090
|
},
|
|
1091
1091
|
delete(e) {
|
|
1092
1092
|
if (!this.has(e))
|
|
1093
1093
|
return !1;
|
|
1094
|
-
const t =
|
|
1095
|
-
return
|
|
1094
|
+
const t = C(this);
|
|
1095
|
+
return B(t), ae(t), t.original.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.copy.delete(e), !0;
|
|
1096
1096
|
},
|
|
1097
1097
|
clear() {
|
|
1098
|
-
const e =
|
|
1098
|
+
const e = C(this);
|
|
1099
1099
|
if (this.size) {
|
|
1100
|
-
|
|
1100
|
+
B(e), ae(e), e.assignedMap = /* @__PURE__ */ new Map();
|
|
1101
1101
|
for (const [t] of e.original)
|
|
1102
1102
|
e.assignedMap.set(t, !1);
|
|
1103
1103
|
e.copy.clear();
|
|
1104
1104
|
}
|
|
1105
1105
|
},
|
|
1106
1106
|
forEach(e, t) {
|
|
1107
|
-
const n =
|
|
1108
|
-
|
|
1107
|
+
const n = C(this);
|
|
1108
|
+
Z(n).forEach((r, i) => {
|
|
1109
1109
|
e.call(t, this.get(i), i, this);
|
|
1110
1110
|
});
|
|
1111
1111
|
},
|
|
1112
1112
|
get(e) {
|
|
1113
1113
|
var t, n;
|
|
1114
|
-
const r =
|
|
1115
|
-
if (r.options.strict &&
|
|
1114
|
+
const r = C(this), i = Z(r).get(e), s = ((n = (t = r.options).mark) === null || n === void 0 ? void 0 : n.call(t, i, X)) === X.mutable;
|
|
1115
|
+
if (r.options.strict && at(i, r.options, s), s || r.finalized || !ie(i, r.options) || i !== r.original.get(e))
|
|
1116
1116
|
return i;
|
|
1117
|
-
const o =
|
|
1117
|
+
const o = Zt.createDraft({
|
|
1118
1118
|
original: i,
|
|
1119
1119
|
parentDraft: r,
|
|
1120
1120
|
key: e,
|
|
1121
1121
|
finalities: r.finalities,
|
|
1122
1122
|
options: r.options
|
|
1123
1123
|
});
|
|
1124
|
-
return
|
|
1124
|
+
return B(r), r.copy.set(e, o), o;
|
|
1125
1125
|
},
|
|
1126
1126
|
keys() {
|
|
1127
|
-
return
|
|
1127
|
+
return Z(C(this)).keys();
|
|
1128
1128
|
},
|
|
1129
1129
|
values() {
|
|
1130
1130
|
const e = this.keys();
|
|
1131
1131
|
return {
|
|
1132
|
-
[
|
|
1132
|
+
[it]: () => this.values(),
|
|
1133
1133
|
next: () => {
|
|
1134
1134
|
const t = e.next();
|
|
1135
1135
|
return t.done ? t : {
|
|
@@ -1142,7 +1142,7 @@ const ft = (e, t, n = !1) => {
|
|
|
1142
1142
|
entries() {
|
|
1143
1143
|
const e = this.keys();
|
|
1144
1144
|
return {
|
|
1145
|
-
[
|
|
1145
|
+
[it]: () => this.entries(),
|
|
1146
1146
|
next: () => {
|
|
1147
1147
|
const t = e.next();
|
|
1148
1148
|
if (t.done)
|
|
@@ -1155,19 +1155,19 @@ const ft = (e, t, n = !1) => {
|
|
|
1155
1155
|
}
|
|
1156
1156
|
};
|
|
1157
1157
|
},
|
|
1158
|
-
[
|
|
1158
|
+
[it]() {
|
|
1159
1159
|
return this.entries();
|
|
1160
1160
|
}
|
|
1161
|
-
}, Di = Reflect.ownKeys(
|
|
1161
|
+
}, Di = Reflect.ownKeys(xt), Dn = (e, t, { isValuesIterator: n }) => () => {
|
|
1162
1162
|
var r, i;
|
|
1163
1163
|
const s = t.next();
|
|
1164
1164
|
if (s.done)
|
|
1165
1165
|
return s;
|
|
1166
1166
|
const o = s.value;
|
|
1167
1167
|
let u = e.setMap.get(o);
|
|
1168
|
-
const a =
|
|
1169
|
-
if (e.options.strict &&
|
|
1170
|
-
const c =
|
|
1168
|
+
const a = C(u), d = ((i = (r = e.options).mark) === null || i === void 0 ? void 0 : i.call(r, u, X)) === X.mutable;
|
|
1169
|
+
if (e.options.strict && at(o, e.options, d), !d && !a && ie(o, e.options) && !e.finalized && e.original.has(o)) {
|
|
1170
|
+
const c = Zt.createDraft({
|
|
1171
1171
|
original: o,
|
|
1172
1172
|
parentDraft: e,
|
|
1173
1173
|
key: o,
|
|
@@ -1180,55 +1180,55 @@ const ft = (e, t, n = !1) => {
|
|
|
1180
1180
|
done: !1,
|
|
1181
1181
|
value: n ? u : [u, u]
|
|
1182
1182
|
};
|
|
1183
|
-
},
|
|
1183
|
+
}, ct = {
|
|
1184
1184
|
get size() {
|
|
1185
|
-
return
|
|
1185
|
+
return C(this).setMap.size;
|
|
1186
1186
|
},
|
|
1187
1187
|
has(e) {
|
|
1188
|
-
const t =
|
|
1188
|
+
const t = C(this);
|
|
1189
1189
|
if (t.setMap.has(e))
|
|
1190
1190
|
return !0;
|
|
1191
|
-
|
|
1192
|
-
const n =
|
|
1191
|
+
B(t);
|
|
1192
|
+
const n = C(e);
|
|
1193
1193
|
return !!(n && t.setMap.has(n.original));
|
|
1194
1194
|
},
|
|
1195
1195
|
add(e) {
|
|
1196
|
-
const t =
|
|
1197
|
-
return this.has(e) || (
|
|
1196
|
+
const t = C(this);
|
|
1197
|
+
return this.has(e) || (B(t), ae(t), t.assignedMap.set(e, !0), t.setMap.set(e, e), rn(t, e, e, Ve)), this;
|
|
1198
1198
|
},
|
|
1199
1199
|
delete(e) {
|
|
1200
1200
|
if (!this.has(e))
|
|
1201
1201
|
return !1;
|
|
1202
|
-
const t =
|
|
1203
|
-
|
|
1204
|
-
const n =
|
|
1202
|
+
const t = C(this);
|
|
1203
|
+
B(t), ae(t);
|
|
1204
|
+
const n = C(e);
|
|
1205
1205
|
return n && t.setMap.has(n.original) ? (t.assignedMap.set(n.original, !1), t.setMap.delete(n.original)) : (!n && t.setMap.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.setMap.delete(e));
|
|
1206
1206
|
},
|
|
1207
1207
|
clear() {
|
|
1208
1208
|
if (!this.size)
|
|
1209
1209
|
return;
|
|
1210
|
-
const e =
|
|
1211
|
-
|
|
1210
|
+
const e = C(this);
|
|
1211
|
+
B(e), ae(e);
|
|
1212
1212
|
for (const t of e.original)
|
|
1213
1213
|
e.assignedMap.set(t, !1);
|
|
1214
1214
|
e.setMap.clear();
|
|
1215
1215
|
},
|
|
1216
1216
|
values() {
|
|
1217
|
-
const e =
|
|
1218
|
-
|
|
1217
|
+
const e = C(this);
|
|
1218
|
+
B(e);
|
|
1219
1219
|
const t = e.setMap.keys();
|
|
1220
1220
|
return {
|
|
1221
1221
|
[Symbol.iterator]: () => this.values(),
|
|
1222
|
-
next:
|
|
1222
|
+
next: Dn(e, t, { isValuesIterator: !0 })
|
|
1223
1223
|
};
|
|
1224
1224
|
},
|
|
1225
1225
|
entries() {
|
|
1226
|
-
const e =
|
|
1227
|
-
|
|
1226
|
+
const e = C(this);
|
|
1227
|
+
B(e);
|
|
1228
1228
|
const t = e.setMap.keys();
|
|
1229
1229
|
return {
|
|
1230
1230
|
[Symbol.iterator]: () => this.entries(),
|
|
1231
|
-
next:
|
|
1231
|
+
next: Dn(e, t, {
|
|
1232
1232
|
isValuesIterator: !1
|
|
1233
1233
|
})
|
|
1234
1234
|
};
|
|
@@ -1236,7 +1236,7 @@ const ft = (e, t, n = !1) => {
|
|
|
1236
1236
|
keys() {
|
|
1237
1237
|
return this.values();
|
|
1238
1238
|
},
|
|
1239
|
-
[
|
|
1239
|
+
[it]() {
|
|
1240
1240
|
return this.values();
|
|
1241
1241
|
},
|
|
1242
1242
|
forEach(e, t) {
|
|
@@ -1246,7 +1246,7 @@ const ft = (e, t, n = !1) => {
|
|
|
1246
1246
|
e.call(t, r.value, r.value, this), r = n.next();
|
|
1247
1247
|
}
|
|
1248
1248
|
};
|
|
1249
|
-
Set.prototype.difference && Object.assign(
|
|
1249
|
+
Set.prototype.difference && Object.assign(ct, {
|
|
1250
1250
|
intersection(e) {
|
|
1251
1251
|
return Set.prototype.intersection.call(new Set(this.values()), e);
|
|
1252
1252
|
},
|
|
@@ -1269,55 +1269,55 @@ Set.prototype.difference && Object.assign(lt, {
|
|
|
1269
1269
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), e);
|
|
1270
1270
|
}
|
|
1271
1271
|
});
|
|
1272
|
-
const xi = Reflect.ownKeys(
|
|
1272
|
+
const xi = Reflect.ownKeys(ct), gr = /* @__PURE__ */ new WeakSet(), Tr = {
|
|
1273
1273
|
get(e, t, n) {
|
|
1274
1274
|
var r, i;
|
|
1275
1275
|
const s = (r = e.copy) === null || r === void 0 ? void 0 : r[t];
|
|
1276
|
-
if (s &&
|
|
1276
|
+
if (s && gr.has(s))
|
|
1277
1277
|
return s;
|
|
1278
|
-
if (t ===
|
|
1278
|
+
if (t === pr)
|
|
1279
1279
|
return e;
|
|
1280
1280
|
let o;
|
|
1281
1281
|
if (e.options.mark) {
|
|
1282
1282
|
const d = t === "size" && (e.original instanceof Map || e.original instanceof Set) ? Reflect.get(e.original, t) : Reflect.get(e.original, t, n);
|
|
1283
|
-
if (o = e.options.mark(d,
|
|
1284
|
-
return e.options.strict &&
|
|
1283
|
+
if (o = e.options.mark(d, X), o === X.mutable)
|
|
1284
|
+
return e.options.strict && at(d, e.options, !0), d;
|
|
1285
1285
|
}
|
|
1286
|
-
const u =
|
|
1286
|
+
const u = Z(e);
|
|
1287
1287
|
if (u instanceof Map && Di.includes(t)) {
|
|
1288
1288
|
if (t === "size")
|
|
1289
|
-
return Object.getOwnPropertyDescriptor(
|
|
1290
|
-
const d =
|
|
1289
|
+
return Object.getOwnPropertyDescriptor(xt, "size").get.call(e.proxy);
|
|
1290
|
+
const d = xt[t];
|
|
1291
1291
|
if (d)
|
|
1292
1292
|
return d.bind(e.proxy);
|
|
1293
1293
|
}
|
|
1294
1294
|
if (u instanceof Set && xi.includes(t)) {
|
|
1295
1295
|
if (t === "size")
|
|
1296
|
-
return Object.getOwnPropertyDescriptor(
|
|
1297
|
-
const d =
|
|
1296
|
+
return Object.getOwnPropertyDescriptor(ct, "size").get.call(e.proxy);
|
|
1297
|
+
const d = ct[t];
|
|
1298
1298
|
if (d)
|
|
1299
1299
|
return d.bind(e.proxy);
|
|
1300
1300
|
}
|
|
1301
|
-
if (!
|
|
1302
|
-
const d =
|
|
1301
|
+
if (!Fe(u, t)) {
|
|
1302
|
+
const d = Rn(u, t);
|
|
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(e.proxy)
|
|
1306
1306
|
) : void 0;
|
|
1307
1307
|
}
|
|
1308
1308
|
const a = u[t];
|
|
1309
|
-
if (e.options.strict &&
|
|
1309
|
+
if (e.options.strict && at(a, e.options), e.finalized || !ie(a, e.options))
|
|
1310
1310
|
return a;
|
|
1311
|
-
if (a ===
|
|
1312
|
-
if (
|
|
1311
|
+
if (a === Ot(e.original, t)) {
|
|
1312
|
+
if (B(e), e.copy[t] = sn({
|
|
1313
1313
|
original: e.original[t],
|
|
1314
1314
|
parentDraft: e,
|
|
1315
1315
|
key: e.type === 1 ? Number(t) : t,
|
|
1316
1316
|
finalities: e.finalities,
|
|
1317
1317
|
options: e.options
|
|
1318
1318
|
}), typeof o == "function") {
|
|
1319
|
-
const d =
|
|
1320
|
-
return
|
|
1319
|
+
const d = C(e.copy[t]);
|
|
1320
|
+
return B(d), ae(d), d.copy;
|
|
1321
1321
|
}
|
|
1322
1322
|
return e.copy[t];
|
|
1323
1323
|
}
|
|
@@ -1330,20 +1330,20 @@ const xi = Reflect.ownKeys(lt), Tr = /* @__PURE__ */ new WeakSet(), wr = {
|
|
|
1330
1330
|
let i;
|
|
1331
1331
|
if (e.type === 1 && t !== "length" && !(Number.isInteger(i = Number(t)) && i >= 0 && (t === 0 || i === 0 || String(i) === String(t))))
|
|
1332
1332
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
1333
|
-
const s =
|
|
1333
|
+
const s = Rn(Z(e), t);
|
|
1334
1334
|
if (s != null && s.set)
|
|
1335
1335
|
return s.set.call(e.proxy, n), !0;
|
|
1336
|
-
const o =
|
|
1337
|
-
return u &&
|
|
1336
|
+
const o = Ot(Z(e), t), u = C(o);
|
|
1337
|
+
return u && fe(u.original, n) ? (e.copy[t] = n, e.assignedMap = (r = e.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (fe(n, o) && (n !== void 0 || Fe(e.original, t)) || (B(e), ae(e), Fe(e.original, t) && fe(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n, rn(e, t, n, Ve)), !0);
|
|
1338
1338
|
},
|
|
1339
1339
|
has(e, t) {
|
|
1340
|
-
return t in
|
|
1340
|
+
return t in Z(e);
|
|
1341
1341
|
},
|
|
1342
1342
|
ownKeys(e) {
|
|
1343
|
-
return Reflect.ownKeys(
|
|
1343
|
+
return Reflect.ownKeys(Z(e));
|
|
1344
1344
|
},
|
|
1345
1345
|
getOwnPropertyDescriptor(e, t) {
|
|
1346
|
-
const n =
|
|
1346
|
+
const n = Z(e), r = Reflect.getOwnPropertyDescriptor(n, t);
|
|
1347
1347
|
return r && {
|
|
1348
1348
|
writable: !0,
|
|
1349
1349
|
configurable: e.type !== 1 || t !== "length",
|
|
@@ -1362,10 +1362,10 @@ const xi = Reflect.ownKeys(lt), Tr = /* @__PURE__ */ new WeakSet(), wr = {
|
|
|
1362
1362
|
},
|
|
1363
1363
|
deleteProperty(e, t) {
|
|
1364
1364
|
var n;
|
|
1365
|
-
return e.type === 1 ?
|
|
1365
|
+
return e.type === 1 ? Tr.set.call(this, e, t, void 0, e.proxy) : (Ot(e.original, t) !== void 0 || t in e.original ? (B(e), ae(e), e.assignedMap.set(t, !1)) : (e.assignedMap = (n = e.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), e.assignedMap.delete(t)), e.copy && delete e.copy[t], !0);
|
|
1366
1366
|
}
|
|
1367
1367
|
};
|
|
1368
|
-
function
|
|
1368
|
+
function sn(e) {
|
|
1369
1369
|
const { original: t, parentDraft: n, key: r, finalities: i, options: s } = e, o = Se(t), u = {
|
|
1370
1370
|
type: o,
|
|
1371
1371
|
finalized: !1,
|
|
@@ -1379,39 +1379,39 @@ function cn(e) {
|
|
|
1379
1379
|
setMap: o === 3 ? new Map(t.entries()) : void 0
|
|
1380
1380
|
};
|
|
1381
1381
|
(r || "key" in e) && (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, Tr);
|
|
1383
|
+
if (i.revoke.push(d), gr.add(a), u.proxy = a, n) {
|
|
1384
1384
|
const c = n;
|
|
1385
1385
|
c.finalities.draft.push((f, h) => {
|
|
1386
1386
|
var p, b;
|
|
1387
|
-
const g =
|
|
1387
|
+
const g = C(a);
|
|
1388
1388
|
let w = c.type === 3 ? c.setMap : c.copy;
|
|
1389
|
-
const T =
|
|
1389
|
+
const T = le(w, r), m = C(T);
|
|
1390
1390
|
if (m) {
|
|
1391
1391
|
let S = m.original;
|
|
1392
|
-
m.operated && (S =
|
|
1392
|
+
m.operated && (S = tn(T)), $t(m), Dt(m, Ve, f, h), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(S, m.original)), qe(w, r, S);
|
|
1393
1393
|
}
|
|
1394
1394
|
(b = g.callbacks) === null || b === void 0 || b.forEach((S) => {
|
|
1395
1395
|
S(f, h);
|
|
1396
1396
|
});
|
|
1397
1397
|
});
|
|
1398
1398
|
} else {
|
|
1399
|
-
const c =
|
|
1399
|
+
const c = C(a);
|
|
1400
1400
|
c.finalities.draft.push((f, h) => {
|
|
1401
|
-
|
|
1401
|
+
$t(c), Dt(c, Ve, f, h);
|
|
1402
1402
|
});
|
|
1403
1403
|
}
|
|
1404
1404
|
return a;
|
|
1405
1405
|
}
|
|
1406
|
-
|
|
1406
|
+
Zt.createDraft = sn;
|
|
1407
1407
|
function Ui(e, t, n, r, i) {
|
|
1408
1408
|
var s;
|
|
1409
|
-
const o =
|
|
1409
|
+
const o = C(e), u = (s = o == null ? void 0 : o.original) !== null && s !== void 0 ? s : e, a = !!t.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 ? t[0] : o ? o.operated ? o.copy : o.original : e;
|
|
1414
|
-
return o &&
|
|
1414
|
+
return o && Rt(o), i && Ee(d, d, o == null ? void 0 : o.options.updatedValues), [
|
|
1415
1415
|
d,
|
|
1416
1416
|
n && a ? [{ op: R.Replace, path: [], value: t[0] }] : n,
|
|
1417
1417
|
r && a ? [{ op: R.Replace, path: [], value: u }] : r
|
|
@@ -1426,7 +1426,7 @@ function Li(e, t) {
|
|
|
1426
1426
|
};
|
|
1427
1427
|
let i, s;
|
|
1428
1428
|
t.enablePatches && (i = [], s = []);
|
|
1429
|
-
const u = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e,
|
|
1429
|
+
const u = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e, X)) === X.mutable || !ie(e, t) ? e : sn({
|
|
1430
1430
|
original: e,
|
|
1431
1431
|
parentDraft: null,
|
|
1432
1432
|
finalities: r,
|
|
@@ -1440,10 +1440,10 @@ function Li(e, t) {
|
|
|
1440
1440
|
}
|
|
1441
1441
|
];
|
|
1442
1442
|
}
|
|
1443
|
-
function
|
|
1443
|
+
function Ut(e) {
|
|
1444
1444
|
const { rootDraft: t, value: n, useRawReturn: r = !1, isRoot: i = !0 } = e;
|
|
1445
|
-
|
|
1446
|
-
const a =
|
|
1445
|
+
nn(n, (s, o, u) => {
|
|
1446
|
+
const a = C(o);
|
|
1447
1447
|
if (a && t && a.finalities === t.finalities) {
|
|
1448
1448
|
e.isContainDraft = !0;
|
|
1449
1449
|
const d = a.original;
|
|
@@ -1451,21 +1451,21 @@ function Vt(e) {
|
|
|
1451
1451
|
const c = Array.from(u);
|
|
1452
1452
|
u.clear(), c.forEach((f) => u.add(s === f ? d : f));
|
|
1453
1453
|
} else
|
|
1454
|
-
|
|
1455
|
-
} else typeof o == "object" && o !== null && (e.value = o, e.isRoot = !1,
|
|
1454
|
+
qe(u, s, d);
|
|
1455
|
+
} else typeof o == "object" && o !== null && (e.value = o, e.isRoot = !1, Ut(e));
|
|
1456
1456
|
}), i && (e.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 wr(e) {
|
|
1459
1459
|
var t;
|
|
1460
|
-
const n =
|
|
1461
|
-
if (!
|
|
1460
|
+
const n = C(e);
|
|
1461
|
+
if (!ie(e, n == null ? void 0 : n.options))
|
|
1462
1462
|
return e;
|
|
1463
1463
|
const r = Se(e);
|
|
1464
1464
|
if (n && !n.operated)
|
|
1465
1465
|
return n.original;
|
|
1466
1466
|
let i;
|
|
1467
1467
|
function s() {
|
|
1468
|
-
i = r === 2 ?
|
|
1468
|
+
i = r === 2 ? en(e) ? new Map(e) : new (Object.getPrototypeOf(e)).constructor(e) : r === 3 ? Array.from(n.setMap.values()) : br(e, n == null ? void 0 : n.options);
|
|
1469
1469
|
}
|
|
1470
1470
|
if (n) {
|
|
1471
1471
|
n.finalized = !0;
|
|
@@ -1476,40 +1476,40 @@ function mr(e) {
|
|
|
1476
1476
|
}
|
|
1477
1477
|
} else
|
|
1478
1478
|
i = e;
|
|
1479
|
-
if (
|
|
1480
|
-
if (n &&
|
|
1479
|
+
if (nn(i, (o, u) => {
|
|
1480
|
+
if (n && fe(le(n.original, o), u))
|
|
1481
1481
|
return;
|
|
1482
|
-
const a =
|
|
1483
|
-
a !== u && (i === e && s(),
|
|
1482
|
+
const a = wr(u);
|
|
1483
|
+
a !== u && (i === e && s(), qe(i, o, a));
|
|
1484
1484
|
}), r === 3) {
|
|
1485
1485
|
const o = (t = n == null ? void 0 : n.original) !== null && t !== void 0 ? t : i;
|
|
1486
|
-
return
|
|
1486
|
+
return Xt(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
|
|
1487
1487
|
}
|
|
1488
1488
|
return i;
|
|
1489
1489
|
}
|
|
1490
|
-
function
|
|
1490
|
+
function xn(e) {
|
|
1491
1491
|
if (!me(e))
|
|
1492
1492
|
throw new Error(`current() is only used for Draft, parameter: ${e}`);
|
|
1493
|
-
return
|
|
1493
|
+
return wr(e);
|
|
1494
1494
|
}
|
|
1495
1495
|
const Fi = (e) => function t(n, r, i) {
|
|
1496
1496
|
var s, o, u;
|
|
1497
1497
|
if (typeof n == "function" && typeof r != "function")
|
|
1498
|
-
return function(
|
|
1499
|
-
return t(
|
|
1498
|
+
return function(E, ...x) {
|
|
1499
|
+
return t(E, (L) => n.call(this, L, ...x), r);
|
|
1500
1500
|
};
|
|
1501
1501
|
const a = n, d = r;
|
|
1502
1502
|
let c = 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({}, e), c);
|
|
1506
|
-
const f = me(a) ?
|
|
1507
|
-
for (const
|
|
1508
|
-
if (typeof
|
|
1509
|
-
throw new Error(`Invalid mark: ${
|
|
1510
|
-
const
|
|
1511
|
-
if (
|
|
1512
|
-
return
|
|
1506
|
+
const f = me(a) ? xn(a) : a, h = Array.isArray(c.mark) ? (E, x) => {
|
|
1507
|
+
for (const L of c.mark) {
|
|
1508
|
+
if (typeof L != "function")
|
|
1509
|
+
throw new Error(`Invalid mark: ${L}, 'mark' should be a function.`);
|
|
1510
|
+
const oe = L(E, x);
|
|
1511
|
+
if (oe)
|
|
1512
|
+
return oe;
|
|
1513
1513
|
}
|
|
1514
1514
|
} : c.mark, p = (s = c.enablePatches) !== null && s !== void 0 ? s : !1, b = (o = c.strict) !== null && o !== void 0 ? o : !1, w = {
|
|
1515
1515
|
enableAutoFreeze: (u = c.enableAutoFreeze) !== null && u !== void 0 ? u : !1,
|
|
@@ -1517,72 +1517,72 @@ const Fi = (e) => function t(n, r, i) {
|
|
|
1517
1517
|
strict: b,
|
|
1518
1518
|
enablePatches: p
|
|
1519
1519
|
};
|
|
1520
|
-
if (!
|
|
1520
|
+
if (!ie(f, w) && 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
1522
|
const [T, m] = Li(f, w);
|
|
1523
1523
|
if (typeof r != "function") {
|
|
1524
|
-
if (!
|
|
1524
|
+
if (!ie(f, w))
|
|
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.");
|
|
1526
1526
|
return [T, m];
|
|
1527
1527
|
}
|
|
1528
1528
|
let S;
|
|
1529
1529
|
try {
|
|
1530
1530
|
S = d(T);
|
|
1531
|
-
} catch (
|
|
1532
|
-
throw
|
|
1531
|
+
} catch (E) {
|
|
1532
|
+
throw Rt(C(T)), E;
|
|
1533
1533
|
}
|
|
1534
|
-
const
|
|
1535
|
-
const x =
|
|
1536
|
-
if (!me(
|
|
1537
|
-
if (
|
|
1534
|
+
const W = (E) => {
|
|
1535
|
+
const x = C(T);
|
|
1536
|
+
if (!me(E)) {
|
|
1537
|
+
if (E !== void 0 && !fe(E, T) && (x != null && x.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
|
|
1540
|
-
if (
|
|
1541
|
-
const
|
|
1542
|
-
return w.strict && typeof
|
|
1539
|
+
const oe = E == null ? void 0 : E[Ci];
|
|
1540
|
+
if (oe) {
|
|
1541
|
+
const O = oe[0];
|
|
1542
|
+
return w.strict && typeof E == "object" && E !== null && Ut({
|
|
1543
1543
|
rootDraft: x,
|
|
1544
|
-
value:
|
|
1544
|
+
value: E,
|
|
1545
1545
|
useRawReturn: !0
|
|
1546
|
-
}), m([
|
|
1546
|
+
}), m([O]);
|
|
1547
1547
|
}
|
|
1548
|
-
if (
|
|
1549
|
-
return typeof
|
|
1548
|
+
if (E !== void 0)
|
|
1549
|
+
return typeof E == "object" && E !== null && Ut({ rootDraft: x, value: E }), m([E]);
|
|
1550
1550
|
}
|
|
1551
|
-
if (
|
|
1551
|
+
if (E === T || E === void 0)
|
|
1552
1552
|
return m([]);
|
|
1553
|
-
const
|
|
1554
|
-
if (w ===
|
|
1555
|
-
if (
|
|
1553
|
+
const L = C(E);
|
|
1554
|
+
if (w === L.options) {
|
|
1555
|
+
if (L.operated)
|
|
1556
1556
|
throw new Error("Cannot return a modified child draft.");
|
|
1557
|
-
return m([
|
|
1557
|
+
return m([xn(E)]);
|
|
1558
1558
|
}
|
|
1559
|
-
return m([
|
|
1559
|
+
return m([E]);
|
|
1560
1560
|
};
|
|
1561
|
-
return S instanceof Promise ? S.then(
|
|
1562
|
-
throw
|
|
1563
|
-
}) :
|
|
1564
|
-
},
|
|
1561
|
+
return S instanceof Promise ? S.then(W, (E) => {
|
|
1562
|
+
throw Rt(C(T)), E;
|
|
1563
|
+
}) : W(S);
|
|
1564
|
+
}, Lt = Fi();
|
|
1565
1565
|
Object.prototype.constructor.toString();
|
|
1566
|
-
function
|
|
1566
|
+
function mr(e, t) {
|
|
1567
1567
|
const n = Object.keys(e), r = Object.keys(t);
|
|
1568
1568
|
return n.length === r.length && Object.keys(e).every((i) => t.hasOwnProperty(i));
|
|
1569
1569
|
}
|
|
1570
|
-
function
|
|
1570
|
+
function Un(e, t) {
|
|
1571
1571
|
return Object.keys(e).length === Object.keys(t).length && Object.keys(e).every((n) => t.hasOwnProperty(n) && e[n] === t[n]);
|
|
1572
1572
|
}
|
|
1573
|
-
function
|
|
1574
|
-
return typeof e != "object" || typeof t != "object" || e === null || t === null ? e === t :
|
|
1573
|
+
function ot(e, t) {
|
|
1574
|
+
return typeof e != "object" || typeof t != "object" || e === null || t === null ? e === t : mr(e, t) ? Object.keys(e).every((n) => ot(e[n], t[n])) : !1;
|
|
1575
1575
|
}
|
|
1576
|
-
function
|
|
1577
|
-
if (!
|
|
1576
|
+
function on(e) {
|
|
1577
|
+
if (!Le(e))
|
|
1578
1578
|
return e;
|
|
1579
1579
|
const t = {};
|
|
1580
1580
|
for (const [n, r] of Object.entries(e))
|
|
1581
1581
|
r !== void 0 && (t[n] = r);
|
|
1582
1582
|
return t;
|
|
1583
1583
|
}
|
|
1584
|
-
function
|
|
1585
|
-
if (!
|
|
1584
|
+
function Sr(e, t) {
|
|
1585
|
+
if (!Le(e) || !Le(t))
|
|
1586
1586
|
return t;
|
|
1587
1587
|
const n = Object.assign({}, e);
|
|
1588
1588
|
for (const r of Object.keys(t)) {
|
|
@@ -1592,12 +1592,12 @@ function vr(e, t) {
|
|
|
1592
1592
|
delete n[r];
|
|
1593
1593
|
continue;
|
|
1594
1594
|
}
|
|
1595
|
-
const i =
|
|
1596
|
-
n[r] = i ?
|
|
1595
|
+
const i = Le(e[r]) && Le(t[r]);
|
|
1596
|
+
n[r] = i ? Sr(e[r], t[r]) : t[r];
|
|
1597
1597
|
}
|
|
1598
1598
|
return n;
|
|
1599
1599
|
}
|
|
1600
|
-
function
|
|
1600
|
+
function Le(e) {
|
|
1601
1601
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
1602
1602
|
}
|
|
1603
1603
|
function Ni(e, t, n) {
|
|
@@ -1611,7 +1611,7 @@ function Ni(e, t, n) {
|
|
|
1611
1611
|
const i = t[t.length - 1];
|
|
1612
1612
|
Array.isArray(r) && typeof i == "number" ? r.splice(i, 0, n) : r[i] = n;
|
|
1613
1613
|
}
|
|
1614
|
-
function
|
|
1614
|
+
function Ln(e, t, n) {
|
|
1615
1615
|
if (!e || t.length === 0)
|
|
1616
1616
|
return;
|
|
1617
1617
|
let r = e || {};
|
|
@@ -1621,7 +1621,7 @@ function Fn(e, t, n) {
|
|
|
1621
1621
|
}
|
|
1622
1622
|
r[t[t.length - 1]] = n;
|
|
1623
1623
|
}
|
|
1624
|
-
function
|
|
1624
|
+
function vr(e, t) {
|
|
1625
1625
|
if (!e || t.length === 0)
|
|
1626
1626
|
return;
|
|
1627
1627
|
const [n, ...r] = t;
|
|
@@ -1630,13 +1630,13 @@ function Or(e, t) {
|
|
|
1630
1630
|
Array.isArray(e) ? e.splice(n, 1) : delete e[n];
|
|
1631
1631
|
return;
|
|
1632
1632
|
}
|
|
1633
|
-
|
|
1633
|
+
vr(e[n], r), Vi(e[n]) && delete e[n];
|
|
1634
1634
|
}
|
|
1635
1635
|
}
|
|
1636
1636
|
function Vi(e) {
|
|
1637
1637
|
return e && Object.keys(e).length === 0;
|
|
1638
1638
|
}
|
|
1639
|
-
const
|
|
1639
|
+
const Fn = /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$/, qi = {
|
|
1640
1640
|
ZULU: 0,
|
|
1641
1641
|
YEKT: 18e3,
|
|
1642
1642
|
YEKST: 21600,
|
|
@@ -1892,10 +1892,10 @@ function Xi(e) {
|
|
|
1892
1892
|
}
|
|
1893
1893
|
}
|
|
1894
1894
|
function es(e) {
|
|
1895
|
-
const t = e.match(
|
|
1895
|
+
const t = e.match(Fn);
|
|
1896
1896
|
if (!t)
|
|
1897
1897
|
return null;
|
|
1898
|
-
const [n] = t, r = qi[n], i = new Date(e.replace(
|
|
1898
|
+
const [n] = t, r = qi[n], i = new Date(e.replace(Fn, "Z"));
|
|
1899
1899
|
return new Date(i.getTime() - r * 1e3);
|
|
1900
1900
|
}
|
|
1901
1901
|
const ts = [
|
|
@@ -1919,7 +1919,7 @@ function ns(e, t) {
|
|
|
1919
1919
|
return null;
|
|
1920
1920
|
}
|
|
1921
1921
|
}
|
|
1922
|
-
function
|
|
1922
|
+
function Ft(e) {
|
|
1923
1923
|
for (const t of ts) {
|
|
1924
1924
|
const n = ns(t, e);
|
|
1925
1925
|
if (n)
|
|
@@ -1930,19 +1930,19 @@ function Wt(e) {
|
|
|
1930
1930
|
function rs(e) {
|
|
1931
1931
|
try {
|
|
1932
1932
|
const t = JSON.parse(e);
|
|
1933
|
-
return typeof t == "string" ?
|
|
1933
|
+
return typeof t == "string" ? Ft(t) : null;
|
|
1934
1934
|
} catch {
|
|
1935
1935
|
return null;
|
|
1936
1936
|
}
|
|
1937
1937
|
}
|
|
1938
|
-
function
|
|
1938
|
+
function lt(e) {
|
|
1939
1939
|
if (e !== void 0) {
|
|
1940
1940
|
if (e === null)
|
|
1941
1941
|
return null;
|
|
1942
1942
|
if (e instanceof Date)
|
|
1943
1943
|
return e;
|
|
1944
1944
|
if (typeof e == "string") {
|
|
1945
|
-
const t =
|
|
1945
|
+
const t = Ft(e) || rs(e) || Ft(e.trim());
|
|
1946
1946
|
if (!t)
|
|
1947
1947
|
throw new Error(`Unable to parse \`${e}\` as a date.`);
|
|
1948
1948
|
return t;
|
|
@@ -1954,19 +1954,19 @@ function yt(e) {
|
|
|
1954
1954
|
function is(e) {
|
|
1955
1955
|
return e.cardinality === "one";
|
|
1956
1956
|
}
|
|
1957
|
-
function
|
|
1957
|
+
function un(e) {
|
|
1958
1958
|
return e["value-type"] === "ref";
|
|
1959
1959
|
}
|
|
1960
|
-
function
|
|
1960
|
+
function an(e) {
|
|
1961
1961
|
return e["value-type"] === "blob";
|
|
1962
1962
|
}
|
|
1963
1963
|
function Ie(e, t) {
|
|
1964
1964
|
return e[t];
|
|
1965
1965
|
}
|
|
1966
|
-
function
|
|
1966
|
+
function ht(e, t) {
|
|
1967
1967
|
return t.reduce((n, r) => n && n.get(r), e);
|
|
1968
1968
|
}
|
|
1969
|
-
function
|
|
1969
|
+
function re(e, t) {
|
|
1970
1970
|
if (t.length === 0)
|
|
1971
1971
|
throw new Error("path must have at least one element");
|
|
1972
1972
|
if (t.length === 1) {
|
|
@@ -1974,7 +1974,7 @@ function se(e, t) {
|
|
|
1974
1974
|
return;
|
|
1975
1975
|
}
|
|
1976
1976
|
const [n, ...r] = t;
|
|
1977
|
-
e.has(n) &&
|
|
1977
|
+
e.has(n) && re(e.get(n), r);
|
|
1978
1978
|
}
|
|
1979
1979
|
function Y(e, t, n) {
|
|
1980
1980
|
if (t.length === 0)
|
|
@@ -1987,7 +1987,7 @@ function Y(e, t, n) {
|
|
|
1987
1987
|
let s = e.get(r);
|
|
1988
1988
|
s || (s = /* @__PURE__ */ new Map(), e.set(r, s)), Y(s, i, n);
|
|
1989
1989
|
}
|
|
1990
|
-
function
|
|
1990
|
+
function Or(e, t, n) {
|
|
1991
1991
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
1992
1992
|
for (const o of t) {
|
|
1993
1993
|
let [u, a, d, c] = o;
|
|
@@ -1996,15 +1996,15 @@ function Er(e, t, n) {
|
|
|
1996
1996
|
console.warn("no such attr", u, e);
|
|
1997
1997
|
continue;
|
|
1998
1998
|
}
|
|
1999
|
-
f["checked-data-type"] === "date" && n && (d =
|
|
1999
|
+
f["checked-data-type"] === "date" && n && (d = lt(d), o[2] = d), un(f) && Y(s, [d, a, u], o), Y(r, [u, a, d], o), Y(i, [a, u, d], o);
|
|
2000
2000
|
}
|
|
2001
2001
|
return { eav: r, aev: i, vae: s };
|
|
2002
2002
|
}
|
|
2003
|
-
function
|
|
2003
|
+
function Er(e) {
|
|
2004
2004
|
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
2005
2005
|
for (const s of Object.values(e)) {
|
|
2006
2006
|
const o = s["forward-identity"], [u, a, d] = o, c = s["reverse-identity"];
|
|
2007
|
-
if (Y(r, [a, d], s),
|
|
2007
|
+
if (Y(r, [a, d], s), an(s) && Y(t, [a, d], s), s["primary?"] && Y(n, [a], s), c) {
|
|
2008
2008
|
const [f, h, p] = c;
|
|
2009
2009
|
Y(i, [h, p], s);
|
|
2010
2010
|
}
|
|
@@ -2022,16 +2022,16 @@ function ss(e) {
|
|
|
2022
2022
|
};
|
|
2023
2023
|
}
|
|
2024
2024
|
function os(e) {
|
|
2025
|
-
return
|
|
2025
|
+
return Nt(e.attrs, e.triples, e.cardinalityInference, e.linkIndex, e.useDateObjects);
|
|
2026
2026
|
}
|
|
2027
|
-
function
|
|
2028
|
-
e.attrIndexes =
|
|
2027
|
+
function cn(e) {
|
|
2028
|
+
e.attrIndexes = Er(e.attrs);
|
|
2029
2029
|
}
|
|
2030
|
-
function
|
|
2031
|
-
const s =
|
|
2032
|
-
return s.useDateObjects = i, s.attrs = e, s.attrIndexes =
|
|
2030
|
+
function Nt(e, t, n, r, i) {
|
|
2031
|
+
const s = Or(e, t, i);
|
|
2032
|
+
return s.useDateObjects = i, s.attrs = e, s.attrIndexes = Er(e), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
|
|
2033
2033
|
}
|
|
2034
|
-
function
|
|
2034
|
+
function We(e, t) {
|
|
2035
2035
|
var n, r;
|
|
2036
2036
|
let i;
|
|
2037
2037
|
if (Array.isArray(t[0])) {
|
|
@@ -2059,59 +2059,59 @@ function ze(e, t) {
|
|
|
2059
2059
|
}
|
|
2060
2060
|
}
|
|
2061
2061
|
function us(e, t) {
|
|
2062
|
-
const n =
|
|
2062
|
+
const n = We(e, t);
|
|
2063
2063
|
if (!n)
|
|
2064
2064
|
return;
|
|
2065
2065
|
const [r, i, s] = n, o = Ie(e.attrs, i);
|
|
2066
|
-
o && (
|
|
2066
|
+
o && (re(e.eav, [r, i, s]), re(e.aev, [i, r, s]), un(o) && re(e.vae, [s, i, r]));
|
|
2067
2067
|
}
|
|
2068
2068
|
let as = 0;
|
|
2069
|
-
function
|
|
2069
|
+
function Ar(e, t, n) {
|
|
2070
2070
|
const [r, i, s] = n;
|
|
2071
2071
|
let o;
|
|
2072
|
-
const u =
|
|
2072
|
+
const u = ht(e.ea, [r, i, s]);
|
|
2073
2073
|
return u && (o = u[3]), o || Date.now() * 10 + as++;
|
|
2074
2074
|
}
|
|
2075
2075
|
function cs(e, t) {
|
|
2076
2076
|
var n;
|
|
2077
|
-
const r =
|
|
2077
|
+
const r = We(e, t);
|
|
2078
2078
|
if (!r)
|
|
2079
2079
|
return;
|
|
2080
2080
|
let [i, s, o] = r;
|
|
2081
2081
|
const u = Ie(e.attrs, s);
|
|
2082
2082
|
if (!u)
|
|
2083
2083
|
return;
|
|
2084
|
-
u["checked-data-type"] === "date" && e.useDateObjects && (o =
|
|
2085
|
-
const a =
|
|
2086
|
-
is(u) ? (Y(e.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), Y(e.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (Y(e.eav, [i, s, o], c), Y(e.aev, [s, i, o], c)),
|
|
2084
|
+
u["checked-data-type"] === "date" && e.useDateObjects && (o = lt(o));
|
|
2085
|
+
const a = ht(e.eav, [i, s, o]), d = (n = a == null ? void 0 : a[3]) !== null && n !== void 0 ? n : Ar(e, u, r), c = [i, s, o, d];
|
|
2086
|
+
is(u) ? (Y(e.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), Y(e.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (Y(e.eav, [i, s, o], c), Y(e.aev, [s, i, o], c)), un(u) && Y(e.vae, [o, s, i], c);
|
|
2087
2087
|
}
|
|
2088
2088
|
function ds(e, t) {
|
|
2089
2089
|
var n;
|
|
2090
|
-
const r =
|
|
2090
|
+
const r = We(e, t);
|
|
2091
2091
|
if (!r)
|
|
2092
2092
|
return;
|
|
2093
2093
|
const [i, s, o] = r, u = Ie(e.attrs, s);
|
|
2094
2094
|
if (!u)
|
|
2095
2095
|
return;
|
|
2096
|
-
if (!
|
|
2096
|
+
if (!an(u))
|
|
2097
2097
|
throw new Error("merge operation is not supported for links");
|
|
2098
|
-
const a =
|
|
2098
|
+
const a = ht(e.eav, [i, s]);
|
|
2099
2099
|
if (!a)
|
|
2100
2100
|
return;
|
|
2101
2101
|
const d = (n = a.values().next()) === null || n === void 0 ? void 0 : n.value;
|
|
2102
2102
|
if (!d)
|
|
2103
2103
|
return;
|
|
2104
|
-
const c = d[2], f =
|
|
2104
|
+
const c = d[2], f = Sr(c, o), h = [
|
|
2105
2105
|
i,
|
|
2106
2106
|
s,
|
|
2107
2107
|
f,
|
|
2108
|
-
|
|
2108
|
+
Ar(e, u, d)
|
|
2109
2109
|
];
|
|
2110
2110
|
Y(e.eav, [i, s], /* @__PURE__ */ new Map([[f, h]]));
|
|
2111
2111
|
}
|
|
2112
|
-
function
|
|
2112
|
+
function Vt(e, t) {
|
|
2113
2113
|
var n, r;
|
|
2114
|
-
const [i, s] = t, o =
|
|
2114
|
+
const [i, s] = t, o = We(e, [i]);
|
|
2115
2115
|
if (!o)
|
|
2116
2116
|
return;
|
|
2117
2117
|
const [u] = o, a = e.eav.get(u);
|
|
@@ -2120,43 +2120,43 @@ function Kt(e, t) {
|
|
|
2120
2120
|
const f = e.attrs[c];
|
|
2121
2121
|
f && f["on-delete-reverse"] === "cascade" && H(a.get(c), 1).forEach(([h, p, b]) => {
|
|
2122
2122
|
var g;
|
|
2123
|
-
return
|
|
2123
|
+
return Vt(e, [b, (g = f["reverse-identity"]) === null || g === void 0 ? void 0 : g[1]]);
|
|
2124
2124
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
2125
2125
|
// the store that didn't set `etype` in deleteEntity
|
|
2126
2126
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
2127
2127
|
!f || // Make sure it matches the etype
|
|
2128
|
-
((n = f["forward-identity"]) === null || n === void 0 ? void 0 : n[1]) === s) && (
|
|
2128
|
+
((n = f["forward-identity"]) === null || n === void 0 ? void 0 : n[1]) === s) && (re(e.aev, [c, u]), re(e.eav, [u, c]));
|
|
2129
2129
|
}
|
|
2130
|
-
a.size === 0 &&
|
|
2130
|
+
a.size === 0 && re(e.eav, [u]);
|
|
2131
2131
|
}
|
|
2132
2132
|
const d = e.vae.get(u) && H(e.vae.get(u), 2);
|
|
2133
2133
|
d && d.forEach((c) => {
|
|
2134
2134
|
var f, h, p;
|
|
2135
2135
|
const [b, g, w] = c, T = e.attrs[g];
|
|
2136
|
-
(!s || !T || ((f = T["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (
|
|
2137
|
-
}), ((r = e.vae.get(u)) === null || r === void 0 ? void 0 : r.size) === 0 &&
|
|
2136
|
+
(!s || !T || ((f = T["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (re(e.eav, [b, g, w]), re(e.aev, [g, b, w]), re(e.vae, [w, g, b])), T && T["on-delete"] === "cascade" && ((h = T["reverse-identity"]) === null || h === void 0 ? void 0 : h[1]) === s && Vt(e, [b, (p = T["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
|
|
2137
|
+
}), ((r = e.vae.get(u)) === null || r === void 0 ? void 0 : r.size) === 0 && re(e.vae, [u]);
|
|
2138
2138
|
}
|
|
2139
|
-
function
|
|
2140
|
-
const n =
|
|
2139
|
+
function Cr(e, t) {
|
|
2140
|
+
const n = Or(e.attrs, t, e.useDateObjects);
|
|
2141
2141
|
Object.keys(n).forEach((r) => {
|
|
2142
2142
|
e[r] = n[r];
|
|
2143
2143
|
});
|
|
2144
2144
|
}
|
|
2145
2145
|
function fs(e, [t]) {
|
|
2146
|
-
e.attrs[t.id] = t,
|
|
2146
|
+
e.attrs[t.id] = t, cn(e);
|
|
2147
2147
|
}
|
|
2148
|
-
function
|
|
2148
|
+
function jr(e) {
|
|
2149
2149
|
return H(e.eav, 3);
|
|
2150
2150
|
}
|
|
2151
2151
|
function ls(e, [t]) {
|
|
2152
2152
|
if (!e.attrs[t])
|
|
2153
2153
|
return;
|
|
2154
|
-
const n =
|
|
2155
|
-
delete e.attrs[t],
|
|
2154
|
+
const n = jr(e).filter(([r, i]) => i !== t);
|
|
2155
|
+
delete e.attrs[t], cn(e), Cr(e, n);
|
|
2156
2156
|
}
|
|
2157
2157
|
function hs(e, [t]) {
|
|
2158
2158
|
const n = e.attrs[t.id];
|
|
2159
|
-
n && (e.attrs[t.id] = Object.assign(Object.assign({}, n), t),
|
|
2159
|
+
n && (e.attrs[t.id] = Object.assign(Object.assign({}, n), t), cn(e), Cr(e, jr(e)));
|
|
2160
2160
|
}
|
|
2161
2161
|
function ps(e, t) {
|
|
2162
2162
|
const [n, ...r] = t;
|
|
@@ -2171,7 +2171,7 @@ function ps(e, t) {
|
|
|
2171
2171
|
us(e, r);
|
|
2172
2172
|
break;
|
|
2173
2173
|
case "delete-entity":
|
|
2174
|
-
|
|
2174
|
+
Vt(e, r);
|
|
2175
2175
|
break;
|
|
2176
2176
|
case "add-attr":
|
|
2177
2177
|
fs(e, r);
|
|
@@ -2202,7 +2202,7 @@ function H(e, t, n = []) {
|
|
|
2202
2202
|
H(r, t - 1, n);
|
|
2203
2203
|
return n;
|
|
2204
2204
|
}
|
|
2205
|
-
function
|
|
2205
|
+
function tt(e, t, n) {
|
|
2206
2206
|
var r, i;
|
|
2207
2207
|
const s = [];
|
|
2208
2208
|
if (n != null && n.hasOwnProperty("$not")) {
|
|
@@ -2252,7 +2252,7 @@ function bs(e, [t, n, r]) {
|
|
|
2252
2252
|
}
|
|
2253
2253
|
case "eav": {
|
|
2254
2254
|
const u = (s = e.eav.get(t)) === null || s === void 0 ? void 0 : s.get(n);
|
|
2255
|
-
return u ?
|
|
2255
|
+
return u ? tt(e, u, r) : [];
|
|
2256
2256
|
}
|
|
2257
2257
|
case "ev": {
|
|
2258
2258
|
const u = e.eav.get(t);
|
|
@@ -2260,7 +2260,7 @@ function bs(e, [t, n, r]) {
|
|
|
2260
2260
|
return [];
|
|
2261
2261
|
const a = [];
|
|
2262
2262
|
for (const d of u.values())
|
|
2263
|
-
a.push(...
|
|
2263
|
+
a.push(...tt(e, d, r));
|
|
2264
2264
|
return a;
|
|
2265
2265
|
}
|
|
2266
2266
|
case "a": {
|
|
@@ -2273,14 +2273,14 @@ function bs(e, [t, n, r]) {
|
|
|
2273
2273
|
return [];
|
|
2274
2274
|
const a = [];
|
|
2275
2275
|
for (const d of u.values())
|
|
2276
|
-
a.push(...
|
|
2276
|
+
a.push(...tt(e, d, r));
|
|
2277
2277
|
return a;
|
|
2278
2278
|
}
|
|
2279
2279
|
case "v": {
|
|
2280
2280
|
const u = [];
|
|
2281
2281
|
for (const a of e.eav.values())
|
|
2282
2282
|
for (const d of a.values())
|
|
2283
|
-
u.push(...
|
|
2283
|
+
u.push(...tt(e, d, r));
|
|
2284
2284
|
return u;
|
|
2285
2285
|
}
|
|
2286
2286
|
default:
|
|
@@ -2301,25 +2301,25 @@ function Ce(e, t, n) {
|
|
|
2301
2301
|
var r;
|
|
2302
2302
|
return (r = e.attrIndexes.forwardIdents.get(t)) === null || r === void 0 ? void 0 : r.get(n);
|
|
2303
2303
|
}
|
|
2304
|
-
function
|
|
2304
|
+
function Pr(e, t, n) {
|
|
2305
2305
|
var r;
|
|
2306
2306
|
return (r = e.attrIndexes.revIdents.get(t)) === null || r === void 0 ? void 0 : r.get(n);
|
|
2307
2307
|
}
|
|
2308
2308
|
function gs(e, t) {
|
|
2309
2309
|
return e.attrIndexes.blobAttrs.get(t);
|
|
2310
2310
|
}
|
|
2311
|
-
function
|
|
2311
|
+
function kr(e, t) {
|
|
2312
2312
|
var n;
|
|
2313
2313
|
const r = e.attrIndexes.primaryKeys.get(t);
|
|
2314
2314
|
return r || ((n = e.attrIndexes.forwardIdents.get(t)) === null || n === void 0 ? void 0 : n.get("id"));
|
|
2315
2315
|
}
|
|
2316
2316
|
function Ts(e, t) {
|
|
2317
|
-
const n =
|
|
2317
|
+
const n = We(e, t);
|
|
2318
2318
|
if (!n)
|
|
2319
2319
|
return;
|
|
2320
2320
|
const [r, i, s] = n;
|
|
2321
2321
|
if (Ie(e.attrs, i))
|
|
2322
|
-
return
|
|
2322
|
+
return ht(e.eav, [r, i]);
|
|
2323
2323
|
}
|
|
2324
2324
|
function ws(e, t) {
|
|
2325
2325
|
const n = t.filter(([r, i, s, o, u]) => {
|
|
@@ -2331,12 +2331,12 @@ function ws(e, t) {
|
|
|
2331
2331
|
let d = !1;
|
|
2332
2332
|
const c = Ie(e.attrs, s);
|
|
2333
2333
|
if (c) {
|
|
2334
|
-
const f =
|
|
2334
|
+
const f = kr(e, c["forward-identity"][1]);
|
|
2335
2335
|
d = !!Ts(e, [i, f.id, i]);
|
|
2336
2336
|
}
|
|
2337
2337
|
return !(a === "create" && d || a === "update" && !d);
|
|
2338
2338
|
});
|
|
2339
|
-
return
|
|
2339
|
+
return Lt(e, (r) => {
|
|
2340
2340
|
n.forEach((i) => {
|
|
2341
2341
|
ps(r, i);
|
|
2342
2342
|
});
|
|
@@ -2348,19 +2348,19 @@ function ms(e) {
|
|
|
2348
2348
|
function Ss(e, t, n) {
|
|
2349
2349
|
if (n.hasOwnProperty(e)) {
|
|
2350
2350
|
const r = n[e];
|
|
2351
|
-
return
|
|
2351
|
+
return Ir(r, t, n);
|
|
2352
2352
|
}
|
|
2353
2353
|
return Object.assign(Object.assign({}, n), { [e]: t });
|
|
2354
2354
|
}
|
|
2355
|
-
function
|
|
2355
|
+
function Nn(e, t, n) {
|
|
2356
2356
|
return e === t ? n : null;
|
|
2357
2357
|
}
|
|
2358
2358
|
function vs(e) {
|
|
2359
2359
|
switch (typeof e) {
|
|
2360
2360
|
case "string":
|
|
2361
|
-
return e.startsWith("?") ? Ss :
|
|
2361
|
+
return e.startsWith("?") ? Ss : Nn;
|
|
2362
2362
|
default:
|
|
2363
|
-
return
|
|
2363
|
+
return Nn;
|
|
2364
2364
|
}
|
|
2365
2365
|
}
|
|
2366
2366
|
const Os = [
|
|
@@ -2377,65 +2377,65 @@ function Es(e) {
|
|
|
2377
2377
|
return !0;
|
|
2378
2378
|
return !1;
|
|
2379
2379
|
}
|
|
2380
|
-
function
|
|
2380
|
+
function Ir(e, t, n) {
|
|
2381
2381
|
return n ? typeof e == "object" ? Es(e) ? n : null : vs(e)(e, t, n) : null;
|
|
2382
2382
|
}
|
|
2383
2383
|
function As(e, t, n) {
|
|
2384
2384
|
return e.reduce((r, i, s) => {
|
|
2385
2385
|
const o = t[s];
|
|
2386
|
-
return
|
|
2386
|
+
return Ir(i, o, r);
|
|
2387
2387
|
}, n);
|
|
2388
2388
|
}
|
|
2389
2389
|
function Cs(e, t, n) {
|
|
2390
2390
|
return ks(e, t, n).map((r) => As(t, r, n)).filter((r) => r);
|
|
2391
2391
|
}
|
|
2392
2392
|
function js(e, t, n) {
|
|
2393
|
-
return t.or ? t.or.patterns.flatMap((r) =>
|
|
2393
|
+
return t.or ? t.or.patterns.flatMap((r) => qt(e, r, n)) : t.and ? t.and.patterns.reduce((r, i) => qt(e, i, r), n) : n.flatMap((r) => Cs(e, t, r));
|
|
2394
2394
|
}
|
|
2395
|
-
function
|
|
2395
|
+
function qt(e, t, n = [{}]) {
|
|
2396
2396
|
return t.reduce((r, i) => js(e, i, r), n);
|
|
2397
2397
|
}
|
|
2398
|
-
function
|
|
2399
|
-
return Array.isArray(t) ? t.map((n) =>
|
|
2398
|
+
function dn(e, t) {
|
|
2399
|
+
return Array.isArray(t) ? t.map((n) => dn(e, n)) : ms(t) ? e[t] : t;
|
|
2400
2400
|
}
|
|
2401
2401
|
function Ps(e, { find: t, where: n }) {
|
|
2402
|
-
return
|
|
2402
|
+
return qt(e, n).map((i) => dn(i, t));
|
|
2403
2403
|
}
|
|
2404
2404
|
function ks(e, t, n) {
|
|
2405
|
-
return bs(e,
|
|
2405
|
+
return bs(e, dn(n, t));
|
|
2406
2406
|
}
|
|
2407
2407
|
const Is = /^(?:[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;
|
|
2408
2408
|
function je(e) {
|
|
2409
2409
|
return typeof e == "string" && Is.test(e);
|
|
2410
2410
|
}
|
|
2411
|
-
const
|
|
2411
|
+
const N = [];
|
|
2412
2412
|
for (let e = 0; e < 256; ++e)
|
|
2413
|
-
|
|
2413
|
+
N.push((e + 256).toString(16).slice(1));
|
|
2414
2414
|
function Ms(e, t = 0) {
|
|
2415
|
-
return (
|
|
2415
|
+
return (N[e[t + 0]] + N[e[t + 1]] + N[e[t + 2]] + N[e[t + 3]] + "-" + N[e[t + 4]] + N[e[t + 5]] + "-" + N[e[t + 6]] + N[e[t + 7]] + "-" + N[e[t + 8]] + N[e[t + 9]] + "-" + N[e[t + 10]] + N[e[t + 11]] + N[e[t + 12]] + N[e[t + 13]] + N[e[t + 14]] + N[e[t + 15]]).toLowerCase();
|
|
2416
2416
|
}
|
|
2417
|
-
let
|
|
2417
|
+
let Et;
|
|
2418
2418
|
const Rs = new Uint8Array(16);
|
|
2419
2419
|
function $s() {
|
|
2420
|
-
if (!
|
|
2420
|
+
if (!Et) {
|
|
2421
2421
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
2422
2422
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
2423
|
-
|
|
2423
|
+
Et = crypto.getRandomValues.bind(crypto);
|
|
2424
2424
|
}
|
|
2425
|
-
return
|
|
2425
|
+
return Et(Rs);
|
|
2426
2426
|
}
|
|
2427
|
-
const Ds = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
2427
|
+
const Ds = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Vn = { randomUUID: Ds };
|
|
2428
2428
|
function xs(e, t, n) {
|
|
2429
2429
|
var i;
|
|
2430
|
-
if (
|
|
2431
|
-
return
|
|
2430
|
+
if (Vn.randomUUID && !e)
|
|
2431
|
+
return Vn.randomUUID();
|
|
2432
2432
|
e = e || {};
|
|
2433
2433
|
const r = e.random ?? ((i = e.rng) == null ? void 0 : i.call(e)) ?? $s();
|
|
2434
2434
|
if (r.length < 16)
|
|
2435
2435
|
throw new Error("Random bytes length must be >= 16");
|
|
2436
2436
|
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Ms(r);
|
|
2437
2437
|
}
|
|
2438
|
-
function
|
|
2438
|
+
function qn(e) {
|
|
2439
2439
|
const t = e.replace(/-/g, ""), n = [];
|
|
2440
2440
|
for (let r = 0; r < t.length; r += 2)
|
|
2441
2441
|
n.push(parseInt(t.substring(r, r + 2), 16));
|
|
@@ -2451,9 +2451,9 @@ function Us(e, t) {
|
|
|
2451
2451
|
return 0;
|
|
2452
2452
|
}
|
|
2453
2453
|
function Ls(e, t) {
|
|
2454
|
-
return Us(
|
|
2454
|
+
return Us(qn(e), qn(t));
|
|
2455
2455
|
}
|
|
2456
|
-
function
|
|
2456
|
+
function q() {
|
|
2457
2457
|
return xs();
|
|
2458
2458
|
}
|
|
2459
2459
|
function Fs(e, t) {
|
|
@@ -2470,10 +2470,10 @@ function Ns() {
|
|
|
2470
2470
|
}
|
|
2471
2471
|
const Vs = Ns();
|
|
2472
2472
|
let qs = 0;
|
|
2473
|
-
function
|
|
2474
|
-
return
|
|
2473
|
+
function Ne(e) {
|
|
2474
|
+
return pt(`_${e}`, qs++);
|
|
2475
2475
|
}
|
|
2476
|
-
function
|
|
2476
|
+
function pt(e, t) {
|
|
2477
2477
|
return `?${e}-${t}`;
|
|
2478
2478
|
}
|
|
2479
2479
|
class Pe extends Error {
|
|
@@ -2482,12 +2482,12 @@ class Pe extends Error {
|
|
|
2482
2482
|
}
|
|
2483
2483
|
}
|
|
2484
2484
|
function Ws(e, t) {
|
|
2485
|
-
const n =
|
|
2485
|
+
const n = kr(e, t);
|
|
2486
2486
|
if (!n)
|
|
2487
2487
|
throw new Pe(`Could not find id attr for ${t}`);
|
|
2488
2488
|
return n;
|
|
2489
2489
|
}
|
|
2490
|
-
function
|
|
2490
|
+
function Wn(e, t, n, r) {
|
|
2491
2491
|
return [zs(e, t, n, r)];
|
|
2492
2492
|
}
|
|
2493
2493
|
function zs(e, t, n, r) {
|
|
@@ -2501,8 +2501,8 @@ function zs(e, t, n, r) {
|
|
|
2501
2501
|
function Ks(e, t, n) {
|
|
2502
2502
|
return e.map((r) => r === t ? n : r);
|
|
2503
2503
|
}
|
|
2504
|
-
function
|
|
2505
|
-
const s = Ce(t, n, i), o =
|
|
2504
|
+
function Mr(e, t, n, r, i) {
|
|
2505
|
+
const s = Ce(t, n, i), o = Pr(t, n, i), u = s || o;
|
|
2506
2506
|
if (!u)
|
|
2507
2507
|
throw new Pe(`Could not find attr for ${[n, i]}`);
|
|
2508
2508
|
if (u["value-type"] !== "ref")
|
|
@@ -2511,16 +2511,16 @@ function Rr(e, t, n, r, i) {
|
|
|
2511
2511
|
e(d, r),
|
|
2512
2512
|
u.id,
|
|
2513
2513
|
e(f, h),
|
|
2514
|
-
|
|
2514
|
+
Ne("time")
|
|
2515
2515
|
] : [
|
|
2516
2516
|
e(d, h),
|
|
2517
2517
|
u.id,
|
|
2518
2518
|
e(f, r),
|
|
2519
|
-
|
|
2519
|
+
Ne("time")
|
|
2520
2520
|
];
|
|
2521
2521
|
return [s ? f : d, h, p, u, !!s];
|
|
2522
2522
|
}
|
|
2523
|
-
function
|
|
2523
|
+
function zn(e, t) {
|
|
2524
2524
|
if (typeof t != "string")
|
|
2525
2525
|
return function(o) {
|
|
2526
2526
|
return !1;
|
|
@@ -2571,7 +2571,7 @@ function Bs(e, t) {
|
|
|
2571
2571
|
}
|
|
2572
2572
|
};
|
|
2573
2573
|
if (t.hasOwnProperty("$like")) {
|
|
2574
|
-
const r =
|
|
2574
|
+
const r = zn(!0, t.$like);
|
|
2575
2575
|
return {
|
|
2576
2576
|
$comparator: !0,
|
|
2577
2577
|
$op: function(s) {
|
|
@@ -2580,7 +2580,7 @@ function Bs(e, t) {
|
|
|
2580
2580
|
};
|
|
2581
2581
|
}
|
|
2582
2582
|
if (t.hasOwnProperty("$ilike")) {
|
|
2583
|
-
const r =
|
|
2583
|
+
const r = zn(!1, t.$ilike);
|
|
2584
2584
|
return {
|
|
2585
2585
|
$comparator: !0,
|
|
2586
2586
|
$op: function(s) {
|
|
@@ -2591,7 +2591,7 @@ function Bs(e, t) {
|
|
|
2591
2591
|
return t;
|
|
2592
2592
|
}
|
|
2593
2593
|
function Qs(e, t, n, r, i, s) {
|
|
2594
|
-
const o = Ce(t, n, i), u =
|
|
2594
|
+
const o = Ce(t, n, i), u = Pr(t, n, i), a = o || u;
|
|
2595
2595
|
if (!a)
|
|
2596
2596
|
throw new Pe(`No attr for etype = ${n} label = ${i}`);
|
|
2597
2597
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
@@ -2602,24 +2602,24 @@ function Qs(e, t, n, r, i, s) {
|
|
|
2602
2602
|
e(n, r),
|
|
2603
2603
|
d.id,
|
|
2604
2604
|
{ $isNull: { attrId: a.id, isNull: s.$isNull, reverse: !o } },
|
|
2605
|
-
|
|
2605
|
+
Ne("time")
|
|
2606
2606
|
];
|
|
2607
2607
|
}
|
|
2608
2608
|
return o ? [
|
|
2609
2609
|
e(n, r),
|
|
2610
2610
|
a.id,
|
|
2611
2611
|
Bs(a, s),
|
|
2612
|
-
|
|
2613
|
-
] : [s, a.id, e(n, r),
|
|
2612
|
+
Ne("time")
|
|
2613
|
+
] : [s, a.id, e(n, r), Ne("time")];
|
|
2614
2614
|
}
|
|
2615
2615
|
function Gs(e, t, n, r, i) {
|
|
2616
2616
|
const [s, o, u] = i.reduce((a, d) => {
|
|
2617
|
-
const [c, f, h] = a, [p, b, g] =
|
|
2617
|
+
const [c, f, h] = a, [p, b, g] = Mr(e, t, c, f, d);
|
|
2618
2618
|
return [p, b, [...h, g]];
|
|
2619
2619
|
}, [n, r, []]);
|
|
2620
2620
|
return [s, o, u];
|
|
2621
2621
|
}
|
|
2622
|
-
function
|
|
2622
|
+
function Wt(e, t, n, r, i, s) {
|
|
2623
2623
|
const o = i.slice(0, i.length - 1), u = i[i.length - 1], [a, d, c] = Gs(e, t, n, r, o), f = Qs(e, t, a, d, u, s);
|
|
2624
2624
|
return c.concat([f]);
|
|
2625
2625
|
}
|
|
@@ -2638,10 +2638,10 @@ function Zs(e, t, n) {
|
|
|
2638
2638
|
return t == s ? s : `${s}-${n}`;
|
|
2639
2639
|
};
|
|
2640
2640
|
}
|
|
2641
|
-
function
|
|
2641
|
+
function Kn(e, t, n, r, i, s) {
|
|
2642
2642
|
const o = e(r, i), u = s.map((a, d) => {
|
|
2643
2643
|
const c = Zs(e, o, d);
|
|
2644
|
-
return
|
|
2644
|
+
return Rr(c, n, r, i, a);
|
|
2645
2645
|
});
|
|
2646
2646
|
return { [t]: { patterns: u, joinSym: o } };
|
|
2647
2647
|
}
|
|
@@ -2651,20 +2651,20 @@ function Xs(e) {
|
|
|
2651
2651
|
t.push(e.slice(0, n));
|
|
2652
2652
|
return t;
|
|
2653
2653
|
}
|
|
2654
|
-
function
|
|
2655
|
-
return Xs(i).map((s) =>
|
|
2654
|
+
function Bn(e, t, n, r, i) {
|
|
2655
|
+
return Xs(i).map((s) => Wt(e, t, n, r, s, { $isNull: !0 }));
|
|
2656
2656
|
}
|
|
2657
|
-
function
|
|
2657
|
+
function Rr(e, t, n, r, i) {
|
|
2658
2658
|
return Object.entries(i).flatMap(([s, o]) => {
|
|
2659
2659
|
if (Hs([s, o]))
|
|
2660
|
-
return
|
|
2660
|
+
return Kn(e, "or", t, n, r, o);
|
|
2661
2661
|
if (Js([s, o]))
|
|
2662
|
-
return
|
|
2662
|
+
return Kn(e, "and", t, n, r, o);
|
|
2663
2663
|
if (s === "$entityIdStartsWith")
|
|
2664
2664
|
return [];
|
|
2665
2665
|
const u = s.split(".");
|
|
2666
2666
|
if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2667
|
-
const a =
|
|
2667
|
+
const a = Wt(e, t, n, r, u, o), d = Bn(e, t, n, r, u);
|
|
2668
2668
|
return [
|
|
2669
2669
|
{
|
|
2670
2670
|
or: {
|
|
@@ -2677,22 +2677,22 @@ function $r(e, t, n, r, i) {
|
|
|
2677
2677
|
return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && u.length > 1 ? [
|
|
2678
2678
|
{
|
|
2679
2679
|
or: {
|
|
2680
|
-
patterns:
|
|
2680
|
+
patterns: Bn(e, t, n, r, u),
|
|
2681
2681
|
joinSym: e(n, r)
|
|
2682
2682
|
}
|
|
2683
2683
|
}
|
|
2684
|
-
] :
|
|
2684
|
+
] : Wt(e, t, n, r, u, o);
|
|
2685
2685
|
});
|
|
2686
2686
|
}
|
|
2687
2687
|
function eo(e, t, n, r) {
|
|
2688
|
-
const i =
|
|
2689
|
-
return r ?
|
|
2688
|
+
const i = pt;
|
|
2689
|
+
return r ? Rr(i, e, t, n, r).concat(Wn(i, e, t, n)) : Wn(i, e, t, n);
|
|
2690
2690
|
}
|
|
2691
2691
|
function to(e, t, n) {
|
|
2692
2692
|
return [e(t, n), e("time", n)];
|
|
2693
2693
|
}
|
|
2694
2694
|
function no(e, t, n, r, i, s) {
|
|
2695
|
-
const [o, u, a, d, c] =
|
|
2695
|
+
const [o, u, a, d, c] = Mr(e, t, n, r, i), f = Ks(a, e(n, r), s);
|
|
2696
2696
|
return [o, u, f, d, c];
|
|
2697
2697
|
}
|
|
2698
2698
|
function ro(e, t, { etype: n, level: r, form: i }, s) {
|
|
@@ -2702,13 +2702,13 @@ function ro(e, t, { etype: n, level: r, form: i }, s) {
|
|
|
2702
2702
|
var p, b, g;
|
|
2703
2703
|
const w = !!(t.cardinalityInference && (!((g = (b = (p = t.linkIndex) === null || p === void 0 ? void 0 : p[n]) === null || b === void 0 ? void 0 : b[h]) === null || g === void 0) && g.isSingular));
|
|
2704
2704
|
try {
|
|
2705
|
-
const [T, m, S] = no(e, t, n, r, h, a),
|
|
2705
|
+
const [T, m, S] = no(e, t, n, r, h, a), W = Dr(t, {
|
|
2706
2706
|
etype: T,
|
|
2707
2707
|
level: m,
|
|
2708
2708
|
form: i[h],
|
|
2709
2709
|
join: S
|
|
2710
|
-
}),
|
|
2711
|
-
return { [h]:
|
|
2710
|
+
}), E = w ? W[0] : W;
|
|
2711
|
+
return { [h]: E };
|
|
2712
2712
|
} catch (T) {
|
|
2713
2713
|
if (T instanceof Pe)
|
|
2714
2714
|
return { [h]: w ? void 0 : [] };
|
|
@@ -2722,19 +2722,19 @@ function ro(e, t, { etype: n, level: r, form: i }, s) {
|
|
|
2722
2722
|
function io(e, t, n) {
|
|
2723
2723
|
return n === "string" ? Vs(e, t) : e > t ? 1 : -1;
|
|
2724
2724
|
}
|
|
2725
|
-
function
|
|
2725
|
+
function dt([e, t], [n, r], i) {
|
|
2726
2726
|
return t === r || t == null && r == null ? Ls(e, n) : r == null ? 1 : t == null ? -1 : io(t, r, i);
|
|
2727
2727
|
}
|
|
2728
|
-
function
|
|
2728
|
+
function zt(e) {
|
|
2729
2729
|
return e == null ? e : new Date(e).getTime();
|
|
2730
2730
|
}
|
|
2731
2731
|
function so(e, t, n, r) {
|
|
2732
2732
|
var i;
|
|
2733
2733
|
const [s, o, u, a] = e, d = n === "desc" ? 1 : -1;
|
|
2734
2734
|
if (((i = t["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
|
|
2735
|
-
return
|
|
2736
|
-
const [c, f] = r, h = t["checked-data-type"], p = h === "date" ?
|
|
2737
|
-
return
|
|
2735
|
+
return dt(r, [s, a], null) === d;
|
|
2736
|
+
const [c, f] = r, h = t["checked-data-type"], p = h === "date" ? zt(f) : f, b = h === "date" ? zt(u) : u;
|
|
2737
|
+
return dt([c, p], [s, b], h) === d;
|
|
2738
2738
|
}
|
|
2739
2739
|
function oo(e, t) {
|
|
2740
2740
|
const n = t[1];
|
|
@@ -2757,7 +2757,7 @@ function co(e, t, n) {
|
|
|
2757
2757
|
const s = /* @__PURE__ */ new Map();
|
|
2758
2758
|
for (const o of n.fields) {
|
|
2759
2759
|
const u = Ce(e, t, o), a = (r = u == null ? void 0 : u["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
|
|
2760
|
-
a &&
|
|
2760
|
+
a && an(u) && s.set(a, u);
|
|
2761
2761
|
}
|
|
2762
2762
|
if (!s.has("id")) {
|
|
2763
2763
|
const o = Ce(e, t, "id"), u = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
|
|
@@ -2767,21 +2767,21 @@ function co(e, t, n) {
|
|
|
2767
2767
|
}
|
|
2768
2768
|
function fo(e, { etype: t, pageInfo: n, dq: r, form: i }) {
|
|
2769
2769
|
var s, o;
|
|
2770
|
-
const u = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, a =
|
|
2770
|
+
const u = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, a = $r(i), d = lo(i);
|
|
2771
2771
|
let c = Ps(e, r);
|
|
2772
2772
|
const f = n == null ? void 0 : n["start-cursor"], h = ao(e, t, f, u);
|
|
2773
2773
|
if (h && ((o = h == null ? void 0 : h["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
|
|
2774
2774
|
const g = h["checked-data-type"] === "date", w = h.id;
|
|
2775
2775
|
c = c.map(([T]) => {
|
|
2776
|
-
var m, S,
|
|
2777
|
-
let
|
|
2778
|
-
return g && (
|
|
2776
|
+
var m, S, W, E, x;
|
|
2777
|
+
let L = (x = (E = (W = (S = (m = e.eav.get(T)) === null || m === void 0 ? void 0 : m.get(w)) === null || S === void 0 ? void 0 : S.values()) === null || W === void 0 ? void 0 : W.next()) === null || E === void 0 ? void 0 : E.value) === null || x === void 0 ? void 0 : x[2];
|
|
2778
|
+
return g && (L = zt(L)), [T, L];
|
|
2779
2779
|
});
|
|
2780
2780
|
}
|
|
2781
2781
|
c.sort(d === "asc" ? function(w, T) {
|
|
2782
|
-
return
|
|
2782
|
+
return dt(w, T, h == null ? void 0 : h["checked-data-type"]);
|
|
2783
2783
|
} : function(w, T) {
|
|
2784
|
-
return
|
|
2784
|
+
return dt(T, w, h == null ? void 0 : h["checked-data-type"]);
|
|
2785
2785
|
});
|
|
2786
2786
|
let p = {};
|
|
2787
2787
|
const b = co(e, t, r);
|
|
@@ -2799,16 +2799,16 @@ function lo(e) {
|
|
|
2799
2799
|
const n = (t = e.$) === null || t === void 0 ? void 0 : t.order;
|
|
2800
2800
|
return n && n[Object.keys(n)[0]] || "asc";
|
|
2801
2801
|
}
|
|
2802
|
-
function
|
|
2802
|
+
function $r(e) {
|
|
2803
2803
|
var t, n, r;
|
|
2804
2804
|
const i = (t = e.$) === null || t === void 0 ? void 0 : t.offset, s = (n = e.$) === null || n === void 0 ? void 0 : n.before, o = (r = e.$) === null || r === void 0 ? void 0 : r.after;
|
|
2805
2805
|
return !i && !s && !o;
|
|
2806
2806
|
}
|
|
2807
2807
|
function ho(e, { etype: t, level: n, form: r, join: i, pageInfo: s }) {
|
|
2808
2808
|
var o, u, a, d, c;
|
|
2809
|
-
if (
|
|
2809
|
+
if (!$r(r) && (!s || !s["start-cursor"]))
|
|
2810
2810
|
return [];
|
|
2811
|
-
const f = Ys(eo(e, t, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), h = to(
|
|
2811
|
+
const f = Ys(eo(e, t, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), h = to(pt, t, n), p = (u = r.$) === null || u === void 0 ? void 0 : u.fields, b = fo(e, {
|
|
2812
2812
|
etype: t,
|
|
2813
2813
|
pageInfo: s,
|
|
2814
2814
|
form: r,
|
|
@@ -2829,9 +2829,9 @@ function po(e, t) {
|
|
|
2829
2829
|
throw n;
|
|
2830
2830
|
}
|
|
2831
2831
|
}
|
|
2832
|
-
function
|
|
2832
|
+
function Dr(e, t) {
|
|
2833
2833
|
const n = po(e, t);
|
|
2834
|
-
return ro(
|
|
2834
|
+
return ro(pt, e, t, n);
|
|
2835
2835
|
}
|
|
2836
2836
|
function yo(e) {
|
|
2837
2837
|
const t = {};
|
|
@@ -2846,7 +2846,7 @@ function yo(e) {
|
|
|
2846
2846
|
}
|
|
2847
2847
|
function bo({ store: e, pageInfo: t, aggregate: n }, r) {
|
|
2848
2848
|
const s = { data: Object.keys(r).reduce(function(u, a) {
|
|
2849
|
-
return n != null && n[a] || a === "$$ruleParams" || (u[a] =
|
|
2849
|
+
return n != null && n[a] || a === "$$ruleParams" || (u[a] = Dr(e, {
|
|
2850
2850
|
etype: a,
|
|
2851
2851
|
form: r[a],
|
|
2852
2852
|
level: 0,
|
|
@@ -2870,7 +2870,7 @@ function _o() {
|
|
|
2870
2870
|
return new Set(Object.keys(t));
|
|
2871
2871
|
}
|
|
2872
2872
|
const go = _o();
|
|
2873
|
-
function
|
|
2873
|
+
function Kt(e, t, n) {
|
|
2874
2874
|
const r = {
|
|
2875
2875
|
__etype: e,
|
|
2876
2876
|
__ops: n
|
|
@@ -2882,17 +2882,17 @@ function Yt(e, t, n) {
|
|
|
2882
2882
|
if (s === "__etype")
|
|
2883
2883
|
return e;
|
|
2884
2884
|
if (go.has(s))
|
|
2885
|
-
return (o, u) =>
|
|
2885
|
+
return (o, u) => Kt(e, t, [
|
|
2886
2886
|
...n,
|
|
2887
2887
|
u ? [s, e, t, o, u] : [s, e, t, o]
|
|
2888
2888
|
]);
|
|
2889
2889
|
}
|
|
2890
2890
|
});
|
|
2891
2891
|
}
|
|
2892
|
-
function
|
|
2892
|
+
function ft(e) {
|
|
2893
2893
|
return e.startsWith("lookup__");
|
|
2894
2894
|
}
|
|
2895
|
-
function
|
|
2895
|
+
function xr(e) {
|
|
2896
2896
|
const [t, n, ...r] = e.split("__");
|
|
2897
2897
|
return [n, JSON.parse(r.join("__"))];
|
|
2898
2898
|
}
|
|
@@ -2904,18 +2904,18 @@ function To(e) {
|
|
|
2904
2904
|
if (n === "__etype")
|
|
2905
2905
|
return e;
|
|
2906
2906
|
const r = n;
|
|
2907
|
-
return
|
|
2907
|
+
return ft(r) ? Kt(e, xr(r), []) : Kt(e, r, []);
|
|
2908
2908
|
}
|
|
2909
2909
|
});
|
|
2910
2910
|
}
|
|
2911
|
-
function
|
|
2911
|
+
function fn() {
|
|
2912
2912
|
return new Proxy({}, {
|
|
2913
2913
|
get(e, t) {
|
|
2914
2914
|
return To(t);
|
|
2915
2915
|
}
|
|
2916
2916
|
});
|
|
2917
2917
|
}
|
|
2918
|
-
|
|
2918
|
+
fn();
|
|
2919
2919
|
function wo(e) {
|
|
2920
2920
|
return e.__ops;
|
|
2921
2921
|
}
|
|
@@ -2938,7 +2938,7 @@ function mo(e, t) {
|
|
|
2938
2938
|
}
|
|
2939
2939
|
return i;
|
|
2940
2940
|
}
|
|
2941
|
-
function
|
|
2941
|
+
function V(e, t, n) {
|
|
2942
2942
|
return Object.values(e).find((r) => {
|
|
2943
2943
|
const [i, s, o] = r["forward-identity"];
|
|
2944
2944
|
return s === t && o === n;
|
|
@@ -2961,30 +2961,30 @@ function So(e) {
|
|
|
2961
2961
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
2962
2962
|
return t[0];
|
|
2963
2963
|
}
|
|
2964
|
-
function
|
|
2964
|
+
function Bt(e, t, n) {
|
|
2965
2965
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2966
2966
|
// before assuming it's a ref lookup.
|
|
2967
|
-
!
|
|
2967
|
+
!V(e, t, n);
|
|
2968
2968
|
}
|
|
2969
|
-
function
|
|
2969
|
+
function Qt(e) {
|
|
2970
2970
|
const [t, n, ...r] = e.split(".");
|
|
2971
2971
|
if (r.length > 0 || n !== "id")
|
|
2972
2972
|
throw new Error(`${e} is not a valid lookup attribute.`);
|
|
2973
2973
|
return t;
|
|
2974
2974
|
}
|
|
2975
2975
|
function vo(e, t, n) {
|
|
2976
|
-
if (!
|
|
2977
|
-
return
|
|
2978
|
-
const r =
|
|
2976
|
+
if (!Bt(e, t, n))
|
|
2977
|
+
return V(e, t, n);
|
|
2978
|
+
const r = Qt(n), i = V(e, t, r) || Te(e, t, r);
|
|
2979
2979
|
if (i && i["value-type"] !== "ref")
|
|
2980
2980
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
2981
2981
|
return i;
|
|
2982
2982
|
}
|
|
2983
|
-
function
|
|
2984
|
-
return typeof e == "string" && !
|
|
2983
|
+
function Gt(e) {
|
|
2984
|
+
return typeof e == "string" && !ft(e) ? null : typeof e == "string" && ft(e) ? xr(e) : So(e);
|
|
2985
2985
|
}
|
|
2986
2986
|
function J(e, t, n) {
|
|
2987
|
-
const r =
|
|
2987
|
+
const r = Gt(n);
|
|
2988
2988
|
if (r === null)
|
|
2989
2989
|
return n;
|
|
2990
2990
|
const [i, s] = r, o = vo(e, t, i);
|
|
@@ -2992,18 +2992,18 @@ function J(e, t, n) {
|
|
|
2992
2992
|
throw new Error(`${i} is not a unique attribute.`);
|
|
2993
2993
|
return [o.id, s];
|
|
2994
2994
|
}
|
|
2995
|
-
function
|
|
2995
|
+
function Ur(e, t, n, r) {
|
|
2996
2996
|
const i = J(e, t, n);
|
|
2997
2997
|
return Array.isArray(i) ? [[
|
|
2998
2998
|
"add-triple",
|
|
2999
2999
|
i,
|
|
3000
|
-
|
|
3000
|
+
V(e, t, "id").id,
|
|
3001
3001
|
i
|
|
3002
3002
|
]].concat(r) : r;
|
|
3003
3003
|
}
|
|
3004
3004
|
function Oo({ attrs: e }, [t, n, r]) {
|
|
3005
3005
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3006
|
-
const u = Array.isArray(o) ? o : [o], a =
|
|
3006
|
+
const u = Array.isArray(o) ? o : [o], a = V(e, t, s), d = Te(e, t, s);
|
|
3007
3007
|
return u.map((c) => a ? [
|
|
3008
3008
|
"add-triple",
|
|
3009
3009
|
J(e, t, n),
|
|
@@ -3016,11 +3016,11 @@ function Oo({ attrs: e }, [t, n, r]) {
|
|
|
3016
3016
|
J(e, t, n)
|
|
3017
3017
|
]);
|
|
3018
3018
|
});
|
|
3019
|
-
return
|
|
3019
|
+
return Ur(e, t, n, i);
|
|
3020
3020
|
}
|
|
3021
3021
|
function Eo({ attrs: e }, [t, n, r]) {
|
|
3022
3022
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3023
|
-
const u = Array.isArray(o) ? o : [o], a =
|
|
3023
|
+
const u = Array.isArray(o) ? o : [o], a = V(e, t, s), d = Te(e, t, s);
|
|
3024
3024
|
return u.map((c) => a ? [
|
|
3025
3025
|
"retract-triple",
|
|
3026
3026
|
J(e, t, n),
|
|
@@ -3033,7 +3033,7 @@ function Eo({ attrs: e }, [t, n, r]) {
|
|
|
3033
3033
|
J(e, t, n)
|
|
3034
3034
|
]);
|
|
3035
3035
|
});
|
|
3036
|
-
return
|
|
3036
|
+
return Ur(e, t, n, i);
|
|
3037
3037
|
}
|
|
3038
3038
|
function Ao(e, t, n) {
|
|
3039
3039
|
if (Array.isArray(n)) {
|
|
@@ -3057,21 +3057,21 @@ function Ao(e, t, n) {
|
|
|
3057
3057
|
}
|
|
3058
3058
|
return !1;
|
|
3059
3059
|
}
|
|
3060
|
-
function
|
|
3060
|
+
function Lr({ stores: e, attrs: t }, [n, r, i, s]) {
|
|
3061
3061
|
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : Ao(e, n, r) ? { mode: "update" } : null;
|
|
3062
3062
|
}
|
|
3063
3063
|
function Co(e, t) {
|
|
3064
|
-
const { stores: n, attrs: r } = e, [i, s, o, u] = t, a =
|
|
3064
|
+
const { stores: n, attrs: r } = e, [i, s, o, u] = t, a = on(o), d = J(r, i, s);
|
|
3065
3065
|
return [["id", d]].concat(Object.entries(a)).map(([f, h]) => {
|
|
3066
|
-
const p =
|
|
3067
|
-
return p["checked-data-type"] === "date" && e.useDateObjects && (h =
|
|
3066
|
+
const p = V(r, i, f);
|
|
3067
|
+
return p["checked-data-type"] === "date" && e.useDateObjects && (h = lt(h)), ["add-triple", d, p.id, h, { mode: "create" }];
|
|
3068
3068
|
});
|
|
3069
3069
|
}
|
|
3070
3070
|
function jo(e, t) {
|
|
3071
|
-
const { stores: n, attrs: r } = e, [i, s, o, u] = t, a =
|
|
3071
|
+
const { stores: n, attrs: r } = e, [i, s, o, u] = t, a = on(o), d = J(r, i, s), c = Lr(e, [i, d, o, u]);
|
|
3072
3072
|
return [["id", d]].concat(Object.entries(a)).map(([h, p]) => {
|
|
3073
|
-
const b =
|
|
3074
|
-
return b["checked-data-type"] === "date" && e.useDateObjects && (p =
|
|
3073
|
+
const b = V(r, i, h);
|
|
3074
|
+
return b["checked-data-type"] === "date" && e.useDateObjects && (p = lt(p)), [
|
|
3075
3075
|
"add-triple",
|
|
3076
3076
|
d,
|
|
3077
3077
|
b.id,
|
|
@@ -3084,8 +3084,8 @@ function Po({ attrs: e }, [t, n]) {
|
|
|
3084
3084
|
return [["delete-entity", J(e, t, n), t]];
|
|
3085
3085
|
}
|
|
3086
3086
|
function ko(e, t) {
|
|
3087
|
-
const { stores: n, attrs: r } = e, [i, s, o, u] = t, a =
|
|
3088
|
-
const g =
|
|
3087
|
+
const { stores: n, attrs: r } = e, [i, s, o, u] = t, a = on(o), d = J(r, i, s), c = Lr(e, [i, d, o, u]), f = Object.entries(a).map(([p, b]) => {
|
|
3088
|
+
const g = V(r, i, p);
|
|
3089
3089
|
return [
|
|
3090
3090
|
"deep-merge-triple",
|
|
3091
3091
|
d,
|
|
@@ -3097,7 +3097,7 @@ function ko(e, t) {
|
|
|
3097
3097
|
return [[
|
|
3098
3098
|
"add-triple",
|
|
3099
3099
|
d,
|
|
3100
|
-
|
|
3100
|
+
V(r, i, "id").id,
|
|
3101
3101
|
d,
|
|
3102
3102
|
...c ? [c] : []
|
|
3103
3103
|
]].concat(f);
|
|
@@ -3158,8 +3158,8 @@ function Do(e, t, n) {
|
|
|
3158
3158
|
"checked-data-type": a
|
|
3159
3159
|
};
|
|
3160
3160
|
}
|
|
3161
|
-
function
|
|
3162
|
-
const i = e ? Do(e, t, n) : null, s =
|
|
3161
|
+
function nt(e, t, n, r) {
|
|
3162
|
+
const i = e ? Do(e, t, n) : null, s = q(), u = [q(), t, n];
|
|
3163
3163
|
return Object.assign(Object.assign({ id: s, "forward-identity": u, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
3164
3164
|
}
|
|
3165
3165
|
function xo(e, t, n) {
|
|
@@ -3171,16 +3171,16 @@ function Uo(e, t, n) {
|
|
|
3171
3171
|
throw new Error(`Couldn't find the link ${t}.${n} in your schema`);
|
|
3172
3172
|
const { forward: i, reverse: s } = r;
|
|
3173
3173
|
return {
|
|
3174
|
-
"forward-identity": [
|
|
3175
|
-
"reverse-identity": [
|
|
3174
|
+
"forward-identity": [q(), i.on, i.label],
|
|
3175
|
+
"reverse-identity": [q(), s.on, s.label],
|
|
3176
3176
|
cardinality: i.has === "one" ? "one" : "many",
|
|
3177
3177
|
"unique?": s.has === "one",
|
|
3178
3178
|
"on-delete": i.onDelete,
|
|
3179
3179
|
"on-delete-reverse": s.onDelete
|
|
3180
3180
|
};
|
|
3181
3181
|
}
|
|
3182
|
-
function
|
|
3183
|
-
const i = e ? Uo(e, t, n) : null, s =
|
|
3182
|
+
function Qn(e, t, n, r) {
|
|
3183
|
+
const i = e ? Uo(e, t, n) : null, s = q(), o = [q(), t, n], u = [q(), n, t];
|
|
3184
3184
|
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 || {});
|
|
3185
3185
|
}
|
|
3186
3186
|
const Lo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Fo = /* @__PURE__ */ new Set(["link", "unlink"]), No = /* @__PURE__ */ new Set(["create", "update", "merge"]), Vo = /* @__PURE__ */ new Set([
|
|
@@ -3191,17 +3191,17 @@ const Lo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
3191
3191
|
"merge",
|
|
3192
3192
|
"delete",
|
|
3193
3193
|
"ruleParams"
|
|
3194
|
-
]),
|
|
3194
|
+
]), Yt = { "unique?": !0, "index?": !0 }, qo = Object.assign(Object.assign({}, Yt), { cardinality: "one" });
|
|
3195
3195
|
function Wo(e) {
|
|
3196
3196
|
const t = [], [n, r, i, s] = e;
|
|
3197
3197
|
if (!Vo.has(n))
|
|
3198
3198
|
return t;
|
|
3199
|
-
const o =
|
|
3199
|
+
const o = Gt(i);
|
|
3200
3200
|
if (o && t.push({ etype: r, lookupPair: o }), n === "link")
|
|
3201
3201
|
for (const [u, a] of Object.entries(s)) {
|
|
3202
3202
|
const d = Array.isArray(a) ? a : [a];
|
|
3203
3203
|
for (const c of d) {
|
|
3204
|
-
const f =
|
|
3204
|
+
const f = Gt(c);
|
|
3205
3205
|
f && t.push({
|
|
3206
3206
|
etype: r,
|
|
3207
3207
|
lookupPair: f,
|
|
@@ -3221,40 +3221,40 @@ function zo({ attrs: e, schema: t }, n) {
|
|
|
3221
3221
|
f != null && f.isUnsynced && !s.has(f.id) && (u.push(["add-attr", f]), s.add(f.id));
|
|
3222
3222
|
}
|
|
3223
3223
|
function c(f, h) {
|
|
3224
|
-
const p =
|
|
3225
|
-
d(p), d(b), !p && !b && a(
|
|
3224
|
+
const p = V(o, f, h), b = Te(o, f, h);
|
|
3225
|
+
d(p), d(b), !p && !b && a(Qn(t, f, h, qo));
|
|
3226
3226
|
}
|
|
3227
3227
|
for (const f of n)
|
|
3228
3228
|
for (const { etype: h, lookupPair: p, linkLabel: b } of Wo(f)) {
|
|
3229
3229
|
const g = p[0];
|
|
3230
3230
|
if (b) {
|
|
3231
3231
|
c(h, b);
|
|
3232
|
-
const w =
|
|
3232
|
+
const w = V(o, h, b), T = Te(o, h, b);
|
|
3233
3233
|
d(w), d(T);
|
|
3234
3234
|
const m = ((r = w == null ? void 0 : w["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = T == null ? void 0 : T["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || b;
|
|
3235
|
-
if (
|
|
3236
|
-
c(m,
|
|
3235
|
+
if (Bt(o, m, g))
|
|
3236
|
+
c(m, Qt(g));
|
|
3237
3237
|
else {
|
|
3238
|
-
const S =
|
|
3239
|
-
S || a(
|
|
3238
|
+
const S = V(o, m, g);
|
|
3239
|
+
S || a(nt(t, m, g, Yt)), d(S);
|
|
3240
3240
|
}
|
|
3241
|
-
} else if (
|
|
3242
|
-
c(h,
|
|
3241
|
+
} else if (Bt(o, h, g))
|
|
3242
|
+
c(h, Qt(g));
|
|
3243
3243
|
else {
|
|
3244
|
-
const w =
|
|
3245
|
-
w || a(
|
|
3244
|
+
const w = V(o, h, g);
|
|
3245
|
+
w || a(nt(t, h, g, Yt)), d(w);
|
|
3246
3246
|
}
|
|
3247
3247
|
}
|
|
3248
3248
|
for (const f of n) {
|
|
3249
3249
|
const [h, p, b, g] = f;
|
|
3250
3250
|
if (Lo.has(h)) {
|
|
3251
|
-
const w =
|
|
3252
|
-
d(w), w || a(
|
|
3251
|
+
const w = V(o, p, "id");
|
|
3252
|
+
d(w), w || a(nt(t, p, "id", { "unique?": !0 }));
|
|
3253
3253
|
for (const T of Object.keys(g)) {
|
|
3254
|
-
const m =
|
|
3255
|
-
if (d(m), No.has(h) && (m || a(
|
|
3254
|
+
const m = V(o, p, T);
|
|
3255
|
+
if (d(m), No.has(h) && (m || a(nt(t, p, T, T === "id" ? { "unique?": !0 } : null))), Fo.has(h)) {
|
|
3256
3256
|
const S = Te(o, p, T);
|
|
3257
|
-
!m && !S && a(
|
|
3257
|
+
!m && !S && a(Qn(t, p, T)), d(S);
|
|
3258
3258
|
}
|
|
3259
3259
|
}
|
|
3260
3260
|
}
|
|
@@ -3265,7 +3265,7 @@ function Ko(e, t) {
|
|
|
3265
3265
|
const r = (Array.isArray(t) ? t : [t]).flatMap((a) => wo(a)), [i, s] = zo(e, r), o = Object.assign(Object.assign({}, e), { attrs: i }), u = r.flatMap((a) => Ro(o, a));
|
|
3266
3266
|
return [...s, ...u];
|
|
3267
3267
|
}
|
|
3268
|
-
var
|
|
3268
|
+
var Gn = function(e, t, n, r) {
|
|
3269
3269
|
function i(s) {
|
|
3270
3270
|
return s instanceof n ? s : new n(function(o) {
|
|
3271
3271
|
o(s);
|
|
@@ -3292,7 +3292,7 @@ var Yn = function(e, t, n, r) {
|
|
|
3292
3292
|
d((r = r.apply(e, t || [])).next());
|
|
3293
3293
|
});
|
|
3294
3294
|
};
|
|
3295
|
-
class
|
|
3295
|
+
class Fr {
|
|
3296
3296
|
constructor(t) {
|
|
3297
3297
|
this.dbName = t, this._storeName = "kv", this._dbPromise = this._init();
|
|
3298
3298
|
}
|
|
@@ -3310,7 +3310,7 @@ class Nr {
|
|
|
3310
3310
|
});
|
|
3311
3311
|
}
|
|
3312
3312
|
getItem(t) {
|
|
3313
|
-
return
|
|
3313
|
+
return Gn(this, void 0, void 0, function* () {
|
|
3314
3314
|
const n = yield this._dbPromise;
|
|
3315
3315
|
return new Promise((r, i) => {
|
|
3316
3316
|
const u = n.transaction([this._storeName], "readonly").objectStore(this._storeName).get(t);
|
|
@@ -3323,7 +3323,7 @@ class Nr {
|
|
|
3323
3323
|
});
|
|
3324
3324
|
}
|
|
3325
3325
|
setItem(t, n) {
|
|
3326
|
-
return
|
|
3326
|
+
return Gn(this, void 0, void 0, function* () {
|
|
3327
3327
|
const r = yield this._dbPromise;
|
|
3328
3328
|
return new Promise((i, s) => {
|
|
3329
3329
|
const a = r.transaction([this._storeName], "readwrite").objectStore(this._storeName).put(n, t);
|
|
@@ -3363,7 +3363,7 @@ var Bo = function(e, t, n, r) {
|
|
|
3363
3363
|
d((r = r.apply(e, t || [])).next());
|
|
3364
3364
|
});
|
|
3365
3365
|
};
|
|
3366
|
-
class
|
|
3366
|
+
class Nr {
|
|
3367
3367
|
static getIsOnline() {
|
|
3368
3368
|
return Bo(this, void 0, void 0, function* () {
|
|
3369
3369
|
return navigator.onLine;
|
|
@@ -3417,22 +3417,22 @@ var Qo = function(e, t, n, r) {
|
|
|
3417
3417
|
d((r = r.apply(e, t || [])).next());
|
|
3418
3418
|
});
|
|
3419
3419
|
};
|
|
3420
|
-
class
|
|
3420
|
+
class yt extends ke {
|
|
3421
3421
|
constructor(t) {
|
|
3422
3422
|
var n;
|
|
3423
3423
|
const r = ((n = t.body) === null || n === void 0 ? void 0 : n.message) || `API Error (${t.status})`;
|
|
3424
3424
|
super(r, t.body.hint);
|
|
3425
3425
|
const i = new.target.prototype;
|
|
3426
|
-
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
3426
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, yt), this.name = "InstantAPIError", this.status = t.status, this.body = t.body;
|
|
3427
3427
|
}
|
|
3428
3428
|
get [Symbol.toStringTag]() {
|
|
3429
3429
|
return "InstantAPIError";
|
|
3430
3430
|
}
|
|
3431
3431
|
}
|
|
3432
|
-
function
|
|
3432
|
+
function se(e, t) {
|
|
3433
3433
|
return Qo(this, void 0, void 0, function* () {
|
|
3434
3434
|
const n = yield fetch(e, t), r = yield n.json();
|
|
3435
|
-
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new
|
|
3435
|
+
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new yt({ status: n.status, body: r }));
|
|
3436
3436
|
});
|
|
3437
3437
|
}
|
|
3438
3438
|
var Me = function(e, t, n, r) {
|
|
@@ -3463,7 +3463,7 @@ var Me = function(e, t, n, r) {
|
|
|
3463
3463
|
});
|
|
3464
3464
|
};
|
|
3465
3465
|
function Go({ apiURI: e, appId: t, email: n }) {
|
|
3466
|
-
return
|
|
3466
|
+
return se(`${e}/runtime/auth/send_magic_code`, {
|
|
3467
3467
|
method: "POST",
|
|
3468
3468
|
headers: { "content-type": "application/json" },
|
|
3469
3469
|
body: JSON.stringify({ "app-id": t, email: n })
|
|
@@ -3471,7 +3471,7 @@ function Go({ apiURI: e, appId: t, email: n }) {
|
|
|
3471
3471
|
}
|
|
3472
3472
|
function Yo(e) {
|
|
3473
3473
|
return Me(this, arguments, void 0, function* ({ apiURI: t, appId: n, email: r, code: i, refreshToken: s }) {
|
|
3474
|
-
return yield
|
|
3474
|
+
return yield se(`${t}/runtime/auth/verify_magic_code`, {
|
|
3475
3475
|
method: "POST",
|
|
3476
3476
|
headers: { "content-type": "application/json" },
|
|
3477
3477
|
body: JSON.stringify(Object.assign({
|
|
@@ -3484,7 +3484,7 @@ function Yo(e) {
|
|
|
3484
3484
|
}
|
|
3485
3485
|
function Ho(e) {
|
|
3486
3486
|
return Me(this, arguments, void 0, function* ({ apiURI: t, appId: n, refreshToken: r }) {
|
|
3487
|
-
return yield
|
|
3487
|
+
return yield se(`${t}/runtime/auth/verify_refresh_token`, {
|
|
3488
3488
|
method: "POST",
|
|
3489
3489
|
headers: { "content-type": "application/json" },
|
|
3490
3490
|
body: JSON.stringify({
|
|
@@ -3496,7 +3496,7 @@ function Ho(e) {
|
|
|
3496
3496
|
}
|
|
3497
3497
|
function Jo(e) {
|
|
3498
3498
|
return Me(this, arguments, void 0, function* ({ apiURI: t, appId: n }) {
|
|
3499
|
-
return yield
|
|
3499
|
+
return yield se(`${t}/runtime/auth/sign_in_guest`, {
|
|
3500
3500
|
method: "POST",
|
|
3501
3501
|
headers: { "content-type": "application/json" },
|
|
3502
3502
|
body: JSON.stringify({
|
|
@@ -3505,9 +3505,9 @@ function Jo(e) {
|
|
|
3505
3505
|
});
|
|
3506
3506
|
});
|
|
3507
3507
|
}
|
|
3508
|
-
function
|
|
3508
|
+
function Yn(e) {
|
|
3509
3509
|
return Me(this, arguments, void 0, function* ({ apiURI: t, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
3510
|
-
return yield
|
|
3510
|
+
return yield se(`${t}/runtime/oauth/token`, {
|
|
3511
3511
|
method: "POST",
|
|
3512
3512
|
headers: { "content-type": "application/json" },
|
|
3513
3513
|
body: JSON.stringify({
|
|
@@ -3521,7 +3521,7 @@ function Hn(e) {
|
|
|
3521
3521
|
}
|
|
3522
3522
|
function Zo(e) {
|
|
3523
3523
|
return Me(this, arguments, void 0, function* ({ apiURI: t, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
|
|
3524
|
-
return yield
|
|
3524
|
+
return yield se(`${t}/runtime/oauth/id_token`, {
|
|
3525
3525
|
method: "POST",
|
|
3526
3526
|
headers: { "content-type": "application/json" },
|
|
3527
3527
|
body: JSON.stringify({
|
|
@@ -3536,7 +3536,7 @@ function Zo(e) {
|
|
|
3536
3536
|
}
|
|
3537
3537
|
function Xo(e) {
|
|
3538
3538
|
return Me(this, arguments, void 0, function* ({ apiURI: t, appId: n, refreshToken: r }) {
|
|
3539
|
-
return yield
|
|
3539
|
+
return yield se(`${t}/runtime/signout`, {
|
|
3540
3540
|
method: "POST",
|
|
3541
3541
|
headers: {
|
|
3542
3542
|
"content-type": "application/json"
|
|
@@ -3548,7 +3548,7 @@ function Xo(e) {
|
|
|
3548
3548
|
});
|
|
3549
3549
|
});
|
|
3550
3550
|
}
|
|
3551
|
-
var
|
|
3551
|
+
var ze = function(e, t, n, r) {
|
|
3552
3552
|
function i(s) {
|
|
3553
3553
|
return s instanceof n ? s : new n(function(o) {
|
|
3554
3554
|
o(s);
|
|
@@ -3576,14 +3576,14 @@ var Ke = function(e, t, n, r) {
|
|
|
3576
3576
|
});
|
|
3577
3577
|
};
|
|
3578
3578
|
function eu(e) {
|
|
3579
|
-
return
|
|
3579
|
+
return ze(this, arguments, void 0, function* ({ apiURI: t, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: u }) {
|
|
3580
3580
|
const a = {
|
|
3581
3581
|
app_id: n,
|
|
3582
3582
|
path: r,
|
|
3583
3583
|
authorization: `Bearer ${s}`,
|
|
3584
3584
|
"content-type": o || i.type
|
|
3585
3585
|
};
|
|
3586
|
-
return u && (a["content-disposition"] = u), yield
|
|
3586
|
+
return u && (a["content-disposition"] = u), yield se(`${t}/storage/upload`, {
|
|
3587
3587
|
method: "PUT",
|
|
3588
3588
|
headers: a,
|
|
3589
3589
|
body: i
|
|
@@ -3591,8 +3591,8 @@ function eu(e) {
|
|
|
3591
3591
|
});
|
|
3592
3592
|
}
|
|
3593
3593
|
function tu(e) {
|
|
3594
|
-
return
|
|
3595
|
-
const { data: s } = yield
|
|
3594
|
+
return ze(this, arguments, void 0, function* ({ apiURI: t, appId: n, path: r, refreshToken: i }) {
|
|
3595
|
+
const { data: s } = yield se(`${t}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3596
3596
|
method: "DELETE",
|
|
3597
3597
|
headers: {
|
|
3598
3598
|
"content-type": "application/json",
|
|
@@ -3603,8 +3603,8 @@ function tu(e) {
|
|
|
3603
3603
|
});
|
|
3604
3604
|
}
|
|
3605
3605
|
function nu(e) {
|
|
3606
|
-
return
|
|
3607
|
-
const { data: o } = yield
|
|
3606
|
+
return ze(this, arguments, void 0, function* ({ apiURI: t, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
|
|
3607
|
+
const { data: o } = yield se(`${t}/storage/signed-upload-url`, {
|
|
3608
3608
|
method: "POST",
|
|
3609
3609
|
headers: {
|
|
3610
3610
|
"content-type": "application/json",
|
|
@@ -3619,7 +3619,7 @@ function nu(e) {
|
|
|
3619
3619
|
});
|
|
3620
3620
|
}
|
|
3621
3621
|
function ru(e, t) {
|
|
3622
|
-
return
|
|
3622
|
+
return ze(this, void 0, void 0, function* () {
|
|
3623
3623
|
return (yield fetch(e, {
|
|
3624
3624
|
method: "PUT",
|
|
3625
3625
|
body: t,
|
|
@@ -3630,8 +3630,8 @@ function ru(e, t) {
|
|
|
3630
3630
|
});
|
|
3631
3631
|
}
|
|
3632
3632
|
function iu(e) {
|
|
3633
|
-
return
|
|
3634
|
-
const { data: s } = yield
|
|
3633
|
+
return ze(this, arguments, void 0, function* ({ apiURI: t, appId: n, path: r, refreshToken: i }) {
|
|
3634
|
+
const { data: s } = yield se(`${t}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3635
3635
|
method: "GET",
|
|
3636
3636
|
headers: {
|
|
3637
3637
|
"content-type": "application/json",
|
|
@@ -3641,9 +3641,9 @@ function iu(e) {
|
|
|
3641
3641
|
return s;
|
|
3642
3642
|
});
|
|
3643
3643
|
}
|
|
3644
|
-
let
|
|
3645
|
-
typeof window < "u" && typeof window.localStorage < "u" && (
|
|
3646
|
-
function
|
|
3644
|
+
let ln = !1, Vr = !1, qr = !1;
|
|
3645
|
+
typeof window < "u" && typeof window.localStorage < "u" && (ln = !!window.localStorage.getItem("devBackend"), Vr = !!window.localStorage.getItem("__instantLogging"), qr = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
3646
|
+
function Hn(e, t) {
|
|
3647
3647
|
if (!t)
|
|
3648
3648
|
return e;
|
|
3649
3649
|
const n = {};
|
|
@@ -3657,27 +3657,27 @@ function su(e, t, n) {
|
|
|
3657
3657
|
peers: {}
|
|
3658
3658
|
};
|
|
3659
3659
|
if (t && "user" in t ? t.user : !0) {
|
|
3660
|
-
const u =
|
|
3660
|
+
const u = Hn((r = e.user) !== null && r !== void 0 ? r : {}, t == null ? void 0 : t.keys);
|
|
3661
3661
|
s.user = Object.assign(Object.assign({}, u), { peerId: n });
|
|
3662
3662
|
}
|
|
3663
3663
|
for (const u of Object.keys((i = e.peers) !== null && i !== void 0 ? i : {})) {
|
|
3664
3664
|
const a = (t == null ? void 0 : t.peers) === void 0, d = Array.isArray(t == null ? void 0 : t.peers) && (t == null ? void 0 : t.peers.includes(u));
|
|
3665
3665
|
if (a || d) {
|
|
3666
|
-
const c =
|
|
3666
|
+
const c = Hn(e.peers[u], t == null ? void 0 : t.keys);
|
|
3667
3667
|
s.peers[u] = Object.assign(Object.assign({}, c), { peerId: u });
|
|
3668
3668
|
}
|
|
3669
3669
|
}
|
|
3670
3670
|
return s;
|
|
3671
3671
|
}
|
|
3672
3672
|
function ou(e, t) {
|
|
3673
|
-
if (e.isLoading !== t.isLoading || e.error !== t.error || (e.user || t.user) && (!e.user || !t.user || !
|
|
3673
|
+
if (e.isLoading !== t.isLoading || e.error !== t.error || (e.user || t.user) && (!e.user || !t.user || !Un(e.user, t.user)) || !mr(e.peers, t.peers))
|
|
3674
3674
|
return !0;
|
|
3675
3675
|
for (const r of Object.keys(e.peers))
|
|
3676
|
-
if (!
|
|
3676
|
+
if (!Un(e.peers[r], t.peers[r]))
|
|
3677
3677
|
return !0;
|
|
3678
3678
|
return !1;
|
|
3679
3679
|
}
|
|
3680
|
-
class
|
|
3680
|
+
class Jn {
|
|
3681
3681
|
constructor() {
|
|
3682
3682
|
this.promise = new Promise((t, n) => {
|
|
3683
3683
|
this._resolve = t, this._reject = n;
|
|
@@ -3690,7 +3690,7 @@ class Zn {
|
|
|
3690
3690
|
this._reject(t);
|
|
3691
3691
|
}
|
|
3692
3692
|
}
|
|
3693
|
-
var
|
|
3693
|
+
var xe = function(e, t, n, r) {
|
|
3694
3694
|
function i(s) {
|
|
3695
3695
|
return s instanceof n ? s : new n(function(o) {
|
|
3696
3696
|
o(s);
|
|
@@ -3720,12 +3720,12 @@ var Ue = function(e, t, n, r) {
|
|
|
3720
3720
|
function uu(e, t) {
|
|
3721
3721
|
typeof requestIdleCallback > "u" ? e() : requestIdleCallback(e, { timeout: t });
|
|
3722
3722
|
}
|
|
3723
|
-
class
|
|
3723
|
+
class Zn {
|
|
3724
3724
|
constructor(t, n, r, i, s = (d) => d, o = (d) => d, u = 100, a = 1e3) {
|
|
3725
3725
|
this._subs = [], this._nextSave = null, this._persister = t, this._key = n, this._onMerge = i, this._loadedCbs = [], this._isLoading = !0, this.currentValue = r, this.serialize = s, this.parse = o, this._saveThrottleMs = u, this._pendingSaveCbs = [], this._version = 0, this._idleCallbackMaxWaitMs = a, this._load();
|
|
3726
3726
|
}
|
|
3727
3727
|
_getFromStorage() {
|
|
3728
|
-
return
|
|
3728
|
+
return xe(this, void 0, void 0, function* () {
|
|
3729
3729
|
try {
|
|
3730
3730
|
return this.parse(yield this._persister.getItem(this._key));
|
|
3731
3731
|
} catch (t) {
|
|
@@ -3734,7 +3734,7 @@ class Xn {
|
|
|
3734
3734
|
});
|
|
3735
3735
|
}
|
|
3736
3736
|
_load() {
|
|
3737
|
-
return
|
|
3737
|
+
return xe(this, void 0, void 0, function* () {
|
|
3738
3738
|
const t = yield this._getFromStorage();
|
|
3739
3739
|
this._isLoading = !1, this._onMerge(t, this.currentValue);
|
|
3740
3740
|
for (const n of this._loadedCbs)
|
|
@@ -3742,7 +3742,7 @@ class Xn {
|
|
|
3742
3742
|
});
|
|
3743
3743
|
}
|
|
3744
3744
|
waitForLoaded() {
|
|
3745
|
-
return
|
|
3745
|
+
return xe(this, void 0, void 0, function* () {
|
|
3746
3746
|
if (!this._isLoading)
|
|
3747
3747
|
return;
|
|
3748
3748
|
yield new Promise((n) => {
|
|
@@ -3757,7 +3757,7 @@ class Xn {
|
|
|
3757
3757
|
return this._version;
|
|
3758
3758
|
}
|
|
3759
3759
|
waitForSync() {
|
|
3760
|
-
return
|
|
3760
|
+
return xe(this, void 0, void 0, function* () {
|
|
3761
3761
|
if (!this._nextSave)
|
|
3762
3762
|
return;
|
|
3763
3763
|
yield new Promise((n) => {
|
|
@@ -3772,7 +3772,7 @@ class Xn {
|
|
|
3772
3772
|
this._pendingSaveCbs.length = 0;
|
|
3773
3773
|
}
|
|
3774
3774
|
flush() {
|
|
3775
|
-
return
|
|
3775
|
+
return xe(this, void 0, void 0, function* () {
|
|
3776
3776
|
this._nextSave && (clearTimeout(this._nextSave), this._writeToStorage());
|
|
3777
3777
|
});
|
|
3778
3778
|
}
|
|
@@ -3798,20 +3798,20 @@ class Xn {
|
|
|
3798
3798
|
};
|
|
3799
3799
|
}
|
|
3800
3800
|
}
|
|
3801
|
-
function
|
|
3801
|
+
function Wr(e, t = []) {
|
|
3802
3802
|
e.forEach((n) => {
|
|
3803
3803
|
const { data: r } = n, { "datalog-result": i } = r, { "join-rows": s } = i;
|
|
3804
3804
|
for (const o of s)
|
|
3805
3805
|
for (const u of o)
|
|
3806
3806
|
t.push(u);
|
|
3807
|
-
|
|
3807
|
+
Wr(n["child-nodes"], t);
|
|
3808
3808
|
});
|
|
3809
3809
|
}
|
|
3810
|
-
function
|
|
3810
|
+
function Xn(e) {
|
|
3811
3811
|
const t = [];
|
|
3812
|
-
return
|
|
3812
|
+
return Wr(e, t), t;
|
|
3813
3813
|
}
|
|
3814
|
-
function
|
|
3814
|
+
function er(e) {
|
|
3815
3815
|
return Object.values(e.links).reduce((t, n) => {
|
|
3816
3816
|
var r, i, s, o;
|
|
3817
3817
|
return (r = t[s = n.forward.on]) !== null && r !== void 0 || (t[s] = {}), t[n.forward.on][n.forward.label] = {
|
|
@@ -3825,7 +3825,7 @@ function tr(e) {
|
|
|
3825
3825
|
}, t;
|
|
3826
3826
|
}, {});
|
|
3827
3827
|
}
|
|
3828
|
-
const
|
|
3828
|
+
const zr = "v0.22.39";
|
|
3829
3829
|
function au(e, t) {
|
|
3830
3830
|
return {
|
|
3831
3831
|
info: e ? (...n) => console.info(...n, t()) : () => {
|
|
@@ -3836,7 +3836,7 @@ function au(e, t) {
|
|
|
3836
3836
|
}
|
|
3837
3837
|
};
|
|
3838
3838
|
}
|
|
3839
|
-
class
|
|
3839
|
+
class de {
|
|
3840
3840
|
constructor(t, n, r, i = { indexed: !1, unique: !1 }) {
|
|
3841
3841
|
this.valueType = t, this.required = n, this.isIndexed = r, this.config = i, this.metadata = {};
|
|
3842
3842
|
}
|
|
@@ -3846,16 +3846,16 @@ class le {
|
|
|
3846
3846
|
* and enforced for backend
|
|
3847
3847
|
*/
|
|
3848
3848
|
clientRequired() {
|
|
3849
|
-
return new
|
|
3849
|
+
return new de(this.valueType, !1, this.isIndexed, this.config);
|
|
3850
3850
|
}
|
|
3851
3851
|
optional() {
|
|
3852
|
-
return new
|
|
3852
|
+
return new de(this.valueType, !1, this.isIndexed, this.config);
|
|
3853
3853
|
}
|
|
3854
3854
|
unique() {
|
|
3855
|
-
return new
|
|
3855
|
+
return new de(this.valueType, this.required, this.isIndexed, Object.assign(Object.assign({}, this.config), { unique: !0 }));
|
|
3856
3856
|
}
|
|
3857
3857
|
indexed() {
|
|
3858
|
-
return new
|
|
3858
|
+
return new de(this.valueType, this.required, !0, Object.assign(Object.assign({}, this.config), { indexed: !0 }));
|
|
3859
3859
|
}
|
|
3860
3860
|
}
|
|
3861
3861
|
class I extends Error {
|
|
@@ -3864,7 +3864,7 @@ class I extends Error {
|
|
|
3864
3864
|
super(r), this.name = "QueryValidationError";
|
|
3865
3865
|
}
|
|
3866
3866
|
}
|
|
3867
|
-
const
|
|
3867
|
+
const tr = [
|
|
3868
3868
|
"where",
|
|
3869
3869
|
"order",
|
|
3870
3870
|
"limit",
|
|
@@ -3875,7 +3875,7 @@ const nr = [
|
|
|
3875
3875
|
"before",
|
|
3876
3876
|
"fields",
|
|
3877
3877
|
"aggregate"
|
|
3878
|
-
], cu = (e) => e.valueType || "unknown",
|
|
3878
|
+
], cu = (e) => e.valueType || "unknown", Kr = (e, t, n = !1) => {
|
|
3879
3879
|
if (n || e == null)
|
|
3880
3880
|
return !0;
|
|
3881
3881
|
switch (t) {
|
|
@@ -3892,7 +3892,7 @@ const nr = [
|
|
|
3892
3892
|
}
|
|
3893
3893
|
}, du = (e, t, n, r, i, s, o) => {
|
|
3894
3894
|
const u = s.valueType === "json", a = (d, c, f) => {
|
|
3895
|
-
if (!
|
|
3895
|
+
if (!Kr(f, c, u))
|
|
3896
3896
|
throw new I(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
|
|
3897
3897
|
};
|
|
3898
3898
|
switch (e) {
|
|
@@ -3930,7 +3930,7 @@ const nr = [
|
|
|
3930
3930
|
const a = e;
|
|
3931
3931
|
for (const [d, c] of Object.entries(a))
|
|
3932
3932
|
du(d, c, s, t, r, n, `${i}.${d}`);
|
|
3933
|
-
} else if (!
|
|
3933
|
+
} else if (!Kr(e, s, o))
|
|
3934
3934
|
throw new I(`Invalid value for attribute '${t}' in entity '${r}'. Expected ${s}, but received: ${typeof e}`, i);
|
|
3935
3935
|
}, fu = (e, t, n, r, i) => {
|
|
3936
3936
|
const s = e.split(".");
|
|
@@ -3954,14 +3954,14 @@ const nr = [
|
|
|
3954
3954
|
if (u === "id") {
|
|
3955
3955
|
if (typeof t == "string" && !je(t))
|
|
3956
3956
|
throw new I(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${t}`, i);
|
|
3957
|
-
Ae(t, e, new
|
|
3957
|
+
Ae(t, e, new de("string", !1, !0), n, i);
|
|
3958
3958
|
return;
|
|
3959
3959
|
}
|
|
3960
3960
|
const d = a.attrs[u];
|
|
3961
3961
|
if (Object.keys(a.links).includes(u)) {
|
|
3962
3962
|
if (typeof t == "string" && !je(t))
|
|
3963
3963
|
throw new I(`Invalid value for link '${u}' in entity '${o}'. Expected a UUID, but received: ${t}`, i);
|
|
3964
|
-
Ae(t, e, new
|
|
3964
|
+
Ae(t, e, new de("string", !1, !0), n, i);
|
|
3965
3965
|
return;
|
|
3966
3966
|
}
|
|
3967
3967
|
if (!d) {
|
|
@@ -3969,16 +3969,16 @@ const nr = [
|
|
|
3969
3969
|
throw new I(`Attribute '${u}' does not exist on entity '${o}' in dot notation path '${e}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
|
|
3970
3970
|
}
|
|
3971
3971
|
Ae(t, e, d, n, i);
|
|
3972
|
-
},
|
|
3972
|
+
}, Br = (e, t, n, r) => {
|
|
3973
3973
|
for (const [i, s] of Object.entries(e)) {
|
|
3974
3974
|
if (i === "or" || i === "and") {
|
|
3975
3975
|
if (Array.isArray(s))
|
|
3976
3976
|
for (const d of s)
|
|
3977
|
-
typeof d == "object" && d !== null &&
|
|
3977
|
+
typeof d == "object" && d !== null && Br(d, t, n, `${r}.${i}[${d}]`);
|
|
3978
3978
|
continue;
|
|
3979
3979
|
}
|
|
3980
3980
|
if (i === "id") {
|
|
3981
|
-
Ae(s, "id", new
|
|
3981
|
+
Ae(s, "id", new de("string", !1, !0), t, `${r}.id`);
|
|
3982
3982
|
continue;
|
|
3983
3983
|
}
|
|
3984
3984
|
if (i.includes(".")) {
|
|
@@ -3998,14 +3998,14 @@ const nr = [
|
|
|
3998
3998
|
else if (a) {
|
|
3999
3999
|
if (typeof s == "string" && !je(s))
|
|
4000
4000
|
throw new I(`Invalid value for link '${i}' in entity '${t}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
|
|
4001
|
-
const d = new
|
|
4001
|
+
const d = new de("string", !1, !0);
|
|
4002
4002
|
Ae(s, i, d, t, `${r}.${i}`);
|
|
4003
4003
|
}
|
|
4004
4004
|
}
|
|
4005
4005
|
}, lu = (e, t, n, r, i = 0) => {
|
|
4006
4006
|
for (const o of Object.keys(e))
|
|
4007
|
-
if (!
|
|
4008
|
-
throw new I(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${
|
|
4007
|
+
if (!tr.includes(o))
|
|
4008
|
+
throw new I(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${tr.join(", ")}. Found: ${o}`, r);
|
|
4009
4009
|
const s = [
|
|
4010
4010
|
"limit",
|
|
4011
4011
|
"offset",
|
|
@@ -4020,9 +4020,9 @@ const nr = [
|
|
|
4020
4020
|
if (e.where && n) {
|
|
4021
4021
|
if (typeof e.where != "object" || e.where === null)
|
|
4022
4022
|
throw new I(`'where' clause must be an object in entity '${t}', but received: ${typeof e.where}`, r ? `${r}.where` : void 0);
|
|
4023
|
-
|
|
4023
|
+
Br(e.where, t, n, r ? `${r}.where` : "where");
|
|
4024
4024
|
}
|
|
4025
|
-
},
|
|
4025
|
+
}, Qr = (e, t, n, r, i = 0) => {
|
|
4026
4026
|
var s;
|
|
4027
4027
|
if (!e || typeof e != "object")
|
|
4028
4028
|
throw new I(`Query part for entity '${t}' must be an object, but received: ${typeof e}`, r);
|
|
@@ -4035,7 +4035,7 @@ const nr = [
|
|
|
4035
4035
|
const u = e[o];
|
|
4036
4036
|
if (typeof u == "object" && u !== null) {
|
|
4037
4037
|
const a = (s = n == null ? void 0 : n.entities[t].links[o]) === null || s === void 0 ? void 0 : s.entityName;
|
|
4038
|
-
a &&
|
|
4038
|
+
a && Qr(u, a, n, `${r}.${o}`, i + 1);
|
|
4039
4039
|
}
|
|
4040
4040
|
} else {
|
|
4041
4041
|
const u = e[o];
|
|
@@ -4043,7 +4043,7 @@ const nr = [
|
|
|
4043
4043
|
throw new I(`Query parameter '$' must be an object in entity '${t}', but received: ${typeof u}`, `${r}.$`);
|
|
4044
4044
|
lu(u, t, n, `${r}.$`, i);
|
|
4045
4045
|
}
|
|
4046
|
-
},
|
|
4046
|
+
}, nr = (e, t) => {
|
|
4047
4047
|
if (typeof e != "object" || e === null)
|
|
4048
4048
|
throw new I(`Query must be an object, but received: ${typeof e}${e === null ? " (null)" : ""}`);
|
|
4049
4049
|
if (Array.isArray(e))
|
|
@@ -4059,16 +4059,16 @@ const nr = [
|
|
|
4059
4059
|
const i = Object.keys(t.entities);
|
|
4060
4060
|
throw new I(`Entity '${r}' does not exist in schema. Available entities: ${i.length > 0 ? i.join(", ") : "none"}`, r);
|
|
4061
4061
|
}
|
|
4062
|
-
|
|
4062
|
+
Qr(n[r], r, t, r, 0);
|
|
4063
4063
|
}
|
|
4064
4064
|
}
|
|
4065
|
-
},
|
|
4066
|
-
class
|
|
4065
|
+
}, rr = (e) => typeof e != "string" ? !1 : ft(e) ? !0 : je(e);
|
|
4066
|
+
class te extends Error {
|
|
4067
4067
|
constructor(t) {
|
|
4068
4068
|
super(t), this.name = "TransactionValidationError";
|
|
4069
4069
|
}
|
|
4070
4070
|
}
|
|
4071
|
-
const
|
|
4071
|
+
const Gr = (e) => e.length > 0 ? e.join(", ") : "none", hu = (e, t) => new te(`Entity '${e}' does not exist in schema. Available entities: ${Gr(t)}`), ir = {
|
|
4072
4072
|
string: (e) => typeof e == "string",
|
|
4073
4073
|
number: (e) => typeof e == "number" && !isNaN(e),
|
|
4074
4074
|
boolean: (e) => typeof e == "boolean",
|
|
@@ -4076,47 +4076,47 @@ const Yr = (e) => e.length > 0 ? e.join(", ") : "none", hu = (e, t) => new ne(`E
|
|
|
4076
4076
|
json: () => !0
|
|
4077
4077
|
}, pu = (e, t) => {
|
|
4078
4078
|
var n, r;
|
|
4079
|
-
return e == null ? !0 : (r = (n =
|
|
4080
|
-
},
|
|
4079
|
+
return e == null ? !0 : (r = (n = ir[t.valueType]) === null || n === void 0 ? void 0 : n.call(ir, e)) !== null && r !== void 0 ? r : !1;
|
|
4080
|
+
}, Yr = (e, t) => {
|
|
4081
4081
|
const n = t.entities[e];
|
|
4082
4082
|
if (!n)
|
|
4083
4083
|
throw hu(e, Object.keys(t.entities));
|
|
4084
4084
|
return n;
|
|
4085
|
-
},
|
|
4086
|
-
const r =
|
|
4085
|
+
}, At = (e, t, n) => {
|
|
4086
|
+
const r = Yr(e, n);
|
|
4087
4087
|
if (typeof t != "object" || t === null)
|
|
4088
|
-
throw new
|
|
4088
|
+
throw new te(`Arguments for data operation on entity '${e}' must be an object, but received: ${typeof t}`);
|
|
4089
4089
|
for (const [i, s] of Object.entries(t)) {
|
|
4090
4090
|
if (i === "id")
|
|
4091
4091
|
continue;
|
|
4092
4092
|
const o = r.attrs[i];
|
|
4093
4093
|
if (o && !pu(s, o))
|
|
4094
|
-
throw new
|
|
4094
|
+
throw new te(`Invalid value for attribute '${i}' in entity '${e}'. Expected ${o.valueType}, but received: ${typeof s}`);
|
|
4095
4095
|
}
|
|
4096
|
-
},
|
|
4097
|
-
const r =
|
|
4096
|
+
}, sr = (e, t, n) => {
|
|
4097
|
+
const r = Yr(e, n);
|
|
4098
4098
|
if (typeof t != "object" || t === null)
|
|
4099
|
-
throw new
|
|
4099
|
+
throw new te(`Arguments for link operation on entity '${e}' must be an object, but received: ${typeof t}`);
|
|
4100
4100
|
for (const [i, s] of Object.entries(t)) {
|
|
4101
4101
|
if (!r.links[i]) {
|
|
4102
4102
|
const u = Object.keys(r.links);
|
|
4103
|
-
throw new
|
|
4103
|
+
throw new te(`Link '${i}' does not exist on entity '${e}'. Available links: ${Gr(u)}`);
|
|
4104
4104
|
}
|
|
4105
4105
|
if (s != null) {
|
|
4106
4106
|
if (Array.isArray(s)) {
|
|
4107
4107
|
for (const u of s)
|
|
4108
|
-
if (!
|
|
4109
|
-
throw new
|
|
4110
|
-
} else if (!
|
|
4111
|
-
throw new
|
|
4108
|
+
if (!rr(u))
|
|
4109
|
+
throw new te(`Invalid entity ID in link '${i}' for entity '${e}'. Expected a UUID or a lookup, but received: ${u}`);
|
|
4110
|
+
} else if (!rr(s))
|
|
4111
|
+
throw new te(`Invalid UUID in link '${i}' for entity '${e}'. Expected a UUID, but received: ${s}`);
|
|
4112
4112
|
}
|
|
4113
4113
|
}
|
|
4114
4114
|
}, yu = {
|
|
4115
|
-
create:
|
|
4116
|
-
update:
|
|
4117
|
-
merge:
|
|
4118
|
-
link:
|
|
4119
|
-
unlink:
|
|
4115
|
+
create: At,
|
|
4116
|
+
update: At,
|
|
4117
|
+
merge: At,
|
|
4118
|
+
link: sr,
|
|
4119
|
+
unlink: sr,
|
|
4120
4120
|
delete: () => {
|
|
4121
4121
|
}
|
|
4122
4122
|
}, bu = (e, t) => {
|
|
@@ -4124,26 +4124,26 @@ const Yr = (e) => e.length > 0 ? e.join(", ") : "none", hu = (e, t) => new ne(`E
|
|
|
4124
4124
|
return;
|
|
4125
4125
|
const [n, r, i, s] = e;
|
|
4126
4126
|
if (!Array.isArray(i) && !je(i))
|
|
4127
|
-
throw new
|
|
4127
|
+
throw new te(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
|
|
4128
4128
|
if (typeof r != "string")
|
|
4129
|
-
throw new
|
|
4129
|
+
throw new te(`Entity name must be a string, but received: ${typeof r}`);
|
|
4130
4130
|
const o = yu[n];
|
|
4131
4131
|
o && s !== void 0 && o(r, s, t);
|
|
4132
4132
|
}, _u = (e, t) => {
|
|
4133
4133
|
const n = Array.isArray(e) ? e : [e];
|
|
4134
4134
|
for (const r of n) {
|
|
4135
4135
|
if (!r || typeof r != "object")
|
|
4136
|
-
throw new
|
|
4136
|
+
throw new te(`Transaction chunk must be an object, but received: ${typeof r}`);
|
|
4137
4137
|
if (!Array.isArray(r.__ops))
|
|
4138
|
-
throw new
|
|
4138
|
+
throw new te(`Transaction chunk must have __ops array, but received: ${typeof r.__ops}`);
|
|
4139
4139
|
for (const i of r.__ops) {
|
|
4140
4140
|
if (!Array.isArray(i))
|
|
4141
|
-
throw new
|
|
4141
|
+
throw new te(`Transaction operation must be an array, but received: ${typeof i}`);
|
|
4142
4142
|
bu(i, t);
|
|
4143
4143
|
}
|
|
4144
4144
|
}
|
|
4145
4145
|
};
|
|
4146
|
-
var
|
|
4146
|
+
var or = function(e, t, n, r) {
|
|
4147
4147
|
function i(s) {
|
|
4148
4148
|
return s instanceof n ? s : new n(function(o) {
|
|
4149
4149
|
o(s);
|
|
@@ -4170,10 +4170,10 @@ var ur = function(e, t, n, r) {
|
|
|
4170
4170
|
d((r = r.apply(e, t || [])).next());
|
|
4171
4171
|
});
|
|
4172
4172
|
};
|
|
4173
|
-
let
|
|
4174
|
-
class
|
|
4173
|
+
let Hr = 0;
|
|
4174
|
+
class ur {
|
|
4175
4175
|
constructor(t) {
|
|
4176
|
-
this.type = "ws", this.id = `${this.type}_${
|
|
4176
|
+
this.type = "ws", this.id = `${this.type}_${Hr++}`, this.conn = new WebSocket(t), this.conn.onopen = (n) => {
|
|
4177
4177
|
this.onopen && this.onopen({ target: this });
|
|
4178
4178
|
}, this.conn.onmessage = (n) => {
|
|
4179
4179
|
this.onmessage && this.onmessage({
|
|
@@ -4201,7 +4201,7 @@ class ar {
|
|
|
4201
4201
|
}
|
|
4202
4202
|
class gu {
|
|
4203
4203
|
constructor(t, n) {
|
|
4204
|
-
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = null, this.id = `${this.type}_${
|
|
4204
|
+
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = null, this.id = `${this.type}_${Hr++}`, this.url = n, this.ES = t, this.conn = new t(n), this.sseInitTimeout = setTimeout(() => {
|
|
4205
4205
|
this.initParams || this.handleError();
|
|
4206
4206
|
}, 1e4), this.conn.onmessage = (r) => {
|
|
4207
4207
|
const i = JSON.parse(r.data);
|
|
@@ -4233,7 +4233,7 @@ class gu {
|
|
|
4233
4233
|
this.conn.close(), this.onclose && !this.closeFired && (this.closeFired = !0, this.onclose({ target: this }));
|
|
4234
4234
|
}
|
|
4235
4235
|
postMessages(t) {
|
|
4236
|
-
return
|
|
4236
|
+
return or(this, void 0, void 0, function* () {
|
|
4237
4237
|
try {
|
|
4238
4238
|
(yield fetch(this.url, {
|
|
4239
4239
|
method: "POST",
|
|
@@ -4251,7 +4251,7 @@ class gu {
|
|
|
4251
4251
|
});
|
|
4252
4252
|
}
|
|
4253
4253
|
flushQueue() {
|
|
4254
|
-
return
|
|
4254
|
+
return or(this, void 0, void 0, function* () {
|
|
4255
4255
|
if (this.sendPromise || !this.sendQueue.length)
|
|
4256
4256
|
return;
|
|
4257
4257
|
const t = this.sendQueue;
|
|
@@ -4311,7 +4311,7 @@ var D = function(e, t, n, r) {
|
|
|
4311
4311
|
t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[i]) && (n[r[i]] = e[r[i]]);
|
|
4312
4312
|
return n;
|
|
4313
4313
|
};
|
|
4314
|
-
const
|
|
4314
|
+
const ce = {
|
|
4315
4315
|
CONNECTING: "connecting",
|
|
4316
4316
|
OPENED: "opened",
|
|
4317
4317
|
AUTHENTICATED: "authenticated",
|
|
@@ -4320,13 +4320,13 @@ const fe = {
|
|
|
4320
4320
|
}, wu = 3e4, mu = 3e4, Su = 200, vu = {
|
|
4321
4321
|
apiURI: "https://api.instantdb.com",
|
|
4322
4322
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
4323
|
-
},
|
|
4323
|
+
}, Ct = "_instant_oauth_redirect", jt = "currentUser";
|
|
4324
4324
|
function Ou({ transportType: e, appId: t, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
4325
4325
|
if (!i)
|
|
4326
|
-
return new
|
|
4326
|
+
return new ur(`${r}?app_id=${t}`);
|
|
4327
4327
|
switch (e) {
|
|
4328
4328
|
case "ws":
|
|
4329
|
-
return new
|
|
4329
|
+
return new ur(`${r}?app_id=${t}`);
|
|
4330
4330
|
case "sse":
|
|
4331
4331
|
return new gu(i, `${n}/runtime/sse?app_id=${t}`);
|
|
4332
4332
|
default:
|
|
@@ -4336,7 +4336,7 @@ function Ou({ transportType: e, appId: t, apiURI: n, wsURI: r, EventSourceImpl:
|
|
|
4336
4336
|
function Eu() {
|
|
4337
4337
|
return typeof window < "u" || typeof chrome < "u";
|
|
4338
4338
|
}
|
|
4339
|
-
const
|
|
4339
|
+
const ar = {
|
|
4340
4340
|
"set-presence": !0,
|
|
4341
4341
|
"set-presence-ok": !0,
|
|
4342
4342
|
"refresh-presence": !0,
|
|
@@ -4363,16 +4363,16 @@ function Cu(e) {
|
|
|
4363
4363
|
}
|
|
4364
4364
|
return n;
|
|
4365
4365
|
}
|
|
4366
|
-
function
|
|
4366
|
+
function cr(e) {
|
|
4367
4367
|
return [...e].sort((t, n) => {
|
|
4368
4368
|
const [r, i] = t, [s, o] = n, u = i.order || 0, a = o.order || 0;
|
|
4369
4369
|
return u == a ? r < s ? -1 : r > s ? 1 : 0 : u - a;
|
|
4370
4370
|
});
|
|
4371
4371
|
}
|
|
4372
4372
|
class ju {
|
|
4373
|
-
constructor(t, n =
|
|
4373
|
+
constructor(t, n = Fr, r = Nr, i, s) {
|
|
4374
4374
|
var o, u, a;
|
|
4375
|
-
if (this._isOnline = !0, this._isShutdown = !1, this.status =
|
|
4375
|
+
if (this._isOnline = !0, this._isShutdown = !1, this.status = ce.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._onMergeQuerySubs = (d, c) => {
|
|
4376
4376
|
const f = d || {}, h = Object.assign({}, c);
|
|
4377
4377
|
Object.entries(c).forEach(([b, g]) => {
|
|
4378
4378
|
var w;
|
|
@@ -4396,7 +4396,7 @@ class ju {
|
|
|
4396
4396
|
}, this.notifyOne = (d) => {
|
|
4397
4397
|
var c, f;
|
|
4398
4398
|
const h = (c = this.queryCbs[d]) !== null && c !== void 0 ? c : [], p = (f = this._dataForQueryCache[d]) === null || f === void 0 ? void 0 : f.data, b = this.dataForQuery(d);
|
|
4399
|
-
b && (
|
|
4399
|
+
b && (ot(b, p) || h.forEach((g) => g.cb(b)));
|
|
4400
4400
|
}, this.notifyOneQueryOnce = (d) => {
|
|
4401
4401
|
var c;
|
|
4402
4402
|
const f = (c = this.queryOnceDfds[d]) !== null && c !== void 0 ? c : [], h = this.dataForQuery(d);
|
|
@@ -4422,7 +4422,7 @@ class ju {
|
|
|
4422
4422
|
return this.pushOps([], c);
|
|
4423
4423
|
}
|
|
4424
4424
|
}, this.pushOps = (d, c) => {
|
|
4425
|
-
const f =
|
|
4425
|
+
const f = q(), h = [...this.pendingMutations.currentValue.values()], p = Math.max(0, ...h.map((w) => w.order || 0)) + 1, b = {
|
|
4426
4426
|
op: "transact",
|
|
4427
4427
|
"tx-steps": d,
|
|
4428
4428
|
created: Date.now(),
|
|
@@ -4430,7 +4430,7 @@ class ju {
|
|
|
4430
4430
|
order: p
|
|
4431
4431
|
};
|
|
4432
4432
|
this.pendingMutations.set((w) => (w.set(f, b), w));
|
|
4433
|
-
const g = new
|
|
4433
|
+
const g = new Jn();
|
|
4434
4434
|
return this.mutationDeferredStore.set(f, g), this._sendMutation(f, b), this.notifyAll(), g.promise;
|
|
4435
4435
|
}, this._transportOnOpen = (d) => {
|
|
4436
4436
|
const c = d.target;
|
|
@@ -4438,9 +4438,9 @@ class ju {
|
|
|
4438
4438
|
this._log.info("[socket][open]", c.id, "skip; this is no longer the current transport");
|
|
4439
4439
|
return;
|
|
4440
4440
|
}
|
|
4441
|
-
this._log.info("[socket][open]", this._transport.id), this._setStatus(
|
|
4441
|
+
this._log.info("[socket][open]", this._transport.id), this._setStatus(ce.OPENED), this.getCurrentUser().then((f) => {
|
|
4442
4442
|
var h;
|
|
4443
|
-
this._trySend(
|
|
4443
|
+
this._trySend(q(), {
|
|
4444
4444
|
op: "init",
|
|
4445
4445
|
"app-id": this.config.appId,
|
|
4446
4446
|
"refresh-token": (h = f.user) === null || h === void 0 ? void 0 : h.refresh_token,
|
|
@@ -4483,7 +4483,7 @@ class ju {
|
|
|
4483
4483
|
this._log.info("[socket][close]", c.id, "skip; this is no longer the current transport");
|
|
4484
4484
|
return;
|
|
4485
4485
|
}
|
|
4486
|
-
this._setStatus(
|
|
4486
|
+
this._setStatus(ce.CLOSED);
|
|
4487
4487
|
for (const f of Object.values(this._rooms))
|
|
4488
4488
|
f.isConnected = !1;
|
|
4489
4489
|
if (this._isShutdown) {
|
|
@@ -4491,7 +4491,7 @@ class ju {
|
|
|
4491
4491
|
return;
|
|
4492
4492
|
}
|
|
4493
4493
|
this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
4494
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, vu), t), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : mu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Su, this._log = au(t.verbose ||
|
|
4494
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, vu), t), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : mu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Su, this._log = au(t.verbose || ln || Vr, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": zr }), this.config.schema && (this._linkIndex = er(this.config.schema)), !!Eu()) {
|
|
4495
4495
|
if (!t.appId)
|
|
4496
4496
|
throw new Error("Instant must be initialized with an appId.");
|
|
4497
4497
|
if (!je(t.appId))
|
|
@@ -4508,13 +4508,13 @@ class ju {
|
|
|
4508
4508
|
}
|
|
4509
4509
|
}))), this._initStorage(n), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
|
|
4510
4510
|
this._isOnline = d, this._startSocket(), r.listen((c) => {
|
|
4511
|
-
c !== this._isOnline && (this._log.info("[network] online =", c), this._isOnline = c, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to",
|
|
4511
|
+
c !== this._isOnline && (this._log.info("[network] online =", c), this._isOnline = c, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", ce.CLOSED), this._setStatus(ce.CLOSED)));
|
|
4512
4512
|
});
|
|
4513
4513
|
}), typeof addEventListener < "u" && (this._beforeUnload = this._beforeUnload.bind(this), addEventListener("beforeunload", this._beforeUnload));
|
|
4514
4514
|
}
|
|
4515
4515
|
}
|
|
4516
4516
|
updateSchema(t) {
|
|
4517
|
-
this.config = Object.assign(Object.assign({}, this.config), { schema: t, cardinalityInference: !!t }), this._linkIndex = t ?
|
|
4517
|
+
this.config = Object.assign(Object.assign({}, this.config), { schema: t, cardinalityInference: !!t }), this._linkIndex = t ? er(this.config.schema) : null;
|
|
4518
4518
|
}
|
|
4519
4519
|
_reactorStats() {
|
|
4520
4520
|
return {
|
|
@@ -4524,7 +4524,7 @@ class ju {
|
|
|
4524
4524
|
};
|
|
4525
4525
|
}
|
|
4526
4526
|
_initStorage(t) {
|
|
4527
|
-
this._persister = new t(`instant_${this.config.appId}_5`), this.querySubs = new
|
|
4527
|
+
this._persister = new t(`instant_${this.config.appId}_5`), this.querySubs = new Zn(this._persister, "querySubs", {}, this._onMergeQuerySubs, Cu, (n) => Au(n, this.config.useDateObjects)), this.pendingMutations = new Zn(
|
|
4528
4528
|
this._persister,
|
|
4529
4529
|
"pendingMutations",
|
|
4530
4530
|
/* @__PURE__ */ new Map(),
|
|
@@ -4556,7 +4556,7 @@ class ju {
|
|
|
4556
4556
|
i.resolve({ status: t, eventId: n });
|
|
4557
4557
|
else if (r.type) {
|
|
4558
4558
|
const { status: o } = r, u = Tu(r, ["status"]);
|
|
4559
|
-
i.reject(new
|
|
4559
|
+
i.reject(new yt({
|
|
4560
4560
|
// @ts-expect-error body.type is not constant typed
|
|
4561
4561
|
body: u,
|
|
4562
4562
|
status: o
|
|
@@ -4579,78 +4579,85 @@ class ju {
|
|
|
4579
4579
|
_handleReceive(t, n) {
|
|
4580
4580
|
var r, i, s, o, u, a;
|
|
4581
4581
|
const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
4582
|
-
switch (
|
|
4582
|
+
switch (ar[n.op] || this._log.info("[receive]", t, n.op, n), n.op) {
|
|
4583
4583
|
case "init-ok":
|
|
4584
|
-
this._setStatus(
|
|
4585
|
-
for (const
|
|
4586
|
-
const
|
|
4587
|
-
this._tryJoinRoom(
|
|
4584
|
+
this._setStatus(ce.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
4585
|
+
for (const O of Object.keys(this._rooms)) {
|
|
4586
|
+
const z = (i = (r = this._presence[O]) === null || r === void 0 ? void 0 : r.result) === null || i === void 0 ? void 0 : i.user;
|
|
4587
|
+
this._tryJoinRoom(O, z);
|
|
4588
4588
|
}
|
|
4589
4589
|
break;
|
|
4590
4590
|
case "add-query-exists":
|
|
4591
4591
|
this.notifyOneQueryOnce(G(n.q));
|
|
4592
4592
|
break;
|
|
4593
4593
|
case "add-query-ok":
|
|
4594
|
-
const { q: c, result: f } = n, h = G(c), p = (o = (s = f == null ? void 0 : f[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], b = (a = (u = f == null ? void 0 : f[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, g =
|
|
4595
|
-
this.querySubs.set((
|
|
4594
|
+
const { q: c, result: f } = n, h = G(c), p = (o = (s = f == null ? void 0 : f[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], b = (a = (u = f == null ? void 0 : f[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, g = Xn(f), w = Nt(this.attrs, g, d, this._linkIndex, this.config.useDateObjects);
|
|
4595
|
+
this.querySubs.set((O) => (O[h].result = {
|
|
4596
4596
|
store: w,
|
|
4597
4597
|
pageInfo: p,
|
|
4598
4598
|
aggregate: b,
|
|
4599
4599
|
processedTxId: n["processed-tx-id"]
|
|
4600
|
-
},
|
|
4600
|
+
}, O)), this._cleanupPendingMutationsQueries(), this.notifyOne(h), this.notifyOneQueryOnce(h), this._cleanupPendingMutationsTimeout();
|
|
4601
4601
|
break;
|
|
4602
4602
|
case "refresh-ok":
|
|
4603
4603
|
const { computations: T, attrs: m } = n, S = n["processed-tx-id"];
|
|
4604
4604
|
m && this._setAttrs(m), this._cleanupPendingMutationsTimeout();
|
|
4605
|
-
const
|
|
4606
|
-
|
|
4607
|
-
const
|
|
4608
|
-
var
|
|
4609
|
-
const
|
|
4610
|
-
return { hash:
|
|
4605
|
+
const W = this._rewriteMutations(this.attrs, this.pendingMutations.currentValue, S);
|
|
4606
|
+
W !== this.pendingMutations.currentValue && this.pendingMutations.set(() => W);
|
|
4607
|
+
const E = cr(W.entries()), x = T.map((O) => {
|
|
4608
|
+
var z, he, ue, ne;
|
|
4609
|
+
const F = O["instaql-query"], U = O["instaql-result"], ye = G(F), Ke = Xn(U), Be = Nt(this.attrs, Ke, d, this._linkIndex, this.config.useDateObjects), Qe = this._applyOptimisticUpdates(Be, E, S), Ge = (he = (z = U == null ? void 0 : U[0]) === null || z === void 0 ? void 0 : z.data) === null || he === void 0 ? void 0 : he["page-info"], Ye = (ne = (ue = U == null ? void 0 : U[0]) === null || ue === void 0 ? void 0 : ue.data) === null || ne === void 0 ? void 0 : ne.aggregate;
|
|
4610
|
+
return { hash: ye, store: Qe, pageInfo: Ge, aggregate: Ye };
|
|
4611
4611
|
});
|
|
4612
|
-
x.forEach(({ hash:
|
|
4613
|
-
this.querySubs.set((
|
|
4614
|
-
}), this._cleanupPendingMutationsQueries(), x.forEach(({ hash:
|
|
4615
|
-
this.notifyOne(
|
|
4612
|
+
x.forEach(({ hash: O, store: z, pageInfo: he, aggregate: ue }) => {
|
|
4613
|
+
this.querySubs.set((ne) => (ne[O].result = { store: z, pageInfo: he, aggregate: ue, processedTxId: S }, ne));
|
|
4614
|
+
}), this._cleanupPendingMutationsQueries(), x.forEach(({ hash: O }) => {
|
|
4615
|
+
this.notifyOne(O);
|
|
4616
4616
|
});
|
|
4617
4617
|
break;
|
|
4618
4618
|
case "transact-ok": {
|
|
4619
|
-
const { "client-event-id":
|
|
4620
|
-
this._inFlightMutationEventIds.delete(
|
|
4621
|
-
const
|
|
4622
|
-
if (!
|
|
4619
|
+
const { "client-event-id": O, "tx-id": z } = n;
|
|
4620
|
+
this._inFlightMutationEventIds.delete(O);
|
|
4621
|
+
const ue = this._rewriteMutations(this.attrs, this.pendingMutations.currentValue).get(O);
|
|
4622
|
+
if (!ue)
|
|
4623
4623
|
break;
|
|
4624
|
-
this.pendingMutations.set((
|
|
4625
|
-
const
|
|
4626
|
-
this._setAttrs(
|
|
4624
|
+
this.pendingMutations.set((F) => (F.set(O, Object.assign(Object.assign({}, F.get(O)), { "tx-id": z, confirmed: Date.now() })), F));
|
|
4625
|
+
const ne = ue["tx-steps"].filter(([F, ...U]) => F === "add-attr").map(([F, U]) => U).concat(Object.values(this.attrs));
|
|
4626
|
+
this._setAttrs(ne), this._finishTransaction("synced", O), this._cleanupPendingMutationsTimeout();
|
|
4627
4627
|
break;
|
|
4628
4628
|
}
|
|
4629
4629
|
case "patch-presence": {
|
|
4630
|
-
const
|
|
4631
|
-
this._patchPresencePeers(
|
|
4630
|
+
const O = n["room-id"];
|
|
4631
|
+
this._trySetRoomConnected(O, !0), this._patchPresencePeers(O, n.edits), this._notifyPresenceSubs(O);
|
|
4632
4632
|
break;
|
|
4633
4633
|
}
|
|
4634
4634
|
case "refresh-presence": {
|
|
4635
|
-
const
|
|
4636
|
-
this._setPresencePeers(
|
|
4635
|
+
const O = n["room-id"];
|
|
4636
|
+
this._trySetRoomConnected(O, !0), this._setPresencePeers(O, n.data), this._notifyPresenceSubs(O);
|
|
4637
4637
|
break;
|
|
4638
4638
|
}
|
|
4639
|
-
case "server-broadcast":
|
|
4640
|
-
const
|
|
4641
|
-
this._notifyBroadcastSubs(
|
|
4639
|
+
case "server-broadcast": {
|
|
4640
|
+
const O = n["room-id"], z = n.topic;
|
|
4641
|
+
this._trySetRoomConnected(O, !0), this._notifyBroadcastSubs(O, z, n);
|
|
4642
4642
|
break;
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4643
|
+
}
|
|
4644
|
+
case "join-room-ok": {
|
|
4645
|
+
const O = n["room-id"];
|
|
4646
|
+
if (!this._rooms[O]) {
|
|
4647
|
+
this._roomsPendingLeave[O] && (this._tryLeaveRoom(O), delete this._roomsPendingLeave[O]);
|
|
4647
4648
|
break;
|
|
4648
4649
|
}
|
|
4649
|
-
|
|
4650
|
+
this._trySetRoomConnected(O, !0), this._flushEnqueuedRoomData(O);
|
|
4650
4651
|
break;
|
|
4652
|
+
}
|
|
4653
|
+
case "leave-room-ok": {
|
|
4654
|
+
const O = n["room-id"];
|
|
4655
|
+
this._trySetRoomConnected(O, !1);
|
|
4656
|
+
break;
|
|
4657
|
+
}
|
|
4651
4658
|
case "join-room-error":
|
|
4652
|
-
const
|
|
4653
|
-
|
|
4659
|
+
const L = n["room-id"], oe = this._rooms[L];
|
|
4660
|
+
oe && (oe.error = n.error), this._notifyPresenceSubs(L);
|
|
4654
4661
|
break;
|
|
4655
4662
|
case "error":
|
|
4656
4663
|
this._handleReceiveError(n);
|
|
@@ -4695,7 +4702,7 @@ class ju {
|
|
|
4695
4702
|
this.changeCurrentUser(null);
|
|
4696
4703
|
return;
|
|
4697
4704
|
}
|
|
4698
|
-
this._setStatus(
|
|
4705
|
+
this._setStatus(ce.ERRORED, d), this.notifyAll();
|
|
4699
4706
|
return;
|
|
4700
4707
|
}
|
|
4701
4708
|
const f = Object.assign({}, t);
|
|
@@ -4711,7 +4718,7 @@ class ju {
|
|
|
4711
4718
|
this.attrs = t.reduce((n, r) => (n[r.id] = r, n), {}), this.notifyAttrsSubs();
|
|
4712
4719
|
}
|
|
4713
4720
|
_startQuerySub(t, n) {
|
|
4714
|
-
const r =
|
|
4721
|
+
const r = q();
|
|
4715
4722
|
return this.querySubs.set((i) => (i[n] = i[n] || { q: t, result: null, eventId: r }, i[n].lastAccessed = Date.now(), i)), this._trySendAuthed(r, { op: "add-query", q: t }), r;
|
|
4716
4723
|
}
|
|
4717
4724
|
/**
|
|
@@ -4726,7 +4733,7 @@ class ju {
|
|
|
4726
4733
|
*/
|
|
4727
4734
|
subscribeQuery(t, n, r) {
|
|
4728
4735
|
var i;
|
|
4729
|
-
this.config.disableValidation ||
|
|
4736
|
+
this.config.disableValidation || nr(t, this.config.schema), r && "ruleParams" in r && (t = Object.assign({ $$ruleParams: r.ruleParams }, t));
|
|
4730
4737
|
const s = G(t), o = this.getPreviousResult(t);
|
|
4731
4738
|
return o && n(o), this.queryCbs[s] = (i = this.queryCbs[s]) !== null && i !== void 0 ? i : [], this.queryCbs[s].push({ q: t, cb: n }), this._startQuerySub(t, s), () => {
|
|
4732
4739
|
this._unsubQuery(t, s, n);
|
|
@@ -4734,8 +4741,8 @@ class ju {
|
|
|
4734
4741
|
}
|
|
4735
4742
|
queryOnce(t, n) {
|
|
4736
4743
|
var r;
|
|
4737
|
-
this.config.disableValidation ||
|
|
4738
|
-
const i = new
|
|
4744
|
+
this.config.disableValidation || nr(t, this.config.schema), n && "ruleParams" in n && (t = Object.assign({ $$ruleParams: n.ruleParams }, t));
|
|
4745
|
+
const i = new Jn();
|
|
4739
4746
|
if (!this._isOnline)
|
|
4740
4747
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
4741
4748
|
if (!this.querySubs)
|
|
@@ -4751,7 +4758,7 @@ class ju {
|
|
|
4751
4758
|
}
|
|
4752
4759
|
_cleanupQuery(t, n) {
|
|
4753
4760
|
var r, i;
|
|
4754
|
-
!((r = this.queryCbs[n]) === null || r === void 0) && r.length || !((i = this.queryOnceDfds[n]) === null || i === void 0) && i.length || (delete this.queryCbs[n], delete this.queryOnceDfds[n], this._trySendAuthed(
|
|
4761
|
+
!((r = this.queryCbs[n]) === null || r === void 0) && r.length || !((i = this.queryOnceDfds[n]) === null || i === void 0) && i.length || (delete this.queryCbs[n], delete this.queryOnceDfds[n], this._trySendAuthed(q(), { op: "remove-query", q: t }));
|
|
4755
4762
|
}
|
|
4756
4763
|
// When we `pushTx`, it's possible that we don't yet have `this.attrs`
|
|
4757
4764
|
// This means that `tx-steps` in `pendingMutations` will include `add-attr`
|
|
@@ -4769,7 +4776,7 @@ class ju {
|
|
|
4769
4776
|
return n;
|
|
4770
4777
|
const i = (c) => {
|
|
4771
4778
|
const [f, h, p] = c["forward-identity"];
|
|
4772
|
-
return
|
|
4779
|
+
return V(t, h, p);
|
|
4773
4780
|
}, s = (c) => {
|
|
4774
4781
|
const [f, h, p] = c["forward-identity"];
|
|
4775
4782
|
return Te(t, h, p);
|
|
@@ -4807,7 +4814,7 @@ class ju {
|
|
|
4807
4814
|
return u ? d : n;
|
|
4808
4815
|
}
|
|
4809
4816
|
_rewriteMutationsSorted(t, n) {
|
|
4810
|
-
return
|
|
4817
|
+
return cr(this._rewriteMutations(t, n).entries());
|
|
4811
4818
|
}
|
|
4812
4819
|
// ---------------------------
|
|
4813
4820
|
// Transact
|
|
@@ -4881,7 +4888,7 @@ class ju {
|
|
|
4881
4888
|
});
|
|
4882
4889
|
return;
|
|
4883
4890
|
}
|
|
4884
|
-
if (this.status !==
|
|
4891
|
+
if (this.status !== ce.AUTHENTICATED) {
|
|
4885
4892
|
this._finishTransaction("enqueued", t);
|
|
4886
4893
|
return;
|
|
4887
4894
|
}
|
|
@@ -4937,11 +4944,11 @@ class ju {
|
|
|
4937
4944
|
});
|
|
4938
4945
|
}
|
|
4939
4946
|
_trySendAuthed(...t) {
|
|
4940
|
-
this.status ===
|
|
4947
|
+
this.status === ce.AUTHENTICATED && this._trySend(...t);
|
|
4941
4948
|
}
|
|
4942
4949
|
_trySend(t, n, r) {
|
|
4943
4950
|
if (this._transport.isOpen()) {
|
|
4944
|
-
switch (
|
|
4951
|
+
switch (ar[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
|
|
4945
4952
|
case "transact": {
|
|
4946
4953
|
this._inFlightMutationEventIds.add(t);
|
|
4947
4954
|
break;
|
|
@@ -4987,7 +4994,7 @@ class ju {
|
|
|
4987
4994
|
return r;
|
|
4988
4995
|
if (this._localIdPromises[n])
|
|
4989
4996
|
return this._localIdPromises[n];
|
|
4990
|
-
const i =
|
|
4997
|
+
const i = q();
|
|
4991
4998
|
return this._localIdPromises[n] = this._persister.setItem(n, i).then(() => i), this._localIdPromises[n];
|
|
4992
4999
|
});
|
|
4993
5000
|
}
|
|
@@ -4997,9 +5004,9 @@ class ju {
|
|
|
4997
5004
|
if (typeof URL > "u")
|
|
4998
5005
|
return;
|
|
4999
5006
|
const t = new URL(window.location.href);
|
|
5000
|
-
if (t.searchParams.get(
|
|
5007
|
+
if (t.searchParams.get(Ct)) {
|
|
5001
5008
|
const n = t.toString();
|
|
5002
|
-
t.searchParams.delete(
|
|
5009
|
+
t.searchParams.delete(Ct), t.searchParams.delete("code"), t.searchParams.delete("error");
|
|
5003
5010
|
const r = t.pathname + (t.searchParams.size ? "?" + t.searchParams : "") + t.hash;
|
|
5004
5011
|
if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
|
|
5005
5012
|
typeof navigation == "object" && // @ts-ignore (waiting for ts support)
|
|
@@ -5024,7 +5031,7 @@ class ju {
|
|
|
5024
5031
|
if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
|
|
5025
5032
|
return null;
|
|
5026
5033
|
const s = new URLSearchParams(window.location.search);
|
|
5027
|
-
if (!s.get(
|
|
5034
|
+
if (!s.get(Ct))
|
|
5028
5035
|
return null;
|
|
5029
5036
|
const o = s.get("error");
|
|
5030
5037
|
if (o)
|
|
@@ -5034,7 +5041,7 @@ class ju {
|
|
|
5034
5041
|
return null;
|
|
5035
5042
|
this._replaceUrlAfterOAuth();
|
|
5036
5043
|
try {
|
|
5037
|
-
const a = yield this._getCurrentUser(), d = (a == null ? void 0 : a.type) === "guest", { user: c } = yield
|
|
5044
|
+
const a = yield this._getCurrentUser(), d = (a == null ? void 0 : a.type) === "guest", { user: c } = yield Yn({
|
|
5038
5045
|
apiURI: this.config.apiURI,
|
|
5039
5046
|
appId: this.config.appId,
|
|
5040
5047
|
code: u,
|
|
@@ -5062,7 +5069,7 @@ class ju {
|
|
|
5062
5069
|
n.isLoading || t(this._currentUserCached);
|
|
5063
5070
|
let r = !1;
|
|
5064
5071
|
return this.getCurrentUser().then((i) => {
|
|
5065
|
-
r ||
|
|
5072
|
+
r || ot(i, n) || t(i);
|
|
5066
5073
|
}), () => {
|
|
5067
5074
|
r = !0, this.authCbs = this.authCbs.filter((i) => i !== t);
|
|
5068
5075
|
};
|
|
@@ -5102,7 +5109,7 @@ class ju {
|
|
|
5102
5109
|
}
|
|
5103
5110
|
setCurrentUser(t) {
|
|
5104
5111
|
return D(this, void 0, void 0, function* () {
|
|
5105
|
-
yield this._persister.setItem(
|
|
5112
|
+
yield this._persister.setItem(jt, t);
|
|
5106
5113
|
});
|
|
5107
5114
|
}
|
|
5108
5115
|
getCurrentUserCached() {
|
|
@@ -5110,7 +5117,7 @@ class ju {
|
|
|
5110
5117
|
}
|
|
5111
5118
|
_getCurrentUser() {
|
|
5112
5119
|
return D(this, void 0, void 0, function* () {
|
|
5113
|
-
const t = yield this._persister.getItem(
|
|
5120
|
+
const t = yield this._persister.getItem(jt);
|
|
5114
5121
|
return typeof t == "string" ? JSON.parse(t) : t;
|
|
5115
5122
|
});
|
|
5116
5123
|
}
|
|
@@ -5127,7 +5134,7 @@ class ju {
|
|
|
5127
5134
|
}
|
|
5128
5135
|
_hasCurrentUser() {
|
|
5129
5136
|
return D(this, void 0, void 0, function* () {
|
|
5130
|
-
const t = yield this._persister.getItem(
|
|
5137
|
+
const t = yield this._persister.getItem(jt);
|
|
5131
5138
|
return JSON.parse(t) != null;
|
|
5132
5139
|
});
|
|
5133
5140
|
}
|
|
@@ -5135,7 +5142,7 @@ class ju {
|
|
|
5135
5142
|
return D(this, void 0, void 0, function* () {
|
|
5136
5143
|
var n;
|
|
5137
5144
|
const { user: r } = yield this.getCurrentUser();
|
|
5138
|
-
if (!
|
|
5145
|
+
if (!ot(r, t)) {
|
|
5139
5146
|
yield this.setCurrentUser(t), this.updateUser(t);
|
|
5140
5147
|
try {
|
|
5141
5148
|
(n = this._broadcastChannel) === null || n === void 0 || n.postMessage({ type: "auth" });
|
|
@@ -5234,7 +5241,7 @@ class ju {
|
|
|
5234
5241
|
exchangeCodeForToken(t) {
|
|
5235
5242
|
return D(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
|
|
5236
5243
|
var i;
|
|
5237
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield
|
|
5244
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield Yn({
|
|
5238
5245
|
apiURI: this.config.apiURI,
|
|
5239
5246
|
appId: this.config.appId,
|
|
5240
5247
|
code: n,
|
|
@@ -5310,17 +5317,21 @@ class ju {
|
|
|
5310
5317
|
s.result.user = o, i.isConnected && (this._trySetPresence(n, o), this._notifyPresenceSubs(n));
|
|
5311
5318
|
}
|
|
5312
5319
|
_trySetPresence(t, n) {
|
|
5313
|
-
this._trySendAuthed(
|
|
5320
|
+
this._trySendAuthed(q(), {
|
|
5314
5321
|
op: "set-presence",
|
|
5315
5322
|
"room-id": t,
|
|
5316
5323
|
data: n
|
|
5317
5324
|
});
|
|
5318
5325
|
}
|
|
5319
5326
|
_tryJoinRoom(t, n) {
|
|
5320
|
-
this._trySendAuthed(
|
|
5327
|
+
this._trySendAuthed(q(), { op: "join-room", "room-id": t, data: n }), delete this._roomsPendingLeave[t];
|
|
5321
5328
|
}
|
|
5322
5329
|
_tryLeaveRoom(t) {
|
|
5323
|
-
this._trySendAuthed(
|
|
5330
|
+
this._trySendAuthed(q(), { op: "leave-room", "room-id": t });
|
|
5331
|
+
}
|
|
5332
|
+
_trySetRoomConnected(t, n) {
|
|
5333
|
+
const r = this._rooms[t];
|
|
5334
|
+
r && (r.isConnected = n);
|
|
5324
5335
|
}
|
|
5325
5336
|
// TODO: look into typing again
|
|
5326
5337
|
subscribePresence(t, n, r, i) {
|
|
@@ -5351,17 +5362,17 @@ class ju {
|
|
|
5351
5362
|
const o = ((i = (r = this._presence[t]) === null || r === void 0 ? void 0 : r.result) === null || i === void 0 ? void 0 : i.peers) || {};
|
|
5352
5363
|
let u = Object.fromEntries(Object.entries(o).map(([d, c]) => [d, { data: c }]));
|
|
5353
5364
|
(s = this._presence[t]) === null || s === void 0 || s.result;
|
|
5354
|
-
const a =
|
|
5365
|
+
const a = Lt(u, (d) => {
|
|
5355
5366
|
for (let [c, f, h] of n)
|
|
5356
5367
|
switch (f) {
|
|
5357
5368
|
case "+":
|
|
5358
5369
|
Ni(d, c, h);
|
|
5359
5370
|
break;
|
|
5360
5371
|
case "r":
|
|
5361
|
-
|
|
5372
|
+
Ln(d, c, h);
|
|
5362
5373
|
break;
|
|
5363
5374
|
case "-":
|
|
5364
|
-
|
|
5375
|
+
vr(d, c);
|
|
5365
5376
|
break;
|
|
5366
5377
|
}
|
|
5367
5378
|
delete d[this._sessionId];
|
|
@@ -5372,8 +5383,8 @@ class ju {
|
|
|
5372
5383
|
const r = Object.assign({}, n);
|
|
5373
5384
|
delete r[this._sessionId];
|
|
5374
5385
|
const i = Object.fromEntries(Object.entries(r).map(([s, o]) => [s, o.data]));
|
|
5375
|
-
this._presence =
|
|
5376
|
-
|
|
5386
|
+
this._presence = Lt(this._presence, (s) => {
|
|
5387
|
+
Ln(s, [t, "result", "peers"], i);
|
|
5377
5388
|
});
|
|
5378
5389
|
}
|
|
5379
5390
|
// --------
|
|
@@ -5390,7 +5401,7 @@ class ju {
|
|
|
5390
5401
|
}
|
|
5391
5402
|
}
|
|
5392
5403
|
_tryBroadcast(t, n, r, i) {
|
|
5393
|
-
this._trySendAuthed(
|
|
5404
|
+
this._trySendAuthed(q(), {
|
|
5394
5405
|
op: "client-broadcast",
|
|
5395
5406
|
"room-id": t,
|
|
5396
5407
|
roomType: n,
|
|
@@ -5460,9 +5471,9 @@ class ju {
|
|
|
5460
5471
|
});
|
|
5461
5472
|
}
|
|
5462
5473
|
}
|
|
5463
|
-
let
|
|
5474
|
+
let rt;
|
|
5464
5475
|
function Pu(e, t) {
|
|
5465
|
-
|
|
5476
|
+
rt == null || rt.dispose();
|
|
5466
5477
|
const n = Du(t), r = Mu(t, u), i = Iu(ku(e));
|
|
5467
5478
|
function s(c) {
|
|
5468
5479
|
var f;
|
|
@@ -5479,14 +5490,14 @@ function Pu(e, t) {
|
|
|
5479
5490
|
n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", s);
|
|
5480
5491
|
}
|
|
5481
5492
|
function d() {
|
|
5482
|
-
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s),
|
|
5493
|
+
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), rt = {
|
|
5483
5494
|
dispose: a
|
|
5484
5495
|
};
|
|
5485
5496
|
}
|
|
5486
5497
|
return d();
|
|
5487
5498
|
}
|
|
5488
5499
|
function ku(e) {
|
|
5489
|
-
return `${
|
|
5500
|
+
return `${ln || qr ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${e}`;
|
|
5490
5501
|
}
|
|
5491
5502
|
function Iu(e) {
|
|
5492
5503
|
const t = document.createElement("iframe");
|
|
@@ -5566,11 +5577,11 @@ function Lu() {
|
|
|
5566
5577
|
var e;
|
|
5567
5578
|
return globalThis.__instantDbStore = (e = globalThis.__instantDbStore) !== null && e !== void 0 ? e : {}, globalThis.__instantDbStore;
|
|
5568
5579
|
}
|
|
5569
|
-
function
|
|
5580
|
+
function Ht(e) {
|
|
5570
5581
|
const t = e.__adminToken;
|
|
5571
5582
|
return e.appId + "_" + (e.websocketURI || "default_ws_uri") + "_" + (e.apiURI || "default_api_uri") + "_" + (t || "client_only") + "_" + e.useDateObjects;
|
|
5572
5583
|
}
|
|
5573
|
-
const
|
|
5584
|
+
const Jt = Lu(), Pt = Uu();
|
|
5574
5585
|
class Fu {
|
|
5575
5586
|
constructor(t) {
|
|
5576
5587
|
this.db = t, 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);
|
|
@@ -5586,7 +5597,7 @@ function Vu(e) {
|
|
|
5586
5597
|
}
|
|
5587
5598
|
class qu {
|
|
5588
5599
|
constructor(t) {
|
|
5589
|
-
this.tx =
|
|
5600
|
+
this.tx = fn(), this._reactor = t, this.auth = new Fu(this._reactor), this.storage = new Nu(this._reactor);
|
|
5590
5601
|
}
|
|
5591
5602
|
/**
|
|
5592
5603
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -5727,7 +5738,7 @@ class qu {
|
|
|
5727
5738
|
};
|
|
5728
5739
|
}
|
|
5729
5740
|
shutdown() {
|
|
5730
|
-
delete
|
|
5741
|
+
delete Jt[Ht(this._reactor.config)], this._reactor.shutdown();
|
|
5731
5742
|
}
|
|
5732
5743
|
/**
|
|
5733
5744
|
* Use this for one-off queries.
|
|
@@ -5746,23 +5757,23 @@ class qu {
|
|
|
5746
5757
|
return this._reactor.queryOnce(t, n);
|
|
5747
5758
|
}
|
|
5748
5759
|
}
|
|
5749
|
-
function
|
|
5760
|
+
function dr(e) {
|
|
5750
5761
|
if (!e)
|
|
5751
5762
|
return "0";
|
|
5752
|
-
if (
|
|
5753
|
-
return
|
|
5763
|
+
if (Pt.get(e))
|
|
5764
|
+
return Pt.get(e);
|
|
5754
5765
|
const t = G(e);
|
|
5755
|
-
return
|
|
5766
|
+
return Pt.set(e, t), t;
|
|
5756
5767
|
}
|
|
5757
5768
|
function Wu(e, t) {
|
|
5758
|
-
return
|
|
5769
|
+
return dr(e._reactor.config.schema) !== dr(t);
|
|
5759
5770
|
}
|
|
5760
5771
|
function zu(e, t, n, r, i) {
|
|
5761
|
-
const s =
|
|
5772
|
+
const s = Jt[Ht(e)];
|
|
5762
5773
|
if (s)
|
|
5763
5774
|
return Wu(s, e.schema) && s._reactor.updateSchema(e.schema), s;
|
|
5764
|
-
const o = new ju(Object.assign(Object.assign(Object.assign({}, xu), e), { cardinalityInference: !!e.schema }), t ||
|
|
5765
|
-
return
|
|
5775
|
+
const o = new ju(Object.assign(Object.assign(Object.assign({}, xu), e), { cardinalityInference: !!e.schema }), t || Fr, n || Nr, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": zr }), i), u = new qu(o);
|
|
5776
|
+
return Jt[Ht(e)] = u, Ku(e.appId, e.devtool), u;
|
|
5766
5777
|
}
|
|
5767
5778
|
function Ku(e, t) {
|
|
5768
5779
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof t == "boolean" && !t)
|
|
@@ -5776,7 +5787,7 @@ const Bu = {
|
|
|
5776
5787
|
pageInfo: void 0,
|
|
5777
5788
|
error: void 0
|
|
5778
5789
|
};
|
|
5779
|
-
function
|
|
5790
|
+
function fr(e) {
|
|
5780
5791
|
return {
|
|
5781
5792
|
isLoading: !e,
|
|
5782
5793
|
data: void 0,
|
|
@@ -5787,10 +5798,10 @@ function lr(e) {
|
|
|
5787
5798
|
}
|
|
5788
5799
|
function Qu(e, t, n) {
|
|
5789
5800
|
t && n && "ruleParams" in n && (t = { $$ruleParams: n.ruleParams, ...t });
|
|
5790
|
-
const r = t ? Vu(t) : null, i = G(r), s =
|
|
5791
|
-
|
|
5792
|
-
), o =
|
|
5793
|
-
(a) => (s.current =
|
|
5801
|
+
const r = t ? Vu(t) : null, i = G(r), s = ut(
|
|
5802
|
+
fr(e._reactor.getPreviousResult(r))
|
|
5803
|
+
), o = pe(
|
|
5804
|
+
(a) => (s.current = fr(
|
|
5794
5805
|
e._reactor.getPreviousResult(r)
|
|
5795
5806
|
), r ? e.subscribeQuery(r, (c) => {
|
|
5796
5807
|
s.current = {
|
|
@@ -5805,14 +5816,14 @@ function Qu(e, t, n) {
|
|
|
5805
5816
|
// Build a new subscribe function if the query changes
|
|
5806
5817
|
[i]
|
|
5807
5818
|
);
|
|
5808
|
-
return { state:
|
|
5819
|
+
return { state: kt(
|
|
5809
5820
|
o,
|
|
5810
5821
|
() => s.current,
|
|
5811
5822
|
() => Bu
|
|
5812
5823
|
), query: r };
|
|
5813
5824
|
}
|
|
5814
5825
|
function Gu() {
|
|
5815
|
-
const e =
|
|
5826
|
+
const e = ut(null);
|
|
5816
5827
|
we(() => {
|
|
5817
5828
|
n();
|
|
5818
5829
|
}, []);
|
|
@@ -5835,7 +5846,7 @@ function Hu(e, t, n) {
|
|
|
5835
5846
|
), [e.id, t]);
|
|
5836
5847
|
}
|
|
5837
5848
|
function Ju(e, t) {
|
|
5838
|
-
return we(() => e.core._reactor.joinRoom(e.id), [e.id]),
|
|
5849
|
+
return we(() => e.core._reactor.joinRoom(e.id), [e.id]), pe(
|
|
5839
5850
|
(r) => {
|
|
5840
5851
|
e.core._reactor.publishTopic({
|
|
5841
5852
|
roomType: e.type,
|
|
@@ -5849,7 +5860,7 @@ function Ju(e, t) {
|
|
|
5849
5860
|
}
|
|
5850
5861
|
function Zu(e, t = {}) {
|
|
5851
5862
|
var o, u;
|
|
5852
|
-
const [n, r] =
|
|
5863
|
+
const [n, r] = hr(() => e.core._reactor.getPresence(e.type, e.id, t) ?? {
|
|
5853
5864
|
peers: {},
|
|
5854
5865
|
isLoading: !0
|
|
5855
5866
|
});
|
|
@@ -5861,13 +5872,13 @@ function Zu(e, t = {}) {
|
|
|
5861
5872
|
r(d);
|
|
5862
5873
|
}
|
|
5863
5874
|
), [e.id, t.user, (o = t.peers) == null ? void 0 : o.join(), (u = t.keys) == null ? void 0 : u.join()]);
|
|
5864
|
-
const i =
|
|
5875
|
+
const i = pe(
|
|
5865
5876
|
(a) => {
|
|
5866
5877
|
e.core._reactor.publishPresence(e.type, e.id, a);
|
|
5867
5878
|
},
|
|
5868
5879
|
[e.type, e.id]
|
|
5869
5880
|
);
|
|
5870
|
-
return
|
|
5881
|
+
return It(() => ({
|
|
5871
5882
|
...n,
|
|
5872
5883
|
publishPresence: i
|
|
5873
5884
|
}), [n, i]);
|
|
@@ -5878,7 +5889,7 @@ function Xu(e, t, n) {
|
|
|
5878
5889
|
function ea(e, t, n = {}) {
|
|
5879
5890
|
const r = Gu(), i = _e.usePresence(e, {
|
|
5880
5891
|
keys: [t]
|
|
5881
|
-
}), s =
|
|
5892
|
+
}), s = It(() => {
|
|
5882
5893
|
const c = e._core._reactor.getPresence(
|
|
5883
5894
|
e.type,
|
|
5884
5895
|
e.id
|
|
@@ -5886,7 +5897,7 @@ function ea(e, t, n = {}) {
|
|
|
5886
5897
|
return n != null && n.writeOnly ? [] : Object.values((c == null ? void 0 : c.peers) ?? {}).filter(
|
|
5887
5898
|
(f) => f[t] === !0
|
|
5888
5899
|
);
|
|
5889
|
-
}, [n == null ? void 0 : n.writeOnly, i]), o =
|
|
5900
|
+
}, [n == null ? void 0 : n.writeOnly, i]), o = pe(
|
|
5890
5901
|
(c) => {
|
|
5891
5902
|
e.core._reactor.publishPresence(e.type, e.id, {
|
|
5892
5903
|
[t]: c
|
|
@@ -5897,15 +5908,15 @@ function ea(e, t, n = {}) {
|
|
|
5897
5908
|
}));
|
|
5898
5909
|
},
|
|
5899
5910
|
[e.type, e.id, t, n == null ? void 0 : n.timeout, r]
|
|
5900
|
-
), u =
|
|
5911
|
+
), u = pe(
|
|
5901
5912
|
(c) => {
|
|
5902
5913
|
const h = !((n == null ? void 0 : n.stopOnEnter) && c.key === "Enter");
|
|
5903
5914
|
o(h);
|
|
5904
5915
|
},
|
|
5905
5916
|
[n.stopOnEnter, o]
|
|
5906
|
-
), a =
|
|
5917
|
+
), a = pe(() => {
|
|
5907
5918
|
o(!1);
|
|
5908
|
-
}, [o]), d =
|
|
5919
|
+
}, [o]), d = It(() => ({ onKeyDown: u, onBlur: a }), [u, a]);
|
|
5909
5920
|
return {
|
|
5910
5921
|
active: s,
|
|
5911
5922
|
setActive: o,
|
|
@@ -5933,8 +5944,8 @@ const na = {
|
|
|
5933
5944
|
};
|
|
5934
5945
|
class ia {
|
|
5935
5946
|
constructor(t, n) {
|
|
5936
|
-
this.tx =
|
|
5937
|
-
const [i, s] =
|
|
5947
|
+
this.tx = fn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
5948
|
+
const [i, s] = hr(null);
|
|
5938
5949
|
return we(() => {
|
|
5939
5950
|
(async () => {
|
|
5940
5951
|
const u = await this.getLocalId(r);
|
|
@@ -5946,12 +5957,12 @@ class ia {
|
|
|
5946
5957
|
r,
|
|
5947
5958
|
i
|
|
5948
5959
|
).state, this.useAuth = () => {
|
|
5949
|
-
const r =
|
|
5960
|
+
const r = ut(
|
|
5950
5961
|
this.core._reactor._currentUserCached
|
|
5951
|
-
), i =
|
|
5962
|
+
), i = pe((o) => this.core.subscribeAuth((a) => {
|
|
5952
5963
|
r.current = { isLoading: !1, ...a }, o();
|
|
5953
5964
|
}), []);
|
|
5954
|
-
return
|
|
5965
|
+
return kt(
|
|
5955
5966
|
i,
|
|
5956
5967
|
() => r.current,
|
|
5957
5968
|
() => na
|
|
@@ -5964,12 +5975,12 @@ class ia {
|
|
|
5964
5975
|
);
|
|
5965
5976
|
return r;
|
|
5966
5977
|
}, this.useConnectionStatus = () => {
|
|
5967
|
-
const r =
|
|
5978
|
+
const r = ut(
|
|
5968
5979
|
this.core._reactor.status
|
|
5969
|
-
), i =
|
|
5980
|
+
), i = pe((o) => this.core.subscribeConnectionStatus((a) => {
|
|
5970
5981
|
a !== r.current && (r.current = a, o());
|
|
5971
5982
|
}), []);
|
|
5972
|
-
return
|
|
5983
|
+
return kt(
|
|
5973
5984
|
i,
|
|
5974
5985
|
() => r.current,
|
|
5975
5986
|
// For SSR, always return 'connecting' as the initial state
|
|
@@ -5977,10 +5988,10 @@ class ia {
|
|
|
5977
5988
|
);
|
|
5978
5989
|
}, this.queryOnce = (r, i) => this.core.queryOnce(r, i), this.SignedIn = ({ children: r }) => {
|
|
5979
5990
|
const i = this.useAuth();
|
|
5980
|
-
return i.isLoading || i.error || !i.user ? null : /* @__PURE__ */
|
|
5991
|
+
return i.isLoading || i.error || !i.user ? null : /* @__PURE__ */ et.jsx(et.Fragment, { children: r });
|
|
5981
5992
|
}, this.SignedOut = ({ children: r }) => {
|
|
5982
5993
|
const i = this.useAuth();
|
|
5983
|
-
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */
|
|
5994
|
+
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */ et.jsx(et.Fragment, { children: r });
|
|
5984
5995
|
}, this.core = zu(
|
|
5985
5996
|
t,
|
|
5986
5997
|
// @ts-expect-error because TS can't resolve subclass statics
|