pinia-plugin-persist-state 0.1.0 → 0.1.1-beta.0
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/CHANGELOG.md +10 -0
- package/README.md +16 -2
- package/dist/pinia-plugin-persist-state.js +213 -195
- package/dist/pinia-plugin-persist-state.umd.cjs +5 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,3 +4,13 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.1]
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Prevented `remember is not a function` at component setup by making store method augmentation available immediately on the client.
|
|
12
|
+
- Moved persisted-state bootstrap behind hydration lifecycle execution (`hydrate`) instead of running it in the store constructor.
|
|
13
|
+
- Hardened browser-runtime detection (`typeof window !== 'undefined'`) for SSR compatibility.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- Test setup now uses `createHydrationPlugin(..., { runtimeEnvironment: 'client' })` to validate client-only subscribers in Node test runtime.
|
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ A small Pinia plugin that adds persistence and optional encryption to your Pinia
|
|
|
11
11
|
- Per-store options via `storeOptions` when defining a store
|
|
12
12
|
- Augmented store API: `persistState`, `remember`, `removePersistedState`, `watch`, `stopWatch`
|
|
13
13
|
- Simple initialization through `createPersistStatePlugin(dbName?, cryptKey?)`
|
|
14
|
+
- SSR-safe hydration flow: methods are injected immediately on client, persistence restore is executed during hydration lifecycle
|
|
14
15
|
|
|
15
16
|
---
|
|
16
17
|
|
|
@@ -28,7 +29,7 @@ Then register the plugin with Pinia in your app entry (see `src/main.ts`):
|
|
|
28
29
|
import { createApp } from 'vue'
|
|
29
30
|
import { createPinia } from 'pinia'
|
|
30
31
|
import { createPlugin } from 'pinia-plugin-subscription'
|
|
31
|
-
import { createPersistStatePlugin } from 'persist-pinia-state'
|
|
32
|
+
import { createPersistStatePlugin, PLUGIN_NAME } from 'persist-pinia-state'
|
|
32
33
|
|
|
33
34
|
const app = createApp(App)
|
|
34
35
|
const pinia = createPinia()
|
|
@@ -37,11 +38,24 @@ const pinia = createPinia()
|
|
|
37
38
|
// and an optional `cryptKey` to enable encryption support
|
|
38
39
|
pinia.use(createPlugin([
|
|
39
40
|
createPersistStatePlugin('localStorage', 'my-secret-key')
|
|
40
|
-
]
|
|
41
|
+
]))
|
|
41
42
|
|
|
42
43
|
app.use(pinia)
|
|
43
44
|
```
|
|
44
45
|
|
|
46
|
+
For Nuxt/SSR projects, prefer `createHydrationPlugin` from `pinia-plugin-subscription` when you need runtime overrides:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { createHydrationPlugin } from 'pinia-plugin-subscription'
|
|
50
|
+
import { createPersistStatePlugin } from 'persist-pinia-state'
|
|
51
|
+
|
|
52
|
+
pinia.use(createHydrationPlugin([
|
|
53
|
+
createPersistStatePlugin('localStorage', 'my-secret-key')
|
|
54
|
+
], {
|
|
55
|
+
runtimeEnvironment: import.meta.client ? 'client' : 'server'
|
|
56
|
+
}))
|
|
57
|
+
```
|
|
58
|
+
|
|
45
59
|
---
|
|
46
60
|
|
|
47
61
|
## 📚 Usage
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CustomConsole as
|
|
2
|
-
class
|
|
1
|
+
import { CustomConsole as Ve, Store as xe, isEmpty as D, PluginSubscriber as De } from "pinia-plugin-subscription";
|
|
2
|
+
class Re {
|
|
3
3
|
_storage;
|
|
4
4
|
constructor(e) {
|
|
5
5
|
this._storage = e === "localStorage" ? localStorage : sessionStorage;
|
|
@@ -27,10 +27,10 @@ class xe {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
const ae = "pinia-plugin-persist-state";
|
|
30
|
-
class
|
|
30
|
+
class ve extends Ve {
|
|
31
31
|
_pluginName = ae;
|
|
32
32
|
}
|
|
33
|
-
const N = new
|
|
33
|
+
const N = new ve();
|
|
34
34
|
let oe = class {
|
|
35
35
|
_db;
|
|
36
36
|
_localStorageVersionKey = "IDBVersion";
|
|
@@ -214,7 +214,7 @@ class X {
|
|
|
214
214
|
}
|
|
215
215
|
defineDb() {
|
|
216
216
|
const { keyPath: e, name: s } = this._db_options;
|
|
217
|
-
return s === "localStorage" || s === "sessionStorage" ? new
|
|
217
|
+
return s === "localStorage" || s === "sessionStorage" ? new Re(s) : new oe(s, { keyPath: e });
|
|
218
218
|
}
|
|
219
219
|
getItem(e) {
|
|
220
220
|
return new Promise((s, r) => {
|
|
@@ -267,7 +267,7 @@ class je {
|
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
let I = {};
|
|
270
|
-
const
|
|
270
|
+
const $e = {
|
|
271
271
|
clear: () => I = {},
|
|
272
272
|
getItem: async (t) => new Promise((e) => e(I[t])),
|
|
273
273
|
removeItem: (t) => delete I[t],
|
|
@@ -276,9 +276,9 @@ const ve = {
|
|
|
276
276
|
I[e] = t;
|
|
277
277
|
}
|
|
278
278
|
};
|
|
279
|
-
class
|
|
279
|
+
class ke extends X {
|
|
280
280
|
defineDb() {
|
|
281
|
-
return this.dbName === "localStorage" || this.dbName === "sessionStorage" ?
|
|
281
|
+
return this.dbName === "localStorage" || this.dbName === "sessionStorage" ? $e : new je();
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
class R {
|
|
@@ -349,18 +349,18 @@ class R {
|
|
|
349
349
|
this._materialKey || await this.setKeyMaterial(this._key);
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
-
const
|
|
352
|
+
const Y = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {};
|
|
353
353
|
process.env.NODE_ENV !== "production" && Object.freeze([]);
|
|
354
354
|
const le = () => {
|
|
355
|
-
},
|
|
356
|
-
(t.charCodeAt(2) > 122 || t.charCodeAt(2) < 97),
|
|
355
|
+
}, Me = (t) => t.charCodeAt(0) === 111 && t.charCodeAt(1) === 110 && // uppercase letter
|
|
356
|
+
(t.charCodeAt(2) > 122 || t.charCodeAt(2) < 97), Fe = (t) => t.startsWith("onUpdate:"), L = Object.assign, p = Array.isArray, w = (t) => typeof t == "function", y = (t) => typeof t == "string", Ae = (t) => typeof t == "symbol", O = (t) => t !== null && typeof t == "object";
|
|
357
357
|
let ne;
|
|
358
|
-
const
|
|
358
|
+
const U = () => ne || (ne = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
|
|
359
359
|
function Z(t) {
|
|
360
360
|
if (p(t)) {
|
|
361
361
|
const e = {};
|
|
362
362
|
for (let s = 0; s < t.length; s++) {
|
|
363
|
-
const r = t[s], o = y(r) ?
|
|
363
|
+
const r = t[s], o = y(r) ? Le(r) : Z(r);
|
|
364
364
|
if (o)
|
|
365
365
|
for (const n in o)
|
|
366
366
|
e[n] = o[n];
|
|
@@ -369,12 +369,12 @@ function Z(t) {
|
|
|
369
369
|
} else if (y(t) || O(t))
|
|
370
370
|
return t;
|
|
371
371
|
}
|
|
372
|
-
const
|
|
373
|
-
function
|
|
372
|
+
const Ke = /;(?![^(]*\))/g, He = /:([^]+)/, qe = /\/\*[^]*?\*\//g;
|
|
373
|
+
function Le(t) {
|
|
374
374
|
const e = {};
|
|
375
|
-
return t.replace(
|
|
375
|
+
return t.replace(qe, "").split(Ke).forEach((s) => {
|
|
376
376
|
if (s) {
|
|
377
|
-
const r = s.split(
|
|
377
|
+
const r = s.split(He);
|
|
378
378
|
r.length > 1 && (e[r[0].trim()] = r[1].trim());
|
|
379
379
|
}
|
|
380
380
|
}), e;
|
|
@@ -397,22 +397,22 @@ process.env.NODE_ENV;
|
|
|
397
397
|
process.env.NODE_ENV;
|
|
398
398
|
process.env.NODE_ENV;
|
|
399
399
|
new Set(
|
|
400
|
-
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((t) => t !== "arguments" && t !== "caller").map((t) => Symbol[t]).filter(
|
|
400
|
+
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((t) => t !== "arguments" && t !== "caller").map((t) => Symbol[t]).filter(Ae)
|
|
401
401
|
);
|
|
402
402
|
// @__NO_SIDE_EFFECTS__
|
|
403
403
|
function ue(t) {
|
|
404
|
-
return /* @__PURE__ */
|
|
404
|
+
return /* @__PURE__ */ G(t) ? /* @__PURE__ */ ue(t.__v_raw) : !!(t && t.__v_isReactive);
|
|
405
405
|
}
|
|
406
406
|
// @__NO_SIDE_EFFECTS__
|
|
407
|
-
function
|
|
407
|
+
function G(t) {
|
|
408
408
|
return !!(t && t.__v_isReadonly);
|
|
409
409
|
}
|
|
410
410
|
// @__NO_SIDE_EFFECTS__
|
|
411
|
-
function
|
|
411
|
+
function B(t) {
|
|
412
412
|
return !!(t && t.__v_isShallow);
|
|
413
413
|
}
|
|
414
414
|
// @__NO_SIDE_EFFECTS__
|
|
415
|
-
function
|
|
415
|
+
function Q(t) {
|
|
416
416
|
return t ? !!t.__v_raw : !1;
|
|
417
417
|
}
|
|
418
418
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -425,17 +425,17 @@ function te(t) {
|
|
|
425
425
|
return t ? t.__v_isRef === !0 : !1;
|
|
426
426
|
}
|
|
427
427
|
const P = [];
|
|
428
|
-
function
|
|
428
|
+
function Ue(t) {
|
|
429
429
|
P.push(t);
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function Be() {
|
|
432
432
|
P.pop();
|
|
433
433
|
}
|
|
434
|
-
let
|
|
434
|
+
let W = !1;
|
|
435
435
|
function E(t, ...e) {
|
|
436
|
-
if (
|
|
437
|
-
|
|
438
|
-
const s = P.length ? P[P.length - 1].component : null, r = s && s.appContext.config.warnHandler, o =
|
|
436
|
+
if (W) return;
|
|
437
|
+
W = !0;
|
|
438
|
+
const s = P.length ? P[P.length - 1].component : null, r = s && s.appContext.config.warnHandler, o = We();
|
|
439
439
|
if (r)
|
|
440
440
|
se(
|
|
441
441
|
r,
|
|
@@ -449,7 +449,7 @@ function E(t, ...e) {
|
|
|
449
449
|
}).join(""),
|
|
450
450
|
s && s.proxy,
|
|
451
451
|
o.map(
|
|
452
|
-
({ vnode: n }) => `at <${
|
|
452
|
+
({ vnode: n }) => `at <${Ce(s, n.type)}>`
|
|
453
453
|
).join(`
|
|
454
454
|
`),
|
|
455
455
|
o
|
|
@@ -458,11 +458,11 @@ function E(t, ...e) {
|
|
|
458
458
|
else {
|
|
459
459
|
const n = [`[Vue warn]: ${t}`, ...e];
|
|
460
460
|
o.length && n.push(`
|
|
461
|
-
`, ...
|
|
461
|
+
`, ...ze(o)), console.warn(...n);
|
|
462
462
|
}
|
|
463
|
-
|
|
463
|
+
W = !1;
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function We() {
|
|
466
466
|
let t = P[P.length - 1];
|
|
467
467
|
if (!t)
|
|
468
468
|
return [];
|
|
@@ -478,22 +478,22 @@ function Be() {
|
|
|
478
478
|
}
|
|
479
479
|
return e;
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function ze(t) {
|
|
482
482
|
const e = [];
|
|
483
483
|
return t.forEach((s, r) => {
|
|
484
484
|
e.push(...r === 0 ? [] : [`
|
|
485
|
-
`], ...
|
|
485
|
+
`], ...Je(s));
|
|
486
486
|
}), e;
|
|
487
487
|
}
|
|
488
|
-
function
|
|
489
|
-
const s = e > 0 ? `... (${e} recursive calls)` : "", r = t.component ? t.component.parent == null : !1, o = ` at <${
|
|
488
|
+
function Je({ vnode: t, recurseCount: e }) {
|
|
489
|
+
const s = e > 0 ? `... (${e} recursive calls)` : "", r = t.component ? t.component.parent == null : !1, o = ` at <${Ce(
|
|
490
490
|
t.component,
|
|
491
491
|
t.type,
|
|
492
492
|
r
|
|
493
493
|
)}`, n = ">" + s;
|
|
494
|
-
return t.props ? [o, ...
|
|
494
|
+
return t.props ? [o, ...Ye(t.props), n] : [o + n];
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function Ye(t) {
|
|
497
497
|
const e = [], s = Object.keys(t);
|
|
498
498
|
return s.slice(0, 3).forEach((r) => {
|
|
499
499
|
e.push(...fe(r, t[r]));
|
|
@@ -543,7 +543,7 @@ function se(t, e, s, r) {
|
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
545
|
function he(t, e, s, r = !0) {
|
|
546
|
-
const o = e ? e.vnode : null, { errorHandler: n, throwUnhandledErrorInProduction: i } = e && e.appContext.config ||
|
|
546
|
+
const o = e ? e.vnode : null, { errorHandler: n, throwUnhandledErrorInProduction: i } = e && e.appContext.config || Y;
|
|
547
547
|
if (e) {
|
|
548
548
|
let c = e.parent;
|
|
549
549
|
const l = e.proxy, f = process.env.NODE_ENV !== "production" ? de[s] : `https://vuejs.org/error-reference/#runtime-${s}`;
|
|
@@ -565,12 +565,12 @@ function he(t, e, s, r = !0) {
|
|
|
565
565
|
return;
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
|
-
|
|
568
|
+
Ge(t, s, o, r, i);
|
|
569
569
|
}
|
|
570
|
-
function
|
|
570
|
+
function Ge(t, e, s, r = !0, o = !1) {
|
|
571
571
|
if (process.env.NODE_ENV !== "production") {
|
|
572
572
|
const n = de[e];
|
|
573
|
-
if (s &&
|
|
573
|
+
if (s && Ue(s), E(`Unhandled error${n ? ` during execution of ${n}` : ""}`), s && Be(), r)
|
|
574
574
|
throw t;
|
|
575
575
|
console.error(t);
|
|
576
576
|
} else {
|
|
@@ -583,39 +583,43 @@ const h = [];
|
|
|
583
583
|
let g = -1;
|
|
584
584
|
const V = [];
|
|
585
585
|
let S = null, C = 0;
|
|
586
|
-
const
|
|
587
|
-
let
|
|
586
|
+
const pe = /* @__PURE__ */ Promise.resolve();
|
|
587
|
+
let k = null;
|
|
588
588
|
const Qe = 100;
|
|
589
589
|
function Xe(t) {
|
|
590
|
+
const e = k || pe;
|
|
591
|
+
return t ? e.then(this ? t.bind(this) : t) : e;
|
|
592
|
+
}
|
|
593
|
+
function Ze(t) {
|
|
590
594
|
let e = g + 1, s = h.length;
|
|
591
595
|
for (; e < s; ) {
|
|
592
|
-
const r = e + s >>> 1, o = h[r], n =
|
|
596
|
+
const r = e + s >>> 1, o = h[r], n = v(o);
|
|
593
597
|
n < t || n === t && o.flags & 2 ? e = r + 1 : s = r;
|
|
594
598
|
}
|
|
595
599
|
return e;
|
|
596
600
|
}
|
|
597
|
-
function
|
|
601
|
+
function et(t) {
|
|
598
602
|
if (!(t.flags & 1)) {
|
|
599
|
-
const e =
|
|
603
|
+
const e = v(t), s = h[h.length - 1];
|
|
600
604
|
!s || // fast path when the job id is larger than the tail
|
|
601
|
-
!(t.flags & 2) && e >=
|
|
605
|
+
!(t.flags & 2) && e >= v(s) ? h.push(t) : h.splice(Ze(e), 0, t), t.flags |= 1, me();
|
|
602
606
|
}
|
|
603
607
|
}
|
|
604
|
-
function
|
|
605
|
-
|
|
608
|
+
function me() {
|
|
609
|
+
k || (k = pe.then(_e));
|
|
606
610
|
}
|
|
607
|
-
function
|
|
611
|
+
function tt(t) {
|
|
608
612
|
if (!p(t))
|
|
609
613
|
S && t.id === -1 ? S.splice(C + 1, 0, t) : t.flags & 1 || (V.push(t), t.flags |= 1);
|
|
610
614
|
else
|
|
611
615
|
for (let e = 0; e < t.length; e++)
|
|
612
616
|
V.push(t[e]);
|
|
613
|
-
|
|
617
|
+
me();
|
|
614
618
|
}
|
|
615
|
-
function
|
|
619
|
+
function st(t) {
|
|
616
620
|
if (V.length) {
|
|
617
621
|
const e = [...new Set(V)].sort(
|
|
618
|
-
(s, r) =>
|
|
622
|
+
(s, r) => v(s) - v(r)
|
|
619
623
|
);
|
|
620
624
|
if (V.length = 0, S) {
|
|
621
625
|
for (let s = 0; s < e.length; s++)
|
|
@@ -624,15 +628,15 @@ function tt(t) {
|
|
|
624
628
|
}
|
|
625
629
|
for (S = e, process.env.NODE_ENV !== "production" && (t = t || /* @__PURE__ */ new Map()), C = 0; C < S.length; C++) {
|
|
626
630
|
const s = S[C];
|
|
627
|
-
process.env.NODE_ENV !== "production" &&
|
|
631
|
+
process.env.NODE_ENV !== "production" && ge(t, s) || (s.flags & 4 && (s.flags &= -2), s.flags & 8 || s(), s.flags &= -2);
|
|
628
632
|
}
|
|
629
633
|
S = null, C = 0;
|
|
630
634
|
}
|
|
631
635
|
}
|
|
632
|
-
const
|
|
633
|
-
function
|
|
636
|
+
const v = (t) => t.id == null ? t.flags & 2 ? -1 : 1 / 0 : t.id;
|
|
637
|
+
function _e(t) {
|
|
634
638
|
process.env.NODE_ENV !== "production" && (t = t || /* @__PURE__ */ new Map());
|
|
635
|
-
const e = process.env.NODE_ENV !== "production" ? (s) =>
|
|
639
|
+
const e = process.env.NODE_ENV !== "production" ? (s) => ge(t, s) : le;
|
|
636
640
|
try {
|
|
637
641
|
for (g = 0; g < h.length; g++) {
|
|
638
642
|
const s = h[g];
|
|
@@ -651,13 +655,13 @@ function me(t) {
|
|
|
651
655
|
const s = h[g];
|
|
652
656
|
s && (s.flags &= -2);
|
|
653
657
|
}
|
|
654
|
-
g = -1, h.length = 0,
|
|
658
|
+
g = -1, h.length = 0, st(t), k = null, (h.length || V.length) && _e(t);
|
|
655
659
|
}
|
|
656
660
|
}
|
|
657
|
-
function
|
|
661
|
+
function ge(t, e) {
|
|
658
662
|
const s = t.get(e) || 0;
|
|
659
663
|
if (s > Qe) {
|
|
660
|
-
const r = e.i, o = r &&
|
|
664
|
+
const r = e.i, o = r && Ie(r.type);
|
|
661
665
|
return he(
|
|
662
666
|
`Maximum recursive updates exceeded${o ? ` in component <${o}>` : ""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
|
|
663
667
|
null,
|
|
@@ -666,52 +670,52 @@ function _e(t, e) {
|
|
|
666
670
|
}
|
|
667
671
|
return t.set(e, s + 1), !1;
|
|
668
672
|
}
|
|
669
|
-
const
|
|
670
|
-
process.env.NODE_ENV !== "production" && (
|
|
671
|
-
createRecord:
|
|
672
|
-
rerender:
|
|
673
|
-
reload:
|
|
673
|
+
const z = /* @__PURE__ */ new Map();
|
|
674
|
+
process.env.NODE_ENV !== "production" && (U().__VUE_HMR_RUNTIME__ = {
|
|
675
|
+
createRecord: J(rt),
|
|
676
|
+
rerender: J(ot),
|
|
677
|
+
reload: J(nt)
|
|
674
678
|
});
|
|
675
|
-
const
|
|
676
|
-
function
|
|
677
|
-
return
|
|
678
|
-
initialDef:
|
|
679
|
+
const M = /* @__PURE__ */ new Map();
|
|
680
|
+
function rt(t, e) {
|
|
681
|
+
return M.has(t) ? !1 : (M.set(t, {
|
|
682
|
+
initialDef: F(e),
|
|
679
683
|
instances: /* @__PURE__ */ new Set()
|
|
680
684
|
}), !0);
|
|
681
685
|
}
|
|
682
|
-
function
|
|
683
|
-
return
|
|
686
|
+
function F(t) {
|
|
687
|
+
return Te(t) ? t.__vccOpts : t;
|
|
684
688
|
}
|
|
685
|
-
function
|
|
686
|
-
const s =
|
|
689
|
+
function ot(t, e) {
|
|
690
|
+
const s = M.get(t);
|
|
687
691
|
s && (s.initialDef.render = e, [...s.instances].forEach((r) => {
|
|
688
|
-
e && (r.render = e,
|
|
692
|
+
e && (r.render = e, F(r.type).render = e), r.renderCache = [], r.job.flags & 8 || r.update();
|
|
689
693
|
}));
|
|
690
694
|
}
|
|
691
|
-
function
|
|
692
|
-
const s =
|
|
695
|
+
function nt(t, e) {
|
|
696
|
+
const s = M.get(t);
|
|
693
697
|
if (!s) return;
|
|
694
|
-
e =
|
|
698
|
+
e = F(e), ie(s.initialDef, e);
|
|
695
699
|
const r = [...s.instances];
|
|
696
700
|
for (let o = 0; o < r.length; o++) {
|
|
697
|
-
const n = r[o], i =
|
|
698
|
-
let c =
|
|
699
|
-
c || (i !== s.initialDef && ie(i, e),
|
|
701
|
+
const n = r[o], i = F(n.type);
|
|
702
|
+
let c = z.get(i);
|
|
703
|
+
c || (i !== s.initialDef && ie(i, e), z.set(i, c = /* @__PURE__ */ new Set())), c.add(n), n.appContext.propsCache.delete(n.type), n.appContext.emitsCache.delete(n.type), n.appContext.optionsCache.delete(n.type), n.ceReload ? (c.add(n), n.ceReload(e.styles), c.delete(n)) : n.parent ? et(() => {
|
|
700
704
|
n.job.flags & 8 || (n.parent.update(), c.delete(n));
|
|
701
705
|
}) : n.appContext.reload ? n.appContext.reload() : typeof window < "u" ? window.location.reload() : console.warn(
|
|
702
706
|
"[HMR] Root or manually mounted instance modified. Full reload required."
|
|
703
707
|
), n.root.ce && n !== n.root && n.root.ce._removeChildStyle(i);
|
|
704
708
|
}
|
|
705
|
-
|
|
706
|
-
|
|
709
|
+
tt(() => {
|
|
710
|
+
z.clear();
|
|
707
711
|
});
|
|
708
712
|
}
|
|
709
713
|
function ie(t, e) {
|
|
710
|
-
|
|
714
|
+
L(t, e);
|
|
711
715
|
for (const s in t)
|
|
712
716
|
s !== "__file" && !(s in e) && delete t[s];
|
|
713
717
|
}
|
|
714
|
-
function
|
|
718
|
+
function J(t) {
|
|
715
719
|
return (e, s) => {
|
|
716
720
|
try {
|
|
717
721
|
return t(e, s);
|
|
@@ -722,26 +726,26 @@ function z(t) {
|
|
|
722
726
|
}
|
|
723
727
|
};
|
|
724
728
|
}
|
|
725
|
-
let T,
|
|
726
|
-
function
|
|
729
|
+
let T, j = [];
|
|
730
|
+
function ye(t, e) {
|
|
727
731
|
var s, r;
|
|
728
|
-
T = t, T ? (T.enabled = !0,
|
|
732
|
+
T = t, T ? (T.enabled = !0, j.forEach(({ event: o, args: n }) => T.emit(o, ...n)), j = []) : /* handle late devtools injection - only do this if we are in an actual */ /* browser environment to avoid the timer handle stalling test runner exit */ /* (#4815) */ typeof window < "u" && // some envs mock window but not fully
|
|
729
733
|
window.HTMLElement && // also exclude jsdom
|
|
730
734
|
// eslint-disable-next-line no-restricted-syntax
|
|
731
735
|
!((r = (s = window.navigator) == null ? void 0 : s.userAgent) != null && r.includes("jsdom")) ? ((e.__VUE_DEVTOOLS_HOOK_REPLAY__ = e.__VUE_DEVTOOLS_HOOK_REPLAY__ || []).push((n) => {
|
|
732
|
-
|
|
736
|
+
ye(n, e);
|
|
733
737
|
}), setTimeout(() => {
|
|
734
|
-
T || (e.__VUE_DEVTOOLS_HOOK_REPLAY__ = null,
|
|
735
|
-
}, 3e3)) :
|
|
738
|
+
T || (e.__VUE_DEVTOOLS_HOOK_REPLAY__ = null, j = []);
|
|
739
|
+
}, 3e3)) : j = [];
|
|
736
740
|
}
|
|
737
|
-
let
|
|
741
|
+
let A = null, it = null;
|
|
738
742
|
const re = (t) => t.__isTeleport;
|
|
739
|
-
function
|
|
743
|
+
function ct(t) {
|
|
740
744
|
let e = t[0];
|
|
741
745
|
if (t.length > 1) {
|
|
742
746
|
let s = !1;
|
|
743
747
|
for (const r of t)
|
|
744
|
-
if (r.type !==
|
|
748
|
+
if (r.type !== we) {
|
|
745
749
|
if (process.env.NODE_ENV !== "production" && s) {
|
|
746
750
|
E(
|
|
747
751
|
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
@@ -753,9 +757,9 @@ function it(t) {
|
|
|
753
757
|
}
|
|
754
758
|
return e;
|
|
755
759
|
}
|
|
756
|
-
function
|
|
757
|
-
if (!
|
|
758
|
-
return re(t.type) && t.children ?
|
|
760
|
+
function at(t) {
|
|
761
|
+
if (!lt(t))
|
|
762
|
+
return re(t.type) && t.children ? ct(t.children) : t;
|
|
759
763
|
if (t.component)
|
|
760
764
|
return t.component.subTree;
|
|
761
765
|
const { shapeFlag: e, children: s } = t;
|
|
@@ -766,42 +770,42 @@ function ct(t) {
|
|
|
766
770
|
return s.default();
|
|
767
771
|
}
|
|
768
772
|
}
|
|
769
|
-
function
|
|
773
|
+
function Se(t, e) {
|
|
770
774
|
if (t.shapeFlag & 6 && t.component) {
|
|
771
775
|
t.transition = e;
|
|
772
776
|
const s = t.component.subTree;
|
|
773
|
-
|
|
774
|
-
re(s.type) &&
|
|
777
|
+
Se(
|
|
778
|
+
re(s.type) && at(s) || s,
|
|
775
779
|
e
|
|
776
780
|
);
|
|
777
781
|
} else t.shapeFlag & 128 ? (t.ssContent.transition = e.clone(t.ssContent), t.ssFallback.transition = e.clone(t.ssFallback)) : t.transition = e;
|
|
778
782
|
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
const
|
|
782
|
-
process.env.NODE_ENV !== "production" && (
|
|
783
|
+
U().requestIdleCallback;
|
|
784
|
+
U().cancelIdleCallback;
|
|
785
|
+
const lt = (t) => t.type.__isKeepAlive, ut = /* @__PURE__ */ Symbol.for("v-ndc"), ft = {};
|
|
786
|
+
process.env.NODE_ENV !== "production" && (ft.ownKeys = (t) => (E(
|
|
783
787
|
"Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."
|
|
784
788
|
), Reflect.ownKeys(t)));
|
|
785
|
-
const
|
|
786
|
-
function
|
|
789
|
+
const dt = {}, be = (t) => Object.getPrototypeOf(t) === dt, ht = (t) => t.__isSuspense, Ee = /* @__PURE__ */ Symbol.for("v-fgt"), pt = /* @__PURE__ */ Symbol.for("v-txt"), we = /* @__PURE__ */ Symbol.for("v-cmt");
|
|
790
|
+
function mt(t) {
|
|
787
791
|
return t ? t.__v_isVNode === !0 : !1;
|
|
788
792
|
}
|
|
789
|
-
const
|
|
793
|
+
const _t = (...t) => Oe(
|
|
790
794
|
...t
|
|
791
|
-
),
|
|
795
|
+
), Ne = ({ key: t }) => t ?? null, $ = ({
|
|
792
796
|
ref: t,
|
|
793
797
|
ref_key: e,
|
|
794
798
|
ref_for: s
|
|
795
|
-
}) => (typeof t == "number" && (t = "" + t), t != null ? y(t) || /* @__PURE__ */ te(t) || w(t) ? { i:
|
|
796
|
-
function
|
|
799
|
+
}) => (typeof t == "number" && (t = "" + t), t != null ? y(t) || /* @__PURE__ */ te(t) || w(t) ? { i: A, r: t, k: e, f: !!s } : t : null);
|
|
800
|
+
function gt(t, e = null, s = null, r = 0, o = null, n = t === Ee ? 0 : 1, i = !1, c = !1) {
|
|
797
801
|
const l = {
|
|
798
802
|
__v_isVNode: !0,
|
|
799
803
|
__v_skip: !0,
|
|
800
804
|
type: t,
|
|
801
805
|
props: e,
|
|
802
|
-
key: e &&
|
|
806
|
+
key: e && Ne(e),
|
|
803
807
|
ref: e && $(e),
|
|
804
|
-
scopeId:
|
|
808
|
+
scopeId: it,
|
|
805
809
|
slotScopeIds: null,
|
|
806
810
|
children: s,
|
|
807
811
|
component: null,
|
|
@@ -821,42 +825,42 @@ function _t(t, e = null, s = null, r = 0, o = null, n = t === be ? 0 : 1, i = !1
|
|
|
821
825
|
dynamicProps: o,
|
|
822
826
|
dynamicChildren: null,
|
|
823
827
|
appContext: null,
|
|
824
|
-
ctx:
|
|
828
|
+
ctx: A
|
|
825
829
|
};
|
|
826
|
-
if (c ? (
|
|
830
|
+
if (c ? (H(l, s), n & 128 && t.normalize(l)) : s && (l.shapeFlag |= y(s) ? 8 : 16), process.env.NODE_ENV !== "production" && l.key !== l.key && E("VNode created with invalid key (NaN). VNode type:", l.type), process.env.NODE_ENV !== "production" && e && l.shapeFlag & 1) {
|
|
827
831
|
const f = e.innerHTML != null ? "innerHTML" : e.textContent != null ? "textContent" : null;
|
|
828
|
-
f &&
|
|
832
|
+
f && yt(l.children) && E(
|
|
829
833
|
`The \`${f}\` prop on <${l.type}> will override its children. Remove either the \`${f}\` prop or the children.`
|
|
830
834
|
);
|
|
831
835
|
}
|
|
832
836
|
return l;
|
|
833
837
|
}
|
|
834
|
-
function
|
|
838
|
+
function yt(t) {
|
|
835
839
|
return y(t) ? t !== "" : p(t) ? t.length > 0 : !1;
|
|
836
840
|
}
|
|
837
|
-
const
|
|
838
|
-
function
|
|
839
|
-
if ((!t || t ===
|
|
840
|
-
const c =
|
|
841
|
+
const St = process.env.NODE_ENV !== "production" ? _t : Oe;
|
|
842
|
+
function Oe(t, e = null, s = null, r = 0, o = null, n = !1) {
|
|
843
|
+
if ((!t || t === ut) && (process.env.NODE_ENV !== "production" && !t && E(`Invalid vnode type when creating vnode: ${t}.`), t = we), mt(t)) {
|
|
844
|
+
const c = K(
|
|
841
845
|
t,
|
|
842
846
|
e,
|
|
843
847
|
!0
|
|
844
848
|
/* mergeRef: true */
|
|
845
849
|
);
|
|
846
|
-
return s &&
|
|
850
|
+
return s && H(c, s), c.patchFlag = -2, c;
|
|
847
851
|
}
|
|
848
|
-
if (
|
|
849
|
-
e =
|
|
852
|
+
if (Te(t) && (t = t.__vccOpts), e) {
|
|
853
|
+
e = bt(e);
|
|
850
854
|
let { class: c, style: l } = e;
|
|
851
|
-
c && !y(c) && (e.class = ee(c)), O(l) && (/* @__PURE__ */
|
|
855
|
+
c && !y(c) && (e.class = ee(c)), O(l) && (/* @__PURE__ */ Q(l) && !p(l) && (l = L({}, l)), e.style = Z(l));
|
|
852
856
|
}
|
|
853
|
-
const i = y(t) ? 1 :
|
|
854
|
-
return process.env.NODE_ENV !== "production" && i & 4 && /* @__PURE__ */
|
|
857
|
+
const i = y(t) ? 1 : ht(t) ? 128 : re(t) ? 64 : O(t) ? 4 : w(t) ? 2 : 0;
|
|
858
|
+
return process.env.NODE_ENV !== "production" && i & 4 && /* @__PURE__ */ Q(t) && (t = /* @__PURE__ */ b(t), E(
|
|
855
859
|
"Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",
|
|
856
860
|
`
|
|
857
861
|
Component that was made reactive: `,
|
|
858
862
|
t
|
|
859
|
-
)),
|
|
863
|
+
)), gt(
|
|
860
864
|
t,
|
|
861
865
|
e,
|
|
862
866
|
s,
|
|
@@ -867,16 +871,16 @@ Component that was made reactive: `,
|
|
|
867
871
|
!0
|
|
868
872
|
);
|
|
869
873
|
}
|
|
870
|
-
function
|
|
871
|
-
return t ? /* @__PURE__ */
|
|
874
|
+
function bt(t) {
|
|
875
|
+
return t ? /* @__PURE__ */ Q(t) || be(t) ? L({}, t) : t : null;
|
|
872
876
|
}
|
|
873
|
-
function
|
|
874
|
-
const { props: o, ref: n, patchFlag: i, children: c, transition: l } = t, f = e ?
|
|
877
|
+
function K(t, e, s = !1, r = !1) {
|
|
878
|
+
const { props: o, ref: n, patchFlag: i, children: c, transition: l } = t, f = e ? wt(o || {}, e) : o, _ = {
|
|
875
879
|
__v_isVNode: !0,
|
|
876
880
|
__v_skip: !0,
|
|
877
881
|
type: t.type,
|
|
878
882
|
props: f,
|
|
879
|
-
key: f &&
|
|
883
|
+
key: f && Ne(f),
|
|
880
884
|
ref: e && e.ref ? (
|
|
881
885
|
// #2078 in the case of <component :is="vnode" ref="extra"/>
|
|
882
886
|
// if the vnode itself already has a ref, cloneVNode will need to merge
|
|
@@ -885,7 +889,7 @@ function A(t, e, s = !1, r = !1) {
|
|
|
885
889
|
) : n,
|
|
886
890
|
scopeId: t.scopeId,
|
|
887
891
|
slotScopeIds: t.slotScopeIds,
|
|
888
|
-
children: process.env.NODE_ENV !== "production" && i === -1 && p(c) ? c.map(
|
|
892
|
+
children: process.env.NODE_ENV !== "production" && i === -1 && p(c) ? c.map(Pe) : c,
|
|
889
893
|
target: t.target,
|
|
890
894
|
targetStart: t.targetStart,
|
|
891
895
|
targetAnchor: t.targetAnchor,
|
|
@@ -895,7 +899,7 @@ function A(t, e, s = !1, r = !1) {
|
|
|
895
899
|
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
|
896
900
|
// note: preserve flag for fragments since they use the flag for children
|
|
897
901
|
// fast paths only.
|
|
898
|
-
patchFlag: e && t.type !==
|
|
902
|
+
patchFlag: e && t.type !== Ee ? i === -1 ? 16 : i | 16 : i,
|
|
899
903
|
dynamicProps: t.dynamicProps,
|
|
900
904
|
dynamicChildren: t.dynamicChildren,
|
|
901
905
|
appContext: t.appContext,
|
|
@@ -907,27 +911,27 @@ function A(t, e, s = !1, r = !1) {
|
|
|
907
911
|
// they will simply be overwritten.
|
|
908
912
|
component: t.component,
|
|
909
913
|
suspense: t.suspense,
|
|
910
|
-
ssContent: t.ssContent &&
|
|
911
|
-
ssFallback: t.ssFallback &&
|
|
914
|
+
ssContent: t.ssContent && K(t.ssContent),
|
|
915
|
+
ssFallback: t.ssFallback && K(t.ssFallback),
|
|
912
916
|
placeholder: t.placeholder,
|
|
913
917
|
el: t.el,
|
|
914
918
|
anchor: t.anchor,
|
|
915
919
|
ctx: t.ctx,
|
|
916
920
|
ce: t.ce
|
|
917
921
|
};
|
|
918
|
-
return l && r &&
|
|
922
|
+
return l && r && Se(
|
|
919
923
|
_,
|
|
920
924
|
l.clone(_)
|
|
921
925
|
), _;
|
|
922
926
|
}
|
|
923
|
-
function
|
|
924
|
-
const e =
|
|
925
|
-
return p(t.children) && (e.children = t.children.map(
|
|
927
|
+
function Pe(t) {
|
|
928
|
+
const e = K(t);
|
|
929
|
+
return p(t.children) && (e.children = t.children.map(Pe)), e;
|
|
926
930
|
}
|
|
927
|
-
function
|
|
928
|
-
return
|
|
931
|
+
function Et(t = " ", e = 0) {
|
|
932
|
+
return St(pt, null, t, e);
|
|
929
933
|
}
|
|
930
|
-
function
|
|
934
|
+
function H(t, e) {
|
|
931
935
|
let s = 0;
|
|
932
936
|
const { shapeFlag: r } = t;
|
|
933
937
|
if (e == null)
|
|
@@ -937,21 +941,21 @@ function K(t, e) {
|
|
|
937
941
|
else if (typeof e == "object")
|
|
938
942
|
if (r & 65) {
|
|
939
943
|
const o = e.default;
|
|
940
|
-
o && (o._c && (o._d = !1),
|
|
944
|
+
o && (o._c && (o._d = !1), H(t, o()), o._c && (o._d = !0));
|
|
941
945
|
return;
|
|
942
946
|
} else
|
|
943
|
-
s = 32, !e._ && !
|
|
947
|
+
s = 32, !e._ && !be(e) && (e._ctx = A);
|
|
944
948
|
else if (w(e)) {
|
|
945
949
|
if (r & 65) {
|
|
946
|
-
|
|
950
|
+
H(t, { default: e });
|
|
947
951
|
return;
|
|
948
952
|
}
|
|
949
|
-
e = { default: e, _ctx:
|
|
953
|
+
e = { default: e, _ctx: A }, s = 32;
|
|
950
954
|
} else
|
|
951
|
-
e = String(e), r & 64 ? (s = 16, e = [
|
|
955
|
+
e = String(e), r & 64 ? (s = 16, e = [Et(e)]) : s = 8;
|
|
952
956
|
t.children = e, t.shapeFlag |= s;
|
|
953
957
|
}
|
|
954
|
-
function
|
|
958
|
+
function wt(...t) {
|
|
955
959
|
const e = {};
|
|
956
960
|
for (let s = 0; s < t.length; s++) {
|
|
957
961
|
const r = t[s];
|
|
@@ -960,17 +964,17 @@ function Et(...t) {
|
|
|
960
964
|
e.class !== r.class && (e.class = ee([e.class, r.class]));
|
|
961
965
|
else if (o === "style")
|
|
962
966
|
e.style = Z([e.style, r.style]);
|
|
963
|
-
else if (
|
|
967
|
+
else if (Me(o)) {
|
|
964
968
|
const n = e[o], i = r[o];
|
|
965
969
|
i && n !== i && !(p(n) && n.includes(i)) ? e[o] = n ? [].concat(n, i) : i : i == null && n == null && // mergeProps({ 'onUpdate:modelValue': undefined }) should not retain
|
|
966
970
|
// the model listener.
|
|
967
|
-
!
|
|
971
|
+
!Fe(o) && (e[o] = i);
|
|
968
972
|
} else o !== "" && (e[o] = r[o]);
|
|
969
973
|
}
|
|
970
974
|
return e;
|
|
971
975
|
}
|
|
972
976
|
{
|
|
973
|
-
const t =
|
|
977
|
+
const t = U(), e = (s, r) => {
|
|
974
978
|
let o;
|
|
975
979
|
return (o = t[s]) || (o = t[s] = []), o.push(r), (n) => {
|
|
976
980
|
o.length > 1 ? o.forEach((i) => i(n)) : o[0](n);
|
|
@@ -985,12 +989,12 @@ function Et(...t) {
|
|
|
985
989
|
);
|
|
986
990
|
}
|
|
987
991
|
process.env.NODE_ENV;
|
|
988
|
-
const
|
|
989
|
-
function
|
|
992
|
+
const Nt = /(?:^|[-_])\w/g, Ot = (t) => t.replace(Nt, (e) => e.toUpperCase()).replace(/[-_]/g, "");
|
|
993
|
+
function Ie(t, e = !0) {
|
|
990
994
|
return w(t) ? t.displayName || t.name : t.name || e && t.__name;
|
|
991
995
|
}
|
|
992
|
-
function
|
|
993
|
-
let r =
|
|
996
|
+
function Ce(t, e, s = !1) {
|
|
997
|
+
let r = Ie(e);
|
|
994
998
|
if (!r && e.__file) {
|
|
995
999
|
const o = e.__file.match(/([^/\\]+)\.\w+$/);
|
|
996
1000
|
o && (r = o[1]);
|
|
@@ -1005,12 +1009,12 @@ function Ie(t, e, s = !1) {
|
|
|
1005
1009
|
t.parent.type.components
|
|
1006
1010
|
) || o(t.appContext.components);
|
|
1007
1011
|
}
|
|
1008
|
-
return r ?
|
|
1012
|
+
return r ? Ot(r) : s ? "App" : "Anonymous";
|
|
1009
1013
|
}
|
|
1010
|
-
function
|
|
1014
|
+
function Te(t) {
|
|
1011
1015
|
return w(t) && "__vccOpts" in t;
|
|
1012
1016
|
}
|
|
1013
|
-
function
|
|
1017
|
+
function Pt() {
|
|
1014
1018
|
if (process.env.NODE_ENV === "production" || typeof window > "u")
|
|
1015
1019
|
return;
|
|
1016
1020
|
const t = { style: "color:#3ba776" }, e = { style: "color:#1677ff" }, s = { style: "color:#f5222d" }, r = { style: "color:#eb2f96" }, o = {
|
|
@@ -1035,16 +1039,16 @@ function Ot() {
|
|
|
1035
1039
|
return [
|
|
1036
1040
|
"div",
|
|
1037
1041
|
{},
|
|
1038
|
-
["span", t, /* @__PURE__ */
|
|
1042
|
+
["span", t, /* @__PURE__ */ B(a) ? "ShallowReactive" : "Reactive"],
|
|
1039
1043
|
"<",
|
|
1040
1044
|
c(a),
|
|
1041
|
-
`>${/* @__PURE__ */
|
|
1045
|
+
`>${/* @__PURE__ */ G(a) ? " (readonly)" : ""}`
|
|
1042
1046
|
];
|
|
1043
|
-
if (/* @__PURE__ */
|
|
1047
|
+
if (/* @__PURE__ */ G(a))
|
|
1044
1048
|
return [
|
|
1045
1049
|
"div",
|
|
1046
1050
|
{},
|
|
1047
|
-
["span", t, /* @__PURE__ */
|
|
1051
|
+
["span", t, /* @__PURE__ */ B(a) ? "ShallowReadonly" : "Readonly"],
|
|
1048
1052
|
"<",
|
|
1049
1053
|
c(a),
|
|
1050
1054
|
">"
|
|
@@ -1066,7 +1070,7 @@ function Ot() {
|
|
|
1066
1070
|
};
|
|
1067
1071
|
function n(a) {
|
|
1068
1072
|
const u = [];
|
|
1069
|
-
a.type.props && a.props && u.push(i("props", /* @__PURE__ */ b(a.props))), a.setupState !==
|
|
1073
|
+
a.type.props && a.props && u.push(i("props", /* @__PURE__ */ b(a.props))), a.setupState !== Y && u.push(i("setup", a.setupState)), a.data !== Y && u.push(i("data", /* @__PURE__ */ b(a.data)));
|
|
1070
1074
|
const d = l(a, "computed");
|
|
1071
1075
|
d && u.push(i("computed", d));
|
|
1072
1076
|
const m = l(a, "inject");
|
|
@@ -1084,7 +1088,7 @@ function Ot() {
|
|
|
1084
1088
|
]), u;
|
|
1085
1089
|
}
|
|
1086
1090
|
function i(a, u) {
|
|
1087
|
-
return u =
|
|
1091
|
+
return u = L({}, u), Object.keys(u).length ? [
|
|
1088
1092
|
"div",
|
|
1089
1093
|
{ style: "line-height:1.25em;margin-bottom:0.6em" },
|
|
1090
1094
|
[
|
|
@@ -1116,28 +1120,28 @@ function Ot() {
|
|
|
1116
1120
|
if (w(d))
|
|
1117
1121
|
return;
|
|
1118
1122
|
const m = {};
|
|
1119
|
-
for (const
|
|
1120
|
-
f(d,
|
|
1123
|
+
for (const x in a.ctx)
|
|
1124
|
+
f(d, x, u) && (m[x] = a.ctx[x]);
|
|
1121
1125
|
return m;
|
|
1122
1126
|
}
|
|
1123
1127
|
function f(a, u, d) {
|
|
1124
1128
|
const m = a[d];
|
|
1125
|
-
if (p(m) && m.includes(u) || O(m) && u in m || a.extends && f(a.extends, u, d) || a.mixins && a.mixins.some((
|
|
1129
|
+
if (p(m) && m.includes(u) || O(m) && u in m || a.extends && f(a.extends, u, d) || a.mixins && a.mixins.some((x) => f(x, u, d)))
|
|
1126
1130
|
return !0;
|
|
1127
1131
|
}
|
|
1128
1132
|
function _(a) {
|
|
1129
|
-
return /* @__PURE__ */
|
|
1133
|
+
return /* @__PURE__ */ B(a) ? "ShallowRef" : a.effect ? "ComputedRef" : "Ref";
|
|
1130
1134
|
}
|
|
1131
1135
|
window.devtoolsFormatters ? window.devtoolsFormatters.push(o) : window.devtoolsFormatters = [o];
|
|
1132
1136
|
}
|
|
1133
1137
|
process.env.NODE_ENV;
|
|
1134
1138
|
process.env.NODE_ENV;
|
|
1135
1139
|
process.env.NODE_ENV;
|
|
1136
|
-
function
|
|
1137
|
-
|
|
1140
|
+
function It() {
|
|
1141
|
+
Pt();
|
|
1138
1142
|
}
|
|
1139
|
-
process.env.NODE_ENV !== "production" &&
|
|
1140
|
-
const
|
|
1143
|
+
process.env.NODE_ENV !== "production" && It();
|
|
1144
|
+
const Ct = [
|
|
1141
1145
|
"@context",
|
|
1142
1146
|
"activeLink",
|
|
1143
1147
|
"computed",
|
|
@@ -1149,7 +1153,7 @@ const It = [
|
|
|
1149
1153
|
"subs",
|
|
1150
1154
|
"version"
|
|
1151
1155
|
];
|
|
1152
|
-
class ce extends
|
|
1156
|
+
class ce extends xe {
|
|
1153
1157
|
_className = "StorePersister";
|
|
1154
1158
|
_crypt;
|
|
1155
1159
|
_excludedKeys;
|
|
@@ -1159,7 +1163,7 @@ class ce extends Ve {
|
|
|
1159
1163
|
constructor(e, s, r, o) {
|
|
1160
1164
|
super(e, s, r, o);
|
|
1161
1165
|
const { crypt: n, persister: i, watchedStore: c } = s;
|
|
1162
|
-
this._excludedKeys = this.initExcludedKeys(), this.definePersister(i), this._propertiesToEncrypt = new Set(this.getPropertiesToEncrypt()), this._watchedStore = c, n && (this._crypt = n, this.options && (this.options.isEncrypted = !1)), this.augmentStore(), this.
|
|
1166
|
+
this._excludedKeys = this.initExcludedKeys(), this.definePersister(i), this._propertiesToEncrypt = new Set(this.getPropertiesToEncrypt()), this._watchedStore = c, n && (this._crypt = n, this.options && (this.options.isEncrypted = !1)), this.augmentStore(), this.debugLog("StorePersister constructor", {
|
|
1163
1167
|
toBeWatched: this.toBeWatched(),
|
|
1164
1168
|
watchedStore: c,
|
|
1165
1169
|
persister: i,
|
|
@@ -1167,6 +1171,9 @@ class ce extends Ve {
|
|
|
1167
1171
|
options: s
|
|
1168
1172
|
}), this.toBeWatched() && (this._watchedStore.add(this.store.$id), this.storeSubscribe = this.storeSubscription.bind(this));
|
|
1169
1173
|
}
|
|
1174
|
+
hydrate() {
|
|
1175
|
+
return typeof window > "u" ? Promise.resolve(!1) : this.remember();
|
|
1176
|
+
}
|
|
1170
1177
|
augmentStore() {
|
|
1171
1178
|
const { isEncrypted: e, persistedPropertiesToEncrypt: s, watchMutation: r } = this.options;
|
|
1172
1179
|
e === void 0 && (this.options.isEncrypted = !1), s === void 0 && (this.options.persistedPropertiesToEncrypt = []), r === void 0 && (this.options.watchMutation = !1), this.stateHas("isLoading") || this.addToState("isLoading", !1), this.store.persistState = async () => await this.persist(), this.store.remember = async () => await this.remember(), this.store.removePersistedState = this.removePersistedState.bind(this), this.store.watch = this.watch, this.store.stopWatch = this.stopWatch;
|
|
@@ -1187,7 +1194,7 @@ class ce extends Ve {
|
|
|
1187
1194
|
const f = this.getValue(e[l]);
|
|
1188
1195
|
f && (c[l] = await this.cryptProperty(o, f, s));
|
|
1189
1196
|
}
|
|
1190
|
-
this.debugLog(`cryptState - ${this.store.$id}`, { encryptedState: c }),
|
|
1197
|
+
this.debugLog(`cryptState - ${this.store.$id}`, { encryptedState: c }), D(c) || (e = { ...e, ...c }, this.options && (this.options.isEncrypted = !s));
|
|
1191
1198
|
}
|
|
1192
1199
|
r(e);
|
|
1193
1200
|
});
|
|
@@ -1220,7 +1227,7 @@ class ce extends Ve {
|
|
|
1220
1227
|
for (const i of Object.keys(s))
|
|
1221
1228
|
if (!this.hasDeniedFirstChar(i[0]) && !e.has(i)) {
|
|
1222
1229
|
const c = s[i];
|
|
1223
|
-
|
|
1230
|
+
D(c) || (r && this._propertiesToEncrypt.has(i) ? n[i] = await this.cryptProperty(o, c, !1) : n[i] = /* @__PURE__ */ b(c));
|
|
1224
1231
|
}
|
|
1225
1232
|
return n;
|
|
1226
1233
|
}
|
|
@@ -1232,13 +1239,13 @@ class ce extends Ve {
|
|
|
1232
1239
|
}
|
|
1233
1240
|
initExcludedKeys() {
|
|
1234
1241
|
return /* @__PURE__ */ new Set([
|
|
1235
|
-
...
|
|
1242
|
+
...Ct,
|
|
1236
1243
|
...this.options.excludedKeys ?? []
|
|
1237
1244
|
]);
|
|
1238
1245
|
}
|
|
1239
1246
|
async persist() {
|
|
1240
1247
|
const e = await this.getStateToPersist();
|
|
1241
|
-
this.debugLog(`persist() ${this.store.$id} - stateToPersist:`, { state: e }),
|
|
1248
|
+
this.debugLog(`persist() ${this.store.$id} - stateToPersist:`, { state: e }), D(e) || this._persister.setItem(this.store.$id, e);
|
|
1242
1249
|
}
|
|
1243
1250
|
propertyShouldBePersisted(e) {
|
|
1244
1251
|
return !this._excludedKeys.has(e);
|
|
@@ -1246,7 +1253,7 @@ class ce extends Ve {
|
|
|
1246
1253
|
async remember() {
|
|
1247
1254
|
return this.state.isLoading = !0, new Promise(async (e) => {
|
|
1248
1255
|
let s = await this.getPersistedState();
|
|
1249
|
-
return s && !
|
|
1256
|
+
return s && !D(s) && this.store.$patch(s), this.state.isLoading = !1, e(!0);
|
|
1250
1257
|
});
|
|
1251
1258
|
}
|
|
1252
1259
|
removePersistedState() {
|
|
@@ -1281,7 +1288,7 @@ class ce extends Ve {
|
|
|
1281
1288
|
this.toBeWatched() && (this.options && (this.options.watchMutation = !0), this.storeSubscribe = this.storeSubscription.bind(this));
|
|
1282
1289
|
}
|
|
1283
1290
|
}
|
|
1284
|
-
class
|
|
1291
|
+
class Tt extends De {
|
|
1285
1292
|
_resetStoreCallback = (e) => {
|
|
1286
1293
|
const { removePersistedState: s } = e;
|
|
1287
1294
|
typeof s == "function" && s();
|
|
@@ -1291,34 +1298,45 @@ class Ct extends De {
|
|
|
1291
1298
|
ae,
|
|
1292
1299
|
ce.customizeStore.bind(ce),
|
|
1293
1300
|
N
|
|
1294
|
-
)
|
|
1301
|
+
), this.execution = {
|
|
1302
|
+
environment: "client",
|
|
1303
|
+
hydration: "immediate"
|
|
1304
|
+
}, this.hydrationScheduler = (e) => {
|
|
1305
|
+
Xe(() => e());
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
hydrate() {
|
|
1309
|
+
typeof window > "u" || this.hydrationScheduler?.(() => {
|
|
1310
|
+
const e = this.storeInstance?.hydrate?.();
|
|
1311
|
+
e && typeof e.catch == "function" && e.catch((s) => this.logError(s));
|
|
1312
|
+
});
|
|
1295
1313
|
}
|
|
1296
1314
|
}
|
|
1297
|
-
const
|
|
1298
|
-
function
|
|
1299
|
-
return
|
|
1315
|
+
const q = new Tt();
|
|
1316
|
+
function Rt(t, e) {
|
|
1317
|
+
return q.pluginOptions = Vt(t, e), q;
|
|
1300
1318
|
}
|
|
1301
|
-
function
|
|
1319
|
+
function Vt(t, e) {
|
|
1302
1320
|
let s, r;
|
|
1303
1321
|
const o = /* @__PURE__ */ new Set();
|
|
1304
1322
|
try {
|
|
1305
|
-
if (window)
|
|
1306
|
-
return !
|
|
1323
|
+
if (typeof window < "u")
|
|
1324
|
+
return !D(t) && t && (s = new X({ name: t, keyPath: "storeName" })), e && (r = new R(e)), { persister: s, crypt: r, watchedStore: o };
|
|
1307
1325
|
} catch {
|
|
1308
1326
|
}
|
|
1309
1327
|
return { persister: s, crypt: r, watchedStore: o };
|
|
1310
1328
|
}
|
|
1311
|
-
function
|
|
1329
|
+
function vt(t, e) {
|
|
1312
1330
|
let s;
|
|
1313
|
-
return e && (s = new R(e)),
|
|
1314
|
-
persister: new
|
|
1331
|
+
return e && (s = new R(e)), q.pluginOptions = {
|
|
1332
|
+
persister: new ke({ name: t }),
|
|
1315
1333
|
crypt: s,
|
|
1316
1334
|
watchedStore: /* @__PURE__ */ new Set()
|
|
1317
|
-
},
|
|
1335
|
+
}, q;
|
|
1318
1336
|
}
|
|
1319
1337
|
export {
|
|
1320
1338
|
ae as PLUGIN_NAME,
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1339
|
+
ke as PersisterMock,
|
|
1340
|
+
Rt as createPersistStatePlugin,
|
|
1341
|
+
vt as createPluginMock
|
|
1324
1342
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(_,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("pinia-plugin-subscription")):typeof define=="function"&&define.amd?define(["exports","pinia-plugin-subscription"],d):(_=typeof globalThis<"u"?globalThis:_||self,d(_["pinia-plugin-persist-state"]={},_.PiniaPluginSubscription))})(this,(function(_,d){"use strict";class
|
|
2
|
-
`),
|
|
3
|
-
`,...
|
|
4
|
-
`],...
|
|
5
|
-
Component that was made reactive: `,t)),pt(t,e,s,r,o,i,n,!0)}function gt(t){return t?X(t)||be(t)?k({},t):t:null}function q(t,e,s=!1,r=!1){const{props:o,ref:n,patchFlag:i,children:c,transition:l}=t,f=e?St(o||{},e):o,b={__v_isVNode:!0,__v_skip:!0,type:t.type,props:f,key:f&&Ne(f),ref:e&&e.ref?s&&n?m(n)?n.concat(H(e)):[n,H(e)]:H(e):n,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:process.env.NODE_ENV!=="production"&&i===-1&&m(c)?c.map(Pe):c,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Ee?i===-1?16:i|16:i,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&q(t.ssContent),ssFallback:t.ssFallback&&q(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&Se(b,l.clone(b)),b}function Pe(t){const e=q(t);return m(t.children)&&(e.children=t.children.map(Pe)),e}function yt(t=" ",e=0){return _t(ft,null,t,e)}function L(t,e){let s=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(m(e))s=16;else if(typeof e=="object")if(r&65){const o=e.default;o&&(o._c&&(o._d=!1),L(t,o()),o._c&&(o._d=!0));return}else s=32,!e._&&!be(e)&&(e._ctx=K);else if(E(e)){if(r&65){L(t,{default:e});return}e={default:e,_ctx:K},s=32}else e=String(e),r&64?(s=16,e=[yt(e)]):s=8;t.children=e,t.shapeFlag|=s}function St(...t){const e={};for(let s=0;s<t.length;s++){const r=t[s];for(const o in r)if(o==="class")e.class!==r.class&&(e.class=Y([e.class,r.class]));else if(o==="style")e.style=J([e.style,r.style]);else if(ve(o)){const n=e[o],i=r[o];i&&n!==i&&!(m(n)&&n.includes(i))?e[o]=n?[].concat(n,i):i:i==null&&n==null&&!ke(o)&&(e[o]=i)}else o!==""&&(e[o]=r[o])}return e}{const t=$(),e=(s,r)=>{let o;return(o=t[s])||(o=t[s]=[]),o.push(r),n=>{o.length>1?o.forEach(i=>i(n)):o[0](n)}};e("__VUE_INSTANCE_SETTERS__",s=>s),e("__VUE_SSR_SETTERS__",s=>s)}process.env.NODE_ENV;const bt=/(?:^|[-_])\w/g,Et=t=>t.replace(bt,e=>e.toUpperCase()).replace(/[-_]/g,"");function Ie(t,e=!0){return E(t)?t.displayName||t.name:t.name||e&&t.__name}function Ce(t,e,s=!1){let r=Ie(e);if(!r&&e.__file){const o=e.__file.match(/([^/\\]+)\.\w+$/);o&&(r=o[1])}if(!r&&t){const o=n=>{for(const i in n)if(n[i]===e)return i};r=o(t.components)||t.parent&&o(t.parent.type.components)||o(t.appContext.components)}return r?Et(r):s?"App":"Anonymous"}function Te(t){return E(t)&&"__vccOpts"in t}function wt(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const t={style:"color:#3ba776"},e={style:"color:#1677ff"},s={style:"color:#f5222d"},r={style:"color:#eb2f96"},o={__vue_custom_formatter:!0,header(a){if(!I(a))return null;if(a.__isVue)return["div",t,"VueInstance"];if(Z(a)){const u=a.value;return["div",{},["span",t,b(a)],"<",c(u),">"]}else{if(ue(a))return["div",{},["span",t,Q(a)?"ShallowReactive":"Reactive"],"<",c(a),`>${G(a)?" (readonly)":""}`];if(G(a))return["div",{},["span",t,Q(a)?"ShallowReadonly":"Readonly"],"<",c(a),">"]}return null},hasBody(a){return a&&a.__isVue},body(a){if(a&&a.__isVue)return["div",{},...n(a.$)]}};function n(a){const u=[];a.type.props&&a.props&&u.push(i("props",w(a.props))),a.setupState!==z&&u.push(i("setup",a.setupState)),a.data!==z&&u.push(i("data",w(a.data)));const p=l(a,"computed");p&&u.push(i("computed",p));const g=l(a,"inject");return g&&u.push(i("injected",g)),u.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:a}]]),u}function i(a,u){return u=k({},u),Object.keys(u).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},a],["div",{style:"padding-left:1.25em"},...Object.keys(u).map(p=>["div",{},["span",r,p+": "],c(u[p],!1)])]]:["span",{}]}function c(a,u=!0){return typeof a=="number"?["span",e,a]:typeof a=="string"?["span",s,JSON.stringify(a)]:typeof a=="boolean"?["span",r,a]:I(a)?["object",{object:u?w(a):a}]:["span",s,String(a)]}function l(a,u){const p=a.type;if(E(p))return;const g={};for(const v in a.ctx)f(p,v,u)&&(g[v]=a.ctx[v]);return g}function f(a,u,p){const g=a[p];if(m(g)&&g.includes(u)||I(g)&&u in g||a.extends&&f(a.extends,u,p)||a.mixins&&a.mixins.some(v=>f(v,u,p)))return!0}function b(a){return Q(a)?"ShallowRef":a.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(o):window.devtoolsFormatters=[o]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;function Nt(){wt()}process.env.NODE_ENV!=="production"&&Nt();const Ot=["@context","activeLink","computed","dep","excludedKeys","fn","isEncrypted","isLoading","subs","version"];class Ve extends d.Store{_className="StorePersister";_crypt;_excludedKeys;_persister;_propertiesToEncrypt;_watchedStore;constructor(e,s,r,o){super(e,s,r,o);const{crypt:n,persister:i,watchedStore:c}=s;this._excludedKeys=this.initExcludedKeys(),this.definePersister(i),this._propertiesToEncrypt=new Set(this.getPropertiesToEncrypt()),this._watchedStore=c,n&&(this._crypt=n,this.options&&(this.options.isEncrypted=!1)),this.augmentStore(),this.remember(),this.debugLog("StorePersister constructor",{toBeWatched:this.toBeWatched(),watchedStore:c,persister:i,store:e,options:s}),this.toBeWatched()&&(this._watchedStore.add(this.store.$id),this.storeSubscribe=this.storeSubscription.bind(this))}augmentStore(){const{isEncrypted:e,persistedPropertiesToEncrypt:s,watchMutation:r}=this.options;e===void 0&&(this.options.isEncrypted=!1),s===void 0&&(this.options.persistedPropertiesToEncrypt=[]),r===void 0&&(this.options.watchMutation=!1),this.stateHas("isLoading")||this.addToState("isLoading",!1),this.store.persistState=async()=>await this.persist(),this.store.remember=async()=>await this.remember(),this.store.removePersistedState=this.removePersistedState.bind(this),this.store.watch=this.watch,this.store.stopWatch=this.stopWatch}async cryptProperty(e,s,r=!1){return r?await e.decrypt(s):await e.encrypt(s)}async cryptState(e,s=!1){return await new Promise(async r=>{const o=this._crypt,n=this.getPropertiesToEncrypt(),i=this.isEncrypted();if(this.debugLog(`cryptState - ${this.store.$id} ${s?"decrypt":"crypt"}`,{can:this._propertiesToEncrypt.size>0&&i===s&&!!o,Crypt:o,state:e}),this._propertiesToEncrypt.size>0&&o){const c={};for(const l of n){const f=this.getValue(e[l]);f&&(c[l]=await this.cryptProperty(o,f,s))}this.debugLog(`cryptState - ${this.store.$id}`,{encryptedState:c}),d.isEmpty(c)||(e={...e,...c},this.options&&(this.options.isEncrypted=!s))}r(e)})}static customizeStore(e,s,r,o){return!s.storeOptions?.persist&&s.storeOptions?.watchMutation&&(s.storeOptions.persist=!0),super.customizeStore(e,s,r,o)}definePersister(e){this._persister=this.options.dbName?new W({name:this.options.dbName,keyPath:"storeName"}):e}isEncrypted(){return this.options.isEncrypted}getPropertiesToEncrypt(){return this.options?.persistedPropertiesToEncrypt??[]}async getPersistedState(e=!0){const s=this.store.$id;try{let r=await this._persister.getItem(s);return e&&this.toBeCrypted()&&r&&(await this._crypt?.init(),r=await this.cryptState(r,!0)),this.debugLog(`getPersistedState ${s}`,{persistedState:r,state:this.state}),r}catch(r){this.logError("getPersistedState()",{storeName:s,e:r})}}async getStateToPersist(){const e=this._excludedKeys,s=this.state,r=this._propertiesToEncrypt.size>0,o=this._crypt;r&&await o.init();const n={};for(const i of Object.keys(s))if(!this.hasDeniedFirstChar(i[0])&&!e.has(i)){const c=s[i];d.isEmpty(c)||(r&&this._propertiesToEncrypt.has(i)?n[i]=await this.cryptProperty(o,c,!1):n[i]=w(c))}return n}getWatchMutation(){return this.options.watchMutation}static hasRequiredKeys(e){return!!e?.persist||!!e?.watchMutation}initExcludedKeys(){return new Set([...Ot,...this.options.excludedKeys??[]])}async persist(){const e=await this.getStateToPersist();this.debugLog(`persist() ${this.store.$id} - stateToPersist:`,{state:e}),d.isEmpty(e)||this._persister.setItem(this.store.$id,e)}propertyShouldBePersisted(e){return!this._excludedKeys.has(e)}async remember(){return this.state.isLoading=!0,new Promise(async e=>{let s=await this.getPersistedState();return s&&!d.isEmpty(s)&&this.store.$patch(s),this.state.isLoading=!1,e(!0)})}removePersistedState(){this._persister.removeItem(this.store.$id)}stopWatch(){this.options?.watchMutation&&(this.options&&(this.options.watchMutation=!1),this._watchedStore.delete(this.store.$id))}storeSubscription(e){this.debugLog(`store.storeSubscription() ${this.store.$id}`,["mutation type !== patch object: ",e.type!=="patch object","watchMutation: ",this.getWatchMutation(),"mutation:",e,"state:",this.state,"store:",this.store]),e.type!=="patch object"&&this.getWatchMutation()&&this.persist().then(()=>{this.store.mutationCallback&&this.store.mutationCallback(this.state,e)})}toBeCrypted(){return!!(this._crypt&&this.getPropertiesToEncrypt())}toBeWatched(){return!this._watchedStore.has(this.store.$id)}watch(){this.toBeWatched()&&(this.options&&(this.options.watchMutation=!0),this.storeSubscribe=this.storeSubscription.bind(this))}}class Pt extends d.PluginSubscriber{_resetStoreCallback=e=>{const{removePersistedState:s}=e;typeof s=="function"&&s()};constructor(){super(B,Ve.customizeStore.bind(Ve),P)}}const U=new Pt;function It(t,e){return U.pluginOptions=Ct(t,e),U}function Ct(t,e){let s,r;const o=new Set;try{if(window)return!d.isEmpty(t)&&t&&(s=new W({name:t,keyPath:"storeName"})),e&&(r=new x(e)),{persister:s,crypt:r,watchedStore:o}}catch{}return{persister:s,crypt:r,watchedStore:o}}function Tt(t,e){let s;return e&&(s=new x(e)),U.pluginOptions={persister:new ce({name:t}),crypt:s,watchedStore:new Set},U}_.PLUGIN_NAME=B,_.PersisterMock=ce,_.createPersistStatePlugin=It,_.createPluginMock=Tt,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(_,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("pinia-plugin-subscription")):typeof define=="function"&&define.amd?define(["exports","pinia-plugin-subscription"],d):(_=typeof globalThis<"u"?globalThis:_||self,d(_["pinia-plugin-persist-state"]={},_.PiniaPluginSubscription))})(this,(function(_,d){"use strict";class xe{_storage;constructor(e){this._storage=e==="localStorage"?localStorage:sessionStorage}clear(){this._storage.clear()}async getItem(e){return new Promise((s,r)=>{const n=this._storage.getItem(e.toString());s(n?JSON.parse(n):void 0)})}removeItem(e){this._storage.removeItem(e.toString())}removeItems(e){for(let s=0;s<this._storage.length;s++){const r=this._storage.key(s);r&&(!e||!e.includes(r))&&this._storage.removeItem(r)}}setItem(e,s){this._storage.setItem(s,JSON.stringify(e))}}const W="pinia-plugin-persist-state";class Re extends d.CustomConsole{_pluginName=W}const P=new Re;let ie=class{_db;_localStorageVersionKey="IDBVersion";_name="persistStore";_objectStore;_objectStoreOptions;_objectStoreName;_transactionMode="readwrite";_version;constructor(e,s,r){this._objectStoreName=e,this._version=this.getStoredVersionNumber(),s&&(this._objectStoreOptions=s),r&&(this._transactionMode=r)}clear(){const e=()=>{if(this._objectStore){const s=this._objectStore.clear();this.requestEventsHandler(s,{error:()=>this.onError(s.error)})}};this.open({success:e})}createObjectStore(){this._db&&!this._db.objectStoreNames.contains(this._objectStoreName)&&this._db.createObjectStore(this._objectStoreName,this._objectStoreOptions)}deleteObjectStore(){const e=()=>{this._db?.deleteObjectStore(this._objectStoreName)};this.open({success:e})}async getItem(e){return new Promise(s=>{const r=()=>{if(this._objectStore){const n=this._objectStore.get(e);this.requestEventsHandler(n,{error:()=>this.onError(n.error,()=>s(void 0)),success:()=>s(n.result)})}};this.open({success:r})})}async getObjectStoreItem(e,s){return new Promise(r=>{const n=()=>{if(this._objectStore){const i=this._objectStore.index(e).get(s);this.requestEventsHandler(i,{error:()=>r(void 0),success:()=>r(i.result)})}};this.open({success:n})})}getStoredVersionNumber(){if(!localStorage)return 1;const e=localStorage.getItem(this._localStorageVersionKey);return e?parseInt(e):1}handleDeleteRequest(e,s){e.onerror=()=>P.error(`IndexedDB - Item "${s}" remove`,e.error)}onError(e,s){s&&s(e)}open(e){const s=indexedDB.open(this._name,this._version),r=()=>{this._db=s.result},n=i=>{try{if(r(),!this._db)return;const c=this._db.transaction(this._objectStoreName,this._transactionMode);c.onerror=()=>this.onError(c.error),this._objectStore=c.objectStore(this._objectStoreName),this._objectStore&&i()}catch(c){P.error("indexedDB - transaction error",[c])}};if(e?.success){const i=e.success;e.success=()=>n(i)}if(e?.upgrade){const i=e.upgrade.bind(this);e.upgrade=()=>{r(),i()}}const o=()=>{const i=c=>{if(c?.name==="VersionError"){this._version++,this.saveVersion(),this.open(e);return}e?.error&&e.error(c)};this.onError(s.error,i)};return e&&this.openRequestEventsHandler(s,{...e,error:o}),s}openRequestEventsHandler(e,s){this.requestEventsHandler(e,s),s.upgrade&&(e.onupgradeneeded=s.upgrade)}removeItem(e){const s=()=>{if(this._objectStore){const r=this._objectStore.delete(e);this.handleDeleteRequest(r,e)}};this.open({success:s})}removeItems(e){const s=()=>{if(this._objectStore){const r=this._objectStore.getAllKeys(),n=()=>{r.result.forEach(c=>{if(this._objectStore&&(!e||!e.includes(c))){const l=this._objectStore.delete(c);this.handleDeleteRequest(l,c)}})},o=()=>P.error("IndexedDB - removeItems",[r.error]);this.requestEventsHandler(r,{error:o,success:n})}};this.open({success:s})}requestEventsHandler(e,s){const{error:r,success:n}=s;r&&(e.onerror=r),n&&(e.onsuccess=n)}saveVersion(){localStorage&&localStorage.setItem(this._localStorageVersionKey,this._version.toString())}setItem(e,s){const r=()=>{if(this._objectStore){const o=this._objectStore.add(e);if(s){const i=()=>{s.forEach(l=>{this._objectStore?.createIndex(l,l,{unique:!0}),P.log(`"${l}" index created`)})},c=()=>this.onError(o.error);this.requestEventsHandler(o,{error:c,success:i})}}},n=this.createObjectStore;this.open({success:r,upgrade:n})}updateItem(e){const s=()=>{if(this._objectStore){const r=this._objectStore.put(e);r.onerror=()=>P.error("update item",[r.error,e])}};this.open({success:s})}};class z{_db;_db_options;get dbName(){return this._db_options.name}constructor(e){if(!e)throw new Error("DbOptions is required");this._db_options=e,this._db=this.defineDb()}defineDb(){const{keyPath:e,name:s}=this._db_options;return s==="localStorage"||s==="sessionStorage"?new xe(s):new ie(s,{keyPath:e})}getItem(e){return new Promise((s,r)=>{try{return this._db.getItem(e).then(n=>s(n))}catch(n){r(n)}})}removeItem(e){this._db.removeItem(e)}setItem(e,s){if(this._db instanceof ie)try{this._db.getItem(e).then(r=>{r?this._db.updateItem(r):this._db.setItem({storeName:e,...s})})}catch(r){P.error("Persister - setItem Error",r),this._db.setItem({storename:e,...s})}else this._db.setItem(s,e)}}class ve{_store=new Map;clear(){this._store.clear()}keyToString(e){return typeof e=="number"?e.toString():e}async getItem(e){return this._store.get(this.keyToString(e))}removeItem(e){this._store.delete(this.keyToString(e))}removeItems(e){if(e)for(const s of this._store.keys())e.includes(s)||this._store.delete(s);else this._store.clear()}setItem(e,s){this._store.set(s,e)}}let T={};const je={clear:()=>T={},getItem:async t=>new Promise(e=>e(T[t])),removeItem:t=>delete T[t],removeItems:t=>t?t.forEach(e=>delete T[e]):T={},setItem:(t,e)=>{T[e]=t}};class ce extends z{defineDb(){return this.dbName==="localStorage"||this.dbName==="sessionStorage"?je:new ve}}class R{_encoder=new TextEncoder;_key;_materialKey;static DECRYPT="decrypt";static ENCRYPT="encrypt";constructor(e){this._key=e}async getKey(e){return await crypto.subtle.deriveKey({name:"PBKDF2",salt:this._encoder.encode("salt"),iterations:1e5,hash:"SHA-256"},this._materialKey,{name:"AES-GCM",length:256},!1,[e])}async setKeyMaterial(e){this._materialKey=await crypto.subtle.importKey("raw",this._encoder.encode(e),{name:"PBKDF2"},!1,["deriveKey"])}async decrypt(e){const[s,r]=e.split(":"),n=await crypto.subtle.decrypt({name:"AES-GCM",iv:Uint8Array.from(atob(s),o=>o.charCodeAt(0))},await this.getKey(R.DECRYPT),Uint8Array.from(atob(r),o=>o.charCodeAt(0)));return new TextDecoder().decode(n)}async encrypt(e){const s=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},await this.getKey(R.ENCRYPT),this._encoder.encode(e));return btoa(String.fromCharCode(...new Uint8Array(s)))+":"+btoa(String.fromCharCode(...new Uint8Array(r)))}async init(){this._materialKey||await this.setKeyMaterial(this._key)}}const J=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const ae=()=>{},ke=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),$e=t=>t.startsWith("onUpdate:"),k=Object.assign,m=Array.isArray,E=t=>typeof t=="function",y=t=>typeof t=="string",Me=t=>typeof t=="symbol",I=t=>t!==null&&typeof t=="object";let le;const $=()=>le||(le=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Y(t){if(m(t)){const e={};for(let s=0;s<t.length;s++){const r=t[s],n=y(r)?He(r):Y(r);if(n)for(const o in n)e[o]=n[o]}return e}else if(y(t)||I(t))return t}const Fe=/;(?![^(]*\))/g,Ae=/:([^]+)/,Ke=/\/\*[^]*?\*\//g;function He(t){const e={};return t.replace(Ke,"").split(Fe).forEach(s=>{if(s){const r=s.split(Ae);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function G(t){let e="";if(y(t))e=t;else if(m(t))for(let s=0;s<t.length;s++){const r=G(t[s]);r&&(e+=r+" ")}else if(I(t))for(const s in t)t[s]&&(e+=s+" ");return e.trim()}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV,new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Me));function ue(t){return Q(t)?ue(t.__v_raw):!!(t&&t.__v_isReactive)}function Q(t){return!!(t&&t.__v_isReadonly)}function X(t){return!!(t&&t.__v_isShallow)}function Z(t){return t?!!t.__v_raw:!1}function w(t){const e=t&&t.__v_raw;return e?w(e):t}function ee(t){return t?t.__v_isRef===!0:!1}const C=[];function qe(t){C.push(t)}function Le(){C.pop()}let te=!1;function N(t,...e){if(te)return;te=!0;const s=C.length?C[C.length-1].component:null,r=s&&s.appContext.config.warnHandler,n=Ue();if(r)se(r,s,11,[t+e.map(o=>{var i,c;return(c=(i=o.toString)==null?void 0:i.call(o))!=null?c:JSON.stringify(o)}).join(""),s&&s.proxy,n.map(({vnode:o})=>`at <${Te(s,o.type)}>`).join(`
|
|
2
|
+
`),n]);else{const o=[`[Vue warn]: ${t}`,...e];n.length&&o.push(`
|
|
3
|
+
`,...Be(n)),console.warn(...o)}te=!1}function Ue(){let t=C[C.length-1];if(!t)return[];const e=[];for(;t;){const s=e[0];s&&s.vnode===t?s.recurseCount++:e.push({vnode:t,recurseCount:0});const r=t.component&&t.component.parent;t=r&&r.vnode}return e}function Be(t){const e=[];return t.forEach((s,r)=>{e.push(...r===0?[]:[`
|
|
4
|
+
`],...We(s))}),e}function We({vnode:t,recurseCount:e}){const s=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,n=` at <${Te(t.component,t.type,r)}`,o=">"+s;return t.props?[n,...ze(t.props),o]:[n+o]}function ze(t){const e=[],s=Object.keys(t);return s.slice(0,3).forEach(r=>{e.push(...fe(r,t[r]))}),s.length>3&&e.push(" ..."),e}function fe(t,e,s){return y(e)?(e=JSON.stringify(e),s?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?s?e:[`${t}=${e}`]:ee(e)?(e=fe(t,w(e.value),!0),s?e:[`${t}=Ref<`,e,">"]):E(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=w(e),s?e:[`${t}=`,e])}const de={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function se(t,e,s,r){try{return r?t(...r):t()}catch(n){he(n,e,s)}}function he(t,e,s,r=!0){const n=e?e.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=e&&e.appContext.config||J;if(e){let c=e.parent;const l=e.proxy,f=process.env.NODE_ENV!=="production"?de[s]:`https://vuejs.org/error-reference/#runtime-${s}`;for(;c;){const b=c.ec;if(b){for(let a=0;a<b.length;a++)if(b[a](t,l,f)===!1)return}c=c.parent}if(o){se(o,null,10,[t,l,f]);return}}Je(t,s,n,r,i)}function Je(t,e,s,r=!0,n=!1){if(process.env.NODE_ENV!=="production"){const o=de[e];if(s&&qe(s),N(`Unhandled error${o?` during execution of ${o}`:""}`),s&&Le(),r)throw t;console.error(t)}else{if(n)throw t;console.error(t)}}const h=[];let S=-1;const V=[];let O=null,D=0;const pe=Promise.resolve();let M=null;const Ye=100;function Ge(t){const e=M||pe;return t?e.then(this?t.bind(this):t):e}function Qe(t){let e=S+1,s=h.length;for(;e<s;){const r=e+s>>>1,n=h[r],o=v(n);o<t||o===t&&n.flags&2?e=r+1:s=r}return e}function Xe(t){if(!(t.flags&1)){const e=v(t),s=h[h.length-1];!s||!(t.flags&2)&&e>=v(s)?h.push(t):h.splice(Qe(e),0,t),t.flags|=1,me()}}function me(){M||(M=pe.then(_e))}function Ze(t){if(!m(t))O&&t.id===-1?O.splice(D+1,0,t):t.flags&1||(V.push(t),t.flags|=1);else for(let e=0;e<t.length;e++)V.push(t[e]);me()}function et(t){if(V.length){const e=[...new Set(V)].sort((s,r)=>v(s)-v(r));if(V.length=0,O){for(let s=0;s<e.length;s++)O.push(e[s]);return}for(O=e,process.env.NODE_ENV!=="production"&&(t=t||new Map),D=0;D<O.length;D++){const s=O[D];process.env.NODE_ENV!=="production"&&ge(t,s)||(s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2)}O=null,D=0}}const v=t=>t.id==null?t.flags&2?-1:1/0:t.id;function _e(t){process.env.NODE_ENV!=="production"&&(t=t||new Map);const e=process.env.NODE_ENV!=="production"?s=>ge(t,s):ae;try{for(S=0;S<h.length;S++){const s=h[S];if(s&&!(s.flags&8)){if(process.env.NODE_ENV!=="production"&&e(s))continue;s.flags&4&&(s.flags&=-2),se(s,s.i,s.i?15:14),s.flags&4||(s.flags&=-2)}}}finally{for(;S<h.length;S++){const s=h[S];s&&(s.flags&=-2)}S=-1,h.length=0,et(t),M=null,(h.length||V.length)&&_e(t)}}function ge(t,e){const s=t.get(e)||0;if(s>Ye){const r=e.i,n=r&&Ce(r.type);return he(`Maximum recursive updates exceeded${n?` in component <${n}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return t.set(e,s+1),!1}const re=new Map;process.env.NODE_ENV!=="production"&&($().__VUE_HMR_RUNTIME__={createRecord:ne(tt),rerender:ne(st),reload:ne(rt)});const F=new Map;function tt(t,e){return F.has(t)?!1:(F.set(t,{initialDef:A(e),instances:new Set}),!0)}function A(t){return Ve(t)?t.__vccOpts:t}function st(t,e){const s=F.get(t);s&&(s.initialDef.render=e,[...s.instances].forEach(r=>{e&&(r.render=e,A(r.type).render=e),r.renderCache=[],r.job.flags&8||r.update()}))}function rt(t,e){const s=F.get(t);if(!s)return;e=A(e),ye(s.initialDef,e);const r=[...s.instances];for(let n=0;n<r.length;n++){const o=r[n],i=A(o.type);let c=re.get(i);c||(i!==s.initialDef&&ye(i,e),re.set(i,c=new Set)),c.add(o),o.appContext.propsCache.delete(o.type),o.appContext.emitsCache.delete(o.type),o.appContext.optionsCache.delete(o.type),o.ceReload?(c.add(o),o.ceReload(e.styles),c.delete(o)):o.parent?Xe(()=>{o.job.flags&8||(o.parent.update(),c.delete(o))}):o.appContext.reload?o.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),o.root.ce&&o!==o.root&&o.root.ce._removeChildStyle(i)}Ze(()=>{re.clear()})}function ye(t,e){k(t,e);for(const s in t)s!=="__file"&&!(s in e)&&delete t[s]}function ne(t){return(e,s)=>{try{return t(e,s)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let x,K=[];function Se(t,e){var s,r;x=t,x?(x.enabled=!0,K.forEach(({event:n,args:o})=>x.emit(n,...o)),K=[]):typeof window<"u"&&window.HTMLElement&&!((r=(s=window.navigator)==null?void 0:s.userAgent)!=null&&r.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(o=>{Se(o,e)}),setTimeout(()=>{x||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,K=[])},3e3)):K=[]}let H=null,nt=null;const oe=t=>t.__isTeleport;function ot(t){let e=t[0];if(t.length>1){let s=!1;for(const r of t)if(r.type!==Ne){if(process.env.NODE_ENV!=="production"&&s){N("<transition> can only be used on a single element or component. Use <transition-group> for lists.");break}if(e=r,s=!0,process.env.NODE_ENV==="production")break}}return e}function it(t){if(!ct(t))return oe(t.type)&&t.children?ot(t.children):t;if(t.component)return t.component.subTree;const{shapeFlag:e,children:s}=t;if(s){if(e&16)return s[0];if(e&32&&E(s.default))return s.default()}}function be(t,e){if(t.shapeFlag&6&&t.component){t.transition=e;const s=t.component.subTree;be(oe(s.type)&&it(s)||s,e)}else t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}$().requestIdleCallback,$().cancelIdleCallback;const ct=t=>t.type.__isKeepAlive,at=Symbol.for("v-ndc"),lt={};process.env.NODE_ENV!=="production"&&(lt.ownKeys=t=>(N("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(t)));const ut={},Ee=t=>Object.getPrototypeOf(t)===ut,ft=t=>t.__isSuspense,we=Symbol.for("v-fgt"),dt=Symbol.for("v-txt"),Ne=Symbol.for("v-cmt");function ht(t){return t?t.__v_isVNode===!0:!1}const pt=(...t)=>Pe(...t),Oe=({key:t})=>t??null,q=({ref:t,ref_key:e,ref_for:s})=>(typeof t=="number"&&(t=""+t),t!=null?y(t)||ee(t)||E(t)?{i:H,r:t,k:e,f:!!s}:t:null);function mt(t,e=null,s=null,r=0,n=null,o=t===we?0:1,i=!1,c=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Oe(e),ref:e&&q(e),scopeId:nt,slotScopeIds:null,children:s,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:r,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:H};if(c?(U(l,s),o&128&&t.normalize(l)):s&&(l.shapeFlag|=y(s)?8:16),process.env.NODE_ENV!=="production"&&l.key!==l.key&&N("VNode created with invalid key (NaN). VNode type:",l.type),process.env.NODE_ENV!=="production"&&e&&l.shapeFlag&1){const f=e.innerHTML!=null?"innerHTML":e.textContent!=null?"textContent":null;f&&_t(l.children)&&N(`The \`${f}\` prop on <${l.type}> will override its children. Remove either the \`${f}\` prop or the children.`)}return l}function _t(t){return y(t)?t!=="":m(t)?t.length>0:!1}const gt=process.env.NODE_ENV!=="production"?pt:Pe;function Pe(t,e=null,s=null,r=0,n=null,o=!1){if((!t||t===at)&&(process.env.NODE_ENV!=="production"&&!t&&N(`Invalid vnode type when creating vnode: ${t}.`),t=Ne),ht(t)){const c=L(t,e,!0);return s&&U(c,s),c.patchFlag=-2,c}if(Ve(t)&&(t=t.__vccOpts),e){e=yt(e);let{class:c,style:l}=e;c&&!y(c)&&(e.class=G(c)),I(l)&&(Z(l)&&!m(l)&&(l=k({},l)),e.style=Y(l))}const i=y(t)?1:ft(t)?128:oe(t)?64:I(t)?4:E(t)?2:0;return process.env.NODE_ENV!=="production"&&i&4&&Z(t)&&(t=w(t),N("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",`
|
|
5
|
+
Component that was made reactive: `,t)),mt(t,e,s,r,n,i,o,!0)}function yt(t){return t?Z(t)||Ee(t)?k({},t):t:null}function L(t,e,s=!1,r=!1){const{props:n,ref:o,patchFlag:i,children:c,transition:l}=t,f=e?bt(n||{},e):n,b={__v_isVNode:!0,__v_skip:!0,type:t.type,props:f,key:f&&Oe(f),ref:e&&e.ref?s&&o?m(o)?o.concat(q(e)):[o,q(e)]:q(e):o,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:process.env.NODE_ENV!=="production"&&i===-1&&m(c)?c.map(Ie):c,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==we?i===-1?16:i|16:i,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&L(t.ssContent),ssFallback:t.ssFallback&&L(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&be(b,l.clone(b)),b}function Ie(t){const e=L(t);return m(t.children)&&(e.children=t.children.map(Ie)),e}function St(t=" ",e=0){return gt(dt,null,t,e)}function U(t,e){let s=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(m(e))s=16;else if(typeof e=="object")if(r&65){const n=e.default;n&&(n._c&&(n._d=!1),U(t,n()),n._c&&(n._d=!0));return}else s=32,!e._&&!Ee(e)&&(e._ctx=H);else if(E(e)){if(r&65){U(t,{default:e});return}e={default:e,_ctx:H},s=32}else e=String(e),r&64?(s=16,e=[St(e)]):s=8;t.children=e,t.shapeFlag|=s}function bt(...t){const e={};for(let s=0;s<t.length;s++){const r=t[s];for(const n in r)if(n==="class")e.class!==r.class&&(e.class=G([e.class,r.class]));else if(n==="style")e.style=Y([e.style,r.style]);else if(ke(n)){const o=e[n],i=r[n];i&&o!==i&&!(m(o)&&o.includes(i))?e[n]=o?[].concat(o,i):i:i==null&&o==null&&!$e(n)&&(e[n]=i)}else n!==""&&(e[n]=r[n])}return e}{const t=$(),e=(s,r)=>{let n;return(n=t[s])||(n=t[s]=[]),n.push(r),o=>{n.length>1?n.forEach(i=>i(o)):n[0](o)}};e("__VUE_INSTANCE_SETTERS__",s=>s),e("__VUE_SSR_SETTERS__",s=>s)}process.env.NODE_ENV;const Et=/(?:^|[-_])\w/g,wt=t=>t.replace(Et,e=>e.toUpperCase()).replace(/[-_]/g,"");function Ce(t,e=!0){return E(t)?t.displayName||t.name:t.name||e&&t.__name}function Te(t,e,s=!1){let r=Ce(e);if(!r&&e.__file){const n=e.__file.match(/([^/\\]+)\.\w+$/);n&&(r=n[1])}if(!r&&t){const n=o=>{for(const i in o)if(o[i]===e)return i};r=n(t.components)||t.parent&&n(t.parent.type.components)||n(t.appContext.components)}return r?wt(r):s?"App":"Anonymous"}function Ve(t){return E(t)&&"__vccOpts"in t}function Nt(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const t={style:"color:#3ba776"},e={style:"color:#1677ff"},s={style:"color:#f5222d"},r={style:"color:#eb2f96"},n={__vue_custom_formatter:!0,header(a){if(!I(a))return null;if(a.__isVue)return["div",t,"VueInstance"];if(ee(a)){const u=a.value;return["div",{},["span",t,b(a)],"<",c(u),">"]}else{if(ue(a))return["div",{},["span",t,X(a)?"ShallowReactive":"Reactive"],"<",c(a),`>${Q(a)?" (readonly)":""}`];if(Q(a))return["div",{},["span",t,X(a)?"ShallowReadonly":"Readonly"],"<",c(a),">"]}return null},hasBody(a){return a&&a.__isVue},body(a){if(a&&a.__isVue)return["div",{},...o(a.$)]}};function o(a){const u=[];a.type.props&&a.props&&u.push(i("props",w(a.props))),a.setupState!==J&&u.push(i("setup",a.setupState)),a.data!==J&&u.push(i("data",w(a.data)));const p=l(a,"computed");p&&u.push(i("computed",p));const g=l(a,"inject");return g&&u.push(i("injected",g)),u.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:a}]]),u}function i(a,u){return u=k({},u),Object.keys(u).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},a],["div",{style:"padding-left:1.25em"},...Object.keys(u).map(p=>["div",{},["span",r,p+": "],c(u[p],!1)])]]:["span",{}]}function c(a,u=!0){return typeof a=="number"?["span",e,a]:typeof a=="string"?["span",s,JSON.stringify(a)]:typeof a=="boolean"?["span",r,a]:I(a)?["object",{object:u?w(a):a}]:["span",s,String(a)]}function l(a,u){const p=a.type;if(E(p))return;const g={};for(const j in a.ctx)f(p,j,u)&&(g[j]=a.ctx[j]);return g}function f(a,u,p){const g=a[p];if(m(g)&&g.includes(u)||I(g)&&u in g||a.extends&&f(a.extends,u,p)||a.mixins&&a.mixins.some(j=>f(j,u,p)))return!0}function b(a){return X(a)?"ShallowRef":a.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(n):window.devtoolsFormatters=[n]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;function Ot(){Nt()}process.env.NODE_ENV!=="production"&&Ot();const Pt=["@context","activeLink","computed","dep","excludedKeys","fn","isEncrypted","isLoading","subs","version"];class De extends d.Store{_className="StorePersister";_crypt;_excludedKeys;_persister;_propertiesToEncrypt;_watchedStore;constructor(e,s,r,n){super(e,s,r,n);const{crypt:o,persister:i,watchedStore:c}=s;this._excludedKeys=this.initExcludedKeys(),this.definePersister(i),this._propertiesToEncrypt=new Set(this.getPropertiesToEncrypt()),this._watchedStore=c,o&&(this._crypt=o,this.options&&(this.options.isEncrypted=!1)),this.augmentStore(),this.debugLog("StorePersister constructor",{toBeWatched:this.toBeWatched(),watchedStore:c,persister:i,store:e,options:s}),this.toBeWatched()&&(this._watchedStore.add(this.store.$id),this.storeSubscribe=this.storeSubscription.bind(this))}hydrate(){return typeof window>"u"?Promise.resolve(!1):this.remember()}augmentStore(){const{isEncrypted:e,persistedPropertiesToEncrypt:s,watchMutation:r}=this.options;e===void 0&&(this.options.isEncrypted=!1),s===void 0&&(this.options.persistedPropertiesToEncrypt=[]),r===void 0&&(this.options.watchMutation=!1),this.stateHas("isLoading")||this.addToState("isLoading",!1),this.store.persistState=async()=>await this.persist(),this.store.remember=async()=>await this.remember(),this.store.removePersistedState=this.removePersistedState.bind(this),this.store.watch=this.watch,this.store.stopWatch=this.stopWatch}async cryptProperty(e,s,r=!1){return r?await e.decrypt(s):await e.encrypt(s)}async cryptState(e,s=!1){return await new Promise(async r=>{const n=this._crypt,o=this.getPropertiesToEncrypt(),i=this.isEncrypted();if(this.debugLog(`cryptState - ${this.store.$id} ${s?"decrypt":"crypt"}`,{can:this._propertiesToEncrypt.size>0&&i===s&&!!n,Crypt:n,state:e}),this._propertiesToEncrypt.size>0&&n){const c={};for(const l of o){const f=this.getValue(e[l]);f&&(c[l]=await this.cryptProperty(n,f,s))}this.debugLog(`cryptState - ${this.store.$id}`,{encryptedState:c}),d.isEmpty(c)||(e={...e,...c},this.options&&(this.options.isEncrypted=!s))}r(e)})}static customizeStore(e,s,r,n){return!s.storeOptions?.persist&&s.storeOptions?.watchMutation&&(s.storeOptions.persist=!0),super.customizeStore(e,s,r,n)}definePersister(e){this._persister=this.options.dbName?new z({name:this.options.dbName,keyPath:"storeName"}):e}isEncrypted(){return this.options.isEncrypted}getPropertiesToEncrypt(){return this.options?.persistedPropertiesToEncrypt??[]}async getPersistedState(e=!0){const s=this.store.$id;try{let r=await this._persister.getItem(s);return e&&this.toBeCrypted()&&r&&(await this._crypt?.init(),r=await this.cryptState(r,!0)),this.debugLog(`getPersistedState ${s}`,{persistedState:r,state:this.state}),r}catch(r){this.logError("getPersistedState()",{storeName:s,e:r})}}async getStateToPersist(){const e=this._excludedKeys,s=this.state,r=this._propertiesToEncrypt.size>0,n=this._crypt;r&&await n.init();const o={};for(const i of Object.keys(s))if(!this.hasDeniedFirstChar(i[0])&&!e.has(i)){const c=s[i];d.isEmpty(c)||(r&&this._propertiesToEncrypt.has(i)?o[i]=await this.cryptProperty(n,c,!1):o[i]=w(c))}return o}getWatchMutation(){return this.options.watchMutation}static hasRequiredKeys(e){return!!e?.persist||!!e?.watchMutation}initExcludedKeys(){return new Set([...Pt,...this.options.excludedKeys??[]])}async persist(){const e=await this.getStateToPersist();this.debugLog(`persist() ${this.store.$id} - stateToPersist:`,{state:e}),d.isEmpty(e)||this._persister.setItem(this.store.$id,e)}propertyShouldBePersisted(e){return!this._excludedKeys.has(e)}async remember(){return this.state.isLoading=!0,new Promise(async e=>{let s=await this.getPersistedState();return s&&!d.isEmpty(s)&&this.store.$patch(s),this.state.isLoading=!1,e(!0)})}removePersistedState(){this._persister.removeItem(this.store.$id)}stopWatch(){this.options?.watchMutation&&(this.options&&(this.options.watchMutation=!1),this._watchedStore.delete(this.store.$id))}storeSubscription(e){this.debugLog(`store.storeSubscription() ${this.store.$id}`,["mutation type !== patch object: ",e.type!=="patch object","watchMutation: ",this.getWatchMutation(),"mutation:",e,"state:",this.state,"store:",this.store]),e.type!=="patch object"&&this.getWatchMutation()&&this.persist().then(()=>{this.store.mutationCallback&&this.store.mutationCallback(this.state,e)})}toBeCrypted(){return!!(this._crypt&&this.getPropertiesToEncrypt())}toBeWatched(){return!this._watchedStore.has(this.store.$id)}watch(){this.toBeWatched()&&(this.options&&(this.options.watchMutation=!0),this.storeSubscribe=this.storeSubscription.bind(this))}}class It extends d.PluginSubscriber{_resetStoreCallback=e=>{const{removePersistedState:s}=e;typeof s=="function"&&s()};constructor(){super(W,De.customizeStore.bind(De),P),this.execution={environment:"client",hydration:"immediate"},this.hydrationScheduler=e=>{Ge(()=>e())}}hydrate(){typeof window>"u"||this.hydrationScheduler?.(()=>{const e=this.storeInstance?.hydrate?.();e&&typeof e.catch=="function"&&e.catch(s=>this.logError(s))})}}const B=new It;function Ct(t,e){return B.pluginOptions=Tt(t,e),B}function Tt(t,e){let s,r;const n=new Set;try{if(typeof window<"u")return!d.isEmpty(t)&&t&&(s=new z({name:t,keyPath:"storeName"})),e&&(r=new R(e)),{persister:s,crypt:r,watchedStore:n}}catch{}return{persister:s,crypt:r,watchedStore:n}}function Vt(t,e){let s;return e&&(s=new R(e)),B.pluginOptions={persister:new ce({name:t}),crypt:s,watchedStore:new Set},B}_.PLUGIN_NAME=W,_.PersisterMock=ce,_.createPersistStatePlugin=Ct,_.createPluginMock=Vt,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinia-plugin-persist-state",
|
|
3
3
|
"description": "Pinia plugin for persisting store state",
|
|
4
|
-
"version": "0.1.0",
|
|
4
|
+
"version": "0.1.1-beta.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Alexandre Bidaud <alexbidaud85@gmail.com> (https://github.com/AlxBDo)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"coverage": "vitest run --coverage"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"pinia-plugin-subscription": "^0.1.1"
|
|
46
|
+
"pinia-plugin-subscription": "^0.1.6-beta.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"pinia": "^2.0.0 || ^3.0.0",
|