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 CHANGED
@@ -1,392 +1,917 @@
1
- let k = () => {
1
+ let Ye = () => {
2
2
  throw "call configureAtomaric() before all!";
3
3
  };
4
- const _ = {}, Se = (t) => {
5
- _.useSyncExternalStore = k = t.useSyncExternalStore, _.keyPathSeparator = t.keyPathSeparator, _.securifyKeyLevel = t.securifyKeyLevel, _.securifyValueLevel = t.securifyValueLevel;
6
- }, ne = (t) => k(t.subscribe, t.get), ie = (t) => t.set, xe = (t) => t.setDeferred, be = (t) => t.get, De = (t) => t.do, $e = (t) => [ne(t), ie(t)], _e = (t, e) => new pe(t, e);
7
- class V {
8
- constructor(e) {
9
- if (e)
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: (i, s) => s in this ? i[s] : e[s]
11
+ get: (r, n) => n in this ? r[n] : t[n]
12
12
  });
13
13
  }
14
14
  }
15
- const ce = (t, e) => {
16
- const i = (s, n, c) => new Proxy(s, {
17
- get: (a, d, p) => {
18
- const w = c === 0 && e.get != null ? e.get(a, d, p) : a[d], f = w ?? (Array.isArray(a) ? [] : {});
19
- return typeof f == "object" && f !== null ? i(
20
- Array.isArray(f) ? f.slice(0) : { ...f },
21
- n.concat(Array.isArray(a) ? +d : d),
22
- c + 1
23
- ) : f;
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
- set: (a, d, p) => (e.onSet(a, n, d, p, a[d]) && (a[d] = p), !0)
26
- });
27
- return i(t, [], 0);
141
+ !1
142
+ )), e;
143
+ }
144
+ function mt() {
145
+ g(2);
146
+ }
147
+ var K = {
148
+ [W]: mt
28
149
  };
