@open-kingdom/shared-frontend-data-access-notifications 0.0.2-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1170 @@
1
+ function Te(e) {
2
+ if (typeof e != "object" || e === null)
3
+ return !1;
4
+ let t = e;
5
+ for (; Object.getPrototypeOf(t) !== null; )
6
+ t = Object.getPrototypeOf(t);
7
+ return Object.getPrototypeOf(e) === t || Object.getPrototypeOf(e) === null;
8
+ }
9
+ function Me(e) {
10
+ return Te(e) && "type" in e && typeof e.type == "string";
11
+ }
12
+ var we = Symbol.for("immer-nothing"), ue = Symbol.for("immer-draftable"), E = Symbol.for("immer-state"), ze = process.env.NODE_ENV !== "production" ? [
13
+ // All error codes, starting by 0:
14
+ function(e) {
15
+ return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
16
+ },
17
+ function(e) {
18
+ 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}'`;
19
+ },
20
+ "This object has been frozen and should not be mutated",
21
+ function(e) {
22
+ return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
23
+ },
24
+ "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
25
+ "Immer forbids circular references",
26
+ "The first or second argument to `produce` must be a function",
27
+ "The third argument to `produce` must be a function or undefined",
28
+ "First argument to `createDraft` must be a plain object, an array, or an immerable object",
29
+ "First argument to `finishDraft` must be a draft returned by `createDraft`",
30
+ function(e) {
31
+ return `'current' expects a draft, got: ${e}`;
32
+ },
33
+ "Object.defineProperty() cannot be used on an Immer draft",
34
+ "Object.setPrototypeOf() cannot be used on an Immer draft",
35
+ "Immer only supports deleting array indices",
36
+ "Immer only supports setting array indices and the 'length' property",
37
+ function(e) {
38
+ return `'original' expects a draft, got: ${e}`;
39
+ }
40
+ // Note: if more errors are added, the errorOffset in Patches.ts should be increased
41
+ // See Patches.ts for additional errors
42
+ ] : [];
43
+ function N(e, ...t) {
44
+ if (process.env.NODE_ENV !== "production") {
45
+ const n = ze[e], r = typeof n == "function" ? n.apply(null, t) : n;
46
+ throw new Error(`[Immer] ${r}`);
47
+ }
48
+ throw new Error(
49
+ `[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
50
+ );
51
+ }
52
+ var M = Object.getPrototypeOf;
53
+ function R(e) {
54
+ return !!e && !!e[E];
55
+ }
56
+ function S(e) {
57
+ return e ? Ne(e) || Array.isArray(e) || !!e[ue] || !!e.constructor?.[ue] || A(e) || G(e) : !1;
58
+ }
59
+ var je = Object.prototype.constructor.toString(), ae = /* @__PURE__ */ new WeakMap();
60
+ function Ne(e) {
61
+ if (!e || typeof e != "object")
62
+ return !1;
63
+ const t = Object.getPrototypeOf(e);
64
+ if (t === null || t === Object.prototype)
65
+ return !0;
66
+ const n = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
67
+ if (n === Object)
68
+ return !0;
69
+ if (typeof n != "function")
70
+ return !1;
71
+ let r = ae.get(n);
72
+ return r === void 0 && (r = Function.toString.call(n), ae.set(n, r)), r === je;
73
+ }
74
+ function B(e, t, n = !0) {
75
+ q(e) === 0 ? (n ? Reflect.ownKeys(e) : Object.keys(e)).forEach((o) => {
76
+ t(o, e[o], e);
77
+ }) : e.forEach((r, o) => t(o, r, e));
78
+ }
79
+ function q(e) {
80
+ const t = e[E];
81
+ return t ? t.type_ : Array.isArray(e) ? 1 : A(e) ? 2 : G(e) ? 3 : 0;
82
+ }
83
+ function Z(e, t) {
84
+ return q(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
85
+ }
86
+ function Ee(e, t, n) {
87
+ const r = q(e);
88
+ r === 2 ? e.set(t, n) : r === 3 ? e.add(n) : e[t] = n;
89
+ }
90
+ function Ae(e, t) {
91
+ return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
92
+ }
93
+ function A(e) {
94
+ return e instanceof Map;
95
+ }
96
+ function G(e) {
97
+ return e instanceof Set;
98
+ }
99
+ function O(e) {
100
+ return e.copy_ || e.base_;
101
+ }
102
+ function L(e, t) {
103
+ if (A(e))
104
+ return new Map(e);
105
+ if (G(e))
106
+ return new Set(e);
107
+ if (Array.isArray(e))
108
+ return Array.prototype.slice.call(e);
109
+ const n = Ne(e);
110
+ if (t === !0 || t === "class_only" && !n) {
111
+ const r = Object.getOwnPropertyDescriptors(e);
112
+ delete r[E];
113
+ let o = Reflect.ownKeys(r);
114
+ for (let i = 0; i < o.length; i++) {
115
+ const c = o[i], s = r[c];
116
+ s.writable === !1 && (s.writable = !0, s.configurable = !0), (s.get || s.set) && (r[c] = {
117
+ configurable: !0,
118
+ writable: !0,
119
+ // could live with !!desc.set as well here...
120
+ enumerable: s.enumerable,
121
+ value: e[c]
122
+ });
123
+ }
124
+ return Object.create(M(e), r);
125
+ } else {
126
+ const r = M(e);
127
+ if (r !== null && n)
128
+ return { ...e };
129
+ const o = Object.create(r);
130
+ return Object.assign(o, e);
131
+ }
132
+ }
133
+ function ie(e, t = !1) {
134
+ return Y(e) || R(e) || !S(e) || (q(e) > 1 && Object.defineProperties(e, {
135
+ set: F,
136
+ add: F,
137
+ clear: F,
138
+ delete: F
139
+ }), Object.freeze(e), t && Object.values(e).forEach((n) => ie(n, !0))), e;
140
+ }
141
+ function xe() {
142
+ N(2);
143
+ }
144
+ var F = {
145
+ value: xe
146
+ };
147
+ function Y(e) {
148
+ return e === null || typeof e != "object" ? !0 : Object.isFrozen(e);
149
+ }
150
+ var Fe = {};
151
+ function k(e) {
152
+ const t = Fe[e];
153
+ return t || N(0, e), t;
154
+ }
155
+ var z;
156
+ function be() {
157
+ return z;
158
+ }
159
+ function Ve(e, t) {
160
+ return {
161
+ drafts_: [],
162
+ parent_: e,
163
+ immer_: t,
164
+ // Whenever the modified draft contains a draft from another scope, we
165
+ // need to prevent auto-freezing so the unowned draft can be finalized.
166
+ canAutoFreeze_: !0,
167
+ unfinalizedDrafts_: 0
168
+ };
169
+ }
170
+ function fe(e, t) {
171
+ t && (k("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
172
+ }
173
+ function ee(e) {
174
+ te(e), e.drafts_.forEach($e), e.drafts_ = null;
175
+ }
176
+ function te(e) {
177
+ e === z && (z = e.parent_);
178
+ }
179
+ function le(e) {
180
+ return z = Ve(z, e);
181
+ }
182
+ function $e(e) {
183
+ const t = e[E];
184
+ t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
185
+ }
186
+ function de(e, t) {
187
+ t.unfinalizedDrafts_ = t.drafts_.length;
188
+ const n = t.drafts_[0];
189
+ return e !== void 0 && e !== n ? (n[E].modified_ && (ee(t), N(4)), S(e) && (e = U(t, e), t.parent_ || K(t, e)), t.patches_ && k("Patches").generateReplacementPatches_(
190
+ n[E].base_,
191
+ e,
192
+ t.patches_,
193
+ t.inversePatches_
194
+ )) : e = U(t, n, []), ee(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== we ? e : void 0;
195
+ }
196
+ function U(e, t, n) {
197
+ if (Y(t))
198
+ return t;
199
+ const r = e.immer_.shouldUseStrictIteration(), o = t[E];
200
+ if (!o)
201
+ return B(
202
+ t,
203
+ (i, c) => pe(e, o, t, i, c, n),
204
+ r
205
+ ), t;
206
+ if (o.scope_ !== e)
207
+ return t;
208
+ if (!o.modified_)
209
+ return K(e, o.base_, !0), o.base_;
210
+ if (!o.finalized_) {
211
+ o.finalized_ = !0, o.scope_.unfinalizedDrafts_--;
212
+ const i = o.copy_;
213
+ let c = i, s = !1;
214
+ o.type_ === 3 && (c = new Set(i), i.clear(), s = !0), B(
215
+ c,
216
+ (f, a) => pe(
217
+ e,
218
+ o,
219
+ i,
220
+ f,
221
+ a,
222
+ n,
223
+ s
224
+ ),
225
+ r
226
+ ), K(e, i, !1), n && e.patches_ && k("Patches").generatePatches_(
227
+ o,
228
+ n,
229
+ e.patches_,
230
+ e.inversePatches_
231
+ );
232
+ }
233
+ return o.copy_;
234
+ }
235
+ function pe(e, t, n, r, o, i, c) {
236
+ if (o == null || typeof o != "object" && !c)
237
+ return;
238
+ const s = Y(o);
239
+ if (!(s && !c)) {
240
+ if (process.env.NODE_ENV !== "production" && o === n && N(5), R(o)) {
241
+ const f = i && t && t.type_ !== 3 && // Set objects are atomic since they have no keys.
242
+ !Z(t.assigned_, r) ? i.concat(r) : void 0, a = U(e, o, f);
243
+ if (Ee(n, r, a), R(a))
244
+ e.canAutoFreeze_ = !1;
245
+ else
246
+ return;
247
+ } else c && n.add(o);
248
+ if (S(o) && !s) {
249
+ if (!e.immer_.autoFreeze_ && e.unfinalizedDrafts_ < 1 || t && t.base_ && t.base_[r] === o && s)
250
+ return;
251
+ U(e, o), (!t || !t.scope_.parent_) && typeof r != "symbol" && (A(n) ? n.has(r) : Object.prototype.propertyIsEnumerable.call(n, r)) && K(e, o);
252
+ }
253
+ }
254
+ }
255
+ function K(e, t, n = !1) {
256
+ !e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && ie(t, n);
257
+ }
258
+ function We(e, t) {
259
+ const n = Array.isArray(e), r = {
260
+ type_: n ? 1 : 0,
261
+ // Track which produce call this is associated with.
262
+ scope_: t ? t.scope_ : be(),
263
+ // True for both shallow and deep changes.
264
+ modified_: !1,
265
+ // Used during finalization.
266
+ finalized_: !1,
267
+ // Track which properties have been assigned (true) or deleted (false).
268
+ assigned_: {},
269
+ // The parent draft state.
270
+ parent_: t,
271
+ // The base state.
272
+ base_: e,
273
+ // The base proxy.
274
+ draft_: null,
275
+ // set below
276
+ // The base copy with any updated values.
277
+ copy_: null,
278
+ // Called by the `produce` function.
279
+ revoke_: null,
280
+ isManual_: !1
281
+ };
282
+ let o = r, i = ce;
283
+ n && (o = [r], i = j);
284
+ const { revoke: c, proxy: s } = Proxy.revocable(o, i);
285
+ return r.draft_ = s, r.revoke_ = c, s;
286
+ }
287
+ var ce = {
288
+ get(e, t) {
289
+ if (t === E)
290
+ return e;
291
+ const n = O(e);
292
+ if (!Z(n, t))
293
+ return Be(e, n, t);
294
+ const r = n[t];
295
+ return e.finalized_ || !S(r) ? r : r === J(e.base_, t) ? (Q(e), e.copy_[t] = re(r, e)) : r;
296
+ },
297
+ has(e, t) {
298
+ return t in O(e);
299
+ },
300
+ ownKeys(e) {
301
+ return Reflect.ownKeys(O(e));
302
+ },
303
+ set(e, t, n) {
304
+ const r = ve(O(e), t);
305
+ if (r?.set)
306
+ return r.set.call(e.draft_, n), !0;
307
+ if (!e.modified_) {
308
+ const o = J(O(e), t), i = o?.[E];
309
+ if (i && i.base_ === n)
310
+ return e.copy_[t] = n, e.assigned_[t] = !1, !0;
311
+ if (Ae(n, o) && (n !== void 0 || Z(e.base_, t)))
312
+ return !0;
313
+ Q(e), ne(e);
314
+ }
315
+ return e.copy_[t] === n && // special case: handle new props with value 'undefined'
316
+ (n !== void 0 || t in e.copy_) || // special case: NaN
317
+ Number.isNaN(n) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = n, e.assigned_[t] = !0), !0;
318
+ },
319
+ deleteProperty(e, t) {
320
+ return J(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_[t] = !1, Q(e), ne(e)) : delete e.assigned_[t], e.copy_ && delete e.copy_[t], !0;
321
+ },
322
+ // Note: We never coerce `desc.value` into an Immer draft, because we can't make
323
+ // the same guarantee in ES5 mode.
324
+ getOwnPropertyDescriptor(e, t) {
325
+ const n = O(e), r = Reflect.getOwnPropertyDescriptor(n, t);
326
+ return r && {
327
+ writable: !0,
328
+ configurable: e.type_ !== 1 || t !== "length",
329
+ enumerable: r.enumerable,
330
+ value: n[t]
331
+ };
332
+ },
333
+ defineProperty() {
334
+ N(11);
335
+ },
336
+ getPrototypeOf(e) {
337
+ return M(e.base_);
338
+ },
339
+ setPrototypeOf() {
340
+ N(12);
341
+ }
342
+ }, j = {};
343
+ B(ce, (e, t) => {
344
+ j[e] = function() {
345
+ return arguments[0] = arguments[0][0], t.apply(this, arguments);
346
+ };
347
+ });
348
+ j.deleteProperty = function(e, t) {
349
+ return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && N(13), j.set.call(this, e, t, void 0);
350
+ };
351
+ j.set = function(e, t, n) {
352
+ return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && N(14), ce.set.call(this, e[0], t, n, e[0]);
353
+ };
354
+ function J(e, t) {
355
+ const n = e[E];
356
+ return (n ? O(n) : e)[t];
357
+ }
358
+ function Be(e, t, n) {
359
+ const r = ve(t, n);
360
+ return r ? "value" in r ? r.value : (
361
+ // This is a very special case, if the prop is a getter defined by the
362
+ // prototype, we should invoke it with the draft as context!
363
+ r.get?.call(e.draft_)
364
+ ) : void 0;
365
+ }
366
+ function ve(e, t) {
367
+ if (!(t in e))
368
+ return;
369
+ let n = M(e);
370
+ for (; n; ) {
371
+ const r = Object.getOwnPropertyDescriptor(n, t);
372
+ if (r)
373
+ return r;
374
+ n = M(n);
375
+ }
376
+ }
377
+ function ne(e) {
378
+ e.modified_ || (e.modified_ = !0, e.parent_ && ne(e.parent_));
379
+ }
380
+ function Q(e) {
381
+ e.copy_ || (e.copy_ = L(
382
+ e.base_,
383
+ e.scope_.immer_.useStrictShallowCopy_
384
+ ));
385
+ }
386
+ var Ue = class {
387
+ constructor(e) {
388
+ this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !0, this.produce = (t, n, r) => {
389
+ if (typeof t == "function" && typeof n != "function") {
390
+ const i = n;
391
+ n = t;
392
+ const c = this;
393
+ return function(f = i, ...a) {
394
+ return c.produce(f, (u) => n.call(this, u, ...a));
395
+ };
396
+ }
397
+ typeof n != "function" && N(6), r !== void 0 && typeof r != "function" && N(7);
398
+ let o;
399
+ if (S(t)) {
400
+ const i = le(this), c = re(t, void 0);
401
+ let s = !0;
402
+ try {
403
+ o = n(c), s = !1;
404
+ } finally {
405
+ s ? ee(i) : te(i);
406
+ }
407
+ return fe(i, r), de(o, i);
408
+ } else if (!t || typeof t != "object") {
409
+ if (o = n(t), o === void 0 && (o = t), o === we && (o = void 0), this.autoFreeze_ && ie(o, !0), r) {
410
+ const i = [], c = [];
411
+ k("Patches").generateReplacementPatches_(t, o, i, c), r(i, c);
412
+ }
413
+ return o;
414
+ } else
415
+ N(1, t);
416
+ }, this.produceWithPatches = (t, n) => {
417
+ if (typeof t == "function")
418
+ return (c, ...s) => this.produceWithPatches(c, (f) => t(f, ...s));
419
+ let r, o;
420
+ return [this.produce(t, n, (c, s) => {
421
+ r = c, o = s;
422
+ }), r, o];
423
+ }, typeof e?.autoFreeze == "boolean" && this.setAutoFreeze(e.autoFreeze), typeof e?.useStrictShallowCopy == "boolean" && this.setUseStrictShallowCopy(e.useStrictShallowCopy), typeof e?.useStrictIteration == "boolean" && this.setUseStrictIteration(e.useStrictIteration);
424
+ }
425
+ createDraft(e) {
426
+ S(e) || N(8), R(e) && (e = Ke(e));
427
+ const t = le(this), n = re(e, void 0);
428
+ return n[E].isManual_ = !0, te(t), n;
429
+ }
430
+ finishDraft(e, t) {
431
+ const n = e && e[E];
432
+ (!n || !n.isManual_) && N(9);
433
+ const { scope_: r } = n;
434
+ return fe(r, t), de(void 0, r);
435
+ }
436
+ /**
437
+ * Pass true to automatically freeze all copies created by Immer.
438
+ *
439
+ * By default, auto-freezing is enabled.
440
+ */
441
+ setAutoFreeze(e) {
442
+ this.autoFreeze_ = e;
443
+ }
444
+ /**
445
+ * Pass true to enable strict shallow copy.
446
+ *
447
+ * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
448
+ */
449
+ setUseStrictShallowCopy(e) {
450
+ this.useStrictShallowCopy_ = e;
451
+ }
452
+ /**
453
+ * Pass false to use faster iteration that skips non-enumerable properties
454
+ * but still handles symbols for compatibility.
455
+ *
456
+ * By default, strict iteration is enabled (includes all own properties).
457
+ */
458
+ setUseStrictIteration(e) {
459
+ this.useStrictIteration_ = e;
460
+ }
461
+ shouldUseStrictIteration() {
462
+ return this.useStrictIteration_;
463
+ }
464
+ applyPatches(e, t) {
465
+ let n;
466
+ for (n = t.length - 1; n >= 0; n--) {
467
+ const o = t[n];
468
+ if (o.path.length === 0 && o.op === "replace") {
469
+ e = o.value;
470
+ break;
471
+ }
472
+ }
473
+ n > -1 && (t = t.slice(n + 1));
474
+ const r = k("Patches").applyPatches_;
475
+ return R(e) ? r(e, t) : this.produce(
476
+ e,
477
+ (o) => r(o, t)
478
+ );
479
+ }
480
+ };
481
+ function re(e, t) {
482
+ const n = A(e) ? k("MapSet").proxyMap_(e, t) : G(e) ? k("MapSet").proxySet_(e, t) : We(e, t);
483
+ return (t ? t.scope_ : be()).drafts_.push(n), n;
484
+ }
485
+ function Ke(e) {
486
+ return R(e) || N(10, e), Ce(e);
487
+ }
488
+ function Ce(e) {
489
+ if (!S(e) || Y(e))
490
+ return e;
491
+ const t = e[E];
492
+ let n, r = !0;
493
+ if (t) {
494
+ if (!t.modified_)
495
+ return t.base_;
496
+ t.finalized_ = !0, n = L(e, t.scope_.immer_.useStrictShallowCopy_), r = t.scope_.immer_.shouldUseStrictIteration();
497
+ } else
498
+ n = L(e, !0);
499
+ return B(
500
+ n,
501
+ (o, i) => {
502
+ Ee(n, o, Ce(i));
503
+ },
504
+ r
505
+ ), t && (t.finalized_ = !1), n;
506
+ }
507
+ var oe = new Ue(), Se = oe.produce, qe = /* @__PURE__ */ oe.setUseStrictIteration.bind(
508
+ oe
509
+ ), Ge = (e, t, n) => {
510
+ if (t.length === 1 && t[0] === n) {
511
+ let r = !1;
512
+ try {
513
+ const o = {};
514
+ e(o) === o && (r = !0);
515
+ } catch {
516
+ }
517
+ if (r) {
518
+ let o;
519
+ try {
520
+ throw new Error();
521
+ } catch (i) {
522
+ ({ stack: o } = i);
523
+ }
524
+ console.warn(
525
+ `The result function returned its own inputs without modification. e.g
526
+ \`createSelector([state => state.todos], todos => todos)\`
527
+ This could lead to inefficient memoization and unnecessary re-renders.
528
+ Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,
529
+ { stack: o }
530
+ );
531
+ }
532
+ }
533
+ }, Ye = (e, t, n) => {
534
+ const { memoize: r, memoizeOptions: o } = t, { inputSelectorResults: i, inputSelectorResultsCopy: c } = e, s = r(() => ({}), ...o);
535
+ if (!(s.apply(null, i) === s.apply(null, c))) {
536
+ let a;
537
+ try {
538
+ throw new Error();
539
+ } catch (u) {
540
+ ({ stack: a } = u);
541
+ }
542
+ console.warn(
543
+ `An input selector returned a different result when passed same arguments.
544
+ This means your output selector will likely run more frequently than intended.
545
+ Avoid returning a new reference inside your input selector, e.g.
546
+ \`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,
547
+ {
548
+ arguments: n,
549
+ firstInputs: i,
550
+ secondInputs: c,
551
+ stack: a
552
+ }
553
+ );
554
+ }
555
+ }, He = {
556
+ inputStabilityCheck: "once",
557
+ identityFunctionCheck: "once"
558
+ };
559
+ function Xe(e, t = `expected a function, instead received ${typeof e}`) {
560
+ if (typeof e != "function")
561
+ throw new TypeError(t);
562
+ }
563
+ function Je(e, t = `expected an object, instead received ${typeof e}`) {
564
+ if (typeof e != "object")
565
+ throw new TypeError(t);
566
+ }
567
+ function Qe(e, t = "expected all items to be functions, instead received the following types: ") {
568
+ if (!e.every((n) => typeof n == "function")) {
569
+ const n = e.map(
570
+ (r) => typeof r == "function" ? `function ${r.name || "unnamed"}()` : typeof r
571
+ ).join(", ");
572
+ throw new TypeError(`${t}[${n}]`);
573
+ }
574
+ }
575
+ var ye = (e) => Array.isArray(e) ? e : [e];
576
+ function Ze(e) {
577
+ const t = Array.isArray(e[0]) ? e[0] : e;
578
+ return Qe(
579
+ t,
580
+ "createSelector expects all input-selectors to be functions, but received the following types: "
581
+ ), t;
582
+ }
583
+ function he(e, t) {
584
+ const n = [], { length: r } = e;
585
+ for (let o = 0; o < r; o++)
586
+ n.push(e[o].apply(null, t));
587
+ return n;
588
+ }
589
+ var Le = (e, t) => {
590
+ const { identityFunctionCheck: n, inputStabilityCheck: r } = {
591
+ ...He,
592
+ ...t
593
+ };
594
+ return {
595
+ identityFunctionCheck: {
596
+ shouldRun: n === "always" || n === "once" && e,
597
+ run: Ge
598
+ },
599
+ inputStabilityCheck: {
600
+ shouldRun: r === "always" || r === "once" && e,
601
+ run: Ye
602
+ }
603
+ };
604
+ }, et = class {
605
+ constructor(e) {
606
+ this.value = e;
607
+ }
608
+ deref() {
609
+ return this.value;
610
+ }
611
+ }, tt = typeof WeakRef < "u" ? WeakRef : et, nt = 0, me = 1;
612
+ function V() {
613
+ return {
614
+ s: nt,
615
+ v: void 0,
616
+ o: null,
617
+ p: null
618
+ };
619
+ }
620
+ function De(e, t = {}) {
621
+ let n = V();
622
+ const { resultEqualityCheck: r } = t;
623
+ let o, i = 0;
624
+ function c() {
625
+ let s = n;
626
+ const { length: f } = arguments;
627
+ for (let p = 0, b = f; p < b; p++) {
628
+ const g = arguments[p];
629
+ if (typeof g == "function" || typeof g == "object" && g !== null) {
630
+ let y = s.o;
631
+ y === null && (s.o = y = /* @__PURE__ */ new WeakMap());
632
+ const v = y.get(g);
633
+ v === void 0 ? (s = V(), y.set(g, s)) : s = v;
634
+ } else {
635
+ let y = s.p;
636
+ y === null && (s.p = y = /* @__PURE__ */ new Map());
637
+ const v = y.get(g);
638
+ v === void 0 ? (s = V(), y.set(g, s)) : s = v;
639
+ }
640
+ }
641
+ const a = s;
642
+ let u;
643
+ if (s.s === me)
644
+ u = s.v;
645
+ else if (u = e.apply(null, arguments), i++, r) {
646
+ const p = o?.deref?.() ?? o;
647
+ p != null && r(p, u) && (u = p, i !== 0 && i--), o = typeof u == "object" && u !== null || typeof u == "function" ? new tt(u) : u;
648
+ }
649
+ return a.s = me, a.v = u, u;
650
+ }
651
+ return c.clearCache = () => {
652
+ n = V(), c.resetResultsCount();
653
+ }, c.resultsCount = () => i, c.resetResultsCount = () => {
654
+ i = 0;
655
+ }, c;
656
+ }
657
+ function rt(e, ...t) {
658
+ const n = typeof e == "function" ? {
659
+ memoize: e,
660
+ memoizeOptions: t
661
+ } : e, r = (...o) => {
662
+ let i = 0, c = 0, s, f = {}, a = o.pop();
663
+ typeof a == "object" && (f = a, a = o.pop()), Xe(
664
+ a,
665
+ `createSelector expects an output function after the inputs, but received: [${typeof a}]`
666
+ );
667
+ const u = {
668
+ ...n,
669
+ ...f
670
+ }, {
671
+ memoize: p,
672
+ memoizeOptions: b = [],
673
+ argsMemoize: g = De,
674
+ argsMemoizeOptions: y = [],
675
+ devModeChecks: v = {}
676
+ } = u, P = ye(b), x = ye(y), I = Ze(o), l = p(function() {
677
+ return i++, a.apply(
678
+ null,
679
+ arguments
680
+ );
681
+ }, ...P);
682
+ let d = !0;
683
+ const h = g(function() {
684
+ c++;
685
+ const w = he(
686
+ I,
687
+ arguments
688
+ );
689
+ if (s = l.apply(null, w), process.env.NODE_ENV !== "production") {
690
+ const { identityFunctionCheck: m, inputStabilityCheck: T } = Le(d, v);
691
+ if (m.shouldRun && m.run(
692
+ a,
693
+ w,
694
+ s
695
+ ), T.shouldRun) {
696
+ const X = he(
697
+ I,
698
+ arguments
699
+ );
700
+ T.run(
701
+ { inputSelectorResults: w, inputSelectorResultsCopy: X },
702
+ { memoize: p, memoizeOptions: P },
703
+ arguments
704
+ );
705
+ }
706
+ d && (d = !1);
707
+ }
708
+ return s;
709
+ }, ...x);
710
+ return Object.assign(h, {
711
+ resultFunc: a,
712
+ memoizedResultFunc: l,
713
+ dependencies: I,
714
+ dependencyRecomputations: () => c,
715
+ resetDependencyRecomputations: () => {
716
+ c = 0;
717
+ },
718
+ lastResult: () => s,
719
+ recomputations: () => i,
720
+ resetRecomputations: () => {
721
+ i = 0;
722
+ },
723
+ memoize: p,
724
+ argsMemoize: g
725
+ });
726
+ };
727
+ return Object.assign(r, {
728
+ withTypes: () => r
729
+ }), r;
730
+ }
731
+ var D = /* @__PURE__ */ rt(De), ot = Object.assign(
732
+ (e, t = D) => {
733
+ Je(
734
+ e,
735
+ `createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`
736
+ );
737
+ const n = Object.keys(e), r = n.map(
738
+ (i) => e[i]
739
+ );
740
+ return t(
741
+ r,
742
+ (...i) => i.reduce((c, s, f) => (c[n[f]] = s, c), {})
743
+ );
744
+ },
745
+ { withTypes: () => ot }
746
+ );
747
+ function _e(e, t) {
748
+ function n(...r) {
749
+ if (t) {
750
+ let o = t(...r);
751
+ if (!o)
752
+ throw new Error(process.env.NODE_ENV === "production" ? _(0) : "prepareAction did not return an object");
753
+ return {
754
+ type: e,
755
+ payload: o.payload,
756
+ ..."meta" in o && {
757
+ meta: o.meta
758
+ },
759
+ ..."error" in o && {
760
+ error: o.error
761
+ }
762
+ };
763
+ }
764
+ return {
765
+ type: e,
766
+ payload: r[0]
767
+ };
768
+ }
769
+ return n.toString = () => `${e}`, n.type = e, n.match = (r) => Me(r) && r.type === e, n;
770
+ }
771
+ function ge(e) {
772
+ return S(e) ? Se(e, () => {
773
+ }) : e;
774
+ }
775
+ function $(e, t, n) {
776
+ return e.has(t) ? e.get(t) : e.set(t, n(t)).get(t);
777
+ }
778
+ function Oe(e) {
779
+ const t = {}, n = [];
780
+ let r;
781
+ const o = {
782
+ addCase(i, c) {
783
+ if (process.env.NODE_ENV !== "production") {
784
+ if (n.length > 0)
785
+ throw new Error(process.env.NODE_ENV === "production" ? _(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
786
+ if (r)
787
+ throw new Error(process.env.NODE_ENV === "production" ? _(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
788
+ }
789
+ const s = typeof i == "string" ? i : i.type;
790
+ if (!s)
791
+ throw new Error(process.env.NODE_ENV === "production" ? _(28) : "`builder.addCase` cannot be called with an empty action type");
792
+ if (s in t)
793
+ throw new Error(process.env.NODE_ENV === "production" ? _(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);
794
+ return t[s] = c, o;
795
+ },
796
+ addAsyncThunk(i, c) {
797
+ if (process.env.NODE_ENV !== "production" && r)
798
+ throw new Error(process.env.NODE_ENV === "production" ? _(43) : "`builder.addAsyncThunk` should only be called before calling `builder.addDefaultCase`");
799
+ return c.pending && (t[i.pending.type] = c.pending), c.rejected && (t[i.rejected.type] = c.rejected), c.fulfilled && (t[i.fulfilled.type] = c.fulfilled), c.settled && n.push({
800
+ matcher: i.settled,
801
+ reducer: c.settled
802
+ }), o;
803
+ },
804
+ addMatcher(i, c) {
805
+ if (process.env.NODE_ENV !== "production" && r)
806
+ throw new Error(process.env.NODE_ENV === "production" ? _(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
807
+ return n.push({
808
+ matcher: i,
809
+ reducer: c
810
+ }), o;
811
+ },
812
+ addDefaultCase(i) {
813
+ if (process.env.NODE_ENV !== "production" && r)
814
+ throw new Error(process.env.NODE_ENV === "production" ? _(31) : "`builder.addDefaultCase` can only be called once");
815
+ return r = i, o;
816
+ }
817
+ };
818
+ return e(o), [t, n, r];
819
+ }
820
+ qe(!1);
821
+ function it(e) {
822
+ return typeof e == "function";
823
+ }
824
+ function ct(e, t) {
825
+ if (process.env.NODE_ENV !== "production" && typeof t == "object")
826
+ throw new Error(process.env.NODE_ENV === "production" ? _(8) : "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
827
+ let [n, r, o] = Oe(t), i;
828
+ if (it(e))
829
+ i = () => ge(e());
830
+ else {
831
+ const s = ge(e);
832
+ i = () => s;
833
+ }
834
+ function c(s = i(), f) {
835
+ let a = [n[f.type], ...r.filter(({
836
+ matcher: u
837
+ }) => u(f)).map(({
838
+ reducer: u
839
+ }) => u)];
840
+ return a.filter((u) => !!u).length === 0 && (a = [o]), a.reduce((u, p) => {
841
+ if (p)
842
+ if (R(u)) {
843
+ const g = p(u, f);
844
+ return g === void 0 ? u : g;
845
+ } else {
846
+ if (S(u))
847
+ return Se(u, (b) => p(b, f));
848
+ {
849
+ const b = p(u, f);
850
+ if (b === void 0) {
851
+ if (u === null)
852
+ return u;
853
+ throw Error("A case reducer on a non-draftable value must not return undefined");
854
+ }
855
+ return b;
856
+ }
857
+ }
858
+ return u;
859
+ }, s);
860
+ }
861
+ return c.getInitialState = i, c;
862
+ }
863
+ var st = /* @__PURE__ */ Symbol.for("rtk-slice-createasyncthunk");
864
+ function ut(e, t) {
865
+ return `${e}/${t}`;
866
+ }
867
+ function at({
868
+ creators: e
869
+ } = {}) {
870
+ const t = e?.asyncThunk?.[st];
871
+ return function(r) {
872
+ const {
873
+ name: o,
874
+ reducerPath: i = o
875
+ } = r;
876
+ if (!o)
877
+ throw new Error(process.env.NODE_ENV === "production" ? _(11) : "`name` is a required option for createSlice");
878
+ typeof process < "u" && process.env.NODE_ENV === "development" && r.initialState === void 0 && console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
879
+ const c = (typeof r.reducers == "function" ? r.reducers(dt()) : r.reducers) || {}, s = Object.keys(c), f = {
880
+ sliceCaseReducersByName: {},
881
+ sliceCaseReducersByType: {},
882
+ actionCreators: {},
883
+ sliceMatchers: []
884
+ }, a = {
885
+ addCase(l, d) {
886
+ const h = typeof l == "string" ? l : l.type;
887
+ if (!h)
888
+ throw new Error(process.env.NODE_ENV === "production" ? _(12) : "`context.addCase` cannot be called with an empty action type");
889
+ if (h in f.sliceCaseReducersByType)
890
+ throw new Error(process.env.NODE_ENV === "production" ? _(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + h);
891
+ return f.sliceCaseReducersByType[h] = d, a;
892
+ },
893
+ addMatcher(l, d) {
894
+ return f.sliceMatchers.push({
895
+ matcher: l,
896
+ reducer: d
897
+ }), a;
898
+ },
899
+ exposeAction(l, d) {
900
+ return f.actionCreators[l] = d, a;
901
+ },
902
+ exposeCaseReducer(l, d) {
903
+ return f.sliceCaseReducersByName[l] = d, a;
904
+ }
905
+ };
906
+ s.forEach((l) => {
907
+ const d = c[l], h = {
908
+ reducerName: l,
909
+ type: ut(o, l),
910
+ createNotation: typeof r.reducers == "function"
911
+ };
912
+ yt(d) ? mt(h, d, a, t) : pt(h, d, a);
913
+ });
914
+ function u() {
915
+ if (process.env.NODE_ENV !== "production" && typeof r.extraReducers == "object")
916
+ throw new Error(process.env.NODE_ENV === "production" ? _(14) : "The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
917
+ const [l = {}, d = [], h = void 0] = typeof r.extraReducers == "function" ? Oe(r.extraReducers) : [r.extraReducers], C = {
918
+ ...l,
919
+ ...f.sliceCaseReducersByType
920
+ };
921
+ return ct(r.initialState, (w) => {
922
+ for (let m in C)
923
+ w.addCase(m, C[m]);
924
+ for (let m of f.sliceMatchers)
925
+ w.addMatcher(m.matcher, m.reducer);
926
+ for (let m of d)
927
+ w.addMatcher(m.matcher, m.reducer);
928
+ h && w.addDefaultCase(h);
929
+ });
930
+ }
931
+ const p = (l) => l, b = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new WeakMap();
932
+ let y;
933
+ function v(l, d) {
934
+ return y || (y = u()), y(l, d);
935
+ }
936
+ function P() {
937
+ return y || (y = u()), y.getInitialState();
938
+ }
939
+ function x(l, d = !1) {
940
+ function h(w) {
941
+ let m = w[l];
942
+ if (typeof m > "u") {
943
+ if (d)
944
+ m = $(g, h, P);
945
+ else if (process.env.NODE_ENV !== "production")
946
+ throw new Error(process.env.NODE_ENV === "production" ? _(15) : "selectSlice returned undefined for an uninjected slice reducer");
947
+ }
948
+ return m;
949
+ }
950
+ function C(w = p) {
951
+ const m = $(b, d, () => /* @__PURE__ */ new WeakMap());
952
+ return $(m, w, () => {
953
+ const T = {};
954
+ for (const [X, Ie] of Object.entries(r.selectors ?? {}))
955
+ T[X] = ft(Ie, w, () => $(g, w, P), d);
956
+ return T;
957
+ });
958
+ }
959
+ return {
960
+ reducerPath: l,
961
+ getSelectors: C,
962
+ get selectors() {
963
+ return C(h);
964
+ },
965
+ selectSlice: h
966
+ };
967
+ }
968
+ const I = {
969
+ name: o,
970
+ reducer: v,
971
+ actions: f.actionCreators,
972
+ caseReducers: f.sliceCaseReducersByName,
973
+ getInitialState: P,
974
+ ...x(i),
975
+ injectInto(l, {
976
+ reducerPath: d,
977
+ ...h
978
+ } = {}) {
979
+ const C = d ?? i;
980
+ return l.inject({
981
+ reducerPath: C,
982
+ reducer: v
983
+ }, h), {
984
+ ...I,
985
+ ...x(C, !0)
986
+ };
987
+ }
988
+ };
989
+ return I;
990
+ };
991
+ }
992
+ function ft(e, t, n, r) {
993
+ function o(i, ...c) {
994
+ let s = t(i);
995
+ if (typeof s > "u") {
996
+ if (r)
997
+ s = n();
998
+ else if (process.env.NODE_ENV !== "production")
999
+ throw new Error(process.env.NODE_ENV === "production" ? _(16) : "selectState returned undefined for an uninjected slice reducer");
1000
+ }
1001
+ return e(s, ...c);
1002
+ }
1003
+ return o.unwrapped = e, o;
1004
+ }
1005
+ var lt = /* @__PURE__ */ at();
1006
+ function dt() {
1007
+ function e(t, n) {
1008
+ return {
1009
+ _reducerDefinitionType: "asyncThunk",
1010
+ payloadCreator: t,
1011
+ ...n
1012
+ };
1013
+ }
1014
+ return e.withTypes = () => e, {
1015
+ reducer(t) {
1016
+ return Object.assign({
1017
+ // hack so the wrapping function has the same name as the original
1018
+ // we need to create a wrapper so the `reducerDefinitionType` is not assigned to the original
1019
+ [t.name](...n) {
1020
+ return t(...n);
1021
+ }
1022
+ }[t.name], {
1023
+ _reducerDefinitionType: "reducer"
1024
+ /* reducer */
1025
+ });
1026
+ },
1027
+ preparedReducer(t, n) {
1028
+ return {
1029
+ _reducerDefinitionType: "reducerWithPrepare",
1030
+ prepare: t,
1031
+ reducer: n
1032
+ };
1033
+ },
1034
+ asyncThunk: e
1035
+ };
1036
+ }
1037
+ function pt({
1038
+ type: e,
1039
+ reducerName: t,
1040
+ createNotation: n
1041
+ }, r, o) {
1042
+ let i, c;
1043
+ if ("reducer" in r) {
1044
+ if (n && !ht(r))
1045
+ throw new Error(process.env.NODE_ENV === "production" ? _(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
1046
+ i = r.reducer, c = r.prepare;
1047
+ } else
1048
+ i = r;
1049
+ o.addCase(e, i).exposeCaseReducer(t, i).exposeAction(t, c ? _e(e, c) : _e(e));
1050
+ }
1051
+ function yt(e) {
1052
+ return e._reducerDefinitionType === "asyncThunk";
1053
+ }
1054
+ function ht(e) {
1055
+ return e._reducerDefinitionType === "reducerWithPrepare";
1056
+ }
1057
+ function mt({
1058
+ type: e,
1059
+ reducerName: t
1060
+ }, n, r, o) {
1061
+ if (!o)
1062
+ throw new Error(process.env.NODE_ENV === "production" ? _(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
1063
+ const {
1064
+ payloadCreator: i,
1065
+ fulfilled: c,
1066
+ pending: s,
1067
+ rejected: f,
1068
+ settled: a,
1069
+ options: u
1070
+ } = n, p = o(e, i, u);
1071
+ r.exposeAction(t, p), c && r.addCase(p.fulfilled, c), s && r.addCase(p.pending, s), f && r.addCase(p.rejected, f), a && r.addMatcher(p.settled, a), r.exposeCaseReducer(t, {
1072
+ fulfilled: c || W,
1073
+ pending: s || W,
1074
+ rejected: f || W,
1075
+ settled: a || W
1076
+ });
1077
+ }
1078
+ function W() {
1079
+ }
1080
+ function _(e) {
1081
+ return `Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `;
1082
+ }
1083
+ const _t = {
1084
+ maxNotifications: 5,
1085
+ autoDismiss: !0,
1086
+ dismissTimeout: 5e3
1087
+ }, gt = {
1088
+ notifications: [],
1089
+ config: _t
1090
+ }, wt = (e, t) => {
1091
+ const n = {
1092
+ ...t.payload,
1093
+ id: Date.now().toString(),
1094
+ timestamp: Date.now(),
1095
+ dismissed: !1
1096
+ };
1097
+ e.notifications.unshift(n), e.config.maxNotifications && e.notifications.length > e.config.maxNotifications && (e.notifications = e.notifications.slice(
1098
+ 0,
1099
+ e.config.maxNotifications
1100
+ ));
1101
+ }, Nt = (e, t) => {
1102
+ const n = e.notifications.find((r) => r.id === t.payload);
1103
+ n && (n.dismissed = !0);
1104
+ }, Et = (e, t) => {
1105
+ e.notifications = e.notifications.filter(
1106
+ (n) => n.id !== t.payload
1107
+ );
1108
+ }, bt = (e) => {
1109
+ e.notifications = [];
1110
+ }, vt = (e, t) => {
1111
+ e.config = { ...e.config, ...t.payload };
1112
+ }, Re = lt({
1113
+ name: "notifications",
1114
+ initialState: gt,
1115
+ reducers: {
1116
+ addNotification: wt,
1117
+ dismissNotification: Nt,
1118
+ removeNotification: Et,
1119
+ clearNotifications: bt,
1120
+ updateConfig: vt
1121
+ }
1122
+ }), {
1123
+ addNotification: H,
1124
+ dismissNotification: St,
1125
+ removeNotification: Dt,
1126
+ clearNotifications: Ot,
1127
+ updateConfig: Rt
1128
+ } = Re.actions, kt = Re.reducer, Pt = (e) => H({ message: e, type: "success" }), It = (e) => H({ message: e, type: "warning" }), Tt = (e) => H({ message: e, type: "error" }), Mt = (e, t) => H({ message: e, type: t }), Ct = "notifications", ke = (e) => e[Ct], se = D(
1129
+ [ke],
1130
+ (e) => e.notifications
1131
+ ), Pe = D(
1132
+ [se],
1133
+ (e) => e.filter((t) => !t.dismissed)
1134
+ ), zt = (e) => D(
1135
+ [se],
1136
+ (t) => t.filter((n) => n.type === e)
1137
+ ), jt = (e) => D(
1138
+ [Pe],
1139
+ (t) => t.filter((n) => n.type === e)
1140
+ ), At = D(
1141
+ [se],
1142
+ (e) => e.length
1143
+ ), xt = D(
1144
+ [Pe],
1145
+ (e) => e.length
1146
+ ), Ft = D(
1147
+ [ke],
1148
+ (e) => e.config
1149
+ );
1150
+ export {
1151
+ Ct as NotificationKey,
1152
+ H as addNotification,
1153
+ Ot as clearNotifications,
1154
+ St as dismissNotification,
1155
+ kt as notificationReducer,
1156
+ Dt as removeNotification,
1157
+ xt as selectActiveNotificationCount,
1158
+ Pe as selectActiveNotifications,
1159
+ jt as selectActiveNotificationsByType,
1160
+ se as selectAllNotifications,
1161
+ Ft as selectNotificationConfig,
1162
+ At as selectNotificationCount,
1163
+ zt as selectNotificationsByType,
1164
+ ke as selectNotificationsState,
1165
+ Tt as showErrorNotification,
1166
+ Mt as showNotification,
1167
+ Pt as showSuccessNotification,
1168
+ It as showWarningNotification,
1169
+ Rt as updateConfig
1170
+ };