@moh-sso/api 0.0.0-stage → 1.3.2

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