@mhmo91/schmancy 0.2.140 → 0.2.143

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.
Files changed (52) hide show
  1. package/dist/card.cjs +1 -1
  2. package/dist/card.js +1 -1
  3. package/dist/content-drawer.cjs +1 -1
  4. package/dist/content-drawer.js +1 -1
  5. package/dist/context-array-Cpar9dLN.cjs +2 -0
  6. package/dist/context-array-Cpar9dLN.cjs.map +1 -0
  7. package/dist/context-array-DpyA_ATT.js +1020 -0
  8. package/dist/context-array-DpyA_ATT.js.map +1 -0
  9. package/dist/extra.cjs +1 -1
  10. package/dist/extra.js +1 -1
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.js +102 -92
  13. package/dist/mixins/tailwind.css +5 -0
  14. package/dist/nav-drawer.cjs +1 -1
  15. package/dist/nav-drawer.js +1 -1
  16. package/dist/selector-hook-CCTCDtVe.js +323 -0
  17. package/dist/selector-hook-CCTCDtVe.js.map +1 -0
  18. package/dist/selector-hook-DGMX3Yt0.cjs +2 -0
  19. package/dist/selector-hook-DGMX3Yt0.cjs.map +1 -0
  20. package/dist/store.cjs +1 -1
  21. package/dist/store.js +33 -23
  22. package/dist/teleport.cjs +1 -1
  23. package/dist/{teleport.component-CqG_93Gb.js → teleport.component-Dg62mNQm.js} +3 -3
  24. package/dist/{teleport.component-CqG_93Gb.js.map → teleport.component-Dg62mNQm.js.map} +1 -1
  25. package/dist/{teleport.component-C6QSf6Kd.cjs → teleport.component-F3-R3PAX.cjs} +2 -2
  26. package/dist/{teleport.component-C6QSf6Kd.cjs.map → teleport.component-F3-R3PAX.cjs.map} +1 -1
  27. package/dist/teleport.js +1 -1
  28. package/dist/{timezone-Bh92BXoh.cjs → timezone-2Eb26kSx.cjs} +1 -3
  29. package/dist/timezone-2Eb26kSx.cjs.map +1 -0
  30. package/dist/{timezone-95O0-5pe.js → timezone-C8cbkh7P.js} +1 -3
  31. package/dist/timezone-C8cbkh7P.js.map +1 -0
  32. package/package.json +2 -1
  33. package/types/src/store/context-array.d.ts +83 -0
  34. package/types/src/store/context-collection.d.ts +20 -41
  35. package/types/src/store/context-create.d.ts +31 -9
  36. package/types/src/store/context-object.d.ts +18 -41
  37. package/types/src/store/filter-directive.d.ts +62 -5
  38. package/types/src/store/immer-integration.d.ts +60 -0
  39. package/types/src/store/selector-hook.d.ts +4 -0
  40. package/types/src/store/selectors.d.ts +29 -20
  41. package/types/src/store/store.class.d.ts +73 -0
  42. package/types/src/store/types.d.ts +102 -0
  43. package/dist/context-object-BDXZ5EKJ.js +0 -306
  44. package/dist/context-object-BDXZ5EKJ.js.map +0 -1
  45. package/dist/context-object-BIywslrO.cjs +0 -2
  46. package/dist/context-object-BIywslrO.cjs.map +0 -1
  47. package/dist/selector-hook-C6VCezv7.js +0 -273
  48. package/dist/selector-hook-C6VCezv7.js.map +0 -1
  49. package/dist/selector-hook-DDaYMsHs.cjs +0 -2
  50. package/dist/selector-hook-DDaYMsHs.cjs.map +0 -1
  51. package/dist/timezone-95O0-5pe.js.map +0 -1
  52. package/dist/timezone-Bh92BXoh.cjs.map +0 -1
