@open-kingdom/shared-frontend-data-access-api-client 0.0.2-10

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,4139 @@
1
+ import { nanoid as $n, formatProdErrorMessage as ye, isPlainObject as Ve, createAction as De, createSelector as Ir, createNextState as Wt, createAsyncThunk as an, createSlice as Se, prepareAutoBatched as Ne, isAnyOf as ze, isFulfilled as be, isRejectedWithValue as Bt, combineReducers as Ar, SHOULD_AUTOBATCH as Ln, isAllOf as Ot, isRejected as Gt, isPending as jn, isAction as Cr, isAsyncThunkAction as cn, createListenerMiddleware as Tr } from "@reduxjs/toolkit";
2
+ import * as he from "react";
3
+ import Kn, { useCallback as ge, useDebugValue as It, useMemo as G, useState as un, useEffect as de, useRef as fe, useLayoutEffect as Dr } from "react";
4
+ var Yt = /* @__PURE__ */ Symbol.for("immer-nothing"), Fe = /* @__PURE__ */ Symbol.for("immer-draftable"), B = /* @__PURE__ */ Symbol.for("immer-state"), Hn = process.env.NODE_ENV !== "production" ? [
5
+ // All error codes, starting by 0:
6
+ function(e) {
7
+ return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
8
+ },
9
+ function(e) {
10
+ 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}'`;
11
+ },
12
+ "This object has been frozen and should not be mutated",
13
+ function(e) {
14
+ return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
15
+ },
16
+ "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
17
+ "Immer forbids circular references",
18
+ "The first or second argument to `produce` must be a function",
19
+ "The third argument to `produce` must be a function or undefined",
20
+ "First argument to `createDraft` must be a plain object, an array, or an immerable object",
21
+ "First argument to `finishDraft` must be a draft returned by `createDraft`",
22
+ function(e) {
23
+ return `'current' expects a draft, got: ${e}`;
24
+ },
25
+ "Object.defineProperty() cannot be used on an Immer draft",
26
+ "Object.setPrototypeOf() cannot be used on an Immer draft",
27
+ "Immer only supports deleting array indices",
28
+ "Immer only supports setting array indices and the 'length' property",
29
+ function(e) {
30
+ return `'original' expects a draft, got: ${e}`;
31
+ }
32
+ // Note: if more errors are added, the errorOffset in Patches.ts should be increased
33
+ // See Patches.ts for additional errors
34
+ ] : [];
35
+ function W(e, ...t) {
36
+ if (process.env.NODE_ENV !== "production") {
37
+ const n = Hn[e], r = pe(n) ? n.apply(null, t) : n;
38
+ throw new Error(`[Immer] ${r}`);
39
+ }
40
+ throw new Error(
41
+ `[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
42
+ );
43
+ }
44
+ var J = Object, Ee = J.getPrototypeOf, $e = "constructor", Ge = "prototype", qt = "configurable", ft = "enumerable", ut = "writable", Le = "value", Z = (e) => !!e && !!e[B];
45
+ function ne(e) {
46
+ return e ? Wn(e) || Je(e) || !!e[Fe] || !!e[$e]?.[Fe] || Xe(e) || Ze(e) : !1;
47
+ }
48
+ var Nr = J[Ge][$e].toString(), ln = /* @__PURE__ */ new WeakMap();
49
+ function Wn(e) {
50
+ if (!e || !Ce(e))
51
+ return !1;
52
+ const t = Ee(e);
53
+ if (t === null || t === J[Ge])
54
+ return !0;
55
+ const n = J.hasOwnProperty.call(t, $e) && t[$e];
56
+ if (n === Object)
57
+ return !0;
58
+ if (!pe(n))
59
+ return !1;
60
+ let r = ln.get(n);
61
+ return r === void 0 && (r = Function.toString.call(n), ln.set(n, r)), r === Nr;
62
+ }
63
+ function kr(e) {
64
+ return Z(e) || W(15, e), e[B].base_;
65
+ }
66
+ function Ye(e, t, n = !0) {
67
+ Pe(e) === 0 ? (n ? Reflect.ownKeys(e) : J.keys(e)).forEach((i) => {
68
+ t(i, e[i], e);
69
+ }) : e.forEach((r, i) => t(i, r, e));
70
+ }
71
+ function Pe(e) {
72
+ const t = e[B];
73
+ return t ? t.type_ : Je(e) ? 1 : Xe(e) ? 2 : Ze(e) ? 3 : 0;
74
+ }
75
+ var xe = (e, t, n = Pe(e)) => n === 2 ? e.has(t) : J[Ge].hasOwnProperty.call(e, t), se = (e, t, n = Pe(e)) => (
76
+ // @ts-ignore
77
+ n === 2 ? e.get(t) : e[t]
78
+ ), dt = (e, t, n, r = Pe(e)) => {
79
+ r === 2 ? e.set(t, n) : r === 3 ? e.add(n) : e[t] = n;
80
+ };
81
+ function Mr(e, t) {
82
+ return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
83
+ }
84
+ var Je = Array.isArray, Xe = (e) => e instanceof Map, Ze = (e) => e instanceof Set, Ce = (e) => typeof e == "object", pe = (e) => typeof e == "function", At = (e) => typeof e == "boolean";
85
+ function Qr(e) {
86
+ const t = +e;
87
+ return Number.isInteger(t) && String(t) === e;
88
+ }
89
+ var qr = (e) => Ce(e) ? e?.[B] : null, ae = (e) => e.copy_ || e.base_, Jt = (e) => e.modified_ ? e.copy_ : e.base_;
90
+ function Ft(e, t) {
91
+ if (Xe(e))
92
+ return new Map(e);
93
+ if (Ze(e))
94
+ return new Set(e);
95
+ if (Je(e))
96
+ return Array[Ge].slice.call(e);
97
+ const n = Wn(e);
98
+ if (t === !0 || t === "class_only" && !n) {
99
+ const r = J.getOwnPropertyDescriptors(e);
100
+ delete r[B];
101
+ let i = Reflect.ownKeys(r);
102
+ for (let u = 0; u < i.length; u++) {
103
+ const m = i[u], _ = r[m];
104
+ _[ut] === !1 && (_[ut] = !0, _[qt] = !0), (_.get || _.set) && (r[m] = {
105
+ [qt]: !0,
106
+ [ut]: !0,
107
+ // could live with !!desc.set as well here...
108
+ [ft]: _[ft],
109
+ [Le]: e[m]
110
+ });
111
+ }
112
+ return J.create(Ee(e), r);
113
+ } else {
114
+ const r = Ee(e);
115
+ if (r !== null && n)
116
+ return { ...e };
117
+ const i = J.create(r);
118
+ return J.assign(i, e);
119
+ }
120
+ }
121
+ function Xt(e, t = !1) {
122
+ return bt(e) || Z(e) || !ne(e) || (Pe(e) > 1 && J.defineProperties(e, {
123
+ set: rt,
124
+ add: rt,
125
+ clear: rt,
126
+ delete: rt
127
+ }), J.freeze(e), t && Ye(
128
+ e,
129
+ (n, r) => {
130
+ Xt(r, !0);
131
+ },
132
+ !1
133
+ )), e;
134
+ }
135
+ function Fr() {
136
+ W(2);
137
+ }
138
+ var rt = {
139
+ [Le]: Fr
140
+ };
141
+ function bt(e) {
142
+ return e === null || !Ce(e) ? !0 : J.isFrozen(e);
143
+ }
144
+ var pt = "MapSet", ht = "Patches", fn = "ArrayMethods", yt = {};
145
+ function we(e) {
146
+ const t = yt[e];
147
+ return t || W(0, e), t;
148
+ }
149
+ var dn = (e) => !!yt[e];
150
+ function xr(e, t) {
151
+ yt[e] || (yt[e] = t);
152
+ }
153
+ var je, Bn = () => je, Ur = (e, t) => ({
154
+ drafts_: [],
155
+ parent_: e,
156
+ immer_: t,
157
+ // Whenever the modified draft contains a draft from another scope, we
158
+ // need to prevent auto-freezing so the unowned draft can be finalized.
159
+ canAutoFreeze_: !0,
160
+ unfinalizedDrafts_: 0,
161
+ handledSet_: /* @__PURE__ */ new Set(),
162
+ processedForPatches_: /* @__PURE__ */ new Set(),
163
+ mapSetPlugin_: dn(pt) ? we(pt) : void 0,
164
+ arrayMethodsPlugin_: dn(fn) ? we(fn) : void 0
165
+ });
166
+ function pn(e, t) {
167
+ t && (e.patchPlugin_ = we(ht), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
168
+ }
169
+ function xt(e) {
170
+ Ut(e), e.drafts_.forEach(Vr), e.drafts_ = null;
171
+ }
172
+ function Ut(e) {
173
+ e === je && (je = e.parent_);
174
+ }
175
+ var hn = (e) => je = Ur(je, e);
176
+ function Vr(e) {
177
+ const t = e[B];
178
+ t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
179
+ }
180
+ function yn(e, t) {
181
+ t.unfinalizedDrafts_ = t.drafts_.length;
182
+ const n = t.drafts_[0];
183
+ if (e !== void 0 && e !== n) {
184
+ n[B].modified_ && (xt(t), W(4)), ne(e) && (e = gn(t, e));
185
+ const { patchPlugin_: i } = t;
186
+ i && i.generateReplacementPatches_(
187
+ n[B].base_,
188
+ e,
189
+ t
190
+ );
191
+ } else
192
+ e = gn(t, n);
193
+ return zr(t, e, !0), xt(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Yt ? e : void 0;
194
+ }
195
+ function gn(e, t) {
196
+ if (bt(t))
197
+ return t;
198
+ const n = t[B];
199
+ if (!n)
200
+ return gt(t, e.handledSet_, e);
201
+ if (!Et(n, e))
202
+ return t;
203
+ if (!n.modified_)
204
+ return n.base_;
205
+ if (!n.finalized_) {
206
+ const { callbacks_: r } = n;
207
+ if (r)
208
+ for (; r.length > 0; )
209
+ r.pop()(e);
210
+ Jn(n, e);
211
+ }
212
+ return n.copy_;
213
+ }
214
+ function zr(e, t, n = !1) {
215
+ !e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && Xt(t, n);
216
+ }
217
+ function Gn(e) {
218
+ e.finalized_ = !0, e.scope_.unfinalizedDrafts_--;
219
+ }
220
+ var Et = (e, t) => e.scope_ === t, $r = [];
221
+ function Yn(e, t, n, r) {
222
+ const i = ae(e), u = e.type_;
223
+ if (r !== void 0 && se(i, r, u) === t) {
224
+ dt(i, r, n, u);
225
+ return;
226
+ }
227
+ if (!e.draftLocations_) {
228
+ const _ = e.draftLocations_ = /* @__PURE__ */ new Map();
229
+ Ye(i, (C, w) => {
230
+ if (Z(w)) {
231
+ const T = _.get(w) || [];
232
+ T.push(C), _.set(w, T);
233
+ }
234
+ });
235
+ }
236
+ const m = e.draftLocations_.get(t) ?? $r;
237
+ for (const _ of m)
238
+ dt(i, _, n, u);
239
+ }
240
+ function Lr(e, t, n) {
241
+ e.callbacks_.push(function(i) {
242
+ const u = t;
243
+ if (!u || !Et(u, i))
244
+ return;
245
+ i.mapSetPlugin_?.fixSetContents(u);
246
+ const m = Jt(u);
247
+ Yn(e, u.draft_ ?? u, m, n), Jn(u, i);
248
+ });
249
+ }
250
+ function Jn(e, t) {
251
+ if (e.modified_ && !e.finalized_ && (e.type_ === 3 || e.type_ === 1 && e.allIndicesReassigned_ || (e.assigned_?.size ?? 0) > 0)) {
252
+ const { patchPlugin_: r } = t;
253
+ if (r) {
254
+ const i = r.getPath(e);
255
+ i && r.generatePatches_(e, i, t);
256
+ }
257
+ Gn(e);
258
+ }
259
+ }
260
+ function jr(e, t, n) {
261
+ const { scope_: r } = e;
262
+ if (Z(n)) {
263
+ const i = n[B];
264
+ Et(i, r) && i.callbacks_.push(function() {
265
+ lt(e);
266
+ const m = Jt(i);
267
+ Yn(e, n, m, t);
268
+ });
269
+ } else ne(n) && e.callbacks_.push(function() {
270
+ const u = ae(e);
271
+ e.type_ === 3 ? u.has(n) && gt(n, r.handledSet_, r) : se(u, t, e.type_) === n && r.drafts_.length > 1 && (e.assigned_.get(t) ?? !1) === !0 && e.copy_ && gt(
272
+ se(e.copy_, t, e.type_),
273
+ r.handledSet_,
274
+ r
275
+ );
276
+ });
277
+ }
278
+ function gt(e, t, n) {
279
+ return !n.immer_.autoFreeze_ && n.unfinalizedDrafts_ < 1 || Z(e) || t.has(e) || !ne(e) || bt(e) || (t.add(e), Ye(e, (r, i) => {
280
+ if (Z(i)) {
281
+ const u = i[B];
282
+ if (Et(u, n)) {
283
+ const m = Jt(u);
284
+ dt(e, r, m, e.type_), Gn(u);
285
+ }
286
+ } else ne(i) && gt(i, t, n);
287
+ })), e;
288
+ }
289
+ function Kr(e, t) {
290
+ const n = Je(e), r = {
291
+ type_: n ? 1 : 0,
292
+ // Track which produce call this is associated with.
293
+ scope_: t ? t.scope_ : Bn(),
294
+ // True for both shallow and deep changes.
295
+ modified_: !1,
296
+ // Used during finalization.
297
+ finalized_: !1,
298
+ // Track which properties have been assigned (true) or deleted (false).
299
+ // actually instantiated in `prepareCopy()`
300
+ assigned_: void 0,
301
+ // The parent draft state.
302
+ parent_: t,
303
+ // The base state.
304
+ base_: e,
305
+ // The base proxy.
306
+ draft_: null,
307
+ // set below
308
+ // The base copy with any updated values.
309
+ copy_: null,
310
+ // Called by the `produce` function.
311
+ revoke_: null,
312
+ isManual_: !1,
313
+ // `callbacks` actually gets assigned in `createProxy`
314
+ callbacks_: void 0
315
+ };
316
+ let i = r, u = mt;
317
+ n && (i = [r], u = Ke);
318
+ const { revoke: m, proxy: _ } = Proxy.revocable(i, u);
319
+ return r.draft_ = _, r.revoke_ = m, [_, r];
320
+ }
321
+ var mt = {
322
+ get(e, t) {
323
+ if (t === B)
324
+ return e;
325
+ let n = e.scope_.arrayMethodsPlugin_;
326
+ const r = e.type_ === 1 && typeof t == "string";
327
+ if (r && n?.isArrayOperationMethod(t))
328
+ return n.createMethodInterceptor(e, t);
329
+ const i = ae(e);
330
+ if (!xe(i, t, e.type_))
331
+ return Hr(e, i, t);
332
+ const u = i[t];
333
+ if (e.finalized_ || !ne(u) || r && e.operationMethod && n?.isMutatingArrayMethod(
334
+ e.operationMethod
335
+ ) && Qr(t))
336
+ return u;
337
+ if (u === Ct(e.base_, t)) {
338
+ lt(e);
339
+ const m = e.type_ === 1 ? +t : t, _ = zt(e.scope_, u, e, m);
340
+ return e.copy_[m] = _;
341
+ }
342
+ return u;
343
+ },
344
+ has(e, t) {
345
+ return t in ae(e);
346
+ },
347
+ ownKeys(e) {
348
+ return Reflect.ownKeys(ae(e));
349
+ },
350
+ set(e, t, n) {
351
+ const r = Xn(ae(e), t);
352
+ if (r?.set)
353
+ return r.set.call(e.draft_, n), !0;
354
+ if (!e.modified_) {
355
+ const i = Ct(ae(e), t), u = i?.[B];
356
+ if (u && u.base_ === n)
357
+ return e.copy_[t] = n, e.assigned_.set(t, !1), !0;
358
+ if (Mr(n, i) && (n !== void 0 || xe(e.base_, t, e.type_)))
359
+ return !0;
360
+ lt(e), Vt(e);
361
+ }
362
+ return e.copy_[t] === n && // special case: handle new props with value 'undefined'
363
+ (n !== void 0 || t in e.copy_) || // special case: NaN
364
+ Number.isNaN(n) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = n, e.assigned_.set(t, !0), jr(e, t, n)), !0;
365
+ },
366
+ deleteProperty(e, t) {
367
+ return lt(e), Ct(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_.set(t, !1), Vt(e)) : e.assigned_.delete(t), e.copy_ && delete e.copy_[t], !0;
368
+ },
369
+ // Note: We never coerce `desc.value` into an Immer draft, because we can't make
370
+ // the same guarantee in ES5 mode.
371
+ getOwnPropertyDescriptor(e, t) {
372
+ const n = ae(e), r = Reflect.getOwnPropertyDescriptor(n, t);
373
+ return r && {
374
+ [ut]: !0,
375
+ [qt]: e.type_ !== 1 || t !== "length",
376
+ [ft]: r[ft],
377
+ [Le]: n[t]
378
+ };
379
+ },
380
+ defineProperty() {
381
+ W(11);
382
+ },
383
+ getPrototypeOf(e) {
384
+ return Ee(e.base_);
385
+ },
386
+ setPrototypeOf() {
387
+ W(12);
388
+ }
389
+ }, Ke = {};
390
+ for (let e in mt) {
391
+ let t = mt[e];
392
+ Ke[e] = function() {
393
+ const n = arguments;
394
+ return n[0] = n[0][0], t.apply(this, n);
395
+ };
396
+ }
397
+ Ke.deleteProperty = function(e, t) {
398
+ return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && W(13), Ke.set.call(this, e, t, void 0);
399
+ };
400
+ Ke.set = function(e, t, n) {
401
+ return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && W(14), mt.set.call(this, e[0], t, n, e[0]);
402
+ };
403
+ function Ct(e, t) {
404
+ const n = e[B];
405
+ return (n ? ae(n) : e)[t];
406
+ }
407
+ function Hr(e, t, n) {
408
+ const r = Xn(t, n);
409
+ return r ? Le in r ? r[Le] : (
410
+ // This is a very special case, if the prop is a getter defined by the
411
+ // prototype, we should invoke it with the draft as context!
412
+ r.get?.call(e.draft_)
413
+ ) : void 0;
414
+ }
415
+ function Xn(e, t) {
416
+ if (!(t in e))
417
+ return;
418
+ let n = Ee(e);
419
+ for (; n; ) {
420
+ const r = Object.getOwnPropertyDescriptor(n, t);
421
+ if (r)
422
+ return r;
423
+ n = Ee(n);
424
+ }
425
+ }
426
+ function Vt(e) {
427
+ e.modified_ || (e.modified_ = !0, e.parent_ && Vt(e.parent_));
428
+ }
429
+ function lt(e) {
430
+ e.copy_ || (e.assigned_ = /* @__PURE__ */ new Map(), e.copy_ = Ft(
431
+ e.base_,
432
+ e.scope_.immer_.useStrictShallowCopy_
433
+ ));
434
+ }
435
+ var Wr = class {
436
+ constructor(e) {
437
+ this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !1, this.produce = (t, n, r) => {
438
+ if (pe(t) && !pe(n)) {
439
+ const u = n;
440
+ n = t;
441
+ const m = this;
442
+ return function(C = u, ...w) {
443
+ return m.produce(C, (T) => n.call(this, T, ...w));
444
+ };
445
+ }
446
+ pe(n) || W(6), r !== void 0 && !pe(r) && W(7);
447
+ let i;
448
+ if (ne(t)) {
449
+ const u = hn(this), m = zt(u, t, void 0);
450
+ let _ = !0;
451
+ try {
452
+ i = n(m), _ = !1;
453
+ } finally {
454
+ _ ? xt(u) : Ut(u);
455
+ }
456
+ return pn(u, r), yn(i, u);
457
+ } else if (!t || !Ce(t)) {
458
+ if (i = n(t), i === void 0 && (i = t), i === Yt && (i = void 0), this.autoFreeze_ && Xt(i, !0), r) {
459
+ const u = [], m = [];
460
+ we(ht).generateReplacementPatches_(t, i, {
461
+ patches_: u,
462
+ inversePatches_: m
463
+ }), r(u, m);
464
+ }
465
+ return i;
466
+ } else
467
+ W(1, t);
468
+ }, this.produceWithPatches = (t, n) => {
469
+ if (pe(t))
470
+ return (m, ..._) => this.produceWithPatches(m, (C) => t(C, ..._));
471
+ let r, i;
472
+ return [this.produce(t, n, (m, _) => {
473
+ r = m, i = _;
474
+ }), r, i];
475
+ }, At(e?.autoFreeze) && this.setAutoFreeze(e.autoFreeze), At(e?.useStrictShallowCopy) && this.setUseStrictShallowCopy(e.useStrictShallowCopy), At(e?.useStrictIteration) && this.setUseStrictIteration(e.useStrictIteration);
476
+ }
477
+ createDraft(e) {
478
+ ne(e) || W(8), Z(e) && (e = Zn(e));
479
+ const t = hn(this), n = zt(t, e, void 0);
480
+ return n[B].isManual_ = !0, Ut(t), n;
481
+ }
482
+ finishDraft(e, t) {
483
+ const n = e && e[B];
484
+ (!n || !n.isManual_) && W(9);
485
+ const { scope_: r } = n;
486
+ return pn(r, t), yn(void 0, r);
487
+ }
488
+ /**
489
+ * Pass true to automatically freeze all copies created by Immer.
490
+ *
491
+ * By default, auto-freezing is enabled.
492
+ */
493
+ setAutoFreeze(e) {
494
+ this.autoFreeze_ = e;
495
+ }
496
+ /**
497
+ * Pass true to enable strict shallow copy.
498
+ *
499
+ * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
500
+ */
501
+ setUseStrictShallowCopy(e) {
502
+ this.useStrictShallowCopy_ = e;
503
+ }
504
+ /**
505
+ * Pass false to use faster iteration that skips non-enumerable properties
506
+ * but still handles symbols for compatibility.
507
+ *
508
+ * By default, strict iteration is enabled (includes all own properties).
509
+ */
510
+ setUseStrictIteration(e) {
511
+ this.useStrictIteration_ = e;
512
+ }
513
+ shouldUseStrictIteration() {
514
+ return this.useStrictIteration_;
515
+ }
516
+ applyPatches(e, t) {
517
+ let n;
518
+ for (n = t.length - 1; n >= 0; n--) {
519
+ const i = t[n];
520
+ if (i.path.length === 0 && i.op === "replace") {
521
+ e = i.value;
522
+ break;
523
+ }
524
+ }
525
+ n > -1 && (t = t.slice(n + 1));
526
+ const r = we(ht).applyPatches_;
527
+ return Z(e) ? r(e, t) : this.produce(
528
+ e,
529
+ (i) => r(i, t)
530
+ );
531
+ }
532
+ };
533
+ function zt(e, t, n, r) {
534
+ const [i, u] = Xe(t) ? we(pt).proxyMap_(t, n) : Ze(t) ? we(pt).proxySet_(t, n) : Kr(t, n);
535
+ return (n?.scope_ ?? Bn()).drafts_.push(i), u.callbacks_ = n?.callbacks_ ?? [], u.key_ = r, n && r !== void 0 ? Lr(n, u, r) : u.callbacks_.push(function(C) {
536
+ C.mapSetPlugin_?.fixSetContents(u);
537
+ const { patchPlugin_: w } = C;
538
+ u.modified_ && w && w.generatePatches_(u, [], C);
539
+ }), i;
540
+ }
541
+ function Zn(e) {
542
+ return Z(e) || W(10, e), er(e);
543
+ }
544
+ function er(e) {
545
+ if (!ne(e) || bt(e))
546
+ return e;
547
+ const t = e[B];
548
+ let n, r = !0;
549
+ if (t) {
550
+ if (!t.modified_)
551
+ return t.base_;
552
+ t.finalized_ = !0, n = Ft(e, t.scope_.immer_.useStrictShallowCopy_), r = t.scope_.immer_.shouldUseStrictIteration();
553
+ } else
554
+ n = Ft(e, !0);
555
+ return Ye(
556
+ n,
557
+ (i, u) => {
558
+ dt(n, i, er(u));
559
+ },
560
+ r
561
+ ), t && (t.finalized_ = !1), n;
562
+ }
563
+ function Br() {
564
+ process.env.NODE_ENV !== "production" && Hn.push(
565
+ 'Sets cannot have "replace" patches.',
566
+ function(d) {
567
+ return "Unsupported patch operation: " + d;
568
+ },
569
+ function(d) {
570
+ return "Cannot apply patch, path doesn't resolve: " + d;
571
+ },
572
+ "Patching reserved attributes like __proto__, prototype and constructor is not allowed"
573
+ );
574
+ function t(d, v = []) {
575
+ if (d.key_ !== void 0) {
576
+ const p = d.parent_.copy_ ?? d.parent_.base_, P = qr(se(p, d.key_)), O = se(p, d.key_);
577
+ if (O === void 0 || O !== d.draft_ && O !== d.base_ && O !== d.copy_ || P != null && P.base_ !== d.base_)
578
+ return null;
579
+ const f = d.parent_.type_ === 3;
580
+ let g;
581
+ if (f) {
582
+ const s = d.parent_;
583
+ g = Array.from(s.drafts_.keys()).indexOf(d.key_);
584
+ } else
585
+ g = d.key_;
586
+ if (!(f && p.size > g || xe(p, g)))
587
+ return null;
588
+ v.push(g);
589
+ }
590
+ if (d.parent_)
591
+ return t(d.parent_, v);
592
+ v.reverse();
593
+ try {
594
+ n(d.copy_, v);
595
+ } catch {
596
+ return null;
597
+ }
598
+ return v;
599
+ }
600
+ function n(d, v) {
601
+ let p = d;
602
+ for (let P = 0; P < v.length - 1; P++) {
603
+ const O = v[P];
604
+ if (p = se(p, O), !Ce(p) || p === null)
605
+ throw new Error(`Cannot resolve path at '${v.join("/")}'`);
606
+ }
607
+ return p;
608
+ }
609
+ const r = "replace", i = "add", u = "remove";
610
+ function m(d, v, p) {
611
+ if (d.scope_.processedForPatches_.has(d))
612
+ return;
613
+ d.scope_.processedForPatches_.add(d);
614
+ const { patches_: P, inversePatches_: O } = p;
615
+ switch (d.type_) {
616
+ case 0:
617
+ case 2:
618
+ return C(
619
+ d,
620
+ v,
621
+ P,
622
+ O
623
+ );
624
+ case 1:
625
+ return _(
626
+ d,
627
+ v,
628
+ P,
629
+ O
630
+ );
631
+ case 3:
632
+ return w(
633
+ d,
634
+ v,
635
+ P,
636
+ O
637
+ );
638
+ }
639
+ }
640
+ function _(d, v, p, P) {
641
+ let { base_: O, assigned_: f } = d, g = d.copy_;
642
+ g.length < O.length && ([O, g] = [g, O], [p, P] = [P, p]);
643
+ const s = d.allIndicesReassigned_ === !0;
644
+ for (let a = 0; a < O.length; a++) {
645
+ const S = g[a], b = O[a];
646
+ if ((s || f?.get(a.toString())) && S !== b) {
647
+ const l = S?.[B];
648
+ if (l && l.modified_)
649
+ continue;
650
+ const o = v.concat([a]);
651
+ p.push({
652
+ op: r,
653
+ path: o,
654
+ // Need to maybe clone it, as it can in fact be the original value
655
+ // due to the base/copy inversion at the start of this function
656
+ value: R(S)
657
+ }), P.push({
658
+ op: r,
659
+ path: o,
660
+ value: R(b)
661
+ });
662
+ }
663
+ }
664
+ for (let a = O.length; a < g.length; a++) {
665
+ const S = v.concat([a]);
666
+ p.push({
667
+ op: i,
668
+ path: S,
669
+ // Need to maybe clone it, as it can in fact be the original value
670
+ // due to the base/copy inversion at the start of this function
671
+ value: R(g[a])
672
+ });
673
+ }
674
+ for (let a = g.length - 1; O.length <= a; --a) {
675
+ const S = v.concat([a]);
676
+ P.push({
677
+ op: u,
678
+ path: S
679
+ });
680
+ }
681
+ }
682
+ function C(d, v, p, P) {
683
+ const { base_: O, copy_: f, type_: g } = d;
684
+ Ye(d.assigned_, (s, a) => {
685
+ const S = se(O, s, g), b = se(f, s, g), h = a ? xe(O, s) ? r : i : u;
686
+ if (S === b && h === r)
687
+ return;
688
+ const l = v.concat(s);
689
+ p.push(
690
+ h === u ? { op: h, path: l } : { op: h, path: l, value: R(b) }
691
+ ), P.push(
692
+ h === i ? { op: u, path: l } : h === u ? { op: i, path: l, value: R(S) } : { op: r, path: l, value: R(S) }
693
+ );
694
+ });
695
+ }
696
+ function w(d, v, p, P) {
697
+ let { base_: O, copy_: f } = d, g = 0;
698
+ O.forEach((s) => {
699
+ if (!f.has(s)) {
700
+ const a = v.concat([g]);
701
+ p.push({
702
+ op: u,
703
+ path: a,
704
+ value: s
705
+ }), P.unshift({
706
+ op: i,
707
+ path: a,
708
+ value: s
709
+ });
710
+ }
711
+ g++;
712
+ }), g = 0, f.forEach((s) => {
713
+ if (!O.has(s)) {
714
+ const a = v.concat([g]);
715
+ p.push({
716
+ op: i,
717
+ path: a,
718
+ value: s
719
+ }), P.unshift({
720
+ op: u,
721
+ path: a,
722
+ value: s
723
+ });
724
+ }
725
+ g++;
726
+ });
727
+ }
728
+ function T(d, v, p) {
729
+ const { patches_: P, inversePatches_: O } = p;
730
+ P.push({
731
+ op: r,
732
+ path: [],
733
+ value: v === Yt ? void 0 : v
734
+ }), O.push({
735
+ op: r,
736
+ path: [],
737
+ value: d
738
+ });
739
+ }
740
+ function I(d, v) {
741
+ return v.forEach((p) => {
742
+ const { path: P, op: O } = p;
743
+ let f = d;
744
+ for (let S = 0; S < P.length - 1; S++) {
745
+ const b = Pe(f);
746
+ let h = P[S];
747
+ typeof h != "string" && typeof h != "number" && (h = "" + h), (b === 0 || b === 1) && (h === "__proto__" || h === $e) && W(19), pe(f) && h === Ge && W(19), f = se(f, h), Ce(f) || W(18, P.join("/"));
748
+ }
749
+ const g = Pe(f), s = A(p.value), a = P[P.length - 1];
750
+ switch (O) {
751
+ case r:
752
+ switch (g) {
753
+ case 2:
754
+ return f.set(a, s);
755
+ case 3:
756
+ W(16);
757
+ default:
758
+ return f[a] = s;
759
+ }
760
+ case i:
761
+ switch (g) {
762
+ case 1:
763
+ return a === "-" ? f.push(s) : f.splice(a, 0, s);
764
+ case 2:
765
+ return f.set(a, s);
766
+ case 3:
767
+ return f.add(s);
768
+ default:
769
+ return f[a] = s;
770
+ }
771
+ case u:
772
+ switch (g) {
773
+ case 1:
774
+ return f.splice(a, 1);
775
+ case 2:
776
+ return f.delete(a);
777
+ case 3:
778
+ return f.delete(p.value);
779
+ default:
780
+ return delete f[a];
781
+ }
782
+ default:
783
+ W(17, O);
784
+ }
785
+ }), d;
786
+ }
787
+ function A(d) {
788
+ if (!ne(d))
789
+ return d;
790
+ if (Je(d))
791
+ return d.map(A);
792
+ if (Xe(d))
793
+ return new Map(
794
+ Array.from(d.entries()).map(([p, P]) => [p, A(P)])
795
+ );
796
+ if (Ze(d))
797
+ return new Set(Array.from(d).map(A));
798
+ const v = Object.create(Ee(d));
799
+ for (const p in d)
800
+ v[p] = A(d[p]);
801
+ return xe(d, Fe) && (v[Fe] = d[Fe]), v;
802
+ }
803
+ function R(d) {
804
+ return Z(d) ? A(d) : d;
805
+ }
806
+ xr(ht, {
807
+ applyPatches_: I,
808
+ generatePatches_: m,
809
+ generateReplacementPatches_: T,
810
+ getPath: t
811
+ });
812
+ }
813
+ var He = new Wr();
814
+ He.produce;
815
+ var tr = /* @__PURE__ */ He.produceWithPatches.bind(
816
+ He
817
+ ), mn = /* @__PURE__ */ He.applyPatches.bind(He), Gr = class extends Error {
818
+ /**
819
+ * The schema issues.
820
+ */
821
+ issues;
822
+ /**
823
+ * Creates a schema error with useful information.
824
+ *
825
+ * @param issues The schema issues.
826
+ */
827
+ constructor(e) {
828
+ super(e[0].message), this.name = "SchemaError", this.issues = e;
829
+ }
830
+ }, Yr = (e, t, n) => {
831
+ if (t.length === 1 && t[0] === n) {
832
+ let r = !1;
833
+ try {
834
+ const i = {};
835
+ e(i) === i && (r = !0);
836
+ } catch {
837
+ }
838
+ if (r) {
839
+ let i;
840
+ try {
841
+ throw new Error();
842
+ } catch (u) {
843
+ ({ stack: i } = u);
844
+ }
845
+ console.warn(
846
+ `The result function returned its own inputs without modification. e.g
847
+ \`createSelector([state => state.todos], todos => todos)\`
848
+ This could lead to inefficient memoization and unnecessary re-renders.
849
+ Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,
850
+ { stack: i }
851
+ );
852
+ }
853
+ }
854
+ }, Jr = (e, t, n) => {
855
+ const { memoize: r, memoizeOptions: i } = t, { inputSelectorResults: u, inputSelectorResultsCopy: m } = e, _ = r(() => ({}), ...i);
856
+ if (!(_.apply(null, u) === _.apply(null, m))) {
857
+ let w;
858
+ try {
859
+ throw new Error();
860
+ } catch (T) {
861
+ ({ stack: w } = T);
862
+ }
863
+ console.warn(
864
+ `An input selector returned a different result when passed same arguments.
865
+ This means your output selector will likely run more frequently than intended.
866
+ Avoid returning a new reference inside your input selector, e.g.
867
+ \`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,
868
+ {
869
+ arguments: n,
870
+ firstInputs: u,
871
+ secondInputs: m,
872
+ stack: w
873
+ }
874
+ );
875
+ }
876
+ }, Xr = {
877
+ inputStabilityCheck: "once",
878
+ identityFunctionCheck: "once"
879
+ };
880
+ function Zr(e, t = `expected a function, instead received ${typeof e}`) {
881
+ if (typeof e != "function")
882
+ throw new TypeError(t);
883
+ }
884
+ function ei(e, t = `expected an object, instead received ${typeof e}`) {
885
+ if (typeof e != "object")
886
+ throw new TypeError(t);
887
+ }
888
+ function ti(e, t = "expected all items to be functions, instead received the following types: ") {
889
+ if (!e.every((n) => typeof n == "function")) {
890
+ const n = e.map(
891
+ (r) => typeof r == "function" ? `function ${r.name || "unnamed"}()` : typeof r
892
+ ).join(", ");
893
+ throw new TypeError(`${t}[${n}]`);
894
+ }
895
+ }
896
+ var vn = (e) => Array.isArray(e) ? e : [e];
897
+ function ni(e) {
898
+ const t = Array.isArray(e[0]) ? e[0] : e;
899
+ return ti(
900
+ t,
901
+ "createSelector expects all input-selectors to be functions, but received the following types: "
902
+ ), t;
903
+ }
904
+ function Sn(e, t) {
905
+ const n = [], { length: r } = e;
906
+ for (let i = 0; i < r; i++)
907
+ n.push(e[i].apply(null, t));
908
+ return n;
909
+ }
910
+ var ri = (e, t) => {
911
+ const { identityFunctionCheck: n, inputStabilityCheck: r } = {
912
+ ...Xr,
913
+ ...t
914
+ };
915
+ return {
916
+ identityFunctionCheck: {
917
+ shouldRun: n === "always" || n === "once" && e,
918
+ run: Yr
919
+ },
920
+ inputStabilityCheck: {
921
+ shouldRun: r === "always" || r === "once" && e,
922
+ run: Jr
923
+ }
924
+ };
925
+ }, ii = class {
926
+ constructor(e) {
927
+ this.value = e;
928
+ }
929
+ deref() {
930
+ return this.value;
931
+ }
932
+ }, oi = typeof WeakRef < "u" ? WeakRef : ii, si = 0, _n = 1;
933
+ function it() {
934
+ return {
935
+ s: si,
936
+ v: void 0,
937
+ o: null,
938
+ p: null
939
+ };
940
+ }
941
+ function vt(e, t = {}) {
942
+ let n = it();
943
+ const { resultEqualityCheck: r } = t;
944
+ let i, u = 0;
945
+ function m() {
946
+ let _ = n;
947
+ const { length: C } = arguments;
948
+ for (let I = 0, A = C; I < A; I++) {
949
+ const R = arguments[I];
950
+ if (typeof R == "function" || typeof R == "object" && R !== null) {
951
+ let d = _.o;
952
+ d === null && (_.o = d = /* @__PURE__ */ new WeakMap());
953
+ const v = d.get(R);
954
+ v === void 0 ? (_ = it(), d.set(R, _)) : _ = v;
955
+ } else {
956
+ let d = _.p;
957
+ d === null && (_.p = d = /* @__PURE__ */ new Map());
958
+ const v = d.get(R);
959
+ v === void 0 ? (_ = it(), d.set(R, _)) : _ = v;
960
+ }
961
+ }
962
+ const w = _;
963
+ let T;
964
+ if (_.s === _n)
965
+ T = _.v;
966
+ else if (T = e.apply(null, arguments), u++, r) {
967
+ const I = i?.deref?.() ?? i;
968
+ I != null && r(I, T) && (T = I, u !== 0 && u--), i = typeof T == "object" && T !== null || typeof T == "function" ? new oi(T) : T;
969
+ }
970
+ return w.s = _n, w.v = T, T;
971
+ }
972
+ return m.clearCache = () => {
973
+ n = it(), m.resetResultsCount();
974
+ }, m.resultsCount = () => u, m.resetResultsCount = () => {
975
+ u = 0;
976
+ }, m;
977
+ }
978
+ function ai(e, ...t) {
979
+ const n = typeof e == "function" ? {
980
+ memoize: e,
981
+ memoizeOptions: t
982
+ } : e, r = (...i) => {
983
+ let u = 0, m = 0, _, C = {}, w = i.pop();
984
+ typeof w == "object" && (C = w, w = i.pop()), Zr(
985
+ w,
986
+ `createSelector expects an output function after the inputs, but received: [${typeof w}]`
987
+ );
988
+ const T = {
989
+ ...n,
990
+ ...C
991
+ }, {
992
+ memoize: I,
993
+ memoizeOptions: A = [],
994
+ argsMemoize: R = vt,
995
+ argsMemoizeOptions: d = [],
996
+ devModeChecks: v = {}
997
+ } = T, p = vn(A), P = vn(d), O = ni(i), f = I(function() {
998
+ return u++, w.apply(
999
+ null,
1000
+ arguments
1001
+ );
1002
+ }, ...p);
1003
+ let g = !0;
1004
+ const s = R(function() {
1005
+ m++;
1006
+ const S = Sn(
1007
+ O,
1008
+ arguments
1009
+ );
1010
+ if (_ = f.apply(null, S), process.env.NODE_ENV !== "production") {
1011
+ const { identityFunctionCheck: b, inputStabilityCheck: h } = ri(g, v);
1012
+ if (b.shouldRun && b.run(
1013
+ w,
1014
+ S,
1015
+ _
1016
+ ), h.shouldRun) {
1017
+ const l = Sn(
1018
+ O,
1019
+ arguments
1020
+ );
1021
+ h.run(
1022
+ { inputSelectorResults: S, inputSelectorResultsCopy: l },
1023
+ { memoize: I, memoizeOptions: p },
1024
+ arguments
1025
+ );
1026
+ }
1027
+ g && (g = !1);
1028
+ }
1029
+ return _;
1030
+ }, ...P);
1031
+ return Object.assign(s, {
1032
+ resultFunc: w,
1033
+ memoizedResultFunc: f,
1034
+ dependencies: O,
1035
+ dependencyRecomputations: () => m,
1036
+ resetDependencyRecomputations: () => {
1037
+ m = 0;
1038
+ },
1039
+ lastResult: () => _,
1040
+ recomputations: () => u,
1041
+ resetRecomputations: () => {
1042
+ u = 0;
1043
+ },
1044
+ memoize: I,
1045
+ argsMemoize: R
1046
+ });
1047
+ };
1048
+ return Object.assign(r, {
1049
+ withTypes: () => r
1050
+ }), r;
1051
+ }
1052
+ var nr = /* @__PURE__ */ ai(vt), ci = Object.assign(
1053
+ (e, t = nr) => {
1054
+ ei(
1055
+ e,
1056
+ `createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`
1057
+ );
1058
+ const n = Object.keys(e), r = n.map(
1059
+ (u) => e[u]
1060
+ );
1061
+ return t(
1062
+ r,
1063
+ (...u) => u.reduce((m, _, C) => (m[n[C]] = _, m), {})
1064
+ );
1065
+ },
1066
+ { withTypes: () => ci }
1067
+ ), rr = /* @__PURE__ */ ((e) => (e.uninitialized = "uninitialized", e.pending = "pending", e.fulfilled = "fulfilled", e.rejected = "rejected", e))(rr || {}), ce = "uninitialized", $t = "pending", Qe = "fulfilled", qe = "rejected";
1068
+ function bn(e) {
1069
+ return {
1070
+ status: e,
1071
+ isUninitialized: e === ce,
1072
+ isLoading: e === $t,
1073
+ isSuccess: e === Qe,
1074
+ isError: e === qe
1075
+ };
1076
+ }
1077
+ var En = Ve;
1078
+ function Zt(e, t) {
1079
+ if (e === t || !(En(e) && En(t) || Array.isArray(e) && Array.isArray(t)))
1080
+ return t;
1081
+ const n = Object.keys(t), r = Object.keys(e);
1082
+ let i = n.length === r.length;
1083
+ const u = Array.isArray(t) ? [] : {};
1084
+ for (const m of n)
1085
+ u[m] = Zt(e[m], t[m]), i && (i = e[m] === u[m]);
1086
+ return i ? e : u;
1087
+ }
1088
+ function Lt(e, t, n) {
1089
+ return e.reduce((r, i, u) => (t(i, u) && r.push(n(i, u)), r), []).flat();
1090
+ }
1091
+ function ui(e) {
1092
+ return new RegExp("(^|:)//").test(e);
1093
+ }
1094
+ function li() {
1095
+ return typeof document > "u" ? !0 : document.visibilityState !== "hidden";
1096
+ }
1097
+ function en(e) {
1098
+ return e != null;
1099
+ }
1100
+ function Pn(e) {
1101
+ return [...e?.values() ?? []].filter(en);
1102
+ }
1103
+ function fi() {
1104
+ return typeof navigator > "u" || navigator.onLine === void 0 ? !0 : navigator.onLine;
1105
+ }
1106
+ var di = (e) => e.replace(/\/$/, ""), pi = (e) => e.replace(/^\//, "");
1107
+ function hi(e, t) {
1108
+ if (!e)
1109
+ return t;
1110
+ if (!t)
1111
+ return e;
1112
+ if (ui(t))
1113
+ return t;
1114
+ const n = e.endsWith("/") || !t.startsWith("?") ? "/" : "";
1115
+ return e = di(e), t = pi(t), `${e}${n}${t}`;
1116
+ }
1117
+ function St(e, t, n) {
1118
+ return e.has(t) ? e.get(t) : e.set(t, n(t)).get(t);
1119
+ }
1120
+ var jt = () => /* @__PURE__ */ new Map(), yi = (e) => {
1121
+ const t = new AbortController();
1122
+ return setTimeout(() => {
1123
+ const n = "signal timed out", r = "TimeoutError";
1124
+ t.abort(
1125
+ // some environments (React Native, Node) don't have DOMException
1126
+ typeof DOMException < "u" ? new DOMException(n, r) : Object.assign(new Error(n), {
1127
+ name: r
1128
+ })
1129
+ );
1130
+ }, e), t.signal;
1131
+ }, gi = (...e) => {
1132
+ for (const n of e) if (n.aborted) return AbortSignal.abort(n.reason);
1133
+ const t = new AbortController();
1134
+ for (const n of e)
1135
+ n.addEventListener("abort", () => t.abort(n.reason), {
1136
+ signal: t.signal,
1137
+ once: !0
1138
+ });
1139
+ return t.signal;
1140
+ }, wn = (...e) => fetch(...e), mi = (e) => e.status >= 200 && e.status <= 299, vi = (e) => (
1141
+ /*applicat*/
1142
+ /ion\/(vnd\.api\+)?json/.test(e.get("content-type") || "")
1143
+ );
1144
+ function Rn(e) {
1145
+ if (!Ve(e))
1146
+ return e;
1147
+ const t = {
1148
+ ...e
1149
+ };
1150
+ for (const [n, r] of Object.entries(t))
1151
+ r === void 0 && delete t[n];
1152
+ return t;
1153
+ }
1154
+ var Si = (e) => typeof e == "object" && (Ve(e) || Array.isArray(e) || typeof e.toJSON == "function");
1155
+ function _i({
1156
+ baseUrl: e,
1157
+ prepareHeaders: t = (I) => I,
1158
+ fetchFn: n = wn,
1159
+ paramsSerializer: r,
1160
+ isJsonContentType: i = vi,
1161
+ jsonContentType: u = "application/json",
1162
+ jsonReplacer: m,
1163
+ timeout: _,
1164
+ responseHandler: C,
1165
+ validateStatus: w,
1166
+ ...T
1167
+ } = {}) {
1168
+ return typeof fetch > "u" && n === wn && console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."), async (A, R, d) => {
1169
+ const {
1170
+ getState: v,
1171
+ extra: p,
1172
+ endpoint: P,
1173
+ forced: O,
1174
+ type: f
1175
+ } = R;
1176
+ let g, {
1177
+ url: s,
1178
+ headers: a = new Headers(T.headers),
1179
+ params: S = void 0,
1180
+ responseHandler: b = C ?? "json",
1181
+ validateStatus: h = w ?? mi,
1182
+ timeout: l = _,
1183
+ ...o
1184
+ } = typeof A == "string" ? {
1185
+ url: A
1186
+ } : A, c = {
1187
+ ...T,
1188
+ signal: l ? gi(R.signal, yi(l)) : R.signal,
1189
+ ...o
1190
+ };
1191
+ a = new Headers(Rn(a)), c.headers = await t(a, {
1192
+ getState: v,
1193
+ arg: A,
1194
+ extra: p,
1195
+ endpoint: P,
1196
+ forced: O,
1197
+ type: f,
1198
+ extraOptions: d
1199
+ }) || a;
1200
+ const y = Si(c.body);
1201
+ if (c.body != null && !y && typeof c.body != "string" && c.headers.delete("content-type"), !c.headers.has("content-type") && y && c.headers.set("content-type", u), y && i(c.headers) && (c.body = JSON.stringify(c.body, m)), c.headers.has("accept") || (b === "json" ? c.headers.set("accept", "application/json") : b === "text" && c.headers.set("accept", "text/plain, text/html, */*")), S) {
1202
+ const Q = ~s.indexOf("?") ? "&" : "?", F = r ? r(S) : new URLSearchParams(Rn(S));
1203
+ s += Q + F;
1204
+ }
1205
+ s = hi(e, s);
1206
+ const E = new Request(s, c);
1207
+ g = {
1208
+ request: new Request(s, c)
1209
+ };
1210
+ let M;
1211
+ try {
1212
+ M = await n(E);
1213
+ } catch (Q) {
1214
+ return {
1215
+ error: {
1216
+ status: (Q instanceof Error || typeof DOMException < "u" && Q instanceof DOMException) && Q.name === "TimeoutError" ? "TIMEOUT_ERROR" : "FETCH_ERROR",
1217
+ error: String(Q)
1218
+ },
1219
+ meta: g
1220
+ };
1221
+ }
1222
+ const q = M.clone();
1223
+ g.response = q;
1224
+ let k, D = "";
1225
+ try {
1226
+ let Q;
1227
+ if (await Promise.all([
1228
+ I(M, b).then((F) => k = F, (F) => Q = F),
1229
+ // see https://github.com/node-fetch/node-fetch/issues/665#issuecomment-538995182
1230
+ // we *have* to "use up" both streams at the same time or they will stop running in node-fetch scenarios
1231
+ q.text().then((F) => D = F, () => {
1232
+ })
1233
+ ]), Q) throw Q;
1234
+ } catch (Q) {
1235
+ return {
1236
+ error: {
1237
+ status: "PARSING_ERROR",
1238
+ originalStatus: M.status,
1239
+ data: D,
1240
+ error: String(Q)
1241
+ },
1242
+ meta: g
1243
+ };
1244
+ }
1245
+ return h(M, k) ? {
1246
+ data: k,
1247
+ meta: g
1248
+ } : {
1249
+ error: {
1250
+ status: M.status,
1251
+ data: k
1252
+ },
1253
+ meta: g
1254
+ };
1255
+ };
1256
+ async function I(A, R) {
1257
+ if (typeof R == "function")
1258
+ return R(A);
1259
+ if (R === "content-type" && (R = i(A.headers) ? "json" : "text"), R === "json") {
1260
+ const d = await A.text();
1261
+ return d.length ? JSON.parse(d) : null;
1262
+ }
1263
+ return A.text();
1264
+ }
1265
+ }
1266
+ var On = class {
1267
+ constructor(e, t = void 0) {
1268
+ this.value = e, this.meta = t;
1269
+ }
1270
+ }, Pt = "__rtkq/", bi = "online", Ei = "offline", ir = "focused", tn = /* @__PURE__ */ De(`${Pt}${ir}`), or = /* @__PURE__ */ De(`${Pt}un${ir}`), nn = /* @__PURE__ */ De(`${Pt}${bi}`), sr = /* @__PURE__ */ De(`${Pt}${Ei}`), et = "query", ar = "mutation", cr = "infinitequery";
1271
+ function wt(e) {
1272
+ return e.type === et;
1273
+ }
1274
+ function Pi(e) {
1275
+ return e.type === ar;
1276
+ }
1277
+ function tt(e) {
1278
+ return e.type === cr;
1279
+ }
1280
+ function _t(e) {
1281
+ return wt(e) || tt(e);
1282
+ }
1283
+ function rn(e, t, n, r, i, u) {
1284
+ const m = wi(e) ? e(t, n, r, i) : e;
1285
+ return m ? Lt(m, en, (_) => u(ur(_))) : [];
1286
+ }
1287
+ function wi(e) {
1288
+ return typeof e == "function";
1289
+ }
1290
+ function ur(e) {
1291
+ return typeof e == "string" ? {
1292
+ type: e
1293
+ } : e;
1294
+ }
1295
+ function Ri(e, t) {
1296
+ return e.catch(t);
1297
+ }
1298
+ var Te = (e, t) => e.endpointDefinitions[t], We = /* @__PURE__ */ Symbol("forceQueryFn"), Kt = (e) => typeof e[We] == "function";
1299
+ function Oi({
1300
+ serializeQueryArgs: e,
1301
+ queryThunk: t,
1302
+ infiniteQueryThunk: n,
1303
+ mutationThunk: r,
1304
+ api: i,
1305
+ context: u,
1306
+ getInternalState: m
1307
+ }) {
1308
+ const _ = (s) => m(s)?.runningQueries, C = (s) => m(s)?.runningMutations, {
1309
+ unsubscribeQueryResult: w,
1310
+ removeMutationResult: T,
1311
+ updateSubscriptionOptions: I
1312
+ } = i.internalActions;
1313
+ return {
1314
+ buildInitiateQuery: O,
1315
+ buildInitiateInfiniteQuery: f,
1316
+ buildInitiateMutation: g,
1317
+ getRunningQueryThunk: A,
1318
+ getRunningMutationThunk: R,
1319
+ getRunningQueriesThunk: d,
1320
+ getRunningMutationsThunk: v
1321
+ };
1322
+ function A(s, a) {
1323
+ return (S) => {
1324
+ const b = Te(u, s), h = e({
1325
+ queryArgs: a,
1326
+ endpointDefinition: b,
1327
+ endpointName: s
1328
+ });
1329
+ return _(S)?.get(h);
1330
+ };
1331
+ }
1332
+ function R(s, a) {
1333
+ return (S) => C(S)?.get(a);
1334
+ }
1335
+ function d() {
1336
+ return (s) => Pn(_(s));
1337
+ }
1338
+ function v() {
1339
+ return (s) => Pn(C(s));
1340
+ }
1341
+ function p(s) {
1342
+ if (process.env.NODE_ENV !== "production") {
1343
+ if (p.triggered) return;
1344
+ const a = s(i.internalActions.internal_getRTKQSubscriptions());
1345
+ if (p.triggered = !0, typeof a != "object" || typeof a?.type == "string")
1346
+ throw new Error(process.env.NODE_ENV === "production" ? ye(34) : `Warning: Middleware for RTK-Query API at reducerPath "${i.reducerPath}" has not been added to the store.
1347
+ You must add the middleware for RTK-Query to function correctly!`);
1348
+ }
1349
+ }
1350
+ function P(s, a) {
1351
+ const S = (b, {
1352
+ subscribe: h = !0,
1353
+ forceRefetch: l,
1354
+ subscriptionOptions: o,
1355
+ [We]: c,
1356
+ ...y
1357
+ } = {}) => (E, N) => {
1358
+ const M = e({
1359
+ queryArgs: b,
1360
+ endpointDefinition: a,
1361
+ endpointName: s
1362
+ });
1363
+ let q;
1364
+ const k = {
1365
+ ...y,
1366
+ type: et,
1367
+ subscribe: h,
1368
+ forceRefetch: l,
1369
+ subscriptionOptions: o,
1370
+ endpointName: s,
1371
+ originalArgs: b,
1372
+ queryCacheKey: M,
1373
+ [We]: c
1374
+ };
1375
+ if (wt(a))
1376
+ q = t(k);
1377
+ else {
1378
+ const {
1379
+ direction: $,
1380
+ initialPageParam: U,
1381
+ refetchCachedPages: x
1382
+ } = y;
1383
+ q = n({
1384
+ ...k,
1385
+ // Supply these even if undefined. This helps with a field existence
1386
+ // check over in `buildSlice.ts`
1387
+ direction: $,
1388
+ initialPageParam: U,
1389
+ refetchCachedPages: x
1390
+ });
1391
+ }
1392
+ const D = i.endpoints[s].select(b), Q = E(q), F = D(N());
1393
+ p(E);
1394
+ const {
1395
+ requestId: L,
1396
+ abort: j
1397
+ } = Q, V = F.requestId !== L, K = _(E)?.get(M), H = () => D(N()), z = Object.assign(c ? (
1398
+ // a query has been forced (upsertQueryData)
1399
+ // -> we want to resolve it once data has been written with the data that will be written
1400
+ Q.then(H)
1401
+ ) : V && !K ? (
1402
+ // a query has been skipped due to a condition and we do not have any currently running query
1403
+ // -> we want to resolve it immediately with the current data
1404
+ Promise.resolve(F)
1405
+ ) : (
1406
+ // query just started or one is already in flight
1407
+ // -> wait for the running query, then resolve with data from after that
1408
+ Promise.all([K, Q]).then(H)
1409
+ ), {
1410
+ arg: b,
1411
+ requestId: L,
1412
+ subscriptionOptions: o,
1413
+ queryCacheKey: M,
1414
+ abort: j,
1415
+ async unwrap() {
1416
+ const $ = await z;
1417
+ if ($.isError)
1418
+ throw $.error;
1419
+ return $.data;
1420
+ },
1421
+ refetch: ($) => E(S(b, {
1422
+ subscribe: !1,
1423
+ forceRefetch: !0,
1424
+ ...$
1425
+ })),
1426
+ unsubscribe() {
1427
+ h && E(w({
1428
+ queryCacheKey: M,
1429
+ requestId: L
1430
+ }));
1431
+ },
1432
+ updateSubscriptionOptions($) {
1433
+ z.subscriptionOptions = $, E(I({
1434
+ endpointName: s,
1435
+ requestId: L,
1436
+ queryCacheKey: M,
1437
+ options: $
1438
+ }));
1439
+ }
1440
+ });
1441
+ if (!K && !V && !c) {
1442
+ const $ = _(E);
1443
+ $.set(M, z), z.then(() => {
1444
+ $.delete(M);
1445
+ });
1446
+ }
1447
+ return z;
1448
+ };
1449
+ return S;
1450
+ }
1451
+ function O(s, a) {
1452
+ return P(s, a);
1453
+ }
1454
+ function f(s, a) {
1455
+ return P(s, a);
1456
+ }
1457
+ function g(s) {
1458
+ return (a, {
1459
+ track: S = !0,
1460
+ fixedCacheKey: b
1461
+ } = {}) => (h, l) => {
1462
+ const o = r({
1463
+ type: "mutation",
1464
+ endpointName: s,
1465
+ originalArgs: a,
1466
+ track: S,
1467
+ fixedCacheKey: b
1468
+ }), c = h(o);
1469
+ p(h);
1470
+ const {
1471
+ requestId: y,
1472
+ abort: E,
1473
+ unwrap: N
1474
+ } = c, M = Ri(c.unwrap().then((Q) => ({
1475
+ data: Q
1476
+ })), (Q) => ({
1477
+ error: Q
1478
+ })), q = () => {
1479
+ h(T({
1480
+ requestId: y,
1481
+ fixedCacheKey: b
1482
+ }));
1483
+ }, k = Object.assign(M, {
1484
+ arg: c.arg,
1485
+ requestId: y,
1486
+ abort: E,
1487
+ unwrap: N,
1488
+ reset: q
1489
+ }), D = C(h);
1490
+ return D.set(y, k), k.then(() => {
1491
+ D.delete(y);
1492
+ }), b && (D.set(b, k), k.then(() => {
1493
+ D.get(b) === k && D.delete(b);
1494
+ })), k;
1495
+ };
1496
+ }
1497
+ }
1498
+ var lr = class extends Gr {
1499
+ constructor(e, t, n, r) {
1500
+ super(e), this.value = t, this.schemaName = n, this._bqMeta = r;
1501
+ }
1502
+ }, me = (e, t) => Array.isArray(e) ? e.includes(t) : !!e;
1503
+ async function ve(e, t, n, r) {
1504
+ const i = await e["~standard"].validate(t);
1505
+ if (i.issues)
1506
+ throw new lr(i.issues, t, n, r);
1507
+ return i.value;
1508
+ }
1509
+ function In(e) {
1510
+ return e;
1511
+ }
1512
+ var ke = (e = {}) => ({
1513
+ ...e,
1514
+ [Ln]: !0
1515
+ });
1516
+ function Ii({
1517
+ reducerPath: e,
1518
+ baseQuery: t,
1519
+ context: {
1520
+ endpointDefinitions: n
1521
+ },
1522
+ serializeQueryArgs: r,
1523
+ api: i,
1524
+ assertTagType: u,
1525
+ selectors: m,
1526
+ onSchemaFailure: _,
1527
+ catchSchemaFailure: C,
1528
+ skipSchemaValidation: w
1529
+ }) {
1530
+ const T = (o, c, y, E) => (N, M) => {
1531
+ const q = n[o], k = r({
1532
+ queryArgs: c,
1533
+ endpointDefinition: q,
1534
+ endpointName: o
1535
+ });
1536
+ if (N(i.internalActions.queryResultPatched({
1537
+ queryCacheKey: k,
1538
+ patches: y
1539
+ })), !E)
1540
+ return;
1541
+ const D = i.endpoints[o].select(c)(
1542
+ // Work around TS 4.1 mismatch
1543
+ M()
1544
+ ), Q = rn(q.providesTags, D.data, void 0, c, {}, u);
1545
+ N(i.internalActions.updateProvidedBy([{
1546
+ queryCacheKey: k,
1547
+ providedTags: Q
1548
+ }]));
1549
+ };
1550
+ function I(o, c, y = 0) {
1551
+ const E = [c, ...o];
1552
+ return y && E.length > y ? E.slice(0, -1) : E;
1553
+ }
1554
+ function A(o, c, y = 0) {
1555
+ const E = [...o, c];
1556
+ return y && E.length > y ? E.slice(1) : E;
1557
+ }
1558
+ const R = (o, c, y, E = !0) => (N, M) => {
1559
+ const k = i.endpoints[o].select(c)(
1560
+ // Work around TS 4.1 mismatch
1561
+ M()
1562
+ ), D = {
1563
+ patches: [],
1564
+ inversePatches: [],
1565
+ undo: () => N(i.util.patchQueryData(o, c, D.inversePatches, E))
1566
+ };
1567
+ if (k.status === ce)
1568
+ return D;
1569
+ let Q;
1570
+ if ("data" in k)
1571
+ if (ne(k.data)) {
1572
+ const [F, L, j] = tr(k.data, y);
1573
+ D.patches.push(...L), D.inversePatches.push(...j), Q = F;
1574
+ } else
1575
+ Q = y(k.data), D.patches.push({
1576
+ op: "replace",
1577
+ path: [],
1578
+ value: Q
1579
+ }), D.inversePatches.push({
1580
+ op: "replace",
1581
+ path: [],
1582
+ value: k.data
1583
+ });
1584
+ return D.patches.length === 0 || N(i.util.patchQueryData(o, c, D.patches, E)), D;
1585
+ }, d = (o, c, y) => (E) => E(i.endpoints[o].initiate(c, {
1586
+ subscribe: !1,
1587
+ forceRefetch: !0,
1588
+ [We]: () => ({
1589
+ data: y
1590
+ })
1591
+ })), v = (o, c) => o.query && o[c] ? o[c] : In, p = async (o, {
1592
+ signal: c,
1593
+ abort: y,
1594
+ rejectWithValue: E,
1595
+ fulfillWithValue: N,
1596
+ dispatch: M,
1597
+ getState: q,
1598
+ extra: k
1599
+ }) => {
1600
+ const D = n[o.endpointName], {
1601
+ metaSchema: Q,
1602
+ skipSchemaValidation: F = w
1603
+ } = D, L = o.type === et;
1604
+ try {
1605
+ let j = In;
1606
+ const V = {
1607
+ signal: c,
1608
+ abort: y,
1609
+ dispatch: M,
1610
+ getState: q,
1611
+ extra: k,
1612
+ endpoint: o.endpointName,
1613
+ type: o.type,
1614
+ forced: L ? P(o, q()) : void 0,
1615
+ queryCacheKey: L ? o.queryCacheKey : void 0
1616
+ }, K = L ? o[We] : void 0;
1617
+ let H;
1618
+ const z = async (U, x, re, Y) => {
1619
+ if (x == null && U.pages.length)
1620
+ return Promise.resolve({
1621
+ data: U
1622
+ });
1623
+ const Oe = {
1624
+ queryArg: o.originalArgs,
1625
+ pageParam: x
1626
+ }, ie = await $(Oe), Ie = Y ? I : A;
1627
+ return {
1628
+ data: {
1629
+ pages: Ie(U.pages, ie.data, re),
1630
+ pageParams: Ie(U.pageParams, x, re)
1631
+ },
1632
+ meta: ie.meta
1633
+ };
1634
+ };
1635
+ async function $(U) {
1636
+ let x;
1637
+ const {
1638
+ extraOptions: re,
1639
+ argSchema: Y,
1640
+ rawResponseSchema: Oe,
1641
+ responseSchema: ie
1642
+ } = D;
1643
+ if (Y && !me(F, "arg") && (U = await ve(
1644
+ Y,
1645
+ U,
1646
+ "argSchema",
1647
+ {}
1648
+ // we don't have a meta yet, so we can't pass it
1649
+ )), K ? x = K() : D.query ? (j = v(D, "transformResponse"), x = await t(D.query(U), V, re)) : x = await D.queryFn(U, V, re, (X) => t(X, V, re)), typeof process < "u" && process.env.NODE_ENV === "development") {
1650
+ const X = D.query ? "`baseQuery`" : "`queryFn`";
1651
+ let ee;
1652
+ if (!x)
1653
+ ee = `${X} did not return anything.`;
1654
+ else if (typeof x != "object")
1655
+ ee = `${X} did not return an object.`;
1656
+ else if (x.error && x.data)
1657
+ ee = `${X} returned an object containing both \`error\` and \`result\`.`;
1658
+ else if (x.error === void 0 && x.data === void 0)
1659
+ ee = `${X} returned an object containing neither a valid \`error\` and \`result\`. At least one of them should not be \`undefined\``;
1660
+ else
1661
+ for (const le of Object.keys(x))
1662
+ if (le !== "error" && le !== "data" && le !== "meta") {
1663
+ ee = `The object returned by ${X} has the unknown property ${le}.`;
1664
+ break;
1665
+ }
1666
+ ee && console.error(`Error encountered handling the endpoint ${o.endpointName}.
1667
+ ${ee}
1668
+ It needs to return an object with either the shape \`{ data: <value> }\` or \`{ error: <value> }\` that may contain an optional \`meta\` property.
1669
+ Object returned was:`, x);
1670
+ }
1671
+ if (x.error) throw new On(x.error, x.meta);
1672
+ let {
1673
+ data: Ie
1674
+ } = x;
1675
+ Oe && !me(F, "rawResponse") && (Ie = await ve(Oe, x.data, "rawResponseSchema", x.meta));
1676
+ let ue = await j(Ie, x.meta, U);
1677
+ return ie && !me(F, "response") && (ue = await ve(ie, ue, "responseSchema", x.meta)), {
1678
+ ...x,
1679
+ data: ue
1680
+ };
1681
+ }
1682
+ if (L && "infiniteQueryOptions" in D) {
1683
+ const {
1684
+ infiniteQueryOptions: U
1685
+ } = D, {
1686
+ maxPages: x = 1 / 0
1687
+ } = U, re = o.refetchCachedPages ?? U.refetchCachedPages ?? !0;
1688
+ let Y;
1689
+ const Oe = {
1690
+ pages: [],
1691
+ pageParams: []
1692
+ }, ie = m.selectQueryEntry(q(), o.queryCacheKey)?.data, ue = /* arg.forceRefetch */ P(o, q()) && !o.direction || !ie ? Oe : ie;
1693
+ if ("direction" in o && o.direction && ue.pages.length) {
1694
+ const X = o.direction === "backward", le = (X ? fr : Ht)(U, ue, o.originalArgs);
1695
+ Y = await z(ue, le, x, X);
1696
+ } else {
1697
+ const {
1698
+ initialPageParam: X = U.initialPageParam
1699
+ } = o, ee = ie?.pageParams ?? [], le = ee[0] ?? X, Rr = ee.length;
1700
+ if (Y = await z(ue, le, x), K && (Y = {
1701
+ data: Y.data.pages[0]
1702
+ }), re)
1703
+ for (let sn = 1; sn < Rr; sn++) {
1704
+ const Or = Ht(U, Y.data, o.originalArgs);
1705
+ Y = await z(Y.data, Or, x);
1706
+ }
1707
+ }
1708
+ H = Y;
1709
+ } else
1710
+ H = await $(o.originalArgs);
1711
+ return Q && !me(F, "meta") && H.meta && (H.meta = await ve(Q, H.meta, "metaSchema", H.meta)), N(H.data, ke({
1712
+ fulfilledTimeStamp: Date.now(),
1713
+ baseQueryMeta: H.meta
1714
+ }));
1715
+ } catch (j) {
1716
+ let V = j;
1717
+ if (V instanceof On) {
1718
+ let K = v(D, "transformErrorResponse");
1719
+ const {
1720
+ rawErrorResponseSchema: H,
1721
+ errorResponseSchema: z
1722
+ } = D;
1723
+ let {
1724
+ value: $,
1725
+ meta: U
1726
+ } = V;
1727
+ try {
1728
+ H && !me(F, "rawErrorResponse") && ($ = await ve(H, $, "rawErrorResponseSchema", U)), Q && !me(F, "meta") && (U = await ve(Q, U, "metaSchema", U));
1729
+ let x = await K($, U, o.originalArgs);
1730
+ return z && !me(F, "errorResponse") && (x = await ve(z, x, "errorResponseSchema", U)), E(x, ke({
1731
+ baseQueryMeta: U
1732
+ }));
1733
+ } catch (x) {
1734
+ V = x;
1735
+ }
1736
+ }
1737
+ try {
1738
+ if (V instanceof lr) {
1739
+ const K = {
1740
+ endpoint: o.endpointName,
1741
+ arg: o.originalArgs,
1742
+ type: o.type,
1743
+ queryCacheKey: L ? o.queryCacheKey : void 0
1744
+ };
1745
+ D.onSchemaFailure?.(V, K), _?.(V, K);
1746
+ const {
1747
+ catchSchemaFailure: H = C
1748
+ } = D;
1749
+ if (H)
1750
+ return E(H(V, K), ke({
1751
+ baseQueryMeta: V._bqMeta
1752
+ }));
1753
+ }
1754
+ } catch (K) {
1755
+ V = K;
1756
+ }
1757
+ throw typeof process < "u" && process.env.NODE_ENV !== "production" ? console.error(`An unhandled error occurred processing a request for the endpoint "${o.endpointName}".
1758
+ In the case of an unhandled error, no tags will be "provided" or "invalidated".`, V) : console.error(V), V;
1759
+ }
1760
+ };
1761
+ function P(o, c) {
1762
+ const y = m.selectQueryEntry(c, o.queryCacheKey), E = m.selectConfig(c).refetchOnMountOrArgChange, N = y?.fulfilledTimeStamp, M = o.forceRefetch ?? (o.subscribe && E);
1763
+ return M ? M === !0 || (Number(/* @__PURE__ */ new Date()) - Number(N)) / 1e3 >= M : !1;
1764
+ }
1765
+ const O = () => an(`${e}/executeQuery`, p, {
1766
+ getPendingMeta({
1767
+ arg: c
1768
+ }) {
1769
+ const y = n[c.endpointName];
1770
+ return ke({
1771
+ startedTimeStamp: Date.now(),
1772
+ ...tt(y) ? {
1773
+ direction: c.direction
1774
+ } : {}
1775
+ });
1776
+ },
1777
+ condition(c, {
1778
+ getState: y
1779
+ }) {
1780
+ const E = y(), N = m.selectQueryEntry(E, c.queryCacheKey), M = N?.fulfilledTimeStamp, q = c.originalArgs, k = N?.originalArgs, D = n[c.endpointName], Q = c.direction;
1781
+ return Kt(c) ? !0 : N?.status === "pending" ? !1 : P(c, E) || wt(D) && D?.forceRefetch?.({
1782
+ currentArg: q,
1783
+ previousArg: k,
1784
+ endpointState: N,
1785
+ state: E
1786
+ }) ? !0 : !(M && !Q);
1787
+ },
1788
+ dispatchConditionRejection: !0
1789
+ }), f = O(), g = O(), s = an(`${e}/executeMutation`, p, {
1790
+ getPendingMeta() {
1791
+ return ke({
1792
+ startedTimeStamp: Date.now()
1793
+ });
1794
+ }
1795
+ }), a = (o) => "force" in o, S = (o) => "ifOlderThan" in o, b = (o, c, y = {}) => (E, N) => {
1796
+ const M = a(y) && y.force, q = S(y) && y.ifOlderThan, k = (Q = !0) => {
1797
+ const F = {
1798
+ forceRefetch: Q,
1799
+ subscribe: !1
1800
+ };
1801
+ return i.endpoints[o].initiate(c, F);
1802
+ }, D = i.endpoints[o].select(c)(N());
1803
+ if (M)
1804
+ E(k());
1805
+ else if (q) {
1806
+ const Q = D?.fulfilledTimeStamp;
1807
+ if (!Q) {
1808
+ E(k());
1809
+ return;
1810
+ }
1811
+ (Number(/* @__PURE__ */ new Date()) - Number(new Date(Q))) / 1e3 >= q && E(k());
1812
+ } else
1813
+ E(k(!1));
1814
+ };
1815
+ function h(o) {
1816
+ return (c) => c?.meta?.arg?.endpointName === o;
1817
+ }
1818
+ function l(o, c) {
1819
+ return {
1820
+ matchPending: Ot(jn(o), h(c)),
1821
+ matchFulfilled: Ot(be(o), h(c)),
1822
+ matchRejected: Ot(Gt(o), h(c))
1823
+ };
1824
+ }
1825
+ return {
1826
+ queryThunk: f,
1827
+ mutationThunk: s,
1828
+ infiniteQueryThunk: g,
1829
+ prefetch: b,
1830
+ updateQueryData: R,
1831
+ upsertQueryData: d,
1832
+ patchQueryData: T,
1833
+ buildMatchThunkActions: l
1834
+ };
1835
+ }
1836
+ function Ht(e, {
1837
+ pages: t,
1838
+ pageParams: n
1839
+ }, r) {
1840
+ const i = t.length - 1;
1841
+ return e.getNextPageParam(t[i], t, n[i], n, r);
1842
+ }
1843
+ function fr(e, {
1844
+ pages: t,
1845
+ pageParams: n
1846
+ }, r) {
1847
+ return e.getPreviousPageParam?.(t[0], t, n[0], n, r);
1848
+ }
1849
+ function dr(e, t, n, r) {
1850
+ return rn(n[e.meta.arg.endpointName][t], be(e) ? e.payload : void 0, Bt(e) ? e.payload : void 0, e.meta.arg.originalArgs, "baseQueryMeta" in e.meta ? e.meta.baseQueryMeta : void 0, r);
1851
+ }
1852
+ function An(e) {
1853
+ return Z(e) ? Zn(e) : e;
1854
+ }
1855
+ function ot(e, t, n) {
1856
+ const r = e[t];
1857
+ r && n(r);
1858
+ }
1859
+ function Be(e) {
1860
+ return ("arg" in e ? e.arg.fixedCacheKey : e.fixedCacheKey) ?? e.requestId;
1861
+ }
1862
+ function Cn(e, t, n) {
1863
+ const r = e[Be(t)];
1864
+ r && n(r);
1865
+ }
1866
+ var st = {};
1867
+ function Ai({
1868
+ reducerPath: e,
1869
+ queryThunk: t,
1870
+ mutationThunk: n,
1871
+ serializeQueryArgs: r,
1872
+ context: {
1873
+ endpointDefinitions: i,
1874
+ apiUid: u,
1875
+ extractRehydrationInfo: m,
1876
+ hasRehydrationInfo: _
1877
+ },
1878
+ assertTagType: C,
1879
+ config: w
1880
+ }) {
1881
+ const T = De(`${e}/resetApiState`);
1882
+ function I(h, l, o, c) {
1883
+ h[l.queryCacheKey] ??= {
1884
+ status: ce,
1885
+ endpointName: l.endpointName
1886
+ }, ot(h, l.queryCacheKey, (y) => {
1887
+ y.status = $t, y.requestId = o && y.requestId ? (
1888
+ // for `upsertQuery` **updates**, keep the current `requestId`
1889
+ y.requestId
1890
+ ) : (
1891
+ // for normal queries or `upsertQuery` **inserts** always update the `requestId`
1892
+ c.requestId
1893
+ ), l.originalArgs !== void 0 && (y.originalArgs = l.originalArgs), y.startedTimeStamp = c.startedTimeStamp;
1894
+ const E = i[c.arg.endpointName];
1895
+ tt(E) && "direction" in l && (y.direction = l.direction);
1896
+ });
1897
+ }
1898
+ function A(h, l, o, c) {
1899
+ ot(h, l.arg.queryCacheKey, (y) => {
1900
+ if (y.requestId !== l.requestId && !c) return;
1901
+ const {
1902
+ merge: E
1903
+ } = i[l.arg.endpointName];
1904
+ if (y.status = Qe, E)
1905
+ if (y.data !== void 0) {
1906
+ const {
1907
+ fulfilledTimeStamp: N,
1908
+ arg: M,
1909
+ baseQueryMeta: q,
1910
+ requestId: k
1911
+ } = l;
1912
+ let D = Wt(y.data, (Q) => E(Q, o, {
1913
+ arg: M.originalArgs,
1914
+ baseQueryMeta: q,
1915
+ fulfilledTimeStamp: N,
1916
+ requestId: k
1917
+ }));
1918
+ y.data = D;
1919
+ } else
1920
+ y.data = o;
1921
+ else
1922
+ y.data = i[l.arg.endpointName].structuralSharing ?? !0 ? Zt(Z(y.data) ? kr(y.data) : y.data, o) : o;
1923
+ delete y.error, y.fulfilledTimeStamp = l.fulfilledTimeStamp;
1924
+ });
1925
+ }
1926
+ const R = Se({
1927
+ name: `${e}/queries`,
1928
+ initialState: st,
1929
+ reducers: {
1930
+ removeQueryResult: {
1931
+ reducer(h, {
1932
+ payload: {
1933
+ queryCacheKey: l
1934
+ }
1935
+ }) {
1936
+ delete h[l];
1937
+ },
1938
+ prepare: Ne()
1939
+ },
1940
+ cacheEntriesUpserted: {
1941
+ reducer(h, l) {
1942
+ for (const o of l.payload) {
1943
+ const {
1944
+ queryDescription: c,
1945
+ value: y
1946
+ } = o;
1947
+ I(h, c, !0, {
1948
+ arg: c,
1949
+ requestId: l.meta.requestId,
1950
+ startedTimeStamp: l.meta.timestamp
1951
+ }), A(
1952
+ h,
1953
+ {
1954
+ arg: c,
1955
+ requestId: l.meta.requestId,
1956
+ fulfilledTimeStamp: l.meta.timestamp,
1957
+ baseQueryMeta: {}
1958
+ },
1959
+ y,
1960
+ // We know we're upserting here
1961
+ !0
1962
+ );
1963
+ }
1964
+ },
1965
+ prepare: (h) => ({
1966
+ payload: h.map((c) => {
1967
+ const {
1968
+ endpointName: y,
1969
+ arg: E,
1970
+ value: N
1971
+ } = c, M = i[y];
1972
+ return {
1973
+ queryDescription: {
1974
+ type: et,
1975
+ endpointName: y,
1976
+ originalArgs: c.arg,
1977
+ queryCacheKey: r({
1978
+ queryArgs: E,
1979
+ endpointDefinition: M,
1980
+ endpointName: y
1981
+ })
1982
+ },
1983
+ value: N
1984
+ };
1985
+ }),
1986
+ meta: {
1987
+ [Ln]: !0,
1988
+ requestId: $n(),
1989
+ timestamp: Date.now()
1990
+ }
1991
+ })
1992
+ },
1993
+ queryResultPatched: {
1994
+ reducer(h, {
1995
+ payload: {
1996
+ queryCacheKey: l,
1997
+ patches: o
1998
+ }
1999
+ }) {
2000
+ ot(h, l, (c) => {
2001
+ c.data = mn(c.data, o.concat());
2002
+ });
2003
+ },
2004
+ prepare: Ne()
2005
+ }
2006
+ },
2007
+ extraReducers(h) {
2008
+ h.addCase(t.pending, (l, {
2009
+ meta: o,
2010
+ meta: {
2011
+ arg: c
2012
+ }
2013
+ }) => {
2014
+ const y = Kt(c);
2015
+ I(l, c, y, o);
2016
+ }).addCase(t.fulfilled, (l, {
2017
+ meta: o,
2018
+ payload: c
2019
+ }) => {
2020
+ const y = Kt(o.arg);
2021
+ A(l, o, c, y);
2022
+ }).addCase(t.rejected, (l, {
2023
+ meta: {
2024
+ condition: o,
2025
+ arg: c,
2026
+ requestId: y
2027
+ },
2028
+ error: E,
2029
+ payload: N
2030
+ }) => {
2031
+ ot(l, c.queryCacheKey, (M) => {
2032
+ if (!o) {
2033
+ if (M.requestId !== y) return;
2034
+ M.status = qe, M.error = N ?? E;
2035
+ }
2036
+ });
2037
+ }).addMatcher(_, (l, o) => {
2038
+ const {
2039
+ queries: c
2040
+ } = m(o);
2041
+ for (const [y, E] of Object.entries(c))
2042
+ // do not rehydrate entries that were currently in flight.
2043
+ (E?.status === Qe || E?.status === qe) && (l[y] = E);
2044
+ });
2045
+ }
2046
+ }), d = Se({
2047
+ name: `${e}/mutations`,
2048
+ initialState: st,
2049
+ reducers: {
2050
+ removeMutationResult: {
2051
+ reducer(h, {
2052
+ payload: l
2053
+ }) {
2054
+ const o = Be(l);
2055
+ o in h && delete h[o];
2056
+ },
2057
+ prepare: Ne()
2058
+ }
2059
+ },
2060
+ extraReducers(h) {
2061
+ h.addCase(n.pending, (l, {
2062
+ meta: o,
2063
+ meta: {
2064
+ requestId: c,
2065
+ arg: y,
2066
+ startedTimeStamp: E
2067
+ }
2068
+ }) => {
2069
+ y.track && (l[Be(o)] = {
2070
+ requestId: c,
2071
+ status: $t,
2072
+ endpointName: y.endpointName,
2073
+ startedTimeStamp: E
2074
+ });
2075
+ }).addCase(n.fulfilled, (l, {
2076
+ payload: o,
2077
+ meta: c
2078
+ }) => {
2079
+ c.arg.track && Cn(l, c, (y) => {
2080
+ y.requestId === c.requestId && (y.status = Qe, y.data = o, y.fulfilledTimeStamp = c.fulfilledTimeStamp);
2081
+ });
2082
+ }).addCase(n.rejected, (l, {
2083
+ payload: o,
2084
+ error: c,
2085
+ meta: y
2086
+ }) => {
2087
+ y.arg.track && Cn(l, y, (E) => {
2088
+ E.requestId === y.requestId && (E.status = qe, E.error = o ?? c);
2089
+ });
2090
+ }).addMatcher(_, (l, o) => {
2091
+ const {
2092
+ mutations: c
2093
+ } = m(o);
2094
+ for (const [y, E] of Object.entries(c))
2095
+ // do not rehydrate entries that were currently in flight.
2096
+ (E?.status === Qe || E?.status === qe) && // only rehydrate endpoints that were persisted using a `fixedCacheKey`
2097
+ y !== E?.requestId && (l[y] = E);
2098
+ });
2099
+ }
2100
+ }), v = {
2101
+ tags: {},
2102
+ keys: {}
2103
+ }, p = Se({
2104
+ name: `${e}/invalidation`,
2105
+ initialState: v,
2106
+ reducers: {
2107
+ updateProvidedBy: {
2108
+ reducer(h, l) {
2109
+ for (const {
2110
+ queryCacheKey: o,
2111
+ providedTags: c
2112
+ } of l.payload) {
2113
+ P(h, o);
2114
+ for (const {
2115
+ type: y,
2116
+ id: E
2117
+ } of c) {
2118
+ const N = (h.tags[y] ??= {})[E || "__internal_without_id"] ??= [];
2119
+ N.includes(o) || N.push(o);
2120
+ }
2121
+ h.keys[o] = c;
2122
+ }
2123
+ },
2124
+ prepare: Ne()
2125
+ }
2126
+ },
2127
+ extraReducers(h) {
2128
+ h.addCase(R.actions.removeQueryResult, (l, {
2129
+ payload: {
2130
+ queryCacheKey: o
2131
+ }
2132
+ }) => {
2133
+ P(l, o);
2134
+ }).addMatcher(_, (l, o) => {
2135
+ const {
2136
+ provided: c
2137
+ } = m(o);
2138
+ for (const [y, E] of Object.entries(c.tags ?? {}))
2139
+ for (const [N, M] of Object.entries(E)) {
2140
+ const q = (l.tags[y] ??= {})[N || "__internal_without_id"] ??= [];
2141
+ for (const k of M)
2142
+ q.includes(k) || q.push(k), l.keys[k] = c.keys[k];
2143
+ }
2144
+ }).addMatcher(ze(be(t), Bt(t)), (l, o) => {
2145
+ O(l, [o]);
2146
+ }).addMatcher(R.actions.cacheEntriesUpserted.match, (l, o) => {
2147
+ const c = o.payload.map(({
2148
+ queryDescription: y,
2149
+ value: E
2150
+ }) => ({
2151
+ type: "UNKNOWN",
2152
+ payload: E,
2153
+ meta: {
2154
+ requestStatus: "fulfilled",
2155
+ requestId: "UNKNOWN",
2156
+ arg: y
2157
+ }
2158
+ }));
2159
+ O(l, c);
2160
+ });
2161
+ }
2162
+ });
2163
+ function P(h, l) {
2164
+ const o = An(h.keys[l] ?? []);
2165
+ for (const c of o) {
2166
+ const y = c.type, E = c.id ?? "__internal_without_id", N = h.tags[y]?.[E];
2167
+ N && (h.tags[y][E] = An(N).filter((M) => M !== l));
2168
+ }
2169
+ delete h.keys[l];
2170
+ }
2171
+ function O(h, l) {
2172
+ const o = l.map((c) => {
2173
+ const y = dr(c, "providesTags", i, C), {
2174
+ queryCacheKey: E
2175
+ } = c.meta.arg;
2176
+ return {
2177
+ queryCacheKey: E,
2178
+ providedTags: y
2179
+ };
2180
+ });
2181
+ p.caseReducers.updateProvidedBy(h, p.actions.updateProvidedBy(o));
2182
+ }
2183
+ const f = Se({
2184
+ name: `${e}/subscriptions`,
2185
+ initialState: st,
2186
+ reducers: {
2187
+ updateSubscriptionOptions(h, l) {
2188
+ },
2189
+ unsubscribeQueryResult(h, l) {
2190
+ },
2191
+ internal_getRTKQSubscriptions() {
2192
+ }
2193
+ }
2194
+ }), g = Se({
2195
+ name: `${e}/internalSubscriptions`,
2196
+ initialState: st,
2197
+ reducers: {
2198
+ subscriptionsUpdated: {
2199
+ reducer(h, l) {
2200
+ return mn(h, l.payload);
2201
+ },
2202
+ prepare: Ne()
2203
+ }
2204
+ }
2205
+ }), s = Se({
2206
+ name: `${e}/config`,
2207
+ initialState: {
2208
+ online: fi(),
2209
+ focused: li(),
2210
+ middlewareRegistered: !1,
2211
+ ...w
2212
+ },
2213
+ reducers: {
2214
+ middlewareRegistered(h, {
2215
+ payload: l
2216
+ }) {
2217
+ h.middlewareRegistered = h.middlewareRegistered === "conflict" || u !== l ? "conflict" : !0;
2218
+ }
2219
+ },
2220
+ extraReducers: (h) => {
2221
+ h.addCase(nn, (l) => {
2222
+ l.online = !0;
2223
+ }).addCase(sr, (l) => {
2224
+ l.online = !1;
2225
+ }).addCase(tn, (l) => {
2226
+ l.focused = !0;
2227
+ }).addCase(or, (l) => {
2228
+ l.focused = !1;
2229
+ }).addMatcher(_, (l) => ({
2230
+ ...l
2231
+ }));
2232
+ }
2233
+ }), a = Ar({
2234
+ queries: R.reducer,
2235
+ mutations: d.reducer,
2236
+ provided: p.reducer,
2237
+ subscriptions: g.reducer,
2238
+ config: s.reducer
2239
+ }), S = (h, l) => a(T.match(l) ? void 0 : h, l), b = {
2240
+ ...s.actions,
2241
+ ...R.actions,
2242
+ ...f.actions,
2243
+ ...g.actions,
2244
+ ...d.actions,
2245
+ ...p.actions,
2246
+ resetApiState: T
2247
+ };
2248
+ return {
2249
+ reducer: S,
2250
+ actions: b
2251
+ };
2252
+ }
2253
+ var te = /* @__PURE__ */ Symbol.for("RTKQ/skipToken"), pr = {
2254
+ status: ce
2255
+ }, Tn = /* @__PURE__ */ Wt(pr, () => {
2256
+ }), Dn = /* @__PURE__ */ Wt(pr, () => {
2257
+ });
2258
+ function Ci({
2259
+ serializeQueryArgs: e,
2260
+ reducerPath: t,
2261
+ createSelector: n
2262
+ }) {
2263
+ const r = (f) => Tn, i = (f) => Dn;
2264
+ return {
2265
+ buildQuerySelector: A,
2266
+ buildInfiniteQuerySelector: R,
2267
+ buildMutationSelector: d,
2268
+ selectInvalidatedBy: v,
2269
+ selectCachedArgsForQuery: p,
2270
+ selectApiState: m,
2271
+ selectQueries: _,
2272
+ selectMutations: w,
2273
+ selectQueryEntry: C,
2274
+ selectConfig: T
2275
+ };
2276
+ function u(f) {
2277
+ return {
2278
+ ...f,
2279
+ ...bn(f.status)
2280
+ };
2281
+ }
2282
+ function m(f) {
2283
+ const g = f[t];
2284
+ if (process.env.NODE_ENV !== "production" && !g) {
2285
+ if (m.triggered) return g;
2286
+ m.triggered = !0, console.error(`Error: No data found at \`state.${t}\`. Did you forget to add the reducer to the store?`);
2287
+ }
2288
+ return g;
2289
+ }
2290
+ function _(f) {
2291
+ return m(f)?.queries;
2292
+ }
2293
+ function C(f, g) {
2294
+ return _(f)?.[g];
2295
+ }
2296
+ function w(f) {
2297
+ return m(f)?.mutations;
2298
+ }
2299
+ function T(f) {
2300
+ return m(f)?.config;
2301
+ }
2302
+ function I(f, g, s) {
2303
+ return (a) => {
2304
+ if (a === te)
2305
+ return n(r, s);
2306
+ const S = e({
2307
+ queryArgs: a,
2308
+ endpointDefinition: g,
2309
+ endpointName: f
2310
+ });
2311
+ return n((h) => C(h, S) ?? Tn, s);
2312
+ };
2313
+ }
2314
+ function A(f, g) {
2315
+ return I(f, g, u);
2316
+ }
2317
+ function R(f, g) {
2318
+ const {
2319
+ infiniteQueryOptions: s
2320
+ } = g;
2321
+ function a(S) {
2322
+ const b = {
2323
+ ...S,
2324
+ ...bn(S.status)
2325
+ }, {
2326
+ isLoading: h,
2327
+ isError: l,
2328
+ direction: o
2329
+ } = b, c = o === "forward", y = o === "backward";
2330
+ return {
2331
+ ...b,
2332
+ hasNextPage: P(s, b.data, b.originalArgs),
2333
+ hasPreviousPage: O(s, b.data, b.originalArgs),
2334
+ isFetchingNextPage: h && c,
2335
+ isFetchingPreviousPage: h && y,
2336
+ isFetchNextPageError: l && c,
2337
+ isFetchPreviousPageError: l && y
2338
+ };
2339
+ }
2340
+ return I(f, g, a);
2341
+ }
2342
+ function d() {
2343
+ return (f) => {
2344
+ let g;
2345
+ return typeof f == "object" ? g = Be(f) ?? te : g = f, n(g === te ? i : (S) => m(S)?.mutations?.[g] ?? Dn, u);
2346
+ };
2347
+ }
2348
+ function v(f, g) {
2349
+ const s = f[t], a = /* @__PURE__ */ new Set(), S = Lt(g, en, ur);
2350
+ for (const b of S) {
2351
+ const h = s.provided.tags[b.type];
2352
+ if (!h)
2353
+ continue;
2354
+ let l = (b.id !== void 0 ? (
2355
+ // id given: invalidate all queries that provide this type & id
2356
+ h[b.id]
2357
+ ) : (
2358
+ // no id: invalidate all queries that provide this type
2359
+ Object.values(h).flat()
2360
+ )) ?? [];
2361
+ for (const o of l)
2362
+ a.add(o);
2363
+ }
2364
+ return Array.from(a.values()).flatMap((b) => {
2365
+ const h = s.queries[b];
2366
+ return h ? {
2367
+ queryCacheKey: b,
2368
+ endpointName: h.endpointName,
2369
+ originalArgs: h.originalArgs
2370
+ } : [];
2371
+ });
2372
+ }
2373
+ function p(f, g) {
2374
+ return Lt(Object.values(_(f)), (s) => s?.endpointName === g && s.status !== ce, (s) => s.originalArgs);
2375
+ }
2376
+ function P(f, g, s) {
2377
+ return g ? Ht(f, g, s) != null : !1;
2378
+ }
2379
+ function O(f, g, s) {
2380
+ return !g || !f.getPreviousPageParam ? !1 : fr(f, g, s) != null;
2381
+ }
2382
+ }
2383
+ var Nn = WeakMap ? /* @__PURE__ */ new WeakMap() : void 0, kn = ({
2384
+ endpointName: e,
2385
+ queryArgs: t
2386
+ }) => {
2387
+ let n = "";
2388
+ const r = Nn?.get(t);
2389
+ if (typeof r == "string")
2390
+ n = r;
2391
+ else {
2392
+ const i = JSON.stringify(t, (u, m) => (m = typeof m == "bigint" ? {
2393
+ $bigint: m.toString()
2394
+ } : m, m = Ve(m) ? Object.keys(m).sort().reduce((_, C) => (_[C] = m[C], _), {}) : m, m));
2395
+ Ve(t) && Nn?.set(t, i), n = i;
2396
+ }
2397
+ return `${e}(${n})`;
2398
+ };
2399
+ function hr(...e) {
2400
+ return function(n) {
2401
+ const r = vt((w) => n.extractRehydrationInfo?.(w, {
2402
+ reducerPath: n.reducerPath ?? "api"
2403
+ })), i = {
2404
+ reducerPath: "api",
2405
+ keepUnusedDataFor: 60,
2406
+ refetchOnMountOrArgChange: !1,
2407
+ refetchOnFocus: !1,
2408
+ refetchOnReconnect: !1,
2409
+ invalidationBehavior: "delayed",
2410
+ ...n,
2411
+ extractRehydrationInfo: r,
2412
+ serializeQueryArgs(w) {
2413
+ let T = kn;
2414
+ if ("serializeQueryArgs" in w.endpointDefinition) {
2415
+ const I = w.endpointDefinition.serializeQueryArgs;
2416
+ T = (A) => {
2417
+ const R = I(A);
2418
+ return typeof R == "string" ? R : kn({
2419
+ ...A,
2420
+ queryArgs: R
2421
+ });
2422
+ };
2423
+ } else n.serializeQueryArgs && (T = n.serializeQueryArgs);
2424
+ return T(w);
2425
+ },
2426
+ tagTypes: [...n.tagTypes || []]
2427
+ }, u = {
2428
+ endpointDefinitions: {},
2429
+ batch(w) {
2430
+ w();
2431
+ },
2432
+ apiUid: $n(),
2433
+ extractRehydrationInfo: r,
2434
+ hasRehydrationInfo: vt((w) => r(w) != null)
2435
+ }, m = {
2436
+ injectEndpoints: C,
2437
+ enhanceEndpoints({
2438
+ addTagTypes: w,
2439
+ endpoints: T
2440
+ }) {
2441
+ if (w)
2442
+ for (const I of w)
2443
+ i.tagTypes.includes(I) || i.tagTypes.push(I);
2444
+ if (T)
2445
+ for (const [I, A] of Object.entries(T))
2446
+ typeof A == "function" ? A(Te(u, I)) : Object.assign(Te(u, I) || {}, A);
2447
+ return m;
2448
+ }
2449
+ }, _ = e.map((w) => w.init(m, i, u));
2450
+ function C(w) {
2451
+ const T = w.endpoints({
2452
+ query: (I) => ({
2453
+ ...I,
2454
+ type: et
2455
+ }),
2456
+ mutation: (I) => ({
2457
+ ...I,
2458
+ type: ar
2459
+ }),
2460
+ infiniteQuery: (I) => ({
2461
+ ...I,
2462
+ type: cr
2463
+ })
2464
+ });
2465
+ for (const [I, A] of Object.entries(T)) {
2466
+ if (w.overrideExisting !== !0 && I in u.endpointDefinitions) {
2467
+ if (w.overrideExisting === "throw")
2468
+ throw new Error(process.env.NODE_ENV === "production" ? ye(39) : `called \`injectEndpoints\` to override already-existing endpointName ${I} without specifying \`overrideExisting: true\``);
2469
+ typeof process < "u" && process.env.NODE_ENV === "development" && console.error(`called \`injectEndpoints\` to override already-existing endpointName ${I} without specifying \`overrideExisting: true\``);
2470
+ continue;
2471
+ }
2472
+ if (typeof process < "u" && process.env.NODE_ENV === "development" && tt(A)) {
2473
+ const {
2474
+ infiniteQueryOptions: R
2475
+ } = A, {
2476
+ maxPages: d,
2477
+ getPreviousPageParam: v
2478
+ } = R;
2479
+ if (typeof d == "number") {
2480
+ if (d < 1)
2481
+ throw new Error(process.env.NODE_ENV === "production" ? ye(40) : `maxPages for endpoint '${I}' must be a number greater than 0`);
2482
+ if (typeof v != "function")
2483
+ throw new Error(process.env.NODE_ENV === "production" ? ye(41) : `getPreviousPageParam for endpoint '${I}' must be a function if maxPages is used`);
2484
+ }
2485
+ }
2486
+ u.endpointDefinitions[I] = A;
2487
+ for (const R of _)
2488
+ R.injectEndpoint(I, A);
2489
+ }
2490
+ return m;
2491
+ }
2492
+ return m.injectEndpoints({
2493
+ endpoints: n.endpoints
2494
+ });
2495
+ };
2496
+ }
2497
+ function oe(e, ...t) {
2498
+ return Object.assign(e, ...t);
2499
+ }
2500
+ var Ti = ({
2501
+ api: e,
2502
+ queryThunk: t,
2503
+ internalState: n,
2504
+ mwApi: r
2505
+ }) => {
2506
+ const i = `${e.reducerPath}/subscriptions`;
2507
+ let u = null, m = null;
2508
+ const {
2509
+ updateSubscriptionOptions: _,
2510
+ unsubscribeQueryResult: C
2511
+ } = e.internalActions, w = (v, p) => {
2512
+ if (_.match(p)) {
2513
+ const {
2514
+ queryCacheKey: O,
2515
+ requestId: f,
2516
+ options: g
2517
+ } = p.payload, s = v.get(O);
2518
+ return s?.has(f) && s.set(f, g), !0;
2519
+ }
2520
+ if (C.match(p)) {
2521
+ const {
2522
+ queryCacheKey: O,
2523
+ requestId: f
2524
+ } = p.payload, g = v.get(O);
2525
+ return g && g.delete(f), !0;
2526
+ }
2527
+ if (e.internalActions.removeQueryResult.match(p))
2528
+ return v.delete(p.payload.queryCacheKey), !0;
2529
+ if (t.pending.match(p)) {
2530
+ const {
2531
+ meta: {
2532
+ arg: O,
2533
+ requestId: f
2534
+ }
2535
+ } = p, g = St(v, O.queryCacheKey, jt);
2536
+ return O.subscribe && g.set(f, O.subscriptionOptions ?? g.get(f) ?? {}), !0;
2537
+ }
2538
+ let P = !1;
2539
+ if (t.rejected.match(p)) {
2540
+ const {
2541
+ meta: {
2542
+ condition: O,
2543
+ arg: f,
2544
+ requestId: g
2545
+ }
2546
+ } = p;
2547
+ if (O && f.subscribe) {
2548
+ const s = St(v, f.queryCacheKey, jt);
2549
+ s.set(g, f.subscriptionOptions ?? s.get(g) ?? {}), P = !0;
2550
+ }
2551
+ }
2552
+ return P;
2553
+ }, T = () => n.currentSubscriptions, R = {
2554
+ getSubscriptions: T,
2555
+ getSubscriptionCount: (v) => T().get(v)?.size ?? 0,
2556
+ isRequestSubscribed: (v, p) => !!T()?.get(v)?.get(p)
2557
+ };
2558
+ function d(v) {
2559
+ return JSON.parse(JSON.stringify(Object.fromEntries([...v].map(([p, P]) => [p, Object.fromEntries(P)]))));
2560
+ }
2561
+ return (v, p) => {
2562
+ if (u || (u = d(n.currentSubscriptions)), e.util.resetApiState.match(v))
2563
+ return u = {}, n.currentSubscriptions.clear(), m = null, [!0, !1];
2564
+ if (e.internalActions.internal_getRTKQSubscriptions.match(v))
2565
+ return [!1, R];
2566
+ const P = w(n.currentSubscriptions, v);
2567
+ let O = !0;
2568
+ if (process.env.NODE_ENV === "test" && typeof v.type == "string" && v.type === `${e.reducerPath}/getPolling`)
2569
+ return [!1, n.currentPolls];
2570
+ if (P) {
2571
+ m || (m = setTimeout(() => {
2572
+ const s = d(n.currentSubscriptions), [, a] = tr(u, () => s);
2573
+ p.next(e.internalActions.subscriptionsUpdated(a)), u = s, m = null;
2574
+ }, 500));
2575
+ const f = typeof v.type == "string" && !!v.type.startsWith(i), g = t.rejected.match(v) && v.meta.condition && !!v.meta.arg.subscribe;
2576
+ O = !f && !g;
2577
+ }
2578
+ return [O, !1];
2579
+ };
2580
+ }, Di = 2147483647 / 1e3 - 1, Ni = ({
2581
+ reducerPath: e,
2582
+ api: t,
2583
+ queryThunk: n,
2584
+ context: r,
2585
+ internalState: i,
2586
+ selectors: {
2587
+ selectQueryEntry: u,
2588
+ selectConfig: m
2589
+ },
2590
+ getRunningQueryThunk: _,
2591
+ mwApi: C
2592
+ }) => {
2593
+ const {
2594
+ removeQueryResult: w,
2595
+ unsubscribeQueryResult: T,
2596
+ cacheEntriesUpserted: I
2597
+ } = t.internalActions, A = ze(T.match, n.fulfilled, n.rejected, I.match);
2598
+ function R(f) {
2599
+ const g = i.currentSubscriptions.get(f);
2600
+ return g ? g.size > 0 : !1;
2601
+ }
2602
+ const d = {};
2603
+ function v(f) {
2604
+ for (const g of f.values())
2605
+ g?.abort?.();
2606
+ }
2607
+ const p = (f, g) => {
2608
+ const s = g.getState(), a = m(s);
2609
+ if (A(f)) {
2610
+ let S;
2611
+ if (I.match(f))
2612
+ S = f.payload.map((b) => b.queryDescription.queryCacheKey);
2613
+ else {
2614
+ const {
2615
+ queryCacheKey: b
2616
+ } = T.match(f) ? f.payload : f.meta.arg;
2617
+ S = [b];
2618
+ }
2619
+ P(S, g, a);
2620
+ }
2621
+ if (t.util.resetApiState.match(f)) {
2622
+ for (const [S, b] of Object.entries(d))
2623
+ b && clearTimeout(b), delete d[S];
2624
+ v(i.runningQueries), v(i.runningMutations);
2625
+ }
2626
+ if (r.hasRehydrationInfo(f)) {
2627
+ const {
2628
+ queries: S
2629
+ } = r.extractRehydrationInfo(f);
2630
+ P(Object.keys(S), g, a);
2631
+ }
2632
+ };
2633
+ function P(f, g, s) {
2634
+ const a = g.getState();
2635
+ for (const S of f) {
2636
+ const b = u(a, S);
2637
+ b?.endpointName && O(S, b.endpointName, g, s);
2638
+ }
2639
+ }
2640
+ function O(f, g, s, a) {
2641
+ const b = Te(r, g)?.keepUnusedDataFor ?? a.keepUnusedDataFor;
2642
+ if (b === 1 / 0)
2643
+ return;
2644
+ const h = Math.max(0, Math.min(b, Di));
2645
+ if (!R(f)) {
2646
+ const l = d[f];
2647
+ l && clearTimeout(l), d[f] = setTimeout(() => {
2648
+ if (!R(f)) {
2649
+ const o = u(s.getState(), f);
2650
+ o?.endpointName && s.dispatch(_(o.endpointName, o.originalArgs))?.abort(), s.dispatch(w({
2651
+ queryCacheKey: f
2652
+ }));
2653
+ }
2654
+ delete d[f];
2655
+ }, h * 1e3);
2656
+ }
2657
+ }
2658
+ return p;
2659
+ }, Mn = new Error("Promise never resolved before cacheEntryRemoved."), ki = ({
2660
+ api: e,
2661
+ reducerPath: t,
2662
+ context: n,
2663
+ queryThunk: r,
2664
+ mutationThunk: i,
2665
+ internalState: u,
2666
+ selectors: {
2667
+ selectQueryEntry: m,
2668
+ selectApiState: _
2669
+ }
2670
+ }) => {
2671
+ const C = cn(r), w = cn(i), T = be(r, i), I = {}, {
2672
+ removeQueryResult: A,
2673
+ removeMutationResult: R,
2674
+ cacheEntriesUpserted: d
2675
+ } = e.internalActions;
2676
+ function v(s, a, S) {
2677
+ const b = I[s];
2678
+ b?.valueResolved && (b.valueResolved({
2679
+ data: a,
2680
+ meta: S
2681
+ }), delete b.valueResolved);
2682
+ }
2683
+ function p(s) {
2684
+ const a = I[s];
2685
+ a && (delete I[s], a.cacheEntryRemoved());
2686
+ }
2687
+ function P(s) {
2688
+ const {
2689
+ arg: a,
2690
+ requestId: S
2691
+ } = s.meta, {
2692
+ endpointName: b,
2693
+ originalArgs: h
2694
+ } = a;
2695
+ return [b, h, S];
2696
+ }
2697
+ const O = (s, a, S) => {
2698
+ const b = f(s);
2699
+ function h(l, o, c, y) {
2700
+ const E = m(S, o), N = m(a.getState(), o);
2701
+ !E && N && g(l, y, o, a, c);
2702
+ }
2703
+ if (r.pending.match(s)) {
2704
+ const [l, o, c] = P(s);
2705
+ h(l, b, c, o);
2706
+ } else if (d.match(s))
2707
+ for (const {
2708
+ queryDescription: l,
2709
+ value: o
2710
+ } of s.payload) {
2711
+ const {
2712
+ endpointName: c,
2713
+ originalArgs: y,
2714
+ queryCacheKey: E
2715
+ } = l;
2716
+ h(c, E, s.meta.requestId, y), v(E, o, {});
2717
+ }
2718
+ else if (i.pending.match(s)) {
2719
+ if (a.getState()[t].mutations[b]) {
2720
+ const [o, c, y] = P(s);
2721
+ g(o, c, b, a, y);
2722
+ }
2723
+ } else if (T(s))
2724
+ v(b, s.payload, s.meta.baseQueryMeta);
2725
+ else if (A.match(s) || R.match(s))
2726
+ p(b);
2727
+ else if (e.util.resetApiState.match(s))
2728
+ for (const l of Object.keys(I))
2729
+ p(l);
2730
+ };
2731
+ function f(s) {
2732
+ return C(s) ? s.meta.arg.queryCacheKey : w(s) ? s.meta.arg.fixedCacheKey ?? s.meta.requestId : A.match(s) ? s.payload.queryCacheKey : R.match(s) ? Be(s.payload) : "";
2733
+ }
2734
+ function g(s, a, S, b, h) {
2735
+ const l = Te(n, s), o = l?.onCacheEntryAdded;
2736
+ if (!o) return;
2737
+ const c = {}, y = new Promise((D) => {
2738
+ c.cacheEntryRemoved = D;
2739
+ }), E = Promise.race([new Promise((D) => {
2740
+ c.valueResolved = D;
2741
+ }), y.then(() => {
2742
+ throw Mn;
2743
+ })]);
2744
+ E.catch(() => {
2745
+ }), I[S] = c;
2746
+ const N = e.endpoints[s].select(_t(l) ? a : S), M = b.dispatch((D, Q, F) => F), q = {
2747
+ ...b,
2748
+ getCacheEntry: () => N(b.getState()),
2749
+ requestId: h,
2750
+ extra: M,
2751
+ updateCachedData: _t(l) ? (D) => b.dispatch(e.util.updateQueryData(s, a, D)) : void 0,
2752
+ cacheDataLoaded: E,
2753
+ cacheEntryRemoved: y
2754
+ }, k = o(a, q);
2755
+ Promise.resolve(k).catch((D) => {
2756
+ if (D !== Mn)
2757
+ throw D;
2758
+ });
2759
+ }
2760
+ return O;
2761
+ }, Mi = ({
2762
+ api: e,
2763
+ context: {
2764
+ apiUid: t
2765
+ },
2766
+ reducerPath: n
2767
+ }) => (r, i) => {
2768
+ e.util.resetApiState.match(r) && i.dispatch(e.internalActions.middlewareRegistered(t)), typeof process < "u" && process.env.NODE_ENV === "development" && e.internalActions.middlewareRegistered.match(r) && r.payload === t && i.getState()[n]?.config?.middlewareRegistered === "conflict" && console.warn(`There is a mismatch between slice and middleware for the reducerPath "${n}".
2769
+ You can only have one api per reducer path, this will lead to crashes in various situations!${n === "api" ? `
2770
+ If you have multiple apis, you *have* to specify the reducerPath option when using createApi!` : ""}`);
2771
+ }, Qi = ({
2772
+ reducerPath: e,
2773
+ context: t,
2774
+ context: {
2775
+ endpointDefinitions: n
2776
+ },
2777
+ mutationThunk: r,
2778
+ queryThunk: i,
2779
+ api: u,
2780
+ assertTagType: m,
2781
+ refetchQuery: _,
2782
+ internalState: C
2783
+ }) => {
2784
+ const {
2785
+ removeQueryResult: w
2786
+ } = u.internalActions, T = ze(be(r), Bt(r)), I = ze(be(i, r), Gt(i, r));
2787
+ let A = [], R = 0;
2788
+ const d = (P, O) => {
2789
+ (i.pending.match(P) || r.pending.match(P)) && R++, I(P) && (R = Math.max(0, R - 1)), T(P) ? p(dr(P, "invalidatesTags", n, m), O) : I(P) ? p([], O) : u.util.invalidateTags.match(P) && p(rn(P.payload, void 0, void 0, void 0, void 0, m), O);
2790
+ };
2791
+ function v() {
2792
+ return R > 0;
2793
+ }
2794
+ function p(P, O) {
2795
+ const f = O.getState(), g = f[e];
2796
+ if (A.push(...P), g.config.invalidationBehavior === "delayed" && v())
2797
+ return;
2798
+ const s = A;
2799
+ if (A = [], s.length === 0) return;
2800
+ const a = u.util.selectInvalidatedBy(f, s);
2801
+ t.batch(() => {
2802
+ const S = Array.from(a.values());
2803
+ for (const {
2804
+ queryCacheKey: b
2805
+ } of S) {
2806
+ const h = g.queries[b], l = St(C.currentSubscriptions, b, jt);
2807
+ h && (l.size === 0 ? O.dispatch(w({
2808
+ queryCacheKey: b
2809
+ })) : h.status !== ce && O.dispatch(_(h)));
2810
+ }
2811
+ });
2812
+ }
2813
+ return d;
2814
+ }, qi = ({
2815
+ reducerPath: e,
2816
+ queryThunk: t,
2817
+ api: n,
2818
+ refetchQuery: r,
2819
+ internalState: i
2820
+ }) => {
2821
+ const {
2822
+ currentPolls: u,
2823
+ currentSubscriptions: m
2824
+ } = i, _ = /* @__PURE__ */ new Set();
2825
+ let C = null;
2826
+ const w = (p, P) => {
2827
+ (n.internalActions.updateSubscriptionOptions.match(p) || n.internalActions.unsubscribeQueryResult.match(p)) && T(p.payload.queryCacheKey, P), (t.pending.match(p) || t.rejected.match(p) && p.meta.condition) && T(p.meta.arg.queryCacheKey, P), (t.fulfilled.match(p) || t.rejected.match(p) && !p.meta.condition) && I(p.meta.arg, P), n.util.resetApiState.match(p) && (d(), C && (clearTimeout(C), C = null), _.clear());
2828
+ };
2829
+ function T(p, P) {
2830
+ _.add(p), C || (C = setTimeout(() => {
2831
+ for (const O of _)
2832
+ A({
2833
+ queryCacheKey: O
2834
+ }, P);
2835
+ _.clear(), C = null;
2836
+ }, 0));
2837
+ }
2838
+ function I({
2839
+ queryCacheKey: p
2840
+ }, P) {
2841
+ const O = P.getState()[e], f = O.queries[p], g = m.get(p);
2842
+ if (!f || f.status === ce) return;
2843
+ const {
2844
+ lowestPollingInterval: s,
2845
+ skipPollingIfUnfocused: a
2846
+ } = v(g);
2847
+ if (!Number.isFinite(s)) return;
2848
+ const S = u.get(p);
2849
+ S?.timeout && (clearTimeout(S.timeout), S.timeout = void 0);
2850
+ const b = Date.now() + s;
2851
+ u.set(p, {
2852
+ nextPollTimestamp: b,
2853
+ pollingInterval: s,
2854
+ timeout: setTimeout(() => {
2855
+ (O.config.focused || !a) && P.dispatch(r(f)), I({
2856
+ queryCacheKey: p
2857
+ }, P);
2858
+ }, s)
2859
+ });
2860
+ }
2861
+ function A({
2862
+ queryCacheKey: p
2863
+ }, P) {
2864
+ const f = P.getState()[e].queries[p], g = m.get(p);
2865
+ if (!f || f.status === ce)
2866
+ return;
2867
+ const {
2868
+ lowestPollingInterval: s
2869
+ } = v(g);
2870
+ if (process.env.NODE_ENV === "test") {
2871
+ const b = u.pollUpdateCounters ??= {};
2872
+ b[p] ??= 0, b[p]++;
2873
+ }
2874
+ if (!Number.isFinite(s)) {
2875
+ R(p);
2876
+ return;
2877
+ }
2878
+ const a = u.get(p), S = Date.now() + s;
2879
+ (!a || S < a.nextPollTimestamp) && I({
2880
+ queryCacheKey: p
2881
+ }, P);
2882
+ }
2883
+ function R(p) {
2884
+ const P = u.get(p);
2885
+ P?.timeout && clearTimeout(P.timeout), u.delete(p);
2886
+ }
2887
+ function d() {
2888
+ for (const p of u.keys())
2889
+ R(p);
2890
+ }
2891
+ function v(p = /* @__PURE__ */ new Map()) {
2892
+ let P = !1, O = Number.POSITIVE_INFINITY;
2893
+ for (const f of p.values())
2894
+ f.pollingInterval && (O = Math.min(f.pollingInterval, O), P = f.skipPollingIfUnfocused || P);
2895
+ return {
2896
+ lowestPollingInterval: O,
2897
+ skipPollingIfUnfocused: P
2898
+ };
2899
+ }
2900
+ return w;
2901
+ }, Fi = ({
2902
+ api: e,
2903
+ context: t,
2904
+ queryThunk: n,
2905
+ mutationThunk: r
2906
+ }) => {
2907
+ const i = jn(n, r), u = Gt(n, r), m = be(n, r), _ = {};
2908
+ return (w, T) => {
2909
+ if (i(w)) {
2910
+ const {
2911
+ requestId: I,
2912
+ arg: {
2913
+ endpointName: A,
2914
+ originalArgs: R
2915
+ }
2916
+ } = w.meta, d = Te(t, A), v = d?.onQueryStarted;
2917
+ if (v) {
2918
+ const p = {}, P = new Promise((s, a) => {
2919
+ p.resolve = s, p.reject = a;
2920
+ });
2921
+ P.catch(() => {
2922
+ }), _[I] = p;
2923
+ const O = e.endpoints[A].select(_t(d) ? R : I), f = T.dispatch((s, a, S) => S), g = {
2924
+ ...T,
2925
+ getCacheEntry: () => O(T.getState()),
2926
+ requestId: I,
2927
+ extra: f,
2928
+ updateCachedData: _t(d) ? (s) => T.dispatch(e.util.updateQueryData(A, R, s)) : void 0,
2929
+ queryFulfilled: P
2930
+ };
2931
+ v(R, g);
2932
+ }
2933
+ } else if (m(w)) {
2934
+ const {
2935
+ requestId: I,
2936
+ baseQueryMeta: A
2937
+ } = w.meta;
2938
+ _[I]?.resolve({
2939
+ data: w.payload,
2940
+ meta: A
2941
+ }), delete _[I];
2942
+ } else if (u(w)) {
2943
+ const {
2944
+ requestId: I,
2945
+ rejectedWithValue: A,
2946
+ baseQueryMeta: R
2947
+ } = w.meta;
2948
+ _[I]?.reject({
2949
+ error: w.payload ?? w.error,
2950
+ isUnhandledError: !A,
2951
+ meta: R
2952
+ }), delete _[I];
2953
+ }
2954
+ };
2955
+ }, xi = ({
2956
+ reducerPath: e,
2957
+ context: t,
2958
+ api: n,
2959
+ refetchQuery: r,
2960
+ internalState: i
2961
+ }) => {
2962
+ const {
2963
+ removeQueryResult: u
2964
+ } = n.internalActions, m = (C, w) => {
2965
+ tn.match(C) && _(w, "refetchOnFocus"), nn.match(C) && _(w, "refetchOnReconnect");
2966
+ };
2967
+ function _(C, w) {
2968
+ const T = C.getState()[e], I = T.queries, A = i.currentSubscriptions;
2969
+ t.batch(() => {
2970
+ for (const R of A.keys()) {
2971
+ const d = I[R], v = A.get(R);
2972
+ if (!v || !d) continue;
2973
+ const p = [...v.values()];
2974
+ (p.some((O) => O[w] === !0) || p.every((O) => O[w] === void 0) && T.config[w]) && (v.size === 0 ? C.dispatch(u({
2975
+ queryCacheKey: R
2976
+ })) : d.status !== ce && C.dispatch(r(d)));
2977
+ }
2978
+ });
2979
+ }
2980
+ return m;
2981
+ };
2982
+ function Ui(e) {
2983
+ const {
2984
+ reducerPath: t,
2985
+ queryThunk: n,
2986
+ api: r,
2987
+ context: i,
2988
+ getInternalState: u
2989
+ } = e, {
2990
+ apiUid: m
2991
+ } = i, _ = {
2992
+ invalidateTags: De(`${t}/invalidateTags`)
2993
+ }, C = (A) => A.type.startsWith(`${t}/`), w = [Mi, Ni, Qi, qi, ki, Fi];
2994
+ return {
2995
+ middleware: (A) => {
2996
+ let R = !1;
2997
+ const d = u(A.dispatch), v = {
2998
+ ...e,
2999
+ internalState: d,
3000
+ refetchQuery: I,
3001
+ isThisApiSliceAction: C,
3002
+ mwApi: A
3003
+ }, p = w.map((f) => f(v)), P = Ti(v), O = xi(v);
3004
+ return (f) => (g) => {
3005
+ if (!Cr(g))
3006
+ return f(g);
3007
+ R || (R = !0, A.dispatch(r.internalActions.middlewareRegistered(m)));
3008
+ const s = {
3009
+ ...A,
3010
+ next: f
3011
+ }, a = A.getState(), [S, b] = P(g, s, a);
3012
+ let h;
3013
+ if (S ? h = f(g) : h = b, A.getState()[t] && (O(g, s, a), C(g) || i.hasRehydrationInfo(g)))
3014
+ for (const l of p)
3015
+ l(g, s, a);
3016
+ return h;
3017
+ };
3018
+ },
3019
+ actions: _
3020
+ };
3021
+ function I(A) {
3022
+ return e.api.endpoints[A.endpointName].initiate(A.originalArgs, {
3023
+ subscribe: !1,
3024
+ forceRefetch: !0
3025
+ });
3026
+ }
3027
+ }
3028
+ var Qn = /* @__PURE__ */ Symbol(), yr = ({
3029
+ createSelector: e = Ir
3030
+ } = {}) => ({
3031
+ name: Qn,
3032
+ init(t, {
3033
+ baseQuery: n,
3034
+ tagTypes: r,
3035
+ reducerPath: i,
3036
+ serializeQueryArgs: u,
3037
+ keepUnusedDataFor: m,
3038
+ refetchOnMountOrArgChange: _,
3039
+ refetchOnFocus: C,
3040
+ refetchOnReconnect: w,
3041
+ invalidationBehavior: T,
3042
+ onSchemaFailure: I,
3043
+ catchSchemaFailure: A,
3044
+ skipSchemaValidation: R
3045
+ }, d) {
3046
+ Br();
3047
+ const v = (z) => (typeof process < "u" && process.env.NODE_ENV === "development" && (r.includes(z.type) || console.error(`Tag type '${z.type}' was used, but not specified in \`tagTypes\`!`)), z);
3048
+ Object.assign(t, {
3049
+ reducerPath: i,
3050
+ endpoints: {},
3051
+ internalActions: {
3052
+ onOnline: nn,
3053
+ onOffline: sr,
3054
+ onFocus: tn,
3055
+ onFocusLost: or
3056
+ },
3057
+ util: {}
3058
+ });
3059
+ const p = Ci({
3060
+ serializeQueryArgs: u,
3061
+ reducerPath: i,
3062
+ createSelector: e
3063
+ }), {
3064
+ selectInvalidatedBy: P,
3065
+ selectCachedArgsForQuery: O,
3066
+ buildQuerySelector: f,
3067
+ buildInfiniteQuerySelector: g,
3068
+ buildMutationSelector: s
3069
+ } = p;
3070
+ oe(t.util, {
3071
+ selectInvalidatedBy: P,
3072
+ selectCachedArgsForQuery: O
3073
+ });
3074
+ const {
3075
+ queryThunk: a,
3076
+ infiniteQueryThunk: S,
3077
+ mutationThunk: b,
3078
+ patchQueryData: h,
3079
+ updateQueryData: l,
3080
+ upsertQueryData: o,
3081
+ prefetch: c,
3082
+ buildMatchThunkActions: y
3083
+ } = Ii({
3084
+ baseQuery: n,
3085
+ reducerPath: i,
3086
+ context: d,
3087
+ api: t,
3088
+ serializeQueryArgs: u,
3089
+ assertTagType: v,
3090
+ selectors: p,
3091
+ onSchemaFailure: I,
3092
+ catchSchemaFailure: A,
3093
+ skipSchemaValidation: R
3094
+ }), {
3095
+ reducer: E,
3096
+ actions: N
3097
+ } = Ai({
3098
+ context: d,
3099
+ queryThunk: a,
3100
+ mutationThunk: b,
3101
+ serializeQueryArgs: u,
3102
+ reducerPath: i,
3103
+ assertTagType: v,
3104
+ config: {
3105
+ refetchOnFocus: C,
3106
+ refetchOnReconnect: w,
3107
+ refetchOnMountOrArgChange: _,
3108
+ keepUnusedDataFor: m,
3109
+ reducerPath: i,
3110
+ invalidationBehavior: T
3111
+ }
3112
+ });
3113
+ oe(t.util, {
3114
+ patchQueryData: h,
3115
+ updateQueryData: l,
3116
+ upsertQueryData: o,
3117
+ prefetch: c,
3118
+ resetApiState: N.resetApiState,
3119
+ upsertQueryEntries: N.cacheEntriesUpserted
3120
+ }), oe(t.internalActions, N);
3121
+ const M = /* @__PURE__ */ new WeakMap(), q = (z) => St(M, z, () => ({
3122
+ currentSubscriptions: /* @__PURE__ */ new Map(),
3123
+ currentPolls: /* @__PURE__ */ new Map(),
3124
+ runningQueries: /* @__PURE__ */ new Map(),
3125
+ runningMutations: /* @__PURE__ */ new Map()
3126
+ })), {
3127
+ buildInitiateQuery: k,
3128
+ buildInitiateInfiniteQuery: D,
3129
+ buildInitiateMutation: Q,
3130
+ getRunningMutationThunk: F,
3131
+ getRunningMutationsThunk: L,
3132
+ getRunningQueriesThunk: j,
3133
+ getRunningQueryThunk: V
3134
+ } = Oi({
3135
+ queryThunk: a,
3136
+ mutationThunk: b,
3137
+ infiniteQueryThunk: S,
3138
+ api: t,
3139
+ serializeQueryArgs: u,
3140
+ context: d,
3141
+ getInternalState: q
3142
+ });
3143
+ oe(t.util, {
3144
+ getRunningMutationThunk: F,
3145
+ getRunningMutationsThunk: L,
3146
+ getRunningQueryThunk: V,
3147
+ getRunningQueriesThunk: j
3148
+ });
3149
+ const {
3150
+ middleware: K,
3151
+ actions: H
3152
+ } = Ui({
3153
+ reducerPath: i,
3154
+ context: d,
3155
+ queryThunk: a,
3156
+ mutationThunk: b,
3157
+ infiniteQueryThunk: S,
3158
+ api: t,
3159
+ assertTagType: v,
3160
+ selectors: p,
3161
+ getRunningQueryThunk: V,
3162
+ getInternalState: q
3163
+ });
3164
+ return oe(t.util, H), oe(t, {
3165
+ reducer: E,
3166
+ middleware: K
3167
+ }), {
3168
+ name: Qn,
3169
+ injectEndpoint(z, $) {
3170
+ const U = t, x = U.endpoints[z] ??= {};
3171
+ wt($) && oe(x, {
3172
+ name: z,
3173
+ select: f(z, $),
3174
+ initiate: k(z, $)
3175
+ }, y(a, z)), Pi($) && oe(x, {
3176
+ name: z,
3177
+ select: s(),
3178
+ initiate: Q(z)
3179
+ }, y(b, z)), tt($) && oe(x, {
3180
+ name: z,
3181
+ select: g(z, $),
3182
+ initiate: D(z, $)
3183
+ }, y(a, z));
3184
+ }
3185
+ };
3186
+ }
3187
+ });
3188
+ yr();
3189
+ var at = { exports: {} }, Tt = {};
3190
+ var qn;
3191
+ function Vi() {
3192
+ if (qn) return Tt;
3193
+ qn = 1;
3194
+ var e = Kn;
3195
+ function t(C, w) {
3196
+ return C === w && (C !== 0 || 1 / C === 1 / w) || C !== C && w !== w;
3197
+ }
3198
+ var n = typeof Object.is == "function" ? Object.is : t, r = e.useSyncExternalStore, i = e.useRef, u = e.useEffect, m = e.useMemo, _ = e.useDebugValue;
3199
+ return Tt.useSyncExternalStoreWithSelector = function(C, w, T, I, A) {
3200
+ var R = i(null);
3201
+ if (R.current === null) {
3202
+ var d = { hasValue: !1, value: null };
3203
+ R.current = d;
3204
+ } else d = R.current;
3205
+ R = m(
3206
+ function() {
3207
+ function p(s) {
3208
+ if (!P) {
3209
+ if (P = !0, O = s, s = I(s), A !== void 0 && d.hasValue) {
3210
+ var a = d.value;
3211
+ if (A(a, s))
3212
+ return f = a;
3213
+ }
3214
+ return f = s;
3215
+ }
3216
+ if (a = f, n(O, s)) return a;
3217
+ var S = I(s);
3218
+ return A !== void 0 && A(a, S) ? (O = s, a) : (O = s, f = S);
3219
+ }
3220
+ var P = !1, O, f, g = T === void 0 ? null : T;
3221
+ return [
3222
+ function() {
3223
+ return p(w());
3224
+ },
3225
+ g === null ? void 0 : function() {
3226
+ return p(g());
3227
+ }
3228
+ ];
3229
+ },
3230
+ [w, T, I, A]
3231
+ );
3232
+ var v = r(C, R[0], R[1]);
3233
+ return u(
3234
+ function() {
3235
+ d.hasValue = !0, d.value = v;
3236
+ },
3237
+ [v]
3238
+ ), _(v), v;
3239
+ }, Tt;
3240
+ }
3241
+ var Dt = {};
3242
+ var Fn;
3243
+ function zi() {
3244
+ return Fn || (Fn = 1, process.env.NODE_ENV !== "production" && (function() {
3245
+ function e(C, w) {
3246
+ return C === w && (C !== 0 || 1 / C === 1 / w) || C !== C && w !== w;
3247
+ }
3248
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
3249
+ var t = Kn, n = typeof Object.is == "function" ? Object.is : e, r = t.useSyncExternalStore, i = t.useRef, u = t.useEffect, m = t.useMemo, _ = t.useDebugValue;
3250
+ Dt.useSyncExternalStoreWithSelector = function(C, w, T, I, A) {
3251
+ var R = i(null);
3252
+ if (R.current === null) {
3253
+ var d = { hasValue: !1, value: null };
3254
+ R.current = d;
3255
+ } else d = R.current;
3256
+ R = m(
3257
+ function() {
3258
+ function p(s) {
3259
+ if (!P) {
3260
+ if (P = !0, O = s, s = I(s), A !== void 0 && d.hasValue) {
3261
+ var a = d.value;
3262
+ if (A(a, s))
3263
+ return f = a;
3264
+ }
3265
+ return f = s;
3266
+ }
3267
+ if (a = f, n(O, s))
3268
+ return a;
3269
+ var S = I(s);
3270
+ return A !== void 0 && A(a, S) ? (O = s, a) : (O = s, f = S);
3271
+ }
3272
+ var P = !1, O, f, g = T === void 0 ? null : T;
3273
+ return [
3274
+ function() {
3275
+ return p(w());
3276
+ },
3277
+ g === null ? void 0 : function() {
3278
+ return p(g());
3279
+ }
3280
+ ];
3281
+ },
3282
+ [w, T, I, A]
3283
+ );
3284
+ var v = r(C, R[0], R[1]);
3285
+ return u(
3286
+ function() {
3287
+ d.hasValue = !0, d.value = v;
3288
+ },
3289
+ [v]
3290
+ ), _(v), v;
3291
+ }, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
3292
+ })()), Dt;
3293
+ }
3294
+ var xn;
3295
+ function $i() {
3296
+ return xn || (xn = 1, process.env.NODE_ENV === "production" ? at.exports = Vi() : at.exports = zi()), at.exports;
3297
+ }
3298
+ var Li = $i();
3299
+ function ji(e) {
3300
+ e();
3301
+ }
3302
+ function Un(e, t) {
3303
+ return e === t ? e !== 0 || t !== 0 || 1 / e === 1 / t : e !== e && t !== t;
3304
+ }
3305
+ function Ue(e, t) {
3306
+ if (Un(e, t)) return !0;
3307
+ if (typeof e != "object" || e === null || typeof t != "object" || t === null)
3308
+ return !1;
3309
+ const n = Object.keys(e), r = Object.keys(t);
3310
+ if (n.length !== r.length) return !1;
3311
+ for (let i = 0; i < n.length; i++)
3312
+ if (!Object.prototype.hasOwnProperty.call(t, n[i]) || !Un(e[n[i]], t[n[i]]))
3313
+ return !1;
3314
+ return !0;
3315
+ }
3316
+ var Ki = /* @__PURE__ */ Symbol.for("react-redux-context"), Hi = typeof globalThis < "u" ? globalThis : (
3317
+ /* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
3318
+ {}
3319
+ );
3320
+ function Wi() {
3321
+ if (!he.createContext) return {};
3322
+ const e = Hi[Ki] ??= /* @__PURE__ */ new Map();
3323
+ let t = e.get(he.createContext);
3324
+ return t || (t = he.createContext(
3325
+ null
3326
+ ), process.env.NODE_ENV !== "production" && (t.displayName = "ReactRedux"), e.set(he.createContext, t)), t;
3327
+ }
3328
+ var Re = /* @__PURE__ */ Wi();
3329
+ function on(e = Re) {
3330
+ return function() {
3331
+ const n = he.useContext(e);
3332
+ if (process.env.NODE_ENV !== "production" && !n)
3333
+ throw new Error(
3334
+ "could not find react-redux context value; please ensure the component is wrapped in a <Provider>"
3335
+ );
3336
+ return n;
3337
+ };
3338
+ }
3339
+ var gr = /* @__PURE__ */ on();
3340
+ function mr(e = Re) {
3341
+ const t = e === Re ? gr : (
3342
+ // @ts-ignore
3343
+ on(e)
3344
+ ), n = () => {
3345
+ const { store: r } = t();
3346
+ return r;
3347
+ };
3348
+ return Object.assign(n, {
3349
+ withTypes: () => n
3350
+ }), n;
3351
+ }
3352
+ var vr = /* @__PURE__ */ mr();
3353
+ function Bi(e = Re) {
3354
+ const t = e === Re ? vr : mr(e), n = () => t().dispatch;
3355
+ return Object.assign(n, {
3356
+ withTypes: () => n
3357
+ }), n;
3358
+ }
3359
+ var Gi = /* @__PURE__ */ Bi(), Yi = (e, t) => e === t;
3360
+ function Ji(e = Re) {
3361
+ const t = e === Re ? gr : on(e), n = (r, i = {}) => {
3362
+ const { equalityFn: u = Yi } = typeof i == "function" ? { equalityFn: i } : i;
3363
+ if (process.env.NODE_ENV !== "production") {
3364
+ if (!r)
3365
+ throw new Error("You must pass a selector to useSelector");
3366
+ if (typeof r != "function")
3367
+ throw new Error("You must pass a function as a selector to useSelector");
3368
+ if (typeof u != "function")
3369
+ throw new Error(
3370
+ "You must pass a function as an equality function to useSelector"
3371
+ );
3372
+ }
3373
+ const m = t(), { store: _, subscription: C, getServerState: w } = m, T = he.useRef(!0), I = he.useCallback(
3374
+ {
3375
+ [r.name](R) {
3376
+ const d = r(R);
3377
+ if (process.env.NODE_ENV !== "production") {
3378
+ const { devModeChecks: v = {} } = typeof i == "function" ? {} : i, { identityFunctionCheck: p, stabilityCheck: P } = m, {
3379
+ identityFunctionCheck: O,
3380
+ stabilityCheck: f
3381
+ } = {
3382
+ stabilityCheck: P,
3383
+ identityFunctionCheck: p,
3384
+ ...v
3385
+ };
3386
+ if (f === "always" || f === "once" && T.current) {
3387
+ const g = r(R);
3388
+ if (!u(d, g)) {
3389
+ let s;
3390
+ try {
3391
+ throw new Error();
3392
+ } catch (a) {
3393
+ ({ stack: s } = a);
3394
+ }
3395
+ console.warn(
3396
+ "Selector " + (r.name || "unknown") + ` returned a different result when called with the same parameters. This can lead to unnecessary rerenders.
3397
+ 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`,
3398
+ {
3399
+ state: R,
3400
+ selected: d,
3401
+ selected2: g,
3402
+ stack: s
3403
+ }
3404
+ );
3405
+ }
3406
+ }
3407
+ if ((O === "always" || O === "once" && T.current) && d === R) {
3408
+ let g;
3409
+ try {
3410
+ throw new Error();
3411
+ } catch (s) {
3412
+ ({ stack: g } = s);
3413
+ }
3414
+ console.warn(
3415
+ "Selector " + (r.name || "unknown") + ` returned the root state when called. This can lead to unnecessary rerenders.
3416
+ Selectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.`,
3417
+ { stack: g }
3418
+ );
3419
+ }
3420
+ T.current && (T.current = !1);
3421
+ }
3422
+ return d;
3423
+ }
3424
+ }[r.name],
3425
+ [r]
3426
+ ), A = Li.useSyncExternalStoreWithSelector(
3427
+ C.addNestedSub,
3428
+ _.getState,
3429
+ w || _.getState,
3430
+ I,
3431
+ u
3432
+ );
3433
+ return he.useDebugValue(A), A;
3434
+ };
3435
+ return Object.assign(n, {
3436
+ withTypes: () => n
3437
+ }), n;
3438
+ }
3439
+ var Xi = /* @__PURE__ */ Ji(), Zi = ji;
3440
+ function ct(e) {
3441
+ return e.replace(e[0], e[0].toUpperCase());
3442
+ }
3443
+ function eo(e) {
3444
+ let t = 0;
3445
+ for (const n in e)
3446
+ t++;
3447
+ return t;
3448
+ }
3449
+ var to = "query", no = "mutation", ro = "infinitequery";
3450
+ function io(e) {
3451
+ return e.type === to;
3452
+ }
3453
+ function oo(e) {
3454
+ return e.type === no;
3455
+ }
3456
+ function Sr(e) {
3457
+ return e.type === ro;
3458
+ }
3459
+ function Me(e, ...t) {
3460
+ return Object.assign(e, ...t);
3461
+ }
3462
+ var Nt = /* @__PURE__ */ Symbol();
3463
+ function kt(e) {
3464
+ const t = fe(e), n = G(() => Zt(t.current, e), [e]);
3465
+ return de(() => {
3466
+ t.current !== n && (t.current = n);
3467
+ }, [n]), n;
3468
+ }
3469
+ function Ae(e) {
3470
+ const t = fe(e);
3471
+ return de(() => {
3472
+ Ue(t.current, e) || (t.current = e);
3473
+ }, [e]), Ue(t.current, e) ? t.current : e;
3474
+ }
3475
+ var so = () => typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", ao = /* @__PURE__ */ so(), co = () => typeof navigator < "u" && navigator.product === "ReactNative", uo = /* @__PURE__ */ co(), lo = () => ao || uo ? Dr : de, fo = /* @__PURE__ */ lo(), Vn = (e) => e.isUninitialized ? {
3476
+ ...e,
3477
+ isUninitialized: !1,
3478
+ isFetching: !0,
3479
+ isLoading: e.data === void 0,
3480
+ // This is the one place where we still have to use `QueryStatus` as an enum,
3481
+ // since it's the only reference in the React package and not in the core.
3482
+ status: rr.pending
3483
+ } : e;
3484
+ function Mt(e, ...t) {
3485
+ const n = {};
3486
+ return t.forEach((r) => {
3487
+ n[r] = e[r];
3488
+ }), n;
3489
+ }
3490
+ var Qt = ["data", "status", "isLoading", "isSuccess", "isError", "error"];
3491
+ function po({
3492
+ api: e,
3493
+ moduleOptions: {
3494
+ batch: t,
3495
+ hooks: {
3496
+ useDispatch: n,
3497
+ useSelector: r,
3498
+ useStore: i
3499
+ },
3500
+ unstable__sideEffectsInRender: u,
3501
+ createSelector: m
3502
+ },
3503
+ serializeQueryArgs: _,
3504
+ context: C
3505
+ }) {
3506
+ const w = u ? (a) => a() : de, T = (a) => a.current?.unsubscribe?.(), I = C.endpointDefinitions;
3507
+ return {
3508
+ buildQueryHooks: f,
3509
+ buildInfiniteQueryHooks: g,
3510
+ buildMutationHook: s,
3511
+ usePrefetch: d
3512
+ };
3513
+ function A(a, S, b) {
3514
+ if (S?.endpointName && a.isUninitialized) {
3515
+ const {
3516
+ endpointName: E
3517
+ } = S, N = I[E];
3518
+ b !== te && _({
3519
+ queryArgs: S.originalArgs,
3520
+ endpointDefinition: N,
3521
+ endpointName: E
3522
+ }) === _({
3523
+ queryArgs: b,
3524
+ endpointDefinition: N,
3525
+ endpointName: E
3526
+ }) && (S = void 0);
3527
+ }
3528
+ let h = a.isSuccess ? a.data : S?.data;
3529
+ h === void 0 && (h = a.data);
3530
+ const l = h !== void 0, o = a.isLoading, c = (!S || S.isLoading || S.isUninitialized) && !l && o, y = a.isSuccess || l && (o && !S?.isError || a.isUninitialized);
3531
+ return {
3532
+ ...a,
3533
+ data: h,
3534
+ currentData: a.data,
3535
+ isFetching: o,
3536
+ isLoading: c,
3537
+ isSuccess: y
3538
+ };
3539
+ }
3540
+ function R(a, S, b) {
3541
+ if (S?.endpointName && a.isUninitialized) {
3542
+ const {
3543
+ endpointName: E
3544
+ } = S, N = I[E];
3545
+ b !== te && _({
3546
+ queryArgs: S.originalArgs,
3547
+ endpointDefinition: N,
3548
+ endpointName: E
3549
+ }) === _({
3550
+ queryArgs: b,
3551
+ endpointDefinition: N,
3552
+ endpointName: E
3553
+ }) && (S = void 0);
3554
+ }
3555
+ let h = a.isSuccess ? a.data : S?.data;
3556
+ h === void 0 && (h = a.data);
3557
+ const l = h !== void 0, o = a.isLoading, c = (!S || S.isLoading || S.isUninitialized) && !l && o, y = a.isSuccess || o && l;
3558
+ return {
3559
+ ...a,
3560
+ data: h,
3561
+ currentData: a.data,
3562
+ isFetching: o,
3563
+ isLoading: c,
3564
+ isSuccess: y
3565
+ };
3566
+ }
3567
+ function d(a, S) {
3568
+ const b = n(), h = Ae(S);
3569
+ return ge((l, o) => b(e.util.prefetch(a, l, {
3570
+ ...h,
3571
+ ...o
3572
+ })), [a, b, h]);
3573
+ }
3574
+ function v(a, S, {
3575
+ refetchOnReconnect: b,
3576
+ refetchOnFocus: h,
3577
+ refetchOnMountOrArgChange: l,
3578
+ skip: o = !1,
3579
+ pollingInterval: c = 0,
3580
+ skipPollingIfUnfocused: y = !1,
3581
+ ...E
3582
+ } = {}) {
3583
+ const {
3584
+ initiate: N
3585
+ } = e.endpoints[a], M = n(), q = fe(void 0);
3586
+ if (!q.current) {
3587
+ const U = M(e.internalActions.internal_getRTKQSubscriptions());
3588
+ if (process.env.NODE_ENV !== "production" && (typeof U != "object" || typeof U?.type == "string"))
3589
+ throw new Error(process.env.NODE_ENV === "production" ? ye(37) : `Warning: Middleware for RTK-Query API at reducerPath "${e.reducerPath}" has not been added to the store.
3590
+ You must add the middleware for RTK-Query to function correctly!`);
3591
+ q.current = U;
3592
+ }
3593
+ const k = kt(o ? te : S), D = Ae({
3594
+ refetchOnReconnect: b,
3595
+ refetchOnFocus: h,
3596
+ pollingInterval: c,
3597
+ skipPollingIfUnfocused: y
3598
+ }), Q = E.initialPageParam, F = Ae(Q), L = E.refetchCachedPages, j = Ae(L), V = fe(void 0);
3599
+ let {
3600
+ queryCacheKey: K,
3601
+ requestId: H
3602
+ } = V.current || {}, z = !1;
3603
+ K && H && (z = q.current.isRequestSubscribed(K, H));
3604
+ const $ = !z && V.current !== void 0;
3605
+ return w(() => {
3606
+ $ && (V.current = void 0);
3607
+ }, [$]), w(() => {
3608
+ const U = V.current;
3609
+ if (typeof process < "u" && process.env.NODE_ENV === "removeMeOnCompilation" && console.log($), k === te) {
3610
+ U?.unsubscribe(), V.current = void 0;
3611
+ return;
3612
+ }
3613
+ const x = V.current?.subscriptionOptions;
3614
+ if (!U || U.arg !== k) {
3615
+ U?.unsubscribe();
3616
+ const re = M(N(k, {
3617
+ subscriptionOptions: D,
3618
+ forceRefetch: l,
3619
+ ...Sr(I[a]) ? {
3620
+ initialPageParam: F,
3621
+ refetchCachedPages: j
3622
+ } : {}
3623
+ }));
3624
+ V.current = re;
3625
+ } else D !== x && U.updateSubscriptionOptions(D);
3626
+ }, [M, N, l, k, D, $, F, j, a]), [V, M, N, D];
3627
+ }
3628
+ function p(a, S) {
3629
+ return (h, {
3630
+ skip: l = !1,
3631
+ selectFromResult: o
3632
+ } = {}) => {
3633
+ const {
3634
+ select: c
3635
+ } = e.endpoints[a], y = kt(l ? te : h), E = fe(void 0), N = G(() => (
3636
+ // Normally ts-ignores are bad and should be avoided, but we're
3637
+ // already casting this selector to be `Selector<any>` anyway,
3638
+ // so the inconsistencies don't matter here
3639
+ // @ts-ignore
3640
+ m([
3641
+ // @ts-ignore
3642
+ c(y),
3643
+ (Q, F) => F,
3644
+ (Q) => y
3645
+ ], S, {
3646
+ memoizeOptions: {
3647
+ resultEqualityCheck: Ue
3648
+ }
3649
+ })
3650
+ ), [c, y]), M = G(() => o ? m([N], o, {
3651
+ devModeChecks: {
3652
+ identityFunctionCheck: "never"
3653
+ }
3654
+ }) : N, [N, o]), q = r((Q) => M(Q, E.current), Ue), k = i(), D = N(k.getState(), E.current);
3655
+ return fo(() => {
3656
+ E.current = D;
3657
+ }, [D]), q;
3658
+ };
3659
+ }
3660
+ function P(a) {
3661
+ de(() => () => {
3662
+ T(a), a.current = void 0;
3663
+ }, [a]);
3664
+ }
3665
+ function O(a) {
3666
+ if (!a.current) throw new Error(process.env.NODE_ENV === "production" ? ye(38) : "Cannot refetch a query that has not been started yet.");
3667
+ return a.current.refetch();
3668
+ }
3669
+ function f(a) {
3670
+ const S = (l, o = {}) => {
3671
+ const [c] = v(a, l, o);
3672
+ return P(c), G(() => ({
3673
+ /**
3674
+ * A method to manually refetch data for the query
3675
+ */
3676
+ refetch: () => O(c)
3677
+ }), [c]);
3678
+ }, b = ({
3679
+ refetchOnReconnect: l,
3680
+ refetchOnFocus: o,
3681
+ pollingInterval: c = 0,
3682
+ skipPollingIfUnfocused: y = !1
3683
+ } = {}) => {
3684
+ const {
3685
+ initiate: E
3686
+ } = e.endpoints[a], N = n(), [M, q] = un(Nt), k = fe(void 0), D = Ae({
3687
+ refetchOnReconnect: l,
3688
+ refetchOnFocus: o,
3689
+ pollingInterval: c,
3690
+ skipPollingIfUnfocused: y
3691
+ });
3692
+ w(() => {
3693
+ const j = k.current?.subscriptionOptions;
3694
+ D !== j && k.current?.updateSubscriptionOptions(D);
3695
+ }, [D]);
3696
+ const Q = fe(D);
3697
+ w(() => {
3698
+ Q.current = D;
3699
+ }, [D]);
3700
+ const F = ge(function(j, V = !1) {
3701
+ let K;
3702
+ return t(() => {
3703
+ T(k), k.current = K = N(E(j, {
3704
+ subscriptionOptions: Q.current,
3705
+ forceRefetch: !V
3706
+ })), q(j);
3707
+ }), K;
3708
+ }, [N, E]), L = ge(() => {
3709
+ k.current?.queryCacheKey && N(e.internalActions.removeQueryResult({
3710
+ queryCacheKey: k.current?.queryCacheKey
3711
+ }));
3712
+ }, [N]);
3713
+ return de(() => () => {
3714
+ T(k);
3715
+ }, []), de(() => {
3716
+ M !== Nt && !k.current && F(M, !0);
3717
+ }, [M, F]), G(() => [F, M, {
3718
+ reset: L
3719
+ }], [F, M, L]);
3720
+ }, h = p(a, A);
3721
+ return {
3722
+ useQueryState: h,
3723
+ useQuerySubscription: S,
3724
+ useLazyQuerySubscription: b,
3725
+ useLazyQuery(l) {
3726
+ const [o, c, {
3727
+ reset: y
3728
+ }] = b(l), E = h(c, {
3729
+ ...l,
3730
+ skip: c === Nt
3731
+ }), N = G(() => ({
3732
+ lastArg: c
3733
+ }), [c]);
3734
+ return G(() => [o, {
3735
+ ...E,
3736
+ reset: y
3737
+ }, N], [o, E, y, N]);
3738
+ },
3739
+ useQuery(l, o) {
3740
+ const c = S(l, o), y = h(l, {
3741
+ selectFromResult: l === te || o?.skip ? void 0 : Vn,
3742
+ ...o
3743
+ }), E = Mt(y, ...Qt);
3744
+ return It(E), G(() => ({
3745
+ ...y,
3746
+ ...c
3747
+ }), [y, c]);
3748
+ }
3749
+ };
3750
+ }
3751
+ function g(a) {
3752
+ const S = (h, l = {}) => {
3753
+ const [o, c, y, E] = v(a, h, l), N = fe(E);
3754
+ w(() => {
3755
+ N.current = E;
3756
+ }, [E]);
3757
+ const M = l.refetchCachedPages, q = Ae(M), k = ge(function(F, L) {
3758
+ let j;
3759
+ return t(() => {
3760
+ T(o), o.current = j = c(y(F, {
3761
+ subscriptionOptions: N.current,
3762
+ direction: L
3763
+ }));
3764
+ }), j;
3765
+ }, [o, c, y]);
3766
+ P(o);
3767
+ const D = kt(l.skip ? te : h), Q = ge((F) => {
3768
+ if (!o.current) throw new Error(process.env.NODE_ENV === "production" ? ye(38) : "Cannot refetch a query that has not been started yet.");
3769
+ const L = {
3770
+ refetchCachedPages: F?.refetchCachedPages ?? q
3771
+ };
3772
+ return o.current.refetch(L);
3773
+ }, [o, q]);
3774
+ return G(() => ({
3775
+ trigger: k,
3776
+ /**
3777
+ * A method to manually refetch data for the query
3778
+ */
3779
+ refetch: Q,
3780
+ fetchNextPage: () => k(D, "forward"),
3781
+ fetchPreviousPage: () => k(D, "backward")
3782
+ }), [Q, k, D]);
3783
+ }, b = p(a, R);
3784
+ return {
3785
+ useInfiniteQueryState: b,
3786
+ useInfiniteQuerySubscription: S,
3787
+ useInfiniteQuery(h, l) {
3788
+ const {
3789
+ refetch: o,
3790
+ fetchNextPage: c,
3791
+ fetchPreviousPage: y
3792
+ } = S(h, l), E = b(h, {
3793
+ selectFromResult: h === te || l?.skip ? void 0 : Vn,
3794
+ ...l
3795
+ }), N = Mt(E, ...Qt, "hasNextPage", "hasPreviousPage");
3796
+ return It(N), G(() => ({
3797
+ ...E,
3798
+ fetchNextPage: c,
3799
+ fetchPreviousPage: y,
3800
+ refetch: o
3801
+ }), [E, c, y, o]);
3802
+ }
3803
+ };
3804
+ }
3805
+ function s(a) {
3806
+ return ({
3807
+ selectFromResult: S,
3808
+ fixedCacheKey: b
3809
+ } = {}) => {
3810
+ const {
3811
+ select: h,
3812
+ initiate: l
3813
+ } = e.endpoints[a], o = n(), [c, y] = un();
3814
+ de(() => () => {
3815
+ c?.arg.fixedCacheKey || c?.reset();
3816
+ }, [c]);
3817
+ const E = ge(function(j) {
3818
+ const V = o(l(j, {
3819
+ fixedCacheKey: b
3820
+ }));
3821
+ return y(V), V;
3822
+ }, [o, l, b]), {
3823
+ requestId: N
3824
+ } = c || {}, M = G(() => h({
3825
+ fixedCacheKey: b,
3826
+ requestId: c?.requestId
3827
+ }), [b, c, h]), q = G(() => S ? m([M], S) : M, [S, M]), k = r(q, Ue), D = b == null ? c?.arg.originalArgs : void 0, Q = ge(() => {
3828
+ t(() => {
3829
+ c && y(void 0), b && o(e.internalActions.removeMutationResult({
3830
+ requestId: N,
3831
+ fixedCacheKey: b
3832
+ }));
3833
+ });
3834
+ }, [o, b, c, N]), F = Mt(k, ...Qt, "endpointName");
3835
+ It(F);
3836
+ const L = G(() => ({
3837
+ ...k,
3838
+ originalArgs: D,
3839
+ reset: Q
3840
+ }), [k, D, Q]);
3841
+ return G(() => [E, L], [E, L]);
3842
+ };
3843
+ }
3844
+ }
3845
+ var ho = /* @__PURE__ */ Symbol(), yo = ({
3846
+ batch: e = Zi,
3847
+ hooks: t = {
3848
+ useDispatch: Gi,
3849
+ useSelector: Xi,
3850
+ useStore: vr
3851
+ },
3852
+ createSelector: n = nr,
3853
+ unstable__sideEffectsInRender: r = !1,
3854
+ ...i
3855
+ } = {}) => {
3856
+ if (process.env.NODE_ENV !== "production") {
3857
+ const u = ["useDispatch", "useSelector", "useStore"];
3858
+ let m = !1;
3859
+ for (const _ of u)
3860
+ if (eo(i) > 0 && (i[_] && (m || (console.warn("As of RTK 2.0, the hooks now need to be specified as one object, provided under a `hooks` key:\n`reactHooksModule({ hooks: { useDispatch, useSelector, useStore } })`"), m = !0)), t[_] = i[_]), typeof t[_] != "function")
3861
+ throw new Error(process.env.NODE_ENV === "production" ? ye(36) : `When using custom hooks for context, all ${u.length} hooks need to be provided: ${u.join(", ")}.
3862
+ Hook ${_} was either not provided or not a function.`);
3863
+ }
3864
+ return {
3865
+ name: ho,
3866
+ init(u, {
3867
+ serializeQueryArgs: m
3868
+ }, _) {
3869
+ const C = u, {
3870
+ buildQueryHooks: w,
3871
+ buildInfiniteQueryHooks: T,
3872
+ buildMutationHook: I,
3873
+ usePrefetch: A
3874
+ } = po({
3875
+ api: u,
3876
+ moduleOptions: {
3877
+ batch: e,
3878
+ hooks: t,
3879
+ unstable__sideEffectsInRender: r,
3880
+ createSelector: n
3881
+ },
3882
+ serializeQueryArgs: m,
3883
+ context: _
3884
+ });
3885
+ return Me(C, {
3886
+ usePrefetch: A
3887
+ }), Me(_, {
3888
+ batch: e
3889
+ }), {
3890
+ injectEndpoint(R, d) {
3891
+ if (io(d)) {
3892
+ const {
3893
+ useQuery: v,
3894
+ useLazyQuery: p,
3895
+ useLazyQuerySubscription: P,
3896
+ useQueryState: O,
3897
+ useQuerySubscription: f
3898
+ } = w(R);
3899
+ Me(C.endpoints[R], {
3900
+ useQuery: v,
3901
+ useLazyQuery: p,
3902
+ useLazyQuerySubscription: P,
3903
+ useQueryState: O,
3904
+ useQuerySubscription: f
3905
+ }), u[`use${ct(R)}Query`] = v, u[`useLazy${ct(R)}Query`] = p;
3906
+ }
3907
+ if (oo(d)) {
3908
+ const v = I(R);
3909
+ Me(C.endpoints[R], {
3910
+ useMutation: v
3911
+ }), u[`use${ct(R)}Mutation`] = v;
3912
+ } else if (Sr(d)) {
3913
+ const {
3914
+ useInfiniteQuery: v,
3915
+ useInfiniteQuerySubscription: p,
3916
+ useInfiniteQueryState: P
3917
+ } = T(R);
3918
+ Me(C.endpoints[R], {
3919
+ useInfiniteQuery: v,
3920
+ useInfiniteQuerySubscription: p,
3921
+ useInfiniteQueryState: P
3922
+ }), u[`use${ct(R)}InfiniteQuery`] = v;
3923
+ }
3924
+ }
3925
+ };
3926
+ }
3927
+ };
3928
+ }, go = /* @__PURE__ */ hr(yr(), yo());
3929
+ const nt = "auth";
3930
+ let _r = null;
3931
+ function mo() {
3932
+ return _r;
3933
+ }
3934
+ function Do(e) {
3935
+ _r = e;
3936
+ }
3937
+ const vo = {
3938
+ token: null
3939
+ }, br = Se({
3940
+ name: nt,
3941
+ initialState: vo,
3942
+ reducers: {
3943
+ setToken: (e, t) => {
3944
+ e.token = t.payload;
3945
+ },
3946
+ logout: (e) => {
3947
+ e.token = null;
3948
+ }
3949
+ }
3950
+ }), { setToken: Er, logout: zn } = br.actions, No = br.reducer, ko = (e) => e[nt].token, Mo = (e) => !!e[nt].token, So = "api", Rt = go({
3951
+ reducerPath: So,
3952
+ baseQuery: _i({
3953
+ baseUrl: process.env.VITE_API_BASE_URL || "",
3954
+ prepareHeaders: (e, { getState: t }) => {
3955
+ const r = t()[nt], i = r ? r.token : void 0, u = mo();
3956
+ return i && (u ? u.prepareHeaders(e, i) : e.set("Authorization", `Bearer ${i}`)), e;
3957
+ }
3958
+ }),
3959
+ endpoints: () => ({})
3960
+ }), Qo = Rt.reducer, qo = Rt.middleware, Pr = [
3961
+ "Authentication",
3962
+ "Email",
3963
+ "Invitations",
3964
+ "Users"
3965
+ ], wr = Rt.enhanceEndpoints({
3966
+ addTagTypes: Pr
3967
+ }).injectEndpoints({
3968
+ endpoints: (e) => ({
3969
+ authControllerLogin: e.mutation({
3970
+ query: (t) => ({
3971
+ url: "/api/auth/login",
3972
+ method: "POST",
3973
+ body: t.loginDto
3974
+ }),
3975
+ invalidatesTags: ["Authentication"]
3976
+ }),
3977
+ authControllerGetProfile: e.query({
3978
+ query: () => ({ url: "/api/profile" }),
3979
+ providesTags: ["Authentication"]
3980
+ }),
3981
+ emailControllerSendEmail: e.mutation({
3982
+ query: (t) => ({
3983
+ url: "/api/email/send",
3984
+ method: "POST",
3985
+ body: t.sendEmailDto
3986
+ }),
3987
+ invalidatesTags: ["Email"]
3988
+ }),
3989
+ invitationsControllerInvite: e.mutation({
3990
+ query: (t) => ({
3991
+ url: "/api/invitations/invite",
3992
+ method: "POST",
3993
+ body: t.inviteUserDto
3994
+ }),
3995
+ invalidatesTags: ["Invitations"]
3996
+ }),
3997
+ invitationsControllerValidate: e.query({
3998
+ query: (t) => ({
3999
+ url: `/api/invitations/validate/${t.token}`
4000
+ }),
4001
+ providesTags: ["Invitations"]
4002
+ }),
4003
+ invitationsControllerAccept: e.mutation({
4004
+ query: (t) => ({
4005
+ url: "/api/invitations/accept",
4006
+ method: "POST",
4007
+ body: t.acceptInvitationDto
4008
+ }),
4009
+ invalidatesTags: ["Invitations"]
4010
+ }),
4011
+ usersControllerFindAll: e.query({
4012
+ query: () => ({ url: "/api/users" }),
4013
+ providesTags: ["Users"]
4014
+ }),
4015
+ usersControllerFindOne: e.query({
4016
+ query: (t) => ({ url: `/api/users/${t.id}` }),
4017
+ providesTags: ["Users"]
4018
+ }),
4019
+ usersControllerDelete: e.mutation({
4020
+ query: (t) => ({
4021
+ url: `/api/users/${t.id}`,
4022
+ method: "DELETE"
4023
+ }),
4024
+ invalidatesTags: ["Users"]
4025
+ })
4026
+ }),
4027
+ overrideExisting: !1
4028
+ }), {
4029
+ useAuthControllerLoginMutation: _o,
4030
+ useAuthControllerGetProfileQuery: bo,
4031
+ useEmailControllerSendEmailMutation: Eo,
4032
+ useInvitationsControllerInviteMutation: Po,
4033
+ useInvitationsControllerValidateQuery: wo,
4034
+ useInvitationsControllerAcceptMutation: Ro,
4035
+ useUsersControllerFindAllQuery: Oo,
4036
+ useUsersControllerFindOneQuery: Io,
4037
+ useUsersControllerDeleteMutation: Ao
4038
+ } = wr, Fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4039
+ __proto__: null,
4040
+ addTagTypes: Pr,
4041
+ api: wr,
4042
+ useAuthControllerGetProfileQuery: bo,
4043
+ useAuthControllerLoginMutation: _o,
4044
+ useEmailControllerSendEmailMutation: Eo,
4045
+ useInvitationsControllerAcceptMutation: Ro,
4046
+ useInvitationsControllerInviteMutation: Po,
4047
+ useInvitationsControllerValidateQuery: wo,
4048
+ useUsersControllerDeleteMutation: Ao,
4049
+ useUsersControllerFindAllQuery: Oo,
4050
+ useUsersControllerFindOneQuery: Io
4051
+ }, Symbol.toStringTag, { value: "Module" }));
4052
+ function xo(e) {
4053
+ return {
4054
+ prepareHeaders(t, n) {
4055
+ const r = e.formatValue ? e.formatValue(n) : n;
4056
+ t.set(e.headerName, r);
4057
+ }
4058
+ };
4059
+ }
4060
+ let _e = {};
4061
+ function Uo(e) {
4062
+ _e = e;
4063
+ }
4064
+ function Vo() {
4065
+ const e = Tr();
4066
+ return e.startListening({
4067
+ actionCreator: zn,
4068
+ effect: (t, n) => {
4069
+ n.dispatch(Rt.util.resetApiState()), _e.onLogout && _e.onLogout();
4070
+ }
4071
+ }), e.startListening({
4072
+ matcher: ze(Er, zn),
4073
+ effect: (t, n) => {
4074
+ if (!_e.persistence) return;
4075
+ const r = n.getState();
4076
+ _e.persistence.setToken(r[nt].token);
4077
+ }
4078
+ }), e.middleware;
4079
+ }
4080
+ function zo() {
4081
+ let e = !1;
4082
+ return (t) => (n) => (r) => {
4083
+ if (!e && _e.persistence) {
4084
+ e = !0;
4085
+ const i = _e.persistence.getToken();
4086
+ i && t.dispatch(Er(i));
4087
+ }
4088
+ return n(r);
4089
+ };
4090
+ }
4091
+ function $o(e, t = "token") {
4092
+ return {
4093
+ getToken: () => {
4094
+ try {
4095
+ return e.getItem(t);
4096
+ } catch {
4097
+ return null;
4098
+ }
4099
+ },
4100
+ setToken: (n) => {
4101
+ try {
4102
+ n ? e.setItem(t, n) : e.removeItem(t);
4103
+ } catch {
4104
+ }
4105
+ }
4106
+ };
4107
+ }
4108
+ export {
4109
+ So as ApiKey,
4110
+ nt as AuthKey,
4111
+ Pr as addTagTypes,
4112
+ wr as api,
4113
+ qo as apiMiddleware,
4114
+ Qo as apiReducer,
4115
+ No as authReducer,
4116
+ br as authSlice,
4117
+ Rt as baseApi,
4118
+ Uo as configureAuth,
4119
+ zo as createAuthHydrationMiddleware,
4120
+ Vo as createAuthListenerMiddleware,
4121
+ xo as createCustomHeaderAdapter,
4122
+ Fo as demoScaffoldBackend,
4123
+ mo as getAuthAdapter,
4124
+ zn as logout,
4125
+ Mo as selectIsAuthenticated,
4126
+ ko as selectToken,
4127
+ Do as setAuthAdapter,
4128
+ Er as setToken,
4129
+ $o as storagePersistence,
4130
+ bo as useAuthControllerGetProfileQuery,
4131
+ _o as useAuthControllerLoginMutation,
4132
+ Eo as useEmailControllerSendEmailMutation,
4133
+ Ro as useInvitationsControllerAcceptMutation,
4134
+ Po as useInvitationsControllerInviteMutation,
4135
+ wo as useInvitationsControllerValidateQuery,
4136
+ Ao as useUsersControllerDeleteMutation,
4137
+ Oo as useUsersControllerFindAllQuery,
4138
+ Io as useUsersControllerFindOneQuery
4139
+ };