atomaric 0.0.78 → 0.0.81
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/build/atomaric.js +812 -287
- package/build/atomaric.umd.cjs +1 -1
- package/package.json +2 -1
- package/types/index.d.ts +27 -20
package/build/atomaric.js
CHANGED
|
@@ -1,392 +1,917 @@
|
|
|
1
|
-
let
|
|
1
|
+
let Ye = () => {
|
|
2
2
|
throw "call configureAtomaric() before all!";
|
|
3
3
|
};
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
},
|
|
7
|
-
class
|
|
8
|
-
constructor(
|
|
9
|
-
if (
|
|
4
|
+
const T = {}, Ot = (e) => {
|
|
5
|
+
T.useSyncExternalStore = Ye = e.useSyncExternalStore, T.keyPathSeparator = e.keyPathSeparator, T.securifyKeyLevel = e.securifyKeyLevel, T.securifyValueLevel = e.securifyValueLevel;
|
|
6
|
+
}, lt = (e) => Ye(e.subscribe, e.get), dt = (e) => e.set, Bt = (e) => e.setDeferred, Wt = (e) => e.get, qt = (e) => e.do, Gt = (e) => [lt(e), dt(e)], Ht = (e, t) => new kt(e, t);
|
|
7
|
+
class F {
|
|
8
|
+
constructor(t) {
|
|
9
|
+
if (t)
|
|
10
10
|
return new Proxy(this, {
|
|
11
|
-
get: (
|
|
11
|
+
get: (r, n) => n in this ? r[n] : t[n]
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
var Qe = Symbol.for("immer-nothing"), Ue = Symbol.for("immer-draftable"), p = Symbol.for("immer-state"), ht = process.env.NODE_ENV !== "production" ? [
|
|
16
|
+
// All error codes, starting by 0:
|
|
17
|
+
function(e) {
|
|
18
|
+
return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
|
|
19
|
+
},
|
|
20
|
+
function(e) {
|
|
21
|
+
return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`;
|
|
22
|
+
},
|
|
23
|
+
"This object has been frozen and should not be mutated",
|
|
24
|
+
function(e) {
|
|
25
|
+
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
|
|
26
|
+
},
|
|
27
|
+
"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
|
|
28
|
+
"Immer forbids circular references",
|
|
29
|
+
"The first or second argument to `produce` must be a function",
|
|
30
|
+
"The third argument to `produce` must be a function or undefined",
|
|
31
|
+
"First argument to `createDraft` must be a plain object, an array, or an immerable object",
|
|
32
|
+
"First argument to `finishDraft` must be a draft returned by `createDraft`",
|
|
33
|
+
function(e) {
|
|
34
|
+
return `'current' expects a draft, got: ${e}`;
|
|
35
|
+
},
|
|
36
|
+
"Object.defineProperty() cannot be used on an Immer draft",
|
|
37
|
+
"Object.setPrototypeOf() cannot be used on an Immer draft",
|
|
38
|
+
"Immer only supports deleting array indices",
|
|
39
|
+
"Immer only supports setting array indices and the 'length' property",
|
|
40
|
+
function(e) {
|
|
41
|
+
return `'original' expects a draft, got: ${e}`;
|
|
42
|
+
}
|
|
43
|
+
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
44
|
+
// See Patches.ts for additional errors
|
|
45
|
+
] : [];
|
|
46
|
+
function g(e, ...t) {
|
|
47
|
+
if (process.env.NODE_ENV !== "production") {
|
|
48
|
+
const r = ht[e], n = v(r) ? r.apply(null, t) : r;
|
|
49
|
+
throw new Error(`[Immer] ${n}`);
|
|
50
|
+
}
|
|
51
|
+
throw new Error(
|
|
52
|
+
`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
var w = Object, O = w.getPrototypeOf, Z = "constructor", oe = "prototype", Pe = "configurable", ee = "enumerable", Y = "writable", W = "value", M = (e) => !!e && !!e[p];
|
|
56
|
+
function C(e) {
|
|
57
|
+
var t;
|
|
58
|
+
return e ? Xe(e) || ae(e) || !!e[Ue] || !!((t = e[Z]) != null && t[Ue]) || ue(e) || fe(e) : !1;
|
|
59
|
+
}
|
|
60
|
+
var _t = w[oe][Z].toString(), je = /* @__PURE__ */ new WeakMap();
|
|
61
|
+
function Xe(e) {
|
|
62
|
+
if (!e || !Fe(e))
|
|
63
|
+
return !1;
|
|
64
|
+
const t = O(e);
|
|
65
|
+
if (t === null || t === w[oe])
|
|
66
|
+
return !0;
|
|
67
|
+
const r = w.hasOwnProperty.call(t, Z) && t[Z];
|
|
68
|
+
if (r === Object)
|
|
69
|
+
return !0;
|
|
70
|
+
if (!v(r))
|
|
71
|
+
return !1;
|
|
72
|
+
let n = je.get(r);
|
|
73
|
+
return n === void 0 && (n = Function.toString.call(r), je.set(r, n)), n === _t;
|
|
74
|
+
}
|
|
75
|
+
function ce(e, t, r = !0) {
|
|
76
|
+
H(e) === 0 ? (r ? Reflect.ownKeys(e) : w.keys(e)).forEach((s) => {
|
|
77
|
+
t(s, e[s], e);
|
|
78
|
+
}) : e.forEach((n, s) => t(s, n, e));
|
|
79
|
+
}
|
|
80
|
+
function H(e) {
|
|
81
|
+
const t = e[p];
|
|
82
|
+
return t ? t.type_ : ae(e) ? 1 : ue(e) ? 2 : fe(e) ? 3 : 0;
|
|
83
|
+
}
|
|
84
|
+
var Oe = (e, t, r = H(e)) => r === 2 ? e.has(t) : w[oe].hasOwnProperty.call(e, t), Ae = (e, t, r = H(e)) => (
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
r === 2 ? e.get(t) : e[t]
|
|
87
|
+
), te = (e, t, r, n = H(e)) => {
|
|
88
|
+
n === 2 ? e.set(t, r) : n === 3 ? e.add(r) : e[t] = r;
|
|
89
|
+
};
|
|
90
|
+
function yt(e, t) {
|
|
91
|
+
return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
|
|
92
|
+
}
|
|
93
|
+
var ae = Array.isArray, ue = (e) => e instanceof Map, fe = (e) => e instanceof Set, Fe = (e) => typeof e == "object", v = (e) => typeof e == "function", we = (e) => typeof e == "boolean";
|
|
94
|
+
function pt(e) {
|
|
95
|
+
const t = +e;
|
|
96
|
+
return Number.isInteger(t) && String(t) === e;
|
|
97
|
+
}
|
|
98
|
+
var I = (e) => e.copy_ || e.base_, Ne = (e) => e.modified_ ? e.copy_ : e.base_;
|
|
99
|
+
function be(e, t) {
|
|
100
|
+
if (ue(e))
|
|
101
|
+
return new Map(e);
|
|
102
|
+
if (fe(e))
|
|
103
|
+
return new Set(e);
|
|
104
|
+
if (ae(e))
|
|
105
|
+
return Array[oe].slice.call(e);
|
|
106
|
+
const r = Xe(e);
|
|
107
|
+
if (t === !0 || t === "class_only" && !r) {
|
|
108
|
+
const n = w.getOwnPropertyDescriptors(e);
|
|
109
|
+
delete n[p];
|
|
110
|
+
let s = Reflect.ownKeys(n);
|
|
111
|
+
for (let i = 0; i < s.length; i++) {
|
|
112
|
+
const c = s[i], u = n[c];
|
|
113
|
+
u[Y] === !1 && (u[Y] = !0, u[Pe] = !0), (u.get || u.set) && (n[c] = {
|
|
114
|
+
[Pe]: !0,
|
|
115
|
+
[Y]: !0,
|
|
116
|
+
// could live with !!desc.set as well here...
|
|
117
|
+
[ee]: u[ee],
|
|
118
|
+
[W]: e[c]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return w.create(O(e), n);
|
|
122
|
+
} else {
|
|
123
|
+
const n = O(e);
|
|
124
|
+
if (n !== null && r)
|
|
125
|
+
return { ...e };
|
|
126
|
+
const s = w.create(n);
|
|
127
|
+
return w.assign(s, e);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function $e(e, t = !1) {
|
|
131
|
+
return le(e) || M(e) || !C(e) || (H(e) > 1 && w.defineProperties(e, {
|
|
132
|
+
set: K,
|
|
133
|
+
add: K,
|
|
134
|
+
clear: K,
|
|
135
|
+
delete: K
|
|
136
|
+
}), w.freeze(e), t && ce(
|
|
137
|
+
e,
|
|
138
|
+
(r, n) => {
|
|
139
|
+
$e(n, !0);
|
|
24
140
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
141
|
+
!1
|
|
142
|
+
)), e;
|
|
143
|
+
}
|
|
144
|
+
function mt() {
|
|
145
|
+
g(2);
|
|
146
|
+
}
|
|
147
|
+
var K = {
|
|
148
|
+
[W]: mt
|
|
28
149
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
150
|
+
function le(e) {
|
|
151
|
+
return e === null || !Fe(e) ? !0 : w.isFrozen(e);
|
|
152
|
+
}
|
|
153
|
+
var re = "MapSet", De = "Patches", Be = "ArrayMethods", Ze = {};
|
|
154
|
+
function E(e) {
|
|
155
|
+
const t = Ze[e];
|
|
156
|
+
return t || g(0, e), t;
|
|
157
|
+
}
|
|
158
|
+
var We = (e) => !!Ze[e], q, et = () => q, gt = (e, t) => ({
|
|
159
|
+
drafts_: [],
|
|
160
|
+
parent_: e,
|
|
161
|
+
immer_: t,
|
|
162
|
+
// Whenever the modified draft contains a draft from another scope, we
|
|
163
|
+
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
164
|
+
canAutoFreeze_: !0,
|
|
165
|
+
unfinalizedDrafts_: 0,
|
|
166
|
+
handledSet_: /* @__PURE__ */ new Set(),
|
|
167
|
+
processedForPatches_: /* @__PURE__ */ new Set(),
|
|
168
|
+
mapSetPlugin_: We(re) ? E(re) : void 0,
|
|
169
|
+
arrayMethodsPlugin_: We(Be) ? E(Be) : void 0
|
|
170
|
+
});
|
|
171
|
+
function qe(e, t) {
|
|
172
|
+
t && (e.patchPlugin_ = E(De), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
|
|
173
|
+
}
|
|
174
|
+
function Ie(e) {
|
|
175
|
+
Ce(e), e.drafts_.forEach(wt), e.drafts_ = null;
|
|
176
|
+
}
|
|
177
|
+
function Ce(e) {
|
|
178
|
+
e === q && (q = e.parent_);
|
|
179
|
+
}
|
|
180
|
+
var Ge = (e) => q = gt(q, e);
|
|
181
|
+
function wt(e) {
|
|
182
|
+
const t = e[p];
|
|
183
|
+
t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
|
|
184
|
+
}
|
|
185
|
+
function He(e, t) {
|
|
186
|
+
t.unfinalizedDrafts_ = t.drafts_.length;
|
|
187
|
+
const r = t.drafts_[0];
|
|
188
|
+
if (e !== void 0 && e !== r) {
|
|
189
|
+
r[p].modified_ && (Ie(t), g(4)), C(e) && (e = Je(t, e));
|
|
190
|
+
const { patchPlugin_: s } = t;
|
|
191
|
+
s && s.generateReplacementPatches_(
|
|
192
|
+
r[p].base_,
|
|
193
|
+
e,
|
|
194
|
+
t
|
|
195
|
+
);
|
|
196
|
+
} else
|
|
197
|
+
e = Je(t, r);
|
|
198
|
+
return St(t, e, !0), Ie(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Qe ? e : void 0;
|
|
199
|
+
}
|
|
200
|
+
function Je(e, t) {
|
|
201
|
+
if (le(t))
|
|
202
|
+
return t;
|
|
203
|
+
const r = t[p];
|
|
204
|
+
if (!r)
|
|
205
|
+
return ne(t, e.handledSet_, e);
|
|
206
|
+
if (!de(r, e))
|
|
207
|
+
return t;
|
|
208
|
+
if (!r.modified_)
|
|
209
|
+
return r.base_;
|
|
210
|
+
if (!r.finalized_) {
|
|
211
|
+
const { callbacks_: n } = r;
|
|
212
|
+
if (n)
|
|
213
|
+
for (; n.length > 0; )
|
|
214
|
+
n.pop()(e);
|
|
215
|
+
nt(r, e);
|
|
216
|
+
}
|
|
217
|
+
return r.copy_;
|
|
218
|
+
}
|
|
219
|
+
function St(e, t, r = !1) {
|
|
220
|
+
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && $e(t, r);
|
|
221
|
+
}
|
|
222
|
+
function tt(e) {
|
|
223
|
+
e.finalized_ = !0, e.scope_.unfinalizedDrafts_--;
|
|
224
|
+
}
|
|
225
|
+
var de = (e, t) => e.scope_ === t, Pt = [];
|
|
226
|
+
function rt(e, t, r, n) {
|
|
227
|
+
const s = I(e), i = e.type_;
|
|
228
|
+
if (n !== void 0 && Ae(s, n, i) === t) {
|
|
229
|
+
te(s, n, r, i);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (!e.draftLocations_) {
|
|
233
|
+
const u = e.draftLocations_ = /* @__PURE__ */ new Map();
|
|
234
|
+
ce(s, (h, d) => {
|
|
235
|
+
if (M(d)) {
|
|
236
|
+
const _ = u.get(d) || [];
|
|
237
|
+
_.push(h), u.set(d, _);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
const c = e.draftLocations_.get(t) ?? Pt;
|
|
242
|
+
for (const u of c)
|
|
243
|
+
te(s, u, r, i);
|
|
244
|
+
}
|
|
245
|
+
function At(e, t, r) {
|
|
246
|
+
e.callbacks_.push(function(s) {
|
|
247
|
+
var u;
|
|
248
|
+
const i = t;
|
|
249
|
+
if (!i || !de(i, s))
|
|
250
|
+
return;
|
|
251
|
+
(u = s.mapSetPlugin_) == null || u.fixSetContents(i);
|
|
252
|
+
const c = Ne(i);
|
|
253
|
+
rt(e, i.draft_ ?? i, c, r), nt(i, s);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function nt(e, t) {
|
|
257
|
+
var n;
|
|
258
|
+
if (e.modified_ && !e.finalized_ && (e.type_ === 3 || e.type_ === 1 && e.allIndicesReassigned_ || (((n = e.assigned_) == null ? void 0 : n.size) ?? 0) > 0)) {
|
|
259
|
+
const { patchPlugin_: s } = t;
|
|
260
|
+
if (s) {
|
|
261
|
+
const i = s.getPath(e);
|
|
262
|
+
i && s.generatePatches_(e, i, t);
|
|
263
|
+
}
|
|
264
|
+
tt(e);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
function bt(e, t, r) {
|
|
268
|
+
const { scope_: n } = e;
|
|
269
|
+
if (M(r)) {
|
|
270
|
+
const s = r[p];
|
|
271
|
+
de(s, n) && s.callbacks_.push(function() {
|
|
272
|
+
Q(e);
|
|
273
|
+
const c = Ne(s);
|
|
274
|
+
rt(e, r, c, t);
|
|
275
|
+
});
|
|
276
|
+
} else C(r) && e.callbacks_.push(function() {
|
|
277
|
+
const i = I(e);
|
|
278
|
+
e.type_ === 3 ? i.has(r) && ne(r, n.handledSet_, n) : Ae(i, t, e.type_) === r && n.drafts_.length > 1 && (e.assigned_.get(t) ?? !1) === !0 && e.copy_ && ne(
|
|
279
|
+
Ae(e.copy_, t, e.type_),
|
|
280
|
+
n.handledSet_,
|
|
281
|
+
n
|
|
282
|
+
);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function ne(e, t, r) {
|
|
286
|
+
return !r.immer_.autoFreeze_ && r.unfinalizedDrafts_ < 1 || M(e) || t.has(e) || !C(e) || le(e) || (t.add(e), ce(e, (n, s) => {
|
|
287
|
+
if (M(s)) {
|
|
288
|
+
const i = s[p];
|
|
289
|
+
if (de(i, r)) {
|
|
290
|
+
const c = Ne(i);
|
|
291
|
+
te(e, n, c, e.type_), tt(i);
|
|
292
|
+
}
|
|
293
|
+
} else C(s) && ne(s, t, r);
|
|
294
|
+
})), e;
|
|
295
|
+
}
|
|
296
|
+
function Dt(e, t) {
|
|
297
|
+
const r = ae(e), n = {
|
|
298
|
+
type_: r ? 1 : 0,
|
|
299
|
+
// Track which produce call this is associated with.
|
|
300
|
+
scope_: t ? t.scope_ : et(),
|
|
301
|
+
// True for both shallow and deep changes.
|
|
302
|
+
modified_: !1,
|
|
303
|
+
// Used during finalization.
|
|
304
|
+
finalized_: !1,
|
|
305
|
+
// Track which properties have been assigned (true) or deleted (false).
|
|
306
|
+
// actually instantiated in `prepareCopy()`
|
|
307
|
+
assigned_: void 0,
|
|
308
|
+
// The parent draft state.
|
|
309
|
+
parent_: t,
|
|
310
|
+
// The base state.
|
|
311
|
+
base_: e,
|
|
312
|
+
// The base proxy.
|
|
313
|
+
draft_: null,
|
|
314
|
+
// set below
|
|
315
|
+
// The base copy with any updated values.
|
|
316
|
+
copy_: null,
|
|
317
|
+
// Called by the `produce` function.
|
|
318
|
+
revoke_: null,
|
|
319
|
+
isManual_: !1,
|
|
320
|
+
// `callbacks` actually gets assigned in `createProxy`
|
|
321
|
+
callbacks_: void 0
|
|
322
|
+
};
|
|
323
|
+
let s = n, i = se;
|
|
324
|
+
r && (s = [n], i = G);
|
|
325
|
+
const { revoke: c, proxy: u } = Proxy.revocable(s, i);
|
|
326
|
+
return n.draft_ = u, n.revoke_ = c, [u, n];
|
|
327
|
+
}
|
|
328
|
+
var se = {
|
|
329
|
+
get(e, t) {
|
|
330
|
+
if (t === p)
|
|
331
|
+
return e;
|
|
332
|
+
let r = e.scope_.arrayMethodsPlugin_;
|
|
333
|
+
const n = e.type_ === 1 && typeof t == "string";
|
|
334
|
+
if (n && r != null && r.isArrayOperationMethod(t))
|
|
335
|
+
return r.createMethodInterceptor(e, t);
|
|
336
|
+
const s = I(e);
|
|
337
|
+
if (!Oe(s, t, e.type_))
|
|
338
|
+
return It(e, s, t);
|
|
339
|
+
const i = s[t];
|
|
340
|
+
if (e.finalized_ || !C(i) || n && e.operationMethod && (r != null && r.isMutatingArrayMethod(
|
|
341
|
+
e.operationMethod
|
|
342
|
+
)) && pt(t))
|
|
343
|
+
return i;
|
|
344
|
+
if (i === Se(e.base_, t)) {
|
|
345
|
+
Q(e);
|
|
346
|
+
const c = e.type_ === 1 ? +t : t, u = ze(e.scope_, i, e, c);
|
|
347
|
+
return e.copy_[c] = u;
|
|
348
|
+
}
|
|
349
|
+
return i;
|
|
350
|
+
},
|
|
351
|
+
has(e, t) {
|
|
352
|
+
return t in I(e);
|
|
353
|
+
},
|
|
354
|
+
ownKeys(e) {
|
|
355
|
+
return Reflect.ownKeys(I(e));
|
|
356
|
+
},
|
|
357
|
+
set(e, t, r) {
|
|
358
|
+
const n = st(I(e), t);
|
|
359
|
+
if (n != null && n.set)
|
|
360
|
+
return n.set.call(e.draft_, r), !0;
|
|
361
|
+
if (!e.modified_) {
|
|
362
|
+
const s = Se(I(e), t), i = s == null ? void 0 : s[p];
|
|
363
|
+
if (i && i.base_ === r)
|
|
364
|
+
return e.copy_[t] = r, e.assigned_.set(t, !1), !0;
|
|
365
|
+
if (yt(r, s) && (r !== void 0 || Oe(e.base_, t, e.type_)))
|
|
366
|
+
return !0;
|
|
367
|
+
Q(e), Me(e);
|
|
368
|
+
}
|
|
369
|
+
return e.copy_[t] === r && // special case: handle new props with value 'undefined'
|
|
370
|
+
(r !== void 0 || t in e.copy_) || // special case: NaN
|
|
371
|
+
Number.isNaN(r) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = r, e.assigned_.set(t, !0), bt(e, t, r)), !0;
|
|
372
|
+
},
|
|
373
|
+
deleteProperty(e, t) {
|
|
374
|
+
return Q(e), Se(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_.set(t, !1), Me(e)) : e.assigned_.delete(t), e.copy_ && delete e.copy_[t], !0;
|
|
375
|
+
},
|
|
376
|
+
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
377
|
+
// the same guarantee in ES5 mode.
|
|
378
|
+
getOwnPropertyDescriptor(e, t) {
|
|
379
|
+
const r = I(e), n = Reflect.getOwnPropertyDescriptor(r, t);
|
|
380
|
+
return n && {
|
|
381
|
+
[Y]: !0,
|
|
382
|
+
[Pe]: e.type_ !== 1 || t !== "length",
|
|
383
|
+
[ee]: n[ee],
|
|
384
|
+
[W]: r[t]
|
|
48
385
|
};
|
|
386
|
+
},
|
|
387
|
+
defineProperty() {
|
|
388
|
+
g(11);
|
|
389
|
+
},
|
|
390
|
+
getPrototypeOf(e) {
|
|
391
|
+
return O(e.base_);
|
|
392
|
+
},
|
|
393
|
+
setPrototypeOf() {
|
|
394
|
+
g(12);
|
|
49
395
|
}
|
|
396
|
+
}, G = {};
|
|
397
|
+
for (let e in se) {
|
|
398
|
+
let t = se[e];
|
|
399
|
+
G[e] = function() {
|
|
400
|
+
const r = arguments;
|
|
401
|
+
return r[0] = r[0][0], t.apply(this, r);
|
|
402
|
+
};
|
|
50
403
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
404
|
+
G.deleteProperty = function(e, t) {
|
|
405
|
+
return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && g(13), G.set.call(this, e, t, void 0);
|
|
406
|
+
};
|
|
407
|
+
G.set = function(e, t, r) {
|
|
408
|
+
return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && g(14), se.set.call(this, e[0], t, r, e[0]);
|
|
409
|
+
};
|
|
410
|
+
function Se(e, t) {
|
|
411
|
+
const r = e[p];
|
|
412
|
+
return (r ? I(r) : e)[t];
|
|
413
|
+
}
|
|
414
|
+
function It(e, t, r) {
|
|
415
|
+
var s;
|
|
416
|
+
const n = st(t, r);
|
|
417
|
+
return n ? W in n ? n[W] : (
|
|
418
|
+
// This is a very special case, if the prop is a getter defined by the
|
|
419
|
+
// prototype, we should invoke it with the draft as context!
|
|
420
|
+
(s = n.get) == null ? void 0 : s.call(e.draft_)
|
|
421
|
+
) : void 0;
|
|
422
|
+
}
|
|
423
|
+
function st(e, t) {
|
|
424
|
+
if (!(t in e))
|
|
425
|
+
return;
|
|
426
|
+
let r = O(e);
|
|
427
|
+
for (; r; ) {
|
|
428
|
+
const n = Object.getOwnPropertyDescriptor(r, t);
|
|
429
|
+
if (n)
|
|
430
|
+
return n;
|
|
431
|
+
r = O(r);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function Me(e) {
|
|
435
|
+
e.modified_ || (e.modified_ = !0, e.parent_ && Me(e.parent_));
|
|
436
|
+
}
|
|
437
|
+
function Q(e) {
|
|
438
|
+
e.copy_ || (e.assigned_ = /* @__PURE__ */ new Map(), e.copy_ = be(
|
|
439
|
+
e.base_,
|
|
440
|
+
e.scope_.immer_.useStrictShallowCopy_
|
|
441
|
+
));
|
|
442
|
+
}
|
|
443
|
+
var Ct = class {
|
|
444
|
+
constructor(e) {
|
|
445
|
+
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !1, this.produce = (t, r, n) => {
|
|
446
|
+
if (v(t) && !v(r)) {
|
|
447
|
+
const i = r;
|
|
448
|
+
r = t;
|
|
449
|
+
const c = this;
|
|
450
|
+
return function(h = i, ...d) {
|
|
451
|
+
return c.produce(h, (_) => r.call(this, _, ...d));
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
v(r) || g(6), n !== void 0 && !v(n) && g(7);
|
|
455
|
+
let s;
|
|
456
|
+
if (C(t)) {
|
|
457
|
+
const i = Ge(this), c = ze(i, t, void 0);
|
|
458
|
+
let u = !0;
|
|
459
|
+
try {
|
|
460
|
+
s = r(c), u = !1;
|
|
461
|
+
} finally {
|
|
462
|
+
u ? Ie(i) : Ce(i);
|
|
463
|
+
}
|
|
464
|
+
return qe(i, n), He(s, i);
|
|
465
|
+
} else if (!t || !Fe(t)) {
|
|
466
|
+
if (s = r(t), s === void 0 && (s = t), s === Qe && (s = void 0), this.autoFreeze_ && $e(s, !0), n) {
|
|
467
|
+
const i = [], c = [];
|
|
468
|
+
E(De).generateReplacementPatches_(t, s, {
|
|
469
|
+
patches_: i,
|
|
470
|
+
inversePatches_: c
|
|
471
|
+
}), n(i, c);
|
|
472
|
+
}
|
|
473
|
+
return s;
|
|
474
|
+
} else
|
|
475
|
+
g(1, t);
|
|
476
|
+
}, this.produceWithPatches = (t, r) => {
|
|
477
|
+
if (v(t))
|
|
478
|
+
return (c, ...u) => this.produceWithPatches(c, (h) => t(h, ...u));
|
|
479
|
+
let n, s;
|
|
480
|
+
return [this.produce(t, r, (c, u) => {
|
|
481
|
+
n = c, s = u;
|
|
482
|
+
}), n, s];
|
|
483
|
+
}, we(e == null ? void 0 : e.autoFreeze) && this.setAutoFreeze(e.autoFreeze), we(e == null ? void 0 : e.useStrictShallowCopy) && this.setUseStrictShallowCopy(e.useStrictShallowCopy), we(e == null ? void 0 : e.useStrictIteration) && this.setUseStrictIteration(e.useStrictIteration);
|
|
484
|
+
}
|
|
485
|
+
createDraft(e) {
|
|
486
|
+
C(e) || g(8), M(e) && (e = Mt(e));
|
|
487
|
+
const t = Ge(this), r = ze(t, e, void 0);
|
|
488
|
+
return r[p].isManual_ = !0, Ce(t), r;
|
|
489
|
+
}
|
|
490
|
+
finishDraft(e, t) {
|
|
491
|
+
const r = e && e[p];
|
|
492
|
+
(!r || !r.isManual_) && g(9);
|
|
493
|
+
const { scope_: n } = r;
|
|
494
|
+
return qe(n, t), He(void 0, n);
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Pass true to automatically freeze all copies created by Immer.
|
|
498
|
+
*
|
|
499
|
+
* By default, auto-freezing is enabled.
|
|
500
|
+
*/
|
|
501
|
+
setAutoFreeze(e) {
|
|
502
|
+
this.autoFreeze_ = e;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Pass true to enable strict shallow copy.
|
|
506
|
+
*
|
|
507
|
+
* By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
|
|
508
|
+
*/
|
|
509
|
+
setUseStrictShallowCopy(e) {
|
|
510
|
+
this.useStrictShallowCopy_ = e;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Pass false to use faster iteration that skips non-enumerable properties
|
|
514
|
+
* but still handles symbols for compatibility.
|
|
515
|
+
*
|
|
516
|
+
* By default, strict iteration is enabled (includes all own properties).
|
|
517
|
+
*/
|
|
518
|
+
setUseStrictIteration(e) {
|
|
519
|
+
this.useStrictIteration_ = e;
|
|
520
|
+
}
|
|
521
|
+
shouldUseStrictIteration() {
|
|
522
|
+
return this.useStrictIteration_;
|
|
523
|
+
}
|
|
524
|
+
applyPatches(e, t) {
|
|
525
|
+
let r;
|
|
526
|
+
for (r = t.length - 1; r >= 0; r--) {
|
|
527
|
+
const s = t[r];
|
|
528
|
+
if (s.path.length === 0 && s.op === "replace") {
|
|
529
|
+
e = s.value;
|
|
530
|
+
break;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
r > -1 && (t = t.slice(r + 1));
|
|
534
|
+
const n = E(De).applyPatches_;
|
|
535
|
+
return M(e) ? n(e, t) : this.produce(
|
|
536
|
+
e,
|
|
537
|
+
(s) => n(s, t)
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
function ze(e, t, r, n) {
|
|
542
|
+
const [s, i] = ue(t) ? E(re).proxyMap_(t, r) : fe(t) ? E(re).proxySet_(t, r) : Dt(t, r);
|
|
543
|
+
return ((r == null ? void 0 : r.scope_) ?? et()).drafts_.push(s), i.callbacks_ = (r == null ? void 0 : r.callbacks_) ?? [], i.key_ = n, r && n !== void 0 ? At(r, i, n) : i.callbacks_.push(function(h) {
|
|
544
|
+
var _;
|
|
545
|
+
(_ = h.mapSetPlugin_) == null || _.fixSetContents(i);
|
|
546
|
+
const { patchPlugin_: d } = h;
|
|
547
|
+
i.modified_ && d && d.generatePatches_(i, [], h);
|
|
548
|
+
}), s;
|
|
549
|
+
}
|
|
550
|
+
function Mt(e) {
|
|
551
|
+
return M(e) || g(10, e), it(e);
|
|
552
|
+
}
|
|
553
|
+
function it(e) {
|
|
554
|
+
if (!C(e) || le(e))
|
|
555
|
+
return e;
|
|
556
|
+
const t = e[p];
|
|
557
|
+
let r, n = !0;
|
|
558
|
+
if (t) {
|
|
559
|
+
if (!t.modified_)
|
|
560
|
+
return t.base_;
|
|
561
|
+
t.finalized_ = !0, r = be(e, t.scope_.immer_.useStrictShallowCopy_), n = t.scope_.immer_.shouldUseStrictIteration();
|
|
562
|
+
} else
|
|
563
|
+
r = be(e, !0);
|
|
564
|
+
return ce(
|
|
565
|
+
r,
|
|
566
|
+
(s, i) => {
|
|
567
|
+
te(r, s, it(i));
|
|
568
|
+
},
|
|
569
|
+
n
|
|
570
|
+
), t && (t.finalized_ = !1), r;
|
|
571
|
+
}
|
|
572
|
+
var zt = new Ct(), ot = zt.produce;
|
|
573
|
+
class xt extends F {
|
|
574
|
+
constructor(t, r) {
|
|
575
|
+
super(r), this.a = t, this.push = (...n) => {
|
|
576
|
+
n.length !== 0 && this.a.set(this.a.get().concat(n));
|
|
577
|
+
}, this.unshift = (...n) => {
|
|
578
|
+
n.length !== 0 && this.a.set(n.concat(this.a.get()));
|
|
579
|
+
}, this.update = (n) => {
|
|
580
|
+
const s = this.a.get(), i = ot(s, (c) => void n(c));
|
|
581
|
+
i !== s && this.a.set(i);
|
|
582
|
+
}, this.filter = (n) => {
|
|
583
|
+
const s = this.a.get().filter(n ?? vt);
|
|
584
|
+
s.length !== this.a.get().length && this.a.set(s);
|
|
585
|
+
}, this.add = (n) => {
|
|
586
|
+
this.a.get().includes(n) || this.a.set(this.a.get().concat([n]));
|
|
587
|
+
}, this.removeFirst = (n) => {
|
|
588
|
+
const s = this.a.get().indexOf(n);
|
|
589
|
+
if (s < 0) return;
|
|
590
|
+
const i = this.a.get().slice(0);
|
|
591
|
+
i.splice(s, 1), this.a.set(i);
|
|
592
|
+
}, this.toggle = (n, s) => {
|
|
593
|
+
const i = this.a.get().slice(), c = i.indexOf(n);
|
|
594
|
+
c < 0 ? s ? i.unshift(n) : i.push(n) : i.splice(c, 1), this.a.set(i);
|
|
73
595
|
};
|
|
74
596
|
}
|
|
75
597
|
}
|
|
76
|
-
const
|
|
77
|
-
class
|
|
78
|
-
constructor(
|
|
79
|
-
super(
|
|
598
|
+
const vt = (e) => e;
|
|
599
|
+
class Tt extends F {
|
|
600
|
+
constructor(t, r) {
|
|
601
|
+
super(r), this.a = t, this.toggle = () => {
|
|
80
602
|
this.a.set(!this.a.get());
|
|
81
603
|
};
|
|
82
604
|
}
|
|
83
605
|
}
|
|
84
|
-
class
|
|
85
|
-
constructor(
|
|
86
|
-
super(
|
|
87
|
-
if (this.a.get().get(
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
}, this.setIfNo = (
|
|
91
|
-
if (this.a.get().has(
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
}, this.delete = (
|
|
95
|
-
if (!this.a.get().has(
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
}, this.toggle = (
|
|
99
|
-
const
|
|
100
|
-
|
|
606
|
+
class Et extends F {
|
|
607
|
+
constructor(t, r) {
|
|
608
|
+
super(r), this.a = t, this.setValue = (n, s) => {
|
|
609
|
+
if (this.a.get().get(n) === s) return;
|
|
610
|
+
const i = new Map(this.a.get());
|
|
611
|
+
i.set(n, s), this.a.set(i);
|
|
612
|
+
}, this.setIfNo = (n, s) => {
|
|
613
|
+
if (this.a.get().has(n)) return;
|
|
614
|
+
const i = new Map(this.a.get());
|
|
615
|
+
i.set(n, s), this.a.set(i);
|
|
616
|
+
}, this.delete = (n) => {
|
|
617
|
+
if (!this.a.get().has(n)) return;
|
|
618
|
+
const s = new Map(this.a.get());
|
|
619
|
+
s.delete(n), this.a.set(s);
|
|
620
|
+
}, this.toggle = (n, s) => {
|
|
621
|
+
const i = new Map(this.a.get());
|
|
622
|
+
i.has(n) ? i.delete(n) : i.set(n, s), this.a.set(i);
|
|
101
623
|
}, this.clear = () => {
|
|
102
624
|
this.a.set(/* @__PURE__ */ new Map());
|
|
103
|
-
}, this.a =
|
|
625
|
+
}, this.a = t;
|
|
104
626
|
}
|
|
105
627
|
}
|
|
106
|
-
class
|
|
107
|
-
constructor(
|
|
108
|
-
super(
|
|
109
|
-
this.a.set(+this.a.get() + (
|
|
628
|
+
class Ft extends F {
|
|
629
|
+
constructor(t, r) {
|
|
630
|
+
super(r), this.a = t, this.increment = (n) => {
|
|
631
|
+
this.a.set(+this.a.get() + (n ?? 1));
|
|
110
632
|
};
|
|
111
633
|
}
|
|
112
634
|
}
|
|
113
|
-
class
|
|
114
|
-
constructor(
|
|
115
|
-
super(
|
|
116
|
-
...
|
|
117
|
-
...typeof
|
|
118
|
-
})), this.update = (
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
}, this.setDeepPartial = (s,
|
|
122
|
-
if (!
|
|
123
|
-
if (
|
|
124
|
-
let
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
let
|
|
129
|
-
for (const
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
133
|
-
if (
|
|
134
|
-
const
|
|
135
|
-
this.a.get()[
|
|
635
|
+
class Nt extends F {
|
|
636
|
+
constructor(t, r) {
|
|
637
|
+
super(r), this.a = t, this.setPartial = (n) => this.a.set((s) => ({
|
|
638
|
+
...s,
|
|
639
|
+
...typeof n == "function" ? n(this.a.get()) : n
|
|
640
|
+
})), this.update = (n) => {
|
|
641
|
+
const s = this.a.get(), i = ot(s, (c) => void n(c));
|
|
642
|
+
i !== s && this.a.set(i);
|
|
643
|
+
}, this.setDeepPartial = (n, s, i, c = T.keyPathSeparator || ".") => {
|
|
644
|
+
if (!c) return;
|
|
645
|
+
if (n.includes(c)) {
|
|
646
|
+
let d = n.split(c);
|
|
647
|
+
const _ = d[d.length - 1];
|
|
648
|
+
d = d.slice(0, -1);
|
|
649
|
+
const z = { ...this.a.get() };
|
|
650
|
+
let S = z, y = i;
|
|
651
|
+
for (const N of d) {
|
|
652
|
+
y = y == null ? void 0 : y[Array.isArray(y) ? "0" : N];
|
|
653
|
+
const m = S[Ke(S, N)] ?? (Array.isArray(y) ? [] : {});
|
|
654
|
+
if (m == null || typeof m != "object") {
|
|
655
|
+
if (i == null) throw "Incorrect path for setDeepPartial";
|
|
656
|
+
const J = typeof s == "function" ? s(void 0) : s;
|
|
657
|
+
this.a.get()[n] !== J && this.setPartial({ [n]: J });
|
|
136
658
|
return;
|
|
137
659
|
}
|
|
138
|
-
|
|
660
|
+
S = S[Ke(S, N)] = Array.isArray(m) ? [...m] : { ...m };
|
|
139
661
|
}
|
|
140
|
-
const
|
|
141
|
-
|
|
662
|
+
const A = S[_];
|
|
663
|
+
S[_] = typeof s == "function" ? s(S[_]) : s, A !== S[_] && this.a.set(z);
|
|
142
664
|
return;
|
|
143
665
|
}
|
|
144
|
-
const
|
|
145
|
-
|
|
666
|
+
const u = this.a.get()[n], h = typeof s == "function" ? s(u) : s;
|
|
667
|
+
h !== u && this.setPartial({ [n]: h });
|
|
146
668
|
};
|
|
147
669
|
}
|
|
148
670
|
}
|
|
149
|
-
const
|
|
150
|
-
class
|
|
151
|
-
constructor(
|
|
152
|
-
super(
|
|
153
|
-
this.a.get().has(
|
|
154
|
-
}, this.delete = (
|
|
155
|
-
if (!this.a.get().has(
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
}, this.toggle = (
|
|
159
|
-
const
|
|
160
|
-
|
|
671
|
+
const Ke = (e, t) => Array.isArray(e) ? `${+t}` : t;
|
|
672
|
+
class $t extends F {
|
|
673
|
+
constructor(t, r) {
|
|
674
|
+
super(r), this.a = t, this.add = (n) => {
|
|
675
|
+
this.a.get().has(n) || this.a.set(new Set(this.a.get()).add(n));
|
|
676
|
+
}, this.delete = (n) => {
|
|
677
|
+
if (!this.a.get().has(n)) return;
|
|
678
|
+
const s = new Set(this.a.get());
|
|
679
|
+
s.delete(n), this.a.set(s);
|
|
680
|
+
}, this.toggle = (n) => {
|
|
681
|
+
const s = new Set(this.a.get());
|
|
682
|
+
s.has(n) ? s.delete(n) : s.add(n), this.a.set(s);
|
|
161
683
|
}, this.clear = () => {
|
|
162
684
|
this.a.set(/* @__PURE__ */ new Set());
|
|
163
|
-
}, this.a =
|
|
685
|
+
}, this.a = t;
|
|
164
686
|
}
|
|
165
687
|
}
|
|
166
|
-
const
|
|
167
|
-
const
|
|
168
|
-
(
|
|
169
|
-
() =>
|
|
170
|
-
|
|
171
|
-
(
|
|
172
|
-
) : null,
|
|
173
|
-
return
|
|
688
|
+
const Rt = (e, t, r) => {
|
|
689
|
+
const n = typeof r == "object" && r != null && "do" in r ? r.do(
|
|
690
|
+
(i, c) => t.set(i, c),
|
|
691
|
+
() => t.get(),
|
|
692
|
+
t,
|
|
693
|
+
(i, c, u) => t.setDeferred(i, c, u)
|
|
694
|
+
) : null, s = {};
|
|
695
|
+
return n && Object.keys(n).forEach((i) => Object.defineProperty(s, i, { get: () => n[i] })), typeof e == "number" ? new Ft(t, n) : typeof e == "boolean" ? new Tt(t, n) : Array.isArray(e) ? new xt(t, n) : e instanceof Set ? new $t(t, n) : e instanceof Map ? new Et(t, n) : e instanceof Object ? new Nt(t, n) : new F(n);
|
|
174
696
|
};
|
|
175
|
-
class
|
|
176
|
-
constructor(
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
let
|
|
180
|
-
},
|
|
181
|
-
const
|
|
182
|
-
return
|
|
697
|
+
class kt {
|
|
698
|
+
constructor(t, r) {
|
|
699
|
+
t = typeof t == "function" ? t() : t;
|
|
700
|
+
const n = (o) => _ = o, s = () => _, i = /* @__PURE__ */ new Set(), c = (o) => o(y());
|
|
701
|
+
let u = !0, h = !1, d = () => !0, _ = t, z, S = () => {
|
|
702
|
+
}, y = () => s(), A = null, N = () => {
|
|
703
|
+
const o = Rt(t, m, r);
|
|
704
|
+
return N = () => o, o;
|
|
183
705
|
};
|
|
184
|
-
const
|
|
185
|
-
get: (
|
|
186
|
-
set:
|
|
187
|
-
}),
|
|
188
|
-
|
|
706
|
+
const m = new Proxy(this, {
|
|
707
|
+
get: (o, l) => l === "do" ? N() : o[l],
|
|
708
|
+
set: Lt
|
|
709
|
+
}), J = () => {
|
|
710
|
+
u = !0, h !== !0 && S(y()), h = !1;
|
|
189
711
|
try {
|
|
190
|
-
|
|
712
|
+
xe.postMessage({ key: f, value: s() });
|
|
191
713
|
} catch {
|
|
192
714
|
}
|
|
193
|
-
},
|
|
194
|
-
const
|
|
195
|
-
|
|
715
|
+
}, $ = (o, l) => {
|
|
716
|
+
const b = typeof o == "function" ? o(y()) : o;
|
|
717
|
+
b === y() || !d(b, y()) || (n(b), h = l, u && (u = !1, i.forEach(c), queueMicrotask(J)));
|
|
196
718
|
};
|
|
197
|
-
this.set = (
|
|
198
|
-
|
|
719
|
+
this.set = (o, l) => $(o, l), this.get = () => y(), this.initialValue = t, this.isInitialValue = () => t === s(), this.subscribe = (o) => (i.add(o), () => {
|
|
720
|
+
i.delete(o);
|
|
199
721
|
}), this.reset = () => {
|
|
200
|
-
|
|
722
|
+
$(t, !0);
|
|
201
723
|
};
|
|
202
|
-
const
|
|
203
|
-
|
|
724
|
+
const ft = (o, l) => {
|
|
725
|
+
$(o, l), z = void 0;
|
|
204
726
|
};
|
|
205
|
-
if (this.setDeferred = (
|
|
206
|
-
|
|
207
|
-
},
|
|
208
|
-
let
|
|
209
|
-
if (
|
|
210
|
-
throw console.error(
|
|
211
|
-
} :
|
|
212
|
-
if (
|
|
727
|
+
if (this.setDeferred = (o, l = 500, b, D = !0) => {
|
|
728
|
+
D && z === void 0 && $(o, b), clearTimeout(z), z = setTimeout(ft, l, o, b);
|
|
729
|
+
}, r == null) return m;
|
|
730
|
+
let P = null, B = null, _e = !0, ye = !0, pe = !1, x = 0, R = 0, Re = -1, k = t instanceof Set ? (o) => new Set(o) : t instanceof Map ? (o) => new Map(o) : (o) => o, L = t instanceof Set ? (o) => {
|
|
731
|
+
if (o instanceof Set) return Array.from(o);
|
|
732
|
+
throw console.error(o), "The value is not Set instance";
|
|
733
|
+
} : t instanceof Map ? (o) => {
|
|
734
|
+
if (o instanceof Map) {
|
|
213
735
|
const l = [];
|
|
214
|
-
return
|
|
736
|
+
return o.forEach((b, D) => l.push([D, b])), l;
|
|
215
737
|
}
|
|
216
|
-
throw console.error(
|
|
217
|
-
} : (
|
|
218
|
-
if (typeof
|
|
219
|
-
|
|
220
|
-
else if ("
|
|
221
|
-
|
|
222
|
-
else return
|
|
223
|
-
const
|
|
224
|
-
if (
|
|
225
|
-
const
|
|
226
|
-
|
|
738
|
+
throw console.error(o), "The value is not Set instance";
|
|
739
|
+
} : (o) => o;
|
|
740
|
+
if (typeof r == "string")
|
|
741
|
+
P = r;
|
|
742
|
+
else if (d = r.filter ?? d, "storageKey" in r)
|
|
743
|
+
_e = r.warnOnDuplicateStorageKey ?? _e, ye = r.listenStorageChanges ?? ye, P = r.storageKey, k = r.unzipValue ?? k, L = r.zipValue ?? L, pe = r.unchangable ?? pe, x = r.securifyKeyLevel ?? T.securifyKeyLevel ?? x, R = r.securifyValueLevel ?? T.securifyValueLevel ?? R, B = r.exp ?? B;
|
|
744
|
+
else return m;
|
|
745
|
+
const me = x ? V(P, x) : P, f = `${R ? ve : U}${me}`;
|
|
746
|
+
if (x) {
|
|
747
|
+
const o = `${U}${P}`;
|
|
748
|
+
o in a && (a[f] = a[o], delete a[o]);
|
|
227
749
|
} else {
|
|
228
|
-
const
|
|
229
|
-
|
|
750
|
+
const o = `${U}${V(P, x)}`;
|
|
751
|
+
o in a && (a[f] = a[o], delete a[o]);
|
|
230
752
|
}
|
|
231
|
-
const
|
|
232
|
-
if (
|
|
233
|
-
const
|
|
234
|
-
if (
|
|
753
|
+
const ge = B === null || !(B(m, f in a) instanceof Date) ? (o) => V([L(o)], 0) : (o) => (A ?? (A = {}), A.exp = B(m, f in a).getTime(), A.exp - Date.now() < 24 * 60 * 60 * 1e3 && (clearTimeout(Re), clearTimeout(ct[f]), Re = setTimeout(() => this.reset(), A.exp - Date.now())), A.exp = Math.trunc(A.exp / 1e3), V([L(o), A], 0));
|
|
754
|
+
if (R) {
|
|
755
|
+
const o = `${U}${me}`, l = L, b = k;
|
|
756
|
+
if (L = (D) => {
|
|
235
757
|
try {
|
|
236
|
-
return
|
|
758
|
+
return V([l(D)], R);
|
|
237
759
|
} catch {
|
|
238
|
-
return delete
|
|
760
|
+
return delete a[f], "";
|
|
239
761
|
}
|
|
240
|
-
},
|
|
241
|
-
const
|
|
762
|
+
}, o in a) {
|
|
763
|
+
const D = `${U}${V(P, x)}`;
|
|
242
764
|
try {
|
|
243
|
-
|
|
765
|
+
a[D] = ge(k(X(a[o], 0)[0])), delete a[o];
|
|
244
766
|
} catch {
|
|
245
767
|
}
|
|
246
768
|
}
|
|
247
|
-
|
|
769
|
+
k = (D) => {
|
|
248
770
|
try {
|
|
249
|
-
return
|
|
771
|
+
return b(X(D, R)[0]);
|
|
250
772
|
} catch {
|
|
251
|
-
return delete
|
|
773
|
+
return delete a[f], "";
|
|
252
774
|
}
|
|
253
775
|
};
|
|
254
|
-
} else delete
|
|
255
|
-
const
|
|
256
|
-
const l =
|
|
257
|
-
return
|
|
776
|
+
} else delete a[`${ve}${me}`];
|
|
777
|
+
const ke = (o) => {
|
|
778
|
+
const l = X(o, 0);
|
|
779
|
+
return A = l[1], k(l[0]);
|
|
258
780
|
};
|
|
259
|
-
let
|
|
260
|
-
if (
|
|
261
|
-
if (
|
|
262
|
-
|
|
781
|
+
let Le = !0;
|
|
782
|
+
if (Te[f] = m, a[`atom/${P}`] && (a[f] || (a[f] = `[${a[`atom/${P}`]}]`), delete a[`atom/${P}`]), y = () => {
|
|
783
|
+
if (y = s, Le) {
|
|
784
|
+
Le = !1;
|
|
263
785
|
try {
|
|
264
|
-
|
|
786
|
+
n(f in a ? ke(a[f]) : t);
|
|
265
787
|
} catch {
|
|
266
|
-
console.warn("Invalid json value",
|
|
788
|
+
console.warn("Invalid json value", a[f]);
|
|
267
789
|
}
|
|
268
790
|
}
|
|
269
|
-
return
|
|
270
|
-
},
|
|
271
|
-
if (
|
|
791
|
+
return s();
|
|
792
|
+
}, S = (o) => {
|
|
793
|
+
if (o === t) {
|
|
272
794
|
this.reset();
|
|
273
795
|
return;
|
|
274
796
|
}
|
|
275
|
-
|
|
797
|
+
a[f] = ge(o);
|
|
276
798
|
}, this.reset = () => {
|
|
277
|
-
delete
|
|
278
|
-
},
|
|
279
|
-
if (
|
|
280
|
-
let
|
|
281
|
-
|
|
282
|
-
clearTimeout(l), l = setTimeout(() =>
|
|
799
|
+
delete a[f], $(t, !0);
|
|
800
|
+
}, _e && j[f] !== void 0 && console.warn("Duplicate Atom key", P), ye)
|
|
801
|
+
if (pe) {
|
|
802
|
+
let o = !1, l;
|
|
803
|
+
he[f] = this, j[f] = () => {
|
|
804
|
+
clearTimeout(l), l = setTimeout(() => o = !1, 10), !o && (o = !0, a[f] = ge(s()));
|
|
283
805
|
};
|
|
284
806
|
} else
|
|
285
|
-
|
|
286
|
-
if (
|
|
807
|
+
j[f] = (o) => {
|
|
808
|
+
if (o.newValue === null) {
|
|
287
809
|
this.reset();
|
|
288
810
|
return;
|
|
289
811
|
}
|
|
290
812
|
try {
|
|
291
|
-
|
|
813
|
+
$(ke(o.newValue));
|
|
292
814
|
} catch {
|
|
293
|
-
console.warn("Invalid json value",
|
|
815
|
+
console.warn("Invalid json value", o.newValue);
|
|
294
816
|
}
|
|
295
817
|
};
|
|
296
|
-
return
|
|
818
|
+
return m;
|
|
297
819
|
}
|
|
298
820
|
}
|
|
299
|
-
let
|
|
821
|
+
let xe;
|
|
300
822
|
try {
|
|
301
|
-
|
|
302
|
-
var
|
|
303
|
-
(
|
|
823
|
+
xe = new BroadcastChannel("updateHere"), xe.addEventListener("message", (e) => {
|
|
824
|
+
var t;
|
|
825
|
+
(t = he[e.data.key]) == null || t.set(e.data.value, !0);
|
|
304
826
|
});
|
|
305
827
|
} catch {
|
|
306
828
|
}
|
|
307
|
-
const
|
|
308
|
-
throw `${
|
|
829
|
+
const a = localStorage, j = {}, he = {}, Lt = (e, t) => {
|
|
830
|
+
throw `${t} is readonly property`;
|
|
309
831
|
};
|
|
310
|
-
window.addEventListener("storage", (
|
|
311
|
-
var
|
|
312
|
-
|
|
832
|
+
window.addEventListener("storage", (e) => {
|
|
833
|
+
var t;
|
|
834
|
+
e.key === null || e.newValue === e.oldValue || (t = j[e.key]) == null || t.call(j, e);
|
|
313
835
|
});
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
836
|
+
const Vt = a.setItem.bind(a), Ut = a.removeItem.bind(a);
|
|
837
|
+
a.setItem = (e, t) => {
|
|
838
|
+
he[e] === void 0 && Vt.call(a, e, t);
|
|
317
839
|
};
|
|
318
|
-
|
|
319
|
-
|
|
840
|
+
a.removeItem = (e) => {
|
|
841
|
+
he[e] === void 0 && Ut.call(a, e);
|
|
320
842
|
};
|
|
321
|
-
const
|
|
322
|
-
for (let
|
|
323
|
-
if (
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
}
|
|
327
|
-
const
|
|
328
|
-
const
|
|
329
|
-
(
|
|
330
|
-
(
|
|
331
|
-
(
|
|
332
|
-
const
|
|
333
|
-
return `${
|
|
843
|
+
const jt = /"exp":\s*(\d+)/, U = "atom\\", ve = "atom`s\\", Te = {}, ct = {}, at = /[a-z]/gi, ie = 5, Ee = {};
|
|
844
|
+
for (let e = 54; e < 80; e++) {
|
|
845
|
+
if (e === 68 || e === 72 || e === 55) continue;
|
|
846
|
+
const t = String.fromCharCode(e + 43).toUpperCase(), r = String.fromCharCode(e + 43).toLowerCase();
|
|
847
|
+
Ee[t] = r, Ee[r] = t;
|
|
848
|
+
}
|
|
849
|
+
const ut = (e) => Ee[e] ?? e, V = /* @__PURE__ */ (() => {
|
|
850
|
+
const e = [
|
|
851
|
+
(t) => JSON.stringify(t),
|
|
852
|
+
(t) => btoa(encodeURI(e[0](t))),
|
|
853
|
+
(t) => {
|
|
854
|
+
const r = e[1](t);
|
|
855
|
+
return `${r.slice(0, ie)}${r.slice(ie).replace(at, ut)}`;
|
|
334
856
|
},
|
|
335
|
-
(
|
|
857
|
+
(t) => btoa(e[2](t))
|
|
336
858
|
];
|
|
337
|
-
return (
|
|
859
|
+
return (t, r) => {
|
|
338
860
|
try {
|
|
339
|
-
return
|
|
340
|
-
} catch (
|
|
341
|
-
if (
|
|
342
|
-
return
|
|
861
|
+
return e[r](t);
|
|
862
|
+
} catch (n) {
|
|
863
|
+
if (r === 0) throw n;
|
|
864
|
+
return e[0](t);
|
|
343
865
|
}
|
|
344
866
|
};
|
|
345
|
-
})(),
|
|
346
|
-
const
|
|
347
|
-
(
|
|
348
|
-
(
|
|
349
|
-
(
|
|
350
|
-
`${
|
|
867
|
+
})(), X = /* @__PURE__ */ (() => {
|
|
868
|
+
const e = [
|
|
869
|
+
(t) => JSON.parse(t),
|
|
870
|
+
(t) => e[0](decodeURI(atob(t))),
|
|
871
|
+
(t) => e[1](
|
|
872
|
+
`${t.slice(0, ie)}${t.slice(ie).replace(at, ut)}`
|
|
351
873
|
),
|
|
352
|
-
(
|
|
874
|
+
(t) => e[2](atob(t))
|
|
353
875
|
];
|
|
354
|
-
return (
|
|
876
|
+
return (t, r) => {
|
|
355
877
|
try {
|
|
356
|
-
return
|
|
357
|
-
} catch (
|
|
358
|
-
if (
|
|
359
|
-
return
|
|
878
|
+
return e[r](t);
|
|
879
|
+
} catch (n) {
|
|
880
|
+
if (r === 0) throw n;
|
|
881
|
+
return e[0](t);
|
|
360
882
|
}
|
|
361
883
|
};
|
|
362
884
|
})();
|
|
363
885
|
setTimeout(() => {
|
|
364
|
-
Object.keys(
|
|
365
|
-
var
|
|
366
|
-
if (typeof
|
|
367
|
-
const
|
|
368
|
-
if (!
|
|
369
|
-
const
|
|
370
|
-
!Array.isArray(
|
|
371
|
-
|
|
372
|
-
|
|
886
|
+
Object.keys(a).forEach((e) => {
|
|
887
|
+
var n;
|
|
888
|
+
if (typeof a[e] != "string" || !e.startsWith(U) && !e.startsWith(ve)) return;
|
|
889
|
+
const t = (n = a[e].match(jt)) == null ? void 0 : n[1];
|
|
890
|
+
if (!t || +t * 1e3 - Date.now() > 24 * 60 * 60 * 1e3) return;
|
|
891
|
+
const r = X(a[e], 0);
|
|
892
|
+
!Array.isArray(r) || r[1] == null || !("exp" in r[1]) || r[1].exp !== t || (ct[e] = setTimeout(
|
|
893
|
+
() => {
|
|
894
|
+
Te[e] ? Te[e].reset() : delete a[e];
|
|
895
|
+
},
|
|
896
|
+
+t * 1e3 - Date.now()
|
|
897
|
+
));
|
|
373
898
|
});
|
|
374
899
|
}, 1e3);
|
|
375
900
|
export {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
901
|
+
kt as Atom,
|
|
902
|
+
xt as AtomArrayDoActions,
|
|
903
|
+
Tt as AtomBooleanDoActions,
|
|
904
|
+
Et as AtomMapDoActions,
|
|
905
|
+
Ft as AtomNumberDoActions,
|
|
906
|
+
Nt as AtomObjectDoActions,
|
|
907
|
+
$t as AtomSetDoActions,
|
|
908
|
+
Ht as atom,
|
|
909
|
+
Ot as configureAtomaric,
|
|
910
|
+
T as configuredOptions,
|
|
911
|
+
Gt as useAtom,
|
|
912
|
+
qt as useAtomDo,
|
|
913
|
+
Wt as useAtomGet,
|
|
914
|
+
dt as useAtomSet,
|
|
915
|
+
Bt as useAtomSetDeferred,
|
|
916
|
+
lt as useAtomValue
|
|
392
917
|
};
|