@@ -0,0 +1,1020 @@
1
+ import { Subject as pe, BehaviorSubject as Q, throttleTime as oe } from "rxjs";
2
+ var ce = Symbol.for("immer-nothing"), $ = Symbol.for("immer-draftable"), l = Symbol.for("immer-state"), fe = process.env.NODE_ENV !== "production" ? [function(t) {
3
+ return `The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`;
4
+ }, function(t) {
5
+ 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 '${t}'`;
6
+ }, "This object has been frozen and should not be mutated", function(t) {
7
+ return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + t;
8
+ }, "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", "Immer forbids circular references", "The first or second argument to `produce` must be a function", "The third argument to `produce` must be a function or undefined", "First argument to `createDraft` must be a plain object, an array, or an immerable object", "First argument to `finishDraft` must be a draft returned by `createDraft`", function(t) {
9
+ return `'current' expects a draft, got: ${t}`;
10
+ }, "Object.defineProperty() cannot be used on an Immer draft", "Object.setPrototypeOf() cannot be used on an Immer draft", "Immer only supports deleting array indices", "Immer only supports setting array indices and the 'length' property", function(t) {
11
+ return `'original' expects a draft, got: ${t}`;
12
+ }] : [];
13
+ function _(t, ...e) {
14
+ if (process.env.NODE_ENV !== "production") {
15
+ const r = fe[t], s = typeof r == "function" ? r.apply(null, e) : r;
16
+ throw new Error(`[Immer] ${s}`);
17
+ }
18
+ throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`);
19
+ }
20
+ var E = Object.getPrototypeOf;
21
+ function w(t) {
22
+ return !!t && !!t[l];
23
+ }
24
+ function v(t) {
25
+ var e;
26
+ return !!t && (he(t) || Array.isArray(t) || !!t[$] || !!((e = t.constructor) != null && e[$]) || A(t) || R(t));
27
+ }
28
+ var ye = Object.prototype.constructor.toString();
29
+ function he(t) {
30
+ if (!t || typeof t != "object") return !1;
31
+ const e = E(t);
32
+ if (e === null) return !0;
33
+ const r = Object.hasOwnProperty.call(e, "constructor") && e.constructor;
34
+ return r === Object || typeof r == "function" && Function.toString.call(r) === ye;
35
+ }
36
+ function P(t, e) {
37
+ T(t) === 0 ? Reflect.ownKeys(t).forEach((r) => {
38
+ e(r, t[r], t);
39
+ }) : t.forEach((r, s) => e(s, r, t));
40
+ }
41
+ function T(t) {
42
+ const e = t[l];
43
+ return e ? e.type_ : Array.isArray(t) ? 1 : A(t) ? 2 : R(t) ? 3 : 0;
44
+ }
45
+ function C(t, e) {
46
+ return T(t) === 2 ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
47
+ }
48
+ function ue(t, e, r) {
49
+ const s = T(t);
50
+ s === 2 ? t.set(e, r) : s === 3 ? t.add(r) : t[e] = r;
51
+ }
52
+ function A(t) {
53
+ return t instanceof Map;
54
+ }
55
+ function R(t) {
56
+ return t instanceof Set;
57
+ }
58
+ function f(t) {
59
+ return t.copy_ || t.base_;
60
+ }
61
+ function J(t, e) {
62
+ if (A(t)) return new Map(t);
63
+ if (R(t)) return new Set(t);
64
+ if (Array.isArray(t)) return Array.prototype.slice.call(t);
65
+ const r = he(t);
66
+ if (e === !0 || e === "class_only" && !r) {
67
+ const s = Object.getOwnPropertyDescriptors(t);
68
+ delete s[l];
69
+ let n = Reflect.ownKeys(s);
70
+ for (let a = 0; a < n.length; a++) {
71
+ const h = n[a], c = s[h];
72
+ c.writable === !1 && (c.writable = !0, c.configurable = !0), (c.get || c.set) && (s[h] = { configurable: !0, writable: !0, enumerable: c.enumerable, value: t[h] });
73
+ }
74
+ return Object.create(E(t), s);
75
+ }
76
+ {
77
+ const s = E(t);
78
+ if (s !== null && r) return { ...t };
79
+ const n = Object.create(s);
80
+ return Object.assign(n, t);
81
+ }
82
+ }
83
+ function X(t, e = !1) {
84
+ return F(t) || w(t) || !v(t) || (T(t) > 1 && (t.set = t.add = t.clear = t.delete = _e), Object.freeze(t), e && Object.entries(t).forEach(([r, s]) => X(s, !0))), t;
85
+ }
86
+ function _e() {
87
+ _(2);
88
+ }
89
+ function F(t) {
90
+ return Object.isFrozen(t);
91
+ }
92
+ var j, U = {};
93
+ function S(t) {
94
+ const e = U[t];
95
+ return e || _(0, t), e;
96
+ }
97
+ function N() {
98
+ return j;
99
+ }
100
+ function Y(t, e) {
101
+ e && (S("Patches"), t.patches_ = [], t.inversePatches_ = [], t.patchListener_ = e);
102
+ }
103
+ function K(t) {
104
+ W(t), t.drafts_.forEach(be), t.drafts_ = null;
105
+ }
106
+ function W(t) {
107
+ t === j && (j = t.parent_);
108
+ }
109
+ function Z(t) {
110
+ return j = { drafts_: [], parent_: j, immer_: t, canAutoFreeze_: !0, unfinalizedDrafts_: 0 };
111
+ }
112
+ function be(t) {
113
+ const e = t[l];
114
+ e.type_ === 0 || e.type_ === 1 ? e.revoke_() : e.revoked_ = !0;
115
+ }
116
+ function H(t, e) {
117
+ e.unfinalizedDrafts_ = e.drafts_.length;
118
+ const r = e.drafts_[0];
119
+ return t !== void 0 && t !== r ? (r[l].modified_ && (K(e), _(4)), v(t) && (t = z(e, t), e.parent_ || M(e, t)), e.patches_ && S("Patches").generateReplacementPatches_(r[l].base_, t, e.patches_, e.inversePatches_)) : t = z(e, r, []), K(e), e.patches_ && e.patchListener_(e.patches_, e.inversePatches_), t !== ce ? t : void 0;
120
+ }
121
+ function z(t, e, r) {
122
+ if (F(e)) return e;
123
+ const s = e[l];
124
+ if (!s) return P(e, (n, a) => ee(t, s, e, n, a, r)), e;
125
+ if (s.scope_ !== t) return e;
126
+ if (!s.modified_) return M(t, s.base_, !0), s.base_;
127
+ if (!s.finalized_) {
128
+ s.finalized_ = !0, s.scope_.unfinalizedDrafts_--;
129
+ const n = s.copy_;
130
+ let a = n, h = !1;
131
+ s.type_ === 3 && (a = new Set(n), n.clear(), h = !0), P(a, (c, i) => ee(t, s, n, c, i, r, h)), M(t, n, !1), r && t.patches_ && S("Patches").generatePatches_(s, r, t.patches_, t.inversePatches_);
132
+ }
133
+ return s.copy_;
134
+ }
135
+ function ee(t, e, r, s, n, a, h) {
136
+ if (process.env.NODE_ENV !== "production" && n === r && _(5), w(n)) {
137
+ const c = z(t, n, a && e && e.type_ !== 3 && !C(e.assigned_, s) ? a.concat(s) : void 0);
138
+ if (ue(r, s, c), !w(c)) return;
139
+ t.canAutoFreeze_ = !1;
140
+ } else h && r.add(n);
141
+ if (v(n) && !F(n)) {
142
+ if (!t.immer_.autoFreeze_ && t.unfinalizedDrafts_ < 1) return;
143
+ z(t, n), e && e.scope_.parent_ || typeof s == "symbol" || !Object.prototype.propertyIsEnumerable.call(r, s) || M(t, n);
144
+ }
145
+ }
146
+ function M(t, e, r = !1) {
147
+ !t.parent_ && t.immer_.autoFreeze_ && t.canAutoFreeze_ && X(e, r);
148
+ }
149
+ var L = { get(t, e) {
150
+ if (e === l) return t;
151
+ const r = f(t);
152
+ if (!C(r, e)) return function(n, a, h) {
153
+ var i;
154
+ const c = te(a, h);
155
+ return c ? "value" in c ? c.value : (i = c.get) == null ? void 0 : i.call(n.draft_) : void 0;
156
+ }(t, r, e);
157
+ const s = r[e];
158
+ return t.finalized_ || !v(s) ? s : s === V(t.base_, e) ? (B(t), t.copy_[e] = I(s, t)) : s;
159
+ }, has: (t, e) => e in f(t), ownKeys: (t) => Reflect.ownKeys(f(t)), set(t, e, r) {
160
+ const s = te(f(t), e);
161
+ if (s != null && s.set) return s.set.call(t.draft_, r), !0;
162
+ if (!t.modified_) {
163
+ const h = V(f(t), e), c = h == null ? void 0 : h[l];
164
+ if (c && c.base_ === r) return t.copy_[e] = r, t.assigned_[e] = !1, !0;
165
+ if (((n = r) === (a = h) ? n !== 0 || 1 / n == 1 / a : n != n && a != a) && (r !== void 0 || C(t.base_, e))) return !0;
166
+ B(t), g(t);
167
+ }
168
+ var n, a;
169
+ return t.copy_[e] === r && (r !== void 0 || e in t.copy_) || Number.isNaN(r) && Number.isNaN(t.copy_[e]) || (t.copy_[e] = r, t.assigned_[e] = !0), !0;
170
+ }, deleteProperty: (t, e) => (V(t.base_, e) !== void 0 || e in t.base_ ? (t.assigned_[e] = !1, B(t), g(t)) : delete t.assigned_[e], t.copy_ && delete t.copy_[e], !0), getOwnPropertyDescriptor(t, e) {
171
+ const r = f(t), s = Reflect.getOwnPropertyDescriptor(r, e);
172
+ return s && { writable: !0, configurable: t.type_ !== 1 || e !== "length", enumerable: s.enumerable, value: r[e] };
173
+ }, defineProperty() {
174
+ _(11);
175
+ }, getPrototypeOf: (t) => E(t.base_), setPrototypeOf() {
176
+ _(12);
177
+ } }, x = {};
178
+ function V(t, e) {
179
+ const r = t[l];
180
+ return (r ? f(r) : t)[e];
181
+ }
182
+ function te(t, e) {
183
+ if (!(e in t)) return;
184
+ let r = E(t);
185
+ for (; r; ) {
186
+ const s = Object.getOwnPropertyDescriptor(r, e);
187
+ if (s) return s;
188
+ r = E(r);
189
+ }
190
+ }
191
+ function g(t) {
192
+ t.modified_ || (t.modified_ = !0, t.parent_ && g(t.parent_));
193
+ }
194
+ function B(t) {
195
+ t.copy_ || (t.copy_ = J(t.base_, t.scope_.immer_.useStrictShallowCopy_));
196
+ }
197
+ P(L, (t, e) => {
198
+ x[t] = function() {
199
+ return arguments[0] = arguments[0][0], e.apply(this, arguments);
200
+ };
201
+ }), x.deleteProperty = function(t, e) {
202
+ return process.env.NODE_ENV !== "production" && isNaN(parseInt(e)) && _(13), x.set.call(this, t, e, void 0);
203
+ }, x.set = function(t, e, r) {
204
+ return process.env.NODE_ENV !== "production" && e !== "length" && isNaN(parseInt(e)) && _(14), L.set.call(this, t[0], e, r, t[0]);
205
+ };
206
+ function I(t, e) {
207
+ const r = A(t) ? S("MapSet").proxyMap_(t, e) : R(t) ? S("MapSet").proxySet_(t, e) : function(s, n) {
208
+ const a = Array.isArray(s), h = { type_: a ? 1 : 0, scope_: n ? n.scope_ : N(), modified_: !1, finalized_: !1, assigned_: {}, parent_: n, base_: s, draft_: null, copy_: null, revoke_: null, isManual_: !1 };
209
+ let c = h, i = L;
210
+ a && (c = [h], i = x);
211
+ const { revoke: o, proxy: p } = Proxy.revocable(c, i);
212
+ return h.draft_ = p, h.revoke_ = o, p;
213
+ }(t, e);
214
+ return (e ? e.scope_ : N()).drafts_.push(r), r;
215
+ }
216
+ function le(t) {
217
+ if (!v(t) || F(t)) return t;
218
+ const e = t[l];
219
+ let r;
220
+ if (e) {
221
+ if (!e.modified_) return e.base_;
222
+ e.finalized_ = !0, r = J(t, e.scope_.immer_.useStrictShallowCopy_);
223
+ } else r = J(t, !0);
224
+ return P(r, (s, n) => {
225
+ ue(r, s, le(n));
226
+ }), e && (e.finalized_ = !1), r;
227
+ }
228
+ var de, re, se, b = new class {
229
+ constructor(t) {
230
+ this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (e, r, s) => {
231
+ if (typeof e == "function" && typeof r != "function") {
232
+ const a = r;
233
+ r = e;
234
+ const h = this;
235
+ return function(c = a, ...i) {
236
+ return h.produce(c, (o) => r.call(this, o, ...i));
237
+ };
238
+ }
239
+ let n;
240
+ if (typeof r != "function" && _(6), s !== void 0 && typeof s != "function" && _(7), v(e)) {
241
+ const a = Z(this), h = I(e, void 0);
242
+ let c = !0;
243
+ try {
244
+ n = r(h), c = !1;
245
+ } finally {
246
+ c ? K(a) : W(a);
247
+ }
248
+ return Y(a, s), H(n, a);
249
+ }
250
+ if (!e || typeof e != "object") {
251
+ if (n = r(e), n === void 0 && (n = e), n === ce && (n = void 0), this.autoFreeze_ && X(n, !0), s) {
252
+ const a = [], h = [];
253
+ S("Patches").generateReplacementPatches_(e, n, a, h), s(a, h);
254
+ }
255
+ return n;
256
+ }
257
+ _(1, e);
258
+ }, this.produceWithPatches = (e, r) => {
259
+ if (typeof e == "function") return (a, ...h) => this.produceWithPatches(a, (c) => e(c, ...h));
260
+ let s, n;
261
+ return [this.produce(e, r, (a, h) => {
262
+ s = a, n = h;
263
+ }), s, n];
264
+ }, typeof (t == null ? void 0 : t.autoFreeze) == "boolean" && this.setAutoFreeze(t.autoFreeze), typeof (t == null ? void 0 : t.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(t.useStrictShallowCopy);
265
+ }
266
+ createDraft(t) {
267
+ v(t) || _(8), w(t) && (t = function(s) {
268
+ return w(s) || _(10, s), le(s);
269
+ }(t));
270
+ const e = Z(this), r = I(t, void 0);
271
+ return r[l].isManual_ = !0, W(e), r;
272
+ }
273
+ finishDraft(t, e) {
274
+ const r = t && t[l];
275
+ r && r.isManual_ || _(9);
276
+ const { scope_: s } = r;
277
+ return Y(s, e), H(void 0, s);
278
+ }
279
+ setAutoFreeze(t) {
280
+ this.autoFreeze_ = t;
281
+ }
282
+ setUseStrictShallowCopy(t) {
283
+ this.useStrictShallowCopy_ = t;
284
+ }
285
+ applyPatches(t, e) {
286
+ let r;
287
+ for (r = e.length - 1; r >= 0; r--) {
288
+ const n = e[r];
289
+ if (n.path.length === 0 && n.op === "replace") {
290
+ t = n.value;
291
+ break;
292
+ }
293
+ }
294
+ r > -1 && (e = e.slice(r + 1));
295
+ const s = S("Patches").applyPatches_;
296
+ return w(t) ? s(t, e) : this.produce(t, (n) => s(n, e));
297
+ }
298
+ }(), d = b.produce;
299
+ b.produceWithPatches.bind(b), b.setAutoFreeze.bind(b), b.setUseStrictShallowCopy.bind(b), b.applyPatches.bind(b), b.createDraft.bind(b), b.finishDraft.bind(b);
300
+ class u extends Error {
301
+ constructor(e, r, s) {
302
+ super(e), this.name = "StoreError", this.cause = r, this.context = s, this.timestamp = /* @__PURE__ */ new Date(), Error.captureStackTrace && Error.captureStackTrace(this, u);
303
+ }
304
+ toJSON() {
305
+ return { name: this.name, message: this.message, cause: this.cause, context: this.context, timestamp: this.timestamp.toISOString(), stack: this.stack };
306
+ }
307
+ }
308
+ class me {
309
+ constructor() {
310
+ this.data = null;
311
+ }
312
+ async load() {
313
+ return this.data;
314
+ }
315
+ async save(e) {
316
+ this.data = e;
317
+ }
318
+ async clear() {
319
+ this.data = null;
320
+ }
321
+ }
322
+ class ge {
323
+ constructor(e) {
324
+ this.key = e;
325
+ }
326
+ async load() {
327
+ try {
328
+ const e = localStorage.getItem(this.key);
329
+ return e ? JSON.parse(e) : null;
330
+ } catch {
331
+ return null;
332
+ }
333
+ }
334
+ async save(e) {
335
+ try {
336
+ localStorage.setItem(this.key, JSON.stringify(e));
337
+ } catch (r) {
338
+ throw new u(`Failed to save to localStorage (${this.key})`, r);
339
+ }
340
+ }
341
+ async clear() {
342
+ localStorage.removeItem(this.key);
343
+ }
344
+ }
345
+ class ve {
346
+ constructor(e) {
347
+ this.key = e;
348
+ }
349
+ async load() {
350
+ try {
351
+ const e = sessionStorage.getItem(this.key);
352
+ return e ? JSON.parse(e) : null;
353
+ } catch {
354
+ return null;
355
+ }
356
+ }
357
+ async save(e) {
358
+ try {
359
+ sessionStorage.setItem(this.key, JSON.stringify(e));
360
+ } catch (r) {
361
+ throw new u(`Failed to save to sessionStorage (${this.key})`, r);
362
+ }
363
+ }
364
+ async clear() {
365
+ sessionStorage.removeItem(this.key);
366
+ }
367
+ }
368
+ const y = class y {
369
+ constructor(e) {
370
+ this.key = e;
371
+ }
372
+ openDB() {
373
+ return new Promise((e, r) => {
374
+ const s = indexedDB.open(y.DB_NAME, y.DB_VERSION);
375
+ s.onupgradeneeded = () => {
376
+ const n = s.result;
377
+ n.objectStoreNames.contains(y.STORE_NAME) || n.createObjectStore(y.STORE_NAME);
378
+ }, s.onsuccess = () => e(s.result), s.onerror = () => r(s.error);
379
+ });
380
+ }
381
+ async load() {
382
+ try {
383
+ const e = await this.openDB();
384
+ return new Promise((r, s) => {
385
+ const n = e.transaction(y.STORE_NAME, "readonly").objectStore(y.STORE_NAME).get(this.key);
386
+ n.onsuccess = () => {
387
+ e.close(), r(n.result || null);
388
+ }, n.onerror = () => {
389
+ e.close(), s(n.error);
390
+ };
391
+ });
392
+ } catch {
393
+ return null;
394
+ }
395
+ }
396
+ async save(e) {
397
+ try {
398
+ const r = await this.openDB();
399
+ return new Promise((s, n) => {
400
+ const a = r.transaction(y.STORE_NAME, "readwrite").objectStore(y.STORE_NAME).put(e, this.key);
401
+ a.onsuccess = () => {
402
+ r.close(), s();
403
+ }, a.onerror = () => {
404
+ r.close(), n(a.error);
405
+ };
406
+ });
407
+ } catch (r) {
408
+ throw new u(`Failed to save to IndexedDB (${this.key})`, r);
409
+ }
410
+ }
411
+ async clear() {
412
+ try {
413
+ const e = await this.openDB();
414
+ return new Promise((r, s) => {
415
+ const n = e.transaction(y.STORE_NAME, "readwrite").objectStore(y.STORE_NAME).delete(this.key);
416
+ n.onsuccess = () => {
417
+ e.close(), r();
418
+ }, n.onerror = () => {
419
+ e.close(), s(n.error);
420
+ };
421
+ });
422
+ } catch (e) {
423
+ throw new u(`Failed to clear from IndexedDB (${this.key})`, e);
424
+ }
425
+ }
426
+ };
427
+ y.DB_NAME = "StoreDB", y.STORE_NAME = "states", y.DB_VERSION = 1;
428
+ let G = y;
429
+ function Se(t, e) {
430
+ switch (t) {
431
+ case "local":
432
+ return new ge(e);
433
+ case "session":
434
+ return new ve(e);
435
+ case "indexeddb":
436
+ return new G(e);
437
+ default:
438
+ return new me();
439
+ }
440
+ }
441
+ (function() {
442
+ class t extends Map {
443
+ constructor(i, o) {
444
+ super(), this[l] = { type_: 2, parent_: o, scope_: o ? o.scope_ : N(), modified_: !1, finalized_: !1, copy_: void 0, assigned_: void 0, base_: i, draft_: this, isManual_: !1, revoked_: !1 };
445
+ }
446
+ get size() {
447
+ return f(this[l]).size;
448
+ }
449
+ has(i) {
450
+ return f(this[l]).has(i);
451
+ }
452
+ set(i, o) {
453
+ const p = this[l];
454
+ return n(p), f(p).has(i) && f(p).get(i) === o || (e(p), g(p), p.assigned_.set(i, !0), p.copy_.set(i, o), p.assigned_.set(i, !0)), this;
455
+ }
456
+ delete(i) {
457
+ if (!this.has(i)) return !1;
458
+ const o = this[l];
459
+ return n(o), e(o), g(o), o.base_.has(i) ? o.assigned_.set(i, !1) : o.assigned_.delete(i), o.copy_.delete(i), !0;
460
+ }
461
+ clear() {
462
+ const i = this[l];
463
+ n(i), f(i).size && (e(i), g(i), i.assigned_ = /* @__PURE__ */ new Map(), P(i.base_, (o) => {
464
+ i.assigned_.set(o, !1);
465
+ }), i.copy_.clear());
466
+ }
467
+ forEach(i, o) {
468
+ f(this[l]).forEach((p, m, we) => {
469
+ i.call(o, this.get(m), m, this);
470
+ });
471
+ }
472
+ get(i) {
473
+ const o = this[l];
474
+ n(o);
475
+ const p = f(o).get(i);
476
+ if (o.finalized_ || !v(p) || p !== o.base_.get(i)) return p;
477
+ const m = I(p, o);
478
+ return e(o), o.copy_.set(i, m), m;
479
+ }
480
+ keys() {
481
+ return f(this[l]).keys();
482
+ }
483
+ values() {
484
+ const i = this.keys();
485
+ return { [Symbol.iterator]: () => this.values(), next: () => {
486
+ const o = i.next();
487
+ return o.done ? o : { done: !1, value: this.get(o.value) };
488
+ } };
489
+ }
490
+ entries() {
491
+ const i = this.keys();
492
+ return { [Symbol.iterator]: () => this.entries(), next: () => {
493
+ const o = i.next();
494
+ if (o.done) return o;
495
+ const p = this.get(o.value);
496
+ return { done: !1, value: [o.value, p] };
497
+ } };
498
+ }
499
+ [Symbol.iterator]() {
500
+ return this.entries();
501
+ }
502
+ }
503
+ function e(c) {
504
+ c.copy_ || (c.assigned_ = /* @__PURE__ */ new Map(), c.copy_ = new Map(c.base_));
505
+ }
506
+ class r extends Set {
507
+ constructor(i, o) {
508
+ super(), this[l] = { type_: 3, parent_: o, scope_: o ? o.scope_ : N(), modified_: !1, finalized_: !1, copy_: void 0, base_: i, draft_: this, drafts_: /* @__PURE__ */ new Map(), revoked_: !1, isManual_: !1 };
509
+ }
510
+ get size() {
511
+ return f(this[l]).size;
512
+ }
513
+ has(i) {
514
+ const o = this[l];
515
+ return n(o), o.copy_ ? !!o.copy_.has(i) || !(!o.drafts_.has(i) || !o.copy_.has(o.drafts_.get(i))) : o.base_.has(i);
516
+ }
517
+ add(i) {
518
+ const o = this[l];
519
+ return n(o), this.has(i) || (s(o), g(o), o.copy_.add(i)), this;
520
+ }
521
+ delete(i) {
522
+ if (!this.has(i)) return !1;
523
+ const o = this[l];
524
+ return n(o), s(o), g(o), o.copy_.delete(i) || !!o.drafts_.has(i) && o.copy_.delete(o.drafts_.get(i));
525
+ }
526
+ clear() {
527
+ const i = this[l];
528
+ n(i), f(i).size && (s(i), g(i), i.copy_.clear());
529
+ }
530
+ values() {
531
+ const i = this[l];
532
+ return n(i), s(i), i.copy_.values();
533
+ }
534
+ entries() {
535
+ const i = this[l];
536
+ return n(i), s(i), i.copy_.entries();
537
+ }
538
+ keys() {
539
+ return this.values();
540
+ }
541
+ [Symbol.iterator]() {
542
+ return this.values();
543
+ }
544
+ forEach(i, o) {
545
+ const p = this.values();
546
+ let m = p.next();
547
+ for (; !m.done; ) i.call(o, m.value, m.value, this), m = p.next();
548
+ }
549
+ }
550
+ function s(c) {
551
+ c.copy_ || (c.copy_ = /* @__PURE__ */ new Set(), c.base_.forEach((i) => {
552
+ if (v(i)) {
553
+ const o = I(i, c);
554
+ c.drafts_.set(i, o), c.copy_.add(o);
555
+ } else c.copy_.add(i);
556
+ }));
557
+ }
558
+ function n(c) {
559
+ c.revoked_ && _(3, JSON.stringify(f(c)));
560
+ }
561
+ var a, h;
562
+ h = { proxyMap_: function(c, i) {
563
+ return new t(c, i);
564
+ }, proxySet_: function(c, i) {
565
+ return new r(c, i);
566
+ } }, U[a = "MapSet"] || (U[a] = h);
567
+ })(), de = $;
568
+ class q {
569
+ constructor(e, r, s) {
570
+ let n;
571
+ this.storageType = e, this.key = r, this[de] = !0, this._ready = !1, this._destroy$ = new pe(), this.error$ = new Q(null), n = s instanceof Map ? new Map(s) : Array.isArray(s) ? [...s] : s && typeof s == "object" ? { ...s } : s;
572
+ try {
573
+ this.defaultValue = this.isImmerDraftable(n) ? d(n, (a) => a) : n;
574
+ } catch {
575
+ this.defaultValue = n;
576
+ }
577
+ this.$ = new Q(this.defaultValue), this.storage = Se(e, r), e === "memory" ? this._ready = !0 : this.initializeFromStorage();
578
+ }
579
+ get ready() {
580
+ return this._ready;
581
+ }
582
+ set ready(e) {
583
+ this._ready = e, this.updateState(this.$.value);
584
+ }
585
+ get value() {
586
+ return this.$.getValue();
587
+ }
588
+ isImmerDraftable(e) {
589
+ return e !== null && typeof e == "object" && (Array.isArray(e) || e instanceof Map || e instanceof Set || Object.getPrototypeOf(e) === Object.prototype || e[$] === !0);
590
+ }
591
+ destroy() {
592
+ this._destroy$.next(), this._destroy$.complete(), this.$.complete(), this.error$.complete();
593
+ }
594
+ replace(e) {
595
+ try {
596
+ const r = this.isImmerDraftable(e) ? d(e, (s) => s) : e;
597
+ this.updateState(r);
598
+ } catch (r) {
599
+ const s = new u(`Error replacing state in ${this.key}`, r);
600
+ this.error$.next(s), this.updateState(e);
601
+ }
602
+ }
603
+ updateState(e) {
604
+ try {
605
+ let r;
606
+ r = this.isImmerDraftable(e) ? d(e, (s) => s) : e, this.$.next(r), this.storageType !== "memory" && this.persistToStorage(r).catch((s) => {
607
+ const n = new u(`Error saving to ${this.storageType} storage for ${this.key}`, s);
608
+ this.error$.next(n);
609
+ });
610
+ } catch (r) {
611
+ const s = new u(`Error updating state in ${this.key}`, r);
612
+ this.error$.next(s), this.$.next(e);
613
+ }
614
+ }
615
+ async initializeFromStorage() {
616
+ try {
617
+ const e = await this.storage.load();
618
+ if (e) {
619
+ const r = this.processStoredValue(e);
620
+ try {
621
+ const s = this.isImmerDraftable(r) ? d(r, (n) => n) : r;
622
+ this.updateState(s);
623
+ } catch {
624
+ this.updateState(r);
625
+ }
626
+ }
627
+ this._ready = !0;
628
+ } catch (e) {
629
+ const r = new u(`Error loading from ${this.storageType} storage for ${this.key}`, e);
630
+ this.error$.next(r), this._ready = !0;
631
+ }
632
+ }
633
+ processStoredValue(e) {
634
+ return e;
635
+ }
636
+ async persistToStorage(e) {
637
+ return this.storage.save(e);
638
+ }
639
+ }
640
+ const k = class k extends q {
641
+ static getInstance(e, r, s) {
642
+ const n = `${e}:${r}`;
643
+ return this.instances.has(n) || this.instances.set(n, new k(e, r, s)), this.instances.get(n);
644
+ }
645
+ set(e, r) {
646
+ try {
647
+ const s = d(this.value, (n) => {
648
+ n.set(e, r);
649
+ });
650
+ this.updateState(s), this.error$.next(null);
651
+ } catch (s) {
652
+ const n = new u(`Error setting value for key ${e} in ${this.key}`, s);
653
+ this.error$.next(n);
654
+ }
655
+ }
656
+ delete(e) {
657
+ try {
658
+ const r = d(this.value, (s) => {
659
+ s.delete(e);
660
+ });
661
+ this.updateState(r), this.error$.next(null);
662
+ } catch (r) {
663
+ const s = new u(`Error deleting key ${e} from ${this.key}`, r);
664
+ this.error$.next(s);
665
+ }
666
+ }
667
+ clear() {
668
+ this.updateState(/* @__PURE__ */ new Map());
669
+ }
670
+ batchUpdate(e) {
671
+ try {
672
+ const r = d(this.value, (s) => {
673
+ Object.entries(e).forEach(([n, a]) => {
674
+ s.set(n, a);
675
+ });
676
+ });
677
+ this.updateState(r), this.error$.next(null);
678
+ } catch (r) {
679
+ const s = new u(`Error batch updating in ${this.key}`, r);
680
+ this.error$.next(s);
681
+ }
682
+ }
683
+ update(e, r) {
684
+ try {
685
+ const s = d(this.value, (n) => {
686
+ const a = n.get(e);
687
+ a !== void 0 && r(a);
688
+ });
689
+ this.updateState(s), this.error$.next(null);
690
+ } catch (s) {
691
+ const n = new u(`Error updating item ${e} in ${this.key}`, s);
692
+ this.error$.next(n);
693
+ }
694
+ }
695
+ constructor(e, r, s) {
696
+ super(e, r, s), e !== "memory" && this.setupPersistence();
697
+ }
698
+ setupPersistence() {
699
+ this.$.pipe(oe(100, void 0, { leading: !0, trailing: !0 })).subscribe((e) => {
700
+ this.storage.save(e).catch((r) => {
701
+ const s = new u(`Error saving to ${this.storageType} storage for ${this.key}`, r);
702
+ this.error$.next(s);
703
+ });
704
+ });
705
+ }
706
+ setupDevTools() {
707
+ typeof window < "u" && (window.__STORES__ = window.__STORES__ || {}, window.__STORES__[this.key] = { getState: () => this.value, set: this.set.bind(this), delete: this.delete.bind(this), clear: this.clear.bind(this), batchUpdate: this.batchUpdate.bind(this), update: this.update.bind(this), subscribe: (e) => {
708
+ const r = this.$.subscribe(e);
709
+ return () => r.unsubscribe();
710
+ } });
711
+ }
712
+ };
713
+ k.type = "collection", k.instances = /* @__PURE__ */ new Map();
714
+ let ne = k;
715
+ const O = class O extends (se = q, re = $, se) {
716
+ constructor() {
717
+ super(...arguments), this[re] = !0;
718
+ }
719
+ static getInstance(e, r, s) {
720
+ const n = `${e}:${r}`;
721
+ return this.instances.has(n) || this.instances.set(n, new O(e, r, s)), this.instances.get(n);
722
+ }
723
+ set(e, r = !0) {
724
+ try {
725
+ if (!this.isImmerDraftable(this.value)) {
726
+ const n = r ? { ...this.value, ...e } : e;
727
+ return this.updateState(n), void this.error$.next(null);
728
+ }
729
+ const s = d(this.value, (n) => {
730
+ if (r) {
731
+ if (e == null) return;
732
+ try {
733
+ Object.assign(n, e);
734
+ } catch {
735
+ Object.keys(e).forEach((h) => {
736
+ n[h] = e[h];
737
+ });
738
+ }
739
+ } else try {
740
+ return e;
741
+ } catch {
742
+ return e;
743
+ }
744
+ });
745
+ this.updateState(s), this.error$.next(null);
746
+ } catch (s) {
747
+ const n = new u(`Error updating store: ${this.key}`, s, { value: e, merge: r });
748
+ this.error$.next(n);
749
+ try {
750
+ const a = r ? { ...this.value, ...e } : e;
751
+ this.updateState(a);
752
+ } catch {
753
+ }
754
+ }
755
+ }
756
+ clear() {
757
+ try {
758
+ if (this.isImmerDraftable(this.defaultValue)) {
759
+ const e = d(this.defaultValue, (r) => r);
760
+ this.set(e, !1);
761
+ } else this.set(this.defaultValue, !1);
762
+ } catch (e) {
763
+ const r = new u(`Error clearing store: ${this.key}`, e);
764
+ this.error$.next(r), this.updateState(this.defaultValue);
765
+ }
766
+ }
767
+ delete(e) {
768
+ try {
769
+ if (!this.isImmerDraftable(this.value)) {
770
+ const s = { ...this.value };
771
+ return delete s[e], void this.updateState(s);
772
+ }
773
+ const r = d(this.value, (s) => {
774
+ delete s[e];
775
+ });
776
+ this.updateState(r);
777
+ } catch (r) {
778
+ const s = new u(`Error deleting key ${String(e)} from store: ${this.key}`, r);
779
+ this.error$.next(s);
780
+ try {
781
+ const n = { ...this.value };
782
+ delete n[e], this.updateState(n);
783
+ } catch {
784
+ }
785
+ }
786
+ }
787
+ setPath(e, r) {
788
+ try {
789
+ if (!e) return;
790
+ if (!this.isImmerDraftable(this.value)) {
791
+ const n = e.split("."), a = { ...this.value };
792
+ let h = a;
793
+ for (let c = 0; c < n.length - 1; c++) {
794
+ const i = n[c];
795
+ h[i] === void 0 ? h[i] = {} : typeof h[i] == "object" && h[i] !== null || (h[i] = {}), h = h[i];
796
+ }
797
+ return h[n[n.length - 1]] = r, void this.updateState(a);
798
+ }
799
+ const s = d(this.value, (n) => {
800
+ const a = e.split(".");
801
+ let h = n;
802
+ for (let i = 0; i < a.length - 1; i++) {
803
+ const o = a[i];
804
+ h[o] === void 0 ? h[o] = {} : typeof h[o] == "object" && h[o] !== null || (h[o] = {}), h = h[o];
805
+ }
806
+ const c = a[a.length - 1];
807
+ try {
808
+ h[c] = r;
809
+ } catch {
810
+ h[c] = r;
811
+ }
812
+ });
813
+ this.updateState(s), this.error$.next(null);
814
+ } catch (s) {
815
+ const n = new u(`Error setting path ${e} in ${this.key}`, s);
816
+ this.error$.next(n);
817
+ try {
818
+ const a = e.split("."), h = { ...this.value };
819
+ let c = h;
820
+ for (let i = 0; i < a.length - 1; i++) {
821
+ const o = a[i];
822
+ c[o] === void 0 ? c[o] = {} : typeof c[o] == "object" && c[o] !== null || (c[o] = {}), c = c[o];
823
+ }
824
+ c[a[a.length - 1]] = r, this.updateState(h);
825
+ } catch {
826
+ }
827
+ }
828
+ }
829
+ processStoredValue(e) {
830
+ try {
831
+ return this.isImmerDraftable(this.defaultValue) && this.isImmerDraftable(e) ? d(this.defaultValue, (r) => {
832
+ Object.assign(r, e);
833
+ }) : { ...this.defaultValue, ...e };
834
+ } catch {
835
+ return e;
836
+ }
837
+ }
838
+ setupDevTools() {
839
+ typeof window < "u" && (window.__STORES__ = window.__STORES__ || {}, window.__STORES__[this.key] = { getState: () => this.value, set: this.set.bind(this), delete: this.delete.bind(this), clear: this.clear.bind(this), setPath: this.setPath.bind(this), subscribe: (e) => {
840
+ const r = this.$.subscribe(e);
841
+ return () => r.unsubscribe();
842
+ } });
843
+ }
844
+ isImmerDraftable(e) {
845
+ return e !== null && typeof e == "object" && (super.isImmerDraftable(e) || e[$] === !0);
846
+ }
847
+ };
848
+ O.type = "object", O.instances = /* @__PURE__ */ new Map();
849
+ let ie = O;
850
+ const D = class D extends q {
851
+ static getInstance(e, r, s = []) {
852
+ const n = `${e}:${r}`;
853
+ return this.instances.has(n) || this.instances.set(n, new D(e, r, s)), this.instances.get(n);
854
+ }
855
+ constructor(e, r, s = []) {
856
+ super(e, r, s), e !== "memory" && this.setupPersistence();
857
+ }
858
+ setupPersistence() {
859
+ this.$.pipe(oe(100, void 0, { leading: !0, trailing: !0 })).subscribe((e) => {
860
+ this.storage.save(e).catch((r) => {
861
+ const s = new u(`Error saving to ${this.storageType} storage for ${this.key}`, r);
862
+ this.error$.next(s);
863
+ });
864
+ });
865
+ }
866
+ push(...e) {
867
+ try {
868
+ const r = d(this.value, (s) => {
869
+ s.push(...e.map((n) => n));
870
+ });
871
+ this.updateState(r), this.error$.next(null);
872
+ } catch (r) {
873
+ const s = new u(`Error pushing items in ${this.key}`, r);
874
+ this.error$.next(s);
875
+ }
876
+ }
877
+ pop() {
878
+ try {
879
+ const e = this.value.length > 0 ? this.value[this.value.length - 1] : void 0, r = d(this.value, (s) => {
880
+ s.pop();
881
+ });
882
+ return this.updateState(r), this.error$.next(null), e;
883
+ } catch (e) {
884
+ const r = new u(`Error popping item from ${this.key}`, e);
885
+ return void this.error$.next(r);
886
+ }
887
+ }
888
+ unshift(...e) {
889
+ try {
890
+ const r = d(this.value, (s) => {
891
+ s.unshift(...e.map((n) => n));
892
+ });
893
+ this.updateState(r), this.error$.next(null);
894
+ } catch (r) {
895
+ const s = new u(`Error unshifting items in ${this.key}`, r);
896
+ this.error$.next(s);
897
+ }
898
+ }
899
+ shift() {
900
+ try {
901
+ const e = this.value.length > 0 ? this.value[0] : void 0, r = d(this.value, (s) => {
902
+ s.shift();
903
+ });
904
+ return this.updateState(r), this.error$.next(null), e;
905
+ } catch (e) {
906
+ const r = new u(`Error shifting item from ${this.key}`, e);
907
+ return void this.error$.next(r);
908
+ }
909
+ }
910
+ set(e, r) {
911
+ try {
912
+ const s = d(this.value, (n) => {
913
+ if (!(e >= 0 && e < n.length)) throw new Error(`Index ${e} out of bounds (length: ${n.length})`);
914
+ n[e] = r;
915
+ });
916
+ this.updateState(s), this.error$.next(null);
917
+ } catch (s) {
918
+ const n = new u(`Error setting item at index ${e} in ${this.key}`, s);
919
+ this.error$.next(n);
920
+ }
921
+ }
922
+ get(e) {
923
+ return this.value[e];
924
+ }
925
+ splice(e, r, ...s) {
926
+ try {
927
+ const n = [...this.value].splice(e, r ?? 0, ...s), a = d(this.value, (h) => {
928
+ h.splice(e, r ?? 0, ...s.map((c) => c));
929
+ });
930
+ return this.updateState(a), this.error$.next(null), n;
931
+ } catch (n) {
932
+ const a = new u(`Error splicing items in ${this.key}`, n);
933
+ return this.error$.next(a), [];
934
+ }
935
+ }
936
+ remove(e, r) {
937
+ try {
938
+ const s = r || ((a, h) => a === h), n = this.value.findIndex((a) => s(a, e));
939
+ if (n !== -1) {
940
+ const a = d(this.value, (h) => {
941
+ h.splice(n, 1);
942
+ });
943
+ return this.updateState(a), this.error$.next(null), !0;
944
+ }
945
+ return this.error$.next(null), !1;
946
+ } catch (s) {
947
+ const n = new u(`Error removing item in ${this.key}`, s);
948
+ return this.error$.next(n), !1;
949
+ }
950
+ }
951
+ replace(e) {
952
+ try {
953
+ const r = d(e, (s) => s);
954
+ this.updateState(r), this.error$.next(null);
955
+ } catch (r) {
956
+ const s = new u(`Error replacing array in ${this.key}`, r);
957
+ this.error$.next(s);
958
+ }
959
+ }
960
+ filter(e) {
961
+ try {
962
+ const r = this.value.filter(e), s = d(this.value, (n) => {
963
+ n.length = 0, n.push(...r.map((a) => a));
964
+ });
965
+ this.updateState(s), this.error$.next(null);
966
+ } catch (r) {
967
+ const s = new u(`Error filtering array in ${this.key}`, r);
968
+ this.error$.next(s);
969
+ }
970
+ }
971
+ map(e) {
972
+ return this.value.map(e);
973
+ }
974
+ sort(e) {
975
+ try {
976
+ const r = [...this.value].sort(e), s = d(this.value, (n) => {
977
+ n.length = 0, n.push(...r.map((a) => a));
978
+ });
979
+ this.updateState(s), this.error$.next(null);
980
+ } catch (r) {
981
+ const s = new u(`Error sorting array in ${this.key}`, r);
982
+ this.error$.next(s);
983
+ }
984
+ }
985
+ update(e, r) {
986
+ try {
987
+ const s = d(this.value, (n) => {
988
+ if (!(e >= 0 && e < n.length)) throw new Error(`Index ${e} out of bounds (length: ${n.length})`);
989
+ r(n[e]);
990
+ });
991
+ this.updateState(s), this.error$.next(null);
992
+ } catch (s) {
993
+ const n = new u(`Error updating item at index ${e} in ${this.key}`, s);
994
+ this.error$.next(n);
995
+ }
996
+ }
997
+ clear() {
998
+ this.updateState([]);
999
+ }
1000
+ setupDevTools() {
1001
+ typeof window < "u" && (window.__STORES__ = window.__STORES__ || {}, window.__STORES__[this.key] = { getState: () => this.value, push: this.push.bind(this), pop: this.pop.bind(this), unshift: this.unshift.bind(this), shift: this.shift.bind(this), set: this.set.bind(this), get: this.get.bind(this), splice: this.splice.bind(this), remove: this.remove.bind(this), replace: this.replace.bind(this), filter: this.filter.bind(this), map: this.map.bind(this), sort: this.sort.bind(this), update: this.update.bind(this), clear: this.clear.bind(this), subscribe: (e) => {
1002
+ const r = this.$.subscribe(e);
1003
+ return () => r.unsubscribe();
1004
+ } });
1005
+ }
1006
+ };
1007
+ D.type = "array", D.instances = /* @__PURE__ */ new Map();
1008
+ let ae = D;
1009
+ export {
1010
+ G as I,
1011
+ ge as L,
1012
+ me as M,
1013
+ ie as S,
1014
+ ve as a,
1015
+ u as b,
1016
+ Se as c,
1017
+ ne as d,
1018
+ ae as e
1019
+ };
1020
+ //# sourceMappingURL=context-array-DpyA_ATT.js.map