@biglogic/rgs 3.9.7 → 3.9.8
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/core/ssr.d.ts +73 -0
- package/core/thunk.d.ts +75 -0
- package/index.cjs +595 -338
- package/index.d.ts +4 -0
- package/index.js +602 -350
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var e, t, n = require("react"), r = Object.defineProperty, s = Object.getOwnPropertyNames, o = (e
|
|
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() {
|
|
4
9
|
return e && (t = (0, e[s(e)[0]])(e = 0)), t;
|
|
5
|
-
},
|
|
10
|
+
}, i = a({
|
|
6
11
|
"core/utils.ts"() {
|
|
7
12
|
e = e => {
|
|
8
13
|
if (null === e || "object" != typeof e) return e;
|
|
@@ -48,21 +53,21 @@ var e, t, n = require("react"), r = Object.defineProperty, s = Object.getOwnProp
|
|
|
48
53
|
return !0;
|
|
49
54
|
};
|
|
50
55
|
}
|
|
51
|
-
}),
|
|
56
|
+
}), c = {};
|
|
52
57
|
|
|
53
58
|
((e, t) => {
|
|
54
59
|
for (var n in t) r(e, n, {
|
|
55
60
|
get: t[n],
|
|
56
61
|
enumerable: !0
|
|
57
62
|
});
|
|
58
|
-
})(
|
|
63
|
+
})(c, {
|
|
59
64
|
SyncEngine: () => exports.SyncEngine,
|
|
60
65
|
createSyncEngine: () => exports.createSyncEngine
|
|
61
66
|
}), exports.SyncEngine = void 0, exports.createSyncEngine = void 0;
|
|
62
67
|
|
|
63
|
-
var
|
|
68
|
+
var l = a({
|
|
64
69
|
"core/sync.ts"() {
|
|
65
|
-
|
|
70
|
+
i(), exports.SyncEngine = class {
|
|
66
71
|
store;
|
|
67
72
|
config;
|
|
68
73
|
pendingQueue=new Map;
|
|
@@ -288,7 +293,7 @@ var c = o({
|
|
|
288
293
|
}
|
|
289
294
|
}, exports.createSyncEngine = (e, t) => new exports.SyncEngine(e, t);
|
|
290
295
|
}
|
|
291
|
-
}),
|
|
296
|
+
}), u = Symbol.for("immer-nothing"), d = Symbol.for("immer-draftable"), y = Symbol.for("immer-state"), p = [ function(e) {
|
|
292
297
|
return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
|
|
293
298
|
}, function(e) {
|
|
294
299
|
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}'`;
|
|
@@ -300,334 +305,334 @@ var c = o({
|
|
|
300
305
|
return `'original' expects a draft, got: ${e}`;
|
|
301
306
|
} ];
|
|
302
307
|
|
|
303
|
-
function
|
|
308
|
+
function f(e, ...t) {
|
|
304
309
|
{
|
|
305
|
-
const n =
|
|
310
|
+
const n = p[e], r = V(n) ? n.apply(null, t) : n;
|
|
306
311
|
throw new Error(`[Immer] ${r}`);
|
|
307
312
|
}
|
|
308
313
|
}
|
|
309
314
|
|
|
310
|
-
var
|
|
315
|
+
var g = Object, h = g.getPrototypeOf, m = "constructor", S = "prototype", _ = "configurable", w = "enumerable", b = "writable", v = "value", E = e => !!e && !!e[y];
|
|
311
316
|
|
|
312
|
-
function
|
|
313
|
-
return !!e && (
|
|
317
|
+
function k(e) {
|
|
318
|
+
return !!e && (C(e) || j(e) || !!e[d] || !!e[m]?.[d] || T(e) || I(e));
|
|
314
319
|
}
|
|
315
320
|
|
|
316
|
-
var
|
|
321
|
+
var x = g[S][m].toString(), O = new WeakMap;
|
|
317
322
|
|
|
318
|
-
function
|
|
319
|
-
if (!e || !
|
|
320
|
-
const t =
|
|
321
|
-
if (null === t || t ===
|
|
322
|
-
const n =
|
|
323
|
+
function C(e) {
|
|
324
|
+
if (!e || !z(e)) return !1;
|
|
325
|
+
const t = h(e);
|
|
326
|
+
if (null === t || t === g[S]) return !0;
|
|
327
|
+
const n = g.hasOwnProperty.call(t, m) && t[m];
|
|
323
328
|
if (n === Object) return !0;
|
|
324
|
-
if (!
|
|
325
|
-
let r =
|
|
326
|
-
return void 0 === r && (r = Function.toString.call(n),
|
|
329
|
+
if (!V(n)) return !1;
|
|
330
|
+
let r = O.get(n);
|
|
331
|
+
return void 0 === r && (r = Function.toString.call(n), O.set(n, r)), r === x;
|
|
327
332
|
}
|
|
328
333
|
|
|
329
|
-
function
|
|
330
|
-
if (0 ===
|
|
331
|
-
(n ? Reflect.ownKeys(e) :
|
|
334
|
+
function A(e, t, n = !0) {
|
|
335
|
+
if (0 === D(e)) {
|
|
336
|
+
(n ? Reflect.ownKeys(e) : g.keys(e)).forEach(n => {
|
|
332
337
|
t(n, e[n], e);
|
|
333
338
|
});
|
|
334
339
|
} else e.forEach((n, r) => t(r, n, e));
|
|
335
340
|
}
|
|
336
341
|
|
|
337
|
-
function
|
|
338
|
-
const t = e[
|
|
339
|
-
return t ? t.type_ :
|
|
342
|
+
function D(e) {
|
|
343
|
+
const t = e[y];
|
|
344
|
+
return t ? t.type_ : j(e) ? 1 : T(e) ? 2 : I(e) ? 3 : 0;
|
|
340
345
|
}
|
|
341
346
|
|
|
342
|
-
var
|
|
347
|
+
var M = (e, t, n = D(e)) => 2 === n ? e.has(t) : g[S].hasOwnProperty.call(e, t), P = (e, t, n = D(e)) => 2 === n ? e.get(t) : e[t], R = (e, t, n, r = D(e)) => {
|
|
343
348
|
2 === r ? e.set(t, n) : 3 === r ? e.add(n) : e[t] = n;
|
|
344
349
|
};
|
|
345
350
|
|
|
346
|
-
var
|
|
351
|
+
var j = Array.isArray, T = e => e instanceof Map, I = e => e instanceof Set, z = e => "object" == typeof e, V = e => "function" == typeof e, $ = e => "boolean" == typeof e;
|
|
347
352
|
|
|
348
|
-
var
|
|
353
|
+
var N = e => e.copy_ || e.base_, U = e => e.modified_ ? e.copy_ : e.base_;
|
|
349
354
|
|
|
350
|
-
function
|
|
351
|
-
if (
|
|
352
|
-
if (
|
|
353
|
-
if (
|
|
354
|
-
const n =
|
|
355
|
+
function L(e, t) {
|
|
356
|
+
if (T(e)) return new Map(e);
|
|
357
|
+
if (I(e)) return new Set(e);
|
|
358
|
+
if (j(e)) return Array[S].slice.call(e);
|
|
359
|
+
const n = C(e);
|
|
355
360
|
if (!0 === t || "class_only" === t && !n) {
|
|
356
|
-
const t =
|
|
357
|
-
delete t[
|
|
361
|
+
const t = g.getOwnPropertyDescriptors(e);
|
|
362
|
+
delete t[y];
|
|
358
363
|
let n = Reflect.ownKeys(t);
|
|
359
364
|
for (let r = 0; r < n.length; r++) {
|
|
360
365
|
const s = n[r], o = t[s];
|
|
361
|
-
!1 === o[
|
|
366
|
+
!1 === o[b] && (o[b] = !0, o[_] = !0), (o.get || o.set) && (t[s] = {
|
|
362
367
|
[_]: !0,
|
|
363
|
-
[
|
|
364
|
-
[
|
|
365
|
-
[
|
|
368
|
+
[b]: !0,
|
|
369
|
+
[w]: o[w],
|
|
370
|
+
[v]: e[s]
|
|
366
371
|
});
|
|
367
372
|
}
|
|
368
|
-
return
|
|
373
|
+
return g.create(h(e), t);
|
|
369
374
|
}
|
|
370
375
|
{
|
|
371
|
-
const t =
|
|
376
|
+
const t = h(e);
|
|
372
377
|
if (null !== t && n) return {
|
|
373
378
|
...e
|
|
374
379
|
};
|
|
375
|
-
const r =
|
|
376
|
-
return
|
|
380
|
+
const r = g.create(t);
|
|
381
|
+
return g.assign(r, e);
|
|
377
382
|
}
|
|
378
383
|
}
|
|
379
384
|
|
|
380
|
-
function
|
|
381
|
-
return
|
|
385
|
+
function F(e, t = !1) {
|
|
386
|
+
return B(e) || E(e) || !k(e) || (D(e) > 1 && g.defineProperties(e, {
|
|
382
387
|
set: K,
|
|
383
388
|
add: K,
|
|
384
389
|
clear: K,
|
|
385
390
|
delete: K
|
|
386
|
-
}),
|
|
387
|
-
|
|
391
|
+
}), g.freeze(e), t && A(e, (e, t) => {
|
|
392
|
+
F(t, !0);
|
|
388
393
|
}, !1)), e;
|
|
389
394
|
}
|
|
390
395
|
|
|
391
396
|
var K = {
|
|
392
|
-
[
|
|
393
|
-
|
|
397
|
+
[v]: function() {
|
|
398
|
+
f(2);
|
|
394
399
|
}
|
|
395
400
|
};
|
|
396
401
|
|
|
397
|
-
function
|
|
398
|
-
return null === e || !
|
|
402
|
+
function B(e) {
|
|
403
|
+
return null === e || !z(e) || g.isFrozen(e);
|
|
399
404
|
}
|
|
400
405
|
|
|
401
|
-
var
|
|
406
|
+
var J = "MapSet", W = "Patches", q = "ArrayMethods", H = {};
|
|
402
407
|
|
|
403
|
-
function
|
|
404
|
-
const t =
|
|
405
|
-
return t ||
|
|
408
|
+
function Q(e) {
|
|
409
|
+
const t = H[e];
|
|
410
|
+
return t || f(0, e), t;
|
|
406
411
|
}
|
|
407
412
|
|
|
408
|
-
var
|
|
413
|
+
var G, X = e => !!H[e], Z = () => G;
|
|
409
414
|
|
|
410
|
-
function
|
|
411
|
-
t && (e.patchPlugin_ =
|
|
415
|
+
function Y(e, t) {
|
|
416
|
+
t && (e.patchPlugin_ = Q(W), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
|
|
412
417
|
}
|
|
413
418
|
|
|
414
|
-
function
|
|
415
|
-
|
|
419
|
+
function ee(e) {
|
|
420
|
+
te(e), e.drafts_.forEach(re), e.drafts_ = null;
|
|
416
421
|
}
|
|
417
422
|
|
|
418
|
-
function
|
|
419
|
-
e ===
|
|
423
|
+
function te(e) {
|
|
424
|
+
e === G && (G = e.parent_);
|
|
420
425
|
}
|
|
421
426
|
|
|
422
|
-
var
|
|
427
|
+
var ne = e => G = {
|
|
423
428
|
drafts_: [],
|
|
424
|
-
parent_:
|
|
429
|
+
parent_: G,
|
|
425
430
|
immer_: e,
|
|
426
431
|
canAutoFreeze_: !0,
|
|
427
432
|
unfinalizedDrafts_: 0,
|
|
428
433
|
handledSet_: new Set,
|
|
429
434
|
processedForPatches_: new Set,
|
|
430
|
-
mapSetPlugin_: X(
|
|
431
|
-
arrayMethodsPlugin_: X(
|
|
435
|
+
mapSetPlugin_: X(J) ? Q(J) : void 0,
|
|
436
|
+
arrayMethodsPlugin_: X(q) ? Q(q) : void 0
|
|
432
437
|
};
|
|
433
438
|
|
|
434
|
-
function
|
|
435
|
-
const t = e[
|
|
439
|
+
function re(e) {
|
|
440
|
+
const t = e[y];
|
|
436
441
|
0 === t.type_ || 1 === t.type_ ? t.revoke_() : t.revoked_ = !0;
|
|
437
442
|
}
|
|
438
443
|
|
|
439
|
-
function
|
|
444
|
+
function se(e, t) {
|
|
440
445
|
t.unfinalizedDrafts_ = t.drafts_.length;
|
|
441
446
|
const n = t.drafts_[0];
|
|
442
447
|
if (void 0 !== e && e !== n) {
|
|
443
|
-
n[
|
|
448
|
+
n[y].modified_ && (ee(t), f(4)), k(e) && (e = oe(t, e));
|
|
444
449
|
const {patchPlugin_: r} = t;
|
|
445
|
-
r && r.generateReplacementPatches_(n[
|
|
446
|
-
} else e =
|
|
450
|
+
r && r.generateReplacementPatches_(n[y].base_, e, t);
|
|
451
|
+
} else e = oe(t, n);
|
|
447
452
|
return function(e, t, n = !1) {
|
|
448
|
-
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ &&
|
|
449
|
-
}(t, e, !0),
|
|
450
|
-
e !==
|
|
453
|
+
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && F(t, n);
|
|
454
|
+
}(t, e, !0), ee(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_),
|
|
455
|
+
e !== u ? e : void 0;
|
|
451
456
|
}
|
|
452
457
|
|
|
453
|
-
function
|
|
454
|
-
if (
|
|
455
|
-
const n = t[
|
|
458
|
+
function oe(e, t) {
|
|
459
|
+
if (B(t)) return t;
|
|
460
|
+
const n = t[y];
|
|
456
461
|
if (!n) {
|
|
457
|
-
return
|
|
462
|
+
return de(t, e.handledSet_, e);
|
|
458
463
|
}
|
|
459
|
-
if (!
|
|
464
|
+
if (!ie(n, e)) return t;
|
|
460
465
|
if (!n.modified_) return n.base_;
|
|
461
466
|
if (!n.finalized_) {
|
|
462
467
|
const {callbacks_: t} = n;
|
|
463
468
|
if (t) for (;t.length > 0; ) {
|
|
464
469
|
t.pop()(e);
|
|
465
470
|
}
|
|
466
|
-
|
|
471
|
+
ue(n, e);
|
|
467
472
|
}
|
|
468
473
|
return n.copy_;
|
|
469
474
|
}
|
|
470
475
|
|
|
471
|
-
function
|
|
476
|
+
function ae(e) {
|
|
472
477
|
e.finalized_ = !0, e.scope_.unfinalizedDrafts_--;
|
|
473
478
|
}
|
|
474
479
|
|
|
475
|
-
var
|
|
480
|
+
var ie = (e, t) => e.scope_ === t, ce = [];
|
|
476
481
|
|
|
477
|
-
function
|
|
478
|
-
const s =
|
|
482
|
+
function le(e, t, n, r) {
|
|
483
|
+
const s = N(e), o = e.type_;
|
|
479
484
|
if (void 0 !== r) {
|
|
480
|
-
if (
|
|
485
|
+
if (P(s, r, o) === t) return void R(s, r, n, o);
|
|
481
486
|
}
|
|
482
487
|
if (!e.draftLocations_) {
|
|
483
488
|
const t = e.draftLocations_ = new Map;
|
|
484
|
-
|
|
485
|
-
if (
|
|
489
|
+
A(s, (e, n) => {
|
|
490
|
+
if (E(n)) {
|
|
486
491
|
const r = t.get(n) || [];
|
|
487
492
|
r.push(e), t.set(n, r);
|
|
488
493
|
}
|
|
489
494
|
});
|
|
490
495
|
}
|
|
491
|
-
const a = e.draftLocations_.get(t) ??
|
|
492
|
-
for (const e of a)
|
|
496
|
+
const a = e.draftLocations_.get(t) ?? ce;
|
|
497
|
+
for (const e of a) R(s, e, n, o);
|
|
493
498
|
}
|
|
494
499
|
|
|
495
|
-
function
|
|
500
|
+
function ue(e, t) {
|
|
496
501
|
if (e.modified_ && !e.finalized_ && (3 === e.type_ || 1 === e.type_ && e.allIndicesReassigned_ || (e.assigned_?.size ?? 0) > 0)) {
|
|
497
502
|
const {patchPlugin_: n} = t;
|
|
498
503
|
if (n) {
|
|
499
504
|
const r = n.getPath(e);
|
|
500
505
|
r && n.generatePatches_(e, r, t);
|
|
501
506
|
}
|
|
502
|
-
|
|
507
|
+
ae(e);
|
|
503
508
|
}
|
|
504
509
|
}
|
|
505
510
|
|
|
506
|
-
function
|
|
507
|
-
return !n.immer_.autoFreeze_ && n.unfinalizedDrafts_ < 1 ||
|
|
508
|
-
|
|
509
|
-
if (
|
|
510
|
-
const t = s[
|
|
511
|
-
if (
|
|
512
|
-
const n =
|
|
513
|
-
|
|
511
|
+
function de(e, t, n) {
|
|
512
|
+
return !n.immer_.autoFreeze_ && n.unfinalizedDrafts_ < 1 || E(e) || t.has(e) || !k(e) || B(e) || (t.add(e),
|
|
513
|
+
A(e, (r, s) => {
|
|
514
|
+
if (E(s)) {
|
|
515
|
+
const t = s[y];
|
|
516
|
+
if (ie(t, n)) {
|
|
517
|
+
const n = U(t);
|
|
518
|
+
R(e, r, n, e.type_), ae(t);
|
|
514
519
|
}
|
|
515
|
-
} else
|
|
520
|
+
} else k(s) && de(s, t, n);
|
|
516
521
|
})), e;
|
|
517
522
|
}
|
|
518
523
|
|
|
519
|
-
var
|
|
524
|
+
var ye = {
|
|
520
525
|
get(e, t) {
|
|
521
|
-
if (t ===
|
|
526
|
+
if (t === y) return e;
|
|
522
527
|
let n = e.scope_.arrayMethodsPlugin_;
|
|
523
528
|
const r = 1 === e.type_ && "string" == typeof t;
|
|
524
529
|
if (r && n?.isArrayOperationMethod(t)) return n.createMethodInterceptor(e, t);
|
|
525
|
-
const s =
|
|
526
|
-
if (!
|
|
527
|
-
const r =
|
|
528
|
-
return r ?
|
|
530
|
+
const s = N(e);
|
|
531
|
+
if (!M(s, t, e.type_)) return function(e, t, n) {
|
|
532
|
+
const r = ge(t, n);
|
|
533
|
+
return r ? v in r ? r[v] : r.get?.call(e.draft_) : void 0;
|
|
529
534
|
}(e, s, t);
|
|
530
535
|
const o = s[t];
|
|
531
|
-
if (e.finalized_ || !
|
|
536
|
+
if (e.finalized_ || !k(o)) return o;
|
|
532
537
|
if (r && e.operationMethod && n?.isMutatingArrayMethod(e.operationMethod) && function(e) {
|
|
533
538
|
const t = +e;
|
|
534
539
|
return Number.isInteger(t) && String(t) === e;
|
|
535
540
|
}(t)) return o;
|
|
536
|
-
if (o ===
|
|
537
|
-
|
|
538
|
-
const n = 1 === e.type_ ? +t : t, r =
|
|
541
|
+
if (o === fe(e.base_, t)) {
|
|
542
|
+
me(e);
|
|
543
|
+
const n = 1 === e.type_ ? +t : t, r = Se(e.scope_, o, e, n);
|
|
539
544
|
return e.copy_[n] = r;
|
|
540
545
|
}
|
|
541
546
|
return o;
|
|
542
547
|
},
|
|
543
|
-
has: (e, t) => t in
|
|
544
|
-
ownKeys: e => Reflect.ownKeys(
|
|
548
|
+
has: (e, t) => t in N(e),
|
|
549
|
+
ownKeys: e => Reflect.ownKeys(N(e)),
|
|
545
550
|
set(e, t, n) {
|
|
546
|
-
const r =
|
|
551
|
+
const r = ge(N(e), t);
|
|
547
552
|
if (r?.set) return r.set.call(e.draft_, n), !0;
|
|
548
553
|
if (!e.modified_) {
|
|
549
|
-
const r =
|
|
554
|
+
const r = fe(N(e), t), a = r?.[y];
|
|
550
555
|
if (a && a.base_ === n) return e.copy_[t] = n, e.assigned_.set(t, !1), !0;
|
|
551
|
-
if (((s = n) === (o = r) ? 0 !== s || 1 / s == 1 / o : s != s && o != o) && (void 0 !== n ||
|
|
552
|
-
|
|
556
|
+
if (((s = n) === (o = r) ? 0 !== s || 1 / s == 1 / o : s != s && o != o) && (void 0 !== n || M(e.base_, t, e.type_))) return !0;
|
|
557
|
+
me(e), he(e);
|
|
553
558
|
}
|
|
554
559
|
var s, o;
|
|
555
560
|
return e.copy_[t] === n && (void 0 !== n || t in e.copy_) || Number.isNaN(n) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = n,
|
|
556
561
|
e.assigned_.set(t, !0), function(e, t, n) {
|
|
557
562
|
const {scope_: r} = e;
|
|
558
|
-
if (
|
|
559
|
-
const s = n[
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
const r =
|
|
563
|
-
|
|
563
|
+
if (E(n)) {
|
|
564
|
+
const s = n[y];
|
|
565
|
+
ie(s, r) && s.callbacks_.push(function() {
|
|
566
|
+
me(e);
|
|
567
|
+
const r = U(s);
|
|
568
|
+
le(e, n, r, t);
|
|
564
569
|
});
|
|
565
|
-
} else
|
|
566
|
-
const s =
|
|
567
|
-
3 === e.type_ ? s.has(n) &&
|
|
570
|
+
} else k(n) && e.callbacks_.push(function() {
|
|
571
|
+
const s = N(e);
|
|
572
|
+
3 === e.type_ ? s.has(n) && de(n, r.handledSet_, r) : P(s, t, e.type_) === n && r.drafts_.length > 1 && !0 === (e.assigned_.get(t) ?? !1) && e.copy_ && de(P(e.copy_, t, e.type_), r.handledSet_, r);
|
|
568
573
|
});
|
|
569
574
|
}(e, t, n)), !0;
|
|
570
575
|
},
|
|
571
|
-
deleteProperty: (e, t) => (
|
|
572
|
-
|
|
576
|
+
deleteProperty: (e, t) => (me(e), void 0 !== fe(e.base_, t) || t in e.base_ ? (e.assigned_.set(t, !1),
|
|
577
|
+
he(e)) : e.assigned_.delete(t), e.copy_ && delete e.copy_[t], !0),
|
|
573
578
|
getOwnPropertyDescriptor(e, t) {
|
|
574
|
-
const n =
|
|
579
|
+
const n = N(e), r = Reflect.getOwnPropertyDescriptor(n, t);
|
|
575
580
|
return r ? {
|
|
576
|
-
[
|
|
581
|
+
[b]: !0,
|
|
577
582
|
[_]: 1 !== e.type_ || "length" !== t,
|
|
578
|
-
[
|
|
579
|
-
[
|
|
583
|
+
[w]: r[w],
|
|
584
|
+
[v]: n[t]
|
|
580
585
|
} : r;
|
|
581
586
|
},
|
|
582
587
|
defineProperty() {
|
|
583
|
-
|
|
588
|
+
f(11);
|
|
584
589
|
},
|
|
585
|
-
getPrototypeOf: e =>
|
|
590
|
+
getPrototypeOf: e => h(e.base_),
|
|
586
591
|
setPrototypeOf() {
|
|
587
|
-
|
|
592
|
+
f(12);
|
|
588
593
|
}
|
|
589
|
-
},
|
|
594
|
+
}, pe = {};
|
|
590
595
|
|
|
591
|
-
for (let e in
|
|
592
|
-
let t =
|
|
593
|
-
|
|
596
|
+
for (let e in ye) {
|
|
597
|
+
let t = ye[e];
|
|
598
|
+
pe[e] = function() {
|
|
594
599
|
const e = arguments;
|
|
595
600
|
return e[0] = e[0][0], t.apply(this, e);
|
|
596
601
|
};
|
|
597
602
|
}
|
|
598
603
|
|
|
599
|
-
function
|
|
600
|
-
const n = e[
|
|
601
|
-
return (n ?
|
|
604
|
+
function fe(e, t) {
|
|
605
|
+
const n = e[y];
|
|
606
|
+
return (n ? N(n) : e)[t];
|
|
602
607
|
}
|
|
603
608
|
|
|
604
|
-
function
|
|
609
|
+
function ge(e, t) {
|
|
605
610
|
if (!(t in e)) return;
|
|
606
|
-
let n =
|
|
611
|
+
let n = h(e);
|
|
607
612
|
for (;n; ) {
|
|
608
613
|
const e = Object.getOwnPropertyDescriptor(n, t);
|
|
609
614
|
if (e) return e;
|
|
610
|
-
n =
|
|
615
|
+
n = h(n);
|
|
611
616
|
}
|
|
612
617
|
}
|
|
613
618
|
|
|
614
|
-
function
|
|
615
|
-
e.modified_ || (e.modified_ = !0, e.parent_ &&
|
|
619
|
+
function he(e) {
|
|
620
|
+
e.modified_ || (e.modified_ = !0, e.parent_ && he(e.parent_));
|
|
616
621
|
}
|
|
617
622
|
|
|
618
|
-
function
|
|
619
|
-
e.copy_ || (e.assigned_ = new Map, e.copy_ =
|
|
623
|
+
function me(e) {
|
|
624
|
+
e.copy_ || (e.assigned_ = new Map, e.copy_ = L(e.base_, e.scope_.immer_.useStrictShallowCopy_));
|
|
620
625
|
}
|
|
621
626
|
|
|
622
|
-
|
|
623
|
-
return isNaN(parseInt(t)) &&
|
|
624
|
-
},
|
|
625
|
-
return "length" !== t && isNaN(parseInt(t)) &&
|
|
627
|
+
pe.deleteProperty = function(e, t) {
|
|
628
|
+
return isNaN(parseInt(t)) && f(13), pe.set.call(this, e, t, void 0);
|
|
629
|
+
}, pe.set = function(e, t, n) {
|
|
630
|
+
return "length" !== t && isNaN(parseInt(t)) && f(14), ye.set.call(this, e[0], t, n, e[0]);
|
|
626
631
|
};
|
|
627
632
|
|
|
628
|
-
function
|
|
629
|
-
const [s, o] =
|
|
630
|
-
const n =
|
|
633
|
+
function Se(e, t, n, r) {
|
|
634
|
+
const [s, o] = T(t) ? Q(J).proxyMap_(t, n) : I(t) ? Q(J).proxySet_(t, n) : function(e, t) {
|
|
635
|
+
const n = j(e), r = {
|
|
631
636
|
type_: n ? 1 : 0,
|
|
632
637
|
scope_: t ? t.scope_ : Z(),
|
|
633
638
|
modified_: !1,
|
|
@@ -641,8 +646,8 @@ function me(e, t, n, r) {
|
|
|
641
646
|
isManual_: !1,
|
|
642
647
|
callbacks_: void 0
|
|
643
648
|
};
|
|
644
|
-
let s = r, o =
|
|
645
|
-
n && (s = [ r ], o =
|
|
649
|
+
let s = r, o = ye;
|
|
650
|
+
n && (s = [ r ], o = pe);
|
|
646
651
|
const {revoke: a, proxy: i} = Proxy.revocable(s, o);
|
|
647
652
|
return r.draft_ = i, r.revoke_ = a, [ i, r ];
|
|
648
653
|
}(t, n);
|
|
@@ -650,10 +655,10 @@ function me(e, t, n, r) {
|
|
|
650
655
|
n && void 0 !== r ? function(e, t, n) {
|
|
651
656
|
e.callbacks_.push(function(r) {
|
|
652
657
|
const s = t;
|
|
653
|
-
if (!s || !
|
|
658
|
+
if (!s || !ie(s, r)) return;
|
|
654
659
|
r.mapSetPlugin_?.fixSetContents(s);
|
|
655
|
-
const o =
|
|
656
|
-
|
|
660
|
+
const o = U(s);
|
|
661
|
+
le(e, s.draft_ ?? s, o, n), ue(s, r);
|
|
657
662
|
});
|
|
658
663
|
}(n, o, r) : o.callbacks_.push(function(e) {
|
|
659
664
|
e.mapSetPlugin_?.fixSetContents(o);
|
|
@@ -663,23 +668,23 @@ function me(e, t, n, r) {
|
|
|
663
668
|
}
|
|
664
669
|
|
|
665
670
|
function _e(e) {
|
|
666
|
-
if (!
|
|
667
|
-
const t = e[
|
|
671
|
+
if (!k(e) || B(e)) return e;
|
|
672
|
+
const t = e[y];
|
|
668
673
|
let n, r = !0;
|
|
669
674
|
if (t) {
|
|
670
675
|
if (!t.modified_) return t.base_;
|
|
671
|
-
t.finalized_ = !0, n =
|
|
672
|
-
} else n =
|
|
673
|
-
return
|
|
674
|
-
|
|
676
|
+
t.finalized_ = !0, n = L(e, t.scope_.immer_.useStrictShallowCopy_), r = t.scope_.immer_.shouldUseStrictIteration();
|
|
677
|
+
} else n = L(e, !0);
|
|
678
|
+
return A(n, (e, t) => {
|
|
679
|
+
R(n, e, _e(t));
|
|
675
680
|
}, r), t && (t.finalized_ = !1), n;
|
|
676
681
|
}
|
|
677
682
|
|
|
678
|
-
var
|
|
683
|
+
var we = (new class {
|
|
679
684
|
constructor(e) {
|
|
680
685
|
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !1,
|
|
681
686
|
this.produce = (e, t, n) => {
|
|
682
|
-
if (
|
|
687
|
+
if (V(e) && !V(t)) {
|
|
683
688
|
const n = t;
|
|
684
689
|
t = e;
|
|
685
690
|
const r = this;
|
|
@@ -688,50 +693,50 @@ var Se = (new class {
|
|
|
688
693
|
};
|
|
689
694
|
}
|
|
690
695
|
let r;
|
|
691
|
-
if (
|
|
692
|
-
const s =
|
|
696
|
+
if (V(t) || f(6), void 0 === n || V(n) || f(7), k(e)) {
|
|
697
|
+
const s = ne(this), o = Se(s, e, void 0);
|
|
693
698
|
let a = !0;
|
|
694
699
|
try {
|
|
695
700
|
r = t(o), a = !1;
|
|
696
701
|
} finally {
|
|
697
|
-
a ?
|
|
702
|
+
a ? ee(s) : te(s);
|
|
698
703
|
}
|
|
699
|
-
return
|
|
704
|
+
return Y(s, n), se(r, s);
|
|
700
705
|
}
|
|
701
|
-
if (!e || !
|
|
702
|
-
if (r = t(e), void 0 === r && (r = e), r ===
|
|
706
|
+
if (!e || !z(e)) {
|
|
707
|
+
if (r = t(e), void 0 === r && (r = e), r === u && (r = void 0), this.autoFreeze_ && F(r, !0),
|
|
703
708
|
n) {
|
|
704
709
|
const t = [], s = [];
|
|
705
|
-
|
|
710
|
+
Q(W).generateReplacementPatches_(e, r, {
|
|
706
711
|
patches_: t,
|
|
707
712
|
inversePatches_: s
|
|
708
713
|
}), n(t, s);
|
|
709
714
|
}
|
|
710
715
|
return r;
|
|
711
716
|
}
|
|
712
|
-
|
|
717
|
+
f(1, e);
|
|
713
718
|
}, this.produceWithPatches = (e, t) => {
|
|
714
|
-
if (
|
|
719
|
+
if (V(e)) return (t, ...n) => this.produceWithPatches(t, t => e(t, ...n));
|
|
715
720
|
let n, r;
|
|
716
721
|
return [ this.produce(e, t, (e, t) => {
|
|
717
722
|
n = e, r = t;
|
|
718
723
|
}), n, r ];
|
|
719
|
-
},
|
|
720
|
-
|
|
724
|
+
}, $(e?.autoFreeze) && this.setAutoFreeze(e.autoFreeze), $(e?.useStrictShallowCopy) && this.setUseStrictShallowCopy(e.useStrictShallowCopy),
|
|
725
|
+
$(e?.useStrictIteration) && this.setUseStrictIteration(e.useStrictIteration);
|
|
721
726
|
}
|
|
722
727
|
createDraft(e) {
|
|
723
|
-
|
|
724
|
-
|
|
728
|
+
k(e) || f(8), E(e) && (e = function(e) {
|
|
729
|
+
E(e) || f(10, e);
|
|
725
730
|
return _e(e);
|
|
726
731
|
}(e));
|
|
727
|
-
const t =
|
|
728
|
-
return n[
|
|
732
|
+
const t = ne(this), n = Se(t, e, void 0);
|
|
733
|
+
return n[y].isManual_ = !0, te(t), n;
|
|
729
734
|
}
|
|
730
735
|
finishDraft(e, t) {
|
|
731
|
-
const n = e && e[
|
|
732
|
-
n && n.isManual_ ||
|
|
736
|
+
const n = e && e[y];
|
|
737
|
+
n && n.isManual_ || f(9);
|
|
733
738
|
const {scope_: r} = n;
|
|
734
|
-
return
|
|
739
|
+
return Y(r, t), se(void 0, r);
|
|
735
740
|
}
|
|
736
741
|
setAutoFreeze(e) {
|
|
737
742
|
this.autoFreeze_ = e;
|
|
@@ -755,10 +760,10 @@ var Se = (new class {
|
|
|
755
760
|
}
|
|
756
761
|
}
|
|
757
762
|
n > -1 && (t = t.slice(n + 1));
|
|
758
|
-
const r =
|
|
759
|
-
return
|
|
763
|
+
const r = Q(W).applyPatches_;
|
|
764
|
+
return E(e) ? r(e, t) : this.produce(e, e => r(e, t));
|
|
760
765
|
}
|
|
761
|
-
}).produce,
|
|
766
|
+
}).produce, be = (e, t) => {
|
|
762
767
|
const n = Date.now();
|
|
763
768
|
if (/\(\.*\+\?\)\+/.test(e) || /\(\.*\?\)\*/.test(e)) return !1;
|
|
764
769
|
if (e.length > 500) return !1;
|
|
@@ -769,35 +774,35 @@ var Se = (new class {
|
|
|
769
774
|
} catch {
|
|
770
775
|
return !1;
|
|
771
776
|
}
|
|
772
|
-
},
|
|
777
|
+
}, ve = () => {
|
|
773
778
|
if ("undefined" != typeof crypto && "function" == typeof crypto.randomUUID) try {
|
|
774
779
|
return crypto.randomUUID();
|
|
775
780
|
} catch {}
|
|
776
781
|
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.");
|
|
777
|
-
},
|
|
782
|
+
}, Ee = "undefined" != typeof crypto && void 0 !== crypto.subtle && "function" == typeof crypto.subtle.generateKey, ke = async (e, t) => {
|
|
778
783
|
const n = (new TextEncoder).encode(JSON.stringify(e)), r = await crypto.subtle.encrypt({
|
|
779
784
|
name: "AES-GCM",
|
|
780
785
|
iv: t.iv
|
|
781
786
|
}, t.key, n), s = new Uint8Array(t.iv.length + r.byteLength);
|
|
782
787
|
return s.set(t.iv), s.set(new Uint8Array(r), t.iv.length), btoa(String.fromCharCode(...s));
|
|
783
|
-
},
|
|
788
|
+
}, xe = async (e, t) => {
|
|
784
789
|
const n = Uint8Array.from(atob(e), e => e.charCodeAt(0)), r = n.slice(0, 12), s = n.slice(12), o = await crypto.subtle.decrypt({
|
|
785
790
|
name: "AES-GCM",
|
|
786
791
|
iv: r
|
|
787
792
|
}, t.key, s);
|
|
788
793
|
return JSON.parse((new TextDecoder).decode(o));
|
|
789
|
-
},
|
|
790
|
-
|
|
791
|
-
},
|
|
794
|
+
}, Oe = null, Ce = e => {
|
|
795
|
+
Oe && Oe(e);
|
|
796
|
+
}, Ae = (e, t, n) => {
|
|
792
797
|
e.set(t instanceof RegExp ? t.source : t, n);
|
|
793
|
-
},
|
|
798
|
+
}, De = (e, t, n, r) => {
|
|
794
799
|
if (0 === e.size) return !0;
|
|
795
800
|
for (const [s, o] of e) {
|
|
796
801
|
let e;
|
|
797
|
-
if (e = "function" == typeof s ? s(t, r) :
|
|
802
|
+
if (e = "function" == typeof s ? s(t, r) : be(s, t), e) return o.includes(n) || o.includes("admin");
|
|
798
803
|
}
|
|
799
804
|
return !1;
|
|
800
|
-
},
|
|
805
|
+
}, Me = e => {
|
|
801
806
|
if ("string" == typeof e) {
|
|
802
807
|
let t = e.replace(/&#[xX]?[0-9a-fA-F]+;?/g, e => {
|
|
803
808
|
const t = e.match(/&#x([0-9a-fA-F]+);?/i);
|
|
@@ -813,20 +818,20 @@ var Se = (new class {
|
|
|
813
818
|
if (e && "object" == typeof e && !Array.isArray(e)) {
|
|
814
819
|
if (Object.getPrototypeOf(e) === Object.prototype) {
|
|
815
820
|
const t = {};
|
|
816
|
-
for (const [n, r] of Object.entries(e)) t[n] =
|
|
821
|
+
for (const [n, r] of Object.entries(e)) t[n] = Me(r);
|
|
817
822
|
return t;
|
|
818
823
|
}
|
|
819
824
|
return e;
|
|
820
825
|
}
|
|
821
|
-
return Array.isArray(e) ? e.map(e =>
|
|
822
|
-
},
|
|
826
|
+
return Array.isArray(e) ? e.map(e => Me(e)) : e;
|
|
827
|
+
}, Pe = e => /^([a-zA-Z0-9_.-][a-zA-Z0-9_.-]*)$/.test(e) && e.length <= 256 && e.length > 0, Re = (e, t, n, r) => {
|
|
823
828
|
const s = {
|
|
824
|
-
id:
|
|
829
|
+
id: ve(),
|
|
825
830
|
purpose: n,
|
|
826
831
|
granted: r,
|
|
827
832
|
timestamp: Date.now()
|
|
828
833
|
}, o = e.get(t) || [];
|
|
829
|
-
return o.push(s), e.set(t, o),
|
|
834
|
+
return o.push(s), e.set(t, o), Ce({
|
|
830
835
|
timestamp: Date.now(),
|
|
831
836
|
action: "set",
|
|
832
837
|
key: `consent:${n}`,
|
|
@@ -835,13 +840,13 @@ var Se = (new class {
|
|
|
835
840
|
}), s;
|
|
836
841
|
};
|
|
837
842
|
|
|
838
|
-
|
|
843
|
+
i();
|
|
839
844
|
|
|
840
|
-
var
|
|
845
|
+
var je = e => `${e}_`;
|
|
841
846
|
|
|
842
|
-
|
|
847
|
+
i();
|
|
843
848
|
|
|
844
|
-
var
|
|
849
|
+
var Te = () => {
|
|
845
850
|
try {
|
|
846
851
|
0;
|
|
847
852
|
const e = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : {};
|
|
@@ -849,13 +854,24 @@ var je = () => {
|
|
|
849
854
|
} catch {
|
|
850
855
|
return !1;
|
|
851
856
|
}
|
|
852
|
-
},
|
|
853
|
-
const
|
|
854
|
-
|
|
857
|
+
}, Ie = () => "undefined" != typeof window ? window.localStorage : null, ze = () => {
|
|
858
|
+
const e = new Map;
|
|
859
|
+
return {
|
|
860
|
+
getItem: t => e.get(t) || null,
|
|
861
|
+
setItem: (t, n) => e.set(t, n),
|
|
862
|
+
removeItem: t => e.delete(t),
|
|
863
|
+
key: t => Array.from(e.keys())[t] || null,
|
|
864
|
+
get length() {
|
|
865
|
+
return e.size;
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
}, Ve = n => {
|
|
869
|
+
const r = new Map, s = new Map, o = new Map, a = new Set, i = new Map, u = new Set, d = new Map, y = new Map, p = new Map, f = 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 || Ie(), 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, P = n?.immer ?? !0, R = n?.persistByDefault ?? n?.persistence ?? n?.persist ?? !1;
|
|
870
|
+
n?.accessRules && n.accessRules.forEach(e => Ae(m, e.pattern, e.permissions));
|
|
855
871
|
let j, T = !1, I = !1, z = !1, V = 0, $ = null, N = null;
|
|
856
872
|
const U = new Promise(e => {
|
|
857
873
|
j = e;
|
|
858
|
-
}),
|
|
874
|
+
}), L = () => `${_}_`, K = () => ({
|
|
859
875
|
store: r,
|
|
860
876
|
versions: s,
|
|
861
877
|
sizes: o,
|
|
@@ -863,8 +879,8 @@ var je = () => {
|
|
|
863
879
|
storage: E,
|
|
864
880
|
config: n || {},
|
|
865
881
|
diskQueue: g,
|
|
866
|
-
encryptionKey:
|
|
867
|
-
audit:
|
|
882
|
+
encryptionKey: C,
|
|
883
|
+
audit: q,
|
|
868
884
|
onError: k,
|
|
869
885
|
silent: w,
|
|
870
886
|
debounceTime: b,
|
|
@@ -907,8 +923,8 @@ var je = () => {
|
|
|
907
923
|
}
|
|
908
924
|
}
|
|
909
925
|
})(B(), e, t);
|
|
910
|
-
},
|
|
911
|
-
D && null !==
|
|
926
|
+
}, q = (e, t, n, r) => {
|
|
927
|
+
D && null !== Oe && Ce && Ce({
|
|
912
928
|
timestamp: Date.now(),
|
|
913
929
|
action: e,
|
|
914
930
|
key: t,
|
|
@@ -916,10 +932,10 @@ var je = () => {
|
|
|
916
932
|
success: n,
|
|
917
933
|
error: r
|
|
918
934
|
});
|
|
919
|
-
},
|
|
935
|
+
}, H = n => {
|
|
920
936
|
const r = y.get(n);
|
|
921
937
|
if (!r) return;
|
|
922
|
-
const o = new Set, a = r.selector(e => (o.add(e), y.has(e) ? y.get(e).lastValue :
|
|
938
|
+
const o = new Set, a = r.selector(e => (o.add(e), y.has(e) ? y.get(e).lastValue : Z.get(e)));
|
|
923
939
|
r.deps.forEach(e => {
|
|
924
940
|
if (!o.has(e)) {
|
|
925
941
|
const t = p.get(e);
|
|
@@ -927,17 +943,17 @@ var je = () => {
|
|
|
927
943
|
}
|
|
928
944
|
}), o.forEach(e => {
|
|
929
945
|
r.deps.has(e) || (p.has(e) || p.set(e, new Set), p.get(e).add(n));
|
|
930
|
-
}), r.deps = o, t(r.lastValue, a) || (r.lastValue = P && null !== a && "object" == typeof a ?
|
|
931
|
-
s.set(n, (s.get(n) || 0) + 1),
|
|
932
|
-
},
|
|
946
|
+
}), r.deps = o, t(r.lastValue, a) || (r.lastValue = P && null !== a && "object" == typeof a ? F(e(a), !0) : a,
|
|
947
|
+
s.set(n, (s.get(n) || 0) + 1), Q(n));
|
|
948
|
+
}, Q = e => {
|
|
933
949
|
if (e) {
|
|
934
950
|
if (p.has(e)) {
|
|
935
951
|
const t = p.get(e);
|
|
936
|
-
for (const e of t)
|
|
952
|
+
for (const e of t) H(e);
|
|
937
953
|
}
|
|
938
954
|
const t = d.get(e);
|
|
939
955
|
if (t) {
|
|
940
|
-
const n =
|
|
956
|
+
const n = Z.get(e);
|
|
941
957
|
for (const r of t) try {
|
|
942
958
|
r(n);
|
|
943
959
|
} catch (t) {
|
|
@@ -948,7 +964,7 @@ var je = () => {
|
|
|
948
964
|
});
|
|
949
965
|
}
|
|
950
966
|
}
|
|
951
|
-
const n =
|
|
967
|
+
const n = i.get(e);
|
|
952
968
|
if (n) for (const t of n) try {
|
|
953
969
|
t();
|
|
954
970
|
} catch (t) {
|
|
@@ -967,10 +983,10 @@ var je = () => {
|
|
|
967
983
|
operation: "listener"
|
|
968
984
|
});
|
|
969
985
|
}
|
|
970
|
-
},
|
|
986
|
+
}, G = async () => {
|
|
971
987
|
(async e => {
|
|
972
988
|
if (!e.storage) return;
|
|
973
|
-
const {store: t, config: n, diskQueue: r, storage: s, encryptionKey: o, audit: a, onError: i, silent: c, currentVersion: l} = e, u =
|
|
989
|
+
const {store: t, config: n, diskQueue: r, storage: s, encryptionKey: o, audit: a, onError: i, silent: c, currentVersion: l} = e, u = je(n.namespace || "gstate");
|
|
974
990
|
try {
|
|
975
991
|
const e = {};
|
|
976
992
|
let r;
|
|
@@ -1001,7 +1017,7 @@ var je = () => {
|
|
|
1001
1017
|
const i = n.options.encoded || n.options.encrypted || n.options.secure;
|
|
1002
1018
|
if (n.options.encrypted) {
|
|
1003
1019
|
if (!o) throw new Error(`Encryption key missing for "${t}"`);
|
|
1004
|
-
r = await
|
|
1020
|
+
r = await ke(n.value, o);
|
|
1005
1021
|
} else i ? r = btoa(JSON.stringify(n.value)) : "object" == typeof n.value && null !== n.value && (r = JSON.stringify(n.value));
|
|
1006
1022
|
s.setItem(`${u}${t}`, JSON.stringify({
|
|
1007
1023
|
v: e.versions.get(t) || 1,
|
|
@@ -1019,32 +1035,32 @@ var je = () => {
|
|
|
1019
1035
|
key: t
|
|
1020
1036
|
});
|
|
1021
1037
|
}
|
|
1022
|
-
})(
|
|
1023
|
-
},
|
|
1038
|
+
})(K());
|
|
1039
|
+
}, X = {}, Z = {
|
|
1024
1040
|
_setSilently: (t, n) => {
|
|
1025
|
-
const a = o.get(t) || 0, i = P && null !== n && "object" == typeof n ?
|
|
1041
|
+
const a = o.get(t) || 0, i = P && null !== n && "object" == typeof n ? F(e(n), !0) : n, c = (x > 0 || O > 0) && !Te() ? J(i) : 0;
|
|
1026
1042
|
V = V - a + c, o.set(t, c), r.set(t, i), s.set(t, (s.get(t) || 0) + 1), N = null;
|
|
1027
1043
|
},
|
|
1028
1044
|
_registerMethod: (e, t, n) => {
|
|
1029
1045
|
const r = e => "__proto__" === e || "constructor" === e || "prototype" === e;
|
|
1030
|
-
r(e) || r(t) || (
|
|
1046
|
+
r(e) || r(t) || (X[e] || (X[e] = {}), X[e][t] = n);
|
|
1031
1047
|
},
|
|
1032
1048
|
set: (a, i, c = {}) => {
|
|
1033
|
-
const l = r.get(a), u = P && "function" == typeof i ?
|
|
1034
|
-
if (A && !
|
|
1035
|
-
if (!
|
|
1036
|
-
const d = A ?
|
|
1049
|
+
const l = r.get(a), u = P && "function" == typeof i ? we(l, i) : i;
|
|
1050
|
+
if (A && !Pe(a)) return !1;
|
|
1051
|
+
if (!De(m, a, "write", M)) return q("set", a, !1, "RBAC Denied"), !1;
|
|
1052
|
+
const d = A ? Me(u) : u, y = o.get(a) || 0;
|
|
1037
1053
|
W("onBeforeSet", {
|
|
1038
1054
|
key: a,
|
|
1039
1055
|
value: d,
|
|
1040
|
-
store:
|
|
1056
|
+
store: Z,
|
|
1041
1057
|
version: s.get(a) || 0
|
|
1042
1058
|
});
|
|
1043
|
-
const p = P && null !== d && "object" == typeof d ?
|
|
1059
|
+
const p = P && null !== d && "object" == typeof d ? F(e(d), !0) : d;
|
|
1044
1060
|
if (!t(l, p)) {
|
|
1045
|
-
const e = (
|
|
1046
|
-
if (
|
|
1047
|
-
const t = new Error(`Object size (${e} bytes) exceeds maxObjectSize (${
|
|
1061
|
+
const e = (x > 0 || O > 0) && !Te() ? J(p) : 0;
|
|
1062
|
+
if (x > 0 && e > x) {
|
|
1063
|
+
const t = new Error(`Object size (${e} bytes) exceeds maxObjectSize (${x} bytes)`);
|
|
1048
1064
|
return k && k(t, {
|
|
1049
1065
|
operation: "set",
|
|
1050
1066
|
key: a
|
|
@@ -1068,23 +1084,23 @@ var je = () => {
|
|
|
1068
1084
|
persist: t,
|
|
1069
1085
|
encoded: c.encoded || n?.encoded
|
|
1070
1086
|
}
|
|
1071
|
-
}), $ && clearTimeout($), $ = setTimeout(
|
|
1087
|
+
}), $ && clearTimeout($), $ = setTimeout(G, b)), W("onSet", {
|
|
1072
1088
|
key: a,
|
|
1073
1089
|
value: p,
|
|
1074
|
-
store:
|
|
1090
|
+
store: Z,
|
|
1075
1091
|
version: s.get(a)
|
|
1076
|
-
}),
|
|
1092
|
+
}), q("set", a, !0), Q(a), !0;
|
|
1077
1093
|
}
|
|
1078
1094
|
return !1;
|
|
1079
1095
|
},
|
|
1080
1096
|
get: e => {
|
|
1081
|
-
if (!
|
|
1097
|
+
if (!De(m, e, "read", M)) return q("get", e, !1, "RBAC Denied"), null;
|
|
1082
1098
|
const t = r.get(e);
|
|
1083
1099
|
return W("onGet", {
|
|
1084
|
-
store:
|
|
1100
|
+
store: Z,
|
|
1085
1101
|
key: e,
|
|
1086
1102
|
value: t
|
|
1087
|
-
}),
|
|
1103
|
+
}), q("get", e, !0), t;
|
|
1088
1104
|
},
|
|
1089
1105
|
compute: (e, t) => {
|
|
1090
1106
|
try {
|
|
@@ -1092,7 +1108,7 @@ var je = () => {
|
|
|
1092
1108
|
selector: t,
|
|
1093
1109
|
lastValue: null,
|
|
1094
1110
|
deps: new Set
|
|
1095
|
-
}),
|
|
1111
|
+
}), H(e)), y.get(e).lastValue;
|
|
1096
1112
|
} catch (t) {
|
|
1097
1113
|
const n = t instanceof Error ? t : new Error(String(t));
|
|
1098
1114
|
return k && k(n, {
|
|
@@ -1109,19 +1125,19 @@ var je = () => {
|
|
|
1109
1125
|
};
|
|
1110
1126
|
},
|
|
1111
1127
|
remove: e => {
|
|
1112
|
-
if (!
|
|
1128
|
+
if (!De(m, e, "delete", M)) return q("delete", e, !1, "RBAC Denied"), !1;
|
|
1113
1129
|
const t = r.get(e), n = r.delete(e);
|
|
1114
1130
|
return n && (V -= o.get(e) || 0, o.delete(e), W("onRemove", {
|
|
1115
|
-
store:
|
|
1131
|
+
store: Z,
|
|
1116
1132
|
key: e,
|
|
1117
1133
|
value: t
|
|
1118
|
-
}), N = null), s.set(e, (s.get(e) || 0) + 1), E && E.removeItem(`${
|
|
1119
|
-
|
|
1134
|
+
}), N = null), s.set(e, (s.get(e) || 0) + 1), E && E.removeItem(`${L()}${e}`), q("delete", e, !0),
|
|
1135
|
+
Q(e), n;
|
|
1120
1136
|
},
|
|
1121
|
-
delete: e =>
|
|
1137
|
+
delete: e => Z.remove(e),
|
|
1122
1138
|
deleteAll: () => {
|
|
1123
|
-
if (Array.from(r.keys()).forEach(e =>
|
|
1124
|
-
const e =
|
|
1139
|
+
if (Array.from(r.keys()).forEach(e => Z.remove(e)), E) {
|
|
1140
|
+
const e = L(), t = [], n = E.length || 0;
|
|
1125
1141
|
for (let r = 0; r < n; r++) {
|
|
1126
1142
|
const n = E.key(r);
|
|
1127
1143
|
n && n.startsWith(e) && t.push(n);
|
|
@@ -1136,24 +1152,24 @@ var je = () => {
|
|
|
1136
1152
|
},
|
|
1137
1153
|
transaction: e => {
|
|
1138
1154
|
T = !0, W("onTransaction", {
|
|
1139
|
-
store:
|
|
1155
|
+
store: Z,
|
|
1140
1156
|
key: "START"
|
|
1141
1157
|
});
|
|
1142
1158
|
try {
|
|
1143
1159
|
e();
|
|
1144
1160
|
} finally {
|
|
1145
1161
|
T = !1, W("onTransaction", {
|
|
1146
|
-
store:
|
|
1162
|
+
store: Z,
|
|
1147
1163
|
key: "END"
|
|
1148
|
-
}), I && (I = !1,
|
|
1164
|
+
}), I && (I = !1, Q());
|
|
1149
1165
|
}
|
|
1150
1166
|
},
|
|
1151
1167
|
destroy: () => {
|
|
1152
1168
|
$ && (clearTimeout($), $ = null), g.clear(), "undefined" != typeof window && window.removeEventListener("beforeunload", Y),
|
|
1153
1169
|
W("onDestroy", {
|
|
1154
|
-
store:
|
|
1155
|
-
}), a.clear(),
|
|
1156
|
-
o.clear(), V = 0, m.clear(),
|
|
1170
|
+
store: Z
|
|
1171
|
+
}), a.clear(), i.clear(), d.clear(), y.clear(), p.clear(), f.clear(), r.clear(),
|
|
1172
|
+
o.clear(), V = 0, m.clear(), S.clear(), s.clear(), h.clear(), u.clear();
|
|
1157
1173
|
},
|
|
1158
1174
|
_addPlugin: e => {
|
|
1159
1175
|
((e, t, n) => {
|
|
@@ -1168,25 +1184,25 @@ var je = () => {
|
|
|
1168
1184
|
key: t.name
|
|
1169
1185
|
}) : e.silent;
|
|
1170
1186
|
}
|
|
1171
|
-
})(B(), e,
|
|
1187
|
+
})(B(), e, Z);
|
|
1172
1188
|
},
|
|
1173
1189
|
_removePlugin: e => {
|
|
1174
1190
|
f.delete(e);
|
|
1175
1191
|
},
|
|
1176
1192
|
_subscribe: (e, t) => {
|
|
1177
1193
|
if (t) {
|
|
1178
|
-
|
|
1179
|
-
const n =
|
|
1194
|
+
i.has(t) || i.set(t, new Set);
|
|
1195
|
+
const n = i.get(t);
|
|
1180
1196
|
return n.add(e), () => {
|
|
1181
|
-
n.delete(e), 0 === n.size &&
|
|
1197
|
+
n.delete(e), 0 === n.size && i.delete(t);
|
|
1182
1198
|
};
|
|
1183
1199
|
}
|
|
1184
1200
|
return a.add(e), () => a.delete(e);
|
|
1185
1201
|
},
|
|
1186
1202
|
_getVersion: e => s.get(e) ?? 0,
|
|
1187
|
-
addAccessRule: (e, t) =>
|
|
1188
|
-
hasPermission: (e, t, n) =>
|
|
1189
|
-
recordConsent: (e, t, n) =>
|
|
1203
|
+
addAccessRule: (e, t) => Ae(m, e, t),
|
|
1204
|
+
hasPermission: (e, t, n) => De(m, e, t, n),
|
|
1205
|
+
recordConsent: (e, t, n) => Re(S, e, t, n),
|
|
1190
1206
|
hasConsent: (e, t) => ((e, t, n) => {
|
|
1191
1207
|
const r = e.get(t);
|
|
1192
1208
|
if (!r) return !1;
|
|
@@ -1195,30 +1211,30 @@ var je = () => {
|
|
|
1195
1211
|
if (t && t.purpose === n) return t.granted;
|
|
1196
1212
|
}
|
|
1197
1213
|
return !1;
|
|
1198
|
-
})(
|
|
1199
|
-
getConsents: e => ((e, t) => e.get(t) || [])(
|
|
1200
|
-
revokeConsent: (e, t) => ((e, t, n) =>
|
|
1214
|
+
})(S, e, t),
|
|
1215
|
+
getConsents: e => ((e, t) => e.get(t) || [])(S, e),
|
|
1216
|
+
revokeConsent: (e, t) => ((e, t, n) => Re(e, t, n, !1))(S, e, t),
|
|
1201
1217
|
exportUserData: e => ((e, t) => ({
|
|
1202
1218
|
userId: t,
|
|
1203
1219
|
exportedAt: Date.now(),
|
|
1204
1220
|
consents: e.get(t) || []
|
|
1205
|
-
}))(
|
|
1221
|
+
}))(S, e),
|
|
1206
1222
|
deleteUserData: e => ((e, t) => {
|
|
1207
1223
|
const n = e.get(t)?.length || 0;
|
|
1208
1224
|
return e.delete(t), {
|
|
1209
1225
|
success: !0,
|
|
1210
1226
|
deletedConsents: n
|
|
1211
1227
|
};
|
|
1212
|
-
})(
|
|
1228
|
+
})(S, e),
|
|
1213
1229
|
getSnapshot: () => (N || (N = Object.fromEntries(r.entries())), N),
|
|
1214
1230
|
get plugins() {
|
|
1215
|
-
return
|
|
1231
|
+
return X;
|
|
1216
1232
|
},
|
|
1217
1233
|
get isReady() {
|
|
1218
1234
|
return z;
|
|
1219
1235
|
},
|
|
1220
1236
|
get namespace() {
|
|
1221
|
-
return
|
|
1237
|
+
return _;
|
|
1222
1238
|
},
|
|
1223
1239
|
get userId() {
|
|
1224
1240
|
return M;
|
|
@@ -1226,15 +1242,15 @@ var je = () => {
|
|
|
1226
1242
|
whenReady: () => U
|
|
1227
1243
|
};
|
|
1228
1244
|
[ "addAccessRule", "recordConsent", "hasConsent", "getConsents", "revokeConsent", "exportUserData", "deleteUserData" ].forEach(e => {
|
|
1229
|
-
const t =
|
|
1230
|
-
t &&
|
|
1245
|
+
const t = Z[e];
|
|
1246
|
+
t && Z._registerMethod("security", e, t);
|
|
1231
1247
|
});
|
|
1232
1248
|
const Y = () => {
|
|
1233
|
-
g.size > 0 &&
|
|
1249
|
+
g.size > 0 && G();
|
|
1234
1250
|
};
|
|
1235
1251
|
if ("undefined" != typeof window && window.addEventListener("beforeunload", Y),
|
|
1236
1252
|
E ? (async (t, n, r) => {
|
|
1237
|
-
const {storage: s, config: o, encryptionKey: a, audit: i, onError: c, silent: l, currentVersion: u, store: d, sizes: y, versions: p} = t, f =
|
|
1253
|
+
const {storage: s, config: o, encryptionKey: a, audit: i, onError: c, silent: l, currentVersion: u, store: d, sizes: y, versions: p} = t, f = je(o.namespace || "gstate"), g = o.immer ?? !0;
|
|
1238
1254
|
if (s) try {
|
|
1239
1255
|
const l = {};
|
|
1240
1256
|
let h = 0;
|
|
@@ -1249,7 +1265,7 @@ var je = () => {
|
|
|
1249
1265
|
continue;
|
|
1250
1266
|
}
|
|
1251
1267
|
let c = r.d;
|
|
1252
|
-
if (r._enc && a) c = await
|
|
1268
|
+
if (r._enc && a) c = await xe(c, a); else if ("string" == typeof c) if (r._b64) try {
|
|
1253
1269
|
c = JSON.parse(atob(c));
|
|
1254
1270
|
} catch (e) {} else if (c.startsWith("{") || c.startsWith("[")) try {
|
|
1255
1271
|
c = JSON.parse(c);
|
|
@@ -1266,7 +1282,7 @@ var je = () => {
|
|
|
1266
1282
|
}
|
|
1267
1283
|
const m = h < u && o.migrate ? o.migrate(l, h) : l;
|
|
1268
1284
|
Object.entries(m).forEach(([r, s]) => {
|
|
1269
|
-
const o = g && null !== s && "object" == typeof s ?
|
|
1285
|
+
const o = g && null !== s && "object" == typeof s ? F(e(s), !0) : s, a = n(o), i = y.get(r) || 0;
|
|
1270
1286
|
t.totalSize = t.totalSize - i + a, y.set(r, a), d.set(r, o), p.set(r, 1);
|
|
1271
1287
|
}), r();
|
|
1272
1288
|
} catch (e) {
|
|
@@ -1275,37 +1291,37 @@ var je = () => {
|
|
|
1275
1291
|
operation: "hydration"
|
|
1276
1292
|
});
|
|
1277
1293
|
}
|
|
1278
|
-
})(
|
|
1279
|
-
z = !0, N = null, j(),
|
|
1294
|
+
})(K(), e => (x > 0 || O > 0) && !Te() ? J(e) : 0, () => {
|
|
1295
|
+
z = !0, N = null, j(), Q();
|
|
1280
1296
|
}).then(() => {}) : (z = !0, j()), n?.sync) {
|
|
1281
1297
|
const e = n.sync, t = async () => {
|
|
1282
|
-
const {SyncEngine: t} = await Promise.resolve().then(() => (
|
|
1283
|
-
return new t(
|
|
1298
|
+
const {SyncEngine: t} = await Promise.resolve().then(() => (l(), c));
|
|
1299
|
+
return new t(Z, e);
|
|
1284
1300
|
};
|
|
1285
1301
|
let r = null;
|
|
1286
|
-
|
|
1302
|
+
Z._registerMethod("sync", "flush", async () => {
|
|
1287
1303
|
r || (r = t());
|
|
1288
1304
|
return (await r).flush();
|
|
1289
|
-
}),
|
|
1305
|
+
}), Z._registerMethod("sync", "getState", async () => {
|
|
1290
1306
|
r || (r = t());
|
|
1291
1307
|
return (await r).getState();
|
|
1292
|
-
}),
|
|
1308
|
+
}), Z._registerMethod("sync", "onStateChange", async e => {
|
|
1293
1309
|
r || (r = t());
|
|
1294
1310
|
return (await r).onStateChange(e);
|
|
1295
|
-
}),
|
|
1311
|
+
}), Z._registerMethod("sync", "forceSync", async () => {
|
|
1296
1312
|
r || (r = t());
|
|
1297
1313
|
return (await r).sync();
|
|
1298
1314
|
});
|
|
1299
1315
|
}
|
|
1300
|
-
return
|
|
1316
|
+
return Z;
|
|
1301
1317
|
};
|
|
1302
1318
|
|
|
1303
|
-
|
|
1319
|
+
l();
|
|
1304
1320
|
|
|
1305
|
-
var
|
|
1321
|
+
var $e = null, Ne = () => $e;
|
|
1306
1322
|
|
|
1307
|
-
function
|
|
1308
|
-
const r = n.useMemo(() => t ||
|
|
1323
|
+
function Ue(e, t) {
|
|
1324
|
+
const r = n.useMemo(() => t || $e, [ t ]), s = n.useMemo(() => {
|
|
1309
1325
|
const e = () => {}, t = () => !1, n = () => null;
|
|
1310
1326
|
return {
|
|
1311
1327
|
set: t,
|
|
@@ -1344,17 +1360,176 @@ function $e(e, t) {
|
|
|
1344
1360
|
} catch {
|
|
1345
1361
|
return;
|
|
1346
1362
|
}
|
|
1347
|
-
}, [ c, a ]), y = n.useSyncExternalStore(l, u, d), p = n.useCallback((e, t) => a ? (
|
|
1363
|
+
}, [ c, a ]), y = n.useSyncExternalStore(l, u, d), p = n.useCallback((e, t) => a ? (Te(),
|
|
1348
1364
|
!1) : o.set(i, e, t), [ o, a, i ]);
|
|
1349
1365
|
return n.useDebugValue(y, e => a ? `Selector: ${JSON.stringify(e)}` : `${i}: ${JSON.stringify(e)}`),
|
|
1350
1366
|
a ? y : [ y, p ];
|
|
1351
1367
|
}
|
|
1352
1368
|
|
|
1353
|
-
var
|
|
1369
|
+
var Le = new Map;
|
|
1354
1370
|
|
|
1355
|
-
|
|
1371
|
+
var Fe, Ke, Be, Je, We, qe, He = () => "undefined" == typeof window || void 0 === window.document, Qe = () => !He(), Ge = e => {
|
|
1372
|
+
const t = e?.ssrSafe ?? !0, n = e?.deferHydration ?? !1;
|
|
1373
|
+
let r = e?.storage;
|
|
1374
|
+
!r && t && He() && (r = ze());
|
|
1375
|
+
const s = Ve({
|
|
1376
|
+
...e,
|
|
1377
|
+
storage: r || void 0,
|
|
1378
|
+
persistByDefault: !n && (e?.persistByDefault ?? !1)
|
|
1379
|
+
});
|
|
1380
|
+
let o = !1, a = null;
|
|
1381
|
+
e?.initialState && He() && (Object.entries(e.initialState).forEach(([e, t]) => {
|
|
1382
|
+
s._setSilently(e, t);
|
|
1383
|
+
}), a = JSON.stringify(e.initialState));
|
|
1384
|
+
return Object.assign(s, {
|
|
1385
|
+
hydrate: async () => {
|
|
1386
|
+
if (!o && !He()) {
|
|
1387
|
+
if (t && !s.namespace.startsWith("async_")) {
|
|
1388
|
+
const t = s.getSnapshot(), n = Ve({
|
|
1389
|
+
...e,
|
|
1390
|
+
namespace: s.namespace,
|
|
1391
|
+
storage: void 0,
|
|
1392
|
+
persistByDefault: e?.persistByDefault ?? !1
|
|
1393
|
+
});
|
|
1394
|
+
Object.entries(t).forEach(([e, t]) => {
|
|
1395
|
+
n._setSilently(e, t);
|
|
1396
|
+
}), o = !0;
|
|
1397
|
+
} else o = !0;
|
|
1398
|
+
await s.whenReady();
|
|
1399
|
+
}
|
|
1400
|
+
},
|
|
1401
|
+
getSerializedState: () => He() ? JSON.stringify(s.getSnapshot()) : a,
|
|
1402
|
+
isHydrated: () => o || s.isReady
|
|
1403
|
+
});
|
|
1404
|
+
}, Xe = () => (Fe || (Fe = o("react"), Ke = Fe.useState, Be = Fe.useEffect, Je = Fe.useSyncExternalStore,
|
|
1405
|
+
We = Fe.useMemo, qe = Fe.useCallback), {
|
|
1406
|
+
React: Fe,
|
|
1407
|
+
useState: Ke,
|
|
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
|
|
1427
|
+
};
|
|
1428
|
+
}, et = e => {
|
|
1429
|
+
const {useState: t, useEffect: n, useMemo: r} = Xe(), [s, o] = t(() => !!He() || (e.isHydrated?.() ?? e.isReady));
|
|
1430
|
+
return n(() => {
|
|
1431
|
+
if (He()) return;
|
|
1432
|
+
const t = () => {
|
|
1433
|
+
const t = e.isHydrated?.() ?? e.isReady;
|
|
1434
|
+
o(t);
|
|
1435
|
+
}, n = setInterval(t, 50), r = e._subscribe(t);
|
|
1436
|
+
return t(), () => {
|
|
1437
|
+
clearInterval(n), r();
|
|
1438
|
+
};
|
|
1439
|
+
}, [ e ]), r(() => {
|
|
1440
|
+
if (s) return e;
|
|
1441
|
+
const t = () => {}, n = () => !1, r = () => null;
|
|
1442
|
+
return {
|
|
1443
|
+
set: n,
|
|
1444
|
+
get: r,
|
|
1445
|
+
remove: n,
|
|
1446
|
+
delete: n,
|
|
1447
|
+
deleteAll: n,
|
|
1448
|
+
list: () => ({}),
|
|
1449
|
+
compute: r,
|
|
1450
|
+
watch: () => () => {},
|
|
1451
|
+
use: t,
|
|
1452
|
+
transaction: t,
|
|
1453
|
+
destroy: t,
|
|
1454
|
+
_subscribe: () => () => {},
|
|
1455
|
+
_setSilently: t,
|
|
1456
|
+
_registerMethod: t,
|
|
1457
|
+
_addPlugin: t,
|
|
1458
|
+
_removePlugin: t,
|
|
1459
|
+
_getVersion: () => 0,
|
|
1460
|
+
get isReady() {
|
|
1461
|
+
return !1;
|
|
1462
|
+
},
|
|
1463
|
+
whenReady: () => Promise.resolve(),
|
|
1464
|
+
get plugins() {
|
|
1465
|
+
return {};
|
|
1466
|
+
},
|
|
1467
|
+
getSnapshot: () => ({}),
|
|
1468
|
+
get namespace() {
|
|
1469
|
+
return e.namespace;
|
|
1470
|
+
},
|
|
1471
|
+
get userId() {
|
|
1472
|
+
return e.userId;
|
|
1473
|
+
}
|
|
1474
|
+
};
|
|
1475
|
+
}, [ e, s ]);
|
|
1476
|
+
}, tt = (e, t) => {
|
|
1477
|
+
const n = t?.extraArgument, r = async t => {
|
|
1478
|
+
if ("function" == typeof t) return t(r, () => e.getSnapshot(), n);
|
|
1479
|
+
if (t.type) {
|
|
1480
|
+
const {type: n, payload: r} = t, s = n.match(/^SET_(.+)$/i);
|
|
1481
|
+
if (s && s[1]) {
|
|
1482
|
+
const t = s[1].toLowerCase();
|
|
1483
|
+
e.set(t, r);
|
|
1484
|
+
}
|
|
1485
|
+
const o = n.match(/^REMOVE_(.+)$/i);
|
|
1486
|
+
if (o && o[1]) {
|
|
1487
|
+
const t = o[1].toLowerCase();
|
|
1488
|
+
e.remove(t);
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
};
|
|
1492
|
+
return Object.assign(e, {
|
|
1493
|
+
dispatch: r
|
|
1494
|
+
});
|
|
1495
|
+
}, nt = (e, t) => async (n, r) => {
|
|
1496
|
+
const s = r()[e];
|
|
1497
|
+
n({
|
|
1498
|
+
type: `SET_${e.toUpperCase()}`,
|
|
1499
|
+
payload: {
|
|
1500
|
+
...s,
|
|
1501
|
+
loading: !0,
|
|
1502
|
+
error: null
|
|
1503
|
+
}
|
|
1504
|
+
});
|
|
1505
|
+
try {
|
|
1506
|
+
const r = await t();
|
|
1507
|
+
return n({
|
|
1508
|
+
type: `SET_${e.toUpperCase()}`,
|
|
1509
|
+
payload: {
|
|
1510
|
+
data: r,
|
|
1511
|
+
loading: !1,
|
|
1512
|
+
error: null
|
|
1513
|
+
}
|
|
1514
|
+
}), r;
|
|
1515
|
+
} catch (t) {
|
|
1516
|
+
throw n({
|
|
1517
|
+
type: `SET_${e.toUpperCase()}`,
|
|
1518
|
+
payload: {
|
|
1519
|
+
data: s?.data ?? null,
|
|
1520
|
+
loading: !1,
|
|
1521
|
+
error: t instanceof Error ? t : new Error(String(t))
|
|
1522
|
+
}
|
|
1523
|
+
}), t;
|
|
1524
|
+
}
|
|
1525
|
+
};
|
|
1526
|
+
|
|
1527
|
+
l();
|
|
1356
1528
|
|
|
1357
|
-
exports.addAccessRule = (e, t) =>
|
|
1529
|
+
exports.addAccessRule = (e, t) => Ne()?.addAccessRule(e, t), exports.all = e => ({
|
|
1530
|
+
type: "all",
|
|
1531
|
+
effects: e
|
|
1532
|
+
}), exports.analyticsPlugin = e => ({
|
|
1358
1533
|
name: "gstate-analytics",
|
|
1359
1534
|
hooks: {
|
|
1360
1535
|
onSet: ({key: t, value: n}) => {
|
|
@@ -1372,6 +1547,10 @@ exports.addAccessRule = (e, t) => Ve()?.addAccessRule(e, t), exports.analyticsPl
|
|
|
1372
1547
|
}));
|
|
1373
1548
|
}
|
|
1374
1549
|
}
|
|
1550
|
+
}), exports.call = (e, ...t) => ({
|
|
1551
|
+
type: "call",
|
|
1552
|
+
fn: e,
|
|
1553
|
+
args: t
|
|
1375
1554
|
}), exports.clearAccessRules = () => {}, exports.clearAllConsents = () => {}, exports.cloudSyncPlugin = e => {
|
|
1376
1555
|
const {adapter: t, autoSyncInterval: n} = e, r = new Map, s = {
|
|
1377
1556
|
lastSyncTimestamp: null,
|
|
@@ -1426,8 +1605,16 @@ exports.addAccessRule = (e, t) => Ve()?.addAccessRule(e, t), exports.analyticsPl
|
|
|
1426
1605
|
}
|
|
1427
1606
|
}
|
|
1428
1607
|
};
|
|
1608
|
+
}, exports.createActions = (e, t) => {
|
|
1609
|
+
const n = tt(e);
|
|
1610
|
+
return Object.assign(n.dispatch, t);
|
|
1611
|
+
}, exports.createAsyncAction = nt, exports.createAsyncActions = (e, t) => {
|
|
1612
|
+
tt(e);
|
|
1613
|
+
const n = {};
|
|
1614
|
+
for (const [e, r] of Object.entries(t)) n[e] = nt(e, r);
|
|
1615
|
+
return n;
|
|
1429
1616
|
}, exports.createAsyncStore = (e, t) => {
|
|
1430
|
-
const n = t?.key || "async_data", r = t?.store ||
|
|
1617
|
+
const n = t?.key || "async_data", r = t?.store || Ve({
|
|
1431
1618
|
namespace: `async_${n}`,
|
|
1432
1619
|
silent: !0
|
|
1433
1620
|
});
|
|
@@ -1484,7 +1671,7 @@ exports.addAccessRule = (e, t) => Ve()?.addAccessRule(e, t), exports.analyticsPl
|
|
|
1484
1671
|
name: "Firebase-Firestore",
|
|
1485
1672
|
save: async e => {
|
|
1486
1673
|
try {
|
|
1487
|
-
|
|
1674
|
+
Te();
|
|
1488
1675
|
return (() => {})("[Mock] Firestore Syncing:", e), !0;
|
|
1489
1676
|
} catch (e) {
|
|
1490
1677
|
return !1;
|
|
@@ -1514,7 +1701,49 @@ exports.addAccessRule = (e, t) => Ve()?.addAccessRule(e, t), exports.analyticsPl
|
|
|
1514
1701
|
upsert: !0
|
|
1515
1702
|
})
|
|
1516
1703
|
})).ok
|
|
1517
|
-
}), exports.
|
|
1704
|
+
}), exports.createNextStore = e => {
|
|
1705
|
+
const t = Ge(e);
|
|
1706
|
+
return Object.assign(t, {
|
|
1707
|
+
useHydrated: Ze,
|
|
1708
|
+
useHydrationStatus: Ye,
|
|
1709
|
+
useDeferredStore: e => {
|
|
1710
|
+
const n = et(t), {useCallback: r} = Xe();
|
|
1711
|
+
return (e => {
|
|
1712
|
+
const {useSyncExternalStore: t} = Xe();
|
|
1713
|
+
return t(r(t => n._subscribe(t, e), [ n, e ]), r(() => n.get(e), [ n, e ]), () => {});
|
|
1714
|
+
})(e);
|
|
1715
|
+
}
|
|
1716
|
+
});
|
|
1717
|
+
}, exports.createSSRStore = Ge, exports.createSaga = e => async (t, n) => {
|
|
1718
|
+
const r = async e => {
|
|
1719
|
+
switch (e.type) {
|
|
1720
|
+
case "call":
|
|
1721
|
+
return e.fn();
|
|
1722
|
+
|
|
1723
|
+
case "put":
|
|
1724
|
+
return t(e.action);
|
|
1725
|
+
|
|
1726
|
+
case "select":
|
|
1727
|
+
return e.selector(n());
|
|
1728
|
+
|
|
1729
|
+
case "all":
|
|
1730
|
+
return Promise.all(e.effects.map(r));
|
|
1731
|
+
|
|
1732
|
+
case "race":
|
|
1733
|
+
{
|
|
1734
|
+
const t = Object.fromEntries(Object.entries(e.effects).map(([e, t]) => [ e, r(t) ]));
|
|
1735
|
+
return Promise.race(Object.values(t));
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
default:
|
|
1739
|
+
return;
|
|
1740
|
+
}
|
|
1741
|
+
};
|
|
1742
|
+
try {
|
|
1743
|
+
let t = e.next();
|
|
1744
|
+
for (;!t.done; ) await r(t.value), t = e.next();
|
|
1745
|
+
} catch (e) {}
|
|
1746
|
+
}, exports.createSqlRestAdapter = (e, t) => ({
|
|
1518
1747
|
name: "SQL-REST-API",
|
|
1519
1748
|
save: async n => {
|
|
1520
1749
|
const r = t();
|
|
@@ -1529,12 +1758,12 @@ exports.addAccessRule = (e, t) => Ve()?.addAccessRule(e, t), exports.analyticsPl
|
|
|
1529
1758
|
credentials: "same-origin"
|
|
1530
1759
|
})).ok;
|
|
1531
1760
|
}
|
|
1532
|
-
}), exports.createStore =
|
|
1533
|
-
if (
|
|
1761
|
+
}), exports.createStore = Ve, exports.createThunkStore = tt, exports.debugPlugin = () => {
|
|
1762
|
+
if (Te()) return {
|
|
1534
1763
|
name: "gstate-debug-noop",
|
|
1535
1764
|
hooks: {}
|
|
1536
1765
|
};
|
|
1537
|
-
|
|
1766
|
+
Te();
|
|
1538
1767
|
return {
|
|
1539
1768
|
name: "gstate-debug",
|
|
1540
1769
|
hooks: {
|
|
@@ -1567,12 +1796,12 @@ exports.addAccessRule = (e, t) => Ve()?.addAccessRule(e, t), exports.analyticsPl
|
|
|
1567
1796
|
}
|
|
1568
1797
|
}
|
|
1569
1798
|
};
|
|
1570
|
-
}, exports.deleteUserData = e => {
|
|
1571
|
-
const t =
|
|
1799
|
+
}, exports.dehydrateStore = e => JSON.stringify(e.getSnapshot()), exports.deleteUserData = e => {
|
|
1800
|
+
const t = Ne();
|
|
1572
1801
|
if (!t) throw new Error("[gstate] deleteUserData failed: No store found.");
|
|
1573
1802
|
return t.deleteUserData(e);
|
|
1574
1803
|
}, exports.deriveKeyFromPassword = async (e, t, n = 6e5) => {
|
|
1575
|
-
if (!
|
|
1804
|
+
if (!Ee) throw new Error("Web Crypto API not available");
|
|
1576
1805
|
const r = await crypto.subtle.importKey("raw", (new TextEncoder).encode(e), "PBKDF2", !1, [ "deriveKey" ]);
|
|
1577
1806
|
return {
|
|
1578
1807
|
key: await crypto.subtle.deriveKey({
|
|
@@ -1587,10 +1816,10 @@ exports.addAccessRule = (e, t) => Ve()?.addAccessRule(e, t), exports.analyticsPl
|
|
|
1587
1816
|
iv: crypto.getRandomValues(new Uint8Array(12))
|
|
1588
1817
|
};
|
|
1589
1818
|
}, exports.destroyState = () => {
|
|
1590
|
-
|
|
1819
|
+
$e && ($e.destroy(), $e = null);
|
|
1591
1820
|
}, exports.destroySync = e => {
|
|
1592
|
-
const t =
|
|
1593
|
-
t && (t.destroy(),
|
|
1821
|
+
const t = Le.get(e);
|
|
1822
|
+
t && (t.destroy(), Le.delete(e));
|
|
1594
1823
|
}, exports.devToolsPlugin = e => {
|
|
1595
1824
|
const t = globalThis.__REDUX_DEVTOOLS_EXTENSION__;
|
|
1596
1825
|
if (!t?.connect) return {
|
|
@@ -1621,11 +1850,11 @@ exports.addAccessRule = (e, t) => Ve()?.addAccessRule(e, t), exports.analyticsPl
|
|
|
1621
1850
|
iv: btoa(String.fromCharCode(...e.iv))
|
|
1622
1851
|
};
|
|
1623
1852
|
}, exports.exportUserData = e => {
|
|
1624
|
-
const t =
|
|
1853
|
+
const t = Ne();
|
|
1625
1854
|
if (!t) throw new Error("[gstate] exportUserData failed: No store found.");
|
|
1626
1855
|
return t.exportUserData(e);
|
|
1627
1856
|
}, exports.generateEncryptionKey = async () => {
|
|
1628
|
-
if (!
|
|
1857
|
+
if (!Ee) throw new Error("Web Crypto API not available");
|
|
1629
1858
|
return {
|
|
1630
1859
|
key: await crypto.subtle.generateKey({
|
|
1631
1860
|
name: "AES-GCM",
|
|
@@ -1634,15 +1863,16 @@ exports.addAccessRule = (e, t) => Ve()?.addAccessRule(e, t), exports.analyticsPl
|
|
|
1634
1863
|
iv: crypto.getRandomValues(new Uint8Array(12))
|
|
1635
1864
|
};
|
|
1636
1865
|
}, exports.generateSalt = (e = 32) => crypto.getRandomValues(new Uint8Array(e)),
|
|
1637
|
-
exports.getConsents = e =>
|
|
1638
|
-
|
|
1866
|
+
exports.getConsents = e => Ne()?.getConsents(e) ?? [], exports.getSSRInitialState = e => e.getSnapshot(),
|
|
1867
|
+
exports.getStore = Ne, exports.gstate = (e, t) => {
|
|
1868
|
+
const n = Ve("string" == typeof t ? {
|
|
1639
1869
|
namespace: t
|
|
1640
1870
|
} : t);
|
|
1641
1871
|
e && Object.entries(e).forEach(([e, t]) => {
|
|
1642
1872
|
null === n.get(e) && n._setSilently(e, t);
|
|
1643
1873
|
});
|
|
1644
|
-
return "undefined" == typeof window ||
|
|
1645
|
-
window.rgs = n), Object.assign(e =>
|
|
1874
|
+
return "undefined" == typeof window || Te() || (window.gstate = n, window.gState = n,
|
|
1875
|
+
window.rgs = n), Object.assign(e => Ue(e, n), n);
|
|
1646
1876
|
}, exports.guardPlugin = e => ({
|
|
1647
1877
|
name: "gstate-guard",
|
|
1648
1878
|
hooks: {
|
|
@@ -1652,8 +1882,10 @@ exports.getConsents = e => Ve()?.getConsents(e) ?? [], exports.getStore = Ve, ex
|
|
|
1652
1882
|
s && s(n);
|
|
1653
1883
|
}
|
|
1654
1884
|
}
|
|
1655
|
-
}), exports.hasConsent = (e, t) =>
|
|
1656
|
-
exports.
|
|
1885
|
+
}), exports.hasConsent = (e, t) => Ne()?.hasConsent(e, t) ?? !1, exports.hasPermission = (e, t, n) => Ne()?.hasPermission(e, t, n) ?? !0,
|
|
1886
|
+
exports.hydrateOnClient = async e => {
|
|
1887
|
+
He() || await e.whenReady();
|
|
1888
|
+
}, exports.immerPlugin = () => ({
|
|
1657
1889
|
name: "gstate-immer",
|
|
1658
1890
|
hooks: {
|
|
1659
1891
|
onInstall: ({store: e}) => {
|
|
@@ -1738,14 +1970,19 @@ exports.immerPlugin = () => ({
|
|
|
1738
1970
|
}
|
|
1739
1971
|
};
|
|
1740
1972
|
}, exports.initState = e => {
|
|
1741
|
-
const t =
|
|
1742
|
-
return
|
|
1973
|
+
const t = Ve(e);
|
|
1974
|
+
return $e = t, t;
|
|
1743
1975
|
}, exports.initSync = (e, t) => {
|
|
1744
1976
|
const n = e.namespace;
|
|
1745
|
-
if (
|
|
1977
|
+
if (Le.has(n)) return Le.get(n);
|
|
1746
1978
|
const r = new exports.SyncEngine(e, t);
|
|
1747
|
-
return
|
|
1748
|
-
}, exports.
|
|
1979
|
+
return Le.set(n, r), r;
|
|
1980
|
+
}, exports.initializeFromSSR = (e, t) => {
|
|
1981
|
+
He() || Object.entries(t).forEach(([t, n]) => {
|
|
1982
|
+
e._setSilently(t, n);
|
|
1983
|
+
});
|
|
1984
|
+
}, exports.isClientSide = Qe, exports.isCryptoAvailable = Ee, exports.isServerSide = He,
|
|
1985
|
+
exports.logAudit = Ce, exports.loggerPlugin = e => ({
|
|
1749
1986
|
name: "gstate-logger",
|
|
1750
1987
|
hooks: {
|
|
1751
1988
|
onSet: ({key: e, value: t, version: n}) => {
|
|
@@ -1754,12 +1991,25 @@ exports.immerPlugin = () => ({
|
|
|
1754
1991
|
onRemove: ({key: e}) => {},
|
|
1755
1992
|
onTransaction: ({key: e}) => {}
|
|
1756
1993
|
}
|
|
1994
|
+
}), exports.put = e => ({
|
|
1995
|
+
type: "put",
|
|
1996
|
+
action: e
|
|
1997
|
+
}), exports.race = e => ({
|
|
1998
|
+
type: "race",
|
|
1999
|
+
effects: e
|
|
1757
2000
|
}), exports.recordConsent = (e, t, n) => {
|
|
1758
|
-
const r =
|
|
2001
|
+
const r = Ne();
|
|
1759
2002
|
if (!r) throw new Error("[gstate] recordConsent failed: No store found. call initState() first.");
|
|
1760
2003
|
return r.recordConsent(e, t, n);
|
|
1761
|
-
}, exports.
|
|
1762
|
-
|
|
2004
|
+
}, exports.rehydrateStore = (e, t) => {
|
|
2005
|
+
if (!He()) try {
|
|
2006
|
+
const n = JSON.parse(t);
|
|
2007
|
+
Object.entries(n).forEach(([t, n]) => {
|
|
2008
|
+
e._setSilently(t, n);
|
|
2009
|
+
});
|
|
2010
|
+
} catch (e) {}
|
|
2011
|
+
}, exports.revokeConsent = (e, t) => Ne()?.revokeConsent(e, t), exports.runSaga = (e, t) => (tt(e).dispatch(t),
|
|
2012
|
+
() => {}), exports.sanitizeValue = Me, exports.schemaPlugin = e => ({
|
|
1763
2013
|
name: "gstate-schema",
|
|
1764
2014
|
hooks: {
|
|
1765
2015
|
onSet: ({key: t, value: n}) => {
|
|
@@ -1771,8 +2021,11 @@ exports.schemaPlugin = e => ({
|
|
|
1771
2021
|
}
|
|
1772
2022
|
}
|
|
1773
2023
|
}
|
|
2024
|
+
}), exports.select = e => ({
|
|
2025
|
+
type: "select",
|
|
2026
|
+
selector: e
|
|
1774
2027
|
}), exports.setAuditLogger = e => {
|
|
1775
|
-
|
|
2028
|
+
Oe = e;
|
|
1776
2029
|
}, exports.snapshotPlugin = () => {
|
|
1777
2030
|
const e = new Map;
|
|
1778
2031
|
return {
|
|
@@ -1823,10 +2076,13 @@ exports.schemaPlugin = e => ({
|
|
|
1823
2076
|
}
|
|
1824
2077
|
}
|
|
1825
2078
|
};
|
|
1826
|
-
}, exports.
|
|
1827
|
-
|
|
2079
|
+
}, exports.take = e => ({
|
|
2080
|
+
type: "take",
|
|
2081
|
+
pattern: e
|
|
2082
|
+
}), exports.triggerSync = async e => {
|
|
2083
|
+
const t = e || $e?.namespace;
|
|
1828
2084
|
if (!t) return;
|
|
1829
|
-
const n =
|
|
2085
|
+
const n = Le.get(t);
|
|
1830
2086
|
n && await n.flush();
|
|
1831
2087
|
}, exports.undoRedoPlugin = e => {
|
|
1832
2088
|
let t = [], n = -1, r = !1;
|
|
@@ -1860,10 +2116,11 @@ exports.schemaPlugin = e => ({
|
|
|
1860
2116
|
}
|
|
1861
2117
|
}
|
|
1862
2118
|
};
|
|
1863
|
-
}, exports.useGState =
|
|
1864
|
-
|
|
2119
|
+
}, exports.useDeferredStore = et, exports.useGState = Ue, exports.useHydrated = Ze,
|
|
2120
|
+
exports.useHydrationStatus = Ye, exports.useIsStoreReady = e => {
|
|
2121
|
+
const t = e || $e, r = n.useMemo(() => e => t ? t._subscribe(e) : () => {}, [ t ]);
|
|
1865
2122
|
return n.useSyncExternalStore(r, () => !!t && t.isReady, () => !0);
|
|
1866
|
-
}, exports.useSimpleState =
|
|
2123
|
+
}, exports.useSimpleState = Ue, exports.useStore = Ue, exports.useSyncStatus = () => {
|
|
1867
2124
|
const [e, t] = n.useState({
|
|
1868
2125
|
isOnline: !0,
|
|
1869
2126
|
isSyncing: !1,
|
|
@@ -1874,7 +2131,7 @@ exports.schemaPlugin = e => ({
|
|
|
1874
2131
|
return n.useEffect(() => {
|
|
1875
2132
|
const e = () => {
|
|
1876
2133
|
let e = !0, n = !1, r = 0, s = 0;
|
|
1877
|
-
|
|
2134
|
+
Le.forEach(t => {
|
|
1878
2135
|
const o = t.getState();
|
|
1879
2136
|
e = e && o.isOnline, n = n || o.isSyncing, r += o.pendingChanges, s += o.conflicts;
|
|
1880
2137
|
}), t({
|
|
@@ -1886,11 +2143,11 @@ exports.schemaPlugin = e => ({
|
|
|
1886
2143
|
});
|
|
1887
2144
|
};
|
|
1888
2145
|
e();
|
|
1889
|
-
const n = Array.from(
|
|
2146
|
+
const n = Array.from(Le.values()).map(t => t.onStateChange(e));
|
|
1890
2147
|
return () => n.forEach(e => e());
|
|
1891
2148
|
}, []), e;
|
|
1892
2149
|
}, exports.useSyncedState = function(e, t) {
|
|
1893
|
-
const r = t ||
|
|
2150
|
+
const r = t || $e, s = r?.namespace || "default", o = Le.get(s), a = Ue(e, r), i = a[0], c = a[1], [l, u] = n.useState(() => o?.getState() || {
|
|
1894
2151
|
isOnline: !0,
|
|
1895
2152
|
isSyncing: !1,
|
|
1896
2153
|
lastSyncTimestamp: null,
|
|
@@ -1908,4 +2165,4 @@ exports.schemaPlugin = e => ({
|
|
|
1908
2165
|
}
|
|
1909
2166
|
return s;
|
|
1910
2167
|
}, [ c, o, e, r ]), l ];
|
|
1911
|
-
}, exports.validateKey =
|
|
2168
|
+
}, exports.validateKey = Pe;
|