hasting-swatchcart-module 0.0.4 → 0.0.6

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 (34) hide show
  1. package/dist/components/SwatchesModule.js +7 -7
  2. package/dist/main.d.ts +1 -1
  3. package/dist/main.js +5 -1
  4. package/dist/src/app/store/rootReducer.js +8 -8
  5. package/dist/src/app/store/store.js +10 -10
  6. package/dist/src/features/Cart/model/cartSlice.js +1 -1
  7. package/dist/src/features/Cart/model/selectors.js +1 -1
  8. package/dist/src/features/MultiProduct/model/multiProductCartSlice.js +1 -1
  9. package/dist/src/features/MultiProduct/model/selectors.js +1 -1
  10. package/dist/src/features/swatches/model/swatchesSlice.js +28 -29
  11. package/dist/src/features/swatches/model/thunks.js +1 -1
  12. package/dist/store/LibraryProvider.d.ts +4 -0
  13. package/dist/store/LibraryProvider.js +9 -0
  14. package/dist/store/rootReducer.d.ts +11 -0
  15. package/dist/store/rootReducer.js +12 -0
  16. package/dist/store/store.d.ts +25 -0
  17. package/dist/store/store.js +17 -0
  18. package/dist/store/withStore.d.ts +2 -0
  19. package/dist/store/withStore.js +9 -0
  20. package/package.json +1 -1
  21. package/dist/_virtual/use-sync-external-store-with-selector.development.js +0 -4
  22. package/dist/_virtual/use-sync-external-store-with-selector.production.js +0 -4
  23. package/dist/_virtual/with-selector.js +0 -5
  24. package/dist/_virtual/with-selector2.js +0 -4
  25. package/dist/node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.js +0 -877
  26. package/dist/node_modules/immer/dist/immer.js +0 -467
  27. package/dist/node_modules/react-redux/dist/react-redux.js +0 -246
  28. package/dist/node_modules/redux/dist/redux.js +0 -258
  29. package/dist/node_modules/redux-thunk/dist/redux-thunk.js +0 -8
  30. package/dist/node_modules/reselect/dist/reselect.js +0 -244
  31. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js +0 -66
  32. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js +0 -65
  33. package/dist/node_modules/use-sync-external-store/with-selector.js +0 -10
  34. package/dist/src/app/providers/StoreProvider.js +0 -7
