react-wire-persisted 1.0.6 → 1.2.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/dist/react-wire-persisted.js +717 -0
- package/dist/react-wire-persisted.min.js +1 -0
- package/es/react-wire-persisted.js +702 -0
- package/es/react-wire-persisted.mjs +1 -0
- package/lib/react-wire-persisted.js +802 -1
- package/package.json +9 -4
- package/src/index.ts +4 -0
- package/src/providers/LocalStorageProvider.js +152 -0
- package/src/providers/MemoryStorageProvider.js +20 -0
- package/src/providers/StorageProvider.js +102 -0
- package/src/react-wire-persisted.ts +115 -0
- package/src/utils/fakeLocalStorage.ts +14 -0
- package/src/utils/index.ts +20 -0
- package/src/utils/keys.ts +49 -0
- package/lib/utils/index.js +0 -1
package/package.json
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-wire-persisted",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"author": "Wesley Bliss <wesley.bliss@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/react-wire-persisted.js",
|
|
7
|
+
"unpkg": "dist/react-wire-persisted.js",
|
|
8
|
+
"module": "es/react-wire-persisted.js",
|
|
7
9
|
"files": [
|
|
8
|
-
"
|
|
10
|
+
"dist",
|
|
11
|
+
"lib",
|
|
12
|
+
"es",
|
|
13
|
+
"src"
|
|
9
14
|
],
|
|
10
15
|
"scripts": {
|
|
11
16
|
"dev": "NODE_ENV=development webpack serve --config config/webpack.config.js --progress",
|
|
12
|
-
"build": "NODE_ENV=production
|
|
17
|
+
"build": "NODE_ENV=production libton-script build",
|
|
13
18
|
"test": "jest",
|
|
14
19
|
"test:watch": "jest --watch",
|
|
15
20
|
"test:watch:all": "jest --watchAll",
|
|
@@ -31,13 +36,13 @@
|
|
|
31
36
|
"babel-jest": "^27.5.1",
|
|
32
37
|
"babel-loader": "^8.2.3",
|
|
33
38
|
"browserslist": "^4.19.3",
|
|
34
|
-
"clean-webpack-plugin": "^4.0.0",
|
|
35
39
|
"css-loader": "^6.6.0",
|
|
36
40
|
"dotenv-webpack": "^7.1.0",
|
|
37
41
|
"esbuild": "^0.14.23",
|
|
38
42
|
"html-webpack-plugin": "^5.5.0",
|
|
39
43
|
"interpolate-html-plugin": "^4.0.0",
|
|
40
44
|
"jest": "^27.5.1",
|
|
45
|
+
"libton-script": "^0.12.8",
|
|
41
46
|
"react": "^17.0.2",
|
|
42
47
|
"react-dom": "^17.0.2",
|
|
43
48
|
"snapshot-diff": "^0.9.0",
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import StorageProvider from './StorageProvider'
|
|
2
|
+
import { fakeLocalStorage, isPrimitive } from '../utils'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A storage provider for `localStorage`
|
|
6
|
+
* @see `StorageProvider.js` for documentation
|
|
7
|
+
*/
|
|
8
|
+
class LocalStorageProvider extends StorageProvider {
|
|
9
|
+
|
|
10
|
+
constructor(namespace = null, registry = {}) {
|
|
11
|
+
|
|
12
|
+
super(namespace, registry)
|
|
13
|
+
|
|
14
|
+
this.storage = this.getStorage()
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getStorage() {
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
return window.localStorage
|
|
22
|
+
} catch (e) {
|
|
23
|
+
/* istanbul ignore next */
|
|
24
|
+
console.warn('LocalStorageProvider: localStorage not supported')
|
|
25
|
+
/* istanbul ignore next */
|
|
26
|
+
return fakeLocalStorage
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setNamespace(namespace) {
|
|
32
|
+
|
|
33
|
+
if (!this.namespace) {
|
|
34
|
+
this.namespace = namespace
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (this.namespace === namespace)
|
|
39
|
+
return
|
|
40
|
+
|
|
41
|
+
const items = JSON.parse(JSON.stringify(this.getAll()))
|
|
42
|
+
|
|
43
|
+
this.removeAll()
|
|
44
|
+
|
|
45
|
+
for (const [key, value] of Object.entries(items)) {
|
|
46
|
+
const newKey = key.replace(this.namespace, namespace)
|
|
47
|
+
this.setItem(newKey, value)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
this.namespace = namespace
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
getItem(key) {
|
|
55
|
+
|
|
56
|
+
const val = this.storage.getItem(key)
|
|
57
|
+
|
|
58
|
+
if (val === undefined || val === null)
|
|
59
|
+
return null
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
return JSON.parse(val)
|
|
63
|
+
} catch (e) {
|
|
64
|
+
return val
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
setItem(key, value) {
|
|
70
|
+
|
|
71
|
+
let val = value
|
|
72
|
+
|
|
73
|
+
// Don't allow "null" & similar values to be stringified
|
|
74
|
+
if (val !== undefined && val !== null)
|
|
75
|
+
val = isPrimitive(value) ? value : JSON.stringify(value)
|
|
76
|
+
|
|
77
|
+
return this.storage.setItem(key, val)
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
removeItem(key, fromRegistry = false) {
|
|
82
|
+
|
|
83
|
+
if (fromRegistry)
|
|
84
|
+
delete this.registry[key]
|
|
85
|
+
|
|
86
|
+
return this.storage.removeItem(key)
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
getAll() {
|
|
91
|
+
|
|
92
|
+
const prefixNs = `${this.namespace}.`
|
|
93
|
+
|
|
94
|
+
return Object.keys(this.storage).reduce((acc, it) => {
|
|
95
|
+
|
|
96
|
+
if (this.namespace ? it.startsWith(prefixNs) : true)
|
|
97
|
+
acc[it] = this.storage.getItem(it)
|
|
98
|
+
|
|
99
|
+
return acc
|
|
100
|
+
|
|
101
|
+
}, {})
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
_resetAll(
|
|
106
|
+
useInitialValues = true,
|
|
107
|
+
excludedKeys = [],
|
|
108
|
+
clearRegistry = false
|
|
109
|
+
) {
|
|
110
|
+
|
|
111
|
+
const prefixNs = `${this.namespace}.`
|
|
112
|
+
|
|
113
|
+
Object.keys(localStorage).forEach(it => {
|
|
114
|
+
|
|
115
|
+
const isAppKey = this.namespace ? it.startsWith(prefixNs) : true
|
|
116
|
+
const isExcluded = excludedKeys?.includes(it) || false
|
|
117
|
+
|
|
118
|
+
if (!isAppKey || isExcluded) return
|
|
119
|
+
|
|
120
|
+
if (useInitialValues) {
|
|
121
|
+
|
|
122
|
+
const isRegistered = Object.prototype.hasOwnProperty.call(this.registry, it)
|
|
123
|
+
|
|
124
|
+
if (isRegistered)
|
|
125
|
+
this.storage.setItem(it, this.registry[it])
|
|
126
|
+
else
|
|
127
|
+
this.storage.removeItem(it)
|
|
128
|
+
|
|
129
|
+
} else {
|
|
130
|
+
|
|
131
|
+
this.storage.removeItem(it)
|
|
132
|
+
|
|
133
|
+
if (clearRegistry)
|
|
134
|
+
delete this.registry[it]
|
|
135
|
+
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
resetAll(excludedKeys = [], clearRegistry = false) {
|
|
143
|
+
this._resetAll(true, excludedKeys || [], clearRegistry)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
removeAll(excludedKeys = [], clearRegistry = false) {
|
|
147
|
+
this._resetAll(false, excludedKeys || [], clearRegistry)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export default LocalStorageProvider
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import LocalStorageProvider from './LocalStorageProvider'
|
|
2
|
+
import { fakeLocalStorage } from '../utils'
|
|
3
|
+
|
|
4
|
+
class MemoryStorageProvider extends LocalStorageProvider {
|
|
5
|
+
|
|
6
|
+
constructor(namespace = null, registry = {}) {
|
|
7
|
+
|
|
8
|
+
super(namespace, registry)
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
getStorage() {
|
|
13
|
+
|
|
14
|
+
return fakeLocalStorage
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default MemoryStorageProvider
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Base class to allow storage access
|
|
4
|
+
* @see `LocalStorageProvider.js` for an example implementation
|
|
5
|
+
*/
|
|
6
|
+
class StorageProvider {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Initializes the class
|
|
10
|
+
* @param {String} namespace Namespace to prefix all keys with. Mostly used for the logging & reset functions
|
|
11
|
+
* @param {Object} registry (Optional) Initialize the storage provider with an existing registry
|
|
12
|
+
*/
|
|
13
|
+
constructor(namespace, registry) {
|
|
14
|
+
|
|
15
|
+
// Simulate being an abstract class
|
|
16
|
+
if (new.target === StorageProvider)
|
|
17
|
+
throw TypeError(`StorageProvider is abstract. Extend this class to implement it`)
|
|
18
|
+
|
|
19
|
+
this.namespace = namespace || null
|
|
20
|
+
this.registry = registry || /* istanbul ignore next */ {}
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Sets the namespace for this storage provider, and migrates
|
|
26
|
+
* all stored values to the new namespace
|
|
27
|
+
* @param {String} namespace New namespace for this storage provider
|
|
28
|
+
*/
|
|
29
|
+
/* istanbul ignore next */
|
|
30
|
+
setNamespace(namespace) {}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Registers an item with it's initial value. This is used for logging, resetting, etc.
|
|
34
|
+
* @param {String} key Storage item's key
|
|
35
|
+
* @param {*} initialValue Storage item's initial value
|
|
36
|
+
*/
|
|
37
|
+
register(key, initialValue) {
|
|
38
|
+
this.registry[key] = initialValue
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Reads an item from storage
|
|
43
|
+
* @param {String} key Key for the item to retrieve
|
|
44
|
+
*/
|
|
45
|
+
/* istanbul ignore next */
|
|
46
|
+
getItem(key) {}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Stores a value
|
|
50
|
+
* @param {String} key Item's storage key
|
|
51
|
+
* @param {String} value Item's value to store
|
|
52
|
+
*/
|
|
53
|
+
/* istanbul ignore next */
|
|
54
|
+
setItem(key, value) {}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Removes an item from storage
|
|
58
|
+
* @param {String} key Item's storage key
|
|
59
|
+
* @param {Boolean} fromRegistry (Optional) If the item should also be removed from the registry
|
|
60
|
+
*/
|
|
61
|
+
/* istanbul ignore next */
|
|
62
|
+
removeItem(key, fromRegistry = false) {}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Gets all stored keys & values
|
|
66
|
+
* If a `namespace` was set, only keys prefixed with the namespace will be returned
|
|
67
|
+
*/
|
|
68
|
+
/* istanbul ignore next */
|
|
69
|
+
getAll() {}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* @param {Boolean} useInitialValues If values should be replaced with their initial values. If false, keys are removed
|
|
74
|
+
* @param {String[]} excludedKeys (Optional) List of keys to exclude
|
|
75
|
+
* @param {Boolean} clearRegistry (Optional) If the registry should also be cleared
|
|
76
|
+
*/
|
|
77
|
+
/* istanbul ignore next */
|
|
78
|
+
_resetAll(
|
|
79
|
+
useInitialValues = true,
|
|
80
|
+
excludedKeys = [],
|
|
81
|
+
clearRegistry = false
|
|
82
|
+
) {}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Resets all values to their initial values
|
|
86
|
+
* If a `namespace` is set, only keys prefixed with the namespace will be reset
|
|
87
|
+
* @param {String[]} excludedKeys (Optional) List of keys to exclude
|
|
88
|
+
*/
|
|
89
|
+
/* istanbul ignore next */
|
|
90
|
+
resetAll(excludedKeys = []) {}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Removes all items from local storage.
|
|
94
|
+
* If a `namespace` is set, only keys prefixed with the namespace will be removed
|
|
95
|
+
* @param {String[]} excludedKeys (Optional) List of keys to exclude
|
|
96
|
+
*/
|
|
97
|
+
/* istanbul ignore next */
|
|
98
|
+
removeAll(excludedKeys = []) {}
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export default StorageProvider
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { createWire } from '@forminator/react-wire'
|
|
2
|
+
import LocalStorageProvider from './providers/LocalStorageProvider'
|
|
3
|
+
|
|
4
|
+
export const defaultOptions = {
|
|
5
|
+
logging: {
|
|
6
|
+
enabled: false,
|
|
7
|
+
},
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let Provider = LocalStorageProvider
|
|
11
|
+
let storage = new Provider()
|
|
12
|
+
let options = { ...defaultOptions }
|
|
13
|
+
let pendingLogs = []
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Gets the namespace of the storage provider
|
|
17
|
+
*
|
|
18
|
+
* @returns {String}
|
|
19
|
+
*/
|
|
20
|
+
export const getNamespace = () => storage.namespace
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Gets the current storage provider class instance
|
|
24
|
+
*
|
|
25
|
+
* @returns {StorageProvider}
|
|
26
|
+
*/
|
|
27
|
+
export const getStorage = () => storage
|
|
28
|
+
|
|
29
|
+
export const getOptions = () => options
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Sets the namespace for the storage provider
|
|
33
|
+
*
|
|
34
|
+
* @param {String} namespace The namespace for the storage provider
|
|
35
|
+
*/
|
|
36
|
+
export const setNamespace = namespace => {
|
|
37
|
+
storage.setNamespace(namespace)
|
|
38
|
+
storage = new Provider(namespace || getNamespace())
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const setOptions = value => {
|
|
42
|
+
options = {
|
|
43
|
+
...options,
|
|
44
|
+
...value,
|
|
45
|
+
}
|
|
46
|
+
/* istanbul ignore next */
|
|
47
|
+
if (options.logging.enabled) {
|
|
48
|
+
console.info('Flushing', pendingLogs.length, 'pending logs')
|
|
49
|
+
while (pendingLogs.length)
|
|
50
|
+
/* istanbul ignore next */
|
|
51
|
+
console.log(...pendingLogs.shift())
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const log = (...args) => {
|
|
56
|
+
/* istanbul ignore next */
|
|
57
|
+
if (options.logging.enabled)
|
|
58
|
+
/* istanbul ignore next */
|
|
59
|
+
console.log(...args)
|
|
60
|
+
else
|
|
61
|
+
pendingLogs.push(args)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Creates a persisted Wire using the `StorageProvider` that is currently set
|
|
66
|
+
* Defaults to `localStorage` via `LocalStorageProvider`
|
|
67
|
+
*
|
|
68
|
+
* @param {String} key Unique key for storing this value
|
|
69
|
+
* @param {*} value Initial value of this Wire
|
|
70
|
+
* @returns A new Wire decorated with localStorage functionality
|
|
71
|
+
*/
|
|
72
|
+
export const createPersistedWire = (key, value = null) => {
|
|
73
|
+
|
|
74
|
+
// This check helps ensure no accidental key typos occur
|
|
75
|
+
if (!key && (typeof key) !== 'number') throw new Error(
|
|
76
|
+
`createPersistedWire: Key cannot be a falsey value (${key}}`
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
// Track this writable entry so we can easily clear all
|
|
80
|
+
storage.register(key, value)
|
|
81
|
+
|
|
82
|
+
// The actual Wire backing object
|
|
83
|
+
const wire = createWire(value)
|
|
84
|
+
|
|
85
|
+
const getValue = () => wire.getValue()
|
|
86
|
+
|
|
87
|
+
const setValue = newValue => {
|
|
88
|
+
storage.setItem(key, newValue)
|
|
89
|
+
return wire.setValue(newValue)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const subscribe = fn => {
|
|
93
|
+
wire.subscribe(fn)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const storedValue = storage.getItem(key)
|
|
97
|
+
const initialValue = storedValue === null ? value : storedValue
|
|
98
|
+
|
|
99
|
+
log('react-wire-persisted: create', key, {
|
|
100
|
+
value,
|
|
101
|
+
storedValue,
|
|
102
|
+
initialValue,
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
if (initialValue !== value)
|
|
106
|
+
setValue(initialValue)
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
...wire,
|
|
110
|
+
getValue,
|
|
111
|
+
setValue,
|
|
112
|
+
subscribe,
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
const storage = {
|
|
3
|
+
__IS_FAKE_LOCAL_STORAGE__: true,
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const fakeLocalStorage = {
|
|
7
|
+
getItem: key => fakeLocalStorage[key],
|
|
8
|
+
setItem: (key, value) => {
|
|
9
|
+
fakeLocalStorage[key] = value
|
|
10
|
+
},
|
|
11
|
+
removeItem: key => {
|
|
12
|
+
delete fakeLocalStorage[key]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from './keys'
|
|
2
|
+
export * from './fakeLocalStorage'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a value is a primitive type
|
|
6
|
+
*
|
|
7
|
+
* @param {*} val Value to check
|
|
8
|
+
* @returns {Boolean} True if value is a primitive type
|
|
9
|
+
*/
|
|
10
|
+
export const isPrimitive = val => {
|
|
11
|
+
|
|
12
|
+
const type = typeof val
|
|
13
|
+
|
|
14
|
+
if (val === null) return true
|
|
15
|
+
if (Array.isArray(val)) return false
|
|
16
|
+
if (type === 'object') return false
|
|
17
|
+
|
|
18
|
+
return type !== 'function'
|
|
19
|
+
|
|
20
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Convenience map of keys
|
|
4
|
+
*/
|
|
5
|
+
const storageKeys = {}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Adds a key to the keys map
|
|
9
|
+
*
|
|
10
|
+
* @param {String} value Key name
|
|
11
|
+
*/
|
|
12
|
+
export const addKey = value => {
|
|
13
|
+
storageKeys[value] = value
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Adds a key to the keys map
|
|
18
|
+
* (Alias for `addKey`)
|
|
19
|
+
*
|
|
20
|
+
* @param {String} value Key name
|
|
21
|
+
*/
|
|
22
|
+
export const key = value => addKey(value)
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Convenience method to get internally managed storage keys
|
|
26
|
+
*
|
|
27
|
+
* @returns {Object} Storage keys map
|
|
28
|
+
*/
|
|
29
|
+
export const getKeys = () => storageKeys
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Helper utility to prefix all keys in a map to use a namespace
|
|
33
|
+
*
|
|
34
|
+
* @param {String} namespace Storage namespace prefix
|
|
35
|
+
* @param {Object} keys (Optional) Storage key/values. Defaults to the internally managed keys map
|
|
36
|
+
*/
|
|
37
|
+
export const getPrefixedKeys = (namespace, keys = null) => {
|
|
38
|
+
|
|
39
|
+
const items = keys || storageKeys
|
|
40
|
+
|
|
41
|
+
if (!namespace)
|
|
42
|
+
return items
|
|
43
|
+
|
|
44
|
+
return Object.keys(items).reduce((acc, it) => ({
|
|
45
|
+
...acc,
|
|
46
|
+
[it]: `${namespace}.${items[it]}`,
|
|
47
|
+
}), {})
|
|
48
|
+
|
|
49
|
+
}
|
package/lib/utils/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,(function(){return(()=>{"use strict";var e={779:e=>{e.exports=require("@babel/runtime/helpers/defineProperty")}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{r.r(n),r.d(n,{addKey:()=>a,fakeLocalStorage:()=>y,getKeys:()=>s,getPrefixedKeys:()=>l,isPrimitive:()=>b,key:()=>p});const e=require("@babel/runtime/helpers/typeof");var t=r.n(e),o=r(779),i=r.n(o);function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var f={},a=function(e){f[e]=e},p=function(e){return a(e)},s=function(){return f},l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=t||f;return e?Object.keys(r).reduce((function(t,n){return u(u({},t),{},i()({},n,"".concat(e,".").concat(r[n])))}),{}):r},y={__IS_FAKE_LOCAL_STORAGE__:!0,getItem:function(e){return y[e]},setItem:function(e,t){y[e]=t},removeItem:function(e){delete y[e]}},b=function(e){var r=t()(e);return null===e||!Array.isArray(e)&&("object"!==r&&"function"!==r)}})(),n})()}));
|