29
- class O extends V {
30
- constructor() {
31
- super(...arguments), this.updateValue = (e, i) => {
32
- const s = Array.isArray(e) ? e.slice(0) : { ...e };
33
- let n = !1;
34
- return i(
35
- ce(s, {
36
- onSet: (c, a, d, p, w) => {
37
- if (p === w) return !0;
38
- let f = s;
39
- n = !0;
40
- for (const b of a) {
41
- const h = f[b];
42
- f = f[b] = Array.isArray(h) ? h.slice() : { ...h };
43
- }
44
- return f[d] = p, !0;
45
- }
46
- })
47
- ), n ? s : e;
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
- class oe extends O {
52
- constructor(e, i) {
53
- super(i), this.a = e, this.push = (...s) => {
54
- s.length !== 0 && this.a.set(this.a.get().concat(s));
55
- }, this.unshift = (...s) => {
56
- s.length !== 0 && this.a.set(s.concat(this.a.get()));
57
- }, this.update = (s) => {
58
- const n = this.a.get(), c = this.updateValue(n, s);
59
- c !== n && this.a.set(c);
60
- }, this.filter = (s) => {
61
- const n = this.a.get().filter(s ?? ae);
62
- n.length !== this.a.get().length && this.a.set(n);
63
- }, this.add = (s) => {
64
- this.a.get().includes(s) || this.a.set(this.a.get().concat([s]));
65
- }, this.removeFirst = (s) => {
66
- const n = this.a.get().indexOf(s);
67
- if (n < 0) return;
68
- const c = this.a.get().slice(0);
69
- c.splice(n, 1), this.a.set(c);
70
- }, this.toggle = (s, n) => {
71
- const c = this.a.get().slice(), a = c.indexOf(s);
72
- a < 0 ? n ? c.unshift(s) : c.push(s) : c.splice(a, 1), this.a.set(c);
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 ae = (t) => t;
77
- class ue extends V {
78
- constructor(e, i) {
79
- super(i), this.a = e, this.toggle = () => {
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 le extends V {
85
- constructor(e, i) {
86
- super(i), this.a = e, this.setValue = (s, n) => {
87
- if (this.a.get().get(s) === n) return;
88
- const c = new Map(this.a.get());
89
- c.set(s, n), this.a.set(c);
90
- }, this.setIfNo = (s, n) => {
91
- if (this.a.get().has(s)) return;
92
- const c = new Map(this.a.get());
93
- c.set(s, n), this.a.set(c);
94
- }, this.delete = (s) => {
95
- if (!this.a.get().has(s)) return;
96
- const n = new Map(this.a.get());
97
- n.delete(s), this.a.set(n);
98
- }, this.toggle = (s, n) => {
99
- const c = new Map(this.a.get());
100
- c.has(s) ? c.delete(s) : c.set(s, n), this.a.set(c);
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 = e;
625
+ }, this.a = t;
104
626
  }
105
627
  }
106
- class fe extends V {
107
- constructor(e, i) {
108
- super(i), this.a = e, this.increment = (s) => {
109
- this.a.set(+this.a.get() + (s ?? 1));
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 he extends O {
114
- constructor(e, i) {
115
- super(i), this.a = e, this.setPartial = (s) => this.a.set((n) => ({
116
- ...n,
117
- ...typeof s == "function" ? s(this.a.get()) : s
118
- })), this.update = (s) => {
119
- const n = this.a.get(), c = this.updateValue(n, s);
120
- c !== n && this.a.set(c);
121
- }, this.setDeepPartial = (s, n, c, a = _.keyPathSeparator || ".") => {
122
- if (!a) return;
123
- if (s.includes(a)) {
124
- let w = s.split(a);
125
- const f = w[w.length - 1];
126
- w = w.slice(0, -1);
127
- const b = { ...this.a.get() };
128
- let h = b, g = c;
129
- for (const y of w) {
130
- g = g == null ? void 0 : g[Array.isArray(g) ? "0" : y];
131
- const D = h[v(h, y)] ?? (Array.isArray(g) ? [] : {});
132
- if (D == null || typeof D != "object") {
133
- if (c == null) throw "Incorrect path for setDeepPartial";
134
- const m = typeof n == "function" ? n(void 0) : n;
135
- this.a.get()[s] !== m && this.setPartial({ [s]: m });
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
- h = h[v(h, y)] = Array.isArray(D) ? [...D] : { ...D };
660
+ S = S[Ke(S, N)] = Array.isArray(m) ? [...m] : { ...m };
139
661
  }
140
- const E = h[f];
141
- h[f] = typeof n == "function" ? n(h[f]) : n, E !== h[f] && this.a.set(b);
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 d = this.a.get()[s], p = typeof n == "function" ? n(d) : n;
145
- p !== d && this.setPartial({ [s]: p });
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 v = (t, e) => Array.isArray(t) ? `${+e}` : e;
150
- class de extends V {
151
- constructor(e, i) {
152
- super(i), this.a = e, this.add = (s) => {
153
- this.a.get().has(s) || this.a.set(new Set(this.a.get()).add(s));
154
- }, this.delete = (s) => {
155
- if (!this.a.get().has(s)) return;
156
- const n = new Set(this.a.get());
157
- n.delete(s), this.a.set(n);
158
- }, this.toggle = (s) => {
159
- const n = new Set(this.a.get());
160
- n.has(s) ? n.delete(s) : n.add(s), this.a.set(n);
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 = e;
685
+ }, this.a = t;
164
686
  }
165
687
  }
166
- const ge = (t, e, i) => {
167
- const s = typeof i == "object" && i != null && "do" in i ? i.do(
168
- (c, a) => e.set(c, a),
169
- () => e.get(),
170
- e,
171
- (c, a, d) => e.setDeferred(c, a, d)
172
- ) : null, n = {};
173
- return s && Object.keys(s).forEach((c) => Object.defineProperty(n, c, { get: () => s[c] })), typeof t == "number" ? new fe(e, s) : typeof t == "boolean" ? new ue(e, s) : Array.isArray(t) ? new oe(e, s) : t instanceof Set ? new de(e, s) : t instanceof Map ? new le(e, s) : t instanceof Object ? new he(e, s) : new V(s);
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 pe {
176
- constructor(e, i) {
177
- e = typeof e == "function" ? e() : e;
178
- const s = (r) => w = r, n = () => w, c = /* @__PURE__ */ new Set(), a = (r) => r(h());
179
- let d = !0, p = !1, w = e, f, b = () => {
180
- }, h = () => n(), g = null, E = () => {
181
- const r = ge(e, y, i);
182
- return E = () => r, r;
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 y = new Proxy(this, {
185
- get: (r, l) => l === "do" ? E() : r[l],
186
- set: we
187
- }), D = () => {
188
- d = !0, p !== !0 && b(h()), p = !1;
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
- H.postMessage({ key: u, value: n() });
712
+ xe.postMessage({ key: f, value: s() });
191
713
  } catch {
192
714
  }
193
- }, m = (r, l) => {
194
- const S = typeof r == "function" ? r(h()) : r;
195
- S !== h() && (s(S), p = l, d && (d = !1, c.forEach(a), queueMicrotask(D)));
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 = (r, l) => m(r, l), this.get = () => h(), this.initialValue = e, this.isInitialValue = () => e === n(), this.subscribe = (r) => (c.add(r), () => {
198
- c.delete(r);
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
- m(e, !0);
722
+ $(t, !0);
201
723
  };
202
- const re = (r, l) => {
203
- m(r, l), f = void 0;
724
+ const ft = (o, l) => {
725
+ $(o, l), z = void 0;
204
726
  };
205
- if (this.setDeferred = (r, l = 500, S, x = !0) => {
206
- x && f === void 0 && m(r, S), clearTimeout(f), f = setTimeout(re, l, r, S);
207
- }, i == null) return y;
208
- let A = null, j = null, q = !0, F = !0, N = !1, $ = 0, M = 0, K = -1, T = e instanceof Set ? (r) => new Set(r) : e instanceof Map ? (r) => new Map(r) : (r) => r, I = e instanceof Set ? (r) => {
209
- if (r instanceof Set) return Array.from(r);
210
- throw console.error(r), "The value is not Set instance";
211
- } : e instanceof Map ? (r) => {
212
- if (r instanceof Map) {
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 r.forEach((S, x) => l.push([x, S])), l;
736
+ return o.forEach((b, D) => l.push([D, b])), l;
215
737
  }
216
- throw console.error(r), "The value is not Set instance";
217
- } : (r) => r;
218
- if (typeof i == "string")
219
- A = i;
220
- else if ("storeKey" in i)
221
- q = i.warnOnDuplicateStoreKey ?? q, F = i.listenStorageChanges ?? F, A = i.storeKey, T = i.unzipValue ?? T, I = i.zipValue ?? I, N = i.unchangable ?? N, $ = i.securifyKeyLevel ?? _.securifyKeyLevel ?? $, M = i.securifyValueLevel ?? _.securifyValueLevel ?? M, j = i.exp ?? j;
222
- else return y;
223
- const B = $ ? L(A, $) : A, u = `${M ? J : C}${B}`;
224
- if ($) {
225
- const r = `${C}${A}`;
226
- r in o && (o[u] = o[r], delete o[r]);
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 r = `${C}${L(A, $)}`;
229
- r in o && (o[u] = o[r], delete o[r]);
750
+ const o = `${U}${V(P, x)}`;
751
+ o in a && (a[f] = a[o], delete a[o]);
230
752
  }
231
- const W = j === null || !(j(y, u in o) instanceof Date) ? (r) => L([I(r)], 0) : (r) => (g ?? (g = {}), g.exp = j(y, u in o).getTime(), g.exp - Date.now() < 24 * 60 * 60 * 1e3 && (clearTimeout(K), clearTimeout(ee[u]), K = setTimeout(() => this.reset(), g.exp - Date.now())), g.exp = Math.trunc(g.exp / 1e3), L([I(r), g], 0));
232
- if (M) {
233
- const r = `${C}${B}`, l = I, S = T;
234
- if (I = (x) => {
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 L([l(x)], M);
758
+ return V([l(D)], R);
237
759
  } catch {
238
- return delete o[u], "";
760
+ return delete a[f], "";
239
761
  }
240
- }, r in o) {
241
- const x = `${C}${L(A, $)}`;
762
+ }, o in a) {
763
+ const D = `${U}${V(P, x)}`;
242
764
  try {
243
- o[x] = W(T(z(o[r], 0)[0])), delete o[r];
765
+ a[D] = ge(k(X(a[o], 0)[0])), delete a[o];
244
766
  } catch {
245
767
  }
246
768
  }
247
- T = (x) => {
769
+ k = (D) => {
248
770
  try {
249
- return S(z(x, M)[0]);
771
+ return b(X(D, R)[0]);
250
772
  } catch {
251
- return delete o[u], "";
773
+ return delete a[f], "";
252
774
  }
253
775
  };
254
- } else delete o[`${J}${B}`];
255
- const X = (r) => {
256
- const l = z(r, 0);
257
- return g = l[1], T(l[0]);
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 Y = !0;
260
- if (G[u] = y, o[`atom/${A}`] && (o[u] || (o[u] = `[${o[`atom/${A}`]}]`), delete o[`atom/${A}`]), h = () => {
261
- if (h = n, Y) {
262
- Y = !1;
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
- s(u in o ? X(o[u]) : e);
786
+ n(f in a ? ke(a[f]) : t);
265
787
  } catch {
266
- console.warn("Invalid json value", o[u]);
788
+ console.warn("Invalid json value", a[f]);
267
789
  }
268
790
  }
269
- return n();
270
- }, b = (r) => {
271
- if (r === e) {
791
+ return s();
792
+ }, S = (o) => {
793
+ if (o === t) {
272
794
  this.reset();
273
795
  return;
274
796
  }
275
- o[u] = W(r);
797
+ a[f] = ge(o);
276
798
  }, this.reset = () => {
277
- delete o[u], m(e, !0);
278
- }, q && P[u] !== void 0 && console.warn("Duplicate Atom key", A), F)
279
- if (N) {
280
- let r = !1, l;
281
- U[u] = this, P[u] = () => {
282
- clearTimeout(l), l = setTimeout(() => r = !1, 10), !r && (r = !0, o[u] = W(n()));
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
- P[u] = (r) => {
286
- if (r.newValue === null) {
807
+ j[f] = (o) => {
808
+ if (o.newValue === null) {
287
809
  this.reset();
288
810
  return;
289
811
  }
290
812
  try {
291
- m(X(r.newValue));
813
+ $(ke(o.newValue));
292
814
  } catch {
293
- console.warn("Invalid json value", r.newValue);
815
+ console.warn("Invalid json value", o.newValue);
294
816
  }
295
817
  };
296
- return y;
818
+ return m;
297
819
  }
298
820
  }
299
- let H;
821
+ let xe;
300
822
  try {
301
- H = new BroadcastChannel("updateHere"), H.addEventListener("message", (t) => {
302
- var e;
303
- (e = U[t.data.key]) == null || e.set(t.data.value, !0);
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 o = localStorage, P = {}, U = {}, we = (t, e) => {
308
- throw `${e} is readonly property`;
829
+ const a = localStorage, j = {}, he = {}, Lt = (e, t) => {
830
+ throw `${t} is readonly property`;
309
831
  };
310
- window.addEventListener("storage", (t) => {
311
- var e;
312
- t.key === null || t.newValue === t.oldValue || (e = P[t.key]) == null || e.call(P, t);
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 ye = o.setItem.bind(o), Ae = o.removeItem.bind(o);
315
- o.setItem = (t, e) => {
316
- U[t] === void 0 && ye.call(o, t, e);
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
- o.removeItem = (t) => {
319
- U[t] === void 0 && Ae.call(o, t);
840
+ a.removeItem = (e) => {
841
+ he[e] === void 0 && Ut.call(a, e);
320
842
  };
321
- const me = /"exp":\s*(\d+)/, C = "atom\\", J = "atom`s\\", G = {}, ee = {}, te = /[a-z]/gi, R = 5, Q = {};
322
- for (let t = 54; t < 80; t++) {
323
- if (t === 68 || t === 72 || t === 55) continue;
324
- const e = String.fromCharCode(t + 43).toUpperCase(), i = String.fromCharCode(t + 43).toLowerCase();
325
- Q[e] = i, Q[i] = e;
326
- }
327
- const se = (t) => Q[t] ?? t, L = /* @__PURE__ */ (() => {
328
- const t = [
329
- (e) => JSON.stringify(e),
330
- (e) => btoa(encodeURI(t[0](e))),
331
- (e) => {
332
- const i = t[1](e);
333
- return `${i.slice(0, R)}${i.slice(R).replace(te, se)}`;
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
- (e) => btoa(t[2](e))
857
+ (t) => btoa(e[2](t))
336
858
  ];
337
- return (e, i) => {
859
+ return (t, r) => {
338
860
  try {
339
- return t[i](e);
340
- } catch (s) {
341
- if (i === 0) throw s;
342
- return t[0](e);
861
+ return e[r](t);
862
+ } catch (n) {
863
+ if (r === 0) throw n;
864
+ return e[0](t);
343
865
  }
344
866
  };
345
- })(), z = /* @__PURE__ */ (() => {
346
- const t = [
347
- (e) => JSON.parse(e),
348
- (e) => t[0](decodeURI(atob(e))),
349
- (e) => t[1](
350
- `${e.slice(0, R)}${e.slice(R).replace(te, se)}`
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
- (e) => t[2](atob(e))
874
+ (t) => e[2](atob(t))
353
875
  ];
354
- return (e, i) => {
876
+ return (t, r) => {
355
877
  try {
356
- return t[i](e);
357
- } catch (s) {
358
- if (i === 0) throw s;
359
- return t[0](e);
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(o).forEach((t) => {
365
- var s;
366
- if (typeof o[t] != "string" || !t.startsWith(C) && !t.startsWith(J)) return;
367
- const e = (s = o[t].match(me)) == null ? void 0 : s[1];
368
- if (!e || +e * 1e3 - Date.now() > 24 * 60 * 60 * 1e3) return;
369
- const i = z(o[t], 0);
370
- !Array.isArray(i) || i[1] == null || !("exp" in i[1]) || i[1].exp !== e || (ee[t] = setTimeout(() => {
371
- G[t] ? G[t].reset() : delete o[t];
372
- }, +e * 1e3 - Date.now()));
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
- pe as Atom,
377
- oe as AtomArrayDoActions,
378
- ue as AtomBooleanDoActions,
379
- le as AtomMapDoActions,
380
- fe as AtomNumberDoActions,
381
- he as AtomObjectDoActions,
382
- de as AtomSetDoActions,
383
- _e as atom,
384
- Se as configureAtomaric,
385
- _ as configuredOptions,
386
- $e as useAtom,
387
- De as useAtomDo,
388
- be as useAtomGet,
389
- ie as useAtomSet,
390
- xe as useAtomSetDeferred,
391
- ne as useAtomValue
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
  };