@@ -1,467 +0,0 @@
1
- var W = Symbol.for("immer-nothing"), R = Symbol.for("immer-draftable"), u = Symbol.for("immer-state"), Q = process.env.NODE_ENV !== "production" ? [
2
- // All error codes, starting by 0:
3
- function(e) {
4
- return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
5
- },
6
- function(e) {
7
- 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}'`;
8
- },
9
- "This object has been frozen and should not be mutated",
10
- function(e) {
11
- return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
12
- },
13
- "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
14
- "Immer forbids circular references",
15
- "The first or second argument to `produce` must be a function",
16
- "The third argument to `produce` must be a function or undefined",
17
- "First argument to `createDraft` must be a plain object, an array, or an immerable object",
18
- "First argument to `finishDraft` must be a draft returned by `createDraft`",
19
- function(e) {
20
- return `'current' expects a draft, got: ${e}`;
21
- },
22
- "Object.defineProperty() cannot be used on an Immer draft",
23
- "Object.setPrototypeOf() cannot be used on an Immer draft",
24
- "Immer only supports deleting array indices",
25
- "Immer only supports setting array indices and the 'length' property",
26
- function(e) {
27
- return `'original' expects a draft, got: ${e}`;
28
- }
29
- // Note: if more errors are added, the errorOffset in Patches.ts should be increased
30
- // See Patches.ts for additional errors
31
- ] : [];
32
- function s(e, ...r) {
33
- if (process.env.NODE_ENV !== "production") {
34
- const t = Q[e], n = typeof t == "function" ? t.apply(null, r) : t;
35
- throw new Error(`[Immer] ${n}`);
36
- }
37
- throw new Error(
38
- `[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
39
- );
40
- }
41
- var y = Object.getPrototypeOf;
42
- function m(e) {
43
- return !!e && !!e[u];
44
- }
45
- function d(e) {
46
- return e ? B(e) || Array.isArray(e) || !!e[R] || !!e.constructor?.[R] || P(e) || v(e) : !1;
47
- }
48
- var Y = Object.prototype.constructor.toString();
49
- function B(e) {
50
- if (!e || typeof e != "object")
51
- return !1;
52
- const r = y(e);
53
- if (r === null)
54
- return !0;
55
- const t = Object.hasOwnProperty.call(r, "constructor") && r.constructor;
56
- return t === Object ? !0 : typeof t == "function" && Function.toString.call(t) === Y;
57
- }
58
- function b(e, r) {
59
- O(e) === 0 ? Reflect.ownKeys(e).forEach((t) => {
60
- r(t, e[t], e);
61
- }) : e.forEach((t, n) => r(n, t, e));
62
- }
63
- function O(e) {
64
- const r = e[u];
65
- return r ? r.type_ : Array.isArray(e) ? 1 : P(e) ? 2 : v(e) ? 3 : 0;
66
- }
67
- function E(e, r) {
68
- return O(e) === 2 ? e.has(r) : Object.prototype.hasOwnProperty.call(e, r);
69
- }
70
- function G(e, r, t) {
71
- const n = O(e);
72
- n === 2 ? e.set(r, t) : n === 3 ? e.add(t) : e[r] = t;
73
- }
74
- function Z(e, r) {
75
- return e === r ? e !== 0 || 1 / e === 1 / r : e !== e && r !== r;
76
- }
77
- function P(e) {
78
- return e instanceof Map;
79
- }
80
- function v(e) {
81
- return e instanceof Set;
82
- }
83
- function l(e) {
84
- return e.copy_ || e.base_;
85
- }
86
- function N(e, r) {
87
- if (P(e))
88
- return new Map(e);
89
- if (v(e))
90
- return new Set(e);
91
- if (Array.isArray(e))
92
- return Array.prototype.slice.call(e);
93
- const t = B(e);
94
- if (r === !0 || r === "class_only" && !t) {
95
- const n = Object.getOwnPropertyDescriptors(e);
96
- delete n[u];
97
- let i = Reflect.ownKeys(n);
98
- for (let o = 0; o < i.length; o++) {
99
- const c = i[o], f = n[c];
100
- f.writable === !1 && (f.writable = !0, f.configurable = !0), (f.get || f.set) && (n[c] = {
101
- configurable: !0,
102
- writable: !0,
103
- // could live with !!desc.set as well here...
104
- enumerable: f.enumerable,
105
- value: e[c]
106
- });
107
- }
108
- return Object.create(y(e), n);
109
- } else {
110
- const n = y(e);
111
- if (n !== null && t)
112
- return { ...e };
113
- const i = Object.create(n);
114
- return Object.assign(i, e);
115
- }
116
- }
117
- function T(e, r = !1) {
118
- return D(e) || m(e) || !d(e) || (O(e) > 1 && Object.defineProperties(e, {
119
- set: { value: g },
120
- add: { value: g },
121
- clear: { value: g },
122
- delete: { value: g }
123
- }), Object.freeze(e), r && Object.values(e).forEach((t) => T(t, !0))), e;
124
- }
125
- function g() {
126
- s(2);
127
- }
128
- function D(e) {
129
- return Object.isFrozen(e);
130
- }
131
- var L = {};
132
- function _(e) {
133
- const r = L[e];
134
- return r || s(0, e), r;
135
- }
136
- var h;
137
- function U() {
138
- return h;
139
- }
140
- function V(e, r) {
141
- return {
142
- drafts_: [],
143
- parent_: e,
144
- immer_: r,
145
- // Whenever the modified draft contains a draft from another scope, we
146
- // need to prevent auto-freezing so the unowned draft can be finalized.
147
- canAutoFreeze_: !0,
148
- unfinalizedDrafts_: 0
149
- };
150
- }
151
- function j(e, r) {
152
- r && (_("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = r);
153
- }
154
- function A(e) {
155
- I(e), e.drafts_.forEach(ee), e.drafts_ = null;
156
- }
157
- function I(e) {
158
- e === h && (h = e.parent_);
159
- }
160
- function x(e) {
161
- return h = V(h, e);
162
- }
163
- function ee(e) {
164
- const r = e[u];
165
- r.type_ === 0 || r.type_ === 1 ? r.revoke_() : r.revoked_ = !0;
166
- }
167
- function $(e, r) {
168
- r.unfinalizedDrafts_ = r.drafts_.length;
169
- const t = r.drafts_[0];
170
- return e !== void 0 && e !== t ? (t[u].modified_ && (A(r), s(4)), d(e) && (e = w(r, e), r.parent_ || z(r, e)), r.patches_ && _("Patches").generateReplacementPatches_(
171
- t[u].base_,
172
- e,
173
- r.patches_,
174
- r.inversePatches_
175
- )) : e = w(r, t, []), A(r), r.patches_ && r.patchListener_(r.patches_, r.inversePatches_), e !== W ? e : void 0;
176
- }
177
- function w(e, r, t) {
178
- if (D(r))
179
- return r;
180
- const n = r[u];
181
- if (!n)
182
- return b(
183
- r,
184
- (i, o) => K(e, n, r, i, o, t)
185
- ), r;
186
- if (n.scope_ !== e)
187
- return r;
188
- if (!n.modified_)
189
- return z(e, n.base_, !0), n.base_;
190
- if (!n.finalized_) {
191
- n.finalized_ = !0, n.scope_.unfinalizedDrafts_--;
192
- const i = n.copy_;
193
- let o = i, c = !1;
194
- n.type_ === 3 && (o = new Set(i), i.clear(), c = !0), b(
195
- o,
196
- (f, a) => K(e, n, i, f, a, t, c)
197
- ), z(e, i, !1), t && e.patches_ && _("Patches").generatePatches_(
198
- n,
199
- t,
200
- e.patches_,
201
- e.inversePatches_
202
- );
203
- }
204
- return n.copy_;
205
- }
206
- function K(e, r, t, n, i, o, c) {
207
- if (process.env.NODE_ENV !== "production" && i === t && s(5), m(i)) {
208
- const f = o && r && r.type_ !== 3 && // Set objects are atomic since they have no keys.
209
- !E(r.assigned_, n) ? o.concat(n) : void 0, a = w(e, i, f);
210
- if (G(t, n, a), m(a))
211
- e.canAutoFreeze_ = !1;
212
- else
213
- return;
214
- } else c && t.add(i);
215
- if (d(i) && !D(i)) {
216
- if (!e.immer_.autoFreeze_ && e.unfinalizedDrafts_ < 1)
217
- return;
218
- w(e, i), (!r || !r.scope_.parent_) && typeof n != "symbol" && (P(t) ? t.has(n) : Object.prototype.propertyIsEnumerable.call(t, n)) && z(e, i);
219
- }
220
- }
221
- function z(e, r, t = !1) {
222
- !e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && T(r, t);
223
- }
224
- function re(e, r) {
225
- const t = Array.isArray(e), n = {
226
- type_: t ? 1 : 0,
227
- // Track which produce call this is associated with.
228
- scope_: r ? r.scope_ : U(),
229
- // True for both shallow and deep changes.
230
- modified_: !1,
231
- // Used during finalization.
232
- finalized_: !1,
233
- // Track which properties have been assigned (true) or deleted (false).
234
- assigned_: {},
235
- // The parent draft state.
236
- parent_: r,
237
- // The base state.
238
- base_: e,
239
- // The base proxy.
240
- draft_: null,
241
- // set below
242
- // The base copy with any updated values.
243
- copy_: null,
244
- // Called by the `produce` function.
245
- revoke_: null,
246
- isManual_: !1
247
- };
248
- let i = n, o = M;
249
- t && (i = [n], o = p);
250
- const { revoke: c, proxy: f } = Proxy.revocable(i, o);
251
- return n.draft_ = f, n.revoke_ = c, f;
252
- }
253
- var M = {
254
- get(e, r) {
255
- if (r === u)
256
- return e;
257
- const t = l(e);
258
- if (!E(t, r))
259
- return te(e, t, r);
260
- const n = t[r];
261
- return e.finalized_ || !d(n) ? n : n === F(e.base_, r) ? (S(e), e.copy_[r] = k(n, e)) : n;
262
- },
263
- has(e, r) {
264
- return r in l(e);
265
- },
266
- ownKeys(e) {
267
- return Reflect.ownKeys(l(e));
268
- },
269
- set(e, r, t) {
270
- const n = H(l(e), r);
271
- if (n?.set)
272
- return n.set.call(e.draft_, t), !0;
273
- if (!e.modified_) {
274
- const i = F(l(e), r), o = i?.[u];
275
- if (o && o.base_ === t)
276
- return e.copy_[r] = t, e.assigned_[r] = !1, !0;
277
- if (Z(t, i) && (t !== void 0 || E(e.base_, r)))
278
- return !0;
279
- S(e), C(e);
280
- }
281
- return e.copy_[r] === t && // special case: handle new props with value 'undefined'
282
- (t !== void 0 || r in e.copy_) || // special case: NaN
283
- Number.isNaN(t) && Number.isNaN(e.copy_[r]) || (e.copy_[r] = t, e.assigned_[r] = !0), !0;
284
- },
285
- deleteProperty(e, r) {
286
- return F(e.base_, r) !== void 0 || r in e.base_ ? (e.assigned_[r] = !1, S(e), C(e)) : delete e.assigned_[r], e.copy_ && delete e.copy_[r], !0;
287
- },
288
- // Note: We never coerce `desc.value` into an Immer draft, because we can't make
289
- // the same guarantee in ES5 mode.
290
- getOwnPropertyDescriptor(e, r) {
291
- const t = l(e), n = Reflect.getOwnPropertyDescriptor(t, r);
292
- return n && {
293
- writable: !0,
294
- configurable: e.type_ !== 1 || r !== "length",
295
- enumerable: n.enumerable,
296
- value: t[r]
297
- };
298
- },
299
- defineProperty() {
300
- s(11);
301
- },
302
- getPrototypeOf(e) {
303
- return y(e.base_);
304
- },
305
- setPrototypeOf() {
306
- s(12);
307
- }
308
- }, p = {};
309
- b(M, (e, r) => {
310
- p[e] = function() {
311
- return arguments[0] = arguments[0][0], r.apply(this, arguments);
312
- };
313
- });
314
- p.deleteProperty = function(e, r) {
315
- return process.env.NODE_ENV !== "production" && isNaN(parseInt(r)) && s(13), p.set.call(this, e, r, void 0);
316
- };
317
- p.set = function(e, r, t) {
318
- return process.env.NODE_ENV !== "production" && r !== "length" && isNaN(parseInt(r)) && s(14), M.set.call(this, e[0], r, t, e[0]);
319
- };
320
- function F(e, r) {
321
- const t = e[u];
322
- return (t ? l(t) : e)[r];
323
- }
324
- function te(e, r, t) {
325
- const n = H(r, t);
326
- return n ? "value" in n ? n.value : (
327
- // This is a very special case, if the prop is a getter defined by the
328
- // prototype, we should invoke it with the draft as context!
329
- n.get?.call(e.draft_)
330
- ) : void 0;
331
- }
332
- function H(e, r) {
333
- if (!(r in e))
334
- return;
335
- let t = y(e);
336
- for (; t; ) {
337
- const n = Object.getOwnPropertyDescriptor(t, r);
338
- if (n)
339
- return n;
340
- t = y(t);
341
- }
342
- }
343
- function C(e) {
344
- e.modified_ || (e.modified_ = !0, e.parent_ && C(e.parent_));
345
- }
346
- function S(e) {
347
- e.copy_ || (e.copy_ = N(
348
- e.base_,
349
- e.scope_.immer_.useStrictShallowCopy_
350
- ));
351
- }
352
- var ne = class {
353
- constructor(e) {
354
- this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (r, t, n) => {
355
- if (typeof r == "function" && typeof t != "function") {
356
- const o = t;
357
- t = r;
358
- const c = this;
359
- return function(a = o, ...q) {
360
- return c.produce(a, (J) => t.call(this, J, ...q));
361
- };
362
- }
363
- typeof t != "function" && s(6), n !== void 0 && typeof n != "function" && s(7);
364
- let i;
365
- if (d(r)) {
366
- const o = x(this), c = k(r, void 0);
367
- let f = !0;
368
- try {
369
- i = t(c), f = !1;
370
- } finally {
371
- f ? A(o) : I(o);
372
- }
373
- return j(o, n), $(i, o);
374
- } else if (!r || typeof r != "object") {
375
- if (i = t(r), i === void 0 && (i = r), i === W && (i = void 0), this.autoFreeze_ && T(i, !0), n) {
376
- const o = [], c = [];
377
- _("Patches").generateReplacementPatches_(r, i, o, c), n(o, c);
378
- }
379
- return i;
380
- } else
381
- s(1, r);
382
- }, this.produceWithPatches = (r, t) => {
383
- if (typeof r == "function")
384
- return (c, ...f) => this.produceWithPatches(c, (a) => r(a, ...f));
385
- let n, i;
386
- return [this.produce(r, t, (c, f) => {
387
- n = c, i = f;
388
- }), n, i];
389
- }, typeof e?.autoFreeze == "boolean" && this.setAutoFreeze(e.autoFreeze), typeof e?.useStrictShallowCopy == "boolean" && this.setUseStrictShallowCopy(e.useStrictShallowCopy);
390
- }
391
- createDraft(e) {
392
- d(e) || s(8), m(e) && (e = ie(e));
393
- const r = x(this), t = k(e, void 0);
394
- return t[u].isManual_ = !0, I(r), t;
395
- }
396
- finishDraft(e, r) {
397
- const t = e && e[u];
398
- (!t || !t.isManual_) && s(9);
399
- const { scope_: n } = t;
400
- return j(n, r), $(void 0, n);
401
- }
402
- /**
403
- * Pass true to automatically freeze all copies created by Immer.
404
- *
405
- * By default, auto-freezing is enabled.
406
- */
407
- setAutoFreeze(e) {
408
- this.autoFreeze_ = e;
409
- }
410
- /**
411
- * Pass true to enable strict shallow copy.
412
- *
413
- * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
414
- */
415
- setUseStrictShallowCopy(e) {
416
- this.useStrictShallowCopy_ = e;
417
- }
418
- applyPatches(e, r) {
419
- let t;
420
- for (t = r.length - 1; t >= 0; t--) {
421
- const i = r[t];
422
- if (i.path.length === 0 && i.op === "replace") {
423
- e = i.value;
424
- break;
425
- }
426
- }
427
- t > -1 && (r = r.slice(t + 1));
428
- const n = _("Patches").applyPatches_;
429
- return m(e) ? n(e, r) : this.produce(
430
- e,
431
- (i) => n(i, r)
432
- );
433
- }
434
- };
435
- function k(e, r) {
436
- const t = P(e) ? _("MapSet").proxyMap_(e, r) : v(e) ? _("MapSet").proxySet_(e, r) : re(e, r);
437
- return (r ? r.scope_ : U()).drafts_.push(t), t;
438
- }
439
- function ie(e) {
440
- return m(e) || s(10, e), X(e);
441
- }
442
- function X(e) {
443
- if (!d(e) || D(e))
444
- return e;
445
- const r = e[u];
446
- let t;
447
- if (r) {
448
- if (!r.modified_)
449
- return r.base_;
450
- r.finalized_ = !0, t = N(e, r.scope_.immer_.useStrictShallowCopy_);
451
- } else
452
- t = N(e, !0);
453
- return b(t, (n, i) => {
454
- G(t, n, X(i));
455
- }), r && (r.finalized_ = !1), t;
456
- }
457
- var oe = new ne(), ce = oe.produce;
458
- export {
459
- ne as Immer,
460
- ie as current,
461
- T as freeze,
462
- R as immerable,
463
- m as isDraft,
464
- d as isDraftable,
465
- W as nothing,
466
- ce as produce
467
- };
@@ -1,246 +0,0 @@
1
- import * as i from "react";
2
- import { w as V } from "../../../_virtual/with-selector.js";
3
- function T(n) {
4
- n();
5
- }
6
- function L() {
7
- let n = null, o = null;
8
- return {
9
- clear() {
10
- n = null, o = null;
11
- },
12
- notify() {
13
- T(() => {
14
- let e = n;
15
- for (; e; )
16
- e.callback(), e = e.next;
17
- });
18
- },
19
- get() {
20
- const e = [];
21
- let t = n;
22
- for (; t; )
23
- e.push(t), t = t.next;
24
- return e;
25
- },
26
- subscribe(e) {
27
- let t = !0;
28
- const r = o = {
29
- callback: e,
30
- next: null,
31
- prev: o
32
- };
33
- return r.prev ? r.prev.next = r : n = r, function() {
34
- !t || n === null || (t = !1, r.next ? r.next.prev = r.prev : o = r.prev, r.prev ? r.prev.next = r.next : n = r.next);
35
- };
36
- }
37
- };
38
- }
39
- var k = {
40
- notify() {
41
- },
42
- get: () => []
43
- };
44
- function M(n, o) {
45
- let e, t = k, r = 0, s = !1;
46
- function f(w) {
47
- u();
48
- const g = t.subscribe(w);
49
- let y = !1;
50
- return () => {
51
- y || (y = !0, g(), b());
52
- };
53
- }
54
- function d() {
55
- t.notify();
56
- }
57
- function c() {
58
- a.onStateChange && a.onStateChange();
59
- }
60
- function p() {
61
- return s;
62
- }
63
- function u() {
64
- r++, e || (e = n.subscribe(c), t = L());
65
- }
66
- function b() {
67
- r--, e && r === 0 && (e(), e = void 0, t.clear(), t = k);
68
- }
69
- function S() {
70
- s || (s = !0, u());
71
- }
72
- function h() {
73
- s && (s = !1, b());
74
- }
75
- const a = {
76
- addNestedSub: f,
77
- notifyNestedSubs: d,
78
- handleChangeWrapper: c,
79
- isSubscribed: p,
80
- trySubscribe: S,
81
- tryUnsubscribe: h,
82
- getListeners: () => t
83
- };
84
- return a;
85
- }
86
- var j = () => typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", U = /* @__PURE__ */ j(), _ = () => typeof navigator < "u" && navigator.product === "ReactNative", H = /* @__PURE__ */ _(), I = () => U || H ? i.useLayoutEffect : i.useEffect, P = /* @__PURE__ */ I(), z = /* @__PURE__ */ Symbol.for("react-redux-context"), O = typeof globalThis < "u" ? globalThis : (
87
- /* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
88
- {}
89
- );
90
- function Y() {
91
- if (!i.createContext) return {};
92
- const n = O[z] ??= /* @__PURE__ */ new Map();
93
- let o = n.get(i.createContext);
94
- return o || (o = i.createContext(
95
- null
96
- ), process.env.NODE_ENV !== "production" && (o.displayName = "ReactRedux"), n.set(i.createContext, o)), o;
97
- }
98
- var l = /* @__PURE__ */ Y();
99
- function F(n) {
100
- const { children: o, context: e, serverState: t, store: r } = n, s = i.useMemo(() => {
101
- const c = M(r), p = {
102
- store: r,
103
- subscription: c,
104
- getServerState: t ? () => t : void 0
105
- };
106
- if (process.env.NODE_ENV === "production")
107
- return p;
108
- {
109
- const { identityFunctionCheck: u = "once", stabilityCheck: b = "once" } = n;
110
- return /* @__PURE__ */ Object.assign(p, {
111
- stabilityCheck: b,
112
- identityFunctionCheck: u
113
- });
114
- }
115
- }, [r, t]), f = i.useMemo(() => r.getState(), [r]);
116
- P(() => {
117
- const { subscription: c } = s;
118
- return c.onStateChange = c.notifyNestedSubs, c.trySubscribe(), f !== r.getState() && c.notifyNestedSubs(), () => {
119
- c.tryUnsubscribe(), c.onStateChange = void 0;
120
- };
121
- }, [s, f]);
122
- const d = e || l;
123
- return /* @__PURE__ */ i.createElement(d.Provider, { value: s }, o);
124
- }
125
- var G = F;
126
- function m(n = l) {
127
- return function() {
128
- const e = i.useContext(n);
129
- if (process.env.NODE_ENV !== "production" && !e)
130
- throw new Error(
131
- "could not find react-redux context value; please ensure the component is wrapped in a <Provider>"
132
- );
133
- return e;
134
- };
135
- }
136
- var N = /* @__PURE__ */ m();
137
- function R(n = l) {
138
- const o = n === l ? N : (
139
- // @ts-ignore
140
- m(n)
141
- ), e = () => {
142
- const { store: t } = o();
143
- return t;
144
- };
145
- return Object.assign(e, {
146
- withTypes: () => e
147
- }), e;
148
- }
149
- var W = /* @__PURE__ */ R();
150
- function A(n = l) {
151
- const o = n === l ? W : R(n), e = () => o().dispatch;
152
- return Object.assign(e, {
153
- withTypes: () => e
154
- }), e;
155
- }
156
- var J = /* @__PURE__ */ A(), B = (n, o) => n === o;
157
- function K(n = l) {
158
- const o = n === l ? N : m(n), e = (t, r = {}) => {
159
- const { equalityFn: s = B } = typeof r == "function" ? { equalityFn: r } : r;
160
- if (process.env.NODE_ENV !== "production") {
161
- if (!t)
162
- throw new Error("You must pass a selector to useSelector");
163
- if (typeof t != "function")
164
- throw new Error("You must pass a function as a selector to useSelector");
165
- if (typeof s != "function")
166
- throw new Error(
167
- "You must pass a function as an equality function to useSelector"
168
- );
169
- }
170
- const f = o(), { store: d, subscription: c, getServerState: p } = f, u = i.useRef(!0), b = i.useCallback(
171
- {
172
- [t.name](h) {
173
- const a = t(h);
174
- if (process.env.NODE_ENV !== "production") {
175
- const { devModeChecks: w = {} } = typeof r == "function" ? {} : r, { identityFunctionCheck: g, stabilityCheck: y } = f, {
176
- identityFunctionCheck: C,
177
- stabilityCheck: E
178
- } = {
179
- stabilityCheck: y,
180
- identityFunctionCheck: g,
181
- ...w
182
- };
183
- if (E === "always" || E === "once" && u.current) {
184
- const v = t(h);
185
- if (!s(a, v)) {
186
- let x;
187
- try {
188
- throw new Error();
189
- } catch (D) {
190
- ({ stack: x } = D);
191
- }
192
- console.warn(
193
- "Selector " + (t.name || "unknown") + ` returned a different result when called with the same parameters. This can lead to unnecessary rerenders.
194
- Selectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization`,
195
- {
196
- state: h,
197
- selected: a,
198
- selected2: v,
199
- stack: x
200
- }
201
- );
202
- }
203
- }
204
- if ((C === "always" || C === "once" && u.current) && a === h) {
205
- let v;
206
- try {
207
- throw new Error();
208
- } catch (x) {
209
- ({ stack: v } = x);
210
- }
211
- console.warn(
212
- "Selector " + (t.name || "unknown") + ` returned the root state when called. This can lead to unnecessary rerenders.
213
- Selectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.`,
214
- { stack: v }
215
- );
216
- }
217
- u.current && (u.current = !1);
218
- }
219
- return a;
220
- }
221
- }[t.name],
222
- [t]
223
- ), S = V.useSyncExternalStoreWithSelector(
224
- c.addNestedSub,
225
- d.getState,
226
- p || d.getState,
227
- b,
228
- s
229
- );
230
- return i.useDebugValue(S), S;
231
- };
232
- return Object.assign(e, {
233
- withTypes: () => e
234
- }), e;
235
- }
236
- var Q = /* @__PURE__ */ K();
237
- export {
238
- G as Provider,
239
- l as ReactReduxContext,
240
- A as createDispatchHook,
241
- K as createSelectorHook,
242
- R as createStoreHook,
243
- J as useDispatch,
244
- Q as useSelector,
245
- W as useStore
246
- };