@biglogic/rgs 3.9.11 → 3.9.20
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 +26 -17
- package/core/hooks.d.ts +6 -2
- package/extension/rgs.vsix +0 -0
- package/index.cjs +509 -441
- package/index.d.ts +1 -1
- package/index.js +402 -332
- package/markdown/api.md +181 -1
- package/markdown/getting-started.md +33 -2
- package/markdown/security-architecture.md +6 -0
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
var e, t, n = require("react"), r = Object.defineProperty, s = Object.getOwnPropertyNames, o = (e => "undefined" != typeof require ? require : "undefined" != typeof Proxy ? new Proxy(e, {
|
|
4
|
-
get: (e, t) => ("undefined" != typeof require ? require : e)[t]
|
|
5
|
-
}) : e)(function(e) {
|
|
6
|
-
if ("undefined" != typeof require) return require.apply(this, arguments);
|
|
7
|
-
throw Error('Dynamic require of "' + e + '" is not supported');
|
|
8
|
-
}), a = (e, t) => function() {
|
|
1
|
+
var e, t, n = require("react"), r = Object.defineProperty, s = Object.getOwnPropertyNames, o = (e, t) => function() {
|
|
9
2
|
return e && (t = (0, e[s(e)[0]])(e = 0)), t;
|
|
10
|
-
},
|
|
3
|
+
}, a = o({
|
|
11
4
|
"core/utils.ts"() {
|
|
12
5
|
e = e => {
|
|
13
6
|
if (null === e || "object" != typeof e) return e;
|
|
@@ -38,6 +31,26 @@ var e, t, n = require("react"), r = Object.defineProperty, s = Object.getOwnProp
|
|
|
38
31
|
}, t = (e, n) => {
|
|
39
32
|
if (e === n) return !0;
|
|
40
33
|
if (null === e || null === n) return e === n;
|
|
34
|
+
if (typeof e != typeof n) return !1;
|
|
35
|
+
if (e instanceof Date && n instanceof Date) return e.getTime() === n.getTime();
|
|
36
|
+
if (e instanceof RegExp && n instanceof RegExp) return e.source === n.source && e.flags === n.flags;
|
|
37
|
+
if (e instanceof Map && n instanceof Map) {
|
|
38
|
+
if (e.size !== n.size) return !1;
|
|
39
|
+
for (const [r, s] of e) if (!n.has(r) || !t(s, n.get(r))) return !1;
|
|
40
|
+
return !0;
|
|
41
|
+
}
|
|
42
|
+
if (e instanceof Set && n instanceof Set) {
|
|
43
|
+
if (e.size !== n.size) return !1;
|
|
44
|
+
for (const r of e) if (![ ...n ].some(e => t(r, e))) return !1;
|
|
45
|
+
return !0;
|
|
46
|
+
}
|
|
47
|
+
if (e instanceof ArrayBuffer && n instanceof ArrayBuffer) return e.byteLength === n.byteLength;
|
|
48
|
+
if (ArrayBuffer.isView(e) && ArrayBuffer.isView(n)) {
|
|
49
|
+
const t = e, r = n;
|
|
50
|
+
if (t.length !== r.length) return !1;
|
|
51
|
+
for (let e = 0; e < t.length; e++) if (t[e] !== r[e]) return !1;
|
|
52
|
+
return !0;
|
|
53
|
+
}
|
|
41
54
|
if ("object" != typeof e || "object" != typeof n) return e === n;
|
|
42
55
|
if (Array.isArray(e) && Array.isArray(n)) {
|
|
43
56
|
if (e.length !== n.length) return !1;
|
|
@@ -53,21 +66,21 @@ var e, t, n = require("react"), r = Object.defineProperty, s = Object.getOwnProp
|
|
|
53
66
|
return !0;
|
|
54
67
|
};
|
|
55
68
|
}
|
|
56
|
-
}),
|
|
69
|
+
}), i = {};
|
|
57
70
|
|
|
58
71
|
((e, t) => {
|
|
59
72
|
for (var n in t) r(e, n, {
|
|
60
73
|
get: t[n],
|
|
61
74
|
enumerable: !0
|
|
62
75
|
});
|
|
63
|
-
})(
|
|
76
|
+
})(i, {
|
|
64
77
|
SyncEngine: () => exports.SyncEngine,
|
|
65
78
|
createSyncEngine: () => exports.createSyncEngine
|
|
66
79
|
}), exports.SyncEngine = void 0, exports.createSyncEngine = void 0;
|
|
67
80
|
|
|
68
|
-
var
|
|
81
|
+
var c = o({
|
|
69
82
|
"core/sync.ts"() {
|
|
70
|
-
|
|
83
|
+
a(), exports.SyncEngine = class {
|
|
71
84
|
store;
|
|
72
85
|
config;
|
|
73
86
|
pendingQueue=new Map;
|
|
@@ -293,7 +306,7 @@ var l = a({
|
|
|
293
306
|
}
|
|
294
307
|
}, exports.createSyncEngine = (e, t) => new exports.SyncEngine(e, t);
|
|
295
308
|
}
|
|
296
|
-
}),
|
|
309
|
+
}), l = Symbol.for("immer-nothing"), u = Symbol.for("immer-draftable"), f = Symbol.for("immer-state"), d = [ function(e) {
|
|
297
310
|
return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
|
|
298
311
|
}, function(e) {
|
|
299
312
|
return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`;
|
|
@@ -305,126 +318,126 @@ var l = a({
|
|
|
305
318
|
return `'original' expects a draft, got: ${e}`;
|
|
306
319
|
} ];
|
|
307
320
|
|
|
308
|
-
function
|
|
321
|
+
function y(e, ...t) {
|
|
309
322
|
{
|
|
310
|
-
const n =
|
|
323
|
+
const n = d[e], r = z(n) ? n.apply(null, t) : n;
|
|
311
324
|
throw new Error(`[Immer] ${r}`);
|
|
312
325
|
}
|
|
313
326
|
}
|
|
314
327
|
|
|
315
|
-
var
|
|
328
|
+
var p = Object, g = p.getPrototypeOf, h = "constructor", m = "prototype", S = "configurable", _ = "enumerable", w = "writable", b = "value", v = e => !!e && !!e[f];
|
|
316
329
|
|
|
317
|
-
function
|
|
318
|
-
return !!e && (O(e) ||
|
|
330
|
+
function E(e) {
|
|
331
|
+
return !!e && (O(e) || P(e) || !!e[u] || !!e[h]?.[u] || j(e) || T(e));
|
|
319
332
|
}
|
|
320
333
|
|
|
321
|
-
var
|
|
334
|
+
var k = p[m][h].toString(), x = new WeakMap;
|
|
322
335
|
|
|
323
336
|
function O(e) {
|
|
324
|
-
if (!e || !
|
|
325
|
-
const t =
|
|
326
|
-
if (null === t || t ===
|
|
327
|
-
const n =
|
|
337
|
+
if (!e || !I(e)) return !1;
|
|
338
|
+
const t = g(e);
|
|
339
|
+
if (null === t || t === p[m]) return !0;
|
|
340
|
+
const n = p.hasOwnProperty.call(t, h) && t[h];
|
|
328
341
|
if (n === Object) return !0;
|
|
329
|
-
if (!
|
|
330
|
-
let r =
|
|
331
|
-
return void 0 === r && (r = Function.toString.call(n),
|
|
342
|
+
if (!z(n)) return !1;
|
|
343
|
+
let r = x.get(n);
|
|
344
|
+
return void 0 === r && (r = Function.toString.call(n), x.set(n, r)), r === k;
|
|
332
345
|
}
|
|
333
346
|
|
|
334
|
-
function
|
|
335
|
-
if (0 ===
|
|
336
|
-
(n ? Reflect.ownKeys(e) :
|
|
347
|
+
function C(e, t, n = !0) {
|
|
348
|
+
if (0 === A(e)) {
|
|
349
|
+
(n ? Reflect.ownKeys(e) : p.keys(e)).forEach(n => {
|
|
337
350
|
t(n, e[n], e);
|
|
338
351
|
});
|
|
339
352
|
} else e.forEach((n, r) => t(r, n, e));
|
|
340
353
|
}
|
|
341
354
|
|
|
342
|
-
function
|
|
343
|
-
const t = e[
|
|
344
|
-
return t ? t.type_ :
|
|
355
|
+
function A(e) {
|
|
356
|
+
const t = e[f];
|
|
357
|
+
return t ? t.type_ : P(e) ? 1 : j(e) ? 2 : T(e) ? 3 : 0;
|
|
345
358
|
}
|
|
346
359
|
|
|
347
|
-
var
|
|
360
|
+
var D = (e, t, n = A(e)) => 2 === n ? e.has(t) : p[m].hasOwnProperty.call(e, t), M = (e, t, n = A(e)) => 2 === n ? e.get(t) : e[t], R = (e, t, n, r = A(e)) => {
|
|
348
361
|
2 === r ? e.set(t, n) : 3 === r ? e.add(n) : e[t] = n;
|
|
349
362
|
};
|
|
350
363
|
|
|
351
|
-
var
|
|
364
|
+
var P = Array.isArray, j = e => e instanceof Map, T = e => e instanceof Set, I = e => "object" == typeof e, z = e => "function" == typeof e, V = e => "boolean" == typeof e;
|
|
352
365
|
|
|
353
|
-
var
|
|
366
|
+
var $ = e => e.copy_ || e.base_, N = e => e.modified_ ? e.copy_ : e.base_;
|
|
354
367
|
|
|
355
|
-
function
|
|
356
|
-
if (
|
|
357
|
-
if (
|
|
358
|
-
if (
|
|
368
|
+
function U(e, t) {
|
|
369
|
+
if (j(e)) return new Map(e);
|
|
370
|
+
if (T(e)) return new Set(e);
|
|
371
|
+
if (P(e)) return Array[m].slice.call(e);
|
|
359
372
|
const n = O(e);
|
|
360
373
|
if (!0 === t || "class_only" === t && !n) {
|
|
361
|
-
const t =
|
|
362
|
-
delete t[
|
|
374
|
+
const t = p.getOwnPropertyDescriptors(e);
|
|
375
|
+
delete t[f];
|
|
363
376
|
let n = Reflect.ownKeys(t);
|
|
364
377
|
for (let r = 0; r < n.length; r++) {
|
|
365
378
|
const s = n[r], o = t[s];
|
|
366
|
-
!1 === o[
|
|
367
|
-
[
|
|
368
|
-
[
|
|
369
|
-
[
|
|
370
|
-
[
|
|
379
|
+
!1 === o[w] && (o[w] = !0, o[S] = !0), (o.get || o.set) && (t[s] = {
|
|
380
|
+
[S]: !0,
|
|
381
|
+
[w]: !0,
|
|
382
|
+
[_]: o[_],
|
|
383
|
+
[b]: e[s]
|
|
371
384
|
});
|
|
372
385
|
}
|
|
373
|
-
return
|
|
386
|
+
return p.create(g(e), t);
|
|
374
387
|
}
|
|
375
388
|
{
|
|
376
|
-
const t =
|
|
389
|
+
const t = g(e);
|
|
377
390
|
if (null !== t && n) return {
|
|
378
391
|
...e
|
|
379
392
|
};
|
|
380
|
-
const r =
|
|
381
|
-
return
|
|
393
|
+
const r = p.create(t);
|
|
394
|
+
return p.assign(r, e);
|
|
382
395
|
}
|
|
383
396
|
}
|
|
384
397
|
|
|
385
|
-
function
|
|
386
|
-
return
|
|
387
|
-
set:
|
|
388
|
-
add:
|
|
389
|
-
clear:
|
|
390
|
-
delete:
|
|
391
|
-
}),
|
|
392
|
-
|
|
398
|
+
function L(e, t = !1) {
|
|
399
|
+
return F(e) || v(e) || !E(e) || (A(e) > 1 && p.defineProperties(e, {
|
|
400
|
+
set: B,
|
|
401
|
+
add: B,
|
|
402
|
+
clear: B,
|
|
403
|
+
delete: B
|
|
404
|
+
}), p.freeze(e), t && C(e, (e, t) => {
|
|
405
|
+
L(t, !0);
|
|
393
406
|
}, !1)), e;
|
|
394
407
|
}
|
|
395
408
|
|
|
396
|
-
var
|
|
397
|
-
[
|
|
398
|
-
|
|
409
|
+
var B = {
|
|
410
|
+
[b]: function() {
|
|
411
|
+
y(2);
|
|
399
412
|
}
|
|
400
413
|
};
|
|
401
414
|
|
|
402
|
-
function
|
|
403
|
-
return null === e || !
|
|
415
|
+
function F(e) {
|
|
416
|
+
return null === e || !I(e) || p.isFrozen(e);
|
|
404
417
|
}
|
|
405
418
|
|
|
406
|
-
var
|
|
419
|
+
var K = "MapSet", J = "Patches", H = "ArrayMethods", W = {};
|
|
407
420
|
|
|
408
421
|
function Q(e) {
|
|
409
|
-
const t =
|
|
410
|
-
return t ||
|
|
422
|
+
const t = W[e];
|
|
423
|
+
return t || y(0, e), t;
|
|
411
424
|
}
|
|
412
425
|
|
|
413
|
-
var G,
|
|
426
|
+
var G, q = e => !!W[e], X = () => G;
|
|
414
427
|
|
|
415
|
-
function
|
|
416
|
-
t && (e.patchPlugin_ = Q(
|
|
428
|
+
function Z(e, t) {
|
|
429
|
+
t && (e.patchPlugin_ = Q(J), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
|
|
417
430
|
}
|
|
418
431
|
|
|
419
|
-
function
|
|
420
|
-
|
|
432
|
+
function Y(e) {
|
|
433
|
+
ee(e), e.drafts_.forEach(ne), e.drafts_ = null;
|
|
421
434
|
}
|
|
422
435
|
|
|
423
|
-
function
|
|
436
|
+
function ee(e) {
|
|
424
437
|
e === G && (G = e.parent_);
|
|
425
438
|
}
|
|
426
439
|
|
|
427
|
-
var
|
|
440
|
+
var te = e => G = {
|
|
428
441
|
drafts_: [],
|
|
429
442
|
parent_: G,
|
|
430
443
|
immer_: e,
|
|
@@ -432,209 +445,209 @@ var ne = e => G = {
|
|
|
432
445
|
unfinalizedDrafts_: 0,
|
|
433
446
|
handledSet_: new Set,
|
|
434
447
|
processedForPatches_: new Set,
|
|
435
|
-
mapSetPlugin_:
|
|
436
|
-
arrayMethodsPlugin_:
|
|
448
|
+
mapSetPlugin_: q(K) ? Q(K) : void 0,
|
|
449
|
+
arrayMethodsPlugin_: q(H) ? Q(H) : void 0
|
|
437
450
|
};
|
|
438
451
|
|
|
439
|
-
function
|
|
440
|
-
const t = e[
|
|
452
|
+
function ne(e) {
|
|
453
|
+
const t = e[f];
|
|
441
454
|
0 === t.type_ || 1 === t.type_ ? t.revoke_() : t.revoked_ = !0;
|
|
442
455
|
}
|
|
443
456
|
|
|
444
|
-
function
|
|
457
|
+
function re(e, t) {
|
|
445
458
|
t.unfinalizedDrafts_ = t.drafts_.length;
|
|
446
459
|
const n = t.drafts_[0];
|
|
447
460
|
if (void 0 !== e && e !== n) {
|
|
448
|
-
n[
|
|
461
|
+
n[f].modified_ && (Y(t), y(4)), E(e) && (e = se(t, e));
|
|
449
462
|
const {patchPlugin_: r} = t;
|
|
450
|
-
r && r.generateReplacementPatches_(n[
|
|
451
|
-
} else e =
|
|
463
|
+
r && r.generateReplacementPatches_(n[f].base_, e, t);
|
|
464
|
+
} else e = se(t, n);
|
|
452
465
|
return function(e, t, n = !1) {
|
|
453
|
-
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ &&
|
|
454
|
-
}(t, e, !0),
|
|
455
|
-
e !==
|
|
466
|
+
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && L(t, n);
|
|
467
|
+
}(t, e, !0), Y(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_),
|
|
468
|
+
e !== l ? e : void 0;
|
|
456
469
|
}
|
|
457
470
|
|
|
458
|
-
function
|
|
459
|
-
if (
|
|
460
|
-
const n = t[
|
|
471
|
+
function se(e, t) {
|
|
472
|
+
if (F(t)) return t;
|
|
473
|
+
const n = t[f];
|
|
461
474
|
if (!n) {
|
|
462
|
-
return
|
|
475
|
+
return ue(t, e.handledSet_, e);
|
|
463
476
|
}
|
|
464
|
-
if (!
|
|
477
|
+
if (!ae(n, e)) return t;
|
|
465
478
|
if (!n.modified_) return n.base_;
|
|
466
479
|
if (!n.finalized_) {
|
|
467
480
|
const {callbacks_: t} = n;
|
|
468
481
|
if (t) for (;t.length > 0; ) {
|
|
469
482
|
t.pop()(e);
|
|
470
483
|
}
|
|
471
|
-
|
|
484
|
+
le(n, e);
|
|
472
485
|
}
|
|
473
486
|
return n.copy_;
|
|
474
487
|
}
|
|
475
488
|
|
|
476
|
-
function
|
|
489
|
+
function oe(e) {
|
|
477
490
|
e.finalized_ = !0, e.scope_.unfinalizedDrafts_--;
|
|
478
491
|
}
|
|
479
492
|
|
|
480
|
-
var
|
|
493
|
+
var ae = (e, t) => e.scope_ === t, ie = [];
|
|
481
494
|
|
|
482
|
-
function
|
|
483
|
-
const s =
|
|
495
|
+
function ce(e, t, n, r) {
|
|
496
|
+
const s = $(e), o = e.type_;
|
|
484
497
|
if (void 0 !== r) {
|
|
485
|
-
if (
|
|
498
|
+
if (M(s, r, o) === t) return void R(s, r, n, o);
|
|
486
499
|
}
|
|
487
500
|
if (!e.draftLocations_) {
|
|
488
501
|
const t = e.draftLocations_ = new Map;
|
|
489
|
-
|
|
490
|
-
if (
|
|
502
|
+
C(s, (e, n) => {
|
|
503
|
+
if (v(n)) {
|
|
491
504
|
const r = t.get(n) || [];
|
|
492
505
|
r.push(e), t.set(n, r);
|
|
493
506
|
}
|
|
494
507
|
});
|
|
495
508
|
}
|
|
496
|
-
const a = e.draftLocations_.get(t) ??
|
|
509
|
+
const a = e.draftLocations_.get(t) ?? ie;
|
|
497
510
|
for (const e of a) R(s, e, n, o);
|
|
498
511
|
}
|
|
499
512
|
|
|
500
|
-
function
|
|
513
|
+
function le(e, t) {
|
|
501
514
|
if (e.modified_ && !e.finalized_ && (3 === e.type_ || 1 === e.type_ && e.allIndicesReassigned_ || (e.assigned_?.size ?? 0) > 0)) {
|
|
502
515
|
const {patchPlugin_: n} = t;
|
|
503
516
|
if (n) {
|
|
504
517
|
const r = n.getPath(e);
|
|
505
518
|
r && n.generatePatches_(e, r, t);
|
|
506
519
|
}
|
|
507
|
-
|
|
520
|
+
oe(e);
|
|
508
521
|
}
|
|
509
522
|
}
|
|
510
523
|
|
|
511
|
-
function
|
|
512
|
-
return !n.immer_.autoFreeze_ && n.unfinalizedDrafts_ < 1 ||
|
|
513
|
-
|
|
514
|
-
if (
|
|
515
|
-
const t = s[
|
|
516
|
-
if (
|
|
517
|
-
const n =
|
|
518
|
-
R(e, r, n, e.type_),
|
|
524
|
+
function ue(e, t, n) {
|
|
525
|
+
return !n.immer_.autoFreeze_ && n.unfinalizedDrafts_ < 1 || v(e) || t.has(e) || !E(e) || F(e) || (t.add(e),
|
|
526
|
+
C(e, (r, s) => {
|
|
527
|
+
if (v(s)) {
|
|
528
|
+
const t = s[f];
|
|
529
|
+
if (ae(t, n)) {
|
|
530
|
+
const n = N(t);
|
|
531
|
+
R(e, r, n, e.type_), oe(t);
|
|
519
532
|
}
|
|
520
|
-
} else
|
|
533
|
+
} else E(s) && ue(s, t, n);
|
|
521
534
|
})), e;
|
|
522
535
|
}
|
|
523
536
|
|
|
524
|
-
var
|
|
537
|
+
var fe = {
|
|
525
538
|
get(e, t) {
|
|
526
|
-
if (t ===
|
|
539
|
+
if (t === f) return e;
|
|
527
540
|
let n = e.scope_.arrayMethodsPlugin_;
|
|
528
541
|
const r = 1 === e.type_ && "string" == typeof t;
|
|
529
542
|
if (r && n?.isArrayOperationMethod(t)) return n.createMethodInterceptor(e, t);
|
|
530
|
-
const s =
|
|
531
|
-
if (!
|
|
532
|
-
const r =
|
|
533
|
-
return r ?
|
|
543
|
+
const s = $(e);
|
|
544
|
+
if (!D(s, t, e.type_)) return function(e, t, n) {
|
|
545
|
+
const r = pe(t, n);
|
|
546
|
+
return r ? b in r ? r[b] : r.get?.call(e.draft_) : void 0;
|
|
534
547
|
}(e, s, t);
|
|
535
548
|
const o = s[t];
|
|
536
|
-
if (e.finalized_ || !
|
|
549
|
+
if (e.finalized_ || !E(o)) return o;
|
|
537
550
|
if (r && e.operationMethod && n?.isMutatingArrayMethod(e.operationMethod) && function(e) {
|
|
538
551
|
const t = +e;
|
|
539
552
|
return Number.isInteger(t) && String(t) === e;
|
|
540
553
|
}(t)) return o;
|
|
541
|
-
if (o ===
|
|
542
|
-
|
|
543
|
-
const n = 1 === e.type_ ? +t : t, r =
|
|
554
|
+
if (o === ye(e.base_, t)) {
|
|
555
|
+
he(e);
|
|
556
|
+
const n = 1 === e.type_ ? +t : t, r = me(e.scope_, o, e, n);
|
|
544
557
|
return e.copy_[n] = r;
|
|
545
558
|
}
|
|
546
559
|
return o;
|
|
547
560
|
},
|
|
548
|
-
has: (e, t) => t in
|
|
549
|
-
ownKeys: e => Reflect.ownKeys(
|
|
561
|
+
has: (e, t) => t in $(e),
|
|
562
|
+
ownKeys: e => Reflect.ownKeys($(e)),
|
|
550
563
|
set(e, t, n) {
|
|
551
|
-
const r =
|
|
564
|
+
const r = pe($(e), t);
|
|
552
565
|
if (r?.set) return r.set.call(e.draft_, n), !0;
|
|
553
566
|
if (!e.modified_) {
|
|
554
|
-
const r =
|
|
567
|
+
const r = ye($(e), t), a = r?.[f];
|
|
555
568
|
if (a && a.base_ === n) return e.copy_[t] = n, e.assigned_.set(t, !1), !0;
|
|
556
|
-
if (((s = n) === (o = r) ? 0 !== s || 1 / s == 1 / o : s != s && o != o) && (void 0 !== n ||
|
|
557
|
-
|
|
569
|
+
if (((s = n) === (o = r) ? 0 !== s || 1 / s == 1 / o : s != s && o != o) && (void 0 !== n || D(e.base_, t, e.type_))) return !0;
|
|
570
|
+
he(e), ge(e);
|
|
558
571
|
}
|
|
559
572
|
var s, o;
|
|
560
573
|
return e.copy_[t] === n && (void 0 !== n || t in e.copy_) || Number.isNaN(n) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = n,
|
|
561
574
|
e.assigned_.set(t, !0), function(e, t, n) {
|
|
562
575
|
const {scope_: r} = e;
|
|
563
|
-
if (
|
|
564
|
-
const s = n[
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
const r =
|
|
568
|
-
|
|
576
|
+
if (v(n)) {
|
|
577
|
+
const s = n[f];
|
|
578
|
+
ae(s, r) && s.callbacks_.push(function() {
|
|
579
|
+
he(e);
|
|
580
|
+
const r = N(s);
|
|
581
|
+
ce(e, n, r, t);
|
|
569
582
|
});
|
|
570
|
-
} else
|
|
571
|
-
const s =
|
|
572
|
-
3 === e.type_ ? s.has(n) &&
|
|
583
|
+
} else E(n) && e.callbacks_.push(function() {
|
|
584
|
+
const s = $(e);
|
|
585
|
+
3 === e.type_ ? s.has(n) && ue(n, r.handledSet_, r) : M(s, t, e.type_) === n && r.drafts_.length > 1 && !0 === (e.assigned_.get(t) ?? !1) && e.copy_ && ue(M(e.copy_, t, e.type_), r.handledSet_, r);
|
|
573
586
|
});
|
|
574
587
|
}(e, t, n)), !0;
|
|
575
588
|
},
|
|
576
|
-
deleteProperty: (e, t) => (
|
|
577
|
-
|
|
589
|
+
deleteProperty: (e, t) => (he(e), void 0 !== ye(e.base_, t) || t in e.base_ ? (e.assigned_.set(t, !1),
|
|
590
|
+
ge(e)) : e.assigned_.delete(t), e.copy_ && delete e.copy_[t], !0),
|
|
578
591
|
getOwnPropertyDescriptor(e, t) {
|
|
579
|
-
const n =
|
|
592
|
+
const n = $(e), r = Reflect.getOwnPropertyDescriptor(n, t);
|
|
580
593
|
return r ? {
|
|
581
|
-
[
|
|
582
|
-
[
|
|
583
|
-
[
|
|
584
|
-
[
|
|
594
|
+
[w]: !0,
|
|
595
|
+
[S]: 1 !== e.type_ || "length" !== t,
|
|
596
|
+
[_]: r[_],
|
|
597
|
+
[b]: n[t]
|
|
585
598
|
} : r;
|
|
586
599
|
},
|
|
587
600
|
defineProperty() {
|
|
588
|
-
|
|
601
|
+
y(11);
|
|
589
602
|
},
|
|
590
|
-
getPrototypeOf: e =>
|
|
603
|
+
getPrototypeOf: e => g(e.base_),
|
|
591
604
|
setPrototypeOf() {
|
|
592
|
-
|
|
605
|
+
y(12);
|
|
593
606
|
}
|
|
594
|
-
},
|
|
607
|
+
}, de = {};
|
|
595
608
|
|
|
596
|
-
for (let e in
|
|
597
|
-
let t =
|
|
598
|
-
|
|
609
|
+
for (let e in fe) {
|
|
610
|
+
let t = fe[e];
|
|
611
|
+
de[e] = function() {
|
|
599
612
|
const e = arguments;
|
|
600
613
|
return e[0] = e[0][0], t.apply(this, e);
|
|
601
614
|
};
|
|
602
615
|
}
|
|
603
616
|
|
|
604
|
-
function
|
|
605
|
-
const n = e[
|
|
606
|
-
return (n ?
|
|
617
|
+
function ye(e, t) {
|
|
618
|
+
const n = e[f];
|
|
619
|
+
return (n ? $(n) : e)[t];
|
|
607
620
|
}
|
|
608
621
|
|
|
609
|
-
function
|
|
622
|
+
function pe(e, t) {
|
|
610
623
|
if (!(t in e)) return;
|
|
611
|
-
let n =
|
|
624
|
+
let n = g(e);
|
|
612
625
|
for (;n; ) {
|
|
613
626
|
const e = Object.getOwnPropertyDescriptor(n, t);
|
|
614
627
|
if (e) return e;
|
|
615
|
-
n =
|
|
628
|
+
n = g(n);
|
|
616
629
|
}
|
|
617
630
|
}
|
|
618
631
|
|
|
619
|
-
function
|
|
620
|
-
e.modified_ || (e.modified_ = !0, e.parent_ &&
|
|
632
|
+
function ge(e) {
|
|
633
|
+
e.modified_ || (e.modified_ = !0, e.parent_ && ge(e.parent_));
|
|
621
634
|
}
|
|
622
635
|
|
|
623
|
-
function
|
|
624
|
-
e.copy_ || (e.assigned_ = new Map, e.copy_ =
|
|
636
|
+
function he(e) {
|
|
637
|
+
e.copy_ || (e.assigned_ = new Map, e.copy_ = U(e.base_, e.scope_.immer_.useStrictShallowCopy_));
|
|
625
638
|
}
|
|
626
639
|
|
|
627
|
-
|
|
628
|
-
return isNaN(parseInt(t)) &&
|
|
629
|
-
},
|
|
630
|
-
return "length" !== t && isNaN(parseInt(t)) &&
|
|
640
|
+
de.deleteProperty = function(e, t) {
|
|
641
|
+
return isNaN(parseInt(t)) && y(13), de.set.call(this, e, t, void 0);
|
|
642
|
+
}, de.set = function(e, t, n) {
|
|
643
|
+
return "length" !== t && isNaN(parseInt(t)) && y(14), fe.set.call(this, e[0], t, n, e[0]);
|
|
631
644
|
};
|
|
632
645
|
|
|
633
|
-
function
|
|
634
|
-
const [s, o] =
|
|
635
|
-
const n =
|
|
646
|
+
function me(e, t, n, r) {
|
|
647
|
+
const [s, o] = j(t) ? Q(K).proxyMap_(t, n) : T(t) ? Q(K).proxySet_(t, n) : function(e, t) {
|
|
648
|
+
const n = P(e), r = {
|
|
636
649
|
type_: n ? 1 : 0,
|
|
637
|
-
scope_: t ? t.scope_ :
|
|
650
|
+
scope_: t ? t.scope_ : X(),
|
|
638
651
|
modified_: !1,
|
|
639
652
|
finalized_: !1,
|
|
640
653
|
assigned_: void 0,
|
|
@@ -646,19 +659,19 @@ function Se(e, t, n, r) {
|
|
|
646
659
|
isManual_: !1,
|
|
647
660
|
callbacks_: void 0
|
|
648
661
|
};
|
|
649
|
-
let s = r, o =
|
|
650
|
-
n && (s = [ r ], o =
|
|
662
|
+
let s = r, o = fe;
|
|
663
|
+
n && (s = [ r ], o = de);
|
|
651
664
|
const {revoke: a, proxy: i} = Proxy.revocable(s, o);
|
|
652
665
|
return r.draft_ = i, r.revoke_ = a, [ i, r ];
|
|
653
666
|
}(t, n);
|
|
654
|
-
return (n?.scope_ ??
|
|
667
|
+
return (n?.scope_ ?? X()).drafts_.push(s), o.callbacks_ = n?.callbacks_ ?? [], o.key_ = r,
|
|
655
668
|
n && void 0 !== r ? function(e, t, n) {
|
|
656
669
|
e.callbacks_.push(function(r) {
|
|
657
670
|
const s = t;
|
|
658
|
-
if (!s || !
|
|
671
|
+
if (!s || !ae(s, r)) return;
|
|
659
672
|
r.mapSetPlugin_?.fixSetContents(s);
|
|
660
|
-
const o =
|
|
661
|
-
|
|
673
|
+
const o = N(s);
|
|
674
|
+
ce(e, s.draft_ ?? s, o, n), le(s, r);
|
|
662
675
|
});
|
|
663
676
|
}(n, o, r) : o.callbacks_.push(function(e) {
|
|
664
677
|
e.mapSetPlugin_?.fixSetContents(o);
|
|
@@ -667,24 +680,24 @@ function Se(e, t, n, r) {
|
|
|
667
680
|
}), s;
|
|
668
681
|
}
|
|
669
682
|
|
|
670
|
-
function
|
|
671
|
-
if (!
|
|
672
|
-
const t = e[
|
|
683
|
+
function Se(e) {
|
|
684
|
+
if (!E(e) || F(e)) return e;
|
|
685
|
+
const t = e[f];
|
|
673
686
|
let n, r = !0;
|
|
674
687
|
if (t) {
|
|
675
688
|
if (!t.modified_) return t.base_;
|
|
676
|
-
t.finalized_ = !0, n =
|
|
677
|
-
} else n =
|
|
678
|
-
return
|
|
679
|
-
R(n, e,
|
|
689
|
+
t.finalized_ = !0, n = U(e, t.scope_.immer_.useStrictShallowCopy_), r = t.scope_.immer_.shouldUseStrictIteration();
|
|
690
|
+
} else n = U(e, !0);
|
|
691
|
+
return C(n, (e, t) => {
|
|
692
|
+
R(n, e, Se(t));
|
|
680
693
|
}, r), t && (t.finalized_ = !1), n;
|
|
681
694
|
}
|
|
682
695
|
|
|
683
|
-
var
|
|
696
|
+
var _e = (new class {
|
|
684
697
|
constructor(e) {
|
|
685
698
|
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !1,
|
|
686
699
|
this.produce = (e, t, n) => {
|
|
687
|
-
if (
|
|
700
|
+
if (z(e) && !z(t)) {
|
|
688
701
|
const n = t;
|
|
689
702
|
t = e;
|
|
690
703
|
const r = this;
|
|
@@ -693,50 +706,50 @@ var we = (new class {
|
|
|
693
706
|
};
|
|
694
707
|
}
|
|
695
708
|
let r;
|
|
696
|
-
if (
|
|
697
|
-
const s =
|
|
709
|
+
if (z(t) || y(6), void 0 === n || z(n) || y(7), E(e)) {
|
|
710
|
+
const s = te(this), o = me(s, e, void 0);
|
|
698
711
|
let a = !0;
|
|
699
712
|
try {
|
|
700
713
|
r = t(o), a = !1;
|
|
701
714
|
} finally {
|
|
702
|
-
a ?
|
|
715
|
+
a ? Y(s) : ee(s);
|
|
703
716
|
}
|
|
704
|
-
return
|
|
717
|
+
return Z(s, n), re(r, s);
|
|
705
718
|
}
|
|
706
|
-
if (!e || !
|
|
707
|
-
if (r = t(e), void 0 === r && (r = e), r ===
|
|
719
|
+
if (!e || !I(e)) {
|
|
720
|
+
if (r = t(e), void 0 === r && (r = e), r === l && (r = void 0), this.autoFreeze_ && L(r, !0),
|
|
708
721
|
n) {
|
|
709
722
|
const t = [], s = [];
|
|
710
|
-
Q(
|
|
723
|
+
Q(J).generateReplacementPatches_(e, r, {
|
|
711
724
|
patches_: t,
|
|
712
725
|
inversePatches_: s
|
|
713
726
|
}), n(t, s);
|
|
714
727
|
}
|
|
715
728
|
return r;
|
|
716
729
|
}
|
|
717
|
-
|
|
730
|
+
y(1, e);
|
|
718
731
|
}, this.produceWithPatches = (e, t) => {
|
|
719
|
-
if (
|
|
732
|
+
if (z(e)) return (t, ...n) => this.produceWithPatches(t, t => e(t, ...n));
|
|
720
733
|
let n, r;
|
|
721
734
|
return [ this.produce(e, t, (e, t) => {
|
|
722
735
|
n = e, r = t;
|
|
723
736
|
}), n, r ];
|
|
724
|
-
},
|
|
725
|
-
|
|
737
|
+
}, V(e?.autoFreeze) && this.setAutoFreeze(e.autoFreeze), V(e?.useStrictShallowCopy) && this.setUseStrictShallowCopy(e.useStrictShallowCopy),
|
|
738
|
+
V(e?.useStrictIteration) && this.setUseStrictIteration(e.useStrictIteration);
|
|
726
739
|
}
|
|
727
740
|
createDraft(e) {
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
return
|
|
741
|
+
E(e) || y(8), v(e) && (e = function(e) {
|
|
742
|
+
v(e) || y(10, e);
|
|
743
|
+
return Se(e);
|
|
731
744
|
}(e));
|
|
732
|
-
const t =
|
|
733
|
-
return n[
|
|
745
|
+
const t = te(this), n = me(t, e, void 0);
|
|
746
|
+
return n[f].isManual_ = !0, ee(t), n;
|
|
734
747
|
}
|
|
735
748
|
finishDraft(e, t) {
|
|
736
|
-
const n = e && e[
|
|
737
|
-
n && n.isManual_ ||
|
|
749
|
+
const n = e && e[f];
|
|
750
|
+
n && n.isManual_ || y(9);
|
|
738
751
|
const {scope_: r} = n;
|
|
739
|
-
return
|
|
752
|
+
return Z(r, t), re(void 0, r);
|
|
740
753
|
}
|
|
741
754
|
setAutoFreeze(e) {
|
|
742
755
|
this.autoFreeze_ = e;
|
|
@@ -760,10 +773,10 @@ var we = (new class {
|
|
|
760
773
|
}
|
|
761
774
|
}
|
|
762
775
|
n > -1 && (t = t.slice(n + 1));
|
|
763
|
-
const r = Q(
|
|
764
|
-
return
|
|
776
|
+
const r = Q(J).applyPatches_;
|
|
777
|
+
return v(e) ? r(e, t) : this.produce(e, e => r(e, t));
|
|
765
778
|
}
|
|
766
|
-
}).produce,
|
|
779
|
+
}).produce, we = (e, t) => {
|
|
767
780
|
const n = Date.now();
|
|
768
781
|
if (/\(\.*\+\?\)\+/.test(e) || /\(\.*\?\)\*/.test(e)) return !1;
|
|
769
782
|
if (e.length > 500) return !1;
|
|
@@ -774,35 +787,35 @@ var we = (new class {
|
|
|
774
787
|
} catch {
|
|
775
788
|
return !1;
|
|
776
789
|
}
|
|
777
|
-
},
|
|
790
|
+
}, be = () => {
|
|
778
791
|
if ("undefined" != typeof crypto && "function" == typeof crypto.randomUUID) try {
|
|
779
792
|
return crypto.randomUUID();
|
|
780
793
|
} catch {}
|
|
781
794
|
throw new Error("Cryptographically secure random UUID generation is required but crypto.randomUUID is unavailable. Please use a browser or environment with Web Crypto API support.");
|
|
782
|
-
},
|
|
795
|
+
}, ve = "undefined" != typeof crypto && void 0 !== crypto.subtle && "function" == typeof crypto.subtle.generateKey, Ee = async (e, t) => {
|
|
783
796
|
const n = (new TextEncoder).encode(JSON.stringify(e)), r = await crypto.subtle.encrypt({
|
|
784
797
|
name: "AES-GCM",
|
|
785
798
|
iv: t.iv
|
|
786
799
|
}, t.key, n), s = new Uint8Array(t.iv.length + r.byteLength);
|
|
787
800
|
return s.set(t.iv), s.set(new Uint8Array(r), t.iv.length), btoa(String.fromCharCode(...s));
|
|
788
|
-
},
|
|
801
|
+
}, ke = async (e, t) => {
|
|
789
802
|
const n = Uint8Array.from(atob(e), e => e.charCodeAt(0)), r = n.slice(0, 12), s = n.slice(12), o = await crypto.subtle.decrypt({
|
|
790
803
|
name: "AES-GCM",
|
|
791
804
|
iv: r
|
|
792
805
|
}, t.key, s);
|
|
793
806
|
return JSON.parse((new TextDecoder).decode(o));
|
|
794
|
-
},
|
|
795
|
-
|
|
796
|
-
},
|
|
807
|
+
}, xe = null, Oe = e => {
|
|
808
|
+
xe && xe(e);
|
|
809
|
+
}, Ce = (e, t, n) => {
|
|
797
810
|
e.set(t instanceof RegExp ? t.source : t, n);
|
|
798
|
-
},
|
|
811
|
+
}, Ae = (e, t, n, r) => {
|
|
799
812
|
if (0 === e.size) return !0;
|
|
800
813
|
for (const [s, o] of e) {
|
|
801
814
|
let e;
|
|
802
|
-
if (e = "function" == typeof s ? s(t, r) :
|
|
815
|
+
if (e = "function" == typeof s ? s(t, r) : we(s, t), e) return o.includes(n) || o.includes("admin");
|
|
803
816
|
}
|
|
804
817
|
return !1;
|
|
805
|
-
},
|
|
818
|
+
}, De = e => {
|
|
806
819
|
if ("string" == typeof e) {
|
|
807
820
|
let t = e.replace(/&#[xX]?[0-9a-fA-F]+;?/g, e => {
|
|
808
821
|
const t = e.match(/&#x([0-9a-fA-F]+);?/i);
|
|
@@ -818,15 +831,15 @@ var we = (new class {
|
|
|
818
831
|
if (e && "object" == typeof e && !Array.isArray(e)) {
|
|
819
832
|
if (Object.getPrototypeOf(e) === Object.prototype) {
|
|
820
833
|
const t = {};
|
|
821
|
-
for (const [n, r] of Object.entries(e)) t[n] =
|
|
834
|
+
for (const [n, r] of Object.entries(e)) t[n] = De(r);
|
|
822
835
|
return t;
|
|
823
836
|
}
|
|
824
837
|
return e;
|
|
825
838
|
}
|
|
826
|
-
return Array.isArray(e) ? e.map(e =>
|
|
827
|
-
},
|
|
839
|
+
return Array.isArray(e) ? e.map(e => De(e)) : e;
|
|
840
|
+
}, Me = e => /^([a-zA-Z0-9_.-][a-zA-Z0-9_.-]*)$/.test(e) && e.length <= 256 && e.length > 0, Re = (e, t, n, r) => {
|
|
828
841
|
const s = {
|
|
829
|
-
id:
|
|
842
|
+
id: be(),
|
|
830
843
|
purpose: n,
|
|
831
844
|
granted: r,
|
|
832
845
|
timestamp: Date.now()
|
|
@@ -840,21 +853,44 @@ var we = (new class {
|
|
|
840
853
|
}), s;
|
|
841
854
|
};
|
|
842
855
|
|
|
843
|
-
|
|
856
|
+
a();
|
|
844
857
|
|
|
845
|
-
var
|
|
858
|
+
var Pe = e => `${e}_`, je = e => {
|
|
859
|
+
if ("undefined" != typeof btoa) return btoa(e);
|
|
860
|
+
const t = globalThis;
|
|
861
|
+
if ("function" == typeof t.Buffer) {
|
|
862
|
+
return t.Buffer.from(e, "binary").toString("base64");
|
|
863
|
+
}
|
|
864
|
+
throw new Error("Base64 encoding not available in this environment");
|
|
865
|
+
}, Te = e => {
|
|
866
|
+
if ("undefined" != typeof atob) return atob(e);
|
|
867
|
+
const t = globalThis;
|
|
868
|
+
if ("function" == typeof t.Buffer) {
|
|
869
|
+
return t.Buffer.from(e, "base64").toString("binary");
|
|
870
|
+
}
|
|
871
|
+
throw new Error("Base64 decoding not available in this environment");
|
|
872
|
+
};
|
|
846
873
|
|
|
847
|
-
|
|
874
|
+
a();
|
|
848
875
|
|
|
849
|
-
var
|
|
876
|
+
var Ie = () => {
|
|
850
877
|
try {
|
|
851
|
-
|
|
878
|
+
if ("production" === (() => {
|
|
879
|
+
try {
|
|
880
|
+
const e = globalThis;
|
|
881
|
+
if ("object" == typeof e.process && null !== e.process) {
|
|
882
|
+
const t = e.process;
|
|
883
|
+
if ("object" == typeof t.env && null !== t.env) return t.env;
|
|
884
|
+
}
|
|
885
|
+
} catch {}
|
|
886
|
+
return {};
|
|
887
|
+
})().NODE_ENV) return !0;
|
|
852
888
|
const e = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : {};
|
|
853
889
|
return void 0 !== e.__DEV__ && !1 === e.__DEV__;
|
|
854
890
|
} catch {
|
|
855
891
|
return !1;
|
|
856
892
|
}
|
|
857
|
-
}, Ie = () => "undefined" != typeof window ? window.localStorage : null,
|
|
893
|
+
}, ze = () => !Ie(), Ve = () => "undefined" != typeof window ? window.localStorage : null, $e = () => {
|
|
858
894
|
const e = new Map;
|
|
859
895
|
return {
|
|
860
896
|
getItem: t => e.get(t) || null,
|
|
@@ -865,13 +901,13 @@ var Te = () => {
|
|
|
865
901
|
return e.size;
|
|
866
902
|
}
|
|
867
903
|
};
|
|
868
|
-
},
|
|
869
|
-
const r = new Map, s = new Map, o = new Map, a = new Set,
|
|
870
|
-
n?.accessRules && n.accessRules.forEach(e =>
|
|
904
|
+
}, Ne = n => {
|
|
905
|
+
const r = new Map, s = new Map, o = new Map, a = new Set, l = new Map, u = new Set, f = new Map, d = new Map, y = new Map, p = new Map, g = new Map, h = new Map, m = new Map, S = new Map, _ = n?.namespace || "gstate", w = n?.silent ?? !1, b = n?.debounceTime ?? 150, v = n?.version ?? 0, E = n?.storage || Ve(), k = n?.onError, x = n?.maxObjectSize ?? 0, O = n?.maxTotalSize ?? 0, C = n?.encryptionKey ?? null, A = n?.validateInput ?? !0, D = n?.auditEnabled ?? !0, M = n?.userId, R = n?.immer ?? !0, P = n?.persistByDefault ?? n?.persistence ?? n?.persist ?? !1;
|
|
906
|
+
n?.accessRules && n.accessRules.forEach(e => Ce(m, e.pattern, e.permissions));
|
|
871
907
|
let j, T = !1, I = !1, z = !1, V = 0, $ = null, N = null;
|
|
872
908
|
const U = new Promise(e => {
|
|
873
909
|
j = e;
|
|
874
|
-
}),
|
|
910
|
+
}), B = () => `${_}_`, F = () => ({
|
|
875
911
|
store: r,
|
|
876
912
|
versions: s,
|
|
877
913
|
sizes: o,
|
|
@@ -879,14 +915,14 @@ var Te = () => {
|
|
|
879
915
|
storage: E,
|
|
880
916
|
config: n || {},
|
|
881
917
|
diskQueue: g,
|
|
882
|
-
encryptionKey:
|
|
883
|
-
audit:
|
|
918
|
+
encryptionKey: C,
|
|
919
|
+
audit: W,
|
|
884
920
|
onError: k,
|
|
885
921
|
silent: w,
|
|
886
922
|
debounceTime: b,
|
|
887
923
|
currentVersion: v
|
|
888
|
-
}),
|
|
889
|
-
plugins:
|
|
924
|
+
}), K = () => ({
|
|
925
|
+
plugins: p,
|
|
890
926
|
onError: k,
|
|
891
927
|
silent: w
|
|
892
928
|
}), J = e => {
|
|
@@ -908,7 +944,7 @@ var Te = () => {
|
|
|
908
944
|
}
|
|
909
945
|
}
|
|
910
946
|
return n;
|
|
911
|
-
},
|
|
947
|
+
}, H = (e, t) => {
|
|
912
948
|
((e, t, n) => {
|
|
913
949
|
if (0 !== e.plugins.size) for (const r of e.plugins.values()) {
|
|
914
950
|
const s = r.hooks?.[t];
|
|
@@ -922,9 +958,9 @@ var Te = () => {
|
|
|
922
958
|
}) : e.silent;
|
|
923
959
|
}
|
|
924
960
|
}
|
|
925
|
-
})(
|
|
926
|
-
},
|
|
927
|
-
D && null !==
|
|
961
|
+
})(K(), e, t);
|
|
962
|
+
}, W = (e, t, n, r) => {
|
|
963
|
+
D && null !== xe && Oe && Oe({
|
|
928
964
|
timestamp: Date.now(),
|
|
929
965
|
action: e,
|
|
930
966
|
key: t,
|
|
@@ -932,26 +968,26 @@ var Te = () => {
|
|
|
932
968
|
success: n,
|
|
933
969
|
error: r
|
|
934
970
|
});
|
|
935
|
-
},
|
|
936
|
-
const r =
|
|
971
|
+
}, Q = n => {
|
|
972
|
+
const r = d.get(n);
|
|
937
973
|
if (!r) return;
|
|
938
|
-
const o = new Set, a = r.selector(e => (o.add(e),
|
|
974
|
+
const o = new Set, a = r.selector(e => (o.add(e), d.has(e) ? d.get(e).lastValue : Z.get(e)));
|
|
939
975
|
r.deps.forEach(e => {
|
|
940
976
|
if (!o.has(e)) {
|
|
941
|
-
const t =
|
|
942
|
-
t && (t.delete(n), 0 === t.size &&
|
|
977
|
+
const t = y.get(e);
|
|
978
|
+
t && (t.delete(n), 0 === t.size && y.delete(e));
|
|
943
979
|
}
|
|
944
980
|
}), o.forEach(e => {
|
|
945
|
-
r.deps.has(e) || (
|
|
946
|
-
}), r.deps = o, t(r.lastValue, a) || (r.lastValue =
|
|
947
|
-
s.set(n, (s.get(n) || 0) + 1),
|
|
948
|
-
},
|
|
981
|
+
r.deps.has(e) || (y.has(e) || y.set(e, new Set), y.get(e).add(n));
|
|
982
|
+
}), r.deps = o, t(r.lastValue, a) || (r.lastValue = R && null !== a && "object" == typeof a ? L(e(a), !0) : a,
|
|
983
|
+
s.set(n, (s.get(n) || 0) + 1), G(n));
|
|
984
|
+
}, G = e => {
|
|
949
985
|
if (e) {
|
|
950
|
-
if (
|
|
951
|
-
const t =
|
|
952
|
-
for (const e of t)
|
|
986
|
+
if (y.has(e)) {
|
|
987
|
+
const t = y.get(e);
|
|
988
|
+
for (const e of t) Q(e);
|
|
953
989
|
}
|
|
954
|
-
const t =
|
|
990
|
+
const t = f.get(e);
|
|
955
991
|
if (t) {
|
|
956
992
|
const n = Z.get(e);
|
|
957
993
|
for (const r of t) try {
|
|
@@ -964,7 +1000,7 @@ var Te = () => {
|
|
|
964
1000
|
});
|
|
965
1001
|
}
|
|
966
1002
|
}
|
|
967
|
-
const n =
|
|
1003
|
+
const n = l.get(e);
|
|
968
1004
|
if (n) for (const t of n) try {
|
|
969
1005
|
t();
|
|
970
1006
|
} catch (t) {
|
|
@@ -983,10 +1019,10 @@ var Te = () => {
|
|
|
983
1019
|
operation: "listener"
|
|
984
1020
|
});
|
|
985
1021
|
}
|
|
986
|
-
},
|
|
1022
|
+
}, q = async () => {
|
|
987
1023
|
(async e => {
|
|
988
1024
|
if (!e.storage) return;
|
|
989
|
-
const {store: t, config: n, diskQueue: r, storage: s, encryptionKey: o, audit: a, onError: i, silent: c, currentVersion: l} = e, u =
|
|
1025
|
+
const {store: t, config: n, diskQueue: r, storage: s, encryptionKey: o, audit: a, onError: i, silent: c, currentVersion: l} = e, u = Pe(n.namespace || "gstate");
|
|
990
1026
|
try {
|
|
991
1027
|
const e = {};
|
|
992
1028
|
let r;
|
|
@@ -994,7 +1030,7 @@ var Te = () => {
|
|
|
994
1030
|
e[n] = t;
|
|
995
1031
|
});
|
|
996
1032
|
const o = n?.encoded;
|
|
997
|
-
r = o ?
|
|
1033
|
+
r = o ? je(JSON.stringify(e)) : JSON.stringify(e), s.setItem(u.replace("_", ""), JSON.stringify({
|
|
998
1034
|
v: 1,
|
|
999
1035
|
t: Date.now(),
|
|
1000
1036
|
e: null,
|
|
@@ -1009,16 +1045,16 @@ var Te = () => {
|
|
|
1009
1045
|
key: "FULL_STATE"
|
|
1010
1046
|
});
|
|
1011
1047
|
}
|
|
1012
|
-
const
|
|
1048
|
+
const f = Array.from(r.entries());
|
|
1013
1049
|
r.clear();
|
|
1014
|
-
for (const [t, n] of
|
|
1050
|
+
for (const [t, n] of f) try {
|
|
1015
1051
|
if (!t || !/^[a-zA-Z0-9_.-]+$/.test(t) || t.length > 256) continue;
|
|
1016
1052
|
let r = n.value;
|
|
1017
1053
|
const i = n.options.encoded || n.options.encrypted || n.options.secure;
|
|
1018
1054
|
if (n.options.encrypted) {
|
|
1019
1055
|
if (!o) throw new Error(`Encryption key missing for "${t}"`);
|
|
1020
|
-
r = await
|
|
1021
|
-
} else i ? r =
|
|
1056
|
+
r = await Ee(n.value, o);
|
|
1057
|
+
} else i ? r = je(JSON.stringify(n.value)) : "object" == typeof n.value && null !== n.value && (r = JSON.stringify(n.value));
|
|
1022
1058
|
s.setItem(`${u}${t}`, JSON.stringify({
|
|
1023
1059
|
v: e.versions.get(t) || 1,
|
|
1024
1060
|
t: Date.now(),
|
|
@@ -1035,10 +1071,10 @@ var Te = () => {
|
|
|
1035
1071
|
key: t
|
|
1036
1072
|
});
|
|
1037
1073
|
}
|
|
1038
|
-
})(
|
|
1074
|
+
})(F());
|
|
1039
1075
|
}, X = {}, Z = {
|
|
1040
1076
|
_setSilently: (t, n) => {
|
|
1041
|
-
const a = o.get(t) || 0, i =
|
|
1077
|
+
const a = o.get(t) || 0, i = R && null !== n && "object" == typeof n ? L(e(n), !0) : n, c = (x > 0 || O > 0) && !Ie() ? J(i) : 0;
|
|
1042
1078
|
V = V - a + c, o.set(t, c), r.set(t, i), s.set(t, (s.get(t) || 0) + 1), N = null;
|
|
1043
1079
|
},
|
|
1044
1080
|
_registerMethod: (e, t, n) => {
|
|
@@ -1046,19 +1082,19 @@ var Te = () => {
|
|
|
1046
1082
|
r(e) || r(t) || (X[e] || (X[e] = {}), X[e][t] = n);
|
|
1047
1083
|
},
|
|
1048
1084
|
set: (a, i, c = {}) => {
|
|
1049
|
-
const l = r.get(a), u =
|
|
1050
|
-
if (A && !
|
|
1051
|
-
if (!
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1085
|
+
const l = r.get(a), u = R && "function" == typeof i ? _e(l, i) : i;
|
|
1086
|
+
if (A && !Me(a)) return !1;
|
|
1087
|
+
if (!Ae(m, a, "write", M)) return W("set", a, !1, "RBAC Denied"), !1;
|
|
1088
|
+
const f = A ? De(u) : u, d = o.get(a) || 0;
|
|
1089
|
+
H("onBeforeSet", {
|
|
1054
1090
|
key: a,
|
|
1055
|
-
value:
|
|
1091
|
+
value: f,
|
|
1056
1092
|
store: Z,
|
|
1057
1093
|
version: s.get(a) || 0
|
|
1058
1094
|
});
|
|
1059
|
-
const
|
|
1060
|
-
if (!t(l,
|
|
1061
|
-
const e = (x > 0 ||
|
|
1095
|
+
const y = R && null !== f && "object" == typeof f ? L(e(f), !0) : f;
|
|
1096
|
+
if (!t(l, y)) {
|
|
1097
|
+
const e = (x > 0 || O > 0) && !Ie() ? J(y) : 0;
|
|
1062
1098
|
if (x > 0 && e > x) {
|
|
1063
1099
|
const t = new Error(`Object size (${e} bytes) exceeds maxObjectSize (${x} bytes)`);
|
|
1064
1100
|
return k && k(t, {
|
|
@@ -1066,49 +1102,49 @@ var Te = () => {
|
|
|
1066
1102
|
key: a
|
|
1067
1103
|
}), !1;
|
|
1068
1104
|
}
|
|
1069
|
-
if (
|
|
1070
|
-
const t = V -
|
|
1071
|
-
if (t >
|
|
1072
|
-
const e = new Error(`Total store size (${t} bytes) exceeds limit (${
|
|
1105
|
+
if (O > 0) {
|
|
1106
|
+
const t = V - d + e;
|
|
1107
|
+
if (t > O) {
|
|
1108
|
+
const e = new Error(`Total store size (${t} bytes) exceeds limit (${O} bytes)`);
|
|
1073
1109
|
return k && k(e, {
|
|
1074
1110
|
operation: "set"
|
|
1075
1111
|
}), !1;
|
|
1076
1112
|
}
|
|
1077
1113
|
}
|
|
1078
|
-
V = V -
|
|
1079
|
-
const t = c.persist ??
|
|
1114
|
+
V = V - d + e, o.set(a, e), r.set(a, y), s.set(a, (s.get(a) || 0) + 1), N = null;
|
|
1115
|
+
const t = c.persist ?? P;
|
|
1080
1116
|
return t && (g.set(a, {
|
|
1081
|
-
value:
|
|
1117
|
+
value: y,
|
|
1082
1118
|
options: {
|
|
1083
1119
|
...c,
|
|
1084
1120
|
persist: t,
|
|
1085
1121
|
encoded: c.encoded || n?.encoded
|
|
1086
1122
|
}
|
|
1087
|
-
}), $ && clearTimeout($), $ = setTimeout(
|
|
1123
|
+
}), $ && clearTimeout($), $ = setTimeout(q, b)), H("onSet", {
|
|
1088
1124
|
key: a,
|
|
1089
|
-
value:
|
|
1125
|
+
value: y,
|
|
1090
1126
|
store: Z,
|
|
1091
1127
|
version: s.get(a)
|
|
1092
|
-
}),
|
|
1128
|
+
}), W("set", a, !0), G(a), !0;
|
|
1093
1129
|
}
|
|
1094
1130
|
return !1;
|
|
1095
1131
|
},
|
|
1096
1132
|
get: e => {
|
|
1097
|
-
if (!
|
|
1133
|
+
if (!Ae(m, e, "read", M)) return W("get", e, !1, "RBAC Denied"), null;
|
|
1098
1134
|
const t = r.get(e);
|
|
1099
|
-
return
|
|
1135
|
+
return H("onGet", {
|
|
1100
1136
|
store: Z,
|
|
1101
1137
|
key: e,
|
|
1102
1138
|
value: t
|
|
1103
|
-
}),
|
|
1139
|
+
}), W("get", e, !0), t;
|
|
1104
1140
|
},
|
|
1105
1141
|
compute: (e, t) => {
|
|
1106
1142
|
try {
|
|
1107
|
-
return
|
|
1143
|
+
return d.has(e) || (d.set(e, {
|
|
1108
1144
|
selector: t,
|
|
1109
1145
|
lastValue: null,
|
|
1110
1146
|
deps: new Set
|
|
1111
|
-
}),
|
|
1147
|
+
}), Q(e)), d.get(e).lastValue;
|
|
1112
1148
|
} catch (t) {
|
|
1113
1149
|
const n = t instanceof Error ? t : new Error(String(t));
|
|
1114
1150
|
return k && k(n, {
|
|
@@ -1118,26 +1154,26 @@ var Te = () => {
|
|
|
1118
1154
|
}
|
|
1119
1155
|
},
|
|
1120
1156
|
watch: (e, t) => {
|
|
1121
|
-
|
|
1122
|
-
const n =
|
|
1157
|
+
f.has(e) || f.set(e, new Set);
|
|
1158
|
+
const n = f.get(e);
|
|
1123
1159
|
return n.add(t), () => {
|
|
1124
|
-
n.delete(t), 0 === n.size &&
|
|
1160
|
+
n.delete(t), 0 === n.size && f.delete(e);
|
|
1125
1161
|
};
|
|
1126
1162
|
},
|
|
1127
1163
|
remove: e => {
|
|
1128
|
-
if (!
|
|
1164
|
+
if (!Ae(m, e, "delete", M)) return W("delete", e, !1, "RBAC Denied"), !1;
|
|
1129
1165
|
const t = r.get(e), n = r.delete(e);
|
|
1130
|
-
return n && (V -= o.get(e) || 0, o.delete(e),
|
|
1166
|
+
return n && (V -= o.get(e) || 0, o.delete(e), H("onRemove", {
|
|
1131
1167
|
store: Z,
|
|
1132
1168
|
key: e,
|
|
1133
1169
|
value: t
|
|
1134
|
-
}), N = null), s.set(e, (s.get(e) || 0) + 1), E && E.removeItem(`${
|
|
1135
|
-
|
|
1170
|
+
}), N = null), s.set(e, (s.get(e) || 0) + 1), E && E.removeItem(`${B()}${e}`), W("delete", e, !0),
|
|
1171
|
+
G(e), n;
|
|
1136
1172
|
},
|
|
1137
1173
|
delete: e => Z.remove(e),
|
|
1138
1174
|
deleteAll: () => {
|
|
1139
1175
|
if (Array.from(r.keys()).forEach(e => Z.remove(e)), E) {
|
|
1140
|
-
const e =
|
|
1176
|
+
const e = B(), t = [], n = E.length || 0;
|
|
1141
1177
|
for (let r = 0; r < n; r++) {
|
|
1142
1178
|
const n = E.key(r);
|
|
1143
1179
|
n && n.startsWith(e) && t.push(n);
|
|
@@ -1151,24 +1187,24 @@ var Te = () => {
|
|
|
1151
1187
|
u.add(e);
|
|
1152
1188
|
},
|
|
1153
1189
|
transaction: e => {
|
|
1154
|
-
T = !0,
|
|
1190
|
+
T = !0, H("onTransaction", {
|
|
1155
1191
|
store: Z,
|
|
1156
1192
|
key: "START"
|
|
1157
1193
|
});
|
|
1158
1194
|
try {
|
|
1159
1195
|
e();
|
|
1160
1196
|
} finally {
|
|
1161
|
-
T = !1,
|
|
1197
|
+
T = !1, H("onTransaction", {
|
|
1162
1198
|
store: Z,
|
|
1163
1199
|
key: "END"
|
|
1164
|
-
}), I && (I = !1,
|
|
1200
|
+
}), I && (I = !1, G());
|
|
1165
1201
|
}
|
|
1166
1202
|
},
|
|
1167
1203
|
destroy: () => {
|
|
1168
1204
|
$ && (clearTimeout($), $ = null), g.clear(), "undefined" != typeof window && window.removeEventListener("beforeunload", Y),
|
|
1169
|
-
|
|
1205
|
+
H("onDestroy", {
|
|
1170
1206
|
store: Z
|
|
1171
|
-
}), a.clear(),
|
|
1207
|
+
}), a.clear(), l.clear(), f.clear(), d.clear(), y.clear(), p.clear(), r.clear(),
|
|
1172
1208
|
o.clear(), V = 0, m.clear(), S.clear(), s.clear(), h.clear(), u.clear();
|
|
1173
1209
|
},
|
|
1174
1210
|
_addPlugin: e => {
|
|
@@ -1184,24 +1220,24 @@ var Te = () => {
|
|
|
1184
1220
|
key: t.name
|
|
1185
1221
|
}) : e.silent;
|
|
1186
1222
|
}
|
|
1187
|
-
})(
|
|
1223
|
+
})(K(), e, Z);
|
|
1188
1224
|
},
|
|
1189
1225
|
_removePlugin: e => {
|
|
1190
|
-
|
|
1226
|
+
p.delete(e);
|
|
1191
1227
|
},
|
|
1192
1228
|
_subscribe: (e, t) => {
|
|
1193
1229
|
if (t) {
|
|
1194
|
-
|
|
1195
|
-
const n =
|
|
1230
|
+
l.has(t) || l.set(t, new Set);
|
|
1231
|
+
const n = l.get(t);
|
|
1196
1232
|
return n.add(e), () => {
|
|
1197
|
-
n.delete(e), 0 === n.size &&
|
|
1233
|
+
n.delete(e), 0 === n.size && l.delete(t);
|
|
1198
1234
|
};
|
|
1199
1235
|
}
|
|
1200
1236
|
return a.add(e), () => a.delete(e);
|
|
1201
1237
|
},
|
|
1202
1238
|
_getVersion: e => s.get(e) ?? 0,
|
|
1203
|
-
addAccessRule: (e, t) =>
|
|
1204
|
-
hasPermission: (e, t, n) =>
|
|
1239
|
+
addAccessRule: (e, t) => Ce(m, e, t),
|
|
1240
|
+
hasPermission: (e, t, n) => Ae(m, e, t, n),
|
|
1205
1241
|
recordConsent: (e, t, n) => Re(S, e, t, n),
|
|
1206
1242
|
hasConsent: (e, t) => ((e, t, n) => {
|
|
1207
1243
|
const r = e.get(t);
|
|
@@ -1246,27 +1282,27 @@ var Te = () => {
|
|
|
1246
1282
|
t && Z._registerMethod("security", e, t);
|
|
1247
1283
|
});
|
|
1248
1284
|
const Y = () => {
|
|
1249
|
-
g.size > 0 &&
|
|
1285
|
+
g.size > 0 && q();
|
|
1250
1286
|
};
|
|
1251
1287
|
if ("undefined" != typeof window && window.addEventListener("beforeunload", Y),
|
|
1252
1288
|
E ? (async (t, n, r) => {
|
|
1253
|
-
const {storage: s, config: o, encryptionKey: a, audit: i, onError: c, silent: l, currentVersion: u, store:
|
|
1289
|
+
const {storage: s, config: o, encryptionKey: a, audit: i, onError: c, silent: l, currentVersion: u, store: f, sizes: d, versions: y} = t, p = Pe(o.namespace || "gstate"), g = o.immer ?? !0;
|
|
1254
1290
|
if (s) try {
|
|
1255
1291
|
const l = {};
|
|
1256
1292
|
let h = 0;
|
|
1257
1293
|
for (let e = 0; e < (s.length || 0); e++) {
|
|
1258
1294
|
const t = s.key(e);
|
|
1259
|
-
if (!t || !t.startsWith(
|
|
1295
|
+
if (!t || !t.startsWith(p)) continue;
|
|
1260
1296
|
const n = s.getItem(t);
|
|
1261
1297
|
if (n) try {
|
|
1262
|
-
const r = JSON.parse(n), o = t.substring(
|
|
1298
|
+
const r = JSON.parse(n), o = t.substring(p.length);
|
|
1263
1299
|
if (h = Math.max(h, void 0 !== r._sys_v ? r._sys_v : r.v || 0), r.e && Date.now() > r.e) {
|
|
1264
1300
|
s.removeItem(t), e--;
|
|
1265
1301
|
continue;
|
|
1266
1302
|
}
|
|
1267
1303
|
let c = r.d;
|
|
1268
|
-
if (r._enc && a) c = await
|
|
1269
|
-
c = JSON.parse(
|
|
1304
|
+
if (r._enc && a) c = await ke(c, a); else if ("string" == typeof c) if (r._b64) try {
|
|
1305
|
+
c = JSON.parse(Te(c));
|
|
1270
1306
|
} catch (e) {} else if (c.startsWith("{") || c.startsWith("[")) try {
|
|
1271
1307
|
c = JSON.parse(c);
|
|
1272
1308
|
} catch (e) {}
|
|
@@ -1282,8 +1318,8 @@ var Te = () => {
|
|
|
1282
1318
|
}
|
|
1283
1319
|
const m = h < u && o.migrate ? o.migrate(l, h) : l;
|
|
1284
1320
|
Object.entries(m).forEach(([r, s]) => {
|
|
1285
|
-
const o = g && null !== s && "object" == typeof s ?
|
|
1286
|
-
t.totalSize = t.totalSize - i + a,
|
|
1321
|
+
const o = g && null !== s && "object" == typeof s ? L(e(s), !0) : s, a = n(o), i = d.get(r) || 0;
|
|
1322
|
+
t.totalSize = t.totalSize - i + a, d.set(r, a), f.set(r, o), y.set(r, 1);
|
|
1287
1323
|
}), r();
|
|
1288
1324
|
} catch (e) {
|
|
1289
1325
|
const t = e instanceof Error ? e : new Error(String(e));
|
|
@@ -1291,11 +1327,11 @@ var Te = () => {
|
|
|
1291
1327
|
operation: "hydration"
|
|
1292
1328
|
});
|
|
1293
1329
|
}
|
|
1294
|
-
})(
|
|
1295
|
-
z = !0, N = null, j(),
|
|
1330
|
+
})(F(), e => (x > 0 || O > 0) && !Ie() ? J(e) : 0, () => {
|
|
1331
|
+
z = !0, N = null, j(), G();
|
|
1296
1332
|
}).then(() => {}) : (z = !0, j()), n?.sync) {
|
|
1297
1333
|
const e = n.sync, t = async () => {
|
|
1298
|
-
const {SyncEngine: t} = await Promise.resolve().then(() => (
|
|
1334
|
+
const {SyncEngine: t} = await Promise.resolve().then(() => (c(), i));
|
|
1299
1335
|
return new t(Z, e);
|
|
1300
1336
|
};
|
|
1301
1337
|
let r = null;
|
|
@@ -1316,12 +1352,27 @@ var Te = () => {
|
|
|
1316
1352
|
return Z;
|
|
1317
1353
|
};
|
|
1318
1354
|
|
|
1319
|
-
|
|
1355
|
+
c();
|
|
1320
1356
|
|
|
1321
|
-
var
|
|
1357
|
+
var Ue = new Map, Le = "__default__";
|
|
1322
1358
|
|
|
1323
|
-
|
|
1324
|
-
|
|
1359
|
+
"undefined" != typeof module && module.hot && module.hot.dispose(() => {
|
|
1360
|
+
Ue.forEach(e => {
|
|
1361
|
+
try {
|
|
1362
|
+
e.destroy();
|
|
1363
|
+
} catch {}
|
|
1364
|
+
}), Ue.clear();
|
|
1365
|
+
});
|
|
1366
|
+
|
|
1367
|
+
var Be = () => Ue.get(Le) || null, Fe = (e, t) => {
|
|
1368
|
+
Ue.set(e, t);
|
|
1369
|
+
};
|
|
1370
|
+
|
|
1371
|
+
function Ke(e, t) {
|
|
1372
|
+
const r = n.useMemo(() => t || (() => {
|
|
1373
|
+
const e = Be();
|
|
1374
|
+
return !e && Ie(), e;
|
|
1375
|
+
})(), [ t ]), s = n.useMemo(() => {
|
|
1325
1376
|
const e = () => {}, t = () => !1, n = () => null;
|
|
1326
1377
|
return {
|
|
1327
1378
|
set: t,
|
|
@@ -1354,25 +1405,31 @@ function Ue(e, t) {
|
|
|
1354
1405
|
},
|
|
1355
1406
|
get userId() {}
|
|
1356
1407
|
};
|
|
1357
|
-
}, []), o = r || s, a = "function" == typeof e,
|
|
1358
|
-
|
|
1359
|
-
|
|
1408
|
+
}, []), o = r || s, a = !r, i = "function" == typeof e, c = i ? null : e, l = i ? e : null, u = n.useRef(!1);
|
|
1409
|
+
!a || i || Ie() || u.current || (u.current = !0);
|
|
1410
|
+
const f = n.useCallback(e => i ? o._subscribe(e) : o._subscribe(e, c), [ o, i, c ]), d = n.useCallback(() => i ? l(o.getSnapshot()) : o.get(c) ?? void 0, [ o, i, c, l ]), y = n.useCallback(() => {
|
|
1411
|
+
if (i) try {
|
|
1412
|
+
const e = new Proxy({}, {
|
|
1413
|
+
get: () => {},
|
|
1414
|
+
has: () => !1
|
|
1415
|
+
});
|
|
1416
|
+
return l(e);
|
|
1360
1417
|
} catch {
|
|
1361
1418
|
return;
|
|
1362
1419
|
}
|
|
1363
|
-
}, [
|
|
1364
|
-
!1) : o.set(
|
|
1365
|
-
return n.useDebugValue(
|
|
1366
|
-
|
|
1420
|
+
}, [ l, i ]), p = n.useSyncExternalStore(f, d, y), g = n.useCallback((e, t) => i ? (Ie(),
|
|
1421
|
+
!1) : !!r && o.set(c, e, t), [ o, i, c, r ]);
|
|
1422
|
+
return n.useDebugValue(p, e => i ? `Selector: ${JSON.stringify(e)}` : `${c}: ${JSON.stringify(e)}`),
|
|
1423
|
+
i ? p : [ p, g ];
|
|
1367
1424
|
}
|
|
1368
1425
|
|
|
1369
|
-
var
|
|
1426
|
+
var Je = new Map;
|
|
1370
1427
|
|
|
1371
|
-
var
|
|
1428
|
+
var He = () => "undefined" == typeof window || void 0 === window.document, We = () => !He(), Qe = e => {
|
|
1372
1429
|
const t = e?.ssrSafe ?? !0, n = e?.deferHydration ?? !1;
|
|
1373
1430
|
let r = e?.storage;
|
|
1374
|
-
!r && t && He() && (r =
|
|
1375
|
-
const s =
|
|
1431
|
+
!r && t && He() && (r = $e());
|
|
1432
|
+
const s = Ne({
|
|
1376
1433
|
...e,
|
|
1377
1434
|
storage: r || void 0,
|
|
1378
1435
|
persistByDefault: !n && (e?.persistByDefault ?? !1)
|
|
@@ -1385,7 +1442,9 @@ var Fe, Ke, Be, Je, We, qe, He = () => "undefined" == typeof window || void 0 ==
|
|
|
1385
1442
|
hydrate: async () => {
|
|
1386
1443
|
if (!o && !He()) {
|
|
1387
1444
|
if (t && !s.namespace.startsWith("async_")) {
|
|
1388
|
-
const t = s.getSnapshot()
|
|
1445
|
+
const t = s.getSnapshot();
|
|
1446
|
+
s.destroy();
|
|
1447
|
+
const n = Ne({
|
|
1389
1448
|
...e,
|
|
1390
1449
|
namespace: s.namespace,
|
|
1391
1450
|
storage: void 0,
|
|
@@ -1393,69 +1452,64 @@ var Fe, Ke, Be, Je, We, qe, He = () => "undefined" == typeof window || void 0 ==
|
|
|
1393
1452
|
});
|
|
1394
1453
|
Object.entries(t).forEach(([e, t]) => {
|
|
1395
1454
|
n._setSilently(e, t);
|
|
1396
|
-
}),
|
|
1397
|
-
}
|
|
1398
|
-
await s.whenReady();
|
|
1455
|
+
}), Object.assign(s, n);
|
|
1456
|
+
}
|
|
1457
|
+
o = !0, await s.whenReady();
|
|
1399
1458
|
}
|
|
1400
1459
|
},
|
|
1401
1460
|
getSerializedState: () => He() ? JSON.stringify(s.getSnapshot()) : a,
|
|
1402
1461
|
isHydrated: () => o || s.isReady
|
|
1403
1462
|
});
|
|
1404
|
-
},
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
useEffect: Be,
|
|
1409
|
-
useSyncExternalStore: Je,
|
|
1410
|
-
useMemo: We,
|
|
1411
|
-
useCallback: qe
|
|
1412
|
-
}), Ze = () => {
|
|
1413
|
-
const {useSyncExternalStore: e} = Xe();
|
|
1414
|
-
return e(e => () => {}, () => Qe(), () => !0);
|
|
1415
|
-
}, Ye = () => {
|
|
1416
|
-
const {useState: e, useEffect: t} = Xe(), [n, r] = e(() => He()), [s, o] = e(() => He());
|
|
1417
|
-
return t(() => {
|
|
1418
|
-
if (He()) return;
|
|
1419
|
-
r(!0);
|
|
1420
|
-
const e = setTimeout(() => {
|
|
1421
|
-
o(!0), r(!1);
|
|
1422
|
-
}, 0);
|
|
1423
|
-
return () => clearTimeout(e);
|
|
1424
|
-
}, []), {
|
|
1425
|
-
isHydrated: s,
|
|
1426
|
-
isHydrating: n
|
|
1463
|
+
}, Ge = () => n.useSyncExternalStore(e => () => {}, () => We(), () => !0), qe = () => {
|
|
1464
|
+
if (He()) return {
|
|
1465
|
+
isHydrated: !0,
|
|
1466
|
+
isHydrating: !1
|
|
1427
1467
|
};
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1468
|
+
const [e, t] = n.useState(!1);
|
|
1469
|
+
return n.useEffect(() => {
|
|
1470
|
+
if (e) return;
|
|
1471
|
+
const n = requestAnimationFrame(() => {
|
|
1472
|
+
t(!0);
|
|
1473
|
+
});
|
|
1474
|
+
return () => cancelAnimationFrame(n);
|
|
1475
|
+
}, [ e ]), {
|
|
1476
|
+
isHydrated: e,
|
|
1477
|
+
isHydrating: !e
|
|
1478
|
+
};
|
|
1479
|
+
}, Xe = e => {
|
|
1480
|
+
const [t, r] = n.useState(() => !!He() || (e.isHydrated?.() ?? e.isReady));
|
|
1481
|
+
return n.useEffect(() => {
|
|
1431
1482
|
if (He()) return;
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1483
|
+
if (t) return;
|
|
1484
|
+
return (async () => {
|
|
1485
|
+
if (e.isHydrated?.() ?? e.isReady) return void r(!0);
|
|
1486
|
+
const t = e._subscribe(() => {
|
|
1487
|
+
(e.isHydrated?.() ?? e.isReady) && (r(!0), t());
|
|
1488
|
+
});
|
|
1489
|
+
try {
|
|
1490
|
+
await e.whenReady(), r(!0), t();
|
|
1491
|
+
} catch {}
|
|
1492
|
+
})(), () => {};
|
|
1493
|
+
}, [ e, t ]), n.useMemo(() => {
|
|
1494
|
+
if (t) return e;
|
|
1495
|
+
const n = () => {}, r = () => !1, s = () => null;
|
|
1442
1496
|
return {
|
|
1443
|
-
set:
|
|
1444
|
-
get:
|
|
1445
|
-
remove:
|
|
1446
|
-
delete:
|
|
1447
|
-
deleteAll:
|
|
1497
|
+
set: r,
|
|
1498
|
+
get: s,
|
|
1499
|
+
remove: r,
|
|
1500
|
+
delete: r,
|
|
1501
|
+
deleteAll: r,
|
|
1448
1502
|
list: () => ({}),
|
|
1449
|
-
compute:
|
|
1503
|
+
compute: s,
|
|
1450
1504
|
watch: () => () => {},
|
|
1451
|
-
use:
|
|
1452
|
-
transaction:
|
|
1453
|
-
destroy:
|
|
1505
|
+
use: n,
|
|
1506
|
+
transaction: n,
|
|
1507
|
+
destroy: n,
|
|
1454
1508
|
_subscribe: () => () => {},
|
|
1455
|
-
_setSilently:
|
|
1456
|
-
_registerMethod:
|
|
1457
|
-
_addPlugin:
|
|
1458
|
-
_removePlugin:
|
|
1509
|
+
_setSilently: n,
|
|
1510
|
+
_registerMethod: n,
|
|
1511
|
+
_addPlugin: n,
|
|
1512
|
+
_removePlugin: n,
|
|
1459
1513
|
_getVersion: () => 0,
|
|
1460
1514
|
get isReady() {
|
|
1461
1515
|
return !1;
|
|
@@ -1472,8 +1526,8 @@ We = Fe.useMemo, qe = Fe.useCallback), {
|
|
|
1472
1526
|
return e.userId;
|
|
1473
1527
|
}
|
|
1474
1528
|
};
|
|
1475
|
-
}, [ e,
|
|
1476
|
-
},
|
|
1529
|
+
}, [ e, t ]);
|
|
1530
|
+
}, Ze = (e, t) => {
|
|
1477
1531
|
const n = t?.extraArgument, r = async t => {
|
|
1478
1532
|
if ("function" == typeof t) return t(r, () => e.getSnapshot(), n);
|
|
1479
1533
|
if (t.type) {
|
|
@@ -1492,7 +1546,7 @@ We = Fe.useMemo, qe = Fe.useCallback), {
|
|
|
1492
1546
|
return Object.assign(e, {
|
|
1493
1547
|
dispatch: r
|
|
1494
1548
|
});
|
|
1495
|
-
},
|
|
1549
|
+
}, Ye = (e, t) => async (n, r) => {
|
|
1496
1550
|
const s = r()[e];
|
|
1497
1551
|
n({
|
|
1498
1552
|
type: `SET_${e.toUpperCase()}`,
|
|
@@ -1524,9 +1578,9 @@ We = Fe.useMemo, qe = Fe.useCallback), {
|
|
|
1524
1578
|
}
|
|
1525
1579
|
};
|
|
1526
1580
|
|
|
1527
|
-
|
|
1581
|
+
c();
|
|
1528
1582
|
|
|
1529
|
-
exports.addAccessRule = (e, t) =>
|
|
1583
|
+
exports.addAccessRule = (e, t) => Be()?.addAccessRule(e, t), exports.all = e => ({
|
|
1530
1584
|
type: "all",
|
|
1531
1585
|
effects: e
|
|
1532
1586
|
}), exports.analyticsPlugin = e => ({
|
|
@@ -1606,15 +1660,15 @@ exports.addAccessRule = (e, t) => Ne()?.addAccessRule(e, t), exports.all = e =>
|
|
|
1606
1660
|
}
|
|
1607
1661
|
};
|
|
1608
1662
|
}, exports.createActions = (e, t) => {
|
|
1609
|
-
const n =
|
|
1663
|
+
const n = Ze(e);
|
|
1610
1664
|
return Object.assign(n.dispatch, t);
|
|
1611
|
-
}, exports.createAsyncAction =
|
|
1612
|
-
|
|
1665
|
+
}, exports.createAsyncAction = Ye, exports.createAsyncActions = (e, t) => {
|
|
1666
|
+
Ze(e);
|
|
1613
1667
|
const n = {};
|
|
1614
|
-
for (const [e, r] of Object.entries(t)) n[e] =
|
|
1668
|
+
for (const [e, r] of Object.entries(t)) n[e] = Ye(e, r);
|
|
1615
1669
|
return n;
|
|
1616
1670
|
}, exports.createAsyncStore = (e, t) => {
|
|
1617
|
-
const n = t?.key || "async_data", r = t?.store ||
|
|
1671
|
+
const n = t?.key || "async_data", r = t?.store || Ne({
|
|
1618
1672
|
namespace: `async_${n}`,
|
|
1619
1673
|
silent: !0
|
|
1620
1674
|
});
|
|
@@ -1671,7 +1725,7 @@ exports.addAccessRule = (e, t) => Ne()?.addAccessRule(e, t), exports.all = e =>
|
|
|
1671
1725
|
name: "Firebase-Firestore",
|
|
1672
1726
|
save: async e => {
|
|
1673
1727
|
try {
|
|
1674
|
-
|
|
1728
|
+
Ie();
|
|
1675
1729
|
return (() => {})("[Mock] Firestore Syncing:", e), !0;
|
|
1676
1730
|
} catch (e) {
|
|
1677
1731
|
return !1;
|
|
@@ -1702,19 +1756,19 @@ exports.addAccessRule = (e, t) => Ne()?.addAccessRule(e, t), exports.all = e =>
|
|
|
1702
1756
|
})
|
|
1703
1757
|
})).ok
|
|
1704
1758
|
}), exports.createNextStore = e => {
|
|
1705
|
-
const t =
|
|
1759
|
+
const t = Qe(e);
|
|
1706
1760
|
return Object.assign(t, {
|
|
1707
|
-
useHydrated:
|
|
1708
|
-
useHydrationStatus:
|
|
1761
|
+
useHydrated: Ge,
|
|
1762
|
+
useHydrationStatus: qe,
|
|
1709
1763
|
useDeferredStore: e => {
|
|
1710
|
-
const
|
|
1764
|
+
const r = Xe(t);
|
|
1711
1765
|
return (e => {
|
|
1712
|
-
const
|
|
1713
|
-
return
|
|
1766
|
+
const t = n.useCallback(t => r._subscribe(t, e), [ r, e ]), s = n.useCallback(() => r.get(e), [ r, e ]);
|
|
1767
|
+
return n.useSyncExternalStore(t, s, () => {});
|
|
1714
1768
|
})(e);
|
|
1715
1769
|
}
|
|
1716
1770
|
});
|
|
1717
|
-
}, exports.createSSRStore =
|
|
1771
|
+
}, exports.createSSRStore = Qe, exports.createSaga = e => async (t, n) => {
|
|
1718
1772
|
const r = async e => {
|
|
1719
1773
|
switch (e.type) {
|
|
1720
1774
|
case "call":
|
|
@@ -1758,12 +1812,12 @@ exports.addAccessRule = (e, t) => Ne()?.addAccessRule(e, t), exports.all = e =>
|
|
|
1758
1812
|
credentials: "same-origin"
|
|
1759
1813
|
})).ok;
|
|
1760
1814
|
}
|
|
1761
|
-
}), exports.createStore =
|
|
1762
|
-
if (
|
|
1815
|
+
}), exports.createStore = Ne, exports.createThunkStore = Ze, exports.debugPlugin = () => {
|
|
1816
|
+
if (Ie()) return {
|
|
1763
1817
|
name: "gstate-debug-noop",
|
|
1764
1818
|
hooks: {}
|
|
1765
1819
|
};
|
|
1766
|
-
|
|
1820
|
+
Ie();
|
|
1767
1821
|
return {
|
|
1768
1822
|
name: "gstate-debug",
|
|
1769
1823
|
hooks: {
|
|
@@ -1797,11 +1851,11 @@ exports.addAccessRule = (e, t) => Ne()?.addAccessRule(e, t), exports.all = e =>
|
|
|
1797
1851
|
}
|
|
1798
1852
|
};
|
|
1799
1853
|
}, exports.dehydrateStore = e => JSON.stringify(e.getSnapshot()), exports.deleteUserData = e => {
|
|
1800
|
-
const t =
|
|
1854
|
+
const t = Be();
|
|
1801
1855
|
if (!t) throw new Error("[gstate] deleteUserData failed: No store found.");
|
|
1802
1856
|
return t.deleteUserData(e);
|
|
1803
1857
|
}, exports.deriveKeyFromPassword = async (e, t, n = 6e5) => {
|
|
1804
|
-
if (!
|
|
1858
|
+
if (!ve) throw new Error("Web Crypto API not available");
|
|
1805
1859
|
const r = await crypto.subtle.importKey("raw", (new TextEncoder).encode(e), "PBKDF2", !1, [ "deriveKey" ]);
|
|
1806
1860
|
return {
|
|
1807
1861
|
key: await crypto.subtle.deriveKey({
|
|
@@ -1815,11 +1869,18 @@ exports.addAccessRule = (e, t) => Ne()?.addAccessRule(e, t), exports.all = e =>
|
|
|
1815
1869
|
}, !0, [ "encrypt", "decrypt" ]),
|
|
1816
1870
|
iv: crypto.getRandomValues(new Uint8Array(12))
|
|
1817
1871
|
};
|
|
1818
|
-
}, exports.
|
|
1819
|
-
|
|
1872
|
+
}, exports.destroyAllStores = () => {
|
|
1873
|
+
Ue.forEach(e => {
|
|
1874
|
+
try {
|
|
1875
|
+
e.destroy();
|
|
1876
|
+
} catch {}
|
|
1877
|
+
}), Ue.clear();
|
|
1878
|
+
}, exports.destroyState = e => {
|
|
1879
|
+
const t = e || Le, n = Ue.get(t);
|
|
1880
|
+
n && (n.destroy(), Ue.delete(t));
|
|
1820
1881
|
}, exports.destroySync = e => {
|
|
1821
|
-
const t =
|
|
1822
|
-
t && (t.destroy(),
|
|
1882
|
+
const t = Je.get(e);
|
|
1883
|
+
t && (t.destroy(), Je.delete(e));
|
|
1823
1884
|
}, exports.devToolsPlugin = e => {
|
|
1824
1885
|
const t = globalThis.__REDUX_DEVTOOLS_EXTENSION__;
|
|
1825
1886
|
if (!t?.connect) return {
|
|
@@ -1850,11 +1911,11 @@ exports.addAccessRule = (e, t) => Ne()?.addAccessRule(e, t), exports.all = e =>
|
|
|
1850
1911
|
iv: btoa(String.fromCharCode(...e.iv))
|
|
1851
1912
|
};
|
|
1852
1913
|
}, exports.exportUserData = e => {
|
|
1853
|
-
const t =
|
|
1914
|
+
const t = Be();
|
|
1854
1915
|
if (!t) throw new Error("[gstate] exportUserData failed: No store found.");
|
|
1855
1916
|
return t.exportUserData(e);
|
|
1856
1917
|
}, exports.generateEncryptionKey = async () => {
|
|
1857
|
-
if (!
|
|
1918
|
+
if (!ve) throw new Error("Web Crypto API not available");
|
|
1858
1919
|
return {
|
|
1859
1920
|
key: await crypto.subtle.generateKey({
|
|
1860
1921
|
name: "AES-GCM",
|
|
@@ -1863,17 +1924,17 @@ exports.addAccessRule = (e, t) => Ne()?.addAccessRule(e, t), exports.all = e =>
|
|
|
1863
1924
|
iv: crypto.getRandomValues(new Uint8Array(12))
|
|
1864
1925
|
};
|
|
1865
1926
|
}, exports.generateSalt = (e = 32) => crypto.getRandomValues(new Uint8Array(e)),
|
|
1866
|
-
exports.getConsents = e =>
|
|
1867
|
-
exports.getStore =
|
|
1868
|
-
const n =
|
|
1927
|
+
exports.getConsents = e => Be()?.getConsents(e) ?? [], exports.getSSRInitialState = e => e.getSnapshot(),
|
|
1928
|
+
exports.getStore = Be, exports.getStoreByNamespace = e => Ue.get(e) || null, exports.gstate = (e, t) => {
|
|
1929
|
+
const n = "string" == typeof t ? {
|
|
1869
1930
|
namespace: t
|
|
1870
|
-
} : t);
|
|
1871
|
-
e && Object.entries(e).forEach(([e, t]) => {
|
|
1872
|
-
null ===
|
|
1931
|
+
} : t, r = n?.namespace || "gstate", s = Ne(n);
|
|
1932
|
+
Fe(r, s), e && Object.entries(e).forEach(([e, t]) => {
|
|
1933
|
+
null === s.get(e) && s._setSilently(e, t);
|
|
1873
1934
|
});
|
|
1874
|
-
const
|
|
1875
|
-
return "undefined"
|
|
1876
|
-
window.rgs =
|
|
1935
|
+
const o = e => Ke(e, s);
|
|
1936
|
+
return "undefined" != typeof window && ze() && (window.gstate = o, window.gState = s,
|
|
1937
|
+
window.rgs = s), Object.assign(o, s);
|
|
1877
1938
|
}, exports.guardPlugin = e => ({
|
|
1878
1939
|
name: "gstate-guard",
|
|
1879
1940
|
hooks: {
|
|
@@ -1883,7 +1944,7 @@ exports.getStore = Ne, exports.gstate = (e, t) => {
|
|
|
1883
1944
|
s && s(n);
|
|
1884
1945
|
}
|
|
1885
1946
|
}
|
|
1886
|
-
}), exports.hasConsent = (e, t) =>
|
|
1947
|
+
}), exports.hasConsent = (e, t) => Be()?.hasConsent(e, t) ?? !1, exports.hasPermission = (e, t, n) => Be()?.hasPermission(e, t, n) ?? !0,
|
|
1887
1948
|
exports.hydrateOnClient = async e => {
|
|
1888
1949
|
He() || await e.whenReady();
|
|
1889
1950
|
}, exports.immerPlugin = () => ({
|
|
@@ -1971,18 +2032,20 @@ exports.hydrateOnClient = async e => {
|
|
|
1971
2032
|
}
|
|
1972
2033
|
};
|
|
1973
2034
|
}, exports.initState = e => {
|
|
1974
|
-
const t =
|
|
1975
|
-
return
|
|
2035
|
+
const t = e?.namespace || Le, n = Ue.get(t);
|
|
2036
|
+
if (n) return !e?.silent && ze(), n;
|
|
2037
|
+
const r = Ne(e);
|
|
2038
|
+
return Ue.set(t, r), r;
|
|
1976
2039
|
}, exports.initSync = (e, t) => {
|
|
1977
2040
|
const n = e.namespace;
|
|
1978
|
-
if (
|
|
2041
|
+
if (Je.has(n)) return Je.get(n);
|
|
1979
2042
|
const r = new exports.SyncEngine(e, t);
|
|
1980
|
-
return
|
|
2043
|
+
return Je.set(n, r), r;
|
|
1981
2044
|
}, exports.initializeFromSSR = (e, t) => {
|
|
1982
2045
|
He() || Object.entries(t).forEach(([t, n]) => {
|
|
1983
2046
|
e._setSilently(t, n);
|
|
1984
2047
|
});
|
|
1985
|
-
}, exports.isClientSide =
|
|
2048
|
+
}, exports.isClientSide = We, exports.isCryptoAvailable = ve, exports.isServerSide = He,
|
|
1986
2049
|
exports.logAudit = Oe, exports.loggerPlugin = e => ({
|
|
1987
2050
|
name: "gstate-logger",
|
|
1988
2051
|
hooks: {
|
|
@@ -1999,18 +2062,18 @@ exports.logAudit = Oe, exports.loggerPlugin = e => ({
|
|
|
1999
2062
|
type: "race",
|
|
2000
2063
|
effects: e
|
|
2001
2064
|
}), exports.recordConsent = (e, t, n) => {
|
|
2002
|
-
const r =
|
|
2065
|
+
const r = Be();
|
|
2003
2066
|
if (!r) throw new Error("[gstate] recordConsent failed: No store found. call initState() first.");
|
|
2004
2067
|
return r.recordConsent(e, t, n);
|
|
2005
|
-
}, exports.rehydrateStore = (e, t) => {
|
|
2068
|
+
}, exports.registerStore = Fe, exports.rehydrateStore = (e, t) => {
|
|
2006
2069
|
if (!He()) try {
|
|
2007
2070
|
const n = JSON.parse(t);
|
|
2008
2071
|
Object.entries(n).forEach(([t, n]) => {
|
|
2009
2072
|
e._setSilently(t, n);
|
|
2010
2073
|
});
|
|
2011
2074
|
} catch (e) {}
|
|
2012
|
-
}, exports.revokeConsent = (e, t) =>
|
|
2013
|
-
() => {}), exports.sanitizeValue =
|
|
2075
|
+
}, exports.revokeConsent = (e, t) => Be()?.revokeConsent(e, t), exports.runSaga = (e, t) => (Ze(e).dispatch(t),
|
|
2076
|
+
() => {}), exports.sanitizeValue = De, exports.schemaPlugin = e => ({
|
|
2014
2077
|
name: "gstate-schema",
|
|
2015
2078
|
hooks: {
|
|
2016
2079
|
onSet: ({key: t, value: n}) => {
|
|
@@ -2026,7 +2089,7 @@ exports.logAudit = Oe, exports.loggerPlugin = e => ({
|
|
|
2026
2089
|
type: "select",
|
|
2027
2090
|
selector: e
|
|
2028
2091
|
}), exports.setAuditLogger = e => {
|
|
2029
|
-
|
|
2092
|
+
xe = e;
|
|
2030
2093
|
}, exports.snapshotPlugin = () => {
|
|
2031
2094
|
const e = new Map;
|
|
2032
2095
|
return {
|
|
@@ -2081,9 +2144,9 @@ exports.logAudit = Oe, exports.loggerPlugin = e => ({
|
|
|
2081
2144
|
type: "take",
|
|
2082
2145
|
pattern: e
|
|
2083
2146
|
}), exports.triggerSync = async e => {
|
|
2084
|
-
const t = e ||
|
|
2147
|
+
const t = e || Be()?.namespace;
|
|
2085
2148
|
if (!t) return;
|
|
2086
|
-
const n =
|
|
2149
|
+
const n = Je.get(t);
|
|
2087
2150
|
n && await n.flush();
|
|
2088
2151
|
}, exports.undoRedoPlugin = e => {
|
|
2089
2152
|
let t = [], n = -1, r = !1;
|
|
@@ -2117,12 +2180,14 @@ exports.logAudit = Oe, exports.loggerPlugin = e => ({
|
|
|
2117
2180
|
}
|
|
2118
2181
|
}
|
|
2119
2182
|
};
|
|
2120
|
-
}, exports.
|
|
2121
|
-
|
|
2122
|
-
|
|
2183
|
+
}, exports.unregisterStore = e => {
|
|
2184
|
+
Ue.delete(e);
|
|
2185
|
+
}, exports.useDeferredStore = Xe, exports.useGState = Ke, exports.useHydrated = Ge,
|
|
2186
|
+
exports.useHydrationStatus = qe, exports.useIsStoreReady = e => {
|
|
2187
|
+
const t = e || Be(), r = n.useMemo(() => e => t ? t._subscribe(e) : () => {}, [ t ]);
|
|
2123
2188
|
return n.useSyncExternalStore(r, () => !!t && t.isReady, () => !0);
|
|
2124
|
-
}, exports.useSimpleState =
|
|
2125
|
-
const t = n.useMemo(() => e ||
|
|
2189
|
+
}, exports.useSimpleState = Ke, exports.useStore = Ke, exports.useStoreSubscribe = function(e) {
|
|
2190
|
+
const t = n.useMemo(() => e || Be(), [ e ]), r = n.useCallback(e => t ? t._subscribe(e) : () => {}, [ t ]), s = n.useCallback(() => !0, []), o = n.useCallback(() => !0, []);
|
|
2126
2191
|
n.useSyncExternalStore(r, s, o);
|
|
2127
2192
|
const [, a] = n.useState(0);
|
|
2128
2193
|
return [ !0, n.useCallback(() => a(e => e + 1), []) ];
|
|
@@ -2137,7 +2202,7 @@ exports.useHydrationStatus = Ye, exports.useIsStoreReady = e => {
|
|
|
2137
2202
|
return n.useEffect(() => {
|
|
2138
2203
|
const e = () => {
|
|
2139
2204
|
let e = !0, n = !1, r = 0, s = 0;
|
|
2140
|
-
|
|
2205
|
+
Je.forEach(t => {
|
|
2141
2206
|
const o = t.getState();
|
|
2142
2207
|
e = e && o.isOnline, n = n || o.isSyncing, r += o.pendingChanges, s += o.conflicts;
|
|
2143
2208
|
}), t({
|
|
@@ -2149,11 +2214,14 @@ exports.useHydrationStatus = Ye, exports.useIsStoreReady = e => {
|
|
|
2149
2214
|
});
|
|
2150
2215
|
};
|
|
2151
2216
|
e();
|
|
2152
|
-
const n = Array.from(
|
|
2217
|
+
const n = Array.from(Je.values()).map(t => t.onStateChange(e));
|
|
2153
2218
|
return () => n.forEach(e => e());
|
|
2154
2219
|
}, []), e;
|
|
2155
2220
|
}, exports.useSyncedState = function(e, t) {
|
|
2156
|
-
const r = t ||
|
|
2221
|
+
const r = t || Be(), s = r?.namespace || "default";
|
|
2222
|
+
let o = Je.get(s);
|
|
2223
|
+
!o && r && ze();
|
|
2224
|
+
const a = Ke(e, r), i = a[0], c = a[1], [l, u] = n.useState(() => o?.getState() || {
|
|
2157
2225
|
isOnline: !0,
|
|
2158
2226
|
isSyncing: !1,
|
|
2159
2227
|
lastSyncTimestamp: null,
|
|
@@ -2171,4 +2239,4 @@ exports.useHydrationStatus = Ye, exports.useIsStoreReady = e => {
|
|
|
2171
2239
|
}
|
|
2172
2240
|
return s;
|
|
2173
2241
|
}, [ c, o, e, r ]), l ];
|
|
2174
|
-
}, exports.validateKey =
|
|
2242
|
+
}, exports.validateKey = Me;
|