use-abcd 1.1.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +209 -226
- package/dist/chunks/client-DReyDQ23.js +144 -0
- package/dist/chunks/client-DReyDQ23.js.map +1 -0
- package/dist/chunks/types-Dy4rYb2N.js.map +1 -1
- package/dist/collection.d.ts +3 -3
- package/dist/fetch-handler.d.ts +1 -0
- package/dist/index.js +632 -626
- package/dist/index.js.map +1 -1
- package/dist/item-cache.test.d.ts +1 -0
- package/dist/item.d.ts +1 -5
- package/dist/runtime/client.d.ts +1 -0
- package/dist/runtime/client.js +1 -1
- package/dist/runtime/server.d.ts +17 -13
- package/dist/runtime/server.js +39 -39
- package/dist/runtime/server.js.map +1 -1
- package/dist/runtime/types.d.ts +2 -0
- package/dist/sync-queue.d.ts +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/useCrud.d.ts +1 -1
- package/dist/useItem.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunks/client-VrsFvEIA.js +0 -144
- package/dist/chunks/client-VrsFvEIA.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useSyncExternalStore as ue,
|
|
1
|
+
import { useSyncExternalStore as ue, useCallback as Xe } from "react";
|
|
2
2
|
import { c as so } from "./chunks/types-Dy4rYb2N.js";
|
|
3
|
-
import { c as
|
|
3
|
+
import { c as oo, b as ao, a as co, f as uo, d as fo, s as lo } from "./chunks/client-DReyDQ23.js";
|
|
4
4
|
const g = {
|
|
5
5
|
Remove: "remove",
|
|
6
6
|
Replace: "replace",
|
|
7
7
|
Add: "add"
|
|
8
|
-
},
|
|
8
|
+
}, At = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Yt = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), fe = Symbol.iterator, C = {
|
|
9
9
|
mutable: "mutable",
|
|
10
10
|
immutable: "immutable"
|
|
11
11
|
}, De = {};
|
|
@@ -29,15 +29,15 @@ function He(e) {
|
|
|
29
29
|
function Ne(e) {
|
|
30
30
|
return Object.getPrototypeOf(e) === Map.prototype;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function M(e) {
|
|
33
33
|
var t;
|
|
34
34
|
return (t = e.copy) !== null && t !== void 0 ? t : e.original;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function Q(e) {
|
|
37
37
|
return !!h(e);
|
|
38
38
|
}
|
|
39
39
|
function h(e) {
|
|
40
|
-
return typeof e != "object" ? null : e?.[
|
|
40
|
+
return typeof e != "object" ? null : e?.[At];
|
|
41
41
|
}
|
|
42
42
|
function Le(e) {
|
|
43
43
|
var t;
|
|
@@ -48,20 +48,20 @@ function T(e, t) {
|
|
|
48
48
|
if (!e || typeof e != "object")
|
|
49
49
|
return !1;
|
|
50
50
|
let n;
|
|
51
|
-
return Object.getPrototypeOf(e) === Object.prototype || Array.isArray(e) || e instanceof Map || e instanceof Set || !!t?.mark && ((n = t.mark(e,
|
|
51
|
+
return Object.getPrototypeOf(e) === Object.prototype || Array.isArray(e) || e instanceof Map || e instanceof Set || !!t?.mark && ((n = t.mark(e, C)) === C.immutable || typeof n == "function");
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Mt(e, t = []) {
|
|
54
54
|
if (Object.hasOwnProperty.call(e, "key")) {
|
|
55
55
|
const n = e.parent.copy, r = h(F(n, e.key));
|
|
56
56
|
if (r !== null && r?.original !== e.original)
|
|
57
57
|
return null;
|
|
58
|
-
const
|
|
59
|
-
if (!(
|
|
58
|
+
const s = e.parent.type === 3, i = s ? Array.from(e.parent.setMap.keys()).indexOf(e.key) : e.key;
|
|
59
|
+
if (!(s && n.size > i || te(n, i)))
|
|
60
60
|
return null;
|
|
61
|
-
t.push(
|
|
61
|
+
t.push(i);
|
|
62
62
|
}
|
|
63
63
|
if (e.parent)
|
|
64
|
-
return
|
|
64
|
+
return Mt(e.parent, t);
|
|
65
65
|
t.reverse();
|
|
66
66
|
try {
|
|
67
67
|
Vt(e.copy, t);
|
|
@@ -70,28 +70,28 @@ function At(e, t = []) {
|
|
|
70
70
|
}
|
|
71
71
|
return t;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function K(e) {
|
|
74
74
|
return Array.isArray(e) ? 1 : e instanceof Map ? 2 : e instanceof Set ? 3 : 0;
|
|
75
75
|
}
|
|
76
76
|
function F(e, t) {
|
|
77
|
-
return
|
|
77
|
+
return K(e) === 2 ? e.get(t) : e[t];
|
|
78
78
|
}
|
|
79
79
|
function ae(e, t, n) {
|
|
80
|
-
|
|
80
|
+
K(e) === 2 ? e.set(t, n) : e[t] = n;
|
|
81
81
|
}
|
|
82
82
|
function Oe(e, t) {
|
|
83
83
|
const n = h(e);
|
|
84
|
-
return (n ?
|
|
84
|
+
return (n ? M(n) : e)[t];
|
|
85
85
|
}
|
|
86
86
|
function j(e, t) {
|
|
87
87
|
return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function Pe(e) {
|
|
90
90
|
if (e)
|
|
91
91
|
for (; e.finalities.revoke.length > 0; )
|
|
92
92
|
e.finalities.revoke.pop()();
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function U(e, t) {
|
|
95
95
|
return t ? e : [""].concat(e).map((n) => {
|
|
96
96
|
const r = `${n}`;
|
|
97
97
|
return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
@@ -100,7 +100,7 @@ function B(e, t) {
|
|
|
100
100
|
function Vt(e, t) {
|
|
101
101
|
for (let n = 0; n < t.length - 1; n += 1) {
|
|
102
102
|
const r = t[n];
|
|
103
|
-
if (e = F(
|
|
103
|
+
if (e = F(K(e) === 3 ? Array.from(e) : e, r), typeof e != "object")
|
|
104
104
|
throw new Error(`Cannot resolve patch at '${t.join("/")}'.`);
|
|
105
105
|
}
|
|
106
106
|
return e;
|
|
@@ -138,8 +138,8 @@ function Ct(e, t) {
|
|
|
138
138
|
return new r(e);
|
|
139
139
|
}
|
|
140
140
|
return new Map(e);
|
|
141
|
-
} else if (t?.mark && (n = t.mark(e,
|
|
142
|
-
if (n ===
|
|
141
|
+
} else if (t?.mark && (n = t.mark(e, C), n !== void 0) && n !== C.mutable) {
|
|
142
|
+
if (n === C.immutable)
|
|
143
143
|
return Zt(e);
|
|
144
144
|
if (typeof n == "function") {
|
|
145
145
|
if (t.enablePatches || t.enableAutoFreeze)
|
|
@@ -149,10 +149,10 @@ function Ct(e, t) {
|
|
|
149
149
|
throw new Error(`Unsupported mark result: ${n}`);
|
|
150
150
|
} else if (typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype) {
|
|
151
151
|
const r = {};
|
|
152
|
-
return Object.keys(e).forEach((
|
|
153
|
-
r[
|
|
154
|
-
}), Object.getOwnPropertySymbols(e).forEach((
|
|
155
|
-
Jt.call(e,
|
|
152
|
+
return Object.keys(e).forEach((s) => {
|
|
153
|
+
r[s] = e[s];
|
|
154
|
+
}), Object.getOwnPropertySymbols(e).forEach((s) => {
|
|
155
|
+
Jt.call(e, s) && (r[s] = e[s]);
|
|
156
156
|
}), r;
|
|
157
157
|
} else
|
|
158
158
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
@@ -166,9 +166,9 @@ function ee(e) {
|
|
|
166
166
|
if (Array.isArray(e))
|
|
167
167
|
return e.map(ee);
|
|
168
168
|
if (e instanceof Map) {
|
|
169
|
-
const n = Array.from(e.entries()).map(([r,
|
|
169
|
+
const n = Array.from(e.entries()).map(([r, s]) => [
|
|
170
170
|
r,
|
|
171
|
-
ee(
|
|
171
|
+
ee(s)
|
|
172
172
|
]);
|
|
173
173
|
if (!Ne(e)) {
|
|
174
174
|
const r = Object.getPrototypeOf(e).constructor;
|
|
@@ -190,7 +190,7 @@ function ee(e) {
|
|
|
190
190
|
return t;
|
|
191
191
|
}
|
|
192
192
|
function le(e) {
|
|
193
|
-
return
|
|
193
|
+
return Q(e) ? ee(e) : e;
|
|
194
194
|
}
|
|
195
195
|
function x(e) {
|
|
196
196
|
var t;
|
|
@@ -199,90 +199,90 @@ function x(e) {
|
|
|
199
199
|
function Ve() {
|
|
200
200
|
throw new Error("Cannot modify frozen object");
|
|
201
201
|
}
|
|
202
|
-
function X(e, t, n, r,
|
|
202
|
+
function X(e, t, n, r, s) {
|
|
203
203
|
{
|
|
204
|
-
n = n ?? /* @__PURE__ */ new WeakMap(), r = r ?? [],
|
|
204
|
+
n = n ?? /* @__PURE__ */ new WeakMap(), r = r ?? [], s = s ?? [];
|
|
205
205
|
const o = n.has(e) ? n.get(e) : e;
|
|
206
206
|
if (r.length > 0) {
|
|
207
207
|
const a = r.indexOf(o);
|
|
208
208
|
if (o && typeof o == "object" && a !== -1)
|
|
209
|
-
throw r[0] === o ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${
|
|
209
|
+
throw r[0] === o ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${s.slice(0, a).map((c, u) => {
|
|
210
210
|
if (typeof c == "symbol")
|
|
211
211
|
return `[${c.toString()}]`;
|
|
212
212
|
const f = r[u];
|
|
213
213
|
return typeof c == "object" && (f instanceof Map || f instanceof Set) ? Array.from(f.keys()).indexOf(c) : c;
|
|
214
214
|
}).join("/")}`);
|
|
215
|
-
r.push(o),
|
|
215
|
+
r.push(o), s.push(t);
|
|
216
216
|
} else
|
|
217
217
|
r.push(o);
|
|
218
218
|
}
|
|
219
|
-
if (Object.isFrozen(e) ||
|
|
220
|
-
r.pop(),
|
|
219
|
+
if (Object.isFrozen(e) || Q(e)) {
|
|
220
|
+
r.pop(), s.pop();
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
223
|
-
switch (
|
|
223
|
+
switch (K(e)) {
|
|
224
224
|
case 2:
|
|
225
225
|
for (const [a, c] of e)
|
|
226
|
-
X(a, a, n, r,
|
|
226
|
+
X(a, a, n, r, s), X(c, a, n, r, s);
|
|
227
227
|
e.set = e.clear = e.delete = Ve;
|
|
228
228
|
break;
|
|
229
229
|
case 3:
|
|
230
230
|
for (const a of e)
|
|
231
|
-
X(a, a, n, r,
|
|
231
|
+
X(a, a, n, r, s);
|
|
232
232
|
e.add = e.clear = e.delete = Ve;
|
|
233
233
|
break;
|
|
234
234
|
case 1:
|
|
235
235
|
Object.freeze(e);
|
|
236
236
|
let o = 0;
|
|
237
237
|
for (const a of e)
|
|
238
|
-
X(a, o, n, r,
|
|
238
|
+
X(a, o, n, r, s), o += 1;
|
|
239
239
|
break;
|
|
240
240
|
default:
|
|
241
241
|
Object.freeze(e), Object.keys(e).forEach((a) => {
|
|
242
242
|
const c = e[a];
|
|
243
|
-
X(c, a, n, r,
|
|
243
|
+
X(c, a, n, r, s);
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
|
-
r.pop(),
|
|
246
|
+
r.pop(), s.pop();
|
|
247
247
|
}
|
|
248
248
|
function qe(e, t) {
|
|
249
|
-
const n =
|
|
249
|
+
const n = K(e);
|
|
250
250
|
if (n === 0)
|
|
251
251
|
Reflect.ownKeys(e).forEach((r) => {
|
|
252
252
|
t(r, e[r], e);
|
|
253
253
|
});
|
|
254
254
|
else if (n === 1) {
|
|
255
255
|
let r = 0;
|
|
256
|
-
for (const
|
|
257
|
-
t(r,
|
|
256
|
+
for (const s of e)
|
|
257
|
+
t(r, s, e), r += 1;
|
|
258
258
|
} else
|
|
259
|
-
e.forEach((r,
|
|
259
|
+
e.forEach((r, s) => t(s, r, e));
|
|
260
260
|
}
|
|
261
|
-
function
|
|
262
|
-
if (
|
|
261
|
+
function Pt(e, t, n) {
|
|
262
|
+
if (Q(e) || !T(e, n) || t.has(e) || Object.isFrozen(e))
|
|
263
263
|
return;
|
|
264
|
-
const r = e instanceof Set,
|
|
265
|
-
if (t.add(e), qe(e, (
|
|
264
|
+
const r = e instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
|
|
265
|
+
if (t.add(e), qe(e, (i, o) => {
|
|
266
266
|
var a;
|
|
267
|
-
if (
|
|
267
|
+
if (Q(o)) {
|
|
268
268
|
const c = h(o);
|
|
269
269
|
S(c);
|
|
270
270
|
const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
|
|
271
|
-
ae(r ?
|
|
271
|
+
ae(r ? s : e, i, u);
|
|
272
272
|
} else
|
|
273
|
-
|
|
274
|
-
}),
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
273
|
+
Pt(o, t, n);
|
|
274
|
+
}), s) {
|
|
275
|
+
const i = e, o = Array.from(i);
|
|
276
|
+
i.clear(), o.forEach((a) => {
|
|
277
|
+
i.add(s.has(a) ? s.get(a) : a);
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
function kt(e, t) {
|
|
282
282
|
const n = e.type === 3 ? e.setMap : e.copy;
|
|
283
|
-
e.finalities.revoke.length > 1 && e.assignedMap.get(t) && n &&
|
|
283
|
+
e.finalities.revoke.length > 1 && e.assignedMap.get(t) && n && Pt(F(n, t), e.finalities.handledSet, e.options);
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function Ee(e) {
|
|
286
286
|
e.type === 3 && e.copy && (e.copy.clear(), e.setMap.forEach((t) => {
|
|
287
287
|
e.copy.add(Le(t));
|
|
288
288
|
}));
|
|
@@ -290,32 +290,32 @@ function Pe(e) {
|
|
|
290
290
|
function Te(e, t, n, r) {
|
|
291
291
|
if (e.operated && e.assignedMap && e.assignedMap.size > 0 && !e.finalized) {
|
|
292
292
|
if (n && r) {
|
|
293
|
-
const
|
|
294
|
-
|
|
293
|
+
const i = Mt(e);
|
|
294
|
+
i && t(e, i, n, r);
|
|
295
295
|
}
|
|
296
296
|
e.finalized = !0;
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
function
|
|
300
|
-
const
|
|
301
|
-
|
|
299
|
+
function Qe(e, t, n, r) {
|
|
300
|
+
const s = h(n);
|
|
301
|
+
s && (s.callbacks || (s.callbacks = []), s.callbacks.push((i, o) => {
|
|
302
302
|
var a;
|
|
303
303
|
const c = e.type === 3 ? e.setMap : e.copy;
|
|
304
304
|
if (j(F(c, t), n)) {
|
|
305
|
-
let u =
|
|
306
|
-
|
|
305
|
+
let u = s.original;
|
|
306
|
+
s.copy && (u = s.copy), Ee(e), Te(e, r, i, o), e.options.enableAutoFreeze && (e.options.updatedValues = (a = e.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), e.options.updatedValues.set(u, s.original)), ae(c, t, u);
|
|
307
307
|
}
|
|
308
|
-
}), e.options.enableAutoFreeze &&
|
|
309
|
-
const
|
|
310
|
-
j(F(
|
|
308
|
+
}), e.options.enableAutoFreeze && s.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)), T(n, e.options) && e.finalities.draft.push(() => {
|
|
309
|
+
const i = e.type === 3 ? e.setMap : e.copy;
|
|
310
|
+
j(F(i, t), n) && kt(e, t);
|
|
311
311
|
});
|
|
312
312
|
}
|
|
313
|
-
function en(e, t, n, r,
|
|
314
|
-
let { original:
|
|
315
|
-
c.length <
|
|
316
|
-
for (let u = 0; u <
|
|
317
|
-
if (o.get(u.toString()) && c[u] !==
|
|
318
|
-
const f = t.concat([u]), l =
|
|
313
|
+
function en(e, t, n, r, s) {
|
|
314
|
+
let { original: i, assignedMap: o, options: a } = e, c = e.copy;
|
|
315
|
+
c.length < i.length && ([i, c] = [c, i], [n, r] = [r, n]);
|
|
316
|
+
for (let u = 0; u < i.length; u += 1)
|
|
317
|
+
if (o.get(u.toString()) && c[u] !== i[u]) {
|
|
318
|
+
const f = t.concat([u]), l = U(f, s);
|
|
319
319
|
n.push({
|
|
320
320
|
op: g.Replace,
|
|
321
321
|
path: l,
|
|
@@ -325,11 +325,11 @@ function en(e, t, n, r, i) {
|
|
|
325
325
|
op: g.Replace,
|
|
326
326
|
path: l,
|
|
327
327
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
328
|
-
value: le(
|
|
328
|
+
value: le(i[u])
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
|
-
for (let u =
|
|
332
|
-
const f = t.concat([u]), l =
|
|
331
|
+
for (let u = i.length; u < c.length; u += 1) {
|
|
332
|
+
const f = t.concat([u]), l = U(f, s);
|
|
333
333
|
n.push({
|
|
334
334
|
op: g.Add,
|
|
335
335
|
path: l,
|
|
@@ -337,18 +337,18 @@ function en(e, t, n, r, i) {
|
|
|
337
337
|
value: le(c[u])
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
|
-
if (
|
|
340
|
+
if (i.length < c.length) {
|
|
341
341
|
const { arrayLengthAssignment: u = !0 } = a.enablePatches;
|
|
342
342
|
if (u) {
|
|
343
|
-
const f = t.concat(["length"]), l =
|
|
343
|
+
const f = t.concat(["length"]), l = U(f, s);
|
|
344
344
|
r.push({
|
|
345
345
|
op: g.Replace,
|
|
346
346
|
path: l,
|
|
347
|
-
value:
|
|
347
|
+
value: i.length
|
|
348
348
|
});
|
|
349
349
|
} else
|
|
350
|
-
for (let f = c.length;
|
|
351
|
-
const l = t.concat([f - 1]), d =
|
|
350
|
+
for (let f = c.length; i.length < f; f -= 1) {
|
|
351
|
+
const l = t.concat([f - 1]), d = U(l, s);
|
|
352
352
|
r.push({
|
|
353
353
|
op: g.Remove,
|
|
354
354
|
path: d
|
|
@@ -356,25 +356,25 @@ function en(e, t, n, r, i) {
|
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
|
-
function tn({ original: e, copy: t, assignedMap: n }, r,
|
|
359
|
+
function tn({ original: e, copy: t, assignedMap: n }, r, s, i, o) {
|
|
360
360
|
n.forEach((a, c) => {
|
|
361
361
|
const u = F(e, c), f = le(F(t, c)), l = a ? te(e, c) ? g.Replace : g.Add : g.Remove;
|
|
362
362
|
if (j(u, f) && l === g.Replace)
|
|
363
363
|
return;
|
|
364
|
-
const d = r.concat(c), y =
|
|
365
|
-
|
|
364
|
+
const d = r.concat(c), y = U(d, o);
|
|
365
|
+
s.push(l === g.Remove ? { op: l, path: y } : { op: l, path: y, value: f }), i.push(l === g.Add ? { op: g.Remove, path: y } : l === g.Remove ? { op: g.Add, path: y, value: u } : { op: g.Replace, path: y, value: u });
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
|
-
function nn({ original: e, copy: t }, n, r,
|
|
368
|
+
function nn({ original: e, copy: t }, n, r, s, i) {
|
|
369
369
|
let o = 0;
|
|
370
370
|
e.forEach((a) => {
|
|
371
371
|
if (!t.has(a)) {
|
|
372
|
-
const c = n.concat([o]), u =
|
|
372
|
+
const c = n.concat([o]), u = U(c, i);
|
|
373
373
|
r.push({
|
|
374
374
|
op: g.Remove,
|
|
375
375
|
path: u,
|
|
376
376
|
value: a
|
|
377
|
-
}),
|
|
377
|
+
}), s.unshift({
|
|
378
378
|
op: g.Add,
|
|
379
379
|
path: u,
|
|
380
380
|
value: a
|
|
@@ -383,12 +383,12 @@ function nn({ original: e, copy: t }, n, r, i, s) {
|
|
|
383
383
|
o += 1;
|
|
384
384
|
}), o = 0, t.forEach((a) => {
|
|
385
385
|
if (!e.has(a)) {
|
|
386
|
-
const c = n.concat([o]), u =
|
|
386
|
+
const c = n.concat([o]), u = U(c, i);
|
|
387
387
|
r.push({
|
|
388
388
|
op: g.Add,
|
|
389
389
|
path: u,
|
|
390
390
|
value: a
|
|
391
|
-
}),
|
|
391
|
+
}), s.unshift({
|
|
392
392
|
op: g.Remove,
|
|
393
393
|
path: u,
|
|
394
394
|
value: a
|
|
@@ -398,15 +398,15 @@ function nn({ original: e, copy: t }, n, r, i, s) {
|
|
|
398
398
|
});
|
|
399
399
|
}
|
|
400
400
|
function re(e, t, n, r) {
|
|
401
|
-
const { pathAsArray:
|
|
401
|
+
const { pathAsArray: s = !0 } = e.options.enablePatches;
|
|
402
402
|
switch (e.type) {
|
|
403
403
|
case 0:
|
|
404
404
|
case 2:
|
|
405
|
-
return tn(e, t, n, r,
|
|
405
|
+
return tn(e, t, n, r, s);
|
|
406
406
|
case 1:
|
|
407
|
-
return en(e, t, n, r,
|
|
407
|
+
return en(e, t, n, r, s);
|
|
408
408
|
case 3:
|
|
409
|
-
return nn(e, t, n, r,
|
|
409
|
+
return nn(e, t, n, r, s);
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
const he = (e, t, n = !1) => {
|
|
@@ -414,14 +414,14 @@ const he = (e, t, n = !1) => {
|
|
|
414
414
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
415
415
|
}, xe = {
|
|
416
416
|
get size() {
|
|
417
|
-
return
|
|
417
|
+
return M(h(this)).size;
|
|
418
418
|
},
|
|
419
419
|
has(e) {
|
|
420
|
-
return
|
|
420
|
+
return M(h(this)).has(e);
|
|
421
421
|
},
|
|
422
422
|
set(e, t) {
|
|
423
|
-
const n = h(this), r =
|
|
424
|
-
return (!r.has(e) || !j(r.get(e), t)) && (S(n), x(n), n.assignedMap.set(e, !0), n.copy.set(e, t),
|
|
423
|
+
const n = h(this), r = M(n);
|
|
424
|
+
return (!r.has(e) || !j(r.get(e), t)) && (S(n), x(n), n.assignedMap.set(e, !0), n.copy.set(e, t), Qe(n, e, t, re)), this;
|
|
425
425
|
},
|
|
426
426
|
delete(e) {
|
|
427
427
|
if (!this.has(e))
|
|
@@ -440,17 +440,17 @@ const he = (e, t, n = !1) => {
|
|
|
440
440
|
},
|
|
441
441
|
forEach(e, t) {
|
|
442
442
|
const n = h(this);
|
|
443
|
-
|
|
444
|
-
e.call(t, this.get(
|
|
443
|
+
M(n).forEach((r, s) => {
|
|
444
|
+
e.call(t, this.get(s), s, this);
|
|
445
445
|
});
|
|
446
446
|
},
|
|
447
447
|
get(e) {
|
|
448
448
|
var t, n;
|
|
449
|
-
const r = h(this),
|
|
450
|
-
if (r.options.strict && he(
|
|
451
|
-
return
|
|
449
|
+
const r = h(this), s = M(r).get(e), i = ((n = (t = r.options).mark) === null || n === void 0 ? void 0 : n.call(t, s, C)) === C.mutable;
|
|
450
|
+
if (r.options.strict && he(s, r.options, i), i || r.finalized || !T(s, r.options) || s !== r.original.get(e))
|
|
451
|
+
return s;
|
|
452
452
|
const o = De.createDraft({
|
|
453
|
-
original:
|
|
453
|
+
original: s,
|
|
454
454
|
parentDraft: r,
|
|
455
455
|
key: e,
|
|
456
456
|
finalities: r.finalities,
|
|
@@ -459,7 +459,7 @@ const he = (e, t, n = !1) => {
|
|
|
459
459
|
return S(r), r.copy.set(e, o), o;
|
|
460
460
|
},
|
|
461
461
|
keys() {
|
|
462
|
-
return
|
|
462
|
+
return M(h(this)).keys();
|
|
463
463
|
},
|
|
464
464
|
values() {
|
|
465
465
|
const e = this.keys();
|
|
@@ -494,13 +494,13 @@ const he = (e, t, n = !1) => {
|
|
|
494
494
|
return this.entries();
|
|
495
495
|
}
|
|
496
496
|
}, rn = Reflect.ownKeys(xe), Ze = (e, t, { isValuesIterator: n }) => () => {
|
|
497
|
-
var r,
|
|
498
|
-
const
|
|
499
|
-
if (
|
|
500
|
-
return
|
|
501
|
-
const o =
|
|
497
|
+
var r, s;
|
|
498
|
+
const i = t.next();
|
|
499
|
+
if (i.done)
|
|
500
|
+
return i;
|
|
501
|
+
const o = i.value;
|
|
502
502
|
let a = e.setMap.get(o);
|
|
503
|
-
const c = h(a), u = ((
|
|
503
|
+
const c = h(a), u = ((s = (r = e.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, C)) === C.mutable;
|
|
504
504
|
if (e.options.strict && he(o, e.options, u), !u && !c && T(o, e.options) && !e.finalized && e.original.has(o)) {
|
|
505
505
|
const f = De.createDraft({
|
|
506
506
|
original: o,
|
|
@@ -529,7 +529,7 @@ const he = (e, t, n = !1) => {
|
|
|
529
529
|
},
|
|
530
530
|
add(e) {
|
|
531
531
|
const t = h(this);
|
|
532
|
-
return this.has(e) || (S(t), x(t), t.assignedMap.set(e, !0), t.setMap.set(e, e),
|
|
532
|
+
return this.has(e) || (S(t), x(t), t.assignedMap.set(e, !0), t.setMap.set(e, e), Qe(t, e, e, re)), this;
|
|
533
533
|
},
|
|
534
534
|
delete(e) {
|
|
535
535
|
if (!this.has(e))
|
|
@@ -606,19 +606,19 @@ Set.prototype.difference && Object.assign(pe, {
|
|
|
606
606
|
});
|
|
607
607
|
const sn = Reflect.ownKeys(pe), Et = {
|
|
608
608
|
get(e, t, n) {
|
|
609
|
-
var r,
|
|
610
|
-
const
|
|
611
|
-
if (
|
|
612
|
-
return
|
|
613
|
-
if (t ===
|
|
609
|
+
var r, s;
|
|
610
|
+
const i = (r = e.copy) === null || r === void 0 ? void 0 : r[t];
|
|
611
|
+
if (i && e.finalities.draftsCache.has(i))
|
|
612
|
+
return i;
|
|
613
|
+
if (t === At)
|
|
614
614
|
return e;
|
|
615
615
|
let o;
|
|
616
616
|
if (e.options.mark) {
|
|
617
617
|
const u = t === "size" && (e.original instanceof Map || e.original instanceof Set) ? Reflect.get(e.original, t) : Reflect.get(e.original, t, n);
|
|
618
|
-
if (o = e.options.mark(u,
|
|
618
|
+
if (o = e.options.mark(u, C), o === C.mutable)
|
|
619
619
|
return e.options.strict && he(u, e.options, !0), u;
|
|
620
620
|
}
|
|
621
|
-
const a =
|
|
621
|
+
const a = M(e);
|
|
622
622
|
if (a instanceof Map && rn.includes(t))
|
|
623
623
|
return t === "size" ? Object.getOwnPropertyDescriptor(xe, "size").get.call(e.proxy) : xe[t].bind(e.proxy);
|
|
624
624
|
if (a instanceof Set && sn.includes(t))
|
|
@@ -627,14 +627,14 @@ const sn = Reflect.ownKeys(pe), Et = {
|
|
|
627
627
|
const u = Ye(a, t);
|
|
628
628
|
return u ? "value" in u ? u.value : (
|
|
629
629
|
// !case: support for getter
|
|
630
|
-
(
|
|
630
|
+
(s = u.get) === null || s === void 0 ? void 0 : s.call(e.proxy)
|
|
631
631
|
) : void 0;
|
|
632
632
|
}
|
|
633
633
|
const c = a[t];
|
|
634
634
|
if (e.options.strict && he(c, e.options), e.finalized || !T(c, e.options))
|
|
635
635
|
return c;
|
|
636
636
|
if (c === Oe(e.original, t)) {
|
|
637
|
-
if (S(e), e.copy[t] =
|
|
637
|
+
if (S(e), e.copy[t] = Ge({
|
|
638
638
|
original: e.original[t],
|
|
639
639
|
parentDraft: e,
|
|
640
640
|
key: e.type === 1 ? Number(t) : t,
|
|
@@ -646,29 +646,29 @@ const sn = Reflect.ownKeys(pe), Et = {
|
|
|
646
646
|
}
|
|
647
647
|
return e.copy[t];
|
|
648
648
|
}
|
|
649
|
-
return
|
|
649
|
+
return Q(c) && e.finalities.draftsCache.add(c), c;
|
|
650
650
|
},
|
|
651
651
|
set(e, t, n) {
|
|
652
652
|
var r;
|
|
653
653
|
if (e.type === 3 || e.type === 2)
|
|
654
654
|
throw new Error("Map/Set draft does not support any property assignment.");
|
|
655
|
-
let
|
|
656
|
-
if (e.type === 1 && t !== "length" && !(Number.isInteger(
|
|
655
|
+
let s;
|
|
656
|
+
if (e.type === 1 && t !== "length" && !(Number.isInteger(s = Number(t)) && s >= 0 && (t === 0 || s === 0 || String(s) === String(t))))
|
|
657
657
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
658
|
-
const
|
|
659
|
-
if (
|
|
660
|
-
return
|
|
661
|
-
const o = Oe(
|
|
662
|
-
return a && j(a.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) : (j(n, o) && (n !== void 0 || te(e.original, t)) || (S(e), x(e), te(e.original, t) && j(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n,
|
|
658
|
+
const i = Ye(M(e), t);
|
|
659
|
+
if (i?.set)
|
|
660
|
+
return i.set.call(e.proxy, n), !0;
|
|
661
|
+
const o = Oe(M(e), t), a = h(o);
|
|
662
|
+
return a && j(a.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) : (j(n, o) && (n !== void 0 || te(e.original, t)) || (S(e), x(e), te(e.original, t) && j(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n, Qe(e, t, n, re)), !0);
|
|
663
663
|
},
|
|
664
664
|
has(e, t) {
|
|
665
|
-
return t in
|
|
665
|
+
return t in M(e);
|
|
666
666
|
},
|
|
667
667
|
ownKeys(e) {
|
|
668
|
-
return Reflect.ownKeys(
|
|
668
|
+
return Reflect.ownKeys(M(e));
|
|
669
669
|
},
|
|
670
670
|
getOwnPropertyDescriptor(e, t) {
|
|
671
|
-
const n =
|
|
671
|
+
const n = M(e), r = Reflect.getOwnPropertyDescriptor(n, t);
|
|
672
672
|
return r && {
|
|
673
673
|
writable: !0,
|
|
674
674
|
configurable: e.type !== 1 || t !== "length",
|
|
@@ -690,22 +690,22 @@ const sn = Reflect.ownKeys(pe), Et = {
|
|
|
690
690
|
return e.type === 1 ? Et.set.call(this, e, t, void 0, e.proxy) : (Oe(e.original, t) !== void 0 || t in e.original ? (S(e), x(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);
|
|
691
691
|
}
|
|
692
692
|
};
|
|
693
|
-
function
|
|
694
|
-
const { original: t, parentDraft: n, key: r, finalities:
|
|
693
|
+
function Ge(e) {
|
|
694
|
+
const { original: t, parentDraft: n, key: r, finalities: s, options: i } = e, o = K(t), a = {
|
|
695
695
|
type: o,
|
|
696
696
|
finalized: !1,
|
|
697
697
|
parent: n,
|
|
698
698
|
original: t,
|
|
699
699
|
copy: null,
|
|
700
700
|
proxy: null,
|
|
701
|
-
finalities:
|
|
702
|
-
options:
|
|
701
|
+
finalities: s,
|
|
702
|
+
options: i,
|
|
703
703
|
// Mapping of draft Set items to their corresponding draft values.
|
|
704
704
|
setMap: o === 3 ? new Map(t.entries()) : void 0
|
|
705
705
|
};
|
|
706
706
|
(r || "key" in e) && (a.key = r);
|
|
707
707
|
const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, Et);
|
|
708
|
-
if (
|
|
708
|
+
if (s.revoke.push(u), a.proxy = c, n) {
|
|
709
709
|
const f = n;
|
|
710
710
|
f.finalities.draft.push((l, d) => {
|
|
711
711
|
var y, m;
|
|
@@ -714,7 +714,7 @@ function Ue(e) {
|
|
|
714
714
|
const w = F(v, r), b = h(w);
|
|
715
715
|
if (b) {
|
|
716
716
|
let A = b.original;
|
|
717
|
-
b.operated && (A = Le(w)),
|
|
717
|
+
b.operated && (A = Le(w)), Ee(b), Te(b, re, l, d), f.options.enableAutoFreeze && (f.options.updatedValues = (y = f.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), f.options.updatedValues.set(A, b.original)), ae(v, r, A);
|
|
718
718
|
}
|
|
719
719
|
(m = O.callbacks) === null || m === void 0 || m.forEach((A) => {
|
|
720
720
|
A(l, d);
|
|
@@ -723,20 +723,20 @@ function Ue(e) {
|
|
|
723
723
|
} else {
|
|
724
724
|
const f = h(c);
|
|
725
725
|
f.finalities.draft.push((l, d) => {
|
|
726
|
-
|
|
726
|
+
Ee(f), Te(f, re, l, d);
|
|
727
727
|
});
|
|
728
728
|
}
|
|
729
729
|
return c;
|
|
730
730
|
}
|
|
731
|
-
De.createDraft =
|
|
732
|
-
function on(e, t, n, r,
|
|
733
|
-
var
|
|
734
|
-
const o = h(e), a = (
|
|
731
|
+
De.createDraft = Ge;
|
|
732
|
+
function on(e, t, n, r, s) {
|
|
733
|
+
var i;
|
|
734
|
+
const o = h(e), a = (i = o?.original) !== null && i !== void 0 ? i : e, c = !!t.length;
|
|
735
735
|
if (o?.operated)
|
|
736
736
|
for (; o.finalities.draft.length > 0; )
|
|
737
737
|
o.finalities.draft.pop()(n, r);
|
|
738
738
|
const u = c ? t[0] : o ? o.operated ? o.copy : o.original : e;
|
|
739
|
-
return o &&
|
|
739
|
+
return o && Pe(o), s && X(u, u, o?.options.updatedValues), [
|
|
740
740
|
u,
|
|
741
741
|
n && c ? [{ op: g.Replace, path: [], value: t[0] }] : n,
|
|
742
742
|
r && c ? [{ op: g.Replace, path: [], value: a }] : r
|
|
@@ -750,9 +750,9 @@ function an(e, t) {
|
|
|
750
750
|
handledSet: /* @__PURE__ */ new WeakSet(),
|
|
751
751
|
draftsCache: /* @__PURE__ */ new WeakSet()
|
|
752
752
|
};
|
|
753
|
-
let
|
|
754
|
-
t.enablePatches && (
|
|
755
|
-
const a = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e,
|
|
753
|
+
let s, i;
|
|
754
|
+
t.enablePatches && (s = [], i = []);
|
|
755
|
+
const a = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e, C)) === C.mutable || !T(e, t) ? e : Ge({
|
|
756
756
|
original: e,
|
|
757
757
|
parentDraft: null,
|
|
758
758
|
finalities: r,
|
|
@@ -761,83 +761,83 @@ function an(e, t) {
|
|
|
761
761
|
return [
|
|
762
762
|
a,
|
|
763
763
|
(c = []) => {
|
|
764
|
-
const [u, f, l] = on(a, c,
|
|
764
|
+
const [u, f, l] = on(a, c, s, i, t.enableAutoFreeze);
|
|
765
765
|
return t.enablePatches ? [u, f, l] : u;
|
|
766
766
|
}
|
|
767
767
|
];
|
|
768
768
|
}
|
|
769
|
-
function
|
|
770
|
-
const { rootDraft: t, value: n, useRawReturn: r = !1, isRoot:
|
|
771
|
-
qe(n, (
|
|
769
|
+
function Re(e) {
|
|
770
|
+
const { rootDraft: t, value: n, useRawReturn: r = !1, isRoot: s = !0 } = e;
|
|
771
|
+
qe(n, (i, o, a) => {
|
|
772
772
|
const c = h(o);
|
|
773
773
|
if (c && t && c.finalities === t.finalities) {
|
|
774
774
|
e.isContainDraft = !0;
|
|
775
775
|
const u = c.original;
|
|
776
776
|
if (a instanceof Set) {
|
|
777
777
|
const f = Array.from(a);
|
|
778
|
-
a.clear(), f.forEach((l) => a.add(
|
|
778
|
+
a.clear(), f.forEach((l) => a.add(i === l ? u : l));
|
|
779
779
|
} else
|
|
780
|
-
ae(a,
|
|
781
|
-
} else typeof o == "object" && o !== null && (e.value = o, e.isRoot = !1,
|
|
782
|
-
}),
|
|
780
|
+
ae(a, i, u);
|
|
781
|
+
} else typeof o == "object" && o !== null && (e.value = o, e.isRoot = !1, Re(e));
|
|
782
|
+
}), s && (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."));
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function Tt(e) {
|
|
785
785
|
var t;
|
|
786
786
|
const n = h(e);
|
|
787
787
|
if (!T(e, n?.options))
|
|
788
788
|
return e;
|
|
789
|
-
const r =
|
|
789
|
+
const r = K(e);
|
|
790
790
|
if (n && !n.operated)
|
|
791
791
|
return n.original;
|
|
792
|
-
let
|
|
793
|
-
function
|
|
794
|
-
|
|
792
|
+
let s;
|
|
793
|
+
function i() {
|
|
794
|
+
s = r === 2 ? Ne(e) ? new Map(e) : new (Object.getPrototypeOf(e)).constructor(e) : r === 3 ? Array.from(n.setMap.values()) : Ct(e, n?.options);
|
|
795
795
|
}
|
|
796
796
|
if (n) {
|
|
797
797
|
n.finalized = !0;
|
|
798
798
|
try {
|
|
799
|
-
|
|
799
|
+
i();
|
|
800
800
|
} finally {
|
|
801
801
|
n.finalized = !1;
|
|
802
802
|
}
|
|
803
803
|
} else
|
|
804
|
-
|
|
805
|
-
if (qe(
|
|
804
|
+
s = e;
|
|
805
|
+
if (qe(s, (o, a) => {
|
|
806
806
|
if (n && j(F(n.original, o), a))
|
|
807
807
|
return;
|
|
808
|
-
const c =
|
|
809
|
-
c !== a && (
|
|
808
|
+
const c = Tt(a);
|
|
809
|
+
c !== a && (s === e && i(), ae(s, o, c));
|
|
810
810
|
}), r === 3) {
|
|
811
|
-
const o = (t = n?.original) !== null && t !== void 0 ? t :
|
|
812
|
-
return He(o) ? new Set(
|
|
811
|
+
const o = (t = n?.original) !== null && t !== void 0 ? t : s;
|
|
812
|
+
return He(o) ? new Set(s) : new (Object.getPrototypeOf(o)).constructor(s);
|
|
813
813
|
}
|
|
814
|
-
return
|
|
814
|
+
return s;
|
|
815
815
|
}
|
|
816
816
|
function Je(e) {
|
|
817
|
-
if (!
|
|
817
|
+
if (!Q(e))
|
|
818
818
|
throw new Error(`current() is only used for Draft, parameter: ${e}`);
|
|
819
|
-
return
|
|
819
|
+
return Tt(e);
|
|
820
820
|
}
|
|
821
|
-
const cn = (e) => function t(n, r,
|
|
822
|
-
var
|
|
821
|
+
const cn = (e) => function t(n, r, s) {
|
|
822
|
+
var i, o, a;
|
|
823
823
|
if (typeof n == "function" && typeof r != "function")
|
|
824
|
-
return function(p, ...
|
|
825
|
-
return t(p, (N) => n.call(this, N, ...
|
|
824
|
+
return function(p, ...I) {
|
|
825
|
+
return t(p, (N) => n.call(this, N, ...I), r);
|
|
826
826
|
};
|
|
827
827
|
const c = n, u = r;
|
|
828
|
-
let f =
|
|
828
|
+
let f = s;
|
|
829
829
|
if (typeof r != "function" && (f = r), f !== void 0 && Object.prototype.toString.call(f) !== "[object Object]")
|
|
830
830
|
throw new Error(`Invalid options: ${f}, 'options' should be an object.`);
|
|
831
831
|
f = Object.assign(Object.assign({}, e), f);
|
|
832
|
-
const l =
|
|
832
|
+
const l = Q(c) ? Je(c) : c, d = Array.isArray(f.mark) ? ((p, I) => {
|
|
833
833
|
for (const N of f.mark) {
|
|
834
834
|
if (typeof N != "function")
|
|
835
835
|
throw new Error(`Invalid mark: ${N}, 'mark' should be a function.`);
|
|
836
|
-
const J = N(p,
|
|
836
|
+
const J = N(p, I);
|
|
837
837
|
if (J)
|
|
838
838
|
return J;
|
|
839
839
|
}
|
|
840
|
-
}) : f.mark, y = (
|
|
840
|
+
}) : f.mark, y = (i = f.enablePatches) !== null && i !== void 0 ? i : !1, m = (o = f.strict) !== null && o !== void 0 ? o : !1, v = {
|
|
841
841
|
enableAutoFreeze: (a = f.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
|
|
842
842
|
mark: d,
|
|
843
843
|
strict: m,
|
|
@@ -855,24 +855,24 @@ const cn = (e) => function t(n, r, i) {
|
|
|
855
855
|
try {
|
|
856
856
|
A = u(w);
|
|
857
857
|
} catch (p) {
|
|
858
|
-
throw
|
|
858
|
+
throw Pe(h(w)), p;
|
|
859
859
|
}
|
|
860
860
|
const G = (p) => {
|
|
861
|
-
const
|
|
862
|
-
if (!
|
|
863
|
-
if (p !== void 0 && !j(p, w) &&
|
|
861
|
+
const I = h(w);
|
|
862
|
+
if (!Q(p)) {
|
|
863
|
+
if (p !== void 0 && !j(p, w) && I?.operated)
|
|
864
864
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
865
865
|
const J = p?.[Yt];
|
|
866
866
|
if (J) {
|
|
867
|
-
const
|
|
868
|
-
return v.strict && typeof p == "object" && p !== null &&
|
|
869
|
-
rootDraft:
|
|
867
|
+
const Xt = J[0];
|
|
868
|
+
return v.strict && typeof p == "object" && p !== null && Re({
|
|
869
|
+
rootDraft: I,
|
|
870
870
|
value: p,
|
|
871
871
|
useRawReturn: !0
|
|
872
|
-
}), b([
|
|
872
|
+
}), b([Xt]);
|
|
873
873
|
}
|
|
874
874
|
if (p !== void 0)
|
|
875
|
-
return typeof p == "object" && p !== null &&
|
|
875
|
+
return typeof p == "object" && p !== null && Re({ rootDraft: I, value: p }), b([p]);
|
|
876
876
|
}
|
|
877
877
|
if (p === w || p === void 0)
|
|
878
878
|
return b([]);
|
|
@@ -885,11 +885,11 @@ const cn = (e) => function t(n, r, i) {
|
|
|
885
885
|
return b([p]);
|
|
886
886
|
};
|
|
887
887
|
return A instanceof Promise ? A.then(G, (p) => {
|
|
888
|
-
throw
|
|
888
|
+
throw Pe(h(w)), p;
|
|
889
889
|
}) : G(A);
|
|
890
|
-
},
|
|
890
|
+
}, E = cn();
|
|
891
891
|
Object.prototype.constructor.toString();
|
|
892
|
-
var
|
|
892
|
+
var xt = typeof global == "object" && global && global.Object === Object && global, un = typeof self == "object" && self && self.Object === Object && self, z = xt || un || Function("return this")(), R = z.Symbol, Rt = Object.prototype, fn = Rt.hasOwnProperty, ln = Rt.toString, k = R ? R.toStringTag : void 0;
|
|
893
893
|
function hn(e) {
|
|
894
894
|
var t = fn.call(e, k), n = e[k];
|
|
895
895
|
try {
|
|
@@ -897,14 +897,14 @@ function hn(e) {
|
|
|
897
897
|
var r = !0;
|
|
898
898
|
} catch {
|
|
899
899
|
}
|
|
900
|
-
var
|
|
901
|
-
return r && (t ? e[k] = n : delete e[k]),
|
|
900
|
+
var s = ln.call(e);
|
|
901
|
+
return r && (t ? e[k] = n : delete e[k]), s;
|
|
902
902
|
}
|
|
903
903
|
var pn = Object.prototype, dn = pn.toString;
|
|
904
904
|
function _n(e) {
|
|
905
905
|
return dn.call(e);
|
|
906
906
|
}
|
|
907
|
-
var yn = "[object Null]", bn = "[object Undefined]", ke =
|
|
907
|
+
var yn = "[object Null]", bn = "[object Undefined]", ke = R ? R.toStringTag : void 0;
|
|
908
908
|
function V(e) {
|
|
909
909
|
return e == null ? e === void 0 ? bn : yn : ke && ke in Object(e) ? hn(e) : _n(e);
|
|
910
910
|
}
|
|
@@ -916,16 +916,16 @@ function _e(e) {
|
|
|
916
916
|
return typeof e == "symbol" || Y(e) && V(e) == gn;
|
|
917
917
|
}
|
|
918
918
|
function It(e, t) {
|
|
919
|
-
for (var n = -1, r = e == null ? 0 : e.length,
|
|
920
|
-
|
|
921
|
-
return
|
|
919
|
+
for (var n = -1, r = e == null ? 0 : e.length, s = Array(r); ++n < r; )
|
|
920
|
+
s[n] = t(e[n], n, e);
|
|
921
|
+
return s;
|
|
922
922
|
}
|
|
923
|
-
var
|
|
924
|
-
function
|
|
923
|
+
var P = Array.isArray, et = R ? R.prototype : void 0, tt = et ? et.toString : void 0;
|
|
924
|
+
function jt(e) {
|
|
925
925
|
if (typeof e == "string")
|
|
926
926
|
return e;
|
|
927
|
-
if (
|
|
928
|
-
return It(e,
|
|
927
|
+
if (P(e))
|
|
928
|
+
return It(e, jt) + "";
|
|
929
929
|
if (_e(e))
|
|
930
930
|
return tt ? tt.call(e) : "";
|
|
931
931
|
var t = e + "";
|
|
@@ -941,33 +941,33 @@ var vn = /^\s+/;
|
|
|
941
941
|
function Sn(e) {
|
|
942
942
|
return e && e.slice(0, wn(e) + 1).replace(vn, "");
|
|
943
943
|
}
|
|
944
|
-
function
|
|
944
|
+
function se(e) {
|
|
945
945
|
var t = typeof e;
|
|
946
946
|
return e != null && (t == "object" || t == "function");
|
|
947
947
|
}
|
|
948
|
-
var nt = NaN, On = /^[-+]0x[0-9a-f]+$/i, An = /^0b[01]+$/i,
|
|
949
|
-
function
|
|
948
|
+
var nt = NaN, On = /^[-+]0x[0-9a-f]+$/i, An = /^0b[01]+$/i, Mn = /^0o[0-7]+$/i, Cn = parseInt;
|
|
949
|
+
function Pn(e) {
|
|
950
950
|
if (typeof e == "number")
|
|
951
951
|
return e;
|
|
952
952
|
if (_e(e))
|
|
953
953
|
return nt;
|
|
954
|
-
if (
|
|
954
|
+
if (se(e)) {
|
|
955
955
|
var t = typeof e.valueOf == "function" ? e.valueOf() : e;
|
|
956
|
-
e =
|
|
956
|
+
e = se(t) ? t + "" : t;
|
|
957
957
|
}
|
|
958
958
|
if (typeof e != "string")
|
|
959
959
|
return e === 0 ? e : +e;
|
|
960
960
|
e = Sn(e);
|
|
961
961
|
var n = An.test(e);
|
|
962
|
-
return n ||
|
|
962
|
+
return n || Mn.test(e) ? Cn(e.slice(2), n ? 2 : 8) : On.test(e) ? nt : +e;
|
|
963
963
|
}
|
|
964
|
-
var rt = 1 / 0,
|
|
964
|
+
var rt = 1 / 0, En = 17976931348623157e292;
|
|
965
965
|
function Tn(e) {
|
|
966
966
|
if (!e)
|
|
967
967
|
return e === 0 ? e : 0;
|
|
968
|
-
if (e =
|
|
968
|
+
if (e = Pn(e), e === rt || e === -rt) {
|
|
969
969
|
var t = e < 0 ? -1 : 1;
|
|
970
|
-
return t *
|
|
970
|
+
return t * En;
|
|
971
971
|
}
|
|
972
972
|
return e === e ? e : 0;
|
|
973
973
|
}
|
|
@@ -975,22 +975,22 @@ function xn(e) {
|
|
|
975
975
|
var t = Tn(e), n = t % 1;
|
|
976
976
|
return t === t ? n ? t - n : t : 0;
|
|
977
977
|
}
|
|
978
|
-
function
|
|
978
|
+
function Rn(e) {
|
|
979
979
|
return e;
|
|
980
980
|
}
|
|
981
|
-
var
|
|
982
|
-
function
|
|
983
|
-
if (!
|
|
981
|
+
var In = "[object AsyncFunction]", jn = "[object Function]", $n = "[object GeneratorFunction]", Fn = "[object Proxy]";
|
|
982
|
+
function $t(e) {
|
|
983
|
+
if (!se(e))
|
|
984
984
|
return !1;
|
|
985
985
|
var t = V(e);
|
|
986
|
-
return t == jn || t == $n || t ==
|
|
986
|
+
return t == jn || t == $n || t == In || t == Fn;
|
|
987
987
|
}
|
|
988
|
-
var Ae = z["__core-js_shared__"],
|
|
988
|
+
var Ae = z["__core-js_shared__"], st = (function() {
|
|
989
989
|
var e = /[^.]+$/.exec(Ae && Ae.keys && Ae.keys.IE_PROTO || "");
|
|
990
990
|
return e ? "Symbol(src)_1." + e : "";
|
|
991
991
|
})();
|
|
992
992
|
function zn(e) {
|
|
993
|
-
return !!
|
|
993
|
+
return !!st && st in e;
|
|
994
994
|
}
|
|
995
995
|
var Dn = Function.prototype, Hn = Dn.toString;
|
|
996
996
|
function W(e) {
|
|
@@ -1006,13 +1006,13 @@ function W(e) {
|
|
|
1006
1006
|
}
|
|
1007
1007
|
return "";
|
|
1008
1008
|
}
|
|
1009
|
-
var Nn = /[\\^$.*+?()[\]{}|]/g, Ln = /^\[object .+?Constructor\]$/, qn = Function.prototype,
|
|
1010
|
-
"^" +
|
|
1009
|
+
var Nn = /[\\^$.*+?()[\]{}|]/g, Ln = /^\[object .+?Constructor\]$/, qn = Function.prototype, Qn = Object.prototype, Gn = qn.toString, Un = Qn.hasOwnProperty, Bn = RegExp(
|
|
1010
|
+
"^" + Gn.call(Un).replace(Nn, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
1011
1011
|
);
|
|
1012
|
-
function
|
|
1013
|
-
if (!
|
|
1012
|
+
function Kn(e) {
|
|
1013
|
+
if (!se(e) || zn(e))
|
|
1014
1014
|
return !1;
|
|
1015
|
-
var t =
|
|
1015
|
+
var t = $t(e) ? Bn : Ln;
|
|
1016
1016
|
return t.test(W(e));
|
|
1017
1017
|
}
|
|
1018
1018
|
function Wn(e, t) {
|
|
@@ -1020,29 +1020,29 @@ function Wn(e, t) {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
function Z(e, t) {
|
|
1022
1022
|
var n = Wn(e, t);
|
|
1023
|
-
return
|
|
1023
|
+
return Kn(n) ? n : void 0;
|
|
1024
1024
|
}
|
|
1025
|
-
var
|
|
1025
|
+
var Ie = Z(z, "WeakMap");
|
|
1026
1026
|
function Xn(e, t, n, r) {
|
|
1027
|
-
for (var
|
|
1028
|
-
if (t(e[
|
|
1029
|
-
return
|
|
1027
|
+
for (var s = e.length, i = n + -1; ++i < s; )
|
|
1028
|
+
if (t(e[i], i, e))
|
|
1029
|
+
return i;
|
|
1030
1030
|
return -1;
|
|
1031
1031
|
}
|
|
1032
1032
|
var Yn = 9007199254740991, Vn = /^(?:0|[1-9]\d*)$/;
|
|
1033
|
-
function
|
|
1033
|
+
function Ft(e, t) {
|
|
1034
1034
|
var n = typeof e;
|
|
1035
1035
|
return t = t ?? Yn, !!t && (n == "number" || n != "symbol" && Vn.test(e)) && e > -1 && e % 1 == 0 && e < t;
|
|
1036
1036
|
}
|
|
1037
|
-
function
|
|
1037
|
+
function zt(e, t) {
|
|
1038
1038
|
return e === t || e !== e && t !== t;
|
|
1039
1039
|
}
|
|
1040
1040
|
var Zn = 9007199254740991;
|
|
1041
|
-
function
|
|
1041
|
+
function Ue(e) {
|
|
1042
1042
|
return typeof e == "number" && e > -1 && e % 1 == 0 && e <= Zn;
|
|
1043
1043
|
}
|
|
1044
1044
|
function ye(e) {
|
|
1045
|
-
return e != null &&
|
|
1045
|
+
return e != null && Ue(e.length) && !$t(e);
|
|
1046
1046
|
}
|
|
1047
1047
|
var Jn = Object.prototype;
|
|
1048
1048
|
function kn(e) {
|
|
@@ -1055,43 +1055,43 @@ function er(e, t) {
|
|
|
1055
1055
|
return r;
|
|
1056
1056
|
}
|
|
1057
1057
|
var tr = "[object Arguments]";
|
|
1058
|
-
function
|
|
1058
|
+
function it(e) {
|
|
1059
1059
|
return Y(e) && V(e) == tr;
|
|
1060
1060
|
}
|
|
1061
|
-
var
|
|
1061
|
+
var Dt = Object.prototype, nr = Dt.hasOwnProperty, rr = Dt.propertyIsEnumerable, Be = it(/* @__PURE__ */ (function() {
|
|
1062
1062
|
return arguments;
|
|
1063
|
-
})()) ?
|
|
1063
|
+
})()) ? it : function(e) {
|
|
1064
1064
|
return Y(e) && nr.call(e, "callee") && !rr.call(e, "callee");
|
|
1065
1065
|
};
|
|
1066
|
-
function
|
|
1066
|
+
function sr() {
|
|
1067
1067
|
return !1;
|
|
1068
1068
|
}
|
|
1069
|
-
var
|
|
1070
|
-
_[Sr] = _[Or] = _[Ar] = _[
|
|
1069
|
+
var Ht = typeof exports == "object" && exports && !exports.nodeType && exports, ot = Ht && typeof module == "object" && module && !module.nodeType && module, ir = ot && ot.exports === Ht, at = ir ? z.Buffer : void 0, or = at ? at.isBuffer : void 0, je = or || sr, ar = "[object Arguments]", cr = "[object Array]", ur = "[object Boolean]", fr = "[object Date]", lr = "[object Error]", hr = "[object Function]", pr = "[object Map]", dr = "[object Number]", _r = "[object Object]", yr = "[object RegExp]", br = "[object Set]", gr = "[object String]", mr = "[object WeakMap]", wr = "[object ArrayBuffer]", vr = "[object DataView]", Sr = "[object Float32Array]", Or = "[object Float64Array]", Ar = "[object Int8Array]", Mr = "[object Int16Array]", Cr = "[object Int32Array]", Pr = "[object Uint8Array]", Er = "[object Uint8ClampedArray]", Tr = "[object Uint16Array]", xr = "[object Uint32Array]", _ = {};
|
|
1070
|
+
_[Sr] = _[Or] = _[Ar] = _[Mr] = _[Cr] = _[Pr] = _[Er] = _[Tr] = _[xr] = !0;
|
|
1071
1071
|
_[ar] = _[cr] = _[wr] = _[ur] = _[vr] = _[fr] = _[lr] = _[hr] = _[pr] = _[dr] = _[_r] = _[yr] = _[br] = _[gr] = _[mr] = !1;
|
|
1072
|
-
function Ir(e) {
|
|
1073
|
-
return Y(e) && Be(e.length) && !!_[V(e)];
|
|
1074
|
-
}
|
|
1075
1072
|
function Rr(e) {
|
|
1073
|
+
return Y(e) && Ue(e.length) && !!_[V(e)];
|
|
1074
|
+
}
|
|
1075
|
+
function Ir(e) {
|
|
1076
1076
|
return function(t) {
|
|
1077
1077
|
return e(t);
|
|
1078
1078
|
};
|
|
1079
1079
|
}
|
|
1080
|
-
var
|
|
1080
|
+
var Nt = typeof exports == "object" && exports && !exports.nodeType && exports, ne = Nt && typeof module == "object" && module && !module.nodeType && module, jr = ne && ne.exports === Nt, Me = jr && xt.process, ct = (function() {
|
|
1081
1081
|
try {
|
|
1082
1082
|
var e = ne && ne.require && ne.require("util").types;
|
|
1083
|
-
return e ||
|
|
1083
|
+
return e || Me && Me.binding && Me.binding("util");
|
|
1084
1084
|
} catch {
|
|
1085
1085
|
}
|
|
1086
|
-
})(), ut = ct && ct.isTypedArray,
|
|
1086
|
+
})(), ut = ct && ct.isTypedArray, Lt = ut ? Ir(ut) : Rr, $r = Object.prototype, Fr = $r.hasOwnProperty;
|
|
1087
1087
|
function zr(e, t) {
|
|
1088
|
-
var n =
|
|
1088
|
+
var n = P(e), r = !n && Be(e), s = !n && !r && je(e), i = !n && !r && !s && Lt(e), o = n || r || s || i, a = o ? er(e.length, String) : [], c = a.length;
|
|
1089
1089
|
for (var u in e)
|
|
1090
1090
|
Fr.call(e, u) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1091
1091
|
(u == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1092
|
+
s && (u == "offset" || u == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1093
|
+
i && (u == "buffer" || u == "byteLength" || u == "byteOffset") || // Skip index properties.
|
|
1094
|
+
Ft(u, c))) && a.push(u);
|
|
1095
1095
|
return a;
|
|
1096
1096
|
}
|
|
1097
1097
|
function Dr(e, t) {
|
|
@@ -1111,77 +1111,77 @@ function qr(e) {
|
|
|
1111
1111
|
function be(e) {
|
|
1112
1112
|
return ye(e) ? zr(e) : qr(e);
|
|
1113
1113
|
}
|
|
1114
|
-
var
|
|
1115
|
-
function
|
|
1116
|
-
if (
|
|
1114
|
+
var Qr = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Gr = /^\w*$/;
|
|
1115
|
+
function Ke(e, t) {
|
|
1116
|
+
if (P(e))
|
|
1117
1117
|
return !1;
|
|
1118
1118
|
var n = typeof e;
|
|
1119
|
-
return n == "number" || n == "symbol" || n == "boolean" || e == null || _e(e) ? !0 :
|
|
1119
|
+
return n == "number" || n == "symbol" || n == "boolean" || e == null || _e(e) ? !0 : Gr.test(e) || !Qr.test(e) || t != null && e in Object(t);
|
|
1120
1120
|
}
|
|
1121
|
-
var
|
|
1122
|
-
function
|
|
1123
|
-
this.__data__ =
|
|
1121
|
+
var ie = Z(Object, "create");
|
|
1122
|
+
function Ur() {
|
|
1123
|
+
this.__data__ = ie ? ie(null) : {}, this.size = 0;
|
|
1124
1124
|
}
|
|
1125
|
-
function
|
|
1125
|
+
function Br(e) {
|
|
1126
1126
|
var t = this.has(e) && delete this.__data__[e];
|
|
1127
1127
|
return this.size -= t ? 1 : 0, t;
|
|
1128
1128
|
}
|
|
1129
|
-
var
|
|
1129
|
+
var Kr = "__lodash_hash_undefined__", Wr = Object.prototype, Xr = Wr.hasOwnProperty;
|
|
1130
1130
|
function Yr(e) {
|
|
1131
1131
|
var t = this.__data__;
|
|
1132
|
-
if (
|
|
1132
|
+
if (ie) {
|
|
1133
1133
|
var n = t[e];
|
|
1134
|
-
return n ===
|
|
1134
|
+
return n === Kr ? void 0 : n;
|
|
1135
1135
|
}
|
|
1136
1136
|
return Xr.call(t, e) ? t[e] : void 0;
|
|
1137
1137
|
}
|
|
1138
1138
|
var Vr = Object.prototype, Zr = Vr.hasOwnProperty;
|
|
1139
1139
|
function Jr(e) {
|
|
1140
1140
|
var t = this.__data__;
|
|
1141
|
-
return
|
|
1141
|
+
return ie ? t[e] !== void 0 : Zr.call(t, e);
|
|
1142
1142
|
}
|
|
1143
1143
|
var kr = "__lodash_hash_undefined__";
|
|
1144
|
-
function
|
|
1144
|
+
function es(e, t) {
|
|
1145
1145
|
var n = this.__data__;
|
|
1146
|
-
return this.size += this.has(e) ? 0 : 1, n[e] =
|
|
1146
|
+
return this.size += this.has(e) ? 0 : 1, n[e] = ie && t === void 0 ? kr : t, this;
|
|
1147
1147
|
}
|
|
1148
|
-
function
|
|
1148
|
+
function B(e) {
|
|
1149
1149
|
var t = -1, n = e == null ? 0 : e.length;
|
|
1150
1150
|
for (this.clear(); ++t < n; ) {
|
|
1151
1151
|
var r = e[t];
|
|
1152
1152
|
this.set(r[0], r[1]);
|
|
1153
1153
|
}
|
|
1154
1154
|
}
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
function
|
|
1155
|
+
B.prototype.clear = Ur;
|
|
1156
|
+
B.prototype.delete = Br;
|
|
1157
|
+
B.prototype.get = Yr;
|
|
1158
|
+
B.prototype.has = Jr;
|
|
1159
|
+
B.prototype.set = es;
|
|
1160
|
+
function ts() {
|
|
1161
1161
|
this.__data__ = [], this.size = 0;
|
|
1162
1162
|
}
|
|
1163
1163
|
function ge(e, t) {
|
|
1164
1164
|
for (var n = e.length; n--; )
|
|
1165
|
-
if (
|
|
1165
|
+
if (zt(e[n][0], t))
|
|
1166
1166
|
return n;
|
|
1167
1167
|
return -1;
|
|
1168
1168
|
}
|
|
1169
|
-
var
|
|
1170
|
-
function
|
|
1169
|
+
var ns = Array.prototype, rs = ns.splice;
|
|
1170
|
+
function ss(e) {
|
|
1171
1171
|
var t = this.__data__, n = ge(t, e);
|
|
1172
1172
|
if (n < 0)
|
|
1173
1173
|
return !1;
|
|
1174
1174
|
var r = t.length - 1;
|
|
1175
|
-
return n == r ? t.pop() :
|
|
1175
|
+
return n == r ? t.pop() : rs.call(t, n, 1), --this.size, !0;
|
|
1176
1176
|
}
|
|
1177
|
-
function
|
|
1177
|
+
function is(e) {
|
|
1178
1178
|
var t = this.__data__, n = ge(t, e);
|
|
1179
1179
|
return n < 0 ? void 0 : t[n][1];
|
|
1180
1180
|
}
|
|
1181
|
-
function
|
|
1181
|
+
function os(e) {
|
|
1182
1182
|
return ge(this.__data__, e) > -1;
|
|
1183
1183
|
}
|
|
1184
|
-
function
|
|
1184
|
+
function as(e, t) {
|
|
1185
1185
|
var n = this.__data__, r = ge(n, e);
|
|
1186
1186
|
return r < 0 ? (++this.size, n.push([e, t])) : n[r][1] = t, this;
|
|
1187
1187
|
}
|
|
@@ -1192,38 +1192,38 @@ function D(e) {
|
|
|
1192
1192
|
this.set(r[0], r[1]);
|
|
1193
1193
|
}
|
|
1194
1194
|
}
|
|
1195
|
-
D.prototype.clear =
|
|
1196
|
-
D.prototype.delete =
|
|
1197
|
-
D.prototype.get =
|
|
1198
|
-
D.prototype.has =
|
|
1199
|
-
D.prototype.set =
|
|
1195
|
+
D.prototype.clear = ts;
|
|
1196
|
+
D.prototype.delete = ss;
|
|
1197
|
+
D.prototype.get = is;
|
|
1198
|
+
D.prototype.has = os;
|
|
1199
|
+
D.prototype.set = as;
|
|
1200
1200
|
var oe = Z(z, "Map");
|
|
1201
|
-
function
|
|
1201
|
+
function cs() {
|
|
1202
1202
|
this.size = 0, this.__data__ = {
|
|
1203
|
-
hash: new
|
|
1203
|
+
hash: new B(),
|
|
1204
1204
|
map: new (oe || D)(),
|
|
1205
|
-
string: new
|
|
1205
|
+
string: new B()
|
|
1206
1206
|
};
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1208
|
+
function us(e) {
|
|
1209
1209
|
var t = typeof e;
|
|
1210
1210
|
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
|
|
1211
1211
|
}
|
|
1212
1212
|
function me(e, t) {
|
|
1213
1213
|
var n = e.__data__;
|
|
1214
|
-
return
|
|
1214
|
+
return us(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
|
|
1215
1215
|
}
|
|
1216
|
-
function
|
|
1216
|
+
function fs(e) {
|
|
1217
1217
|
var t = me(this, e).delete(e);
|
|
1218
1218
|
return this.size -= t ? 1 : 0, t;
|
|
1219
1219
|
}
|
|
1220
|
-
function
|
|
1220
|
+
function ls(e) {
|
|
1221
1221
|
return me(this, e).get(e);
|
|
1222
1222
|
}
|
|
1223
|
-
function
|
|
1223
|
+
function hs(e) {
|
|
1224
1224
|
return me(this, e).has(e);
|
|
1225
1225
|
}
|
|
1226
|
-
function
|
|
1226
|
+
function ps(e, t) {
|
|
1227
1227
|
var n = me(this, e), r = n.size;
|
|
1228
1228
|
return n.set(e, t), this.size += n.size == r ? 0 : 1, this;
|
|
1229
1229
|
}
|
|
@@ -1234,43 +1234,43 @@ function H(e) {
|
|
|
1234
1234
|
this.set(r[0], r[1]);
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
|
-
H.prototype.clear =
|
|
1238
|
-
H.prototype.delete =
|
|
1239
|
-
H.prototype.get =
|
|
1240
|
-
H.prototype.has =
|
|
1241
|
-
H.prototype.set =
|
|
1242
|
-
var
|
|
1237
|
+
H.prototype.clear = cs;
|
|
1238
|
+
H.prototype.delete = fs;
|
|
1239
|
+
H.prototype.get = ls;
|
|
1240
|
+
H.prototype.has = hs;
|
|
1241
|
+
H.prototype.set = ps;
|
|
1242
|
+
var ds = "Expected a function";
|
|
1243
1243
|
function We(e, t) {
|
|
1244
1244
|
if (typeof e != "function" || t != null && typeof t != "function")
|
|
1245
|
-
throw new TypeError(
|
|
1245
|
+
throw new TypeError(ds);
|
|
1246
1246
|
var n = function() {
|
|
1247
|
-
var r = arguments,
|
|
1248
|
-
if (
|
|
1249
|
-
return
|
|
1247
|
+
var r = arguments, s = t ? t.apply(this, r) : r[0], i = n.cache;
|
|
1248
|
+
if (i.has(s))
|
|
1249
|
+
return i.get(s);
|
|
1250
1250
|
var o = e.apply(this, r);
|
|
1251
|
-
return n.cache =
|
|
1251
|
+
return n.cache = i.set(s, o) || i, o;
|
|
1252
1252
|
};
|
|
1253
1253
|
return n.cache = new (We.Cache || H)(), n;
|
|
1254
1254
|
}
|
|
1255
1255
|
We.Cache = H;
|
|
1256
|
-
var
|
|
1257
|
-
function
|
|
1256
|
+
var _s = 500;
|
|
1257
|
+
function ys(e) {
|
|
1258
1258
|
var t = We(e, function(r) {
|
|
1259
|
-
return n.size ===
|
|
1259
|
+
return n.size === _s && n.clear(), r;
|
|
1260
1260
|
}), n = t.cache;
|
|
1261
1261
|
return t;
|
|
1262
1262
|
}
|
|
1263
|
-
var
|
|
1263
|
+
var bs = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, gs = /\\(\\)?/g, ms = ys(function(e) {
|
|
1264
1264
|
var t = [];
|
|
1265
|
-
return e.charCodeAt(0) === 46 && t.push(""), e.replace(
|
|
1266
|
-
t.push(
|
|
1265
|
+
return e.charCodeAt(0) === 46 && t.push(""), e.replace(bs, function(n, r, s, i) {
|
|
1266
|
+
t.push(s ? i.replace(gs, "$1") : r || n);
|
|
1267
1267
|
}), t;
|
|
1268
1268
|
});
|
|
1269
|
-
function
|
|
1270
|
-
return e == null ? "" :
|
|
1269
|
+
function ws(e) {
|
|
1270
|
+
return e == null ? "" : jt(e);
|
|
1271
1271
|
}
|
|
1272
|
-
function
|
|
1273
|
-
return
|
|
1272
|
+
function qt(e, t) {
|
|
1273
|
+
return P(e) ? e : Ke(e, t) ? [e] : ms(ws(e));
|
|
1274
1274
|
}
|
|
1275
1275
|
function we(e) {
|
|
1276
1276
|
if (typeof e == "string" || _e(e))
|
|
@@ -1278,52 +1278,52 @@ function we(e) {
|
|
|
1278
1278
|
var t = e + "";
|
|
1279
1279
|
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
|
|
1280
1280
|
}
|
|
1281
|
-
function
|
|
1282
|
-
t =
|
|
1281
|
+
function Qt(e, t) {
|
|
1282
|
+
t = qt(t, e);
|
|
1283
1283
|
for (var n = 0, r = t.length; e != null && n < r; )
|
|
1284
1284
|
e = e[we(t[n++])];
|
|
1285
1285
|
return n && n == r ? e : void 0;
|
|
1286
1286
|
}
|
|
1287
|
-
function
|
|
1288
|
-
var r = e == null ? void 0 :
|
|
1287
|
+
function vs(e, t, n) {
|
|
1288
|
+
var r = e == null ? void 0 : Qt(e, t);
|
|
1289
1289
|
return r === void 0 ? n : r;
|
|
1290
1290
|
}
|
|
1291
1291
|
function Gt(e, t) {
|
|
1292
|
-
for (var n = -1, r = t.length,
|
|
1293
|
-
e[
|
|
1292
|
+
for (var n = -1, r = t.length, s = e.length; ++n < r; )
|
|
1293
|
+
e[s + n] = t[n];
|
|
1294
1294
|
return e;
|
|
1295
1295
|
}
|
|
1296
|
-
var ft =
|
|
1297
|
-
function
|
|
1298
|
-
return
|
|
1296
|
+
var ft = R ? R.isConcatSpreadable : void 0;
|
|
1297
|
+
function Ss(e) {
|
|
1298
|
+
return P(e) || Be(e) || !!(ft && e && e[ft]);
|
|
1299
1299
|
}
|
|
1300
|
-
function
|
|
1301
|
-
var
|
|
1302
|
-
for (n || (n =
|
|
1303
|
-
var a = e[
|
|
1304
|
-
n(a) ? Gt(
|
|
1300
|
+
function Os(e, t, n, r, s) {
|
|
1301
|
+
var i = -1, o = e.length;
|
|
1302
|
+
for (n || (n = Ss), s || (s = []); ++i < o; ) {
|
|
1303
|
+
var a = e[i];
|
|
1304
|
+
n(a) ? Gt(s, a) : s[s.length] = a;
|
|
1305
1305
|
}
|
|
1306
|
-
return
|
|
1306
|
+
return s;
|
|
1307
1307
|
}
|
|
1308
|
-
function
|
|
1308
|
+
function As() {
|
|
1309
1309
|
this.__data__ = new D(), this.size = 0;
|
|
1310
1310
|
}
|
|
1311
|
-
function
|
|
1311
|
+
function Ms(e) {
|
|
1312
1312
|
var t = this.__data__, n = t.delete(e);
|
|
1313
1313
|
return this.size = t.size, n;
|
|
1314
1314
|
}
|
|
1315
|
-
function
|
|
1315
|
+
function Cs(e) {
|
|
1316
1316
|
return this.__data__.get(e);
|
|
1317
1317
|
}
|
|
1318
|
-
function
|
|
1318
|
+
function Ps(e) {
|
|
1319
1319
|
return this.__data__.has(e);
|
|
1320
1320
|
}
|
|
1321
|
-
var
|
|
1322
|
-
function
|
|
1321
|
+
var Es = 200;
|
|
1322
|
+
function Ts(e, t) {
|
|
1323
1323
|
var n = this.__data__;
|
|
1324
1324
|
if (n instanceof D) {
|
|
1325
1325
|
var r = n.__data__;
|
|
1326
|
-
if (!oe || r.length <
|
|
1326
|
+
if (!oe || r.length < Es - 1)
|
|
1327
1327
|
return r.push([e, t]), this.size = ++n.size, this;
|
|
1328
1328
|
n = this.__data__ = new H(r);
|
|
1329
1329
|
}
|
|
@@ -1333,56 +1333,56 @@ function $(e) {
|
|
|
1333
1333
|
var t = this.__data__ = new D(e);
|
|
1334
1334
|
this.size = t.size;
|
|
1335
1335
|
}
|
|
1336
|
-
$.prototype.clear =
|
|
1337
|
-
$.prototype.delete =
|
|
1338
|
-
$.prototype.get =
|
|
1339
|
-
$.prototype.has =
|
|
1340
|
-
$.prototype.set =
|
|
1341
|
-
function
|
|
1342
|
-
for (var n = -1, r = e == null ? 0 : e.length,
|
|
1336
|
+
$.prototype.clear = As;
|
|
1337
|
+
$.prototype.delete = Ms;
|
|
1338
|
+
$.prototype.get = Cs;
|
|
1339
|
+
$.prototype.has = Ps;
|
|
1340
|
+
$.prototype.set = Ts;
|
|
1341
|
+
function xs(e, t) {
|
|
1342
|
+
for (var n = -1, r = e == null ? 0 : e.length, s = 0, i = []; ++n < r; ) {
|
|
1343
1343
|
var o = e[n];
|
|
1344
|
-
t(o, n, e) && (s
|
|
1344
|
+
t(o, n, e) && (i[s++] = o);
|
|
1345
1345
|
}
|
|
1346
|
-
return
|
|
1346
|
+
return i;
|
|
1347
1347
|
}
|
|
1348
|
-
function
|
|
1348
|
+
function Rs() {
|
|
1349
1349
|
return [];
|
|
1350
1350
|
}
|
|
1351
|
-
var
|
|
1352
|
-
return e == null ? [] : (e = Object(e),
|
|
1353
|
-
return
|
|
1351
|
+
var Is = Object.prototype, js = Is.propertyIsEnumerable, lt = Object.getOwnPropertySymbols, $s = lt ? function(e) {
|
|
1352
|
+
return e == null ? [] : (e = Object(e), xs(lt(e), function(t) {
|
|
1353
|
+
return js.call(e, t);
|
|
1354
1354
|
}));
|
|
1355
|
-
} :
|
|
1356
|
-
function
|
|
1355
|
+
} : Rs;
|
|
1356
|
+
function Fs(e, t, n) {
|
|
1357
1357
|
var r = t(e);
|
|
1358
|
-
return
|
|
1358
|
+
return P(e) ? r : Gt(r, n(e));
|
|
1359
1359
|
}
|
|
1360
1360
|
function ht(e) {
|
|
1361
|
-
return
|
|
1361
|
+
return Fs(e, be, $s);
|
|
1362
1362
|
}
|
|
1363
|
-
var $e = Z(z, "DataView"), Fe = Z(z, "Promise"), ze = Z(z, "Set"), pt = "[object Map]",
|
|
1364
|
-
($e && L(new $e(new ArrayBuffer(1))) != bt || oe && L(new oe()) != pt || Fe && L(Fe.resolve()) != dt || ze && L(new ze()) != _t ||
|
|
1365
|
-
var t = V(e), n = t ==
|
|
1363
|
+
var $e = Z(z, "DataView"), Fe = Z(z, "Promise"), ze = Z(z, "Set"), pt = "[object Map]", zs = "[object Object]", dt = "[object Promise]", _t = "[object Set]", yt = "[object WeakMap]", bt = "[object DataView]", Ds = W($e), Hs = W(oe), Ns = W(Fe), Ls = W(ze), qs = W(Ie), L = V;
|
|
1364
|
+
($e && L(new $e(new ArrayBuffer(1))) != bt || oe && L(new oe()) != pt || Fe && L(Fe.resolve()) != dt || ze && L(new ze()) != _t || Ie && L(new Ie()) != yt) && (L = function(e) {
|
|
1365
|
+
var t = V(e), n = t == zs ? e.constructor : void 0, r = n ? W(n) : "";
|
|
1366
1366
|
if (r)
|
|
1367
1367
|
switch (r) {
|
|
1368
|
-
case
|
|
1368
|
+
case Ds:
|
|
1369
1369
|
return bt;
|
|
1370
|
-
case
|
|
1370
|
+
case Hs:
|
|
1371
1371
|
return pt;
|
|
1372
|
-
case
|
|
1372
|
+
case Ns:
|
|
1373
1373
|
return dt;
|
|
1374
|
-
case
|
|
1374
|
+
case Ls:
|
|
1375
1375
|
return _t;
|
|
1376
|
-
case
|
|
1376
|
+
case qs:
|
|
1377
1377
|
return yt;
|
|
1378
1378
|
}
|
|
1379
1379
|
return t;
|
|
1380
1380
|
});
|
|
1381
|
-
var gt = z.Uint8Array,
|
|
1382
|
-
function
|
|
1383
|
-
return this.__data__.set(e,
|
|
1381
|
+
var gt = z.Uint8Array, Qs = "__lodash_hash_undefined__";
|
|
1382
|
+
function Gs(e) {
|
|
1383
|
+
return this.__data__.set(e, Qs), this;
|
|
1384
1384
|
}
|
|
1385
|
-
function
|
|
1385
|
+
function Us(e) {
|
|
1386
1386
|
return this.__data__.has(e);
|
|
1387
1387
|
}
|
|
1388
1388
|
function de(e) {
|
|
@@ -1390,30 +1390,30 @@ function de(e) {
|
|
|
1390
1390
|
for (this.__data__ = new H(); ++t < n; )
|
|
1391
1391
|
this.add(e[t]);
|
|
1392
1392
|
}
|
|
1393
|
-
de.prototype.add = de.prototype.push =
|
|
1394
|
-
de.prototype.has =
|
|
1395
|
-
function
|
|
1393
|
+
de.prototype.add = de.prototype.push = Gs;
|
|
1394
|
+
de.prototype.has = Us;
|
|
1395
|
+
function Bs(e, t) {
|
|
1396
1396
|
for (var n = -1, r = e == null ? 0 : e.length; ++n < r; )
|
|
1397
1397
|
if (t(e[n], n, e))
|
|
1398
1398
|
return !0;
|
|
1399
1399
|
return !1;
|
|
1400
1400
|
}
|
|
1401
|
-
function
|
|
1401
|
+
function Ks(e, t) {
|
|
1402
1402
|
return e.has(t);
|
|
1403
1403
|
}
|
|
1404
|
-
var
|
|
1405
|
-
function Ut(e, t, n, r,
|
|
1406
|
-
var o = n &
|
|
1404
|
+
var Ws = 1, Xs = 2;
|
|
1405
|
+
function Ut(e, t, n, r, s, i) {
|
|
1406
|
+
var o = n & Ws, a = e.length, c = t.length;
|
|
1407
1407
|
if (a != c && !(o && c > a))
|
|
1408
1408
|
return !1;
|
|
1409
|
-
var u =
|
|
1409
|
+
var u = i.get(e), f = i.get(t);
|
|
1410
1410
|
if (u && f)
|
|
1411
1411
|
return u == t && f == e;
|
|
1412
|
-
var l = -1, d = !0, y = n &
|
|
1413
|
-
for (
|
|
1412
|
+
var l = -1, d = !0, y = n & Xs ? new de() : void 0;
|
|
1413
|
+
for (i.set(e, t), i.set(t, e); ++l < a; ) {
|
|
1414
1414
|
var m = e[l], O = t[l];
|
|
1415
1415
|
if (r)
|
|
1416
|
-
var v = o ? r(O, m, l, t, e,
|
|
1416
|
+
var v = o ? r(O, m, l, t, e, i) : r(m, O, l, e, t, i);
|
|
1417
1417
|
if (v !== void 0) {
|
|
1418
1418
|
if (v)
|
|
1419
1419
|
continue;
|
|
@@ -1421,89 +1421,89 @@ function Ut(e, t, n, r, i, s) {
|
|
|
1421
1421
|
break;
|
|
1422
1422
|
}
|
|
1423
1423
|
if (y) {
|
|
1424
|
-
if (!
|
|
1425
|
-
if (!
|
|
1424
|
+
if (!Bs(t, function(w, b) {
|
|
1425
|
+
if (!Ks(y, b) && (m === w || s(m, w, n, r, i)))
|
|
1426
1426
|
return y.push(b);
|
|
1427
1427
|
})) {
|
|
1428
1428
|
d = !1;
|
|
1429
1429
|
break;
|
|
1430
1430
|
}
|
|
1431
|
-
} else if (!(m === O ||
|
|
1431
|
+
} else if (!(m === O || s(m, O, n, r, i))) {
|
|
1432
1432
|
d = !1;
|
|
1433
1433
|
break;
|
|
1434
1434
|
}
|
|
1435
1435
|
}
|
|
1436
|
-
return
|
|
1436
|
+
return i.delete(e), i.delete(t), d;
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1438
|
+
function Ys(e) {
|
|
1439
1439
|
var t = -1, n = Array(e.size);
|
|
1440
|
-
return e.forEach(function(r,
|
|
1441
|
-
n[++t] = [
|
|
1440
|
+
return e.forEach(function(r, s) {
|
|
1441
|
+
n[++t] = [s, r];
|
|
1442
1442
|
}), n;
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1444
|
+
function Vs(e) {
|
|
1445
1445
|
var t = -1, n = Array(e.size);
|
|
1446
1446
|
return e.forEach(function(r) {
|
|
1447
1447
|
n[++t] = r;
|
|
1448
1448
|
}), n;
|
|
1449
1449
|
}
|
|
1450
|
-
var
|
|
1451
|
-
function
|
|
1450
|
+
var Zs = 1, Js = 2, ks = "[object Boolean]", ei = "[object Date]", ti = "[object Error]", ni = "[object Map]", ri = "[object Number]", si = "[object RegExp]", ii = "[object Set]", oi = "[object String]", ai = "[object Symbol]", ci = "[object ArrayBuffer]", ui = "[object DataView]", mt = R ? R.prototype : void 0, Ce = mt ? mt.valueOf : void 0;
|
|
1451
|
+
function fi(e, t, n, r, s, i, o) {
|
|
1452
1452
|
switch (n) {
|
|
1453
|
-
case
|
|
1453
|
+
case ui:
|
|
1454
1454
|
if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset)
|
|
1455
1455
|
return !1;
|
|
1456
1456
|
e = e.buffer, t = t.buffer;
|
|
1457
|
-
case
|
|
1458
|
-
return !(e.byteLength != t.byteLength || !
|
|
1459
|
-
case
|
|
1460
|
-
case
|
|
1461
|
-
case
|
|
1462
|
-
return
|
|
1463
|
-
case
|
|
1457
|
+
case ci:
|
|
1458
|
+
return !(e.byteLength != t.byteLength || !i(new gt(e), new gt(t)));
|
|
1459
|
+
case ks:
|
|
1460
|
+
case ei:
|
|
1461
|
+
case ri:
|
|
1462
|
+
return zt(+e, +t);
|
|
1463
|
+
case ti:
|
|
1464
1464
|
return e.name == t.name && e.message == t.message;
|
|
1465
|
-
case
|
|
1466
|
-
case
|
|
1465
|
+
case si:
|
|
1466
|
+
case oi:
|
|
1467
1467
|
return e == t + "";
|
|
1468
|
-
case
|
|
1469
|
-
var a =
|
|
1470
|
-
case
|
|
1471
|
-
var c = r &
|
|
1472
|
-
if (a || (a =
|
|
1468
|
+
case ni:
|
|
1469
|
+
var a = Ys;
|
|
1470
|
+
case ii:
|
|
1471
|
+
var c = r & Zs;
|
|
1472
|
+
if (a || (a = Vs), e.size != t.size && !c)
|
|
1473
1473
|
return !1;
|
|
1474
1474
|
var u = o.get(e);
|
|
1475
1475
|
if (u)
|
|
1476
1476
|
return u == t;
|
|
1477
|
-
r |=
|
|
1478
|
-
var f = Ut(a(e), a(t), r,
|
|
1477
|
+
r |= Js, o.set(e, t);
|
|
1478
|
+
var f = Ut(a(e), a(t), r, s, i, o);
|
|
1479
1479
|
return o.delete(e), f;
|
|
1480
|
-
case
|
|
1481
|
-
if (
|
|
1482
|
-
return
|
|
1480
|
+
case ai:
|
|
1481
|
+
if (Ce)
|
|
1482
|
+
return Ce.call(e) == Ce.call(t);
|
|
1483
1483
|
}
|
|
1484
1484
|
return !1;
|
|
1485
1485
|
}
|
|
1486
|
-
var
|
|
1487
|
-
function
|
|
1488
|
-
var o = n &
|
|
1486
|
+
var li = 1, hi = Object.prototype, pi = hi.hasOwnProperty;
|
|
1487
|
+
function di(e, t, n, r, s, i) {
|
|
1488
|
+
var o = n & li, a = ht(e), c = a.length, u = ht(t), f = u.length;
|
|
1489
1489
|
if (c != f && !o)
|
|
1490
1490
|
return !1;
|
|
1491
1491
|
for (var l = c; l--; ) {
|
|
1492
1492
|
var d = a[l];
|
|
1493
|
-
if (!(o ? d in t :
|
|
1493
|
+
if (!(o ? d in t : pi.call(t, d)))
|
|
1494
1494
|
return !1;
|
|
1495
1495
|
}
|
|
1496
|
-
var y =
|
|
1496
|
+
var y = i.get(e), m = i.get(t);
|
|
1497
1497
|
if (y && m)
|
|
1498
1498
|
return y == t && m == e;
|
|
1499
1499
|
var O = !0;
|
|
1500
|
-
|
|
1500
|
+
i.set(e, t), i.set(t, e);
|
|
1501
1501
|
for (var v = o; ++l < c; ) {
|
|
1502
1502
|
d = a[l];
|
|
1503
1503
|
var w = e[d], b = t[d];
|
|
1504
1504
|
if (r)
|
|
1505
|
-
var A = o ? r(b, w, d, t, e,
|
|
1506
|
-
if (!(A === void 0 ? w === b ||
|
|
1505
|
+
var A = o ? r(b, w, d, t, e, i) : r(w, b, d, e, t, i);
|
|
1506
|
+
if (!(A === void 0 ? w === b || s(w, b, n, r, i) : A)) {
|
|
1507
1507
|
O = !1;
|
|
1508
1508
|
break;
|
|
1509
1509
|
}
|
|
@@ -1513,11 +1513,11 @@ function ds(e, t, n, r, i, s) {
|
|
|
1513
1513
|
var G = e.constructor, p = t.constructor;
|
|
1514
1514
|
G != p && "constructor" in e && "constructor" in t && !(typeof G == "function" && G instanceof G && typeof p == "function" && p instanceof p) && (O = !1);
|
|
1515
1515
|
}
|
|
1516
|
-
return
|
|
1516
|
+
return i.delete(e), i.delete(t), O;
|
|
1517
1517
|
}
|
|
1518
|
-
var
|
|
1519
|
-
function
|
|
1520
|
-
var o =
|
|
1518
|
+
var _i = 1, wt = "[object Arguments]", vt = "[object Array]", ce = "[object Object]", yi = Object.prototype, St = yi.hasOwnProperty;
|
|
1519
|
+
function bi(e, t, n, r, s, i) {
|
|
1520
|
+
var o = P(e), a = P(t), c = o ? vt : L(e), u = a ? vt : L(t);
|
|
1521
1521
|
c = c == wt ? ce : c, u = u == wt ? ce : u;
|
|
1522
1522
|
var f = c == ce, l = u == ce, d = c == u;
|
|
1523
1523
|
if (d && je(e)) {
|
|
@@ -1526,50 +1526,50 @@ function bs(e, t, n, r, i, s) {
|
|
|
1526
1526
|
o = !0, f = !1;
|
|
1527
1527
|
}
|
|
1528
1528
|
if (d && !f)
|
|
1529
|
-
return
|
|
1530
|
-
if (!(n &
|
|
1529
|
+
return i || (i = new $()), o || Lt(e) ? Ut(e, t, n, r, s, i) : fi(e, t, c, n, r, s, i);
|
|
1530
|
+
if (!(n & _i)) {
|
|
1531
1531
|
var y = f && St.call(e, "__wrapped__"), m = l && St.call(t, "__wrapped__");
|
|
1532
1532
|
if (y || m) {
|
|
1533
1533
|
var O = y ? e.value() : e, v = m ? t.value() : t;
|
|
1534
|
-
return
|
|
1534
|
+
return i || (i = new $()), s(O, v, n, r, i);
|
|
1535
1535
|
}
|
|
1536
1536
|
}
|
|
1537
|
-
return d ? (
|
|
1537
|
+
return d ? (i || (i = new $()), di(e, t, n, r, s, i)) : !1;
|
|
1538
1538
|
}
|
|
1539
|
-
function ve(e, t, n, r,
|
|
1540
|
-
return e === t ? !0 : e == null || t == null || !Y(e) && !Y(t) ? e !== e && t !== t :
|
|
1539
|
+
function ve(e, t, n, r, s) {
|
|
1540
|
+
return e === t ? !0 : e == null || t == null || !Y(e) && !Y(t) ? e !== e && t !== t : bi(e, t, n, r, ve, s);
|
|
1541
1541
|
}
|
|
1542
|
-
var
|
|
1543
|
-
function
|
|
1544
|
-
var
|
|
1542
|
+
var gi = 1, mi = 2;
|
|
1543
|
+
function wi(e, t, n, r) {
|
|
1544
|
+
var s = n.length, i = s;
|
|
1545
1545
|
if (e == null)
|
|
1546
|
-
return !
|
|
1547
|
-
for (e = Object(e);
|
|
1548
|
-
var o = n[
|
|
1546
|
+
return !i;
|
|
1547
|
+
for (e = Object(e); s--; ) {
|
|
1548
|
+
var o = n[s];
|
|
1549
1549
|
if (o[2] ? o[1] !== e[o[0]] : !(o[0] in e))
|
|
1550
1550
|
return !1;
|
|
1551
1551
|
}
|
|
1552
|
-
for (; ++
|
|
1553
|
-
o = n[
|
|
1552
|
+
for (; ++s < i; ) {
|
|
1553
|
+
o = n[s];
|
|
1554
1554
|
var a = o[0], c = e[a], u = o[1];
|
|
1555
1555
|
if (o[2]) {
|
|
1556
1556
|
if (c === void 0 && !(a in e))
|
|
1557
1557
|
return !1;
|
|
1558
1558
|
} else {
|
|
1559
1559
|
var f = new $(), l;
|
|
1560
|
-
if (!(l === void 0 ? ve(u, c,
|
|
1560
|
+
if (!(l === void 0 ? ve(u, c, gi | mi, r, f) : l))
|
|
1561
1561
|
return !1;
|
|
1562
1562
|
}
|
|
1563
1563
|
}
|
|
1564
1564
|
return !0;
|
|
1565
1565
|
}
|
|
1566
1566
|
function Bt(e) {
|
|
1567
|
-
return e === e && !
|
|
1567
|
+
return e === e && !se(e);
|
|
1568
1568
|
}
|
|
1569
|
-
function
|
|
1569
|
+
function vi(e) {
|
|
1570
1570
|
for (var t = be(e), n = t.length; n--; ) {
|
|
1571
|
-
var r = t[n],
|
|
1572
|
-
t[n] = [r,
|
|
1571
|
+
var r = t[n], s = e[r];
|
|
1572
|
+
t[n] = [r, s, Bt(s)];
|
|
1573
1573
|
}
|
|
1574
1574
|
return t;
|
|
1575
1575
|
}
|
|
@@ -1578,148 +1578,148 @@ function Kt(e, t) {
|
|
|
1578
1578
|
return n == null ? !1 : n[e] === t && (t !== void 0 || e in Object(n));
|
|
1579
1579
|
};
|
|
1580
1580
|
}
|
|
1581
|
-
function
|
|
1582
|
-
var t =
|
|
1581
|
+
function Si(e) {
|
|
1582
|
+
var t = vi(e);
|
|
1583
1583
|
return t.length == 1 && t[0][2] ? Kt(t[0][0], t[0][1]) : function(n) {
|
|
1584
|
-
return n === e ||
|
|
1584
|
+
return n === e || wi(n, e, t);
|
|
1585
1585
|
};
|
|
1586
1586
|
}
|
|
1587
|
-
function
|
|
1587
|
+
function Oi(e, t) {
|
|
1588
1588
|
return e != null && t in Object(e);
|
|
1589
1589
|
}
|
|
1590
|
-
function
|
|
1591
|
-
t =
|
|
1592
|
-
for (var r = -1,
|
|
1590
|
+
function Ai(e, t, n) {
|
|
1591
|
+
t = qt(t, e);
|
|
1592
|
+
for (var r = -1, s = t.length, i = !1; ++r < s; ) {
|
|
1593
1593
|
var o = we(t[r]);
|
|
1594
|
-
if (!(
|
|
1594
|
+
if (!(i = e != null && n(e, o)))
|
|
1595
1595
|
break;
|
|
1596
1596
|
e = e[o];
|
|
1597
1597
|
}
|
|
1598
|
-
return
|
|
1598
|
+
return i || ++r != s ? i : (s = e == null ? 0 : e.length, !!s && Ue(s) && Ft(o, s) && (P(e) || Be(e)));
|
|
1599
1599
|
}
|
|
1600
|
-
function
|
|
1601
|
-
return e != null &&
|
|
1600
|
+
function Mi(e, t) {
|
|
1601
|
+
return e != null && Ai(e, t, Oi);
|
|
1602
1602
|
}
|
|
1603
|
-
var
|
|
1604
|
-
function
|
|
1605
|
-
return
|
|
1606
|
-
var r =
|
|
1607
|
-
return r === void 0 && r === t ?
|
|
1603
|
+
var Ci = 1, Pi = 2;
|
|
1604
|
+
function Ei(e, t) {
|
|
1605
|
+
return Ke(e) && Bt(t) ? Kt(we(e), t) : function(n) {
|
|
1606
|
+
var r = vs(n, e);
|
|
1607
|
+
return r === void 0 && r === t ? Mi(n, e) : ve(t, r, Ci | Pi);
|
|
1608
1608
|
};
|
|
1609
1609
|
}
|
|
1610
|
-
function
|
|
1610
|
+
function Ti(e) {
|
|
1611
1611
|
return function(t) {
|
|
1612
1612
|
return t?.[e];
|
|
1613
1613
|
};
|
|
1614
1614
|
}
|
|
1615
|
-
function
|
|
1615
|
+
function xi(e) {
|
|
1616
1616
|
return function(t) {
|
|
1617
|
-
return
|
|
1617
|
+
return Qt(t, e);
|
|
1618
1618
|
};
|
|
1619
1619
|
}
|
|
1620
|
-
function
|
|
1621
|
-
return
|
|
1620
|
+
function Ri(e) {
|
|
1621
|
+
return Ke(e) ? Ti(we(e)) : xi(e);
|
|
1622
1622
|
}
|
|
1623
1623
|
function Se(e) {
|
|
1624
|
-
return typeof e == "function" ? e : e == null ?
|
|
1624
|
+
return typeof e == "function" ? e : e == null ? Rn : typeof e == "object" ? P(e) ? Ei(e[0], e[1]) : Si(e) : Ri(e);
|
|
1625
1625
|
}
|
|
1626
|
-
function
|
|
1626
|
+
function Ii(e) {
|
|
1627
1627
|
return function(t, n, r) {
|
|
1628
|
-
for (var
|
|
1629
|
-
var c = o[++
|
|
1630
|
-
if (n(
|
|
1628
|
+
for (var s = -1, i = Object(t), o = r(t), a = o.length; a--; ) {
|
|
1629
|
+
var c = o[++s];
|
|
1630
|
+
if (n(i[c], c, i) === !1)
|
|
1631
1631
|
break;
|
|
1632
1632
|
}
|
|
1633
1633
|
return t;
|
|
1634
1634
|
};
|
|
1635
1635
|
}
|
|
1636
|
-
var
|
|
1637
|
-
function $
|
|
1638
|
-
return e &&
|
|
1636
|
+
var ji = Ii();
|
|
1637
|
+
function $i(e, t) {
|
|
1638
|
+
return e && ji(e, t, be);
|
|
1639
1639
|
}
|
|
1640
|
-
function
|
|
1640
|
+
function Fi(e, t) {
|
|
1641
1641
|
return function(n, r) {
|
|
1642
1642
|
if (n == null)
|
|
1643
1643
|
return n;
|
|
1644
1644
|
if (!ye(n))
|
|
1645
1645
|
return e(n, r);
|
|
1646
|
-
for (var
|
|
1646
|
+
for (var s = n.length, i = -1, o = Object(n); ++i < s && r(o[i], i, o) !== !1; )
|
|
1647
1647
|
;
|
|
1648
1648
|
return n;
|
|
1649
1649
|
};
|
|
1650
1650
|
}
|
|
1651
|
-
var
|
|
1652
|
-
function
|
|
1651
|
+
var Wt = Fi($i);
|
|
1652
|
+
function zi(e) {
|
|
1653
1653
|
var t = e == null ? 0 : e.length;
|
|
1654
1654
|
return t ? e[t - 1] : void 0;
|
|
1655
1655
|
}
|
|
1656
|
-
function
|
|
1656
|
+
function Di(e, t) {
|
|
1657
1657
|
for (var n = -1, r = e == null ? 0 : e.length; ++n < r; )
|
|
1658
1658
|
if (!t(e[n], n, e))
|
|
1659
1659
|
return !1;
|
|
1660
1660
|
return !0;
|
|
1661
1661
|
}
|
|
1662
|
-
function
|
|
1662
|
+
function Hi(e, t) {
|
|
1663
1663
|
var n = !0;
|
|
1664
|
-
return
|
|
1665
|
-
return n = !!t(r,
|
|
1664
|
+
return Wt(e, function(r, s, i) {
|
|
1665
|
+
return n = !!t(r, s, i), n;
|
|
1666
1666
|
}), n;
|
|
1667
1667
|
}
|
|
1668
|
-
function
|
|
1669
|
-
var r =
|
|
1668
|
+
function Ni(e, t, n) {
|
|
1669
|
+
var r = P(e) ? Di : Hi;
|
|
1670
1670
|
return r(e, Se(t));
|
|
1671
1671
|
}
|
|
1672
|
-
function
|
|
1672
|
+
function Li(e) {
|
|
1673
1673
|
return function(t, n, r) {
|
|
1674
|
-
var
|
|
1674
|
+
var s = Object(t);
|
|
1675
1675
|
if (!ye(t)) {
|
|
1676
|
-
var
|
|
1676
|
+
var i = Se(n);
|
|
1677
1677
|
t = be(t), n = function(a) {
|
|
1678
|
-
return s
|
|
1678
|
+
return i(s[a], a, s);
|
|
1679
1679
|
};
|
|
1680
1680
|
}
|
|
1681
1681
|
var o = e(t, n, r);
|
|
1682
|
-
return o > -1 ? i
|
|
1682
|
+
return o > -1 ? s[i ? t[o] : o] : void 0;
|
|
1683
1683
|
};
|
|
1684
1684
|
}
|
|
1685
|
-
var
|
|
1686
|
-
function
|
|
1685
|
+
var qi = Math.max;
|
|
1686
|
+
function Qi(e, t, n) {
|
|
1687
1687
|
var r = e == null ? 0 : e.length;
|
|
1688
1688
|
if (!r)
|
|
1689
1689
|
return -1;
|
|
1690
|
-
var
|
|
1691
|
-
return
|
|
1690
|
+
var s = n == null ? 0 : xn(n);
|
|
1691
|
+
return s < 0 && (s = qi(r + s, 0)), Xn(e, Se(t), s);
|
|
1692
1692
|
}
|
|
1693
|
-
var
|
|
1694
|
-
function
|
|
1693
|
+
var Gi = Li(Qi);
|
|
1694
|
+
function Ui(e, t) {
|
|
1695
1695
|
var n = -1, r = ye(e) ? Array(e.length) : [];
|
|
1696
|
-
return
|
|
1697
|
-
r[++n] = t(
|
|
1696
|
+
return Wt(e, function(s, i, o) {
|
|
1697
|
+
r[++n] = t(s, i, o);
|
|
1698
1698
|
}), r;
|
|
1699
1699
|
}
|
|
1700
|
-
function
|
|
1701
|
-
var n =
|
|
1700
|
+
function Bi(e, t) {
|
|
1701
|
+
var n = P(e) ? It : Ui;
|
|
1702
1702
|
return n(e, Se(t));
|
|
1703
1703
|
}
|
|
1704
|
-
function
|
|
1705
|
-
return
|
|
1704
|
+
function Ki(e, t) {
|
|
1705
|
+
return Os(Bi(e, t));
|
|
1706
1706
|
}
|
|
1707
|
-
function
|
|
1707
|
+
function Wi(e) {
|
|
1708
1708
|
for (var t = -1, n = e == null ? 0 : e.length, r = {}; ++t < n; ) {
|
|
1709
|
-
var
|
|
1710
|
-
r[
|
|
1709
|
+
var s = e[t];
|
|
1710
|
+
r[s[0]] = s[1];
|
|
1711
1711
|
}
|
|
1712
1712
|
return r;
|
|
1713
1713
|
}
|
|
1714
|
-
function
|
|
1714
|
+
function Xi(e, t) {
|
|
1715
1715
|
return ve(e, t);
|
|
1716
1716
|
}
|
|
1717
|
-
const
|
|
1717
|
+
const Yi = (e, t) => {
|
|
1718
1718
|
if (!e.length) return [t];
|
|
1719
|
-
const n =
|
|
1719
|
+
const n = zi(e);
|
|
1720
1720
|
return n.type === "create" && t.type === "delete" ? null : n.type === "create" && t.type === "update" ? [{ ...n, data: t.data }] : n.type === "update" && t.type === "update" ? [...e.slice(0, -1), t] : n.type === "update" && t.type === "delete" ? [...e, t] : [t];
|
|
1721
1721
|
};
|
|
1722
|
-
class
|
|
1722
|
+
class Vi {
|
|
1723
1723
|
_config;
|
|
1724
1724
|
_state;
|
|
1725
1725
|
_subscribers = /* @__PURE__ */ new Set();
|
|
@@ -1736,8 +1736,8 @@ class Vs {
|
|
|
1736
1736
|
}
|
|
1737
1737
|
enqueue(t) {
|
|
1738
1738
|
this._updateState((n) => {
|
|
1739
|
-
const r = [...n.queue.get(t.id) ?? []],
|
|
1740
|
-
|
|
1739
|
+
const r = [...n.queue.get(t.id) ?? []], s = Yi(r, t);
|
|
1740
|
+
s ? n.queue.set(t.id, s) : n.queue.delete(t.id), n.errors.delete(t.id);
|
|
1741
1741
|
}), this._scheduleFlush();
|
|
1742
1742
|
}
|
|
1743
1743
|
pause() {
|
|
@@ -1753,8 +1753,8 @@ class Vs {
|
|
|
1753
1753
|
retryAll() {
|
|
1754
1754
|
const t = this._state.errors;
|
|
1755
1755
|
t.size !== 0 && (this._updateState((n) => {
|
|
1756
|
-
for (const [r,
|
|
1757
|
-
n.queue.has(r) || n.queue.set(r,
|
|
1756
|
+
for (const [r, s] of t)
|
|
1757
|
+
n.queue.has(r) || n.queue.set(r, s.operations);
|
|
1758
1758
|
n.errors.clear();
|
|
1759
1759
|
}), this._scheduleFlush());
|
|
1760
1760
|
}
|
|
@@ -1770,6 +1770,15 @@ class Vs {
|
|
|
1770
1770
|
r && (r.retries = 0);
|
|
1771
1771
|
});
|
|
1772
1772
|
}
|
|
1773
|
+
destroy() {
|
|
1774
|
+
this._clearTimer(), this._abortController?.abort("SyncQueue destroyed"), this._abortController = null, this._subscribers.clear(), this._state = {
|
|
1775
|
+
queue: /* @__PURE__ */ new Map(),
|
|
1776
|
+
inFlight: /* @__PURE__ */ new Map(),
|
|
1777
|
+
errors: /* @__PURE__ */ new Map(),
|
|
1778
|
+
isPaused: !1,
|
|
1779
|
+
isSyncing: !1
|
|
1780
|
+
};
|
|
1781
|
+
}
|
|
1773
1782
|
getState() {
|
|
1774
1783
|
return this._state;
|
|
1775
1784
|
}
|
|
@@ -1777,7 +1786,7 @@ class Vs {
|
|
|
1777
1786
|
return this._subscribers.add(t), () => this._subscribers.delete(t);
|
|
1778
1787
|
}
|
|
1779
1788
|
_updateState(t) {
|
|
1780
|
-
this._state =
|
|
1789
|
+
this._state = E(this._state, t), this._subscribers.forEach((n) => n());
|
|
1781
1790
|
}
|
|
1782
1791
|
_scheduleFlush() {
|
|
1783
1792
|
this._state.isPaused || this._state.isSyncing || (this._clearTimer(), this._debounceTimer = setTimeout(() => this._flush(), this._config.debounce));
|
|
@@ -1788,61 +1797,61 @@ class Vs {
|
|
|
1788
1797
|
async _flush() {
|
|
1789
1798
|
const { isPaused: t, isSyncing: n, queue: r } = this._state;
|
|
1790
1799
|
if (t || n || r.size === 0) return;
|
|
1791
|
-
this._updateState((
|
|
1792
|
-
|
|
1800
|
+
this._updateState((i) => {
|
|
1801
|
+
i.inFlight = new Map(r), i.queue = /* @__PURE__ */ new Map(), i.isSyncing = !0;
|
|
1793
1802
|
});
|
|
1794
|
-
const
|
|
1803
|
+
const s = Ki([...this._state.inFlight.values()]);
|
|
1795
1804
|
this._abortController = new AbortController();
|
|
1796
1805
|
try {
|
|
1797
|
-
const
|
|
1798
|
-
this._processResults(
|
|
1799
|
-
} catch (
|
|
1800
|
-
this._handleError(
|
|
1806
|
+
const i = await this._config.onSync(s, this._abortController.signal);
|
|
1807
|
+
this._processResults(Wi(i.map((o) => [o.id, o])));
|
|
1808
|
+
} catch (i) {
|
|
1809
|
+
this._handleError(i);
|
|
1801
1810
|
}
|
|
1802
1811
|
this._abortController = null, this._state.queue.size > 0 && !this._state.isPaused && this._scheduleFlush();
|
|
1803
1812
|
}
|
|
1804
1813
|
_processResults(t) {
|
|
1805
1814
|
const n = this._state.inFlight, r = [];
|
|
1806
|
-
this._updateState((
|
|
1807
|
-
for (const [
|
|
1808
|
-
if (
|
|
1809
|
-
|
|
1815
|
+
this._updateState((s) => {
|
|
1816
|
+
for (const [i, o] of n)
|
|
1817
|
+
if (Ni(o, (c) => t[c.id]?.status === "success")) {
|
|
1818
|
+
s.errors.delete(i);
|
|
1810
1819
|
for (const c of o) {
|
|
1811
1820
|
const u = t[c.id];
|
|
1812
1821
|
c.type === "create" && u?.newId && u.newId !== c.id && r.push({ tempId: c.id, newId: u.newId });
|
|
1813
1822
|
}
|
|
1814
1823
|
} else {
|
|
1815
|
-
const c = (
|
|
1816
|
-
c < this._config.maxRetries && !
|
|
1817
|
-
const u =
|
|
1818
|
-
|
|
1824
|
+
const c = (s.errors.get(i)?.retries ?? 0) + 1;
|
|
1825
|
+
c < this._config.maxRetries && !s.queue.has(i) && s.queue.set(i, o);
|
|
1826
|
+
const u = Gi(o, (f) => t[f.id]?.status !== "success");
|
|
1827
|
+
s.errors.set(i, {
|
|
1819
1828
|
error: t[u?.id ?? ""]?.error ?? "Unknown error",
|
|
1820
1829
|
retries: c,
|
|
1821
1830
|
operations: o
|
|
1822
1831
|
});
|
|
1823
1832
|
}
|
|
1824
|
-
|
|
1833
|
+
s.inFlight = /* @__PURE__ */ new Map(), s.isSyncing = !1;
|
|
1825
1834
|
}), r.length > 0 && this._config.onIdRemap && this._config.onIdRemap(r);
|
|
1826
1835
|
}
|
|
1827
1836
|
_handleError(t) {
|
|
1828
|
-
const n = this._state.inFlight, r = this._abortController?.signal.aborted,
|
|
1829
|
-
this._updateState((
|
|
1837
|
+
const n = this._state.inFlight, r = this._abortController?.signal.aborted, s = t instanceof Error ? t.message : String(t);
|
|
1838
|
+
this._updateState((i) => {
|
|
1830
1839
|
for (const [o, a] of n)
|
|
1831
1840
|
if (r)
|
|
1832
|
-
|
|
1841
|
+
i.queue.has(o) || i.queue.set(o, a);
|
|
1833
1842
|
else {
|
|
1834
|
-
const c = (
|
|
1835
|
-
c < this._config.maxRetries && !
|
|
1836
|
-
error:
|
|
1843
|
+
const c = (i.errors.get(o)?.retries ?? 0) + 1;
|
|
1844
|
+
c < this._config.maxRetries && !i.queue.has(o) && i.queue.set(o, a), i.errors.set(o, {
|
|
1845
|
+
error: s,
|
|
1837
1846
|
retries: c,
|
|
1838
1847
|
operations: a
|
|
1839
1848
|
});
|
|
1840
1849
|
}
|
|
1841
|
-
|
|
1850
|
+
i.inFlight = /* @__PURE__ */ new Map(), i.isSyncing = !1;
|
|
1842
1851
|
});
|
|
1843
1852
|
}
|
|
1844
1853
|
}
|
|
1845
|
-
class
|
|
1854
|
+
class Zi {
|
|
1846
1855
|
_cache = /* @__PURE__ */ new Map();
|
|
1847
1856
|
_capacity;
|
|
1848
1857
|
_ttl;
|
|
@@ -1875,7 +1884,7 @@ class Zs {
|
|
|
1875
1884
|
return this._cache.size;
|
|
1876
1885
|
}
|
|
1877
1886
|
}
|
|
1878
|
-
class
|
|
1887
|
+
class Ji {
|
|
1879
1888
|
_config;
|
|
1880
1889
|
_cache;
|
|
1881
1890
|
_state = { status: "idle", items: [] };
|
|
@@ -1883,43 +1892,43 @@ class Js {
|
|
|
1883
1892
|
_abortController = null;
|
|
1884
1893
|
_currentContext = null;
|
|
1885
1894
|
constructor(t) {
|
|
1886
|
-
this._config = { retries: 0, ...t }, this._cache = new
|
|
1895
|
+
this._config = { retries: 0, ...t }, this._cache = new Zi(t.cacheCapacity, t.cacheTtl);
|
|
1887
1896
|
}
|
|
1888
1897
|
_getCacheKey = (t) => JSON.stringify([this._config.id, t]);
|
|
1889
1898
|
_setState(t) {
|
|
1890
|
-
this._state =
|
|
1899
|
+
this._state = E(this._state, (n) => {
|
|
1891
1900
|
Object.assign(n, t);
|
|
1892
1901
|
}), this._subscribers.forEach((n) => n());
|
|
1893
1902
|
}
|
|
1894
1903
|
async _fetchWithRetry(t, n) {
|
|
1895
1904
|
const r = this._config.retries;
|
|
1896
|
-
let
|
|
1897
|
-
for (let
|
|
1905
|
+
let s;
|
|
1906
|
+
for (let i = 0; i <= r; i++) {
|
|
1898
1907
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
1899
1908
|
try {
|
|
1900
|
-
return
|
|
1909
|
+
return i > 0 && this._setState({ retryCount: i }), await this._config.onFetch(t, n);
|
|
1901
1910
|
} catch (o) {
|
|
1902
|
-
if (
|
|
1911
|
+
if (s = o, n.aborted || i === r) throw o;
|
|
1903
1912
|
}
|
|
1904
1913
|
}
|
|
1905
|
-
throw
|
|
1914
|
+
throw s;
|
|
1906
1915
|
}
|
|
1907
1916
|
async fetch(t) {
|
|
1908
1917
|
const n = this._getCacheKey(t), r = this._cache.get(n);
|
|
1909
1918
|
if (r !== null)
|
|
1910
1919
|
return this._currentContext = t, this._setState({ status: "idle", items: r, error: void 0, retryCount: void 0 }), r;
|
|
1911
1920
|
this._abortController?.abort("New fetch request started");
|
|
1912
|
-
const
|
|
1913
|
-
this._abortController =
|
|
1921
|
+
const s = new AbortController();
|
|
1922
|
+
this._abortController = s, this._currentContext = t, this._setState({ status: "fetching", error: void 0, retryCount: void 0 });
|
|
1914
1923
|
try {
|
|
1915
|
-
const
|
|
1916
|
-
return this._cache.set(n,
|
|
1917
|
-
} catch (
|
|
1918
|
-
if (
|
|
1924
|
+
const i = await this._fetchWithRetry(t, s.signal);
|
|
1925
|
+
return this._cache.set(n, i), this._abortController = null, this._setState({ status: "idle", items: i, error: void 0, retryCount: void 0 }), i;
|
|
1926
|
+
} catch (i) {
|
|
1927
|
+
if (s.signal.aborted) return this._state.items;
|
|
1919
1928
|
throw this._abortController = null, this._setState({
|
|
1920
1929
|
status: "error",
|
|
1921
|
-
error:
|
|
1922
|
-
}),
|
|
1930
|
+
error: i instanceof Error ? i.message : String(i)
|
|
1931
|
+
}), i;
|
|
1923
1932
|
}
|
|
1924
1933
|
}
|
|
1925
1934
|
async refresh(t) {
|
|
@@ -1933,6 +1942,9 @@ class Js {
|
|
|
1933
1942
|
invalidateCacheForContext(t) {
|
|
1934
1943
|
this._cache.invalidate(this._getCacheKey(t));
|
|
1935
1944
|
}
|
|
1945
|
+
destroy() {
|
|
1946
|
+
this._abortController?.abort("FetchHandler destroyed"), this._abortController = null, this._cache.clear(), this._subscribers.clear(), this._currentContext = null, this._state = { status: "idle", items: [] };
|
|
1947
|
+
}
|
|
1936
1948
|
getState = () => this._state;
|
|
1937
1949
|
getContext = () => this._currentContext;
|
|
1938
1950
|
isFetching = () => this._state.status === "fetching";
|
|
@@ -1942,24 +1954,13 @@ class Js {
|
|
|
1942
1954
|
};
|
|
1943
1955
|
}
|
|
1944
1956
|
}
|
|
1945
|
-
class
|
|
1957
|
+
class Ot {
|
|
1946
1958
|
_collection;
|
|
1947
1959
|
_id;
|
|
1948
1960
|
_cachedStatus = null;
|
|
1949
|
-
_refCount = 0;
|
|
1950
1961
|
constructor(t, n) {
|
|
1951
1962
|
this._collection = t, this._id = n;
|
|
1952
1963
|
}
|
|
1953
|
-
// Reference counting for lifecycle management
|
|
1954
|
-
_retain() {
|
|
1955
|
-
this._refCount++;
|
|
1956
|
-
}
|
|
1957
|
-
_release() {
|
|
1958
|
-
this._refCount--, this._refCount <= 0 && this._collection._releaseItem(this._id);
|
|
1959
|
-
}
|
|
1960
|
-
get refCount() {
|
|
1961
|
-
return this._refCount;
|
|
1962
|
-
}
|
|
1963
1964
|
get id() {
|
|
1964
1965
|
return this._id;
|
|
1965
1966
|
}
|
|
@@ -1974,7 +1975,7 @@ class ks {
|
|
|
1974
1975
|
}
|
|
1975
1976
|
getStatus() {
|
|
1976
1977
|
const t = this._collection.getItemStatus(this._id);
|
|
1977
|
-
return
|
|
1978
|
+
return Xi(this._cachedStatus, t) || (this._cachedStatus = t), this._cachedStatus;
|
|
1978
1979
|
}
|
|
1979
1980
|
exists() {
|
|
1980
1981
|
return this._collection.getState().items.has(this._id);
|
|
@@ -1989,50 +1990,51 @@ class ks {
|
|
|
1989
1990
|
this._id = t;
|
|
1990
1991
|
}
|
|
1991
1992
|
}
|
|
1992
|
-
class
|
|
1993
|
+
class q {
|
|
1993
1994
|
// Global cache of collection instances by id
|
|
1995
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1994
1996
|
static _cache = /* @__PURE__ */ new Map();
|
|
1995
1997
|
// Get or create a collection instance
|
|
1996
1998
|
static get(t) {
|
|
1997
|
-
const n =
|
|
1999
|
+
const n = q._cache.get(t.id);
|
|
1998
2000
|
if (n)
|
|
1999
2001
|
return n;
|
|
2000
|
-
const r = new
|
|
2001
|
-
return
|
|
2002
|
+
const r = new q(t);
|
|
2003
|
+
return q._cache.set(t.id, r), r;
|
|
2002
2004
|
}
|
|
2003
2005
|
// Clear a specific collection from cache
|
|
2004
2006
|
static clear(t) {
|
|
2005
|
-
|
|
2007
|
+
q._cache.delete(t);
|
|
2006
2008
|
}
|
|
2007
2009
|
// Clear all collections from cache
|
|
2008
2010
|
static clearAll() {
|
|
2009
|
-
|
|
2011
|
+
q._cache.clear();
|
|
2010
2012
|
}
|
|
2011
2013
|
id;
|
|
2012
2014
|
config;
|
|
2013
2015
|
_state;
|
|
2014
2016
|
_syncQueue;
|
|
2015
2017
|
_fetchHandler;
|
|
2016
|
-
_itemCache = /* @__PURE__ */ new
|
|
2018
|
+
_itemCache = /* @__PURE__ */ new WeakMap();
|
|
2017
2019
|
_subscribers = /* @__PURE__ */ new Set();
|
|
2018
2020
|
_hasInitialized = !1;
|
|
2019
2021
|
_batchMode = !1;
|
|
2020
2022
|
constructor(t) {
|
|
2021
2023
|
this.id = t.id, this.config = t;
|
|
2022
|
-
const n = async (
|
|
2023
|
-
this._syncQueue = new
|
|
2024
|
+
const n = async (i) => i.map((o) => ({ id: o.id, status: "success" }));
|
|
2025
|
+
this._syncQueue = new Vi({
|
|
2024
2026
|
debounce: t.syncDebounce ?? 300,
|
|
2025
2027
|
maxRetries: t.syncRetries ?? 3,
|
|
2026
2028
|
onSync: t.onSync ?? n,
|
|
2027
|
-
onIdRemap: (
|
|
2028
|
-
}), this._fetchHandler = new
|
|
2029
|
+
onIdRemap: (i) => this._handleIdRemap(i)
|
|
2030
|
+
}), this._fetchHandler = new Ji({
|
|
2029
2031
|
id: t.id,
|
|
2030
2032
|
cacheCapacity: t.cacheCapacity ?? 10,
|
|
2031
2033
|
cacheTtl: t.cacheTtl ?? 6e4,
|
|
2032
2034
|
retries: t.fetchRetries ?? 0,
|
|
2033
2035
|
onFetch: t.onFetch
|
|
2034
2036
|
});
|
|
2035
|
-
const r = this._syncQueue.getState(),
|
|
2037
|
+
const r = this._syncQueue.getState(), s = this._fetchHandler.getState();
|
|
2036
2038
|
this._state = {
|
|
2037
2039
|
context: t.initialContext,
|
|
2038
2040
|
items: /* @__PURE__ */ new Map(),
|
|
@@ -2040,8 +2042,8 @@ class U {
|
|
|
2040
2042
|
loading: !1,
|
|
2041
2043
|
syncing: !1,
|
|
2042
2044
|
syncQueue: r,
|
|
2043
|
-
fetchStatus:
|
|
2044
|
-
fetchError:
|
|
2045
|
+
fetchStatus: s.status,
|
|
2046
|
+
fetchError: s.error
|
|
2045
2047
|
}, this._syncQueue.subscribe(() => {
|
|
2046
2048
|
this._onSyncQueueChange();
|
|
2047
2049
|
}), this._fetchHandler.subscribe(() => {
|
|
@@ -2076,16 +2078,16 @@ class U {
|
|
|
2076
2078
|
}
|
|
2077
2079
|
// Get item status from sync queue state
|
|
2078
2080
|
getItemStatus(t) {
|
|
2079
|
-
const { queue: n, inFlight: r, errors:
|
|
2080
|
-
if (
|
|
2081
|
+
const { queue: n, inFlight: r, errors: s } = this._state.syncQueue, i = r.get(t);
|
|
2082
|
+
if (i && i.length > 0)
|
|
2081
2083
|
return {
|
|
2082
|
-
type:
|
|
2084
|
+
type: i[i.length - 1].type,
|
|
2083
2085
|
status: "syncing",
|
|
2084
|
-
retries:
|
|
2086
|
+
retries: s.get(t)?.retries ?? 0
|
|
2085
2087
|
};
|
|
2086
2088
|
const o = n.get(t);
|
|
2087
2089
|
if (o && o.length > 0) {
|
|
2088
|
-
const c = o[o.length - 1], u =
|
|
2090
|
+
const c = o[o.length - 1], u = s.get(t);
|
|
2089
2091
|
return {
|
|
2090
2092
|
type: c.type,
|
|
2091
2093
|
status: u ? "error" : "pending",
|
|
@@ -2093,7 +2095,7 @@ class U {
|
|
|
2093
2095
|
error: u?.error
|
|
2094
2096
|
};
|
|
2095
2097
|
}
|
|
2096
|
-
const a =
|
|
2098
|
+
const a = s.get(t);
|
|
2097
2099
|
return a ? {
|
|
2098
2100
|
type: "update",
|
|
2099
2101
|
status: "error",
|
|
@@ -2104,7 +2106,7 @@ class U {
|
|
|
2104
2106
|
// Create a new item (local-first)
|
|
2105
2107
|
create(t) {
|
|
2106
2108
|
const n = this.config.getId(t);
|
|
2107
|
-
this._state =
|
|
2109
|
+
this._state = E(this._state, (r) => {
|
|
2108
2110
|
r.items.set(n, t);
|
|
2109
2111
|
}), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: n, type: "create", data: t });
|
|
2110
2112
|
}
|
|
@@ -2112,32 +2114,32 @@ class U {
|
|
|
2112
2114
|
update(t, n) {
|
|
2113
2115
|
const r = this._state.items.get(t);
|
|
2114
2116
|
if (!r) return;
|
|
2115
|
-
const
|
|
2116
|
-
this._state =
|
|
2117
|
-
|
|
2118
|
-
}), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: t, type: "update", data:
|
|
2117
|
+
const s = E(r, n);
|
|
2118
|
+
this._state = E(this._state, (i) => {
|
|
2119
|
+
i.items.set(t, s);
|
|
2120
|
+
}), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: t, type: "update", data: s });
|
|
2119
2121
|
}
|
|
2120
2122
|
// Remove an item (local-first)
|
|
2121
2123
|
remove(t) {
|
|
2122
2124
|
const n = this._state.items.get(t);
|
|
2123
|
-
n && (this._state =
|
|
2125
|
+
n && (this._state = E(this._state, (r) => {
|
|
2124
2126
|
r.items.delete(t);
|
|
2125
|
-
}), this.
|
|
2127
|
+
}), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: t, type: "delete", data: n }));
|
|
2126
2128
|
}
|
|
2127
|
-
// Get Item reference (cached
|
|
2129
|
+
// Get Item reference (cached by data object)
|
|
2128
2130
|
getItem(t) {
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
this._itemCache.
|
|
2131
|
+
const n = this._state.items.get(t);
|
|
2132
|
+
if (!n)
|
|
2133
|
+
return new Ot(this, t);
|
|
2134
|
+
const r = n;
|
|
2135
|
+
let s = this._itemCache.get(r);
|
|
2136
|
+
return s || (s = new Ot(this, t), this._itemCache.set(r, s)), s;
|
|
2135
2137
|
}
|
|
2136
2138
|
// Update context and refetch
|
|
2137
2139
|
setContext(t) {
|
|
2138
|
-
const n = this._state.context, r =
|
|
2139
|
-
n !== r && (this._state =
|
|
2140
|
-
|
|
2140
|
+
const n = this._state.context, r = E(n, t);
|
|
2141
|
+
n !== r && (this._state = E(this._state, (s) => {
|
|
2142
|
+
s.context = r;
|
|
2141
2143
|
}), this._fetchHandler.fetch(r), this._notifySubscribers());
|
|
2142
2144
|
}
|
|
2143
2145
|
// Force refresh (bypass cache)
|
|
@@ -2154,6 +2156,10 @@ class U {
|
|
|
2154
2156
|
retrySync(t) {
|
|
2155
2157
|
t ? this._syncQueue.retry(t) : this._syncQueue.retryAll();
|
|
2156
2158
|
}
|
|
2159
|
+
// Cleanup everything and remove from global cache
|
|
2160
|
+
destroy() {
|
|
2161
|
+
this._syncQueue.destroy(), this._fetchHandler.destroy(), this._subscribers.clear(), q._cache.delete(this.id);
|
|
2162
|
+
}
|
|
2157
2163
|
// Private methods
|
|
2158
2164
|
async _initialFetch() {
|
|
2159
2165
|
this._hasInitialized || (this._hasInitialized = !0, await this._fetchHandler.fetch(this._state.context));
|
|
@@ -2164,26 +2170,26 @@ class U {
|
|
|
2164
2170
|
}
|
|
2165
2171
|
_onFetchChange() {
|
|
2166
2172
|
const t = this._fetchHandler.getState();
|
|
2167
|
-
this._state =
|
|
2173
|
+
this._state = E(this._state, (n) => {
|
|
2168
2174
|
n.fetchStatus = t.status, n.fetchError = t.error, n.loading = t.status === "fetching", n.syncState = this._computeSyncState(t.status, n.syncQueue.isSyncing);
|
|
2169
|
-
const { queue: r, inFlight:
|
|
2175
|
+
const { queue: r, inFlight: s } = this._state.syncQueue, i = /* @__PURE__ */ new Map();
|
|
2170
2176
|
for (const o of t.items) {
|
|
2171
2177
|
const a = this.config.getId(o);
|
|
2172
|
-
|
|
2178
|
+
i.set(a, o);
|
|
2173
2179
|
}
|
|
2174
2180
|
for (const [o, a] of r) {
|
|
2175
2181
|
const c = a[a.length - 1];
|
|
2176
|
-
(c.type === "create" || c.type === "update") &&
|
|
2182
|
+
(c.type === "create" || c.type === "update") && i.set(o, c.data);
|
|
2177
2183
|
}
|
|
2178
|
-
for (const [o, a] of
|
|
2184
|
+
for (const [o, a] of s) {
|
|
2179
2185
|
const c = a[a.length - 1];
|
|
2180
|
-
(c.type === "create" || c.type === "update") &&
|
|
2186
|
+
(c.type === "create" || c.type === "update") && i.set(o, c.data);
|
|
2181
2187
|
}
|
|
2182
|
-
n.items =
|
|
2188
|
+
n.items = i;
|
|
2183
2189
|
}), this._notifySubscribers();
|
|
2184
2190
|
}
|
|
2185
2191
|
_updateSyncState(t) {
|
|
2186
|
-
this._state =
|
|
2192
|
+
this._state = E(this._state, (n) => {
|
|
2187
2193
|
n.syncQueue = t, n.syncing = t.isSyncing, n.syncState = this._computeSyncState(n.fetchStatus, t.isSyncing);
|
|
2188
2194
|
}), this._notifySubscribers();
|
|
2189
2195
|
}
|
|
@@ -2198,24 +2204,27 @@ class U {
|
|
|
2198
2204
|
_handleIdRemap(t) {
|
|
2199
2205
|
if (t.length === 0) return;
|
|
2200
2206
|
const { setId: n } = this.config;
|
|
2201
|
-
this._state =
|
|
2202
|
-
for (const { tempId:
|
|
2203
|
-
const o = r.items.get(
|
|
2207
|
+
this._state = E(this._state, (r) => {
|
|
2208
|
+
for (const { tempId: s, newId: i } of t) {
|
|
2209
|
+
const o = r.items.get(s);
|
|
2204
2210
|
if (o) {
|
|
2205
2211
|
let a;
|
|
2206
|
-
n ? a = n(o,
|
|
2212
|
+
n ? a = n(o, i) : (o.id = i, a = o), r.items.delete(s), r.items.set(i, a);
|
|
2207
2213
|
}
|
|
2208
2214
|
}
|
|
2209
2215
|
});
|
|
2210
|
-
for (const {
|
|
2211
|
-
const s = this.
|
|
2212
|
-
|
|
2216
|
+
for (const { newId: r } of t) {
|
|
2217
|
+
const s = this._state.items.get(r);
|
|
2218
|
+
if (s) {
|
|
2219
|
+
const i = s, o = this._itemCache.get(i);
|
|
2220
|
+
o && o._updateId(r);
|
|
2221
|
+
}
|
|
2213
2222
|
}
|
|
2214
2223
|
this._notifySubscribers();
|
|
2215
2224
|
}
|
|
2216
2225
|
}
|
|
2217
|
-
function
|
|
2218
|
-
const t =
|
|
2226
|
+
function eo(e) {
|
|
2227
|
+
const t = q.get(e), n = ue(
|
|
2219
2228
|
(r) => t.subscribe(r),
|
|
2220
2229
|
() => t.getState(),
|
|
2221
2230
|
() => t.getState()
|
|
@@ -2232,7 +2241,7 @@ function to(e) {
|
|
|
2232
2241
|
fetchError: n.fetchError,
|
|
2233
2242
|
// Item operations
|
|
2234
2243
|
create: (r) => t.create(r),
|
|
2235
|
-
update: (r,
|
|
2244
|
+
update: (r, s) => t.update(r, s),
|
|
2236
2245
|
remove: (r) => t.remove(r),
|
|
2237
2246
|
getItem: (r) => t.getItem(r),
|
|
2238
2247
|
getItemStatus: (r) => t.getItemStatus(r),
|
|
@@ -2245,10 +2254,7 @@ function to(e) {
|
|
|
2245
2254
|
retrySync: (r) => t.retrySync(r)
|
|
2246
2255
|
};
|
|
2247
2256
|
}
|
|
2248
|
-
function
|
|
2249
|
-
Xt(() => () => {
|
|
2250
|
-
queueMicrotask(() => e._release());
|
|
2251
|
-
}, [e]);
|
|
2257
|
+
function to(e) {
|
|
2252
2258
|
const t = ue(
|
|
2253
2259
|
(o) => e.collection.subscribe(o),
|
|
2254
2260
|
() => e.data,
|
|
@@ -2261,23 +2267,23 @@ function no(e) {
|
|
|
2261
2267
|
(o) => e.collection.subscribe(o),
|
|
2262
2268
|
() => e.exists(),
|
|
2263
2269
|
() => e.exists()
|
|
2264
|
-
),
|
|
2265
|
-
return { data: t, status: n, update:
|
|
2270
|
+
), s = Xe((o) => e.update(o), [e]), i = Xe(() => e.remove(), [e]);
|
|
2271
|
+
return { data: t, status: n, update: s, remove: i, exists: r };
|
|
2266
2272
|
}
|
|
2267
2273
|
export {
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2274
|
+
Zi as Cache,
|
|
2275
|
+
q as Collection,
|
|
2276
|
+
Ji as FetchHandler,
|
|
2277
|
+
Ot as Item,
|
|
2278
|
+
Vi as SyncQueue,
|
|
2273
2279
|
so as categorizeResults,
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2280
|
+
oo as createSyncClient,
|
|
2281
|
+
ao as createSyncClientFromEndpoint,
|
|
2282
|
+
co as createSyncClientWithStats,
|
|
2283
|
+
uo as fetchToSyncResult,
|
|
2284
|
+
fo as syncError,
|
|
2285
|
+
lo as syncSuccess,
|
|
2286
|
+
eo as useCrud,
|
|
2287
|
+
to as useItem
|
|
2282
2288
|
};
|
|
2283
2289
|
//# sourceMappingURL=index.js.map
|