UNPKG

193 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3 typeof define === 'function' && define.amd ? define(['exports'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.RTKQ = {}));
5})(this, (function (exports) { 'use strict';
6
7 var __extends = (undefined && undefined.__extends) || (function () {
8 var extendStatics = function (d, b) {
9 extendStatics = Object.setPrototypeOf ||
10 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
11 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
12 return extendStatics(d, b);
13 };
14 return function (d, b) {
15 if (typeof b !== "function" && b !== null)
16 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
17 extendStatics(d, b);
18 function __() { this.constructor = d; }
19 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
20 };
21 })();
22 var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
23 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25 function verb(n) { return function (v) { return step([n, v]); }; }
26 function step(op) {
27 if (f) throw new TypeError("Generator is already executing.");
28 while (_) try {
29 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30 if (y = 0, t) op = [op[0] & 2, t.value];
31 switch (op[0]) {
32 case 0: case 1: t = op; break;
33 case 4: _.label++; return { value: op[1], done: false };
34 case 5: _.label++; y = op[1]; op = [0]; continue;
35 case 7: op = _.ops.pop(); _.trys.pop(); continue;
36 default:
37 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41 if (t[2]) _.ops.pop();
42 _.trys.pop(); continue;
43 }
44 op = body.call(thisArg, _);
45 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47 }
48 };
49 var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) {
50 for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
51 to[j] = from[i];
52 return to;
53 };
54 var __defProp = Object.defineProperty;
55 var __defProps = Object.defineProperties;
56 var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
57 var __getOwnPropSymbols = Object.getOwnPropertySymbols;
58 var __hasOwnProp = Object.prototype.hasOwnProperty;
59 var __propIsEnum = Object.prototype.propertyIsEnumerable;
60 var __defNormalProp = function (obj, key, value) { return key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value }) : obj[key] = value; };
61 var __spreadValues = function (a2, b2) {
62 for (var prop in b2 || (b2 = {}))
63 if (__hasOwnProp.call(b2, prop))
64 __defNormalProp(a2, prop, b2[prop]);
65 if (__getOwnPropSymbols)
66 for (var _j = 0, _k = __getOwnPropSymbols(b2); _j < _k.length; _j++) {
67 var prop = _k[_j];
68 if (__propIsEnum.call(b2, prop))
69 __defNormalProp(a2, prop, b2[prop]);
70 }
71 return a2;
72 };
73 var __spreadProps = function (a2, b2) { return __defProps(a2, __getOwnPropDescs(b2)); };
74 var __objRest = function (source, exclude) {
75 var target = {};
76 for (var prop in source)
77 if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
78 target[prop] = source[prop];
79 if (source != null && __getOwnPropSymbols)
80 for (var _j = 0, _k = __getOwnPropSymbols(source); _j < _k.length; _j++) {
81 var prop = _k[_j];
82 if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
83 target[prop] = source[prop];
84 }
85 return target;
86 };
87 var __async = function (__this, __arguments, generator) {
88 return new Promise(function (resolve, reject) {
89 var fulfilled = function (value) {
90 try {
91 step(generator.next(value));
92 }
93 catch (e2) {
94 reject(e2);
95 }
96 };
97 var rejected = function (value) {
98 try {
99 step(generator.throw(value));
100 }
101 catch (e2) {
102 reject(e2);
103 }
104 };
105 var step = function (x2) { return x2.done ? resolve(x2.value) : Promise.resolve(x2.value).then(fulfilled, rejected); };
106 step((generator = generator.apply(__this, __arguments)).next());
107 });
108 };
109 // src/query/core/apiState.ts
110 exports.QueryStatus = void 0;
111 (function (QueryStatus2) {
112 QueryStatus2["uninitialized"] = "uninitialized";
113 QueryStatus2["pending"] = "pending";
114 QueryStatus2["fulfilled"] = "fulfilled";
115 QueryStatus2["rejected"] = "rejected";
116 })(exports.QueryStatus || (exports.QueryStatus = {}));
117 function getRequestStatusFlags(status) {
118 return {
119 status: status,
120 isUninitialized: status === exports.QueryStatus.uninitialized,
121 isLoading: status === exports.QueryStatus.pending,
122 isSuccess: status === exports.QueryStatus.fulfilled,
123 isError: status === exports.QueryStatus.rejected
124 };
125 }
126 // src/query/utils/isAbsoluteUrl.ts
127 function isAbsoluteUrl(url) {
128 return new RegExp("(^|:)//").test(url);
129 }
130 // src/query/utils/joinUrls.ts
131 var withoutTrailingSlash = function (url) { return url.replace(/\/$/, ""); };
132 var withoutLeadingSlash = function (url) { return url.replace(/^\//, ""); };
133 function joinUrls(base, url) {
134 if (!base) {
135 return url;
136 }
137 if (!url) {
138 return base;
139 }
140 if (isAbsoluteUrl(url)) {
141 return url;
142 }
143 var delimiter = base.endsWith("/") || !url.startsWith("?") ? "/" : "";
144 base = withoutTrailingSlash(base);
145 url = withoutLeadingSlash(url);
146 return "" + base + delimiter + url;
147 }
148 // src/query/utils/flatten.ts
149 var flatten = function (arr) { return [].concat.apply([], arr); };
150 // src/query/utils/isOnline.ts
151 function isOnline() {
152 return typeof navigator === "undefined" ? true : navigator.onLine === void 0 ? true : navigator.onLine;
153 }
154 // src/query/utils/isDocumentVisible.ts
155 function isDocumentVisible() {
156 if (typeof document === "undefined") {
157 return true;
158 }
159 return document.visibilityState !== "hidden";
160 }
161 // ../../node_modules/immer/dist/immer.esm.mjs
162 function n(n2) {
163 for (var r2 = arguments.length, t2 = Array(r2 > 1 ? r2 - 1 : 0), e2 = 1; e2 < r2; e2++)
164 t2[e2 - 1] = arguments[e2];
165 {
166 var i2 = Y[n2], o2 = i2 ? typeof i2 == "function" ? i2.apply(null, t2) : i2 : "unknown error nr: " + n2;
167 throw Error("[Immer] " + o2);
168 }
169 }
170 function r(n2) {
171 return !!n2 && !!n2[Q];
172 }
173 function t(n2) {
174 var r2;
175 return !!n2 && (function (n3) {
176 if (!n3 || typeof n3 != "object")
177 return false;
178 var r3 = Object.getPrototypeOf(n3);
179 if (r3 === null)
180 return true;
181 var t2 = Object.hasOwnProperty.call(r3, "constructor") && r3.constructor;
182 return t2 === Object || typeof t2 == "function" && Function.toString.call(t2) === Z;
183 }(n2) || Array.isArray(n2) || !!n2[L] || !!((r2 = n2.constructor) === null || r2 === void 0 ? void 0 : r2[L]) || s(n2) || v(n2));
184 }
185 function i(n2, r2, t2) {
186 t2 === void 0 && (t2 = false), o(n2) === 0 ? (t2 ? Object.keys : nn)(n2).forEach(function (e2) {
187 t2 && typeof e2 == "symbol" || r2(e2, n2[e2], n2);
188 }) : n2.forEach(function (t3, e2) {
189 return r2(e2, t3, n2);
190 });
191 }
192 function o(n2) {
193 var r2 = n2[Q];
194 return r2 ? r2.i > 3 ? r2.i - 4 : r2.i : Array.isArray(n2) ? 1 : s(n2) ? 2 : v(n2) ? 3 : 0;
195 }
196 function u(n2, r2) {
197 return o(n2) === 2 ? n2.has(r2) : Object.prototype.hasOwnProperty.call(n2, r2);
198 }
199 function a(n2, r2) {
200 return o(n2) === 2 ? n2.get(r2) : n2[r2];
201 }
202 function f(n2, r2, t2) {
203 var e2 = o(n2);
204 e2 === 2 ? n2.set(r2, t2) : e2 === 3 ? (n2.delete(r2), n2.add(t2)) : n2[r2] = t2;
205 }
206 function c(n2, r2) {
207 return n2 === r2 ? n2 !== 0 || 1 / n2 == 1 / r2 : n2 != n2 && r2 != r2;
208 }
209 function s(n2) {
210 return X && n2 instanceof Map;
211 }
212 function v(n2) {
213 return q && n2 instanceof Set;
214 }
215 function p(n2) {
216 return n2.o || n2.t;
217 }
218 function l(n2) {
219 if (Array.isArray(n2))
220 return Array.prototype.slice.call(n2);
221 var r2 = rn(n2);
222 delete r2[Q];
223 for (var t2 = nn(r2), e2 = 0; e2 < t2.length; e2++) {
224 var i2 = t2[e2], o2 = r2[i2];
225 o2.writable === false && (o2.writable = true, o2.configurable = true), (o2.get || o2.set) && (r2[i2] = { configurable: true, writable: true, enumerable: o2.enumerable, value: n2[i2] });
226 }
227 return Object.create(Object.getPrototypeOf(n2), r2);
228 }
229 function d(n2, e2) {
230 return e2 === void 0 && (e2 = false), y(n2) || r(n2) || !t(n2) ? n2 : (o(n2) > 1 && (n2.set = n2.add = n2.clear = n2.delete = h), Object.freeze(n2), e2 && i(n2, function (n3, r2) {
231 return d(r2, true);
232 }, true), n2);
233 }
234 function h() {
235 n(2);
236 }
237 function y(n2) {
238 return n2 == null || typeof n2 != "object" || Object.isFrozen(n2);
239 }
240 function b(r2) {
241 var t2 = tn[r2];
242 return t2 || n(18, r2), t2;
243 }
244 function m(n2, r2) {
245 tn[n2] || (tn[n2] = r2);
246 }
247 function _() {
248 return U || n(0), U;
249 }
250 function j(n2, r2) {
251 r2 && (b("Patches"), n2.u = [], n2.s = [], n2.v = r2);
252 }
253 function O(n2) {
254 g(n2), n2.p.forEach(S), n2.p = null;
255 }
256 function g(n2) {
257 n2 === U && (U = n2.l);
258 }
259 function w(n2) {
260 return U = { p: [], l: U, h: n2, m: true, _: 0 };
261 }
262 function S(n2) {
263 var r2 = n2[Q];
264 r2.i === 0 || r2.i === 1 ? r2.j() : r2.O = true;
265 }
266 function P(r2, e2) {
267 e2._ = e2.p.length;
268 var i2 = e2.p[0], o2 = r2 !== void 0 && r2 !== i2;
269 return e2.h.g || b("ES5").S(e2, r2, o2), o2 ? (i2[Q].P && (O(e2), n(4)), t(r2) && (r2 = M(e2, r2), e2.l || x(e2, r2)), e2.u && b("Patches").M(i2[Q].t, r2, e2.u, e2.s)) : r2 = M(e2, i2, []), O(e2), e2.u && e2.v(e2.u, e2.s), r2 !== H ? r2 : void 0;
270 }
271 function M(n2, r2, t2) {
272 if (y(r2))
273 return r2;
274 var e2 = r2[Q];
275 if (!e2)
276 return i(r2, function (i2, o3) {
277 return A(n2, e2, r2, i2, o3, t2);
278 }, true), r2;
279 if (e2.A !== n2)
280 return r2;
281 if (!e2.P)
282 return x(n2, e2.t, true), e2.t;
283 if (!e2.I) {
284 e2.I = true, e2.A._--;
285 var o2 = e2.i === 4 || e2.i === 5 ? e2.o = l(e2.k) : e2.o;
286 i(e2.i === 3 ? new Set(o2) : o2, function (r3, i2) {
287 return A(n2, e2, o2, r3, i2, t2);
288 }), x(n2, o2, false), t2 && n2.u && b("Patches").R(e2, t2, n2.u, n2.s);
289 }
290 return e2.o;
291 }
292 function A(e2, i2, o2, a2, c2, s2) {
293 if (c2 === o2 && n(5), r(c2)) {
294 var v2 = M(e2, c2, s2 && i2 && i2.i !== 3 && !u(i2.D, a2) ? s2.concat(a2) : void 0);
295 if (f(o2, a2, v2), !r(v2))
296 return;
297 e2.m = false;
298 }
299 if (t(c2) && !y(c2)) {
300 if (!e2.h.F && e2._ < 1)
301 return;
302 M(e2, c2), i2 && i2.A.l || x(e2, c2);
303 }
304 }
305 function x(n2, r2, t2) {
306 t2 === void 0 && (t2 = false), n2.h.F && n2.m && d(r2, t2);
307 }
308 function z(n2, r2) {
309 var t2 = n2[Q];
310 return (t2 ? p(t2) : n2)[r2];
311 }
312 function I(n2, r2) {
313 if (r2 in n2)
314 for (var t2 = Object.getPrototypeOf(n2); t2;) {
315 var e2 = Object.getOwnPropertyDescriptor(t2, r2);
316 if (e2)
317 return e2;
318 t2 = Object.getPrototypeOf(t2);
319 }
320 }
321 function k(n2) {
322 n2.P || (n2.P = true, n2.l && k(n2.l));
323 }
324 function E(n2) {
325 n2.o || (n2.o = l(n2.t));
326 }
327 function R(n2, r2, t2) {
328 var e2 = s(r2) ? b("MapSet").N(r2, t2) : v(r2) ? b("MapSet").T(r2, t2) : n2.g ? function (n3, r3) {
329 var t3 = Array.isArray(n3), e3 = { i: t3 ? 1 : 0, A: r3 ? r3.A : _(), P: false, I: false, D: {}, l: r3, t: n3, k: null, o: null, j: null, C: false }, i2 = e3, o2 = en;
330 t3 && (i2 = [e3], o2 = on);
331 var u2 = Proxy.revocable(i2, o2), a2 = u2.revoke, f2 = u2.proxy;
332 return e3.k = f2, e3.j = a2, f2;
333 }(r2, t2) : b("ES5").J(r2, t2);
334 return (t2 ? t2.A : _()).p.push(e2), e2;
335 }
336 function D(e2) {
337 return r(e2) || n(22, e2), function n2(r2) {
338 if (!t(r2))
339 return r2;
340 var e3, u2 = r2[Q], c2 = o(r2);
341 if (u2) {
342 if (!u2.P && (u2.i < 4 || !b("ES5").K(u2)))
343 return u2.t;
344 u2.I = true, e3 = F(r2, c2), u2.I = false;
345 }
346 else
347 e3 = F(r2, c2);
348 return i(e3, function (r3, t2) {
349 u2 && a(u2.t, r3) === t2 || f(e3, r3, n2(t2));
350 }), c2 === 3 ? new Set(e3) : e3;
351 }(e2);
352 }
353 function F(n2, r2) {
354 switch (r2) {
355 case 2:
356 return new Map(n2);
357 case 3:
358 return Array.from(n2);
359 }
360 return l(n2);
361 }
362 function N() {
363 function t2(n2, r2) {
364 var t3 = s2[n2];
365 return t3 ? t3.enumerable = r2 : s2[n2] = t3 = { configurable: true, enumerable: r2, get: function () {
366 var r3 = this[Q];
367 return f2(r3), en.get(r3, n2);
368 }, set: function (r3) {
369 var t4 = this[Q];
370 f2(t4), en.set(t4, n2, r3);
371 } }, t3;
372 }
373 function e2(n2) {
374 for (var r2 = n2.length - 1; r2 >= 0; r2--) {
375 var t3 = n2[r2][Q];
376 if (!t3.P)
377 switch (t3.i) {
378 case 5:
379 a2(t3) && k(t3);
380 break;
381 case 4:
382 o2(t3) && k(t3);
383 }
384 }
385 }
386 function o2(n2) {
387 for (var r2 = n2.t, t3 = n2.k, e3 = nn(t3), i2 = e3.length - 1; i2 >= 0; i2--) {
388 var o3 = e3[i2];
389 if (o3 !== Q) {
390 var a3 = r2[o3];
391 if (a3 === void 0 && !u(r2, o3))
392 return true;
393 var f3 = t3[o3], s3 = f3 && f3[Q];
394 if (s3 ? s3.t !== a3 : !c(f3, a3))
395 return true;
396 }
397 }
398 var v2 = !!r2[Q];
399 return e3.length !== nn(r2).length + (v2 ? 0 : 1);
400 }
401 function a2(n2) {
402 var r2 = n2.k;
403 if (r2.length !== n2.t.length)
404 return true;
405 var t3 = Object.getOwnPropertyDescriptor(r2, r2.length - 1);
406 if (t3 && !t3.get)
407 return true;
408 for (var e3 = 0; e3 < r2.length; e3++)
409 if (!r2.hasOwnProperty(e3))
410 return true;
411 return false;
412 }
413 function f2(r2) {
414 r2.O && n(3, JSON.stringify(p(r2)));
415 }
416 var s2 = {};
417 m("ES5", { J: function (n2, r2) {
418 var e3 = Array.isArray(n2), i2 = function (n3, r3) {
419 if (n3) {
420 for (var e4 = Array(r3.length), i3 = 0; i3 < r3.length; i3++)
421 Object.defineProperty(e4, "" + i3, t2(i3, true));
422 return e4;
423 }
424 var o4 = rn(r3);
425 delete o4[Q];
426 for (var u2 = nn(o4), a3 = 0; a3 < u2.length; a3++) {
427 var f3 = u2[a3];
428 o4[f3] = t2(f3, n3 || !!o4[f3].enumerable);
429 }
430 return Object.create(Object.getPrototypeOf(r3), o4);
431 }(e3, n2), o3 = { i: e3 ? 5 : 4, A: r2 ? r2.A : _(), P: false, I: false, D: {}, l: r2, t: n2, k: i2, o: null, O: false, C: false };
432 return Object.defineProperty(i2, Q, { value: o3, writable: true }), i2;
433 }, S: function (n2, t3, o3) {
434 o3 ? r(t3) && t3[Q].A === n2 && e2(n2.p) : (n2.u && function n3(r2) {
435 if (r2 && typeof r2 == "object") {
436 var t4 = r2[Q];
437 if (t4) {
438 var e3 = t4.t, o4 = t4.k, f3 = t4.D, c2 = t4.i;
439 if (c2 === 4)
440 i(o4, function (r3) {
441 r3 !== Q && (e3[r3] !== void 0 || u(e3, r3) ? f3[r3] || n3(o4[r3]) : (f3[r3] = true, k(t4)));
442 }), i(e3, function (n4) {
443 o4[n4] !== void 0 || u(o4, n4) || (f3[n4] = false, k(t4));
444 });
445 else if (c2 === 5) {
446 if (a2(t4) && (k(t4), f3.length = true), o4.length < e3.length)
447 for (var s3 = o4.length; s3 < e3.length; s3++)
448 f3[s3] = false;
449 else
450 for (var v2 = e3.length; v2 < o4.length; v2++)
451 f3[v2] = true;
452 for (var p2 = Math.min(o4.length, e3.length), l2 = 0; l2 < p2; l2++)
453 o4.hasOwnProperty(l2) || (f3[l2] = true), f3[l2] === void 0 && n3(o4[l2]);
454 }
455 }
456 }
457 }(n2.p[0]), e2(n2.p));
458 }, K: function (n2) {
459 return n2.i === 4 ? o2(n2) : a2(n2);
460 } });
461 }
462 function T() {
463 function e2(n2) {
464 if (!t(n2))
465 return n2;
466 if (Array.isArray(n2))
467 return n2.map(e2);
468 if (s(n2))
469 return new Map(Array.from(n2.entries()).map(function (n3) {
470 return [n3[0], e2(n3[1])];
471 }));
472 if (v(n2))
473 return new Set(Array.from(n2).map(e2));
474 var r2 = Object.create(Object.getPrototypeOf(n2));
475 for (var i2 in n2)
476 r2[i2] = e2(n2[i2]);
477 return u(n2, L) && (r2[L] = n2[L]), r2;
478 }
479 function f2(n2) {
480 return r(n2) ? e2(n2) : n2;
481 }
482 var c2 = "add";
483 m("Patches", { $: function (r2, t2) {
484 return t2.forEach(function (t3) {
485 for (var i2 = t3.path, u2 = t3.op, f3 = r2, s2 = 0; s2 < i2.length - 1; s2++) {
486 var v2 = o(f3), p2 = "" + i2[s2];
487 v2 !== 0 && v2 !== 1 || p2 !== "__proto__" && p2 !== "constructor" || n(24), typeof f3 == "function" && p2 === "prototype" && n(24), typeof (f3 = a(f3, p2)) != "object" && n(15, i2.join("/"));
488 }
489 var l2 = o(f3), d2 = e2(t3.value), h2 = i2[i2.length - 1];
490 switch (u2) {
491 case "replace":
492 switch (l2) {
493 case 2:
494 return f3.set(h2, d2);
495 case 3:
496 n(16);
497 default:
498 return f3[h2] = d2;
499 }
500 case c2:
501 switch (l2) {
502 case 1:
503 return h2 === "-" ? f3.push(d2) : f3.splice(h2, 0, d2);
504 case 2:
505 return f3.set(h2, d2);
506 case 3:
507 return f3.add(d2);
508 default:
509 return f3[h2] = d2;
510 }
511 case "remove":
512 switch (l2) {
513 case 1:
514 return f3.splice(h2, 1);
515 case 2:
516 return f3.delete(h2);
517 case 3:
518 return f3.delete(t3.value);
519 default:
520 return delete f3[h2];
521 }
522 default:
523 n(17, u2);
524 }
525 }), r2;
526 }, R: function (n2, r2, t2, e3) {
527 switch (n2.i) {
528 case 0:
529 case 4:
530 case 2:
531 return function (n3, r3, t3, e4) {
532 var o2 = n3.t, s2 = n3.o;
533 i(n3.D, function (n4, i2) {
534 var v2 = a(o2, n4), p2 = a(s2, n4), l2 = i2 ? u(o2, n4) ? "replace" : c2 : "remove";
535 if (v2 !== p2 || l2 !== "replace") {
536 var d2 = r3.concat(n4);
537 t3.push(l2 === "remove" ? { op: l2, path: d2 } : { op: l2, path: d2, value: p2 }), e4.push(l2 === c2 ? { op: "remove", path: d2 } : l2 === "remove" ? { op: c2, path: d2, value: f2(v2) } : { op: "replace", path: d2, value: f2(v2) });
538 }
539 });
540 }(n2, r2, t2, e3);
541 case 5:
542 case 1:
543 return function (n3, r3, t3, e4) {
544 var i2 = n3.t, o2 = n3.D, u2 = n3.o;
545 if (u2.length < i2.length) {
546 var a2 = [u2, i2];
547 i2 = a2[0], u2 = a2[1];
548 var s2 = [e4, t3];
549 t3 = s2[0], e4 = s2[1];
550 }
551 for (var v2 = 0; v2 < i2.length; v2++)
552 if (o2[v2] && u2[v2] !== i2[v2]) {
553 var p2 = r3.concat([v2]);
554 t3.push({ op: "replace", path: p2, value: f2(u2[v2]) }), e4.push({ op: "replace", path: p2, value: f2(i2[v2]) });
555 }
556 for (var l2 = i2.length; l2 < u2.length; l2++) {
557 var d2 = r3.concat([l2]);
558 t3.push({ op: c2, path: d2, value: f2(u2[l2]) });
559 }
560 i2.length < u2.length && e4.push({ op: "replace", path: r3.concat(["length"]), value: i2.length });
561 }(n2, r2, t2, e3);
562 case 3:
563 return function (n3, r3, t3, e4) {
564 var i2 = n3.t, o2 = n3.o, u2 = 0;
565 i2.forEach(function (n4) {
566 if (!o2.has(n4)) {
567 var i3 = r3.concat([u2]);
568 t3.push({ op: "remove", path: i3, value: n4 }), e4.unshift({ op: c2, path: i3, value: n4 });
569 }
570 u2++;
571 }), u2 = 0, o2.forEach(function (n4) {
572 if (!i2.has(n4)) {
573 var o3 = r3.concat([u2]);
574 t3.push({ op: c2, path: o3, value: n4 }), e4.unshift({ op: "remove", path: o3, value: n4 });
575 }
576 u2++;
577 });
578 }(n2, r2, t2, e3);
579 }
580 }, M: function (n2, r2, t2, e3) {
581 t2.push({ op: "replace", path: [], value: r2 === H ? void 0 : r2 }), e3.push({ op: "replace", path: [], value: n2 });
582 } });
583 }
584 var G;
585 var U;
586 var W = typeof Symbol != "undefined" && typeof Symbol("x") == "symbol";
587 var X = typeof Map != "undefined";
588 var q = typeof Set != "undefined";
589 var B = typeof Proxy != "undefined" && Proxy.revocable !== void 0 && typeof Reflect != "undefined";
590 var H = W ? Symbol.for("immer-nothing") : ((G = {})["immer-nothing"] = true, G);
591 var L = W ? Symbol.for("immer-draftable") : "__$immer_draftable";
592 var Q = W ? Symbol.for("immer-state") : "__$immer_state";
593 var Y = { 0: "Illegal state", 1: "Immer drafts cannot have computed properties", 2: "This object has been frozen and should not be mutated", 3: function (n2) {
594 return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + n2;
595 }, 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", 5: "Immer forbids circular references", 6: "The first or second argument to `produce` must be a function", 7: "The third argument to `produce` must be a function or undefined", 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object", 9: "First argument to `finishDraft` must be a draft returned by `createDraft`", 10: "The given draft is already finalized", 11: "Object.defineProperty() cannot be used on an Immer draft", 12: "Object.setPrototypeOf() cannot be used on an Immer draft", 13: "Immer only supports deleting array indices", 14: "Immer only supports setting array indices and the 'length' property", 15: function (n2) {
596 return "Cannot apply patch, path doesn't resolve: " + n2;
597 }, 16: 'Sets cannot have "replace" patches.', 17: function (n2) {
598 return "Unsupported patch operation: " + n2;
599 }, 18: function (n2) {
600 return "The plugin for '" + n2 + "' has not been loaded into Immer. To enable the plugin, import and call `enable" + n2 + "()` when initializing your application.";
601 }, 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available", 21: function (n2) {
602 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 '" + n2 + "'";
603 }, 22: function (n2) {
604 return "'current' expects a draft, got: " + n2;
605 }, 23: function (n2) {
606 return "'original' expects a draft, got: " + n2;
607 }, 24: "Patching reserved attributes like __proto__, prototype and constructor is not allowed" };
608 var Z = "" + Object.prototype.constructor;
609 var nn = typeof Reflect != "undefined" && Reflect.ownKeys ? Reflect.ownKeys : Object.getOwnPropertySymbols !== void 0 ? function (n2) {
610 return Object.getOwnPropertyNames(n2).concat(Object.getOwnPropertySymbols(n2));
611 } : Object.getOwnPropertyNames;
612 var rn = Object.getOwnPropertyDescriptors || function (n2) {
613 var r2 = {};
614 return nn(n2).forEach(function (t2) {
615 r2[t2] = Object.getOwnPropertyDescriptor(n2, t2);
616 }), r2;
617 };
618 var tn = {};
619 var en = { get: function (n2, r2) {
620 if (r2 === Q)
621 return n2;
622 var e2 = p(n2);
623 if (!u(e2, r2))
624 return function (n3, r3, t2) {
625 var e3, i3 = I(r3, t2);
626 return i3 ? "value" in i3 ? i3.value : (e3 = i3.get) === null || e3 === void 0 ? void 0 : e3.call(n3.k) : void 0;
627 }(n2, e2, r2);
628 var i2 = e2[r2];
629 return n2.I || !t(i2) ? i2 : i2 === z(n2.t, r2) ? (E(n2), n2.o[r2] = R(n2.A.h, i2, n2)) : i2;
630 }, has: function (n2, r2) {
631 return r2 in p(n2);
632 }, ownKeys: function (n2) {
633 return Reflect.ownKeys(p(n2));
634 }, set: function (n2, r2, t2) {
635 var e2 = I(p(n2), r2);
636 if (e2 == null ? void 0 : e2.set)
637 return e2.set.call(n2.k, t2), true;
638 if (!n2.P) {
639 var i2 = z(p(n2), r2), o2 = i2 == null ? void 0 : i2[Q];
640 if (o2 && o2.t === t2)
641 return n2.o[r2] = t2, n2.D[r2] = false, true;
642 if (c(t2, i2) && (t2 !== void 0 || u(n2.t, r2)))
643 return true;
644 E(n2), k(n2);
645 }
646 return n2.o[r2] === t2 && typeof t2 != "number" && (t2 !== void 0 || r2 in n2.o) || (n2.o[r2] = t2, n2.D[r2] = true, true);
647 }, deleteProperty: function (n2, r2) {
648 return z(n2.t, r2) !== void 0 || r2 in n2.t ? (n2.D[r2] = false, E(n2), k(n2)) : delete n2.D[r2], n2.o && delete n2.o[r2], true;
649 }, getOwnPropertyDescriptor: function (n2, r2) {
650 var t2 = p(n2), e2 = Reflect.getOwnPropertyDescriptor(t2, r2);
651 return e2 ? { writable: true, configurable: n2.i !== 1 || r2 !== "length", enumerable: e2.enumerable, value: t2[r2] } : e2;
652 }, defineProperty: function () {
653 n(11);
654 }, getPrototypeOf: function (n2) {
655 return Object.getPrototypeOf(n2.t);
656 }, setPrototypeOf: function () {
657 n(12);
658 } };
659 var on = {};
660 i(en, function (n2, r2) {
661 on[n2] = function () {
662 return arguments[0] = arguments[0][0], r2.apply(this, arguments);
663 };
664 }), on.deleteProperty = function (r2, t2) {
665 return isNaN(parseInt(t2)) && n(13), on.set.call(this, r2, t2, void 0);
666 }, on.set = function (r2, t2, e2) {
667 return t2 !== "length" && isNaN(parseInt(t2)) && n(14), en.set.call(this, r2[0], t2, e2, r2[0]);
668 };
669 var un = function () {
670 function e2(r2) {
671 var e3 = this;
672 this.g = B, this.F = true, this.produce = function (r3, i3, o2) {
673 if (typeof r3 == "function" && typeof i3 != "function") {
674 var u2 = i3;
675 i3 = r3;
676 var a2 = e3;
677 return function (n2) {
678 var r4 = this;
679 n2 === void 0 && (n2 = u2);
680 for (var t2 = arguments.length, e4 = Array(t2 > 1 ? t2 - 1 : 0), o3 = 1; o3 < t2; o3++)
681 e4[o3 - 1] = arguments[o3];
682 return a2.produce(n2, function (n3) {
683 var t3;
684 return (t3 = i3).call.apply(t3, [r4, n3].concat(e4));
685 });
686 };
687 }
688 var f2;
689 if (typeof i3 != "function" && n(6), o2 !== void 0 && typeof o2 != "function" && n(7), t(r3)) {
690 var c2 = w(e3), s2 = R(e3, r3, void 0), v2 = true;
691 try {
692 f2 = i3(s2), v2 = false;
693 }
694 finally {
695 v2 ? O(c2) : g(c2);
696 }
697 return typeof Promise != "undefined" && f2 instanceof Promise ? f2.then(function (n2) {
698 return j(c2, o2), P(n2, c2);
699 }, function (n2) {
700 throw O(c2), n2;
701 }) : (j(c2, o2), P(f2, c2));
702 }
703 if (!r3 || typeof r3 != "object") {
704 if ((f2 = i3(r3)) === void 0 && (f2 = r3), f2 === H && (f2 = void 0), e3.F && d(f2, true), o2) {
705 var p2 = [], l2 = [];
706 b("Patches").M(r3, f2, p2, l2), o2(p2, l2);
707 }
708 return f2;
709 }
710 n(21, r3);
711 }, this.produceWithPatches = function (n2, r3) {
712 if (typeof n2 == "function")
713 return function (r4) {
714 for (var t3 = arguments.length, i4 = Array(t3 > 1 ? t3 - 1 : 0), o3 = 1; o3 < t3; o3++)
715 i4[o3 - 1] = arguments[o3];
716 return e3.produceWithPatches(r4, function (r5) {
717 return n2.apply(void 0, [r5].concat(i4));
718 });
719 };
720 var t2, i3, o2 = e3.produce(n2, r3, function (n3, r4) {
721 t2 = n3, i3 = r4;
722 });
723 return typeof Promise != "undefined" && o2 instanceof Promise ? o2.then(function (n3) {
724 return [n3, t2, i3];
725 }) : [o2, t2, i3];
726 }, typeof (r2 == null ? void 0 : r2.useProxies) == "boolean" && this.setUseProxies(r2.useProxies), typeof (r2 == null ? void 0 : r2.autoFreeze) == "boolean" && this.setAutoFreeze(r2.autoFreeze);
727 }
728 var i2 = e2.prototype;
729 return i2.createDraft = function (e3) {
730 t(e3) || n(8), r(e3) && (e3 = D(e3));
731 var i3 = w(this), o2 = R(this, e3, void 0);
732 return o2[Q].C = true, g(i3), o2;
733 }, i2.finishDraft = function (r2, t2) {
734 var e3 = r2 && r2[Q];
735 e3 && e3.C || n(9), e3.I && n(10);
736 var i3 = e3.A;
737 return j(i3, t2), P(void 0, i3);
738 }, i2.setAutoFreeze = function (n2) {
739 this.F = n2;
740 }, i2.setUseProxies = function (r2) {
741 r2 && !B && n(20), this.g = r2;
742 }, i2.applyPatches = function (n2, t2) {
743 var e3;
744 for (e3 = t2.length - 1; e3 >= 0; e3--) {
745 var i3 = t2[e3];
746 if (i3.path.length === 0 && i3.op === "replace") {
747 n2 = i3.value;
748 break;
749 }
750 }
751 e3 > -1 && (t2 = t2.slice(e3 + 1));
752 var o2 = b("Patches").$;
753 return r(n2) ? o2(n2, t2) : this.produce(n2, function (n3) {
754 return o2(n3, t2);
755 });
756 }, e2;
757 }();
758 var an = new un();
759 var fn = an.produce;
760 var cn = an.produceWithPatches.bind(an);
761 an.setAutoFreeze.bind(an);
762 an.setUseProxies.bind(an);
763 var pn = an.applyPatches.bind(an);
764 an.createDraft.bind(an);
765 an.finishDraft.bind(an);
766 var immer_esm_default = fn;
767 var randomString = function randomString2() {
768 return Math.random().toString(36).substring(7).split("").join(".");
769 };
770 var ActionTypes = {
771 INIT: "@@redux/INIT" + randomString(),
772 REPLACE: "@@redux/REPLACE" + randomString(),
773 PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
774 return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
775 }
776 };
777 function isPlainObject(obj) {
778 if (typeof obj !== "object" || obj === null)
779 return false;
780 var proto = obj;
781 while (Object.getPrototypeOf(proto) !== null) {
782 proto = Object.getPrototypeOf(proto);
783 }
784 return Object.getPrototypeOf(obj) === proto;
785 }
786 function miniKindOf(val) {
787 if (val === void 0)
788 return "undefined";
789 if (val === null)
790 return "null";
791 var type = typeof val;
792 switch (type) {
793 case "boolean":
794 case "string":
795 case "number":
796 case "symbol":
797 case "function": {
798 return type;
799 }
800 }
801 if (Array.isArray(val))
802 return "array";
803 if (isDate(val))
804 return "date";
805 if (isError(val))
806 return "error";
807 var constructorName = ctorName(val);
808 switch (constructorName) {
809 case "Symbol":
810 case "Promise":
811 case "WeakMap":
812 case "WeakSet":
813 case "Map":
814 case "Set":
815 return constructorName;
816 }
817 return type.slice(8, -1).toLowerCase().replace(/\s/g, "");
818 }
819 function ctorName(val) {
820 return typeof val.constructor === "function" ? val.constructor.name : null;
821 }
822 function isError(val) {
823 return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
824 }
825 function isDate(val) {
826 if (val instanceof Date)
827 return true;
828 return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
829 }
830 function kindOf(val) {
831 var typeOfVal = typeof val;
832 {
833 typeOfVal = miniKindOf(val);
834 }
835 return typeOfVal;
836 }
837 function warning(message) {
838 if (typeof console !== "undefined" && typeof console.error === "function") {
839 console.error(message);
840 }
841 try {
842 throw new Error(message);
843 }
844 catch (e2) {
845 }
846 }
847 function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
848 var reducerKeys = Object.keys(reducers);
849 var argumentName = action && action.type === ActionTypes.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
850 if (reducerKeys.length === 0) {
851 return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
852 }
853 if (!isPlainObject(inputState)) {
854 return "The " + argumentName + ' has unexpected type of "' + kindOf(inputState) + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"');
855 }
856 var unexpectedKeys = Object.keys(inputState).filter(function (key) {
857 return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
858 });
859 unexpectedKeys.forEach(function (key) {
860 unexpectedKeyCache[key] = true;
861 });
862 if (action && action.type === ActionTypes.REPLACE)
863 return;
864 if (unexpectedKeys.length > 0) {
865 return "Unexpected " + (unexpectedKeys.length > 1 ? "keys" : "key") + " " + ('"' + unexpectedKeys.join('", "') + '" found in ' + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ('"' + reducerKeys.join('", "') + '". Unexpected keys will be ignored.');
866 }
867 }
868 function assertReducerShape(reducers) {
869 Object.keys(reducers).forEach(function (key) {
870 var reducer = reducers[key];
871 var initialState2 = reducer(void 0, {
872 type: ActionTypes.INIT
873 });
874 if (typeof initialState2 === "undefined") {
875 throw new Error('The slice reducer for key "' + key + "\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");
876 }
877 if (typeof reducer(void 0, {
878 type: ActionTypes.PROBE_UNKNOWN_ACTION()
879 }) === "undefined") {
880 throw new Error('The slice reducer for key "' + key + '" returned undefined when probed with a random type. ' + ("Don't try to handle '" + ActionTypes.INIT + "' or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.");
881 }
882 });
883 }
884 function combineReducers(reducers) {
885 var reducerKeys = Object.keys(reducers);
886 var finalReducers = {};
887 for (var i2 = 0; i2 < reducerKeys.length; i2++) {
888 var key = reducerKeys[i2];
889 {
890 if (typeof reducers[key] === "undefined") {
891 warning('No reducer provided for key "' + key + '"');
892 }
893 }
894 if (typeof reducers[key] === "function") {
895 finalReducers[key] = reducers[key];
896 }
897 }
898 var finalReducerKeys = Object.keys(finalReducers);
899 var unexpectedKeyCache;
900 {
901 unexpectedKeyCache = {};
902 }
903 var shapeAssertionError;
904 try {
905 assertReducerShape(finalReducers);
906 }
907 catch (e2) {
908 shapeAssertionError = e2;
909 }
910 return function combination(state, action) {
911 if (state === void 0) {
912 state = {};
913 }
914 if (shapeAssertionError) {
915 throw shapeAssertionError;
916 }
917 {
918 var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
919 if (warningMessage) {
920 warning(warningMessage);
921 }
922 }
923 var hasChanged = false;
924 var nextState = {};
925 for (var _i = 0; _i < finalReducerKeys.length; _i++) {
926 var _key = finalReducerKeys[_i];
927 var reducer = finalReducers[_key];
928 var previousStateForKey = state[_key];
929 var nextStateForKey = reducer(previousStateForKey, action);
930 if (typeof nextStateForKey === "undefined") {
931 var actionType = action && action.type;
932 throw new Error("When called with an action of type " + (actionType ? '"' + String(actionType) + '"' : "(unknown type)") + ', the slice reducer for key "' + _key + '" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.');
933 }
934 nextState[_key] = nextStateForKey;
935 hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
936 }
937 hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
938 return hasChanged ? nextState : state;
939 };
940 }
941 function isCrushed() {
942 }
943 if (typeof isCrushed.name === "string" && isCrushed.name !== "isCrushed") {
944 warning('You are currently using minified code outside of NODE_ENV === "production". This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) to ensure you have the correct code for your production build.');
945 }
946 // ../../node_modules/reselect/es/defaultMemoize.js
947 var NOT_FOUND = "NOT_FOUND";
948 function createSingletonCache(equals) {
949 var entry;
950 return {
951 get: function get(key) {
952 if (entry && equals(entry.key, key)) {
953 return entry.value;
954 }
955 return NOT_FOUND;
956 },
957 put: function put(key, value) {
958 entry = {
959 key: key,
960 value: value
961 };
962 },
963 getEntries: function getEntries() {
964 return entry ? [entry] : [];
965 },
966 clear: function clear() {
967 entry = void 0;
968 }
969 };
970 }
971 function createLruCache(maxSize, equals) {
972 var entries = [];
973 function get(key) {
974 var cacheIndex = entries.findIndex(function (entry2) {
975 return equals(key, entry2.key);
976 });
977 if (cacheIndex > -1) {
978 var entry = entries[cacheIndex];
979 if (cacheIndex > 0) {
980 entries.splice(cacheIndex, 1);
981 entries.unshift(entry);
982 }
983 return entry.value;
984 }
985 return NOT_FOUND;
986 }
987 function put(key, value) {
988 if (get(key) === NOT_FOUND) {
989 entries.unshift({
990 key: key,
991 value: value
992 });
993 if (entries.length > maxSize) {
994 entries.pop();
995 }
996 }
997 }
998 function getEntries() {
999 return entries;
1000 }
1001 function clear() {
1002 entries = [];
1003 }
1004 return {
1005 get: get,
1006 put: put,
1007 getEntries: getEntries,
1008 clear: clear
1009 };
1010 }
1011 var defaultEqualityCheck = function defaultEqualityCheck2(a2, b2) {
1012 return a2 === b2;
1013 };
1014 function createCacheKeyComparator(equalityCheck) {
1015 return function areArgumentsShallowlyEqual(prev, next) {
1016 if (prev === null || next === null || prev.length !== next.length) {
1017 return false;
1018 }
1019 var length = prev.length;
1020 for (var i2 = 0; i2 < length; i2++) {
1021 if (!equalityCheck(prev[i2], next[i2])) {
1022 return false;
1023 }
1024 }
1025 return true;
1026 };
1027 }
1028 function defaultMemoize(func, equalityCheckOrOptions) {
1029 var providedOptions = typeof equalityCheckOrOptions === "object" ? equalityCheckOrOptions : {
1030 equalityCheck: equalityCheckOrOptions
1031 };
1032 var _providedOptions$equa = providedOptions.equalityCheck, equalityCheck = _providedOptions$equa === void 0 ? defaultEqualityCheck : _providedOptions$equa, _providedOptions$maxS = providedOptions.maxSize, maxSize = _providedOptions$maxS === void 0 ? 1 : _providedOptions$maxS, resultEqualityCheck = providedOptions.resultEqualityCheck;
1033 var comparator = createCacheKeyComparator(equalityCheck);
1034 var cache = maxSize === 1 ? createSingletonCache(comparator) : createLruCache(maxSize, comparator);
1035 function memoized() {
1036 var value = cache.get(arguments);
1037 if (value === NOT_FOUND) {
1038 value = func.apply(null, arguments);
1039 if (resultEqualityCheck) {
1040 var entries = cache.getEntries();
1041 var matchingEntry = entries.find(function (entry) {
1042 return resultEqualityCheck(entry.value, value);
1043 });
1044 if (matchingEntry) {
1045 value = matchingEntry.value;
1046 }
1047 }
1048 cache.put(arguments, value);
1049 }
1050 return value;
1051 }
1052 memoized.clearCache = function () {
1053 return cache.clear();
1054 };
1055 return memoized;
1056 }
1057 // ../../node_modules/reselect/es/index.js
1058 function getDependencies(funcs) {
1059 var dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs;
1060 if (!dependencies.every(function (dep) {
1061 return typeof dep === "function";
1062 })) {
1063 var dependencyTypes = dependencies.map(function (dep) {
1064 return typeof dep === "function" ? "function " + (dep.name || "unnamed") + "()" : typeof dep;
1065 }).join(", ");
1066 throw new Error("createSelector expects all input-selectors to be functions, but received the following types: [" + dependencyTypes + "]");
1067 }
1068 return dependencies;
1069 }
1070 function createSelectorCreator(memoize) {
1071 for (var _len = arguments.length, memoizeOptionsFromArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1072 memoizeOptionsFromArgs[_key - 1] = arguments[_key];
1073 }
1074 var createSelector2 = function createSelector3() {
1075 for (var _len2 = arguments.length, funcs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1076 funcs[_key2] = arguments[_key2];
1077 }
1078 var _recomputations = 0;
1079 var _lastResult;
1080 var directlyPassedOptions = {
1081 memoizeOptions: void 0
1082 };
1083 var resultFunc = funcs.pop();
1084 if (typeof resultFunc === "object") {
1085 directlyPassedOptions = resultFunc;
1086 resultFunc = funcs.pop();
1087 }
1088 if (typeof resultFunc !== "function") {
1089 throw new Error("createSelector expects an output function after the inputs, but received: [" + typeof resultFunc + "]");
1090 }
1091 var _directlyPassedOption = directlyPassedOptions, _directlyPassedOption2 = _directlyPassedOption.memoizeOptions, memoizeOptions = _directlyPassedOption2 === void 0 ? memoizeOptionsFromArgs : _directlyPassedOption2;
1092 var finalMemoizeOptions = Array.isArray(memoizeOptions) ? memoizeOptions : [memoizeOptions];
1093 var dependencies = getDependencies(funcs);
1094 var memoizedResultFunc = memoize.apply(void 0, [function recomputationWrapper() {
1095 _recomputations++;
1096 return resultFunc.apply(null, arguments);
1097 }].concat(finalMemoizeOptions));
1098 var selector = memoize(function dependenciesChecker() {
1099 var params = [];
1100 var length = dependencies.length;
1101 for (var i2 = 0; i2 < length; i2++) {
1102 params.push(dependencies[i2].apply(null, arguments));
1103 }
1104 _lastResult = memoizedResultFunc.apply(null, params);
1105 return _lastResult;
1106 });
1107 Object.assign(selector, {
1108 resultFunc: resultFunc,
1109 memoizedResultFunc: memoizedResultFunc,
1110 dependencies: dependencies,
1111 lastResult: function lastResult() {
1112 return _lastResult;
1113 },
1114 recomputations: function recomputations() {
1115 return _recomputations;
1116 },
1117 resetRecomputations: function resetRecomputations() {
1118 return _recomputations = 0;
1119 }
1120 });
1121 return selector;
1122 };
1123 return createSelector2;
1124 }
1125 var createSelector = /* @__PURE__ */ createSelectorCreator(defaultMemoize);
1126 // src/isPlainObject.ts
1127 function isPlainObject2(value) {
1128 if (typeof value !== "object" || value === null)
1129 return false;
1130 var proto = Object.getPrototypeOf(value);
1131 if (proto === null)
1132 return true;
1133 var baseProto = proto;
1134 while (Object.getPrototypeOf(baseProto) !== null) {
1135 baseProto = Object.getPrototypeOf(baseProto);
1136 }
1137 return proto === baseProto;
1138 }
1139 // src/utils.ts
1140 /** @class */ ((function (_super) {
1141 __extends(MiddlewareArray, _super);
1142 function MiddlewareArray() {
1143 var args = [];
1144 for (var _j = 0; _j < arguments.length; _j++) {
1145 args[_j] = arguments[_j];
1146 }
1147 var _this = _super.apply(this, args) || this;
1148 Object.setPrototypeOf(_this, MiddlewareArray.prototype);
1149 return _this;
1150 }
1151 Object.defineProperty(MiddlewareArray, Symbol.species, {
1152 get: function () {
1153 return MiddlewareArray;
1154 },
1155 enumerable: false,
1156 configurable: true
1157 });
1158 MiddlewareArray.prototype.concat = function () {
1159 var arr = [];
1160 for (var _j = 0; _j < arguments.length; _j++) {
1161 arr[_j] = arguments[_j];
1162 }
1163 return _super.prototype.concat.apply(this, arr);
1164 };
1165 MiddlewareArray.prototype.prepend = function () {
1166 var arr = [];
1167 for (var _j = 0; _j < arguments.length; _j++) {
1168 arr[_j] = arguments[_j];
1169 }
1170 if (arr.length === 1 && Array.isArray(arr[0])) {
1171 return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr[0].concat(this))))();
1172 }
1173 return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr.concat(this))))();
1174 };
1175 return MiddlewareArray;
1176 })(Array));
1177 function freezeDraftable(val) {
1178 return t(val) ? immer_esm_default(val, function () {
1179 }) : val;
1180 }
1181 // src/createAction.ts
1182 function createAction(type, prepareAction) {
1183 function actionCreator() {
1184 var args = [];
1185 for (var _j = 0; _j < arguments.length; _j++) {
1186 args[_j] = arguments[_j];
1187 }
1188 if (prepareAction) {
1189 var prepared = prepareAction.apply(void 0, args);
1190 if (!prepared) {
1191 throw new Error("prepareAction did not return an object");
1192 }
1193 return __spreadValues(__spreadValues({
1194 type: type,
1195 payload: prepared.payload
1196 }, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error });
1197 }
1198 return { type: type, payload: args[0] };
1199 }
1200 actionCreator.toString = function () { return "" + type; };
1201 actionCreator.type = type;
1202 actionCreator.match = function (action) { return action.type === type; };
1203 return actionCreator;
1204 }
1205 // src/mapBuilders.ts
1206 function executeReducerBuilderCallback(builderCallback) {
1207 var actionsMap = {};
1208 var actionMatchers = [];
1209 var defaultCaseReducer;
1210 var builder = {
1211 addCase: function (typeOrActionCreator, reducer) {
1212 {
1213 if (actionMatchers.length > 0) {
1214 throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");
1215 }
1216 if (defaultCaseReducer) {
1217 throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`");
1218 }
1219 }
1220 var type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
1221 if (type in actionsMap) {
1222 throw new Error("addCase cannot be called with two reducers for the same action type");
1223 }
1224 actionsMap[type] = reducer;
1225 return builder;
1226 },
1227 addMatcher: function (matcher, reducer) {
1228 {
1229 if (defaultCaseReducer) {
1230 throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
1231 }
1232 }
1233 actionMatchers.push({ matcher: matcher, reducer: reducer });
1234 return builder;
1235 },
1236 addDefaultCase: function (reducer) {
1237 {
1238 if (defaultCaseReducer) {
1239 throw new Error("`builder.addDefaultCase` can only be called once");
1240 }
1241 }
1242 defaultCaseReducer = reducer;
1243 return builder;
1244 }
1245 };
1246 builderCallback(builder);
1247 return [actionsMap, actionMatchers, defaultCaseReducer];
1248 }
1249 // src/createReducer.ts
1250 function isStateFunction(x2) {
1251 return typeof x2 === "function";
1252 }
1253 var hasWarnedAboutObjectNotation = false;
1254 function createReducer(initialState2, mapOrBuilderCallback, actionMatchers, defaultCaseReducer) {
1255 if (actionMatchers === void 0) { actionMatchers = []; }
1256 {
1257 if (typeof mapOrBuilderCallback === "object") {
1258 if (!hasWarnedAboutObjectNotation) {
1259 hasWarnedAboutObjectNotation = true;
1260 console.warn("The object notation for `createReducer` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
1261 }
1262 }
1263 }
1264 var _j = typeof mapOrBuilderCallback === "function" ? executeReducerBuilderCallback(mapOrBuilderCallback) : [mapOrBuilderCallback, actionMatchers, defaultCaseReducer], actionsMap = _j[0], finalActionMatchers = _j[1], finalDefaultCaseReducer = _j[2];
1265 var getInitialState;
1266 if (isStateFunction(initialState2)) {
1267 getInitialState = function () { return freezeDraftable(initialState2()); };
1268 }
1269 else {
1270 var frozenInitialState_1 = freezeDraftable(initialState2);
1271 getInitialState = function () { return frozenInitialState_1; };
1272 }
1273 function reducer(state, action) {
1274 if (state === void 0) { state = getInitialState(); }
1275 var caseReducers = __spreadArray([
1276 actionsMap[action.type]
1277 ], finalActionMatchers.filter(function (_j) {
1278 var matcher = _j.matcher;
1279 return matcher(action);
1280 }).map(function (_j) {
1281 var reducer2 = _j.reducer;
1282 return reducer2;
1283 }));
1284 if (caseReducers.filter(function (cr) { return !!cr; }).length === 0) {
1285 caseReducers = [finalDefaultCaseReducer];
1286 }
1287 return caseReducers.reduce(function (previousState, caseReducer) {
1288 if (caseReducer) {
1289 if (r(previousState)) {
1290 var draft = previousState;
1291 var result = caseReducer(draft, action);
1292 if (result === void 0) {
1293 return previousState;
1294 }
1295 return result;
1296 }
1297 else if (!t(previousState)) {
1298 var result = caseReducer(previousState, action);
1299 if (result === void 0) {
1300 if (previousState === null) {
1301 return previousState;
1302 }
1303 throw Error("A case reducer on a non-draftable value must not return undefined");
1304 }
1305 return result;
1306 }
1307 else {
1308 return immer_esm_default(previousState, function (draft) {
1309 return caseReducer(draft, action);
1310 });
1311 }
1312 }
1313 return previousState;
1314 }, state);
1315 }
1316 reducer.getInitialState = getInitialState;
1317 return reducer;
1318 }
1319 // src/createSlice.ts
1320 var hasWarnedAboutObjectNotation2 = false;
1321 function getType(slice, actionKey) {
1322 return slice + "/" + actionKey;
1323 }
1324 function createSlice(options) {
1325 var name = options.name;
1326 if (!name) {
1327 throw new Error("`name` is a required option for createSlice");
1328 }
1329 if (typeof process !== "undefined" && true) {
1330 if (options.initialState === void 0) {
1331 console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
1332 }
1333 }
1334 var initialState2 = typeof options.initialState == "function" ? options.initialState : freezeDraftable(options.initialState);
1335 var reducers = options.reducers || {};
1336 var reducerNames = Object.keys(reducers);
1337 var sliceCaseReducersByName = {};
1338 var sliceCaseReducersByType = {};
1339 var actionCreators = {};
1340 reducerNames.forEach(function (reducerName) {
1341 var maybeReducerWithPrepare = reducers[reducerName];
1342 var type = getType(name, reducerName);
1343 var caseReducer;
1344 var prepareCallback;
1345 if ("reducer" in maybeReducerWithPrepare) {
1346 caseReducer = maybeReducerWithPrepare.reducer;
1347 prepareCallback = maybeReducerWithPrepare.prepare;
1348 }
1349 else {
1350 caseReducer = maybeReducerWithPrepare;
1351 }
1352 sliceCaseReducersByName[reducerName] = caseReducer;
1353 sliceCaseReducersByType[type] = caseReducer;
1354 actionCreators[reducerName] = prepareCallback ? createAction(type, prepareCallback) : createAction(type);
1355 });
1356 function buildReducer() {
1357 {
1358 if (typeof options.extraReducers === "object") {
1359 if (!hasWarnedAboutObjectNotation2) {
1360 hasWarnedAboutObjectNotation2 = true;
1361 console.warn("The object notation for `createSlice.extraReducers` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
1362 }
1363 }
1364 }
1365 var _j = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers], _k = _j[0], extraReducers = _k === void 0 ? {} : _k, _l = _j[1], actionMatchers = _l === void 0 ? [] : _l, _m = _j[2], defaultCaseReducer = _m === void 0 ? void 0 : _m;
1366 var finalCaseReducers = __spreadValues(__spreadValues({}, extraReducers), sliceCaseReducersByType);
1367 return createReducer(initialState2, function (builder) {
1368 for (var key in finalCaseReducers) {
1369 builder.addCase(key, finalCaseReducers[key]);
1370 }
1371 for (var _j = 0, actionMatchers_1 = actionMatchers; _j < actionMatchers_1.length; _j++) {
1372 var m2 = actionMatchers_1[_j];
1373 builder.addMatcher(m2.matcher, m2.reducer);
1374 }
1375 if (defaultCaseReducer) {
1376 builder.addDefaultCase(defaultCaseReducer);
1377 }
1378 });
1379 }
1380 var _reducer;
1381 return {
1382 name: name,
1383 reducer: function (state, action) {
1384 if (!_reducer)
1385 _reducer = buildReducer();
1386 return _reducer(state, action);
1387 },
1388 actions: actionCreators,
1389 caseReducers: sliceCaseReducersByName,
1390 getInitialState: function () {
1391 if (!_reducer)
1392 _reducer = buildReducer();
1393 return _reducer.getInitialState();
1394 }
1395 };
1396 }
1397 // src/nanoid.ts
1398 var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW";
1399 var nanoid = function (size) {
1400 if (size === void 0) { size = 21; }
1401 var id = "";
1402 var i2 = size;
1403 while (i2--) {
1404 id += urlAlphabet[Math.random() * 64 | 0];
1405 }
1406 return id;
1407 };
1408 // src/createAsyncThunk.ts
1409 var commonProperties = [
1410 "name",
1411 "message",
1412 "stack",
1413 "code"
1414 ];
1415 var RejectWithValue = /** @class */ (function () {
1416 function RejectWithValue(payload, meta) {
1417 this.payload = payload;
1418 this.meta = meta;
1419 }
1420 return RejectWithValue;
1421 }());
1422 var FulfillWithMeta = /** @class */ (function () {
1423 function FulfillWithMeta(payload, meta) {
1424 this.payload = payload;
1425 this.meta = meta;
1426 }
1427 return FulfillWithMeta;
1428 }());
1429 var miniSerializeError = function (value) {
1430 if (typeof value === "object" && value !== null) {
1431 var simpleError = {};
1432 for (var _j = 0, commonProperties_1 = commonProperties; _j < commonProperties_1.length; _j++) {
1433 var property = commonProperties_1[_j];
1434 if (typeof value[property] === "string") {
1435 simpleError[property] = value[property];
1436 }
1437 }
1438 return simpleError;
1439 }
1440 return { message: String(value) };
1441 };
1442 var createAsyncThunk = (function () {
1443 function createAsyncThunk2(typePrefix, payloadCreator, options) {
1444 var fulfilled = createAction(typePrefix + "/fulfilled", function (payload, requestId, arg, meta) { return ({
1445 payload: payload,
1446 meta: __spreadProps(__spreadValues({}, meta || {}), {
1447 arg: arg,
1448 requestId: requestId,
1449 requestStatus: "fulfilled"
1450 })
1451 }); });
1452 var pending = createAction(typePrefix + "/pending", function (requestId, arg, meta) { return ({
1453 payload: void 0,
1454 meta: __spreadProps(__spreadValues({}, meta || {}), {
1455 arg: arg,
1456 requestId: requestId,
1457 requestStatus: "pending"
1458 })
1459 }); });
1460 var rejected = createAction(typePrefix + "/rejected", function (error, requestId, arg, payload, meta) { return ({
1461 payload: payload,
1462 error: (options && options.serializeError || miniSerializeError)(error || "Rejected"),
1463 meta: __spreadProps(__spreadValues({}, meta || {}), {
1464 arg: arg,
1465 requestId: requestId,
1466 rejectedWithValue: !!payload,
1467 requestStatus: "rejected",
1468 aborted: (error == null ? void 0 : error.name) === "AbortError",
1469 condition: (error == null ? void 0 : error.name) === "ConditionError"
1470 })
1471 }); });
1472 var displayedWarning = false;
1473 var AC = typeof AbortController !== "undefined" ? AbortController : /** @class */ (function () {
1474 function class_1() {
1475 this.signal = {
1476 aborted: false,
1477 addEventListener: function () {
1478 },
1479 dispatchEvent: function () {
1480 return false;
1481 },
1482 onabort: function () {
1483 },
1484 removeEventListener: function () {
1485 },
1486 reason: void 0,
1487 throwIfAborted: function () {
1488 }
1489 };
1490 }
1491 class_1.prototype.abort = function () {
1492 {
1493 if (!displayedWarning) {
1494 displayedWarning = true;
1495 console.info("This platform does not implement AbortController. \nIf you want to use the AbortController to react to `abort` events, please consider importing a polyfill like 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'.");
1496 }
1497 }
1498 };
1499 return class_1;
1500 }());
1501 function actionCreator(arg) {
1502 return function (dispatch, getState, extra) {
1503 var requestId = (options == null ? void 0 : options.idGenerator) ? options.idGenerator(arg) : nanoid();
1504 var abortController = new AC();
1505 var abortReason;
1506 function abort(reason) {
1507 abortReason = reason;
1508 abortController.abort();
1509 }
1510 var promise3 = function () {
1511 return __async(this, null, function () {
1512 var _a, _b, finalAction, conditionResult, abortedPromise, err_1, skipDispatch;
1513 return __generator(this, function (_j) {
1514 switch (_j.label) {
1515 case 0:
1516 _j.trys.push([0, 4, , 5]);
1517 conditionResult = (_a = options == null ? void 0 : options.condition) == null ? void 0 : _a.call(options, arg, { getState: getState, extra: extra });
1518 if (!isThenable(conditionResult)) return [3 /*break*/, 2];
1519 return [4 /*yield*/, conditionResult];
1520 case 1:
1521 conditionResult = _j.sent();
1522 _j.label = 2;
1523 case 2:
1524 if (conditionResult === false || abortController.signal.aborted) {
1525 throw {
1526 name: "ConditionError",
1527 message: "Aborted due to condition callback returning false."
1528 };
1529 }
1530 abortedPromise = new Promise(function (_2, reject) { return abortController.signal.addEventListener("abort", function () { return reject({
1531 name: "AbortError",
1532 message: abortReason || "Aborted"
1533 }); }); });
1534 dispatch(pending(requestId, arg, (_b = options == null ? void 0 : options.getPendingMeta) == null ? void 0 : _b.call(options, { requestId: requestId, arg: arg }, { getState: getState, extra: extra })));
1535 return [4 /*yield*/, Promise.race([
1536 abortedPromise,
1537 Promise.resolve(payloadCreator(arg, {
1538 dispatch: dispatch,
1539 getState: getState,
1540 extra: extra,
1541 requestId: requestId,
1542 signal: abortController.signal,
1543 abort: abort,
1544 rejectWithValue: function (value, meta) {
1545 return new RejectWithValue(value, meta);
1546 },
1547 fulfillWithValue: function (value, meta) {
1548 return new FulfillWithMeta(value, meta);
1549 }
1550 })).then(function (result) {
1551 if (result instanceof RejectWithValue) {
1552 throw result;
1553 }
1554 if (result instanceof FulfillWithMeta) {
1555 return fulfilled(result.payload, requestId, arg, result.meta);
1556 }
1557 return fulfilled(result, requestId, arg);
1558 })
1559 ])];
1560 case 3:
1561 finalAction = _j.sent();
1562 return [3 /*break*/, 5];
1563 case 4:
1564 err_1 = _j.sent();
1565 finalAction = err_1 instanceof RejectWithValue ? rejected(null, requestId, arg, err_1.payload, err_1.meta) : rejected(err_1, requestId, arg);
1566 return [3 /*break*/, 5];
1567 case 5:
1568 skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition;
1569 if (!skipDispatch) {
1570 dispatch(finalAction);
1571 }
1572 return [2 /*return*/, finalAction];
1573 }
1574 });
1575 });
1576 }();
1577 return Object.assign(promise3, {
1578 abort: abort,
1579 requestId: requestId,
1580 arg: arg,
1581 unwrap: function () {
1582 return promise3.then(unwrapResult);
1583 }
1584 });
1585 };
1586 }
1587 return Object.assign(actionCreator, {
1588 pending: pending,
1589 rejected: rejected,
1590 fulfilled: fulfilled,
1591 typePrefix: typePrefix
1592 });
1593 }
1594 createAsyncThunk2.withTypes = function () { return createAsyncThunk2; };
1595 return createAsyncThunk2;
1596 })();
1597 function unwrapResult(action) {
1598 if (action.meta && action.meta.rejectedWithValue) {
1599 throw action.payload;
1600 }
1601 if (action.error) {
1602 throw action.error;
1603 }
1604 return action.payload;
1605 }
1606 function isThenable(value) {
1607 return value !== null && typeof value === "object" && typeof value.then === "function";
1608 }
1609 // src/tsHelpers.ts
1610 var hasMatchFunction = function (v2) {
1611 return v2 && typeof v2.match === "function";
1612 };
1613 // src/matchers.ts
1614 var matches = function (matcher, action) {
1615 if (hasMatchFunction(matcher)) {
1616 return matcher.match(action);
1617 }
1618 else {
1619 return matcher(action);
1620 }
1621 };
1622 function isAnyOf() {
1623 var matchers = [];
1624 for (var _j = 0; _j < arguments.length; _j++) {
1625 matchers[_j] = arguments[_j];
1626 }
1627 return function (action) {
1628 return matchers.some(function (matcher) { return matches(matcher, action); });
1629 };
1630 }
1631 function isAllOf() {
1632 var matchers = [];
1633 for (var _j = 0; _j < arguments.length; _j++) {
1634 matchers[_j] = arguments[_j];
1635 }
1636 return function (action) {
1637 return matchers.every(function (matcher) { return matches(matcher, action); });
1638 };
1639 }
1640 function hasExpectedRequestMetadata(action, validStatus) {
1641 if (!action || !action.meta)
1642 return false;
1643 var hasValidRequestId = typeof action.meta.requestId === "string";
1644 var hasValidRequestStatus = validStatus.indexOf(action.meta.requestStatus) > -1;
1645 return hasValidRequestId && hasValidRequestStatus;
1646 }
1647 function isAsyncThunkArray(a2) {
1648 return typeof a2[0] === "function" && "pending" in a2[0] && "fulfilled" in a2[0] && "rejected" in a2[0];
1649 }
1650 function isPending() {
1651 var asyncThunks = [];
1652 for (var _j = 0; _j < arguments.length; _j++) {
1653 asyncThunks[_j] = arguments[_j];
1654 }
1655 if (asyncThunks.length === 0) {
1656 return function (action) { return hasExpectedRequestMetadata(action, ["pending"]); };
1657 }
1658 if (!isAsyncThunkArray(asyncThunks)) {
1659 return isPending()(asyncThunks[0]);
1660 }
1661 return function (action) {
1662 var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.pending; });
1663 var combinedMatcher = isAnyOf.apply(void 0, matchers);
1664 return combinedMatcher(action);
1665 };
1666 }
1667 function isRejected() {
1668 var asyncThunks = [];
1669 for (var _j = 0; _j < arguments.length; _j++) {
1670 asyncThunks[_j] = arguments[_j];
1671 }
1672 if (asyncThunks.length === 0) {
1673 return function (action) { return hasExpectedRequestMetadata(action, ["rejected"]); };
1674 }
1675 if (!isAsyncThunkArray(asyncThunks)) {
1676 return isRejected()(asyncThunks[0]);
1677 }
1678 return function (action) {
1679 var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.rejected; });
1680 var combinedMatcher = isAnyOf.apply(void 0, matchers);
1681 return combinedMatcher(action);
1682 };
1683 }
1684 function isRejectedWithValue() {
1685 var asyncThunks = [];
1686 for (var _j = 0; _j < arguments.length; _j++) {
1687 asyncThunks[_j] = arguments[_j];
1688 }
1689 var hasFlag = function (action) {
1690 return action && action.meta && action.meta.rejectedWithValue;
1691 };
1692 if (asyncThunks.length === 0) {
1693 return function (action) {
1694 var combinedMatcher = isAllOf(isRejected.apply(void 0, asyncThunks), hasFlag);
1695 return combinedMatcher(action);
1696 };
1697 }
1698 if (!isAsyncThunkArray(asyncThunks)) {
1699 return isRejectedWithValue()(asyncThunks[0]);
1700 }
1701 return function (action) {
1702 var combinedMatcher = isAllOf(isRejected.apply(void 0, asyncThunks), hasFlag);
1703 return combinedMatcher(action);
1704 };
1705 }
1706 function isFulfilled() {
1707 var asyncThunks = [];
1708 for (var _j = 0; _j < arguments.length; _j++) {
1709 asyncThunks[_j] = arguments[_j];
1710 }
1711 if (asyncThunks.length === 0) {
1712 return function (action) { return hasExpectedRequestMetadata(action, ["fulfilled"]); };
1713 }
1714 if (!isAsyncThunkArray(asyncThunks)) {
1715 return isFulfilled()(asyncThunks[0]);
1716 }
1717 return function (action) {
1718 var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.fulfilled; });
1719 var combinedMatcher = isAnyOf.apply(void 0, matchers);
1720 return combinedMatcher(action);
1721 };
1722 }
1723 function isAsyncThunkAction() {
1724 var asyncThunks = [];
1725 for (var _j = 0; _j < arguments.length; _j++) {
1726 asyncThunks[_j] = arguments[_j];
1727 }
1728 if (asyncThunks.length === 0) {
1729 return function (action) { return hasExpectedRequestMetadata(action, ["pending", "fulfilled", "rejected"]); };
1730 }
1731 if (!isAsyncThunkArray(asyncThunks)) {
1732 return isAsyncThunkAction()(asyncThunks[0]);
1733 }
1734 return function (action) {
1735 var matchers = [];
1736 for (var _j = 0, asyncThunks_1 = asyncThunks; _j < asyncThunks_1.length; _j++) {
1737 var asyncThunk = asyncThunks_1[_j];
1738 matchers.push(asyncThunk.pending, asyncThunk.rejected, asyncThunk.fulfilled);
1739 }
1740 var combinedMatcher = isAnyOf.apply(void 0, matchers);
1741 return combinedMatcher(action);
1742 };
1743 }
1744 // src/autoBatchEnhancer.ts
1745 var SHOULD_AUTOBATCH = "RTK_autoBatch";
1746 var prepareAutoBatched = function () { return function (payload) {
1747 var _j;
1748 return ({
1749 payload: payload,
1750 meta: (_j = {}, _j[SHOULD_AUTOBATCH] = true, _j)
1751 });
1752 }; };
1753 var promise;
1754 typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : globalThis) : function (cb) { return (promise || (promise = Promise.resolve())).then(cb).catch(function (err) { return setTimeout(function () {
1755 throw err;
1756 }, 0); }); };
1757 // src/index.ts
1758 N();
1759 // src/query/utils/copyWithStructuralSharing.ts
1760 var isPlainObject3 = isPlainObject2;
1761 function copyWithStructuralSharing(oldObj, newObj) {
1762 if (oldObj === newObj || !(isPlainObject3(oldObj) && isPlainObject3(newObj) || Array.isArray(oldObj) && Array.isArray(newObj))) {
1763 return newObj;
1764 }
1765 var newKeys = Object.keys(newObj);
1766 var oldKeys = Object.keys(oldObj);
1767 var isSameObject = newKeys.length === oldKeys.length;
1768 var mergeObj = Array.isArray(newObj) ? [] : {};
1769 for (var _j = 0, newKeys_1 = newKeys; _j < newKeys_1.length; _j++) {
1770 var key = newKeys_1[_j];
1771 mergeObj[key] = copyWithStructuralSharing(oldObj[key], newObj[key]);
1772 if (isSameObject)
1773 isSameObject = oldObj[key] === mergeObj[key];
1774 }
1775 return isSameObject ? oldObj : mergeObj;
1776 }
1777 // src/query/fetchBaseQuery.ts
1778 var defaultFetchFn = function () {
1779 var args = [];
1780 for (var _j = 0; _j < arguments.length; _j++) {
1781 args[_j] = arguments[_j];
1782 }
1783 return fetch.apply(void 0, args);
1784 };
1785 var defaultValidateStatus = function (response) { return response.status >= 200 && response.status <= 299; };
1786 var defaultIsJsonContentType = function (headers) { return /ion\/(vnd\.api\+)?json/.test(headers.get("content-type") || ""); };
1787 function stripUndefined(obj) {
1788 if (!isPlainObject2(obj)) {
1789 return obj;
1790 }
1791 var copy = __spreadValues({}, obj);
1792 for (var _j = 0, _k = Object.entries(copy); _j < _k.length; _j++) {
1793 var _l = _k[_j], k2 = _l[0], v2 = _l[1];
1794 if (v2 === void 0)
1795 delete copy[k2];
1796 }
1797 return copy;
1798 }
1799 function fetchBaseQuery(_a) {
1800 var _this = this;
1801 if (_a === void 0) { _a = {}; }
1802 var _b = _a, baseUrl = _b.baseUrl, _j = _b.prepareHeaders, prepareHeaders = _j === void 0 ? function (x2) { return x2; } : _j, _k = _b.fetchFn, fetchFn = _k === void 0 ? defaultFetchFn : _k, paramsSerializer = _b.paramsSerializer, _l = _b.isJsonContentType, isJsonContentType = _l === void 0 ? defaultIsJsonContentType : _l, _m = _b.jsonContentType, jsonContentType = _m === void 0 ? "application/json" : _m, jsonReplacer = _b.jsonReplacer, defaultTimeout = _b.timeout, globalValidateStatus = _b.validateStatus, baseFetchOptions = __objRest(_b, [
1803 "baseUrl",
1804 "prepareHeaders",
1805 "fetchFn",
1806 "paramsSerializer",
1807 "isJsonContentType",
1808 "jsonContentType",
1809 "jsonReplacer",
1810 "timeout",
1811 "validateStatus"
1812 ]);
1813 if (typeof fetch === "undefined" && fetchFn === defaultFetchFn) {
1814 console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments.");
1815 }
1816 return function (arg, api) { return __async(_this, null, function () {
1817 var signal, getState, extra, endpoint, forced, type, meta, _a2, url, _j, headers, _k, params, _l, responseHandler, _m, validateStatus, _o, timeout, rest, config, _p, isJsonifiable, divider, query, request, requestClone, response, timedOut, timeoutId, e2_1, responseClone, resultData, responseText, handleResponseError_1, e2_2;
1818 return __generator(this, function (_q) {
1819 switch (_q.label) {
1820 case 0:
1821 signal = api.signal, getState = api.getState, extra = api.extra, endpoint = api.endpoint, forced = api.forced, type = api.type;
1822 _a2 = typeof arg == "string" ? { url: arg } : arg, url = _a2.url, _j = _a2.headers, headers = _j === void 0 ? new Headers(baseFetchOptions.headers) : _j, _k = _a2.params, params = _k === void 0 ? void 0 : _k, _l = _a2.responseHandler, responseHandler = _l === void 0 ? "json" : _l, _m = _a2.validateStatus, validateStatus = _m === void 0 ? globalValidateStatus != null ? globalValidateStatus : defaultValidateStatus : _m, _o = _a2.timeout, timeout = _o === void 0 ? defaultTimeout : _o, rest = __objRest(_a2, [
1823 "url",
1824 "headers",
1825 "params",
1826 "responseHandler",
1827 "validateStatus",
1828 "timeout"
1829 ]);
1830 config = __spreadValues(__spreadProps(__spreadValues({}, baseFetchOptions), {
1831 signal: signal
1832 }), rest);
1833 headers = new Headers(stripUndefined(headers));
1834 _p = config;
1835 return [4 /*yield*/, prepareHeaders(headers, {
1836 getState: getState,
1837 extra: extra,
1838 endpoint: endpoint,
1839 forced: forced,
1840 type: type
1841 })];
1842 case 1:
1843 _p.headers = (_q.sent()) || headers;
1844 isJsonifiable = function (body) { return typeof body === "object" && (isPlainObject2(body) || Array.isArray(body) || typeof body.toJSON === "function"); };
1845 if (!config.headers.has("content-type") && isJsonifiable(config.body)) {
1846 config.headers.set("content-type", jsonContentType);
1847 }
1848 if (isJsonifiable(config.body) && isJsonContentType(config.headers)) {
1849 config.body = JSON.stringify(config.body, jsonReplacer);
1850 }
1851 if (params) {
1852 divider = ~url.indexOf("?") ? "&" : "?";
1853 query = paramsSerializer ? paramsSerializer(params) : new URLSearchParams(stripUndefined(params));
1854 url += divider + query;
1855 }
1856 url = joinUrls(baseUrl, url);
1857 request = new Request(url, config);
1858 requestClone = request.clone();
1859 meta = { request: requestClone };
1860 timedOut = false, timeoutId = timeout && setTimeout(function () {
1861 timedOut = true;
1862 api.abort();
1863 }, timeout);
1864 _q.label = 2;
1865 case 2:
1866 _q.trys.push([2, 4, 5, 6]);
1867 return [4 /*yield*/, fetchFn(request)];
1868 case 3:
1869 response = _q.sent();
1870 return [3 /*break*/, 6];
1871 case 4:
1872 e2_1 = _q.sent();
1873 return [2 /*return*/, {
1874 error: {
1875 status: timedOut ? "TIMEOUT_ERROR" : "FETCH_ERROR",
1876 error: String(e2_1)
1877 },
1878 meta: meta
1879 }];
1880 case 5:
1881 if (timeoutId)
1882 clearTimeout(timeoutId);
1883 return [7 /*endfinally*/];
1884 case 6:
1885 responseClone = response.clone();
1886 meta.response = responseClone;
1887 responseText = "";
1888 _q.label = 7;
1889 case 7:
1890 _q.trys.push([7, 9, , 10]);
1891 return [4 /*yield*/, Promise.all([
1892 handleResponse(response, responseHandler).then(function (r2) { return resultData = r2; }, function (e2) { return handleResponseError_1 = e2; }),
1893 responseClone.text().then(function (r2) { return responseText = r2; }, function () {
1894 })
1895 ])];
1896 case 8:
1897 _q.sent();
1898 if (handleResponseError_1)
1899 throw handleResponseError_1;
1900 return [3 /*break*/, 10];
1901 case 9:
1902 e2_2 = _q.sent();
1903 return [2 /*return*/, {
1904 error: {
1905 status: "PARSING_ERROR",
1906 originalStatus: response.status,
1907 data: responseText,
1908 error: String(e2_2)
1909 },
1910 meta: meta
1911 }];
1912 case 10: return [2 /*return*/, validateStatus(response, resultData) ? {
1913 data: resultData,
1914 meta: meta
1915 } : {
1916 error: {
1917 status: response.status,
1918 data: resultData
1919 },
1920 meta: meta
1921 }];
1922 }
1923 });
1924 }); };
1925 function handleResponse(response, responseHandler) {
1926 return __async(this, null, function () {
1927 var text;
1928 return __generator(this, function (_j) {
1929 switch (_j.label) {
1930 case 0:
1931 if (typeof responseHandler === "function") {
1932 return [2 /*return*/, responseHandler(response)];
1933 }
1934 if (responseHandler === "content-type") {
1935 responseHandler = isJsonContentType(response.headers) ? "json" : "text";
1936 }
1937 if (!(responseHandler === "json")) return [3 /*break*/, 2];
1938 return [4 /*yield*/, response.text()];
1939 case 1:
1940 text = _j.sent();
1941 return [2 /*return*/, text.length ? JSON.parse(text) : null];
1942 case 2: return [2 /*return*/, response.text()];
1943 }
1944 });
1945 });
1946 }
1947 }
1948 // src/query/HandledError.ts
1949 var HandledError = /** @class */ (function () {
1950 function HandledError(value, meta) {
1951 if (meta === void 0) { meta = void 0; }
1952 this.value = value;
1953 this.meta = meta;
1954 }
1955 return HandledError;
1956 }());
1957 // src/query/retry.ts
1958 function defaultBackoff(attempt, maxRetries) {
1959 if (attempt === void 0) { attempt = 0; }
1960 if (maxRetries === void 0) { maxRetries = 5; }
1961 return __async(this, null, function () {
1962 var attempts, timeout;
1963 return __generator(this, function (_j) {
1964 switch (_j.label) {
1965 case 0:
1966 attempts = Math.min(attempt, maxRetries);
1967 timeout = ~~((Math.random() + 0.4) * (300 << attempts));
1968 return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(function (res) { return resolve(res); }, timeout); })];
1969 case 1:
1970 _j.sent();
1971 return [2 /*return*/];
1972 }
1973 });
1974 });
1975 }
1976 function fail(e2) {
1977 throw Object.assign(new HandledError({ error: e2 }), {
1978 throwImmediately: true
1979 });
1980 }
1981 var EMPTY_OPTIONS = {};
1982 var retryWithBackoff = function (baseQuery, defaultOptions) { return function (args, api, extraOptions) { return __async(void 0, null, function () {
1983 var possibleMaxRetries, maxRetries, defaultRetryCondition, options, retry2, result, e2_3;
1984 return __generator(this, function (_j) {
1985 switch (_j.label) {
1986 case 0:
1987 possibleMaxRetries = [
1988 5,
1989 (defaultOptions || EMPTY_OPTIONS).maxRetries,
1990 (extraOptions || EMPTY_OPTIONS).maxRetries
1991 ].filter(function (x2) { return x2 !== void 0; });
1992 maxRetries = possibleMaxRetries.slice(-1)[0];
1993 defaultRetryCondition = function (_2, __, _j) {
1994 var attempt = _j.attempt;
1995 return attempt <= maxRetries;
1996 };
1997 options = __spreadValues(__spreadValues({
1998 maxRetries: maxRetries,
1999 backoff: defaultBackoff,
2000 retryCondition: defaultRetryCondition
2001 }, defaultOptions), extraOptions);
2002 retry2 = 0;
2003 _j.label = 1;
2004 case 1:
2005 _j.label = 2;
2006 case 2:
2007 _j.trys.push([2, 4, , 6]);
2008 return [4 /*yield*/, baseQuery(args, api, extraOptions)];
2009 case 3:
2010 result = _j.sent();
2011 if (result.error) {
2012 throw new HandledError(result);
2013 }
2014 return [2 /*return*/, result];
2015 case 4:
2016 e2_3 = _j.sent();
2017 retry2++;
2018 if (e2_3.throwImmediately) {
2019 if (e2_3 instanceof HandledError) {
2020 return [2 /*return*/, e2_3.value];
2021 }
2022 throw e2_3;
2023 }
2024 if (e2_3 instanceof HandledError && !options.retryCondition(e2_3.value.error, args, {
2025 attempt: retry2,
2026 baseQueryApi: api,
2027 extraOptions: extraOptions
2028 })) {
2029 return [2 /*return*/, e2_3.value];
2030 }
2031 return [4 /*yield*/, options.backoff(retry2, options.maxRetries)];
2032 case 5:
2033 _j.sent();
2034 return [3 /*break*/, 6];
2035 case 6: return [3 /*break*/, 1];
2036 case 7: return [2 /*return*/];
2037 }
2038 });
2039 }); }; };
2040 var retry = /* @__PURE__ */ Object.assign(retryWithBackoff, { fail: fail });
2041 // src/query/core/setupListeners.ts
2042 var onFocus = /* @__PURE__ */ createAction("__rtkq/focused");
2043 var onFocusLost = /* @__PURE__ */ createAction("__rtkq/unfocused");
2044 var onOnline = /* @__PURE__ */ createAction("__rtkq/online");
2045 var onOffline = /* @__PURE__ */ createAction("__rtkq/offline");
2046 var initialized = false;
2047 function setupListeners(dispatch, customHandler) {
2048 function defaultHandler() {
2049 var handleFocus = function () { return dispatch(onFocus()); };
2050 var handleFocusLost = function () { return dispatch(onFocusLost()); };
2051 var handleOnline = function () { return dispatch(onOnline()); };
2052 var handleOffline = function () { return dispatch(onOffline()); };
2053 var handleVisibilityChange = function () {
2054 if (window.document.visibilityState === "visible") {
2055 handleFocus();
2056 }
2057 else {
2058 handleFocusLost();
2059 }
2060 };
2061 if (!initialized) {
2062 if (typeof window !== "undefined" && window.addEventListener) {
2063 window.addEventListener("visibilitychange", handleVisibilityChange, false);
2064 window.addEventListener("focus", handleFocus, false);
2065 window.addEventListener("online", handleOnline, false);
2066 window.addEventListener("offline", handleOffline, false);
2067 initialized = true;
2068 }
2069 }
2070 var unsubscribe = function () {
2071 window.removeEventListener("focus", handleFocus);
2072 window.removeEventListener("visibilitychange", handleVisibilityChange);
2073 window.removeEventListener("online", handleOnline);
2074 window.removeEventListener("offline", handleOffline);
2075 initialized = false;
2076 };
2077 return unsubscribe;
2078 }
2079 return customHandler ? customHandler(dispatch, { onFocus: onFocus, onFocusLost: onFocusLost, onOffline: onOffline, onOnline: onOnline }) : defaultHandler();
2080 }
2081 // src/query/endpointDefinitions.ts
2082 var DefinitionType;
2083 (function (DefinitionType2) {
2084 DefinitionType2["query"] = "query";
2085 DefinitionType2["mutation"] = "mutation";
2086 })(DefinitionType || (DefinitionType = {}));
2087 function isQueryDefinition(e2) {
2088 return e2.type === DefinitionType.query;
2089 }
2090 function isMutationDefinition(e2) {
2091 return e2.type === DefinitionType.mutation;
2092 }
2093 function calculateProvidedBy(description, result, error, queryArg, meta, assertTagTypes) {
2094 if (isFunction(description)) {
2095 return description(result, error, queryArg, meta).map(expandTagDescription).map(assertTagTypes);
2096 }
2097 if (Array.isArray(description)) {
2098 return description.map(expandTagDescription).map(assertTagTypes);
2099 }
2100 return [];
2101 }
2102 function isFunction(t2) {
2103 return typeof t2 === "function";
2104 }
2105 function expandTagDescription(description) {
2106 return typeof description === "string" ? { type: description } : description;
2107 }
2108 // src/query/utils/isNotNullish.ts
2109 function isNotNullish(v2) {
2110 return v2 != null;
2111 }
2112 // src/query/core/buildInitiate.ts
2113 var forceQueryFnSymbol = Symbol("forceQueryFn");
2114 var isUpsertQuery = function (arg) { return typeof arg[forceQueryFnSymbol] === "function"; };
2115 function buildInitiate(_j) {
2116 var serializeQueryArgs = _j.serializeQueryArgs, queryThunk = _j.queryThunk, mutationThunk = _j.mutationThunk, api = _j.api, context = _j.context;
2117 var runningQueries = new Map();
2118 var runningMutations = new Map();
2119 var _k = api.internalActions, unsubscribeQueryResult = _k.unsubscribeQueryResult, removeMutationResult = _k.removeMutationResult, updateSubscriptionOptions = _k.updateSubscriptionOptions;
2120 return {
2121 buildInitiateQuery: buildInitiateQuery,
2122 buildInitiateMutation: buildInitiateMutation,
2123 getRunningQueryThunk: getRunningQueryThunk,
2124 getRunningMutationThunk: getRunningMutationThunk,
2125 getRunningQueriesThunk: getRunningQueriesThunk,
2126 getRunningMutationsThunk: getRunningMutationsThunk,
2127 getRunningOperationPromises: getRunningOperationPromises,
2128 removalWarning: removalWarning
2129 };
2130 function removalWarning() {
2131 throw new Error("This method had to be removed due to a conceptual bug in RTK.\n Please see https://github.com/reduxjs/redux-toolkit/pull/2481 for details.\n See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for new guidance on SSR.");
2132 }
2133 function getRunningOperationPromises() {
2134 if (typeof process !== "undefined" && true) {
2135 removalWarning();
2136 }
2137 else {
2138 var extract = function (v2) { return Array.from(v2.values()).flatMap(function (queriesForStore) { return queriesForStore ? Object.values(queriesForStore) : []; }); };
2139 return __spreadArray(__spreadArray([], extract(runningQueries)), extract(runningMutations)).filter(isNotNullish);
2140 }
2141 }
2142 function getRunningQueryThunk(endpointName, queryArgs) {
2143 return function (dispatch) {
2144 var _a;
2145 var endpointDefinition = context.endpointDefinitions[endpointName];
2146 var queryCacheKey = serializeQueryArgs({
2147 queryArgs: queryArgs,
2148 endpointDefinition: endpointDefinition,
2149 endpointName: endpointName
2150 });
2151 return (_a = runningQueries.get(dispatch)) == null ? void 0 : _a[queryCacheKey];
2152 };
2153 }
2154 function getRunningMutationThunk(_endpointName, fixedCacheKeyOrRequestId) {
2155 return function (dispatch) {
2156 var _a;
2157 return (_a = runningMutations.get(dispatch)) == null ? void 0 : _a[fixedCacheKeyOrRequestId];
2158 };
2159 }
2160 function getRunningQueriesThunk() {
2161 return function (dispatch) { return Object.values(runningQueries.get(dispatch) || {}).filter(isNotNullish); };
2162 }
2163 function getRunningMutationsThunk() {
2164 return function (dispatch) { return Object.values(runningMutations.get(dispatch) || {}).filter(isNotNullish); };
2165 }
2166 function middlewareWarning(dispatch) {
2167 {
2168 if (middlewareWarning.triggered)
2169 return;
2170 var registered = dispatch(api.internalActions.internal_probeSubscription({
2171 queryCacheKey: "DOES_NOT_EXIST",
2172 requestId: "DUMMY_REQUEST_ID"
2173 }));
2174 middlewareWarning.triggered = true;
2175 if (typeof registered !== "boolean") {
2176 throw new Error("Warning: Middleware for RTK-Query API at reducerPath \"" + api.reducerPath + "\" has not been added to the store.\nYou must add the middleware for RTK-Query to function correctly!");
2177 }
2178 }
2179 }
2180 function buildInitiateQuery(endpointName, endpointDefinition) {
2181 var queryAction = function (arg, _j) {
2182 var _k = _j === void 0 ? {} : _j, _l = _k.subscribe, subscribe = _l === void 0 ? true : _l, forceRefetch = _k.forceRefetch, subscriptionOptions = _k.subscriptionOptions, _m = forceQueryFnSymbol, forceQueryFn = _k[_m];
2183 return function (dispatch, getState) {
2184 var _j;
2185 var _a;
2186 var queryCacheKey = serializeQueryArgs({
2187 queryArgs: arg,
2188 endpointDefinition: endpointDefinition,
2189 endpointName: endpointName
2190 });
2191 var thunk = queryThunk((_j = {
2192 type: "query",
2193 subscribe: subscribe,
2194 forceRefetch: forceRefetch,
2195 subscriptionOptions: subscriptionOptions,
2196 endpointName: endpointName,
2197 originalArgs: arg,
2198 queryCacheKey: queryCacheKey
2199 },
2200 _j[forceQueryFnSymbol] = forceQueryFn,
2201 _j));
2202 var selector = api.endpoints[endpointName].select(arg);
2203 var thunkResult = dispatch(thunk);
2204 var stateAfter = selector(getState());
2205 middlewareWarning(dispatch);
2206 var requestId = thunkResult.requestId, abort = thunkResult.abort;
2207 var skippedSynchronously = stateAfter.requestId !== requestId;
2208 var runningQuery = (_a = runningQueries.get(dispatch)) == null ? void 0 : _a[queryCacheKey];
2209 var selectFromState = function () { return selector(getState()); };
2210 var statePromise = Object.assign(forceQueryFn ? thunkResult.then(selectFromState) : skippedSynchronously && !runningQuery ? Promise.resolve(stateAfter) : Promise.all([runningQuery, thunkResult]).then(selectFromState), {
2211 arg: arg,
2212 requestId: requestId,
2213 subscriptionOptions: subscriptionOptions,
2214 queryCacheKey: queryCacheKey,
2215 abort: abort,
2216 unwrap: function () {
2217 return __async(this, null, function () {
2218 var result;
2219 return __generator(this, function (_j) {
2220 switch (_j.label) {
2221 case 0: return [4 /*yield*/, statePromise];
2222 case 1:
2223 result = _j.sent();
2224 if (result.isError) {
2225 throw result.error;
2226 }
2227 return [2 /*return*/, result.data];
2228 }
2229 });
2230 });
2231 },
2232 refetch: function () { return dispatch(queryAction(arg, { subscribe: false, forceRefetch: true })); },
2233 unsubscribe: function () {
2234 if (subscribe)
2235 dispatch(unsubscribeQueryResult({
2236 queryCacheKey: queryCacheKey,
2237 requestId: requestId
2238 }));
2239 },
2240 updateSubscriptionOptions: function (options) {
2241 statePromise.subscriptionOptions = options;
2242 dispatch(updateSubscriptionOptions({
2243 endpointName: endpointName,
2244 requestId: requestId,
2245 queryCacheKey: queryCacheKey,
2246 options: options
2247 }));
2248 }
2249 });
2250 if (!runningQuery && !skippedSynchronously && !forceQueryFn) {
2251 var running_1 = runningQueries.get(dispatch) || {};
2252 running_1[queryCacheKey] = statePromise;
2253 runningQueries.set(dispatch, running_1);
2254 statePromise.then(function () {
2255 delete running_1[queryCacheKey];
2256 if (!Object.keys(running_1).length) {
2257 runningQueries.delete(dispatch);
2258 }
2259 });
2260 }
2261 return statePromise;
2262 };
2263 };
2264 return queryAction;
2265 }
2266 function buildInitiateMutation(endpointName) {
2267 return function (arg, _j) {
2268 var _k = _j === void 0 ? {} : _j, _l = _k.track, track = _l === void 0 ? true : _l, fixedCacheKey = _k.fixedCacheKey;
2269 return function (dispatch, getState) {
2270 var thunk = mutationThunk({
2271 type: "mutation",
2272 endpointName: endpointName,
2273 originalArgs: arg,
2274 track: track,
2275 fixedCacheKey: fixedCacheKey
2276 });
2277 var thunkResult = dispatch(thunk);
2278 middlewareWarning(dispatch);
2279 var requestId = thunkResult.requestId, abort = thunkResult.abort, unwrap = thunkResult.unwrap;
2280 var returnValuePromise = thunkResult.unwrap().then(function (data) { return ({ data: data }); }).catch(function (error) { return ({ error: error }); });
2281 var reset = function () {
2282 dispatch(removeMutationResult({ requestId: requestId, fixedCacheKey: fixedCacheKey }));
2283 };
2284 var ret = Object.assign(returnValuePromise, {
2285 arg: thunkResult.arg,
2286 requestId: requestId,
2287 abort: abort,
2288 unwrap: unwrap,
2289 unsubscribe: reset,
2290 reset: reset
2291 });
2292 var running = runningMutations.get(dispatch) || {};
2293 runningMutations.set(dispatch, running);
2294 running[requestId] = ret;
2295 ret.then(function () {
2296 delete running[requestId];
2297 if (!Object.keys(running).length) {
2298 runningMutations.delete(dispatch);
2299 }
2300 });
2301 if (fixedCacheKey) {
2302 running[fixedCacheKey] = ret;
2303 ret.then(function () {
2304 if (running[fixedCacheKey] === ret) {
2305 delete running[fixedCacheKey];
2306 if (!Object.keys(running).length) {
2307 runningMutations.delete(dispatch);
2308 }
2309 }
2310 });
2311 }
2312 return ret;
2313 };
2314 };
2315 }
2316 }
2317 // src/query/core/buildThunks.ts
2318 function defaultTransformResponse(baseQueryReturnValue) {
2319 return baseQueryReturnValue;
2320 }
2321 function buildThunks(_j) {
2322 var _this = this;
2323 var reducerPath = _j.reducerPath, baseQuery = _j.baseQuery, endpointDefinitions = _j.context.endpointDefinitions, serializeQueryArgs = _j.serializeQueryArgs, api = _j.api;
2324 var patchQueryData = function (endpointName, args, patches) { return function (dispatch) {
2325 var endpointDefinition = endpointDefinitions[endpointName];
2326 dispatch(api.internalActions.queryResultPatched({
2327 queryCacheKey: serializeQueryArgs({
2328 queryArgs: args,
2329 endpointDefinition: endpointDefinition,
2330 endpointName: endpointName
2331 }),
2332 patches: patches
2333 }));
2334 }; };
2335 var updateQueryData = function (endpointName, args, updateRecipe) { return function (dispatch, getState) {
2336 var _j, _k;
2337 var currentState = api.endpoints[endpointName].select(args)(getState());
2338 var ret = {
2339 patches: [],
2340 inversePatches: [],
2341 undo: function () { return dispatch(api.util.patchQueryData(endpointName, args, ret.inversePatches)); }
2342 };
2343 if (currentState.status === exports.QueryStatus.uninitialized) {
2344 return ret;
2345 }
2346 if ("data" in currentState) {
2347 if (t(currentState.data)) {
2348 var _l = cn(currentState.data, updateRecipe), patches = _l[1], inversePatches = _l[2];
2349 (_j = ret.patches).push.apply(_j, patches);
2350 (_k = ret.inversePatches).push.apply(_k, inversePatches);
2351 }
2352 else {
2353 var value = updateRecipe(currentState.data);
2354 ret.patches.push({ op: "replace", path: [], value: value });
2355 ret.inversePatches.push({
2356 op: "replace",
2357 path: [],
2358 value: currentState.data
2359 });
2360 }
2361 }
2362 dispatch(api.util.patchQueryData(endpointName, args, ret.patches));
2363 return ret;
2364 }; };
2365 var upsertQueryData = function (endpointName, args, value) { return function (dispatch) {
2366 var _j;
2367 return dispatch(api.endpoints[endpointName].initiate(args, (_j = {
2368 subscribe: false,
2369 forceRefetch: true
2370 },
2371 _j[forceQueryFnSymbol] = function () { return ({
2372 data: value
2373 }); },
2374 _j)));
2375 }; };
2376 var executeEndpoint = function (_0, _1) { return __async(_this, [_0, _1], function (arg, _j) {
2377 var endpointDefinition, transformResponse, result, baseQueryApi_1, forceQueryFn, what, err, _k, _l, key, _m, error_1, catchedError, transformErrorResponse, _o, e2_4;
2378 var _p, _q;
2379 var signal = _j.signal, abort = _j.abort, rejectWithValue = _j.rejectWithValue, fulfillWithValue = _j.fulfillWithValue, dispatch = _j.dispatch, getState = _j.getState, extra = _j.extra;
2380 return __generator(this, function (_r) {
2381 switch (_r.label) {
2382 case 0:
2383 endpointDefinition = endpointDefinitions[arg.endpointName];
2384 _r.label = 1;
2385 case 1:
2386 _r.trys.push([1, 8, , 13]);
2387 transformResponse = defaultTransformResponse;
2388 result = void 0;
2389 baseQueryApi_1 = {
2390 signal: signal,
2391 abort: abort,
2392 dispatch: dispatch,
2393 getState: getState,
2394 extra: extra,
2395 endpoint: arg.endpointName,
2396 type: arg.type,
2397 forced: arg.type === "query" ? isForcedQuery(arg, getState()) : void 0
2398 };
2399 forceQueryFn = arg.type === "query" ? arg[forceQueryFnSymbol] : void 0;
2400 if (!forceQueryFn) return [3 /*break*/, 2];
2401 result = forceQueryFn();
2402 return [3 /*break*/, 6];
2403 case 2:
2404 if (!endpointDefinition.query) return [3 /*break*/, 4];
2405 return [4 /*yield*/, baseQuery(endpointDefinition.query(arg.originalArgs), baseQueryApi_1, endpointDefinition.extraOptions)];
2406 case 3:
2407 result = _r.sent();
2408 if (endpointDefinition.transformResponse) {
2409 transformResponse = endpointDefinition.transformResponse;
2410 }
2411 return [3 /*break*/, 6];
2412 case 4: return [4 /*yield*/, endpointDefinition.queryFn(arg.originalArgs, baseQueryApi_1, endpointDefinition.extraOptions, function (arg2) { return baseQuery(arg2, baseQueryApi_1, endpointDefinition.extraOptions); })];
2413 case 5:
2414 result = _r.sent();
2415 _r.label = 6;
2416 case 6:
2417 if (typeof process !== "undefined" && true) {
2418 what = endpointDefinition.query ? "`baseQuery`" : "`queryFn`";
2419 err = void 0;
2420 if (!result) {
2421 err = what + " did not return anything.";
2422 }
2423 else if (typeof result !== "object") {
2424 err = what + " did not return an object.";
2425 }
2426 else if (result.error && result.data) {
2427 err = what + " returned an object containing both `error` and `result`.";
2428 }
2429 else if (result.error === void 0 && result.data === void 0) {
2430 err = what + " returned an object containing neither a valid `error` and `result`. At least one of them should not be `undefined`";
2431 }
2432 else {
2433 for (_k = 0, _l = Object.keys(result); _k < _l.length; _k++) {
2434 key = _l[_k];
2435 if (key !== "error" && key !== "data" && key !== "meta") {
2436 err = "The object returned by " + what + " has the unknown property " + key + ".";
2437 break;
2438 }
2439 }
2440 }
2441 if (err) {
2442 console.error("Error encountered handling the endpoint " + arg.endpointName + ".\n " + err + "\n It needs to return an object with either the shape `{ data: <value> }` or `{ error: <value> }` that may contain an optional `meta` property.\n Object returned was:", result);
2443 }
2444 }
2445 if (result.error)
2446 throw new HandledError(result.error, result.meta);
2447 _m = fulfillWithValue;
2448 return [4 /*yield*/, transformResponse(result.data, result.meta, arg.originalArgs)];
2449 case 7: return [2 /*return*/, _m.apply(void 0, [_r.sent(), (_p = {
2450 fulfilledTimeStamp: Date.now(),
2451 baseQueryMeta: result.meta
2452 },
2453 _p[SHOULD_AUTOBATCH] = true,
2454 _p)])];
2455 case 8:
2456 error_1 = _r.sent();
2457 catchedError = error_1;
2458 if (!(catchedError instanceof HandledError)) return [3 /*break*/, 12];
2459 transformErrorResponse = defaultTransformResponse;
2460 if (endpointDefinition.query && endpointDefinition.transformErrorResponse) {
2461 transformErrorResponse = endpointDefinition.transformErrorResponse;
2462 }
2463 _r.label = 9;
2464 case 9:
2465 _r.trys.push([9, 11, , 12]);
2466 _o = rejectWithValue;
2467 return [4 /*yield*/, transformErrorResponse(catchedError.value, catchedError.meta, arg.originalArgs)];
2468 case 10: return [2 /*return*/, _o.apply(void 0, [_r.sent(), (_q = { baseQueryMeta: catchedError.meta }, _q[SHOULD_AUTOBATCH] = true, _q)])];
2469 case 11:
2470 e2_4 = _r.sent();
2471 catchedError = e2_4;
2472 return [3 /*break*/, 12];
2473 case 12:
2474 if (typeof process !== "undefined" && true) {
2475 console.error("An unhandled error occurred processing a request for the endpoint \"" + arg.endpointName + "\".\nIn the case of an unhandled error, no tags will be \"provided\" or \"invalidated\".", catchedError);
2476 }
2477 else {
2478 console.error(catchedError);
2479 }
2480 throw catchedError;
2481 case 13: return [2 /*return*/];
2482 }
2483 });
2484 }); };
2485 function isForcedQuery(arg, state) {
2486 var _a, _b, _c, _d;
2487 var requestState = (_b = (_a = state[reducerPath]) == null ? void 0 : _a.queries) == null ? void 0 : _b[arg.queryCacheKey];
2488 var baseFetchOnMountOrArgChange = (_c = state[reducerPath]) == null ? void 0 : _c.config.refetchOnMountOrArgChange;
2489 var fulfilledVal = requestState == null ? void 0 : requestState.fulfilledTimeStamp;
2490 var refetchVal = (_d = arg.forceRefetch) != null ? _d : arg.subscribe && baseFetchOnMountOrArgChange;
2491 if (refetchVal) {
2492 return refetchVal === true || (Number(new Date()) - Number(fulfilledVal)) / 1e3 >= refetchVal;
2493 }
2494 return false;
2495 }
2496 var queryThunk = createAsyncThunk(reducerPath + "/executeQuery", executeEndpoint, {
2497 getPendingMeta: function () {
2498 var _j;
2499 return _j = { startedTimeStamp: Date.now() }, _j[SHOULD_AUTOBATCH] = true, _j;
2500 },
2501 condition: function (queryThunkArgs, _j) {
2502 var getState = _j.getState;
2503 var _a, _b, _c;
2504 var state = getState();
2505 var requestState = (_b = (_a = state[reducerPath]) == null ? void 0 : _a.queries) == null ? void 0 : _b[queryThunkArgs.queryCacheKey];
2506 var fulfilledVal = requestState == null ? void 0 : requestState.fulfilledTimeStamp;
2507 var currentArg = queryThunkArgs.originalArgs;
2508 var previousArg = requestState == null ? void 0 : requestState.originalArgs;
2509 var endpointDefinition = endpointDefinitions[queryThunkArgs.endpointName];
2510 if (isUpsertQuery(queryThunkArgs)) {
2511 return true;
2512 }
2513 if ((requestState == null ? void 0 : requestState.status) === "pending") {
2514 return false;
2515 }
2516 if (isForcedQuery(queryThunkArgs, state)) {
2517 return true;
2518 }
2519 if (isQueryDefinition(endpointDefinition) && ((_c = endpointDefinition == null ? void 0 : endpointDefinition.forceRefetch) == null ? void 0 : _c.call(endpointDefinition, {
2520 currentArg: currentArg,
2521 previousArg: previousArg,
2522 endpointState: requestState,
2523 state: state
2524 }))) {
2525 return true;
2526 }
2527 if (fulfilledVal) {
2528 return false;
2529 }
2530 return true;
2531 },
2532 dispatchConditionRejection: true
2533 });
2534 var mutationThunk = createAsyncThunk(reducerPath + "/executeMutation", executeEndpoint, {
2535 getPendingMeta: function () {
2536 var _j;
2537 return _j = { startedTimeStamp: Date.now() }, _j[SHOULD_AUTOBATCH] = true, _j;
2538 }
2539 });
2540 var hasTheForce = function (options) { return "force" in options; };
2541 var hasMaxAge = function (options) { return "ifOlderThan" in options; };
2542 var prefetch = function (endpointName, arg, options) { return function (dispatch, getState) {
2543 var force = hasTheForce(options) && options.force;
2544 var maxAge = hasMaxAge(options) && options.ifOlderThan;
2545 var queryAction = function (force2) {
2546 if (force2 === void 0) { force2 = true; }
2547 return api.endpoints[endpointName].initiate(arg, { forceRefetch: force2 });
2548 };
2549 var latestStateValue = api.endpoints[endpointName].select(arg)(getState());
2550 if (force) {
2551 dispatch(queryAction());
2552 }
2553 else if (maxAge) {
2554 var lastFulfilledTs = latestStateValue == null ? void 0 : latestStateValue.fulfilledTimeStamp;
2555 if (!lastFulfilledTs) {
2556 dispatch(queryAction());
2557 return;
2558 }
2559 var shouldRetrigger = (Number(new Date()) - Number(new Date(lastFulfilledTs))) / 1e3 >= maxAge;
2560 if (shouldRetrigger) {
2561 dispatch(queryAction());
2562 }
2563 }
2564 else {
2565 dispatch(queryAction(false));
2566 }
2567 }; };
2568 function matchesEndpoint(endpointName) {
2569 return function (action) {
2570 var _a, _b;
2571 return ((_b = (_a = action == null ? void 0 : action.meta) == null ? void 0 : _a.arg) == null ? void 0 : _b.endpointName) === endpointName;
2572 };
2573 }
2574 function buildMatchThunkActions(thunk, endpointName) {
2575 return {
2576 matchPending: isAllOf(isPending(thunk), matchesEndpoint(endpointName)),
2577 matchFulfilled: isAllOf(isFulfilled(thunk), matchesEndpoint(endpointName)),
2578 matchRejected: isAllOf(isRejected(thunk), matchesEndpoint(endpointName))
2579 };
2580 }
2581 return {
2582 queryThunk: queryThunk,
2583 mutationThunk: mutationThunk,
2584 prefetch: prefetch,
2585 updateQueryData: updateQueryData,
2586 upsertQueryData: upsertQueryData,
2587 patchQueryData: patchQueryData,
2588 buildMatchThunkActions: buildMatchThunkActions
2589 };
2590 }
2591 function calculateProvidedByThunk(action, type, endpointDefinitions, assertTagType) {
2592 return calculateProvidedBy(endpointDefinitions[action.meta.arg.endpointName][type], isFulfilled(action) ? action.payload : void 0, isRejectedWithValue(action) ? action.payload : void 0, action.meta.arg.originalArgs, "baseQueryMeta" in action.meta ? action.meta.baseQueryMeta : void 0, assertTagType);
2593 }
2594 // src/query/core/buildSlice.ts
2595 function updateQuerySubstateIfExists(state, queryCacheKey, update) {
2596 var substate = state[queryCacheKey];
2597 if (substate) {
2598 update(substate);
2599 }
2600 }
2601 function getMutationCacheKey(id) {
2602 var _a;
2603 return (_a = "arg" in id ? id.arg.fixedCacheKey : id.fixedCacheKey) != null ? _a : id.requestId;
2604 }
2605 function updateMutationSubstateIfExists(state, id, update) {
2606 var substate = state[getMutationCacheKey(id)];
2607 if (substate) {
2608 update(substate);
2609 }
2610 }
2611 var initialState = {};
2612 function buildSlice(_j) {
2613 var reducerPath = _j.reducerPath, queryThunk = _j.queryThunk, mutationThunk = _j.mutationThunk, _k = _j.context, definitions = _k.endpointDefinitions, apiUid = _k.apiUid, extractRehydrationInfo = _k.extractRehydrationInfo, hasRehydrationInfo = _k.hasRehydrationInfo, assertTagType = _j.assertTagType, config = _j.config;
2614 var resetApiState = createAction(reducerPath + "/resetApiState");
2615 var querySlice = createSlice({
2616 name: reducerPath + "/queries",
2617 initialState: initialState,
2618 reducers: {
2619 removeQueryResult: {
2620 reducer: function (draft, _j) {
2621 var queryCacheKey = _j.payload.queryCacheKey;
2622 delete draft[queryCacheKey];
2623 },
2624 prepare: prepareAutoBatched()
2625 },
2626 queryResultPatched: function (draft, _j) {
2627 var _k = _j.payload, queryCacheKey = _k.queryCacheKey, patches = _k.patches;
2628 updateQuerySubstateIfExists(draft, queryCacheKey, function (substate) {
2629 substate.data = pn(substate.data, patches.concat());
2630 });
2631 }
2632 },
2633 extraReducers: function (builder) {
2634 builder.addCase(queryThunk.pending, function (draft, _j) {
2635 var meta = _j.meta, arg = _j.meta.arg;
2636 var _a, _b;
2637 var upserting = isUpsertQuery(arg);
2638 if (arg.subscribe || upserting) {
2639 (_b = draft[_a = arg.queryCacheKey]) != null ? _b : draft[_a] = {
2640 status: exports.QueryStatus.uninitialized,
2641 endpointName: arg.endpointName
2642 };
2643 }
2644 updateQuerySubstateIfExists(draft, arg.queryCacheKey, function (substate) {
2645 substate.status = exports.QueryStatus.pending;
2646 substate.requestId = upserting && substate.requestId ? substate.requestId : meta.requestId;
2647 if (arg.originalArgs !== void 0) {
2648 substate.originalArgs = arg.originalArgs;
2649 }
2650 substate.startedTimeStamp = meta.startedTimeStamp;
2651 });
2652 }).addCase(queryThunk.fulfilled, function (draft, _j) {
2653 var meta = _j.meta, payload = _j.payload;
2654 updateQuerySubstateIfExists(draft, meta.arg.queryCacheKey, function (substate) {
2655 var _a;
2656 if (substate.requestId !== meta.requestId && !isUpsertQuery(meta.arg))
2657 return;
2658 var merge = definitions[meta.arg.endpointName].merge;
2659 substate.status = exports.QueryStatus.fulfilled;
2660 if (merge) {
2661 if (substate.data !== void 0) {
2662 var fulfilledTimeStamp_1 = meta.fulfilledTimeStamp, arg_1 = meta.arg, baseQueryMeta_1 = meta.baseQueryMeta, requestId_1 = meta.requestId;
2663 var newData = immer_esm_default(substate.data, function (draftSubstateData) {
2664 return merge(draftSubstateData, payload, {
2665 arg: arg_1.originalArgs,
2666 baseQueryMeta: baseQueryMeta_1,
2667 fulfilledTimeStamp: fulfilledTimeStamp_1,
2668 requestId: requestId_1
2669 });
2670 });
2671 substate.data = newData;
2672 }
2673 else {
2674 substate.data = payload;
2675 }
2676 }
2677 else {
2678 substate.data = ((_a = definitions[meta.arg.endpointName].structuralSharing) != null ? _a : true) ? copyWithStructuralSharing(substate.data, payload) : payload;
2679 }
2680 delete substate.error;
2681 substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;
2682 });
2683 }).addCase(queryThunk.rejected, function (draft, _j) {
2684 var _k = _j.meta, condition = _k.condition, arg = _k.arg, requestId = _k.requestId, error = _j.error, payload = _j.payload;
2685 updateQuerySubstateIfExists(draft, arg.queryCacheKey, function (substate) {
2686 if (condition) ;
2687 else {
2688 if (substate.requestId !== requestId)
2689 return;
2690 substate.status = exports.QueryStatus.rejected;
2691 substate.error = payload != null ? payload : error;
2692 }
2693 });
2694 }).addMatcher(hasRehydrationInfo, function (draft, action) {
2695 var queries = extractRehydrationInfo(action).queries;
2696 for (var _j = 0, _k = Object.entries(queries); _j < _k.length; _j++) {
2697 var _l = _k[_j], key = _l[0], entry = _l[1];
2698 if ((entry == null ? void 0 : entry.status) === exports.QueryStatus.fulfilled || (entry == null ? void 0 : entry.status) === exports.QueryStatus.rejected) {
2699 draft[key] = entry;
2700 }
2701 }
2702 });
2703 }
2704 });
2705 var mutationSlice = createSlice({
2706 name: reducerPath + "/mutations",
2707 initialState: initialState,
2708 reducers: {
2709 removeMutationResult: {
2710 reducer: function (draft, _j) {
2711 var payload = _j.payload;
2712 var cacheKey = getMutationCacheKey(payload);
2713 if (cacheKey in draft) {
2714 delete draft[cacheKey];
2715 }
2716 },
2717 prepare: prepareAutoBatched()
2718 }
2719 },
2720 extraReducers: function (builder) {
2721 builder.addCase(mutationThunk.pending, function (draft, _j) {
2722 var meta = _j.meta, _k = _j.meta, requestId = _k.requestId, arg = _k.arg, startedTimeStamp = _k.startedTimeStamp;
2723 if (!arg.track)
2724 return;
2725 draft[getMutationCacheKey(meta)] = {
2726 requestId: requestId,
2727 status: exports.QueryStatus.pending,
2728 endpointName: arg.endpointName,
2729 startedTimeStamp: startedTimeStamp
2730 };
2731 }).addCase(mutationThunk.fulfilled, function (draft, _j) {
2732 var payload = _j.payload, meta = _j.meta;
2733 if (!meta.arg.track)
2734 return;
2735 updateMutationSubstateIfExists(draft, meta, function (substate) {
2736 if (substate.requestId !== meta.requestId)
2737 return;
2738 substate.status = exports.QueryStatus.fulfilled;
2739 substate.data = payload;
2740 substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;
2741 });
2742 }).addCase(mutationThunk.rejected, function (draft, _j) {
2743 var payload = _j.payload, error = _j.error, meta = _j.meta;
2744 if (!meta.arg.track)
2745 return;
2746 updateMutationSubstateIfExists(draft, meta, function (substate) {
2747 if (substate.requestId !== meta.requestId)
2748 return;
2749 substate.status = exports.QueryStatus.rejected;
2750 substate.error = payload != null ? payload : error;
2751 });
2752 }).addMatcher(hasRehydrationInfo, function (draft, action) {
2753 var mutations = extractRehydrationInfo(action).mutations;
2754 for (var _j = 0, _k = Object.entries(mutations); _j < _k.length; _j++) {
2755 var _l = _k[_j], key = _l[0], entry = _l[1];
2756 if (((entry == null ? void 0 : entry.status) === exports.QueryStatus.fulfilled || (entry == null ? void 0 : entry.status) === exports.QueryStatus.rejected) && key !== (entry == null ? void 0 : entry.requestId)) {
2757 draft[key] = entry;
2758 }
2759 }
2760 });
2761 }
2762 });
2763 var invalidationSlice = createSlice({
2764 name: reducerPath + "/invalidation",
2765 initialState: initialState,
2766 reducers: {},
2767 extraReducers: function (builder) {
2768 builder.addCase(querySlice.actions.removeQueryResult, function (draft, _j) {
2769 var queryCacheKey = _j.payload.queryCacheKey;
2770 for (var _k = 0, _l = Object.values(draft); _k < _l.length; _k++) {
2771 var tagTypeSubscriptions = _l[_k];
2772 for (var _m = 0, _o = Object.values(tagTypeSubscriptions); _m < _o.length; _m++) {
2773 var idSubscriptions = _o[_m];
2774 var foundAt = idSubscriptions.indexOf(queryCacheKey);
2775 if (foundAt !== -1) {
2776 idSubscriptions.splice(foundAt, 1);
2777 }
2778 }
2779 }
2780 }).addMatcher(hasRehydrationInfo, function (draft, action) {
2781 var _a, _b, _c, _d;
2782 var provided = extractRehydrationInfo(action).provided;
2783 for (var _j = 0, _k = Object.entries(provided); _j < _k.length; _j++) {
2784 var _l = _k[_j], type = _l[0], incomingTags = _l[1];
2785 for (var _m = 0, _o = Object.entries(incomingTags); _m < _o.length; _m++) {
2786 var _p = _o[_m], id = _p[0], cacheKeys = _p[1];
2787 var subscribedQueries = (_d = (_b = (_a = draft[type]) != null ? _a : draft[type] = {})[_c = id || "__internal_without_id"]) != null ? _d : _b[_c] = [];
2788 for (var _q = 0, cacheKeys_1 = cacheKeys; _q < cacheKeys_1.length; _q++) {
2789 var queryCacheKey = cacheKeys_1[_q];
2790 var alreadySubscribed = subscribedQueries.includes(queryCacheKey);
2791 if (!alreadySubscribed) {
2792 subscribedQueries.push(queryCacheKey);
2793 }
2794 }
2795 }
2796 }
2797 }).addMatcher(isAnyOf(isFulfilled(queryThunk), isRejectedWithValue(queryThunk)), function (draft, action) {
2798 var _a, _b, _c, _d;
2799 var providedTags = calculateProvidedByThunk(action, "providesTags", definitions, assertTagType);
2800 var queryCacheKey = action.meta.arg.queryCacheKey;
2801 for (var _j = 0, _k = Object.values(draft); _j < _k.length; _j++) {
2802 var tagTypeSubscriptions = _k[_j];
2803 for (var _l = 0, _m = Object.values(tagTypeSubscriptions); _l < _m.length; _l++) {
2804 var idSubscriptions = _m[_l];
2805 var foundAt = idSubscriptions.indexOf(queryCacheKey);
2806 if (foundAt !== -1) {
2807 idSubscriptions.splice(foundAt, 1);
2808 }
2809 }
2810 }
2811 for (var _o = 0, providedTags_1 = providedTags; _o < providedTags_1.length; _o++) {
2812 var _p = providedTags_1[_o], type = _p.type, id = _p.id;
2813 var subscribedQueries = (_d = (_b = (_a = draft[type]) != null ? _a : draft[type] = {})[_c = id || "__internal_without_id"]) != null ? _d : _b[_c] = [];
2814 var alreadySubscribed = subscribedQueries.includes(queryCacheKey);
2815 if (!alreadySubscribed) {
2816 subscribedQueries.push(queryCacheKey);
2817 }
2818 }
2819 });
2820 }
2821 });
2822 var subscriptionSlice = createSlice({
2823 name: reducerPath + "/subscriptions",
2824 initialState: initialState,
2825 reducers: {
2826 updateSubscriptionOptions: function (d2, a2) {
2827 },
2828 unsubscribeQueryResult: function (d2, a2) {
2829 },
2830 internal_probeSubscription: function (d2, a2) {
2831 }
2832 }
2833 });
2834 var internalSubscriptionsSlice = createSlice({
2835 name: reducerPath + "/internalSubscriptions",
2836 initialState: initialState,
2837 reducers: {
2838 subscriptionsUpdated: function (state, action) {
2839 return pn(state, action.payload);
2840 }
2841 }
2842 });
2843 var configSlice = createSlice({
2844 name: reducerPath + "/config",
2845 initialState: __spreadValues({
2846 online: isOnline(),
2847 focused: isDocumentVisible(),
2848 middlewareRegistered: false
2849 }, config),
2850 reducers: {
2851 middlewareRegistered: function (state, _j) {
2852 var payload = _j.payload;
2853 state.middlewareRegistered = state.middlewareRegistered === "conflict" || apiUid !== payload ? "conflict" : true;
2854 }
2855 },
2856 extraReducers: function (builder) {
2857 builder.addCase(onOnline, function (state) {
2858 state.online = true;
2859 }).addCase(onOffline, function (state) {
2860 state.online = false;
2861 }).addCase(onFocus, function (state) {
2862 state.focused = true;
2863 }).addCase(onFocusLost, function (state) {
2864 state.focused = false;
2865 }).addMatcher(hasRehydrationInfo, function (draft) { return __spreadValues({}, draft); });
2866 }
2867 });
2868 var combinedReducer = combineReducers({
2869 queries: querySlice.reducer,
2870 mutations: mutationSlice.reducer,
2871 provided: invalidationSlice.reducer,
2872 subscriptions: internalSubscriptionsSlice.reducer,
2873 config: configSlice.reducer
2874 });
2875 var reducer = function (state, action) { return combinedReducer(resetApiState.match(action) ? void 0 : state, action); };
2876 var actions = __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, configSlice.actions), querySlice.actions), subscriptionSlice.actions), internalSubscriptionsSlice.actions), mutationSlice.actions), {
2877 unsubscribeMutationResult: mutationSlice.actions.removeMutationResult,
2878 resetApiState: resetApiState
2879 });
2880 return { reducer: reducer, actions: actions };
2881 }
2882 // src/query/core/buildSelectors.ts
2883 var skipToken = /* @__PURE__ */ Symbol.for("RTKQ/skipToken");
2884 var skipSelector = skipToken;
2885 var initialSubState = {
2886 status: exports.QueryStatus.uninitialized
2887 };
2888 var defaultQuerySubState = /* @__PURE__ */ immer_esm_default(initialSubState, function () {
2889 });
2890 var defaultMutationSubState = /* @__PURE__ */ immer_esm_default(initialSubState, function () {
2891 });
2892 function buildSelectors(_j) {
2893 var serializeQueryArgs = _j.serializeQueryArgs, reducerPath = _j.reducerPath;
2894 var selectSkippedQuery = function (state) { return defaultQuerySubState; };
2895 var selectSkippedMutation = function (state) { return defaultMutationSubState; };
2896 return { buildQuerySelector: buildQuerySelector, buildMutationSelector: buildMutationSelector, selectInvalidatedBy: selectInvalidatedBy };
2897 function withRequestFlags(substate) {
2898 return __spreadValues(__spreadValues({}, substate), getRequestStatusFlags(substate.status));
2899 }
2900 function selectInternalState(rootState) {
2901 var state = rootState[reducerPath];
2902 {
2903 if (!state) {
2904 if (selectInternalState.triggered)
2905 return state;
2906 selectInternalState.triggered = true;
2907 console.error("Error: No data found at `state." + reducerPath + "`. Did you forget to add the reducer to the store?");
2908 }
2909 }
2910 return state;
2911 }
2912 function buildQuerySelector(endpointName, endpointDefinition) {
2913 return function (queryArgs) {
2914 var serializedArgs = serializeQueryArgs({
2915 queryArgs: queryArgs,
2916 endpointDefinition: endpointDefinition,
2917 endpointName: endpointName
2918 });
2919 var selectQuerySubstate = function (state) {
2920 var _a, _b, _c;
2921 return (_c = (_b = (_a = selectInternalState(state)) == null ? void 0 : _a.queries) == null ? void 0 : _b[serializedArgs]) != null ? _c : defaultQuerySubState;
2922 };
2923 var finalSelectQuerySubState = queryArgs === skipToken ? selectSkippedQuery : selectQuerySubstate;
2924 return createSelector(finalSelectQuerySubState, withRequestFlags);
2925 };
2926 }
2927 function buildMutationSelector() {
2928 return function (id) {
2929 var _a;
2930 var mutationId;
2931 if (typeof id === "object") {
2932 mutationId = (_a = getMutationCacheKey(id)) != null ? _a : skipToken;
2933 }
2934 else {
2935 mutationId = id;
2936 }
2937 var selectMutationSubstate = function (state) {
2938 var _a2, _b, _c;
2939 return (_c = (_b = (_a2 = selectInternalState(state)) == null ? void 0 : _a2.mutations) == null ? void 0 : _b[mutationId]) != null ? _c : defaultMutationSubState;
2940 };
2941 var finalSelectMutationSubstate = mutationId === skipToken ? selectSkippedMutation : selectMutationSubstate;
2942 return createSelector(finalSelectMutationSubstate, withRequestFlags);
2943 };
2944 }
2945 function selectInvalidatedBy(state, tags) {
2946 var _a;
2947 var apiState = state[reducerPath];
2948 var toInvalidate = new Set();
2949 for (var _j = 0, _k = tags.map(expandTagDescription); _j < _k.length; _j++) {
2950 var tag = _k[_j];
2951 var provided = apiState.provided[tag.type];
2952 if (!provided) {
2953 continue;
2954 }
2955 var invalidateSubscriptions = (_a = tag.id !== void 0 ? provided[tag.id] : flatten(Object.values(provided))) != null ? _a : [];
2956 for (var _l = 0, invalidateSubscriptions_1 = invalidateSubscriptions; _l < invalidateSubscriptions_1.length; _l++) {
2957 var invalidate = invalidateSubscriptions_1[_l];
2958 toInvalidate.add(invalidate);
2959 }
2960 }
2961 return flatten(Array.from(toInvalidate.values()).map(function (queryCacheKey) {
2962 var querySubState = apiState.queries[queryCacheKey];
2963 return querySubState ? [
2964 {
2965 queryCacheKey: queryCacheKey,
2966 endpointName: querySubState.endpointName,
2967 originalArgs: querySubState.originalArgs
2968 }
2969 ] : [];
2970 }));
2971 }
2972 }
2973 // src/query/defaultSerializeQueryArgs.ts
2974 var defaultSerializeQueryArgs = function (_j) {
2975 var endpointName = _j.endpointName, queryArgs = _j.queryArgs;
2976 return endpointName + "(" + JSON.stringify(queryArgs, function (key, value) { return isPlainObject2(value) ? Object.keys(value).sort().reduce(function (acc, key2) {
2977 acc[key2] = value[key2];
2978 return acc;
2979 }, {}) : value; }) + ")";
2980 };
2981 // src/query/createApi.ts
2982 function buildCreateApi() {
2983 var modules = [];
2984 for (var _j = 0; _j < arguments.length; _j++) {
2985 modules[_j] = arguments[_j];
2986 }
2987 return function baseCreateApi(options) {
2988 var extractRehydrationInfo = defaultMemoize(function (action) {
2989 var _a, _b;
2990 return (_b = options.extractRehydrationInfo) == null ? void 0 : _b.call(options, action, {
2991 reducerPath: (_a = options.reducerPath) != null ? _a : "api"
2992 });
2993 });
2994 var optionsWithDefaults = __spreadProps(__spreadValues({
2995 reducerPath: "api",
2996 keepUnusedDataFor: 60,
2997 refetchOnMountOrArgChange: false,
2998 refetchOnFocus: false,
2999 refetchOnReconnect: false
3000 }, options), {
3001 extractRehydrationInfo: extractRehydrationInfo,
3002 serializeQueryArgs: function (queryArgsApi) {
3003 var finalSerializeQueryArgs = defaultSerializeQueryArgs;
3004 if ("serializeQueryArgs" in queryArgsApi.endpointDefinition) {
3005 var endpointSQA_1 = queryArgsApi.endpointDefinition.serializeQueryArgs;
3006 finalSerializeQueryArgs = function (queryArgsApi2) {
3007 var initialResult = endpointSQA_1(queryArgsApi2);
3008 if (typeof initialResult === "string") {
3009 return initialResult;
3010 }
3011 else {
3012 return defaultSerializeQueryArgs(__spreadProps(__spreadValues({}, queryArgsApi2), {
3013 queryArgs: initialResult
3014 }));
3015 }
3016 };
3017 }
3018 else if (options.serializeQueryArgs) {
3019 finalSerializeQueryArgs = options.serializeQueryArgs;
3020 }
3021 return finalSerializeQueryArgs(queryArgsApi);
3022 },
3023 tagTypes: __spreadArray([], options.tagTypes || [])
3024 });
3025 var context = {
3026 endpointDefinitions: {},
3027 batch: function (fn2) {
3028 fn2();
3029 },
3030 apiUid: nanoid(),
3031 extractRehydrationInfo: extractRehydrationInfo,
3032 hasRehydrationInfo: defaultMemoize(function (action) { return extractRehydrationInfo(action) != null; })
3033 };
3034 var api = {
3035 injectEndpoints: injectEndpoints,
3036 enhanceEndpoints: function (_j) {
3037 var addTagTypes = _j.addTagTypes, endpoints = _j.endpoints;
3038 if (addTagTypes) {
3039 for (var _k = 0, addTagTypes_1 = addTagTypes; _k < addTagTypes_1.length; _k++) {
3040 var eT = addTagTypes_1[_k];
3041 if (!optionsWithDefaults.tagTypes.includes(eT)) {
3042 optionsWithDefaults.tagTypes.push(eT);
3043 }
3044 }
3045 }
3046 if (endpoints) {
3047 for (var _l = 0, _m = Object.entries(endpoints); _l < _m.length; _l++) {
3048 var _o = _m[_l], endpointName = _o[0], partialDefinition = _o[1];
3049 if (typeof partialDefinition === "function") {
3050 partialDefinition(context.endpointDefinitions[endpointName]);
3051 }
3052 else {
3053 Object.assign(context.endpointDefinitions[endpointName] || {}, partialDefinition);
3054 }
3055 }
3056 }
3057 return api;
3058 }
3059 };
3060 var initializedModules = modules.map(function (m2) { return m2.init(api, optionsWithDefaults, context); });
3061 function injectEndpoints(inject) {
3062 var evaluatedEndpoints = inject.endpoints({
3063 query: function (x2) { return __spreadProps(__spreadValues({}, x2), { type: DefinitionType.query }); },
3064 mutation: function (x2) { return __spreadProps(__spreadValues({}, x2), { type: DefinitionType.mutation }); }
3065 });
3066 for (var _j = 0, _k = Object.entries(evaluatedEndpoints); _j < _k.length; _j++) {
3067 var _l = _k[_j], endpointName = _l[0], definition = _l[1];
3068 if (!inject.overrideExisting && endpointName in context.endpointDefinitions) {
3069 if (typeof process !== "undefined" && true) {
3070 console.error("called `injectEndpoints` to override already-existing endpointName " + endpointName + " without specifying `overrideExisting: true`");
3071 }
3072 continue;
3073 }
3074 context.endpointDefinitions[endpointName] = definition;
3075 for (var _m = 0, initializedModules_1 = initializedModules; _m < initializedModules_1.length; _m++) {
3076 var m2 = initializedModules_1[_m];
3077 m2.injectEndpoint(endpointName, definition);
3078 }
3079 }
3080 return api;
3081 }
3082 return api.injectEndpoints({ endpoints: options.endpoints });
3083 };
3084 }
3085 // src/query/fakeBaseQuery.ts
3086 function fakeBaseQuery() {
3087 return function () {
3088 throw new Error("When using `fakeBaseQuery`, all queries & mutations must use the `queryFn` definition syntax.");
3089 };
3090 }
3091 // src/query/core/buildMiddleware/cacheCollection.ts
3092 function isObjectEmpty(obj) {
3093 for (var k2 in obj) {
3094 return false;
3095 }
3096 return true;
3097 }
3098 var THIRTY_TWO_BIT_MAX_TIMER_SECONDS = 2147483647 / 1e3 - 1;
3099 var buildCacheCollectionHandler = function (_j) {
3100 var reducerPath = _j.reducerPath, api = _j.api, context = _j.context, internalState = _j.internalState;
3101 var _k = api.internalActions, removeQueryResult = _k.removeQueryResult, unsubscribeQueryResult = _k.unsubscribeQueryResult;
3102 function anySubscriptionsRemainingForKey(queryCacheKey) {
3103 var subscriptions = internalState.currentSubscriptions[queryCacheKey];
3104 return !!subscriptions && !isObjectEmpty(subscriptions);
3105 }
3106 var currentRemovalTimeouts = {};
3107 var handler = function (action, mwApi, internalState2) {
3108 var _a;
3109 if (unsubscribeQueryResult.match(action)) {
3110 var state = mwApi.getState()[reducerPath];
3111 var queryCacheKey = action.payload.queryCacheKey;
3112 handleUnsubscribe(queryCacheKey, (_a = state.queries[queryCacheKey]) == null ? void 0 : _a.endpointName, mwApi, state.config);
3113 }
3114 if (api.util.resetApiState.match(action)) {
3115 for (var _j = 0, _k = Object.entries(currentRemovalTimeouts); _j < _k.length; _j++) {
3116 var _l = _k[_j], key = _l[0], timeout = _l[1];
3117 if (timeout)
3118 clearTimeout(timeout);
3119 delete currentRemovalTimeouts[key];
3120 }
3121 }
3122 if (context.hasRehydrationInfo(action)) {
3123 var state = mwApi.getState()[reducerPath];
3124 var queries = context.extractRehydrationInfo(action).queries;
3125 for (var _m = 0, _o = Object.entries(queries); _m < _o.length; _m++) {
3126 var _p = _o[_m], queryCacheKey = _p[0], queryState = _p[1];
3127 handleUnsubscribe(queryCacheKey, queryState == null ? void 0 : queryState.endpointName, mwApi, state.config);
3128 }
3129 }
3130 };
3131 function handleUnsubscribe(queryCacheKey, endpointName, api2, config) {
3132 var _a;
3133 var endpointDefinition = context.endpointDefinitions[endpointName];
3134 var keepUnusedDataFor = (_a = endpointDefinition == null ? void 0 : endpointDefinition.keepUnusedDataFor) != null ? _a : config.keepUnusedDataFor;
3135 if (keepUnusedDataFor === Infinity) {
3136 return;
3137 }
3138 var finalKeepUnusedDataFor = Math.max(0, Math.min(keepUnusedDataFor, THIRTY_TWO_BIT_MAX_TIMER_SECONDS));
3139 if (!anySubscriptionsRemainingForKey(queryCacheKey)) {
3140 var currentTimeout = currentRemovalTimeouts[queryCacheKey];
3141 if (currentTimeout) {
3142 clearTimeout(currentTimeout);
3143 }
3144 currentRemovalTimeouts[queryCacheKey] = setTimeout(function () {
3145 if (!anySubscriptionsRemainingForKey(queryCacheKey)) {
3146 api2.dispatch(removeQueryResult({ queryCacheKey: queryCacheKey }));
3147 }
3148 delete currentRemovalTimeouts[queryCacheKey];
3149 }, finalKeepUnusedDataFor * 1e3);
3150 }
3151 }
3152 return handler;
3153 };
3154 // src/query/core/buildMiddleware/invalidationByTags.ts
3155 var buildInvalidationByTagsHandler = function (_j) {
3156 var reducerPath = _j.reducerPath, context = _j.context, endpointDefinitions = _j.context.endpointDefinitions, mutationThunk = _j.mutationThunk, api = _j.api, assertTagType = _j.assertTagType, refetchQuery = _j.refetchQuery;
3157 var removeQueryResult = api.internalActions.removeQueryResult;
3158 var isThunkActionWithTags = isAnyOf(isFulfilled(mutationThunk), isRejectedWithValue(mutationThunk));
3159 var handler = function (action, mwApi) {
3160 if (isThunkActionWithTags(action)) {
3161 invalidateTags(calculateProvidedByThunk(action, "invalidatesTags", endpointDefinitions, assertTagType), mwApi);
3162 }
3163 if (api.util.invalidateTags.match(action)) {
3164 invalidateTags(calculateProvidedBy(action.payload, void 0, void 0, void 0, void 0, assertTagType), mwApi);
3165 }
3166 };
3167 function invalidateTags(tags, mwApi) {
3168 var rootState = mwApi.getState();
3169 var state = rootState[reducerPath];
3170 var toInvalidate = api.util.selectInvalidatedBy(rootState, tags);
3171 context.batch(function () {
3172 var _a;
3173 var valuesArray = Array.from(toInvalidate.values());
3174 for (var _j = 0, valuesArray_1 = valuesArray; _j < valuesArray_1.length; _j++) {
3175 var queryCacheKey = valuesArray_1[_j].queryCacheKey;
3176 var querySubState = state.queries[queryCacheKey];
3177 var subscriptionSubState = (_a = state.subscriptions[queryCacheKey]) != null ? _a : {};
3178 if (querySubState) {
3179 if (Object.keys(subscriptionSubState).length === 0) {
3180 mwApi.dispatch(removeQueryResult({
3181 queryCacheKey: queryCacheKey
3182 }));
3183 }
3184 else if (querySubState.status !== exports.QueryStatus.uninitialized) {
3185 mwApi.dispatch(refetchQuery(querySubState, queryCacheKey));
3186 }
3187 }
3188 }
3189 });
3190 }
3191 return handler;
3192 };
3193 // src/query/core/buildMiddleware/polling.ts
3194 var buildPollingHandler = function (_j) {
3195 var reducerPath = _j.reducerPath, queryThunk = _j.queryThunk, api = _j.api, refetchQuery = _j.refetchQuery, internalState = _j.internalState;
3196 var currentPolls = {};
3197 var handler = function (action, mwApi) {
3198 if (api.internalActions.updateSubscriptionOptions.match(action) || api.internalActions.unsubscribeQueryResult.match(action)) {
3199 updatePollingInterval(action.payload, mwApi);
3200 }
3201 if (queryThunk.pending.match(action) || queryThunk.rejected.match(action) && action.meta.condition) {
3202 updatePollingInterval(action.meta.arg, mwApi);
3203 }
3204 if (queryThunk.fulfilled.match(action) || queryThunk.rejected.match(action) && !action.meta.condition) {
3205 startNextPoll(action.meta.arg, mwApi);
3206 }
3207 if (api.util.resetApiState.match(action)) {
3208 clearPolls();
3209 }
3210 };
3211 function startNextPoll(_j, api2) {
3212 var queryCacheKey = _j.queryCacheKey;
3213 var state = api2.getState()[reducerPath];
3214 var querySubState = state.queries[queryCacheKey];
3215 var subscriptions = internalState.currentSubscriptions[queryCacheKey];
3216 if (!querySubState || querySubState.status === exports.QueryStatus.uninitialized)
3217 return;
3218 var lowestPollingInterval = findLowestPollingInterval(subscriptions);
3219 if (!Number.isFinite(lowestPollingInterval))
3220 return;
3221 var currentPoll = currentPolls[queryCacheKey];
3222 if (currentPoll == null ? void 0 : currentPoll.timeout) {
3223 clearTimeout(currentPoll.timeout);
3224 currentPoll.timeout = void 0;
3225 }
3226 var nextPollTimestamp = Date.now() + lowestPollingInterval;
3227 var currentInterval = currentPolls[queryCacheKey] = {
3228 nextPollTimestamp: nextPollTimestamp,
3229 pollingInterval: lowestPollingInterval,
3230 timeout: setTimeout(function () {
3231 currentInterval.timeout = void 0;
3232 api2.dispatch(refetchQuery(querySubState, queryCacheKey));
3233 }, lowestPollingInterval)
3234 };
3235 }
3236 function updatePollingInterval(_j, api2) {
3237 var queryCacheKey = _j.queryCacheKey;
3238 var state = api2.getState()[reducerPath];
3239 var querySubState = state.queries[queryCacheKey];
3240 var subscriptions = internalState.currentSubscriptions[queryCacheKey];
3241 if (!querySubState || querySubState.status === exports.QueryStatus.uninitialized) {
3242 return;
3243 }
3244 var lowestPollingInterval = findLowestPollingInterval(subscriptions);
3245 if (!Number.isFinite(lowestPollingInterval)) {
3246 cleanupPollForKey(queryCacheKey);
3247 return;
3248 }
3249 var currentPoll = currentPolls[queryCacheKey];
3250 var nextPollTimestamp = Date.now() + lowestPollingInterval;
3251 if (!currentPoll || nextPollTimestamp < currentPoll.nextPollTimestamp) {
3252 startNextPoll({ queryCacheKey: queryCacheKey }, api2);
3253 }
3254 }
3255 function cleanupPollForKey(key) {
3256 var existingPoll = currentPolls[key];
3257 if (existingPoll == null ? void 0 : existingPoll.timeout) {
3258 clearTimeout(existingPoll.timeout);
3259 }
3260 delete currentPolls[key];
3261 }
3262 function clearPolls() {
3263 for (var _j = 0, _k = Object.keys(currentPolls); _j < _k.length; _j++) {
3264 var key = _k[_j];
3265 cleanupPollForKey(key);
3266 }
3267 }
3268 function findLowestPollingInterval(subscribers) {
3269 if (subscribers === void 0) { subscribers = {}; }
3270 var lowestPollingInterval = Number.POSITIVE_INFINITY;
3271 for (var key in subscribers) {
3272 if (!!subscribers[key].pollingInterval) {
3273 lowestPollingInterval = Math.min(subscribers[key].pollingInterval, lowestPollingInterval);
3274 }
3275 }
3276 return lowestPollingInterval;
3277 }
3278 return handler;
3279 };
3280 // src/query/core/buildMiddleware/windowEventHandling.ts
3281 var buildWindowEventHandler = function (_j) {
3282 var reducerPath = _j.reducerPath, context = _j.context, api = _j.api, refetchQuery = _j.refetchQuery, internalState = _j.internalState;
3283 var removeQueryResult = api.internalActions.removeQueryResult;
3284 var handler = function (action, mwApi) {
3285 if (onFocus.match(action)) {
3286 refetchValidQueries(mwApi, "refetchOnFocus");
3287 }
3288 if (onOnline.match(action)) {
3289 refetchValidQueries(mwApi, "refetchOnReconnect");
3290 }
3291 };
3292 function refetchValidQueries(api2, type) {
3293 var state = api2.getState()[reducerPath];
3294 var queries = state.queries;
3295 var subscriptions = internalState.currentSubscriptions;
3296 context.batch(function () {
3297 for (var _j = 0, _k = Object.keys(subscriptions); _j < _k.length; _j++) {
3298 var queryCacheKey = _k[_j];
3299 var querySubState = queries[queryCacheKey];
3300 var subscriptionSubState = subscriptions[queryCacheKey];
3301 if (!subscriptionSubState || !querySubState)
3302 continue;
3303 var shouldRefetch = Object.values(subscriptionSubState).some(function (sub) { return sub[type] === true; }) || Object.values(subscriptionSubState).every(function (sub) { return sub[type] === void 0; }) && state.config[type];
3304 if (shouldRefetch) {
3305 if (Object.keys(subscriptionSubState).length === 0) {
3306 api2.dispatch(removeQueryResult({
3307 queryCacheKey: queryCacheKey
3308 }));
3309 }
3310 else if (querySubState.status !== exports.QueryStatus.uninitialized) {
3311 api2.dispatch(refetchQuery(querySubState, queryCacheKey));
3312 }
3313 }
3314 }
3315 });
3316 }
3317 return handler;
3318 };
3319 // src/query/core/buildMiddleware/cacheLifecycle.ts
3320 var neverResolvedError = new Error("Promise never resolved before cacheEntryRemoved.");
3321 var buildCacheLifecycleHandler = function (_j) {
3322 var api = _j.api, reducerPath = _j.reducerPath, context = _j.context, queryThunk = _j.queryThunk, mutationThunk = _j.mutationThunk; _j.internalState;
3323 var isQueryThunk = isAsyncThunkAction(queryThunk);
3324 var isMutationThunk = isAsyncThunkAction(mutationThunk);
3325 var isFulfilledThunk = isFulfilled(queryThunk, mutationThunk);
3326 var lifecycleMap = {};
3327 var handler = function (action, mwApi, stateBefore) {
3328 var cacheKey = getCacheKey(action);
3329 if (queryThunk.pending.match(action)) {
3330 var oldState = stateBefore[reducerPath].queries[cacheKey];
3331 var state = mwApi.getState()[reducerPath].queries[cacheKey];
3332 if (!oldState && state) {
3333 handleNewKey(action.meta.arg.endpointName, action.meta.arg.originalArgs, cacheKey, mwApi, action.meta.requestId);
3334 }
3335 }
3336 else if (mutationThunk.pending.match(action)) {
3337 var state = mwApi.getState()[reducerPath].mutations[cacheKey];
3338 if (state) {
3339 handleNewKey(action.meta.arg.endpointName, action.meta.arg.originalArgs, cacheKey, mwApi, action.meta.requestId);
3340 }
3341 }
3342 else if (isFulfilledThunk(action)) {
3343 var lifecycle = lifecycleMap[cacheKey];
3344 if (lifecycle == null ? void 0 : lifecycle.valueResolved) {
3345 lifecycle.valueResolved({
3346 data: action.payload,
3347 meta: action.meta.baseQueryMeta
3348 });
3349 delete lifecycle.valueResolved;
3350 }
3351 }
3352 else if (api.internalActions.removeQueryResult.match(action) || api.internalActions.removeMutationResult.match(action)) {
3353 var lifecycle = lifecycleMap[cacheKey];
3354 if (lifecycle) {
3355 delete lifecycleMap[cacheKey];
3356 lifecycle.cacheEntryRemoved();
3357 }
3358 }
3359 else if (api.util.resetApiState.match(action)) {
3360 for (var _j = 0, _k = Object.entries(lifecycleMap); _j < _k.length; _j++) {
3361 var _l = _k[_j], cacheKey2 = _l[0], lifecycle = _l[1];
3362 delete lifecycleMap[cacheKey2];
3363 lifecycle.cacheEntryRemoved();
3364 }
3365 }
3366 };
3367 function getCacheKey(action) {
3368 if (isQueryThunk(action))
3369 return action.meta.arg.queryCacheKey;
3370 if (isMutationThunk(action))
3371 return action.meta.requestId;
3372 if (api.internalActions.removeQueryResult.match(action))
3373 return action.payload.queryCacheKey;
3374 if (api.internalActions.removeMutationResult.match(action))
3375 return getMutationCacheKey(action.payload);
3376 return "";
3377 }
3378 function handleNewKey(endpointName, originalArgs, queryCacheKey, mwApi, requestId) {
3379 var endpointDefinition = context.endpointDefinitions[endpointName];
3380 var onCacheEntryAdded = endpointDefinition == null ? void 0 : endpointDefinition.onCacheEntryAdded;
3381 if (!onCacheEntryAdded)
3382 return;
3383 var lifecycle = {};
3384 var cacheEntryRemoved = new Promise(function (resolve) {
3385 lifecycle.cacheEntryRemoved = resolve;
3386 });
3387 var cacheDataLoaded = Promise.race([
3388 new Promise(function (resolve) {
3389 lifecycle.valueResolved = resolve;
3390 }),
3391 cacheEntryRemoved.then(function () {
3392 throw neverResolvedError;
3393 })
3394 ]);
3395 cacheDataLoaded.catch(function () {
3396 });
3397 lifecycleMap[queryCacheKey] = lifecycle;
3398 var selector = api.endpoints[endpointName].select(endpointDefinition.type === DefinitionType.query ? originalArgs : queryCacheKey);
3399 var extra = mwApi.dispatch(function (_2, __, extra2) { return extra2; });
3400 var lifecycleApi = __spreadProps(__spreadValues({}, mwApi), {
3401 getCacheEntry: function () { return selector(mwApi.getState()); },
3402 requestId: requestId,
3403 extra: extra,
3404 updateCachedData: endpointDefinition.type === DefinitionType.query ? function (updateRecipe) { return mwApi.dispatch(api.util.updateQueryData(endpointName, originalArgs, updateRecipe)); } : void 0,
3405 cacheDataLoaded: cacheDataLoaded,
3406 cacheEntryRemoved: cacheEntryRemoved
3407 });
3408 var runningHandler = onCacheEntryAdded(originalArgs, lifecycleApi);
3409 Promise.resolve(runningHandler).catch(function (e2) {
3410 if (e2 === neverResolvedError)
3411 return;
3412 throw e2;
3413 });
3414 }
3415 return handler;
3416 };
3417 // src/query/core/buildMiddleware/queryLifecycle.ts
3418 var buildQueryLifecycleHandler = function (_j) {
3419 var api = _j.api, context = _j.context, queryThunk = _j.queryThunk, mutationThunk = _j.mutationThunk;
3420 var isPendingThunk = isPending(queryThunk, mutationThunk);
3421 var isRejectedThunk = isRejected(queryThunk, mutationThunk);
3422 var isFullfilledThunk = isFulfilled(queryThunk, mutationThunk);
3423 var lifecycleMap = {};
3424 var handler = function (action, mwApi) {
3425 var _a, _b, _c;
3426 if (isPendingThunk(action)) {
3427 var _j = action.meta, requestId = _j.requestId, _k = _j.arg, endpointName_1 = _k.endpointName, originalArgs_1 = _k.originalArgs;
3428 var endpointDefinition = context.endpointDefinitions[endpointName_1];
3429 var onQueryStarted = endpointDefinition == null ? void 0 : endpointDefinition.onQueryStarted;
3430 if (onQueryStarted) {
3431 var lifecycle_1 = {};
3432 var queryFulfilled = new Promise(function (resolve, reject) {
3433 lifecycle_1.resolve = resolve;
3434 lifecycle_1.reject = reject;
3435 });
3436 queryFulfilled.catch(function () {
3437 });
3438 lifecycleMap[requestId] = lifecycle_1;
3439 var selector_1 = api.endpoints[endpointName_1].select(endpointDefinition.type === DefinitionType.query ? originalArgs_1 : requestId);
3440 var extra = mwApi.dispatch(function (_2, __, extra2) { return extra2; });
3441 var lifecycleApi = __spreadProps(__spreadValues({}, mwApi), {
3442 getCacheEntry: function () { return selector_1(mwApi.getState()); },
3443 requestId: requestId,
3444 extra: extra,
3445 updateCachedData: endpointDefinition.type === DefinitionType.query ? function (updateRecipe) { return mwApi.dispatch(api.util.updateQueryData(endpointName_1, originalArgs_1, updateRecipe)); } : void 0,
3446 queryFulfilled: queryFulfilled
3447 });
3448 onQueryStarted(originalArgs_1, lifecycleApi);
3449 }
3450 }
3451 else if (isFullfilledThunk(action)) {
3452 var _l = action.meta, requestId = _l.requestId, baseQueryMeta = _l.baseQueryMeta;
3453 (_a = lifecycleMap[requestId]) == null ? void 0 : _a.resolve({
3454 data: action.payload,
3455 meta: baseQueryMeta
3456 });
3457 delete lifecycleMap[requestId];
3458 }
3459 else if (isRejectedThunk(action)) {
3460 var _m = action.meta, requestId = _m.requestId, rejectedWithValue = _m.rejectedWithValue, baseQueryMeta = _m.baseQueryMeta;
3461 (_c = lifecycleMap[requestId]) == null ? void 0 : _c.reject({
3462 error: (_b = action.payload) != null ? _b : action.error,
3463 isUnhandledError: !rejectedWithValue,
3464 meta: baseQueryMeta
3465 });
3466 delete lifecycleMap[requestId];
3467 }
3468 };
3469 return handler;
3470 };
3471 // src/query/core/buildMiddleware/devMiddleware.ts
3472 var buildDevCheckHandler = function (_j) {
3473 var api = _j.api, apiUid = _j.context.apiUid, reducerPath = _j.reducerPath;
3474 return function (action, mwApi) {
3475 var _a, _b;
3476 if (api.util.resetApiState.match(action)) {
3477 mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));
3478 }
3479 if (typeof process !== "undefined" && true) {
3480 if (api.internalActions.middlewareRegistered.match(action) && action.payload === apiUid && ((_b = (_a = mwApi.getState()[reducerPath]) == null ? void 0 : _a.config) == null ? void 0 : _b.middlewareRegistered) === "conflict") {
3481 console.warn("There is a mismatch between slice and middleware for the reducerPath \"" + reducerPath + "\".\nYou can only have one api per reducer path, this will lead to crashes in various situations!" + (reducerPath === "api" ? "\nIf you have multiple apis, you *have* to specify the reducerPath option when using createApi!" : ""));
3482 }
3483 }
3484 };
3485 };
3486 // src/query/core/buildMiddleware/batchActions.ts
3487 var promise2;
3488 var queueMicrotaskShim2 = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : globalThis) : function (cb) { return (promise2 || (promise2 = Promise.resolve())).then(cb).catch(function (err) { return setTimeout(function () {
3489 throw err;
3490 }, 0); }); };
3491 var buildBatchedActionsHandler = function (_j) {
3492 var api = _j.api, queryThunk = _j.queryThunk, internalState = _j.internalState;
3493 var subscriptionsPrefix = api.reducerPath + "/subscriptions";
3494 var previousSubscriptions = null;
3495 var dispatchQueued = false;
3496 var _k = api.internalActions, updateSubscriptionOptions = _k.updateSubscriptionOptions, unsubscribeQueryResult = _k.unsubscribeQueryResult;
3497 var actuallyMutateSubscriptions = function (mutableState, action) {
3498 var _a, _b, _c, _d, _e, _f, _g, _h, _i;
3499 if (updateSubscriptionOptions.match(action)) {
3500 var _j = action.payload, queryCacheKey = _j.queryCacheKey, requestId = _j.requestId, options = _j.options;
3501 if ((_a = mutableState == null ? void 0 : mutableState[queryCacheKey]) == null ? void 0 : _a[requestId]) {
3502 mutableState[queryCacheKey][requestId] = options;
3503 }
3504 return true;
3505 }
3506 if (unsubscribeQueryResult.match(action)) {
3507 var _k = action.payload, queryCacheKey = _k.queryCacheKey, requestId = _k.requestId;
3508 if (mutableState[queryCacheKey]) {
3509 delete mutableState[queryCacheKey][requestId];
3510 }
3511 return true;
3512 }
3513 if (api.internalActions.removeQueryResult.match(action)) {
3514 delete mutableState[action.payload.queryCacheKey];
3515 return true;
3516 }
3517 if (queryThunk.pending.match(action)) {
3518 var _l = action.meta, arg = _l.arg, requestId = _l.requestId;
3519 if (arg.subscribe) {
3520 var substate = (_c = mutableState[_b = arg.queryCacheKey]) != null ? _c : mutableState[_b] = {};
3521 substate[requestId] = (_e = (_d = arg.subscriptionOptions) != null ? _d : substate[requestId]) != null ? _e : {};
3522 return true;
3523 }
3524 }
3525 if (queryThunk.rejected.match(action)) {
3526 var _m = action.meta, condition = _m.condition, arg = _m.arg, requestId = _m.requestId;
3527 if (condition && arg.subscribe) {
3528 var substate = (_g = mutableState[_f = arg.queryCacheKey]) != null ? _g : mutableState[_f] = {};
3529 substate[requestId] = (_i = (_h = arg.subscriptionOptions) != null ? _h : substate[requestId]) != null ? _i : {};
3530 return true;
3531 }
3532 }
3533 return false;
3534 };
3535 return function (action, mwApi) {
3536 var _a, _b;
3537 if (!previousSubscriptions) {
3538 previousSubscriptions = JSON.parse(JSON.stringify(internalState.currentSubscriptions));
3539 }
3540 if (api.internalActions.internal_probeSubscription.match(action)) {
3541 var _j = action.payload, queryCacheKey = _j.queryCacheKey, requestId = _j.requestId;
3542 var hasSubscription = !!((_a = internalState.currentSubscriptions[queryCacheKey]) == null ? void 0 : _a[requestId]);
3543 return [false, hasSubscription];
3544 }
3545 var didMutate = actuallyMutateSubscriptions(internalState.currentSubscriptions, action);
3546 if (didMutate) {
3547 if (!dispatchQueued) {
3548 queueMicrotaskShim2(function () {
3549 var newSubscriptions = JSON.parse(JSON.stringify(internalState.currentSubscriptions));
3550 var _j = cn(previousSubscriptions, function () { return newSubscriptions; }), patches = _j[1];
3551 mwApi.next(api.internalActions.subscriptionsUpdated(patches));
3552 previousSubscriptions = newSubscriptions;
3553 dispatchQueued = false;
3554 });
3555 dispatchQueued = true;
3556 }
3557 var isSubscriptionSliceAction = !!((_b = action.type) == null ? void 0 : _b.startsWith(subscriptionsPrefix));
3558 var isAdditionalSubscriptionAction = queryThunk.rejected.match(action) && action.meta.condition && !!action.meta.arg.subscribe;
3559 var actionShouldContinue = !isSubscriptionSliceAction && !isAdditionalSubscriptionAction;
3560 return [actionShouldContinue, false];
3561 }
3562 return [true, false];
3563 };
3564 };
3565 // src/query/core/buildMiddleware/index.ts
3566 function buildMiddleware(input) {
3567 var reducerPath = input.reducerPath, queryThunk = input.queryThunk, api = input.api, context = input.context;
3568 var apiUid = context.apiUid;
3569 var actions = {
3570 invalidateTags: createAction(reducerPath + "/invalidateTags")
3571 };
3572 var isThisApiSliceAction = function (action) {
3573 return !!action && typeof action.type === "string" && action.type.startsWith(reducerPath + "/");
3574 };
3575 var handlerBuilders = [
3576 buildDevCheckHandler,
3577 buildCacheCollectionHandler,
3578 buildInvalidationByTagsHandler,
3579 buildPollingHandler,
3580 buildCacheLifecycleHandler,
3581 buildQueryLifecycleHandler
3582 ];
3583 var middleware = function (mwApi) {
3584 var initialized2 = false;
3585 var internalState = {
3586 currentSubscriptions: {}
3587 };
3588 var builderArgs = __spreadProps(__spreadValues({}, input), {
3589 internalState: internalState,
3590 refetchQuery: refetchQuery
3591 });
3592 var handlers = handlerBuilders.map(function (build) { return build(builderArgs); });
3593 var batchedActionsHandler = buildBatchedActionsHandler(builderArgs);
3594 var windowEventsHandler = buildWindowEventHandler(builderArgs);
3595 return function (next) {
3596 return function (action) {
3597 if (!initialized2) {
3598 initialized2 = true;
3599 mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));
3600 }
3601 var mwApiWithNext = __spreadProps(__spreadValues({}, mwApi), { next: next });
3602 var stateBefore = mwApi.getState();
3603 var _j = batchedActionsHandler(action, mwApiWithNext, stateBefore), actionShouldContinue = _j[0], hasSubscription = _j[1];
3604 var res;
3605 if (actionShouldContinue) {
3606 res = next(action);
3607 }
3608 else {
3609 res = hasSubscription;
3610 }
3611 if (!!mwApi.getState()[reducerPath]) {
3612 windowEventsHandler(action, mwApiWithNext, stateBefore);
3613 if (isThisApiSliceAction(action) || context.hasRehydrationInfo(action)) {
3614 for (var _k = 0, handlers_1 = handlers; _k < handlers_1.length; _k++) {
3615 var handler = handlers_1[_k];
3616 handler(action, mwApiWithNext, stateBefore);
3617 }
3618 }
3619 }
3620 return res;
3621 };
3622 };
3623 };
3624 return { middleware: middleware, actions: actions };
3625 function refetchQuery(querySubState, queryCacheKey, override) {
3626 if (override === void 0) { override = {}; }
3627 return queryThunk(__spreadValues({
3628 type: "query",
3629 endpointName: querySubState.endpointName,
3630 originalArgs: querySubState.originalArgs,
3631 subscribe: false,
3632 forceRefetch: true,
3633 queryCacheKey: queryCacheKey
3634 }, override));
3635 }
3636 }
3637 function safeAssign(target) {
3638 var args = [];
3639 for (var _j = 1; _j < arguments.length; _j++) {
3640 args[_j - 1] = arguments[_j];
3641 }
3642 Object.assign.apply(Object, __spreadArray([target], args));
3643 }
3644 // src/query/core/module.ts
3645 var coreModuleName = /* @__PURE__ */ Symbol();
3646 var coreModule = function () { return ({
3647 name: coreModuleName,
3648 init: function (api, _j, context) {
3649 var baseQuery = _j.baseQuery, tagTypes = _j.tagTypes, reducerPath = _j.reducerPath, serializeQueryArgs = _j.serializeQueryArgs, keepUnusedDataFor = _j.keepUnusedDataFor, refetchOnMountOrArgChange = _j.refetchOnMountOrArgChange, refetchOnFocus = _j.refetchOnFocus, refetchOnReconnect = _j.refetchOnReconnect;
3650 T();
3651 var assertTagType = function (tag) {
3652 if (typeof process !== "undefined" && true) {
3653 if (!tagTypes.includes(tag.type)) {
3654 console.error("Tag type '" + tag.type + "' was used, but not specified in `tagTypes`!");
3655 }
3656 }
3657 return tag;
3658 };
3659 Object.assign(api, {
3660 reducerPath: reducerPath,
3661 endpoints: {},
3662 internalActions: {
3663 onOnline: onOnline,
3664 onOffline: onOffline,
3665 onFocus: onFocus,
3666 onFocusLost: onFocusLost
3667 },
3668 util: {}
3669 });
3670 var _k = buildThunks({
3671 baseQuery: baseQuery,
3672 reducerPath: reducerPath,
3673 context: context,
3674 api: api,
3675 serializeQueryArgs: serializeQueryArgs
3676 }), queryThunk = _k.queryThunk, mutationThunk = _k.mutationThunk, patchQueryData = _k.patchQueryData, updateQueryData = _k.updateQueryData, upsertQueryData = _k.upsertQueryData, prefetch = _k.prefetch, buildMatchThunkActions = _k.buildMatchThunkActions;
3677 var _l = buildSlice({
3678 context: context,
3679 queryThunk: queryThunk,
3680 mutationThunk: mutationThunk,
3681 reducerPath: reducerPath,
3682 assertTagType: assertTagType,
3683 config: {
3684 refetchOnFocus: refetchOnFocus,
3685 refetchOnReconnect: refetchOnReconnect,
3686 refetchOnMountOrArgChange: refetchOnMountOrArgChange,
3687 keepUnusedDataFor: keepUnusedDataFor,
3688 reducerPath: reducerPath
3689 }
3690 }), reducer = _l.reducer, sliceActions = _l.actions;
3691 safeAssign(api.util, {
3692 patchQueryData: patchQueryData,
3693 updateQueryData: updateQueryData,
3694 upsertQueryData: upsertQueryData,
3695 prefetch: prefetch,
3696 resetApiState: sliceActions.resetApiState
3697 });
3698 safeAssign(api.internalActions, sliceActions);
3699 var _m = buildMiddleware({
3700 reducerPath: reducerPath,
3701 context: context,
3702 queryThunk: queryThunk,
3703 mutationThunk: mutationThunk,
3704 api: api,
3705 assertTagType: assertTagType
3706 }), middleware = _m.middleware, middlewareActions = _m.actions;
3707 safeAssign(api.util, middlewareActions);
3708 safeAssign(api, { reducer: reducer, middleware: middleware });
3709 var _o = buildSelectors({
3710 serializeQueryArgs: serializeQueryArgs,
3711 reducerPath: reducerPath
3712 }), buildQuerySelector = _o.buildQuerySelector, buildMutationSelector = _o.buildMutationSelector, selectInvalidatedBy = _o.selectInvalidatedBy;
3713 safeAssign(api.util, { selectInvalidatedBy: selectInvalidatedBy });
3714 var _p = buildInitiate({
3715 queryThunk: queryThunk,
3716 mutationThunk: mutationThunk,
3717 api: api,
3718 serializeQueryArgs: serializeQueryArgs,
3719 context: context
3720 }), buildInitiateQuery = _p.buildInitiateQuery, buildInitiateMutation = _p.buildInitiateMutation, getRunningMutationThunk = _p.getRunningMutationThunk, getRunningMutationsThunk = _p.getRunningMutationsThunk, getRunningQueriesThunk = _p.getRunningQueriesThunk, getRunningQueryThunk = _p.getRunningQueryThunk, getRunningOperationPromises = _p.getRunningOperationPromises, removalWarning = _p.removalWarning;
3721 safeAssign(api.util, {
3722 getRunningOperationPromises: getRunningOperationPromises,
3723 getRunningOperationPromise: removalWarning,
3724 getRunningMutationThunk: getRunningMutationThunk,
3725 getRunningMutationsThunk: getRunningMutationsThunk,
3726 getRunningQueryThunk: getRunningQueryThunk,
3727 getRunningQueriesThunk: getRunningQueriesThunk
3728 });
3729 return {
3730 name: coreModuleName,
3731 injectEndpoint: function (endpointName, definition) {
3732 var _a, _b;
3733 var anyApi = api;
3734 (_b = (_a = anyApi.endpoints)[endpointName]) != null ? _b : _a[endpointName] = {};
3735 if (isQueryDefinition(definition)) {
3736 safeAssign(anyApi.endpoints[endpointName], {
3737 name: endpointName,
3738 select: buildQuerySelector(endpointName, definition),
3739 initiate: buildInitiateQuery(endpointName, definition)
3740 }, buildMatchThunkActions(queryThunk, endpointName));
3741 }
3742 else if (isMutationDefinition(definition)) {
3743 safeAssign(anyApi.endpoints[endpointName], {
3744 name: endpointName,
3745 select: buildMutationSelector(),
3746 initiate: buildInitiateMutation(endpointName)
3747 }, buildMatchThunkActions(mutationThunk, endpointName));
3748 }
3749 }
3750 };
3751 }
3752 }); };
3753 // src/query/core/index.ts
3754 var createApi = /* @__PURE__ */ buildCreateApi(coreModule());
3755
3756 exports.buildCreateApi = buildCreateApi;
3757 exports.copyWithStructuralSharing = copyWithStructuralSharing;
3758 exports.coreModule = coreModule;
3759 exports.createApi = createApi;
3760 exports.defaultSerializeQueryArgs = defaultSerializeQueryArgs;
3761 exports.fakeBaseQuery = fakeBaseQuery;
3762 exports.fetchBaseQuery = fetchBaseQuery;
3763 exports.retry = retry;
3764 exports.setupListeners = setupListeners;
3765 exports.skipSelector = skipSelector;
3766 exports.skipToken = skipToken;
3767
3768 Object.defineProperty(exports, '__esModule', { value: true });
3769
3770}));
3771//# sourceMappingURL=rtk-query.umd.js.map