Index: node_modules/@reduxjs/toolkit/dist/query/cjs/index.js
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/cjs/index.js	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/cjs/index.js	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,6 @@
+'use strict'
+if (process.env.NODE_ENV === 'production') {
+  module.exports = require('./rtk-query.production.min.cjs')
+} else {
+  module.exports = require('./rtk-query.development.cjs')
+}
Index: node_modules/@reduxjs/toolkit/dist/query/cjs/rtk-query.development.cjs
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/cjs/rtk-query.development.cjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/cjs/rtk-query.development.cjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,3087 @@
+"use strict";
+var __defProp = Object.defineProperty;
+var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
+var __getOwnPropNames = Object.getOwnPropertyNames;
+var __hasOwnProp = Object.prototype.hasOwnProperty;
+var __export = (target, all) => {
+  for (var name in all)
+    __defProp(target, name, { get: all[name], enumerable: true });
+};
+var __copyProps = (to, from, except, desc) => {
+  if (from && typeof from === "object" || typeof from === "function") {
+    for (let key of __getOwnPropNames(from))
+      if (!__hasOwnProp.call(to, key) && key !== except)
+        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
+  }
+  return to;
+};
+var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
+
+// src/query/index.ts
+var query_exports = {};
+__export(query_exports, {
+  NamedSchemaError: () => NamedSchemaError,
+  QueryStatus: () => QueryStatus,
+  _NEVER: () => _NEVER,
+  buildCreateApi: () => buildCreateApi,
+  copyWithStructuralSharing: () => copyWithStructuralSharing,
+  coreModule: () => coreModule,
+  coreModuleName: () => coreModuleName,
+  createApi: () => createApi,
+  defaultSerializeQueryArgs: () => defaultSerializeQueryArgs,
+  fakeBaseQuery: () => fakeBaseQuery,
+  fetchBaseQuery: () => fetchBaseQuery,
+  retry: () => retry,
+  setupListeners: () => setupListeners,
+  skipToken: () => skipToken
+});
+module.exports = __toCommonJS(query_exports);
+
+// src/query/core/apiState.ts
+var QueryStatus = /* @__PURE__ */ ((QueryStatus7) => {
+  QueryStatus7["uninitialized"] = "uninitialized";
+  QueryStatus7["pending"] = "pending";
+  QueryStatus7["fulfilled"] = "fulfilled";
+  QueryStatus7["rejected"] = "rejected";
+  return QueryStatus7;
+})(QueryStatus || {});
+var STATUS_UNINITIALIZED = "uninitialized" /* uninitialized */;
+var STATUS_PENDING = "pending" /* pending */;
+var STATUS_FULFILLED = "fulfilled" /* fulfilled */;
+var STATUS_REJECTED = "rejected" /* rejected */;
+function getRequestStatusFlags(status) {
+  return {
+    status,
+    isUninitialized: status === STATUS_UNINITIALIZED,
+    isLoading: status === STATUS_PENDING,
+    isSuccess: status === STATUS_FULFILLED,
+    isError: status === STATUS_REJECTED
+  };
+}
+
+// src/query/core/rtkImports.ts
+var import_toolkit = require("@reduxjs/toolkit");
+
+// src/query/utils/copyWithStructuralSharing.ts
+var isPlainObject2 = import_toolkit.isPlainObject;
+function copyWithStructuralSharing(oldObj, newObj) {
+  if (oldObj === newObj || !(isPlainObject2(oldObj) && isPlainObject2(newObj) || Array.isArray(oldObj) && Array.isArray(newObj))) {
+    return newObj;
+  }
+  const newKeys = Object.keys(newObj);
+  const oldKeys = Object.keys(oldObj);
+  let isSameObject = newKeys.length === oldKeys.length;
+  const mergeObj = Array.isArray(newObj) ? [] : {};
+  for (const key of newKeys) {
+    mergeObj[key] = copyWithStructuralSharing(oldObj[key], newObj[key]);
+    if (isSameObject) isSameObject = oldObj[key] === mergeObj[key];
+  }
+  return isSameObject ? oldObj : mergeObj;
+}
+
+// src/query/utils/filterMap.ts
+function filterMap(array, predicate, mapper) {
+  return array.reduce((acc, item, i) => {
+    if (predicate(item, i)) {
+      acc.push(mapper(item, i));
+    }
+    return acc;
+  }, []).flat();
+}
+
+// src/query/utils/isAbsoluteUrl.ts
+function isAbsoluteUrl(url) {
+  return new RegExp(`(^|:)//`).test(url);
+}
+
+// src/query/utils/isDocumentVisible.ts
+function isDocumentVisible() {
+  if (typeof document === "undefined") {
+    return true;
+  }
+  return document.visibilityState !== "hidden";
+}
+
+// src/query/utils/isNotNullish.ts
+function isNotNullish(v) {
+  return v != null;
+}
+function filterNullishValues(map) {
+  return [...map?.values() ?? []].filter(isNotNullish);
+}
+
+// src/query/utils/isOnline.ts
+function isOnline() {
+  return typeof navigator === "undefined" ? true : navigator.onLine === void 0 ? true : navigator.onLine;
+}
+
+// src/query/utils/joinUrls.ts
+var withoutTrailingSlash = (url) => url.replace(/\/$/, "");
+var withoutLeadingSlash = (url) => url.replace(/^\//, "");
+function joinUrls(base, url) {
+  if (!base) {
+    return url;
+  }
+  if (!url) {
+    return base;
+  }
+  if (isAbsoluteUrl(url)) {
+    return url;
+  }
+  const delimiter = base.endsWith("/") || !url.startsWith("?") ? "/" : "";
+  base = withoutTrailingSlash(base);
+  url = withoutLeadingSlash(url);
+  return `${base}${delimiter}${url}`;
+}
+
+// src/query/utils/getOrInsert.ts
+function getOrInsertComputed(map, key, compute) {
+  if (map.has(key)) return map.get(key);
+  return map.set(key, compute(key)).get(key);
+}
+var createNewMap = () => /* @__PURE__ */ new Map();
+
+// src/query/utils/signals.ts
+var timeoutSignal = (milliseconds) => {
+  const abortController = new AbortController();
+  setTimeout(() => {
+    const message = "signal timed out";
+    const name = "TimeoutError";
+    abortController.abort(
+      // some environments (React Native, Node) don't have DOMException
+      typeof DOMException !== "undefined" ? new DOMException(message, name) : Object.assign(new Error(message), {
+        name
+      })
+    );
+  }, milliseconds);
+  return abortController.signal;
+};
+var anySignal = (...signals) => {
+  for (const signal of signals) if (signal.aborted) return AbortSignal.abort(signal.reason);
+  const abortController = new AbortController();
+  for (const signal of signals) {
+    signal.addEventListener("abort", () => abortController.abort(signal.reason), {
+      signal: abortController.signal,
+      once: true
+    });
+  }
+  return abortController.signal;
+};
+
+// src/query/fetchBaseQuery.ts
+var defaultFetchFn = (...args) => fetch(...args);
+var defaultValidateStatus = (response) => response.status >= 200 && response.status <= 299;
+var defaultIsJsonContentType = (headers) => (
+  /*applicat*/
+  /ion\/(vnd\.api\+)?json/.test(headers.get("content-type") || "")
+);
+function stripUndefined(obj) {
+  if (!(0, import_toolkit.isPlainObject)(obj)) {
+    return obj;
+  }
+  const copy = {
+    ...obj
+  };
+  for (const [k, v] of Object.entries(copy)) {
+    if (v === void 0) delete copy[k];
+  }
+  return copy;
+}
+var isJsonifiable = (body) => typeof body === "object" && ((0, import_toolkit.isPlainObject)(body) || Array.isArray(body) || typeof body.toJSON === "function");
+function fetchBaseQuery({
+  baseUrl,
+  prepareHeaders = (x) => x,
+  fetchFn = defaultFetchFn,
+  paramsSerializer,
+  isJsonContentType = defaultIsJsonContentType,
+  jsonContentType = "application/json",
+  jsonReplacer,
+  timeout: defaultTimeout,
+  responseHandler: globalResponseHandler,
+  validateStatus: globalValidateStatus,
+  ...baseFetchOptions
+} = {}) {
+  if (typeof fetch === "undefined" && fetchFn === defaultFetchFn) {
+    console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments.");
+  }
+  return async (arg, api, extraOptions) => {
+    const {
+      getState,
+      extra,
+      endpoint,
+      forced,
+      type
+    } = api;
+    let meta;
+    let {
+      url,
+      headers = new Headers(baseFetchOptions.headers),
+      params = void 0,
+      responseHandler = globalResponseHandler ?? "json",
+      validateStatus = globalValidateStatus ?? defaultValidateStatus,
+      timeout = defaultTimeout,
+      ...rest
+    } = typeof arg == "string" ? {
+      url: arg
+    } : arg;
+    let config = {
+      ...baseFetchOptions,
+      signal: timeout ? anySignal(api.signal, timeoutSignal(timeout)) : api.signal,
+      ...rest
+    };
+    headers = new Headers(stripUndefined(headers));
+    config.headers = await prepareHeaders(headers, {
+      getState,
+      arg,
+      extra,
+      endpoint,
+      forced,
+      type,
+      extraOptions
+    }) || headers;
+    const bodyIsJsonifiable = isJsonifiable(config.body);
+    if (config.body != null && !bodyIsJsonifiable && typeof config.body !== "string") {
+      config.headers.delete("content-type");
+    }
+    if (!config.headers.has("content-type") && bodyIsJsonifiable) {
+      config.headers.set("content-type", jsonContentType);
+    }
+    if (bodyIsJsonifiable && isJsonContentType(config.headers)) {
+      config.body = JSON.stringify(config.body, jsonReplacer);
+    }
+    if (!config.headers.has("accept")) {
+      if (responseHandler === "json") {
+        config.headers.set("accept", "application/json");
+      } else if (responseHandler === "text") {
+        config.headers.set("accept", "text/plain, text/html, */*");
+      }
+    }
+    if (params) {
+      const divider = ~url.indexOf("?") ? "&" : "?";
+      const query = paramsSerializer ? paramsSerializer(params) : new URLSearchParams(stripUndefined(params));
+      url += divider + query;
+    }
+    url = joinUrls(baseUrl, url);
+    const request = new Request(url, config);
+    const requestClone = new Request(url, config);
+    meta = {
+      request: requestClone
+    };
+    let response;
+    try {
+      response = await fetchFn(request);
+    } catch (e) {
+      return {
+        error: {
+          status: (e instanceof Error || typeof DOMException !== "undefined" && e instanceof DOMException) && e.name === "TimeoutError" ? "TIMEOUT_ERROR" : "FETCH_ERROR",
+          error: String(e)
+        },
+        meta
+      };
+    }
+    const responseClone = response.clone();
+    meta.response = responseClone;
+    let resultData;
+    let responseText = "";
+    try {
+      let handleResponseError;
+      await Promise.all([
+        handleResponse(response, responseHandler).then((r) => resultData = r, (e) => handleResponseError = e),
+        // see https://github.com/node-fetch/node-fetch/issues/665#issuecomment-538995182
+        // we *have* to "use up" both streams at the same time or they will stop running in node-fetch scenarios
+        responseClone.text().then((r) => responseText = r, () => {
+        })
+      ]);
+      if (handleResponseError) throw handleResponseError;
+    } catch (e) {
+      return {
+        error: {
+          status: "PARSING_ERROR",
+          originalStatus: response.status,
+          data: responseText,
+          error: String(e)
+        },
+        meta
+      };
+    }
+    return validateStatus(response, resultData) ? {
+      data: resultData,
+      meta
+    } : {
+      error: {
+        status: response.status,
+        data: resultData
+      },
+      meta
+    };
+  };
+  async function handleResponse(response, responseHandler) {
+    if (typeof responseHandler === "function") {
+      return responseHandler(response);
+    }
+    if (responseHandler === "content-type") {
+      responseHandler = isJsonContentType(response.headers) ? "json" : "text";
+    }
+    if (responseHandler === "json") {
+      const text = await response.text();
+      return text.length ? JSON.parse(text) : null;
+    }
+    return response.text();
+  }
+}
+
+// src/query/HandledError.ts
+var HandledError = class {
+  constructor(value, meta = void 0) {
+    this.value = value;
+    this.meta = meta;
+  }
+};
+
+// src/query/retry.ts
+async function defaultBackoff(attempt = 0, maxRetries = 5, signal) {
+  const attempts = Math.min(attempt, maxRetries);
+  const timeout = ~~((Math.random() + 0.4) * (300 << attempts));
+  await new Promise((resolve, reject) => {
+    const timeoutId = setTimeout(() => resolve(), timeout);
+    if (signal) {
+      const abortHandler = () => {
+        clearTimeout(timeoutId);
+        reject(new Error("Aborted"));
+      };
+      if (signal.aborted) {
+        clearTimeout(timeoutId);
+        reject(new Error("Aborted"));
+      } else {
+        signal.addEventListener("abort", abortHandler, {
+          once: true
+        });
+      }
+    }
+  });
+}
+function fail(error, meta) {
+  throw Object.assign(new HandledError({
+    error,
+    meta
+  }), {
+    throwImmediately: true
+  });
+}
+function failIfAborted(signal) {
+  if (signal.aborted) {
+    fail({
+      status: "CUSTOM_ERROR",
+      error: "Aborted"
+    });
+  }
+}
+var EMPTY_OPTIONS = {};
+var retryWithBackoff = (baseQuery, defaultOptions) => async (args, api, extraOptions) => {
+  const possibleMaxRetries = [5, (defaultOptions || EMPTY_OPTIONS).maxRetries, (extraOptions || EMPTY_OPTIONS).maxRetries].filter((x) => x !== void 0);
+  const [maxRetries] = possibleMaxRetries.slice(-1);
+  const defaultRetryCondition = (_, __, {
+    attempt
+  }) => attempt <= maxRetries;
+  const options = {
+    maxRetries,
+    backoff: defaultBackoff,
+    retryCondition: defaultRetryCondition,
+    ...defaultOptions,
+    ...extraOptions
+  };
+  let retry2 = 0;
+  while (true) {
+    failIfAborted(api.signal);
+    try {
+      const result = await baseQuery(args, api, extraOptions);
+      if (result.error) {
+        throw new HandledError(result);
+      }
+      return result;
+    } catch (e) {
+      retry2++;
+      if (e.throwImmediately) {
+        if (e instanceof HandledError) {
+          return e.value;
+        }
+        throw e;
+      }
+      if (e instanceof HandledError) {
+        if (!options.retryCondition(e.value.error, args, {
+          attempt: retry2,
+          baseQueryApi: api,
+          extraOptions
+        })) {
+          return e.value;
+        }
+      } else {
+        if (retry2 > options.maxRetries) {
+          return {
+            error: e
+          };
+        }
+      }
+      failIfAborted(api.signal);
+      try {
+        await options.backoff(retry2, options.maxRetries, api.signal);
+      } catch (backoffError) {
+        failIfAborted(api.signal);
+        throw backoffError;
+      }
+    }
+  }
+};
+var retry = /* @__PURE__ */ Object.assign(retryWithBackoff, {
+  fail
+});
+
+// src/query/core/setupListeners.ts
+var INTERNAL_PREFIX = "__rtkq/";
+var ONLINE = "online";
+var OFFLINE = "offline";
+var FOCUS = "focus";
+var FOCUSED = "focused";
+var VISIBILITYCHANGE = "visibilitychange";
+var onFocus = /* @__PURE__ */ (0, import_toolkit.createAction)(`${INTERNAL_PREFIX}${FOCUSED}`);
+var onFocusLost = /* @__PURE__ */ (0, import_toolkit.createAction)(`${INTERNAL_PREFIX}un${FOCUSED}`);
+var onOnline = /* @__PURE__ */ (0, import_toolkit.createAction)(`${INTERNAL_PREFIX}${ONLINE}`);
+var onOffline = /* @__PURE__ */ (0, import_toolkit.createAction)(`${INTERNAL_PREFIX}${OFFLINE}`);
+var actions = {
+  onFocus,
+  onFocusLost,
+  onOnline,
+  onOffline
+};
+var initialized = false;
+function setupListeners(dispatch, customHandler) {
+  function defaultHandler() {
+    const [handleFocus, handleFocusLost, handleOnline, handleOffline] = [onFocus, onFocusLost, onOnline, onOffline].map((action) => () => dispatch(action()));
+    const handleVisibilityChange = () => {
+      if (window.document.visibilityState === "visible") {
+        handleFocus();
+      } else {
+        handleFocusLost();
+      }
+    };
+    let unsubscribe = () => {
+      initialized = false;
+    };
+    if (!initialized) {
+      if (typeof window !== "undefined" && window.addEventListener) {
+        let updateListeners2 = function(add) {
+          Object.entries(handlers).forEach(([event, handler]) => {
+            if (add) {
+              window.addEventListener(event, handler, false);
+            } else {
+              window.removeEventListener(event, handler);
+            }
+          });
+        };
+        var updateListeners = updateListeners2;
+        const handlers = {
+          [FOCUS]: handleFocus,
+          [VISIBILITYCHANGE]: handleVisibilityChange,
+          [ONLINE]: handleOnline,
+          [OFFLINE]: handleOffline
+        };
+        updateListeners2(true);
+        initialized = true;
+        unsubscribe = () => {
+          updateListeners2(false);
+          initialized = false;
+        };
+      }
+    }
+    return unsubscribe;
+  }
+  return customHandler ? customHandler(dispatch, actions) : defaultHandler();
+}
+
+// src/query/endpointDefinitions.ts
+var ENDPOINT_QUERY = "query" /* query */;
+var ENDPOINT_MUTATION = "mutation" /* mutation */;
+var ENDPOINT_INFINITEQUERY = "infinitequery" /* infinitequery */;
+function isQueryDefinition(e) {
+  return e.type === ENDPOINT_QUERY;
+}
+function isMutationDefinition(e) {
+  return e.type === ENDPOINT_MUTATION;
+}
+function isInfiniteQueryDefinition(e) {
+  return e.type === ENDPOINT_INFINITEQUERY;
+}
+function isAnyQueryDefinition(e) {
+  return isQueryDefinition(e) || isInfiniteQueryDefinition(e);
+}
+function calculateProvidedBy(description, result, error, queryArg, meta, assertTagTypes) {
+  const finalDescription = isFunction(description) ? description(result, error, queryArg, meta) : description;
+  if (finalDescription) {
+    return filterMap(finalDescription, isNotNullish, (tag) => assertTagTypes(expandTagDescription(tag)));
+  }
+  return [];
+}
+function isFunction(t) {
+  return typeof t === "function";
+}
+function expandTagDescription(description) {
+  return typeof description === "string" ? {
+    type: description
+  } : description;
+}
+
+// src/query/utils/immerImports.ts
+var import_immer = require("immer");
+
+// src/query/core/buildInitiate.ts
+var import_toolkit2 = require("@reduxjs/toolkit");
+
+// src/tsHelpers.ts
+function asSafePromise(promise, fallback) {
+  return promise.catch(fallback);
+}
+
+// src/query/apiTypes.ts
+var getEndpointDefinition = (context, endpointName) => context.endpointDefinitions[endpointName];
+
+// src/query/core/buildInitiate.ts
+var forceQueryFnSymbol = Symbol("forceQueryFn");
+var isUpsertQuery = (arg) => typeof arg[forceQueryFnSymbol] === "function";
+function buildInitiate({
+  serializeQueryArgs,
+  queryThunk,
+  infiniteQueryThunk,
+  mutationThunk,
+  api,
+  context,
+  getInternalState
+}) {
+  const getRunningQueries = (dispatch) => getInternalState(dispatch)?.runningQueries;
+  const getRunningMutations = (dispatch) => getInternalState(dispatch)?.runningMutations;
+  const {
+    unsubscribeQueryResult,
+    removeMutationResult,
+    updateSubscriptionOptions
+  } = api.internalActions;
+  return {
+    buildInitiateQuery,
+    buildInitiateInfiniteQuery,
+    buildInitiateMutation,
+    getRunningQueryThunk,
+    getRunningMutationThunk,
+    getRunningQueriesThunk,
+    getRunningMutationsThunk
+  };
+  function getRunningQueryThunk(endpointName, queryArgs) {
+    return (dispatch) => {
+      const endpointDefinition = getEndpointDefinition(context, endpointName);
+      const queryCacheKey = serializeQueryArgs({
+        queryArgs,
+        endpointDefinition,
+        endpointName
+      });
+      return getRunningQueries(dispatch)?.get(queryCacheKey);
+    };
+  }
+  function getRunningMutationThunk(_endpointName, fixedCacheKeyOrRequestId) {
+    return (dispatch) => {
+      return getRunningMutations(dispatch)?.get(fixedCacheKeyOrRequestId);
+    };
+  }
+  function getRunningQueriesThunk() {
+    return (dispatch) => filterNullishValues(getRunningQueries(dispatch));
+  }
+  function getRunningMutationsThunk() {
+    return (dispatch) => filterNullishValues(getRunningMutations(dispatch));
+  }
+  function middlewareWarning(dispatch) {
+    if (true) {
+      if (middlewareWarning.triggered) return;
+      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());
+      middlewareWarning.triggered = true;
+      if (typeof returnedValue !== "object" || typeof returnedValue?.type === "string") {
+        throw new Error(false ? _formatProdErrorMessage(34) : `Warning: Middleware for RTK-Query API at reducerPath "${api.reducerPath}" has not been added to the store.
+You must add the middleware for RTK-Query to function correctly!`);
+      }
+    }
+  }
+  function buildInitiateAnyQuery(endpointName, endpointDefinition) {
+    const queryAction = (arg, {
+      subscribe = true,
+      forceRefetch,
+      subscriptionOptions,
+      [forceQueryFnSymbol]: forceQueryFn,
+      ...rest
+    } = {}) => (dispatch, getState) => {
+      const queryCacheKey = serializeQueryArgs({
+        queryArgs: arg,
+        endpointDefinition,
+        endpointName
+      });
+      let thunk;
+      const commonThunkArgs = {
+        ...rest,
+        type: ENDPOINT_QUERY,
+        subscribe,
+        forceRefetch,
+        subscriptionOptions,
+        endpointName,
+        originalArgs: arg,
+        queryCacheKey,
+        [forceQueryFnSymbol]: forceQueryFn
+      };
+      if (isQueryDefinition(endpointDefinition)) {
+        thunk = queryThunk(commonThunkArgs);
+      } else {
+        const {
+          direction,
+          initialPageParam,
+          refetchCachedPages
+        } = rest;
+        thunk = infiniteQueryThunk({
+          ...commonThunkArgs,
+          // Supply these even if undefined. This helps with a field existence
+          // check over in `buildSlice.ts`
+          direction,
+          initialPageParam,
+          refetchCachedPages
+        });
+      }
+      const selector = api.endpoints[endpointName].select(arg);
+      const thunkResult = dispatch(thunk);
+      const stateAfter = selector(getState());
+      middlewareWarning(dispatch);
+      const {
+        requestId,
+        abort
+      } = thunkResult;
+      const skippedSynchronously = stateAfter.requestId !== requestId;
+      const runningQuery = getRunningQueries(dispatch)?.get(queryCacheKey);
+      const selectFromState = () => selector(getState());
+      const statePromise = Object.assign(forceQueryFn ? (
+        // a query has been forced (upsertQueryData)
+        // -> we want to resolve it once data has been written with the data that will be written
+        thunkResult.then(selectFromState)
+      ) : skippedSynchronously && !runningQuery ? (
+        // a query has been skipped due to a condition and we do not have any currently running query
+        // -> we want to resolve it immediately with the current data
+        Promise.resolve(stateAfter)
+      ) : (
+        // query just started or one is already in flight
+        // -> wait for the running query, then resolve with data from after that
+        Promise.all([runningQuery, thunkResult]).then(selectFromState)
+      ), {
+        arg,
+        requestId,
+        subscriptionOptions,
+        queryCacheKey,
+        abort,
+        async unwrap() {
+          const result = await statePromise;
+          if (result.isError) {
+            throw result.error;
+          }
+          return result.data;
+        },
+        refetch: (options) => dispatch(queryAction(arg, {
+          subscribe: false,
+          forceRefetch: true,
+          ...options
+        })),
+        unsubscribe() {
+          if (subscribe) dispatch(unsubscribeQueryResult({
+            queryCacheKey,
+            requestId
+          }));
+        },
+        updateSubscriptionOptions(options) {
+          statePromise.subscriptionOptions = options;
+          dispatch(updateSubscriptionOptions({
+            endpointName,
+            requestId,
+            queryCacheKey,
+            options
+          }));
+        }
+      });
+      if (!runningQuery && !skippedSynchronously && !forceQueryFn) {
+        const runningQueries = getRunningQueries(dispatch);
+        runningQueries.set(queryCacheKey, statePromise);
+        statePromise.then(() => {
+          runningQueries.delete(queryCacheKey);
+        });
+      }
+      return statePromise;
+    };
+    return queryAction;
+  }
+  function buildInitiateQuery(endpointName, endpointDefinition) {
+    const queryAction = buildInitiateAnyQuery(endpointName, endpointDefinition);
+    return queryAction;
+  }
+  function buildInitiateInfiniteQuery(endpointName, endpointDefinition) {
+    const infiniteQueryAction = buildInitiateAnyQuery(endpointName, endpointDefinition);
+    return infiniteQueryAction;
+  }
+  function buildInitiateMutation(endpointName) {
+    return (arg, {
+      track = true,
+      fixedCacheKey
+    } = {}) => (dispatch, getState) => {
+      const thunk = mutationThunk({
+        type: "mutation",
+        endpointName,
+        originalArgs: arg,
+        track,
+        fixedCacheKey
+      });
+      const thunkResult = dispatch(thunk);
+      middlewareWarning(dispatch);
+      const {
+        requestId,
+        abort,
+        unwrap
+      } = thunkResult;
+      const returnValuePromise = asSafePromise(thunkResult.unwrap().then((data) => ({
+        data
+      })), (error) => ({
+        error
+      }));
+      const reset = () => {
+        dispatch(removeMutationResult({
+          requestId,
+          fixedCacheKey
+        }));
+      };
+      const ret = Object.assign(returnValuePromise, {
+        arg: thunkResult.arg,
+        requestId,
+        abort,
+        unwrap,
+        reset
+      });
+      const runningMutations = getRunningMutations(dispatch);
+      runningMutations.set(requestId, ret);
+      ret.then(() => {
+        runningMutations.delete(requestId);
+      });
+      if (fixedCacheKey) {
+        runningMutations.set(fixedCacheKey, ret);
+        ret.then(() => {
+          if (runningMutations.get(fixedCacheKey) === ret) {
+            runningMutations.delete(fixedCacheKey);
+          }
+        });
+      }
+      return ret;
+    };
+  }
+}
+
+// src/query/standardSchema.ts
+var import_utils4 = require("@standard-schema/utils");
+var NamedSchemaError = class extends import_utils4.SchemaError {
+  constructor(issues, value, schemaName, _bqMeta) {
+    super(issues);
+    this.value = value;
+    this.schemaName = schemaName;
+    this._bqMeta = _bqMeta;
+  }
+};
+var shouldSkip = (skipSchemaValidation, schemaName) => Array.isArray(skipSchemaValidation) ? skipSchemaValidation.includes(schemaName) : !!skipSchemaValidation;
+async function parseWithSchema(schema, data, schemaName, bqMeta) {
+  const result = await schema["~standard"].validate(data);
+  if (result.issues) {
+    throw new NamedSchemaError(result.issues, data, schemaName, bqMeta);
+  }
+  return result.value;
+}
+
+// src/query/core/buildThunks.ts
+function defaultTransformResponse(baseQueryReturnValue) {
+  return baseQueryReturnValue;
+}
+var addShouldAutoBatch = (arg = {}) => {
+  return {
+    ...arg,
+    [import_toolkit.SHOULD_AUTOBATCH]: true
+  };
+};
+function buildThunks({
+  reducerPath,
+  baseQuery,
+  context: {
+    endpointDefinitions
+  },
+  serializeQueryArgs,
+  api,
+  assertTagType,
+  selectors,
+  onSchemaFailure,
+  catchSchemaFailure: globalCatchSchemaFailure,
+  skipSchemaValidation: globalSkipSchemaValidation
+}) {
+  const patchQueryData = (endpointName, arg, patches, updateProvided) => (dispatch, getState) => {
+    const endpointDefinition = endpointDefinitions[endpointName];
+    const queryCacheKey = serializeQueryArgs({
+      queryArgs: arg,
+      endpointDefinition,
+      endpointName
+    });
+    dispatch(api.internalActions.queryResultPatched({
+      queryCacheKey,
+      patches
+    }));
+    if (!updateProvided) {
+      return;
+    }
+    const newValue = api.endpoints[endpointName].select(arg)(
+      // Work around TS 4.1 mismatch
+      getState()
+    );
+    const providedTags = calculateProvidedBy(endpointDefinition.providesTags, newValue.data, void 0, arg, {}, assertTagType);
+    dispatch(api.internalActions.updateProvidedBy([{
+      queryCacheKey,
+      providedTags
+    }]));
+  };
+  function addToStart(items, item, max = 0) {
+    const newItems = [item, ...items];
+    return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
+  }
+  function addToEnd(items, item, max = 0) {
+    const newItems = [...items, item];
+    return max && newItems.length > max ? newItems.slice(1) : newItems;
+  }
+  const updateQueryData = (endpointName, arg, updateRecipe, updateProvided = true) => (dispatch, getState) => {
+    const endpointDefinition = api.endpoints[endpointName];
+    const currentState = endpointDefinition.select(arg)(
+      // Work around TS 4.1 mismatch
+      getState()
+    );
+    const ret = {
+      patches: [],
+      inversePatches: [],
+      undo: () => dispatch(api.util.patchQueryData(endpointName, arg, ret.inversePatches, updateProvided))
+    };
+    if (currentState.status === STATUS_UNINITIALIZED) {
+      return ret;
+    }
+    let newValue;
+    if ("data" in currentState) {
+      if ((0, import_immer.isDraftable)(currentState.data)) {
+        const [value, patches, inversePatches] = (0, import_immer.produceWithPatches)(currentState.data, updateRecipe);
+        ret.patches.push(...patches);
+        ret.inversePatches.push(...inversePatches);
+        newValue = value;
+      } else {
+        newValue = updateRecipe(currentState.data);
+        ret.patches.push({
+          op: "replace",
+          path: [],
+          value: newValue
+        });
+        ret.inversePatches.push({
+          op: "replace",
+          path: [],
+          value: currentState.data
+        });
+      }
+    }
+    if (ret.patches.length === 0) {
+      return ret;
+    }
+    dispatch(api.util.patchQueryData(endpointName, arg, ret.patches, updateProvided));
+    return ret;
+  };
+  const upsertQueryData = (endpointName, arg, value) => (dispatch) => {
+    const res = dispatch(api.endpoints[endpointName].initiate(arg, {
+      subscribe: false,
+      forceRefetch: true,
+      [forceQueryFnSymbol]: () => ({
+        data: value
+      })
+    }));
+    return res;
+  };
+  const getTransformCallbackForEndpoint = (endpointDefinition, transformFieldName) => {
+    return endpointDefinition.query && endpointDefinition[transformFieldName] ? endpointDefinition[transformFieldName] : defaultTransformResponse;
+  };
+  const executeEndpoint = async (arg, {
+    signal,
+    abort,
+    rejectWithValue,
+    fulfillWithValue,
+    dispatch,
+    getState,
+    extra
+  }) => {
+    const endpointDefinition = endpointDefinitions[arg.endpointName];
+    const {
+      metaSchema,
+      skipSchemaValidation = globalSkipSchemaValidation
+    } = endpointDefinition;
+    const isQuery = arg.type === ENDPOINT_QUERY;
+    try {
+      let transformResponse = defaultTransformResponse;
+      const baseQueryApi = {
+        signal,
+        abort,
+        dispatch,
+        getState,
+        extra,
+        endpoint: arg.endpointName,
+        type: arg.type,
+        forced: isQuery ? isForcedQuery(arg, getState()) : void 0,
+        queryCacheKey: isQuery ? arg.queryCacheKey : void 0
+      };
+      const forceQueryFn = isQuery ? arg[forceQueryFnSymbol] : void 0;
+      let finalQueryReturnValue;
+      const fetchPage = async (data, param, maxPages, previous) => {
+        if (param == null && data.pages.length) {
+          return Promise.resolve({
+            data
+          });
+        }
+        const finalQueryArg = {
+          queryArg: arg.originalArgs,
+          pageParam: param
+        };
+        const pageResponse = await executeRequest(finalQueryArg);
+        const addTo = previous ? addToStart : addToEnd;
+        return {
+          data: {
+            pages: addTo(data.pages, pageResponse.data, maxPages),
+            pageParams: addTo(data.pageParams, param, maxPages)
+          },
+          meta: pageResponse.meta
+        };
+      };
+      async function executeRequest(finalQueryArg) {
+        let result;
+        const {
+          extraOptions,
+          argSchema,
+          rawResponseSchema,
+          responseSchema
+        } = endpointDefinition;
+        if (argSchema && !shouldSkip(skipSchemaValidation, "arg")) {
+          finalQueryArg = await parseWithSchema(
+            argSchema,
+            finalQueryArg,
+            "argSchema",
+            {}
+            // we don't have a meta yet, so we can't pass it
+          );
+        }
+        if (forceQueryFn) {
+          result = forceQueryFn();
+        } else if (endpointDefinition.query) {
+          transformResponse = getTransformCallbackForEndpoint(endpointDefinition, "transformResponse");
+          result = await baseQuery(endpointDefinition.query(finalQueryArg), baseQueryApi, extraOptions);
+        } else {
+          result = await endpointDefinition.queryFn(finalQueryArg, baseQueryApi, extraOptions, (arg2) => baseQuery(arg2, baseQueryApi, extraOptions));
+        }
+        if (typeof process !== "undefined" && true) {
+          const what = endpointDefinition.query ? "`baseQuery`" : "`queryFn`";
+          let err;
+          if (!result) {
+            err = `${what} did not return anything.`;
+          } else if (typeof result !== "object") {
+            err = `${what} did not return an object.`;
+          } else if (result.error && result.data) {
+            err = `${what} returned an object containing both \`error\` and \`result\`.`;
+          } else if (result.error === void 0 && result.data === void 0) {
+            err = `${what} returned an object containing neither a valid \`error\` and \`result\`. At least one of them should not be \`undefined\``;
+          } else {
+            for (const key of Object.keys(result)) {
+              if (key !== "error" && key !== "data" && key !== "meta") {
+                err = `The object returned by ${what} has the unknown property ${key}.`;
+                break;
+              }
+            }
+          }
+          if (err) {
+            console.error(`Error encountered handling the endpoint ${arg.endpointName}.
+                  ${err}
+                  It needs to return an object with either the shape \`{ data: <value> }\` or \`{ error: <value> }\` that may contain an optional \`meta\` property.
+                  Object returned was:`, result);
+          }
+        }
+        if (result.error) throw new HandledError(result.error, result.meta);
+        let {
+          data
+        } = result;
+        if (rawResponseSchema && !shouldSkip(skipSchemaValidation, "rawResponse")) {
+          data = await parseWithSchema(rawResponseSchema, result.data, "rawResponseSchema", result.meta);
+        }
+        let transformedResponse = await transformResponse(data, result.meta, finalQueryArg);
+        if (responseSchema && !shouldSkip(skipSchemaValidation, "response")) {
+          transformedResponse = await parseWithSchema(responseSchema, transformedResponse, "responseSchema", result.meta);
+        }
+        return {
+          ...result,
+          data: transformedResponse
+        };
+      }
+      if (isQuery && "infiniteQueryOptions" in endpointDefinition) {
+        const {
+          infiniteQueryOptions
+        } = endpointDefinition;
+        const {
+          maxPages = Infinity
+        } = infiniteQueryOptions;
+        const refetchCachedPages = arg.refetchCachedPages ?? infiniteQueryOptions.refetchCachedPages ?? true;
+        let result;
+        const blankData = {
+          pages: [],
+          pageParams: []
+        };
+        const cachedData = selectors.selectQueryEntry(getState(), arg.queryCacheKey)?.data;
+        const isForcedQueryNeedingRefetch = (
+          // arg.forceRefetch
+          isForcedQuery(arg, getState()) && !arg.direction
+        );
+        const existingData = isForcedQueryNeedingRefetch || !cachedData ? blankData : cachedData;
+        if ("direction" in arg && arg.direction && existingData.pages.length) {
+          const previous = arg.direction === "backward";
+          const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
+          const param = pageParamFn(infiniteQueryOptions, existingData, arg.originalArgs);
+          result = await fetchPage(existingData, param, maxPages, previous);
+        } else {
+          const {
+            initialPageParam = infiniteQueryOptions.initialPageParam
+          } = arg;
+          const cachedPageParams = cachedData?.pageParams ?? [];
+          const firstPageParam = cachedPageParams[0] ?? initialPageParam;
+          const totalPages = cachedPageParams.length;
+          result = await fetchPage(existingData, firstPageParam, maxPages);
+          if (forceQueryFn) {
+            result = {
+              data: result.data.pages[0]
+            };
+          }
+          if (refetchCachedPages) {
+            for (let i = 1; i < totalPages; i++) {
+              const param = getNextPageParam(infiniteQueryOptions, result.data, arg.originalArgs);
+              result = await fetchPage(result.data, param, maxPages);
+            }
+          }
+        }
+        finalQueryReturnValue = result;
+      } else {
+        finalQueryReturnValue = await executeRequest(arg.originalArgs);
+      }
+      if (metaSchema && !shouldSkip(skipSchemaValidation, "meta") && finalQueryReturnValue.meta) {
+        finalQueryReturnValue.meta = await parseWithSchema(metaSchema, finalQueryReturnValue.meta, "metaSchema", finalQueryReturnValue.meta);
+      }
+      return fulfillWithValue(finalQueryReturnValue.data, addShouldAutoBatch({
+        fulfilledTimeStamp: Date.now(),
+        baseQueryMeta: finalQueryReturnValue.meta
+      }));
+    } catch (error) {
+      let caughtError = error;
+      if (caughtError instanceof HandledError) {
+        let transformErrorResponse = getTransformCallbackForEndpoint(endpointDefinition, "transformErrorResponse");
+        const {
+          rawErrorResponseSchema,
+          errorResponseSchema
+        } = endpointDefinition;
+        let {
+          value,
+          meta
+        } = caughtError;
+        try {
+          if (rawErrorResponseSchema && !shouldSkip(skipSchemaValidation, "rawErrorResponse")) {
+            value = await parseWithSchema(rawErrorResponseSchema, value, "rawErrorResponseSchema", meta);
+          }
+          if (metaSchema && !shouldSkip(skipSchemaValidation, "meta")) {
+            meta = await parseWithSchema(metaSchema, meta, "metaSchema", meta);
+          }
+          let transformedErrorResponse = await transformErrorResponse(value, meta, arg.originalArgs);
+          if (errorResponseSchema && !shouldSkip(skipSchemaValidation, "errorResponse")) {
+            transformedErrorResponse = await parseWithSchema(errorResponseSchema, transformedErrorResponse, "errorResponseSchema", meta);
+          }
+          return rejectWithValue(transformedErrorResponse, addShouldAutoBatch({
+            baseQueryMeta: meta
+          }));
+        } catch (e) {
+          caughtError = e;
+        }
+      }
+      try {
+        if (caughtError instanceof NamedSchemaError) {
+          const info = {
+            endpoint: arg.endpointName,
+            arg: arg.originalArgs,
+            type: arg.type,
+            queryCacheKey: isQuery ? arg.queryCacheKey : void 0
+          };
+          endpointDefinition.onSchemaFailure?.(caughtError, info);
+          onSchemaFailure?.(caughtError, info);
+          const {
+            catchSchemaFailure = globalCatchSchemaFailure
+          } = endpointDefinition;
+          if (catchSchemaFailure) {
+            return rejectWithValue(catchSchemaFailure(caughtError, info), addShouldAutoBatch({
+              baseQueryMeta: caughtError._bqMeta
+            }));
+          }
+        }
+      } catch (e) {
+        caughtError = e;
+      }
+      if (typeof process !== "undefined" && true) {
+        console.error(`An unhandled error occurred processing a request for the endpoint "${arg.endpointName}".
+In the case of an unhandled error, no tags will be "provided" or "invalidated".`, caughtError);
+      } else {
+        console.error(caughtError);
+      }
+      throw caughtError;
+    }
+  };
+  function isForcedQuery(arg, state) {
+    const requestState = selectors.selectQueryEntry(state, arg.queryCacheKey);
+    const baseFetchOnMountOrArgChange = selectors.selectConfig(state).refetchOnMountOrArgChange;
+    const fulfilledVal = requestState?.fulfilledTimeStamp;
+    const refetchVal = arg.forceRefetch ?? (arg.subscribe && baseFetchOnMountOrArgChange);
+    if (refetchVal) {
+      return refetchVal === true || (Number(/* @__PURE__ */ new Date()) - Number(fulfilledVal)) / 1e3 >= refetchVal;
+    }
+    return false;
+  }
+  const createQueryThunk = () => {
+    const generatedQueryThunk = (0, import_toolkit.createAsyncThunk)(`${reducerPath}/executeQuery`, executeEndpoint, {
+      getPendingMeta({
+        arg
+      }) {
+        const endpointDefinition = endpointDefinitions[arg.endpointName];
+        return addShouldAutoBatch({
+          startedTimeStamp: Date.now(),
+          ...isInfiniteQueryDefinition(endpointDefinition) ? {
+            direction: arg.direction
+          } : {}
+        });
+      },
+      condition(queryThunkArg, {
+        getState
+      }) {
+        const state = getState();
+        const requestState = selectors.selectQueryEntry(state, queryThunkArg.queryCacheKey);
+        const fulfilledVal = requestState?.fulfilledTimeStamp;
+        const currentArg = queryThunkArg.originalArgs;
+        const previousArg = requestState?.originalArgs;
+        const endpointDefinition = endpointDefinitions[queryThunkArg.endpointName];
+        const direction = queryThunkArg.direction;
+        if (isUpsertQuery(queryThunkArg)) {
+          return true;
+        }
+        if (requestState?.status === "pending") {
+          return false;
+        }
+        if (isForcedQuery(queryThunkArg, state)) {
+          return true;
+        }
+        if (isQueryDefinition(endpointDefinition) && endpointDefinition?.forceRefetch?.({
+          currentArg,
+          previousArg,
+          endpointState: requestState,
+          state
+        })) {
+          return true;
+        }
+        if (fulfilledVal && !direction) {
+          return false;
+        }
+        return true;
+      },
+      dispatchConditionRejection: true
+    });
+    return generatedQueryThunk;
+  };
+  const queryThunk = createQueryThunk();
+  const infiniteQueryThunk = createQueryThunk();
+  const mutationThunk = (0, import_toolkit.createAsyncThunk)(`${reducerPath}/executeMutation`, executeEndpoint, {
+    getPendingMeta() {
+      return addShouldAutoBatch({
+        startedTimeStamp: Date.now()
+      });
+    }
+  });
+  const hasTheForce = (options) => "force" in options;
+  const hasMaxAge = (options) => "ifOlderThan" in options;
+  const prefetch = (endpointName, arg, options = {}) => (dispatch, getState) => {
+    const force = hasTheForce(options) && options.force;
+    const maxAge = hasMaxAge(options) && options.ifOlderThan;
+    const queryAction = (force2 = true) => {
+      const options2 = {
+        forceRefetch: force2,
+        subscribe: false
+      };
+      return api.endpoints[endpointName].initiate(arg, options2);
+    };
+    const latestStateValue = api.endpoints[endpointName].select(arg)(getState());
+    if (force) {
+      dispatch(queryAction());
+    } else if (maxAge) {
+      const lastFulfilledTs = latestStateValue?.fulfilledTimeStamp;
+      if (!lastFulfilledTs) {
+        dispatch(queryAction());
+        return;
+      }
+      const shouldRetrigger = (Number(/* @__PURE__ */ new Date()) - Number(new Date(lastFulfilledTs))) / 1e3 >= maxAge;
+      if (shouldRetrigger) {
+        dispatch(queryAction());
+      }
+    } else {
+      dispatch(queryAction(false));
+    }
+  };
+  function matchesEndpoint(endpointName) {
+    return (action) => action?.meta?.arg?.endpointName === endpointName;
+  }
+  function buildMatchThunkActions(thunk, endpointName) {
+    return {
+      matchPending: (0, import_toolkit.isAllOf)((0, import_toolkit.isPending)(thunk), matchesEndpoint(endpointName)),
+      matchFulfilled: (0, import_toolkit.isAllOf)((0, import_toolkit.isFulfilled)(thunk), matchesEndpoint(endpointName)),
+      matchRejected: (0, import_toolkit.isAllOf)((0, import_toolkit.isRejected)(thunk), matchesEndpoint(endpointName))
+    };
+  }
+  return {
+    queryThunk,
+    mutationThunk,
+    infiniteQueryThunk,
+    prefetch,
+    updateQueryData,
+    upsertQueryData,
+    patchQueryData,
+    buildMatchThunkActions
+  };
+}
+function getNextPageParam(options, {
+  pages,
+  pageParams
+}, queryArg) {
+  const lastIndex = pages.length - 1;
+  return options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams, queryArg);
+}
+function getPreviousPageParam(options, {
+  pages,
+  pageParams
+}, queryArg) {
+  return options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams, queryArg);
+}
+function calculateProvidedByThunk(action, type, endpointDefinitions, assertTagType) {
+  return calculateProvidedBy(endpointDefinitions[action.meta.arg.endpointName][type], (0, import_toolkit.isFulfilled)(action) ? action.payload : void 0, (0, import_toolkit.isRejectedWithValue)(action) ? action.payload : void 0, action.meta.arg.originalArgs, "baseQueryMeta" in action.meta ? action.meta.baseQueryMeta : void 0, assertTagType);
+}
+
+// src/query/utils/getCurrent.ts
+function getCurrent(value) {
+  return (0, import_immer.isDraft)(value) ? (0, import_immer.current)(value) : value;
+}
+
+// src/query/core/buildSlice.ts
+function updateQuerySubstateIfExists(state, queryCacheKey, update) {
+  const substate = state[queryCacheKey];
+  if (substate) {
+    update(substate);
+  }
+}
+function getMutationCacheKey(id) {
+  return ("arg" in id ? id.arg.fixedCacheKey : id.fixedCacheKey) ?? id.requestId;
+}
+function updateMutationSubstateIfExists(state, id, update) {
+  const substate = state[getMutationCacheKey(id)];
+  if (substate) {
+    update(substate);
+  }
+}
+var initialState = {};
+function buildSlice({
+  reducerPath,
+  queryThunk,
+  mutationThunk,
+  serializeQueryArgs,
+  context: {
+    endpointDefinitions: definitions,
+    apiUid,
+    extractRehydrationInfo,
+    hasRehydrationInfo
+  },
+  assertTagType,
+  config
+}) {
+  const resetApiState = (0, import_toolkit.createAction)(`${reducerPath}/resetApiState`);
+  function writePendingCacheEntry(draft, arg, upserting, meta) {
+    draft[arg.queryCacheKey] ??= {
+      status: STATUS_UNINITIALIZED,
+      endpointName: arg.endpointName
+    };
+    updateQuerySubstateIfExists(draft, arg.queryCacheKey, (substate) => {
+      substate.status = STATUS_PENDING;
+      substate.requestId = upserting && substate.requestId ? (
+        // for `upsertQuery` **updates**, keep the current `requestId`
+        substate.requestId
+      ) : (
+        // for normal queries or `upsertQuery` **inserts** always update the `requestId`
+        meta.requestId
+      );
+      if (arg.originalArgs !== void 0) {
+        substate.originalArgs = arg.originalArgs;
+      }
+      substate.startedTimeStamp = meta.startedTimeStamp;
+      const endpointDefinition = definitions[meta.arg.endpointName];
+      if (isInfiniteQueryDefinition(endpointDefinition) && "direction" in arg) {
+        ;
+        substate.direction = arg.direction;
+      }
+    });
+  }
+  function writeFulfilledCacheEntry(draft, meta, payload, upserting) {
+    updateQuerySubstateIfExists(draft, meta.arg.queryCacheKey, (substate) => {
+      if (substate.requestId !== meta.requestId && !upserting) return;
+      const {
+        merge
+      } = definitions[meta.arg.endpointName];
+      substate.status = STATUS_FULFILLED;
+      if (merge) {
+        if (substate.data !== void 0) {
+          const {
+            fulfilledTimeStamp,
+            arg,
+            baseQueryMeta,
+            requestId
+          } = meta;
+          let newData = (0, import_toolkit.createNextState)(substate.data, (draftSubstateData) => {
+            return merge(draftSubstateData, payload, {
+              arg: arg.originalArgs,
+              baseQueryMeta,
+              fulfilledTimeStamp,
+              requestId
+            });
+          });
+          substate.data = newData;
+        } else {
+          substate.data = payload;
+        }
+      } else {
+        substate.data = definitions[meta.arg.endpointName].structuralSharing ?? true ? copyWithStructuralSharing((0, import_immer.isDraft)(substate.data) ? (0, import_immer.original)(substate.data) : substate.data, payload) : payload;
+      }
+      delete substate.error;
+      substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;
+    });
+  }
+  const querySlice = (0, import_toolkit.createSlice)({
+    name: `${reducerPath}/queries`,
+    initialState,
+    reducers: {
+      removeQueryResult: {
+        reducer(draft, {
+          payload: {
+            queryCacheKey
+          }
+        }) {
+          delete draft[queryCacheKey];
+        },
+        prepare: (0, import_toolkit.prepareAutoBatched)()
+      },
+      cacheEntriesUpserted: {
+        reducer(draft, action) {
+          for (const entry of action.payload) {
+            const {
+              queryDescription: arg,
+              value
+            } = entry;
+            writePendingCacheEntry(draft, arg, true, {
+              arg,
+              requestId: action.meta.requestId,
+              startedTimeStamp: action.meta.timestamp
+            });
+            writeFulfilledCacheEntry(
+              draft,
+              {
+                arg,
+                requestId: action.meta.requestId,
+                fulfilledTimeStamp: action.meta.timestamp,
+                baseQueryMeta: {}
+              },
+              value,
+              // We know we're upserting here
+              true
+            );
+          }
+        },
+        prepare: (payload) => {
+          const queryDescriptions = payload.map((entry) => {
+            const {
+              endpointName,
+              arg,
+              value
+            } = entry;
+            const endpointDefinition = definitions[endpointName];
+            const queryDescription = {
+              type: ENDPOINT_QUERY,
+              endpointName,
+              originalArgs: entry.arg,
+              queryCacheKey: serializeQueryArgs({
+                queryArgs: arg,
+                endpointDefinition,
+                endpointName
+              })
+            };
+            return {
+              queryDescription,
+              value
+            };
+          });
+          const result = {
+            payload: queryDescriptions,
+            meta: {
+              [import_toolkit.SHOULD_AUTOBATCH]: true,
+              requestId: (0, import_toolkit.nanoid)(),
+              timestamp: Date.now()
+            }
+          };
+          return result;
+        }
+      },
+      queryResultPatched: {
+        reducer(draft, {
+          payload: {
+            queryCacheKey,
+            patches
+          }
+        }) {
+          updateQuerySubstateIfExists(draft, queryCacheKey, (substate) => {
+            substate.data = (0, import_immer.applyPatches)(substate.data, patches.concat());
+          });
+        },
+        prepare: (0, import_toolkit.prepareAutoBatched)()
+      }
+    },
+    extraReducers(builder) {
+      builder.addCase(queryThunk.pending, (draft, {
+        meta,
+        meta: {
+          arg
+        }
+      }) => {
+        const upserting = isUpsertQuery(arg);
+        writePendingCacheEntry(draft, arg, upserting, meta);
+      }).addCase(queryThunk.fulfilled, (draft, {
+        meta,
+        payload
+      }) => {
+        const upserting = isUpsertQuery(meta.arg);
+        writeFulfilledCacheEntry(draft, meta, payload, upserting);
+      }).addCase(queryThunk.rejected, (draft, {
+        meta: {
+          condition,
+          arg,
+          requestId
+        },
+        error,
+        payload
+      }) => {
+        updateQuerySubstateIfExists(draft, arg.queryCacheKey, (substate) => {
+          if (condition) {
+          } else {
+            if (substate.requestId !== requestId) return;
+            substate.status = STATUS_REJECTED;
+            substate.error = payload ?? error;
+          }
+        });
+      }).addMatcher(hasRehydrationInfo, (draft, action) => {
+        const {
+          queries
+        } = extractRehydrationInfo(action);
+        for (const [key, entry] of Object.entries(queries)) {
+          if (
+            // do not rehydrate entries that were currently in flight.
+            entry?.status === STATUS_FULFILLED || entry?.status === STATUS_REJECTED
+          ) {
+            draft[key] = entry;
+          }
+        }
+      });
+    }
+  });
+  const mutationSlice = (0, import_toolkit.createSlice)({
+    name: `${reducerPath}/mutations`,
+    initialState,
+    reducers: {
+      removeMutationResult: {
+        reducer(draft, {
+          payload
+        }) {
+          const cacheKey = getMutationCacheKey(payload);
+          if (cacheKey in draft) {
+            delete draft[cacheKey];
+          }
+        },
+        prepare: (0, import_toolkit.prepareAutoBatched)()
+      }
+    },
+    extraReducers(builder) {
+      builder.addCase(mutationThunk.pending, (draft, {
+        meta,
+        meta: {
+          requestId,
+          arg,
+          startedTimeStamp
+        }
+      }) => {
+        if (!arg.track) return;
+        draft[getMutationCacheKey(meta)] = {
+          requestId,
+          status: STATUS_PENDING,
+          endpointName: arg.endpointName,
+          startedTimeStamp
+        };
+      }).addCase(mutationThunk.fulfilled, (draft, {
+        payload,
+        meta
+      }) => {
+        if (!meta.arg.track) return;
+        updateMutationSubstateIfExists(draft, meta, (substate) => {
+          if (substate.requestId !== meta.requestId) return;
+          substate.status = STATUS_FULFILLED;
+          substate.data = payload;
+          substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;
+        });
+      }).addCase(mutationThunk.rejected, (draft, {
+        payload,
+        error,
+        meta
+      }) => {
+        if (!meta.arg.track) return;
+        updateMutationSubstateIfExists(draft, meta, (substate) => {
+          if (substate.requestId !== meta.requestId) return;
+          substate.status = STATUS_REJECTED;
+          substate.error = payload ?? error;
+        });
+      }).addMatcher(hasRehydrationInfo, (draft, action) => {
+        const {
+          mutations
+        } = extractRehydrationInfo(action);
+        for (const [key, entry] of Object.entries(mutations)) {
+          if (
+            // do not rehydrate entries that were currently in flight.
+            (entry?.status === STATUS_FULFILLED || entry?.status === STATUS_REJECTED) && // only rehydrate endpoints that were persisted using a `fixedCacheKey`
+            key !== entry?.requestId
+          ) {
+            draft[key] = entry;
+          }
+        }
+      });
+    }
+  });
+  const initialInvalidationState = {
+    tags: {},
+    keys: {}
+  };
+  const invalidationSlice = (0, import_toolkit.createSlice)({
+    name: `${reducerPath}/invalidation`,
+    initialState: initialInvalidationState,
+    reducers: {
+      updateProvidedBy: {
+        reducer(draft, action) {
+          for (const {
+            queryCacheKey,
+            providedTags
+          } of action.payload) {
+            removeCacheKeyFromTags(draft, queryCacheKey);
+            for (const {
+              type,
+              id
+            } of providedTags) {
+              const subscribedQueries = (draft.tags[type] ??= {})[id || "__internal_without_id"] ??= [];
+              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);
+              if (!alreadySubscribed) {
+                subscribedQueries.push(queryCacheKey);
+              }
+            }
+            draft.keys[queryCacheKey] = providedTags;
+          }
+        },
+        prepare: (0, import_toolkit.prepareAutoBatched)()
+      }
+    },
+    extraReducers(builder) {
+      builder.addCase(querySlice.actions.removeQueryResult, (draft, {
+        payload: {
+          queryCacheKey
+        }
+      }) => {
+        removeCacheKeyFromTags(draft, queryCacheKey);
+      }).addMatcher(hasRehydrationInfo, (draft, action) => {
+        const {
+          provided
+        } = extractRehydrationInfo(action);
+        for (const [type, incomingTags] of Object.entries(provided.tags ?? {})) {
+          for (const [id, cacheKeys] of Object.entries(incomingTags)) {
+            const subscribedQueries = (draft.tags[type] ??= {})[id || "__internal_without_id"] ??= [];
+            for (const queryCacheKey of cacheKeys) {
+              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);
+              if (!alreadySubscribed) {
+                subscribedQueries.push(queryCacheKey);
+              }
+              draft.keys[queryCacheKey] = provided.keys[queryCacheKey];
+            }
+          }
+        }
+      }).addMatcher((0, import_toolkit.isAnyOf)((0, import_toolkit.isFulfilled)(queryThunk), (0, import_toolkit.isRejectedWithValue)(queryThunk)), (draft, action) => {
+        writeProvidedTagsForQueries(draft, [action]);
+      }).addMatcher(querySlice.actions.cacheEntriesUpserted.match, (draft, action) => {
+        const mockActions = action.payload.map(({
+          queryDescription,
+          value
+        }) => {
+          return {
+            type: "UNKNOWN",
+            payload: value,
+            meta: {
+              requestStatus: "fulfilled",
+              requestId: "UNKNOWN",
+              arg: queryDescription
+            }
+          };
+        });
+        writeProvidedTagsForQueries(draft, mockActions);
+      });
+    }
+  });
+  function removeCacheKeyFromTags(draft, queryCacheKey) {
+    const existingTags = getCurrent(draft.keys[queryCacheKey] ?? []);
+    for (const tag of existingTags) {
+      const tagType = tag.type;
+      const tagId = tag.id ?? "__internal_without_id";
+      const tagSubscriptions = draft.tags[tagType]?.[tagId];
+      if (tagSubscriptions) {
+        draft.tags[tagType][tagId] = getCurrent(tagSubscriptions).filter((qc) => qc !== queryCacheKey);
+      }
+    }
+    delete draft.keys[queryCacheKey];
+  }
+  function writeProvidedTagsForQueries(draft, actions3) {
+    const providedByEntries = actions3.map((action) => {
+      const providedTags = calculateProvidedByThunk(action, "providesTags", definitions, assertTagType);
+      const {
+        queryCacheKey
+      } = action.meta.arg;
+      return {
+        queryCacheKey,
+        providedTags
+      };
+    });
+    invalidationSlice.caseReducers.updateProvidedBy(draft, invalidationSlice.actions.updateProvidedBy(providedByEntries));
+  }
+  const subscriptionSlice = (0, import_toolkit.createSlice)({
+    name: `${reducerPath}/subscriptions`,
+    initialState,
+    reducers: {
+      updateSubscriptionOptions(d, a) {
+      },
+      unsubscribeQueryResult(d, a) {
+      },
+      internal_getRTKQSubscriptions() {
+      }
+    }
+  });
+  const internalSubscriptionsSlice = (0, import_toolkit.createSlice)({
+    name: `${reducerPath}/internalSubscriptions`,
+    initialState,
+    reducers: {
+      subscriptionsUpdated: {
+        reducer(state, action) {
+          return (0, import_immer.applyPatches)(state, action.payload);
+        },
+        prepare: (0, import_toolkit.prepareAutoBatched)()
+      }
+    }
+  });
+  const configSlice = (0, import_toolkit.createSlice)({
+    name: `${reducerPath}/config`,
+    initialState: {
+      online: isOnline(),
+      focused: isDocumentVisible(),
+      middlewareRegistered: false,
+      ...config
+    },
+    reducers: {
+      middlewareRegistered(state, {
+        payload
+      }) {
+        state.middlewareRegistered = state.middlewareRegistered === "conflict" || apiUid !== payload ? "conflict" : true;
+      }
+    },
+    extraReducers: (builder) => {
+      builder.addCase(onOnline, (state) => {
+        state.online = true;
+      }).addCase(onOffline, (state) => {
+        state.online = false;
+      }).addCase(onFocus, (state) => {
+        state.focused = true;
+      }).addCase(onFocusLost, (state) => {
+        state.focused = false;
+      }).addMatcher(hasRehydrationInfo, (draft) => ({
+        ...draft
+      }));
+    }
+  });
+  const combinedReducer = (0, import_toolkit.combineReducers)({
+    queries: querySlice.reducer,
+    mutations: mutationSlice.reducer,
+    provided: invalidationSlice.reducer,
+    subscriptions: internalSubscriptionsSlice.reducer,
+    config: configSlice.reducer
+  });
+  const reducer = (state, action) => combinedReducer(resetApiState.match(action) ? void 0 : state, action);
+  const actions2 = {
+    ...configSlice.actions,
+    ...querySlice.actions,
+    ...subscriptionSlice.actions,
+    ...internalSubscriptionsSlice.actions,
+    ...mutationSlice.actions,
+    ...invalidationSlice.actions,
+    resetApiState
+  };
+  return {
+    reducer,
+    actions: actions2
+  };
+}
+
+// src/query/core/buildSelectors.ts
+var skipToken = /* @__PURE__ */ Symbol.for("RTKQ/skipToken");
+var initialSubState = {
+  status: STATUS_UNINITIALIZED
+};
+var defaultQuerySubState = /* @__PURE__ */ (0, import_toolkit.createNextState)(initialSubState, () => {
+});
+var defaultMutationSubState = /* @__PURE__ */ (0, import_toolkit.createNextState)(initialSubState, () => {
+});
+function buildSelectors({
+  serializeQueryArgs,
+  reducerPath,
+  createSelector: createSelector2
+}) {
+  const selectSkippedQuery = (state) => defaultQuerySubState;
+  const selectSkippedMutation = (state) => defaultMutationSubState;
+  return {
+    buildQuerySelector,
+    buildInfiniteQuerySelector,
+    buildMutationSelector,
+    selectInvalidatedBy,
+    selectCachedArgsForQuery,
+    selectApiState,
+    selectQueries,
+    selectMutations,
+    selectQueryEntry,
+    selectConfig
+  };
+  function withRequestFlags(substate) {
+    return {
+      ...substate,
+      ...getRequestStatusFlags(substate.status)
+    };
+  }
+  function selectApiState(rootState) {
+    const state = rootState[reducerPath];
+    if (true) {
+      if (!state) {
+        if (selectApiState.triggered) return state;
+        selectApiState.triggered = true;
+        console.error(`Error: No data found at \`state.${reducerPath}\`. Did you forget to add the reducer to the store?`);
+      }
+    }
+    return state;
+  }
+  function selectQueries(rootState) {
+    return selectApiState(rootState)?.queries;
+  }
+  function selectQueryEntry(rootState, cacheKey) {
+    return selectQueries(rootState)?.[cacheKey];
+  }
+  function selectMutations(rootState) {
+    return selectApiState(rootState)?.mutations;
+  }
+  function selectConfig(rootState) {
+    return selectApiState(rootState)?.config;
+  }
+  function buildAnyQuerySelector(endpointName, endpointDefinition, combiner) {
+    return (queryArgs) => {
+      if (queryArgs === skipToken) {
+        return createSelector2(selectSkippedQuery, combiner);
+      }
+      const serializedArgs = serializeQueryArgs({
+        queryArgs,
+        endpointDefinition,
+        endpointName
+      });
+      const selectQuerySubstate = (state) => selectQueryEntry(state, serializedArgs) ?? defaultQuerySubState;
+      return createSelector2(selectQuerySubstate, combiner);
+    };
+  }
+  function buildQuerySelector(endpointName, endpointDefinition) {
+    return buildAnyQuerySelector(endpointName, endpointDefinition, withRequestFlags);
+  }
+  function buildInfiniteQuerySelector(endpointName, endpointDefinition) {
+    const {
+      infiniteQueryOptions
+    } = endpointDefinition;
+    function withInfiniteQueryResultFlags(substate) {
+      const stateWithRequestFlags = {
+        ...substate,
+        ...getRequestStatusFlags(substate.status)
+      };
+      const {
+        isLoading,
+        isError,
+        direction
+      } = stateWithRequestFlags;
+      const isForward = direction === "forward";
+      const isBackward = direction === "backward";
+      return {
+        ...stateWithRequestFlags,
+        hasNextPage: getHasNextPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),
+        hasPreviousPage: getHasPreviousPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),
+        isFetchingNextPage: isLoading && isForward,
+        isFetchingPreviousPage: isLoading && isBackward,
+        isFetchNextPageError: isError && isForward,
+        isFetchPreviousPageError: isError && isBackward
+      };
+    }
+    return buildAnyQuerySelector(endpointName, endpointDefinition, withInfiniteQueryResultFlags);
+  }
+  function buildMutationSelector() {
+    return (id) => {
+      let mutationId;
+      if (typeof id === "object") {
+        mutationId = getMutationCacheKey(id) ?? skipToken;
+      } else {
+        mutationId = id;
+      }
+      const selectMutationSubstate = (state) => selectApiState(state)?.mutations?.[mutationId] ?? defaultMutationSubState;
+      const finalSelectMutationSubstate = mutationId === skipToken ? selectSkippedMutation : selectMutationSubstate;
+      return createSelector2(finalSelectMutationSubstate, withRequestFlags);
+    };
+  }
+  function selectInvalidatedBy(state, tags) {
+    const apiState = state[reducerPath];
+    const toInvalidate = /* @__PURE__ */ new Set();
+    const finalTags = filterMap(tags, isNotNullish, expandTagDescription);
+    for (const tag of finalTags) {
+      const provided = apiState.provided.tags[tag.type];
+      if (!provided) {
+        continue;
+      }
+      let invalidateSubscriptions = (tag.id !== void 0 ? (
+        // id given: invalidate all queries that provide this type & id
+        provided[tag.id]
+      ) : (
+        // no id: invalidate all queries that provide this type
+        Object.values(provided).flat()
+      )) ?? [];
+      for (const invalidate of invalidateSubscriptions) {
+        toInvalidate.add(invalidate);
+      }
+    }
+    return Array.from(toInvalidate.values()).flatMap((queryCacheKey) => {
+      const querySubState = apiState.queries[queryCacheKey];
+      return querySubState ? {
+        queryCacheKey,
+        endpointName: querySubState.endpointName,
+        originalArgs: querySubState.originalArgs
+      } : [];
+    });
+  }
+  function selectCachedArgsForQuery(state, queryName) {
+    return filterMap(Object.values(selectQueries(state)), (entry) => entry?.endpointName === queryName && entry.status !== STATUS_UNINITIALIZED, (entry) => entry.originalArgs);
+  }
+  function getHasNextPage(options, data, queryArg) {
+    if (!data) return false;
+    return getNextPageParam(options, data, queryArg) != null;
+  }
+  function getHasPreviousPage(options, data, queryArg) {
+    if (!data || !options.getPreviousPageParam) return false;
+    return getPreviousPageParam(options, data, queryArg) != null;
+  }
+}
+
+// src/query/createApi.ts
+var import_toolkit3 = require("@reduxjs/toolkit");
+
+// src/query/defaultSerializeQueryArgs.ts
+var cache = WeakMap ? /* @__PURE__ */ new WeakMap() : void 0;
+var defaultSerializeQueryArgs = ({
+  endpointName,
+  queryArgs
+}) => {
+  let serialized = "";
+  const cached = cache?.get(queryArgs);
+  if (typeof cached === "string") {
+    serialized = cached;
+  } else {
+    const stringified = JSON.stringify(queryArgs, (key, value) => {
+      value = typeof value === "bigint" ? {
+        $bigint: value.toString()
+      } : value;
+      value = (0, import_toolkit.isPlainObject)(value) ? Object.keys(value).sort().reduce((acc, key2) => {
+        acc[key2] = value[key2];
+        return acc;
+      }, {}) : value;
+      return value;
+    });
+    if ((0, import_toolkit.isPlainObject)(queryArgs)) {
+      cache?.set(queryArgs, stringified);
+    }
+    serialized = stringified;
+  }
+  return `${endpointName}(${serialized})`;
+};
+
+// src/query/createApi.ts
+var import_reselect = require("reselect");
+function buildCreateApi(...modules) {
+  return function baseCreateApi(options) {
+    const extractRehydrationInfo = (0, import_reselect.weakMapMemoize)((action) => options.extractRehydrationInfo?.(action, {
+      reducerPath: options.reducerPath ?? "api"
+    }));
+    const optionsWithDefaults = {
+      reducerPath: "api",
+      keepUnusedDataFor: 60,
+      refetchOnMountOrArgChange: false,
+      refetchOnFocus: false,
+      refetchOnReconnect: false,
+      invalidationBehavior: "delayed",
+      ...options,
+      extractRehydrationInfo,
+      serializeQueryArgs(queryArgsApi) {
+        let finalSerializeQueryArgs = defaultSerializeQueryArgs;
+        if ("serializeQueryArgs" in queryArgsApi.endpointDefinition) {
+          const endpointSQA = queryArgsApi.endpointDefinition.serializeQueryArgs;
+          finalSerializeQueryArgs = (queryArgsApi2) => {
+            const initialResult = endpointSQA(queryArgsApi2);
+            if (typeof initialResult === "string") {
+              return initialResult;
+            } else {
+              return defaultSerializeQueryArgs({
+                ...queryArgsApi2,
+                queryArgs: initialResult
+              });
+            }
+          };
+        } else if (options.serializeQueryArgs) {
+          finalSerializeQueryArgs = options.serializeQueryArgs;
+        }
+        return finalSerializeQueryArgs(queryArgsApi);
+      },
+      tagTypes: [...options.tagTypes || []]
+    };
+    const context = {
+      endpointDefinitions: {},
+      batch(fn) {
+        fn();
+      },
+      apiUid: (0, import_toolkit.nanoid)(),
+      extractRehydrationInfo,
+      hasRehydrationInfo: (0, import_reselect.weakMapMemoize)((action) => extractRehydrationInfo(action) != null)
+    };
+    const api = {
+      injectEndpoints,
+      enhanceEndpoints({
+        addTagTypes,
+        endpoints
+      }) {
+        if (addTagTypes) {
+          for (const eT of addTagTypes) {
+            if (!optionsWithDefaults.tagTypes.includes(eT)) {
+              ;
+              optionsWithDefaults.tagTypes.push(eT);
+            }
+          }
+        }
+        if (endpoints) {
+          for (const [endpointName, partialDefinition] of Object.entries(endpoints)) {
+            if (typeof partialDefinition === "function") {
+              partialDefinition(getEndpointDefinition(context, endpointName));
+            } else {
+              Object.assign(getEndpointDefinition(context, endpointName) || {}, partialDefinition);
+            }
+          }
+        }
+        return api;
+      }
+    };
+    const initializedModules = modules.map((m) => m.init(api, optionsWithDefaults, context));
+    function injectEndpoints(inject) {
+      const evaluatedEndpoints = inject.endpoints({
+        query: (x) => ({
+          ...x,
+          type: ENDPOINT_QUERY
+        }),
+        mutation: (x) => ({
+          ...x,
+          type: ENDPOINT_MUTATION
+        }),
+        infiniteQuery: (x) => ({
+          ...x,
+          type: ENDPOINT_INFINITEQUERY
+        })
+      });
+      for (const [endpointName, definition] of Object.entries(evaluatedEndpoints)) {
+        if (inject.overrideExisting !== true && endpointName in context.endpointDefinitions) {
+          if (inject.overrideExisting === "throw") {
+            throw new Error(false ? _formatProdErrorMessage2(39) : `called \`injectEndpoints\` to override already-existing endpointName ${endpointName} without specifying \`overrideExisting: true\``);
+          } else if (typeof process !== "undefined" && true) {
+            console.error(`called \`injectEndpoints\` to override already-existing endpointName ${endpointName} without specifying \`overrideExisting: true\``);
+          }
+          continue;
+        }
+        if (typeof process !== "undefined" && true) {
+          if (isInfiniteQueryDefinition(definition)) {
+            const {
+              infiniteQueryOptions
+            } = definition;
+            const {
+              maxPages,
+              getPreviousPageParam: getPreviousPageParam2
+            } = infiniteQueryOptions;
+            if (typeof maxPages === "number") {
+              if (maxPages < 1) {
+                throw new Error(false ? _formatProdErrorMessage22(40) : `maxPages for endpoint '${endpointName}' must be a number greater than 0`);
+              }
+              if (typeof getPreviousPageParam2 !== "function") {
+                throw new Error(false ? _formatProdErrorMessage3(41) : `getPreviousPageParam for endpoint '${endpointName}' must be a function if maxPages is used`);
+              }
+            }
+          }
+        }
+        context.endpointDefinitions[endpointName] = definition;
+        for (const m of initializedModules) {
+          m.injectEndpoint(endpointName, definition);
+        }
+      }
+      return api;
+    }
+    return api.injectEndpoints({
+      endpoints: options.endpoints
+    });
+  };
+}
+
+// src/query/fakeBaseQuery.ts
+var import_toolkit4 = require("@reduxjs/toolkit");
+var _NEVER = /* @__PURE__ */ Symbol();
+function fakeBaseQuery() {
+  return function() {
+    throw new Error(false ? _formatProdErrorMessage4(33) : "When using `fakeBaseQuery`, all queries & mutations must use the `queryFn` definition syntax.");
+  };
+}
+
+// src/query/tsHelpers.ts
+function assertCast(v) {
+}
+function safeAssign(target, ...args) {
+  return Object.assign(target, ...args);
+}
+
+// src/query/core/buildMiddleware/batchActions.ts
+var buildBatchedActionsHandler = ({
+  api,
+  queryThunk,
+  internalState,
+  mwApi
+}) => {
+  const subscriptionsPrefix = `${api.reducerPath}/subscriptions`;
+  let previousSubscriptions = null;
+  let updateSyncTimer = null;
+  const {
+    updateSubscriptionOptions,
+    unsubscribeQueryResult
+  } = api.internalActions;
+  const actuallyMutateSubscriptions = (currentSubscriptions, action) => {
+    if (updateSubscriptionOptions.match(action)) {
+      const {
+        queryCacheKey,
+        requestId,
+        options
+      } = action.payload;
+      const sub = currentSubscriptions.get(queryCacheKey);
+      if (sub?.has(requestId)) {
+        sub.set(requestId, options);
+      }
+      return true;
+    }
+    if (unsubscribeQueryResult.match(action)) {
+      const {
+        queryCacheKey,
+        requestId
+      } = action.payload;
+      const sub = currentSubscriptions.get(queryCacheKey);
+      if (sub) {
+        sub.delete(requestId);
+      }
+      return true;
+    }
+    if (api.internalActions.removeQueryResult.match(action)) {
+      currentSubscriptions.delete(action.payload.queryCacheKey);
+      return true;
+    }
+    if (queryThunk.pending.match(action)) {
+      const {
+        meta: {
+          arg,
+          requestId
+        }
+      } = action;
+      const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);
+      if (arg.subscribe) {
+        substate.set(requestId, arg.subscriptionOptions ?? substate.get(requestId) ?? {});
+      }
+      return true;
+    }
+    let mutated = false;
+    if (queryThunk.rejected.match(action)) {
+      const {
+        meta: {
+          condition,
+          arg,
+          requestId
+        }
+      } = action;
+      if (condition && arg.subscribe) {
+        const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);
+        substate.set(requestId, arg.subscriptionOptions ?? substate.get(requestId) ?? {});
+        mutated = true;
+      }
+    }
+    return mutated;
+  };
+  const getSubscriptions = () => internalState.currentSubscriptions;
+  const getSubscriptionCount = (queryCacheKey) => {
+    const subscriptions = getSubscriptions();
+    const subscriptionsForQueryArg = subscriptions.get(queryCacheKey);
+    return subscriptionsForQueryArg?.size ?? 0;
+  };
+  const isRequestSubscribed = (queryCacheKey, requestId) => {
+    const subscriptions = getSubscriptions();
+    return !!subscriptions?.get(queryCacheKey)?.get(requestId);
+  };
+  const subscriptionSelectors = {
+    getSubscriptions,
+    getSubscriptionCount,
+    isRequestSubscribed
+  };
+  function serializeSubscriptions(currentSubscriptions) {
+    return JSON.parse(JSON.stringify(Object.fromEntries([...currentSubscriptions].map(([k, v]) => [k, Object.fromEntries(v)]))));
+  }
+  return (action, mwApi2) => {
+    if (!previousSubscriptions) {
+      previousSubscriptions = serializeSubscriptions(internalState.currentSubscriptions);
+    }
+    if (api.util.resetApiState.match(action)) {
+      previousSubscriptions = {};
+      internalState.currentSubscriptions.clear();
+      updateSyncTimer = null;
+      return [true, false];
+    }
+    if (api.internalActions.internal_getRTKQSubscriptions.match(action)) {
+      return [false, subscriptionSelectors];
+    }
+    const didMutate = actuallyMutateSubscriptions(internalState.currentSubscriptions, action);
+    let actionShouldContinue = true;
+    if (false) {
+      return [false, internalState.currentPolls];
+    }
+    if (didMutate) {
+      if (!updateSyncTimer) {
+        updateSyncTimer = setTimeout(() => {
+          const newSubscriptions = serializeSubscriptions(internalState.currentSubscriptions);
+          const [, patches] = (0, import_immer.produceWithPatches)(previousSubscriptions, () => newSubscriptions);
+          mwApi2.next(api.internalActions.subscriptionsUpdated(patches));
+          previousSubscriptions = newSubscriptions;
+          updateSyncTimer = null;
+        }, 500);
+      }
+      const isSubscriptionSliceAction = typeof action.type == "string" && !!action.type.startsWith(subscriptionsPrefix);
+      const isAdditionalSubscriptionAction = queryThunk.rejected.match(action) && action.meta.condition && !!action.meta.arg.subscribe;
+      actionShouldContinue = !isSubscriptionSliceAction && !isAdditionalSubscriptionAction;
+    }
+    return [actionShouldContinue, false];
+  };
+};
+
+// src/query/core/buildMiddleware/cacheCollection.ts
+var THIRTY_TWO_BIT_MAX_TIMER_SECONDS = 2147483647 / 1e3 - 1;
+var buildCacheCollectionHandler = ({
+  reducerPath,
+  api,
+  queryThunk,
+  context,
+  internalState,
+  selectors: {
+    selectQueryEntry,
+    selectConfig
+  },
+  getRunningQueryThunk,
+  mwApi
+}) => {
+  const {
+    removeQueryResult,
+    unsubscribeQueryResult,
+    cacheEntriesUpserted
+  } = api.internalActions;
+  const canTriggerUnsubscribe = (0, import_toolkit.isAnyOf)(unsubscribeQueryResult.match, queryThunk.fulfilled, queryThunk.rejected, cacheEntriesUpserted.match);
+  function anySubscriptionsRemainingForKey(queryCacheKey) {
+    const subscriptions = internalState.currentSubscriptions.get(queryCacheKey);
+    if (!subscriptions) {
+      return false;
+    }
+    const hasSubscriptions = subscriptions.size > 0;
+    return hasSubscriptions;
+  }
+  const currentRemovalTimeouts = {};
+  function abortAllPromises(promiseMap) {
+    for (const promise of promiseMap.values()) {
+      promise?.abort?.();
+    }
+  }
+  const handler = (action, mwApi2) => {
+    const state = mwApi2.getState();
+    const config = selectConfig(state);
+    if (canTriggerUnsubscribe(action)) {
+      let queryCacheKeys;
+      if (cacheEntriesUpserted.match(action)) {
+        queryCacheKeys = action.payload.map((entry) => entry.queryDescription.queryCacheKey);
+      } else {
+        const {
+          queryCacheKey
+        } = unsubscribeQueryResult.match(action) ? action.payload : action.meta.arg;
+        queryCacheKeys = [queryCacheKey];
+      }
+      handleUnsubscribeMany(queryCacheKeys, mwApi2, config);
+    }
+    if (api.util.resetApiState.match(action)) {
+      for (const [key, timeout] of Object.entries(currentRemovalTimeouts)) {
+        if (timeout) clearTimeout(timeout);
+        delete currentRemovalTimeouts[key];
+      }
+      abortAllPromises(internalState.runningQueries);
+      abortAllPromises(internalState.runningMutations);
+    }
+    if (context.hasRehydrationInfo(action)) {
+      const {
+        queries
+      } = context.extractRehydrationInfo(action);
+      handleUnsubscribeMany(Object.keys(queries), mwApi2, config);
+    }
+  };
+  function handleUnsubscribeMany(cacheKeys, api2, config) {
+    const state = api2.getState();
+    for (const queryCacheKey of cacheKeys) {
+      const entry = selectQueryEntry(state, queryCacheKey);
+      if (entry?.endpointName) {
+        handleUnsubscribe(queryCacheKey, entry.endpointName, api2, config);
+      }
+    }
+  }
+  function handleUnsubscribe(queryCacheKey, endpointName, api2, config) {
+    const endpointDefinition = getEndpointDefinition(context, endpointName);
+    const keepUnusedDataFor = endpointDefinition?.keepUnusedDataFor ?? config.keepUnusedDataFor;
+    if (keepUnusedDataFor === Infinity) {
+      return;
+    }
+    const finalKeepUnusedDataFor = Math.max(0, Math.min(keepUnusedDataFor, THIRTY_TWO_BIT_MAX_TIMER_SECONDS));
+    if (!anySubscriptionsRemainingForKey(queryCacheKey)) {
+      const currentTimeout = currentRemovalTimeouts[queryCacheKey];
+      if (currentTimeout) {
+        clearTimeout(currentTimeout);
+      }
+      currentRemovalTimeouts[queryCacheKey] = setTimeout(() => {
+        if (!anySubscriptionsRemainingForKey(queryCacheKey)) {
+          const entry = selectQueryEntry(api2.getState(), queryCacheKey);
+          if (entry?.endpointName) {
+            const runningQuery = api2.dispatch(getRunningQueryThunk(entry.endpointName, entry.originalArgs));
+            runningQuery?.abort();
+          }
+          api2.dispatch(removeQueryResult({
+            queryCacheKey
+          }));
+        }
+        delete currentRemovalTimeouts[queryCacheKey];
+      }, finalKeepUnusedDataFor * 1e3);
+    }
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/cacheLifecycle.ts
+var neverResolvedError = new Error("Promise never resolved before cacheEntryRemoved.");
+var buildCacheLifecycleHandler = ({
+  api,
+  reducerPath,
+  context,
+  queryThunk,
+  mutationThunk,
+  internalState,
+  selectors: {
+    selectQueryEntry,
+    selectApiState
+  }
+}) => {
+  const isQueryThunk = (0, import_toolkit.isAsyncThunkAction)(queryThunk);
+  const isMutationThunk = (0, import_toolkit.isAsyncThunkAction)(mutationThunk);
+  const isFulfilledThunk = (0, import_toolkit.isFulfilled)(queryThunk, mutationThunk);
+  const lifecycleMap = {};
+  const {
+    removeQueryResult,
+    removeMutationResult,
+    cacheEntriesUpserted
+  } = api.internalActions;
+  function resolveLifecycleEntry(cacheKey, data, meta) {
+    const lifecycle = lifecycleMap[cacheKey];
+    if (lifecycle?.valueResolved) {
+      lifecycle.valueResolved({
+        data,
+        meta
+      });
+      delete lifecycle.valueResolved;
+    }
+  }
+  function removeLifecycleEntry(cacheKey) {
+    const lifecycle = lifecycleMap[cacheKey];
+    if (lifecycle) {
+      delete lifecycleMap[cacheKey];
+      lifecycle.cacheEntryRemoved();
+    }
+  }
+  function getActionMetaFields(action) {
+    const {
+      arg,
+      requestId
+    } = action.meta;
+    const {
+      endpointName,
+      originalArgs
+    } = arg;
+    return [endpointName, originalArgs, requestId];
+  }
+  const handler = (action, mwApi, stateBefore) => {
+    const cacheKey = getCacheKey(action);
+    function checkForNewCacheKey(endpointName, cacheKey2, requestId, originalArgs) {
+      const oldEntry = selectQueryEntry(stateBefore, cacheKey2);
+      const newEntry = selectQueryEntry(mwApi.getState(), cacheKey2);
+      if (!oldEntry && newEntry) {
+        handleNewKey(endpointName, originalArgs, cacheKey2, mwApi, requestId);
+      }
+    }
+    if (queryThunk.pending.match(action)) {
+      const [endpointName, originalArgs, requestId] = getActionMetaFields(action);
+      checkForNewCacheKey(endpointName, cacheKey, requestId, originalArgs);
+    } else if (cacheEntriesUpserted.match(action)) {
+      for (const {
+        queryDescription,
+        value
+      } of action.payload) {
+        const {
+          endpointName,
+          originalArgs,
+          queryCacheKey
+        } = queryDescription;
+        checkForNewCacheKey(endpointName, queryCacheKey, action.meta.requestId, originalArgs);
+        resolveLifecycleEntry(queryCacheKey, value, {});
+      }
+    } else if (mutationThunk.pending.match(action)) {
+      const state = mwApi.getState()[reducerPath].mutations[cacheKey];
+      if (state) {
+        const [endpointName, originalArgs, requestId] = getActionMetaFields(action);
+        handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId);
+      }
+    } else if (isFulfilledThunk(action)) {
+      resolveLifecycleEntry(cacheKey, action.payload, action.meta.baseQueryMeta);
+    } else if (removeQueryResult.match(action) || removeMutationResult.match(action)) {
+      removeLifecycleEntry(cacheKey);
+    } else if (api.util.resetApiState.match(action)) {
+      for (const cacheKey2 of Object.keys(lifecycleMap)) {
+        removeLifecycleEntry(cacheKey2);
+      }
+    }
+  };
+  function getCacheKey(action) {
+    if (isQueryThunk(action)) return action.meta.arg.queryCacheKey;
+    if (isMutationThunk(action)) {
+      return action.meta.arg.fixedCacheKey ?? action.meta.requestId;
+    }
+    if (removeQueryResult.match(action)) return action.payload.queryCacheKey;
+    if (removeMutationResult.match(action)) return getMutationCacheKey(action.payload);
+    return "";
+  }
+  function handleNewKey(endpointName, originalArgs, queryCacheKey, mwApi, requestId) {
+    const endpointDefinition = getEndpointDefinition(context, endpointName);
+    const onCacheEntryAdded = endpointDefinition?.onCacheEntryAdded;
+    if (!onCacheEntryAdded) return;
+    const lifecycle = {};
+    const cacheEntryRemoved = new Promise((resolve) => {
+      lifecycle.cacheEntryRemoved = resolve;
+    });
+    const cacheDataLoaded = Promise.race([new Promise((resolve) => {
+      lifecycle.valueResolved = resolve;
+    }), cacheEntryRemoved.then(() => {
+      throw neverResolvedError;
+    })]);
+    cacheDataLoaded.catch(() => {
+    });
+    lifecycleMap[queryCacheKey] = lifecycle;
+    const selector = api.endpoints[endpointName].select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : queryCacheKey);
+    const extra = mwApi.dispatch((_, __, extra2) => extra2);
+    const lifecycleApi = {
+      ...mwApi,
+      getCacheEntry: () => selector(mwApi.getState()),
+      requestId,
+      extra,
+      updateCachedData: isAnyQueryDefinition(endpointDefinition) ? (updateRecipe) => mwApi.dispatch(api.util.updateQueryData(endpointName, originalArgs, updateRecipe)) : void 0,
+      cacheDataLoaded,
+      cacheEntryRemoved
+    };
+    const runningHandler = onCacheEntryAdded(originalArgs, lifecycleApi);
+    Promise.resolve(runningHandler).catch((e) => {
+      if (e === neverResolvedError) return;
+      throw e;
+    });
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/devMiddleware.ts
+var buildDevCheckHandler = ({
+  api,
+  context: {
+    apiUid
+  },
+  reducerPath
+}) => {
+  return (action, mwApi) => {
+    if (api.util.resetApiState.match(action)) {
+      mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));
+    }
+    if (typeof process !== "undefined" && true) {
+      if (api.internalActions.middlewareRegistered.match(action) && action.payload === apiUid && mwApi.getState()[reducerPath]?.config?.middlewareRegistered === "conflict") {
+        console.warn(`There is a mismatch between slice and middleware for the reducerPath "${reducerPath}".
+You can only have one api per reducer path, this will lead to crashes in various situations!${reducerPath === "api" ? `
+If you have multiple apis, you *have* to specify the reducerPath option when using createApi!` : ""}`);
+      }
+    }
+  };
+};
+
+// src/query/core/buildMiddleware/invalidationByTags.ts
+var buildInvalidationByTagsHandler = ({
+  reducerPath,
+  context,
+  context: {
+    endpointDefinitions
+  },
+  mutationThunk,
+  queryThunk,
+  api,
+  assertTagType,
+  refetchQuery,
+  internalState
+}) => {
+  const {
+    removeQueryResult
+  } = api.internalActions;
+  const isThunkActionWithTags = (0, import_toolkit.isAnyOf)((0, import_toolkit.isFulfilled)(mutationThunk), (0, import_toolkit.isRejectedWithValue)(mutationThunk));
+  const isQueryEnd = (0, import_toolkit.isAnyOf)((0, import_toolkit.isFulfilled)(queryThunk, mutationThunk), (0, import_toolkit.isRejected)(queryThunk, mutationThunk));
+  let pendingTagInvalidations = [];
+  let pendingRequestCount = 0;
+  const handler = (action, mwApi) => {
+    if (queryThunk.pending.match(action) || mutationThunk.pending.match(action)) {
+      pendingRequestCount++;
+    }
+    if (isQueryEnd(action)) {
+      pendingRequestCount = Math.max(0, pendingRequestCount - 1);
+    }
+    if (isThunkActionWithTags(action)) {
+      invalidateTags(calculateProvidedByThunk(action, "invalidatesTags", endpointDefinitions, assertTagType), mwApi);
+    } else if (isQueryEnd(action)) {
+      invalidateTags([], mwApi);
+    } else if (api.util.invalidateTags.match(action)) {
+      invalidateTags(calculateProvidedBy(action.payload, void 0, void 0, void 0, void 0, assertTagType), mwApi);
+    }
+  };
+  function hasPendingRequests() {
+    return pendingRequestCount > 0;
+  }
+  function invalidateTags(newTags, mwApi) {
+    const rootState = mwApi.getState();
+    const state = rootState[reducerPath];
+    pendingTagInvalidations.push(...newTags);
+    if (state.config.invalidationBehavior === "delayed" && hasPendingRequests()) {
+      return;
+    }
+    const tags = pendingTagInvalidations;
+    pendingTagInvalidations = [];
+    if (tags.length === 0) return;
+    const toInvalidate = api.util.selectInvalidatedBy(rootState, tags);
+    context.batch(() => {
+      const valuesArray = Array.from(toInvalidate.values());
+      for (const {
+        queryCacheKey
+      } of valuesArray) {
+        const querySubState = state.queries[queryCacheKey];
+        const subscriptionSubState = getOrInsertComputed(internalState.currentSubscriptions, queryCacheKey, createNewMap);
+        if (querySubState) {
+          if (subscriptionSubState.size === 0) {
+            mwApi.dispatch(removeQueryResult({
+              queryCacheKey
+            }));
+          } else if (querySubState.status !== STATUS_UNINITIALIZED) {
+            mwApi.dispatch(refetchQuery(querySubState));
+          }
+        }
+      }
+    });
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/polling.ts
+var buildPollingHandler = ({
+  reducerPath,
+  queryThunk,
+  api,
+  refetchQuery,
+  internalState
+}) => {
+  const {
+    currentPolls,
+    currentSubscriptions
+  } = internalState;
+  const pendingPollingUpdates = /* @__PURE__ */ new Set();
+  let pollingUpdateTimer = null;
+  const handler = (action, mwApi) => {
+    if (api.internalActions.updateSubscriptionOptions.match(action) || api.internalActions.unsubscribeQueryResult.match(action)) {
+      schedulePollingUpdate(action.payload.queryCacheKey, mwApi);
+    }
+    if (queryThunk.pending.match(action) || queryThunk.rejected.match(action) && action.meta.condition) {
+      schedulePollingUpdate(action.meta.arg.queryCacheKey, mwApi);
+    }
+    if (queryThunk.fulfilled.match(action) || queryThunk.rejected.match(action) && !action.meta.condition) {
+      startNextPoll(action.meta.arg, mwApi);
+    }
+    if (api.util.resetApiState.match(action)) {
+      clearPolls();
+      if (pollingUpdateTimer) {
+        clearTimeout(pollingUpdateTimer);
+        pollingUpdateTimer = null;
+      }
+      pendingPollingUpdates.clear();
+    }
+  };
+  function schedulePollingUpdate(queryCacheKey, api2) {
+    pendingPollingUpdates.add(queryCacheKey);
+    if (!pollingUpdateTimer) {
+      pollingUpdateTimer = setTimeout(() => {
+        for (const key of pendingPollingUpdates) {
+          updatePollingInterval({
+            queryCacheKey: key
+          }, api2);
+        }
+        pendingPollingUpdates.clear();
+        pollingUpdateTimer = null;
+      }, 0);
+    }
+  }
+  function startNextPoll({
+    queryCacheKey
+  }, api2) {
+    const state = api2.getState()[reducerPath];
+    const querySubState = state.queries[queryCacheKey];
+    const subscriptions = currentSubscriptions.get(queryCacheKey);
+    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) return;
+    const {
+      lowestPollingInterval,
+      skipPollingIfUnfocused
+    } = findLowestPollingInterval(subscriptions);
+    if (!Number.isFinite(lowestPollingInterval)) return;
+    const currentPoll = currentPolls.get(queryCacheKey);
+    if (currentPoll?.timeout) {
+      clearTimeout(currentPoll.timeout);
+      currentPoll.timeout = void 0;
+    }
+    const nextPollTimestamp = Date.now() + lowestPollingInterval;
+    currentPolls.set(queryCacheKey, {
+      nextPollTimestamp,
+      pollingInterval: lowestPollingInterval,
+      timeout: setTimeout(() => {
+        if (state.config.focused || !skipPollingIfUnfocused) {
+          api2.dispatch(refetchQuery(querySubState));
+        }
+        startNextPoll({
+          queryCacheKey
+        }, api2);
+      }, lowestPollingInterval)
+    });
+  }
+  function updatePollingInterval({
+    queryCacheKey
+  }, api2) {
+    const state = api2.getState()[reducerPath];
+    const querySubState = state.queries[queryCacheKey];
+    const subscriptions = currentSubscriptions.get(queryCacheKey);
+    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) {
+      return;
+    }
+    const {
+      lowestPollingInterval
+    } = findLowestPollingInterval(subscriptions);
+    if (false) {
+      const updateCounters = currentPolls.pollUpdateCounters ??= {};
+      updateCounters[queryCacheKey] ??= 0;
+      updateCounters[queryCacheKey]++;
+    }
+    if (!Number.isFinite(lowestPollingInterval)) {
+      cleanupPollForKey(queryCacheKey);
+      return;
+    }
+    const currentPoll = currentPolls.get(queryCacheKey);
+    const nextPollTimestamp = Date.now() + lowestPollingInterval;
+    if (!currentPoll || nextPollTimestamp < currentPoll.nextPollTimestamp) {
+      startNextPoll({
+        queryCacheKey
+      }, api2);
+    }
+  }
+  function cleanupPollForKey(key) {
+    const existingPoll = currentPolls.get(key);
+    if (existingPoll?.timeout) {
+      clearTimeout(existingPoll.timeout);
+    }
+    currentPolls.delete(key);
+  }
+  function clearPolls() {
+    for (const key of currentPolls.keys()) {
+      cleanupPollForKey(key);
+    }
+  }
+  function findLowestPollingInterval(subscribers = /* @__PURE__ */ new Map()) {
+    let skipPollingIfUnfocused = false;
+    let lowestPollingInterval = Number.POSITIVE_INFINITY;
+    for (const entry of subscribers.values()) {
+      if (!!entry.pollingInterval) {
+        lowestPollingInterval = Math.min(entry.pollingInterval, lowestPollingInterval);
+        skipPollingIfUnfocused = entry.skipPollingIfUnfocused || skipPollingIfUnfocused;
+      }
+    }
+    return {
+      lowestPollingInterval,
+      skipPollingIfUnfocused
+    };
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/queryLifecycle.ts
+var buildQueryLifecycleHandler = ({
+  api,
+  context,
+  queryThunk,
+  mutationThunk
+}) => {
+  const isPendingThunk = (0, import_toolkit.isPending)(queryThunk, mutationThunk);
+  const isRejectedThunk = (0, import_toolkit.isRejected)(queryThunk, mutationThunk);
+  const isFullfilledThunk = (0, import_toolkit.isFulfilled)(queryThunk, mutationThunk);
+  const lifecycleMap = {};
+  const handler = (action, mwApi) => {
+    if (isPendingThunk(action)) {
+      const {
+        requestId,
+        arg: {
+          endpointName,
+          originalArgs
+        }
+      } = action.meta;
+      const endpointDefinition = getEndpointDefinition(context, endpointName);
+      const onQueryStarted = endpointDefinition?.onQueryStarted;
+      if (onQueryStarted) {
+        const lifecycle = {};
+        const queryFulfilled = new Promise((resolve, reject) => {
+          lifecycle.resolve = resolve;
+          lifecycle.reject = reject;
+        });
+        queryFulfilled.catch(() => {
+        });
+        lifecycleMap[requestId] = lifecycle;
+        const selector = api.endpoints[endpointName].select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : requestId);
+        const extra = mwApi.dispatch((_, __, extra2) => extra2);
+        const lifecycleApi = {
+          ...mwApi,
+          getCacheEntry: () => selector(mwApi.getState()),
+          requestId,
+          extra,
+          updateCachedData: isAnyQueryDefinition(endpointDefinition) ? (updateRecipe) => mwApi.dispatch(api.util.updateQueryData(endpointName, originalArgs, updateRecipe)) : void 0,
+          queryFulfilled
+        };
+        onQueryStarted(originalArgs, lifecycleApi);
+      }
+    } else if (isFullfilledThunk(action)) {
+      const {
+        requestId,
+        baseQueryMeta
+      } = action.meta;
+      lifecycleMap[requestId]?.resolve({
+        data: action.payload,
+        meta: baseQueryMeta
+      });
+      delete lifecycleMap[requestId];
+    } else if (isRejectedThunk(action)) {
+      const {
+        requestId,
+        rejectedWithValue,
+        baseQueryMeta
+      } = action.meta;
+      lifecycleMap[requestId]?.reject({
+        error: action.payload ?? action.error,
+        isUnhandledError: !rejectedWithValue,
+        meta: baseQueryMeta
+      });
+      delete lifecycleMap[requestId];
+    }
+  };
+  return handler;
+};
+
+// src/query/core/buildMiddleware/windowEventHandling.ts
+var buildWindowEventHandler = ({
+  reducerPath,
+  context,
+  api,
+  refetchQuery,
+  internalState
+}) => {
+  const {
+    removeQueryResult
+  } = api.internalActions;
+  const handler = (action, mwApi) => {
+    if (onFocus.match(action)) {
+      refetchValidQueries(mwApi, "refetchOnFocus");
+    }
+    if (onOnline.match(action)) {
+      refetchValidQueries(mwApi, "refetchOnReconnect");
+    }
+  };
+  function refetchValidQueries(api2, type) {
+    const state = api2.getState()[reducerPath];
+    const queries = state.queries;
+    const subscriptions = internalState.currentSubscriptions;
+    context.batch(() => {
+      for (const queryCacheKey of subscriptions.keys()) {
+        const querySubState = queries[queryCacheKey];
+        const subscriptionSubState = subscriptions.get(queryCacheKey);
+        if (!subscriptionSubState || !querySubState) continue;
+        const values = [...subscriptionSubState.values()];
+        const shouldRefetch = values.some((sub) => sub[type] === true) || values.every((sub) => sub[type] === void 0) && state.config[type];
+        if (shouldRefetch) {
+          if (subscriptionSubState.size === 0) {
+            api2.dispatch(removeQueryResult({
+              queryCacheKey
+            }));
+          } else if (querySubState.status !== STATUS_UNINITIALIZED) {
+            api2.dispatch(refetchQuery(querySubState));
+          }
+        }
+      }
+    });
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/index.ts
+function buildMiddleware(input) {
+  const {
+    reducerPath,
+    queryThunk,
+    api,
+    context,
+    getInternalState
+  } = input;
+  const {
+    apiUid
+  } = context;
+  const actions2 = {
+    invalidateTags: (0, import_toolkit.createAction)(`${reducerPath}/invalidateTags`)
+  };
+  const isThisApiSliceAction = (action) => action.type.startsWith(`${reducerPath}/`);
+  const handlerBuilders = [buildDevCheckHandler, buildCacheCollectionHandler, buildInvalidationByTagsHandler, buildPollingHandler, buildCacheLifecycleHandler, buildQueryLifecycleHandler];
+  const middleware = (mwApi) => {
+    let initialized2 = false;
+    const internalState = getInternalState(mwApi.dispatch);
+    const builderArgs = {
+      ...input,
+      internalState,
+      refetchQuery,
+      isThisApiSliceAction,
+      mwApi
+    };
+    const handlers = handlerBuilders.map((build) => build(builderArgs));
+    const batchedActionsHandler = buildBatchedActionsHandler(builderArgs);
+    const windowEventsHandler = buildWindowEventHandler(builderArgs);
+    return (next) => {
+      return (action) => {
+        if (!(0, import_toolkit.isAction)(action)) {
+          return next(action);
+        }
+        if (!initialized2) {
+          initialized2 = true;
+          mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));
+        }
+        const mwApiWithNext = {
+          ...mwApi,
+          next
+        };
+        const stateBefore = mwApi.getState();
+        const [actionShouldContinue, internalProbeResult] = batchedActionsHandler(action, mwApiWithNext, stateBefore);
+        let res;
+        if (actionShouldContinue) {
+          res = next(action);
+        } else {
+          res = internalProbeResult;
+        }
+        if (!!mwApi.getState()[reducerPath]) {
+          windowEventsHandler(action, mwApiWithNext, stateBefore);
+          if (isThisApiSliceAction(action) || context.hasRehydrationInfo(action)) {
+            for (const handler of handlers) {
+              handler(action, mwApiWithNext, stateBefore);
+            }
+          }
+        }
+        return res;
+      };
+    };
+  };
+  return {
+    middleware,
+    actions: actions2
+  };
+  function refetchQuery(querySubState) {
+    return input.api.endpoints[querySubState.endpointName].initiate(querySubState.originalArgs, {
+      subscribe: false,
+      forceRefetch: true
+    });
+  }
+}
+
+// src/query/core/module.ts
+var coreModuleName = /* @__PURE__ */ Symbol();
+var coreModule = ({
+  createSelector: createSelector2 = import_toolkit.createSelector
+} = {}) => ({
+  name: coreModuleName,
+  init(api, {
+    baseQuery,
+    tagTypes,
+    reducerPath,
+    serializeQueryArgs,
+    keepUnusedDataFor,
+    refetchOnMountOrArgChange,
+    refetchOnFocus,
+    refetchOnReconnect,
+    invalidationBehavior,
+    onSchemaFailure,
+    catchSchemaFailure,
+    skipSchemaValidation
+  }, context) {
+    (0, import_immer.enablePatches)();
+    assertCast(serializeQueryArgs);
+    const assertTagType = (tag) => {
+      if (typeof process !== "undefined" && true) {
+        if (!tagTypes.includes(tag.type)) {
+          console.error(`Tag type '${tag.type}' was used, but not specified in \`tagTypes\`!`);
+        }
+      }
+      return tag;
+    };
+    Object.assign(api, {
+      reducerPath,
+      endpoints: {},
+      internalActions: {
+        onOnline,
+        onOffline,
+        onFocus,
+        onFocusLost
+      },
+      util: {}
+    });
+    const selectors = buildSelectors({
+      serializeQueryArgs,
+      reducerPath,
+      createSelector: createSelector2
+    });
+    const {
+      selectInvalidatedBy,
+      selectCachedArgsForQuery,
+      buildQuerySelector,
+      buildInfiniteQuerySelector,
+      buildMutationSelector
+    } = selectors;
+    safeAssign(api.util, {
+      selectInvalidatedBy,
+      selectCachedArgsForQuery
+    });
+    const {
+      queryThunk,
+      infiniteQueryThunk,
+      mutationThunk,
+      patchQueryData,
+      updateQueryData,
+      upsertQueryData,
+      prefetch,
+      buildMatchThunkActions
+    } = buildThunks({
+      baseQuery,
+      reducerPath,
+      context,
+      api,
+      serializeQueryArgs,
+      assertTagType,
+      selectors,
+      onSchemaFailure,
+      catchSchemaFailure,
+      skipSchemaValidation
+    });
+    const {
+      reducer,
+      actions: sliceActions
+    } = buildSlice({
+      context,
+      queryThunk,
+      infiniteQueryThunk,
+      mutationThunk,
+      serializeQueryArgs,
+      reducerPath,
+      assertTagType,
+      config: {
+        refetchOnFocus,
+        refetchOnReconnect,
+        refetchOnMountOrArgChange,
+        keepUnusedDataFor,
+        reducerPath,
+        invalidationBehavior
+      }
+    });
+    safeAssign(api.util, {
+      patchQueryData,
+      updateQueryData,
+      upsertQueryData,
+      prefetch,
+      resetApiState: sliceActions.resetApiState,
+      upsertQueryEntries: sliceActions.cacheEntriesUpserted
+    });
+    safeAssign(api.internalActions, sliceActions);
+    const internalStateMap = /* @__PURE__ */ new WeakMap();
+    const getInternalState = (dispatch) => {
+      const state = getOrInsertComputed(internalStateMap, dispatch, () => ({
+        currentSubscriptions: /* @__PURE__ */ new Map(),
+        currentPolls: /* @__PURE__ */ new Map(),
+        runningQueries: /* @__PURE__ */ new Map(),
+        runningMutations: /* @__PURE__ */ new Map()
+      }));
+      return state;
+    };
+    const {
+      buildInitiateQuery,
+      buildInitiateInfiniteQuery,
+      buildInitiateMutation,
+      getRunningMutationThunk,
+      getRunningMutationsThunk,
+      getRunningQueriesThunk,
+      getRunningQueryThunk
+    } = buildInitiate({
+      queryThunk,
+      mutationThunk,
+      infiniteQueryThunk,
+      api,
+      serializeQueryArgs,
+      context,
+      getInternalState
+    });
+    safeAssign(api.util, {
+      getRunningMutationThunk,
+      getRunningMutationsThunk,
+      getRunningQueryThunk,
+      getRunningQueriesThunk
+    });
+    const {
+      middleware,
+      actions: middlewareActions
+    } = buildMiddleware({
+      reducerPath,
+      context,
+      queryThunk,
+      mutationThunk,
+      infiniteQueryThunk,
+      api,
+      assertTagType,
+      selectors,
+      getRunningQueryThunk,
+      getInternalState
+    });
+    safeAssign(api.util, middlewareActions);
+    safeAssign(api, {
+      reducer,
+      middleware
+    });
+    return {
+      name: coreModuleName,
+      injectEndpoint(endpointName, definition) {
+        const anyApi = api;
+        const endpoint = anyApi.endpoints[endpointName] ??= {};
+        if (isQueryDefinition(definition)) {
+          safeAssign(endpoint, {
+            name: endpointName,
+            select: buildQuerySelector(endpointName, definition),
+            initiate: buildInitiateQuery(endpointName, definition)
+          }, buildMatchThunkActions(queryThunk, endpointName));
+        }
+        if (isMutationDefinition(definition)) {
+          safeAssign(endpoint, {
+            name: endpointName,
+            select: buildMutationSelector(),
+            initiate: buildInitiateMutation(endpointName)
+          }, buildMatchThunkActions(mutationThunk, endpointName));
+        }
+        if (isInfiniteQueryDefinition(definition)) {
+          safeAssign(endpoint, {
+            name: endpointName,
+            select: buildInfiniteQuerySelector(endpointName, definition),
+            initiate: buildInitiateInfiniteQuery(endpointName, definition)
+          }, buildMatchThunkActions(queryThunk, endpointName));
+        }
+      }
+    };
+  }
+});
+
+// src/query/core/index.ts
+var createApi = /* @__PURE__ */ buildCreateApi(coreModule());
+// Annotate the CommonJS export names for ESM import in node:
+0 && (module.exports = {
+  NamedSchemaError,
+  QueryStatus,
+  _NEVER,
+  buildCreateApi,
+  copyWithStructuralSharing,
+  coreModule,
+  coreModuleName,
+  createApi,
+  defaultSerializeQueryArgs,
+  fakeBaseQuery,
+  fetchBaseQuery,
+  retry,
+  setupListeners,
+  skipToken
+});
+//# sourceMappingURL=rtk-query.development.cjs.map
Index: node_modules/@reduxjs/toolkit/dist/query/cjs/rtk-query.development.cjs.map
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/cjs/rtk-query.development.cjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/cjs/rtk-query.development.cjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,1 @@
+{"version":3,"sources":["../../../src/query/index.ts","../../../src/query/core/apiState.ts","../../../src/query/core/rtkImports.ts","../../../src/query/utils/copyWithStructuralSharing.ts","../../../src/query/utils/filterMap.ts","../../../src/query/utils/isAbsoluteUrl.ts","../../../src/query/utils/isDocumentVisible.ts","../../../src/query/utils/isNotNullish.ts","../../../src/query/utils/isOnline.ts","../../../src/query/utils/joinUrls.ts","../../../src/query/utils/getOrInsert.ts","../../../src/query/utils/signals.ts","../../../src/query/fetchBaseQuery.ts","../../../src/query/HandledError.ts","../../../src/query/retry.ts","../../../src/query/core/setupListeners.ts","../../../src/query/endpointDefinitions.ts","../../../src/query/utils/immerImports.ts","../../../src/query/core/buildInitiate.ts","../../../src/tsHelpers.ts","../../../src/query/apiTypes.ts","../../../src/query/standardSchema.ts","../../../src/query/core/buildThunks.ts","../../../src/query/utils/getCurrent.ts","../../../src/query/core/buildSlice.ts","../../../src/query/core/buildSelectors.ts","../../../src/query/createApi.ts","../../../src/query/defaultSerializeQueryArgs.ts","../../../src/query/fakeBaseQuery.ts","../../../src/query/tsHelpers.ts","../../../src/query/core/buildMiddleware/batchActions.ts","../../../src/query/core/buildMiddleware/cacheCollection.ts","../../../src/query/core/buildMiddleware/cacheLifecycle.ts","../../../src/query/core/buildMiddleware/devMiddleware.ts","../../../src/query/core/buildMiddleware/invalidationByTags.ts","../../../src/query/core/buildMiddleware/polling.ts","../../../src/query/core/buildMiddleware/queryLifecycle.ts","../../../src/query/core/buildMiddleware/windowEventHandling.ts","../../../src/query/core/buildMiddleware/index.ts","../../../src/query/core/module.ts","../../../src/query/core/index.ts"],"sourcesContent":["// This must remain here so that the `mangleErrors.cjs` build script\n// does not have to import this into each source file it rewrites.\nimport { formatProdErrorMessage } from '@reduxjs/toolkit';\nexport type { CombinedState, QueryCacheKey, QueryKeys, QuerySubState, RootState, SubscriptionOptions } from './core/apiState';\nexport { QueryStatus } from './core/apiState';\nexport type { Api, ApiContext, Module } from './apiTypes';\nexport type { BaseQueryApi, BaseQueryArg, BaseQueryEnhancer, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta, BaseQueryResult, QueryReturnValue } from './baseQueryTypes';\nexport type { BaseEndpointDefinition, EndpointDefinitions, EndpointDefinition, EndpointBuilder, QueryDefinition, MutationDefinition, MutationExtraOptions, InfiniteQueryArgFrom, InfiniteQueryDefinition, InfiniteQueryExtraOptions, PageParamFrom, TagDescription, QueryArgFrom, QueryExtraOptions, ResultTypeFrom, DefinitionType, DefinitionsFromApi, OverrideResultType, ResultDescription, TagTypesFromApi, UpdateDefinitions, SchemaFailureHandler, SchemaFailureConverter, SchemaFailureInfo, SchemaType } from './endpointDefinitions';\nexport { fetchBaseQuery } from './fetchBaseQuery';\nexport type { FetchBaseQueryArgs, FetchBaseQueryError, FetchBaseQueryMeta, FetchArgs } from './fetchBaseQuery';\nexport { retry } from './retry';\nexport type { RetryOptions } from './retry';\nexport { setupListeners } from './core/setupListeners';\nexport { skipToken } from './core/buildSelectors';\nexport type { QueryResultSelectorResult, MutationResultSelectorResult, SkipToken } from './core/buildSelectors';\nexport type { QueryActionCreatorResult, MutationActionCreatorResult, StartQueryActionCreatorOptions } from './core/buildInitiate';\nexport type { CreateApi, CreateApiOptions } from './createApi';\nexport { buildCreateApi } from './createApi';\nexport { _NEVER, fakeBaseQuery } from './fakeBaseQuery';\nexport { copyWithStructuralSharing } from './utils/copyWithStructuralSharing';\nexport { createApi, coreModule, coreModuleName } from './core/index';\nexport type { InfiniteData, InfiniteQueryActionCreatorResult, InfiniteQueryConfigOptions, InfiniteQueryResultSelectorResult, InfiniteQuerySubState, TypedMutationOnQueryStarted, TypedQueryOnQueryStarted } from './core/index';\nexport type { ApiEndpointMutation, ApiEndpointQuery, ApiEndpointInfiniteQuery, ApiModules, CoreModule, PrefetchOptions } from './core/module';\nexport { defaultSerializeQueryArgs } from './defaultSerializeQueryArgs';\nexport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nexport type { Id as TSHelpersId, NoInfer as TSHelpersNoInfer, Override as TSHelpersOverride } from './tsHelpers';\nexport { NamedSchemaError } from './standardSchema';","import type { SerializedError } from '@reduxjs/toolkit';\nimport type { BaseQueryError } from '../baseQueryTypes';\nimport type { BaseEndpointDefinition, EndpointDefinitions, FullTagDescription, InfiniteQueryDefinition, MutationDefinition, PageParamFrom, QueryArgFromAnyQuery, QueryDefinition, ResultTypeFrom } from '../endpointDefinitions';\nimport type { Id, WithRequiredProp } from '../tsHelpers';\nexport type QueryCacheKey = string & {\n  _type: 'queryCacheKey';\n};\nexport type QuerySubstateIdentifier = {\n  queryCacheKey: QueryCacheKey;\n};\nexport type MutationSubstateIdentifier = {\n  requestId: string;\n  fixedCacheKey?: string;\n} | {\n  requestId?: string;\n  fixedCacheKey: string;\n};\nexport type RefetchConfigOptions = {\n  refetchOnMountOrArgChange: boolean | number;\n  refetchOnReconnect: boolean;\n  refetchOnFocus: boolean;\n};\nexport type InfiniteQueryConfigOptions<DataType, PageParam, QueryArg> = {\n  /**\n   * The initial page parameter to use for the first page fetch.\n   */\n  initialPageParam: PageParam;\n  /**\n   * This function is required to automatically get the next cursor for infinite queries.\n   * The result will also be used to determine the value of `hasNextPage`.\n   */\n  getNextPageParam: (lastPage: DataType, allPages: Array<DataType>, lastPageParam: PageParam, allPageParams: Array<PageParam>, queryArg: QueryArg) => PageParam | undefined | null;\n  /**\n   * This function can be set to automatically get the previous cursor for infinite queries.\n   * The result will also be used to determine the value of `hasPreviousPage`.\n   */\n  getPreviousPageParam?: (firstPage: DataType, allPages: Array<DataType>, firstPageParam: PageParam, allPageParams: Array<PageParam>, queryArg: QueryArg) => PageParam | undefined | null;\n  /**\n   * If specified, only keep this many pages in cache at once.\n   * If additional pages are fetched, older pages in the other\n   * direction will be dropped from the cache.\n   */\n  maxPages?: number;\n  /**\n   * Defaults to `true`. When this is `true` and an infinite query endpoint is refetched\n   * (due to tag invalidation, polling, arg change configuration, or manual refetching),\n   * RTK Query will try to sequentially refetch all pages currently in the cache.\n   * When `false` only the first page will be refetched.\n   */\n  refetchCachedPages?: boolean;\n};\nexport type InfiniteData<DataType, PageParam> = {\n  pages: Array<DataType>;\n  pageParams: Array<PageParam>;\n};\n\n// NOTE: DO NOT import and use this for runtime comparisons internally,\n// except in the RTKQ React package. Use the string versions just below this.\n// ESBuild auto-inlines TS enums, which bloats our bundle with many repeated\n// constants like \"initialized\":\n// https://github.com/evanw/esbuild/releases/tag/v0.14.7\n// We still have to use this in the React package since we don't publicly export\n// the string constants below.\n/**\n * Strings describing the query state at any given time.\n */\nexport enum QueryStatus {\n  uninitialized = 'uninitialized',\n  pending = 'pending',\n  fulfilled = 'fulfilled',\n  rejected = 'rejected',\n}\n\n// Use these string constants for runtime comparisons internally\nexport const STATUS_UNINITIALIZED = QueryStatus.uninitialized;\nexport const STATUS_PENDING = QueryStatus.pending;\nexport const STATUS_FULFILLED = QueryStatus.fulfilled;\nexport const STATUS_REJECTED = QueryStatus.rejected;\nexport type RequestStatusFlags = {\n  status: QueryStatus.uninitialized;\n  isUninitialized: true;\n  isLoading: false;\n  isSuccess: false;\n  isError: false;\n} | {\n  status: QueryStatus.pending;\n  isUninitialized: false;\n  isLoading: true;\n  isSuccess: false;\n  isError: false;\n} | {\n  status: QueryStatus.fulfilled;\n  isUninitialized: false;\n  isLoading: false;\n  isSuccess: true;\n  isError: false;\n} | {\n  status: QueryStatus.rejected;\n  isUninitialized: false;\n  isLoading: false;\n  isSuccess: false;\n  isError: true;\n};\nexport function getRequestStatusFlags(status: QueryStatus): RequestStatusFlags {\n  return {\n    status,\n    isUninitialized: status === STATUS_UNINITIALIZED,\n    isLoading: status === STATUS_PENDING,\n    isSuccess: status === STATUS_FULFILLED,\n    isError: status === STATUS_REJECTED\n  } as any;\n}\n\n/**\n * @public\n */\nexport type SubscriptionOptions = {\n  /**\n   * How frequently to automatically re-fetch data (in milliseconds). Defaults to `0` (off).\n   */\n  pollingInterval?: number;\n  /**\n   *  Defaults to 'false'. This setting allows you to control whether RTK Query will continue polling if the window is not focused.\n   *\n   *  If pollingInterval is not set or set to 0, this **will not be evaluated** until pollingInterval is greater than 0.\n   *\n   *  Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  skipPollingIfUnfocused?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after regaining a network connection.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnReconnect?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after the application window regains focus.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnFocus?: boolean;\n};\nexport type SubscribersInternal = Map<string, SubscriptionOptions>;\nexport type Subscribers = {\n  [requestId: string]: SubscriptionOptions;\n};\nexport type QueryKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any> ? K : never }[keyof Definitions];\nexport type InfiniteQueryKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? K : never }[keyof Definitions];\nexport type MutationKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends MutationDefinition<any, any, any, any> ? K : never }[keyof Definitions];\ntype BaseQuerySubState<D extends BaseEndpointDefinition<any, any, any, any>, DataType = ResultTypeFrom<D>> = {\n  /**\n   * The argument originally passed into the hook or `initiate` action call\n   */\n  originalArgs: QueryArgFromAnyQuery<D>;\n  /**\n   * A unique ID associated with the request\n   */\n  requestId: string;\n  /**\n   * The received data from the query\n   */\n  data?: DataType;\n  /**\n   * The received error if applicable\n   */\n  error?: SerializedError | (D extends QueryDefinition<any, infer BaseQuery, any, any> ? BaseQueryError<BaseQuery> : never);\n  /**\n   * The name of the endpoint associated with the query\n   */\n  endpointName: string;\n  /**\n   * Time that the latest query started\n   */\n  startedTimeStamp: number;\n  /**\n   * Time that the latest query was fulfilled\n   */\n  fulfilledTimeStamp?: number;\n};\nexport type QuerySubState<D extends BaseEndpointDefinition<any, any, any, any>, DataType = ResultTypeFrom<D>> = Id<({\n  status: QueryStatus.fulfilled;\n} & WithRequiredProp<BaseQuerySubState<D, DataType>, 'data' | 'fulfilledTimeStamp'> & {\n  error: undefined;\n}) | ({\n  status: QueryStatus.pending;\n} & BaseQuerySubState<D, DataType>) | ({\n  status: QueryStatus.rejected;\n} & WithRequiredProp<BaseQuerySubState<D, DataType>, 'error'>) | {\n  status: QueryStatus.uninitialized;\n  originalArgs?: undefined;\n  data?: undefined;\n  error?: undefined;\n  requestId?: undefined;\n  endpointName?: string;\n  startedTimeStamp?: undefined;\n  fulfilledTimeStamp?: undefined;\n}>;\nexport type InfiniteQueryDirection = 'forward' | 'backward';\nexport type InfiniteQuerySubState<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any> ? QuerySubState<D, InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>> & {\n  direction?: InfiniteQueryDirection;\n} : never;\ntype BaseMutationSubState<D extends BaseEndpointDefinition<any, any, any, any>> = {\n  requestId: string;\n  data?: ResultTypeFrom<D>;\n  error?: SerializedError | (D extends MutationDefinition<any, infer BaseQuery, any, any> ? BaseQueryError<BaseQuery> : never);\n  endpointName: string;\n  startedTimeStamp: number;\n  fulfilledTimeStamp?: number;\n};\nexport type MutationSubState<D extends BaseEndpointDefinition<any, any, any, any>> = (({\n  status: QueryStatus.fulfilled;\n} & WithRequiredProp<BaseMutationSubState<D>, 'data' | 'fulfilledTimeStamp'>) & {\n  error: undefined;\n}) | (({\n  status: QueryStatus.pending;\n} & BaseMutationSubState<D>) & {\n  data?: undefined;\n}) | ({\n  status: QueryStatus.rejected;\n} & WithRequiredProp<BaseMutationSubState<D>, 'error'>) | {\n  requestId?: undefined;\n  status: QueryStatus.uninitialized;\n  data?: undefined;\n  error?: undefined;\n  endpointName?: string;\n  startedTimeStamp?: undefined;\n  fulfilledTimeStamp?: undefined;\n};\nexport type CombinedState<D extends EndpointDefinitions, E extends string, ReducerPath extends string> = {\n  queries: QueryState<D>;\n  mutations: MutationState<D>;\n  provided: InvalidationState<E>;\n  subscriptions: SubscriptionState;\n  config: ConfigState<ReducerPath>;\n};\nexport type InvalidationState<TagTypes extends string> = {\n  tags: { [_ in TagTypes]: {\n    [id: string]: Array<QueryCacheKey>;\n    [id: number]: Array<QueryCacheKey>;\n  } };\n  keys: Record<QueryCacheKey, Array<FullTagDescription<any>>>;\n};\nexport type QueryState<D extends EndpointDefinitions> = {\n  [queryCacheKey: string]: QuerySubState<D[string]> | InfiniteQuerySubState<D[string]> | undefined;\n};\nexport type SubscriptionInternalState = Map<string, SubscribersInternal>;\nexport type SubscriptionState = {\n  [queryCacheKey: string]: Subscribers | undefined;\n};\nexport type ConfigState<ReducerPath> = RefetchConfigOptions & {\n  reducerPath: ReducerPath;\n  online: boolean;\n  focused: boolean;\n  middlewareRegistered: boolean | 'conflict';\n} & ModifiableConfigState;\nexport type ModifiableConfigState = {\n  keepUnusedDataFor: number;\n  invalidationBehavior: 'delayed' | 'immediately';\n} & RefetchConfigOptions;\nexport type MutationState<D extends EndpointDefinitions> = {\n  [requestId: string]: MutationSubState<D[string]> | undefined;\n};\nexport type RootState<Definitions extends EndpointDefinitions, TagTypes extends string, ReducerPath extends string> = { [P in ReducerPath]: CombinedState<Definitions, TagTypes, P> };","// This file exists to consolidate all of the imports from the `@reduxjs/toolkit` package.\n// ESBuild does not de-duplicate imports, so this file is used to ensure that each method\n// imported is only listed once, and there's only one mention of the `@reduxjs/toolkit` package.\n\nexport { createAction, createSlice, createSelector, createAsyncThunk, combineReducers, createNextState, isAnyOf, isAllOf, isAction, isPending, isRejected, isFulfilled, isRejectedWithValue, isAsyncThunkAction, prepareAutoBatched, SHOULD_AUTOBATCH, isPlainObject, nanoid } from '@reduxjs/toolkit';","import { isPlainObject as _iPO } from '../core/rtkImports';\n\n// remove type guard\nconst isPlainObject: (_: any) => boolean = _iPO;\nexport function copyWithStructuralSharing<T>(oldObj: any, newObj: T): T;\nexport function copyWithStructuralSharing(oldObj: any, newObj: any): any {\n  if (oldObj === newObj || !(isPlainObject(oldObj) && isPlainObject(newObj) || Array.isArray(oldObj) && Array.isArray(newObj))) {\n    return newObj;\n  }\n  const newKeys = Object.keys(newObj);\n  const oldKeys = Object.keys(oldObj);\n  let isSameObject = newKeys.length === oldKeys.length;\n  const mergeObj: any = Array.isArray(newObj) ? [] : {};\n  for (const key of newKeys) {\n    mergeObj[key] = copyWithStructuralSharing(oldObj[key], newObj[key]);\n    if (isSameObject) isSameObject = oldObj[key] === mergeObj[key];\n  }\n  return isSameObject ? oldObj : mergeObj;\n}","// Preserve type guard predicate behavior when passing to mapper\nexport function filterMap<T, U, S extends T = T>(array: readonly T[], predicate: (item: T, index: number) => item is S, mapper: (item: S, index: number) => U | U[]): U[];\nexport function filterMap<T, U>(array: readonly T[], predicate: (item: T, index: number) => boolean, mapper: (item: T, index: number) => U | U[]): U[];\nexport function filterMap<T, U>(array: readonly T[], predicate: (item: T, index: number) => boolean, mapper: (item: T, index: number) => U | U[]): U[] {\n  return array.reduce<(U | U[])[]>((acc, item, i) => {\n    if (predicate(item as any, i)) {\n      acc.push(mapper(item as any, i));\n    }\n    return acc;\n  }, []).flat() as U[];\n}","/**\n * If either :// or // is present consider it to be an absolute url\n *\n * @param url string\n */\n\nexport function isAbsoluteUrl(url: string) {\n  return new RegExp(`(^|:)//`).test(url);\n}","/**\n * Assumes true for a non-browser env, otherwise makes a best effort\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState\n */\nexport function isDocumentVisible(): boolean {\n  // `document` may not exist in non-browser envs (like RN)\n  if (typeof document === 'undefined') {\n    return true;\n  }\n  // Match true for visible, prerender, undefined\n  return document.visibilityState !== 'hidden';\n}","export function isNotNullish<T>(v: T | null | undefined): v is T {\n  return v != null;\n}\nexport function filterNullishValues<T>(map?: Map<any, T>) {\n  return [...(map?.values() ?? [])].filter(isNotNullish) as NonNullable<T>[];\n}","/**\n * Assumes a browser is online if `undefined`, otherwise makes a best effort\n * @link https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine\n */\nexport function isOnline() {\n  // We set the default config value in the store, so we'd need to check for this in a SSR env\n  return typeof navigator === 'undefined' ? true : navigator.onLine === undefined ? true : navigator.onLine;\n}","import { isAbsoluteUrl } from './isAbsoluteUrl';\nconst withoutTrailingSlash = (url: string) => url.replace(/\\/$/, '');\nconst withoutLeadingSlash = (url: string) => url.replace(/^\\//, '');\nexport function joinUrls(base: string | undefined, url: string | undefined): string {\n  if (!base) {\n    return url!;\n  }\n  if (!url) {\n    return base;\n  }\n  if (isAbsoluteUrl(url)) {\n    return url;\n  }\n  const delimiter = base.endsWith('/') || !url.startsWith('?') ? '/' : '';\n  base = withoutTrailingSlash(base);\n  url = withoutLeadingSlash(url);\n  return `${base}${delimiter}${url}`;\n}","// Duplicate some of the utils in `/src/utils` to ensure\n// we don't end up dragging in larger chunks of the RTK core\n// into the RTKQ bundle\n\nexport function getOrInsert<K extends object, V>(map: WeakMap<K, V>, key: K, value: V): V;\nexport function getOrInsert<K, V>(map: Map<K, V>, key: K, value: V): V;\nexport function getOrInsert<K extends object, V>(map: Map<K, V> | WeakMap<K, V>, key: K, value: V): V {\n  if (map.has(key)) return map.get(key) as V;\n  return map.set(key, value).get(key) as V;\n}\nexport function getOrInsertComputed<K extends object, V>(map: WeakMap<K, V>, key: K, compute: (key: K) => V): V;\nexport function getOrInsertComputed<K, V>(map: Map<K, V>, key: K, compute: (key: K) => V): V;\nexport function getOrInsertComputed<K extends object, V>(map: Map<K, V> | WeakMap<K, V>, key: K, compute: (key: K) => V): V {\n  if (map.has(key)) return map.get(key) as V;\n  return map.set(key, compute(key)).get(key) as V;\n}\nexport const createNewMap = () => new Map();","// AbortSignal.timeout() is currently baseline 2024\nexport const timeoutSignal = (milliseconds: number) => {\n  const abortController = new AbortController();\n  setTimeout(() => {\n    const message = 'signal timed out';\n    const name = 'TimeoutError';\n    abortController.abort(\n    // some environments (React Native, Node) don't have DOMException\n    typeof DOMException !== 'undefined' ? new DOMException(message, name) : Object.assign(new Error(message), {\n      name\n    }));\n  }, milliseconds);\n  return abortController.signal;\n};\n\n// AbortSignal.any() is currently baseline 2024\nexport const anySignal = (...signals: AbortSignal[]) => {\n  // if any are already aborted, return an already aborted signal\n  for (const signal of signals) if (signal.aborted) return AbortSignal.abort(signal.reason);\n\n  // otherwise, create a new signal that aborts when any of the given signals abort\n  const abortController = new AbortController();\n  for (const signal of signals) {\n    signal.addEventListener('abort', () => abortController.abort(signal.reason), {\n      signal: abortController.signal,\n      once: true\n    });\n  }\n  return abortController.signal;\n};","import { joinUrls } from './utils';\nimport { isPlainObject } from './core/rtkImports';\nimport type { BaseQueryApi, BaseQueryFn } from './baseQueryTypes';\nimport type { MaybePromise, Override } from './tsHelpers';\nimport { anySignal, timeoutSignal } from './utils/signals';\nexport type ResponseHandler = 'content-type' | 'json' | 'text' | ((response: Response) => Promise<any>);\ntype CustomRequestInit = Override<RequestInit, {\n  headers?: Headers | string[][] | Record<string, string | undefined> | undefined;\n}>;\nexport interface FetchArgs extends CustomRequestInit {\n  url: string;\n  params?: Record<string, any>;\n  body?: any;\n  responseHandler?: ResponseHandler;\n  validateStatus?: (response: Response, body: any) => boolean;\n  /**\n   * A number in milliseconds that represents that maximum time a request can take before timing out.\n   */\n  timeout?: number;\n}\n\n/**\n * A mini-wrapper that passes arguments straight through to\n * {@link [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)}.\n * Avoids storing `fetch` in a closure, in order to permit mocking/monkey-patching.\n */\nconst defaultFetchFn: typeof fetch = (...args) => fetch(...args);\nconst defaultValidateStatus = (response: Response) => response.status >= 200 && response.status <= 299;\nconst defaultIsJsonContentType = (headers: Headers) => /*applicat*//ion\\/(vnd\\.api\\+)?json/.test(headers.get('content-type') || '');\nexport type FetchBaseQueryError = {\n  /**\n   * * `number`:\n   *   HTTP status code\n   */\n  status: number;\n  data: unknown;\n} | {\n  /**\n   * * `\"FETCH_ERROR\"`:\n   *   An error that occurred during execution of `fetch` or the `fetchFn` callback option\n   **/\n  status: 'FETCH_ERROR';\n  data?: undefined;\n  error: string;\n} | {\n  /**\n   * * `\"PARSING_ERROR\"`:\n   *   An error happened during parsing.\n   *   Most likely a non-JSON-response was returned with the default `responseHandler` \"JSON\",\n   *   or an error occurred while executing a custom `responseHandler`.\n   **/\n  status: 'PARSING_ERROR';\n  originalStatus: number;\n  data: string;\n  error: string;\n} | {\n  /**\n   * * `\"TIMEOUT_ERROR\"`:\n   *   Request timed out\n   **/\n  status: 'TIMEOUT_ERROR';\n  data?: undefined;\n  error: string;\n} | {\n  /**\n   * * `\"CUSTOM_ERROR\"`:\n   *   A custom error type that you can return from your `queryFn` where another error might not make sense.\n   **/\n  status: 'CUSTOM_ERROR';\n  data?: unknown;\n  error: string;\n};\nfunction stripUndefined(obj: any) {\n  if (!isPlainObject(obj)) {\n    return obj;\n  }\n  const copy: Record<string, any> = {\n    ...obj\n  };\n  for (const [k, v] of Object.entries(copy)) {\n    if (v === undefined) delete copy[k];\n  }\n  return copy;\n}\n\n// Only set the content-type to json if appropriate. Will not be true for FormData, ArrayBuffer, Blob, etc.\nconst isJsonifiable = (body: any) => typeof body === 'object' && (isPlainObject(body) || Array.isArray(body) || typeof body.toJSON === 'function');\nexport type FetchBaseQueryArgs = {\n  baseUrl?: string;\n  prepareHeaders?: (headers: Headers, api: Pick<BaseQueryApi, 'getState' | 'extra' | 'endpoint' | 'type' | 'forced'> & {\n    arg: string | FetchArgs;\n    extraOptions: unknown;\n  }) => MaybePromise<Headers | void>;\n  fetchFn?: (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;\n  paramsSerializer?: (params: Record<string, any>) => string;\n  /**\n   * By default, we only check for 'application/json' and 'application/vnd.api+json' as the content-types for json. If you need to support another format, you can pass\n   * in a predicate function for your given api to get the same automatic stringifying behavior\n   * @example\n   * ```ts\n   * const isJsonContentType = (headers: Headers) => [\"application/vnd.api+json\", \"application/json\", \"application/vnd.hal+json\"].includes(headers.get(\"content-type\")?.trim());\n   * ```\n   */\n  isJsonContentType?: (headers: Headers) => boolean;\n  /**\n   * Defaults to `application/json`;\n   */\n  jsonContentType?: string;\n\n  /**\n   * Custom replacer function used when calling `JSON.stringify()`;\n   */\n  jsonReplacer?: (this: any, key: string, value: any) => any;\n} & RequestInit & Pick<FetchArgs, 'responseHandler' | 'validateStatus' | 'timeout'>;\nexport type FetchBaseQueryMeta = {\n  request: Request;\n  response?: Response;\n};\n\n/**\n * This is a very small wrapper around fetch that aims to simplify requests.\n *\n * @example\n * ```ts\n * const baseQuery = fetchBaseQuery({\n *   baseUrl: 'https://api.your-really-great-app.com/v1/',\n *   prepareHeaders: (headers, { getState }) => {\n *     const token = (getState() as RootState).auth.token;\n *     // If we have a token set in state, let's assume that we should be passing it.\n *     if (token) {\n *       headers.set('authorization', `Bearer ${token}`);\n *     }\n *     return headers;\n *   },\n * })\n * ```\n *\n * @param {string} baseUrl\n * The base URL for an API service.\n * Typically in the format of https://example.com/\n *\n * @param {(headers: Headers, api: { getState: () => unknown; arg: string | FetchArgs; extra: unknown; endpoint: string; type: 'query' | 'mutation'; forced: boolean; }) => Headers} prepareHeaders\n * An optional function that can be used to inject headers on requests.\n * Provides a Headers object, most of the `BaseQueryApi` (`dispatch` is not available), and the arg passed into the query function.\n * Useful for setting authentication or headers that need to be set conditionally.\n *\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Headers\n *\n * @param {(input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>} fetchFn\n * Accepts a custom `fetch` function if you do not want to use the default on the window.\n * Useful in SSR environments if you need to use a library such as `isomorphic-fetch` or `cross-fetch`\n *\n * @param {(params: Record<string, unknown>) => string} paramsSerializer\n * An optional function that can be used to stringify querystring parameters.\n *\n * @param {(headers: Headers) => boolean} isJsonContentType\n * An optional predicate function to determine if `JSON.stringify()` should be called on the `body` arg of `FetchArgs`\n *\n * @param {string} jsonContentType Used when automatically setting the content-type header for a request with a jsonifiable body that does not have an explicit content-type header. Defaults to `application/json`.\n *\n * @param {(this: any, key: string, value: any) => any} jsonReplacer Custom replacer function used when calling `JSON.stringify()`.\n *\n * @param {number} timeout\n * A number in milliseconds that represents the maximum time a request can take before timing out.\n */\n\nexport function fetchBaseQuery({\n  baseUrl,\n  prepareHeaders = x => x,\n  fetchFn = defaultFetchFn,\n  paramsSerializer,\n  isJsonContentType = defaultIsJsonContentType,\n  jsonContentType = 'application/json',\n  jsonReplacer,\n  timeout: defaultTimeout,\n  responseHandler: globalResponseHandler,\n  validateStatus: globalValidateStatus,\n  ...baseFetchOptions\n}: FetchBaseQueryArgs = {}): BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta> {\n  if (typeof fetch === 'undefined' && fetchFn === defaultFetchFn) {\n    console.warn('Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments.');\n  }\n  return async (arg, api, extraOptions) => {\n    const {\n      getState,\n      extra,\n      endpoint,\n      forced,\n      type\n    } = api;\n    let meta: FetchBaseQueryMeta | undefined;\n    let {\n      url,\n      headers = new Headers(baseFetchOptions.headers),\n      params = undefined,\n      responseHandler = globalResponseHandler ?? 'json' as const,\n      validateStatus = globalValidateStatus ?? defaultValidateStatus,\n      timeout = defaultTimeout,\n      ...rest\n    } = typeof arg == 'string' ? {\n      url: arg\n    } : arg;\n    let config: RequestInit = {\n      ...baseFetchOptions,\n      signal: timeout ? anySignal(api.signal, timeoutSignal(timeout)) : api.signal,\n      ...rest\n    };\n    headers = new Headers(stripUndefined(headers));\n    config.headers = (await prepareHeaders(headers, {\n      getState,\n      arg,\n      extra,\n      endpoint,\n      forced,\n      type,\n      extraOptions\n    })) || headers;\n    const bodyIsJsonifiable = isJsonifiable(config.body);\n\n    // Remove content-type for non-jsonifiable bodies to let the browser set it automatically\n    // Exception: keep content-type for string bodies as they might be intentional (text/plain, text/html, etc.)\n    if (config.body != null && !bodyIsJsonifiable && typeof config.body !== 'string') {\n      config.headers.delete('content-type');\n    }\n    if (!config.headers.has('content-type') && bodyIsJsonifiable) {\n      config.headers.set('content-type', jsonContentType);\n    }\n    if (bodyIsJsonifiable && isJsonContentType(config.headers)) {\n      config.body = JSON.stringify(config.body, jsonReplacer);\n    }\n\n    // Set Accept header based on responseHandler if not already set\n    if (!config.headers.has('accept')) {\n      if (responseHandler === 'json') {\n        config.headers.set('accept', 'application/json');\n      } else if (responseHandler === 'text') {\n        config.headers.set('accept', 'text/plain, text/html, */*');\n      }\n      // For 'content-type' responseHandler, don't set Accept (let server decide)\n    }\n    if (params) {\n      const divider = ~url.indexOf('?') ? '&' : '?';\n      const query = paramsSerializer ? paramsSerializer(params) : new URLSearchParams(stripUndefined(params));\n      url += divider + query;\n    }\n    url = joinUrls(baseUrl, url);\n    const request = new Request(url, config);\n    const requestClone = new Request(url, config);\n    meta = {\n      request: requestClone\n    };\n    let response;\n    try {\n      response = await fetchFn(request);\n    } catch (e) {\n      return {\n        error: {\n          status: (e instanceof Error || typeof DOMException !== 'undefined' && e instanceof DOMException) && e.name === 'TimeoutError' ? 'TIMEOUT_ERROR' : 'FETCH_ERROR',\n          error: String(e)\n        },\n        meta\n      };\n    }\n    const responseClone = response.clone();\n    meta.response = responseClone;\n    let resultData: any;\n    let responseText: string = '';\n    try {\n      let handleResponseError;\n      await Promise.all([handleResponse(response, responseHandler).then(r => resultData = r, e => handleResponseError = e),\n      // see https://github.com/node-fetch/node-fetch/issues/665#issuecomment-538995182\n      // we *have* to \"use up\" both streams at the same time or they will stop running in node-fetch scenarios\n      responseClone.text().then(r => responseText = r, () => {})]);\n      if (handleResponseError) throw handleResponseError;\n    } catch (e) {\n      return {\n        error: {\n          status: 'PARSING_ERROR',\n          originalStatus: response.status,\n          data: responseText,\n          error: String(e)\n        },\n        meta\n      };\n    }\n    return validateStatus(response, resultData) ? {\n      data: resultData,\n      meta\n    } : {\n      error: {\n        status: response.status,\n        data: resultData\n      },\n      meta\n    };\n  };\n  async function handleResponse(response: Response, responseHandler: ResponseHandler) {\n    if (typeof responseHandler === 'function') {\n      return responseHandler(response);\n    }\n    if (responseHandler === 'content-type') {\n      responseHandler = isJsonContentType(response.headers) ? 'json' : 'text';\n    }\n    if (responseHandler === 'json') {\n      const text = await response.text();\n      return text.length ? JSON.parse(text) : null;\n    }\n    return response.text();\n  }\n}","export class HandledError {\n  constructor(public readonly value: any, public readonly meta: any = undefined) {}\n}","import type { BaseQueryApi, BaseQueryArg, BaseQueryEnhancer, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta } from './baseQueryTypes';\nimport type { FetchBaseQueryError } from './fetchBaseQuery';\nimport { HandledError } from './HandledError';\n\n/**\n * Exponential backoff based on the attempt number.\n *\n * @remarks\n * 1. 600ms * random(0.4, 1.4)\n * 2. 1200ms * random(0.4, 1.4)\n * 3. 2400ms * random(0.4, 1.4)\n * 4. 4800ms * random(0.4, 1.4)\n * 5. 9600ms * random(0.4, 1.4)\n *\n * @param attempt - Current attempt\n * @param maxRetries - Maximum number of retries\n */\nasync function defaultBackoff(attempt: number = 0, maxRetries: number = 5, signal?: AbortSignal) {\n  const attempts = Math.min(attempt, maxRetries);\n  const timeout = ~~((Math.random() + 0.4) * (300 << attempts)); // Force a positive int in the case we make this an option\n\n  await new Promise<void>((resolve, reject) => {\n    const timeoutId = setTimeout(() => resolve(), timeout);\n\n    // If signal is provided and gets aborted, clear timeout and reject\n    if (signal) {\n      const abortHandler = () => {\n        clearTimeout(timeoutId);\n        reject(new Error('Aborted'));\n      };\n\n      // Check if already aborted\n      if (signal.aborted) {\n        clearTimeout(timeoutId);\n        reject(new Error('Aborted'));\n      } else {\n        signal.addEventListener('abort', abortHandler, {\n          once: true\n        });\n      }\n    }\n  });\n}\ntype RetryConditionFunction = (error: BaseQueryError<BaseQueryFn>, args: BaseQueryArg<BaseQueryFn>, extraArgs: {\n  attempt: number;\n  baseQueryApi: BaseQueryApi;\n  extraOptions: BaseQueryExtraOptions<BaseQueryFn> & RetryOptions;\n}) => boolean;\nexport type RetryOptions = {\n  /**\n   * Function used to determine delay between retries\n   */\n  backoff?: (attempt: number, maxRetries: number, signal?: AbortSignal) => Promise<void>;\n} & ({\n  /**\n   * How many times the query will be retried (default: 5)\n   */\n  maxRetries?: number;\n  retryCondition?: undefined;\n} | {\n  /**\n   * Callback to determine if a retry should be attempted.\n   * Return `true` for another retry and `false` to quit trying prematurely.\n   */\n  retryCondition?: RetryConditionFunction;\n  maxRetries?: undefined;\n});\nfunction fail<BaseQuery extends BaseQueryFn = BaseQueryFn>(error: BaseQueryError<BaseQuery>, meta?: BaseQueryMeta<BaseQuery>): never {\n  throw Object.assign(new HandledError({\n    error,\n    meta\n  }), {\n    throwImmediately: true\n  });\n}\n\n/**\n * Checks if the abort signal is aborted and fails immediately if so.\n * Used to exit retry loops cleanly when a request is aborted.\n */\nfunction failIfAborted(signal: AbortSignal): void {\n  if (signal.aborted) {\n    fail({\n      status: 'CUSTOM_ERROR',\n      error: 'Aborted'\n    });\n  }\n}\nconst EMPTY_OPTIONS = {};\nconst retryWithBackoff: BaseQueryEnhancer<unknown, RetryOptions, RetryOptions | void> = (baseQuery, defaultOptions) => async (args, api, extraOptions) => {\n  // We need to figure out `maxRetries` before we define `defaultRetryCondition.\n  // This is probably goofy, but ought to work.\n  // Put our defaults in one array, filter out undefineds, grab the last value.\n  const possibleMaxRetries: number[] = [5, (defaultOptions as any || EMPTY_OPTIONS).maxRetries, (extraOptions as any || EMPTY_OPTIONS).maxRetries].filter(x => x !== undefined);\n  const [maxRetries] = possibleMaxRetries.slice(-1);\n  const defaultRetryCondition: RetryConditionFunction = (_, __, {\n    attempt\n  }) => attempt <= maxRetries;\n  const options: {\n    maxRetries: number;\n    backoff: typeof defaultBackoff;\n    retryCondition: typeof defaultRetryCondition;\n  } = {\n    maxRetries,\n    backoff: defaultBackoff,\n    retryCondition: defaultRetryCondition,\n    ...defaultOptions,\n    ...extraOptions\n  };\n  let retry = 0;\n  while (true) {\n    // Check if aborted before each attempt\n    failIfAborted(api.signal);\n    try {\n      const result = await baseQuery(args, api, extraOptions);\n      // baseQueries _should_ return an error property, so we should check for that and throw it to continue retrying\n      if (result.error) {\n        throw new HandledError(result);\n      }\n      return result;\n    } catch (e: any) {\n      retry++;\n      if (e.throwImmediately) {\n        if (e instanceof HandledError) {\n          return e.value;\n        }\n\n        // We don't know what this is, so we have to rethrow it\n        throw e;\n      }\n      if (e instanceof HandledError) {\n        if (!options.retryCondition(e.value.error as FetchBaseQueryError, args, {\n          attempt: retry,\n          baseQueryApi: api,\n          extraOptions\n        })) {\n          return e.value; // Max retries for expected error\n        }\n      } else {\n        // For unexpected errors, respect maxRetries\n        if (retry > options.maxRetries) {\n          // Return the error as a proper error response instead of throwing\n          return {\n            error: e\n          };\n        }\n      }\n\n      // Check if aborted before backoff\n      failIfAborted(api.signal);\n      try {\n        await options.backoff(retry, options.maxRetries, api.signal);\n      } catch (backoffError) {\n        // If backoff was aborted, exit the retry loop\n        failIfAborted(api.signal);\n        // Otherwise, rethrow the backoff error\n        throw backoffError;\n      }\n    }\n  }\n};\n\n/**\n * A utility that can wrap `baseQuery` in the API definition to provide retries with a basic exponential backoff.\n *\n * @example\n *\n * ```ts\n * // codeblock-meta title=\"Retry every request 5 times by default\"\n * import { createApi, fetchBaseQuery, retry } from '@reduxjs/toolkit/query/react'\n * interface Post {\n *   id: number\n *   name: string\n * }\n * type PostsResponse = Post[]\n *\n * // maxRetries: 5 is the default, and can be omitted. Shown for documentation purposes.\n * const staggeredBaseQuery = retry(fetchBaseQuery({ baseUrl: '/' }), { maxRetries: 5 });\n * export const api = createApi({\n *   baseQuery: staggeredBaseQuery,\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsResponse, void>({\n *       query: () => ({ url: 'posts' }),\n *     }),\n *     getPost: build.query<PostsResponse, string>({\n *       query: (id) => ({ url: `post/${id}` }),\n *       extraOptions: { maxRetries: 8 }, // You can override the retry behavior on each endpoint\n *     }),\n *   }),\n * });\n *\n * export const { useGetPostsQuery, useGetPostQuery } = api;\n * ```\n */\nexport const retry = /* @__PURE__ */Object.assign(retryWithBackoff, {\n  fail\n});","import type { ThunkDispatch, ActionCreatorWithoutPayload // Workaround for API-Extractor\n} from '@reduxjs/toolkit';\nimport { createAction } from './rtkImports';\nexport const INTERNAL_PREFIX = '__rtkq/';\nconst ONLINE = 'online';\nconst OFFLINE = 'offline';\nconst FOCUS = 'focus';\nconst FOCUSED = 'focused';\nconst VISIBILITYCHANGE = 'visibilitychange';\nexport const onFocus = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${FOCUSED}`);\nexport const onFocusLost = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}un${FOCUSED}`);\nexport const onOnline = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${ONLINE}`);\nexport const onOffline = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${OFFLINE}`);\nconst actions = {\n  onFocus,\n  onFocusLost,\n  onOnline,\n  onOffline\n};\nlet initialized = false;\n\n/**\n * A utility used to enable `refetchOnMount` and `refetchOnReconnect` behaviors.\n * It requires the dispatch method from your store.\n * Calling `setupListeners(store.dispatch)` will configure listeners with the recommended defaults,\n * but you have the option of providing a callback for more granular control.\n *\n * @example\n * ```ts\n * setupListeners(store.dispatch)\n * ```\n *\n * @param dispatch - The dispatch method from your store\n * @param customHandler - An optional callback for more granular control over listener behavior\n * @returns Return value of the handler.\n * The default handler returns an `unsubscribe` method that can be called to remove the listeners.\n */\nexport function setupListeners(dispatch: ThunkDispatch<any, any, any>, customHandler?: (dispatch: ThunkDispatch<any, any, any>, actions: {\n  onFocus: typeof onFocus;\n  onFocusLost: typeof onFocusLost;\n  onOnline: typeof onOnline;\n  onOffline: typeof onOffline;\n}) => () => void) {\n  function defaultHandler() {\n    const [handleFocus, handleFocusLost, handleOnline, handleOffline] = [onFocus, onFocusLost, onOnline, onOffline].map(action => () => dispatch(action()));\n    const handleVisibilityChange = () => {\n      if (window.document.visibilityState === 'visible') {\n        handleFocus();\n      } else {\n        handleFocusLost();\n      }\n    };\n    let unsubscribe = () => {\n      initialized = false;\n    };\n    if (!initialized) {\n      if (typeof window !== 'undefined' && window.addEventListener) {\n        const handlers = {\n          [FOCUS]: handleFocus,\n          [VISIBILITYCHANGE]: handleVisibilityChange,\n          [ONLINE]: handleOnline,\n          [OFFLINE]: handleOffline\n        };\n        function updateListeners(add: boolean) {\n          Object.entries(handlers).forEach(([event, handler]) => {\n            if (add) {\n              window.addEventListener(event, handler, false);\n            } else {\n              window.removeEventListener(event, handler);\n            }\n          });\n        }\n        // Handle focus events\n        updateListeners(true);\n        initialized = true;\n        unsubscribe = () => {\n          updateListeners(false);\n          initialized = false;\n        };\n      }\n    }\n    return unsubscribe;\n  }\n  return customHandler ? customHandler(dispatch, actions) : defaultHandler();\n}","import type { Api } from '@reduxjs/toolkit/query';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { BaseQueryApi, BaseQueryArg, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta, BaseQueryResult, QueryReturnValue } from './baseQueryTypes';\nimport type { CacheCollectionQueryExtraOptions } from './core/buildMiddleware/cacheCollection';\nimport type { CacheLifecycleInfiniteQueryExtraOptions, CacheLifecycleMutationExtraOptions, CacheLifecycleQueryExtraOptions } from './core/buildMiddleware/cacheLifecycle';\nimport type { QueryLifecycleInfiniteQueryExtraOptions, QueryLifecycleMutationExtraOptions, QueryLifecycleQueryExtraOptions } from './core/buildMiddleware/queryLifecycle';\nimport type { InfiniteData, InfiniteQueryConfigOptions, QuerySubState, RootState } from './core/index';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { NEVER } from './fakeBaseQuery';\nimport type { CastAny, HasRequiredProps, MaybePromise, NonUndefined, OmitFromUnion, UnwrapPromise } from './tsHelpers';\nimport { isNotNullish } from './utils';\nimport type { NamedSchemaError } from './standardSchema';\nimport { filterMap } from './utils/filterMap';\nconst rawResultType = /* @__PURE__ */Symbol();\nconst resultType = /* @__PURE__ */Symbol();\nconst baseQuery = /* @__PURE__ */Symbol();\nexport interface SchemaFailureInfo {\n  endpoint: string;\n  arg: any;\n  type: 'query' | 'mutation';\n  queryCacheKey?: string;\n}\nexport type SchemaFailureHandler = (error: NamedSchemaError, info: SchemaFailureInfo) => void;\nexport type SchemaFailureConverter<BaseQuery extends BaseQueryFn> = (error: NamedSchemaError, info: SchemaFailureInfo) => BaseQueryError<BaseQuery>;\nexport type EndpointDefinitionWithQuery<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery>> = {\n  /**\n   * `query` can be a function that returns either a `string` or an `object` which is passed to your `baseQuery`. If you are using [fetchBaseQuery](./fetchBaseQuery), this can return either a `string` or an `object` of properties in `FetchArgs`. If you use your own custom [`baseQuery`](../../rtk-query/usage/customizing-queries), you can customize this behavior to your liking.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"query example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       // highlight-start\n   *       query: () => 'posts',\n   *       // highlight-end\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *      // highlight-start\n   *      query: (body) => ({\n   *        url: `posts`,\n   *        method: 'POST',\n   *        body,\n   *      }),\n   *      // highlight-end\n   *      invalidatesTags: [{ type: 'Post', id: 'LIST' }],\n   *    }),\n   *   })\n   * })\n   * ```\n   */\n  query(arg: QueryArg): BaseQueryArg<BaseQuery>;\n  queryFn?: never;\n  /**\n   * A function to manipulate the data returned by a query or mutation.\n   */\n  transformResponse?(baseQueryReturnValue: RawResultType, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): ResultType | Promise<ResultType>;\n  /**\n   * A function to manipulate the data returned by a failed query or mutation.\n   */\n  transformErrorResponse?(baseQueryReturnValue: BaseQueryError<BaseQuery>, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): unknown;\n\n  /**\n   * A schema for the result *before* it's passed to `transformResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPostName: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawResponseSchema: postSchema,\n   *       transformResponse: (post) => post.name,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawResponseSchema?: StandardSchemaV1<RawResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn`, *before* it's passed to `transformErrorResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import {customBaseQuery, baseQueryErrorSchema} from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawErrorResponseSchema: baseQueryErrorSchema,\n   *       transformErrorResponse: (error) => error.data,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawErrorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n};\nexport type EndpointDefinitionWithQueryFn<QueryArg, BaseQuery extends BaseQueryFn, ResultType> = {\n  /**\n   * Can be used in place of `query` as an inline function that bypasses `baseQuery` completely for the endpoint.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Basic queryFn example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *     }),\n   *     flipCoin: build.query<'heads' | 'tails', void>({\n   *       // highlight-start\n   *       queryFn(arg, queryApi, extraOptions, baseQuery) {\n   *         const randomVal = Math.random()\n   *         if (randomVal < 0.45) {\n   *           return { data: 'heads' }\n   *         }\n   *         if (randomVal < 0.9) {\n   *           return { data: 'tails' }\n   *         }\n   *         return { error: { status: 500, statusText: 'Internal Server Error', data: \"Coin landed on its edge!\" } }\n   *       }\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  queryFn(arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions<BaseQuery>, baseQuery: (arg: Parameters<BaseQuery>[0]) => ReturnType<BaseQuery>): MaybePromise<QueryReturnValue<ResultType, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>>;\n  query?: never;\n  transformResponse?: never;\n  transformErrorResponse?: never;\n  rawResponseSchema?: never;\n  rawErrorResponseSchema?: never;\n};\ntype BaseEndpointTypes<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType> = {\n  QueryArg: QueryArg;\n  BaseQuery: BaseQuery;\n  ResultType: ResultType;\n  RawResultType: RawResultType;\n};\nexport type SchemaType = 'arg' | 'rawResponse' | 'response' | 'rawErrorResponse' | 'errorResponse' | 'meta';\ninterface CommonEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType> {\n  /**\n   * A schema for the arguments to be passed to the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       argSchema: v.object({ id: v.number() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  argSchema?: StandardSchemaV1<QueryArg>;\n\n  /**\n   * A schema for the result (including `transformResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: postSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  responseSchema?: StandardSchemaV1<ResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn` (including `transformErrorResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryErrorSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       errorResponseSchema: baseQueryErrorSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  errorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n\n  /**\n   * A schema for the `meta` property returned by the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryMetaSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       metaSchema: baseQueryMetaSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  metaSchema?: StandardSchemaV1<BaseQueryMeta<BaseQuery>>;\n\n  /**\n   * Defaults to `true`.\n   *\n   * Most apps should leave this setting on. The only time it can be a performance issue\n   * is if an API returns extremely large amounts of data (e.g. 10,000 rows per request) and\n   * you're unable to paginate it.\n   *\n   * For details of how this works, please see the below. When it is set to `false`,\n   * every request will cause subscribed components to rerender, even when the data has not changed.\n   *\n   * @see https://redux-toolkit.js.org/api/other-exports#copywithstructuralsharing\n   */\n  structuralSharing?: boolean;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       onSchemaFailure: (error, info) => {\n   *         console.error(error, info)\n   *       },\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       catchSchemaFailure: (error, info) => ({\n   *         status: \"CUSTOM_ERROR\",\n   *         error: error.schemaName + \" failed validation\",\n   *         data: error.issues,\n   *       }),\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for this endpoint.\n   * Overrides the global setting.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type BaseEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = (([CastAny<BaseQueryResult<BaseQuery>, {}>] extends [NEVER] ? never : EndpointDefinitionWithQuery<QueryArg, BaseQuery, ResultType, RawResultType>) | EndpointDefinitionWithQueryFn<QueryArg, BaseQuery, ResultType>) & CommonEndpointDefinition<QueryArg, BaseQuery, ResultType> & {\n  /* phantom type */\n  [rawResultType]?: RawResultType;\n  /* phantom type */\n  [resultType]?: ResultType;\n  /* phantom type */\n  [baseQuery]?: BaseQuery;\n} & HasRequiredProps<BaseQueryExtraOptions<BaseQuery>, {\n  extraOptions: BaseQueryExtraOptions<BaseQuery>;\n}, {\n  extraOptions?: BaseQueryExtraOptions<BaseQuery>;\n}>;\n\n// NOTE As with QueryStatus in `apiState.ts`, don't use this for real comparisons\n// at runtime, use the string constants defined below.\nexport enum DefinitionType {\n  query = 'query',\n  mutation = 'mutation',\n  infinitequery = 'infinitequery',\n}\nexport const ENDPOINT_QUERY = DefinitionType.query;\nexport const ENDPOINT_MUTATION = DefinitionType.mutation;\nexport const ENDPOINT_INFINITEQUERY = DefinitionType.infinitequery;\ntype TagDescriptionArray<TagTypes extends string> = ReadonlyArray<TagDescription<TagTypes> | undefined | null>;\nexport type GetResultDescriptionFn<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = (result: ResultType | undefined, error: ErrorType | undefined, arg: QueryArg, meta: MetaType) => TagDescriptionArray<TagTypes>;\nexport type FullTagDescription<TagType> = {\n  type: TagType;\n  id?: number | string;\n};\nexport type TagDescription<TagType> = TagType | FullTagDescription<TagType>;\n\n/**\n * @public\n */\nexport type ResultDescription<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = TagDescriptionArray<TagTypes> | GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>;\ntype QueryTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  QueryDefinition: QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface QueryExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.query;\n\n  /**\n   * Used by `query` endpoints. Determines which 'tag' is attached to the cached data returned by the query.\n   * Expects an array of tag type strings, an array of objects of tag types with ids, or a function that returns such an array.\n   * 1.  `['Post']` - equivalent to `2`\n   * 2.  `[{ type: 'Post' }]` - equivalent to `1`\n   * 3.  `[{ type: 'Post', id: 1 }]`\n   * 4.  `(result, error, arg) => ['Post']` - equivalent to `5`\n   * 5.  `(result, error, arg) => [{ type: 'Post' }]` - equivalent to `4`\n   * 6.  `(result, error, arg) => [{ type: 'Post', id: 1 }]`\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"providesTags example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       // highlight-start\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  providesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * Can be provided to merge an incoming response value into the current cache data.\n   * If supplied, no automatic structural sharing will be applied - it's up to\n   * you to update the cache appropriately.\n   *\n   * Since RTKQ normally replaces cache entries with the new response, you will usually\n   * need to use this with the `serializeQueryArgs` or `forceRefetch` options to keep\n   * an existing cache entry so that it can be updated.\n   *\n   * Since this is wrapped with Immer, you may either mutate the `currentCacheValue` directly,\n   * or return a new value, but _not_ both at once.\n   *\n   * Will only be called if the existing `currentCacheData` is _not_ `undefined` - on first response,\n   * the cache entry will just save the response data directly.\n   *\n   * Useful if you don't want a new request to completely override the current cache value,\n   * maybe because you have manually updated it from another source and don't want those\n   * updates to get lost.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"merge: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  merge?(currentCacheData: ResultType, responseData: ResultType, otherArgs: {\n    arg: QueryArg;\n    baseQueryMeta: BaseQueryMeta<BaseQuery>;\n    requestId: string;\n    fulfilledTimeStamp: number;\n  }): ResultType | void;\n\n  /**\n   * Check to see if the endpoint should force a refetch in cases where it normally wouldn't.\n   * This is primarily useful for \"infinite scroll\" / pagination use cases where\n   * RTKQ is keeping a single cache entry that is added to over time, in combination\n   * with `serializeQueryArgs` returning a fixed cache key and a `merge` callback\n   * set to add incoming data to the cache entry each time.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"forceRefresh: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  forceRefetch?(params: {\n    currentArg: QueryArg | undefined;\n    previousArg: QueryArg | undefined;\n    state: RootState<any, any, string>;\n    endpointState?: QuerySubState<any>;\n  }): boolean;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: QueryTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type QueryDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & QueryExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type InfiniteQueryTypes<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  InfiniteQueryDefinition: InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\nexport interface InfiniteQueryExtraOptions<TagTypes extends string, ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.infinitequery;\n  providesTags?: ResultDescription<TagTypes, InfiniteData<ResultType, PageParam>, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Required options to configure the infinite query behavior.\n   * `initialPageParam` and `getNextPageParam` are required, to\n   * ensure the infinite query can properly fetch the next page of data.\n   * `initialPageParam` may be specified when using the\n   * endpoint, to override the default value.\n   * `maxPages` and `getPreviousPageParam` are both optional.\n   * \n   * @example\n   * \n   * ```ts\n   * // codeblock-meta title=\"infiniteQueryOptions example\"\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * \n   * type Pokemon = {\n   *   id: string\n   *   name: string\n   * }\n   * \n   * const pokemonApi = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),\n   *   endpoints: (build) => ({\n   *     getInfinitePokemonWithMax: build.infiniteQuery<Pokemon[], string, number>({\n   *       infiniteQueryOptions: {\n   *         initialPageParam: 0,\n   *         maxPages: 3,\n   *         getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) =>\n   *           lastPageParam + 1,\n   *         getPreviousPageParam: (\n   *           firstPage,\n   *           allPages,\n   *           firstPageParam,\n   *           allPageParams,\n   *         ) => {\n   *           return firstPageParam > 0 ? firstPageParam - 1 : undefined\n   *         },\n   *       },\n   *       query({pageParam}) {\n   *         return `https://example.com/listItems?page=${pageParam}`\n   *       },\n   *     }),\n   *   }),\n   * })\n   \n   * ```\n   */\n  infiniteQueryOptions: InfiniteQueryConfigOptions<ResultType, PageParam, QueryArg>;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: InfiniteQueryTypes<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> =\n// Infinite query endpoints receive `{queryArg, pageParam}`\nBaseEndpointDefinition<InfiniteQueryCombinedArg<QueryArg, PageParam>, BaseQuery, ResultType, RawResultType> & InfiniteQueryExtraOptions<TagTypes, ResultType, QueryArg, PageParam, BaseQuery, ReducerPath, RawResultType>;\ntype MutationTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseMutation<typeof api.endpoints.query.Types.MutationDefinition> = ...\n   * ```\n   */\n  MutationDefinition: MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface MutationExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath> {\n  type: DefinitionType.mutation;\n\n  /**\n   * Used by `mutation` endpoints. Determines which cached data should be either re-fetched or removed from the cache.\n   * Expects the same shapes as `providesTags`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"invalidatesTags example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *       query(body) {\n   *         return {\n   *           url: `posts`,\n   *           method: 'POST',\n   *           body,\n   *         }\n   *       },\n   *       // highlight-start\n   *       invalidatesTags: [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  invalidatesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A mutation should not provide tags to the cache.\n   */\n  providesTags?: never;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: MutationTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type MutationDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & MutationExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type EndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, PageParam = any, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\nexport type EndpointDefinitions = Record<string, EndpointDefinition<any, any, any, any, any, any, any>>;\nexport function isQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is QueryDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_QUERY;\n}\nexport function isMutationDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is MutationDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_MUTATION;\n}\nexport function isInfiniteQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is InfiniteQueryDefinition<any, any, any, any, any, any, any> {\n  return e.type === ENDPOINT_INFINITEQUERY;\n}\nexport function isAnyQueryDefinition(e: EndpointDefinition<any, any, any, any>): e is QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any> {\n  return isQueryDefinition(e) || isInfiniteQueryDefinition(e);\n}\nexport type EndpointBuilder<BaseQuery extends BaseQueryFn, TagTypes extends string, ReducerPath extends string> = {\n  /**\n   * An endpoint definition that retrieves data, and may provide tags to the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all query endpoint options\"\n   * const api = createApi({\n   *  baseQuery,\n   *  endpoints: (build) => ({\n   *    getPost: build.query({\n   *      query: (id) => ({ url: `post/${id}` }),\n   *      // Pick out data and prevent nested properties in a hook or selector\n   *      transformResponse: (response) => response.data,\n   *      // Pick out error and prevent nested properties in a hook or selector\n   *      transformErrorResponse: (response) => response.error,\n   *      // `result` is the server response\n   *      providesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry, updateCachedData }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry, updateCachedData }) {},\n   *    }),\n   *  }),\n   *});\n   *```\n   */\n  query<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n\n  /**\n   * An endpoint definition that alters data on the server or will possibly invalidate the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all mutation endpoint options\"\n   * const api = createApi({\n   *   baseQuery,\n   *   endpoints: (build) => ({\n   *     updatePost: build.mutation({\n   *       query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),\n   *       // Pick out data and prevent nested properties in a hook or selector\n   *       transformResponse: (response) => response.data,\n   *       // Pick out error and prevent nested properties in a hook or selector\n   *       transformErrorResponse: (response) => response.error,\n   *       // `result` is the server response\n   *       invalidatesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry }) {},\n   *     }),\n   *   }),\n   * });\n   * ```\n   */\n  mutation<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n  infiniteQuery<ResultType, QueryArg, PageParam, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n};\nexport type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T;\nexport function calculateProvidedBy<ResultType, QueryArg, ErrorType, MetaType>(description: ResultDescription<string, ResultType, QueryArg, ErrorType, MetaType> | undefined, result: ResultType | undefined, error: ErrorType | undefined, queryArg: QueryArg, meta: MetaType | undefined, assertTagTypes: AssertTagTypes): readonly FullTagDescription<string>[] {\n  const finalDescription = isFunction(description) ? description(result as ResultType, error as undefined, queryArg, meta as MetaType) : description;\n  if (finalDescription) {\n    return filterMap(finalDescription, isNotNullish, tag => assertTagTypes(expandTagDescription(tag)));\n  }\n  return [];\n}\nfunction isFunction<T>(t: T): t is Extract<T, Function> {\n  return typeof t === 'function';\n}\nexport function expandTagDescription(description: TagDescription<string>): FullTagDescription<string> {\n  return typeof description === 'string' ? {\n    type: description\n  } : description;\n}\nexport type QueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<infer QA, any, any, any> ? QA : never;\n\n// Just extracting `QueryArg` from `BaseEndpointDefinition`\n// doesn't sufficiently match here.\n// We need to explicitly match against `InfiniteQueryDefinition`\nexport type InfiniteQueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<infer QA, any, any, any, any, any, any> ? QA : never;\nexport type QueryArgFromAnyQuery<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any, any, any> ? InfiniteQueryArgFrom<D> : D extends QueryDefinition<any, any, any, any, any, any> ? QueryArgFrom<D> : never;\nexport type ResultTypeFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<any, any, infer RT, any> ? RT : unknown;\nexport type ReducerPathFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, any, any, infer RP, any, any> ? RP : unknown;\nexport type TagTypesFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, infer TT, any, any, any, any> ? TT : unknown;\nexport type PageParamFrom<D extends InfiniteQueryDefinition<any, any, any, any, any, any, any>> = D extends InfiniteQueryDefinition<any, infer PP, any, any, any, any, any> ? PP : unknown;\nexport type InfiniteQueryCombinedArg<QueryArg, PageParam> = {\n  queryArg: QueryArg;\n  pageParam: PageParam;\n};\nexport type TagTypesFromApi<T> = T extends Api<any, any, any, infer TagTypes> ? TagTypes : never;\nexport type DefinitionsFromApi<T> = T extends Api<any, infer Definitions, any, any> ? Definitions : never;\nexport type TransformedResponse<NewDefinitions extends EndpointDefinitions, K, ResultType> = K extends keyof NewDefinitions ? NewDefinitions[K]['transformResponse'] extends undefined ? ResultType : UnwrapPromise<ReturnType<NonUndefined<NewDefinitions[K]['transformResponse']>>> : ResultType;\nexport type OverrideResultType<Definition, NewResultType> = Definition extends QueryDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends MutationDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, NewResultType, ReducerPath> : never;\nexport type UpdateDefinitions<Definitions extends EndpointDefinitions, NewTagTypes extends string, NewDefinitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends MutationDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : never };","export { current, isDraft, applyPatches, original, isDraftable, produceWithPatches, enablePatches } from 'immer';","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { AsyncThunkAction, SafePromise, SerializedError, ThunkAction, UnknownAction } from '@reduxjs/toolkit';\nimport type { Dispatch } from 'redux';\nimport { asSafePromise } from '../../tsHelpers';\nimport { getEndpointDefinition, type Api, type ApiContext } from '../apiTypes';\nimport type { BaseQueryError, QueryReturnValue } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport { ENDPOINT_QUERY, isQueryDefinition, type EndpointDefinition, type EndpointDefinitions, type InfiniteQueryArgFrom, type InfiniteQueryDefinition, type MutationDefinition, type PageParamFrom, type QueryArgFrom, type QueryDefinition, type ResultTypeFrom } from '../endpointDefinitions';\nimport { filterNullishValues } from '../utils';\nimport type { InfiniteData, InfiniteQueryConfigOptions, InfiniteQueryDirection, SubscriptionOptions } from './apiState';\nimport type { InfiniteQueryResultSelectorResult, QueryResultSelectorResult } from './buildSelectors';\nimport type { InfiniteQueryThunk, InfiniteQueryThunkArg, MutationThunk, QueryThunk, QueryThunkArg, ThunkApiMetaConfig } from './buildThunks';\nimport type { ApiEndpointQuery } from './module';\nimport type { InternalMiddlewareState } from './buildMiddleware/types';\nexport type BuildInitiateApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>> = {\n  initiate: StartQueryActionCreator<Definition>;\n};\nexport type BuildInitiateApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  initiate: StartInfiniteQueryActionCreator<Definition>;\n};\nexport type BuildInitiateApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>> = {\n  initiate: StartMutationActionCreator<Definition>;\n};\nexport const forceQueryFnSymbol = Symbol('forceQueryFn');\nexport const isUpsertQuery = (arg: QueryThunkArg) => typeof arg[forceQueryFnSymbol] === 'function';\nexport type StartQueryActionCreatorOptions = {\n  subscribe?: boolean;\n  forceRefetch?: boolean | number;\n  subscriptionOptions?: SubscriptionOptions;\n  [forceQueryFnSymbol]?: () => QueryReturnValue;\n};\ntype RefetchOptions = {\n  refetchCachedPages?: boolean;\n};\nexport type StartInfiniteQueryActionCreatorOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>> = StartQueryActionCreatorOptions & {\n  direction?: InfiniteQueryDirection;\n  param?: unknown;\n} & Partial<Pick<Partial<InfiniteQueryConfigOptions<ResultTypeFrom<D>, PageParamFrom<D>, InfiniteQueryArgFrom<D>>>, 'initialPageParam' | 'refetchCachedPages'>>;\ntype AnyQueryActionCreator<D extends EndpointDefinition<any, any, any, any>> = (arg: any, options?: StartQueryActionCreatorOptions) => ThunkAction<AnyActionCreatorResult, any, any, UnknownAction>;\ntype StartQueryActionCreator<D extends QueryDefinition<any, any, any, any, any>> = (arg: QueryArgFrom<D>, options?: StartQueryActionCreatorOptions) => ThunkAction<QueryActionCreatorResult<D>, any, any, UnknownAction>;\nexport type StartInfiniteQueryActionCreator<D extends InfiniteQueryDefinition<any, any, any, any, any>> = (arg: InfiniteQueryArgFrom<D>, options?: StartInfiniteQueryActionCreatorOptions<D>) => ThunkAction<InfiniteQueryActionCreatorResult<D>, any, any, UnknownAction>;\ntype QueryActionCreatorFields = {\n  requestId: string;\n  subscriptionOptions: SubscriptionOptions | undefined;\n  abort(): void;\n  unsubscribe(): void;\n  updateSubscriptionOptions(options: SubscriptionOptions): void;\n  queryCacheKey: string;\n};\ntype AnyActionCreatorResult = SafePromise<any> & QueryActionCreatorFields & {\n  arg: any;\n  unwrap(): Promise<any>;\n  refetch(options?: RefetchOptions): AnyActionCreatorResult;\n};\nexport type QueryActionCreatorResult<D extends QueryDefinition<any, any, any, any>> = SafePromise<QueryResultSelectorResult<D>> & QueryActionCreatorFields & {\n  arg: QueryArgFrom<D>;\n  unwrap(): Promise<ResultTypeFrom<D>>;\n  refetch(): QueryActionCreatorResult<D>;\n};\nexport type InfiniteQueryActionCreatorResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = SafePromise<InfiniteQueryResultSelectorResult<D>> & QueryActionCreatorFields & {\n  arg: InfiniteQueryArgFrom<D>;\n  unwrap(): Promise<InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>>;\n  refetch(options?: Pick<StartInfiniteQueryActionCreatorOptions<D>, 'refetchCachedPages'>): InfiniteQueryActionCreatorResult<D>;\n};\ntype StartMutationActionCreator<D extends MutationDefinition<any, any, any, any>> = (arg: QueryArgFrom<D>, options?: {\n  /**\n   * If this mutation should be tracked in the store.\n   * If you just want to manually trigger this mutation using `dispatch` and don't care about the\n   * result, state & potential errors being held in store, you can set this to false.\n   * (defaults to `true`)\n   */\n  track?: boolean;\n  fixedCacheKey?: string;\n}) => ThunkAction<MutationActionCreatorResult<D>, any, any, UnknownAction>;\nexport type MutationActionCreatorResult<D extends MutationDefinition<any, any, any, any>> = SafePromise<{\n  data: ResultTypeFrom<D>;\n  error?: undefined;\n} | {\n  data?: undefined;\n  error: Exclude<BaseQueryError<D extends MutationDefinition<any, infer BaseQuery, any, any> ? BaseQuery : never>, undefined> | SerializedError;\n}> & {\n  /** @internal */\n  arg: {\n    /**\n     * The name of the given endpoint for the mutation\n     */\n    endpointName: string;\n    /**\n     * The original arguments supplied to the mutation call\n     */\n    originalArgs: QueryArgFrom<D>;\n    /**\n     * Whether the mutation is being tracked in the store.\n     */\n    track?: boolean;\n    fixedCacheKey?: string;\n  };\n  /**\n   * A unique string generated for the request sequence\n   */\n  requestId: string;\n\n  /**\n   * A method to cancel the mutation promise. Note that this is not intended to prevent the mutation\n   * that was fired off from reaching the server, but only to assist in handling the response.\n   *\n   * Calling `abort()` prior to the promise resolving will force it to reach the error state with\n   * the serialized error:\n   * `{ name: 'AbortError', message: 'Aborted' }`\n   *\n   * @example\n   * ```ts\n   * const [updateUser] = useUpdateUserMutation();\n   *\n   * useEffect(() => {\n   *   const promise = updateUser(id);\n   *   promise\n   *     .unwrap()\n   *     .catch((err) => {\n   *       if (err.name === 'AbortError') return;\n   *       // else handle the unexpected error\n   *     })\n   *\n   *   return () => {\n   *     promise.abort();\n   *   }\n   * }, [id, updateUser])\n   * ```\n   */\n  abort(): void;\n  /**\n   * Unwraps a mutation call to provide the raw response/error.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a mutation, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap\"\n   * addPost({ id: 1, name: 'Example' })\n   *   .unwrap()\n   *   .then((payload) => console.log('fulfilled', payload))\n   *   .catch((error) => console.error('rejected', error));\n   * ```\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await addPost({ id: 1, name: 'Example' }).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  unwrap(): Promise<ResultTypeFrom<D>>;\n  /**\n   * A method to manually unsubscribe from the mutation call, meaning it will be removed from cache after the usual caching grace period.\n   The value returned by the hook will reset to `isUninitialized` afterwards.\n   */\n  reset(): void;\n};\nexport function buildInitiate({\n  serializeQueryArgs,\n  queryThunk,\n  infiniteQueryThunk,\n  mutationThunk,\n  api,\n  context,\n  getInternalState\n}: {\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  queryThunk: QueryThunk;\n  infiniteQueryThunk: InfiniteQueryThunk<any>;\n  mutationThunk: MutationThunk;\n  api: Api<any, EndpointDefinitions, any, any>;\n  context: ApiContext<EndpointDefinitions>;\n  getInternalState: (dispatch: Dispatch) => InternalMiddlewareState;\n}) {\n  const getRunningQueries = (dispatch: Dispatch) => getInternalState(dispatch)?.runningQueries;\n  const getRunningMutations = (dispatch: Dispatch) => getInternalState(dispatch)?.runningMutations;\n  const {\n    unsubscribeQueryResult,\n    removeMutationResult,\n    updateSubscriptionOptions\n  } = api.internalActions;\n  return {\n    buildInitiateQuery,\n    buildInitiateInfiniteQuery,\n    buildInitiateMutation,\n    getRunningQueryThunk,\n    getRunningMutationThunk,\n    getRunningQueriesThunk,\n    getRunningMutationsThunk\n  };\n  function getRunningQueryThunk(endpointName: string, queryArgs: any) {\n    return (dispatch: Dispatch) => {\n      const endpointDefinition = getEndpointDefinition(context, endpointName);\n      const queryCacheKey = serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      });\n      return getRunningQueries(dispatch)?.get(queryCacheKey) as QueryActionCreatorResult<never> | InfiniteQueryActionCreatorResult<never> | undefined;\n    };\n  }\n  function getRunningMutationThunk(\n  /**\n   * this is only here to allow TS to infer the result type by input value\n   * we could use it to validate the result, but it's probably not necessary\n   */\n  _endpointName: string, fixedCacheKeyOrRequestId: string) {\n    return (dispatch: Dispatch) => {\n      return getRunningMutations(dispatch)?.get(fixedCacheKeyOrRequestId) as MutationActionCreatorResult<never> | undefined;\n    };\n  }\n  function getRunningQueriesThunk() {\n    return (dispatch: Dispatch) => filterNullishValues(getRunningQueries(dispatch));\n  }\n  function getRunningMutationsThunk() {\n    return (dispatch: Dispatch) => filterNullishValues(getRunningMutations(dispatch));\n  }\n  function middlewareWarning(dispatch: Dispatch) {\n    if (process.env.NODE_ENV !== 'production') {\n      if ((middlewareWarning as any).triggered) return;\n      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());\n      (middlewareWarning as any).triggered = true;\n\n      // The RTKQ middleware should return the internal state object,\n      // but it should _not_ be the action object.\n      if (typeof returnedValue !== 'object' || typeof returnedValue?.type === 'string') {\n        // Otherwise, must not have been added\n        throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(34) : `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!`);\n      }\n    }\n  }\n  function buildInitiateAnyQuery<T extends 'query' | 'infiniteQuery'>(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any>) {\n    const queryAction: AnyQueryActionCreator<any> = (arg, {\n      subscribe = true,\n      forceRefetch,\n      subscriptionOptions,\n      [forceQueryFnSymbol]: forceQueryFn,\n      ...rest\n    } = {}) => (dispatch, getState) => {\n      const queryCacheKey = serializeQueryArgs({\n        queryArgs: arg,\n        endpointDefinition,\n        endpointName\n      });\n      let thunk: AsyncThunkAction<unknown, QueryThunkArg, ThunkApiMetaConfig>;\n      const commonThunkArgs = {\n        ...rest,\n        type: ENDPOINT_QUERY as 'query',\n        subscribe,\n        forceRefetch: forceRefetch,\n        subscriptionOptions,\n        endpointName,\n        originalArgs: arg,\n        queryCacheKey,\n        [forceQueryFnSymbol]: forceQueryFn\n      };\n      if (isQueryDefinition(endpointDefinition)) {\n        thunk = queryThunk(commonThunkArgs);\n      } else {\n        const {\n          direction,\n          initialPageParam,\n          refetchCachedPages\n        } = rest as Pick<InfiniteQueryThunkArg<any>, 'direction' | 'initialPageParam' | 'refetchCachedPages'>;\n        thunk = infiniteQueryThunk({\n          ...(commonThunkArgs as InfiniteQueryThunkArg<any>),\n          // Supply these even if undefined. This helps with a field existence\n          // check over in `buildSlice.ts`\n          direction,\n          initialPageParam,\n          refetchCachedPages\n        });\n      }\n      const selector = (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).select(arg);\n      const thunkResult = dispatch(thunk);\n      const stateAfter = selector(getState());\n      middlewareWarning(dispatch);\n      const {\n        requestId,\n        abort\n      } = thunkResult;\n      const skippedSynchronously = stateAfter.requestId !== requestId;\n      const runningQuery = getRunningQueries(dispatch)?.get(queryCacheKey);\n      const selectFromState = () => selector(getState());\n      const statePromise: AnyActionCreatorResult = Object.assign((forceQueryFn ?\n      // a query has been forced (upsertQueryData)\n      // -> we want to resolve it once data has been written with the data that will be written\n      thunkResult.then(selectFromState) : skippedSynchronously && !runningQuery ?\n      // a query has been skipped due to a condition and we do not have any currently running query\n      // -> we want to resolve it immediately with the current data\n      Promise.resolve(stateAfter) :\n      // query just started or one is already in flight\n      // -> wait for the running query, then resolve with data from after that\n      Promise.all([runningQuery, thunkResult]).then(selectFromState)) as SafePromise<any>, {\n        arg,\n        requestId,\n        subscriptionOptions,\n        queryCacheKey,\n        abort,\n        async unwrap() {\n          const result = await statePromise;\n          if (result.isError) {\n            throw result.error;\n          }\n          return result.data;\n        },\n        refetch: (options?: RefetchOptions) => dispatch(queryAction(arg, {\n          subscribe: false,\n          forceRefetch: true,\n          ...options\n        })),\n        unsubscribe() {\n          if (subscribe) dispatch(unsubscribeQueryResult({\n            queryCacheKey,\n            requestId\n          }));\n        },\n        updateSubscriptionOptions(options: SubscriptionOptions) {\n          statePromise.subscriptionOptions = options;\n          dispatch(updateSubscriptionOptions({\n            endpointName,\n            requestId,\n            queryCacheKey,\n            options\n          }));\n        }\n      });\n      if (!runningQuery && !skippedSynchronously && !forceQueryFn) {\n        const runningQueries = getRunningQueries(dispatch)!;\n        runningQueries.set(queryCacheKey, statePromise);\n        statePromise.then(() => {\n          runningQueries.delete(queryCacheKey);\n        });\n      }\n      return statePromise;\n    };\n    return queryAction;\n  }\n  function buildInitiateQuery(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any>) {\n    const queryAction: StartQueryActionCreator<any> = buildInitiateAnyQuery(endpointName, endpointDefinition);\n    return queryAction;\n  }\n  function buildInitiateInfiniteQuery(endpointName: string, endpointDefinition: InfiniteQueryDefinition<any, any, any, any, any>) {\n    const infiniteQueryAction: StartInfiniteQueryActionCreator<any> = buildInitiateAnyQuery(endpointName, endpointDefinition);\n    return infiniteQueryAction;\n  }\n  function buildInitiateMutation(endpointName: string): StartMutationActionCreator<any> {\n    return (arg, {\n      track = true,\n      fixedCacheKey\n    } = {}) => (dispatch, getState) => {\n      const thunk = mutationThunk({\n        type: 'mutation',\n        endpointName,\n        originalArgs: arg,\n        track,\n        fixedCacheKey\n      });\n      const thunkResult = dispatch(thunk);\n      middlewareWarning(dispatch);\n      const {\n        requestId,\n        abort,\n        unwrap\n      } = thunkResult;\n      const returnValuePromise = asSafePromise(thunkResult.unwrap().then(data => ({\n        data\n      })), error => ({\n        error\n      }));\n      const reset = () => {\n        dispatch(removeMutationResult({\n          requestId,\n          fixedCacheKey\n        }));\n      };\n      const ret = Object.assign(returnValuePromise, {\n        arg: thunkResult.arg,\n        requestId,\n        abort,\n        unwrap,\n        reset\n      });\n      const runningMutations = getRunningMutations(dispatch)!;\n      runningMutations.set(requestId, ret);\n      ret.then(() => {\n        runningMutations.delete(requestId);\n      });\n      if (fixedCacheKey) {\n        runningMutations.set(fixedCacheKey, ret);\n        ret.then(() => {\n          if (runningMutations.get(fixedCacheKey) === ret) {\n            runningMutations.delete(fixedCacheKey);\n          }\n        });\n      }\n      return ret;\n    };\n  }\n}","import type { Middleware, StoreEnhancer } from 'redux';\nimport type { Tuple } from './utils';\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>) {\n  Object.assign(target, ...args);\n}\n\n/**\n * return True if T is `any`, otherwise return False\n * taken from https://github.com/joonhocho/tsdef\n *\n * @internal\n */\nexport type IsAny<T, True, False = never> =\n// test if we are going the left AND right path in the condition\ntrue | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;\n\n/**\n * return True if T is `unknown`, otherwise return False\n * taken from https://github.com/joonhocho/tsdef\n *\n * @internal\n */\nexport type IsUnknown<T, True, False = never> = unknown extends T ? IsAny<T, False, True> : False;\nexport type FallbackIfUnknown<T, Fallback> = IsUnknown<T, Fallback, T>;\n\n/**\n * @internal\n */\nexport type IfMaybeUndefined<P, True, False> = [undefined] extends [P] ? True : False;\n\n/**\n * @internal\n */\nexport type IfVoid<P, True, False> = [void] extends [P] ? True : False;\n\n/**\n * @internal\n */\nexport type IsEmptyObj<T, True, False = never> = T extends any ? keyof T extends never ? IsUnknown<T, False, IfMaybeUndefined<T, False, IfVoid<T, False, True>>> : False : never;\n\n/**\n * returns True if TS version is above 3.5, False if below.\n * uses feature detection to detect TS version >= 3.5\n * * versions below 3.5 will return `{}` for unresolvable interference\n * * versions above will return `unknown`\n *\n * @internal\n */\nexport type AtLeastTS35<True, False> = [True, False][IsUnknown<ReturnType<<T>() => T>, 0, 1>];\n\n/**\n * @internal\n */\nexport type IsUnknownOrNonInferrable<T, True, False> = AtLeastTS35<IsUnknown<T, True, False>, IsEmptyObj<T, True, IsUnknown<T, True, False>>>;\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\n\n// Appears to have a convenient side effect of ignoring `never` even if that's not what you specified\nexport type ExcludeFromTuple<T, E, Acc extends unknown[] = []> = T extends [infer Head, ...infer Tail] ? ExcludeFromTuple<Tail, E, [...Acc, ...([Head] extends [E] ? [] : [Head])]> : Acc;\ntype ExtractDispatchFromMiddlewareTuple<MiddlewareTuple extends readonly any[], Acc extends {}> = MiddlewareTuple extends [infer Head, ...infer Tail] ? ExtractDispatchFromMiddlewareTuple<Tail, Acc & (Head extends Middleware<infer D> ? IsAny<D, {}, D> : {})> : Acc;\nexport type ExtractDispatchExtensions<M> = M extends Tuple<infer MiddlewareTuple> ? ExtractDispatchFromMiddlewareTuple<MiddlewareTuple, {}> : M extends ReadonlyArray<Middleware> ? ExtractDispatchFromMiddlewareTuple<[...M], {}> : never;\ntype ExtractStoreExtensionsFromEnhancerTuple<EnhancerTuple extends readonly any[], Acc extends {}> = EnhancerTuple extends [infer Head, ...infer Tail] ? ExtractStoreExtensionsFromEnhancerTuple<Tail, Acc & (Head extends StoreEnhancer<infer Ext> ? IsAny<Ext, {}, Ext> : {})> : Acc;\nexport type ExtractStoreExtensions<E> = E extends Tuple<infer EnhancerTuple> ? ExtractStoreExtensionsFromEnhancerTuple<EnhancerTuple, {}> : E extends ReadonlyArray<StoreEnhancer> ? UnionToIntersection<E[number] extends StoreEnhancer<infer Ext> ? Ext extends {} ? IsAny<Ext, {}, Ext> : {} : {}> : never;\ntype ExtractStateExtensionsFromEnhancerTuple<EnhancerTuple extends readonly any[], Acc extends {}> = EnhancerTuple extends [infer Head, ...infer Tail] ? ExtractStateExtensionsFromEnhancerTuple<Tail, Acc & (Head extends StoreEnhancer<any, infer StateExt> ? IsAny<StateExt, {}, StateExt> : {})> : Acc;\nexport type ExtractStateExtensions<E> = E extends Tuple<infer EnhancerTuple> ? ExtractStateExtensionsFromEnhancerTuple<EnhancerTuple, {}> : E extends ReadonlyArray<StoreEnhancer> ? UnionToIntersection<E[number] extends StoreEnhancer<any, infer StateExt> ? StateExt extends {} ? IsAny<StateExt, {}, StateExt> : {} : {}> : never;\n\n/**\n * Helper type. Passes T out again, but boxes it in a way that it cannot\n * \"widen\" the type by accident if it is a generic that should be inferred\n * from elsewhere.\n *\n * @internal\n */\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type WithOptionalProp<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\nexport interface TypeGuard<T> {\n  (value: any): value is T;\n}\nexport interface HasMatchFunction<T> {\n  match: TypeGuard<T>;\n}\nexport const hasMatchFunction = <T,>(v: Matcher<T>): v is HasMatchFunction<T> => {\n  return v && typeof (v as HasMatchFunction<T>).match === 'function';\n};\n\n/** @public */\nexport type Matcher<T> = HasMatchFunction<T> | TypeGuard<T>;\n\n/** @public */\nexport type ActionFromMatcher<M extends Matcher<any>> = M extends Matcher<infer T> ? T : never;\nexport type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type Tail<T extends any[]> = T extends [any, ...infer Tail] ? Tail : never;\nexport type UnknownIfNonSpecific<T> = {} extends T ? unknown : T;\n\n/**\n * A Promise that will never reject.\n * @see https://github.com/reduxjs/redux-toolkit/issues/4101\n */\nexport type SafePromise<T> = Promise<T> & {\n  __linterBrands: 'SafePromise';\n};\n\n/**\n * Properly wraps a Promise as a {@link SafePromise} with .catch(fallback).\n */\nexport function asSafePromise<Resolved, Rejected>(promise: Promise<Resolved>, fallback: (error: unknown) => Rejected) {\n  return promise.catch(fallback) as SafePromise<Resolved | Rejected>;\n}","import type { UnknownAction } from '@reduxjs/toolkit';\nimport type { BaseQueryFn } from './baseQueryTypes';\nimport type { CombinedState, CoreModule, QueryKeys } from './core';\nimport type { ApiModules } from './core/module';\nimport type { CreateApiOptions } from './createApi';\nimport type { EndpointBuilder, EndpointDefinition, EndpointDefinitions, UpdateDefinitions } from './endpointDefinitions';\nimport type { NoInfer, UnionToIntersection, WithRequiredProp } from './tsHelpers';\nexport type ModuleName = keyof ApiModules<any, any, any, any>;\nexport type Module<Name extends ModuleName> = {\n  name: Name;\n  init<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string>(api: Api<BaseQuery, EndpointDefinitions, ReducerPath, TagTypes, ModuleName>, options: WithRequiredProp<CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>, 'reducerPath' | 'serializeQueryArgs' | 'keepUnusedDataFor' | 'refetchOnMountOrArgChange' | 'refetchOnFocus' | 'refetchOnReconnect' | 'invalidationBehavior' | 'tagTypes'>, context: ApiContext<Definitions>): {\n    injectEndpoint(endpointName: string, definition: EndpointDefinition<any, any, any, any>): void;\n  };\n};\nexport interface ApiContext<Definitions extends EndpointDefinitions> {\n  apiUid: string;\n  endpointDefinitions: Definitions;\n  batch(cb: () => void): void;\n  extractRehydrationInfo: (action: UnknownAction) => CombinedState<any, any, any> | undefined;\n  hasRehydrationInfo: (action: UnknownAction) => boolean;\n}\nexport const getEndpointDefinition = <Definitions extends EndpointDefinitions, EndpointName extends keyof Definitions>(context: ApiContext<Definitions>, endpointName: EndpointName) => context.endpointDefinitions[endpointName];\nexport type Api<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string, Enhancers extends ModuleName = CoreModule> = UnionToIntersection<ApiModules<BaseQuery, Definitions, ReducerPath, TagTypes>[Enhancers]> & {\n  /**\n   * A function to inject the endpoints into the original API, but also give you that same API with correct types for these endpoints back. Useful with code-splitting.\n   */\n  injectEndpoints<NewDefinitions extends EndpointDefinitions>(_: {\n    endpoints: (build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>) => NewDefinitions;\n    /**\n     * Optionally allows endpoints to be overridden if defined by multiple `injectEndpoints` calls.\n     *\n     * If set to `true`, will override existing endpoints with the new definition.\n     * If set to `'throw'`, will throw an error if an endpoint is redefined with a different definition.\n     * If set to `false` (or unset), will not override existing endpoints with the new definition, and log a warning in development.\n     */\n    overrideExisting?: boolean | 'throw';\n  }): Api<BaseQuery, Definitions & NewDefinitions, ReducerPath, TagTypes, Enhancers>;\n  /**\n   *A function to enhance a generated API with additional information. Useful with code-generation.\n   */\n  enhanceEndpoints<NewTagTypes extends string = never, NewDefinitions extends EndpointDefinitions = never>(_: {\n    addTagTypes?: readonly NewTagTypes[];\n    endpoints?: UpdateDefinitions<Definitions, TagTypes | NoInfer<NewTagTypes>, NewDefinitions> extends infer NewDefinitions ? { [K in keyof NewDefinitions]?: Partial<NewDefinitions[K]> | ((definition: NewDefinitions[K]) => void) } : never;\n  }): Api<BaseQuery, UpdateDefinitions<Definitions, TagTypes | NewTagTypes, NewDefinitions>, ReducerPath, TagTypes | NewTagTypes, Enhancers>;\n};","import type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { SchemaError } from '@standard-schema/utils';\nimport type { SchemaType } from './endpointDefinitions';\nexport class NamedSchemaError extends SchemaError {\n  constructor(issues: readonly StandardSchemaV1.Issue[], public readonly value: any, public readonly schemaName: `${SchemaType}Schema`, public readonly _bqMeta: any) {\n    super(issues);\n  }\n}\nexport const shouldSkip = (skipSchemaValidation: boolean | SchemaType[] | undefined, schemaName: SchemaType) => Array.isArray(skipSchemaValidation) ? skipSchemaValidation.includes(schemaName) : !!skipSchemaValidation;\nexport async function parseWithSchema<Schema extends StandardSchemaV1>(schema: Schema, data: unknown, schemaName: `${SchemaType}Schema`, bqMeta: any): Promise<StandardSchemaV1.InferOutput<Schema>> {\n  const result = await schema['~standard'].validate(data);\n  if (result.issues) {\n    throw new NamedSchemaError(result.issues, data, schemaName, bqMeta);\n  }\n  return result.value;\n}","import type { AsyncThunk, AsyncThunkPayloadCreator, Draft, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { Patch } from 'immer';\nimport { isDraftable, produceWithPatches } from '../utils/immerImports';\nimport type { Api, ApiContext } from '../apiTypes';\nimport type { BaseQueryError, BaseQueryFn, QueryReturnValue } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { AssertTagTypes, EndpointDefinition, EndpointDefinitions, InfiniteQueryArgFrom, InfiniteQueryCombinedArg, InfiniteQueryDefinition, MutationDefinition, PageParamFrom, QueryArgFrom, QueryDefinition, ResultDescription, ResultTypeFrom, SchemaFailureConverter, SchemaFailureHandler, SchemaFailureInfo, SchemaType } from '../endpointDefinitions';\nimport { calculateProvidedBy, ENDPOINT_QUERY, isInfiniteQueryDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { HandledError } from '../HandledError';\nimport type { UnwrapPromise } from '../tsHelpers';\nimport type { RootState, QueryKeys, QuerySubstateIdentifier, InfiniteData, InfiniteQueryConfigOptions, QueryCacheKey, InfiniteQueryDirection, InfiniteQueryKeys } from './apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from './apiState';\nimport type { InfiniteQueryActionCreatorResult, QueryActionCreatorResult, StartInfiniteQueryActionCreatorOptions, StartQueryActionCreatorOptions } from './buildInitiate';\nimport { forceQueryFnSymbol, isUpsertQuery } from './buildInitiate';\nimport type { AllSelectors } from './buildSelectors';\nimport type { ApiEndpointQuery, PrefetchOptions } from './module';\nimport { createAsyncThunk, isAllOf, isFulfilled, isPending, isRejected, isRejectedWithValue, SHOULD_AUTOBATCH } from './rtkImports';\nimport { parseWithSchema, NamedSchemaError, shouldSkip } from '../standardSchema';\nexport type BuildThunksApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>> = Matchers<QueryThunk, Definition>;\nexport type BuildThunksApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = Matchers<InfiniteQueryThunk<any>, Definition>;\nexport type BuildThunksApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>> = Matchers<MutationThunk, Definition>;\ntype EndpointThunk<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = Definition extends EndpointDefinition<infer QueryArg, infer BaseQueryFn, any, infer ResultType> ? Thunk extends AsyncThunk<unknown, infer ATArg, infer ATConfig> ? AsyncThunk<ResultType, ATArg & {\n  originalArgs: QueryArg;\n}, ATConfig & {\n  rejectValue: BaseQueryError<BaseQueryFn>;\n}> : never : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQueryFn, any, infer ResultType> ? Thunk extends AsyncThunk<unknown, infer ATArg, infer ATConfig> ? AsyncThunk<InfiniteData<ResultType, PageParam>, ATArg & {\n  originalArgs: QueryArg;\n}, ATConfig & {\n  rejectValue: BaseQueryError<BaseQueryFn>;\n}> : never : never;\nexport type PendingAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['pending']>;\nexport type FulfilledAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['fulfilled']>;\nexport type RejectedAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['rejected']>;\nexport type Matcher<M> = (value: any) => value is M;\nexport interface Matchers<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> {\n  matchPending: Matcher<PendingAction<Thunk, Definition>>;\n  matchFulfilled: Matcher<FulfilledAction<Thunk, Definition>>;\n  matchRejected: Matcher<RejectedAction<Thunk, Definition>>;\n}\nexport type QueryThunkArg = QuerySubstateIdentifier & StartQueryActionCreatorOptions & {\n  type: 'query';\n  originalArgs: unknown;\n  endpointName: string;\n};\nexport type InfiniteQueryThunkArg<D extends InfiniteQueryDefinition<any, any, any, any, any>> = QuerySubstateIdentifier & StartInfiniteQueryActionCreatorOptions<D> & {\n  type: `query`;\n  originalArgs: unknown;\n  endpointName: string;\n  param: unknown;\n  direction?: InfiniteQueryDirection;\n  refetchCachedPages?: boolean;\n};\ntype MutationThunkArg = {\n  type: 'mutation';\n  originalArgs: unknown;\n  endpointName: string;\n  track?: boolean;\n  fixedCacheKey?: string;\n};\nexport type ThunkResult = unknown;\nexport type ThunkApiMetaConfig = {\n  pendingMeta: {\n    startedTimeStamp: number;\n    [SHOULD_AUTOBATCH]: true;\n  };\n  fulfilledMeta: {\n    fulfilledTimeStamp: number;\n    baseQueryMeta: unknown;\n    [SHOULD_AUTOBATCH]: true;\n  };\n  rejectedMeta: {\n    baseQueryMeta: unknown;\n    [SHOULD_AUTOBATCH]: true;\n  };\n};\nexport type QueryThunk = AsyncThunk<ThunkResult, QueryThunkArg, ThunkApiMetaConfig>;\nexport type InfiniteQueryThunk<D extends InfiniteQueryDefinition<any, any, any, any, any>> = AsyncThunk<ThunkResult, InfiniteQueryThunkArg<D>, ThunkApiMetaConfig>;\nexport type MutationThunk = AsyncThunk<ThunkResult, MutationThunkArg, ThunkApiMetaConfig>;\nfunction defaultTransformResponse(baseQueryReturnValue: unknown) {\n  return baseQueryReturnValue;\n}\nexport type MaybeDrafted<T> = T | Draft<T>;\nexport type Recipe<T> = (data: MaybeDrafted<T>) => void | MaybeDrafted<T>;\nexport type UpsertRecipe<T> = (data: MaybeDrafted<T> | undefined) => void | MaybeDrafted<T>;\nexport type PatchQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFrom<Definitions[EndpointName]>, patches: readonly Patch[], updateProvided?: boolean) => ThunkAction<void, PartialState, any, UnknownAction>;\nexport type AllQueryKeys<Definitions extends EndpointDefinitions> = QueryKeys<Definitions> | InfiniteQueryKeys<Definitions>;\nexport type QueryArgFromAnyQueryDefinition<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryArgFrom<Definitions[EndpointName]> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? QueryArgFrom<Definitions[EndpointName]> : never;\nexport type DataFromAnyQueryDefinition<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteData<ResultTypeFrom<Definitions[EndpointName]>, PageParamFrom<Definitions[EndpointName]>> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? ResultTypeFrom<Definitions[EndpointName]> : unknown;\nexport type UpsertThunkResult<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryActionCreatorResult<Definitions[EndpointName]> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? QueryActionCreatorResult<Definitions[EndpointName]> : QueryActionCreatorResult<never>;\nexport type UpdateQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>, updateRecipe: Recipe<DataFromAnyQueryDefinition<Definitions, EndpointName>>, updateProvided?: boolean) => ThunkAction<PatchCollection, PartialState, any, UnknownAction>;\nexport type UpsertQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>, value: DataFromAnyQueryDefinition<Definitions, EndpointName>) => ThunkAction<UpsertThunkResult<Definitions, EndpointName>, PartialState, any, UnknownAction>;\n\n/**\n * An object returned from dispatching a `api.util.updateQueryData` call.\n */\nexport type PatchCollection = {\n  /**\n   * An `immer` Patch describing the cache update.\n   */\n  patches: Patch[];\n  /**\n   * An `immer` Patch to revert the cache update.\n   */\n  inversePatches: Patch[];\n  /**\n   * A function that will undo the cache update.\n   */\n  undo: () => void;\n};\ntype TransformCallback = (baseQueryReturnValue: unknown, meta: unknown, arg: unknown) => any;\nexport const addShouldAutoBatch = <T extends Record<string, any>,>(arg: T = {} as T): T & {\n  [SHOULD_AUTOBATCH]: true;\n} => {\n  return {\n    ...arg,\n    [SHOULD_AUTOBATCH]: true\n  };\n};\nexport function buildThunks<BaseQuery extends BaseQueryFn, ReducerPath extends string, Definitions extends EndpointDefinitions>({\n  reducerPath,\n  baseQuery,\n  context: {\n    endpointDefinitions\n  },\n  serializeQueryArgs,\n  api,\n  assertTagType,\n  selectors,\n  onSchemaFailure,\n  catchSchemaFailure: globalCatchSchemaFailure,\n  skipSchemaValidation: globalSkipSchemaValidation\n}: {\n  baseQuery: BaseQuery;\n  reducerPath: ReducerPath;\n  context: ApiContext<Definitions>;\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  api: Api<BaseQuery, Definitions, ReducerPath, any>;\n  assertTagType: AssertTagTypes;\n  selectors: AllSelectors;\n  onSchemaFailure: SchemaFailureHandler | undefined;\n  catchSchemaFailure: SchemaFailureConverter<BaseQuery> | undefined;\n  skipSchemaValidation: boolean | SchemaType[] | undefined;\n}) {\n  type State = RootState<any, string, ReducerPath>;\n  const patchQueryData: PatchQueryDataThunk<EndpointDefinitions, State> = (endpointName, arg, patches, updateProvided) => (dispatch, getState) => {\n    const endpointDefinition = endpointDefinitions[endpointName];\n    const queryCacheKey = serializeQueryArgs({\n      queryArgs: arg,\n      endpointDefinition,\n      endpointName\n    });\n    dispatch(api.internalActions.queryResultPatched({\n      queryCacheKey,\n      patches\n    }));\n    if (!updateProvided) {\n      return;\n    }\n    const newValue = api.endpoints[endpointName].select(arg)(\n    // Work around TS 4.1 mismatch\n    getState() as RootState<any, any, any>);\n    const providedTags = calculateProvidedBy(endpointDefinition.providesTags, newValue.data, undefined, arg, {}, assertTagType);\n    dispatch(api.internalActions.updateProvidedBy([{\n      queryCacheKey,\n      providedTags\n    }]));\n  };\n  function addToStart<T>(items: Array<T>, item: T, max = 0): Array<T> {\n    const newItems = [item, ...items];\n    return max && newItems.length > max ? newItems.slice(0, -1) : newItems;\n  }\n  function addToEnd<T>(items: Array<T>, item: T, max = 0): Array<T> {\n    const newItems = [...items, item];\n    return max && newItems.length > max ? newItems.slice(1) : newItems;\n  }\n  const updateQueryData: UpdateQueryDataThunk<EndpointDefinitions, State> = (endpointName, arg, updateRecipe, updateProvided = true) => (dispatch, getState) => {\n    const endpointDefinition = api.endpoints[endpointName];\n    const currentState = endpointDefinition.select(arg)(\n    // Work around TS 4.1 mismatch\n    getState() as RootState<any, any, any>);\n    const ret: PatchCollection = {\n      patches: [],\n      inversePatches: [],\n      undo: () => dispatch(api.util.patchQueryData(endpointName, arg, ret.inversePatches, updateProvided))\n    };\n    if (currentState.status === STATUS_UNINITIALIZED) {\n      return ret;\n    }\n    let newValue;\n    if ('data' in currentState) {\n      if (isDraftable(currentState.data)) {\n        const [value, patches, inversePatches] = produceWithPatches(currentState.data, updateRecipe);\n        ret.patches.push(...patches);\n        ret.inversePatches.push(...inversePatches);\n        newValue = value;\n      } else {\n        newValue = updateRecipe(currentState.data);\n        ret.patches.push({\n          op: 'replace',\n          path: [],\n          value: newValue\n        });\n        ret.inversePatches.push({\n          op: 'replace',\n          path: [],\n          value: currentState.data\n        });\n      }\n    }\n    if (ret.patches.length === 0) {\n      return ret;\n    }\n    dispatch(api.util.patchQueryData(endpointName, arg, ret.patches, updateProvided));\n    return ret;\n  };\n  const upsertQueryData: UpsertQueryDataThunk<Definitions, State> = (endpointName, arg, value) => dispatch => {\n    type EndpointName = typeof endpointName;\n    const res = dispatch((api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>).initiate(arg, {\n      subscribe: false,\n      forceRefetch: true,\n      [forceQueryFnSymbol]: () => ({\n        data: value\n      })\n    })) as UpsertThunkResult<Definitions, EndpointName>;\n    return res;\n  };\n  const getTransformCallbackForEndpoint = (endpointDefinition: EndpointDefinition<any, any, any, any>, transformFieldName: 'transformResponse' | 'transformErrorResponse'): TransformCallback => {\n    return endpointDefinition.query && endpointDefinition[transformFieldName] ? endpointDefinition[transformFieldName]! as TransformCallback : defaultTransformResponse;\n  };\n\n  // The generic async payload function for all of our thunks\n  const executeEndpoint: AsyncThunkPayloadCreator<ThunkResult, QueryThunkArg | MutationThunkArg | InfiniteQueryThunkArg<any>, ThunkApiMetaConfig & {\n    state: RootState<any, string, ReducerPath>;\n  }> = async (arg, {\n    signal,\n    abort,\n    rejectWithValue,\n    fulfillWithValue,\n    dispatch,\n    getState,\n    extra\n  }) => {\n    const endpointDefinition = endpointDefinitions[arg.endpointName];\n    const {\n      metaSchema,\n      skipSchemaValidation = globalSkipSchemaValidation\n    } = endpointDefinition;\n    const isQuery = arg.type === ENDPOINT_QUERY;\n    try {\n      let transformResponse: TransformCallback = defaultTransformResponse;\n      const baseQueryApi = {\n        signal,\n        abort,\n        dispatch,\n        getState,\n        extra,\n        endpoint: arg.endpointName,\n        type: arg.type,\n        forced: isQuery ? isForcedQuery(arg, getState()) : undefined,\n        queryCacheKey: isQuery ? arg.queryCacheKey : undefined\n      };\n      const forceQueryFn = isQuery ? arg[forceQueryFnSymbol] : undefined;\n      let finalQueryReturnValue: QueryReturnValue;\n\n      // Infinite query wrapper, which executes the request and returns\n      // the InfiniteData `{pages, pageParams}` structure\n      const fetchPage = async (data: InfiniteData<unknown, unknown>, param: unknown, maxPages: number, previous?: boolean): Promise<QueryReturnValue> => {\n        // This should handle cases where there is no `getPrevPageParam`,\n        // or `getPPP` returned nullish\n        if (param == null && data.pages.length) {\n          return Promise.resolve({\n            data\n          });\n        }\n        const finalQueryArg: InfiniteQueryCombinedArg<any, any> = {\n          queryArg: arg.originalArgs,\n          pageParam: param\n        };\n        const pageResponse = await executeRequest(finalQueryArg);\n        const addTo = previous ? addToStart : addToEnd;\n        return {\n          data: {\n            pages: addTo(data.pages, pageResponse.data, maxPages),\n            pageParams: addTo(data.pageParams, param, maxPages)\n          },\n          meta: pageResponse.meta\n        };\n      };\n\n      // Wrapper for executing either `query` or `queryFn`,\n      // and handling any errors\n      async function executeRequest(finalQueryArg: unknown): Promise<QueryReturnValue> {\n        let result: QueryReturnValue;\n        const {\n          extraOptions,\n          argSchema,\n          rawResponseSchema,\n          responseSchema\n        } = endpointDefinition;\n        if (argSchema && !shouldSkip(skipSchemaValidation, 'arg')) {\n          finalQueryArg = await parseWithSchema(argSchema, finalQueryArg, 'argSchema', {} // we don't have a meta yet, so we can't pass it\n          );\n        }\n        if (forceQueryFn) {\n          // upsertQueryData relies on this to pass in the user-provided value\n          result = forceQueryFn();\n        } else if (endpointDefinition.query) {\n          // We should only run `transformResponse` when the endpoint has a `query` method,\n          // and we're not doing an `upsertQueryData`.\n          transformResponse = getTransformCallbackForEndpoint(endpointDefinition, 'transformResponse');\n          result = await baseQuery(endpointDefinition.query(finalQueryArg as any), baseQueryApi, extraOptions as any);\n        } else {\n          result = await endpointDefinition.queryFn(finalQueryArg as any, baseQueryApi, extraOptions as any, arg => baseQuery(arg, baseQueryApi, extraOptions as any));\n        }\n        if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n          const what = endpointDefinition.query ? '`baseQuery`' : '`queryFn`';\n          let err: undefined | string;\n          if (!result) {\n            err = `${what} did not return anything.`;\n          } else if (typeof result !== 'object') {\n            err = `${what} did not return an object.`;\n          } else if (result.error && result.data) {\n            err = `${what} returned an object containing both \\`error\\` and \\`result\\`.`;\n          } else if (result.error === undefined && result.data === undefined) {\n            err = `${what} returned an object containing neither a valid \\`error\\` and \\`result\\`. At least one of them should not be \\`undefined\\``;\n          } else {\n            for (const key of Object.keys(result)) {\n              if (key !== 'error' && key !== 'data' && key !== 'meta') {\n                err = `The object returned by ${what} has the unknown property ${key}.`;\n                break;\n              }\n            }\n          }\n          if (err) {\n            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);\n          }\n        }\n        if (result.error) throw new HandledError(result.error, result.meta);\n        let {\n          data\n        } = result;\n        if (rawResponseSchema && !shouldSkip(skipSchemaValidation, 'rawResponse')) {\n          data = await parseWithSchema(rawResponseSchema, result.data, 'rawResponseSchema', result.meta);\n        }\n        let transformedResponse = await transformResponse(data, result.meta, finalQueryArg);\n        if (responseSchema && !shouldSkip(skipSchemaValidation, 'response')) {\n          transformedResponse = await parseWithSchema(responseSchema, transformedResponse, 'responseSchema', result.meta);\n        }\n        return {\n          ...result,\n          data: transformedResponse\n        };\n      }\n      if (isQuery && 'infiniteQueryOptions' in endpointDefinition) {\n        // This is an infinite query endpoint\n        const {\n          infiniteQueryOptions\n        } = endpointDefinition;\n\n        // Runtime checks should guarantee this is a positive number if provided\n        const {\n          maxPages = Infinity\n        } = infiniteQueryOptions;\n\n        // Priority: per-call override > endpoint config > default (true)\n        const refetchCachedPages = (arg as InfiniteQueryThunkArg<any>).refetchCachedPages ?? infiniteQueryOptions.refetchCachedPages ?? true;\n        let result: QueryReturnValue;\n\n        // Start by looking up the existing InfiniteData value from state,\n        // falling back to an empty value if it doesn't exist yet\n        const blankData = {\n          pages: [],\n          pageParams: []\n        };\n        const cachedData = selectors.selectQueryEntry(getState(), arg.queryCacheKey)?.data as InfiniteData<unknown, unknown> | undefined;\n\n        // When the arg changes or the user forces a refetch,\n        // we don't include the `direction` flag. This lets us distinguish\n        // between actually refetching with a forced query, vs just fetching\n        // the next page.\n        const isForcedQueryNeedingRefetch =\n        // arg.forceRefetch\n        isForcedQuery(arg, getState()) && !(arg as InfiniteQueryThunkArg<any>).direction;\n        const existingData = (isForcedQueryNeedingRefetch || !cachedData ? blankData : cachedData) as InfiniteData<unknown, unknown>;\n\n        // If the thunk specified a direction and we do have at least one page,\n        // fetch the next or previous page\n        if ('direction' in arg && arg.direction && existingData.pages.length) {\n          const previous = arg.direction === 'backward';\n          const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;\n          const param = pageParamFn(infiniteQueryOptions, existingData, arg.originalArgs);\n          result = await fetchPage(existingData, param, maxPages, previous);\n        } else {\n          // Otherwise, fetch the first page and then any remaining pages\n\n          const {\n            initialPageParam = infiniteQueryOptions.initialPageParam\n          } = arg as InfiniteQueryThunkArg<any>;\n\n          // If we're doing a refetch, we should start from\n          // the first page we have cached.\n          // Otherwise, we should start from the initialPageParam\n          const cachedPageParams = cachedData?.pageParams ?? [];\n          const firstPageParam = cachedPageParams[0] ?? initialPageParam;\n          const totalPages = cachedPageParams.length;\n\n          // Fetch first page\n          result = await fetchPage(existingData, firstPageParam, maxPages);\n          if (forceQueryFn) {\n            // HACK `upsertQueryData` expects the user to pass in the `{pages, pageParams}` structure,\n            // but `fetchPage` treats that as `pages[0]`. We have to manually un-nest it.\n            result = {\n              data: (result.data as InfiniteData<unknown, unknown>).pages[0]\n            } as QueryReturnValue;\n          }\n          if (refetchCachedPages) {\n            // Fetch remaining pages\n            for (let i = 1; i < totalPages; i++) {\n              const param = getNextPageParam(infiniteQueryOptions, result.data as InfiniteData<unknown, unknown>, arg.originalArgs);\n              result = await fetchPage(result.data as InfiniteData<unknown, unknown>, param, maxPages);\n            }\n          }\n        }\n        finalQueryReturnValue = result;\n      } else {\n        // Non-infinite endpoint. Just run the one request.\n        finalQueryReturnValue = await executeRequest(arg.originalArgs);\n      }\n      if (metaSchema && !shouldSkip(skipSchemaValidation, 'meta') && finalQueryReturnValue.meta) {\n        finalQueryReturnValue.meta = await parseWithSchema(metaSchema, finalQueryReturnValue.meta, 'metaSchema', finalQueryReturnValue.meta);\n      }\n\n      // console.log('Final result: ', transformedData)\n      return fulfillWithValue(finalQueryReturnValue.data, addShouldAutoBatch({\n        fulfilledTimeStamp: Date.now(),\n        baseQueryMeta: finalQueryReturnValue.meta\n      }));\n    } catch (error) {\n      let caughtError = error;\n      if (caughtError instanceof HandledError) {\n        let transformErrorResponse = getTransformCallbackForEndpoint(endpointDefinition, 'transformErrorResponse');\n        const {\n          rawErrorResponseSchema,\n          errorResponseSchema\n        } = endpointDefinition;\n        let {\n          value,\n          meta\n        } = caughtError;\n        try {\n          if (rawErrorResponseSchema && !shouldSkip(skipSchemaValidation, 'rawErrorResponse')) {\n            value = await parseWithSchema(rawErrorResponseSchema, value, 'rawErrorResponseSchema', meta);\n          }\n          if (metaSchema && !shouldSkip(skipSchemaValidation, 'meta')) {\n            meta = await parseWithSchema(metaSchema, meta, 'metaSchema', meta);\n          }\n          let transformedErrorResponse = await transformErrorResponse(value, meta, arg.originalArgs);\n          if (errorResponseSchema && !shouldSkip(skipSchemaValidation, 'errorResponse')) {\n            transformedErrorResponse = await parseWithSchema(errorResponseSchema, transformedErrorResponse, 'errorResponseSchema', meta);\n          }\n          return rejectWithValue(transformedErrorResponse, addShouldAutoBatch({\n            baseQueryMeta: meta\n          }));\n        } catch (e) {\n          caughtError = e;\n        }\n      }\n      try {\n        if (caughtError instanceof NamedSchemaError) {\n          const info: SchemaFailureInfo = {\n            endpoint: arg.endpointName,\n            arg: arg.originalArgs,\n            type: arg.type,\n            queryCacheKey: isQuery ? arg.queryCacheKey : undefined\n          };\n          endpointDefinition.onSchemaFailure?.(caughtError, info);\n          onSchemaFailure?.(caughtError, info);\n          const {\n            catchSchemaFailure = globalCatchSchemaFailure\n          } = endpointDefinition;\n          if (catchSchemaFailure) {\n            return rejectWithValue(catchSchemaFailure(caughtError, info), addShouldAutoBatch({\n              baseQueryMeta: caughtError._bqMeta\n            }));\n          }\n        }\n      } catch (e) {\n        caughtError = e;\n      }\n      if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production') {\n        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\".`, caughtError);\n      } else {\n        console.error(caughtError);\n      }\n      throw caughtError;\n    }\n  };\n  function isForcedQuery(arg: QueryThunkArg, state: RootState<any, string, ReducerPath>) {\n    const requestState = selectors.selectQueryEntry(state, arg.queryCacheKey);\n    const baseFetchOnMountOrArgChange = selectors.selectConfig(state).refetchOnMountOrArgChange;\n    const fulfilledVal = requestState?.fulfilledTimeStamp;\n    const refetchVal = arg.forceRefetch ?? (arg.subscribe && baseFetchOnMountOrArgChange);\n    if (refetchVal) {\n      // Return if it's true or compare the dates because it must be a number\n      return refetchVal === true || (Number(new Date()) - Number(fulfilledVal)) / 1000 >= refetchVal;\n    }\n    return false;\n  }\n  const createQueryThunk = <ThunkArgType extends QueryThunkArg | InfiniteQueryThunkArg<any>,>() => {\n    const generatedQueryThunk = createAsyncThunk<ThunkResult, ThunkArgType, ThunkApiMetaConfig & {\n      state: RootState<any, string, ReducerPath>;\n    }>(`${reducerPath}/executeQuery`, executeEndpoint, {\n      getPendingMeta({\n        arg\n      }) {\n        const endpointDefinition = endpointDefinitions[arg.endpointName];\n        return addShouldAutoBatch({\n          startedTimeStamp: Date.now(),\n          ...(isInfiniteQueryDefinition(endpointDefinition) ? {\n            direction: (arg as InfiniteQueryThunkArg<any>).direction\n          } : {})\n        });\n      },\n      condition(queryThunkArg, {\n        getState\n      }) {\n        const state = getState();\n        const requestState = selectors.selectQueryEntry(state, queryThunkArg.queryCacheKey);\n        const fulfilledVal = requestState?.fulfilledTimeStamp;\n        const currentArg = queryThunkArg.originalArgs;\n        const previousArg = requestState?.originalArgs;\n        const endpointDefinition = endpointDefinitions[queryThunkArg.endpointName];\n        const direction = (queryThunkArg as InfiniteQueryThunkArg<any>).direction;\n\n        // Order of these checks matters.\n        // In order for `upsertQueryData` to successfully run while an existing request is in flight,\n        /// we have to check for that first, otherwise `queryThunk` will bail out and not run at all.\n        if (isUpsertQuery(queryThunkArg)) {\n          return true;\n        }\n\n        // Don't retry a request that's currently in-flight\n        if (requestState?.status === 'pending') {\n          return false;\n        }\n\n        // if this is forced, continue\n        if (isForcedQuery(queryThunkArg, state)) {\n          return true;\n        }\n        if (isQueryDefinition(endpointDefinition) && endpointDefinition?.forceRefetch?.({\n          currentArg,\n          previousArg,\n          endpointState: requestState,\n          state\n        })) {\n          return true;\n        }\n\n        // Pull from the cache unless we explicitly force refetch or qualify based on time\n        if (fulfilledVal && !direction) {\n          // Value is cached and we didn't specify to refresh, skip it.\n          return false;\n        }\n        return true;\n      },\n      dispatchConditionRejection: true\n    });\n    return generatedQueryThunk;\n  };\n  const queryThunk = createQueryThunk<QueryThunkArg>();\n  const infiniteQueryThunk = createQueryThunk<InfiniteQueryThunkArg<any>>();\n  const mutationThunk = createAsyncThunk<ThunkResult, MutationThunkArg, ThunkApiMetaConfig & {\n    state: RootState<any, string, ReducerPath>;\n  }>(`${reducerPath}/executeMutation`, executeEndpoint, {\n    getPendingMeta() {\n      return addShouldAutoBatch({\n        startedTimeStamp: Date.now()\n      });\n    }\n  });\n  const hasTheForce = (options: any): options is {\n    force: boolean;\n  } => 'force' in options;\n  const hasMaxAge = (options: any): options is {\n    ifOlderThan: false | number;\n  } => 'ifOlderThan' in options;\n  const prefetch = <EndpointName extends QueryKeys<Definitions>,>(endpointName: EndpointName, arg: any, options: PrefetchOptions = {}): ThunkAction<void, any, any, UnknownAction> => (dispatch: ThunkDispatch<any, any, any>, getState: () => any) => {\n    const force = hasTheForce(options) && options.force;\n    const maxAge = hasMaxAge(options) && options.ifOlderThan;\n    const queryAction = (force: boolean = true) => {\n      const options: StartQueryActionCreatorOptions = {\n        forceRefetch: force,\n        subscribe: false\n      };\n      return (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).initiate(arg, options);\n    };\n    const latestStateValue = (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).select(arg)(getState());\n    if (force) {\n      dispatch(queryAction());\n    } else if (maxAge) {\n      const lastFulfilledTs = latestStateValue?.fulfilledTimeStamp;\n      if (!lastFulfilledTs) {\n        dispatch(queryAction());\n        return;\n      }\n      const shouldRetrigger = (Number(new Date()) - Number(new Date(lastFulfilledTs))) / 1000 >= maxAge;\n      if (shouldRetrigger) {\n        dispatch(queryAction());\n      }\n    } else {\n      // If prefetching with no options, just let it try\n      dispatch(queryAction(false));\n    }\n  };\n  function matchesEndpoint(endpointName: string) {\n    return (action: any): action is UnknownAction => action?.meta?.arg?.endpointName === endpointName;\n  }\n  function buildMatchThunkActions<Thunk extends AsyncThunk<any, QueryThunkArg, ThunkApiMetaConfig> | AsyncThunk<any, MutationThunkArg, ThunkApiMetaConfig>>(thunk: Thunk, endpointName: string) {\n    return {\n      matchPending: isAllOf(isPending(thunk), matchesEndpoint(endpointName)),\n      matchFulfilled: isAllOf(isFulfilled(thunk), matchesEndpoint(endpointName)),\n      matchRejected: isAllOf(isRejected(thunk), matchesEndpoint(endpointName))\n    } as Matchers<Thunk, any>;\n  }\n  return {\n    queryThunk,\n    mutationThunk,\n    infiniteQueryThunk,\n    prefetch,\n    updateQueryData,\n    upsertQueryData,\n    patchQueryData,\n    buildMatchThunkActions\n  };\n}\nexport function getNextPageParam(options: InfiniteQueryConfigOptions<unknown, unknown, unknown>, {\n  pages,\n  pageParams\n}: InfiniteData<unknown, unknown>, queryArg: unknown): unknown | undefined {\n  const lastIndex = pages.length - 1;\n  return options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams, queryArg);\n}\nexport function getPreviousPageParam(options: InfiniteQueryConfigOptions<unknown, unknown, unknown>, {\n  pages,\n  pageParams\n}: InfiniteData<unknown, unknown>, queryArg: unknown): unknown | undefined {\n  return options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams, queryArg);\n}\nexport function calculateProvidedByThunk(action: UnwrapPromise<ReturnType<ReturnType<QueryThunk>> | ReturnType<ReturnType<MutationThunk>> | ReturnType<ReturnType<InfiniteQueryThunk<any>>>>, type: 'providesTags' | 'invalidatesTags', endpointDefinitions: EndpointDefinitions, assertTagType: AssertTagTypes) {\n  return calculateProvidedBy(endpointDefinitions[action.meta.arg.endpointName][type] as ResultDescription<any, any, any, any, any>, isFulfilled(action) ? action.payload : undefined, isRejectedWithValue(action) ? action.payload : undefined, action.meta.arg.originalArgs, 'baseQueryMeta' in action.meta ? action.meta.baseQueryMeta : undefined, assertTagType);\n}","import type { Draft } from 'immer';\nimport { current, isDraft } from '../utils/immerImports';\nexport function getCurrent<T>(value: T | Draft<T>): T {\n  return (isDraft(value) ? current(value) : value) as T;\n}","import type { PayloadAction } from '@reduxjs/toolkit';\nimport { combineReducers, createAction, createSlice, isAnyOf, isFulfilled, isRejectedWithValue, createNextState, prepareAutoBatched, SHOULD_AUTOBATCH, nanoid } from './rtkImports';\nimport type { QuerySubstateIdentifier, QuerySubState, MutationSubstateIdentifier, MutationSubState, MutationState, QueryState, InvalidationState, Subscribers, QueryCacheKey, SubscriptionState, ConfigState, InfiniteQuerySubState, InfiniteQueryDirection } from './apiState';\nimport { STATUS_FULFILLED, STATUS_PENDING, QueryStatus, STATUS_REJECTED, STATUS_UNINITIALIZED } from './apiState';\nimport type { AllQueryKeys, QueryArgFromAnyQueryDefinition, DataFromAnyQueryDefinition, InfiniteQueryThunk, MutationThunk, QueryThunk, QueryThunkArg } from './buildThunks';\nimport { calculateProvidedByThunk } from './buildThunks';\nimport { ENDPOINT_QUERY, isInfiniteQueryDefinition, type AssertTagTypes, type EndpointDefinitions, type FullTagDescription, type QueryDefinition } from '../endpointDefinitions';\nimport type { Patch } from 'immer';\nimport { applyPatches, original, isDraft } from '../utils/immerImports';\nimport { onFocus, onFocusLost, onOffline, onOnline } from './setupListeners';\nimport { isDocumentVisible, isOnline, copyWithStructuralSharing } from '../utils';\nimport type { ApiContext } from '../apiTypes';\nimport { isUpsertQuery } from './buildInitiate';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { UnwrapPromise } from '../tsHelpers';\nimport { getCurrent } from '../utils/getCurrent';\n\n/**\n * A typesafe single entry to be upserted into the cache\n */\nexport type NormalizedQueryUpsertEntry<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = {\n  endpointName: EndpointName;\n  arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>;\n  value: DataFromAnyQueryDefinition<Definitions, EndpointName>;\n};\n\n/**\n * The internal version that is not typesafe since we can't carry the generics through `createSlice`\n */\ntype NormalizedQueryUpsertEntryPayload = {\n  endpointName: string;\n  arg: unknown;\n  value: unknown;\n};\nexport type ProcessedQueryUpsertEntry = {\n  queryDescription: QueryThunkArg;\n  value: unknown;\n};\n\n/**\n * A typesafe representation of a util action creator that accepts cache entry descriptions to upsert\n */\nexport type UpsertEntries<Definitions extends EndpointDefinitions> = (<EndpointNames extends Array<AllQueryKeys<Definitions>>>(entries: [...{ [I in keyof EndpointNames]: NormalizedQueryUpsertEntry<Definitions, EndpointNames[I]> }]) => PayloadAction<NormalizedQueryUpsertEntryPayload[]>) & {\n  match: (action: unknown) => action is PayloadAction<NormalizedQueryUpsertEntryPayload[]>;\n};\nfunction updateQuerySubstateIfExists(state: QueryState<any>, queryCacheKey: QueryCacheKey, update: (substate: QuerySubState<any> | InfiniteQuerySubState<any>) => void) {\n  const substate = state[queryCacheKey];\n  if (substate) {\n    update(substate);\n  }\n}\nexport function getMutationCacheKey(id: MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}): string;\nexport function getMutationCacheKey(id: {\n  fixedCacheKey?: string;\n  requestId?: string;\n}): string | undefined;\nexport function getMutationCacheKey(id: {\n  fixedCacheKey?: string;\n  requestId?: string;\n} | MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}): string | undefined {\n  return ('arg' in id ? id.arg.fixedCacheKey : id.fixedCacheKey) ?? id.requestId;\n}\nfunction updateMutationSubstateIfExists(state: MutationState<any>, id: MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}, update: (substate: MutationSubState<any>) => void) {\n  const substate = state[getMutationCacheKey(id)];\n  if (substate) {\n    update(substate);\n  }\n}\nconst initialState = {} as any;\nexport function buildSlice({\n  reducerPath,\n  queryThunk,\n  mutationThunk,\n  serializeQueryArgs,\n  context: {\n    endpointDefinitions: definitions,\n    apiUid,\n    extractRehydrationInfo,\n    hasRehydrationInfo\n  },\n  assertTagType,\n  config\n}: {\n  reducerPath: string;\n  queryThunk: QueryThunk;\n  infiniteQueryThunk: InfiniteQueryThunk<any>;\n  mutationThunk: MutationThunk;\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  context: ApiContext<EndpointDefinitions>;\n  assertTagType: AssertTagTypes;\n  config: Omit<ConfigState<string>, 'online' | 'focused' | 'middlewareRegistered'>;\n}) {\n  const resetApiState = createAction(`${reducerPath}/resetApiState`);\n  function writePendingCacheEntry(draft: QueryState<any>, arg: QueryThunkArg, upserting: boolean, meta: {\n    arg: QueryThunkArg;\n    requestId: string;\n    // requestStatus: 'pending'\n  } & {\n    startedTimeStamp: number;\n  }) {\n    draft[arg.queryCacheKey] ??= {\n      status: STATUS_UNINITIALIZED,\n      endpointName: arg.endpointName\n    };\n    updateQuerySubstateIfExists(draft, arg.queryCacheKey, substate => {\n      substate.status = STATUS_PENDING;\n      substate.requestId = upserting && substate.requestId ?\n      // for `upsertQuery` **updates**, keep the current `requestId`\n      substate.requestId :\n      // for normal queries or `upsertQuery` **inserts** always update the `requestId`\n      meta.requestId;\n      if (arg.originalArgs !== undefined) {\n        substate.originalArgs = arg.originalArgs;\n      }\n      substate.startedTimeStamp = meta.startedTimeStamp;\n      const endpointDefinition = definitions[meta.arg.endpointName];\n      if (isInfiniteQueryDefinition(endpointDefinition) && 'direction' in arg) {\n        ;\n        (substate as InfiniteQuerySubState<any>).direction = arg.direction as InfiniteQueryDirection;\n      }\n    });\n  }\n  function writeFulfilledCacheEntry(draft: QueryState<any>, meta: {\n    arg: QueryThunkArg;\n    requestId: string;\n  } & {\n    fulfilledTimeStamp: number;\n    baseQueryMeta: unknown;\n  }, payload: unknown, upserting: boolean) {\n    updateQuerySubstateIfExists(draft, meta.arg.queryCacheKey, substate => {\n      if (substate.requestId !== meta.requestId && !upserting) return;\n      const {\n        merge\n      } = definitions[meta.arg.endpointName] as QueryDefinition<any, any, any, any>;\n      substate.status = STATUS_FULFILLED;\n      if (merge) {\n        if (substate.data !== undefined) {\n          const {\n            fulfilledTimeStamp,\n            arg,\n            baseQueryMeta,\n            requestId\n          } = meta;\n          // There's existing cache data. Let the user merge it in themselves.\n          // We're already inside an Immer-powered reducer, and the user could just mutate `substate.data`\n          // themselves inside of `merge()`. But, they might also want to return a new value.\n          // Try to let Immer figure that part out, save the result, and assign it to `substate.data`.\n          let newData = createNextState(substate.data, draftSubstateData => {\n            // As usual with Immer, you can mutate _or_ return inside here, but not both\n            return merge(draftSubstateData, payload, {\n              arg: arg.originalArgs,\n              baseQueryMeta,\n              fulfilledTimeStamp,\n              requestId\n            });\n          });\n          substate.data = newData;\n        } else {\n          // Presumably a fresh request. Just cache the response data.\n          substate.data = payload;\n        }\n      } else {\n        // Assign or safely update the cache data.\n        substate.data = definitions[meta.arg.endpointName].structuralSharing ?? true ? copyWithStructuralSharing(isDraft(substate.data) ? original(substate.data) : substate.data, payload) : payload;\n      }\n      delete substate.error;\n      substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;\n    });\n  }\n  const querySlice = createSlice({\n    name: `${reducerPath}/queries`,\n    initialState: initialState as QueryState<any>,\n    reducers: {\n      removeQueryResult: {\n        reducer(draft, {\n          payload: {\n            queryCacheKey\n          }\n        }: PayloadAction<QuerySubstateIdentifier>) {\n          delete draft[queryCacheKey];\n        },\n        prepare: prepareAutoBatched<QuerySubstateIdentifier>()\n      },\n      cacheEntriesUpserted: {\n        reducer(draft, action: PayloadAction<ProcessedQueryUpsertEntry[], string, {\n          RTK_autoBatch: boolean;\n          requestId: string;\n          timestamp: number;\n        }>) {\n          for (const entry of action.payload) {\n            const {\n              queryDescription: arg,\n              value\n            } = entry;\n            writePendingCacheEntry(draft, arg, true, {\n              arg,\n              requestId: action.meta.requestId,\n              startedTimeStamp: action.meta.timestamp\n            });\n            writeFulfilledCacheEntry(draft, {\n              arg,\n              requestId: action.meta.requestId,\n              fulfilledTimeStamp: action.meta.timestamp,\n              baseQueryMeta: {}\n            }, value,\n            // We know we're upserting here\n            true);\n          }\n        },\n        prepare: (payload: NormalizedQueryUpsertEntryPayload[]) => {\n          const queryDescriptions: ProcessedQueryUpsertEntry[] = payload.map(entry => {\n            const {\n              endpointName,\n              arg,\n              value\n            } = entry;\n            const endpointDefinition = definitions[endpointName];\n            const queryDescription: QueryThunkArg = {\n              type: ENDPOINT_QUERY as 'query',\n              endpointName,\n              originalArgs: entry.arg,\n              queryCacheKey: serializeQueryArgs({\n                queryArgs: arg,\n                endpointDefinition,\n                endpointName\n              })\n            };\n            return {\n              queryDescription,\n              value\n            };\n          });\n          const result = {\n            payload: queryDescriptions,\n            meta: {\n              [SHOULD_AUTOBATCH]: true,\n              requestId: nanoid(),\n              timestamp: Date.now()\n            }\n          };\n          return result;\n        }\n      },\n      queryResultPatched: {\n        reducer(draft, {\n          payload: {\n            queryCacheKey,\n            patches\n          }\n        }: PayloadAction<QuerySubstateIdentifier & {\n          patches: readonly Patch[];\n        }>) {\n          updateQuerySubstateIfExists(draft, queryCacheKey, substate => {\n            substate.data = applyPatches(substate.data as any, patches.concat());\n          });\n        },\n        prepare: prepareAutoBatched<QuerySubstateIdentifier & {\n          patches: readonly Patch[];\n        }>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(queryThunk.pending, (draft, {\n        meta,\n        meta: {\n          arg\n        }\n      }) => {\n        const upserting = isUpsertQuery(arg);\n        writePendingCacheEntry(draft, arg, upserting, meta);\n      }).addCase(queryThunk.fulfilled, (draft, {\n        meta,\n        payload\n      }) => {\n        const upserting = isUpsertQuery(meta.arg);\n        writeFulfilledCacheEntry(draft, meta, payload, upserting);\n      }).addCase(queryThunk.rejected, (draft, {\n        meta: {\n          condition,\n          arg,\n          requestId\n        },\n        error,\n        payload\n      }) => {\n        updateQuerySubstateIfExists(draft, arg.queryCacheKey, substate => {\n          if (condition) {\n            // request was aborted due to condition (another query already running)\n          } else {\n            // request failed\n            if (substate.requestId !== requestId) return;\n            substate.status = STATUS_REJECTED;\n            substate.error = (payload ?? error) as any;\n          }\n        });\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          queries\n        } = extractRehydrationInfo(action)!;\n        for (const [key, entry] of Object.entries(queries)) {\n          if (\n          // do not rehydrate entries that were currently in flight.\n          entry?.status === STATUS_FULFILLED || entry?.status === STATUS_REJECTED) {\n            draft[key] = entry;\n          }\n        }\n      });\n    }\n  });\n  const mutationSlice = createSlice({\n    name: `${reducerPath}/mutations`,\n    initialState: initialState as MutationState<any>,\n    reducers: {\n      removeMutationResult: {\n        reducer(draft, {\n          payload\n        }: PayloadAction<MutationSubstateIdentifier>) {\n          const cacheKey = getMutationCacheKey(payload);\n          if (cacheKey in draft) {\n            delete draft[cacheKey];\n          }\n        },\n        prepare: prepareAutoBatched<MutationSubstateIdentifier>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(mutationThunk.pending, (draft, {\n        meta,\n        meta: {\n          requestId,\n          arg,\n          startedTimeStamp\n        }\n      }) => {\n        if (!arg.track) return;\n        draft[getMutationCacheKey(meta)] = {\n          requestId,\n          status: STATUS_PENDING,\n          endpointName: arg.endpointName,\n          startedTimeStamp\n        };\n      }).addCase(mutationThunk.fulfilled, (draft, {\n        payload,\n        meta\n      }) => {\n        if (!meta.arg.track) return;\n        updateMutationSubstateIfExists(draft, meta, substate => {\n          if (substate.requestId !== meta.requestId) return;\n          substate.status = STATUS_FULFILLED;\n          substate.data = payload;\n          substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;\n        });\n      }).addCase(mutationThunk.rejected, (draft, {\n        payload,\n        error,\n        meta\n      }) => {\n        if (!meta.arg.track) return;\n        updateMutationSubstateIfExists(draft, meta, substate => {\n          if (substate.requestId !== meta.requestId) return;\n          substate.status = STATUS_REJECTED;\n          substate.error = (payload ?? error) as any;\n        });\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          mutations\n        } = extractRehydrationInfo(action)!;\n        for (const [key, entry] of Object.entries(mutations)) {\n          if (\n          // do not rehydrate entries that were currently in flight.\n          (entry?.status === STATUS_FULFILLED || entry?.status === STATUS_REJECTED) &&\n          // only rehydrate endpoints that were persisted using a `fixedCacheKey`\n          key !== entry?.requestId) {\n            draft[key] = entry;\n          }\n        }\n      });\n    }\n  });\n  type CalculateProvidedByAction = UnwrapPromise<ReturnType<ReturnType<QueryThunk>> | ReturnType<ReturnType<InfiniteQueryThunk<any>>>>;\n  const initialInvalidationState: InvalidationState<string> = {\n    tags: {},\n    keys: {}\n  };\n  const invalidationSlice = createSlice({\n    name: `${reducerPath}/invalidation`,\n    initialState: initialInvalidationState,\n    reducers: {\n      updateProvidedBy: {\n        reducer(draft, action: PayloadAction<Array<{\n          queryCacheKey: QueryCacheKey;\n          providedTags: readonly FullTagDescription<string>[];\n        }>>) {\n          for (const {\n            queryCacheKey,\n            providedTags\n          } of action.payload) {\n            removeCacheKeyFromTags(draft, queryCacheKey);\n            for (const {\n              type,\n              id\n            } of providedTags) {\n              const subscribedQueries = (draft.tags[type] ??= {})[id || '__internal_without_id'] ??= [];\n              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);\n              if (!alreadySubscribed) {\n                subscribedQueries.push(queryCacheKey);\n              }\n            }\n\n            // Remove readonly from the providedTags array\n            draft.keys[queryCacheKey] = providedTags as FullTagDescription<string>[];\n          }\n        },\n        prepare: prepareAutoBatched<Array<{\n          queryCacheKey: QueryCacheKey;\n          providedTags: readonly FullTagDescription<string>[];\n        }>>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(querySlice.actions.removeQueryResult, (draft, {\n        payload: {\n          queryCacheKey\n        }\n      }) => {\n        removeCacheKeyFromTags(draft, queryCacheKey);\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          provided\n        } = extractRehydrationInfo(action)!;\n        for (const [type, incomingTags] of Object.entries(provided.tags ?? {})) {\n          for (const [id, cacheKeys] of Object.entries(incomingTags)) {\n            const subscribedQueries = (draft.tags[type] ??= {})[id || '__internal_without_id'] ??= [];\n            for (const queryCacheKey of cacheKeys) {\n              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);\n              if (!alreadySubscribed) {\n                subscribedQueries.push(queryCacheKey);\n              }\n              draft.keys[queryCacheKey] = provided.keys[queryCacheKey];\n            }\n          }\n        }\n      }).addMatcher(isAnyOf(isFulfilled(queryThunk), isRejectedWithValue(queryThunk)), (draft, action) => {\n        writeProvidedTagsForQueries(draft, [action]);\n      }).addMatcher(querySlice.actions.cacheEntriesUpserted.match, (draft, action) => {\n        const mockActions: CalculateProvidedByAction[] = action.payload.map(({\n          queryDescription,\n          value\n        }) => {\n          return {\n            type: 'UNKNOWN',\n            payload: value,\n            meta: {\n              requestStatus: 'fulfilled',\n              requestId: 'UNKNOWN',\n              arg: queryDescription\n            }\n          };\n        });\n        writeProvidedTagsForQueries(draft, mockActions);\n      });\n    }\n  });\n  function removeCacheKeyFromTags(draft: InvalidationState<any>, queryCacheKey: QueryCacheKey) {\n    const existingTags = getCurrent(draft.keys[queryCacheKey] ?? []);\n\n    // Delete this cache key from any existing tags that may have provided it\n    for (const tag of existingTags) {\n      const tagType = tag.type;\n      const tagId = tag.id ?? '__internal_without_id';\n      const tagSubscriptions = draft.tags[tagType]?.[tagId];\n      if (tagSubscriptions) {\n        draft.tags[tagType][tagId] = getCurrent(tagSubscriptions).filter(qc => qc !== queryCacheKey);\n      }\n    }\n    delete draft.keys[queryCacheKey];\n  }\n  function writeProvidedTagsForQueries(draft: InvalidationState<string>, actions: CalculateProvidedByAction[]) {\n    const providedByEntries = actions.map(action => {\n      const providedTags = calculateProvidedByThunk(action, 'providesTags', definitions, assertTagType);\n      const {\n        queryCacheKey\n      } = action.meta.arg;\n      return {\n        queryCacheKey,\n        providedTags\n      };\n    });\n    invalidationSlice.caseReducers.updateProvidedBy(draft, invalidationSlice.actions.updateProvidedBy(providedByEntries));\n  }\n\n  // Dummy slice to generate actions\n  const subscriptionSlice = createSlice({\n    name: `${reducerPath}/subscriptions`,\n    initialState: initialState as SubscriptionState,\n    reducers: {\n      updateSubscriptionOptions(d, a: PayloadAction<{\n        endpointName: string;\n        requestId: string;\n        options: Subscribers[number];\n      } & QuerySubstateIdentifier>) {\n        // Dummy\n      },\n      unsubscribeQueryResult(d, a: PayloadAction<{\n        requestId: string;\n      } & QuerySubstateIdentifier>) {\n        // Dummy\n      },\n      internal_getRTKQSubscriptions() {}\n    }\n  });\n  const internalSubscriptionsSlice = createSlice({\n    name: `${reducerPath}/internalSubscriptions`,\n    initialState: initialState as SubscriptionState,\n    reducers: {\n      subscriptionsUpdated: {\n        reducer(state, action: PayloadAction<Patch[]>) {\n          return applyPatches(state, action.payload);\n        },\n        prepare: prepareAutoBatched<Patch[]>()\n      }\n    }\n  });\n  const configSlice = createSlice({\n    name: `${reducerPath}/config`,\n    initialState: {\n      online: isOnline(),\n      focused: isDocumentVisible(),\n      middlewareRegistered: false,\n      ...config\n    } as ConfigState<string>,\n    reducers: {\n      middlewareRegistered(state, {\n        payload\n      }: PayloadAction<string>) {\n        state.middlewareRegistered = state.middlewareRegistered === 'conflict' || apiUid !== payload ? 'conflict' : true;\n      }\n    },\n    extraReducers: builder => {\n      builder.addCase(onOnline, state => {\n        state.online = true;\n      }).addCase(onOffline, state => {\n        state.online = false;\n      }).addCase(onFocus, state => {\n        state.focused = true;\n      }).addCase(onFocusLost, state => {\n        state.focused = false;\n      })\n      // update the state to be a new object to be picked up as a \"state change\"\n      // by redux-persist's `autoMergeLevel2`\n      .addMatcher(hasRehydrationInfo, draft => ({\n        ...draft\n      }));\n    }\n  });\n  const combinedReducer = combineReducers({\n    queries: querySlice.reducer,\n    mutations: mutationSlice.reducer,\n    provided: invalidationSlice.reducer,\n    subscriptions: internalSubscriptionsSlice.reducer,\n    config: configSlice.reducer\n  });\n  const reducer: typeof combinedReducer = (state, action) => combinedReducer(resetApiState.match(action) ? undefined : state, action);\n  const actions = {\n    ...configSlice.actions,\n    ...querySlice.actions,\n    ...subscriptionSlice.actions,\n    ...internalSubscriptionsSlice.actions,\n    ...mutationSlice.actions,\n    ...invalidationSlice.actions,\n    resetApiState\n  };\n  return {\n    reducer,\n    actions\n  };\n}\nexport type SliceActions = ReturnType<typeof buildSlice>['actions'];","import type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { EndpointDefinition, EndpointDefinitions, InfiniteQueryArgFrom, InfiniteQueryDefinition, MutationDefinition, QueryArgFrom, QueryArgFromAnyQuery, QueryDefinition, ReducerPathFrom, TagDescription, TagTypesFrom } from '../endpointDefinitions';\nimport { expandTagDescription } from '../endpointDefinitions';\nimport { filterMap, isNotNullish } from '../utils';\nimport type { InfiniteData, InfiniteQueryConfigOptions, InfiniteQuerySubState, MutationSubState, QueryCacheKey, QueryState, QuerySubState, RequestStatusFlags, RootState as _RootState, QueryStatus } from './apiState';\nimport { STATUS_UNINITIALIZED, getRequestStatusFlags } from './apiState';\nimport { getMutationCacheKey } from './buildSlice';\nimport type { createSelector as _createSelector } from './rtkImports';\nimport { createNextState } from './rtkImports';\nimport { type AllQueryKeys, getNextPageParam, getPreviousPageParam } from './buildThunks';\nexport type SkipToken = typeof skipToken;\n/**\n * Can be passed into `useQuery`, `useQueryState` or `useQuerySubscription`\n * instead of the query argument to get the same effect as if setting\n * `skip: true` in the query options.\n *\n * Useful for scenarios where a query should be skipped when `arg` is `undefined`\n * and TypeScript complains about it because `arg` is not allowed to be passed\n * in as `undefined`, such as\n *\n * ```ts\n * // codeblock-meta title=\"will error if the query argument is not allowed to be undefined\" no-transpile\n * useSomeQuery(arg, { skip: !!arg })\n * ```\n *\n * ```ts\n * // codeblock-meta title=\"using skipToken instead\" no-transpile\n * useSomeQuery(arg ?? skipToken)\n * ```\n *\n * If passed directly into a query or mutation selector, that selector will always\n * return an uninitialized state.\n */\nexport const skipToken = /* @__PURE__ */Symbol.for('RTKQ/skipToken');\nexport type BuildSelectorsApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: QueryResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\nexport type BuildSelectorsApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: InfiniteQueryResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\nexport type BuildSelectorsApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: MutationResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\ntype QueryResultSelectorFactory<Definition extends QueryDefinition<any, any, any, any>, RootState> = (queryArg: QueryArgFrom<Definition> | SkipToken) => (state: RootState) => QueryResultSelectorResult<Definition>;\nexport type QueryResultSelectorResult<Definition extends QueryDefinition<any, any, any, any>> = QuerySubState<Definition> & RequestStatusFlags;\ntype InfiniteQueryResultSelectorFactory<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, RootState> = (queryArg: InfiniteQueryArgFrom<Definition> | SkipToken) => (state: RootState) => InfiniteQueryResultSelectorResult<Definition>;\nexport type InfiniteQueryResultFlags = {\n  hasNextPage: boolean;\n  hasPreviousPage: boolean;\n  isFetchingNextPage: boolean;\n  isFetchingPreviousPage: boolean;\n  isFetchNextPageError: boolean;\n  isFetchPreviousPageError: boolean;\n};\nexport type InfiniteQueryResultSelectorResult<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = InfiniteQuerySubState<Definition> & RequestStatusFlags & InfiniteQueryResultFlags;\ntype MutationResultSelectorFactory<Definition extends MutationDefinition<any, any, any, any>, RootState> = (requestId: string | {\n  requestId: string | undefined;\n  fixedCacheKey: string | undefined;\n} | SkipToken) => (state: RootState) => MutationResultSelectorResult<Definition>;\nexport type MutationResultSelectorResult<Definition extends MutationDefinition<any, any, any, any>> = MutationSubState<Definition> & RequestStatusFlags;\nconst initialSubState: QuerySubState<any> = {\n  status: STATUS_UNINITIALIZED\n};\n\n// abuse immer to freeze default states\nconst defaultQuerySubState = /* @__PURE__ */createNextState(initialSubState, () => {});\nconst defaultMutationSubState = /* @__PURE__ */createNextState(initialSubState as MutationSubState<any>, () => {});\nexport type AllSelectors = ReturnType<typeof buildSelectors>;\nexport function buildSelectors<Definitions extends EndpointDefinitions, ReducerPath extends string>({\n  serializeQueryArgs,\n  reducerPath,\n  createSelector\n}: {\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  reducerPath: ReducerPath;\n  createSelector: typeof _createSelector;\n}) {\n  type RootState = _RootState<Definitions, string, string>;\n  const selectSkippedQuery = (state: RootState) => defaultQuerySubState;\n  const selectSkippedMutation = (state: RootState) => defaultMutationSubState;\n  return {\n    buildQuerySelector,\n    buildInfiniteQuerySelector,\n    buildMutationSelector,\n    selectInvalidatedBy,\n    selectCachedArgsForQuery,\n    selectApiState,\n    selectQueries,\n    selectMutations,\n    selectQueryEntry,\n    selectConfig\n  };\n  function withRequestFlags<T extends {\n    status: QueryStatus;\n  }>(substate: T): T & RequestStatusFlags {\n    return {\n      ...substate,\n      ...getRequestStatusFlags(substate.status)\n    };\n  }\n  function selectApiState(rootState: RootState) {\n    const state = rootState[reducerPath];\n    if (process.env.NODE_ENV !== 'production') {\n      if (!state) {\n        if ((selectApiState as any).triggered) return state;\n        (selectApiState as any).triggered = true;\n        console.error(`Error: No data found at \\`state.${reducerPath}\\`. Did you forget to add the reducer to the store?`);\n      }\n    }\n    return state;\n  }\n  function selectQueries(rootState: RootState) {\n    return selectApiState(rootState)?.queries;\n  }\n  function selectQueryEntry(rootState: RootState, cacheKey: QueryCacheKey) {\n    return selectQueries(rootState)?.[cacheKey];\n  }\n  function selectMutations(rootState: RootState) {\n    return selectApiState(rootState)?.mutations;\n  }\n  function selectConfig(rootState: RootState) {\n    return selectApiState(rootState)?.config;\n  }\n  function buildAnyQuerySelector(endpointName: string, endpointDefinition: EndpointDefinition<any, any, any, any>, combiner: <T extends {\n    status: QueryStatus;\n  }>(substate: T) => T & RequestStatusFlags) {\n    return (queryArgs: any) => {\n      // Avoid calling serializeQueryArgs if the arg is skipToken\n      if (queryArgs === skipToken) {\n        return createSelector(selectSkippedQuery, combiner);\n      }\n      const serializedArgs = serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      });\n      const selectQuerySubstate = (state: RootState) => selectQueryEntry(state, serializedArgs) ?? defaultQuerySubState;\n      return createSelector(selectQuerySubstate, combiner);\n    };\n  }\n  function buildQuerySelector(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any>) {\n    return buildAnyQuerySelector(endpointName, endpointDefinition, withRequestFlags) as QueryResultSelectorFactory<any, RootState>;\n  }\n  function buildInfiniteQuerySelector(endpointName: string, endpointDefinition: InfiniteQueryDefinition<any, any, any, any, any>) {\n    const {\n      infiniteQueryOptions\n    } = endpointDefinition;\n    function withInfiniteQueryResultFlags<T extends {\n      status: QueryStatus;\n    }>(substate: T): T & RequestStatusFlags & InfiniteQueryResultFlags {\n      const stateWithRequestFlags = {\n        ...(substate as InfiniteQuerySubState<any>),\n        ...getRequestStatusFlags(substate.status)\n      };\n      const {\n        isLoading,\n        isError,\n        direction\n      } = stateWithRequestFlags;\n      const isForward = direction === 'forward';\n      const isBackward = direction === 'backward';\n      return {\n        ...stateWithRequestFlags,\n        hasNextPage: getHasNextPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),\n        hasPreviousPage: getHasPreviousPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),\n        isFetchingNextPage: isLoading && isForward,\n        isFetchingPreviousPage: isLoading && isBackward,\n        isFetchNextPageError: isError && isForward,\n        isFetchPreviousPageError: isError && isBackward\n      };\n    }\n    return buildAnyQuerySelector(endpointName, endpointDefinition, withInfiniteQueryResultFlags) as unknown as InfiniteQueryResultSelectorFactory<any, RootState>;\n  }\n  function buildMutationSelector() {\n    return (id => {\n      let mutationId: string | typeof skipToken;\n      if (typeof id === 'object') {\n        mutationId = getMutationCacheKey(id) ?? skipToken;\n      } else {\n        mutationId = id;\n      }\n      const selectMutationSubstate = (state: RootState) => selectApiState(state)?.mutations?.[mutationId as string] ?? defaultMutationSubState;\n      const finalSelectMutationSubstate = mutationId === skipToken ? selectSkippedMutation : selectMutationSubstate;\n      return createSelector(finalSelectMutationSubstate, withRequestFlags);\n    }) as MutationResultSelectorFactory<any, RootState>;\n  }\n  function selectInvalidatedBy(state: RootState, tags: ReadonlyArray<TagDescription<string> | null | undefined>): Array<{\n    endpointName: string;\n    originalArgs: any;\n    queryCacheKey: QueryCacheKey;\n  }> {\n    const apiState = state[reducerPath];\n    const toInvalidate = new Set<QueryCacheKey>();\n    const finalTags = filterMap(tags, isNotNullish, expandTagDescription);\n    for (const tag of finalTags) {\n      const provided = apiState.provided.tags[tag.type];\n      if (!provided) {\n        continue;\n      }\n      let invalidateSubscriptions = (tag.id !== undefined ?\n      // id given: invalidate all queries that provide this type & id\n      provided[tag.id] :\n      // no id: invalidate all queries that provide this type\n      Object.values(provided).flat()) ?? [];\n      for (const invalidate of invalidateSubscriptions) {\n        toInvalidate.add(invalidate);\n      }\n    }\n    return Array.from(toInvalidate.values()).flatMap(queryCacheKey => {\n      const querySubState = apiState.queries[queryCacheKey];\n      return querySubState ? {\n        queryCacheKey,\n        endpointName: querySubState.endpointName!,\n        originalArgs: querySubState.originalArgs\n      } : [];\n    });\n  }\n  function selectCachedArgsForQuery<QueryName extends AllQueryKeys<Definitions>>(state: RootState, queryName: QueryName): Array<QueryArgFromAnyQuery<Definitions[QueryName]>> {\n    return filterMap(Object.values(selectQueries(state) as QueryState<any>), (entry): entry is Exclude<QuerySubState<Definitions[QueryName]>, {\n      status: QueryStatus.uninitialized;\n    }> => entry?.endpointName === queryName && entry.status !== STATUS_UNINITIALIZED, entry => entry.originalArgs);\n  }\n  function getHasNextPage(options: InfiniteQueryConfigOptions<any, any, any>, data?: InfiniteData<unknown, unknown>, queryArg?: unknown): boolean {\n    if (!data) return false;\n    return getNextPageParam(options, data, queryArg) != null;\n  }\n  function getHasPreviousPage(options: InfiniteQueryConfigOptions<any, any, any>, data?: InfiniteData<unknown, unknown>, queryArg?: unknown): boolean {\n    if (!data || !options.getPreviousPageParam) return false;\n    return getPreviousPageParam(options, data, queryArg) != null;\n  }\n}","import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3 } from \"@reduxjs/toolkit\";\nimport { getEndpointDefinition, type Api, type ApiContext, type Module, type ModuleName } from './apiTypes';\nimport type { CombinedState } from './core/apiState';\nimport type { BaseQueryArg, BaseQueryFn } from './baseQueryTypes';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport { defaultSerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { EndpointBuilder, EndpointDefinitions, SchemaFailureConverter, SchemaFailureHandler, SchemaType } from './endpointDefinitions';\nimport { DefinitionType, ENDPOINT_INFINITEQUERY, ENDPOINT_MUTATION, ENDPOINT_QUERY, isInfiniteQueryDefinition, isQueryDefinition } from './endpointDefinitions';\nimport { nanoid } from './core/rtkImports';\nimport type { UnknownAction } from '@reduxjs/toolkit';\nimport type { NoInfer } from './tsHelpers';\nimport { weakMapMemoize } from 'reselect';\nexport interface CreateApiOptions<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string = 'api', TagTypes extends string = never> {\n  /**\n   * The base query used by each endpoint if no `queryFn` option is specified. RTK Query exports a utility called [fetchBaseQuery](./fetchBaseQuery) as a lightweight wrapper around `fetch` for common use-cases. See [Customizing Queries](../../rtk-query/usage/customizing-queries) if `fetchBaseQuery` does not handle your requirements.\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   *\n   * const api = createApi({\n   *   // highlight-start\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // ...endpoints\n   *   }),\n   * })\n   * ```\n   */\n  baseQuery: BaseQuery;\n  /**\n   * An array of string tag type names. Specifying tag types is optional, but you should define them so that they can be used for caching and invalidation. When defining a tag type, you will be able to [provide](../../rtk-query/usage/automated-refetching#providing-tags) them with `providesTags` and [invalidate](../../rtk-query/usage/automated-refetching#invalidating-tags) them with `invalidatesTags` when configuring [endpoints](#endpoints).\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-start\n   *   tagTypes: ['Post', 'User'],\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // ...endpoints\n   *   }),\n   * })\n   * ```\n   */\n  tagTypes?: readonly TagTypes[];\n  /**\n   * The `reducerPath` is a _unique_ key that your service will be mounted to in your store. If you call `createApi` more than once in your application, you will need to provide a unique value each time. Defaults to `'api'`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"apis.js\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query';\n   *\n   * const apiOne = createApi({\n   *   // highlight-start\n   *   reducerPath: 'apiOne',\n   *   // highlight-end\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (builder) => ({\n   *     // ...endpoints\n   *   }),\n   * });\n   *\n   * const apiTwo = createApi({\n   *   // highlight-start\n   *   reducerPath: 'apiTwo',\n   *   // highlight-end\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (builder) => ({\n   *     // ...endpoints\n   *   }),\n   * });\n   * ```\n   */\n  reducerPath?: ReducerPath;\n  /**\n   * Accepts a custom function if you have a need to change the creation of cache keys for any reason.\n   */\n  serializeQueryArgs?: SerializeQueryArgs<unknown>;\n  /**\n   * Endpoints are a set of operations that you want to perform against your server. You define them as an object using the builder syntax. There are three endpoint types: [`query`](../../rtk-query/usage/queries), [`infiniteQuery`](../../rtk-query/usage/infinite-queries) and [`mutation`](../../rtk-query/usage/mutations).\n   */\n  endpoints(build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>): Definitions;\n  /**\n   * Defaults to `60` _(this value is in seconds)_. This is how long RTK Query will keep your data cached for **after** the last component unsubscribes. For example, if you query an endpoint, then unmount the component, then mount another component that makes the same request within the given time frame, the most recent value will be served from the cache.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"keepUnusedDataFor example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts'\n   *     })\n   *   }),\n   *   // highlight-start\n   *   keepUnusedDataFor: 5\n   *   // highlight-end\n   * })\n   * ```\n   */\n  keepUnusedDataFor?: number;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after the application window regains focus.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnFocus?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after regaining a network connection.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnReconnect?: boolean;\n  /**\n   * Defaults to `'delayed'`. This setting allows you to control when tags are invalidated after a mutation.\n   *\n   * - `'immediately'`: Queries are invalidated instantly after the mutation finished, even if they are running.\n   *   If the query provides tags that were invalidated while it ran, it won't be re-fetched.\n   * - `'delayed'`: Invalidation only happens after all queries and mutations are settled.\n   *   This ensures that queries are always invalidated correctly and automatically \"batches\" invalidations of concurrent mutations.\n   *   Note that if you constantly have some queries (or mutations) running, this can delay tag invalidations indefinitely.\n   */\n  invalidationBehavior?: 'delayed' | 'immediately';\n  /**\n   * A function that is passed every dispatched action. If this returns something other than `undefined`,\n   * that return value will be used to rehydrate fulfilled & errored queries.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"next-redux-wrapper rehydration example\"\n   * import type { Action, PayloadAction } from '@reduxjs/toolkit'\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import { HYDRATE } from 'next-redux-wrapper'\n   *\n   * type RootState = any; // normally inferred from state\n   *\n   * function isHydrateAction(action: Action): action is PayloadAction<RootState> {\n   *   return action.type === HYDRATE\n   * }\n   *\n   * export const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-start\n   *   extractRehydrationInfo(action, { reducerPath }): any {\n   *     if (isHydrateAction(action)) {\n   *       return action.payload[reducerPath]\n   *     }\n   *   },\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // omitted\n   *   }),\n   * })\n   * ```\n   */\n  extractRehydrationInfo?: (action: UnknownAction, {\n    reducerPath\n  }: {\n    reducerPath: ReducerPath;\n  }) => undefined | CombinedState<NoInfer<Definitions>, NoInfer<TagTypes>, NoInfer<ReducerPath>>;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *     }),\n   *   }),\n   *   onSchemaFailure: (error, info) => {\n   *     console.error(error, info)\n   *   },\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *     }),\n   *   }),\n   *   catchSchemaFailure: (error, info) => ({\n   *     status: \"CUSTOM_ERROR\",\n   *     error: error.schemaName + \" failed validation\",\n   *     data: error.issues,\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for all endpoints, unless overridden by the endpoint.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type CreateApi<Modules extends ModuleName> = {\n  /**\n   * Creates a service to use in your application. Contains only the basic redux logic (the core module).\n   *\n   * @link https://redux-toolkit.js.org/rtk-query/api/createApi\n   */\n  <BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string = 'api', TagTypes extends string = never>(options: CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>): Api<BaseQuery, Definitions, ReducerPath, TagTypes, Modules>;\n};\n\n/**\n * Builds a `createApi` method based on the provided `modules`.\n *\n * @link https://redux-toolkit.js.org/rtk-query/usage/customizing-create-api\n *\n * @example\n * ```ts\n * const MyContext = React.createContext<ReactReduxContextValue | null>(null);\n * const customCreateApi = buildCreateApi(\n *   coreModule(),\n *   reactHooksModule({\n *     hooks: {\n *       useDispatch: createDispatchHook(MyContext),\n *       useSelector: createSelectorHook(MyContext),\n *       useStore: createStoreHook(MyContext)\n *     }\n *   })\n * );\n * ```\n *\n * @param modules - A variable number of modules that customize how the `createApi` method handles endpoints\n * @returns A `createApi` method using the provided `modules`.\n */\nexport function buildCreateApi<Modules extends [Module<any>, ...Module<any>[]]>(...modules: Modules): CreateApi<Modules[number]['name']> {\n  return function baseCreateApi(options) {\n    const extractRehydrationInfo = weakMapMemoize((action: UnknownAction) => options.extractRehydrationInfo?.(action, {\n      reducerPath: (options.reducerPath ?? 'api') as any\n    }));\n    const optionsWithDefaults: CreateApiOptions<any, any, any, any> = {\n      reducerPath: 'api',\n      keepUnusedDataFor: 60,\n      refetchOnMountOrArgChange: false,\n      refetchOnFocus: false,\n      refetchOnReconnect: false,\n      invalidationBehavior: 'delayed',\n      ...options,\n      extractRehydrationInfo,\n      serializeQueryArgs(queryArgsApi) {\n        let finalSerializeQueryArgs = defaultSerializeQueryArgs;\n        if ('serializeQueryArgs' in queryArgsApi.endpointDefinition) {\n          const endpointSQA = queryArgsApi.endpointDefinition.serializeQueryArgs!;\n          finalSerializeQueryArgs = queryArgsApi => {\n            const initialResult = endpointSQA(queryArgsApi);\n            if (typeof initialResult === 'string') {\n              // If the user function returned a string, use it as-is\n              return initialResult;\n            } else {\n              // Assume they returned an object (such as a subset of the original\n              // query args) or a primitive, and serialize it ourselves\n              return defaultSerializeQueryArgs({\n                ...queryArgsApi,\n                queryArgs: initialResult\n              });\n            }\n          };\n        } else if (options.serializeQueryArgs) {\n          finalSerializeQueryArgs = options.serializeQueryArgs;\n        }\n        return finalSerializeQueryArgs(queryArgsApi);\n      },\n      tagTypes: [...(options.tagTypes || [])]\n    };\n    const context: ApiContext<EndpointDefinitions> = {\n      endpointDefinitions: {},\n      batch(fn) {\n        // placeholder \"batch\" method to be overridden by plugins, for example with React.unstable_batchedUpdate\n        fn();\n      },\n      apiUid: nanoid(),\n      extractRehydrationInfo,\n      hasRehydrationInfo: weakMapMemoize(action => extractRehydrationInfo(action) != null)\n    };\n    const api = {\n      injectEndpoints,\n      enhanceEndpoints({\n        addTagTypes,\n        endpoints\n      }) {\n        if (addTagTypes) {\n          for (const eT of addTagTypes) {\n            if (!optionsWithDefaults.tagTypes!.includes(eT as any)) {\n              ;\n              (optionsWithDefaults.tagTypes as any[]).push(eT);\n            }\n          }\n        }\n        if (endpoints) {\n          for (const [endpointName, partialDefinition] of Object.entries(endpoints)) {\n            if (typeof partialDefinition === 'function') {\n              partialDefinition(getEndpointDefinition(context, endpointName));\n            } else {\n              Object.assign(getEndpointDefinition(context, endpointName) || {}, partialDefinition);\n            }\n          }\n        }\n        return api;\n      }\n    } as Api<BaseQueryFn, {}, string, string, Modules[number]['name']>;\n    const initializedModules = modules.map(m => m.init(api as any, optionsWithDefaults as any, context));\n    function injectEndpoints(inject: Parameters<typeof api.injectEndpoints>[0]) {\n      const evaluatedEndpoints = inject.endpoints({\n        query: x => ({\n          ...x,\n          type: ENDPOINT_QUERY\n        }) as any,\n        mutation: x => ({\n          ...x,\n          type: ENDPOINT_MUTATION\n        }) as any,\n        infiniteQuery: x => ({\n          ...x,\n          type: ENDPOINT_INFINITEQUERY\n        }) as any\n      });\n      for (const [endpointName, definition] of Object.entries(evaluatedEndpoints)) {\n        if (inject.overrideExisting !== true && endpointName in context.endpointDefinitions) {\n          if (inject.overrideExisting === 'throw') {\n            throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(39) : `called \\`injectEndpoints\\` to override already-existing endpointName ${endpointName} without specifying \\`overrideExisting: true\\``);\n          } else if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n            console.error(`called \\`injectEndpoints\\` to override already-existing endpointName ${endpointName} without specifying \\`overrideExisting: true\\``);\n          }\n          continue;\n        }\n        if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n          if (isInfiniteQueryDefinition(definition)) {\n            const {\n              infiniteQueryOptions\n            } = definition;\n            const {\n              maxPages,\n              getPreviousPageParam\n            } = infiniteQueryOptions;\n            if (typeof maxPages === 'number') {\n              if (maxPages < 1) {\n                throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(40) : `maxPages for endpoint '${endpointName}' must be a number greater than 0`);\n              }\n              if (typeof getPreviousPageParam !== 'function') {\n                throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(41) : `getPreviousPageParam for endpoint '${endpointName}' must be a function if maxPages is used`);\n              }\n            }\n          }\n        }\n        context.endpointDefinitions[endpointName] = definition;\n        for (const m of initializedModules) {\n          m.injectEndpoint(endpointName, definition);\n        }\n      }\n      return api as any;\n    }\n    return api.injectEndpoints({\n      endpoints: options.endpoints as any\n    });\n  };\n}","import type { QueryCacheKey } from './core/apiState';\nimport type { EndpointDefinition } from './endpointDefinitions';\nimport { isPlainObject } from './core/rtkImports';\nconst cache: WeakMap<any, string> | undefined = WeakMap ? new WeakMap() : undefined;\nexport const defaultSerializeQueryArgs: SerializeQueryArgs<any> = ({\n  endpointName,\n  queryArgs\n}) => {\n  let serialized = '';\n  const cached = cache?.get(queryArgs);\n  if (typeof cached === 'string') {\n    serialized = cached;\n  } else {\n    const stringified = JSON.stringify(queryArgs, (key, value) => {\n      // Handle bigints\n      value = typeof value === 'bigint' ? {\n        $bigint: value.toString()\n      } : value;\n      // Sort the object keys before stringifying, to prevent useQuery({ a: 1, b: 2 }) having a different cache key than useQuery({ b: 2, a: 1 })\n      value = isPlainObject(value) ? Object.keys(value).sort().reduce<any>((acc, key) => {\n        acc[key] = (value as any)[key];\n        return acc;\n      }, {}) : value;\n      return value;\n    });\n    if (isPlainObject(queryArgs)) {\n      cache?.set(queryArgs, stringified);\n    }\n    serialized = stringified;\n  }\n  return `${endpointName}(${serialized})`;\n};\nexport type SerializeQueryArgs<QueryArgs, ReturnType = string> = (_: {\n  queryArgs: QueryArgs;\n  endpointDefinition: EndpointDefinition<any, any, any, any>;\n  endpointName: string;\n}) => ReturnType;\nexport type InternalSerializeQueryArgs = (_: {\n  queryArgs: any;\n  endpointDefinition: EndpointDefinition<any, any, any, any>;\n  endpointName: string;\n}) => QueryCacheKey;","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { BaseQueryFn } from './baseQueryTypes';\nexport const _NEVER = /* @__PURE__ */Symbol();\nexport type NEVER = typeof _NEVER;\n\n/**\n * Creates a \"fake\" baseQuery to be used if your api *only* uses the `queryFn` definition syntax.\n * This also allows you to specify a specific error type to be shared by all your `queryFn` definitions.\n */\nexport function fakeBaseQuery<ErrorType>(): BaseQueryFn<void, NEVER, ErrorType, {}> {\n  return function () {\n    throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(33) : 'When using `fakeBaseQuery`, all queries & mutations must use the `queryFn` definition syntax.');\n  };\n}","export type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type Override<T1, T2> = T2 extends any ? Omit<T1, keyof T2> & T2 : never;\nexport function assertCast<T>(v: any): asserts v is T {}\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>): T {\n  return Object.assign(target, ...args);\n}\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\nexport type NonOptionalKeys<T> = { [K in keyof T]-?: undefined extends T[K] ? never : K }[keyof T];\nexport type HasRequiredProps<T, True, False> = NonOptionalKeys<T> extends never ? False : True;\nexport type OptionalIfAllPropsOptional<T> = HasRequiredProps<T, T, T | never>;\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type UnwrapPromise<T> = T extends PromiseLike<infer V> ? V : T;\nexport type MaybePromise<T> = T | PromiseLike<T>;\nexport type OmitFromUnion<T, K extends keyof T> = T extends any ? Omit<T, K> : never;\nexport type IsAny<T, True, False = never> = true | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;","import type { InternalHandlerBuilder, SubscriptionSelectors } from './types';\nimport type { SubscriptionInternalState, SubscriptionState } from '../apiState';\nimport { produceWithPatches } from '../../utils/immerImports';\nimport type { Action } from '@reduxjs/toolkit';\nimport { getOrInsertComputed, createNewMap } from '../../utils/getOrInsert';\nexport const buildBatchedActionsHandler: InternalHandlerBuilder<[actionShouldContinue: boolean, returnValue: SubscriptionSelectors | boolean]> = ({\n  api,\n  queryThunk,\n  internalState,\n  mwApi\n}) => {\n  const subscriptionsPrefix = `${api.reducerPath}/subscriptions`;\n  let previousSubscriptions: SubscriptionState = null as unknown as SubscriptionState;\n  let updateSyncTimer: ReturnType<typeof window.setTimeout> | null = null;\n  const {\n    updateSubscriptionOptions,\n    unsubscribeQueryResult\n  } = api.internalActions;\n\n  // Actually intentionally mutate the subscriptions state used in the middleware\n  // This is done to speed up perf when loading many components\n  const actuallyMutateSubscriptions = (currentSubscriptions: SubscriptionInternalState, action: Action) => {\n    if (updateSubscriptionOptions.match(action)) {\n      const {\n        queryCacheKey,\n        requestId,\n        options\n      } = action.payload;\n      const sub = currentSubscriptions.get(queryCacheKey);\n      if (sub?.has(requestId)) {\n        sub.set(requestId, options);\n      }\n      return true;\n    }\n    if (unsubscribeQueryResult.match(action)) {\n      const {\n        queryCacheKey,\n        requestId\n      } = action.payload;\n      const sub = currentSubscriptions.get(queryCacheKey);\n      if (sub) {\n        sub.delete(requestId);\n      }\n      return true;\n    }\n    if (api.internalActions.removeQueryResult.match(action)) {\n      currentSubscriptions.delete(action.payload.queryCacheKey);\n      return true;\n    }\n    if (queryThunk.pending.match(action)) {\n      const {\n        meta: {\n          arg,\n          requestId\n        }\n      } = action;\n      const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);\n      if (arg.subscribe) {\n        substate.set(requestId, arg.subscriptionOptions ?? substate.get(requestId) ?? {});\n      }\n      return true;\n    }\n    let mutated = false;\n    if (queryThunk.rejected.match(action)) {\n      const {\n        meta: {\n          condition,\n          arg,\n          requestId\n        }\n      } = action;\n      if (condition && arg.subscribe) {\n        const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);\n        substate.set(requestId, arg.subscriptionOptions ?? substate.get(requestId) ?? {});\n        mutated = true;\n      }\n    }\n    return mutated;\n  };\n  const getSubscriptions = () => internalState.currentSubscriptions;\n  const getSubscriptionCount = (queryCacheKey: string) => {\n    const subscriptions = getSubscriptions();\n    const subscriptionsForQueryArg = subscriptions.get(queryCacheKey);\n    return subscriptionsForQueryArg?.size ?? 0;\n  };\n  const isRequestSubscribed = (queryCacheKey: string, requestId: string) => {\n    const subscriptions = getSubscriptions();\n    return !!subscriptions?.get(queryCacheKey)?.get(requestId);\n  };\n  const subscriptionSelectors: SubscriptionSelectors = {\n    getSubscriptions,\n    getSubscriptionCount,\n    isRequestSubscribed\n  };\n  function serializeSubscriptions(currentSubscriptions: SubscriptionInternalState): SubscriptionState {\n    // We now use nested Maps for subscriptions, instead of\n    // plain Records. Stringify this accordingly so we can\n    // convert it to the shape we need for the store.\n    return JSON.parse(JSON.stringify(Object.fromEntries([...currentSubscriptions].map(([k, v]) => [k, Object.fromEntries(v)]))));\n  }\n  return (action, mwApi): [actionShouldContinue: boolean, result: SubscriptionSelectors | boolean] => {\n    if (!previousSubscriptions) {\n      // Initialize it the first time this handler runs\n      previousSubscriptions = serializeSubscriptions(internalState.currentSubscriptions);\n    }\n    if (api.util.resetApiState.match(action)) {\n      previousSubscriptions = {};\n      internalState.currentSubscriptions.clear();\n      updateSyncTimer = null;\n      return [true, false];\n    }\n\n    // Intercept requests by hooks to see if they're subscribed\n    // We return the internal state reference so that hooks\n    // can do their own checks to see if they're still active.\n    // It's stupid and hacky, but it does cut down on some dispatch calls.\n    if (api.internalActions.internal_getRTKQSubscriptions.match(action)) {\n      return [false, subscriptionSelectors];\n    }\n\n    // Update subscription data based on this action\n    const didMutate = actuallyMutateSubscriptions(internalState.currentSubscriptions, action);\n    let actionShouldContinue = true;\n\n    // HACK Sneak the test-only polling state back out\n    if (process.env.NODE_ENV === 'test' && typeof action.type === 'string' && action.type === `${api.reducerPath}/getPolling`) {\n      return [false, internalState.currentPolls] as any;\n    }\n    if (didMutate) {\n      if (!updateSyncTimer) {\n        // We only use the subscription state for the Redux DevTools at this point,\n        // as the real data is kept here in the middleware.\n        // Given that, we can throttle synchronizing this state significantly to\n        // save on overall perf.\n        // In 1.9, it was updated in a microtask, but now we do it at most every 500ms.\n        updateSyncTimer = setTimeout(() => {\n          // Deep clone the current subscription data\n          const newSubscriptions: SubscriptionState = serializeSubscriptions(internalState.currentSubscriptions);\n          // Figure out a smaller diff between original and current\n          const [, patches] = produceWithPatches(previousSubscriptions, () => newSubscriptions);\n\n          // Sync the store state for visibility\n          mwApi.next(api.internalActions.subscriptionsUpdated(patches));\n          // Save the cloned state for later reference\n          previousSubscriptions = newSubscriptions;\n          updateSyncTimer = null;\n        }, 500);\n      }\n      const isSubscriptionSliceAction = typeof action.type == 'string' && !!action.type.startsWith(subscriptionsPrefix);\n      const isAdditionalSubscriptionAction = queryThunk.rejected.match(action) && action.meta.condition && !!action.meta.arg.subscribe;\n      actionShouldContinue = !isSubscriptionSliceAction && !isAdditionalSubscriptionAction;\n    }\n    return [actionShouldContinue, false];\n  };\n};","import { getEndpointDefinition } from '@internal/query/apiTypes';\nimport type { QueryDefinition } from '../../endpointDefinitions';\nimport type { ConfigState, QueryCacheKey, QuerySubState } from '../apiState';\nimport { isAnyOf } from '../rtkImports';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, QueryStateMeta, SubMiddlewareApi, TimeoutId } from './types';\nexport type ReferenceCacheCollection = never;\n\n/**\n * @example\n * ```ts\n * // codeblock-meta title=\"keepUnusedDataFor example\"\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n * interface Post {\n *   id: number\n *   name: string\n * }\n * type PostsResponse = Post[]\n *\n * const api = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsResponse, void>({\n *       query: () => 'posts',\n *       // highlight-start\n *       keepUnusedDataFor: 5\n *       // highlight-end\n *     })\n *   })\n * })\n * ```\n */\nexport type CacheCollectionQueryExtraOptions = {\n  /**\n   * Overrides the api-wide definition of `keepUnusedDataFor` for this endpoint only. _(This value is in seconds.)_\n   *\n   * This is how long RTK Query will keep your data cached for **after** the last component unsubscribes. For example, if you query an endpoint, then unmount the component, then mount another component that makes the same request within the given time frame, the most recent value will be served from the cache.\n   */\n  keepUnusedDataFor?: number;\n};\n\n// Per https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value , browsers store\n// `setTimeout()` timer values in a 32-bit int. If we pass a value in that's larger than that,\n// it wraps and ends up executing immediately.\n// Our `keepUnusedDataFor` values are in seconds, so adjust the numbers here accordingly.\nexport const THIRTY_TWO_BIT_MAX_INT = 2_147_483_647;\nexport const THIRTY_TWO_BIT_MAX_TIMER_SECONDS = 2_147_483_647 / 1_000 - 1;\nexport const buildCacheCollectionHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  api,\n  queryThunk,\n  context,\n  internalState,\n  selectors: {\n    selectQueryEntry,\n    selectConfig\n  },\n  getRunningQueryThunk,\n  mwApi\n}) => {\n  const {\n    removeQueryResult,\n    unsubscribeQueryResult,\n    cacheEntriesUpserted\n  } = api.internalActions;\n  const canTriggerUnsubscribe = isAnyOf(unsubscribeQueryResult.match, queryThunk.fulfilled, queryThunk.rejected, cacheEntriesUpserted.match);\n  function anySubscriptionsRemainingForKey(queryCacheKey: string) {\n    const subscriptions = internalState.currentSubscriptions.get(queryCacheKey);\n    if (!subscriptions) {\n      return false;\n    }\n    const hasSubscriptions = subscriptions.size > 0;\n    return hasSubscriptions;\n  }\n  const currentRemovalTimeouts: QueryStateMeta<TimeoutId> = {};\n  function abortAllPromises<T extends {\n    abort?: () => void;\n  }>(promiseMap: Map<string, T | undefined>): void {\n    for (const promise of promiseMap.values()) {\n      promise?.abort?.();\n    }\n  }\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    const state = mwApi.getState();\n    const config = selectConfig(state);\n    if (canTriggerUnsubscribe(action)) {\n      let queryCacheKeys: QueryCacheKey[];\n      if (cacheEntriesUpserted.match(action)) {\n        queryCacheKeys = action.payload.map(entry => entry.queryDescription.queryCacheKey);\n      } else {\n        const {\n          queryCacheKey\n        } = unsubscribeQueryResult.match(action) ? action.payload : action.meta.arg;\n        queryCacheKeys = [queryCacheKey];\n      }\n      handleUnsubscribeMany(queryCacheKeys, mwApi, config);\n    }\n    if (api.util.resetApiState.match(action)) {\n      for (const [key, timeout] of Object.entries(currentRemovalTimeouts)) {\n        if (timeout) clearTimeout(timeout);\n        delete currentRemovalTimeouts[key];\n      }\n      abortAllPromises(internalState.runningQueries);\n      abortAllPromises(internalState.runningMutations);\n    }\n    if (context.hasRehydrationInfo(action)) {\n      const {\n        queries\n      } = context.extractRehydrationInfo(action)!;\n      // Gotcha:\n      // If rehydrating before the endpoint has been injected,the global `keepUnusedDataFor`\n      // will be used instead of the endpoint-specific one.\n      handleUnsubscribeMany(Object.keys(queries) as QueryCacheKey[], mwApi, config);\n    }\n  };\n  function handleUnsubscribeMany(cacheKeys: QueryCacheKey[], api: SubMiddlewareApi, config: ConfigState<string>) {\n    const state = api.getState();\n    for (const queryCacheKey of cacheKeys) {\n      const entry = selectQueryEntry(state, queryCacheKey);\n      if (entry?.endpointName) {\n        handleUnsubscribe(queryCacheKey, entry.endpointName, api, config);\n      }\n    }\n  }\n  function handleUnsubscribe(queryCacheKey: QueryCacheKey, endpointName: string, api: SubMiddlewareApi, config: ConfigState<string>) {\n    const endpointDefinition = getEndpointDefinition(context, endpointName) as QueryDefinition<any, any, any, any>;\n    const keepUnusedDataFor = endpointDefinition?.keepUnusedDataFor ?? config.keepUnusedDataFor;\n    if (keepUnusedDataFor === Infinity) {\n      // Hey, user said keep this forever!\n      return;\n    }\n    // Prevent `setTimeout` timers from overflowing a 32-bit internal int, by\n    // clamping the max value to be at most 1000ms less than the 32-bit max.\n    // Look, a 24.8-day keepalive ought to be enough for anybody, right? :)\n    // Also avoid negative values too.\n    const finalKeepUnusedDataFor = Math.max(0, Math.min(keepUnusedDataFor, THIRTY_TWO_BIT_MAX_TIMER_SECONDS));\n    if (!anySubscriptionsRemainingForKey(queryCacheKey)) {\n      const currentTimeout = currentRemovalTimeouts[queryCacheKey];\n      if (currentTimeout) {\n        clearTimeout(currentTimeout);\n      }\n      currentRemovalTimeouts[queryCacheKey] = setTimeout(() => {\n        if (!anySubscriptionsRemainingForKey(queryCacheKey)) {\n          // Try to abort any running query for this cache key\n          const entry = selectQueryEntry(api.getState(), queryCacheKey);\n          if (entry?.endpointName) {\n            const runningQuery = api.dispatch(getRunningQueryThunk(entry.endpointName, entry.originalArgs));\n            runningQuery?.abort();\n          }\n          api.dispatch(removeQueryResult({\n            queryCacheKey\n          }));\n        }\n        delete currentRemovalTimeouts![queryCacheKey];\n      }, finalKeepUnusedDataFor * 1000);\n    }\n  }\n  return handler;\n};","import type { ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { BaseQueryFn, BaseQueryMeta, BaseQueryResult } from '../../baseQueryTypes';\nimport type { BaseEndpointDefinition, DefinitionType } from '../../endpointDefinitions';\nimport { isAnyQueryDefinition } from '../../endpointDefinitions';\nimport type { QueryCacheKey, RootState } from '../apiState';\nimport type { MutationResultSelectorResult, QueryResultSelectorResult } from '../buildSelectors';\nimport { getMutationCacheKey } from '../buildSlice';\nimport type { PatchCollection, Recipe } from '../buildThunks';\nimport { isAsyncThunkAction, isFulfilled } from '../rtkImports';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, PromiseWithKnownReason, SubMiddlewareApi } from './types';\nimport { getEndpointDefinition } from '@internal/query/apiTypes';\nexport type ReferenceCacheLifecycle = never;\nexport interface QueryBaseLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends LifecycleApi<ReducerPath> {\n  /**\n   * Gets the current value of this cache entry.\n   */\n  getCacheEntry(): QueryResultSelectorResult<{\n    type: DefinitionType.query;\n  } & BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, BaseQueryResult<BaseQuery>>>;\n  /**\n   * Updates the current cache entry value.\n   * For documentation see `api.util.updateQueryData`.\n   */\n  updateCachedData(updateRecipe: Recipe<ResultType>): PatchCollection;\n}\nexport type MutationBaseLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = LifecycleApi<ReducerPath> & {\n  /**\n   * Gets the current value of this cache entry.\n   */\n  getCacheEntry(): MutationResultSelectorResult<{\n    type: DefinitionType.mutation;\n  } & BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, BaseQueryResult<BaseQuery>>>;\n};\ntype LifecycleApi<ReducerPath extends string = string> = {\n  /**\n   * The dispatch method for the store\n   */\n  dispatch: ThunkDispatch<any, any, UnknownAction>;\n  /**\n   * A method to get the current state\n   */\n  getState(): RootState<any, any, ReducerPath>;\n  /**\n   * `extra` as provided as `thunk.extraArgument` to the `configureStore` `getDefaultMiddleware` option.\n   */\n  extra: unknown;\n  /**\n   * A unique ID generated for the mutation\n   */\n  requestId: string;\n};\ntype CacheLifecyclePromises<ResultType = unknown, MetaType = unknown> = {\n  /**\n   * Promise that will resolve with the first value for this cache key.\n   * This allows you to `await` until an actual value is in cache.\n   *\n   * If the cache entry is removed from the cache before any value has ever\n   * been resolved, this Promise will reject with\n   * `new Error('Promise never resolved before cacheEntryRemoved.')`\n   * to prevent memory leaks.\n   * You can just re-throw that error (or not handle it at all) -\n   * it will be caught outside of `cacheEntryAdded`.\n   *\n   * If you don't interact with this promise, it will not throw.\n   */\n  cacheDataLoaded: PromiseWithKnownReason<{\n    /**\n     * The (transformed) query result.\n     */\n    data: ResultType;\n    /**\n     * The `meta` returned by the `baseQuery`\n     */\n    meta: MetaType;\n  }, typeof neverResolvedError>;\n  /**\n   * Promise that allows you to wait for the point in time when the cache entry\n   * has been removed from the cache, by not being used/subscribed to any more\n   * in the application for too long or by dispatching `api.util.resetApiState`.\n   */\n  cacheEntryRemoved: Promise<void>;\n};\nexport interface QueryCacheLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>, CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>> {}\nexport type MutationCacheLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> & CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>>;\nexport type CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  onCacheEntryAdded?(arg: QueryArg, api: QueryCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport type CacheLifecycleInfiniteQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>;\nexport type CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  onCacheEntryAdded?(arg: QueryArg, api: MutationCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nconst neverResolvedError = new Error('Promise never resolved before cacheEntryRemoved.') as Error & {\n  message: 'Promise never resolved before cacheEntryRemoved.';\n};\nexport const buildCacheLifecycleHandler: InternalHandlerBuilder = ({\n  api,\n  reducerPath,\n  context,\n  queryThunk,\n  mutationThunk,\n  internalState,\n  selectors: {\n    selectQueryEntry,\n    selectApiState\n  }\n}) => {\n  const isQueryThunk = isAsyncThunkAction(queryThunk);\n  const isMutationThunk = isAsyncThunkAction(mutationThunk);\n  const isFulfilledThunk = isFulfilled(queryThunk, mutationThunk);\n  type CacheLifecycle = {\n    valueResolved?(value: {\n      data: unknown;\n      meta: unknown;\n    }): unknown;\n    cacheEntryRemoved(): void;\n  };\n  const lifecycleMap: Record<string, CacheLifecycle> = {};\n  const {\n    removeQueryResult,\n    removeMutationResult,\n    cacheEntriesUpserted\n  } = api.internalActions;\n  function resolveLifecycleEntry(cacheKey: string, data: unknown, meta: unknown) {\n    const lifecycle = lifecycleMap[cacheKey];\n    if (lifecycle?.valueResolved) {\n      lifecycle.valueResolved({\n        data,\n        meta\n      });\n      delete lifecycle.valueResolved;\n    }\n  }\n  function removeLifecycleEntry(cacheKey: string) {\n    const lifecycle = lifecycleMap[cacheKey];\n    if (lifecycle) {\n      delete lifecycleMap[cacheKey];\n      lifecycle.cacheEntryRemoved();\n    }\n  }\n  function getActionMetaFields(action: ReturnType<typeof queryThunk.pending> | ReturnType<typeof mutationThunk.pending>) {\n    const {\n      arg,\n      requestId\n    } = action.meta;\n    const {\n      endpointName,\n      originalArgs\n    } = arg;\n    return [endpointName, originalArgs, requestId] as const;\n  }\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi, stateBefore) => {\n    const cacheKey = getCacheKey(action) as QueryCacheKey;\n    function checkForNewCacheKey(endpointName: string, cacheKey: QueryCacheKey, requestId: string, originalArgs: unknown) {\n      const oldEntry = selectQueryEntry(stateBefore, cacheKey);\n      const newEntry = selectQueryEntry(mwApi.getState(), cacheKey);\n      if (!oldEntry && newEntry) {\n        handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId);\n      }\n    }\n    if (queryThunk.pending.match(action)) {\n      const [endpointName, originalArgs, requestId] = getActionMetaFields(action);\n      checkForNewCacheKey(endpointName, cacheKey, requestId, originalArgs);\n    } else if (cacheEntriesUpserted.match(action)) {\n      for (const {\n        queryDescription,\n        value\n      } of action.payload) {\n        const {\n          endpointName,\n          originalArgs,\n          queryCacheKey\n        } = queryDescription;\n        checkForNewCacheKey(endpointName, queryCacheKey, action.meta.requestId, originalArgs);\n        resolveLifecycleEntry(queryCacheKey, value, {});\n      }\n    } else if (mutationThunk.pending.match(action)) {\n      const state = mwApi.getState()[reducerPath].mutations[cacheKey];\n      if (state) {\n        const [endpointName, originalArgs, requestId] = getActionMetaFields(action);\n        handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId);\n      }\n    } else if (isFulfilledThunk(action)) {\n      resolveLifecycleEntry(cacheKey, action.payload, action.meta.baseQueryMeta);\n    } else if (removeQueryResult.match(action) || removeMutationResult.match(action)) {\n      removeLifecycleEntry(cacheKey);\n    } else if (api.util.resetApiState.match(action)) {\n      for (const cacheKey of Object.keys(lifecycleMap)) {\n        removeLifecycleEntry(cacheKey);\n      }\n    }\n  };\n  function getCacheKey(action: any) {\n    if (isQueryThunk(action)) return action.meta.arg.queryCacheKey;\n    if (isMutationThunk(action)) {\n      return action.meta.arg.fixedCacheKey ?? action.meta.requestId;\n    }\n    if (removeQueryResult.match(action)) return action.payload.queryCacheKey;\n    if (removeMutationResult.match(action)) return getMutationCacheKey(action.payload);\n    return '';\n  }\n  function handleNewKey(endpointName: string, originalArgs: any, queryCacheKey: string, mwApi: SubMiddlewareApi, requestId: string) {\n    const endpointDefinition = getEndpointDefinition(context, endpointName);\n    const onCacheEntryAdded = endpointDefinition?.onCacheEntryAdded;\n    if (!onCacheEntryAdded) return;\n    const lifecycle = {} as CacheLifecycle;\n    const cacheEntryRemoved = new Promise<void>(resolve => {\n      lifecycle.cacheEntryRemoved = resolve;\n    });\n    const cacheDataLoaded: PromiseWithKnownReason<{\n      data: unknown;\n      meta: unknown;\n    }, typeof neverResolvedError> = Promise.race([new Promise<{\n      data: unknown;\n      meta: unknown;\n    }>(resolve => {\n      lifecycle.valueResolved = resolve;\n    }), cacheEntryRemoved.then(() => {\n      throw neverResolvedError;\n    })]);\n    // prevent uncaught promise rejections from happening.\n    // if the original promise is used in any way, that will create a new promise that will throw again\n    cacheDataLoaded.catch(() => {});\n    lifecycleMap[queryCacheKey] = lifecycle;\n    const selector = (api.endpoints[endpointName] as any).select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : queryCacheKey);\n    const extra = mwApi.dispatch((_, __, extra) => extra);\n    const lifecycleApi = {\n      ...mwApi,\n      getCacheEntry: () => selector(mwApi.getState()),\n      requestId,\n      extra,\n      updateCachedData: (isAnyQueryDefinition(endpointDefinition) ? (updateRecipe: Recipe<any>) => mwApi.dispatch(api.util.updateQueryData(endpointName as never, originalArgs as never, updateRecipe)) : undefined) as any,\n      cacheDataLoaded,\n      cacheEntryRemoved\n    };\n    const runningHandler = onCacheEntryAdded(originalArgs, lifecycleApi as any);\n    // if a `neverResolvedError` was thrown, but not handled in the running handler, do not let it leak out further\n    Promise.resolve(runningHandler).catch(e => {\n      if (e === neverResolvedError) return;\n      throw e;\n    });\n  }\n  return handler;\n};","import type { InternalHandlerBuilder } from './types';\nexport const buildDevCheckHandler: InternalHandlerBuilder = ({\n  api,\n  context: {\n    apiUid\n  },\n  reducerPath\n}) => {\n  return (action, mwApi) => {\n    if (api.util.resetApiState.match(action)) {\n      // dispatch after api reset\n      mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));\n    }\n    if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n      if (api.internalActions.middlewareRegistered.match(action) && action.payload === apiUid && mwApi.getState()[reducerPath]?.config?.middlewareRegistered === 'conflict') {\n        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!` : ''}`);\n      }\n    }\n  };\n};","import { isAnyOf, isFulfilled, isRejected, isRejectedWithValue } from '../rtkImports';\nimport type { EndpointDefinitions, FullTagDescription } from '../../endpointDefinitions';\nimport { calculateProvidedBy } from '../../endpointDefinitions';\nimport type { CombinedState, QueryCacheKey } from '../apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport { calculateProvidedByThunk } from '../buildThunks';\nimport type { SubMiddlewareApi, InternalHandlerBuilder, ApiMiddlewareInternalHandler } from './types';\nimport { getOrInsertComputed, createNewMap } from '../../utils/getOrInsert';\nexport const buildInvalidationByTagsHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  context,\n  context: {\n    endpointDefinitions\n  },\n  mutationThunk,\n  queryThunk,\n  api,\n  assertTagType,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    removeQueryResult\n  } = api.internalActions;\n  const isThunkActionWithTags = isAnyOf(isFulfilled(mutationThunk), isRejectedWithValue(mutationThunk));\n  const isQueryEnd = isAnyOf(isFulfilled(queryThunk, mutationThunk), isRejected(queryThunk, mutationThunk));\n  let pendingTagInvalidations: FullTagDescription<string>[] = [];\n  // Track via counter so we can avoid iterating over state every time\n  let pendingRequestCount = 0;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (queryThunk.pending.match(action) || mutationThunk.pending.match(action)) {\n      pendingRequestCount++;\n    }\n    if (isQueryEnd(action)) {\n      pendingRequestCount = Math.max(0, pendingRequestCount - 1);\n    }\n    if (isThunkActionWithTags(action)) {\n      invalidateTags(calculateProvidedByThunk(action, 'invalidatesTags', endpointDefinitions, assertTagType), mwApi);\n    } else if (isQueryEnd(action)) {\n      invalidateTags([], mwApi);\n    } else if (api.util.invalidateTags.match(action)) {\n      invalidateTags(calculateProvidedBy(action.payload, undefined, undefined, undefined, undefined, assertTagType), mwApi);\n    }\n  };\n  function hasPendingRequests() {\n    return pendingRequestCount > 0;\n  }\n  function invalidateTags(newTags: readonly FullTagDescription<string>[], mwApi: SubMiddlewareApi) {\n    const rootState = mwApi.getState();\n    const state = rootState[reducerPath];\n    pendingTagInvalidations.push(...newTags);\n    if (state.config.invalidationBehavior === 'delayed' && hasPendingRequests()) {\n      return;\n    }\n    const tags = pendingTagInvalidations;\n    pendingTagInvalidations = [];\n    if (tags.length === 0) return;\n    const toInvalidate = api.util.selectInvalidatedBy(rootState, tags);\n    context.batch(() => {\n      const valuesArray = Array.from(toInvalidate.values());\n      for (const {\n        queryCacheKey\n      } of valuesArray) {\n        const querySubState = state.queries[queryCacheKey];\n        const subscriptionSubState = getOrInsertComputed(internalState.currentSubscriptions, queryCacheKey, createNewMap);\n        if (querySubState) {\n          if (subscriptionSubState.size === 0) {\n            mwApi.dispatch(removeQueryResult({\n              queryCacheKey: queryCacheKey as QueryCacheKey\n            }));\n          } else if (querySubState.status !== STATUS_UNINITIALIZED) {\n            mwApi.dispatch(refetchQuery(querySubState));\n          }\n        }\n      }\n    });\n  }\n  return handler;\n};","import type { QueryCacheKey, QuerySubstateIdentifier, Subscribers, SubscribersInternal } from '../apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport type { QueryStateMeta, SubMiddlewareApi, TimeoutId, InternalHandlerBuilder, ApiMiddlewareInternalHandler, InternalMiddlewareState } from './types';\nexport const buildPollingHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  queryThunk,\n  api,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    currentPolls,\n    currentSubscriptions\n  } = internalState;\n\n  // Batching state for polling updates\n  const pendingPollingUpdates = new Set<string>();\n  let pollingUpdateTimer: ReturnType<typeof setTimeout> | null = null;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (api.internalActions.updateSubscriptionOptions.match(action) || api.internalActions.unsubscribeQueryResult.match(action)) {\n      schedulePollingUpdate(action.payload.queryCacheKey, mwApi);\n    }\n    if (queryThunk.pending.match(action) || queryThunk.rejected.match(action) && action.meta.condition) {\n      schedulePollingUpdate(action.meta.arg.queryCacheKey, mwApi);\n    }\n    if (queryThunk.fulfilled.match(action) || queryThunk.rejected.match(action) && !action.meta.condition) {\n      startNextPoll(action.meta.arg, mwApi);\n    }\n    if (api.util.resetApiState.match(action)) {\n      clearPolls();\n      // Clear any pending updates\n      if (pollingUpdateTimer) {\n        clearTimeout(pollingUpdateTimer);\n        pollingUpdateTimer = null;\n      }\n      pendingPollingUpdates.clear();\n    }\n  };\n  function schedulePollingUpdate(queryCacheKey: string, api: SubMiddlewareApi) {\n    pendingPollingUpdates.add(queryCacheKey);\n    if (!pollingUpdateTimer) {\n      pollingUpdateTimer = setTimeout(() => {\n        // Process all pending updates in a single batch\n        for (const key of pendingPollingUpdates) {\n          updatePollingInterval({\n            queryCacheKey: key as any\n          }, api);\n        }\n        pendingPollingUpdates.clear();\n        pollingUpdateTimer = null;\n      }, 0);\n    }\n  }\n  function startNextPoll({\n    queryCacheKey\n  }: QuerySubstateIdentifier, api: SubMiddlewareApi) {\n    const state = api.getState()[reducerPath];\n    const querySubState = state.queries[queryCacheKey];\n    const subscriptions = currentSubscriptions.get(queryCacheKey);\n    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) return;\n    const {\n      lowestPollingInterval,\n      skipPollingIfUnfocused\n    } = findLowestPollingInterval(subscriptions);\n    if (!Number.isFinite(lowestPollingInterval)) return;\n    const currentPoll = currentPolls.get(queryCacheKey);\n    if (currentPoll?.timeout) {\n      clearTimeout(currentPoll.timeout);\n      currentPoll.timeout = undefined;\n    }\n    const nextPollTimestamp = Date.now() + lowestPollingInterval;\n    currentPolls.set(queryCacheKey, {\n      nextPollTimestamp,\n      pollingInterval: lowestPollingInterval,\n      timeout: setTimeout(() => {\n        if (state.config.focused || !skipPollingIfUnfocused) {\n          api.dispatch(refetchQuery(querySubState));\n        }\n        startNextPoll({\n          queryCacheKey\n        }, api);\n      }, lowestPollingInterval)\n    });\n  }\n  function updatePollingInterval({\n    queryCacheKey\n  }: QuerySubstateIdentifier, api: SubMiddlewareApi) {\n    const state = api.getState()[reducerPath];\n    const querySubState = state.queries[queryCacheKey];\n    const subscriptions = currentSubscriptions.get(queryCacheKey);\n    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) {\n      return;\n    }\n    const {\n      lowestPollingInterval\n    } = findLowestPollingInterval(subscriptions);\n\n    // HACK add extra data to track how many times this has been called in tests\n    // yes we're mutating a nonexistent field on a Map here\n    if (process.env.NODE_ENV === 'test') {\n      const updateCounters = (currentPolls as any).pollUpdateCounters ??= {};\n      updateCounters[queryCacheKey] ??= 0;\n      updateCounters[queryCacheKey]++;\n    }\n    if (!Number.isFinite(lowestPollingInterval)) {\n      cleanupPollForKey(queryCacheKey);\n      return;\n    }\n    const currentPoll = currentPolls.get(queryCacheKey);\n    const nextPollTimestamp = Date.now() + lowestPollingInterval;\n    if (!currentPoll || nextPollTimestamp < currentPoll.nextPollTimestamp) {\n      startNextPoll({\n        queryCacheKey\n      }, api);\n    }\n  }\n  function cleanupPollForKey(key: string) {\n    const existingPoll = currentPolls.get(key);\n    if (existingPoll?.timeout) {\n      clearTimeout(existingPoll.timeout);\n    }\n    currentPolls.delete(key);\n  }\n  function clearPolls() {\n    for (const key of currentPolls.keys()) {\n      cleanupPollForKey(key);\n    }\n  }\n  function findLowestPollingInterval(subscribers: SubscribersInternal = new Map()) {\n    let skipPollingIfUnfocused: boolean | undefined = false;\n    let lowestPollingInterval = Number.POSITIVE_INFINITY;\n    for (const entry of subscribers.values()) {\n      if (!!entry.pollingInterval) {\n        lowestPollingInterval = Math.min(entry.pollingInterval!, lowestPollingInterval);\n        skipPollingIfUnfocused = entry.skipPollingIfUnfocused || skipPollingIfUnfocused;\n      }\n    }\n    return {\n      lowestPollingInterval,\n      skipPollingIfUnfocused\n    };\n  }\n  return handler;\n};","import { getEndpointDefinition } from '@internal/query/apiTypes';\nimport type { BaseQueryError, BaseQueryFn, BaseQueryMeta } from '../../baseQueryTypes';\nimport { isAnyQueryDefinition } from '../../endpointDefinitions';\nimport type { Recipe } from '../buildThunks';\nimport { isFulfilled, isPending, isRejected } from '../rtkImports';\nimport type { MutationBaseLifecycleApi, QueryBaseLifecycleApi } from './cacheLifecycle';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, PromiseConstructorWithKnownReason, PromiseWithKnownReason } from './types';\nexport type ReferenceQueryLifecycle = never;\ntype QueryLifecyclePromises<ResultType, BaseQuery extends BaseQueryFn> = {\n  /**\n   * Promise that will resolve with the (transformed) query result.\n   *\n   * If the query fails, this promise will reject with the error.\n   *\n   * This allows you to `await` for the query to finish.\n   *\n   * If you don't interact with this promise, it will not throw.\n   */\n  queryFulfilled: PromiseWithKnownReason<{\n    /**\n     * The (transformed) query result.\n     */\n    data: ResultType;\n    /**\n     * The `meta` returned by the `baseQuery`\n     */\n    meta: BaseQueryMeta<BaseQuery>;\n  }, QueryFulfilledRejectionReason<BaseQuery>>;\n};\ntype QueryFulfilledRejectionReason<BaseQuery extends BaseQueryFn> = {\n  error: BaseQueryError<BaseQuery>;\n  /**\n   * If this is `false`, that means this error was returned from the `baseQuery` or `queryFn` in a controlled manner.\n   */\n  isUnhandledError: false;\n  /**\n   * The `meta` returned by the `baseQuery`\n   */\n  meta: BaseQueryMeta<BaseQuery>;\n} | {\n  error: unknown;\n  meta?: undefined;\n  /**\n   * If this is `true`, that means that this error is the result of `baseQueryFn`, `queryFn`, `transformResponse` or `transformErrorResponse` throwing an error instead of handling it properly.\n   * There can not be made any assumption about the shape of `error`.\n   */\n  isUnhandledError: true;\n};\nexport type QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  /**\n   * A function that is called when the individual query is started. The function is called with a lifecycle api object containing properties such as `queryFulfilled`, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. throughout the lifecycle of an individual query/mutation call).\n   *\n   * Can be used to perform side-effects throughout the lifecycle of the query.\n   *\n   * @example\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   * import { messageCreated } from './notificationsSlice\n   * export interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({\n   *     baseUrl: '/',\n   *   }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, number>({\n   *       query: (id) => `post/${id}`,\n   *       async onQueryStarted(id, { dispatch, queryFulfilled }) {\n   *         // `onStart` side-effect\n   *         dispatch(messageCreated('Fetching posts...'))\n   *         try {\n   *           const { data } = await queryFulfilled\n   *           // `onSuccess` side-effect\n   *           dispatch(messageCreated('Posts received!'))\n   *         } catch (err) {\n   *           // `onError` side-effect\n   *           dispatch(messageCreated('Error fetching posts!'))\n   *         }\n   *       }\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  onQueryStarted?(queryArgument: QueryArg, queryLifeCycleApi: QueryLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport type QueryLifecycleInfiniteQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>;\nexport type QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  /**\n   * A function that is called when the individual mutation is started. The function is called with a lifecycle api object containing properties such as `queryFulfilled`, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. throughout the lifecycle of an individual query/mutation call).\n   *\n   * Can be used for `optimistic updates`.\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   * export interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({\n   *     baseUrl: '/',\n   *   }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, number>({\n   *       query: (id) => `post/${id}`,\n   *       providesTags: ['Post'],\n   *     }),\n   *     updatePost: build.mutation<void, Pick<Post, 'id'> & Partial<Post>>({\n   *       query: ({ id, ...patch }) => ({\n   *         url: `post/${id}`,\n   *         method: 'PATCH',\n   *         body: patch,\n   *       }),\n   *       invalidatesTags: ['Post'],\n   *       async onQueryStarted({ id, ...patch }, { dispatch, queryFulfilled }) {\n   *         const patchResult = dispatch(\n   *           api.util.updateQueryData('getPost', id, (draft) => {\n   *             Object.assign(draft, patch)\n   *           })\n   *         )\n   *         try {\n   *           await queryFulfilled\n   *         } catch {\n   *           patchResult.undo()\n   *         }\n   *       },\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  onQueryStarted?(queryArgument: QueryArg, mutationLifeCycleApi: MutationLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport interface QueryLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>, QueryLifecyclePromises<ResultType, BaseQuery> {}\nexport type MutationLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> & QueryLifecyclePromises<ResultType, BaseQuery>;\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryLifecycleQueryExtraOptions.onQueryStarted | onQueryStarted}\n * for a specific query.\n *\n * @example\n * <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>\n *\n * ```ts\n * import type { TypedQueryOnQueryStarted } from '@reduxjs/toolkit/query'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n *\n * type Post = {\n *   id: number\n *   title: string\n *   userId: number\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = number | undefined\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * const baseApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, void>({\n *       query: () => `/posts`,\n *     }),\n *\n *     getPostById: build.query<Post, QueryArgument>({\n *       query: (postId) => `/posts/${postId}`,\n *     }),\n *   }),\n * })\n *\n * const updatePostOnFulfilled: TypedQueryOnQueryStarted<\n *   PostsApiResponse,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   'postsApi'\n * > = async (queryArgument, { dispatch, queryFulfilled }) => {\n *   const result = await queryFulfilled\n *\n *   const { posts } = result.data\n *\n *   // Pre-fill the individual post entries with the results\n *   // from the list endpoint query\n *   dispatch(\n *     baseApiSlice.util.upsertQueryEntries(\n *       posts.map((post) => ({\n *         endpointName: 'getPostById',\n *         arg: post.id,\n *         value: post,\n *       })),\n *     ),\n *   )\n * }\n *\n * export const extendedApiSlice = baseApiSlice.injectEndpoints({\n *   endpoints: (build) => ({\n *     getPostsByUserId: build.query<PostsApiResponse, QueryArgument>({\n *       query: (userId) => `/posts/user/${userId}`,\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *   }),\n * })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template ReducerPath - The type representing the `reducerPath` for the API slice.\n *\n * @since 2.4.0\n * @public\n */\nexport type TypedQueryOnQueryStarted<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleQueryExtraOptions<ResultType, QueryArgumentType, BaseQueryFunctionType, ReducerPath>['onQueryStarted'];\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryLifecycleMutationExtraOptions.onQueryStarted | onQueryStarted}\n * for a specific mutation.\n *\n * @example\n * <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>\n *\n * ```ts\n * import type { TypedMutationOnQueryStarted } from '@reduxjs/toolkit/query'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n *\n * type Post = {\n *   id: number\n *   title: string\n *   userId: number\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = Pick<Post, 'id'> & Partial<Post>\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * const baseApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, void>({\n *       query: () => `/posts`,\n *     }),\n *\n *     getPostById: build.query<Post, number>({\n *       query: (postId) => `/posts/${postId}`,\n *     }),\n *   }),\n * })\n *\n * const updatePostOnFulfilled: TypedMutationOnQueryStarted<\n *   Post,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   'postsApi'\n * > = async ({ id, ...patch }, { dispatch, queryFulfilled }) => {\n *   const patchCollection = dispatch(\n *     baseApiSlice.util.updateQueryData('getPostById', id, (draftPost) => {\n *       Object.assign(draftPost, patch)\n *     }),\n *   )\n *\n *   try {\n *     await queryFulfilled\n *   } catch {\n *     patchCollection.undo()\n *   }\n * }\n *\n * export const extendedApiSlice = baseApiSlice.injectEndpoints({\n *   endpoints: (build) => ({\n *     addPost: build.mutation<Post, Omit<QueryArgument, 'id'>>({\n *       query: (body) => ({\n *         url: `posts/add`,\n *         method: 'POST',\n *         body,\n *       }),\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *\n *     updatePost: build.mutation<Post, QueryArgument>({\n *       query: ({ id, ...patch }) => ({\n *         url: `post/${id}`,\n *         method: 'PATCH',\n *         body: patch,\n *       }),\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *   }),\n * })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template ReducerPath - The type representing the `reducerPath` for the API slice.\n *\n * @since 2.4.0\n * @public\n */\nexport type TypedMutationOnQueryStarted<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleMutationExtraOptions<ResultType, QueryArgumentType, BaseQueryFunctionType, ReducerPath>['onQueryStarted'];\nexport const buildQueryLifecycleHandler: InternalHandlerBuilder = ({\n  api,\n  context,\n  queryThunk,\n  mutationThunk\n}) => {\n  const isPendingThunk = isPending(queryThunk, mutationThunk);\n  const isRejectedThunk = isRejected(queryThunk, mutationThunk);\n  const isFullfilledThunk = isFulfilled(queryThunk, mutationThunk);\n  type CacheLifecycle = {\n    resolve(value: {\n      data: unknown;\n      meta: unknown;\n    }): unknown;\n    reject(value: QueryFulfilledRejectionReason<any>): unknown;\n  };\n  const lifecycleMap: Record<string, CacheLifecycle> = {};\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (isPendingThunk(action)) {\n      const {\n        requestId,\n        arg: {\n          endpointName,\n          originalArgs\n        }\n      } = action.meta;\n      const endpointDefinition = getEndpointDefinition(context, endpointName);\n      const onQueryStarted = endpointDefinition?.onQueryStarted;\n      if (onQueryStarted) {\n        const lifecycle = {} as CacheLifecycle;\n        const queryFulfilled = new (Promise as PromiseConstructorWithKnownReason)<{\n          data: unknown;\n          meta: unknown;\n        }, QueryFulfilledRejectionReason<any>>((resolve, reject) => {\n          lifecycle.resolve = resolve;\n          lifecycle.reject = reject;\n        });\n        // prevent uncaught promise rejections from happening.\n        // if the original promise is used in any way, that will create a new promise that will throw again\n        queryFulfilled.catch(() => {});\n        lifecycleMap[requestId] = lifecycle;\n        const selector = (api.endpoints[endpointName] as any).select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : requestId);\n        const extra = mwApi.dispatch((_, __, extra) => extra);\n        const lifecycleApi = {\n          ...mwApi,\n          getCacheEntry: () => selector(mwApi.getState()),\n          requestId,\n          extra,\n          updateCachedData: (isAnyQueryDefinition(endpointDefinition) ? (updateRecipe: Recipe<any>) => mwApi.dispatch(api.util.updateQueryData(endpointName as never, originalArgs as never, updateRecipe)) : undefined) as any,\n          queryFulfilled\n        };\n        onQueryStarted(originalArgs, lifecycleApi as any);\n      }\n    } else if (isFullfilledThunk(action)) {\n      const {\n        requestId,\n        baseQueryMeta\n      } = action.meta;\n      lifecycleMap[requestId]?.resolve({\n        data: action.payload,\n        meta: baseQueryMeta\n      });\n      delete lifecycleMap[requestId];\n    } else if (isRejectedThunk(action)) {\n      const {\n        requestId,\n        rejectedWithValue,\n        baseQueryMeta\n      } = action.meta;\n      lifecycleMap[requestId]?.reject({\n        error: action.payload ?? action.error,\n        isUnhandledError: !rejectedWithValue,\n        meta: baseQueryMeta as any\n      });\n      delete lifecycleMap[requestId];\n    }\n  };\n  return handler;\n};","import { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport type { QueryCacheKey } from '../apiState';\nimport { onFocus, onOnline } from '../setupListeners';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, SubMiddlewareApi } from './types';\nexport const buildWindowEventHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  context,\n  api,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    removeQueryResult\n  } = api.internalActions;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (onFocus.match(action)) {\n      refetchValidQueries(mwApi, 'refetchOnFocus');\n    }\n    if (onOnline.match(action)) {\n      refetchValidQueries(mwApi, 'refetchOnReconnect');\n    }\n  };\n  function refetchValidQueries(api: SubMiddlewareApi, type: 'refetchOnFocus' | 'refetchOnReconnect') {\n    const state = api.getState()[reducerPath];\n    const queries = state.queries;\n    const subscriptions = internalState.currentSubscriptions;\n    context.batch(() => {\n      for (const queryCacheKey of subscriptions.keys()) {\n        const querySubState = queries[queryCacheKey];\n        const subscriptionSubState = subscriptions.get(queryCacheKey);\n        if (!subscriptionSubState || !querySubState) continue;\n        const values = [...subscriptionSubState.values()];\n        const shouldRefetch = values.some(sub => sub[type] === true) || values.every(sub => sub[type] === undefined) && state.config[type];\n        if (shouldRefetch) {\n          if (subscriptionSubState.size === 0) {\n            api.dispatch(removeQueryResult({\n              queryCacheKey: queryCacheKey as QueryCacheKey\n            }));\n          } else if (querySubState.status !== STATUS_UNINITIALIZED) {\n            api.dispatch(refetchQuery(querySubState));\n          }\n        }\n      }\n    });\n  }\n  return handler;\n};","import type { Action, Middleware, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { EndpointDefinitions, FullTagDescription } from '../../endpointDefinitions';\nimport type { QueryStatus, QuerySubState, RootState } from '../apiState';\nimport type { QueryThunkArg } from '../buildThunks';\nimport { createAction, isAction } from '../rtkImports';\nimport { buildBatchedActionsHandler } from './batchActions';\nimport { buildCacheCollectionHandler } from './cacheCollection';\nimport { buildCacheLifecycleHandler } from './cacheLifecycle';\nimport { buildDevCheckHandler } from './devMiddleware';\nimport { buildInvalidationByTagsHandler } from './invalidationByTags';\nimport { buildPollingHandler } from './polling';\nimport { buildQueryLifecycleHandler } from './queryLifecycle';\nimport type { BuildMiddlewareInput, InternalHandlerBuilder, InternalMiddlewareState } from './types';\nimport { buildWindowEventHandler } from './windowEventHandling';\nimport type { ApiEndpointQuery } from '../module';\nexport type { ReferenceCacheCollection } from './cacheCollection';\nexport type { MutationCacheLifecycleApi, QueryCacheLifecycleApi, ReferenceCacheLifecycle } from './cacheLifecycle';\nexport type { MutationLifecycleApi, QueryLifecycleApi, ReferenceQueryLifecycle, TypedMutationOnQueryStarted, TypedQueryOnQueryStarted } from './queryLifecycle';\nexport type { SubscriptionSelectors } from './types';\nexport function buildMiddleware<Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string>(input: BuildMiddlewareInput<Definitions, ReducerPath, TagTypes>) {\n  const {\n    reducerPath,\n    queryThunk,\n    api,\n    context,\n    getInternalState\n  } = input;\n  const {\n    apiUid\n  } = context;\n  const actions = {\n    invalidateTags: createAction<Array<TagTypes | FullTagDescription<TagTypes> | null | undefined>>(`${reducerPath}/invalidateTags`)\n  };\n  const isThisApiSliceAction = (action: Action) => action.type.startsWith(`${reducerPath}/`);\n  const handlerBuilders: InternalHandlerBuilder[] = [buildDevCheckHandler, buildCacheCollectionHandler, buildInvalidationByTagsHandler, buildPollingHandler, buildCacheLifecycleHandler, buildQueryLifecycleHandler];\n  const middleware: Middleware<{}, RootState<Definitions, string, ReducerPath>, ThunkDispatch<any, any, UnknownAction>> = mwApi => {\n    let initialized = false;\n    const internalState = getInternalState(mwApi.dispatch);\n    const builderArgs = {\n      ...(input as any as BuildMiddlewareInput<EndpointDefinitions, string, string>),\n      internalState,\n      refetchQuery,\n      isThisApiSliceAction,\n      mwApi\n    };\n    const handlers = handlerBuilders.map(build => build(builderArgs));\n    const batchedActionsHandler = buildBatchedActionsHandler(builderArgs);\n    const windowEventsHandler = buildWindowEventHandler(builderArgs);\n    return next => {\n      return action => {\n        if (!isAction(action)) {\n          return next(action);\n        }\n        if (!initialized) {\n          initialized = true;\n          // dispatch before any other action\n          mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));\n        }\n        const mwApiWithNext = {\n          ...mwApi,\n          next\n        };\n        const stateBefore = mwApi.getState();\n        const [actionShouldContinue, internalProbeResult] = batchedActionsHandler(action, mwApiWithNext, stateBefore);\n        let res: any;\n        if (actionShouldContinue) {\n          res = next(action);\n        } else {\n          res = internalProbeResult;\n        }\n        if (!!mwApi.getState()[reducerPath]) {\n          // Only run these checks if the middleware is registered okay\n\n          // This looks for actions that aren't specific to the API slice\n          windowEventsHandler(action, mwApiWithNext, stateBefore);\n          if (isThisApiSliceAction(action) || context.hasRehydrationInfo(action)) {\n            // Only run these additional checks if the actions are part of the API slice,\n            // or the action has hydration-related data\n            for (const handler of handlers) {\n              handler(action, mwApiWithNext, stateBefore);\n            }\n          }\n        }\n        return res;\n      };\n    };\n  };\n  return {\n    middleware,\n    actions\n  };\n  function refetchQuery(querySubState: Exclude<QuerySubState<any>, {\n    status: QueryStatus.uninitialized;\n  }>) {\n    return (input.api.endpoints[querySubState.endpointName] as ApiEndpointQuery<any, any>).initiate(querySubState.originalArgs as any, {\n      subscribe: false,\n      forceRefetch: true\n    });\n  }\n}","/**\n * Note: this file should import all other files for type discovery and declaration merging\n */\nimport type { ActionCreatorWithPayload, Dispatch, Middleware, Reducer, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport { enablePatches } from '../utils/immerImports';\nimport type { Api, Module } from '../apiTypes';\nimport type { BaseQueryFn } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { AssertTagTypes, EndpointDefinitions, InfiniteQueryDefinition, MutationDefinition, QueryArgFrom, QueryArgFromAnyQuery, QueryDefinition, TagDescription } from '../endpointDefinitions';\nimport { isInfiniteQueryDefinition, isMutationDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { assertCast, safeAssign } from '../tsHelpers';\nimport type { CombinedState, MutationKeys, QueryKeys, RootState } from './apiState';\nimport type { BuildInitiateApiEndpointMutation, BuildInitiateApiEndpointQuery, MutationActionCreatorResult, QueryActionCreatorResult, InfiniteQueryActionCreatorResult, BuildInitiateApiEndpointInfiniteQuery } from './buildInitiate';\nimport { buildInitiate } from './buildInitiate';\nimport type { ReferenceCacheCollection, ReferenceCacheLifecycle, ReferenceQueryLifecycle } from './buildMiddleware';\nimport { buildMiddleware } from './buildMiddleware';\nimport type { BuildSelectorsApiEndpointInfiniteQuery, BuildSelectorsApiEndpointMutation, BuildSelectorsApiEndpointQuery } from './buildSelectors';\nimport { buildSelectors } from './buildSelectors';\nimport type { SliceActions, UpsertEntries } from './buildSlice';\nimport { buildSlice } from './buildSlice';\nimport type { AllQueryKeys, BuildThunksApiEndpointInfiniteQuery, BuildThunksApiEndpointMutation, BuildThunksApiEndpointQuery, PatchQueryDataThunk, QueryArgFromAnyQueryDefinition, UpdateQueryDataThunk, UpsertQueryDataThunk } from './buildThunks';\nimport { buildThunks } from './buildThunks';\nimport { createSelector as _createSelector } from './rtkImports';\nimport { onFocus, onFocusLost, onOffline, onOnline } from './setupListeners';\nimport type { InternalMiddlewareState } from './buildMiddleware/types';\nimport { getOrInsertComputed } from '../utils';\nimport type { CreateSelectorFunction } from 'reselect';\n\n/**\n * `ifOlderThan` - (default: `false` | `number`) - _number is value in seconds_\n * - If specified, it will only run the query if the difference between `new Date()` and the last `fulfilledTimeStamp` is greater than the given value\n *\n * @overloadSummary\n * `force`\n * - If `force: true`, it will ignore the `ifOlderThan` value if it is set and the query will be run even if it exists in the cache.\n */\nexport type PrefetchOptions = {\n  ifOlderThan?: false | number;\n} | {\n  force?: boolean;\n};\nexport const coreModuleName = /* @__PURE__ */Symbol();\nexport type CoreModule = typeof coreModuleName | ReferenceCacheLifecycle | ReferenceQueryLifecycle | ReferenceCacheCollection;\nexport type ThunkWithReturnValue<T> = ThunkAction<T, any, any, UnknownAction>;\nexport interface ApiModules<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nBaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string> {\n  [coreModuleName]: {\n    /**\n     * This api's reducer should be mounted at `store[api.reducerPath]`.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    reducerPath: ReducerPath;\n    /**\n     * Internal actions not part of the public API. Note: These are subject to change at any given time.\n     */\n    internalActions: InternalActions;\n    /**\n     *  A standard redux reducer that enables core functionality. Make sure it's included in your store.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    reducer: Reducer<CombinedState<Definitions, TagTypes, ReducerPath>, UnknownAction>;\n    /**\n     * This is a standard redux middleware and is responsible for things like polling, garbage collection and a handful of other things. Make sure it's included in your store.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    middleware: Middleware<{}, RootState<Definitions, string, ReducerPath>, ThunkDispatch<any, any, UnknownAction>>;\n    /**\n     * A collection of utility thunks for various situations.\n     */\n    util: {\n      /**\n       * A thunk that (if dispatched) will return a specific running query, identified\n       * by `endpointName` and `arg`.\n       * If that query is not running, dispatching the thunk will result in `undefined`.\n       *\n       * Can be used to await a specific query triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningQueryThunk<EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>): ThunkWithReturnValue<QueryActionCreatorResult<Definitions[EndpointName] & {\n        type: 'query';\n      }> | InfiniteQueryActionCreatorResult<Definitions[EndpointName] & {\n        type: 'infinitequery';\n      }> | undefined>;\n\n      /**\n       * A thunk that (if dispatched) will return a specific running mutation, identified\n       * by `endpointName` and `fixedCacheKey` or `requestId`.\n       * If that mutation is not running, dispatching the thunk will result in `undefined`.\n       *\n       * Can be used to await a specific mutation triggered in any way,\n       * including via hook trigger functions or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningMutationThunk<EndpointName extends MutationKeys<Definitions>>(endpointName: EndpointName, fixedCacheKeyOrRequestId: string): ThunkWithReturnValue<MutationActionCreatorResult<Definitions[EndpointName] & {\n        type: 'mutation';\n      }> | undefined>;\n\n      /**\n       * A thunk that (if dispatched) will return all running queries.\n       *\n       * Useful for SSR scenarios to await all running queries triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningQueriesThunk(): ThunkWithReturnValue<Array<QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>>;\n\n      /**\n       * A thunk that (if dispatched) will return all running mutations.\n       *\n       * Useful for SSR scenarios to await all running mutations triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningMutationsThunk(): ThunkWithReturnValue<Array<MutationActionCreatorResult<any>>>;\n\n      /**\n       * A Redux thunk that can be used to manually trigger pre-fetching of data.\n       *\n       * The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a set of options used to determine if the data actually should be re-fetched based on cache staleness.\n       *\n       * React Hooks users will most likely never need to use this directly, as the `usePrefetch` hook will dispatch this thunk internally as needed when you call the prefetching function supplied by the hook.\n       *\n       * @example\n       *\n       * ```ts no-transpile\n       * dispatch(api.util.prefetch('getPosts', undefined, { force: true }))\n       * ```\n       */\n      prefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions): ThunkAction<void, any, any, UnknownAction>;\n      /**\n       * A Redux thunk action creator that, when dispatched, creates and applies a set of JSON diff/patch objects to the current state. This immediately updates the Redux state with those changes.\n       *\n       * The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and an `updateRecipe` callback function. The callback receives an Immer-wrapped `draft` of the current state, and may modify the draft to match the expected results after the mutation completes successfully.\n       *\n       * The thunk executes _synchronously_, and returns an object containing `{patches: Patch[], inversePatches: Patch[], undo: () => void}`. The `patches` and `inversePatches` are generated using Immer's [`produceWithPatches` method](https://immerjs.github.io/immer/patches).\n       *\n       * This is typically used as the first step in implementing optimistic updates. The generated `inversePatches` can be used to revert the updates by calling `dispatch(patchQueryData(endpointName, arg, inversePatches))`. Alternatively, the `undo` method can be called directly to achieve the same effect.\n       *\n       * Note that the first two arguments (`endpointName` and `arg`) are used to determine which existing cache entry to update. If no existing cache entry is found, the `updateRecipe` callback will not run.\n       *\n       * @example\n       *\n       * ```ts\n       * const patchCollection = dispatch(\n       *   api.util.updateQueryData('getPosts', undefined, (draftPosts) => {\n       *     draftPosts.push({ id: 1, name: 'Teddy' })\n       *   })\n       * )\n       * ```\n       */\n      updateQueryData: UpdateQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n\n      /**\n       * A Redux thunk action creator that, when dispatched, acts as an artificial API request to upsert a value into the cache.\n       *\n       * The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and the data to upsert.\n       *\n       * If no cache entry for that cache key exists, a cache entry will be created and the data added. If a cache entry already exists, this will _overwrite_ the existing cache entry data.\n       *\n       * The thunk executes _asynchronously_, and returns a promise that resolves when the store has been updated.\n       *\n       * If dispatched while an actual request is in progress, both the upsert and request will be handled as soon as they resolve, resulting in a \"last result wins\" update behavior.\n       *\n       * @example\n       *\n       * ```ts\n       * await dispatch(\n       *   api.util.upsertQueryData('getPost', {id: 1}, {id: 1, text: \"Hello!\"})\n       * )\n       * ```\n       */\n      upsertQueryData: UpsertQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n      /**\n       * A Redux thunk that applies a JSON diff/patch array to the cached data for a given query result. This immediately updates the Redux state with those changes.\n       *\n       * The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a JSON diff/patch array as produced by Immer's `produceWithPatches`.\n       *\n       * This is typically used as the second step in implementing optimistic updates. If a request fails, the optimistically-applied changes can be reverted by dispatching `patchQueryData` with the `inversePatches` that were generated by `updateQueryData` earlier.\n       *\n       * In cases where it is desired to simply revert the previous changes, it may be preferable to call the `undo` method returned from dispatching `updateQueryData` instead.\n       *\n       * @example\n       * ```ts\n       * const patchCollection = dispatch(\n       *   api.util.updateQueryData('getPosts', undefined, (draftPosts) => {\n       *     draftPosts.push({ id: 1, name: 'Teddy' })\n       *   })\n       * )\n       *\n       * // later\n       * dispatch(\n       *   api.util.patchQueryData('getPosts', undefined, patchCollection.inversePatches)\n       * )\n       *\n       * // or\n       * patchCollection.undo()\n       * ```\n       */\n      patchQueryData: PatchQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n\n      /**\n       * A Redux action creator that can be dispatched to manually reset the api state completely. This will immediately remove all existing cache entries, and all queries will be considered 'uninitialized'.\n       *\n       * @example\n       *\n       * ```ts\n       * dispatch(api.util.resetApiState())\n       * ```\n       */\n      resetApiState: SliceActions['resetApiState'];\n      upsertQueryEntries: UpsertEntries<Definitions>;\n\n      /**\n       * A Redux action creator that can be used to manually invalidate cache tags for [automated re-fetching](../../usage/automated-refetching.mdx).\n       *\n       * The action creator accepts one argument: the cache tags to be invalidated. It returns an action with those tags as a payload, and the corresponding `invalidateTags` action type for the api.\n       *\n       * Dispatching the result of this action creator will [invalidate](../../usage/automated-refetching.mdx#invalidating-cache-data) the given tags, causing queries to automatically re-fetch if they are subscribed to cache data that [provides](../../usage/automated-refetching.mdx#providing-cache-data) the corresponding tags.\n       *\n       * The array of tags provided to the action creator should be in one of the following formats, where `TagType` is equal to a string provided to the [`tagTypes`](../createApi.mdx#tagtypes) property of the api:\n       *\n       * - `[TagType]`\n       * - `[{ type: TagType }]`\n       * - `[{ type: TagType, id: number | string }]`\n       *\n       * @example\n       *\n       * ```ts\n       * dispatch(api.util.invalidateTags(['Post']))\n       * dispatch(api.util.invalidateTags([{ type: 'Post', id: 1 }]))\n       * dispatch(\n       *   api.util.invalidateTags([\n       *     { type: 'Post', id: 1 },\n       *     { type: 'Post', id: 'LIST' },\n       *   ])\n       * )\n       * ```\n       */\n      invalidateTags: ActionCreatorWithPayload<Array<TagDescription<TagTypes> | null | undefined>, string>;\n\n      /**\n       * A function to select all `{ endpointName, originalArgs, queryCacheKey }` combinations that would be invalidated by a specific set of tags.\n       *\n       * Can be used for mutations that want to do optimistic updates instead of invalidating a set of tags, but don't know exactly what they need to update.\n       */\n      selectInvalidatedBy: (state: RootState<Definitions, string, ReducerPath>, tags: ReadonlyArray<TagDescription<TagTypes> | null | undefined>) => Array<{\n        endpointName: string;\n        originalArgs: any;\n        queryCacheKey: string;\n      }>;\n\n      /**\n       * A function to select all arguments currently cached for a given endpoint.\n       *\n       * Can be used for mutations that want to do optimistic updates instead of invalidating a set of tags, but don't know exactly what they need to update.\n       */\n      selectCachedArgsForQuery: <QueryName extends AllQueryKeys<Definitions>>(state: RootState<Definitions, string, ReducerPath>, queryName: QueryName) => Array<QueryArgFromAnyQuery<Definitions[QueryName]>>;\n    };\n    /**\n     * Endpoints based on the input endpoints provided to `createApi`, containing `select` and `action matchers`.\n     */\n    endpoints: { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? ApiEndpointQuery<Definitions[K], Definitions> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? ApiEndpointMutation<Definitions[K], Definitions> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? ApiEndpointInfiniteQuery<Definitions[K], Definitions> : never };\n  };\n}\nexport interface ApiEndpointQuery<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends QueryDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointQuery<Definition>, BuildInitiateApiEndpointQuery<Definition>, BuildSelectorsApiEndpointQuery<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\nexport interface ApiEndpointInfiniteQuery<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends InfiniteQueryDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointInfiniteQuery<Definition>, BuildInitiateApiEndpointInfiniteQuery<Definition>, BuildSelectorsApiEndpointInfiniteQuery<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport interface ApiEndpointMutation<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends MutationDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointMutation<Definition>, BuildInitiateApiEndpointMutation<Definition>, BuildSelectorsApiEndpointMutation<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\nexport type ListenerActions = {\n  /**\n   * Will cause the RTK Query middleware to trigger any refetchOnReconnect-related behavior\n   * @link https://redux-toolkit.js.org/rtk-query/api/setupListeners\n   */\n  onOnline: typeof onOnline;\n  onOffline: typeof onOffline;\n  /**\n   * Will cause the RTK Query middleware to trigger any refetchOnFocus-related behavior\n   * @link https://redux-toolkit.js.org/rtk-query/api/setupListeners\n   */\n  onFocus: typeof onFocus;\n  onFocusLost: typeof onFocusLost;\n};\nexport type InternalActions = SliceActions & ListenerActions;\nexport interface CoreModuleOptions {\n  /**\n   * A selector creator (usually from `reselect`, or matching the same signature)\n   */\n  createSelector?: CreateSelectorFunction<any, any, any>;\n}\n\n/**\n * Creates a module containing the basic redux logic for use with `buildCreateApi`.\n *\n * @example\n * ```ts\n * const createBaseApi = buildCreateApi(coreModule());\n * ```\n */\nexport const coreModule = ({\n  createSelector = _createSelector\n}: CoreModuleOptions = {}): Module<CoreModule> => ({\n  name: coreModuleName,\n  init(api, {\n    baseQuery,\n    tagTypes,\n    reducerPath,\n    serializeQueryArgs,\n    keepUnusedDataFor,\n    refetchOnMountOrArgChange,\n    refetchOnFocus,\n    refetchOnReconnect,\n    invalidationBehavior,\n    onSchemaFailure,\n    catchSchemaFailure,\n    skipSchemaValidation\n  }, context) {\n    enablePatches();\n    assertCast<InternalSerializeQueryArgs>(serializeQueryArgs);\n    const assertTagType: AssertTagTypes = tag => {\n      if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n        if (!tagTypes.includes(tag.type as any)) {\n          console.error(`Tag type '${tag.type}' was used, but not specified in \\`tagTypes\\`!`);\n        }\n      }\n      return tag;\n    };\n    Object.assign(api, {\n      reducerPath,\n      endpoints: {},\n      internalActions: {\n        onOnline,\n        onOffline,\n        onFocus,\n        onFocusLost\n      },\n      util: {}\n    });\n    const selectors = buildSelectors({\n      serializeQueryArgs: serializeQueryArgs as any,\n      reducerPath,\n      createSelector\n    });\n    const {\n      selectInvalidatedBy,\n      selectCachedArgsForQuery,\n      buildQuerySelector,\n      buildInfiniteQuerySelector,\n      buildMutationSelector\n    } = selectors;\n    safeAssign(api.util, {\n      selectInvalidatedBy,\n      selectCachedArgsForQuery\n    });\n    const {\n      queryThunk,\n      infiniteQueryThunk,\n      mutationThunk,\n      patchQueryData,\n      updateQueryData,\n      upsertQueryData,\n      prefetch,\n      buildMatchThunkActions\n    } = buildThunks({\n      baseQuery,\n      reducerPath,\n      context,\n      api,\n      serializeQueryArgs,\n      assertTagType,\n      selectors,\n      onSchemaFailure,\n      catchSchemaFailure,\n      skipSchemaValidation\n    });\n    const {\n      reducer,\n      actions: sliceActions\n    } = buildSlice({\n      context,\n      queryThunk,\n      infiniteQueryThunk,\n      mutationThunk,\n      serializeQueryArgs,\n      reducerPath,\n      assertTagType,\n      config: {\n        refetchOnFocus,\n        refetchOnReconnect,\n        refetchOnMountOrArgChange,\n        keepUnusedDataFor,\n        reducerPath,\n        invalidationBehavior\n      }\n    });\n    safeAssign(api.util, {\n      patchQueryData,\n      updateQueryData,\n      upsertQueryData,\n      prefetch,\n      resetApiState: sliceActions.resetApiState,\n      upsertQueryEntries: sliceActions.cacheEntriesUpserted as any\n    });\n    safeAssign(api.internalActions, sliceActions);\n    const internalStateMap = new WeakMap<Dispatch, InternalMiddlewareState>();\n    const getInternalState = (dispatch: Dispatch) => {\n      const state = getOrInsertComputed(internalStateMap, dispatch, () => ({\n        currentSubscriptions: new Map(),\n        currentPolls: new Map(),\n        runningQueries: new Map(),\n        runningMutations: new Map()\n      }));\n      return state;\n    };\n    const {\n      buildInitiateQuery,\n      buildInitiateInfiniteQuery,\n      buildInitiateMutation,\n      getRunningMutationThunk,\n      getRunningMutationsThunk,\n      getRunningQueriesThunk,\n      getRunningQueryThunk\n    } = buildInitiate({\n      queryThunk,\n      mutationThunk,\n      infiniteQueryThunk,\n      api,\n      serializeQueryArgs: serializeQueryArgs as any,\n      context,\n      getInternalState\n    });\n    safeAssign(api.util, {\n      getRunningMutationThunk,\n      getRunningMutationsThunk,\n      getRunningQueryThunk,\n      getRunningQueriesThunk\n    });\n    const {\n      middleware,\n      actions: middlewareActions\n    } = buildMiddleware({\n      reducerPath,\n      context,\n      queryThunk,\n      mutationThunk,\n      infiniteQueryThunk,\n      api,\n      assertTagType,\n      selectors,\n      getRunningQueryThunk,\n      getInternalState\n    });\n    safeAssign(api.util, middlewareActions);\n    safeAssign(api, {\n      reducer: reducer as any,\n      middleware\n    });\n    return {\n      name: coreModuleName,\n      injectEndpoint(endpointName, definition) {\n        const anyApi = api as any as Api<any, Record<string, any>, string, string, CoreModule>;\n        const endpoint = anyApi.endpoints[endpointName] ??= {} as any;\n        if (isQueryDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildQuerySelector(endpointName, definition),\n            initiate: buildInitiateQuery(endpointName, definition)\n          }, buildMatchThunkActions(queryThunk, endpointName));\n        }\n        if (isMutationDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildMutationSelector(),\n            initiate: buildInitiateMutation(endpointName)\n          }, buildMatchThunkActions(mutationThunk, endpointName));\n        }\n        if (isInfiniteQueryDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildInfiniteQuerySelector(endpointName, definition),\n            initiate: buildInitiateInfiniteQuery(endpointName, definition)\n          }, buildMatchThunkActions(queryThunk, endpointName));\n        }\n      }\n    };\n  }\n});","import { buildCreateApi } from '../createApi';\nimport { coreModule } from './module';\nexport const createApi = /* @__PURE__ */buildCreateApi(coreModule());\nexport { QueryStatus } from './apiState';\nexport type { CombinedState, InfiniteData, InfiniteQueryConfigOptions, InfiniteQuerySubState, MutationKeys, QueryCacheKey, QueryKeys, QuerySubState, RootState, SubscriptionOptions } from './apiState';\nexport type { InfiniteQueryActionCreatorResult, MutationActionCreatorResult, QueryActionCreatorResult, StartQueryActionCreatorOptions } from './buildInitiate';\nexport type { MutationCacheLifecycleApi, MutationLifecycleApi, QueryCacheLifecycleApi, QueryLifecycleApi, SubscriptionSelectors, TypedMutationOnQueryStarted, TypedQueryOnQueryStarted } from './buildMiddleware/index';\nexport { skipToken } from './buildSelectors';\nexport type { InfiniteQueryResultSelectorResult, MutationResultSelectorResult, QueryResultSelectorResult, SkipToken } from './buildSelectors';\nexport type { SliceActions } from './buildSlice';\nexport type { PatchQueryDataThunk, UpdateQueryDataThunk, UpsertQueryDataThunk } from './buildThunks';\nexport { coreModuleName } from './module';\nexport type { ApiEndpointInfiniteQuery, ApiEndpointMutation, ApiEndpointQuery, CoreModule, InternalActions, PrefetchOptions, ThunkWithReturnValue } from './module';\nexport { setupListeners } from './setupListeners';\nexport { buildCreateApi, coreModule };"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACkEO,IAAK,cAAL,kBAAKA,iBAAL;AACL,EAAAA,aAAA,mBAAgB;AAChB,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,eAAY;AACZ,EAAAA,aAAA,cAAW;AAJD,SAAAA;AAAA,GAAA;AAQL,IAAM,uBAAuB;AAC7B,IAAM,iBAAiB;AACvB,IAAM,mBAAmB;AACzB,IAAM,kBAAkB;AA0BxB,S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,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AACD,eAAW,IAAI,MAAM,iBAAiB;AACtC,eAAW,KAAK;AAAA,MACd;AAAA,MACA;AAAA,IACF,CAAC;AACD,WAAO;AAAA,MACL,MAAM;AAAA,MACN,eAAe,cAAc,YAAY;AACvC,cAAM,SAAS;AACf,cAAM,WAAW,OAAO,UAAU,YAAY,MAAM,CAAC;AACrD,YAAI,kBAAkB,UAAU,GAAG;AACjC,qBAAW,UAAU;AAAA,YACnB,MAAM;AAAA,YACN,QAAQ,mBAAmB,cAAc,UAAU;AAAA,YACnD,UAAU,mBAAmB,cAAc,UAAU;AAAA,UACvD,GAAG,uBAAuB,YAAY,YAAY,CAAC;AAAA,QACrD;AACA,YAAI,qBAAqB,UAAU,GAAG;AACpC,qBAAW,UAAU;AAAA,YACnB,MAAM;AAAA,YACN,QAAQ,sBAAsB;AAAA,YAC9B,UAAU,sBAAsB,YAAY;AAAA,UAC9C,GAAG,uBAAuB,eAAe,YAAY,CAAC;AAAA,QACxD;AACA,YAAI,0BAA0B,UAAU,GAAG;AACzC,qBAAW,UAAU;AAAA,YACnB,MAAM;AAAA,YACN,QAAQ,2BAA2B,cAAc,UAAU;AAAA,YAC3D,UAAU,2BAA2B,cAAc,UAAU;AAAA,UAC/D,GAAG,uBAAuB,YAAY,YAAY,CAAC;AAAA,QACrD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;ACniBO,IAAM,YAA2B,+BAAe,WAAW,CAAC;","names":["QueryStatus","isPlainObject","retry","updateListeners","import_toolkit","import_utils","arg","force","options","actions","createSelector","import_toolkit","key","queryArgsApi","_formatProdErrorMessage","getPreviousPageParam","_formatProdErrorMessage2","import_toolkit","_formatProdErrorMessage","mwApi","mwApi","api","cacheKey","extra","api","extra","api","actions","initialized","createSelector"]}
Index: node_modules/@reduxjs/toolkit/dist/query/cjs/rtk-query.production.min.cjs
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/cjs/rtk-query.production.min.cjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/cjs/rtk-query.production.min.cjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,2 @@
+"use strict";var He=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var Jt=Object.prototype.hasOwnProperty;var Gt=(e,t)=>{for(var u in t)He(e,u,{get:t[u],enumerable:!0})},Zt=(e,t,u,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of Yt(t))!Jt.call(e,p)&&p!==u&&He(e,p,{get:()=>t[p],enumerable:!(l=$t(t,p))||l.enumerable});return e};var Xt=e=>Zt(He({},"__esModule",{value:!0}),e);var ln={};Gt(ln,{NamedSchemaError:()=>ce,QueryStatus:()=>Ve,_NEVER:()=>Ct,buildCreateApi:()=>Le,copyWithStructuralSharing:()=>Se,coreModule:()=>_e,coreModuleName:()=>Me,createApi:()=>jt,defaultSerializeQueryArgs:()=>ke,fakeBaseQuery:()=>Ft,fetchBaseQuery:()=>pt,retry:()=>lt,setupListeners:()=>Qt,skipToken:()=>Be});module.exports=Xt(ln);var Ve=(p=>(p.uninitialized="uninitialized",p.pending="pending",p.fulfilled="fulfilled",p.rejected="rejected",p))(Ve||{}),W="uninitialized",Fe="pending",ge="fulfilled",Qe="rejected";function je(e){return{status:e,isUninitialized:e===W,isLoading:e===Fe,isSuccess:e===ge,isError:e===Qe}}var s=require("@reduxjs/toolkit");var tt=s.isPlainObject;function Se(e,t){if(e===t||!(tt(e)&&tt(t)||Array.isArray(e)&&Array.isArray(t)))return t;let u=Object.keys(t),l=Object.keys(e),p=u.length===l.length,S=Array.isArray(t)?[]:{};for(let Q of u)S[Q]=Se(e[Q],t[Q]),p&&(p=e[Q]===S[Q]);return p?e:S}function xe(e,t,u){return e.reduce((l,p,S)=>(t(p,S)&&l.push(u(p,S)),l),[]).flat()}function nt(e){return new RegExp("(^|:)//").test(e)}function rt(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function De(e){return e!=null}function ze(e){return[...e?.values()??[]].filter(De)}function it(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var en=e=>e.replace(/\/$/,""),tn=e=>e.replace(/^\//,"");function at(e,t){if(!e)return t;if(!t)return e;if(nt(t))return t;let u=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=en(e),t=tn(t),`${e}${u}${t}`}function ye(e,t,u){return e.has(t)?e.get(t):e.set(t,u(t)).get(t)}var Ee=()=>new Map;var ot=e=>{let t=new AbortController;return setTimeout(()=>{let u="signal timed out",l="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(u,l):Object.assign(new Error(u),{name:l}))},e),t.signal},st=(...e)=>{for(let u of e)if(u.aborted)return AbortSignal.abort(u.reason);let t=new AbortController;for(let u of e)u.addEventListener("abort",()=>t.abort(u.reason),{signal:t.signal,once:!0});return t.signal};var ut=(...e)=>fetch(...e),nn=e=>e.status>=200&&e.status<=299,rn=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function yt(e){if(!(0,s.isPlainObject)(e))return e;let t={...e};for(let[u,l]of Object.entries(t))l===void 0&&delete t[u];return t}var an=e=>typeof e=="object"&&((0,s.isPlainObject)(e)||Array.isArray(e)||typeof e.toJSON=="function");function pt({baseUrl:e,prepareHeaders:t=h=>h,fetchFn:u=ut,paramsSerializer:l,isJsonContentType:p=rn,jsonContentType:S="application/json",jsonReplacer:Q,timeout:k,responseHandler:M,validateStatus:x,...D}={}){return typeof fetch>"u"&&u===ut&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),async(R,b,w)=>{let{getState:P,extra:f,endpoint:A,forced:B,type:y}=b,c,{url:i,headers:T=new Headers(D.headers),params:E=void 0,responseHandler:g=M??"json",validateStatus:d=x??nn,timeout:a=k,...n}=typeof R=="string"?{url:R}:R,r={...D,signal:a?st(b.signal,ot(a)):b.signal,...n};T=new Headers(yt(T)),r.headers=await t(T,{getState:P,arg:R,extra:f,endpoint:A,forced:B,type:y,extraOptions:w})||T;let o=an(r.body);if(r.body!=null&&!o&&typeof r.body!="string"&&r.headers.delete("content-type"),!r.headers.has("content-type")&&o&&r.headers.set("content-type",S),o&&p(r.headers)&&(r.body=JSON.stringify(r.body,Q)),r.headers.has("accept")||(g==="json"?r.headers.set("accept","application/json"):g==="text"&&r.headers.set("accept","text/plain, text/html, */*")),E){let O=~i.indexOf("?")?"&":"?",_=l?l(E):new URLSearchParams(yt(E));i+=O+_}i=at(e,i);let m=new Request(i,r);c={request:new Request(i,r)};let C;try{C=await u(m)}catch(O){return{error:{status:(O instanceof Error||typeof DOMException<"u"&&O instanceof DOMException)&&O.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(O)},meta:c}}let N=C.clone();c.response=N;let v,I="";try{let O;if(await Promise.all([h(C,g).then(_=>v=_,_=>O=_),N.text().then(_=>I=_,()=>{})]),O)throw O}catch(O){return{error:{status:"PARSING_ERROR",originalStatus:C.status,data:I,error:String(O)},meta:c}}return d(C,v)?{data:v,meta:c}:{error:{status:C.status,data:v},meta:c}};async function h(R,b){if(typeof b=="function")return b(R);if(b==="content-type"&&(b=p(R.headers)?"json":"text"),b==="json"){let w=await R.text();return w.length?JSON.parse(w):null}return R.text()}}var Z=class{constructor(t,u=void 0){this.value=t;this.meta=u}};async function on(e=0,t=5,u){let l=Math.min(e,t),p=~~((Math.random()+.4)*(300<<l));await new Promise((S,Q)=>{let k=setTimeout(()=>S(),p);if(u){let M=()=>{clearTimeout(k),Q(new Error("Aborted"))};u.aborted?(clearTimeout(k),Q(new Error("Aborted"))):u.addEventListener("abort",M,{once:!0})}})}function ct(e,t){throw Object.assign(new Z({error:e,meta:t}),{throwImmediately:!0})}function We(e){e.aborted&&ct({status:"CUSTOM_ERROR",error:"Aborted"})}var dt={},sn=(e,t)=>async(u,l,p)=>{let S=[5,(t||dt).maxRetries,(p||dt).maxRetries].filter(D=>D!==void 0),[Q]=S.slice(-1),M={maxRetries:Q,backoff:on,retryCondition:(D,h,{attempt:R})=>R<=Q,...t,...p},x=0;for(;;){We(l.signal);try{let D=await e(u,l,p);if(D.error)throw new Z(D);return D}catch(D){if(x++,D.throwImmediately){if(D instanceof Z)return D.value;throw D}if(D instanceof Z){if(!M.retryCondition(D.value.error,u,{attempt:x,baseQueryApi:l,extraOptions:p}))return D.value}else if(x>M.maxRetries)return{error:D};We(l.signal);try{await M.backoff(x,M.maxRetries,l.signal)}catch(h){throw We(l.signal),h}}}},lt=Object.assign(sn,{fail:ct});var Oe="__rtkq/",ft="online",mt="offline",un="focus",gt="focused",yn="visibilitychange",ie=(0,s.createAction)(`${Oe}${gt}`),Te=(0,s.createAction)(`${Oe}un${gt}`),ae=(0,s.createAction)(`${Oe}${ft}`),he=(0,s.createAction)(`${Oe}${mt}`),pn={onFocus:ie,onFocusLost:Te,onOnline:ae,onOffline:he},ve=!1;function Qt(e,t){function u(){let[l,p,S,Q]=[ie,Te,ae,he].map(D=>()=>e(D())),k=()=>{window.document.visibilityState==="visible"?l():p()},M=()=>{ve=!1};if(!ve&&typeof window<"u"&&window.addEventListener){let h=function(R){Object.entries(D).forEach(([b,w])=>{R?window.addEventListener(b,w,!1):window.removeEventListener(b,w)})};var x=h;let D={[un]:l,[yn]:k,[ft]:S,[mt]:Q};h(!0),ve=!0,M=()=>{h(!1),ve=!1}}return M}return t?t(e,pn):u()}var te="query",$e="mutation",Ye="infinitequery";function pe(e){return e.type===te}function Tt(e){return e.type===$e}function de(e){return e.type===Ye}function Re(e){return pe(e)||de(e)}function be(e,t,u,l,p,S){let Q=dn(e)?e(t,u,l,p):e;return Q?xe(Q,De,k=>S(Je(k))):[]}function dn(e){return typeof e=="function"}function Je(e){return typeof e=="string"?{type:e}:e}var H=require("immer");var Hn=require("@reduxjs/toolkit");function ht(e,t){return e.catch(t)}var J=(e,t)=>e.endpointDefinitions[t];var Ae=Symbol("forceQueryFn"),Pe=e=>typeof e[Ae]=="function";function Rt({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:u,mutationThunk:l,api:p,context:S,getInternalState:Q}){let k=i=>Q(i)?.runningQueries,M=i=>Q(i)?.runningMutations,{unsubscribeQueryResult:x,removeMutationResult:D,updateSubscriptionOptions:h}=p.internalActions;return{buildInitiateQuery:B,buildInitiateInfiniteQuery:y,buildInitiateMutation:c,getRunningQueryThunk:R,getRunningMutationThunk:b,getRunningQueriesThunk:w,getRunningMutationsThunk:P};function R(i,T){return E=>{let g=J(S,i),d=e({queryArgs:T,endpointDefinition:g,endpointName:i});return k(E)?.get(d)}}function b(i,T){return E=>M(E)?.get(T)}function w(){return i=>ze(k(i))}function P(){return i=>ze(M(i))}function f(i){}function A(i,T){let E=(g,{subscribe:d=!0,forceRefetch:a,subscriptionOptions:n,[Ae]:r,...o}={})=>(m,F)=>{let C=e({queryArgs:g,endpointDefinition:T,endpointName:i}),N,v={...o,type:te,subscribe:d,forceRefetch:a,subscriptionOptions:n,endpointName:i,originalArgs:g,queryCacheKey:C,[Ae]:r};if(pe(T))N=t(v);else{let{direction:K,initialPageParam:L,refetchCachedPages:U}=o;N=u({...v,direction:K,initialPageParam:L,refetchCachedPages:U})}let I=p.endpoints[i].select(g),O=m(N),_=I(F());let{requestId:$,abort:G}=O,V=_.requestId!==$,z=k(m)?.get(C),j=()=>I(F()),q=Object.assign(r?O.then(j):V&&!z?Promise.resolve(_):Promise.all([z,O]).then(j),{arg:g,requestId:$,subscriptionOptions:n,queryCacheKey:C,abort:G,async unwrap(){let K=await q;if(K.isError)throw K.error;return K.data},refetch:K=>m(E(g,{subscribe:!1,forceRefetch:!0,...K})),unsubscribe(){d&&m(x({queryCacheKey:C,requestId:$}))},updateSubscriptionOptions(K){q.subscriptionOptions=K,m(h({endpointName:i,requestId:$,queryCacheKey:C,options:K}))}});if(!z&&!V&&!r){let K=k(m);K.set(C,q),q.then(()=>{K.delete(C)})}return q};return E}function B(i,T){return A(i,T)}function y(i,T){return A(i,T)}function c(i){return(T,{track:E=!0,fixedCacheKey:g}={})=>(d,a)=>{let n=l({type:"mutation",endpointName:i,originalArgs:T,track:E,fixedCacheKey:g}),r=d(n);let{requestId:o,abort:m,unwrap:F}=r,C=ht(r.unwrap().then(O=>({data:O})),O=>({error:O})),N=()=>{d(D({requestId:o,fixedCacheKey:g}))},v=Object.assign(C,{arg:r.arg,requestId:o,abort:m,unwrap:F,reset:N}),I=M(d);return I.set(o,v),v.then(()=>{I.delete(o)}),g&&(I.set(g,v),v.then(()=>{I.get(g)===v&&I.delete(g)})),v}}}var At=require("@standard-schema/utils"),ce=class extends At.SchemaError{constructor(u,l,p,S){super(u);this.value=l;this.schemaName=p;this._bqMeta=S}},oe=(e,t)=>Array.isArray(e)?e.includes(t):!!e;async function se(e,t,u,l){let p=await e["~standard"].validate(t);if(p.issues)throw new ce(p.issues,t,u,l);return p.value}function St(e){return e}var Ie=(e={})=>({...e,[s.SHOULD_AUTOBATCH]:!0});function xt({reducerPath:e,baseQuery:t,context:{endpointDefinitions:u},serializeQueryArgs:l,api:p,assertTagType:S,selectors:Q,onSchemaFailure:k,catchSchemaFailure:M,skipSchemaValidation:x}){let D=(n,r,o,m)=>(F,C)=>{let N=u[n],v=l({queryArgs:r,endpointDefinition:N,endpointName:n});if(F(p.internalActions.queryResultPatched({queryCacheKey:v,patches:o})),!m)return;let I=p.endpoints[n].select(r)(C()),O=be(N.providesTags,I.data,void 0,r,{},S);F(p.internalActions.updateProvidedBy([{queryCacheKey:v,providedTags:O}]))};function h(n,r,o=0){let m=[r,...n];return o&&m.length>o?m.slice(0,-1):m}function R(n,r,o=0){let m=[...n,r];return o&&m.length>o?m.slice(1):m}let b=(n,r,o,m=!0)=>(F,C)=>{let v=p.endpoints[n].select(r)(C()),I={patches:[],inversePatches:[],undo:()=>F(p.util.patchQueryData(n,r,I.inversePatches,m))};if(v.status===W)return I;let O;if("data"in v)if((0,H.isDraftable)(v.data)){let[_,$,G]=(0,H.produceWithPatches)(v.data,o);I.patches.push(...$),I.inversePatches.push(...G),O=_}else O=o(v.data),I.patches.push({op:"replace",path:[],value:O}),I.inversePatches.push({op:"replace",path:[],value:v.data});return I.patches.length===0||F(p.util.patchQueryData(n,r,I.patches,m)),I},w=(n,r,o)=>m=>m(p.endpoints[n].initiate(r,{subscribe:!1,forceRefetch:!0,[Ae]:()=>({data:o})})),P=(n,r)=>n.query&&n[r]?n[r]:St,f=async(n,{signal:r,abort:o,rejectWithValue:m,fulfillWithValue:F,dispatch:C,getState:N,extra:v})=>{let I=u[n.endpointName],{metaSchema:O,skipSchemaValidation:_=x}=I,$=n.type===te;try{let G=St,V={signal:r,abort:o,dispatch:C,getState:N,extra:v,endpoint:n.endpointName,type:n.type,forced:$?A(n,N()):void 0,queryCacheKey:$?n.queryCacheKey:void 0},z=$?n[Ae]:void 0,j,q=async(L,U,ne,Y)=>{if(U==null&&L.pages.length)return Promise.resolve({data:L});let fe={queryArg:n.originalArgs,pageParam:U},ee=await K(fe),me=Y?h:R;return{data:{pages:me(L.pages,ee.data,ne),pageParams:me(L.pageParams,U,ne)},meta:ee.meta}};async function K(L){let U,{extraOptions:ne,argSchema:Y,rawResponseSchema:fe,responseSchema:ee}=I;if(Y&&!oe(_,"arg")&&(L=await se(Y,L,"argSchema",{})),z?U=z():I.query?(G=P(I,"transformResponse"),U=await t(I.query(L),V,ne)):U=await I.queryFn(L,V,ne,ue=>t(ue,V,ne)),typeof process<"u",U.error)throw new Z(U.error,U.meta);let{data:me}=U;fe&&!oe(_,"rawResponse")&&(me=await se(fe,U.data,"rawResponseSchema",U.meta));let re=await G(me,U.meta,L);return ee&&!oe(_,"response")&&(re=await se(ee,re,"responseSchema",U.meta)),{...U,data:re}}if($&&"infiniteQueryOptions"in I){let{infiniteQueryOptions:L}=I,{maxPages:U=1/0}=L,ne=n.refetchCachedPages??L.refetchCachedPages??!0,Y,fe={pages:[],pageParams:[]},ee=Q.selectQueryEntry(N(),n.queryCacheKey)?.data,re=A(n,N())&&!n.direction||!ee?fe:ee;if("direction"in n&&n.direction&&re.pages.length){let ue=n.direction==="backward",Ce=(ue?Ge:Ne)(L,re,n.originalArgs);Y=await q(re,Ce,U,ue)}else{let{initialPageParam:ue=L.initialPageParam}=n,we=ee?.pageParams??[],Ce=we[0]??ue,zt=we.length;if(Y=await q(re,Ce,U),z&&(Y={data:Y.data.pages[0]}),ne)for(let et=1;et<zt;et++){let Wt=Ne(L,Y.data,n.originalArgs);Y=await q(Y.data,Wt,U)}}j=Y}else j=await K(n.originalArgs);return O&&!oe(_,"meta")&&j.meta&&(j.meta=await se(O,j.meta,"metaSchema",j.meta)),F(j.data,Ie({fulfilledTimeStamp:Date.now(),baseQueryMeta:j.meta}))}catch(G){let V=G;if(V instanceof Z){let z=P(I,"transformErrorResponse"),{rawErrorResponseSchema:j,errorResponseSchema:q}=I,{value:K,meta:L}=V;try{j&&!oe(_,"rawErrorResponse")&&(K=await se(j,K,"rawErrorResponseSchema",L)),O&&!oe(_,"meta")&&(L=await se(O,L,"metaSchema",L));let U=await z(K,L,n.originalArgs);return q&&!oe(_,"errorResponse")&&(U=await se(q,U,"errorResponseSchema",L)),m(U,Ie({baseQueryMeta:L}))}catch(U){V=U}}try{if(V instanceof ce){let z={endpoint:n.endpointName,arg:n.originalArgs,type:n.type,queryCacheKey:$?n.queryCacheKey:void 0};I.onSchemaFailure?.(V,z),k?.(V,z);let{catchSchemaFailure:j=M}=I;if(j)return m(j(V,z),Ie({baseQueryMeta:V._bqMeta}))}}catch(z){V=z}throw typeof process<"u",console.error(V),V}};function A(n,r){let o=Q.selectQueryEntry(r,n.queryCacheKey),m=Q.selectConfig(r).refetchOnMountOrArgChange,F=o?.fulfilledTimeStamp,C=n.forceRefetch??(n.subscribe&&m);return C?C===!0||(Number(new Date)-Number(F))/1e3>=C:!1}let B=()=>(0,s.createAsyncThunk)(`${e}/executeQuery`,f,{getPendingMeta({arg:r}){let o=u[r.endpointName];return Ie({startedTimeStamp:Date.now(),...de(o)?{direction:r.direction}:{}})},condition(r,{getState:o}){let m=o(),F=Q.selectQueryEntry(m,r.queryCacheKey),C=F?.fulfilledTimeStamp,N=r.originalArgs,v=F?.originalArgs,I=u[r.endpointName],O=r.direction;return Pe(r)?!0:F?.status==="pending"?!1:A(r,m)||pe(I)&&I?.forceRefetch?.({currentArg:N,previousArg:v,endpointState:F,state:m})?!0:!(C&&!O)},dispatchConditionRejection:!0}),y=B(),c=B(),i=(0,s.createAsyncThunk)(`${e}/executeMutation`,f,{getPendingMeta(){return Ie({startedTimeStamp:Date.now()})}}),T=n=>"force"in n,E=n=>"ifOlderThan"in n,g=(n,r,o={})=>(m,F)=>{let C=T(o)&&o.force,N=E(o)&&o.ifOlderThan,v=(O=!0)=>{let _={forceRefetch:O,subscribe:!1};return p.endpoints[n].initiate(r,_)},I=p.endpoints[n].select(r)(F());if(C)m(v());else if(N){let O=I?.fulfilledTimeStamp;if(!O){m(v());return}(Number(new Date)-Number(new Date(O)))/1e3>=N&&m(v())}else m(v(!1))};function d(n){return r=>r?.meta?.arg?.endpointName===n}function a(n,r){return{matchPending:(0,s.isAllOf)((0,s.isPending)(n),d(r)),matchFulfilled:(0,s.isAllOf)((0,s.isFulfilled)(n),d(r)),matchRejected:(0,s.isAllOf)((0,s.isRejected)(n),d(r))}}return{queryThunk:y,mutationThunk:i,infiniteQueryThunk:c,prefetch:g,updateQueryData:b,upsertQueryData:w,patchQueryData:D,buildMatchThunkActions:a}}function Ne(e,{pages:t,pageParams:u},l){let p=t.length-1;return e.getNextPageParam(t[p],t,u[p],u,l)}function Ge(e,{pages:t,pageParams:u},l){return e.getPreviousPageParam?.(t[0],t,u[0],u,l)}function Ue(e,t,u,l){return be(u[e.meta.arg.endpointName][t],(0,s.isFulfilled)(e)?e.payload:void 0,(0,s.isRejectedWithValue)(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,l)}function Ze(e){return(0,H.isDraft)(e)?(0,H.current)(e):e}function qe(e,t,u){let l=e[t];l&&u(l)}function le(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Dt(e,t,u){let l=e[le(t)];l&&u(l)}var Ke={};function Et({reducerPath:e,queryThunk:t,mutationThunk:u,serializeQueryArgs:l,context:{endpointDefinitions:p,apiUid:S,extractRehydrationInfo:Q,hasRehydrationInfo:k},assertTagType:M,config:x}){let D=(0,s.createAction)(`${e}/resetApiState`);function h(d,a,n,r){d[a.queryCacheKey]??={status:W,endpointName:a.endpointName},qe(d,a.queryCacheKey,o=>{o.status=Fe,o.requestId=n&&o.requestId?o.requestId:r.requestId,a.originalArgs!==void 0&&(o.originalArgs=a.originalArgs),o.startedTimeStamp=r.startedTimeStamp;let m=p[r.arg.endpointName];de(m)&&"direction"in a&&(o.direction=a.direction)})}function R(d,a,n,r){qe(d,a.arg.queryCacheKey,o=>{if(o.requestId!==a.requestId&&!r)return;let{merge:m}=p[a.arg.endpointName];if(o.status=ge,m)if(o.data!==void 0){let{fulfilledTimeStamp:F,arg:C,baseQueryMeta:N,requestId:v}=a,I=(0,s.createNextState)(o.data,O=>m(O,n,{arg:C.originalArgs,baseQueryMeta:N,fulfilledTimeStamp:F,requestId:v}));o.data=I}else o.data=n;else o.data=p[a.arg.endpointName].structuralSharing??!0?Se((0,H.isDraft)(o.data)?(0,H.original)(o.data):o.data,n):n;delete o.error,o.fulfilledTimeStamp=a.fulfilledTimeStamp})}let b=(0,s.createSlice)({name:`${e}/queries`,initialState:Ke,reducers:{removeQueryResult:{reducer(d,{payload:{queryCacheKey:a}}){delete d[a]},prepare:(0,s.prepareAutoBatched)()},cacheEntriesUpserted:{reducer(d,a){for(let n of a.payload){let{queryDescription:r,value:o}=n;h(d,r,!0,{arg:r,requestId:a.meta.requestId,startedTimeStamp:a.meta.timestamp}),R(d,{arg:r,requestId:a.meta.requestId,fulfilledTimeStamp:a.meta.timestamp,baseQueryMeta:{}},o,!0)}},prepare:d=>({payload:d.map(r=>{let{endpointName:o,arg:m,value:F}=r,C=p[o];return{queryDescription:{type:te,endpointName:o,originalArgs:r.arg,queryCacheKey:l({queryArgs:m,endpointDefinition:C,endpointName:o})},value:F}}),meta:{[s.SHOULD_AUTOBATCH]:!0,requestId:(0,s.nanoid)(),timestamp:Date.now()}})},queryResultPatched:{reducer(d,{payload:{queryCacheKey:a,patches:n}}){qe(d,a,r=>{r.data=(0,H.applyPatches)(r.data,n.concat())})},prepare:(0,s.prepareAutoBatched)()}},extraReducers(d){d.addCase(t.pending,(a,{meta:n,meta:{arg:r}})=>{let o=Pe(r);h(a,r,o,n)}).addCase(t.fulfilled,(a,{meta:n,payload:r})=>{let o=Pe(n.arg);R(a,n,r,o)}).addCase(t.rejected,(a,{meta:{condition:n,arg:r,requestId:o},error:m,payload:F})=>{qe(a,r.queryCacheKey,C=>{if(!n){if(C.requestId!==o)return;C.status=Qe,C.error=F??m}})}).addMatcher(k,(a,n)=>{let{queries:r}=Q(n);for(let[o,m]of Object.entries(r))(m?.status===ge||m?.status===Qe)&&(a[o]=m)})}}),w=(0,s.createSlice)({name:`${e}/mutations`,initialState:Ke,reducers:{removeMutationResult:{reducer(d,{payload:a}){let n=le(a);n in d&&delete d[n]},prepare:(0,s.prepareAutoBatched)()}},extraReducers(d){d.addCase(u.pending,(a,{meta:n,meta:{requestId:r,arg:o,startedTimeStamp:m}})=>{o.track&&(a[le(n)]={requestId:r,status:Fe,endpointName:o.endpointName,startedTimeStamp:m})}).addCase(u.fulfilled,(a,{payload:n,meta:r})=>{r.arg.track&&Dt(a,r,o=>{o.requestId===r.requestId&&(o.status=ge,o.data=n,o.fulfilledTimeStamp=r.fulfilledTimeStamp)})}).addCase(u.rejected,(a,{payload:n,error:r,meta:o})=>{o.arg.track&&Dt(a,o,m=>{m.requestId===o.requestId&&(m.status=Qe,m.error=n??r)})}).addMatcher(k,(a,n)=>{let{mutations:r}=Q(n);for(let[o,m]of Object.entries(r))(m?.status===ge||m?.status===Qe)&&o!==m?.requestId&&(a[o]=m)})}}),P={tags:{},keys:{}},f=(0,s.createSlice)({name:`${e}/invalidation`,initialState:P,reducers:{updateProvidedBy:{reducer(d,a){for(let{queryCacheKey:n,providedTags:r}of a.payload){A(d,n);for(let{type:o,id:m}of r){let F=(d.tags[o]??={})[m||"__internal_without_id"]??=[];F.includes(n)||F.push(n)}d.keys[n]=r}},prepare:(0,s.prepareAutoBatched)()}},extraReducers(d){d.addCase(b.actions.removeQueryResult,(a,{payload:{queryCacheKey:n}})=>{A(a,n)}).addMatcher(k,(a,n)=>{let{provided:r}=Q(n);for(let[o,m]of Object.entries(r.tags??{}))for(let[F,C]of Object.entries(m)){let N=(a.tags[o]??={})[F||"__internal_without_id"]??=[];for(let v of C)N.includes(v)||N.push(v),a.keys[v]=r.keys[v]}}).addMatcher((0,s.isAnyOf)((0,s.isFulfilled)(t),(0,s.isRejectedWithValue)(t)),(a,n)=>{B(a,[n])}).addMatcher(b.actions.cacheEntriesUpserted.match,(a,n)=>{let r=n.payload.map(({queryDescription:o,value:m})=>({type:"UNKNOWN",payload:m,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:o}}));B(a,r)})}});function A(d,a){let n=Ze(d.keys[a]??[]);for(let r of n){let o=r.type,m=r.id??"__internal_without_id",F=d.tags[o]?.[m];F&&(d.tags[o][m]=Ze(F).filter(C=>C!==a))}delete d.keys[a]}function B(d,a){let n=a.map(r=>{let o=Ue(r,"providesTags",p,M),{queryCacheKey:m}=r.meta.arg;return{queryCacheKey:m,providedTags:o}});f.caseReducers.updateProvidedBy(d,f.actions.updateProvidedBy(n))}let y=(0,s.createSlice)({name:`${e}/subscriptions`,initialState:Ke,reducers:{updateSubscriptionOptions(d,a){},unsubscribeQueryResult(d,a){},internal_getRTKQSubscriptions(){}}}),c=(0,s.createSlice)({name:`${e}/internalSubscriptions`,initialState:Ke,reducers:{subscriptionsUpdated:{reducer(d,a){return(0,H.applyPatches)(d,a.payload)},prepare:(0,s.prepareAutoBatched)()}}}),i=(0,s.createSlice)({name:`${e}/config`,initialState:{online:it(),focused:rt(),middlewareRegistered:!1,...x},reducers:{middlewareRegistered(d,{payload:a}){d.middlewareRegistered=d.middlewareRegistered==="conflict"||S!==a?"conflict":!0}},extraReducers:d=>{d.addCase(ae,a=>{a.online=!0}).addCase(he,a=>{a.online=!1}).addCase(ie,a=>{a.focused=!0}).addCase(Te,a=>{a.focused=!1}).addMatcher(k,a=>({...a}))}}),T=(0,s.combineReducers)({queries:b.reducer,mutations:w.reducer,provided:f.reducer,subscriptions:c.reducer,config:i.reducer}),E=(d,a)=>T(D.match(a)?void 0:d,a),g={...i.actions,...b.actions,...y.actions,...c.actions,...w.actions,...f.actions,resetApiState:D};return{reducer:E,actions:g}}var Be=Symbol.for("RTKQ/skipToken"),It={status:W},bt=(0,s.createNextState)(It,()=>{}),Pt=(0,s.createNextState)(It,()=>{});function Bt({serializeQueryArgs:e,reducerPath:t,createSelector:u}){let l=y=>bt,p=y=>Pt;return{buildQuerySelector:R,buildInfiniteQuerySelector:b,buildMutationSelector:w,selectInvalidatedBy:P,selectCachedArgsForQuery:f,selectApiState:Q,selectQueries:k,selectMutations:x,selectQueryEntry:M,selectConfig:D};function S(y){return{...y,...je(y.status)}}function Q(y){return y[t]}function k(y){return Q(y)?.queries}function M(y,c){return k(y)?.[c]}function x(y){return Q(y)?.mutations}function D(y){return Q(y)?.config}function h(y,c,i){return T=>{if(T===Be)return u(l,i);let E=e({queryArgs:T,endpointDefinition:c,endpointName:y});return u(d=>M(d,E)??bt,i)}}function R(y,c){return h(y,c,S)}function b(y,c){let{infiniteQueryOptions:i}=c;function T(E){let g={...E,...je(E.status)},{isLoading:d,isError:a,direction:n}=g,r=n==="forward",o=n==="backward";return{...g,hasNextPage:A(i,g.data,g.originalArgs),hasPreviousPage:B(i,g.data,g.originalArgs),isFetchingNextPage:d&&r,isFetchingPreviousPage:d&&o,isFetchNextPageError:a&&r,isFetchPreviousPageError:a&&o}}return h(y,c,T)}function w(){return y=>{let c;return typeof y=="object"?c=le(y)??Be:c=y,u(c===Be?p:E=>Q(E)?.mutations?.[c]??Pt,S)}}function P(y,c){let i=y[t],T=new Set,E=xe(c,De,Je);for(let g of E){let d=i.provided.tags[g.type];if(!d)continue;let a=(g.id!==void 0?d[g.id]:Object.values(d).flat())??[];for(let n of a)T.add(n)}return Array.from(T.values()).flatMap(g=>{let d=i.queries[g];return d?{queryCacheKey:g,endpointName:d.endpointName,originalArgs:d.originalArgs}:[]})}function f(y,c){return xe(Object.values(k(y)),i=>i?.endpointName===c&&i.status!==W,i=>i.originalArgs)}function A(y,c,i){return c?Ne(y,c,i)!=null:!1}function B(y,c,i){return!c||!y.getPreviousPageParam?!1:Ge(y,c,i)!=null}}var Mt=require("@reduxjs/toolkit");var kt=WeakMap?new WeakMap:void 0,ke=({endpointName:e,queryArgs:t})=>{let u="",l=kt?.get(t);if(typeof l=="string")u=l;else{let p=JSON.stringify(t,(S,Q)=>(Q=typeof Q=="bigint"?{$bigint:Q.toString()}:Q,Q=(0,s.isPlainObject)(Q)?Object.keys(Q).sort().reduce((k,M)=>(k[M]=Q[M],k),{}):Q,Q));(0,s.isPlainObject)(t)&&kt?.set(t,p),u=p}return`${e}(${u})`};var Xe=require("reselect");function Le(...e){return function(u){let l=(0,Xe.weakMapMemoize)(x=>u.extractRehydrationInfo?.(x,{reducerPath:u.reducerPath??"api"})),p={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...u,extractRehydrationInfo:l,serializeQueryArgs(x){let D=ke;if("serializeQueryArgs"in x.endpointDefinition){let h=x.endpointDefinition.serializeQueryArgs;D=R=>{let b=h(R);return typeof b=="string"?b:ke({...R,queryArgs:b})}}else u.serializeQueryArgs&&(D=u.serializeQueryArgs);return D(x)},tagTypes:[...u.tagTypes||[]]},S={endpointDefinitions:{},batch(x){x()},apiUid:(0,s.nanoid)(),extractRehydrationInfo:l,hasRehydrationInfo:(0,Xe.weakMapMemoize)(x=>l(x)!=null)},Q={injectEndpoints:M,enhanceEndpoints({addTagTypes:x,endpoints:D}){if(x)for(let h of x)p.tagTypes.includes(h)||p.tagTypes.push(h);if(D)for(let[h,R]of Object.entries(D))typeof R=="function"?R(J(S,h)):Object.assign(J(S,h)||{},R);return Q}},k=e.map(x=>x.init(Q,p,S));function M(x){let D=x.endpoints({query:h=>({...h,type:te}),mutation:h=>({...h,type:$e}),infiniteQuery:h=>({...h,type:Ye})});for(let[h,R]of Object.entries(D)){if(x.overrideExisting!==!0&&h in S.endpointDefinitions){if(x.overrideExisting==="throw")throw new Error((0,Mt.formatProdErrorMessage)(39));typeof process<"u";continue}typeof process<"u",S.endpointDefinitions[h]=R;for(let b of k)b.injectEndpoint(h,R)}return Q}return Q.injectEndpoints({endpoints:u.endpoints})}}var wt=require("@reduxjs/toolkit"),Ct=Symbol();function Ft(){return function(){throw new Error((0,wt.formatProdErrorMessage)(33))}}function X(e,...t){return Object.assign(e,...t)}var vt=({api:e,queryThunk:t,internalState:u,mwApi:l})=>{let p=`${e.reducerPath}/subscriptions`,S=null,Q=null,{updateSubscriptionOptions:k,unsubscribeQueryResult:M}=e.internalActions,x=(P,f)=>{if(k.match(f)){let{queryCacheKey:B,requestId:y,options:c}=f.payload,i=P.get(B);return i?.has(y)&&i.set(y,c),!0}if(M.match(f)){let{queryCacheKey:B,requestId:y}=f.payload,c=P.get(B);return c&&c.delete(y),!0}if(e.internalActions.removeQueryResult.match(f))return P.delete(f.payload.queryCacheKey),!0;if(t.pending.match(f)){let{meta:{arg:B,requestId:y}}=f,c=ye(P,B.queryCacheKey,Ee);return B.subscribe&&c.set(y,B.subscriptionOptions??c.get(y)??{}),!0}let A=!1;if(t.rejected.match(f)){let{meta:{condition:B,arg:y,requestId:c}}=f;if(B&&y.subscribe){let i=ye(P,y.queryCacheKey,Ee);i.set(c,y.subscriptionOptions??i.get(c)??{}),A=!0}}return A},D=()=>u.currentSubscriptions,b={getSubscriptions:D,getSubscriptionCount:P=>D().get(P)?.size??0,isRequestSubscribed:(P,f)=>!!D()?.get(P)?.get(f)};function w(P){return JSON.parse(JSON.stringify(Object.fromEntries([...P].map(([f,A])=>[f,Object.fromEntries(A)]))))}return(P,f)=>{if(S||(S=w(u.currentSubscriptions)),e.util.resetApiState.match(P))return S={},u.currentSubscriptions.clear(),Q=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(P))return[!1,b];let A=x(u.currentSubscriptions,P),B=!0;if(A){Q||(Q=setTimeout(()=>{let i=w(u.currentSubscriptions),[,T]=(0,H.produceWithPatches)(S,()=>i);f.next(e.internalActions.subscriptionsUpdated(T)),S=i,Q=null},500));let y=typeof P.type=="string"&&!!P.type.startsWith(p),c=t.rejected.match(P)&&P.meta.condition&&!!P.meta.arg.subscribe;B=!y&&!c}return[B,!1]}};var cn=2147483647/1e3-1,Ot=({reducerPath:e,api:t,queryThunk:u,context:l,internalState:p,selectors:{selectQueryEntry:S,selectConfig:Q},getRunningQueryThunk:k,mwApi:M})=>{let{removeQueryResult:x,unsubscribeQueryResult:D,cacheEntriesUpserted:h}=t.internalActions,R=(0,s.isAnyOf)(D.match,u.fulfilled,u.rejected,h.match);function b(y){let c=p.currentSubscriptions.get(y);return c?c.size>0:!1}let w={};function P(y){for(let c of y.values())c?.abort?.()}let f=(y,c)=>{let i=c.getState(),T=Q(i);if(R(y)){let E;if(h.match(y))E=y.payload.map(g=>g.queryDescription.queryCacheKey);else{let{queryCacheKey:g}=D.match(y)?y.payload:y.meta.arg;E=[g]}A(E,c,T)}if(t.util.resetApiState.match(y)){for(let[E,g]of Object.entries(w))g&&clearTimeout(g),delete w[E];P(p.runningQueries),P(p.runningMutations)}if(l.hasRehydrationInfo(y)){let{queries:E}=l.extractRehydrationInfo(y);A(Object.keys(E),c,T)}};function A(y,c,i){let T=c.getState();for(let E of y){let g=S(T,E);g?.endpointName&&B(E,g.endpointName,c,i)}}function B(y,c,i,T){let g=J(l,c)?.keepUnusedDataFor??T.keepUnusedDataFor;if(g===1/0)return;let d=Math.max(0,Math.min(g,cn));if(!b(y)){let a=w[y];a&&clearTimeout(a),w[y]=setTimeout(()=>{if(!b(y)){let n=S(i.getState(),y);n?.endpointName&&i.dispatch(k(n.endpointName,n.originalArgs))?.abort(),i.dispatch(x({queryCacheKey:y}))}delete w[y]},d*1e3)}}return f};var Nt=new Error("Promise never resolved before cacheEntryRemoved."),Ut=({api:e,reducerPath:t,context:u,queryThunk:l,mutationThunk:p,internalState:S,selectors:{selectQueryEntry:Q,selectApiState:k}})=>{let M=(0,s.isAsyncThunkAction)(l),x=(0,s.isAsyncThunkAction)(p),D=(0,s.isFulfilled)(l,p),h={},{removeQueryResult:R,removeMutationResult:b,cacheEntriesUpserted:w}=e.internalActions;function P(i,T,E){let g=h[i];g?.valueResolved&&(g.valueResolved({data:T,meta:E}),delete g.valueResolved)}function f(i){let T=h[i];T&&(delete h[i],T.cacheEntryRemoved())}function A(i){let{arg:T,requestId:E}=i.meta,{endpointName:g,originalArgs:d}=T;return[g,d,E]}let B=(i,T,E)=>{let g=y(i);function d(a,n,r,o){let m=Q(E,n),F=Q(T.getState(),n);!m&&F&&c(a,o,n,T,r)}if(l.pending.match(i)){let[a,n,r]=A(i);d(a,g,r,n)}else if(w.match(i))for(let{queryDescription:a,value:n}of i.payload){let{endpointName:r,originalArgs:o,queryCacheKey:m}=a;d(r,m,i.meta.requestId,o),P(m,n,{})}else if(p.pending.match(i)){if(T.getState()[t].mutations[g]){let[n,r,o]=A(i);c(n,r,g,T,o)}}else if(D(i))P(g,i.payload,i.meta.baseQueryMeta);else if(R.match(i)||b.match(i))f(g);else if(e.util.resetApiState.match(i))for(let a of Object.keys(h))f(a)};function y(i){return M(i)?i.meta.arg.queryCacheKey:x(i)?i.meta.arg.fixedCacheKey??i.meta.requestId:R.match(i)?i.payload.queryCacheKey:b.match(i)?le(i.payload):""}function c(i,T,E,g,d){let a=J(u,i),n=a?.onCacheEntryAdded;if(!n)return;let r={},o=new Promise(I=>{r.cacheEntryRemoved=I}),m=Promise.race([new Promise(I=>{r.valueResolved=I}),o.then(()=>{throw Nt})]);m.catch(()=>{}),h[E]=r;let F=e.endpoints[i].select(Re(a)?T:E),C=g.dispatch((I,O,_)=>_),N={...g,getCacheEntry:()=>F(g.getState()),requestId:d,extra:C,updateCachedData:Re(a)?I=>g.dispatch(e.util.updateQueryData(i,T,I)):void 0,cacheDataLoaded:m,cacheEntryRemoved:o},v=n(T,N);Promise.resolve(v).catch(I=>{if(I!==Nt)throw I})}return B};var qt=({api:e,context:{apiUid:t},reducerPath:u})=>(l,p)=>{e.util.resetApiState.match(l)&&p.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"};var Kt=({reducerPath:e,context:t,context:{endpointDefinitions:u},mutationThunk:l,queryThunk:p,api:S,assertTagType:Q,refetchQuery:k,internalState:M})=>{let{removeQueryResult:x}=S.internalActions,D=(0,s.isAnyOf)((0,s.isFulfilled)(l),(0,s.isRejectedWithValue)(l)),h=(0,s.isAnyOf)((0,s.isFulfilled)(p,l),(0,s.isRejected)(p,l)),R=[],b=0,w=(A,B)=>{(p.pending.match(A)||l.pending.match(A))&&b++,h(A)&&(b=Math.max(0,b-1)),D(A)?f(Ue(A,"invalidatesTags",u,Q),B):h(A)?f([],B):S.util.invalidateTags.match(A)&&f(be(A.payload,void 0,void 0,void 0,void 0,Q),B)};function P(){return b>0}function f(A,B){let y=B.getState(),c=y[e];if(R.push(...A),c.config.invalidationBehavior==="delayed"&&P())return;let i=R;if(R=[],i.length===0)return;let T=S.util.selectInvalidatedBy(y,i);t.batch(()=>{let E=Array.from(T.values());for(let{queryCacheKey:g}of E){let d=c.queries[g],a=ye(M.currentSubscriptions,g,Ee);d&&(a.size===0?B.dispatch(x({queryCacheKey:g})):d.status!==W&&B.dispatch(k(d)))}})}return w};var Lt=({reducerPath:e,queryThunk:t,api:u,refetchQuery:l,internalState:p})=>{let{currentPolls:S,currentSubscriptions:Q}=p,k=new Set,M=null,x=(f,A)=>{(u.internalActions.updateSubscriptionOptions.match(f)||u.internalActions.unsubscribeQueryResult.match(f))&&D(f.payload.queryCacheKey,A),(t.pending.match(f)||t.rejected.match(f)&&f.meta.condition)&&D(f.meta.arg.queryCacheKey,A),(t.fulfilled.match(f)||t.rejected.match(f)&&!f.meta.condition)&&h(f.meta.arg,A),u.util.resetApiState.match(f)&&(w(),M&&(clearTimeout(M),M=null),k.clear())};function D(f,A){k.add(f),M||(M=setTimeout(()=>{for(let B of k)R({queryCacheKey:B},A);k.clear(),M=null},0))}function h({queryCacheKey:f},A){let B=A.getState()[e],y=B.queries[f],c=Q.get(f);if(!y||y.status===W)return;let{lowestPollingInterval:i,skipPollingIfUnfocused:T}=P(c);if(!Number.isFinite(i))return;let E=S.get(f);E?.timeout&&(clearTimeout(E.timeout),E.timeout=void 0);let g=Date.now()+i;S.set(f,{nextPollTimestamp:g,pollingInterval:i,timeout:setTimeout(()=>{(B.config.focused||!T)&&A.dispatch(l(y)),h({queryCacheKey:f},A)},i)})}function R({queryCacheKey:f},A){let y=A.getState()[e].queries[f],c=Q.get(f);if(!y||y.status===W)return;let{lowestPollingInterval:i}=P(c);if(!Number.isFinite(i)){b(f);return}let T=S.get(f),E=Date.now()+i;(!T||E<T.nextPollTimestamp)&&h({queryCacheKey:f},A)}function b(f){let A=S.get(f);A?.timeout&&clearTimeout(A.timeout),S.delete(f)}function w(){for(let f of S.keys())b(f)}function P(f=new Map){let A=!1,B=Number.POSITIVE_INFINITY;for(let y of f.values())y.pollingInterval&&(B=Math.min(y.pollingInterval,B),A=y.skipPollingIfUnfocused||A);return{lowestPollingInterval:B,skipPollingIfUnfocused:A}}return x};var _t=({api:e,context:t,queryThunk:u,mutationThunk:l})=>{let p=(0,s.isPending)(u,l),S=(0,s.isRejected)(u,l),Q=(0,s.isFulfilled)(u,l),k={};return(x,D)=>{if(p(x)){let{requestId:h,arg:{endpointName:R,originalArgs:b}}=x.meta,w=J(t,R),P=w?.onQueryStarted;if(P){let f={},A=new Promise((i,T)=>{f.resolve=i,f.reject=T});A.catch(()=>{}),k[h]=f;let B=e.endpoints[R].select(Re(w)?b:h),y=D.dispatch((i,T,E)=>E),c={...D,getCacheEntry:()=>B(D.getState()),requestId:h,extra:y,updateCachedData:Re(w)?i=>D.dispatch(e.util.updateQueryData(R,b,i)):void 0,queryFulfilled:A};P(b,c)}}else if(Q(x)){let{requestId:h,baseQueryMeta:R}=x.meta;k[h]?.resolve({data:x.payload,meta:R}),delete k[h]}else if(S(x)){let{requestId:h,rejectedWithValue:R,baseQueryMeta:b}=x.meta;k[h]?.reject({error:x.payload??x.error,isUnhandledError:!R,meta:b}),delete k[h]}}};var Ht=({reducerPath:e,context:t,api:u,refetchQuery:l,internalState:p})=>{let{removeQueryResult:S}=u.internalActions,Q=(M,x)=>{ie.match(M)&&k(x,"refetchOnFocus"),ae.match(M)&&k(x,"refetchOnReconnect")};function k(M,x){let D=M.getState()[e],h=D.queries,R=p.currentSubscriptions;t.batch(()=>{for(let b of R.keys()){let w=h[b],P=R.get(b);if(!P||!w)continue;let f=[...P.values()];(f.some(B=>B[x]===!0)||f.every(B=>B[x]===void 0)&&D.config[x])&&(P.size===0?M.dispatch(S({queryCacheKey:b})):w.status!==W&&M.dispatch(l(w)))}})}return Q};function Vt(e){let{reducerPath:t,queryThunk:u,api:l,context:p,getInternalState:S}=e,{apiUid:Q}=p,k={invalidateTags:(0,s.createAction)(`${t}/invalidateTags`)},M=R=>R.type.startsWith(`${t}/`),x=[qt,Ot,Kt,Lt,Ut,_t];return{middleware:R=>{let b=!1,w=S(R.dispatch),P={...e,internalState:w,refetchQuery:h,isThisApiSliceAction:M,mwApi:R},f=x.map(y=>y(P)),A=vt(P),B=Ht(P);return y=>c=>{if(!(0,s.isAction)(c))return y(c);b||(b=!0,R.dispatch(l.internalActions.middlewareRegistered(Q)));let i={...R,next:y},T=R.getState(),[E,g]=A(c,i,T),d;if(E?d=y(c):d=g,R.getState()[t]&&(B(c,i,T),M(c)||p.hasRehydrationInfo(c)))for(let a of f)a(c,i,T);return d}},actions:k};function h(R){return e.api.endpoints[R.endpointName].initiate(R.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Me=Symbol(),_e=({createSelector:e=s.createSelector}={})=>({name:Me,init(t,{baseQuery:u,tagTypes:l,reducerPath:p,serializeQueryArgs:S,keepUnusedDataFor:Q,refetchOnMountOrArgChange:k,refetchOnFocus:M,refetchOnReconnect:x,invalidationBehavior:D,onSchemaFailure:h,catchSchemaFailure:R,skipSchemaValidation:b},w){(0,H.enablePatches)();let P=q=>(typeof process<"u",q);Object.assign(t,{reducerPath:p,endpoints:{},internalActions:{onOnline:ae,onOffline:he,onFocus:ie,onFocusLost:Te},util:{}});let f=Bt({serializeQueryArgs:S,reducerPath:p,createSelector:e}),{selectInvalidatedBy:A,selectCachedArgsForQuery:B,buildQuerySelector:y,buildInfiniteQuerySelector:c,buildMutationSelector:i}=f;X(t.util,{selectInvalidatedBy:A,selectCachedArgsForQuery:B});let{queryThunk:T,infiniteQueryThunk:E,mutationThunk:g,patchQueryData:d,updateQueryData:a,upsertQueryData:n,prefetch:r,buildMatchThunkActions:o}=xt({baseQuery:u,reducerPath:p,context:w,api:t,serializeQueryArgs:S,assertTagType:P,selectors:f,onSchemaFailure:h,catchSchemaFailure:R,skipSchemaValidation:b}),{reducer:m,actions:F}=Et({context:w,queryThunk:T,infiniteQueryThunk:E,mutationThunk:g,serializeQueryArgs:S,reducerPath:p,assertTagType:P,config:{refetchOnFocus:M,refetchOnReconnect:x,refetchOnMountOrArgChange:k,keepUnusedDataFor:Q,reducerPath:p,invalidationBehavior:D}});X(t.util,{patchQueryData:d,updateQueryData:a,upsertQueryData:n,prefetch:r,resetApiState:F.resetApiState,upsertQueryEntries:F.cacheEntriesUpserted}),X(t.internalActions,F);let C=new WeakMap,N=q=>ye(C,q,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:v,buildInitiateInfiniteQuery:I,buildInitiateMutation:O,getRunningMutationThunk:_,getRunningMutationsThunk:$,getRunningQueriesThunk:G,getRunningQueryThunk:V}=Rt({queryThunk:T,mutationThunk:g,infiniteQueryThunk:E,api:t,serializeQueryArgs:S,context:w,getInternalState:N});X(t.util,{getRunningMutationThunk:_,getRunningMutationsThunk:$,getRunningQueryThunk:V,getRunningQueriesThunk:G});let{middleware:z,actions:j}=Vt({reducerPath:p,context:w,queryThunk:T,mutationThunk:g,infiniteQueryThunk:E,api:t,assertTagType:P,selectors:f,getRunningQueryThunk:V,getInternalState:N});return X(t.util,j),X(t,{reducer:m,middleware:z}),{name:Me,injectEndpoint(q,K){let L=t,U=L.endpoints[q]??={};pe(K)&&X(U,{name:q,select:y(q,K),initiate:v(q,K)},o(T,q)),Tt(K)&&X(U,{name:q,select:i(),initiate:O(q)},o(g,q)),de(K)&&X(U,{name:q,select:c(q,K),initiate:I(q,K)},o(T,q))}}}});var jt=Le(_e());0&&(module.exports={NamedSchemaError,QueryStatus,_NEVER,buildCreateApi,copyWithStructuralSharing,coreModule,coreModuleName,createApi,defaultSerializeQueryArgs,fakeBaseQuery,fetchBaseQuery,retry,setupListeners,skipToken});
+//# sourceMappingURL=rtk-query.production.min.cjs.map
Index: node_modules/@reduxjs/toolkit/dist/query/cjs/rtk-query.production.min.cjs.map
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/cjs/rtk-query.production.min.cjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/cjs/rtk-query.production.min.cjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,1 @@
+{"version":3,"sources":["../../../src/query/index.ts","../../../src/query/core/apiState.ts","../../../src/query/core/rtkImports.ts","../../../src/query/utils/copyWithStructuralSharing.ts","../../../src/query/utils/filterMap.ts","../../../src/query/utils/isAbsoluteUrl.ts","../../../src/query/utils/isDocumentVisible.ts","../../../src/query/utils/isNotNullish.ts","../../../src/query/utils/isOnline.ts","../../../src/query/utils/joinUrls.ts","../../../src/query/utils/getOrInsert.ts","../../../src/query/utils/signals.ts","../../../src/query/fetchBaseQuery.ts","../../../src/query/HandledError.ts","../../../src/query/retry.ts","../../../src/query/core/setupListeners.ts","../../../src/query/endpointDefinitions.ts","../../../src/query/utils/immerImports.ts","../../../src/query/core/buildInitiate.ts","../../../src/tsHelpers.ts","../../../src/query/apiTypes.ts","../../../src/query/standardSchema.ts","../../../src/query/core/buildThunks.ts","../../../src/query/utils/getCurrent.ts","../../../src/query/core/buildSlice.ts","../../../src/query/core/buildSelectors.ts","../../../src/query/createApi.ts","../../../src/query/defaultSerializeQueryArgs.ts","../../../src/query/fakeBaseQuery.ts","../../../src/query/tsHelpers.ts","../../../src/query/core/buildMiddleware/batchActions.ts","../../../src/query/core/buildMiddleware/cacheCollection.ts","../../../src/query/core/buildMiddleware/cacheLifecycle.ts","../../../src/query/core/buildMiddleware/devMiddleware.ts","../../../src/query/core/buildMiddleware/invalidationByTags.ts","../../../src/query/core/buildMiddleware/polling.ts","../../../src/query/core/buildMiddleware/queryLifecycle.ts","../../../src/query/core/buildMiddleware/windowEventHandling.ts","../../../src/query/core/buildMiddleware/index.ts","../../../src/query/core/module.ts","../../../src/query/core/index.ts"],"sourcesContent":["// This must remain here so that the `mangleErrors.cjs` build script\n// does not have to import this into each source file it rewrites.\nimport { formatProdErrorMessage } from '@reduxjs/toolkit';\nexport type { CombinedState, QueryCacheKey, QueryKeys, QuerySubState, RootState, SubscriptionOptions } from './core/apiState';\nexport { QueryStatus } from './core/apiState';\nexport type { Api, ApiContext, Module } from './apiTypes';\nexport type { BaseQueryApi, BaseQueryArg, BaseQueryEnhancer, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta, BaseQueryResult, QueryReturnValue } from './baseQueryTypes';\nexport type { BaseEndpointDefinition, EndpointDefinitions, EndpointDefinition, EndpointBuilder, QueryDefinition, MutationDefinition, MutationExtraOptions, InfiniteQueryArgFrom, InfiniteQueryDefinition, InfiniteQueryExtraOptions, PageParamFrom, TagDescription, QueryArgFrom, QueryExtraOptions, ResultTypeFrom, DefinitionType, DefinitionsFromApi, OverrideResultType, ResultDescription, TagTypesFromApi, UpdateDefinitions, SchemaFailureHandler, SchemaFailureConverter, SchemaFailureInfo, SchemaType } from './endpointDefinitions';\nexport { fetchBaseQuery } from './fetchBaseQuery';\nexport type { FetchBaseQueryArgs, FetchBaseQueryError, FetchBaseQueryMeta, FetchArgs } from './fetchBaseQuery';\nexport { retry } from './retry';\nexport type { RetryOptions } from './retry';\nexport { setupListeners } from './core/setupListeners';\nexport { skipToken } from './core/buildSelectors';\nexport type { QueryResultSelectorResult, MutationResultSelectorResult, SkipToken } from './core/buildSelectors';\nexport type { QueryActionCreatorResult, MutationActionCreatorResult, StartQueryActionCreatorOptions } from './core/buildInitiate';\nexport type { CreateApi, CreateApiOptions } from './createApi';\nexport { buildCreateApi } from './createApi';\nexport { _NEVER, fakeBaseQuery } from './fakeBaseQuery';\nexport { copyWithStructuralSharing } from './utils/copyWithStructuralSharing';\nexport { createApi, coreModule, coreModuleName } from './core/index';\nexport type { InfiniteData, InfiniteQueryActionCreatorResult, InfiniteQueryConfigOptions, InfiniteQueryResultSelectorResult, InfiniteQuerySubState, TypedMutationOnQueryStarted, TypedQueryOnQueryStarted } from './core/index';\nexport type { ApiEndpointMutation, ApiEndpointQuery, ApiEndpointInfiniteQuery, ApiModules, CoreModule, PrefetchOptions } from './core/module';\nexport { defaultSerializeQueryArgs } from './defaultSerializeQueryArgs';\nexport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nexport type { Id as TSHelpersId, NoInfer as TSHelpersNoInfer, Override as TSHelpersOverride } from './tsHelpers';\nexport { NamedSchemaError } from './standardSchema';","import type { SerializedError } from '@reduxjs/toolkit';\nimport type { BaseQueryError } from '../baseQueryTypes';\nimport type { BaseEndpointDefinition, EndpointDefinitions, FullTagDescription, InfiniteQueryDefinition, MutationDefinition, PageParamFrom, QueryArgFromAnyQuery, QueryDefinition, ResultTypeFrom } from '../endpointDefinitions';\nimport type { Id, WithRequiredProp } from '../tsHelpers';\nexport type QueryCacheKey = string & {\n  _type: 'queryCacheKey';\n};\nexport type QuerySubstateIdentifier = {\n  queryCacheKey: QueryCacheKey;\n};\nexport type MutationSubstateIdentifier = {\n  requestId: string;\n  fixedCacheKey?: string;\n} | {\n  requestId?: string;\n  fixedCacheKey: string;\n};\nexport type RefetchConfigOptions = {\n  refetchOnMountOrArgChange: boolean | number;\n  refetchOnReconnect: boolean;\n  refetchOnFocus: boolean;\n};\nexport type InfiniteQueryConfigOptions<DataType, PageParam, QueryArg> = {\n  /**\n   * The initial page parameter to use for the first page fetch.\n   */\n  initialPageParam: PageParam;\n  /**\n   * This function is required to automatically get the next cursor for infinite queries.\n   * The result will also be used to determine the value of `hasNextPage`.\n   */\n  getNextPageParam: (lastPage: DataType, allPages: Array<DataType>, lastPageParam: PageParam, allPageParams: Array<PageParam>, queryArg: QueryArg) => PageParam | undefined | null;\n  /**\n   * This function can be set to automatically get the previous cursor for infinite queries.\n   * The result will also be used to determine the value of `hasPreviousPage`.\n   */\n  getPreviousPageParam?: (firstPage: DataType, allPages: Array<DataType>, firstPageParam: PageParam, allPageParams: Array<PageParam>, queryArg: QueryArg) => PageParam | undefined | null;\n  /**\n   * If specified, only keep this many pages in cache at once.\n   * If additional pages are fetched, older pages in the other\n   * direction will be dropped from the cache.\n   */\n  maxPages?: number;\n  /**\n   * Defaults to `true`. When this is `true` and an infinite query endpoint is refetched\n   * (due to tag invalidation, polling, arg change configuration, or manual refetching),\n   * RTK Query will try to sequentially refetch all pages currently in the cache.\n   * When `false` only the first page will be refetched.\n   */\n  refetchCachedPages?: boolean;\n};\nexport type InfiniteData<DataType, PageParam> = {\n  pages: Array<DataType>;\n  pageParams: Array<PageParam>;\n};\n\n// NOTE: DO NOT import and use this for runtime comparisons internally,\n// except in the RTKQ React package. Use the string versions just below this.\n// ESBuild auto-inlines TS enums, which bloats our bundle with many repeated\n// constants like \"initialized\":\n// https://github.com/evanw/esbuild/releases/tag/v0.14.7\n// We still have to use this in the React package since we don't publicly export\n// the string constants below.\n/**\n * Strings describing the query state at any given time.\n */\nexport enum QueryStatus {\n  uninitialized = 'uninitialized',\n  pending = 'pending',\n  fulfilled = 'fulfilled',\n  rejected = 'rejected',\n}\n\n// Use these string constants for runtime comparisons internally\nexport const STATUS_UNINITIALIZED = QueryStatus.uninitialized;\nexport const STATUS_PENDING = QueryStatus.pending;\nexport const STATUS_FULFILLED = QueryStatus.fulfilled;\nexport const STATUS_REJECTED = QueryStatus.rejected;\nexport type RequestStatusFlags = {\n  status: QueryStatus.uninitialized;\n  isUninitialized: true;\n  isLoading: false;\n  isSuccess: false;\n  isError: false;\n} | {\n  status: QueryStatus.pending;\n  isUninitialized: false;\n  isLoading: true;\n  isSuccess: false;\n  isError: false;\n} | {\n  status: QueryStatus.fulfilled;\n  isUninitialized: false;\n  isLoading: false;\n  isSuccess: true;\n  isError: false;\n} | {\n  status: QueryStatus.rejected;\n  isUninitialized: false;\n  isLoading: false;\n  isSuccess: false;\n  isError: true;\n};\nexport function getRequestStatusFlags(status: QueryStatus): RequestStatusFlags {\n  return {\n    status,\n    isUninitialized: status === STATUS_UNINITIALIZED,\n    isLoading: status === STATUS_PENDING,\n    isSuccess: status === STATUS_FULFILLED,\n    isError: status === STATUS_REJECTED\n  } as any;\n}\n\n/**\n * @public\n */\nexport type SubscriptionOptions = {\n  /**\n   * How frequently to automatically re-fetch data (in milliseconds). Defaults to `0` (off).\n   */\n  pollingInterval?: number;\n  /**\n   *  Defaults to 'false'. This setting allows you to control whether RTK Query will continue polling if the window is not focused.\n   *\n   *  If pollingInterval is not set or set to 0, this **will not be evaluated** until pollingInterval is greater than 0.\n   *\n   *  Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  skipPollingIfUnfocused?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after regaining a network connection.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnReconnect?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after the application window regains focus.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnFocus?: boolean;\n};\nexport type SubscribersInternal = Map<string, SubscriptionOptions>;\nexport type Subscribers = {\n  [requestId: string]: SubscriptionOptions;\n};\nexport type QueryKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any> ? K : never }[keyof Definitions];\nexport type InfiniteQueryKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? K : never }[keyof Definitions];\nexport type MutationKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends MutationDefinition<any, any, any, any> ? K : never }[keyof Definitions];\ntype BaseQuerySubState<D extends BaseEndpointDefinition<any, any, any, any>, DataType = ResultTypeFrom<D>> = {\n  /**\n   * The argument originally passed into the hook or `initiate` action call\n   */\n  originalArgs: QueryArgFromAnyQuery<D>;\n  /**\n   * A unique ID associated with the request\n   */\n  requestId: string;\n  /**\n   * The received data from the query\n   */\n  data?: DataType;\n  /**\n   * The received error if applicable\n   */\n  error?: SerializedError | (D extends QueryDefinition<any, infer BaseQuery, any, any> ? BaseQueryError<BaseQuery> : never);\n  /**\n   * The name of the endpoint associated with the query\n   */\n  endpointName: string;\n  /**\n   * Time that the latest query started\n   */\n  startedTimeStamp: number;\n  /**\n   * Time that the latest query was fulfilled\n   */\n  fulfilledTimeStamp?: number;\n};\nexport type QuerySubState<D extends BaseEndpointDefinition<any, any, any, any>, DataType = ResultTypeFrom<D>> = Id<({\n  status: QueryStatus.fulfilled;\n} & WithRequiredProp<BaseQuerySubState<D, DataType>, 'data' | 'fulfilledTimeStamp'> & {\n  error: undefined;\n}) | ({\n  status: QueryStatus.pending;\n} & BaseQuerySubState<D, DataType>) | ({\n  status: QueryStatus.rejected;\n} & WithRequiredProp<BaseQuerySubState<D, DataType>, 'error'>) | {\n  status: QueryStatus.uninitialized;\n  originalArgs?: undefined;\n  data?: undefined;\n  error?: undefined;\n  requestId?: undefined;\n  endpointName?: string;\n  startedTimeStamp?: undefined;\n  fulfilledTimeStamp?: undefined;\n}>;\nexport type InfiniteQueryDirection = 'forward' | 'backward';\nexport type InfiniteQuerySubState<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any> ? QuerySubState<D, InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>> & {\n  direction?: InfiniteQueryDirection;\n} : never;\ntype BaseMutationSubState<D extends BaseEndpointDefinition<any, any, any, any>> = {\n  requestId: string;\n  data?: ResultTypeFrom<D>;\n  error?: SerializedError | (D extends MutationDefinition<any, infer BaseQuery, any, any> ? BaseQueryError<BaseQuery> : never);\n  endpointName: string;\n  startedTimeStamp: number;\n  fulfilledTimeStamp?: number;\n};\nexport type MutationSubState<D extends BaseEndpointDefinition<any, any, any, any>> = (({\n  status: QueryStatus.fulfilled;\n} & WithRequiredProp<BaseMutationSubState<D>, 'data' | 'fulfilledTimeStamp'>) & {\n  error: undefined;\n}) | (({\n  status: QueryStatus.pending;\n} & BaseMutationSubState<D>) & {\n  data?: undefined;\n}) | ({\n  status: QueryStatus.rejected;\n} & WithRequiredProp<BaseMutationSubState<D>, 'error'>) | {\n  requestId?: undefined;\n  status: QueryStatus.uninitialized;\n  data?: undefined;\n  error?: undefined;\n  endpointName?: string;\n  startedTimeStamp?: undefined;\n  fulfilledTimeStamp?: undefined;\n};\nexport type CombinedState<D extends EndpointDefinitions, E extends string, ReducerPath extends string> = {\n  queries: QueryState<D>;\n  mutations: MutationState<D>;\n  provided: InvalidationState<E>;\n  subscriptions: SubscriptionState;\n  config: ConfigState<ReducerPath>;\n};\nexport type InvalidationState<TagTypes extends string> = {\n  tags: { [_ in TagTypes]: {\n    [id: string]: Array<QueryCacheKey>;\n    [id: number]: Array<QueryCacheKey>;\n  } };\n  keys: Record<QueryCacheKey, Array<FullTagDescription<any>>>;\n};\nexport type QueryState<D extends EndpointDefinitions> = {\n  [queryCacheKey: string]: QuerySubState<D[string]> | InfiniteQuerySubState<D[string]> | undefined;\n};\nexport type SubscriptionInternalState = Map<string, SubscribersInternal>;\nexport type SubscriptionState = {\n  [queryCacheKey: string]: Subscribers | undefined;\n};\nexport type ConfigState<ReducerPath> = RefetchConfigOptions & {\n  reducerPath: ReducerPath;\n  online: boolean;\n  focused: boolean;\n  middlewareRegistered: boolean | 'conflict';\n} & ModifiableConfigState;\nexport type ModifiableConfigState = {\n  keepUnusedDataFor: number;\n  invalidationBehavior: 'delayed' | 'immediately';\n} & RefetchConfigOptions;\nexport type MutationState<D extends EndpointDefinitions> = {\n  [requestId: string]: MutationSubState<D[string]> | undefined;\n};\nexport type RootState<Definitions extends EndpointDefinitions, TagTypes extends string, ReducerPath extends string> = { [P in ReducerPath]: CombinedState<Definitions, TagTypes, P> };","// This file exists to consolidate all of the imports from the `@reduxjs/toolkit` package.\n// ESBuild does not de-duplicate imports, so this file is used to ensure that each method\n// imported is only listed once, and there's only one mention of the `@reduxjs/toolkit` package.\n\nexport { createAction, createSlice, createSelector, createAsyncThunk, combineReducers, createNextState, isAnyOf, isAllOf, isAction, isPending, isRejected, isFulfilled, isRejectedWithValue, isAsyncThunkAction, prepareAutoBatched, SHOULD_AUTOBATCH, isPlainObject, nanoid } from '@reduxjs/toolkit';","import { isPlainObject as _iPO } from '../core/rtkImports';\n\n// remove type guard\nconst isPlainObject: (_: any) => boolean = _iPO;\nexport function copyWithStructuralSharing<T>(oldObj: any, newObj: T): T;\nexport function copyWithStructuralSharing(oldObj: any, newObj: any): any {\n  if (oldObj === newObj || !(isPlainObject(oldObj) && isPlainObject(newObj) || Array.isArray(oldObj) && Array.isArray(newObj))) {\n    return newObj;\n  }\n  const newKeys = Object.keys(newObj);\n  const oldKeys = Object.keys(oldObj);\n  let isSameObject = newKeys.length === oldKeys.length;\n  const mergeObj: any = Array.isArray(newObj) ? [] : {};\n  for (const key of newKeys) {\n    mergeObj[key] = copyWithStructuralSharing(oldObj[key], newObj[key]);\n    if (isSameObject) isSameObject = oldObj[key] === mergeObj[key];\n  }\n  return isSameObject ? oldObj : mergeObj;\n}","// Preserve type guard predicate behavior when passing to mapper\nexport function filterMap<T, U, S extends T = T>(array: readonly T[], predicate: (item: T, index: number) => item is S, mapper: (item: S, index: number) => U | U[]): U[];\nexport function filterMap<T, U>(array: readonly T[], predicate: (item: T, index: number) => boolean, mapper: (item: T, index: number) => U | U[]): U[];\nexport function filterMap<T, U>(array: readonly T[], predicate: (item: T, index: number) => boolean, mapper: (item: T, index: number) => U | U[]): U[] {\n  return array.reduce<(U | U[])[]>((acc, item, i) => {\n    if (predicate(item as any, i)) {\n      acc.push(mapper(item as any, i));\n    }\n    return acc;\n  }, []).flat() as U[];\n}","/**\n * If either :// or // is present consider it to be an absolute url\n *\n * @param url string\n */\n\nexport function isAbsoluteUrl(url: string) {\n  return new RegExp(`(^|:)//`).test(url);\n}","/**\n * Assumes true for a non-browser env, otherwise makes a best effort\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState\n */\nexport function isDocumentVisible(): boolean {\n  // `document` may not exist in non-browser envs (like RN)\n  if (typeof document === 'undefined') {\n    return true;\n  }\n  // Match true for visible, prerender, undefined\n  return document.visibilityState !== 'hidden';\n}","export function isNotNullish<T>(v: T | null | undefined): v is T {\n  return v != null;\n}\nexport function filterNullishValues<T>(map?: Map<any, T>) {\n  return [...(map?.values() ?? [])].filter(isNotNullish) as NonNullable<T>[];\n}","/**\n * Assumes a browser is online if `undefined`, otherwise makes a best effort\n * @link https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine\n */\nexport function isOnline() {\n  // We set the default config value in the store, so we'd need to check for this in a SSR env\n  return typeof navigator === 'undefined' ? true : navigator.onLine === undefined ? true : navigator.onLine;\n}","import { isAbsoluteUrl } from './isAbsoluteUrl';\nconst withoutTrailingSlash = (url: string) => url.replace(/\\/$/, '');\nconst withoutLeadingSlash = (url: string) => url.replace(/^\\//, '');\nexport function joinUrls(base: string | undefined, url: string | undefined): string {\n  if (!base) {\n    return url!;\n  }\n  if (!url) {\n    return base;\n  }\n  if (isAbsoluteUrl(url)) {\n    return url;\n  }\n  const delimiter = base.endsWith('/') || !url.startsWith('?') ? '/' : '';\n  base = withoutTrailingSlash(base);\n  url = withoutLeadingSlash(url);\n  return `${base}${delimiter}${url}`;\n}","// Duplicate some of the utils in `/src/utils` to ensure\n// we don't end up dragging in larger chunks of the RTK core\n// into the RTKQ bundle\n\nexport function getOrInsert<K extends object, V>(map: WeakMap<K, V>, key: K, value: V): V;\nexport function getOrInsert<K, V>(map: Map<K, V>, key: K, value: V): V;\nexport function getOrInsert<K extends object, V>(map: Map<K, V> | WeakMap<K, V>, key: K, value: V): V {\n  if (map.has(key)) return map.get(key) as V;\n  return map.set(key, value).get(key) as V;\n}\nexport function getOrInsertComputed<K extends object, V>(map: WeakMap<K, V>, key: K, compute: (key: K) => V): V;\nexport function getOrInsertComputed<K, V>(map: Map<K, V>, key: K, compute: (key: K) => V): V;\nexport function getOrInsertComputed<K extends object, V>(map: Map<K, V> | WeakMap<K, V>, key: K, compute: (key: K) => V): V {\n  if (map.has(key)) return map.get(key) as V;\n  return map.set(key, compute(key)).get(key) as V;\n}\nexport const createNewMap = () => new Map();","// AbortSignal.timeout() is currently baseline 2024\nexport const timeoutSignal = (milliseconds: number) => {\n  const abortController = new AbortController();\n  setTimeout(() => {\n    const message = 'signal timed out';\n    const name = 'TimeoutError';\n    abortController.abort(\n    // some environments (React Native, Node) don't have DOMException\n    typeof DOMException !== 'undefined' ? new DOMException(message, name) : Object.assign(new Error(message), {\n      name\n    }));\n  }, milliseconds);\n  return abortController.signal;\n};\n\n// AbortSignal.any() is currently baseline 2024\nexport const anySignal = (...signals: AbortSignal[]) => {\n  // if any are already aborted, return an already aborted signal\n  for (const signal of signals) if (signal.aborted) return AbortSignal.abort(signal.reason);\n\n  // otherwise, create a new signal that aborts when any of the given signals abort\n  const abortController = new AbortController();\n  for (const signal of signals) {\n    signal.addEventListener('abort', () => abortController.abort(signal.reason), {\n      signal: abortController.signal,\n      once: true\n    });\n  }\n  return abortController.signal;\n};","import { joinUrls } from './utils';\nimport { isPlainObject } from './core/rtkImports';\nimport type { BaseQueryApi, BaseQueryFn } from './baseQueryTypes';\nimport type { MaybePromise, Override } from './tsHelpers';\nimport { anySignal, timeoutSignal } from './utils/signals';\nexport type ResponseHandler = 'content-type' | 'json' | 'text' | ((response: Response) => Promise<any>);\ntype CustomRequestInit = Override<RequestInit, {\n  headers?: Headers | string[][] | Record<string, string | undefined> | undefined;\n}>;\nexport interface FetchArgs extends CustomRequestInit {\n  url: string;\n  params?: Record<string, any>;\n  body?: any;\n  responseHandler?: ResponseHandler;\n  validateStatus?: (response: Response, body: any) => boolean;\n  /**\n   * A number in milliseconds that represents that maximum time a request can take before timing out.\n   */\n  timeout?: number;\n}\n\n/**\n * A mini-wrapper that passes arguments straight through to\n * {@link [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)}.\n * Avoids storing `fetch` in a closure, in order to permit mocking/monkey-patching.\n */\nconst defaultFetchFn: typeof fetch = (...args) => fetch(...args);\nconst defaultValidateStatus = (response: Response) => response.status >= 200 && response.status <= 299;\nconst defaultIsJsonContentType = (headers: Headers) => /*applicat*//ion\\/(vnd\\.api\\+)?json/.test(headers.get('content-type') || '');\nexport type FetchBaseQueryError = {\n  /**\n   * * `number`:\n   *   HTTP status code\n   */\n  status: number;\n  data: unknown;\n} | {\n  /**\n   * * `\"FETCH_ERROR\"`:\n   *   An error that occurred during execution of `fetch` or the `fetchFn` callback option\n   **/\n  status: 'FETCH_ERROR';\n  data?: undefined;\n  error: string;\n} | {\n  /**\n   * * `\"PARSING_ERROR\"`:\n   *   An error happened during parsing.\n   *   Most likely a non-JSON-response was returned with the default `responseHandler` \"JSON\",\n   *   or an error occurred while executing a custom `responseHandler`.\n   **/\n  status: 'PARSING_ERROR';\n  originalStatus: number;\n  data: string;\n  error: string;\n} | {\n  /**\n   * * `\"TIMEOUT_ERROR\"`:\n   *   Request timed out\n   **/\n  status: 'TIMEOUT_ERROR';\n  data?: undefined;\n  error: string;\n} | {\n  /**\n   * * `\"CUSTOM_ERROR\"`:\n   *   A custom error type that you can return from your `queryFn` where another error might not make sense.\n   **/\n  status: 'CUSTOM_ERROR';\n  data?: unknown;\n  error: string;\n};\nfunction stripUndefined(obj: any) {\n  if (!isPlainObject(obj)) {\n    return obj;\n  }\n  const copy: Record<string, any> = {\n    ...obj\n  };\n  for (const [k, v] of Object.entries(copy)) {\n    if (v === undefined) delete copy[k];\n  }\n  return copy;\n}\n\n// Only set the content-type to json if appropriate. Will not be true for FormData, ArrayBuffer, Blob, etc.\nconst isJsonifiable = (body: any) => typeof body === 'object' && (isPlainObject(body) || Array.isArray(body) || typeof body.toJSON === 'function');\nexport type FetchBaseQueryArgs = {\n  baseUrl?: string;\n  prepareHeaders?: (headers: Headers, api: Pick<BaseQueryApi, 'getState' | 'extra' | 'endpoint' | 'type' | 'forced'> & {\n    arg: string | FetchArgs;\n    extraOptions: unknown;\n  }) => MaybePromise<Headers | void>;\n  fetchFn?: (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;\n  paramsSerializer?: (params: Record<string, any>) => string;\n  /**\n   * By default, we only check for 'application/json' and 'application/vnd.api+json' as the content-types for json. If you need to support another format, you can pass\n   * in a predicate function for your given api to get the same automatic stringifying behavior\n   * @example\n   * ```ts\n   * const isJsonContentType = (headers: Headers) => [\"application/vnd.api+json\", \"application/json\", \"application/vnd.hal+json\"].includes(headers.get(\"content-type\")?.trim());\n   * ```\n   */\n  isJsonContentType?: (headers: Headers) => boolean;\n  /**\n   * Defaults to `application/json`;\n   */\n  jsonContentType?: string;\n\n  /**\n   * Custom replacer function used when calling `JSON.stringify()`;\n   */\n  jsonReplacer?: (this: any, key: string, value: any) => any;\n} & RequestInit & Pick<FetchArgs, 'responseHandler' | 'validateStatus' | 'timeout'>;\nexport type FetchBaseQueryMeta = {\n  request: Request;\n  response?: Response;\n};\n\n/**\n * This is a very small wrapper around fetch that aims to simplify requests.\n *\n * @example\n * ```ts\n * const baseQuery = fetchBaseQuery({\n *   baseUrl: 'https://api.your-really-great-app.com/v1/',\n *   prepareHeaders: (headers, { getState }) => {\n *     const token = (getState() as RootState).auth.token;\n *     // If we have a token set in state, let's assume that we should be passing it.\n *     if (token) {\n *       headers.set('authorization', `Bearer ${token}`);\n *     }\n *     return headers;\n *   },\n * })\n * ```\n *\n * @param {string} baseUrl\n * The base URL for an API service.\n * Typically in the format of https://example.com/\n *\n * @param {(headers: Headers, api: { getState: () => unknown; arg: string | FetchArgs; extra: unknown; endpoint: string; type: 'query' | 'mutation'; forced: boolean; }) => Headers} prepareHeaders\n * An optional function that can be used to inject headers on requests.\n * Provides a Headers object, most of the `BaseQueryApi` (`dispatch` is not available), and the arg passed into the query function.\n * Useful for setting authentication or headers that need to be set conditionally.\n *\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Headers\n *\n * @param {(input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>} fetchFn\n * Accepts a custom `fetch` function if you do not want to use the default on the window.\n * Useful in SSR environments if you need to use a library such as `isomorphic-fetch` or `cross-fetch`\n *\n * @param {(params: Record<string, unknown>) => string} paramsSerializer\n * An optional function that can be used to stringify querystring parameters.\n *\n * @param {(headers: Headers) => boolean} isJsonContentType\n * An optional predicate function to determine if `JSON.stringify()` should be called on the `body` arg of `FetchArgs`\n *\n * @param {string} jsonContentType Used when automatically setting the content-type header for a request with a jsonifiable body that does not have an explicit content-type header. Defaults to `application/json`.\n *\n * @param {(this: any, key: string, value: any) => any} jsonReplacer Custom replacer function used when calling `JSON.stringify()`.\n *\n * @param {number} timeout\n * A number in milliseconds that represents the maximum time a request can take before timing out.\n */\n\nexport function fetchBaseQuery({\n  baseUrl,\n  prepareHeaders = x => x,\n  fetchFn = defaultFetchFn,\n  paramsSerializer,\n  isJsonContentType = defaultIsJsonContentType,\n  jsonContentType = 'application/json',\n  jsonReplacer,\n  timeout: defaultTimeout,\n  responseHandler: globalResponseHandler,\n  validateStatus: globalValidateStatus,\n  ...baseFetchOptions\n}: FetchBaseQueryArgs = {}): BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta> {\n  if (typeof fetch === 'undefined' && fetchFn === defaultFetchFn) {\n    console.warn('Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments.');\n  }\n  return async (arg, api, extraOptions) => {\n    const {\n      getState,\n      extra,\n      endpoint,\n      forced,\n      type\n    } = api;\n    let meta: FetchBaseQueryMeta | undefined;\n    let {\n      url,\n      headers = new Headers(baseFetchOptions.headers),\n      params = undefined,\n      responseHandler = globalResponseHandler ?? 'json' as const,\n      validateStatus = globalValidateStatus ?? defaultValidateStatus,\n      timeout = defaultTimeout,\n      ...rest\n    } = typeof arg == 'string' ? {\n      url: arg\n    } : arg;\n    let config: RequestInit = {\n      ...baseFetchOptions,\n      signal: timeout ? anySignal(api.signal, timeoutSignal(timeout)) : api.signal,\n      ...rest\n    };\n    headers = new Headers(stripUndefined(headers));\n    config.headers = (await prepareHeaders(headers, {\n      getState,\n      arg,\n      extra,\n      endpoint,\n      forced,\n      type,\n      extraOptions\n    })) || headers;\n    const bodyIsJsonifiable = isJsonifiable(config.body);\n\n    // Remove content-type for non-jsonifiable bodies to let the browser set it automatically\n    // Exception: keep content-type for string bodies as they might be intentional (text/plain, text/html, etc.)\n    if (config.body != null && !bodyIsJsonifiable && typeof config.body !== 'string') {\n      config.headers.delete('content-type');\n    }\n    if (!config.headers.has('content-type') && bodyIsJsonifiable) {\n      config.headers.set('content-type', jsonContentType);\n    }\n    if (bodyIsJsonifiable && isJsonContentType(config.headers)) {\n      config.body = JSON.stringify(config.body, jsonReplacer);\n    }\n\n    // Set Accept header based on responseHandler if not already set\n    if (!config.headers.has('accept')) {\n      if (responseHandler === 'json') {\n        config.headers.set('accept', 'application/json');\n      } else if (responseHandler === 'text') {\n        config.headers.set('accept', 'text/plain, text/html, */*');\n      }\n      // For 'content-type' responseHandler, don't set Accept (let server decide)\n    }\n    if (params) {\n      const divider = ~url.indexOf('?') ? '&' : '?';\n      const query = paramsSerializer ? paramsSerializer(params) : new URLSearchParams(stripUndefined(params));\n      url += divider + query;\n    }\n    url = joinUrls(baseUrl, url);\n    const request = new Request(url, config);\n    const requestClone = new Request(url, config);\n    meta = {\n      request: requestClone\n    };\n    let response;\n    try {\n      response = await fetchFn(request);\n    } catch (e) {\n      return {\n        error: {\n          status: (e instanceof Error || typeof DOMException !== 'undefined' && e instanceof DOMException) && e.name === 'TimeoutError' ? 'TIMEOUT_ERROR' : 'FETCH_ERROR',\n          error: String(e)\n        },\n        meta\n      };\n    }\n    const responseClone = response.clone();\n    meta.response = responseClone;\n    let resultData: any;\n    let responseText: string = '';\n    try {\n      let handleResponseError;\n      await Promise.all([handleResponse(response, responseHandler).then(r => resultData = r, e => handleResponseError = e),\n      // see https://github.com/node-fetch/node-fetch/issues/665#issuecomment-538995182\n      // we *have* to \"use up\" both streams at the same time or they will stop running in node-fetch scenarios\n      responseClone.text().then(r => responseText = r, () => {})]);\n      if (handleResponseError) throw handleResponseError;\n    } catch (e) {\n      return {\n        error: {\n          status: 'PARSING_ERROR',\n          originalStatus: response.status,\n          data: responseText,\n          error: String(e)\n        },\n        meta\n      };\n    }\n    return validateStatus(response, resultData) ? {\n      data: resultData,\n      meta\n    } : {\n      error: {\n        status: response.status,\n        data: resultData\n      },\n      meta\n    };\n  };\n  async function handleResponse(response: Response, responseHandler: ResponseHandler) {\n    if (typeof responseHandler === 'function') {\n      return responseHandler(response);\n    }\n    if (responseHandler === 'content-type') {\n      responseHandler = isJsonContentType(response.headers) ? 'json' : 'text';\n    }\n    if (responseHandler === 'json') {\n      const text = await response.text();\n      return text.length ? JSON.parse(text) : null;\n    }\n    return response.text();\n  }\n}","export class HandledError {\n  constructor(public readonly value: any, public readonly meta: any = undefined) {}\n}","import type { BaseQueryApi, BaseQueryArg, BaseQueryEnhancer, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta } from './baseQueryTypes';\nimport type { FetchBaseQueryError } from './fetchBaseQuery';\nimport { HandledError } from './HandledError';\n\n/**\n * Exponential backoff based on the attempt number.\n *\n * @remarks\n * 1. 600ms * random(0.4, 1.4)\n * 2. 1200ms * random(0.4, 1.4)\n * 3. 2400ms * random(0.4, 1.4)\n * 4. 4800ms * random(0.4, 1.4)\n * 5. 9600ms * random(0.4, 1.4)\n *\n * @param attempt - Current attempt\n * @param maxRetries - Maximum number of retries\n */\nasync function defaultBackoff(attempt: number = 0, maxRetries: number = 5, signal?: AbortSignal) {\n  const attempts = Math.min(attempt, maxRetries);\n  const timeout = ~~((Math.random() + 0.4) * (300 << attempts)); // Force a positive int in the case we make this an option\n\n  await new Promise<void>((resolve, reject) => {\n    const timeoutId = setTimeout(() => resolve(), timeout);\n\n    // If signal is provided and gets aborted, clear timeout and reject\n    if (signal) {\n      const abortHandler = () => {\n        clearTimeout(timeoutId);\n        reject(new Error('Aborted'));\n      };\n\n      // Check if already aborted\n      if (signal.aborted) {\n        clearTimeout(timeoutId);\n        reject(new Error('Aborted'));\n      } else {\n        signal.addEventListener('abort', abortHandler, {\n          once: true\n        });\n      }\n    }\n  });\n}\ntype RetryConditionFunction = (error: BaseQueryError<BaseQueryFn>, args: BaseQueryArg<BaseQueryFn>, extraArgs: {\n  attempt: number;\n  baseQueryApi: BaseQueryApi;\n  extraOptions: BaseQueryExtraOptions<BaseQueryFn> & RetryOptions;\n}) => boolean;\nexport type RetryOptions = {\n  /**\n   * Function used to determine delay between retries\n   */\n  backoff?: (attempt: number, maxRetries: number, signal?: AbortSignal) => Promise<void>;\n} & ({\n  /**\n   * How many times the query will be retried (default: 5)\n   */\n  maxRetries?: number;\n  retryCondition?: undefined;\n} | {\n  /**\n   * Callback to determine if a retry should be attempted.\n   * Return `true` for another retry and `false` to quit trying prematurely.\n   */\n  retryCondition?: RetryConditionFunction;\n  maxRetries?: undefined;\n});\nfunction fail<BaseQuery extends BaseQueryFn = BaseQueryFn>(error: BaseQueryError<BaseQuery>, meta?: BaseQueryMeta<BaseQuery>): never {\n  throw Object.assign(new HandledError({\n    error,\n    meta\n  }), {\n    throwImmediately: true\n  });\n}\n\n/**\n * Checks if the abort signal is aborted and fails immediately if so.\n * Used to exit retry loops cleanly when a request is aborted.\n */\nfunction failIfAborted(signal: AbortSignal): void {\n  if (signal.aborted) {\n    fail({\n      status: 'CUSTOM_ERROR',\n      error: 'Aborted'\n    });\n  }\n}\nconst EMPTY_OPTIONS = {};\nconst retryWithBackoff: BaseQueryEnhancer<unknown, RetryOptions, RetryOptions | void> = (baseQuery, defaultOptions) => async (args, api, extraOptions) => {\n  // We need to figure out `maxRetries` before we define `defaultRetryCondition.\n  // This is probably goofy, but ought to work.\n  // Put our defaults in one array, filter out undefineds, grab the last value.\n  const possibleMaxRetries: number[] = [5, (defaultOptions as any || EMPTY_OPTIONS).maxRetries, (extraOptions as any || EMPTY_OPTIONS).maxRetries].filter(x => x !== undefined);\n  const [maxRetries] = possibleMaxRetries.slice(-1);\n  const defaultRetryCondition: RetryConditionFunction = (_, __, {\n    attempt\n  }) => attempt <= maxRetries;\n  const options: {\n    maxRetries: number;\n    backoff: typeof defaultBackoff;\n    retryCondition: typeof defaultRetryCondition;\n  } = {\n    maxRetries,\n    backoff: defaultBackoff,\n    retryCondition: defaultRetryCondition,\n    ...defaultOptions,\n    ...extraOptions\n  };\n  let retry = 0;\n  while (true) {\n    // Check if aborted before each attempt\n    failIfAborted(api.signal);\n    try {\n      const result = await baseQuery(args, api, extraOptions);\n      // baseQueries _should_ return an error property, so we should check for that and throw it to continue retrying\n      if (result.error) {\n        throw new HandledError(result);\n      }\n      return result;\n    } catch (e: any) {\n      retry++;\n      if (e.throwImmediately) {\n        if (e instanceof HandledError) {\n          return e.value;\n        }\n\n        // We don't know what this is, so we have to rethrow it\n        throw e;\n      }\n      if (e instanceof HandledError) {\n        if (!options.retryCondition(e.value.error as FetchBaseQueryError, args, {\n          attempt: retry,\n          baseQueryApi: api,\n          extraOptions\n        })) {\n          return e.value; // Max retries for expected error\n        }\n      } else {\n        // For unexpected errors, respect maxRetries\n        if (retry > options.maxRetries) {\n          // Return the error as a proper error response instead of throwing\n          return {\n            error: e\n          };\n        }\n      }\n\n      // Check if aborted before backoff\n      failIfAborted(api.signal);\n      try {\n        await options.backoff(retry, options.maxRetries, api.signal);\n      } catch (backoffError) {\n        // If backoff was aborted, exit the retry loop\n        failIfAborted(api.signal);\n        // Otherwise, rethrow the backoff error\n        throw backoffError;\n      }\n    }\n  }\n};\n\n/**\n * A utility that can wrap `baseQuery` in the API definition to provide retries with a basic exponential backoff.\n *\n * @example\n *\n * ```ts\n * // codeblock-meta title=\"Retry every request 5 times by default\"\n * import { createApi, fetchBaseQuery, retry } from '@reduxjs/toolkit/query/react'\n * interface Post {\n *   id: number\n *   name: string\n * }\n * type PostsResponse = Post[]\n *\n * // maxRetries: 5 is the default, and can be omitted. Shown for documentation purposes.\n * const staggeredBaseQuery = retry(fetchBaseQuery({ baseUrl: '/' }), { maxRetries: 5 });\n * export const api = createApi({\n *   baseQuery: staggeredBaseQuery,\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsResponse, void>({\n *       query: () => ({ url: 'posts' }),\n *     }),\n *     getPost: build.query<PostsResponse, string>({\n *       query: (id) => ({ url: `post/${id}` }),\n *       extraOptions: { maxRetries: 8 }, // You can override the retry behavior on each endpoint\n *     }),\n *   }),\n * });\n *\n * export const { useGetPostsQuery, useGetPostQuery } = api;\n * ```\n */\nexport const retry = /* @__PURE__ */Object.assign(retryWithBackoff, {\n  fail\n});","import type { ThunkDispatch, ActionCreatorWithoutPayload // Workaround for API-Extractor\n} from '@reduxjs/toolkit';\nimport { createAction } from './rtkImports';\nexport const INTERNAL_PREFIX = '__rtkq/';\nconst ONLINE = 'online';\nconst OFFLINE = 'offline';\nconst FOCUS = 'focus';\nconst FOCUSED = 'focused';\nconst VISIBILITYCHANGE = 'visibilitychange';\nexport const onFocus = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${FOCUSED}`);\nexport const onFocusLost = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}un${FOCUSED}`);\nexport const onOnline = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${ONLINE}`);\nexport const onOffline = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${OFFLINE}`);\nconst actions = {\n  onFocus,\n  onFocusLost,\n  onOnline,\n  onOffline\n};\nlet initialized = false;\n\n/**\n * A utility used to enable `refetchOnMount` and `refetchOnReconnect` behaviors.\n * It requires the dispatch method from your store.\n * Calling `setupListeners(store.dispatch)` will configure listeners with the recommended defaults,\n * but you have the option of providing a callback for more granular control.\n *\n * @example\n * ```ts\n * setupListeners(store.dispatch)\n * ```\n *\n * @param dispatch - The dispatch method from your store\n * @param customHandler - An optional callback for more granular control over listener behavior\n * @returns Return value of the handler.\n * The default handler returns an `unsubscribe` method that can be called to remove the listeners.\n */\nexport function setupListeners(dispatch: ThunkDispatch<any, any, any>, customHandler?: (dispatch: ThunkDispatch<any, any, any>, actions: {\n  onFocus: typeof onFocus;\n  onFocusLost: typeof onFocusLost;\n  onOnline: typeof onOnline;\n  onOffline: typeof onOffline;\n}) => () => void) {\n  function defaultHandler() {\n    const [handleFocus, handleFocusLost, handleOnline, handleOffline] = [onFocus, onFocusLost, onOnline, onOffline].map(action => () => dispatch(action()));\n    const handleVisibilityChange = () => {\n      if (window.document.visibilityState === 'visible') {\n        handleFocus();\n      } else {\n        handleFocusLost();\n      }\n    };\n    let unsubscribe = () => {\n      initialized = false;\n    };\n    if (!initialized) {\n      if (typeof window !== 'undefined' && window.addEventListener) {\n        const handlers = {\n          [FOCUS]: handleFocus,\n          [VISIBILITYCHANGE]: handleVisibilityChange,\n          [ONLINE]: handleOnline,\n          [OFFLINE]: handleOffline\n        };\n        function updateListeners(add: boolean) {\n          Object.entries(handlers).forEach(([event, handler]) => {\n            if (add) {\n              window.addEventListener(event, handler, false);\n            } else {\n              window.removeEventListener(event, handler);\n            }\n          });\n        }\n        // Handle focus events\n        updateListeners(true);\n        initialized = true;\n        unsubscribe = () => {\n          updateListeners(false);\n          initialized = false;\n        };\n      }\n    }\n    return unsubscribe;\n  }\n  return customHandler ? customHandler(dispatch, actions) : defaultHandler();\n}","import type { Api } from '@reduxjs/toolkit/query';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { BaseQueryApi, BaseQueryArg, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta, BaseQueryResult, QueryReturnValue } from './baseQueryTypes';\nimport type { CacheCollectionQueryExtraOptions } from './core/buildMiddleware/cacheCollection';\nimport type { CacheLifecycleInfiniteQueryExtraOptions, CacheLifecycleMutationExtraOptions, CacheLifecycleQueryExtraOptions } from './core/buildMiddleware/cacheLifecycle';\nimport type { QueryLifecycleInfiniteQueryExtraOptions, QueryLifecycleMutationExtraOptions, QueryLifecycleQueryExtraOptions } from './core/buildMiddleware/queryLifecycle';\nimport type { InfiniteData, InfiniteQueryConfigOptions, QuerySubState, RootState } from './core/index';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { NEVER } from './fakeBaseQuery';\nimport type { CastAny, HasRequiredProps, MaybePromise, NonUndefined, OmitFromUnion, UnwrapPromise } from './tsHelpers';\nimport { isNotNullish } from './utils';\nimport type { NamedSchemaError } from './standardSchema';\nimport { filterMap } from './utils/filterMap';\nconst rawResultType = /* @__PURE__ */Symbol();\nconst resultType = /* @__PURE__ */Symbol();\nconst baseQuery = /* @__PURE__ */Symbol();\nexport interface SchemaFailureInfo {\n  endpoint: string;\n  arg: any;\n  type: 'query' | 'mutation';\n  queryCacheKey?: string;\n}\nexport type SchemaFailureHandler = (error: NamedSchemaError, info: SchemaFailureInfo) => void;\nexport type SchemaFailureConverter<BaseQuery extends BaseQueryFn> = (error: NamedSchemaError, info: SchemaFailureInfo) => BaseQueryError<BaseQuery>;\nexport type EndpointDefinitionWithQuery<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery>> = {\n  /**\n   * `query` can be a function that returns either a `string` or an `object` which is passed to your `baseQuery`. If you are using [fetchBaseQuery](./fetchBaseQuery), this can return either a `string` or an `object` of properties in `FetchArgs`. If you use your own custom [`baseQuery`](../../rtk-query/usage/customizing-queries), you can customize this behavior to your liking.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"query example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       // highlight-start\n   *       query: () => 'posts',\n   *       // highlight-end\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *      // highlight-start\n   *      query: (body) => ({\n   *        url: `posts`,\n   *        method: 'POST',\n   *        body,\n   *      }),\n   *      // highlight-end\n   *      invalidatesTags: [{ type: 'Post', id: 'LIST' }],\n   *    }),\n   *   })\n   * })\n   * ```\n   */\n  query(arg: QueryArg): BaseQueryArg<BaseQuery>;\n  queryFn?: never;\n  /**\n   * A function to manipulate the data returned by a query or mutation.\n   */\n  transformResponse?(baseQueryReturnValue: RawResultType, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): ResultType | Promise<ResultType>;\n  /**\n   * A function to manipulate the data returned by a failed query or mutation.\n   */\n  transformErrorResponse?(baseQueryReturnValue: BaseQueryError<BaseQuery>, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): unknown;\n\n  /**\n   * A schema for the result *before* it's passed to `transformResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPostName: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawResponseSchema: postSchema,\n   *       transformResponse: (post) => post.name,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawResponseSchema?: StandardSchemaV1<RawResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn`, *before* it's passed to `transformErrorResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import {customBaseQuery, baseQueryErrorSchema} from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawErrorResponseSchema: baseQueryErrorSchema,\n   *       transformErrorResponse: (error) => error.data,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawErrorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n};\nexport type EndpointDefinitionWithQueryFn<QueryArg, BaseQuery extends BaseQueryFn, ResultType> = {\n  /**\n   * Can be used in place of `query` as an inline function that bypasses `baseQuery` completely for the endpoint.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Basic queryFn example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *     }),\n   *     flipCoin: build.query<'heads' | 'tails', void>({\n   *       // highlight-start\n   *       queryFn(arg, queryApi, extraOptions, baseQuery) {\n   *         const randomVal = Math.random()\n   *         if (randomVal < 0.45) {\n   *           return { data: 'heads' }\n   *         }\n   *         if (randomVal < 0.9) {\n   *           return { data: 'tails' }\n   *         }\n   *         return { error: { status: 500, statusText: 'Internal Server Error', data: \"Coin landed on its edge!\" } }\n   *       }\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  queryFn(arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions<BaseQuery>, baseQuery: (arg: Parameters<BaseQuery>[0]) => ReturnType<BaseQuery>): MaybePromise<QueryReturnValue<ResultType, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>>;\n  query?: never;\n  transformResponse?: never;\n  transformErrorResponse?: never;\n  rawResponseSchema?: never;\n  rawErrorResponseSchema?: never;\n};\ntype BaseEndpointTypes<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType> = {\n  QueryArg: QueryArg;\n  BaseQuery: BaseQuery;\n  ResultType: ResultType;\n  RawResultType: RawResultType;\n};\nexport type SchemaType = 'arg' | 'rawResponse' | 'response' | 'rawErrorResponse' | 'errorResponse' | 'meta';\ninterface CommonEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType> {\n  /**\n   * A schema for the arguments to be passed to the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       argSchema: v.object({ id: v.number() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  argSchema?: StandardSchemaV1<QueryArg>;\n\n  /**\n   * A schema for the result (including `transformResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: postSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  responseSchema?: StandardSchemaV1<ResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn` (including `transformErrorResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryErrorSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       errorResponseSchema: baseQueryErrorSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  errorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n\n  /**\n   * A schema for the `meta` property returned by the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryMetaSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       metaSchema: baseQueryMetaSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  metaSchema?: StandardSchemaV1<BaseQueryMeta<BaseQuery>>;\n\n  /**\n   * Defaults to `true`.\n   *\n   * Most apps should leave this setting on. The only time it can be a performance issue\n   * is if an API returns extremely large amounts of data (e.g. 10,000 rows per request) and\n   * you're unable to paginate it.\n   *\n   * For details of how this works, please see the below. When it is set to `false`,\n   * every request will cause subscribed components to rerender, even when the data has not changed.\n   *\n   * @see https://redux-toolkit.js.org/api/other-exports#copywithstructuralsharing\n   */\n  structuralSharing?: boolean;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       onSchemaFailure: (error, info) => {\n   *         console.error(error, info)\n   *       },\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       catchSchemaFailure: (error, info) => ({\n   *         status: \"CUSTOM_ERROR\",\n   *         error: error.schemaName + \" failed validation\",\n   *         data: error.issues,\n   *       }),\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for this endpoint.\n   * Overrides the global setting.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type BaseEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = (([CastAny<BaseQueryResult<BaseQuery>, {}>] extends [NEVER] ? never : EndpointDefinitionWithQuery<QueryArg, BaseQuery, ResultType, RawResultType>) | EndpointDefinitionWithQueryFn<QueryArg, BaseQuery, ResultType>) & CommonEndpointDefinition<QueryArg, BaseQuery, ResultType> & {\n  /* phantom type */\n  [rawResultType]?: RawResultType;\n  /* phantom type */\n  [resultType]?: ResultType;\n  /* phantom type */\n  [baseQuery]?: BaseQuery;\n} & HasRequiredProps<BaseQueryExtraOptions<BaseQuery>, {\n  extraOptions: BaseQueryExtraOptions<BaseQuery>;\n}, {\n  extraOptions?: BaseQueryExtraOptions<BaseQuery>;\n}>;\n\n// NOTE As with QueryStatus in `apiState.ts`, don't use this for real comparisons\n// at runtime, use the string constants defined below.\nexport enum DefinitionType {\n  query = 'query',\n  mutation = 'mutation',\n  infinitequery = 'infinitequery',\n}\nexport const ENDPOINT_QUERY = DefinitionType.query;\nexport const ENDPOINT_MUTATION = DefinitionType.mutation;\nexport const ENDPOINT_INFINITEQUERY = DefinitionType.infinitequery;\ntype TagDescriptionArray<TagTypes extends string> = ReadonlyArray<TagDescription<TagTypes> | undefined | null>;\nexport type GetResultDescriptionFn<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = (result: ResultType | undefined, error: ErrorType | undefined, arg: QueryArg, meta: MetaType) => TagDescriptionArray<TagTypes>;\nexport type FullTagDescription<TagType> = {\n  type: TagType;\n  id?: number | string;\n};\nexport type TagDescription<TagType> = TagType | FullTagDescription<TagType>;\n\n/**\n * @public\n */\nexport type ResultDescription<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = TagDescriptionArray<TagTypes> | GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>;\ntype QueryTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  QueryDefinition: QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface QueryExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.query;\n\n  /**\n   * Used by `query` endpoints. Determines which 'tag' is attached to the cached data returned by the query.\n   * Expects an array of tag type strings, an array of objects of tag types with ids, or a function that returns such an array.\n   * 1.  `['Post']` - equivalent to `2`\n   * 2.  `[{ type: 'Post' }]` - equivalent to `1`\n   * 3.  `[{ type: 'Post', id: 1 }]`\n   * 4.  `(result, error, arg) => ['Post']` - equivalent to `5`\n   * 5.  `(result, error, arg) => [{ type: 'Post' }]` - equivalent to `4`\n   * 6.  `(result, error, arg) => [{ type: 'Post', id: 1 }]`\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"providesTags example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       // highlight-start\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  providesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * Can be provided to merge an incoming response value into the current cache data.\n   * If supplied, no automatic structural sharing will be applied - it's up to\n   * you to update the cache appropriately.\n   *\n   * Since RTKQ normally replaces cache entries with the new response, you will usually\n   * need to use this with the `serializeQueryArgs` or `forceRefetch` options to keep\n   * an existing cache entry so that it can be updated.\n   *\n   * Since this is wrapped with Immer, you may either mutate the `currentCacheValue` directly,\n   * or return a new value, but _not_ both at once.\n   *\n   * Will only be called if the existing `currentCacheData` is _not_ `undefined` - on first response,\n   * the cache entry will just save the response data directly.\n   *\n   * Useful if you don't want a new request to completely override the current cache value,\n   * maybe because you have manually updated it from another source and don't want those\n   * updates to get lost.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"merge: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  merge?(currentCacheData: ResultType, responseData: ResultType, otherArgs: {\n    arg: QueryArg;\n    baseQueryMeta: BaseQueryMeta<BaseQuery>;\n    requestId: string;\n    fulfilledTimeStamp: number;\n  }): ResultType | void;\n\n  /**\n   * Check to see if the endpoint should force a refetch in cases where it normally wouldn't.\n   * This is primarily useful for \"infinite scroll\" / pagination use cases where\n   * RTKQ is keeping a single cache entry that is added to over time, in combination\n   * with `serializeQueryArgs` returning a fixed cache key and a `merge` callback\n   * set to add incoming data to the cache entry each time.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"forceRefresh: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  forceRefetch?(params: {\n    currentArg: QueryArg | undefined;\n    previousArg: QueryArg | undefined;\n    state: RootState<any, any, string>;\n    endpointState?: QuerySubState<any>;\n  }): boolean;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: QueryTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type QueryDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & QueryExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type InfiniteQueryTypes<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  InfiniteQueryDefinition: InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\nexport interface InfiniteQueryExtraOptions<TagTypes extends string, ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.infinitequery;\n  providesTags?: ResultDescription<TagTypes, InfiniteData<ResultType, PageParam>, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Required options to configure the infinite query behavior.\n   * `initialPageParam` and `getNextPageParam` are required, to\n   * ensure the infinite query can properly fetch the next page of data.\n   * `initialPageParam` may be specified when using the\n   * endpoint, to override the default value.\n   * `maxPages` and `getPreviousPageParam` are both optional.\n   * \n   * @example\n   * \n   * ```ts\n   * // codeblock-meta title=\"infiniteQueryOptions example\"\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * \n   * type Pokemon = {\n   *   id: string\n   *   name: string\n   * }\n   * \n   * const pokemonApi = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),\n   *   endpoints: (build) => ({\n   *     getInfinitePokemonWithMax: build.infiniteQuery<Pokemon[], string, number>({\n   *       infiniteQueryOptions: {\n   *         initialPageParam: 0,\n   *         maxPages: 3,\n   *         getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) =>\n   *           lastPageParam + 1,\n   *         getPreviousPageParam: (\n   *           firstPage,\n   *           allPages,\n   *           firstPageParam,\n   *           allPageParams,\n   *         ) => {\n   *           return firstPageParam > 0 ? firstPageParam - 1 : undefined\n   *         },\n   *       },\n   *       query({pageParam}) {\n   *         return `https://example.com/listItems?page=${pageParam}`\n   *       },\n   *     }),\n   *   }),\n   * })\n   \n   * ```\n   */\n  infiniteQueryOptions: InfiniteQueryConfigOptions<ResultType, PageParam, QueryArg>;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: InfiniteQueryTypes<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> =\n// Infinite query endpoints receive `{queryArg, pageParam}`\nBaseEndpointDefinition<InfiniteQueryCombinedArg<QueryArg, PageParam>, BaseQuery, ResultType, RawResultType> & InfiniteQueryExtraOptions<TagTypes, ResultType, QueryArg, PageParam, BaseQuery, ReducerPath, RawResultType>;\ntype MutationTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseMutation<typeof api.endpoints.query.Types.MutationDefinition> = ...\n   * ```\n   */\n  MutationDefinition: MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface MutationExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath> {\n  type: DefinitionType.mutation;\n\n  /**\n   * Used by `mutation` endpoints. Determines which cached data should be either re-fetched or removed from the cache.\n   * Expects the same shapes as `providesTags`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"invalidatesTags example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *       query(body) {\n   *         return {\n   *           url: `posts`,\n   *           method: 'POST',\n   *           body,\n   *         }\n   *       },\n   *       // highlight-start\n   *       invalidatesTags: [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  invalidatesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A mutation should not provide tags to the cache.\n   */\n  providesTags?: never;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: MutationTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type MutationDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & MutationExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type EndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, PageParam = any, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\nexport type EndpointDefinitions = Record<string, EndpointDefinition<any, any, any, any, any, any, any>>;\nexport function isQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is QueryDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_QUERY;\n}\nexport function isMutationDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is MutationDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_MUTATION;\n}\nexport function isInfiniteQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is InfiniteQueryDefinition<any, any, any, any, any, any, any> {\n  return e.type === ENDPOINT_INFINITEQUERY;\n}\nexport function isAnyQueryDefinition(e: EndpointDefinition<any, any, any, any>): e is QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any> {\n  return isQueryDefinition(e) || isInfiniteQueryDefinition(e);\n}\nexport type EndpointBuilder<BaseQuery extends BaseQueryFn, TagTypes extends string, ReducerPath extends string> = {\n  /**\n   * An endpoint definition that retrieves data, and may provide tags to the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all query endpoint options\"\n   * const api = createApi({\n   *  baseQuery,\n   *  endpoints: (build) => ({\n   *    getPost: build.query({\n   *      query: (id) => ({ url: `post/${id}` }),\n   *      // Pick out data and prevent nested properties in a hook or selector\n   *      transformResponse: (response) => response.data,\n   *      // Pick out error and prevent nested properties in a hook or selector\n   *      transformErrorResponse: (response) => response.error,\n   *      // `result` is the server response\n   *      providesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry, updateCachedData }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry, updateCachedData }) {},\n   *    }),\n   *  }),\n   *});\n   *```\n   */\n  query<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n\n  /**\n   * An endpoint definition that alters data on the server or will possibly invalidate the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all mutation endpoint options\"\n   * const api = createApi({\n   *   baseQuery,\n   *   endpoints: (build) => ({\n   *     updatePost: build.mutation({\n   *       query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),\n   *       // Pick out data and prevent nested properties in a hook or selector\n   *       transformResponse: (response) => response.data,\n   *       // Pick out error and prevent nested properties in a hook or selector\n   *       transformErrorResponse: (response) => response.error,\n   *       // `result` is the server response\n   *       invalidatesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry }) {},\n   *     }),\n   *   }),\n   * });\n   * ```\n   */\n  mutation<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n  infiniteQuery<ResultType, QueryArg, PageParam, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n};\nexport type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T;\nexport function calculateProvidedBy<ResultType, QueryArg, ErrorType, MetaType>(description: ResultDescription<string, ResultType, QueryArg, ErrorType, MetaType> | undefined, result: ResultType | undefined, error: ErrorType | undefined, queryArg: QueryArg, meta: MetaType | undefined, assertTagTypes: AssertTagTypes): readonly FullTagDescription<string>[] {\n  const finalDescription = isFunction(description) ? description(result as ResultType, error as undefined, queryArg, meta as MetaType) : description;\n  if (finalDescription) {\n    return filterMap(finalDescription, isNotNullish, tag => assertTagTypes(expandTagDescription(tag)));\n  }\n  return [];\n}\nfunction isFunction<T>(t: T): t is Extract<T, Function> {\n  return typeof t === 'function';\n}\nexport function expandTagDescription(description: TagDescription<string>): FullTagDescription<string> {\n  return typeof description === 'string' ? {\n    type: description\n  } : description;\n}\nexport type QueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<infer QA, any, any, any> ? QA : never;\n\n// Just extracting `QueryArg` from `BaseEndpointDefinition`\n// doesn't sufficiently match here.\n// We need to explicitly match against `InfiniteQueryDefinition`\nexport type InfiniteQueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<infer QA, any, any, any, any, any, any> ? QA : never;\nexport type QueryArgFromAnyQuery<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any, any, any> ? InfiniteQueryArgFrom<D> : D extends QueryDefinition<any, any, any, any, any, any> ? QueryArgFrom<D> : never;\nexport type ResultTypeFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<any, any, infer RT, any> ? RT : unknown;\nexport type ReducerPathFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, any, any, infer RP, any, any> ? RP : unknown;\nexport type TagTypesFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, infer TT, any, any, any, any> ? TT : unknown;\nexport type PageParamFrom<D extends InfiniteQueryDefinition<any, any, any, any, any, any, any>> = D extends InfiniteQueryDefinition<any, infer PP, any, any, any, any, any> ? PP : unknown;\nexport type InfiniteQueryCombinedArg<QueryArg, PageParam> = {\n  queryArg: QueryArg;\n  pageParam: PageParam;\n};\nexport type TagTypesFromApi<T> = T extends Api<any, any, any, infer TagTypes> ? TagTypes : never;\nexport type DefinitionsFromApi<T> = T extends Api<any, infer Definitions, any, any> ? Definitions : never;\nexport type TransformedResponse<NewDefinitions extends EndpointDefinitions, K, ResultType> = K extends keyof NewDefinitions ? NewDefinitions[K]['transformResponse'] extends undefined ? ResultType : UnwrapPromise<ReturnType<NonUndefined<NewDefinitions[K]['transformResponse']>>> : ResultType;\nexport type OverrideResultType<Definition, NewResultType> = Definition extends QueryDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends MutationDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, NewResultType, ReducerPath> : never;\nexport type UpdateDefinitions<Definitions extends EndpointDefinitions, NewTagTypes extends string, NewDefinitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends MutationDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : never };","export { current, isDraft, applyPatches, original, isDraftable, produceWithPatches, enablePatches } from 'immer';","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { AsyncThunkAction, SafePromise, SerializedError, ThunkAction, UnknownAction } from '@reduxjs/toolkit';\nimport type { Dispatch } from 'redux';\nimport { asSafePromise } from '../../tsHelpers';\nimport { getEndpointDefinition, type Api, type ApiContext } from '../apiTypes';\nimport type { BaseQueryError, QueryReturnValue } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport { ENDPOINT_QUERY, isQueryDefinition, type EndpointDefinition, type EndpointDefinitions, type InfiniteQueryArgFrom, type InfiniteQueryDefinition, type MutationDefinition, type PageParamFrom, type QueryArgFrom, type QueryDefinition, type ResultTypeFrom } from '../endpointDefinitions';\nimport { filterNullishValues } from '../utils';\nimport type { InfiniteData, InfiniteQueryConfigOptions, InfiniteQueryDirection, SubscriptionOptions } from './apiState';\nimport type { InfiniteQueryResultSelectorResult, QueryResultSelectorResult } from './buildSelectors';\nimport type { InfiniteQueryThunk, InfiniteQueryThunkArg, MutationThunk, QueryThunk, QueryThunkArg, ThunkApiMetaConfig } from './buildThunks';\nimport type { ApiEndpointQuery } from './module';\nimport type { InternalMiddlewareState } from './buildMiddleware/types';\nexport type BuildInitiateApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>> = {\n  initiate: StartQueryActionCreator<Definition>;\n};\nexport type BuildInitiateApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  initiate: StartInfiniteQueryActionCreator<Definition>;\n};\nexport type BuildInitiateApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>> = {\n  initiate: StartMutationActionCreator<Definition>;\n};\nexport const forceQueryFnSymbol = Symbol('forceQueryFn');\nexport const isUpsertQuery = (arg: QueryThunkArg) => typeof arg[forceQueryFnSymbol] === 'function';\nexport type StartQueryActionCreatorOptions = {\n  subscribe?: boolean;\n  forceRefetch?: boolean | number;\n  subscriptionOptions?: SubscriptionOptions;\n  [forceQueryFnSymbol]?: () => QueryReturnValue;\n};\ntype RefetchOptions = {\n  refetchCachedPages?: boolean;\n};\nexport type StartInfiniteQueryActionCreatorOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>> = StartQueryActionCreatorOptions & {\n  direction?: InfiniteQueryDirection;\n  param?: unknown;\n} & Partial<Pick<Partial<InfiniteQueryConfigOptions<ResultTypeFrom<D>, PageParamFrom<D>, InfiniteQueryArgFrom<D>>>, 'initialPageParam' | 'refetchCachedPages'>>;\ntype AnyQueryActionCreator<D extends EndpointDefinition<any, any, any, any>> = (arg: any, options?: StartQueryActionCreatorOptions) => ThunkAction<AnyActionCreatorResult, any, any, UnknownAction>;\ntype StartQueryActionCreator<D extends QueryDefinition<any, any, any, any, any>> = (arg: QueryArgFrom<D>, options?: StartQueryActionCreatorOptions) => ThunkAction<QueryActionCreatorResult<D>, any, any, UnknownAction>;\nexport type StartInfiniteQueryActionCreator<D extends InfiniteQueryDefinition<any, any, any, any, any>> = (arg: InfiniteQueryArgFrom<D>, options?: StartInfiniteQueryActionCreatorOptions<D>) => ThunkAction<InfiniteQueryActionCreatorResult<D>, any, any, UnknownAction>;\ntype QueryActionCreatorFields = {\n  requestId: string;\n  subscriptionOptions: SubscriptionOptions | undefined;\n  abort(): void;\n  unsubscribe(): void;\n  updateSubscriptionOptions(options: SubscriptionOptions): void;\n  queryCacheKey: string;\n};\ntype AnyActionCreatorResult = SafePromise<any> & QueryActionCreatorFields & {\n  arg: any;\n  unwrap(): Promise<any>;\n  refetch(options?: RefetchOptions): AnyActionCreatorResult;\n};\nexport type QueryActionCreatorResult<D extends QueryDefinition<any, any, any, any>> = SafePromise<QueryResultSelectorResult<D>> & QueryActionCreatorFields & {\n  arg: QueryArgFrom<D>;\n  unwrap(): Promise<ResultTypeFrom<D>>;\n  refetch(): QueryActionCreatorResult<D>;\n};\nexport type InfiniteQueryActionCreatorResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = SafePromise<InfiniteQueryResultSelectorResult<D>> & QueryActionCreatorFields & {\n  arg: InfiniteQueryArgFrom<D>;\n  unwrap(): Promise<InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>>;\n  refetch(options?: Pick<StartInfiniteQueryActionCreatorOptions<D>, 'refetchCachedPages'>): InfiniteQueryActionCreatorResult<D>;\n};\ntype StartMutationActionCreator<D extends MutationDefinition<any, any, any, any>> = (arg: QueryArgFrom<D>, options?: {\n  /**\n   * If this mutation should be tracked in the store.\n   * If you just want to manually trigger this mutation using `dispatch` and don't care about the\n   * result, state & potential errors being held in store, you can set this to false.\n   * (defaults to `true`)\n   */\n  track?: boolean;\n  fixedCacheKey?: string;\n}) => ThunkAction<MutationActionCreatorResult<D>, any, any, UnknownAction>;\nexport type MutationActionCreatorResult<D extends MutationDefinition<any, any, any, any>> = SafePromise<{\n  data: ResultTypeFrom<D>;\n  error?: undefined;\n} | {\n  data?: undefined;\n  error: Exclude<BaseQueryError<D extends MutationDefinition<any, infer BaseQuery, any, any> ? BaseQuery : never>, undefined> | SerializedError;\n}> & {\n  /** @internal */\n  arg: {\n    /**\n     * The name of the given endpoint for the mutation\n     */\n    endpointName: string;\n    /**\n     * The original arguments supplied to the mutation call\n     */\n    originalArgs: QueryArgFrom<D>;\n    /**\n     * Whether the mutation is being tracked in the store.\n     */\n    track?: boolean;\n    fixedCacheKey?: string;\n  };\n  /**\n   * A unique string generated for the request sequence\n   */\n  requestId: string;\n\n  /**\n   * A method to cancel the mutation promise. Note that this is not intended to prevent the mutation\n   * that was fired off from reaching the server, but only to assist in handling the response.\n   *\n   * Calling `abort()` prior to the promise resolving will force it to reach the error state with\n   * the serialized error:\n   * `{ name: 'AbortError', message: 'Aborted' }`\n   *\n   * @example\n   * ```ts\n   * const [updateUser] = useUpdateUserMutation();\n   *\n   * useEffect(() => {\n   *   const promise = updateUser(id);\n   *   promise\n   *     .unwrap()\n   *     .catch((err) => {\n   *       if (err.name === 'AbortError') return;\n   *       // else handle the unexpected error\n   *     })\n   *\n   *   return () => {\n   *     promise.abort();\n   *   }\n   * }, [id, updateUser])\n   * ```\n   */\n  abort(): void;\n  /**\n   * Unwraps a mutation call to provide the raw response/error.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a mutation, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap\"\n   * addPost({ id: 1, name: 'Example' })\n   *   .unwrap()\n   *   .then((payload) => console.log('fulfilled', payload))\n   *   .catch((error) => console.error('rejected', error));\n   * ```\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await addPost({ id: 1, name: 'Example' }).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  unwrap(): Promise<ResultTypeFrom<D>>;\n  /**\n   * A method to manually unsubscribe from the mutation call, meaning it will be removed from cache after the usual caching grace period.\n   The value returned by the hook will reset to `isUninitialized` afterwards.\n   */\n  reset(): void;\n};\nexport function buildInitiate({\n  serializeQueryArgs,\n  queryThunk,\n  infiniteQueryThunk,\n  mutationThunk,\n  api,\n  context,\n  getInternalState\n}: {\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  queryThunk: QueryThunk;\n  infiniteQueryThunk: InfiniteQueryThunk<any>;\n  mutationThunk: MutationThunk;\n  api: Api<any, EndpointDefinitions, any, any>;\n  context: ApiContext<EndpointDefinitions>;\n  getInternalState: (dispatch: Dispatch) => InternalMiddlewareState;\n}) {\n  const getRunningQueries = (dispatch: Dispatch) => getInternalState(dispatch)?.runningQueries;\n  const getRunningMutations = (dispatch: Dispatch) => getInternalState(dispatch)?.runningMutations;\n  const {\n    unsubscribeQueryResult,\n    removeMutationResult,\n    updateSubscriptionOptions\n  } = api.internalActions;\n  return {\n    buildInitiateQuery,\n    buildInitiateInfiniteQuery,\n    buildInitiateMutation,\n    getRunningQueryThunk,\n    getRunningMutationThunk,\n    getRunningQueriesThunk,\n    getRunningMutationsThunk\n  };\n  function getRunningQueryThunk(endpointName: string, queryArgs: any) {\n    return (dispatch: Dispatch) => {\n      const endpointDefinition = getEndpointDefinition(context, endpointName);\n      const queryCacheKey = serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      });\n      return getRunningQueries(dispatch)?.get(queryCacheKey) as QueryActionCreatorResult<never> | InfiniteQueryActionCreatorResult<never> | undefined;\n    };\n  }\n  function getRunningMutationThunk(\n  /**\n   * this is only here to allow TS to infer the result type by input value\n   * we could use it to validate the result, but it's probably not necessary\n   */\n  _endpointName: string, fixedCacheKeyOrRequestId: string) {\n    return (dispatch: Dispatch) => {\n      return getRunningMutations(dispatch)?.get(fixedCacheKeyOrRequestId) as MutationActionCreatorResult<never> | undefined;\n    };\n  }\n  function getRunningQueriesThunk() {\n    return (dispatch: Dispatch) => filterNullishValues(getRunningQueries(dispatch));\n  }\n  function getRunningMutationsThunk() {\n    return (dispatch: Dispatch) => filterNullishValues(getRunningMutations(dispatch));\n  }\n  function middlewareWarning(dispatch: Dispatch) {\n    if (process.env.NODE_ENV !== 'production') {\n      if ((middlewareWarning as any).triggered) return;\n      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());\n      (middlewareWarning as any).triggered = true;\n\n      // The RTKQ middleware should return the internal state object,\n      // but it should _not_ be the action object.\n      if (typeof returnedValue !== 'object' || typeof returnedValue?.type === 'string') {\n        // Otherwise, must not have been added\n        throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(34) : `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!`);\n      }\n    }\n  }\n  function buildInitiateAnyQuery<T extends 'query' | 'infiniteQuery'>(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any>) {\n    const queryAction: AnyQueryActionCreator<any> = (arg, {\n      subscribe = true,\n      forceRefetch,\n      subscriptionOptions,\n      [forceQueryFnSymbol]: forceQueryFn,\n      ...rest\n    } = {}) => (dispatch, getState) => {\n      const queryCacheKey = serializeQueryArgs({\n        queryArgs: arg,\n        endpointDefinition,\n        endpointName\n      });\n      let thunk: AsyncThunkAction<unknown, QueryThunkArg, ThunkApiMetaConfig>;\n      const commonThunkArgs = {\n        ...rest,\n        type: ENDPOINT_QUERY as 'query',\n        subscribe,\n        forceRefetch: forceRefetch,\n        subscriptionOptions,\n        endpointName,\n        originalArgs: arg,\n        queryCacheKey,\n        [forceQueryFnSymbol]: forceQueryFn\n      };\n      if (isQueryDefinition(endpointDefinition)) {\n        thunk = queryThunk(commonThunkArgs);\n      } else {\n        const {\n          direction,\n          initialPageParam,\n          refetchCachedPages\n        } = rest as Pick<InfiniteQueryThunkArg<any>, 'direction' | 'initialPageParam' | 'refetchCachedPages'>;\n        thunk = infiniteQueryThunk({\n          ...(commonThunkArgs as InfiniteQueryThunkArg<any>),\n          // Supply these even if undefined. This helps with a field existence\n          // check over in `buildSlice.ts`\n          direction,\n          initialPageParam,\n          refetchCachedPages\n        });\n      }\n      const selector = (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).select(arg);\n      const thunkResult = dispatch(thunk);\n      const stateAfter = selector(getState());\n      middlewareWarning(dispatch);\n      const {\n        requestId,\n        abort\n      } = thunkResult;\n      const skippedSynchronously = stateAfter.requestId !== requestId;\n      const runningQuery = getRunningQueries(dispatch)?.get(queryCacheKey);\n      const selectFromState = () => selector(getState());\n      const statePromise: AnyActionCreatorResult = Object.assign((forceQueryFn ?\n      // a query has been forced (upsertQueryData)\n      // -> we want to resolve it once data has been written with the data that will be written\n      thunkResult.then(selectFromState) : skippedSynchronously && !runningQuery ?\n      // a query has been skipped due to a condition and we do not have any currently running query\n      // -> we want to resolve it immediately with the current data\n      Promise.resolve(stateAfter) :\n      // query just started or one is already in flight\n      // -> wait for the running query, then resolve with data from after that\n      Promise.all([runningQuery, thunkResult]).then(selectFromState)) as SafePromise<any>, {\n        arg,\n        requestId,\n        subscriptionOptions,\n        queryCacheKey,\n        abort,\n        async unwrap() {\n          const result = await statePromise;\n          if (result.isError) {\n            throw result.error;\n          }\n          return result.data;\n        },\n        refetch: (options?: RefetchOptions) => dispatch(queryAction(arg, {\n          subscribe: false,\n          forceRefetch: true,\n          ...options\n        })),\n        unsubscribe() {\n          if (subscribe) dispatch(unsubscribeQueryResult({\n            queryCacheKey,\n            requestId\n          }));\n        },\n        updateSubscriptionOptions(options: SubscriptionOptions) {\n          statePromise.subscriptionOptions = options;\n          dispatch(updateSubscriptionOptions({\n            endpointName,\n            requestId,\n            queryCacheKey,\n            options\n          }));\n        }\n      });\n      if (!runningQuery && !skippedSynchronously && !forceQueryFn) {\n        const runningQueries = getRunningQueries(dispatch)!;\n        runningQueries.set(queryCacheKey, statePromise);\n        statePromise.then(() => {\n          runningQueries.delete(queryCacheKey);\n        });\n      }\n      return statePromise;\n    };\n    return queryAction;\n  }\n  function buildInitiateQuery(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any>) {\n    const queryAction: StartQueryActionCreator<any> = buildInitiateAnyQuery(endpointName, endpointDefinition);\n    return queryAction;\n  }\n  function buildInitiateInfiniteQuery(endpointName: string, endpointDefinition: InfiniteQueryDefinition<any, any, any, any, any>) {\n    const infiniteQueryAction: StartInfiniteQueryActionCreator<any> = buildInitiateAnyQuery(endpointName, endpointDefinition);\n    return infiniteQueryAction;\n  }\n  function buildInitiateMutation(endpointName: string): StartMutationActionCreator<any> {\n    return (arg, {\n      track = true,\n      fixedCacheKey\n    } = {}) => (dispatch, getState) => {\n      const thunk = mutationThunk({\n        type: 'mutation',\n        endpointName,\n        originalArgs: arg,\n        track,\n        fixedCacheKey\n      });\n      const thunkResult = dispatch(thunk);\n      middlewareWarning(dispatch);\n      const {\n        requestId,\n        abort,\n        unwrap\n      } = thunkResult;\n      const returnValuePromise = asSafePromise(thunkResult.unwrap().then(data => ({\n        data\n      })), error => ({\n        error\n      }));\n      const reset = () => {\n        dispatch(removeMutationResult({\n          requestId,\n          fixedCacheKey\n        }));\n      };\n      const ret = Object.assign(returnValuePromise, {\n        arg: thunkResult.arg,\n        requestId,\n        abort,\n        unwrap,\n        reset\n      });\n      const runningMutations = getRunningMutations(dispatch)!;\n      runningMutations.set(requestId, ret);\n      ret.then(() => {\n        runningMutations.delete(requestId);\n      });\n      if (fixedCacheKey) {\n        runningMutations.set(fixedCacheKey, ret);\n        ret.then(() => {\n          if (runningMutations.get(fixedCacheKey) === ret) {\n            runningMutations.delete(fixedCacheKey);\n          }\n        });\n      }\n      return ret;\n    };\n  }\n}","import type { Middleware, StoreEnhancer } from 'redux';\nimport type { Tuple } from './utils';\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>) {\n  Object.assign(target, ...args);\n}\n\n/**\n * return True if T is `any`, otherwise return False\n * taken from https://github.com/joonhocho/tsdef\n *\n * @internal\n */\nexport type IsAny<T, True, False = never> =\n// test if we are going the left AND right path in the condition\ntrue | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;\n\n/**\n * return True if T is `unknown`, otherwise return False\n * taken from https://github.com/joonhocho/tsdef\n *\n * @internal\n */\nexport type IsUnknown<T, True, False = never> = unknown extends T ? IsAny<T, False, True> : False;\nexport type FallbackIfUnknown<T, Fallback> = IsUnknown<T, Fallback, T>;\n\n/**\n * @internal\n */\nexport type IfMaybeUndefined<P, True, False> = [undefined] extends [P] ? True : False;\n\n/**\n * @internal\n */\nexport type IfVoid<P, True, False> = [void] extends [P] ? True : False;\n\n/**\n * @internal\n */\nexport type IsEmptyObj<T, True, False = never> = T extends any ? keyof T extends never ? IsUnknown<T, False, IfMaybeUndefined<T, False, IfVoid<T, False, True>>> : False : never;\n\n/**\n * returns True if TS version is above 3.5, False if below.\n * uses feature detection to detect TS version >= 3.5\n * * versions below 3.5 will return `{}` for unresolvable interference\n * * versions above will return `unknown`\n *\n * @internal\n */\nexport type AtLeastTS35<True, False> = [True, False][IsUnknown<ReturnType<<T>() => T>, 0, 1>];\n\n/**\n * @internal\n */\nexport type IsUnknownOrNonInferrable<T, True, False> = AtLeastTS35<IsUnknown<T, True, False>, IsEmptyObj<T, True, IsUnknown<T, True, False>>>;\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\n\n// Appears to have a convenient side effect of ignoring `never` even if that's not what you specified\nexport type ExcludeFromTuple<T, E, Acc extends unknown[] = []> = T extends [infer Head, ...infer Tail] ? ExcludeFromTuple<Tail, E, [...Acc, ...([Head] extends [E] ? [] : [Head])]> : Acc;\ntype ExtractDispatchFromMiddlewareTuple<MiddlewareTuple extends readonly any[], Acc extends {}> = MiddlewareTuple extends [infer Head, ...infer Tail] ? ExtractDispatchFromMiddlewareTuple<Tail, Acc & (Head extends Middleware<infer D> ? IsAny<D, {}, D> : {})> : Acc;\nexport type ExtractDispatchExtensions<M> = M extends Tuple<infer MiddlewareTuple> ? ExtractDispatchFromMiddlewareTuple<MiddlewareTuple, {}> : M extends ReadonlyArray<Middleware> ? ExtractDispatchFromMiddlewareTuple<[...M], {}> : never;\ntype ExtractStoreExtensionsFromEnhancerTuple<EnhancerTuple extends readonly any[], Acc extends {}> = EnhancerTuple extends [infer Head, ...infer Tail] ? ExtractStoreExtensionsFromEnhancerTuple<Tail, Acc & (Head extends StoreEnhancer<infer Ext> ? IsAny<Ext, {}, Ext> : {})> : Acc;\nexport type ExtractStoreExtensions<E> = E extends Tuple<infer EnhancerTuple> ? ExtractStoreExtensionsFromEnhancerTuple<EnhancerTuple, {}> : E extends ReadonlyArray<StoreEnhancer> ? UnionToIntersection<E[number] extends StoreEnhancer<infer Ext> ? Ext extends {} ? IsAny<Ext, {}, Ext> : {} : {}> : never;\ntype ExtractStateExtensionsFromEnhancerTuple<EnhancerTuple extends readonly any[], Acc extends {}> = EnhancerTuple extends [infer Head, ...infer Tail] ? ExtractStateExtensionsFromEnhancerTuple<Tail, Acc & (Head extends StoreEnhancer<any, infer StateExt> ? IsAny<StateExt, {}, StateExt> : {})> : Acc;\nexport type ExtractStateExtensions<E> = E extends Tuple<infer EnhancerTuple> ? ExtractStateExtensionsFromEnhancerTuple<EnhancerTuple, {}> : E extends ReadonlyArray<StoreEnhancer> ? UnionToIntersection<E[number] extends StoreEnhancer<any, infer StateExt> ? StateExt extends {} ? IsAny<StateExt, {}, StateExt> : {} : {}> : never;\n\n/**\n * Helper type. Passes T out again, but boxes it in a way that it cannot\n * \"widen\" the type by accident if it is a generic that should be inferred\n * from elsewhere.\n *\n * @internal\n */\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type WithOptionalProp<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\nexport interface TypeGuard<T> {\n  (value: any): value is T;\n}\nexport interface HasMatchFunction<T> {\n  match: TypeGuard<T>;\n}\nexport const hasMatchFunction = <T,>(v: Matcher<T>): v is HasMatchFunction<T> => {\n  return v && typeof (v as HasMatchFunction<T>).match === 'function';\n};\n\n/** @public */\nexport type Matcher<T> = HasMatchFunction<T> | TypeGuard<T>;\n\n/** @public */\nexport type ActionFromMatcher<M extends Matcher<any>> = M extends Matcher<infer T> ? T : never;\nexport type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type Tail<T extends any[]> = T extends [any, ...infer Tail] ? Tail : never;\nexport type UnknownIfNonSpecific<T> = {} extends T ? unknown : T;\n\n/**\n * A Promise that will never reject.\n * @see https://github.com/reduxjs/redux-toolkit/issues/4101\n */\nexport type SafePromise<T> = Promise<T> & {\n  __linterBrands: 'SafePromise';\n};\n\n/**\n * Properly wraps a Promise as a {@link SafePromise} with .catch(fallback).\n */\nexport function asSafePromise<Resolved, Rejected>(promise: Promise<Resolved>, fallback: (error: unknown) => Rejected) {\n  return promise.catch(fallback) as SafePromise<Resolved | Rejected>;\n}","import type { UnknownAction } from '@reduxjs/toolkit';\nimport type { BaseQueryFn } from './baseQueryTypes';\nimport type { CombinedState, CoreModule, QueryKeys } from './core';\nimport type { ApiModules } from './core/module';\nimport type { CreateApiOptions } from './createApi';\nimport type { EndpointBuilder, EndpointDefinition, EndpointDefinitions, UpdateDefinitions } from './endpointDefinitions';\nimport type { NoInfer, UnionToIntersection, WithRequiredProp } from './tsHelpers';\nexport type ModuleName = keyof ApiModules<any, any, any, any>;\nexport type Module<Name extends ModuleName> = {\n  name: Name;\n  init<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string>(api: Api<BaseQuery, EndpointDefinitions, ReducerPath, TagTypes, ModuleName>, options: WithRequiredProp<CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>, 'reducerPath' | 'serializeQueryArgs' | 'keepUnusedDataFor' | 'refetchOnMountOrArgChange' | 'refetchOnFocus' | 'refetchOnReconnect' | 'invalidationBehavior' | 'tagTypes'>, context: ApiContext<Definitions>): {\n    injectEndpoint(endpointName: string, definition: EndpointDefinition<any, any, any, any>): void;\n  };\n};\nexport interface ApiContext<Definitions extends EndpointDefinitions> {\n  apiUid: string;\n  endpointDefinitions: Definitions;\n  batch(cb: () => void): void;\n  extractRehydrationInfo: (action: UnknownAction) => CombinedState<any, any, any> | undefined;\n  hasRehydrationInfo: (action: UnknownAction) => boolean;\n}\nexport const getEndpointDefinition = <Definitions extends EndpointDefinitions, EndpointName extends keyof Definitions>(context: ApiContext<Definitions>, endpointName: EndpointName) => context.endpointDefinitions[endpointName];\nexport type Api<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string, Enhancers extends ModuleName = CoreModule> = UnionToIntersection<ApiModules<BaseQuery, Definitions, ReducerPath, TagTypes>[Enhancers]> & {\n  /**\n   * A function to inject the endpoints into the original API, but also give you that same API with correct types for these endpoints back. Useful with code-splitting.\n   */\n  injectEndpoints<NewDefinitions extends EndpointDefinitions>(_: {\n    endpoints: (build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>) => NewDefinitions;\n    /**\n     * Optionally allows endpoints to be overridden if defined by multiple `injectEndpoints` calls.\n     *\n     * If set to `true`, will override existing endpoints with the new definition.\n     * If set to `'throw'`, will throw an error if an endpoint is redefined with a different definition.\n     * If set to `false` (or unset), will not override existing endpoints with the new definition, and log a warning in development.\n     */\n    overrideExisting?: boolean | 'throw';\n  }): Api<BaseQuery, Definitions & NewDefinitions, ReducerPath, TagTypes, Enhancers>;\n  /**\n   *A function to enhance a generated API with additional information. Useful with code-generation.\n   */\n  enhanceEndpoints<NewTagTypes extends string = never, NewDefinitions extends EndpointDefinitions = never>(_: {\n    addTagTypes?: readonly NewTagTypes[];\n    endpoints?: UpdateDefinitions<Definitions, TagTypes | NoInfer<NewTagTypes>, NewDefinitions> extends infer NewDefinitions ? { [K in keyof NewDefinitions]?: Partial<NewDefinitions[K]> | ((definition: NewDefinitions[K]) => void) } : never;\n  }): Api<BaseQuery, UpdateDefinitions<Definitions, TagTypes | NewTagTypes, NewDefinitions>, ReducerPath, TagTypes | NewTagTypes, Enhancers>;\n};","import type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { SchemaError } from '@standard-schema/utils';\nimport type { SchemaType } from './endpointDefinitions';\nexport class NamedSchemaError extends SchemaError {\n  constructor(issues: readonly StandardSchemaV1.Issue[], public readonly value: any, public readonly schemaName: `${SchemaType}Schema`, public readonly _bqMeta: any) {\n    super(issues);\n  }\n}\nexport const shouldSkip = (skipSchemaValidation: boolean | SchemaType[] | undefined, schemaName: SchemaType) => Array.isArray(skipSchemaValidation) ? skipSchemaValidation.includes(schemaName) : !!skipSchemaValidation;\nexport async function parseWithSchema<Schema extends StandardSchemaV1>(schema: Schema, data: unknown, schemaName: `${SchemaType}Schema`, bqMeta: any): Promise<StandardSchemaV1.InferOutput<Schema>> {\n  const result = await schema['~standard'].validate(data);\n  if (result.issues) {\n    throw new NamedSchemaError(result.issues, data, schemaName, bqMeta);\n  }\n  return result.value;\n}","import type { AsyncThunk, AsyncThunkPayloadCreator, Draft, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { Patch } from 'immer';\nimport { isDraftable, produceWithPatches } from '../utils/immerImports';\nimport type { Api, ApiContext } from '../apiTypes';\nimport type { BaseQueryError, BaseQueryFn, QueryReturnValue } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { AssertTagTypes, EndpointDefinition, EndpointDefinitions, InfiniteQueryArgFrom, InfiniteQueryCombinedArg, InfiniteQueryDefinition, MutationDefinition, PageParamFrom, QueryArgFrom, QueryDefinition, ResultDescription, ResultTypeFrom, SchemaFailureConverter, SchemaFailureHandler, SchemaFailureInfo, SchemaType } from '../endpointDefinitions';\nimport { calculateProvidedBy, ENDPOINT_QUERY, isInfiniteQueryDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { HandledError } from '../HandledError';\nimport type { UnwrapPromise } from '../tsHelpers';\nimport type { RootState, QueryKeys, QuerySubstateIdentifier, InfiniteData, InfiniteQueryConfigOptions, QueryCacheKey, InfiniteQueryDirection, InfiniteQueryKeys } from './apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from './apiState';\nimport type { InfiniteQueryActionCreatorResult, QueryActionCreatorResult, StartInfiniteQueryActionCreatorOptions, StartQueryActionCreatorOptions } from './buildInitiate';\nimport { forceQueryFnSymbol, isUpsertQuery } from './buildInitiate';\nimport type { AllSelectors } from './buildSelectors';\nimport type { ApiEndpointQuery, PrefetchOptions } from './module';\nimport { createAsyncThunk, isAllOf, isFulfilled, isPending, isRejected, isRejectedWithValue, SHOULD_AUTOBATCH } from './rtkImports';\nimport { parseWithSchema, NamedSchemaError, shouldSkip } from '../standardSchema';\nexport type BuildThunksApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>> = Matchers<QueryThunk, Definition>;\nexport type BuildThunksApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = Matchers<InfiniteQueryThunk<any>, Definition>;\nexport type BuildThunksApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>> = Matchers<MutationThunk, Definition>;\ntype EndpointThunk<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = Definition extends EndpointDefinition<infer QueryArg, infer BaseQueryFn, any, infer ResultType> ? Thunk extends AsyncThunk<unknown, infer ATArg, infer ATConfig> ? AsyncThunk<ResultType, ATArg & {\n  originalArgs: QueryArg;\n}, ATConfig & {\n  rejectValue: BaseQueryError<BaseQueryFn>;\n}> : never : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQueryFn, any, infer ResultType> ? Thunk extends AsyncThunk<unknown, infer ATArg, infer ATConfig> ? AsyncThunk<InfiniteData<ResultType, PageParam>, ATArg & {\n  originalArgs: QueryArg;\n}, ATConfig & {\n  rejectValue: BaseQueryError<BaseQueryFn>;\n}> : never : never;\nexport type PendingAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['pending']>;\nexport type FulfilledAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['fulfilled']>;\nexport type RejectedAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['rejected']>;\nexport type Matcher<M> = (value: any) => value is M;\nexport interface Matchers<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> {\n  matchPending: Matcher<PendingAction<Thunk, Definition>>;\n  matchFulfilled: Matcher<FulfilledAction<Thunk, Definition>>;\n  matchRejected: Matcher<RejectedAction<Thunk, Definition>>;\n}\nexport type QueryThunkArg = QuerySubstateIdentifier & StartQueryActionCreatorOptions & {\n  type: 'query';\n  originalArgs: unknown;\n  endpointName: string;\n};\nexport type InfiniteQueryThunkArg<D extends InfiniteQueryDefinition<any, any, any, any, any>> = QuerySubstateIdentifier & StartInfiniteQueryActionCreatorOptions<D> & {\n  type: `query`;\n  originalArgs: unknown;\n  endpointName: string;\n  param: unknown;\n  direction?: InfiniteQueryDirection;\n  refetchCachedPages?: boolean;\n};\ntype MutationThunkArg = {\n  type: 'mutation';\n  originalArgs: unknown;\n  endpointName: string;\n  track?: boolean;\n  fixedCacheKey?: string;\n};\nexport type ThunkResult = unknown;\nexport type ThunkApiMetaConfig = {\n  pendingMeta: {\n    startedTimeStamp: number;\n    [SHOULD_AUTOBATCH]: true;\n  };\n  fulfilledMeta: {\n    fulfilledTimeStamp: number;\n    baseQueryMeta: unknown;\n    [SHOULD_AUTOBATCH]: true;\n  };\n  rejectedMeta: {\n    baseQueryMeta: unknown;\n    [SHOULD_AUTOBATCH]: true;\n  };\n};\nexport type QueryThunk = AsyncThunk<ThunkResult, QueryThunkArg, ThunkApiMetaConfig>;\nexport type InfiniteQueryThunk<D extends InfiniteQueryDefinition<any, any, any, any, any>> = AsyncThunk<ThunkResult, InfiniteQueryThunkArg<D>, ThunkApiMetaConfig>;\nexport type MutationThunk = AsyncThunk<ThunkResult, MutationThunkArg, ThunkApiMetaConfig>;\nfunction defaultTransformResponse(baseQueryReturnValue: unknown) {\n  return baseQueryReturnValue;\n}\nexport type MaybeDrafted<T> = T | Draft<T>;\nexport type Recipe<T> = (data: MaybeDrafted<T>) => void | MaybeDrafted<T>;\nexport type UpsertRecipe<T> = (data: MaybeDrafted<T> | undefined) => void | MaybeDrafted<T>;\nexport type PatchQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFrom<Definitions[EndpointName]>, patches: readonly Patch[], updateProvided?: boolean) => ThunkAction<void, PartialState, any, UnknownAction>;\nexport type AllQueryKeys<Definitions extends EndpointDefinitions> = QueryKeys<Definitions> | InfiniteQueryKeys<Definitions>;\nexport type QueryArgFromAnyQueryDefinition<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryArgFrom<Definitions[EndpointName]> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? QueryArgFrom<Definitions[EndpointName]> : never;\nexport type DataFromAnyQueryDefinition<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteData<ResultTypeFrom<Definitions[EndpointName]>, PageParamFrom<Definitions[EndpointName]>> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? ResultTypeFrom<Definitions[EndpointName]> : unknown;\nexport type UpsertThunkResult<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryActionCreatorResult<Definitions[EndpointName]> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? QueryActionCreatorResult<Definitions[EndpointName]> : QueryActionCreatorResult<never>;\nexport type UpdateQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>, updateRecipe: Recipe<DataFromAnyQueryDefinition<Definitions, EndpointName>>, updateProvided?: boolean) => ThunkAction<PatchCollection, PartialState, any, UnknownAction>;\nexport type UpsertQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>, value: DataFromAnyQueryDefinition<Definitions, EndpointName>) => ThunkAction<UpsertThunkResult<Definitions, EndpointName>, PartialState, any, UnknownAction>;\n\n/**\n * An object returned from dispatching a `api.util.updateQueryData` call.\n */\nexport type PatchCollection = {\n  /**\n   * An `immer` Patch describing the cache update.\n   */\n  patches: Patch[];\n  /**\n   * An `immer` Patch to revert the cache update.\n   */\n  inversePatches: Patch[];\n  /**\n   * A function that will undo the cache update.\n   */\n  undo: () => void;\n};\ntype TransformCallback = (baseQueryReturnValue: unknown, meta: unknown, arg: unknown) => any;\nexport const addShouldAutoBatch = <T extends Record<string, any>,>(arg: T = {} as T): T & {\n  [SHOULD_AUTOBATCH]: true;\n} => {\n  return {\n    ...arg,\n    [SHOULD_AUTOBATCH]: true\n  };\n};\nexport function buildThunks<BaseQuery extends BaseQueryFn, ReducerPath extends string, Definitions extends EndpointDefinitions>({\n  reducerPath,\n  baseQuery,\n  context: {\n    endpointDefinitions\n  },\n  serializeQueryArgs,\n  api,\n  assertTagType,\n  selectors,\n  onSchemaFailure,\n  catchSchemaFailure: globalCatchSchemaFailure,\n  skipSchemaValidation: globalSkipSchemaValidation\n}: {\n  baseQuery: BaseQuery;\n  reducerPath: ReducerPath;\n  context: ApiContext<Definitions>;\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  api: Api<BaseQuery, Definitions, ReducerPath, any>;\n  assertTagType: AssertTagTypes;\n  selectors: AllSelectors;\n  onSchemaFailure: SchemaFailureHandler | undefined;\n  catchSchemaFailure: SchemaFailureConverter<BaseQuery> | undefined;\n  skipSchemaValidation: boolean | SchemaType[] | undefined;\n}) {\n  type State = RootState<any, string, ReducerPath>;\n  const patchQueryData: PatchQueryDataThunk<EndpointDefinitions, State> = (endpointName, arg, patches, updateProvided) => (dispatch, getState) => {\n    const endpointDefinition = endpointDefinitions[endpointName];\n    const queryCacheKey = serializeQueryArgs({\n      queryArgs: arg,\n      endpointDefinition,\n      endpointName\n    });\n    dispatch(api.internalActions.queryResultPatched({\n      queryCacheKey,\n      patches\n    }));\n    if (!updateProvided) {\n      return;\n    }\n    const newValue = api.endpoints[endpointName].select(arg)(\n    // Work around TS 4.1 mismatch\n    getState() as RootState<any, any, any>);\n    const providedTags = calculateProvidedBy(endpointDefinition.providesTags, newValue.data, undefined, arg, {}, assertTagType);\n    dispatch(api.internalActions.updateProvidedBy([{\n      queryCacheKey,\n      providedTags\n    }]));\n  };\n  function addToStart<T>(items: Array<T>, item: T, max = 0): Array<T> {\n    const newItems = [item, ...items];\n    return max && newItems.length > max ? newItems.slice(0, -1) : newItems;\n  }\n  function addToEnd<T>(items: Array<T>, item: T, max = 0): Array<T> {\n    const newItems = [...items, item];\n    return max && newItems.length > max ? newItems.slice(1) : newItems;\n  }\n  const updateQueryData: UpdateQueryDataThunk<EndpointDefinitions, State> = (endpointName, arg, updateRecipe, updateProvided = true) => (dispatch, getState) => {\n    const endpointDefinition = api.endpoints[endpointName];\n    const currentState = endpointDefinition.select(arg)(\n    // Work around TS 4.1 mismatch\n    getState() as RootState<any, any, any>);\n    const ret: PatchCollection = {\n      patches: [],\n      inversePatches: [],\n      undo: () => dispatch(api.util.patchQueryData(endpointName, arg, ret.inversePatches, updateProvided))\n    };\n    if (currentState.status === STATUS_UNINITIALIZED) {\n      return ret;\n    }\n    let newValue;\n    if ('data' in currentState) {\n      if (isDraftable(currentState.data)) {\n        const [value, patches, inversePatches] = produceWithPatches(currentState.data, updateRecipe);\n        ret.patches.push(...patches);\n        ret.inversePatches.push(...inversePatches);\n        newValue = value;\n      } else {\n        newValue = updateRecipe(currentState.data);\n        ret.patches.push({\n          op: 'replace',\n          path: [],\n          value: newValue\n        });\n        ret.inversePatches.push({\n          op: 'replace',\n          path: [],\n          value: currentState.data\n        });\n      }\n    }\n    if (ret.patches.length === 0) {\n      return ret;\n    }\n    dispatch(api.util.patchQueryData(endpointName, arg, ret.patches, updateProvided));\n    return ret;\n  };\n  const upsertQueryData: UpsertQueryDataThunk<Definitions, State> = (endpointName, arg, value) => dispatch => {\n    type EndpointName = typeof endpointName;\n    const res = dispatch((api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>).initiate(arg, {\n      subscribe: false,\n      forceRefetch: true,\n      [forceQueryFnSymbol]: () => ({\n        data: value\n      })\n    })) as UpsertThunkResult<Definitions, EndpointName>;\n    return res;\n  };\n  const getTransformCallbackForEndpoint = (endpointDefinition: EndpointDefinition<any, any, any, any>, transformFieldName: 'transformResponse' | 'transformErrorResponse'): TransformCallback => {\n    return endpointDefinition.query && endpointDefinition[transformFieldName] ? endpointDefinition[transformFieldName]! as TransformCallback : defaultTransformResponse;\n  };\n\n  // The generic async payload function for all of our thunks\n  const executeEndpoint: AsyncThunkPayloadCreator<ThunkResult, QueryThunkArg | MutationThunkArg | InfiniteQueryThunkArg<any>, ThunkApiMetaConfig & {\n    state: RootState<any, string, ReducerPath>;\n  }> = async (arg, {\n    signal,\n    abort,\n    rejectWithValue,\n    fulfillWithValue,\n    dispatch,\n    getState,\n    extra\n  }) => {\n    const endpointDefinition = endpointDefinitions[arg.endpointName];\n    const {\n      metaSchema,\n      skipSchemaValidation = globalSkipSchemaValidation\n    } = endpointDefinition;\n    const isQuery = arg.type === ENDPOINT_QUERY;\n    try {\n      let transformResponse: TransformCallback = defaultTransformResponse;\n      const baseQueryApi = {\n        signal,\n        abort,\n        dispatch,\n        getState,\n        extra,\n        endpoint: arg.endpointName,\n        type: arg.type,\n        forced: isQuery ? isForcedQuery(arg, getState()) : undefined,\n        queryCacheKey: isQuery ? arg.queryCacheKey : undefined\n      };\n      const forceQueryFn = isQuery ? arg[forceQueryFnSymbol] : undefined;\n      let finalQueryReturnValue: QueryReturnValue;\n\n      // Infinite query wrapper, which executes the request and returns\n      // the InfiniteData `{pages, pageParams}` structure\n      const fetchPage = async (data: InfiniteData<unknown, unknown>, param: unknown, maxPages: number, previous?: boolean): Promise<QueryReturnValue> => {\n        // This should handle cases where there is no `getPrevPageParam`,\n        // or `getPPP` returned nullish\n        if (param == null && data.pages.length) {\n          return Promise.resolve({\n            data\n          });\n        }\n        const finalQueryArg: InfiniteQueryCombinedArg<any, any> = {\n          queryArg: arg.originalArgs,\n          pageParam: param\n        };\n        const pageResponse = await executeRequest(finalQueryArg);\n        const addTo = previous ? addToStart : addToEnd;\n        return {\n          data: {\n            pages: addTo(data.pages, pageResponse.data, maxPages),\n            pageParams: addTo(data.pageParams, param, maxPages)\n          },\n          meta: pageResponse.meta\n        };\n      };\n\n      // Wrapper for executing either `query` or `queryFn`,\n      // and handling any errors\n      async function executeRequest(finalQueryArg: unknown): Promise<QueryReturnValue> {\n        let result: QueryReturnValue;\n        const {\n          extraOptions,\n          argSchema,\n          rawResponseSchema,\n          responseSchema\n        } = endpointDefinition;\n        if (argSchema && !shouldSkip(skipSchemaValidation, 'arg')) {\n          finalQueryArg = await parseWithSchema(argSchema, finalQueryArg, 'argSchema', {} // we don't have a meta yet, so we can't pass it\n          );\n        }\n        if (forceQueryFn) {\n          // upsertQueryData relies on this to pass in the user-provided value\n          result = forceQueryFn();\n        } else if (endpointDefinition.query) {\n          // We should only run `transformResponse` when the endpoint has a `query` method,\n          // and we're not doing an `upsertQueryData`.\n          transformResponse = getTransformCallbackForEndpoint(endpointDefinition, 'transformResponse');\n          result = await baseQuery(endpointDefinition.query(finalQueryArg as any), baseQueryApi, extraOptions as any);\n        } else {\n          result = await endpointDefinition.queryFn(finalQueryArg as any, baseQueryApi, extraOptions as any, arg => baseQuery(arg, baseQueryApi, extraOptions as any));\n        }\n        if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n          const what = endpointDefinition.query ? '`baseQuery`' : '`queryFn`';\n          let err: undefined | string;\n          if (!result) {\n            err = `${what} did not return anything.`;\n          } else if (typeof result !== 'object') {\n            err = `${what} did not return an object.`;\n          } else if (result.error && result.data) {\n            err = `${what} returned an object containing both \\`error\\` and \\`result\\`.`;\n          } else if (result.error === undefined && result.data === undefined) {\n            err = `${what} returned an object containing neither a valid \\`error\\` and \\`result\\`. At least one of them should not be \\`undefined\\``;\n          } else {\n            for (const key of Object.keys(result)) {\n              if (key !== 'error' && key !== 'data' && key !== 'meta') {\n                err = `The object returned by ${what} has the unknown property ${key}.`;\n                break;\n              }\n            }\n          }\n          if (err) {\n            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);\n          }\n        }\n        if (result.error) throw new HandledError(result.error, result.meta);\n        let {\n          data\n        } = result;\n        if (rawResponseSchema && !shouldSkip(skipSchemaValidation, 'rawResponse')) {\n          data = await parseWithSchema(rawResponseSchema, result.data, 'rawResponseSchema', result.meta);\n        }\n        let transformedResponse = await transformResponse(data, result.meta, finalQueryArg);\n        if (responseSchema && !shouldSkip(skipSchemaValidation, 'response')) {\n          transformedResponse = await parseWithSchema(responseSchema, transformedResponse, 'responseSchema', result.meta);\n        }\n        return {\n          ...result,\n          data: transformedResponse\n        };\n      }\n      if (isQuery && 'infiniteQueryOptions' in endpointDefinition) {\n        // This is an infinite query endpoint\n        const {\n          infiniteQueryOptions\n        } = endpointDefinition;\n\n        // Runtime checks should guarantee this is a positive number if provided\n        const {\n          maxPages = Infinity\n        } = infiniteQueryOptions;\n\n        // Priority: per-call override > endpoint config > default (true)\n        const refetchCachedPages = (arg as InfiniteQueryThunkArg<any>).refetchCachedPages ?? infiniteQueryOptions.refetchCachedPages ?? true;\n        let result: QueryReturnValue;\n\n        // Start by looking up the existing InfiniteData value from state,\n        // falling back to an empty value if it doesn't exist yet\n        const blankData = {\n          pages: [],\n          pageParams: []\n        };\n        const cachedData = selectors.selectQueryEntry(getState(), arg.queryCacheKey)?.data as InfiniteData<unknown, unknown> | undefined;\n\n        // When the arg changes or the user forces a refetch,\n        // we don't include the `direction` flag. This lets us distinguish\n        // between actually refetching with a forced query, vs just fetching\n        // the next page.\n        const isForcedQueryNeedingRefetch =\n        // arg.forceRefetch\n        isForcedQuery(arg, getState()) && !(arg as InfiniteQueryThunkArg<any>).direction;\n        const existingData = (isForcedQueryNeedingRefetch || !cachedData ? blankData : cachedData) as InfiniteData<unknown, unknown>;\n\n        // If the thunk specified a direction and we do have at least one page,\n        // fetch the next or previous page\n        if ('direction' in arg && arg.direction && existingData.pages.length) {\n          const previous = arg.direction === 'backward';\n          const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;\n          const param = pageParamFn(infiniteQueryOptions, existingData, arg.originalArgs);\n          result = await fetchPage(existingData, param, maxPages, previous);\n        } else {\n          // Otherwise, fetch the first page and then any remaining pages\n\n          const {\n            initialPageParam = infiniteQueryOptions.initialPageParam\n          } = arg as InfiniteQueryThunkArg<any>;\n\n          // If we're doing a refetch, we should start from\n          // the first page we have cached.\n          // Otherwise, we should start from the initialPageParam\n          const cachedPageParams = cachedData?.pageParams ?? [];\n          const firstPageParam = cachedPageParams[0] ?? initialPageParam;\n          const totalPages = cachedPageParams.length;\n\n          // Fetch first page\n          result = await fetchPage(existingData, firstPageParam, maxPages);\n          if (forceQueryFn) {\n            // HACK `upsertQueryData` expects the user to pass in the `{pages, pageParams}` structure,\n            // but `fetchPage` treats that as `pages[0]`. We have to manually un-nest it.\n            result = {\n              data: (result.data as InfiniteData<unknown, unknown>).pages[0]\n            } as QueryReturnValue;\n          }\n          if (refetchCachedPages) {\n            // Fetch remaining pages\n            for (let i = 1; i < totalPages; i++) {\n              const param = getNextPageParam(infiniteQueryOptions, result.data as InfiniteData<unknown, unknown>, arg.originalArgs);\n              result = await fetchPage(result.data as InfiniteData<unknown, unknown>, param, maxPages);\n            }\n          }\n        }\n        finalQueryReturnValue = result;\n      } else {\n        // Non-infinite endpoint. Just run the one request.\n        finalQueryReturnValue = await executeRequest(arg.originalArgs);\n      }\n      if (metaSchema && !shouldSkip(skipSchemaValidation, 'meta') && finalQueryReturnValue.meta) {\n        finalQueryReturnValue.meta = await parseWithSchema(metaSchema, finalQueryReturnValue.meta, 'metaSchema', finalQueryReturnValue.meta);\n      }\n\n      // console.log('Final result: ', transformedData)\n      return fulfillWithValue(finalQueryReturnValue.data, addShouldAutoBatch({\n        fulfilledTimeStamp: Date.now(),\n        baseQueryMeta: finalQueryReturnValue.meta\n      }));\n    } catch (error) {\n      let caughtError = error;\n      if (caughtError instanceof HandledError) {\n        let transformErrorResponse = getTransformCallbackForEndpoint(endpointDefinition, 'transformErrorResponse');\n        const {\n          rawErrorResponseSchema,\n          errorResponseSchema\n        } = endpointDefinition;\n        let {\n          value,\n          meta\n        } = caughtError;\n        try {\n          if (rawErrorResponseSchema && !shouldSkip(skipSchemaValidation, 'rawErrorResponse')) {\n            value = await parseWithSchema(rawErrorResponseSchema, value, 'rawErrorResponseSchema', meta);\n          }\n          if (metaSchema && !shouldSkip(skipSchemaValidation, 'meta')) {\n            meta = await parseWithSchema(metaSchema, meta, 'metaSchema', meta);\n          }\n          let transformedErrorResponse = await transformErrorResponse(value, meta, arg.originalArgs);\n          if (errorResponseSchema && !shouldSkip(skipSchemaValidation, 'errorResponse')) {\n            transformedErrorResponse = await parseWithSchema(errorResponseSchema, transformedErrorResponse, 'errorResponseSchema', meta);\n          }\n          return rejectWithValue(transformedErrorResponse, addShouldAutoBatch({\n            baseQueryMeta: meta\n          }));\n        } catch (e) {\n          caughtError = e;\n        }\n      }\n      try {\n        if (caughtError instanceof NamedSchemaError) {\n          const info: SchemaFailureInfo = {\n            endpoint: arg.endpointName,\n            arg: arg.originalArgs,\n            type: arg.type,\n            queryCacheKey: isQuery ? arg.queryCacheKey : undefined\n          };\n          endpointDefinition.onSchemaFailure?.(caughtError, info);\n          onSchemaFailure?.(caughtError, info);\n          const {\n            catchSchemaFailure = globalCatchSchemaFailure\n          } = endpointDefinition;\n          if (catchSchemaFailure) {\n            return rejectWithValue(catchSchemaFailure(caughtError, info), addShouldAutoBatch({\n              baseQueryMeta: caughtError._bqMeta\n            }));\n          }\n        }\n      } catch (e) {\n        caughtError = e;\n      }\n      if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production') {\n        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\".`, caughtError);\n      } else {\n        console.error(caughtError);\n      }\n      throw caughtError;\n    }\n  };\n  function isForcedQuery(arg: QueryThunkArg, state: RootState<any, string, ReducerPath>) {\n    const requestState = selectors.selectQueryEntry(state, arg.queryCacheKey);\n    const baseFetchOnMountOrArgChange = selectors.selectConfig(state).refetchOnMountOrArgChange;\n    const fulfilledVal = requestState?.fulfilledTimeStamp;\n    const refetchVal = arg.forceRefetch ?? (arg.subscribe && baseFetchOnMountOrArgChange);\n    if (refetchVal) {\n      // Return if it's true or compare the dates because it must be a number\n      return refetchVal === true || (Number(new Date()) - Number(fulfilledVal)) / 1000 >= refetchVal;\n    }\n    return false;\n  }\n  const createQueryThunk = <ThunkArgType extends QueryThunkArg | InfiniteQueryThunkArg<any>,>() => {\n    const generatedQueryThunk = createAsyncThunk<ThunkResult, ThunkArgType, ThunkApiMetaConfig & {\n      state: RootState<any, string, ReducerPath>;\n    }>(`${reducerPath}/executeQuery`, executeEndpoint, {\n      getPendingMeta({\n        arg\n      }) {\n        const endpointDefinition = endpointDefinitions[arg.endpointName];\n        return addShouldAutoBatch({\n          startedTimeStamp: Date.now(),\n          ...(isInfiniteQueryDefinition(endpointDefinition) ? {\n            direction: (arg as InfiniteQueryThunkArg<any>).direction\n          } : {})\n        });\n      },\n      condition(queryThunkArg, {\n        getState\n      }) {\n        const state = getState();\n        const requestState = selectors.selectQueryEntry(state, queryThunkArg.queryCacheKey);\n        const fulfilledVal = requestState?.fulfilledTimeStamp;\n        const currentArg = queryThunkArg.originalArgs;\n        const previousArg = requestState?.originalArgs;\n        const endpointDefinition = endpointDefinitions[queryThunkArg.endpointName];\n        const direction = (queryThunkArg as InfiniteQueryThunkArg<any>).direction;\n\n        // Order of these checks matters.\n        // In order for `upsertQueryData` to successfully run while an existing request is in flight,\n        /// we have to check for that first, otherwise `queryThunk` will bail out and not run at all.\n        if (isUpsertQuery(queryThunkArg)) {\n          return true;\n        }\n\n        // Don't retry a request that's currently in-flight\n        if (requestState?.status === 'pending') {\n          return false;\n        }\n\n        // if this is forced, continue\n        if (isForcedQuery(queryThunkArg, state)) {\n          return true;\n        }\n        if (isQueryDefinition(endpointDefinition) && endpointDefinition?.forceRefetch?.({\n          currentArg,\n          previousArg,\n          endpointState: requestState,\n          state\n        })) {\n          return true;\n        }\n\n        // Pull from the cache unless we explicitly force refetch or qualify based on time\n        if (fulfilledVal && !direction) {\n          // Value is cached and we didn't specify to refresh, skip it.\n          return false;\n        }\n        return true;\n      },\n      dispatchConditionRejection: true\n    });\n    return generatedQueryThunk;\n  };\n  const queryThunk = createQueryThunk<QueryThunkArg>();\n  const infiniteQueryThunk = createQueryThunk<InfiniteQueryThunkArg<any>>();\n  const mutationThunk = createAsyncThunk<ThunkResult, MutationThunkArg, ThunkApiMetaConfig & {\n    state: RootState<any, string, ReducerPath>;\n  }>(`${reducerPath}/executeMutation`, executeEndpoint, {\n    getPendingMeta() {\n      return addShouldAutoBatch({\n        startedTimeStamp: Date.now()\n      });\n    }\n  });\n  const hasTheForce = (options: any): options is {\n    force: boolean;\n  } => 'force' in options;\n  const hasMaxAge = (options: any): options is {\n    ifOlderThan: false | number;\n  } => 'ifOlderThan' in options;\n  const prefetch = <EndpointName extends QueryKeys<Definitions>,>(endpointName: EndpointName, arg: any, options: PrefetchOptions = {}): ThunkAction<void, any, any, UnknownAction> => (dispatch: ThunkDispatch<any, any, any>, getState: () => any) => {\n    const force = hasTheForce(options) && options.force;\n    const maxAge = hasMaxAge(options) && options.ifOlderThan;\n    const queryAction = (force: boolean = true) => {\n      const options: StartQueryActionCreatorOptions = {\n        forceRefetch: force,\n        subscribe: false\n      };\n      return (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).initiate(arg, options);\n    };\n    const latestStateValue = (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).select(arg)(getState());\n    if (force) {\n      dispatch(queryAction());\n    } else if (maxAge) {\n      const lastFulfilledTs = latestStateValue?.fulfilledTimeStamp;\n      if (!lastFulfilledTs) {\n        dispatch(queryAction());\n        return;\n      }\n      const shouldRetrigger = (Number(new Date()) - Number(new Date(lastFulfilledTs))) / 1000 >= maxAge;\n      if (shouldRetrigger) {\n        dispatch(queryAction());\n      }\n    } else {\n      // If prefetching with no options, just let it try\n      dispatch(queryAction(false));\n    }\n  };\n  function matchesEndpoint(endpointName: string) {\n    return (action: any): action is UnknownAction => action?.meta?.arg?.endpointName === endpointName;\n  }\n  function buildMatchThunkActions<Thunk extends AsyncThunk<any, QueryThunkArg, ThunkApiMetaConfig> | AsyncThunk<any, MutationThunkArg, ThunkApiMetaConfig>>(thunk: Thunk, endpointName: string) {\n    return {\n      matchPending: isAllOf(isPending(thunk), matchesEndpoint(endpointName)),\n      matchFulfilled: isAllOf(isFulfilled(thunk), matchesEndpoint(endpointName)),\n      matchRejected: isAllOf(isRejected(thunk), matchesEndpoint(endpointName))\n    } as Matchers<Thunk, any>;\n  }\n  return {\n    queryThunk,\n    mutationThunk,\n    infiniteQueryThunk,\n    prefetch,\n    updateQueryData,\n    upsertQueryData,\n    patchQueryData,\n    buildMatchThunkActions\n  };\n}\nexport function getNextPageParam(options: InfiniteQueryConfigOptions<unknown, unknown, unknown>, {\n  pages,\n  pageParams\n}: InfiniteData<unknown, unknown>, queryArg: unknown): unknown | undefined {\n  const lastIndex = pages.length - 1;\n  return options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams, queryArg);\n}\nexport function getPreviousPageParam(options: InfiniteQueryConfigOptions<unknown, unknown, unknown>, {\n  pages,\n  pageParams\n}: InfiniteData<unknown, unknown>, queryArg: unknown): unknown | undefined {\n  return options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams, queryArg);\n}\nexport function calculateProvidedByThunk(action: UnwrapPromise<ReturnType<ReturnType<QueryThunk>> | ReturnType<ReturnType<MutationThunk>> | ReturnType<ReturnType<InfiniteQueryThunk<any>>>>, type: 'providesTags' | 'invalidatesTags', endpointDefinitions: EndpointDefinitions, assertTagType: AssertTagTypes) {\n  return calculateProvidedBy(endpointDefinitions[action.meta.arg.endpointName][type] as ResultDescription<any, any, any, any, any>, isFulfilled(action) ? action.payload : undefined, isRejectedWithValue(action) ? action.payload : undefined, action.meta.arg.originalArgs, 'baseQueryMeta' in action.meta ? action.meta.baseQueryMeta : undefined, assertTagType);\n}","import type { Draft } from 'immer';\nimport { current, isDraft } from '../utils/immerImports';\nexport function getCurrent<T>(value: T | Draft<T>): T {\n  return (isDraft(value) ? current(value) : value) as T;\n}","import type { PayloadAction } from '@reduxjs/toolkit';\nimport { combineReducers, createAction, createSlice, isAnyOf, isFulfilled, isRejectedWithValue, createNextState, prepareAutoBatched, SHOULD_AUTOBATCH, nanoid } from './rtkImports';\nimport type { QuerySubstateIdentifier, QuerySubState, MutationSubstateIdentifier, MutationSubState, MutationState, QueryState, InvalidationState, Subscribers, QueryCacheKey, SubscriptionState, ConfigState, InfiniteQuerySubState, InfiniteQueryDirection } from './apiState';\nimport { STATUS_FULFILLED, STATUS_PENDING, QueryStatus, STATUS_REJECTED, STATUS_UNINITIALIZED } from './apiState';\nimport type { AllQueryKeys, QueryArgFromAnyQueryDefinition, DataFromAnyQueryDefinition, InfiniteQueryThunk, MutationThunk, QueryThunk, QueryThunkArg } from './buildThunks';\nimport { calculateProvidedByThunk } from './buildThunks';\nimport { ENDPOINT_QUERY, isInfiniteQueryDefinition, type AssertTagTypes, type EndpointDefinitions, type FullTagDescription, type QueryDefinition } from '../endpointDefinitions';\nimport type { Patch } from 'immer';\nimport { applyPatches, original, isDraft } from '../utils/immerImports';\nimport { onFocus, onFocusLost, onOffline, onOnline } from './setupListeners';\nimport { isDocumentVisible, isOnline, copyWithStructuralSharing } from '../utils';\nimport type { ApiContext } from '../apiTypes';\nimport { isUpsertQuery } from './buildInitiate';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { UnwrapPromise } from '../tsHelpers';\nimport { getCurrent } from '../utils/getCurrent';\n\n/**\n * A typesafe single entry to be upserted into the cache\n */\nexport type NormalizedQueryUpsertEntry<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = {\n  endpointName: EndpointName;\n  arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>;\n  value: DataFromAnyQueryDefinition<Definitions, EndpointName>;\n};\n\n/**\n * The internal version that is not typesafe since we can't carry the generics through `createSlice`\n */\ntype NormalizedQueryUpsertEntryPayload = {\n  endpointName: string;\n  arg: unknown;\n  value: unknown;\n};\nexport type ProcessedQueryUpsertEntry = {\n  queryDescription: QueryThunkArg;\n  value: unknown;\n};\n\n/**\n * A typesafe representation of a util action creator that accepts cache entry descriptions to upsert\n */\nexport type UpsertEntries<Definitions extends EndpointDefinitions> = (<EndpointNames extends Array<AllQueryKeys<Definitions>>>(entries: [...{ [I in keyof EndpointNames]: NormalizedQueryUpsertEntry<Definitions, EndpointNames[I]> }]) => PayloadAction<NormalizedQueryUpsertEntryPayload[]>) & {\n  match: (action: unknown) => action is PayloadAction<NormalizedQueryUpsertEntryPayload[]>;\n};\nfunction updateQuerySubstateIfExists(state: QueryState<any>, queryCacheKey: QueryCacheKey, update: (substate: QuerySubState<any> | InfiniteQuerySubState<any>) => void) {\n  const substate = state[queryCacheKey];\n  if (substate) {\n    update(substate);\n  }\n}\nexport function getMutationCacheKey(id: MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}): string;\nexport function getMutationCacheKey(id: {\n  fixedCacheKey?: string;\n  requestId?: string;\n}): string | undefined;\nexport function getMutationCacheKey(id: {\n  fixedCacheKey?: string;\n  requestId?: string;\n} | MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}): string | undefined {\n  return ('arg' in id ? id.arg.fixedCacheKey : id.fixedCacheKey) ?? id.requestId;\n}\nfunction updateMutationSubstateIfExists(state: MutationState<any>, id: MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}, update: (substate: MutationSubState<any>) => void) {\n  const substate = state[getMutationCacheKey(id)];\n  if (substate) {\n    update(substate);\n  }\n}\nconst initialState = {} as any;\nexport function buildSlice({\n  reducerPath,\n  queryThunk,\n  mutationThunk,\n  serializeQueryArgs,\n  context: {\n    endpointDefinitions: definitions,\n    apiUid,\n    extractRehydrationInfo,\n    hasRehydrationInfo\n  },\n  assertTagType,\n  config\n}: {\n  reducerPath: string;\n  queryThunk: QueryThunk;\n  infiniteQueryThunk: InfiniteQueryThunk<any>;\n  mutationThunk: MutationThunk;\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  context: ApiContext<EndpointDefinitions>;\n  assertTagType: AssertTagTypes;\n  config: Omit<ConfigState<string>, 'online' | 'focused' | 'middlewareRegistered'>;\n}) {\n  const resetApiState = createAction(`${reducerPath}/resetApiState`);\n  function writePendingCacheEntry(draft: QueryState<any>, arg: QueryThunkArg, upserting: boolean, meta: {\n    arg: QueryThunkArg;\n    requestId: string;\n    // requestStatus: 'pending'\n  } & {\n    startedTimeStamp: number;\n  }) {\n    draft[arg.queryCacheKey] ??= {\n      status: STATUS_UNINITIALIZED,\n      endpointName: arg.endpointName\n    };\n    updateQuerySubstateIfExists(draft, arg.queryCacheKey, substate => {\n      substate.status = STATUS_PENDING;\n      substate.requestId = upserting && substate.requestId ?\n      // for `upsertQuery` **updates**, keep the current `requestId`\n      substate.requestId :\n      // for normal queries or `upsertQuery` **inserts** always update the `requestId`\n      meta.requestId;\n      if (arg.originalArgs !== undefined) {\n        substate.originalArgs = arg.originalArgs;\n      }\n      substate.startedTimeStamp = meta.startedTimeStamp;\n      const endpointDefinition = definitions[meta.arg.endpointName];\n      if (isInfiniteQueryDefinition(endpointDefinition) && 'direction' in arg) {\n        ;\n        (substate as InfiniteQuerySubState<any>).direction = arg.direction as InfiniteQueryDirection;\n      }\n    });\n  }\n  function writeFulfilledCacheEntry(draft: QueryState<any>, meta: {\n    arg: QueryThunkArg;\n    requestId: string;\n  } & {\n    fulfilledTimeStamp: number;\n    baseQueryMeta: unknown;\n  }, payload: unknown, upserting: boolean) {\n    updateQuerySubstateIfExists(draft, meta.arg.queryCacheKey, substate => {\n      if (substate.requestId !== meta.requestId && !upserting) return;\n      const {\n        merge\n      } = definitions[meta.arg.endpointName] as QueryDefinition<any, any, any, any>;\n      substate.status = STATUS_FULFILLED;\n      if (merge) {\n        if (substate.data !== undefined) {\n          const {\n            fulfilledTimeStamp,\n            arg,\n            baseQueryMeta,\n            requestId\n          } = meta;\n          // There's existing cache data. Let the user merge it in themselves.\n          // We're already inside an Immer-powered reducer, and the user could just mutate `substate.data`\n          // themselves inside of `merge()`. But, they might also want to return a new value.\n          // Try to let Immer figure that part out, save the result, and assign it to `substate.data`.\n          let newData = createNextState(substate.data, draftSubstateData => {\n            // As usual with Immer, you can mutate _or_ return inside here, but not both\n            return merge(draftSubstateData, payload, {\n              arg: arg.originalArgs,\n              baseQueryMeta,\n              fulfilledTimeStamp,\n              requestId\n            });\n          });\n          substate.data = newData;\n        } else {\n          // Presumably a fresh request. Just cache the response data.\n          substate.data = payload;\n        }\n      } else {\n        // Assign or safely update the cache data.\n        substate.data = definitions[meta.arg.endpointName].structuralSharing ?? true ? copyWithStructuralSharing(isDraft(substate.data) ? original(substate.data) : substate.data, payload) : payload;\n      }\n      delete substate.error;\n      substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;\n    });\n  }\n  const querySlice = createSlice({\n    name: `${reducerPath}/queries`,\n    initialState: initialState as QueryState<any>,\n    reducers: {\n      removeQueryResult: {\n        reducer(draft, {\n          payload: {\n            queryCacheKey\n          }\n        }: PayloadAction<QuerySubstateIdentifier>) {\n          delete draft[queryCacheKey];\n        },\n        prepare: prepareAutoBatched<QuerySubstateIdentifier>()\n      },\n      cacheEntriesUpserted: {\n        reducer(draft, action: PayloadAction<ProcessedQueryUpsertEntry[], string, {\n          RTK_autoBatch: boolean;\n          requestId: string;\n          timestamp: number;\n        }>) {\n          for (const entry of action.payload) {\n            const {\n              queryDescription: arg,\n              value\n            } = entry;\n            writePendingCacheEntry(draft, arg, true, {\n              arg,\n              requestId: action.meta.requestId,\n              startedTimeStamp: action.meta.timestamp\n            });\n            writeFulfilledCacheEntry(draft, {\n              arg,\n              requestId: action.meta.requestId,\n              fulfilledTimeStamp: action.meta.timestamp,\n              baseQueryMeta: {}\n            }, value,\n            // We know we're upserting here\n            true);\n          }\n        },\n        prepare: (payload: NormalizedQueryUpsertEntryPayload[]) => {\n          const queryDescriptions: ProcessedQueryUpsertEntry[] = payload.map(entry => {\n            const {\n              endpointName,\n              arg,\n              value\n            } = entry;\n            const endpointDefinition = definitions[endpointName];\n            const queryDescription: QueryThunkArg = {\n              type: ENDPOINT_QUERY as 'query',\n              endpointName,\n              originalArgs: entry.arg,\n              queryCacheKey: serializeQueryArgs({\n                queryArgs: arg,\n                endpointDefinition,\n                endpointName\n              })\n            };\n            return {\n              queryDescription,\n              value\n            };\n          });\n          const result = {\n            payload: queryDescriptions,\n            meta: {\n              [SHOULD_AUTOBATCH]: true,\n              requestId: nanoid(),\n              timestamp: Date.now()\n            }\n          };\n          return result;\n        }\n      },\n      queryResultPatched: {\n        reducer(draft, {\n          payload: {\n            queryCacheKey,\n            patches\n          }\n        }: PayloadAction<QuerySubstateIdentifier & {\n          patches: readonly Patch[];\n        }>) {\n          updateQuerySubstateIfExists(draft, queryCacheKey, substate => {\n            substate.data = applyPatches(substate.data as any, patches.concat());\n          });\n        },\n        prepare: prepareAutoBatched<QuerySubstateIdentifier & {\n          patches: readonly Patch[];\n        }>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(queryThunk.pending, (draft, {\n        meta,\n        meta: {\n          arg\n        }\n      }) => {\n        const upserting = isUpsertQuery(arg);\n        writePendingCacheEntry(draft, arg, upserting, meta);\n      }).addCase(queryThunk.fulfilled, (draft, {\n        meta,\n        payload\n      }) => {\n        const upserting = isUpsertQuery(meta.arg);\n        writeFulfilledCacheEntry(draft, meta, payload, upserting);\n      }).addCase(queryThunk.rejected, (draft, {\n        meta: {\n          condition,\n          arg,\n          requestId\n        },\n        error,\n        payload\n      }) => {\n        updateQuerySubstateIfExists(draft, arg.queryCacheKey, substate => {\n          if (condition) {\n            // request was aborted due to condition (another query already running)\n          } else {\n            // request failed\n            if (substate.requestId !== requestId) return;\n            substate.status = STATUS_REJECTED;\n            substate.error = (payload ?? error) as any;\n          }\n        });\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          queries\n        } = extractRehydrationInfo(action)!;\n        for (const [key, entry] of Object.entries(queries)) {\n          if (\n          // do not rehydrate entries that were currently in flight.\n          entry?.status === STATUS_FULFILLED || entry?.status === STATUS_REJECTED) {\n            draft[key] = entry;\n          }\n        }\n      });\n    }\n  });\n  const mutationSlice = createSlice({\n    name: `${reducerPath}/mutations`,\n    initialState: initialState as MutationState<any>,\n    reducers: {\n      removeMutationResult: {\n        reducer(draft, {\n          payload\n        }: PayloadAction<MutationSubstateIdentifier>) {\n          const cacheKey = getMutationCacheKey(payload);\n          if (cacheKey in draft) {\n            delete draft[cacheKey];\n          }\n        },\n        prepare: prepareAutoBatched<MutationSubstateIdentifier>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(mutationThunk.pending, (draft, {\n        meta,\n        meta: {\n          requestId,\n          arg,\n          startedTimeStamp\n        }\n      }) => {\n        if (!arg.track) return;\n        draft[getMutationCacheKey(meta)] = {\n          requestId,\n          status: STATUS_PENDING,\n          endpointName: arg.endpointName,\n          startedTimeStamp\n        };\n      }).addCase(mutationThunk.fulfilled, (draft, {\n        payload,\n        meta\n      }) => {\n        if (!meta.arg.track) return;\n        updateMutationSubstateIfExists(draft, meta, substate => {\n          if (substate.requestId !== meta.requestId) return;\n          substate.status = STATUS_FULFILLED;\n          substate.data = payload;\n          substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;\n        });\n      }).addCase(mutationThunk.rejected, (draft, {\n        payload,\n        error,\n        meta\n      }) => {\n        if (!meta.arg.track) return;\n        updateMutationSubstateIfExists(draft, meta, substate => {\n          if (substate.requestId !== meta.requestId) return;\n          substate.status = STATUS_REJECTED;\n          substate.error = (payload ?? error) as any;\n        });\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          mutations\n        } = extractRehydrationInfo(action)!;\n        for (const [key, entry] of Object.entries(mutations)) {\n          if (\n          // do not rehydrate entries that were currently in flight.\n          (entry?.status === STATUS_FULFILLED || entry?.status === STATUS_REJECTED) &&\n          // only rehydrate endpoints that were persisted using a `fixedCacheKey`\n          key !== entry?.requestId) {\n            draft[key] = entry;\n          }\n        }\n      });\n    }\n  });\n  type CalculateProvidedByAction = UnwrapPromise<ReturnType<ReturnType<QueryThunk>> | ReturnType<ReturnType<InfiniteQueryThunk<any>>>>;\n  const initialInvalidationState: InvalidationState<string> = {\n    tags: {},\n    keys: {}\n  };\n  const invalidationSlice = createSlice({\n    name: `${reducerPath}/invalidation`,\n    initialState: initialInvalidationState,\n    reducers: {\n      updateProvidedBy: {\n        reducer(draft, action: PayloadAction<Array<{\n          queryCacheKey: QueryCacheKey;\n          providedTags: readonly FullTagDescription<string>[];\n        }>>) {\n          for (const {\n            queryCacheKey,\n            providedTags\n          } of action.payload) {\n            removeCacheKeyFromTags(draft, queryCacheKey);\n            for (const {\n              type,\n              id\n            } of providedTags) {\n              const subscribedQueries = (draft.tags[type] ??= {})[id || '__internal_without_id'] ??= [];\n              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);\n              if (!alreadySubscribed) {\n                subscribedQueries.push(queryCacheKey);\n              }\n            }\n\n            // Remove readonly from the providedTags array\n            draft.keys[queryCacheKey] = providedTags as FullTagDescription<string>[];\n          }\n        },\n        prepare: prepareAutoBatched<Array<{\n          queryCacheKey: QueryCacheKey;\n          providedTags: readonly FullTagDescription<string>[];\n        }>>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(querySlice.actions.removeQueryResult, (draft, {\n        payload: {\n          queryCacheKey\n        }\n      }) => {\n        removeCacheKeyFromTags(draft, queryCacheKey);\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          provided\n        } = extractRehydrationInfo(action)!;\n        for (const [type, incomingTags] of Object.entries(provided.tags ?? {})) {\n          for (const [id, cacheKeys] of Object.entries(incomingTags)) {\n            const subscribedQueries = (draft.tags[type] ??= {})[id || '__internal_without_id'] ??= [];\n            for (const queryCacheKey of cacheKeys) {\n              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);\n              if (!alreadySubscribed) {\n                subscribedQueries.push(queryCacheKey);\n              }\n              draft.keys[queryCacheKey] = provided.keys[queryCacheKey];\n            }\n          }\n        }\n      }).addMatcher(isAnyOf(isFulfilled(queryThunk), isRejectedWithValue(queryThunk)), (draft, action) => {\n        writeProvidedTagsForQueries(draft, [action]);\n      }).addMatcher(querySlice.actions.cacheEntriesUpserted.match, (draft, action) => {\n        const mockActions: CalculateProvidedByAction[] = action.payload.map(({\n          queryDescription,\n          value\n        }) => {\n          return {\n            type: 'UNKNOWN',\n            payload: value,\n            meta: {\n              requestStatus: 'fulfilled',\n              requestId: 'UNKNOWN',\n              arg: queryDescription\n            }\n          };\n        });\n        writeProvidedTagsForQueries(draft, mockActions);\n      });\n    }\n  });\n  function removeCacheKeyFromTags(draft: InvalidationState<any>, queryCacheKey: QueryCacheKey) {\n    const existingTags = getCurrent(draft.keys[queryCacheKey] ?? []);\n\n    // Delete this cache key from any existing tags that may have provided it\n    for (const tag of existingTags) {\n      const tagType = tag.type;\n      const tagId = tag.id ?? '__internal_without_id';\n      const tagSubscriptions = draft.tags[tagType]?.[tagId];\n      if (tagSubscriptions) {\n        draft.tags[tagType][tagId] = getCurrent(tagSubscriptions).filter(qc => qc !== queryCacheKey);\n      }\n    }\n    delete draft.keys[queryCacheKey];\n  }\n  function writeProvidedTagsForQueries(draft: InvalidationState<string>, actions: CalculateProvidedByAction[]) {\n    const providedByEntries = actions.map(action => {\n      const providedTags = calculateProvidedByThunk(action, 'providesTags', definitions, assertTagType);\n      const {\n        queryCacheKey\n      } = action.meta.arg;\n      return {\n        queryCacheKey,\n        providedTags\n      };\n    });\n    invalidationSlice.caseReducers.updateProvidedBy(draft, invalidationSlice.actions.updateProvidedBy(providedByEntries));\n  }\n\n  // Dummy slice to generate actions\n  const subscriptionSlice = createSlice({\n    name: `${reducerPath}/subscriptions`,\n    initialState: initialState as SubscriptionState,\n    reducers: {\n      updateSubscriptionOptions(d, a: PayloadAction<{\n        endpointName: string;\n        requestId: string;\n        options: Subscribers[number];\n      } & QuerySubstateIdentifier>) {\n        // Dummy\n      },\n      unsubscribeQueryResult(d, a: PayloadAction<{\n        requestId: string;\n      } & QuerySubstateIdentifier>) {\n        // Dummy\n      },\n      internal_getRTKQSubscriptions() {}\n    }\n  });\n  const internalSubscriptionsSlice = createSlice({\n    name: `${reducerPath}/internalSubscriptions`,\n    initialState: initialState as SubscriptionState,\n    reducers: {\n      subscriptionsUpdated: {\n        reducer(state, action: PayloadAction<Patch[]>) {\n          return applyPatches(state, action.payload);\n        },\n        prepare: prepareAutoBatched<Patch[]>()\n      }\n    }\n  });\n  const configSlice = createSlice({\n    name: `${reducerPath}/config`,\n    initialState: {\n      online: isOnline(),\n      focused: isDocumentVisible(),\n      middlewareRegistered: false,\n      ...config\n    } as ConfigState<string>,\n    reducers: {\n      middlewareRegistered(state, {\n        payload\n      }: PayloadAction<string>) {\n        state.middlewareRegistered = state.middlewareRegistered === 'conflict' || apiUid !== payload ? 'conflict' : true;\n      }\n    },\n    extraReducers: builder => {\n      builder.addCase(onOnline, state => {\n        state.online = true;\n      }).addCase(onOffline, state => {\n        state.online = false;\n      }).addCase(onFocus, state => {\n        state.focused = true;\n      }).addCase(onFocusLost, state => {\n        state.focused = false;\n      })\n      // update the state to be a new object to be picked up as a \"state change\"\n      // by redux-persist's `autoMergeLevel2`\n      .addMatcher(hasRehydrationInfo, draft => ({\n        ...draft\n      }));\n    }\n  });\n  const combinedReducer = combineReducers({\n    queries: querySlice.reducer,\n    mutations: mutationSlice.reducer,\n    provided: invalidationSlice.reducer,\n    subscriptions: internalSubscriptionsSlice.reducer,\n    config: configSlice.reducer\n  });\n  const reducer: typeof combinedReducer = (state, action) => combinedReducer(resetApiState.match(action) ? undefined : state, action);\n  const actions = {\n    ...configSlice.actions,\n    ...querySlice.actions,\n    ...subscriptionSlice.actions,\n    ...internalSubscriptionsSlice.actions,\n    ...mutationSlice.actions,\n    ...invalidationSlice.actions,\n    resetApiState\n  };\n  return {\n    reducer,\n    actions\n  };\n}\nexport type SliceActions = ReturnType<typeof buildSlice>['actions'];","import type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { EndpointDefinition, EndpointDefinitions, InfiniteQueryArgFrom, InfiniteQueryDefinition, MutationDefinition, QueryArgFrom, QueryArgFromAnyQuery, QueryDefinition, ReducerPathFrom, TagDescription, TagTypesFrom } from '../endpointDefinitions';\nimport { expandTagDescription } from '../endpointDefinitions';\nimport { filterMap, isNotNullish } from '../utils';\nimport type { InfiniteData, InfiniteQueryConfigOptions, InfiniteQuerySubState, MutationSubState, QueryCacheKey, QueryState, QuerySubState, RequestStatusFlags, RootState as _RootState, QueryStatus } from './apiState';\nimport { STATUS_UNINITIALIZED, getRequestStatusFlags } from './apiState';\nimport { getMutationCacheKey } from './buildSlice';\nimport type { createSelector as _createSelector } from './rtkImports';\nimport { createNextState } from './rtkImports';\nimport { type AllQueryKeys, getNextPageParam, getPreviousPageParam } from './buildThunks';\nexport type SkipToken = typeof skipToken;\n/**\n * Can be passed into `useQuery`, `useQueryState` or `useQuerySubscription`\n * instead of the query argument to get the same effect as if setting\n * `skip: true` in the query options.\n *\n * Useful for scenarios where a query should be skipped when `arg` is `undefined`\n * and TypeScript complains about it because `arg` is not allowed to be passed\n * in as `undefined`, such as\n *\n * ```ts\n * // codeblock-meta title=\"will error if the query argument is not allowed to be undefined\" no-transpile\n * useSomeQuery(arg, { skip: !!arg })\n * ```\n *\n * ```ts\n * // codeblock-meta title=\"using skipToken instead\" no-transpile\n * useSomeQuery(arg ?? skipToken)\n * ```\n *\n * If passed directly into a query or mutation selector, that selector will always\n * return an uninitialized state.\n */\nexport const skipToken = /* @__PURE__ */Symbol.for('RTKQ/skipToken');\nexport type BuildSelectorsApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: QueryResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\nexport type BuildSelectorsApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: InfiniteQueryResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\nexport type BuildSelectorsApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: MutationResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\ntype QueryResultSelectorFactory<Definition extends QueryDefinition<any, any, any, any>, RootState> = (queryArg: QueryArgFrom<Definition> | SkipToken) => (state: RootState) => QueryResultSelectorResult<Definition>;\nexport type QueryResultSelectorResult<Definition extends QueryDefinition<any, any, any, any>> = QuerySubState<Definition> & RequestStatusFlags;\ntype InfiniteQueryResultSelectorFactory<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, RootState> = (queryArg: InfiniteQueryArgFrom<Definition> | SkipToken) => (state: RootState) => InfiniteQueryResultSelectorResult<Definition>;\nexport type InfiniteQueryResultFlags = {\n  hasNextPage: boolean;\n  hasPreviousPage: boolean;\n  isFetchingNextPage: boolean;\n  isFetchingPreviousPage: boolean;\n  isFetchNextPageError: boolean;\n  isFetchPreviousPageError: boolean;\n};\nexport type InfiniteQueryResultSelectorResult<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = InfiniteQuerySubState<Definition> & RequestStatusFlags & InfiniteQueryResultFlags;\ntype MutationResultSelectorFactory<Definition extends MutationDefinition<any, any, any, any>, RootState> = (requestId: string | {\n  requestId: string | undefined;\n  fixedCacheKey: string | undefined;\n} | SkipToken) => (state: RootState) => MutationResultSelectorResult<Definition>;\nexport type MutationResultSelectorResult<Definition extends MutationDefinition<any, any, any, any>> = MutationSubState<Definition> & RequestStatusFlags;\nconst initialSubState: QuerySubState<any> = {\n  status: STATUS_UNINITIALIZED\n};\n\n// abuse immer to freeze default states\nconst defaultQuerySubState = /* @__PURE__ */createNextState(initialSubState, () => {});\nconst defaultMutationSubState = /* @__PURE__ */createNextState(initialSubState as MutationSubState<any>, () => {});\nexport type AllSelectors = ReturnType<typeof buildSelectors>;\nexport function buildSelectors<Definitions extends EndpointDefinitions, ReducerPath extends string>({\n  serializeQueryArgs,\n  reducerPath,\n  createSelector\n}: {\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  reducerPath: ReducerPath;\n  createSelector: typeof _createSelector;\n}) {\n  type RootState = _RootState<Definitions, string, string>;\n  const selectSkippedQuery = (state: RootState) => defaultQuerySubState;\n  const selectSkippedMutation = (state: RootState) => defaultMutationSubState;\n  return {\n    buildQuerySelector,\n    buildInfiniteQuerySelector,\n    buildMutationSelector,\n    selectInvalidatedBy,\n    selectCachedArgsForQuery,\n    selectApiState,\n    selectQueries,\n    selectMutations,\n    selectQueryEntry,\n    selectConfig\n  };\n  function withRequestFlags<T extends {\n    status: QueryStatus;\n  }>(substate: T): T & RequestStatusFlags {\n    return {\n      ...substate,\n      ...getRequestStatusFlags(substate.status)\n    };\n  }\n  function selectApiState(rootState: RootState) {\n    const state = rootState[reducerPath];\n    if (process.env.NODE_ENV !== 'production') {\n      if (!state) {\n        if ((selectApiState as any).triggered) return state;\n        (selectApiState as any).triggered = true;\n        console.error(`Error: No data found at \\`state.${reducerPath}\\`. Did you forget to add the reducer to the store?`);\n      }\n    }\n    return state;\n  }\n  function selectQueries(rootState: RootState) {\n    return selectApiState(rootState)?.queries;\n  }\n  function selectQueryEntry(rootState: RootState, cacheKey: QueryCacheKey) {\n    return selectQueries(rootState)?.[cacheKey];\n  }\n  function selectMutations(rootState: RootState) {\n    return selectApiState(rootState)?.mutations;\n  }\n  function selectConfig(rootState: RootState) {\n    return selectApiState(rootState)?.config;\n  }\n  function buildAnyQuerySelector(endpointName: string, endpointDefinition: EndpointDefinition<any, any, any, any>, combiner: <T extends {\n    status: QueryStatus;\n  }>(substate: T) => T & RequestStatusFlags) {\n    return (queryArgs: any) => {\n      // Avoid calling serializeQueryArgs if the arg is skipToken\n      if (queryArgs === skipToken) {\n        return createSelector(selectSkippedQuery, combiner);\n      }\n      const serializedArgs = serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      });\n      const selectQuerySubstate = (state: RootState) => selectQueryEntry(state, serializedArgs) ?? defaultQuerySubState;\n      return createSelector(selectQuerySubstate, combiner);\n    };\n  }\n  function buildQuerySelector(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any>) {\n    return buildAnyQuerySelector(endpointName, endpointDefinition, withRequestFlags) as QueryResultSelectorFactory<any, RootState>;\n  }\n  function buildInfiniteQuerySelector(endpointName: string, endpointDefinition: InfiniteQueryDefinition<any, any, any, any, any>) {\n    const {\n      infiniteQueryOptions\n    } = endpointDefinition;\n    function withInfiniteQueryResultFlags<T extends {\n      status: QueryStatus;\n    }>(substate: T): T & RequestStatusFlags & InfiniteQueryResultFlags {\n      const stateWithRequestFlags = {\n        ...(substate as InfiniteQuerySubState<any>),\n        ...getRequestStatusFlags(substate.status)\n      };\n      const {\n        isLoading,\n        isError,\n        direction\n      } = stateWithRequestFlags;\n      const isForward = direction === 'forward';\n      const isBackward = direction === 'backward';\n      return {\n        ...stateWithRequestFlags,\n        hasNextPage: getHasNextPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),\n        hasPreviousPage: getHasPreviousPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),\n        isFetchingNextPage: isLoading && isForward,\n        isFetchingPreviousPage: isLoading && isBackward,\n        isFetchNextPageError: isError && isForward,\n        isFetchPreviousPageError: isError && isBackward\n      };\n    }\n    return buildAnyQuerySelector(endpointName, endpointDefinition, withInfiniteQueryResultFlags) as unknown as InfiniteQueryResultSelectorFactory<any, RootState>;\n  }\n  function buildMutationSelector() {\n    return (id => {\n      let mutationId: string | typeof skipToken;\n      if (typeof id === 'object') {\n        mutationId = getMutationCacheKey(id) ?? skipToken;\n      } else {\n        mutationId = id;\n      }\n      const selectMutationSubstate = (state: RootState) => selectApiState(state)?.mutations?.[mutationId as string] ?? defaultMutationSubState;\n      const finalSelectMutationSubstate = mutationId === skipToken ? selectSkippedMutation : selectMutationSubstate;\n      return createSelector(finalSelectMutationSubstate, withRequestFlags);\n    }) as MutationResultSelectorFactory<any, RootState>;\n  }\n  function selectInvalidatedBy(state: RootState, tags: ReadonlyArray<TagDescription<string> | null | undefined>): Array<{\n    endpointName: string;\n    originalArgs: any;\n    queryCacheKey: QueryCacheKey;\n  }> {\n    const apiState = state[reducerPath];\n    const toInvalidate = new Set<QueryCacheKey>();\n    const finalTags = filterMap(tags, isNotNullish, expandTagDescription);\n    for (const tag of finalTags) {\n      const provided = apiState.provided.tags[tag.type];\n      if (!provided) {\n        continue;\n      }\n      let invalidateSubscriptions = (tag.id !== undefined ?\n      // id given: invalidate all queries that provide this type & id\n      provided[tag.id] :\n      // no id: invalidate all queries that provide this type\n      Object.values(provided).flat()) ?? [];\n      for (const invalidate of invalidateSubscriptions) {\n        toInvalidate.add(invalidate);\n      }\n    }\n    return Array.from(toInvalidate.values()).flatMap(queryCacheKey => {\n      const querySubState = apiState.queries[queryCacheKey];\n      return querySubState ? {\n        queryCacheKey,\n        endpointName: querySubState.endpointName!,\n        originalArgs: querySubState.originalArgs\n      } : [];\n    });\n  }\n  function selectCachedArgsForQuery<QueryName extends AllQueryKeys<Definitions>>(state: RootState, queryName: QueryName): Array<QueryArgFromAnyQuery<Definitions[QueryName]>> {\n    return filterMap(Object.values(selectQueries(state) as QueryState<any>), (entry): entry is Exclude<QuerySubState<Definitions[QueryName]>, {\n      status: QueryStatus.uninitialized;\n    }> => entry?.endpointName === queryName && entry.status !== STATUS_UNINITIALIZED, entry => entry.originalArgs);\n  }\n  function getHasNextPage(options: InfiniteQueryConfigOptions<any, any, any>, data?: InfiniteData<unknown, unknown>, queryArg?: unknown): boolean {\n    if (!data) return false;\n    return getNextPageParam(options, data, queryArg) != null;\n  }\n  function getHasPreviousPage(options: InfiniteQueryConfigOptions<any, any, any>, data?: InfiniteData<unknown, unknown>, queryArg?: unknown): boolean {\n    if (!data || !options.getPreviousPageParam) return false;\n    return getPreviousPageParam(options, data, queryArg) != null;\n  }\n}","import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3 } from \"@reduxjs/toolkit\";\nimport { getEndpointDefinition, type Api, type ApiContext, type Module, type ModuleName } from './apiTypes';\nimport type { CombinedState } from './core/apiState';\nimport type { BaseQueryArg, BaseQueryFn } from './baseQueryTypes';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport { defaultSerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { EndpointBuilder, EndpointDefinitions, SchemaFailureConverter, SchemaFailureHandler, SchemaType } from './endpointDefinitions';\nimport { DefinitionType, ENDPOINT_INFINITEQUERY, ENDPOINT_MUTATION, ENDPOINT_QUERY, isInfiniteQueryDefinition, isQueryDefinition } from './endpointDefinitions';\nimport { nanoid } from './core/rtkImports';\nimport type { UnknownAction } from '@reduxjs/toolkit';\nimport type { NoInfer } from './tsHelpers';\nimport { weakMapMemoize } from 'reselect';\nexport interface CreateApiOptions<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string = 'api', TagTypes extends string = never> {\n  /**\n   * The base query used by each endpoint if no `queryFn` option is specified. RTK Query exports a utility called [fetchBaseQuery](./fetchBaseQuery) as a lightweight wrapper around `fetch` for common use-cases. See [Customizing Queries](../../rtk-query/usage/customizing-queries) if `fetchBaseQuery` does not handle your requirements.\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   *\n   * const api = createApi({\n   *   // highlight-start\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // ...endpoints\n   *   }),\n   * })\n   * ```\n   */\n  baseQuery: BaseQuery;\n  /**\n   * An array of string tag type names. Specifying tag types is optional, but you should define them so that they can be used for caching and invalidation. When defining a tag type, you will be able to [provide](../../rtk-query/usage/automated-refetching#providing-tags) them with `providesTags` and [invalidate](../../rtk-query/usage/automated-refetching#invalidating-tags) them with `invalidatesTags` when configuring [endpoints](#endpoints).\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-start\n   *   tagTypes: ['Post', 'User'],\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // ...endpoints\n   *   }),\n   * })\n   * ```\n   */\n  tagTypes?: readonly TagTypes[];\n  /**\n   * The `reducerPath` is a _unique_ key that your service will be mounted to in your store. If you call `createApi` more than once in your application, you will need to provide a unique value each time. Defaults to `'api'`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"apis.js\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query';\n   *\n   * const apiOne = createApi({\n   *   // highlight-start\n   *   reducerPath: 'apiOne',\n   *   // highlight-end\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (builder) => ({\n   *     // ...endpoints\n   *   }),\n   * });\n   *\n   * const apiTwo = createApi({\n   *   // highlight-start\n   *   reducerPath: 'apiTwo',\n   *   // highlight-end\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (builder) => ({\n   *     // ...endpoints\n   *   }),\n   * });\n   * ```\n   */\n  reducerPath?: ReducerPath;\n  /**\n   * Accepts a custom function if you have a need to change the creation of cache keys for any reason.\n   */\n  serializeQueryArgs?: SerializeQueryArgs<unknown>;\n  /**\n   * Endpoints are a set of operations that you want to perform against your server. You define them as an object using the builder syntax. There are three endpoint types: [`query`](../../rtk-query/usage/queries), [`infiniteQuery`](../../rtk-query/usage/infinite-queries) and [`mutation`](../../rtk-query/usage/mutations).\n   */\n  endpoints(build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>): Definitions;\n  /**\n   * Defaults to `60` _(this value is in seconds)_. This is how long RTK Query will keep your data cached for **after** the last component unsubscribes. For example, if you query an endpoint, then unmount the component, then mount another component that makes the same request within the given time frame, the most recent value will be served from the cache.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"keepUnusedDataFor example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts'\n   *     })\n   *   }),\n   *   // highlight-start\n   *   keepUnusedDataFor: 5\n   *   // highlight-end\n   * })\n   * ```\n   */\n  keepUnusedDataFor?: number;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after the application window regains focus.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnFocus?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after regaining a network connection.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnReconnect?: boolean;\n  /**\n   * Defaults to `'delayed'`. This setting allows you to control when tags are invalidated after a mutation.\n   *\n   * - `'immediately'`: Queries are invalidated instantly after the mutation finished, even if they are running.\n   *   If the query provides tags that were invalidated while it ran, it won't be re-fetched.\n   * - `'delayed'`: Invalidation only happens after all queries and mutations are settled.\n   *   This ensures that queries are always invalidated correctly and automatically \"batches\" invalidations of concurrent mutations.\n   *   Note that if you constantly have some queries (or mutations) running, this can delay tag invalidations indefinitely.\n   */\n  invalidationBehavior?: 'delayed' | 'immediately';\n  /**\n   * A function that is passed every dispatched action. If this returns something other than `undefined`,\n   * that return value will be used to rehydrate fulfilled & errored queries.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"next-redux-wrapper rehydration example\"\n   * import type { Action, PayloadAction } from '@reduxjs/toolkit'\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import { HYDRATE } from 'next-redux-wrapper'\n   *\n   * type RootState = any; // normally inferred from state\n   *\n   * function isHydrateAction(action: Action): action is PayloadAction<RootState> {\n   *   return action.type === HYDRATE\n   * }\n   *\n   * export const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-start\n   *   extractRehydrationInfo(action, { reducerPath }): any {\n   *     if (isHydrateAction(action)) {\n   *       return action.payload[reducerPath]\n   *     }\n   *   },\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // omitted\n   *   }),\n   * })\n   * ```\n   */\n  extractRehydrationInfo?: (action: UnknownAction, {\n    reducerPath\n  }: {\n    reducerPath: ReducerPath;\n  }) => undefined | CombinedState<NoInfer<Definitions>, NoInfer<TagTypes>, NoInfer<ReducerPath>>;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *     }),\n   *   }),\n   *   onSchemaFailure: (error, info) => {\n   *     console.error(error, info)\n   *   },\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *     }),\n   *   }),\n   *   catchSchemaFailure: (error, info) => ({\n   *     status: \"CUSTOM_ERROR\",\n   *     error: error.schemaName + \" failed validation\",\n   *     data: error.issues,\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for all endpoints, unless overridden by the endpoint.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type CreateApi<Modules extends ModuleName> = {\n  /**\n   * Creates a service to use in your application. Contains only the basic redux logic (the core module).\n   *\n   * @link https://redux-toolkit.js.org/rtk-query/api/createApi\n   */\n  <BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string = 'api', TagTypes extends string = never>(options: CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>): Api<BaseQuery, Definitions, ReducerPath, TagTypes, Modules>;\n};\n\n/**\n * Builds a `createApi` method based on the provided `modules`.\n *\n * @link https://redux-toolkit.js.org/rtk-query/usage/customizing-create-api\n *\n * @example\n * ```ts\n * const MyContext = React.createContext<ReactReduxContextValue | null>(null);\n * const customCreateApi = buildCreateApi(\n *   coreModule(),\n *   reactHooksModule({\n *     hooks: {\n *       useDispatch: createDispatchHook(MyContext),\n *       useSelector: createSelectorHook(MyContext),\n *       useStore: createStoreHook(MyContext)\n *     }\n *   })\n * );\n * ```\n *\n * @param modules - A variable number of modules that customize how the `createApi` method handles endpoints\n * @returns A `createApi` method using the provided `modules`.\n */\nexport function buildCreateApi<Modules extends [Module<any>, ...Module<any>[]]>(...modules: Modules): CreateApi<Modules[number]['name']> {\n  return function baseCreateApi(options) {\n    const extractRehydrationInfo = weakMapMemoize((action: UnknownAction) => options.extractRehydrationInfo?.(action, {\n      reducerPath: (options.reducerPath ?? 'api') as any\n    }));\n    const optionsWithDefaults: CreateApiOptions<any, any, any, any> = {\n      reducerPath: 'api',\n      keepUnusedDataFor: 60,\n      refetchOnMountOrArgChange: false,\n      refetchOnFocus: false,\n      refetchOnReconnect: false,\n      invalidationBehavior: 'delayed',\n      ...options,\n      extractRehydrationInfo,\n      serializeQueryArgs(queryArgsApi) {\n        let finalSerializeQueryArgs = defaultSerializeQueryArgs;\n        if ('serializeQueryArgs' in queryArgsApi.endpointDefinition) {\n          const endpointSQA = queryArgsApi.endpointDefinition.serializeQueryArgs!;\n          finalSerializeQueryArgs = queryArgsApi => {\n            const initialResult = endpointSQA(queryArgsApi);\n            if (typeof initialResult === 'string') {\n              // If the user function returned a string, use it as-is\n              return initialResult;\n            } else {\n              // Assume they returned an object (such as a subset of the original\n              // query args) or a primitive, and serialize it ourselves\n              return defaultSerializeQueryArgs({\n                ...queryArgsApi,\n                queryArgs: initialResult\n              });\n            }\n          };\n        } else if (options.serializeQueryArgs) {\n          finalSerializeQueryArgs = options.serializeQueryArgs;\n        }\n        return finalSerializeQueryArgs(queryArgsApi);\n      },\n      tagTypes: [...(options.tagTypes || [])]\n    };\n    const context: ApiContext<EndpointDefinitions> = {\n      endpointDefinitions: {},\n      batch(fn) {\n        // placeholder \"batch\" method to be overridden by plugins, for example with React.unstable_batchedUpdate\n        fn();\n      },\n      apiUid: nanoid(),\n      extractRehydrationInfo,\n      hasRehydrationInfo: weakMapMemoize(action => extractRehydrationInfo(action) != null)\n    };\n    const api = {\n      injectEndpoints,\n      enhanceEndpoints({\n        addTagTypes,\n        endpoints\n      }) {\n        if (addTagTypes) {\n          for (const eT of addTagTypes) {\n            if (!optionsWithDefaults.tagTypes!.includes(eT as any)) {\n              ;\n              (optionsWithDefaults.tagTypes as any[]).push(eT);\n            }\n          }\n        }\n        if (endpoints) {\n          for (const [endpointName, partialDefinition] of Object.entries(endpoints)) {\n            if (typeof partialDefinition === 'function') {\n              partialDefinition(getEndpointDefinition(context, endpointName));\n            } else {\n              Object.assign(getEndpointDefinition(context, endpointName) || {}, partialDefinition);\n            }\n          }\n        }\n        return api;\n      }\n    } as Api<BaseQueryFn, {}, string, string, Modules[number]['name']>;\n    const initializedModules = modules.map(m => m.init(api as any, optionsWithDefaults as any, context));\n    function injectEndpoints(inject: Parameters<typeof api.injectEndpoints>[0]) {\n      const evaluatedEndpoints = inject.endpoints({\n        query: x => ({\n          ...x,\n          type: ENDPOINT_QUERY\n        }) as any,\n        mutation: x => ({\n          ...x,\n          type: ENDPOINT_MUTATION\n        }) as any,\n        infiniteQuery: x => ({\n          ...x,\n          type: ENDPOINT_INFINITEQUERY\n        }) as any\n      });\n      for (const [endpointName, definition] of Object.entries(evaluatedEndpoints)) {\n        if (inject.overrideExisting !== true && endpointName in context.endpointDefinitions) {\n          if (inject.overrideExisting === 'throw') {\n            throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(39) : `called \\`injectEndpoints\\` to override already-existing endpointName ${endpointName} without specifying \\`overrideExisting: true\\``);\n          } else if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n            console.error(`called \\`injectEndpoints\\` to override already-existing endpointName ${endpointName} without specifying \\`overrideExisting: true\\``);\n          }\n          continue;\n        }\n        if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n          if (isInfiniteQueryDefinition(definition)) {\n            const {\n              infiniteQueryOptions\n            } = definition;\n            const {\n              maxPages,\n              getPreviousPageParam\n            } = infiniteQueryOptions;\n            if (typeof maxPages === 'number') {\n              if (maxPages < 1) {\n                throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(40) : `maxPages for endpoint '${endpointName}' must be a number greater than 0`);\n              }\n              if (typeof getPreviousPageParam !== 'function') {\n                throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(41) : `getPreviousPageParam for endpoint '${endpointName}' must be a function if maxPages is used`);\n              }\n            }\n          }\n        }\n        context.endpointDefinitions[endpointName] = definition;\n        for (const m of initializedModules) {\n          m.injectEndpoint(endpointName, definition);\n        }\n      }\n      return api as any;\n    }\n    return api.injectEndpoints({\n      endpoints: options.endpoints as any\n    });\n  };\n}","import type { QueryCacheKey } from './core/apiState';\nimport type { EndpointDefinition } from './endpointDefinitions';\nimport { isPlainObject } from './core/rtkImports';\nconst cache: WeakMap<any, string> | undefined = WeakMap ? new WeakMap() : undefined;\nexport const defaultSerializeQueryArgs: SerializeQueryArgs<any> = ({\n  endpointName,\n  queryArgs\n}) => {\n  let serialized = '';\n  const cached = cache?.get(queryArgs);\n  if (typeof cached === 'string') {\n    serialized = cached;\n  } else {\n    const stringified = JSON.stringify(queryArgs, (key, value) => {\n      // Handle bigints\n      value = typeof value === 'bigint' ? {\n        $bigint: value.toString()\n      } : value;\n      // Sort the object keys before stringifying, to prevent useQuery({ a: 1, b: 2 }) having a different cache key than useQuery({ b: 2, a: 1 })\n      value = isPlainObject(value) ? Object.keys(value).sort().reduce<any>((acc, key) => {\n        acc[key] = (value as any)[key];\n        return acc;\n      }, {}) : value;\n      return value;\n    });\n    if (isPlainObject(queryArgs)) {\n      cache?.set(queryArgs, stringified);\n    }\n    serialized = stringified;\n  }\n  return `${endpointName}(${serialized})`;\n};\nexport type SerializeQueryArgs<QueryArgs, ReturnType = string> = (_: {\n  queryArgs: QueryArgs;\n  endpointDefinition: EndpointDefinition<any, any, any, any>;\n  endpointName: string;\n}) => ReturnType;\nexport type InternalSerializeQueryArgs = (_: {\n  queryArgs: any;\n  endpointDefinition: EndpointDefinition<any, any, any, any>;\n  endpointName: string;\n}) => QueryCacheKey;","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { BaseQueryFn } from './baseQueryTypes';\nexport const _NEVER = /* @__PURE__ */Symbol();\nexport type NEVER = typeof _NEVER;\n\n/**\n * Creates a \"fake\" baseQuery to be used if your api *only* uses the `queryFn` definition syntax.\n * This also allows you to specify a specific error type to be shared by all your `queryFn` definitions.\n */\nexport function fakeBaseQuery<ErrorType>(): BaseQueryFn<void, NEVER, ErrorType, {}> {\n  return function () {\n    throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(33) : 'When using `fakeBaseQuery`, all queries & mutations must use the `queryFn` definition syntax.');\n  };\n}","export type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type Override<T1, T2> = T2 extends any ? Omit<T1, keyof T2> & T2 : never;\nexport function assertCast<T>(v: any): asserts v is T {}\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>): T {\n  return Object.assign(target, ...args);\n}\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\nexport type NonOptionalKeys<T> = { [K in keyof T]-?: undefined extends T[K] ? never : K }[keyof T];\nexport type HasRequiredProps<T, True, False> = NonOptionalKeys<T> extends never ? False : True;\nexport type OptionalIfAllPropsOptional<T> = HasRequiredProps<T, T, T | never>;\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type UnwrapPromise<T> = T extends PromiseLike<infer V> ? V : T;\nexport type MaybePromise<T> = T | PromiseLike<T>;\nexport type OmitFromUnion<T, K extends keyof T> = T extends any ? Omit<T, K> : never;\nexport type IsAny<T, True, False = never> = true | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;","import type { InternalHandlerBuilder, SubscriptionSelectors } from './types';\nimport type { SubscriptionInternalState, SubscriptionState } from '../apiState';\nimport { produceWithPatches } from '../../utils/immerImports';\nimport type { Action } from '@reduxjs/toolkit';\nimport { getOrInsertComputed, createNewMap } from '../../utils/getOrInsert';\nexport const buildBatchedActionsHandler: InternalHandlerBuilder<[actionShouldContinue: boolean, returnValue: SubscriptionSelectors | boolean]> = ({\n  api,\n  queryThunk,\n  internalState,\n  mwApi\n}) => {\n  const subscriptionsPrefix = `${api.reducerPath}/subscriptions`;\n  let previousSubscriptions: SubscriptionState = null as unknown as SubscriptionState;\n  let updateSyncTimer: ReturnType<typeof window.setTimeout> | null = null;\n  const {\n    updateSubscriptionOptions,\n    unsubscribeQueryResult\n  } = api.internalActions;\n\n  // Actually intentionally mutate the subscriptions state used in the middleware\n  // This is done to speed up perf when loading many components\n  const actuallyMutateSubscriptions = (currentSubscriptions: SubscriptionInternalState, action: Action) => {\n    if (updateSubscriptionOptions.match(action)) {\n      const {\n        queryCacheKey,\n        requestId,\n        options\n      } = action.payload;\n      const sub = currentSubscriptions.get(queryCacheKey);\n      if (sub?.has(requestId)) {\n        sub.set(requestId, options);\n      }\n      return true;\n    }\n    if (unsubscribeQueryResult.match(action)) {\n      const {\n        queryCacheKey,\n        requestId\n      } = action.payload;\n      const sub = currentSubscriptions.get(queryCacheKey);\n      if (sub) {\n        sub.delete(requestId);\n      }\n      return true;\n    }\n    if (api.internalActions.removeQueryResult.match(action)) {\n      currentSubscriptions.delete(action.payload.queryCacheKey);\n      return true;\n    }\n    if (queryThunk.pending.match(action)) {\n      const {\n        meta: {\n          arg,\n          requestId\n        }\n      } = action;\n      const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);\n      if (arg.subscribe) {\n        substate.set(requestId, arg.subscriptionOptions ?? substate.get(requestId) ?? {});\n      }\n      return true;\n    }\n    let mutated = false;\n    if (queryThunk.rejected.match(action)) {\n      const {\n        meta: {\n          condition,\n          arg,\n          requestId\n        }\n      } = action;\n      if (condition && arg.subscribe) {\n        const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);\n        substate.set(requestId, arg.subscriptionOptions ?? substate.get(requestId) ?? {});\n        mutated = true;\n      }\n    }\n    return mutated;\n  };\n  const getSubscriptions = () => internalState.currentSubscriptions;\n  const getSubscriptionCount = (queryCacheKey: string) => {\n    const subscriptions = getSubscriptions();\n    const subscriptionsForQueryArg = subscriptions.get(queryCacheKey);\n    return subscriptionsForQueryArg?.size ?? 0;\n  };\n  const isRequestSubscribed = (queryCacheKey: string, requestId: string) => {\n    const subscriptions = getSubscriptions();\n    return !!subscriptions?.get(queryCacheKey)?.get(requestId);\n  };\n  const subscriptionSelectors: SubscriptionSelectors = {\n    getSubscriptions,\n    getSubscriptionCount,\n    isRequestSubscribed\n  };\n  function serializeSubscriptions(currentSubscriptions: SubscriptionInternalState): SubscriptionState {\n    // We now use nested Maps for subscriptions, instead of\n    // plain Records. Stringify this accordingly so we can\n    // convert it to the shape we need for the store.\n    return JSON.parse(JSON.stringify(Object.fromEntries([...currentSubscriptions].map(([k, v]) => [k, Object.fromEntries(v)]))));\n  }\n  return (action, mwApi): [actionShouldContinue: boolean, result: SubscriptionSelectors | boolean] => {\n    if (!previousSubscriptions) {\n      // Initialize it the first time this handler runs\n      previousSubscriptions = serializeSubscriptions(internalState.currentSubscriptions);\n    }\n    if (api.util.resetApiState.match(action)) {\n      previousSubscriptions = {};\n      internalState.currentSubscriptions.clear();\n      updateSyncTimer = null;\n      return [true, false];\n    }\n\n    // Intercept requests by hooks to see if they're subscribed\n    // We return the internal state reference so that hooks\n    // can do their own checks to see if they're still active.\n    // It's stupid and hacky, but it does cut down on some dispatch calls.\n    if (api.internalActions.internal_getRTKQSubscriptions.match(action)) {\n      return [false, subscriptionSelectors];\n    }\n\n    // Update subscription data based on this action\n    const didMutate = actuallyMutateSubscriptions(internalState.currentSubscriptions, action);\n    let actionShouldContinue = true;\n\n    // HACK Sneak the test-only polling state back out\n    if (process.env.NODE_ENV === 'test' && typeof action.type === 'string' && action.type === `${api.reducerPath}/getPolling`) {\n      return [false, internalState.currentPolls] as any;\n    }\n    if (didMutate) {\n      if (!updateSyncTimer) {\n        // We only use the subscription state for the Redux DevTools at this point,\n        // as the real data is kept here in the middleware.\n        // Given that, we can throttle synchronizing this state significantly to\n        // save on overall perf.\n        // In 1.9, it was updated in a microtask, but now we do it at most every 500ms.\n        updateSyncTimer = setTimeout(() => {\n          // Deep clone the current subscription data\n          const newSubscriptions: SubscriptionState = serializeSubscriptions(internalState.currentSubscriptions);\n          // Figure out a smaller diff between original and current\n          const [, patches] = produceWithPatches(previousSubscriptions, () => newSubscriptions);\n\n          // Sync the store state for visibility\n          mwApi.next(api.internalActions.subscriptionsUpdated(patches));\n          // Save the cloned state for later reference\n          previousSubscriptions = newSubscriptions;\n          updateSyncTimer = null;\n        }, 500);\n      }\n      const isSubscriptionSliceAction = typeof action.type == 'string' && !!action.type.startsWith(subscriptionsPrefix);\n      const isAdditionalSubscriptionAction = queryThunk.rejected.match(action) && action.meta.condition && !!action.meta.arg.subscribe;\n      actionShouldContinue = !isSubscriptionSliceAction && !isAdditionalSubscriptionAction;\n    }\n    return [actionShouldContinue, false];\n  };\n};","import { getEndpointDefinition } from '@internal/query/apiTypes';\nimport type { QueryDefinition } from '../../endpointDefinitions';\nimport type { ConfigState, QueryCacheKey, QuerySubState } from '../apiState';\nimport { isAnyOf } from '../rtkImports';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, QueryStateMeta, SubMiddlewareApi, TimeoutId } from './types';\nexport type ReferenceCacheCollection = never;\n\n/**\n * @example\n * ```ts\n * // codeblock-meta title=\"keepUnusedDataFor example\"\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n * interface Post {\n *   id: number\n *   name: string\n * }\n * type PostsResponse = Post[]\n *\n * const api = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsResponse, void>({\n *       query: () => 'posts',\n *       // highlight-start\n *       keepUnusedDataFor: 5\n *       // highlight-end\n *     })\n *   })\n * })\n * ```\n */\nexport type CacheCollectionQueryExtraOptions = {\n  /**\n   * Overrides the api-wide definition of `keepUnusedDataFor` for this endpoint only. _(This value is in seconds.)_\n   *\n   * This is how long RTK Query will keep your data cached for **after** the last component unsubscribes. For example, if you query an endpoint, then unmount the component, then mount another component that makes the same request within the given time frame, the most recent value will be served from the cache.\n   */\n  keepUnusedDataFor?: number;\n};\n\n// Per https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value , browsers store\n// `setTimeout()` timer values in a 32-bit int. If we pass a value in that's larger than that,\n// it wraps and ends up executing immediately.\n// Our `keepUnusedDataFor` values are in seconds, so adjust the numbers here accordingly.\nexport const THIRTY_TWO_BIT_MAX_INT = 2_147_483_647;\nexport const THIRTY_TWO_BIT_MAX_TIMER_SECONDS = 2_147_483_647 / 1_000 - 1;\nexport const buildCacheCollectionHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  api,\n  queryThunk,\n  context,\n  internalState,\n  selectors: {\n    selectQueryEntry,\n    selectConfig\n  },\n  getRunningQueryThunk,\n  mwApi\n}) => {\n  const {\n    removeQueryResult,\n    unsubscribeQueryResult,\n    cacheEntriesUpserted\n  } = api.internalActions;\n  const canTriggerUnsubscribe = isAnyOf(unsubscribeQueryResult.match, queryThunk.fulfilled, queryThunk.rejected, cacheEntriesUpserted.match);\n  function anySubscriptionsRemainingForKey(queryCacheKey: string) {\n    const subscriptions = internalState.currentSubscriptions.get(queryCacheKey);\n    if (!subscriptions) {\n      return false;\n    }\n    const hasSubscriptions = subscriptions.size > 0;\n    return hasSubscriptions;\n  }\n  const currentRemovalTimeouts: QueryStateMeta<TimeoutId> = {};\n  function abortAllPromises<T extends {\n    abort?: () => void;\n  }>(promiseMap: Map<string, T | undefined>): void {\n    for (const promise of promiseMap.values()) {\n      promise?.abort?.();\n    }\n  }\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    const state = mwApi.getState();\n    const config = selectConfig(state);\n    if (canTriggerUnsubscribe(action)) {\n      let queryCacheKeys: QueryCacheKey[];\n      if (cacheEntriesUpserted.match(action)) {\n        queryCacheKeys = action.payload.map(entry => entry.queryDescription.queryCacheKey);\n      } else {\n        const {\n          queryCacheKey\n        } = unsubscribeQueryResult.match(action) ? action.payload : action.meta.arg;\n        queryCacheKeys = [queryCacheKey];\n      }\n      handleUnsubscribeMany(queryCacheKeys, mwApi, config);\n    }\n    if (api.util.resetApiState.match(action)) {\n      for (const [key, timeout] of Object.entries(currentRemovalTimeouts)) {\n        if (timeout) clearTimeout(timeout);\n        delete currentRemovalTimeouts[key];\n      }\n      abortAllPromises(internalState.runningQueries);\n      abortAllPromises(internalState.runningMutations);\n    }\n    if (context.hasRehydrationInfo(action)) {\n      const {\n        queries\n      } = context.extractRehydrationInfo(action)!;\n      // Gotcha:\n      // If rehydrating before the endpoint has been injected,the global `keepUnusedDataFor`\n      // will be used instead of the endpoint-specific one.\n      handleUnsubscribeMany(Object.keys(queries) as QueryCacheKey[], mwApi, config);\n    }\n  };\n  function handleUnsubscribeMany(cacheKeys: QueryCacheKey[], api: SubMiddlewareApi, config: ConfigState<string>) {\n    const state = api.getState();\n    for (const queryCacheKey of cacheKeys) {\n      const entry = selectQueryEntry(state, queryCacheKey);\n      if (entry?.endpointName) {\n        handleUnsubscribe(queryCacheKey, entry.endpointName, api, config);\n      }\n    }\n  }\n  function handleUnsubscribe(queryCacheKey: QueryCacheKey, endpointName: string, api: SubMiddlewareApi, config: ConfigState<string>) {\n    const endpointDefinition = getEndpointDefinition(context, endpointName) as QueryDefinition<any, any, any, any>;\n    const keepUnusedDataFor = endpointDefinition?.keepUnusedDataFor ?? config.keepUnusedDataFor;\n    if (keepUnusedDataFor === Infinity) {\n      // Hey, user said keep this forever!\n      return;\n    }\n    // Prevent `setTimeout` timers from overflowing a 32-bit internal int, by\n    // clamping the max value to be at most 1000ms less than the 32-bit max.\n    // Look, a 24.8-day keepalive ought to be enough for anybody, right? :)\n    // Also avoid negative values too.\n    const finalKeepUnusedDataFor = Math.max(0, Math.min(keepUnusedDataFor, THIRTY_TWO_BIT_MAX_TIMER_SECONDS));\n    if (!anySubscriptionsRemainingForKey(queryCacheKey)) {\n      const currentTimeout = currentRemovalTimeouts[queryCacheKey];\n      if (currentTimeout) {\n        clearTimeout(currentTimeout);\n      }\n      currentRemovalTimeouts[queryCacheKey] = setTimeout(() => {\n        if (!anySubscriptionsRemainingForKey(queryCacheKey)) {\n          // Try to abort any running query for this cache key\n          const entry = selectQueryEntry(api.getState(), queryCacheKey);\n          if (entry?.endpointName) {\n            const runningQuery = api.dispatch(getRunningQueryThunk(entry.endpointName, entry.originalArgs));\n            runningQuery?.abort();\n          }\n          api.dispatch(removeQueryResult({\n            queryCacheKey\n          }));\n        }\n        delete currentRemovalTimeouts![queryCacheKey];\n      }, finalKeepUnusedDataFor * 1000);\n    }\n  }\n  return handler;\n};","import type { ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { BaseQueryFn, BaseQueryMeta, BaseQueryResult } from '../../baseQueryTypes';\nimport type { BaseEndpointDefinition, DefinitionType } from '../../endpointDefinitions';\nimport { isAnyQueryDefinition } from '../../endpointDefinitions';\nimport type { QueryCacheKey, RootState } from '../apiState';\nimport type { MutationResultSelectorResult, QueryResultSelectorResult } from '../buildSelectors';\nimport { getMutationCacheKey } from '../buildSlice';\nimport type { PatchCollection, Recipe } from '../buildThunks';\nimport { isAsyncThunkAction, isFulfilled } from '../rtkImports';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, PromiseWithKnownReason, SubMiddlewareApi } from './types';\nimport { getEndpointDefinition } from '@internal/query/apiTypes';\nexport type ReferenceCacheLifecycle = never;\nexport interface QueryBaseLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends LifecycleApi<ReducerPath> {\n  /**\n   * Gets the current value of this cache entry.\n   */\n  getCacheEntry(): QueryResultSelectorResult<{\n    type: DefinitionType.query;\n  } & BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, BaseQueryResult<BaseQuery>>>;\n  /**\n   * Updates the current cache entry value.\n   * For documentation see `api.util.updateQueryData`.\n   */\n  updateCachedData(updateRecipe: Recipe<ResultType>): PatchCollection;\n}\nexport type MutationBaseLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = LifecycleApi<ReducerPath> & {\n  /**\n   * Gets the current value of this cache entry.\n   */\n  getCacheEntry(): MutationResultSelectorResult<{\n    type: DefinitionType.mutation;\n  } & BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, BaseQueryResult<BaseQuery>>>;\n};\ntype LifecycleApi<ReducerPath extends string = string> = {\n  /**\n   * The dispatch method for the store\n   */\n  dispatch: ThunkDispatch<any, any, UnknownAction>;\n  /**\n   * A method to get the current state\n   */\n  getState(): RootState<any, any, ReducerPath>;\n  /**\n   * `extra` as provided as `thunk.extraArgument` to the `configureStore` `getDefaultMiddleware` option.\n   */\n  extra: unknown;\n  /**\n   * A unique ID generated for the mutation\n   */\n  requestId: string;\n};\ntype CacheLifecyclePromises<ResultType = unknown, MetaType = unknown> = {\n  /**\n   * Promise that will resolve with the first value for this cache key.\n   * This allows you to `await` until an actual value is in cache.\n   *\n   * If the cache entry is removed from the cache before any value has ever\n   * been resolved, this Promise will reject with\n   * `new Error('Promise never resolved before cacheEntryRemoved.')`\n   * to prevent memory leaks.\n   * You can just re-throw that error (or not handle it at all) -\n   * it will be caught outside of `cacheEntryAdded`.\n   *\n   * If you don't interact with this promise, it will not throw.\n   */\n  cacheDataLoaded: PromiseWithKnownReason<{\n    /**\n     * The (transformed) query result.\n     */\n    data: ResultType;\n    /**\n     * The `meta` returned by the `baseQuery`\n     */\n    meta: MetaType;\n  }, typeof neverResolvedError>;\n  /**\n   * Promise that allows you to wait for the point in time when the cache entry\n   * has been removed from the cache, by not being used/subscribed to any more\n   * in the application for too long or by dispatching `api.util.resetApiState`.\n   */\n  cacheEntryRemoved: Promise<void>;\n};\nexport interface QueryCacheLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>, CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>> {}\nexport type MutationCacheLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> & CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>>;\nexport type CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  onCacheEntryAdded?(arg: QueryArg, api: QueryCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport type CacheLifecycleInfiniteQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>;\nexport type CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  onCacheEntryAdded?(arg: QueryArg, api: MutationCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nconst neverResolvedError = new Error('Promise never resolved before cacheEntryRemoved.') as Error & {\n  message: 'Promise never resolved before cacheEntryRemoved.';\n};\nexport const buildCacheLifecycleHandler: InternalHandlerBuilder = ({\n  api,\n  reducerPath,\n  context,\n  queryThunk,\n  mutationThunk,\n  internalState,\n  selectors: {\n    selectQueryEntry,\n    selectApiState\n  }\n}) => {\n  const isQueryThunk = isAsyncThunkAction(queryThunk);\n  const isMutationThunk = isAsyncThunkAction(mutationThunk);\n  const isFulfilledThunk = isFulfilled(queryThunk, mutationThunk);\n  type CacheLifecycle = {\n    valueResolved?(value: {\n      data: unknown;\n      meta: unknown;\n    }): unknown;\n    cacheEntryRemoved(): void;\n  };\n  const lifecycleMap: Record<string, CacheLifecycle> = {};\n  const {\n    removeQueryResult,\n    removeMutationResult,\n    cacheEntriesUpserted\n  } = api.internalActions;\n  function resolveLifecycleEntry(cacheKey: string, data: unknown, meta: unknown) {\n    const lifecycle = lifecycleMap[cacheKey];\n    if (lifecycle?.valueResolved) {\n      lifecycle.valueResolved({\n        data,\n        meta\n      });\n      delete lifecycle.valueResolved;\n    }\n  }\n  function removeLifecycleEntry(cacheKey: string) {\n    const lifecycle = lifecycleMap[cacheKey];\n    if (lifecycle) {\n      delete lifecycleMap[cacheKey];\n      lifecycle.cacheEntryRemoved();\n    }\n  }\n  function getActionMetaFields(action: ReturnType<typeof queryThunk.pending> | ReturnType<typeof mutationThunk.pending>) {\n    const {\n      arg,\n      requestId\n    } = action.meta;\n    const {\n      endpointName,\n      originalArgs\n    } = arg;\n    return [endpointName, originalArgs, requestId] as const;\n  }\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi, stateBefore) => {\n    const cacheKey = getCacheKey(action) as QueryCacheKey;\n    function checkForNewCacheKey(endpointName: string, cacheKey: QueryCacheKey, requestId: string, originalArgs: unknown) {\n      const oldEntry = selectQueryEntry(stateBefore, cacheKey);\n      const newEntry = selectQueryEntry(mwApi.getState(), cacheKey);\n      if (!oldEntry && newEntry) {\n        handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId);\n      }\n    }\n    if (queryThunk.pending.match(action)) {\n      const [endpointName, originalArgs, requestId] = getActionMetaFields(action);\n      checkForNewCacheKey(endpointName, cacheKey, requestId, originalArgs);\n    } else if (cacheEntriesUpserted.match(action)) {\n      for (const {\n        queryDescription,\n        value\n      } of action.payload) {\n        const {\n          endpointName,\n          originalArgs,\n          queryCacheKey\n        } = queryDescription;\n        checkForNewCacheKey(endpointName, queryCacheKey, action.meta.requestId, originalArgs);\n        resolveLifecycleEntry(queryCacheKey, value, {});\n      }\n    } else if (mutationThunk.pending.match(action)) {\n      const state = mwApi.getState()[reducerPath].mutations[cacheKey];\n      if (state) {\n        const [endpointName, originalArgs, requestId] = getActionMetaFields(action);\n        handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId);\n      }\n    } else if (isFulfilledThunk(action)) {\n      resolveLifecycleEntry(cacheKey, action.payload, action.meta.baseQueryMeta);\n    } else if (removeQueryResult.match(action) || removeMutationResult.match(action)) {\n      removeLifecycleEntry(cacheKey);\n    } else if (api.util.resetApiState.match(action)) {\n      for (const cacheKey of Object.keys(lifecycleMap)) {\n        removeLifecycleEntry(cacheKey);\n      }\n    }\n  };\n  function getCacheKey(action: any) {\n    if (isQueryThunk(action)) return action.meta.arg.queryCacheKey;\n    if (isMutationThunk(action)) {\n      return action.meta.arg.fixedCacheKey ?? action.meta.requestId;\n    }\n    if (removeQueryResult.match(action)) return action.payload.queryCacheKey;\n    if (removeMutationResult.match(action)) return getMutationCacheKey(action.payload);\n    return '';\n  }\n  function handleNewKey(endpointName: string, originalArgs: any, queryCacheKey: string, mwApi: SubMiddlewareApi, requestId: string) {\n    const endpointDefinition = getEndpointDefinition(context, endpointName);\n    const onCacheEntryAdded = endpointDefinition?.onCacheEntryAdded;\n    if (!onCacheEntryAdded) return;\n    const lifecycle = {} as CacheLifecycle;\n    const cacheEntryRemoved = new Promise<void>(resolve => {\n      lifecycle.cacheEntryRemoved = resolve;\n    });\n    const cacheDataLoaded: PromiseWithKnownReason<{\n      data: unknown;\n      meta: unknown;\n    }, typeof neverResolvedError> = Promise.race([new Promise<{\n      data: unknown;\n      meta: unknown;\n    }>(resolve => {\n      lifecycle.valueResolved = resolve;\n    }), cacheEntryRemoved.then(() => {\n      throw neverResolvedError;\n    })]);\n    // prevent uncaught promise rejections from happening.\n    // if the original promise is used in any way, that will create a new promise that will throw again\n    cacheDataLoaded.catch(() => {});\n    lifecycleMap[queryCacheKey] = lifecycle;\n    const selector = (api.endpoints[endpointName] as any).select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : queryCacheKey);\n    const extra = mwApi.dispatch((_, __, extra) => extra);\n    const lifecycleApi = {\n      ...mwApi,\n      getCacheEntry: () => selector(mwApi.getState()),\n      requestId,\n      extra,\n      updateCachedData: (isAnyQueryDefinition(endpointDefinition) ? (updateRecipe: Recipe<any>) => mwApi.dispatch(api.util.updateQueryData(endpointName as never, originalArgs as never, updateRecipe)) : undefined) as any,\n      cacheDataLoaded,\n      cacheEntryRemoved\n    };\n    const runningHandler = onCacheEntryAdded(originalArgs, lifecycleApi as any);\n    // if a `neverResolvedError` was thrown, but not handled in the running handler, do not let it leak out further\n    Promise.resolve(runningHandler).catch(e => {\n      if (e === neverResolvedError) return;\n      throw e;\n    });\n  }\n  return handler;\n};","import type { InternalHandlerBuilder } from './types';\nexport const buildDevCheckHandler: InternalHandlerBuilder = ({\n  api,\n  context: {\n    apiUid\n  },\n  reducerPath\n}) => {\n  return (action, mwApi) => {\n    if (api.util.resetApiState.match(action)) {\n      // dispatch after api reset\n      mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));\n    }\n    if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n      if (api.internalActions.middlewareRegistered.match(action) && action.payload === apiUid && mwApi.getState()[reducerPath]?.config?.middlewareRegistered === 'conflict') {\n        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!` : ''}`);\n      }\n    }\n  };\n};","import { isAnyOf, isFulfilled, isRejected, isRejectedWithValue } from '../rtkImports';\nimport type { EndpointDefinitions, FullTagDescription } from '../../endpointDefinitions';\nimport { calculateProvidedBy } from '../../endpointDefinitions';\nimport type { CombinedState, QueryCacheKey } from '../apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport { calculateProvidedByThunk } from '../buildThunks';\nimport type { SubMiddlewareApi, InternalHandlerBuilder, ApiMiddlewareInternalHandler } from './types';\nimport { getOrInsertComputed, createNewMap } from '../../utils/getOrInsert';\nexport const buildInvalidationByTagsHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  context,\n  context: {\n    endpointDefinitions\n  },\n  mutationThunk,\n  queryThunk,\n  api,\n  assertTagType,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    removeQueryResult\n  } = api.internalActions;\n  const isThunkActionWithTags = isAnyOf(isFulfilled(mutationThunk), isRejectedWithValue(mutationThunk));\n  const isQueryEnd = isAnyOf(isFulfilled(queryThunk, mutationThunk), isRejected(queryThunk, mutationThunk));\n  let pendingTagInvalidations: FullTagDescription<string>[] = [];\n  // Track via counter so we can avoid iterating over state every time\n  let pendingRequestCount = 0;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (queryThunk.pending.match(action) || mutationThunk.pending.match(action)) {\n      pendingRequestCount++;\n    }\n    if (isQueryEnd(action)) {\n      pendingRequestCount = Math.max(0, pendingRequestCount - 1);\n    }\n    if (isThunkActionWithTags(action)) {\n      invalidateTags(calculateProvidedByThunk(action, 'invalidatesTags', endpointDefinitions, assertTagType), mwApi);\n    } else if (isQueryEnd(action)) {\n      invalidateTags([], mwApi);\n    } else if (api.util.invalidateTags.match(action)) {\n      invalidateTags(calculateProvidedBy(action.payload, undefined, undefined, undefined, undefined, assertTagType), mwApi);\n    }\n  };\n  function hasPendingRequests() {\n    return pendingRequestCount > 0;\n  }\n  function invalidateTags(newTags: readonly FullTagDescription<string>[], mwApi: SubMiddlewareApi) {\n    const rootState = mwApi.getState();\n    const state = rootState[reducerPath];\n    pendingTagInvalidations.push(...newTags);\n    if (state.config.invalidationBehavior === 'delayed' && hasPendingRequests()) {\n      return;\n    }\n    const tags = pendingTagInvalidations;\n    pendingTagInvalidations = [];\n    if (tags.length === 0) return;\n    const toInvalidate = api.util.selectInvalidatedBy(rootState, tags);\n    context.batch(() => {\n      const valuesArray = Array.from(toInvalidate.values());\n      for (const {\n        queryCacheKey\n      } of valuesArray) {\n        const querySubState = state.queries[queryCacheKey];\n        const subscriptionSubState = getOrInsertComputed(internalState.currentSubscriptions, queryCacheKey, createNewMap);\n        if (querySubState) {\n          if (subscriptionSubState.size === 0) {\n            mwApi.dispatch(removeQueryResult({\n              queryCacheKey: queryCacheKey as QueryCacheKey\n            }));\n          } else if (querySubState.status !== STATUS_UNINITIALIZED) {\n            mwApi.dispatch(refetchQuery(querySubState));\n          }\n        }\n      }\n    });\n  }\n  return handler;\n};","import type { QueryCacheKey, QuerySubstateIdentifier, Subscribers, SubscribersInternal } from '../apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport type { QueryStateMeta, SubMiddlewareApi, TimeoutId, InternalHandlerBuilder, ApiMiddlewareInternalHandler, InternalMiddlewareState } from './types';\nexport const buildPollingHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  queryThunk,\n  api,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    currentPolls,\n    currentSubscriptions\n  } = internalState;\n\n  // Batching state for polling updates\n  const pendingPollingUpdates = new Set<string>();\n  let pollingUpdateTimer: ReturnType<typeof setTimeout> | null = null;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (api.internalActions.updateSubscriptionOptions.match(action) || api.internalActions.unsubscribeQueryResult.match(action)) {\n      schedulePollingUpdate(action.payload.queryCacheKey, mwApi);\n    }\n    if (queryThunk.pending.match(action) || queryThunk.rejected.match(action) && action.meta.condition) {\n      schedulePollingUpdate(action.meta.arg.queryCacheKey, mwApi);\n    }\n    if (queryThunk.fulfilled.match(action) || queryThunk.rejected.match(action) && !action.meta.condition) {\n      startNextPoll(action.meta.arg, mwApi);\n    }\n    if (api.util.resetApiState.match(action)) {\n      clearPolls();\n      // Clear any pending updates\n      if (pollingUpdateTimer) {\n        clearTimeout(pollingUpdateTimer);\n        pollingUpdateTimer = null;\n      }\n      pendingPollingUpdates.clear();\n    }\n  };\n  function schedulePollingUpdate(queryCacheKey: string, api: SubMiddlewareApi) {\n    pendingPollingUpdates.add(queryCacheKey);\n    if (!pollingUpdateTimer) {\n      pollingUpdateTimer = setTimeout(() => {\n        // Process all pending updates in a single batch\n        for (const key of pendingPollingUpdates) {\n          updatePollingInterval({\n            queryCacheKey: key as any\n          }, api);\n        }\n        pendingPollingUpdates.clear();\n        pollingUpdateTimer = null;\n      }, 0);\n    }\n  }\n  function startNextPoll({\n    queryCacheKey\n  }: QuerySubstateIdentifier, api: SubMiddlewareApi) {\n    const state = api.getState()[reducerPath];\n    const querySubState = state.queries[queryCacheKey];\n    const subscriptions = currentSubscriptions.get(queryCacheKey);\n    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) return;\n    const {\n      lowestPollingInterval,\n      skipPollingIfUnfocused\n    } = findLowestPollingInterval(subscriptions);\n    if (!Number.isFinite(lowestPollingInterval)) return;\n    const currentPoll = currentPolls.get(queryCacheKey);\n    if (currentPoll?.timeout) {\n      clearTimeout(currentPoll.timeout);\n      currentPoll.timeout = undefined;\n    }\n    const nextPollTimestamp = Date.now() + lowestPollingInterval;\n    currentPolls.set(queryCacheKey, {\n      nextPollTimestamp,\n      pollingInterval: lowestPollingInterval,\n      timeout: setTimeout(() => {\n        if (state.config.focused || !skipPollingIfUnfocused) {\n          api.dispatch(refetchQuery(querySubState));\n        }\n        startNextPoll({\n          queryCacheKey\n        }, api);\n      }, lowestPollingInterval)\n    });\n  }\n  function updatePollingInterval({\n    queryCacheKey\n  }: QuerySubstateIdentifier, api: SubMiddlewareApi) {\n    const state = api.getState()[reducerPath];\n    const querySubState = state.queries[queryCacheKey];\n    const subscriptions = currentSubscriptions.get(queryCacheKey);\n    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) {\n      return;\n    }\n    const {\n      lowestPollingInterval\n    } = findLowestPollingInterval(subscriptions);\n\n    // HACK add extra data to track how many times this has been called in tests\n    // yes we're mutating a nonexistent field on a Map here\n    if (process.env.NODE_ENV === 'test') {\n      const updateCounters = (currentPolls as any).pollUpdateCounters ??= {};\n      updateCounters[queryCacheKey] ??= 0;\n      updateCounters[queryCacheKey]++;\n    }\n    if (!Number.isFinite(lowestPollingInterval)) {\n      cleanupPollForKey(queryCacheKey);\n      return;\n    }\n    const currentPoll = currentPolls.get(queryCacheKey);\n    const nextPollTimestamp = Date.now() + lowestPollingInterval;\n    if (!currentPoll || nextPollTimestamp < currentPoll.nextPollTimestamp) {\n      startNextPoll({\n        queryCacheKey\n      }, api);\n    }\n  }\n  function cleanupPollForKey(key: string) {\n    const existingPoll = currentPolls.get(key);\n    if (existingPoll?.timeout) {\n      clearTimeout(existingPoll.timeout);\n    }\n    currentPolls.delete(key);\n  }\n  function clearPolls() {\n    for (const key of currentPolls.keys()) {\n      cleanupPollForKey(key);\n    }\n  }\n  function findLowestPollingInterval(subscribers: SubscribersInternal = new Map()) {\n    let skipPollingIfUnfocused: boolean | undefined = false;\n    let lowestPollingInterval = Number.POSITIVE_INFINITY;\n    for (const entry of subscribers.values()) {\n      if (!!entry.pollingInterval) {\n        lowestPollingInterval = Math.min(entry.pollingInterval!, lowestPollingInterval);\n        skipPollingIfUnfocused = entry.skipPollingIfUnfocused || skipPollingIfUnfocused;\n      }\n    }\n    return {\n      lowestPollingInterval,\n      skipPollingIfUnfocused\n    };\n  }\n  return handler;\n};","import { getEndpointDefinition } from '@internal/query/apiTypes';\nimport type { BaseQueryError, BaseQueryFn, BaseQueryMeta } from '../../baseQueryTypes';\nimport { isAnyQueryDefinition } from '../../endpointDefinitions';\nimport type { Recipe } from '../buildThunks';\nimport { isFulfilled, isPending, isRejected } from '../rtkImports';\nimport type { MutationBaseLifecycleApi, QueryBaseLifecycleApi } from './cacheLifecycle';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, PromiseConstructorWithKnownReason, PromiseWithKnownReason } from './types';\nexport type ReferenceQueryLifecycle = never;\ntype QueryLifecyclePromises<ResultType, BaseQuery extends BaseQueryFn> = {\n  /**\n   * Promise that will resolve with the (transformed) query result.\n   *\n   * If the query fails, this promise will reject with the error.\n   *\n   * This allows you to `await` for the query to finish.\n   *\n   * If you don't interact with this promise, it will not throw.\n   */\n  queryFulfilled: PromiseWithKnownReason<{\n    /**\n     * The (transformed) query result.\n     */\n    data: ResultType;\n    /**\n     * The `meta` returned by the `baseQuery`\n     */\n    meta: BaseQueryMeta<BaseQuery>;\n  }, QueryFulfilledRejectionReason<BaseQuery>>;\n};\ntype QueryFulfilledRejectionReason<BaseQuery extends BaseQueryFn> = {\n  error: BaseQueryError<BaseQuery>;\n  /**\n   * If this is `false`, that means this error was returned from the `baseQuery` or `queryFn` in a controlled manner.\n   */\n  isUnhandledError: false;\n  /**\n   * The `meta` returned by the `baseQuery`\n   */\n  meta: BaseQueryMeta<BaseQuery>;\n} | {\n  error: unknown;\n  meta?: undefined;\n  /**\n   * If this is `true`, that means that this error is the result of `baseQueryFn`, `queryFn`, `transformResponse` or `transformErrorResponse` throwing an error instead of handling it properly.\n   * There can not be made any assumption about the shape of `error`.\n   */\n  isUnhandledError: true;\n};\nexport type QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  /**\n   * A function that is called when the individual query is started. The function is called with a lifecycle api object containing properties such as `queryFulfilled`, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. throughout the lifecycle of an individual query/mutation call).\n   *\n   * Can be used to perform side-effects throughout the lifecycle of the query.\n   *\n   * @example\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   * import { messageCreated } from './notificationsSlice\n   * export interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({\n   *     baseUrl: '/',\n   *   }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, number>({\n   *       query: (id) => `post/${id}`,\n   *       async onQueryStarted(id, { dispatch, queryFulfilled }) {\n   *         // `onStart` side-effect\n   *         dispatch(messageCreated('Fetching posts...'))\n   *         try {\n   *           const { data } = await queryFulfilled\n   *           // `onSuccess` side-effect\n   *           dispatch(messageCreated('Posts received!'))\n   *         } catch (err) {\n   *           // `onError` side-effect\n   *           dispatch(messageCreated('Error fetching posts!'))\n   *         }\n   *       }\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  onQueryStarted?(queryArgument: QueryArg, queryLifeCycleApi: QueryLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport type QueryLifecycleInfiniteQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>;\nexport type QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  /**\n   * A function that is called when the individual mutation is started. The function is called with a lifecycle api object containing properties such as `queryFulfilled`, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. throughout the lifecycle of an individual query/mutation call).\n   *\n   * Can be used for `optimistic updates`.\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   * export interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({\n   *     baseUrl: '/',\n   *   }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, number>({\n   *       query: (id) => `post/${id}`,\n   *       providesTags: ['Post'],\n   *     }),\n   *     updatePost: build.mutation<void, Pick<Post, 'id'> & Partial<Post>>({\n   *       query: ({ id, ...patch }) => ({\n   *         url: `post/${id}`,\n   *         method: 'PATCH',\n   *         body: patch,\n   *       }),\n   *       invalidatesTags: ['Post'],\n   *       async onQueryStarted({ id, ...patch }, { dispatch, queryFulfilled }) {\n   *         const patchResult = dispatch(\n   *           api.util.updateQueryData('getPost', id, (draft) => {\n   *             Object.assign(draft, patch)\n   *           })\n   *         )\n   *         try {\n   *           await queryFulfilled\n   *         } catch {\n   *           patchResult.undo()\n   *         }\n   *       },\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  onQueryStarted?(queryArgument: QueryArg, mutationLifeCycleApi: MutationLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport interface QueryLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>, QueryLifecyclePromises<ResultType, BaseQuery> {}\nexport type MutationLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> & QueryLifecyclePromises<ResultType, BaseQuery>;\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryLifecycleQueryExtraOptions.onQueryStarted | onQueryStarted}\n * for a specific query.\n *\n * @example\n * <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>\n *\n * ```ts\n * import type { TypedQueryOnQueryStarted } from '@reduxjs/toolkit/query'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n *\n * type Post = {\n *   id: number\n *   title: string\n *   userId: number\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = number | undefined\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * const baseApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, void>({\n *       query: () => `/posts`,\n *     }),\n *\n *     getPostById: build.query<Post, QueryArgument>({\n *       query: (postId) => `/posts/${postId}`,\n *     }),\n *   }),\n * })\n *\n * const updatePostOnFulfilled: TypedQueryOnQueryStarted<\n *   PostsApiResponse,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   'postsApi'\n * > = async (queryArgument, { dispatch, queryFulfilled }) => {\n *   const result = await queryFulfilled\n *\n *   const { posts } = result.data\n *\n *   // Pre-fill the individual post entries with the results\n *   // from the list endpoint query\n *   dispatch(\n *     baseApiSlice.util.upsertQueryEntries(\n *       posts.map((post) => ({\n *         endpointName: 'getPostById',\n *         arg: post.id,\n *         value: post,\n *       })),\n *     ),\n *   )\n * }\n *\n * export const extendedApiSlice = baseApiSlice.injectEndpoints({\n *   endpoints: (build) => ({\n *     getPostsByUserId: build.query<PostsApiResponse, QueryArgument>({\n *       query: (userId) => `/posts/user/${userId}`,\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *   }),\n * })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template ReducerPath - The type representing the `reducerPath` for the API slice.\n *\n * @since 2.4.0\n * @public\n */\nexport type TypedQueryOnQueryStarted<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleQueryExtraOptions<ResultType, QueryArgumentType, BaseQueryFunctionType, ReducerPath>['onQueryStarted'];\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryLifecycleMutationExtraOptions.onQueryStarted | onQueryStarted}\n * for a specific mutation.\n *\n * @example\n * <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>\n *\n * ```ts\n * import type { TypedMutationOnQueryStarted } from '@reduxjs/toolkit/query'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n *\n * type Post = {\n *   id: number\n *   title: string\n *   userId: number\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = Pick<Post, 'id'> & Partial<Post>\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * const baseApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, void>({\n *       query: () => `/posts`,\n *     }),\n *\n *     getPostById: build.query<Post, number>({\n *       query: (postId) => `/posts/${postId}`,\n *     }),\n *   }),\n * })\n *\n * const updatePostOnFulfilled: TypedMutationOnQueryStarted<\n *   Post,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   'postsApi'\n * > = async ({ id, ...patch }, { dispatch, queryFulfilled }) => {\n *   const patchCollection = dispatch(\n *     baseApiSlice.util.updateQueryData('getPostById', id, (draftPost) => {\n *       Object.assign(draftPost, patch)\n *     }),\n *   )\n *\n *   try {\n *     await queryFulfilled\n *   } catch {\n *     patchCollection.undo()\n *   }\n * }\n *\n * export const extendedApiSlice = baseApiSlice.injectEndpoints({\n *   endpoints: (build) => ({\n *     addPost: build.mutation<Post, Omit<QueryArgument, 'id'>>({\n *       query: (body) => ({\n *         url: `posts/add`,\n *         method: 'POST',\n *         body,\n *       }),\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *\n *     updatePost: build.mutation<Post, QueryArgument>({\n *       query: ({ id, ...patch }) => ({\n *         url: `post/${id}`,\n *         method: 'PATCH',\n *         body: patch,\n *       }),\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *   }),\n * })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template ReducerPath - The type representing the `reducerPath` for the API slice.\n *\n * @since 2.4.0\n * @public\n */\nexport type TypedMutationOnQueryStarted<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleMutationExtraOptions<ResultType, QueryArgumentType, BaseQueryFunctionType, ReducerPath>['onQueryStarted'];\nexport const buildQueryLifecycleHandler: InternalHandlerBuilder = ({\n  api,\n  context,\n  queryThunk,\n  mutationThunk\n}) => {\n  const isPendingThunk = isPending(queryThunk, mutationThunk);\n  const isRejectedThunk = isRejected(queryThunk, mutationThunk);\n  const isFullfilledThunk = isFulfilled(queryThunk, mutationThunk);\n  type CacheLifecycle = {\n    resolve(value: {\n      data: unknown;\n      meta: unknown;\n    }): unknown;\n    reject(value: QueryFulfilledRejectionReason<any>): unknown;\n  };\n  const lifecycleMap: Record<string, CacheLifecycle> = {};\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (isPendingThunk(action)) {\n      const {\n        requestId,\n        arg: {\n          endpointName,\n          originalArgs\n        }\n      } = action.meta;\n      const endpointDefinition = getEndpointDefinition(context, endpointName);\n      const onQueryStarted = endpointDefinition?.onQueryStarted;\n      if (onQueryStarted) {\n        const lifecycle = {} as CacheLifecycle;\n        const queryFulfilled = new (Promise as PromiseConstructorWithKnownReason)<{\n          data: unknown;\n          meta: unknown;\n        }, QueryFulfilledRejectionReason<any>>((resolve, reject) => {\n          lifecycle.resolve = resolve;\n          lifecycle.reject = reject;\n        });\n        // prevent uncaught promise rejections from happening.\n        // if the original promise is used in any way, that will create a new promise that will throw again\n        queryFulfilled.catch(() => {});\n        lifecycleMap[requestId] = lifecycle;\n        const selector = (api.endpoints[endpointName] as any).select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : requestId);\n        const extra = mwApi.dispatch((_, __, extra) => extra);\n        const lifecycleApi = {\n          ...mwApi,\n          getCacheEntry: () => selector(mwApi.getState()),\n          requestId,\n          extra,\n          updateCachedData: (isAnyQueryDefinition(endpointDefinition) ? (updateRecipe: Recipe<any>) => mwApi.dispatch(api.util.updateQueryData(endpointName as never, originalArgs as never, updateRecipe)) : undefined) as any,\n          queryFulfilled\n        };\n        onQueryStarted(originalArgs, lifecycleApi as any);\n      }\n    } else if (isFullfilledThunk(action)) {\n      const {\n        requestId,\n        baseQueryMeta\n      } = action.meta;\n      lifecycleMap[requestId]?.resolve({\n        data: action.payload,\n        meta: baseQueryMeta\n      });\n      delete lifecycleMap[requestId];\n    } else if (isRejectedThunk(action)) {\n      const {\n        requestId,\n        rejectedWithValue,\n        baseQueryMeta\n      } = action.meta;\n      lifecycleMap[requestId]?.reject({\n        error: action.payload ?? action.error,\n        isUnhandledError: !rejectedWithValue,\n        meta: baseQueryMeta as any\n      });\n      delete lifecycleMap[requestId];\n    }\n  };\n  return handler;\n};","import { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport type { QueryCacheKey } from '../apiState';\nimport { onFocus, onOnline } from '../setupListeners';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, SubMiddlewareApi } from './types';\nexport const buildWindowEventHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  context,\n  api,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    removeQueryResult\n  } = api.internalActions;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (onFocus.match(action)) {\n      refetchValidQueries(mwApi, 'refetchOnFocus');\n    }\n    if (onOnline.match(action)) {\n      refetchValidQueries(mwApi, 'refetchOnReconnect');\n    }\n  };\n  function refetchValidQueries(api: SubMiddlewareApi, type: 'refetchOnFocus' | 'refetchOnReconnect') {\n    const state = api.getState()[reducerPath];\n    const queries = state.queries;\n    const subscriptions = internalState.currentSubscriptions;\n    context.batch(() => {\n      for (const queryCacheKey of subscriptions.keys()) {\n        const querySubState = queries[queryCacheKey];\n        const subscriptionSubState = subscriptions.get(queryCacheKey);\n        if (!subscriptionSubState || !querySubState) continue;\n        const values = [...subscriptionSubState.values()];\n        const shouldRefetch = values.some(sub => sub[type] === true) || values.every(sub => sub[type] === undefined) && state.config[type];\n        if (shouldRefetch) {\n          if (subscriptionSubState.size === 0) {\n            api.dispatch(removeQueryResult({\n              queryCacheKey: queryCacheKey as QueryCacheKey\n            }));\n          } else if (querySubState.status !== STATUS_UNINITIALIZED) {\n            api.dispatch(refetchQuery(querySubState));\n          }\n        }\n      }\n    });\n  }\n  return handler;\n};","import type { Action, Middleware, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { EndpointDefinitions, FullTagDescription } from '../../endpointDefinitions';\nimport type { QueryStatus, QuerySubState, RootState } from '../apiState';\nimport type { QueryThunkArg } from '../buildThunks';\nimport { createAction, isAction } from '../rtkImports';\nimport { buildBatchedActionsHandler } from './batchActions';\nimport { buildCacheCollectionHandler } from './cacheCollection';\nimport { buildCacheLifecycleHandler } from './cacheLifecycle';\nimport { buildDevCheckHandler } from './devMiddleware';\nimport { buildInvalidationByTagsHandler } from './invalidationByTags';\nimport { buildPollingHandler } from './polling';\nimport { buildQueryLifecycleHandler } from './queryLifecycle';\nimport type { BuildMiddlewareInput, InternalHandlerBuilder, InternalMiddlewareState } from './types';\nimport { buildWindowEventHandler } from './windowEventHandling';\nimport type { ApiEndpointQuery } from '../module';\nexport type { ReferenceCacheCollection } from './cacheCollection';\nexport type { MutationCacheLifecycleApi, QueryCacheLifecycleApi, ReferenceCacheLifecycle } from './cacheLifecycle';\nexport type { MutationLifecycleApi, QueryLifecycleApi, ReferenceQueryLifecycle, TypedMutationOnQueryStarted, TypedQueryOnQueryStarted } from './queryLifecycle';\nexport type { SubscriptionSelectors } from './types';\nexport function buildMiddleware<Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string>(input: BuildMiddlewareInput<Definitions, ReducerPath, TagTypes>) {\n  const {\n    reducerPath,\n    queryThunk,\n    api,\n    context,\n    getInternalState\n  } = input;\n  const {\n    apiUid\n  } = context;\n  const actions = {\n    invalidateTags: createAction<Array<TagTypes | FullTagDescription<TagTypes> | null | undefined>>(`${reducerPath}/invalidateTags`)\n  };\n  const isThisApiSliceAction = (action: Action) => action.type.startsWith(`${reducerPath}/`);\n  const handlerBuilders: InternalHandlerBuilder[] = [buildDevCheckHandler, buildCacheCollectionHandler, buildInvalidationByTagsHandler, buildPollingHandler, buildCacheLifecycleHandler, buildQueryLifecycleHandler];\n  const middleware: Middleware<{}, RootState<Definitions, string, ReducerPath>, ThunkDispatch<any, any, UnknownAction>> = mwApi => {\n    let initialized = false;\n    const internalState = getInternalState(mwApi.dispatch);\n    const builderArgs = {\n      ...(input as any as BuildMiddlewareInput<EndpointDefinitions, string, string>),\n      internalState,\n      refetchQuery,\n      isThisApiSliceAction,\n      mwApi\n    };\n    const handlers = handlerBuilders.map(build => build(builderArgs));\n    const batchedActionsHandler = buildBatchedActionsHandler(builderArgs);\n    const windowEventsHandler = buildWindowEventHandler(builderArgs);\n    return next => {\n      return action => {\n        if (!isAction(action)) {\n          return next(action);\n        }\n        if (!initialized) {\n          initialized = true;\n          // dispatch before any other action\n          mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));\n        }\n        const mwApiWithNext = {\n          ...mwApi,\n          next\n        };\n        const stateBefore = mwApi.getState();\n        const [actionShouldContinue, internalProbeResult] = batchedActionsHandler(action, mwApiWithNext, stateBefore);\n        let res: any;\n        if (actionShouldContinue) {\n          res = next(action);\n        } else {\n          res = internalProbeResult;\n        }\n        if (!!mwApi.getState()[reducerPath]) {\n          // Only run these checks if the middleware is registered okay\n\n          // This looks for actions that aren't specific to the API slice\n          windowEventsHandler(action, mwApiWithNext, stateBefore);\n          if (isThisApiSliceAction(action) || context.hasRehydrationInfo(action)) {\n            // Only run these additional checks if the actions are part of the API slice,\n            // or the action has hydration-related data\n            for (const handler of handlers) {\n              handler(action, mwApiWithNext, stateBefore);\n            }\n          }\n        }\n        return res;\n      };\n    };\n  };\n  return {\n    middleware,\n    actions\n  };\n  function refetchQuery(querySubState: Exclude<QuerySubState<any>, {\n    status: QueryStatus.uninitialized;\n  }>) {\n    return (input.api.endpoints[querySubState.endpointName] as ApiEndpointQuery<any, any>).initiate(querySubState.originalArgs as any, {\n      subscribe: false,\n      forceRefetch: true\n    });\n  }\n}","/**\n * Note: this file should import all other files for type discovery and declaration merging\n */\nimport type { ActionCreatorWithPayload, Dispatch, Middleware, Reducer, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport { enablePatches } from '../utils/immerImports';\nimport type { Api, Module } from '../apiTypes';\nimport type { BaseQueryFn } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { AssertTagTypes, EndpointDefinitions, InfiniteQueryDefinition, MutationDefinition, QueryArgFrom, QueryArgFromAnyQuery, QueryDefinition, TagDescription } from '../endpointDefinitions';\nimport { isInfiniteQueryDefinition, isMutationDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { assertCast, safeAssign } from '../tsHelpers';\nimport type { CombinedState, MutationKeys, QueryKeys, RootState } from './apiState';\nimport type { BuildInitiateApiEndpointMutation, BuildInitiateApiEndpointQuery, MutationActionCreatorResult, QueryActionCreatorResult, InfiniteQueryActionCreatorResult, BuildInitiateApiEndpointInfiniteQuery } from './buildInitiate';\nimport { buildInitiate } from './buildInitiate';\nimport type { ReferenceCacheCollection, ReferenceCacheLifecycle, ReferenceQueryLifecycle } from './buildMiddleware';\nimport { buildMiddleware } from './buildMiddleware';\nimport type { BuildSelectorsApiEndpointInfiniteQuery, BuildSelectorsApiEndpointMutation, BuildSelectorsApiEndpointQuery } from './buildSelectors';\nimport { buildSelectors } from './buildSelectors';\nimport type { SliceActions, UpsertEntries } from './buildSlice';\nimport { buildSlice } from './buildSlice';\nimport type { AllQueryKeys, BuildThunksApiEndpointInfiniteQuery, BuildThunksApiEndpointMutation, BuildThunksApiEndpointQuery, PatchQueryDataThunk, QueryArgFromAnyQueryDefinition, UpdateQueryDataThunk, UpsertQueryDataThunk } from './buildThunks';\nimport { buildThunks } from './buildThunks';\nimport { createSelector as _createSelector } from './rtkImports';\nimport { onFocus, onFocusLost, onOffline, onOnline } from './setupListeners';\nimport type { InternalMiddlewareState } from './buildMiddleware/types';\nimport { getOrInsertComputed } from '../utils';\nimport type { CreateSelectorFunction } from 'reselect';\n\n/**\n * `ifOlderThan` - (default: `false` | `number`) - _number is value in seconds_\n * - If specified, it will only run the query if the difference between `new Date()` and the last `fulfilledTimeStamp` is greater than the given value\n *\n * @overloadSummary\n * `force`\n * - If `force: true`, it will ignore the `ifOlderThan` value if it is set and the query will be run even if it exists in the cache.\n */\nexport type PrefetchOptions = {\n  ifOlderThan?: false | number;\n} | {\n  force?: boolean;\n};\nexport const coreModuleName = /* @__PURE__ */Symbol();\nexport type CoreModule = typeof coreModuleName | ReferenceCacheLifecycle | ReferenceQueryLifecycle | ReferenceCacheCollection;\nexport type ThunkWithReturnValue<T> = ThunkAction<T, any, any, UnknownAction>;\nexport interface ApiModules<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nBaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string> {\n  [coreModuleName]: {\n    /**\n     * This api's reducer should be mounted at `store[api.reducerPath]`.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    reducerPath: ReducerPath;\n    /**\n     * Internal actions not part of the public API. Note: These are subject to change at any given time.\n     */\n    internalActions: InternalActions;\n    /**\n     *  A standard redux reducer that enables core functionality. Make sure it's included in your store.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    reducer: Reducer<CombinedState<Definitions, TagTypes, ReducerPath>, UnknownAction>;\n    /**\n     * This is a standard redux middleware and is responsible for things like polling, garbage collection and a handful of other things. Make sure it's included in your store.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    middleware: Middleware<{}, RootState<Definitions, string, ReducerPath>, ThunkDispatch<any, any, UnknownAction>>;\n    /**\n     * A collection of utility thunks for various situations.\n     */\n    util: {\n      /**\n       * A thunk that (if dispatched) will return a specific running query, identified\n       * by `endpointName` and `arg`.\n       * If that query is not running, dispatching the thunk will result in `undefined`.\n       *\n       * Can be used to await a specific query triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningQueryThunk<EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>): ThunkWithReturnValue<QueryActionCreatorResult<Definitions[EndpointName] & {\n        type: 'query';\n      }> | InfiniteQueryActionCreatorResult<Definitions[EndpointName] & {\n        type: 'infinitequery';\n      }> | undefined>;\n\n      /**\n       * A thunk that (if dispatched) will return a specific running mutation, identified\n       * by `endpointName` and `fixedCacheKey` or `requestId`.\n       * If that mutation is not running, dispatching the thunk will result in `undefined`.\n       *\n       * Can be used to await a specific mutation triggered in any way,\n       * including via hook trigger functions or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningMutationThunk<EndpointName extends MutationKeys<Definitions>>(endpointName: EndpointName, fixedCacheKeyOrRequestId: string): ThunkWithReturnValue<MutationActionCreatorResult<Definitions[EndpointName] & {\n        type: 'mutation';\n      }> | undefined>;\n\n      /**\n       * A thunk that (if dispatched) will return all running queries.\n       *\n       * Useful for SSR scenarios to await all running queries triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningQueriesThunk(): ThunkWithReturnValue<Array<QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>>;\n\n      /**\n       * A thunk that (if dispatched) will return all running mutations.\n       *\n       * Useful for SSR scenarios to await all running mutations triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningMutationsThunk(): ThunkWithReturnValue<Array<MutationActionCreatorResult<any>>>;\n\n      /**\n       * A Redux thunk that can be used to manually trigger pre-fetching of data.\n       *\n       * The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a set of options used to determine if the data actually should be re-fetched based on cache staleness.\n       *\n       * React Hooks users will most likely never need to use this directly, as the `usePrefetch` hook will dispatch this thunk internally as needed when you call the prefetching function supplied by the hook.\n       *\n       * @example\n       *\n       * ```ts no-transpile\n       * dispatch(api.util.prefetch('getPosts', undefined, { force: true }))\n       * ```\n       */\n      prefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions): ThunkAction<void, any, any, UnknownAction>;\n      /**\n       * A Redux thunk action creator that, when dispatched, creates and applies a set of JSON diff/patch objects to the current state. This immediately updates the Redux state with those changes.\n       *\n       * The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and an `updateRecipe` callback function. The callback receives an Immer-wrapped `draft` of the current state, and may modify the draft to match the expected results after the mutation completes successfully.\n       *\n       * The thunk executes _synchronously_, and returns an object containing `{patches: Patch[], inversePatches: Patch[], undo: () => void}`. The `patches` and `inversePatches` are generated using Immer's [`produceWithPatches` method](https://immerjs.github.io/immer/patches).\n       *\n       * This is typically used as the first step in implementing optimistic updates. The generated `inversePatches` can be used to revert the updates by calling `dispatch(patchQueryData(endpointName, arg, inversePatches))`. Alternatively, the `undo` method can be called directly to achieve the same effect.\n       *\n       * Note that the first two arguments (`endpointName` and `arg`) are used to determine which existing cache entry to update. If no existing cache entry is found, the `updateRecipe` callback will not run.\n       *\n       * @example\n       *\n       * ```ts\n       * const patchCollection = dispatch(\n       *   api.util.updateQueryData('getPosts', undefined, (draftPosts) => {\n       *     draftPosts.push({ id: 1, name: 'Teddy' })\n       *   })\n       * )\n       * ```\n       */\n      updateQueryData: UpdateQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n\n      /**\n       * A Redux thunk action creator that, when dispatched, acts as an artificial API request to upsert a value into the cache.\n       *\n       * The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and the data to upsert.\n       *\n       * If no cache entry for that cache key exists, a cache entry will be created and the data added. If a cache entry already exists, this will _overwrite_ the existing cache entry data.\n       *\n       * The thunk executes _asynchronously_, and returns a promise that resolves when the store has been updated.\n       *\n       * If dispatched while an actual request is in progress, both the upsert and request will be handled as soon as they resolve, resulting in a \"last result wins\" update behavior.\n       *\n       * @example\n       *\n       * ```ts\n       * await dispatch(\n       *   api.util.upsertQueryData('getPost', {id: 1}, {id: 1, text: \"Hello!\"})\n       * )\n       * ```\n       */\n      upsertQueryData: UpsertQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n      /**\n       * A Redux thunk that applies a JSON diff/patch array to the cached data for a given query result. This immediately updates the Redux state with those changes.\n       *\n       * The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a JSON diff/patch array as produced by Immer's `produceWithPatches`.\n       *\n       * This is typically used as the second step in implementing optimistic updates. If a request fails, the optimistically-applied changes can be reverted by dispatching `patchQueryData` with the `inversePatches` that were generated by `updateQueryData` earlier.\n       *\n       * In cases where it is desired to simply revert the previous changes, it may be preferable to call the `undo` method returned from dispatching `updateQueryData` instead.\n       *\n       * @example\n       * ```ts\n       * const patchCollection = dispatch(\n       *   api.util.updateQueryData('getPosts', undefined, (draftPosts) => {\n       *     draftPosts.push({ id: 1, name: 'Teddy' })\n       *   })\n       * )\n       *\n       * // later\n       * dispatch(\n       *   api.util.patchQueryData('getPosts', undefined, patchCollection.inversePatches)\n       * )\n       *\n       * // or\n       * patchCollection.undo()\n       * ```\n       */\n      patchQueryData: PatchQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n\n      /**\n       * A Redux action creator that can be dispatched to manually reset the api state completely. This will immediately remove all existing cache entries, and all queries will be considered 'uninitialized'.\n       *\n       * @example\n       *\n       * ```ts\n       * dispatch(api.util.resetApiState())\n       * ```\n       */\n      resetApiState: SliceActions['resetApiState'];\n      upsertQueryEntries: UpsertEntries<Definitions>;\n\n      /**\n       * A Redux action creator that can be used to manually invalidate cache tags for [automated re-fetching](../../usage/automated-refetching.mdx).\n       *\n       * The action creator accepts one argument: the cache tags to be invalidated. It returns an action with those tags as a payload, and the corresponding `invalidateTags` action type for the api.\n       *\n       * Dispatching the result of this action creator will [invalidate](../../usage/automated-refetching.mdx#invalidating-cache-data) the given tags, causing queries to automatically re-fetch if they are subscribed to cache data that [provides](../../usage/automated-refetching.mdx#providing-cache-data) the corresponding tags.\n       *\n       * The array of tags provided to the action creator should be in one of the following formats, where `TagType` is equal to a string provided to the [`tagTypes`](../createApi.mdx#tagtypes) property of the api:\n       *\n       * - `[TagType]`\n       * - `[{ type: TagType }]`\n       * - `[{ type: TagType, id: number | string }]`\n       *\n       * @example\n       *\n       * ```ts\n       * dispatch(api.util.invalidateTags(['Post']))\n       * dispatch(api.util.invalidateTags([{ type: 'Post', id: 1 }]))\n       * dispatch(\n       *   api.util.invalidateTags([\n       *     { type: 'Post', id: 1 },\n       *     { type: 'Post', id: 'LIST' },\n       *   ])\n       * )\n       * ```\n       */\n      invalidateTags: ActionCreatorWithPayload<Array<TagDescription<TagTypes> | null | undefined>, string>;\n\n      /**\n       * A function to select all `{ endpointName, originalArgs, queryCacheKey }` combinations that would be invalidated by a specific set of tags.\n       *\n       * Can be used for mutations that want to do optimistic updates instead of invalidating a set of tags, but don't know exactly what they need to update.\n       */\n      selectInvalidatedBy: (state: RootState<Definitions, string, ReducerPath>, tags: ReadonlyArray<TagDescription<TagTypes> | null | undefined>) => Array<{\n        endpointName: string;\n        originalArgs: any;\n        queryCacheKey: string;\n      }>;\n\n      /**\n       * A function to select all arguments currently cached for a given endpoint.\n       *\n       * Can be used for mutations that want to do optimistic updates instead of invalidating a set of tags, but don't know exactly what they need to update.\n       */\n      selectCachedArgsForQuery: <QueryName extends AllQueryKeys<Definitions>>(state: RootState<Definitions, string, ReducerPath>, queryName: QueryName) => Array<QueryArgFromAnyQuery<Definitions[QueryName]>>;\n    };\n    /**\n     * Endpoints based on the input endpoints provided to `createApi`, containing `select` and `action matchers`.\n     */\n    endpoints: { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? ApiEndpointQuery<Definitions[K], Definitions> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? ApiEndpointMutation<Definitions[K], Definitions> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? ApiEndpointInfiniteQuery<Definitions[K], Definitions> : never };\n  };\n}\nexport interface ApiEndpointQuery<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends QueryDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointQuery<Definition>, BuildInitiateApiEndpointQuery<Definition>, BuildSelectorsApiEndpointQuery<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\nexport interface ApiEndpointInfiniteQuery<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends InfiniteQueryDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointInfiniteQuery<Definition>, BuildInitiateApiEndpointInfiniteQuery<Definition>, BuildSelectorsApiEndpointInfiniteQuery<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport interface ApiEndpointMutation<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends MutationDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointMutation<Definition>, BuildInitiateApiEndpointMutation<Definition>, BuildSelectorsApiEndpointMutation<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\nexport type ListenerActions = {\n  /**\n   * Will cause the RTK Query middleware to trigger any refetchOnReconnect-related behavior\n   * @link https://redux-toolkit.js.org/rtk-query/api/setupListeners\n   */\n  onOnline: typeof onOnline;\n  onOffline: typeof onOffline;\n  /**\n   * Will cause the RTK Query middleware to trigger any refetchOnFocus-related behavior\n   * @link https://redux-toolkit.js.org/rtk-query/api/setupListeners\n   */\n  onFocus: typeof onFocus;\n  onFocusLost: typeof onFocusLost;\n};\nexport type InternalActions = SliceActions & ListenerActions;\nexport interface CoreModuleOptions {\n  /**\n   * A selector creator (usually from `reselect`, or matching the same signature)\n   */\n  createSelector?: CreateSelectorFunction<any, any, any>;\n}\n\n/**\n * Creates a module containing the basic redux logic for use with `buildCreateApi`.\n *\n * @example\n * ```ts\n * const createBaseApi = buildCreateApi(coreModule());\n * ```\n */\nexport const coreModule = ({\n  createSelector = _createSelector\n}: CoreModuleOptions = {}): Module<CoreModule> => ({\n  name: coreModuleName,\n  init(api, {\n    baseQuery,\n    tagTypes,\n    reducerPath,\n    serializeQueryArgs,\n    keepUnusedDataFor,\n    refetchOnMountOrArgChange,\n    refetchOnFocus,\n    refetchOnReconnect,\n    invalidationBehavior,\n    onSchemaFailure,\n    catchSchemaFailure,\n    skipSchemaValidation\n  }, context) {\n    enablePatches();\n    assertCast<InternalSerializeQueryArgs>(serializeQueryArgs);\n    const assertTagType: AssertTagTypes = tag => {\n      if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n        if (!tagTypes.includes(tag.type as any)) {\n          console.error(`Tag type '${tag.type}' was used, but not specified in \\`tagTypes\\`!`);\n        }\n      }\n      return tag;\n    };\n    Object.assign(api, {\n      reducerPath,\n      endpoints: {},\n      internalActions: {\n        onOnline,\n        onOffline,\n        onFocus,\n        onFocusLost\n      },\n      util: {}\n    });\n    const selectors = buildSelectors({\n      serializeQueryArgs: serializeQueryArgs as any,\n      reducerPath,\n      createSelector\n    });\n    const {\n      selectInvalidatedBy,\n      selectCachedArgsForQuery,\n      buildQuerySelector,\n      buildInfiniteQuerySelector,\n      buildMutationSelector\n    } = selectors;\n    safeAssign(api.util, {\n      selectInvalidatedBy,\n      selectCachedArgsForQuery\n    });\n    const {\n      queryThunk,\n      infiniteQueryThunk,\n      mutationThunk,\n      patchQueryData,\n      updateQueryData,\n      upsertQueryData,\n      prefetch,\n      buildMatchThunkActions\n    } = buildThunks({\n      baseQuery,\n      reducerPath,\n      context,\n      api,\n      serializeQueryArgs,\n      assertTagType,\n      selectors,\n      onSchemaFailure,\n      catchSchemaFailure,\n      skipSchemaValidation\n    });\n    const {\n      reducer,\n      actions: sliceActions\n    } = buildSlice({\n      context,\n      queryThunk,\n      infiniteQueryThunk,\n      mutationThunk,\n      serializeQueryArgs,\n      reducerPath,\n      assertTagType,\n      config: {\n        refetchOnFocus,\n        refetchOnReconnect,\n        refetchOnMountOrArgChange,\n        keepUnusedDataFor,\n        reducerPath,\n        invalidationBehavior\n      }\n    });\n    safeAssign(api.util, {\n      patchQueryData,\n      updateQueryData,\n      upsertQueryData,\n      prefetch,\n      resetApiState: sliceActions.resetApiState,\n      upsertQueryEntries: sliceActions.cacheEntriesUpserted as any\n    });\n    safeAssign(api.internalActions, sliceActions);\n    const internalStateMap = new WeakMap<Dispatch, InternalMiddlewareState>();\n    const getInternalState = (dispatch: Dispatch) => {\n      const state = getOrInsertComputed(internalStateMap, dispatch, () => ({\n        currentSubscriptions: new Map(),\n        currentPolls: new Map(),\n        runningQueries: new Map(),\n        runningMutations: new Map()\n      }));\n      return state;\n    };\n    const {\n      buildInitiateQuery,\n      buildInitiateInfiniteQuery,\n      buildInitiateMutation,\n      getRunningMutationThunk,\n      getRunningMutationsThunk,\n      getRunningQueriesThunk,\n      getRunningQueryThunk\n    } = buildInitiate({\n      queryThunk,\n      mutationThunk,\n      infiniteQueryThunk,\n      api,\n      serializeQueryArgs: serializeQueryArgs as any,\n      context,\n      getInternalState\n    });\n    safeAssign(api.util, {\n      getRunningMutationThunk,\n      getRunningMutationsThunk,\n      getRunningQueryThunk,\n      getRunningQueriesThunk\n    });\n    const {\n      middleware,\n      actions: middlewareActions\n    } = buildMiddleware({\n      reducerPath,\n      context,\n      queryThunk,\n      mutationThunk,\n      infiniteQueryThunk,\n      api,\n      assertTagType,\n      selectors,\n      getRunningQueryThunk,\n      getInternalState\n    });\n    safeAssign(api.util, middlewareActions);\n    safeAssign(api, {\n      reducer: reducer as any,\n      middleware\n    });\n    return {\n      name: coreModuleName,\n      injectEndpoint(endpointName, definition) {\n        const anyApi = api as any as Api<any, Record<string, any>, string, string, CoreModule>;\n        const endpoint = anyApi.endpoints[endpointName] ??= {} as any;\n        if (isQueryDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildQuerySelector(endpointName, definition),\n            initiate: buildInitiateQuery(endpointName, definition)\n          }, buildMatchThunkActions(queryThunk, endpointName));\n        }\n        if (isMutationDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildMutationSelector(),\n            initiate: buildInitiateMutation(endpointName)\n          }, buildMatchThunkActions(mutationThunk, endpointName));\n        }\n        if (isInfiniteQueryDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildInfiniteQuerySelector(endpointName, definition),\n            initiate: buildInitiateInfiniteQuery(endpointName, definition)\n          }, buildMatchThunkActions(queryThunk, endpointName));\n        }\n      }\n    };\n  }\n});","import { buildCreateApi } from '../createApi';\nimport { coreModule } from './module';\nexport const createApi = /* @__PURE__ */buildCreateApi(coreModule());\nexport { QueryStatus } from './apiState';\nexport type { CombinedState, InfiniteData, InfiniteQueryConfigOptions, InfiniteQuerySubState, MutationKeys, QueryCacheKey, QueryKeys, QuerySubState, RootState, SubscriptionOptions } from './apiState';\nexport type { InfiniteQueryActionCreatorResult, MutationActionCreatorResult, QueryActionCreatorResult, StartQueryActionCreatorOptions } from './buildInitiate';\nexport type { MutationCacheLifecycleApi, MutationLifecycleApi, QueryCacheLifecycleApi, QueryLifecycleApi, SubscriptionSelectors, TypedMutationOnQueryStarted, TypedQueryOnQueryStarted } from './buildMiddleware/index';\nexport { skipToken } from './buildSelectors';\nexport type { InfiniteQueryResultSelectorResult, MutationResultSelectorResult, QueryResultSelectorResult, SkipToken } from './buildSelectors';\nexport type { SliceActions } from './buildSlice';\nexport type { PatchQueryDataThunk, UpdateQueryDataThunk, UpsertQueryDataThunk } from './buildThunks';\nexport { coreModuleName } from './module';\nexport type { ApiEndpointInfiniteQuery, ApiEndpointMutation, ApiEndpointQuery, CoreModule, InternalActions, PrefetchOptions, ThunkWithReturnValue } from './module';\nexport { setupListeners } from './setupListeners';\nexport { buildCreateApi, coreModule };"],"mappings":"ubAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,sBAAAE,GAAA,gBAAAC,GAAA,WAAAC,GAAA,mBAAAC,GAAA,8BAAAC,GAAA,eAAAC,GAAA,mBAAAC,GAAA,cAAAC,GAAA,8BAAAC,GAAA,kBAAAC,GAAA,mBAAAC,GAAA,UAAAC,GAAA,mBAAAC,GAAA,cAAAC,KAAA,eAAAC,GAAAhB,ICkEO,IAAKiB,QACVA,EAAA,cAAgB,gBAChBA,EAAA,QAAU,UACVA,EAAA,UAAY,YACZA,EAAA,SAAW,WAJDA,QAAA,IAQCC,EAAuB,gBACvBC,GAAiB,UACjBC,GAAmB,YACnBC,GAAkB,WA0BxB,SAASC,GAAsBC,EAAyC,CAC7E,MAAO,CACL,OAAAA,EACA,gBAAiBA,IAAWL,EAC5B,UAAWK,IAAWJ,GACtB,UAAWI,IAAWH,GACtB,QAASG,IAAWF,EACtB,CACF,CC3GA,IAAAG,EAAoR,4BCDpR,IAAMC,GAAqC,gBAEpC,SAASC,GAA0BC,EAAaC,EAAkB,CACvE,GAAID,IAAWC,GAAU,EAAEH,GAAcE,CAAM,GAAKF,GAAcG,CAAM,GAAK,MAAM,QAAQD,CAAM,GAAK,MAAM,QAAQC,CAAM,GACxH,OAAOA,EAET,IAAMC,EAAU,OAAO,KAAKD,CAAM,EAC5BE,EAAU,OAAO,KAAKH,CAAM,EAC9BI,EAAeF,EAAQ,SAAWC,EAAQ,OACxCE,EAAgB,MAAM,QAAQJ,CAAM,EAAI,C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CACnB,KAAMH,EACN,OAAQ9B,EAA2B8B,EAAcC,CAAU,EAC3D,SAAUX,EAA2BU,EAAcC,CAAU,CAC/D,EAAGrB,EAAuBP,EAAY2B,CAAY,CAAC,CAEvD,CACF,CACF,CACF,GCniBO,IAAMO,GAA2BC,GAAeC,GAAW,CAAC","names":["query_exports","__export","NamedSchemaError","QueryStatus","_NEVER","buildCreateApi","copyWithStructuralSharing","coreModule","coreModuleName","createApi","defaultSerializeQueryArgs","fakeBaseQuery","fetchBaseQuery","retry","setupListeners","skipToken","__toCommonJS","QueryStatus","STATUS_UNINITIALIZED","STATUS_PENDING","STATUS_FULFILLED","STATUS_REJECTED","getRequestStatusFlags","status","import_toolkit","isPlainObject","copyWithStructuralSharing","oldObj","newObj","newKeys","oldKeys","isSameObject","mergeObj","key","filterMap","array","predicate","mapper","acc","item","i","isAbsoluteUrl","url","isDocumentVisible","isNotNullish","v","filterNullishValues","map","isOnline","withoutTrailingSlash","url","withoutLeadingSlash","joinUrls","base","isAbsoluteUrl","delimiter","getOrInsertComputed","map","key","compute","createNewMap","timeoutSignal","milliseconds","abortController","message","name","anySignal","signals","signal","defaultFetchFn","args","defaultValidateStatus","response","defaultIsJsonContentType","headers","stripUndefined","obj","copy","k","v","isJsonifiable","body","fetchBaseQuery","baseUrl","prepareHeaders","x","fetchFn","paramsSerializer","isJsonContentType","jsonContentType","jsonReplacer","defaultTimeout","globalResponseHandler","globalValidateStatus","baseFetchOptions","arg","api","extraOptions","getState","extra","endpoint","forced","type","meta","url","params","responseHandler","validateStatus","timeout","rest","config","anySignal","timeoutSignal","bodyIsJsonifiable","divider","query","joinUrls","request","e","responseClone","resultData","responseText","handleResponseError","handleResponse","r","text","HandledError","value","meta","defaultBackoff","attempt","maxRetries","signal","attempts","timeout","resolve","reject","timeoutId","abortHandler","fail","error","meta","HandledError","failIfAborted","EMPTY_OPTIONS","retryWithBackoff","baseQuery","defaultOptions","args","api","extraOptions","possibleMaxRetries","x","options","_","__","retry","result","e","backoffError","INTERNAL_PREFIX","ONLINE","OFFLINE","FOCUS","FOCUSED","VISIBILITYCHANGE","onFocus","onFocusLost","onOnline","onOffline","actions","initialized","setupListeners","dispatch","customHandler","defaultHandler","handleFocus","handleFocusLost","handleOnline","handleOffline","action","handleVisibilityChange","unsubscribe","updateListeners","add","handlers","event","handler","ENDPOINT_QUERY","ENDPOINT_MUTATION","ENDPOINT_INFINITEQUERY","isQueryDefinition","isMutationDefinition","isInfiniteQueryDefinition","isAnyQueryDefinition","calculateProvidedBy","description","result","error","queryArg","meta","assertTagTypes","finalDescription","isFunction","filterMap","isNotNullish","tag","expandTagDescription","t","import_immer","import_toolkit","asSafePromise","promise","fallback","getEndpointDefinition","context","endpointName","forceQueryFnSymbol","isUpsertQuery","arg","buildInitiate","serializeQueryArgs","queryThunk","infiniteQueryThunk","mutationThunk","api","context","getInternalState","getRunningQueries","dispatch","getRunningMutations","unsubscribeQueryResult","removeMutationResult","updateSubscriptionOptions","buildInitiateQuery","buildInitiateInfiniteQuery","buildInitiateMutation","getRunningQueryThunk","getRunningMutationThunk","getRunningQueriesThunk","getRunningMutationsThunk","endpointName","queryArgs","endpointDefinition","getEndpointDefinition","queryCacheKey","_endpointName","fixedCacheKeyOrRequestId","filterNullishValues","middlewareWarning","buildInitiateAnyQuery","queryAction","subscribe","forceRefetch","subscriptionOptions","forceQueryFn","rest","getState","thunk","commonThunkArgs","ENDPOINT_QUERY","isQueryDefinition","direction","initialPageParam","refetchCachedPages","selector","thunkResult","stateAfter","requestId","abort","skippedSynchronously","runningQuery","selectFromState","statePromise","result","options","runningQueries","track","fixedCacheKey","unwrap","returnValuePromise","asSafePromise","data","error","reset","ret","runningMutations","import_utils","NamedSchemaError","issues","value","schemaName","_bqMeta","shouldSkip","skipSchemaValidation","parseWithSchema","schema","data","bqMeta","result","defaultTransformResponse","baseQueryReturnValue","addShouldAutoBatch","arg","buildThunks","reducerPath","baseQuery","endpointDefinitions","serializeQueryArgs","api","assertTagType","selectors","onSchemaFailure","globalCatchSchemaFailure","globalSkipSchemaValidation","patchQueryData","endpointName","patches","updateProvided","dispatch","getState","endpointDefinition","queryCacheKey","newValue","providedTags","calculateProvidedBy","addToStart","items","item","max","newItems","addToEnd","updateQueryData","updateRecipe","currentState","ret","STATUS_UNINITIALIZED","value","inversePatches","upsertQueryData","forceQueryFnSymbol","getTransformCallbackForEndpoint","transformFieldName","executeEndpoint","signal","abort","rejectWithValue","fulfillWithValue","extra","metaSchema","skipSchemaValidation","isQuery","ENDPOINT_QUERY","transformResponse","baseQueryApi","isForcedQuery","forceQueryFn","finalQueryReturnValue","fetchPage","data","param","maxPages","previous","finalQueryArg","pageResponse","executeRequest","addTo","result","extraOptions","argSchema","rawResponseSchema","responseSchema","shouldSkip","parseWithSchema","HandledError","transformedResponse","infiniteQueryOptions","refetchCachedPages","blankData","cachedData","existingData","getPreviousPageParam","getNextPageParam","initialPageParam","cachedPageParams","firstPageParam","totalPages","i","error","caughtError","transformErrorResponse","rawErrorResponseSchema","errorResponseSchema","meta","transformedErrorResponse","e","NamedSchemaError","info","catchSchemaFailure","state","requestState","baseFetchOnMountOrArgChange","fulfilledVal","refetchVal","createQueryThunk","isInfiniteQueryDefinition","queryThunkArg","currentArg","previousArg","direction","isUpsertQuery","isQueryDefinition","queryThunk","infiniteQueryThunk","mutationThunk","hasTheForce","options","hasMaxAge","prefetch","force","maxAge","queryAction","latestStateValue","lastFulfilledTs","matchesEndpoint","action","buildMatchThunkActions","thunk","pages","pageParams","queryArg","lastIndex","calculateProvidedByThunk","type","getCurrent","value","updateQuerySubstateIfExists","state","queryCacheKey","update","substate","getMutationCacheKey","id","updateMutationSubstateIfExists","initialState","buildSlice","reducerPath","queryThunk","mutationThunk","serializeQueryArgs","definitions","apiUid","extractRehydrationInfo","hasRehydrationInfo","assertTagType","config","resetApiState","writePendingCacheEntry","draft","arg","upserting","meta","STATUS_UNINITIALIZED","STATUS_PENDING","endpointDefinition","isInfiniteQueryDefinition","writeFulfilledCacheEntry","payload","merge","STATUS_FULFILLED","fulfilledTimeStamp","baseQueryMeta","requestId","newData","draftSubstateData","copyWithStructuralSharing","querySlice","action","entry","value","endpointName","ENDPOINT_QUERY","patches","builder","isUpsertQuery","condition","error","STATUS_REJECTED","queries","key","mutationSlice","cacheKey","startedTimeStamp","mutations","initialInvalidationState","invalidationSlice","providedTags","removeCacheKeyFromTags","type","subscribedQueries","provided","incomingTags","cacheKeys","writeProvidedTagsForQueries","mockActions","queryDescription","existingTags","getCurrent","tag","tagType","tagId","tagSubscriptions","qc","actions","providedByEntries","calculateProvidedByThunk","subscriptionSlice","internalSubscriptionsSlice","configSlice","isOnline","isDocumentVisible","onOnline","onOffline","onFocus","onFocusLost","combinedReducer","reducer","skipToken","initialSubState","STATUS_UNINITIALIZED","defaultQuerySubState","defaultMutationSubState","buildSelectors","serializeQueryArgs","reducerPath","createSelector","selectSkippedQuery","state","selectSkippedMutation","buildQuerySelector","buildInfiniteQuerySelector","buildMutationSelector","selectInvalidatedBy","selectCachedArgsForQuery","selectApiState","selectQueries","selectMutations","selectQueryEntry","selectConfig","withRequestFlags","substate","getRequestStatusFlags","rootState","cacheKey","buildAnyQuerySelector","endpointName","endpointDefinition","combiner","queryArgs","serializedArgs","infiniteQueryOptions","withInfiniteQueryResultFlags","stateWithRequestFlags","isLoading","isError","direction","isForward","isBackward","getHasNextPage","getHasPreviousPage","id","mutationId","getMutationCacheKey","tags","apiState","toInvalidate","finalTags","filterMap","isNotNullish","expandTagDescription","tag","provided","invalidateSubscriptions","invalidate","queryCacheKey","querySubState","queryName","entry","options","data","queryArg","getNextPageParam","getPreviousPageParam","import_toolkit","cache","defaultSerializeQueryArgs","endpointName","queryArgs","serialized","cached","stringified","key","value","acc","import_reselect","buildCreateApi","modules","options","extractRehydrationInfo","action","optionsWithDefaults","queryArgsApi","finalSerializeQueryArgs","defaultSerializeQueryArgs","endpointSQA","initialResult","context","fn","api","injectEndpoints","addTagTypes","endpoints","eT","endpointName","partialDefinition","getEndpointDefinition","initializedModules","m","inject","evaluatedEndpoints","x","ENDPOINT_QUERY","ENDPOINT_MUTATION","ENDPOINT_INFINITEQUERY","definition","_formatProdErrorMessage","import_toolkit","_NEVER","fakeBaseQuery","_formatProdErrorMessage","safeAssign","target","args","buildBatchedActionsHandler","api","queryThunk","internalState","mwApi","subscriptionsPrefix","previousSubscriptions","updateSyncTimer","updateSubscriptionOptions","unsubscribeQueryResult","actuallyMutateSubscriptions","currentSubscriptions","action","queryCacheKey","requestId","options","sub","arg","substate","getOrInsertComputed","createNewMap","mutated","condition","getSubscriptions","subscriptionSelectors","serializeSubscriptions","k","v","didMutate","actionShouldContinue","newSubscriptions","patches","isSubscriptionSliceAction","isAdditionalSubscriptionAction","THIRTY_TWO_BIT_MAX_TIMER_SECONDS","buildCacheCollectionHandler","reducerPath","api","queryThunk","context","internalState","selectQueryEntry","selectConfig","getRunningQueryThunk","mwApi","removeQueryResult","unsubscribeQueryResult","cacheEntriesUpserted","canTriggerUnsubscribe","anySubscriptionsRemainingForKey","queryCacheKey","subscriptions","currentRemovalTimeouts","abortAllPromises","promiseMap","promise","handler","action","state","config","queryCacheKeys","entry","handleUnsubscribeMany","key","timeout","queries","cacheKeys","handleUnsubscribe","endpointName","keepUnusedDataFor","getEndpointDefinition","finalKeepUnusedDataFor","currentTimeout","neverResolvedError","buildCacheLifecycleHandler","api","reducerPath","context","queryThunk","mutationThunk","internalState","selectQueryEntry","selectApiState","isQueryThunk","isMutationThunk","isFulfilledThunk","lifecycleMap","removeQueryResult","removeMutationResult","cacheEntriesUpserted","resolveLifecycleEntry","cacheKey","data","meta","lifecycle","removeLifecycleEntry","getActionMetaFields","action","arg","requestId","endpointName","originalArgs","handler","mwApi","stateBefore","getCacheKey","checkForNewCacheKey","oldEntry","newEntry","handleNewKey","queryDescription","value","queryCacheKey","getMutationCacheKey","endpointDefinition","getEndpointDefinition","onCacheEntryAdded","cacheEntryRemoved","resolve","cacheDataLoaded","selector","isAnyQueryDefinition","extra","_","__","lifecycleApi","updateRecipe","runningHandler","e","buildDevCheckHandler","api","apiUid","reducerPath","action","mwApi","buildInvalidationByTagsHandler","reducerPath","context","endpointDefinitions","mutationThunk","queryThunk","api","assertTagType","refetchQuery","internalState","removeQueryResult","isThunkActionWithTags","isQueryEnd","pendingTagInvalidations","pendingRequestCount","handler","action","mwApi","invalidateTags","calculateProvidedByThunk","calculateProvidedBy","hasPendingRequests","newTags","rootState","state","tags","toInvalidate","valuesArray","queryCacheKey","querySubState","subscriptionSubState","getOrInsertComputed","createNewMap","STATUS_UNINITIALIZED","buildPollingHandler","reducerPath","queryThunk","api","refetchQuery","internalState","currentPolls","currentSubscriptions","pendingPollingUpdates","pollingUpdateTimer","handler","action","mwApi","schedulePollingUpdate","startNextPoll","clearPolls","queryCacheKey","key","updatePollingInterval","state","querySubState","subscriptions","STATUS_UNINITIALIZED","lowestPollingInterval","skipPollingIfUnfocused","findLowestPollingInterval","currentPoll","nextPollTimestamp","cleanupPollForKey","existingPoll","subscribers","entry","buildQueryLifecycleHandler","api","context","queryThunk","mutationThunk","isPendingThunk","isRejectedThunk","isFullfilledThunk","lifecycleMap","action","mwApi","requestId","endpointName","originalArgs","endpointDefinition","getEndpointDefinition","onQueryStarted","lifecycle","queryFulfilled","resolve","reject","selector","isAnyQueryDefinition","extra","_","__","lifecycleApi","updateRecipe","baseQueryMeta","rejectedWithValue","buildWindowEventHandler","reducerPath","context","api","refetchQuery","internalState","removeQueryResult","handler","action","mwApi","onFocus","refetchValidQueries","onOnline","type","state","queries","subscriptions","queryCacheKey","querySubState","subscriptionSubState","values","sub","STATUS_UNINITIALIZED","buildMiddleware","input","reducerPath","queryThunk","api","context","getInternalState","apiUid","actions","isThisApiSliceAction","action","handlerBuilders","buildDevCheckHandler","buildCacheCollectionHandler","buildInvalidationByTagsHandler","buildPollingHandler","buildCacheLifecycleHandler","buildQueryLifecycleHandler","mwApi","initialized","internalState","builderArgs","refetchQuery","handlers","build","batchedActionsHandler","buildBatchedActionsHandler","windowEventsHandler","buildWindowEventHandler","next","mwApiWithNext","stateBefore","actionShouldContinue","internalProbeResult","res","handler","querySubState","coreModuleName","coreModule","createSelector","api","baseQuery","tagTypes","reducerPath","serializeQueryArgs","keepUnusedDataFor","refetchOnMountOrArgChange","refetchOnFocus","refetchOnReconnect","invalidationBehavior","onSchemaFailure","catchSchemaFailure","skipSchemaValidation","context","assertTagType","tag","onOnline","onOffline","onFocus","onFocusLost","selectors","buildSelectors","selectInvalidatedBy","selectCachedArgsForQuery","buildQuerySelector","buildInfiniteQuerySelector","buildMutationSelector","safeAssign","queryThunk","infiniteQueryThunk","mutationThunk","patchQueryData","updateQueryData","upsertQueryData","prefetch","buildMatchThunkActions","buildThunks","reducer","sliceActions","buildSlice","internalStateMap","getInternalState","dispatch","getOrInsertComputed","buildInitiateQuery","buildInitiateInfiniteQuery","buildInitiateMutation","getRunningMutationThunk","getRunningMutationsThunk","getRunningQueriesThunk","getRunningQueryThunk","buildInitiate","middleware","middlewareActions","buildMiddleware","endpointName","definition","anyApi","endpoint","isQueryDefinition","isMutationDefinition","isInfiniteQueryDefinition","createApi","buildCreateApi","coreModule"]}
Index: node_modules/@reduxjs/toolkit/dist/query/index.d.mts
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/index.d.mts	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/index.d.mts	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,2954 @@
+import * as _reduxjs_toolkit from '@reduxjs/toolkit';
+import { ThunkDispatch, UnknownAction, Draft, AsyncThunk, SHOULD_AUTOBATCH, ThunkAction, SafePromise, SerializedError, PayloadAction, ActionCreatorWithoutPayload, Reducer, Middleware, ActionCreatorWithPayload } from '@reduxjs/toolkit';
+import { Patch } from 'immer';
+import * as redux from 'redux';
+import { CreateSelectorFunction } from 'reselect';
+import { StandardSchemaV1 } from '@standard-schema/spec';
+import { SchemaError } from '@standard-schema/utils';
+
+type Id<T> = {
+    [K in keyof T]: T[K];
+} & {};
+type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
+type Override<T1, T2> = T2 extends any ? Omit<T1, keyof T2> & T2 : never;
+/**
+ * Convert a Union type `(A|B)` to an intersection type `(A&B)`
+ */
+type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
+type NonOptionalKeys<T> = {
+    [K in keyof T]-?: undefined extends T[K] ? never : K;
+}[keyof T];
+type HasRequiredProps<T, True, False> = NonOptionalKeys<T> extends never ? False : True;
+type NoInfer<T> = [T][T extends any ? 0 : never];
+type NonUndefined<T> = T extends undefined ? never : T;
+type UnwrapPromise<T> = T extends PromiseLike<infer V> ? V : T;
+type MaybePromise<T> = T | PromiseLike<T>;
+type OmitFromUnion<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
+type IsAny<T, True, False = never> = true | false extends (T extends never ? true : false) ? True : False;
+type CastAny<T, CastTo> = IsAny<T, CastTo, T>;
+
+interface BaseQueryApi {
+    signal: AbortSignal;
+    abort: (reason?: string) => void;
+    dispatch: ThunkDispatch<any, any, any>;
+    getState: () => unknown;
+    extra: unknown;
+    endpoint: string;
+    type: 'query' | 'mutation';
+    /**
+     * Only available for queries: indicates if a query has been forced,
+     * i.e. it would have been fetched even if there would already be a cache entry
+     * (this does not mean that there is already a cache entry though!)
+     *
+     * This can be used to for example add a `Cache-Control: no-cache` header for
+     * invalidated queries.
+     */
+    forced?: boolean;
+    /**
+     * Only available for queries: the cache key that was used to store the query result
+     */
+    queryCacheKey?: string;
+}
+type QueryReturnValue<T = unknown, E = unknown, M = unknown> = {
+    error: E;
+    data?: undefined;
+    meta?: M;
+} | {
+    error?: undefined;
+    data: T;
+    meta?: M;
+};
+type BaseQueryFn<Args = any, Result = unknown, Error = unknown, DefinitionExtraOptions = {}, Meta = {}> = (args: Args, api: BaseQueryApi, extraOptions: DefinitionExtraOptions) => MaybePromise<QueryReturnValue<Result, Error, Meta>>;
+type BaseQueryEnhancer<AdditionalArgs = unknown, AdditionalDefinitionExtraOptions = unknown, Config = void> = <BaseQuery extends BaseQueryFn>(baseQuery: BaseQuery, config: Config) => BaseQueryFn<BaseQueryArg<BaseQuery> & AdditionalArgs, BaseQueryResult<BaseQuery>, BaseQueryError<BaseQuery>, BaseQueryExtraOptions<BaseQuery> & AdditionalDefinitionExtraOptions, NonNullable<BaseQueryMeta<BaseQuery>>>;
+/**
+ * @public
+ */
+type BaseQueryResult<BaseQuery extends BaseQueryFn> = UnwrapPromise<ReturnType<BaseQuery>> extends infer Unwrapped ? Unwrapped extends {
+    data: any;
+} ? Unwrapped['data'] : never : never;
+/**
+ * @public
+ */
+type BaseQueryMeta<BaseQuery extends BaseQueryFn> = UnwrapPromise<ReturnType<BaseQuery>>['meta'];
+/**
+ * @public
+ */
+type BaseQueryError<BaseQuery extends BaseQueryFn> = Exclude<UnwrapPromise<ReturnType<BaseQuery>>, {
+    error?: undefined;
+}>['error'];
+/**
+ * @public
+ */
+type BaseQueryArg<T extends (arg: any, ...args: any[]) => any> = T extends (arg: infer A, ...args: any[]) => any ? A : any;
+/**
+ * @public
+ */
+type BaseQueryExtraOptions<BaseQuery extends BaseQueryFn> = Parameters<BaseQuery>[2];
+
+declare const defaultSerializeQueryArgs: SerializeQueryArgs<any>;
+type SerializeQueryArgs<QueryArgs, ReturnType = string> = (_: {
+    queryArgs: QueryArgs;
+    endpointDefinition: EndpointDefinition<any, any, any, any>;
+    endpointName: string;
+}) => ReturnType;
+type InternalSerializeQueryArgs = (_: {
+    queryArgs: any;
+    endpointDefinition: EndpointDefinition<any, any, any, any>;
+    endpointName: string;
+}) => QueryCacheKey;
+
+interface CreateApiOptions<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string = 'api', TagTypes extends string = never> {
+    /**
+     * The base query used by each endpoint if no `queryFn` option is specified. RTK Query exports a utility called [fetchBaseQuery](./fetchBaseQuery) as a lightweight wrapper around `fetch` for common use-cases. See [Customizing Queries](../../rtk-query/usage/customizing-queries) if `fetchBaseQuery` does not handle your requirements.
+     *
+     * @example
+     *
+     * ```ts
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
+     *
+     * const api = createApi({
+     *   // highlight-start
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   // highlight-end
+     *   endpoints: (build) => ({
+     *     // ...endpoints
+     *   }),
+     * })
+     * ```
+     */
+    baseQuery: BaseQuery;
+    /**
+     * An array of string tag type names. Specifying tag types is optional, but you should define them so that they can be used for caching and invalidation. When defining a tag type, you will be able to [provide](../../rtk-query/usage/automated-refetching#providing-tags) them with `providesTags` and [invalidate](../../rtk-query/usage/automated-refetching#invalidating-tags) them with `invalidatesTags` when configuring [endpoints](#endpoints).
+     *
+     * @example
+     *
+     * ```ts
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   // highlight-start
+     *   tagTypes: ['Post', 'User'],
+     *   // highlight-end
+     *   endpoints: (build) => ({
+     *     // ...endpoints
+     *   }),
+     * })
+     * ```
+     */
+    tagTypes?: readonly TagTypes[];
+    /**
+     * The `reducerPath` is a _unique_ key that your service will be mounted to in your store. If you call `createApi` more than once in your application, you will need to provide a unique value each time. Defaults to `'api'`.
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="apis.js"
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query';
+     *
+     * const apiOne = createApi({
+     *   // highlight-start
+     *   reducerPath: 'apiOne',
+     *   // highlight-end
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (builder) => ({
+     *     // ...endpoints
+     *   }),
+     * });
+     *
+     * const apiTwo = createApi({
+     *   // highlight-start
+     *   reducerPath: 'apiTwo',
+     *   // highlight-end
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (builder) => ({
+     *     // ...endpoints
+     *   }),
+     * });
+     * ```
+     */
+    reducerPath?: ReducerPath;
+    /**
+     * Accepts a custom function if you have a need to change the creation of cache keys for any reason.
+     */
+    serializeQueryArgs?: SerializeQueryArgs<unknown>;
+    /**
+     * Endpoints are a set of operations that you want to perform against your server. You define them as an object using the builder syntax. There are three endpoint types: [`query`](../../rtk-query/usage/queries), [`infiniteQuery`](../../rtk-query/usage/infinite-queries) and [`mutation`](../../rtk-query/usage/mutations).
+     */
+    endpoints(build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>): Definitions;
+    /**
+     * Defaults to `60` _(this value is in seconds)_. This is how long RTK Query will keep your data cached for **after** the last component unsubscribes. For example, if you query an endpoint, then unmount the component, then mount another component that makes the same request within the given time frame, the most recent value will be served from the cache.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="keepUnusedDataFor example"
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     * type PostsResponse = Post[]
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPosts: build.query<PostsResponse, void>({
+     *       query: () => 'posts'
+     *     })
+     *   }),
+     *   // highlight-start
+     *   keepUnusedDataFor: 5
+     *   // highlight-end
+     * })
+     * ```
+     */
+    keepUnusedDataFor?: number;
+    /**
+     * Defaults to `false`. This setting allows you to control whether if a cached result is already available RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.
+     * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.
+     * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.
+     * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.
+     *
+     * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.
+     */
+    refetchOnMountOrArgChange?: boolean | number;
+    /**
+     * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after the application window regains focus.
+     *
+     * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.
+     *
+     * Note: requires [`setupListeners`](./setupListeners) to have been called.
+     */
+    refetchOnFocus?: boolean;
+    /**
+     * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after regaining a network connection.
+     *
+     * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.
+     *
+     * Note: requires [`setupListeners`](./setupListeners) to have been called.
+     */
+    refetchOnReconnect?: boolean;
+    /**
+     * Defaults to `'delayed'`. This setting allows you to control when tags are invalidated after a mutation.
+     *
+     * - `'immediately'`: Queries are invalidated instantly after the mutation finished, even if they are running.
+     *   If the query provides tags that were invalidated while it ran, it won't be re-fetched.
+     * - `'delayed'`: Invalidation only happens after all queries and mutations are settled.
+     *   This ensures that queries are always invalidated correctly and automatically "batches" invalidations of concurrent mutations.
+     *   Note that if you constantly have some queries (or mutations) running, this can delay tag invalidations indefinitely.
+     */
+    invalidationBehavior?: 'delayed' | 'immediately';
+    /**
+     * A function that is passed every dispatched action. If this returns something other than `undefined`,
+     * that return value will be used to rehydrate fulfilled & errored queries.
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="next-redux-wrapper rehydration example"
+     * import type { Action, PayloadAction } from '@reduxjs/toolkit'
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * import { HYDRATE } from 'next-redux-wrapper'
+     *
+     * type RootState = any; // normally inferred from state
+     *
+     * function isHydrateAction(action: Action): action is PayloadAction<RootState> {
+     *   return action.type === HYDRATE
+     * }
+     *
+     * export const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   // highlight-start
+     *   extractRehydrationInfo(action, { reducerPath }): any {
+     *     if (isHydrateAction(action)) {
+     *       return action.payload[reducerPath]
+     *     }
+     *   },
+     *   // highlight-end
+     *   endpoints: (build) => ({
+     *     // omitted
+     *   }),
+     * })
+     * ```
+     */
+    extractRehydrationInfo?: (action: UnknownAction, { reducerPath, }: {
+        reducerPath: ReducerPath;
+    }) => undefined | CombinedState<NoInfer<Definitions>, NoInfer<TagTypes>, NoInfer<ReducerPath>>;
+    /**
+     * A function that is called when a schema validation fails.
+     *
+     * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).
+     *
+     * `NamedSchemaError` has the following properties:
+     * - `issues`: an array of issues that caused the validation to fail
+     * - `value`: the value that was passed to the schema
+     * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *     }),
+     *   }),
+     *   onSchemaFailure: (error, info) => {
+     *     console.error(error, info)
+     *   },
+     * })
+     * ```
+     */
+    onSchemaFailure?: SchemaFailureHandler;
+    /**
+     * Convert a schema validation failure into an error shape matching base query errors.
+     *
+     * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       responseSchema: v.object({ id: v.number(), name: v.string() }),
+     *     }),
+     *   }),
+     *   catchSchemaFailure: (error, info) => ({
+     *     status: "CUSTOM_ERROR",
+     *     error: error.schemaName + " failed validation",
+     *     data: error.issues,
+     *   }),
+     * })
+     * ```
+     */
+    catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;
+    /**
+     * Defaults to `false`.
+     *
+     * If set to `true`, will skip schema validation for all endpoints, unless overridden by the endpoint.
+     *
+     * Can be overridden for specific schemas by passing an array of schema types to skip.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   skipSchemaValidation: process.env.NODE_ENV === "test" ? ["response"] : false, // skip schema validation for response in tests, since we'll be mocking the response
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       responseSchema: v.object({ id: v.number(), name: v.string() }),
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    skipSchemaValidation?: boolean | SchemaType[];
+}
+type CreateApi<Modules extends ModuleName> = {
+    /**
+     * Creates a service to use in your application. Contains only the basic redux logic (the core module).
+     *
+     * @link https://redux-toolkit.js.org/rtk-query/api/createApi
+     */
+    <BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string = 'api', TagTypes extends string = never>(options: CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>): Api<BaseQuery, Definitions, ReducerPath, TagTypes, Modules>;
+};
+/**
+ * Builds a `createApi` method based on the provided `modules`.
+ *
+ * @link https://redux-toolkit.js.org/rtk-query/usage/customizing-create-api
+ *
+ * @example
+ * ```ts
+ * const MyContext = React.createContext<ReactReduxContextValue | null>(null);
+ * const customCreateApi = buildCreateApi(
+ *   coreModule(),
+ *   reactHooksModule({
+ *     hooks: {
+ *       useDispatch: createDispatchHook(MyContext),
+ *       useSelector: createSelectorHook(MyContext),
+ *       useStore: createStoreHook(MyContext)
+ *     }
+ *   })
+ * );
+ * ```
+ *
+ * @param modules - A variable number of modules that customize how the `createApi` method handles endpoints
+ * @returns A `createApi` method using the provided `modules`.
+ */
+declare function buildCreateApi<Modules extends [Module<any>, ...Module<any>[]]>(...modules: Modules): CreateApi<Modules[number]['name']>;
+
+type BuildThunksApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>> = Matchers<QueryThunk, Definition>;
+type BuildThunksApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = Matchers<InfiniteQueryThunk<any>, Definition>;
+type BuildThunksApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>> = Matchers<MutationThunk, Definition>;
+type EndpointThunk<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = Definition extends EndpointDefinition<infer QueryArg, infer BaseQueryFn, any, infer ResultType> ? Thunk extends AsyncThunk<unknown, infer ATArg, infer ATConfig> ? AsyncThunk<ResultType, ATArg & {
+    originalArgs: QueryArg;
+}, ATConfig & {
+    rejectValue: BaseQueryError<BaseQueryFn>;
+}> : never : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQueryFn, any, infer ResultType> ? Thunk extends AsyncThunk<unknown, infer ATArg, infer ATConfig> ? AsyncThunk<InfiniteData<ResultType, PageParam>, ATArg & {
+    originalArgs: QueryArg;
+}, ATConfig & {
+    rejectValue: BaseQueryError<BaseQueryFn>;
+}> : never : never;
+type PendingAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['pending']>;
+type FulfilledAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['fulfilled']>;
+type RejectedAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['rejected']>;
+type Matcher<M> = (value: any) => value is M;
+interface Matchers<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> {
+    matchPending: Matcher<PendingAction<Thunk, Definition>>;
+    matchFulfilled: Matcher<FulfilledAction<Thunk, Definition>>;
+    matchRejected: Matcher<RejectedAction<Thunk, Definition>>;
+}
+type QueryThunkArg = QuerySubstateIdentifier & StartQueryActionCreatorOptions & {
+    type: 'query';
+    originalArgs: unknown;
+    endpointName: string;
+};
+type InfiniteQueryThunkArg<D extends InfiniteQueryDefinition<any, any, any, any, any>> = QuerySubstateIdentifier & StartInfiniteQueryActionCreatorOptions<D> & {
+    type: `query`;
+    originalArgs: unknown;
+    endpointName: string;
+    param: unknown;
+    direction?: InfiniteQueryDirection;
+    refetchCachedPages?: boolean;
+};
+type MutationThunkArg = {
+    type: 'mutation';
+    originalArgs: unknown;
+    endpointName: string;
+    track?: boolean;
+    fixedCacheKey?: string;
+};
+type ThunkResult = unknown;
+type ThunkApiMetaConfig = {
+    pendingMeta: {
+        startedTimeStamp: number;
+        [SHOULD_AUTOBATCH]: true;
+    };
+    fulfilledMeta: {
+        fulfilledTimeStamp: number;
+        baseQueryMeta: unknown;
+        [SHOULD_AUTOBATCH]: true;
+    };
+    rejectedMeta: {
+        baseQueryMeta: unknown;
+        [SHOULD_AUTOBATCH]: true;
+    };
+};
+type QueryThunk = AsyncThunk<ThunkResult, QueryThunkArg, ThunkApiMetaConfig>;
+type InfiniteQueryThunk<D extends InfiniteQueryDefinition<any, any, any, any, any>> = AsyncThunk<ThunkResult, InfiniteQueryThunkArg<D>, ThunkApiMetaConfig>;
+type MutationThunk = AsyncThunk<ThunkResult, MutationThunkArg, ThunkApiMetaConfig>;
+type MaybeDrafted<T> = T | Draft<T>;
+type Recipe<T> = (data: MaybeDrafted<T>) => void | MaybeDrafted<T>;
+type PatchQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFrom<Definitions[EndpointName]>, patches: readonly Patch[], updateProvided?: boolean) => ThunkAction<void, PartialState, any, UnknownAction>;
+type AllQueryKeys<Definitions extends EndpointDefinitions> = QueryKeys<Definitions> | InfiniteQueryKeys<Definitions>;
+type QueryArgFromAnyQueryDefinition<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryArgFrom<Definitions[EndpointName]> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? QueryArgFrom<Definitions[EndpointName]> : never;
+type DataFromAnyQueryDefinition<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteData<ResultTypeFrom<Definitions[EndpointName]>, PageParamFrom<Definitions[EndpointName]>> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? ResultTypeFrom<Definitions[EndpointName]> : unknown;
+type UpsertThunkResult<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryActionCreatorResult<Definitions[EndpointName]> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? QueryActionCreatorResult<Definitions[EndpointName]> : QueryActionCreatorResult<never>;
+type UpdateQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>, updateRecipe: Recipe<DataFromAnyQueryDefinition<Definitions, EndpointName>>, updateProvided?: boolean) => ThunkAction<PatchCollection, PartialState, any, UnknownAction>;
+type UpsertQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>, value: DataFromAnyQueryDefinition<Definitions, EndpointName>) => ThunkAction<UpsertThunkResult<Definitions, EndpointName>, PartialState, any, UnknownAction>;
+/**
+ * An object returned from dispatching a `api.util.updateQueryData` call.
+ */
+type PatchCollection = {
+    /**
+     * An `immer` Patch describing the cache update.
+     */
+    patches: Patch[];
+    /**
+     * An `immer` Patch to revert the cache update.
+     */
+    inversePatches: Patch[];
+    /**
+     * A function that will undo the cache update.
+     */
+    undo: () => void;
+};
+
+type SkipToken = typeof skipToken;
+/**
+ * Can be passed into `useQuery`, `useQueryState` or `useQuerySubscription`
+ * instead of the query argument to get the same effect as if setting
+ * `skip: true` in the query options.
+ *
+ * Useful for scenarios where a query should be skipped when `arg` is `undefined`
+ * and TypeScript complains about it because `arg` is not allowed to be passed
+ * in as `undefined`, such as
+ *
+ * ```ts
+ * // codeblock-meta title="will error if the query argument is not allowed to be undefined" no-transpile
+ * useSomeQuery(arg, { skip: !!arg })
+ * ```
+ *
+ * ```ts
+ * // codeblock-meta title="using skipToken instead" no-transpile
+ * useSomeQuery(arg ?? skipToken)
+ * ```
+ *
+ * If passed directly into a query or mutation selector, that selector will always
+ * return an uninitialized state.
+ */
+export declare const skipToken: unique symbol;
+type BuildSelectorsApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {
+    select: QueryResultSelectorFactory<Definition, RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;
+};
+type BuildSelectorsApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {
+    select: InfiniteQueryResultSelectorFactory<Definition, RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;
+};
+type BuildSelectorsApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {
+    select: MutationResultSelectorFactory<Definition, RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;
+};
+type QueryResultSelectorFactory<Definition extends QueryDefinition<any, any, any, any>, RootState> = (queryArg: QueryArgFrom<Definition> | SkipToken) => (state: RootState) => QueryResultSelectorResult<Definition>;
+type QueryResultSelectorResult<Definition extends QueryDefinition<any, any, any, any>> = QuerySubState<Definition> & RequestStatusFlags;
+type InfiniteQueryResultSelectorFactory<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, RootState> = (queryArg: InfiniteQueryArgFrom<Definition> | SkipToken) => (state: RootState) => InfiniteQueryResultSelectorResult<Definition>;
+type InfiniteQueryResultFlags = {
+    hasNextPage: boolean;
+    hasPreviousPage: boolean;
+    isFetchingNextPage: boolean;
+    isFetchingPreviousPage: boolean;
+    isFetchNextPageError: boolean;
+    isFetchPreviousPageError: boolean;
+};
+type InfiniteQueryResultSelectorResult<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = InfiniteQuerySubState<Definition> & RequestStatusFlags & InfiniteQueryResultFlags;
+type MutationResultSelectorFactory<Definition extends MutationDefinition<any, any, any, any>, RootState> = (requestId: string | {
+    requestId: string | undefined;
+    fixedCacheKey: string | undefined;
+} | SkipToken) => (state: RootState) => MutationResultSelectorResult<Definition>;
+type MutationResultSelectorResult<Definition extends MutationDefinition<any, any, any, any>> = MutationSubState<Definition> & RequestStatusFlags;
+
+type BuildInitiateApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>> = {
+    initiate: StartQueryActionCreator<Definition>;
+};
+type BuildInitiateApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = {
+    initiate: StartInfiniteQueryActionCreator<Definition>;
+};
+type BuildInitiateApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>> = {
+    initiate: StartMutationActionCreator<Definition>;
+};
+declare const forceQueryFnSymbol: unique symbol;
+type StartQueryActionCreatorOptions = {
+    subscribe?: boolean;
+    forceRefetch?: boolean | number;
+    subscriptionOptions?: SubscriptionOptions;
+    [forceQueryFnSymbol]?: () => QueryReturnValue;
+};
+type StartInfiniteQueryActionCreatorOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>> = StartQueryActionCreatorOptions & {
+    direction?: InfiniteQueryDirection;
+    param?: unknown;
+} & Partial<Pick<Partial<InfiniteQueryConfigOptions<ResultTypeFrom<D>, PageParamFrom<D>, InfiniteQueryArgFrom<D>>>, 'initialPageParam' | 'refetchCachedPages'>>;
+type StartQueryActionCreator<D extends QueryDefinition<any, any, any, any, any>> = (arg: QueryArgFrom<D>, options?: StartQueryActionCreatorOptions) => ThunkAction<QueryActionCreatorResult<D>, any, any, UnknownAction>;
+type StartInfiniteQueryActionCreator<D extends InfiniteQueryDefinition<any, any, any, any, any>> = (arg: InfiniteQueryArgFrom<D>, options?: StartInfiniteQueryActionCreatorOptions<D>) => ThunkAction<InfiniteQueryActionCreatorResult<D>, any, any, UnknownAction>;
+type QueryActionCreatorFields = {
+    requestId: string;
+    subscriptionOptions: SubscriptionOptions | undefined;
+    abort(): void;
+    unsubscribe(): void;
+    updateSubscriptionOptions(options: SubscriptionOptions): void;
+    queryCacheKey: string;
+};
+type QueryActionCreatorResult<D extends QueryDefinition<any, any, any, any>> = SafePromise<QueryResultSelectorResult<D>> & QueryActionCreatorFields & {
+    arg: QueryArgFrom<D>;
+    unwrap(): Promise<ResultTypeFrom<D>>;
+    refetch(): QueryActionCreatorResult<D>;
+};
+type InfiniteQueryActionCreatorResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = SafePromise<InfiniteQueryResultSelectorResult<D>> & QueryActionCreatorFields & {
+    arg: InfiniteQueryArgFrom<D>;
+    unwrap(): Promise<InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>>;
+    refetch(options?: Pick<StartInfiniteQueryActionCreatorOptions<D>, 'refetchCachedPages'>): InfiniteQueryActionCreatorResult<D>;
+};
+type StartMutationActionCreator<D extends MutationDefinition<any, any, any, any>> = (arg: QueryArgFrom<D>, options?: {
+    /**
+     * If this mutation should be tracked in the store.
+     * If you just want to manually trigger this mutation using `dispatch` and don't care about the
+     * result, state & potential errors being held in store, you can set this to false.
+     * (defaults to `true`)
+     */
+    track?: boolean;
+    fixedCacheKey?: string;
+}) => ThunkAction<MutationActionCreatorResult<D>, any, any, UnknownAction>;
+type MutationActionCreatorResult<D extends MutationDefinition<any, any, any, any>> = SafePromise<{
+    data: ResultTypeFrom<D>;
+    error?: undefined;
+} | {
+    data?: undefined;
+    error: Exclude<BaseQueryError<D extends MutationDefinition<any, infer BaseQuery, any, any> ? BaseQuery : never>, undefined> | SerializedError;
+}> & {
+    /** @internal */
+    arg: {
+        /**
+         * The name of the given endpoint for the mutation
+         */
+        endpointName: string;
+        /**
+         * The original arguments supplied to the mutation call
+         */
+        originalArgs: QueryArgFrom<D>;
+        /**
+         * Whether the mutation is being tracked in the store.
+         */
+        track?: boolean;
+        fixedCacheKey?: string;
+    };
+    /**
+     * A unique string generated for the request sequence
+     */
+    requestId: string;
+    /**
+     * A method to cancel the mutation promise. Note that this is not intended to prevent the mutation
+     * that was fired off from reaching the server, but only to assist in handling the response.
+     *
+     * Calling `abort()` prior to the promise resolving will force it to reach the error state with
+     * the serialized error:
+     * `{ name: 'AbortError', message: 'Aborted' }`
+     *
+     * @example
+     * ```ts
+     * const [updateUser] = useUpdateUserMutation();
+     *
+     * useEffect(() => {
+     *   const promise = updateUser(id);
+     *   promise
+     *     .unwrap()
+     *     .catch((err) => {
+     *       if (err.name === 'AbortError') return;
+     *       // else handle the unexpected error
+     *     })
+     *
+     *   return () => {
+     *     promise.abort();
+     *   }
+     * }, [id, updateUser])
+     * ```
+     */
+    abort(): void;
+    /**
+     * Unwraps a mutation call to provide the raw response/error.
+     *
+     * @remarks
+     * If you need to access the error or success payload immediately after a mutation, you can chain .unwrap().
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Using .unwrap"
+     * addPost({ id: 1, name: 'Example' })
+     *   .unwrap()
+     *   .then((payload) => console.log('fulfilled', payload))
+     *   .catch((error) => console.error('rejected', error));
+     * ```
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Using .unwrap with async await"
+     * try {
+     *   const payload = await addPost({ id: 1, name: 'Example' }).unwrap();
+     *   console.log('fulfilled', payload)
+     * } catch (error) {
+     *   console.error('rejected', error);
+     * }
+     * ```
+     */
+    unwrap(): Promise<ResultTypeFrom<D>>;
+    /**
+     * A method to manually unsubscribe from the mutation call, meaning it will be removed from cache after the usual caching grace period.
+     The value returned by the hook will reset to `isUninitialized` afterwards.
+     */
+    reset(): void;
+};
+
+type ReferenceCacheLifecycle = never;
+interface QueryBaseLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends LifecycleApi<ReducerPath> {
+    /**
+     * Gets the current value of this cache entry.
+     */
+    getCacheEntry(): QueryResultSelectorResult<{
+        type: DefinitionType.query;
+    } & BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, BaseQueryResult<BaseQuery>>>;
+    /**
+     * Updates the current cache entry value.
+     * For documentation see `api.util.updateQueryData`.
+     */
+    updateCachedData(updateRecipe: Recipe<ResultType>): PatchCollection;
+}
+type MutationBaseLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = LifecycleApi<ReducerPath> & {
+    /**
+     * Gets the current value of this cache entry.
+     */
+    getCacheEntry(): MutationResultSelectorResult<{
+        type: DefinitionType.mutation;
+    } & BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, BaseQueryResult<BaseQuery>>>;
+};
+type LifecycleApi<ReducerPath extends string = string> = {
+    /**
+     * The dispatch method for the store
+     */
+    dispatch: ThunkDispatch<any, any, UnknownAction>;
+    /**
+     * A method to get the current state
+     */
+    getState(): RootState<any, any, ReducerPath>;
+    /**
+     * `extra` as provided as `thunk.extraArgument` to the `configureStore` `getDefaultMiddleware` option.
+     */
+    extra: unknown;
+    /**
+     * A unique ID generated for the mutation
+     */
+    requestId: string;
+};
+type CacheLifecyclePromises<ResultType = unknown, MetaType = unknown> = {
+    /**
+     * Promise that will resolve with the first value for this cache key.
+     * This allows you to `await` until an actual value is in cache.
+     *
+     * If the cache entry is removed from the cache before any value has ever
+     * been resolved, this Promise will reject with
+     * `new Error('Promise never resolved before cacheEntryRemoved.')`
+     * to prevent memory leaks.
+     * You can just re-throw that error (or not handle it at all) -
+     * it will be caught outside of `cacheEntryAdded`.
+     *
+     * If you don't interact with this promise, it will not throw.
+     */
+    cacheDataLoaded: PromiseWithKnownReason<{
+        /**
+         * The (transformed) query result.
+         */
+        data: ResultType;
+        /**
+         * The `meta` returned by the `baseQuery`
+         */
+        meta: MetaType;
+    }, typeof neverResolvedError>;
+    /**
+     * Promise that allows you to wait for the point in time when the cache entry
+     * has been removed from the cache, by not being used/subscribed to any more
+     * in the application for too long or by dispatching `api.util.resetApiState`.
+     */
+    cacheEntryRemoved: Promise<void>;
+};
+interface QueryCacheLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>, CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>> {
+}
+type MutationCacheLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> & CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>>;
+type CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {
+    onCacheEntryAdded?(arg: QueryArg, api: QueryCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;
+};
+type CacheLifecycleInfiniteQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>;
+type CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {
+    onCacheEntryAdded?(arg: QueryArg, api: MutationCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;
+};
+declare const neverResolvedError: Error & {
+    message: "Promise never resolved before cacheEntryRemoved.";
+};
+
+type ReferenceQueryLifecycle = never;
+type QueryLifecyclePromises<ResultType, BaseQuery extends BaseQueryFn> = {
+    /**
+     * Promise that will resolve with the (transformed) query result.
+     *
+     * If the query fails, this promise will reject with the error.
+     *
+     * This allows you to `await` for the query to finish.
+     *
+     * If you don't interact with this promise, it will not throw.
+     */
+    queryFulfilled: PromiseWithKnownReason<{
+        /**
+         * The (transformed) query result.
+         */
+        data: ResultType;
+        /**
+         * The `meta` returned by the `baseQuery`
+         */
+        meta: BaseQueryMeta<BaseQuery>;
+    }, QueryFulfilledRejectionReason<BaseQuery>>;
+};
+type QueryFulfilledRejectionReason<BaseQuery extends BaseQueryFn> = {
+    error: BaseQueryError<BaseQuery>;
+    /**
+     * If this is `false`, that means this error was returned from the `baseQuery` or `queryFn` in a controlled manner.
+     */
+    isUnhandledError: false;
+    /**
+     * The `meta` returned by the `baseQuery`
+     */
+    meta: BaseQueryMeta<BaseQuery>;
+} | {
+    error: unknown;
+    meta?: undefined;
+    /**
+     * If this is `true`, that means that this error is the result of `baseQueryFn`, `queryFn`, `transformResponse` or `transformErrorResponse` throwing an error instead of handling it properly.
+     * There can not be made any assumption about the shape of `error`.
+     */
+    isUnhandledError: true;
+};
+type QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {
+    /**
+     * A function that is called when the individual query is started. The function is called with a lifecycle api object containing properties such as `queryFulfilled`, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. throughout the lifecycle of an individual query/mutation call).
+     *
+     * Can be used to perform side-effects throughout the lifecycle of the query.
+     *
+     * @example
+     * ```ts
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
+     * import { messageCreated } from './notificationsSlice
+     * export interface Post {
+     *   id: number
+     *   name: string
+     * }
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({
+     *     baseUrl: '/',
+     *   }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, number>({
+     *       query: (id) => `post/${id}`,
+     *       async onQueryStarted(id, { dispatch, queryFulfilled }) {
+     *         // `onStart` side-effect
+     *         dispatch(messageCreated('Fetching posts...'))
+     *         try {
+     *           const { data } = await queryFulfilled
+     *           // `onSuccess` side-effect
+     *           dispatch(messageCreated('Posts received!'))
+     *         } catch (err) {
+     *           // `onError` side-effect
+     *           dispatch(messageCreated('Error fetching posts!'))
+     *         }
+     *       }
+     *     }),
+     *   }),
+     * })
+     * ```
+     */
+    onQueryStarted?(queryArgument: QueryArg, queryLifeCycleApi: QueryLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;
+};
+type QueryLifecycleInfiniteQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>;
+type QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {
+    /**
+     * A function that is called when the individual mutation is started. The function is called with a lifecycle api object containing properties such as `queryFulfilled`, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. throughout the lifecycle of an individual query/mutation call).
+     *
+     * Can be used for `optimistic updates`.
+     *
+     * @example
+     *
+     * ```ts
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
+     * export interface Post {
+     *   id: number
+     *   name: string
+     * }
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({
+     *     baseUrl: '/',
+     *   }),
+     *   tagTypes: ['Post'],
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, number>({
+     *       query: (id) => `post/${id}`,
+     *       providesTags: ['Post'],
+     *     }),
+     *     updatePost: build.mutation<void, Pick<Post, 'id'> & Partial<Post>>({
+     *       query: ({ id, ...patch }) => ({
+     *         url: `post/${id}`,
+     *         method: 'PATCH',
+     *         body: patch,
+     *       }),
+     *       invalidatesTags: ['Post'],
+     *       async onQueryStarted({ id, ...patch }, { dispatch, queryFulfilled }) {
+     *         const patchResult = dispatch(
+     *           api.util.updateQueryData('getPost', id, (draft) => {
+     *             Object.assign(draft, patch)
+     *           })
+     *         )
+     *         try {
+     *           await queryFulfilled
+     *         } catch {
+     *           patchResult.undo()
+     *         }
+     *       },
+     *     }),
+     *   }),
+     * })
+     * ```
+     */
+    onQueryStarted?(queryArgument: QueryArg, mutationLifeCycleApi: MutationLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;
+};
+interface QueryLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>, QueryLifecyclePromises<ResultType, BaseQuery> {
+}
+type MutationLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> & QueryLifecyclePromises<ResultType, BaseQuery>;
+/**
+ * Provides a way to define a strongly-typed version of
+ * {@linkcode QueryLifecycleQueryExtraOptions.onQueryStarted | onQueryStarted}
+ * for a specific query.
+ *
+ * @example
+ * <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>
+ *
+ * ```ts
+ * import type { TypedQueryOnQueryStarted } from '@reduxjs/toolkit/query'
+ * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
+ *
+ * type Post = {
+ *   id: number
+ *   title: string
+ *   userId: number
+ * }
+ *
+ * type PostsApiResponse = {
+ *   posts: Post[]
+ *   total: number
+ *   skip: number
+ *   limit: number
+ * }
+ *
+ * type QueryArgument = number | undefined
+ *
+ * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>
+ *
+ * const baseApiSlice = createApi({
+ *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com' }),
+ *   reducerPath: 'postsApi',
+ *   tagTypes: ['Posts'],
+ *   endpoints: (build) => ({
+ *     getPosts: build.query<PostsApiResponse, void>({
+ *       query: () => `/posts`,
+ *     }),
+ *
+ *     getPostById: build.query<Post, QueryArgument>({
+ *       query: (postId) => `/posts/${postId}`,
+ *     }),
+ *   }),
+ * })
+ *
+ * const updatePostOnFulfilled: TypedQueryOnQueryStarted<
+ *   PostsApiResponse,
+ *   QueryArgument,
+ *   BaseQueryFunction,
+ *   'postsApi'
+ * > = async (queryArgument, { dispatch, queryFulfilled }) => {
+ *   const result = await queryFulfilled
+ *
+ *   const { posts } = result.data
+ *
+ *   // Pre-fill the individual post entries with the results
+ *   // from the list endpoint query
+ *   dispatch(
+ *     baseApiSlice.util.upsertQueryEntries(
+ *       posts.map((post) => ({
+ *         endpointName: 'getPostById',
+ *         arg: post.id,
+ *         value: post,
+ *       })),
+ *     ),
+ *   )
+ * }
+ *
+ * export const extendedApiSlice = baseApiSlice.injectEndpoints({
+ *   endpoints: (build) => ({
+ *     getPostsByUserId: build.query<PostsApiResponse, QueryArgument>({
+ *       query: (userId) => `/posts/user/${userId}`,
+ *
+ *       onQueryStarted: updatePostOnFulfilled,
+ *     }),
+ *   }),
+ * })
+ * ```
+ *
+ * @template ResultType - The type of the result `data` returned by the query.
+ * @template QueryArgumentType - The type of the argument passed into the query.
+ * @template BaseQueryFunctionType - The type of the base query function being used.
+ * @template ReducerPath - The type representing the `reducerPath` for the API slice.
+ *
+ * @since 2.4.0
+ * @public
+ */
+type TypedQueryOnQueryStarted<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleQueryExtraOptions<ResultType, QueryArgumentType, BaseQueryFunctionType, ReducerPath>['onQueryStarted'];
+/**
+ * Provides a way to define a strongly-typed version of
+ * {@linkcode QueryLifecycleMutationExtraOptions.onQueryStarted | onQueryStarted}
+ * for a specific mutation.
+ *
+ * @example
+ * <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>
+ *
+ * ```ts
+ * import type { TypedMutationOnQueryStarted } from '@reduxjs/toolkit/query'
+ * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
+ *
+ * type Post = {
+ *   id: number
+ *   title: string
+ *   userId: number
+ * }
+ *
+ * type PostsApiResponse = {
+ *   posts: Post[]
+ *   total: number
+ *   skip: number
+ *   limit: number
+ * }
+ *
+ * type QueryArgument = Pick<Post, 'id'> & Partial<Post>
+ *
+ * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>
+ *
+ * const baseApiSlice = createApi({
+ *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com' }),
+ *   reducerPath: 'postsApi',
+ *   tagTypes: ['Posts'],
+ *   endpoints: (build) => ({
+ *     getPosts: build.query<PostsApiResponse, void>({
+ *       query: () => `/posts`,
+ *     }),
+ *
+ *     getPostById: build.query<Post, number>({
+ *       query: (postId) => `/posts/${postId}`,
+ *     }),
+ *   }),
+ * })
+ *
+ * const updatePostOnFulfilled: TypedMutationOnQueryStarted<
+ *   Post,
+ *   QueryArgument,
+ *   BaseQueryFunction,
+ *   'postsApi'
+ * > = async ({ id, ...patch }, { dispatch, queryFulfilled }) => {
+ *   const patchCollection = dispatch(
+ *     baseApiSlice.util.updateQueryData('getPostById', id, (draftPost) => {
+ *       Object.assign(draftPost, patch)
+ *     }),
+ *   )
+ *
+ *   try {
+ *     await queryFulfilled
+ *   } catch {
+ *     patchCollection.undo()
+ *   }
+ * }
+ *
+ * export const extendedApiSlice = baseApiSlice.injectEndpoints({
+ *   endpoints: (build) => ({
+ *     addPost: build.mutation<Post, Omit<QueryArgument, 'id'>>({
+ *       query: (body) => ({
+ *         url: `posts/add`,
+ *         method: 'POST',
+ *         body,
+ *       }),
+ *
+ *       onQueryStarted: updatePostOnFulfilled,
+ *     }),
+ *
+ *     updatePost: build.mutation<Post, QueryArgument>({
+ *       query: ({ id, ...patch }) => ({
+ *         url: `post/${id}`,
+ *         method: 'PATCH',
+ *         body: patch,
+ *       }),
+ *
+ *       onQueryStarted: updatePostOnFulfilled,
+ *     }),
+ *   }),
+ * })
+ * ```
+ *
+ * @template ResultType - The type of the result `data` returned by the query.
+ * @template QueryArgumentType - The type of the argument passed into the query.
+ * @template BaseQueryFunctionType - The type of the base query function being used.
+ * @template ReducerPath - The type representing the `reducerPath` for the API slice.
+ *
+ * @since 2.4.0
+ * @public
+ */
+type TypedMutationOnQueryStarted<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleMutationExtraOptions<ResultType, QueryArgumentType, BaseQueryFunctionType, ReducerPath>['onQueryStarted'];
+
+/**
+ * A typesafe single entry to be upserted into the cache
+ */
+type NormalizedQueryUpsertEntry<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = {
+    endpointName: EndpointName;
+    arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>;
+    value: DataFromAnyQueryDefinition<Definitions, EndpointName>;
+};
+/**
+ * The internal version that is not typesafe since we can't carry the generics through `createSlice`
+ */
+type NormalizedQueryUpsertEntryPayload = {
+    endpointName: string;
+    arg: unknown;
+    value: unknown;
+};
+type ProcessedQueryUpsertEntry = {
+    queryDescription: QueryThunkArg;
+    value: unknown;
+};
+/**
+ * A typesafe representation of a util action creator that accepts cache entry descriptions to upsert
+ */
+type UpsertEntries<Definitions extends EndpointDefinitions> = (<EndpointNames extends Array<AllQueryKeys<Definitions>>>(entries: [
+    ...{
+        [I in keyof EndpointNames]: NormalizedQueryUpsertEntry<Definitions, EndpointNames[I]>;
+    }
+]) => PayloadAction<NormalizedQueryUpsertEntryPayload[]>) & {
+    match: (action: unknown) => action is PayloadAction<NormalizedQueryUpsertEntryPayload[]>;
+};
+declare function buildSlice({ reducerPath, queryThunk, mutationThunk, serializeQueryArgs, context: { endpointDefinitions: definitions, apiUid, extractRehydrationInfo, hasRehydrationInfo, }, assertTagType, config, }: {
+    reducerPath: string;
+    queryThunk: QueryThunk;
+    infiniteQueryThunk: InfiniteQueryThunk<any>;
+    mutationThunk: MutationThunk;
+    serializeQueryArgs: InternalSerializeQueryArgs;
+    context: ApiContext<EndpointDefinitions>;
+    assertTagType: AssertTagTypes;
+    config: Omit<ConfigState<string>, 'online' | 'focused' | 'middlewareRegistered'>;
+}): {
+    reducer: redux.Reducer<{
+        queries: QueryState<any>;
+        mutations: MutationState<any>;
+        provided: InvalidationState<string>;
+        subscriptions: SubscriptionState;
+        config: ConfigState<string>;
+    }, redux.UnknownAction, Partial<{
+        queries: QueryState<any> | undefined;
+        mutations: MutationState<any> | undefined;
+        provided: InvalidationState<string> | undefined;
+        subscriptions: SubscriptionState | undefined;
+        config: ConfigState<string> | undefined;
+    }>>;
+    actions: {
+        resetApiState: _reduxjs_toolkit.ActionCreatorWithoutPayload<`${string}/resetApiState`>;
+        updateProvidedBy: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[payload: {
+            queryCacheKey: QueryCacheKey;
+            providedTags: readonly FullTagDescription<string>[];
+        }[]], {
+            queryCacheKey: QueryCacheKey;
+            providedTags: readonly FullTagDescription<string>[];
+        }[], `${string}/invalidation/updateProvidedBy`, never, unknown>;
+        removeMutationResult: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[payload: MutationSubstateIdentifier], MutationSubstateIdentifier, `${string}/mutations/removeMutationResult`, never, unknown>;
+        subscriptionsUpdated: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[payload: Patch[]], Patch[], `${string}/internalSubscriptions/subscriptionsUpdated`, never, unknown>;
+        updateSubscriptionOptions: _reduxjs_toolkit.ActionCreatorWithPayload<{
+            endpointName: string;
+            requestId: string;
+            options: Subscribers[number];
+        } & QuerySubstateIdentifier, `${string}/subscriptions/updateSubscriptionOptions`>;
+        unsubscribeQueryResult: _reduxjs_toolkit.ActionCreatorWithPayload<{
+            requestId: string;
+        } & QuerySubstateIdentifier, `${string}/subscriptions/unsubscribeQueryResult`>;
+        internal_getRTKQSubscriptions: _reduxjs_toolkit.ActionCreatorWithoutPayload<`${string}/subscriptions/internal_getRTKQSubscriptions`>;
+        removeQueryResult: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[payload: QuerySubstateIdentifier], QuerySubstateIdentifier, `${string}/queries/removeQueryResult`, never, unknown>;
+        cacheEntriesUpserted: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[payload: NormalizedQueryUpsertEntryPayload[]], ProcessedQueryUpsertEntry[], `${string}/queries/cacheEntriesUpserted`, never, {
+            RTK_autoBatch: boolean;
+            requestId: string;
+            timestamp: number;
+        }>;
+        queryResultPatched: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[payload: QuerySubstateIdentifier & {
+            patches: readonly Patch[];
+        }], QuerySubstateIdentifier & {
+            patches: readonly Patch[];
+        }, `${string}/queries/queryResultPatched`, never, unknown>;
+        middlewareRegistered: _reduxjs_toolkit.ActionCreatorWithPayload<string, `${string}/config/middlewareRegistered`>;
+    };
+};
+type SliceActions = ReturnType<typeof buildSlice>['actions'];
+
+declare const onFocus: ActionCreatorWithoutPayload<"__rtkq/focused">;
+declare const onFocusLost: ActionCreatorWithoutPayload<"__rtkq/unfocused">;
+declare const onOnline: ActionCreatorWithoutPayload<"__rtkq/online">;
+declare const onOffline: ActionCreatorWithoutPayload<"__rtkq/offline">;
+/**
+ * A utility used to enable `refetchOnMount` and `refetchOnReconnect` behaviors.
+ * It requires the dispatch method from your store.
+ * Calling `setupListeners(store.dispatch)` will configure listeners with the recommended defaults,
+ * but you have the option of providing a callback for more granular control.
+ *
+ * @example
+ * ```ts
+ * setupListeners(store.dispatch)
+ * ```
+ *
+ * @param dispatch - The dispatch method from your store
+ * @param customHandler - An optional callback for more granular control over listener behavior
+ * @returns Return value of the handler.
+ * The default handler returns an `unsubscribe` method that can be called to remove the listeners.
+ */
+declare function setupListeners(dispatch: ThunkDispatch<any, any, any>, customHandler?: (dispatch: ThunkDispatch<any, any, any>, actions: {
+    onFocus: typeof onFocus;
+    onFocusLost: typeof onFocusLost;
+    onOnline: typeof onOnline;
+    onOffline: typeof onOffline;
+}) => () => void): () => void;
+
+/**
+ * Note: this file should import all other files for type discovery and declaration merging
+ */
+
+/**
+ * `ifOlderThan` - (default: `false` | `number`) - _number is value in seconds_
+ * - If specified, it will only run the query if the difference between `new Date()` and the last `fulfilledTimeStamp` is greater than the given value
+ *
+ * @overloadSummary
+ * `force`
+ * - If `force: true`, it will ignore the `ifOlderThan` value if it is set and the query will be run even if it exists in the cache.
+ */
+type PrefetchOptions = {
+    ifOlderThan?: false | number;
+} | {
+    force?: boolean;
+};
+export declare const coreModuleName: unique symbol;
+type CoreModule = typeof coreModuleName | ReferenceCacheLifecycle | ReferenceQueryLifecycle | ReferenceCacheCollection;
+type ThunkWithReturnValue<T> = ThunkAction<T, any, any, UnknownAction>;
+interface ApiModules<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string> {
+    [coreModuleName]: {
+        /**
+         * This api's reducer should be mounted at `store[api.reducerPath]`.
+         *
+         * @example
+         * ```ts
+         * configureStore({
+         *   reducer: {
+         *     [api.reducerPath]: api.reducer,
+         *   },
+         *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),
+         * })
+         * ```
+         */
+        reducerPath: ReducerPath;
+        /**
+         * Internal actions not part of the public API. Note: These are subject to change at any given time.
+         */
+        internalActions: InternalActions;
+        /**
+         *  A standard redux reducer that enables core functionality. Make sure it's included in your store.
+         *
+         * @example
+         * ```ts
+         * configureStore({
+         *   reducer: {
+         *     [api.reducerPath]: api.reducer,
+         *   },
+         *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),
+         * })
+         * ```
+         */
+        reducer: Reducer<CombinedState<Definitions, TagTypes, ReducerPath>, UnknownAction>;
+        /**
+         * This is a standard redux middleware and is responsible for things like polling, garbage collection and a handful of other things. Make sure it's included in your store.
+         *
+         * @example
+         * ```ts
+         * configureStore({
+         *   reducer: {
+         *     [api.reducerPath]: api.reducer,
+         *   },
+         *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),
+         * })
+         * ```
+         */
+        middleware: Middleware<{}, RootState<Definitions, string, ReducerPath>, ThunkDispatch<any, any, UnknownAction>>;
+        /**
+         * A collection of utility thunks for various situations.
+         */
+        util: {
+            /**
+             * A thunk that (if dispatched) will return a specific running query, identified
+             * by `endpointName` and `arg`.
+             * If that query is not running, dispatching the thunk will result in `undefined`.
+             *
+             * Can be used to await a specific query triggered in any way,
+             * including via hook calls or manually dispatching `initiate` actions.
+             *
+             * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.
+             */
+            getRunningQueryThunk<EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>): ThunkWithReturnValue<QueryActionCreatorResult<Definitions[EndpointName] & {
+                type: 'query';
+            }> | InfiniteQueryActionCreatorResult<Definitions[EndpointName] & {
+                type: 'infinitequery';
+            }> | undefined>;
+            /**
+             * A thunk that (if dispatched) will return a specific running mutation, identified
+             * by `endpointName` and `fixedCacheKey` or `requestId`.
+             * If that mutation is not running, dispatching the thunk will result in `undefined`.
+             *
+             * Can be used to await a specific mutation triggered in any way,
+             * including via hook trigger functions or manually dispatching `initiate` actions.
+             *
+             * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.
+             */
+            getRunningMutationThunk<EndpointName extends MutationKeys<Definitions>>(endpointName: EndpointName, fixedCacheKeyOrRequestId: string): ThunkWithReturnValue<MutationActionCreatorResult<Definitions[EndpointName] & {
+                type: 'mutation';
+            }> | undefined>;
+            /**
+             * A thunk that (if dispatched) will return all running queries.
+             *
+             * Useful for SSR scenarios to await all running queries triggered in any way,
+             * including via hook calls or manually dispatching `initiate` actions.
+             *
+             * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.
+             */
+            getRunningQueriesThunk(): ThunkWithReturnValue<Array<QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>>;
+            /**
+             * A thunk that (if dispatched) will return all running mutations.
+             *
+             * Useful for SSR scenarios to await all running mutations triggered in any way,
+             * including via hook calls or manually dispatching `initiate` actions.
+             *
+             * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.
+             */
+            getRunningMutationsThunk(): ThunkWithReturnValue<Array<MutationActionCreatorResult<any>>>;
+            /**
+             * A Redux thunk that can be used to manually trigger pre-fetching of data.
+             *
+             * The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a set of options used to determine if the data actually should be re-fetched based on cache staleness.
+             *
+             * React Hooks users will most likely never need to use this directly, as the `usePrefetch` hook will dispatch this thunk internally as needed when you call the prefetching function supplied by the hook.
+             *
+             * @example
+             *
+             * ```ts no-transpile
+             * dispatch(api.util.prefetch('getPosts', undefined, { force: true }))
+             * ```
+             */
+            prefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions): ThunkAction<void, any, any, UnknownAction>;
+            /**
+             * A Redux thunk action creator that, when dispatched, creates and applies a set of JSON diff/patch objects to the current state. This immediately updates the Redux state with those changes.
+             *
+             * The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and an `updateRecipe` callback function. The callback receives an Immer-wrapped `draft` of the current state, and may modify the draft to match the expected results after the mutation completes successfully.
+             *
+             * The thunk executes _synchronously_, and returns an object containing `{patches: Patch[], inversePatches: Patch[], undo: () => void}`. The `patches` and `inversePatches` are generated using Immer's [`produceWithPatches` method](https://immerjs.github.io/immer/patches).
+             *
+             * This is typically used as the first step in implementing optimistic updates. The generated `inversePatches` can be used to revert the updates by calling `dispatch(patchQueryData(endpointName, arg, inversePatches))`. Alternatively, the `undo` method can be called directly to achieve the same effect.
+             *
+             * Note that the first two arguments (`endpointName` and `arg`) are used to determine which existing cache entry to update. If no existing cache entry is found, the `updateRecipe` callback will not run.
+             *
+             * @example
+             *
+             * ```ts
+             * const patchCollection = dispatch(
+             *   api.util.updateQueryData('getPosts', undefined, (draftPosts) => {
+             *     draftPosts.push({ id: 1, name: 'Teddy' })
+             *   })
+             * )
+             * ```
+             */
+            updateQueryData: UpdateQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;
+            /**
+             * A Redux thunk action creator that, when dispatched, acts as an artificial API request to upsert a value into the cache.
+             *
+             * The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and the data to upsert.
+             *
+             * If no cache entry for that cache key exists, a cache entry will be created and the data added. If a cache entry already exists, this will _overwrite_ the existing cache entry data.
+             *
+             * The thunk executes _asynchronously_, and returns a promise that resolves when the store has been updated.
+             *
+             * If dispatched while an actual request is in progress, both the upsert and request will be handled as soon as they resolve, resulting in a "last result wins" update behavior.
+             *
+             * @example
+             *
+             * ```ts
+             * await dispatch(
+             *   api.util.upsertQueryData('getPost', {id: 1}, {id: 1, text: "Hello!"})
+             * )
+             * ```
+             */
+            upsertQueryData: UpsertQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;
+            /**
+             * A Redux thunk that applies a JSON diff/patch array to the cached data for a given query result. This immediately updates the Redux state with those changes.
+             *
+             * The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a JSON diff/patch array as produced by Immer's `produceWithPatches`.
+             *
+             * This is typically used as the second step in implementing optimistic updates. If a request fails, the optimistically-applied changes can be reverted by dispatching `patchQueryData` with the `inversePatches` that were generated by `updateQueryData` earlier.
+             *
+             * In cases where it is desired to simply revert the previous changes, it may be preferable to call the `undo` method returned from dispatching `updateQueryData` instead.
+             *
+             * @example
+             * ```ts
+             * const patchCollection = dispatch(
+             *   api.util.updateQueryData('getPosts', undefined, (draftPosts) => {
+             *     draftPosts.push({ id: 1, name: 'Teddy' })
+             *   })
+             * )
+             *
+             * // later
+             * dispatch(
+             *   api.util.patchQueryData('getPosts', undefined, patchCollection.inversePatches)
+             * )
+             *
+             * // or
+             * patchCollection.undo()
+             * ```
+             */
+            patchQueryData: PatchQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;
+            /**
+             * A Redux action creator that can be dispatched to manually reset the api state completely. This will immediately remove all existing cache entries, and all queries will be considered 'uninitialized'.
+             *
+             * @example
+             *
+             * ```ts
+             * dispatch(api.util.resetApiState())
+             * ```
+             */
+            resetApiState: SliceActions['resetApiState'];
+            upsertQueryEntries: UpsertEntries<Definitions>;
+            /**
+             * A Redux action creator that can be used to manually invalidate cache tags for [automated re-fetching](../../usage/automated-refetching.mdx).
+             *
+             * The action creator accepts one argument: the cache tags to be invalidated. It returns an action with those tags as a payload, and the corresponding `invalidateTags` action type for the api.
+             *
+             * Dispatching the result of this action creator will [invalidate](../../usage/automated-refetching.mdx#invalidating-cache-data) the given tags, causing queries to automatically re-fetch if they are subscribed to cache data that [provides](../../usage/automated-refetching.mdx#providing-cache-data) the corresponding tags.
+             *
+             * The array of tags provided to the action creator should be in one of the following formats, where `TagType` is equal to a string provided to the [`tagTypes`](../createApi.mdx#tagtypes) property of the api:
+             *
+             * - `[TagType]`
+             * - `[{ type: TagType }]`
+             * - `[{ type: TagType, id: number | string }]`
+             *
+             * @example
+             *
+             * ```ts
+             * dispatch(api.util.invalidateTags(['Post']))
+             * dispatch(api.util.invalidateTags([{ type: 'Post', id: 1 }]))
+             * dispatch(
+             *   api.util.invalidateTags([
+             *     { type: 'Post', id: 1 },
+             *     { type: 'Post', id: 'LIST' },
+             *   ])
+             * )
+             * ```
+             */
+            invalidateTags: ActionCreatorWithPayload<Array<TagDescription<TagTypes> | null | undefined>, string>;
+            /**
+             * A function to select all `{ endpointName, originalArgs, queryCacheKey }` combinations that would be invalidated by a specific set of tags.
+             *
+             * Can be used for mutations that want to do optimistic updates instead of invalidating a set of tags, but don't know exactly what they need to update.
+             */
+            selectInvalidatedBy: (state: RootState<Definitions, string, ReducerPath>, tags: ReadonlyArray<TagDescription<TagTypes> | null | undefined>) => Array<{
+                endpointName: string;
+                originalArgs: any;
+                queryCacheKey: string;
+            }>;
+            /**
+             * A function to select all arguments currently cached for a given endpoint.
+             *
+             * Can be used for mutations that want to do optimistic updates instead of invalidating a set of tags, but don't know exactly what they need to update.
+             */
+            selectCachedArgsForQuery: <QueryName extends AllQueryKeys<Definitions>>(state: RootState<Definitions, string, ReducerPath>, queryName: QueryName) => Array<QueryArgFromAnyQuery<Definitions[QueryName]>>;
+        };
+        /**
+         * Endpoints based on the input endpoints provided to `createApi`, containing `select` and `action matchers`.
+         */
+        endpoints: {
+            [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? ApiEndpointQuery<Definitions[K], Definitions> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? ApiEndpointMutation<Definitions[K], Definitions> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? ApiEndpointInfiniteQuery<Definitions[K], Definitions> : never;
+        };
+    };
+}
+interface ApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> extends BuildThunksApiEndpointQuery<Definition>, BuildInitiateApiEndpointQuery<Definition>, BuildSelectorsApiEndpointQuery<Definition, Definitions> {
+    name: string;
+    /**
+     * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
+     */
+    Types: NonNullable<Definition['Types']>;
+}
+interface ApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> extends BuildThunksApiEndpointInfiniteQuery<Definition>, BuildInitiateApiEndpointInfiniteQuery<Definition>, BuildSelectorsApiEndpointInfiniteQuery<Definition, Definitions> {
+    name: string;
+    /**
+     * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
+     */
+    Types: NonNullable<Definition['Types']>;
+}
+interface ApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> extends BuildThunksApiEndpointMutation<Definition>, BuildInitiateApiEndpointMutation<Definition>, BuildSelectorsApiEndpointMutation<Definition, Definitions> {
+    name: string;
+    /**
+     * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
+     */
+    Types: NonNullable<Definition['Types']>;
+}
+type ListenerActions = {
+    /**
+     * Will cause the RTK Query middleware to trigger any refetchOnReconnect-related behavior
+     * @link https://redux-toolkit.js.org/rtk-query/api/setupListeners
+     */
+    onOnline: typeof onOnline;
+    onOffline: typeof onOffline;
+    /**
+     * Will cause the RTK Query middleware to trigger any refetchOnFocus-related behavior
+     * @link https://redux-toolkit.js.org/rtk-query/api/setupListeners
+     */
+    onFocus: typeof onFocus;
+    onFocusLost: typeof onFocusLost;
+};
+type InternalActions = SliceActions & ListenerActions;
+interface CoreModuleOptions {
+    /**
+     * A selector creator (usually from `reselect`, or matching the same signature)
+     */
+    createSelector?: CreateSelectorFunction<any, any, any>;
+}
+/**
+ * Creates a module containing the basic redux logic for use with `buildCreateApi`.
+ *
+ * @example
+ * ```ts
+ * const createBaseApi = buildCreateApi(coreModule());
+ * ```
+ */
+declare const coreModule: ({ createSelector, }?: CoreModuleOptions) => Module<CoreModule>;
+
+declare const createApi: CreateApi<typeof coreModuleName>;
+
+type ModuleName = keyof ApiModules<any, any, any, any>;
+type Module<Name extends ModuleName> = {
+    name: Name;
+    init<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string>(api: Api<BaseQuery, EndpointDefinitions, ReducerPath, TagTypes, ModuleName>, options: WithRequiredProp<CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>, 'reducerPath' | 'serializeQueryArgs' | 'keepUnusedDataFor' | 'refetchOnMountOrArgChange' | 'refetchOnFocus' | 'refetchOnReconnect' | 'invalidationBehavior' | 'tagTypes'>, context: ApiContext<Definitions>): {
+        injectEndpoint(endpointName: string, definition: EndpointDefinition<any, any, any, any>): void;
+    };
+};
+interface ApiContext<Definitions extends EndpointDefinitions> {
+    apiUid: string;
+    endpointDefinitions: Definitions;
+    batch(cb: () => void): void;
+    extractRehydrationInfo: (action: UnknownAction) => CombinedState<any, any, any> | undefined;
+    hasRehydrationInfo: (action: UnknownAction) => boolean;
+}
+type Api<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string, Enhancers extends ModuleName = CoreModule> = UnionToIntersection<ApiModules<BaseQuery, Definitions, ReducerPath, TagTypes>[Enhancers]> & {
+    /**
+     * A function to inject the endpoints into the original API, but also give you that same API with correct types for these endpoints back. Useful with code-splitting.
+     */
+    injectEndpoints<NewDefinitions extends EndpointDefinitions>(_: {
+        endpoints: (build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>) => NewDefinitions;
+        /**
+         * Optionally allows endpoints to be overridden if defined by multiple `injectEndpoints` calls.
+         *
+         * If set to `true`, will override existing endpoints with the new definition.
+         * If set to `'throw'`, will throw an error if an endpoint is redefined with a different definition.
+         * If set to `false` (or unset), will not override existing endpoints with the new definition, and log a warning in development.
+         */
+        overrideExisting?: boolean | 'throw';
+    }): Api<BaseQuery, Definitions & NewDefinitions, ReducerPath, TagTypes, Enhancers>;
+    /**
+     *A function to enhance a generated API with additional information. Useful with code-generation.
+     */
+    enhanceEndpoints<NewTagTypes extends string = never, NewDefinitions extends EndpointDefinitions = never>(_: {
+        addTagTypes?: readonly NewTagTypes[];
+        endpoints?: UpdateDefinitions<Definitions, TagTypes | NoInfer<NewTagTypes>, NewDefinitions> extends infer NewDefinitions ? {
+            [K in keyof NewDefinitions]?: Partial<NewDefinitions[K]> | ((definition: NewDefinitions[K]) => void);
+        } : never;
+    }): Api<BaseQuery, UpdateDefinitions<Definitions, TagTypes | NewTagTypes, NewDefinitions>, ReducerPath, TagTypes | NewTagTypes, Enhancers>;
+};
+
+type PromiseWithKnownReason<T, R> = Omit<Promise<T>, 'then' | 'catch'> & {
+    /**
+     * Attaches callbacks for the resolution and/or rejection of the Promise.
+     * @param onfulfilled The callback to execute when the Promise is resolved.
+     * @param onrejected The callback to execute when the Promise is rejected.
+     * @returns A Promise for the completion of which ever callback is executed.
+     */
+    then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: R) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
+    /**
+     * Attaches a callback for only the rejection of the Promise.
+     * @param onrejected The callback to execute when the Promise is rejected.
+     * @returns A Promise for the completion of the callback.
+     */
+    catch<TResult = never>(onrejected?: ((reason: R) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
+};
+
+type ReferenceCacheCollection = never;
+/**
+ * @example
+ * ```ts
+ * // codeblock-meta title="keepUnusedDataFor example"
+ * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+ * interface Post {
+ *   id: number
+ *   name: string
+ * }
+ * type PostsResponse = Post[]
+ *
+ * const api = createApi({
+ *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+ *   endpoints: (build) => ({
+ *     getPosts: build.query<PostsResponse, void>({
+ *       query: () => 'posts',
+ *       // highlight-start
+ *       keepUnusedDataFor: 5
+ *       // highlight-end
+ *     })
+ *   })
+ * })
+ * ```
+ */
+type CacheCollectionQueryExtraOptions = {
+    /**
+     * Overrides the api-wide definition of `keepUnusedDataFor` for this endpoint only. _(This value is in seconds.)_
+     *
+     * This is how long RTK Query will keep your data cached for **after** the last component unsubscribes. For example, if you query an endpoint, then unmount the component, then mount another component that makes the same request within the given time frame, the most recent value will be served from the cache.
+     */
+    keepUnusedDataFor?: number;
+};
+
+export declare const _NEVER: unique symbol;
+type NEVER = typeof _NEVER;
+/**
+ * Creates a "fake" baseQuery to be used if your api *only* uses the `queryFn` definition syntax.
+ * This also allows you to specify a specific error type to be shared by all your `queryFn` definitions.
+ */
+declare function fakeBaseQuery<ErrorType>(): BaseQueryFn<void, NEVER, ErrorType, {}>;
+
+declare class NamedSchemaError extends SchemaError {
+    readonly value: any;
+    readonly schemaName: `${SchemaType}Schema`;
+    readonly _bqMeta: any;
+    constructor(issues: readonly StandardSchemaV1.Issue[], value: any, schemaName: `${SchemaType}Schema`, _bqMeta: any);
+}
+
+declare const rawResultType: unique symbol;
+declare const resultType: unique symbol;
+declare const baseQuery: unique symbol;
+interface SchemaFailureInfo {
+    endpoint: string;
+    arg: any;
+    type: 'query' | 'mutation';
+    queryCacheKey?: string;
+}
+type SchemaFailureHandler = (error: NamedSchemaError, info: SchemaFailureInfo) => void;
+type SchemaFailureConverter<BaseQuery extends BaseQueryFn> = (error: NamedSchemaError, info: SchemaFailureInfo) => BaseQueryError<BaseQuery>;
+type EndpointDefinitionWithQuery<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery>> = {
+    /**
+     * `query` can be a function that returns either a `string` or an `object` which is passed to your `baseQuery`. If you are using [fetchBaseQuery](./fetchBaseQuery), this can return either a `string` or an `object` of properties in `FetchArgs`. If you use your own custom [`baseQuery`](../../rtk-query/usage/customizing-queries), you can customize this behavior to your liking.
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="query example"
+     *
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     * type PostsResponse = Post[]
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   tagTypes: ['Post'],
+     *   endpoints: (build) => ({
+     *     getPosts: build.query<PostsResponse, void>({
+     *       // highlight-start
+     *       query: () => 'posts',
+     *       // highlight-end
+     *     }),
+     *     addPost: build.mutation<Post, Partial<Post>>({
+     *      // highlight-start
+     *      query: (body) => ({
+     *        url: `posts`,
+     *        method: 'POST',
+     *        body,
+     *      }),
+     *      // highlight-end
+     *      invalidatesTags: [{ type: 'Post', id: 'LIST' }],
+     *    }),
+     *   })
+     * })
+     * ```
+     */
+    query(arg: QueryArg): BaseQueryArg<BaseQuery>;
+    queryFn?: never;
+    /**
+     * A function to manipulate the data returned by a query or mutation.
+     */
+    transformResponse?(baseQueryReturnValue: RawResultType, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): ResultType | Promise<ResultType>;
+    /**
+     * A function to manipulate the data returned by a failed query or mutation.
+     */
+    transformErrorResponse?(baseQueryReturnValue: BaseQueryError<BaseQuery>, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): unknown;
+    /**
+     * A schema for the result *before* it's passed to `transformResponse`.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const postSchema = v.object({ id: v.number(), name: v.string() })
+     * type Post = v.InferOutput<typeof postSchema>
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPostName: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       rawResponseSchema: postSchema,
+     *       transformResponse: (post) => post.name,
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    rawResponseSchema?: StandardSchemaV1<RawResultType>;
+    /**
+     * A schema for the error object returned by the `query` or `queryFn`, *before* it's passed to `transformErrorResponse`.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     * import {customBaseQuery, baseQueryErrorSchema} from "./customBaseQuery"
+     *
+     * const api = createApi({
+     *   baseQuery: customBaseQuery,
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       rawErrorResponseSchema: baseQueryErrorSchema,
+     *       transformErrorResponse: (error) => error.data,
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    rawErrorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;
+};
+type EndpointDefinitionWithQueryFn<QueryArg, BaseQuery extends BaseQueryFn, ResultType> = {
+    /**
+     * Can be used in place of `query` as an inline function that bypasses `baseQuery` completely for the endpoint.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Basic queryFn example"
+     *
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     * type PostsResponse = Post[]
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPosts: build.query<PostsResponse, void>({
+     *       query: () => 'posts',
+     *     }),
+     *     flipCoin: build.query<'heads' | 'tails', void>({
+     *       // highlight-start
+     *       queryFn(arg, queryApi, extraOptions, baseQuery) {
+     *         const randomVal = Math.random()
+     *         if (randomVal < 0.45) {
+     *           return { data: 'heads' }
+     *         }
+     *         if (randomVal < 0.9) {
+     *           return { data: 'tails' }
+     *         }
+     *         return { error: { status: 500, statusText: 'Internal Server Error', data: "Coin landed on its edge!" } }
+     *       }
+     *       // highlight-end
+     *     })
+     *   })
+     * })
+     * ```
+     */
+    queryFn(arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions<BaseQuery>, baseQuery: (arg: Parameters<BaseQuery>[0]) => ReturnType<BaseQuery>): MaybePromise<QueryReturnValue<ResultType, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>>;
+    query?: never;
+    transformResponse?: never;
+    transformErrorResponse?: never;
+    rawResponseSchema?: never;
+    rawErrorResponseSchema?: never;
+};
+type BaseEndpointTypes<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType> = {
+    QueryArg: QueryArg;
+    BaseQuery: BaseQuery;
+    ResultType: ResultType;
+    RawResultType: RawResultType;
+};
+type SchemaType = 'arg' | 'rawResponse' | 'response' | 'rawErrorResponse' | 'errorResponse' | 'meta';
+interface CommonEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType> {
+    /**
+     * A schema for the arguments to be passed to the `query` or `queryFn`.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       argSchema: v.object({ id: v.number() }),
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    argSchema?: StandardSchemaV1<QueryArg>;
+    /**
+     * A schema for the result (including `transformResponse` if provided).
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const postSchema = v.object({ id: v.number(), name: v.string() })
+     * type Post = v.InferOutput<typeof postSchema>
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       responseSchema: postSchema,
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    responseSchema?: StandardSchemaV1<ResultType>;
+    /**
+     * A schema for the error object returned by the `query` or `queryFn` (including `transformErrorResponse` if provided).
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     * import { customBaseQuery, baseQueryErrorSchema } from "./customBaseQuery"
+     *
+     * const api = createApi({
+     *   baseQuery: customBaseQuery,
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       errorResponseSchema: baseQueryErrorSchema,
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    errorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;
+    /**
+     * A schema for the `meta` property returned by the `query` or `queryFn`.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     * import { customBaseQuery, baseQueryMetaSchema } from "./customBaseQuery"
+     *
+     * const api = createApi({
+     *   baseQuery: customBaseQuery,
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       metaSchema: baseQueryMetaSchema,
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    metaSchema?: StandardSchemaV1<BaseQueryMeta<BaseQuery>>;
+    /**
+     * Defaults to `true`.
+     *
+     * Most apps should leave this setting on. The only time it can be a performance issue
+     * is if an API returns extremely large amounts of data (e.g. 10,000 rows per request) and
+     * you're unable to paginate it.
+     *
+     * For details of how this works, please see the below. When it is set to `false`,
+     * every request will cause subscribed components to rerender, even when the data has not changed.
+     *
+     * @see https://redux-toolkit.js.org/api/other-exports#copywithstructuralsharing
+     */
+    structuralSharing?: boolean;
+    /**
+     * A function that is called when a schema validation fails.
+     *
+     * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).
+     *
+     * `NamedSchemaError` has the following properties:
+     * - `issues`: an array of issues that caused the validation to fail
+     * - `value`: the value that was passed to the schema
+     * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       onSchemaFailure: (error, info) => {
+     *         console.error(error, info)
+     *       },
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    onSchemaFailure?: SchemaFailureHandler;
+    /**
+     * Convert a schema validation failure into an error shape matching base query errors.
+     *
+     * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       responseSchema: v.object({ id: v.number(), name: v.string() }),
+     *       catchSchemaFailure: (error, info) => ({
+     *         status: "CUSTOM_ERROR",
+     *         error: error.schemaName + " failed validation",
+     *         data: error.issues,
+     *       }),
+     *     }),
+     *   }),
+     * })
+     * ```
+     */
+    catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;
+    /**
+     * Defaults to `false`.
+     *
+     * If set to `true`, will skip schema validation for this endpoint.
+     * Overrides the global setting.
+     *
+     * Can be overridden for specific schemas by passing an array of schema types to skip.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       responseSchema: v.object({ id: v.number(), name: v.string() }),
+     *       skipSchemaValidation: process.env.NODE_ENV === "test" ? ["response"] : false, // skip schema validation for response in tests, since we'll be mocking the response
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    skipSchemaValidation?: boolean | SchemaType[];
+}
+type BaseEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = (([CastAny<BaseQueryResult<BaseQuery>, {}>] extends [NEVER] ? never : EndpointDefinitionWithQuery<QueryArg, BaseQuery, ResultType, RawResultType>) | EndpointDefinitionWithQueryFn<QueryArg, BaseQuery, ResultType>) & CommonEndpointDefinition<QueryArg, BaseQuery, ResultType> & {
+    [rawResultType]?: RawResultType;
+    [resultType]?: ResultType;
+    [baseQuery]?: BaseQuery;
+} & HasRequiredProps<BaseQueryExtraOptions<BaseQuery>, {
+    extraOptions: BaseQueryExtraOptions<BaseQuery>;
+}, {
+    extraOptions?: BaseQueryExtraOptions<BaseQuery>;
+}>;
+declare enum DefinitionType {
+    query = "query",
+    mutation = "mutation",
+    infinitequery = "infinitequery"
+}
+type TagDescriptionArray<TagTypes extends string> = ReadonlyArray<TagDescription<TagTypes> | undefined | null>;
+type GetResultDescriptionFn<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = (result: ResultType | undefined, error: ErrorType | undefined, arg: QueryArg, meta: MetaType) => TagDescriptionArray<TagTypes>;
+type FullTagDescription<TagType> = {
+    type: TagType;
+    id?: number | string;
+};
+type TagDescription<TagType> = TagType | FullTagDescription<TagType>;
+/**
+ * @public
+ */
+type ResultDescription<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = TagDescriptionArray<TagTypes> | GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>;
+type QueryTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {
+    /**
+     * The endpoint definition type. To be used with some internal generic types.
+     * @example
+     * ```ts
+     * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...
+     * ```
+     */
+    QueryDefinition: QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;
+    TagTypes: TagTypes;
+    ReducerPath: ReducerPath;
+};
+/**
+ * @public
+ */
+interface QueryExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {
+    type: DefinitionType.query;
+    /**
+     * Used by `query` endpoints. Determines which 'tag' is attached to the cached data returned by the query.
+     * Expects an array of tag type strings, an array of objects of tag types with ids, or a function that returns such an array.
+     * 1.  `['Post']` - equivalent to `2`
+     * 2.  `[{ type: 'Post' }]` - equivalent to `1`
+     * 3.  `[{ type: 'Post', id: 1 }]`
+     * 4.  `(result, error, arg) => ['Post']` - equivalent to `5`
+     * 5.  `(result, error, arg) => [{ type: 'Post' }]` - equivalent to `4`
+     * 6.  `(result, error, arg) => [{ type: 'Post', id: 1 }]`
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="providesTags example"
+     *
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     * type PostsResponse = Post[]
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   tagTypes: ['Posts'],
+     *   endpoints: (build) => ({
+     *     getPosts: build.query<PostsResponse, void>({
+     *       query: () => 'posts',
+     *       // highlight-start
+     *       providesTags: (result) =>
+     *         result
+     *           ? [
+     *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),
+     *               { type: 'Posts', id: 'LIST' },
+     *             ]
+     *           : [{ type: 'Posts', id: 'LIST' }],
+     *       // highlight-end
+     *     })
+     *   })
+     * })
+     * ```
+     */
+    providesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;
+    /**
+     * Not to be used. A query should not invalidate tags in the cache.
+     */
+    invalidatesTags?: never;
+    /**
+     * Can be provided to return a custom cache key value based on the query arguments.
+     *
+     * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.
+     *
+     * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.
+     *
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="serializeQueryArgs : exclude value"
+     *
+     * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     *
+     * interface MyApiClient {
+     *   fetchPost: (id: string) => Promise<Post>
+     * }
+     *
+     * createApi({
+     *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *  endpoints: (build) => ({
+     *    // Example: an endpoint with an API client passed in as an argument,
+     *    // but only the item ID should be used as the cache key
+     *    getPost: build.query<Post, { id: string; client: MyApiClient }>({
+     *      queryFn: async ({ id, client }) => {
+     *        const post = await client.fetchPost(id)
+     *        return { data: post }
+     *      },
+     *      // highlight-start
+     *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {
+     *        const { id } = queryArgs
+     *        // This can return a string, an object, a number, or a boolean.
+     *        // If it returns an object, number or boolean, that value
+     *        // will be serialized automatically via `defaultSerializeQueryArgs`
+     *        return { id } // omit `client` from the cache key
+     *
+     *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:
+     *        // return defaultSerializeQueryArgs({
+     *        //   endpointName,
+     *        //   queryArgs: { id },
+     *        //   endpointDefinition
+     *        // })
+     *        // Or  create and return a string yourself:
+     *        // return `getPost(${id})`
+     *      },
+     *      // highlight-end
+     *    }),
+     *  }),
+     *})
+     * ```
+     */
+    serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;
+    /**
+     * Can be provided to merge an incoming response value into the current cache data.
+     * If supplied, no automatic structural sharing will be applied - it's up to
+     * you to update the cache appropriately.
+     *
+     * Since RTKQ normally replaces cache entries with the new response, you will usually
+     * need to use this with the `serializeQueryArgs` or `forceRefetch` options to keep
+     * an existing cache entry so that it can be updated.
+     *
+     * Since this is wrapped with Immer, you may either mutate the `currentCacheValue` directly,
+     * or return a new value, but _not_ both at once.
+     *
+     * Will only be called if the existing `currentCacheData` is _not_ `undefined` - on first response,
+     * the cache entry will just save the response data directly.
+     *
+     * Useful if you don't want a new request to completely override the current cache value,
+     * maybe because you have manually updated it from another source and don't want those
+     * updates to get lost.
+     *
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="merge: pagination"
+     *
+     * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     *
+     * createApi({
+     *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *  endpoints: (build) => ({
+     *    listItems: build.query<string[], number>({
+     *      query: (pageNumber) => `/listItems?page=${pageNumber}`,
+     *     // Only have one cache entry because the arg always maps to one string
+     *     serializeQueryArgs: ({ endpointName }) => {
+     *       return endpointName
+     *      },
+     *      // Always merge incoming data to the cache entry
+     *      merge: (currentCache, newItems) => {
+     *        currentCache.push(...newItems)
+     *      },
+     *      // Refetch when the page arg changes
+     *      forceRefetch({ currentArg, previousArg }) {
+     *        return currentArg !== previousArg
+     *      },
+     *    }),
+     *  }),
+     *})
+     * ```
+     */
+    merge?(currentCacheData: ResultType, responseData: ResultType, otherArgs: {
+        arg: QueryArg;
+        baseQueryMeta: BaseQueryMeta<BaseQuery>;
+        requestId: string;
+        fulfilledTimeStamp: number;
+    }): ResultType | void;
+    /**
+     * Check to see if the endpoint should force a refetch in cases where it normally wouldn't.
+     * This is primarily useful for "infinite scroll" / pagination use cases where
+     * RTKQ is keeping a single cache entry that is added to over time, in combination
+     * with `serializeQueryArgs` returning a fixed cache key and a `merge` callback
+     * set to add incoming data to the cache entry each time.
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="forceRefresh: pagination"
+     *
+     * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     *
+     * createApi({
+     *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *  endpoints: (build) => ({
+     *    listItems: build.query<string[], number>({
+     *      query: (pageNumber) => `/listItems?page=${pageNumber}`,
+     *     // Only have one cache entry because the arg always maps to one string
+     *     serializeQueryArgs: ({ endpointName }) => {
+     *       return endpointName
+     *      },
+     *      // Always merge incoming data to the cache entry
+     *      merge: (currentCache, newItems) => {
+     *        currentCache.push(...newItems)
+     *      },
+     *      // Refetch when the page arg changes
+     *      forceRefetch({ currentArg, previousArg }) {
+     *        return currentArg !== previousArg
+     *      },
+     *    }),
+     *  }),
+     *})
+     * ```
+     */
+    forceRefetch?(params: {
+        currentArg: QueryArg | undefined;
+        previousArg: QueryArg | undefined;
+        state: RootState<any, any, string>;
+        endpointState?: QuerySubState<any>;
+    }): boolean;
+    /**
+     * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
+     */
+    Types?: QueryTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;
+}
+type QueryDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & QueryExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;
+type InfiniteQueryTypes<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {
+    /**
+     * The endpoint definition type. To be used with some internal generic types.
+     * @example
+     * ```ts
+     * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...
+     * ```
+     */
+    InfiniteQueryDefinition: InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath>;
+    TagTypes: TagTypes;
+    ReducerPath: ReducerPath;
+};
+interface InfiniteQueryExtraOptions<TagTypes extends string, ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {
+    type: DefinitionType.infinitequery;
+    providesTags?: ResultDescription<TagTypes, InfiniteData<ResultType, PageParam>, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;
+    /**
+     * Not to be used. A query should not invalidate tags in the cache.
+     */
+    invalidatesTags?: never;
+    /**
+     * Required options to configure the infinite query behavior.
+     * `initialPageParam` and `getNextPageParam` are required, to
+     * ensure the infinite query can properly fetch the next page of data.
+     * `initialPageParam` may be specified when using the
+     * endpoint, to override the default value.
+     * `maxPages` and `getPreviousPageParam` are both optional.
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="infiniteQueryOptions example"
+     * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'
+     *
+     * type Pokemon = {
+     *   id: string
+     *   name: string
+     * }
+     *
+     * const pokemonApi = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),
+     *   endpoints: (build) => ({
+     *     getInfinitePokemonWithMax: build.infiniteQuery<Pokemon[], string, number>({
+     *       infiniteQueryOptions: {
+     *         initialPageParam: 0,
+     *         maxPages: 3,
+     *         getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) =>
+     *           lastPageParam + 1,
+     *         getPreviousPageParam: (
+     *           firstPage,
+     *           allPages,
+     *           firstPageParam,
+     *           allPageParams,
+     *         ) => {
+     *           return firstPageParam > 0 ? firstPageParam - 1 : undefined
+     *         },
+     *       },
+     *       query({pageParam}) {
+     *         return `https://example.com/listItems?page=${pageParam}`
+     *       },
+     *     }),
+     *   }),
+     * })
+     
+     * ```
+     */
+    infiniteQueryOptions: InfiniteQueryConfigOptions<ResultType, PageParam, QueryArg>;
+    /**
+     * Can be provided to return a custom cache key value based on the query arguments.
+     *
+     * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.
+     *
+     * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.
+     *
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="serializeQueryArgs : exclude value"
+     *
+     * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     *
+     * interface MyApiClient {
+     *   fetchPost: (id: string) => Promise<Post>
+     * }
+     *
+     * createApi({
+     *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *  endpoints: (build) => ({
+     *    // Example: an endpoint with an API client passed in as an argument,
+     *    // but only the item ID should be used as the cache key
+     *    getPost: build.query<Post, { id: string; client: MyApiClient }>({
+     *      queryFn: async ({ id, client }) => {
+     *        const post = await client.fetchPost(id)
+     *        return { data: post }
+     *      },
+     *      // highlight-start
+     *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {
+     *        const { id } = queryArgs
+     *        // This can return a string, an object, a number, or a boolean.
+     *        // If it returns an object, number or boolean, that value
+     *        // will be serialized automatically via `defaultSerializeQueryArgs`
+     *        return { id } // omit `client` from the cache key
+     *
+     *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:
+     *        // return defaultSerializeQueryArgs({
+     *        //   endpointName,
+     *        //   queryArgs: { id },
+     *        //   endpointDefinition
+     *        // })
+     *        // Or  create and return a string yourself:
+     *        // return `getPost(${id})`
+     *      },
+     *      // highlight-end
+     *    }),
+     *  }),
+     *})
+     * ```
+     */
+    serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;
+    /**
+     * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
+     */
+    Types?: InfiniteQueryTypes<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;
+}
+type InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<InfiniteQueryCombinedArg<QueryArg, PageParam>, BaseQuery, ResultType, RawResultType> & InfiniteQueryExtraOptions<TagTypes, ResultType, QueryArg, PageParam, BaseQuery, ReducerPath, RawResultType>;
+type MutationTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {
+    /**
+     * The endpoint definition type. To be used with some internal generic types.
+     * @example
+     * ```ts
+     * const useMyWrappedHook: UseMutation<typeof api.endpoints.query.Types.MutationDefinition> = ...
+     * ```
+     */
+    MutationDefinition: MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;
+    TagTypes: TagTypes;
+    ReducerPath: ReducerPath;
+};
+/**
+ * @public
+ */
+interface MutationExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath> {
+    type: DefinitionType.mutation;
+    /**
+     * Used by `mutation` endpoints. Determines which cached data should be either re-fetched or removed from the cache.
+     * Expects the same shapes as `providesTags`.
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="invalidatesTags example"
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     * type PostsResponse = Post[]
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   tagTypes: ['Posts'],
+     *   endpoints: (build) => ({
+     *     getPosts: build.query<PostsResponse, void>({
+     *       query: () => 'posts',
+     *       providesTags: (result) =>
+     *         result
+     *           ? [
+     *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),
+     *               { type: 'Posts', id: 'LIST' },
+     *             ]
+     *           : [{ type: 'Posts', id: 'LIST' }],
+     *     }),
+     *     addPost: build.mutation<Post, Partial<Post>>({
+     *       query(body) {
+     *         return {
+     *           url: `posts`,
+     *           method: 'POST',
+     *           body,
+     *         }
+     *       },
+     *       // highlight-start
+     *       invalidatesTags: [{ type: 'Posts', id: 'LIST' }],
+     *       // highlight-end
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    invalidatesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;
+    /**
+     * Not to be used. A mutation should not provide tags to the cache.
+     */
+    providesTags?: never;
+    /**
+     * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
+     */
+    Types?: MutationTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;
+}
+type MutationDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & MutationExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;
+type EndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, PageParam = any, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;
+type EndpointDefinitions = Record<string, EndpointDefinition<any, any, any, any, any, any, any>>;
+type EndpointBuilder<BaseQuery extends BaseQueryFn, TagTypes extends string, ReducerPath extends string> = {
+    /**
+     * An endpoint definition that retrieves data, and may provide tags to the cache.
+     *
+     * @example
+     * ```js
+     * // codeblock-meta title="Example of all query endpoint options"
+     * const api = createApi({
+     *  baseQuery,
+     *  endpoints: (build) => ({
+     *    getPost: build.query({
+     *      query: (id) => ({ url: `post/${id}` }),
+     *      // Pick out data and prevent nested properties in a hook or selector
+     *      transformResponse: (response) => response.data,
+     *      // Pick out error and prevent nested properties in a hook or selector
+     *      transformErrorResponse: (response) => response.error,
+     *      // `result` is the server response
+     *      providesTags: (result, error, id) => [{ type: 'Post', id }],
+     *      // trigger side effects or optimistic updates
+     *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry, updateCachedData }) {},
+     *      // handle subscriptions etc
+     *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry, updateCachedData }) {},
+     *    }),
+     *  }),
+     *});
+     *```
+     */
+    query<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;
+    /**
+     * An endpoint definition that alters data on the server or will possibly invalidate the cache.
+     *
+     * @example
+     * ```js
+     * // codeblock-meta title="Example of all mutation endpoint options"
+     * const api = createApi({
+     *   baseQuery,
+     *   endpoints: (build) => ({
+     *     updatePost: build.mutation({
+     *       query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),
+     *       // Pick out data and prevent nested properties in a hook or selector
+     *       transformResponse: (response) => response.data,
+     *       // Pick out error and prevent nested properties in a hook or selector
+     *       transformErrorResponse: (response) => response.error,
+     *       // `result` is the server response
+     *       invalidatesTags: (result, error, id) => [{ type: 'Post', id }],
+     *      // trigger side effects or optimistic updates
+     *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry }) {},
+     *      // handle subscriptions etc
+     *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry }) {},
+     *     }),
+     *   }),
+     * });
+     * ```
+     */
+    mutation<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;
+    infiniteQuery<ResultType, QueryArg, PageParam, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;
+};
+type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T;
+type QueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<infer QA, any, any, any> ? QA : never;
+type InfiniteQueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<infer QA, any, any, any, any, any, any> ? QA : never;
+type QueryArgFromAnyQuery<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any, any, any> ? InfiniteQueryArgFrom<D> : D extends QueryDefinition<any, any, any, any, any, any> ? QueryArgFrom<D> : never;
+type ResultTypeFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<any, any, infer RT, any> ? RT : unknown;
+type ReducerPathFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, any, any, infer RP, any, any> ? RP : unknown;
+type TagTypesFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, infer TT, any, any, any, any> ? TT : unknown;
+type PageParamFrom<D extends InfiniteQueryDefinition<any, any, any, any, any, any, any>> = D extends InfiniteQueryDefinition<any, infer PP, any, any, any, any, any> ? PP : unknown;
+type InfiniteQueryCombinedArg<QueryArg, PageParam> = {
+    queryArg: QueryArg;
+    pageParam: PageParam;
+};
+type TagTypesFromApi<T> = T extends Api<any, any, any, infer TagTypes> ? TagTypes : never;
+type DefinitionsFromApi<T> = T extends Api<any, infer Definitions, any, any> ? Definitions : never;
+type TransformedResponse<NewDefinitions extends EndpointDefinitions, K, ResultType> = K extends keyof NewDefinitions ? NewDefinitions[K]['transformResponse'] extends undefined ? ResultType : UnwrapPromise<ReturnType<NonUndefined<NewDefinitions[K]['transformResponse']>>> : ResultType;
+type OverrideResultType<Definition, NewResultType> = Definition extends QueryDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends MutationDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, NewResultType, ReducerPath> : never;
+type UpdateDefinitions<Definitions extends EndpointDefinitions, NewTagTypes extends string, NewDefinitions extends EndpointDefinitions> = {
+    [K in keyof Definitions]: Definitions[K] extends QueryDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends MutationDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : never;
+};
+
+type QueryCacheKey = string & {
+    _type: 'queryCacheKey';
+};
+type QuerySubstateIdentifier = {
+    queryCacheKey: QueryCacheKey;
+};
+type MutationSubstateIdentifier = {
+    requestId: string;
+    fixedCacheKey?: string;
+} | {
+    requestId?: string;
+    fixedCacheKey: string;
+};
+type RefetchConfigOptions = {
+    refetchOnMountOrArgChange: boolean | number;
+    refetchOnReconnect: boolean;
+    refetchOnFocus: boolean;
+};
+type InfiniteQueryConfigOptions<DataType, PageParam, QueryArg> = {
+    /**
+     * The initial page parameter to use for the first page fetch.
+     */
+    initialPageParam: PageParam;
+    /**
+     * This function is required to automatically get the next cursor for infinite queries.
+     * The result will also be used to determine the value of `hasNextPage`.
+     */
+    getNextPageParam: (lastPage: DataType, allPages: Array<DataType>, lastPageParam: PageParam, allPageParams: Array<PageParam>, queryArg: QueryArg) => PageParam | undefined | null;
+    /**
+     * This function can be set to automatically get the previous cursor for infinite queries.
+     * The result will also be used to determine the value of `hasPreviousPage`.
+     */
+    getPreviousPageParam?: (firstPage: DataType, allPages: Array<DataType>, firstPageParam: PageParam, allPageParams: Array<PageParam>, queryArg: QueryArg) => PageParam | undefined | null;
+    /**
+     * If specified, only keep this many pages in cache at once.
+     * If additional pages are fetched, older pages in the other
+     * direction will be dropped from the cache.
+     */
+    maxPages?: number;
+    /**
+     * Defaults to `true`. When this is `true` and an infinite query endpoint is refetched
+     * (due to tag invalidation, polling, arg change configuration, or manual refetching),
+     * RTK Query will try to sequentially refetch all pages currently in the cache.
+     * When `false` only the first page will be refetched.
+     */
+    refetchCachedPages?: boolean;
+};
+type InfiniteData<DataType, PageParam> = {
+    pages: Array<DataType>;
+    pageParams: Array<PageParam>;
+};
+/**
+ * Strings describing the query state at any given time.
+ */
+declare enum QueryStatus {
+    uninitialized = "uninitialized",
+    pending = "pending",
+    fulfilled = "fulfilled",
+    rejected = "rejected"
+}
+type RequestStatusFlags = {
+    status: QueryStatus.uninitialized;
+    isUninitialized: true;
+    isLoading: false;
+    isSuccess: false;
+    isError: false;
+} | {
+    status: QueryStatus.pending;
+    isUninitialized: false;
+    isLoading: true;
+    isSuccess: false;
+    isError: false;
+} | {
+    status: QueryStatus.fulfilled;
+    isUninitialized: false;
+    isLoading: false;
+    isSuccess: true;
+    isError: false;
+} | {
+    status: QueryStatus.rejected;
+    isUninitialized: false;
+    isLoading: false;
+    isSuccess: false;
+    isError: true;
+};
+/**
+ * @public
+ */
+type SubscriptionOptions = {
+    /**
+     * How frequently to automatically re-fetch data (in milliseconds). Defaults to `0` (off).
+     */
+    pollingInterval?: number;
+    /**
+     *  Defaults to 'false'. This setting allows you to control whether RTK Query will continue polling if the window is not focused.
+     *
+     *  If pollingInterval is not set or set to 0, this **will not be evaluated** until pollingInterval is greater than 0.
+     *
+     *  Note: requires [`setupListeners`](./setupListeners) to have been called.
+     */
+    skipPollingIfUnfocused?: boolean;
+    /**
+     * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after regaining a network connection.
+     *
+     * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.
+     *
+     * Note: requires [`setupListeners`](./setupListeners) to have been called.
+     */
+    refetchOnReconnect?: boolean;
+    /**
+     * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after the application window regains focus.
+     *
+     * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.
+     *
+     * Note: requires [`setupListeners`](./setupListeners) to have been called.
+     */
+    refetchOnFocus?: boolean;
+};
+type Subscribers = {
+    [requestId: string]: SubscriptionOptions;
+};
+type QueryKeys<Definitions extends EndpointDefinitions> = {
+    [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any> ? K : never;
+}[keyof Definitions];
+type InfiniteQueryKeys<Definitions extends EndpointDefinitions> = {
+    [K in keyof Definitions]: Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? K : never;
+}[keyof Definitions];
+type MutationKeys<Definitions extends EndpointDefinitions> = {
+    [K in keyof Definitions]: Definitions[K] extends MutationDefinition<any, any, any, any> ? K : never;
+}[keyof Definitions];
+type BaseQuerySubState<D extends BaseEndpointDefinition<any, any, any, any>, DataType = ResultTypeFrom<D>> = {
+    /**
+     * The argument originally passed into the hook or `initiate` action call
+     */
+    originalArgs: QueryArgFromAnyQuery<D>;
+    /**
+     * A unique ID associated with the request
+     */
+    requestId: string;
+    /**
+     * The received data from the query
+     */
+    data?: DataType;
+    /**
+     * The received error if applicable
+     */
+    error?: SerializedError | (D extends QueryDefinition<any, infer BaseQuery, any, any> ? BaseQueryError<BaseQuery> : never);
+    /**
+     * The name of the endpoint associated with the query
+     */
+    endpointName: string;
+    /**
+     * Time that the latest query started
+     */
+    startedTimeStamp: number;
+    /**
+     * Time that the latest query was fulfilled
+     */
+    fulfilledTimeStamp?: number;
+};
+type QuerySubState<D extends BaseEndpointDefinition<any, any, any, any>, DataType = ResultTypeFrom<D>> = Id<({
+    status: QueryStatus.fulfilled;
+} & WithRequiredProp<BaseQuerySubState<D, DataType>, 'data' | 'fulfilledTimeStamp'> & {
+    error: undefined;
+}) | ({
+    status: QueryStatus.pending;
+} & BaseQuerySubState<D, DataType>) | ({
+    status: QueryStatus.rejected;
+} & WithRequiredProp<BaseQuerySubState<D, DataType>, 'error'>) | {
+    status: QueryStatus.uninitialized;
+    originalArgs?: undefined;
+    data?: undefined;
+    error?: undefined;
+    requestId?: undefined;
+    endpointName?: string;
+    startedTimeStamp?: undefined;
+    fulfilledTimeStamp?: undefined;
+}>;
+type InfiniteQueryDirection = 'forward' | 'backward';
+type InfiniteQuerySubState<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any> ? QuerySubState<D, InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>> & {
+    direction?: InfiniteQueryDirection;
+} : never;
+type BaseMutationSubState<D extends BaseEndpointDefinition<any, any, any, any>> = {
+    requestId: string;
+    data?: ResultTypeFrom<D>;
+    error?: SerializedError | (D extends MutationDefinition<any, infer BaseQuery, any, any> ? BaseQueryError<BaseQuery> : never);
+    endpointName: string;
+    startedTimeStamp: number;
+    fulfilledTimeStamp?: number;
+};
+type MutationSubState<D extends BaseEndpointDefinition<any, any, any, any>> = (({
+    status: QueryStatus.fulfilled;
+} & WithRequiredProp<BaseMutationSubState<D>, 'data' | 'fulfilledTimeStamp'>) & {
+    error: undefined;
+}) | (({
+    status: QueryStatus.pending;
+} & BaseMutationSubState<D>) & {
+    data?: undefined;
+}) | ({
+    status: QueryStatus.rejected;
+} & WithRequiredProp<BaseMutationSubState<D>, 'error'>) | {
+    requestId?: undefined;
+    status: QueryStatus.uninitialized;
+    data?: undefined;
+    error?: undefined;
+    endpointName?: string;
+    startedTimeStamp?: undefined;
+    fulfilledTimeStamp?: undefined;
+};
+type CombinedState<D extends EndpointDefinitions, E extends string, ReducerPath extends string> = {
+    queries: QueryState<D>;
+    mutations: MutationState<D>;
+    provided: InvalidationState<E>;
+    subscriptions: SubscriptionState;
+    config: ConfigState<ReducerPath>;
+};
+type InvalidationState<TagTypes extends string> = {
+    tags: {
+        [_ in TagTypes]: {
+            [id: string]: Array<QueryCacheKey>;
+            [id: number]: Array<QueryCacheKey>;
+        };
+    };
+    keys: Record<QueryCacheKey, Array<FullTagDescription<any>>>;
+};
+type QueryState<D extends EndpointDefinitions> = {
+    [queryCacheKey: string]: QuerySubState<D[string]> | InfiniteQuerySubState<D[string]> | undefined;
+};
+type SubscriptionState = {
+    [queryCacheKey: string]: Subscribers | undefined;
+};
+type ConfigState<ReducerPath> = RefetchConfigOptions & {
+    reducerPath: ReducerPath;
+    online: boolean;
+    focused: boolean;
+    middlewareRegistered: boolean | 'conflict';
+} & ModifiableConfigState;
+type ModifiableConfigState = {
+    keepUnusedDataFor: number;
+    invalidationBehavior: 'delayed' | 'immediately';
+} & RefetchConfigOptions;
+type MutationState<D extends EndpointDefinitions> = {
+    [requestId: string]: MutationSubState<D[string]> | undefined;
+};
+type RootState<Definitions extends EndpointDefinitions, TagTypes extends string, ReducerPath extends string> = {
+    [P in ReducerPath]: CombinedState<Definitions, TagTypes, P>;
+};
+
+type ResponseHandler = 'content-type' | 'json' | 'text' | ((response: Response) => Promise<any>);
+type CustomRequestInit = Override<RequestInit, {
+    headers?: Headers | string[][] | Record<string, string | undefined> | undefined;
+}>;
+interface FetchArgs extends CustomRequestInit {
+    url: string;
+    params?: Record<string, any>;
+    body?: any;
+    responseHandler?: ResponseHandler;
+    validateStatus?: (response: Response, body: any) => boolean;
+    /**
+     * A number in milliseconds that represents that maximum time a request can take before timing out.
+     */
+    timeout?: number;
+}
+type FetchBaseQueryError = {
+    /**
+     * * `number`:
+     *   HTTP status code
+     */
+    status: number;
+    data: unknown;
+} | {
+    /**
+     * * `"FETCH_ERROR"`:
+     *   An error that occurred during execution of `fetch` or the `fetchFn` callback option
+     **/
+    status: 'FETCH_ERROR';
+    data?: undefined;
+    error: string;
+} | {
+    /**
+     * * `"PARSING_ERROR"`:
+     *   An error happened during parsing.
+     *   Most likely a non-JSON-response was returned with the default `responseHandler` "JSON",
+     *   or an error occurred while executing a custom `responseHandler`.
+     **/
+    status: 'PARSING_ERROR';
+    originalStatus: number;
+    data: string;
+    error: string;
+} | {
+    /**
+     * * `"TIMEOUT_ERROR"`:
+     *   Request timed out
+     **/
+    status: 'TIMEOUT_ERROR';
+    data?: undefined;
+    error: string;
+} | {
+    /**
+     * * `"CUSTOM_ERROR"`:
+     *   A custom error type that you can return from your `queryFn` where another error might not make sense.
+     **/
+    status: 'CUSTOM_ERROR';
+    data?: unknown;
+    error: string;
+};
+type FetchBaseQueryArgs = {
+    baseUrl?: string;
+    prepareHeaders?: (headers: Headers, api: Pick<BaseQueryApi, 'getState' | 'extra' | 'endpoint' | 'type' | 'forced'> & {
+        arg: string | FetchArgs;
+        extraOptions: unknown;
+    }) => MaybePromise<Headers | void>;
+    fetchFn?: (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
+    paramsSerializer?: (params: Record<string, any>) => string;
+    /**
+     * By default, we only check for 'application/json' and 'application/vnd.api+json' as the content-types for json. If you need to support another format, you can pass
+     * in a predicate function for your given api to get the same automatic stringifying behavior
+     * @example
+     * ```ts
+     * const isJsonContentType = (headers: Headers) => ["application/vnd.api+json", "application/json", "application/vnd.hal+json"].includes(headers.get("content-type")?.trim());
+     * ```
+     */
+    isJsonContentType?: (headers: Headers) => boolean;
+    /**
+     * Defaults to `application/json`;
+     */
+    jsonContentType?: string;
+    /**
+     * Custom replacer function used when calling `JSON.stringify()`;
+     */
+    jsonReplacer?: (this: any, key: string, value: any) => any;
+} & RequestInit & Pick<FetchArgs, 'responseHandler' | 'validateStatus' | 'timeout'>;
+type FetchBaseQueryMeta = {
+    request: Request;
+    response?: Response;
+};
+/**
+ * This is a very small wrapper around fetch that aims to simplify requests.
+ *
+ * @example
+ * ```ts
+ * const baseQuery = fetchBaseQuery({
+ *   baseUrl: 'https://api.your-really-great-app.com/v1/',
+ *   prepareHeaders: (headers, { getState }) => {
+ *     const token = (getState() as RootState).auth.token;
+ *     // If we have a token set in state, let's assume that we should be passing it.
+ *     if (token) {
+ *       headers.set('authorization', `Bearer ${token}`);
+ *     }
+ *     return headers;
+ *   },
+ * })
+ * ```
+ *
+ * @param {string} baseUrl
+ * The base URL for an API service.
+ * Typically in the format of https://example.com/
+ *
+ * @param {(headers: Headers, api: { getState: () => unknown; arg: string | FetchArgs; extra: unknown; endpoint: string; type: 'query' | 'mutation'; forced: boolean; }) => Headers} prepareHeaders
+ * An optional function that can be used to inject headers on requests.
+ * Provides a Headers object, most of the `BaseQueryApi` (`dispatch` is not available), and the arg passed into the query function.
+ * Useful for setting authentication or headers that need to be set conditionally.
+ *
+ * @link https://developer.mozilla.org/en-US/docs/Web/API/Headers
+ *
+ * @param {(input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>} fetchFn
+ * Accepts a custom `fetch` function if you do not want to use the default on the window.
+ * Useful in SSR environments if you need to use a library such as `isomorphic-fetch` or `cross-fetch`
+ *
+ * @param {(params: Record<string, unknown>) => string} paramsSerializer
+ * An optional function that can be used to stringify querystring parameters.
+ *
+ * @param {(headers: Headers) => boolean} isJsonContentType
+ * An optional predicate function to determine if `JSON.stringify()` should be called on the `body` arg of `FetchArgs`
+ *
+ * @param {string} jsonContentType Used when automatically setting the content-type header for a request with a jsonifiable body that does not have an explicit content-type header. Defaults to `application/json`.
+ *
+ * @param {(this: any, key: string, value: any) => any} jsonReplacer Custom replacer function used when calling `JSON.stringify()`.
+ *
+ * @param {number} timeout
+ * A number in milliseconds that represents the maximum time a request can take before timing out.
+ */
+declare function fetchBaseQuery({ baseUrl, prepareHeaders, fetchFn, paramsSerializer, isJsonContentType, jsonContentType, jsonReplacer, timeout: defaultTimeout, responseHandler: globalResponseHandler, validateStatus: globalValidateStatus, ...baseFetchOptions }?: FetchBaseQueryArgs): BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>;
+
+type RetryConditionFunction = (error: BaseQueryError<BaseQueryFn>, args: BaseQueryArg<BaseQueryFn>, extraArgs: {
+    attempt: number;
+    baseQueryApi: BaseQueryApi;
+    extraOptions: BaseQueryExtraOptions<BaseQueryFn> & RetryOptions;
+}) => boolean;
+type RetryOptions = {
+    /**
+     * Function used to determine delay between retries
+     */
+    backoff?: (attempt: number, maxRetries: number, signal?: AbortSignal) => Promise<void>;
+} & ({
+    /**
+     * How many times the query will be retried (default: 5)
+     */
+    maxRetries?: number;
+    retryCondition?: undefined;
+} | {
+    /**
+     * Callback to determine if a retry should be attempted.
+     * Return `true` for another retry and `false` to quit trying prematurely.
+     */
+    retryCondition?: RetryConditionFunction;
+    maxRetries?: undefined;
+});
+declare function fail<BaseQuery extends BaseQueryFn = BaseQueryFn>(error: BaseQueryError<BaseQuery>, meta?: BaseQueryMeta<BaseQuery>): never;
+/**
+ * A utility that can wrap `baseQuery` in the API definition to provide retries with a basic exponential backoff.
+ *
+ * @example
+ *
+ * ```ts
+ * // codeblock-meta title="Retry every request 5 times by default"
+ * import { createApi, fetchBaseQuery, retry } from '@reduxjs/toolkit/query/react'
+ * interface Post {
+ *   id: number
+ *   name: string
+ * }
+ * type PostsResponse = Post[]
+ *
+ * // maxRetries: 5 is the default, and can be omitted. Shown for documentation purposes.
+ * const staggeredBaseQuery = retry(fetchBaseQuery({ baseUrl: '/' }), { maxRetries: 5 });
+ * export const api = createApi({
+ *   baseQuery: staggeredBaseQuery,
+ *   endpoints: (build) => ({
+ *     getPosts: build.query<PostsResponse, void>({
+ *       query: () => ({ url: 'posts' }),
+ *     }),
+ *     getPost: build.query<PostsResponse, string>({
+ *       query: (id) => ({ url: `post/${id}` }),
+ *       extraOptions: { maxRetries: 8 }, // You can override the retry behavior on each endpoint
+ *     }),
+ *   }),
+ * });
+ *
+ * export const { useGetPostsQuery, useGetPostQuery } = api;
+ * ```
+ */
+declare const retry: BaseQueryEnhancer<unknown, RetryOptions, void | RetryOptions> & {
+    fail: typeof fail;
+};
+
+declare function copyWithStructuralSharing<T>(oldObj: any, newObj: T): T;
+
+export { type Api, type ApiContext, type ApiEndpointInfiniteQuery, type ApiEndpointMutation, type ApiEndpointQuery, type ApiModules, type BaseEndpointDefinition, type BaseQueryApi, type BaseQueryArg, type BaseQueryEnhancer, type BaseQueryError, type BaseQueryExtraOptions, type BaseQueryFn, type BaseQueryMeta, type BaseQueryResult, type CombinedState, type CoreModule, type CreateApi, type CreateApiOptions, DefinitionType, type DefinitionsFromApi, type EndpointBuilder, type EndpointDefinition, type EndpointDefinitions, type FetchArgs, type FetchBaseQueryArgs, type FetchBaseQueryError, type FetchBaseQueryMeta, type InfiniteData, type InfiniteQueryActionCreatorResult, type InfiniteQueryArgFrom, type InfiniteQueryConfigOptions, type InfiniteQueryDefinition, type InfiniteQueryExtraOptions, type InfiniteQueryResultSelectorResult, type InfiniteQuerySubState, type Module, type MutationActionCreatorResult, type MutationDefinition, type MutationExtraOptions, type MutationResultSelectorResult, NamedSchemaError, type OverrideResultType, type PageParamFrom, type PrefetchOptions, type QueryActionCreatorResult, type QueryArgFrom, type QueryCacheKey, type QueryDefinition, type QueryExtraOptions, type QueryKeys, type QueryResultSelectorResult, type QueryReturnValue, QueryStatus, type QuerySubState, type ResultDescription, type ResultTypeFrom, type RetryOptions, type RootState, type SchemaFailureConverter, type SchemaFailureHandler, type SchemaFailureInfo, type SchemaType, type SerializeQueryArgs, type SkipToken, type StartQueryActionCreatorOptions, type SubscriptionOptions, type Id as TSHelpersId, type NoInfer as TSHelpersNoInfer, type Override as TSHelpersOverride, type TagDescription, type TagTypesFromApi, type TypedMutationOnQueryStarted, type TypedQueryOnQueryStarted, type UpdateDefinitions, buildCreateApi, copyWithStructuralSharing, coreModule, createApi, defaultSerializeQueryArgs, fakeBaseQuery, fetchBaseQuery, retry, setupListeners };
Index: node_modules/@reduxjs/toolkit/dist/query/index.d.ts
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/index.d.ts	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/index.d.ts	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,2954 @@
+import * as _reduxjs_toolkit from '@reduxjs/toolkit';
+import { ThunkDispatch, UnknownAction, Draft, AsyncThunk, SHOULD_AUTOBATCH, ThunkAction, SafePromise, SerializedError, PayloadAction, ActionCreatorWithoutPayload, Reducer, Middleware, ActionCreatorWithPayload } from '@reduxjs/toolkit';
+import { Patch } from 'immer';
+import * as redux from 'redux';
+import { CreateSelectorFunction } from 'reselect';
+import { StandardSchemaV1 } from '@standard-schema/spec';
+import { SchemaError } from '@standard-schema/utils';
+
+type Id<T> = {
+    [K in keyof T]: T[K];
+} & {};
+type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
+type Override<T1, T2> = T2 extends any ? Omit<T1, keyof T2> & T2 : never;
+/**
+ * Convert a Union type `(A|B)` to an intersection type `(A&B)`
+ */
+type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
+type NonOptionalKeys<T> = {
+    [K in keyof T]-?: undefined extends T[K] ? never : K;
+}[keyof T];
+type HasRequiredProps<T, True, False> = NonOptionalKeys<T> extends never ? False : True;
+type NoInfer<T> = [T][T extends any ? 0 : never];
+type NonUndefined<T> = T extends undefined ? never : T;
+type UnwrapPromise<T> = T extends PromiseLike<infer V> ? V : T;
+type MaybePromise<T> = T | PromiseLike<T>;
+type OmitFromUnion<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
+type IsAny<T, True, False = never> = true | false extends (T extends never ? true : false) ? True : False;
+type CastAny<T, CastTo> = IsAny<T, CastTo, T>;
+
+interface BaseQueryApi {
+    signal: AbortSignal;
+    abort: (reason?: string) => void;
+    dispatch: ThunkDispatch<any, any, any>;
+    getState: () => unknown;
+    extra: unknown;
+    endpoint: string;
+    type: 'query' | 'mutation';
+    /**
+     * Only available for queries: indicates if a query has been forced,
+     * i.e. it would have been fetched even if there would already be a cache entry
+     * (this does not mean that there is already a cache entry though!)
+     *
+     * This can be used to for example add a `Cache-Control: no-cache` header for
+     * invalidated queries.
+     */
+    forced?: boolean;
+    /**
+     * Only available for queries: the cache key that was used to store the query result
+     */
+    queryCacheKey?: string;
+}
+type QueryReturnValue<T = unknown, E = unknown, M = unknown> = {
+    error: E;
+    data?: undefined;
+    meta?: M;
+} | {
+    error?: undefined;
+    data: T;
+    meta?: M;
+};
+type BaseQueryFn<Args = any, Result = unknown, Error = unknown, DefinitionExtraOptions = {}, Meta = {}> = (args: Args, api: BaseQueryApi, extraOptions: DefinitionExtraOptions) => MaybePromise<QueryReturnValue<Result, Error, Meta>>;
+type BaseQueryEnhancer<AdditionalArgs = unknown, AdditionalDefinitionExtraOptions = unknown, Config = void> = <BaseQuery extends BaseQueryFn>(baseQuery: BaseQuery, config: Config) => BaseQueryFn<BaseQueryArg<BaseQuery> & AdditionalArgs, BaseQueryResult<BaseQuery>, BaseQueryError<BaseQuery>, BaseQueryExtraOptions<BaseQuery> & AdditionalDefinitionExtraOptions, NonNullable<BaseQueryMeta<BaseQuery>>>;
+/**
+ * @public
+ */
+type BaseQueryResult<BaseQuery extends BaseQueryFn> = UnwrapPromise<ReturnType<BaseQuery>> extends infer Unwrapped ? Unwrapped extends {
+    data: any;
+} ? Unwrapped['data'] : never : never;
+/**
+ * @public
+ */
+type BaseQueryMeta<BaseQuery extends BaseQueryFn> = UnwrapPromise<ReturnType<BaseQuery>>['meta'];
+/**
+ * @public
+ */
+type BaseQueryError<BaseQuery extends BaseQueryFn> = Exclude<UnwrapPromise<ReturnType<BaseQuery>>, {
+    error?: undefined;
+}>['error'];
+/**
+ * @public
+ */
+type BaseQueryArg<T extends (arg: any, ...args: any[]) => any> = T extends (arg: infer A, ...args: any[]) => any ? A : any;
+/**
+ * @public
+ */
+type BaseQueryExtraOptions<BaseQuery extends BaseQueryFn> = Parameters<BaseQuery>[2];
+
+declare const defaultSerializeQueryArgs: SerializeQueryArgs<any>;
+type SerializeQueryArgs<QueryArgs, ReturnType = string> = (_: {
+    queryArgs: QueryArgs;
+    endpointDefinition: EndpointDefinition<any, any, any, any>;
+    endpointName: string;
+}) => ReturnType;
+type InternalSerializeQueryArgs = (_: {
+    queryArgs: any;
+    endpointDefinition: EndpointDefinition<any, any, any, any>;
+    endpointName: string;
+}) => QueryCacheKey;
+
+interface CreateApiOptions<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string = 'api', TagTypes extends string = never> {
+    /**
+     * The base query used by each endpoint if no `queryFn` option is specified. RTK Query exports a utility called [fetchBaseQuery](./fetchBaseQuery) as a lightweight wrapper around `fetch` for common use-cases. See [Customizing Queries](../../rtk-query/usage/customizing-queries) if `fetchBaseQuery` does not handle your requirements.
+     *
+     * @example
+     *
+     * ```ts
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
+     *
+     * const api = createApi({
+     *   // highlight-start
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   // highlight-end
+     *   endpoints: (build) => ({
+     *     // ...endpoints
+     *   }),
+     * })
+     * ```
+     */
+    baseQuery: BaseQuery;
+    /**
+     * An array of string tag type names. Specifying tag types is optional, but you should define them so that they can be used for caching and invalidation. When defining a tag type, you will be able to [provide](../../rtk-query/usage/automated-refetching#providing-tags) them with `providesTags` and [invalidate](../../rtk-query/usage/automated-refetching#invalidating-tags) them with `invalidatesTags` when configuring [endpoints](#endpoints).
+     *
+     * @example
+     *
+     * ```ts
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   // highlight-start
+     *   tagTypes: ['Post', 'User'],
+     *   // highlight-end
+     *   endpoints: (build) => ({
+     *     // ...endpoints
+     *   }),
+     * })
+     * ```
+     */
+    tagTypes?: readonly TagTypes[];
+    /**
+     * The `reducerPath` is a _unique_ key that your service will be mounted to in your store. If you call `createApi` more than once in your application, you will need to provide a unique value each time. Defaults to `'api'`.
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="apis.js"
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query';
+     *
+     * const apiOne = createApi({
+     *   // highlight-start
+     *   reducerPath: 'apiOne',
+     *   // highlight-end
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (builder) => ({
+     *     // ...endpoints
+     *   }),
+     * });
+     *
+     * const apiTwo = createApi({
+     *   // highlight-start
+     *   reducerPath: 'apiTwo',
+     *   // highlight-end
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (builder) => ({
+     *     // ...endpoints
+     *   }),
+     * });
+     * ```
+     */
+    reducerPath?: ReducerPath;
+    /**
+     * Accepts a custom function if you have a need to change the creation of cache keys for any reason.
+     */
+    serializeQueryArgs?: SerializeQueryArgs<unknown>;
+    /**
+     * Endpoints are a set of operations that you want to perform against your server. You define them as an object using the builder syntax. There are three endpoint types: [`query`](../../rtk-query/usage/queries), [`infiniteQuery`](../../rtk-query/usage/infinite-queries) and [`mutation`](../../rtk-query/usage/mutations).
+     */
+    endpoints(build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>): Definitions;
+    /**
+     * Defaults to `60` _(this value is in seconds)_. This is how long RTK Query will keep your data cached for **after** the last component unsubscribes. For example, if you query an endpoint, then unmount the component, then mount another component that makes the same request within the given time frame, the most recent value will be served from the cache.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="keepUnusedDataFor example"
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     * type PostsResponse = Post[]
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPosts: build.query<PostsResponse, void>({
+     *       query: () => 'posts'
+     *     })
+     *   }),
+     *   // highlight-start
+     *   keepUnusedDataFor: 5
+     *   // highlight-end
+     * })
+     * ```
+     */
+    keepUnusedDataFor?: number;
+    /**
+     * Defaults to `false`. This setting allows you to control whether if a cached result is already available RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.
+     * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.
+     * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.
+     * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.
+     *
+     * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.
+     */
+    refetchOnMountOrArgChange?: boolean | number;
+    /**
+     * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after the application window regains focus.
+     *
+     * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.
+     *
+     * Note: requires [`setupListeners`](./setupListeners) to have been called.
+     */
+    refetchOnFocus?: boolean;
+    /**
+     * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after regaining a network connection.
+     *
+     * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.
+     *
+     * Note: requires [`setupListeners`](./setupListeners) to have been called.
+     */
+    refetchOnReconnect?: boolean;
+    /**
+     * Defaults to `'delayed'`. This setting allows you to control when tags are invalidated after a mutation.
+     *
+     * - `'immediately'`: Queries are invalidated instantly after the mutation finished, even if they are running.
+     *   If the query provides tags that were invalidated while it ran, it won't be re-fetched.
+     * - `'delayed'`: Invalidation only happens after all queries and mutations are settled.
+     *   This ensures that queries are always invalidated correctly and automatically "batches" invalidations of concurrent mutations.
+     *   Note that if you constantly have some queries (or mutations) running, this can delay tag invalidations indefinitely.
+     */
+    invalidationBehavior?: 'delayed' | 'immediately';
+    /**
+     * A function that is passed every dispatched action. If this returns something other than `undefined`,
+     * that return value will be used to rehydrate fulfilled & errored queries.
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="next-redux-wrapper rehydration example"
+     * import type { Action, PayloadAction } from '@reduxjs/toolkit'
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * import { HYDRATE } from 'next-redux-wrapper'
+     *
+     * type RootState = any; // normally inferred from state
+     *
+     * function isHydrateAction(action: Action): action is PayloadAction<RootState> {
+     *   return action.type === HYDRATE
+     * }
+     *
+     * export const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   // highlight-start
+     *   extractRehydrationInfo(action, { reducerPath }): any {
+     *     if (isHydrateAction(action)) {
+     *       return action.payload[reducerPath]
+     *     }
+     *   },
+     *   // highlight-end
+     *   endpoints: (build) => ({
+     *     // omitted
+     *   }),
+     * })
+     * ```
+     */
+    extractRehydrationInfo?: (action: UnknownAction, { reducerPath, }: {
+        reducerPath: ReducerPath;
+    }) => undefined | CombinedState<NoInfer<Definitions>, NoInfer<TagTypes>, NoInfer<ReducerPath>>;
+    /**
+     * A function that is called when a schema validation fails.
+     *
+     * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).
+     *
+     * `NamedSchemaError` has the following properties:
+     * - `issues`: an array of issues that caused the validation to fail
+     * - `value`: the value that was passed to the schema
+     * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *     }),
+     *   }),
+     *   onSchemaFailure: (error, info) => {
+     *     console.error(error, info)
+     *   },
+     * })
+     * ```
+     */
+    onSchemaFailure?: SchemaFailureHandler;
+    /**
+     * Convert a schema validation failure into an error shape matching base query errors.
+     *
+     * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       responseSchema: v.object({ id: v.number(), name: v.string() }),
+     *     }),
+     *   }),
+     *   catchSchemaFailure: (error, info) => ({
+     *     status: "CUSTOM_ERROR",
+     *     error: error.schemaName + " failed validation",
+     *     data: error.issues,
+     *   }),
+     * })
+     * ```
+     */
+    catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;
+    /**
+     * Defaults to `false`.
+     *
+     * If set to `true`, will skip schema validation for all endpoints, unless overridden by the endpoint.
+     *
+     * Can be overridden for specific schemas by passing an array of schema types to skip.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   skipSchemaValidation: process.env.NODE_ENV === "test" ? ["response"] : false, // skip schema validation for response in tests, since we'll be mocking the response
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       responseSchema: v.object({ id: v.number(), name: v.string() }),
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    skipSchemaValidation?: boolean | SchemaType[];
+}
+type CreateApi<Modules extends ModuleName> = {
+    /**
+     * Creates a service to use in your application. Contains only the basic redux logic (the core module).
+     *
+     * @link https://redux-toolkit.js.org/rtk-query/api/createApi
+     */
+    <BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string = 'api', TagTypes extends string = never>(options: CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>): Api<BaseQuery, Definitions, ReducerPath, TagTypes, Modules>;
+};
+/**
+ * Builds a `createApi` method based on the provided `modules`.
+ *
+ * @link https://redux-toolkit.js.org/rtk-query/usage/customizing-create-api
+ *
+ * @example
+ * ```ts
+ * const MyContext = React.createContext<ReactReduxContextValue | null>(null);
+ * const customCreateApi = buildCreateApi(
+ *   coreModule(),
+ *   reactHooksModule({
+ *     hooks: {
+ *       useDispatch: createDispatchHook(MyContext),
+ *       useSelector: createSelectorHook(MyContext),
+ *       useStore: createStoreHook(MyContext)
+ *     }
+ *   })
+ * );
+ * ```
+ *
+ * @param modules - A variable number of modules that customize how the `createApi` method handles endpoints
+ * @returns A `createApi` method using the provided `modules`.
+ */
+declare function buildCreateApi<Modules extends [Module<any>, ...Module<any>[]]>(...modules: Modules): CreateApi<Modules[number]['name']>;
+
+type BuildThunksApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>> = Matchers<QueryThunk, Definition>;
+type BuildThunksApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = Matchers<InfiniteQueryThunk<any>, Definition>;
+type BuildThunksApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>> = Matchers<MutationThunk, Definition>;
+type EndpointThunk<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = Definition extends EndpointDefinition<infer QueryArg, infer BaseQueryFn, any, infer ResultType> ? Thunk extends AsyncThunk<unknown, infer ATArg, infer ATConfig> ? AsyncThunk<ResultType, ATArg & {
+    originalArgs: QueryArg;
+}, ATConfig & {
+    rejectValue: BaseQueryError<BaseQueryFn>;
+}> : never : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQueryFn, any, infer ResultType> ? Thunk extends AsyncThunk<unknown, infer ATArg, infer ATConfig> ? AsyncThunk<InfiniteData<ResultType, PageParam>, ATArg & {
+    originalArgs: QueryArg;
+}, ATConfig & {
+    rejectValue: BaseQueryError<BaseQueryFn>;
+}> : never : never;
+type PendingAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['pending']>;
+type FulfilledAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['fulfilled']>;
+type RejectedAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['rejected']>;
+type Matcher<M> = (value: any) => value is M;
+interface Matchers<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> {
+    matchPending: Matcher<PendingAction<Thunk, Definition>>;
+    matchFulfilled: Matcher<FulfilledAction<Thunk, Definition>>;
+    matchRejected: Matcher<RejectedAction<Thunk, Definition>>;
+}
+type QueryThunkArg = QuerySubstateIdentifier & StartQueryActionCreatorOptions & {
+    type: 'query';
+    originalArgs: unknown;
+    endpointName: string;
+};
+type InfiniteQueryThunkArg<D extends InfiniteQueryDefinition<any, any, any, any, any>> = QuerySubstateIdentifier & StartInfiniteQueryActionCreatorOptions<D> & {
+    type: `query`;
+    originalArgs: unknown;
+    endpointName: string;
+    param: unknown;
+    direction?: InfiniteQueryDirection;
+    refetchCachedPages?: boolean;
+};
+type MutationThunkArg = {
+    type: 'mutation';
+    originalArgs: unknown;
+    endpointName: string;
+    track?: boolean;
+    fixedCacheKey?: string;
+};
+type ThunkResult = unknown;
+type ThunkApiMetaConfig = {
+    pendingMeta: {
+        startedTimeStamp: number;
+        [SHOULD_AUTOBATCH]: true;
+    };
+    fulfilledMeta: {
+        fulfilledTimeStamp: number;
+        baseQueryMeta: unknown;
+        [SHOULD_AUTOBATCH]: true;
+    };
+    rejectedMeta: {
+        baseQueryMeta: unknown;
+        [SHOULD_AUTOBATCH]: true;
+    };
+};
+type QueryThunk = AsyncThunk<ThunkResult, QueryThunkArg, ThunkApiMetaConfig>;
+type InfiniteQueryThunk<D extends InfiniteQueryDefinition<any, any, any, any, any>> = AsyncThunk<ThunkResult, InfiniteQueryThunkArg<D>, ThunkApiMetaConfig>;
+type MutationThunk = AsyncThunk<ThunkResult, MutationThunkArg, ThunkApiMetaConfig>;
+type MaybeDrafted<T> = T | Draft<T>;
+type Recipe<T> = (data: MaybeDrafted<T>) => void | MaybeDrafted<T>;
+type PatchQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFrom<Definitions[EndpointName]>, patches: readonly Patch[], updateProvided?: boolean) => ThunkAction<void, PartialState, any, UnknownAction>;
+type AllQueryKeys<Definitions extends EndpointDefinitions> = QueryKeys<Definitions> | InfiniteQueryKeys<Definitions>;
+type QueryArgFromAnyQueryDefinition<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryArgFrom<Definitions[EndpointName]> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? QueryArgFrom<Definitions[EndpointName]> : never;
+type DataFromAnyQueryDefinition<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteData<ResultTypeFrom<Definitions[EndpointName]>, PageParamFrom<Definitions[EndpointName]>> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? ResultTypeFrom<Definitions[EndpointName]> : unknown;
+type UpsertThunkResult<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryActionCreatorResult<Definitions[EndpointName]> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? QueryActionCreatorResult<Definitions[EndpointName]> : QueryActionCreatorResult<never>;
+type UpdateQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>, updateRecipe: Recipe<DataFromAnyQueryDefinition<Definitions, EndpointName>>, updateProvided?: boolean) => ThunkAction<PatchCollection, PartialState, any, UnknownAction>;
+type UpsertQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>, value: DataFromAnyQueryDefinition<Definitions, EndpointName>) => ThunkAction<UpsertThunkResult<Definitions, EndpointName>, PartialState, any, UnknownAction>;
+/**
+ * An object returned from dispatching a `api.util.updateQueryData` call.
+ */
+type PatchCollection = {
+    /**
+     * An `immer` Patch describing the cache update.
+     */
+    patches: Patch[];
+    /**
+     * An `immer` Patch to revert the cache update.
+     */
+    inversePatches: Patch[];
+    /**
+     * A function that will undo the cache update.
+     */
+    undo: () => void;
+};
+
+type SkipToken = typeof skipToken;
+/**
+ * Can be passed into `useQuery`, `useQueryState` or `useQuerySubscription`
+ * instead of the query argument to get the same effect as if setting
+ * `skip: true` in the query options.
+ *
+ * Useful for scenarios where a query should be skipped when `arg` is `undefined`
+ * and TypeScript complains about it because `arg` is not allowed to be passed
+ * in as `undefined`, such as
+ *
+ * ```ts
+ * // codeblock-meta title="will error if the query argument is not allowed to be undefined" no-transpile
+ * useSomeQuery(arg, { skip: !!arg })
+ * ```
+ *
+ * ```ts
+ * // codeblock-meta title="using skipToken instead" no-transpile
+ * useSomeQuery(arg ?? skipToken)
+ * ```
+ *
+ * If passed directly into a query or mutation selector, that selector will always
+ * return an uninitialized state.
+ */
+export declare const skipToken: unique symbol;
+type BuildSelectorsApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {
+    select: QueryResultSelectorFactory<Definition, RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;
+};
+type BuildSelectorsApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {
+    select: InfiniteQueryResultSelectorFactory<Definition, RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;
+};
+type BuildSelectorsApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {
+    select: MutationResultSelectorFactory<Definition, RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;
+};
+type QueryResultSelectorFactory<Definition extends QueryDefinition<any, any, any, any>, RootState> = (queryArg: QueryArgFrom<Definition> | SkipToken) => (state: RootState) => QueryResultSelectorResult<Definition>;
+type QueryResultSelectorResult<Definition extends QueryDefinition<any, any, any, any>> = QuerySubState<Definition> & RequestStatusFlags;
+type InfiniteQueryResultSelectorFactory<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, RootState> = (queryArg: InfiniteQueryArgFrom<Definition> | SkipToken) => (state: RootState) => InfiniteQueryResultSelectorResult<Definition>;
+type InfiniteQueryResultFlags = {
+    hasNextPage: boolean;
+    hasPreviousPage: boolean;
+    isFetchingNextPage: boolean;
+    isFetchingPreviousPage: boolean;
+    isFetchNextPageError: boolean;
+    isFetchPreviousPageError: boolean;
+};
+type InfiniteQueryResultSelectorResult<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = InfiniteQuerySubState<Definition> & RequestStatusFlags & InfiniteQueryResultFlags;
+type MutationResultSelectorFactory<Definition extends MutationDefinition<any, any, any, any>, RootState> = (requestId: string | {
+    requestId: string | undefined;
+    fixedCacheKey: string | undefined;
+} | SkipToken) => (state: RootState) => MutationResultSelectorResult<Definition>;
+type MutationResultSelectorResult<Definition extends MutationDefinition<any, any, any, any>> = MutationSubState<Definition> & RequestStatusFlags;
+
+type BuildInitiateApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>> = {
+    initiate: StartQueryActionCreator<Definition>;
+};
+type BuildInitiateApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = {
+    initiate: StartInfiniteQueryActionCreator<Definition>;
+};
+type BuildInitiateApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>> = {
+    initiate: StartMutationActionCreator<Definition>;
+};
+declare const forceQueryFnSymbol: unique symbol;
+type StartQueryActionCreatorOptions = {
+    subscribe?: boolean;
+    forceRefetch?: boolean | number;
+    subscriptionOptions?: SubscriptionOptions;
+    [forceQueryFnSymbol]?: () => QueryReturnValue;
+};
+type StartInfiniteQueryActionCreatorOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>> = StartQueryActionCreatorOptions & {
+    direction?: InfiniteQueryDirection;
+    param?: unknown;
+} & Partial<Pick<Partial<InfiniteQueryConfigOptions<ResultTypeFrom<D>, PageParamFrom<D>, InfiniteQueryArgFrom<D>>>, 'initialPageParam' | 'refetchCachedPages'>>;
+type StartQueryActionCreator<D extends QueryDefinition<any, any, any, any, any>> = (arg: QueryArgFrom<D>, options?: StartQueryActionCreatorOptions) => ThunkAction<QueryActionCreatorResult<D>, any, any, UnknownAction>;
+type StartInfiniteQueryActionCreator<D extends InfiniteQueryDefinition<any, any, any, any, any>> = (arg: InfiniteQueryArgFrom<D>, options?: StartInfiniteQueryActionCreatorOptions<D>) => ThunkAction<InfiniteQueryActionCreatorResult<D>, any, any, UnknownAction>;
+type QueryActionCreatorFields = {
+    requestId: string;
+    subscriptionOptions: SubscriptionOptions | undefined;
+    abort(): void;
+    unsubscribe(): void;
+    updateSubscriptionOptions(options: SubscriptionOptions): void;
+    queryCacheKey: string;
+};
+type QueryActionCreatorResult<D extends QueryDefinition<any, any, any, any>> = SafePromise<QueryResultSelectorResult<D>> & QueryActionCreatorFields & {
+    arg: QueryArgFrom<D>;
+    unwrap(): Promise<ResultTypeFrom<D>>;
+    refetch(): QueryActionCreatorResult<D>;
+};
+type InfiniteQueryActionCreatorResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = SafePromise<InfiniteQueryResultSelectorResult<D>> & QueryActionCreatorFields & {
+    arg: InfiniteQueryArgFrom<D>;
+    unwrap(): Promise<InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>>;
+    refetch(options?: Pick<StartInfiniteQueryActionCreatorOptions<D>, 'refetchCachedPages'>): InfiniteQueryActionCreatorResult<D>;
+};
+type StartMutationActionCreator<D extends MutationDefinition<any, any, any, any>> = (arg: QueryArgFrom<D>, options?: {
+    /**
+     * If this mutation should be tracked in the store.
+     * If you just want to manually trigger this mutation using `dispatch` and don't care about the
+     * result, state & potential errors being held in store, you can set this to false.
+     * (defaults to `true`)
+     */
+    track?: boolean;
+    fixedCacheKey?: string;
+}) => ThunkAction<MutationActionCreatorResult<D>, any, any, UnknownAction>;
+type MutationActionCreatorResult<D extends MutationDefinition<any, any, any, any>> = SafePromise<{
+    data: ResultTypeFrom<D>;
+    error?: undefined;
+} | {
+    data?: undefined;
+    error: Exclude<BaseQueryError<D extends MutationDefinition<any, infer BaseQuery, any, any> ? BaseQuery : never>, undefined> | SerializedError;
+}> & {
+    /** @internal */
+    arg: {
+        /**
+         * The name of the given endpoint for the mutation
+         */
+        endpointName: string;
+        /**
+         * The original arguments supplied to the mutation call
+         */
+        originalArgs: QueryArgFrom<D>;
+        /**
+         * Whether the mutation is being tracked in the store.
+         */
+        track?: boolean;
+        fixedCacheKey?: string;
+    };
+    /**
+     * A unique string generated for the request sequence
+     */
+    requestId: string;
+    /**
+     * A method to cancel the mutation promise. Note that this is not intended to prevent the mutation
+     * that was fired off from reaching the server, but only to assist in handling the response.
+     *
+     * Calling `abort()` prior to the promise resolving will force it to reach the error state with
+     * the serialized error:
+     * `{ name: 'AbortError', message: 'Aborted' }`
+     *
+     * @example
+     * ```ts
+     * const [updateUser] = useUpdateUserMutation();
+     *
+     * useEffect(() => {
+     *   const promise = updateUser(id);
+     *   promise
+     *     .unwrap()
+     *     .catch((err) => {
+     *       if (err.name === 'AbortError') return;
+     *       // else handle the unexpected error
+     *     })
+     *
+     *   return () => {
+     *     promise.abort();
+     *   }
+     * }, [id, updateUser])
+     * ```
+     */
+    abort(): void;
+    /**
+     * Unwraps a mutation call to provide the raw response/error.
+     *
+     * @remarks
+     * If you need to access the error or success payload immediately after a mutation, you can chain .unwrap().
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Using .unwrap"
+     * addPost({ id: 1, name: 'Example' })
+     *   .unwrap()
+     *   .then((payload) => console.log('fulfilled', payload))
+     *   .catch((error) => console.error('rejected', error));
+     * ```
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Using .unwrap with async await"
+     * try {
+     *   const payload = await addPost({ id: 1, name: 'Example' }).unwrap();
+     *   console.log('fulfilled', payload)
+     * } catch (error) {
+     *   console.error('rejected', error);
+     * }
+     * ```
+     */
+    unwrap(): Promise<ResultTypeFrom<D>>;
+    /**
+     * A method to manually unsubscribe from the mutation call, meaning it will be removed from cache after the usual caching grace period.
+     The value returned by the hook will reset to `isUninitialized` afterwards.
+     */
+    reset(): void;
+};
+
+type ReferenceCacheLifecycle = never;
+interface QueryBaseLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends LifecycleApi<ReducerPath> {
+    /**
+     * Gets the current value of this cache entry.
+     */
+    getCacheEntry(): QueryResultSelectorResult<{
+        type: DefinitionType.query;
+    } & BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, BaseQueryResult<BaseQuery>>>;
+    /**
+     * Updates the current cache entry value.
+     * For documentation see `api.util.updateQueryData`.
+     */
+    updateCachedData(updateRecipe: Recipe<ResultType>): PatchCollection;
+}
+type MutationBaseLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = LifecycleApi<ReducerPath> & {
+    /**
+     * Gets the current value of this cache entry.
+     */
+    getCacheEntry(): MutationResultSelectorResult<{
+        type: DefinitionType.mutation;
+    } & BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, BaseQueryResult<BaseQuery>>>;
+};
+type LifecycleApi<ReducerPath extends string = string> = {
+    /**
+     * The dispatch method for the store
+     */
+    dispatch: ThunkDispatch<any, any, UnknownAction>;
+    /**
+     * A method to get the current state
+     */
+    getState(): RootState<any, any, ReducerPath>;
+    /**
+     * `extra` as provided as `thunk.extraArgument` to the `configureStore` `getDefaultMiddleware` option.
+     */
+    extra: unknown;
+    /**
+     * A unique ID generated for the mutation
+     */
+    requestId: string;
+};
+type CacheLifecyclePromises<ResultType = unknown, MetaType = unknown> = {
+    /**
+     * Promise that will resolve with the first value for this cache key.
+     * This allows you to `await` until an actual value is in cache.
+     *
+     * If the cache entry is removed from the cache before any value has ever
+     * been resolved, this Promise will reject with
+     * `new Error('Promise never resolved before cacheEntryRemoved.')`
+     * to prevent memory leaks.
+     * You can just re-throw that error (or not handle it at all) -
+     * it will be caught outside of `cacheEntryAdded`.
+     *
+     * If you don't interact with this promise, it will not throw.
+     */
+    cacheDataLoaded: PromiseWithKnownReason<{
+        /**
+         * The (transformed) query result.
+         */
+        data: ResultType;
+        /**
+         * The `meta` returned by the `baseQuery`
+         */
+        meta: MetaType;
+    }, typeof neverResolvedError>;
+    /**
+     * Promise that allows you to wait for the point in time when the cache entry
+     * has been removed from the cache, by not being used/subscribed to any more
+     * in the application for too long or by dispatching `api.util.resetApiState`.
+     */
+    cacheEntryRemoved: Promise<void>;
+};
+interface QueryCacheLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>, CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>> {
+}
+type MutationCacheLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> & CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>>;
+type CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {
+    onCacheEntryAdded?(arg: QueryArg, api: QueryCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;
+};
+type CacheLifecycleInfiniteQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>;
+type CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {
+    onCacheEntryAdded?(arg: QueryArg, api: MutationCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;
+};
+declare const neverResolvedError: Error & {
+    message: "Promise never resolved before cacheEntryRemoved.";
+};
+
+type ReferenceQueryLifecycle = never;
+type QueryLifecyclePromises<ResultType, BaseQuery extends BaseQueryFn> = {
+    /**
+     * Promise that will resolve with the (transformed) query result.
+     *
+     * If the query fails, this promise will reject with the error.
+     *
+     * This allows you to `await` for the query to finish.
+     *
+     * If you don't interact with this promise, it will not throw.
+     */
+    queryFulfilled: PromiseWithKnownReason<{
+        /**
+         * The (transformed) query result.
+         */
+        data: ResultType;
+        /**
+         * The `meta` returned by the `baseQuery`
+         */
+        meta: BaseQueryMeta<BaseQuery>;
+    }, QueryFulfilledRejectionReason<BaseQuery>>;
+};
+type QueryFulfilledRejectionReason<BaseQuery extends BaseQueryFn> = {
+    error: BaseQueryError<BaseQuery>;
+    /**
+     * If this is `false`, that means this error was returned from the `baseQuery` or `queryFn` in a controlled manner.
+     */
+    isUnhandledError: false;
+    /**
+     * The `meta` returned by the `baseQuery`
+     */
+    meta: BaseQueryMeta<BaseQuery>;
+} | {
+    error: unknown;
+    meta?: undefined;
+    /**
+     * If this is `true`, that means that this error is the result of `baseQueryFn`, `queryFn`, `transformResponse` or `transformErrorResponse` throwing an error instead of handling it properly.
+     * There can not be made any assumption about the shape of `error`.
+     */
+    isUnhandledError: true;
+};
+type QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {
+    /**
+     * A function that is called when the individual query is started. The function is called with a lifecycle api object containing properties such as `queryFulfilled`, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. throughout the lifecycle of an individual query/mutation call).
+     *
+     * Can be used to perform side-effects throughout the lifecycle of the query.
+     *
+     * @example
+     * ```ts
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
+     * import { messageCreated } from './notificationsSlice
+     * export interface Post {
+     *   id: number
+     *   name: string
+     * }
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({
+     *     baseUrl: '/',
+     *   }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, number>({
+     *       query: (id) => `post/${id}`,
+     *       async onQueryStarted(id, { dispatch, queryFulfilled }) {
+     *         // `onStart` side-effect
+     *         dispatch(messageCreated('Fetching posts...'))
+     *         try {
+     *           const { data } = await queryFulfilled
+     *           // `onSuccess` side-effect
+     *           dispatch(messageCreated('Posts received!'))
+     *         } catch (err) {
+     *           // `onError` side-effect
+     *           dispatch(messageCreated('Error fetching posts!'))
+     *         }
+     *       }
+     *     }),
+     *   }),
+     * })
+     * ```
+     */
+    onQueryStarted?(queryArgument: QueryArg, queryLifeCycleApi: QueryLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;
+};
+type QueryLifecycleInfiniteQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>;
+type QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {
+    /**
+     * A function that is called when the individual mutation is started. The function is called with a lifecycle api object containing properties such as `queryFulfilled`, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. throughout the lifecycle of an individual query/mutation call).
+     *
+     * Can be used for `optimistic updates`.
+     *
+     * @example
+     *
+     * ```ts
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
+     * export interface Post {
+     *   id: number
+     *   name: string
+     * }
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({
+     *     baseUrl: '/',
+     *   }),
+     *   tagTypes: ['Post'],
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, number>({
+     *       query: (id) => `post/${id}`,
+     *       providesTags: ['Post'],
+     *     }),
+     *     updatePost: build.mutation<void, Pick<Post, 'id'> & Partial<Post>>({
+     *       query: ({ id, ...patch }) => ({
+     *         url: `post/${id}`,
+     *         method: 'PATCH',
+     *         body: patch,
+     *       }),
+     *       invalidatesTags: ['Post'],
+     *       async onQueryStarted({ id, ...patch }, { dispatch, queryFulfilled }) {
+     *         const patchResult = dispatch(
+     *           api.util.updateQueryData('getPost', id, (draft) => {
+     *             Object.assign(draft, patch)
+     *           })
+     *         )
+     *         try {
+     *           await queryFulfilled
+     *         } catch {
+     *           patchResult.undo()
+     *         }
+     *       },
+     *     }),
+     *   }),
+     * })
+     * ```
+     */
+    onQueryStarted?(queryArgument: QueryArg, mutationLifeCycleApi: MutationLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;
+};
+interface QueryLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>, QueryLifecyclePromises<ResultType, BaseQuery> {
+}
+type MutationLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> & QueryLifecyclePromises<ResultType, BaseQuery>;
+/**
+ * Provides a way to define a strongly-typed version of
+ * {@linkcode QueryLifecycleQueryExtraOptions.onQueryStarted | onQueryStarted}
+ * for a specific query.
+ *
+ * @example
+ * <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>
+ *
+ * ```ts
+ * import type { TypedQueryOnQueryStarted } from '@reduxjs/toolkit/query'
+ * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
+ *
+ * type Post = {
+ *   id: number
+ *   title: string
+ *   userId: number
+ * }
+ *
+ * type PostsApiResponse = {
+ *   posts: Post[]
+ *   total: number
+ *   skip: number
+ *   limit: number
+ * }
+ *
+ * type QueryArgument = number | undefined
+ *
+ * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>
+ *
+ * const baseApiSlice = createApi({
+ *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com' }),
+ *   reducerPath: 'postsApi',
+ *   tagTypes: ['Posts'],
+ *   endpoints: (build) => ({
+ *     getPosts: build.query<PostsApiResponse, void>({
+ *       query: () => `/posts`,
+ *     }),
+ *
+ *     getPostById: build.query<Post, QueryArgument>({
+ *       query: (postId) => `/posts/${postId}`,
+ *     }),
+ *   }),
+ * })
+ *
+ * const updatePostOnFulfilled: TypedQueryOnQueryStarted<
+ *   PostsApiResponse,
+ *   QueryArgument,
+ *   BaseQueryFunction,
+ *   'postsApi'
+ * > = async (queryArgument, { dispatch, queryFulfilled }) => {
+ *   const result = await queryFulfilled
+ *
+ *   const { posts } = result.data
+ *
+ *   // Pre-fill the individual post entries with the results
+ *   // from the list endpoint query
+ *   dispatch(
+ *     baseApiSlice.util.upsertQueryEntries(
+ *       posts.map((post) => ({
+ *         endpointName: 'getPostById',
+ *         arg: post.id,
+ *         value: post,
+ *       })),
+ *     ),
+ *   )
+ * }
+ *
+ * export const extendedApiSlice = baseApiSlice.injectEndpoints({
+ *   endpoints: (build) => ({
+ *     getPostsByUserId: build.query<PostsApiResponse, QueryArgument>({
+ *       query: (userId) => `/posts/user/${userId}`,
+ *
+ *       onQueryStarted: updatePostOnFulfilled,
+ *     }),
+ *   }),
+ * })
+ * ```
+ *
+ * @template ResultType - The type of the result `data` returned by the query.
+ * @template QueryArgumentType - The type of the argument passed into the query.
+ * @template BaseQueryFunctionType - The type of the base query function being used.
+ * @template ReducerPath - The type representing the `reducerPath` for the API slice.
+ *
+ * @since 2.4.0
+ * @public
+ */
+type TypedQueryOnQueryStarted<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleQueryExtraOptions<ResultType, QueryArgumentType, BaseQueryFunctionType, ReducerPath>['onQueryStarted'];
+/**
+ * Provides a way to define a strongly-typed version of
+ * {@linkcode QueryLifecycleMutationExtraOptions.onQueryStarted | onQueryStarted}
+ * for a specific mutation.
+ *
+ * @example
+ * <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>
+ *
+ * ```ts
+ * import type { TypedMutationOnQueryStarted } from '@reduxjs/toolkit/query'
+ * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
+ *
+ * type Post = {
+ *   id: number
+ *   title: string
+ *   userId: number
+ * }
+ *
+ * type PostsApiResponse = {
+ *   posts: Post[]
+ *   total: number
+ *   skip: number
+ *   limit: number
+ * }
+ *
+ * type QueryArgument = Pick<Post, 'id'> & Partial<Post>
+ *
+ * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>
+ *
+ * const baseApiSlice = createApi({
+ *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com' }),
+ *   reducerPath: 'postsApi',
+ *   tagTypes: ['Posts'],
+ *   endpoints: (build) => ({
+ *     getPosts: build.query<PostsApiResponse, void>({
+ *       query: () => `/posts`,
+ *     }),
+ *
+ *     getPostById: build.query<Post, number>({
+ *       query: (postId) => `/posts/${postId}`,
+ *     }),
+ *   }),
+ * })
+ *
+ * const updatePostOnFulfilled: TypedMutationOnQueryStarted<
+ *   Post,
+ *   QueryArgument,
+ *   BaseQueryFunction,
+ *   'postsApi'
+ * > = async ({ id, ...patch }, { dispatch, queryFulfilled }) => {
+ *   const patchCollection = dispatch(
+ *     baseApiSlice.util.updateQueryData('getPostById', id, (draftPost) => {
+ *       Object.assign(draftPost, patch)
+ *     }),
+ *   )
+ *
+ *   try {
+ *     await queryFulfilled
+ *   } catch {
+ *     patchCollection.undo()
+ *   }
+ * }
+ *
+ * export const extendedApiSlice = baseApiSlice.injectEndpoints({
+ *   endpoints: (build) => ({
+ *     addPost: build.mutation<Post, Omit<QueryArgument, 'id'>>({
+ *       query: (body) => ({
+ *         url: `posts/add`,
+ *         method: 'POST',
+ *         body,
+ *       }),
+ *
+ *       onQueryStarted: updatePostOnFulfilled,
+ *     }),
+ *
+ *     updatePost: build.mutation<Post, QueryArgument>({
+ *       query: ({ id, ...patch }) => ({
+ *         url: `post/${id}`,
+ *         method: 'PATCH',
+ *         body: patch,
+ *       }),
+ *
+ *       onQueryStarted: updatePostOnFulfilled,
+ *     }),
+ *   }),
+ * })
+ * ```
+ *
+ * @template ResultType - The type of the result `data` returned by the query.
+ * @template QueryArgumentType - The type of the argument passed into the query.
+ * @template BaseQueryFunctionType - The type of the base query function being used.
+ * @template ReducerPath - The type representing the `reducerPath` for the API slice.
+ *
+ * @since 2.4.0
+ * @public
+ */
+type TypedMutationOnQueryStarted<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleMutationExtraOptions<ResultType, QueryArgumentType, BaseQueryFunctionType, ReducerPath>['onQueryStarted'];
+
+/**
+ * A typesafe single entry to be upserted into the cache
+ */
+type NormalizedQueryUpsertEntry<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = {
+    endpointName: EndpointName;
+    arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>;
+    value: DataFromAnyQueryDefinition<Definitions, EndpointName>;
+};
+/**
+ * The internal version that is not typesafe since we can't carry the generics through `createSlice`
+ */
+type NormalizedQueryUpsertEntryPayload = {
+    endpointName: string;
+    arg: unknown;
+    value: unknown;
+};
+type ProcessedQueryUpsertEntry = {
+    queryDescription: QueryThunkArg;
+    value: unknown;
+};
+/**
+ * A typesafe representation of a util action creator that accepts cache entry descriptions to upsert
+ */
+type UpsertEntries<Definitions extends EndpointDefinitions> = (<EndpointNames extends Array<AllQueryKeys<Definitions>>>(entries: [
+    ...{
+        [I in keyof EndpointNames]: NormalizedQueryUpsertEntry<Definitions, EndpointNames[I]>;
+    }
+]) => PayloadAction<NormalizedQueryUpsertEntryPayload[]>) & {
+    match: (action: unknown) => action is PayloadAction<NormalizedQueryUpsertEntryPayload[]>;
+};
+declare function buildSlice({ reducerPath, queryThunk, mutationThunk, serializeQueryArgs, context: { endpointDefinitions: definitions, apiUid, extractRehydrationInfo, hasRehydrationInfo, }, assertTagType, config, }: {
+    reducerPath: string;
+    queryThunk: QueryThunk;
+    infiniteQueryThunk: InfiniteQueryThunk<any>;
+    mutationThunk: MutationThunk;
+    serializeQueryArgs: InternalSerializeQueryArgs;
+    context: ApiContext<EndpointDefinitions>;
+    assertTagType: AssertTagTypes;
+    config: Omit<ConfigState<string>, 'online' | 'focused' | 'middlewareRegistered'>;
+}): {
+    reducer: redux.Reducer<{
+        queries: QueryState<any>;
+        mutations: MutationState<any>;
+        provided: InvalidationState<string>;
+        subscriptions: SubscriptionState;
+        config: ConfigState<string>;
+    }, redux.UnknownAction, Partial<{
+        queries: QueryState<any> | undefined;
+        mutations: MutationState<any> | undefined;
+        provided: InvalidationState<string> | undefined;
+        subscriptions: SubscriptionState | undefined;
+        config: ConfigState<string> | undefined;
+    }>>;
+    actions: {
+        resetApiState: _reduxjs_toolkit.ActionCreatorWithoutPayload<`${string}/resetApiState`>;
+        updateProvidedBy: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[payload: {
+            queryCacheKey: QueryCacheKey;
+            providedTags: readonly FullTagDescription<string>[];
+        }[]], {
+            queryCacheKey: QueryCacheKey;
+            providedTags: readonly FullTagDescription<string>[];
+        }[], `${string}/invalidation/updateProvidedBy`, never, unknown>;
+        removeMutationResult: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[payload: MutationSubstateIdentifier], MutationSubstateIdentifier, `${string}/mutations/removeMutationResult`, never, unknown>;
+        subscriptionsUpdated: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[payload: Patch[]], Patch[], `${string}/internalSubscriptions/subscriptionsUpdated`, never, unknown>;
+        updateSubscriptionOptions: _reduxjs_toolkit.ActionCreatorWithPayload<{
+            endpointName: string;
+            requestId: string;
+            options: Subscribers[number];
+        } & QuerySubstateIdentifier, `${string}/subscriptions/updateSubscriptionOptions`>;
+        unsubscribeQueryResult: _reduxjs_toolkit.ActionCreatorWithPayload<{
+            requestId: string;
+        } & QuerySubstateIdentifier, `${string}/subscriptions/unsubscribeQueryResult`>;
+        internal_getRTKQSubscriptions: _reduxjs_toolkit.ActionCreatorWithoutPayload<`${string}/subscriptions/internal_getRTKQSubscriptions`>;
+        removeQueryResult: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[payload: QuerySubstateIdentifier], QuerySubstateIdentifier, `${string}/queries/removeQueryResult`, never, unknown>;
+        cacheEntriesUpserted: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[payload: NormalizedQueryUpsertEntryPayload[]], ProcessedQueryUpsertEntry[], `${string}/queries/cacheEntriesUpserted`, never, {
+            RTK_autoBatch: boolean;
+            requestId: string;
+            timestamp: number;
+        }>;
+        queryResultPatched: _reduxjs_toolkit.ActionCreatorWithPreparedPayload<[payload: QuerySubstateIdentifier & {
+            patches: readonly Patch[];
+        }], QuerySubstateIdentifier & {
+            patches: readonly Patch[];
+        }, `${string}/queries/queryResultPatched`, never, unknown>;
+        middlewareRegistered: _reduxjs_toolkit.ActionCreatorWithPayload<string, `${string}/config/middlewareRegistered`>;
+    };
+};
+type SliceActions = ReturnType<typeof buildSlice>['actions'];
+
+declare const onFocus: ActionCreatorWithoutPayload<"__rtkq/focused">;
+declare const onFocusLost: ActionCreatorWithoutPayload<"__rtkq/unfocused">;
+declare const onOnline: ActionCreatorWithoutPayload<"__rtkq/online">;
+declare const onOffline: ActionCreatorWithoutPayload<"__rtkq/offline">;
+/**
+ * A utility used to enable `refetchOnMount` and `refetchOnReconnect` behaviors.
+ * It requires the dispatch method from your store.
+ * Calling `setupListeners(store.dispatch)` will configure listeners with the recommended defaults,
+ * but you have the option of providing a callback for more granular control.
+ *
+ * @example
+ * ```ts
+ * setupListeners(store.dispatch)
+ * ```
+ *
+ * @param dispatch - The dispatch method from your store
+ * @param customHandler - An optional callback for more granular control over listener behavior
+ * @returns Return value of the handler.
+ * The default handler returns an `unsubscribe` method that can be called to remove the listeners.
+ */
+declare function setupListeners(dispatch: ThunkDispatch<any, any, any>, customHandler?: (dispatch: ThunkDispatch<any, any, any>, actions: {
+    onFocus: typeof onFocus;
+    onFocusLost: typeof onFocusLost;
+    onOnline: typeof onOnline;
+    onOffline: typeof onOffline;
+}) => () => void): () => void;
+
+/**
+ * Note: this file should import all other files for type discovery and declaration merging
+ */
+
+/**
+ * `ifOlderThan` - (default: `false` | `number`) - _number is value in seconds_
+ * - If specified, it will only run the query if the difference between `new Date()` and the last `fulfilledTimeStamp` is greater than the given value
+ *
+ * @overloadSummary
+ * `force`
+ * - If `force: true`, it will ignore the `ifOlderThan` value if it is set and the query will be run even if it exists in the cache.
+ */
+type PrefetchOptions = {
+    ifOlderThan?: false | number;
+} | {
+    force?: boolean;
+};
+export declare const coreModuleName: unique symbol;
+type CoreModule = typeof coreModuleName | ReferenceCacheLifecycle | ReferenceQueryLifecycle | ReferenceCacheCollection;
+type ThunkWithReturnValue<T> = ThunkAction<T, any, any, UnknownAction>;
+interface ApiModules<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string> {
+    [coreModuleName]: {
+        /**
+         * This api's reducer should be mounted at `store[api.reducerPath]`.
+         *
+         * @example
+         * ```ts
+         * configureStore({
+         *   reducer: {
+         *     [api.reducerPath]: api.reducer,
+         *   },
+         *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),
+         * })
+         * ```
+         */
+        reducerPath: ReducerPath;
+        /**
+         * Internal actions not part of the public API. Note: These are subject to change at any given time.
+         */
+        internalActions: InternalActions;
+        /**
+         *  A standard redux reducer that enables core functionality. Make sure it's included in your store.
+         *
+         * @example
+         * ```ts
+         * configureStore({
+         *   reducer: {
+         *     [api.reducerPath]: api.reducer,
+         *   },
+         *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),
+         * })
+         * ```
+         */
+        reducer: Reducer<CombinedState<Definitions, TagTypes, ReducerPath>, UnknownAction>;
+        /**
+         * This is a standard redux middleware and is responsible for things like polling, garbage collection and a handful of other things. Make sure it's included in your store.
+         *
+         * @example
+         * ```ts
+         * configureStore({
+         *   reducer: {
+         *     [api.reducerPath]: api.reducer,
+         *   },
+         *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),
+         * })
+         * ```
+         */
+        middleware: Middleware<{}, RootState<Definitions, string, ReducerPath>, ThunkDispatch<any, any, UnknownAction>>;
+        /**
+         * A collection of utility thunks for various situations.
+         */
+        util: {
+            /**
+             * A thunk that (if dispatched) will return a specific running query, identified
+             * by `endpointName` and `arg`.
+             * If that query is not running, dispatching the thunk will result in `undefined`.
+             *
+             * Can be used to await a specific query triggered in any way,
+             * including via hook calls or manually dispatching `initiate` actions.
+             *
+             * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.
+             */
+            getRunningQueryThunk<EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>): ThunkWithReturnValue<QueryActionCreatorResult<Definitions[EndpointName] & {
+                type: 'query';
+            }> | InfiniteQueryActionCreatorResult<Definitions[EndpointName] & {
+                type: 'infinitequery';
+            }> | undefined>;
+            /**
+             * A thunk that (if dispatched) will return a specific running mutation, identified
+             * by `endpointName` and `fixedCacheKey` or `requestId`.
+             * If that mutation is not running, dispatching the thunk will result in `undefined`.
+             *
+             * Can be used to await a specific mutation triggered in any way,
+             * including via hook trigger functions or manually dispatching `initiate` actions.
+             *
+             * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.
+             */
+            getRunningMutationThunk<EndpointName extends MutationKeys<Definitions>>(endpointName: EndpointName, fixedCacheKeyOrRequestId: string): ThunkWithReturnValue<MutationActionCreatorResult<Definitions[EndpointName] & {
+                type: 'mutation';
+            }> | undefined>;
+            /**
+             * A thunk that (if dispatched) will return all running queries.
+             *
+             * Useful for SSR scenarios to await all running queries triggered in any way,
+             * including via hook calls or manually dispatching `initiate` actions.
+             *
+             * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.
+             */
+            getRunningQueriesThunk(): ThunkWithReturnValue<Array<QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>>;
+            /**
+             * A thunk that (if dispatched) will return all running mutations.
+             *
+             * Useful for SSR scenarios to await all running mutations triggered in any way,
+             * including via hook calls or manually dispatching `initiate` actions.
+             *
+             * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.
+             */
+            getRunningMutationsThunk(): ThunkWithReturnValue<Array<MutationActionCreatorResult<any>>>;
+            /**
+             * A Redux thunk that can be used to manually trigger pre-fetching of data.
+             *
+             * The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a set of options used to determine if the data actually should be re-fetched based on cache staleness.
+             *
+             * React Hooks users will most likely never need to use this directly, as the `usePrefetch` hook will dispatch this thunk internally as needed when you call the prefetching function supplied by the hook.
+             *
+             * @example
+             *
+             * ```ts no-transpile
+             * dispatch(api.util.prefetch('getPosts', undefined, { force: true }))
+             * ```
+             */
+            prefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions): ThunkAction<void, any, any, UnknownAction>;
+            /**
+             * A Redux thunk action creator that, when dispatched, creates and applies a set of JSON diff/patch objects to the current state. This immediately updates the Redux state with those changes.
+             *
+             * The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and an `updateRecipe` callback function. The callback receives an Immer-wrapped `draft` of the current state, and may modify the draft to match the expected results after the mutation completes successfully.
+             *
+             * The thunk executes _synchronously_, and returns an object containing `{patches: Patch[], inversePatches: Patch[], undo: () => void}`. The `patches` and `inversePatches` are generated using Immer's [`produceWithPatches` method](https://immerjs.github.io/immer/patches).
+             *
+             * This is typically used as the first step in implementing optimistic updates. The generated `inversePatches` can be used to revert the updates by calling `dispatch(patchQueryData(endpointName, arg, inversePatches))`. Alternatively, the `undo` method can be called directly to achieve the same effect.
+             *
+             * Note that the first two arguments (`endpointName` and `arg`) are used to determine which existing cache entry to update. If no existing cache entry is found, the `updateRecipe` callback will not run.
+             *
+             * @example
+             *
+             * ```ts
+             * const patchCollection = dispatch(
+             *   api.util.updateQueryData('getPosts', undefined, (draftPosts) => {
+             *     draftPosts.push({ id: 1, name: 'Teddy' })
+             *   })
+             * )
+             * ```
+             */
+            updateQueryData: UpdateQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;
+            /**
+             * A Redux thunk action creator that, when dispatched, acts as an artificial API request to upsert a value into the cache.
+             *
+             * The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and the data to upsert.
+             *
+             * If no cache entry for that cache key exists, a cache entry will be created and the data added. If a cache entry already exists, this will _overwrite_ the existing cache entry data.
+             *
+             * The thunk executes _asynchronously_, and returns a promise that resolves when the store has been updated.
+             *
+             * If dispatched while an actual request is in progress, both the upsert and request will be handled as soon as they resolve, resulting in a "last result wins" update behavior.
+             *
+             * @example
+             *
+             * ```ts
+             * await dispatch(
+             *   api.util.upsertQueryData('getPost', {id: 1}, {id: 1, text: "Hello!"})
+             * )
+             * ```
+             */
+            upsertQueryData: UpsertQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;
+            /**
+             * A Redux thunk that applies a JSON diff/patch array to the cached data for a given query result. This immediately updates the Redux state with those changes.
+             *
+             * The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a JSON diff/patch array as produced by Immer's `produceWithPatches`.
+             *
+             * This is typically used as the second step in implementing optimistic updates. If a request fails, the optimistically-applied changes can be reverted by dispatching `patchQueryData` with the `inversePatches` that were generated by `updateQueryData` earlier.
+             *
+             * In cases where it is desired to simply revert the previous changes, it may be preferable to call the `undo` method returned from dispatching `updateQueryData` instead.
+             *
+             * @example
+             * ```ts
+             * const patchCollection = dispatch(
+             *   api.util.updateQueryData('getPosts', undefined, (draftPosts) => {
+             *     draftPosts.push({ id: 1, name: 'Teddy' })
+             *   })
+             * )
+             *
+             * // later
+             * dispatch(
+             *   api.util.patchQueryData('getPosts', undefined, patchCollection.inversePatches)
+             * )
+             *
+             * // or
+             * patchCollection.undo()
+             * ```
+             */
+            patchQueryData: PatchQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;
+            /**
+             * A Redux action creator that can be dispatched to manually reset the api state completely. This will immediately remove all existing cache entries, and all queries will be considered 'uninitialized'.
+             *
+             * @example
+             *
+             * ```ts
+             * dispatch(api.util.resetApiState())
+             * ```
+             */
+            resetApiState: SliceActions['resetApiState'];
+            upsertQueryEntries: UpsertEntries<Definitions>;
+            /**
+             * A Redux action creator that can be used to manually invalidate cache tags for [automated re-fetching](../../usage/automated-refetching.mdx).
+             *
+             * The action creator accepts one argument: the cache tags to be invalidated. It returns an action with those tags as a payload, and the corresponding `invalidateTags` action type for the api.
+             *
+             * Dispatching the result of this action creator will [invalidate](../../usage/automated-refetching.mdx#invalidating-cache-data) the given tags, causing queries to automatically re-fetch if they are subscribed to cache data that [provides](../../usage/automated-refetching.mdx#providing-cache-data) the corresponding tags.
+             *
+             * The array of tags provided to the action creator should be in one of the following formats, where `TagType` is equal to a string provided to the [`tagTypes`](../createApi.mdx#tagtypes) property of the api:
+             *
+             * - `[TagType]`
+             * - `[{ type: TagType }]`
+             * - `[{ type: TagType, id: number | string }]`
+             *
+             * @example
+             *
+             * ```ts
+             * dispatch(api.util.invalidateTags(['Post']))
+             * dispatch(api.util.invalidateTags([{ type: 'Post', id: 1 }]))
+             * dispatch(
+             *   api.util.invalidateTags([
+             *     { type: 'Post', id: 1 },
+             *     { type: 'Post', id: 'LIST' },
+             *   ])
+             * )
+             * ```
+             */
+            invalidateTags: ActionCreatorWithPayload<Array<TagDescription<TagTypes> | null | undefined>, string>;
+            /**
+             * A function to select all `{ endpointName, originalArgs, queryCacheKey }` combinations that would be invalidated by a specific set of tags.
+             *
+             * Can be used for mutations that want to do optimistic updates instead of invalidating a set of tags, but don't know exactly what they need to update.
+             */
+            selectInvalidatedBy: (state: RootState<Definitions, string, ReducerPath>, tags: ReadonlyArray<TagDescription<TagTypes> | null | undefined>) => Array<{
+                endpointName: string;
+                originalArgs: any;
+                queryCacheKey: string;
+            }>;
+            /**
+             * A function to select all arguments currently cached for a given endpoint.
+             *
+             * Can be used for mutations that want to do optimistic updates instead of invalidating a set of tags, but don't know exactly what they need to update.
+             */
+            selectCachedArgsForQuery: <QueryName extends AllQueryKeys<Definitions>>(state: RootState<Definitions, string, ReducerPath>, queryName: QueryName) => Array<QueryArgFromAnyQuery<Definitions[QueryName]>>;
+        };
+        /**
+         * Endpoints based on the input endpoints provided to `createApi`, containing `select` and `action matchers`.
+         */
+        endpoints: {
+            [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? ApiEndpointQuery<Definitions[K], Definitions> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? ApiEndpointMutation<Definitions[K], Definitions> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? ApiEndpointInfiniteQuery<Definitions[K], Definitions> : never;
+        };
+    };
+}
+interface ApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> extends BuildThunksApiEndpointQuery<Definition>, BuildInitiateApiEndpointQuery<Definition>, BuildSelectorsApiEndpointQuery<Definition, Definitions> {
+    name: string;
+    /**
+     * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
+     */
+    Types: NonNullable<Definition['Types']>;
+}
+interface ApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> extends BuildThunksApiEndpointInfiniteQuery<Definition>, BuildInitiateApiEndpointInfiniteQuery<Definition>, BuildSelectorsApiEndpointInfiniteQuery<Definition, Definitions> {
+    name: string;
+    /**
+     * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
+     */
+    Types: NonNullable<Definition['Types']>;
+}
+interface ApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> extends BuildThunksApiEndpointMutation<Definition>, BuildInitiateApiEndpointMutation<Definition>, BuildSelectorsApiEndpointMutation<Definition, Definitions> {
+    name: string;
+    /**
+     * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
+     */
+    Types: NonNullable<Definition['Types']>;
+}
+type ListenerActions = {
+    /**
+     * Will cause the RTK Query middleware to trigger any refetchOnReconnect-related behavior
+     * @link https://redux-toolkit.js.org/rtk-query/api/setupListeners
+     */
+    onOnline: typeof onOnline;
+    onOffline: typeof onOffline;
+    /**
+     * Will cause the RTK Query middleware to trigger any refetchOnFocus-related behavior
+     * @link https://redux-toolkit.js.org/rtk-query/api/setupListeners
+     */
+    onFocus: typeof onFocus;
+    onFocusLost: typeof onFocusLost;
+};
+type InternalActions = SliceActions & ListenerActions;
+interface CoreModuleOptions {
+    /**
+     * A selector creator (usually from `reselect`, or matching the same signature)
+     */
+    createSelector?: CreateSelectorFunction<any, any, any>;
+}
+/**
+ * Creates a module containing the basic redux logic for use with `buildCreateApi`.
+ *
+ * @example
+ * ```ts
+ * const createBaseApi = buildCreateApi(coreModule());
+ * ```
+ */
+declare const coreModule: ({ createSelector, }?: CoreModuleOptions) => Module<CoreModule>;
+
+declare const createApi: CreateApi<typeof coreModuleName>;
+
+type ModuleName = keyof ApiModules<any, any, any, any>;
+type Module<Name extends ModuleName> = {
+    name: Name;
+    init<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string>(api: Api<BaseQuery, EndpointDefinitions, ReducerPath, TagTypes, ModuleName>, options: WithRequiredProp<CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>, 'reducerPath' | 'serializeQueryArgs' | 'keepUnusedDataFor' | 'refetchOnMountOrArgChange' | 'refetchOnFocus' | 'refetchOnReconnect' | 'invalidationBehavior' | 'tagTypes'>, context: ApiContext<Definitions>): {
+        injectEndpoint(endpointName: string, definition: EndpointDefinition<any, any, any, any>): void;
+    };
+};
+interface ApiContext<Definitions extends EndpointDefinitions> {
+    apiUid: string;
+    endpointDefinitions: Definitions;
+    batch(cb: () => void): void;
+    extractRehydrationInfo: (action: UnknownAction) => CombinedState<any, any, any> | undefined;
+    hasRehydrationInfo: (action: UnknownAction) => boolean;
+}
+type Api<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string, Enhancers extends ModuleName = CoreModule> = UnionToIntersection<ApiModules<BaseQuery, Definitions, ReducerPath, TagTypes>[Enhancers]> & {
+    /**
+     * A function to inject the endpoints into the original API, but also give you that same API with correct types for these endpoints back. Useful with code-splitting.
+     */
+    injectEndpoints<NewDefinitions extends EndpointDefinitions>(_: {
+        endpoints: (build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>) => NewDefinitions;
+        /**
+         * Optionally allows endpoints to be overridden if defined by multiple `injectEndpoints` calls.
+         *
+         * If set to `true`, will override existing endpoints with the new definition.
+         * If set to `'throw'`, will throw an error if an endpoint is redefined with a different definition.
+         * If set to `false` (or unset), will not override existing endpoints with the new definition, and log a warning in development.
+         */
+        overrideExisting?: boolean | 'throw';
+    }): Api<BaseQuery, Definitions & NewDefinitions, ReducerPath, TagTypes, Enhancers>;
+    /**
+     *A function to enhance a generated API with additional information. Useful with code-generation.
+     */
+    enhanceEndpoints<NewTagTypes extends string = never, NewDefinitions extends EndpointDefinitions = never>(_: {
+        addTagTypes?: readonly NewTagTypes[];
+        endpoints?: UpdateDefinitions<Definitions, TagTypes | NoInfer<NewTagTypes>, NewDefinitions> extends infer NewDefinitions ? {
+            [K in keyof NewDefinitions]?: Partial<NewDefinitions[K]> | ((definition: NewDefinitions[K]) => void);
+        } : never;
+    }): Api<BaseQuery, UpdateDefinitions<Definitions, TagTypes | NewTagTypes, NewDefinitions>, ReducerPath, TagTypes | NewTagTypes, Enhancers>;
+};
+
+type PromiseWithKnownReason<T, R> = Omit<Promise<T>, 'then' | 'catch'> & {
+    /**
+     * Attaches callbacks for the resolution and/or rejection of the Promise.
+     * @param onfulfilled The callback to execute when the Promise is resolved.
+     * @param onrejected The callback to execute when the Promise is rejected.
+     * @returns A Promise for the completion of which ever callback is executed.
+     */
+    then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: R) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
+    /**
+     * Attaches a callback for only the rejection of the Promise.
+     * @param onrejected The callback to execute when the Promise is rejected.
+     * @returns A Promise for the completion of the callback.
+     */
+    catch<TResult = never>(onrejected?: ((reason: R) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
+};
+
+type ReferenceCacheCollection = never;
+/**
+ * @example
+ * ```ts
+ * // codeblock-meta title="keepUnusedDataFor example"
+ * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+ * interface Post {
+ *   id: number
+ *   name: string
+ * }
+ * type PostsResponse = Post[]
+ *
+ * const api = createApi({
+ *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+ *   endpoints: (build) => ({
+ *     getPosts: build.query<PostsResponse, void>({
+ *       query: () => 'posts',
+ *       // highlight-start
+ *       keepUnusedDataFor: 5
+ *       // highlight-end
+ *     })
+ *   })
+ * })
+ * ```
+ */
+type CacheCollectionQueryExtraOptions = {
+    /**
+     * Overrides the api-wide definition of `keepUnusedDataFor` for this endpoint only. _(This value is in seconds.)_
+     *
+     * This is how long RTK Query will keep your data cached for **after** the last component unsubscribes. For example, if you query an endpoint, then unmount the component, then mount another component that makes the same request within the given time frame, the most recent value will be served from the cache.
+     */
+    keepUnusedDataFor?: number;
+};
+
+export declare const _NEVER: unique symbol;
+type NEVER = typeof _NEVER;
+/**
+ * Creates a "fake" baseQuery to be used if your api *only* uses the `queryFn` definition syntax.
+ * This also allows you to specify a specific error type to be shared by all your `queryFn` definitions.
+ */
+declare function fakeBaseQuery<ErrorType>(): BaseQueryFn<void, NEVER, ErrorType, {}>;
+
+declare class NamedSchemaError extends SchemaError {
+    readonly value: any;
+    readonly schemaName: `${SchemaType}Schema`;
+    readonly _bqMeta: any;
+    constructor(issues: readonly StandardSchemaV1.Issue[], value: any, schemaName: `${SchemaType}Schema`, _bqMeta: any);
+}
+
+declare const rawResultType: unique symbol;
+declare const resultType: unique symbol;
+declare const baseQuery: unique symbol;
+interface SchemaFailureInfo {
+    endpoint: string;
+    arg: any;
+    type: 'query' | 'mutation';
+    queryCacheKey?: string;
+}
+type SchemaFailureHandler = (error: NamedSchemaError, info: SchemaFailureInfo) => void;
+type SchemaFailureConverter<BaseQuery extends BaseQueryFn> = (error: NamedSchemaError, info: SchemaFailureInfo) => BaseQueryError<BaseQuery>;
+type EndpointDefinitionWithQuery<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery>> = {
+    /**
+     * `query` can be a function that returns either a `string` or an `object` which is passed to your `baseQuery`. If you are using [fetchBaseQuery](./fetchBaseQuery), this can return either a `string` or an `object` of properties in `FetchArgs`. If you use your own custom [`baseQuery`](../../rtk-query/usage/customizing-queries), you can customize this behavior to your liking.
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="query example"
+     *
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     * type PostsResponse = Post[]
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   tagTypes: ['Post'],
+     *   endpoints: (build) => ({
+     *     getPosts: build.query<PostsResponse, void>({
+     *       // highlight-start
+     *       query: () => 'posts',
+     *       // highlight-end
+     *     }),
+     *     addPost: build.mutation<Post, Partial<Post>>({
+     *      // highlight-start
+     *      query: (body) => ({
+     *        url: `posts`,
+     *        method: 'POST',
+     *        body,
+     *      }),
+     *      // highlight-end
+     *      invalidatesTags: [{ type: 'Post', id: 'LIST' }],
+     *    }),
+     *   })
+     * })
+     * ```
+     */
+    query(arg: QueryArg): BaseQueryArg<BaseQuery>;
+    queryFn?: never;
+    /**
+     * A function to manipulate the data returned by a query or mutation.
+     */
+    transformResponse?(baseQueryReturnValue: RawResultType, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): ResultType | Promise<ResultType>;
+    /**
+     * A function to manipulate the data returned by a failed query or mutation.
+     */
+    transformErrorResponse?(baseQueryReturnValue: BaseQueryError<BaseQuery>, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): unknown;
+    /**
+     * A schema for the result *before* it's passed to `transformResponse`.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const postSchema = v.object({ id: v.number(), name: v.string() })
+     * type Post = v.InferOutput<typeof postSchema>
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPostName: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       rawResponseSchema: postSchema,
+     *       transformResponse: (post) => post.name,
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    rawResponseSchema?: StandardSchemaV1<RawResultType>;
+    /**
+     * A schema for the error object returned by the `query` or `queryFn`, *before* it's passed to `transformErrorResponse`.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     * import {customBaseQuery, baseQueryErrorSchema} from "./customBaseQuery"
+     *
+     * const api = createApi({
+     *   baseQuery: customBaseQuery,
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       rawErrorResponseSchema: baseQueryErrorSchema,
+     *       transformErrorResponse: (error) => error.data,
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    rawErrorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;
+};
+type EndpointDefinitionWithQueryFn<QueryArg, BaseQuery extends BaseQueryFn, ResultType> = {
+    /**
+     * Can be used in place of `query` as an inline function that bypasses `baseQuery` completely for the endpoint.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Basic queryFn example"
+     *
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     * type PostsResponse = Post[]
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPosts: build.query<PostsResponse, void>({
+     *       query: () => 'posts',
+     *     }),
+     *     flipCoin: build.query<'heads' | 'tails', void>({
+     *       // highlight-start
+     *       queryFn(arg, queryApi, extraOptions, baseQuery) {
+     *         const randomVal = Math.random()
+     *         if (randomVal < 0.45) {
+     *           return { data: 'heads' }
+     *         }
+     *         if (randomVal < 0.9) {
+     *           return { data: 'tails' }
+     *         }
+     *         return { error: { status: 500, statusText: 'Internal Server Error', data: "Coin landed on its edge!" } }
+     *       }
+     *       // highlight-end
+     *     })
+     *   })
+     * })
+     * ```
+     */
+    queryFn(arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions<BaseQuery>, baseQuery: (arg: Parameters<BaseQuery>[0]) => ReturnType<BaseQuery>): MaybePromise<QueryReturnValue<ResultType, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>>;
+    query?: never;
+    transformResponse?: never;
+    transformErrorResponse?: never;
+    rawResponseSchema?: never;
+    rawErrorResponseSchema?: never;
+};
+type BaseEndpointTypes<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType> = {
+    QueryArg: QueryArg;
+    BaseQuery: BaseQuery;
+    ResultType: ResultType;
+    RawResultType: RawResultType;
+};
+type SchemaType = 'arg' | 'rawResponse' | 'response' | 'rawErrorResponse' | 'errorResponse' | 'meta';
+interface CommonEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType> {
+    /**
+     * A schema for the arguments to be passed to the `query` or `queryFn`.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       argSchema: v.object({ id: v.number() }),
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    argSchema?: StandardSchemaV1<QueryArg>;
+    /**
+     * A schema for the result (including `transformResponse` if provided).
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const postSchema = v.object({ id: v.number(), name: v.string() })
+     * type Post = v.InferOutput<typeof postSchema>
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       responseSchema: postSchema,
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    responseSchema?: StandardSchemaV1<ResultType>;
+    /**
+     * A schema for the error object returned by the `query` or `queryFn` (including `transformErrorResponse` if provided).
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     * import { customBaseQuery, baseQueryErrorSchema } from "./customBaseQuery"
+     *
+     * const api = createApi({
+     *   baseQuery: customBaseQuery,
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       errorResponseSchema: baseQueryErrorSchema,
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    errorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;
+    /**
+     * A schema for the `meta` property returned by the `query` or `queryFn`.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     * import { customBaseQuery, baseQueryMetaSchema } from "./customBaseQuery"
+     *
+     * const api = createApi({
+     *   baseQuery: customBaseQuery,
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       metaSchema: baseQueryMetaSchema,
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    metaSchema?: StandardSchemaV1<BaseQueryMeta<BaseQuery>>;
+    /**
+     * Defaults to `true`.
+     *
+     * Most apps should leave this setting on. The only time it can be a performance issue
+     * is if an API returns extremely large amounts of data (e.g. 10,000 rows per request) and
+     * you're unable to paginate it.
+     *
+     * For details of how this works, please see the below. When it is set to `false`,
+     * every request will cause subscribed components to rerender, even when the data has not changed.
+     *
+     * @see https://redux-toolkit.js.org/api/other-exports#copywithstructuralsharing
+     */
+    structuralSharing?: boolean;
+    /**
+     * A function that is called when a schema validation fails.
+     *
+     * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).
+     *
+     * `NamedSchemaError` has the following properties:
+     * - `issues`: an array of issues that caused the validation to fail
+     * - `value`: the value that was passed to the schema
+     * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       onSchemaFailure: (error, info) => {
+     *         console.error(error, info)
+     *       },
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    onSchemaFailure?: SchemaFailureHandler;
+    /**
+     * Convert a schema validation failure into an error shape matching base query errors.
+     *
+     * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       responseSchema: v.object({ id: v.number(), name: v.string() }),
+     *       catchSchemaFailure: (error, info) => ({
+     *         status: "CUSTOM_ERROR",
+     *         error: error.schemaName + " failed validation",
+     *         data: error.issues,
+     *       }),
+     *     }),
+     *   }),
+     * })
+     * ```
+     */
+    catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;
+    /**
+     * Defaults to `false`.
+     *
+     * If set to `true`, will skip schema validation for this endpoint.
+     * Overrides the global setting.
+     *
+     * Can be overridden for specific schemas by passing an array of schema types to skip.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta no-transpile
+     * import { createApi } from '@reduxjs/toolkit/query/react'
+     * import * as v from "valibot"
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   endpoints: (build) => ({
+     *     getPost: build.query<Post, { id: number }>({
+     *       query: ({ id }) => `/post/${id}`,
+     *       responseSchema: v.object({ id: v.number(), name: v.string() }),
+     *       skipSchemaValidation: process.env.NODE_ENV === "test" ? ["response"] : false, // skip schema validation for response in tests, since we'll be mocking the response
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    skipSchemaValidation?: boolean | SchemaType[];
+}
+type BaseEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = (([CastAny<BaseQueryResult<BaseQuery>, {}>] extends [NEVER] ? never : EndpointDefinitionWithQuery<QueryArg, BaseQuery, ResultType, RawResultType>) | EndpointDefinitionWithQueryFn<QueryArg, BaseQuery, ResultType>) & CommonEndpointDefinition<QueryArg, BaseQuery, ResultType> & {
+    [rawResultType]?: RawResultType;
+    [resultType]?: ResultType;
+    [baseQuery]?: BaseQuery;
+} & HasRequiredProps<BaseQueryExtraOptions<BaseQuery>, {
+    extraOptions: BaseQueryExtraOptions<BaseQuery>;
+}, {
+    extraOptions?: BaseQueryExtraOptions<BaseQuery>;
+}>;
+declare enum DefinitionType {
+    query = "query",
+    mutation = "mutation",
+    infinitequery = "infinitequery"
+}
+type TagDescriptionArray<TagTypes extends string> = ReadonlyArray<TagDescription<TagTypes> | undefined | null>;
+type GetResultDescriptionFn<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = (result: ResultType | undefined, error: ErrorType | undefined, arg: QueryArg, meta: MetaType) => TagDescriptionArray<TagTypes>;
+type FullTagDescription<TagType> = {
+    type: TagType;
+    id?: number | string;
+};
+type TagDescription<TagType> = TagType | FullTagDescription<TagType>;
+/**
+ * @public
+ */
+type ResultDescription<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = TagDescriptionArray<TagTypes> | GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>;
+type QueryTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {
+    /**
+     * The endpoint definition type. To be used with some internal generic types.
+     * @example
+     * ```ts
+     * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...
+     * ```
+     */
+    QueryDefinition: QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;
+    TagTypes: TagTypes;
+    ReducerPath: ReducerPath;
+};
+/**
+ * @public
+ */
+interface QueryExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {
+    type: DefinitionType.query;
+    /**
+     * Used by `query` endpoints. Determines which 'tag' is attached to the cached data returned by the query.
+     * Expects an array of tag type strings, an array of objects of tag types with ids, or a function that returns such an array.
+     * 1.  `['Post']` - equivalent to `2`
+     * 2.  `[{ type: 'Post' }]` - equivalent to `1`
+     * 3.  `[{ type: 'Post', id: 1 }]`
+     * 4.  `(result, error, arg) => ['Post']` - equivalent to `5`
+     * 5.  `(result, error, arg) => [{ type: 'Post' }]` - equivalent to `4`
+     * 6.  `(result, error, arg) => [{ type: 'Post', id: 1 }]`
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="providesTags example"
+     *
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     * type PostsResponse = Post[]
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   tagTypes: ['Posts'],
+     *   endpoints: (build) => ({
+     *     getPosts: build.query<PostsResponse, void>({
+     *       query: () => 'posts',
+     *       // highlight-start
+     *       providesTags: (result) =>
+     *         result
+     *           ? [
+     *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),
+     *               { type: 'Posts', id: 'LIST' },
+     *             ]
+     *           : [{ type: 'Posts', id: 'LIST' }],
+     *       // highlight-end
+     *     })
+     *   })
+     * })
+     * ```
+     */
+    providesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;
+    /**
+     * Not to be used. A query should not invalidate tags in the cache.
+     */
+    invalidatesTags?: never;
+    /**
+     * Can be provided to return a custom cache key value based on the query arguments.
+     *
+     * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.
+     *
+     * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.
+     *
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="serializeQueryArgs : exclude value"
+     *
+     * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     *
+     * interface MyApiClient {
+     *   fetchPost: (id: string) => Promise<Post>
+     * }
+     *
+     * createApi({
+     *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *  endpoints: (build) => ({
+     *    // Example: an endpoint with an API client passed in as an argument,
+     *    // but only the item ID should be used as the cache key
+     *    getPost: build.query<Post, { id: string; client: MyApiClient }>({
+     *      queryFn: async ({ id, client }) => {
+     *        const post = await client.fetchPost(id)
+     *        return { data: post }
+     *      },
+     *      // highlight-start
+     *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {
+     *        const { id } = queryArgs
+     *        // This can return a string, an object, a number, or a boolean.
+     *        // If it returns an object, number or boolean, that value
+     *        // will be serialized automatically via `defaultSerializeQueryArgs`
+     *        return { id } // omit `client` from the cache key
+     *
+     *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:
+     *        // return defaultSerializeQueryArgs({
+     *        //   endpointName,
+     *        //   queryArgs: { id },
+     *        //   endpointDefinition
+     *        // })
+     *        // Or  create and return a string yourself:
+     *        // return `getPost(${id})`
+     *      },
+     *      // highlight-end
+     *    }),
+     *  }),
+     *})
+     * ```
+     */
+    serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;
+    /**
+     * Can be provided to merge an incoming response value into the current cache data.
+     * If supplied, no automatic structural sharing will be applied - it's up to
+     * you to update the cache appropriately.
+     *
+     * Since RTKQ normally replaces cache entries with the new response, you will usually
+     * need to use this with the `serializeQueryArgs` or `forceRefetch` options to keep
+     * an existing cache entry so that it can be updated.
+     *
+     * Since this is wrapped with Immer, you may either mutate the `currentCacheValue` directly,
+     * or return a new value, but _not_ both at once.
+     *
+     * Will only be called if the existing `currentCacheData` is _not_ `undefined` - on first response,
+     * the cache entry will just save the response data directly.
+     *
+     * Useful if you don't want a new request to completely override the current cache value,
+     * maybe because you have manually updated it from another source and don't want those
+     * updates to get lost.
+     *
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="merge: pagination"
+     *
+     * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     *
+     * createApi({
+     *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *  endpoints: (build) => ({
+     *    listItems: build.query<string[], number>({
+     *      query: (pageNumber) => `/listItems?page=${pageNumber}`,
+     *     // Only have one cache entry because the arg always maps to one string
+     *     serializeQueryArgs: ({ endpointName }) => {
+     *       return endpointName
+     *      },
+     *      // Always merge incoming data to the cache entry
+     *      merge: (currentCache, newItems) => {
+     *        currentCache.push(...newItems)
+     *      },
+     *      // Refetch when the page arg changes
+     *      forceRefetch({ currentArg, previousArg }) {
+     *        return currentArg !== previousArg
+     *      },
+     *    }),
+     *  }),
+     *})
+     * ```
+     */
+    merge?(currentCacheData: ResultType, responseData: ResultType, otherArgs: {
+        arg: QueryArg;
+        baseQueryMeta: BaseQueryMeta<BaseQuery>;
+        requestId: string;
+        fulfilledTimeStamp: number;
+    }): ResultType | void;
+    /**
+     * Check to see if the endpoint should force a refetch in cases where it normally wouldn't.
+     * This is primarily useful for "infinite scroll" / pagination use cases where
+     * RTKQ is keeping a single cache entry that is added to over time, in combination
+     * with `serializeQueryArgs` returning a fixed cache key and a `merge` callback
+     * set to add incoming data to the cache entry each time.
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="forceRefresh: pagination"
+     *
+     * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     *
+     * createApi({
+     *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *  endpoints: (build) => ({
+     *    listItems: build.query<string[], number>({
+     *      query: (pageNumber) => `/listItems?page=${pageNumber}`,
+     *     // Only have one cache entry because the arg always maps to one string
+     *     serializeQueryArgs: ({ endpointName }) => {
+     *       return endpointName
+     *      },
+     *      // Always merge incoming data to the cache entry
+     *      merge: (currentCache, newItems) => {
+     *        currentCache.push(...newItems)
+     *      },
+     *      // Refetch when the page arg changes
+     *      forceRefetch({ currentArg, previousArg }) {
+     *        return currentArg !== previousArg
+     *      },
+     *    }),
+     *  }),
+     *})
+     * ```
+     */
+    forceRefetch?(params: {
+        currentArg: QueryArg | undefined;
+        previousArg: QueryArg | undefined;
+        state: RootState<any, any, string>;
+        endpointState?: QuerySubState<any>;
+    }): boolean;
+    /**
+     * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
+     */
+    Types?: QueryTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;
+}
+type QueryDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & QueryExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;
+type InfiniteQueryTypes<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {
+    /**
+     * The endpoint definition type. To be used with some internal generic types.
+     * @example
+     * ```ts
+     * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...
+     * ```
+     */
+    InfiniteQueryDefinition: InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath>;
+    TagTypes: TagTypes;
+    ReducerPath: ReducerPath;
+};
+interface InfiniteQueryExtraOptions<TagTypes extends string, ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {
+    type: DefinitionType.infinitequery;
+    providesTags?: ResultDescription<TagTypes, InfiniteData<ResultType, PageParam>, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;
+    /**
+     * Not to be used. A query should not invalidate tags in the cache.
+     */
+    invalidatesTags?: never;
+    /**
+     * Required options to configure the infinite query behavior.
+     * `initialPageParam` and `getNextPageParam` are required, to
+     * ensure the infinite query can properly fetch the next page of data.
+     * `initialPageParam` may be specified when using the
+     * endpoint, to override the default value.
+     * `maxPages` and `getPreviousPageParam` are both optional.
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="infiniteQueryOptions example"
+     * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'
+     *
+     * type Pokemon = {
+     *   id: string
+     *   name: string
+     * }
+     *
+     * const pokemonApi = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),
+     *   endpoints: (build) => ({
+     *     getInfinitePokemonWithMax: build.infiniteQuery<Pokemon[], string, number>({
+     *       infiniteQueryOptions: {
+     *         initialPageParam: 0,
+     *         maxPages: 3,
+     *         getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) =>
+     *           lastPageParam + 1,
+     *         getPreviousPageParam: (
+     *           firstPage,
+     *           allPages,
+     *           firstPageParam,
+     *           allPageParams,
+     *         ) => {
+     *           return firstPageParam > 0 ? firstPageParam - 1 : undefined
+     *         },
+     *       },
+     *       query({pageParam}) {
+     *         return `https://example.com/listItems?page=${pageParam}`
+     *       },
+     *     }),
+     *   }),
+     * })
+     
+     * ```
+     */
+    infiniteQueryOptions: InfiniteQueryConfigOptions<ResultType, PageParam, QueryArg>;
+    /**
+     * Can be provided to return a custom cache key value based on the query arguments.
+     *
+     * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.
+     *
+     * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.
+     *
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="serializeQueryArgs : exclude value"
+     *
+     * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     *
+     * interface MyApiClient {
+     *   fetchPost: (id: string) => Promise<Post>
+     * }
+     *
+     * createApi({
+     *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *  endpoints: (build) => ({
+     *    // Example: an endpoint with an API client passed in as an argument,
+     *    // but only the item ID should be used as the cache key
+     *    getPost: build.query<Post, { id: string; client: MyApiClient }>({
+     *      queryFn: async ({ id, client }) => {
+     *        const post = await client.fetchPost(id)
+     *        return { data: post }
+     *      },
+     *      // highlight-start
+     *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {
+     *        const { id } = queryArgs
+     *        // This can return a string, an object, a number, or a boolean.
+     *        // If it returns an object, number or boolean, that value
+     *        // will be serialized automatically via `defaultSerializeQueryArgs`
+     *        return { id } // omit `client` from the cache key
+     *
+     *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:
+     *        // return defaultSerializeQueryArgs({
+     *        //   endpointName,
+     *        //   queryArgs: { id },
+     *        //   endpointDefinition
+     *        // })
+     *        // Or  create and return a string yourself:
+     *        // return `getPost(${id})`
+     *      },
+     *      // highlight-end
+     *    }),
+     *  }),
+     *})
+     * ```
+     */
+    serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;
+    /**
+     * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
+     */
+    Types?: InfiniteQueryTypes<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;
+}
+type InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<InfiniteQueryCombinedArg<QueryArg, PageParam>, BaseQuery, ResultType, RawResultType> & InfiniteQueryExtraOptions<TagTypes, ResultType, QueryArg, PageParam, BaseQuery, ReducerPath, RawResultType>;
+type MutationTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {
+    /**
+     * The endpoint definition type. To be used with some internal generic types.
+     * @example
+     * ```ts
+     * const useMyWrappedHook: UseMutation<typeof api.endpoints.query.Types.MutationDefinition> = ...
+     * ```
+     */
+    MutationDefinition: MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;
+    TagTypes: TagTypes;
+    ReducerPath: ReducerPath;
+};
+/**
+ * @public
+ */
+interface MutationExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath> {
+    type: DefinitionType.mutation;
+    /**
+     * Used by `mutation` endpoints. Determines which cached data should be either re-fetched or removed from the cache.
+     * Expects the same shapes as `providesTags`.
+     *
+     * @example
+     *
+     * ```ts
+     * // codeblock-meta title="invalidatesTags example"
+     * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+     * interface Post {
+     *   id: number
+     *   name: string
+     * }
+     * type PostsResponse = Post[]
+     *
+     * const api = createApi({
+     *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+     *   tagTypes: ['Posts'],
+     *   endpoints: (build) => ({
+     *     getPosts: build.query<PostsResponse, void>({
+     *       query: () => 'posts',
+     *       providesTags: (result) =>
+     *         result
+     *           ? [
+     *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),
+     *               { type: 'Posts', id: 'LIST' },
+     *             ]
+     *           : [{ type: 'Posts', id: 'LIST' }],
+     *     }),
+     *     addPost: build.mutation<Post, Partial<Post>>({
+     *       query(body) {
+     *         return {
+     *           url: `posts`,
+     *           method: 'POST',
+     *           body,
+     *         }
+     *       },
+     *       // highlight-start
+     *       invalidatesTags: [{ type: 'Posts', id: 'LIST' }],
+     *       // highlight-end
+     *     }),
+     *   })
+     * })
+     * ```
+     */
+    invalidatesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;
+    /**
+     * Not to be used. A mutation should not provide tags to the cache.
+     */
+    providesTags?: never;
+    /**
+     * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
+     */
+    Types?: MutationTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;
+}
+type MutationDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & MutationExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;
+type EndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, PageParam = any, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;
+type EndpointDefinitions = Record<string, EndpointDefinition<any, any, any, any, any, any, any>>;
+type EndpointBuilder<BaseQuery extends BaseQueryFn, TagTypes extends string, ReducerPath extends string> = {
+    /**
+     * An endpoint definition that retrieves data, and may provide tags to the cache.
+     *
+     * @example
+     * ```js
+     * // codeblock-meta title="Example of all query endpoint options"
+     * const api = createApi({
+     *  baseQuery,
+     *  endpoints: (build) => ({
+     *    getPost: build.query({
+     *      query: (id) => ({ url: `post/${id}` }),
+     *      // Pick out data and prevent nested properties in a hook or selector
+     *      transformResponse: (response) => response.data,
+     *      // Pick out error and prevent nested properties in a hook or selector
+     *      transformErrorResponse: (response) => response.error,
+     *      // `result` is the server response
+     *      providesTags: (result, error, id) => [{ type: 'Post', id }],
+     *      // trigger side effects or optimistic updates
+     *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry, updateCachedData }) {},
+     *      // handle subscriptions etc
+     *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry, updateCachedData }) {},
+     *    }),
+     *  }),
+     *});
+     *```
+     */
+    query<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;
+    /**
+     * An endpoint definition that alters data on the server or will possibly invalidate the cache.
+     *
+     * @example
+     * ```js
+     * // codeblock-meta title="Example of all mutation endpoint options"
+     * const api = createApi({
+     *   baseQuery,
+     *   endpoints: (build) => ({
+     *     updatePost: build.mutation({
+     *       query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),
+     *       // Pick out data and prevent nested properties in a hook or selector
+     *       transformResponse: (response) => response.data,
+     *       // Pick out error and prevent nested properties in a hook or selector
+     *       transformErrorResponse: (response) => response.error,
+     *       // `result` is the server response
+     *       invalidatesTags: (result, error, id) => [{ type: 'Post', id }],
+     *      // trigger side effects or optimistic updates
+     *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry }) {},
+     *      // handle subscriptions etc
+     *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry }) {},
+     *     }),
+     *   }),
+     * });
+     * ```
+     */
+    mutation<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;
+    infiniteQuery<ResultType, QueryArg, PageParam, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;
+};
+type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T;
+type QueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<infer QA, any, any, any> ? QA : never;
+type InfiniteQueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<infer QA, any, any, any, any, any, any> ? QA : never;
+type QueryArgFromAnyQuery<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any, any, any> ? InfiniteQueryArgFrom<D> : D extends QueryDefinition<any, any, any, any, any, any> ? QueryArgFrom<D> : never;
+type ResultTypeFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<any, any, infer RT, any> ? RT : unknown;
+type ReducerPathFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, any, any, infer RP, any, any> ? RP : unknown;
+type TagTypesFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, infer TT, any, any, any, any> ? TT : unknown;
+type PageParamFrom<D extends InfiniteQueryDefinition<any, any, any, any, any, any, any>> = D extends InfiniteQueryDefinition<any, infer PP, any, any, any, any, any> ? PP : unknown;
+type InfiniteQueryCombinedArg<QueryArg, PageParam> = {
+    queryArg: QueryArg;
+    pageParam: PageParam;
+};
+type TagTypesFromApi<T> = T extends Api<any, any, any, infer TagTypes> ? TagTypes : never;
+type DefinitionsFromApi<T> = T extends Api<any, infer Definitions, any, any> ? Definitions : never;
+type TransformedResponse<NewDefinitions extends EndpointDefinitions, K, ResultType> = K extends keyof NewDefinitions ? NewDefinitions[K]['transformResponse'] extends undefined ? ResultType : UnwrapPromise<ReturnType<NonUndefined<NewDefinitions[K]['transformResponse']>>> : ResultType;
+type OverrideResultType<Definition, NewResultType> = Definition extends QueryDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends MutationDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, NewResultType, ReducerPath> : never;
+type UpdateDefinitions<Definitions extends EndpointDefinitions, NewTagTypes extends string, NewDefinitions extends EndpointDefinitions> = {
+    [K in keyof Definitions]: Definitions[K] extends QueryDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends MutationDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : never;
+};
+
+type QueryCacheKey = string & {
+    _type: 'queryCacheKey';
+};
+type QuerySubstateIdentifier = {
+    queryCacheKey: QueryCacheKey;
+};
+type MutationSubstateIdentifier = {
+    requestId: string;
+    fixedCacheKey?: string;
+} | {
+    requestId?: string;
+    fixedCacheKey: string;
+};
+type RefetchConfigOptions = {
+    refetchOnMountOrArgChange: boolean | number;
+    refetchOnReconnect: boolean;
+    refetchOnFocus: boolean;
+};
+type InfiniteQueryConfigOptions<DataType, PageParam, QueryArg> = {
+    /**
+     * The initial page parameter to use for the first page fetch.
+     */
+    initialPageParam: PageParam;
+    /**
+     * This function is required to automatically get the next cursor for infinite queries.
+     * The result will also be used to determine the value of `hasNextPage`.
+     */
+    getNextPageParam: (lastPage: DataType, allPages: Array<DataType>, lastPageParam: PageParam, allPageParams: Array<PageParam>, queryArg: QueryArg) => PageParam | undefined | null;
+    /**
+     * This function can be set to automatically get the previous cursor for infinite queries.
+     * The result will also be used to determine the value of `hasPreviousPage`.
+     */
+    getPreviousPageParam?: (firstPage: DataType, allPages: Array<DataType>, firstPageParam: PageParam, allPageParams: Array<PageParam>, queryArg: QueryArg) => PageParam | undefined | null;
+    /**
+     * If specified, only keep this many pages in cache at once.
+     * If additional pages are fetched, older pages in the other
+     * direction will be dropped from the cache.
+     */
+    maxPages?: number;
+    /**
+     * Defaults to `true`. When this is `true` and an infinite query endpoint is refetched
+     * (due to tag invalidation, polling, arg change configuration, or manual refetching),
+     * RTK Query will try to sequentially refetch all pages currently in the cache.
+     * When `false` only the first page will be refetched.
+     */
+    refetchCachedPages?: boolean;
+};
+type InfiniteData<DataType, PageParam> = {
+    pages: Array<DataType>;
+    pageParams: Array<PageParam>;
+};
+/**
+ * Strings describing the query state at any given time.
+ */
+declare enum QueryStatus {
+    uninitialized = "uninitialized",
+    pending = "pending",
+    fulfilled = "fulfilled",
+    rejected = "rejected"
+}
+type RequestStatusFlags = {
+    status: QueryStatus.uninitialized;
+    isUninitialized: true;
+    isLoading: false;
+    isSuccess: false;
+    isError: false;
+} | {
+    status: QueryStatus.pending;
+    isUninitialized: false;
+    isLoading: true;
+    isSuccess: false;
+    isError: false;
+} | {
+    status: QueryStatus.fulfilled;
+    isUninitialized: false;
+    isLoading: false;
+    isSuccess: true;
+    isError: false;
+} | {
+    status: QueryStatus.rejected;
+    isUninitialized: false;
+    isLoading: false;
+    isSuccess: false;
+    isError: true;
+};
+/**
+ * @public
+ */
+type SubscriptionOptions = {
+    /**
+     * How frequently to automatically re-fetch data (in milliseconds). Defaults to `0` (off).
+     */
+    pollingInterval?: number;
+    /**
+     *  Defaults to 'false'. This setting allows you to control whether RTK Query will continue polling if the window is not focused.
+     *
+     *  If pollingInterval is not set or set to 0, this **will not be evaluated** until pollingInterval is greater than 0.
+     *
+     *  Note: requires [`setupListeners`](./setupListeners) to have been called.
+     */
+    skipPollingIfUnfocused?: boolean;
+    /**
+     * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after regaining a network connection.
+     *
+     * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.
+     *
+     * Note: requires [`setupListeners`](./setupListeners) to have been called.
+     */
+    refetchOnReconnect?: boolean;
+    /**
+     * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after the application window regains focus.
+     *
+     * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.
+     *
+     * Note: requires [`setupListeners`](./setupListeners) to have been called.
+     */
+    refetchOnFocus?: boolean;
+};
+type Subscribers = {
+    [requestId: string]: SubscriptionOptions;
+};
+type QueryKeys<Definitions extends EndpointDefinitions> = {
+    [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any> ? K : never;
+}[keyof Definitions];
+type InfiniteQueryKeys<Definitions extends EndpointDefinitions> = {
+    [K in keyof Definitions]: Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? K : never;
+}[keyof Definitions];
+type MutationKeys<Definitions extends EndpointDefinitions> = {
+    [K in keyof Definitions]: Definitions[K] extends MutationDefinition<any, any, any, any> ? K : never;
+}[keyof Definitions];
+type BaseQuerySubState<D extends BaseEndpointDefinition<any, any, any, any>, DataType = ResultTypeFrom<D>> = {
+    /**
+     * The argument originally passed into the hook or `initiate` action call
+     */
+    originalArgs: QueryArgFromAnyQuery<D>;
+    /**
+     * A unique ID associated with the request
+     */
+    requestId: string;
+    /**
+     * The received data from the query
+     */
+    data?: DataType;
+    /**
+     * The received error if applicable
+     */
+    error?: SerializedError | (D extends QueryDefinition<any, infer BaseQuery, any, any> ? BaseQueryError<BaseQuery> : never);
+    /**
+     * The name of the endpoint associated with the query
+     */
+    endpointName: string;
+    /**
+     * Time that the latest query started
+     */
+    startedTimeStamp: number;
+    /**
+     * Time that the latest query was fulfilled
+     */
+    fulfilledTimeStamp?: number;
+};
+type QuerySubState<D extends BaseEndpointDefinition<any, any, any, any>, DataType = ResultTypeFrom<D>> = Id<({
+    status: QueryStatus.fulfilled;
+} & WithRequiredProp<BaseQuerySubState<D, DataType>, 'data' | 'fulfilledTimeStamp'> & {
+    error: undefined;
+}) | ({
+    status: QueryStatus.pending;
+} & BaseQuerySubState<D, DataType>) | ({
+    status: QueryStatus.rejected;
+} & WithRequiredProp<BaseQuerySubState<D, DataType>, 'error'>) | {
+    status: QueryStatus.uninitialized;
+    originalArgs?: undefined;
+    data?: undefined;
+    error?: undefined;
+    requestId?: undefined;
+    endpointName?: string;
+    startedTimeStamp?: undefined;
+    fulfilledTimeStamp?: undefined;
+}>;
+type InfiniteQueryDirection = 'forward' | 'backward';
+type InfiniteQuerySubState<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any> ? QuerySubState<D, InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>> & {
+    direction?: InfiniteQueryDirection;
+} : never;
+type BaseMutationSubState<D extends BaseEndpointDefinition<any, any, any, any>> = {
+    requestId: string;
+    data?: ResultTypeFrom<D>;
+    error?: SerializedError | (D extends MutationDefinition<any, infer BaseQuery, any, any> ? BaseQueryError<BaseQuery> : never);
+    endpointName: string;
+    startedTimeStamp: number;
+    fulfilledTimeStamp?: number;
+};
+type MutationSubState<D extends BaseEndpointDefinition<any, any, any, any>> = (({
+    status: QueryStatus.fulfilled;
+} & WithRequiredProp<BaseMutationSubState<D>, 'data' | 'fulfilledTimeStamp'>) & {
+    error: undefined;
+}) | (({
+    status: QueryStatus.pending;
+} & BaseMutationSubState<D>) & {
+    data?: undefined;
+}) | ({
+    status: QueryStatus.rejected;
+} & WithRequiredProp<BaseMutationSubState<D>, 'error'>) | {
+    requestId?: undefined;
+    status: QueryStatus.uninitialized;
+    data?: undefined;
+    error?: undefined;
+    endpointName?: string;
+    startedTimeStamp?: undefined;
+    fulfilledTimeStamp?: undefined;
+};
+type CombinedState<D extends EndpointDefinitions, E extends string, ReducerPath extends string> = {
+    queries: QueryState<D>;
+    mutations: MutationState<D>;
+    provided: InvalidationState<E>;
+    subscriptions: SubscriptionState;
+    config: ConfigState<ReducerPath>;
+};
+type InvalidationState<TagTypes extends string> = {
+    tags: {
+        [_ in TagTypes]: {
+            [id: string]: Array<QueryCacheKey>;
+            [id: number]: Array<QueryCacheKey>;
+        };
+    };
+    keys: Record<QueryCacheKey, Array<FullTagDescription<any>>>;
+};
+type QueryState<D extends EndpointDefinitions> = {
+    [queryCacheKey: string]: QuerySubState<D[string]> | InfiniteQuerySubState<D[string]> | undefined;
+};
+type SubscriptionState = {
+    [queryCacheKey: string]: Subscribers | undefined;
+};
+type ConfigState<ReducerPath> = RefetchConfigOptions & {
+    reducerPath: ReducerPath;
+    online: boolean;
+    focused: boolean;
+    middlewareRegistered: boolean | 'conflict';
+} & ModifiableConfigState;
+type ModifiableConfigState = {
+    keepUnusedDataFor: number;
+    invalidationBehavior: 'delayed' | 'immediately';
+} & RefetchConfigOptions;
+type MutationState<D extends EndpointDefinitions> = {
+    [requestId: string]: MutationSubState<D[string]> | undefined;
+};
+type RootState<Definitions extends EndpointDefinitions, TagTypes extends string, ReducerPath extends string> = {
+    [P in ReducerPath]: CombinedState<Definitions, TagTypes, P>;
+};
+
+type ResponseHandler = 'content-type' | 'json' | 'text' | ((response: Response) => Promise<any>);
+type CustomRequestInit = Override<RequestInit, {
+    headers?: Headers | string[][] | Record<string, string | undefined> | undefined;
+}>;
+interface FetchArgs extends CustomRequestInit {
+    url: string;
+    params?: Record<string, any>;
+    body?: any;
+    responseHandler?: ResponseHandler;
+    validateStatus?: (response: Response, body: any) => boolean;
+    /**
+     * A number in milliseconds that represents that maximum time a request can take before timing out.
+     */
+    timeout?: number;
+}
+type FetchBaseQueryError = {
+    /**
+     * * `number`:
+     *   HTTP status code
+     */
+    status: number;
+    data: unknown;
+} | {
+    /**
+     * * `"FETCH_ERROR"`:
+     *   An error that occurred during execution of `fetch` or the `fetchFn` callback option
+     **/
+    status: 'FETCH_ERROR';
+    data?: undefined;
+    error: string;
+} | {
+    /**
+     * * `"PARSING_ERROR"`:
+     *   An error happened during parsing.
+     *   Most likely a non-JSON-response was returned with the default `responseHandler` "JSON",
+     *   or an error occurred while executing a custom `responseHandler`.
+     **/
+    status: 'PARSING_ERROR';
+    originalStatus: number;
+    data: string;
+    error: string;
+} | {
+    /**
+     * * `"TIMEOUT_ERROR"`:
+     *   Request timed out
+     **/
+    status: 'TIMEOUT_ERROR';
+    data?: undefined;
+    error: string;
+} | {
+    /**
+     * * `"CUSTOM_ERROR"`:
+     *   A custom error type that you can return from your `queryFn` where another error might not make sense.
+     **/
+    status: 'CUSTOM_ERROR';
+    data?: unknown;
+    error: string;
+};
+type FetchBaseQueryArgs = {
+    baseUrl?: string;
+    prepareHeaders?: (headers: Headers, api: Pick<BaseQueryApi, 'getState' | 'extra' | 'endpoint' | 'type' | 'forced'> & {
+        arg: string | FetchArgs;
+        extraOptions: unknown;
+    }) => MaybePromise<Headers | void>;
+    fetchFn?: (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
+    paramsSerializer?: (params: Record<string, any>) => string;
+    /**
+     * By default, we only check for 'application/json' and 'application/vnd.api+json' as the content-types for json. If you need to support another format, you can pass
+     * in a predicate function for your given api to get the same automatic stringifying behavior
+     * @example
+     * ```ts
+     * const isJsonContentType = (headers: Headers) => ["application/vnd.api+json", "application/json", "application/vnd.hal+json"].includes(headers.get("content-type")?.trim());
+     * ```
+     */
+    isJsonContentType?: (headers: Headers) => boolean;
+    /**
+     * Defaults to `application/json`;
+     */
+    jsonContentType?: string;
+    /**
+     * Custom replacer function used when calling `JSON.stringify()`;
+     */
+    jsonReplacer?: (this: any, key: string, value: any) => any;
+} & RequestInit & Pick<FetchArgs, 'responseHandler' | 'validateStatus' | 'timeout'>;
+type FetchBaseQueryMeta = {
+    request: Request;
+    response?: Response;
+};
+/**
+ * This is a very small wrapper around fetch that aims to simplify requests.
+ *
+ * @example
+ * ```ts
+ * const baseQuery = fetchBaseQuery({
+ *   baseUrl: 'https://api.your-really-great-app.com/v1/',
+ *   prepareHeaders: (headers, { getState }) => {
+ *     const token = (getState() as RootState).auth.token;
+ *     // If we have a token set in state, let's assume that we should be passing it.
+ *     if (token) {
+ *       headers.set('authorization', `Bearer ${token}`);
+ *     }
+ *     return headers;
+ *   },
+ * })
+ * ```
+ *
+ * @param {string} baseUrl
+ * The base URL for an API service.
+ * Typically in the format of https://example.com/
+ *
+ * @param {(headers: Headers, api: { getState: () => unknown; arg: string | FetchArgs; extra: unknown; endpoint: string; type: 'query' | 'mutation'; forced: boolean; }) => Headers} prepareHeaders
+ * An optional function that can be used to inject headers on requests.
+ * Provides a Headers object, most of the `BaseQueryApi` (`dispatch` is not available), and the arg passed into the query function.
+ * Useful for setting authentication or headers that need to be set conditionally.
+ *
+ * @link https://developer.mozilla.org/en-US/docs/Web/API/Headers
+ *
+ * @param {(input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>} fetchFn
+ * Accepts a custom `fetch` function if you do not want to use the default on the window.
+ * Useful in SSR environments if you need to use a library such as `isomorphic-fetch` or `cross-fetch`
+ *
+ * @param {(params: Record<string, unknown>) => string} paramsSerializer
+ * An optional function that can be used to stringify querystring parameters.
+ *
+ * @param {(headers: Headers) => boolean} isJsonContentType
+ * An optional predicate function to determine if `JSON.stringify()` should be called on the `body` arg of `FetchArgs`
+ *
+ * @param {string} jsonContentType Used when automatically setting the content-type header for a request with a jsonifiable body that does not have an explicit content-type header. Defaults to `application/json`.
+ *
+ * @param {(this: any, key: string, value: any) => any} jsonReplacer Custom replacer function used when calling `JSON.stringify()`.
+ *
+ * @param {number} timeout
+ * A number in milliseconds that represents the maximum time a request can take before timing out.
+ */
+declare function fetchBaseQuery({ baseUrl, prepareHeaders, fetchFn, paramsSerializer, isJsonContentType, jsonContentType, jsonReplacer, timeout: defaultTimeout, responseHandler: globalResponseHandler, validateStatus: globalValidateStatus, ...baseFetchOptions }?: FetchBaseQueryArgs): BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>;
+
+type RetryConditionFunction = (error: BaseQueryError<BaseQueryFn>, args: BaseQueryArg<BaseQueryFn>, extraArgs: {
+    attempt: number;
+    baseQueryApi: BaseQueryApi;
+    extraOptions: BaseQueryExtraOptions<BaseQueryFn> & RetryOptions;
+}) => boolean;
+type RetryOptions = {
+    /**
+     * Function used to determine delay between retries
+     */
+    backoff?: (attempt: number, maxRetries: number, signal?: AbortSignal) => Promise<void>;
+} & ({
+    /**
+     * How many times the query will be retried (default: 5)
+     */
+    maxRetries?: number;
+    retryCondition?: undefined;
+} | {
+    /**
+     * Callback to determine if a retry should be attempted.
+     * Return `true` for another retry and `false` to quit trying prematurely.
+     */
+    retryCondition?: RetryConditionFunction;
+    maxRetries?: undefined;
+});
+declare function fail<BaseQuery extends BaseQueryFn = BaseQueryFn>(error: BaseQueryError<BaseQuery>, meta?: BaseQueryMeta<BaseQuery>): never;
+/**
+ * A utility that can wrap `baseQuery` in the API definition to provide retries with a basic exponential backoff.
+ *
+ * @example
+ *
+ * ```ts
+ * // codeblock-meta title="Retry every request 5 times by default"
+ * import { createApi, fetchBaseQuery, retry } from '@reduxjs/toolkit/query/react'
+ * interface Post {
+ *   id: number
+ *   name: string
+ * }
+ * type PostsResponse = Post[]
+ *
+ * // maxRetries: 5 is the default, and can be omitted. Shown for documentation purposes.
+ * const staggeredBaseQuery = retry(fetchBaseQuery({ baseUrl: '/' }), { maxRetries: 5 });
+ * export const api = createApi({
+ *   baseQuery: staggeredBaseQuery,
+ *   endpoints: (build) => ({
+ *     getPosts: build.query<PostsResponse, void>({
+ *       query: () => ({ url: 'posts' }),
+ *     }),
+ *     getPost: build.query<PostsResponse, string>({
+ *       query: (id) => ({ url: `post/${id}` }),
+ *       extraOptions: { maxRetries: 8 }, // You can override the retry behavior on each endpoint
+ *     }),
+ *   }),
+ * });
+ *
+ * export const { useGetPostsQuery, useGetPostQuery } = api;
+ * ```
+ */
+declare const retry: BaseQueryEnhancer<unknown, RetryOptions, void | RetryOptions> & {
+    fail: typeof fail;
+};
+
+declare function copyWithStructuralSharing<T>(oldObj: any, newObj: T): T;
+
+export { type Api, type ApiContext, type ApiEndpointInfiniteQuery, type ApiEndpointMutation, type ApiEndpointQuery, type ApiModules, type BaseEndpointDefinition, type BaseQueryApi, type BaseQueryArg, type BaseQueryEnhancer, type BaseQueryError, type BaseQueryExtraOptions, type BaseQueryFn, type BaseQueryMeta, type BaseQueryResult, type CombinedState, type CoreModule, type CreateApi, type CreateApiOptions, DefinitionType, type DefinitionsFromApi, type EndpointBuilder, type EndpointDefinition, type EndpointDefinitions, type FetchArgs, type FetchBaseQueryArgs, type FetchBaseQueryError, type FetchBaseQueryMeta, type InfiniteData, type InfiniteQueryActionCreatorResult, type InfiniteQueryArgFrom, type InfiniteQueryConfigOptions, type InfiniteQueryDefinition, type InfiniteQueryExtraOptions, type InfiniteQueryResultSelectorResult, type InfiniteQuerySubState, type Module, type MutationActionCreatorResult, type MutationDefinition, type MutationExtraOptions, type MutationResultSelectorResult, NamedSchemaError, type OverrideResultType, type PageParamFrom, type PrefetchOptions, type QueryActionCreatorResult, type QueryArgFrom, type QueryCacheKey, type QueryDefinition, type QueryExtraOptions, type QueryKeys, type QueryResultSelectorResult, type QueryReturnValue, QueryStatus, type QuerySubState, type ResultDescription, type ResultTypeFrom, type RetryOptions, type RootState, type SchemaFailureConverter, type SchemaFailureHandler, type SchemaFailureInfo, type SchemaType, type SerializeQueryArgs, type SkipToken, type StartQueryActionCreatorOptions, type SubscriptionOptions, type Id as TSHelpersId, type NoInfer as TSHelpersNoInfer, type Override as TSHelpersOverride, type TagDescription, type TagTypesFromApi, type TypedMutationOnQueryStarted, type TypedQueryOnQueryStarted, type UpdateDefinitions, buildCreateApi, copyWithStructuralSharing, coreModule, createApi, defaultSerializeQueryArgs, fakeBaseQuery, fetchBaseQuery, retry, setupListeners };
Index: node_modules/@reduxjs/toolkit/dist/query/react/cjs/index.js
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/react/cjs/index.js	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/react/cjs/index.js	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,6 @@
+'use strict'
+if (process.env.NODE_ENV === 'production') {
+  module.exports = require('./rtk-query-react.production.min.cjs')
+} else {
+  module.exports = require('./rtk-query-react.development.cjs')
+}
Index: node_modules/@reduxjs/toolkit/dist/query/react/cjs/rtk-query-react.development.cjs
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/react/cjs/rtk-query-react.development.cjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/react/cjs/rtk-query-react.development.cjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,748 @@
+"use strict";
+var __create = Object.create;
+var __defProp = Object.defineProperty;
+var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
+var __getOwnPropNames = Object.getOwnPropertyNames;
+var __getProtoOf = Object.getPrototypeOf;
+var __hasOwnProp = Object.prototype.hasOwnProperty;
+var __export = (target, all) => {
+  for (var name in all)
+    __defProp(target, name, { get: all[name], enumerable: true });
+};
+var __copyProps = (to, from, except, desc) => {
+  if (from && typeof from === "object" || typeof from === "function") {
+    for (let key of __getOwnPropNames(from))
+      if (!__hasOwnProp.call(to, key) && key !== except)
+        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
+  }
+  return to;
+};
+var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
+var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
+  // If the importer is in node compatibility mode or this is not an ESM
+  // file that has been converted to a CommonJS file using a Babel-
+  // compatible transform (i.e. "__esModule" has not been set), then set
+  // "default" to the CommonJS "module.exports" for node compatibility.
+  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
+  mod
+));
+var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
+
+// src/query/react/index.ts
+var react_exports = {};
+__export(react_exports, {
+  ApiProvider: () => ApiProvider,
+  UNINITIALIZED_VALUE: () => UNINITIALIZED_VALUE,
+  createApi: () => createApi,
+  reactHooksModule: () => reactHooksModule,
+  reactHooksModuleName: () => reactHooksModuleName
+});
+module.exports = __toCommonJS(react_exports);
+
+// src/query/react/rtkqImports.ts
+var import_query = require("@reduxjs/toolkit/query");
+
+// src/query/react/module.ts
+var import_toolkit2 = require("@reduxjs/toolkit");
+var import_react_redux2 = require("react-redux");
+var import_reselect = require("reselect");
+
+// src/query/utils/capitalize.ts
+function capitalize(str) {
+  return str.replace(str[0], str[0].toUpperCase());
+}
+
+// src/query/utils/countObjectKeys.ts
+function countObjectKeys(obj) {
+  let count = 0;
+  for (const _key in obj) {
+    count++;
+  }
+  return count;
+}
+
+// src/query/endpointDefinitions.ts
+var ENDPOINT_QUERY = "query" /* query */;
+var ENDPOINT_MUTATION = "mutation" /* mutation */;
+var ENDPOINT_INFINITEQUERY = "infinitequery" /* infinitequery */;
+function isQueryDefinition(e) {
+  return e.type === ENDPOINT_QUERY;
+}
+function isMutationDefinition(e) {
+  return e.type === ENDPOINT_MUTATION;
+}
+function isInfiniteQueryDefinition(e) {
+  return e.type === ENDPOINT_INFINITEQUERY;
+}
+
+// src/query/tsHelpers.ts
+function safeAssign(target, ...args) {
+  return Object.assign(target, ...args);
+}
+
+// src/query/react/buildHooks.ts
+var import_toolkit = require("@reduxjs/toolkit");
+
+// src/query/react/reactImports.ts
+var import_react = require("react");
+
+// src/query/react/reactReduxImports.ts
+var import_react_redux = require("react-redux");
+
+// src/query/react/constants.ts
+var UNINITIALIZED_VALUE = Symbol();
+
+// src/query/react/useSerializedStableValue.ts
+function useStableQueryArgs(queryArgs) {
+  const cache = (0, import_react.useRef)(queryArgs);
+  const copy = (0, import_react.useMemo)(() => (0, import_query.copyWithStructuralSharing)(cache.current, queryArgs), [queryArgs]);
+  (0, import_react.useEffect)(() => {
+    if (cache.current !== copy) {
+      cache.current = copy;
+    }
+  }, [copy]);
+  return copy;
+}
+
+// src/query/react/useShallowStableValue.ts
+function useShallowStableValue(value) {
+  const cache = (0, import_react.useRef)(value);
+  (0, import_react.useEffect)(() => {
+    if (!(0, import_react_redux.shallowEqual)(cache.current, value)) {
+      cache.current = value;
+    }
+  }, [value]);
+  return (0, import_react_redux.shallowEqual)(cache.current, value) ? cache.current : value;
+}
+
+// src/query/react/buildHooks.ts
+var canUseDOM = () => !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
+var isDOM = /* @__PURE__ */ canUseDOM();
+var isRunningInReactNative = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
+var isReactNative = /* @__PURE__ */ isRunningInReactNative();
+var getUseIsomorphicLayoutEffect = () => isDOM || isReactNative ? import_react.useLayoutEffect : import_react.useEffect;
+var useIsomorphicLayoutEffect = /* @__PURE__ */ getUseIsomorphicLayoutEffect();
+var noPendingQueryStateSelector = (selected) => {
+  if (selected.isUninitialized) {
+    return {
+      ...selected,
+      isUninitialized: false,
+      isFetching: true,
+      isLoading: selected.data !== void 0 ? false : true,
+      // This is the one place where we still have to use `QueryStatus` as an enum,
+      // since it's the only reference in the React package and not in the core.
+      status: import_query.QueryStatus.pending
+    };
+  }
+  return selected;
+};
+function pick(obj, ...keys) {
+  const ret = {};
+  keys.forEach((key) => {
+    ret[key] = obj[key];
+  });
+  return ret;
+}
+var COMMON_HOOK_DEBUG_FIELDS = ["data", "status", "isLoading", "isSuccess", "isError", "error"];
+function buildHooks({
+  api,
+  moduleOptions: {
+    batch,
+    hooks: {
+      useDispatch,
+      useSelector,
+      useStore
+    },
+    unstable__sideEffectsInRender,
+    createSelector
+  },
+  serializeQueryArgs,
+  context
+}) {
+  const usePossiblyImmediateEffect = unstable__sideEffectsInRender ? (cb) => cb() : import_react.useEffect;
+  const unsubscribePromiseRef = (ref) => ref.current?.unsubscribe?.();
+  const endpointDefinitions = context.endpointDefinitions;
+  return {
+    buildQueryHooks,
+    buildInfiniteQueryHooks,
+    buildMutationHook,
+    usePrefetch
+  };
+  function queryStatePreSelector(currentState, lastResult, queryArgs) {
+    if (lastResult?.endpointName && currentState.isUninitialized) {
+      const {
+        endpointName
+      } = lastResult;
+      const endpointDefinition = endpointDefinitions[endpointName];
+      if (queryArgs !== import_query.skipToken && serializeQueryArgs({
+        queryArgs: lastResult.originalArgs,
+        endpointDefinition,
+        endpointName
+      }) === serializeQueryArgs({
+        queryArgs,
+        endpointDefinition,
+        endpointName
+      })) lastResult = void 0;
+    }
+    let data = currentState.isSuccess ? currentState.data : lastResult?.data;
+    if (data === void 0) data = currentState.data;
+    const hasData = data !== void 0;
+    const isFetching = currentState.isLoading;
+    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;
+    const isSuccess = currentState.isSuccess || hasData && (isFetching && !lastResult?.isError || currentState.isUninitialized);
+    return {
+      ...currentState,
+      data,
+      currentData: currentState.data,
+      isFetching,
+      isLoading,
+      isSuccess
+    };
+  }
+  function infiniteQueryStatePreSelector(currentState, lastResult, queryArgs) {
+    if (lastResult?.endpointName && currentState.isUninitialized) {
+      const {
+        endpointName
+      } = lastResult;
+      const endpointDefinition = endpointDefinitions[endpointName];
+      if (queryArgs !== import_query.skipToken && serializeQueryArgs({
+        queryArgs: lastResult.originalArgs,
+        endpointDefinition,
+        endpointName
+      }) === serializeQueryArgs({
+        queryArgs,
+        endpointDefinition,
+        endpointName
+      })) lastResult = void 0;
+    }
+    let data = currentState.isSuccess ? currentState.data : lastResult?.data;
+    if (data === void 0) data = currentState.data;
+    const hasData = data !== void 0;
+    const isFetching = currentState.isLoading;
+    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;
+    const isSuccess = currentState.isSuccess || isFetching && hasData;
+    return {
+      ...currentState,
+      data,
+      currentData: currentState.data,
+      isFetching,
+      isLoading,
+      isSuccess
+    };
+  }
+  function usePrefetch(endpointName, defaultOptions) {
+    const dispatch = useDispatch();
+    const stableDefaultOptions = useShallowStableValue(defaultOptions);
+    return (0, import_react.useCallback)((arg, options) => dispatch(api.util.prefetch(endpointName, arg, {
+      ...stableDefaultOptions,
+      ...options
+    })), [endpointName, dispatch, stableDefaultOptions]);
+  }
+  function useQuerySubscriptionCommonImpl(endpointName, arg, {
+    refetchOnReconnect,
+    refetchOnFocus,
+    refetchOnMountOrArgChange,
+    skip = false,
+    pollingInterval = 0,
+    skipPollingIfUnfocused = false,
+    ...rest
+  } = {}) {
+    const {
+      initiate
+    } = api.endpoints[endpointName];
+    const dispatch = useDispatch();
+    const subscriptionSelectorsRef = (0, import_react.useRef)(void 0);
+    if (!subscriptionSelectorsRef.current) {
+      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());
+      if (true) {
+        if (typeof returnedValue !== "object" || typeof returnedValue?.type === "string") {
+          throw new Error(false ? _formatProdErrorMessage(37) : `Warning: Middleware for RTK-Query API at reducerPath "${api.reducerPath}" has not been added to the store.
+    You must add the middleware for RTK-Query to function correctly!`);
+        }
+      }
+      subscriptionSelectorsRef.current = returnedValue;
+    }
+    const stableArg = useStableQueryArgs(skip ? import_query.skipToken : arg);
+    const stableSubscriptionOptions = useShallowStableValue({
+      refetchOnReconnect,
+      refetchOnFocus,
+      pollingInterval,
+      skipPollingIfUnfocused
+    });
+    const initialPageParam = rest.initialPageParam;
+    const stableInitialPageParam = useShallowStableValue(initialPageParam);
+    const refetchCachedPages = rest.refetchCachedPages;
+    const stableRefetchCachedPages = useShallowStableValue(refetchCachedPages);
+    const promiseRef = (0, import_react.useRef)(void 0);
+    let {
+      queryCacheKey,
+      requestId
+    } = promiseRef.current || {};
+    let currentRenderHasSubscription = false;
+    if (queryCacheKey && requestId) {
+      currentRenderHasSubscription = subscriptionSelectorsRef.current.isRequestSubscribed(queryCacheKey, requestId);
+    }
+    const subscriptionRemoved = !currentRenderHasSubscription && promiseRef.current !== void 0;
+    usePossiblyImmediateEffect(() => {
+      if (subscriptionRemoved) {
+        promiseRef.current = void 0;
+      }
+    }, [subscriptionRemoved]);
+    usePossiblyImmediateEffect(() => {
+      const lastPromise = promiseRef.current;
+      if (typeof process !== "undefined" && false) {
+        console.log(subscriptionRemoved);
+      }
+      if (stableArg === import_query.skipToken) {
+        lastPromise?.unsubscribe();
+        promiseRef.current = void 0;
+        return;
+      }
+      const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions;
+      if (!lastPromise || lastPromise.arg !== stableArg) {
+        lastPromise?.unsubscribe();
+        const promise = dispatch(initiate(stableArg, {
+          subscriptionOptions: stableSubscriptionOptions,
+          forceRefetch: refetchOnMountOrArgChange,
+          ...isInfiniteQueryDefinition(endpointDefinitions[endpointName]) ? {
+            initialPageParam: stableInitialPageParam,
+            refetchCachedPages: stableRefetchCachedPages
+          } : {}
+        }));
+        promiseRef.current = promise;
+      } else if (stableSubscriptionOptions !== lastSubscriptionOptions) {
+        lastPromise.updateSubscriptionOptions(stableSubscriptionOptions);
+      }
+    }, [dispatch, initiate, refetchOnMountOrArgChange, stableArg, stableSubscriptionOptions, subscriptionRemoved, stableInitialPageParam, stableRefetchCachedPages, endpointName]);
+    return [promiseRef, dispatch, initiate, stableSubscriptionOptions];
+  }
+  function buildUseQueryState(endpointName, preSelector) {
+    const useQueryState = (arg, {
+      skip = false,
+      selectFromResult
+    } = {}) => {
+      const {
+        select
+      } = api.endpoints[endpointName];
+      const stableArg = useStableQueryArgs(skip ? import_query.skipToken : arg);
+      const lastValue = (0, import_react.useRef)(void 0);
+      const selectDefaultResult = (0, import_react.useMemo)(() => (
+        // Normally ts-ignores are bad and should be avoided, but we're
+        // already casting this selector to be `Selector<any>` anyway,
+        // so the inconsistencies don't matter here
+        // @ts-ignore
+        createSelector([
+          // @ts-ignore
+          select(stableArg),
+          (_, lastResult) => lastResult,
+          (_) => stableArg
+        ], preSelector, {
+          memoizeOptions: {
+            resultEqualityCheck: import_react_redux.shallowEqual
+          }
+        })
+      ), [select, stableArg]);
+      const querySelector = (0, import_react.useMemo)(() => selectFromResult ? createSelector([selectDefaultResult], selectFromResult, {
+        devModeChecks: {
+          identityFunctionCheck: "never"
+        }
+      }) : selectDefaultResult, [selectDefaultResult, selectFromResult]);
+      const currentState = useSelector((state) => querySelector(state, lastValue.current), import_react_redux.shallowEqual);
+      const store = useStore();
+      const newLastValue = selectDefaultResult(store.getState(), lastValue.current);
+      useIsomorphicLayoutEffect(() => {
+        lastValue.current = newLastValue;
+      }, [newLastValue]);
+      return currentState;
+    };
+    return useQueryState;
+  }
+  function usePromiseRefUnsubscribeOnUnmount(promiseRef) {
+    (0, import_react.useEffect)(() => {
+      return () => {
+        unsubscribePromiseRef(promiseRef);
+        promiseRef.current = void 0;
+      };
+    }, [promiseRef]);
+  }
+  function refetchOrErrorIfUnmounted(promiseRef) {
+    if (!promiseRef.current) throw new Error(false ? _formatProdErrorMessage2(38) : "Cannot refetch a query that has not been started yet.");
+    return promiseRef.current.refetch();
+  }
+  function buildQueryHooks(endpointName) {
+    const useQuerySubscription = (arg, options = {}) => {
+      const [promiseRef] = useQuerySubscriptionCommonImpl(endpointName, arg, options);
+      usePromiseRefUnsubscribeOnUnmount(promiseRef);
+      return (0, import_react.useMemo)(() => ({
+        /**
+         * A method to manually refetch data for the query
+         */
+        refetch: () => refetchOrErrorIfUnmounted(promiseRef)
+      }), [promiseRef]);
+    };
+    const useLazyQuerySubscription = ({
+      refetchOnReconnect,
+      refetchOnFocus,
+      pollingInterval = 0,
+      skipPollingIfUnfocused = false
+    } = {}) => {
+      const {
+        initiate
+      } = api.endpoints[endpointName];
+      const dispatch = useDispatch();
+      const [arg, setArg] = (0, import_react.useState)(UNINITIALIZED_VALUE);
+      const promiseRef = (0, import_react.useRef)(void 0);
+      const stableSubscriptionOptions = useShallowStableValue({
+        refetchOnReconnect,
+        refetchOnFocus,
+        pollingInterval,
+        skipPollingIfUnfocused
+      });
+      usePossiblyImmediateEffect(() => {
+        const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions;
+        if (stableSubscriptionOptions !== lastSubscriptionOptions) {
+          promiseRef.current?.updateSubscriptionOptions(stableSubscriptionOptions);
+        }
+      }, [stableSubscriptionOptions]);
+      const subscriptionOptionsRef = (0, import_react.useRef)(stableSubscriptionOptions);
+      usePossiblyImmediateEffect(() => {
+        subscriptionOptionsRef.current = stableSubscriptionOptions;
+      }, [stableSubscriptionOptions]);
+      const trigger = (0, import_react.useCallback)(function(arg2, preferCacheValue = false) {
+        let promise;
+        batch(() => {
+          unsubscribePromiseRef(promiseRef);
+          promiseRef.current = promise = dispatch(initiate(arg2, {
+            subscriptionOptions: subscriptionOptionsRef.current,
+            forceRefetch: !preferCacheValue
+          }));
+          setArg(arg2);
+        });
+        return promise;
+      }, [dispatch, initiate]);
+      const reset = (0, import_react.useCallback)(() => {
+        if (promiseRef.current?.queryCacheKey) {
+          dispatch(api.internalActions.removeQueryResult({
+            queryCacheKey: promiseRef.current?.queryCacheKey
+          }));
+        }
+      }, [dispatch]);
+      (0, import_react.useEffect)(() => {
+        return () => {
+          unsubscribePromiseRef(promiseRef);
+        };
+      }, []);
+      (0, import_react.useEffect)(() => {
+        if (arg !== UNINITIALIZED_VALUE && !promiseRef.current) {
+          trigger(arg, true);
+        }
+      }, [arg, trigger]);
+      return (0, import_react.useMemo)(() => [trigger, arg, {
+        reset
+      }], [trigger, arg, reset]);
+    };
+    const useQueryState = buildUseQueryState(endpointName, queryStatePreSelector);
+    return {
+      useQueryState,
+      useQuerySubscription,
+      useLazyQuerySubscription,
+      useLazyQuery(options) {
+        const [trigger, arg, {
+          reset
+        }] = useLazyQuerySubscription(options);
+        const queryStateResults = useQueryState(arg, {
+          ...options,
+          skip: arg === UNINITIALIZED_VALUE
+        });
+        const info = (0, import_react.useMemo)(() => ({
+          lastArg: arg
+        }), [arg]);
+        return (0, import_react.useMemo)(() => [trigger, {
+          ...queryStateResults,
+          reset
+        }, info], [trigger, queryStateResults, reset, info]);
+      },
+      useQuery(arg, options) {
+        const querySubscriptionResults = useQuerySubscription(arg, options);
+        const queryStateResults = useQueryState(arg, {
+          selectFromResult: arg === import_query.skipToken || options?.skip ? void 0 : noPendingQueryStateSelector,
+          ...options
+        });
+        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS);
+        (0, import_react.useDebugValue)(debugValue);
+        return (0, import_react.useMemo)(() => ({
+          ...queryStateResults,
+          ...querySubscriptionResults
+        }), [queryStateResults, querySubscriptionResults]);
+      }
+    };
+  }
+  function buildInfiniteQueryHooks(endpointName) {
+    const useInfiniteQuerySubscription = (arg, options = {}) => {
+      const [promiseRef, dispatch, initiate, stableSubscriptionOptions] = useQuerySubscriptionCommonImpl(endpointName, arg, options);
+      const subscriptionOptionsRef = (0, import_react.useRef)(stableSubscriptionOptions);
+      usePossiblyImmediateEffect(() => {
+        subscriptionOptionsRef.current = stableSubscriptionOptions;
+      }, [stableSubscriptionOptions]);
+      const hookRefetchCachedPages = options.refetchCachedPages;
+      const stableHookRefetchCachedPages = useShallowStableValue(hookRefetchCachedPages);
+      const trigger = (0, import_react.useCallback)(function(arg2, direction) {
+        let promise;
+        batch(() => {
+          unsubscribePromiseRef(promiseRef);
+          promiseRef.current = promise = dispatch(initiate(arg2, {
+            subscriptionOptions: subscriptionOptionsRef.current,
+            direction
+          }));
+        });
+        return promise;
+      }, [promiseRef, dispatch, initiate]);
+      usePromiseRefUnsubscribeOnUnmount(promiseRef);
+      const stableArg = useStableQueryArgs(options.skip ? import_query.skipToken : arg);
+      const refetch = (0, import_react.useCallback)((options2) => {
+        if (!promiseRef.current) throw new Error(false ? _formatProdErrorMessage3(38) : "Cannot refetch a query that has not been started yet.");
+        const mergedOptions = {
+          refetchCachedPages: options2?.refetchCachedPages ?? stableHookRefetchCachedPages
+        };
+        return promiseRef.current.refetch(mergedOptions);
+      }, [promiseRef, stableHookRefetchCachedPages]);
+      return (0, import_react.useMemo)(() => {
+        const fetchNextPage = () => {
+          return trigger(stableArg, "forward");
+        };
+        const fetchPreviousPage = () => {
+          return trigger(stableArg, "backward");
+        };
+        return {
+          trigger,
+          /**
+           * A method to manually refetch data for the query
+           */
+          refetch,
+          fetchNextPage,
+          fetchPreviousPage
+        };
+      }, [refetch, trigger, stableArg]);
+    };
+    const useInfiniteQueryState = buildUseQueryState(endpointName, infiniteQueryStatePreSelector);
+    return {
+      useInfiniteQueryState,
+      useInfiniteQuerySubscription,
+      useInfiniteQuery(arg, options) {
+        const {
+          refetch,
+          fetchNextPage,
+          fetchPreviousPage
+        } = useInfiniteQuerySubscription(arg, options);
+        const queryStateResults = useInfiniteQueryState(arg, {
+          selectFromResult: arg === import_query.skipToken || options?.skip ? void 0 : noPendingQueryStateSelector,
+          ...options
+        });
+        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS, "hasNextPage", "hasPreviousPage");
+        (0, import_react.useDebugValue)(debugValue);
+        return (0, import_react.useMemo)(() => ({
+          ...queryStateResults,
+          fetchNextPage,
+          fetchPreviousPage,
+          refetch
+        }), [queryStateResults, fetchNextPage, fetchPreviousPage, refetch]);
+      }
+    };
+  }
+  function buildMutationHook(name) {
+    return ({
+      selectFromResult,
+      fixedCacheKey
+    } = {}) => {
+      const {
+        select,
+        initiate
+      } = api.endpoints[name];
+      const dispatch = useDispatch();
+      const [promise, setPromise] = (0, import_react.useState)();
+      (0, import_react.useEffect)(() => () => {
+        if (!promise?.arg.fixedCacheKey) {
+          promise?.reset();
+        }
+      }, [promise]);
+      const triggerMutation = (0, import_react.useCallback)(function(arg) {
+        const promise2 = dispatch(initiate(arg, {
+          fixedCacheKey
+        }));
+        setPromise(promise2);
+        return promise2;
+      }, [dispatch, initiate, fixedCacheKey]);
+      const {
+        requestId
+      } = promise || {};
+      const selectDefaultResult = (0, import_react.useMemo)(() => select({
+        fixedCacheKey,
+        requestId: promise?.requestId
+      }), [fixedCacheKey, promise, select]);
+      const mutationSelector = (0, import_react.useMemo)(() => selectFromResult ? createSelector([selectDefaultResult], selectFromResult) : selectDefaultResult, [selectFromResult, selectDefaultResult]);
+      const currentState = useSelector(mutationSelector, import_react_redux.shallowEqual);
+      const originalArgs = fixedCacheKey == null ? promise?.arg.originalArgs : void 0;
+      const reset = (0, import_react.useCallback)(() => {
+        batch(() => {
+          if (promise) {
+            setPromise(void 0);
+          }
+          if (fixedCacheKey) {
+            dispatch(api.internalActions.removeMutationResult({
+              requestId,
+              fixedCacheKey
+            }));
+          }
+        });
+      }, [dispatch, fixedCacheKey, promise, requestId]);
+      const debugValue = pick(currentState, ...COMMON_HOOK_DEBUG_FIELDS, "endpointName");
+      (0, import_react.useDebugValue)(debugValue);
+      const finalState = (0, import_react.useMemo)(() => ({
+        ...currentState,
+        originalArgs,
+        reset
+      }), [currentState, originalArgs, reset]);
+      return (0, import_react.useMemo)(() => [triggerMutation, finalState], [triggerMutation, finalState]);
+    };
+  }
+}
+
+// src/query/react/module.ts
+var reactHooksModuleName = /* @__PURE__ */ Symbol();
+var reactHooksModule = ({
+  batch = import_react_redux2.batch,
+  hooks = {
+    useDispatch: import_react_redux2.useDispatch,
+    useSelector: import_react_redux2.useSelector,
+    useStore: import_react_redux2.useStore
+  },
+  createSelector = import_reselect.createSelector,
+  unstable__sideEffectsInRender = false,
+  ...rest
+} = {}) => {
+  if (true) {
+    const hookNames = ["useDispatch", "useSelector", "useStore"];
+    let warned = false;
+    for (const hookName of hookNames) {
+      if (countObjectKeys(rest) > 0) {
+        if (rest[hookName]) {
+          if (!warned) {
+            console.warn("As of RTK 2.0, the hooks now need to be specified as one object, provided under a `hooks` key:\n`reactHooksModule({ hooks: { useDispatch, useSelector, useStore } })`");
+            warned = true;
+          }
+        }
+        hooks[hookName] = rest[hookName];
+      }
+      if (typeof hooks[hookName] !== "function") {
+        throw new Error(false ? _formatProdErrorMessage4(36) : `When using custom hooks for context, all ${hookNames.length} hooks need to be provided: ${hookNames.join(", ")}.
+Hook ${hookName} was either not provided or not a function.`);
+      }
+    }
+  }
+  return {
+    name: reactHooksModuleName,
+    init(api, {
+      serializeQueryArgs
+    }, context) {
+      const anyApi = api;
+      const {
+        buildQueryHooks,
+        buildInfiniteQueryHooks,
+        buildMutationHook,
+        usePrefetch
+      } = buildHooks({
+        api,
+        moduleOptions: {
+          batch,
+          hooks,
+          unstable__sideEffectsInRender,
+          createSelector
+        },
+        serializeQueryArgs,
+        context
+      });
+      safeAssign(anyApi, {
+        usePrefetch
+      });
+      safeAssign(context, {
+        batch
+      });
+      return {
+        injectEndpoint(endpointName, definition) {
+          if (isQueryDefinition(definition)) {
+            const {
+              useQuery,
+              useLazyQuery,
+              useLazyQuerySubscription,
+              useQueryState,
+              useQuerySubscription
+            } = buildQueryHooks(endpointName);
+            safeAssign(anyApi.endpoints[endpointName], {
+              useQuery,
+              useLazyQuery,
+              useLazyQuerySubscription,
+              useQueryState,
+              useQuerySubscription
+            });
+            api[`use${capitalize(endpointName)}Query`] = useQuery;
+            api[`useLazy${capitalize(endpointName)}Query`] = useLazyQuery;
+          }
+          if (isMutationDefinition(definition)) {
+            const useMutation = buildMutationHook(endpointName);
+            safeAssign(anyApi.endpoints[endpointName], {
+              useMutation
+            });
+            api[`use${capitalize(endpointName)}Mutation`] = useMutation;
+          } else if (isInfiniteQueryDefinition(definition)) {
+            const {
+              useInfiniteQuery,
+              useInfiniteQuerySubscription,
+              useInfiniteQueryState
+            } = buildInfiniteQueryHooks(endpointName);
+            safeAssign(anyApi.endpoints[endpointName], {
+              useInfiniteQuery,
+              useInfiniteQuerySubscription,
+              useInfiniteQueryState
+            });
+            api[`use${capitalize(endpointName)}InfiniteQuery`] = useInfiniteQuery;
+          }
+        }
+      };
+    }
+  };
+};
+
+// src/query/react/index.ts
+__reExport(react_exports, require("@reduxjs/toolkit/query"), module.exports);
+
+// src/query/react/ApiProvider.tsx
+var import_toolkit3 = require("@reduxjs/toolkit");
+var React = __toESM(require("react"));
+function ApiProvider(props) {
+  const context = props.context || import_react_redux.ReactReduxContext;
+  const existingContext = (0, import_react.useContext)(context);
+  if (existingContext) {
+    throw new Error(false ? _formatProdErrorMessage5(35) : "Existing Redux context detected. If you already have a store set up, please use the traditional Redux setup.");
+  }
+  const [store] = React.useState(() => (0, import_toolkit3.configureStore)({
+    reducer: {
+      [props.api.reducerPath]: props.api.reducer
+    },
+    middleware: (gDM) => gDM().concat(props.api.middleware)
+  }));
+  (0, import_react.useEffect)(() => props.setupListeners === false ? void 0 : (0, import_query.setupListeners)(store.dispatch, props.setupListeners), [props.setupListeners, store.dispatch]);
+  return /* @__PURE__ */ React.createElement(import_react_redux.Provider, { store, context }, props.children);
+}
+
+// src/query/react/index.ts
+var createApi = /* @__PURE__ */ (0, import_query.buildCreateApi)((0, import_query.coreModule)(), reactHooksModule());
+// Annotate the CommonJS export names for ESM import in node:
+0 && (module.exports = {
+  ApiProvider,
+  UNINITIALIZED_VALUE,
+  createApi,
+  reactHooksModule,
+  reactHooksModuleName,
+  ...require("@reduxjs/toolkit/query")
+});
+//# sourceMappingURL=rtk-query-react.development.cjs.map
Index: node_modules/@reduxjs/toolkit/dist/query/react/cjs/rtk-query-react.development.cjs.map
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/react/cjs/rtk-query-react.development.cjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/react/cjs/rtk-query-react.development.cjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,1 @@
+{"version":3,"sources":["../../../../src/query/react/index.ts","../../../../src/query/react/rtkqImports.ts","../../../../src/query/react/module.ts","../../../../src/query/utils/capitalize.ts","../../../../src/query/utils/countObjectKeys.ts","../../../../src/query/endpointDefinitions.ts","../../../../src/query/tsHelpers.ts","../../../../src/query/react/buildHooks.ts","../../../../src/query/react/reactImports.ts","../../../../src/query/react/reactReduxImports.ts","../../../../src/query/react/constants.ts","../../../../src/query/react/useSerializedStableValue.ts","../../../../src/query/react/useShallowStableValue.ts","../../../../src/query/react/ApiProvider.tsx"],"sourcesContent":["// This must remain here so that the `mangleErrors.cjs` build script\n// does not have to import this into each source file it rewrites.\nimport { formatProdErrorMessage } from '@reduxjs/toolkit';\nimport { buildCreateApi, coreModule } from './rtkqImports';\nimport { reactHooksModule, reactHooksModuleName } from './module';\nexport * from '@reduxjs/toolkit/query';\nexport { ApiProvider } from './ApiProvider';\nconst createApi = /* @__PURE__ */buildCreateApi(coreModule(), reactHooksModule());\nexport type { TypedUseMutationResult, TypedUseQueryHookResult, TypedUseQueryStateResult, TypedUseQuerySubscriptionResult, TypedLazyQueryTrigger, TypedUseLazyQuery, TypedUseMutation, TypedMutationTrigger, TypedQueryStateSelector, TypedUseQueryState, TypedUseQuery, TypedUseQuerySubscription, TypedUseLazyQuerySubscription, TypedUseQueryStateOptions, TypedUseLazyQueryStateResult, TypedUseInfiniteQuery, TypedUseInfiniteQueryHookResult, TypedUseInfiniteQueryStateResult, TypedUseInfiniteQuerySubscriptionResult, TypedUseInfiniteQueryStateOptions, TypedInfiniteQueryStateSelector, TypedUseInfiniteQuerySubscription, TypedUseInfiniteQueryState, TypedLazyInfiniteQueryTrigger } from './buildHooks';\nexport { UNINITIALIZED_VALUE } from './constants';\nexport { createApi, reactHooksModule, reactHooksModuleName };","export { buildCreateApi, coreModule, copyWithStructuralSharing, setupListeners, QueryStatus, skipToken } from '@reduxjs/toolkit/query';","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { Api, BaseQueryFn, EndpointDefinitions, InfiniteQueryDefinition, Module, MutationDefinition, PrefetchOptions, QueryArgFrom, QueryDefinition, QueryKeys } from '@reduxjs/toolkit/query';\nimport { batch as rrBatch, useDispatch as rrUseDispatch, useSelector as rrUseSelector, useStore as rrUseStore } from 'react-redux';\nimport type { CreateSelectorFunction } from 'reselect';\nimport { createSelector as _createSelector } from 'reselect';\nimport { isInfiniteQueryDefinition, isMutationDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { safeAssign } from '../tsHelpers';\nimport { capitalize, countObjectKeys } from '../utils';\nimport type { InfiniteQueryHooks, MutationHooks, QueryHooks } from './buildHooks';\nimport { buildHooks } from './buildHooks';\nimport type { HooksWithUniqueNames } from './namedHooks';\nexport const reactHooksModuleName = /* @__PURE__ */Symbol();\nexport type ReactHooksModule = typeof reactHooksModuleName;\ndeclare module '@reduxjs/toolkit/query' {\n  export interface ApiModules<\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions,\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  ReducerPath extends string,\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  TagTypes extends string> {\n    [reactHooksModuleName]: {\n      /**\n       *  Endpoints based on the input endpoints provided to `createApi`, containing `select`, `hooks` and `action matchers`.\n       */\n      endpoints: { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? QueryHooks<Definitions[K]> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? MutationHooks<Definitions[K]> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryHooks<Definitions[K]> : never };\n      /**\n       * A hook that accepts a string endpoint name, and provides a callback that when called, pre-fetches the data for that endpoint.\n       */\n      usePrefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, options?: PrefetchOptions): (arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions) => void;\n    } & HooksWithUniqueNames<Definitions>;\n  }\n}\ntype RR = typeof import('react-redux');\nexport interface ReactHooksModuleOptions {\n  /**\n   * The hooks from React Redux to be used\n   */\n  hooks?: {\n    /**\n     * The version of the `useDispatch` hook to be used\n     */\n    useDispatch: RR['useDispatch'];\n    /**\n     * The version of the `useSelector` hook to be used\n     */\n    useSelector: RR['useSelector'];\n    /**\n     * The version of the `useStore` hook to be used\n     */\n    useStore: RR['useStore'];\n  };\n  /**\n   * The version of the `batchedUpdates` function to be used\n   */\n  batch?: RR['batch'];\n  /**\n   * Enables performing asynchronous tasks immediately within a render.\n   *\n   * @example\n   *\n   * ```ts\n   * import {\n   *   buildCreateApi,\n   *   coreModule,\n   *   reactHooksModule\n   * } from '@reduxjs/toolkit/query/react'\n   *\n   * const createApi = buildCreateApi(\n   *   coreModule(),\n   *   reactHooksModule({ unstable__sideEffectsInRender: true })\n   * )\n   * ```\n   */\n  unstable__sideEffectsInRender?: boolean;\n  /**\n   * A selector creator (usually from `reselect`, or matching the same signature)\n   */\n  createSelector?: CreateSelectorFunction<any, any, any>;\n}\n\n/**\n * Creates a module that generates react hooks from endpoints, for use with `buildCreateApi`.\n *\n *  @example\n * ```ts\n * const MyContext = React.createContext<ReactReduxContextValue | null>(null);\n * const customCreateApi = buildCreateApi(\n *   coreModule(),\n *   reactHooksModule({\n *     hooks: {\n *       useDispatch: createDispatchHook(MyContext),\n *       useSelector: createSelectorHook(MyContext),\n *       useStore: createStoreHook(MyContext)\n *     }\n *   })\n * );\n * ```\n *\n * @returns A module for use with `buildCreateApi`\n */\nexport const reactHooksModule = ({\n  batch = rrBatch,\n  hooks = {\n    useDispatch: rrUseDispatch,\n    useSelector: rrUseSelector,\n    useStore: rrUseStore\n  },\n  createSelector = _createSelector,\n  unstable__sideEffectsInRender = false,\n  ...rest\n}: ReactHooksModuleOptions = {}): Module<ReactHooksModule> => {\n  if (process.env.NODE_ENV !== 'production') {\n    const hookNames = ['useDispatch', 'useSelector', 'useStore'] as const;\n    let warned = false;\n    for (const hookName of hookNames) {\n      // warn for old hook options\n      if (countObjectKeys(rest) > 0) {\n        if ((rest as Partial<typeof hooks>)[hookName]) {\n          if (!warned) {\n            console.warn('As of RTK 2.0, the hooks now need to be specified as one object, provided under a `hooks` key:' + '\\n`reactHooksModule({ hooks: { useDispatch, useSelector, useStore } })`');\n            warned = true;\n          }\n        }\n        // migrate\n        // @ts-ignore\n        hooks[hookName] = rest[hookName];\n      }\n      // then make sure we have them all\n      if (typeof hooks[hookName] !== 'function') {\n        throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(36) : `When using custom hooks for context, all ${hookNames.length} hooks need to be provided: ${hookNames.join(', ')}.\\nHook ${hookName} was either not provided or not a function.`);\n      }\n    }\n  }\n  return {\n    name: reactHooksModuleName,\n    init(api, {\n      serializeQueryArgs\n    }, context) {\n      const anyApi = api as any as Api<any, Record<string, any>, any, any, ReactHooksModule>;\n      const {\n        buildQueryHooks,\n        buildInfiniteQueryHooks,\n        buildMutationHook,\n        usePrefetch\n      } = buildHooks({\n        api,\n        moduleOptions: {\n          batch,\n          hooks,\n          unstable__sideEffectsInRender,\n          createSelector\n        },\n        serializeQueryArgs,\n        context\n      });\n      safeAssign(anyApi, {\n        usePrefetch\n      });\n      safeAssign(context, {\n        batch\n      });\n      return {\n        injectEndpoint(endpointName, definition) {\n          if (isQueryDefinition(definition)) {\n            const {\n              useQuery,\n              useLazyQuery,\n              useLazyQuerySubscription,\n              useQueryState,\n              useQuerySubscription\n            } = buildQueryHooks(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useQuery,\n              useLazyQuery,\n              useLazyQuerySubscription,\n              useQueryState,\n              useQuerySubscription\n            });\n            (api as any)[`use${capitalize(endpointName)}Query`] = useQuery;\n            (api as any)[`useLazy${capitalize(endpointName)}Query`] = useLazyQuery;\n          }\n          if (isMutationDefinition(definition)) {\n            const useMutation = buildMutationHook(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useMutation\n            });\n            (api as any)[`use${capitalize(endpointName)}Mutation`] = useMutation;\n          } else if (isInfiniteQueryDefinition(definition)) {\n            const {\n              useInfiniteQuery,\n              useInfiniteQuerySubscription,\n              useInfiniteQueryState\n            } = buildInfiniteQueryHooks(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useInfiniteQuery,\n              useInfiniteQuerySubscription,\n              useInfiniteQueryState\n            });\n            (api as any)[`use${capitalize(endpointName)}InfiniteQuery`] = useInfiniteQuery;\n          }\n        }\n      };\n    }\n  };\n};","export function capitalize(str: string) {\n  return str.replace(str[0], str[0].toUpperCase());\n}","// Fast method for counting an object's keys\n// without resorting to `Object.keys(obj).length\n// Will this make a big difference in perf? Probably not\n// But we can save a few allocations.\n\nexport function countObjectKeys(obj: Record<any, any>) {\n  let count = 0;\n  for (const _key in obj) {\n    count++;\n  }\n  return count;\n}","import type { Api } from '@reduxjs/toolkit/query';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { BaseQueryApi, BaseQueryArg, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta, BaseQueryResult, QueryReturnValue } from './baseQueryTypes';\nimport type { CacheCollectionQueryExtraOptions } from './core/buildMiddleware/cacheCollection';\nimport type { CacheLifecycleInfiniteQueryExtraOptions, CacheLifecycleMutationExtraOptions, CacheLifecycleQueryExtraOptions } from './core/buildMiddleware/cacheLifecycle';\nimport type { QueryLifecycleInfiniteQueryExtraOptions, QueryLifecycleMutationExtraOptions, QueryLifecycleQueryExtraOptions } from './core/buildMiddleware/queryLifecycle';\nimport type { InfiniteData, InfiniteQueryConfigOptions, QuerySubState, RootState } from './core/index';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { NEVER } from './fakeBaseQuery';\nimport type { CastAny, HasRequiredProps, MaybePromise, NonUndefined, OmitFromUnion, UnwrapPromise } from './tsHelpers';\nimport { isNotNullish } from './utils';\nimport type { NamedSchemaError } from './standardSchema';\nimport { filterMap } from './utils/filterMap';\nconst rawResultType = /* @__PURE__ */Symbol();\nconst resultType = /* @__PURE__ */Symbol();\nconst baseQuery = /* @__PURE__ */Symbol();\nexport interface SchemaFailureInfo {\n  endpoint: string;\n  arg: any;\n  type: 'query' | 'mutation';\n  queryCacheKey?: string;\n}\nexport type SchemaFailureHandler = (error: NamedSchemaError, info: SchemaFailureInfo) => void;\nexport type SchemaFailureConverter<BaseQuery extends BaseQueryFn> = (error: NamedSchemaError, info: SchemaFailureInfo) => BaseQueryError<BaseQuery>;\nexport type EndpointDefinitionWithQuery<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery>> = {\n  /**\n   * `query` can be a function that returns either a `string` or an `object` which is passed to your `baseQuery`. If you are using [fetchBaseQuery](./fetchBaseQuery), this can return either a `string` or an `object` of properties in `FetchArgs`. If you use your own custom [`baseQuery`](../../rtk-query/usage/customizing-queries), you can customize this behavior to your liking.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"query example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       // highlight-start\n   *       query: () => 'posts',\n   *       // highlight-end\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *      // highlight-start\n   *      query: (body) => ({\n   *        url: `posts`,\n   *        method: 'POST',\n   *        body,\n   *      }),\n   *      // highlight-end\n   *      invalidatesTags: [{ type: 'Post', id: 'LIST' }],\n   *    }),\n   *   })\n   * })\n   * ```\n   */\n  query(arg: QueryArg): BaseQueryArg<BaseQuery>;\n  queryFn?: never;\n  /**\n   * A function to manipulate the data returned by a query or mutation.\n   */\n  transformResponse?(baseQueryReturnValue: RawResultType, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): ResultType | Promise<ResultType>;\n  /**\n   * A function to manipulate the data returned by a failed query or mutation.\n   */\n  transformErrorResponse?(baseQueryReturnValue: BaseQueryError<BaseQuery>, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): unknown;\n\n  /**\n   * A schema for the result *before* it's passed to `transformResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPostName: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawResponseSchema: postSchema,\n   *       transformResponse: (post) => post.name,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawResponseSchema?: StandardSchemaV1<RawResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn`, *before* it's passed to `transformErrorResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import {customBaseQuery, baseQueryErrorSchema} from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawErrorResponseSchema: baseQueryErrorSchema,\n   *       transformErrorResponse: (error) => error.data,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawErrorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n};\nexport type EndpointDefinitionWithQueryFn<QueryArg, BaseQuery extends BaseQueryFn, ResultType> = {\n  /**\n   * Can be used in place of `query` as an inline function that bypasses `baseQuery` completely for the endpoint.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Basic queryFn example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *     }),\n   *     flipCoin: build.query<'heads' | 'tails', void>({\n   *       // highlight-start\n   *       queryFn(arg, queryApi, extraOptions, baseQuery) {\n   *         const randomVal = Math.random()\n   *         if (randomVal < 0.45) {\n   *           return { data: 'heads' }\n   *         }\n   *         if (randomVal < 0.9) {\n   *           return { data: 'tails' }\n   *         }\n   *         return { error: { status: 500, statusText: 'Internal Server Error', data: \"Coin landed on its edge!\" } }\n   *       }\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  queryFn(arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions<BaseQuery>, baseQuery: (arg: Parameters<BaseQuery>[0]) => ReturnType<BaseQuery>): MaybePromise<QueryReturnValue<ResultType, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>>;\n  query?: never;\n  transformResponse?: never;\n  transformErrorResponse?: never;\n  rawResponseSchema?: never;\n  rawErrorResponseSchema?: never;\n};\ntype BaseEndpointTypes<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType> = {\n  QueryArg: QueryArg;\n  BaseQuery: BaseQuery;\n  ResultType: ResultType;\n  RawResultType: RawResultType;\n};\nexport type SchemaType = 'arg' | 'rawResponse' | 'response' | 'rawErrorResponse' | 'errorResponse' | 'meta';\ninterface CommonEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType> {\n  /**\n   * A schema for the arguments to be passed to the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       argSchema: v.object({ id: v.number() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  argSchema?: StandardSchemaV1<QueryArg>;\n\n  /**\n   * A schema for the result (including `transformResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: postSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  responseSchema?: StandardSchemaV1<ResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn` (including `transformErrorResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryErrorSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       errorResponseSchema: baseQueryErrorSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  errorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n\n  /**\n   * A schema for the `meta` property returned by the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryMetaSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       metaSchema: baseQueryMetaSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  metaSchema?: StandardSchemaV1<BaseQueryMeta<BaseQuery>>;\n\n  /**\n   * Defaults to `true`.\n   *\n   * Most apps should leave this setting on. The only time it can be a performance issue\n   * is if an API returns extremely large amounts of data (e.g. 10,000 rows per request) and\n   * you're unable to paginate it.\n   *\n   * For details of how this works, please see the below. When it is set to `false`,\n   * every request will cause subscribed components to rerender, even when the data has not changed.\n   *\n   * @see https://redux-toolkit.js.org/api/other-exports#copywithstructuralsharing\n   */\n  structuralSharing?: boolean;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       onSchemaFailure: (error, info) => {\n   *         console.error(error, info)\n   *       },\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       catchSchemaFailure: (error, info) => ({\n   *         status: \"CUSTOM_ERROR\",\n   *         error: error.schemaName + \" failed validation\",\n   *         data: error.issues,\n   *       }),\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for this endpoint.\n   * Overrides the global setting.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type BaseEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = (([CastAny<BaseQueryResult<BaseQuery>, {}>] extends [NEVER] ? never : EndpointDefinitionWithQuery<QueryArg, BaseQuery, ResultType, RawResultType>) | EndpointDefinitionWithQueryFn<QueryArg, BaseQuery, ResultType>) & CommonEndpointDefinition<QueryArg, BaseQuery, ResultType> & {\n  /* phantom type */\n  [rawResultType]?: RawResultType;\n  /* phantom type */\n  [resultType]?: ResultType;\n  /* phantom type */\n  [baseQuery]?: BaseQuery;\n} & HasRequiredProps<BaseQueryExtraOptions<BaseQuery>, {\n  extraOptions: BaseQueryExtraOptions<BaseQuery>;\n}, {\n  extraOptions?: BaseQueryExtraOptions<BaseQuery>;\n}>;\n\n// NOTE As with QueryStatus in `apiState.ts`, don't use this for real comparisons\n// at runtime, use the string constants defined below.\nexport enum DefinitionType {\n  query = 'query',\n  mutation = 'mutation',\n  infinitequery = 'infinitequery',\n}\nexport const ENDPOINT_QUERY = DefinitionType.query;\nexport const ENDPOINT_MUTATION = DefinitionType.mutation;\nexport const ENDPOINT_INFINITEQUERY = DefinitionType.infinitequery;\ntype TagDescriptionArray<TagTypes extends string> = ReadonlyArray<TagDescription<TagTypes> | undefined | null>;\nexport type GetResultDescriptionFn<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = (result: ResultType | undefined, error: ErrorType | undefined, arg: QueryArg, meta: MetaType) => TagDescriptionArray<TagTypes>;\nexport type FullTagDescription<TagType> = {\n  type: TagType;\n  id?: number | string;\n};\nexport type TagDescription<TagType> = TagType | FullTagDescription<TagType>;\n\n/**\n * @public\n */\nexport type ResultDescription<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = TagDescriptionArray<TagTypes> | GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>;\ntype QueryTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  QueryDefinition: QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface QueryExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.query;\n\n  /**\n   * Used by `query` endpoints. Determines which 'tag' is attached to the cached data returned by the query.\n   * Expects an array of tag type strings, an array of objects of tag types with ids, or a function that returns such an array.\n   * 1.  `['Post']` - equivalent to `2`\n   * 2.  `[{ type: 'Post' }]` - equivalent to `1`\n   * 3.  `[{ type: 'Post', id: 1 }]`\n   * 4.  `(result, error, arg) => ['Post']` - equivalent to `5`\n   * 5.  `(result, error, arg) => [{ type: 'Post' }]` - equivalent to `4`\n   * 6.  `(result, error, arg) => [{ type: 'Post', id: 1 }]`\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"providesTags example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       // highlight-start\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  providesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * Can be provided to merge an incoming response value into the current cache data.\n   * If supplied, no automatic structural sharing will be applied - it's up to\n   * you to update the cache appropriately.\n   *\n   * Since RTKQ normally replaces cache entries with the new response, you will usually\n   * need to use this with the `serializeQueryArgs` or `forceRefetch` options to keep\n   * an existing cache entry so that it can be updated.\n   *\n   * Since this is wrapped with Immer, you may either mutate the `currentCacheValue` directly,\n   * or return a new value, but _not_ both at once.\n   *\n   * Will only be called if the existing `currentCacheData` is _not_ `undefined` - on first response,\n   * the cache entry will just save the response data directly.\n   *\n   * Useful if you don't want a new request to completely override the current cache value,\n   * maybe because you have manually updated it from another source and don't want those\n   * updates to get lost.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"merge: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  merge?(currentCacheData: ResultType, responseData: ResultType, otherArgs: {\n    arg: QueryArg;\n    baseQueryMeta: BaseQueryMeta<BaseQuery>;\n    requestId: string;\n    fulfilledTimeStamp: number;\n  }): ResultType | void;\n\n  /**\n   * Check to see if the endpoint should force a refetch in cases where it normally wouldn't.\n   * This is primarily useful for \"infinite scroll\" / pagination use cases where\n   * RTKQ is keeping a single cache entry that is added to over time, in combination\n   * with `serializeQueryArgs` returning a fixed cache key and a `merge` callback\n   * set to add incoming data to the cache entry each time.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"forceRefresh: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  forceRefetch?(params: {\n    currentArg: QueryArg | undefined;\n    previousArg: QueryArg | undefined;\n    state: RootState<any, any, string>;\n    endpointState?: QuerySubState<any>;\n  }): boolean;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: QueryTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type QueryDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & QueryExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type InfiniteQueryTypes<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  InfiniteQueryDefinition: InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\nexport interface InfiniteQueryExtraOptions<TagTypes extends string, ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.infinitequery;\n  providesTags?: ResultDescription<TagTypes, InfiniteData<ResultType, PageParam>, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Required options to configure the infinite query behavior.\n   * `initialPageParam` and `getNextPageParam` are required, to\n   * ensure the infinite query can properly fetch the next page of data.\n   * `initialPageParam` may be specified when using the\n   * endpoint, to override the default value.\n   * `maxPages` and `getPreviousPageParam` are both optional.\n   * \n   * @example\n   * \n   * ```ts\n   * // codeblock-meta title=\"infiniteQueryOptions example\"\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * \n   * type Pokemon = {\n   *   id: string\n   *   name: string\n   * }\n   * \n   * const pokemonApi = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),\n   *   endpoints: (build) => ({\n   *     getInfinitePokemonWithMax: build.infiniteQuery<Pokemon[], string, number>({\n   *       infiniteQueryOptions: {\n   *         initialPageParam: 0,\n   *         maxPages: 3,\n   *         getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) =>\n   *           lastPageParam + 1,\n   *         getPreviousPageParam: (\n   *           firstPage,\n   *           allPages,\n   *           firstPageParam,\n   *           allPageParams,\n   *         ) => {\n   *           return firstPageParam > 0 ? firstPageParam - 1 : undefined\n   *         },\n   *       },\n   *       query({pageParam}) {\n   *         return `https://example.com/listItems?page=${pageParam}`\n   *       },\n   *     }),\n   *   }),\n   * })\n   \n   * ```\n   */\n  infiniteQueryOptions: InfiniteQueryConfigOptions<ResultType, PageParam, QueryArg>;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: InfiniteQueryTypes<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> =\n// Infinite query endpoints receive `{queryArg, pageParam}`\nBaseEndpointDefinition<InfiniteQueryCombinedArg<QueryArg, PageParam>, BaseQuery, ResultType, RawResultType> & InfiniteQueryExtraOptions<TagTypes, ResultType, QueryArg, PageParam, BaseQuery, ReducerPath, RawResultType>;\ntype MutationTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseMutation<typeof api.endpoints.query.Types.MutationDefinition> = ...\n   * ```\n   */\n  MutationDefinition: MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface MutationExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath> {\n  type: DefinitionType.mutation;\n\n  /**\n   * Used by `mutation` endpoints. Determines which cached data should be either re-fetched or removed from the cache.\n   * Expects the same shapes as `providesTags`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"invalidatesTags example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *       query(body) {\n   *         return {\n   *           url: `posts`,\n   *           method: 'POST',\n   *           body,\n   *         }\n   *       },\n   *       // highlight-start\n   *       invalidatesTags: [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  invalidatesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A mutation should not provide tags to the cache.\n   */\n  providesTags?: never;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: MutationTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type MutationDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & MutationExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type EndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, PageParam = any, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\nexport type EndpointDefinitions = Record<string, EndpointDefinition<any, any, any, any, any, any, any>>;\nexport function isQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is QueryDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_QUERY;\n}\nexport function isMutationDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is MutationDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_MUTATION;\n}\nexport function isInfiniteQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is InfiniteQueryDefinition<any, any, any, any, any, any, any> {\n  return e.type === ENDPOINT_INFINITEQUERY;\n}\nexport function isAnyQueryDefinition(e: EndpointDefinition<any, any, any, any>): e is QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any> {\n  return isQueryDefinition(e) || isInfiniteQueryDefinition(e);\n}\nexport type EndpointBuilder<BaseQuery extends BaseQueryFn, TagTypes extends string, ReducerPath extends string> = {\n  /**\n   * An endpoint definition that retrieves data, and may provide tags to the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all query endpoint options\"\n   * const api = createApi({\n   *  baseQuery,\n   *  endpoints: (build) => ({\n   *    getPost: build.query({\n   *      query: (id) => ({ url: `post/${id}` }),\n   *      // Pick out data and prevent nested properties in a hook or selector\n   *      transformResponse: (response) => response.data,\n   *      // Pick out error and prevent nested properties in a hook or selector\n   *      transformErrorResponse: (response) => response.error,\n   *      // `result` is the server response\n   *      providesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry, updateCachedData }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry, updateCachedData }) {},\n   *    }),\n   *  }),\n   *});\n   *```\n   */\n  query<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n\n  /**\n   * An endpoint definition that alters data on the server or will possibly invalidate the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all mutation endpoint options\"\n   * const api = createApi({\n   *   baseQuery,\n   *   endpoints: (build) => ({\n   *     updatePost: build.mutation({\n   *       query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),\n   *       // Pick out data and prevent nested properties in a hook or selector\n   *       transformResponse: (response) => response.data,\n   *       // Pick out error and prevent nested properties in a hook or selector\n   *       transformErrorResponse: (response) => response.error,\n   *       // `result` is the server response\n   *       invalidatesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry }) {},\n   *     }),\n   *   }),\n   * });\n   * ```\n   */\n  mutation<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n  infiniteQuery<ResultType, QueryArg, PageParam, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n};\nexport type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T;\nexport function calculateProvidedBy<ResultType, QueryArg, ErrorType, MetaType>(description: ResultDescription<string, ResultType, QueryArg, ErrorType, MetaType> | undefined, result: ResultType | undefined, error: ErrorType | undefined, queryArg: QueryArg, meta: MetaType | undefined, assertTagTypes: AssertTagTypes): readonly FullTagDescription<string>[] {\n  const finalDescription = isFunction(description) ? description(result as ResultType, error as undefined, queryArg, meta as MetaType) : description;\n  if (finalDescription) {\n    return filterMap(finalDescription, isNotNullish, tag => assertTagTypes(expandTagDescription(tag)));\n  }\n  return [];\n}\nfunction isFunction<T>(t: T): t is Extract<T, Function> {\n  return typeof t === 'function';\n}\nexport function expandTagDescription(description: TagDescription<string>): FullTagDescription<string> {\n  return typeof description === 'string' ? {\n    type: description\n  } : description;\n}\nexport type QueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<infer QA, any, any, any> ? QA : never;\n\n// Just extracting `QueryArg` from `BaseEndpointDefinition`\n// doesn't sufficiently match here.\n// We need to explicitly match against `InfiniteQueryDefinition`\nexport type InfiniteQueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<infer QA, any, any, any, any, any, any> ? QA : never;\nexport type QueryArgFromAnyQuery<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any, any, any> ? InfiniteQueryArgFrom<D> : D extends QueryDefinition<any, any, any, any, any, any> ? QueryArgFrom<D> : never;\nexport type ResultTypeFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<any, any, infer RT, any> ? RT : unknown;\nexport type ReducerPathFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, any, any, infer RP, any, any> ? RP : unknown;\nexport type TagTypesFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, infer TT, any, any, any, any> ? TT : unknown;\nexport type PageParamFrom<D extends InfiniteQueryDefinition<any, any, any, any, any, any, any>> = D extends InfiniteQueryDefinition<any, infer PP, any, any, any, any, any> ? PP : unknown;\nexport type InfiniteQueryCombinedArg<QueryArg, PageParam> = {\n  queryArg: QueryArg;\n  pageParam: PageParam;\n};\nexport type TagTypesFromApi<T> = T extends Api<any, any, any, infer TagTypes> ? TagTypes : never;\nexport type DefinitionsFromApi<T> = T extends Api<any, infer Definitions, any, any> ? Definitions : never;\nexport type TransformedResponse<NewDefinitions extends EndpointDefinitions, K, ResultType> = K extends keyof NewDefinitions ? NewDefinitions[K]['transformResponse'] extends undefined ? ResultType : UnwrapPromise<ReturnType<NonUndefined<NewDefinitions[K]['transformResponse']>>> : ResultType;\nexport type OverrideResultType<Definition, NewResultType> = Definition extends QueryDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends MutationDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, NewResultType, ReducerPath> : never;\nexport type UpdateDefinitions<Definitions extends EndpointDefinitions, NewTagTypes extends string, NewDefinitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends MutationDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : never };","export type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type Override<T1, T2> = T2 extends any ? Omit<T1, keyof T2> & T2 : never;\nexport function assertCast<T>(v: any): asserts v is T {}\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>): T {\n  return Object.assign(target, ...args);\n}\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\nexport type NonOptionalKeys<T> = { [K in keyof T]-?: undefined extends T[K] ? never : K }[keyof T];\nexport type HasRequiredProps<T, True, False> = NonOptionalKeys<T> extends never ? False : True;\nexport type OptionalIfAllPropsOptional<T> = HasRequiredProps<T, T, T | never>;\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type UnwrapPromise<T> = T extends PromiseLike<infer V> ? V : T;\nexport type MaybePromise<T> = T | PromiseLike<T>;\nexport type OmitFromUnion<T, K extends keyof T> = T extends any ? Omit<T, K> : never;\nexport type IsAny<T, True, False = never> = true | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;","import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3 } from \"@reduxjs/toolkit\";\nimport type { Selector, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { Api, ApiContext, ApiEndpointInfiniteQuery, ApiEndpointMutation, ApiEndpointQuery, BaseQueryFn, CoreModule, EndpointDefinitions, InfiniteQueryActionCreatorResult, InfiniteQueryArgFrom, InfiniteQueryDefinition, InfiniteQueryResultSelectorResult, InfiniteQuerySubState, MutationActionCreatorResult, MutationDefinition, MutationResultSelectorResult, PageParamFrom, PrefetchOptions, QueryActionCreatorResult, QueryArgFrom, QueryCacheKey, QueryDefinition, QueryKeys, QueryResultSelectorResult, QuerySubState, ResultTypeFrom, RootState, SerializeQueryArgs, SkipToken, SubscriptionOptions, TSHelpersId, TSHelpersNoInfer, TSHelpersOverride } from '@reduxjs/toolkit/query';\nimport { QueryStatus, skipToken } from './rtkqImports';\nimport type { DependencyList } from 'react';\nimport { useCallback, useDebugValue, useEffect, useLayoutEffect, useMemo, useRef, useState } from './reactImports';\nimport { shallowEqual } from './reactReduxImports';\nimport type { SubscriptionSelectors } from '../core/buildMiddleware/index';\nimport type { InfiniteData, InfiniteQueryConfigOptions } from '../core/index';\nimport type { UninitializedValue } from './constants';\nimport { UNINITIALIZED_VALUE } from './constants';\nimport type { ReactHooksModuleOptions } from './module';\nimport { useStableQueryArgs } from './useSerializedStableValue';\nimport { useShallowStableValue } from './useShallowStableValue';\nimport type { InfiniteQueryDirection } from '../core/apiState';\nimport { isInfiniteQueryDefinition } from '../endpointDefinitions';\nimport type { StartInfiniteQueryActionCreator } from '../core/buildInitiate';\n\n// Copy-pasted from React-Redux\nconst canUseDOM = () => !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\nconst isDOM = /* @__PURE__ */canUseDOM();\n\n// Under React Native, we know that we always want to use useLayoutEffect\n\nconst isRunningInReactNative = () => typeof navigator !== 'undefined' && navigator.product === 'ReactNative';\nconst isReactNative = /* @__PURE__ */isRunningInReactNative();\nconst getUseIsomorphicLayoutEffect = () => isDOM || isReactNative ? useLayoutEffect : useEffect;\nexport const useIsomorphicLayoutEffect = /* @__PURE__ */getUseIsomorphicLayoutEffect();\nexport type QueryHooks<Definition extends QueryDefinition<any, any, any, any, any>> = {\n  useQuery: UseQuery<Definition>;\n  useLazyQuery: UseLazyQuery<Definition>;\n  useQuerySubscription: UseQuerySubscription<Definition>;\n  useLazyQuerySubscription: UseLazyQuerySubscription<Definition>;\n  useQueryState: UseQueryState<Definition>;\n};\nexport type InfiniteQueryHooks<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  useInfiniteQuery: UseInfiniteQuery<Definition>;\n  useInfiniteQuerySubscription: UseInfiniteQuerySubscription<Definition>;\n  useInfiniteQueryState: UseInfiniteQueryState<Definition>;\n};\nexport type MutationHooks<Definition extends MutationDefinition<any, any, any, any, any>> = {\n  useMutation: UseMutation<Definition>;\n};\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.\n *\n * This hook combines the functionality of both [`useQueryState`](#usequerystate) and [`useQuerySubscription`](#usequerysubscription) together, and is intended to be used in the majority of situations.\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseQuery<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(arg: QueryArgFrom<D> | SkipToken, options?: UseQuerySubscriptionOptions & UseQueryStateOptions<D, R>) => UseQueryHookResult<D, R>;\nexport type TypedUseQuery<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuery<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseQueryHookResult<D extends QueryDefinition<any, any, any, any>, R = UseQueryStateDefaultResult<D>> = UseQueryStateResult<D, R> & UseQuerySubscriptionResult<D>;\n\n/**\n * Helper type to manually type the result\n * of the `useQuery` hook in userland code.\n */\nexport type TypedUseQueryHookResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = TypedUseQueryStateResult<ResultType, QueryArg, BaseQuery, R> & TypedUseQuerySubscriptionResult<ResultType, QueryArg, BaseQuery>;\nexport type UseQuerySubscriptionOptions = SubscriptionOptions & {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When `skip` is true (or `skipToken` is passed in as `arg`):\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```tsx\n   * // codeblock-meta no-transpile title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n};\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useQuery`](#usequery) or [`useQueryState`](#usequerystate).\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n */\nexport type UseQuerySubscription<D extends QueryDefinition<any, any, any, any>> = (arg: QueryArgFrom<D> | SkipToken, options?: UseQuerySubscriptionOptions) => UseQuerySubscriptionResult<D>;\nexport type TypedUseQuerySubscription<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuerySubscription<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseQuerySubscriptionResult<D extends QueryDefinition<any, any, any, any>> = Pick<QueryActionCreatorResult<D>, 'refetch'>;\n\n/**\n * Helper type to manually type the result\n * of the `useQuerySubscription` hook in userland code.\n */\nexport type TypedUseQuerySubscriptionResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuerySubscriptionResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseLazyQueryLastPromiseInfo<D extends QueryDefinition<any, any, any, any>> = {\n  lastArg: QueryArgFrom<D>;\n};\n\n/**\n * A React hook similar to [`useQuery`](#usequery), but with manual control over when the data fetching occurs.\n *\n * This hook includes the functionality of [`useLazyQuerySubscription`](#uselazyquerysubscription).\n *\n * #### Features\n *\n * - Manual control over firing a request to retrieve data\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once\n *\n * #### Note\n *\n * When the trigger function returned from a LazyQuery is called, it always initiates a new request to the server even if there is cached data. Set `preferCacheValue`(the second argument to the function) as `true` if you want it to immediately return a cached value if one exists.\n */\nexport type UseLazyQuery<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(options?: SubscriptionOptions & Omit<UseQueryStateOptions<D, R>, 'skip'>) => [LazyQueryTrigger<D>, UseLazyQueryStateResult<D, R>, UseLazyQueryLastPromiseInfo<D>];\nexport type TypedUseLazyQuery<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseLazyQuery<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseLazyQueryStateResult<D extends QueryDefinition<any, any, any, any>, R = UseQueryStateDefaultResult<D>> = UseQueryStateResult<D, R> & {\n  /**\n   * Resets the hook state to its initial `uninitialized` state.\n   * This will also remove the last result from the cache.\n   */\n  reset: () => void;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useLazyQuery` hook in userland code.\n */\nexport type TypedUseLazyQueryStateResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseLazyQueryStateResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>, R>;\nexport type LazyQueryTrigger<D extends QueryDefinition<any, any, any, any>> = {\n  /**\n   * Triggers a lazy query.\n   *\n   * By default, this will start a new request even if there is already a value in the cache.\n   * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a lazy query, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await getUserById(1).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>, preferCacheValue?: boolean): QueryActionCreatorResult<D>;\n};\nexport type TypedLazyQueryTrigger<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = LazyQueryTrigger<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook similar to [`useQuerySubscription`](#usequerysubscription), but with manual control over when the data fetching occurs.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useLazyQuery`](#uselazyquery).\n *\n * #### Features\n *\n * - Manual control over firing a request to retrieve data\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once\n */\nexport type UseLazyQuerySubscription<D extends QueryDefinition<any, any, any, any>> = (options?: SubscriptionOptions) => readonly [LazyQueryTrigger<D>, QueryArgFrom<D> | UninitializedValue, {\n  reset: () => void;\n}];\nexport type TypedUseLazyQuerySubscription<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseLazyQuerySubscription<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * @internal\n */\nexport type QueryStateSelector<R extends Record<string, any>, D extends QueryDefinition<any, any, any, any>> = (state: UseQueryStateDefaultResult<D>) => R;\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryStateSelector} for use with a specific query.\n * This is useful for scenarios where you want to create a \"pre-typed\"\n * {@linkcode UseQueryStateOptions.selectFromResult | selectFromResult}\n * function.\n *\n * @example\n * <caption>#### __Create a strongly-typed `selectFromResult` selector function__</caption>\n *\n * ```tsx\n * import type { TypedQueryStateSelector } from '@reduxjs/toolkit/query/react'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n *\n * type Post = {\n *   id: number\n *   title: string\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = number | undefined\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * type SelectedResult = Pick<PostsApiResponse, 'posts'>\n *\n * const postsApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com/posts' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, QueryArgument>({\n *       query: (limit = 5) => `?limit=${limit}&select=title`,\n *     }),\n *   }),\n * })\n *\n * const { useGetPostsQuery } = postsApiSlice\n *\n * function PostById({ id }: { id: number }) {\n *   const { post } = useGetPostsQuery(undefined, {\n *     selectFromResult: (state) => ({\n *       post: state.data?.posts.find((post) => post.id === id),\n *     }),\n *   })\n *\n *   return <li>{post?.title}</li>\n * }\n *\n * const EMPTY_ARRAY: Post[] = []\n *\n * const typedSelectFromResult: TypedQueryStateSelector<\n *   PostsApiResponse,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   SelectedResult\n * > = (state) => ({ posts: state.data?.posts ?? EMPTY_ARRAY })\n *\n * function PostsList() {\n *   const { posts } = useGetPostsQuery(undefined, {\n *     selectFromResult: typedSelectFromResult,\n *   })\n *\n *   return (\n *     <div>\n *       <ul>\n *         {posts.map((post) => (\n *           <PostById key={post.id} id={post.id} />\n *         ))}\n *       </ul>\n *     </div>\n *   )\n * }\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template SelectedResultType - The type of the selected result returned by the __`selectFromResult`__ function.\n *\n * @since 2.3.0\n * @public\n */\nexport type TypedQueryStateSelector<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, SelectedResultType extends Record<string, any> = UseQueryStateDefaultResult<QueryDefinition<QueryArgumentType, BaseQueryFunctionType, string, ResultType, string>>> = QueryStateSelector<SelectedResultType, QueryDefinition<QueryArgumentType, BaseQueryFunctionType, string, ResultType, string>>;\n\n/**\n * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * Note that this hook does not trigger fetching new data. For that use-case, see [`useQuery`](#usequery) or [`useQuerySubscription`](#usequerysubscription).\n *\n * #### Features\n *\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseQueryState<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(arg: QueryArgFrom<D> | SkipToken, options?: UseQueryStateOptions<D, R>) => UseQueryStateResult<D, R>;\nexport type TypedUseQueryState<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQueryState<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * @internal\n */\nexport type UseQueryStateOptions<D extends QueryDefinition<any, any, any, any>, R extends Record<string, any>> = {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When skip is true:\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after skipping the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.\n   * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.\n   * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using selectFromResult to extract a single result\"\n   * function PostsList() {\n   *   const { data: posts } = api.useGetPostsQuery();\n   *\n   *   return (\n   *     <ul>\n   *       {posts?.data?.map((post) => (\n   *         <PostById key={post.id} id={post.id} />\n   *       ))}\n   *     </ul>\n   *   );\n   * }\n   *\n   * function PostById({ id }: { id: number }) {\n   *   // Will select the post with the given id, and will only rerender if the given posts data changes\n   *   const { post } = api.useGetPostsQuery(undefined, {\n   *     selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),\n   *   });\n   *\n   *   return <li>{post?.name}</li>;\n   * }\n   * ```\n   */\n  selectFromResult?: QueryStateSelector<R, D>;\n};\n\n/**\n * Provides a way to define a \"pre-typed\" version of\n * {@linkcode UseQueryStateOptions} with specific options for a given query.\n * This is particularly useful for setting default query behaviors such as\n * refetching strategies, which can be overridden as needed.\n *\n * @example\n * <caption>#### __Create a `useQuery` hook with default options__</caption>\n *\n * ```ts\n * import type {\n *   SubscriptionOptions,\n *   TypedUseQueryStateOptions,\n * } from '@reduxjs/toolkit/query/react'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n *\n * type Post = {\n *   id: number\n *   name: string\n * }\n *\n * const api = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n *   tagTypes: ['Post'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<Post[], void>({\n *       query: () => 'posts',\n *     }),\n *   }),\n * })\n *\n * const { useGetPostsQuery } = api\n *\n * export const useGetPostsQueryWithDefaults = <\n *   SelectedResult extends Record<string, any>,\n * >(\n *   overrideOptions: TypedUseQueryStateOptions<\n *     Post[],\n *     void,\n *     ReturnType<typeof fetchBaseQuery>,\n *     SelectedResult\n *   > &\n *     SubscriptionOptions,\n * ) =>\n *   useGetPostsQuery(undefined, {\n *     // Insert default options here\n *\n *     refetchOnMountOrArgChange: true,\n *     refetchOnFocus: true,\n *     ...overrideOptions,\n *   })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArg - The type of the argument passed into the query.\n * @template BaseQuery - The type of the base query function being used.\n * @template SelectedResult - The type of the selected result returned by the __`selectFromResult`__ function.\n *\n * @since 2.2.8\n * @public\n */\nexport type TypedUseQueryStateOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseQueryStateOptions<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>, SelectedResult>;\nexport type UseQueryStateResult<_ extends QueryDefinition<any, any, any, any>, R> = TSHelpersNoInfer<R>;\n\n/**\n * Helper type to manually type the result\n * of the `useQueryState` hook in userland code.\n */\nexport type TypedUseQueryStateResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = TSHelpersNoInfer<R>;\ntype UseQueryStateBaseResult<D extends QueryDefinition<any, any, any, any>> = QuerySubState<D> & {\n  /**\n   * Where `data` tries to hold data as much as possible, also re-using\n   * data from the last arguments passed into the hook, this property\n   * will always contain the received data from the query, for the current query arguments.\n   */\n  currentData?: ResultTypeFrom<D>;\n  /**\n   * Query has not started yet.\n   */\n  isUninitialized: false;\n  /**\n   * Query is currently loading for the first time. No data yet.\n   */\n  isLoading: false;\n  /**\n   * Query is currently fetching, but might have data from an earlier request.\n   */\n  isFetching: false;\n  /**\n   * Query has data from a successful load.\n   */\n  isSuccess: false;\n  /**\n   * Query is currently in \"error\" state.\n   */\n  isError: false;\n};\ntype UseQueryStateUninitialized<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<Extract<UseQueryStateBaseResult<D>, {\n  status: QueryStatus.uninitialized;\n}>, {\n  isUninitialized: true;\n}>;\ntype UseQueryStateLoading<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isLoading: true;\n  isFetching: boolean;\n  data: undefined;\n}>;\ntype UseQueryStateSuccessFetching<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isSuccess: true;\n  isFetching: true;\n  error: undefined;\n} & {\n  data: ResultTypeFrom<D>;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'fulfilledTimeStamp'>>>;\ntype UseQueryStateSuccessNotFetching<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isSuccess: true;\n  isFetching: false;\n  error: undefined;\n} & {\n  data: ResultTypeFrom<D>;\n  currentData: ResultTypeFrom<D>;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'fulfilledTimeStamp'>>>;\ntype UseQueryStateError<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isError: true;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'error'>>>;\ntype UseQueryStateDefaultResult<D extends QueryDefinition<any, any, any, any>> = TSHelpersId<UseQueryStateUninitialized<D> | UseQueryStateLoading<D> | UseQueryStateSuccessFetching<D> | UseQueryStateSuccessNotFetching<D> | UseQueryStateError<D>> & {\n  /**\n   * @deprecated Included for completeness, but discouraged.\n   * Please use the `isLoading`, `isFetching`, `isSuccess`, `isError`\n   * and `isUninitialized` flags instead\n   */\n  status: QueryStatus;\n};\nexport type LazyInfiniteQueryTrigger<D extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  /**\n   * Triggers a lazy query.\n   *\n   * By default, this will start a new request even if there is already a value in the cache.\n   * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a lazy query, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await getUserById(1).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>, direction: InfiniteQueryDirection): InfiniteQueryActionCreatorResult<D>;\n};\nexport type TypedLazyInfiniteQueryTrigger<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = LazyInfiniteQueryTrigger<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type UseInfiniteQuerySubscriptionOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>> = SubscriptionOptions & {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When `skip` is true (or `skipToken` is passed in as `arg`):\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```tsx\n   * // codeblock-meta no-transpile title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n  initialPageParam?: PageParamFrom<D>;\n  /**\n   * Defaults to `true`. When this is `true` and an infinite query endpoint is refetched\n   * (due to tag invalidation, polling, arg change configuration, or manual refetching),\n   * RTK Query will try to sequentially refetch all pages currently in the cache.\n   * When `false` only the first page will be refetched.\n   *\n   * This option applies to all automatic refetches for this subscription (polling, tag invalidation, etc.).\n   * It can be overridden on a per-call basis using the `refetch()` method.\n   */\n  refetchCachedPages?: boolean;\n};\nexport type TypedUseInfiniteQuerySubscription<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuerySubscription<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type UseInfiniteQuerySubscriptionResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  refetch: (options?: Pick<UseInfiniteQuerySubscriptionOptions<D>, 'refetchCachedPages'>) => InfiniteQueryActionCreatorResult<D>;\n  trigger: LazyInfiniteQueryTrigger<D>;\n  fetchNextPage: () => InfiniteQueryActionCreatorResult<D>;\n  fetchPreviousPage: () => InfiniteQueryActionCreatorResult<D>;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useQuerySubscription` hook in userland code.\n */\nexport type TypedUseInfiniteQuerySubscriptionResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuerySubscriptionResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type InfiniteQueryStateSelector<R extends Record<string, any>, D extends InfiniteQueryDefinition<any, any, any, any, any>> = (state: UseInfiniteQueryStateDefaultResult<D>) => R;\nexport type TypedInfiniteQueryStateSelector<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = InfiniteQueryStateSelector<SelectedResult, InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.  Additionally, it will cache multiple \"pages\" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.\n *\n *  The `data` field will be a `{pages: Data[], pageParams: PageParam[]}` structure containing all fetched page responses and the corresponding page param values for each page. You may use this to render individual pages, combine all pages into a single infinite list, or other display logic as needed.\n *\n * This hook combines the functionality of both [`useInfiniteQueryState`](#useinfinitequerystate) and [`useInfiniteQuerySubscription`](#useinfinitequerysubscription) together, and is intended to be used in the majority of situations.\n *\n * As with normal query hooks, `skipToken` is a valid argument that will skip the query from executing.\n *\n * By default, the initial request will use the `initialPageParam` value that was defined on the infinite query endpoint. If you want to start from a different value, you can pass `initialPageParam` as part of the hook options to override that initial request value.\n *\n * Use the returned `fetchNextPage` and `fetchPreviousPage` methods on the hook result object to trigger fetches forwards and backwards. These will always calculate the next or previous page param based on the current cached pages and the provided `getNext/PreviousPageParam` callbacks defined in the endpoint.\n *\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseInfiniteQuery<D extends InfiniteQueryDefinition<any, any, any, any, any>> = <R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<D>>(arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQuerySubscriptionOptions<D> & UseInfiniteQueryStateOptions<D, R>) => UseInfiniteQueryHookResult<D, R> & Pick<UseInfiniteQuerySubscriptionResult<D>, 'fetchNextPage' | 'fetchPreviousPage'>;\nexport type TypedUseInfiniteQuery<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuery<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * Note that this hook does not trigger fetching new data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQuerySubscription`](#useinfinitequerysubscription).\n *\n * #### Features\n *\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseInfiniteQueryState<D extends InfiniteQueryDefinition<any, any, any, any, any>> = <R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<D>>(arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQueryStateOptions<D, R>) => UseInfiniteQueryStateResult<D, R>;\nexport type TypedUseInfiniteQueryState<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQueryState<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data. Additionally, it will cache multiple \"pages\" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQueryState`](#useinfinitequerystate).\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n */\nexport type UseInfiniteQuerySubscription<D extends InfiniteQueryDefinition<any, any, any, any, any>> = (arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQuerySubscriptionOptions<D>) => UseInfiniteQuerySubscriptionResult<D>;\nexport type UseInfiniteQueryHookResult<D extends InfiniteQueryDefinition<any, any, any, any, any>, R = UseInfiniteQueryStateDefaultResult<D>> = UseInfiniteQueryStateResult<D, R> & Pick<UseInfiniteQuerySubscriptionResult<D>, 'refetch' | 'fetchNextPage' | 'fetchPreviousPage'>;\nexport type TypedUseInfiniteQueryHookResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryHookResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, R>;\nexport type UseInfiniteQueryStateOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>, R extends Record<string, any>> = {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When skip is true:\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after skipping the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.\n   * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.\n   * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.\n   * Note that this should always return an object (not a primitive), as RTKQ adds fields to the return value.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using selectFromResult to extract a single result\"\n   * function PostsList() {\n   *   const { data: posts } = api.useGetPostsQuery();\n   *\n   *   return (\n   *     <ul>\n   *       {posts?.data?.map((post) => (\n   *         <PostById key={post.id} id={post.id} />\n   *       ))}\n   *     </ul>\n   *   );\n   * }\n   *\n   * function PostById({ id }: { id: number }) {\n   *   // Will select the post with the given id, and will only rerender if the given posts data changes\n   *   const { post } = api.useGetPostsQuery(undefined, {\n   *     selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),\n   *   });\n   *\n   *   return <li>{post?.name}</li>;\n   * }\n   * ```\n   */\n  selectFromResult?: InfiniteQueryStateSelector<R, D>;\n};\nexport type TypedUseInfiniteQueryStateOptions<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryStateOptions<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, SelectedResult>;\nexport type UseInfiniteQueryStateResult<D extends InfiniteQueryDefinition<any, any, any, any, any>, R = UseInfiniteQueryStateDefaultResult<D>> = TSHelpersNoInfer<R>;\nexport type TypedUseInfiniteQueryStateResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, R = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryStateResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, R>;\ntype UseInfiniteQueryStateBaseResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = InfiniteQuerySubState<D> & {\n  /**\n   * Where `data` tries to hold data as much as possible, also re-using\n   * data from the last arguments passed into the hook, this property\n   * will always contain the received data from the query, for the current query arguments.\n   */\n  currentData?: InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>;\n  /**\n   * Query has not started yet.\n   */\n  isUninitialized: false;\n  /**\n   * Query is currently loading for the first time. No data yet.\n   */\n  isLoading: false;\n  /**\n   * Query is currently fetching, but might have data from an earlier request.\n   */\n  isFetching: false;\n  /**\n   * Query has data from a successful load.\n   */\n  isSuccess: false;\n  /**\n   * Query is currently in \"error\" state.\n   */\n  isError: false;\n  hasNextPage: boolean;\n  hasPreviousPage: boolean;\n  isFetchingNextPage: boolean;\n  isFetchingPreviousPage: boolean;\n};\ntype UseInfiniteQueryStateDefaultResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = TSHelpersId<TSHelpersOverride<Extract<UseInfiniteQueryStateBaseResult<D>, {\n  status: QueryStatus.uninitialized;\n}>, {\n  isUninitialized: true;\n}> | TSHelpersOverride<UseInfiniteQueryStateBaseResult<D>, {\n  isLoading: true;\n  isFetching: boolean;\n  data: undefined;\n} | ({\n  isSuccess: true;\n  isFetching: true;\n  error: undefined;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp'>>) | ({\n  isSuccess: true;\n  isFetching: false;\n  error: undefined;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp' | 'currentData'>>) | ({\n  isError: true;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'error'>>)>> & {\n  /**\n   * @deprecated Included for completeness, but discouraged.\n   * Please use the `isLoading`, `isFetching`, `isSuccess`, `isError`\n   * and `isUninitialized` flags instead\n   */\n  status: QueryStatus;\n};\nexport type MutationStateSelector<R extends Record<string, any>, D extends MutationDefinition<any, any, any, any>> = (state: MutationResultSelectorResult<D>) => R;\nexport type UseMutationStateOptions<D extends MutationDefinition<any, any, any, any>, R extends Record<string, any>> = {\n  selectFromResult?: MutationStateSelector<R, D>;\n  fixedCacheKey?: string;\n};\nexport type UseMutationStateResult<D extends MutationDefinition<any, any, any, any>, R> = TSHelpersNoInfer<R> & {\n  originalArgs?: QueryArgFrom<D>;\n  /**\n   * Resets the hook state to its initial `uninitialized` state.\n   * This will also remove the last result from the cache.\n   */\n  reset: () => void;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useMutation` hook in userland code.\n */\nexport type TypedUseMutationResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = MutationResultSelectorResult<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseMutationStateResult<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>, R>;\n\n/**\n * A React hook that lets you trigger an update request for a given endpoint, and subscribes the component to read the request status from the Redux store. The component will re-render as the loading status changes.\n *\n * #### Features\n *\n * - Manual control over firing a request to alter data on the server or possibly invalidate the cache\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseMutation<D extends MutationDefinition<any, any, any, any>> = <R extends Record<string, any> = MutationResultSelectorResult<D>>(options?: UseMutationStateOptions<D, R>) => readonly [MutationTrigger<D>, UseMutationStateResult<D, R>];\nexport type TypedUseMutation<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseMutation<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type MutationTrigger<D extends MutationDefinition<any, any, any, any>> = {\n  /**\n   * Triggers the mutation and returns a Promise.\n   * @remarks\n   * If you need to access the error or success payload immediately after a mutation, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await addPost({ id: 1, name: 'Example' }).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>): MutationActionCreatorResult<D>;\n};\nexport type TypedMutationTrigger<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = MutationTrigger<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * Wrapper around `defaultQueryStateSelector` to be used in `useQuery`.\n * We want the initial render to already come back with\n * `{ isUninitialized: false, isFetching: true, isLoading: true }`\n * to prevent that the library user has to do an additional check for `isUninitialized`/\n */\nconst noPendingQueryStateSelector: QueryStateSelector<any, any> = selected => {\n  if (selected.isUninitialized) {\n    return {\n      ...selected,\n      isUninitialized: false,\n      isFetching: true,\n      isLoading: selected.data !== undefined ? false : true,\n      // This is the one place where we still have to use `QueryStatus` as an enum,\n      // since it's the only reference in the React package and not in the core.\n      status: QueryStatus.pending\n    } as any;\n  }\n  return selected;\n};\nfunction pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K> {\n  const ret: any = {};\n  keys.forEach(key => {\n    ret[key] = obj[key];\n  });\n  return ret;\n}\nconst COMMON_HOOK_DEBUG_FIELDS = ['data', 'status', 'isLoading', 'isSuccess', 'isError', 'error'] as const;\ntype GenericPrefetchThunk = (endpointName: any, arg: any, options: PrefetchOptions) => ThunkAction<void, any, any, UnknownAction>;\n\n/**\n *\n * @param opts.api - An API with defined endpoints to create hooks for\n * @param opts.moduleOptions.batch - The version of the `batchedUpdates` function to be used\n * @param opts.moduleOptions.useDispatch - The version of the `useDispatch` hook to be used\n * @param opts.moduleOptions.useSelector - The version of the `useSelector` hook to be used\n * @returns An object containing functions to generate hooks based on an endpoint\n */\nexport function buildHooks<Definitions extends EndpointDefinitions>({\n  api,\n  moduleOptions: {\n    batch,\n    hooks: {\n      useDispatch,\n      useSelector,\n      useStore\n    },\n    unstable__sideEffectsInRender,\n    createSelector\n  },\n  serializeQueryArgs,\n  context\n}: {\n  api: Api<any, Definitions, any, any, CoreModule>;\n  moduleOptions: Required<ReactHooksModuleOptions>;\n  serializeQueryArgs: SerializeQueryArgs<any>;\n  context: ApiContext<Definitions>;\n}) {\n  const usePossiblyImmediateEffect: (effect: () => void | undefined, deps?: DependencyList) => void = unstable__sideEffectsInRender ? cb => cb() : useEffect;\n  type UnsubscribePromiseRef = React.RefObject<{\n    unsubscribe?: () => void;\n  } | undefined>;\n  const unsubscribePromiseRef = (ref: UnsubscribePromiseRef) => ref.current?.unsubscribe?.();\n  const endpointDefinitions = context.endpointDefinitions;\n  return {\n    buildQueryHooks,\n    buildInfiniteQueryHooks,\n    buildMutationHook,\n    usePrefetch\n  };\n  function queryStatePreSelector(currentState: QueryResultSelectorResult<any>, lastResult: UseQueryStateDefaultResult<any> | undefined, queryArgs: any): UseQueryStateDefaultResult<any> {\n    // if we had a last result and the current result is uninitialized,\n    // we might have called `api.util.resetApiState`\n    // in this case, reset the hook\n    if (lastResult?.endpointName && currentState.isUninitialized) {\n      const {\n        endpointName\n      } = lastResult;\n      const endpointDefinition = endpointDefinitions[endpointName];\n      if (queryArgs !== skipToken && serializeQueryArgs({\n        queryArgs: lastResult.originalArgs,\n        endpointDefinition,\n        endpointName\n      }) === serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      })) lastResult = undefined;\n    }\n\n    // data is the last known good request result we have tracked - or if none has been tracked yet the last good result for the current args\n    let data = currentState.isSuccess ? currentState.data : lastResult?.data;\n    if (data === undefined) data = currentState.data;\n    const hasData = data !== undefined;\n\n    // isFetching = true any time a request is in flight\n    const isFetching = currentState.isLoading;\n\n    // isLoading = true only when loading while no data is present yet (initial load with no data in the cache)\n    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;\n\n    // isSuccess = true when data is present and we're not refetching after an error.\n    // That includes cases where the _current_ item is either actively\n    // fetching or about to fetch due to an uninitialized entry.\n    const isSuccess = currentState.isSuccess || hasData && (isFetching && !lastResult?.isError || currentState.isUninitialized);\n    return {\n      ...currentState,\n      data,\n      currentData: currentState.data,\n      isFetching,\n      isLoading,\n      isSuccess\n    } as UseQueryStateDefaultResult<any>;\n  }\n  function infiniteQueryStatePreSelector(currentState: InfiniteQueryResultSelectorResult<any>, lastResult: UseInfiniteQueryStateDefaultResult<any> | undefined, queryArgs: any): UseInfiniteQueryStateDefaultResult<any> {\n    // if we had a last result and the current result is uninitialized,\n    // we might have called `api.util.resetApiState`\n    // in this case, reset the hook\n    if (lastResult?.endpointName && currentState.isUninitialized) {\n      const {\n        endpointName\n      } = lastResult;\n      const endpointDefinition = endpointDefinitions[endpointName];\n      if (queryArgs !== skipToken && serializeQueryArgs({\n        queryArgs: lastResult.originalArgs,\n        endpointDefinition,\n        endpointName\n      }) === serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      })) lastResult = undefined;\n    }\n\n    // data is the last known good request result we have tracked - or if none has been tracked yet the last good result for the current args\n    let data = currentState.isSuccess ? currentState.data : lastResult?.data;\n    if (data === undefined) data = currentState.data;\n    const hasData = data !== undefined;\n\n    // isFetching = true any time a request is in flight\n    const isFetching = currentState.isLoading;\n    // isLoading = true only when loading while no data is present yet (initial load with no data in the cache)\n    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;\n    // isSuccess = true when data is present\n    const isSuccess = currentState.isSuccess || isFetching && hasData;\n    return {\n      ...currentState,\n      data,\n      currentData: currentState.data,\n      isFetching,\n      isLoading,\n      isSuccess\n    } as UseInfiniteQueryStateDefaultResult<any>;\n  }\n  function usePrefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, defaultOptions?: PrefetchOptions) {\n    const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n    const stableDefaultOptions = useShallowStableValue(defaultOptions);\n    return useCallback((arg: any, options?: PrefetchOptions) => dispatch((api.util.prefetch as GenericPrefetchThunk)(endpointName, arg, {\n      ...stableDefaultOptions,\n      ...options\n    })), [endpointName, dispatch, stableDefaultOptions]);\n  }\n  function useQuerySubscriptionCommonImpl<T extends QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>(endpointName: string, arg: unknown | SkipToken, {\n    refetchOnReconnect,\n    refetchOnFocus,\n    refetchOnMountOrArgChange,\n    skip = false,\n    pollingInterval = 0,\n    skipPollingIfUnfocused = false,\n    ...rest\n  }: UseQuerySubscriptionOptions = {}) {\n    const {\n      initiate\n    } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n    const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n\n    // TODO: Change this to `useRef<SubscriptionSelectors>(undefined)` after upgrading to React 19.\n    const subscriptionSelectorsRef = useRef<SubscriptionSelectors | undefined>(undefined);\n    if (!subscriptionSelectorsRef.current) {\n      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());\n      if (process.env.NODE_ENV !== 'production') {\n        if (typeof returnedValue !== 'object' || typeof returnedValue?.type === 'string') {\n          throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(37) : `Warning: Middleware for RTK-Query API at reducerPath \"${api.reducerPath}\" has not been added to the store.\n    You must add the middleware for RTK-Query to function correctly!`);\n        }\n      }\n      subscriptionSelectorsRef.current = returnedValue as unknown as SubscriptionSelectors;\n    }\n    const stableArg = useStableQueryArgs(skip ? skipToken : arg);\n    const stableSubscriptionOptions = useShallowStableValue({\n      refetchOnReconnect,\n      refetchOnFocus,\n      pollingInterval,\n      skipPollingIfUnfocused\n    });\n    const initialPageParam = (rest as UseInfiniteQuerySubscriptionOptions<any>).initialPageParam;\n    const stableInitialPageParam = useShallowStableValue(initialPageParam);\n    const refetchCachedPages = (rest as UseInfiniteQuerySubscriptionOptions<any>).refetchCachedPages;\n    const stableRefetchCachedPages = useShallowStableValue(refetchCachedPages);\n\n    /**\n     * @todo Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n     */\n    const promiseRef = useRef<T | undefined>(undefined);\n    let {\n      queryCacheKey,\n      requestId\n    } = promiseRef.current || {};\n\n    // HACK We've saved the middleware subscription lookup callbacks into a ref,\n    // so we can directly check here if the subscription exists for this query.\n    let currentRenderHasSubscription = false;\n    if (queryCacheKey && requestId) {\n      currentRenderHasSubscription = subscriptionSelectorsRef.current.isRequestSubscribed(queryCacheKey, requestId);\n    }\n    const subscriptionRemoved = !currentRenderHasSubscription && promiseRef.current !== undefined;\n    usePossiblyImmediateEffect((): void | undefined => {\n      if (subscriptionRemoved) {\n        promiseRef.current = undefined;\n      }\n    }, [subscriptionRemoved]);\n    usePossiblyImmediateEffect((): void | undefined => {\n      const lastPromise = promiseRef.current;\n      if (typeof process !== 'undefined' && process.env.NODE_ENV === 'removeMeOnCompilation') {\n        // this is only present to enforce the rule of hooks to keep `isSubscribed` in the dependency array\n        console.log(subscriptionRemoved);\n      }\n      if (stableArg === skipToken) {\n        lastPromise?.unsubscribe();\n        promiseRef.current = undefined;\n        return;\n      }\n      const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions;\n      if (!lastPromise || lastPromise.arg !== stableArg) {\n        lastPromise?.unsubscribe();\n        const promise = dispatch(initiate(stableArg, {\n          subscriptionOptions: stableSubscriptionOptions,\n          forceRefetch: refetchOnMountOrArgChange,\n          ...(isInfiniteQueryDefinition(endpointDefinitions[endpointName]) ? {\n            initialPageParam: stableInitialPageParam,\n            refetchCachedPages: stableRefetchCachedPages\n          } : {})\n        }));\n        promiseRef.current = promise as T;\n      } else if (stableSubscriptionOptions !== lastSubscriptionOptions) {\n        lastPromise.updateSubscriptionOptions(stableSubscriptionOptions);\n      }\n    }, [dispatch, initiate, refetchOnMountOrArgChange, stableArg, stableSubscriptionOptions, subscriptionRemoved, stableInitialPageParam, stableRefetchCachedPages, endpointName]);\n    return [promiseRef, dispatch, initiate, stableSubscriptionOptions] as const;\n  }\n  function buildUseQueryState(endpointName: string, preSelector: typeof queryStatePreSelector | typeof infiniteQueryStatePreSelector) {\n    const useQueryState = (arg: any, {\n      skip = false,\n      selectFromResult\n    }: UseQueryStateOptions<any, any> | UseInfiniteQueryStateOptions<any, any> = {}) => {\n      const {\n        select\n      } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n      const stableArg = useStableQueryArgs(skip ? skipToken : arg);\n      type ApiRootState = Parameters<ReturnType<typeof select>>[0];\n      const lastValue = useRef<any>(undefined);\n      const selectDefaultResult: Selector<ApiRootState, any, [any]> = useMemo(() =>\n      // Normally ts-ignores are bad and should be avoided, but we're\n      // already casting this selector to be `Selector<any>` anyway,\n      // so the inconsistencies don't matter here\n      // @ts-ignore\n      createSelector([\n      // @ts-ignore\n      select(stableArg), (_: ApiRootState, lastResult: any) => lastResult, (_: ApiRootState) => stableArg], preSelector, {\n        memoizeOptions: {\n          resultEqualityCheck: shallowEqual\n        }\n      }), [select, stableArg]);\n      const querySelector: Selector<ApiRootState, any, [any]> = useMemo(() => selectFromResult ? createSelector([selectDefaultResult], selectFromResult, {\n        devModeChecks: {\n          identityFunctionCheck: 'never'\n        }\n      }) : selectDefaultResult, [selectDefaultResult, selectFromResult]);\n      const currentState = useSelector((state: RootState<Definitions, any, any>) => querySelector(state, lastValue.current), shallowEqual);\n      const store = useStore<RootState<Definitions, any, any>>();\n      const newLastValue = selectDefaultResult(store.getState(), lastValue.current);\n      useIsomorphicLayoutEffect(() => {\n        lastValue.current = newLastValue;\n      }, [newLastValue]);\n      return currentState;\n    };\n    return useQueryState;\n  }\n  function usePromiseRefUnsubscribeOnUnmount(promiseRef: UnsubscribePromiseRef) {\n    useEffect(() => {\n      return () => {\n        unsubscribePromiseRef(promiseRef)\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n        ;\n        (promiseRef.current as any) = undefined;\n      };\n    }, [promiseRef]);\n  }\n  function refetchOrErrorIfUnmounted<T extends QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>(promiseRef: React.RefObject<T | undefined>): T {\n    if (!promiseRef.current) throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(38) : 'Cannot refetch a query that has not been started yet.');\n    return promiseRef.current.refetch() as T;\n  }\n  function buildQueryHooks(endpointName: string): QueryHooks<any> {\n    const useQuerySubscription: UseQuerySubscription<any> = (arg: any, options = {}) => {\n      const [promiseRef] = useQuerySubscriptionCommonImpl<QueryActionCreatorResult<any>>(endpointName, arg, options);\n      usePromiseRefUnsubscribeOnUnmount(promiseRef);\n      return useMemo(() => ({\n        /**\n         * A method to manually refetch data for the query\n         */\n        refetch: () => refetchOrErrorIfUnmounted(promiseRef)\n      }), [promiseRef]);\n    };\n    const useLazyQuerySubscription: UseLazyQuerySubscription<any> = ({\n      refetchOnReconnect,\n      refetchOnFocus,\n      pollingInterval = 0,\n      skipPollingIfUnfocused = false\n    } = {}) => {\n      const {\n        initiate\n      } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n      const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n      const [arg, setArg] = useState<any>(UNINITIALIZED_VALUE);\n\n      // TODO: Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n      /**\n       * @todo Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n       */\n      const promiseRef = useRef<QueryActionCreatorResult<any> | undefined>(undefined);\n      const stableSubscriptionOptions = useShallowStableValue({\n        refetchOnReconnect,\n        refetchOnFocus,\n        pollingInterval,\n        skipPollingIfUnfocused\n      });\n      usePossiblyImmediateEffect(() => {\n        const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions;\n        if (stableSubscriptionOptions !== lastSubscriptionOptions) {\n          promiseRef.current?.updateSubscriptionOptions(stableSubscriptionOptions);\n        }\n      }, [stableSubscriptionOptions]);\n      const subscriptionOptionsRef = useRef(stableSubscriptionOptions);\n      usePossiblyImmediateEffect(() => {\n        subscriptionOptionsRef.current = stableSubscriptionOptions;\n      }, [stableSubscriptionOptions]);\n      const trigger = useCallback(function (arg: any, preferCacheValue = false) {\n        let promise: QueryActionCreatorResult<any>;\n        batch(() => {\n          unsubscribePromiseRef(promiseRef);\n          promiseRef.current = promise = dispatch(initiate(arg, {\n            subscriptionOptions: subscriptionOptionsRef.current,\n            forceRefetch: !preferCacheValue\n          }));\n          setArg(arg);\n        });\n        return promise!;\n      }, [dispatch, initiate]);\n      const reset = useCallback(() => {\n        if (promiseRef.current?.queryCacheKey) {\n          dispatch(api.internalActions.removeQueryResult({\n            queryCacheKey: promiseRef.current?.queryCacheKey as QueryCacheKey\n          }));\n        }\n      }, [dispatch]);\n\n      /* cleanup on unmount */\n      useEffect(() => {\n        return () => {\n          unsubscribePromiseRef(promiseRef);\n        };\n      }, []);\n\n      /* if \"cleanup on unmount\" was triggered from a fast refresh, we want to reinstate the query */\n      useEffect(() => {\n        if (arg !== UNINITIALIZED_VALUE && !promiseRef.current) {\n          trigger(arg, true);\n        }\n      }, [arg, trigger]);\n      return useMemo(() => [trigger, arg, {\n        reset\n      }] as const, [trigger, arg, reset]);\n    };\n    const useQueryState: UseQueryState<any> = buildUseQueryState(endpointName, queryStatePreSelector);\n    return {\n      useQueryState,\n      useQuerySubscription,\n      useLazyQuerySubscription,\n      useLazyQuery(options) {\n        const [trigger, arg, {\n          reset\n        }] = useLazyQuerySubscription(options);\n        const queryStateResults = useQueryState(arg, {\n          ...options,\n          skip: arg === UNINITIALIZED_VALUE\n        });\n        const info = useMemo(() => ({\n          lastArg: arg\n        }), [arg]);\n        return useMemo(() => [trigger, {\n          ...queryStateResults,\n          reset\n        }, info], [trigger, queryStateResults, reset, info]);\n      },\n      useQuery(arg, options) {\n        const querySubscriptionResults = useQuerySubscription(arg, options);\n        const queryStateResults = useQueryState(arg, {\n          selectFromResult: arg === skipToken || options?.skip ? undefined : noPendingQueryStateSelector,\n          ...options\n        });\n        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS);\n        useDebugValue(debugValue);\n        return useMemo(() => ({\n          ...queryStateResults,\n          ...querySubscriptionResults\n        }), [queryStateResults, querySubscriptionResults]);\n      }\n    };\n  }\n  function buildInfiniteQueryHooks(endpointName: string): InfiniteQueryHooks<any> {\n    const useInfiniteQuerySubscription: UseInfiniteQuerySubscription<any> = (arg: any, options = {}) => {\n      const [promiseRef, dispatch, initiate, stableSubscriptionOptions] = useQuerySubscriptionCommonImpl<InfiniteQueryActionCreatorResult<any>>(endpointName, arg, options);\n      const subscriptionOptionsRef = useRef(stableSubscriptionOptions);\n      usePossiblyImmediateEffect(() => {\n        subscriptionOptionsRef.current = stableSubscriptionOptions;\n      }, [stableSubscriptionOptions]);\n\n      // Extract and stabilize the hook-level refetchCachedPages option\n      const hookRefetchCachedPages = (options as UseInfiniteQuerySubscriptionOptions<any>).refetchCachedPages;\n      const stableHookRefetchCachedPages = useShallowStableValue(hookRefetchCachedPages);\n      const trigger: LazyInfiniteQueryTrigger<any> = useCallback(function (arg: unknown, direction: 'forward' | 'backward') {\n        let promise: InfiniteQueryActionCreatorResult<any>;\n        batch(() => {\n          unsubscribePromiseRef(promiseRef);\n          promiseRef.current = promise = dispatch((initiate as StartInfiniteQueryActionCreator<any>)(arg, {\n            subscriptionOptions: subscriptionOptionsRef.current,\n            direction\n          }));\n        });\n        return promise!;\n      }, [promiseRef, dispatch, initiate]);\n      usePromiseRefUnsubscribeOnUnmount(promiseRef);\n      const stableArg = useStableQueryArgs(options.skip ? skipToken : arg);\n      const refetch = useCallback((options?: Pick<UseInfiniteQuerySubscriptionOptions<any>, 'refetchCachedPages'>) => {\n        if (!promiseRef.current) throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(38) : 'Cannot refetch a query that has not been started yet.');\n        // Merge per-call options with hook-level default\n        const mergedOptions = {\n          refetchCachedPages: options?.refetchCachedPages ?? stableHookRefetchCachedPages\n        };\n        return promiseRef.current.refetch(mergedOptions);\n      }, [promiseRef, stableHookRefetchCachedPages]);\n      return useMemo(() => {\n        const fetchNextPage = () => {\n          return trigger(stableArg, 'forward');\n        };\n        const fetchPreviousPage = () => {\n          return trigger(stableArg, 'backward');\n        };\n        return {\n          trigger,\n          /**\n           * A method to manually refetch data for the query\n           */\n          refetch,\n          fetchNextPage,\n          fetchPreviousPage\n        };\n      }, [refetch, trigger, stableArg]);\n    };\n    const useInfiniteQueryState: UseInfiniteQueryState<any> = buildUseQueryState(endpointName, infiniteQueryStatePreSelector);\n    return {\n      useInfiniteQueryState,\n      useInfiniteQuerySubscription,\n      useInfiniteQuery(arg, options) {\n        const {\n          refetch,\n          fetchNextPage,\n          fetchPreviousPage\n        } = useInfiniteQuerySubscription(arg, options);\n        const queryStateResults = useInfiniteQueryState(arg, {\n          selectFromResult: arg === skipToken || options?.skip ? undefined : noPendingQueryStateSelector,\n          ...options\n        });\n        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS, 'hasNextPage', 'hasPreviousPage');\n        useDebugValue(debugValue);\n        return useMemo(() => ({\n          ...queryStateResults,\n          fetchNextPage,\n          fetchPreviousPage,\n          refetch\n        }), [queryStateResults, fetchNextPage, fetchPreviousPage, refetch]);\n      }\n    };\n  }\n  function buildMutationHook(name: string): UseMutation<any> {\n    return ({\n      selectFromResult,\n      fixedCacheKey\n    } = {}) => {\n      const {\n        select,\n        initiate\n      } = api.endpoints[name] as ApiEndpointMutation<MutationDefinition<any, any, any, any, any>, Definitions>;\n      const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n      const [promise, setPromise] = useState<MutationActionCreatorResult<any>>();\n      useEffect(() => () => {\n        if (!promise?.arg.fixedCacheKey) {\n          promise?.reset();\n        }\n      }, [promise]);\n      const triggerMutation = useCallback(function (arg: Parameters<typeof initiate>['0']) {\n        const promise = dispatch(initiate(arg, {\n          fixedCacheKey\n        }));\n        setPromise(promise);\n        return promise;\n      }, [dispatch, initiate, fixedCacheKey]);\n      const {\n        requestId\n      } = promise || {};\n      const selectDefaultResult = useMemo(() => select({\n        fixedCacheKey,\n        requestId: promise?.requestId\n      }), [fixedCacheKey, promise, select]);\n      const mutationSelector = useMemo((): Selector<RootState<Definitions, any, any>, any> => selectFromResult ? createSelector([selectDefaultResult], selectFromResult) : selectDefaultResult, [selectFromResult, selectDefaultResult]);\n      const currentState = useSelector(mutationSelector, shallowEqual);\n      const originalArgs = fixedCacheKey == null ? promise?.arg.originalArgs : undefined;\n      const reset = useCallback(() => {\n        batch(() => {\n          if (promise) {\n            setPromise(undefined);\n          }\n          if (fixedCacheKey) {\n            dispatch(api.internalActions.removeMutationResult({\n              requestId,\n              fixedCacheKey\n            }));\n          }\n        });\n      }, [dispatch, fixedCacheKey, promise, requestId]);\n      const debugValue = pick(currentState, ...COMMON_HOOK_DEBUG_FIELDS, 'endpointName');\n      useDebugValue(debugValue);\n      const finalState = useMemo(() => ({\n        ...currentState,\n        originalArgs,\n        reset\n      }), [currentState, originalArgs, reset]);\n      return useMemo(() => [triggerMutation, finalState] as const, [triggerMutation, finalState]);\n    };\n  }\n}","export { useEffect, useRef, useMemo, useContext, useCallback, useDebugValue, useLayoutEffect, useState } from 'react';","export { shallowEqual, Provider, ReactReduxContext } from 'react-redux';","export const UNINITIALIZED_VALUE = Symbol();\nexport type UninitializedValue = typeof UNINITIALIZED_VALUE;","import { useEffect, useRef, useMemo } from './reactImports';\nimport { copyWithStructuralSharing } from './rtkqImports';\nexport function useStableQueryArgs<T>(queryArgs: T) {\n  const cache = useRef(queryArgs);\n  const copy = useMemo(() => copyWithStructuralSharing(cache.current, queryArgs), [queryArgs]);\n  useEffect(() => {\n    if (cache.current !== copy) {\n      cache.current = copy;\n    }\n  }, [copy]);\n  return copy;\n}","import { useEffect, useRef } from './reactImports';\nimport { shallowEqual } from './reactReduxImports';\nexport function useShallowStableValue<T>(value: T) {\n  const cache = useRef(value);\n  useEffect(() => {\n    if (!shallowEqual(cache.current, value)) {\n      cache.current = value;\n    }\n  }, [value]);\n  return shallowEqual(cache.current, value) ? cache.current : value;\n}","import { configureStore, formatProdErrorMessage as _formatProdErrorMessage } from '@reduxjs/toolkit';\nimport type { Context } from 'react';\nimport { useContext, useEffect } from './reactImports';\nimport * as React from 'react';\nimport type { ReactReduxContextValue } from 'react-redux';\nimport { Provider, ReactReduxContext } from './reactReduxImports';\nimport { setupListeners } from './rtkqImports';\nimport type { Api } from '@reduxjs/toolkit/query';\n\n/**\n * Can be used as a `Provider` if you **do not already have a Redux store**.\n *\n * @example\n * ```tsx\n * // codeblock-meta no-transpile title=\"Basic usage - wrap your App with ApiProvider\"\n * import * as React from 'react';\n * import { ApiProvider } from '@reduxjs/toolkit/query/react';\n * import { Pokemon } from './features/Pokemon';\n *\n * function App() {\n *   return (\n *     <ApiProvider api={api}>\n *       <Pokemon />\n *     </ApiProvider>\n *   );\n * }\n * ```\n *\n * @remarks\n * Using this together with an existing redux store, both will\n * conflict with each other - please use the traditional redux setup\n * in that case.\n */\nexport function ApiProvider(props: {\n  children: any;\n  api: Api<any, {}, any, any>;\n  setupListeners?: Parameters<typeof setupListeners>[1] | false;\n  context?: Context<ReactReduxContextValue | null>;\n}) {\n  const context = props.context || ReactReduxContext;\n  const existingContext = useContext(context);\n  if (existingContext) {\n    throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(35) : 'Existing Redux context detected. If you already have a store set up, please use the traditional Redux setup.');\n  }\n  const [store] = React.useState(() => configureStore({\n    reducer: {\n      [props.api.reducerPath]: props.api.reducer\n    },\n    middleware: gDM => gDM().concat(props.api.middleware)\n  }));\n  // Adds the event listeners for online/offline/focus/etc\n  useEffect((): undefined | (() => void) => props.setupListeners === false ? undefined : setupListeners(store.dispatch, props.setupListeners), [props.setupListeners, store.dispatch]);\n  return <Provider store={store} context={context}>\n      {props.children}\n    </Provider>;\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA8G;;;ACA9G,IAAAA,kBAAkE;AAElE,IAAAC,sBAAqH;AAErH,sBAAkD;;;ACJ3C,SAAS,WAAW,KAAa;AACtC,SAAO,IAAI,QAAQ,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,YAAY,CAAC;AACjD;;;ACGO,SAAS,gBAAgB,KAAuB;AACrD,MAAI,QAAQ;AACZ,aAAW,QAAQ,KAAK;AACtB;AAAA,EACF;AACA,SAAO;AACT;;;AC8XO,IAAM,iBAAiB;AACvB,IAAM,oBAAoB;AAC1B,IAAM,yBAAyB;AA+c/B,SAAS,kBAAkB,GAA8G;AAC9I,SAAO,EAAE,SAAS;AACpB;AACO,SAAS,qBAAqB,GAAiH;AACpJ,SAAO,EAAE,SAAS;AACpB;AACO,SAAS,0BAA0B,GAA2H;AACnK,SAAO,EAAE,SAAS;AACpB;;;AC91BO,SAAS,WAA6B,WAAc,MAAqC;AAC9F,SAAO,OAAO,OAAO,QAAQ,GAAG,IAAI;AACtC;;;ACNA,qBAA0K;;;ACA1K,mBAA8G;;;ACA9G,yBAA0D;;;ACAnD,IAAM,sBAAsB,OAAO;;;ACEnC,SAAS,mBAAsB,WAAc;AAClD,QAAM,YAAQ,qBAAO,SAAS;AAC9B,QAAM,WAAO,sBAAQ,UAAM,wCAA0B,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YACF,CAAC;AACD,YAAC,IAAY,MAAM,WAAW,YAAY,CAAC,eAAe,IAAI;AAAA,UAChE;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AFxMA,0BAAc,mCALd;;;AaAA,IAAAC,kBAAkF;AAGlF,YAAuB;AA8BhB,SAAS,YAAY,OAKzB;AACD,QAAM,UAAU,MAAM,WAAW;AACjC,QAAM,sBAAkB,yBAAW,OAAO;AAC1C,MAAI,iBAAiB;AACnB,UAAM,IAAI,MAAM,QAAwCC,yBAAwB,EAAE,IAAI,8GAA8G;AAAA,EACtM;AACA,QAAM,CAAC,KAAK,IAAU,eAAS,UAAM,gCAAe;AAAA,IAClD,SAAS;AAAA,MACP,CAAC,MAAM,IAAI,WAAW,GAAG,MAAM,IAAI;AAAA,IACrC;AAAA,IACA,YAAY,SAAO,IAAI,EAAE,OAAO,MAAM,IAAI,UAAU;AAAA,EACtD,CAAC,CAAC;AAEF,8BAAU,MAAgC,MAAM,mBAAmB,QAAQ,aAAY,6BAAe,MAAM,UAAU,MAAM,cAAc,GAAG,CAAC,MAAM,gBAAgB,MAAM,QAAQ,CAAC;AACnL,SAAO,oCAAC,+BAAS,OAAc,WAC1B,MAAM,QACT;AACJ;;;AbhDA,IAAM,YAA2B,qDAAe,yBAAW,GAAG,iBAAiB,CAAC;","names":["import_toolkit","import_react_redux","arg","options","promise","rrBatch","rrUseDispatch","rrUseSelector","rrUseStore","_createSelector","_formatProdErrorMessage","import_toolkit","_formatProdErrorMessage"]}
Index: node_modules/@reduxjs/toolkit/dist/query/react/cjs/rtk-query-react.production.min.cjs
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/react/cjs/rtk-query-react.production.min.cjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/react/cjs/rtk-query-react.production.min.cjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,2 @@
+"use strict";var me=Object.create;var G=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var Pe=Object.getPrototypeOf,Ae=Object.prototype.hasOwnProperty;var he=(e,s)=>{for(var f in s)G(e,f,{get:s[f],enumerable:!0})},$=(e,s,f,D)=>{if(s&&typeof s=="object"||typeof s=="function")for(let U of Be(s))!Ae.call(e,U)&&U!==f&&G(e,U,{get:()=>s[U],enumerable:!(D=Se(s,U))||D.enumerable});return e},O=(e,s,f)=>($(e,s,"default"),f&&$(f,s,"default")),Ie=(e,s,f)=>(f=e!=null?me(Pe(e)):{},$(s||!e||!e.__esModule?G(f,"default",{value:e,enumerable:!0}):f,e)),Ue=e=>$(G({},"__esModule",{value:!0}),e);var E={};he(E,{ApiProvider:()=>Re,UNINITIALIZED_VALUE:()=>K,createApi:()=>Ne,reactHooksModule:()=>ye,reactHooksModuleName:()=>ue});module.exports=Ue(E);var d=require("@reduxjs/toolkit/query");var yt=require("@reduxjs/toolkit"),M=require("react-redux"),le=require("reselect");function W(e){return e.replace(e[0],e[0].toUpperCase())}var be="query",Ee="mutation",ke="infinitequery";function fe(e){return e.type===be}function Qe(e){return e.type===Ee}function Z(e){return e.type===ke}function q(e,...s){return Object.assign(e,...s)}var J=require("@reduxjs/toolkit");var t=require("react");var m=require("react-redux");var K=Symbol();function Y(e){let s=(0,t.useRef)(e),f=(0,t.useMemo)(()=>(0,d.copyWithStructuralSharing)(s.current,e),[e]);return(0,t.useEffect)(()=>{s.current!==f&&(s.current=f)},[f]),f}function C(e){let s=(0,t.useRef)(e);return(0,t.useEffect)(()=>{(0,m.shallowEqual)(s.current,e)||(s.current=e)},[e]),(0,m.shallowEqual)(s.current,e)?s.current:e}var Oe=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Me=Oe(),Fe=()=>typeof navigator<"u"&&navigator.product==="ReactNative",we=Fe(),ve=()=>Me||we?t.useLayoutEffect:t.useEffect,Ce=ve(),ce=e=>e.isUninitialized?{...e,isUninitialized:!1,isFetching:!0,isLoading:e.data===void 0,status:d.QueryStatus.pending}:e;function se(e,...s){let f={};return s.forEach(D=>{f[D]=e[D]}),f}var ae=["data","status","isLoading","isSuccess","isError","error"];function de({api:e,moduleOptions:{batch:s,hooks:{useDispatch:f,useSelector:D,useStore:U},unstable__sideEffectsInRender:b,createSelector:N},serializeQueryArgs:k,context:L}){let F=b?n=>n():t.useEffect,H=n=>n.current?.unsubscribe?.(),V=L.endpointDefinitions;return{buildQueryHooks:re,buildInfiniteQueryHooks:ge,buildMutationHook:Te,usePrefetch:_};function te(n,a,c){if(a?.endpointName&&n.isUninitialized){let{endpointName:y}=a,p=V[y];c!==d.skipToken&&k({queryArgs:a.originalArgs,endpointDefinition:p,endpointName:y})===k({queryArgs:c,endpointDefinition:p,endpointName:y})&&(a=void 0)}let o=n.isSuccess?n.data:a?.data;o===void 0&&(o=n.data);let u=o!==void 0,r=n.isLoading,i=(!a||a.isLoading||a.isUninitialized)&&!u&&r,Q=n.isSuccess||u&&(r&&!a?.isError||n.isUninitialized);return{...n,data:o,currentData:n.data,isFetching:r,isLoading:i,isSuccess:Q}}function B(n,a,c){if(a?.endpointName&&n.isUninitialized){let{endpointName:y}=a,p=V[y];c!==d.skipToken&&k({queryArgs:a.originalArgs,endpointDefinition:p,endpointName:y})===k({queryArgs:c,endpointDefinition:p,endpointName:y})&&(a=void 0)}let o=n.isSuccess?n.data:a?.data;o===void 0&&(o=n.data);let u=o!==void 0,r=n.isLoading,i=(!a||a.isLoading||a.isUninitialized)&&!u&&r,Q=n.isSuccess||r&&u;return{...n,data:o,currentData:n.data,isFetching:r,isLoading:i,isSuccess:Q}}function _(n,a){let c=f(),o=C(a);return(0,t.useCallback)((u,r)=>c(e.util.prefetch(n,u,{...o,...r})),[n,c,o])}function I(n,a,{refetchOnReconnect:c,refetchOnFocus:o,refetchOnMountOrArgChange:u,skip:r=!1,pollingInterval:i=0,skipPollingIfUnfocused:Q=!1,...y}={}){let{initiate:p}=e.endpoints[n],g=f(),P=(0,t.useRef)(void 0);if(!P.current){let v=g(e.internalActions.internal_getRTKQSubscriptions());P.current=v}let l=Y(r?d.skipToken:a),R=C({refetchOnReconnect:c,refetchOnFocus:o,pollingInterval:i,skipPollingIfUnfocused:Q}),x=y.initialPageParam,T=C(x),A=y.refetchCachedPages,h=C(A),S=(0,t.useRef)(void 0),{queryCacheKey:j,requestId:oe}=S.current||{},pe=!1;j&&oe&&(pe=P.current.isRequestSubscribed(j,oe));let ie=!pe&&S.current!==void 0;return F(()=>{ie&&(S.current=void 0)},[ie]),F(()=>{let v=S.current;if(typeof process<"u",l===d.skipToken){v?.unsubscribe(),S.current=void 0;return}let De=S.current?.subscriptionOptions;if(!v||v.arg!==l){v?.unsubscribe();let xe=g(p(l,{subscriptionOptions:R,forceRefetch:u,...Z(V[n])?{initialPageParam:T,refetchCachedPages:h}:{}}));S.current=xe}else R!==De&&v.updateSubscriptionOptions(R)},[g,p,u,l,R,ie,T,h,n]),[S,g,p,R]}function w(n,a){return(o,{skip:u=!1,selectFromResult:r}={})=>{let{select:i}=e.endpoints[n],Q=Y(u?d.skipToken:o),y=(0,t.useRef)(void 0),p=(0,t.useMemo)(()=>N([i(Q),(x,T)=>T,x=>Q],a,{memoizeOptions:{resultEqualityCheck:m.shallowEqual}}),[i,Q]),g=(0,t.useMemo)(()=>r?N([p],r,{devModeChecks:{identityFunctionCheck:"never"}}):p,[p,r]),P=D(x=>g(x,y.current),m.shallowEqual),l=U(),R=p(l.getState(),y.current);return Ce(()=>{y.current=R},[R]),P}}function z(n){(0,t.useEffect)(()=>()=>{H(n),n.current=void 0},[n])}function ne(n){if(!n.current)throw new Error((0,J.formatProdErrorMessage)(38));return n.current.refetch()}function re(n){let a=(u,r={})=>{let[i]=I(n,u,r);return z(i),(0,t.useMemo)(()=>({refetch:()=>ne(i)}),[i])},c=({refetchOnReconnect:u,refetchOnFocus:r,pollingInterval:i=0,skipPollingIfUnfocused:Q=!1}={})=>{let{initiate:y}=e.endpoints[n],p=f(),[g,P]=(0,t.useState)(K),l=(0,t.useRef)(void 0),R=C({refetchOnReconnect:u,refetchOnFocus:r,pollingInterval:i,skipPollingIfUnfocused:Q});F(()=>{let h=l.current?.subscriptionOptions;R!==h&&l.current?.updateSubscriptionOptions(R)},[R]);let x=(0,t.useRef)(R);F(()=>{x.current=R},[R]);let T=(0,t.useCallback)(function(h,S=!1){let j;return s(()=>{H(l),l.current=j=p(y(h,{subscriptionOptions:x.current,forceRefetch:!S})),P(h)}),j},[p,y]),A=(0,t.useCallback)(()=>{l.current?.queryCacheKey&&p(e.internalActions.removeQueryResult({queryCacheKey:l.current?.queryCacheKey}))},[p]);return(0,t.useEffect)(()=>()=>{H(l)},[]),(0,t.useEffect)(()=>{g!==K&&!l.current&&T(g,!0)},[g,T]),(0,t.useMemo)(()=>[T,g,{reset:A}],[T,g,A])},o=w(n,te);return{useQueryState:o,useQuerySubscription:a,useLazyQuerySubscription:c,useLazyQuery(u){let[r,i,{reset:Q}]=c(u),y=o(i,{...u,skip:i===K}),p=(0,t.useMemo)(()=>({lastArg:i}),[i]);return(0,t.useMemo)(()=>[r,{...y,reset:Q},p],[r,y,Q,p])},useQuery(u,r){let i=a(u,r),Q=o(u,{selectFromResult:u===d.skipToken||r?.skip?void 0:ce,...r}),y=se(Q,...ae);return(0,t.useDebugValue)(y),(0,t.useMemo)(()=>({...Q,...i}),[Q,i])}}}function ge(n){let a=(o,u={})=>{let[r,i,Q,y]=I(n,o,u),p=(0,t.useRef)(y);F(()=>{p.current=y},[y]);let g=u.refetchCachedPages,P=C(g),l=(0,t.useCallback)(function(T,A){let h;return s(()=>{H(r),r.current=h=i(Q(T,{subscriptionOptions:p.current,direction:A}))}),h},[r,i,Q]);z(r);let R=Y(u.skip?d.skipToken:o),x=(0,t.useCallback)(T=>{if(!r.current)throw new Error((0,J.formatProdErrorMessage)(38));let A={refetchCachedPages:T?.refetchCachedPages??P};return r.current.refetch(A)},[r,P]);return(0,t.useMemo)(()=>({trigger:l,refetch:x,fetchNextPage:()=>l(R,"forward"),fetchPreviousPage:()=>l(R,"backward")}),[x,l,R])},c=w(n,B);return{useInfiniteQueryState:c,useInfiniteQuerySubscription:a,useInfiniteQuery(o,u){let{refetch:r,fetchNextPage:i,fetchPreviousPage:Q}=a(o,u),y=c(o,{selectFromResult:o===d.skipToken||u?.skip?void 0:ce,...u}),p=se(y,...ae,"hasNextPage","hasPreviousPage");return(0,t.useDebugValue)(p),(0,t.useMemo)(()=>({...y,fetchNextPage:i,fetchPreviousPage:Q,refetch:r}),[y,i,Q,r])}}}function Te(n){return({selectFromResult:a,fixedCacheKey:c}={})=>{let{select:o,initiate:u}=e.endpoints[n],r=f(),[i,Q]=(0,t.useState)();(0,t.useEffect)(()=>()=>{i?.arg.fixedCacheKey||i?.reset()},[i]);let y=(0,t.useCallback)(function(h){let S=r(u(h,{fixedCacheKey:c}));return Q(S),S},[r,u,c]),{requestId:p}=i||{},g=(0,t.useMemo)(()=>o({fixedCacheKey:c,requestId:i?.requestId}),[c,i,o]),P=(0,t.useMemo)(()=>a?N([g],a):g,[a,g]),l=D(P,m.shallowEqual),R=c==null?i?.arg.originalArgs:void 0,x=(0,t.useCallback)(()=>{s(()=>{i&&Q(void 0),c&&r(e.internalActions.removeMutationResult({requestId:p,fixedCacheKey:c}))})},[r,c,i,p]),T=se(l,...ae,"endpointName");(0,t.useDebugValue)(T);let A=(0,t.useMemo)(()=>({...l,originalArgs:R,reset:x}),[l,R,x]);return(0,t.useMemo)(()=>[y,A],[y,A])}}}var ue=Symbol(),ye=({batch:e=M.batch,hooks:s={useDispatch:M.useDispatch,useSelector:M.useSelector,useStore:M.useStore},createSelector:f=le.createSelector,unstable__sideEffectsInRender:D=!1,...U}={})=>({name:ue,init(b,{serializeQueryArgs:N},k){let L=b,{buildQueryHooks:F,buildInfiniteQueryHooks:H,buildMutationHook:V,usePrefetch:te}=de({api:b,moduleOptions:{batch:e,hooks:s,unstable__sideEffectsInRender:D,createSelector:f},serializeQueryArgs:N,context:k});return q(L,{usePrefetch:te}),q(k,{batch:e}),{injectEndpoint(B,_){if(fe(_)){let{useQuery:I,useLazyQuery:w,useLazyQuerySubscription:z,useQueryState:ne,useQuerySubscription:re}=F(B);q(L.endpoints[B],{useQuery:I,useLazyQuery:w,useLazyQuerySubscription:z,useQueryState:ne,useQuerySubscription:re}),b[`use${W(B)}Query`]=I,b[`useLazy${W(B)}Query`]=w}if(Qe(_)){let I=V(B);q(L.endpoints[B],{useMutation:I}),b[`use${W(B)}Mutation`]=I}else if(Z(_)){let{useInfiniteQuery:I,useInfiniteQuerySubscription:w,useInfiniteQueryState:z}=H(B);q(L.endpoints[B],{useInfiniteQuery:I,useInfiniteQuerySubscription:w,useInfiniteQueryState:z}),b[`use${W(B)}InfiniteQuery`]=I}}}}});O(E,require("@reduxjs/toolkit/query"),module.exports);var X=require("@reduxjs/toolkit");var ee=Ie(require("react"));function Re(e){let s=e.context||m.ReactReduxContext;if((0,t.useContext)(s))throw new Error((0,X.formatProdErrorMessage)(35));let[D]=ee.useState(()=>(0,X.configureStore)({reducer:{[e.api.reducerPath]:e.api.reducer},middleware:U=>U().concat(e.api.middleware)}));return(0,t.useEffect)(()=>e.setupListeners===!1?void 0:(0,d.setupListeners)(D.dispatch,e.setupListeners),[e.setupListeners,D.dispatch]),ee.createElement(m.Provider,{store:D,context:s},e.children)}var Ne=(0,d.buildCreateApi)((0,d.coreModule)(),ye());0&&(module.exports={ApiProvider,UNINITIALIZED_VALUE,createApi,reactHooksModule,reactHooksModuleName,...require("@reduxjs/toolkit/query")});
+//# sourceMappingURL=rtk-query-react.production.min.cjs.map
Index: node_modules/@reduxjs/toolkit/dist/query/react/cjs/rtk-query-react.production.min.cjs.map
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/react/cjs/rtk-query-react.production.min.cjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/react/cjs/rtk-query-react.production.min.cjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,1 @@
+{"version":3,"sources":["../../../../src/query/react/index.ts","../../../../src/query/react/rtkqImports.ts","../../../../src/query/react/module.ts","../../../../src/query/utils/capitalize.ts","../../../../src/query/endpointDefinitions.ts","../../../../src/query/tsHelpers.ts","../../../../src/query/react/buildHooks.ts","../../../../src/query/react/reactImports.ts","../../../../src/query/react/reactReduxImports.ts","../../../../src/query/react/constants.ts","../../../../src/query/react/useSerializedStableValue.ts","../../../../src/query/react/useShallowStableValue.ts","../../../../src/query/react/ApiProvider.tsx"],"sourcesContent":["// This must remain here so that the `mangleErrors.cjs` build script\n// does not have to import this into each source file it rewrites.\nimport { formatProdErrorMessage } from '@reduxjs/toolkit';\nimport { buildCreateApi, coreModule } from './rtkqImports';\nimport { reactHooksModule, reactHooksModuleName } from './module';\nexport * from '@reduxjs/toolkit/query';\nexport { ApiProvider } from './ApiProvider';\nconst createApi = /* @__PURE__ */buildCreateApi(coreModule(), reactHooksModule());\nexport type { TypedUseMutationResult, TypedUseQueryHookResult, TypedUseQueryStateResult, TypedUseQuerySubscriptionResult, TypedLazyQueryTrigger, TypedUseLazyQuery, TypedUseMutation, TypedMutationTrigger, TypedQueryStateSelector, TypedUseQueryState, TypedUseQuery, TypedUseQuerySubscription, TypedUseLazyQuerySubscription, TypedUseQueryStateOptions, TypedUseLazyQueryStateResult, TypedUseInfiniteQuery, TypedUseInfiniteQueryHookResult, TypedUseInfiniteQueryStateResult, TypedUseInfiniteQuerySubscriptionResult, TypedUseInfiniteQueryStateOptions, TypedInfiniteQueryStateSelector, TypedUseInfiniteQuerySubscription, TypedUseInfiniteQueryState, TypedLazyInfiniteQueryTrigger } from './buildHooks';\nexport { UNINITIALIZED_VALUE } from './constants';\nexport { createApi, reactHooksModule, reactHooksModuleName };","export { buildCreateApi, coreModule, copyWithStructuralSharing, setupListeners, QueryStatus, skipToken } from '@reduxjs/toolkit/query';","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { Api, BaseQueryFn, EndpointDefinitions, InfiniteQueryDefinition, Module, MutationDefinition, PrefetchOptions, QueryArgFrom, QueryDefinition, QueryKeys } from '@reduxjs/toolkit/query';\nimport { batch as rrBatch, useDispatch as rrUseDispatch, useSelector as rrUseSelector, useStore as rrUseStore } from 'react-redux';\nimport type { CreateSelectorFunction } from 'reselect';\nimport { createSelector as _createSelector } from 'reselect';\nimport { isInfiniteQueryDefinition, isMutationDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { safeAssign } from '../tsHelpers';\nimport { capitalize, countObjectKeys } from '../utils';\nimport type { InfiniteQueryHooks, MutationHooks, QueryHooks } from './buildHooks';\nimport { buildHooks } from './buildHooks';\nimport type { HooksWithUniqueNames } from './namedHooks';\nexport const reactHooksModuleName = /* @__PURE__ */Symbol();\nexport type ReactHooksModule = typeof reactHooksModuleName;\ndeclare module '@reduxjs/toolkit/query' {\n  export interface ApiModules<\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions,\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  ReducerPath extends string,\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  TagTypes extends string> {\n    [reactHooksModuleName]: {\n      /**\n       *  Endpoints based on the input endpoints provided to `createApi`, containing `select`, `hooks` and `action matchers`.\n       */\n      endpoints: { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? QueryHooks<Definitions[K]> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? MutationHooks<Definitions[K]> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryHooks<Definitions[K]> : never };\n      /**\n       * A hook that accepts a string endpoint name, and provides a callback that when called, pre-fetches the data for that endpoint.\n       */\n      usePrefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, options?: PrefetchOptions): (arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions) => void;\n    } & HooksWithUniqueNames<Definitions>;\n  }\n}\ntype RR = typeof import('react-redux');\nexport interface ReactHooksModuleOptions {\n  /**\n   * The hooks from React Redux to be used\n   */\n  hooks?: {\n    /**\n     * The version of the `useDispatch` hook to be used\n     */\n    useDispatch: RR['useDispatch'];\n    /**\n     * The version of the `useSelector` hook to be used\n     */\n    useSelector: RR['useSelector'];\n    /**\n     * The version of the `useStore` hook to be used\n     */\n    useStore: RR['useStore'];\n  };\n  /**\n   * The version of the `batchedUpdates` function to be used\n   */\n  batch?: RR['batch'];\n  /**\n   * Enables performing asynchronous tasks immediately within a render.\n   *\n   * @example\n   *\n   * ```ts\n   * import {\n   *   buildCreateApi,\n   *   coreModule,\n   *   reactHooksModule\n   * } from '@reduxjs/toolkit/query/react'\n   *\n   * const createApi = buildCreateApi(\n   *   coreModule(),\n   *   reactHooksModule({ unstable__sideEffectsInRender: true })\n   * )\n   * ```\n   */\n  unstable__sideEffectsInRender?: boolean;\n  /**\n   * A selector creator (usually from `reselect`, or matching the same signature)\n   */\n  createSelector?: CreateSelectorFunction<any, any, any>;\n}\n\n/**\n * Creates a module that generates react hooks from endpoints, for use with `buildCreateApi`.\n *\n *  @example\n * ```ts\n * const MyContext = React.createContext<ReactReduxContextValue | null>(null);\n * const customCreateApi = buildCreateApi(\n *   coreModule(),\n *   reactHooksModule({\n *     hooks: {\n *       useDispatch: createDispatchHook(MyContext),\n *       useSelector: createSelectorHook(MyContext),\n *       useStore: createStoreHook(MyContext)\n *     }\n *   })\n * );\n * ```\n *\n * @returns A module for use with `buildCreateApi`\n */\nexport const reactHooksModule = ({\n  batch = rrBatch,\n  hooks = {\n    useDispatch: rrUseDispatch,\n    useSelector: rrUseSelector,\n    useStore: rrUseStore\n  },\n  createSelector = _createSelector,\n  unstable__sideEffectsInRender = false,\n  ...rest\n}: ReactHooksModuleOptions = {}): Module<ReactHooksModule> => {\n  if (process.env.NODE_ENV !== 'production') {\n    const hookNames = ['useDispatch', 'useSelector', 'useStore'] as const;\n    let warned = false;\n    for (const hookName of hookNames) {\n      // warn for old hook options\n      if (countObjectKeys(rest) > 0) {\n        if ((rest as Partial<typeof hooks>)[hookName]) {\n          if (!warned) {\n            console.warn('As of RTK 2.0, the hooks now need to be specified as one object, provided under a `hooks` key:' + '\\n`reactHooksModule({ hooks: { useDispatch, useSelector, useStore } })`');\n            warned = true;\n          }\n        }\n        // migrate\n        // @ts-ignore\n        hooks[hookName] = rest[hookName];\n      }\n      // then make sure we have them all\n      if (typeof hooks[hookName] !== 'function') {\n        throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(36) : `When using custom hooks for context, all ${hookNames.length} hooks need to be provided: ${hookNames.join(', ')}.\\nHook ${hookName} was either not provided or not a function.`);\n      }\n    }\n  }\n  return {\n    name: reactHooksModuleName,\n    init(api, {\n      serializeQueryArgs\n    }, context) {\n      const anyApi = api as any as Api<any, Record<string, any>, any, any, ReactHooksModule>;\n      const {\n        buildQueryHooks,\n        buildInfiniteQueryHooks,\n        buildMutationHook,\n        usePrefetch\n      } = buildHooks({\n        api,\n        moduleOptions: {\n          batch,\n          hooks,\n          unstable__sideEffectsInRender,\n          createSelector\n        },\n        serializeQueryArgs,\n        context\n      });\n      safeAssign(anyApi, {\n        usePrefetch\n      });\n      safeAssign(context, {\n        batch\n      });\n      return {\n        injectEndpoint(endpointName, definition) {\n          if (isQueryDefinition(definition)) {\n            const {\n              useQuery,\n              useLazyQuery,\n              useLazyQuerySubscription,\n              useQueryState,\n              useQuerySubscription\n            } = buildQueryHooks(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useQuery,\n              useLazyQuery,\n              useLazyQuerySubscription,\n              useQueryState,\n              useQuerySubscription\n            });\n            (api as any)[`use${capitalize(endpointName)}Query`] = useQuery;\n            (api as any)[`useLazy${capitalize(endpointName)}Query`] = useLazyQuery;\n          }\n          if (isMutationDefinition(definition)) {\n            const useMutation = buildMutationHook(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useMutation\n            });\n            (api as any)[`use${capitalize(endpointName)}Mutation`] = useMutation;\n          } else if (isInfiniteQueryDefinition(definition)) {\n            const {\n              useInfiniteQuery,\n              useInfiniteQuerySubscription,\n              useInfiniteQueryState\n            } = buildInfiniteQueryHooks(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useInfiniteQuery,\n              useInfiniteQuerySubscription,\n              useInfiniteQueryState\n            });\n            (api as any)[`use${capitalize(endpointName)}InfiniteQuery`] = useInfiniteQuery;\n          }\n        }\n      };\n    }\n  };\n};","export function capitalize(str: string) {\n  return str.replace(str[0], str[0].toUpperCase());\n}","import type { Api } from '@reduxjs/toolkit/query';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { BaseQueryApi, BaseQueryArg, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta, BaseQueryResult, QueryReturnValue } from './baseQueryTypes';\nimport type { CacheCollectionQueryExtraOptions } from './core/buildMiddleware/cacheCollection';\nimport type { CacheLifecycleInfiniteQueryExtraOptions, CacheLifecycleMutationExtraOptions, CacheLifecycleQueryExtraOptions } from './core/buildMiddleware/cacheLifecycle';\nimport type { QueryLifecycleInfiniteQueryExtraOptions, QueryLifecycleMutationExtraOptions, QueryLifecycleQueryExtraOptions } from './core/buildMiddleware/queryLifecycle';\nimport type { InfiniteData, InfiniteQueryConfigOptions, QuerySubState, RootState } from './core/index';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { NEVER } from './fakeBaseQuery';\nimport type { CastAny, HasRequiredProps, MaybePromise, NonUndefined, OmitFromUnion, UnwrapPromise } from './tsHelpers';\nimport { isNotNullish } from './utils';\nimport type { NamedSchemaError } from './standardSchema';\nimport { filterMap } from './utils/filterMap';\nconst rawResultType = /* @__PURE__ */Symbol();\nconst resultType = /* @__PURE__ */Symbol();\nconst baseQuery = /* @__PURE__ */Symbol();\nexport interface SchemaFailureInfo {\n  endpoint: string;\n  arg: any;\n  type: 'query' | 'mutation';\n  queryCacheKey?: string;\n}\nexport type SchemaFailureHandler = (error: NamedSchemaError, info: SchemaFailureInfo) => void;\nexport type SchemaFailureConverter<BaseQuery extends BaseQueryFn> = (error: NamedSchemaError, info: SchemaFailureInfo) => BaseQueryError<BaseQuery>;\nexport type EndpointDefinitionWithQuery<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery>> = {\n  /**\n   * `query` can be a function that returns either a `string` or an `object` which is passed to your `baseQuery`. If you are using [fetchBaseQuery](./fetchBaseQuery), this can return either a `string` or an `object` of properties in `FetchArgs`. If you use your own custom [`baseQuery`](../../rtk-query/usage/customizing-queries), you can customize this behavior to your liking.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"query example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       // highlight-start\n   *       query: () => 'posts',\n   *       // highlight-end\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *      // highlight-start\n   *      query: (body) => ({\n   *        url: `posts`,\n   *        method: 'POST',\n   *        body,\n   *      }),\n   *      // highlight-end\n   *      invalidatesTags: [{ type: 'Post', id: 'LIST' }],\n   *    }),\n   *   })\n   * })\n   * ```\n   */\n  query(arg: QueryArg): BaseQueryArg<BaseQuery>;\n  queryFn?: never;\n  /**\n   * A function to manipulate the data returned by a query or mutation.\n   */\n  transformResponse?(baseQueryReturnValue: RawResultType, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): ResultType | Promise<ResultType>;\n  /**\n   * A function to manipulate the data returned by a failed query or mutation.\n   */\n  transformErrorResponse?(baseQueryReturnValue: BaseQueryError<BaseQuery>, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): unknown;\n\n  /**\n   * A schema for the result *before* it's passed to `transformResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPostName: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawResponseSchema: postSchema,\n   *       transformResponse: (post) => post.name,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawResponseSchema?: StandardSchemaV1<RawResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn`, *before* it's passed to `transformErrorResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import {customBaseQuery, baseQueryErrorSchema} from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawErrorResponseSchema: baseQueryErrorSchema,\n   *       transformErrorResponse: (error) => error.data,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawErrorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n};\nexport type EndpointDefinitionWithQueryFn<QueryArg, BaseQuery extends BaseQueryFn, ResultType> = {\n  /**\n   * Can be used in place of `query` as an inline function that bypasses `baseQuery` completely for the endpoint.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Basic queryFn example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *     }),\n   *     flipCoin: build.query<'heads' | 'tails', void>({\n   *       // highlight-start\n   *       queryFn(arg, queryApi, extraOptions, baseQuery) {\n   *         const randomVal = Math.random()\n   *         if (randomVal < 0.45) {\n   *           return { data: 'heads' }\n   *         }\n   *         if (randomVal < 0.9) {\n   *           return { data: 'tails' }\n   *         }\n   *         return { error: { status: 500, statusText: 'Internal Server Error', data: \"Coin landed on its edge!\" } }\n   *       }\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  queryFn(arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions<BaseQuery>, baseQuery: (arg: Parameters<BaseQuery>[0]) => ReturnType<BaseQuery>): MaybePromise<QueryReturnValue<ResultType, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>>;\n  query?: never;\n  transformResponse?: never;\n  transformErrorResponse?: never;\n  rawResponseSchema?: never;\n  rawErrorResponseSchema?: never;\n};\ntype BaseEndpointTypes<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType> = {\n  QueryArg: QueryArg;\n  BaseQuery: BaseQuery;\n  ResultType: ResultType;\n  RawResultType: RawResultType;\n};\nexport type SchemaType = 'arg' | 'rawResponse' | 'response' | 'rawErrorResponse' | 'errorResponse' | 'meta';\ninterface CommonEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType> {\n  /**\n   * A schema for the arguments to be passed to the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       argSchema: v.object({ id: v.number() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  argSchema?: StandardSchemaV1<QueryArg>;\n\n  /**\n   * A schema for the result (including `transformResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: postSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  responseSchema?: StandardSchemaV1<ResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn` (including `transformErrorResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryErrorSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       errorResponseSchema: baseQueryErrorSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  errorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n\n  /**\n   * A schema for the `meta` property returned by the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryMetaSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       metaSchema: baseQueryMetaSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  metaSchema?: StandardSchemaV1<BaseQueryMeta<BaseQuery>>;\n\n  /**\n   * Defaults to `true`.\n   *\n   * Most apps should leave this setting on. The only time it can be a performance issue\n   * is if an API returns extremely large amounts of data (e.g. 10,000 rows per request) and\n   * you're unable to paginate it.\n   *\n   * For details of how this works, please see the below. When it is set to `false`,\n   * every request will cause subscribed components to rerender, even when the data has not changed.\n   *\n   * @see https://redux-toolkit.js.org/api/other-exports#copywithstructuralsharing\n   */\n  structuralSharing?: boolean;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       onSchemaFailure: (error, info) => {\n   *         console.error(error, info)\n   *       },\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       catchSchemaFailure: (error, info) => ({\n   *         status: \"CUSTOM_ERROR\",\n   *         error: error.schemaName + \" failed validation\",\n   *         data: error.issues,\n   *       }),\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for this endpoint.\n   * Overrides the global setting.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type BaseEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = (([CastAny<BaseQueryResult<BaseQuery>, {}>] extends [NEVER] ? never : EndpointDefinitionWithQuery<QueryArg, BaseQuery, ResultType, RawResultType>) | EndpointDefinitionWithQueryFn<QueryArg, BaseQuery, ResultType>) & CommonEndpointDefinition<QueryArg, BaseQuery, ResultType> & {\n  /* phantom type */\n  [rawResultType]?: RawResultType;\n  /* phantom type */\n  [resultType]?: ResultType;\n  /* phantom type */\n  [baseQuery]?: BaseQuery;\n} & HasRequiredProps<BaseQueryExtraOptions<BaseQuery>, {\n  extraOptions: BaseQueryExtraOptions<BaseQuery>;\n}, {\n  extraOptions?: BaseQueryExtraOptions<BaseQuery>;\n}>;\n\n// NOTE As with QueryStatus in `apiState.ts`, don't use this for real comparisons\n// at runtime, use the string constants defined below.\nexport enum DefinitionType {\n  query = 'query',\n  mutation = 'mutation',\n  infinitequery = 'infinitequery',\n}\nexport const ENDPOINT_QUERY = DefinitionType.query;\nexport const ENDPOINT_MUTATION = DefinitionType.mutation;\nexport const ENDPOINT_INFINITEQUERY = DefinitionType.infinitequery;\ntype TagDescriptionArray<TagTypes extends string> = ReadonlyArray<TagDescription<TagTypes> | undefined | null>;\nexport type GetResultDescriptionFn<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = (result: ResultType | undefined, error: ErrorType | undefined, arg: QueryArg, meta: MetaType) => TagDescriptionArray<TagTypes>;\nexport type FullTagDescription<TagType> = {\n  type: TagType;\n  id?: number | string;\n};\nexport type TagDescription<TagType> = TagType | FullTagDescription<TagType>;\n\n/**\n * @public\n */\nexport type ResultDescription<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = TagDescriptionArray<TagTypes> | GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>;\ntype QueryTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  QueryDefinition: QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface QueryExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.query;\n\n  /**\n   * Used by `query` endpoints. Determines which 'tag' is attached to the cached data returned by the query.\n   * Expects an array of tag type strings, an array of objects of tag types with ids, or a function that returns such an array.\n   * 1.  `['Post']` - equivalent to `2`\n   * 2.  `[{ type: 'Post' }]` - equivalent to `1`\n   * 3.  `[{ type: 'Post', id: 1 }]`\n   * 4.  `(result, error, arg) => ['Post']` - equivalent to `5`\n   * 5.  `(result, error, arg) => [{ type: 'Post' }]` - equivalent to `4`\n   * 6.  `(result, error, arg) => [{ type: 'Post', id: 1 }]`\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"providesTags example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       // highlight-start\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  providesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * Can be provided to merge an incoming response value into the current cache data.\n   * If supplied, no automatic structural sharing will be applied - it's up to\n   * you to update the cache appropriately.\n   *\n   * Since RTKQ normally replaces cache entries with the new response, you will usually\n   * need to use this with the `serializeQueryArgs` or `forceRefetch` options to keep\n   * an existing cache entry so that it can be updated.\n   *\n   * Since this is wrapped with Immer, you may either mutate the `currentCacheValue` directly,\n   * or return a new value, but _not_ both at once.\n   *\n   * Will only be called if the existing `currentCacheData` is _not_ `undefined` - on first response,\n   * the cache entry will just save the response data directly.\n   *\n   * Useful if you don't want a new request to completely override the current cache value,\n   * maybe because you have manually updated it from another source and don't want those\n   * updates to get lost.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"merge: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  merge?(currentCacheData: ResultType, responseData: ResultType, otherArgs: {\n    arg: QueryArg;\n    baseQueryMeta: BaseQueryMeta<BaseQuery>;\n    requestId: string;\n    fulfilledTimeStamp: number;\n  }): ResultType | void;\n\n  /**\n   * Check to see if the endpoint should force a refetch in cases where it normally wouldn't.\n   * This is primarily useful for \"infinite scroll\" / pagination use cases where\n   * RTKQ is keeping a single cache entry that is added to over time, in combination\n   * with `serializeQueryArgs` returning a fixed cache key and a `merge` callback\n   * set to add incoming data to the cache entry each time.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"forceRefresh: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  forceRefetch?(params: {\n    currentArg: QueryArg | undefined;\n    previousArg: QueryArg | undefined;\n    state: RootState<any, any, string>;\n    endpointState?: QuerySubState<any>;\n  }): boolean;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: QueryTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type QueryDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & QueryExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type InfiniteQueryTypes<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  InfiniteQueryDefinition: InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\nexport interface InfiniteQueryExtraOptions<TagTypes extends string, ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.infinitequery;\n  providesTags?: ResultDescription<TagTypes, InfiniteData<ResultType, PageParam>, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Required options to configure the infinite query behavior.\n   * `initialPageParam` and `getNextPageParam` are required, to\n   * ensure the infinite query can properly fetch the next page of data.\n   * `initialPageParam` may be specified when using the\n   * endpoint, to override the default value.\n   * `maxPages` and `getPreviousPageParam` are both optional.\n   * \n   * @example\n   * \n   * ```ts\n   * // codeblock-meta title=\"infiniteQueryOptions example\"\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * \n   * type Pokemon = {\n   *   id: string\n   *   name: string\n   * }\n   * \n   * const pokemonApi = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),\n   *   endpoints: (build) => ({\n   *     getInfinitePokemonWithMax: build.infiniteQuery<Pokemon[], string, number>({\n   *       infiniteQueryOptions: {\n   *         initialPageParam: 0,\n   *         maxPages: 3,\n   *         getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) =>\n   *           lastPageParam + 1,\n   *         getPreviousPageParam: (\n   *           firstPage,\n   *           allPages,\n   *           firstPageParam,\n   *           allPageParams,\n   *         ) => {\n   *           return firstPageParam > 0 ? firstPageParam - 1 : undefined\n   *         },\n   *       },\n   *       query({pageParam}) {\n   *         return `https://example.com/listItems?page=${pageParam}`\n   *       },\n   *     }),\n   *   }),\n   * })\n   \n   * ```\n   */\n  infiniteQueryOptions: InfiniteQueryConfigOptions<ResultType, PageParam, QueryArg>;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: InfiniteQueryTypes<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> =\n// Infinite query endpoints receive `{queryArg, pageParam}`\nBaseEndpointDefinition<InfiniteQueryCombinedArg<QueryArg, PageParam>, BaseQuery, ResultType, RawResultType> & InfiniteQueryExtraOptions<TagTypes, ResultType, QueryArg, PageParam, BaseQuery, ReducerPath, RawResultType>;\ntype MutationTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseMutation<typeof api.endpoints.query.Types.MutationDefinition> = ...\n   * ```\n   */\n  MutationDefinition: MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface MutationExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath> {\n  type: DefinitionType.mutation;\n\n  /**\n   * Used by `mutation` endpoints. Determines which cached data should be either re-fetched or removed from the cache.\n   * Expects the same shapes as `providesTags`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"invalidatesTags example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *       query(body) {\n   *         return {\n   *           url: `posts`,\n   *           method: 'POST',\n   *           body,\n   *         }\n   *       },\n   *       // highlight-start\n   *       invalidatesTags: [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  invalidatesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A mutation should not provide tags to the cache.\n   */\n  providesTags?: never;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: MutationTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type MutationDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & MutationExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type EndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, PageParam = any, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\nexport type EndpointDefinitions = Record<string, EndpointDefinition<any, any, any, any, any, any, any>>;\nexport function isQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is QueryDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_QUERY;\n}\nexport function isMutationDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is MutationDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_MUTATION;\n}\nexport function isInfiniteQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is InfiniteQueryDefinition<any, any, any, any, any, any, any> {\n  return e.type === ENDPOINT_INFINITEQUERY;\n}\nexport function isAnyQueryDefinition(e: EndpointDefinition<any, any, any, any>): e is QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any> {\n  return isQueryDefinition(e) || isInfiniteQueryDefinition(e);\n}\nexport type EndpointBuilder<BaseQuery extends BaseQueryFn, TagTypes extends string, ReducerPath extends string> = {\n  /**\n   * An endpoint definition that retrieves data, and may provide tags to the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all query endpoint options\"\n   * const api = createApi({\n   *  baseQuery,\n   *  endpoints: (build) => ({\n   *    getPost: build.query({\n   *      query: (id) => ({ url: `post/${id}` }),\n   *      // Pick out data and prevent nested properties in a hook or selector\n   *      transformResponse: (response) => response.data,\n   *      // Pick out error and prevent nested properties in a hook or selector\n   *      transformErrorResponse: (response) => response.error,\n   *      // `result` is the server response\n   *      providesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry, updateCachedData }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry, updateCachedData }) {},\n   *    }),\n   *  }),\n   *});\n   *```\n   */\n  query<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n\n  /**\n   * An endpoint definition that alters data on the server or will possibly invalidate the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all mutation endpoint options\"\n   * const api = createApi({\n   *   baseQuery,\n   *   endpoints: (build) => ({\n   *     updatePost: build.mutation({\n   *       query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),\n   *       // Pick out data and prevent nested properties in a hook or selector\n   *       transformResponse: (response) => response.data,\n   *       // Pick out error and prevent nested properties in a hook or selector\n   *       transformErrorResponse: (response) => response.error,\n   *       // `result` is the server response\n   *       invalidatesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry }) {},\n   *     }),\n   *   }),\n   * });\n   * ```\n   */\n  mutation<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n  infiniteQuery<ResultType, QueryArg, PageParam, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n};\nexport type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T;\nexport function calculateProvidedBy<ResultType, QueryArg, ErrorType, MetaType>(description: ResultDescription<string, ResultType, QueryArg, ErrorType, MetaType> | undefined, result: ResultType | undefined, error: ErrorType | undefined, queryArg: QueryArg, meta: MetaType | undefined, assertTagTypes: AssertTagTypes): readonly FullTagDescription<string>[] {\n  const finalDescription = isFunction(description) ? description(result as ResultType, error as undefined, queryArg, meta as MetaType) : description;\n  if (finalDescription) {\n    return filterMap(finalDescription, isNotNullish, tag => assertTagTypes(expandTagDescription(tag)));\n  }\n  return [];\n}\nfunction isFunction<T>(t: T): t is Extract<T, Function> {\n  return typeof t === 'function';\n}\nexport function expandTagDescription(description: TagDescription<string>): FullTagDescription<string> {\n  return typeof description === 'string' ? {\n    type: description\n  } : description;\n}\nexport type QueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<infer QA, any, any, any> ? QA : never;\n\n// Just extracting `QueryArg` from `BaseEndpointDefinition`\n// doesn't sufficiently match here.\n// We need to explicitly match against `InfiniteQueryDefinition`\nexport type InfiniteQueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<infer QA, any, any, any, any, any, any> ? QA : never;\nexport type QueryArgFromAnyQuery<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any, any, any> ? InfiniteQueryArgFrom<D> : D extends QueryDefinition<any, any, any, any, any, any> ? QueryArgFrom<D> : never;\nexport type ResultTypeFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<any, any, infer RT, any> ? RT : unknown;\nexport type ReducerPathFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, any, any, infer RP, any, any> ? RP : unknown;\nexport type TagTypesFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, infer TT, any, any, any, any> ? TT : unknown;\nexport type PageParamFrom<D extends InfiniteQueryDefinition<any, any, any, any, any, any, any>> = D extends InfiniteQueryDefinition<any, infer PP, any, any, any, any, any> ? PP : unknown;\nexport type InfiniteQueryCombinedArg<QueryArg, PageParam> = {\n  queryArg: QueryArg;\n  pageParam: PageParam;\n};\nexport type TagTypesFromApi<T> = T extends Api<any, any, any, infer TagTypes> ? TagTypes : never;\nexport type DefinitionsFromApi<T> = T extends Api<any, infer Definitions, any, any> ? Definitions : never;\nexport type TransformedResponse<NewDefinitions extends EndpointDefinitions, K, ResultType> = K extends keyof NewDefinitions ? NewDefinitions[K]['transformResponse'] extends undefined ? ResultType : UnwrapPromise<ReturnType<NonUndefined<NewDefinitions[K]['transformResponse']>>> : ResultType;\nexport type OverrideResultType<Definition, NewResultType> = Definition extends QueryDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends MutationDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, NewResultType, ReducerPath> : never;\nexport type UpdateDefinitions<Definitions extends EndpointDefinitions, NewTagTypes extends string, NewDefinitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends MutationDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : never };","export type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type Override<T1, T2> = T2 extends any ? Omit<T1, keyof T2> & T2 : never;\nexport function assertCast<T>(v: any): asserts v is T {}\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>): T {\n  return Object.assign(target, ...args);\n}\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\nexport type NonOptionalKeys<T> = { [K in keyof T]-?: undefined extends T[K] ? never : K }[keyof T];\nexport type HasRequiredProps<T, True, False> = NonOptionalKeys<T> extends never ? False : True;\nexport type OptionalIfAllPropsOptional<T> = HasRequiredProps<T, T, T | never>;\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type UnwrapPromise<T> = T extends PromiseLike<infer V> ? V : T;\nexport type MaybePromise<T> = T | PromiseLike<T>;\nexport type OmitFromUnion<T, K extends keyof T> = T extends any ? Omit<T, K> : never;\nexport type IsAny<T, True, False = never> = true | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;","import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3 } from \"@reduxjs/toolkit\";\nimport type { Selector, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { Api, ApiContext, ApiEndpointInfiniteQuery, ApiEndpointMutation, ApiEndpointQuery, BaseQueryFn, CoreModule, EndpointDefinitions, InfiniteQueryActionCreatorResult, InfiniteQueryArgFrom, InfiniteQueryDefinition, InfiniteQueryResultSelectorResult, InfiniteQuerySubState, MutationActionCreatorResult, MutationDefinition, MutationResultSelectorResult, PageParamFrom, PrefetchOptions, QueryActionCreatorResult, QueryArgFrom, QueryCacheKey, QueryDefinition, QueryKeys, QueryResultSelectorResult, QuerySubState, ResultTypeFrom, RootState, SerializeQueryArgs, SkipToken, SubscriptionOptions, TSHelpersId, TSHelpersNoInfer, TSHelpersOverride } from '@reduxjs/toolkit/query';\nimport { QueryStatus, skipToken } from './rtkqImports';\nimport type { DependencyList } from 'react';\nimport { useCallback, useDebugValue, useEffect, useLayoutEffect, useMemo, useRef, useState } from './reactImports';\nimport { shallowEqual } from './reactReduxImports';\nimport type { SubscriptionSelectors } from '../core/buildMiddleware/index';\nimport type { InfiniteData, InfiniteQueryConfigOptions } from '../core/index';\nimport type { UninitializedValue } from './constants';\nimport { UNINITIALIZED_VALUE } from './constants';\nimport type { ReactHooksModuleOptions } from './module';\nimport { useStableQueryArgs } from './useSerializedStableValue';\nimport { useShallowStableValue } from './useShallowStableValue';\nimport type { InfiniteQueryDirection } from '../core/apiState';\nimport { isInfiniteQueryDefinition } from '../endpointDefinitions';\nimport type { StartInfiniteQueryActionCreator } from '../core/buildInitiate';\n\n// Copy-pasted from React-Redux\nconst canUseDOM = () => !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\nconst isDOM = /* @__PURE__ */canUseDOM();\n\n// Under React Native, we know that we always want to use useLayoutEffect\n\nconst isRunningInReactNative = () => typeof navigator !== 'undefined' && navigator.product === 'ReactNative';\nconst isReactNative = /* @__PURE__ */isRunningInReactNative();\nconst getUseIsomorphicLayoutEffect = () => isDOM || isReactNative ? useLayoutEffect : useEffect;\nexport const useIsomorphicLayoutEffect = /* @__PURE__ */getUseIsomorphicLayoutEffect();\nexport type QueryHooks<Definition extends QueryDefinition<any, any, any, any, any>> = {\n  useQuery: UseQuery<Definition>;\n  useLazyQuery: UseLazyQuery<Definition>;\n  useQuerySubscription: UseQuerySubscription<Definition>;\n  useLazyQuerySubscription: UseLazyQuerySubscription<Definition>;\n  useQueryState: UseQueryState<Definition>;\n};\nexport type InfiniteQueryHooks<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  useInfiniteQuery: UseInfiniteQuery<Definition>;\n  useInfiniteQuerySubscription: UseInfiniteQuerySubscription<Definition>;\n  useInfiniteQueryState: UseInfiniteQueryState<Definition>;\n};\nexport type MutationHooks<Definition extends MutationDefinition<any, any, any, any, any>> = {\n  useMutation: UseMutation<Definition>;\n};\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.\n *\n * This hook combines the functionality of both [`useQueryState`](#usequerystate) and [`useQuerySubscription`](#usequerysubscription) together, and is intended to be used in the majority of situations.\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseQuery<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(arg: QueryArgFrom<D> | SkipToken, options?: UseQuerySubscriptionOptions & UseQueryStateOptions<D, R>) => UseQueryHookResult<D, R>;\nexport type TypedUseQuery<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuery<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseQueryHookResult<D extends QueryDefinition<any, any, any, any>, R = UseQueryStateDefaultResult<D>> = UseQueryStateResult<D, R> & UseQuerySubscriptionResult<D>;\n\n/**\n * Helper type to manually type the result\n * of the `useQuery` hook in userland code.\n */\nexport type TypedUseQueryHookResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = TypedUseQueryStateResult<ResultType, QueryArg, BaseQuery, R> & TypedUseQuerySubscriptionResult<ResultType, QueryArg, BaseQuery>;\nexport type UseQuerySubscriptionOptions = SubscriptionOptions & {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When `skip` is true (or `skipToken` is passed in as `arg`):\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```tsx\n   * // codeblock-meta no-transpile title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n};\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useQuery`](#usequery) or [`useQueryState`](#usequerystate).\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n */\nexport type UseQuerySubscription<D extends QueryDefinition<any, any, any, any>> = (arg: QueryArgFrom<D> | SkipToken, options?: UseQuerySubscriptionOptions) => UseQuerySubscriptionResult<D>;\nexport type TypedUseQuerySubscription<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuerySubscription<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseQuerySubscriptionResult<D extends QueryDefinition<any, any, any, any>> = Pick<QueryActionCreatorResult<D>, 'refetch'>;\n\n/**\n * Helper type to manually type the result\n * of the `useQuerySubscription` hook in userland code.\n */\nexport type TypedUseQuerySubscriptionResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuerySubscriptionResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseLazyQueryLastPromiseInfo<D extends QueryDefinition<any, any, any, any>> = {\n  lastArg: QueryArgFrom<D>;\n};\n\n/**\n * A React hook similar to [`useQuery`](#usequery), but with manual control over when the data fetching occurs.\n *\n * This hook includes the functionality of [`useLazyQuerySubscription`](#uselazyquerysubscription).\n *\n * #### Features\n *\n * - Manual control over firing a request to retrieve data\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once\n *\n * #### Note\n *\n * When the trigger function returned from a LazyQuery is called, it always initiates a new request to the server even if there is cached data. Set `preferCacheValue`(the second argument to the function) as `true` if you want it to immediately return a cached value if one exists.\n */\nexport type UseLazyQuery<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(options?: SubscriptionOptions & Omit<UseQueryStateOptions<D, R>, 'skip'>) => [LazyQueryTrigger<D>, UseLazyQueryStateResult<D, R>, UseLazyQueryLastPromiseInfo<D>];\nexport type TypedUseLazyQuery<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseLazyQuery<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseLazyQueryStateResult<D extends QueryDefinition<any, any, any, any>, R = UseQueryStateDefaultResult<D>> = UseQueryStateResult<D, R> & {\n  /**\n   * Resets the hook state to its initial `uninitialized` state.\n   * This will also remove the last result from the cache.\n   */\n  reset: () => void;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useLazyQuery` hook in userland code.\n */\nexport type TypedUseLazyQueryStateResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseLazyQueryStateResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>, R>;\nexport type LazyQueryTrigger<D extends QueryDefinition<any, any, any, any>> = {\n  /**\n   * Triggers a lazy query.\n   *\n   * By default, this will start a new request even if there is already a value in the cache.\n   * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a lazy query, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await getUserById(1).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>, preferCacheValue?: boolean): QueryActionCreatorResult<D>;\n};\nexport type TypedLazyQueryTrigger<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = LazyQueryTrigger<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook similar to [`useQuerySubscription`](#usequerysubscription), but with manual control over when the data fetching occurs.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useLazyQuery`](#uselazyquery).\n *\n * #### Features\n *\n * - Manual control over firing a request to retrieve data\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once\n */\nexport type UseLazyQuerySubscription<D extends QueryDefinition<any, any, any, any>> = (options?: SubscriptionOptions) => readonly [LazyQueryTrigger<D>, QueryArgFrom<D> | UninitializedValue, {\n  reset: () => void;\n}];\nexport type TypedUseLazyQuerySubscription<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseLazyQuerySubscription<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * @internal\n */\nexport type QueryStateSelector<R extends Record<string, any>, D extends QueryDefinition<any, any, any, any>> = (state: UseQueryStateDefaultResult<D>) => R;\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryStateSelector} for use with a specific query.\n * This is useful for scenarios where you want to create a \"pre-typed\"\n * {@linkcode UseQueryStateOptions.selectFromResult | selectFromResult}\n * function.\n *\n * @example\n * <caption>#### __Create a strongly-typed `selectFromResult` selector function__</caption>\n *\n * ```tsx\n * import type { TypedQueryStateSelector } from '@reduxjs/toolkit/query/react'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n *\n * type Post = {\n *   id: number\n *   title: string\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = number | undefined\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * type SelectedResult = Pick<PostsApiResponse, 'posts'>\n *\n * const postsApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com/posts' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, QueryArgument>({\n *       query: (limit = 5) => `?limit=${limit}&select=title`,\n *     }),\n *   }),\n * })\n *\n * const { useGetPostsQuery } = postsApiSlice\n *\n * function PostById({ id }: { id: number }) {\n *   const { post } = useGetPostsQuery(undefined, {\n *     selectFromResult: (state) => ({\n *       post: state.data?.posts.find((post) => post.id === id),\n *     }),\n *   })\n *\n *   return <li>{post?.title}</li>\n * }\n *\n * const EMPTY_ARRAY: Post[] = []\n *\n * const typedSelectFromResult: TypedQueryStateSelector<\n *   PostsApiResponse,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   SelectedResult\n * > = (state) => ({ posts: state.data?.posts ?? EMPTY_ARRAY })\n *\n * function PostsList() {\n *   const { posts } = useGetPostsQuery(undefined, {\n *     selectFromResult: typedSelectFromResult,\n *   })\n *\n *   return (\n *     <div>\n *       <ul>\n *         {posts.map((post) => (\n *           <PostById key={post.id} id={post.id} />\n *         ))}\n *       </ul>\n *     </div>\n *   )\n * }\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template SelectedResultType - The type of the selected result returned by the __`selectFromResult`__ function.\n *\n * @since 2.3.0\n * @public\n */\nexport type TypedQueryStateSelector<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, SelectedResultType extends Record<string, any> = UseQueryStateDefaultResult<QueryDefinition<QueryArgumentType, BaseQueryFunctionType, string, ResultType, string>>> = QueryStateSelector<SelectedResultType, QueryDefinition<QueryArgumentType, BaseQueryFunctionType, string, ResultType, string>>;\n\n/**\n * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * Note that this hook does not trigger fetching new data. For that use-case, see [`useQuery`](#usequery) or [`useQuerySubscription`](#usequerysubscription).\n *\n * #### Features\n *\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseQueryState<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(arg: QueryArgFrom<D> | SkipToken, options?: UseQueryStateOptions<D, R>) => UseQueryStateResult<D, R>;\nexport type TypedUseQueryState<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQueryState<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * @internal\n */\nexport type UseQueryStateOptions<D extends QueryDefinition<any, any, any, any>, R extends Record<string, any>> = {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When skip is true:\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after skipping the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.\n   * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.\n   * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using selectFromResult to extract a single result\"\n   * function PostsList() {\n   *   const { data: posts } = api.useGetPostsQuery();\n   *\n   *   return (\n   *     <ul>\n   *       {posts?.data?.map((post) => (\n   *         <PostById key={post.id} id={post.id} />\n   *       ))}\n   *     </ul>\n   *   );\n   * }\n   *\n   * function PostById({ id }: { id: number }) {\n   *   // Will select the post with the given id, and will only rerender if the given posts data changes\n   *   const { post } = api.useGetPostsQuery(undefined, {\n   *     selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),\n   *   });\n   *\n   *   return <li>{post?.name}</li>;\n   * }\n   * ```\n   */\n  selectFromResult?: QueryStateSelector<R, D>;\n};\n\n/**\n * Provides a way to define a \"pre-typed\" version of\n * {@linkcode UseQueryStateOptions} with specific options for a given query.\n * This is particularly useful for setting default query behaviors such as\n * refetching strategies, which can be overridden as needed.\n *\n * @example\n * <caption>#### __Create a `useQuery` hook with default options__</caption>\n *\n * ```ts\n * import type {\n *   SubscriptionOptions,\n *   TypedUseQueryStateOptions,\n * } from '@reduxjs/toolkit/query/react'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n *\n * type Post = {\n *   id: number\n *   name: string\n * }\n *\n * const api = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n *   tagTypes: ['Post'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<Post[], void>({\n *       query: () => 'posts',\n *     }),\n *   }),\n * })\n *\n * const { useGetPostsQuery } = api\n *\n * export const useGetPostsQueryWithDefaults = <\n *   SelectedResult extends Record<string, any>,\n * >(\n *   overrideOptions: TypedUseQueryStateOptions<\n *     Post[],\n *     void,\n *     ReturnType<typeof fetchBaseQuery>,\n *     SelectedResult\n *   > &\n *     SubscriptionOptions,\n * ) =>\n *   useGetPostsQuery(undefined, {\n *     // Insert default options here\n *\n *     refetchOnMountOrArgChange: true,\n *     refetchOnFocus: true,\n *     ...overrideOptions,\n *   })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArg - The type of the argument passed into the query.\n * @template BaseQuery - The type of the base query function being used.\n * @template SelectedResult - The type of the selected result returned by the __`selectFromResult`__ function.\n *\n * @since 2.2.8\n * @public\n */\nexport type TypedUseQueryStateOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseQueryStateOptions<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>, SelectedResult>;\nexport type UseQueryStateResult<_ extends QueryDefinition<any, any, any, any>, R> = TSHelpersNoInfer<R>;\n\n/**\n * Helper type to manually type the result\n * of the `useQueryState` hook in userland code.\n */\nexport type TypedUseQueryStateResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = TSHelpersNoInfer<R>;\ntype UseQueryStateBaseResult<D extends QueryDefinition<any, any, any, any>> = QuerySubState<D> & {\n  /**\n   * Where `data` tries to hold data as much as possible, also re-using\n   * data from the last arguments passed into the hook, this property\n   * will always contain the received data from the query, for the current query arguments.\n   */\n  currentData?: ResultTypeFrom<D>;\n  /**\n   * Query has not started yet.\n   */\n  isUninitialized: false;\n  /**\n   * Query is currently loading for the first time. No data yet.\n   */\n  isLoading: false;\n  /**\n   * Query is currently fetching, but might have data from an earlier request.\n   */\n  isFetching: false;\n  /**\n   * Query has data from a successful load.\n   */\n  isSuccess: false;\n  /**\n   * Query is currently in \"error\" state.\n   */\n  isError: false;\n};\ntype UseQueryStateUninitialized<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<Extract<UseQueryStateBaseResult<D>, {\n  status: QueryStatus.uninitialized;\n}>, {\n  isUninitialized: true;\n}>;\ntype UseQueryStateLoading<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isLoading: true;\n  isFetching: boolean;\n  data: undefined;\n}>;\ntype UseQueryStateSuccessFetching<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isSuccess: true;\n  isFetching: true;\n  error: undefined;\n} & {\n  data: ResultTypeFrom<D>;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'fulfilledTimeStamp'>>>;\ntype UseQueryStateSuccessNotFetching<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isSuccess: true;\n  isFetching: false;\n  error: undefined;\n} & {\n  data: ResultTypeFrom<D>;\n  currentData: ResultTypeFrom<D>;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'fulfilledTimeStamp'>>>;\ntype UseQueryStateError<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isError: true;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'error'>>>;\ntype UseQueryStateDefaultResult<D extends QueryDefinition<any, any, any, any>> = TSHelpersId<UseQueryStateUninitialized<D> | UseQueryStateLoading<D> | UseQueryStateSuccessFetching<D> | UseQueryStateSuccessNotFetching<D> | UseQueryStateError<D>> & {\n  /**\n   * @deprecated Included for completeness, but discouraged.\n   * Please use the `isLoading`, `isFetching`, `isSuccess`, `isError`\n   * and `isUninitialized` flags instead\n   */\n  status: QueryStatus;\n};\nexport type LazyInfiniteQueryTrigger<D extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  /**\n   * Triggers a lazy query.\n   *\n   * By default, this will start a new request even if there is already a value in the cache.\n   * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a lazy query, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await getUserById(1).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>, direction: InfiniteQueryDirection): InfiniteQueryActionCreatorResult<D>;\n};\nexport type TypedLazyInfiniteQueryTrigger<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = LazyInfiniteQueryTrigger<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type UseInfiniteQuerySubscriptionOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>> = SubscriptionOptions & {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When `skip` is true (or `skipToken` is passed in as `arg`):\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```tsx\n   * // codeblock-meta no-transpile title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n  initialPageParam?: PageParamFrom<D>;\n  /**\n   * Defaults to `true`. When this is `true` and an infinite query endpoint is refetched\n   * (due to tag invalidation, polling, arg change configuration, or manual refetching),\n   * RTK Query will try to sequentially refetch all pages currently in the cache.\n   * When `false` only the first page will be refetched.\n   *\n   * This option applies to all automatic refetches for this subscription (polling, tag invalidation, etc.).\n   * It can be overridden on a per-call basis using the `refetch()` method.\n   */\n  refetchCachedPages?: boolean;\n};\nexport type TypedUseInfiniteQuerySubscription<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuerySubscription<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type UseInfiniteQuerySubscriptionResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  refetch: (options?: Pick<UseInfiniteQuerySubscriptionOptions<D>, 'refetchCachedPages'>) => InfiniteQueryActionCreatorResult<D>;\n  trigger: LazyInfiniteQueryTrigger<D>;\n  fetchNextPage: () => InfiniteQueryActionCreatorResult<D>;\n  fetchPreviousPage: () => InfiniteQueryActionCreatorResult<D>;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useQuerySubscription` hook in userland code.\n */\nexport type TypedUseInfiniteQuerySubscriptionResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuerySubscriptionResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type InfiniteQueryStateSelector<R extends Record<string, any>, D extends InfiniteQueryDefinition<any, any, any, any, any>> = (state: UseInfiniteQueryStateDefaultResult<D>) => R;\nexport type TypedInfiniteQueryStateSelector<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = InfiniteQueryStateSelector<SelectedResult, InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.  Additionally, it will cache multiple \"pages\" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.\n *\n *  The `data` field will be a `{pages: Data[], pageParams: PageParam[]}` structure containing all fetched page responses and the corresponding page param values for each page. You may use this to render individual pages, combine all pages into a single infinite list, or other display logic as needed.\n *\n * This hook combines the functionality of both [`useInfiniteQueryState`](#useinfinitequerystate) and [`useInfiniteQuerySubscription`](#useinfinitequerysubscription) together, and is intended to be used in the majority of situations.\n *\n * As with normal query hooks, `skipToken` is a valid argument that will skip the query from executing.\n *\n * By default, the initial request will use the `initialPageParam` value that was defined on the infinite query endpoint. If you want to start from a different value, you can pass `initialPageParam` as part of the hook options to override that initial request value.\n *\n * Use the returned `fetchNextPage` and `fetchPreviousPage` methods on the hook result object to trigger fetches forwards and backwards. These will always calculate the next or previous page param based on the current cached pages and the provided `getNext/PreviousPageParam` callbacks defined in the endpoint.\n *\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseInfiniteQuery<D extends InfiniteQueryDefinition<any, any, any, any, any>> = <R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<D>>(arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQuerySubscriptionOptions<D> & UseInfiniteQueryStateOptions<D, R>) => UseInfiniteQueryHookResult<D, R> & Pick<UseInfiniteQuerySubscriptionResult<D>, 'fetchNextPage' | 'fetchPreviousPage'>;\nexport type TypedUseInfiniteQuery<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuery<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * Note that this hook does not trigger fetching new data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQuerySubscription`](#useinfinitequerysubscription).\n *\n * #### Features\n *\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseInfiniteQueryState<D extends InfiniteQueryDefinition<any, any, any, any, any>> = <R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<D>>(arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQueryStateOptions<D, R>) => UseInfiniteQueryStateResult<D, R>;\nexport type TypedUseInfiniteQueryState<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQueryState<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data. Additionally, it will cache multiple \"pages\" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQueryState`](#useinfinitequerystate).\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n */\nexport type UseInfiniteQuerySubscription<D extends InfiniteQueryDefinition<any, any, any, any, any>> = (arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQuerySubscriptionOptions<D>) => UseInfiniteQuerySubscriptionResult<D>;\nexport type UseInfiniteQueryHookResult<D extends InfiniteQueryDefinition<any, any, any, any, any>, R = UseInfiniteQueryStateDefaultResult<D>> = UseInfiniteQueryStateResult<D, R> & Pick<UseInfiniteQuerySubscriptionResult<D>, 'refetch' | 'fetchNextPage' | 'fetchPreviousPage'>;\nexport type TypedUseInfiniteQueryHookResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryHookResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, R>;\nexport type UseInfiniteQueryStateOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>, R extends Record<string, any>> = {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When skip is true:\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after skipping the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.\n   * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.\n   * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.\n   * Note that this should always return an object (not a primitive), as RTKQ adds fields to the return value.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using selectFromResult to extract a single result\"\n   * function PostsList() {\n   *   const { data: posts } = api.useGetPostsQuery();\n   *\n   *   return (\n   *     <ul>\n   *       {posts?.data?.map((post) => (\n   *         <PostById key={post.id} id={post.id} />\n   *       ))}\n   *     </ul>\n   *   );\n   * }\n   *\n   * function PostById({ id }: { id: number }) {\n   *   // Will select the post with the given id, and will only rerender if the given posts data changes\n   *   const { post } = api.useGetPostsQuery(undefined, {\n   *     selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),\n   *   });\n   *\n   *   return <li>{post?.name}</li>;\n   * }\n   * ```\n   */\n  selectFromResult?: InfiniteQueryStateSelector<R, D>;\n};\nexport type TypedUseInfiniteQueryStateOptions<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryStateOptions<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, SelectedResult>;\nexport type UseInfiniteQueryStateResult<D extends InfiniteQueryDefinition<any, any, any, any, any>, R = UseInfiniteQueryStateDefaultResult<D>> = TSHelpersNoInfer<R>;\nexport type TypedUseInfiniteQueryStateResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, R = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryStateResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, R>;\ntype UseInfiniteQueryStateBaseResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = InfiniteQuerySubState<D> & {\n  /**\n   * Where `data` tries to hold data as much as possible, also re-using\n   * data from the last arguments passed into the hook, this property\n   * will always contain the received data from the query, for the current query arguments.\n   */\n  currentData?: InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>;\n  /**\n   * Query has not started yet.\n   */\n  isUninitialized: false;\n  /**\n   * Query is currently loading for the first time. No data yet.\n   */\n  isLoading: false;\n  /**\n   * Query is currently fetching, but might have data from an earlier request.\n   */\n  isFetching: false;\n  /**\n   * Query has data from a successful load.\n   */\n  isSuccess: false;\n  /**\n   * Query is currently in \"error\" state.\n   */\n  isError: false;\n  hasNextPage: boolean;\n  hasPreviousPage: boolean;\n  isFetchingNextPage: boolean;\n  isFetchingPreviousPage: boolean;\n};\ntype UseInfiniteQueryStateDefaultResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = TSHelpersId<TSHelpersOverride<Extract<UseInfiniteQueryStateBaseResult<D>, {\n  status: QueryStatus.uninitialized;\n}>, {\n  isUninitialized: true;\n}> | TSHelpersOverride<UseInfiniteQueryStateBaseResult<D>, {\n  isLoading: true;\n  isFetching: boolean;\n  data: undefined;\n} | ({\n  isSuccess: true;\n  isFetching: true;\n  error: undefined;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp'>>) | ({\n  isSuccess: true;\n  isFetching: false;\n  error: undefined;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp' | 'currentData'>>) | ({\n  isError: true;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'error'>>)>> & {\n  /**\n   * @deprecated Included for completeness, but discouraged.\n   * Please use the `isLoading`, `isFetching`, `isSuccess`, `isError`\n   * and `isUninitialized` flags instead\n   */\n  status: QueryStatus;\n};\nexport type MutationStateSelector<R extends Record<string, any>, D extends MutationDefinition<any, any, any, any>> = (state: MutationResultSelectorResult<D>) => R;\nexport type UseMutationStateOptions<D extends MutationDefinition<any, any, any, any>, R extends Record<string, any>> = {\n  selectFromResult?: MutationStateSelector<R, D>;\n  fixedCacheKey?: string;\n};\nexport type UseMutationStateResult<D extends MutationDefinition<any, any, any, any>, R> = TSHelpersNoInfer<R> & {\n  originalArgs?: QueryArgFrom<D>;\n  /**\n   * Resets the hook state to its initial `uninitialized` state.\n   * This will also remove the last result from the cache.\n   */\n  reset: () => void;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useMutation` hook in userland code.\n */\nexport type TypedUseMutationResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = MutationResultSelectorResult<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseMutationStateResult<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>, R>;\n\n/**\n * A React hook that lets you trigger an update request for a given endpoint, and subscribes the component to read the request status from the Redux store. The component will re-render as the loading status changes.\n *\n * #### Features\n *\n * - Manual control over firing a request to alter data on the server or possibly invalidate the cache\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseMutation<D extends MutationDefinition<any, any, any, any>> = <R extends Record<string, any> = MutationResultSelectorResult<D>>(options?: UseMutationStateOptions<D, R>) => readonly [MutationTrigger<D>, UseMutationStateResult<D, R>];\nexport type TypedUseMutation<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseMutation<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type MutationTrigger<D extends MutationDefinition<any, any, any, any>> = {\n  /**\n   * Triggers the mutation and returns a Promise.\n   * @remarks\n   * If you need to access the error or success payload immediately after a mutation, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await addPost({ id: 1, name: 'Example' }).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>): MutationActionCreatorResult<D>;\n};\nexport type TypedMutationTrigger<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = MutationTrigger<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * Wrapper around `defaultQueryStateSelector` to be used in `useQuery`.\n * We want the initial render to already come back with\n * `{ isUninitialized: false, isFetching: true, isLoading: true }`\n * to prevent that the library user has to do an additional check for `isUninitialized`/\n */\nconst noPendingQueryStateSelector: QueryStateSelector<any, any> = selected => {\n  if (selected.isUninitialized) {\n    return {\n      ...selected,\n      isUninitialized: false,\n      isFetching: true,\n      isLoading: selected.data !== undefined ? false : true,\n      // This is the one place where we still have to use `QueryStatus` as an enum,\n      // since it's the only reference in the React package and not in the core.\n      status: QueryStatus.pending\n    } as any;\n  }\n  return selected;\n};\nfunction pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K> {\n  const ret: any = {};\n  keys.forEach(key => {\n    ret[key] = obj[key];\n  });\n  return ret;\n}\nconst COMMON_HOOK_DEBUG_FIELDS = ['data', 'status', 'isLoading', 'isSuccess', 'isError', 'error'] as const;\ntype GenericPrefetchThunk = (endpointName: any, arg: any, options: PrefetchOptions) => ThunkAction<void, any, any, UnknownAction>;\n\n/**\n *\n * @param opts.api - An API with defined endpoints to create hooks for\n * @param opts.moduleOptions.batch - The version of the `batchedUpdates` function to be used\n * @param opts.moduleOptions.useDispatch - The version of the `useDispatch` hook to be used\n * @param opts.moduleOptions.useSelector - The version of the `useSelector` hook to be used\n * @returns An object containing functions to generate hooks based on an endpoint\n */\nexport function buildHooks<Definitions extends EndpointDefinitions>({\n  api,\n  moduleOptions: {\n    batch,\n    hooks: {\n      useDispatch,\n      useSelector,\n      useStore\n    },\n    unstable__sideEffectsInRender,\n    createSelector\n  },\n  serializeQueryArgs,\n  context\n}: {\n  api: Api<any, Definitions, any, any, CoreModule>;\n  moduleOptions: Required<ReactHooksModuleOptions>;\n  serializeQueryArgs: SerializeQueryArgs<any>;\n  context: ApiContext<Definitions>;\n}) {\n  const usePossiblyImmediateEffect: (effect: () => void | undefined, deps?: DependencyList) => void = unstable__sideEffectsInRender ? cb => cb() : useEffect;\n  type UnsubscribePromiseRef = React.RefObject<{\n    unsubscribe?: () => void;\n  } | undefined>;\n  const unsubscribePromiseRef = (ref: UnsubscribePromiseRef) => ref.current?.unsubscribe?.();\n  const endpointDefinitions = context.endpointDefinitions;\n  return {\n    buildQueryHooks,\n    buildInfiniteQueryHooks,\n    buildMutationHook,\n    usePrefetch\n  };\n  function queryStatePreSelector(currentState: QueryResultSelectorResult<any>, lastResult: UseQueryStateDefaultResult<any> | undefined, queryArgs: any): UseQueryStateDefaultResult<any> {\n    // if we had a last result and the current result is uninitialized,\n    // we might have called `api.util.resetApiState`\n    // in this case, reset the hook\n    if (lastResult?.endpointName && currentState.isUninitialized) {\n      const {\n        endpointName\n      } = lastResult;\n      const endpointDefinition = endpointDefinitions[endpointName];\n      if (queryArgs !== skipToken && serializeQueryArgs({\n        queryArgs: lastResult.originalArgs,\n        endpointDefinition,\n        endpointName\n      }) === serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      })) lastResult = undefined;\n    }\n\n    // data is the last known good request result we have tracked - or if none has been tracked yet the last good result for the current args\n    let data = currentState.isSuccess ? currentState.data : lastResult?.data;\n    if (data === undefined) data = currentState.data;\n    const hasData = data !== undefined;\n\n    // isFetching = true any time a request is in flight\n    const isFetching = currentState.isLoading;\n\n    // isLoading = true only when loading while no data is present yet (initial load with no data in the cache)\n    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;\n\n    // isSuccess = true when data is present and we're not refetching after an error.\n    // That includes cases where the _current_ item is either actively\n    // fetching or about to fetch due to an uninitialized entry.\n    const isSuccess = currentState.isSuccess || hasData && (isFetching && !lastResult?.isError || currentState.isUninitialized);\n    return {\n      ...currentState,\n      data,\n      currentData: currentState.data,\n      isFetching,\n      isLoading,\n      isSuccess\n    } as UseQueryStateDefaultResult<any>;\n  }\n  function infiniteQueryStatePreSelector(currentState: InfiniteQueryResultSelectorResult<any>, lastResult: UseInfiniteQueryStateDefaultResult<any> | undefined, queryArgs: any): UseInfiniteQueryStateDefaultResult<any> {\n    // if we had a last result and the current result is uninitialized,\n    // we might have called `api.util.resetApiState`\n    // in this case, reset the hook\n    if (lastResult?.endpointName && currentState.isUninitialized) {\n      const {\n        endpointName\n      } = lastResult;\n      const endpointDefinition = endpointDefinitions[endpointName];\n      if (queryArgs !== skipToken && serializeQueryArgs({\n        queryArgs: lastResult.originalArgs,\n        endpointDefinition,\n        endpointName\n      }) === serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      })) lastResult = undefined;\n    }\n\n    // data is the last known good request result we have tracked - or if none has been tracked yet the last good result for the current args\n    let data = currentState.isSuccess ? currentState.data : lastResult?.data;\n    if (data === undefined) data = currentState.data;\n    const hasData = data !== undefined;\n\n    // isFetching = true any time a request is in flight\n    const isFetching = currentState.isLoading;\n    // isLoading = true only when loading while no data is present yet (initial load with no data in the cache)\n    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;\n    // isSuccess = true when data is present\n    const isSuccess = currentState.isSuccess || isFetching && hasData;\n    return {\n      ...currentState,\n      data,\n      currentData: currentState.data,\n      isFetching,\n      isLoading,\n      isSuccess\n    } as UseInfiniteQueryStateDefaultResult<any>;\n  }\n  function usePrefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, defaultOptions?: PrefetchOptions) {\n    const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n    const stableDefaultOptions = useShallowStableValue(defaultOptions);\n    return useCallback((arg: any, options?: PrefetchOptions) => dispatch((api.util.prefetch as GenericPrefetchThunk)(endpointName, arg, {\n      ...stableDefaultOptions,\n      ...options\n    })), [endpointName, dispatch, stableDefaultOptions]);\n  }\n  function useQuerySubscriptionCommonImpl<T extends QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>(endpointName: string, arg: unknown | SkipToken, {\n    refetchOnReconnect,\n    refetchOnFocus,\n    refetchOnMountOrArgChange,\n    skip = false,\n    pollingInterval = 0,\n    skipPollingIfUnfocused = false,\n    ...rest\n  }: UseQuerySubscriptionOptions = {}) {\n    const {\n      initiate\n    } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n    const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n\n    // TODO: Change this to `useRef<SubscriptionSelectors>(undefined)` after upgrading to React 19.\n    const subscriptionSelectorsRef = useRef<SubscriptionSelectors | undefined>(undefined);\n    if (!subscriptionSelectorsRef.current) {\n      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());\n      if (process.env.NODE_ENV !== 'production') {\n        if (typeof returnedValue !== 'object' || typeof returnedValue?.type === 'string') {\n          throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(37) : `Warning: Middleware for RTK-Query API at reducerPath \"${api.reducerPath}\" has not been added to the store.\n    You must add the middleware for RTK-Query to function correctly!`);\n        }\n      }\n      subscriptionSelectorsRef.current = returnedValue as unknown as SubscriptionSelectors;\n    }\n    const stableArg = useStableQueryArgs(skip ? skipToken : arg);\n    const stableSubscriptionOptions = useShallowStableValue({\n      refetchOnReconnect,\n      refetchOnFocus,\n      pollingInterval,\n      skipPollingIfUnfocused\n    });\n    const initialPageParam = (rest as UseInfiniteQuerySubscriptionOptions<any>).initialPageParam;\n    const stableInitialPageParam = useShallowStableValue(initialPageParam);\n    const refetchCachedPages = (rest as UseInfiniteQuerySubscriptionOptions<any>).refetchCachedPages;\n    const stableRefetchCachedPages = useShallowStableValue(refetchCachedPages);\n\n    /**\n     * @todo Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n     */\n    const promiseRef = useRef<T | undefined>(undefined);\n    let {\n      queryCacheKey,\n      requestId\n    } = promiseRef.current || {};\n\n    // HACK We've saved the middleware subscription lookup callbacks into a ref,\n    // so we can directly check here if the subscription exists for this query.\n    let currentRenderHasSubscription = false;\n    if (queryCacheKey && requestId) {\n      currentRenderHasSubscription = subscriptionSelectorsRef.current.isRequestSubscribed(queryCacheKey, requestId);\n    }\n    const subscriptionRemoved = !currentRenderHasSubscription && promiseRef.current !== undefined;\n    usePossiblyImmediateEffect((): void | undefined => {\n      if (subscriptionRemoved) {\n        promiseRef.current = undefined;\n      }\n    }, [subscriptionRemoved]);\n    usePossiblyImmediateEffect((): void | undefined => {\n      const lastPromise = promiseRef.current;\n      if (typeof process !== 'undefined' && process.env.NODE_ENV === 'removeMeOnCompilation') {\n        // this is only present to enforce the rule of hooks to keep `isSubscribed` in the dependency array\n        console.log(subscriptionRemoved);\n      }\n      if (stableArg === skipToken) {\n        lastPromise?.unsubscribe();\n        promiseRef.current = undefined;\n        return;\n      }\n      const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions;\n      if (!lastPromise || lastPromise.arg !== stableArg) {\n        lastPromise?.unsubscribe();\n        const promise = dispatch(initiate(stableArg, {\n          subscriptionOptions: stableSubscriptionOptions,\n          forceRefetch: refetchOnMountOrArgChange,\n          ...(isInfiniteQueryDefinition(endpointDefinitions[endpointName]) ? {\n            initialPageParam: stableInitialPageParam,\n            refetchCachedPages: stableRefetchCachedPages\n          } : {})\n        }));\n        promiseRef.current = promise as T;\n      } else if (stableSubscriptionOptions !== lastSubscriptionOptions) {\n        lastPromise.updateSubscriptionOptions(stableSubscriptionOptions);\n      }\n    }, [dispatch, initiate, refetchOnMountOrArgChange, stableArg, stableSubscriptionOptions, subscriptionRemoved, stableInitialPageParam, stableRefetchCachedPages, endpointName]);\n    return [promiseRef, dispatch, initiate, stableSubscriptionOptions] as const;\n  }\n  function buildUseQueryState(endpointName: string, preSelector: typeof queryStatePreSelector | typeof infiniteQueryStatePreSelector) {\n    const useQueryState = (arg: any, {\n      skip = false,\n      selectFromResult\n    }: UseQueryStateOptions<any, any> | UseInfiniteQueryStateOptions<any, any> = {}) => {\n      const {\n        select\n      } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n      const stableArg = useStableQueryArgs(skip ? skipToken : arg);\n      type ApiRootState = Parameters<ReturnType<typeof select>>[0];\n      const lastValue = useRef<any>(undefined);\n      const selectDefaultResult: Selector<ApiRootState, any, [any]> = useMemo(() =>\n      // Normally ts-ignores are bad and should be avoided, but we're\n      // already casting this selector to be `Selector<any>` anyway,\n      // so the inconsistencies don't matter here\n      // @ts-ignore\n      createSelector([\n      // @ts-ignore\n      select(stableArg), (_: ApiRootState, lastResult: any) => lastResult, (_: ApiRootState) => stableArg], preSelector, {\n        memoizeOptions: {\n          resultEqualityCheck: shallowEqual\n        }\n      }), [select, stableArg]);\n      const querySelector: Selector<ApiRootState, any, [any]> = useMemo(() => selectFromResult ? createSelector([selectDefaultResult], selectFromResult, {\n        devModeChecks: {\n          identityFunctionCheck: 'never'\n        }\n      }) : selectDefaultResult, [selectDefaultResult, selectFromResult]);\n      const currentState = useSelector((state: RootState<Definitions, any, any>) => querySelector(state, lastValue.current), shallowEqual);\n      const store = useStore<RootState<Definitions, any, any>>();\n      const newLastValue = selectDefaultResult(store.getState(), lastValue.current);\n      useIsomorphicLayoutEffect(() => {\n        lastValue.current = newLastValue;\n      }, [newLastValue]);\n      return currentState;\n    };\n    return useQueryState;\n  }\n  function usePromiseRefUnsubscribeOnUnmount(promiseRef: UnsubscribePromiseRef) {\n    useEffect(() => {\n      return () => {\n        unsubscribePromiseRef(promiseRef)\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n        ;\n        (promiseRef.current as any) = undefined;\n      };\n    }, [promiseRef]);\n  }\n  function refetchOrErrorIfUnmounted<T extends QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>(promiseRef: React.RefObject<T | undefined>): T {\n    if (!promiseRef.current) throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(38) : 'Cannot refetch a query that has not been started yet.');\n    return promiseRef.current.refetch() as T;\n  }\n  function buildQueryHooks(endpointName: string): QueryHooks<any> {\n    const useQuerySubscription: UseQuerySubscription<any> = (arg: any, options = {}) => {\n      const [promiseRef] = useQuerySubscriptionCommonImpl<QueryActionCreatorResult<any>>(endpointName, arg, options);\n      usePromiseRefUnsubscribeOnUnmount(promiseRef);\n      return useMemo(() => ({\n        /**\n         * A method to manually refetch data for the query\n         */\n        refetch: () => refetchOrErrorIfUnmounted(promiseRef)\n      }), [promiseRef]);\n    };\n    const useLazyQuerySubscription: UseLazyQuerySubscription<any> = ({\n      refetchOnReconnect,\n      refetchOnFocus,\n      pollingInterval = 0,\n      skipPollingIfUnfocused = false\n    } = {}) => {\n      const {\n        initiate\n      } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n      const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n      const [arg, setArg] = useState<any>(UNINITIALIZED_VALUE);\n\n      // TODO: Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n      /**\n       * @todo Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n       */\n      const promiseRef = useRef<QueryActionCreatorResult<any> | undefined>(undefined);\n      const stableSubscriptionOptions = useShallowStableValue({\n        refetchOnReconnect,\n        refetchOnFocus,\n        pollingInterval,\n        skipPollingIfUnfocused\n      });\n      usePossiblyImmediateEffect(() => {\n        const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions;\n        if (stableSubscriptionOptions !== lastSubscriptionOptions) {\n          promiseRef.current?.updateSubscriptionOptions(stableSubscriptionOptions);\n        }\n      }, [stableSubscriptionOptions]);\n      const subscriptionOptionsRef = useRef(stableSubscriptionOptions);\n      usePossiblyImmediateEffect(() => {\n        subscriptionOptionsRef.current = stableSubscriptionOptions;\n      }, [stableSubscriptionOptions]);\n      const trigger = useCallback(function (arg: any, preferCacheValue = false) {\n        let promise: QueryActionCreatorResult<any>;\n        batch(() => {\n          unsubscribePromiseRef(promiseRef);\n          promiseRef.current = promise = dispatch(initiate(arg, {\n            subscriptionOptions: subscriptionOptionsRef.current,\n            forceRefetch: !preferCacheValue\n          }));\n          setArg(arg);\n        });\n        return promise!;\n      }, [dispatch, initiate]);\n      const reset = useCallback(() => {\n        if (promiseRef.current?.queryCacheKey) {\n          dispatch(api.internalActions.removeQueryResult({\n            queryCacheKey: promiseRef.current?.queryCacheKey as QueryCacheKey\n          }));\n        }\n      }, [dispatch]);\n\n      /* cleanup on unmount */\n      useEffect(() => {\n        return () => {\n          unsubscribePromiseRef(promiseRef);\n        };\n      }, []);\n\n      /* if \"cleanup on unmount\" was triggered from a fast refresh, we want to reinstate the query */\n      useEffect(() => {\n        if (arg !== UNINITIALIZED_VALUE && !promiseRef.current) {\n          trigger(arg, true);\n        }\n      }, [arg, trigger]);\n      return useMemo(() => [trigger, arg, {\n        reset\n      }] as const, [trigger, arg, reset]);\n    };\n    const useQueryState: UseQueryState<any> = buildUseQueryState(endpointName, queryStatePreSelector);\n    return {\n      useQueryState,\n      useQuerySubscription,\n      useLazyQuerySubscription,\n      useLazyQuery(options) {\n        const [trigger, arg, {\n          reset\n        }] = useLazyQuerySubscription(options);\n        const queryStateResults = useQueryState(arg, {\n          ...options,\n          skip: arg === UNINITIALIZED_VALUE\n        });\n        const info = useMemo(() => ({\n          lastArg: arg\n        }), [arg]);\n        return useMemo(() => [trigger, {\n          ...queryStateResults,\n          reset\n        }, info], [trigger, queryStateResults, reset, info]);\n      },\n      useQuery(arg, options) {\n        const querySubscriptionResults = useQuerySubscription(arg, options);\n        const queryStateResults = useQueryState(arg, {\n          selectFromResult: arg === skipToken || options?.skip ? undefined : noPendingQueryStateSelector,\n          ...options\n        });\n        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS);\n        useDebugValue(debugValue);\n        return useMemo(() => ({\n          ...queryStateResults,\n          ...querySubscriptionResults\n        }), [queryStateResults, querySubscriptionResults]);\n      }\n    };\n  }\n  function buildInfiniteQueryHooks(endpointName: string): InfiniteQueryHooks<any> {\n    const useInfiniteQuerySubscription: UseInfiniteQuerySubscription<any> = (arg: any, options = {}) => {\n      const [promiseRef, dispatch, initiate, stableSubscriptionOptions] = useQuerySubscriptionCommonImpl<InfiniteQueryActionCreatorResult<any>>(endpointName, arg, options);\n      const subscriptionOptionsRef = useRef(stableSubscriptionOptions);\n      usePossiblyImmediateEffect(() => {\n        subscriptionOptionsRef.current = stableSubscriptionOptions;\n      }, [stableSubscriptionOptions]);\n\n      // Extract and stabilize the hook-level refetchCachedPages option\n      const hookRefetchCachedPages = (options as UseInfiniteQuerySubscriptionOptions<any>).refetchCachedPages;\n      const stableHookRefetchCachedPages = useShallowStableValue(hookRefetchCachedPages);\n      const trigger: LazyInfiniteQueryTrigger<any> = useCallback(function (arg: unknown, direction: 'forward' | 'backward') {\n        let promise: InfiniteQueryActionCreatorResult<any>;\n        batch(() => {\n          unsubscribePromiseRef(promiseRef);\n          promiseRef.current = promise = dispatch((initiate as StartInfiniteQueryActionCreator<any>)(arg, {\n            subscriptionOptions: subscriptionOptionsRef.current,\n            direction\n          }));\n        });\n        return promise!;\n      }, [promiseRef, dispatch, initiate]);\n      usePromiseRefUnsubscribeOnUnmount(promiseRef);\n      const stableArg = useStableQueryArgs(options.skip ? skipToken : arg);\n      const refetch = useCallback((options?: Pick<UseInfiniteQuerySubscriptionOptions<any>, 'refetchCachedPages'>) => {\n        if (!promiseRef.current) throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(38) : 'Cannot refetch a query that has not been started yet.');\n        // Merge per-call options with hook-level default\n        const mergedOptions = {\n          refetchCachedPages: options?.refetchCachedPages ?? stableHookRefetchCachedPages\n        };\n        return promiseRef.current.refetch(mergedOptions);\n      }, [promiseRef, stableHookRefetchCachedPages]);\n      return useMemo(() => {\n        const fetchNextPage = () => {\n          return trigger(stableArg, 'forward');\n        };\n        const fetchPreviousPage = () => {\n          return trigger(stableArg, 'backward');\n        };\n        return {\n          trigger,\n          /**\n           * A method to manually refetch data for the query\n           */\n          refetch,\n          fetchNextPage,\n          fetchPreviousPage\n        };\n      }, [refetch, trigger, stableArg]);\n    };\n    const useInfiniteQueryState: UseInfiniteQueryState<any> = buildUseQueryState(endpointName, infiniteQueryStatePreSelector);\n    return {\n      useInfiniteQueryState,\n      useInfiniteQuerySubscription,\n      useInfiniteQuery(arg, options) {\n        const {\n          refetch,\n          fetchNextPage,\n          fetchPreviousPage\n        } = useInfiniteQuerySubscription(arg, options);\n        const queryStateResults = useInfiniteQueryState(arg, {\n          selectFromResult: arg === skipToken || options?.skip ? undefined : noPendingQueryStateSelector,\n          ...options\n        });\n        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS, 'hasNextPage', 'hasPreviousPage');\n        useDebugValue(debugValue);\n        return useMemo(() => ({\n          ...queryStateResults,\n          fetchNextPage,\n          fetchPreviousPage,\n          refetch\n        }), [queryStateResults, fetchNextPage, fetchPreviousPage, refetch]);\n      }\n    };\n  }\n  function buildMutationHook(name: string): UseMutation<any> {\n    return ({\n      selectFromResult,\n      fixedCacheKey\n    } = {}) => {\n      const {\n        select,\n        initiate\n      } = api.endpoints[name] as ApiEndpointMutation<MutationDefinition<any, any, any, any, any>, Definitions>;\n      const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n      const [promise, setPromise] = useState<MutationActionCreatorResult<any>>();\n      useEffect(() => () => {\n        if (!promise?.arg.fixedCacheKey) {\n          promise?.reset();\n        }\n      }, [promise]);\n      const triggerMutation = useCallback(function (arg: Parameters<typeof initiate>['0']) {\n        const promise = dispatch(initiate(arg, {\n          fixedCacheKey\n        }));\n        setPromise(promise);\n        return promise;\n      }, [dispatch, initiate, fixedCacheKey]);\n      const {\n        requestId\n      } = promise || {};\n      const selectDefaultResult = useMemo(() => select({\n        fixedCacheKey,\n        requestId: promise?.requestId\n      }), [fixedCacheKey, promise, select]);\n      const mutationSelector = useMemo((): Selector<RootState<Definitions, any, any>, any> => selectFromResult ? createSelector([selectDefaultResult], selectFromResult) : selectDefaultResult, [selectFromResult, selectDefaultResult]);\n      const currentState = useSelector(mutationSelector, shallowEqual);\n      const originalArgs = fixedCacheKey == null ? promise?.arg.originalArgs : undefined;\n      const reset = useCallback(() => {\n        batch(() => {\n          if (promise) {\n            setPromise(undefined);\n          }\n          if (fixedCacheKey) {\n            dispatch(api.internalActions.removeMutationResult({\n              requestId,\n              fixedCacheKey\n            }));\n          }\n        });\n      }, [dispatch, fixedCacheKey, promise, requestId]);\n      const debugValue = pick(currentState, ...COMMON_HOOK_DEBUG_FIELDS, 'endpointName');\n      useDebugValue(debugValue);\n      const finalState = useMemo(() => ({\n        ...currentState,\n        originalArgs,\n        reset\n      }), [currentState, originalArgs, reset]);\n      return useMemo(() => [triggerMutation, finalState] as const, [triggerMutation, finalState]);\n    };\n  }\n}","export { useEffect, useRef, useMemo, useContext, useCallback, useDebugValue, useLayoutEffect, useState } from 'react';","export { shallowEqual, Provider, ReactReduxContext } from 'react-redux';","export const UNINITIALIZED_VALUE = Symbol();\nexport type UninitializedValue = typeof UNINITIALIZED_VALUE;","import { useEffect, useRef, useMemo } from './reactImports';\nimport { copyWithStructuralSharing } from './rtkqImports';\nexport function useStableQueryArgs<T>(queryArgs: T) {\n  const cache = useRef(queryArgs);\n  const copy = useMemo(() => copyWithStructuralSharing(cache.current, queryArgs), [queryArgs]);\n  useEffect(() => {\n    if (cache.current !== copy) {\n      cache.current = copy;\n    }\n  }, [copy]);\n  return copy;\n}","import { useEffect, useRef } from './reactImports';\nimport { shallowEqual } from './reactReduxImports';\nexport function useShallowStableValue<T>(value: T) {\n  const cache = useRef(value);\n  useEffect(() => {\n    if (!shallowEqual(cache.current, value)) {\n      cache.current = value;\n    }\n  }, [value]);\n  return shallowEqual(cache.current, value) ? cache.current : value;\n}","import { configureStore, formatProdErrorMessage as _formatProdErrorMessage } from '@reduxjs/toolkit';\nimport type { Context } from 'react';\nimport { useContext, useEffect } from './reactImports';\nimport * as React from 'react';\nimport type { ReactReduxContextValue } from 'react-redux';\nimport { Provider, ReactReduxContext } from './reactReduxImports';\nimport { setupListeners } from './rtkqImports';\nimport type { Api } from '@reduxjs/toolkit/query';\n\n/**\n * Can be used as a `Provider` if you **do not already have a Redux store**.\n *\n * @example\n * ```tsx\n * // codeblock-meta no-transpile title=\"Basic usage - wrap your App with ApiProvider\"\n * import * as React from 'react';\n * import { ApiProvider } from '@reduxjs/toolkit/query/react';\n * import { Pokemon } from './features/Pokemon';\n *\n * function App() {\n *   return (\n *     <ApiProvider api={api}>\n *       <Pokemon />\n *     </ApiProvider>\n *   );\n * }\n * ```\n *\n * @remarks\n * Using this together with an existing redux store, both will\n * conflict with each other - please use the traditional redux setup\n * in that case.\n */\nexport function ApiProvider(props: {\n  children: any;\n  api: Api<any, {}, any, any>;\n  setupListeners?: Parameters<typeof setupListeners>[1] | false;\n  context?: Context<ReactReduxContextValue | null>;\n}) {\n  const context = props.context || ReactReduxContext;\n  const existingContext = useContext(context);\n  if (existingContext) {\n    throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(35) : 'Existing Redux context detected. If you already have a store set up, please use the traditional Redux setup.');\n  }\n  const [store] = React.useState(() => configureStore({\n    reducer: {\n      [props.api.reducerPath]: props.api.reducer\n    },\n    middleware: gDM => gDM().concat(props.api.middleware)\n  }));\n  // Adds the event listeners for online/offline/focus/etc\n  useEffect((): undefined | (() => void) => props.setupListeners === false ? undefined : setupListeners(store.dispatch, props.setupListeners), [props.setupListeners, store.dispatch]);\n  return <Provider store={store} context={context}>\n      {props.children}\n    </Provider>;\n}"],"mappings":"qnBAAA,IAAAA,EAAA,GAAAC,GAAAD,EAAA,iBAAAE,GAAA,wBAAAC,EAAA,cAAAC,GAAA,qBAAAC,GAAA,yBAAAC,KAAA,eAAAC,GAAAP,GCAA,IAAAQ,EAA8G,kCCA9G,IAAAC,GAAkE,4BAElEC,EAAqH,uBAErHC,GAAkD,oBCJ3C,SAASC,EAAWC,EAAa,CACtC,OAAOA,EAAI,QAAQA,EAAI,CAAC,EAAGA,EAAI,CAAC,EAAE,YAAY,CAAC,CACjD,CCuYO,IAAMC,GAAiB,QACjBC,GAAoB,WACpBC,GAAyB,gBA+c/B,SAASC,GAAkB,EAA8G,CAC9I,OAAO,EAAE,OAASH,EACpB,CACO,SAASI,GAAqB,EAAiH,CACpJ,OAAO,EAAE,OAASH,EACpB,CACO,SAASI,EAA0B,EAA2H,CACnK,OAAO,EAAE,OAASH,EACpB,CC91BO,SAASI,EAA6BC,KAAcC,EAAqC,CAC9F,OAAO,OAAO,OAAOD,EAAQ,GAAGC,CAAI,CACtC,CCNA,IAAAC,EAA0K,4BCA1K,IAAAC,EAA8G,iBCA9G,IAAAC,EAA0D,uBCAnD,IAAMC,EAAsB,OAAO,ECEnC,SAASC,EAAsBC,EAAc,CAClD,IAAMC,KAAQ,UAAOD,CAAS,EACxBE,KAAO,WAAQ,OAAM,6BAA0BD,EAAM,QAASD,CAAS,EAAG,CAACA,CAAS,CAAC,EAC3F,sBAAU,IAAM,CACVC,EAAM,UAAYC,IACpBD,EAAM,QAAUC,EAEpB,EAAG,CAACA,CAAI,CAAC,EACFA,CACT,CCTO,SAASC,EAAyBC,EAAU,CACjD,IAAMC,KAAQ,UAAOD,CAAK,EAC1B,sBAAU,IAAM,IACT,gBAAaC,EAAM,QAASD,CAAK,IACpCC,EAAM,QAAUD,EAEpB,EAAG,C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C,CACF,EAAInB,EAAwBK,CAAY,EACxCD,EAAWN,EAAO,UAAUO,CAAY,EAAG,CACzC,iBAAAY,EACA,6BAAAC,EACA,sBAAAC,CACF,CAAC,EACAxB,EAAY,MAAMkB,EAAWR,CAAY,CAAC,eAAe,EAAIY,CAChE,CACF,CACF,CACF,CACF,GFvMFG,EAAAC,EAAc,kCALd,gBYAA,IAAAC,EAAkF,4BAGlF,IAAAC,GAAuB,qBA8BhB,SAASC,GAAYC,EAKzB,CACD,IAAMC,EAAUD,EAAM,SAAW,oBAEjC,MADwB,cAAWC,CAAO,EAExC,MAAM,IAAI,SAA8C,EAAAC,wBAAwB,EAAE,CAAkH,EAEtM,GAAM,CAACC,CAAK,EAAU,YAAS,OAAM,kBAAe,CAClD,QAAS,CACP,CAACH,EAAM,IAAI,WAAW,EAAGA,EAAM,IAAI,OACrC,EACA,WAAYI,GAAOA,EAAI,EAAE,OAAOJ,EAAM,IAAI,UAAU,CACtD,CAAC,CAAC,EAEF,sBAAU,IAAgCA,EAAM,iBAAmB,GAAQ,UAAY,kBAAeG,EAAM,SAAUH,EAAM,cAAc,EAAG,CAACA,EAAM,eAAgBG,EAAM,QAAQ,CAAC,EAC5K,iBAAC,YAAS,MAAOA,EAAO,QAASF,GACnCD,EAAM,QACT,CACJ,CZhDA,IAAMK,MAA2B,qBAAe,cAAW,EAAGC,GAAiB,CAAC","names":["react_exports","__export","ApiProvider","UNINITIALIZED_VALUE","createApi","reactHooksModule","reactHooksModuleName","__toCommonJS","import_query","import_toolkit","import_react_redux","import_reselect","capitalize","str","ENDPOINT_QUERY","ENDPOINT_MUTATION","ENDPOINT_INFINITEQUERY","isQueryDefinition","isMutationDefinition","isInfiniteQueryDefinition","safeAssign","target","args","import_toolkit","import_react","import_react_redux","UNINITIALIZED_VALUE","useStableQueryArgs","queryArgs","cache","copy","useShallowStableValue","value","cache","canUseDOM","isDOM","isRunningInReactNative","isReactNative","getUseIsomorphicLayoutEffect","useIsomorphicLayoutEffect","noPendingQueryStateSelector","selected","pick","obj","keys","ret","key","COMMON_HOOK_DEBUG_FIELDS","buildHooks","api","batch","useDispatch","useSelector","useStore","unstable__sideEffectsInRender","createSelector","serializeQueryArgs","context","usePossiblyImmediateEffect","cb","unsubscribePromiseRef","ref","endpointDefinitions","buildQueryHooks","buildInfiniteQueryHooks","buildMutationHook","usePrefetch","queryStatePreSelector","currentState","lastResult","queryArgs","endpointName","endpointDefinition","data","hasData","isFetching","isLoading","isSuccess","infiniteQueryStatePreSelector","defaultOptions","dispatch","stableDefaultOptions","useShallowStableValue","arg","options","useQuerySubscriptionCommonImpl","refetchOnReconnect","refetchOnFocus","refetchOnMountOrArgChange","skip","pollingInterval","skipPollingIfUnfocused","rest","initiate","subscriptionSelectorsRef","returnedValue","stableArg","useStableQueryArgs","stableSubscriptionOptions","initialPageParam","stableInitialPageParam","refetchCachedPages","stableRefetchCachedPages","promiseRef","queryCacheKey","requestId","currentRenderHasSubscription","subscriptionRemoved","lastPromise","lastSubscriptionOptions","promise","isInfiniteQueryDefinition","buildUseQueryState","preSelector","selectFromResult","select","lastValue","selectDefaultResult","_","querySelector","state","store","newLastValue","usePromiseRefUnsubscribeOnUnmount","refetchOrErrorIfUnmounted","_formatProdErrorMessage2","useQuerySubscription","useLazyQuerySubscription","setArg","UNINITIALIZED_VALUE","subscriptionOptionsRef","trigger","preferCacheValue","reset","useQueryState","queryStateResults","info","querySubscriptionResults","debugValue","useInfiniteQuerySubscription","hookRefetchCachedPages","stableHookRefetchCachedPages","direction","refetch","_formatProdErrorMessage3","mergedOptions","useInfiniteQueryState","fetchNextPage","fetchPreviousPage","name","fixedCacheKey","setPromise","triggerMutation","mutationSelector","originalArgs","finalState","reactHooksModuleName","reactHooksModule","batch","rrBatch","hooks","rrUseDispatch","rrUseSelector","rrUseStore","createSelector","_createSelector","unstable__sideEffectsInRender","rest","api","serializeQueryArgs","context","anyApi","buildQueryHooks","buildInfiniteQueryHooks","buildMutationHook","usePrefetch","buildHooks","safeAssign","endpointName","definition","isQueryDefinition","useQuery","useLazyQuery","useLazyQuerySubscription","useQueryState","useQuerySubscription","capitalize","isMutationDefinition","useMutation","isInfiniteQueryDefinition","useInfiniteQuery","useInfiniteQuerySubscription","useInfiniteQueryState","__reExport","react_exports","import_toolkit","React","ApiProvider","props","context","_formatProdErrorMessage","store","gDM","createApi","reactHooksModule"]}
Index: node_modules/@reduxjs/toolkit/dist/query/react/index.d.mts
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/react/index.d.mts	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/react/index.d.mts	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,980 @@
+import * as _reduxjs_toolkit_query from '@reduxjs/toolkit/query';
+import { QueryDefinition, TSHelpersId, TSHelpersOverride, QuerySubState, ResultTypeFrom, QueryStatus, QueryArgFrom, SkipToken, SubscriptionOptions, TSHelpersNoInfer, QueryActionCreatorResult, MutationDefinition, MutationResultSelectorResult, MutationActionCreatorResult, InfiniteQueryDefinition, InfiniteQuerySubState, PageParamFrom, InfiniteQueryArgFrom, InfiniteQueryActionCreatorResult, BaseQueryFn, EndpointDefinitions, DefinitionType, QueryKeys, PrefetchOptions, Module, Api, setupListeners } from '@reduxjs/toolkit/query';
+export * from '@reduxjs/toolkit/query';
+import * as react_redux from 'react-redux';
+import { ReactReduxContextValue } from 'react-redux';
+import { CreateSelectorFunction } from 'reselect';
+import * as React from 'react';
+import { Context } from 'react';
+
+type InfiniteData<DataType, PageParam> = {
+    pages: Array<DataType>;
+    pageParams: Array<PageParam>;
+};
+type InfiniteQueryDirection = 'forward' | 'backward';
+
+export declare const UNINITIALIZED_VALUE: unique symbol;
+type UninitializedValue = typeof UNINITIALIZED_VALUE;
+
+type QueryHooks<Definition extends QueryDefinition<any, any, any, any, any>> = {
+    useQuery: UseQuery<Definition>;
+    useLazyQuery: UseLazyQuery<Definition>;
+    useQuerySubscription: UseQuerySubscription<Definition>;
+    useLazyQuerySubscription: UseLazyQuerySubscription<Definition>;
+    useQueryState: UseQueryState<Definition>;
+};
+type InfiniteQueryHooks<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = {
+    useInfiniteQuery: UseInfiniteQuery<Definition>;
+    useInfiniteQuerySubscription: UseInfiniteQuerySubscription<Definition>;
+    useInfiniteQueryState: UseInfiniteQueryState<Definition>;
+};
+type MutationHooks<Definition extends MutationDefinition<any, any, any, any, any>> = {
+    useMutation: UseMutation<Definition>;
+};
+/**
+ * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.
+ *
+ * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.
+ *
+ * This hook combines the functionality of both [`useQueryState`](#usequerystate) and [`useQuerySubscription`](#usequerysubscription) together, and is intended to be used in the majority of situations.
+ *
+ * #### Features
+ *
+ * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default
+ * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
+ * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met
+ * - Returns the latest request status and cached data from the Redux store
+ * - Re-renders as the request status changes and data becomes available
+ */
+type UseQuery<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(arg: QueryArgFrom<D> | SkipToken, options?: UseQuerySubscriptionOptions & UseQueryStateOptions<D, R>) => UseQueryHookResult<D, R>;
+type TypedUseQuery<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuery<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+type UseQueryHookResult<D extends QueryDefinition<any, any, any, any>, R = UseQueryStateDefaultResult<D>> = UseQueryStateResult<D, R> & UseQuerySubscriptionResult<D>;
+/**
+ * Helper type to manually type the result
+ * of the `useQuery` hook in userland code.
+ */
+type TypedUseQueryHookResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = TypedUseQueryStateResult<ResultType, QueryArg, BaseQuery, R> & TypedUseQuerySubscriptionResult<ResultType, QueryArg, BaseQuery>;
+type UseQuerySubscriptionOptions = SubscriptionOptions & {
+    /**
+     * Prevents a query from automatically running.
+     *
+     * @remarks
+     * When `skip` is true (or `skipToken` is passed in as `arg`):
+     *
+     * - **If the query has cached data:**
+     *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed
+     *   * The query will have a status of `uninitialized`
+     *   * If `skip: false` is set after the initial load, the cached result will be used
+     * - **If the query does not have cached data:**
+     *   * The query will have a status of `uninitialized`
+     *   * The query will not exist in the state when viewed with the dev tools
+     *   * The query will not automatically fetch on mount
+     *   * The query will not automatically run when additional components with the same query are added that do run
+     *
+     * @example
+     * ```tsx
+     * // codeblock-meta no-transpile title="Skip example"
+     * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {
+     *   const { data, error, status } = useGetPokemonByNameQuery(name, {
+     *     skip,
+     *   });
+     *
+     *   return (
+     *     <div>
+     *       {name} - {status}
+     *     </div>
+     *   );
+     * };
+     * ```
+     */
+    skip?: boolean;
+    /**
+     * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.
+     * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.
+     * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.
+     * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.
+     *
+     * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.
+     */
+    refetchOnMountOrArgChange?: boolean | number;
+};
+/**
+ * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data.
+ *
+ * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.
+ *
+ * Note that this hook does not return a request status or cached data. For that use-case, see [`useQuery`](#usequery) or [`useQueryState`](#usequerystate).
+ *
+ * #### Features
+ *
+ * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default
+ * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
+ * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met
+ */
+type UseQuerySubscription<D extends QueryDefinition<any, any, any, any>> = (arg: QueryArgFrom<D> | SkipToken, options?: UseQuerySubscriptionOptions) => UseQuerySubscriptionResult<D>;
+type TypedUseQuerySubscription<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuerySubscription<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+type UseQuerySubscriptionResult<D extends QueryDefinition<any, any, any, any>> = Pick<QueryActionCreatorResult<D>, 'refetch'>;
+/**
+ * Helper type to manually type the result
+ * of the `useQuerySubscription` hook in userland code.
+ */
+type TypedUseQuerySubscriptionResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuerySubscriptionResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+type UseLazyQueryLastPromiseInfo<D extends QueryDefinition<any, any, any, any>> = {
+    lastArg: QueryArgFrom<D>;
+};
+/**
+ * A React hook similar to [`useQuery`](#usequery), but with manual control over when the data fetching occurs.
+ *
+ * This hook includes the functionality of [`useLazyQuerySubscription`](#uselazyquerysubscription).
+ *
+ * #### Features
+ *
+ * - Manual control over firing a request to retrieve data
+ * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
+ * - Returns the latest request status and cached data from the Redux store
+ * - Re-renders as the request status changes and data becomes available
+ * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once
+ *
+ * #### Note
+ *
+ * When the trigger function returned from a LazyQuery is called, it always initiates a new request to the server even if there is cached data. Set `preferCacheValue`(the second argument to the function) as `true` if you want it to immediately return a cached value if one exists.
+ */
+type UseLazyQuery<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(options?: SubscriptionOptions & Omit<UseQueryStateOptions<D, R>, 'skip'>) => [
+    LazyQueryTrigger<D>,
+    UseLazyQueryStateResult<D, R>,
+    UseLazyQueryLastPromiseInfo<D>
+];
+type TypedUseLazyQuery<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseLazyQuery<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+type UseLazyQueryStateResult<D extends QueryDefinition<any, any, any, any>, R = UseQueryStateDefaultResult<D>> = UseQueryStateResult<D, R> & {
+    /**
+     * Resets the hook state to its initial `uninitialized` state.
+     * This will also remove the last result from the cache.
+     */
+    reset: () => void;
+};
+/**
+ * Helper type to manually type the result
+ * of the `useLazyQuery` hook in userland code.
+ */
+type TypedUseLazyQueryStateResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseLazyQueryStateResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>, R>;
+type LazyQueryTrigger<D extends QueryDefinition<any, any, any, any>> = {
+    /**
+     * Triggers a lazy query.
+     *
+     * By default, this will start a new request even if there is already a value in the cache.
+     * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.
+     *
+     * @remarks
+     * If you need to access the error or success payload immediately after a lazy query, you can chain .unwrap().
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Using .unwrap with async await"
+     * try {
+     *   const payload = await getUserById(1).unwrap();
+     *   console.log('fulfilled', payload)
+     * } catch (error) {
+     *   console.error('rejected', error);
+     * }
+     * ```
+     */
+    (arg: QueryArgFrom<D>, preferCacheValue?: boolean): QueryActionCreatorResult<D>;
+};
+type TypedLazyQueryTrigger<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = LazyQueryTrigger<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+/**
+ * A React hook similar to [`useQuerySubscription`](#usequerysubscription), but with manual control over when the data fetching occurs.
+ *
+ * Note that this hook does not return a request status or cached data. For that use-case, see [`useLazyQuery`](#uselazyquery).
+ *
+ * #### Features
+ *
+ * - Manual control over firing a request to retrieve data
+ * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
+ * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once
+ */
+type UseLazyQuerySubscription<D extends QueryDefinition<any, any, any, any>> = (options?: SubscriptionOptions) => readonly [
+    LazyQueryTrigger<D>,
+    QueryArgFrom<D> | UninitializedValue,
+    {
+        reset: () => void;
+    }
+];
+type TypedUseLazyQuerySubscription<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseLazyQuerySubscription<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+/**
+ * @internal
+ */
+type QueryStateSelector<R extends Record<string, any>, D extends QueryDefinition<any, any, any, any>> = (state: UseQueryStateDefaultResult<D>) => R;
+/**
+ * Provides a way to define a strongly-typed version of
+ * {@linkcode QueryStateSelector} for use with a specific query.
+ * This is useful for scenarios where you want to create a "pre-typed"
+ * {@linkcode UseQueryStateOptions.selectFromResult | selectFromResult}
+ * function.
+ *
+ * @example
+ * <caption>#### __Create a strongly-typed `selectFromResult` selector function__</caption>
+ *
+ * ```tsx
+ * import type { TypedQueryStateSelector } from '@reduxjs/toolkit/query/react'
+ * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+ *
+ * type Post = {
+ *   id: number
+ *   title: string
+ * }
+ *
+ * type PostsApiResponse = {
+ *   posts: Post[]
+ *   total: number
+ *   skip: number
+ *   limit: number
+ * }
+ *
+ * type QueryArgument = number | undefined
+ *
+ * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>
+ *
+ * type SelectedResult = Pick<PostsApiResponse, 'posts'>
+ *
+ * const postsApiSlice = createApi({
+ *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com/posts' }),
+ *   reducerPath: 'postsApi',
+ *   tagTypes: ['Posts'],
+ *   endpoints: (build) => ({
+ *     getPosts: build.query<PostsApiResponse, QueryArgument>({
+ *       query: (limit = 5) => `?limit=${limit}&select=title`,
+ *     }),
+ *   }),
+ * })
+ *
+ * const { useGetPostsQuery } = postsApiSlice
+ *
+ * function PostById({ id }: { id: number }) {
+ *   const { post } = useGetPostsQuery(undefined, {
+ *     selectFromResult: (state) => ({
+ *       post: state.data?.posts.find((post) => post.id === id),
+ *     }),
+ *   })
+ *
+ *   return <li>{post?.title}</li>
+ * }
+ *
+ * const EMPTY_ARRAY: Post[] = []
+ *
+ * const typedSelectFromResult: TypedQueryStateSelector<
+ *   PostsApiResponse,
+ *   QueryArgument,
+ *   BaseQueryFunction,
+ *   SelectedResult
+ * > = (state) => ({ posts: state.data?.posts ?? EMPTY_ARRAY })
+ *
+ * function PostsList() {
+ *   const { posts } = useGetPostsQuery(undefined, {
+ *     selectFromResult: typedSelectFromResult,
+ *   })
+ *
+ *   return (
+ *     <div>
+ *       <ul>
+ *         {posts.map((post) => (
+ *           <PostById key={post.id} id={post.id} />
+ *         ))}
+ *       </ul>
+ *     </div>
+ *   )
+ * }
+ * ```
+ *
+ * @template ResultType - The type of the result `data` returned by the query.
+ * @template QueryArgumentType - The type of the argument passed into the query.
+ * @template BaseQueryFunctionType - The type of the base query function being used.
+ * @template SelectedResultType - The type of the selected result returned by the __`selectFromResult`__ function.
+ *
+ * @since 2.3.0
+ * @public
+ */
+type TypedQueryStateSelector<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, SelectedResultType extends Record<string, any> = UseQueryStateDefaultResult<QueryDefinition<QueryArgumentType, BaseQueryFunctionType, string, ResultType, string>>> = QueryStateSelector<SelectedResultType, QueryDefinition<QueryArgumentType, BaseQueryFunctionType, string, ResultType, string>>;
+/**
+ * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.
+ *
+ * Note that this hook does not trigger fetching new data. For that use-case, see [`useQuery`](#usequery) or [`useQuerySubscription`](#usequerysubscription).
+ *
+ * #### Features
+ *
+ * - Returns the latest request status and cached data from the Redux store
+ * - Re-renders as the request status changes and data becomes available
+ */
+type UseQueryState<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(arg: QueryArgFrom<D> | SkipToken, options?: UseQueryStateOptions<D, R>) => UseQueryStateResult<D, R>;
+type TypedUseQueryState<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQueryState<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+/**
+ * @internal
+ */
+type UseQueryStateOptions<D extends QueryDefinition<any, any, any, any>, R extends Record<string, any>> = {
+    /**
+     * Prevents a query from automatically running.
+     *
+     * @remarks
+     * When skip is true:
+     *
+     * - **If the query has cached data:**
+     *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed
+     *   * The query will have a status of `uninitialized`
+     *   * If `skip: false` is set after skipping the initial load, the cached result will be used
+     * - **If the query does not have cached data:**
+     *   * The query will have a status of `uninitialized`
+     *   * The query will not exist in the state when viewed with the dev tools
+     *   * The query will not automatically fetch on mount
+     *   * The query will not automatically run when additional components with the same query are added that do run
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Skip example"
+     * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {
+     *   const { data, error, status } = useGetPokemonByNameQuery(name, {
+     *     skip,
+     *   });
+     *
+     *   return (
+     *     <div>
+     *       {name} - {status}
+     *     </div>
+     *   );
+     * };
+     * ```
+     */
+    skip?: boolean;
+    /**
+     * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.
+     * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.
+     * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Using selectFromResult to extract a single result"
+     * function PostsList() {
+     *   const { data: posts } = api.useGetPostsQuery();
+     *
+     *   return (
+     *     <ul>
+     *       {posts?.data?.map((post) => (
+     *         <PostById key={post.id} id={post.id} />
+     *       ))}
+     *     </ul>
+     *   );
+     * }
+     *
+     * function PostById({ id }: { id: number }) {
+     *   // Will select the post with the given id, and will only rerender if the given posts data changes
+     *   const { post } = api.useGetPostsQuery(undefined, {
+     *     selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),
+     *   });
+     *
+     *   return <li>{post?.name}</li>;
+     * }
+     * ```
+     */
+    selectFromResult?: QueryStateSelector<R, D>;
+};
+/**
+ * Provides a way to define a "pre-typed" version of
+ * {@linkcode UseQueryStateOptions} with specific options for a given query.
+ * This is particularly useful for setting default query behaviors such as
+ * refetching strategies, which can be overridden as needed.
+ *
+ * @example
+ * <caption>#### __Create a `useQuery` hook with default options__</caption>
+ *
+ * ```ts
+ * import type {
+ *   SubscriptionOptions,
+ *   TypedUseQueryStateOptions,
+ * } from '@reduxjs/toolkit/query/react'
+ * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+ *
+ * type Post = {
+ *   id: number
+ *   name: string
+ * }
+ *
+ * const api = createApi({
+ *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+ *   tagTypes: ['Post'],
+ *   endpoints: (build) => ({
+ *     getPosts: build.query<Post[], void>({
+ *       query: () => 'posts',
+ *     }),
+ *   }),
+ * })
+ *
+ * const { useGetPostsQuery } = api
+ *
+ * export const useGetPostsQueryWithDefaults = <
+ *   SelectedResult extends Record<string, any>,
+ * >(
+ *   overrideOptions: TypedUseQueryStateOptions<
+ *     Post[],
+ *     void,
+ *     ReturnType<typeof fetchBaseQuery>,
+ *     SelectedResult
+ *   > &
+ *     SubscriptionOptions,
+ * ) =>
+ *   useGetPostsQuery(undefined, {
+ *     // Insert default options here
+ *
+ *     refetchOnMountOrArgChange: true,
+ *     refetchOnFocus: true,
+ *     ...overrideOptions,
+ *   })
+ * ```
+ *
+ * @template ResultType - The type of the result `data` returned by the query.
+ * @template QueryArg - The type of the argument passed into the query.
+ * @template BaseQuery - The type of the base query function being used.
+ * @template SelectedResult - The type of the selected result returned by the __`selectFromResult`__ function.
+ *
+ * @since 2.2.8
+ * @public
+ */
+type TypedUseQueryStateOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseQueryStateOptions<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>, SelectedResult>;
+type UseQueryStateResult<_ extends QueryDefinition<any, any, any, any>, R> = TSHelpersNoInfer<R>;
+/**
+ * Helper type to manually type the result
+ * of the `useQueryState` hook in userland code.
+ */
+type TypedUseQueryStateResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = TSHelpersNoInfer<R>;
+type UseQueryStateBaseResult<D extends QueryDefinition<any, any, any, any>> = QuerySubState<D> & {
+    /**
+     * Where `data` tries to hold data as much as possible, also re-using
+     * data from the last arguments passed into the hook, this property
+     * will always contain the received data from the query, for the current query arguments.
+     */
+    currentData?: ResultTypeFrom<D>;
+    /**
+     * Query has not started yet.
+     */
+    isUninitialized: false;
+    /**
+     * Query is currently loading for the first time. No data yet.
+     */
+    isLoading: false;
+    /**
+     * Query is currently fetching, but might have data from an earlier request.
+     */
+    isFetching: false;
+    /**
+     * Query has data from a successful load.
+     */
+    isSuccess: false;
+    /**
+     * Query is currently in "error" state.
+     */
+    isError: false;
+};
+type UseQueryStateUninitialized<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<Extract<UseQueryStateBaseResult<D>, {
+    status: QueryStatus.uninitialized;
+}>, {
+    isUninitialized: true;
+}>;
+type UseQueryStateLoading<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {
+    isLoading: true;
+    isFetching: boolean;
+    data: undefined;
+}>;
+type UseQueryStateSuccessFetching<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {
+    isSuccess: true;
+    isFetching: true;
+    error: undefined;
+} & {
+    data: ResultTypeFrom<D>;
+} & Required<Pick<UseQueryStateBaseResult<D>, 'fulfilledTimeStamp'>>>;
+type UseQueryStateSuccessNotFetching<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {
+    isSuccess: true;
+    isFetching: false;
+    error: undefined;
+} & {
+    data: ResultTypeFrom<D>;
+    currentData: ResultTypeFrom<D>;
+} & Required<Pick<UseQueryStateBaseResult<D>, 'fulfilledTimeStamp'>>>;
+type UseQueryStateError<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {
+    isError: true;
+} & Required<Pick<UseQueryStateBaseResult<D>, 'error'>>>;
+type UseQueryStateDefaultResult<D extends QueryDefinition<any, any, any, any>> = TSHelpersId<UseQueryStateUninitialized<D> | UseQueryStateLoading<D> | UseQueryStateSuccessFetching<D> | UseQueryStateSuccessNotFetching<D> | UseQueryStateError<D>> & {
+    /**
+     * @deprecated Included for completeness, but discouraged.
+     * Please use the `isLoading`, `isFetching`, `isSuccess`, `isError`
+     * and `isUninitialized` flags instead
+     */
+    status: QueryStatus;
+};
+type LazyInfiniteQueryTrigger<D extends InfiniteQueryDefinition<any, any, any, any, any>> = {
+    /**
+     * Triggers a lazy query.
+     *
+     * By default, this will start a new request even if there is already a value in the cache.
+     * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.
+     *
+     * @remarks
+     * If you need to access the error or success payload immediately after a lazy query, you can chain .unwrap().
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Using .unwrap with async await"
+     * try {
+     *   const payload = await getUserById(1).unwrap();
+     *   console.log('fulfilled', payload)
+     * } catch (error) {
+     *   console.error('rejected', error);
+     * }
+     * ```
+     */
+    (arg: QueryArgFrom<D>, direction: InfiniteQueryDirection): InfiniteQueryActionCreatorResult<D>;
+};
+type TypedLazyInfiniteQueryTrigger<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = LazyInfiniteQueryTrigger<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;
+type UseInfiniteQuerySubscriptionOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>> = SubscriptionOptions & {
+    /**
+     * Prevents a query from automatically running.
+     *
+     * @remarks
+     * When `skip` is true (or `skipToken` is passed in as `arg`):
+     *
+     * - **If the query has cached data:**
+     *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed
+     *   * The query will have a status of `uninitialized`
+     *   * If `skip: false` is set after the initial load, the cached result will be used
+     * - **If the query does not have cached data:**
+     *   * The query will have a status of `uninitialized`
+     *   * The query will not exist in the state when viewed with the dev tools
+     *   * The query will not automatically fetch on mount
+     *   * The query will not automatically run when additional components with the same query are added that do run
+     *
+     * @example
+     * ```tsx
+     * // codeblock-meta no-transpile title="Skip example"
+     * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {
+     *   const { data, error, status } = useGetPokemonByNameQuery(name, {
+     *     skip,
+     *   });
+     *
+     *   return (
+     *     <div>
+     *       {name} - {status}
+     *     </div>
+     *   );
+     * };
+     * ```
+     */
+    skip?: boolean;
+    /**
+     * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.
+     * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.
+     * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.
+     * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.
+     *
+     * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.
+     */
+    refetchOnMountOrArgChange?: boolean | number;
+    initialPageParam?: PageParamFrom<D>;
+    /**
+     * Defaults to `true`. When this is `true` and an infinite query endpoint is refetched
+     * (due to tag invalidation, polling, arg change configuration, or manual refetching),
+     * RTK Query will try to sequentially refetch all pages currently in the cache.
+     * When `false` only the first page will be refetched.
+     *
+     * This option applies to all automatic refetches for this subscription (polling, tag invalidation, etc.).
+     * It can be overridden on a per-call basis using the `refetch()` method.
+     */
+    refetchCachedPages?: boolean;
+};
+type TypedUseInfiniteQuerySubscription<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuerySubscription<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;
+type UseInfiniteQuerySubscriptionResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = {
+    refetch: (options?: Pick<UseInfiniteQuerySubscriptionOptions<D>, 'refetchCachedPages'>) => InfiniteQueryActionCreatorResult<D>;
+    trigger: LazyInfiniteQueryTrigger<D>;
+    fetchNextPage: () => InfiniteQueryActionCreatorResult<D>;
+    fetchPreviousPage: () => InfiniteQueryActionCreatorResult<D>;
+};
+/**
+ * Helper type to manually type the result
+ * of the `useQuerySubscription` hook in userland code.
+ */
+type TypedUseInfiniteQuerySubscriptionResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuerySubscriptionResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;
+type InfiniteQueryStateSelector<R extends Record<string, any>, D extends InfiniteQueryDefinition<any, any, any, any, any>> = (state: UseInfiniteQueryStateDefaultResult<D>) => R;
+type TypedInfiniteQueryStateSelector<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = InfiniteQueryStateSelector<SelectedResult, InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;
+/**
+ * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.  Additionally, it will cache multiple "pages" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.
+ *
+ * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.
+ *
+ *  The `data` field will be a `{pages: Data[], pageParams: PageParam[]}` structure containing all fetched page responses and the corresponding page param values for each page. You may use this to render individual pages, combine all pages into a single infinite list, or other display logic as needed.
+ *
+ * This hook combines the functionality of both [`useInfiniteQueryState`](#useinfinitequerystate) and [`useInfiniteQuerySubscription`](#useinfinitequerysubscription) together, and is intended to be used in the majority of situations.
+ *
+ * As with normal query hooks, `skipToken` is a valid argument that will skip the query from executing.
+ *
+ * By default, the initial request will use the `initialPageParam` value that was defined on the infinite query endpoint. If you want to start from a different value, you can pass `initialPageParam` as part of the hook options to override that initial request value.
+ *
+ * Use the returned `fetchNextPage` and `fetchPreviousPage` methods on the hook result object to trigger fetches forwards and backwards. These will always calculate the next or previous page param based on the current cached pages and the provided `getNext/PreviousPageParam` callbacks defined in the endpoint.
+ *
+ *
+ * #### Features
+ *
+ * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default
+ * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
+ * - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards
+ * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met
+ * - Returns the latest request status and cached data from the Redux store
+ * - Re-renders as the request status changes and data becomes available
+ */
+type UseInfiniteQuery<D extends InfiniteQueryDefinition<any, any, any, any, any>> = <R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<D>>(arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQuerySubscriptionOptions<D> & UseInfiniteQueryStateOptions<D, R>) => UseInfiniteQueryHookResult<D, R> & Pick<UseInfiniteQuerySubscriptionResult<D>, 'fetchNextPage' | 'fetchPreviousPage'>;
+type TypedUseInfiniteQuery<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuery<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;
+/**
+ * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.
+ *
+ * Note that this hook does not trigger fetching new data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQuerySubscription`](#useinfinitequerysubscription).
+ *
+ * #### Features
+ *
+ * - Returns the latest request status and cached data from the Redux store
+ * - Re-renders as the request status changes and data becomes available
+ */
+type UseInfiniteQueryState<D extends InfiniteQueryDefinition<any, any, any, any, any>> = <R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<D>>(arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQueryStateOptions<D, R>) => UseInfiniteQueryStateResult<D, R>;
+type TypedUseInfiniteQueryState<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQueryState<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;
+/**
+ * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data. Additionally, it will cache multiple "pages" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.
+ *
+ * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.
+ *
+ * Note that this hook does not return a request status or cached data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQueryState`](#useinfinitequerystate).
+ *
+ * #### Features
+ *
+ * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default
+ * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
+ * - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards
+ * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met
+ */
+type UseInfiniteQuerySubscription<D extends InfiniteQueryDefinition<any, any, any, any, any>> = (arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQuerySubscriptionOptions<D>) => UseInfiniteQuerySubscriptionResult<D>;
+type UseInfiniteQueryHookResult<D extends InfiniteQueryDefinition<any, any, any, any, any>, R = UseInfiniteQueryStateDefaultResult<D>> = UseInfiniteQueryStateResult<D, R> & Pick<UseInfiniteQuerySubscriptionResult<D>, 'refetch' | 'fetchNextPage' | 'fetchPreviousPage'>;
+type TypedUseInfiniteQueryHookResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryHookResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, R>;
+type UseInfiniteQueryStateOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>, R extends Record<string, any>> = {
+    /**
+     * Prevents a query from automatically running.
+     *
+     * @remarks
+     * When skip is true:
+     *
+     * - **If the query has cached data:**
+     *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed
+     *   * The query will have a status of `uninitialized`
+     *   * If `skip: false` is set after skipping the initial load, the cached result will be used
+     * - **If the query does not have cached data:**
+     *   * The query will have a status of `uninitialized`
+     *   * The query will not exist in the state when viewed with the dev tools
+     *   * The query will not automatically fetch on mount
+     *   * The query will not automatically run when additional components with the same query are added that do run
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Skip example"
+     * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {
+     *   const { data, error, status } = useGetPokemonByNameQuery(name, {
+     *     skip,
+     *   });
+     *
+     *   return (
+     *     <div>
+     *       {name} - {status}
+     *     </div>
+     *   );
+     * };
+     * ```
+     */
+    skip?: boolean;
+    /**
+     * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.
+     * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.
+     * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.
+     * Note that this should always return an object (not a primitive), as RTKQ adds fields to the return value.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Using selectFromResult to extract a single result"
+     * function PostsList() {
+     *   const { data: posts } = api.useGetPostsQuery();
+     *
+     *   return (
+     *     <ul>
+     *       {posts?.data?.map((post) => (
+     *         <PostById key={post.id} id={post.id} />
+     *       ))}
+     *     </ul>
+     *   );
+     * }
+     *
+     * function PostById({ id }: { id: number }) {
+     *   // Will select the post with the given id, and will only rerender if the given posts data changes
+     *   const { post } = api.useGetPostsQuery(undefined, {
+     *     selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),
+     *   });
+     *
+     *   return <li>{post?.name}</li>;
+     * }
+     * ```
+     */
+    selectFromResult?: InfiniteQueryStateSelector<R, D>;
+};
+type TypedUseInfiniteQueryStateOptions<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryStateOptions<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, SelectedResult>;
+type UseInfiniteQueryStateResult<D extends InfiniteQueryDefinition<any, any, any, any, any>, R = UseInfiniteQueryStateDefaultResult<D>> = TSHelpersNoInfer<R>;
+type TypedUseInfiniteQueryStateResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, R = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryStateResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, R>;
+type UseInfiniteQueryStateBaseResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = InfiniteQuerySubState<D> & {
+    /**
+     * Where `data` tries to hold data as much as possible, also re-using
+     * data from the last arguments passed into the hook, this property
+     * will always contain the received data from the query, for the current query arguments.
+     */
+    currentData?: InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>;
+    /**
+     * Query has not started yet.
+     */
+    isUninitialized: false;
+    /**
+     * Query is currently loading for the first time. No data yet.
+     */
+    isLoading: false;
+    /**
+     * Query is currently fetching, but might have data from an earlier request.
+     */
+    isFetching: false;
+    /**
+     * Query has data from a successful load.
+     */
+    isSuccess: false;
+    /**
+     * Query is currently in "error" state.
+     */
+    isError: false;
+    hasNextPage: boolean;
+    hasPreviousPage: boolean;
+    isFetchingNextPage: boolean;
+    isFetchingPreviousPage: boolean;
+};
+type UseInfiniteQueryStateDefaultResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = TSHelpersId<TSHelpersOverride<Extract<UseInfiniteQueryStateBaseResult<D>, {
+    status: QueryStatus.uninitialized;
+}>, {
+    isUninitialized: true;
+}> | TSHelpersOverride<UseInfiniteQueryStateBaseResult<D>, {
+    isLoading: true;
+    isFetching: boolean;
+    data: undefined;
+} | ({
+    isSuccess: true;
+    isFetching: true;
+    error: undefined;
+} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp'>>) | ({
+    isSuccess: true;
+    isFetching: false;
+    error: undefined;
+} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp' | 'currentData'>>) | ({
+    isError: true;
+} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'error'>>)>> & {
+    /**
+     * @deprecated Included for completeness, but discouraged.
+     * Please use the `isLoading`, `isFetching`, `isSuccess`, `isError`
+     * and `isUninitialized` flags instead
+     */
+    status: QueryStatus;
+};
+type MutationStateSelector<R extends Record<string, any>, D extends MutationDefinition<any, any, any, any>> = (state: MutationResultSelectorResult<D>) => R;
+type UseMutationStateOptions<D extends MutationDefinition<any, any, any, any>, R extends Record<string, any>> = {
+    selectFromResult?: MutationStateSelector<R, D>;
+    fixedCacheKey?: string;
+};
+type UseMutationStateResult<D extends MutationDefinition<any, any, any, any>, R> = TSHelpersNoInfer<R> & {
+    originalArgs?: QueryArgFrom<D>;
+    /**
+     * Resets the hook state to its initial `uninitialized` state.
+     * This will also remove the last result from the cache.
+     */
+    reset: () => void;
+};
+/**
+ * Helper type to manually type the result
+ * of the `useMutation` hook in userland code.
+ */
+type TypedUseMutationResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = MutationResultSelectorResult<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseMutationStateResult<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>, R>;
+/**
+ * A React hook that lets you trigger an update request for a given endpoint, and subscribes the component to read the request status from the Redux store. The component will re-render as the loading status changes.
+ *
+ * #### Features
+ *
+ * - Manual control over firing a request to alter data on the server or possibly invalidate the cache
+ * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
+ * - Returns the latest request status and cached data from the Redux store
+ * - Re-renders as the request status changes and data becomes available
+ */
+type UseMutation<D extends MutationDefinition<any, any, any, any>> = <R extends Record<string, any> = MutationResultSelectorResult<D>>(options?: UseMutationStateOptions<D, R>) => readonly [MutationTrigger<D>, UseMutationStateResult<D, R>];
+type TypedUseMutation<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseMutation<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+type MutationTrigger<D extends MutationDefinition<any, any, any, any>> = {
+    /**
+     * Triggers the mutation and returns a Promise.
+     * @remarks
+     * If you need to access the error or success payload immediately after a mutation, you can chain .unwrap().
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Using .unwrap with async await"
+     * try {
+     *   const payload = await addPost({ id: 1, name: 'Example' }).unwrap();
+     *   console.log('fulfilled', payload)
+     * } catch (error) {
+     *   console.error('rejected', error);
+     * }
+     * ```
+     */
+    (arg: QueryArgFrom<D>): MutationActionCreatorResult<D>;
+};
+type TypedMutationTrigger<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = MutationTrigger<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+
+type QueryHookNames<Definitions extends EndpointDefinitions> = {
+    [K in keyof Definitions as Definitions[K] extends {
+        type: DefinitionType.query;
+    } ? `use${Capitalize<K & string>}Query` : never]: UseQuery<Extract<Definitions[K], QueryDefinition<any, any, any, any>>>;
+};
+type LazyQueryHookNames<Definitions extends EndpointDefinitions> = {
+    [K in keyof Definitions as Definitions[K] extends {
+        type: DefinitionType.query;
+    } ? `useLazy${Capitalize<K & string>}Query` : never]: UseLazyQuery<Extract<Definitions[K], QueryDefinition<any, any, any, any>>>;
+};
+type InfiniteQueryHookNames<Definitions extends EndpointDefinitions> = {
+    [K in keyof Definitions as Definitions[K] extends {
+        type: DefinitionType.infinitequery;
+    } ? `use${Capitalize<K & string>}InfiniteQuery` : never]: UseInfiniteQuery<Extract<Definitions[K], InfiniteQueryDefinition<any, any, any, any, any>>>;
+};
+type MutationHookNames<Definitions extends EndpointDefinitions> = {
+    [K in keyof Definitions as Definitions[K] extends {
+        type: DefinitionType.mutation;
+    } ? `use${Capitalize<K & string>}Mutation` : never]: UseMutation<Extract<Definitions[K], MutationDefinition<any, any, any, any>>>;
+};
+type HooksWithUniqueNames<Definitions extends EndpointDefinitions> = QueryHookNames<Definitions> & LazyQueryHookNames<Definitions> & InfiniteQueryHookNames<Definitions> & MutationHookNames<Definitions>;
+
+export declare const reactHooksModuleName: unique symbol;
+type ReactHooksModule = typeof reactHooksModuleName;
+declare module '@reduxjs/toolkit/query' {
+    interface ApiModules<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string> {
+        [reactHooksModuleName]: {
+            /**
+             *  Endpoints based on the input endpoints provided to `createApi`, containing `select`, `hooks` and `action matchers`.
+             */
+            endpoints: {
+                [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? QueryHooks<Definitions[K]> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? MutationHooks<Definitions[K]> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryHooks<Definitions[K]> : never;
+            };
+            /**
+             * A hook that accepts a string endpoint name, and provides a callback that when called, pre-fetches the data for that endpoint.
+             */
+            usePrefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, options?: PrefetchOptions): (arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions) => void;
+        } & HooksWithUniqueNames<Definitions>;
+    }
+}
+type RR = typeof react_redux;
+interface ReactHooksModuleOptions {
+    /**
+     * The hooks from React Redux to be used
+     */
+    hooks?: {
+        /**
+         * The version of the `useDispatch` hook to be used
+         */
+        useDispatch: RR['useDispatch'];
+        /**
+         * The version of the `useSelector` hook to be used
+         */
+        useSelector: RR['useSelector'];
+        /**
+         * The version of the `useStore` hook to be used
+         */
+        useStore: RR['useStore'];
+    };
+    /**
+     * The version of the `batchedUpdates` function to be used
+     */
+    batch?: RR['batch'];
+    /**
+     * Enables performing asynchronous tasks immediately within a render.
+     *
+     * @example
+     *
+     * ```ts
+     * import {
+     *   buildCreateApi,
+     *   coreModule,
+     *   reactHooksModule
+     * } from '@reduxjs/toolkit/query/react'
+     *
+     * const createApi = buildCreateApi(
+     *   coreModule(),
+     *   reactHooksModule({ unstable__sideEffectsInRender: true })
+     * )
+     * ```
+     */
+    unstable__sideEffectsInRender?: boolean;
+    /**
+     * A selector creator (usually from `reselect`, or matching the same signature)
+     */
+    createSelector?: CreateSelectorFunction<any, any, any>;
+}
+/**
+ * Creates a module that generates react hooks from endpoints, for use with `buildCreateApi`.
+ *
+ *  @example
+ * ```ts
+ * const MyContext = React.createContext<ReactReduxContextValue | null>(null);
+ * const customCreateApi = buildCreateApi(
+ *   coreModule(),
+ *   reactHooksModule({
+ *     hooks: {
+ *       useDispatch: createDispatchHook(MyContext),
+ *       useSelector: createSelectorHook(MyContext),
+ *       useStore: createStoreHook(MyContext)
+ *     }
+ *   })
+ * );
+ * ```
+ *
+ * @returns A module for use with `buildCreateApi`
+ */
+declare const reactHooksModule: ({ batch, hooks, createSelector, unstable__sideEffectsInRender, ...rest }?: ReactHooksModuleOptions) => Module<ReactHooksModule>;
+
+/**
+ * Can be used as a `Provider` if you **do not already have a Redux store**.
+ *
+ * @example
+ * ```tsx
+ * // codeblock-meta no-transpile title="Basic usage - wrap your App with ApiProvider"
+ * import * as React from 'react';
+ * import { ApiProvider } from '@reduxjs/toolkit/query/react';
+ * import { Pokemon } from './features/Pokemon';
+ *
+ * function App() {
+ *   return (
+ *     <ApiProvider api={api}>
+ *       <Pokemon />
+ *     </ApiProvider>
+ *   );
+ * }
+ * ```
+ *
+ * @remarks
+ * Using this together with an existing redux store, both will
+ * conflict with each other - please use the traditional redux setup
+ * in that case.
+ */
+declare function ApiProvider(props: {
+    children: any;
+    api: Api<any, {}, any, any>;
+    setupListeners?: Parameters<typeof setupListeners>[1] | false;
+    context?: Context<ReactReduxContextValue | null>;
+}): React.JSX.Element;
+
+declare const createApi: _reduxjs_toolkit_query.CreateApi<typeof _reduxjs_toolkit_query.coreModuleName | typeof reactHooksModuleName>;
+
+export { ApiProvider, type TypedInfiniteQueryStateSelector, type TypedLazyInfiniteQueryTrigger, type TypedLazyQueryTrigger, type TypedMutationTrigger, type TypedQueryStateSelector, type TypedUseInfiniteQuery, type TypedUseInfiniteQueryHookResult, type TypedUseInfiniteQueryState, type TypedUseInfiniteQueryStateOptions, type TypedUseInfiniteQueryStateResult, type TypedUseInfiniteQuerySubscription, type TypedUseInfiniteQuerySubscriptionResult, type TypedUseLazyQuery, type TypedUseLazyQueryStateResult, type TypedUseLazyQuerySubscription, type TypedUseMutation, type TypedUseMutationResult, type TypedUseQuery, type TypedUseQueryHookResult, type TypedUseQueryState, type TypedUseQueryStateOptions, type TypedUseQueryStateResult, type TypedUseQuerySubscription, type TypedUseQuerySubscriptionResult, createApi, reactHooksModule };
Index: node_modules/@reduxjs/toolkit/dist/query/react/index.d.ts
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/react/index.d.ts	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/react/index.d.ts	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,980 @@
+import * as _reduxjs_toolkit_query from '@reduxjs/toolkit/query';
+import { QueryDefinition, TSHelpersId, TSHelpersOverride, QuerySubState, ResultTypeFrom, QueryStatus, QueryArgFrom, SkipToken, SubscriptionOptions, TSHelpersNoInfer, QueryActionCreatorResult, MutationDefinition, MutationResultSelectorResult, MutationActionCreatorResult, InfiniteQueryDefinition, InfiniteQuerySubState, PageParamFrom, InfiniteQueryArgFrom, InfiniteQueryActionCreatorResult, BaseQueryFn, EndpointDefinitions, DefinitionType, QueryKeys, PrefetchOptions, Module, Api, setupListeners } from '@reduxjs/toolkit/query';
+export * from '@reduxjs/toolkit/query';
+import * as react_redux from 'react-redux';
+import { ReactReduxContextValue } from 'react-redux';
+import { CreateSelectorFunction } from 'reselect';
+import * as React from 'react';
+import { Context } from 'react';
+
+type InfiniteData<DataType, PageParam> = {
+    pages: Array<DataType>;
+    pageParams: Array<PageParam>;
+};
+type InfiniteQueryDirection = 'forward' | 'backward';
+
+export declare const UNINITIALIZED_VALUE: unique symbol;
+type UninitializedValue = typeof UNINITIALIZED_VALUE;
+
+type QueryHooks<Definition extends QueryDefinition<any, any, any, any, any>> = {
+    useQuery: UseQuery<Definition>;
+    useLazyQuery: UseLazyQuery<Definition>;
+    useQuerySubscription: UseQuerySubscription<Definition>;
+    useLazyQuerySubscription: UseLazyQuerySubscription<Definition>;
+    useQueryState: UseQueryState<Definition>;
+};
+type InfiniteQueryHooks<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = {
+    useInfiniteQuery: UseInfiniteQuery<Definition>;
+    useInfiniteQuerySubscription: UseInfiniteQuerySubscription<Definition>;
+    useInfiniteQueryState: UseInfiniteQueryState<Definition>;
+};
+type MutationHooks<Definition extends MutationDefinition<any, any, any, any, any>> = {
+    useMutation: UseMutation<Definition>;
+};
+/**
+ * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.
+ *
+ * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.
+ *
+ * This hook combines the functionality of both [`useQueryState`](#usequerystate) and [`useQuerySubscription`](#usequerysubscription) together, and is intended to be used in the majority of situations.
+ *
+ * #### Features
+ *
+ * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default
+ * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
+ * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met
+ * - Returns the latest request status and cached data from the Redux store
+ * - Re-renders as the request status changes and data becomes available
+ */
+type UseQuery<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(arg: QueryArgFrom<D> | SkipToken, options?: UseQuerySubscriptionOptions & UseQueryStateOptions<D, R>) => UseQueryHookResult<D, R>;
+type TypedUseQuery<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuery<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+type UseQueryHookResult<D extends QueryDefinition<any, any, any, any>, R = UseQueryStateDefaultResult<D>> = UseQueryStateResult<D, R> & UseQuerySubscriptionResult<D>;
+/**
+ * Helper type to manually type the result
+ * of the `useQuery` hook in userland code.
+ */
+type TypedUseQueryHookResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = TypedUseQueryStateResult<ResultType, QueryArg, BaseQuery, R> & TypedUseQuerySubscriptionResult<ResultType, QueryArg, BaseQuery>;
+type UseQuerySubscriptionOptions = SubscriptionOptions & {
+    /**
+     * Prevents a query from automatically running.
+     *
+     * @remarks
+     * When `skip` is true (or `skipToken` is passed in as `arg`):
+     *
+     * - **If the query has cached data:**
+     *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed
+     *   * The query will have a status of `uninitialized`
+     *   * If `skip: false` is set after the initial load, the cached result will be used
+     * - **If the query does not have cached data:**
+     *   * The query will have a status of `uninitialized`
+     *   * The query will not exist in the state when viewed with the dev tools
+     *   * The query will not automatically fetch on mount
+     *   * The query will not automatically run when additional components with the same query are added that do run
+     *
+     * @example
+     * ```tsx
+     * // codeblock-meta no-transpile title="Skip example"
+     * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {
+     *   const { data, error, status } = useGetPokemonByNameQuery(name, {
+     *     skip,
+     *   });
+     *
+     *   return (
+     *     <div>
+     *       {name} - {status}
+     *     </div>
+     *   );
+     * };
+     * ```
+     */
+    skip?: boolean;
+    /**
+     * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.
+     * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.
+     * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.
+     * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.
+     *
+     * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.
+     */
+    refetchOnMountOrArgChange?: boolean | number;
+};
+/**
+ * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data.
+ *
+ * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.
+ *
+ * Note that this hook does not return a request status or cached data. For that use-case, see [`useQuery`](#usequery) or [`useQueryState`](#usequerystate).
+ *
+ * #### Features
+ *
+ * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default
+ * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
+ * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met
+ */
+type UseQuerySubscription<D extends QueryDefinition<any, any, any, any>> = (arg: QueryArgFrom<D> | SkipToken, options?: UseQuerySubscriptionOptions) => UseQuerySubscriptionResult<D>;
+type TypedUseQuerySubscription<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuerySubscription<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+type UseQuerySubscriptionResult<D extends QueryDefinition<any, any, any, any>> = Pick<QueryActionCreatorResult<D>, 'refetch'>;
+/**
+ * Helper type to manually type the result
+ * of the `useQuerySubscription` hook in userland code.
+ */
+type TypedUseQuerySubscriptionResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuerySubscriptionResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+type UseLazyQueryLastPromiseInfo<D extends QueryDefinition<any, any, any, any>> = {
+    lastArg: QueryArgFrom<D>;
+};
+/**
+ * A React hook similar to [`useQuery`](#usequery), but with manual control over when the data fetching occurs.
+ *
+ * This hook includes the functionality of [`useLazyQuerySubscription`](#uselazyquerysubscription).
+ *
+ * #### Features
+ *
+ * - Manual control over firing a request to retrieve data
+ * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
+ * - Returns the latest request status and cached data from the Redux store
+ * - Re-renders as the request status changes and data becomes available
+ * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once
+ *
+ * #### Note
+ *
+ * When the trigger function returned from a LazyQuery is called, it always initiates a new request to the server even if there is cached data. Set `preferCacheValue`(the second argument to the function) as `true` if you want it to immediately return a cached value if one exists.
+ */
+type UseLazyQuery<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(options?: SubscriptionOptions & Omit<UseQueryStateOptions<D, R>, 'skip'>) => [
+    LazyQueryTrigger<D>,
+    UseLazyQueryStateResult<D, R>,
+    UseLazyQueryLastPromiseInfo<D>
+];
+type TypedUseLazyQuery<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseLazyQuery<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+type UseLazyQueryStateResult<D extends QueryDefinition<any, any, any, any>, R = UseQueryStateDefaultResult<D>> = UseQueryStateResult<D, R> & {
+    /**
+     * Resets the hook state to its initial `uninitialized` state.
+     * This will also remove the last result from the cache.
+     */
+    reset: () => void;
+};
+/**
+ * Helper type to manually type the result
+ * of the `useLazyQuery` hook in userland code.
+ */
+type TypedUseLazyQueryStateResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseLazyQueryStateResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>, R>;
+type LazyQueryTrigger<D extends QueryDefinition<any, any, any, any>> = {
+    /**
+     * Triggers a lazy query.
+     *
+     * By default, this will start a new request even if there is already a value in the cache.
+     * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.
+     *
+     * @remarks
+     * If you need to access the error or success payload immediately after a lazy query, you can chain .unwrap().
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Using .unwrap with async await"
+     * try {
+     *   const payload = await getUserById(1).unwrap();
+     *   console.log('fulfilled', payload)
+     * } catch (error) {
+     *   console.error('rejected', error);
+     * }
+     * ```
+     */
+    (arg: QueryArgFrom<D>, preferCacheValue?: boolean): QueryActionCreatorResult<D>;
+};
+type TypedLazyQueryTrigger<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = LazyQueryTrigger<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+/**
+ * A React hook similar to [`useQuerySubscription`](#usequerysubscription), but with manual control over when the data fetching occurs.
+ *
+ * Note that this hook does not return a request status or cached data. For that use-case, see [`useLazyQuery`](#uselazyquery).
+ *
+ * #### Features
+ *
+ * - Manual control over firing a request to retrieve data
+ * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
+ * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once
+ */
+type UseLazyQuerySubscription<D extends QueryDefinition<any, any, any, any>> = (options?: SubscriptionOptions) => readonly [
+    LazyQueryTrigger<D>,
+    QueryArgFrom<D> | UninitializedValue,
+    {
+        reset: () => void;
+    }
+];
+type TypedUseLazyQuerySubscription<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseLazyQuerySubscription<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+/**
+ * @internal
+ */
+type QueryStateSelector<R extends Record<string, any>, D extends QueryDefinition<any, any, any, any>> = (state: UseQueryStateDefaultResult<D>) => R;
+/**
+ * Provides a way to define a strongly-typed version of
+ * {@linkcode QueryStateSelector} for use with a specific query.
+ * This is useful for scenarios where you want to create a "pre-typed"
+ * {@linkcode UseQueryStateOptions.selectFromResult | selectFromResult}
+ * function.
+ *
+ * @example
+ * <caption>#### __Create a strongly-typed `selectFromResult` selector function__</caption>
+ *
+ * ```tsx
+ * import type { TypedQueryStateSelector } from '@reduxjs/toolkit/query/react'
+ * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+ *
+ * type Post = {
+ *   id: number
+ *   title: string
+ * }
+ *
+ * type PostsApiResponse = {
+ *   posts: Post[]
+ *   total: number
+ *   skip: number
+ *   limit: number
+ * }
+ *
+ * type QueryArgument = number | undefined
+ *
+ * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>
+ *
+ * type SelectedResult = Pick<PostsApiResponse, 'posts'>
+ *
+ * const postsApiSlice = createApi({
+ *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com/posts' }),
+ *   reducerPath: 'postsApi',
+ *   tagTypes: ['Posts'],
+ *   endpoints: (build) => ({
+ *     getPosts: build.query<PostsApiResponse, QueryArgument>({
+ *       query: (limit = 5) => `?limit=${limit}&select=title`,
+ *     }),
+ *   }),
+ * })
+ *
+ * const { useGetPostsQuery } = postsApiSlice
+ *
+ * function PostById({ id }: { id: number }) {
+ *   const { post } = useGetPostsQuery(undefined, {
+ *     selectFromResult: (state) => ({
+ *       post: state.data?.posts.find((post) => post.id === id),
+ *     }),
+ *   })
+ *
+ *   return <li>{post?.title}</li>
+ * }
+ *
+ * const EMPTY_ARRAY: Post[] = []
+ *
+ * const typedSelectFromResult: TypedQueryStateSelector<
+ *   PostsApiResponse,
+ *   QueryArgument,
+ *   BaseQueryFunction,
+ *   SelectedResult
+ * > = (state) => ({ posts: state.data?.posts ?? EMPTY_ARRAY })
+ *
+ * function PostsList() {
+ *   const { posts } = useGetPostsQuery(undefined, {
+ *     selectFromResult: typedSelectFromResult,
+ *   })
+ *
+ *   return (
+ *     <div>
+ *       <ul>
+ *         {posts.map((post) => (
+ *           <PostById key={post.id} id={post.id} />
+ *         ))}
+ *       </ul>
+ *     </div>
+ *   )
+ * }
+ * ```
+ *
+ * @template ResultType - The type of the result `data` returned by the query.
+ * @template QueryArgumentType - The type of the argument passed into the query.
+ * @template BaseQueryFunctionType - The type of the base query function being used.
+ * @template SelectedResultType - The type of the selected result returned by the __`selectFromResult`__ function.
+ *
+ * @since 2.3.0
+ * @public
+ */
+type TypedQueryStateSelector<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, SelectedResultType extends Record<string, any> = UseQueryStateDefaultResult<QueryDefinition<QueryArgumentType, BaseQueryFunctionType, string, ResultType, string>>> = QueryStateSelector<SelectedResultType, QueryDefinition<QueryArgumentType, BaseQueryFunctionType, string, ResultType, string>>;
+/**
+ * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.
+ *
+ * Note that this hook does not trigger fetching new data. For that use-case, see [`useQuery`](#usequery) or [`useQuerySubscription`](#usequerysubscription).
+ *
+ * #### Features
+ *
+ * - Returns the latest request status and cached data from the Redux store
+ * - Re-renders as the request status changes and data becomes available
+ */
+type UseQueryState<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(arg: QueryArgFrom<D> | SkipToken, options?: UseQueryStateOptions<D, R>) => UseQueryStateResult<D, R>;
+type TypedUseQueryState<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQueryState<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+/**
+ * @internal
+ */
+type UseQueryStateOptions<D extends QueryDefinition<any, any, any, any>, R extends Record<string, any>> = {
+    /**
+     * Prevents a query from automatically running.
+     *
+     * @remarks
+     * When skip is true:
+     *
+     * - **If the query has cached data:**
+     *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed
+     *   * The query will have a status of `uninitialized`
+     *   * If `skip: false` is set after skipping the initial load, the cached result will be used
+     * - **If the query does not have cached data:**
+     *   * The query will have a status of `uninitialized`
+     *   * The query will not exist in the state when viewed with the dev tools
+     *   * The query will not automatically fetch on mount
+     *   * The query will not automatically run when additional components with the same query are added that do run
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Skip example"
+     * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {
+     *   const { data, error, status } = useGetPokemonByNameQuery(name, {
+     *     skip,
+     *   });
+     *
+     *   return (
+     *     <div>
+     *       {name} - {status}
+     *     </div>
+     *   );
+     * };
+     * ```
+     */
+    skip?: boolean;
+    /**
+     * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.
+     * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.
+     * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Using selectFromResult to extract a single result"
+     * function PostsList() {
+     *   const { data: posts } = api.useGetPostsQuery();
+     *
+     *   return (
+     *     <ul>
+     *       {posts?.data?.map((post) => (
+     *         <PostById key={post.id} id={post.id} />
+     *       ))}
+     *     </ul>
+     *   );
+     * }
+     *
+     * function PostById({ id }: { id: number }) {
+     *   // Will select the post with the given id, and will only rerender if the given posts data changes
+     *   const { post } = api.useGetPostsQuery(undefined, {
+     *     selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),
+     *   });
+     *
+     *   return <li>{post?.name}</li>;
+     * }
+     * ```
+     */
+    selectFromResult?: QueryStateSelector<R, D>;
+};
+/**
+ * Provides a way to define a "pre-typed" version of
+ * {@linkcode UseQueryStateOptions} with specific options for a given query.
+ * This is particularly useful for setting default query behaviors such as
+ * refetching strategies, which can be overridden as needed.
+ *
+ * @example
+ * <caption>#### __Create a `useQuery` hook with default options__</caption>
+ *
+ * ```ts
+ * import type {
+ *   SubscriptionOptions,
+ *   TypedUseQueryStateOptions,
+ * } from '@reduxjs/toolkit/query/react'
+ * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+ *
+ * type Post = {
+ *   id: number
+ *   name: string
+ * }
+ *
+ * const api = createApi({
+ *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),
+ *   tagTypes: ['Post'],
+ *   endpoints: (build) => ({
+ *     getPosts: build.query<Post[], void>({
+ *       query: () => 'posts',
+ *     }),
+ *   }),
+ * })
+ *
+ * const { useGetPostsQuery } = api
+ *
+ * export const useGetPostsQueryWithDefaults = <
+ *   SelectedResult extends Record<string, any>,
+ * >(
+ *   overrideOptions: TypedUseQueryStateOptions<
+ *     Post[],
+ *     void,
+ *     ReturnType<typeof fetchBaseQuery>,
+ *     SelectedResult
+ *   > &
+ *     SubscriptionOptions,
+ * ) =>
+ *   useGetPostsQuery(undefined, {
+ *     // Insert default options here
+ *
+ *     refetchOnMountOrArgChange: true,
+ *     refetchOnFocus: true,
+ *     ...overrideOptions,
+ *   })
+ * ```
+ *
+ * @template ResultType - The type of the result `data` returned by the query.
+ * @template QueryArg - The type of the argument passed into the query.
+ * @template BaseQuery - The type of the base query function being used.
+ * @template SelectedResult - The type of the selected result returned by the __`selectFromResult`__ function.
+ *
+ * @since 2.2.8
+ * @public
+ */
+type TypedUseQueryStateOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseQueryStateOptions<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>, SelectedResult>;
+type UseQueryStateResult<_ extends QueryDefinition<any, any, any, any>, R> = TSHelpersNoInfer<R>;
+/**
+ * Helper type to manually type the result
+ * of the `useQueryState` hook in userland code.
+ */
+type TypedUseQueryStateResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = TSHelpersNoInfer<R>;
+type UseQueryStateBaseResult<D extends QueryDefinition<any, any, any, any>> = QuerySubState<D> & {
+    /**
+     * Where `data` tries to hold data as much as possible, also re-using
+     * data from the last arguments passed into the hook, this property
+     * will always contain the received data from the query, for the current query arguments.
+     */
+    currentData?: ResultTypeFrom<D>;
+    /**
+     * Query has not started yet.
+     */
+    isUninitialized: false;
+    /**
+     * Query is currently loading for the first time. No data yet.
+     */
+    isLoading: false;
+    /**
+     * Query is currently fetching, but might have data from an earlier request.
+     */
+    isFetching: false;
+    /**
+     * Query has data from a successful load.
+     */
+    isSuccess: false;
+    /**
+     * Query is currently in "error" state.
+     */
+    isError: false;
+};
+type UseQueryStateUninitialized<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<Extract<UseQueryStateBaseResult<D>, {
+    status: QueryStatus.uninitialized;
+}>, {
+    isUninitialized: true;
+}>;
+type UseQueryStateLoading<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {
+    isLoading: true;
+    isFetching: boolean;
+    data: undefined;
+}>;
+type UseQueryStateSuccessFetching<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {
+    isSuccess: true;
+    isFetching: true;
+    error: undefined;
+} & {
+    data: ResultTypeFrom<D>;
+} & Required<Pick<UseQueryStateBaseResult<D>, 'fulfilledTimeStamp'>>>;
+type UseQueryStateSuccessNotFetching<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {
+    isSuccess: true;
+    isFetching: false;
+    error: undefined;
+} & {
+    data: ResultTypeFrom<D>;
+    currentData: ResultTypeFrom<D>;
+} & Required<Pick<UseQueryStateBaseResult<D>, 'fulfilledTimeStamp'>>>;
+type UseQueryStateError<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {
+    isError: true;
+} & Required<Pick<UseQueryStateBaseResult<D>, 'error'>>>;
+type UseQueryStateDefaultResult<D extends QueryDefinition<any, any, any, any>> = TSHelpersId<UseQueryStateUninitialized<D> | UseQueryStateLoading<D> | UseQueryStateSuccessFetching<D> | UseQueryStateSuccessNotFetching<D> | UseQueryStateError<D>> & {
+    /**
+     * @deprecated Included for completeness, but discouraged.
+     * Please use the `isLoading`, `isFetching`, `isSuccess`, `isError`
+     * and `isUninitialized` flags instead
+     */
+    status: QueryStatus;
+};
+type LazyInfiniteQueryTrigger<D extends InfiniteQueryDefinition<any, any, any, any, any>> = {
+    /**
+     * Triggers a lazy query.
+     *
+     * By default, this will start a new request even if there is already a value in the cache.
+     * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.
+     *
+     * @remarks
+     * If you need to access the error or success payload immediately after a lazy query, you can chain .unwrap().
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Using .unwrap with async await"
+     * try {
+     *   const payload = await getUserById(1).unwrap();
+     *   console.log('fulfilled', payload)
+     * } catch (error) {
+     *   console.error('rejected', error);
+     * }
+     * ```
+     */
+    (arg: QueryArgFrom<D>, direction: InfiniteQueryDirection): InfiniteQueryActionCreatorResult<D>;
+};
+type TypedLazyInfiniteQueryTrigger<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = LazyInfiniteQueryTrigger<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;
+type UseInfiniteQuerySubscriptionOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>> = SubscriptionOptions & {
+    /**
+     * Prevents a query from automatically running.
+     *
+     * @remarks
+     * When `skip` is true (or `skipToken` is passed in as `arg`):
+     *
+     * - **If the query has cached data:**
+     *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed
+     *   * The query will have a status of `uninitialized`
+     *   * If `skip: false` is set after the initial load, the cached result will be used
+     * - **If the query does not have cached data:**
+     *   * The query will have a status of `uninitialized`
+     *   * The query will not exist in the state when viewed with the dev tools
+     *   * The query will not automatically fetch on mount
+     *   * The query will not automatically run when additional components with the same query are added that do run
+     *
+     * @example
+     * ```tsx
+     * // codeblock-meta no-transpile title="Skip example"
+     * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {
+     *   const { data, error, status } = useGetPokemonByNameQuery(name, {
+     *     skip,
+     *   });
+     *
+     *   return (
+     *     <div>
+     *       {name} - {status}
+     *     </div>
+     *   );
+     * };
+     * ```
+     */
+    skip?: boolean;
+    /**
+     * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.
+     * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.
+     * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.
+     * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.
+     *
+     * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.
+     */
+    refetchOnMountOrArgChange?: boolean | number;
+    initialPageParam?: PageParamFrom<D>;
+    /**
+     * Defaults to `true`. When this is `true` and an infinite query endpoint is refetched
+     * (due to tag invalidation, polling, arg change configuration, or manual refetching),
+     * RTK Query will try to sequentially refetch all pages currently in the cache.
+     * When `false` only the first page will be refetched.
+     *
+     * This option applies to all automatic refetches for this subscription (polling, tag invalidation, etc.).
+     * It can be overridden on a per-call basis using the `refetch()` method.
+     */
+    refetchCachedPages?: boolean;
+};
+type TypedUseInfiniteQuerySubscription<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuerySubscription<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;
+type UseInfiniteQuerySubscriptionResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = {
+    refetch: (options?: Pick<UseInfiniteQuerySubscriptionOptions<D>, 'refetchCachedPages'>) => InfiniteQueryActionCreatorResult<D>;
+    trigger: LazyInfiniteQueryTrigger<D>;
+    fetchNextPage: () => InfiniteQueryActionCreatorResult<D>;
+    fetchPreviousPage: () => InfiniteQueryActionCreatorResult<D>;
+};
+/**
+ * Helper type to manually type the result
+ * of the `useQuerySubscription` hook in userland code.
+ */
+type TypedUseInfiniteQuerySubscriptionResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuerySubscriptionResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;
+type InfiniteQueryStateSelector<R extends Record<string, any>, D extends InfiniteQueryDefinition<any, any, any, any, any>> = (state: UseInfiniteQueryStateDefaultResult<D>) => R;
+type TypedInfiniteQueryStateSelector<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = InfiniteQueryStateSelector<SelectedResult, InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;
+/**
+ * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.  Additionally, it will cache multiple "pages" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.
+ *
+ * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.
+ *
+ *  The `data` field will be a `{pages: Data[], pageParams: PageParam[]}` structure containing all fetched page responses and the corresponding page param values for each page. You may use this to render individual pages, combine all pages into a single infinite list, or other display logic as needed.
+ *
+ * This hook combines the functionality of both [`useInfiniteQueryState`](#useinfinitequerystate) and [`useInfiniteQuerySubscription`](#useinfinitequerysubscription) together, and is intended to be used in the majority of situations.
+ *
+ * As with normal query hooks, `skipToken` is a valid argument that will skip the query from executing.
+ *
+ * By default, the initial request will use the `initialPageParam` value that was defined on the infinite query endpoint. If you want to start from a different value, you can pass `initialPageParam` as part of the hook options to override that initial request value.
+ *
+ * Use the returned `fetchNextPage` and `fetchPreviousPage` methods on the hook result object to trigger fetches forwards and backwards. These will always calculate the next or previous page param based on the current cached pages and the provided `getNext/PreviousPageParam` callbacks defined in the endpoint.
+ *
+ *
+ * #### Features
+ *
+ * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default
+ * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
+ * - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards
+ * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met
+ * - Returns the latest request status and cached data from the Redux store
+ * - Re-renders as the request status changes and data becomes available
+ */
+type UseInfiniteQuery<D extends InfiniteQueryDefinition<any, any, any, any, any>> = <R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<D>>(arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQuerySubscriptionOptions<D> & UseInfiniteQueryStateOptions<D, R>) => UseInfiniteQueryHookResult<D, R> & Pick<UseInfiniteQuerySubscriptionResult<D>, 'fetchNextPage' | 'fetchPreviousPage'>;
+type TypedUseInfiniteQuery<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuery<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;
+/**
+ * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.
+ *
+ * Note that this hook does not trigger fetching new data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQuerySubscription`](#useinfinitequerysubscription).
+ *
+ * #### Features
+ *
+ * - Returns the latest request status and cached data from the Redux store
+ * - Re-renders as the request status changes and data becomes available
+ */
+type UseInfiniteQueryState<D extends InfiniteQueryDefinition<any, any, any, any, any>> = <R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<D>>(arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQueryStateOptions<D, R>) => UseInfiniteQueryStateResult<D, R>;
+type TypedUseInfiniteQueryState<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQueryState<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;
+/**
+ * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data. Additionally, it will cache multiple "pages" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.
+ *
+ * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.
+ *
+ * Note that this hook does not return a request status or cached data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQueryState`](#useinfinitequerystate).
+ *
+ * #### Features
+ *
+ * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default
+ * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
+ * - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards
+ * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met
+ */
+type UseInfiniteQuerySubscription<D extends InfiniteQueryDefinition<any, any, any, any, any>> = (arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQuerySubscriptionOptions<D>) => UseInfiniteQuerySubscriptionResult<D>;
+type UseInfiniteQueryHookResult<D extends InfiniteQueryDefinition<any, any, any, any, any>, R = UseInfiniteQueryStateDefaultResult<D>> = UseInfiniteQueryStateResult<D, R> & Pick<UseInfiniteQuerySubscriptionResult<D>, 'refetch' | 'fetchNextPage' | 'fetchPreviousPage'>;
+type TypedUseInfiniteQueryHookResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryHookResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, R>;
+type UseInfiniteQueryStateOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>, R extends Record<string, any>> = {
+    /**
+     * Prevents a query from automatically running.
+     *
+     * @remarks
+     * When skip is true:
+     *
+     * - **If the query has cached data:**
+     *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed
+     *   * The query will have a status of `uninitialized`
+     *   * If `skip: false` is set after skipping the initial load, the cached result will be used
+     * - **If the query does not have cached data:**
+     *   * The query will have a status of `uninitialized`
+     *   * The query will not exist in the state when viewed with the dev tools
+     *   * The query will not automatically fetch on mount
+     *   * The query will not automatically run when additional components with the same query are added that do run
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Skip example"
+     * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {
+     *   const { data, error, status } = useGetPokemonByNameQuery(name, {
+     *     skip,
+     *   });
+     *
+     *   return (
+     *     <div>
+     *       {name} - {status}
+     *     </div>
+     *   );
+     * };
+     * ```
+     */
+    skip?: boolean;
+    /**
+     * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.
+     * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.
+     * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.
+     * Note that this should always return an object (not a primitive), as RTKQ adds fields to the return value.
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Using selectFromResult to extract a single result"
+     * function PostsList() {
+     *   const { data: posts } = api.useGetPostsQuery();
+     *
+     *   return (
+     *     <ul>
+     *       {posts?.data?.map((post) => (
+     *         <PostById key={post.id} id={post.id} />
+     *       ))}
+     *     </ul>
+     *   );
+     * }
+     *
+     * function PostById({ id }: { id: number }) {
+     *   // Will select the post with the given id, and will only rerender if the given posts data changes
+     *   const { post } = api.useGetPostsQuery(undefined, {
+     *     selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),
+     *   });
+     *
+     *   return <li>{post?.name}</li>;
+     * }
+     * ```
+     */
+    selectFromResult?: InfiniteQueryStateSelector<R, D>;
+};
+type TypedUseInfiniteQueryStateOptions<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryStateOptions<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, SelectedResult>;
+type UseInfiniteQueryStateResult<D extends InfiniteQueryDefinition<any, any, any, any, any>, R = UseInfiniteQueryStateDefaultResult<D>> = TSHelpersNoInfer<R>;
+type TypedUseInfiniteQueryStateResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, R = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryStateResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, R>;
+type UseInfiniteQueryStateBaseResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = InfiniteQuerySubState<D> & {
+    /**
+     * Where `data` tries to hold data as much as possible, also re-using
+     * data from the last arguments passed into the hook, this property
+     * will always contain the received data from the query, for the current query arguments.
+     */
+    currentData?: InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>;
+    /**
+     * Query has not started yet.
+     */
+    isUninitialized: false;
+    /**
+     * Query is currently loading for the first time. No data yet.
+     */
+    isLoading: false;
+    /**
+     * Query is currently fetching, but might have data from an earlier request.
+     */
+    isFetching: false;
+    /**
+     * Query has data from a successful load.
+     */
+    isSuccess: false;
+    /**
+     * Query is currently in "error" state.
+     */
+    isError: false;
+    hasNextPage: boolean;
+    hasPreviousPage: boolean;
+    isFetchingNextPage: boolean;
+    isFetchingPreviousPage: boolean;
+};
+type UseInfiniteQueryStateDefaultResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = TSHelpersId<TSHelpersOverride<Extract<UseInfiniteQueryStateBaseResult<D>, {
+    status: QueryStatus.uninitialized;
+}>, {
+    isUninitialized: true;
+}> | TSHelpersOverride<UseInfiniteQueryStateBaseResult<D>, {
+    isLoading: true;
+    isFetching: boolean;
+    data: undefined;
+} | ({
+    isSuccess: true;
+    isFetching: true;
+    error: undefined;
+} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp'>>) | ({
+    isSuccess: true;
+    isFetching: false;
+    error: undefined;
+} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp' | 'currentData'>>) | ({
+    isError: true;
+} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'error'>>)>> & {
+    /**
+     * @deprecated Included for completeness, but discouraged.
+     * Please use the `isLoading`, `isFetching`, `isSuccess`, `isError`
+     * and `isUninitialized` flags instead
+     */
+    status: QueryStatus;
+};
+type MutationStateSelector<R extends Record<string, any>, D extends MutationDefinition<any, any, any, any>> = (state: MutationResultSelectorResult<D>) => R;
+type UseMutationStateOptions<D extends MutationDefinition<any, any, any, any>, R extends Record<string, any>> = {
+    selectFromResult?: MutationStateSelector<R, D>;
+    fixedCacheKey?: string;
+};
+type UseMutationStateResult<D extends MutationDefinition<any, any, any, any>, R> = TSHelpersNoInfer<R> & {
+    originalArgs?: QueryArgFrom<D>;
+    /**
+     * Resets the hook state to its initial `uninitialized` state.
+     * This will also remove the last result from the cache.
+     */
+    reset: () => void;
+};
+/**
+ * Helper type to manually type the result
+ * of the `useMutation` hook in userland code.
+ */
+type TypedUseMutationResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = MutationResultSelectorResult<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseMutationStateResult<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>, R>;
+/**
+ * A React hook that lets you trigger an update request for a given endpoint, and subscribes the component to read the request status from the Redux store. The component will re-render as the loading status changes.
+ *
+ * #### Features
+ *
+ * - Manual control over firing a request to alter data on the server or possibly invalidate the cache
+ * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
+ * - Returns the latest request status and cached data from the Redux store
+ * - Re-renders as the request status changes and data becomes available
+ */
+type UseMutation<D extends MutationDefinition<any, any, any, any>> = <R extends Record<string, any> = MutationResultSelectorResult<D>>(options?: UseMutationStateOptions<D, R>) => readonly [MutationTrigger<D>, UseMutationStateResult<D, R>];
+type TypedUseMutation<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseMutation<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+type MutationTrigger<D extends MutationDefinition<any, any, any, any>> = {
+    /**
+     * Triggers the mutation and returns a Promise.
+     * @remarks
+     * If you need to access the error or success payload immediately after a mutation, you can chain .unwrap().
+     *
+     * @example
+     * ```ts
+     * // codeblock-meta title="Using .unwrap with async await"
+     * try {
+     *   const payload = await addPost({ id: 1, name: 'Example' }).unwrap();
+     *   console.log('fulfilled', payload)
+     * } catch (error) {
+     *   console.error('rejected', error);
+     * }
+     * ```
+     */
+    (arg: QueryArgFrom<D>): MutationActionCreatorResult<D>;
+};
+type TypedMutationTrigger<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = MutationTrigger<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>;
+
+type QueryHookNames<Definitions extends EndpointDefinitions> = {
+    [K in keyof Definitions as Definitions[K] extends {
+        type: DefinitionType.query;
+    } ? `use${Capitalize<K & string>}Query` : never]: UseQuery<Extract<Definitions[K], QueryDefinition<any, any, any, any>>>;
+};
+type LazyQueryHookNames<Definitions extends EndpointDefinitions> = {
+    [K in keyof Definitions as Definitions[K] extends {
+        type: DefinitionType.query;
+    } ? `useLazy${Capitalize<K & string>}Query` : never]: UseLazyQuery<Extract<Definitions[K], QueryDefinition<any, any, any, any>>>;
+};
+type InfiniteQueryHookNames<Definitions extends EndpointDefinitions> = {
+    [K in keyof Definitions as Definitions[K] extends {
+        type: DefinitionType.infinitequery;
+    } ? `use${Capitalize<K & string>}InfiniteQuery` : never]: UseInfiniteQuery<Extract<Definitions[K], InfiniteQueryDefinition<any, any, any, any, any>>>;
+};
+type MutationHookNames<Definitions extends EndpointDefinitions> = {
+    [K in keyof Definitions as Definitions[K] extends {
+        type: DefinitionType.mutation;
+    } ? `use${Capitalize<K & string>}Mutation` : never]: UseMutation<Extract<Definitions[K], MutationDefinition<any, any, any, any>>>;
+};
+type HooksWithUniqueNames<Definitions extends EndpointDefinitions> = QueryHookNames<Definitions> & LazyQueryHookNames<Definitions> & InfiniteQueryHookNames<Definitions> & MutationHookNames<Definitions>;
+
+export declare const reactHooksModuleName: unique symbol;
+type ReactHooksModule = typeof reactHooksModuleName;
+declare module '@reduxjs/toolkit/query' {
+    interface ApiModules<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string> {
+        [reactHooksModuleName]: {
+            /**
+             *  Endpoints based on the input endpoints provided to `createApi`, containing `select`, `hooks` and `action matchers`.
+             */
+            endpoints: {
+                [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? QueryHooks<Definitions[K]> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? MutationHooks<Definitions[K]> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryHooks<Definitions[K]> : never;
+            };
+            /**
+             * A hook that accepts a string endpoint name, and provides a callback that when called, pre-fetches the data for that endpoint.
+             */
+            usePrefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, options?: PrefetchOptions): (arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions) => void;
+        } & HooksWithUniqueNames<Definitions>;
+    }
+}
+type RR = typeof react_redux;
+interface ReactHooksModuleOptions {
+    /**
+     * The hooks from React Redux to be used
+     */
+    hooks?: {
+        /**
+         * The version of the `useDispatch` hook to be used
+         */
+        useDispatch: RR['useDispatch'];
+        /**
+         * The version of the `useSelector` hook to be used
+         */
+        useSelector: RR['useSelector'];
+        /**
+         * The version of the `useStore` hook to be used
+         */
+        useStore: RR['useStore'];
+    };
+    /**
+     * The version of the `batchedUpdates` function to be used
+     */
+    batch?: RR['batch'];
+    /**
+     * Enables performing asynchronous tasks immediately within a render.
+     *
+     * @example
+     *
+     * ```ts
+     * import {
+     *   buildCreateApi,
+     *   coreModule,
+     *   reactHooksModule
+     * } from '@reduxjs/toolkit/query/react'
+     *
+     * const createApi = buildCreateApi(
+     *   coreModule(),
+     *   reactHooksModule({ unstable__sideEffectsInRender: true })
+     * )
+     * ```
+     */
+    unstable__sideEffectsInRender?: boolean;
+    /**
+     * A selector creator (usually from `reselect`, or matching the same signature)
+     */
+    createSelector?: CreateSelectorFunction<any, any, any>;
+}
+/**
+ * Creates a module that generates react hooks from endpoints, for use with `buildCreateApi`.
+ *
+ *  @example
+ * ```ts
+ * const MyContext = React.createContext<ReactReduxContextValue | null>(null);
+ * const customCreateApi = buildCreateApi(
+ *   coreModule(),
+ *   reactHooksModule({
+ *     hooks: {
+ *       useDispatch: createDispatchHook(MyContext),
+ *       useSelector: createSelectorHook(MyContext),
+ *       useStore: createStoreHook(MyContext)
+ *     }
+ *   })
+ * );
+ * ```
+ *
+ * @returns A module for use with `buildCreateApi`
+ */
+declare const reactHooksModule: ({ batch, hooks, createSelector, unstable__sideEffectsInRender, ...rest }?: ReactHooksModuleOptions) => Module<ReactHooksModule>;
+
+/**
+ * Can be used as a `Provider` if you **do not already have a Redux store**.
+ *
+ * @example
+ * ```tsx
+ * // codeblock-meta no-transpile title="Basic usage - wrap your App with ApiProvider"
+ * import * as React from 'react';
+ * import { ApiProvider } from '@reduxjs/toolkit/query/react';
+ * import { Pokemon } from './features/Pokemon';
+ *
+ * function App() {
+ *   return (
+ *     <ApiProvider api={api}>
+ *       <Pokemon />
+ *     </ApiProvider>
+ *   );
+ * }
+ * ```
+ *
+ * @remarks
+ * Using this together with an existing redux store, both will
+ * conflict with each other - please use the traditional redux setup
+ * in that case.
+ */
+declare function ApiProvider(props: {
+    children: any;
+    api: Api<any, {}, any, any>;
+    setupListeners?: Parameters<typeof setupListeners>[1] | false;
+    context?: Context<ReactReduxContextValue | null>;
+}): React.JSX.Element;
+
+declare const createApi: _reduxjs_toolkit_query.CreateApi<typeof _reduxjs_toolkit_query.coreModuleName | typeof reactHooksModuleName>;
+
+export { ApiProvider, type TypedInfiniteQueryStateSelector, type TypedLazyInfiniteQueryTrigger, type TypedLazyQueryTrigger, type TypedMutationTrigger, type TypedQueryStateSelector, type TypedUseInfiniteQuery, type TypedUseInfiniteQueryHookResult, type TypedUseInfiniteQueryState, type TypedUseInfiniteQueryStateOptions, type TypedUseInfiniteQueryStateResult, type TypedUseInfiniteQuerySubscription, type TypedUseInfiniteQuerySubscriptionResult, type TypedUseLazyQuery, type TypedUseLazyQueryStateResult, type TypedUseLazyQuerySubscription, type TypedUseMutation, type TypedUseMutationResult, type TypedUseQuery, type TypedUseQueryHookResult, type TypedUseQueryState, type TypedUseQueryStateOptions, type TypedUseQueryStateResult, type TypedUseQuerySubscription, type TypedUseQuerySubscriptionResult, createApi, reactHooksModule };
Index: node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.browser.mjs
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.browser.mjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.browser.mjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,2 @@
+import{buildCreateApi as ue,coreModule as ye,copyWithStructuralSharing as oe,setupListeners as pe,QueryStatus as fe,skipToken as b}from"@reduxjs/toolkit/query";import"@reduxjs/toolkit";import{batch as Ce,useDispatch as Ne,useSelector as Le,useStore as He}from"react-redux";import{createSelector as ze}from"reselect";function _(e){return e.replace(e[0],e[0].toUpperCase())}var he="query",Ie="mutation",Ue="infinitequery";function Qe(e){return e.type===he}function ce(e){return e.type===Ie}function $(e){return e.type===Ue}function z(e,...c){return Object.assign(e,...c)}import{formatProdErrorMessage as be,formatProdErrorMessage as Ee}from"@reduxjs/toolkit";import{useEffect as x,useRef as I,useMemo as R,useContext as de,useCallback as k,useDebugValue as G,useLayoutEffect as le,useState as ne}from"react";import{shallowEqual as w,Provider as Re,ReactReduxContext as ge}from"react-redux";var j=Symbol();function Z(e){let c=I(e),g=R(()=>oe(c.current,e),[e]);return x(()=>{c.current!==g&&(c.current=g)},[g]),g}function v(e){let c=I(e);return x(()=>{w(c.current,e)||(c.current=e)},[e]),w(c.current,e)?c.current:e}var ke=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Oe=ke(),Me=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Fe=Me(),we=()=>Oe||Fe?le:x,ve=we(),Te=e=>e.isUninitialized?{...e,isUninitialized:!1,isFetching:!0,isLoading:e.data===void 0,status:fe.pending}:e;function re(e,...c){let g={};return c.forEach(A=>{g[A]=e[A]}),g}var ie=["data","status","isLoading","isSuccess","isError","error"];function De({api:e,moduleOptions:{batch:c,hooks:{useDispatch:g,useSelector:A,useStore:W},unstable__sideEffectsInRender:U,createSelector:C},serializeQueryArgs:E,context:N}){let O=U?t=>t():x,L=t=>t.current?.unsubscribe?.(),q=N.endpointDefinitions;return{buildQueryHooks:ee,buildInfiniteQueryHooks:Se,buildMutationHook:Be,usePrefetch:K};function J(t,i,p){if(i?.endpointName&&t.isUninitialized){let{endpointName:a}=i,y=q[a];p!==b&&E({queryArgs:i.originalArgs,endpointDefinition:y,endpointName:a})===E({queryArgs:p,endpointDefinition:y,endpointName:a})&&(i=void 0)}let u=t.isSuccess?t.data:i?.data;u===void 0&&(u=t.data);let s=u!==void 0,n=t.isLoading,r=(!i||i.isLoading||i.isUninitialized)&&!s&&n,o=t.isSuccess||s&&(n&&!i?.isError||t.isUninitialized);return{...t,data:u,currentData:t.data,isFetching:n,isLoading:r,isSuccess:o}}function m(t,i,p){if(i?.endpointName&&t.isUninitialized){let{endpointName:a}=i,y=q[a];p!==b&&E({queryArgs:i.originalArgs,endpointDefinition:y,endpointName:a})===E({queryArgs:p,endpointDefinition:y,endpointName:a})&&(i=void 0)}let u=t.isSuccess?t.data:i?.data;u===void 0&&(u=t.data);let s=u!==void 0,n=t.isLoading,r=(!i||i.isLoading||i.isUninitialized)&&!s&&n,o=t.isSuccess||n&&s;return{...t,data:u,currentData:t.data,isFetching:n,isLoading:r,isSuccess:o}}function K(t,i){let p=g(),u=v(i);return k((s,n)=>p(e.util.prefetch(t,s,{...u,...n})),[t,p,u])}function h(t,i,{refetchOnReconnect:p,refetchOnFocus:u,refetchOnMountOrArgChange:s,skip:n=!1,pollingInterval:r=0,skipPollingIfUnfocused:o=!1,...a}={}){let{initiate:y}=e.endpoints[t],d=g(),S=I(void 0);if(!S.current){let F=d(e.internalActions.internal_getRTKQSubscriptions());S.current=F}let f=Z(n?b:i),Q=v({refetchOnReconnect:p,refetchOnFocus:u,pollingInterval:r,skipPollingIfUnfocused:o}),T=a.initialPageParam,l=v(T),B=a.refetchCachedPages,P=v(B),D=I(void 0),{queryCacheKey:V,requestId:se}=D.current||{},ae=!1;V&&se&&(ae=S.current.isRequestSubscribed(V,se));let te=!ae&&D.current!==void 0;return O(()=>{te&&(D.current=void 0)},[te]),O(()=>{let F=D.current;if(f===b){F?.unsubscribe(),D.current=void 0;return}let Pe=D.current?.subscriptionOptions;if(!F||F.arg!==f){F?.unsubscribe();let Ae=d(y(f,{subscriptionOptions:Q,forceRefetch:s,...$(q[t])?{initialPageParam:l,refetchCachedPages:P}:{}}));D.current=Ae}else Q!==Pe&&F.updateSubscriptionOptions(Q)},[d,y,s,f,Q,te,l,P,t]),[D,d,y,Q]}function M(t,i){return(u,{skip:s=!1,selectFromResult:n}={})=>{let{select:r}=e.endpoints[t],o=Z(s?b:u),a=I(void 0),y=R(()=>C([r(o),(T,l)=>l,T=>o],i,{memoizeOptions:{resultEqualityCheck:w}}),[r,o]),d=R(()=>n?C([y],n,{devModeChecks:{identityFunctionCheck:"never"}}):y,[y,n]),S=A(T=>d(T,a.current),w),f=W(),Q=y(f.getState(),a.current);return ve(()=>{a.current=Q},[Q]),S}}function H(t){x(()=>()=>{L(t),t.current=void 0},[t])}function X(t){if(!t.current)throw new Error(be(38));return t.current.refetch()}function ee(t){let i=(s,n={})=>{let[r]=h(t,s,n);return H(r),R(()=>({refetch:()=>X(r)}),[r])},p=({refetchOnReconnect:s,refetchOnFocus:n,pollingInterval:r=0,skipPollingIfUnfocused:o=!1}={})=>{let{initiate:a}=e.endpoints[t],y=g(),[d,S]=ne(j),f=I(void 0),Q=v({refetchOnReconnect:s,refetchOnFocus:n,pollingInterval:r,skipPollingIfUnfocused:o});O(()=>{let P=f.current?.subscriptionOptions;Q!==P&&f.current?.updateSubscriptionOptions(Q)},[Q]);let T=I(Q);O(()=>{T.current=Q},[Q]);let l=k(function(P,D=!1){let V;return c(()=>{L(f),f.current=V=y(a(P,{subscriptionOptions:T.current,forceRefetch:!D})),S(P)}),V},[y,a]),B=k(()=>{f.current?.queryCacheKey&&y(e.internalActions.removeQueryResult({queryCacheKey:f.current?.queryCacheKey}))},[y]);return x(()=>()=>{L(f)},[]),x(()=>{d!==j&&!f.current&&l(d,!0)},[d,l]),R(()=>[l,d,{reset:B}],[l,d,B])},u=M(t,J);return{useQueryState:u,useQuerySubscription:i,useLazyQuerySubscription:p,useLazyQuery(s){let[n,r,{reset:o}]=p(s),a=u(r,{...s,skip:r===j}),y=R(()=>({lastArg:r}),[r]);return R(()=>[n,{...a,reset:o},y],[n,a,o,y])},useQuery(s,n){let r=i(s,n),o=u(s,{selectFromResult:s===b||n?.skip?void 0:Te,...n}),a=re(o,...ie);return G(a),R(()=>({...o,...r}),[o,r])}}}function Se(t){let i=(u,s={})=>{let[n,r,o,a]=h(t,u,s),y=I(a);O(()=>{y.current=a},[a]);let d=s.refetchCachedPages,S=v(d),f=k(function(l,B){let P;return c(()=>{L(n),n.current=P=r(o(l,{subscriptionOptions:y.current,direction:B}))}),P},[n,r,o]);H(n);let Q=Z(s.skip?b:u),T=k(l=>{if(!n.current)throw new Error(Ee(38));let B={refetchCachedPages:l?.refetchCachedPages??S};return n.current.refetch(B)},[n,S]);return R(()=>({trigger:f,refetch:T,fetchNextPage:()=>f(Q,"forward"),fetchPreviousPage:()=>f(Q,"backward")}),[T,f,Q])},p=M(t,m);return{useInfiniteQueryState:p,useInfiniteQuerySubscription:i,useInfiniteQuery(u,s){let{refetch:n,fetchNextPage:r,fetchPreviousPage:o}=i(u,s),a=p(u,{selectFromResult:u===b||s?.skip?void 0:Te,...s}),y=re(a,...ie,"hasNextPage","hasPreviousPage");return G(y),R(()=>({...a,fetchNextPage:r,fetchPreviousPage:o,refetch:n}),[a,r,o,n])}}}function Be(t){return({selectFromResult:i,fixedCacheKey:p}={})=>{let{select:u,initiate:s}=e.endpoints[t],n=g(),[r,o]=ne();x(()=>()=>{r?.arg.fixedCacheKey||r?.reset()},[r]);let a=k(function(P){let D=n(s(P,{fixedCacheKey:p}));return o(D),D},[n,s,p]),{requestId:y}=r||{},d=R(()=>u({fixedCacheKey:p,requestId:r?.requestId}),[p,r,u]),S=R(()=>i?C([d],i):d,[i,d]),f=A(S,w),Q=p==null?r?.arg.originalArgs:void 0,T=k(()=>{c(()=>{r&&o(void 0),p&&n(e.internalActions.removeMutationResult({requestId:y,fixedCacheKey:p}))})},[n,p,r,y]),l=re(f,...ie,"endpointName");G(l);let B=R(()=>({...f,originalArgs:Q,reset:T}),[f,Q,T]);return R(()=>[a,B],[a,B])}}}var xe=Symbol(),me=({batch:e=Ce,hooks:c={useDispatch:Ne,useSelector:Le,useStore:He},createSelector:g=ze,unstable__sideEffectsInRender:A=!1,...W}={})=>({name:xe,init(U,{serializeQueryArgs:C},E){let N=U,{buildQueryHooks:O,buildInfiniteQueryHooks:L,buildMutationHook:q,usePrefetch:J}=De({api:U,moduleOptions:{batch:e,hooks:c,unstable__sideEffectsInRender:A,createSelector:g},serializeQueryArgs:C,context:E});return z(N,{usePrefetch:J}),z(E,{batch:e}),{injectEndpoint(m,K){if(Qe(K)){let{useQuery:h,useLazyQuery:M,useLazyQuerySubscription:H,useQueryState:X,useQuerySubscription:ee}=O(m);z(N.endpoints[m],{useQuery:h,useLazyQuery:M,useLazyQuerySubscription:H,useQueryState:X,useQuerySubscription:ee}),U[`use${_(m)}Query`]=h,U[`useLazy${_(m)}Query`]=M}if(ce(K)){let h=q(m);z(N.endpoints[m],{useMutation:h}),U[`use${_(m)}Mutation`]=h}else if($(K)){let{useInfiniteQuery:h,useInfiniteQuerySubscription:M,useInfiniteQueryState:H}=L(m);z(N.endpoints[m],{useInfiniteQuery:h,useInfiniteQuerySubscription:M,useInfiniteQueryState:H}),U[`use${_(m)}InfiniteQuery`]=h}}}}});export*from"@reduxjs/toolkit/query";import{configureStore as qe,formatProdErrorMessage as Ke}from"@reduxjs/toolkit";import*as Y from"react";function Ve(e){let c=e.context||ge;if(de(c))throw new Error(Ke(35));let[A]=Y.useState(()=>qe({reducer:{[e.api.reducerPath]:e.api.reducer},middleware:W=>W().concat(e.api.middleware)}));return x(()=>e.setupListeners===!1?void 0:pe(A.dispatch,e.setupListeners),[e.setupListeners,A.dispatch]),Y.createElement(Re,{store:A,context:c},e.children)}var Ft=ue(ye(),me());export{Ve as ApiProvider,j as UNINITIALIZED_VALUE,Ft as createApi,me as reactHooksModule,xe as reactHooksModuleName};
+//# sourceMappingURL=rtk-query-react.browser.mjs.map
Index: node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.browser.mjs.map
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.browser.mjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.browser.mjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,1 @@
+{"version":3,"sources":["../../../src/query/react/rtkqImports.ts","../../../src/query/react/module.ts","../../../src/query/utils/capitalize.ts","../../../src/query/endpointDefinitions.ts","../../../src/query/tsHelpers.ts","../../../src/query/react/buildHooks.ts","../../../src/query/react/reactImports.ts","../../../src/query/react/reactReduxImports.ts","../../../src/query/react/constants.ts","../../../src/query/react/useSerializedStableValue.ts","../../../src/query/react/useShallowStableValue.ts","../../../src/query/react/index.ts","../../../src/query/react/ApiProvider.tsx"],"sourcesContent":["export { buildCreateApi, coreModule, copyWithStructuralSharing, setupListeners, QueryStatus, skipToken } from '@reduxjs/toolkit/query';","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { Api, BaseQueryFn, EndpointDefinitions, InfiniteQueryDefinition, Module, MutationDefinition, PrefetchOptions, QueryArgFrom, QueryDefinition, QueryKeys } from '@reduxjs/toolkit/query';\nimport { batch as rrBatch, useDispatch as rrUseDispatch, useSelector as rrUseSelector, useStore as rrUseStore } from 'react-redux';\nimport type { CreateSelectorFunction } from 'reselect';\nimport { createSelector as _createSelector } from 'reselect';\nimport { isInfiniteQueryDefinition, isMutationDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { safeAssign } from '../tsHelpers';\nimport { capitalize, countObjectKeys } from '../utils';\nimport type { InfiniteQueryHooks, MutationHooks, QueryHooks } from './buildHooks';\nimport { buildHooks } from './buildHooks';\nimport type { HooksWithUniqueNames } from './namedHooks';\nexport const reactHooksModuleName = /* @__PURE__ */Symbol();\nexport type ReactHooksModule = typeof reactHooksModuleName;\ndeclare module '@reduxjs/toolkit/query' {\n  export interface ApiModules<\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions,\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  ReducerPath extends string,\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  TagTypes extends string> {\n    [reactHooksModuleName]: {\n      /**\n       *  Endpoints based on the input endpoints provided to `createApi`, containing `select`, `hooks` and `action matchers`.\n       */\n      endpoints: { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? QueryHooks<Definitions[K]> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? MutationHooks<Definitions[K]> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryHooks<Definitions[K]> : never };\n      /**\n       * A hook that accepts a string endpoint name, and provides a callback that when called, pre-fetches the data for that endpoint.\n       */\n      usePrefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, options?: PrefetchOptions): (arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions) => void;\n    } & HooksWithUniqueNames<Definitions>;\n  }\n}\ntype RR = typeof import('react-redux');\nexport interface ReactHooksModuleOptions {\n  /**\n   * The hooks from React Redux to be used\n   */\n  hooks?: {\n    /**\n     * The version of the `useDispatch` hook to be used\n     */\n    useDispatch: RR['useDispatch'];\n    /**\n     * The version of the `useSelector` hook to be used\n     */\n    useSelector: RR['useSelector'];\n    /**\n     * The version of the `useStore` hook to be used\n     */\n    useStore: RR['useStore'];\n  };\n  /**\n   * The version of the `batchedUpdates` function to be used\n   */\n  batch?: RR['batch'];\n  /**\n   * Enables performing asynchronous tasks immediately within a render.\n   *\n   * @example\n   *\n   * ```ts\n   * import {\n   *   buildCreateApi,\n   *   coreModule,\n   *   reactHooksModule\n   * } from '@reduxjs/toolkit/query/react'\n   *\n   * const createApi = buildCreateApi(\n   *   coreModule(),\n   *   reactHooksModule({ unstable__sideEffectsInRender: true })\n   * )\n   * ```\n   */\n  unstable__sideEffectsInRender?: boolean;\n  /**\n   * A selector creator (usually from `reselect`, or matching the same signature)\n   */\n  createSelector?: CreateSelectorFunction<any, any, any>;\n}\n\n/**\n * Creates a module that generates react hooks from endpoints, for use with `buildCreateApi`.\n *\n *  @example\n * ```ts\n * const MyContext = React.createContext<ReactReduxContextValue | null>(null);\n * const customCreateApi = buildCreateApi(\n *   coreModule(),\n *   reactHooksModule({\n *     hooks: {\n *       useDispatch: createDispatchHook(MyContext),\n *       useSelector: createSelectorHook(MyContext),\n *       useStore: createStoreHook(MyContext)\n *     }\n *   })\n * );\n * ```\n *\n * @returns A module for use with `buildCreateApi`\n */\nexport const reactHooksModule = ({\n  batch = rrBatch,\n  hooks = {\n    useDispatch: rrUseDispatch,\n    useSelector: rrUseSelector,\n    useStore: rrUseStore\n  },\n  createSelector = _createSelector,\n  unstable__sideEffectsInRender = false,\n  ...rest\n}: ReactHooksModuleOptions = {}): Module<ReactHooksModule> => {\n  if (process.env.NODE_ENV !== 'production') {\n    const hookNames = ['useDispatch', 'useSelector', 'useStore'] as const;\n    let warned = false;\n    for (const hookName of hookNames) {\n      // warn for old hook options\n      if (countObjectKeys(rest) > 0) {\n        if ((rest as Partial<typeof hooks>)[hookName]) {\n          if (!warned) {\n            console.warn('As of RTK 2.0, the hooks now need to be specified as one object, provided under a `hooks` key:' + '\\n`reactHooksModule({ hooks: { useDispatch, useSelector, useStore } })`');\n            warned = true;\n          }\n        }\n        // migrate\n        // @ts-ignore\n        hooks[hookName] = rest[hookName];\n      }\n      // then make sure we have them all\n      if (typeof hooks[hookName] !== 'function') {\n        throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(36) : `When using custom hooks for context, all ${hookNames.length} hooks need to be provided: ${hookNames.join(', ')}.\\nHook ${hookName} was either not provided or not a function.`);\n      }\n    }\n  }\n  return {\n    name: reactHooksModuleName,\n    init(api, {\n      serializeQueryArgs\n    }, context) {\n      const anyApi = api as any as Api<any, Record<string, any>, any, any, ReactHooksModule>;\n      const {\n        buildQueryHooks,\n        buildInfiniteQueryHooks,\n        buildMutationHook,\n        usePrefetch\n      } = buildHooks({\n        api,\n        moduleOptions: {\n          batch,\n          hooks,\n          unstable__sideEffectsInRender,\n          createSelector\n        },\n        serializeQueryArgs,\n        context\n      });\n      safeAssign(anyApi, {\n        usePrefetch\n      });\n      safeAssign(context, {\n        batch\n      });\n      return {\n        injectEndpoint(endpointName, definition) {\n          if (isQueryDefinition(definition)) {\n            const {\n              useQuery,\n              useLazyQuery,\n              useLazyQuerySubscription,\n              useQueryState,\n              useQuerySubscription\n            } = buildQueryHooks(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useQuery,\n              useLazyQuery,\n              useLazyQuerySubscription,\n              useQueryState,\n              useQuerySubscription\n            });\n            (api as any)[`use${capitalize(endpointName)}Query`] = useQuery;\n            (api as any)[`useLazy${capitalize(endpointName)}Query`] = useLazyQuery;\n          }\n          if (isMutationDefinition(definition)) {\n            const useMutation = buildMutationHook(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useMutation\n            });\n            (api as any)[`use${capitalize(endpointName)}Mutation`] = useMutation;\n          } else if (isInfiniteQueryDefinition(definition)) {\n            const {\n              useInfiniteQuery,\n              useInfiniteQuerySubscription,\n              useInfiniteQueryState\n            } = buildInfiniteQueryHooks(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useInfiniteQuery,\n              useInfiniteQuerySubscription,\n              useInfiniteQueryState\n            });\n            (api as any)[`use${capitalize(endpointName)}InfiniteQuery`] = useInfiniteQuery;\n          }\n        }\n      };\n    }\n  };\n};","export function capitalize(str: string) {\n  return str.replace(str[0], str[0].toUpperCase());\n}","import type { Api } from '@reduxjs/toolkit/query';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { BaseQueryApi, BaseQueryArg, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta, BaseQueryResult, QueryReturnValue } from './baseQueryTypes';\nimport type { CacheCollectionQueryExtraOptions } from './core/buildMiddleware/cacheCollection';\nimport type { CacheLifecycleInfiniteQueryExtraOptions, CacheLifecycleMutationExtraOptions, CacheLifecycleQueryExtraOptions } from './core/buildMiddleware/cacheLifecycle';\nimport type { QueryLifecycleInfiniteQueryExtraOptions, QueryLifecycleMutationExtraOptions, QueryLifecycleQueryExtraOptions } from './core/buildMiddleware/queryLifecycle';\nimport type { InfiniteData, InfiniteQueryConfigOptions, QuerySubState, RootState } from './core/index';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { NEVER } from './fakeBaseQuery';\nimport type { CastAny, HasRequiredProps, MaybePromise, NonUndefined, OmitFromUnion, UnwrapPromise } from './tsHelpers';\nimport { isNotNullish } from './utils';\nimport type { NamedSchemaError } from './standardSchema';\nimport { filterMap } from './utils/filterMap';\nconst rawResultType = /* @__PURE__ */Symbol();\nconst resultType = /* @__PURE__ */Symbol();\nconst baseQuery = /* @__PURE__ */Symbol();\nexport interface SchemaFailureInfo {\n  endpoint: string;\n  arg: any;\n  type: 'query' | 'mutation';\n  queryCacheKey?: string;\n}\nexport type SchemaFailureHandler = (error: NamedSchemaError, info: SchemaFailureInfo) => void;\nexport type SchemaFailureConverter<BaseQuery extends BaseQueryFn> = (error: NamedSchemaError, info: SchemaFailureInfo) => BaseQueryError<BaseQuery>;\nexport type EndpointDefinitionWithQuery<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery>> = {\n  /**\n   * `query` can be a function that returns either a `string` or an `object` which is passed to your `baseQuery`. If you are using [fetchBaseQuery](./fetchBaseQuery), this can return either a `string` or an `object` of properties in `FetchArgs`. If you use your own custom [`baseQuery`](../../rtk-query/usage/customizing-queries), you can customize this behavior to your liking.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"query example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       // highlight-start\n   *       query: () => 'posts',\n   *       // highlight-end\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *      // highlight-start\n   *      query: (body) => ({\n   *        url: `posts`,\n   *        method: 'POST',\n   *        body,\n   *      }),\n   *      // highlight-end\n   *      invalidatesTags: [{ type: 'Post', id: 'LIST' }],\n   *    }),\n   *   })\n   * })\n   * ```\n   */\n  query(arg: QueryArg): BaseQueryArg<BaseQuery>;\n  queryFn?: never;\n  /**\n   * A function to manipulate the data returned by a query or mutation.\n   */\n  transformResponse?(baseQueryReturnValue: RawResultType, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): ResultType | Promise<ResultType>;\n  /**\n   * A function to manipulate the data returned by a failed query or mutation.\n   */\n  transformErrorResponse?(baseQueryReturnValue: BaseQueryError<BaseQuery>, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): unknown;\n\n  /**\n   * A schema for the result *before* it's passed to `transformResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPostName: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawResponseSchema: postSchema,\n   *       transformResponse: (post) => post.name,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawResponseSchema?: StandardSchemaV1<RawResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn`, *before* it's passed to `transformErrorResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import {customBaseQuery, baseQueryErrorSchema} from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawErrorResponseSchema: baseQueryErrorSchema,\n   *       transformErrorResponse: (error) => error.data,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawErrorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n};\nexport type EndpointDefinitionWithQueryFn<QueryArg, BaseQuery extends BaseQueryFn, ResultType> = {\n  /**\n   * Can be used in place of `query` as an inline function that bypasses `baseQuery` completely for the endpoint.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Basic queryFn example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *     }),\n   *     flipCoin: build.query<'heads' | 'tails', void>({\n   *       // highlight-start\n   *       queryFn(arg, queryApi, extraOptions, baseQuery) {\n   *         const randomVal = Math.random()\n   *         if (randomVal < 0.45) {\n   *           return { data: 'heads' }\n   *         }\n   *         if (randomVal < 0.9) {\n   *           return { data: 'tails' }\n   *         }\n   *         return { error: { status: 500, statusText: 'Internal Server Error', data: \"Coin landed on its edge!\" } }\n   *       }\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  queryFn(arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions<BaseQuery>, baseQuery: (arg: Parameters<BaseQuery>[0]) => ReturnType<BaseQuery>): MaybePromise<QueryReturnValue<ResultType, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>>;\n  query?: never;\n  transformResponse?: never;\n  transformErrorResponse?: never;\n  rawResponseSchema?: never;\n  rawErrorResponseSchema?: never;\n};\ntype BaseEndpointTypes<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType> = {\n  QueryArg: QueryArg;\n  BaseQuery: BaseQuery;\n  ResultType: ResultType;\n  RawResultType: RawResultType;\n};\nexport type SchemaType = 'arg' | 'rawResponse' | 'response' | 'rawErrorResponse' | 'errorResponse' | 'meta';\ninterface CommonEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType> {\n  /**\n   * A schema for the arguments to be passed to the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       argSchema: v.object({ id: v.number() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  argSchema?: StandardSchemaV1<QueryArg>;\n\n  /**\n   * A schema for the result (including `transformResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: postSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  responseSchema?: StandardSchemaV1<ResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn` (including `transformErrorResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryErrorSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       errorResponseSchema: baseQueryErrorSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  errorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n\n  /**\n   * A schema for the `meta` property returned by the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryMetaSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       metaSchema: baseQueryMetaSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  metaSchema?: StandardSchemaV1<BaseQueryMeta<BaseQuery>>;\n\n  /**\n   * Defaults to `true`.\n   *\n   * Most apps should leave this setting on. The only time it can be a performance issue\n   * is if an API returns extremely large amounts of data (e.g. 10,000 rows per request) and\n   * you're unable to paginate it.\n   *\n   * For details of how this works, please see the below. When it is set to `false`,\n   * every request will cause subscribed components to rerender, even when the data has not changed.\n   *\n   * @see https://redux-toolkit.js.org/api/other-exports#copywithstructuralsharing\n   */\n  structuralSharing?: boolean;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       onSchemaFailure: (error, info) => {\n   *         console.error(error, info)\n   *       },\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       catchSchemaFailure: (error, info) => ({\n   *         status: \"CUSTOM_ERROR\",\n   *         error: error.schemaName + \" failed validation\",\n   *         data: error.issues,\n   *       }),\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for this endpoint.\n   * Overrides the global setting.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type BaseEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = (([CastAny<BaseQueryResult<BaseQuery>, {}>] extends [NEVER] ? never : EndpointDefinitionWithQuery<QueryArg, BaseQuery, ResultType, RawResultType>) | EndpointDefinitionWithQueryFn<QueryArg, BaseQuery, ResultType>) & CommonEndpointDefinition<QueryArg, BaseQuery, ResultType> & {\n  /* phantom type */\n  [rawResultType]?: RawResultType;\n  /* phantom type */\n  [resultType]?: ResultType;\n  /* phantom type */\n  [baseQuery]?: BaseQuery;\n} & HasRequiredProps<BaseQueryExtraOptions<BaseQuery>, {\n  extraOptions: BaseQueryExtraOptions<BaseQuery>;\n}, {\n  extraOptions?: BaseQueryExtraOptions<BaseQuery>;\n}>;\n\n// NOTE As with QueryStatus in `apiState.ts`, don't use this for real comparisons\n// at runtime, use the string constants defined below.\nexport enum DefinitionType {\n  query = 'query',\n  mutation = 'mutation',\n  infinitequery = 'infinitequery',\n}\nexport const ENDPOINT_QUERY = DefinitionType.query;\nexport const ENDPOINT_MUTATION = DefinitionType.mutation;\nexport const ENDPOINT_INFINITEQUERY = DefinitionType.infinitequery;\ntype TagDescriptionArray<TagTypes extends string> = ReadonlyArray<TagDescription<TagTypes> | undefined | null>;\nexport type GetResultDescriptionFn<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = (result: ResultType | undefined, error: ErrorType | undefined, arg: QueryArg, meta: MetaType) => TagDescriptionArray<TagTypes>;\nexport type FullTagDescription<TagType> = {\n  type: TagType;\n  id?: number | string;\n};\nexport type TagDescription<TagType> = TagType | FullTagDescription<TagType>;\n\n/**\n * @public\n */\nexport type ResultDescription<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = TagDescriptionArray<TagTypes> | GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>;\ntype QueryTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  QueryDefinition: QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface QueryExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.query;\n\n  /**\n   * Used by `query` endpoints. Determines which 'tag' is attached to the cached data returned by the query.\n   * Expects an array of tag type strings, an array of objects of tag types with ids, or a function that returns such an array.\n   * 1.  `['Post']` - equivalent to `2`\n   * 2.  `[{ type: 'Post' }]` - equivalent to `1`\n   * 3.  `[{ type: 'Post', id: 1 }]`\n   * 4.  `(result, error, arg) => ['Post']` - equivalent to `5`\n   * 5.  `(result, error, arg) => [{ type: 'Post' }]` - equivalent to `4`\n   * 6.  `(result, error, arg) => [{ type: 'Post', id: 1 }]`\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"providesTags example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       // highlight-start\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  providesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * Can be provided to merge an incoming response value into the current cache data.\n   * If supplied, no automatic structural sharing will be applied - it's up to\n   * you to update the cache appropriately.\n   *\n   * Since RTKQ normally replaces cache entries with the new response, you will usually\n   * need to use this with the `serializeQueryArgs` or `forceRefetch` options to keep\n   * an existing cache entry so that it can be updated.\n   *\n   * Since this is wrapped with Immer, you may either mutate the `currentCacheValue` directly,\n   * or return a new value, but _not_ both at once.\n   *\n   * Will only be called if the existing `currentCacheData` is _not_ `undefined` - on first response,\n   * the cache entry will just save the response data directly.\n   *\n   * Useful if you don't want a new request to completely override the current cache value,\n   * maybe because you have manually updated it from another source and don't want those\n   * updates to get lost.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"merge: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  merge?(currentCacheData: ResultType, responseData: ResultType, otherArgs: {\n    arg: QueryArg;\n    baseQueryMeta: BaseQueryMeta<BaseQuery>;\n    requestId: string;\n    fulfilledTimeStamp: number;\n  }): ResultType | void;\n\n  /**\n   * Check to see if the endpoint should force a refetch in cases where it normally wouldn't.\n   * This is primarily useful for \"infinite scroll\" / pagination use cases where\n   * RTKQ is keeping a single cache entry that is added to over time, in combination\n   * with `serializeQueryArgs` returning a fixed cache key and a `merge` callback\n   * set to add incoming data to the cache entry each time.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"forceRefresh: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  forceRefetch?(params: {\n    currentArg: QueryArg | undefined;\n    previousArg: QueryArg | undefined;\n    state: RootState<any, any, string>;\n    endpointState?: QuerySubState<any>;\n  }): boolean;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: QueryTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type QueryDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & QueryExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type InfiniteQueryTypes<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  InfiniteQueryDefinition: InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\nexport interface InfiniteQueryExtraOptions<TagTypes extends string, ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.infinitequery;\n  providesTags?: ResultDescription<TagTypes, InfiniteData<ResultType, PageParam>, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Required options to configure the infinite query behavior.\n   * `initialPageParam` and `getNextPageParam` are required, to\n   * ensure the infinite query can properly fetch the next page of data.\n   * `initialPageParam` may be specified when using the\n   * endpoint, to override the default value.\n   * `maxPages` and `getPreviousPageParam` are both optional.\n   * \n   * @example\n   * \n   * ```ts\n   * // codeblock-meta title=\"infiniteQueryOptions example\"\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * \n   * type Pokemon = {\n   *   id: string\n   *   name: string\n   * }\n   * \n   * const pokemonApi = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),\n   *   endpoints: (build) => ({\n   *     getInfinitePokemonWithMax: build.infiniteQuery<Pokemon[], string, number>({\n   *       infiniteQueryOptions: {\n   *         initialPageParam: 0,\n   *         maxPages: 3,\n   *         getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) =>\n   *           lastPageParam + 1,\n   *         getPreviousPageParam: (\n   *           firstPage,\n   *           allPages,\n   *           firstPageParam,\n   *           allPageParams,\n   *         ) => {\n   *           return firstPageParam > 0 ? firstPageParam - 1 : undefined\n   *         },\n   *       },\n   *       query({pageParam}) {\n   *         return `https://example.com/listItems?page=${pageParam}`\n   *       },\n   *     }),\n   *   }),\n   * })\n   \n   * ```\n   */\n  infiniteQueryOptions: InfiniteQueryConfigOptions<ResultType, PageParam, QueryArg>;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: InfiniteQueryTypes<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> =\n// Infinite query endpoints receive `{queryArg, pageParam}`\nBaseEndpointDefinition<InfiniteQueryCombinedArg<QueryArg, PageParam>, BaseQuery, ResultType, RawResultType> & InfiniteQueryExtraOptions<TagTypes, ResultType, QueryArg, PageParam, BaseQuery, ReducerPath, RawResultType>;\ntype MutationTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseMutation<typeof api.endpoints.query.Types.MutationDefinition> = ...\n   * ```\n   */\n  MutationDefinition: MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface MutationExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath> {\n  type: DefinitionType.mutation;\n\n  /**\n   * Used by `mutation` endpoints. Determines which cached data should be either re-fetched or removed from the cache.\n   * Expects the same shapes as `providesTags`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"invalidatesTags example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *       query(body) {\n   *         return {\n   *           url: `posts`,\n   *           method: 'POST',\n   *           body,\n   *         }\n   *       },\n   *       // highlight-start\n   *       invalidatesTags: [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  invalidatesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A mutation should not provide tags to the cache.\n   */\n  providesTags?: never;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: MutationTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type MutationDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & MutationExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type EndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, PageParam = any, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\nexport type EndpointDefinitions = Record<string, EndpointDefinition<any, any, any, any, any, any, any>>;\nexport function isQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is QueryDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_QUERY;\n}\nexport function isMutationDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is MutationDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_MUTATION;\n}\nexport function isInfiniteQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is InfiniteQueryDefinition<any, any, any, any, any, any, any> {\n  return e.type === ENDPOINT_INFINITEQUERY;\n}\nexport function isAnyQueryDefinition(e: EndpointDefinition<any, any, any, any>): e is QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any> {\n  return isQueryDefinition(e) || isInfiniteQueryDefinition(e);\n}\nexport type EndpointBuilder<BaseQuery extends BaseQueryFn, TagTypes extends string, ReducerPath extends string> = {\n  /**\n   * An endpoint definition that retrieves data, and may provide tags to the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all query endpoint options\"\n   * const api = createApi({\n   *  baseQuery,\n   *  endpoints: (build) => ({\n   *    getPost: build.query({\n   *      query: (id) => ({ url: `post/${id}` }),\n   *      // Pick out data and prevent nested properties in a hook or selector\n   *      transformResponse: (response) => response.data,\n   *      // Pick out error and prevent nested properties in a hook or selector\n   *      transformErrorResponse: (response) => response.error,\n   *      // `result` is the server response\n   *      providesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry, updateCachedData }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry, updateCachedData }) {},\n   *    }),\n   *  }),\n   *});\n   *```\n   */\n  query<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n\n  /**\n   * An endpoint definition that alters data on the server or will possibly invalidate the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all mutation endpoint options\"\n   * const api = createApi({\n   *   baseQuery,\n   *   endpoints: (build) => ({\n   *     updatePost: build.mutation({\n   *       query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),\n   *       // Pick out data and prevent nested properties in a hook or selector\n   *       transformResponse: (response) => response.data,\n   *       // Pick out error and prevent nested properties in a hook or selector\n   *       transformErrorResponse: (response) => response.error,\n   *       // `result` is the server response\n   *       invalidatesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry }) {},\n   *     }),\n   *   }),\n   * });\n   * ```\n   */\n  mutation<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n  infiniteQuery<ResultType, QueryArg, PageParam, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n};\nexport type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T;\nexport function calculateProvidedBy<ResultType, QueryArg, ErrorType, MetaType>(description: ResultDescription<string, ResultType, QueryArg, ErrorType, MetaType> | undefined, result: ResultType | undefined, error: ErrorType | undefined, queryArg: QueryArg, meta: MetaType | undefined, assertTagTypes: AssertTagTypes): readonly FullTagDescription<string>[] {\n  const finalDescription = isFunction(description) ? description(result as ResultType, error as undefined, queryArg, meta as MetaType) : description;\n  if (finalDescription) {\n    return filterMap(finalDescription, isNotNullish, tag => assertTagTypes(expandTagDescription(tag)));\n  }\n  return [];\n}\nfunction isFunction<T>(t: T): t is Extract<T, Function> {\n  return typeof t === 'function';\n}\nexport function expandTagDescription(description: TagDescription<string>): FullTagDescription<string> {\n  return typeof description === 'string' ? {\n    type: description\n  } : description;\n}\nexport type QueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<infer QA, any, any, any> ? QA : never;\n\n// Just extracting `QueryArg` from `BaseEndpointDefinition`\n// doesn't sufficiently match here.\n// We need to explicitly match against `InfiniteQueryDefinition`\nexport type InfiniteQueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<infer QA, any, any, any, any, any, any> ? QA : never;\nexport type QueryArgFromAnyQuery<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any, any, any> ? InfiniteQueryArgFrom<D> : D extends QueryDefinition<any, any, any, any, any, any> ? QueryArgFrom<D> : never;\nexport type ResultTypeFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<any, any, infer RT, any> ? RT : unknown;\nexport type ReducerPathFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, any, any, infer RP, any, any> ? RP : unknown;\nexport type TagTypesFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, infer TT, any, any, any, any> ? TT : unknown;\nexport type PageParamFrom<D extends InfiniteQueryDefinition<any, any, any, any, any, any, any>> = D extends InfiniteQueryDefinition<any, infer PP, any, any, any, any, any> ? PP : unknown;\nexport type InfiniteQueryCombinedArg<QueryArg, PageParam> = {\n  queryArg: QueryArg;\n  pageParam: PageParam;\n};\nexport type TagTypesFromApi<T> = T extends Api<any, any, any, infer TagTypes> ? TagTypes : never;\nexport type DefinitionsFromApi<T> = T extends Api<any, infer Definitions, any, any> ? Definitions : never;\nexport type TransformedResponse<NewDefinitions extends EndpointDefinitions, K, ResultType> = K extends keyof NewDefinitions ? NewDefinitions[K]['transformResponse'] extends undefined ? ResultType : UnwrapPromise<ReturnType<NonUndefined<NewDefinitions[K]['transformResponse']>>> : ResultType;\nexport type OverrideResultType<Definition, NewResultType> = Definition extends QueryDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends MutationDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, NewResultType, ReducerPath> : never;\nexport type UpdateDefinitions<Definitions extends EndpointDefinitions, NewTagTypes extends string, NewDefinitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends MutationDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : never };","export type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type Override<T1, T2> = T2 extends any ? Omit<T1, keyof T2> & T2 : never;\nexport function assertCast<T>(v: any): asserts v is T {}\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>): T {\n  return Object.assign(target, ...args);\n}\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\nexport type NonOptionalKeys<T> = { [K in keyof T]-?: undefined extends T[K] ? never : K }[keyof T];\nexport type HasRequiredProps<T, True, False> = NonOptionalKeys<T> extends never ? False : True;\nexport type OptionalIfAllPropsOptional<T> = HasRequiredProps<T, T, T | never>;\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type UnwrapPromise<T> = T extends PromiseLike<infer V> ? V : T;\nexport type MaybePromise<T> = T | PromiseLike<T>;\nexport type OmitFromUnion<T, K extends keyof T> = T extends any ? Omit<T, K> : never;\nexport type IsAny<T, True, False = never> = true | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;","import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3 } from \"@reduxjs/toolkit\";\nimport type { Selector, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { Api, ApiContext, ApiEndpointInfiniteQuery, ApiEndpointMutation, ApiEndpointQuery, BaseQueryFn, CoreModule, EndpointDefinitions, InfiniteQueryActionCreatorResult, InfiniteQueryArgFrom, InfiniteQueryDefinition, InfiniteQueryResultSelectorResult, InfiniteQuerySubState, MutationActionCreatorResult, MutationDefinition, MutationResultSelectorResult, PageParamFrom, PrefetchOptions, QueryActionCreatorResult, QueryArgFrom, QueryCacheKey, QueryDefinition, QueryKeys, QueryResultSelectorResult, QuerySubState, ResultTypeFrom, RootState, SerializeQueryArgs, SkipToken, SubscriptionOptions, TSHelpersId, TSHelpersNoInfer, TSHelpersOverride } from '@reduxjs/toolkit/query';\nimport { QueryStatus, skipToken } from './rtkqImports';\nimport type { DependencyList } from 'react';\nimport { useCallback, useDebugValue, useEffect, useLayoutEffect, useMemo, useRef, useState } from './reactImports';\nimport { shallowEqual } from './reactReduxImports';\nimport type { SubscriptionSelectors } from '../core/buildMiddleware/index';\nimport type { InfiniteData, InfiniteQueryConfigOptions } from '../core/index';\nimport type { UninitializedValue } from './constants';\nimport { UNINITIALIZED_VALUE } from './constants';\nimport type { ReactHooksModuleOptions } from './module';\nimport { useStableQueryArgs } from './useSerializedStableValue';\nimport { useShallowStableValue } from './useShallowStableValue';\nimport type { InfiniteQueryDirection } from '../core/apiState';\nimport { isInfiniteQueryDefinition } from '../endpointDefinitions';\nimport type { StartInfiniteQueryActionCreator } from '../core/buildInitiate';\n\n// Copy-pasted from React-Redux\nconst canUseDOM = () => !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\nconst isDOM = /* @__PURE__ */canUseDOM();\n\n// Under React Native, we know that we always want to use useLayoutEffect\n\nconst isRunningInReactNative = () => typeof navigator !== 'undefined' && navigator.product === 'ReactNative';\nconst isReactNative = /* @__PURE__ */isRunningInReactNative();\nconst getUseIsomorphicLayoutEffect = () => isDOM || isReactNative ? useLayoutEffect : useEffect;\nexport const useIsomorphicLayoutEffect = /* @__PURE__ */getUseIsomorphicLayoutEffect();\nexport type QueryHooks<Definition extends QueryDefinition<any, any, any, any, any>> = {\n  useQuery: UseQuery<Definition>;\n  useLazyQuery: UseLazyQuery<Definition>;\n  useQuerySubscription: UseQuerySubscription<Definition>;\n  useLazyQuerySubscription: UseLazyQuerySubscription<Definition>;\n  useQueryState: UseQueryState<Definition>;\n};\nexport type InfiniteQueryHooks<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  useInfiniteQuery: UseInfiniteQuery<Definition>;\n  useInfiniteQuerySubscription: UseInfiniteQuerySubscription<Definition>;\n  useInfiniteQueryState: UseInfiniteQueryState<Definition>;\n};\nexport type MutationHooks<Definition extends MutationDefinition<any, any, any, any, any>> = {\n  useMutation: UseMutation<Definition>;\n};\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.\n *\n * This hook combines the functionality of both [`useQueryState`](#usequerystate) and [`useQuerySubscription`](#usequerysubscription) together, and is intended to be used in the majority of situations.\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseQuery<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(arg: QueryArgFrom<D> | SkipToken, options?: UseQuerySubscriptionOptions & UseQueryStateOptions<D, R>) => UseQueryHookResult<D, R>;\nexport type TypedUseQuery<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuery<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseQueryHookResult<D extends QueryDefinition<any, any, any, any>, R = UseQueryStateDefaultResult<D>> = UseQueryStateResult<D, R> & UseQuerySubscriptionResult<D>;\n\n/**\n * Helper type to manually type the result\n * of the `useQuery` hook in userland code.\n */\nexport type TypedUseQueryHookResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = TypedUseQueryStateResult<ResultType, QueryArg, BaseQuery, R> & TypedUseQuerySubscriptionResult<ResultType, QueryArg, BaseQuery>;\nexport type UseQuerySubscriptionOptions = SubscriptionOptions & {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When `skip` is true (or `skipToken` is passed in as `arg`):\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```tsx\n   * // codeblock-meta no-transpile title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n};\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useQuery`](#usequery) or [`useQueryState`](#usequerystate).\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n */\nexport type UseQuerySubscription<D extends QueryDefinition<any, any, any, any>> = (arg: QueryArgFrom<D> | SkipToken, options?: UseQuerySubscriptionOptions) => UseQuerySubscriptionResult<D>;\nexport type TypedUseQuerySubscription<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuerySubscription<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseQuerySubscriptionResult<D extends QueryDefinition<any, any, any, any>> = Pick<QueryActionCreatorResult<D>, 'refetch'>;\n\n/**\n * Helper type to manually type the result\n * of the `useQuerySubscription` hook in userland code.\n */\nexport type TypedUseQuerySubscriptionResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuerySubscriptionResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseLazyQueryLastPromiseInfo<D extends QueryDefinition<any, any, any, any>> = {\n  lastArg: QueryArgFrom<D>;\n};\n\n/**\n * A React hook similar to [`useQuery`](#usequery), but with manual control over when the data fetching occurs.\n *\n * This hook includes the functionality of [`useLazyQuerySubscription`](#uselazyquerysubscription).\n *\n * #### Features\n *\n * - Manual control over firing a request to retrieve data\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once\n *\n * #### Note\n *\n * When the trigger function returned from a LazyQuery is called, it always initiates a new request to the server even if there is cached data. Set `preferCacheValue`(the second argument to the function) as `true` if you want it to immediately return a cached value if one exists.\n */\nexport type UseLazyQuery<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(options?: SubscriptionOptions & Omit<UseQueryStateOptions<D, R>, 'skip'>) => [LazyQueryTrigger<D>, UseLazyQueryStateResult<D, R>, UseLazyQueryLastPromiseInfo<D>];\nexport type TypedUseLazyQuery<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseLazyQuery<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseLazyQueryStateResult<D extends QueryDefinition<any, any, any, any>, R = UseQueryStateDefaultResult<D>> = UseQueryStateResult<D, R> & {\n  /**\n   * Resets the hook state to its initial `uninitialized` state.\n   * This will also remove the last result from the cache.\n   */\n  reset: () => void;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useLazyQuery` hook in userland code.\n */\nexport type TypedUseLazyQueryStateResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseLazyQueryStateResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>, R>;\nexport type LazyQueryTrigger<D extends QueryDefinition<any, any, any, any>> = {\n  /**\n   * Triggers a lazy query.\n   *\n   * By default, this will start a new request even if there is already a value in the cache.\n   * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a lazy query, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await getUserById(1).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>, preferCacheValue?: boolean): QueryActionCreatorResult<D>;\n};\nexport type TypedLazyQueryTrigger<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = LazyQueryTrigger<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook similar to [`useQuerySubscription`](#usequerysubscription), but with manual control over when the data fetching occurs.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useLazyQuery`](#uselazyquery).\n *\n * #### Features\n *\n * - Manual control over firing a request to retrieve data\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once\n */\nexport type UseLazyQuerySubscription<D extends QueryDefinition<any, any, any, any>> = (options?: SubscriptionOptions) => readonly [LazyQueryTrigger<D>, QueryArgFrom<D> | UninitializedValue, {\n  reset: () => void;\n}];\nexport type TypedUseLazyQuerySubscription<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseLazyQuerySubscription<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * @internal\n */\nexport type QueryStateSelector<R extends Record<string, any>, D extends QueryDefinition<any, any, any, any>> = (state: UseQueryStateDefaultResult<D>) => R;\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryStateSelector} for use with a specific query.\n * This is useful for scenarios where you want to create a \"pre-typed\"\n * {@linkcode UseQueryStateOptions.selectFromResult | selectFromResult}\n * function.\n *\n * @example\n * <caption>#### __Create a strongly-typed `selectFromResult` selector function__</caption>\n *\n * ```tsx\n * import type { TypedQueryStateSelector } from '@reduxjs/toolkit/query/react'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n *\n * type Post = {\n *   id: number\n *   title: string\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = number | undefined\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * type SelectedResult = Pick<PostsApiResponse, 'posts'>\n *\n * const postsApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com/posts' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, QueryArgument>({\n *       query: (limit = 5) => `?limit=${limit}&select=title`,\n *     }),\n *   }),\n * })\n *\n * const { useGetPostsQuery } = postsApiSlice\n *\n * function PostById({ id }: { id: number }) {\n *   const { post } = useGetPostsQuery(undefined, {\n *     selectFromResult: (state) => ({\n *       post: state.data?.posts.find((post) => post.id === id),\n *     }),\n *   })\n *\n *   return <li>{post?.title}</li>\n * }\n *\n * const EMPTY_ARRAY: Post[] = []\n *\n * const typedSelectFromResult: TypedQueryStateSelector<\n *   PostsApiResponse,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   SelectedResult\n * > = (state) => ({ posts: state.data?.posts ?? EMPTY_ARRAY })\n *\n * function PostsList() {\n *   const { posts } = useGetPostsQuery(undefined, {\n *     selectFromResult: typedSelectFromResult,\n *   })\n *\n *   return (\n *     <div>\n *       <ul>\n *         {posts.map((post) => (\n *           <PostById key={post.id} id={post.id} />\n *         ))}\n *       </ul>\n *     </div>\n *   )\n * }\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template SelectedResultType - The type of the selected result returned by the __`selectFromResult`__ function.\n *\n * @since 2.3.0\n * @public\n */\nexport type TypedQueryStateSelector<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, SelectedResultType extends Record<string, any> = UseQueryStateDefaultResult<QueryDefinition<QueryArgumentType, BaseQueryFunctionType, string, ResultType, string>>> = QueryStateSelector<SelectedResultType, QueryDefinition<QueryArgumentType, BaseQueryFunctionType, string, ResultType, string>>;\n\n/**\n * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * Note that this hook does not trigger fetching new data. For that use-case, see [`useQuery`](#usequery) or [`useQuerySubscription`](#usequerysubscription).\n *\n * #### Features\n *\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseQueryState<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(arg: QueryArgFrom<D> | SkipToken, options?: UseQueryStateOptions<D, R>) => UseQueryStateResult<D, R>;\nexport type TypedUseQueryState<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQueryState<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * @internal\n */\nexport type UseQueryStateOptions<D extends QueryDefinition<any, any, any, any>, R extends Record<string, any>> = {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When skip is true:\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after skipping the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.\n   * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.\n   * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using selectFromResult to extract a single result\"\n   * function PostsList() {\n   *   const { data: posts } = api.useGetPostsQuery();\n   *\n   *   return (\n   *     <ul>\n   *       {posts?.data?.map((post) => (\n   *         <PostById key={post.id} id={post.id} />\n   *       ))}\n   *     </ul>\n   *   );\n   * }\n   *\n   * function PostById({ id }: { id: number }) {\n   *   // Will select the post with the given id, and will only rerender if the given posts data changes\n   *   const { post } = api.useGetPostsQuery(undefined, {\n   *     selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),\n   *   });\n   *\n   *   return <li>{post?.name}</li>;\n   * }\n   * ```\n   */\n  selectFromResult?: QueryStateSelector<R, D>;\n};\n\n/**\n * Provides a way to define a \"pre-typed\" version of\n * {@linkcode UseQueryStateOptions} with specific options for a given query.\n * This is particularly useful for setting default query behaviors such as\n * refetching strategies, which can be overridden as needed.\n *\n * @example\n * <caption>#### __Create a `useQuery` hook with default options__</caption>\n *\n * ```ts\n * import type {\n *   SubscriptionOptions,\n *   TypedUseQueryStateOptions,\n * } from '@reduxjs/toolkit/query/react'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n *\n * type Post = {\n *   id: number\n *   name: string\n * }\n *\n * const api = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n *   tagTypes: ['Post'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<Post[], void>({\n *       query: () => 'posts',\n *     }),\n *   }),\n * })\n *\n * const { useGetPostsQuery } = api\n *\n * export const useGetPostsQueryWithDefaults = <\n *   SelectedResult extends Record<string, any>,\n * >(\n *   overrideOptions: TypedUseQueryStateOptions<\n *     Post[],\n *     void,\n *     ReturnType<typeof fetchBaseQuery>,\n *     SelectedResult\n *   > &\n *     SubscriptionOptions,\n * ) =>\n *   useGetPostsQuery(undefined, {\n *     // Insert default options here\n *\n *     refetchOnMountOrArgChange: true,\n *     refetchOnFocus: true,\n *     ...overrideOptions,\n *   })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArg - The type of the argument passed into the query.\n * @template BaseQuery - The type of the base query function being used.\n * @template SelectedResult - The type of the selected result returned by the __`selectFromResult`__ function.\n *\n * @since 2.2.8\n * @public\n */\nexport type TypedUseQueryStateOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseQueryStateOptions<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>, SelectedResult>;\nexport type UseQueryStateResult<_ extends QueryDefinition<any, any, any, any>, R> = TSHelpersNoInfer<R>;\n\n/**\n * Helper type to manually type the result\n * of the `useQueryState` hook in userland code.\n */\nexport type TypedUseQueryStateResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = TSHelpersNoInfer<R>;\ntype UseQueryStateBaseResult<D extends QueryDefinition<any, any, any, any>> = QuerySubState<D> & {\n  /**\n   * Where `data` tries to hold data as much as possible, also re-using\n   * data from the last arguments passed into the hook, this property\n   * will always contain the received data from the query, for the current query arguments.\n   */\n  currentData?: ResultTypeFrom<D>;\n  /**\n   * Query has not started yet.\n   */\n  isUninitialized: false;\n  /**\n   * Query is currently loading for the first time. No data yet.\n   */\n  isLoading: false;\n  /**\n   * Query is currently fetching, but might have data from an earlier request.\n   */\n  isFetching: false;\n  /**\n   * Query has data from a successful load.\n   */\n  isSuccess: false;\n  /**\n   * Query is currently in \"error\" state.\n   */\n  isError: false;\n};\ntype UseQueryStateUninitialized<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<Extract<UseQueryStateBaseResult<D>, {\n  status: QueryStatus.uninitialized;\n}>, {\n  isUninitialized: true;\n}>;\ntype UseQueryStateLoading<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isLoading: true;\n  isFetching: boolean;\n  data: undefined;\n}>;\ntype UseQueryStateSuccessFetching<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isSuccess: true;\n  isFetching: true;\n  error: undefined;\n} & {\n  data: ResultTypeFrom<D>;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'fulfilledTimeStamp'>>>;\ntype UseQueryStateSuccessNotFetching<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isSuccess: true;\n  isFetching: false;\n  error: undefined;\n} & {\n  data: ResultTypeFrom<D>;\n  currentData: ResultTypeFrom<D>;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'fulfilledTimeStamp'>>>;\ntype UseQueryStateError<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isError: true;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'error'>>>;\ntype UseQueryStateDefaultResult<D extends QueryDefinition<any, any, any, any>> = TSHelpersId<UseQueryStateUninitialized<D> | UseQueryStateLoading<D> | UseQueryStateSuccessFetching<D> | UseQueryStateSuccessNotFetching<D> | UseQueryStateError<D>> & {\n  /**\n   * @deprecated Included for completeness, but discouraged.\n   * Please use the `isLoading`, `isFetching`, `isSuccess`, `isError`\n   * and `isUninitialized` flags instead\n   */\n  status: QueryStatus;\n};\nexport type LazyInfiniteQueryTrigger<D extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  /**\n   * Triggers a lazy query.\n   *\n   * By default, this will start a new request even if there is already a value in the cache.\n   * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a lazy query, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await getUserById(1).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>, direction: InfiniteQueryDirection): InfiniteQueryActionCreatorResult<D>;\n};\nexport type TypedLazyInfiniteQueryTrigger<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = LazyInfiniteQueryTrigger<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type UseInfiniteQuerySubscriptionOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>> = SubscriptionOptions & {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When `skip` is true (or `skipToken` is passed in as `arg`):\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```tsx\n   * // codeblock-meta no-transpile title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n  initialPageParam?: PageParamFrom<D>;\n  /**\n   * Defaults to `true`. When this is `true` and an infinite query endpoint is refetched\n   * (due to tag invalidation, polling, arg change configuration, or manual refetching),\n   * RTK Query will try to sequentially refetch all pages currently in the cache.\n   * When `false` only the first page will be refetched.\n   *\n   * This option applies to all automatic refetches for this subscription (polling, tag invalidation, etc.).\n   * It can be overridden on a per-call basis using the `refetch()` method.\n   */\n  refetchCachedPages?: boolean;\n};\nexport type TypedUseInfiniteQuerySubscription<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuerySubscription<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type UseInfiniteQuerySubscriptionResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  refetch: (options?: Pick<UseInfiniteQuerySubscriptionOptions<D>, 'refetchCachedPages'>) => InfiniteQueryActionCreatorResult<D>;\n  trigger: LazyInfiniteQueryTrigger<D>;\n  fetchNextPage: () => InfiniteQueryActionCreatorResult<D>;\n  fetchPreviousPage: () => InfiniteQueryActionCreatorResult<D>;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useQuerySubscription` hook in userland code.\n */\nexport type TypedUseInfiniteQuerySubscriptionResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuerySubscriptionResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type InfiniteQueryStateSelector<R extends Record<string, any>, D extends InfiniteQueryDefinition<any, any, any, any, any>> = (state: UseInfiniteQueryStateDefaultResult<D>) => R;\nexport type TypedInfiniteQueryStateSelector<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = InfiniteQueryStateSelector<SelectedResult, InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.  Additionally, it will cache multiple \"pages\" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.\n *\n *  The `data` field will be a `{pages: Data[], pageParams: PageParam[]}` structure containing all fetched page responses and the corresponding page param values for each page. You may use this to render individual pages, combine all pages into a single infinite list, or other display logic as needed.\n *\n * This hook combines the functionality of both [`useInfiniteQueryState`](#useinfinitequerystate) and [`useInfiniteQuerySubscription`](#useinfinitequerysubscription) together, and is intended to be used in the majority of situations.\n *\n * As with normal query hooks, `skipToken` is a valid argument that will skip the query from executing.\n *\n * By default, the initial request will use the `initialPageParam` value that was defined on the infinite query endpoint. If you want to start from a different value, you can pass `initialPageParam` as part of the hook options to override that initial request value.\n *\n * Use the returned `fetchNextPage` and `fetchPreviousPage` methods on the hook result object to trigger fetches forwards and backwards. These will always calculate the next or previous page param based on the current cached pages and the provided `getNext/PreviousPageParam` callbacks defined in the endpoint.\n *\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseInfiniteQuery<D extends InfiniteQueryDefinition<any, any, any, any, any>> = <R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<D>>(arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQuerySubscriptionOptions<D> & UseInfiniteQueryStateOptions<D, R>) => UseInfiniteQueryHookResult<D, R> & Pick<UseInfiniteQuerySubscriptionResult<D>, 'fetchNextPage' | 'fetchPreviousPage'>;\nexport type TypedUseInfiniteQuery<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuery<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * Note that this hook does not trigger fetching new data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQuerySubscription`](#useinfinitequerysubscription).\n *\n * #### Features\n *\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseInfiniteQueryState<D extends InfiniteQueryDefinition<any, any, any, any, any>> = <R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<D>>(arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQueryStateOptions<D, R>) => UseInfiniteQueryStateResult<D, R>;\nexport type TypedUseInfiniteQueryState<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQueryState<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data. Additionally, it will cache multiple \"pages\" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQueryState`](#useinfinitequerystate).\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n */\nexport type UseInfiniteQuerySubscription<D extends InfiniteQueryDefinition<any, any, any, any, any>> = (arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQuerySubscriptionOptions<D>) => UseInfiniteQuerySubscriptionResult<D>;\nexport type UseInfiniteQueryHookResult<D extends InfiniteQueryDefinition<any, any, any, any, any>, R = UseInfiniteQueryStateDefaultResult<D>> = UseInfiniteQueryStateResult<D, R> & Pick<UseInfiniteQuerySubscriptionResult<D>, 'refetch' | 'fetchNextPage' | 'fetchPreviousPage'>;\nexport type TypedUseInfiniteQueryHookResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryHookResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, R>;\nexport type UseInfiniteQueryStateOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>, R extends Record<string, any>> = {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When skip is true:\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after skipping the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.\n   * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.\n   * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.\n   * Note that this should always return an object (not a primitive), as RTKQ adds fields to the return value.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using selectFromResult to extract a single result\"\n   * function PostsList() {\n   *   const { data: posts } = api.useGetPostsQuery();\n   *\n   *   return (\n   *     <ul>\n   *       {posts?.data?.map((post) => (\n   *         <PostById key={post.id} id={post.id} />\n   *       ))}\n   *     </ul>\n   *   );\n   * }\n   *\n   * function PostById({ id }: { id: number }) {\n   *   // Will select the post with the given id, and will only rerender if the given posts data changes\n   *   const { post } = api.useGetPostsQuery(undefined, {\n   *     selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),\n   *   });\n   *\n   *   return <li>{post?.name}</li>;\n   * }\n   * ```\n   */\n  selectFromResult?: InfiniteQueryStateSelector<R, D>;\n};\nexport type TypedUseInfiniteQueryStateOptions<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryStateOptions<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, SelectedResult>;\nexport type UseInfiniteQueryStateResult<D extends InfiniteQueryDefinition<any, any, any, any, any>, R = UseInfiniteQueryStateDefaultResult<D>> = TSHelpersNoInfer<R>;\nexport type TypedUseInfiniteQueryStateResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, R = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryStateResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, R>;\ntype UseInfiniteQueryStateBaseResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = InfiniteQuerySubState<D> & {\n  /**\n   * Where `data` tries to hold data as much as possible, also re-using\n   * data from the last arguments passed into the hook, this property\n   * will always contain the received data from the query, for the current query arguments.\n   */\n  currentData?: InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>;\n  /**\n   * Query has not started yet.\n   */\n  isUninitialized: false;\n  /**\n   * Query is currently loading for the first time. No data yet.\n   */\n  isLoading: false;\n  /**\n   * Query is currently fetching, but might have data from an earlier request.\n   */\n  isFetching: false;\n  /**\n   * Query has data from a successful load.\n   */\n  isSuccess: false;\n  /**\n   * Query is currently in \"error\" state.\n   */\n  isError: false;\n  hasNextPage: boolean;\n  hasPreviousPage: boolean;\n  isFetchingNextPage: boolean;\n  isFetchingPreviousPage: boolean;\n};\ntype UseInfiniteQueryStateDefaultResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = TSHelpersId<TSHelpersOverride<Extract<UseInfiniteQueryStateBaseResult<D>, {\n  status: QueryStatus.uninitialized;\n}>, {\n  isUninitialized: true;\n}> | TSHelpersOverride<UseInfiniteQueryStateBaseResult<D>, {\n  isLoading: true;\n  isFetching: boolean;\n  data: undefined;\n} | ({\n  isSuccess: true;\n  isFetching: true;\n  error: undefined;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp'>>) | ({\n  isSuccess: true;\n  isFetching: false;\n  error: undefined;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp' | 'currentData'>>) | ({\n  isError: true;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'error'>>)>> & {\n  /**\n   * @deprecated Included for completeness, but discouraged.\n   * Please use the `isLoading`, `isFetching`, `isSuccess`, `isError`\n   * and `isUninitialized` flags instead\n   */\n  status: QueryStatus;\n};\nexport type MutationStateSelector<R extends Record<string, any>, D extends MutationDefinition<any, any, any, any>> = (state: MutationResultSelectorResult<D>) => R;\nexport type UseMutationStateOptions<D extends MutationDefinition<any, any, any, any>, R extends Record<string, any>> = {\n  selectFromResult?: MutationStateSelector<R, D>;\n  fixedCacheKey?: string;\n};\nexport type UseMutationStateResult<D extends MutationDefinition<any, any, any, any>, R> = TSHelpersNoInfer<R> & {\n  originalArgs?: QueryArgFrom<D>;\n  /**\n   * Resets the hook state to its initial `uninitialized` state.\n   * This will also remove the last result from the cache.\n   */\n  reset: () => void;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useMutation` hook in userland code.\n */\nexport type TypedUseMutationResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = MutationResultSelectorResult<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseMutationStateResult<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>, R>;\n\n/**\n * A React hook that lets you trigger an update request for a given endpoint, and subscribes the component to read the request status from the Redux store. The component will re-render as the loading status changes.\n *\n * #### Features\n *\n * - Manual control over firing a request to alter data on the server or possibly invalidate the cache\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseMutation<D extends MutationDefinition<any, any, any, any>> = <R extends Record<string, any> = MutationResultSelectorResult<D>>(options?: UseMutationStateOptions<D, R>) => readonly [MutationTrigger<D>, UseMutationStateResult<D, R>];\nexport type TypedUseMutation<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseMutation<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type MutationTrigger<D extends MutationDefinition<any, any, any, any>> = {\n  /**\n   * Triggers the mutation and returns a Promise.\n   * @remarks\n   * If you need to access the error or success payload immediately after a mutation, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await addPost({ id: 1, name: 'Example' }).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>): MutationActionCreatorResult<D>;\n};\nexport type TypedMutationTrigger<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = MutationTrigger<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * Wrapper around `defaultQueryStateSelector` to be used in `useQuery`.\n * We want the initial render to already come back with\n * `{ isUninitialized: false, isFetching: true, isLoading: true }`\n * to prevent that the library user has to do an additional check for `isUninitialized`/\n */\nconst noPendingQueryStateSelector: QueryStateSelector<any, any> = selected => {\n  if (selected.isUninitialized) {\n    return {\n      ...selected,\n      isUninitialized: false,\n      isFetching: true,\n      isLoading: selected.data !== undefined ? false : true,\n      // This is the one place where we still have to use `QueryStatus` as an enum,\n      // since it's the only reference in the React package and not in the core.\n      status: QueryStatus.pending\n    } as any;\n  }\n  return selected;\n};\nfunction pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K> {\n  const ret: any = {};\n  keys.forEach(key => {\n    ret[key] = obj[key];\n  });\n  return ret;\n}\nconst COMMON_HOOK_DEBUG_FIELDS = ['data', 'status', 'isLoading', 'isSuccess', 'isError', 'error'] as const;\ntype GenericPrefetchThunk = (endpointName: any, arg: any, options: PrefetchOptions) => ThunkAction<void, any, any, UnknownAction>;\n\n/**\n *\n * @param opts.api - An API with defined endpoints to create hooks for\n * @param opts.moduleOptions.batch - The version of the `batchedUpdates` function to be used\n * @param opts.moduleOptions.useDispatch - The version of the `useDispatch` hook to be used\n * @param opts.moduleOptions.useSelector - The version of the `useSelector` hook to be used\n * @returns An object containing functions to generate hooks based on an endpoint\n */\nexport function buildHooks<Definitions extends EndpointDefinitions>({\n  api,\n  moduleOptions: {\n    batch,\n    hooks: {\n      useDispatch,\n      useSelector,\n      useStore\n    },\n    unstable__sideEffectsInRender,\n    createSelector\n  },\n  serializeQueryArgs,\n  context\n}: {\n  api: Api<any, Definitions, any, any, CoreModule>;\n  moduleOptions: Required<ReactHooksModuleOptions>;\n  serializeQueryArgs: SerializeQueryArgs<any>;\n  context: ApiContext<Definitions>;\n}) {\n  const usePossiblyImmediateEffect: (effect: () => void | undefined, deps?: DependencyList) => void = unstable__sideEffectsInRender ? cb => cb() : useEffect;\n  type UnsubscribePromiseRef = React.RefObject<{\n    unsubscribe?: () => void;\n  } | undefined>;\n  const unsubscribePromiseRef = (ref: UnsubscribePromiseRef) => ref.current?.unsubscribe?.();\n  const endpointDefinitions = context.endpointDefinitions;\n  return {\n    buildQueryHooks,\n    buildInfiniteQueryHooks,\n    buildMutationHook,\n    usePrefetch\n  };\n  function queryStatePreSelector(currentState: QueryResultSelectorResult<any>, lastResult: UseQueryStateDefaultResult<any> | undefined, queryArgs: any): UseQueryStateDefaultResult<any> {\n    // if we had a last result and the current result is uninitialized,\n    // we might have called `api.util.resetApiState`\n    // in this case, reset the hook\n    if (lastResult?.endpointName && currentState.isUninitialized) {\n      const {\n        endpointName\n      } = lastResult;\n      const endpointDefinition = endpointDefinitions[endpointName];\n      if (queryArgs !== skipToken && serializeQueryArgs({\n        queryArgs: lastResult.originalArgs,\n        endpointDefinition,\n        endpointName\n      }) === serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      })) lastResult = undefined;\n    }\n\n    // data is the last known good request result we have tracked - or if none has been tracked yet the last good result for the current args\n    let data = currentState.isSuccess ? currentState.data : lastResult?.data;\n    if (data === undefined) data = currentState.data;\n    const hasData = data !== undefined;\n\n    // isFetching = true any time a request is in flight\n    const isFetching = currentState.isLoading;\n\n    // isLoading = true only when loading while no data is present yet (initial load with no data in the cache)\n    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;\n\n    // isSuccess = true when data is present and we're not refetching after an error.\n    // That includes cases where the _current_ item is either actively\n    // fetching or about to fetch due to an uninitialized entry.\n    const isSuccess = currentState.isSuccess || hasData && (isFetching && !lastResult?.isError || currentState.isUninitialized);\n    return {\n      ...currentState,\n      data,\n      currentData: currentState.data,\n      isFetching,\n      isLoading,\n      isSuccess\n    } as UseQueryStateDefaultResult<any>;\n  }\n  function infiniteQueryStatePreSelector(currentState: InfiniteQueryResultSelectorResult<any>, lastResult: UseInfiniteQueryStateDefaultResult<any> | undefined, queryArgs: any): UseInfiniteQueryStateDefaultResult<any> {\n    // if we had a last result and the current result is uninitialized,\n    // we might have called `api.util.resetApiState`\n    // in this case, reset the hook\n    if (lastResult?.endpointName && currentState.isUninitialized) {\n      const {\n        endpointName\n      } = lastResult;\n      const endpointDefinition = endpointDefinitions[endpointName];\n      if (queryArgs !== skipToken && serializeQueryArgs({\n        queryArgs: lastResult.originalArgs,\n        endpointDefinition,\n        endpointName\n      }) === serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      })) lastResult = undefined;\n    }\n\n    // data is the last known good request result we have tracked - or if none has been tracked yet the last good result for the current args\n    let data = currentState.isSuccess ? currentState.data : lastResult?.data;\n    if (data === undefined) data = currentState.data;\n    const hasData = data !== undefined;\n\n    // isFetching = true any time a request is in flight\n    const isFetching = currentState.isLoading;\n    // isLoading = true only when loading while no data is present yet (initial load with no data in the cache)\n    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;\n    // isSuccess = true when data is present\n    const isSuccess = currentState.isSuccess || isFetching && hasData;\n    return {\n      ...currentState,\n      data,\n      currentData: currentState.data,\n      isFetching,\n      isLoading,\n      isSuccess\n    } as UseInfiniteQueryStateDefaultResult<any>;\n  }\n  function usePrefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, defaultOptions?: PrefetchOptions) {\n    const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n    const stableDefaultOptions = useShallowStableValue(defaultOptions);\n    return useCallback((arg: any, options?: PrefetchOptions) => dispatch((api.util.prefetch as GenericPrefetchThunk)(endpointName, arg, {\n      ...stableDefaultOptions,\n      ...options\n    })), [endpointName, dispatch, stableDefaultOptions]);\n  }\n  function useQuerySubscriptionCommonImpl<T extends QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>(endpointName: string, arg: unknown | SkipToken, {\n    refetchOnReconnect,\n    refetchOnFocus,\n    refetchOnMountOrArgChange,\n    skip = false,\n    pollingInterval = 0,\n    skipPollingIfUnfocused = false,\n    ...rest\n  }: UseQuerySubscriptionOptions = {}) {\n    const {\n      initiate\n    } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n    const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n\n    // TODO: Change this to `useRef<SubscriptionSelectors>(undefined)` after upgrading to React 19.\n    const subscriptionSelectorsRef = useRef<SubscriptionSelectors | undefined>(undefined);\n    if (!subscriptionSelectorsRef.current) {\n      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());\n      if (process.env.NODE_ENV !== 'production') {\n        if (typeof returnedValue !== 'object' || typeof returnedValue?.type === 'string') {\n          throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(37) : `Warning: Middleware for RTK-Query API at reducerPath \"${api.reducerPath}\" has not been added to the store.\n    You must add the middleware for RTK-Query to function correctly!`);\n        }\n      }\n      subscriptionSelectorsRef.current = returnedValue as unknown as SubscriptionSelectors;\n    }\n    const stableArg = useStableQueryArgs(skip ? skipToken : arg);\n    const stableSubscriptionOptions = useShallowStableValue({\n      refetchOnReconnect,\n      refetchOnFocus,\n      pollingInterval,\n      skipPollingIfUnfocused\n    });\n    const initialPageParam = (rest as UseInfiniteQuerySubscriptionOptions<any>).initialPageParam;\n    const stableInitialPageParam = useShallowStableValue(initialPageParam);\n    const refetchCachedPages = (rest as UseInfiniteQuerySubscriptionOptions<any>).refetchCachedPages;\n    const stableRefetchCachedPages = useShallowStableValue(refetchCachedPages);\n\n    /**\n     * @todo Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n     */\n    const promiseRef = useRef<T | undefined>(undefined);\n    let {\n      queryCacheKey,\n      requestId\n    } = promiseRef.current || {};\n\n    // HACK We've saved the middleware subscription lookup callbacks into a ref,\n    // so we can directly check here if the subscription exists for this query.\n    let currentRenderHasSubscription = false;\n    if (queryCacheKey && requestId) {\n      currentRenderHasSubscription = subscriptionSelectorsRef.current.isRequestSubscribed(queryCacheKey, requestId);\n    }\n    const subscriptionRemoved = !currentRenderHasSubscription && promiseRef.current !== undefined;\n    usePossiblyImmediateEffect((): void | undefined => {\n      if (subscriptionRemoved) {\n        promiseRef.current = undefined;\n      }\n    }, [subscriptionRemoved]);\n    usePossiblyImmediateEffect((): void | undefined => {\n      const lastPromise = promiseRef.current;\n      if (typeof process !== 'undefined' && process.env.NODE_ENV === 'removeMeOnCompilation') {\n        // this is only present to enforce the rule of hooks to keep `isSubscribed` in the dependency array\n        console.log(subscriptionRemoved);\n      }\n      if (stableArg === skipToken) {\n        lastPromise?.unsubscribe();\n        promiseRef.current = undefined;\n        return;\n      }\n      const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions;\n      if (!lastPromise || lastPromise.arg !== stableArg) {\n        lastPromise?.unsubscribe();\n        const promise = dispatch(initiate(stableArg, {\n          subscriptionOptions: stableSubscriptionOptions,\n          forceRefetch: refetchOnMountOrArgChange,\n          ...(isInfiniteQueryDefinition(endpointDefinitions[endpointName]) ? {\n            initialPageParam: stableInitialPageParam,\n            refetchCachedPages: stableRefetchCachedPages\n          } : {})\n        }));\n        promiseRef.current = promise as T;\n      } else if (stableSubscriptionOptions !== lastSubscriptionOptions) {\n        lastPromise.updateSubscriptionOptions(stableSubscriptionOptions);\n      }\n    }, [dispatch, initiate, refetchOnMountOrArgChange, stableArg, stableSubscriptionOptions, subscriptionRemoved, stableInitialPageParam, stableRefetchCachedPages, endpointName]);\n    return [promiseRef, dispatch, initiate, stableSubscriptionOptions] as const;\n  }\n  function buildUseQueryState(endpointName: string, preSelector: typeof queryStatePreSelector | typeof infiniteQueryStatePreSelector) {\n    const useQueryState = (arg: any, {\n      skip = false,\n      selectFromResult\n    }: UseQueryStateOptions<any, any> | UseInfiniteQueryStateOptions<any, any> = {}) => {\n      const {\n        select\n      } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n      const stableArg = useStableQueryArgs(skip ? skipToken : arg);\n      type ApiRootState = Parameters<ReturnType<typeof select>>[0];\n      const lastValue = useRef<any>(undefined);\n      const selectDefaultResult: Selector<ApiRootState, any, [any]> = useMemo(() =>\n      // Normally ts-ignores are bad and should be avoided, but we're\n      // already casting this selector to be `Selector<any>` anyway,\n      // so the inconsistencies don't matter here\n      // @ts-ignore\n      createSelector([\n      // @ts-ignore\n      select(stableArg), (_: ApiRootState, lastResult: any) => lastResult, (_: ApiRootState) => stableArg], preSelector, {\n        memoizeOptions: {\n          resultEqualityCheck: shallowEqual\n        }\n      }), [select, stableArg]);\n      const querySelector: Selector<ApiRootState, any, [any]> = useMemo(() => selectFromResult ? createSelector([selectDefaultResult], selectFromResult, {\n        devModeChecks: {\n          identityFunctionCheck: 'never'\n        }\n      }) : selectDefaultResult, [selectDefaultResult, selectFromResult]);\n      const currentState = useSelector((state: RootState<Definitions, any, any>) => querySelector(state, lastValue.current), shallowEqual);\n      const store = useStore<RootState<Definitions, any, any>>();\n      const newLastValue = selectDefaultResult(store.getState(), lastValue.current);\n      useIsomorphicLayoutEffect(() => {\n        lastValue.current = newLastValue;\n      }, [newLastValue]);\n      return currentState;\n    };\n    return useQueryState;\n  }\n  function usePromiseRefUnsubscribeOnUnmount(promiseRef: UnsubscribePromiseRef) {\n    useEffect(() => {\n      return () => {\n        unsubscribePromiseRef(promiseRef)\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n        ;\n        (promiseRef.current as any) = undefined;\n      };\n    }, [promiseRef]);\n  }\n  function refetchOrErrorIfUnmounted<T extends QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>(promiseRef: React.RefObject<T | undefined>): T {\n    if (!promiseRef.current) throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(38) : 'Cannot refetch a query that has not been started yet.');\n    return promiseRef.current.refetch() as T;\n  }\n  function buildQueryHooks(endpointName: string): QueryHooks<any> {\n    const useQuerySubscription: UseQuerySubscription<any> = (arg: any, options = {}) => {\n      const [promiseRef] = useQuerySubscriptionCommonImpl<QueryActionCreatorResult<any>>(endpointName, arg, options);\n      usePromiseRefUnsubscribeOnUnmount(promiseRef);\n      return useMemo(() => ({\n        /**\n         * A method to manually refetch data for the query\n         */\n        refetch: () => refetchOrErrorIfUnmounted(promiseRef)\n      }), [promiseRef]);\n    };\n    const useLazyQuerySubscription: UseLazyQuerySubscription<any> = ({\n      refetchOnReconnect,\n      refetchOnFocus,\n      pollingInterval = 0,\n      skipPollingIfUnfocused = false\n    } = {}) => {\n      const {\n        initiate\n      } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n      const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n      const [arg, setArg] = useState<any>(UNINITIALIZED_VALUE);\n\n      // TODO: Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n      /**\n       * @todo Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n       */\n      const promiseRef = useRef<QueryActionCreatorResult<any> | undefined>(undefined);\n      const stableSubscriptionOptions = useShallowStableValue({\n        refetchOnReconnect,\n        refetchOnFocus,\n        pollingInterval,\n        skipPollingIfUnfocused\n      });\n      usePossiblyImmediateEffect(() => {\n        const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions;\n        if (stableSubscriptionOptions !== lastSubscriptionOptions) {\n          promiseRef.current?.updateSubscriptionOptions(stableSubscriptionOptions);\n        }\n      }, [stableSubscriptionOptions]);\n      const subscriptionOptionsRef = useRef(stableSubscriptionOptions);\n      usePossiblyImmediateEffect(() => {\n        subscriptionOptionsRef.current = stableSubscriptionOptions;\n      }, [stableSubscriptionOptions]);\n      const trigger = useCallback(function (arg: any, preferCacheValue = false) {\n        let promise: QueryActionCreatorResult<any>;\n        batch(() => {\n          unsubscribePromiseRef(promiseRef);\n          promiseRef.current = promise = dispatch(initiate(arg, {\n            subscriptionOptions: subscriptionOptionsRef.current,\n            forceRefetch: !preferCacheValue\n          }));\n          setArg(arg);\n        });\n        return promise!;\n      }, [dispatch, initiate]);\n      const reset = useCallback(() => {\n        if (promiseRef.current?.queryCacheKey) {\n          dispatch(api.internalActions.removeQueryResult({\n            queryCacheKey: promiseRef.current?.queryCacheKey as QueryCacheKey\n          }));\n        }\n      }, [dispatch]);\n\n      /* cleanup on unmount */\n      useEffect(() => {\n        return () => {\n          unsubscribePromiseRef(promiseRef);\n        };\n      }, []);\n\n      /* if \"cleanup on unmount\" was triggered from a fast refresh, we want to reinstate the query */\n      useEffect(() => {\n        if (arg !== UNINITIALIZED_VALUE && !promiseRef.current) {\n          trigger(arg, true);\n        }\n      }, [arg, trigger]);\n      return useMemo(() => [trigger, arg, {\n        reset\n      }] as const, [trigger, arg, reset]);\n    };\n    const useQueryState: UseQueryState<any> = buildUseQueryState(endpointName, queryStatePreSelector);\n    return {\n      useQueryState,\n      useQuerySubscription,\n      useLazyQuerySubscription,\n      useLazyQuery(options) {\n        const [trigger, arg, {\n          reset\n        }] = useLazyQuerySubscription(options);\n        const queryStateResults = useQueryState(arg, {\n          ...options,\n          skip: arg === UNINITIALIZED_VALUE\n        });\n        const info = useMemo(() => ({\n          lastArg: arg\n        }), [arg]);\n        return useMemo(() => [trigger, {\n          ...queryStateResults,\n          reset\n        }, info], [trigger, queryStateResults, reset, info]);\n      },\n      useQuery(arg, options) {\n        const querySubscriptionResults = useQuerySubscription(arg, options);\n        const queryStateResults = useQueryState(arg, {\n          selectFromResult: arg === skipToken || options?.skip ? undefined : noPendingQueryStateSelector,\n          ...options\n        });\n        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS);\n        useDebugValue(debugValue);\n        return useMemo(() => ({\n          ...queryStateResults,\n          ...querySubscriptionResults\n        }), [queryStateResults, querySubscriptionResults]);\n      }\n    };\n  }\n  function buildInfiniteQueryHooks(endpointName: string): InfiniteQueryHooks<any> {\n    const useInfiniteQuerySubscription: UseInfiniteQuerySubscription<any> = (arg: any, options = {}) => {\n      const [promiseRef, dispatch, initiate, stableSubscriptionOptions] = useQuerySubscriptionCommonImpl<InfiniteQueryActionCreatorResult<any>>(endpointName, arg, options);\n      const subscriptionOptionsRef = useRef(stableSubscriptionOptions);\n      usePossiblyImmediateEffect(() => {\n        subscriptionOptionsRef.current = stableSubscriptionOptions;\n      }, [stableSubscriptionOptions]);\n\n      // Extract and stabilize the hook-level refetchCachedPages option\n      const hookRefetchCachedPages = (options as UseInfiniteQuerySubscriptionOptions<any>).refetchCachedPages;\n      const stableHookRefetchCachedPages = useShallowStableValue(hookRefetchCachedPages);\n      const trigger: LazyInfiniteQueryTrigger<any> = useCallback(function (arg: unknown, direction: 'forward' | 'backward') {\n        let promise: InfiniteQueryActionCreatorResult<any>;\n        batch(() => {\n          unsubscribePromiseRef(promiseRef);\n          promiseRef.current = promise = dispatch((initiate as StartInfiniteQueryActionCreator<any>)(arg, {\n            subscriptionOptions: subscriptionOptionsRef.current,\n            direction\n          }));\n        });\n        return promise!;\n      }, [promiseRef, dispatch, initiate]);\n      usePromiseRefUnsubscribeOnUnmount(promiseRef);\n      const stableArg = useStableQueryArgs(options.skip ? skipToken : arg);\n      const refetch = useCallback((options?: Pick<UseInfiniteQuerySubscriptionOptions<any>, 'refetchCachedPages'>) => {\n        if (!promiseRef.current) throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(38) : 'Cannot refetch a query that has not been started yet.');\n        // Merge per-call options with hook-level default\n        const mergedOptions = {\n          refetchCachedPages: options?.refetchCachedPages ?? stableHookRefetchCachedPages\n        };\n        return promiseRef.current.refetch(mergedOptions);\n      }, [promiseRef, stableHookRefetchCachedPages]);\n      return useMemo(() => {\n        const fetchNextPage = () => {\n          return trigger(stableArg, 'forward');\n        };\n        const fetchPreviousPage = () => {\n          return trigger(stableArg, 'backward');\n        };\n        return {\n          trigger,\n          /**\n           * A method to manually refetch data for the query\n           */\n          refetch,\n          fetchNextPage,\n          fetchPreviousPage\n        };\n      }, [refetch, trigger, stableArg]);\n    };\n    const useInfiniteQueryState: UseInfiniteQueryState<any> = buildUseQueryState(endpointName, infiniteQueryStatePreSelector);\n    return {\n      useInfiniteQueryState,\n      useInfiniteQuerySubscription,\n      useInfiniteQuery(arg, options) {\n        const {\n          refetch,\n          fetchNextPage,\n          fetchPreviousPage\n        } = useInfiniteQuerySubscription(arg, options);\n        const queryStateResults = useInfiniteQueryState(arg, {\n          selectFromResult: arg === skipToken || options?.skip ? undefined : noPendingQueryStateSelector,\n          ...options\n        });\n        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS, 'hasNextPage', 'hasPreviousPage');\n        useDebugValue(debugValue);\n        return useMemo(() => ({\n          ...queryStateResults,\n          fetchNextPage,\n          fetchPreviousPage,\n          refetch\n        }), [queryStateResults, fetchNextPage, fetchPreviousPage, refetch]);\n      }\n    };\n  }\n  function buildMutationHook(name: string): UseMutation<any> {\n    return ({\n      selectFromResult,\n      fixedCacheKey\n    } = {}) => {\n      const {\n        select,\n        initiate\n      } = api.endpoints[name] as ApiEndpointMutation<MutationDefinition<any, any, any, any, any>, Definitions>;\n      const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n      const [promise, setPromise] = useState<MutationActionCreatorResult<any>>();\n      useEffect(() => () => {\n        if (!promise?.arg.fixedCacheKey) {\n          promise?.reset();\n        }\n      }, [promise]);\n      const triggerMutation = useCallback(function (arg: Parameters<typeof initiate>['0']) {\n        const promise = dispatch(initiate(arg, {\n          fixedCacheKey\n        }));\n        setPromise(promise);\n        return promise;\n      }, [dispatch, initiate, fixedCacheKey]);\n      const {\n        requestId\n      } = promise || {};\n      const selectDefaultResult = useMemo(() => select({\n        fixedCacheKey,\n        requestId: promise?.requestId\n      }), [fixedCacheKey, promise, select]);\n      const mutationSelector = useMemo((): Selector<RootState<Definitions, any, any>, any> => selectFromResult ? createSelector([selectDefaultResult], selectFromResult) : selectDefaultResult, [selectFromResult, selectDefaultResult]);\n      const currentState = useSelector(mutationSelector, shallowEqual);\n      const originalArgs = fixedCacheKey == null ? promise?.arg.originalArgs : undefined;\n      const reset = useCallback(() => {\n        batch(() => {\n          if (promise) {\n            setPromise(undefined);\n          }\n          if (fixedCacheKey) {\n            dispatch(api.internalActions.removeMutationResult({\n              requestId,\n              fixedCacheKey\n            }));\n          }\n        });\n      }, [dispatch, fixedCacheKey, promise, requestId]);\n      const debugValue = pick(currentState, ...COMMON_HOOK_DEBUG_FIELDS, 'endpointName');\n      useDebugValue(debugValue);\n      const finalState = useMemo(() => ({\n        ...currentState,\n        originalArgs,\n        reset\n      }), [currentState, originalArgs, reset]);\n      return useMemo(() => [triggerMutation, finalState] as const, [triggerMutation, finalState]);\n    };\n  }\n}","export { useEffect, useRef, useMemo, useContext, useCallback, useDebugValue, useLayoutEffect, useState } from 'react';","export { shallowEqual, Provider, ReactReduxContext } from 'react-redux';","export const UNINITIALIZED_VALUE = Symbol();\nexport type UninitializedValue = typeof UNINITIALIZED_VALUE;","import { useEffect, useRef, useMemo } from './reactImports';\nimport { copyWithStructuralSharing } from './rtkqImports';\nexport function useStableQueryArgs<T>(queryArgs: T) {\n  const cache = useRef(queryArgs);\n  const copy = useMemo(() => copyWithStructuralSharing(cache.current, queryArgs), [queryArgs]);\n  useEffect(() => {\n    if (cache.current !== copy) {\n      cache.current = copy;\n    }\n  }, [copy]);\n  return copy;\n}","import { useEffect, useRef } from './reactImports';\nimport { shallowEqual } from './reactReduxImports';\nexport function useShallowStableValue<T>(value: T) {\n  const cache = useRef(value);\n  useEffect(() => {\n    if (!shallowEqual(cache.current, value)) {\n      cache.current = value;\n    }\n  }, [value]);\n  return shallowEqual(cache.current, value) ? cache.current : value;\n}","// This must remain here so that the `mangleErrors.cjs` build script\n// does not have to import this into each source file it rewrites.\nimport { formatProdErrorMessage } from '@reduxjs/toolkit';\nimport { buildCreateApi, coreModule } from './rtkqImports';\nimport { reactHooksModule, reactHooksModuleName } from './module';\nexport * from '@reduxjs/toolkit/query';\nexport { ApiProvider } from './ApiProvider';\nconst createApi = /* @__PURE__ */buildCreateApi(coreModule(), reactHooksModule());\nexport type { TypedUseMutationResult, TypedUseQueryHookResult, TypedUseQueryStateResult, TypedUseQuerySubscriptionResult, TypedLazyQueryTrigger, TypedUseLazyQuery, TypedUseMutation, TypedMutationTrigger, TypedQueryStateSelector, TypedUseQueryState, TypedUseQuery, TypedUseQuerySubscription, TypedUseLazyQuerySubscription, TypedUseQueryStateOptions, TypedUseLazyQueryStateResult, TypedUseInfiniteQuery, TypedUseInfiniteQueryHookResult, TypedUseInfiniteQueryStateResult, TypedUseInfiniteQuerySubscriptionResult, TypedUseInfiniteQueryStateOptions, TypedInfiniteQueryStateSelector, TypedUseInfiniteQuerySubscription, TypedUseInfiniteQueryState, TypedLazyInfiniteQueryTrigger } from './buildHooks';\nexport { UNINITIALIZED_VALUE } from './constants';\nexport { createApi, reactHooksModule, reactHooksModuleName };","import { configureStore, formatProdErrorMessage as _formatProdErrorMessage } from '@reduxjs/toolkit';\nimport type { Context } from 'react';\nimport { useContext, useEffect } from './reactImports';\nimport * as React from 'react';\nimport type { ReactReduxContextValue } from 'react-redux';\nimport { Provider, ReactReduxContext } from './reactReduxImports';\nimport { setupListeners } from './rtkqImports';\nimport type { Api } from '@reduxjs/toolkit/query';\n\n/**\n * Can be used as a `Provider` if you **do not already have a Redux store**.\n *\n * @example\n * ```tsx\n * // codeblock-meta no-transpile title=\"Basic usage - wrap your App with ApiProvider\"\n * import * as React from 'react';\n * import { ApiProvider } from '@reduxjs/toolkit/query/react';\n * import { Pokemon } from './features/Pokemon';\n *\n * function App() {\n *   return (\n *     <ApiProvider api={api}>\n *       <Pokemon />\n *     </ApiProvider>\n *   );\n * }\n * ```\n *\n * @remarks\n * Using this together with an existing redux store, both will\n * conflict with each other - please use the traditional redux setup\n * in that case.\n */\nexport function ApiProvider(props: {\n  children: any;\n  api: Api<any, {}, any, any>;\n  setupListeners?: Parameters<typeof setupListeners>[1] | false;\n  context?: Context<ReactReduxContextValue | null>;\n}) {\n  const context = props.context || ReactReduxContext;\n  const existingContext = useContext(context);\n  if (existingContext) {\n    throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(35) : 'Existing Redux context detected. If you already have a store set up, please use the traditional Redux setup.');\n  }\n  const [store] = React.useState(() => configureStore({\n    reducer: {\n      [props.api.reducerPath]: props.api.reducer\n    },\n    middleware: gDM => gDM().concat(props.api.middleware)\n  }));\n  // Adds the event listeners for online/offline/focus/etc\n  useEffect((): undefined | (() => void) => props.setupListeners === false ? undefined : setupListeners(store.dispatch, props.setupListeners), [props.setupListeners, store.dispatch]);\n  return <Provider store={store} context={context}>\n      {props.children}\n    </Provider>;\n}"],"mappings":"AAAA,OAAS,kBAAAA,GAAgB,cAAAC,GAAY,6BAAAC,GAA2B,kBAAAC,GAAgB,eAAAC,GAAa,aAAAC,MAAiB,yBCA9G,MAAkE,mBAElE,OAAS,SAASC,GAAS,eAAeC,GAAe,eAAeC,GAAe,YAAYC,OAAkB,cAErH,OAAS,kBAAkBC,OAAuB,WCJ3C,SAASC,EAAWC,EAAa,CACtC,OAAOA,EAAI,QAAQA,EAAI,CAAC,EAAGA,EAAI,CAAC,EAAE,YAAY,CAAC,CACjD,CCuYO,IAAMC,GAAiB,QACjBC,GAAoB,WACpBC,GAAyB,gBA+c/B,SAASC,GAAkB,EAA8G,CAC9I,OAAO,EAAE,OAASH,EACpB,CACO,SAASI,GAAqB,EAAiH,CACpJ,OAAO,EAAE,OAASH,EACpB,CACO,SAASI,EAA0B,EAA2H,CACnK,OAAO,EAAE,OAASH,EACpB,CC91BO,SAASI,EAA6BC,KAAcC,EAAqC,CAC9F,OAAO,OAAO,OAAOD,EAAQ,GAAGC,CAAI,CACtC,CCNA,OAA4D,0BAA0BC,GAA0B,0BAA0BC,OAAgC,mBCA1K,OAAS,aAAAC,EAAW,UAAAC,EAAQ,WAAAC,EAAS,cAAAC,GAAY,eAAAC,EAAa,iBAAAC,EAAe,mBAAAC,GAAiB,YAAAC,OAAgB,QCA9G,OAAS,gBAAAC,EAAc,YAAAC,GAAU,qBAAAC,OAAyB,cCAnD,IAAMC,EAAsB,OAAO,ECEnC,SAASC,EAAsBC,EAAc,CAClD,IAAMC,EAAQC,EAAOF,CAAS,EACxBG,EAAOC,EAAQ,IAAMC,GAA0BJ,EAAM,QAASD,CAAS,EAAG,CAACA,CAAS,CAAC,EAC3F,OAAAM,EAAU,IAAM,CACVL,EAAM,UAAYE,IACpBF,EAAM,QAAUE,EAEpB,EAAG,CAACA,CAAI,CAAC,EACFA,CACT,CCTO,SAASI,EAAyBC,EAA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ACzC,YAAAU,CACF,CAAC,EACApB,EAAY,MAAMkB,EAAWR,CAAY,CAAC,UAAU,EAAIU,CAC3D,SAAWC,EAA0BV,CAAU,EAAG,CAChD,GAAM,CACJ,iBAAAW,EACA,6BAAAC,EACA,sBAAAC,CACF,EAAInB,EAAwBK,CAAY,EACxCD,EAAWN,EAAO,UAAUO,CAAY,EAAG,CACzC,iBAAAY,EACA,6BAAAC,EACA,sBAAAC,CACF,CAAC,EACAxB,EAAY,MAAMkB,EAAWR,CAAY,CAAC,eAAe,EAAIY,CAChE,CACF,CACF,CACF,CACF,GUvMF,WAAc,yBCLd,OAAS,kBAAAG,GAAgB,0BAA0BC,OAA+B,mBAGlF,UAAYC,MAAW,QA8BhB,SAASC,GAAYC,EAKzB,CACD,IAAMC,EAAUD,EAAM,SAAWE,GAEjC,GADwBC,GAAWF,CAAO,EAExC,MAAM,IAAI,MAA8CG,GAAwB,EAAE,CAAkH,EAEtM,GAAM,CAACC,CAAK,EAAU,WAAS,IAAMC,GAAe,CAClD,QAAS,CACP,CAACN,EAAM,IAAI,WAAW,EAAGA,EAAM,IAAI,OACrC,EACA,WAAYO,GAAOA,EAAI,EAAE,OAAOP,EAAM,IAAI,UAAU,CACtD,CAAC,CAAC,EAEF,OAAAQ,EAAU,IAAgCR,EAAM,iBAAmB,GAAQ,OAAYS,GAAeJ,EAAM,SAAUL,EAAM,cAAc,EAAG,CAACA,EAAM,eAAgBK,EAAM,QAAQ,CAAC,EAC5K,gBAACK,GAAA,CAAS,MAAOL,EAAO,QAASJ,GACnCD,EAAM,QACT,CACJ,CDhDA,IAAMW,GAA2BC,GAAeC,GAAW,EAAGC,GAAiB,CAAC","names":["buildCreateApi","coreModule","copyWithStructuralSharing","setupListeners","QueryStatus","skipToken","rrBatch","rrUseDispatch","rrUseSelector","rrUseStore","_createSelector","capitalize","str","ENDPOINT_QUERY","ENDPOINT_MUTATION","ENDPOINT_INFINITEQUERY","isQueryDefinition","isMutationDefinition","isInfiniteQueryDefinition","safeAssign","target","args","_formatProdErrorMessage2","_formatProdErrorMessage3","useEffect","useRef","useMemo","useContext","useCallback","useDebugValue","useLayoutEffect","useState","shallowEqual","Provider","ReactReduxContext","UNINITIALIZED_VALUE","useStableQueryArgs","queryArgs","cache","useRef","copy","useMemo","copyWithStructuralSharing","useEffect","useShallowStableValue","value","cache","useRef","useEffect","shallowEqual","canUseDOM","isDOM","isRunningInReactNative","isReactNative","getUseIsomorphicLayoutEffect","useLayoutEffect","useEffect","useIsomorphicLayoutEffect","noPendingQueryStateSelector","selected","QueryStatus","pick","obj","keys","ret","key","COMMON_HOOK_DEBUG_FIELDS","buildHooks","api","batch","useDispatch","useSelector","useStore","unstable__sideEffectsInRender","createSelector","serializeQueryArgs","context","usePossiblyImmediateEffect","cb","unsubscribePromiseRef","ref","endpointDefinitions","buildQueryHooks","buildInfiniteQueryHooks","buildMutationHook","usePrefetch","queryStatePreSelector","currentState","lastResult","queryArgs","endpointName","endpointDefinition","skipToken","data","hasData","isFetching","isLoading","isSuccess","infiniteQueryStatePreSelector","defaultOptions","dispatch","stableDefaultOptions","useShallowStableValue","useCallback","arg","options","useQuerySubscriptionCommonImpl","refetchOnReconnect","refetchOnFocus","refetchOnMountOrArgChange","skip","pollingInterval","skipPollingIfUnfocused","rest","initiate","subscriptionSelectorsRef","useRef","returnedValue","stableArg","useStableQueryArgs","stableSubscriptionOptions","initialPageParam","stableInitialPageParam","refetchCachedPages","stableRefetchCachedPages","promiseRef","queryCacheKey","requestId","currentRenderHasSubscription","subscriptionRemoved","lastPromise","lastSubscriptionOptions","promise","isInfiniteQueryDefinition","buildUseQueryState","preSelector","selectFromResult","select","lastValue","selectDefaultResult","useMemo","_","shallowEqual","querySelector","state","store","newLastValue","usePromiseRefUnsubscribeOnUnmount","refetchOrErrorIfUnmounted","_formatProdErrorMessage2","useQuerySubscription","useLazyQuerySubscription","setArg","useState","UNINITIALIZED_VALUE","subscriptionOptionsRef","trigger","preferCacheValue","reset","useQueryState","queryStateResults","info","querySubscriptionResults","debugValue","useDebugValue","useInfiniteQuerySubscription","hookRefetchCachedPages","stableHookRefetchCachedPages","direction","refetch","_formatProdErrorMessage3","mergedOptions","useInfiniteQueryState","fetchNextPage","fetchPreviousPage","name","fixedCacheKey","setPromise","triggerMutation","mutationSelector","originalArgs","finalState","reactHooksModuleName","reactHooksModule","batch","rrBatch","hooks","rrUseDispatch","rrUseSelector","rrUseStore","createSelector","_createSelector","unstable__sideEffectsInRender","rest","api","serializeQueryArgs","context","anyApi","buildQueryHooks","buildInfiniteQueryHooks","buildMutationHook","usePrefetch","buildHooks","safeAssign","endpointName","definition","isQueryDefinition","useQuery","useLazyQuery","useLazyQuerySubscription","useQueryState","useQuerySubscription","capitalize","isMutationDefinition","useMutation","isInfiniteQueryDefinition","useInfiniteQuery","useInfiniteQuerySubscription","useInfiniteQueryState","configureStore","_formatProdErrorMessage","React","ApiProvider","props","context","ReactReduxContext","useContext","_formatProdErrorMessage","store","configureStore","gDM","useEffect","setupListeners","Provider","createApi","buildCreateApi","coreModule","reactHooksModule"]}
Index: node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.legacy-esm.js
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.legacy-esm.js	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.legacy-esm.js	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,740 @@
+var __defProp = Object.defineProperty;
+var __defProps = Object.defineProperties;
+var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
+var __getOwnPropSymbols = Object.getOwnPropertySymbols;
+var __hasOwnProp = Object.prototype.hasOwnProperty;
+var __propIsEnum = Object.prototype.propertyIsEnumerable;
+var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+var __spreadValues = (a, b) => {
+  for (var prop in b || (b = {}))
+    if (__hasOwnProp.call(b, prop))
+      __defNormalProp(a, prop, b[prop]);
+  if (__getOwnPropSymbols)
+    for (var prop of __getOwnPropSymbols(b)) {
+      if (__propIsEnum.call(b, prop))
+        __defNormalProp(a, prop, b[prop]);
+    }
+  return a;
+};
+var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
+var __objRest = (source, exclude) => {
+  var target = {};
+  for (var prop in source)
+    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
+      target[prop] = source[prop];
+  if (source != null && __getOwnPropSymbols)
+    for (var prop of __getOwnPropSymbols(source)) {
+      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
+        target[prop] = source[prop];
+    }
+  return target;
+};
+
+// src/query/react/rtkqImports.ts
+import { buildCreateApi, coreModule, copyWithStructuralSharing, setupListeners, QueryStatus, skipToken } from "@reduxjs/toolkit/query";
+
+// src/query/react/module.ts
+import { formatProdErrorMessage as _formatProdErrorMessage4 } from "@reduxjs/toolkit";
+import { batch as rrBatch, useDispatch as rrUseDispatch, useSelector as rrUseSelector, useStore as rrUseStore } from "react-redux";
+import { createSelector as _createSelector } from "reselect";
+
+// src/query/utils/capitalize.ts
+function capitalize(str) {
+  return str.replace(str[0], str[0].toUpperCase());
+}
+
+// src/query/utils/countObjectKeys.ts
+function countObjectKeys(obj) {
+  let count = 0;
+  for (const _key in obj) {
+    count++;
+  }
+  return count;
+}
+
+// src/query/endpointDefinitions.ts
+var ENDPOINT_QUERY = "query" /* query */;
+var ENDPOINT_MUTATION = "mutation" /* mutation */;
+var ENDPOINT_INFINITEQUERY = "infinitequery" /* infinitequery */;
+function isQueryDefinition(e) {
+  return e.type === ENDPOINT_QUERY;
+}
+function isMutationDefinition(e) {
+  return e.type === ENDPOINT_MUTATION;
+}
+function isInfiniteQueryDefinition(e) {
+  return e.type === ENDPOINT_INFINITEQUERY;
+}
+
+// src/query/tsHelpers.ts
+function safeAssign(target, ...args) {
+  return Object.assign(target, ...args);
+}
+
+// src/query/react/buildHooks.ts
+import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3 } from "@reduxjs/toolkit";
+
+// src/query/react/reactImports.ts
+import { useEffect, useRef, useMemo, useContext, useCallback, useDebugValue, useLayoutEffect, useState } from "react";
+
+// src/query/react/reactReduxImports.ts
+import { shallowEqual, Provider, ReactReduxContext } from "react-redux";
+
+// src/query/react/constants.ts
+var UNINITIALIZED_VALUE = Symbol();
+
+// src/query/react/useSerializedStableValue.ts
+function useStableQueryArgs(queryArgs) {
+  const cache = useRef(queryArgs);
+  const copy = useMemo(() => copyWithStructuralSharing(cache.current, queryArgs), [queryArgs]);
+  useEffect(() => {
+    if (cache.current !== copy) {
+      cache.current = copy;
+    }
+  }, [copy]);
+  return copy;
+}
+
+// src/query/react/useShallowStableValue.ts
+function useShallowStableValue(value) {
+  const cache = useRef(value);
+  useEffect(() => {
+    if (!shallowEqual(cache.current, value)) {
+      cache.current = value;
+    }
+  }, [value]);
+  return shallowEqual(cache.current, value) ? cache.current : value;
+}
+
+// src/query/react/buildHooks.ts
+var canUseDOM = () => !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
+var isDOM = /* @__PURE__ */ canUseDOM();
+var isRunningInReactNative = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
+var isReactNative = /* @__PURE__ */ isRunningInReactNative();
+var getUseIsomorphicLayoutEffect = () => isDOM || isReactNative ? useLayoutEffect : useEffect;
+var useIsomorphicLayoutEffect = /* @__PURE__ */ getUseIsomorphicLayoutEffect();
+var noPendingQueryStateSelector = (selected) => {
+  if (selected.isUninitialized) {
+    return __spreadProps(__spreadValues({}, selected), {
+      isUninitialized: false,
+      isFetching: true,
+      isLoading: selected.data !== void 0 ? false : true,
+      // This is the one place where we still have to use `QueryStatus` as an enum,
+      // since it's the only reference in the React package and not in the core.
+      status: QueryStatus.pending
+    });
+  }
+  return selected;
+};
+function pick(obj, ...keys) {
+  const ret = {};
+  keys.forEach((key) => {
+    ret[key] = obj[key];
+  });
+  return ret;
+}
+var COMMON_HOOK_DEBUG_FIELDS = ["data", "status", "isLoading", "isSuccess", "isError", "error"];
+function buildHooks({
+  api,
+  moduleOptions: {
+    batch,
+    hooks: {
+      useDispatch,
+      useSelector,
+      useStore
+    },
+    unstable__sideEffectsInRender,
+    createSelector
+  },
+  serializeQueryArgs,
+  context
+}) {
+  const usePossiblyImmediateEffect = unstable__sideEffectsInRender ? (cb) => cb() : useEffect;
+  const unsubscribePromiseRef = (ref) => {
+    var _a, _b;
+    return (_b = (_a = ref.current) == null ? void 0 : _a.unsubscribe) == null ? void 0 : _b.call(_a);
+  };
+  const endpointDefinitions = context.endpointDefinitions;
+  return {
+    buildQueryHooks,
+    buildInfiniteQueryHooks,
+    buildMutationHook,
+    usePrefetch
+  };
+  function queryStatePreSelector(currentState, lastResult, queryArgs) {
+    if ((lastResult == null ? void 0 : lastResult.endpointName) && currentState.isUninitialized) {
+      const {
+        endpointName
+      } = lastResult;
+      const endpointDefinition = endpointDefinitions[endpointName];
+      if (queryArgs !== skipToken && serializeQueryArgs({
+        queryArgs: lastResult.originalArgs,
+        endpointDefinition,
+        endpointName
+      }) === serializeQueryArgs({
+        queryArgs,
+        endpointDefinition,
+        endpointName
+      })) lastResult = void 0;
+    }
+    let data = currentState.isSuccess ? currentState.data : lastResult == null ? void 0 : lastResult.data;
+    if (data === void 0) data = currentState.data;
+    const hasData = data !== void 0;
+    const isFetching = currentState.isLoading;
+    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;
+    const isSuccess = currentState.isSuccess || hasData && (isFetching && !(lastResult == null ? void 0 : lastResult.isError) || currentState.isUninitialized);
+    return __spreadProps(__spreadValues({}, currentState), {
+      data,
+      currentData: currentState.data,
+      isFetching,
+      isLoading,
+      isSuccess
+    });
+  }
+  function infiniteQueryStatePreSelector(currentState, lastResult, queryArgs) {
+    if ((lastResult == null ? void 0 : lastResult.endpointName) && currentState.isUninitialized) {
+      const {
+        endpointName
+      } = lastResult;
+      const endpointDefinition = endpointDefinitions[endpointName];
+      if (queryArgs !== skipToken && serializeQueryArgs({
+        queryArgs: lastResult.originalArgs,
+        endpointDefinition,
+        endpointName
+      }) === serializeQueryArgs({
+        queryArgs,
+        endpointDefinition,
+        endpointName
+      })) lastResult = void 0;
+    }
+    let data = currentState.isSuccess ? currentState.data : lastResult == null ? void 0 : lastResult.data;
+    if (data === void 0) data = currentState.data;
+    const hasData = data !== void 0;
+    const isFetching = currentState.isLoading;
+    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;
+    const isSuccess = currentState.isSuccess || isFetching && hasData;
+    return __spreadProps(__spreadValues({}, currentState), {
+      data,
+      currentData: currentState.data,
+      isFetching,
+      isLoading,
+      isSuccess
+    });
+  }
+  function usePrefetch(endpointName, defaultOptions) {
+    const dispatch = useDispatch();
+    const stableDefaultOptions = useShallowStableValue(defaultOptions);
+    return useCallback((arg, options) => dispatch(api.util.prefetch(endpointName, arg, __spreadValues(__spreadValues({}, stableDefaultOptions), options))), [endpointName, dispatch, stableDefaultOptions]);
+  }
+  function useQuerySubscriptionCommonImpl(endpointName, arg, _a = {}) {
+    var _b = _a, {
+      refetchOnReconnect,
+      refetchOnFocus,
+      refetchOnMountOrArgChange,
+      skip = false,
+      pollingInterval = 0,
+      skipPollingIfUnfocused = false
+    } = _b, rest = __objRest(_b, [
+      "refetchOnReconnect",
+      "refetchOnFocus",
+      "refetchOnMountOrArgChange",
+      "skip",
+      "pollingInterval",
+      "skipPollingIfUnfocused"
+    ]);
+    const {
+      initiate
+    } = api.endpoints[endpointName];
+    const dispatch = useDispatch();
+    const subscriptionSelectorsRef = useRef(void 0);
+    if (!subscriptionSelectorsRef.current) {
+      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());
+      if (process.env.NODE_ENV !== "production") {
+        if (typeof returnedValue !== "object" || typeof (returnedValue == null ? void 0 : returnedValue.type) === "string") {
+          throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage(37) : `Warning: Middleware for RTK-Query API at reducerPath "${api.reducerPath}" has not been added to the store.
+    You must add the middleware for RTK-Query to function correctly!`);
+        }
+      }
+      subscriptionSelectorsRef.current = returnedValue;
+    }
+    const stableArg = useStableQueryArgs(skip ? skipToken : arg);
+    const stableSubscriptionOptions = useShallowStableValue({
+      refetchOnReconnect,
+      refetchOnFocus,
+      pollingInterval,
+      skipPollingIfUnfocused
+    });
+    const initialPageParam = rest.initialPageParam;
+    const stableInitialPageParam = useShallowStableValue(initialPageParam);
+    const refetchCachedPages = rest.refetchCachedPages;
+    const stableRefetchCachedPages = useShallowStableValue(refetchCachedPages);
+    const promiseRef = useRef(void 0);
+    let {
+      queryCacheKey,
+      requestId
+    } = promiseRef.current || {};
+    let currentRenderHasSubscription = false;
+    if (queryCacheKey && requestId) {
+      currentRenderHasSubscription = subscriptionSelectorsRef.current.isRequestSubscribed(queryCacheKey, requestId);
+    }
+    const subscriptionRemoved = !currentRenderHasSubscription && promiseRef.current !== void 0;
+    usePossiblyImmediateEffect(() => {
+      if (subscriptionRemoved) {
+        promiseRef.current = void 0;
+      }
+    }, [subscriptionRemoved]);
+    usePossiblyImmediateEffect(() => {
+      var _a2;
+      const lastPromise = promiseRef.current;
+      if (typeof process !== "undefined" && process.env.NODE_ENV === "removeMeOnCompilation") {
+        console.log(subscriptionRemoved);
+      }
+      if (stableArg === skipToken) {
+        lastPromise == null ? void 0 : lastPromise.unsubscribe();
+        promiseRef.current = void 0;
+        return;
+      }
+      const lastSubscriptionOptions = (_a2 = promiseRef.current) == null ? void 0 : _a2.subscriptionOptions;
+      if (!lastPromise || lastPromise.arg !== stableArg) {
+        lastPromise == null ? void 0 : lastPromise.unsubscribe();
+        const promise = dispatch(initiate(stableArg, __spreadValues({
+          subscriptionOptions: stableSubscriptionOptions,
+          forceRefetch: refetchOnMountOrArgChange
+        }, isInfiniteQueryDefinition(endpointDefinitions[endpointName]) ? {
+          initialPageParam: stableInitialPageParam,
+          refetchCachedPages: stableRefetchCachedPages
+        } : {})));
+        promiseRef.current = promise;
+      } else if (stableSubscriptionOptions !== lastSubscriptionOptions) {
+        lastPromise.updateSubscriptionOptions(stableSubscriptionOptions);
+      }
+    }, [dispatch, initiate, refetchOnMountOrArgChange, stableArg, stableSubscriptionOptions, subscriptionRemoved, stableInitialPageParam, stableRefetchCachedPages, endpointName]);
+    return [promiseRef, dispatch, initiate, stableSubscriptionOptions];
+  }
+  function buildUseQueryState(endpointName, preSelector) {
+    const useQueryState = (arg, {
+      skip = false,
+      selectFromResult
+    } = {}) => {
+      const {
+        select
+      } = api.endpoints[endpointName];
+      const stableArg = useStableQueryArgs(skip ? skipToken : arg);
+      const lastValue = useRef(void 0);
+      const selectDefaultResult = useMemo(() => (
+        // Normally ts-ignores are bad and should be avoided, but we're
+        // already casting this selector to be `Selector<any>` anyway,
+        // so the inconsistencies don't matter here
+        // @ts-ignore
+        createSelector([
+          // @ts-ignore
+          select(stableArg),
+          (_, lastResult) => lastResult,
+          (_) => stableArg
+        ], preSelector, {
+          memoizeOptions: {
+            resultEqualityCheck: shallowEqual
+          }
+        })
+      ), [select, stableArg]);
+      const querySelector = useMemo(() => selectFromResult ? createSelector([selectDefaultResult], selectFromResult, {
+        devModeChecks: {
+          identityFunctionCheck: "never"
+        }
+      }) : selectDefaultResult, [selectDefaultResult, selectFromResult]);
+      const currentState = useSelector((state) => querySelector(state, lastValue.current), shallowEqual);
+      const store = useStore();
+      const newLastValue = selectDefaultResult(store.getState(), lastValue.current);
+      useIsomorphicLayoutEffect(() => {
+        lastValue.current = newLastValue;
+      }, [newLastValue]);
+      return currentState;
+    };
+    return useQueryState;
+  }
+  function usePromiseRefUnsubscribeOnUnmount(promiseRef) {
+    useEffect(() => {
+      return () => {
+        unsubscribePromiseRef(promiseRef);
+        promiseRef.current = void 0;
+      };
+    }, [promiseRef]);
+  }
+  function refetchOrErrorIfUnmounted(promiseRef) {
+    if (!promiseRef.current) throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage2(38) : "Cannot refetch a query that has not been started yet.");
+    return promiseRef.current.refetch();
+  }
+  function buildQueryHooks(endpointName) {
+    const useQuerySubscription = (arg, options = {}) => {
+      const [promiseRef] = useQuerySubscriptionCommonImpl(endpointName, arg, options);
+      usePromiseRefUnsubscribeOnUnmount(promiseRef);
+      return useMemo(() => ({
+        /**
+         * A method to manually refetch data for the query
+         */
+        refetch: () => refetchOrErrorIfUnmounted(promiseRef)
+      }), [promiseRef]);
+    };
+    const useLazyQuerySubscription = ({
+      refetchOnReconnect,
+      refetchOnFocus,
+      pollingInterval = 0,
+      skipPollingIfUnfocused = false
+    } = {}) => {
+      const {
+        initiate
+      } = api.endpoints[endpointName];
+      const dispatch = useDispatch();
+      const [arg, setArg] = useState(UNINITIALIZED_VALUE);
+      const promiseRef = useRef(void 0);
+      const stableSubscriptionOptions = useShallowStableValue({
+        refetchOnReconnect,
+        refetchOnFocus,
+        pollingInterval,
+        skipPollingIfUnfocused
+      });
+      usePossiblyImmediateEffect(() => {
+        var _a, _b;
+        const lastSubscriptionOptions = (_a = promiseRef.current) == null ? void 0 : _a.subscriptionOptions;
+        if (stableSubscriptionOptions !== lastSubscriptionOptions) {
+          (_b = promiseRef.current) == null ? void 0 : _b.updateSubscriptionOptions(stableSubscriptionOptions);
+        }
+      }, [stableSubscriptionOptions]);
+      const subscriptionOptionsRef = useRef(stableSubscriptionOptions);
+      usePossiblyImmediateEffect(() => {
+        subscriptionOptionsRef.current = stableSubscriptionOptions;
+      }, [stableSubscriptionOptions]);
+      const trigger = useCallback(function(arg2, preferCacheValue = false) {
+        let promise;
+        batch(() => {
+          unsubscribePromiseRef(promiseRef);
+          promiseRef.current = promise = dispatch(initiate(arg2, {
+            subscriptionOptions: subscriptionOptionsRef.current,
+            forceRefetch: !preferCacheValue
+          }));
+          setArg(arg2);
+        });
+        return promise;
+      }, [dispatch, initiate]);
+      const reset = useCallback(() => {
+        var _a, _b;
+        if ((_a = promiseRef.current) == null ? void 0 : _a.queryCacheKey) {
+          dispatch(api.internalActions.removeQueryResult({
+            queryCacheKey: (_b = promiseRef.current) == null ? void 0 : _b.queryCacheKey
+          }));
+        }
+      }, [dispatch]);
+      useEffect(() => {
+        return () => {
+          unsubscribePromiseRef(promiseRef);
+        };
+      }, []);
+      useEffect(() => {
+        if (arg !== UNINITIALIZED_VALUE && !promiseRef.current) {
+          trigger(arg, true);
+        }
+      }, [arg, trigger]);
+      return useMemo(() => [trigger, arg, {
+        reset
+      }], [trigger, arg, reset]);
+    };
+    const useQueryState = buildUseQueryState(endpointName, queryStatePreSelector);
+    return {
+      useQueryState,
+      useQuerySubscription,
+      useLazyQuerySubscription,
+      useLazyQuery(options) {
+        const [trigger, arg, {
+          reset
+        }] = useLazyQuerySubscription(options);
+        const queryStateResults = useQueryState(arg, __spreadProps(__spreadValues({}, options), {
+          skip: arg === UNINITIALIZED_VALUE
+        }));
+        const info = useMemo(() => ({
+          lastArg: arg
+        }), [arg]);
+        return useMemo(() => [trigger, __spreadProps(__spreadValues({}, queryStateResults), {
+          reset
+        }), info], [trigger, queryStateResults, reset, info]);
+      },
+      useQuery(arg, options) {
+        const querySubscriptionResults = useQuerySubscription(arg, options);
+        const queryStateResults = useQueryState(arg, __spreadValues({
+          selectFromResult: arg === skipToken || (options == null ? void 0 : options.skip) ? void 0 : noPendingQueryStateSelector
+        }, options));
+        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS);
+        useDebugValue(debugValue);
+        return useMemo(() => __spreadValues(__spreadValues({}, queryStateResults), querySubscriptionResults), [queryStateResults, querySubscriptionResults]);
+      }
+    };
+  }
+  function buildInfiniteQueryHooks(endpointName) {
+    const useInfiniteQuerySubscription = (arg, options = {}) => {
+      const [promiseRef, dispatch, initiate, stableSubscriptionOptions] = useQuerySubscriptionCommonImpl(endpointName, arg, options);
+      const subscriptionOptionsRef = useRef(stableSubscriptionOptions);
+      usePossiblyImmediateEffect(() => {
+        subscriptionOptionsRef.current = stableSubscriptionOptions;
+      }, [stableSubscriptionOptions]);
+      const hookRefetchCachedPages = options.refetchCachedPages;
+      const stableHookRefetchCachedPages = useShallowStableValue(hookRefetchCachedPages);
+      const trigger = useCallback(function(arg2, direction) {
+        let promise;
+        batch(() => {
+          unsubscribePromiseRef(promiseRef);
+          promiseRef.current = promise = dispatch(initiate(arg2, {
+            subscriptionOptions: subscriptionOptionsRef.current,
+            direction
+          }));
+        });
+        return promise;
+      }, [promiseRef, dispatch, initiate]);
+      usePromiseRefUnsubscribeOnUnmount(promiseRef);
+      const stableArg = useStableQueryArgs(options.skip ? skipToken : arg);
+      const refetch = useCallback((options2) => {
+        var _a;
+        if (!promiseRef.current) throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage3(38) : "Cannot refetch a query that has not been started yet.");
+        const mergedOptions = {
+          refetchCachedPages: (_a = options2 == null ? void 0 : options2.refetchCachedPages) != null ? _a : stableHookRefetchCachedPages
+        };
+        return promiseRef.current.refetch(mergedOptions);
+      }, [promiseRef, stableHookRefetchCachedPages]);
+      return useMemo(() => {
+        const fetchNextPage = () => {
+          return trigger(stableArg, "forward");
+        };
+        const fetchPreviousPage = () => {
+          return trigger(stableArg, "backward");
+        };
+        return {
+          trigger,
+          /**
+           * A method to manually refetch data for the query
+           */
+          refetch,
+          fetchNextPage,
+          fetchPreviousPage
+        };
+      }, [refetch, trigger, stableArg]);
+    };
+    const useInfiniteQueryState = buildUseQueryState(endpointName, infiniteQueryStatePreSelector);
+    return {
+      useInfiniteQueryState,
+      useInfiniteQuerySubscription,
+      useInfiniteQuery(arg, options) {
+        const {
+          refetch,
+          fetchNextPage,
+          fetchPreviousPage
+        } = useInfiniteQuerySubscription(arg, options);
+        const queryStateResults = useInfiniteQueryState(arg, __spreadValues({
+          selectFromResult: arg === skipToken || (options == null ? void 0 : options.skip) ? void 0 : noPendingQueryStateSelector
+        }, options));
+        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS, "hasNextPage", "hasPreviousPage");
+        useDebugValue(debugValue);
+        return useMemo(() => __spreadProps(__spreadValues({}, queryStateResults), {
+          fetchNextPage,
+          fetchPreviousPage,
+          refetch
+        }), [queryStateResults, fetchNextPage, fetchPreviousPage, refetch]);
+      }
+    };
+  }
+  function buildMutationHook(name) {
+    return ({
+      selectFromResult,
+      fixedCacheKey
+    } = {}) => {
+      const {
+        select,
+        initiate
+      } = api.endpoints[name];
+      const dispatch = useDispatch();
+      const [promise, setPromise] = useState();
+      useEffect(() => () => {
+        if (!(promise == null ? void 0 : promise.arg.fixedCacheKey)) {
+          promise == null ? void 0 : promise.reset();
+        }
+      }, [promise]);
+      const triggerMutation = useCallback(function(arg) {
+        const promise2 = dispatch(initiate(arg, {
+          fixedCacheKey
+        }));
+        setPromise(promise2);
+        return promise2;
+      }, [dispatch, initiate, fixedCacheKey]);
+      const {
+        requestId
+      } = promise || {};
+      const selectDefaultResult = useMemo(() => select({
+        fixedCacheKey,
+        requestId: promise == null ? void 0 : promise.requestId
+      }), [fixedCacheKey, promise, select]);
+      const mutationSelector = useMemo(() => selectFromResult ? createSelector([selectDefaultResult], selectFromResult) : selectDefaultResult, [selectFromResult, selectDefaultResult]);
+      const currentState = useSelector(mutationSelector, shallowEqual);
+      const originalArgs = fixedCacheKey == null ? promise == null ? void 0 : promise.arg.originalArgs : void 0;
+      const reset = useCallback(() => {
+        batch(() => {
+          if (promise) {
+            setPromise(void 0);
+          }
+          if (fixedCacheKey) {
+            dispatch(api.internalActions.removeMutationResult({
+              requestId,
+              fixedCacheKey
+            }));
+          }
+        });
+      }, [dispatch, fixedCacheKey, promise, requestId]);
+      const debugValue = pick(currentState, ...COMMON_HOOK_DEBUG_FIELDS, "endpointName");
+      useDebugValue(debugValue);
+      const finalState = useMemo(() => __spreadProps(__spreadValues({}, currentState), {
+        originalArgs,
+        reset
+      }), [currentState, originalArgs, reset]);
+      return useMemo(() => [triggerMutation, finalState], [triggerMutation, finalState]);
+    };
+  }
+}
+
+// src/query/react/module.ts
+var reactHooksModuleName = /* @__PURE__ */ Symbol();
+var reactHooksModule = (_a = {}) => {
+  var _b = _a, {
+    batch = rrBatch,
+    hooks = {
+      useDispatch: rrUseDispatch,
+      useSelector: rrUseSelector,
+      useStore: rrUseStore
+    },
+    createSelector = _createSelector,
+    unstable__sideEffectsInRender = false
+  } = _b, rest = __objRest(_b, [
+    "batch",
+    "hooks",
+    "createSelector",
+    "unstable__sideEffectsInRender"
+  ]);
+  if (process.env.NODE_ENV !== "production") {
+    const hookNames = ["useDispatch", "useSelector", "useStore"];
+    let warned = false;
+    for (const hookName of hookNames) {
+      if (countObjectKeys(rest) > 0) {
+        if (rest[hookName]) {
+          if (!warned) {
+            console.warn("As of RTK 2.0, the hooks now need to be specified as one object, provided under a `hooks` key:\n`reactHooksModule({ hooks: { useDispatch, useSelector, useStore } })`");
+            warned = true;
+          }
+        }
+        hooks[hookName] = rest[hookName];
+      }
+      if (typeof hooks[hookName] !== "function") {
+        throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage4(36) : `When using custom hooks for context, all ${hookNames.length} hooks need to be provided: ${hookNames.join(", ")}.
+Hook ${hookName} was either not provided or not a function.`);
+      }
+    }
+  }
+  return {
+    name: reactHooksModuleName,
+    init(api, {
+      serializeQueryArgs
+    }, context) {
+      const anyApi = api;
+      const {
+        buildQueryHooks,
+        buildInfiniteQueryHooks,
+        buildMutationHook,
+        usePrefetch
+      } = buildHooks({
+        api,
+        moduleOptions: {
+          batch,
+          hooks,
+          unstable__sideEffectsInRender,
+          createSelector
+        },
+        serializeQueryArgs,
+        context
+      });
+      safeAssign(anyApi, {
+        usePrefetch
+      });
+      safeAssign(context, {
+        batch
+      });
+      return {
+        injectEndpoint(endpointName, definition) {
+          if (isQueryDefinition(definition)) {
+            const {
+              useQuery,
+              useLazyQuery,
+              useLazyQuerySubscription,
+              useQueryState,
+              useQuerySubscription
+            } = buildQueryHooks(endpointName);
+            safeAssign(anyApi.endpoints[endpointName], {
+              useQuery,
+              useLazyQuery,
+              useLazyQuerySubscription,
+              useQueryState,
+              useQuerySubscription
+            });
+            api[`use${capitalize(endpointName)}Query`] = useQuery;
+            api[`useLazy${capitalize(endpointName)}Query`] = useLazyQuery;
+          }
+          if (isMutationDefinition(definition)) {
+            const useMutation = buildMutationHook(endpointName);
+            safeAssign(anyApi.endpoints[endpointName], {
+              useMutation
+            });
+            api[`use${capitalize(endpointName)}Mutation`] = useMutation;
+          } else if (isInfiniteQueryDefinition(definition)) {
+            const {
+              useInfiniteQuery,
+              useInfiniteQuerySubscription,
+              useInfiniteQueryState
+            } = buildInfiniteQueryHooks(endpointName);
+            safeAssign(anyApi.endpoints[endpointName], {
+              useInfiniteQuery,
+              useInfiniteQuerySubscription,
+              useInfiniteQueryState
+            });
+            api[`use${capitalize(endpointName)}InfiniteQuery`] = useInfiniteQuery;
+          }
+        }
+      };
+    }
+  };
+};
+
+// src/query/react/index.ts
+export * from "@reduxjs/toolkit/query";
+
+// src/query/react/ApiProvider.tsx
+import { configureStore, formatProdErrorMessage as _formatProdErrorMessage5 } from "@reduxjs/toolkit";
+import * as React from "react";
+function ApiProvider(props) {
+  const context = props.context || ReactReduxContext;
+  const existingContext = useContext(context);
+  if (existingContext) {
+    throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage5(35) : "Existing Redux context detected. If you already have a store set up, please use the traditional Redux setup.");
+  }
+  const [store] = React.useState(() => configureStore({
+    reducer: {
+      [props.api.reducerPath]: props.api.reducer
+    },
+    middleware: (gDM) => gDM().concat(props.api.middleware)
+  }));
+  useEffect(() => props.setupListeners === false ? void 0 : setupListeners(store.dispatch, props.setupListeners), [props.setupListeners, store.dispatch]);
+  return /* @__PURE__ */ React.createElement(Provider, { store, context }, props.children);
+}
+
+// src/query/react/index.ts
+var createApi = /* @__PURE__ */ buildCreateApi(coreModule(), reactHooksModule());
+export {
+  ApiProvider,
+  UNINITIALIZED_VALUE,
+  createApi,
+  reactHooksModule,
+  reactHooksModuleName
+};
+//# sourceMappingURL=rtk-query-react.legacy-esm.js.map
Index: node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.legacy-esm.js.map
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.legacy-esm.js.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.legacy-esm.js.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,1 @@
+{"version":3,"sources":["../../../src/query/react/rtkqImports.ts","../../../src/query/react/module.ts","../../../src/query/utils/capitalize.ts","../../../src/query/utils/countObjectKeys.ts","../../../src/query/endpointDefinitions.ts","../../../src/query/tsHelpers.ts","../../../src/query/react/buildHooks.ts","../../../src/query/react/reactImports.ts","../../../src/query/react/reactReduxImports.ts","../../../src/query/react/constants.ts","../../../src/query/react/useSerializedStableValue.ts","../../../src/query/react/useShallowStableValue.ts","../../../src/query/react/index.ts","../../../src/query/react/ApiProvider.tsx"],"sourcesContent":["export { buildCreateApi, coreModule, copyWithStructuralSharing, setupListeners, QueryStatus, skipToken } from '@reduxjs/toolkit/query';","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { Api, BaseQueryFn, EndpointDefinitions, InfiniteQueryDefinition, Module, MutationDefinition, PrefetchOptions, QueryArgFrom, QueryDefinition, QueryKeys } from '@reduxjs/toolkit/query';\nimport { batch as rrBatch, useDispatch as rrUseDispatch, useSelector as rrUseSelector, useStore as rrUseStore } from 'react-redux';\nimport type { CreateSelectorFunction } from 'reselect';\nimport { createSelector as _createSelector } from 'reselect';\nimport { isInfiniteQueryDefinition, isMutationDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { safeAssign } from '../tsHelpers';\nimport { capitalize, countObjectKeys } from '../utils';\nimport type { InfiniteQueryHooks, MutationHooks, QueryHooks } from './buildHooks';\nimport { buildHooks } from './buildHooks';\nimport type { HooksWithUniqueNames } from './namedHooks';\nexport const reactHooksModuleName = /* @__PURE__ */Symbol();\nexport type ReactHooksModule = typeof reactHooksModuleName;\ndeclare module '@reduxjs/toolkit/query' {\n  export interface ApiModules<\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions,\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  ReducerPath extends string,\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  TagTypes extends string> {\n    [reactHooksModuleName]: {\n      /**\n       *  Endpoints based on the input endpoints provided to `createApi`, containing `select`, `hooks` and `action matchers`.\n       */\n      endpoints: { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? QueryHooks<Definitions[K]> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? MutationHooks<Definitions[K]> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryHooks<Definitions[K]> : never };\n      /**\n       * A hook that accepts a string endpoint name, and provides a callback that when called, pre-fetches the data for that endpoint.\n       */\n      usePrefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, options?: PrefetchOptions): (arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions) => void;\n    } & HooksWithUniqueNames<Definitions>;\n  }\n}\ntype RR = typeof import('react-redux');\nexport interface ReactHooksModuleOptions {\n  /**\n   * The hooks from React Redux to be used\n   */\n  hooks?: {\n    /**\n     * The version of the `useDispatch` hook to be used\n     */\n    useDispatch: RR['useDispatch'];\n    /**\n     * The version of the `useSelector` hook to be used\n     */\n    useSelector: RR['useSelector'];\n    /**\n     * The version of the `useStore` hook to be used\n     */\n    useStore: RR['useStore'];\n  };\n  /**\n   * The version of the `batchedUpdates` function to be used\n   */\n  batch?: RR['batch'];\n  /**\n   * Enables performing asynchronous tasks immediately within a render.\n   *\n   * @example\n   *\n   * ```ts\n   * import {\n   *   buildCreateApi,\n   *   coreModule,\n   *   reactHooksModule\n   * } from '@reduxjs/toolkit/query/react'\n   *\n   * const createApi = buildCreateApi(\n   *   coreModule(),\n   *   reactHooksModule({ unstable__sideEffectsInRender: true })\n   * )\n   * ```\n   */\n  unstable__sideEffectsInRender?: boolean;\n  /**\n   * A selector creator (usually from `reselect`, or matching the same signature)\n   */\n  createSelector?: CreateSelectorFunction<any, any, any>;\n}\n\n/**\n * Creates a module that generates react hooks from endpoints, for use with `buildCreateApi`.\n *\n *  @example\n * ```ts\n * const MyContext = React.createContext<ReactReduxContextValue | null>(null);\n * const customCreateApi = buildCreateApi(\n *   coreModule(),\n *   reactHooksModule({\n *     hooks: {\n *       useDispatch: createDispatchHook(MyContext),\n *       useSelector: createSelectorHook(MyContext),\n *       useStore: createStoreHook(MyContext)\n *     }\n *   })\n * );\n * ```\n *\n * @returns A module for use with `buildCreateApi`\n */\nexport const reactHooksModule = ({\n  batch = rrBatch,\n  hooks = {\n    useDispatch: rrUseDispatch,\n    useSelector: rrUseSelector,\n    useStore: rrUseStore\n  },\n  createSelector = _createSelector,\n  unstable__sideEffectsInRender = false,\n  ...rest\n}: ReactHooksModuleOptions = {}): Module<ReactHooksModule> => {\n  if (process.env.NODE_ENV !== 'production') {\n    const hookNames = ['useDispatch', 'useSelector', 'useStore'] as const;\n    let warned = false;\n    for (const hookName of hookNames) {\n      // warn for old hook options\n      if (countObjectKeys(rest) > 0) {\n        if ((rest as Partial<typeof hooks>)[hookName]) {\n          if (!warned) {\n            console.warn('As of RTK 2.0, the hooks now need to be specified as one object, provided under a `hooks` key:' + '\\n`reactHooksModule({ hooks: { useDispatch, useSelector, useStore } })`');\n            warned = true;\n          }\n        }\n        // migrate\n        // @ts-ignore\n        hooks[hookName] = rest[hookName];\n      }\n      // then make sure we have them all\n      if (typeof hooks[hookName] !== 'function') {\n        throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(36) : `When using custom hooks for context, all ${hookNames.length} hooks need to be provided: ${hookNames.join(', ')}.\\nHook ${hookName} was either not provided or not a function.`);\n      }\n    }\n  }\n  return {\n    name: reactHooksModuleName,\n    init(api, {\n      serializeQueryArgs\n    }, context) {\n      const anyApi = api as any as Api<any, Record<string, any>, any, any, ReactHooksModule>;\n      const {\n        buildQueryHooks,\n        buildInfiniteQueryHooks,\n        buildMutationHook,\n        usePrefetch\n      } = buildHooks({\n        api,\n        moduleOptions: {\n          batch,\n          hooks,\n          unstable__sideEffectsInRender,\n          createSelector\n        },\n        serializeQueryArgs,\n        context\n      });\n      safeAssign(anyApi, {\n        usePrefetch\n      });\n      safeAssign(context, {\n        batch\n      });\n      return {\n        injectEndpoint(endpointName, definition) {\n          if (isQueryDefinition(definition)) {\n            const {\n              useQuery,\n              useLazyQuery,\n              useLazyQuerySubscription,\n              useQueryState,\n              useQuerySubscription\n            } = buildQueryHooks(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useQuery,\n              useLazyQuery,\n              useLazyQuerySubscription,\n              useQueryState,\n              useQuerySubscription\n            });\n            (api as any)[`use${capitalize(endpointName)}Query`] = useQuery;\n            (api as any)[`useLazy${capitalize(endpointName)}Query`] = useLazyQuery;\n          }\n          if (isMutationDefinition(definition)) {\n            const useMutation = buildMutationHook(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useMutation\n            });\n            (api as any)[`use${capitalize(endpointName)}Mutation`] = useMutation;\n          } else if (isInfiniteQueryDefinition(definition)) {\n            const {\n              useInfiniteQuery,\n              useInfiniteQuerySubscription,\n              useInfiniteQueryState\n            } = buildInfiniteQueryHooks(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useInfiniteQuery,\n              useInfiniteQuerySubscription,\n              useInfiniteQueryState\n            });\n            (api as any)[`use${capitalize(endpointName)}InfiniteQuery`] = useInfiniteQuery;\n          }\n        }\n      };\n    }\n  };\n};","export function capitalize(str: string) {\n  return str.replace(str[0], str[0].toUpperCase());\n}","// Fast method for counting an object's keys\n// without resorting to `Object.keys(obj).length\n// Will this make a big difference in perf? Probably not\n// But we can save a few allocations.\n\nexport function countObjectKeys(obj: Record<any, any>) {\n  let count = 0;\n  for (const _key in obj) {\n    count++;\n  }\n  return count;\n}","import type { Api } from '@reduxjs/toolkit/query';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { BaseQueryApi, BaseQueryArg, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta, BaseQueryResult, QueryReturnValue } from './baseQueryTypes';\nimport type { CacheCollectionQueryExtraOptions } from './core/buildMiddleware/cacheCollection';\nimport type { CacheLifecycleInfiniteQueryExtraOptions, CacheLifecycleMutationExtraOptions, CacheLifecycleQueryExtraOptions } from './core/buildMiddleware/cacheLifecycle';\nimport type { QueryLifecycleInfiniteQueryExtraOptions, QueryLifecycleMutationExtraOptions, QueryLifecycleQueryExtraOptions } from './core/buildMiddleware/queryLifecycle';\nimport type { InfiniteData, InfiniteQueryConfigOptions, QuerySubState, RootState } from './core/index';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { NEVER } from './fakeBaseQuery';\nimport type { CastAny, HasRequiredProps, MaybePromise, NonUndefined, OmitFromUnion, UnwrapPromise } from './tsHelpers';\nimport { isNotNullish } from './utils';\nimport type { NamedSchemaError } from './standardSchema';\nimport { filterMap } from './utils/filterMap';\nconst rawResultType = /* @__PURE__ */Symbol();\nconst resultType = /* @__PURE__ */Symbol();\nconst baseQuery = /* @__PURE__ */Symbol();\nexport interface SchemaFailureInfo {\n  endpoint: string;\n  arg: any;\n  type: 'query' | 'mutation';\n  queryCacheKey?: string;\n}\nexport type SchemaFailureHandler = (error: NamedSchemaError, info: SchemaFailureInfo) => void;\nexport type SchemaFailureConverter<BaseQuery extends BaseQueryFn> = (error: NamedSchemaError, info: SchemaFailureInfo) => BaseQueryError<BaseQuery>;\nexport type EndpointDefinitionWithQuery<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery>> = {\n  /**\n   * `query` can be a function that returns either a `string` or an `object` which is passed to your `baseQuery`. If you are using [fetchBaseQuery](./fetchBaseQuery), this can return either a `string` or an `object` of properties in `FetchArgs`. If you use your own custom [`baseQuery`](../../rtk-query/usage/customizing-queries), you can customize this behavior to your liking.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"query example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       // highlight-start\n   *       query: () => 'posts',\n   *       // highlight-end\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *      // highlight-start\n   *      query: (body) => ({\n   *        url: `posts`,\n   *        method: 'POST',\n   *        body,\n   *      }),\n   *      // highlight-end\n   *      invalidatesTags: [{ type: 'Post', id: 'LIST' }],\n   *    }),\n   *   })\n   * })\n   * ```\n   */\n  query(arg: QueryArg): BaseQueryArg<BaseQuery>;\n  queryFn?: never;\n  /**\n   * A function to manipulate the data returned by a query or mutation.\n   */\n  transformResponse?(baseQueryReturnValue: RawResultType, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): ResultType | Promise<ResultType>;\n  /**\n   * A function to manipulate the data returned by a failed query or mutation.\n   */\n  transformErrorResponse?(baseQueryReturnValue: BaseQueryError<BaseQuery>, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): unknown;\n\n  /**\n   * A schema for the result *before* it's passed to `transformResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPostName: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawResponseSchema: postSchema,\n   *       transformResponse: (post) => post.name,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawResponseSchema?: StandardSchemaV1<RawResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn`, *before* it's passed to `transformErrorResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import {customBaseQuery, baseQueryErrorSchema} from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawErrorResponseSchema: baseQueryErrorSchema,\n   *       transformErrorResponse: (error) => error.data,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawErrorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n};\nexport type EndpointDefinitionWithQueryFn<QueryArg, BaseQuery extends BaseQueryFn, ResultType> = {\n  /**\n   * Can be used in place of `query` as an inline function that bypasses `baseQuery` completely for the endpoint.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Basic queryFn example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *     }),\n   *     flipCoin: build.query<'heads' | 'tails', void>({\n   *       // highlight-start\n   *       queryFn(arg, queryApi, extraOptions, baseQuery) {\n   *         const randomVal = Math.random()\n   *         if (randomVal < 0.45) {\n   *           return { data: 'heads' }\n   *         }\n   *         if (randomVal < 0.9) {\n   *           return { data: 'tails' }\n   *         }\n   *         return { error: { status: 500, statusText: 'Internal Server Error', data: \"Coin landed on its edge!\" } }\n   *       }\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  queryFn(arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions<BaseQuery>, baseQuery: (arg: Parameters<BaseQuery>[0]) => ReturnType<BaseQuery>): MaybePromise<QueryReturnValue<ResultType, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>>;\n  query?: never;\n  transformResponse?: never;\n  transformErrorResponse?: never;\n  rawResponseSchema?: never;\n  rawErrorResponseSchema?: never;\n};\ntype BaseEndpointTypes<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType> = {\n  QueryArg: QueryArg;\n  BaseQuery: BaseQuery;\n  ResultType: ResultType;\n  RawResultType: RawResultType;\n};\nexport type SchemaType = 'arg' | 'rawResponse' | 'response' | 'rawErrorResponse' | 'errorResponse' | 'meta';\ninterface CommonEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType> {\n  /**\n   * A schema for the arguments to be passed to the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       argSchema: v.object({ id: v.number() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  argSchema?: StandardSchemaV1<QueryArg>;\n\n  /**\n   * A schema for the result (including `transformResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: postSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  responseSchema?: StandardSchemaV1<ResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn` (including `transformErrorResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryErrorSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       errorResponseSchema: baseQueryErrorSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  errorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n\n  /**\n   * A schema for the `meta` property returned by the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryMetaSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       metaSchema: baseQueryMetaSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  metaSchema?: StandardSchemaV1<BaseQueryMeta<BaseQuery>>;\n\n  /**\n   * Defaults to `true`.\n   *\n   * Most apps should leave this setting on. The only time it can be a performance issue\n   * is if an API returns extremely large amounts of data (e.g. 10,000 rows per request) and\n   * you're unable to paginate it.\n   *\n   * For details of how this works, please see the below. When it is set to `false`,\n   * every request will cause subscribed components to rerender, even when the data has not changed.\n   *\n   * @see https://redux-toolkit.js.org/api/other-exports#copywithstructuralsharing\n   */\n  structuralSharing?: boolean;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       onSchemaFailure: (error, info) => {\n   *         console.error(error, info)\n   *       },\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       catchSchemaFailure: (error, info) => ({\n   *         status: \"CUSTOM_ERROR\",\n   *         error: error.schemaName + \" failed validation\",\n   *         data: error.issues,\n   *       }),\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for this endpoint.\n   * Overrides the global setting.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type BaseEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = (([CastAny<BaseQueryResult<BaseQuery>, {}>] extends [NEVER] ? never : EndpointDefinitionWithQuery<QueryArg, BaseQuery, ResultType, RawResultType>) | EndpointDefinitionWithQueryFn<QueryArg, BaseQuery, ResultType>) & CommonEndpointDefinition<QueryArg, BaseQuery, ResultType> & {\n  /* phantom type */\n  [rawResultType]?: RawResultType;\n  /* phantom type */\n  [resultType]?: ResultType;\n  /* phantom type */\n  [baseQuery]?: BaseQuery;\n} & HasRequiredProps<BaseQueryExtraOptions<BaseQuery>, {\n  extraOptions: BaseQueryExtraOptions<BaseQuery>;\n}, {\n  extraOptions?: BaseQueryExtraOptions<BaseQuery>;\n}>;\n\n// NOTE As with QueryStatus in `apiState.ts`, don't use this for real comparisons\n// at runtime, use the string constants defined below.\nexport enum DefinitionType {\n  query = 'query',\n  mutation = 'mutation',\n  infinitequery = 'infinitequery',\n}\nexport const ENDPOINT_QUERY = DefinitionType.query;\nexport const ENDPOINT_MUTATION = DefinitionType.mutation;\nexport const ENDPOINT_INFINITEQUERY = DefinitionType.infinitequery;\ntype TagDescriptionArray<TagTypes extends string> = ReadonlyArray<TagDescription<TagTypes> | undefined | null>;\nexport type GetResultDescriptionFn<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = (result: ResultType | undefined, error: ErrorType | undefined, arg: QueryArg, meta: MetaType) => TagDescriptionArray<TagTypes>;\nexport type FullTagDescription<TagType> = {\n  type: TagType;\n  id?: number | string;\n};\nexport type TagDescription<TagType> = TagType | FullTagDescription<TagType>;\n\n/**\n * @public\n */\nexport type ResultDescription<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = TagDescriptionArray<TagTypes> | GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>;\ntype QueryTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  QueryDefinition: QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface QueryExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.query;\n\n  /**\n   * Used by `query` endpoints. Determines which 'tag' is attached to the cached data returned by the query.\n   * Expects an array of tag type strings, an array of objects of tag types with ids, or a function that returns such an array.\n   * 1.  `['Post']` - equivalent to `2`\n   * 2.  `[{ type: 'Post' }]` - equivalent to `1`\n   * 3.  `[{ type: 'Post', id: 1 }]`\n   * 4.  `(result, error, arg) => ['Post']` - equivalent to `5`\n   * 5.  `(result, error, arg) => [{ type: 'Post' }]` - equivalent to `4`\n   * 6.  `(result, error, arg) => [{ type: 'Post', id: 1 }]`\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"providesTags example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       // highlight-start\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  providesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * Can be provided to merge an incoming response value into the current cache data.\n   * If supplied, no automatic structural sharing will be applied - it's up to\n   * you to update the cache appropriately.\n   *\n   * Since RTKQ normally replaces cache entries with the new response, you will usually\n   * need to use this with the `serializeQueryArgs` or `forceRefetch` options to keep\n   * an existing cache entry so that it can be updated.\n   *\n   * Since this is wrapped with Immer, you may either mutate the `currentCacheValue` directly,\n   * or return a new value, but _not_ both at once.\n   *\n   * Will only be called if the existing `currentCacheData` is _not_ `undefined` - on first response,\n   * the cache entry will just save the response data directly.\n   *\n   * Useful if you don't want a new request to completely override the current cache value,\n   * maybe because you have manually updated it from another source and don't want those\n   * updates to get lost.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"merge: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  merge?(currentCacheData: ResultType, responseData: ResultType, otherArgs: {\n    arg: QueryArg;\n    baseQueryMeta: BaseQueryMeta<BaseQuery>;\n    requestId: string;\n    fulfilledTimeStamp: number;\n  }): ResultType | void;\n\n  /**\n   * Check to see if the endpoint should force a refetch in cases where it normally wouldn't.\n   * This is primarily useful for \"infinite scroll\" / pagination use cases where\n   * RTKQ is keeping a single cache entry that is added to over time, in combination\n   * with `serializeQueryArgs` returning a fixed cache key and a `merge` callback\n   * set to add incoming data to the cache entry each time.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"forceRefresh: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  forceRefetch?(params: {\n    currentArg: QueryArg | undefined;\n    previousArg: QueryArg | undefined;\n    state: RootState<any, any, string>;\n    endpointState?: QuerySubState<any>;\n  }): boolean;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: QueryTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type QueryDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & QueryExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type InfiniteQueryTypes<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  InfiniteQueryDefinition: InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\nexport interface InfiniteQueryExtraOptions<TagTypes extends string, ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.infinitequery;\n  providesTags?: ResultDescription<TagTypes, InfiniteData<ResultType, PageParam>, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Required options to configure the infinite query behavior.\n   * `initialPageParam` and `getNextPageParam` are required, to\n   * ensure the infinite query can properly fetch the next page of data.\n   * `initialPageParam` may be specified when using the\n   * endpoint, to override the default value.\n   * `maxPages` and `getPreviousPageParam` are both optional.\n   * \n   * @example\n   * \n   * ```ts\n   * // codeblock-meta title=\"infiniteQueryOptions example\"\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * \n   * type Pokemon = {\n   *   id: string\n   *   name: string\n   * }\n   * \n   * const pokemonApi = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),\n   *   endpoints: (build) => ({\n   *     getInfinitePokemonWithMax: build.infiniteQuery<Pokemon[], string, number>({\n   *       infiniteQueryOptions: {\n   *         initialPageParam: 0,\n   *         maxPages: 3,\n   *         getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) =>\n   *           lastPageParam + 1,\n   *         getPreviousPageParam: (\n   *           firstPage,\n   *           allPages,\n   *           firstPageParam,\n   *           allPageParams,\n   *         ) => {\n   *           return firstPageParam > 0 ? firstPageParam - 1 : undefined\n   *         },\n   *       },\n   *       query({pageParam}) {\n   *         return `https://example.com/listItems?page=${pageParam}`\n   *       },\n   *     }),\n   *   }),\n   * })\n   \n   * ```\n   */\n  infiniteQueryOptions: InfiniteQueryConfigOptions<ResultType, PageParam, QueryArg>;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: InfiniteQueryTypes<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> =\n// Infinite query endpoints receive `{queryArg, pageParam}`\nBaseEndpointDefinition<InfiniteQueryCombinedArg<QueryArg, PageParam>, BaseQuery, ResultType, RawResultType> & InfiniteQueryExtraOptions<TagTypes, ResultType, QueryArg, PageParam, BaseQuery, ReducerPath, RawResultType>;\ntype MutationTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseMutation<typeof api.endpoints.query.Types.MutationDefinition> = ...\n   * ```\n   */\n  MutationDefinition: MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface MutationExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath> {\n  type: DefinitionType.mutation;\n\n  /**\n   * Used by `mutation` endpoints. Determines which cached data should be either re-fetched or removed from the cache.\n   * Expects the same shapes as `providesTags`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"invalidatesTags example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *       query(body) {\n   *         return {\n   *           url: `posts`,\n   *           method: 'POST',\n   *           body,\n   *         }\n   *       },\n   *       // highlight-start\n   *       invalidatesTags: [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  invalidatesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A mutation should not provide tags to the cache.\n   */\n  providesTags?: never;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: MutationTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type MutationDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & MutationExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type EndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, PageParam = any, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\nexport type EndpointDefinitions = Record<string, EndpointDefinition<any, any, any, any, any, any, any>>;\nexport function isQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is QueryDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_QUERY;\n}\nexport function isMutationDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is MutationDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_MUTATION;\n}\nexport function isInfiniteQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is InfiniteQueryDefinition<any, any, any, any, any, any, any> {\n  return e.type === ENDPOINT_INFINITEQUERY;\n}\nexport function isAnyQueryDefinition(e: EndpointDefinition<any, any, any, any>): e is QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any> {\n  return isQueryDefinition(e) || isInfiniteQueryDefinition(e);\n}\nexport type EndpointBuilder<BaseQuery extends BaseQueryFn, TagTypes extends string, ReducerPath extends string> = {\n  /**\n   * An endpoint definition that retrieves data, and may provide tags to the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all query endpoint options\"\n   * const api = createApi({\n   *  baseQuery,\n   *  endpoints: (build) => ({\n   *    getPost: build.query({\n   *      query: (id) => ({ url: `post/${id}` }),\n   *      // Pick out data and prevent nested properties in a hook or selector\n   *      transformResponse: (response) => response.data,\n   *      // Pick out error and prevent nested properties in a hook or selector\n   *      transformErrorResponse: (response) => response.error,\n   *      // `result` is the server response\n   *      providesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry, updateCachedData }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry, updateCachedData }) {},\n   *    }),\n   *  }),\n   *});\n   *```\n   */\n  query<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n\n  /**\n   * An endpoint definition that alters data on the server or will possibly invalidate the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all mutation endpoint options\"\n   * const api = createApi({\n   *   baseQuery,\n   *   endpoints: (build) => ({\n   *     updatePost: build.mutation({\n   *       query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),\n   *       // Pick out data and prevent nested properties in a hook or selector\n   *       transformResponse: (response) => response.data,\n   *       // Pick out error and prevent nested properties in a hook or selector\n   *       transformErrorResponse: (response) => response.error,\n   *       // `result` is the server response\n   *       invalidatesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry }) {},\n   *     }),\n   *   }),\n   * });\n   * ```\n   */\n  mutation<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n  infiniteQuery<ResultType, QueryArg, PageParam, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n};\nexport type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T;\nexport function calculateProvidedBy<ResultType, QueryArg, ErrorType, MetaType>(description: ResultDescription<string, ResultType, QueryArg, ErrorType, MetaType> | undefined, result: ResultType | undefined, error: ErrorType | undefined, queryArg: QueryArg, meta: MetaType | undefined, assertTagTypes: AssertTagTypes): readonly FullTagDescription<string>[] {\n  const finalDescription = isFunction(description) ? description(result as ResultType, error as undefined, queryArg, meta as MetaType) : description;\n  if (finalDescription) {\n    return filterMap(finalDescription, isNotNullish, tag => assertTagTypes(expandTagDescription(tag)));\n  }\n  return [];\n}\nfunction isFunction<T>(t: T): t is Extract<T, Function> {\n  return typeof t === 'function';\n}\nexport function expandTagDescription(description: TagDescription<string>): FullTagDescription<string> {\n  return typeof description === 'string' ? {\n    type: description\n  } : description;\n}\nexport type QueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<infer QA, any, any, any> ? QA : never;\n\n// Just extracting `QueryArg` from `BaseEndpointDefinition`\n// doesn't sufficiently match here.\n// We need to explicitly match against `InfiniteQueryDefinition`\nexport type InfiniteQueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<infer QA, any, any, any, any, any, any> ? QA : never;\nexport type QueryArgFromAnyQuery<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any, any, any> ? InfiniteQueryArgFrom<D> : D extends QueryDefinition<any, any, any, any, any, any> ? QueryArgFrom<D> : never;\nexport type ResultTypeFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<any, any, infer RT, any> ? RT : unknown;\nexport type ReducerPathFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, any, any, infer RP, any, any> ? RP : unknown;\nexport type TagTypesFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, infer TT, any, any, any, any> ? TT : unknown;\nexport type PageParamFrom<D extends InfiniteQueryDefinition<any, any, any, any, any, any, any>> = D extends InfiniteQueryDefinition<any, infer PP, any, any, any, any, any> ? PP : unknown;\nexport type InfiniteQueryCombinedArg<QueryArg, PageParam> = {\n  queryArg: QueryArg;\n  pageParam: PageParam;\n};\nexport type TagTypesFromApi<T> = T extends Api<any, any, any, infer TagTypes> ? TagTypes : never;\nexport type DefinitionsFromApi<T> = T extends Api<any, infer Definitions, any, any> ? Definitions : never;\nexport type TransformedResponse<NewDefinitions extends EndpointDefinitions, K, ResultType> = K extends keyof NewDefinitions ? NewDefinitions[K]['transformResponse'] extends undefined ? ResultType : UnwrapPromise<ReturnType<NonUndefined<NewDefinitions[K]['transformResponse']>>> : ResultType;\nexport type OverrideResultType<Definition, NewResultType> = Definition extends QueryDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends MutationDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, NewResultType, ReducerPath> : never;\nexport type UpdateDefinitions<Definitions extends EndpointDefinitions, NewTagTypes extends string, NewDefinitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends MutationDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : never };","export type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type Override<T1, T2> = T2 extends any ? Omit<T1, keyof T2> & T2 : never;\nexport function assertCast<T>(v: any): asserts v is T {}\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>): T {\n  return Object.assign(target, ...args);\n}\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\nexport type NonOptionalKeys<T> = { [K in keyof T]-?: undefined extends T[K] ? never : K }[keyof T];\nexport type HasRequiredProps<T, True, False> = NonOptionalKeys<T> extends never ? False : True;\nexport type OptionalIfAllPropsOptional<T> = HasRequiredProps<T, T, T | never>;\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type UnwrapPromise<T> = T extends PromiseLike<infer V> ? V : T;\nexport type MaybePromise<T> = T | PromiseLike<T>;\nexport type OmitFromUnion<T, K extends keyof T> = T extends any ? Omit<T, K> : never;\nexport type IsAny<T, True, False = never> = true | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;","import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3 } from \"@reduxjs/toolkit\";\nimport type { Selector, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { Api, ApiContext, ApiEndpointInfiniteQuery, ApiEndpointMutation, ApiEndpointQuery, BaseQueryFn, CoreModule, EndpointDefinitions, InfiniteQueryActionCreatorResult, InfiniteQueryArgFrom, InfiniteQueryDefinition, InfiniteQueryResultSelectorResult, InfiniteQuerySubState, MutationActionCreatorResult, MutationDefinition, MutationResultSelectorResult, PageParamFrom, PrefetchOptions, QueryActionCreatorResult, QueryArgFrom, QueryCacheKey, QueryDefinition, QueryKeys, QueryResultSelectorResult, QuerySubState, ResultTypeFrom, RootState, SerializeQueryArgs, SkipToken, SubscriptionOptions, TSHelpersId, TSHelpersNoInfer, TSHelpersOverride } from '@reduxjs/toolkit/query';\nimport { QueryStatus, skipToken } from './rtkqImports';\nimport type { DependencyList } from 'react';\nimport { useCallback, useDebugValue, useEffect, useLayoutEffect, useMemo, useRef, useState } from './reactImports';\nimport { shallowEqual } from './reactReduxImports';\nimport type { SubscriptionSelectors } from '../core/buildMiddleware/index';\nimport type { InfiniteData, InfiniteQueryConfigOptions } from '../core/index';\nimport type { UninitializedValue } from './constants';\nimport { UNINITIALIZED_VALUE } from './constants';\nimport type { ReactHooksModuleOptions } from './module';\nimport { useStableQueryArgs } from './useSerializedStableValue';\nimport { useShallowStableValue } from './useShallowStableValue';\nimport type { InfiniteQueryDirection } from '../core/apiState';\nimport { isInfiniteQueryDefinition } from '../endpointDefinitions';\nimport type { StartInfiniteQueryActionCreator } from '../core/buildInitiate';\n\n// Copy-pasted from React-Redux\nconst canUseDOM = () => !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\nconst isDOM = /* @__PURE__ */canUseDOM();\n\n// Under React Native, we know that we always want to use useLayoutEffect\n\nconst isRunningInReactNative = () => typeof navigator !== 'undefined' && navigator.product === 'ReactNative';\nconst isReactNative = /* @__PURE__ */isRunningInReactNative();\nconst getUseIsomorphicLayoutEffect = () => isDOM || isReactNative ? useLayoutEffect : useEffect;\nexport const useIsomorphicLayoutEffect = /* @__PURE__ */getUseIsomorphicLayoutEffect();\nexport type QueryHooks<Definition extends QueryDefinition<any, any, any, any, any>> = {\n  useQuery: UseQuery<Definition>;\n  useLazyQuery: UseLazyQuery<Definition>;\n  useQuerySubscription: UseQuerySubscription<Definition>;\n  useLazyQuerySubscription: UseLazyQuerySubscription<Definition>;\n  useQueryState: UseQueryState<Definition>;\n};\nexport type InfiniteQueryHooks<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  useInfiniteQuery: UseInfiniteQuery<Definition>;\n  useInfiniteQuerySubscription: UseInfiniteQuerySubscription<Definition>;\n  useInfiniteQueryState: UseInfiniteQueryState<Definition>;\n};\nexport type MutationHooks<Definition extends MutationDefinition<any, any, any, any, any>> = {\n  useMutation: UseMutation<Definition>;\n};\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.\n *\n * This hook combines the functionality of both [`useQueryState`](#usequerystate) and [`useQuerySubscription`](#usequerysubscription) together, and is intended to be used in the majority of situations.\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseQuery<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(arg: QueryArgFrom<D> | SkipToken, options?: UseQuerySubscriptionOptions & UseQueryStateOptions<D, R>) => UseQueryHookResult<D, R>;\nexport type TypedUseQuery<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuery<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseQueryHookResult<D extends QueryDefinition<any, any, any, any>, R = UseQueryStateDefaultResult<D>> = UseQueryStateResult<D, R> & UseQuerySubscriptionResult<D>;\n\n/**\n * Helper type to manually type the result\n * of the `useQuery` hook in userland code.\n */\nexport type TypedUseQueryHookResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = TypedUseQueryStateResult<ResultType, QueryArg, BaseQuery, R> & TypedUseQuerySubscriptionResult<ResultType, QueryArg, BaseQuery>;\nexport type UseQuerySubscriptionOptions = SubscriptionOptions & {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When `skip` is true (or `skipToken` is passed in as `arg`):\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```tsx\n   * // codeblock-meta no-transpile title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n};\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useQuery`](#usequery) or [`useQueryState`](#usequerystate).\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n */\nexport type UseQuerySubscription<D extends QueryDefinition<any, any, any, any>> = (arg: QueryArgFrom<D> | SkipToken, options?: UseQuerySubscriptionOptions) => UseQuerySubscriptionResult<D>;\nexport type TypedUseQuerySubscription<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuerySubscription<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseQuerySubscriptionResult<D extends QueryDefinition<any, any, any, any>> = Pick<QueryActionCreatorResult<D>, 'refetch'>;\n\n/**\n * Helper type to manually type the result\n * of the `useQuerySubscription` hook in userland code.\n */\nexport type TypedUseQuerySubscriptionResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuerySubscriptionResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseLazyQueryLastPromiseInfo<D extends QueryDefinition<any, any, any, any>> = {\n  lastArg: QueryArgFrom<D>;\n};\n\n/**\n * A React hook similar to [`useQuery`](#usequery), but with manual control over when the data fetching occurs.\n *\n * This hook includes the functionality of [`useLazyQuerySubscription`](#uselazyquerysubscription).\n *\n * #### Features\n *\n * - Manual control over firing a request to retrieve data\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once\n *\n * #### Note\n *\n * When the trigger function returned from a LazyQuery is called, it always initiates a new request to the server even if there is cached data. Set `preferCacheValue`(the second argument to the function) as `true` if you want it to immediately return a cached value if one exists.\n */\nexport type UseLazyQuery<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(options?: SubscriptionOptions & Omit<UseQueryStateOptions<D, R>, 'skip'>) => [LazyQueryTrigger<D>, UseLazyQueryStateResult<D, R>, UseLazyQueryLastPromiseInfo<D>];\nexport type TypedUseLazyQuery<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseLazyQuery<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseLazyQueryStateResult<D extends QueryDefinition<any, any, any, any>, R = UseQueryStateDefaultResult<D>> = UseQueryStateResult<D, R> & {\n  /**\n   * Resets the hook state to its initial `uninitialized` state.\n   * This will also remove the last result from the cache.\n   */\n  reset: () => void;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useLazyQuery` hook in userland code.\n */\nexport type TypedUseLazyQueryStateResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseLazyQueryStateResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>, R>;\nexport type LazyQueryTrigger<D extends QueryDefinition<any, any, any, any>> = {\n  /**\n   * Triggers a lazy query.\n   *\n   * By default, this will start a new request even if there is already a value in the cache.\n   * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a lazy query, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await getUserById(1).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>, preferCacheValue?: boolean): QueryActionCreatorResult<D>;\n};\nexport type TypedLazyQueryTrigger<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = LazyQueryTrigger<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook similar to [`useQuerySubscription`](#usequerysubscription), but with manual control over when the data fetching occurs.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useLazyQuery`](#uselazyquery).\n *\n * #### Features\n *\n * - Manual control over firing a request to retrieve data\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once\n */\nexport type UseLazyQuerySubscription<D extends QueryDefinition<any, any, any, any>> = (options?: SubscriptionOptions) => readonly [LazyQueryTrigger<D>, QueryArgFrom<D> | UninitializedValue, {\n  reset: () => void;\n}];\nexport type TypedUseLazyQuerySubscription<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseLazyQuerySubscription<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * @internal\n */\nexport type QueryStateSelector<R extends Record<string, any>, D extends QueryDefinition<any, any, any, any>> = (state: UseQueryStateDefaultResult<D>) => R;\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryStateSelector} for use with a specific query.\n * This is useful for scenarios where you want to create a \"pre-typed\"\n * {@linkcode UseQueryStateOptions.selectFromResult | selectFromResult}\n * function.\n *\n * @example\n * <caption>#### __Create a strongly-typed `selectFromResult` selector function__</caption>\n *\n * ```tsx\n * import type { TypedQueryStateSelector } from '@reduxjs/toolkit/query/react'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n *\n * type Post = {\n *   id: number\n *   title: string\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = number | undefined\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * type SelectedResult = Pick<PostsApiResponse, 'posts'>\n *\n * const postsApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com/posts' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, QueryArgument>({\n *       query: (limit = 5) => `?limit=${limit}&select=title`,\n *     }),\n *   }),\n * })\n *\n * const { useGetPostsQuery } = postsApiSlice\n *\n * function PostById({ id }: { id: number }) {\n *   const { post } = useGetPostsQuery(undefined, {\n *     selectFromResult: (state) => ({\n *       post: state.data?.posts.find((post) => post.id === id),\n *     }),\n *   })\n *\n *   return <li>{post?.title}</li>\n * }\n *\n * const EMPTY_ARRAY: Post[] = []\n *\n * const typedSelectFromResult: TypedQueryStateSelector<\n *   PostsApiResponse,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   SelectedResult\n * > = (state) => ({ posts: state.data?.posts ?? EMPTY_ARRAY })\n *\n * function PostsList() {\n *   const { posts } = useGetPostsQuery(undefined, {\n *     selectFromResult: typedSelectFromResult,\n *   })\n *\n *   return (\n *     <div>\n *       <ul>\n *         {posts.map((post) => (\n *           <PostById key={post.id} id={post.id} />\n *         ))}\n *       </ul>\n *     </div>\n *   )\n * }\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template SelectedResultType - The type of the selected result returned by the __`selectFromResult`__ function.\n *\n * @since 2.3.0\n * @public\n */\nexport type TypedQueryStateSelector<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, SelectedResultType extends Record<string, any> = UseQueryStateDefaultResult<QueryDefinition<QueryArgumentType, BaseQueryFunctionType, string, ResultType, string>>> = QueryStateSelector<SelectedResultType, QueryDefinition<QueryArgumentType, BaseQueryFunctionType, string, ResultType, string>>;\n\n/**\n * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * Note that this hook does not trigger fetching new data. For that use-case, see [`useQuery`](#usequery) or [`useQuerySubscription`](#usequerysubscription).\n *\n * #### Features\n *\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseQueryState<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(arg: QueryArgFrom<D> | SkipToken, options?: UseQueryStateOptions<D, R>) => UseQueryStateResult<D, R>;\nexport type TypedUseQueryState<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQueryState<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * @internal\n */\nexport type UseQueryStateOptions<D extends QueryDefinition<any, any, any, any>, R extends Record<string, any>> = {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When skip is true:\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after skipping the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.\n   * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.\n   * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using selectFromResult to extract a single result\"\n   * function PostsList() {\n   *   const { data: posts } = api.useGetPostsQuery();\n   *\n   *   return (\n   *     <ul>\n   *       {posts?.data?.map((post) => (\n   *         <PostById key={post.id} id={post.id} />\n   *       ))}\n   *     </ul>\n   *   );\n   * }\n   *\n   * function PostById({ id }: { id: number }) {\n   *   // Will select the post with the given id, and will only rerender if the given posts data changes\n   *   const { post } = api.useGetPostsQuery(undefined, {\n   *     selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),\n   *   });\n   *\n   *   return <li>{post?.name}</li>;\n   * }\n   * ```\n   */\n  selectFromResult?: QueryStateSelector<R, D>;\n};\n\n/**\n * Provides a way to define a \"pre-typed\" version of\n * {@linkcode UseQueryStateOptions} with specific options for a given query.\n * This is particularly useful for setting default query behaviors such as\n * refetching strategies, which can be overridden as needed.\n *\n * @example\n * <caption>#### __Create a `useQuery` hook with default options__</caption>\n *\n * ```ts\n * import type {\n *   SubscriptionOptions,\n *   TypedUseQueryStateOptions,\n * } from '@reduxjs/toolkit/query/react'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n *\n * type Post = {\n *   id: number\n *   name: string\n * }\n *\n * const api = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n *   tagTypes: ['Post'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<Post[], void>({\n *       query: () => 'posts',\n *     }),\n *   }),\n * })\n *\n * const { useGetPostsQuery } = api\n *\n * export const useGetPostsQueryWithDefaults = <\n *   SelectedResult extends Record<string, any>,\n * >(\n *   overrideOptions: TypedUseQueryStateOptions<\n *     Post[],\n *     void,\n *     ReturnType<typeof fetchBaseQuery>,\n *     SelectedResult\n *   > &\n *     SubscriptionOptions,\n * ) =>\n *   useGetPostsQuery(undefined, {\n *     // Insert default options here\n *\n *     refetchOnMountOrArgChange: true,\n *     refetchOnFocus: true,\n *     ...overrideOptions,\n *   })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArg - The type of the argument passed into the query.\n * @template BaseQuery - The type of the base query function being used.\n * @template SelectedResult - The type of the selected result returned by the __`selectFromResult`__ function.\n *\n * @since 2.2.8\n * @public\n */\nexport type TypedUseQueryStateOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseQueryStateOptions<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>, SelectedResult>;\nexport type UseQueryStateResult<_ extends QueryDefinition<any, any, any, any>, R> = TSHelpersNoInfer<R>;\n\n/**\n * Helper type to manually type the result\n * of the `useQueryState` hook in userland code.\n */\nexport type TypedUseQueryStateResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = TSHelpersNoInfer<R>;\ntype UseQueryStateBaseResult<D extends QueryDefinition<any, any, any, any>> = QuerySubState<D> & {\n  /**\n   * Where `data` tries to hold data as much as possible, also re-using\n   * data from the last arguments passed into the hook, this property\n   * will always contain the received data from the query, for the current query arguments.\n   */\n  currentData?: ResultTypeFrom<D>;\n  /**\n   * Query has not started yet.\n   */\n  isUninitialized: false;\n  /**\n   * Query is currently loading for the first time. No data yet.\n   */\n  isLoading: false;\n  /**\n   * Query is currently fetching, but might have data from an earlier request.\n   */\n  isFetching: false;\n  /**\n   * Query has data from a successful load.\n   */\n  isSuccess: false;\n  /**\n   * Query is currently in \"error\" state.\n   */\n  isError: false;\n};\ntype UseQueryStateUninitialized<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<Extract<UseQueryStateBaseResult<D>, {\n  status: QueryStatus.uninitialized;\n}>, {\n  isUninitialized: true;\n}>;\ntype UseQueryStateLoading<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isLoading: true;\n  isFetching: boolean;\n  data: undefined;\n}>;\ntype UseQueryStateSuccessFetching<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isSuccess: true;\n  isFetching: true;\n  error: undefined;\n} & {\n  data: ResultTypeFrom<D>;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'fulfilledTimeStamp'>>>;\ntype UseQueryStateSuccessNotFetching<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isSuccess: true;\n  isFetching: false;\n  error: undefined;\n} & {\n  data: ResultTypeFrom<D>;\n  currentData: ResultTypeFrom<D>;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'fulfilledTimeStamp'>>>;\ntype UseQueryStateError<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isError: true;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'error'>>>;\ntype UseQueryStateDefaultResult<D extends QueryDefinition<any, any, any, any>> = TSHelpersId<UseQueryStateUninitialized<D> | UseQueryStateLoading<D> | UseQueryStateSuccessFetching<D> | UseQueryStateSuccessNotFetching<D> | UseQueryStateError<D>> & {\n  /**\n   * @deprecated Included for completeness, but discouraged.\n   * Please use the `isLoading`, `isFetching`, `isSuccess`, `isError`\n   * and `isUninitialized` flags instead\n   */\n  status: QueryStatus;\n};\nexport type LazyInfiniteQueryTrigger<D extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  /**\n   * Triggers a lazy query.\n   *\n   * By default, this will start a new request even if there is already a value in the cache.\n   * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a lazy query, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await getUserById(1).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>, direction: InfiniteQueryDirection): InfiniteQueryActionCreatorResult<D>;\n};\nexport type TypedLazyInfiniteQueryTrigger<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = LazyInfiniteQueryTrigger<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type UseInfiniteQuerySubscriptionOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>> = SubscriptionOptions & {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When `skip` is true (or `skipToken` is passed in as `arg`):\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```tsx\n   * // codeblock-meta no-transpile title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n  initialPageParam?: PageParamFrom<D>;\n  /**\n   * Defaults to `true`. When this is `true` and an infinite query endpoint is refetched\n   * (due to tag invalidation, polling, arg change configuration, or manual refetching),\n   * RTK Query will try to sequentially refetch all pages currently in the cache.\n   * When `false` only the first page will be refetched.\n   *\n   * This option applies to all automatic refetches for this subscription (polling, tag invalidation, etc.).\n   * It can be overridden on a per-call basis using the `refetch()` method.\n   */\n  refetchCachedPages?: boolean;\n};\nexport type TypedUseInfiniteQuerySubscription<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuerySubscription<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type UseInfiniteQuerySubscriptionResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  refetch: (options?: Pick<UseInfiniteQuerySubscriptionOptions<D>, 'refetchCachedPages'>) => InfiniteQueryActionCreatorResult<D>;\n  trigger: LazyInfiniteQueryTrigger<D>;\n  fetchNextPage: () => InfiniteQueryActionCreatorResult<D>;\n  fetchPreviousPage: () => InfiniteQueryActionCreatorResult<D>;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useQuerySubscription` hook in userland code.\n */\nexport type TypedUseInfiniteQuerySubscriptionResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuerySubscriptionResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type InfiniteQueryStateSelector<R extends Record<string, any>, D extends InfiniteQueryDefinition<any, any, any, any, any>> = (state: UseInfiniteQueryStateDefaultResult<D>) => R;\nexport type TypedInfiniteQueryStateSelector<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = InfiniteQueryStateSelector<SelectedResult, InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.  Additionally, it will cache multiple \"pages\" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.\n *\n *  The `data` field will be a `{pages: Data[], pageParams: PageParam[]}` structure containing all fetched page responses and the corresponding page param values for each page. You may use this to render individual pages, combine all pages into a single infinite list, or other display logic as needed.\n *\n * This hook combines the functionality of both [`useInfiniteQueryState`](#useinfinitequerystate) and [`useInfiniteQuerySubscription`](#useinfinitequerysubscription) together, and is intended to be used in the majority of situations.\n *\n * As with normal query hooks, `skipToken` is a valid argument that will skip the query from executing.\n *\n * By default, the initial request will use the `initialPageParam` value that was defined on the infinite query endpoint. If you want to start from a different value, you can pass `initialPageParam` as part of the hook options to override that initial request value.\n *\n * Use the returned `fetchNextPage` and `fetchPreviousPage` methods on the hook result object to trigger fetches forwards and backwards. These will always calculate the next or previous page param based on the current cached pages and the provided `getNext/PreviousPageParam` callbacks defined in the endpoint.\n *\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseInfiniteQuery<D extends InfiniteQueryDefinition<any, any, any, any, any>> = <R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<D>>(arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQuerySubscriptionOptions<D> & UseInfiniteQueryStateOptions<D, R>) => UseInfiniteQueryHookResult<D, R> & Pick<UseInfiniteQuerySubscriptionResult<D>, 'fetchNextPage' | 'fetchPreviousPage'>;\nexport type TypedUseInfiniteQuery<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuery<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * Note that this hook does not trigger fetching new data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQuerySubscription`](#useinfinitequerysubscription).\n *\n * #### Features\n *\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseInfiniteQueryState<D extends InfiniteQueryDefinition<any, any, any, any, any>> = <R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<D>>(arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQueryStateOptions<D, R>) => UseInfiniteQueryStateResult<D, R>;\nexport type TypedUseInfiniteQueryState<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQueryState<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data. Additionally, it will cache multiple \"pages\" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQueryState`](#useinfinitequerystate).\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n */\nexport type UseInfiniteQuerySubscription<D extends InfiniteQueryDefinition<any, any, any, any, any>> = (arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQuerySubscriptionOptions<D>) => UseInfiniteQuerySubscriptionResult<D>;\nexport type UseInfiniteQueryHookResult<D extends InfiniteQueryDefinition<any, any, any, any, any>, R = UseInfiniteQueryStateDefaultResult<D>> = UseInfiniteQueryStateResult<D, R> & Pick<UseInfiniteQuerySubscriptionResult<D>, 'refetch' | 'fetchNextPage' | 'fetchPreviousPage'>;\nexport type TypedUseInfiniteQueryHookResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryHookResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, R>;\nexport type UseInfiniteQueryStateOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>, R extends Record<string, any>> = {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When skip is true:\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after skipping the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.\n   * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.\n   * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.\n   * Note that this should always return an object (not a primitive), as RTKQ adds fields to the return value.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using selectFromResult to extract a single result\"\n   * function PostsList() {\n   *   const { data: posts } = api.useGetPostsQuery();\n   *\n   *   return (\n   *     <ul>\n   *       {posts?.data?.map((post) => (\n   *         <PostById key={post.id} id={post.id} />\n   *       ))}\n   *     </ul>\n   *   );\n   * }\n   *\n   * function PostById({ id }: { id: number }) {\n   *   // Will select the post with the given id, and will only rerender if the given posts data changes\n   *   const { post } = api.useGetPostsQuery(undefined, {\n   *     selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),\n   *   });\n   *\n   *   return <li>{post?.name}</li>;\n   * }\n   * ```\n   */\n  selectFromResult?: InfiniteQueryStateSelector<R, D>;\n};\nexport type TypedUseInfiniteQueryStateOptions<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryStateOptions<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, SelectedResult>;\nexport type UseInfiniteQueryStateResult<D extends InfiniteQueryDefinition<any, any, any, any, any>, R = UseInfiniteQueryStateDefaultResult<D>> = TSHelpersNoInfer<R>;\nexport type TypedUseInfiniteQueryStateResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, R = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryStateResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, R>;\ntype UseInfiniteQueryStateBaseResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = InfiniteQuerySubState<D> & {\n  /**\n   * Where `data` tries to hold data as much as possible, also re-using\n   * data from the last arguments passed into the hook, this property\n   * will always contain the received data from the query, for the current query arguments.\n   */\n  currentData?: InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>;\n  /**\n   * Query has not started yet.\n   */\n  isUninitialized: false;\n  /**\n   * Query is currently loading for the first time. No data yet.\n   */\n  isLoading: false;\n  /**\n   * Query is currently fetching, but might have data from an earlier request.\n   */\n  isFetching: false;\n  /**\n   * Query has data from a successful load.\n   */\n  isSuccess: false;\n  /**\n   * Query is currently in \"error\" state.\n   */\n  isError: false;\n  hasNextPage: boolean;\n  hasPreviousPage: boolean;\n  isFetchingNextPage: boolean;\n  isFetchingPreviousPage: boolean;\n};\ntype UseInfiniteQueryStateDefaultResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = TSHelpersId<TSHelpersOverride<Extract<UseInfiniteQueryStateBaseResult<D>, {\n  status: QueryStatus.uninitialized;\n}>, {\n  isUninitialized: true;\n}> | TSHelpersOverride<UseInfiniteQueryStateBaseResult<D>, {\n  isLoading: true;\n  isFetching: boolean;\n  data: undefined;\n} | ({\n  isSuccess: true;\n  isFetching: true;\n  error: undefined;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp'>>) | ({\n  isSuccess: true;\n  isFetching: false;\n  error: undefined;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp' | 'currentData'>>) | ({\n  isError: true;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'error'>>)>> & {\n  /**\n   * @deprecated Included for completeness, but discouraged.\n   * Please use the `isLoading`, `isFetching`, `isSuccess`, `isError`\n   * and `isUninitialized` flags instead\n   */\n  status: QueryStatus;\n};\nexport type MutationStateSelector<R extends Record<string, any>, D extends MutationDefinition<any, any, any, any>> = (state: MutationResultSelectorResult<D>) => R;\nexport type UseMutationStateOptions<D extends MutationDefinition<any, any, any, any>, R extends Record<string, any>> = {\n  selectFromResult?: MutationStateSelector<R, D>;\n  fixedCacheKey?: string;\n};\nexport type UseMutationStateResult<D extends MutationDefinition<any, any, any, any>, R> = TSHelpersNoInfer<R> & {\n  originalArgs?: QueryArgFrom<D>;\n  /**\n   * Resets the hook state to its initial `uninitialized` state.\n   * This will also remove the last result from the cache.\n   */\n  reset: () => void;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useMutation` hook in userland code.\n */\nexport type TypedUseMutationResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = MutationResultSelectorResult<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseMutationStateResult<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>, R>;\n\n/**\n * A React hook that lets you trigger an update request for a given endpoint, and subscribes the component to read the request status from the Redux store. The component will re-render as the loading status changes.\n *\n * #### Features\n *\n * - Manual control over firing a request to alter data on the server or possibly invalidate the cache\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseMutation<D extends MutationDefinition<any, any, any, any>> = <R extends Record<string, any> = MutationResultSelectorResult<D>>(options?: UseMutationStateOptions<D, R>) => readonly [MutationTrigger<D>, UseMutationStateResult<D, R>];\nexport type TypedUseMutation<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseMutation<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type MutationTrigger<D extends MutationDefinition<any, any, any, any>> = {\n  /**\n   * Triggers the mutation and returns a Promise.\n   * @remarks\n   * If you need to access the error or success payload immediately after a mutation, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await addPost({ id: 1, name: 'Example' }).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>): MutationActionCreatorResult<D>;\n};\nexport type TypedMutationTrigger<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = MutationTrigger<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * Wrapper around `defaultQueryStateSelector` to be used in `useQuery`.\n * We want the initial render to already come back with\n * `{ isUninitialized: false, isFetching: true, isLoading: true }`\n * to prevent that the library user has to do an additional check for `isUninitialized`/\n */\nconst noPendingQueryStateSelector: QueryStateSelector<any, any> = selected => {\n  if (selected.isUninitialized) {\n    return {\n      ...selected,\n      isUninitialized: false,\n      isFetching: true,\n      isLoading: selected.data !== undefined ? false : true,\n      // This is the one place where we still have to use `QueryStatus` as an enum,\n      // since it's the only reference in the React package and not in the core.\n      status: QueryStatus.pending\n    } as any;\n  }\n  return selected;\n};\nfunction pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K> {\n  const ret: any = {};\n  keys.forEach(key => {\n    ret[key] = obj[key];\n  });\n  return ret;\n}\nconst COMMON_HOOK_DEBUG_FIELDS = ['data', 'status', 'isLoading', 'isSuccess', 'isError', 'error'] as const;\ntype GenericPrefetchThunk = (endpointName: any, arg: any, options: PrefetchOptions) => ThunkAction<void, any, any, UnknownAction>;\n\n/**\n *\n * @param opts.api - An API with defined endpoints to create hooks for\n * @param opts.moduleOptions.batch - The version of the `batchedUpdates` function to be used\n * @param opts.moduleOptions.useDispatch - The version of the `useDispatch` hook to be used\n * @param opts.moduleOptions.useSelector - The version of the `useSelector` hook to be used\n * @returns An object containing functions to generate hooks based on an endpoint\n */\nexport function buildHooks<Definitions extends EndpointDefinitions>({\n  api,\n  moduleOptions: {\n    batch,\n    hooks: {\n      useDispatch,\n      useSelector,\n      useStore\n    },\n    unstable__sideEffectsInRender,\n    createSelector\n  },\n  serializeQueryArgs,\n  context\n}: {\n  api: Api<any, Definitions, any, any, CoreModule>;\n  moduleOptions: Required<ReactHooksModuleOptions>;\n  serializeQueryArgs: SerializeQueryArgs<any>;\n  context: ApiContext<Definitions>;\n}) {\n  const usePossiblyImmediateEffect: (effect: () => void | undefined, deps?: DependencyList) => void = unstable__sideEffectsInRender ? cb => cb() : useEffect;\n  type UnsubscribePromiseRef = React.RefObject<{\n    unsubscribe?: () => void;\n  } | undefined>;\n  const unsubscribePromiseRef = (ref: UnsubscribePromiseRef) => ref.current?.unsubscribe?.();\n  const endpointDefinitions = context.endpointDefinitions;\n  return {\n    buildQueryHooks,\n    buildInfiniteQueryHooks,\n    buildMutationHook,\n    usePrefetch\n  };\n  function queryStatePreSelector(currentState: QueryResultSelectorResult<any>, lastResult: UseQueryStateDefaultResult<any> | undefined, queryArgs: any): UseQueryStateDefaultResult<any> {\n    // if we had a last result and the current result is uninitialized,\n    // we might have called `api.util.resetApiState`\n    // in this case, reset the hook\n    if (lastResult?.endpointName && currentState.isUninitialized) {\n      const {\n        endpointName\n      } = lastResult;\n      const endpointDefinition = endpointDefinitions[endpointName];\n      if (queryArgs !== skipToken && serializeQueryArgs({\n        queryArgs: lastResult.originalArgs,\n        endpointDefinition,\n        endpointName\n      }) === serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      })) lastResult = undefined;\n    }\n\n    // data is the last known good request result we have tracked - or if none has been tracked yet the last good result for the current args\n    let data = currentState.isSuccess ? currentState.data : lastResult?.data;\n    if (data === undefined) data = currentState.data;\n    const hasData = data !== undefined;\n\n    // isFetching = true any time a request is in flight\n    const isFetching = currentState.isLoading;\n\n    // isLoading = true only when loading while no data is present yet (initial load with no data in the cache)\n    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;\n\n    // isSuccess = true when data is present and we're not refetching after an error.\n    // That includes cases where the _current_ item is either actively\n    // fetching or about to fetch due to an uninitialized entry.\n    const isSuccess = currentState.isSuccess || hasData && (isFetching && !lastResult?.isError || currentState.isUninitialized);\n    return {\n      ...currentState,\n      data,\n      currentData: currentState.data,\n      isFetching,\n      isLoading,\n      isSuccess\n    } as UseQueryStateDefaultResult<any>;\n  }\n  function infiniteQueryStatePreSelector(currentState: InfiniteQueryResultSelectorResult<any>, lastResult: UseInfiniteQueryStateDefaultResult<any> | undefined, queryArgs: any): UseInfiniteQueryStateDefaultResult<any> {\n    // if we had a last result and the current result is uninitialized,\n    // we might have called `api.util.resetApiState`\n    // in this case, reset the hook\n    if (lastResult?.endpointName && currentState.isUninitialized) {\n      const {\n        endpointName\n      } = lastResult;\n      const endpointDefinition = endpointDefinitions[endpointName];\n      if (queryArgs !== skipToken && serializeQueryArgs({\n        queryArgs: lastResult.originalArgs,\n        endpointDefinition,\n        endpointName\n      }) === serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      })) lastResult = undefined;\n    }\n\n    // data is the last known good request result we have tracked - or if none has been tracked yet the last good result for the current args\n    let data = currentState.isSuccess ? currentState.data : lastResult?.data;\n    if (data === undefined) data = currentState.data;\n    const hasData = data !== undefined;\n\n    // isFetching = true any time a request is in flight\n    const isFetching = currentState.isLoading;\n    // isLoading = true only when loading while no data is present yet (initial load with no data in the cache)\n    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;\n    // isSuccess = true when data is present\n    const isSuccess = currentState.isSuccess || isFetching && hasData;\n    return {\n      ...currentState,\n      data,\n      currentData: currentState.data,\n      isFetching,\n      isLoading,\n      isSuccess\n    } as UseInfiniteQueryStateDefaultResult<any>;\n  }\n  function usePrefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, defaultOptions?: PrefetchOptions) {\n    const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n    const stableDefaultOptions = useShallowStableValue(defaultOptions);\n    return useCallback((arg: any, options?: PrefetchOptions) => dispatch((api.util.prefetch as GenericPrefetchThunk)(endpointName, arg, {\n      ...stableDefaultOptions,\n      ...options\n    })), [endpointName, dispatch, stableDefaultOptions]);\n  }\n  function useQuerySubscriptionCommonImpl<T extends QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>(endpointName: string, arg: unknown | SkipToken, {\n    refetchOnReconnect,\n    refetchOnFocus,\n    refetchOnMountOrArgChange,\n    skip = false,\n    pollingInterval = 0,\n    skipPollingIfUnfocused = false,\n    ...rest\n  }: UseQuerySubscriptionOptions = {}) {\n    const {\n      initiate\n    } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n    const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n\n    // TODO: Change this to `useRef<SubscriptionSelectors>(undefined)` after upgrading to React 19.\n    const subscriptionSelectorsRef = useRef<SubscriptionSelectors | undefined>(undefined);\n    if (!subscriptionSelectorsRef.current) {\n      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());\n      if (process.env.NODE_ENV !== 'production') {\n        if (typeof returnedValue !== 'object' || typeof returnedValue?.type === 'string') {\n          throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(37) : `Warning: Middleware for RTK-Query API at reducerPath \"${api.reducerPath}\" has not been added to the store.\n    You must add the middleware for RTK-Query to function correctly!`);\n        }\n      }\n      subscriptionSelectorsRef.current = returnedValue as unknown as SubscriptionSelectors;\n    }\n    const stableArg = useStableQueryArgs(skip ? skipToken : arg);\n    const stableSubscriptionOptions = useShallowStableValue({\n      refetchOnReconnect,\n      refetchOnFocus,\n      pollingInterval,\n      skipPollingIfUnfocused\n    });\n    const initialPageParam = (rest as UseInfiniteQuerySubscriptionOptions<any>).initialPageParam;\n    const stableInitialPageParam = useShallowStableValue(initialPageParam);\n    const refetchCachedPages = (rest as UseInfiniteQuerySubscriptionOptions<any>).refetchCachedPages;\n    const stableRefetchCachedPages = useShallowStableValue(refetchCachedPages);\n\n    /**\n     * @todo Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n     */\n    const promiseRef = useRef<T | undefined>(undefined);\n    let {\n      queryCacheKey,\n      requestId\n    } = promiseRef.current || {};\n\n    // HACK We've saved the middleware subscription lookup callbacks into a ref,\n    // so we can directly check here if the subscription exists for this query.\n    let currentRenderHasSubscription = false;\n    if (queryCacheKey && requestId) {\n      currentRenderHasSubscription = subscriptionSelectorsRef.current.isRequestSubscribed(queryCacheKey, requestId);\n    }\n    const subscriptionRemoved = !currentRenderHasSubscription && promiseRef.current !== undefined;\n    usePossiblyImmediateEffect((): void | undefined => {\n      if (subscriptionRemoved) {\n        promiseRef.current = undefined;\n      }\n    }, [subscriptionRemoved]);\n    usePossiblyImmediateEffect((): void | undefined => {\n      const lastPromise = promiseRef.current;\n      if (typeof process !== 'undefined' && process.env.NODE_ENV === 'removeMeOnCompilation') {\n        // this is only present to enforce the rule of hooks to keep `isSubscribed` in the dependency array\n        console.log(subscriptionRemoved);\n      }\n      if (stableArg === skipToken) {\n        lastPromise?.unsubscribe();\n        promiseRef.current = undefined;\n        return;\n      }\n      const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions;\n      if (!lastPromise || lastPromise.arg !== stableArg) {\n        lastPromise?.unsubscribe();\n        const promise = dispatch(initiate(stableArg, {\n          subscriptionOptions: stableSubscriptionOptions,\n          forceRefetch: refetchOnMountOrArgChange,\n          ...(isInfiniteQueryDefinition(endpointDefinitions[endpointName]) ? {\n            initialPageParam: stableInitialPageParam,\n            refetchCachedPages: stableRefetchCachedPages\n          } : {})\n        }));\n        promiseRef.current = promise as T;\n      } else if (stableSubscriptionOptions !== lastSubscriptionOptions) {\n        lastPromise.updateSubscriptionOptions(stableSubscriptionOptions);\n      }\n    }, [dispatch, initiate, refetchOnMountOrArgChange, stableArg, stableSubscriptionOptions, subscriptionRemoved, stableInitialPageParam, stableRefetchCachedPages, endpointName]);\n    return [promiseRef, dispatch, initiate, stableSubscriptionOptions] as const;\n  }\n  function buildUseQueryState(endpointName: string, preSelector: typeof queryStatePreSelector | typeof infiniteQueryStatePreSelector) {\n    const useQueryState = (arg: any, {\n      skip = false,\n      selectFromResult\n    }: UseQueryStateOptions<any, any> | UseInfiniteQueryStateOptions<any, any> = {}) => {\n      const {\n        select\n      } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n      const stableArg = useStableQueryArgs(skip ? skipToken : arg);\n      type ApiRootState = Parameters<ReturnType<typeof select>>[0];\n      const lastValue = useRef<any>(undefined);\n      const selectDefaultResult: Selector<ApiRootState, any, [any]> = useMemo(() =>\n      // Normally ts-ignores are bad and should be avoided, but we're\n      // already casting this selector to be `Selector<any>` anyway,\n      // so the inconsistencies don't matter here\n      // @ts-ignore\n      createSelector([\n      // @ts-ignore\n      select(stableArg), (_: ApiRootState, lastResult: any) => lastResult, (_: ApiRootState) => stableArg], preSelector, {\n        memoizeOptions: {\n          resultEqualityCheck: shallowEqual\n        }\n      }), [select, stableArg]);\n      const querySelector: Selector<ApiRootState, any, [any]> = useMemo(() => selectFromResult ? createSelector([selectDefaultResult], selectFromResult, {\n        devModeChecks: {\n          identityFunctionCheck: 'never'\n        }\n      }) : selectDefaultResult, [selectDefaultResult, selectFromResult]);\n      const currentState = useSelector((state: RootState<Definitions, any, any>) => querySelector(state, lastValue.current), shallowEqual);\n      const store = useStore<RootState<Definitions, any, any>>();\n      const newLastValue = selectDefaultResult(store.getState(), lastValue.current);\n      useIsomorphicLayoutEffect(() => {\n        lastValue.current = newLastValue;\n      }, [newLastValue]);\n      return currentState;\n    };\n    return useQueryState;\n  }\n  function usePromiseRefUnsubscribeOnUnmount(promiseRef: UnsubscribePromiseRef) {\n    useEffect(() => {\n      return () => {\n        unsubscribePromiseRef(promiseRef)\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n        ;\n        (promiseRef.current as any) = undefined;\n      };\n    }, [promiseRef]);\n  }\n  function refetchOrErrorIfUnmounted<T extends QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>(promiseRef: React.RefObject<T | undefined>): T {\n    if (!promiseRef.current) throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(38) : 'Cannot refetch a query that has not been started yet.');\n    return promiseRef.current.refetch() as T;\n  }\n  function buildQueryHooks(endpointName: string): QueryHooks<any> {\n    const useQuerySubscription: UseQuerySubscription<any> = (arg: any, options = {}) => {\n      const [promiseRef] = useQuerySubscriptionCommonImpl<QueryActionCreatorResult<any>>(endpointName, arg, options);\n      usePromiseRefUnsubscribeOnUnmount(promiseRef);\n      return useMemo(() => ({\n        /**\n         * A method to manually refetch data for the query\n         */\n        refetch: () => refetchOrErrorIfUnmounted(promiseRef)\n      }), [promiseRef]);\n    };\n    const useLazyQuerySubscription: UseLazyQuerySubscription<any> = ({\n      refetchOnReconnect,\n      refetchOnFocus,\n      pollingInterval = 0,\n      skipPollingIfUnfocused = false\n    } = {}) => {\n      const {\n        initiate\n      } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n      const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n      const [arg, setArg] = useState<any>(UNINITIALIZED_VALUE);\n\n      // TODO: Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n      /**\n       * @todo Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n       */\n      const promiseRef = useRef<QueryActionCreatorResult<any> | undefined>(undefined);\n      const stableSubscriptionOptions = useShallowStableValue({\n        refetchOnReconnect,\n        refetchOnFocus,\n        pollingInterval,\n        skipPollingIfUnfocused\n      });\n      usePossiblyImmediateEffect(() => {\n        const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions;\n        if (stableSubscriptionOptions !== lastSubscriptionOptions) {\n          promiseRef.current?.updateSubscriptionOptions(stableSubscriptionOptions);\n        }\n      }, [stableSubscriptionOptions]);\n      const subscriptionOptionsRef = useRef(stableSubscriptionOptions);\n      usePossiblyImmediateEffect(() => {\n        subscriptionOptionsRef.current = stableSubscriptionOptions;\n      }, [stableSubscriptionOptions]);\n      const trigger = useCallback(function (arg: any, preferCacheValue = false) {\n        let promise: QueryActionCreatorResult<any>;\n        batch(() => {\n          unsubscribePromiseRef(promiseRef);\n          promiseRef.current = promise = dispatch(initiate(arg, {\n            subscriptionOptions: subscriptionOptionsRef.current,\n            forceRefetch: !preferCacheValue\n          }));\n          setArg(arg);\n        });\n        return promise!;\n      }, [dispatch, initiate]);\n      const reset = useCallback(() => {\n        if (promiseRef.current?.queryCacheKey) {\n          dispatch(api.internalActions.removeQueryResult({\n            queryCacheKey: promiseRef.current?.queryCacheKey as QueryCacheKey\n          }));\n        }\n      }, [dispatch]);\n\n      /* cleanup on unmount */\n      useEffect(() => {\n        return () => {\n          unsubscribePromiseRef(promiseRef);\n        };\n      }, []);\n\n      /* if \"cleanup on unmount\" was triggered from a fast refresh, we want to reinstate the query */\n      useEffect(() => {\n        if (arg !== UNINITIALIZED_VALUE && !promiseRef.current) {\n          trigger(arg, true);\n        }\n      }, [arg, trigger]);\n      return useMemo(() => [trigger, arg, {\n        reset\n      }] as const, [trigger, arg, reset]);\n    };\n    const useQueryState: UseQueryState<any> = buildUseQueryState(endpointName, queryStatePreSelector);\n    return {\n      useQueryState,\n      useQuerySubscription,\n      useLazyQuerySubscription,\n      useLazyQuery(options) {\n        const [trigger, arg, {\n          reset\n        }] = useLazyQuerySubscription(options);\n        const queryStateResults = useQueryState(arg, {\n          ...options,\n          skip: arg === UNINITIALIZED_VALUE\n        });\n        const info = useMemo(() => ({\n          lastArg: arg\n        }), [arg]);\n        return useMemo(() => [trigger, {\n          ...queryStateResults,\n          reset\n        }, info], [trigger, queryStateResults, reset, info]);\n      },\n      useQuery(arg, options) {\n        const querySubscriptionResults = useQuerySubscription(arg, options);\n        const queryStateResults = useQueryState(arg, {\n          selectFromResult: arg === skipToken || options?.skip ? undefined : noPendingQueryStateSelector,\n          ...options\n        });\n        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS);\n        useDebugValue(debugValue);\n        return useMemo(() => ({\n          ...queryStateResults,\n          ...querySubscriptionResults\n        }), [queryStateResults, querySubscriptionResults]);\n      }\n    };\n  }\n  function buildInfiniteQueryHooks(endpointName: string): InfiniteQueryHooks<any> {\n    const useInfiniteQuerySubscription: UseInfiniteQuerySubscription<any> = (arg: any, options = {}) => {\n      const [promiseRef, dispatch, initiate, stableSubscriptionOptions] = useQuerySubscriptionCommonImpl<InfiniteQueryActionCreatorResult<any>>(endpointName, arg, options);\n      const subscriptionOptionsRef = useRef(stableSubscriptionOptions);\n      usePossiblyImmediateEffect(() => {\n        subscriptionOptionsRef.current = stableSubscriptionOptions;\n      }, [stableSubscriptionOptions]);\n\n      // Extract and stabilize the hook-level refetchCachedPages option\n      const hookRefetchCachedPages = (options as UseInfiniteQuerySubscriptionOptions<any>).refetchCachedPages;\n      const stableHookRefetchCachedPages = useShallowStableValue(hookRefetchCachedPages);\n      const trigger: LazyInfiniteQueryTrigger<any> = useCallback(function (arg: unknown, direction: 'forward' | 'backward') {\n        let promise: InfiniteQueryActionCreatorResult<any>;\n        batch(() => {\n          unsubscribePromiseRef(promiseRef);\n          promiseRef.current = promise = dispatch((initiate as StartInfiniteQueryActionCreator<any>)(arg, {\n            subscriptionOptions: subscriptionOptionsRef.current,\n            direction\n          }));\n        });\n        return promise!;\n      }, [promiseRef, dispatch, initiate]);\n      usePromiseRefUnsubscribeOnUnmount(promiseRef);\n      const stableArg = useStableQueryArgs(options.skip ? skipToken : arg);\n      const refetch = useCallback((options?: Pick<UseInfiniteQuerySubscriptionOptions<any>, 'refetchCachedPages'>) => {\n        if (!promiseRef.current) throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(38) : 'Cannot refetch a query that has not been started yet.');\n        // Merge per-call options with hook-level default\n        const mergedOptions = {\n          refetchCachedPages: options?.refetchCachedPages ?? stableHookRefetchCachedPages\n        };\n        return promiseRef.current.refetch(mergedOptions);\n      }, [promiseRef, stableHookRefetchCachedPages]);\n      return useMemo(() => {\n        const fetchNextPage = () => {\n          return trigger(stableArg, 'forward');\n        };\n        const fetchPreviousPage = () => {\n          return trigger(stableArg, 'backward');\n        };\n        return {\n          trigger,\n          /**\n           * A method to manually refetch data for the query\n           */\n          refetch,\n          fetchNextPage,\n          fetchPreviousPage\n        };\n      }, [refetch, trigger, stableArg]);\n    };\n    const useInfiniteQueryState: UseInfiniteQueryState<any> = buildUseQueryState(endpointName, infiniteQueryStatePreSelector);\n    return {\n      useInfiniteQueryState,\n      useInfiniteQuerySubscription,\n      useInfiniteQuery(arg, options) {\n        const {\n          refetch,\n          fetchNextPage,\n          fetchPreviousPage\n        } = useInfiniteQuerySubscription(arg, options);\n        const queryStateResults = useInfiniteQueryState(arg, {\n          selectFromResult: arg === skipToken || options?.skip ? undefined : noPendingQueryStateSelector,\n          ...options\n        });\n        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS, 'hasNextPage', 'hasPreviousPage');\n        useDebugValue(debugValue);\n        return useMemo(() => ({\n          ...queryStateResults,\n          fetchNextPage,\n          fetchPreviousPage,\n          refetch\n        }), [queryStateResults, fetchNextPage, fetchPreviousPage, refetch]);\n      }\n    };\n  }\n  function buildMutationHook(name: string): UseMutation<any> {\n    return ({\n      selectFromResult,\n      fixedCacheKey\n    } = {}) => {\n      const {\n        select,\n        initiate\n      } = api.endpoints[name] as ApiEndpointMutation<MutationDefinition<any, any, any, any, any>, Definitions>;\n      const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n      const [promise, setPromise] = useState<MutationActionCreatorResult<any>>();\n      useEffect(() => () => {\n        if (!promise?.arg.fixedCacheKey) {\n          promise?.reset();\n        }\n      }, [promise]);\n      const triggerMutation = useCallback(function (arg: Parameters<typeof initiate>['0']) {\n        const promise = dispatch(initiate(arg, {\n          fixedCacheKey\n        }));\n        setPromise(promise);\n        return promise;\n      }, [dispatch, initiate, fixedCacheKey]);\n      const {\n        requestId\n      } = promise || {};\n      const selectDefaultResult = useMemo(() => select({\n        fixedCacheKey,\n        requestId: promise?.requestId\n      }), [fixedCacheKey, promise, select]);\n      const mutationSelector = useMemo((): Selector<RootState<Definitions, any, any>, any> => selectFromResult ? createSelector([selectDefaultResult], selectFromResult) : selectDefaultResult, [selectFromResult, selectDefaultResult]);\n      const currentState = useSelector(mutationSelector, shallowEqual);\n      const originalArgs = fixedCacheKey == null ? promise?.arg.originalArgs : undefined;\n      const reset = useCallback(() => {\n        batch(() => {\n          if (promise) {\n            setPromise(undefined);\n          }\n          if (fixedCacheKey) {\n            dispatch(api.internalActions.removeMutationResult({\n              requestId,\n              fixedCacheKey\n            }));\n          }\n        });\n      }, [dispatch, fixedCacheKey, promise, requestId]);\n      const debugValue = pick(currentState, ...COMMON_HOOK_DEBUG_FIELDS, 'endpointName');\n      useDebugValue(debugValue);\n      const finalState = useMemo(() => ({\n        ...currentState,\n        originalArgs,\n        reset\n      }), [currentState, originalArgs, reset]);\n      return useMemo(() => [triggerMutation, finalState] as const, [triggerMutation, finalState]);\n    };\n  }\n}","export { useEffect, useRef, useMemo, useContext, useCallback, useDebugValue, useLayoutEffect, useState } from 'react';","export { shallowEqual, Provider, ReactReduxContext } from 'react-redux';","export const UNINITIALIZED_VALUE = Symbol();\nexport type UninitializedValue = typeof UNINITIALIZED_VALUE;","import { useEffect, useRef, useMemo } from './reactImports';\nimport { copyWithStructuralSharing } from './rtkqImports';\nexport function useStableQueryArgs<T>(queryArgs: T) {\n  const cache = useRef(queryArgs);\n  const copy = useMemo(() => copyWithStructuralSharing(cache.current, queryArgs), [queryArgs]);\n  useEffect(() => {\n    if (cache.current !== copy) {\n      cache.current = copy;\n    }\n  }, [copy]);\n  return copy;\n}","import { useEffect, useRef } from './reactImports';\nimport { shallowEqual } from './reactReduxImports';\nexport function useShallowStableValue<T>(value: T) {\n  const cache = useRef(value);\n  useEffect(() => {\n    if (!shallowEqual(cache.current, value)) {\n      cache.current = value;\n    }\n  }, [value]);\n  return shallowEqual(cache.current, value) ? cache.current : value;\n}","// This must remain here so that the `mangleErrors.cjs` build script\n// does not have to import this into each source file it rewrites.\nimport { formatProdErrorMessage } from '@reduxjs/toolkit';\nimport { buildCreateApi, coreModule } from './rtkqImports';\nimport { reactHooksModule, reactHooksModuleName } from './module';\nexport * from '@reduxjs/toolkit/query';\nexport { ApiProvider } from './ApiProvider';\nconst createApi = /* @__PURE__ */buildCreateApi(coreModule(), reactHooksModule());\nexport type { TypedUseMutationResult, TypedUseQueryHookResult, TypedUseQueryStateResult, TypedUseQuerySubscriptionResult, TypedLazyQueryTrigger, TypedUseLazyQuery, TypedUseMutation, TypedMutationTrigger, TypedQueryStateSelector, TypedUseQueryState, TypedUseQuery, TypedUseQuerySubscription, TypedUseLazyQuerySubscription, TypedUseQueryStateOptions, TypedUseLazyQueryStateResult, TypedUseInfiniteQuery, TypedUseInfiniteQueryHookResult, TypedUseInfiniteQueryStateResult, TypedUseInfiniteQuerySubscriptionResult, TypedUseInfiniteQueryStateOptions, TypedInfiniteQueryStateSelector, TypedUseInfiniteQuerySubscription, TypedUseInfiniteQueryState, TypedLazyInfiniteQueryTrigger } from './buildHooks';\nexport { UNINITIALIZED_VALUE } from './constants';\nexport { createApi, reactHooksModule, reactHooksModuleName };","import { configureStore, formatProdErrorMessage as _formatProdErrorMessage } from '@reduxjs/toolkit';\nimport type { Context } from 'react';\nimport { useContext, useEffect } from './reactImports';\nimport * as React from 'react';\nimport type { ReactReduxContextValue } from 'react-redux';\nimport { Provider, ReactReduxContext } from './reactReduxImports';\nimport { setupListeners } from './rtkqImports';\nimport type { Api } from '@reduxjs/toolkit/query';\n\n/**\n * Can be used as a `Provider` if you **do not already have a Redux store**.\n *\n * @example\n * ```tsx\n * // codeblock-meta no-transpile title=\"Basic usage - wrap your App with ApiProvider\"\n * import * as React from 'react';\n * import { ApiProvider } from '@reduxjs/toolkit/query/react';\n * import { Pokemon } from './features/Pokemon';\n *\n * function App() {\n *   return (\n *     <ApiProvider api={api}>\n *       <Pokemon />\n *     </ApiProvider>\n *   );\n * }\n * ```\n *\n * @remarks\n * Using this together with an existing redux store, both will\n * conflict with each other - please use the traditional redux setup\n * in that case.\n */\nexport function ApiProvider(props: {\n  children: any;\n  api: Api<any, {}, any, any>;\n  setupListeners?: Parameters<typeof setupListeners>[1] | false;\n  context?: Context<ReactReduxContextValue | null>;\n}) {\n  const context = props.context || ReactReduxContext;\n  const existingContext = useContext(context);\n  if (existingContext) {\n    throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(35) : 'Existing Redux context detected. If you already have a store set up, please use the traditional Redux setup.');\n  }\n  const [store] = React.useState(() => configureStore({\n    reducer: {\n      [props.api.reducerPath]: props.api.reducer\n    },\n    middleware: gDM => gDM().concat(props.api.middleware)\n  }));\n  // Adds the event listeners for online/offline/focus/etc\n  useEffect((): undefined | (() => void) => props.setupListeners === false ? undefined : setupListeners(store.dispatch, props.setupListeners), [props.setupListeners, store.dispatch]);\n  return <Provider store={store} context={context}>\n      {props.children}\n    </Provider>;\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB,YAAY,2BAA2B,gBAAgB,aAAa,iBAAiB;;;ACA9G,SAAS,0BAA0BA,gCAA+B;AAElE,SAAS,SAAS,SAAS,eAAe,eAAe,eAAe,eAAe,YAAY,kBAAkB;AAErH,SAAS,kBAAkB,uBAAuB;;;ACJ3C,SAAS,WAAW,KAAa;AACtC,SAAO,IAAI,QAAQ,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,YAAY,CAAC;AACjD;;;ACGO,SAAS,gBAAgB,KAAuB;AACrD,MAAI,QAAQ;AACZ,aAAW,QAAQ,KAAK;AACtB;AAAA,EACF;AACA,SAAO;AACT;;;AC8XO,IAAM,iBAAiB;AACvB,IAAM,oBAAoB;AAC1B,IAAM,yBAAyB;AA+c/B,SAAS,kBAAkB,GAA8G;AAC9I,SAAO,EAAE,SAAS;AACpB;AACO,SAAS,qBAAqB,GAAiH;AACpJ,SAAO,EAAE,SAAS;AACpB;AACO,SAAS,0BAA0B,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AI,UAAU;AAAA,EACtD,CAAC,CAAC;AAEF,YAAU,MAAgC,MAAM,mBAAmB,QAAQ,SAAY,eAAe,MAAM,UAAU,MAAM,cAAc,GAAG,CAAC,MAAM,gBAAgB,MAAM,QAAQ,CAAC;AACnL,SAAO,oCAAC,YAAS,OAAc,WAC1B,MAAM,QACT;AACJ;;;ADhDA,IAAM,YAA2B,+BAAe,WAAW,GAAG,iBAAiB,CAAC;","names":["_formatProdErrorMessage","_a","arg","options","promise","_formatProdErrorMessage","_formatProdErrorMessage","_formatProdErrorMessage"]}
Index: node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.modern.mjs
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.modern.mjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.modern.mjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,705 @@
+// src/query/react/rtkqImports.ts
+import { buildCreateApi, coreModule, copyWithStructuralSharing, setupListeners, QueryStatus, skipToken } from "@reduxjs/toolkit/query";
+
+// src/query/react/module.ts
+import { formatProdErrorMessage as _formatProdErrorMessage4 } from "@reduxjs/toolkit";
+import { batch as rrBatch, useDispatch as rrUseDispatch, useSelector as rrUseSelector, useStore as rrUseStore } from "react-redux";
+import { createSelector as _createSelector } from "reselect";
+
+// src/query/utils/capitalize.ts
+function capitalize(str) {
+  return str.replace(str[0], str[0].toUpperCase());
+}
+
+// src/query/utils/countObjectKeys.ts
+function countObjectKeys(obj) {
+  let count = 0;
+  for (const _key in obj) {
+    count++;
+  }
+  return count;
+}
+
+// src/query/endpointDefinitions.ts
+var ENDPOINT_QUERY = "query" /* query */;
+var ENDPOINT_MUTATION = "mutation" /* mutation */;
+var ENDPOINT_INFINITEQUERY = "infinitequery" /* infinitequery */;
+function isQueryDefinition(e) {
+  return e.type === ENDPOINT_QUERY;
+}
+function isMutationDefinition(e) {
+  return e.type === ENDPOINT_MUTATION;
+}
+function isInfiniteQueryDefinition(e) {
+  return e.type === ENDPOINT_INFINITEQUERY;
+}
+
+// src/query/tsHelpers.ts
+function safeAssign(target, ...args) {
+  return Object.assign(target, ...args);
+}
+
+// src/query/react/buildHooks.ts
+import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3 } from "@reduxjs/toolkit";
+
+// src/query/react/reactImports.ts
+import { useEffect, useRef, useMemo, useContext, useCallback, useDebugValue, useLayoutEffect, useState } from "react";
+
+// src/query/react/reactReduxImports.ts
+import { shallowEqual, Provider, ReactReduxContext } from "react-redux";
+
+// src/query/react/constants.ts
+var UNINITIALIZED_VALUE = Symbol();
+
+// src/query/react/useSerializedStableValue.ts
+function useStableQueryArgs(queryArgs) {
+  const cache = useRef(queryArgs);
+  const copy = useMemo(() => copyWithStructuralSharing(cache.current, queryArgs), [queryArgs]);
+  useEffect(() => {
+    if (cache.current !== copy) {
+      cache.current = copy;
+    }
+  }, [copy]);
+  return copy;
+}
+
+// src/query/react/useShallowStableValue.ts
+function useShallowStableValue(value) {
+  const cache = useRef(value);
+  useEffect(() => {
+    if (!shallowEqual(cache.current, value)) {
+      cache.current = value;
+    }
+  }, [value]);
+  return shallowEqual(cache.current, value) ? cache.current : value;
+}
+
+// src/query/react/buildHooks.ts
+var canUseDOM = () => !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
+var isDOM = /* @__PURE__ */ canUseDOM();
+var isRunningInReactNative = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
+var isReactNative = /* @__PURE__ */ isRunningInReactNative();
+var getUseIsomorphicLayoutEffect = () => isDOM || isReactNative ? useLayoutEffect : useEffect;
+var useIsomorphicLayoutEffect = /* @__PURE__ */ getUseIsomorphicLayoutEffect();
+var noPendingQueryStateSelector = (selected) => {
+  if (selected.isUninitialized) {
+    return {
+      ...selected,
+      isUninitialized: false,
+      isFetching: true,
+      isLoading: selected.data !== void 0 ? false : true,
+      // This is the one place where we still have to use `QueryStatus` as an enum,
+      // since it's the only reference in the React package and not in the core.
+      status: QueryStatus.pending
+    };
+  }
+  return selected;
+};
+function pick(obj, ...keys) {
+  const ret = {};
+  keys.forEach((key) => {
+    ret[key] = obj[key];
+  });
+  return ret;
+}
+var COMMON_HOOK_DEBUG_FIELDS = ["data", "status", "isLoading", "isSuccess", "isError", "error"];
+function buildHooks({
+  api,
+  moduleOptions: {
+    batch,
+    hooks: {
+      useDispatch,
+      useSelector,
+      useStore
+    },
+    unstable__sideEffectsInRender,
+    createSelector
+  },
+  serializeQueryArgs,
+  context
+}) {
+  const usePossiblyImmediateEffect = unstable__sideEffectsInRender ? (cb) => cb() : useEffect;
+  const unsubscribePromiseRef = (ref) => ref.current?.unsubscribe?.();
+  const endpointDefinitions = context.endpointDefinitions;
+  return {
+    buildQueryHooks,
+    buildInfiniteQueryHooks,
+    buildMutationHook,
+    usePrefetch
+  };
+  function queryStatePreSelector(currentState, lastResult, queryArgs) {
+    if (lastResult?.endpointName && currentState.isUninitialized) {
+      const {
+        endpointName
+      } = lastResult;
+      const endpointDefinition = endpointDefinitions[endpointName];
+      if (queryArgs !== skipToken && serializeQueryArgs({
+        queryArgs: lastResult.originalArgs,
+        endpointDefinition,
+        endpointName
+      }) === serializeQueryArgs({
+        queryArgs,
+        endpointDefinition,
+        endpointName
+      })) lastResult = void 0;
+    }
+    let data = currentState.isSuccess ? currentState.data : lastResult?.data;
+    if (data === void 0) data = currentState.data;
+    const hasData = data !== void 0;
+    const isFetching = currentState.isLoading;
+    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;
+    const isSuccess = currentState.isSuccess || hasData && (isFetching && !lastResult?.isError || currentState.isUninitialized);
+    return {
+      ...currentState,
+      data,
+      currentData: currentState.data,
+      isFetching,
+      isLoading,
+      isSuccess
+    };
+  }
+  function infiniteQueryStatePreSelector(currentState, lastResult, queryArgs) {
+    if (lastResult?.endpointName && currentState.isUninitialized) {
+      const {
+        endpointName
+      } = lastResult;
+      const endpointDefinition = endpointDefinitions[endpointName];
+      if (queryArgs !== skipToken && serializeQueryArgs({
+        queryArgs: lastResult.originalArgs,
+        endpointDefinition,
+        endpointName
+      }) === serializeQueryArgs({
+        queryArgs,
+        endpointDefinition,
+        endpointName
+      })) lastResult = void 0;
+    }
+    let data = currentState.isSuccess ? currentState.data : lastResult?.data;
+    if (data === void 0) data = currentState.data;
+    const hasData = data !== void 0;
+    const isFetching = currentState.isLoading;
+    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;
+    const isSuccess = currentState.isSuccess || isFetching && hasData;
+    return {
+      ...currentState,
+      data,
+      currentData: currentState.data,
+      isFetching,
+      isLoading,
+      isSuccess
+    };
+  }
+  function usePrefetch(endpointName, defaultOptions) {
+    const dispatch = useDispatch();
+    const stableDefaultOptions = useShallowStableValue(defaultOptions);
+    return useCallback((arg, options) => dispatch(api.util.prefetch(endpointName, arg, {
+      ...stableDefaultOptions,
+      ...options
+    })), [endpointName, dispatch, stableDefaultOptions]);
+  }
+  function useQuerySubscriptionCommonImpl(endpointName, arg, {
+    refetchOnReconnect,
+    refetchOnFocus,
+    refetchOnMountOrArgChange,
+    skip = false,
+    pollingInterval = 0,
+    skipPollingIfUnfocused = false,
+    ...rest
+  } = {}) {
+    const {
+      initiate
+    } = api.endpoints[endpointName];
+    const dispatch = useDispatch();
+    const subscriptionSelectorsRef = useRef(void 0);
+    if (!subscriptionSelectorsRef.current) {
+      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());
+      if (process.env.NODE_ENV !== "production") {
+        if (typeof returnedValue !== "object" || typeof returnedValue?.type === "string") {
+          throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage(37) : `Warning: Middleware for RTK-Query API at reducerPath "${api.reducerPath}" has not been added to the store.
+    You must add the middleware for RTK-Query to function correctly!`);
+        }
+      }
+      subscriptionSelectorsRef.current = returnedValue;
+    }
+    const stableArg = useStableQueryArgs(skip ? skipToken : arg);
+    const stableSubscriptionOptions = useShallowStableValue({
+      refetchOnReconnect,
+      refetchOnFocus,
+      pollingInterval,
+      skipPollingIfUnfocused
+    });
+    const initialPageParam = rest.initialPageParam;
+    const stableInitialPageParam = useShallowStableValue(initialPageParam);
+    const refetchCachedPages = rest.refetchCachedPages;
+    const stableRefetchCachedPages = useShallowStableValue(refetchCachedPages);
+    const promiseRef = useRef(void 0);
+    let {
+      queryCacheKey,
+      requestId
+    } = promiseRef.current || {};
+    let currentRenderHasSubscription = false;
+    if (queryCacheKey && requestId) {
+      currentRenderHasSubscription = subscriptionSelectorsRef.current.isRequestSubscribed(queryCacheKey, requestId);
+    }
+    const subscriptionRemoved = !currentRenderHasSubscription && promiseRef.current !== void 0;
+    usePossiblyImmediateEffect(() => {
+      if (subscriptionRemoved) {
+        promiseRef.current = void 0;
+      }
+    }, [subscriptionRemoved]);
+    usePossiblyImmediateEffect(() => {
+      const lastPromise = promiseRef.current;
+      if (typeof process !== "undefined" && process.env.NODE_ENV === "removeMeOnCompilation") {
+        console.log(subscriptionRemoved);
+      }
+      if (stableArg === skipToken) {
+        lastPromise?.unsubscribe();
+        promiseRef.current = void 0;
+        return;
+      }
+      const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions;
+      if (!lastPromise || lastPromise.arg !== stableArg) {
+        lastPromise?.unsubscribe();
+        const promise = dispatch(initiate(stableArg, {
+          subscriptionOptions: stableSubscriptionOptions,
+          forceRefetch: refetchOnMountOrArgChange,
+          ...isInfiniteQueryDefinition(endpointDefinitions[endpointName]) ? {
+            initialPageParam: stableInitialPageParam,
+            refetchCachedPages: stableRefetchCachedPages
+          } : {}
+        }));
+        promiseRef.current = promise;
+      } else if (stableSubscriptionOptions !== lastSubscriptionOptions) {
+        lastPromise.updateSubscriptionOptions(stableSubscriptionOptions);
+      }
+    }, [dispatch, initiate, refetchOnMountOrArgChange, stableArg, stableSubscriptionOptions, subscriptionRemoved, stableInitialPageParam, stableRefetchCachedPages, endpointName]);
+    return [promiseRef, dispatch, initiate, stableSubscriptionOptions];
+  }
+  function buildUseQueryState(endpointName, preSelector) {
+    const useQueryState = (arg, {
+      skip = false,
+      selectFromResult
+    } = {}) => {
+      const {
+        select
+      } = api.endpoints[endpointName];
+      const stableArg = useStableQueryArgs(skip ? skipToken : arg);
+      const lastValue = useRef(void 0);
+      const selectDefaultResult = useMemo(() => (
+        // Normally ts-ignores are bad and should be avoided, but we're
+        // already casting this selector to be `Selector<any>` anyway,
+        // so the inconsistencies don't matter here
+        // @ts-ignore
+        createSelector([
+          // @ts-ignore
+          select(stableArg),
+          (_, lastResult) => lastResult,
+          (_) => stableArg
+        ], preSelector, {
+          memoizeOptions: {
+            resultEqualityCheck: shallowEqual
+          }
+        })
+      ), [select, stableArg]);
+      const querySelector = useMemo(() => selectFromResult ? createSelector([selectDefaultResult], selectFromResult, {
+        devModeChecks: {
+          identityFunctionCheck: "never"
+        }
+      }) : selectDefaultResult, [selectDefaultResult, selectFromResult]);
+      const currentState = useSelector((state) => querySelector(state, lastValue.current), shallowEqual);
+      const store = useStore();
+      const newLastValue = selectDefaultResult(store.getState(), lastValue.current);
+      useIsomorphicLayoutEffect(() => {
+        lastValue.current = newLastValue;
+      }, [newLastValue]);
+      return currentState;
+    };
+    return useQueryState;
+  }
+  function usePromiseRefUnsubscribeOnUnmount(promiseRef) {
+    useEffect(() => {
+      return () => {
+        unsubscribePromiseRef(promiseRef);
+        promiseRef.current = void 0;
+      };
+    }, [promiseRef]);
+  }
+  function refetchOrErrorIfUnmounted(promiseRef) {
+    if (!promiseRef.current) throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage2(38) : "Cannot refetch a query that has not been started yet.");
+    return promiseRef.current.refetch();
+  }
+  function buildQueryHooks(endpointName) {
+    const useQuerySubscription = (arg, options = {}) => {
+      const [promiseRef] = useQuerySubscriptionCommonImpl(endpointName, arg, options);
+      usePromiseRefUnsubscribeOnUnmount(promiseRef);
+      return useMemo(() => ({
+        /**
+         * A method to manually refetch data for the query
+         */
+        refetch: () => refetchOrErrorIfUnmounted(promiseRef)
+      }), [promiseRef]);
+    };
+    const useLazyQuerySubscription = ({
+      refetchOnReconnect,
+      refetchOnFocus,
+      pollingInterval = 0,
+      skipPollingIfUnfocused = false
+    } = {}) => {
+      const {
+        initiate
+      } = api.endpoints[endpointName];
+      const dispatch = useDispatch();
+      const [arg, setArg] = useState(UNINITIALIZED_VALUE);
+      const promiseRef = useRef(void 0);
+      const stableSubscriptionOptions = useShallowStableValue({
+        refetchOnReconnect,
+        refetchOnFocus,
+        pollingInterval,
+        skipPollingIfUnfocused
+      });
+      usePossiblyImmediateEffect(() => {
+        const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions;
+        if (stableSubscriptionOptions !== lastSubscriptionOptions) {
+          promiseRef.current?.updateSubscriptionOptions(stableSubscriptionOptions);
+        }
+      }, [stableSubscriptionOptions]);
+      const subscriptionOptionsRef = useRef(stableSubscriptionOptions);
+      usePossiblyImmediateEffect(() => {
+        subscriptionOptionsRef.current = stableSubscriptionOptions;
+      }, [stableSubscriptionOptions]);
+      const trigger = useCallback(function(arg2, preferCacheValue = false) {
+        let promise;
+        batch(() => {
+          unsubscribePromiseRef(promiseRef);
+          promiseRef.current = promise = dispatch(initiate(arg2, {
+            subscriptionOptions: subscriptionOptionsRef.current,
+            forceRefetch: !preferCacheValue
+          }));
+          setArg(arg2);
+        });
+        return promise;
+      }, [dispatch, initiate]);
+      const reset = useCallback(() => {
+        if (promiseRef.current?.queryCacheKey) {
+          dispatch(api.internalActions.removeQueryResult({
+            queryCacheKey: promiseRef.current?.queryCacheKey
+          }));
+        }
+      }, [dispatch]);
+      useEffect(() => {
+        return () => {
+          unsubscribePromiseRef(promiseRef);
+        };
+      }, []);
+      useEffect(() => {
+        if (arg !== UNINITIALIZED_VALUE && !promiseRef.current) {
+          trigger(arg, true);
+        }
+      }, [arg, trigger]);
+      return useMemo(() => [trigger, arg, {
+        reset
+      }], [trigger, arg, reset]);
+    };
+    const useQueryState = buildUseQueryState(endpointName, queryStatePreSelector);
+    return {
+      useQueryState,
+      useQuerySubscription,
+      useLazyQuerySubscription,
+      useLazyQuery(options) {
+        const [trigger, arg, {
+          reset
+        }] = useLazyQuerySubscription(options);
+        const queryStateResults = useQueryState(arg, {
+          ...options,
+          skip: arg === UNINITIALIZED_VALUE
+        });
+        const info = useMemo(() => ({
+          lastArg: arg
+        }), [arg]);
+        return useMemo(() => [trigger, {
+          ...queryStateResults,
+          reset
+        }, info], [trigger, queryStateResults, reset, info]);
+      },
+      useQuery(arg, options) {
+        const querySubscriptionResults = useQuerySubscription(arg, options);
+        const queryStateResults = useQueryState(arg, {
+          selectFromResult: arg === skipToken || options?.skip ? void 0 : noPendingQueryStateSelector,
+          ...options
+        });
+        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS);
+        useDebugValue(debugValue);
+        return useMemo(() => ({
+          ...queryStateResults,
+          ...querySubscriptionResults
+        }), [queryStateResults, querySubscriptionResults]);
+      }
+    };
+  }
+  function buildInfiniteQueryHooks(endpointName) {
+    const useInfiniteQuerySubscription = (arg, options = {}) => {
+      const [promiseRef, dispatch, initiate, stableSubscriptionOptions] = useQuerySubscriptionCommonImpl(endpointName, arg, options);
+      const subscriptionOptionsRef = useRef(stableSubscriptionOptions);
+      usePossiblyImmediateEffect(() => {
+        subscriptionOptionsRef.current = stableSubscriptionOptions;
+      }, [stableSubscriptionOptions]);
+      const hookRefetchCachedPages = options.refetchCachedPages;
+      const stableHookRefetchCachedPages = useShallowStableValue(hookRefetchCachedPages);
+      const trigger = useCallback(function(arg2, direction) {
+        let promise;
+        batch(() => {
+          unsubscribePromiseRef(promiseRef);
+          promiseRef.current = promise = dispatch(initiate(arg2, {
+            subscriptionOptions: subscriptionOptionsRef.current,
+            direction
+          }));
+        });
+        return promise;
+      }, [promiseRef, dispatch, initiate]);
+      usePromiseRefUnsubscribeOnUnmount(promiseRef);
+      const stableArg = useStableQueryArgs(options.skip ? skipToken : arg);
+      const refetch = useCallback((options2) => {
+        if (!promiseRef.current) throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage3(38) : "Cannot refetch a query that has not been started yet.");
+        const mergedOptions = {
+          refetchCachedPages: options2?.refetchCachedPages ?? stableHookRefetchCachedPages
+        };
+        return promiseRef.current.refetch(mergedOptions);
+      }, [promiseRef, stableHookRefetchCachedPages]);
+      return useMemo(() => {
+        const fetchNextPage = () => {
+          return trigger(stableArg, "forward");
+        };
+        const fetchPreviousPage = () => {
+          return trigger(stableArg, "backward");
+        };
+        return {
+          trigger,
+          /**
+           * A method to manually refetch data for the query
+           */
+          refetch,
+          fetchNextPage,
+          fetchPreviousPage
+        };
+      }, [refetch, trigger, stableArg]);
+    };
+    const useInfiniteQueryState = buildUseQueryState(endpointName, infiniteQueryStatePreSelector);
+    return {
+      useInfiniteQueryState,
+      useInfiniteQuerySubscription,
+      useInfiniteQuery(arg, options) {
+        const {
+          refetch,
+          fetchNextPage,
+          fetchPreviousPage
+        } = useInfiniteQuerySubscription(arg, options);
+        const queryStateResults = useInfiniteQueryState(arg, {
+          selectFromResult: arg === skipToken || options?.skip ? void 0 : noPendingQueryStateSelector,
+          ...options
+        });
+        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS, "hasNextPage", "hasPreviousPage");
+        useDebugValue(debugValue);
+        return useMemo(() => ({
+          ...queryStateResults,
+          fetchNextPage,
+          fetchPreviousPage,
+          refetch
+        }), [queryStateResults, fetchNextPage, fetchPreviousPage, refetch]);
+      }
+    };
+  }
+  function buildMutationHook(name) {
+    return ({
+      selectFromResult,
+      fixedCacheKey
+    } = {}) => {
+      const {
+        select,
+        initiate
+      } = api.endpoints[name];
+      const dispatch = useDispatch();
+      const [promise, setPromise] = useState();
+      useEffect(() => () => {
+        if (!promise?.arg.fixedCacheKey) {
+          promise?.reset();
+        }
+      }, [promise]);
+      const triggerMutation = useCallback(function(arg) {
+        const promise2 = dispatch(initiate(arg, {
+          fixedCacheKey
+        }));
+        setPromise(promise2);
+        return promise2;
+      }, [dispatch, initiate, fixedCacheKey]);
+      const {
+        requestId
+      } = promise || {};
+      const selectDefaultResult = useMemo(() => select({
+        fixedCacheKey,
+        requestId: promise?.requestId
+      }), [fixedCacheKey, promise, select]);
+      const mutationSelector = useMemo(() => selectFromResult ? createSelector([selectDefaultResult], selectFromResult) : selectDefaultResult, [selectFromResult, selectDefaultResult]);
+      const currentState = useSelector(mutationSelector, shallowEqual);
+      const originalArgs = fixedCacheKey == null ? promise?.arg.originalArgs : void 0;
+      const reset = useCallback(() => {
+        batch(() => {
+          if (promise) {
+            setPromise(void 0);
+          }
+          if (fixedCacheKey) {
+            dispatch(api.internalActions.removeMutationResult({
+              requestId,
+              fixedCacheKey
+            }));
+          }
+        });
+      }, [dispatch, fixedCacheKey, promise, requestId]);
+      const debugValue = pick(currentState, ...COMMON_HOOK_DEBUG_FIELDS, "endpointName");
+      useDebugValue(debugValue);
+      const finalState = useMemo(() => ({
+        ...currentState,
+        originalArgs,
+        reset
+      }), [currentState, originalArgs, reset]);
+      return useMemo(() => [triggerMutation, finalState], [triggerMutation, finalState]);
+    };
+  }
+}
+
+// src/query/react/module.ts
+var reactHooksModuleName = /* @__PURE__ */ Symbol();
+var reactHooksModule = ({
+  batch = rrBatch,
+  hooks = {
+    useDispatch: rrUseDispatch,
+    useSelector: rrUseSelector,
+    useStore: rrUseStore
+  },
+  createSelector = _createSelector,
+  unstable__sideEffectsInRender = false,
+  ...rest
+} = {}) => {
+  if (process.env.NODE_ENV !== "production") {
+    const hookNames = ["useDispatch", "useSelector", "useStore"];
+    let warned = false;
+    for (const hookName of hookNames) {
+      if (countObjectKeys(rest) > 0) {
+        if (rest[hookName]) {
+          if (!warned) {
+            console.warn("As of RTK 2.0, the hooks now need to be specified as one object, provided under a `hooks` key:\n`reactHooksModule({ hooks: { useDispatch, useSelector, useStore } })`");
+            warned = true;
+          }
+        }
+        hooks[hookName] = rest[hookName];
+      }
+      if (typeof hooks[hookName] !== "function") {
+        throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage4(36) : `When using custom hooks for context, all ${hookNames.length} hooks need to be provided: ${hookNames.join(", ")}.
+Hook ${hookName} was either not provided or not a function.`);
+      }
+    }
+  }
+  return {
+    name: reactHooksModuleName,
+    init(api, {
+      serializeQueryArgs
+    }, context) {
+      const anyApi = api;
+      const {
+        buildQueryHooks,
+        buildInfiniteQueryHooks,
+        buildMutationHook,
+        usePrefetch
+      } = buildHooks({
+        api,
+        moduleOptions: {
+          batch,
+          hooks,
+          unstable__sideEffectsInRender,
+          createSelector
+        },
+        serializeQueryArgs,
+        context
+      });
+      safeAssign(anyApi, {
+        usePrefetch
+      });
+      safeAssign(context, {
+        batch
+      });
+      return {
+        injectEndpoint(endpointName, definition) {
+          if (isQueryDefinition(definition)) {
+            const {
+              useQuery,
+              useLazyQuery,
+              useLazyQuerySubscription,
+              useQueryState,
+              useQuerySubscription
+            } = buildQueryHooks(endpointName);
+            safeAssign(anyApi.endpoints[endpointName], {
+              useQuery,
+              useLazyQuery,
+              useLazyQuerySubscription,
+              useQueryState,
+              useQuerySubscription
+            });
+            api[`use${capitalize(endpointName)}Query`] = useQuery;
+            api[`useLazy${capitalize(endpointName)}Query`] = useLazyQuery;
+          }
+          if (isMutationDefinition(definition)) {
+            const useMutation = buildMutationHook(endpointName);
+            safeAssign(anyApi.endpoints[endpointName], {
+              useMutation
+            });
+            api[`use${capitalize(endpointName)}Mutation`] = useMutation;
+          } else if (isInfiniteQueryDefinition(definition)) {
+            const {
+              useInfiniteQuery,
+              useInfiniteQuerySubscription,
+              useInfiniteQueryState
+            } = buildInfiniteQueryHooks(endpointName);
+            safeAssign(anyApi.endpoints[endpointName], {
+              useInfiniteQuery,
+              useInfiniteQuerySubscription,
+              useInfiniteQueryState
+            });
+            api[`use${capitalize(endpointName)}InfiniteQuery`] = useInfiniteQuery;
+          }
+        }
+      };
+    }
+  };
+};
+
+// src/query/react/index.ts
+export * from "@reduxjs/toolkit/query";
+
+// src/query/react/ApiProvider.tsx
+import { configureStore, formatProdErrorMessage as _formatProdErrorMessage5 } from "@reduxjs/toolkit";
+import * as React from "react";
+function ApiProvider(props) {
+  const context = props.context || ReactReduxContext;
+  const existingContext = useContext(context);
+  if (existingContext) {
+    throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage5(35) : "Existing Redux context detected. If you already have a store set up, please use the traditional Redux setup.");
+  }
+  const [store] = React.useState(() => configureStore({
+    reducer: {
+      [props.api.reducerPath]: props.api.reducer
+    },
+    middleware: (gDM) => gDM().concat(props.api.middleware)
+  }));
+  useEffect(() => props.setupListeners === false ? void 0 : setupListeners(store.dispatch, props.setupListeners), [props.setupListeners, store.dispatch]);
+  return /* @__PURE__ */ React.createElement(Provider, { store, context }, props.children);
+}
+
+// src/query/react/index.ts
+var createApi = /* @__PURE__ */ buildCreateApi(coreModule(), reactHooksModule());
+export {
+  ApiProvider,
+  UNINITIALIZED_VALUE,
+  createApi,
+  reactHooksModule,
+  reactHooksModuleName
+};
+//# sourceMappingURL=rtk-query-react.modern.mjs.map
Index: node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.modern.mjs.map
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.modern.mjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.modern.mjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,1 @@
+{"version":3,"sources":["../../../src/query/react/rtkqImports.ts","../../../src/query/react/module.ts","../../../src/query/utils/capitalize.ts","../../../src/query/utils/countObjectKeys.ts","../../../src/query/endpointDefinitions.ts","../../../src/query/tsHelpers.ts","../../../src/query/react/buildHooks.ts","../../../src/query/react/reactImports.ts","../../../src/query/react/reactReduxImports.ts","../../../src/query/react/constants.ts","../../../src/query/react/useSerializedStableValue.ts","../../../src/query/react/useShallowStableValue.ts","../../../src/query/react/index.ts","../../../src/query/react/ApiProvider.tsx"],"sourcesContent":["export { buildCreateApi, coreModule, copyWithStructuralSharing, setupListeners, QueryStatus, skipToken } from '@reduxjs/toolkit/query';","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { Api, BaseQueryFn, EndpointDefinitions, InfiniteQueryDefinition, Module, MutationDefinition, PrefetchOptions, QueryArgFrom, QueryDefinition, QueryKeys } from '@reduxjs/toolkit/query';\nimport { batch as rrBatch, useDispatch as rrUseDispatch, useSelector as rrUseSelector, useStore as rrUseStore } from 'react-redux';\nimport type { CreateSelectorFunction } from 'reselect';\nimport { createSelector as _createSelector } from 'reselect';\nimport { isInfiniteQueryDefinition, isMutationDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { safeAssign } from '../tsHelpers';\nimport { capitalize, countObjectKeys } from '../utils';\nimport type { InfiniteQueryHooks, MutationHooks, QueryHooks } from './buildHooks';\nimport { buildHooks } from './buildHooks';\nimport type { HooksWithUniqueNames } from './namedHooks';\nexport const reactHooksModuleName = /* @__PURE__ */Symbol();\nexport type ReactHooksModule = typeof reactHooksModuleName;\ndeclare module '@reduxjs/toolkit/query' {\n  export interface ApiModules<\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions,\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  ReducerPath extends string,\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  TagTypes extends string> {\n    [reactHooksModuleName]: {\n      /**\n       *  Endpoints based on the input endpoints provided to `createApi`, containing `select`, `hooks` and `action matchers`.\n       */\n      endpoints: { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? QueryHooks<Definitions[K]> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? MutationHooks<Definitions[K]> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryHooks<Definitions[K]> : never };\n      /**\n       * A hook that accepts a string endpoint name, and provides a callback that when called, pre-fetches the data for that endpoint.\n       */\n      usePrefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, options?: PrefetchOptions): (arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions) => void;\n    } & HooksWithUniqueNames<Definitions>;\n  }\n}\ntype RR = typeof import('react-redux');\nexport interface ReactHooksModuleOptions {\n  /**\n   * The hooks from React Redux to be used\n   */\n  hooks?: {\n    /**\n     * The version of the `useDispatch` hook to be used\n     */\n    useDispatch: RR['useDispatch'];\n    /**\n     * The version of the `useSelector` hook to be used\n     */\n    useSelector: RR['useSelector'];\n    /**\n     * The version of the `useStore` hook to be used\n     */\n    useStore: RR['useStore'];\n  };\n  /**\n   * The version of the `batchedUpdates` function to be used\n   */\n  batch?: RR['batch'];\n  /**\n   * Enables performing asynchronous tasks immediately within a render.\n   *\n   * @example\n   *\n   * ```ts\n   * import {\n   *   buildCreateApi,\n   *   coreModule,\n   *   reactHooksModule\n   * } from '@reduxjs/toolkit/query/react'\n   *\n   * const createApi = buildCreateApi(\n   *   coreModule(),\n   *   reactHooksModule({ unstable__sideEffectsInRender: true })\n   * )\n   * ```\n   */\n  unstable__sideEffectsInRender?: boolean;\n  /**\n   * A selector creator (usually from `reselect`, or matching the same signature)\n   */\n  createSelector?: CreateSelectorFunction<any, any, any>;\n}\n\n/**\n * Creates a module that generates react hooks from endpoints, for use with `buildCreateApi`.\n *\n *  @example\n * ```ts\n * const MyContext = React.createContext<ReactReduxContextValue | null>(null);\n * const customCreateApi = buildCreateApi(\n *   coreModule(),\n *   reactHooksModule({\n *     hooks: {\n *       useDispatch: createDispatchHook(MyContext),\n *       useSelector: createSelectorHook(MyContext),\n *       useStore: createStoreHook(MyContext)\n *     }\n *   })\n * );\n * ```\n *\n * @returns A module for use with `buildCreateApi`\n */\nexport const reactHooksModule = ({\n  batch = rrBatch,\n  hooks = {\n    useDispatch: rrUseDispatch,\n    useSelector: rrUseSelector,\n    useStore: rrUseStore\n  },\n  createSelector = _createSelector,\n  unstable__sideEffectsInRender = false,\n  ...rest\n}: ReactHooksModuleOptions = {}): Module<ReactHooksModule> => {\n  if (process.env.NODE_ENV !== 'production') {\n    const hookNames = ['useDispatch', 'useSelector', 'useStore'] as const;\n    let warned = false;\n    for (const hookName of hookNames) {\n      // warn for old hook options\n      if (countObjectKeys(rest) > 0) {\n        if ((rest as Partial<typeof hooks>)[hookName]) {\n          if (!warned) {\n            console.warn('As of RTK 2.0, the hooks now need to be specified as one object, provided under a `hooks` key:' + '\\n`reactHooksModule({ hooks: { useDispatch, useSelector, useStore } })`');\n            warned = true;\n          }\n        }\n        // migrate\n        // @ts-ignore\n        hooks[hookName] = rest[hookName];\n      }\n      // then make sure we have them all\n      if (typeof hooks[hookName] !== 'function') {\n        throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(36) : `When using custom hooks for context, all ${hookNames.length} hooks need to be provided: ${hookNames.join(', ')}.\\nHook ${hookName} was either not provided or not a function.`);\n      }\n    }\n  }\n  return {\n    name: reactHooksModuleName,\n    init(api, {\n      serializeQueryArgs\n    }, context) {\n      const anyApi = api as any as Api<any, Record<string, any>, any, any, ReactHooksModule>;\n      const {\n        buildQueryHooks,\n        buildInfiniteQueryHooks,\n        buildMutationHook,\n        usePrefetch\n      } = buildHooks({\n        api,\n        moduleOptions: {\n          batch,\n          hooks,\n          unstable__sideEffectsInRender,\n          createSelector\n        },\n        serializeQueryArgs,\n        context\n      });\n      safeAssign(anyApi, {\n        usePrefetch\n      });\n      safeAssign(context, {\n        batch\n      });\n      return {\n        injectEndpoint(endpointName, definition) {\n          if (isQueryDefinition(definition)) {\n            const {\n              useQuery,\n              useLazyQuery,\n              useLazyQuerySubscription,\n              useQueryState,\n              useQuerySubscription\n            } = buildQueryHooks(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useQuery,\n              useLazyQuery,\n              useLazyQuerySubscription,\n              useQueryState,\n              useQuerySubscription\n            });\n            (api as any)[`use${capitalize(endpointName)}Query`] = useQuery;\n            (api as any)[`useLazy${capitalize(endpointName)}Query`] = useLazyQuery;\n          }\n          if (isMutationDefinition(definition)) {\n            const useMutation = buildMutationHook(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useMutation\n            });\n            (api as any)[`use${capitalize(endpointName)}Mutation`] = useMutation;\n          } else if (isInfiniteQueryDefinition(definition)) {\n            const {\n              useInfiniteQuery,\n              useInfiniteQuerySubscription,\n              useInfiniteQueryState\n            } = buildInfiniteQueryHooks(endpointName);\n            safeAssign(anyApi.endpoints[endpointName], {\n              useInfiniteQuery,\n              useInfiniteQuerySubscription,\n              useInfiniteQueryState\n            });\n            (api as any)[`use${capitalize(endpointName)}InfiniteQuery`] = useInfiniteQuery;\n          }\n        }\n      };\n    }\n  };\n};","export function capitalize(str: string) {\n  return str.replace(str[0], str[0].toUpperCase());\n}","// Fast method for counting an object's keys\n// without resorting to `Object.keys(obj).length\n// Will this make a big difference in perf? Probably not\n// But we can save a few allocations.\n\nexport function countObjectKeys(obj: Record<any, any>) {\n  let count = 0;\n  for (const _key in obj) {\n    count++;\n  }\n  return count;\n}","import type { Api } from '@reduxjs/toolkit/query';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { BaseQueryApi, BaseQueryArg, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta, BaseQueryResult, QueryReturnValue } from './baseQueryTypes';\nimport type { CacheCollectionQueryExtraOptions } from './core/buildMiddleware/cacheCollection';\nimport type { CacheLifecycleInfiniteQueryExtraOptions, CacheLifecycleMutationExtraOptions, CacheLifecycleQueryExtraOptions } from './core/buildMiddleware/cacheLifecycle';\nimport type { QueryLifecycleInfiniteQueryExtraOptions, QueryLifecycleMutationExtraOptions, QueryLifecycleQueryExtraOptions } from './core/buildMiddleware/queryLifecycle';\nimport type { InfiniteData, InfiniteQueryConfigOptions, QuerySubState, RootState } from './core/index';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { NEVER } from './fakeBaseQuery';\nimport type { CastAny, HasRequiredProps, MaybePromise, NonUndefined, OmitFromUnion, UnwrapPromise } from './tsHelpers';\nimport { isNotNullish } from './utils';\nimport type { NamedSchemaError } from './standardSchema';\nimport { filterMap } from './utils/filterMap';\nconst rawResultType = /* @__PURE__ */Symbol();\nconst resultType = /* @__PURE__ */Symbol();\nconst baseQuery = /* @__PURE__ */Symbol();\nexport interface SchemaFailureInfo {\n  endpoint: string;\n  arg: any;\n  type: 'query' | 'mutation';\n  queryCacheKey?: string;\n}\nexport type SchemaFailureHandler = (error: NamedSchemaError, info: SchemaFailureInfo) => void;\nexport type SchemaFailureConverter<BaseQuery extends BaseQueryFn> = (error: NamedSchemaError, info: SchemaFailureInfo) => BaseQueryError<BaseQuery>;\nexport type EndpointDefinitionWithQuery<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery>> = {\n  /**\n   * `query` can be a function that returns either a `string` or an `object` which is passed to your `baseQuery`. If you are using [fetchBaseQuery](./fetchBaseQuery), this can return either a `string` or an `object` of properties in `FetchArgs`. If you use your own custom [`baseQuery`](../../rtk-query/usage/customizing-queries), you can customize this behavior to your liking.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"query example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       // highlight-start\n   *       query: () => 'posts',\n   *       // highlight-end\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *      // highlight-start\n   *      query: (body) => ({\n   *        url: `posts`,\n   *        method: 'POST',\n   *        body,\n   *      }),\n   *      // highlight-end\n   *      invalidatesTags: [{ type: 'Post', id: 'LIST' }],\n   *    }),\n   *   })\n   * })\n   * ```\n   */\n  query(arg: QueryArg): BaseQueryArg<BaseQuery>;\n  queryFn?: never;\n  /**\n   * A function to manipulate the data returned by a query or mutation.\n   */\n  transformResponse?(baseQueryReturnValue: RawResultType, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): ResultType | Promise<ResultType>;\n  /**\n   * A function to manipulate the data returned by a failed query or mutation.\n   */\n  transformErrorResponse?(baseQueryReturnValue: BaseQueryError<BaseQuery>, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): unknown;\n\n  /**\n   * A schema for the result *before* it's passed to `transformResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPostName: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawResponseSchema: postSchema,\n   *       transformResponse: (post) => post.name,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawResponseSchema?: StandardSchemaV1<RawResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn`, *before* it's passed to `transformErrorResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import {customBaseQuery, baseQueryErrorSchema} from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawErrorResponseSchema: baseQueryErrorSchema,\n   *       transformErrorResponse: (error) => error.data,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawErrorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n};\nexport type EndpointDefinitionWithQueryFn<QueryArg, BaseQuery extends BaseQueryFn, ResultType> = {\n  /**\n   * Can be used in place of `query` as an inline function that bypasses `baseQuery` completely for the endpoint.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Basic queryFn example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *     }),\n   *     flipCoin: build.query<'heads' | 'tails', void>({\n   *       // highlight-start\n   *       queryFn(arg, queryApi, extraOptions, baseQuery) {\n   *         const randomVal = Math.random()\n   *         if (randomVal < 0.45) {\n   *           return { data: 'heads' }\n   *         }\n   *         if (randomVal < 0.9) {\n   *           return { data: 'tails' }\n   *         }\n   *         return { error: { status: 500, statusText: 'Internal Server Error', data: \"Coin landed on its edge!\" } }\n   *       }\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  queryFn(arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions<BaseQuery>, baseQuery: (arg: Parameters<BaseQuery>[0]) => ReturnType<BaseQuery>): MaybePromise<QueryReturnValue<ResultType, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>>;\n  query?: never;\n  transformResponse?: never;\n  transformErrorResponse?: never;\n  rawResponseSchema?: never;\n  rawErrorResponseSchema?: never;\n};\ntype BaseEndpointTypes<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType> = {\n  QueryArg: QueryArg;\n  BaseQuery: BaseQuery;\n  ResultType: ResultType;\n  RawResultType: RawResultType;\n};\nexport type SchemaType = 'arg' | 'rawResponse' | 'response' | 'rawErrorResponse' | 'errorResponse' | 'meta';\ninterface CommonEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType> {\n  /**\n   * A schema for the arguments to be passed to the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       argSchema: v.object({ id: v.number() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  argSchema?: StandardSchemaV1<QueryArg>;\n\n  /**\n   * A schema for the result (including `transformResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: postSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  responseSchema?: StandardSchemaV1<ResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn` (including `transformErrorResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryErrorSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       errorResponseSchema: baseQueryErrorSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  errorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n\n  /**\n   * A schema for the `meta` property returned by the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryMetaSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       metaSchema: baseQueryMetaSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  metaSchema?: StandardSchemaV1<BaseQueryMeta<BaseQuery>>;\n\n  /**\n   * Defaults to `true`.\n   *\n   * Most apps should leave this setting on. The only time it can be a performance issue\n   * is if an API returns extremely large amounts of data (e.g. 10,000 rows per request) and\n   * you're unable to paginate it.\n   *\n   * For details of how this works, please see the below. When it is set to `false`,\n   * every request will cause subscribed components to rerender, even when the data has not changed.\n   *\n   * @see https://redux-toolkit.js.org/api/other-exports#copywithstructuralsharing\n   */\n  structuralSharing?: boolean;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       onSchemaFailure: (error, info) => {\n   *         console.error(error, info)\n   *       },\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       catchSchemaFailure: (error, info) => ({\n   *         status: \"CUSTOM_ERROR\",\n   *         error: error.schemaName + \" failed validation\",\n   *         data: error.issues,\n   *       }),\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for this endpoint.\n   * Overrides the global setting.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type BaseEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = (([CastAny<BaseQueryResult<BaseQuery>, {}>] extends [NEVER] ? never : EndpointDefinitionWithQuery<QueryArg, BaseQuery, ResultType, RawResultType>) | EndpointDefinitionWithQueryFn<QueryArg, BaseQuery, ResultType>) & CommonEndpointDefinition<QueryArg, BaseQuery, ResultType> & {\n  /* phantom type */\n  [rawResultType]?: RawResultType;\n  /* phantom type */\n  [resultType]?: ResultType;\n  /* phantom type */\n  [baseQuery]?: BaseQuery;\n} & HasRequiredProps<BaseQueryExtraOptions<BaseQuery>, {\n  extraOptions: BaseQueryExtraOptions<BaseQuery>;\n}, {\n  extraOptions?: BaseQueryExtraOptions<BaseQuery>;\n}>;\n\n// NOTE As with QueryStatus in `apiState.ts`, don't use this for real comparisons\n// at runtime, use the string constants defined below.\nexport enum DefinitionType {\n  query = 'query',\n  mutation = 'mutation',\n  infinitequery = 'infinitequery',\n}\nexport const ENDPOINT_QUERY = DefinitionType.query;\nexport const ENDPOINT_MUTATION = DefinitionType.mutation;\nexport const ENDPOINT_INFINITEQUERY = DefinitionType.infinitequery;\ntype TagDescriptionArray<TagTypes extends string> = ReadonlyArray<TagDescription<TagTypes> | undefined | null>;\nexport type GetResultDescriptionFn<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = (result: ResultType | undefined, error: ErrorType | undefined, arg: QueryArg, meta: MetaType) => TagDescriptionArray<TagTypes>;\nexport type FullTagDescription<TagType> = {\n  type: TagType;\n  id?: number | string;\n};\nexport type TagDescription<TagType> = TagType | FullTagDescription<TagType>;\n\n/**\n * @public\n */\nexport type ResultDescription<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = TagDescriptionArray<TagTypes> | GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>;\ntype QueryTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  QueryDefinition: QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface QueryExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.query;\n\n  /**\n   * Used by `query` endpoints. Determines which 'tag' is attached to the cached data returned by the query.\n   * Expects an array of tag type strings, an array of objects of tag types with ids, or a function that returns such an array.\n   * 1.  `['Post']` - equivalent to `2`\n   * 2.  `[{ type: 'Post' }]` - equivalent to `1`\n   * 3.  `[{ type: 'Post', id: 1 }]`\n   * 4.  `(result, error, arg) => ['Post']` - equivalent to `5`\n   * 5.  `(result, error, arg) => [{ type: 'Post' }]` - equivalent to `4`\n   * 6.  `(result, error, arg) => [{ type: 'Post', id: 1 }]`\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"providesTags example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       // highlight-start\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  providesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * Can be provided to merge an incoming response value into the current cache data.\n   * If supplied, no automatic structural sharing will be applied - it's up to\n   * you to update the cache appropriately.\n   *\n   * Since RTKQ normally replaces cache entries with the new response, you will usually\n   * need to use this with the `serializeQueryArgs` or `forceRefetch` options to keep\n   * an existing cache entry so that it can be updated.\n   *\n   * Since this is wrapped with Immer, you may either mutate the `currentCacheValue` directly,\n   * or return a new value, but _not_ both at once.\n   *\n   * Will only be called if the existing `currentCacheData` is _not_ `undefined` - on first response,\n   * the cache entry will just save the response data directly.\n   *\n   * Useful if you don't want a new request to completely override the current cache value,\n   * maybe because you have manually updated it from another source and don't want those\n   * updates to get lost.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"merge: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  merge?(currentCacheData: ResultType, responseData: ResultType, otherArgs: {\n    arg: QueryArg;\n    baseQueryMeta: BaseQueryMeta<BaseQuery>;\n    requestId: string;\n    fulfilledTimeStamp: number;\n  }): ResultType | void;\n\n  /**\n   * Check to see if the endpoint should force a refetch in cases where it normally wouldn't.\n   * This is primarily useful for \"infinite scroll\" / pagination use cases where\n   * RTKQ is keeping a single cache entry that is added to over time, in combination\n   * with `serializeQueryArgs` returning a fixed cache key and a `merge` callback\n   * set to add incoming data to the cache entry each time.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"forceRefresh: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  forceRefetch?(params: {\n    currentArg: QueryArg | undefined;\n    previousArg: QueryArg | undefined;\n    state: RootState<any, any, string>;\n    endpointState?: QuerySubState<any>;\n  }): boolean;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: QueryTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type QueryDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & QueryExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type InfiniteQueryTypes<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  InfiniteQueryDefinition: InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\nexport interface InfiniteQueryExtraOptions<TagTypes extends string, ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.infinitequery;\n  providesTags?: ResultDescription<TagTypes, InfiniteData<ResultType, PageParam>, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Required options to configure the infinite query behavior.\n   * `initialPageParam` and `getNextPageParam` are required, to\n   * ensure the infinite query can properly fetch the next page of data.\n   * `initialPageParam` may be specified when using the\n   * endpoint, to override the default value.\n   * `maxPages` and `getPreviousPageParam` are both optional.\n   * \n   * @example\n   * \n   * ```ts\n   * // codeblock-meta title=\"infiniteQueryOptions example\"\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * \n   * type Pokemon = {\n   *   id: string\n   *   name: string\n   * }\n   * \n   * const pokemonApi = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),\n   *   endpoints: (build) => ({\n   *     getInfinitePokemonWithMax: build.infiniteQuery<Pokemon[], string, number>({\n   *       infiniteQueryOptions: {\n   *         initialPageParam: 0,\n   *         maxPages: 3,\n   *         getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) =>\n   *           lastPageParam + 1,\n   *         getPreviousPageParam: (\n   *           firstPage,\n   *           allPages,\n   *           firstPageParam,\n   *           allPageParams,\n   *         ) => {\n   *           return firstPageParam > 0 ? firstPageParam - 1 : undefined\n   *         },\n   *       },\n   *       query({pageParam}) {\n   *         return `https://example.com/listItems?page=${pageParam}`\n   *       },\n   *     }),\n   *   }),\n   * })\n   \n   * ```\n   */\n  infiniteQueryOptions: InfiniteQueryConfigOptions<ResultType, PageParam, QueryArg>;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: InfiniteQueryTypes<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> =\n// Infinite query endpoints receive `{queryArg, pageParam}`\nBaseEndpointDefinition<InfiniteQueryCombinedArg<QueryArg, PageParam>, BaseQuery, ResultType, RawResultType> & InfiniteQueryExtraOptions<TagTypes, ResultType, QueryArg, PageParam, BaseQuery, ReducerPath, RawResultType>;\ntype MutationTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseMutation<typeof api.endpoints.query.Types.MutationDefinition> = ...\n   * ```\n   */\n  MutationDefinition: MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface MutationExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath> {\n  type: DefinitionType.mutation;\n\n  /**\n   * Used by `mutation` endpoints. Determines which cached data should be either re-fetched or removed from the cache.\n   * Expects the same shapes as `providesTags`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"invalidatesTags example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *       query(body) {\n   *         return {\n   *           url: `posts`,\n   *           method: 'POST',\n   *           body,\n   *         }\n   *       },\n   *       // highlight-start\n   *       invalidatesTags: [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  invalidatesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A mutation should not provide tags to the cache.\n   */\n  providesTags?: never;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: MutationTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type MutationDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & MutationExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type EndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, PageParam = any, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\nexport type EndpointDefinitions = Record<string, EndpointDefinition<any, any, any, any, any, any, any>>;\nexport function isQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is QueryDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_QUERY;\n}\nexport function isMutationDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is MutationDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_MUTATION;\n}\nexport function isInfiniteQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is InfiniteQueryDefinition<any, any, any, any, any, any, any> {\n  return e.type === ENDPOINT_INFINITEQUERY;\n}\nexport function isAnyQueryDefinition(e: EndpointDefinition<any, any, any, any>): e is QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any> {\n  return isQueryDefinition(e) || isInfiniteQueryDefinition(e);\n}\nexport type EndpointBuilder<BaseQuery extends BaseQueryFn, TagTypes extends string, ReducerPath extends string> = {\n  /**\n   * An endpoint definition that retrieves data, and may provide tags to the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all query endpoint options\"\n   * const api = createApi({\n   *  baseQuery,\n   *  endpoints: (build) => ({\n   *    getPost: build.query({\n   *      query: (id) => ({ url: `post/${id}` }),\n   *      // Pick out data and prevent nested properties in a hook or selector\n   *      transformResponse: (response) => response.data,\n   *      // Pick out error and prevent nested properties in a hook or selector\n   *      transformErrorResponse: (response) => response.error,\n   *      // `result` is the server response\n   *      providesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry, updateCachedData }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry, updateCachedData }) {},\n   *    }),\n   *  }),\n   *});\n   *```\n   */\n  query<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n\n  /**\n   * An endpoint definition that alters data on the server or will possibly invalidate the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all mutation endpoint options\"\n   * const api = createApi({\n   *   baseQuery,\n   *   endpoints: (build) => ({\n   *     updatePost: build.mutation({\n   *       query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),\n   *       // Pick out data and prevent nested properties in a hook or selector\n   *       transformResponse: (response) => response.data,\n   *       // Pick out error and prevent nested properties in a hook or selector\n   *       transformErrorResponse: (response) => response.error,\n   *       // `result` is the server response\n   *       invalidatesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry }) {},\n   *     }),\n   *   }),\n   * });\n   * ```\n   */\n  mutation<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n  infiniteQuery<ResultType, QueryArg, PageParam, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n};\nexport type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T;\nexport function calculateProvidedBy<ResultType, QueryArg, ErrorType, MetaType>(description: ResultDescription<string, ResultType, QueryArg, ErrorType, MetaType> | undefined, result: ResultType | undefined, error: ErrorType | undefined, queryArg: QueryArg, meta: MetaType | undefined, assertTagTypes: AssertTagTypes): readonly FullTagDescription<string>[] {\n  const finalDescription = isFunction(description) ? description(result as ResultType, error as undefined, queryArg, meta as MetaType) : description;\n  if (finalDescription) {\n    return filterMap(finalDescription, isNotNullish, tag => assertTagTypes(expandTagDescription(tag)));\n  }\n  return [];\n}\nfunction isFunction<T>(t: T): t is Extract<T, Function> {\n  return typeof t === 'function';\n}\nexport function expandTagDescription(description: TagDescription<string>): FullTagDescription<string> {\n  return typeof description === 'string' ? {\n    type: description\n  } : description;\n}\nexport type QueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<infer QA, any, any, any> ? QA : never;\n\n// Just extracting `QueryArg` from `BaseEndpointDefinition`\n// doesn't sufficiently match here.\n// We need to explicitly match against `InfiniteQueryDefinition`\nexport type InfiniteQueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<infer QA, any, any, any, any, any, any> ? QA : never;\nexport type QueryArgFromAnyQuery<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any, any, any> ? InfiniteQueryArgFrom<D> : D extends QueryDefinition<any, any, any, any, any, any> ? QueryArgFrom<D> : never;\nexport type ResultTypeFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<any, any, infer RT, any> ? RT : unknown;\nexport type ReducerPathFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, any, any, infer RP, any, any> ? RP : unknown;\nexport type TagTypesFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, infer TT, any, any, any, any> ? TT : unknown;\nexport type PageParamFrom<D extends InfiniteQueryDefinition<any, any, any, any, any, any, any>> = D extends InfiniteQueryDefinition<any, infer PP, any, any, any, any, any> ? PP : unknown;\nexport type InfiniteQueryCombinedArg<QueryArg, PageParam> = {\n  queryArg: QueryArg;\n  pageParam: PageParam;\n};\nexport type TagTypesFromApi<T> = T extends Api<any, any, any, infer TagTypes> ? TagTypes : never;\nexport type DefinitionsFromApi<T> = T extends Api<any, infer Definitions, any, any> ? Definitions : never;\nexport type TransformedResponse<NewDefinitions extends EndpointDefinitions, K, ResultType> = K extends keyof NewDefinitions ? NewDefinitions[K]['transformResponse'] extends undefined ? ResultType : UnwrapPromise<ReturnType<NonUndefined<NewDefinitions[K]['transformResponse']>>> : ResultType;\nexport type OverrideResultType<Definition, NewResultType> = Definition extends QueryDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends MutationDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, NewResultType, ReducerPath> : never;\nexport type UpdateDefinitions<Definitions extends EndpointDefinitions, NewTagTypes extends string, NewDefinitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends MutationDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : never };","export type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type Override<T1, T2> = T2 extends any ? Omit<T1, keyof T2> & T2 : never;\nexport function assertCast<T>(v: any): asserts v is T {}\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>): T {\n  return Object.assign(target, ...args);\n}\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\nexport type NonOptionalKeys<T> = { [K in keyof T]-?: undefined extends T[K] ? never : K }[keyof T];\nexport type HasRequiredProps<T, True, False> = NonOptionalKeys<T> extends never ? False : True;\nexport type OptionalIfAllPropsOptional<T> = HasRequiredProps<T, T, T | never>;\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type UnwrapPromise<T> = T extends PromiseLike<infer V> ? V : T;\nexport type MaybePromise<T> = T | PromiseLike<T>;\nexport type OmitFromUnion<T, K extends keyof T> = T extends any ? Omit<T, K> : never;\nexport type IsAny<T, True, False = never> = true | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;","import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3 } from \"@reduxjs/toolkit\";\nimport type { Selector, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { Api, ApiContext, ApiEndpointInfiniteQuery, ApiEndpointMutation, ApiEndpointQuery, BaseQueryFn, CoreModule, EndpointDefinitions, InfiniteQueryActionCreatorResult, InfiniteQueryArgFrom, InfiniteQueryDefinition, InfiniteQueryResultSelectorResult, InfiniteQuerySubState, MutationActionCreatorResult, MutationDefinition, MutationResultSelectorResult, PageParamFrom, PrefetchOptions, QueryActionCreatorResult, QueryArgFrom, QueryCacheKey, QueryDefinition, QueryKeys, QueryResultSelectorResult, QuerySubState, ResultTypeFrom, RootState, SerializeQueryArgs, SkipToken, SubscriptionOptions, TSHelpersId, TSHelpersNoInfer, TSHelpersOverride } from '@reduxjs/toolkit/query';\nimport { QueryStatus, skipToken } from './rtkqImports';\nimport type { DependencyList } from 'react';\nimport { useCallback, useDebugValue, useEffect, useLayoutEffect, useMemo, useRef, useState } from './reactImports';\nimport { shallowEqual } from './reactReduxImports';\nimport type { SubscriptionSelectors } from '../core/buildMiddleware/index';\nimport type { InfiniteData, InfiniteQueryConfigOptions } from '../core/index';\nimport type { UninitializedValue } from './constants';\nimport { UNINITIALIZED_VALUE } from './constants';\nimport type { ReactHooksModuleOptions } from './module';\nimport { useStableQueryArgs } from './useSerializedStableValue';\nimport { useShallowStableValue } from './useShallowStableValue';\nimport type { InfiniteQueryDirection } from '../core/apiState';\nimport { isInfiniteQueryDefinition } from '../endpointDefinitions';\nimport type { StartInfiniteQueryActionCreator } from '../core/buildInitiate';\n\n// Copy-pasted from React-Redux\nconst canUseDOM = () => !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\nconst isDOM = /* @__PURE__ */canUseDOM();\n\n// Under React Native, we know that we always want to use useLayoutEffect\n\nconst isRunningInReactNative = () => typeof navigator !== 'undefined' && navigator.product === 'ReactNative';\nconst isReactNative = /* @__PURE__ */isRunningInReactNative();\nconst getUseIsomorphicLayoutEffect = () => isDOM || isReactNative ? useLayoutEffect : useEffect;\nexport const useIsomorphicLayoutEffect = /* @__PURE__ */getUseIsomorphicLayoutEffect();\nexport type QueryHooks<Definition extends QueryDefinition<any, any, any, any, any>> = {\n  useQuery: UseQuery<Definition>;\n  useLazyQuery: UseLazyQuery<Definition>;\n  useQuerySubscription: UseQuerySubscription<Definition>;\n  useLazyQuerySubscription: UseLazyQuerySubscription<Definition>;\n  useQueryState: UseQueryState<Definition>;\n};\nexport type InfiniteQueryHooks<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  useInfiniteQuery: UseInfiniteQuery<Definition>;\n  useInfiniteQuerySubscription: UseInfiniteQuerySubscription<Definition>;\n  useInfiniteQueryState: UseInfiniteQueryState<Definition>;\n};\nexport type MutationHooks<Definition extends MutationDefinition<any, any, any, any, any>> = {\n  useMutation: UseMutation<Definition>;\n};\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.\n *\n * This hook combines the functionality of both [`useQueryState`](#usequerystate) and [`useQuerySubscription`](#usequerysubscription) together, and is intended to be used in the majority of situations.\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseQuery<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(arg: QueryArgFrom<D> | SkipToken, options?: UseQuerySubscriptionOptions & UseQueryStateOptions<D, R>) => UseQueryHookResult<D, R>;\nexport type TypedUseQuery<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuery<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseQueryHookResult<D extends QueryDefinition<any, any, any, any>, R = UseQueryStateDefaultResult<D>> = UseQueryStateResult<D, R> & UseQuerySubscriptionResult<D>;\n\n/**\n * Helper type to manually type the result\n * of the `useQuery` hook in userland code.\n */\nexport type TypedUseQueryHookResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = TypedUseQueryStateResult<ResultType, QueryArg, BaseQuery, R> & TypedUseQuerySubscriptionResult<ResultType, QueryArg, BaseQuery>;\nexport type UseQuerySubscriptionOptions = SubscriptionOptions & {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When `skip` is true (or `skipToken` is passed in as `arg`):\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```tsx\n   * // codeblock-meta no-transpile title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n};\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useQuery`](#usequery) or [`useQueryState`](#usequerystate).\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n */\nexport type UseQuerySubscription<D extends QueryDefinition<any, any, any, any>> = (arg: QueryArgFrom<D> | SkipToken, options?: UseQuerySubscriptionOptions) => UseQuerySubscriptionResult<D>;\nexport type TypedUseQuerySubscription<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuerySubscription<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseQuerySubscriptionResult<D extends QueryDefinition<any, any, any, any>> = Pick<QueryActionCreatorResult<D>, 'refetch'>;\n\n/**\n * Helper type to manually type the result\n * of the `useQuerySubscription` hook in userland code.\n */\nexport type TypedUseQuerySubscriptionResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQuerySubscriptionResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseLazyQueryLastPromiseInfo<D extends QueryDefinition<any, any, any, any>> = {\n  lastArg: QueryArgFrom<D>;\n};\n\n/**\n * A React hook similar to [`useQuery`](#usequery), but with manual control over when the data fetching occurs.\n *\n * This hook includes the functionality of [`useLazyQuerySubscription`](#uselazyquerysubscription).\n *\n * #### Features\n *\n * - Manual control over firing a request to retrieve data\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once\n *\n * #### Note\n *\n * When the trigger function returned from a LazyQuery is called, it always initiates a new request to the server even if there is cached data. Set `preferCacheValue`(the second argument to the function) as `true` if you want it to immediately return a cached value if one exists.\n */\nexport type UseLazyQuery<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(options?: SubscriptionOptions & Omit<UseQueryStateOptions<D, R>, 'skip'>) => [LazyQueryTrigger<D>, UseLazyQueryStateResult<D, R>, UseLazyQueryLastPromiseInfo<D>];\nexport type TypedUseLazyQuery<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseLazyQuery<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type UseLazyQueryStateResult<D extends QueryDefinition<any, any, any, any>, R = UseQueryStateDefaultResult<D>> = UseQueryStateResult<D, R> & {\n  /**\n   * Resets the hook state to its initial `uninitialized` state.\n   * This will also remove the last result from the cache.\n   */\n  reset: () => void;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useLazyQuery` hook in userland code.\n */\nexport type TypedUseLazyQueryStateResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseLazyQueryStateResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>, R>;\nexport type LazyQueryTrigger<D extends QueryDefinition<any, any, any, any>> = {\n  /**\n   * Triggers a lazy query.\n   *\n   * By default, this will start a new request even if there is already a value in the cache.\n   * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a lazy query, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await getUserById(1).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>, preferCacheValue?: boolean): QueryActionCreatorResult<D>;\n};\nexport type TypedLazyQueryTrigger<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = LazyQueryTrigger<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook similar to [`useQuerySubscription`](#usequerysubscription), but with manual control over when the data fetching occurs.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useLazyQuery`](#uselazyquery).\n *\n * #### Features\n *\n * - Manual control over firing a request to retrieve data\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met and the fetch has been manually called at least once\n */\nexport type UseLazyQuerySubscription<D extends QueryDefinition<any, any, any, any>> = (options?: SubscriptionOptions) => readonly [LazyQueryTrigger<D>, QueryArgFrom<D> | UninitializedValue, {\n  reset: () => void;\n}];\nexport type TypedUseLazyQuerySubscription<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseLazyQuerySubscription<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * @internal\n */\nexport type QueryStateSelector<R extends Record<string, any>, D extends QueryDefinition<any, any, any, any>> = (state: UseQueryStateDefaultResult<D>) => R;\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryStateSelector} for use with a specific query.\n * This is useful for scenarios where you want to create a \"pre-typed\"\n * {@linkcode UseQueryStateOptions.selectFromResult | selectFromResult}\n * function.\n *\n * @example\n * <caption>#### __Create a strongly-typed `selectFromResult` selector function__</caption>\n *\n * ```tsx\n * import type { TypedQueryStateSelector } from '@reduxjs/toolkit/query/react'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n *\n * type Post = {\n *   id: number\n *   title: string\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = number | undefined\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * type SelectedResult = Pick<PostsApiResponse, 'posts'>\n *\n * const postsApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com/posts' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, QueryArgument>({\n *       query: (limit = 5) => `?limit=${limit}&select=title`,\n *     }),\n *   }),\n * })\n *\n * const { useGetPostsQuery } = postsApiSlice\n *\n * function PostById({ id }: { id: number }) {\n *   const { post } = useGetPostsQuery(undefined, {\n *     selectFromResult: (state) => ({\n *       post: state.data?.posts.find((post) => post.id === id),\n *     }),\n *   })\n *\n *   return <li>{post?.title}</li>\n * }\n *\n * const EMPTY_ARRAY: Post[] = []\n *\n * const typedSelectFromResult: TypedQueryStateSelector<\n *   PostsApiResponse,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   SelectedResult\n * > = (state) => ({ posts: state.data?.posts ?? EMPTY_ARRAY })\n *\n * function PostsList() {\n *   const { posts } = useGetPostsQuery(undefined, {\n *     selectFromResult: typedSelectFromResult,\n *   })\n *\n *   return (\n *     <div>\n *       <ul>\n *         {posts.map((post) => (\n *           <PostById key={post.id} id={post.id} />\n *         ))}\n *       </ul>\n *     </div>\n *   )\n * }\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template SelectedResultType - The type of the selected result returned by the __`selectFromResult`__ function.\n *\n * @since 2.3.0\n * @public\n */\nexport type TypedQueryStateSelector<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, SelectedResultType extends Record<string, any> = UseQueryStateDefaultResult<QueryDefinition<QueryArgumentType, BaseQueryFunctionType, string, ResultType, string>>> = QueryStateSelector<SelectedResultType, QueryDefinition<QueryArgumentType, BaseQueryFunctionType, string, ResultType, string>>;\n\n/**\n * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * Note that this hook does not trigger fetching new data. For that use-case, see [`useQuery`](#usequery) or [`useQuerySubscription`](#usequerysubscription).\n *\n * #### Features\n *\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseQueryState<D extends QueryDefinition<any, any, any, any>> = <R extends Record<string, any> = UseQueryStateDefaultResult<D>>(arg: QueryArgFrom<D> | SkipToken, options?: UseQueryStateOptions<D, R>) => UseQueryStateResult<D, R>;\nexport type TypedUseQueryState<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseQueryState<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * @internal\n */\nexport type UseQueryStateOptions<D extends QueryDefinition<any, any, any, any>, R extends Record<string, any>> = {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When skip is true:\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after skipping the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.\n   * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.\n   * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using selectFromResult to extract a single result\"\n   * function PostsList() {\n   *   const { data: posts } = api.useGetPostsQuery();\n   *\n   *   return (\n   *     <ul>\n   *       {posts?.data?.map((post) => (\n   *         <PostById key={post.id} id={post.id} />\n   *       ))}\n   *     </ul>\n   *   );\n   * }\n   *\n   * function PostById({ id }: { id: number }) {\n   *   // Will select the post with the given id, and will only rerender if the given posts data changes\n   *   const { post } = api.useGetPostsQuery(undefined, {\n   *     selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),\n   *   });\n   *\n   *   return <li>{post?.name}</li>;\n   * }\n   * ```\n   */\n  selectFromResult?: QueryStateSelector<R, D>;\n};\n\n/**\n * Provides a way to define a \"pre-typed\" version of\n * {@linkcode UseQueryStateOptions} with specific options for a given query.\n * This is particularly useful for setting default query behaviors such as\n * refetching strategies, which can be overridden as needed.\n *\n * @example\n * <caption>#### __Create a `useQuery` hook with default options__</caption>\n *\n * ```ts\n * import type {\n *   SubscriptionOptions,\n *   TypedUseQueryStateOptions,\n * } from '@reduxjs/toolkit/query/react'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n *\n * type Post = {\n *   id: number\n *   name: string\n * }\n *\n * const api = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n *   tagTypes: ['Post'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<Post[], void>({\n *       query: () => 'posts',\n *     }),\n *   }),\n * })\n *\n * const { useGetPostsQuery } = api\n *\n * export const useGetPostsQueryWithDefaults = <\n *   SelectedResult extends Record<string, any>,\n * >(\n *   overrideOptions: TypedUseQueryStateOptions<\n *     Post[],\n *     void,\n *     ReturnType<typeof fetchBaseQuery>,\n *     SelectedResult\n *   > &\n *     SubscriptionOptions,\n * ) =>\n *   useGetPostsQuery(undefined, {\n *     // Insert default options here\n *\n *     refetchOnMountOrArgChange: true,\n *     refetchOnFocus: true,\n *     ...overrideOptions,\n *   })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArg - The type of the argument passed into the query.\n * @template BaseQuery - The type of the base query function being used.\n * @template SelectedResult - The type of the selected result returned by the __`selectFromResult`__ function.\n *\n * @since 2.2.8\n * @public\n */\nexport type TypedUseQueryStateOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseQueryStateOptions<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>, SelectedResult>;\nexport type UseQueryStateResult<_ extends QueryDefinition<any, any, any, any>, R> = TSHelpersNoInfer<R>;\n\n/**\n * Helper type to manually type the result\n * of the `useQueryState` hook in userland code.\n */\nexport type TypedUseQueryStateResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = UseQueryStateDefaultResult<QueryDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = TSHelpersNoInfer<R>;\ntype UseQueryStateBaseResult<D extends QueryDefinition<any, any, any, any>> = QuerySubState<D> & {\n  /**\n   * Where `data` tries to hold data as much as possible, also re-using\n   * data from the last arguments passed into the hook, this property\n   * will always contain the received data from the query, for the current query arguments.\n   */\n  currentData?: ResultTypeFrom<D>;\n  /**\n   * Query has not started yet.\n   */\n  isUninitialized: false;\n  /**\n   * Query is currently loading for the first time. No data yet.\n   */\n  isLoading: false;\n  /**\n   * Query is currently fetching, but might have data from an earlier request.\n   */\n  isFetching: false;\n  /**\n   * Query has data from a successful load.\n   */\n  isSuccess: false;\n  /**\n   * Query is currently in \"error\" state.\n   */\n  isError: false;\n};\ntype UseQueryStateUninitialized<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<Extract<UseQueryStateBaseResult<D>, {\n  status: QueryStatus.uninitialized;\n}>, {\n  isUninitialized: true;\n}>;\ntype UseQueryStateLoading<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isLoading: true;\n  isFetching: boolean;\n  data: undefined;\n}>;\ntype UseQueryStateSuccessFetching<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isSuccess: true;\n  isFetching: true;\n  error: undefined;\n} & {\n  data: ResultTypeFrom<D>;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'fulfilledTimeStamp'>>>;\ntype UseQueryStateSuccessNotFetching<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isSuccess: true;\n  isFetching: false;\n  error: undefined;\n} & {\n  data: ResultTypeFrom<D>;\n  currentData: ResultTypeFrom<D>;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'fulfilledTimeStamp'>>>;\ntype UseQueryStateError<D extends QueryDefinition<any, any, any, any>> = TSHelpersOverride<UseQueryStateBaseResult<D>, {\n  isError: true;\n} & Required<Pick<UseQueryStateBaseResult<D>, 'error'>>>;\ntype UseQueryStateDefaultResult<D extends QueryDefinition<any, any, any, any>> = TSHelpersId<UseQueryStateUninitialized<D> | UseQueryStateLoading<D> | UseQueryStateSuccessFetching<D> | UseQueryStateSuccessNotFetching<D> | UseQueryStateError<D>> & {\n  /**\n   * @deprecated Included for completeness, but discouraged.\n   * Please use the `isLoading`, `isFetching`, `isSuccess`, `isError`\n   * and `isUninitialized` flags instead\n   */\n  status: QueryStatus;\n};\nexport type LazyInfiniteQueryTrigger<D extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  /**\n   * Triggers a lazy query.\n   *\n   * By default, this will start a new request even if there is already a value in the cache.\n   * If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a lazy query, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await getUserById(1).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>, direction: InfiniteQueryDirection): InfiniteQueryActionCreatorResult<D>;\n};\nexport type TypedLazyInfiniteQueryTrigger<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = LazyInfiniteQueryTrigger<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type UseInfiniteQuerySubscriptionOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>> = SubscriptionOptions & {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When `skip` is true (or `skipToken` is passed in as `arg`):\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```tsx\n   * // codeblock-meta no-transpile title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available, RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n  initialPageParam?: PageParamFrom<D>;\n  /**\n   * Defaults to `true`. When this is `true` and an infinite query endpoint is refetched\n   * (due to tag invalidation, polling, arg change configuration, or manual refetching),\n   * RTK Query will try to sequentially refetch all pages currently in the cache.\n   * When `false` only the first page will be refetched.\n   *\n   * This option applies to all automatic refetches for this subscription (polling, tag invalidation, etc.).\n   * It can be overridden on a per-call basis using the `refetch()` method.\n   */\n  refetchCachedPages?: boolean;\n};\nexport type TypedUseInfiniteQuerySubscription<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuerySubscription<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type UseInfiniteQuerySubscriptionResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  refetch: (options?: Pick<UseInfiniteQuerySubscriptionOptions<D>, 'refetchCachedPages'>) => InfiniteQueryActionCreatorResult<D>;\n  trigger: LazyInfiniteQueryTrigger<D>;\n  fetchNextPage: () => InfiniteQueryActionCreatorResult<D>;\n  fetchPreviousPage: () => InfiniteQueryActionCreatorResult<D>;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useQuerySubscription` hook in userland code.\n */\nexport type TypedUseInfiniteQuerySubscriptionResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuerySubscriptionResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\nexport type InfiniteQueryStateSelector<R extends Record<string, any>, D extends InfiniteQueryDefinition<any, any, any, any, any>> = (state: UseInfiniteQueryStateDefaultResult<D>) => R;\nexport type TypedInfiniteQueryStateSelector<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = InfiniteQueryStateSelector<SelectedResult, InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.  Additionally, it will cache multiple \"pages\" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already, and the hook will return the data for that query arg once it's available.\n *\n *  The `data` field will be a `{pages: Data[], pageParams: PageParam[]}` structure containing all fetched page responses and the corresponding page param values for each page. You may use this to render individual pages, combine all pages into a single infinite list, or other display logic as needed.\n *\n * This hook combines the functionality of both [`useInfiniteQueryState`](#useinfinitequerystate) and [`useInfiniteQuerySubscription`](#useinfinitequerysubscription) together, and is intended to be used in the majority of situations.\n *\n * As with normal query hooks, `skipToken` is a valid argument that will skip the query from executing.\n *\n * By default, the initial request will use the `initialPageParam` value that was defined on the infinite query endpoint. If you want to start from a different value, you can pass `initialPageParam` as part of the hook options to override that initial request value.\n *\n * Use the returned `fetchNextPage` and `fetchPreviousPage` methods on the hook result object to trigger fetches forwards and backwards. These will always calculate the next or previous page param based on the current cached pages and the provided `getNext/PreviousPageParam` callbacks defined in the endpoint.\n *\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseInfiniteQuery<D extends InfiniteQueryDefinition<any, any, any, any, any>> = <R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<D>>(arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQuerySubscriptionOptions<D> & UseInfiniteQueryStateOptions<D, R>) => UseInfiniteQueryHookResult<D, R> & Pick<UseInfiniteQuerySubscriptionResult<D>, 'fetchNextPage' | 'fetchPreviousPage'>;\nexport type TypedUseInfiniteQuery<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQuery<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.\n *\n * Note that this hook does not trigger fetching new data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQuerySubscription`](#useinfinitequerysubscription).\n *\n * #### Features\n *\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseInfiniteQueryState<D extends InfiniteQueryDefinition<any, any, any, any, any>> = <R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<D>>(arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQueryStateOptions<D, R>) => UseInfiniteQueryStateResult<D, R>;\nexport type TypedUseInfiniteQueryState<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn> = UseInfiniteQueryState<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>;\n\n/**\n * A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data. Additionally, it will cache multiple \"pages\" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.\n *\n * The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.\n *\n * Note that this hook does not return a request status or cached data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQueryState`](#useinfinitequerystate).\n *\n * #### Features\n *\n * - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards\n * - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met\n */\nexport type UseInfiniteQuerySubscription<D extends InfiniteQueryDefinition<any, any, any, any, any>> = (arg: InfiniteQueryArgFrom<D> | SkipToken, options?: UseInfiniteQuerySubscriptionOptions<D>) => UseInfiniteQuerySubscriptionResult<D>;\nexport type UseInfiniteQueryHookResult<D extends InfiniteQueryDefinition<any, any, any, any, any>, R = UseInfiniteQueryStateDefaultResult<D>> = UseInfiniteQueryStateResult<D, R> & Pick<UseInfiniteQuerySubscriptionResult<D>, 'refetch' | 'fetchNextPage' | 'fetchPreviousPage'>;\nexport type TypedUseInfiniteQueryHookResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, R extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryHookResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, R>;\nexport type UseInfiniteQueryStateOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>, R extends Record<string, any>> = {\n  /**\n   * Prevents a query from automatically running.\n   *\n   * @remarks\n   * When skip is true:\n   *\n   * - **If the query has cached data:**\n   *   * The cached data **will not be used** on the initial load, and will ignore updates from any identical query until the `skip` condition is removed\n   *   * The query will have a status of `uninitialized`\n   *   * If `skip: false` is set after skipping the initial load, the cached result will be used\n   * - **If the query does not have cached data:**\n   *   * The query will have a status of `uninitialized`\n   *   * The query will not exist in the state when viewed with the dev tools\n   *   * The query will not automatically fetch on mount\n   *   * The query will not automatically run when additional components with the same query are added that do run\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Skip example\"\n   * const Pokemon = ({ name, skip }: { name: string; skip: boolean }) => {\n   *   const { data, error, status } = useGetPokemonByNameQuery(name, {\n   *     skip,\n   *   });\n   *\n   *   return (\n   *     <div>\n   *       {name} - {status}\n   *     </div>\n   *   );\n   * };\n   * ```\n   */\n  skip?: boolean;\n  /**\n   * `selectFromResult` allows you to get a specific segment from a query result in a performant manner.\n   * When using this feature, the component will not rerender unless the underlying data of the selected item has changed.\n   * If the selected item is one element in a larger collection, it will disregard changes to elements in the same collection.\n   * Note that this should always return an object (not a primitive), as RTKQ adds fields to the return value.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using selectFromResult to extract a single result\"\n   * function PostsList() {\n   *   const { data: posts } = api.useGetPostsQuery();\n   *\n   *   return (\n   *     <ul>\n   *       {posts?.data?.map((post) => (\n   *         <PostById key={post.id} id={post.id} />\n   *       ))}\n   *     </ul>\n   *   );\n   * }\n   *\n   * function PostById({ id }: { id: number }) {\n   *   // Will select the post with the given id, and will only rerender if the given posts data changes\n   *   const { post } = api.useGetPostsQuery(undefined, {\n   *     selectFromResult: ({ data }) => ({ post: data?.find((post) => post.id === id) }),\n   *   });\n   *\n   *   return <li>{post?.name}</li>;\n   * }\n   * ```\n   */\n  selectFromResult?: InfiniteQueryStateSelector<R, D>;\n};\nexport type TypedUseInfiniteQueryStateOptions<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, SelectedResult extends Record<string, any> = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryStateOptions<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, SelectedResult>;\nexport type UseInfiniteQueryStateResult<D extends InfiniteQueryDefinition<any, any, any, any, any>, R = UseInfiniteQueryStateDefaultResult<D>> = TSHelpersNoInfer<R>;\nexport type TypedUseInfiniteQueryStateResult<ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, R = UseInfiniteQueryStateDefaultResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>>> = UseInfiniteQueryStateResult<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, string, ResultType, string>, R>;\ntype UseInfiniteQueryStateBaseResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = InfiniteQuerySubState<D> & {\n  /**\n   * Where `data` tries to hold data as much as possible, also re-using\n   * data from the last arguments passed into the hook, this property\n   * will always contain the received data from the query, for the current query arguments.\n   */\n  currentData?: InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>;\n  /**\n   * Query has not started yet.\n   */\n  isUninitialized: false;\n  /**\n   * Query is currently loading for the first time. No data yet.\n   */\n  isLoading: false;\n  /**\n   * Query is currently fetching, but might have data from an earlier request.\n   */\n  isFetching: false;\n  /**\n   * Query has data from a successful load.\n   */\n  isSuccess: false;\n  /**\n   * Query is currently in \"error\" state.\n   */\n  isError: false;\n  hasNextPage: boolean;\n  hasPreviousPage: boolean;\n  isFetchingNextPage: boolean;\n  isFetchingPreviousPage: boolean;\n};\ntype UseInfiniteQueryStateDefaultResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = TSHelpersId<TSHelpersOverride<Extract<UseInfiniteQueryStateBaseResult<D>, {\n  status: QueryStatus.uninitialized;\n}>, {\n  isUninitialized: true;\n}> | TSHelpersOverride<UseInfiniteQueryStateBaseResult<D>, {\n  isLoading: true;\n  isFetching: boolean;\n  data: undefined;\n} | ({\n  isSuccess: true;\n  isFetching: true;\n  error: undefined;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp'>>) | ({\n  isSuccess: true;\n  isFetching: false;\n  error: undefined;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'data' | 'fulfilledTimeStamp' | 'currentData'>>) | ({\n  isError: true;\n} & Required<Pick<UseInfiniteQueryStateBaseResult<D>, 'error'>>)>> & {\n  /**\n   * @deprecated Included for completeness, but discouraged.\n   * Please use the `isLoading`, `isFetching`, `isSuccess`, `isError`\n   * and `isUninitialized` flags instead\n   */\n  status: QueryStatus;\n};\nexport type MutationStateSelector<R extends Record<string, any>, D extends MutationDefinition<any, any, any, any>> = (state: MutationResultSelectorResult<D>) => R;\nexport type UseMutationStateOptions<D extends MutationDefinition<any, any, any, any>, R extends Record<string, any>> = {\n  selectFromResult?: MutationStateSelector<R, D>;\n  fixedCacheKey?: string;\n};\nexport type UseMutationStateResult<D extends MutationDefinition<any, any, any, any>, R> = TSHelpersNoInfer<R> & {\n  originalArgs?: QueryArgFrom<D>;\n  /**\n   * Resets the hook state to its initial `uninitialized` state.\n   * This will also remove the last result from the cache.\n   */\n  reset: () => void;\n};\n\n/**\n * Helper type to manually type the result\n * of the `useMutation` hook in userland code.\n */\nexport type TypedUseMutationResult<ResultType, QueryArg, BaseQuery extends BaseQueryFn, R = MutationResultSelectorResult<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>> = UseMutationStateResult<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>, R>;\n\n/**\n * A React hook that lets you trigger an update request for a given endpoint, and subscribes the component to read the request status from the Redux store. The component will re-render as the loading status changes.\n *\n * #### Features\n *\n * - Manual control over firing a request to alter data on the server or possibly invalidate the cache\n * - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts\n * - Returns the latest request status and cached data from the Redux store\n * - Re-renders as the request status changes and data becomes available\n */\nexport type UseMutation<D extends MutationDefinition<any, any, any, any>> = <R extends Record<string, any> = MutationResultSelectorResult<D>>(options?: UseMutationStateOptions<D, R>) => readonly [MutationTrigger<D>, UseMutationStateResult<D, R>];\nexport type TypedUseMutation<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = UseMutation<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\nexport type MutationTrigger<D extends MutationDefinition<any, any, any, any>> = {\n  /**\n   * Triggers the mutation and returns a Promise.\n   * @remarks\n   * If you need to access the error or success payload immediately after a mutation, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await addPost({ id: 1, name: 'Example' }).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  (arg: QueryArgFrom<D>): MutationActionCreatorResult<D>;\n};\nexport type TypedMutationTrigger<ResultType, QueryArg, BaseQuery extends BaseQueryFn> = MutationTrigger<MutationDefinition<QueryArg, BaseQuery, string, ResultType, string>>;\n\n/**\n * Wrapper around `defaultQueryStateSelector` to be used in `useQuery`.\n * We want the initial render to already come back with\n * `{ isUninitialized: false, isFetching: true, isLoading: true }`\n * to prevent that the library user has to do an additional check for `isUninitialized`/\n */\nconst noPendingQueryStateSelector: QueryStateSelector<any, any> = selected => {\n  if (selected.isUninitialized) {\n    return {\n      ...selected,\n      isUninitialized: false,\n      isFetching: true,\n      isLoading: selected.data !== undefined ? false : true,\n      // This is the one place where we still have to use `QueryStatus` as an enum,\n      // since it's the only reference in the React package and not in the core.\n      status: QueryStatus.pending\n    } as any;\n  }\n  return selected;\n};\nfunction pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K> {\n  const ret: any = {};\n  keys.forEach(key => {\n    ret[key] = obj[key];\n  });\n  return ret;\n}\nconst COMMON_HOOK_DEBUG_FIELDS = ['data', 'status', 'isLoading', 'isSuccess', 'isError', 'error'] as const;\ntype GenericPrefetchThunk = (endpointName: any, arg: any, options: PrefetchOptions) => ThunkAction<void, any, any, UnknownAction>;\n\n/**\n *\n * @param opts.api - An API with defined endpoints to create hooks for\n * @param opts.moduleOptions.batch - The version of the `batchedUpdates` function to be used\n * @param opts.moduleOptions.useDispatch - The version of the `useDispatch` hook to be used\n * @param opts.moduleOptions.useSelector - The version of the `useSelector` hook to be used\n * @returns An object containing functions to generate hooks based on an endpoint\n */\nexport function buildHooks<Definitions extends EndpointDefinitions>({\n  api,\n  moduleOptions: {\n    batch,\n    hooks: {\n      useDispatch,\n      useSelector,\n      useStore\n    },\n    unstable__sideEffectsInRender,\n    createSelector\n  },\n  serializeQueryArgs,\n  context\n}: {\n  api: Api<any, Definitions, any, any, CoreModule>;\n  moduleOptions: Required<ReactHooksModuleOptions>;\n  serializeQueryArgs: SerializeQueryArgs<any>;\n  context: ApiContext<Definitions>;\n}) {\n  const usePossiblyImmediateEffect: (effect: () => void | undefined, deps?: DependencyList) => void = unstable__sideEffectsInRender ? cb => cb() : useEffect;\n  type UnsubscribePromiseRef = React.RefObject<{\n    unsubscribe?: () => void;\n  } | undefined>;\n  const unsubscribePromiseRef = (ref: UnsubscribePromiseRef) => ref.current?.unsubscribe?.();\n  const endpointDefinitions = context.endpointDefinitions;\n  return {\n    buildQueryHooks,\n    buildInfiniteQueryHooks,\n    buildMutationHook,\n    usePrefetch\n  };\n  function queryStatePreSelector(currentState: QueryResultSelectorResult<any>, lastResult: UseQueryStateDefaultResult<any> | undefined, queryArgs: any): UseQueryStateDefaultResult<any> {\n    // if we had a last result and the current result is uninitialized,\n    // we might have called `api.util.resetApiState`\n    // in this case, reset the hook\n    if (lastResult?.endpointName && currentState.isUninitialized) {\n      const {\n        endpointName\n      } = lastResult;\n      const endpointDefinition = endpointDefinitions[endpointName];\n      if (queryArgs !== skipToken && serializeQueryArgs({\n        queryArgs: lastResult.originalArgs,\n        endpointDefinition,\n        endpointName\n      }) === serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      })) lastResult = undefined;\n    }\n\n    // data is the last known good request result we have tracked - or if none has been tracked yet the last good result for the current args\n    let data = currentState.isSuccess ? currentState.data : lastResult?.data;\n    if (data === undefined) data = currentState.data;\n    const hasData = data !== undefined;\n\n    // isFetching = true any time a request is in flight\n    const isFetching = currentState.isLoading;\n\n    // isLoading = true only when loading while no data is present yet (initial load with no data in the cache)\n    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;\n\n    // isSuccess = true when data is present and we're not refetching after an error.\n    // That includes cases where the _current_ item is either actively\n    // fetching or about to fetch due to an uninitialized entry.\n    const isSuccess = currentState.isSuccess || hasData && (isFetching && !lastResult?.isError || currentState.isUninitialized);\n    return {\n      ...currentState,\n      data,\n      currentData: currentState.data,\n      isFetching,\n      isLoading,\n      isSuccess\n    } as UseQueryStateDefaultResult<any>;\n  }\n  function infiniteQueryStatePreSelector(currentState: InfiniteQueryResultSelectorResult<any>, lastResult: UseInfiniteQueryStateDefaultResult<any> | undefined, queryArgs: any): UseInfiniteQueryStateDefaultResult<any> {\n    // if we had a last result and the current result is uninitialized,\n    // we might have called `api.util.resetApiState`\n    // in this case, reset the hook\n    if (lastResult?.endpointName && currentState.isUninitialized) {\n      const {\n        endpointName\n      } = lastResult;\n      const endpointDefinition = endpointDefinitions[endpointName];\n      if (queryArgs !== skipToken && serializeQueryArgs({\n        queryArgs: lastResult.originalArgs,\n        endpointDefinition,\n        endpointName\n      }) === serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      })) lastResult = undefined;\n    }\n\n    // data is the last known good request result we have tracked - or if none has been tracked yet the last good result for the current args\n    let data = currentState.isSuccess ? currentState.data : lastResult?.data;\n    if (data === undefined) data = currentState.data;\n    const hasData = data !== undefined;\n\n    // isFetching = true any time a request is in flight\n    const isFetching = currentState.isLoading;\n    // isLoading = true only when loading while no data is present yet (initial load with no data in the cache)\n    const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;\n    // isSuccess = true when data is present\n    const isSuccess = currentState.isSuccess || isFetching && hasData;\n    return {\n      ...currentState,\n      data,\n      currentData: currentState.data,\n      isFetching,\n      isLoading,\n      isSuccess\n    } as UseInfiniteQueryStateDefaultResult<any>;\n  }\n  function usePrefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, defaultOptions?: PrefetchOptions) {\n    const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n    const stableDefaultOptions = useShallowStableValue(defaultOptions);\n    return useCallback((arg: any, options?: PrefetchOptions) => dispatch((api.util.prefetch as GenericPrefetchThunk)(endpointName, arg, {\n      ...stableDefaultOptions,\n      ...options\n    })), [endpointName, dispatch, stableDefaultOptions]);\n  }\n  function useQuerySubscriptionCommonImpl<T extends QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>(endpointName: string, arg: unknown | SkipToken, {\n    refetchOnReconnect,\n    refetchOnFocus,\n    refetchOnMountOrArgChange,\n    skip = false,\n    pollingInterval = 0,\n    skipPollingIfUnfocused = false,\n    ...rest\n  }: UseQuerySubscriptionOptions = {}) {\n    const {\n      initiate\n    } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n    const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n\n    // TODO: Change this to `useRef<SubscriptionSelectors>(undefined)` after upgrading to React 19.\n    const subscriptionSelectorsRef = useRef<SubscriptionSelectors | undefined>(undefined);\n    if (!subscriptionSelectorsRef.current) {\n      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());\n      if (process.env.NODE_ENV !== 'production') {\n        if (typeof returnedValue !== 'object' || typeof returnedValue?.type === 'string') {\n          throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(37) : `Warning: Middleware for RTK-Query API at reducerPath \"${api.reducerPath}\" has not been added to the store.\n    You must add the middleware for RTK-Query to function correctly!`);\n        }\n      }\n      subscriptionSelectorsRef.current = returnedValue as unknown as SubscriptionSelectors;\n    }\n    const stableArg = useStableQueryArgs(skip ? skipToken : arg);\n    const stableSubscriptionOptions = useShallowStableValue({\n      refetchOnReconnect,\n      refetchOnFocus,\n      pollingInterval,\n      skipPollingIfUnfocused\n    });\n    const initialPageParam = (rest as UseInfiniteQuerySubscriptionOptions<any>).initialPageParam;\n    const stableInitialPageParam = useShallowStableValue(initialPageParam);\n    const refetchCachedPages = (rest as UseInfiniteQuerySubscriptionOptions<any>).refetchCachedPages;\n    const stableRefetchCachedPages = useShallowStableValue(refetchCachedPages);\n\n    /**\n     * @todo Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n     */\n    const promiseRef = useRef<T | undefined>(undefined);\n    let {\n      queryCacheKey,\n      requestId\n    } = promiseRef.current || {};\n\n    // HACK We've saved the middleware subscription lookup callbacks into a ref,\n    // so we can directly check here if the subscription exists for this query.\n    let currentRenderHasSubscription = false;\n    if (queryCacheKey && requestId) {\n      currentRenderHasSubscription = subscriptionSelectorsRef.current.isRequestSubscribed(queryCacheKey, requestId);\n    }\n    const subscriptionRemoved = !currentRenderHasSubscription && promiseRef.current !== undefined;\n    usePossiblyImmediateEffect((): void | undefined => {\n      if (subscriptionRemoved) {\n        promiseRef.current = undefined;\n      }\n    }, [subscriptionRemoved]);\n    usePossiblyImmediateEffect((): void | undefined => {\n      const lastPromise = promiseRef.current;\n      if (typeof process !== 'undefined' && process.env.NODE_ENV === 'removeMeOnCompilation') {\n        // this is only present to enforce the rule of hooks to keep `isSubscribed` in the dependency array\n        console.log(subscriptionRemoved);\n      }\n      if (stableArg === skipToken) {\n        lastPromise?.unsubscribe();\n        promiseRef.current = undefined;\n        return;\n      }\n      const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions;\n      if (!lastPromise || lastPromise.arg !== stableArg) {\n        lastPromise?.unsubscribe();\n        const promise = dispatch(initiate(stableArg, {\n          subscriptionOptions: stableSubscriptionOptions,\n          forceRefetch: refetchOnMountOrArgChange,\n          ...(isInfiniteQueryDefinition(endpointDefinitions[endpointName]) ? {\n            initialPageParam: stableInitialPageParam,\n            refetchCachedPages: stableRefetchCachedPages\n          } : {})\n        }));\n        promiseRef.current = promise as T;\n      } else if (stableSubscriptionOptions !== lastSubscriptionOptions) {\n        lastPromise.updateSubscriptionOptions(stableSubscriptionOptions);\n      }\n    }, [dispatch, initiate, refetchOnMountOrArgChange, stableArg, stableSubscriptionOptions, subscriptionRemoved, stableInitialPageParam, stableRefetchCachedPages, endpointName]);\n    return [promiseRef, dispatch, initiate, stableSubscriptionOptions] as const;\n  }\n  function buildUseQueryState(endpointName: string, preSelector: typeof queryStatePreSelector | typeof infiniteQueryStatePreSelector) {\n    const useQueryState = (arg: any, {\n      skip = false,\n      selectFromResult\n    }: UseQueryStateOptions<any, any> | UseInfiniteQueryStateOptions<any, any> = {}) => {\n      const {\n        select\n      } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n      const stableArg = useStableQueryArgs(skip ? skipToken : arg);\n      type ApiRootState = Parameters<ReturnType<typeof select>>[0];\n      const lastValue = useRef<any>(undefined);\n      const selectDefaultResult: Selector<ApiRootState, any, [any]> = useMemo(() =>\n      // Normally ts-ignores are bad and should be avoided, but we're\n      // already casting this selector to be `Selector<any>` anyway,\n      // so the inconsistencies don't matter here\n      // @ts-ignore\n      createSelector([\n      // @ts-ignore\n      select(stableArg), (_: ApiRootState, lastResult: any) => lastResult, (_: ApiRootState) => stableArg], preSelector, {\n        memoizeOptions: {\n          resultEqualityCheck: shallowEqual\n        }\n      }), [select, stableArg]);\n      const querySelector: Selector<ApiRootState, any, [any]> = useMemo(() => selectFromResult ? createSelector([selectDefaultResult], selectFromResult, {\n        devModeChecks: {\n          identityFunctionCheck: 'never'\n        }\n      }) : selectDefaultResult, [selectDefaultResult, selectFromResult]);\n      const currentState = useSelector((state: RootState<Definitions, any, any>) => querySelector(state, lastValue.current), shallowEqual);\n      const store = useStore<RootState<Definitions, any, any>>();\n      const newLastValue = selectDefaultResult(store.getState(), lastValue.current);\n      useIsomorphicLayoutEffect(() => {\n        lastValue.current = newLastValue;\n      }, [newLastValue]);\n      return currentState;\n    };\n    return useQueryState;\n  }\n  function usePromiseRefUnsubscribeOnUnmount(promiseRef: UnsubscribePromiseRef) {\n    useEffect(() => {\n      return () => {\n        unsubscribePromiseRef(promiseRef)\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n        ;\n        (promiseRef.current as any) = undefined;\n      };\n    }, [promiseRef]);\n  }\n  function refetchOrErrorIfUnmounted<T extends QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>(promiseRef: React.RefObject<T | undefined>): T {\n    if (!promiseRef.current) throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(38) : 'Cannot refetch a query that has not been started yet.');\n    return promiseRef.current.refetch() as T;\n  }\n  function buildQueryHooks(endpointName: string): QueryHooks<any> {\n    const useQuerySubscription: UseQuerySubscription<any> = (arg: any, options = {}) => {\n      const [promiseRef] = useQuerySubscriptionCommonImpl<QueryActionCreatorResult<any>>(endpointName, arg, options);\n      usePromiseRefUnsubscribeOnUnmount(promiseRef);\n      return useMemo(() => ({\n        /**\n         * A method to manually refetch data for the query\n         */\n        refetch: () => refetchOrErrorIfUnmounted(promiseRef)\n      }), [promiseRef]);\n    };\n    const useLazyQuerySubscription: UseLazyQuerySubscription<any> = ({\n      refetchOnReconnect,\n      refetchOnFocus,\n      pollingInterval = 0,\n      skipPollingIfUnfocused = false\n    } = {}) => {\n      const {\n        initiate\n      } = api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>;\n      const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n      const [arg, setArg] = useState<any>(UNINITIALIZED_VALUE);\n\n      // TODO: Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n      /**\n       * @todo Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.\n       */\n      const promiseRef = useRef<QueryActionCreatorResult<any> | undefined>(undefined);\n      const stableSubscriptionOptions = useShallowStableValue({\n        refetchOnReconnect,\n        refetchOnFocus,\n        pollingInterval,\n        skipPollingIfUnfocused\n      });\n      usePossiblyImmediateEffect(() => {\n        const lastSubscriptionOptions = promiseRef.current?.subscriptionOptions;\n        if (stableSubscriptionOptions !== lastSubscriptionOptions) {\n          promiseRef.current?.updateSubscriptionOptions(stableSubscriptionOptions);\n        }\n      }, [stableSubscriptionOptions]);\n      const subscriptionOptionsRef = useRef(stableSubscriptionOptions);\n      usePossiblyImmediateEffect(() => {\n        subscriptionOptionsRef.current = stableSubscriptionOptions;\n      }, [stableSubscriptionOptions]);\n      const trigger = useCallback(function (arg: any, preferCacheValue = false) {\n        let promise: QueryActionCreatorResult<any>;\n        batch(() => {\n          unsubscribePromiseRef(promiseRef);\n          promiseRef.current = promise = dispatch(initiate(arg, {\n            subscriptionOptions: subscriptionOptionsRef.current,\n            forceRefetch: !preferCacheValue\n          }));\n          setArg(arg);\n        });\n        return promise!;\n      }, [dispatch, initiate]);\n      const reset = useCallback(() => {\n        if (promiseRef.current?.queryCacheKey) {\n          dispatch(api.internalActions.removeQueryResult({\n            queryCacheKey: promiseRef.current?.queryCacheKey as QueryCacheKey\n          }));\n        }\n      }, [dispatch]);\n\n      /* cleanup on unmount */\n      useEffect(() => {\n        return () => {\n          unsubscribePromiseRef(promiseRef);\n        };\n      }, []);\n\n      /* if \"cleanup on unmount\" was triggered from a fast refresh, we want to reinstate the query */\n      useEffect(() => {\n        if (arg !== UNINITIALIZED_VALUE && !promiseRef.current) {\n          trigger(arg, true);\n        }\n      }, [arg, trigger]);\n      return useMemo(() => [trigger, arg, {\n        reset\n      }] as const, [trigger, arg, reset]);\n    };\n    const useQueryState: UseQueryState<any> = buildUseQueryState(endpointName, queryStatePreSelector);\n    return {\n      useQueryState,\n      useQuerySubscription,\n      useLazyQuerySubscription,\n      useLazyQuery(options) {\n        const [trigger, arg, {\n          reset\n        }] = useLazyQuerySubscription(options);\n        const queryStateResults = useQueryState(arg, {\n          ...options,\n          skip: arg === UNINITIALIZED_VALUE\n        });\n        const info = useMemo(() => ({\n          lastArg: arg\n        }), [arg]);\n        return useMemo(() => [trigger, {\n          ...queryStateResults,\n          reset\n        }, info], [trigger, queryStateResults, reset, info]);\n      },\n      useQuery(arg, options) {\n        const querySubscriptionResults = useQuerySubscription(arg, options);\n        const queryStateResults = useQueryState(arg, {\n          selectFromResult: arg === skipToken || options?.skip ? undefined : noPendingQueryStateSelector,\n          ...options\n        });\n        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS);\n        useDebugValue(debugValue);\n        return useMemo(() => ({\n          ...queryStateResults,\n          ...querySubscriptionResults\n        }), [queryStateResults, querySubscriptionResults]);\n      }\n    };\n  }\n  function buildInfiniteQueryHooks(endpointName: string): InfiniteQueryHooks<any> {\n    const useInfiniteQuerySubscription: UseInfiniteQuerySubscription<any> = (arg: any, options = {}) => {\n      const [promiseRef, dispatch, initiate, stableSubscriptionOptions] = useQuerySubscriptionCommonImpl<InfiniteQueryActionCreatorResult<any>>(endpointName, arg, options);\n      const subscriptionOptionsRef = useRef(stableSubscriptionOptions);\n      usePossiblyImmediateEffect(() => {\n        subscriptionOptionsRef.current = stableSubscriptionOptions;\n      }, [stableSubscriptionOptions]);\n\n      // Extract and stabilize the hook-level refetchCachedPages option\n      const hookRefetchCachedPages = (options as UseInfiniteQuerySubscriptionOptions<any>).refetchCachedPages;\n      const stableHookRefetchCachedPages = useShallowStableValue(hookRefetchCachedPages);\n      const trigger: LazyInfiniteQueryTrigger<any> = useCallback(function (arg: unknown, direction: 'forward' | 'backward') {\n        let promise: InfiniteQueryActionCreatorResult<any>;\n        batch(() => {\n          unsubscribePromiseRef(promiseRef);\n          promiseRef.current = promise = dispatch((initiate as StartInfiniteQueryActionCreator<any>)(arg, {\n            subscriptionOptions: subscriptionOptionsRef.current,\n            direction\n          }));\n        });\n        return promise!;\n      }, [promiseRef, dispatch, initiate]);\n      usePromiseRefUnsubscribeOnUnmount(promiseRef);\n      const stableArg = useStableQueryArgs(options.skip ? skipToken : arg);\n      const refetch = useCallback((options?: Pick<UseInfiniteQuerySubscriptionOptions<any>, 'refetchCachedPages'>) => {\n        if (!promiseRef.current) throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(38) : 'Cannot refetch a query that has not been started yet.');\n        // Merge per-call options with hook-level default\n        const mergedOptions = {\n          refetchCachedPages: options?.refetchCachedPages ?? stableHookRefetchCachedPages\n        };\n        return promiseRef.current.refetch(mergedOptions);\n      }, [promiseRef, stableHookRefetchCachedPages]);\n      return useMemo(() => {\n        const fetchNextPage = () => {\n          return trigger(stableArg, 'forward');\n        };\n        const fetchPreviousPage = () => {\n          return trigger(stableArg, 'backward');\n        };\n        return {\n          trigger,\n          /**\n           * A method to manually refetch data for the query\n           */\n          refetch,\n          fetchNextPage,\n          fetchPreviousPage\n        };\n      }, [refetch, trigger, stableArg]);\n    };\n    const useInfiniteQueryState: UseInfiniteQueryState<any> = buildUseQueryState(endpointName, infiniteQueryStatePreSelector);\n    return {\n      useInfiniteQueryState,\n      useInfiniteQuerySubscription,\n      useInfiniteQuery(arg, options) {\n        const {\n          refetch,\n          fetchNextPage,\n          fetchPreviousPage\n        } = useInfiniteQuerySubscription(arg, options);\n        const queryStateResults = useInfiniteQueryState(arg, {\n          selectFromResult: arg === skipToken || options?.skip ? undefined : noPendingQueryStateSelector,\n          ...options\n        });\n        const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS, 'hasNextPage', 'hasPreviousPage');\n        useDebugValue(debugValue);\n        return useMemo(() => ({\n          ...queryStateResults,\n          fetchNextPage,\n          fetchPreviousPage,\n          refetch\n        }), [queryStateResults, fetchNextPage, fetchPreviousPage, refetch]);\n      }\n    };\n  }\n  function buildMutationHook(name: string): UseMutation<any> {\n    return ({\n      selectFromResult,\n      fixedCacheKey\n    } = {}) => {\n      const {\n        select,\n        initiate\n      } = api.endpoints[name] as ApiEndpointMutation<MutationDefinition<any, any, any, any, any>, Definitions>;\n      const dispatch = useDispatch<ThunkDispatch<any, any, UnknownAction>>();\n      const [promise, setPromise] = useState<MutationActionCreatorResult<any>>();\n      useEffect(() => () => {\n        if (!promise?.arg.fixedCacheKey) {\n          promise?.reset();\n        }\n      }, [promise]);\n      const triggerMutation = useCallback(function (arg: Parameters<typeof initiate>['0']) {\n        const promise = dispatch(initiate(arg, {\n          fixedCacheKey\n        }));\n        setPromise(promise);\n        return promise;\n      }, [dispatch, initiate, fixedCacheKey]);\n      const {\n        requestId\n      } = promise || {};\n      const selectDefaultResult = useMemo(() => select({\n        fixedCacheKey,\n        requestId: promise?.requestId\n      }), [fixedCacheKey, promise, select]);\n      const mutationSelector = useMemo((): Selector<RootState<Definitions, any, any>, any> => selectFromResult ? createSelector([selectDefaultResult], selectFromResult) : selectDefaultResult, [selectFromResult, selectDefaultResult]);\n      const currentState = useSelector(mutationSelector, shallowEqual);\n      const originalArgs = fixedCacheKey == null ? promise?.arg.originalArgs : undefined;\n      const reset = useCallback(() => {\n        batch(() => {\n          if (promise) {\n            setPromise(undefined);\n          }\n          if (fixedCacheKey) {\n            dispatch(api.internalActions.removeMutationResult({\n              requestId,\n              fixedCacheKey\n            }));\n          }\n        });\n      }, [dispatch, fixedCacheKey, promise, requestId]);\n      const debugValue = pick(currentState, ...COMMON_HOOK_DEBUG_FIELDS, 'endpointName');\n      useDebugValue(debugValue);\n      const finalState = useMemo(() => ({\n        ...currentState,\n        originalArgs,\n        reset\n      }), [currentState, originalArgs, reset]);\n      return useMemo(() => [triggerMutation, finalState] as const, [triggerMutation, finalState]);\n    };\n  }\n}","export { useEffect, useRef, useMemo, useContext, useCallback, useDebugValue, useLayoutEffect, useState } from 'react';","export { shallowEqual, Provider, ReactReduxContext } from 'react-redux';","export const UNINITIALIZED_VALUE = Symbol();\nexport type UninitializedValue = typeof UNINITIALIZED_VALUE;","import { useEffect, useRef, useMemo } from './reactImports';\nimport { copyWithStructuralSharing } from './rtkqImports';\nexport function useStableQueryArgs<T>(queryArgs: T) {\n  const cache = useRef(queryArgs);\n  const copy = useMemo(() => copyWithStructuralSharing(cache.current, queryArgs), [queryArgs]);\n  useEffect(() => {\n    if (cache.current !== copy) {\n      cache.current = copy;\n    }\n  }, [copy]);\n  return copy;\n}","import { useEffect, useRef } from './reactImports';\nimport { shallowEqual } from './reactReduxImports';\nexport function useShallowStableValue<T>(value: T) {\n  const cache = useRef(value);\n  useEffect(() => {\n    if (!shallowEqual(cache.current, value)) {\n      cache.current = value;\n    }\n  }, [value]);\n  return shallowEqual(cache.current, value) ? cache.current : value;\n}","// This must remain here so that the `mangleErrors.cjs` build script\n// does not have to import this into each source file it rewrites.\nimport { formatProdErrorMessage } from '@reduxjs/toolkit';\nimport { buildCreateApi, coreModule } from './rtkqImports';\nimport { reactHooksModule, reactHooksModuleName } from './module';\nexport * from '@reduxjs/toolkit/query';\nexport { ApiProvider } from './ApiProvider';\nconst createApi = /* @__PURE__ */buildCreateApi(coreModule(), reactHooksModule());\nexport type { TypedUseMutationResult, TypedUseQueryHookResult, TypedUseQueryStateResult, TypedUseQuerySubscriptionResult, TypedLazyQueryTrigger, TypedUseLazyQuery, TypedUseMutation, TypedMutationTrigger, TypedQueryStateSelector, TypedUseQueryState, TypedUseQuery, TypedUseQuerySubscription, TypedUseLazyQuerySubscription, TypedUseQueryStateOptions, TypedUseLazyQueryStateResult, TypedUseInfiniteQuery, TypedUseInfiniteQueryHookResult, TypedUseInfiniteQueryStateResult, TypedUseInfiniteQuerySubscriptionResult, TypedUseInfiniteQueryStateOptions, TypedInfiniteQueryStateSelector, TypedUseInfiniteQuerySubscription, TypedUseInfiniteQueryState, TypedLazyInfiniteQueryTrigger } from './buildHooks';\nexport { UNINITIALIZED_VALUE } from './constants';\nexport { createApi, reactHooksModule, reactHooksModuleName };","import { configureStore, formatProdErrorMessage as _formatProdErrorMessage } from '@reduxjs/toolkit';\nimport type { Context } from 'react';\nimport { useContext, useEffect } from './reactImports';\nimport * as React from 'react';\nimport type { ReactReduxContextValue } from 'react-redux';\nimport { Provider, ReactReduxContext } from './reactReduxImports';\nimport { setupListeners } from './rtkqImports';\nimport type { Api } from '@reduxjs/toolkit/query';\n\n/**\n * Can be used as a `Provider` if you **do not already have a Redux store**.\n *\n * @example\n * ```tsx\n * // codeblock-meta no-transpile title=\"Basic usage - wrap your App with ApiProvider\"\n * import * as React from 'react';\n * import { ApiProvider } from '@reduxjs/toolkit/query/react';\n * import { Pokemon } from './features/Pokemon';\n *\n * function App() {\n *   return (\n *     <ApiProvider api={api}>\n *       <Pokemon />\n *     </ApiProvider>\n *   );\n * }\n * ```\n *\n * @remarks\n * Using this together with an existing redux store, both will\n * conflict with each other - please use the traditional redux setup\n * in that case.\n */\nexport function ApiProvider(props: {\n  children: any;\n  api: Api<any, {}, any, any>;\n  setupListeners?: Parameters<typeof setupListeners>[1] | false;\n  context?: Context<ReactReduxContextValue | null>;\n}) {\n  const context = props.context || ReactReduxContext;\n  const existingContext = useContext(context);\n  if (existingContext) {\n    throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(35) : 'Existing Redux context detected. If you already have a store set up, please use the traditional Redux setup.');\n  }\n  const [store] = React.useState(() => configureStore({\n    reducer: {\n      [props.api.reducerPath]: props.api.reducer\n    },\n    middleware: gDM => gDM().concat(props.api.middleware)\n  }));\n  // Adds the event listeners for online/offline/focus/etc\n  useEffect((): undefined | (() => void) => props.setupListeners === false ? undefined : setupListeners(store.dispatch, props.setupListeners), [props.setupListeners, store.dispatch]);\n  return <Provider store={store} context={context}>\n      {props.children}\n    </Provider>;\n}"],"mappings":";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GlF,YAAY,WAAW;AA8BhB,SAAS,YAAY,OAKzB;AACD,QAAM,UAAU,MAAM,WAAW;AACjC,QAAM,kBAAkB,WAAW,OAAO;AAC1C,MAAI,iBAAiB;AACnB,UAAM,IAAI,MAAM,QAAQ,IAAI,aAAa,eAAeC,yBAAwB,EAAE,IAAI,8GAA8G;AAAA,EACtM;AACA,QAAM,CAAC,KAAK,IAAU,eAAS,MAAM,eAAe;AAAA,IAClD,SAAS;AAAA,MACP,CAAC,MAAM,IAAI,WAAW,GAAG,MAAM,IAAI;AAAA,IACrC;AAAA,IACA,YAAY,SAAO,IAAI,EAAE,OAAO,MAAM,IAAI,UAAU;AAAA,EACtD,CAAC,CAAC;AAEF,YAAU,MAAgC,MAAM,mBAAmB,QAAQ,SAAY,eAAe,MAAM,UAAU,MAAM,cAAc,GAAG,CAAC,MAAM,gBAAgB,MAAM,QAAQ,CAAC;AACnL,SAAO,oCAAC,YAAS,OAAc,WAC1B,MAAM,QACT;AACJ;;;ADhDA,IAAM,YAA2B,+BAAe,WAAW,GAAG,iBAAiB,CAAC;","names":["_formatProdErrorMessage","arg","options","promise","_formatProdErrorMessage","_formatProdErrorMessage","_formatProdErrorMessage"]}
Index: node_modules/@reduxjs/toolkit/dist/query/rtk-query.browser.mjs
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/rtk-query.browser.mjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/rtk-query.browser.mjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,2 @@
+var ft=(y=>(y.uninitialized="uninitialized",y.pending="pending",y.fulfilled="fulfilled",y.rejected="rejected",y))(ft||{}),j="uninitialized",Ne="pending",Te="fulfilled",he="rejected";function et(e){return{status:e,isUninitialized:e===j,isLoading:e===Ne,isSuccess:e===Te,isError:e===he}}import{createAction as ee,createSlice as pe,createSelector as mt,createAsyncThunk as tt,combineReducers as gt,createNextState as Ie,isAnyOf as de,isAllOf as Ue,isAction as Qt,isPending as qe,isRejected as Re,isFulfilled as $,isRejectedWithValue as Ae,isAsyncThunkAction as nt,prepareAutoBatched as Se,SHOULD_AUTOBATCH as Ke,isPlainObject as ie,nanoid as Le}from"@reduxjs/toolkit";var Tt=ie;function _e(e,n){if(e===n||!(Tt(e)&&Tt(n)||Array.isArray(e)&&Array.isArray(n)))return n;let u=Object.keys(n),f=Object.keys(e),y=u.length===f.length,A=Array.isArray(n)?[]:{};for(let g of u)A[g]=_e(e[g],n[g]),y&&(y=e[g]===A[g]);return y?e:A}function Be(e,n,u){return e.reduce((f,y,A)=>(n(y,A)&&f.push(u(y,A)),f),[]).flat()}function ht(e){return new RegExp("(^|:)//").test(e)}function Rt(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function ke(e){return e!=null}function rt(e){return[...e?.values()??[]].filter(ke)}function At(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var un=e=>e.replace(/\/$/,""),yn=e=>e.replace(/^\//,"");function St(e,n){if(!e)return n;if(!n)return e;if(ht(n))return n;let u=e.endsWith("/")||!n.startsWith("?")?"/":"";return e=un(e),n=yn(n),`${e}${u}${n}`}function ce(e,n,u){return e.has(n)?e.get(n):e.set(n,u(n)).get(n)}var Me=()=>new Map;var xt=e=>{let n=new AbortController;return setTimeout(()=>{let u="signal timed out",f="TimeoutError";n.abort(typeof DOMException<"u"?new DOMException(u,f):Object.assign(new Error(u),{name:f}))},e),n.signal},Dt=(...e)=>{for(let u of e)if(u.aborted)return AbortSignal.abort(u.reason);let n=new AbortController;for(let u of e)u.addEventListener("abort",()=>n.abort(u.reason),{signal:n.signal,once:!0});return n.signal};var Et=(...e)=>fetch(...e),pn=e=>e.status>=200&&e.status<=299,dn=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function bt(e){if(!ie(e))return e;let n={...e};for(let[u,f]of Object.entries(n))f===void 0&&delete n[u];return n}var cn=e=>typeof e=="object"&&(ie(e)||Array.isArray(e)||typeof e.toJSON=="function");function ln({baseUrl:e,prepareHeaders:n=T=>T,fetchFn:u=Et,paramsSerializer:f,isJsonContentType:y=dn,jsonContentType:A="application/json",jsonReplacer:g,timeout:B,responseHandler:k,validateStatus:S,...x}={}){return typeof fetch>"u"&&u===Et&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),async(h,E,M)=>{let{getState:b,extra:c,endpoint:R,forced:I,type:s}=E,d,{url:i,headers:Q=new Headers(x.headers),params:D=void 0,responseHandler:m=k??"json",validateStatus:p=S??pn,timeout:a=B,...t}=typeof h=="string"?{url:h}:h,r={...x,signal:a?Dt(E.signal,xt(a)):E.signal,...t};Q=new Headers(bt(Q)),r.headers=await n(Q,{getState:b,arg:h,extra:c,endpoint:R,forced:I,type:s,extraOptions:M})||Q;let o=cn(r.body);if(r.body!=null&&!o&&typeof r.body!="string"&&r.headers.delete("content-type"),!r.headers.has("content-type")&&o&&r.headers.set("content-type",A),o&&y(r.headers)&&(r.body=JSON.stringify(r.body,g)),r.headers.has("accept")||(m==="json"?r.headers.set("accept","application/json"):m==="text"&&r.headers.set("accept","text/plain, text/html, */*")),D){let v=~i.indexOf("?")?"&":"?",L=f?f(D):new URLSearchParams(bt(D));i+=v+L}i=St(e,i);let l=new Request(i,r);d={request:new Request(i,r)};let w;try{w=await u(l)}catch(v){return{error:{status:(v instanceof Error||typeof DOMException<"u"&&v instanceof DOMException)&&v.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(v)},meta:d}}let O=w.clone();d.response=O;let F,P="";try{let v;if(await Promise.all([T(w,m).then(L=>F=L,L=>v=L),O.text().then(L=>P=L,()=>{})]),v)throw v}catch(v){return{error:{status:"PARSING_ERROR",originalStatus:w.status,data:P,error:String(v)},meta:d}}return p(w,F)?{data:F,meta:d}:{error:{status:w.status,data:F},meta:d}};async function T(h,E){if(typeof E=="function")return E(h);if(E==="content-type"&&(E=y(h.headers)?"json":"text"),E==="json"){let M=await h.text();return M.length?JSON.parse(M):null}return h.text()}}var G=class{constructor(n,u=void 0){this.value=n;this.meta=u}};async function fn(e=0,n=5,u){let f=Math.min(e,n),y=~~((Math.random()+.4)*(300<<f));await new Promise((A,g)=>{let B=setTimeout(()=>A(),y);if(u){let k=()=>{clearTimeout(B),g(new Error("Aborted"))};u.aborted?(clearTimeout(B),g(new Error("Aborted"))):u.addEventListener("abort",k,{once:!0})}})}function It(e,n){throw Object.assign(new G({error:e,meta:n}),{throwImmediately:!0})}function it(e){e.aborted&&It({status:"CUSTOM_ERROR",error:"Aborted"})}var Pt={},mn=(e,n)=>async(u,f,y)=>{let A=[5,(n||Pt).maxRetries,(y||Pt).maxRetries].filter(x=>x!==void 0),[g]=A.slice(-1),k={maxRetries:g,backoff:fn,retryCondition:(x,T,{attempt:h})=>h<=g,...n,...y},S=0;for(;;){it(f.signal);try{let x=await e(u,f,y);if(x.error)throw new G(x);return x}catch(x){if(S++,x.throwImmediately){if(x instanceof G)return x.value;throw x}if(x instanceof G){if(!k.retryCondition(x.value.error,u,{attempt:S,baseQueryApi:f,extraOptions:y}))return x.value}else if(S>k.maxRetries)return{error:x};it(f.signal);try{await k.backoff(S,k.maxRetries,f.signal)}catch(T){throw it(f.signal),T}}}},gn=Object.assign(mn,{fail:It});var Ve="__rtkq/",Bt="online",kt="offline",Qn="focus",Mt="focused",Tn="visibilitychange",ae=ee(`${Ve}${Mt}`),xe=ee(`${Ve}un${Mt}`),oe=ee(`${Ve}${Bt}`),De=ee(`${Ve}${kt}`),hn={onFocus:ae,onFocusLost:xe,onOnline:oe,onOffline:De},He=!1;function Rn(e,n){function u(){let[f,y,A,g]=[ae,xe,oe,De].map(x=>()=>e(x())),B=()=>{window.document.visibilityState==="visible"?f():y()},k=()=>{He=!1};if(!He&&typeof window<"u"&&window.addEventListener){let T=function(h){Object.entries(x).forEach(([E,M])=>{h?window.addEventListener(E,M,!1):window.removeEventListener(E,M)})};var S=T;let x={[Qn]:f,[Tn]:B,[Bt]:A,[kt]:g};T(!0),He=!0,k=()=>{T(!1),He=!1}}return k}return n?n(e,hn):u()}var te="query",at="mutation",ot="infinitequery";function le(e){return e.type===te}function wt(e){return e.type===at}function fe(e){return e.type===ot}function Ee(e){return le(e)||fe(e)}function we(e,n,u,f,y,A){let g=An(e)?e(n,u,f,y):e;return g?Be(g,ke,B=>A(st(B))):[]}function An(e){return typeof e=="function"}function st(e){return typeof e=="string"?{type:e}:e}import{current as Ct,isDraft as je,applyPatches as ut,original as Ft,isDraftable as vt,produceWithPatches as ze,enablePatches as Ot}from"immer";import"@reduxjs/toolkit";function Nt(e,n){return e.catch(n)}var Y=(e,n)=>e.endpointDefinitions[n];var be=Symbol("forceQueryFn"),Ce=e=>typeof e[be]=="function";function Ut({serializeQueryArgs:e,queryThunk:n,infiniteQueryThunk:u,mutationThunk:f,api:y,context:A,getInternalState:g}){let B=i=>g(i)?.runningQueries,k=i=>g(i)?.runningMutations,{unsubscribeQueryResult:S,removeMutationResult:x,updateSubscriptionOptions:T}=y.internalActions;return{buildInitiateQuery:I,buildInitiateInfiniteQuery:s,buildInitiateMutation:d,getRunningQueryThunk:h,getRunningMutationThunk:E,getRunningQueriesThunk:M,getRunningMutationsThunk:b};function h(i,Q){return D=>{let m=Y(A,i),p=e({queryArgs:Q,endpointDefinition:m,endpointName:i});return B(D)?.get(p)}}function E(i,Q){return D=>k(D)?.get(Q)}function M(){return i=>rt(B(i))}function b(){return i=>rt(k(i))}function c(i){}function R(i,Q){let D=(m,{subscribe:p=!0,forceRefetch:a,subscriptionOptions:t,[be]:r,...o}={})=>(l,C)=>{let w=e({queryArgs:m,endpointDefinition:Q,endpointName:i}),O,F={...o,type:te,subscribe:p,forceRefetch:a,subscriptionOptions:t,endpointName:i,originalArgs:m,queryCacheKey:w,[be]:r};if(le(Q))O=n(F);else{let{direction:q,initialPageParam:K,refetchCachedPages:N}=o;O=u({...F,direction:q,initialPageParam:K,refetchCachedPages:N})}let P=y.endpoints[i].select(m),v=l(O),L=P(C());let{requestId:z,abort:J}=v,_=L.requestId!==z,V=B(l)?.get(w),H=()=>P(C()),U=Object.assign(r?v.then(H):_&&!V?Promise.resolve(L):Promise.all([V,v]).then(H),{arg:m,requestId:z,subscriptionOptions:t,queryCacheKey:w,abort:J,async unwrap(){let q=await U;if(q.isError)throw q.error;return q.data},refetch:q=>l(D(m,{subscribe:!1,forceRefetch:!0,...q})),unsubscribe(){p&&l(S({queryCacheKey:w,requestId:z}))},updateSubscriptionOptions(q){U.subscriptionOptions=q,l(T({endpointName:i,requestId:z,queryCacheKey:w,options:q}))}});if(!V&&!_&&!r){let q=B(l);q.set(w,U),U.then(()=>{q.delete(w)})}return U};return D}function I(i,Q){return R(i,Q)}function s(i,Q){return R(i,Q)}function d(i){return(Q,{track:D=!0,fixedCacheKey:m}={})=>(p,a)=>{let t=f({type:"mutation",endpointName:i,originalArgs:Q,track:D,fixedCacheKey:m}),r=p(t);let{requestId:o,abort:l,unwrap:C}=r,w=Nt(r.unwrap().then(v=>({data:v})),v=>({error:v})),O=()=>{p(x({requestId:o,fixedCacheKey:m}))},F=Object.assign(w,{arg:r.arg,requestId:o,abort:l,unwrap:C,reset:O}),P=k(p);return P.set(o,F),F.then(()=>{P.delete(o)}),m&&(P.set(m,F),F.then(()=>{P.get(m)===F&&P.delete(m)})),F}}}import{SchemaError as Sn}from"@standard-schema/utils";var Pe=class extends Sn{constructor(u,f,y,A){super(u);this.value=f;this.schemaName=y;this._bqMeta=A}},se=(e,n)=>Array.isArray(e)?e.includes(n):!!e;async function ue(e,n,u,f){let y=await e["~standard"].validate(n);if(y.issues)throw new Pe(y.issues,n,u,f);return y.value}function qt(e){return e}var Fe=(e={})=>({...e,[Ke]:!0});function Kt({reducerPath:e,baseQuery:n,context:{endpointDefinitions:u},serializeQueryArgs:f,api:y,assertTagType:A,selectors:g,onSchemaFailure:B,catchSchemaFailure:k,skipSchemaValidation:S}){let x=(t,r,o,l)=>(C,w)=>{let O=u[t],F=f({queryArgs:r,endpointDefinition:O,endpointName:t});if(C(y.internalActions.queryResultPatched({queryCacheKey:F,patches:o})),!l)return;let P=y.endpoints[t].select(r)(w()),v=we(O.providesTags,P.data,void 0,r,{},A);C(y.internalActions.updateProvidedBy([{queryCacheKey:F,providedTags:v}]))};function T(t,r,o=0){let l=[r,...t];return o&&l.length>o?l.slice(0,-1):l}function h(t,r,o=0){let l=[...t,r];return o&&l.length>o?l.slice(1):l}let E=(t,r,o,l=!0)=>(C,w)=>{let F=y.endpoints[t].select(r)(w()),P={patches:[],inversePatches:[],undo:()=>C(y.util.patchQueryData(t,r,P.inversePatches,l))};if(F.status===j)return P;let v;if("data"in F)if(vt(F.data)){let[L,z,J]=ze(F.data,o);P.patches.push(...z),P.inversePatches.push(...J),v=L}else v=o(F.data),P.patches.push({op:"replace",path:[],value:v}),P.inversePatches.push({op:"replace",path:[],value:F.data});return P.patches.length===0||C(y.util.patchQueryData(t,r,P.patches,l)),P},M=(t,r,o)=>l=>l(y.endpoints[t].initiate(r,{subscribe:!1,forceRefetch:!0,[be]:()=>({data:o})})),b=(t,r)=>t.query&&t[r]?t[r]:qt,c=async(t,{signal:r,abort:o,rejectWithValue:l,fulfillWithValue:C,dispatch:w,getState:O,extra:F})=>{let P=u[t.endpointName],{metaSchema:v,skipSchemaValidation:L=S}=P,z=t.type===te;try{let J=qt,_={signal:r,abort:o,dispatch:w,getState:O,extra:F,endpoint:t.endpointName,type:t.type,forced:z?R(t,O()):void 0,queryCacheKey:z?t.queryCacheKey:void 0},V=z?t[be]:void 0,H,U=async(K,N,ne,W)=>{if(N==null&&K.pages.length)return Promise.resolve({data:K});let ge={queryArg:t.originalArgs,pageParam:N},X=await q(ge),Qe=W?T:h;return{data:{pages:Qe(K.pages,X.data,ne),pageParams:Qe(K.pageParams,N,ne)},meta:X.meta}};async function q(K){let N,{extraOptions:ne,argSchema:W,rawResponseSchema:ge,responseSchema:X}=P;if(W&&!se(L,"arg")&&(K=await ue(W,K,"argSchema",{})),V?N=V():P.query?(J=b(P,"transformResponse"),N=await n(P.query(K),_,ne)):N=await P.queryFn(K,_,ne,ye=>n(ye,_,ne)),N.error)throw new G(N.error,N.meta);let{data:Qe}=N;ge&&!se(L,"rawResponse")&&(Qe=await ue(ge,N.data,"rawResponseSchema",N.meta));let re=await J(Qe,N.meta,K);return X&&!se(L,"response")&&(re=await ue(X,re,"responseSchema",N.meta)),{...N,data:re}}if(z&&"infiniteQueryOptions"in P){let{infiniteQueryOptions:K}=P,{maxPages:N=1/0}=K,ne=t.refetchCachedPages??K.refetchCachedPages??!0,W,ge={pages:[],pageParams:[]},X=g.selectQueryEntry(O(),t.queryCacheKey)?.data,re=R(t,O())&&!t.direction||!X?ge:X;if("direction"in t&&t.direction&&re.pages.length){let ye=t.direction==="backward",Oe=(ye?yt:We)(K,re,t.originalArgs);W=await U(re,Oe,N,ye)}else{let{initialPageParam:ye=K.initialPageParam}=t,ve=X?.pageParams??[],Oe=ve[0]??ye,on=ve.length;if(W=await U(re,Oe,N),V&&(W={data:W.data.pages[0]}),ne)for(let lt=1;lt<on;lt++){let sn=We(K,W.data,t.originalArgs);W=await U(W.data,sn,N)}}H=W}else H=await q(t.originalArgs);return v&&!se(L,"meta")&&H.meta&&(H.meta=await ue(v,H.meta,"metaSchema",H.meta)),C(H.data,Fe({fulfilledTimeStamp:Date.now(),baseQueryMeta:H.meta}))}catch(J){let _=J;if(_ instanceof G){let V=b(P,"transformErrorResponse"),{rawErrorResponseSchema:H,errorResponseSchema:U}=P,{value:q,meta:K}=_;try{H&&!se(L,"rawErrorResponse")&&(q=await ue(H,q,"rawErrorResponseSchema",K)),v&&!se(L,"meta")&&(K=await ue(v,K,"metaSchema",K));let N=await V(q,K,t.originalArgs);return U&&!se(L,"errorResponse")&&(N=await ue(U,N,"errorResponseSchema",K)),l(N,Fe({baseQueryMeta:K}))}catch(N){_=N}}try{if(_ instanceof Pe){let V={endpoint:t.endpointName,arg:t.originalArgs,type:t.type,queryCacheKey:z?t.queryCacheKey:void 0};P.onSchemaFailure?.(_,V),B?.(_,V);let{catchSchemaFailure:H=k}=P;if(H)return l(H(_,V),Fe({baseQueryMeta:_._bqMeta}))}}catch(V){_=V}throw console.error(_),_}};function R(t,r){let o=g.selectQueryEntry(r,t.queryCacheKey),l=g.selectConfig(r).refetchOnMountOrArgChange,C=o?.fulfilledTimeStamp,w=t.forceRefetch??(t.subscribe&&l);return w?w===!0||(Number(new Date)-Number(C))/1e3>=w:!1}let I=()=>tt(`${e}/executeQuery`,c,{getPendingMeta({arg:r}){let o=u[r.endpointName];return Fe({startedTimeStamp:Date.now(),...fe(o)?{direction:r.direction}:{}})},condition(r,{getState:o}){let l=o(),C=g.selectQueryEntry(l,r.queryCacheKey),w=C?.fulfilledTimeStamp,O=r.originalArgs,F=C?.originalArgs,P=u[r.endpointName],v=r.direction;return Ce(r)?!0:C?.status==="pending"?!1:R(r,l)||le(P)&&P?.forceRefetch?.({currentArg:O,previousArg:F,endpointState:C,state:l})?!0:!(w&&!v)},dispatchConditionRejection:!0}),s=I(),d=I(),i=tt(`${e}/executeMutation`,c,{getPendingMeta(){return Fe({startedTimeStamp:Date.now()})}}),Q=t=>"force"in t,D=t=>"ifOlderThan"in t,m=(t,r,o={})=>(l,C)=>{let w=Q(o)&&o.force,O=D(o)&&o.ifOlderThan,F=(v=!0)=>{let L={forceRefetch:v,subscribe:!1};return y.endpoints[t].initiate(r,L)},P=y.endpoints[t].select(r)(C());if(w)l(F());else if(O){let v=P?.fulfilledTimeStamp;if(!v){l(F());return}(Number(new Date)-Number(new Date(v)))/1e3>=O&&l(F())}else l(F(!1))};function p(t){return r=>r?.meta?.arg?.endpointName===t}function a(t,r){return{matchPending:Ue(qe(t),p(r)),matchFulfilled:Ue($(t),p(r)),matchRejected:Ue(Re(t),p(r))}}return{queryThunk:s,mutationThunk:i,infiniteQueryThunk:d,prefetch:m,updateQueryData:E,upsertQueryData:M,patchQueryData:x,buildMatchThunkActions:a}}function We(e,{pages:n,pageParams:u},f){let y=n.length-1;return e.getNextPageParam(n[y],n,u[y],u,f)}function yt(e,{pages:n,pageParams:u},f){return e.getPreviousPageParam?.(n[0],n,u[0],u,f)}function $e(e,n,u,f){return we(u[e.meta.arg.endpointName][n],$(e)?e.payload:void 0,Ae(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,f)}function pt(e){return je(e)?Ct(e):e}function Ye(e,n,u){let f=e[n];f&&u(f)}function me(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Lt(e,n,u){let f=e[me(n)];f&&u(f)}var Je={};function _t({reducerPath:e,queryThunk:n,mutationThunk:u,serializeQueryArgs:f,context:{endpointDefinitions:y,apiUid:A,extractRehydrationInfo:g,hasRehydrationInfo:B},assertTagType:k,config:S}){let x=ee(`${e}/resetApiState`);function T(p,a,t,r){p[a.queryCacheKey]??={status:j,endpointName:a.endpointName},Ye(p,a.queryCacheKey,o=>{o.status=Ne,o.requestId=t&&o.requestId?o.requestId:r.requestId,a.originalArgs!==void 0&&(o.originalArgs=a.originalArgs),o.startedTimeStamp=r.startedTimeStamp;let l=y[r.arg.endpointName];fe(l)&&"direction"in a&&(o.direction=a.direction)})}function h(p,a,t,r){Ye(p,a.arg.queryCacheKey,o=>{if(o.requestId!==a.requestId&&!r)return;let{merge:l}=y[a.arg.endpointName];if(o.status=Te,l)if(o.data!==void 0){let{fulfilledTimeStamp:C,arg:w,baseQueryMeta:O,requestId:F}=a,P=Ie(o.data,v=>l(v,t,{arg:w.originalArgs,baseQueryMeta:O,fulfilledTimeStamp:C,requestId:F}));o.data=P}else o.data=t;else o.data=y[a.arg.endpointName].structuralSharing??!0?_e(je(o.data)?Ft(o.data):o.data,t):t;delete o.error,o.fulfilledTimeStamp=a.fulfilledTimeStamp})}let E=pe({name:`${e}/queries`,initialState:Je,reducers:{removeQueryResult:{reducer(p,{payload:{queryCacheKey:a}}){delete p[a]},prepare:Se()},cacheEntriesUpserted:{reducer(p,a){for(let t of a.payload){let{queryDescription:r,value:o}=t;T(p,r,!0,{arg:r,requestId:a.meta.requestId,startedTimeStamp:a.meta.timestamp}),h(p,{arg:r,requestId:a.meta.requestId,fulfilledTimeStamp:a.meta.timestamp,baseQueryMeta:{}},o,!0)}},prepare:p=>({payload:p.map(r=>{let{endpointName:o,arg:l,value:C}=r,w=y[o];return{queryDescription:{type:te,endpointName:o,originalArgs:r.arg,queryCacheKey:f({queryArgs:l,endpointDefinition:w,endpointName:o})},value:C}}),meta:{[Ke]:!0,requestId:Le(),timestamp:Date.now()}})},queryResultPatched:{reducer(p,{payload:{queryCacheKey:a,patches:t}}){Ye(p,a,r=>{r.data=ut(r.data,t.concat())})},prepare:Se()}},extraReducers(p){p.addCase(n.pending,(a,{meta:t,meta:{arg:r}})=>{let o=Ce(r);T(a,r,o,t)}).addCase(n.fulfilled,(a,{meta:t,payload:r})=>{let o=Ce(t.arg);h(a,t,r,o)}).addCase(n.rejected,(a,{meta:{condition:t,arg:r,requestId:o},error:l,payload:C})=>{Ye(a,r.queryCacheKey,w=>{if(!t){if(w.requestId!==o)return;w.status=he,w.error=C??l}})}).addMatcher(B,(a,t)=>{let{queries:r}=g(t);for(let[o,l]of Object.entries(r))(l?.status===Te||l?.status===he)&&(a[o]=l)})}}),M=pe({name:`${e}/mutations`,initialState:Je,reducers:{removeMutationResult:{reducer(p,{payload:a}){let t=me(a);t in p&&delete p[t]},prepare:Se()}},extraReducers(p){p.addCase(u.pending,(a,{meta:t,meta:{requestId:r,arg:o,startedTimeStamp:l}})=>{o.track&&(a[me(t)]={requestId:r,status:Ne,endpointName:o.endpointName,startedTimeStamp:l})}).addCase(u.fulfilled,(a,{payload:t,meta:r})=>{r.arg.track&&Lt(a,r,o=>{o.requestId===r.requestId&&(o.status=Te,o.data=t,o.fulfilledTimeStamp=r.fulfilledTimeStamp)})}).addCase(u.rejected,(a,{payload:t,error:r,meta:o})=>{o.arg.track&&Lt(a,o,l=>{l.requestId===o.requestId&&(l.status=he,l.error=t??r)})}).addMatcher(B,(a,t)=>{let{mutations:r}=g(t);for(let[o,l]of Object.entries(r))(l?.status===Te||l?.status===he)&&o!==l?.requestId&&(a[o]=l)})}}),b={tags:{},keys:{}},c=pe({name:`${e}/invalidation`,initialState:b,reducers:{updateProvidedBy:{reducer(p,a){for(let{queryCacheKey:t,providedTags:r}of a.payload){R(p,t);for(let{type:o,id:l}of r){let C=(p.tags[o]??={})[l||"__internal_without_id"]??=[];C.includes(t)||C.push(t)}p.keys[t]=r}},prepare:Se()}},extraReducers(p){p.addCase(E.actions.removeQueryResult,(a,{payload:{queryCacheKey:t}})=>{R(a,t)}).addMatcher(B,(a,t)=>{let{provided:r}=g(t);for(let[o,l]of Object.entries(r.tags??{}))for(let[C,w]of Object.entries(l)){let O=(a.tags[o]??={})[C||"__internal_without_id"]??=[];for(let F of w)O.includes(F)||O.push(F),a.keys[F]=r.keys[F]}}).addMatcher(de($(n),Ae(n)),(a,t)=>{I(a,[t])}).addMatcher(E.actions.cacheEntriesUpserted.match,(a,t)=>{let r=t.payload.map(({queryDescription:o,value:l})=>({type:"UNKNOWN",payload:l,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:o}}));I(a,r)})}});function R(p,a){let t=pt(p.keys[a]??[]);for(let r of t){let o=r.type,l=r.id??"__internal_without_id",C=p.tags[o]?.[l];C&&(p.tags[o][l]=pt(C).filter(w=>w!==a))}delete p.keys[a]}function I(p,a){let t=a.map(r=>{let o=$e(r,"providesTags",y,k),{queryCacheKey:l}=r.meta.arg;return{queryCacheKey:l,providedTags:o}});c.caseReducers.updateProvidedBy(p,c.actions.updateProvidedBy(t))}let s=pe({name:`${e}/subscriptions`,initialState:Je,reducers:{updateSubscriptionOptions(p,a){},unsubscribeQueryResult(p,a){},internal_getRTKQSubscriptions(){}}}),d=pe({name:`${e}/internalSubscriptions`,initialState:Je,reducers:{subscriptionsUpdated:{reducer(p,a){return ut(p,a.payload)},prepare:Se()}}}),i=pe({name:`${e}/config`,initialState:{online:At(),focused:Rt(),middlewareRegistered:!1,...S},reducers:{middlewareRegistered(p,{payload:a}){p.middlewareRegistered=p.middlewareRegistered==="conflict"||A!==a?"conflict":!0}},extraReducers:p=>{p.addCase(oe,a=>{a.online=!0}).addCase(De,a=>{a.online=!1}).addCase(ae,a=>{a.focused=!0}).addCase(xe,a=>{a.focused=!1}).addMatcher(B,a=>({...a}))}}),Q=gt({queries:E.reducer,mutations:M.reducer,provided:c.reducer,subscriptions:d.reducer,config:i.reducer}),D=(p,a)=>Q(x.match(a)?void 0:p,a),m={...i.actions,...E.actions,...s.actions,...d.actions,...M.actions,...c.actions,resetApiState:x};return{reducer:D,actions:m}}var Ge=Symbol.for("RTKQ/skipToken"),jt={status:j},Ht=Ie(jt,()=>{}),Vt=Ie(jt,()=>{});function zt({serializeQueryArgs:e,reducerPath:n,createSelector:u}){let f=s=>Ht,y=s=>Vt;return{buildQuerySelector:h,buildInfiniteQuerySelector:E,buildMutationSelector:M,selectInvalidatedBy:b,selectCachedArgsForQuery:c,selectApiState:g,selectQueries:B,selectMutations:S,selectQueryEntry:k,selectConfig:x};function A(s){return{...s,...et(s.status)}}function g(s){return s[n]}function B(s){return g(s)?.queries}function k(s,d){return B(s)?.[d]}function S(s){return g(s)?.mutations}function x(s){return g(s)?.config}function T(s,d,i){return Q=>{if(Q===Ge)return u(f,i);let D=e({queryArgs:Q,endpointDefinition:d,endpointName:s});return u(p=>k(p,D)??Ht,i)}}function h(s,d){return T(s,d,A)}function E(s,d){let{infiniteQueryOptions:i}=d;function Q(D){let m={...D,...et(D.status)},{isLoading:p,isError:a,direction:t}=m,r=t==="forward",o=t==="backward";return{...m,hasNextPage:R(i,m.data,m.originalArgs),hasPreviousPage:I(i,m.data,m.originalArgs),isFetchingNextPage:p&&r,isFetchingPreviousPage:p&&o,isFetchNextPageError:a&&r,isFetchPreviousPageError:a&&o}}return T(s,d,Q)}function M(){return s=>{let d;return typeof s=="object"?d=me(s)??Ge:d=s,u(d===Ge?y:D=>g(D)?.mutations?.[d]??Vt,A)}}function b(s,d){let i=s[n],Q=new Set,D=Be(d,ke,st);for(let m of D){let p=i.provided.tags[m.type];if(!p)continue;let a=(m.id!==void 0?p[m.id]:Object.values(p).flat())??[];for(let t of a)Q.add(t)}return Array.from(Q.values()).flatMap(m=>{let p=i.queries[m];return p?{queryCacheKey:m,endpointName:p.endpointName,originalArgs:p.originalArgs}:[]})}function c(s,d){return Be(Object.values(B(s)),i=>i?.endpointName===d&&i.status!==j,i=>i.originalArgs)}function R(s,d,i){return d?We(s,d,i)!=null:!1}function I(s,d,i){return!d||!s.getPreviousPageParam?!1:yt(s,d,i)!=null}}import{formatProdErrorMessage as xn}from"@reduxjs/toolkit";var Wt=WeakMap?new WeakMap:void 0,Ze=({endpointName:e,queryArgs:n})=>{let u="",f=Wt?.get(n);if(typeof f=="string")u=f;else{let y=JSON.stringify(n,(A,g)=>(g=typeof g=="bigint"?{$bigint:g.toString()}:g,g=ie(g)?Object.keys(g).sort().reduce((B,k)=>(B[k]=g[k],B),{}):g,g));ie(n)&&Wt?.set(n,y),u=y}return`${e}(${u})`};import{weakMapMemoize as $t}from"reselect";function dt(...e){return function(u){let f=$t(S=>u.extractRehydrationInfo?.(S,{reducerPath:u.reducerPath??"api"})),y={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...u,extractRehydrationInfo:f,serializeQueryArgs(S){let x=Ze;if("serializeQueryArgs"in S.endpointDefinition){let T=S.endpointDefinition.serializeQueryArgs;x=h=>{let E=T(h);return typeof E=="string"?E:Ze({...h,queryArgs:E})}}else u.serializeQueryArgs&&(x=u.serializeQueryArgs);return x(S)},tagTypes:[...u.tagTypes||[]]},A={endpointDefinitions:{},batch(S){S()},apiUid:Le(),extractRehydrationInfo:f,hasRehydrationInfo:$t(S=>f(S)!=null)},g={injectEndpoints:k,enhanceEndpoints({addTagTypes:S,endpoints:x}){if(S)for(let T of S)y.tagTypes.includes(T)||y.tagTypes.push(T);if(x)for(let[T,h]of Object.entries(x))typeof h=="function"?h(Y(A,T)):Object.assign(Y(A,T)||{},h);return g}},B=e.map(S=>S.init(g,y,A));function k(S){let x=S.endpoints({query:T=>({...T,type:te}),mutation:T=>({...T,type:at}),infiniteQuery:T=>({...T,type:ot})});for(let[T,h]of Object.entries(x)){if(S.overrideExisting!==!0&&T in A.endpointDefinitions){if(S.overrideExisting==="throw")throw new Error(xn(39));continue}A.endpointDefinitions[T]=h;for(let E of B)E.injectEndpoint(T,h)}return g}return g.injectEndpoints({endpoints:u.endpoints})}}import{formatProdErrorMessage as Dn}from"@reduxjs/toolkit";var En=Symbol();function bn(){return function(){throw new Error(Dn(33))}}function Z(e,...n){return Object.assign(e,...n)}var Yt=({api:e,queryThunk:n,internalState:u,mwApi:f})=>{let y=`${e.reducerPath}/subscriptions`,A=null,g=null,{updateSubscriptionOptions:B,unsubscribeQueryResult:k}=e.internalActions,S=(b,c)=>{if(B.match(c)){let{queryCacheKey:I,requestId:s,options:d}=c.payload,i=b.get(I);return i?.has(s)&&i.set(s,d),!0}if(k.match(c)){let{queryCacheKey:I,requestId:s}=c.payload,d=b.get(I);return d&&d.delete(s),!0}if(e.internalActions.removeQueryResult.match(c))return b.delete(c.payload.queryCacheKey),!0;if(n.pending.match(c)){let{meta:{arg:I,requestId:s}}=c,d=ce(b,I.queryCacheKey,Me);return I.subscribe&&d.set(s,I.subscriptionOptions??d.get(s)??{}),!0}let R=!1;if(n.rejected.match(c)){let{meta:{condition:I,arg:s,requestId:d}}=c;if(I&&s.subscribe){let i=ce(b,s.queryCacheKey,Me);i.set(d,s.subscriptionOptions??i.get(d)??{}),R=!0}}return R},x=()=>u.currentSubscriptions,E={getSubscriptions:x,getSubscriptionCount:b=>x().get(b)?.size??0,isRequestSubscribed:(b,c)=>!!x()?.get(b)?.get(c)};function M(b){return JSON.parse(JSON.stringify(Object.fromEntries([...b].map(([c,R])=>[c,Object.fromEntries(R)]))))}return(b,c)=>{if(A||(A=M(u.currentSubscriptions)),e.util.resetApiState.match(b))return A={},u.currentSubscriptions.clear(),g=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(b))return[!1,E];let R=S(u.currentSubscriptions,b),I=!0;if(R){g||(g=setTimeout(()=>{let i=M(u.currentSubscriptions),[,Q]=ze(A,()=>i);c.next(e.internalActions.subscriptionsUpdated(Q)),A=i,g=null},500));let s=typeof b.type=="string"&&!!b.type.startsWith(y),d=n.rejected.match(b)&&b.meta.condition&&!!b.meta.arg.subscribe;I=!s&&!d}return[I,!1]}};var Pn=2147483647/1e3-1,Jt=({reducerPath:e,api:n,queryThunk:u,context:f,internalState:y,selectors:{selectQueryEntry:A,selectConfig:g},getRunningQueryThunk:B,mwApi:k})=>{let{removeQueryResult:S,unsubscribeQueryResult:x,cacheEntriesUpserted:T}=n.internalActions,h=de(x.match,u.fulfilled,u.rejected,T.match);function E(s){let d=y.currentSubscriptions.get(s);return d?d.size>0:!1}let M={};function b(s){for(let d of s.values())d?.abort?.()}let c=(s,d)=>{let i=d.getState(),Q=g(i);if(h(s)){let D;if(T.match(s))D=s.payload.map(m=>m.queryDescription.queryCacheKey);else{let{queryCacheKey:m}=x.match(s)?s.payload:s.meta.arg;D=[m]}R(D,d,Q)}if(n.util.resetApiState.match(s)){for(let[D,m]of Object.entries(M))m&&clearTimeout(m),delete M[D];b(y.runningQueries),b(y.runningMutations)}if(f.hasRehydrationInfo(s)){let{queries:D}=f.extractRehydrationInfo(s);R(Object.keys(D),d,Q)}};function R(s,d,i){let Q=d.getState();for(let D of s){let m=A(Q,D);m?.endpointName&&I(D,m.endpointName,d,i)}}function I(s,d,i,Q){let m=Y(f,d)?.keepUnusedDataFor??Q.keepUnusedDataFor;if(m===1/0)return;let p=Math.max(0,Math.min(m,Pn));if(!E(s)){let a=M[s];a&&clearTimeout(a),M[s]=setTimeout(()=>{if(!E(s)){let t=A(i.getState(),s);t?.endpointName&&i.dispatch(B(t.endpointName,t.originalArgs))?.abort(),i.dispatch(S({queryCacheKey:s}))}delete M[s]},p*1e3)}}return c};var Gt=new Error("Promise never resolved before cacheEntryRemoved."),Zt=({api:e,reducerPath:n,context:u,queryThunk:f,mutationThunk:y,internalState:A,selectors:{selectQueryEntry:g,selectApiState:B}})=>{let k=nt(f),S=nt(y),x=$(f,y),T={},{removeQueryResult:h,removeMutationResult:E,cacheEntriesUpserted:M}=e.internalActions;function b(i,Q,D){let m=T[i];m?.valueResolved&&(m.valueResolved({data:Q,meta:D}),delete m.valueResolved)}function c(i){let Q=T[i];Q&&(delete T[i],Q.cacheEntryRemoved())}function R(i){let{arg:Q,requestId:D}=i.meta,{endpointName:m,originalArgs:p}=Q;return[m,p,D]}let I=(i,Q,D)=>{let m=s(i);function p(a,t,r,o){let l=g(D,t),C=g(Q.getState(),t);!l&&C&&d(a,o,t,Q,r)}if(f.pending.match(i)){let[a,t,r]=R(i);p(a,m,r,t)}else if(M.match(i))for(let{queryDescription:a,value:t}of i.payload){let{endpointName:r,originalArgs:o,queryCacheKey:l}=a;p(r,l,i.meta.requestId,o),b(l,t,{})}else if(y.pending.match(i)){if(Q.getState()[n].mutations[m]){let[t,r,o]=R(i);d(t,r,m,Q,o)}}else if(x(i))b(m,i.payload,i.meta.baseQueryMeta);else if(h.match(i)||E.match(i))c(m);else if(e.util.resetApiState.match(i))for(let a of Object.keys(T))c(a)};function s(i){return k(i)?i.meta.arg.queryCacheKey:S(i)?i.meta.arg.fixedCacheKey??i.meta.requestId:h.match(i)?i.payload.queryCacheKey:E.match(i)?me(i.payload):""}function d(i,Q,D,m,p){let a=Y(u,i),t=a?.onCacheEntryAdded;if(!t)return;let r={},o=new Promise(P=>{r.cacheEntryRemoved=P}),l=Promise.race([new Promise(P=>{r.valueResolved=P}),o.then(()=>{throw Gt})]);l.catch(()=>{}),T[D]=r;let C=e.endpoints[i].select(Ee(a)?Q:D),w=m.dispatch((P,v,L)=>L),O={...m,getCacheEntry:()=>C(m.getState()),requestId:p,extra:w,updateCachedData:Ee(a)?P=>m.dispatch(e.util.updateQueryData(i,Q,P)):void 0,cacheDataLoaded:l,cacheEntryRemoved:o},F=t(Q,O);Promise.resolve(F).catch(P=>{if(P!==Gt)throw P})}return I};var Xt=({api:e,context:{apiUid:n},reducerPath:u})=>(f,y)=>{e.util.resetApiState.match(f)&&y.dispatch(e.internalActions.middlewareRegistered(n))};var en=({reducerPath:e,context:n,context:{endpointDefinitions:u},mutationThunk:f,queryThunk:y,api:A,assertTagType:g,refetchQuery:B,internalState:k})=>{let{removeQueryResult:S}=A.internalActions,x=de($(f),Ae(f)),T=de($(y,f),Re(y,f)),h=[],E=0,M=(R,I)=>{(y.pending.match(R)||f.pending.match(R))&&E++,T(R)&&(E=Math.max(0,E-1)),x(R)?c($e(R,"invalidatesTags",u,g),I):T(R)?c([],I):A.util.invalidateTags.match(R)&&c(we(R.payload,void 0,void 0,void 0,void 0,g),I)};function b(){return E>0}function c(R,I){let s=I.getState(),d=s[e];if(h.push(...R),d.config.invalidationBehavior==="delayed"&&b())return;let i=h;if(h=[],i.length===0)return;let Q=A.util.selectInvalidatedBy(s,i);n.batch(()=>{let D=Array.from(Q.values());for(let{queryCacheKey:m}of D){let p=d.queries[m],a=ce(k.currentSubscriptions,m,Me);p&&(a.size===0?I.dispatch(S({queryCacheKey:m})):p.status!==j&&I.dispatch(B(p)))}})}return M};var tn=({reducerPath:e,queryThunk:n,api:u,refetchQuery:f,internalState:y})=>{let{currentPolls:A,currentSubscriptions:g}=y,B=new Set,k=null,S=(c,R)=>{(u.internalActions.updateSubscriptionOptions.match(c)||u.internalActions.unsubscribeQueryResult.match(c))&&x(c.payload.queryCacheKey,R),(n.pending.match(c)||n.rejected.match(c)&&c.meta.condition)&&x(c.meta.arg.queryCacheKey,R),(n.fulfilled.match(c)||n.rejected.match(c)&&!c.meta.condition)&&T(c.meta.arg,R),u.util.resetApiState.match(c)&&(M(),k&&(clearTimeout(k),k=null),B.clear())};function x(c,R){B.add(c),k||(k=setTimeout(()=>{for(let I of B)h({queryCacheKey:I},R);B.clear(),k=null},0))}function T({queryCacheKey:c},R){let I=R.getState()[e],s=I.queries[c],d=g.get(c);if(!s||s.status===j)return;let{lowestPollingInterval:i,skipPollingIfUnfocused:Q}=b(d);if(!Number.isFinite(i))return;let D=A.get(c);D?.timeout&&(clearTimeout(D.timeout),D.timeout=void 0);let m=Date.now()+i;A.set(c,{nextPollTimestamp:m,pollingInterval:i,timeout:setTimeout(()=>{(I.config.focused||!Q)&&R.dispatch(f(s)),T({queryCacheKey:c},R)},i)})}function h({queryCacheKey:c},R){let s=R.getState()[e].queries[c],d=g.get(c);if(!s||s.status===j)return;let{lowestPollingInterval:i}=b(d);if(!Number.isFinite(i)){E(c);return}let Q=A.get(c),D=Date.now()+i;(!Q||D<Q.nextPollTimestamp)&&T({queryCacheKey:c},R)}function E(c){let R=A.get(c);R?.timeout&&clearTimeout(R.timeout),A.delete(c)}function M(){for(let c of A.keys())E(c)}function b(c=new Map){let R=!1,I=Number.POSITIVE_INFINITY;for(let s of c.values())s.pollingInterval&&(I=Math.min(s.pollingInterval,I),R=s.skipPollingIfUnfocused||R);return{lowestPollingInterval:I,skipPollingIfUnfocused:R}}return S};var nn=({api:e,context:n,queryThunk:u,mutationThunk:f})=>{let y=qe(u,f),A=Re(u,f),g=$(u,f),B={};return(S,x)=>{if(y(S)){let{requestId:T,arg:{endpointName:h,originalArgs:E}}=S.meta,M=Y(n,h),b=M?.onQueryStarted;if(b){let c={},R=new Promise((i,Q)=>{c.resolve=i,c.reject=Q});R.catch(()=>{}),B[T]=c;let I=e.endpoints[h].select(Ee(M)?E:T),s=x.dispatch((i,Q,D)=>D),d={...x,getCacheEntry:()=>I(x.getState()),requestId:T,extra:s,updateCachedData:Ee(M)?i=>x.dispatch(e.util.updateQueryData(h,E,i)):void 0,queryFulfilled:R};b(E,d)}}else if(g(S)){let{requestId:T,baseQueryMeta:h}=S.meta;B[T]?.resolve({data:S.payload,meta:h}),delete B[T]}else if(A(S)){let{requestId:T,rejectedWithValue:h,baseQueryMeta:E}=S.meta;B[T]?.reject({error:S.payload??S.error,isUnhandledError:!h,meta:E}),delete B[T]}}};var rn=({reducerPath:e,context:n,api:u,refetchQuery:f,internalState:y})=>{let{removeQueryResult:A}=u.internalActions,g=(k,S)=>{ae.match(k)&&B(S,"refetchOnFocus"),oe.match(k)&&B(S,"refetchOnReconnect")};function B(k,S){let x=k.getState()[e],T=x.queries,h=y.currentSubscriptions;n.batch(()=>{for(let E of h.keys()){let M=T[E],b=h.get(E);if(!b||!M)continue;let c=[...b.values()];(c.some(I=>I[S]===!0)||c.every(I=>I[S]===void 0)&&x.config[S])&&(b.size===0?k.dispatch(A({queryCacheKey:E})):M.status!==j&&k.dispatch(f(M)))}})}return g};function an(e){let{reducerPath:n,queryThunk:u,api:f,context:y,getInternalState:A}=e,{apiUid:g}=y,B={invalidateTags:ee(`${n}/invalidateTags`)},k=h=>h.type.startsWith(`${n}/`),S=[Xt,Jt,en,tn,Zt,nn];return{middleware:h=>{let E=!1,M=A(h.dispatch),b={...e,internalState:M,refetchQuery:T,isThisApiSliceAction:k,mwApi:h},c=S.map(s=>s(b)),R=Yt(b),I=rn(b);return s=>d=>{if(!Qt(d))return s(d);E||(E=!0,h.dispatch(f.internalActions.middlewareRegistered(g)));let i={...h,next:s},Q=h.getState(),[D,m]=R(d,i,Q),p;if(D?p=s(d):p=m,h.getState()[n]&&(I(d,i,Q),k(d)||y.hasRehydrationInfo(d)))for(let a of c)a(d,i,Q);return p}},actions:B};function T(h){return e.api.endpoints[h.endpointName].initiate(h.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Xe=Symbol(),ct=({createSelector:e=mt}={})=>({name:Xe,init(n,{baseQuery:u,tagTypes:f,reducerPath:y,serializeQueryArgs:A,keepUnusedDataFor:g,refetchOnMountOrArgChange:B,refetchOnFocus:k,refetchOnReconnect:S,invalidationBehavior:x,onSchemaFailure:T,catchSchemaFailure:h,skipSchemaValidation:E},M){Ot();let b=U=>U;Object.assign(n,{reducerPath:y,endpoints:{},internalActions:{onOnline:oe,onOffline:De,onFocus:ae,onFocusLost:xe},util:{}});let c=zt({serializeQueryArgs:A,reducerPath:y,createSelector:e}),{selectInvalidatedBy:R,selectCachedArgsForQuery:I,buildQuerySelector:s,buildInfiniteQuerySelector:d,buildMutationSelector:i}=c;Z(n.util,{selectInvalidatedBy:R,selectCachedArgsForQuery:I});let{queryThunk:Q,infiniteQueryThunk:D,mutationThunk:m,patchQueryData:p,updateQueryData:a,upsertQueryData:t,prefetch:r,buildMatchThunkActions:o}=Kt({baseQuery:u,reducerPath:y,context:M,api:n,serializeQueryArgs:A,assertTagType:b,selectors:c,onSchemaFailure:T,catchSchemaFailure:h,skipSchemaValidation:E}),{reducer:l,actions:C}=_t({context:M,queryThunk:Q,infiniteQueryThunk:D,mutationThunk:m,serializeQueryArgs:A,reducerPath:y,assertTagType:b,config:{refetchOnFocus:k,refetchOnReconnect:S,refetchOnMountOrArgChange:B,keepUnusedDataFor:g,reducerPath:y,invalidationBehavior:x}});Z(n.util,{patchQueryData:p,updateQueryData:a,upsertQueryData:t,prefetch:r,resetApiState:C.resetApiState,upsertQueryEntries:C.cacheEntriesUpserted}),Z(n.internalActions,C);let w=new WeakMap,O=U=>ce(w,U,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:F,buildInitiateInfiniteQuery:P,buildInitiateMutation:v,getRunningMutationThunk:L,getRunningMutationsThunk:z,getRunningQueriesThunk:J,getRunningQueryThunk:_}=Ut({queryThunk:Q,mutationThunk:m,infiniteQueryThunk:D,api:n,serializeQueryArgs:A,context:M,getInternalState:O});Z(n.util,{getRunningMutationThunk:L,getRunningMutationsThunk:z,getRunningQueryThunk:_,getRunningQueriesThunk:J});let{middleware:V,actions:H}=an({reducerPath:y,context:M,queryThunk:Q,mutationThunk:m,infiniteQueryThunk:D,api:n,assertTagType:b,selectors:c,getRunningQueryThunk:_,getInternalState:O});return Z(n.util,H),Z(n,{reducer:l,middleware:V}),{name:Xe,injectEndpoint(U,q){let K=n,N=K.endpoints[U]??={};le(q)&&Z(N,{name:U,select:s(U,q),initiate:F(U,q)},o(Q,U)),wt(q)&&Z(N,{name:U,select:i(),initiate:v(U)},o(m,U)),fe(q)&&Z(N,{name:U,select:d(U,q),initiate:P(U,q)},o(Q,U))}}}});var In=dt(ct());export{Pe as NamedSchemaError,ft as QueryStatus,En as _NEVER,dt as buildCreateApi,_e as copyWithStructuralSharing,ct as coreModule,Xe as coreModuleName,In as createApi,Ze as defaultSerializeQueryArgs,bn as fakeBaseQuery,ln as fetchBaseQuery,gn as retry,Rn as setupListeners,Ge as skipToken};
+//# sourceMappingURL=rtk-query.browser.mjs.map
Index: node_modules/@reduxjs/toolkit/dist/query/rtk-query.browser.mjs.map
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/rtk-query.browser.mjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/rtk-query.browser.mjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,1 @@
+{"version":3,"sources":["../../src/query/core/apiState.ts","../../src/query/core/rtkImports.ts","../../src/query/utils/copyWithStructuralSharing.ts","../../src/query/utils/filterMap.ts","../../src/query/utils/isAbsoluteUrl.ts","../../src/query/utils/isDocumentVisible.ts","../../src/query/utils/isNotNullish.ts","../../src/query/utils/isOnline.ts","../../src/query/utils/joinUrls.ts","../../src/query/utils/getOrInsert.ts","../../src/query/utils/signals.ts","../../src/query/fetchBaseQuery.ts","../../src/query/HandledError.ts","../../src/query/retry.ts","../../src/query/core/setupListeners.ts","../../src/query/endpointDefinitions.ts","../../src/query/utils/immerImports.ts","../../src/query/core/buildInitiate.ts","../../src/tsHelpers.ts","../../src/query/apiTypes.ts","../../src/query/standardSchema.ts","../../src/query/core/buildThunks.ts","../../src/query/utils/getCurrent.ts","../../src/query/core/buildSlice.ts","../../src/query/core/buildSelectors.ts","../../src/query/createApi.ts","../../src/query/defaultSerializeQueryArgs.ts","../../src/query/fakeBaseQuery.ts","../../src/query/tsHelpers.ts","../../src/query/core/buildMiddleware/batchActions.ts","../../src/query/core/buildMiddleware/cacheCollection.ts","../../src/query/core/buildMiddleware/cacheLifecycle.ts","../../src/query/core/buildMiddleware/devMiddleware.ts","../../src/query/core/buildMiddleware/invalidationByTags.ts","../../src/query/core/buildMiddleware/polling.ts","../../src/query/core/buildMiddleware/queryLifecycle.ts","../../src/query/core/buildMiddleware/windowEventHandling.ts","../../src/query/core/buildMiddleware/index.ts","../../src/query/core/module.ts","../../src/query/core/index.ts"],"sourcesContent":["import type { SerializedError } from '@reduxjs/toolkit';\nimport type { BaseQueryError } from '../baseQueryTypes';\nimport type { BaseEndpointDefinition, EndpointDefinitions, FullTagDescription, InfiniteQueryDefinition, MutationDefinition, PageParamFrom, QueryArgFromAnyQuery, QueryDefinition, ResultTypeFrom } from '../endpointDefinitions';\nimport type { Id, WithRequiredProp } from '../tsHelpers';\nexport type QueryCacheKey = string & {\n  _type: 'queryCacheKey';\n};\nexport type QuerySubstateIdentifier = {\n  queryCacheKey: QueryCacheKey;\n};\nexport type MutationSubstateIdentifier = {\n  requestId: string;\n  fixedCacheKey?: string;\n} | {\n  requestId?: string;\n  fixedCacheKey: string;\n};\nexport type RefetchConfigOptions = {\n  refetchOnMountOrArgChange: boolean | number;\n  refetchOnReconnect: boolean;\n  refetchOnFocus: boolean;\n};\nexport type InfiniteQueryConfigOptions<DataType, PageParam, QueryArg> = {\n  /**\n   * The initial page parameter to use for the first page fetch.\n   */\n  initialPageParam: PageParam;\n  /**\n   * This function is required to automatically get the next cursor for infinite queries.\n   * The result will also be used to determine the value of `hasNextPage`.\n   */\n  getNextPageParam: (lastPage: DataType, allPages: Array<DataType>, lastPageParam: PageParam, allPageParams: Array<PageParam>, queryArg: QueryArg) => PageParam | undefined | null;\n  /**\n   * This function can be set to automatically get the previous cursor for infinite queries.\n   * The result will also be used to determine the value of `hasPreviousPage`.\n   */\n  getPreviousPageParam?: (firstPage: DataType, allPages: Array<DataType>, firstPageParam: PageParam, allPageParams: Array<PageParam>, queryArg: QueryArg) => PageParam | undefined | null;\n  /**\n   * If specified, only keep this many pages in cache at once.\n   * If additional pages are fetched, older pages in the other\n   * direction will be dropped from the cache.\n   */\n  maxPages?: number;\n  /**\n   * Defaults to `true`. When this is `true` and an infinite query endpoint is refetched\n   * (due to tag invalidation, polling, arg change configuration, or manual refetching),\n   * RTK Query will try to sequentially refetch all pages currently in the cache.\n   * When `false` only the first page will be refetched.\n   */\n  refetchCachedPages?: boolean;\n};\nexport type InfiniteData<DataType, PageParam> = {\n  pages: Array<DataType>;\n  pageParams: Array<PageParam>;\n};\n\n// NOTE: DO NOT import and use this for runtime comparisons internally,\n// except in the RTKQ React package. Use the string versions just below this.\n// ESBuild auto-inlines TS enums, which bloats our bundle with many repeated\n// constants like \"initialized\":\n// https://github.com/evanw/esbuild/releases/tag/v0.14.7\n// We still have to use this in the React package since we don't publicly export\n// the string constants below.\n/**\n * Strings describing the query state at any given time.\n */\nexport enum QueryStatus {\n  uninitialized = 'uninitialized',\n  pending = 'pending',\n  fulfilled = 'fulfilled',\n  rejected = 'rejected',\n}\n\n// Use these string constants for runtime comparisons internally\nexport const STATUS_UNINITIALIZED = QueryStatus.uninitialized;\nexport const STATUS_PENDING = QueryStatus.pending;\nexport const STATUS_FULFILLED = QueryStatus.fulfilled;\nexport const STATUS_REJECTED = QueryStatus.rejected;\nexport type RequestStatusFlags = {\n  status: QueryStatus.uninitialized;\n  isUninitialized: true;\n  isLoading: false;\n  isSuccess: false;\n  isError: false;\n} | {\n  status: QueryStatus.pending;\n  isUninitialized: false;\n  isLoading: true;\n  isSuccess: false;\n  isError: false;\n} | {\n  status: QueryStatus.fulfilled;\n  isUninitialized: false;\n  isLoading: false;\n  isSuccess: true;\n  isError: false;\n} | {\n  status: QueryStatus.rejected;\n  isUninitialized: false;\n  isLoading: false;\n  isSuccess: false;\n  isError: true;\n};\nexport function getRequestStatusFlags(status: QueryStatus): RequestStatusFlags {\n  return {\n    status,\n    isUninitialized: status === STATUS_UNINITIALIZED,\n    isLoading: status === STATUS_PENDING,\n    isSuccess: status === STATUS_FULFILLED,\n    isError: status === STATUS_REJECTED\n  } as any;\n}\n\n/**\n * @public\n */\nexport type SubscriptionOptions = {\n  /**\n   * How frequently to automatically re-fetch data (in milliseconds). Defaults to `0` (off).\n   */\n  pollingInterval?: number;\n  /**\n   *  Defaults to 'false'. This setting allows you to control whether RTK Query will continue polling if the window is not focused.\n   *\n   *  If pollingInterval is not set or set to 0, this **will not be evaluated** until pollingInterval is greater than 0.\n   *\n   *  Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  skipPollingIfUnfocused?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after regaining a network connection.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnReconnect?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after the application window regains focus.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnFocus?: boolean;\n};\nexport type SubscribersInternal = Map<string, SubscriptionOptions>;\nexport type Subscribers = {\n  [requestId: string]: SubscriptionOptions;\n};\nexport type QueryKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any> ? K : never }[keyof Definitions];\nexport type InfiniteQueryKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? K : never }[keyof Definitions];\nexport type MutationKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends MutationDefinition<any, any, any, any> ? K : never }[keyof Definitions];\ntype BaseQuerySubState<D extends BaseEndpointDefinition<any, any, any, any>, DataType = ResultTypeFrom<D>> = {\n  /**\n   * The argument originally passed into the hook or `initiate` action call\n   */\n  originalArgs: QueryArgFromAnyQuery<D>;\n  /**\n   * A unique ID associated with the request\n   */\n  requestId: string;\n  /**\n   * The received data from the query\n   */\n  data?: DataType;\n  /**\n   * The received error if applicable\n   */\n  error?: SerializedError | (D extends QueryDefinition<any, infer BaseQuery, any, any> ? BaseQueryError<BaseQuery> : never);\n  /**\n   * The name of the endpoint associated with the query\n   */\n  endpointName: string;\n  /**\n   * Time that the latest query started\n   */\n  startedTimeStamp: number;\n  /**\n   * Time that the latest query was fulfilled\n   */\n  fulfilledTimeStamp?: number;\n};\nexport type QuerySubState<D extends BaseEndpointDefinition<any, any, any, any>, DataType = ResultTypeFrom<D>> = Id<({\n  status: QueryStatus.fulfilled;\n} & WithRequiredProp<BaseQuerySubState<D, DataType>, 'data' | 'fulfilledTimeStamp'> & {\n  error: undefined;\n}) | ({\n  status: QueryStatus.pending;\n} & BaseQuerySubState<D, DataType>) | ({\n  status: QueryStatus.rejected;\n} & WithRequiredProp<BaseQuerySubState<D, DataType>, 'error'>) | {\n  status: QueryStatus.uninitialized;\n  originalArgs?: undefined;\n  data?: undefined;\n  error?: undefined;\n  requestId?: undefined;\n  endpointName?: string;\n  startedTimeStamp?: undefined;\n  fulfilledTimeStamp?: undefined;\n}>;\nexport type InfiniteQueryDirection = 'forward' | 'backward';\nexport type InfiniteQuerySubState<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any> ? QuerySubState<D, InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>> & {\n  direction?: InfiniteQueryDirection;\n} : never;\ntype BaseMutationSubState<D extends BaseEndpointDefinition<any, any, any, any>> = {\n  requestId: string;\n  data?: ResultTypeFrom<D>;\n  error?: SerializedError | (D extends MutationDefinition<any, infer BaseQuery, any, any> ? BaseQueryError<BaseQuery> : never);\n  endpointName: string;\n  startedTimeStamp: number;\n  fulfilledTimeStamp?: number;\n};\nexport type MutationSubState<D extends BaseEndpointDefinition<any, any, any, any>> = (({\n  status: QueryStatus.fulfilled;\n} & WithRequiredProp<BaseMutationSubState<D>, 'data' | 'fulfilledTimeStamp'>) & {\n  error: undefined;\n}) | (({\n  status: QueryStatus.pending;\n} & BaseMutationSubState<D>) & {\n  data?: undefined;\n}) | ({\n  status: QueryStatus.rejected;\n} & WithRequiredProp<BaseMutationSubState<D>, 'error'>) | {\n  requestId?: undefined;\n  status: QueryStatus.uninitialized;\n  data?: undefined;\n  error?: undefined;\n  endpointName?: string;\n  startedTimeStamp?: undefined;\n  fulfilledTimeStamp?: undefined;\n};\nexport type CombinedState<D extends EndpointDefinitions, E extends string, ReducerPath extends string> = {\n  queries: QueryState<D>;\n  mutations: MutationState<D>;\n  provided: InvalidationState<E>;\n  subscriptions: SubscriptionState;\n  config: ConfigState<ReducerPath>;\n};\nexport type InvalidationState<TagTypes extends string> = {\n  tags: { [_ in TagTypes]: {\n    [id: string]: Array<QueryCacheKey>;\n    [id: number]: Array<QueryCacheKey>;\n  } };\n  keys: Record<QueryCacheKey, Array<FullTagDescription<any>>>;\n};\nexport type QueryState<D extends EndpointDefinitions> = {\n  [queryCacheKey: string]: QuerySubState<D[string]> | InfiniteQuerySubState<D[string]> | undefined;\n};\nexport type SubscriptionInternalState = Map<string, SubscribersInternal>;\nexport type SubscriptionState = {\n  [queryCacheKey: string]: Subscribers | undefined;\n};\nexport type ConfigState<ReducerPath> = RefetchConfigOptions & {\n  reducerPath: ReducerPath;\n  online: boolean;\n  focused: boolean;\n  middlewareRegistered: boolean | 'conflict';\n} & ModifiableConfigState;\nexport type ModifiableConfigState = {\n  keepUnusedDataFor: number;\n  invalidationBehavior: 'delayed' | 'immediately';\n} & RefetchConfigOptions;\nexport type MutationState<D extends EndpointDefinitions> = {\n  [requestId: string]: MutationSubState<D[string]> | undefined;\n};\nexport type RootState<Definitions extends EndpointDefinitions, TagTypes extends string, ReducerPath extends string> = { [P in ReducerPath]: CombinedState<Definitions, TagTypes, P> };","// This file exists to consolidate all of the imports from the `@reduxjs/toolkit` package.\n// ESBuild does not de-duplicate imports, so this file is used to ensure that each method\n// imported is only listed once, and there's only one mention of the `@reduxjs/toolkit` package.\n\nexport { createAction, createSlice, createSelector, createAsyncThunk, combineReducers, createNextState, isAnyOf, isAllOf, isAction, isPending, isRejected, isFulfilled, isRejectedWithValue, isAsyncThunkAction, prepareAutoBatched, SHOULD_AUTOBATCH, isPlainObject, nanoid } from '@reduxjs/toolkit';","import { isPlainObject as _iPO } from '../core/rtkImports';\n\n// remove type guard\nconst isPlainObject: (_: any) => boolean = _iPO;\nexport function copyWithStructuralSharing<T>(oldObj: any, newObj: T): T;\nexport function copyWithStructuralSharing(oldObj: any, newObj: any): any {\n  if (oldObj === newObj || !(isPlainObject(oldObj) && isPlainObject(newObj) || Array.isArray(oldObj) && Array.isArray(newObj))) {\n    return newObj;\n  }\n  const newKeys = Object.keys(newObj);\n  const oldKeys = Object.keys(oldObj);\n  let isSameObject = newKeys.length === oldKeys.length;\n  const mergeObj: any = Array.isArray(newObj) ? [] : {};\n  for (const key of newKeys) {\n    mergeObj[key] = copyWithStructuralSharing(oldObj[key], newObj[key]);\n    if (isSameObject) isSameObject = oldObj[key] === mergeObj[key];\n  }\n  return isSameObject ? oldObj : mergeObj;\n}","// Preserve type guard predicate behavior when passing to mapper\nexport function filterMap<T, U, S extends T = T>(array: readonly T[], predicate: (item: T, index: number) => item is S, mapper: (item: S, index: number) => U | U[]): U[];\nexport function filterMap<T, U>(array: readonly T[], predicate: (item: T, index: number) => boolean, mapper: (item: T, index: number) => U | U[]): U[];\nexport function filterMap<T, U>(array: readonly T[], predicate: (item: T, index: number) => boolean, mapper: (item: T, index: number) => U | U[]): U[] {\n  return array.reduce<(U | U[])[]>((acc, item, i) => {\n    if (predicate(item as any, i)) {\n      acc.push(mapper(item as any, i));\n    }\n    return acc;\n  }, []).flat() as U[];\n}","/**\n * If either :// or // is present consider it to be an absolute url\n *\n * @param url string\n */\n\nexport function isAbsoluteUrl(url: string) {\n  return new RegExp(`(^|:)//`).test(url);\n}","/**\n * Assumes true for a non-browser env, otherwise makes a best effort\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState\n */\nexport function isDocumentVisible(): boolean {\n  // `document` may not exist in non-browser envs (like RN)\n  if (typeof document === 'undefined') {\n    return true;\n  }\n  // Match true for visible, prerender, undefined\n  return document.visibilityState !== 'hidden';\n}","export function isNotNullish<T>(v: T | null | undefined): v is T {\n  return v != null;\n}\nexport function filterNullishValues<T>(map?: Map<any, T>) {\n  return [...(map?.values() ?? [])].filter(isNotNullish) as NonNullable<T>[];\n}","/**\n * Assumes a browser is online if `undefined`, otherwise makes a best effort\n * @link https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine\n */\nexport function isOnline() {\n  // We set the default config value in the store, so we'd need to check for this in a SSR env\n  return typeof navigator === 'undefined' ? true : navigator.onLine === undefined ? true : navigator.onLine;\n}","import { isAbsoluteUrl } from './isAbsoluteUrl';\nconst withoutTrailingSlash = (url: string) => url.replace(/\\/$/, '');\nconst withoutLeadingSlash = (url: string) => url.replace(/^\\//, '');\nexport function joinUrls(base: string | undefined, url: string | undefined): string {\n  if (!base) {\n    return url!;\n  }\n  if (!url) {\n    return base;\n  }\n  if (isAbsoluteUrl(url)) {\n    return url;\n  }\n  const delimiter = base.endsWith('/') || !url.startsWith('?') ? '/' : '';\n  base = withoutTrailingSlash(base);\n  url = withoutLeadingSlash(url);\n  return `${base}${delimiter}${url}`;\n}","// Duplicate some of the utils in `/src/utils` to ensure\n// we don't end up dragging in larger chunks of the RTK core\n// into the RTKQ bundle\n\nexport function getOrInsert<K extends object, V>(map: WeakMap<K, V>, key: K, value: V): V;\nexport function getOrInsert<K, V>(map: Map<K, V>, key: K, value: V): V;\nexport function getOrInsert<K extends object, V>(map: Map<K, V> | WeakMap<K, V>, key: K, value: V): V {\n  if (map.has(key)) return map.get(key) as V;\n  return map.set(key, value).get(key) as V;\n}\nexport function getOrInsertComputed<K extends object, V>(map: WeakMap<K, V>, key: K, compute: (key: K) => V): V;\nexport function getOrInsertComputed<K, V>(map: Map<K, V>, key: K, compute: (key: K) => V): V;\nexport function getOrInsertComputed<K extends object, V>(map: Map<K, V> | WeakMap<K, V>, key: K, compute: (key: K) => V): V {\n  if (map.has(key)) return map.get(key) as V;\n  return map.set(key, compute(key)).get(key) as V;\n}\nexport const createNewMap = () => new Map();","// AbortSignal.timeout() is currently baseline 2024\nexport const timeoutSignal = (milliseconds: number) => {\n  const abortController = new AbortController();\n  setTimeout(() => {\n    const message = 'signal timed out';\n    const name = 'TimeoutError';\n    abortController.abort(\n    // some environments (React Native, Node) don't have DOMException\n    typeof DOMException !== 'undefined' ? new DOMException(message, name) : Object.assign(new Error(message), {\n      name\n    }));\n  }, milliseconds);\n  return abortController.signal;\n};\n\n// AbortSignal.any() is currently baseline 2024\nexport const anySignal = (...signals: AbortSignal[]) => {\n  // if any are already aborted, return an already aborted signal\n  for (const signal of signals) if (signal.aborted) return AbortSignal.abort(signal.reason);\n\n  // otherwise, create a new signal that aborts when any of the given signals abort\n  const abortController = new AbortController();\n  for (const signal of signals) {\n    signal.addEventListener('abort', () => abortController.abort(signal.reason), {\n      signal: abortController.signal,\n      once: true\n    });\n  }\n  return abortController.signal;\n};","import { joinUrls } from './utils';\nimport { isPlainObject } from './core/rtkImports';\nimport type { BaseQueryApi, BaseQueryFn } from './baseQueryTypes';\nimport type { MaybePromise, Override } from './tsHelpers';\nimport { anySignal, timeoutSignal } from './utils/signals';\nexport type ResponseHandler = 'content-type' | 'json' | 'text' | ((response: Response) => Promise<any>);\ntype CustomRequestInit = Override<RequestInit, {\n  headers?: Headers | string[][] | Record<string, string | undefined> | undefined;\n}>;\nexport interface FetchArgs extends CustomRequestInit {\n  url: string;\n  params?: Record<string, any>;\n  body?: any;\n  responseHandler?: ResponseHandler;\n  validateStatus?: (response: Response, body: any) => boolean;\n  /**\n   * A number in milliseconds that represents that maximum time a request can take before timing out.\n   */\n  timeout?: number;\n}\n\n/**\n * A mini-wrapper that passes arguments straight through to\n * {@link [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)}.\n * Avoids storing `fetch` in a closure, in order to permit mocking/monkey-patching.\n */\nconst defaultFetchFn: typeof fetch = (...args) => fetch(...args);\nconst defaultValidateStatus = (response: Response) => response.status >= 200 && response.status <= 299;\nconst defaultIsJsonContentType = (headers: Headers) => /*applicat*//ion\\/(vnd\\.api\\+)?json/.test(headers.get('content-type') || '');\nexport type FetchBaseQueryError = {\n  /**\n   * * `number`:\n   *   HTTP status code\n   */\n  status: number;\n  data: unknown;\n} | {\n  /**\n   * * `\"FETCH_ERROR\"`:\n   *   An error that occurred during execution of `fetch` or the `fetchFn` callback option\n   **/\n  status: 'FETCH_ERROR';\n  data?: undefined;\n  error: string;\n} | {\n  /**\n   * * `\"PARSING_ERROR\"`:\n   *   An error happened during parsing.\n   *   Most likely a non-JSON-response was returned with the default `responseHandler` \"JSON\",\n   *   or an error occurred while executing a custom `responseHandler`.\n   **/\n  status: 'PARSING_ERROR';\n  originalStatus: number;\n  data: string;\n  error: string;\n} | {\n  /**\n   * * `\"TIMEOUT_ERROR\"`:\n   *   Request timed out\n   **/\n  status: 'TIMEOUT_ERROR';\n  data?: undefined;\n  error: string;\n} | {\n  /**\n   * * `\"CUSTOM_ERROR\"`:\n   *   A custom error type that you can return from your `queryFn` where another error might not make sense.\n   **/\n  status: 'CUSTOM_ERROR';\n  data?: unknown;\n  error: string;\n};\nfunction stripUndefined(obj: any) {\n  if (!isPlainObject(obj)) {\n    return obj;\n  }\n  const copy: Record<string, any> = {\n    ...obj\n  };\n  for (const [k, v] of Object.entries(copy)) {\n    if (v === undefined) delete copy[k];\n  }\n  return copy;\n}\n\n// Only set the content-type to json if appropriate. Will not be true for FormData, ArrayBuffer, Blob, etc.\nconst isJsonifiable = (body: any) => typeof body === 'object' && (isPlainObject(body) || Array.isArray(body) || typeof body.toJSON === 'function');\nexport type FetchBaseQueryArgs = {\n  baseUrl?: string;\n  prepareHeaders?: (headers: Headers, api: Pick<BaseQueryApi, 'getState' | 'extra' | 'endpoint' | 'type' | 'forced'> & {\n    arg: string | FetchArgs;\n    extraOptions: unknown;\n  }) => MaybePromise<Headers | void>;\n  fetchFn?: (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;\n  paramsSerializer?: (params: Record<string, any>) => string;\n  /**\n   * By default, we only check for 'application/json' and 'application/vnd.api+json' as the content-types for json. If you need to support another format, you can pass\n   * in a predicate function for your given api to get the same automatic stringifying behavior\n   * @example\n   * ```ts\n   * const isJsonContentType = (headers: Headers) => [\"application/vnd.api+json\", \"application/json\", \"application/vnd.hal+json\"].includes(headers.get(\"content-type\")?.trim());\n   * ```\n   */\n  isJsonContentType?: (headers: Headers) => boolean;\n  /**\n   * Defaults to `application/json`;\n   */\n  jsonContentType?: string;\n\n  /**\n   * Custom replacer function used when calling `JSON.stringify()`;\n   */\n  jsonReplacer?: (this: any, key: string, value: any) => any;\n} & RequestInit & Pick<FetchArgs, 'responseHandler' | 'validateStatus' | 'timeout'>;\nexport type FetchBaseQueryMeta = {\n  request: Request;\n  response?: Response;\n};\n\n/**\n * This is a very small wrapper around fetch that aims to simplify requests.\n *\n * @example\n * ```ts\n * const baseQuery = fetchBaseQuery({\n *   baseUrl: 'https://api.your-really-great-app.com/v1/',\n *   prepareHeaders: (headers, { getState }) => {\n *     const token = (getState() as RootState).auth.token;\n *     // If we have a token set in state, let's assume that we should be passing it.\n *     if (token) {\n *       headers.set('authorization', `Bearer ${token}`);\n *     }\n *     return headers;\n *   },\n * })\n * ```\n *\n * @param {string} baseUrl\n * The base URL for an API service.\n * Typically in the format of https://example.com/\n *\n * @param {(headers: Headers, api: { getState: () => unknown; arg: string | FetchArgs; extra: unknown; endpoint: string; type: 'query' | 'mutation'; forced: boolean; }) => Headers} prepareHeaders\n * An optional function that can be used to inject headers on requests.\n * Provides a Headers object, most of the `BaseQueryApi` (`dispatch` is not available), and the arg passed into the query function.\n * Useful for setting authentication or headers that need to be set conditionally.\n *\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Headers\n *\n * @param {(input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>} fetchFn\n * Accepts a custom `fetch` function if you do not want to use the default on the window.\n * Useful in SSR environments if you need to use a library such as `isomorphic-fetch` or `cross-fetch`\n *\n * @param {(params: Record<string, unknown>) => string} paramsSerializer\n * An optional function that can be used to stringify querystring parameters.\n *\n * @param {(headers: Headers) => boolean} isJsonContentType\n * An optional predicate function to determine if `JSON.stringify()` should be called on the `body` arg of `FetchArgs`\n *\n * @param {string} jsonContentType Used when automatically setting the content-type header for a request with a jsonifiable body that does not have an explicit content-type header. Defaults to `application/json`.\n *\n * @param {(this: any, key: string, value: any) => any} jsonReplacer Custom replacer function used when calling `JSON.stringify()`.\n *\n * @param {number} timeout\n * A number in milliseconds that represents the maximum time a request can take before timing out.\n */\n\nexport function fetchBaseQuery({\n  baseUrl,\n  prepareHeaders = x => x,\n  fetchFn = defaultFetchFn,\n  paramsSerializer,\n  isJsonContentType = defaultIsJsonContentType,\n  jsonContentType = 'application/json',\n  jsonReplacer,\n  timeout: defaultTimeout,\n  responseHandler: globalResponseHandler,\n  validateStatus: globalValidateStatus,\n  ...baseFetchOptions\n}: FetchBaseQueryArgs = {}): BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta> {\n  if (typeof fetch === 'undefined' && fetchFn === defaultFetchFn) {\n    console.warn('Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments.');\n  }\n  return async (arg, api, extraOptions) => {\n    const {\n      getState,\n      extra,\n      endpoint,\n      forced,\n      type\n    } = api;\n    let meta: FetchBaseQueryMeta | undefined;\n    let {\n      url,\n      headers = new Headers(baseFetchOptions.headers),\n      params = undefined,\n      responseHandler = globalResponseHandler ?? 'json' as const,\n      validateStatus = globalValidateStatus ?? defaultValidateStatus,\n      timeout = defaultTimeout,\n      ...rest\n    } = typeof arg == 'string' ? {\n      url: arg\n    } : arg;\n    let config: RequestInit = {\n      ...baseFetchOptions,\n      signal: timeout ? anySignal(api.signal, timeoutSignal(timeout)) : api.signal,\n      ...rest\n    };\n    headers = new Headers(stripUndefined(headers));\n    config.headers = (await prepareHeaders(headers, {\n      getState,\n      arg,\n      extra,\n      endpoint,\n      forced,\n      type,\n      extraOptions\n    })) || headers;\n    const bodyIsJsonifiable = isJsonifiable(config.body);\n\n    // Remove content-type for non-jsonifiable bodies to let the browser set it automatically\n    // Exception: keep content-type for string bodies as they might be intentional (text/plain, text/html, etc.)\n    if (config.body != null && !bodyIsJsonifiable && typeof config.body !== 'string') {\n      config.headers.delete('content-type');\n    }\n    if (!config.headers.has('content-type') && bodyIsJsonifiable) {\n      config.headers.set('content-type', jsonContentType);\n    }\n    if (bodyIsJsonifiable && isJsonContentType(config.headers)) {\n      config.body = JSON.stringify(config.body, jsonReplacer);\n    }\n\n    // Set Accept header based on responseHandler if not already set\n    if (!config.headers.has('accept')) {\n      if (responseHandler === 'json') {\n        config.headers.set('accept', 'application/json');\n      } else if (responseHandler === 'text') {\n        config.headers.set('accept', 'text/plain, text/html, */*');\n      }\n      // For 'content-type' responseHandler, don't set Accept (let server decide)\n    }\n    if (params) {\n      const divider = ~url.indexOf('?') ? '&' : '?';\n      const query = paramsSerializer ? paramsSerializer(params) : new URLSearchParams(stripUndefined(params));\n      url += divider + query;\n    }\n    url = joinUrls(baseUrl, url);\n    const request = new Request(url, config);\n    const requestClone = new Request(url, config);\n    meta = {\n      request: requestClone\n    };\n    let response;\n    try {\n      response = await fetchFn(request);\n    } catch (e) {\n      return {\n        error: {\n          status: (e instanceof Error || typeof DOMException !== 'undefined' && e instanceof DOMException) && e.name === 'TimeoutError' ? 'TIMEOUT_ERROR' : 'FETCH_ERROR',\n          error: String(e)\n        },\n        meta\n      };\n    }\n    const responseClone = response.clone();\n    meta.response = responseClone;\n    let resultData: any;\n    let responseText: string = '';\n    try {\n      let handleResponseError;\n      await Promise.all([handleResponse(response, responseHandler).then(r => resultData = r, e => handleResponseError = e),\n      // see https://github.com/node-fetch/node-fetch/issues/665#issuecomment-538995182\n      // we *have* to \"use up\" both streams at the same time or they will stop running in node-fetch scenarios\n      responseClone.text().then(r => responseText = r, () => {})]);\n      if (handleResponseError) throw handleResponseError;\n    } catch (e) {\n      return {\n        error: {\n          status: 'PARSING_ERROR',\n          originalStatus: response.status,\n          data: responseText,\n          error: String(e)\n        },\n        meta\n      };\n    }\n    return validateStatus(response, resultData) ? {\n      data: resultData,\n      meta\n    } : {\n      error: {\n        status: response.status,\n        data: resultData\n      },\n      meta\n    };\n  };\n  async function handleResponse(response: Response, responseHandler: ResponseHandler) {\n    if (typeof responseHandler === 'function') {\n      return responseHandler(response);\n    }\n    if (responseHandler === 'content-type') {\n      responseHandler = isJsonContentType(response.headers) ? 'json' : 'text';\n    }\n    if (responseHandler === 'json') {\n      const text = await response.text();\n      return text.length ? JSON.parse(text) : null;\n    }\n    return response.text();\n  }\n}","export class HandledError {\n  constructor(public readonly value: any, public readonly meta: any = undefined) {}\n}","import type { BaseQueryApi, BaseQueryArg, BaseQueryEnhancer, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta } from './baseQueryTypes';\nimport type { FetchBaseQueryError } from './fetchBaseQuery';\nimport { HandledError } from './HandledError';\n\n/**\n * Exponential backoff based on the attempt number.\n *\n * @remarks\n * 1. 600ms * random(0.4, 1.4)\n * 2. 1200ms * random(0.4, 1.4)\n * 3. 2400ms * random(0.4, 1.4)\n * 4. 4800ms * random(0.4, 1.4)\n * 5. 9600ms * random(0.4, 1.4)\n *\n * @param attempt - Current attempt\n * @param maxRetries - Maximum number of retries\n */\nasync function defaultBackoff(attempt: number = 0, maxRetries: number = 5, signal?: AbortSignal) {\n  const attempts = Math.min(attempt, maxRetries);\n  const timeout = ~~((Math.random() + 0.4) * (300 << attempts)); // Force a positive int in the case we make this an option\n\n  await new Promise<void>((resolve, reject) => {\n    const timeoutId = setTimeout(() => resolve(), timeout);\n\n    // If signal is provided and gets aborted, clear timeout and reject\n    if (signal) {\n      const abortHandler = () => {\n        clearTimeout(timeoutId);\n        reject(new Error('Aborted'));\n      };\n\n      // Check if already aborted\n      if (signal.aborted) {\n        clearTimeout(timeoutId);\n        reject(new Error('Aborted'));\n      } else {\n        signal.addEventListener('abort', abortHandler, {\n          once: true\n        });\n      }\n    }\n  });\n}\ntype RetryConditionFunction = (error: BaseQueryError<BaseQueryFn>, args: BaseQueryArg<BaseQueryFn>, extraArgs: {\n  attempt: number;\n  baseQueryApi: BaseQueryApi;\n  extraOptions: BaseQueryExtraOptions<BaseQueryFn> & RetryOptions;\n}) => boolean;\nexport type RetryOptions = {\n  /**\n   * Function used to determine delay between retries\n   */\n  backoff?: (attempt: number, maxRetries: number, signal?: AbortSignal) => Promise<void>;\n} & ({\n  /**\n   * How many times the query will be retried (default: 5)\n   */\n  maxRetries?: number;\n  retryCondition?: undefined;\n} | {\n  /**\n   * Callback to determine if a retry should be attempted.\n   * Return `true` for another retry and `false` to quit trying prematurely.\n   */\n  retryCondition?: RetryConditionFunction;\n  maxRetries?: undefined;\n});\nfunction fail<BaseQuery extends BaseQueryFn = BaseQueryFn>(error: BaseQueryError<BaseQuery>, meta?: BaseQueryMeta<BaseQuery>): never {\n  throw Object.assign(new HandledError({\n    error,\n    meta\n  }), {\n    throwImmediately: true\n  });\n}\n\n/**\n * Checks if the abort signal is aborted and fails immediately if so.\n * Used to exit retry loops cleanly when a request is aborted.\n */\nfunction failIfAborted(signal: AbortSignal): void {\n  if (signal.aborted) {\n    fail({\n      status: 'CUSTOM_ERROR',\n      error: 'Aborted'\n    });\n  }\n}\nconst EMPTY_OPTIONS = {};\nconst retryWithBackoff: BaseQueryEnhancer<unknown, RetryOptions, RetryOptions | void> = (baseQuery, defaultOptions) => async (args, api, extraOptions) => {\n  // We need to figure out `maxRetries` before we define `defaultRetryCondition.\n  // This is probably goofy, but ought to work.\n  // Put our defaults in one array, filter out undefineds, grab the last value.\n  const possibleMaxRetries: number[] = [5, (defaultOptions as any || EMPTY_OPTIONS).maxRetries, (extraOptions as any || EMPTY_OPTIONS).maxRetries].filter(x => x !== undefined);\n  const [maxRetries] = possibleMaxRetries.slice(-1);\n  const defaultRetryCondition: RetryConditionFunction = (_, __, {\n    attempt\n  }) => attempt <= maxRetries;\n  const options: {\n    maxRetries: number;\n    backoff: typeof defaultBackoff;\n    retryCondition: typeof defaultRetryCondition;\n  } = {\n    maxRetries,\n    backoff: defaultBackoff,\n    retryCondition: defaultRetryCondition,\n    ...defaultOptions,\n    ...extraOptions\n  };\n  let retry = 0;\n  while (true) {\n    // Check if aborted before each attempt\n    failIfAborted(api.signal);\n    try {\n      const result = await baseQuery(args, api, extraOptions);\n      // baseQueries _should_ return an error property, so we should check for that and throw it to continue retrying\n      if (result.error) {\n        throw new HandledError(result);\n      }\n      return result;\n    } catch (e: any) {\n      retry++;\n      if (e.throwImmediately) {\n        if (e instanceof HandledError) {\n          return e.value;\n        }\n\n        // We don't know what this is, so we have to rethrow it\n        throw e;\n      }\n      if (e instanceof HandledError) {\n        if (!options.retryCondition(e.value.error as FetchBaseQueryError, args, {\n          attempt: retry,\n          baseQueryApi: api,\n          extraOptions\n        })) {\n          return e.value; // Max retries for expected error\n        }\n      } else {\n        // For unexpected errors, respect maxRetries\n        if (retry > options.maxRetries) {\n          // Return the error as a proper error response instead of throwing\n          return {\n            error: e\n          };\n        }\n      }\n\n      // Check if aborted before backoff\n      failIfAborted(api.signal);\n      try {\n        await options.backoff(retry, options.maxRetries, api.signal);\n      } catch (backoffError) {\n        // If backoff was aborted, exit the retry loop\n        failIfAborted(api.signal);\n        // Otherwise, rethrow the backoff error\n        throw backoffError;\n      }\n    }\n  }\n};\n\n/**\n * A utility that can wrap `baseQuery` in the API definition to provide retries with a basic exponential backoff.\n *\n * @example\n *\n * ```ts\n * // codeblock-meta title=\"Retry every request 5 times by default\"\n * import { createApi, fetchBaseQuery, retry } from '@reduxjs/toolkit/query/react'\n * interface Post {\n *   id: number\n *   name: string\n * }\n * type PostsResponse = Post[]\n *\n * // maxRetries: 5 is the default, and can be omitted. Shown for documentation purposes.\n * const staggeredBaseQuery = retry(fetchBaseQuery({ baseUrl: '/' }), { maxRetries: 5 });\n * export const api = createApi({\n *   baseQuery: staggeredBaseQuery,\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsResponse, void>({\n *       query: () => ({ url: 'posts' }),\n *     }),\n *     getPost: build.query<PostsResponse, string>({\n *       query: (id) => ({ url: `post/${id}` }),\n *       extraOptions: { maxRetries: 8 }, // You can override the retry behavior on each endpoint\n *     }),\n *   }),\n * });\n *\n * export const { useGetPostsQuery, useGetPostQuery } = api;\n * ```\n */\nexport const retry = /* @__PURE__ */Object.assign(retryWithBackoff, {\n  fail\n});","import type { ThunkDispatch, ActionCreatorWithoutPayload // Workaround for API-Extractor\n} from '@reduxjs/toolkit';\nimport { createAction } from './rtkImports';\nexport const INTERNAL_PREFIX = '__rtkq/';\nconst ONLINE = 'online';\nconst OFFLINE = 'offline';\nconst FOCUS = 'focus';\nconst FOCUSED = 'focused';\nconst VISIBILITYCHANGE = 'visibilitychange';\nexport const onFocus = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${FOCUSED}`);\nexport const onFocusLost = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}un${FOCUSED}`);\nexport const onOnline = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${ONLINE}`);\nexport const onOffline = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${OFFLINE}`);\nconst actions = {\n  onFocus,\n  onFocusLost,\n  onOnline,\n  onOffline\n};\nlet initialized = false;\n\n/**\n * A utility used to enable `refetchOnMount` and `refetchOnReconnect` behaviors.\n * It requires the dispatch method from your store.\n * Calling `setupListeners(store.dispatch)` will configure listeners with the recommended defaults,\n * but you have the option of providing a callback for more granular control.\n *\n * @example\n * ```ts\n * setupListeners(store.dispatch)\n * ```\n *\n * @param dispatch - The dispatch method from your store\n * @param customHandler - An optional callback for more granular control over listener behavior\n * @returns Return value of the handler.\n * The default handler returns an `unsubscribe` method that can be called to remove the listeners.\n */\nexport function setupListeners(dispatch: ThunkDispatch<any, any, any>, customHandler?: (dispatch: ThunkDispatch<any, any, any>, actions: {\n  onFocus: typeof onFocus;\n  onFocusLost: typeof onFocusLost;\n  onOnline: typeof onOnline;\n  onOffline: typeof onOffline;\n}) => () => void) {\n  function defaultHandler() {\n    const [handleFocus, handleFocusLost, handleOnline, handleOffline] = [onFocus, onFocusLost, onOnline, onOffline].map(action => () => dispatch(action()));\n    const handleVisibilityChange = () => {\n      if (window.document.visibilityState === 'visible') {\n        handleFocus();\n      } else {\n        handleFocusLost();\n      }\n    };\n    let unsubscribe = () => {\n      initialized = false;\n    };\n    if (!initialized) {\n      if (typeof window !== 'undefined' && window.addEventListener) {\n        const handlers = {\n          [FOCUS]: handleFocus,\n          [VISIBILITYCHANGE]: handleVisibilityChange,\n          [ONLINE]: handleOnline,\n          [OFFLINE]: handleOffline\n        };\n        function updateListeners(add: boolean) {\n          Object.entries(handlers).forEach(([event, handler]) => {\n            if (add) {\n              window.addEventListener(event, handler, false);\n            } else {\n              window.removeEventListener(event, handler);\n            }\n          });\n        }\n        // Handle focus events\n        updateListeners(true);\n        initialized = true;\n        unsubscribe = () => {\n          updateListeners(false);\n          initialized = false;\n        };\n      }\n    }\n    return unsubscribe;\n  }\n  return customHandler ? customHandler(dispatch, actions) : defaultHandler();\n}","import type { Api } from '@reduxjs/toolkit/query';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { BaseQueryApi, BaseQueryArg, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta, BaseQueryResult, QueryReturnValue } from './baseQueryTypes';\nimport type { CacheCollectionQueryExtraOptions } from './core/buildMiddleware/cacheCollection';\nimport type { CacheLifecycleInfiniteQueryExtraOptions, CacheLifecycleMutationExtraOptions, CacheLifecycleQueryExtraOptions } from './core/buildMiddleware/cacheLifecycle';\nimport type { QueryLifecycleInfiniteQueryExtraOptions, QueryLifecycleMutationExtraOptions, QueryLifecycleQueryExtraOptions } from './core/buildMiddleware/queryLifecycle';\nimport type { InfiniteData, InfiniteQueryConfigOptions, QuerySubState, RootState } from './core/index';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { NEVER } from './fakeBaseQuery';\nimport type { CastAny, HasRequiredProps, MaybePromise, NonUndefined, OmitFromUnion, UnwrapPromise } from './tsHelpers';\nimport { isNotNullish } from './utils';\nimport type { NamedSchemaError } from './standardSchema';\nimport { filterMap } from './utils/filterMap';\nconst rawResultType = /* @__PURE__ */Symbol();\nconst resultType = /* @__PURE__ */Symbol();\nconst baseQuery = /* @__PURE__ */Symbol();\nexport interface SchemaFailureInfo {\n  endpoint: string;\n  arg: any;\n  type: 'query' | 'mutation';\n  queryCacheKey?: string;\n}\nexport type SchemaFailureHandler = (error: NamedSchemaError, info: SchemaFailureInfo) => void;\nexport type SchemaFailureConverter<BaseQuery extends BaseQueryFn> = (error: NamedSchemaError, info: SchemaFailureInfo) => BaseQueryError<BaseQuery>;\nexport type EndpointDefinitionWithQuery<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery>> = {\n  /**\n   * `query` can be a function that returns either a `string` or an `object` which is passed to your `baseQuery`. If you are using [fetchBaseQuery](./fetchBaseQuery), this can return either a `string` or an `object` of properties in `FetchArgs`. If you use your own custom [`baseQuery`](../../rtk-query/usage/customizing-queries), you can customize this behavior to your liking.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"query example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       // highlight-start\n   *       query: () => 'posts',\n   *       // highlight-end\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *      // highlight-start\n   *      query: (body) => ({\n   *        url: `posts`,\n   *        method: 'POST',\n   *        body,\n   *      }),\n   *      // highlight-end\n   *      invalidatesTags: [{ type: 'Post', id: 'LIST' }],\n   *    }),\n   *   })\n   * })\n   * ```\n   */\n  query(arg: QueryArg): BaseQueryArg<BaseQuery>;\n  queryFn?: never;\n  /**\n   * A function to manipulate the data returned by a query or mutation.\n   */\n  transformResponse?(baseQueryReturnValue: RawResultType, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): ResultType | Promise<ResultType>;\n  /**\n   * A function to manipulate the data returned by a failed query or mutation.\n   */\n  transformErrorResponse?(baseQueryReturnValue: BaseQueryError<BaseQuery>, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): unknown;\n\n  /**\n   * A schema for the result *before* it's passed to `transformResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPostName: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawResponseSchema: postSchema,\n   *       transformResponse: (post) => post.name,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawResponseSchema?: StandardSchemaV1<RawResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn`, *before* it's passed to `transformErrorResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import {customBaseQuery, baseQueryErrorSchema} from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawErrorResponseSchema: baseQueryErrorSchema,\n   *       transformErrorResponse: (error) => error.data,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawErrorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n};\nexport type EndpointDefinitionWithQueryFn<QueryArg, BaseQuery extends BaseQueryFn, ResultType> = {\n  /**\n   * Can be used in place of `query` as an inline function that bypasses `baseQuery` completely for the endpoint.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Basic queryFn example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *     }),\n   *     flipCoin: build.query<'heads' | 'tails', void>({\n   *       // highlight-start\n   *       queryFn(arg, queryApi, extraOptions, baseQuery) {\n   *         const randomVal = Math.random()\n   *         if (randomVal < 0.45) {\n   *           return { data: 'heads' }\n   *         }\n   *         if (randomVal < 0.9) {\n   *           return { data: 'tails' }\n   *         }\n   *         return { error: { status: 500, statusText: 'Internal Server Error', data: \"Coin landed on its edge!\" } }\n   *       }\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  queryFn(arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions<BaseQuery>, baseQuery: (arg: Parameters<BaseQuery>[0]) => ReturnType<BaseQuery>): MaybePromise<QueryReturnValue<ResultType, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>>;\n  query?: never;\n  transformResponse?: never;\n  transformErrorResponse?: never;\n  rawResponseSchema?: never;\n  rawErrorResponseSchema?: never;\n};\ntype BaseEndpointTypes<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType> = {\n  QueryArg: QueryArg;\n  BaseQuery: BaseQuery;\n  ResultType: ResultType;\n  RawResultType: RawResultType;\n};\nexport type SchemaType = 'arg' | 'rawResponse' | 'response' | 'rawErrorResponse' | 'errorResponse' | 'meta';\ninterface CommonEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType> {\n  /**\n   * A schema for the arguments to be passed to the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       argSchema: v.object({ id: v.number() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  argSchema?: StandardSchemaV1<QueryArg>;\n\n  /**\n   * A schema for the result (including `transformResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: postSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  responseSchema?: StandardSchemaV1<ResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn` (including `transformErrorResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryErrorSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       errorResponseSchema: baseQueryErrorSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  errorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n\n  /**\n   * A schema for the `meta` property returned by the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryMetaSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       metaSchema: baseQueryMetaSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  metaSchema?: StandardSchemaV1<BaseQueryMeta<BaseQuery>>;\n\n  /**\n   * Defaults to `true`.\n   *\n   * Most apps should leave this setting on. The only time it can be a performance issue\n   * is if an API returns extremely large amounts of data (e.g. 10,000 rows per request) and\n   * you're unable to paginate it.\n   *\n   * For details of how this works, please see the below. When it is set to `false`,\n   * every request will cause subscribed components to rerender, even when the data has not changed.\n   *\n   * @see https://redux-toolkit.js.org/api/other-exports#copywithstructuralsharing\n   */\n  structuralSharing?: boolean;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       onSchemaFailure: (error, info) => {\n   *         console.error(error, info)\n   *       },\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       catchSchemaFailure: (error, info) => ({\n   *         status: \"CUSTOM_ERROR\",\n   *         error: error.schemaName + \" failed validation\",\n   *         data: error.issues,\n   *       }),\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for this endpoint.\n   * Overrides the global setting.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type BaseEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = (([CastAny<BaseQueryResult<BaseQuery>, {}>] extends [NEVER] ? never : EndpointDefinitionWithQuery<QueryArg, BaseQuery, ResultType, RawResultType>) | EndpointDefinitionWithQueryFn<QueryArg, BaseQuery, ResultType>) & CommonEndpointDefinition<QueryArg, BaseQuery, ResultType> & {\n  /* phantom type */\n  [rawResultType]?: RawResultType;\n  /* phantom type */\n  [resultType]?: ResultType;\n  /* phantom type */\n  [baseQuery]?: BaseQuery;\n} & HasRequiredProps<BaseQueryExtraOptions<BaseQuery>, {\n  extraOptions: BaseQueryExtraOptions<BaseQuery>;\n}, {\n  extraOptions?: BaseQueryExtraOptions<BaseQuery>;\n}>;\n\n// NOTE As with QueryStatus in `apiState.ts`, don't use this for real comparisons\n// at runtime, use the string constants defined below.\nexport enum DefinitionType {\n  query = 'query',\n  mutation = 'mutation',\n  infinitequery = 'infinitequery',\n}\nexport const ENDPOINT_QUERY = DefinitionType.query;\nexport const ENDPOINT_MUTATION = DefinitionType.mutation;\nexport const ENDPOINT_INFINITEQUERY = DefinitionType.infinitequery;\ntype TagDescriptionArray<TagTypes extends string> = ReadonlyArray<TagDescription<TagTypes> | undefined | null>;\nexport type GetResultDescriptionFn<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = (result: ResultType | undefined, error: ErrorType | undefined, arg: QueryArg, meta: MetaType) => TagDescriptionArray<TagTypes>;\nexport type FullTagDescription<TagType> = {\n  type: TagType;\n  id?: number | string;\n};\nexport type TagDescription<TagType> = TagType | FullTagDescription<TagType>;\n\n/**\n * @public\n */\nexport type ResultDescription<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = TagDescriptionArray<TagTypes> | GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>;\ntype QueryTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  QueryDefinition: QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface QueryExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.query;\n\n  /**\n   * Used by `query` endpoints. Determines which 'tag' is attached to the cached data returned by the query.\n   * Expects an array of tag type strings, an array of objects of tag types with ids, or a function that returns such an array.\n   * 1.  `['Post']` - equivalent to `2`\n   * 2.  `[{ type: 'Post' }]` - equivalent to `1`\n   * 3.  `[{ type: 'Post', id: 1 }]`\n   * 4.  `(result, error, arg) => ['Post']` - equivalent to `5`\n   * 5.  `(result, error, arg) => [{ type: 'Post' }]` - equivalent to `4`\n   * 6.  `(result, error, arg) => [{ type: 'Post', id: 1 }]`\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"providesTags example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       // highlight-start\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  providesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * Can be provided to merge an incoming response value into the current cache data.\n   * If supplied, no automatic structural sharing will be applied - it's up to\n   * you to update the cache appropriately.\n   *\n   * Since RTKQ normally replaces cache entries with the new response, you will usually\n   * need to use this with the `serializeQueryArgs` or `forceRefetch` options to keep\n   * an existing cache entry so that it can be updated.\n   *\n   * Since this is wrapped with Immer, you may either mutate the `currentCacheValue` directly,\n   * or return a new value, but _not_ both at once.\n   *\n   * Will only be called if the existing `currentCacheData` is _not_ `undefined` - on first response,\n   * the cache entry will just save the response data directly.\n   *\n   * Useful if you don't want a new request to completely override the current cache value,\n   * maybe because you have manually updated it from another source and don't want those\n   * updates to get lost.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"merge: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  merge?(currentCacheData: ResultType, responseData: ResultType, otherArgs: {\n    arg: QueryArg;\n    baseQueryMeta: BaseQueryMeta<BaseQuery>;\n    requestId: string;\n    fulfilledTimeStamp: number;\n  }): ResultType | void;\n\n  /**\n   * Check to see if the endpoint should force a refetch in cases where it normally wouldn't.\n   * This is primarily useful for \"infinite scroll\" / pagination use cases where\n   * RTKQ is keeping a single cache entry that is added to over time, in combination\n   * with `serializeQueryArgs` returning a fixed cache key and a `merge` callback\n   * set to add incoming data to the cache entry each time.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"forceRefresh: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  forceRefetch?(params: {\n    currentArg: QueryArg | undefined;\n    previousArg: QueryArg | undefined;\n    state: RootState<any, any, string>;\n    endpointState?: QuerySubState<any>;\n  }): boolean;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: QueryTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type QueryDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & QueryExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type InfiniteQueryTypes<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  InfiniteQueryDefinition: InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\nexport interface InfiniteQueryExtraOptions<TagTypes extends string, ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.infinitequery;\n  providesTags?: ResultDescription<TagTypes, InfiniteData<ResultType, PageParam>, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Required options to configure the infinite query behavior.\n   * `initialPageParam` and `getNextPageParam` are required, to\n   * ensure the infinite query can properly fetch the next page of data.\n   * `initialPageParam` may be specified when using the\n   * endpoint, to override the default value.\n   * `maxPages` and `getPreviousPageParam` are both optional.\n   * \n   * @example\n   * \n   * ```ts\n   * // codeblock-meta title=\"infiniteQueryOptions example\"\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * \n   * type Pokemon = {\n   *   id: string\n   *   name: string\n   * }\n   * \n   * const pokemonApi = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),\n   *   endpoints: (build) => ({\n   *     getInfinitePokemonWithMax: build.infiniteQuery<Pokemon[], string, number>({\n   *       infiniteQueryOptions: {\n   *         initialPageParam: 0,\n   *         maxPages: 3,\n   *         getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) =>\n   *           lastPageParam + 1,\n   *         getPreviousPageParam: (\n   *           firstPage,\n   *           allPages,\n   *           firstPageParam,\n   *           allPageParams,\n   *         ) => {\n   *           return firstPageParam > 0 ? firstPageParam - 1 : undefined\n   *         },\n   *       },\n   *       query({pageParam}) {\n   *         return `https://example.com/listItems?page=${pageParam}`\n   *       },\n   *     }),\n   *   }),\n   * })\n   \n   * ```\n   */\n  infiniteQueryOptions: InfiniteQueryConfigOptions<ResultType, PageParam, QueryArg>;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: InfiniteQueryTypes<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> =\n// Infinite query endpoints receive `{queryArg, pageParam}`\nBaseEndpointDefinition<InfiniteQueryCombinedArg<QueryArg, PageParam>, BaseQuery, ResultType, RawResultType> & InfiniteQueryExtraOptions<TagTypes, ResultType, QueryArg, PageParam, BaseQuery, ReducerPath, RawResultType>;\ntype MutationTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseMutation<typeof api.endpoints.query.Types.MutationDefinition> = ...\n   * ```\n   */\n  MutationDefinition: MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface MutationExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath> {\n  type: DefinitionType.mutation;\n\n  /**\n   * Used by `mutation` endpoints. Determines which cached data should be either re-fetched or removed from the cache.\n   * Expects the same shapes as `providesTags`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"invalidatesTags example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *       query(body) {\n   *         return {\n   *           url: `posts`,\n   *           method: 'POST',\n   *           body,\n   *         }\n   *       },\n   *       // highlight-start\n   *       invalidatesTags: [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  invalidatesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A mutation should not provide tags to the cache.\n   */\n  providesTags?: never;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: MutationTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type MutationDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & MutationExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type EndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, PageParam = any, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\nexport type EndpointDefinitions = Record<string, EndpointDefinition<any, any, any, any, any, any, any>>;\nexport function isQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is QueryDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_QUERY;\n}\nexport function isMutationDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is MutationDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_MUTATION;\n}\nexport function isInfiniteQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is InfiniteQueryDefinition<any, any, any, any, any, any, any> {\n  return e.type === ENDPOINT_INFINITEQUERY;\n}\nexport function isAnyQueryDefinition(e: EndpointDefinition<any, any, any, any>): e is QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any> {\n  return isQueryDefinition(e) || isInfiniteQueryDefinition(e);\n}\nexport type EndpointBuilder<BaseQuery extends BaseQueryFn, TagTypes extends string, ReducerPath extends string> = {\n  /**\n   * An endpoint definition that retrieves data, and may provide tags to the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all query endpoint options\"\n   * const api = createApi({\n   *  baseQuery,\n   *  endpoints: (build) => ({\n   *    getPost: build.query({\n   *      query: (id) => ({ url: `post/${id}` }),\n   *      // Pick out data and prevent nested properties in a hook or selector\n   *      transformResponse: (response) => response.data,\n   *      // Pick out error and prevent nested properties in a hook or selector\n   *      transformErrorResponse: (response) => response.error,\n   *      // `result` is the server response\n   *      providesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry, updateCachedData }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry, updateCachedData }) {},\n   *    }),\n   *  }),\n   *});\n   *```\n   */\n  query<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n\n  /**\n   * An endpoint definition that alters data on the server or will possibly invalidate the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all mutation endpoint options\"\n   * const api = createApi({\n   *   baseQuery,\n   *   endpoints: (build) => ({\n   *     updatePost: build.mutation({\n   *       query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),\n   *       // Pick out data and prevent nested properties in a hook or selector\n   *       transformResponse: (response) => response.data,\n   *       // Pick out error and prevent nested properties in a hook or selector\n   *       transformErrorResponse: (response) => response.error,\n   *       // `result` is the server response\n   *       invalidatesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry }) {},\n   *     }),\n   *   }),\n   * });\n   * ```\n   */\n  mutation<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n  infiniteQuery<ResultType, QueryArg, PageParam, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n};\nexport type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T;\nexport function calculateProvidedBy<ResultType, QueryArg, ErrorType, MetaType>(description: ResultDescription<string, ResultType, QueryArg, ErrorType, MetaType> | undefined, result: ResultType | undefined, error: ErrorType | undefined, queryArg: QueryArg, meta: MetaType | undefined, assertTagTypes: AssertTagTypes): readonly FullTagDescription<string>[] {\n  const finalDescription = isFunction(description) ? description(result as ResultType, error as undefined, queryArg, meta as MetaType) : description;\n  if (finalDescription) {\n    return filterMap(finalDescription, isNotNullish, tag => assertTagTypes(expandTagDescription(tag)));\n  }\n  return [];\n}\nfunction isFunction<T>(t: T): t is Extract<T, Function> {\n  return typeof t === 'function';\n}\nexport function expandTagDescription(description: TagDescription<string>): FullTagDescription<string> {\n  return typeof description === 'string' ? {\n    type: description\n  } : description;\n}\nexport type QueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<infer QA, any, any, any> ? QA : never;\n\n// Just extracting `QueryArg` from `BaseEndpointDefinition`\n// doesn't sufficiently match here.\n// We need to explicitly match against `InfiniteQueryDefinition`\nexport type InfiniteQueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<infer QA, any, any, any, any, any, any> ? QA : never;\nexport type QueryArgFromAnyQuery<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any, any, any> ? InfiniteQueryArgFrom<D> : D extends QueryDefinition<any, any, any, any, any, any> ? QueryArgFrom<D> : never;\nexport type ResultTypeFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<any, any, infer RT, any> ? RT : unknown;\nexport type ReducerPathFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, any, any, infer RP, any, any> ? RP : unknown;\nexport type TagTypesFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, infer TT, any, any, any, any> ? TT : unknown;\nexport type PageParamFrom<D extends InfiniteQueryDefinition<any, any, any, any, any, any, any>> = D extends InfiniteQueryDefinition<any, infer PP, any, any, any, any, any> ? PP : unknown;\nexport type InfiniteQueryCombinedArg<QueryArg, PageParam> = {\n  queryArg: QueryArg;\n  pageParam: PageParam;\n};\nexport type TagTypesFromApi<T> = T extends Api<any, any, any, infer TagTypes> ? TagTypes : never;\nexport type DefinitionsFromApi<T> = T extends Api<any, infer Definitions, any, any> ? Definitions : never;\nexport type TransformedResponse<NewDefinitions extends EndpointDefinitions, K, ResultType> = K extends keyof NewDefinitions ? NewDefinitions[K]['transformResponse'] extends undefined ? ResultType : UnwrapPromise<ReturnType<NonUndefined<NewDefinitions[K]['transformResponse']>>> : ResultType;\nexport type OverrideResultType<Definition, NewResultType> = Definition extends QueryDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends MutationDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, NewResultType, ReducerPath> : never;\nexport type UpdateDefinitions<Definitions extends EndpointDefinitions, NewTagTypes extends string, NewDefinitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends MutationDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : never };","export { current, isDraft, applyPatches, original, isDraftable, produceWithPatches, enablePatches } from 'immer';","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { AsyncThunkAction, SafePromise, SerializedError, ThunkAction, UnknownAction } from '@reduxjs/toolkit';\nimport type { Dispatch } from 'redux';\nimport { asSafePromise } from '../../tsHelpers';\nimport { getEndpointDefinition, type Api, type ApiContext } from '../apiTypes';\nimport type { BaseQueryError, QueryReturnValue } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport { ENDPOINT_QUERY, isQueryDefinition, type EndpointDefinition, type EndpointDefinitions, type InfiniteQueryArgFrom, type InfiniteQueryDefinition, type MutationDefinition, type PageParamFrom, type QueryArgFrom, type QueryDefinition, type ResultTypeFrom } from '../endpointDefinitions';\nimport { filterNullishValues } from '../utils';\nimport type { InfiniteData, InfiniteQueryConfigOptions, InfiniteQueryDirection, SubscriptionOptions } from './apiState';\nimport type { InfiniteQueryResultSelectorResult, QueryResultSelectorResult } from './buildSelectors';\nimport type { InfiniteQueryThunk, InfiniteQueryThunkArg, MutationThunk, QueryThunk, QueryThunkArg, ThunkApiMetaConfig } from './buildThunks';\nimport type { ApiEndpointQuery } from './module';\nimport type { InternalMiddlewareState } from './buildMiddleware/types';\nexport type BuildInitiateApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>> = {\n  initiate: StartQueryActionCreator<Definition>;\n};\nexport type BuildInitiateApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  initiate: StartInfiniteQueryActionCreator<Definition>;\n};\nexport type BuildInitiateApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>> = {\n  initiate: StartMutationActionCreator<Definition>;\n};\nexport const forceQueryFnSymbol = Symbol('forceQueryFn');\nexport const isUpsertQuery = (arg: QueryThunkArg) => typeof arg[forceQueryFnSymbol] === 'function';\nexport type StartQueryActionCreatorOptions = {\n  subscribe?: boolean;\n  forceRefetch?: boolean | number;\n  subscriptionOptions?: SubscriptionOptions;\n  [forceQueryFnSymbol]?: () => QueryReturnValue;\n};\ntype RefetchOptions = {\n  refetchCachedPages?: boolean;\n};\nexport type StartInfiniteQueryActionCreatorOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>> = StartQueryActionCreatorOptions & {\n  direction?: InfiniteQueryDirection;\n  param?: unknown;\n} & Partial<Pick<Partial<InfiniteQueryConfigOptions<ResultTypeFrom<D>, PageParamFrom<D>, InfiniteQueryArgFrom<D>>>, 'initialPageParam' | 'refetchCachedPages'>>;\ntype AnyQueryActionCreator<D extends EndpointDefinition<any, any, any, any>> = (arg: any, options?: StartQueryActionCreatorOptions) => ThunkAction<AnyActionCreatorResult, any, any, UnknownAction>;\ntype StartQueryActionCreator<D extends QueryDefinition<any, any, any, any, any>> = (arg: QueryArgFrom<D>, options?: StartQueryActionCreatorOptions) => ThunkAction<QueryActionCreatorResult<D>, any, any, UnknownAction>;\nexport type StartInfiniteQueryActionCreator<D extends InfiniteQueryDefinition<any, any, any, any, any>> = (arg: InfiniteQueryArgFrom<D>, options?: StartInfiniteQueryActionCreatorOptions<D>) => ThunkAction<InfiniteQueryActionCreatorResult<D>, any, any, UnknownAction>;\ntype QueryActionCreatorFields = {\n  requestId: string;\n  subscriptionOptions: SubscriptionOptions | undefined;\n  abort(): void;\n  unsubscribe(): void;\n  updateSubscriptionOptions(options: SubscriptionOptions): void;\n  queryCacheKey: string;\n};\ntype AnyActionCreatorResult = SafePromise<any> & QueryActionCreatorFields & {\n  arg: any;\n  unwrap(): Promise<any>;\n  refetch(options?: RefetchOptions): AnyActionCreatorResult;\n};\nexport type QueryActionCreatorResult<D extends QueryDefinition<any, any, any, any>> = SafePromise<QueryResultSelectorResult<D>> & QueryActionCreatorFields & {\n  arg: QueryArgFrom<D>;\n  unwrap(): Promise<ResultTypeFrom<D>>;\n  refetch(): QueryActionCreatorResult<D>;\n};\nexport type InfiniteQueryActionCreatorResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = SafePromise<InfiniteQueryResultSelectorResult<D>> & QueryActionCreatorFields & {\n  arg: InfiniteQueryArgFrom<D>;\n  unwrap(): Promise<InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>>;\n  refetch(options?: Pick<StartInfiniteQueryActionCreatorOptions<D>, 'refetchCachedPages'>): InfiniteQueryActionCreatorResult<D>;\n};\ntype StartMutationActionCreator<D extends MutationDefinition<any, any, any, any>> = (arg: QueryArgFrom<D>, options?: {\n  /**\n   * If this mutation should be tracked in the store.\n   * If you just want to manually trigger this mutation using `dispatch` and don't care about the\n   * result, state & potential errors being held in store, you can set this to false.\n   * (defaults to `true`)\n   */\n  track?: boolean;\n  fixedCacheKey?: string;\n}) => ThunkAction<MutationActionCreatorResult<D>, any, any, UnknownAction>;\nexport type MutationActionCreatorResult<D extends MutationDefinition<any, any, any, any>> = SafePromise<{\n  data: ResultTypeFrom<D>;\n  error?: undefined;\n} | {\n  data?: undefined;\n  error: Exclude<BaseQueryError<D extends MutationDefinition<any, infer BaseQuery, any, any> ? BaseQuery : never>, undefined> | SerializedError;\n}> & {\n  /** @internal */\n  arg: {\n    /**\n     * The name of the given endpoint for the mutation\n     */\n    endpointName: string;\n    /**\n     * The original arguments supplied to the mutation call\n     */\n    originalArgs: QueryArgFrom<D>;\n    /**\n     * Whether the mutation is being tracked in the store.\n     */\n    track?: boolean;\n    fixedCacheKey?: string;\n  };\n  /**\n   * A unique string generated for the request sequence\n   */\n  requestId: string;\n\n  /**\n   * A method to cancel the mutation promise. Note that this is not intended to prevent the mutation\n   * that was fired off from reaching the server, but only to assist in handling the response.\n   *\n   * Calling `abort()` prior to the promise resolving will force it to reach the error state with\n   * the serialized error:\n   * `{ name: 'AbortError', message: 'Aborted' }`\n   *\n   * @example\n   * ```ts\n   * const [updateUser] = useUpdateUserMutation();\n   *\n   * useEffect(() => {\n   *   const promise = updateUser(id);\n   *   promise\n   *     .unwrap()\n   *     .catch((err) => {\n   *       if (err.name === 'AbortError') return;\n   *       // else handle the unexpected error\n   *     })\n   *\n   *   return () => {\n   *     promise.abort();\n   *   }\n   * }, [id, updateUser])\n   * ```\n   */\n  abort(): void;\n  /**\n   * Unwraps a mutation call to provide the raw response/error.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a mutation, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap\"\n   * addPost({ id: 1, name: 'Example' })\n   *   .unwrap()\n   *   .then((payload) => console.log('fulfilled', payload))\n   *   .catch((error) => console.error('rejected', error));\n   * ```\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await addPost({ id: 1, name: 'Example' }).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  unwrap(): Promise<ResultTypeFrom<D>>;\n  /**\n   * A method to manually unsubscribe from the mutation call, meaning it will be removed from cache after the usual caching grace period.\n   The value returned by the hook will reset to `isUninitialized` afterwards.\n   */\n  reset(): void;\n};\nexport function buildInitiate({\n  serializeQueryArgs,\n  queryThunk,\n  infiniteQueryThunk,\n  mutationThunk,\n  api,\n  context,\n  getInternalState\n}: {\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  queryThunk: QueryThunk;\n  infiniteQueryThunk: InfiniteQueryThunk<any>;\n  mutationThunk: MutationThunk;\n  api: Api<any, EndpointDefinitions, any, any>;\n  context: ApiContext<EndpointDefinitions>;\n  getInternalState: (dispatch: Dispatch) => InternalMiddlewareState;\n}) {\n  const getRunningQueries = (dispatch: Dispatch) => getInternalState(dispatch)?.runningQueries;\n  const getRunningMutations = (dispatch: Dispatch) => getInternalState(dispatch)?.runningMutations;\n  const {\n    unsubscribeQueryResult,\n    removeMutationResult,\n    updateSubscriptionOptions\n  } = api.internalActions;\n  return {\n    buildInitiateQuery,\n    buildInitiateInfiniteQuery,\n    buildInitiateMutation,\n    getRunningQueryThunk,\n    getRunningMutationThunk,\n    getRunningQueriesThunk,\n    getRunningMutationsThunk\n  };\n  function getRunningQueryThunk(endpointName: string, queryArgs: any) {\n    return (dispatch: Dispatch) => {\n      const endpointDefinition = getEndpointDefinition(context, endpointName);\n      const queryCacheKey = serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      });\n      return getRunningQueries(dispatch)?.get(queryCacheKey) as QueryActionCreatorResult<never> | InfiniteQueryActionCreatorResult<never> | undefined;\n    };\n  }\n  function getRunningMutationThunk(\n  /**\n   * this is only here to allow TS to infer the result type by input value\n   * we could use it to validate the result, but it's probably not necessary\n   */\n  _endpointName: string, fixedCacheKeyOrRequestId: string) {\n    return (dispatch: Dispatch) => {\n      return getRunningMutations(dispatch)?.get(fixedCacheKeyOrRequestId) as MutationActionCreatorResult<never> | undefined;\n    };\n  }\n  function getRunningQueriesThunk() {\n    return (dispatch: Dispatch) => filterNullishValues(getRunningQueries(dispatch));\n  }\n  function getRunningMutationsThunk() {\n    return (dispatch: Dispatch) => filterNullishValues(getRunningMutations(dispatch));\n  }\n  function middlewareWarning(dispatch: Dispatch) {\n    if (process.env.NODE_ENV !== 'production') {\n      if ((middlewareWarning as any).triggered) return;\n      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());\n      (middlewareWarning as any).triggered = true;\n\n      // The RTKQ middleware should return the internal state object,\n      // but it should _not_ be the action object.\n      if (typeof returnedValue !== 'object' || typeof returnedValue?.type === 'string') {\n        // Otherwise, must not have been added\n        throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(34) : `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!`);\n      }\n    }\n  }\n  function buildInitiateAnyQuery<T extends 'query' | 'infiniteQuery'>(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any>) {\n    const queryAction: AnyQueryActionCreator<any> = (arg, {\n      subscribe = true,\n      forceRefetch,\n      subscriptionOptions,\n      [forceQueryFnSymbol]: forceQueryFn,\n      ...rest\n    } = {}) => (dispatch, getState) => {\n      const queryCacheKey = serializeQueryArgs({\n        queryArgs: arg,\n        endpointDefinition,\n        endpointName\n      });\n      let thunk: AsyncThunkAction<unknown, QueryThunkArg, ThunkApiMetaConfig>;\n      const commonThunkArgs = {\n        ...rest,\n        type: ENDPOINT_QUERY as 'query',\n        subscribe,\n        forceRefetch: forceRefetch,\n        subscriptionOptions,\n        endpointName,\n        originalArgs: arg,\n        queryCacheKey,\n        [forceQueryFnSymbol]: forceQueryFn\n      };\n      if (isQueryDefinition(endpointDefinition)) {\n        thunk = queryThunk(commonThunkArgs);\n      } else {\n        const {\n          direction,\n          initialPageParam,\n          refetchCachedPages\n        } = rest as Pick<InfiniteQueryThunkArg<any>, 'direction' | 'initialPageParam' | 'refetchCachedPages'>;\n        thunk = infiniteQueryThunk({\n          ...(commonThunkArgs as InfiniteQueryThunkArg<any>),\n          // Supply these even if undefined. This helps with a field existence\n          // check over in `buildSlice.ts`\n          direction,\n          initialPageParam,\n          refetchCachedPages\n        });\n      }\n      const selector = (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).select(arg);\n      const thunkResult = dispatch(thunk);\n      const stateAfter = selector(getState());\n      middlewareWarning(dispatch);\n      const {\n        requestId,\n        abort\n      } = thunkResult;\n      const skippedSynchronously = stateAfter.requestId !== requestId;\n      const runningQuery = getRunningQueries(dispatch)?.get(queryCacheKey);\n      const selectFromState = () => selector(getState());\n      const statePromise: AnyActionCreatorResult = Object.assign((forceQueryFn ?\n      // a query has been forced (upsertQueryData)\n      // -> we want to resolve it once data has been written with the data that will be written\n      thunkResult.then(selectFromState) : skippedSynchronously && !runningQuery ?\n      // a query has been skipped due to a condition and we do not have any currently running query\n      // -> we want to resolve it immediately with the current data\n      Promise.resolve(stateAfter) :\n      // query just started or one is already in flight\n      // -> wait for the running query, then resolve with data from after that\n      Promise.all([runningQuery, thunkResult]).then(selectFromState)) as SafePromise<any>, {\n        arg,\n        requestId,\n        subscriptionOptions,\n        queryCacheKey,\n        abort,\n        async unwrap() {\n          const result = await statePromise;\n          if (result.isError) {\n            throw result.error;\n          }\n          return result.data;\n        },\n        refetch: (options?: RefetchOptions) => dispatch(queryAction(arg, {\n          subscribe: false,\n          forceRefetch: true,\n          ...options\n        })),\n        unsubscribe() {\n          if (subscribe) dispatch(unsubscribeQueryResult({\n            queryCacheKey,\n            requestId\n          }));\n        },\n        updateSubscriptionOptions(options: SubscriptionOptions) {\n          statePromise.subscriptionOptions = options;\n          dispatch(updateSubscriptionOptions({\n            endpointName,\n            requestId,\n            queryCacheKey,\n            options\n          }));\n        }\n      });\n      if (!runningQuery && !skippedSynchronously && !forceQueryFn) {\n        const runningQueries = getRunningQueries(dispatch)!;\n        runningQueries.set(queryCacheKey, statePromise);\n        statePromise.then(() => {\n          runningQueries.delete(queryCacheKey);\n        });\n      }\n      return statePromise;\n    };\n    return queryAction;\n  }\n  function buildInitiateQuery(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any>) {\n    const queryAction: StartQueryActionCreator<any> = buildInitiateAnyQuery(endpointName, endpointDefinition);\n    return queryAction;\n  }\n  function buildInitiateInfiniteQuery(endpointName: string, endpointDefinition: InfiniteQueryDefinition<any, any, any, any, any>) {\n    const infiniteQueryAction: StartInfiniteQueryActionCreator<any> = buildInitiateAnyQuery(endpointName, endpointDefinition);\n    return infiniteQueryAction;\n  }\n  function buildInitiateMutation(endpointName: string): StartMutationActionCreator<any> {\n    return (arg, {\n      track = true,\n      fixedCacheKey\n    } = {}) => (dispatch, getState) => {\n      const thunk = mutationThunk({\n        type: 'mutation',\n        endpointName,\n        originalArgs: arg,\n        track,\n        fixedCacheKey\n      });\n      const thunkResult = dispatch(thunk);\n      middlewareWarning(dispatch);\n      const {\n        requestId,\n        abort,\n        unwrap\n      } = thunkResult;\n      const returnValuePromise = asSafePromise(thunkResult.unwrap().then(data => ({\n        data\n      })), error => ({\n        error\n      }));\n      const reset = () => {\n        dispatch(removeMutationResult({\n          requestId,\n          fixedCacheKey\n        }));\n      };\n      const ret = Object.assign(returnValuePromise, {\n        arg: thunkResult.arg,\n        requestId,\n        abort,\n        unwrap,\n        reset\n      });\n      const runningMutations = getRunningMutations(dispatch)!;\n      runningMutations.set(requestId, ret);\n      ret.then(() => {\n        runningMutations.delete(requestId);\n      });\n      if (fixedCacheKey) {\n        runningMutations.set(fixedCacheKey, ret);\n        ret.then(() => {\n          if (runningMutations.get(fixedCacheKey) === ret) {\n            runningMutations.delete(fixedCacheKey);\n          }\n        });\n      }\n      return ret;\n    };\n  }\n}","import type { Middleware, StoreEnhancer } from 'redux';\nimport type { Tuple } from './utils';\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>) {\n  Object.assign(target, ...args);\n}\n\n/**\n * return True if T is `any`, otherwise return False\n * taken from https://github.com/joonhocho/tsdef\n *\n * @internal\n */\nexport type IsAny<T, True, False = never> =\n// test if we are going the left AND right path in the condition\ntrue | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;\n\n/**\n * return True if T is `unknown`, otherwise return False\n * taken from https://github.com/joonhocho/tsdef\n *\n * @internal\n */\nexport type IsUnknown<T, True, False = never> = unknown extends T ? IsAny<T, False, True> : False;\nexport type FallbackIfUnknown<T, Fallback> = IsUnknown<T, Fallback, T>;\n\n/**\n * @internal\n */\nexport type IfMaybeUndefined<P, True, False> = [undefined] extends [P] ? True : False;\n\n/**\n * @internal\n */\nexport type IfVoid<P, True, False> = [void] extends [P] ? True : False;\n\n/**\n * @internal\n */\nexport type IsEmptyObj<T, True, False = never> = T extends any ? keyof T extends never ? IsUnknown<T, False, IfMaybeUndefined<T, False, IfVoid<T, False, True>>> : False : never;\n\n/**\n * returns True if TS version is above 3.5, False if below.\n * uses feature detection to detect TS version >= 3.5\n * * versions below 3.5 will return `{}` for unresolvable interference\n * * versions above will return `unknown`\n *\n * @internal\n */\nexport type AtLeastTS35<True, False> = [True, False][IsUnknown<ReturnType<<T>() => T>, 0, 1>];\n\n/**\n * @internal\n */\nexport type IsUnknownOrNonInferrable<T, True, False> = AtLeastTS35<IsUnknown<T, True, False>, IsEmptyObj<T, True, IsUnknown<T, True, False>>>;\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\n\n// Appears to have a convenient side effect of ignoring `never` even if that's not what you specified\nexport type ExcludeFromTuple<T, E, Acc extends unknown[] = []> = T extends [infer Head, ...infer Tail] ? ExcludeFromTuple<Tail, E, [...Acc, ...([Head] extends [E] ? [] : [Head])]> : Acc;\ntype ExtractDispatchFromMiddlewareTuple<MiddlewareTuple extends readonly any[], Acc extends {}> = MiddlewareTuple extends [infer Head, ...infer Tail] ? ExtractDispatchFromMiddlewareTuple<Tail, Acc & (Head extends Middleware<infer D> ? IsAny<D, {}, D> : {})> : Acc;\nexport type ExtractDispatchExtensions<M> = M extends Tuple<infer MiddlewareTuple> ? ExtractDispatchFromMiddlewareTuple<MiddlewareTuple, {}> : M extends ReadonlyArray<Middleware> ? ExtractDispatchFromMiddlewareTuple<[...M], {}> : never;\ntype ExtractStoreExtensionsFromEnhancerTuple<EnhancerTuple extends readonly any[], Acc extends {}> = EnhancerTuple extends [infer Head, ...infer Tail] ? ExtractStoreExtensionsFromEnhancerTuple<Tail, Acc & (Head extends StoreEnhancer<infer Ext> ? IsAny<Ext, {}, Ext> : {})> : Acc;\nexport type ExtractStoreExtensions<E> = E extends Tuple<infer EnhancerTuple> ? ExtractStoreExtensionsFromEnhancerTuple<EnhancerTuple, {}> : E extends ReadonlyArray<StoreEnhancer> ? UnionToIntersection<E[number] extends StoreEnhancer<infer Ext> ? Ext extends {} ? IsAny<Ext, {}, Ext> : {} : {}> : never;\ntype ExtractStateExtensionsFromEnhancerTuple<EnhancerTuple extends readonly any[], Acc extends {}> = EnhancerTuple extends [infer Head, ...infer Tail] ? ExtractStateExtensionsFromEnhancerTuple<Tail, Acc & (Head extends StoreEnhancer<any, infer StateExt> ? IsAny<StateExt, {}, StateExt> : {})> : Acc;\nexport type ExtractStateExtensions<E> = E extends Tuple<infer EnhancerTuple> ? ExtractStateExtensionsFromEnhancerTuple<EnhancerTuple, {}> : E extends ReadonlyArray<StoreEnhancer> ? UnionToIntersection<E[number] extends StoreEnhancer<any, infer StateExt> ? StateExt extends {} ? IsAny<StateExt, {}, StateExt> : {} : {}> : never;\n\n/**\n * Helper type. Passes T out again, but boxes it in a way that it cannot\n * \"widen\" the type by accident if it is a generic that should be inferred\n * from elsewhere.\n *\n * @internal\n */\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type WithOptionalProp<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\nexport interface TypeGuard<T> {\n  (value: any): value is T;\n}\nexport interface HasMatchFunction<T> {\n  match: TypeGuard<T>;\n}\nexport const hasMatchFunction = <T,>(v: Matcher<T>): v is HasMatchFunction<T> => {\n  return v && typeof (v as HasMatchFunction<T>).match === 'function';\n};\n\n/** @public */\nexport type Matcher<T> = HasMatchFunction<T> | TypeGuard<T>;\n\n/** @public */\nexport type ActionFromMatcher<M extends Matcher<any>> = M extends Matcher<infer T> ? T : never;\nexport type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type Tail<T extends any[]> = T extends [any, ...infer Tail] ? Tail : never;\nexport type UnknownIfNonSpecific<T> = {} extends T ? unknown : T;\n\n/**\n * A Promise that will never reject.\n * @see https://github.com/reduxjs/redux-toolkit/issues/4101\n */\nexport type SafePromise<T> = Promise<T> & {\n  __linterBrands: 'SafePromise';\n};\n\n/**\n * Properly wraps a Promise as a {@link SafePromise} with .catch(fallback).\n */\nexport function asSafePromise<Resolved, Rejected>(promise: Promise<Resolved>, fallback: (error: unknown) => Rejected) {\n  return promise.catch(fallback) as SafePromise<Resolved | Rejected>;\n}","import type { UnknownAction } from '@reduxjs/toolkit';\nimport type { BaseQueryFn } from './baseQueryTypes';\nimport type { CombinedState, CoreModule, QueryKeys } from './core';\nimport type { ApiModules } from './core/module';\nimport type { CreateApiOptions } from './createApi';\nimport type { EndpointBuilder, EndpointDefinition, EndpointDefinitions, UpdateDefinitions } from './endpointDefinitions';\nimport type { NoInfer, UnionToIntersection, WithRequiredProp } from './tsHelpers';\nexport type ModuleName = keyof ApiModules<any, any, any, any>;\nexport type Module<Name extends ModuleName> = {\n  name: Name;\n  init<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string>(api: Api<BaseQuery, EndpointDefinitions, ReducerPath, TagTypes, ModuleName>, options: WithRequiredProp<CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>, 'reducerPath' | 'serializeQueryArgs' | 'keepUnusedDataFor' | 'refetchOnMountOrArgChange' | 'refetchOnFocus' | 'refetchOnReconnect' | 'invalidationBehavior' | 'tagTypes'>, context: ApiContext<Definitions>): {\n    injectEndpoint(endpointName: string, definition: EndpointDefinition<any, any, any, any>): void;\n  };\n};\nexport interface ApiContext<Definitions extends EndpointDefinitions> {\n  apiUid: string;\n  endpointDefinitions: Definitions;\n  batch(cb: () => void): void;\n  extractRehydrationInfo: (action: UnknownAction) => CombinedState<any, any, any> | undefined;\n  hasRehydrationInfo: (action: UnknownAction) => boolean;\n}\nexport const getEndpointDefinition = <Definitions extends EndpointDefinitions, EndpointName extends keyof Definitions>(context: ApiContext<Definitions>, endpointName: EndpointName) => context.endpointDefinitions[endpointName];\nexport type Api<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string, Enhancers extends ModuleName = CoreModule> = UnionToIntersection<ApiModules<BaseQuery, Definitions, ReducerPath, TagTypes>[Enhancers]> & {\n  /**\n   * A function to inject the endpoints into the original API, but also give you that same API with correct types for these endpoints back. Useful with code-splitting.\n   */\n  injectEndpoints<NewDefinitions extends EndpointDefinitions>(_: {\n    endpoints: (build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>) => NewDefinitions;\n    /**\n     * Optionally allows endpoints to be overridden if defined by multiple `injectEndpoints` calls.\n     *\n     * If set to `true`, will override existing endpoints with the new definition.\n     * If set to `'throw'`, will throw an error if an endpoint is redefined with a different definition.\n     * If set to `false` (or unset), will not override existing endpoints with the new definition, and log a warning in development.\n     */\n    overrideExisting?: boolean | 'throw';\n  }): Api<BaseQuery, Definitions & NewDefinitions, ReducerPath, TagTypes, Enhancers>;\n  /**\n   *A function to enhance a generated API with additional information. Useful with code-generation.\n   */\n  enhanceEndpoints<NewTagTypes extends string = never, NewDefinitions extends EndpointDefinitions = never>(_: {\n    addTagTypes?: readonly NewTagTypes[];\n    endpoints?: UpdateDefinitions<Definitions, TagTypes | NoInfer<NewTagTypes>, NewDefinitions> extends infer NewDefinitions ? { [K in keyof NewDefinitions]?: Partial<NewDefinitions[K]> | ((definition: NewDefinitions[K]) => void) } : never;\n  }): Api<BaseQuery, UpdateDefinitions<Definitions, TagTypes | NewTagTypes, NewDefinitions>, ReducerPath, TagTypes | NewTagTypes, Enhancers>;\n};","import type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { SchemaError } from '@standard-schema/utils';\nimport type { SchemaType } from './endpointDefinitions';\nexport class NamedSchemaError extends SchemaError {\n  constructor(issues: readonly StandardSchemaV1.Issue[], public readonly value: any, public readonly schemaName: `${SchemaType}Schema`, public readonly _bqMeta: any) {\n    super(issues);\n  }\n}\nexport const shouldSkip = (skipSchemaValidation: boolean | SchemaType[] | undefined, schemaName: SchemaType) => Array.isArray(skipSchemaValidation) ? skipSchemaValidation.includes(schemaName) : !!skipSchemaValidation;\nexport async function parseWithSchema<Schema extends StandardSchemaV1>(schema: Schema, data: unknown, schemaName: `${SchemaType}Schema`, bqMeta: any): Promise<StandardSchemaV1.InferOutput<Schema>> {\n  const result = await schema['~standard'].validate(data);\n  if (result.issues) {\n    throw new NamedSchemaError(result.issues, data, schemaName, bqMeta);\n  }\n  return result.value;\n}","import type { AsyncThunk, AsyncThunkPayloadCreator, Draft, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { Patch } from 'immer';\nimport { isDraftable, produceWithPatches } from '../utils/immerImports';\nimport type { Api, ApiContext } from '../apiTypes';\nimport type { BaseQueryError, BaseQueryFn, QueryReturnValue } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { AssertTagTypes, EndpointDefinition, EndpointDefinitions, InfiniteQueryArgFrom, InfiniteQueryCombinedArg, InfiniteQueryDefinition, MutationDefinition, PageParamFrom, QueryArgFrom, QueryDefinition, ResultDescription, ResultTypeFrom, SchemaFailureConverter, SchemaFailureHandler, SchemaFailureInfo, SchemaType } from '../endpointDefinitions';\nimport { calculateProvidedBy, ENDPOINT_QUERY, isInfiniteQueryDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { HandledError } from '../HandledError';\nimport type { UnwrapPromise } from '../tsHelpers';\nimport type { RootState, QueryKeys, QuerySubstateIdentifier, InfiniteData, InfiniteQueryConfigOptions, QueryCacheKey, InfiniteQueryDirection, InfiniteQueryKeys } from './apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from './apiState';\nimport type { InfiniteQueryActionCreatorResult, QueryActionCreatorResult, StartInfiniteQueryActionCreatorOptions, StartQueryActionCreatorOptions } from './buildInitiate';\nimport { forceQueryFnSymbol, isUpsertQuery } from './buildInitiate';\nimport type { AllSelectors } from './buildSelectors';\nimport type { ApiEndpointQuery, PrefetchOptions } from './module';\nimport { createAsyncThunk, isAllOf, isFulfilled, isPending, isRejected, isRejectedWithValue, SHOULD_AUTOBATCH } from './rtkImports';\nimport { parseWithSchema, NamedSchemaError, shouldSkip } from '../standardSchema';\nexport type BuildThunksApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>> = Matchers<QueryThunk, Definition>;\nexport type BuildThunksApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = Matchers<InfiniteQueryThunk<any>, Definition>;\nexport type BuildThunksApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>> = Matchers<MutationThunk, Definition>;\ntype EndpointThunk<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = Definition extends EndpointDefinition<infer QueryArg, infer BaseQueryFn, any, infer ResultType> ? Thunk extends AsyncThunk<unknown, infer ATArg, infer ATConfig> ? AsyncThunk<ResultType, ATArg & {\n  originalArgs: QueryArg;\n}, ATConfig & {\n  rejectValue: BaseQueryError<BaseQueryFn>;\n}> : never : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQueryFn, any, infer ResultType> ? Thunk extends AsyncThunk<unknown, infer ATArg, infer ATConfig> ? AsyncThunk<InfiniteData<ResultType, PageParam>, ATArg & {\n  originalArgs: QueryArg;\n}, ATConfig & {\n  rejectValue: BaseQueryError<BaseQueryFn>;\n}> : never : never;\nexport type PendingAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['pending']>;\nexport type FulfilledAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['fulfilled']>;\nexport type RejectedAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['rejected']>;\nexport type Matcher<M> = (value: any) => value is M;\nexport interface Matchers<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> {\n  matchPending: Matcher<PendingAction<Thunk, Definition>>;\n  matchFulfilled: Matcher<FulfilledAction<Thunk, Definition>>;\n  matchRejected: Matcher<RejectedAction<Thunk, Definition>>;\n}\nexport type QueryThunkArg = QuerySubstateIdentifier & StartQueryActionCreatorOptions & {\n  type: 'query';\n  originalArgs: unknown;\n  endpointName: string;\n};\nexport type InfiniteQueryThunkArg<D extends InfiniteQueryDefinition<any, any, any, any, any>> = QuerySubstateIdentifier & StartInfiniteQueryActionCreatorOptions<D> & {\n  type: `query`;\n  originalArgs: unknown;\n  endpointName: string;\n  param: unknown;\n  direction?: InfiniteQueryDirection;\n  refetchCachedPages?: boolean;\n};\ntype MutationThunkArg = {\n  type: 'mutation';\n  originalArgs: unknown;\n  endpointName: string;\n  track?: boolean;\n  fixedCacheKey?: string;\n};\nexport type ThunkResult = unknown;\nexport type ThunkApiMetaConfig = {\n  pendingMeta: {\n    startedTimeStamp: number;\n    [SHOULD_AUTOBATCH]: true;\n  };\n  fulfilledMeta: {\n    fulfilledTimeStamp: number;\n    baseQueryMeta: unknown;\n    [SHOULD_AUTOBATCH]: true;\n  };\n  rejectedMeta: {\n    baseQueryMeta: unknown;\n    [SHOULD_AUTOBATCH]: true;\n  };\n};\nexport type QueryThunk = AsyncThunk<ThunkResult, QueryThunkArg, ThunkApiMetaConfig>;\nexport type InfiniteQueryThunk<D extends InfiniteQueryDefinition<any, any, any, any, any>> = AsyncThunk<ThunkResult, InfiniteQueryThunkArg<D>, ThunkApiMetaConfig>;\nexport type MutationThunk = AsyncThunk<ThunkResult, MutationThunkArg, ThunkApiMetaConfig>;\nfunction defaultTransformResponse(baseQueryReturnValue: unknown) {\n  return baseQueryReturnValue;\n}\nexport type MaybeDrafted<T> = T | Draft<T>;\nexport type Recipe<T> = (data: MaybeDrafted<T>) => void | MaybeDrafted<T>;\nexport type UpsertRecipe<T> = (data: MaybeDrafted<T> | undefined) => void | MaybeDrafted<T>;\nexport type PatchQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFrom<Definitions[EndpointName]>, patches: readonly Patch[], updateProvided?: boolean) => ThunkAction<void, PartialState, any, UnknownAction>;\nexport type AllQueryKeys<Definitions extends EndpointDefinitions> = QueryKeys<Definitions> | InfiniteQueryKeys<Definitions>;\nexport type QueryArgFromAnyQueryDefinition<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryArgFrom<Definitions[EndpointName]> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? QueryArgFrom<Definitions[EndpointName]> : never;\nexport type DataFromAnyQueryDefinition<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteData<ResultTypeFrom<Definitions[EndpointName]>, PageParamFrom<Definitions[EndpointName]>> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? ResultTypeFrom<Definitions[EndpointName]> : unknown;\nexport type UpsertThunkResult<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryActionCreatorResult<Definitions[EndpointName]> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? QueryActionCreatorResult<Definitions[EndpointName]> : QueryActionCreatorResult<never>;\nexport type UpdateQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>, updateRecipe: Recipe<DataFromAnyQueryDefinition<Definitions, EndpointName>>, updateProvided?: boolean) => ThunkAction<PatchCollection, PartialState, any, UnknownAction>;\nexport type UpsertQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>, value: DataFromAnyQueryDefinition<Definitions, EndpointName>) => ThunkAction<UpsertThunkResult<Definitions, EndpointName>, PartialState, any, UnknownAction>;\n\n/**\n * An object returned from dispatching a `api.util.updateQueryData` call.\n */\nexport type PatchCollection = {\n  /**\n   * An `immer` Patch describing the cache update.\n   */\n  patches: Patch[];\n  /**\n   * An `immer` Patch to revert the cache update.\n   */\n  inversePatches: Patch[];\n  /**\n   * A function that will undo the cache update.\n   */\n  undo: () => void;\n};\ntype TransformCallback = (baseQueryReturnValue: unknown, meta: unknown, arg: unknown) => any;\nexport const addShouldAutoBatch = <T extends Record<string, any>,>(arg: T = {} as T): T & {\n  [SHOULD_AUTOBATCH]: true;\n} => {\n  return {\n    ...arg,\n    [SHOULD_AUTOBATCH]: true\n  };\n};\nexport function buildThunks<BaseQuery extends BaseQueryFn, ReducerPath extends string, Definitions extends EndpointDefinitions>({\n  reducerPath,\n  baseQuery,\n  context: {\n    endpointDefinitions\n  },\n  serializeQueryArgs,\n  api,\n  assertTagType,\n  selectors,\n  onSchemaFailure,\n  catchSchemaFailure: globalCatchSchemaFailure,\n  skipSchemaValidation: globalSkipSchemaValidation\n}: {\n  baseQuery: BaseQuery;\n  reducerPath: ReducerPath;\n  context: ApiContext<Definitions>;\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  api: Api<BaseQuery, Definitions, ReducerPath, any>;\n  assertTagType: AssertTagTypes;\n  selectors: AllSelectors;\n  onSchemaFailure: SchemaFailureHandler | undefined;\n  catchSchemaFailure: SchemaFailureConverter<BaseQuery> | undefined;\n  skipSchemaValidation: boolean | SchemaType[] | undefined;\n}) {\n  type State = RootState<any, string, ReducerPath>;\n  const patchQueryData: PatchQueryDataThunk<EndpointDefinitions, State> = (endpointName, arg, patches, updateProvided) => (dispatch, getState) => {\n    const endpointDefinition = endpointDefinitions[endpointName];\n    const queryCacheKey = serializeQueryArgs({\n      queryArgs: arg,\n      endpointDefinition,\n      endpointName\n    });\n    dispatch(api.internalActions.queryResultPatched({\n      queryCacheKey,\n      patches\n    }));\n    if (!updateProvided) {\n      return;\n    }\n    const newValue = api.endpoints[endpointName].select(arg)(\n    // Work around TS 4.1 mismatch\n    getState() as RootState<any, any, any>);\n    const providedTags = calculateProvidedBy(endpointDefinition.providesTags, newValue.data, undefined, arg, {}, assertTagType);\n    dispatch(api.internalActions.updateProvidedBy([{\n      queryCacheKey,\n      providedTags\n    }]));\n  };\n  function addToStart<T>(items: Array<T>, item: T, max = 0): Array<T> {\n    const newItems = [item, ...items];\n    return max && newItems.length > max ? newItems.slice(0, -1) : newItems;\n  }\n  function addToEnd<T>(items: Array<T>, item: T, max = 0): Array<T> {\n    const newItems = [...items, item];\n    return max && newItems.length > max ? newItems.slice(1) : newItems;\n  }\n  const updateQueryData: UpdateQueryDataThunk<EndpointDefinitions, State> = (endpointName, arg, updateRecipe, updateProvided = true) => (dispatch, getState) => {\n    const endpointDefinition = api.endpoints[endpointName];\n    const currentState = endpointDefinition.select(arg)(\n    // Work around TS 4.1 mismatch\n    getState() as RootState<any, any, any>);\n    const ret: PatchCollection = {\n      patches: [],\n      inversePatches: [],\n      undo: () => dispatch(api.util.patchQueryData(endpointName, arg, ret.inversePatches, updateProvided))\n    };\n    if (currentState.status === STATUS_UNINITIALIZED) {\n      return ret;\n    }\n    let newValue;\n    if ('data' in currentState) {\n      if (isDraftable(currentState.data)) {\n        const [value, patches, inversePatches] = produceWithPatches(currentState.data, updateRecipe);\n        ret.patches.push(...patches);\n        ret.inversePatches.push(...inversePatches);\n        newValue = value;\n      } else {\n        newValue = updateRecipe(currentState.data);\n        ret.patches.push({\n          op: 'replace',\n          path: [],\n          value: newValue\n        });\n        ret.inversePatches.push({\n          op: 'replace',\n          path: [],\n          value: currentState.data\n        });\n      }\n    }\n    if (ret.patches.length === 0) {\n      return ret;\n    }\n    dispatch(api.util.patchQueryData(endpointName, arg, ret.patches, updateProvided));\n    return ret;\n  };\n  const upsertQueryData: UpsertQueryDataThunk<Definitions, State> = (endpointName, arg, value) => dispatch => {\n    type EndpointName = typeof endpointName;\n    const res = dispatch((api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>).initiate(arg, {\n      subscribe: false,\n      forceRefetch: true,\n      [forceQueryFnSymbol]: () => ({\n        data: value\n      })\n    })) as UpsertThunkResult<Definitions, EndpointName>;\n    return res;\n  };\n  const getTransformCallbackForEndpoint = (endpointDefinition: EndpointDefinition<any, any, any, any>, transformFieldName: 'transformResponse' | 'transformErrorResponse'): TransformCallback => {\n    return endpointDefinition.query && endpointDefinition[transformFieldName] ? endpointDefinition[transformFieldName]! as TransformCallback : defaultTransformResponse;\n  };\n\n  // The generic async payload function for all of our thunks\n  const executeEndpoint: AsyncThunkPayloadCreator<ThunkResult, QueryThunkArg | MutationThunkArg | InfiniteQueryThunkArg<any>, ThunkApiMetaConfig & {\n    state: RootState<any, string, ReducerPath>;\n  }> = async (arg, {\n    signal,\n    abort,\n    rejectWithValue,\n    fulfillWithValue,\n    dispatch,\n    getState,\n    extra\n  }) => {\n    const endpointDefinition = endpointDefinitions[arg.endpointName];\n    const {\n      metaSchema,\n      skipSchemaValidation = globalSkipSchemaValidation\n    } = endpointDefinition;\n    const isQuery = arg.type === ENDPOINT_QUERY;\n    try {\n      let transformResponse: TransformCallback = defaultTransformResponse;\n      const baseQueryApi = {\n        signal,\n        abort,\n        dispatch,\n        getState,\n        extra,\n        endpoint: arg.endpointName,\n        type: arg.type,\n        forced: isQuery ? isForcedQuery(arg, getState()) : undefined,\n        queryCacheKey: isQuery ? arg.queryCacheKey : undefined\n      };\n      const forceQueryFn = isQuery ? arg[forceQueryFnSymbol] : undefined;\n      let finalQueryReturnValue: QueryReturnValue;\n\n      // Infinite query wrapper, which executes the request and returns\n      // the InfiniteData `{pages, pageParams}` structure\n      const fetchPage = async (data: InfiniteData<unknown, unknown>, param: unknown, maxPages: number, previous?: boolean): Promise<QueryReturnValue> => {\n        // This should handle cases where there is no `getPrevPageParam`,\n        // or `getPPP` returned nullish\n        if (param == null && data.pages.length) {\n          return Promise.resolve({\n            data\n          });\n        }\n        const finalQueryArg: InfiniteQueryCombinedArg<any, any> = {\n          queryArg: arg.originalArgs,\n          pageParam: param\n        };\n        const pageResponse = await executeRequest(finalQueryArg);\n        const addTo = previous ? addToStart : addToEnd;\n        return {\n          data: {\n            pages: addTo(data.pages, pageResponse.data, maxPages),\n            pageParams: addTo(data.pageParams, param, maxPages)\n          },\n          meta: pageResponse.meta\n        };\n      };\n\n      // Wrapper for executing either `query` or `queryFn`,\n      // and handling any errors\n      async function executeRequest(finalQueryArg: unknown): Promise<QueryReturnValue> {\n        let result: QueryReturnValue;\n        const {\n          extraOptions,\n          argSchema,\n          rawResponseSchema,\n          responseSchema\n        } = endpointDefinition;\n        if (argSchema && !shouldSkip(skipSchemaValidation, 'arg')) {\n          finalQueryArg = await parseWithSchema(argSchema, finalQueryArg, 'argSchema', {} // we don't have a meta yet, so we can't pass it\n          );\n        }\n        if (forceQueryFn) {\n          // upsertQueryData relies on this to pass in the user-provided value\n          result = forceQueryFn();\n        } else if (endpointDefinition.query) {\n          // We should only run `transformResponse` when the endpoint has a `query` method,\n          // and we're not doing an `upsertQueryData`.\n          transformResponse = getTransformCallbackForEndpoint(endpointDefinition, 'transformResponse');\n          result = await baseQuery(endpointDefinition.query(finalQueryArg as any), baseQueryApi, extraOptions as any);\n        } else {\n          result = await endpointDefinition.queryFn(finalQueryArg as any, baseQueryApi, extraOptions as any, arg => baseQuery(arg, baseQueryApi, extraOptions as any));\n        }\n        if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n          const what = endpointDefinition.query ? '`baseQuery`' : '`queryFn`';\n          let err: undefined | string;\n          if (!result) {\n            err = `${what} did not return anything.`;\n          } else if (typeof result !== 'object') {\n            err = `${what} did not return an object.`;\n          } else if (result.error && result.data) {\n            err = `${what} returned an object containing both \\`error\\` and \\`result\\`.`;\n          } else if (result.error === undefined && result.data === undefined) {\n            err = `${what} returned an object containing neither a valid \\`error\\` and \\`result\\`. At least one of them should not be \\`undefined\\``;\n          } else {\n            for (const key of Object.keys(result)) {\n              if (key !== 'error' && key !== 'data' && key !== 'meta') {\n                err = `The object returned by ${what} has the unknown property ${key}.`;\n                break;\n              }\n            }\n          }\n          if (err) {\n            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);\n          }\n        }\n        if (result.error) throw new HandledError(result.error, result.meta);\n        let {\n          data\n        } = result;\n        if (rawResponseSchema && !shouldSkip(skipSchemaValidation, 'rawResponse')) {\n          data = await parseWithSchema(rawResponseSchema, result.data, 'rawResponseSchema', result.meta);\n        }\n        let transformedResponse = await transformResponse(data, result.meta, finalQueryArg);\n        if (responseSchema && !shouldSkip(skipSchemaValidation, 'response')) {\n          transformedResponse = await parseWithSchema(responseSchema, transformedResponse, 'responseSchema', result.meta);\n        }\n        return {\n          ...result,\n          data: transformedResponse\n        };\n      }\n      if (isQuery && 'infiniteQueryOptions' in endpointDefinition) {\n        // This is an infinite query endpoint\n        const {\n          infiniteQueryOptions\n        } = endpointDefinition;\n\n        // Runtime checks should guarantee this is a positive number if provided\n        const {\n          maxPages = Infinity\n        } = infiniteQueryOptions;\n\n        // Priority: per-call override > endpoint config > default (true)\n        const refetchCachedPages = (arg as InfiniteQueryThunkArg<any>).refetchCachedPages ?? infiniteQueryOptions.refetchCachedPages ?? true;\n        let result: QueryReturnValue;\n\n        // Start by looking up the existing InfiniteData value from state,\n        // falling back to an empty value if it doesn't exist yet\n        const blankData = {\n          pages: [],\n          pageParams: []\n        };\n        const cachedData = selectors.selectQueryEntry(getState(), arg.queryCacheKey)?.data as InfiniteData<unknown, unknown> | undefined;\n\n        // When the arg changes or the user forces a refetch,\n        // we don't include the `direction` flag. This lets us distinguish\n        // between actually refetching with a forced query, vs just fetching\n        // the next page.\n        const isForcedQueryNeedingRefetch =\n        // arg.forceRefetch\n        isForcedQuery(arg, getState()) && !(arg as InfiniteQueryThunkArg<any>).direction;\n        const existingData = (isForcedQueryNeedingRefetch || !cachedData ? blankData : cachedData) as InfiniteData<unknown, unknown>;\n\n        // If the thunk specified a direction and we do have at least one page,\n        // fetch the next or previous page\n        if ('direction' in arg && arg.direction && existingData.pages.length) {\n          const previous = arg.direction === 'backward';\n          const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;\n          const param = pageParamFn(infiniteQueryOptions, existingData, arg.originalArgs);\n          result = await fetchPage(existingData, param, maxPages, previous);\n        } else {\n          // Otherwise, fetch the first page and then any remaining pages\n\n          const {\n            initialPageParam = infiniteQueryOptions.initialPageParam\n          } = arg as InfiniteQueryThunkArg<any>;\n\n          // If we're doing a refetch, we should start from\n          // the first page we have cached.\n          // Otherwise, we should start from the initialPageParam\n          const cachedPageParams = cachedData?.pageParams ?? [];\n          const firstPageParam = cachedPageParams[0] ?? initialPageParam;\n          const totalPages = cachedPageParams.length;\n\n          // Fetch first page\n          result = await fetchPage(existingData, firstPageParam, maxPages);\n          if (forceQueryFn) {\n            // HACK `upsertQueryData` expects the user to pass in the `{pages, pageParams}` structure,\n            // but `fetchPage` treats that as `pages[0]`. We have to manually un-nest it.\n            result = {\n              data: (result.data as InfiniteData<unknown, unknown>).pages[0]\n            } as QueryReturnValue;\n          }\n          if (refetchCachedPages) {\n            // Fetch remaining pages\n            for (let i = 1; i < totalPages; i++) {\n              const param = getNextPageParam(infiniteQueryOptions, result.data as InfiniteData<unknown, unknown>, arg.originalArgs);\n              result = await fetchPage(result.data as InfiniteData<unknown, unknown>, param, maxPages);\n            }\n          }\n        }\n        finalQueryReturnValue = result;\n      } else {\n        // Non-infinite endpoint. Just run the one request.\n        finalQueryReturnValue = await executeRequest(arg.originalArgs);\n      }\n      if (metaSchema && !shouldSkip(skipSchemaValidation, 'meta') && finalQueryReturnValue.meta) {\n        finalQueryReturnValue.meta = await parseWithSchema(metaSchema, finalQueryReturnValue.meta, 'metaSchema', finalQueryReturnValue.meta);\n      }\n\n      // console.log('Final result: ', transformedData)\n      return fulfillWithValue(finalQueryReturnValue.data, addShouldAutoBatch({\n        fulfilledTimeStamp: Date.now(),\n        baseQueryMeta: finalQueryReturnValue.meta\n      }));\n    } catch (error) {\n      let caughtError = error;\n      if (caughtError instanceof HandledError) {\n        let transformErrorResponse = getTransformCallbackForEndpoint(endpointDefinition, 'transformErrorResponse');\n        const {\n          rawErrorResponseSchema,\n          errorResponseSchema\n        } = endpointDefinition;\n        let {\n          value,\n          meta\n        } = caughtError;\n        try {\n          if (rawErrorResponseSchema && !shouldSkip(skipSchemaValidation, 'rawErrorResponse')) {\n            value = await parseWithSchema(rawErrorResponseSchema, value, 'rawErrorResponseSchema', meta);\n          }\n          if (metaSchema && !shouldSkip(skipSchemaValidation, 'meta')) {\n            meta = await parseWithSchema(metaSchema, meta, 'metaSchema', meta);\n          }\n          let transformedErrorResponse = await transformErrorResponse(value, meta, arg.originalArgs);\n          if (errorResponseSchema && !shouldSkip(skipSchemaValidation, 'errorResponse')) {\n            transformedErrorResponse = await parseWithSchema(errorResponseSchema, transformedErrorResponse, 'errorResponseSchema', meta);\n          }\n          return rejectWithValue(transformedErrorResponse, addShouldAutoBatch({\n            baseQueryMeta: meta\n          }));\n        } catch (e) {\n          caughtError = e;\n        }\n      }\n      try {\n        if (caughtError instanceof NamedSchemaError) {\n          const info: SchemaFailureInfo = {\n            endpoint: arg.endpointName,\n            arg: arg.originalArgs,\n            type: arg.type,\n            queryCacheKey: isQuery ? arg.queryCacheKey : undefined\n          };\n          endpointDefinition.onSchemaFailure?.(caughtError, info);\n          onSchemaFailure?.(caughtError, info);\n          const {\n            catchSchemaFailure = globalCatchSchemaFailure\n          } = endpointDefinition;\n          if (catchSchemaFailure) {\n            return rejectWithValue(catchSchemaFailure(caughtError, info), addShouldAutoBatch({\n              baseQueryMeta: caughtError._bqMeta\n            }));\n          }\n        }\n      } catch (e) {\n        caughtError = e;\n      }\n      if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production') {\n        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\".`, caughtError);\n      } else {\n        console.error(caughtError);\n      }\n      throw caughtError;\n    }\n  };\n  function isForcedQuery(arg: QueryThunkArg, state: RootState<any, string, ReducerPath>) {\n    const requestState = selectors.selectQueryEntry(state, arg.queryCacheKey);\n    const baseFetchOnMountOrArgChange = selectors.selectConfig(state).refetchOnMountOrArgChange;\n    const fulfilledVal = requestState?.fulfilledTimeStamp;\n    const refetchVal = arg.forceRefetch ?? (arg.subscribe && baseFetchOnMountOrArgChange);\n    if (refetchVal) {\n      // Return if it's true or compare the dates because it must be a number\n      return refetchVal === true || (Number(new Date()) - Number(fulfilledVal)) / 1000 >= refetchVal;\n    }\n    return false;\n  }\n  const createQueryThunk = <ThunkArgType extends QueryThunkArg | InfiniteQueryThunkArg<any>,>() => {\n    const generatedQueryThunk = createAsyncThunk<ThunkResult, ThunkArgType, ThunkApiMetaConfig & {\n      state: RootState<any, string, ReducerPath>;\n    }>(`${reducerPath}/executeQuery`, executeEndpoint, {\n      getPendingMeta({\n        arg\n      }) {\n        const endpointDefinition = endpointDefinitions[arg.endpointName];\n        return addShouldAutoBatch({\n          startedTimeStamp: Date.now(),\n          ...(isInfiniteQueryDefinition(endpointDefinition) ? {\n            direction: (arg as InfiniteQueryThunkArg<any>).direction\n          } : {})\n        });\n      },\n      condition(queryThunkArg, {\n        getState\n      }) {\n        const state = getState();\n        const requestState = selectors.selectQueryEntry(state, queryThunkArg.queryCacheKey);\n        const fulfilledVal = requestState?.fulfilledTimeStamp;\n        const currentArg = queryThunkArg.originalArgs;\n        const previousArg = requestState?.originalArgs;\n        const endpointDefinition = endpointDefinitions[queryThunkArg.endpointName];\n        const direction = (queryThunkArg as InfiniteQueryThunkArg<any>).direction;\n\n        // Order of these checks matters.\n        // In order for `upsertQueryData` to successfully run while an existing request is in flight,\n        /// we have to check for that first, otherwise `queryThunk` will bail out and not run at all.\n        if (isUpsertQuery(queryThunkArg)) {\n          return true;\n        }\n\n        // Don't retry a request that's currently in-flight\n        if (requestState?.status === 'pending') {\n          return false;\n        }\n\n        // if this is forced, continue\n        if (isForcedQuery(queryThunkArg, state)) {\n          return true;\n        }\n        if (isQueryDefinition(endpointDefinition) && endpointDefinition?.forceRefetch?.({\n          currentArg,\n          previousArg,\n          endpointState: requestState,\n          state\n        })) {\n          return true;\n        }\n\n        // Pull from the cache unless we explicitly force refetch or qualify based on time\n        if (fulfilledVal && !direction) {\n          // Value is cached and we didn't specify to refresh, skip it.\n          return false;\n        }\n        return true;\n      },\n      dispatchConditionRejection: true\n    });\n    return generatedQueryThunk;\n  };\n  const queryThunk = createQueryThunk<QueryThunkArg>();\n  const infiniteQueryThunk = createQueryThunk<InfiniteQueryThunkArg<any>>();\n  const mutationThunk = createAsyncThunk<ThunkResult, MutationThunkArg, ThunkApiMetaConfig & {\n    state: RootState<any, string, ReducerPath>;\n  }>(`${reducerPath}/executeMutation`, executeEndpoint, {\n    getPendingMeta() {\n      return addShouldAutoBatch({\n        startedTimeStamp: Date.now()\n      });\n    }\n  });\n  const hasTheForce = (options: any): options is {\n    force: boolean;\n  } => 'force' in options;\n  const hasMaxAge = (options: any): options is {\n    ifOlderThan: false | number;\n  } => 'ifOlderThan' in options;\n  const prefetch = <EndpointName extends QueryKeys<Definitions>,>(endpointName: EndpointName, arg: any, options: PrefetchOptions = {}): ThunkAction<void, any, any, UnknownAction> => (dispatch: ThunkDispatch<any, any, any>, getState: () => any) => {\n    const force = hasTheForce(options) && options.force;\n    const maxAge = hasMaxAge(options) && options.ifOlderThan;\n    const queryAction = (force: boolean = true) => {\n      const options: StartQueryActionCreatorOptions = {\n        forceRefetch: force,\n        subscribe: false\n      };\n      return (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).initiate(arg, options);\n    };\n    const latestStateValue = (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).select(arg)(getState());\n    if (force) {\n      dispatch(queryAction());\n    } else if (maxAge) {\n      const lastFulfilledTs = latestStateValue?.fulfilledTimeStamp;\n      if (!lastFulfilledTs) {\n        dispatch(queryAction());\n        return;\n      }\n      const shouldRetrigger = (Number(new Date()) - Number(new Date(lastFulfilledTs))) / 1000 >= maxAge;\n      if (shouldRetrigger) {\n        dispatch(queryAction());\n      }\n    } else {\n      // If prefetching with no options, just let it try\n      dispatch(queryAction(false));\n    }\n  };\n  function matchesEndpoint(endpointName: string) {\n    return (action: any): action is UnknownAction => action?.meta?.arg?.endpointName === endpointName;\n  }\n  function buildMatchThunkActions<Thunk extends AsyncThunk<any, QueryThunkArg, ThunkApiMetaConfig> | AsyncThunk<any, MutationThunkArg, ThunkApiMetaConfig>>(thunk: Thunk, endpointName: string) {\n    return {\n      matchPending: isAllOf(isPending(thunk), matchesEndpoint(endpointName)),\n      matchFulfilled: isAllOf(isFulfilled(thunk), matchesEndpoint(endpointName)),\n      matchRejected: isAllOf(isRejected(thunk), matchesEndpoint(endpointName))\n    } as Matchers<Thunk, any>;\n  }\n  return {\n    queryThunk,\n    mutationThunk,\n    infiniteQueryThunk,\n    prefetch,\n    updateQueryData,\n    upsertQueryData,\n    patchQueryData,\n    buildMatchThunkActions\n  };\n}\nexport function getNextPageParam(options: InfiniteQueryConfigOptions<unknown, unknown, unknown>, {\n  pages,\n  pageParams\n}: InfiniteData<unknown, unknown>, queryArg: unknown): unknown | undefined {\n  const lastIndex = pages.length - 1;\n  return options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams, queryArg);\n}\nexport function getPreviousPageParam(options: InfiniteQueryConfigOptions<unknown, unknown, unknown>, {\n  pages,\n  pageParams\n}: InfiniteData<unknown, unknown>, queryArg: unknown): unknown | undefined {\n  return options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams, queryArg);\n}\nexport function calculateProvidedByThunk(action: UnwrapPromise<ReturnType<ReturnType<QueryThunk>> | ReturnType<ReturnType<MutationThunk>> | ReturnType<ReturnType<InfiniteQueryThunk<any>>>>, type: 'providesTags' | 'invalidatesTags', endpointDefinitions: EndpointDefinitions, assertTagType: AssertTagTypes) {\n  return calculateProvidedBy(endpointDefinitions[action.meta.arg.endpointName][type] as ResultDescription<any, any, any, any, any>, isFulfilled(action) ? action.payload : undefined, isRejectedWithValue(action) ? action.payload : undefined, action.meta.arg.originalArgs, 'baseQueryMeta' in action.meta ? action.meta.baseQueryMeta : undefined, assertTagType);\n}","import type { Draft } from 'immer';\nimport { current, isDraft } from '../utils/immerImports';\nexport function getCurrent<T>(value: T | Draft<T>): T {\n  return (isDraft(value) ? current(value) : value) as T;\n}","import type { PayloadAction } from '@reduxjs/toolkit';\nimport { combineReducers, createAction, createSlice, isAnyOf, isFulfilled, isRejectedWithValue, createNextState, prepareAutoBatched, SHOULD_AUTOBATCH, nanoid } from './rtkImports';\nimport type { QuerySubstateIdentifier, QuerySubState, MutationSubstateIdentifier, MutationSubState, MutationState, QueryState, InvalidationState, Subscribers, QueryCacheKey, SubscriptionState, ConfigState, InfiniteQuerySubState, InfiniteQueryDirection } from './apiState';\nimport { STATUS_FULFILLED, STATUS_PENDING, QueryStatus, STATUS_REJECTED, STATUS_UNINITIALIZED } from './apiState';\nimport type { AllQueryKeys, QueryArgFromAnyQueryDefinition, DataFromAnyQueryDefinition, InfiniteQueryThunk, MutationThunk, QueryThunk, QueryThunkArg } from './buildThunks';\nimport { calculateProvidedByThunk } from './buildThunks';\nimport { ENDPOINT_QUERY, isInfiniteQueryDefinition, type AssertTagTypes, type EndpointDefinitions, type FullTagDescription, type QueryDefinition } from '../endpointDefinitions';\nimport type { Patch } from 'immer';\nimport { applyPatches, original, isDraft } from '../utils/immerImports';\nimport { onFocus, onFocusLost, onOffline, onOnline } from './setupListeners';\nimport { isDocumentVisible, isOnline, copyWithStructuralSharing } from '../utils';\nimport type { ApiContext } from '../apiTypes';\nimport { isUpsertQuery } from './buildInitiate';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { UnwrapPromise } from '../tsHelpers';\nimport { getCurrent } from '../utils/getCurrent';\n\n/**\n * A typesafe single entry to be upserted into the cache\n */\nexport type NormalizedQueryUpsertEntry<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = {\n  endpointName: EndpointName;\n  arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>;\n  value: DataFromAnyQueryDefinition<Definitions, EndpointName>;\n};\n\n/**\n * The internal version that is not typesafe since we can't carry the generics through `createSlice`\n */\ntype NormalizedQueryUpsertEntryPayload = {\n  endpointName: string;\n  arg: unknown;\n  value: unknown;\n};\nexport type ProcessedQueryUpsertEntry = {\n  queryDescription: QueryThunkArg;\n  value: unknown;\n};\n\n/**\n * A typesafe representation of a util action creator that accepts cache entry descriptions to upsert\n */\nexport type UpsertEntries<Definitions extends EndpointDefinitions> = (<EndpointNames extends Array<AllQueryKeys<Definitions>>>(entries: [...{ [I in keyof EndpointNames]: NormalizedQueryUpsertEntry<Definitions, EndpointNames[I]> }]) => PayloadAction<NormalizedQueryUpsertEntryPayload[]>) & {\n  match: (action: unknown) => action is PayloadAction<NormalizedQueryUpsertEntryPayload[]>;\n};\nfunction updateQuerySubstateIfExists(state: QueryState<any>, queryCacheKey: QueryCacheKey, update: (substate: QuerySubState<any> | InfiniteQuerySubState<any>) => void) {\n  const substate = state[queryCacheKey];\n  if (substate) {\n    update(substate);\n  }\n}\nexport function getMutationCacheKey(id: MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}): string;\nexport function getMutationCacheKey(id: {\n  fixedCacheKey?: string;\n  requestId?: string;\n}): string | undefined;\nexport function getMutationCacheKey(id: {\n  fixedCacheKey?: string;\n  requestId?: string;\n} | MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}): string | undefined {\n  return ('arg' in id ? id.arg.fixedCacheKey : id.fixedCacheKey) ?? id.requestId;\n}\nfunction updateMutationSubstateIfExists(state: MutationState<any>, id: MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}, update: (substate: MutationSubState<any>) => void) {\n  const substate = state[getMutationCacheKey(id)];\n  if (substate) {\n    update(substate);\n  }\n}\nconst initialState = {} as any;\nexport function buildSlice({\n  reducerPath,\n  queryThunk,\n  mutationThunk,\n  serializeQueryArgs,\n  context: {\n    endpointDefinitions: definitions,\n    apiUid,\n    extractRehydrationInfo,\n    hasRehydrationInfo\n  },\n  assertTagType,\n  config\n}: {\n  reducerPath: string;\n  queryThunk: QueryThunk;\n  infiniteQueryThunk: InfiniteQueryThunk<any>;\n  mutationThunk: MutationThunk;\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  context: ApiContext<EndpointDefinitions>;\n  assertTagType: AssertTagTypes;\n  config: Omit<ConfigState<string>, 'online' | 'focused' | 'middlewareRegistered'>;\n}) {\n  const resetApiState = createAction(`${reducerPath}/resetApiState`);\n  function writePendingCacheEntry(draft: QueryState<any>, arg: QueryThunkArg, upserting: boolean, meta: {\n    arg: QueryThunkArg;\n    requestId: string;\n    // requestStatus: 'pending'\n  } & {\n    startedTimeStamp: number;\n  }) {\n    draft[arg.queryCacheKey] ??= {\n      status: STATUS_UNINITIALIZED,\n      endpointName: arg.endpointName\n    };\n    updateQuerySubstateIfExists(draft, arg.queryCacheKey, substate => {\n      substate.status = STATUS_PENDING;\n      substate.requestId = upserting && substate.requestId ?\n      // for `upsertQuery` **updates**, keep the current `requestId`\n      substate.requestId :\n      // for normal queries or `upsertQuery` **inserts** always update the `requestId`\n      meta.requestId;\n      if (arg.originalArgs !== undefined) {\n        substate.originalArgs = arg.originalArgs;\n      }\n      substate.startedTimeStamp = meta.startedTimeStamp;\n      const endpointDefinition = definitions[meta.arg.endpointName];\n      if (isInfiniteQueryDefinition(endpointDefinition) && 'direction' in arg) {\n        ;\n        (substate as InfiniteQuerySubState<any>).direction = arg.direction as InfiniteQueryDirection;\n      }\n    });\n  }\n  function writeFulfilledCacheEntry(draft: QueryState<any>, meta: {\n    arg: QueryThunkArg;\n    requestId: string;\n  } & {\n    fulfilledTimeStamp: number;\n    baseQueryMeta: unknown;\n  }, payload: unknown, upserting: boolean) {\n    updateQuerySubstateIfExists(draft, meta.arg.queryCacheKey, substate => {\n      if (substate.requestId !== meta.requestId && !upserting) return;\n      const {\n        merge\n      } = definitions[meta.arg.endpointName] as QueryDefinition<any, any, any, any>;\n      substate.status = STATUS_FULFILLED;\n      if (merge) {\n        if (substate.data !== undefined) {\n          const {\n            fulfilledTimeStamp,\n            arg,\n            baseQueryMeta,\n            requestId\n          } = meta;\n          // There's existing cache data. Let the user merge it in themselves.\n          // We're already inside an Immer-powered reducer, and the user could just mutate `substate.data`\n          // themselves inside of `merge()`. But, they might also want to return a new value.\n          // Try to let Immer figure that part out, save the result, and assign it to `substate.data`.\n          let newData = createNextState(substate.data, draftSubstateData => {\n            // As usual with Immer, you can mutate _or_ return inside here, but not both\n            return merge(draftSubstateData, payload, {\n              arg: arg.originalArgs,\n              baseQueryMeta,\n              fulfilledTimeStamp,\n              requestId\n            });\n          });\n          substate.data = newData;\n        } else {\n          // Presumably a fresh request. Just cache the response data.\n          substate.data = payload;\n        }\n      } else {\n        // Assign or safely update the cache data.\n        substate.data = definitions[meta.arg.endpointName].structuralSharing ?? true ? copyWithStructuralSharing(isDraft(substate.data) ? original(substate.data) : substate.data, payload) : payload;\n      }\n      delete substate.error;\n      substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;\n    });\n  }\n  const querySlice = createSlice({\n    name: `${reducerPath}/queries`,\n    initialState: initialState as QueryState<any>,\n    reducers: {\n      removeQueryResult: {\n        reducer(draft, {\n          payload: {\n            queryCacheKey\n          }\n        }: PayloadAction<QuerySubstateIdentifier>) {\n          delete draft[queryCacheKey];\n        },\n        prepare: prepareAutoBatched<QuerySubstateIdentifier>()\n      },\n      cacheEntriesUpserted: {\n        reducer(draft, action: PayloadAction<ProcessedQueryUpsertEntry[], string, {\n          RTK_autoBatch: boolean;\n          requestId: string;\n          timestamp: number;\n        }>) {\n          for (const entry of action.payload) {\n            const {\n              queryDescription: arg,\n              value\n            } = entry;\n            writePendingCacheEntry(draft, arg, true, {\n              arg,\n              requestId: action.meta.requestId,\n              startedTimeStamp: action.meta.timestamp\n            });\n            writeFulfilledCacheEntry(draft, {\n              arg,\n              requestId: action.meta.requestId,\n              fulfilledTimeStamp: action.meta.timestamp,\n              baseQueryMeta: {}\n            }, value,\n            // We know we're upserting here\n            true);\n          }\n        },\n        prepare: (payload: NormalizedQueryUpsertEntryPayload[]) => {\n          const queryDescriptions: ProcessedQueryUpsertEntry[] = payload.map(entry => {\n            const {\n              endpointName,\n              arg,\n              value\n            } = entry;\n            const endpointDefinition = definitions[endpointName];\n            const queryDescription: QueryThunkArg = {\n              type: ENDPOINT_QUERY as 'query',\n              endpointName,\n              originalArgs: entry.arg,\n              queryCacheKey: serializeQueryArgs({\n                queryArgs: arg,\n                endpointDefinition,\n                endpointName\n              })\n            };\n            return {\n              queryDescription,\n              value\n            };\n          });\n          const result = {\n            payload: queryDescriptions,\n            meta: {\n              [SHOULD_AUTOBATCH]: true,\n              requestId: nanoid(),\n              timestamp: Date.now()\n            }\n          };\n          return result;\n        }\n      },\n      queryResultPatched: {\n        reducer(draft, {\n          payload: {\n            queryCacheKey,\n            patches\n          }\n        }: PayloadAction<QuerySubstateIdentifier & {\n          patches: readonly Patch[];\n        }>) {\n          updateQuerySubstateIfExists(draft, queryCacheKey, substate => {\n            substate.data = applyPatches(substate.data as any, patches.concat());\n          });\n        },\n        prepare: prepareAutoBatched<QuerySubstateIdentifier & {\n          patches: readonly Patch[];\n        }>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(queryThunk.pending, (draft, {\n        meta,\n        meta: {\n          arg\n        }\n      }) => {\n        const upserting = isUpsertQuery(arg);\n        writePendingCacheEntry(draft, arg, upserting, meta);\n      }).addCase(queryThunk.fulfilled, (draft, {\n        meta,\n        payload\n      }) => {\n        const upserting = isUpsertQuery(meta.arg);\n        writeFulfilledCacheEntry(draft, meta, payload, upserting);\n      }).addCase(queryThunk.rejected, (draft, {\n        meta: {\n          condition,\n          arg,\n          requestId\n        },\n        error,\n        payload\n      }) => {\n        updateQuerySubstateIfExists(draft, arg.queryCacheKey, substate => {\n          if (condition) {\n            // request was aborted due to condition (another query already running)\n          } else {\n            // request failed\n            if (substate.requestId !== requestId) return;\n            substate.status = STATUS_REJECTED;\n            substate.error = (payload ?? error) as any;\n          }\n        });\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          queries\n        } = extractRehydrationInfo(action)!;\n        for (const [key, entry] of Object.entries(queries)) {\n          if (\n          // do not rehydrate entries that were currently in flight.\n          entry?.status === STATUS_FULFILLED || entry?.status === STATUS_REJECTED) {\n            draft[key] = entry;\n          }\n        }\n      });\n    }\n  });\n  const mutationSlice = createSlice({\n    name: `${reducerPath}/mutations`,\n    initialState: initialState as MutationState<any>,\n    reducers: {\n      removeMutationResult: {\n        reducer(draft, {\n          payload\n        }: PayloadAction<MutationSubstateIdentifier>) {\n          const cacheKey = getMutationCacheKey(payload);\n          if (cacheKey in draft) {\n            delete draft[cacheKey];\n          }\n        },\n        prepare: prepareAutoBatched<MutationSubstateIdentifier>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(mutationThunk.pending, (draft, {\n        meta,\n        meta: {\n          requestId,\n          arg,\n          startedTimeStamp\n        }\n      }) => {\n        if (!arg.track) return;\n        draft[getMutationCacheKey(meta)] = {\n          requestId,\n          status: STATUS_PENDING,\n          endpointName: arg.endpointName,\n          startedTimeStamp\n        };\n      }).addCase(mutationThunk.fulfilled, (draft, {\n        payload,\n        meta\n      }) => {\n        if (!meta.arg.track) return;\n        updateMutationSubstateIfExists(draft, meta, substate => {\n          if (substate.requestId !== meta.requestId) return;\n          substate.status = STATUS_FULFILLED;\n          substate.data = payload;\n          substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;\n        });\n      }).addCase(mutationThunk.rejected, (draft, {\n        payload,\n        error,\n        meta\n      }) => {\n        if (!meta.arg.track) return;\n        updateMutationSubstateIfExists(draft, meta, substate => {\n          if (substate.requestId !== meta.requestId) return;\n          substate.status = STATUS_REJECTED;\n          substate.error = (payload ?? error) as any;\n        });\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          mutations\n        } = extractRehydrationInfo(action)!;\n        for (const [key, entry] of Object.entries(mutations)) {\n          if (\n          // do not rehydrate entries that were currently in flight.\n          (entry?.status === STATUS_FULFILLED || entry?.status === STATUS_REJECTED) &&\n          // only rehydrate endpoints that were persisted using a `fixedCacheKey`\n          key !== entry?.requestId) {\n            draft[key] = entry;\n          }\n        }\n      });\n    }\n  });\n  type CalculateProvidedByAction = UnwrapPromise<ReturnType<ReturnType<QueryThunk>> | ReturnType<ReturnType<InfiniteQueryThunk<any>>>>;\n  const initialInvalidationState: InvalidationState<string> = {\n    tags: {},\n    keys: {}\n  };\n  const invalidationSlice = createSlice({\n    name: `${reducerPath}/invalidation`,\n    initialState: initialInvalidationState,\n    reducers: {\n      updateProvidedBy: {\n        reducer(draft, action: PayloadAction<Array<{\n          queryCacheKey: QueryCacheKey;\n          providedTags: readonly FullTagDescription<string>[];\n        }>>) {\n          for (const {\n            queryCacheKey,\n            providedTags\n          } of action.payload) {\n            removeCacheKeyFromTags(draft, queryCacheKey);\n            for (const {\n              type,\n              id\n            } of providedTags) {\n              const subscribedQueries = (draft.tags[type] ??= {})[id || '__internal_without_id'] ??= [];\n              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);\n              if (!alreadySubscribed) {\n                subscribedQueries.push(queryCacheKey);\n              }\n            }\n\n            // Remove readonly from the providedTags array\n            draft.keys[queryCacheKey] = providedTags as FullTagDescription<string>[];\n          }\n        },\n        prepare: prepareAutoBatched<Array<{\n          queryCacheKey: QueryCacheKey;\n          providedTags: readonly FullTagDescription<string>[];\n        }>>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(querySlice.actions.removeQueryResult, (draft, {\n        payload: {\n          queryCacheKey\n        }\n      }) => {\n        removeCacheKeyFromTags(draft, queryCacheKey);\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          provided\n        } = extractRehydrationInfo(action)!;\n        for (const [type, incomingTags] of Object.entries(provided.tags ?? {})) {\n          for (const [id, cacheKeys] of Object.entries(incomingTags)) {\n            const subscribedQueries = (draft.tags[type] ??= {})[id || '__internal_without_id'] ??= [];\n            for (const queryCacheKey of cacheKeys) {\n              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);\n              if (!alreadySubscribed) {\n                subscribedQueries.push(queryCacheKey);\n              }\n              draft.keys[queryCacheKey] = provided.keys[queryCacheKey];\n            }\n          }\n        }\n      }).addMatcher(isAnyOf(isFulfilled(queryThunk), isRejectedWithValue(queryThunk)), (draft, action) => {\n        writeProvidedTagsForQueries(draft, [action]);\n      }).addMatcher(querySlice.actions.cacheEntriesUpserted.match, (draft, action) => {\n        const mockActions: CalculateProvidedByAction[] = action.payload.map(({\n          queryDescription,\n          value\n        }) => {\n          return {\n            type: 'UNKNOWN',\n            payload: value,\n            meta: {\n              requestStatus: 'fulfilled',\n              requestId: 'UNKNOWN',\n              arg: queryDescription\n            }\n          };\n        });\n        writeProvidedTagsForQueries(draft, mockActions);\n      });\n    }\n  });\n  function removeCacheKeyFromTags(draft: InvalidationState<any>, queryCacheKey: QueryCacheKey) {\n    const existingTags = getCurrent(draft.keys[queryCacheKey] ?? []);\n\n    // Delete this cache key from any existing tags that may have provided it\n    for (const tag of existingTags) {\n      const tagType = tag.type;\n      const tagId = tag.id ?? '__internal_without_id';\n      const tagSubscriptions = draft.tags[tagType]?.[tagId];\n      if (tagSubscriptions) {\n        draft.tags[tagType][tagId] = getCurrent(tagSubscriptions).filter(qc => qc !== queryCacheKey);\n      }\n    }\n    delete draft.keys[queryCacheKey];\n  }\n  function writeProvidedTagsForQueries(draft: InvalidationState<string>, actions: CalculateProvidedByAction[]) {\n    const providedByEntries = actions.map(action => {\n      const providedTags = calculateProvidedByThunk(action, 'providesTags', definitions, assertTagType);\n      const {\n        queryCacheKey\n      } = action.meta.arg;\n      return {\n        queryCacheKey,\n        providedTags\n      };\n    });\n    invalidationSlice.caseReducers.updateProvidedBy(draft, invalidationSlice.actions.updateProvidedBy(providedByEntries));\n  }\n\n  // Dummy slice to generate actions\n  const subscriptionSlice = createSlice({\n    name: `${reducerPath}/subscriptions`,\n    initialState: initialState as SubscriptionState,\n    reducers: {\n      updateSubscriptionOptions(d, a: PayloadAction<{\n        endpointName: string;\n        requestId: string;\n        options: Subscribers[number];\n      } & QuerySubstateIdentifier>) {\n        // Dummy\n      },\n      unsubscribeQueryResult(d, a: PayloadAction<{\n        requestId: string;\n      } & QuerySubstateIdentifier>) {\n        // Dummy\n      },\n      internal_getRTKQSubscriptions() {}\n    }\n  });\n  const internalSubscriptionsSlice = createSlice({\n    name: `${reducerPath}/internalSubscriptions`,\n    initialState: initialState as SubscriptionState,\n    reducers: {\n      subscriptionsUpdated: {\n        reducer(state, action: PayloadAction<Patch[]>) {\n          return applyPatches(state, action.payload);\n        },\n        prepare: prepareAutoBatched<Patch[]>()\n      }\n    }\n  });\n  const configSlice = createSlice({\n    name: `${reducerPath}/config`,\n    initialState: {\n      online: isOnline(),\n      focused: isDocumentVisible(),\n      middlewareRegistered: false,\n      ...config\n    } as ConfigState<string>,\n    reducers: {\n      middlewareRegistered(state, {\n        payload\n      }: PayloadAction<string>) {\n        state.middlewareRegistered = state.middlewareRegistered === 'conflict' || apiUid !== payload ? 'conflict' : true;\n      }\n    },\n    extraReducers: builder => {\n      builder.addCase(onOnline, state => {\n        state.online = true;\n      }).addCase(onOffline, state => {\n        state.online = false;\n      }).addCase(onFocus, state => {\n        state.focused = true;\n      }).addCase(onFocusLost, state => {\n        state.focused = false;\n      })\n      // update the state to be a new object to be picked up as a \"state change\"\n      // by redux-persist's `autoMergeLevel2`\n      .addMatcher(hasRehydrationInfo, draft => ({\n        ...draft\n      }));\n    }\n  });\n  const combinedReducer = combineReducers({\n    queries: querySlice.reducer,\n    mutations: mutationSlice.reducer,\n    provided: invalidationSlice.reducer,\n    subscriptions: internalSubscriptionsSlice.reducer,\n    config: configSlice.reducer\n  });\n  const reducer: typeof combinedReducer = (state, action) => combinedReducer(resetApiState.match(action) ? undefined : state, action);\n  const actions = {\n    ...configSlice.actions,\n    ...querySlice.actions,\n    ...subscriptionSlice.actions,\n    ...internalSubscriptionsSlice.actions,\n    ...mutationSlice.actions,\n    ...invalidationSlice.actions,\n    resetApiState\n  };\n  return {\n    reducer,\n    actions\n  };\n}\nexport type SliceActions = ReturnType<typeof buildSlice>['actions'];","import type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { EndpointDefinition, EndpointDefinitions, InfiniteQueryArgFrom, InfiniteQueryDefinition, MutationDefinition, QueryArgFrom, QueryArgFromAnyQuery, QueryDefinition, ReducerPathFrom, TagDescription, TagTypesFrom } from '../endpointDefinitions';\nimport { expandTagDescription } from '../endpointDefinitions';\nimport { filterMap, isNotNullish } from '../utils';\nimport type { InfiniteData, InfiniteQueryConfigOptions, InfiniteQuerySubState, MutationSubState, QueryCacheKey, QueryState, QuerySubState, RequestStatusFlags, RootState as _RootState, QueryStatus } from './apiState';\nimport { STATUS_UNINITIALIZED, getRequestStatusFlags } from './apiState';\nimport { getMutationCacheKey } from './buildSlice';\nimport type { createSelector as _createSelector } from './rtkImports';\nimport { createNextState } from './rtkImports';\nimport { type AllQueryKeys, getNextPageParam, getPreviousPageParam } from './buildThunks';\nexport type SkipToken = typeof skipToken;\n/**\n * Can be passed into `useQuery`, `useQueryState` or `useQuerySubscription`\n * instead of the query argument to get the same effect as if setting\n * `skip: true` in the query options.\n *\n * Useful for scenarios where a query should be skipped when `arg` is `undefined`\n * and TypeScript complains about it because `arg` is not allowed to be passed\n * in as `undefined`, such as\n *\n * ```ts\n * // codeblock-meta title=\"will error if the query argument is not allowed to be undefined\" no-transpile\n * useSomeQuery(arg, { skip: !!arg })\n * ```\n *\n * ```ts\n * // codeblock-meta title=\"using skipToken instead\" no-transpile\n * useSomeQuery(arg ?? skipToken)\n * ```\n *\n * If passed directly into a query or mutation selector, that selector will always\n * return an uninitialized state.\n */\nexport const skipToken = /* @__PURE__ */Symbol.for('RTKQ/skipToken');\nexport type BuildSelectorsApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: QueryResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\nexport type BuildSelectorsApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: InfiniteQueryResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\nexport type BuildSelectorsApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: MutationResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\ntype QueryResultSelectorFactory<Definition extends QueryDefinition<any, any, any, any>, RootState> = (queryArg: QueryArgFrom<Definition> | SkipToken) => (state: RootState) => QueryResultSelectorResult<Definition>;\nexport type QueryResultSelectorResult<Definition extends QueryDefinition<any, any, any, any>> = QuerySubState<Definition> & RequestStatusFlags;\ntype InfiniteQueryResultSelectorFactory<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, RootState> = (queryArg: InfiniteQueryArgFrom<Definition> | SkipToken) => (state: RootState) => InfiniteQueryResultSelectorResult<Definition>;\nexport type InfiniteQueryResultFlags = {\n  hasNextPage: boolean;\n  hasPreviousPage: boolean;\n  isFetchingNextPage: boolean;\n  isFetchingPreviousPage: boolean;\n  isFetchNextPageError: boolean;\n  isFetchPreviousPageError: boolean;\n};\nexport type InfiniteQueryResultSelectorResult<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = InfiniteQuerySubState<Definition> & RequestStatusFlags & InfiniteQueryResultFlags;\ntype MutationResultSelectorFactory<Definition extends MutationDefinition<any, any, any, any>, RootState> = (requestId: string | {\n  requestId: string | undefined;\n  fixedCacheKey: string | undefined;\n} | SkipToken) => (state: RootState) => MutationResultSelectorResult<Definition>;\nexport type MutationResultSelectorResult<Definition extends MutationDefinition<any, any, any, any>> = MutationSubState<Definition> & RequestStatusFlags;\nconst initialSubState: QuerySubState<any> = {\n  status: STATUS_UNINITIALIZED\n};\n\n// abuse immer to freeze default states\nconst defaultQuerySubState = /* @__PURE__ */createNextState(initialSubState, () => {});\nconst defaultMutationSubState = /* @__PURE__ */createNextState(initialSubState as MutationSubState<any>, () => {});\nexport type AllSelectors = ReturnType<typeof buildSelectors>;\nexport function buildSelectors<Definitions extends EndpointDefinitions, ReducerPath extends string>({\n  serializeQueryArgs,\n  reducerPath,\n  createSelector\n}: {\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  reducerPath: ReducerPath;\n  createSelector: typeof _createSelector;\n}) {\n  type RootState = _RootState<Definitions, string, string>;\n  const selectSkippedQuery = (state: RootState) => defaultQuerySubState;\n  const selectSkippedMutation = (state: RootState) => defaultMutationSubState;\n  return {\n    buildQuerySelector,\n    buildInfiniteQuerySelector,\n    buildMutationSelector,\n    selectInvalidatedBy,\n    selectCachedArgsForQuery,\n    selectApiState,\n    selectQueries,\n    selectMutations,\n    selectQueryEntry,\n    selectConfig\n  };\n  function withRequestFlags<T extends {\n    status: QueryStatus;\n  }>(substate: T): T & RequestStatusFlags {\n    return {\n      ...substate,\n      ...getRequestStatusFlags(substate.status)\n    };\n  }\n  function selectApiState(rootState: RootState) {\n    const state = rootState[reducerPath];\n    if (process.env.NODE_ENV !== 'production') {\n      if (!state) {\n        if ((selectApiState as any).triggered) return state;\n        (selectApiState as any).triggered = true;\n        console.error(`Error: No data found at \\`state.${reducerPath}\\`. Did you forget to add the reducer to the store?`);\n      }\n    }\n    return state;\n  }\n  function selectQueries(rootState: RootState) {\n    return selectApiState(rootState)?.queries;\n  }\n  function selectQueryEntry(rootState: RootState, cacheKey: QueryCacheKey) {\n    return selectQueries(rootState)?.[cacheKey];\n  }\n  function selectMutations(rootState: RootState) {\n    return selectApiState(rootState)?.mutations;\n  }\n  function selectConfig(rootState: RootState) {\n    return selectApiState(rootState)?.config;\n  }\n  function buildAnyQuerySelector(endpointName: string, endpointDefinition: EndpointDefinition<any, any, any, any>, combiner: <T extends {\n    status: QueryStatus;\n  }>(substate: T) => T & RequestStatusFlags) {\n    return (queryArgs: any) => {\n      // Avoid calling serializeQueryArgs if the arg is skipToken\n      if (queryArgs === skipToken) {\n        return createSelector(selectSkippedQuery, combiner);\n      }\n      const serializedArgs = serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      });\n      const selectQuerySubstate = (state: RootState) => selectQueryEntry(state, serializedArgs) ?? defaultQuerySubState;\n      return createSelector(selectQuerySubstate, combiner);\n    };\n  }\n  function buildQuerySelector(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any>) {\n    return buildAnyQuerySelector(endpointName, endpointDefinition, withRequestFlags) as QueryResultSelectorFactory<any, RootState>;\n  }\n  function buildInfiniteQuerySelector(endpointName: string, endpointDefinition: InfiniteQueryDefinition<any, any, any, any, any>) {\n    const {\n      infiniteQueryOptions\n    } = endpointDefinition;\n    function withInfiniteQueryResultFlags<T extends {\n      status: QueryStatus;\n    }>(substate: T): T & RequestStatusFlags & InfiniteQueryResultFlags {\n      const stateWithRequestFlags = {\n        ...(substate as InfiniteQuerySubState<any>),\n        ...getRequestStatusFlags(substate.status)\n      };\n      const {\n        isLoading,\n        isError,\n        direction\n      } = stateWithRequestFlags;\n      const isForward = direction === 'forward';\n      const isBackward = direction === 'backward';\n      return {\n        ...stateWithRequestFlags,\n        hasNextPage: getHasNextPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),\n        hasPreviousPage: getHasPreviousPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),\n        isFetchingNextPage: isLoading && isForward,\n        isFetchingPreviousPage: isLoading && isBackward,\n        isFetchNextPageError: isError && isForward,\n        isFetchPreviousPageError: isError && isBackward\n      };\n    }\n    return buildAnyQuerySelector(endpointName, endpointDefinition, withInfiniteQueryResultFlags) as unknown as InfiniteQueryResultSelectorFactory<any, RootState>;\n  }\n  function buildMutationSelector() {\n    return (id => {\n      let mutationId: string | typeof skipToken;\n      if (typeof id === 'object') {\n        mutationId = getMutationCacheKey(id) ?? skipToken;\n      } else {\n        mutationId = id;\n      }\n      const selectMutationSubstate = (state: RootState) => selectApiState(state)?.mutations?.[mutationId as string] ?? defaultMutationSubState;\n      const finalSelectMutationSubstate = mutationId === skipToken ? selectSkippedMutation : selectMutationSubstate;\n      return createSelector(finalSelectMutationSubstate, withRequestFlags);\n    }) as MutationResultSelectorFactory<any, RootState>;\n  }\n  function selectInvalidatedBy(state: RootState, tags: ReadonlyArray<TagDescription<string> | null | undefined>): Array<{\n    endpointName: string;\n    originalArgs: any;\n    queryCacheKey: QueryCacheKey;\n  }> {\n    const apiState = state[reducerPath];\n    const toInvalidate = new Set<QueryCacheKey>();\n    const finalTags = filterMap(tags, isNotNullish, expandTagDescription);\n    for (const tag of finalTags) {\n      const provided = apiState.provided.tags[tag.type];\n      if (!provided) {\n        continue;\n      }\n      let invalidateSubscriptions = (tag.id !== undefined ?\n      // id given: invalidate all queries that provide this type & id\n      provided[tag.id] :\n      // no id: invalidate all queries that provide this type\n      Object.values(provided).flat()) ?? [];\n      for (const invalidate of invalidateSubscriptions) {\n        toInvalidate.add(invalidate);\n      }\n    }\n    return Array.from(toInvalidate.values()).flatMap(queryCacheKey => {\n      const querySubState = apiState.queries[queryCacheKey];\n      return querySubState ? {\n        queryCacheKey,\n        endpointName: querySubState.endpointName!,\n        originalArgs: querySubState.originalArgs\n      } : [];\n    });\n  }\n  function selectCachedArgsForQuery<QueryName extends AllQueryKeys<Definitions>>(state: RootState, queryName: QueryName): Array<QueryArgFromAnyQuery<Definitions[QueryName]>> {\n    return filterMap(Object.values(selectQueries(state) as QueryState<any>), (entry): entry is Exclude<QuerySubState<Definitions[QueryName]>, {\n      status: QueryStatus.uninitialized;\n    }> => entry?.endpointName === queryName && entry.status !== STATUS_UNINITIALIZED, entry => entry.originalArgs);\n  }\n  function getHasNextPage(options: InfiniteQueryConfigOptions<any, any, any>, data?: InfiniteData<unknown, unknown>, queryArg?: unknown): boolean {\n    if (!data) return false;\n    return getNextPageParam(options, data, queryArg) != null;\n  }\n  function getHasPreviousPage(options: InfiniteQueryConfigOptions<any, any, any>, data?: InfiniteData<unknown, unknown>, queryArg?: unknown): boolean {\n    if (!data || !options.getPreviousPageParam) return false;\n    return getPreviousPageParam(options, data, queryArg) != null;\n  }\n}","import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3 } from \"@reduxjs/toolkit\";\nimport { getEndpointDefinition, type Api, type ApiContext, type Module, type ModuleName } from './apiTypes';\nimport type { CombinedState } from './core/apiState';\nimport type { BaseQueryArg, BaseQueryFn } from './baseQueryTypes';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport { defaultSerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { EndpointBuilder, EndpointDefinitions, SchemaFailureConverter, SchemaFailureHandler, SchemaType } from './endpointDefinitions';\nimport { DefinitionType, ENDPOINT_INFINITEQUERY, ENDPOINT_MUTATION, ENDPOINT_QUERY, isInfiniteQueryDefinition, isQueryDefinition } from './endpointDefinitions';\nimport { nanoid } from './core/rtkImports';\nimport type { UnknownAction } from '@reduxjs/toolkit';\nimport type { NoInfer } from './tsHelpers';\nimport { weakMapMemoize } from 'reselect';\nexport interface CreateApiOptions<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string = 'api', TagTypes extends string = never> {\n  /**\n   * The base query used by each endpoint if no `queryFn` option is specified. RTK Query exports a utility called [fetchBaseQuery](./fetchBaseQuery) as a lightweight wrapper around `fetch` for common use-cases. See [Customizing Queries](../../rtk-query/usage/customizing-queries) if `fetchBaseQuery` does not handle your requirements.\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   *\n   * const api = createApi({\n   *   // highlight-start\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // ...endpoints\n   *   }),\n   * })\n   * ```\n   */\n  baseQuery: BaseQuery;\n  /**\n   * An array of string tag type names. Specifying tag types is optional, but you should define them so that they can be used for caching and invalidation. When defining a tag type, you will be able to [provide](../../rtk-query/usage/automated-refetching#providing-tags) them with `providesTags` and [invalidate](../../rtk-query/usage/automated-refetching#invalidating-tags) them with `invalidatesTags` when configuring [endpoints](#endpoints).\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-start\n   *   tagTypes: ['Post', 'User'],\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // ...endpoints\n   *   }),\n   * })\n   * ```\n   */\n  tagTypes?: readonly TagTypes[];\n  /**\n   * The `reducerPath` is a _unique_ key that your service will be mounted to in your store. If you call `createApi` more than once in your application, you will need to provide a unique value each time. Defaults to `'api'`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"apis.js\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query';\n   *\n   * const apiOne = createApi({\n   *   // highlight-start\n   *   reducerPath: 'apiOne',\n   *   // highlight-end\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (builder) => ({\n   *     // ...endpoints\n   *   }),\n   * });\n   *\n   * const apiTwo = createApi({\n   *   // highlight-start\n   *   reducerPath: 'apiTwo',\n   *   // highlight-end\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (builder) => ({\n   *     // ...endpoints\n   *   }),\n   * });\n   * ```\n   */\n  reducerPath?: ReducerPath;\n  /**\n   * Accepts a custom function if you have a need to change the creation of cache keys for any reason.\n   */\n  serializeQueryArgs?: SerializeQueryArgs<unknown>;\n  /**\n   * Endpoints are a set of operations that you want to perform against your server. You define them as an object using the builder syntax. There are three endpoint types: [`query`](../../rtk-query/usage/queries), [`infiniteQuery`](../../rtk-query/usage/infinite-queries) and [`mutation`](../../rtk-query/usage/mutations).\n   */\n  endpoints(build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>): Definitions;\n  /**\n   * Defaults to `60` _(this value is in seconds)_. This is how long RTK Query will keep your data cached for **after** the last component unsubscribes. For example, if you query an endpoint, then unmount the component, then mount another component that makes the same request within the given time frame, the most recent value will be served from the cache.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"keepUnusedDataFor example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts'\n   *     })\n   *   }),\n   *   // highlight-start\n   *   keepUnusedDataFor: 5\n   *   // highlight-end\n   * })\n   * ```\n   */\n  keepUnusedDataFor?: number;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after the application window regains focus.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnFocus?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after regaining a network connection.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnReconnect?: boolean;\n  /**\n   * Defaults to `'delayed'`. This setting allows you to control when tags are invalidated after a mutation.\n   *\n   * - `'immediately'`: Queries are invalidated instantly after the mutation finished, even if they are running.\n   *   If the query provides tags that were invalidated while it ran, it won't be re-fetched.\n   * - `'delayed'`: Invalidation only happens after all queries and mutations are settled.\n   *   This ensures that queries are always invalidated correctly and automatically \"batches\" invalidations of concurrent mutations.\n   *   Note that if you constantly have some queries (or mutations) running, this can delay tag invalidations indefinitely.\n   */\n  invalidationBehavior?: 'delayed' | 'immediately';\n  /**\n   * A function that is passed every dispatched action. If this returns something other than `undefined`,\n   * that return value will be used to rehydrate fulfilled & errored queries.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"next-redux-wrapper rehydration example\"\n   * import type { Action, PayloadAction } from '@reduxjs/toolkit'\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import { HYDRATE } from 'next-redux-wrapper'\n   *\n   * type RootState = any; // normally inferred from state\n   *\n   * function isHydrateAction(action: Action): action is PayloadAction<RootState> {\n   *   return action.type === HYDRATE\n   * }\n   *\n   * export const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-start\n   *   extractRehydrationInfo(action, { reducerPath }): any {\n   *     if (isHydrateAction(action)) {\n   *       return action.payload[reducerPath]\n   *     }\n   *   },\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // omitted\n   *   }),\n   * })\n   * ```\n   */\n  extractRehydrationInfo?: (action: UnknownAction, {\n    reducerPath\n  }: {\n    reducerPath: ReducerPath;\n  }) => undefined | CombinedState<NoInfer<Definitions>, NoInfer<TagTypes>, NoInfer<ReducerPath>>;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *     }),\n   *   }),\n   *   onSchemaFailure: (error, info) => {\n   *     console.error(error, info)\n   *   },\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *     }),\n   *   }),\n   *   catchSchemaFailure: (error, info) => ({\n   *     status: \"CUSTOM_ERROR\",\n   *     error: error.schemaName + \" failed validation\",\n   *     data: error.issues,\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for all endpoints, unless overridden by the endpoint.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type CreateApi<Modules extends ModuleName> = {\n  /**\n   * Creates a service to use in your application. Contains only the basic redux logic (the core module).\n   *\n   * @link https://redux-toolkit.js.org/rtk-query/api/createApi\n   */\n  <BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string = 'api', TagTypes extends string = never>(options: CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>): Api<BaseQuery, Definitions, ReducerPath, TagTypes, Modules>;\n};\n\n/**\n * Builds a `createApi` method based on the provided `modules`.\n *\n * @link https://redux-toolkit.js.org/rtk-query/usage/customizing-create-api\n *\n * @example\n * ```ts\n * const MyContext = React.createContext<ReactReduxContextValue | null>(null);\n * const customCreateApi = buildCreateApi(\n *   coreModule(),\n *   reactHooksModule({\n *     hooks: {\n *       useDispatch: createDispatchHook(MyContext),\n *       useSelector: createSelectorHook(MyContext),\n *       useStore: createStoreHook(MyContext)\n *     }\n *   })\n * );\n * ```\n *\n * @param modules - A variable number of modules that customize how the `createApi` method handles endpoints\n * @returns A `createApi` method using the provided `modules`.\n */\nexport function buildCreateApi<Modules extends [Module<any>, ...Module<any>[]]>(...modules: Modules): CreateApi<Modules[number]['name']> {\n  return function baseCreateApi(options) {\n    const extractRehydrationInfo = weakMapMemoize((action: UnknownAction) => options.extractRehydrationInfo?.(action, {\n      reducerPath: (options.reducerPath ?? 'api') as any\n    }));\n    const optionsWithDefaults: CreateApiOptions<any, any, any, any> = {\n      reducerPath: 'api',\n      keepUnusedDataFor: 60,\n      refetchOnMountOrArgChange: false,\n      refetchOnFocus: false,\n      refetchOnReconnect: false,\n      invalidationBehavior: 'delayed',\n      ...options,\n      extractRehydrationInfo,\n      serializeQueryArgs(queryArgsApi) {\n        let finalSerializeQueryArgs = defaultSerializeQueryArgs;\n        if ('serializeQueryArgs' in queryArgsApi.endpointDefinition) {\n          const endpointSQA = queryArgsApi.endpointDefinition.serializeQueryArgs!;\n          finalSerializeQueryArgs = queryArgsApi => {\n            const initialResult = endpointSQA(queryArgsApi);\n            if (typeof initialResult === 'string') {\n              // If the user function returned a string, use it as-is\n              return initialResult;\n            } else {\n              // Assume they returned an object (such as a subset of the original\n              // query args) or a primitive, and serialize it ourselves\n              return defaultSerializeQueryArgs({\n                ...queryArgsApi,\n                queryArgs: initialResult\n              });\n            }\n          };\n        } else if (options.serializeQueryArgs) {\n          finalSerializeQueryArgs = options.serializeQueryArgs;\n        }\n        return finalSerializeQueryArgs(queryArgsApi);\n      },\n      tagTypes: [...(options.tagTypes || [])]\n    };\n    const context: ApiContext<EndpointDefinitions> = {\n      endpointDefinitions: {},\n      batch(fn) {\n        // placeholder \"batch\" method to be overridden by plugins, for example with React.unstable_batchedUpdate\n        fn();\n      },\n      apiUid: nanoid(),\n      extractRehydrationInfo,\n      hasRehydrationInfo: weakMapMemoize(action => extractRehydrationInfo(action) != null)\n    };\n    const api = {\n      injectEndpoints,\n      enhanceEndpoints({\n        addTagTypes,\n        endpoints\n      }) {\n        if (addTagTypes) {\n          for (const eT of addTagTypes) {\n            if (!optionsWithDefaults.tagTypes!.includes(eT as any)) {\n              ;\n              (optionsWithDefaults.tagTypes as any[]).push(eT);\n            }\n          }\n        }\n        if (endpoints) {\n          for (const [endpointName, partialDefinition] of Object.entries(endpoints)) {\n            if (typeof partialDefinition === 'function') {\n              partialDefinition(getEndpointDefinition(context, endpointName));\n            } else {\n              Object.assign(getEndpointDefinition(context, endpointName) || {}, partialDefinition);\n            }\n          }\n        }\n        return api;\n      }\n    } as Api<BaseQueryFn, {}, string, string, Modules[number]['name']>;\n    const initializedModules = modules.map(m => m.init(api as any, optionsWithDefaults as any, context));\n    function injectEndpoints(inject: Parameters<typeof api.injectEndpoints>[0]) {\n      const evaluatedEndpoints = inject.endpoints({\n        query: x => ({\n          ...x,\n          type: ENDPOINT_QUERY\n        }) as any,\n        mutation: x => ({\n          ...x,\n          type: ENDPOINT_MUTATION\n        }) as any,\n        infiniteQuery: x => ({\n          ...x,\n          type: ENDPOINT_INFINITEQUERY\n        }) as any\n      });\n      for (const [endpointName, definition] of Object.entries(evaluatedEndpoints)) {\n        if (inject.overrideExisting !== true && endpointName in context.endpointDefinitions) {\n          if (inject.overrideExisting === 'throw') {\n            throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(39) : `called \\`injectEndpoints\\` to override already-existing endpointName ${endpointName} without specifying \\`overrideExisting: true\\``);\n          } else if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n            console.error(`called \\`injectEndpoints\\` to override already-existing endpointName ${endpointName} without specifying \\`overrideExisting: true\\``);\n          }\n          continue;\n        }\n        if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n          if (isInfiniteQueryDefinition(definition)) {\n            const {\n              infiniteQueryOptions\n            } = definition;\n            const {\n              maxPages,\n              getPreviousPageParam\n            } = infiniteQueryOptions;\n            if (typeof maxPages === 'number') {\n              if (maxPages < 1) {\n                throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(40) : `maxPages for endpoint '${endpointName}' must be a number greater than 0`);\n              }\n              if (typeof getPreviousPageParam !== 'function') {\n                throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(41) : `getPreviousPageParam for endpoint '${endpointName}' must be a function if maxPages is used`);\n              }\n            }\n          }\n        }\n        context.endpointDefinitions[endpointName] = definition;\n        for (const m of initializedModules) {\n          m.injectEndpoint(endpointName, definition);\n        }\n      }\n      return api as any;\n    }\n    return api.injectEndpoints({\n      endpoints: options.endpoints as any\n    });\n  };\n}","import type { QueryCacheKey } from './core/apiState';\nimport type { EndpointDefinition } from './endpointDefinitions';\nimport { isPlainObject } from './core/rtkImports';\nconst cache: WeakMap<any, string> | undefined = WeakMap ? new WeakMap() : undefined;\nexport const defaultSerializeQueryArgs: SerializeQueryArgs<any> = ({\n  endpointName,\n  queryArgs\n}) => {\n  let serialized = '';\n  const cached = cache?.get(queryArgs);\n  if (typeof cached === 'string') {\n    serialized = cached;\n  } else {\n    const stringified = JSON.stringify(queryArgs, (key, value) => {\n      // Handle bigints\n      value = typeof value === 'bigint' ? {\n        $bigint: value.toString()\n      } : value;\n      // Sort the object keys before stringifying, to prevent useQuery({ a: 1, b: 2 }) having a different cache key than useQuery({ b: 2, a: 1 })\n      value = isPlainObject(value) ? Object.keys(value).sort().reduce<any>((acc, key) => {\n        acc[key] = (value as any)[key];\n        return acc;\n      }, {}) : value;\n      return value;\n    });\n    if (isPlainObject(queryArgs)) {\n      cache?.set(queryArgs, stringified);\n    }\n    serialized = stringified;\n  }\n  return `${endpointName}(${serialized})`;\n};\nexport type SerializeQueryArgs<QueryArgs, ReturnType = string> = (_: {\n  queryArgs: QueryArgs;\n  endpointDefinition: EndpointDefinition<any, any, any, any>;\n  endpointName: string;\n}) => ReturnType;\nexport type InternalSerializeQueryArgs = (_: {\n  queryArgs: any;\n  endpointDefinition: EndpointDefinition<any, any, any, any>;\n  endpointName: string;\n}) => QueryCacheKey;","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { BaseQueryFn } from './baseQueryTypes';\nexport const _NEVER = /* @__PURE__ */Symbol();\nexport type NEVER = typeof _NEVER;\n\n/**\n * Creates a \"fake\" baseQuery to be used if your api *only* uses the `queryFn` definition syntax.\n * This also allows you to specify a specific error type to be shared by all your `queryFn` definitions.\n */\nexport function fakeBaseQuery<ErrorType>(): BaseQueryFn<void, NEVER, ErrorType, {}> {\n  return function () {\n    throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(33) : 'When using `fakeBaseQuery`, all queries & mutations must use the `queryFn` definition syntax.');\n  };\n}","export type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type Override<T1, T2> = T2 extends any ? Omit<T1, keyof T2> & T2 : never;\nexport function assertCast<T>(v: any): asserts v is T {}\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>): T {\n  return Object.assign(target, ...args);\n}\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\nexport type NonOptionalKeys<T> = { [K in keyof T]-?: undefined extends T[K] ? never : K }[keyof T];\nexport type HasRequiredProps<T, True, False> = NonOptionalKeys<T> extends never ? False : True;\nexport type OptionalIfAllPropsOptional<T> = HasRequiredProps<T, T, T | never>;\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type UnwrapPromise<T> = T extends PromiseLike<infer V> ? V : T;\nexport type MaybePromise<T> = T | PromiseLike<T>;\nexport type OmitFromUnion<T, K extends keyof T> = T extends any ? Omit<T, K> : never;\nexport type IsAny<T, True, False = never> = true | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;","import type { InternalHandlerBuilder, SubscriptionSelectors } from './types';\nimport type { SubscriptionInternalState, SubscriptionState } from '../apiState';\nimport { produceWithPatches } from '../../utils/immerImports';\nimport type { Action } from '@reduxjs/toolkit';\nimport { getOrInsertComputed, createNewMap } from '../../utils/getOrInsert';\nexport const buildBatchedActionsHandler: InternalHandlerBuilder<[actionShouldContinue: boolean, returnValue: SubscriptionSelectors | boolean]> = ({\n  api,\n  queryThunk,\n  internalState,\n  mwApi\n}) => {\n  const subscriptionsPrefix = `${api.reducerPath}/subscriptions`;\n  let previousSubscriptions: SubscriptionState = null as unknown as SubscriptionState;\n  let updateSyncTimer: ReturnType<typeof window.setTimeout> | null = null;\n  const {\n    updateSubscriptionOptions,\n    unsubscribeQueryResult\n  } = api.internalActions;\n\n  // Actually intentionally mutate the subscriptions state used in the middleware\n  // This is done to speed up perf when loading many components\n  const actuallyMutateSubscriptions = (currentSubscriptions: SubscriptionInternalState, action: Action) => {\n    if (updateSubscriptionOptions.match(action)) {\n      const {\n        queryCacheKey,\n        requestId,\n        options\n      } = action.payload;\n      const sub = currentSubscriptions.get(queryCacheKey);\n      if (sub?.has(requestId)) {\n        sub.set(requestId, options);\n      }\n      return true;\n    }\n    if (unsubscribeQueryResult.match(action)) {\n      const {\n        queryCacheKey,\n        requestId\n      } = action.payload;\n      const sub = currentSubscriptions.get(queryCacheKey);\n      if (sub) {\n        sub.delete(requestId);\n      }\n      return true;\n    }\n    if (api.internalActions.removeQueryResult.match(action)) {\n      currentSubscriptions.delete(action.payload.queryCacheKey);\n      return true;\n    }\n    if (queryThunk.pending.match(action)) {\n      const {\n        meta: {\n          arg,\n          requestId\n        }\n      } = action;\n      const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);\n      if (arg.subscribe) {\n        substate.set(requestId, arg.subscriptionOptions ?? substate.get(requestId) ?? {});\n      }\n      return true;\n    }\n    let mutated = false;\n    if (queryThunk.rejected.match(action)) {\n      const {\n        meta: {\n          condition,\n          arg,\n          requestId\n        }\n      } = action;\n      if (condition && arg.subscribe) {\n        const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);\n        substate.set(requestId, arg.subscriptionOptions ?? substate.get(requestId) ?? {});\n        mutated = true;\n      }\n    }\n    return mutated;\n  };\n  const getSubscriptions = () => internalState.currentSubscriptions;\n  const getSubscriptionCount = (queryCacheKey: string) => {\n    const subscriptions = getSubscriptions();\n    const subscriptionsForQueryArg = subscriptions.get(queryCacheKey);\n    return subscriptionsForQueryArg?.size ?? 0;\n  };\n  const isRequestSubscribed = (queryCacheKey: string, requestId: string) => {\n    const subscriptions = getSubscriptions();\n    return !!subscriptions?.get(queryCacheKey)?.get(requestId);\n  };\n  const subscriptionSelectors: SubscriptionSelectors = {\n    getSubscriptions,\n    getSubscriptionCount,\n    isRequestSubscribed\n  };\n  function serializeSubscriptions(currentSubscriptions: SubscriptionInternalState): SubscriptionState {\n    // We now use nested Maps for subscriptions, instead of\n    // plain Records. Stringify this accordingly so we can\n    // convert it to the shape we need for the store.\n    return JSON.parse(JSON.stringify(Object.fromEntries([...currentSubscriptions].map(([k, v]) => [k, Object.fromEntries(v)]))));\n  }\n  return (action, mwApi): [actionShouldContinue: boolean, result: SubscriptionSelectors | boolean] => {\n    if (!previousSubscriptions) {\n      // Initialize it the first time this handler runs\n      previousSubscriptions = serializeSubscriptions(internalState.currentSubscriptions);\n    }\n    if (api.util.resetApiState.match(action)) {\n      previousSubscriptions = {};\n      internalState.currentSubscriptions.clear();\n      updateSyncTimer = null;\n      return [true, false];\n    }\n\n    // Intercept requests by hooks to see if they're subscribed\n    // We return the internal state reference so that hooks\n    // can do their own checks to see if they're still active.\n    // It's stupid and hacky, but it does cut down on some dispatch calls.\n    if (api.internalActions.internal_getRTKQSubscriptions.match(action)) {\n      return [false, subscriptionSelectors];\n    }\n\n    // Update subscription data based on this action\n    const didMutate = actuallyMutateSubscriptions(internalState.currentSubscriptions, action);\n    let actionShouldContinue = true;\n\n    // HACK Sneak the test-only polling state back out\n    if (process.env.NODE_ENV === 'test' && typeof action.type === 'string' && action.type === `${api.reducerPath}/getPolling`) {\n      return [false, internalState.currentPolls] as any;\n    }\n    if (didMutate) {\n      if (!updateSyncTimer) {\n        // We only use the subscription state for the Redux DevTools at this point,\n        // as the real data is kept here in the middleware.\n        // Given that, we can throttle synchronizing this state significantly to\n        // save on overall perf.\n        // In 1.9, it was updated in a microtask, but now we do it at most every 500ms.\n        updateSyncTimer = setTimeout(() => {\n          // Deep clone the current subscription data\n          const newSubscriptions: SubscriptionState = serializeSubscriptions(internalState.currentSubscriptions);\n          // Figure out a smaller diff between original and current\n          const [, patches] = produceWithPatches(previousSubscriptions, () => newSubscriptions);\n\n          // Sync the store state for visibility\n          mwApi.next(api.internalActions.subscriptionsUpdated(patches));\n          // Save the cloned state for later reference\n          previousSubscriptions = newSubscriptions;\n          updateSyncTimer = null;\n        }, 500);\n      }\n      const isSubscriptionSliceAction = typeof action.type == 'string' && !!action.type.startsWith(subscriptionsPrefix);\n      const isAdditionalSubscriptionAction = queryThunk.rejected.match(action) && action.meta.condition && !!action.meta.arg.subscribe;\n      actionShouldContinue = !isSubscriptionSliceAction && !isAdditionalSubscriptionAction;\n    }\n    return [actionShouldContinue, false];\n  };\n};","import { getEndpointDefinition } from '@internal/query/apiTypes';\nimport type { QueryDefinition } from '../../endpointDefinitions';\nimport type { ConfigState, QueryCacheKey, QuerySubState } from '../apiState';\nimport { isAnyOf } from '../rtkImports';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, QueryStateMeta, SubMiddlewareApi, TimeoutId } from './types';\nexport type ReferenceCacheCollection = never;\n\n/**\n * @example\n * ```ts\n * // codeblock-meta title=\"keepUnusedDataFor example\"\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n * interface Post {\n *   id: number\n *   name: string\n * }\n * type PostsResponse = Post[]\n *\n * const api = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsResponse, void>({\n *       query: () => 'posts',\n *       // highlight-start\n *       keepUnusedDataFor: 5\n *       // highlight-end\n *     })\n *   })\n * })\n * ```\n */\nexport type CacheCollectionQueryExtraOptions = {\n  /**\n   * Overrides the api-wide definition of `keepUnusedDataFor` for this endpoint only. _(This value is in seconds.)_\n   *\n   * This is how long RTK Query will keep your data cached for **after** the last component unsubscribes. For example, if you query an endpoint, then unmount the component, then mount another component that makes the same request within the given time frame, the most recent value will be served from the cache.\n   */\n  keepUnusedDataFor?: number;\n};\n\n// Per https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value , browsers store\n// `setTimeout()` timer values in a 32-bit int. If we pass a value in that's larger than that,\n// it wraps and ends up executing immediately.\n// Our `keepUnusedDataFor` values are in seconds, so adjust the numbers here accordingly.\nexport const THIRTY_TWO_BIT_MAX_INT = 2_147_483_647;\nexport const THIRTY_TWO_BIT_MAX_TIMER_SECONDS = 2_147_483_647 / 1_000 - 1;\nexport const buildCacheCollectionHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  api,\n  queryThunk,\n  context,\n  internalState,\n  selectors: {\n    selectQueryEntry,\n    selectConfig\n  },\n  getRunningQueryThunk,\n  mwApi\n}) => {\n  const {\n    removeQueryResult,\n    unsubscribeQueryResult,\n    cacheEntriesUpserted\n  } = api.internalActions;\n  const canTriggerUnsubscribe = isAnyOf(unsubscribeQueryResult.match, queryThunk.fulfilled, queryThunk.rejected, cacheEntriesUpserted.match);\n  function anySubscriptionsRemainingForKey(queryCacheKey: string) {\n    const subscriptions = internalState.currentSubscriptions.get(queryCacheKey);\n    if (!subscriptions) {\n      return false;\n    }\n    const hasSubscriptions = subscriptions.size > 0;\n    return hasSubscriptions;\n  }\n  const currentRemovalTimeouts: QueryStateMeta<TimeoutId> = {};\n  function abortAllPromises<T extends {\n    abort?: () => void;\n  }>(promiseMap: Map<string, T | undefined>): void {\n    for (const promise of promiseMap.values()) {\n      promise?.abort?.();\n    }\n  }\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    const state = mwApi.getState();\n    const config = selectConfig(state);\n    if (canTriggerUnsubscribe(action)) {\n      let queryCacheKeys: QueryCacheKey[];\n      if (cacheEntriesUpserted.match(action)) {\n        queryCacheKeys = action.payload.map(entry => entry.queryDescription.queryCacheKey);\n      } else {\n        const {\n          queryCacheKey\n        } = unsubscribeQueryResult.match(action) ? action.payload : action.meta.arg;\n        queryCacheKeys = [queryCacheKey];\n      }\n      handleUnsubscribeMany(queryCacheKeys, mwApi, config);\n    }\n    if (api.util.resetApiState.match(action)) {\n      for (const [key, timeout] of Object.entries(currentRemovalTimeouts)) {\n        if (timeout) clearTimeout(timeout);\n        delete currentRemovalTimeouts[key];\n      }\n      abortAllPromises(internalState.runningQueries);\n      abortAllPromises(internalState.runningMutations);\n    }\n    if (context.hasRehydrationInfo(action)) {\n      const {\n        queries\n      } = context.extractRehydrationInfo(action)!;\n      // Gotcha:\n      // If rehydrating before the endpoint has been injected,the global `keepUnusedDataFor`\n      // will be used instead of the endpoint-specific one.\n      handleUnsubscribeMany(Object.keys(queries) as QueryCacheKey[], mwApi, config);\n    }\n  };\n  function handleUnsubscribeMany(cacheKeys: QueryCacheKey[], api: SubMiddlewareApi, config: ConfigState<string>) {\n    const state = api.getState();\n    for (const queryCacheKey of cacheKeys) {\n      const entry = selectQueryEntry(state, queryCacheKey);\n      if (entry?.endpointName) {\n        handleUnsubscribe(queryCacheKey, entry.endpointName, api, config);\n      }\n    }\n  }\n  function handleUnsubscribe(queryCacheKey: QueryCacheKey, endpointName: string, api: SubMiddlewareApi, config: ConfigState<string>) {\n    const endpointDefinition = getEndpointDefinition(context, endpointName) as QueryDefinition<any, any, any, any>;\n    const keepUnusedDataFor = endpointDefinition?.keepUnusedDataFor ?? config.keepUnusedDataFor;\n    if (keepUnusedDataFor === Infinity) {\n      // Hey, user said keep this forever!\n      return;\n    }\n    // Prevent `setTimeout` timers from overflowing a 32-bit internal int, by\n    // clamping the max value to be at most 1000ms less than the 32-bit max.\n    // Look, a 24.8-day keepalive ought to be enough for anybody, right? :)\n    // Also avoid negative values too.\n    const finalKeepUnusedDataFor = Math.max(0, Math.min(keepUnusedDataFor, THIRTY_TWO_BIT_MAX_TIMER_SECONDS));\n    if (!anySubscriptionsRemainingForKey(queryCacheKey)) {\n      const currentTimeout = currentRemovalTimeouts[queryCacheKey];\n      if (currentTimeout) {\n        clearTimeout(currentTimeout);\n      }\n      currentRemovalTimeouts[queryCacheKey] = setTimeout(() => {\n        if (!anySubscriptionsRemainingForKey(queryCacheKey)) {\n          // Try to abort any running query for this cache key\n          const entry = selectQueryEntry(api.getState(), queryCacheKey);\n          if (entry?.endpointName) {\n            const runningQuery = api.dispatch(getRunningQueryThunk(entry.endpointName, entry.originalArgs));\n            runningQuery?.abort();\n          }\n          api.dispatch(removeQueryResult({\n            queryCacheKey\n          }));\n        }\n        delete currentRemovalTimeouts![queryCacheKey];\n      }, finalKeepUnusedDataFor * 1000);\n    }\n  }\n  return handler;\n};","import type { ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { BaseQueryFn, BaseQueryMeta, BaseQueryResult } from '../../baseQueryTypes';\nimport type { BaseEndpointDefinition, DefinitionType } from '../../endpointDefinitions';\nimport { isAnyQueryDefinition } from '../../endpointDefinitions';\nimport type { QueryCacheKey, RootState } from '../apiState';\nimport type { MutationResultSelectorResult, QueryResultSelectorResult } from '../buildSelectors';\nimport { getMutationCacheKey } from '../buildSlice';\nimport type { PatchCollection, Recipe } from '../buildThunks';\nimport { isAsyncThunkAction, isFulfilled } from '../rtkImports';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, PromiseWithKnownReason, SubMiddlewareApi } from './types';\nimport { getEndpointDefinition } from '@internal/query/apiTypes';\nexport type ReferenceCacheLifecycle = never;\nexport interface QueryBaseLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends LifecycleApi<ReducerPath> {\n  /**\n   * Gets the current value of this cache entry.\n   */\n  getCacheEntry(): QueryResultSelectorResult<{\n    type: DefinitionType.query;\n  } & BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, BaseQueryResult<BaseQuery>>>;\n  /**\n   * Updates the current cache entry value.\n   * For documentation see `api.util.updateQueryData`.\n   */\n  updateCachedData(updateRecipe: Recipe<ResultType>): PatchCollection;\n}\nexport type MutationBaseLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = LifecycleApi<ReducerPath> & {\n  /**\n   * Gets the current value of this cache entry.\n   */\n  getCacheEntry(): MutationResultSelectorResult<{\n    type: DefinitionType.mutation;\n  } & BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, BaseQueryResult<BaseQuery>>>;\n};\ntype LifecycleApi<ReducerPath extends string = string> = {\n  /**\n   * The dispatch method for the store\n   */\n  dispatch: ThunkDispatch<any, any, UnknownAction>;\n  /**\n   * A method to get the current state\n   */\n  getState(): RootState<any, any, ReducerPath>;\n  /**\n   * `extra` as provided as `thunk.extraArgument` to the `configureStore` `getDefaultMiddleware` option.\n   */\n  extra: unknown;\n  /**\n   * A unique ID generated for the mutation\n   */\n  requestId: string;\n};\ntype CacheLifecyclePromises<ResultType = unknown, MetaType = unknown> = {\n  /**\n   * Promise that will resolve with the first value for this cache key.\n   * This allows you to `await` until an actual value is in cache.\n   *\n   * If the cache entry is removed from the cache before any value has ever\n   * been resolved, this Promise will reject with\n   * `new Error('Promise never resolved before cacheEntryRemoved.')`\n   * to prevent memory leaks.\n   * You can just re-throw that error (or not handle it at all) -\n   * it will be caught outside of `cacheEntryAdded`.\n   *\n   * If you don't interact with this promise, it will not throw.\n   */\n  cacheDataLoaded: PromiseWithKnownReason<{\n    /**\n     * The (transformed) query result.\n     */\n    data: ResultType;\n    /**\n     * The `meta` returned by the `baseQuery`\n     */\n    meta: MetaType;\n  }, typeof neverResolvedError>;\n  /**\n   * Promise that allows you to wait for the point in time when the cache entry\n   * has been removed from the cache, by not being used/subscribed to any more\n   * in the application for too long or by dispatching `api.util.resetApiState`.\n   */\n  cacheEntryRemoved: Promise<void>;\n};\nexport interface QueryCacheLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>, CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>> {}\nexport type MutationCacheLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> & CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>>;\nexport type CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  onCacheEntryAdded?(arg: QueryArg, api: QueryCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport type CacheLifecycleInfiniteQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>;\nexport type CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  onCacheEntryAdded?(arg: QueryArg, api: MutationCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nconst neverResolvedError = new Error('Promise never resolved before cacheEntryRemoved.') as Error & {\n  message: 'Promise never resolved before cacheEntryRemoved.';\n};\nexport const buildCacheLifecycleHandler: InternalHandlerBuilder = ({\n  api,\n  reducerPath,\n  context,\n  queryThunk,\n  mutationThunk,\n  internalState,\n  selectors: {\n    selectQueryEntry,\n    selectApiState\n  }\n}) => {\n  const isQueryThunk = isAsyncThunkAction(queryThunk);\n  const isMutationThunk = isAsyncThunkAction(mutationThunk);\n  const isFulfilledThunk = isFulfilled(queryThunk, mutationThunk);\n  type CacheLifecycle = {\n    valueResolved?(value: {\n      data: unknown;\n      meta: unknown;\n    }): unknown;\n    cacheEntryRemoved(): void;\n  };\n  const lifecycleMap: Record<string, CacheLifecycle> = {};\n  const {\n    removeQueryResult,\n    removeMutationResult,\n    cacheEntriesUpserted\n  } = api.internalActions;\n  function resolveLifecycleEntry(cacheKey: string, data: unknown, meta: unknown) {\n    const lifecycle = lifecycleMap[cacheKey];\n    if (lifecycle?.valueResolved) {\n      lifecycle.valueResolved({\n        data,\n        meta\n      });\n      delete lifecycle.valueResolved;\n    }\n  }\n  function removeLifecycleEntry(cacheKey: string) {\n    const lifecycle = lifecycleMap[cacheKey];\n    if (lifecycle) {\n      delete lifecycleMap[cacheKey];\n      lifecycle.cacheEntryRemoved();\n    }\n  }\n  function getActionMetaFields(action: ReturnType<typeof queryThunk.pending> | ReturnType<typeof mutationThunk.pending>) {\n    const {\n      arg,\n      requestId\n    } = action.meta;\n    const {\n      endpointName,\n      originalArgs\n    } = arg;\n    return [endpointName, originalArgs, requestId] as const;\n  }\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi, stateBefore) => {\n    const cacheKey = getCacheKey(action) as QueryCacheKey;\n    function checkForNewCacheKey(endpointName: string, cacheKey: QueryCacheKey, requestId: string, originalArgs: unknown) {\n      const oldEntry = selectQueryEntry(stateBefore, cacheKey);\n      const newEntry = selectQueryEntry(mwApi.getState(), cacheKey);\n      if (!oldEntry && newEntry) {\n        handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId);\n      }\n    }\n    if (queryThunk.pending.match(action)) {\n      const [endpointName, originalArgs, requestId] = getActionMetaFields(action);\n      checkForNewCacheKey(endpointName, cacheKey, requestId, originalArgs);\n    } else if (cacheEntriesUpserted.match(action)) {\n      for (const {\n        queryDescription,\n        value\n      } of action.payload) {\n        const {\n          endpointName,\n          originalArgs,\n          queryCacheKey\n        } = queryDescription;\n        checkForNewCacheKey(endpointName, queryCacheKey, action.meta.requestId, originalArgs);\n        resolveLifecycleEntry(queryCacheKey, value, {});\n      }\n    } else if (mutationThunk.pending.match(action)) {\n      const state = mwApi.getState()[reducerPath].mutations[cacheKey];\n      if (state) {\n        const [endpointName, originalArgs, requestId] = getActionMetaFields(action);\n        handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId);\n      }\n    } else if (isFulfilledThunk(action)) {\n      resolveLifecycleEntry(cacheKey, action.payload, action.meta.baseQueryMeta);\n    } else if (removeQueryResult.match(action) || removeMutationResult.match(action)) {\n      removeLifecycleEntry(cacheKey);\n    } else if (api.util.resetApiState.match(action)) {\n      for (const cacheKey of Object.keys(lifecycleMap)) {\n        removeLifecycleEntry(cacheKey);\n      }\n    }\n  };\n  function getCacheKey(action: any) {\n    if (isQueryThunk(action)) return action.meta.arg.queryCacheKey;\n    if (isMutationThunk(action)) {\n      return action.meta.arg.fixedCacheKey ?? action.meta.requestId;\n    }\n    if (removeQueryResult.match(action)) return action.payload.queryCacheKey;\n    if (removeMutationResult.match(action)) return getMutationCacheKey(action.payload);\n    return '';\n  }\n  function handleNewKey(endpointName: string, originalArgs: any, queryCacheKey: string, mwApi: SubMiddlewareApi, requestId: string) {\n    const endpointDefinition = getEndpointDefinition(context, endpointName);\n    const onCacheEntryAdded = endpointDefinition?.onCacheEntryAdded;\n    if (!onCacheEntryAdded) return;\n    const lifecycle = {} as CacheLifecycle;\n    const cacheEntryRemoved = new Promise<void>(resolve => {\n      lifecycle.cacheEntryRemoved = resolve;\n    });\n    const cacheDataLoaded: PromiseWithKnownReason<{\n      data: unknown;\n      meta: unknown;\n    }, typeof neverResolvedError> = Promise.race([new Promise<{\n      data: unknown;\n      meta: unknown;\n    }>(resolve => {\n      lifecycle.valueResolved = resolve;\n    }), cacheEntryRemoved.then(() => {\n      throw neverResolvedError;\n    })]);\n    // prevent uncaught promise rejections from happening.\n    // if the original promise is used in any way, that will create a new promise that will throw again\n    cacheDataLoaded.catch(() => {});\n    lifecycleMap[queryCacheKey] = lifecycle;\n    const selector = (api.endpoints[endpointName] as any).select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : queryCacheKey);\n    const extra = mwApi.dispatch((_, __, extra) => extra);\n    const lifecycleApi = {\n      ...mwApi,\n      getCacheEntry: () => selector(mwApi.getState()),\n      requestId,\n      extra,\n      updateCachedData: (isAnyQueryDefinition(endpointDefinition) ? (updateRecipe: Recipe<any>) => mwApi.dispatch(api.util.updateQueryData(endpointName as never, originalArgs as never, updateRecipe)) : undefined) as any,\n      cacheDataLoaded,\n      cacheEntryRemoved\n    };\n    const runningHandler = onCacheEntryAdded(originalArgs, lifecycleApi as any);\n    // if a `neverResolvedError` was thrown, but not handled in the running handler, do not let it leak out further\n    Promise.resolve(runningHandler).catch(e => {\n      if (e === neverResolvedError) return;\n      throw e;\n    });\n  }\n  return handler;\n};","import type { InternalHandlerBuilder } from './types';\nexport const buildDevCheckHandler: InternalHandlerBuilder = ({\n  api,\n  context: {\n    apiUid\n  },\n  reducerPath\n}) => {\n  return (action, mwApi) => {\n    if (api.util.resetApiState.match(action)) {\n      // dispatch after api reset\n      mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));\n    }\n    if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n      if (api.internalActions.middlewareRegistered.match(action) && action.payload === apiUid && mwApi.getState()[reducerPath]?.config?.middlewareRegistered === 'conflict') {\n        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!` : ''}`);\n      }\n    }\n  };\n};","import { isAnyOf, isFulfilled, isRejected, isRejectedWithValue } from '../rtkImports';\nimport type { EndpointDefinitions, FullTagDescription } from '../../endpointDefinitions';\nimport { calculateProvidedBy } from '../../endpointDefinitions';\nimport type { CombinedState, QueryCacheKey } from '../apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport { calculateProvidedByThunk } from '../buildThunks';\nimport type { SubMiddlewareApi, InternalHandlerBuilder, ApiMiddlewareInternalHandler } from './types';\nimport { getOrInsertComputed, createNewMap } from '../../utils/getOrInsert';\nexport const buildInvalidationByTagsHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  context,\n  context: {\n    endpointDefinitions\n  },\n  mutationThunk,\n  queryThunk,\n  api,\n  assertTagType,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    removeQueryResult\n  } = api.internalActions;\n  const isThunkActionWithTags = isAnyOf(isFulfilled(mutationThunk), isRejectedWithValue(mutationThunk));\n  const isQueryEnd = isAnyOf(isFulfilled(queryThunk, mutationThunk), isRejected(queryThunk, mutationThunk));\n  let pendingTagInvalidations: FullTagDescription<string>[] = [];\n  // Track via counter so we can avoid iterating over state every time\n  let pendingRequestCount = 0;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (queryThunk.pending.match(action) || mutationThunk.pending.match(action)) {\n      pendingRequestCount++;\n    }\n    if (isQueryEnd(action)) {\n      pendingRequestCount = Math.max(0, pendingRequestCount - 1);\n    }\n    if (isThunkActionWithTags(action)) {\n      invalidateTags(calculateProvidedByThunk(action, 'invalidatesTags', endpointDefinitions, assertTagType), mwApi);\n    } else if (isQueryEnd(action)) {\n      invalidateTags([], mwApi);\n    } else if (api.util.invalidateTags.match(action)) {\n      invalidateTags(calculateProvidedBy(action.payload, undefined, undefined, undefined, undefined, assertTagType), mwApi);\n    }\n  };\n  function hasPendingRequests() {\n    return pendingRequestCount > 0;\n  }\n  function invalidateTags(newTags: readonly FullTagDescription<string>[], mwApi: SubMiddlewareApi) {\n    const rootState = mwApi.getState();\n    const state = rootState[reducerPath];\n    pendingTagInvalidations.push(...newTags);\n    if (state.config.invalidationBehavior === 'delayed' && hasPendingRequests()) {\n      return;\n    }\n    const tags = pendingTagInvalidations;\n    pendingTagInvalidations = [];\n    if (tags.length === 0) return;\n    const toInvalidate = api.util.selectInvalidatedBy(rootState, tags);\n    context.batch(() => {\n      const valuesArray = Array.from(toInvalidate.values());\n      for (const {\n        queryCacheKey\n      } of valuesArray) {\n        const querySubState = state.queries[queryCacheKey];\n        const subscriptionSubState = getOrInsertComputed(internalState.currentSubscriptions, queryCacheKey, createNewMap);\n        if (querySubState) {\n          if (subscriptionSubState.size === 0) {\n            mwApi.dispatch(removeQueryResult({\n              queryCacheKey: queryCacheKey as QueryCacheKey\n            }));\n          } else if (querySubState.status !== STATUS_UNINITIALIZED) {\n            mwApi.dispatch(refetchQuery(querySubState));\n          }\n        }\n      }\n    });\n  }\n  return handler;\n};","import type { QueryCacheKey, QuerySubstateIdentifier, Subscribers, SubscribersInternal } from '../apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport type { QueryStateMeta, SubMiddlewareApi, TimeoutId, InternalHandlerBuilder, ApiMiddlewareInternalHandler, InternalMiddlewareState } from './types';\nexport const buildPollingHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  queryThunk,\n  api,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    currentPolls,\n    currentSubscriptions\n  } = internalState;\n\n  // Batching state for polling updates\n  const pendingPollingUpdates = new Set<string>();\n  let pollingUpdateTimer: ReturnType<typeof setTimeout> | null = null;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (api.internalActions.updateSubscriptionOptions.match(action) || api.internalActions.unsubscribeQueryResult.match(action)) {\n      schedulePollingUpdate(action.payload.queryCacheKey, mwApi);\n    }\n    if (queryThunk.pending.match(action) || queryThunk.rejected.match(action) && action.meta.condition) {\n      schedulePollingUpdate(action.meta.arg.queryCacheKey, mwApi);\n    }\n    if (queryThunk.fulfilled.match(action) || queryThunk.rejected.match(action) && !action.meta.condition) {\n      startNextPoll(action.meta.arg, mwApi);\n    }\n    if (api.util.resetApiState.match(action)) {\n      clearPolls();\n      // Clear any pending updates\n      if (pollingUpdateTimer) {\n        clearTimeout(pollingUpdateTimer);\n        pollingUpdateTimer = null;\n      }\n      pendingPollingUpdates.clear();\n    }\n  };\n  function schedulePollingUpdate(queryCacheKey: string, api: SubMiddlewareApi) {\n    pendingPollingUpdates.add(queryCacheKey);\n    if (!pollingUpdateTimer) {\n      pollingUpdateTimer = setTimeout(() => {\n        // Process all pending updates in a single batch\n        for (const key of pendingPollingUpdates) {\n          updatePollingInterval({\n            queryCacheKey: key as any\n          }, api);\n        }\n        pendingPollingUpdates.clear();\n        pollingUpdateTimer = null;\n      }, 0);\n    }\n  }\n  function startNextPoll({\n    queryCacheKey\n  }: QuerySubstateIdentifier, api: SubMiddlewareApi) {\n    const state = api.getState()[reducerPath];\n    const querySubState = state.queries[queryCacheKey];\n    const subscriptions = currentSubscriptions.get(queryCacheKey);\n    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) return;\n    const {\n      lowestPollingInterval,\n      skipPollingIfUnfocused\n    } = findLowestPollingInterval(subscriptions);\n    if (!Number.isFinite(lowestPollingInterval)) return;\n    const currentPoll = currentPolls.get(queryCacheKey);\n    if (currentPoll?.timeout) {\n      clearTimeout(currentPoll.timeout);\n      currentPoll.timeout = undefined;\n    }\n    const nextPollTimestamp = Date.now() + lowestPollingInterval;\n    currentPolls.set(queryCacheKey, {\n      nextPollTimestamp,\n      pollingInterval: lowestPollingInterval,\n      timeout: setTimeout(() => {\n        if (state.config.focused || !skipPollingIfUnfocused) {\n          api.dispatch(refetchQuery(querySubState));\n        }\n        startNextPoll({\n          queryCacheKey\n        }, api);\n      }, lowestPollingInterval)\n    });\n  }\n  function updatePollingInterval({\n    queryCacheKey\n  }: QuerySubstateIdentifier, api: SubMiddlewareApi) {\n    const state = api.getState()[reducerPath];\n    const querySubState = state.queries[queryCacheKey];\n    const subscriptions = currentSubscriptions.get(queryCacheKey);\n    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) {\n      return;\n    }\n    const {\n      lowestPollingInterval\n    } = findLowestPollingInterval(subscriptions);\n\n    // HACK add extra data to track how many times this has been called in tests\n    // yes we're mutating a nonexistent field on a Map here\n    if (process.env.NODE_ENV === 'test') {\n      const updateCounters = (currentPolls as any).pollUpdateCounters ??= {};\n      updateCounters[queryCacheKey] ??= 0;\n      updateCounters[queryCacheKey]++;\n    }\n    if (!Number.isFinite(lowestPollingInterval)) {\n      cleanupPollForKey(queryCacheKey);\n      return;\n    }\n    const currentPoll = currentPolls.get(queryCacheKey);\n    const nextPollTimestamp = Date.now() + lowestPollingInterval;\n    if (!currentPoll || nextPollTimestamp < currentPoll.nextPollTimestamp) {\n      startNextPoll({\n        queryCacheKey\n      }, api);\n    }\n  }\n  function cleanupPollForKey(key: string) {\n    const existingPoll = currentPolls.get(key);\n    if (existingPoll?.timeout) {\n      clearTimeout(existingPoll.timeout);\n    }\n    currentPolls.delete(key);\n  }\n  function clearPolls() {\n    for (const key of currentPolls.keys()) {\n      cleanupPollForKey(key);\n    }\n  }\n  function findLowestPollingInterval(subscribers: SubscribersInternal = new Map()) {\n    let skipPollingIfUnfocused: boolean | undefined = false;\n    let lowestPollingInterval = Number.POSITIVE_INFINITY;\n    for (const entry of subscribers.values()) {\n      if (!!entry.pollingInterval) {\n        lowestPollingInterval = Math.min(entry.pollingInterval!, lowestPollingInterval);\n        skipPollingIfUnfocused = entry.skipPollingIfUnfocused || skipPollingIfUnfocused;\n      }\n    }\n    return {\n      lowestPollingInterval,\n      skipPollingIfUnfocused\n    };\n  }\n  return handler;\n};","import { getEndpointDefinition } from '@internal/query/apiTypes';\nimport type { BaseQueryError, BaseQueryFn, BaseQueryMeta } from '../../baseQueryTypes';\nimport { isAnyQueryDefinition } from '../../endpointDefinitions';\nimport type { Recipe } from '../buildThunks';\nimport { isFulfilled, isPending, isRejected } from '../rtkImports';\nimport type { MutationBaseLifecycleApi, QueryBaseLifecycleApi } from './cacheLifecycle';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, PromiseConstructorWithKnownReason, PromiseWithKnownReason } from './types';\nexport type ReferenceQueryLifecycle = never;\ntype QueryLifecyclePromises<ResultType, BaseQuery extends BaseQueryFn> = {\n  /**\n   * Promise that will resolve with the (transformed) query result.\n   *\n   * If the query fails, this promise will reject with the error.\n   *\n   * This allows you to `await` for the query to finish.\n   *\n   * If you don't interact with this promise, it will not throw.\n   */\n  queryFulfilled: PromiseWithKnownReason<{\n    /**\n     * The (transformed) query result.\n     */\n    data: ResultType;\n    /**\n     * The `meta` returned by the `baseQuery`\n     */\n    meta: BaseQueryMeta<BaseQuery>;\n  }, QueryFulfilledRejectionReason<BaseQuery>>;\n};\ntype QueryFulfilledRejectionReason<BaseQuery extends BaseQueryFn> = {\n  error: BaseQueryError<BaseQuery>;\n  /**\n   * If this is `false`, that means this error was returned from the `baseQuery` or `queryFn` in a controlled manner.\n   */\n  isUnhandledError: false;\n  /**\n   * The `meta` returned by the `baseQuery`\n   */\n  meta: BaseQueryMeta<BaseQuery>;\n} | {\n  error: unknown;\n  meta?: undefined;\n  /**\n   * If this is `true`, that means that this error is the result of `baseQueryFn`, `queryFn`, `transformResponse` or `transformErrorResponse` throwing an error instead of handling it properly.\n   * There can not be made any assumption about the shape of `error`.\n   */\n  isUnhandledError: true;\n};\nexport type QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  /**\n   * A function that is called when the individual query is started. The function is called with a lifecycle api object containing properties such as `queryFulfilled`, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. throughout the lifecycle of an individual query/mutation call).\n   *\n   * Can be used to perform side-effects throughout the lifecycle of the query.\n   *\n   * @example\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   * import { messageCreated } from './notificationsSlice\n   * export interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({\n   *     baseUrl: '/',\n   *   }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, number>({\n   *       query: (id) => `post/${id}`,\n   *       async onQueryStarted(id, { dispatch, queryFulfilled }) {\n   *         // `onStart` side-effect\n   *         dispatch(messageCreated('Fetching posts...'))\n   *         try {\n   *           const { data } = await queryFulfilled\n   *           // `onSuccess` side-effect\n   *           dispatch(messageCreated('Posts received!'))\n   *         } catch (err) {\n   *           // `onError` side-effect\n   *           dispatch(messageCreated('Error fetching posts!'))\n   *         }\n   *       }\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  onQueryStarted?(queryArgument: QueryArg, queryLifeCycleApi: QueryLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport type QueryLifecycleInfiniteQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>;\nexport type QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  /**\n   * A function that is called when the individual mutation is started. The function is called with a lifecycle api object containing properties such as `queryFulfilled`, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. throughout the lifecycle of an individual query/mutation call).\n   *\n   * Can be used for `optimistic updates`.\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   * export interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({\n   *     baseUrl: '/',\n   *   }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, number>({\n   *       query: (id) => `post/${id}`,\n   *       providesTags: ['Post'],\n   *     }),\n   *     updatePost: build.mutation<void, Pick<Post, 'id'> & Partial<Post>>({\n   *       query: ({ id, ...patch }) => ({\n   *         url: `post/${id}`,\n   *         method: 'PATCH',\n   *         body: patch,\n   *       }),\n   *       invalidatesTags: ['Post'],\n   *       async onQueryStarted({ id, ...patch }, { dispatch, queryFulfilled }) {\n   *         const patchResult = dispatch(\n   *           api.util.updateQueryData('getPost', id, (draft) => {\n   *             Object.assign(draft, patch)\n   *           })\n   *         )\n   *         try {\n   *           await queryFulfilled\n   *         } catch {\n   *           patchResult.undo()\n   *         }\n   *       },\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  onQueryStarted?(queryArgument: QueryArg, mutationLifeCycleApi: MutationLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport interface QueryLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>, QueryLifecyclePromises<ResultType, BaseQuery> {}\nexport type MutationLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> & QueryLifecyclePromises<ResultType, BaseQuery>;\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryLifecycleQueryExtraOptions.onQueryStarted | onQueryStarted}\n * for a specific query.\n *\n * @example\n * <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>\n *\n * ```ts\n * import type { TypedQueryOnQueryStarted } from '@reduxjs/toolkit/query'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n *\n * type Post = {\n *   id: number\n *   title: string\n *   userId: number\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = number | undefined\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * const baseApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, void>({\n *       query: () => `/posts`,\n *     }),\n *\n *     getPostById: build.query<Post, QueryArgument>({\n *       query: (postId) => `/posts/${postId}`,\n *     }),\n *   }),\n * })\n *\n * const updatePostOnFulfilled: TypedQueryOnQueryStarted<\n *   PostsApiResponse,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   'postsApi'\n * > = async (queryArgument, { dispatch, queryFulfilled }) => {\n *   const result = await queryFulfilled\n *\n *   const { posts } = result.data\n *\n *   // Pre-fill the individual post entries with the results\n *   // from the list endpoint query\n *   dispatch(\n *     baseApiSlice.util.upsertQueryEntries(\n *       posts.map((post) => ({\n *         endpointName: 'getPostById',\n *         arg: post.id,\n *         value: post,\n *       })),\n *     ),\n *   )\n * }\n *\n * export const extendedApiSlice = baseApiSlice.injectEndpoints({\n *   endpoints: (build) => ({\n *     getPostsByUserId: build.query<PostsApiResponse, QueryArgument>({\n *       query: (userId) => `/posts/user/${userId}`,\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *   }),\n * })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template ReducerPath - The type representing the `reducerPath` for the API slice.\n *\n * @since 2.4.0\n * @public\n */\nexport type TypedQueryOnQueryStarted<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleQueryExtraOptions<ResultType, QueryArgumentType, BaseQueryFunctionType, ReducerPath>['onQueryStarted'];\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryLifecycleMutationExtraOptions.onQueryStarted | onQueryStarted}\n * for a specific mutation.\n *\n * @example\n * <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>\n *\n * ```ts\n * import type { TypedMutationOnQueryStarted } from '@reduxjs/toolkit/query'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n *\n * type Post = {\n *   id: number\n *   title: string\n *   userId: number\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = Pick<Post, 'id'> & Partial<Post>\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * const baseApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, void>({\n *       query: () => `/posts`,\n *     }),\n *\n *     getPostById: build.query<Post, number>({\n *       query: (postId) => `/posts/${postId}`,\n *     }),\n *   }),\n * })\n *\n * const updatePostOnFulfilled: TypedMutationOnQueryStarted<\n *   Post,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   'postsApi'\n * > = async ({ id, ...patch }, { dispatch, queryFulfilled }) => {\n *   const patchCollection = dispatch(\n *     baseApiSlice.util.updateQueryData('getPostById', id, (draftPost) => {\n *       Object.assign(draftPost, patch)\n *     }),\n *   )\n *\n *   try {\n *     await queryFulfilled\n *   } catch {\n *     patchCollection.undo()\n *   }\n * }\n *\n * export const extendedApiSlice = baseApiSlice.injectEndpoints({\n *   endpoints: (build) => ({\n *     addPost: build.mutation<Post, Omit<QueryArgument, 'id'>>({\n *       query: (body) => ({\n *         url: `posts/add`,\n *         method: 'POST',\n *         body,\n *       }),\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *\n *     updatePost: build.mutation<Post, QueryArgument>({\n *       query: ({ id, ...patch }) => ({\n *         url: `post/${id}`,\n *         method: 'PATCH',\n *         body: patch,\n *       }),\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *   }),\n * })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template ReducerPath - The type representing the `reducerPath` for the API slice.\n *\n * @since 2.4.0\n * @public\n */\nexport type TypedMutationOnQueryStarted<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleMutationExtraOptions<ResultType, QueryArgumentType, BaseQueryFunctionType, ReducerPath>['onQueryStarted'];\nexport const buildQueryLifecycleHandler: InternalHandlerBuilder = ({\n  api,\n  context,\n  queryThunk,\n  mutationThunk\n}) => {\n  const isPendingThunk = isPending(queryThunk, mutationThunk);\n  const isRejectedThunk = isRejected(queryThunk, mutationThunk);\n  const isFullfilledThunk = isFulfilled(queryThunk, mutationThunk);\n  type CacheLifecycle = {\n    resolve(value: {\n      data: unknown;\n      meta: unknown;\n    }): unknown;\n    reject(value: QueryFulfilledRejectionReason<any>): unknown;\n  };\n  const lifecycleMap: Record<string, CacheLifecycle> = {};\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (isPendingThunk(action)) {\n      const {\n        requestId,\n        arg: {\n          endpointName,\n          originalArgs\n        }\n      } = action.meta;\n      const endpointDefinition = getEndpointDefinition(context, endpointName);\n      const onQueryStarted = endpointDefinition?.onQueryStarted;\n      if (onQueryStarted) {\n        const lifecycle = {} as CacheLifecycle;\n        const queryFulfilled = new (Promise as PromiseConstructorWithKnownReason)<{\n          data: unknown;\n          meta: unknown;\n        }, QueryFulfilledRejectionReason<any>>((resolve, reject) => {\n          lifecycle.resolve = resolve;\n          lifecycle.reject = reject;\n        });\n        // prevent uncaught promise rejections from happening.\n        // if the original promise is used in any way, that will create a new promise that will throw again\n        queryFulfilled.catch(() => {});\n        lifecycleMap[requestId] = lifecycle;\n        const selector = (api.endpoints[endpointName] as any).select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : requestId);\n        const extra = mwApi.dispatch((_, __, extra) => extra);\n        const lifecycleApi = {\n          ...mwApi,\n          getCacheEntry: () => selector(mwApi.getState()),\n          requestId,\n          extra,\n          updateCachedData: (isAnyQueryDefinition(endpointDefinition) ? (updateRecipe: Recipe<any>) => mwApi.dispatch(api.util.updateQueryData(endpointName as never, originalArgs as never, updateRecipe)) : undefined) as any,\n          queryFulfilled\n        };\n        onQueryStarted(originalArgs, lifecycleApi as any);\n      }\n    } else if (isFullfilledThunk(action)) {\n      const {\n        requestId,\n        baseQueryMeta\n      } = action.meta;\n      lifecycleMap[requestId]?.resolve({\n        data: action.payload,\n        meta: baseQueryMeta\n      });\n      delete lifecycleMap[requestId];\n    } else if (isRejectedThunk(action)) {\n      const {\n        requestId,\n        rejectedWithValue,\n        baseQueryMeta\n      } = action.meta;\n      lifecycleMap[requestId]?.reject({\n        error: action.payload ?? action.error,\n        isUnhandledError: !rejectedWithValue,\n        meta: baseQueryMeta as any\n      });\n      delete lifecycleMap[requestId];\n    }\n  };\n  return handler;\n};","import { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport type { QueryCacheKey } from '../apiState';\nimport { onFocus, onOnline } from '../setupListeners';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, SubMiddlewareApi } from './types';\nexport const buildWindowEventHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  context,\n  api,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    removeQueryResult\n  } = api.internalActions;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (onFocus.match(action)) {\n      refetchValidQueries(mwApi, 'refetchOnFocus');\n    }\n    if (onOnline.match(action)) {\n      refetchValidQueries(mwApi, 'refetchOnReconnect');\n    }\n  };\n  function refetchValidQueries(api: SubMiddlewareApi, type: 'refetchOnFocus' | 'refetchOnReconnect') {\n    const state = api.getState()[reducerPath];\n    const queries = state.queries;\n    const subscriptions = internalState.currentSubscriptions;\n    context.batch(() => {\n      for (const queryCacheKey of subscriptions.keys()) {\n        const querySubState = queries[queryCacheKey];\n        const subscriptionSubState = subscriptions.get(queryCacheKey);\n        if (!subscriptionSubState || !querySubState) continue;\n        const values = [...subscriptionSubState.values()];\n        const shouldRefetch = values.some(sub => sub[type] === true) || values.every(sub => sub[type] === undefined) && state.config[type];\n        if (shouldRefetch) {\n          if (subscriptionSubState.size === 0) {\n            api.dispatch(removeQueryResult({\n              queryCacheKey: queryCacheKey as QueryCacheKey\n            }));\n          } else if (querySubState.status !== STATUS_UNINITIALIZED) {\n            api.dispatch(refetchQuery(querySubState));\n          }\n        }\n      }\n    });\n  }\n  return handler;\n};","import type { Action, Middleware, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { EndpointDefinitions, FullTagDescription } from '../../endpointDefinitions';\nimport type { QueryStatus, QuerySubState, RootState } from '../apiState';\nimport type { QueryThunkArg } from '../buildThunks';\nimport { createAction, isAction } from '../rtkImports';\nimport { buildBatchedActionsHandler } from './batchActions';\nimport { buildCacheCollectionHandler } from './cacheCollection';\nimport { buildCacheLifecycleHandler } from './cacheLifecycle';\nimport { buildDevCheckHandler } from './devMiddleware';\nimport { buildInvalidationByTagsHandler } from './invalidationByTags';\nimport { buildPollingHandler } from './polling';\nimport { buildQueryLifecycleHandler } from './queryLifecycle';\nimport type { BuildMiddlewareInput, InternalHandlerBuilder, InternalMiddlewareState } from './types';\nimport { buildWindowEventHandler } from './windowEventHandling';\nimport type { ApiEndpointQuery } from '../module';\nexport type { ReferenceCacheCollection } from './cacheCollection';\nexport type { MutationCacheLifecycleApi, QueryCacheLifecycleApi, ReferenceCacheLifecycle } from './cacheLifecycle';\nexport type { MutationLifecycleApi, QueryLifecycleApi, ReferenceQueryLifecycle, TypedMutationOnQueryStarted, TypedQueryOnQueryStarted } from './queryLifecycle';\nexport type { SubscriptionSelectors } from './types';\nexport function buildMiddleware<Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string>(input: BuildMiddlewareInput<Definitions, ReducerPath, TagTypes>) {\n  const {\n    reducerPath,\n    queryThunk,\n    api,\n    context,\n    getInternalState\n  } = input;\n  const {\n    apiUid\n  } = context;\n  const actions = {\n    invalidateTags: createAction<Array<TagTypes | FullTagDescription<TagTypes> | null | undefined>>(`${reducerPath}/invalidateTags`)\n  };\n  const isThisApiSliceAction = (action: Action) => action.type.startsWith(`${reducerPath}/`);\n  const handlerBuilders: InternalHandlerBuilder[] = [buildDevCheckHandler, buildCacheCollectionHandler, buildInvalidationByTagsHandler, buildPollingHandler, buildCacheLifecycleHandler, buildQueryLifecycleHandler];\n  const middleware: Middleware<{}, RootState<Definitions, string, ReducerPath>, ThunkDispatch<any, any, UnknownAction>> = mwApi => {\n    let initialized = false;\n    const internalState = getInternalState(mwApi.dispatch);\n    const builderArgs = {\n      ...(input as any as BuildMiddlewareInput<EndpointDefinitions, string, string>),\n      internalState,\n      refetchQuery,\n      isThisApiSliceAction,\n      mwApi\n    };\n    const handlers = handlerBuilders.map(build => build(builderArgs));\n    const batchedActionsHandler = buildBatchedActionsHandler(builderArgs);\n    const windowEventsHandler = buildWindowEventHandler(builderArgs);\n    return next => {\n      return action => {\n        if (!isAction(action)) {\n          return next(action);\n        }\n        if (!initialized) {\n          initialized = true;\n          // dispatch before any other action\n          mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));\n        }\n        const mwApiWithNext = {\n          ...mwApi,\n          next\n        };\n        const stateBefore = mwApi.getState();\n        const [actionShouldContinue, internalProbeResult] = batchedActionsHandler(action, mwApiWithNext, stateBefore);\n        let res: any;\n        if (actionShouldContinue) {\n          res = next(action);\n        } else {\n          res = internalProbeResult;\n        }\n        if (!!mwApi.getState()[reducerPath]) {\n          // Only run these checks if the middleware is registered okay\n\n          // This looks for actions that aren't specific to the API slice\n          windowEventsHandler(action, mwApiWithNext, stateBefore);\n          if (isThisApiSliceAction(action) || context.hasRehydrationInfo(action)) {\n            // Only run these additional checks if the actions are part of the API slice,\n            // or the action has hydration-related data\n            for (const handler of handlers) {\n              handler(action, mwApiWithNext, stateBefore);\n            }\n          }\n        }\n        return res;\n      };\n    };\n  };\n  return {\n    middleware,\n    actions\n  };\n  function refetchQuery(querySubState: Exclude<QuerySubState<any>, {\n    status: QueryStatus.uninitialized;\n  }>) {\n    return (input.api.endpoints[querySubState.endpointName] as ApiEndpointQuery<any, any>).initiate(querySubState.originalArgs as any, {\n      subscribe: false,\n      forceRefetch: true\n    });\n  }\n}","/**\n * Note: this file should import all other files for type discovery and declaration merging\n */\nimport type { ActionCreatorWithPayload, Dispatch, Middleware, Reducer, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport { enablePatches } from '../utils/immerImports';\nimport type { Api, Module } from '../apiTypes';\nimport type { BaseQueryFn } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { AssertTagTypes, EndpointDefinitions, InfiniteQueryDefinition, MutationDefinition, QueryArgFrom, QueryArgFromAnyQuery, QueryDefinition, TagDescription } from '../endpointDefinitions';\nimport { isInfiniteQueryDefinition, isMutationDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { assertCast, safeAssign } from '../tsHelpers';\nimport type { CombinedState, MutationKeys, QueryKeys, RootState } from './apiState';\nimport type { BuildInitiateApiEndpointMutation, BuildInitiateApiEndpointQuery, MutationActionCreatorResult, QueryActionCreatorResult, InfiniteQueryActionCreatorResult, BuildInitiateApiEndpointInfiniteQuery } from './buildInitiate';\nimport { buildInitiate } from './buildInitiate';\nimport type { ReferenceCacheCollection, ReferenceCacheLifecycle, ReferenceQueryLifecycle } from './buildMiddleware';\nimport { buildMiddleware } from './buildMiddleware';\nimport type { BuildSelectorsApiEndpointInfiniteQuery, BuildSelectorsApiEndpointMutation, BuildSelectorsApiEndpointQuery } from './buildSelectors';\nimport { buildSelectors } from './buildSelectors';\nimport type { SliceActions, UpsertEntries } from './buildSlice';\nimport { buildSlice } from './buildSlice';\nimport type { AllQueryKeys, BuildThunksApiEndpointInfiniteQuery, BuildThunksApiEndpointMutation, BuildThunksApiEndpointQuery, PatchQueryDataThunk, QueryArgFromAnyQueryDefinition, UpdateQueryDataThunk, UpsertQueryDataThunk } from './buildThunks';\nimport { buildThunks } from './buildThunks';\nimport { createSelector as _createSelector } from './rtkImports';\nimport { onFocus, onFocusLost, onOffline, onOnline } from './setupListeners';\nimport type { InternalMiddlewareState } from './buildMiddleware/types';\nimport { getOrInsertComputed } from '../utils';\nimport type { CreateSelectorFunction } from 'reselect';\n\n/**\n * `ifOlderThan` - (default: `false` | `number`) - _number is value in seconds_\n * - If specified, it will only run the query if the difference between `new Date()` and the last `fulfilledTimeStamp` is greater than the given value\n *\n * @overloadSummary\n * `force`\n * - If `force: true`, it will ignore the `ifOlderThan` value if it is set and the query will be run even if it exists in the cache.\n */\nexport type PrefetchOptions = {\n  ifOlderThan?: false | number;\n} | {\n  force?: boolean;\n};\nexport const coreModuleName = /* @__PURE__ */Symbol();\nexport type CoreModule = typeof coreModuleName | ReferenceCacheLifecycle | ReferenceQueryLifecycle | ReferenceCacheCollection;\nexport type ThunkWithReturnValue<T> = ThunkAction<T, any, any, UnknownAction>;\nexport interface ApiModules<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nBaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string> {\n  [coreModuleName]: {\n    /**\n     * This api's reducer should be mounted at `store[api.reducerPath]`.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    reducerPath: ReducerPath;\n    /**\n     * Internal actions not part of the public API. Note: These are subject to change at any given time.\n     */\n    internalActions: InternalActions;\n    /**\n     *  A standard redux reducer that enables core functionality. Make sure it's included in your store.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    reducer: Reducer<CombinedState<Definitions, TagTypes, ReducerPath>, UnknownAction>;\n    /**\n     * This is a standard redux middleware and is responsible for things like polling, garbage collection and a handful of other things. Make sure it's included in your store.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    middleware: Middleware<{}, RootState<Definitions, string, ReducerPath>, ThunkDispatch<any, any, UnknownAction>>;\n    /**\n     * A collection of utility thunks for various situations.\n     */\n    util: {\n      /**\n       * A thunk that (if dispatched) will return a specific running query, identified\n       * by `endpointName` and `arg`.\n       * If that query is not running, dispatching the thunk will result in `undefined`.\n       *\n       * Can be used to await a specific query triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningQueryThunk<EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>): ThunkWithReturnValue<QueryActionCreatorResult<Definitions[EndpointName] & {\n        type: 'query';\n      }> | InfiniteQueryActionCreatorResult<Definitions[EndpointName] & {\n        type: 'infinitequery';\n      }> | undefined>;\n\n      /**\n       * A thunk that (if dispatched) will return a specific running mutation, identified\n       * by `endpointName` and `fixedCacheKey` or `requestId`.\n       * If that mutation is not running, dispatching the thunk will result in `undefined`.\n       *\n       * Can be used to await a specific mutation triggered in any way,\n       * including via hook trigger functions or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningMutationThunk<EndpointName extends MutationKeys<Definitions>>(endpointName: EndpointName, fixedCacheKeyOrRequestId: string): ThunkWithReturnValue<MutationActionCreatorResult<Definitions[EndpointName] & {\n        type: 'mutation';\n      }> | undefined>;\n\n      /**\n       * A thunk that (if dispatched) will return all running queries.\n       *\n       * Useful for SSR scenarios to await all running queries triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningQueriesThunk(): ThunkWithReturnValue<Array<QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>>;\n\n      /**\n       * A thunk that (if dispatched) will return all running mutations.\n       *\n       * Useful for SSR scenarios to await all running mutations triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningMutationsThunk(): ThunkWithReturnValue<Array<MutationActionCreatorResult<any>>>;\n\n      /**\n       * A Redux thunk that can be used to manually trigger pre-fetching of data.\n       *\n       * The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a set of options used to determine if the data actually should be re-fetched based on cache staleness.\n       *\n       * React Hooks users will most likely never need to use this directly, as the `usePrefetch` hook will dispatch this thunk internally as needed when you call the prefetching function supplied by the hook.\n       *\n       * @example\n       *\n       * ```ts no-transpile\n       * dispatch(api.util.prefetch('getPosts', undefined, { force: true }))\n       * ```\n       */\n      prefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions): ThunkAction<void, any, any, UnknownAction>;\n      /**\n       * A Redux thunk action creator that, when dispatched, creates and applies a set of JSON diff/patch objects to the current state. This immediately updates the Redux state with those changes.\n       *\n       * The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and an `updateRecipe` callback function. The callback receives an Immer-wrapped `draft` of the current state, and may modify the draft to match the expected results after the mutation completes successfully.\n       *\n       * The thunk executes _synchronously_, and returns an object containing `{patches: Patch[], inversePatches: Patch[], undo: () => void}`. The `patches` and `inversePatches` are generated using Immer's [`produceWithPatches` method](https://immerjs.github.io/immer/patches).\n       *\n       * This is typically used as the first step in implementing optimistic updates. The generated `inversePatches` can be used to revert the updates by calling `dispatch(patchQueryData(endpointName, arg, inversePatches))`. Alternatively, the `undo` method can be called directly to achieve the same effect.\n       *\n       * Note that the first two arguments (`endpointName` and `arg`) are used to determine which existing cache entry to update. If no existing cache entry is found, the `updateRecipe` callback will not run.\n       *\n       * @example\n       *\n       * ```ts\n       * const patchCollection = dispatch(\n       *   api.util.updateQueryData('getPosts', undefined, (draftPosts) => {\n       *     draftPosts.push({ id: 1, name: 'Teddy' })\n       *   })\n       * )\n       * ```\n       */\n      updateQueryData: UpdateQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n\n      /**\n       * A Redux thunk action creator that, when dispatched, acts as an artificial API request to upsert a value into the cache.\n       *\n       * The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and the data to upsert.\n       *\n       * If no cache entry for that cache key exists, a cache entry will be created and the data added. If a cache entry already exists, this will _overwrite_ the existing cache entry data.\n       *\n       * The thunk executes _asynchronously_, and returns a promise that resolves when the store has been updated.\n       *\n       * If dispatched while an actual request is in progress, both the upsert and request will be handled as soon as they resolve, resulting in a \"last result wins\" update behavior.\n       *\n       * @example\n       *\n       * ```ts\n       * await dispatch(\n       *   api.util.upsertQueryData('getPost', {id: 1}, {id: 1, text: \"Hello!\"})\n       * )\n       * ```\n       */\n      upsertQueryData: UpsertQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n      /**\n       * A Redux thunk that applies a JSON diff/patch array to the cached data for a given query result. This immediately updates the Redux state with those changes.\n       *\n       * The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a JSON diff/patch array as produced by Immer's `produceWithPatches`.\n       *\n       * This is typically used as the second step in implementing optimistic updates. If a request fails, the optimistically-applied changes can be reverted by dispatching `patchQueryData` with the `inversePatches` that were generated by `updateQueryData` earlier.\n       *\n       * In cases where it is desired to simply revert the previous changes, it may be preferable to call the `undo` method returned from dispatching `updateQueryData` instead.\n       *\n       * @example\n       * ```ts\n       * const patchCollection = dispatch(\n       *   api.util.updateQueryData('getPosts', undefined, (draftPosts) => {\n       *     draftPosts.push({ id: 1, name: 'Teddy' })\n       *   })\n       * )\n       *\n       * // later\n       * dispatch(\n       *   api.util.patchQueryData('getPosts', undefined, patchCollection.inversePatches)\n       * )\n       *\n       * // or\n       * patchCollection.undo()\n       * ```\n       */\n      patchQueryData: PatchQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n\n      /**\n       * A Redux action creator that can be dispatched to manually reset the api state completely. This will immediately remove all existing cache entries, and all queries will be considered 'uninitialized'.\n       *\n       * @example\n       *\n       * ```ts\n       * dispatch(api.util.resetApiState())\n       * ```\n       */\n      resetApiState: SliceActions['resetApiState'];\n      upsertQueryEntries: UpsertEntries<Definitions>;\n\n      /**\n       * A Redux action creator that can be used to manually invalidate cache tags for [automated re-fetching](../../usage/automated-refetching.mdx).\n       *\n       * The action creator accepts one argument: the cache tags to be invalidated. It returns an action with those tags as a payload, and the corresponding `invalidateTags` action type for the api.\n       *\n       * Dispatching the result of this action creator will [invalidate](../../usage/automated-refetching.mdx#invalidating-cache-data) the given tags, causing queries to automatically re-fetch if they are subscribed to cache data that [provides](../../usage/automated-refetching.mdx#providing-cache-data) the corresponding tags.\n       *\n       * The array of tags provided to the action creator should be in one of the following formats, where `TagType` is equal to a string provided to the [`tagTypes`](../createApi.mdx#tagtypes) property of the api:\n       *\n       * - `[TagType]`\n       * - `[{ type: TagType }]`\n       * - `[{ type: TagType, id: number | string }]`\n       *\n       * @example\n       *\n       * ```ts\n       * dispatch(api.util.invalidateTags(['Post']))\n       * dispatch(api.util.invalidateTags([{ type: 'Post', id: 1 }]))\n       * dispatch(\n       *   api.util.invalidateTags([\n       *     { type: 'Post', id: 1 },\n       *     { type: 'Post', id: 'LIST' },\n       *   ])\n       * )\n       * ```\n       */\n      invalidateTags: ActionCreatorWithPayload<Array<TagDescription<TagTypes> | null | undefined>, string>;\n\n      /**\n       * A function to select all `{ endpointName, originalArgs, queryCacheKey }` combinations that would be invalidated by a specific set of tags.\n       *\n       * Can be used for mutations that want to do optimistic updates instead of invalidating a set of tags, but don't know exactly what they need to update.\n       */\n      selectInvalidatedBy: (state: RootState<Definitions, string, ReducerPath>, tags: ReadonlyArray<TagDescription<TagTypes> | null | undefined>) => Array<{\n        endpointName: string;\n        originalArgs: any;\n        queryCacheKey: string;\n      }>;\n\n      /**\n       * A function to select all arguments currently cached for a given endpoint.\n       *\n       * Can be used for mutations that want to do optimistic updates instead of invalidating a set of tags, but don't know exactly what they need to update.\n       */\n      selectCachedArgsForQuery: <QueryName extends AllQueryKeys<Definitions>>(state: RootState<Definitions, string, ReducerPath>, queryName: QueryName) => Array<QueryArgFromAnyQuery<Definitions[QueryName]>>;\n    };\n    /**\n     * Endpoints based on the input endpoints provided to `createApi`, containing `select` and `action matchers`.\n     */\n    endpoints: { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? ApiEndpointQuery<Definitions[K], Definitions> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? ApiEndpointMutation<Definitions[K], Definitions> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? ApiEndpointInfiniteQuery<Definitions[K], Definitions> : never };\n  };\n}\nexport interface ApiEndpointQuery<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends QueryDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointQuery<Definition>, BuildInitiateApiEndpointQuery<Definition>, BuildSelectorsApiEndpointQuery<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\nexport interface ApiEndpointInfiniteQuery<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends InfiniteQueryDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointInfiniteQuery<Definition>, BuildInitiateApiEndpointInfiniteQuery<Definition>, BuildSelectorsApiEndpointInfiniteQuery<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport interface ApiEndpointMutation<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends MutationDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointMutation<Definition>, BuildInitiateApiEndpointMutation<Definition>, BuildSelectorsApiEndpointMutation<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\nexport type ListenerActions = {\n  /**\n   * Will cause the RTK Query middleware to trigger any refetchOnReconnect-related behavior\n   * @link https://redux-toolkit.js.org/rtk-query/api/setupListeners\n   */\n  onOnline: typeof onOnline;\n  onOffline: typeof onOffline;\n  /**\n   * Will cause the RTK Query middleware to trigger any refetchOnFocus-related behavior\n   * @link https://redux-toolkit.js.org/rtk-query/api/setupListeners\n   */\n  onFocus: typeof onFocus;\n  onFocusLost: typeof onFocusLost;\n};\nexport type InternalActions = SliceActions & ListenerActions;\nexport interface CoreModuleOptions {\n  /**\n   * A selector creator (usually from `reselect`, or matching the same signature)\n   */\n  createSelector?: CreateSelectorFunction<any, any, any>;\n}\n\n/**\n * Creates a module containing the basic redux logic for use with `buildCreateApi`.\n *\n * @example\n * ```ts\n * const createBaseApi = buildCreateApi(coreModule());\n * ```\n */\nexport const coreModule = ({\n  createSelector = _createSelector\n}: CoreModuleOptions = {}): Module<CoreModule> => ({\n  name: coreModuleName,\n  init(api, {\n    baseQuery,\n    tagTypes,\n    reducerPath,\n    serializeQueryArgs,\n    keepUnusedDataFor,\n    refetchOnMountOrArgChange,\n    refetchOnFocus,\n    refetchOnReconnect,\n    invalidationBehavior,\n    onSchemaFailure,\n    catchSchemaFailure,\n    skipSchemaValidation\n  }, context) {\n    enablePatches();\n    assertCast<InternalSerializeQueryArgs>(serializeQueryArgs);\n    const assertTagType: AssertTagTypes = tag => {\n      if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n        if (!tagTypes.includes(tag.type as any)) {\n          console.error(`Tag type '${tag.type}' was used, but not specified in \\`tagTypes\\`!`);\n        }\n      }\n      return tag;\n    };\n    Object.assign(api, {\n      reducerPath,\n      endpoints: {},\n      internalActions: {\n        onOnline,\n        onOffline,\n        onFocus,\n        onFocusLost\n      },\n      util: {}\n    });\n    const selectors = buildSelectors({\n      serializeQueryArgs: serializeQueryArgs as any,\n      reducerPath,\n      createSelector\n    });\n    const {\n      selectInvalidatedBy,\n      selectCachedArgsForQuery,\n      buildQuerySelector,\n      buildInfiniteQuerySelector,\n      buildMutationSelector\n    } = selectors;\n    safeAssign(api.util, {\n      selectInvalidatedBy,\n      selectCachedArgsForQuery\n    });\n    const {\n      queryThunk,\n      infiniteQueryThunk,\n      mutationThunk,\n      patchQueryData,\n      updateQueryData,\n      upsertQueryData,\n      prefetch,\n      buildMatchThunkActions\n    } = buildThunks({\n      baseQuery,\n      reducerPath,\n      context,\n      api,\n      serializeQueryArgs,\n      assertTagType,\n      selectors,\n      onSchemaFailure,\n      catchSchemaFailure,\n      skipSchemaValidation\n    });\n    const {\n      reducer,\n      actions: sliceActions\n    } = buildSlice({\n      context,\n      queryThunk,\n      infiniteQueryThunk,\n      mutationThunk,\n      serializeQueryArgs,\n      reducerPath,\n      assertTagType,\n      config: {\n        refetchOnFocus,\n        refetchOnReconnect,\n        refetchOnMountOrArgChange,\n        keepUnusedDataFor,\n        reducerPath,\n        invalidationBehavior\n      }\n    });\n    safeAssign(api.util, {\n      patchQueryData,\n      updateQueryData,\n      upsertQueryData,\n      prefetch,\n      resetApiState: sliceActions.resetApiState,\n      upsertQueryEntries: sliceActions.cacheEntriesUpserted as any\n    });\n    safeAssign(api.internalActions, sliceActions);\n    const internalStateMap = new WeakMap<Dispatch, InternalMiddlewareState>();\n    const getInternalState = (dispatch: Dispatch) => {\n      const state = getOrInsertComputed(internalStateMap, dispatch, () => ({\n        currentSubscriptions: new Map(),\n        currentPolls: new Map(),\n        runningQueries: new Map(),\n        runningMutations: new Map()\n      }));\n      return state;\n    };\n    const {\n      buildInitiateQuery,\n      buildInitiateInfiniteQuery,\n      buildInitiateMutation,\n      getRunningMutationThunk,\n      getRunningMutationsThunk,\n      getRunningQueriesThunk,\n      getRunningQueryThunk\n    } = buildInitiate({\n      queryThunk,\n      mutationThunk,\n      infiniteQueryThunk,\n      api,\n      serializeQueryArgs: serializeQueryArgs as any,\n      context,\n      getInternalState\n    });\n    safeAssign(api.util, {\n      getRunningMutationThunk,\n      getRunningMutationsThunk,\n      getRunningQueryThunk,\n      getRunningQueriesThunk\n    });\n    const {\n      middleware,\n      actions: middlewareActions\n    } = buildMiddleware({\n      reducerPath,\n      context,\n      queryThunk,\n      mutationThunk,\n      infiniteQueryThunk,\n      api,\n      assertTagType,\n      selectors,\n      getRunningQueryThunk,\n      getInternalState\n    });\n    safeAssign(api.util, middlewareActions);\n    safeAssign(api, {\n      reducer: reducer as any,\n      middleware\n    });\n    return {\n      name: coreModuleName,\n      injectEndpoint(endpointName, definition) {\n        const anyApi = api as any as Api<any, Record<string, any>, string, string, CoreModule>;\n        const endpoint = anyApi.endpoints[endpointName] ??= {} as any;\n        if (isQueryDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildQuerySelector(endpointName, definition),\n            initiate: buildInitiateQuery(endpointName, definition)\n          }, buildMatchThunkActions(queryThunk, endpointName));\n        }\n        if (isMutationDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildMutationSelector(),\n            initiate: buildInitiateMutation(endpointName)\n          }, buildMatchThunkActions(mutationThunk, endpointName));\n        }\n        if (isInfiniteQueryDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildInfiniteQuerySelector(endpointName, definition),\n            initiate: buildInitiateInfiniteQuery(endpointName, definition)\n          }, buildMatchThunkActions(queryThunk, endpointName));\n        }\n      }\n    };\n  }\n});","import { buildCreateApi } from '../createApi';\nimport { coreModule } from './module';\nexport const createApi = /* @__PURE__ */buildCreateApi(coreModule());\nexport { QueryStatus } from './apiState';\nexport type { CombinedState, InfiniteData, InfiniteQueryConfigOptions, InfiniteQuerySubState, MutationKeys, QueryCacheKey, QueryKeys, QuerySubState, RootState, SubscriptionOptions } from './apiState';\nexport type { InfiniteQueryActionCreatorResult, MutationActionCreatorResult, QueryActionCreatorResult, StartQueryActionCreatorOptions } from './buildInitiate';\nexport type { MutationCacheLifecycleApi, MutationLifecycleApi, QueryCacheLifecycleApi, QueryLifecycleApi, SubscriptionSelectors, TypedMutationOnQueryStarted, TypedQueryOnQueryStarted } from './buildMiddleware/index';\nexport { skipToken } from './buildSelectors';\nexport type { InfiniteQueryResultSelectorResult, MutationResultSelectorResult, QueryResultSelectorResult, SkipToken } from './buildSelectors';\nexport type { SliceActions } from './buildSlice';\nexport type { PatchQueryDataThunk, UpdateQueryDataThunk, UpsertQueryDataThunk } from './buildThunks';\nexport { coreModuleName } from './module';\nexport type { ApiEndpointInfiniteQuery, ApiEndpointMutation, ApiEndpointQuery, CoreModule, InternalActions, PrefetchOptions, ThunkWithReturnValue } from './module';\nexport { setupListeners } from './setupListeners';\nexport { buildCreateApi, coreModule };"],"mappings":"AAkEO,IAAKA,QACVA,EAAA,cAAgB,gBAChBA,EAAA,QAAU,UACVA,EAAA,UAAY,YACZA,EAAA,SAAW,WAJDA,QAAA,IAQCC,EAAuB,gBACvBC,GAAiB,UACjBC,GAAmB,YACnBC,GAAkB,WA0BxB,SAASC,GAAsBC,EAAyC,CAC7E,MAAO,CACL,OAAAA,EACA,gBAAiBA,IAAWL,EAC5B,UAAWK,IAAWJ,GACtB,UAAWI,IAAWH,GACtB,QAASG,IAAWF,EACtB,CACF,CC3GA,OAAS,gBAAAG,GAAc,eAAAC,GAAa,kBAAAC,GAAgB,oBAAAC,GAAkB,mBAAAC,G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Ad,EAAW5B,EAAI,KAAMsD,CAAiB,EACtC1B,EAAW5B,EAAK,CACd,QAASsC,EACT,WAAAe,CACF,CAAC,EACM,CACL,KAAMxD,GACN,eAAe2D,EAAcC,EAAY,CACvC,IAAMC,EAAS1D,EACT2D,EAAWD,EAAO,UAAUF,CAAY,IAAM,CAAC,EACjDI,GAAkBH,CAAU,GAC9B7B,EAAW+B,EAAU,CACnB,KAAMH,EACN,OAAQ/B,EAAmB+B,EAAcC,CAAU,EACnD,SAAUZ,EAAmBW,EAAcC,CAAU,CACvD,EAAGrB,EAAuBP,EAAY2B,CAAY,CAAC,EAEjDK,GAAqBJ,CAAU,GACjC7B,EAAW+B,EAAU,CACnB,KAAMH,EACN,OAAQ7B,EAAsB,EAC9B,SAAUoB,EAAsBS,CAAY,CAC9C,EAAGpB,EAAuBL,EAAeyB,CAAY,CAAC,EAEpDM,GAA0BL,CAAU,GACtC7B,EAAW+B,EAAU,CACnB,KAAMH,EACN,OAAQ9B,EAA2B8B,EAAcC,CAAU,EAC3D,SAAUX,EAA2BU,EAAcC,CAAU,CAC/D,EAAGrB,EAAuBP,EAAY2B,CAAY,CAAC,CAEvD,CACF,CACF,CACF,GCniBO,IAAMO,GAA2BC,GAAeC,GAAW,CAAC","names":["QueryStatus","STATUS_UNINITIALIZED","STATUS_PENDING","STATUS_FULFILLED","STATUS_REJECTED","getRequestStatusFlags","status","createAction","createSlice","createSelector","createAsyncThunk","combineReducers","createNextState","isAnyOf","isAllOf","isAction","isPending","isRejected","isFulfilled","isRejectedWithValue","isAsyncThunkAction","prepareAutoBatched","SHOULD_AUTOBATCH","isPlainObject","nanoid","isPlainObject","copyWithStructuralSharing","oldObj","newObj","newKeys","oldKeys","isSameObject","mergeObj","key","filterMap","array","predicate","mapper","acc","item","i","isAbsoluteUrl","url","isDocumentVisible","isNotNullish","v","filterNullishValues","map","isOnline","withoutTrailingSlash","url","withoutLeadingSlash","joinUrls","base","isAbsoluteUrl","delimiter","getOrInsertComputed","map","key","compute","createNewMap","timeoutSignal","milliseconds","abortController","message","name","anySignal","signals","signal","defaultFetchFn","args","defaultValidateStatus","response","defaultIsJsonContentType","headers","stripUndefined","obj","isPlainObject","copy","k","v","isJsonifiable","body","fetchBaseQuery","baseUrl","prepareHeaders","x","fetchFn","paramsSerializer","isJsonContentType","jsonContentType","jsonReplacer","defaultTimeout","globalResponseHandler","globalValidateStatus","baseFetchOptions","arg","api","extraOptions","getState","extra","endpoint","forced","type","meta","url","params","responseHandler","validateStatus","timeout","rest","config","anySignal","timeoutSignal","bodyIsJsonifiable","divider","query","joinUrls","request","e","responseClone","resultData","responseText","handleResponseError","handleResponse","r","text","HandledError","value","meta","defaultBackoff","attempt","maxRetries","signal","attempts","timeout","resolve","reject","timeoutId","abortHandler","fail","error","meta","HandledError","failIfAborted","EMPTY_OPTIONS","retryWithBackoff","baseQuery","defaultOptions","args","api","extraOptions","possibleMaxRetries","options","_","__","retry","result","e","backoffError","INTERNAL_PREFIX","ONLINE","OFFLINE","FOCUS","FOCUSED","VISIBILITYCHANGE","onFocus","createAction","onFocusLost","onOnline","onOffline","actions","initialized","setupListeners","dispatch","customHandler","defaultHandler","handleFocus","handleFocusLost","handleOnline","handleOffline","action","handleVisibilityChange","unsubscribe","updateListeners","add","handlers","event","handler","ENDPOINT_QUERY","ENDPOINT_MUTATION","ENDPOINT_INFINITEQUERY","isQueryDefinition","isMutationDefinition","isInfiniteQueryDefinition","isAnyQueryDefinition","calculateProvidedBy","description","result","error","queryArg","meta","assertTagTypes","finalDescription","isFunction","filterMap","isNotNullish","tag","expandTagDescription","t","current","isDraft","applyPatches","original","isDraftable","produceWithPatches","enablePatches","asSafePromise","promise","fallback","getEndpointDefinition","context","endpointName","forceQueryFnSymbol","isUpsertQuery","arg","buildInitiate","serializeQueryArgs","queryThunk","infiniteQueryThunk","mutationThunk","api","context","getInternalState","getRunningQueries","dispatch","getRunningMutations","unsubscribeQueryResult","removeMutationResult","updateSubscriptionOptions","buildInitiateQuery","buildInitiateInfiniteQuery","buildInitiateMutation","getRunningQueryThunk","getRunningMutationThunk","getRunningQueriesThunk","getRunningMutationsThunk","endpointName","queryArgs","endpointDefinition","getEndpointDefinition","queryCacheKey","_endpointName","fixedCacheKeyOrRequestId","filterNullishValues","middlewareWarning","buildInitiateAnyQuery","queryAction","subscribe","forceRefetch","subscriptionOptions","forceQueryFn","rest","getState","thunk","commonThunkArgs","ENDPOINT_QUERY","isQueryDefinition","direction","initialPageParam","refetchCachedPages","selector","thunkResult","stateAfter","requestId","abort","skippedSynchronously","runningQuery","selectFromState","statePromise","result","options","runningQueries","track","fixedCacheKey","unwrap","returnValuePromise","asSafePromise","data","error","reset","ret","runningMutations","SchemaError","NamedSchemaError","issues","value","schemaName","_bqMeta","shouldSkip","skipSchemaValidation","parseWithSchema","schema","data","bqMeta","result","defaultTransformResponse","baseQueryReturnValue","addShouldAutoBatch","arg","SHOULD_AUTOBATCH","buildThunks","reducerPath","baseQuery","endpointDefinitions","serializeQueryArgs","api","assertTagType","selectors","onSchemaFailure","globalCatchSchemaFailure","globalSkipSchemaValidation","patchQueryData","endpointName","patches","updateProvided","dispatch","getState","endpointDefinition","queryCacheKey","newValue","providedTags","calculateProvidedBy","addToStart","items","item","max","newItems","addToEnd","updateQueryData","updateRecipe","currentState","ret","STATUS_UNINITIALIZED","isDraftable","value","inversePatches","produceWithPatches","upsertQueryData","forceQueryFnSymbol","getTransformCallbackForEndpoint","transformFieldName","executeEndpoint","signal","abort","rejectWithValue","fulfillWithValue","extra","metaSchema","skipSchemaValidation","isQuery","ENDPOINT_QUERY","transformResponse","baseQueryApi","isForcedQuery","forceQueryFn","finalQueryReturnValue","fetchPage","data","param","maxPages","previous","finalQueryArg","pageResponse","executeRequest","addTo","result","extraOptions","argSchema","rawResponseSchema","responseSchema","shouldSkip","parseWithSchema","HandledError","transformedResponse","infiniteQueryOptions","refetchCachedPages","blankData","cachedData","existingData","getPreviousPageParam","getNextPageParam","initialPageParam","cachedPageParams","firstPageParam","totalPages","i","error","caughtError","transformErrorResponse","rawErrorResponseSchema","errorResponseSchema","meta","transformedErrorResponse","e","NamedSchemaError","info","catchSchemaFailure","state","requestState","baseFetchOnMountOrArgChange","fulfilledVal","refetchVal","createQueryThunk","createAsyncThunk","isInfiniteQueryDefinition","queryThunkArg","currentArg","previousArg","direction","isUpsertQuery","isQueryDefinition","queryThunk","infiniteQueryThunk","mutationThunk","hasTheForce","options","hasMaxAge","prefetch","force","maxAge","queryAction","latestStateValue","lastFulfilledTs","matchesEndpoint","action","buildMatchThunkActions","thunk","isAllOf","isPending","isFulfilled","isRejected","pages","pageParams","queryArg","lastIndex","calculateProvidedByThunk","type","isRejectedWithValue","getCurrent","value","isDraft","current","updateQuerySubstateIfExists","state","queryCacheKey","update","substate","getMutationCacheKey","id","updateMutationSubstateIfExists","initialState","buildSlice","reducerPath","queryThunk","mutationThunk","serializeQueryArgs","definitions","apiUid","extractRehydrationInfo","hasRehydrationInfo","assertTagType","config","resetApiState","createAction","writePendingCacheEntry","draft","arg","upserting","meta","STATUS_UNINITIALIZED","STATUS_PENDING","endpointDefinition","isInfiniteQueryDefinition","writeFulfilledCacheEntry","payload","merge","STATUS_FULFILLED","fulfilledTimeStamp","baseQueryMeta","requestId","newData","createNextState","draftSubstateData","copyWithStructuralSharing","isDraft","original","querySlice","createSlice","prepareAutoBatched","action","entry","value","endpointName","ENDPOINT_QUERY","SHOULD_AUTOBATCH","nanoid","patches","applyPatches","builder","isUpsertQuery","condition","error","STATUS_REJECTED","queries","key","mutationSlice","cacheKey","startedTimeStamp","mutations","initialInvalidationState","invalidationSlice","providedTags","removeCacheKeyFromTags","type","subscribedQueries","provided","incomingTags","cacheKeys","isAnyOf","isFulfilled","isRejectedWithValue","writeProvidedTagsForQueries","mockActions","queryDescription","existingTags","getCurrent","tag","tagType","tagId","tagSubscriptions","qc","actions","providedByEntries","calculateProvidedByThunk","subscriptionSlice","d","internalSubscriptionsSlice","configSlice","isOnline","isDocumentVisible","onOnline","onOffline","onFocus","onFocusLost","combinedReducer","combineReducers","reducer","skipToken","initialSubState","STATUS_UNINITIALIZED","defaultQuerySubState","createNextState","defaultMutationSubState","buildSelectors","serializeQueryArgs","reducerPath","createSelector","selectSkippedQuery","state","selectSkippedMutation","buildQuerySelector","buildInfiniteQuerySelector","buildMutationSelector","selectInvalidatedBy","selectCachedArgsForQuery","selectApiState","selectQueries","selectMutations","selectQueryEntry","selectConfig","withRequestFlags","substate","getRequestStatusFlags","rootState","cacheKey","buildAnyQuerySelector","endpointName","endpointDefinition","combiner","queryArgs","serializedArgs","infiniteQueryOptions","withInfiniteQueryResultFlags","stateWithRequestFlags","isLoading","isError","direction","isForward","isBackward","getHasNextPage","getHasPreviousPage","id","mutationId","getMutationCacheKey","tags","apiState","toInvalidate","finalTags","filterMap","isNotNullish","expandTagDescription","tag","provided","invalidateSubscriptions","invalidate","queryCacheKey","querySubState","queryName","entry","options","data","queryArg","getNextPageParam","getPreviousPageParam","_formatProdErrorMessage","cache","defaultSerializeQueryArgs","endpointName","queryArgs","serialized","cached","stringified","key","value","isPlainObject","acc","weakMapMemoize","buildCreateApi","modules","options","extractRehydrationInfo","action","optionsWithDefaults","queryArgsApi","finalSerializeQueryArgs","defaultSerializeQueryArgs","endpointSQA","initialResult","context","fn","nanoid","api","injectEndpoints","addTagTypes","endpoints","eT","endpointName","partialDefinition","getEndpointDefinition","initializedModules","m","inject","evaluatedEndpoints","x","ENDPOINT_QUERY","ENDPOINT_MUTATION","ENDPOINT_INFINITEQUERY","definition","_formatProdErrorMessage","_formatProdErrorMessage","_NEVER","fakeBaseQuery","safeAssign","target","args","buildBatchedActionsHandler","api","queryThunk","internalState","mwApi","subscriptionsPrefix","previousSubscriptions","updateSyncTimer","updateSubscriptionOptions","unsubscribeQueryResult","actuallyMutateSubscriptions","currentSubscriptions","action","queryCacheKey","requestId","options","sub","arg","substate","getOrInsertComputed","createNewMap","mutated","condition","getSubscriptions","subscriptionSelectors","serializeSubscriptions","k","v","didMutate","actionShouldContinue","newSubscriptions","patches","produceWithPatches","isSubscriptionSliceAction","isAdditionalSubscriptionAction","THIRTY_TWO_BIT_MAX_TIMER_SECONDS","buildCacheCollectionHandler","reducerPath","api","queryThunk","context","internalState","selectQueryEntry","selectConfig","getRunningQueryThunk","mwApi","removeQueryResult","unsubscribeQueryResult","cacheEntriesUpserted","canTriggerUnsubscribe","isAnyOf","anySubscriptionsRemainingForKey","queryCacheKey","subscriptions","currentRemovalTimeouts","abortAllPromises","promiseMap","promise","handler","action","state","config","queryCacheKeys","entry","handleUnsubscribeMany","key","timeout","queries","cacheKeys","handleUnsubscribe","endpointName","keepUnusedDataFor","getEndpointDefinition","finalKeepUnusedDataFor","currentTimeout","neverResolvedError","buildCacheLifecycleHandler","api","reducerPath","context","queryThunk","mutationThunk","internalState","selectQueryEntry","selectApiState","isQueryThunk","isAsyncThunkAction","isMutationThunk","isFulfilledThunk","isFulfilled","lifecycleMap","removeQueryResult","removeMutationResult","cacheEntriesUpserted","resolveLifecycleEntry","cacheKey","data","meta","lifecycle","removeLifecycleEntry","getActionMetaFields","action","arg","requestId","endpointName","originalArgs","handler","mwApi","stateBefore","getCacheKey","checkForNewCacheKey","oldEntry","newEntry","handleNewKey","queryDescription","value","queryCacheKey","getMutationCacheKey","endpointDefinition","getEndpointDefinition","onCacheEntryAdded","cacheEntryRemoved","resolve","cacheDataLoaded","selector","isAnyQueryDefinition","extra","_","__","lifecycleApi","updateRecipe","runningHandler","e","buildDevCheckHandler","api","apiUid","reducerPath","action","mwApi","buildInvalidationByTagsHandler","reducerPath","context","endpointDefinitions","mutationThunk","queryThunk","api","assertTagType","refetchQuery","internalState","removeQueryResult","isThunkActionWithTags","isAnyOf","isFulfilled","isRejectedWithValue","isQueryEnd","isRejected","pendingTagInvalidations","pendingRequestCount","handler","action","mwApi","invalidateTags","calculateProvidedByThunk","calculateProvidedBy","hasPendingRequests","newTags","rootState","state","tags","toInvalidate","valuesArray","queryCacheKey","querySubState","subscriptionSubState","getOrInsertComputed","createNewMap","STATUS_UNINITIALIZED","buildPollingHandler","reducerPath","queryThunk","api","refetchQuery","internalState","currentPolls","currentSubscriptions","pendingPollingUpdates","pollingUpdateTimer","handler","action","mwApi","schedulePollingUpdate","startNextPoll","clearPolls","queryCacheKey","key","updatePollingInterval","state","querySubState","subscriptions","STATUS_UNINITIALIZED","lowestPollingInterval","skipPollingIfUnfocused","findLowestPollingInterval","currentPoll","nextPollTimestamp","cleanupPollForKey","existingPoll","subscribers","entry","buildQueryLifecycleHandler","api","context","queryThunk","mutationThunk","isPendingThunk","isPending","isRejectedThunk","isRejected","isFullfilledThunk","isFulfilled","lifecycleMap","action","mwApi","requestId","endpointName","originalArgs","endpointDefinition","getEndpointDefinition","onQueryStarted","lifecycle","queryFulfilled","resolve","reject","selector","isAnyQueryDefinition","extra","_","__","lifecycleApi","updateRecipe","baseQueryMeta","rejectedWithValue","buildWindowEventHandler","reducerPath","context","api","refetchQuery","internalState","removeQueryResult","handler","action","mwApi","onFocus","refetchValidQueries","onOnline","type","state","queries","subscriptions","queryCacheKey","querySubState","subscriptionSubState","values","sub","STATUS_UNINITIALIZED","buildMiddleware","input","reducerPath","queryThunk","api","context","getInternalState","apiUid","actions","createAction","isThisApiSliceAction","action","handlerBuilders","buildDevCheckHandler","buildCacheCollectionHandler","buildInvalidationByTagsHandler","buildPollingHandler","buildCacheLifecycleHandler","buildQueryLifecycleHandler","mwApi","initialized","internalState","builderArgs","refetchQuery","handlers","build","batchedActionsHandler","buildBatchedActionsHandler","windowEventsHandler","buildWindowEventHandler","next","isAction","mwApiWithNext","stateBefore","actionShouldContinue","internalProbeResult","res","handler","querySubState","coreModuleName","coreModule","createSelector","api","baseQuery","tagTypes","reducerPath","serializeQueryArgs","keepUnusedDataFor","refetchOnMountOrArgChange","refetchOnFocus","refetchOnReconnect","invalidationBehavior","onSchemaFailure","catchSchemaFailure","skipSchemaValidation","context","enablePatches","assertTagType","tag","onOnline","onOffline","onFocus","onFocusLost","selectors","buildSelectors","selectInvalidatedBy","selectCachedArgsForQuery","buildQuerySelector","buildInfiniteQuerySelector","buildMutationSelector","safeAssign","queryThunk","infiniteQueryThunk","mutationThunk","patchQueryData","updateQueryData","upsertQueryData","prefetch","buildMatchThunkActions","buildThunks","reducer","sliceActions","buildSlice","internalStateMap","getInternalState","dispatch","getOrInsertComputed","buildInitiateQuery","buildInitiateInfiniteQuery","buildInitiateMutation","getRunningMutationThunk","getRunningMutationsThunk","getRunningQueriesThunk","getRunningQueryThunk","buildInitiate","middleware","middlewareActions","buildMiddleware","endpointName","definition","anyApi","endpoint","isQueryDefinition","isMutationDefinition","isInfiniteQueryDefinition","createApi","buildCreateApi","coreModule"]}
Index: node_modules/@reduxjs/toolkit/dist/query/rtk-query.legacy-esm.js
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/rtk-query.legacy-esm.js	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/rtk-query.legacy-esm.js	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,3116 @@
+var __defProp = Object.defineProperty;
+var __defProps = Object.defineProperties;
+var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
+var __getOwnPropSymbols = Object.getOwnPropertySymbols;
+var __hasOwnProp = Object.prototype.hasOwnProperty;
+var __propIsEnum = Object.prototype.propertyIsEnumerable;
+var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+var __spreadValues = (a, b) => {
+  for (var prop in b || (b = {}))
+    if (__hasOwnProp.call(b, prop))
+      __defNormalProp(a, prop, b[prop]);
+  if (__getOwnPropSymbols)
+    for (var prop of __getOwnPropSymbols(b)) {
+      if (__propIsEnum.call(b, prop))
+        __defNormalProp(a, prop, b[prop]);
+    }
+  return a;
+};
+var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
+var __restKey = (key) => typeof key === "symbol" ? key : key + "";
+var __objRest = (source, exclude) => {
+  var target = {};
+  for (var prop in source)
+    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
+      target[prop] = source[prop];
+  if (source != null && __getOwnPropSymbols)
+    for (var prop of __getOwnPropSymbols(source)) {
+      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
+        target[prop] = source[prop];
+    }
+  return target;
+};
+
+// src/query/core/apiState.ts
+var QueryStatus = /* @__PURE__ */ ((QueryStatus7) => {
+  QueryStatus7["uninitialized"] = "uninitialized";
+  QueryStatus7["pending"] = "pending";
+  QueryStatus7["fulfilled"] = "fulfilled";
+  QueryStatus7["rejected"] = "rejected";
+  return QueryStatus7;
+})(QueryStatus || {});
+var STATUS_UNINITIALIZED = "uninitialized" /* uninitialized */;
+var STATUS_PENDING = "pending" /* pending */;
+var STATUS_FULFILLED = "fulfilled" /* fulfilled */;
+var STATUS_REJECTED = "rejected" /* rejected */;
+function getRequestStatusFlags(status) {
+  return {
+    status,
+    isUninitialized: status === STATUS_UNINITIALIZED,
+    isLoading: status === STATUS_PENDING,
+    isSuccess: status === STATUS_FULFILLED,
+    isError: status === STATUS_REJECTED
+  };
+}
+
+// src/query/core/rtkImports.ts
+import { createAction, createSlice, createSelector, createAsyncThunk, combineReducers, createNextState, isAnyOf, isAllOf, isAction, isPending, isRejected, isFulfilled, isRejectedWithValue, isAsyncThunkAction, prepareAutoBatched, SHOULD_AUTOBATCH, isPlainObject, nanoid } from "@reduxjs/toolkit";
+
+// src/query/utils/copyWithStructuralSharing.ts
+var isPlainObject2 = isPlainObject;
+function copyWithStructuralSharing(oldObj, newObj) {
+  if (oldObj === newObj || !(isPlainObject2(oldObj) && isPlainObject2(newObj) || Array.isArray(oldObj) && Array.isArray(newObj))) {
+    return newObj;
+  }
+  const newKeys = Object.keys(newObj);
+  const oldKeys = Object.keys(oldObj);
+  let isSameObject = newKeys.length === oldKeys.length;
+  const mergeObj = Array.isArray(newObj) ? [] : {};
+  for (const key of newKeys) {
+    mergeObj[key] = copyWithStructuralSharing(oldObj[key], newObj[key]);
+    if (isSameObject) isSameObject = oldObj[key] === mergeObj[key];
+  }
+  return isSameObject ? oldObj : mergeObj;
+}
+
+// src/query/utils/filterMap.ts
+function filterMap(array, predicate, mapper) {
+  return array.reduce((acc, item, i) => {
+    if (predicate(item, i)) {
+      acc.push(mapper(item, i));
+    }
+    return acc;
+  }, []).flat();
+}
+
+// src/query/utils/isAbsoluteUrl.ts
+function isAbsoluteUrl(url) {
+  return new RegExp(`(^|:)//`).test(url);
+}
+
+// src/query/utils/isDocumentVisible.ts
+function isDocumentVisible() {
+  if (typeof document === "undefined") {
+    return true;
+  }
+  return document.visibilityState !== "hidden";
+}
+
+// src/query/utils/isNotNullish.ts
+function isNotNullish(v) {
+  return v != null;
+}
+function filterNullishValues(map) {
+  var _a;
+  return [...(_a = map == null ? void 0 : map.values()) != null ? _a : []].filter(isNotNullish);
+}
+
+// src/query/utils/isOnline.ts
+function isOnline() {
+  return typeof navigator === "undefined" ? true : navigator.onLine === void 0 ? true : navigator.onLine;
+}
+
+// src/query/utils/joinUrls.ts
+var withoutTrailingSlash = (url) => url.replace(/\/$/, "");
+var withoutLeadingSlash = (url) => url.replace(/^\//, "");
+function joinUrls(base, url) {
+  if (!base) {
+    return url;
+  }
+  if (!url) {
+    return base;
+  }
+  if (isAbsoluteUrl(url)) {
+    return url;
+  }
+  const delimiter = base.endsWith("/") || !url.startsWith("?") ? "/" : "";
+  base = withoutTrailingSlash(base);
+  url = withoutLeadingSlash(url);
+  return `${base}${delimiter}${url}`;
+}
+
+// src/query/utils/getOrInsert.ts
+function getOrInsertComputed(map, key, compute) {
+  if (map.has(key)) return map.get(key);
+  return map.set(key, compute(key)).get(key);
+}
+var createNewMap = () => /* @__PURE__ */ new Map();
+
+// src/query/utils/signals.ts
+var timeoutSignal = (milliseconds) => {
+  const abortController = new AbortController();
+  setTimeout(() => {
+    const message = "signal timed out";
+    const name = "TimeoutError";
+    abortController.abort(
+      // some environments (React Native, Node) don't have DOMException
+      typeof DOMException !== "undefined" ? new DOMException(message, name) : Object.assign(new Error(message), {
+        name
+      })
+    );
+  }, milliseconds);
+  return abortController.signal;
+};
+var anySignal = (...signals) => {
+  for (const signal of signals) if (signal.aborted) return AbortSignal.abort(signal.reason);
+  const abortController = new AbortController();
+  for (const signal of signals) {
+    signal.addEventListener("abort", () => abortController.abort(signal.reason), {
+      signal: abortController.signal,
+      once: true
+    });
+  }
+  return abortController.signal;
+};
+
+// src/query/fetchBaseQuery.ts
+var defaultFetchFn = (...args) => fetch(...args);
+var defaultValidateStatus = (response) => response.status >= 200 && response.status <= 299;
+var defaultIsJsonContentType = (headers) => (
+  /*applicat*/
+  /ion\/(vnd\.api\+)?json/.test(headers.get("content-type") || "")
+);
+function stripUndefined(obj) {
+  if (!isPlainObject(obj)) {
+    return obj;
+  }
+  const copy = __spreadValues({}, obj);
+  for (const [k, v] of Object.entries(copy)) {
+    if (v === void 0) delete copy[k];
+  }
+  return copy;
+}
+var isJsonifiable = (body) => typeof body === "object" && (isPlainObject(body) || Array.isArray(body) || typeof body.toJSON === "function");
+function fetchBaseQuery(_a = {}) {
+  var _b = _a, {
+    baseUrl,
+    prepareHeaders = (x) => x,
+    fetchFn = defaultFetchFn,
+    paramsSerializer,
+    isJsonContentType = defaultIsJsonContentType,
+    jsonContentType = "application/json",
+    jsonReplacer,
+    timeout: defaultTimeout,
+    responseHandler: globalResponseHandler,
+    validateStatus: globalValidateStatus
+  } = _b, baseFetchOptions = __objRest(_b, [
+    "baseUrl",
+    "prepareHeaders",
+    "fetchFn",
+    "paramsSerializer",
+    "isJsonContentType",
+    "jsonContentType",
+    "jsonReplacer",
+    "timeout",
+    "responseHandler",
+    "validateStatus"
+  ]);
+  if (typeof fetch === "undefined" && fetchFn === defaultFetchFn) {
+    console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments.");
+  }
+  return async (arg, api, extraOptions) => {
+    const {
+      getState,
+      extra,
+      endpoint,
+      forced,
+      type
+    } = api;
+    let meta;
+    let _a2 = typeof arg == "string" ? {
+      url: arg
+    } : arg, {
+      url,
+      headers = new Headers(baseFetchOptions.headers),
+      params = void 0,
+      responseHandler = globalResponseHandler != null ? globalResponseHandler : "json",
+      validateStatus = globalValidateStatus != null ? globalValidateStatus : defaultValidateStatus,
+      timeout = defaultTimeout
+    } = _a2, rest = __objRest(_a2, [
+      "url",
+      "headers",
+      "params",
+      "responseHandler",
+      "validateStatus",
+      "timeout"
+    ]);
+    let config = __spreadValues(__spreadProps(__spreadValues({}, baseFetchOptions), {
+      signal: timeout ? anySignal(api.signal, timeoutSignal(timeout)) : api.signal
+    }), rest);
+    headers = new Headers(stripUndefined(headers));
+    config.headers = await prepareHeaders(headers, {
+      getState,
+      arg,
+      extra,
+      endpoint,
+      forced,
+      type,
+      extraOptions
+    }) || headers;
+    const bodyIsJsonifiable = isJsonifiable(config.body);
+    if (config.body != null && !bodyIsJsonifiable && typeof config.body !== "string") {
+      config.headers.delete("content-type");
+    }
+    if (!config.headers.has("content-type") && bodyIsJsonifiable) {
+      config.headers.set("content-type", jsonContentType);
+    }
+    if (bodyIsJsonifiable && isJsonContentType(config.headers)) {
+      config.body = JSON.stringify(config.body, jsonReplacer);
+    }
+    if (!config.headers.has("accept")) {
+      if (responseHandler === "json") {
+        config.headers.set("accept", "application/json");
+      } else if (responseHandler === "text") {
+        config.headers.set("accept", "text/plain, text/html, */*");
+      }
+    }
+    if (params) {
+      const divider = ~url.indexOf("?") ? "&" : "?";
+      const query = paramsSerializer ? paramsSerializer(params) : new URLSearchParams(stripUndefined(params));
+      url += divider + query;
+    }
+    url = joinUrls(baseUrl, url);
+    const request = new Request(url, config);
+    const requestClone = new Request(url, config);
+    meta = {
+      request: requestClone
+    };
+    let response;
+    try {
+      response = await fetchFn(request);
+    } catch (e) {
+      return {
+        error: {
+          status: (e instanceof Error || typeof DOMException !== "undefined" && e instanceof DOMException) && e.name === "TimeoutError" ? "TIMEOUT_ERROR" : "FETCH_ERROR",
+          error: String(e)
+        },
+        meta
+      };
+    }
+    const responseClone = response.clone();
+    meta.response = responseClone;
+    let resultData;
+    let responseText = "";
+    try {
+      let handleResponseError;
+      await Promise.all([
+        handleResponse(response, responseHandler).then((r) => resultData = r, (e) => handleResponseError = e),
+        // see https://github.com/node-fetch/node-fetch/issues/665#issuecomment-538995182
+        // we *have* to "use up" both streams at the same time or they will stop running in node-fetch scenarios
+        responseClone.text().then((r) => responseText = r, () => {
+        })
+      ]);
+      if (handleResponseError) throw handleResponseError;
+    } catch (e) {
+      return {
+        error: {
+          status: "PARSING_ERROR",
+          originalStatus: response.status,
+          data: responseText,
+          error: String(e)
+        },
+        meta
+      };
+    }
+    return validateStatus(response, resultData) ? {
+      data: resultData,
+      meta
+    } : {
+      error: {
+        status: response.status,
+        data: resultData
+      },
+      meta
+    };
+  };
+  async function handleResponse(response, responseHandler) {
+    if (typeof responseHandler === "function") {
+      return responseHandler(response);
+    }
+    if (responseHandler === "content-type") {
+      responseHandler = isJsonContentType(response.headers) ? "json" : "text";
+    }
+    if (responseHandler === "json") {
+      const text = await response.text();
+      return text.length ? JSON.parse(text) : null;
+    }
+    return response.text();
+  }
+}
+
+// src/query/HandledError.ts
+var HandledError = class {
+  constructor(value, meta = void 0) {
+    this.value = value;
+    this.meta = meta;
+  }
+};
+
+// src/query/retry.ts
+async function defaultBackoff(attempt = 0, maxRetries = 5, signal) {
+  const attempts = Math.min(attempt, maxRetries);
+  const timeout = ~~((Math.random() + 0.4) * (300 << attempts));
+  await new Promise((resolve, reject) => {
+    const timeoutId = setTimeout(() => resolve(), timeout);
+    if (signal) {
+      const abortHandler = () => {
+        clearTimeout(timeoutId);
+        reject(new Error("Aborted"));
+      };
+      if (signal.aborted) {
+        clearTimeout(timeoutId);
+        reject(new Error("Aborted"));
+      } else {
+        signal.addEventListener("abort", abortHandler, {
+          once: true
+        });
+      }
+    }
+  });
+}
+function fail(error, meta) {
+  throw Object.assign(new HandledError({
+    error,
+    meta
+  }), {
+    throwImmediately: true
+  });
+}
+function failIfAborted(signal) {
+  if (signal.aborted) {
+    fail({
+      status: "CUSTOM_ERROR",
+      error: "Aborted"
+    });
+  }
+}
+var EMPTY_OPTIONS = {};
+var retryWithBackoff = (baseQuery, defaultOptions) => async (args, api, extraOptions) => {
+  const possibleMaxRetries = [5, (defaultOptions || EMPTY_OPTIONS).maxRetries, (extraOptions || EMPTY_OPTIONS).maxRetries].filter((x) => x !== void 0);
+  const [maxRetries] = possibleMaxRetries.slice(-1);
+  const defaultRetryCondition = (_, __, {
+    attempt
+  }) => attempt <= maxRetries;
+  const options = __spreadValues(__spreadValues({
+    maxRetries,
+    backoff: defaultBackoff,
+    retryCondition: defaultRetryCondition
+  }, defaultOptions), extraOptions);
+  let retry2 = 0;
+  while (true) {
+    failIfAborted(api.signal);
+    try {
+      const result = await baseQuery(args, api, extraOptions);
+      if (result.error) {
+        throw new HandledError(result);
+      }
+      return result;
+    } catch (e) {
+      retry2++;
+      if (e.throwImmediately) {
+        if (e instanceof HandledError) {
+          return e.value;
+        }
+        throw e;
+      }
+      if (e instanceof HandledError) {
+        if (!options.retryCondition(e.value.error, args, {
+          attempt: retry2,
+          baseQueryApi: api,
+          extraOptions
+        })) {
+          return e.value;
+        }
+      } else {
+        if (retry2 > options.maxRetries) {
+          return {
+            error: e
+          };
+        }
+      }
+      failIfAborted(api.signal);
+      try {
+        await options.backoff(retry2, options.maxRetries, api.signal);
+      } catch (backoffError) {
+        failIfAborted(api.signal);
+        throw backoffError;
+      }
+    }
+  }
+};
+var retry = /* @__PURE__ */ Object.assign(retryWithBackoff, {
+  fail
+});
+
+// src/query/core/setupListeners.ts
+var INTERNAL_PREFIX = "__rtkq/";
+var ONLINE = "online";
+var OFFLINE = "offline";
+var FOCUS = "focus";
+var FOCUSED = "focused";
+var VISIBILITYCHANGE = "visibilitychange";
+var onFocus = /* @__PURE__ */ createAction(`${INTERNAL_PREFIX}${FOCUSED}`);
+var onFocusLost = /* @__PURE__ */ createAction(`${INTERNAL_PREFIX}un${FOCUSED}`);
+var onOnline = /* @__PURE__ */ createAction(`${INTERNAL_PREFIX}${ONLINE}`);
+var onOffline = /* @__PURE__ */ createAction(`${INTERNAL_PREFIX}${OFFLINE}`);
+var actions = {
+  onFocus,
+  onFocusLost,
+  onOnline,
+  onOffline
+};
+var initialized = false;
+function setupListeners(dispatch, customHandler) {
+  function defaultHandler() {
+    const [handleFocus, handleFocusLost, handleOnline, handleOffline] = [onFocus, onFocusLost, onOnline, onOffline].map((action) => () => dispatch(action()));
+    const handleVisibilityChange = () => {
+      if (window.document.visibilityState === "visible") {
+        handleFocus();
+      } else {
+        handleFocusLost();
+      }
+    };
+    let unsubscribe = () => {
+      initialized = false;
+    };
+    if (!initialized) {
+      if (typeof window !== "undefined" && window.addEventListener) {
+        let updateListeners2 = function(add) {
+          Object.entries(handlers).forEach(([event, handler]) => {
+            if (add) {
+              window.addEventListener(event, handler, false);
+            } else {
+              window.removeEventListener(event, handler);
+            }
+          });
+        };
+        var updateListeners = updateListeners2;
+        const handlers = {
+          [FOCUS]: handleFocus,
+          [VISIBILITYCHANGE]: handleVisibilityChange,
+          [ONLINE]: handleOnline,
+          [OFFLINE]: handleOffline
+        };
+        updateListeners2(true);
+        initialized = true;
+        unsubscribe = () => {
+          updateListeners2(false);
+          initialized = false;
+        };
+      }
+    }
+    return unsubscribe;
+  }
+  return customHandler ? customHandler(dispatch, actions) : defaultHandler();
+}
+
+// src/query/endpointDefinitions.ts
+var ENDPOINT_QUERY = "query" /* query */;
+var ENDPOINT_MUTATION = "mutation" /* mutation */;
+var ENDPOINT_INFINITEQUERY = "infinitequery" /* infinitequery */;
+function isQueryDefinition(e) {
+  return e.type === ENDPOINT_QUERY;
+}
+function isMutationDefinition(e) {
+  return e.type === ENDPOINT_MUTATION;
+}
+function isInfiniteQueryDefinition(e) {
+  return e.type === ENDPOINT_INFINITEQUERY;
+}
+function isAnyQueryDefinition(e) {
+  return isQueryDefinition(e) || isInfiniteQueryDefinition(e);
+}
+function calculateProvidedBy(description, result, error, queryArg, meta, assertTagTypes) {
+  const finalDescription = isFunction(description) ? description(result, error, queryArg, meta) : description;
+  if (finalDescription) {
+    return filterMap(finalDescription, isNotNullish, (tag) => assertTagTypes(expandTagDescription(tag)));
+  }
+  return [];
+}
+function isFunction(t) {
+  return typeof t === "function";
+}
+function expandTagDescription(description) {
+  return typeof description === "string" ? {
+    type: description
+  } : description;
+}
+
+// src/query/utils/immerImports.ts
+import { current, isDraft, applyPatches, original, isDraftable, produceWithPatches, enablePatches } from "immer";
+
+// src/query/core/buildInitiate.ts
+import { formatProdErrorMessage as _formatProdErrorMessage } from "@reduxjs/toolkit";
+
+// src/tsHelpers.ts
+function asSafePromise(promise, fallback) {
+  return promise.catch(fallback);
+}
+
+// src/query/apiTypes.ts
+var getEndpointDefinition = (context, endpointName) => context.endpointDefinitions[endpointName];
+
+// src/query/core/buildInitiate.ts
+var forceQueryFnSymbol = Symbol("forceQueryFn");
+var isUpsertQuery = (arg) => typeof arg[forceQueryFnSymbol] === "function";
+function buildInitiate({
+  serializeQueryArgs,
+  queryThunk,
+  infiniteQueryThunk,
+  mutationThunk,
+  api,
+  context,
+  getInternalState
+}) {
+  const getRunningQueries = (dispatch) => {
+    var _a;
+    return (_a = getInternalState(dispatch)) == null ? void 0 : _a.runningQueries;
+  };
+  const getRunningMutations = (dispatch) => {
+    var _a;
+    return (_a = getInternalState(dispatch)) == null ? void 0 : _a.runningMutations;
+  };
+  const {
+    unsubscribeQueryResult,
+    removeMutationResult,
+    updateSubscriptionOptions
+  } = api.internalActions;
+  return {
+    buildInitiateQuery,
+    buildInitiateInfiniteQuery,
+    buildInitiateMutation,
+    getRunningQueryThunk,
+    getRunningMutationThunk,
+    getRunningQueriesThunk,
+    getRunningMutationsThunk
+  };
+  function getRunningQueryThunk(endpointName, queryArgs) {
+    return (dispatch) => {
+      var _a;
+      const endpointDefinition = getEndpointDefinition(context, endpointName);
+      const queryCacheKey = serializeQueryArgs({
+        queryArgs,
+        endpointDefinition,
+        endpointName
+      });
+      return (_a = getRunningQueries(dispatch)) == null ? void 0 : _a.get(queryCacheKey);
+    };
+  }
+  function getRunningMutationThunk(_endpointName, fixedCacheKeyOrRequestId) {
+    return (dispatch) => {
+      var _a;
+      return (_a = getRunningMutations(dispatch)) == null ? void 0 : _a.get(fixedCacheKeyOrRequestId);
+    };
+  }
+  function getRunningQueriesThunk() {
+    return (dispatch) => filterNullishValues(getRunningQueries(dispatch));
+  }
+  function getRunningMutationsThunk() {
+    return (dispatch) => filterNullishValues(getRunningMutations(dispatch));
+  }
+  function middlewareWarning(dispatch) {
+    if (process.env.NODE_ENV !== "production") {
+      if (middlewareWarning.triggered) return;
+      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());
+      middlewareWarning.triggered = true;
+      if (typeof returnedValue !== "object" || typeof (returnedValue == null ? void 0 : returnedValue.type) === "string") {
+        throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage(34) : `Warning: Middleware for RTK-Query API at reducerPath "${api.reducerPath}" has not been added to the store.
+You must add the middleware for RTK-Query to function correctly!`);
+      }
+    }
+  }
+  function buildInitiateAnyQuery(endpointName, endpointDefinition) {
+    const queryAction = (arg, _a = {}) => {
+      var _b = _a, {
+        subscribe = true,
+        forceRefetch,
+        subscriptionOptions,
+        [forceQueryFnSymbol]: forceQueryFn
+      } = _b, rest = __objRest(_b, [
+        "subscribe",
+        "forceRefetch",
+        "subscriptionOptions",
+        __restKey(forceQueryFnSymbol)
+      ]);
+      return (dispatch, getState) => {
+        var _a2;
+        const queryCacheKey = serializeQueryArgs({
+          queryArgs: arg,
+          endpointDefinition,
+          endpointName
+        });
+        let thunk;
+        const commonThunkArgs = __spreadProps(__spreadValues({}, rest), {
+          type: ENDPOINT_QUERY,
+          subscribe,
+          forceRefetch,
+          subscriptionOptions,
+          endpointName,
+          originalArgs: arg,
+          queryCacheKey,
+          [forceQueryFnSymbol]: forceQueryFn
+        });
+        if (isQueryDefinition(endpointDefinition)) {
+          thunk = queryThunk(commonThunkArgs);
+        } else {
+          const {
+            direction,
+            initialPageParam,
+            refetchCachedPages
+          } = rest;
+          thunk = infiniteQueryThunk(__spreadProps(__spreadValues({}, commonThunkArgs), {
+            // Supply these even if undefined. This helps with a field existence
+            // check over in `buildSlice.ts`
+            direction,
+            initialPageParam,
+            refetchCachedPages
+          }));
+        }
+        const selector = api.endpoints[endpointName].select(arg);
+        const thunkResult = dispatch(thunk);
+        const stateAfter = selector(getState());
+        middlewareWarning(dispatch);
+        const {
+          requestId,
+          abort
+        } = thunkResult;
+        const skippedSynchronously = stateAfter.requestId !== requestId;
+        const runningQuery = (_a2 = getRunningQueries(dispatch)) == null ? void 0 : _a2.get(queryCacheKey);
+        const selectFromState = () => selector(getState());
+        const statePromise = Object.assign(forceQueryFn ? (
+          // a query has been forced (upsertQueryData)
+          // -> we want to resolve it once data has been written with the data that will be written
+          thunkResult.then(selectFromState)
+        ) : skippedSynchronously && !runningQuery ? (
+          // a query has been skipped due to a condition and we do not have any currently running query
+          // -> we want to resolve it immediately with the current data
+          Promise.resolve(stateAfter)
+        ) : (
+          // query just started or one is already in flight
+          // -> wait for the running query, then resolve with data from after that
+          Promise.all([runningQuery, thunkResult]).then(selectFromState)
+        ), {
+          arg,
+          requestId,
+          subscriptionOptions,
+          queryCacheKey,
+          abort,
+          async unwrap() {
+            const result = await statePromise;
+            if (result.isError) {
+              throw result.error;
+            }
+            return result.data;
+          },
+          refetch: (options) => dispatch(queryAction(arg, __spreadValues({
+            subscribe: false,
+            forceRefetch: true
+          }, options))),
+          unsubscribe() {
+            if (subscribe) dispatch(unsubscribeQueryResult({
+              queryCacheKey,
+              requestId
+            }));
+          },
+          updateSubscriptionOptions(options) {
+            statePromise.subscriptionOptions = options;
+            dispatch(updateSubscriptionOptions({
+              endpointName,
+              requestId,
+              queryCacheKey,
+              options
+            }));
+          }
+        });
+        if (!runningQuery && !skippedSynchronously && !forceQueryFn) {
+          const runningQueries = getRunningQueries(dispatch);
+          runningQueries.set(queryCacheKey, statePromise);
+          statePromise.then(() => {
+            runningQueries.delete(queryCacheKey);
+          });
+        }
+        return statePromise;
+      };
+    };
+    return queryAction;
+  }
+  function buildInitiateQuery(endpointName, endpointDefinition) {
+    const queryAction = buildInitiateAnyQuery(endpointName, endpointDefinition);
+    return queryAction;
+  }
+  function buildInitiateInfiniteQuery(endpointName, endpointDefinition) {
+    const infiniteQueryAction = buildInitiateAnyQuery(endpointName, endpointDefinition);
+    return infiniteQueryAction;
+  }
+  function buildInitiateMutation(endpointName) {
+    return (arg, {
+      track = true,
+      fixedCacheKey
+    } = {}) => (dispatch, getState) => {
+      const thunk = mutationThunk({
+        type: "mutation",
+        endpointName,
+        originalArgs: arg,
+        track,
+        fixedCacheKey
+      });
+      const thunkResult = dispatch(thunk);
+      middlewareWarning(dispatch);
+      const {
+        requestId,
+        abort,
+        unwrap
+      } = thunkResult;
+      const returnValuePromise = asSafePromise(thunkResult.unwrap().then((data) => ({
+        data
+      })), (error) => ({
+        error
+      }));
+      const reset = () => {
+        dispatch(removeMutationResult({
+          requestId,
+          fixedCacheKey
+        }));
+      };
+      const ret = Object.assign(returnValuePromise, {
+        arg: thunkResult.arg,
+        requestId,
+        abort,
+        unwrap,
+        reset
+      });
+      const runningMutations = getRunningMutations(dispatch);
+      runningMutations.set(requestId, ret);
+      ret.then(() => {
+        runningMutations.delete(requestId);
+      });
+      if (fixedCacheKey) {
+        runningMutations.set(fixedCacheKey, ret);
+        ret.then(() => {
+          if (runningMutations.get(fixedCacheKey) === ret) {
+            runningMutations.delete(fixedCacheKey);
+          }
+        });
+      }
+      return ret;
+    };
+  }
+}
+
+// src/query/standardSchema.ts
+import { SchemaError } from "@standard-schema/utils";
+var NamedSchemaError = class extends SchemaError {
+  constructor(issues, value, schemaName, _bqMeta) {
+    super(issues);
+    this.value = value;
+    this.schemaName = schemaName;
+    this._bqMeta = _bqMeta;
+  }
+};
+var shouldSkip = (skipSchemaValidation, schemaName) => Array.isArray(skipSchemaValidation) ? skipSchemaValidation.includes(schemaName) : !!skipSchemaValidation;
+async function parseWithSchema(schema, data, schemaName, bqMeta) {
+  const result = await schema["~standard"].validate(data);
+  if (result.issues) {
+    throw new NamedSchemaError(result.issues, data, schemaName, bqMeta);
+  }
+  return result.value;
+}
+
+// src/query/core/buildThunks.ts
+function defaultTransformResponse(baseQueryReturnValue) {
+  return baseQueryReturnValue;
+}
+var addShouldAutoBatch = (arg = {}) => {
+  return __spreadProps(__spreadValues({}, arg), {
+    [SHOULD_AUTOBATCH]: true
+  });
+};
+function buildThunks({
+  reducerPath,
+  baseQuery,
+  context: {
+    endpointDefinitions
+  },
+  serializeQueryArgs,
+  api,
+  assertTagType,
+  selectors,
+  onSchemaFailure,
+  catchSchemaFailure: globalCatchSchemaFailure,
+  skipSchemaValidation: globalSkipSchemaValidation
+}) {
+  const patchQueryData = (endpointName, arg, patches, updateProvided) => (dispatch, getState) => {
+    const endpointDefinition = endpointDefinitions[endpointName];
+    const queryCacheKey = serializeQueryArgs({
+      queryArgs: arg,
+      endpointDefinition,
+      endpointName
+    });
+    dispatch(api.internalActions.queryResultPatched({
+      queryCacheKey,
+      patches
+    }));
+    if (!updateProvided) {
+      return;
+    }
+    const newValue = api.endpoints[endpointName].select(arg)(
+      // Work around TS 4.1 mismatch
+      getState()
+    );
+    const providedTags = calculateProvidedBy(endpointDefinition.providesTags, newValue.data, void 0, arg, {}, assertTagType);
+    dispatch(api.internalActions.updateProvidedBy([{
+      queryCacheKey,
+      providedTags
+    }]));
+  };
+  function addToStart(items, item, max = 0) {
+    const newItems = [item, ...items];
+    return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
+  }
+  function addToEnd(items, item, max = 0) {
+    const newItems = [...items, item];
+    return max && newItems.length > max ? newItems.slice(1) : newItems;
+  }
+  const updateQueryData = (endpointName, arg, updateRecipe, updateProvided = true) => (dispatch, getState) => {
+    const endpointDefinition = api.endpoints[endpointName];
+    const currentState = endpointDefinition.select(arg)(
+      // Work around TS 4.1 mismatch
+      getState()
+    );
+    const ret = {
+      patches: [],
+      inversePatches: [],
+      undo: () => dispatch(api.util.patchQueryData(endpointName, arg, ret.inversePatches, updateProvided))
+    };
+    if (currentState.status === STATUS_UNINITIALIZED) {
+      return ret;
+    }
+    let newValue;
+    if ("data" in currentState) {
+      if (isDraftable(currentState.data)) {
+        const [value, patches, inversePatches] = produceWithPatches(currentState.data, updateRecipe);
+        ret.patches.push(...patches);
+        ret.inversePatches.push(...inversePatches);
+        newValue = value;
+      } else {
+        newValue = updateRecipe(currentState.data);
+        ret.patches.push({
+          op: "replace",
+          path: [],
+          value: newValue
+        });
+        ret.inversePatches.push({
+          op: "replace",
+          path: [],
+          value: currentState.data
+        });
+      }
+    }
+    if (ret.patches.length === 0) {
+      return ret;
+    }
+    dispatch(api.util.patchQueryData(endpointName, arg, ret.patches, updateProvided));
+    return ret;
+  };
+  const upsertQueryData = (endpointName, arg, value) => (dispatch) => {
+    const res = dispatch(api.endpoints[endpointName].initiate(arg, {
+      subscribe: false,
+      forceRefetch: true,
+      [forceQueryFnSymbol]: () => ({
+        data: value
+      })
+    }));
+    return res;
+  };
+  const getTransformCallbackForEndpoint = (endpointDefinition, transformFieldName) => {
+    return endpointDefinition.query && endpointDefinition[transformFieldName] ? endpointDefinition[transformFieldName] : defaultTransformResponse;
+  };
+  const executeEndpoint = async (arg, {
+    signal,
+    abort,
+    rejectWithValue,
+    fulfillWithValue,
+    dispatch,
+    getState,
+    extra
+  }) => {
+    var _a, _b, _c, _d, _e, _f;
+    const endpointDefinition = endpointDefinitions[arg.endpointName];
+    const {
+      metaSchema,
+      skipSchemaValidation = globalSkipSchemaValidation
+    } = endpointDefinition;
+    const isQuery = arg.type === ENDPOINT_QUERY;
+    try {
+      let transformResponse = defaultTransformResponse;
+      const baseQueryApi = {
+        signal,
+        abort,
+        dispatch,
+        getState,
+        extra,
+        endpoint: arg.endpointName,
+        type: arg.type,
+        forced: isQuery ? isForcedQuery(arg, getState()) : void 0,
+        queryCacheKey: isQuery ? arg.queryCacheKey : void 0
+      };
+      const forceQueryFn = isQuery ? arg[forceQueryFnSymbol] : void 0;
+      let finalQueryReturnValue;
+      const fetchPage = async (data, param, maxPages, previous) => {
+        if (param == null && data.pages.length) {
+          return Promise.resolve({
+            data
+          });
+        }
+        const finalQueryArg = {
+          queryArg: arg.originalArgs,
+          pageParam: param
+        };
+        const pageResponse = await executeRequest(finalQueryArg);
+        const addTo = previous ? addToStart : addToEnd;
+        return {
+          data: {
+            pages: addTo(data.pages, pageResponse.data, maxPages),
+            pageParams: addTo(data.pageParams, param, maxPages)
+          },
+          meta: pageResponse.meta
+        };
+      };
+      async function executeRequest(finalQueryArg) {
+        let result;
+        const {
+          extraOptions,
+          argSchema,
+          rawResponseSchema,
+          responseSchema
+        } = endpointDefinition;
+        if (argSchema && !shouldSkip(skipSchemaValidation, "arg")) {
+          finalQueryArg = await parseWithSchema(
+            argSchema,
+            finalQueryArg,
+            "argSchema",
+            {}
+            // we don't have a meta yet, so we can't pass it
+          );
+        }
+        if (forceQueryFn) {
+          result = forceQueryFn();
+        } else if (endpointDefinition.query) {
+          transformResponse = getTransformCallbackForEndpoint(endpointDefinition, "transformResponse");
+          result = await baseQuery(endpointDefinition.query(finalQueryArg), baseQueryApi, extraOptions);
+        } else {
+          result = await endpointDefinition.queryFn(finalQueryArg, baseQueryApi, extraOptions, (arg2) => baseQuery(arg2, baseQueryApi, extraOptions));
+        }
+        if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
+          const what = endpointDefinition.query ? "`baseQuery`" : "`queryFn`";
+          let err;
+          if (!result) {
+            err = `${what} did not return anything.`;
+          } else if (typeof result !== "object") {
+            err = `${what} did not return an object.`;
+          } else if (result.error && result.data) {
+            err = `${what} returned an object containing both \`error\` and \`result\`.`;
+          } else if (result.error === void 0 && result.data === void 0) {
+            err = `${what} returned an object containing neither a valid \`error\` and \`result\`. At least one of them should not be \`undefined\``;
+          } else {
+            for (const key of Object.keys(result)) {
+              if (key !== "error" && key !== "data" && key !== "meta") {
+                err = `The object returned by ${what} has the unknown property ${key}.`;
+                break;
+              }
+            }
+          }
+          if (err) {
+            console.error(`Error encountered handling the endpoint ${arg.endpointName}.
+                  ${err}
+                  It needs to return an object with either the shape \`{ data: <value> }\` or \`{ error: <value> }\` that may contain an optional \`meta\` property.
+                  Object returned was:`, result);
+          }
+        }
+        if (result.error) throw new HandledError(result.error, result.meta);
+        let {
+          data
+        } = result;
+        if (rawResponseSchema && !shouldSkip(skipSchemaValidation, "rawResponse")) {
+          data = await parseWithSchema(rawResponseSchema, result.data, "rawResponseSchema", result.meta);
+        }
+        let transformedResponse = await transformResponse(data, result.meta, finalQueryArg);
+        if (responseSchema && !shouldSkip(skipSchemaValidation, "response")) {
+          transformedResponse = await parseWithSchema(responseSchema, transformedResponse, "responseSchema", result.meta);
+        }
+        return __spreadProps(__spreadValues({}, result), {
+          data: transformedResponse
+        });
+      }
+      if (isQuery && "infiniteQueryOptions" in endpointDefinition) {
+        const {
+          infiniteQueryOptions
+        } = endpointDefinition;
+        const {
+          maxPages = Infinity
+        } = infiniteQueryOptions;
+        const refetchCachedPages = (_b = (_a = arg.refetchCachedPages) != null ? _a : infiniteQueryOptions.refetchCachedPages) != null ? _b : true;
+        let result;
+        const blankData = {
+          pages: [],
+          pageParams: []
+        };
+        const cachedData = (_c = selectors.selectQueryEntry(getState(), arg.queryCacheKey)) == null ? void 0 : _c.data;
+        const isForcedQueryNeedingRefetch = (
+          // arg.forceRefetch
+          isForcedQuery(arg, getState()) && !arg.direction
+        );
+        const existingData = isForcedQueryNeedingRefetch || !cachedData ? blankData : cachedData;
+        if ("direction" in arg && arg.direction && existingData.pages.length) {
+          const previous = arg.direction === "backward";
+          const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
+          const param = pageParamFn(infiniteQueryOptions, existingData, arg.originalArgs);
+          result = await fetchPage(existingData, param, maxPages, previous);
+        } else {
+          const {
+            initialPageParam = infiniteQueryOptions.initialPageParam
+          } = arg;
+          const cachedPageParams = (_d = cachedData == null ? void 0 : cachedData.pageParams) != null ? _d : [];
+          const firstPageParam = (_e = cachedPageParams[0]) != null ? _e : initialPageParam;
+          const totalPages = cachedPageParams.length;
+          result = await fetchPage(existingData, firstPageParam, maxPages);
+          if (forceQueryFn) {
+            result = {
+              data: result.data.pages[0]
+            };
+          }
+          if (refetchCachedPages) {
+            for (let i = 1; i < totalPages; i++) {
+              const param = getNextPageParam(infiniteQueryOptions, result.data, arg.originalArgs);
+              result = await fetchPage(result.data, param, maxPages);
+            }
+          }
+        }
+        finalQueryReturnValue = result;
+      } else {
+        finalQueryReturnValue = await executeRequest(arg.originalArgs);
+      }
+      if (metaSchema && !shouldSkip(skipSchemaValidation, "meta") && finalQueryReturnValue.meta) {
+        finalQueryReturnValue.meta = await parseWithSchema(metaSchema, finalQueryReturnValue.meta, "metaSchema", finalQueryReturnValue.meta);
+      }
+      return fulfillWithValue(finalQueryReturnValue.data, addShouldAutoBatch({
+        fulfilledTimeStamp: Date.now(),
+        baseQueryMeta: finalQueryReturnValue.meta
+      }));
+    } catch (error) {
+      let caughtError = error;
+      if (caughtError instanceof HandledError) {
+        let transformErrorResponse = getTransformCallbackForEndpoint(endpointDefinition, "transformErrorResponse");
+        const {
+          rawErrorResponseSchema,
+          errorResponseSchema
+        } = endpointDefinition;
+        let {
+          value,
+          meta
+        } = caughtError;
+        try {
+          if (rawErrorResponseSchema && !shouldSkip(skipSchemaValidation, "rawErrorResponse")) {
+            value = await parseWithSchema(rawErrorResponseSchema, value, "rawErrorResponseSchema", meta);
+          }
+          if (metaSchema && !shouldSkip(skipSchemaValidation, "meta")) {
+            meta = await parseWithSchema(metaSchema, meta, "metaSchema", meta);
+          }
+          let transformedErrorResponse = await transformErrorResponse(value, meta, arg.originalArgs);
+          if (errorResponseSchema && !shouldSkip(skipSchemaValidation, "errorResponse")) {
+            transformedErrorResponse = await parseWithSchema(errorResponseSchema, transformedErrorResponse, "errorResponseSchema", meta);
+          }
+          return rejectWithValue(transformedErrorResponse, addShouldAutoBatch({
+            baseQueryMeta: meta
+          }));
+        } catch (e) {
+          caughtError = e;
+        }
+      }
+      try {
+        if (caughtError instanceof NamedSchemaError) {
+          const info = {
+            endpoint: arg.endpointName,
+            arg: arg.originalArgs,
+            type: arg.type,
+            queryCacheKey: isQuery ? arg.queryCacheKey : void 0
+          };
+          (_f = endpointDefinition.onSchemaFailure) == null ? void 0 : _f.call(endpointDefinition, caughtError, info);
+          onSchemaFailure == null ? void 0 : onSchemaFailure(caughtError, info);
+          const {
+            catchSchemaFailure = globalCatchSchemaFailure
+          } = endpointDefinition;
+          if (catchSchemaFailure) {
+            return rejectWithValue(catchSchemaFailure(caughtError, info), addShouldAutoBatch({
+              baseQueryMeta: caughtError._bqMeta
+            }));
+          }
+        }
+      } catch (e) {
+        caughtError = e;
+      }
+      if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
+        console.error(`An unhandled error occurred processing a request for the endpoint "${arg.endpointName}".
+In the case of an unhandled error, no tags will be "provided" or "invalidated".`, caughtError);
+      } else {
+        console.error(caughtError);
+      }
+      throw caughtError;
+    }
+  };
+  function isForcedQuery(arg, state) {
+    var _a;
+    const requestState = selectors.selectQueryEntry(state, arg.queryCacheKey);
+    const baseFetchOnMountOrArgChange = selectors.selectConfig(state).refetchOnMountOrArgChange;
+    const fulfilledVal = requestState == null ? void 0 : requestState.fulfilledTimeStamp;
+    const refetchVal = (_a = arg.forceRefetch) != null ? _a : arg.subscribe && baseFetchOnMountOrArgChange;
+    if (refetchVal) {
+      return refetchVal === true || (Number(/* @__PURE__ */ new Date()) - Number(fulfilledVal)) / 1e3 >= refetchVal;
+    }
+    return false;
+  }
+  const createQueryThunk = () => {
+    const generatedQueryThunk = createAsyncThunk(`${reducerPath}/executeQuery`, executeEndpoint, {
+      getPendingMeta({
+        arg
+      }) {
+        const endpointDefinition = endpointDefinitions[arg.endpointName];
+        return addShouldAutoBatch(__spreadValues({
+          startedTimeStamp: Date.now()
+        }, isInfiniteQueryDefinition(endpointDefinition) ? {
+          direction: arg.direction
+        } : {}));
+      },
+      condition(queryThunkArg, {
+        getState
+      }) {
+        var _a;
+        const state = getState();
+        const requestState = selectors.selectQueryEntry(state, queryThunkArg.queryCacheKey);
+        const fulfilledVal = requestState == null ? void 0 : requestState.fulfilledTimeStamp;
+        const currentArg = queryThunkArg.originalArgs;
+        const previousArg = requestState == null ? void 0 : requestState.originalArgs;
+        const endpointDefinition = endpointDefinitions[queryThunkArg.endpointName];
+        const direction = queryThunkArg.direction;
+        if (isUpsertQuery(queryThunkArg)) {
+          return true;
+        }
+        if ((requestState == null ? void 0 : requestState.status) === "pending") {
+          return false;
+        }
+        if (isForcedQuery(queryThunkArg, state)) {
+          return true;
+        }
+        if (isQueryDefinition(endpointDefinition) && ((_a = endpointDefinition == null ? void 0 : endpointDefinition.forceRefetch) == null ? void 0 : _a.call(endpointDefinition, {
+          currentArg,
+          previousArg,
+          endpointState: requestState,
+          state
+        }))) {
+          return true;
+        }
+        if (fulfilledVal && !direction) {
+          return false;
+        }
+        return true;
+      },
+      dispatchConditionRejection: true
+    });
+    return generatedQueryThunk;
+  };
+  const queryThunk = createQueryThunk();
+  const infiniteQueryThunk = createQueryThunk();
+  const mutationThunk = createAsyncThunk(`${reducerPath}/executeMutation`, executeEndpoint, {
+    getPendingMeta() {
+      return addShouldAutoBatch({
+        startedTimeStamp: Date.now()
+      });
+    }
+  });
+  const hasTheForce = (options) => "force" in options;
+  const hasMaxAge = (options) => "ifOlderThan" in options;
+  const prefetch = (endpointName, arg, options = {}) => (dispatch, getState) => {
+    const force = hasTheForce(options) && options.force;
+    const maxAge = hasMaxAge(options) && options.ifOlderThan;
+    const queryAction = (force2 = true) => {
+      const options2 = {
+        forceRefetch: force2,
+        subscribe: false
+      };
+      return api.endpoints[endpointName].initiate(arg, options2);
+    };
+    const latestStateValue = api.endpoints[endpointName].select(arg)(getState());
+    if (force) {
+      dispatch(queryAction());
+    } else if (maxAge) {
+      const lastFulfilledTs = latestStateValue == null ? void 0 : latestStateValue.fulfilledTimeStamp;
+      if (!lastFulfilledTs) {
+        dispatch(queryAction());
+        return;
+      }
+      const shouldRetrigger = (Number(/* @__PURE__ */ new Date()) - Number(new Date(lastFulfilledTs))) / 1e3 >= maxAge;
+      if (shouldRetrigger) {
+        dispatch(queryAction());
+      }
+    } else {
+      dispatch(queryAction(false));
+    }
+  };
+  function matchesEndpoint(endpointName) {
+    return (action) => {
+      var _a, _b;
+      return ((_b = (_a = action == null ? void 0 : action.meta) == null ? void 0 : _a.arg) == null ? void 0 : _b.endpointName) === endpointName;
+    };
+  }
+  function buildMatchThunkActions(thunk, endpointName) {
+    return {
+      matchPending: isAllOf(isPending(thunk), matchesEndpoint(endpointName)),
+      matchFulfilled: isAllOf(isFulfilled(thunk), matchesEndpoint(endpointName)),
+      matchRejected: isAllOf(isRejected(thunk), matchesEndpoint(endpointName))
+    };
+  }
+  return {
+    queryThunk,
+    mutationThunk,
+    infiniteQueryThunk,
+    prefetch,
+    updateQueryData,
+    upsertQueryData,
+    patchQueryData,
+    buildMatchThunkActions
+  };
+}
+function getNextPageParam(options, {
+  pages,
+  pageParams
+}, queryArg) {
+  const lastIndex = pages.length - 1;
+  return options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams, queryArg);
+}
+function getPreviousPageParam(options, {
+  pages,
+  pageParams
+}, queryArg) {
+  var _a;
+  return (_a = options.getPreviousPageParam) == null ? void 0 : _a.call(options, pages[0], pages, pageParams[0], pageParams, queryArg);
+}
+function calculateProvidedByThunk(action, type, endpointDefinitions, assertTagType) {
+  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);
+}
+
+// src/query/utils/getCurrent.ts
+function getCurrent(value) {
+  return isDraft(value) ? current(value) : value;
+}
+
+// src/query/core/buildSlice.ts
+function updateQuerySubstateIfExists(state, queryCacheKey, update) {
+  const substate = state[queryCacheKey];
+  if (substate) {
+    update(substate);
+  }
+}
+function getMutationCacheKey(id) {
+  var _a;
+  return (_a = "arg" in id ? id.arg.fixedCacheKey : id.fixedCacheKey) != null ? _a : id.requestId;
+}
+function updateMutationSubstateIfExists(state, id, update) {
+  const substate = state[getMutationCacheKey(id)];
+  if (substate) {
+    update(substate);
+  }
+}
+var initialState = {};
+function buildSlice({
+  reducerPath,
+  queryThunk,
+  mutationThunk,
+  serializeQueryArgs,
+  context: {
+    endpointDefinitions: definitions,
+    apiUid,
+    extractRehydrationInfo,
+    hasRehydrationInfo
+  },
+  assertTagType,
+  config
+}) {
+  const resetApiState = createAction(`${reducerPath}/resetApiState`);
+  function writePendingCacheEntry(draft, arg, upserting, meta) {
+    var _a, _b;
+    (_b = draft[_a = arg.queryCacheKey]) != null ? _b : draft[_a] = {
+      status: STATUS_UNINITIALIZED,
+      endpointName: arg.endpointName
+    };
+    updateQuerySubstateIfExists(draft, arg.queryCacheKey, (substate) => {
+      substate.status = STATUS_PENDING;
+      substate.requestId = upserting && substate.requestId ? (
+        // for `upsertQuery` **updates**, keep the current `requestId`
+        substate.requestId
+      ) : (
+        // for normal queries or `upsertQuery` **inserts** always update the `requestId`
+        meta.requestId
+      );
+      if (arg.originalArgs !== void 0) {
+        substate.originalArgs = arg.originalArgs;
+      }
+      substate.startedTimeStamp = meta.startedTimeStamp;
+      const endpointDefinition = definitions[meta.arg.endpointName];
+      if (isInfiniteQueryDefinition(endpointDefinition) && "direction" in arg) {
+        ;
+        substate.direction = arg.direction;
+      }
+    });
+  }
+  function writeFulfilledCacheEntry(draft, meta, payload, upserting) {
+    updateQuerySubstateIfExists(draft, meta.arg.queryCacheKey, (substate) => {
+      var _a;
+      if (substate.requestId !== meta.requestId && !upserting) return;
+      const {
+        merge
+      } = definitions[meta.arg.endpointName];
+      substate.status = STATUS_FULFILLED;
+      if (merge) {
+        if (substate.data !== void 0) {
+          const {
+            fulfilledTimeStamp,
+            arg,
+            baseQueryMeta,
+            requestId
+          } = meta;
+          let newData = createNextState(substate.data, (draftSubstateData) => {
+            return merge(draftSubstateData, payload, {
+              arg: arg.originalArgs,
+              baseQueryMeta,
+              fulfilledTimeStamp,
+              requestId
+            });
+          });
+          substate.data = newData;
+        } else {
+          substate.data = payload;
+        }
+      } else {
+        substate.data = ((_a = definitions[meta.arg.endpointName].structuralSharing) != null ? _a : true) ? copyWithStructuralSharing(isDraft(substate.data) ? original(substate.data) : substate.data, payload) : payload;
+      }
+      delete substate.error;
+      substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;
+    });
+  }
+  const querySlice = createSlice({
+    name: `${reducerPath}/queries`,
+    initialState,
+    reducers: {
+      removeQueryResult: {
+        reducer(draft, {
+          payload: {
+            queryCacheKey
+          }
+        }) {
+          delete draft[queryCacheKey];
+        },
+        prepare: prepareAutoBatched()
+      },
+      cacheEntriesUpserted: {
+        reducer(draft, action) {
+          for (const entry of action.payload) {
+            const {
+              queryDescription: arg,
+              value
+            } = entry;
+            writePendingCacheEntry(draft, arg, true, {
+              arg,
+              requestId: action.meta.requestId,
+              startedTimeStamp: action.meta.timestamp
+            });
+            writeFulfilledCacheEntry(
+              draft,
+              {
+                arg,
+                requestId: action.meta.requestId,
+                fulfilledTimeStamp: action.meta.timestamp,
+                baseQueryMeta: {}
+              },
+              value,
+              // We know we're upserting here
+              true
+            );
+          }
+        },
+        prepare: (payload) => {
+          const queryDescriptions = payload.map((entry) => {
+            const {
+              endpointName,
+              arg,
+              value
+            } = entry;
+            const endpointDefinition = definitions[endpointName];
+            const queryDescription = {
+              type: ENDPOINT_QUERY,
+              endpointName,
+              originalArgs: entry.arg,
+              queryCacheKey: serializeQueryArgs({
+                queryArgs: arg,
+                endpointDefinition,
+                endpointName
+              })
+            };
+            return {
+              queryDescription,
+              value
+            };
+          });
+          const result = {
+            payload: queryDescriptions,
+            meta: {
+              [SHOULD_AUTOBATCH]: true,
+              requestId: nanoid(),
+              timestamp: Date.now()
+            }
+          };
+          return result;
+        }
+      },
+      queryResultPatched: {
+        reducer(draft, {
+          payload: {
+            queryCacheKey,
+            patches
+          }
+        }) {
+          updateQuerySubstateIfExists(draft, queryCacheKey, (substate) => {
+            substate.data = applyPatches(substate.data, patches.concat());
+          });
+        },
+        prepare: prepareAutoBatched()
+      }
+    },
+    extraReducers(builder) {
+      builder.addCase(queryThunk.pending, (draft, {
+        meta,
+        meta: {
+          arg
+        }
+      }) => {
+        const upserting = isUpsertQuery(arg);
+        writePendingCacheEntry(draft, arg, upserting, meta);
+      }).addCase(queryThunk.fulfilled, (draft, {
+        meta,
+        payload
+      }) => {
+        const upserting = isUpsertQuery(meta.arg);
+        writeFulfilledCacheEntry(draft, meta, payload, upserting);
+      }).addCase(queryThunk.rejected, (draft, {
+        meta: {
+          condition,
+          arg,
+          requestId
+        },
+        error,
+        payload
+      }) => {
+        updateQuerySubstateIfExists(draft, arg.queryCacheKey, (substate) => {
+          if (condition) {
+          } else {
+            if (substate.requestId !== requestId) return;
+            substate.status = STATUS_REJECTED;
+            substate.error = payload != null ? payload : error;
+          }
+        });
+      }).addMatcher(hasRehydrationInfo, (draft, action) => {
+        const {
+          queries
+        } = extractRehydrationInfo(action);
+        for (const [key, entry] of Object.entries(queries)) {
+          if (
+            // do not rehydrate entries that were currently in flight.
+            (entry == null ? void 0 : entry.status) === STATUS_FULFILLED || (entry == null ? void 0 : entry.status) === STATUS_REJECTED
+          ) {
+            draft[key] = entry;
+          }
+        }
+      });
+    }
+  });
+  const mutationSlice = createSlice({
+    name: `${reducerPath}/mutations`,
+    initialState,
+    reducers: {
+      removeMutationResult: {
+        reducer(draft, {
+          payload
+        }) {
+          const cacheKey = getMutationCacheKey(payload);
+          if (cacheKey in draft) {
+            delete draft[cacheKey];
+          }
+        },
+        prepare: prepareAutoBatched()
+      }
+    },
+    extraReducers(builder) {
+      builder.addCase(mutationThunk.pending, (draft, {
+        meta,
+        meta: {
+          requestId,
+          arg,
+          startedTimeStamp
+        }
+      }) => {
+        if (!arg.track) return;
+        draft[getMutationCacheKey(meta)] = {
+          requestId,
+          status: STATUS_PENDING,
+          endpointName: arg.endpointName,
+          startedTimeStamp
+        };
+      }).addCase(mutationThunk.fulfilled, (draft, {
+        payload,
+        meta
+      }) => {
+        if (!meta.arg.track) return;
+        updateMutationSubstateIfExists(draft, meta, (substate) => {
+          if (substate.requestId !== meta.requestId) return;
+          substate.status = STATUS_FULFILLED;
+          substate.data = payload;
+          substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;
+        });
+      }).addCase(mutationThunk.rejected, (draft, {
+        payload,
+        error,
+        meta
+      }) => {
+        if (!meta.arg.track) return;
+        updateMutationSubstateIfExists(draft, meta, (substate) => {
+          if (substate.requestId !== meta.requestId) return;
+          substate.status = STATUS_REJECTED;
+          substate.error = payload != null ? payload : error;
+        });
+      }).addMatcher(hasRehydrationInfo, (draft, action) => {
+        const {
+          mutations
+        } = extractRehydrationInfo(action);
+        for (const [key, entry] of Object.entries(mutations)) {
+          if (
+            // do not rehydrate entries that were currently in flight.
+            ((entry == null ? void 0 : entry.status) === STATUS_FULFILLED || (entry == null ? void 0 : entry.status) === STATUS_REJECTED) && // only rehydrate endpoints that were persisted using a `fixedCacheKey`
+            key !== (entry == null ? void 0 : entry.requestId)
+          ) {
+            draft[key] = entry;
+          }
+        }
+      });
+    }
+  });
+  const initialInvalidationState = {
+    tags: {},
+    keys: {}
+  };
+  const invalidationSlice = createSlice({
+    name: `${reducerPath}/invalidation`,
+    initialState: initialInvalidationState,
+    reducers: {
+      updateProvidedBy: {
+        reducer(draft, action) {
+          var _a, _b, _c, _d, _e;
+          for (const {
+            queryCacheKey,
+            providedTags
+          } of action.payload) {
+            removeCacheKeyFromTags(draft, queryCacheKey);
+            for (const {
+              type,
+              id
+            } of providedTags) {
+              const subscribedQueries = (_e = (_c = (_b = (_a = draft.tags)[type]) != null ? _b : _a[type] = {})[_d = id || "__internal_without_id"]) != null ? _e : _c[_d] = [];
+              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);
+              if (!alreadySubscribed) {
+                subscribedQueries.push(queryCacheKey);
+              }
+            }
+            draft.keys[queryCacheKey] = providedTags;
+          }
+        },
+        prepare: prepareAutoBatched()
+      }
+    },
+    extraReducers(builder) {
+      builder.addCase(querySlice.actions.removeQueryResult, (draft, {
+        payload: {
+          queryCacheKey
+        }
+      }) => {
+        removeCacheKeyFromTags(draft, queryCacheKey);
+      }).addMatcher(hasRehydrationInfo, (draft, action) => {
+        var _a, _b, _c, _d, _e, _f;
+        const {
+          provided
+        } = extractRehydrationInfo(action);
+        for (const [type, incomingTags] of Object.entries((_a = provided.tags) != null ? _a : {})) {
+          for (const [id, cacheKeys] of Object.entries(incomingTags)) {
+            const subscribedQueries = (_f = (_d = (_c = (_b = draft.tags)[type]) != null ? _c : _b[type] = {})[_e = id || "__internal_without_id"]) != null ? _f : _d[_e] = [];
+            for (const queryCacheKey of cacheKeys) {
+              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);
+              if (!alreadySubscribed) {
+                subscribedQueries.push(queryCacheKey);
+              }
+              draft.keys[queryCacheKey] = provided.keys[queryCacheKey];
+            }
+          }
+        }
+      }).addMatcher(isAnyOf(isFulfilled(queryThunk), isRejectedWithValue(queryThunk)), (draft, action) => {
+        writeProvidedTagsForQueries(draft, [action]);
+      }).addMatcher(querySlice.actions.cacheEntriesUpserted.match, (draft, action) => {
+        const mockActions = action.payload.map(({
+          queryDescription,
+          value
+        }) => {
+          return {
+            type: "UNKNOWN",
+            payload: value,
+            meta: {
+              requestStatus: "fulfilled",
+              requestId: "UNKNOWN",
+              arg: queryDescription
+            }
+          };
+        });
+        writeProvidedTagsForQueries(draft, mockActions);
+      });
+    }
+  });
+  function removeCacheKeyFromTags(draft, queryCacheKey) {
+    var _a, _b, _c;
+    const existingTags = getCurrent((_a = draft.keys[queryCacheKey]) != null ? _a : []);
+    for (const tag of existingTags) {
+      const tagType = tag.type;
+      const tagId = (_b = tag.id) != null ? _b : "__internal_without_id";
+      const tagSubscriptions = (_c = draft.tags[tagType]) == null ? void 0 : _c[tagId];
+      if (tagSubscriptions) {
+        draft.tags[tagType][tagId] = getCurrent(tagSubscriptions).filter((qc) => qc !== queryCacheKey);
+      }
+    }
+    delete draft.keys[queryCacheKey];
+  }
+  function writeProvidedTagsForQueries(draft, actions3) {
+    const providedByEntries = actions3.map((action) => {
+      const providedTags = calculateProvidedByThunk(action, "providesTags", definitions, assertTagType);
+      const {
+        queryCacheKey
+      } = action.meta.arg;
+      return {
+        queryCacheKey,
+        providedTags
+      };
+    });
+    invalidationSlice.caseReducers.updateProvidedBy(draft, invalidationSlice.actions.updateProvidedBy(providedByEntries));
+  }
+  const subscriptionSlice = createSlice({
+    name: `${reducerPath}/subscriptions`,
+    initialState,
+    reducers: {
+      updateSubscriptionOptions(d, a) {
+      },
+      unsubscribeQueryResult(d, a) {
+      },
+      internal_getRTKQSubscriptions() {
+      }
+    }
+  });
+  const internalSubscriptionsSlice = createSlice({
+    name: `${reducerPath}/internalSubscriptions`,
+    initialState,
+    reducers: {
+      subscriptionsUpdated: {
+        reducer(state, action) {
+          return applyPatches(state, action.payload);
+        },
+        prepare: prepareAutoBatched()
+      }
+    }
+  });
+  const configSlice = createSlice({
+    name: `${reducerPath}/config`,
+    initialState: __spreadValues({
+      online: isOnline(),
+      focused: isDocumentVisible(),
+      middlewareRegistered: false
+    }, config),
+    reducers: {
+      middlewareRegistered(state, {
+        payload
+      }) {
+        state.middlewareRegistered = state.middlewareRegistered === "conflict" || apiUid !== payload ? "conflict" : true;
+      }
+    },
+    extraReducers: (builder) => {
+      builder.addCase(onOnline, (state) => {
+        state.online = true;
+      }).addCase(onOffline, (state) => {
+        state.online = false;
+      }).addCase(onFocus, (state) => {
+        state.focused = true;
+      }).addCase(onFocusLost, (state) => {
+        state.focused = false;
+      }).addMatcher(hasRehydrationInfo, (draft) => __spreadValues({}, draft));
+    }
+  });
+  const combinedReducer = combineReducers({
+    queries: querySlice.reducer,
+    mutations: mutationSlice.reducer,
+    provided: invalidationSlice.reducer,
+    subscriptions: internalSubscriptionsSlice.reducer,
+    config: configSlice.reducer
+  });
+  const reducer = (state, action) => combinedReducer(resetApiState.match(action) ? void 0 : state, action);
+  const actions2 = __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, configSlice.actions), querySlice.actions), subscriptionSlice.actions), internalSubscriptionsSlice.actions), mutationSlice.actions), invalidationSlice.actions), {
+    resetApiState
+  });
+  return {
+    reducer,
+    actions: actions2
+  };
+}
+
+// src/query/core/buildSelectors.ts
+var skipToken = /* @__PURE__ */ Symbol.for("RTKQ/skipToken");
+var initialSubState = {
+  status: STATUS_UNINITIALIZED
+};
+var defaultQuerySubState = /* @__PURE__ */ createNextState(initialSubState, () => {
+});
+var defaultMutationSubState = /* @__PURE__ */ createNextState(initialSubState, () => {
+});
+function buildSelectors({
+  serializeQueryArgs,
+  reducerPath,
+  createSelector: createSelector2
+}) {
+  const selectSkippedQuery = (state) => defaultQuerySubState;
+  const selectSkippedMutation = (state) => defaultMutationSubState;
+  return {
+    buildQuerySelector,
+    buildInfiniteQuerySelector,
+    buildMutationSelector,
+    selectInvalidatedBy,
+    selectCachedArgsForQuery,
+    selectApiState,
+    selectQueries,
+    selectMutations,
+    selectQueryEntry,
+    selectConfig
+  };
+  function withRequestFlags(substate) {
+    return __spreadValues(__spreadValues({}, substate), getRequestStatusFlags(substate.status));
+  }
+  function selectApiState(rootState) {
+    const state = rootState[reducerPath];
+    if (process.env.NODE_ENV !== "production") {
+      if (!state) {
+        if (selectApiState.triggered) return state;
+        selectApiState.triggered = true;
+        console.error(`Error: No data found at \`state.${reducerPath}\`. Did you forget to add the reducer to the store?`);
+      }
+    }
+    return state;
+  }
+  function selectQueries(rootState) {
+    var _a;
+    return (_a = selectApiState(rootState)) == null ? void 0 : _a.queries;
+  }
+  function selectQueryEntry(rootState, cacheKey) {
+    var _a;
+    return (_a = selectQueries(rootState)) == null ? void 0 : _a[cacheKey];
+  }
+  function selectMutations(rootState) {
+    var _a;
+    return (_a = selectApiState(rootState)) == null ? void 0 : _a.mutations;
+  }
+  function selectConfig(rootState) {
+    var _a;
+    return (_a = selectApiState(rootState)) == null ? void 0 : _a.config;
+  }
+  function buildAnyQuerySelector(endpointName, endpointDefinition, combiner) {
+    return (queryArgs) => {
+      if (queryArgs === skipToken) {
+        return createSelector2(selectSkippedQuery, combiner);
+      }
+      const serializedArgs = serializeQueryArgs({
+        queryArgs,
+        endpointDefinition,
+        endpointName
+      });
+      const selectQuerySubstate = (state) => {
+        var _a;
+        return (_a = selectQueryEntry(state, serializedArgs)) != null ? _a : defaultQuerySubState;
+      };
+      return createSelector2(selectQuerySubstate, combiner);
+    };
+  }
+  function buildQuerySelector(endpointName, endpointDefinition) {
+    return buildAnyQuerySelector(endpointName, endpointDefinition, withRequestFlags);
+  }
+  function buildInfiniteQuerySelector(endpointName, endpointDefinition) {
+    const {
+      infiniteQueryOptions
+    } = endpointDefinition;
+    function withInfiniteQueryResultFlags(substate) {
+      const stateWithRequestFlags = __spreadValues(__spreadValues({}, substate), getRequestStatusFlags(substate.status));
+      const {
+        isLoading,
+        isError,
+        direction
+      } = stateWithRequestFlags;
+      const isForward = direction === "forward";
+      const isBackward = direction === "backward";
+      return __spreadProps(__spreadValues({}, stateWithRequestFlags), {
+        hasNextPage: getHasNextPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),
+        hasPreviousPage: getHasPreviousPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),
+        isFetchingNextPage: isLoading && isForward,
+        isFetchingPreviousPage: isLoading && isBackward,
+        isFetchNextPageError: isError && isForward,
+        isFetchPreviousPageError: isError && isBackward
+      });
+    }
+    return buildAnyQuerySelector(endpointName, endpointDefinition, withInfiniteQueryResultFlags);
+  }
+  function buildMutationSelector() {
+    return (id) => {
+      var _a;
+      let mutationId;
+      if (typeof id === "object") {
+        mutationId = (_a = getMutationCacheKey(id)) != null ? _a : skipToken;
+      } else {
+        mutationId = id;
+      }
+      const selectMutationSubstate = (state) => {
+        var _a2, _b, _c;
+        return (_c = (_b = (_a2 = selectApiState(state)) == null ? void 0 : _a2.mutations) == null ? void 0 : _b[mutationId]) != null ? _c : defaultMutationSubState;
+      };
+      const finalSelectMutationSubstate = mutationId === skipToken ? selectSkippedMutation : selectMutationSubstate;
+      return createSelector2(finalSelectMutationSubstate, withRequestFlags);
+    };
+  }
+  function selectInvalidatedBy(state, tags) {
+    var _a;
+    const apiState = state[reducerPath];
+    const toInvalidate = /* @__PURE__ */ new Set();
+    const finalTags = filterMap(tags, isNotNullish, expandTagDescription);
+    for (const tag of finalTags) {
+      const provided = apiState.provided.tags[tag.type];
+      if (!provided) {
+        continue;
+      }
+      let invalidateSubscriptions = (_a = tag.id !== void 0 ? (
+        // id given: invalidate all queries that provide this type & id
+        provided[tag.id]
+      ) : (
+        // no id: invalidate all queries that provide this type
+        Object.values(provided).flat()
+      )) != null ? _a : [];
+      for (const invalidate of invalidateSubscriptions) {
+        toInvalidate.add(invalidate);
+      }
+    }
+    return Array.from(toInvalidate.values()).flatMap((queryCacheKey) => {
+      const querySubState = apiState.queries[queryCacheKey];
+      return querySubState ? {
+        queryCacheKey,
+        endpointName: querySubState.endpointName,
+        originalArgs: querySubState.originalArgs
+      } : [];
+    });
+  }
+  function selectCachedArgsForQuery(state, queryName) {
+    return filterMap(Object.values(selectQueries(state)), (entry) => (entry == null ? void 0 : entry.endpointName) === queryName && entry.status !== STATUS_UNINITIALIZED, (entry) => entry.originalArgs);
+  }
+  function getHasNextPage(options, data, queryArg) {
+    if (!data) return false;
+    return getNextPageParam(options, data, queryArg) != null;
+  }
+  function getHasPreviousPage(options, data, queryArg) {
+    if (!data || !options.getPreviousPageParam) return false;
+    return getPreviousPageParam(options, data, queryArg) != null;
+  }
+}
+
+// src/query/createApi.ts
+import { formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage22, formatProdErrorMessage as _formatProdErrorMessage3 } from "@reduxjs/toolkit";
+
+// src/query/defaultSerializeQueryArgs.ts
+var cache = WeakMap ? /* @__PURE__ */ new WeakMap() : void 0;
+var defaultSerializeQueryArgs = ({
+  endpointName,
+  queryArgs
+}) => {
+  let serialized = "";
+  const cached = cache == null ? void 0 : cache.get(queryArgs);
+  if (typeof cached === "string") {
+    serialized = cached;
+  } else {
+    const stringified = JSON.stringify(queryArgs, (key, value) => {
+      value = typeof value === "bigint" ? {
+        $bigint: value.toString()
+      } : value;
+      value = isPlainObject(value) ? Object.keys(value).sort().reduce((acc, key2) => {
+        acc[key2] = value[key2];
+        return acc;
+      }, {}) : value;
+      return value;
+    });
+    if (isPlainObject(queryArgs)) {
+      cache == null ? void 0 : cache.set(queryArgs, stringified);
+    }
+    serialized = stringified;
+  }
+  return `${endpointName}(${serialized})`;
+};
+
+// src/query/createApi.ts
+import { weakMapMemoize } from "reselect";
+function buildCreateApi(...modules) {
+  return function baseCreateApi(options) {
+    const extractRehydrationInfo = weakMapMemoize((action) => {
+      var _a, _b;
+      return (_b = options.extractRehydrationInfo) == null ? void 0 : _b.call(options, action, {
+        reducerPath: (_a = options.reducerPath) != null ? _a : "api"
+      });
+    });
+    const optionsWithDefaults = __spreadProps(__spreadValues({
+      reducerPath: "api",
+      keepUnusedDataFor: 60,
+      refetchOnMountOrArgChange: false,
+      refetchOnFocus: false,
+      refetchOnReconnect: false,
+      invalidationBehavior: "delayed"
+    }, options), {
+      extractRehydrationInfo,
+      serializeQueryArgs(queryArgsApi) {
+        let finalSerializeQueryArgs = defaultSerializeQueryArgs;
+        if ("serializeQueryArgs" in queryArgsApi.endpointDefinition) {
+          const endpointSQA = queryArgsApi.endpointDefinition.serializeQueryArgs;
+          finalSerializeQueryArgs = (queryArgsApi2) => {
+            const initialResult = endpointSQA(queryArgsApi2);
+            if (typeof initialResult === "string") {
+              return initialResult;
+            } else {
+              return defaultSerializeQueryArgs(__spreadProps(__spreadValues({}, queryArgsApi2), {
+                queryArgs: initialResult
+              }));
+            }
+          };
+        } else if (options.serializeQueryArgs) {
+          finalSerializeQueryArgs = options.serializeQueryArgs;
+        }
+        return finalSerializeQueryArgs(queryArgsApi);
+      },
+      tagTypes: [...options.tagTypes || []]
+    });
+    const context = {
+      endpointDefinitions: {},
+      batch(fn) {
+        fn();
+      },
+      apiUid: nanoid(),
+      extractRehydrationInfo,
+      hasRehydrationInfo: weakMapMemoize((action) => extractRehydrationInfo(action) != null)
+    };
+    const api = {
+      injectEndpoints,
+      enhanceEndpoints({
+        addTagTypes,
+        endpoints
+      }) {
+        if (addTagTypes) {
+          for (const eT of addTagTypes) {
+            if (!optionsWithDefaults.tagTypes.includes(eT)) {
+              ;
+              optionsWithDefaults.tagTypes.push(eT);
+            }
+          }
+        }
+        if (endpoints) {
+          for (const [endpointName, partialDefinition] of Object.entries(endpoints)) {
+            if (typeof partialDefinition === "function") {
+              partialDefinition(getEndpointDefinition(context, endpointName));
+            } else {
+              Object.assign(getEndpointDefinition(context, endpointName) || {}, partialDefinition);
+            }
+          }
+        }
+        return api;
+      }
+    };
+    const initializedModules = modules.map((m) => m.init(api, optionsWithDefaults, context));
+    function injectEndpoints(inject) {
+      const evaluatedEndpoints = inject.endpoints({
+        query: (x) => __spreadProps(__spreadValues({}, x), {
+          type: ENDPOINT_QUERY
+        }),
+        mutation: (x) => __spreadProps(__spreadValues({}, x), {
+          type: ENDPOINT_MUTATION
+        }),
+        infiniteQuery: (x) => __spreadProps(__spreadValues({}, x), {
+          type: ENDPOINT_INFINITEQUERY
+        })
+      });
+      for (const [endpointName, definition] of Object.entries(evaluatedEndpoints)) {
+        if (inject.overrideExisting !== true && endpointName in context.endpointDefinitions) {
+          if (inject.overrideExisting === "throw") {
+            throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage2(39) : `called \`injectEndpoints\` to override already-existing endpointName ${endpointName} without specifying \`overrideExisting: true\``);
+          } else if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
+            console.error(`called \`injectEndpoints\` to override already-existing endpointName ${endpointName} without specifying \`overrideExisting: true\``);
+          }
+          continue;
+        }
+        if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
+          if (isInfiniteQueryDefinition(definition)) {
+            const {
+              infiniteQueryOptions
+            } = definition;
+            const {
+              maxPages,
+              getPreviousPageParam: getPreviousPageParam2
+            } = infiniteQueryOptions;
+            if (typeof maxPages === "number") {
+              if (maxPages < 1) {
+                throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage22(40) : `maxPages for endpoint '${endpointName}' must be a number greater than 0`);
+              }
+              if (typeof getPreviousPageParam2 !== "function") {
+                throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage3(41) : `getPreviousPageParam for endpoint '${endpointName}' must be a function if maxPages is used`);
+              }
+            }
+          }
+        }
+        context.endpointDefinitions[endpointName] = definition;
+        for (const m of initializedModules) {
+          m.injectEndpoint(endpointName, definition);
+        }
+      }
+      return api;
+    }
+    return api.injectEndpoints({
+      endpoints: options.endpoints
+    });
+  };
+}
+
+// src/query/fakeBaseQuery.ts
+import { formatProdErrorMessage as _formatProdErrorMessage4 } from "@reduxjs/toolkit";
+var _NEVER = /* @__PURE__ */ Symbol();
+function fakeBaseQuery() {
+  return function() {
+    throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage4(33) : "When using `fakeBaseQuery`, all queries & mutations must use the `queryFn` definition syntax.");
+  };
+}
+
+// src/query/tsHelpers.ts
+function assertCast(v) {
+}
+function safeAssign(target, ...args) {
+  return Object.assign(target, ...args);
+}
+
+// src/query/core/buildMiddleware/batchActions.ts
+var buildBatchedActionsHandler = ({
+  api,
+  queryThunk,
+  internalState,
+  mwApi
+}) => {
+  const subscriptionsPrefix = `${api.reducerPath}/subscriptions`;
+  let previousSubscriptions = null;
+  let updateSyncTimer = null;
+  const {
+    updateSubscriptionOptions,
+    unsubscribeQueryResult
+  } = api.internalActions;
+  const actuallyMutateSubscriptions = (currentSubscriptions, action) => {
+    var _a, _b, _c, _d;
+    if (updateSubscriptionOptions.match(action)) {
+      const {
+        queryCacheKey,
+        requestId,
+        options
+      } = action.payload;
+      const sub = currentSubscriptions.get(queryCacheKey);
+      if (sub == null ? void 0 : sub.has(requestId)) {
+        sub.set(requestId, options);
+      }
+      return true;
+    }
+    if (unsubscribeQueryResult.match(action)) {
+      const {
+        queryCacheKey,
+        requestId
+      } = action.payload;
+      const sub = currentSubscriptions.get(queryCacheKey);
+      if (sub) {
+        sub.delete(requestId);
+      }
+      return true;
+    }
+    if (api.internalActions.removeQueryResult.match(action)) {
+      currentSubscriptions.delete(action.payload.queryCacheKey);
+      return true;
+    }
+    if (queryThunk.pending.match(action)) {
+      const {
+        meta: {
+          arg,
+          requestId
+        }
+      } = action;
+      const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);
+      if (arg.subscribe) {
+        substate.set(requestId, (_b = (_a = arg.subscriptionOptions) != null ? _a : substate.get(requestId)) != null ? _b : {});
+      }
+      return true;
+    }
+    let mutated = false;
+    if (queryThunk.rejected.match(action)) {
+      const {
+        meta: {
+          condition,
+          arg,
+          requestId
+        }
+      } = action;
+      if (condition && arg.subscribe) {
+        const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);
+        substate.set(requestId, (_d = (_c = arg.subscriptionOptions) != null ? _c : substate.get(requestId)) != null ? _d : {});
+        mutated = true;
+      }
+    }
+    return mutated;
+  };
+  const getSubscriptions = () => internalState.currentSubscriptions;
+  const getSubscriptionCount = (queryCacheKey) => {
+    var _a;
+    const subscriptions = getSubscriptions();
+    const subscriptionsForQueryArg = subscriptions.get(queryCacheKey);
+    return (_a = subscriptionsForQueryArg == null ? void 0 : subscriptionsForQueryArg.size) != null ? _a : 0;
+  };
+  const isRequestSubscribed = (queryCacheKey, requestId) => {
+    var _a;
+    const subscriptions = getSubscriptions();
+    return !!((_a = subscriptions == null ? void 0 : subscriptions.get(queryCacheKey)) == null ? void 0 : _a.get(requestId));
+  };
+  const subscriptionSelectors = {
+    getSubscriptions,
+    getSubscriptionCount,
+    isRequestSubscribed
+  };
+  function serializeSubscriptions(currentSubscriptions) {
+    return JSON.parse(JSON.stringify(Object.fromEntries([...currentSubscriptions].map(([k, v]) => [k, Object.fromEntries(v)]))));
+  }
+  return (action, mwApi2) => {
+    if (!previousSubscriptions) {
+      previousSubscriptions = serializeSubscriptions(internalState.currentSubscriptions);
+    }
+    if (api.util.resetApiState.match(action)) {
+      previousSubscriptions = {};
+      internalState.currentSubscriptions.clear();
+      updateSyncTimer = null;
+      return [true, false];
+    }
+    if (api.internalActions.internal_getRTKQSubscriptions.match(action)) {
+      return [false, subscriptionSelectors];
+    }
+    const didMutate = actuallyMutateSubscriptions(internalState.currentSubscriptions, action);
+    let actionShouldContinue = true;
+    if (process.env.NODE_ENV === "test" && typeof action.type === "string" && action.type === `${api.reducerPath}/getPolling`) {
+      return [false, internalState.currentPolls];
+    }
+    if (didMutate) {
+      if (!updateSyncTimer) {
+        updateSyncTimer = setTimeout(() => {
+          const newSubscriptions = serializeSubscriptions(internalState.currentSubscriptions);
+          const [, patches] = produceWithPatches(previousSubscriptions, () => newSubscriptions);
+          mwApi2.next(api.internalActions.subscriptionsUpdated(patches));
+          previousSubscriptions = newSubscriptions;
+          updateSyncTimer = null;
+        }, 500);
+      }
+      const isSubscriptionSliceAction = typeof action.type == "string" && !!action.type.startsWith(subscriptionsPrefix);
+      const isAdditionalSubscriptionAction = queryThunk.rejected.match(action) && action.meta.condition && !!action.meta.arg.subscribe;
+      actionShouldContinue = !isSubscriptionSliceAction && !isAdditionalSubscriptionAction;
+    }
+    return [actionShouldContinue, false];
+  };
+};
+
+// src/query/core/buildMiddleware/cacheCollection.ts
+var THIRTY_TWO_BIT_MAX_TIMER_SECONDS = 2147483647 / 1e3 - 1;
+var buildCacheCollectionHandler = ({
+  reducerPath,
+  api,
+  queryThunk,
+  context,
+  internalState,
+  selectors: {
+    selectQueryEntry,
+    selectConfig
+  },
+  getRunningQueryThunk,
+  mwApi
+}) => {
+  const {
+    removeQueryResult,
+    unsubscribeQueryResult,
+    cacheEntriesUpserted
+  } = api.internalActions;
+  const canTriggerUnsubscribe = isAnyOf(unsubscribeQueryResult.match, queryThunk.fulfilled, queryThunk.rejected, cacheEntriesUpserted.match);
+  function anySubscriptionsRemainingForKey(queryCacheKey) {
+    const subscriptions = internalState.currentSubscriptions.get(queryCacheKey);
+    if (!subscriptions) {
+      return false;
+    }
+    const hasSubscriptions = subscriptions.size > 0;
+    return hasSubscriptions;
+  }
+  const currentRemovalTimeouts = {};
+  function abortAllPromises(promiseMap) {
+    var _a;
+    for (const promise of promiseMap.values()) {
+      (_a = promise == null ? void 0 : promise.abort) == null ? void 0 : _a.call(promise);
+    }
+  }
+  const handler = (action, mwApi2) => {
+    const state = mwApi2.getState();
+    const config = selectConfig(state);
+    if (canTriggerUnsubscribe(action)) {
+      let queryCacheKeys;
+      if (cacheEntriesUpserted.match(action)) {
+        queryCacheKeys = action.payload.map((entry) => entry.queryDescription.queryCacheKey);
+      } else {
+        const {
+          queryCacheKey
+        } = unsubscribeQueryResult.match(action) ? action.payload : action.meta.arg;
+        queryCacheKeys = [queryCacheKey];
+      }
+      handleUnsubscribeMany(queryCacheKeys, mwApi2, config);
+    }
+    if (api.util.resetApiState.match(action)) {
+      for (const [key, timeout] of Object.entries(currentRemovalTimeouts)) {
+        if (timeout) clearTimeout(timeout);
+        delete currentRemovalTimeouts[key];
+      }
+      abortAllPromises(internalState.runningQueries);
+      abortAllPromises(internalState.runningMutations);
+    }
+    if (context.hasRehydrationInfo(action)) {
+      const {
+        queries
+      } = context.extractRehydrationInfo(action);
+      handleUnsubscribeMany(Object.keys(queries), mwApi2, config);
+    }
+  };
+  function handleUnsubscribeMany(cacheKeys, api2, config) {
+    const state = api2.getState();
+    for (const queryCacheKey of cacheKeys) {
+      const entry = selectQueryEntry(state, queryCacheKey);
+      if (entry == null ? void 0 : entry.endpointName) {
+        handleUnsubscribe(queryCacheKey, entry.endpointName, api2, config);
+      }
+    }
+  }
+  function handleUnsubscribe(queryCacheKey, endpointName, api2, config) {
+    var _a;
+    const endpointDefinition = getEndpointDefinition(context, endpointName);
+    const keepUnusedDataFor = (_a = endpointDefinition == null ? void 0 : endpointDefinition.keepUnusedDataFor) != null ? _a : config.keepUnusedDataFor;
+    if (keepUnusedDataFor === Infinity) {
+      return;
+    }
+    const finalKeepUnusedDataFor = Math.max(0, Math.min(keepUnusedDataFor, THIRTY_TWO_BIT_MAX_TIMER_SECONDS));
+    if (!anySubscriptionsRemainingForKey(queryCacheKey)) {
+      const currentTimeout = currentRemovalTimeouts[queryCacheKey];
+      if (currentTimeout) {
+        clearTimeout(currentTimeout);
+      }
+      currentRemovalTimeouts[queryCacheKey] = setTimeout(() => {
+        if (!anySubscriptionsRemainingForKey(queryCacheKey)) {
+          const entry = selectQueryEntry(api2.getState(), queryCacheKey);
+          if (entry == null ? void 0 : entry.endpointName) {
+            const runningQuery = api2.dispatch(getRunningQueryThunk(entry.endpointName, entry.originalArgs));
+            runningQuery == null ? void 0 : runningQuery.abort();
+          }
+          api2.dispatch(removeQueryResult({
+            queryCacheKey
+          }));
+        }
+        delete currentRemovalTimeouts[queryCacheKey];
+      }, finalKeepUnusedDataFor * 1e3);
+    }
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/cacheLifecycle.ts
+var neverResolvedError = new Error("Promise never resolved before cacheEntryRemoved.");
+var buildCacheLifecycleHandler = ({
+  api,
+  reducerPath,
+  context,
+  queryThunk,
+  mutationThunk,
+  internalState,
+  selectors: {
+    selectQueryEntry,
+    selectApiState
+  }
+}) => {
+  const isQueryThunk = isAsyncThunkAction(queryThunk);
+  const isMutationThunk = isAsyncThunkAction(mutationThunk);
+  const isFulfilledThunk = isFulfilled(queryThunk, mutationThunk);
+  const lifecycleMap = {};
+  const {
+    removeQueryResult,
+    removeMutationResult,
+    cacheEntriesUpserted
+  } = api.internalActions;
+  function resolveLifecycleEntry(cacheKey, data, meta) {
+    const lifecycle = lifecycleMap[cacheKey];
+    if (lifecycle == null ? void 0 : lifecycle.valueResolved) {
+      lifecycle.valueResolved({
+        data,
+        meta
+      });
+      delete lifecycle.valueResolved;
+    }
+  }
+  function removeLifecycleEntry(cacheKey) {
+    const lifecycle = lifecycleMap[cacheKey];
+    if (lifecycle) {
+      delete lifecycleMap[cacheKey];
+      lifecycle.cacheEntryRemoved();
+    }
+  }
+  function getActionMetaFields(action) {
+    const {
+      arg,
+      requestId
+    } = action.meta;
+    const {
+      endpointName,
+      originalArgs
+    } = arg;
+    return [endpointName, originalArgs, requestId];
+  }
+  const handler = (action, mwApi, stateBefore) => {
+    const cacheKey = getCacheKey(action);
+    function checkForNewCacheKey(endpointName, cacheKey2, requestId, originalArgs) {
+      const oldEntry = selectQueryEntry(stateBefore, cacheKey2);
+      const newEntry = selectQueryEntry(mwApi.getState(), cacheKey2);
+      if (!oldEntry && newEntry) {
+        handleNewKey(endpointName, originalArgs, cacheKey2, mwApi, requestId);
+      }
+    }
+    if (queryThunk.pending.match(action)) {
+      const [endpointName, originalArgs, requestId] = getActionMetaFields(action);
+      checkForNewCacheKey(endpointName, cacheKey, requestId, originalArgs);
+    } else if (cacheEntriesUpserted.match(action)) {
+      for (const {
+        queryDescription,
+        value
+      } of action.payload) {
+        const {
+          endpointName,
+          originalArgs,
+          queryCacheKey
+        } = queryDescription;
+        checkForNewCacheKey(endpointName, queryCacheKey, action.meta.requestId, originalArgs);
+        resolveLifecycleEntry(queryCacheKey, value, {});
+      }
+    } else if (mutationThunk.pending.match(action)) {
+      const state = mwApi.getState()[reducerPath].mutations[cacheKey];
+      if (state) {
+        const [endpointName, originalArgs, requestId] = getActionMetaFields(action);
+        handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId);
+      }
+    } else if (isFulfilledThunk(action)) {
+      resolveLifecycleEntry(cacheKey, action.payload, action.meta.baseQueryMeta);
+    } else if (removeQueryResult.match(action) || removeMutationResult.match(action)) {
+      removeLifecycleEntry(cacheKey);
+    } else if (api.util.resetApiState.match(action)) {
+      for (const cacheKey2 of Object.keys(lifecycleMap)) {
+        removeLifecycleEntry(cacheKey2);
+      }
+    }
+  };
+  function getCacheKey(action) {
+    var _a;
+    if (isQueryThunk(action)) return action.meta.arg.queryCacheKey;
+    if (isMutationThunk(action)) {
+      return (_a = action.meta.arg.fixedCacheKey) != null ? _a : action.meta.requestId;
+    }
+    if (removeQueryResult.match(action)) return action.payload.queryCacheKey;
+    if (removeMutationResult.match(action)) return getMutationCacheKey(action.payload);
+    return "";
+  }
+  function handleNewKey(endpointName, originalArgs, queryCacheKey, mwApi, requestId) {
+    const endpointDefinition = getEndpointDefinition(context, endpointName);
+    const onCacheEntryAdded = endpointDefinition == null ? void 0 : endpointDefinition.onCacheEntryAdded;
+    if (!onCacheEntryAdded) return;
+    const lifecycle = {};
+    const cacheEntryRemoved = new Promise((resolve) => {
+      lifecycle.cacheEntryRemoved = resolve;
+    });
+    const cacheDataLoaded = Promise.race([new Promise((resolve) => {
+      lifecycle.valueResolved = resolve;
+    }), cacheEntryRemoved.then(() => {
+      throw neverResolvedError;
+    })]);
+    cacheDataLoaded.catch(() => {
+    });
+    lifecycleMap[queryCacheKey] = lifecycle;
+    const selector = api.endpoints[endpointName].select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : queryCacheKey);
+    const extra = mwApi.dispatch((_, __, extra2) => extra2);
+    const lifecycleApi = __spreadProps(__spreadValues({}, mwApi), {
+      getCacheEntry: () => selector(mwApi.getState()),
+      requestId,
+      extra,
+      updateCachedData: isAnyQueryDefinition(endpointDefinition) ? (updateRecipe) => mwApi.dispatch(api.util.updateQueryData(endpointName, originalArgs, updateRecipe)) : void 0,
+      cacheDataLoaded,
+      cacheEntryRemoved
+    });
+    const runningHandler = onCacheEntryAdded(originalArgs, lifecycleApi);
+    Promise.resolve(runningHandler).catch((e) => {
+      if (e === neverResolvedError) return;
+      throw e;
+    });
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/devMiddleware.ts
+var buildDevCheckHandler = ({
+  api,
+  context: {
+    apiUid
+  },
+  reducerPath
+}) => {
+  return (action, mwApi) => {
+    var _a, _b;
+    if (api.util.resetApiState.match(action)) {
+      mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));
+    }
+    if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
+      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") {
+        console.warn(`There is a mismatch between slice and middleware for the reducerPath "${reducerPath}".
+You can only have one api per reducer path, this will lead to crashes in various situations!${reducerPath === "api" ? `
+If you have multiple apis, you *have* to specify the reducerPath option when using createApi!` : ""}`);
+      }
+    }
+  };
+};
+
+// src/query/core/buildMiddleware/invalidationByTags.ts
+var buildInvalidationByTagsHandler = ({
+  reducerPath,
+  context,
+  context: {
+    endpointDefinitions
+  },
+  mutationThunk,
+  queryThunk,
+  api,
+  assertTagType,
+  refetchQuery,
+  internalState
+}) => {
+  const {
+    removeQueryResult
+  } = api.internalActions;
+  const isThunkActionWithTags = isAnyOf(isFulfilled(mutationThunk), isRejectedWithValue(mutationThunk));
+  const isQueryEnd = isAnyOf(isFulfilled(queryThunk, mutationThunk), isRejected(queryThunk, mutationThunk));
+  let pendingTagInvalidations = [];
+  let pendingRequestCount = 0;
+  const handler = (action, mwApi) => {
+    if (queryThunk.pending.match(action) || mutationThunk.pending.match(action)) {
+      pendingRequestCount++;
+    }
+    if (isQueryEnd(action)) {
+      pendingRequestCount = Math.max(0, pendingRequestCount - 1);
+    }
+    if (isThunkActionWithTags(action)) {
+      invalidateTags(calculateProvidedByThunk(action, "invalidatesTags", endpointDefinitions, assertTagType), mwApi);
+    } else if (isQueryEnd(action)) {
+      invalidateTags([], mwApi);
+    } else if (api.util.invalidateTags.match(action)) {
+      invalidateTags(calculateProvidedBy(action.payload, void 0, void 0, void 0, void 0, assertTagType), mwApi);
+    }
+  };
+  function hasPendingRequests() {
+    return pendingRequestCount > 0;
+  }
+  function invalidateTags(newTags, mwApi) {
+    const rootState = mwApi.getState();
+    const state = rootState[reducerPath];
+    pendingTagInvalidations.push(...newTags);
+    if (state.config.invalidationBehavior === "delayed" && hasPendingRequests()) {
+      return;
+    }
+    const tags = pendingTagInvalidations;
+    pendingTagInvalidations = [];
+    if (tags.length === 0) return;
+    const toInvalidate = api.util.selectInvalidatedBy(rootState, tags);
+    context.batch(() => {
+      const valuesArray = Array.from(toInvalidate.values());
+      for (const {
+        queryCacheKey
+      } of valuesArray) {
+        const querySubState = state.queries[queryCacheKey];
+        const subscriptionSubState = getOrInsertComputed(internalState.currentSubscriptions, queryCacheKey, createNewMap);
+        if (querySubState) {
+          if (subscriptionSubState.size === 0) {
+            mwApi.dispatch(removeQueryResult({
+              queryCacheKey
+            }));
+          } else if (querySubState.status !== STATUS_UNINITIALIZED) {
+            mwApi.dispatch(refetchQuery(querySubState));
+          }
+        }
+      }
+    });
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/polling.ts
+var buildPollingHandler = ({
+  reducerPath,
+  queryThunk,
+  api,
+  refetchQuery,
+  internalState
+}) => {
+  const {
+    currentPolls,
+    currentSubscriptions
+  } = internalState;
+  const pendingPollingUpdates = /* @__PURE__ */ new Set();
+  let pollingUpdateTimer = null;
+  const handler = (action, mwApi) => {
+    if (api.internalActions.updateSubscriptionOptions.match(action) || api.internalActions.unsubscribeQueryResult.match(action)) {
+      schedulePollingUpdate(action.payload.queryCacheKey, mwApi);
+    }
+    if (queryThunk.pending.match(action) || queryThunk.rejected.match(action) && action.meta.condition) {
+      schedulePollingUpdate(action.meta.arg.queryCacheKey, mwApi);
+    }
+    if (queryThunk.fulfilled.match(action) || queryThunk.rejected.match(action) && !action.meta.condition) {
+      startNextPoll(action.meta.arg, mwApi);
+    }
+    if (api.util.resetApiState.match(action)) {
+      clearPolls();
+      if (pollingUpdateTimer) {
+        clearTimeout(pollingUpdateTimer);
+        pollingUpdateTimer = null;
+      }
+      pendingPollingUpdates.clear();
+    }
+  };
+  function schedulePollingUpdate(queryCacheKey, api2) {
+    pendingPollingUpdates.add(queryCacheKey);
+    if (!pollingUpdateTimer) {
+      pollingUpdateTimer = setTimeout(() => {
+        for (const key of pendingPollingUpdates) {
+          updatePollingInterval({
+            queryCacheKey: key
+          }, api2);
+        }
+        pendingPollingUpdates.clear();
+        pollingUpdateTimer = null;
+      }, 0);
+    }
+  }
+  function startNextPoll({
+    queryCacheKey
+  }, api2) {
+    const state = api2.getState()[reducerPath];
+    const querySubState = state.queries[queryCacheKey];
+    const subscriptions = currentSubscriptions.get(queryCacheKey);
+    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) return;
+    const {
+      lowestPollingInterval,
+      skipPollingIfUnfocused
+    } = findLowestPollingInterval(subscriptions);
+    if (!Number.isFinite(lowestPollingInterval)) return;
+    const currentPoll = currentPolls.get(queryCacheKey);
+    if (currentPoll == null ? void 0 : currentPoll.timeout) {
+      clearTimeout(currentPoll.timeout);
+      currentPoll.timeout = void 0;
+    }
+    const nextPollTimestamp = Date.now() + lowestPollingInterval;
+    currentPolls.set(queryCacheKey, {
+      nextPollTimestamp,
+      pollingInterval: lowestPollingInterval,
+      timeout: setTimeout(() => {
+        if (state.config.focused || !skipPollingIfUnfocused) {
+          api2.dispatch(refetchQuery(querySubState));
+        }
+        startNextPoll({
+          queryCacheKey
+        }, api2);
+      }, lowestPollingInterval)
+    });
+  }
+  function updatePollingInterval({
+    queryCacheKey
+  }, api2) {
+    var _a, _b;
+    const state = api2.getState()[reducerPath];
+    const querySubState = state.queries[queryCacheKey];
+    const subscriptions = currentSubscriptions.get(queryCacheKey);
+    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) {
+      return;
+    }
+    const {
+      lowestPollingInterval
+    } = findLowestPollingInterval(subscriptions);
+    if (process.env.NODE_ENV === "test") {
+      const updateCounters = (_a = currentPolls.pollUpdateCounters) != null ? _a : currentPolls.pollUpdateCounters = {};
+      (_b = updateCounters[queryCacheKey]) != null ? _b : updateCounters[queryCacheKey] = 0;
+      updateCounters[queryCacheKey]++;
+    }
+    if (!Number.isFinite(lowestPollingInterval)) {
+      cleanupPollForKey(queryCacheKey);
+      return;
+    }
+    const currentPoll = currentPolls.get(queryCacheKey);
+    const nextPollTimestamp = Date.now() + lowestPollingInterval;
+    if (!currentPoll || nextPollTimestamp < currentPoll.nextPollTimestamp) {
+      startNextPoll({
+        queryCacheKey
+      }, api2);
+    }
+  }
+  function cleanupPollForKey(key) {
+    const existingPoll = currentPolls.get(key);
+    if (existingPoll == null ? void 0 : existingPoll.timeout) {
+      clearTimeout(existingPoll.timeout);
+    }
+    currentPolls.delete(key);
+  }
+  function clearPolls() {
+    for (const key of currentPolls.keys()) {
+      cleanupPollForKey(key);
+    }
+  }
+  function findLowestPollingInterval(subscribers = /* @__PURE__ */ new Map()) {
+    let skipPollingIfUnfocused = false;
+    let lowestPollingInterval = Number.POSITIVE_INFINITY;
+    for (const entry of subscribers.values()) {
+      if (!!entry.pollingInterval) {
+        lowestPollingInterval = Math.min(entry.pollingInterval, lowestPollingInterval);
+        skipPollingIfUnfocused = entry.skipPollingIfUnfocused || skipPollingIfUnfocused;
+      }
+    }
+    return {
+      lowestPollingInterval,
+      skipPollingIfUnfocused
+    };
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/queryLifecycle.ts
+var buildQueryLifecycleHandler = ({
+  api,
+  context,
+  queryThunk,
+  mutationThunk
+}) => {
+  const isPendingThunk = isPending(queryThunk, mutationThunk);
+  const isRejectedThunk = isRejected(queryThunk, mutationThunk);
+  const isFullfilledThunk = isFulfilled(queryThunk, mutationThunk);
+  const lifecycleMap = {};
+  const handler = (action, mwApi) => {
+    var _a, _b, _c;
+    if (isPendingThunk(action)) {
+      const {
+        requestId,
+        arg: {
+          endpointName,
+          originalArgs
+        }
+      } = action.meta;
+      const endpointDefinition = getEndpointDefinition(context, endpointName);
+      const onQueryStarted = endpointDefinition == null ? void 0 : endpointDefinition.onQueryStarted;
+      if (onQueryStarted) {
+        const lifecycle = {};
+        const queryFulfilled = new Promise((resolve, reject) => {
+          lifecycle.resolve = resolve;
+          lifecycle.reject = reject;
+        });
+        queryFulfilled.catch(() => {
+        });
+        lifecycleMap[requestId] = lifecycle;
+        const selector = api.endpoints[endpointName].select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : requestId);
+        const extra = mwApi.dispatch((_, __, extra2) => extra2);
+        const lifecycleApi = __spreadProps(__spreadValues({}, mwApi), {
+          getCacheEntry: () => selector(mwApi.getState()),
+          requestId,
+          extra,
+          updateCachedData: isAnyQueryDefinition(endpointDefinition) ? (updateRecipe) => mwApi.dispatch(api.util.updateQueryData(endpointName, originalArgs, updateRecipe)) : void 0,
+          queryFulfilled
+        });
+        onQueryStarted(originalArgs, lifecycleApi);
+      }
+    } else if (isFullfilledThunk(action)) {
+      const {
+        requestId,
+        baseQueryMeta
+      } = action.meta;
+      (_a = lifecycleMap[requestId]) == null ? void 0 : _a.resolve({
+        data: action.payload,
+        meta: baseQueryMeta
+      });
+      delete lifecycleMap[requestId];
+    } else if (isRejectedThunk(action)) {
+      const {
+        requestId,
+        rejectedWithValue,
+        baseQueryMeta
+      } = action.meta;
+      (_c = lifecycleMap[requestId]) == null ? void 0 : _c.reject({
+        error: (_b = action.payload) != null ? _b : action.error,
+        isUnhandledError: !rejectedWithValue,
+        meta: baseQueryMeta
+      });
+      delete lifecycleMap[requestId];
+    }
+  };
+  return handler;
+};
+
+// src/query/core/buildMiddleware/windowEventHandling.ts
+var buildWindowEventHandler = ({
+  reducerPath,
+  context,
+  api,
+  refetchQuery,
+  internalState
+}) => {
+  const {
+    removeQueryResult
+  } = api.internalActions;
+  const handler = (action, mwApi) => {
+    if (onFocus.match(action)) {
+      refetchValidQueries(mwApi, "refetchOnFocus");
+    }
+    if (onOnline.match(action)) {
+      refetchValidQueries(mwApi, "refetchOnReconnect");
+    }
+  };
+  function refetchValidQueries(api2, type) {
+    const state = api2.getState()[reducerPath];
+    const queries = state.queries;
+    const subscriptions = internalState.currentSubscriptions;
+    context.batch(() => {
+      for (const queryCacheKey of subscriptions.keys()) {
+        const querySubState = queries[queryCacheKey];
+        const subscriptionSubState = subscriptions.get(queryCacheKey);
+        if (!subscriptionSubState || !querySubState) continue;
+        const values = [...subscriptionSubState.values()];
+        const shouldRefetch = values.some((sub) => sub[type] === true) || values.every((sub) => sub[type] === void 0) && state.config[type];
+        if (shouldRefetch) {
+          if (subscriptionSubState.size === 0) {
+            api2.dispatch(removeQueryResult({
+              queryCacheKey
+            }));
+          } else if (querySubState.status !== STATUS_UNINITIALIZED) {
+            api2.dispatch(refetchQuery(querySubState));
+          }
+        }
+      }
+    });
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/index.ts
+function buildMiddleware(input) {
+  const {
+    reducerPath,
+    queryThunk,
+    api,
+    context,
+    getInternalState
+  } = input;
+  const {
+    apiUid
+  } = context;
+  const actions2 = {
+    invalidateTags: createAction(`${reducerPath}/invalidateTags`)
+  };
+  const isThisApiSliceAction = (action) => action.type.startsWith(`${reducerPath}/`);
+  const handlerBuilders = [buildDevCheckHandler, buildCacheCollectionHandler, buildInvalidationByTagsHandler, buildPollingHandler, buildCacheLifecycleHandler, buildQueryLifecycleHandler];
+  const middleware = (mwApi) => {
+    let initialized2 = false;
+    const internalState = getInternalState(mwApi.dispatch);
+    const builderArgs = __spreadProps(__spreadValues({}, input), {
+      internalState,
+      refetchQuery,
+      isThisApiSliceAction,
+      mwApi
+    });
+    const handlers = handlerBuilders.map((build) => build(builderArgs));
+    const batchedActionsHandler = buildBatchedActionsHandler(builderArgs);
+    const windowEventsHandler = buildWindowEventHandler(builderArgs);
+    return (next) => {
+      return (action) => {
+        if (!isAction(action)) {
+          return next(action);
+        }
+        if (!initialized2) {
+          initialized2 = true;
+          mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));
+        }
+        const mwApiWithNext = __spreadProps(__spreadValues({}, mwApi), {
+          next
+        });
+        const stateBefore = mwApi.getState();
+        const [actionShouldContinue, internalProbeResult] = batchedActionsHandler(action, mwApiWithNext, stateBefore);
+        let res;
+        if (actionShouldContinue) {
+          res = next(action);
+        } else {
+          res = internalProbeResult;
+        }
+        if (!!mwApi.getState()[reducerPath]) {
+          windowEventsHandler(action, mwApiWithNext, stateBefore);
+          if (isThisApiSliceAction(action) || context.hasRehydrationInfo(action)) {
+            for (const handler of handlers) {
+              handler(action, mwApiWithNext, stateBefore);
+            }
+          }
+        }
+        return res;
+      };
+    };
+  };
+  return {
+    middleware,
+    actions: actions2
+  };
+  function refetchQuery(querySubState) {
+    return input.api.endpoints[querySubState.endpointName].initiate(querySubState.originalArgs, {
+      subscribe: false,
+      forceRefetch: true
+    });
+  }
+}
+
+// src/query/core/module.ts
+var coreModuleName = /* @__PURE__ */ Symbol();
+var coreModule = ({
+  createSelector: createSelector2 = createSelector
+} = {}) => ({
+  name: coreModuleName,
+  init(api, {
+    baseQuery,
+    tagTypes,
+    reducerPath,
+    serializeQueryArgs,
+    keepUnusedDataFor,
+    refetchOnMountOrArgChange,
+    refetchOnFocus,
+    refetchOnReconnect,
+    invalidationBehavior,
+    onSchemaFailure,
+    catchSchemaFailure,
+    skipSchemaValidation
+  }, context) {
+    enablePatches();
+    assertCast(serializeQueryArgs);
+    const assertTagType = (tag) => {
+      if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
+        if (!tagTypes.includes(tag.type)) {
+          console.error(`Tag type '${tag.type}' was used, but not specified in \`tagTypes\`!`);
+        }
+      }
+      return tag;
+    };
+    Object.assign(api, {
+      reducerPath,
+      endpoints: {},
+      internalActions: {
+        onOnline,
+        onOffline,
+        onFocus,
+        onFocusLost
+      },
+      util: {}
+    });
+    const selectors = buildSelectors({
+      serializeQueryArgs,
+      reducerPath,
+      createSelector: createSelector2
+    });
+    const {
+      selectInvalidatedBy,
+      selectCachedArgsForQuery,
+      buildQuerySelector,
+      buildInfiniteQuerySelector,
+      buildMutationSelector
+    } = selectors;
+    safeAssign(api.util, {
+      selectInvalidatedBy,
+      selectCachedArgsForQuery
+    });
+    const {
+      queryThunk,
+      infiniteQueryThunk,
+      mutationThunk,
+      patchQueryData,
+      updateQueryData,
+      upsertQueryData,
+      prefetch,
+      buildMatchThunkActions
+    } = buildThunks({
+      baseQuery,
+      reducerPath,
+      context,
+      api,
+      serializeQueryArgs,
+      assertTagType,
+      selectors,
+      onSchemaFailure,
+      catchSchemaFailure,
+      skipSchemaValidation
+    });
+    const {
+      reducer,
+      actions: sliceActions
+    } = buildSlice({
+      context,
+      queryThunk,
+      infiniteQueryThunk,
+      mutationThunk,
+      serializeQueryArgs,
+      reducerPath,
+      assertTagType,
+      config: {
+        refetchOnFocus,
+        refetchOnReconnect,
+        refetchOnMountOrArgChange,
+        keepUnusedDataFor,
+        reducerPath,
+        invalidationBehavior
+      }
+    });
+    safeAssign(api.util, {
+      patchQueryData,
+      updateQueryData,
+      upsertQueryData,
+      prefetch,
+      resetApiState: sliceActions.resetApiState,
+      upsertQueryEntries: sliceActions.cacheEntriesUpserted
+    });
+    safeAssign(api.internalActions, sliceActions);
+    const internalStateMap = /* @__PURE__ */ new WeakMap();
+    const getInternalState = (dispatch) => {
+      const state = getOrInsertComputed(internalStateMap, dispatch, () => ({
+        currentSubscriptions: /* @__PURE__ */ new Map(),
+        currentPolls: /* @__PURE__ */ new Map(),
+        runningQueries: /* @__PURE__ */ new Map(),
+        runningMutations: /* @__PURE__ */ new Map()
+      }));
+      return state;
+    };
+    const {
+      buildInitiateQuery,
+      buildInitiateInfiniteQuery,
+      buildInitiateMutation,
+      getRunningMutationThunk,
+      getRunningMutationsThunk,
+      getRunningQueriesThunk,
+      getRunningQueryThunk
+    } = buildInitiate({
+      queryThunk,
+      mutationThunk,
+      infiniteQueryThunk,
+      api,
+      serializeQueryArgs,
+      context,
+      getInternalState
+    });
+    safeAssign(api.util, {
+      getRunningMutationThunk,
+      getRunningMutationsThunk,
+      getRunningQueryThunk,
+      getRunningQueriesThunk
+    });
+    const {
+      middleware,
+      actions: middlewareActions
+    } = buildMiddleware({
+      reducerPath,
+      context,
+      queryThunk,
+      mutationThunk,
+      infiniteQueryThunk,
+      api,
+      assertTagType,
+      selectors,
+      getRunningQueryThunk,
+      getInternalState
+    });
+    safeAssign(api.util, middlewareActions);
+    safeAssign(api, {
+      reducer,
+      middleware
+    });
+    return {
+      name: coreModuleName,
+      injectEndpoint(endpointName, definition) {
+        var _a, _b;
+        const anyApi = api;
+        const endpoint = (_b = (_a = anyApi.endpoints)[endpointName]) != null ? _b : _a[endpointName] = {};
+        if (isQueryDefinition(definition)) {
+          safeAssign(endpoint, {
+            name: endpointName,
+            select: buildQuerySelector(endpointName, definition),
+            initiate: buildInitiateQuery(endpointName, definition)
+          }, buildMatchThunkActions(queryThunk, endpointName));
+        }
+        if (isMutationDefinition(definition)) {
+          safeAssign(endpoint, {
+            name: endpointName,
+            select: buildMutationSelector(),
+            initiate: buildInitiateMutation(endpointName)
+          }, buildMatchThunkActions(mutationThunk, endpointName));
+        }
+        if (isInfiniteQueryDefinition(definition)) {
+          safeAssign(endpoint, {
+            name: endpointName,
+            select: buildInfiniteQuerySelector(endpointName, definition),
+            initiate: buildInitiateInfiniteQuery(endpointName, definition)
+          }, buildMatchThunkActions(queryThunk, endpointName));
+        }
+      }
+    };
+  }
+});
+
+// src/query/core/index.ts
+var createApi = /* @__PURE__ */ buildCreateApi(coreModule());
+export {
+  NamedSchemaError,
+  QueryStatus,
+  _NEVER,
+  buildCreateApi,
+  copyWithStructuralSharing,
+  coreModule,
+  coreModuleName,
+  createApi,
+  defaultSerializeQueryArgs,
+  fakeBaseQuery,
+  fetchBaseQuery,
+  retry,
+  setupListeners,
+  skipToken
+};
+//# sourceMappingURL=rtk-query.legacy-esm.js.map
Index: node_modules/@reduxjs/toolkit/dist/query/rtk-query.legacy-esm.js.map
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/rtk-query.legacy-esm.js.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/rtk-query.legacy-esm.js.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,1 @@
+{"version":3,"sources":["../../src/query/core/apiState.ts","../../src/query/core/rtkImports.ts","../../src/query/utils/copyWithStructuralSharing.ts","../../src/query/utils/filterMap.ts","../../src/query/utils/isAbsoluteUrl.ts","../../src/query/utils/isDocumentVisible.ts","../../src/query/utils/isNotNullish.ts","../../src/query/utils/isOnline.ts","../../src/query/utils/joinUrls.ts","../../src/query/utils/getOrInsert.ts","../../src/query/utils/signals.ts","../../src/query/fetchBaseQuery.ts","../../src/query/HandledError.ts","../../src/query/retry.ts","../../src/query/core/setupListeners.ts","../../src/query/endpointDefinitions.ts","../../src/query/utils/immerImports.ts","../../src/query/core/buildInitiate.ts","../../src/tsHelpers.ts","../../src/query/apiTypes.ts","../../src/query/standardSchema.ts","../../src/query/core/buildThunks.ts","../../src/query/utils/getCurrent.ts","../../src/query/core/buildSlice.ts","../../src/query/core/buildSelectors.ts","../../src/query/createApi.ts","../../src/query/defaultSerializeQueryArgs.ts","../../src/query/fakeBaseQuery.ts","../../src/query/tsHelpers.ts","../../src/query/core/buildMiddleware/batchActions.ts","../../src/query/core/buildMiddleware/cacheCollection.ts","../../src/query/core/buildMiddleware/cacheLifecycle.ts","../../src/query/core/buildMiddleware/devMiddleware.ts","../../src/query/core/buildMiddleware/invalidationByTags.ts","../../src/query/core/buildMiddleware/polling.ts","../../src/query/core/buildMiddleware/queryLifecycle.ts","../../src/query/core/buildMiddleware/windowEventHandling.ts","../../src/query/core/buildMiddleware/index.ts","../../src/query/core/module.ts","../../src/query/core/index.ts"],"sourcesContent":["import type { SerializedError } from '@reduxjs/toolkit';\nimport type { BaseQueryError } from '../baseQueryTypes';\nimport type { BaseEndpointDefinition, EndpointDefinitions, FullTagDescription, InfiniteQueryDefinition, MutationDefinition, PageParamFrom, QueryArgFromAnyQuery, QueryDefinition, ResultTypeFrom } from '../endpointDefinitions';\nimport type { Id, WithRequiredProp } from '../tsHelpers';\nexport type QueryCacheKey = string & {\n  _type: 'queryCacheKey';\n};\nexport type QuerySubstateIdentifier = {\n  queryCacheKey: QueryCacheKey;\n};\nexport type MutationSubstateIdentifier = {\n  requestId: string;\n  fixedCacheKey?: string;\n} | {\n  requestId?: string;\n  fixedCacheKey: string;\n};\nexport type RefetchConfigOptions = {\n  refetchOnMountOrArgChange: boolean | number;\n  refetchOnReconnect: boolean;\n  refetchOnFocus: boolean;\n};\nexport type InfiniteQueryConfigOptions<DataType, PageParam, QueryArg> = {\n  /**\n   * The initial page parameter to use for the first page fetch.\n   */\n  initialPageParam: PageParam;\n  /**\n   * This function is required to automatically get the next cursor for infinite queries.\n   * The result will also be used to determine the value of `hasNextPage`.\n   */\n  getNextPageParam: (lastPage: DataType, allPages: Array<DataType>, lastPageParam: PageParam, allPageParams: Array<PageParam>, queryArg: QueryArg) => PageParam | undefined | null;\n  /**\n   * This function can be set to automatically get the previous cursor for infinite queries.\n   * The result will also be used to determine the value of `hasPreviousPage`.\n   */\n  getPreviousPageParam?: (firstPage: DataType, allPages: Array<DataType>, firstPageParam: PageParam, allPageParams: Array<PageParam>, queryArg: QueryArg) => PageParam | undefined | null;\n  /**\n   * If specified, only keep this many pages in cache at once.\n   * If additional pages are fetched, older pages in the other\n   * direction will be dropped from the cache.\n   */\n  maxPages?: number;\n  /**\n   * Defaults to `true`. When this is `true` and an infinite query endpoint is refetched\n   * (due to tag invalidation, polling, arg change configuration, or manual refetching),\n   * RTK Query will try to sequentially refetch all pages currently in the cache.\n   * When `false` only the first page will be refetched.\n   */\n  refetchCachedPages?: boolean;\n};\nexport type InfiniteData<DataType, PageParam> = {\n  pages: Array<DataType>;\n  pageParams: Array<PageParam>;\n};\n\n// NOTE: DO NOT import and use this for runtime comparisons internally,\n// except in the RTKQ React package. Use the string versions just below this.\n// ESBuild auto-inlines TS enums, which bloats our bundle with many repeated\n// constants like \"initialized\":\n// https://github.com/evanw/esbuild/releases/tag/v0.14.7\n// We still have to use this in the React package since we don't publicly export\n// the string constants below.\n/**\n * Strings describing the query state at any given time.\n */\nexport enum QueryStatus {\n  uninitialized = 'uninitialized',\n  pending = 'pending',\n  fulfilled = 'fulfilled',\n  rejected = 'rejected',\n}\n\n// Use these string constants for runtime comparisons internally\nexport const STATUS_UNINITIALIZED = QueryStatus.uninitialized;\nexport const STATUS_PENDING = QueryStatus.pending;\nexport const STATUS_FULFILLED = QueryStatus.fulfilled;\nexport const STATUS_REJECTED = QueryStatus.rejected;\nexport type RequestStatusFlags = {\n  status: QueryStatus.uninitialized;\n  isUninitialized: true;\n  isLoading: false;\n  isSuccess: false;\n  isError: false;\n} | {\n  status: QueryStatus.pending;\n  isUninitialized: false;\n  isLoading: true;\n  isSuccess: false;\n  isError: false;\n} | {\n  status: QueryStatus.fulfilled;\n  isUninitialized: false;\n  isLoading: false;\n  isSuccess: true;\n  isError: false;\n} | {\n  status: QueryStatus.rejected;\n  isUninitialized: false;\n  isLoading: false;\n  isSuccess: false;\n  isError: true;\n};\nexport function getRequestStatusFlags(status: QueryStatus): RequestStatusFlags {\n  return {\n    status,\n    isUninitialized: status === STATUS_UNINITIALIZED,\n    isLoading: status === STATUS_PENDING,\n    isSuccess: status === STATUS_FULFILLED,\n    isError: status === STATUS_REJECTED\n  } as any;\n}\n\n/**\n * @public\n */\nexport type SubscriptionOptions = {\n  /**\n   * How frequently to automatically re-fetch data (in milliseconds). Defaults to `0` (off).\n   */\n  pollingInterval?: number;\n  /**\n   *  Defaults to 'false'. This setting allows you to control whether RTK Query will continue polling if the window is not focused.\n   *\n   *  If pollingInterval is not set or set to 0, this **will not be evaluated** until pollingInterval is greater than 0.\n   *\n   *  Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  skipPollingIfUnfocused?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after regaining a network connection.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnReconnect?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after the application window regains focus.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnFocus?: boolean;\n};\nexport type SubscribersInternal = Map<string, SubscriptionOptions>;\nexport type Subscribers = {\n  [requestId: string]: SubscriptionOptions;\n};\nexport type QueryKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any> ? K : never }[keyof Definitions];\nexport type InfiniteQueryKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? K : never }[keyof Definitions];\nexport type MutationKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends MutationDefinition<any, any, any, any> ? K : never }[keyof Definitions];\ntype BaseQuerySubState<D extends BaseEndpointDefinition<any, any, any, any>, DataType = ResultTypeFrom<D>> = {\n  /**\n   * The argument originally passed into the hook or `initiate` action call\n   */\n  originalArgs: QueryArgFromAnyQuery<D>;\n  /**\n   * A unique ID associated with the request\n   */\n  requestId: string;\n  /**\n   * The received data from the query\n   */\n  data?: DataType;\n  /**\n   * The received error if applicable\n   */\n  error?: SerializedError | (D extends QueryDefinition<any, infer BaseQuery, any, any> ? BaseQueryError<BaseQuery> : never);\n  /**\n   * The name of the endpoint associated with the query\n   */\n  endpointName: string;\n  /**\n   * Time that the latest query started\n   */\n  startedTimeStamp: number;\n  /**\n   * Time that the latest query was fulfilled\n   */\n  fulfilledTimeStamp?: number;\n};\nexport type QuerySubState<D extends BaseEndpointDefinition<any, any, any, any>, DataType = ResultTypeFrom<D>> = Id<({\n  status: QueryStatus.fulfilled;\n} & WithRequiredProp<BaseQuerySubState<D, DataType>, 'data' | 'fulfilledTimeStamp'> & {\n  error: undefined;\n}) | ({\n  status: QueryStatus.pending;\n} & BaseQuerySubState<D, DataType>) | ({\n  status: QueryStatus.rejected;\n} & WithRequiredProp<BaseQuerySubState<D, DataType>, 'error'>) | {\n  status: QueryStatus.uninitialized;\n  originalArgs?: undefined;\n  data?: undefined;\n  error?: undefined;\n  requestId?: undefined;\n  endpointName?: string;\n  startedTimeStamp?: undefined;\n  fulfilledTimeStamp?: undefined;\n}>;\nexport type InfiniteQueryDirection = 'forward' | 'backward';\nexport type InfiniteQuerySubState<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any> ? QuerySubState<D, InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>> & {\n  direction?: InfiniteQueryDirection;\n} : never;\ntype BaseMutationSubState<D extends BaseEndpointDefinition<any, any, any, any>> = {\n  requestId: string;\n  data?: ResultTypeFrom<D>;\n  error?: SerializedError | (D extends MutationDefinition<any, infer BaseQuery, any, any> ? BaseQueryError<BaseQuery> : never);\n  endpointName: string;\n  startedTimeStamp: number;\n  fulfilledTimeStamp?: number;\n};\nexport type MutationSubState<D extends BaseEndpointDefinition<any, any, any, any>> = (({\n  status: QueryStatus.fulfilled;\n} & WithRequiredProp<BaseMutationSubState<D>, 'data' | 'fulfilledTimeStamp'>) & {\n  error: undefined;\n}) | (({\n  status: QueryStatus.pending;\n} & BaseMutationSubState<D>) & {\n  data?: undefined;\n}) | ({\n  status: QueryStatus.rejected;\n} & WithRequiredProp<BaseMutationSubState<D>, 'error'>) | {\n  requestId?: undefined;\n  status: QueryStatus.uninitialized;\n  data?: undefined;\n  error?: undefined;\n  endpointName?: string;\n  startedTimeStamp?: undefined;\n  fulfilledTimeStamp?: undefined;\n};\nexport type CombinedState<D extends EndpointDefinitions, E extends string, ReducerPath extends string> = {\n  queries: QueryState<D>;\n  mutations: MutationState<D>;\n  provided: InvalidationState<E>;\n  subscriptions: SubscriptionState;\n  config: ConfigState<ReducerPath>;\n};\nexport type InvalidationState<TagTypes extends string> = {\n  tags: { [_ in TagTypes]: {\n    [id: string]: Array<QueryCacheKey>;\n    [id: number]: Array<QueryCacheKey>;\n  } };\n  keys: Record<QueryCacheKey, Array<FullTagDescription<any>>>;\n};\nexport type QueryState<D extends EndpointDefinitions> = {\n  [queryCacheKey: string]: QuerySubState<D[string]> | InfiniteQuerySubState<D[string]> | undefined;\n};\nexport type SubscriptionInternalState = Map<string, SubscribersInternal>;\nexport type SubscriptionState = {\n  [queryCacheKey: string]: Subscribers | undefined;\n};\nexport type ConfigState<ReducerPath> = RefetchConfigOptions & {\n  reducerPath: ReducerPath;\n  online: boolean;\n  focused: boolean;\n  middlewareRegistered: boolean | 'conflict';\n} & ModifiableConfigState;\nexport type ModifiableConfigState = {\n  keepUnusedDataFor: number;\n  invalidationBehavior: 'delayed' | 'immediately';\n} & RefetchConfigOptions;\nexport type MutationState<D extends EndpointDefinitions> = {\n  [requestId: string]: MutationSubState<D[string]> | undefined;\n};\nexport type RootState<Definitions extends EndpointDefinitions, TagTypes extends string, ReducerPath extends string> = { [P in ReducerPath]: CombinedState<Definitions, TagTypes, P> };","// This file exists to consolidate all of the imports from the `@reduxjs/toolkit` package.\n// ESBuild does not de-duplicate imports, so this file is used to ensure that each method\n// imported is only listed once, and there's only one mention of the `@reduxjs/toolkit` package.\n\nexport { createAction, createSlice, createSelector, createAsyncThunk, combineReducers, createNextState, isAnyOf, isAllOf, isAction, isPending, isRejected, isFulfilled, isRejectedWithValue, isAsyncThunkAction, prepareAutoBatched, SHOULD_AUTOBATCH, isPlainObject, nanoid } from '@reduxjs/toolkit';","import { isPlainObject as _iPO } from '../core/rtkImports';\n\n// remove type guard\nconst isPlainObject: (_: any) => boolean = _iPO;\nexport function copyWithStructuralSharing<T>(oldObj: any, newObj: T): T;\nexport function copyWithStructuralSharing(oldObj: any, newObj: any): any {\n  if (oldObj === newObj || !(isPlainObject(oldObj) && isPlainObject(newObj) || Array.isArray(oldObj) && Array.isArray(newObj))) {\n    return newObj;\n  }\n  const newKeys = Object.keys(newObj);\n  const oldKeys = Object.keys(oldObj);\n  let isSameObject = newKeys.length === oldKeys.length;\n  const mergeObj: any = Array.isArray(newObj) ? [] : {};\n  for (const key of newKeys) {\n    mergeObj[key] = copyWithStructuralSharing(oldObj[key], newObj[key]);\n    if (isSameObject) isSameObject = oldObj[key] === mergeObj[key];\n  }\n  return isSameObject ? oldObj : mergeObj;\n}","// Preserve type guard predicate behavior when passing to mapper\nexport function filterMap<T, U, S extends T = T>(array: readonly T[], predicate: (item: T, index: number) => item is S, mapper: (item: S, index: number) => U | U[]): U[];\nexport function filterMap<T, U>(array: readonly T[], predicate: (item: T, index: number) => boolean, mapper: (item: T, index: number) => U | U[]): U[];\nexport function filterMap<T, U>(array: readonly T[], predicate: (item: T, index: number) => boolean, mapper: (item: T, index: number) => U | U[]): U[] {\n  return array.reduce<(U | U[])[]>((acc, item, i) => {\n    if (predicate(item as any, i)) {\n      acc.push(mapper(item as any, i));\n    }\n    return acc;\n  }, []).flat() as U[];\n}","/**\n * If either :// or // is present consider it to be an absolute url\n *\n * @param url string\n */\n\nexport function isAbsoluteUrl(url: string) {\n  return new RegExp(`(^|:)//`).test(url);\n}","/**\n * Assumes true for a non-browser env, otherwise makes a best effort\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState\n */\nexport function isDocumentVisible(): boolean {\n  // `document` may not exist in non-browser envs (like RN)\n  if (typeof document === 'undefined') {\n    return true;\n  }\n  // Match true for visible, prerender, undefined\n  return document.visibilityState !== 'hidden';\n}","export function isNotNullish<T>(v: T | null | undefined): v is T {\n  return v != null;\n}\nexport function filterNullishValues<T>(map?: Map<any, T>) {\n  return [...(map?.values() ?? [])].filter(isNotNullish) as NonNullable<T>[];\n}","/**\n * Assumes a browser is online if `undefined`, otherwise makes a best effort\n * @link https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine\n */\nexport function isOnline() {\n  // We set the default config value in the store, so we'd need to check for this in a SSR env\n  return typeof navigator === 'undefined' ? true : navigator.onLine === undefined ? true : navigator.onLine;\n}","import { isAbsoluteUrl } from './isAbsoluteUrl';\nconst withoutTrailingSlash = (url: string) => url.replace(/\\/$/, '');\nconst withoutLeadingSlash = (url: string) => url.replace(/^\\//, '');\nexport function joinUrls(base: string | undefined, url: string | undefined): string {\n  if (!base) {\n    return url!;\n  }\n  if (!url) {\n    return base;\n  }\n  if (isAbsoluteUrl(url)) {\n    return url;\n  }\n  const delimiter = base.endsWith('/') || !url.startsWith('?') ? '/' : '';\n  base = withoutTrailingSlash(base);\n  url = withoutLeadingSlash(url);\n  return `${base}${delimiter}${url}`;\n}","// Duplicate some of the utils in `/src/utils` to ensure\n// we don't end up dragging in larger chunks of the RTK core\n// into the RTKQ bundle\n\nexport function getOrInsert<K extends object, V>(map: WeakMap<K, V>, key: K, value: V): V;\nexport function getOrInsert<K, V>(map: Map<K, V>, key: K, value: V): V;\nexport function getOrInsert<K extends object, V>(map: Map<K, V> | WeakMap<K, V>, key: K, value: V): V {\n  if (map.has(key)) return map.get(key) as V;\n  return map.set(key, value).get(key) as V;\n}\nexport function getOrInsertComputed<K extends object, V>(map: WeakMap<K, V>, key: K, compute: (key: K) => V): V;\nexport function getOrInsertComputed<K, V>(map: Map<K, V>, key: K, compute: (key: K) => V): V;\nexport function getOrInsertComputed<K extends object, V>(map: Map<K, V> | WeakMap<K, V>, key: K, compute: (key: K) => V): V {\n  if (map.has(key)) return map.get(key) as V;\n  return map.set(key, compute(key)).get(key) as V;\n}\nexport const createNewMap = () => new Map();","// AbortSignal.timeout() is currently baseline 2024\nexport const timeoutSignal = (milliseconds: number) => {\n  const abortController = new AbortController();\n  setTimeout(() => {\n    const message = 'signal timed out';\n    const name = 'TimeoutError';\n    abortController.abort(\n    // some environments (React Native, Node) don't have DOMException\n    typeof DOMException !== 'undefined' ? new DOMException(message, name) : Object.assign(new Error(message), {\n      name\n    }));\n  }, milliseconds);\n  return abortController.signal;\n};\n\n// AbortSignal.any() is currently baseline 2024\nexport const anySignal = (...signals: AbortSignal[]) => {\n  // if any are already aborted, return an already aborted signal\n  for (const signal of signals) if (signal.aborted) return AbortSignal.abort(signal.reason);\n\n  // otherwise, create a new signal that aborts when any of the given signals abort\n  const abortController = new AbortController();\n  for (const signal of signals) {\n    signal.addEventListener('abort', () => abortController.abort(signal.reason), {\n      signal: abortController.signal,\n      once: true\n    });\n  }\n  return abortController.signal;\n};","import { joinUrls } from './utils';\nimport { isPlainObject } from './core/rtkImports';\nimport type { BaseQueryApi, BaseQueryFn } from './baseQueryTypes';\nimport type { MaybePromise, Override } from './tsHelpers';\nimport { anySignal, timeoutSignal } from './utils/signals';\nexport type ResponseHandler = 'content-type' | 'json' | 'text' | ((response: Response) => Promise<any>);\ntype CustomRequestInit = Override<RequestInit, {\n  headers?: Headers | string[][] | Record<string, string | undefined> | undefined;\n}>;\nexport interface FetchArgs extends CustomRequestInit {\n  url: string;\n  params?: Record<string, any>;\n  body?: any;\n  responseHandler?: ResponseHandler;\n  validateStatus?: (response: Response, body: any) => boolean;\n  /**\n   * A number in milliseconds that represents that maximum time a request can take before timing out.\n   */\n  timeout?: number;\n}\n\n/**\n * A mini-wrapper that passes arguments straight through to\n * {@link [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)}.\n * Avoids storing `fetch` in a closure, in order to permit mocking/monkey-patching.\n */\nconst defaultFetchFn: typeof fetch = (...args) => fetch(...args);\nconst defaultValidateStatus = (response: Response) => response.status >= 200 && response.status <= 299;\nconst defaultIsJsonContentType = (headers: Headers) => /*applicat*//ion\\/(vnd\\.api\\+)?json/.test(headers.get('content-type') || '');\nexport type FetchBaseQueryError = {\n  /**\n   * * `number`:\n   *   HTTP status code\n   */\n  status: number;\n  data: unknown;\n} | {\n  /**\n   * * `\"FETCH_ERROR\"`:\n   *   An error that occurred during execution of `fetch` or the `fetchFn` callback option\n   **/\n  status: 'FETCH_ERROR';\n  data?: undefined;\n  error: string;\n} | {\n  /**\n   * * `\"PARSING_ERROR\"`:\n   *   An error happened during parsing.\n   *   Most likely a non-JSON-response was returned with the default `responseHandler` \"JSON\",\n   *   or an error occurred while executing a custom `responseHandler`.\n   **/\n  status: 'PARSING_ERROR';\n  originalStatus: number;\n  data: string;\n  error: string;\n} | {\n  /**\n   * * `\"TIMEOUT_ERROR\"`:\n   *   Request timed out\n   **/\n  status: 'TIMEOUT_ERROR';\n  data?: undefined;\n  error: string;\n} | {\n  /**\n   * * `\"CUSTOM_ERROR\"`:\n   *   A custom error type that you can return from your `queryFn` where another error might not make sense.\n   **/\n  status: 'CUSTOM_ERROR';\n  data?: unknown;\n  error: string;\n};\nfunction stripUndefined(obj: any) {\n  if (!isPlainObject(obj)) {\n    return obj;\n  }\n  const copy: Record<string, any> = {\n    ...obj\n  };\n  for (const [k, v] of Object.entries(copy)) {\n    if (v === undefined) delete copy[k];\n  }\n  return copy;\n}\n\n// Only set the content-type to json if appropriate. Will not be true for FormData, ArrayBuffer, Blob, etc.\nconst isJsonifiable = (body: any) => typeof body === 'object' && (isPlainObject(body) || Array.isArray(body) || typeof body.toJSON === 'function');\nexport type FetchBaseQueryArgs = {\n  baseUrl?: string;\n  prepareHeaders?: (headers: Headers, api: Pick<BaseQueryApi, 'getState' | 'extra' | 'endpoint' | 'type' | 'forced'> & {\n    arg: string | FetchArgs;\n    extraOptions: unknown;\n  }) => MaybePromise<Headers | void>;\n  fetchFn?: (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;\n  paramsSerializer?: (params: Record<string, any>) => string;\n  /**\n   * By default, we only check for 'application/json' and 'application/vnd.api+json' as the content-types for json. If you need to support another format, you can pass\n   * in a predicate function for your given api to get the same automatic stringifying behavior\n   * @example\n   * ```ts\n   * const isJsonContentType = (headers: Headers) => [\"application/vnd.api+json\", \"application/json\", \"application/vnd.hal+json\"].includes(headers.get(\"content-type\")?.trim());\n   * ```\n   */\n  isJsonContentType?: (headers: Headers) => boolean;\n  /**\n   * Defaults to `application/json`;\n   */\n  jsonContentType?: string;\n\n  /**\n   * Custom replacer function used when calling `JSON.stringify()`;\n   */\n  jsonReplacer?: (this: any, key: string, value: any) => any;\n} & RequestInit & Pick<FetchArgs, 'responseHandler' | 'validateStatus' | 'timeout'>;\nexport type FetchBaseQueryMeta = {\n  request: Request;\n  response?: Response;\n};\n\n/**\n * This is a very small wrapper around fetch that aims to simplify requests.\n *\n * @example\n * ```ts\n * const baseQuery = fetchBaseQuery({\n *   baseUrl: 'https://api.your-really-great-app.com/v1/',\n *   prepareHeaders: (headers, { getState }) => {\n *     const token = (getState() as RootState).auth.token;\n *     // If we have a token set in state, let's assume that we should be passing it.\n *     if (token) {\n *       headers.set('authorization', `Bearer ${token}`);\n *     }\n *     return headers;\n *   },\n * })\n * ```\n *\n * @param {string} baseUrl\n * The base URL for an API service.\n * Typically in the format of https://example.com/\n *\n * @param {(headers: Headers, api: { getState: () => unknown; arg: string | FetchArgs; extra: unknown; endpoint: string; type: 'query' | 'mutation'; forced: boolean; }) => Headers} prepareHeaders\n * An optional function that can be used to inject headers on requests.\n * Provides a Headers object, most of the `BaseQueryApi` (`dispatch` is not available), and the arg passed into the query function.\n * Useful for setting authentication or headers that need to be set conditionally.\n *\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Headers\n *\n * @param {(input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>} fetchFn\n * Accepts a custom `fetch` function if you do not want to use the default on the window.\n * Useful in SSR environments if you need to use a library such as `isomorphic-fetch` or `cross-fetch`\n *\n * @param {(params: Record<string, unknown>) => string} paramsSerializer\n * An optional function that can be used to stringify querystring parameters.\n *\n * @param {(headers: Headers) => boolean} isJsonContentType\n * An optional predicate function to determine if `JSON.stringify()` should be called on the `body` arg of `FetchArgs`\n *\n * @param {string} jsonContentType Used when automatically setting the content-type header for a request with a jsonifiable body that does not have an explicit content-type header. Defaults to `application/json`.\n *\n * @param {(this: any, key: string, value: any) => any} jsonReplacer Custom replacer function used when calling `JSON.stringify()`.\n *\n * @param {number} timeout\n * A number in milliseconds that represents the maximum time a request can take before timing out.\n */\n\nexport function fetchBaseQuery({\n  baseUrl,\n  prepareHeaders = x => x,\n  fetchFn = defaultFetchFn,\n  paramsSerializer,\n  isJsonContentType = defaultIsJsonContentType,\n  jsonContentType = 'application/json',\n  jsonReplacer,\n  timeout: defaultTimeout,\n  responseHandler: globalResponseHandler,\n  validateStatus: globalValidateStatus,\n  ...baseFetchOptions\n}: FetchBaseQueryArgs = {}): BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta> {\n  if (typeof fetch === 'undefined' && fetchFn === defaultFetchFn) {\n    console.warn('Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments.');\n  }\n  return async (arg, api, extraOptions) => {\n    const {\n      getState,\n      extra,\n      endpoint,\n      forced,\n      type\n    } = api;\n    let meta: FetchBaseQueryMeta | undefined;\n    let {\n      url,\n      headers = new Headers(baseFetchOptions.headers),\n      params = undefined,\n      responseHandler = globalResponseHandler ?? 'json' as const,\n      validateStatus = globalValidateStatus ?? defaultValidateStatus,\n      timeout = defaultTimeout,\n      ...rest\n    } = typeof arg == 'string' ? {\n      url: arg\n    } : arg;\n    let config: RequestInit = {\n      ...baseFetchOptions,\n      signal: timeout ? anySignal(api.signal, timeoutSignal(timeout)) : api.signal,\n      ...rest\n    };\n    headers = new Headers(stripUndefined(headers));\n    config.headers = (await prepareHeaders(headers, {\n      getState,\n      arg,\n      extra,\n      endpoint,\n      forced,\n      type,\n      extraOptions\n    })) || headers;\n    const bodyIsJsonifiable = isJsonifiable(config.body);\n\n    // Remove content-type for non-jsonifiable bodies to let the browser set it automatically\n    // Exception: keep content-type for string bodies as they might be intentional (text/plain, text/html, etc.)\n    if (config.body != null && !bodyIsJsonifiable && typeof config.body !== 'string') {\n      config.headers.delete('content-type');\n    }\n    if (!config.headers.has('content-type') && bodyIsJsonifiable) {\n      config.headers.set('content-type', jsonContentType);\n    }\n    if (bodyIsJsonifiable && isJsonContentType(config.headers)) {\n      config.body = JSON.stringify(config.body, jsonReplacer);\n    }\n\n    // Set Accept header based on responseHandler if not already set\n    if (!config.headers.has('accept')) {\n      if (responseHandler === 'json') {\n        config.headers.set('accept', 'application/json');\n      } else if (responseHandler === 'text') {\n        config.headers.set('accept', 'text/plain, text/html, */*');\n      }\n      // For 'content-type' responseHandler, don't set Accept (let server decide)\n    }\n    if (params) {\n      const divider = ~url.indexOf('?') ? '&' : '?';\n      const query = paramsSerializer ? paramsSerializer(params) : new URLSearchParams(stripUndefined(params));\n      url += divider + query;\n    }\n    url = joinUrls(baseUrl, url);\n    const request = new Request(url, config);\n    const requestClone = new Request(url, config);\n    meta = {\n      request: requestClone\n    };\n    let response;\n    try {\n      response = await fetchFn(request);\n    } catch (e) {\n      return {\n        error: {\n          status: (e instanceof Error || typeof DOMException !== 'undefined' && e instanceof DOMException) && e.name === 'TimeoutError' ? 'TIMEOUT_ERROR' : 'FETCH_ERROR',\n          error: String(e)\n        },\n        meta\n      };\n    }\n    const responseClone = response.clone();\n    meta.response = responseClone;\n    let resultData: any;\n    let responseText: string = '';\n    try {\n      let handleResponseError;\n      await Promise.all([handleResponse(response, responseHandler).then(r => resultData = r, e => handleResponseError = e),\n      // see https://github.com/node-fetch/node-fetch/issues/665#issuecomment-538995182\n      // we *have* to \"use up\" both streams at the same time or they will stop running in node-fetch scenarios\n      responseClone.text().then(r => responseText = r, () => {})]);\n      if (handleResponseError) throw handleResponseError;\n    } catch (e) {\n      return {\n        error: {\n          status: 'PARSING_ERROR',\n          originalStatus: response.status,\n          data: responseText,\n          error: String(e)\n        },\n        meta\n      };\n    }\n    return validateStatus(response, resultData) ? {\n      data: resultData,\n      meta\n    } : {\n      error: {\n        status: response.status,\n        data: resultData\n      },\n      meta\n    };\n  };\n  async function handleResponse(response: Response, responseHandler: ResponseHandler) {\n    if (typeof responseHandler === 'function') {\n      return responseHandler(response);\n    }\n    if (responseHandler === 'content-type') {\n      responseHandler = isJsonContentType(response.headers) ? 'json' : 'text';\n    }\n    if (responseHandler === 'json') {\n      const text = await response.text();\n      return text.length ? JSON.parse(text) : null;\n    }\n    return response.text();\n  }\n}","export class HandledError {\n  constructor(public readonly value: any, public readonly meta: any = undefined) {}\n}","import type { BaseQueryApi, BaseQueryArg, BaseQueryEnhancer, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta } from './baseQueryTypes';\nimport type { FetchBaseQueryError } from './fetchBaseQuery';\nimport { HandledError } from './HandledError';\n\n/**\n * Exponential backoff based on the attempt number.\n *\n * @remarks\n * 1. 600ms * random(0.4, 1.4)\n * 2. 1200ms * random(0.4, 1.4)\n * 3. 2400ms * random(0.4, 1.4)\n * 4. 4800ms * random(0.4, 1.4)\n * 5. 9600ms * random(0.4, 1.4)\n *\n * @param attempt - Current attempt\n * @param maxRetries - Maximum number of retries\n */\nasync function defaultBackoff(attempt: number = 0, maxRetries: number = 5, signal?: AbortSignal) {\n  const attempts = Math.min(attempt, maxRetries);\n  const timeout = ~~((Math.random() + 0.4) * (300 << attempts)); // Force a positive int in the case we make this an option\n\n  await new Promise<void>((resolve, reject) => {\n    const timeoutId = setTimeout(() => resolve(), timeout);\n\n    // If signal is provided and gets aborted, clear timeout and reject\n    if (signal) {\n      const abortHandler = () => {\n        clearTimeout(timeoutId);\n        reject(new Error('Aborted'));\n      };\n\n      // Check if already aborted\n      if (signal.aborted) {\n        clearTimeout(timeoutId);\n        reject(new Error('Aborted'));\n      } else {\n        signal.addEventListener('abort', abortHandler, {\n          once: true\n        });\n      }\n    }\n  });\n}\ntype RetryConditionFunction = (error: BaseQueryError<BaseQueryFn>, args: BaseQueryArg<BaseQueryFn>, extraArgs: {\n  attempt: number;\n  baseQueryApi: BaseQueryApi;\n  extraOptions: BaseQueryExtraOptions<BaseQueryFn> & RetryOptions;\n}) => boolean;\nexport type RetryOptions = {\n  /**\n   * Function used to determine delay between retries\n   */\n  backoff?: (attempt: number, maxRetries: number, signal?: AbortSignal) => Promise<void>;\n} & ({\n  /**\n   * How many times the query will be retried (default: 5)\n   */\n  maxRetries?: number;\n  retryCondition?: undefined;\n} | {\n  /**\n   * Callback to determine if a retry should be attempted.\n   * Return `true` for another retry and `false` to quit trying prematurely.\n   */\n  retryCondition?: RetryConditionFunction;\n  maxRetries?: undefined;\n});\nfunction fail<BaseQuery extends BaseQueryFn = BaseQueryFn>(error: BaseQueryError<BaseQuery>, meta?: BaseQueryMeta<BaseQuery>): never {\n  throw Object.assign(new HandledError({\n    error,\n    meta\n  }), {\n    throwImmediately: true\n  });\n}\n\n/**\n * Checks if the abort signal is aborted and fails immediately if so.\n * Used to exit retry loops cleanly when a request is aborted.\n */\nfunction failIfAborted(signal: AbortSignal): void {\n  if (signal.aborted) {\n    fail({\n      status: 'CUSTOM_ERROR',\n      error: 'Aborted'\n    });\n  }\n}\nconst EMPTY_OPTIONS = {};\nconst retryWithBackoff: BaseQueryEnhancer<unknown, RetryOptions, RetryOptions | void> = (baseQuery, defaultOptions) => async (args, api, extraOptions) => {\n  // We need to figure out `maxRetries` before we define `defaultRetryCondition.\n  // This is probably goofy, but ought to work.\n  // Put our defaults in one array, filter out undefineds, grab the last value.\n  const possibleMaxRetries: number[] = [5, (defaultOptions as any || EMPTY_OPTIONS).maxRetries, (extraOptions as any || EMPTY_OPTIONS).maxRetries].filter(x => x !== undefined);\n  const [maxRetries] = possibleMaxRetries.slice(-1);\n  const defaultRetryCondition: RetryConditionFunction = (_, __, {\n    attempt\n  }) => attempt <= maxRetries;\n  const options: {\n    maxRetries: number;\n    backoff: typeof defaultBackoff;\n    retryCondition: typeof defaultRetryCondition;\n  } = {\n    maxRetries,\n    backoff: defaultBackoff,\n    retryCondition: defaultRetryCondition,\n    ...defaultOptions,\n    ...extraOptions\n  };\n  let retry = 0;\n  while (true) {\n    // Check if aborted before each attempt\n    failIfAborted(api.signal);\n    try {\n      const result = await baseQuery(args, api, extraOptions);\n      // baseQueries _should_ return an error property, so we should check for that and throw it to continue retrying\n      if (result.error) {\n        throw new HandledError(result);\n      }\n      return result;\n    } catch (e: any) {\n      retry++;\n      if (e.throwImmediately) {\n        if (e instanceof HandledError) {\n          return e.value;\n        }\n\n        // We don't know what this is, so we have to rethrow it\n        throw e;\n      }\n      if (e instanceof HandledError) {\n        if (!options.retryCondition(e.value.error as FetchBaseQueryError, args, {\n          attempt: retry,\n          baseQueryApi: api,\n          extraOptions\n        })) {\n          return e.value; // Max retries for expected error\n        }\n      } else {\n        // For unexpected errors, respect maxRetries\n        if (retry > options.maxRetries) {\n          // Return the error as a proper error response instead of throwing\n          return {\n            error: e\n          };\n        }\n      }\n\n      // Check if aborted before backoff\n      failIfAborted(api.signal);\n      try {\n        await options.backoff(retry, options.maxRetries, api.signal);\n      } catch (backoffError) {\n        // If backoff was aborted, exit the retry loop\n        failIfAborted(api.signal);\n        // Otherwise, rethrow the backoff error\n        throw backoffError;\n      }\n    }\n  }\n};\n\n/**\n * A utility that can wrap `baseQuery` in the API definition to provide retries with a basic exponential backoff.\n *\n * @example\n *\n * ```ts\n * // codeblock-meta title=\"Retry every request 5 times by default\"\n * import { createApi, fetchBaseQuery, retry } from '@reduxjs/toolkit/query/react'\n * interface Post {\n *   id: number\n *   name: string\n * }\n * type PostsResponse = Post[]\n *\n * // maxRetries: 5 is the default, and can be omitted. Shown for documentation purposes.\n * const staggeredBaseQuery = retry(fetchBaseQuery({ baseUrl: '/' }), { maxRetries: 5 });\n * export const api = createApi({\n *   baseQuery: staggeredBaseQuery,\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsResponse, void>({\n *       query: () => ({ url: 'posts' }),\n *     }),\n *     getPost: build.query<PostsResponse, string>({\n *       query: (id) => ({ url: `post/${id}` }),\n *       extraOptions: { maxRetries: 8 }, // You can override the retry behavior on each endpoint\n *     }),\n *   }),\n * });\n *\n * export const { useGetPostsQuery, useGetPostQuery } = api;\n * ```\n */\nexport const retry = /* @__PURE__ */Object.assign(retryWithBackoff, {\n  fail\n});","import type { ThunkDispatch, ActionCreatorWithoutPayload // Workaround for API-Extractor\n} from '@reduxjs/toolkit';\nimport { createAction } from './rtkImports';\nexport const INTERNAL_PREFIX = '__rtkq/';\nconst ONLINE = 'online';\nconst OFFLINE = 'offline';\nconst FOCUS = 'focus';\nconst FOCUSED = 'focused';\nconst VISIBILITYCHANGE = 'visibilitychange';\nexport const onFocus = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${FOCUSED}`);\nexport const onFocusLost = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}un${FOCUSED}`);\nexport const onOnline = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${ONLINE}`);\nexport const onOffline = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${OFFLINE}`);\nconst actions = {\n  onFocus,\n  onFocusLost,\n  onOnline,\n  onOffline\n};\nlet initialized = false;\n\n/**\n * A utility used to enable `refetchOnMount` and `refetchOnReconnect` behaviors.\n * It requires the dispatch method from your store.\n * Calling `setupListeners(store.dispatch)` will configure listeners with the recommended defaults,\n * but you have the option of providing a callback for more granular control.\n *\n * @example\n * ```ts\n * setupListeners(store.dispatch)\n * ```\n *\n * @param dispatch - The dispatch method from your store\n * @param customHandler - An optional callback for more granular control over listener behavior\n * @returns Return value of the handler.\n * The default handler returns an `unsubscribe` method that can be called to remove the listeners.\n */\nexport function setupListeners(dispatch: ThunkDispatch<any, any, any>, customHandler?: (dispatch: ThunkDispatch<any, any, any>, actions: {\n  onFocus: typeof onFocus;\n  onFocusLost: typeof onFocusLost;\n  onOnline: typeof onOnline;\n  onOffline: typeof onOffline;\n}) => () => void) {\n  function defaultHandler() {\n    const [handleFocus, handleFocusLost, handleOnline, handleOffline] = [onFocus, onFocusLost, onOnline, onOffline].map(action => () => dispatch(action()));\n    const handleVisibilityChange = () => {\n      if (window.document.visibilityState === 'visible') {\n        handleFocus();\n      } else {\n        handleFocusLost();\n      }\n    };\n    let unsubscribe = () => {\n      initialized = false;\n    };\n    if (!initialized) {\n      if (typeof window !== 'undefined' && window.addEventListener) {\n        const handlers = {\n          [FOCUS]: handleFocus,\n          [VISIBILITYCHANGE]: handleVisibilityChange,\n          [ONLINE]: handleOnline,\n          [OFFLINE]: handleOffline\n        };\n        function updateListeners(add: boolean) {\n          Object.entries(handlers).forEach(([event, handler]) => {\n            if (add) {\n              window.addEventListener(event, handler, false);\n            } else {\n              window.removeEventListener(event, handler);\n            }\n          });\n        }\n        // Handle focus events\n        updateListeners(true);\n        initialized = true;\n        unsubscribe = () => {\n          updateListeners(false);\n          initialized = false;\n        };\n      }\n    }\n    return unsubscribe;\n  }\n  return customHandler ? customHandler(dispatch, actions) : defaultHandler();\n}","import type { Api } from '@reduxjs/toolkit/query';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { BaseQueryApi, BaseQueryArg, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta, BaseQueryResult, QueryReturnValue } from './baseQueryTypes';\nimport type { CacheCollectionQueryExtraOptions } from './core/buildMiddleware/cacheCollection';\nimport type { CacheLifecycleInfiniteQueryExtraOptions, CacheLifecycleMutationExtraOptions, CacheLifecycleQueryExtraOptions } from './core/buildMiddleware/cacheLifecycle';\nimport type { QueryLifecycleInfiniteQueryExtraOptions, QueryLifecycleMutationExtraOptions, QueryLifecycleQueryExtraOptions } from './core/buildMiddleware/queryLifecycle';\nimport type { InfiniteData, InfiniteQueryConfigOptions, QuerySubState, RootState } from './core/index';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { NEVER } from './fakeBaseQuery';\nimport type { CastAny, HasRequiredProps, MaybePromise, NonUndefined, OmitFromUnion, UnwrapPromise } from './tsHelpers';\nimport { isNotNullish } from './utils';\nimport type { NamedSchemaError } from './standardSchema';\nimport { filterMap } from './utils/filterMap';\nconst rawResultType = /* @__PURE__ */Symbol();\nconst resultType = /* @__PURE__ */Symbol();\nconst baseQuery = /* @__PURE__ */Symbol();\nexport interface SchemaFailureInfo {\n  endpoint: string;\n  arg: any;\n  type: 'query' | 'mutation';\n  queryCacheKey?: string;\n}\nexport type SchemaFailureHandler = (error: NamedSchemaError, info: SchemaFailureInfo) => void;\nexport type SchemaFailureConverter<BaseQuery extends BaseQueryFn> = (error: NamedSchemaError, info: SchemaFailureInfo) => BaseQueryError<BaseQuery>;\nexport type EndpointDefinitionWithQuery<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery>> = {\n  /**\n   * `query` can be a function that returns either a `string` or an `object` which is passed to your `baseQuery`. If you are using [fetchBaseQuery](./fetchBaseQuery), this can return either a `string` or an `object` of properties in `FetchArgs`. If you use your own custom [`baseQuery`](../../rtk-query/usage/customizing-queries), you can customize this behavior to your liking.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"query example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       // highlight-start\n   *       query: () => 'posts',\n   *       // highlight-end\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *      // highlight-start\n   *      query: (body) => ({\n   *        url: `posts`,\n   *        method: 'POST',\n   *        body,\n   *      }),\n   *      // highlight-end\n   *      invalidatesTags: [{ type: 'Post', id: 'LIST' }],\n   *    }),\n   *   })\n   * })\n   * ```\n   */\n  query(arg: QueryArg): BaseQueryArg<BaseQuery>;\n  queryFn?: never;\n  /**\n   * A function to manipulate the data returned by a query or mutation.\n   */\n  transformResponse?(baseQueryReturnValue: RawResultType, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): ResultType | Promise<ResultType>;\n  /**\n   * A function to manipulate the data returned by a failed query or mutation.\n   */\n  transformErrorResponse?(baseQueryReturnValue: BaseQueryError<BaseQuery>, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): unknown;\n\n  /**\n   * A schema for the result *before* it's passed to `transformResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPostName: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawResponseSchema: postSchema,\n   *       transformResponse: (post) => post.name,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawResponseSchema?: StandardSchemaV1<RawResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn`, *before* it's passed to `transformErrorResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import {customBaseQuery, baseQueryErrorSchema} from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawErrorResponseSchema: baseQueryErrorSchema,\n   *       transformErrorResponse: (error) => error.data,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawErrorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n};\nexport type EndpointDefinitionWithQueryFn<QueryArg, BaseQuery extends BaseQueryFn, ResultType> = {\n  /**\n   * Can be used in place of `query` as an inline function that bypasses `baseQuery` completely for the endpoint.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Basic queryFn example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *     }),\n   *     flipCoin: build.query<'heads' | 'tails', void>({\n   *       // highlight-start\n   *       queryFn(arg, queryApi, extraOptions, baseQuery) {\n   *         const randomVal = Math.random()\n   *         if (randomVal < 0.45) {\n   *           return { data: 'heads' }\n   *         }\n   *         if (randomVal < 0.9) {\n   *           return { data: 'tails' }\n   *         }\n   *         return { error: { status: 500, statusText: 'Internal Server Error', data: \"Coin landed on its edge!\" } }\n   *       }\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  queryFn(arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions<BaseQuery>, baseQuery: (arg: Parameters<BaseQuery>[0]) => ReturnType<BaseQuery>): MaybePromise<QueryReturnValue<ResultType, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>>;\n  query?: never;\n  transformResponse?: never;\n  transformErrorResponse?: never;\n  rawResponseSchema?: never;\n  rawErrorResponseSchema?: never;\n};\ntype BaseEndpointTypes<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType> = {\n  QueryArg: QueryArg;\n  BaseQuery: BaseQuery;\n  ResultType: ResultType;\n  RawResultType: RawResultType;\n};\nexport type SchemaType = 'arg' | 'rawResponse' | 'response' | 'rawErrorResponse' | 'errorResponse' | 'meta';\ninterface CommonEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType> {\n  /**\n   * A schema for the arguments to be passed to the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       argSchema: v.object({ id: v.number() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  argSchema?: StandardSchemaV1<QueryArg>;\n\n  /**\n   * A schema for the result (including `transformResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: postSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  responseSchema?: StandardSchemaV1<ResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn` (including `transformErrorResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryErrorSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       errorResponseSchema: baseQueryErrorSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  errorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n\n  /**\n   * A schema for the `meta` property returned by the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryMetaSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       metaSchema: baseQueryMetaSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  metaSchema?: StandardSchemaV1<BaseQueryMeta<BaseQuery>>;\n\n  /**\n   * Defaults to `true`.\n   *\n   * Most apps should leave this setting on. The only time it can be a performance issue\n   * is if an API returns extremely large amounts of data (e.g. 10,000 rows per request) and\n   * you're unable to paginate it.\n   *\n   * For details of how this works, please see the below. When it is set to `false`,\n   * every request will cause subscribed components to rerender, even when the data has not changed.\n   *\n   * @see https://redux-toolkit.js.org/api/other-exports#copywithstructuralsharing\n   */\n  structuralSharing?: boolean;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       onSchemaFailure: (error, info) => {\n   *         console.error(error, info)\n   *       },\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       catchSchemaFailure: (error, info) => ({\n   *         status: \"CUSTOM_ERROR\",\n   *         error: error.schemaName + \" failed validation\",\n   *         data: error.issues,\n   *       }),\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for this endpoint.\n   * Overrides the global setting.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type BaseEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = (([CastAny<BaseQueryResult<BaseQuery>, {}>] extends [NEVER] ? never : EndpointDefinitionWithQuery<QueryArg, BaseQuery, ResultType, RawResultType>) | EndpointDefinitionWithQueryFn<QueryArg, BaseQuery, ResultType>) & CommonEndpointDefinition<QueryArg, BaseQuery, ResultType> & {\n  /* phantom type */\n  [rawResultType]?: RawResultType;\n  /* phantom type */\n  [resultType]?: ResultType;\n  /* phantom type */\n  [baseQuery]?: BaseQuery;\n} & HasRequiredProps<BaseQueryExtraOptions<BaseQuery>, {\n  extraOptions: BaseQueryExtraOptions<BaseQuery>;\n}, {\n  extraOptions?: BaseQueryExtraOptions<BaseQuery>;\n}>;\n\n// NOTE As with QueryStatus in `apiState.ts`, don't use this for real comparisons\n// at runtime, use the string constants defined below.\nexport enum DefinitionType {\n  query = 'query',\n  mutation = 'mutation',\n  infinitequery = 'infinitequery',\n}\nexport const ENDPOINT_QUERY = DefinitionType.query;\nexport const ENDPOINT_MUTATION = DefinitionType.mutation;\nexport const ENDPOINT_INFINITEQUERY = DefinitionType.infinitequery;\ntype TagDescriptionArray<TagTypes extends string> = ReadonlyArray<TagDescription<TagTypes> | undefined | null>;\nexport type GetResultDescriptionFn<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = (result: ResultType | undefined, error: ErrorType | undefined, arg: QueryArg, meta: MetaType) => TagDescriptionArray<TagTypes>;\nexport type FullTagDescription<TagType> = {\n  type: TagType;\n  id?: number | string;\n};\nexport type TagDescription<TagType> = TagType | FullTagDescription<TagType>;\n\n/**\n * @public\n */\nexport type ResultDescription<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = TagDescriptionArray<TagTypes> | GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>;\ntype QueryTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  QueryDefinition: QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface QueryExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.query;\n\n  /**\n   * Used by `query` endpoints. Determines which 'tag' is attached to the cached data returned by the query.\n   * Expects an array of tag type strings, an array of objects of tag types with ids, or a function that returns such an array.\n   * 1.  `['Post']` - equivalent to `2`\n   * 2.  `[{ type: 'Post' }]` - equivalent to `1`\n   * 3.  `[{ type: 'Post', id: 1 }]`\n   * 4.  `(result, error, arg) => ['Post']` - equivalent to `5`\n   * 5.  `(result, error, arg) => [{ type: 'Post' }]` - equivalent to `4`\n   * 6.  `(result, error, arg) => [{ type: 'Post', id: 1 }]`\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"providesTags example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       // highlight-start\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  providesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * Can be provided to merge an incoming response value into the current cache data.\n   * If supplied, no automatic structural sharing will be applied - it's up to\n   * you to update the cache appropriately.\n   *\n   * Since RTKQ normally replaces cache entries with the new response, you will usually\n   * need to use this with the `serializeQueryArgs` or `forceRefetch` options to keep\n   * an existing cache entry so that it can be updated.\n   *\n   * Since this is wrapped with Immer, you may either mutate the `currentCacheValue` directly,\n   * or return a new value, but _not_ both at once.\n   *\n   * Will only be called if the existing `currentCacheData` is _not_ `undefined` - on first response,\n   * the cache entry will just save the response data directly.\n   *\n   * Useful if you don't want a new request to completely override the current cache value,\n   * maybe because you have manually updated it from another source and don't want those\n   * updates to get lost.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"merge: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  merge?(currentCacheData: ResultType, responseData: ResultType, otherArgs: {\n    arg: QueryArg;\n    baseQueryMeta: BaseQueryMeta<BaseQuery>;\n    requestId: string;\n    fulfilledTimeStamp: number;\n  }): ResultType | void;\n\n  /**\n   * Check to see if the endpoint should force a refetch in cases where it normally wouldn't.\n   * This is primarily useful for \"infinite scroll\" / pagination use cases where\n   * RTKQ is keeping a single cache entry that is added to over time, in combination\n   * with `serializeQueryArgs` returning a fixed cache key and a `merge` callback\n   * set to add incoming data to the cache entry each time.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"forceRefresh: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  forceRefetch?(params: {\n    currentArg: QueryArg | undefined;\n    previousArg: QueryArg | undefined;\n    state: RootState<any, any, string>;\n    endpointState?: QuerySubState<any>;\n  }): boolean;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: QueryTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type QueryDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & QueryExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type InfiniteQueryTypes<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  InfiniteQueryDefinition: InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\nexport interface InfiniteQueryExtraOptions<TagTypes extends string, ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.infinitequery;\n  providesTags?: ResultDescription<TagTypes, InfiniteData<ResultType, PageParam>, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Required options to configure the infinite query behavior.\n   * `initialPageParam` and `getNextPageParam` are required, to\n   * ensure the infinite query can properly fetch the next page of data.\n   * `initialPageParam` may be specified when using the\n   * endpoint, to override the default value.\n   * `maxPages` and `getPreviousPageParam` are both optional.\n   * \n   * @example\n   * \n   * ```ts\n   * // codeblock-meta title=\"infiniteQueryOptions example\"\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * \n   * type Pokemon = {\n   *   id: string\n   *   name: string\n   * }\n   * \n   * const pokemonApi = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),\n   *   endpoints: (build) => ({\n   *     getInfinitePokemonWithMax: build.infiniteQuery<Pokemon[], string, number>({\n   *       infiniteQueryOptions: {\n   *         initialPageParam: 0,\n   *         maxPages: 3,\n   *         getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) =>\n   *           lastPageParam + 1,\n   *         getPreviousPageParam: (\n   *           firstPage,\n   *           allPages,\n   *           firstPageParam,\n   *           allPageParams,\n   *         ) => {\n   *           return firstPageParam > 0 ? firstPageParam - 1 : undefined\n   *         },\n   *       },\n   *       query({pageParam}) {\n   *         return `https://example.com/listItems?page=${pageParam}`\n   *       },\n   *     }),\n   *   }),\n   * })\n   \n   * ```\n   */\n  infiniteQueryOptions: InfiniteQueryConfigOptions<ResultType, PageParam, QueryArg>;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: InfiniteQueryTypes<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> =\n// Infinite query endpoints receive `{queryArg, pageParam}`\nBaseEndpointDefinition<InfiniteQueryCombinedArg<QueryArg, PageParam>, BaseQuery, ResultType, RawResultType> & InfiniteQueryExtraOptions<TagTypes, ResultType, QueryArg, PageParam, BaseQuery, ReducerPath, RawResultType>;\ntype MutationTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseMutation<typeof api.endpoints.query.Types.MutationDefinition> = ...\n   * ```\n   */\n  MutationDefinition: MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface MutationExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath> {\n  type: DefinitionType.mutation;\n\n  /**\n   * Used by `mutation` endpoints. Determines which cached data should be either re-fetched or removed from the cache.\n   * Expects the same shapes as `providesTags`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"invalidatesTags example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *       query(body) {\n   *         return {\n   *           url: `posts`,\n   *           method: 'POST',\n   *           body,\n   *         }\n   *       },\n   *       // highlight-start\n   *       invalidatesTags: [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  invalidatesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A mutation should not provide tags to the cache.\n   */\n  providesTags?: never;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: MutationTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type MutationDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & MutationExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type EndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, PageParam = any, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\nexport type EndpointDefinitions = Record<string, EndpointDefinition<any, any, any, any, any, any, any>>;\nexport function isQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is QueryDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_QUERY;\n}\nexport function isMutationDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is MutationDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_MUTATION;\n}\nexport function isInfiniteQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is InfiniteQueryDefinition<any, any, any, any, any, any, any> {\n  return e.type === ENDPOINT_INFINITEQUERY;\n}\nexport function isAnyQueryDefinition(e: EndpointDefinition<any, any, any, any>): e is QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any> {\n  return isQueryDefinition(e) || isInfiniteQueryDefinition(e);\n}\nexport type EndpointBuilder<BaseQuery extends BaseQueryFn, TagTypes extends string, ReducerPath extends string> = {\n  /**\n   * An endpoint definition that retrieves data, and may provide tags to the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all query endpoint options\"\n   * const api = createApi({\n   *  baseQuery,\n   *  endpoints: (build) => ({\n   *    getPost: build.query({\n   *      query: (id) => ({ url: `post/${id}` }),\n   *      // Pick out data and prevent nested properties in a hook or selector\n   *      transformResponse: (response) => response.data,\n   *      // Pick out error and prevent nested properties in a hook or selector\n   *      transformErrorResponse: (response) => response.error,\n   *      // `result` is the server response\n   *      providesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry, updateCachedData }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry, updateCachedData }) {},\n   *    }),\n   *  }),\n   *});\n   *```\n   */\n  query<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n\n  /**\n   * An endpoint definition that alters data on the server or will possibly invalidate the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all mutation endpoint options\"\n   * const api = createApi({\n   *   baseQuery,\n   *   endpoints: (build) => ({\n   *     updatePost: build.mutation({\n   *       query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),\n   *       // Pick out data and prevent nested properties in a hook or selector\n   *       transformResponse: (response) => response.data,\n   *       // Pick out error and prevent nested properties in a hook or selector\n   *       transformErrorResponse: (response) => response.error,\n   *       // `result` is the server response\n   *       invalidatesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry }) {},\n   *     }),\n   *   }),\n   * });\n   * ```\n   */\n  mutation<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n  infiniteQuery<ResultType, QueryArg, PageParam, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n};\nexport type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T;\nexport function calculateProvidedBy<ResultType, QueryArg, ErrorType, MetaType>(description: ResultDescription<string, ResultType, QueryArg, ErrorType, MetaType> | undefined, result: ResultType | undefined, error: ErrorType | undefined, queryArg: QueryArg, meta: MetaType | undefined, assertTagTypes: AssertTagTypes): readonly FullTagDescription<string>[] {\n  const finalDescription = isFunction(description) ? description(result as ResultType, error as undefined, queryArg, meta as MetaType) : description;\n  if (finalDescription) {\n    return filterMap(finalDescription, isNotNullish, tag => assertTagTypes(expandTagDescription(tag)));\n  }\n  return [];\n}\nfunction isFunction<T>(t: T): t is Extract<T, Function> {\n  return typeof t === 'function';\n}\nexport function expandTagDescription(description: TagDescription<string>): FullTagDescription<string> {\n  return typeof description === 'string' ? {\n    type: description\n  } : description;\n}\nexport type QueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<infer QA, any, any, any> ? QA : never;\n\n// Just extracting `QueryArg` from `BaseEndpointDefinition`\n// doesn't sufficiently match here.\n// We need to explicitly match against `InfiniteQueryDefinition`\nexport type InfiniteQueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<infer QA, any, any, any, any, any, any> ? QA : never;\nexport type QueryArgFromAnyQuery<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any, any, any> ? InfiniteQueryArgFrom<D> : D extends QueryDefinition<any, any, any, any, any, any> ? QueryArgFrom<D> : never;\nexport type ResultTypeFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<any, any, infer RT, any> ? RT : unknown;\nexport type ReducerPathFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, any, any, infer RP, any, any> ? RP : unknown;\nexport type TagTypesFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, infer TT, any, any, any, any> ? TT : unknown;\nexport type PageParamFrom<D extends InfiniteQueryDefinition<any, any, any, any, any, any, any>> = D extends InfiniteQueryDefinition<any, infer PP, any, any, any, any, any> ? PP : unknown;\nexport type InfiniteQueryCombinedArg<QueryArg, PageParam> = {\n  queryArg: QueryArg;\n  pageParam: PageParam;\n};\nexport type TagTypesFromApi<T> = T extends Api<any, any, any, infer TagTypes> ? TagTypes : never;\nexport type DefinitionsFromApi<T> = T extends Api<any, infer Definitions, any, any> ? Definitions : never;\nexport type TransformedResponse<NewDefinitions extends EndpointDefinitions, K, ResultType> = K extends keyof NewDefinitions ? NewDefinitions[K]['transformResponse'] extends undefined ? ResultType : UnwrapPromise<ReturnType<NonUndefined<NewDefinitions[K]['transformResponse']>>> : ResultType;\nexport type OverrideResultType<Definition, NewResultType> = Definition extends QueryDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends MutationDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, NewResultType, ReducerPath> : never;\nexport type UpdateDefinitions<Definitions extends EndpointDefinitions, NewTagTypes extends string, NewDefinitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends MutationDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : never };","export { current, isDraft, applyPatches, original, isDraftable, produceWithPatches, enablePatches } from 'immer';","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { AsyncThunkAction, SafePromise, SerializedError, ThunkAction, UnknownAction } from '@reduxjs/toolkit';\nimport type { Dispatch } from 'redux';\nimport { asSafePromise } from '../../tsHelpers';\nimport { getEndpointDefinition, type Api, type ApiContext } from '../apiTypes';\nimport type { BaseQueryError, QueryReturnValue } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport { ENDPOINT_QUERY, isQueryDefinition, type EndpointDefinition, type EndpointDefinitions, type InfiniteQueryArgFrom, type InfiniteQueryDefinition, type MutationDefinition, type PageParamFrom, type QueryArgFrom, type QueryDefinition, type ResultTypeFrom } from '../endpointDefinitions';\nimport { filterNullishValues } from '../utils';\nimport type { InfiniteData, InfiniteQueryConfigOptions, InfiniteQueryDirection, SubscriptionOptions } from './apiState';\nimport type { InfiniteQueryResultSelectorResult, QueryResultSelectorResult } from './buildSelectors';\nimport type { InfiniteQueryThunk, InfiniteQueryThunkArg, MutationThunk, QueryThunk, QueryThunkArg, ThunkApiMetaConfig } from './buildThunks';\nimport type { ApiEndpointQuery } from './module';\nimport type { InternalMiddlewareState } from './buildMiddleware/types';\nexport type BuildInitiateApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>> = {\n  initiate: StartQueryActionCreator<Definition>;\n};\nexport type BuildInitiateApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  initiate: StartInfiniteQueryActionCreator<Definition>;\n};\nexport type BuildInitiateApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>> = {\n  initiate: StartMutationActionCreator<Definition>;\n};\nexport const forceQueryFnSymbol = Symbol('forceQueryFn');\nexport const isUpsertQuery = (arg: QueryThunkArg) => typeof arg[forceQueryFnSymbol] === 'function';\nexport type StartQueryActionCreatorOptions = {\n  subscribe?: boolean;\n  forceRefetch?: boolean | number;\n  subscriptionOptions?: SubscriptionOptions;\n  [forceQueryFnSymbol]?: () => QueryReturnValue;\n};\ntype RefetchOptions = {\n  refetchCachedPages?: boolean;\n};\nexport type StartInfiniteQueryActionCreatorOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>> = StartQueryActionCreatorOptions & {\n  direction?: InfiniteQueryDirection;\n  param?: unknown;\n} & Partial<Pick<Partial<InfiniteQueryConfigOptions<ResultTypeFrom<D>, PageParamFrom<D>, InfiniteQueryArgFrom<D>>>, 'initialPageParam' | 'refetchCachedPages'>>;\ntype AnyQueryActionCreator<D extends EndpointDefinition<any, any, any, any>> = (arg: any, options?: StartQueryActionCreatorOptions) => ThunkAction<AnyActionCreatorResult, any, any, UnknownAction>;\ntype StartQueryActionCreator<D extends QueryDefinition<any, any, any, any, any>> = (arg: QueryArgFrom<D>, options?: StartQueryActionCreatorOptions) => ThunkAction<QueryActionCreatorResult<D>, any, any, UnknownAction>;\nexport type StartInfiniteQueryActionCreator<D extends InfiniteQueryDefinition<any, any, any, any, any>> = (arg: InfiniteQueryArgFrom<D>, options?: StartInfiniteQueryActionCreatorOptions<D>) => ThunkAction<InfiniteQueryActionCreatorResult<D>, any, any, UnknownAction>;\ntype QueryActionCreatorFields = {\n  requestId: string;\n  subscriptionOptions: SubscriptionOptions | undefined;\n  abort(): void;\n  unsubscribe(): void;\n  updateSubscriptionOptions(options: SubscriptionOptions): void;\n  queryCacheKey: string;\n};\ntype AnyActionCreatorResult = SafePromise<any> & QueryActionCreatorFields & {\n  arg: any;\n  unwrap(): Promise<any>;\n  refetch(options?: RefetchOptions): AnyActionCreatorResult;\n};\nexport type QueryActionCreatorResult<D extends QueryDefinition<any, any, any, any>> = SafePromise<QueryResultSelectorResult<D>> & QueryActionCreatorFields & {\n  arg: QueryArgFrom<D>;\n  unwrap(): Promise<ResultTypeFrom<D>>;\n  refetch(): QueryActionCreatorResult<D>;\n};\nexport type InfiniteQueryActionCreatorResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = SafePromise<InfiniteQueryResultSelectorResult<D>> & QueryActionCreatorFields & {\n  arg: InfiniteQueryArgFrom<D>;\n  unwrap(): Promise<InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>>;\n  refetch(options?: Pick<StartInfiniteQueryActionCreatorOptions<D>, 'refetchCachedPages'>): InfiniteQueryActionCreatorResult<D>;\n};\ntype StartMutationActionCreator<D extends MutationDefinition<any, any, any, any>> = (arg: QueryArgFrom<D>, options?: {\n  /**\n   * If this mutation should be tracked in the store.\n   * If you just want to manually trigger this mutation using `dispatch` and don't care about the\n   * result, state & potential errors being held in store, you can set this to false.\n   * (defaults to `true`)\n   */\n  track?: boolean;\n  fixedCacheKey?: string;\n}) => ThunkAction<MutationActionCreatorResult<D>, any, any, UnknownAction>;\nexport type MutationActionCreatorResult<D extends MutationDefinition<any, any, any, any>> = SafePromise<{\n  data: ResultTypeFrom<D>;\n  error?: undefined;\n} | {\n  data?: undefined;\n  error: Exclude<BaseQueryError<D extends MutationDefinition<any, infer BaseQuery, any, any> ? BaseQuery : never>, undefined> | SerializedError;\n}> & {\n  /** @internal */\n  arg: {\n    /**\n     * The name of the given endpoint for the mutation\n     */\n    endpointName: string;\n    /**\n     * The original arguments supplied to the mutation call\n     */\n    originalArgs: QueryArgFrom<D>;\n    /**\n     * Whether the mutation is being tracked in the store.\n     */\n    track?: boolean;\n    fixedCacheKey?: string;\n  };\n  /**\n   * A unique string generated for the request sequence\n   */\n  requestId: string;\n\n  /**\n   * A method to cancel the mutation promise. Note that this is not intended to prevent the mutation\n   * that was fired off from reaching the server, but only to assist in handling the response.\n   *\n   * Calling `abort()` prior to the promise resolving will force it to reach the error state with\n   * the serialized error:\n   * `{ name: 'AbortError', message: 'Aborted' }`\n   *\n   * @example\n   * ```ts\n   * const [updateUser] = useUpdateUserMutation();\n   *\n   * useEffect(() => {\n   *   const promise = updateUser(id);\n   *   promise\n   *     .unwrap()\n   *     .catch((err) => {\n   *       if (err.name === 'AbortError') return;\n   *       // else handle the unexpected error\n   *     })\n   *\n   *   return () => {\n   *     promise.abort();\n   *   }\n   * }, [id, updateUser])\n   * ```\n   */\n  abort(): void;\n  /**\n   * Unwraps a mutation call to provide the raw response/error.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a mutation, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap\"\n   * addPost({ id: 1, name: 'Example' })\n   *   .unwrap()\n   *   .then((payload) => console.log('fulfilled', payload))\n   *   .catch((error) => console.error('rejected', error));\n   * ```\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await addPost({ id: 1, name: 'Example' }).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  unwrap(): Promise<ResultTypeFrom<D>>;\n  /**\n   * A method to manually unsubscribe from the mutation call, meaning it will be removed from cache after the usual caching grace period.\n   The value returned by the hook will reset to `isUninitialized` afterwards.\n   */\n  reset(): void;\n};\nexport function buildInitiate({\n  serializeQueryArgs,\n  queryThunk,\n  infiniteQueryThunk,\n  mutationThunk,\n  api,\n  context,\n  getInternalState\n}: {\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  queryThunk: QueryThunk;\n  infiniteQueryThunk: InfiniteQueryThunk<any>;\n  mutationThunk: MutationThunk;\n  api: Api<any, EndpointDefinitions, any, any>;\n  context: ApiContext<EndpointDefinitions>;\n  getInternalState: (dispatch: Dispatch) => InternalMiddlewareState;\n}) {\n  const getRunningQueries = (dispatch: Dispatch) => getInternalState(dispatch)?.runningQueries;\n  const getRunningMutations = (dispatch: Dispatch) => getInternalState(dispatch)?.runningMutations;\n  const {\n    unsubscribeQueryResult,\n    removeMutationResult,\n    updateSubscriptionOptions\n  } = api.internalActions;\n  return {\n    buildInitiateQuery,\n    buildInitiateInfiniteQuery,\n    buildInitiateMutation,\n    getRunningQueryThunk,\n    getRunningMutationThunk,\n    getRunningQueriesThunk,\n    getRunningMutationsThunk\n  };\n  function getRunningQueryThunk(endpointName: string, queryArgs: any) {\n    return (dispatch: Dispatch) => {\n      const endpointDefinition = getEndpointDefinition(context, endpointName);\n      const queryCacheKey = serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      });\n      return getRunningQueries(dispatch)?.get(queryCacheKey) as QueryActionCreatorResult<never> | InfiniteQueryActionCreatorResult<never> | undefined;\n    };\n  }\n  function getRunningMutationThunk(\n  /**\n   * this is only here to allow TS to infer the result type by input value\n   * we could use it to validate the result, but it's probably not necessary\n   */\n  _endpointName: string, fixedCacheKeyOrRequestId: string) {\n    return (dispatch: Dispatch) => {\n      return getRunningMutations(dispatch)?.get(fixedCacheKeyOrRequestId) as MutationActionCreatorResult<never> | undefined;\n    };\n  }\n  function getRunningQueriesThunk() {\n    return (dispatch: Dispatch) => filterNullishValues(getRunningQueries(dispatch));\n  }\n  function getRunningMutationsThunk() {\n    return (dispatch: Dispatch) => filterNullishValues(getRunningMutations(dispatch));\n  }\n  function middlewareWarning(dispatch: Dispatch) {\n    if (process.env.NODE_ENV !== 'production') {\n      if ((middlewareWarning as any).triggered) return;\n      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());\n      (middlewareWarning as any).triggered = true;\n\n      // The RTKQ middleware should return the internal state object,\n      // but it should _not_ be the action object.\n      if (typeof returnedValue !== 'object' || typeof returnedValue?.type === 'string') {\n        // Otherwise, must not have been added\n        throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(34) : `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!`);\n      }\n    }\n  }\n  function buildInitiateAnyQuery<T extends 'query' | 'infiniteQuery'>(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any>) {\n    const queryAction: AnyQueryActionCreator<any> = (arg, {\n      subscribe = true,\n      forceRefetch,\n      subscriptionOptions,\n      [forceQueryFnSymbol]: forceQueryFn,\n      ...rest\n    } = {}) => (dispatch, getState) => {\n      const queryCacheKey = serializeQueryArgs({\n        queryArgs: arg,\n        endpointDefinition,\n        endpointName\n      });\n      let thunk: AsyncThunkAction<unknown, QueryThunkArg, ThunkApiMetaConfig>;\n      const commonThunkArgs = {\n        ...rest,\n        type: ENDPOINT_QUERY as 'query',\n        subscribe,\n        forceRefetch: forceRefetch,\n        subscriptionOptions,\n        endpointName,\n        originalArgs: arg,\n        queryCacheKey,\n        [forceQueryFnSymbol]: forceQueryFn\n      };\n      if (isQueryDefinition(endpointDefinition)) {\n        thunk = queryThunk(commonThunkArgs);\n      } else {\n        const {\n          direction,\n          initialPageParam,\n          refetchCachedPages\n        } = rest as Pick<InfiniteQueryThunkArg<any>, 'direction' | 'initialPageParam' | 'refetchCachedPages'>;\n        thunk = infiniteQueryThunk({\n          ...(commonThunkArgs as InfiniteQueryThunkArg<any>),\n          // Supply these even if undefined. This helps with a field existence\n          // check over in `buildSlice.ts`\n          direction,\n          initialPageParam,\n          refetchCachedPages\n        });\n      }\n      const selector = (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).select(arg);\n      const thunkResult = dispatch(thunk);\n      const stateAfter = selector(getState());\n      middlewareWarning(dispatch);\n      const {\n        requestId,\n        abort\n      } = thunkResult;\n      const skippedSynchronously = stateAfter.requestId !== requestId;\n      const runningQuery = getRunningQueries(dispatch)?.get(queryCacheKey);\n      const selectFromState = () => selector(getState());\n      const statePromise: AnyActionCreatorResult = Object.assign((forceQueryFn ?\n      // a query has been forced (upsertQueryData)\n      // -> we want to resolve it once data has been written with the data that will be written\n      thunkResult.then(selectFromState) : skippedSynchronously && !runningQuery ?\n      // a query has been skipped due to a condition and we do not have any currently running query\n      // -> we want to resolve it immediately with the current data\n      Promise.resolve(stateAfter) :\n      // query just started or one is already in flight\n      // -> wait for the running query, then resolve with data from after that\n      Promise.all([runningQuery, thunkResult]).then(selectFromState)) as SafePromise<any>, {\n        arg,\n        requestId,\n        subscriptionOptions,\n        queryCacheKey,\n        abort,\n        async unwrap() {\n          const result = await statePromise;\n          if (result.isError) {\n            throw result.error;\n          }\n          return result.data;\n        },\n        refetch: (options?: RefetchOptions) => dispatch(queryAction(arg, {\n          subscribe: false,\n          forceRefetch: true,\n          ...options\n        })),\n        unsubscribe() {\n          if (subscribe) dispatch(unsubscribeQueryResult({\n            queryCacheKey,\n            requestId\n          }));\n        },\n        updateSubscriptionOptions(options: SubscriptionOptions) {\n          statePromise.subscriptionOptions = options;\n          dispatch(updateSubscriptionOptions({\n            endpointName,\n            requestId,\n            queryCacheKey,\n            options\n          }));\n        }\n      });\n      if (!runningQuery && !skippedSynchronously && !forceQueryFn) {\n        const runningQueries = getRunningQueries(dispatch)!;\n        runningQueries.set(queryCacheKey, statePromise);\n        statePromise.then(() => {\n          runningQueries.delete(queryCacheKey);\n        });\n      }\n      return statePromise;\n    };\n    return queryAction;\n  }\n  function buildInitiateQuery(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any>) {\n    const queryAction: StartQueryActionCreator<any> = buildInitiateAnyQuery(endpointName, endpointDefinition);\n    return queryAction;\n  }\n  function buildInitiateInfiniteQuery(endpointName: string, endpointDefinition: InfiniteQueryDefinition<any, any, any, any, any>) {\n    const infiniteQueryAction: StartInfiniteQueryActionCreator<any> = buildInitiateAnyQuery(endpointName, endpointDefinition);\n    return infiniteQueryAction;\n  }\n  function buildInitiateMutation(endpointName: string): StartMutationActionCreator<any> {\n    return (arg, {\n      track = true,\n      fixedCacheKey\n    } = {}) => (dispatch, getState) => {\n      const thunk = mutationThunk({\n        type: 'mutation',\n        endpointName,\n        originalArgs: arg,\n        track,\n        fixedCacheKey\n      });\n      const thunkResult = dispatch(thunk);\n      middlewareWarning(dispatch);\n      const {\n        requestId,\n        abort,\n        unwrap\n      } = thunkResult;\n      const returnValuePromise = asSafePromise(thunkResult.unwrap().then(data => ({\n        data\n      })), error => ({\n        error\n      }));\n      const reset = () => {\n        dispatch(removeMutationResult({\n          requestId,\n          fixedCacheKey\n        }));\n      };\n      const ret = Object.assign(returnValuePromise, {\n        arg: thunkResult.arg,\n        requestId,\n        abort,\n        unwrap,\n        reset\n      });\n      const runningMutations = getRunningMutations(dispatch)!;\n      runningMutations.set(requestId, ret);\n      ret.then(() => {\n        runningMutations.delete(requestId);\n      });\n      if (fixedCacheKey) {\n        runningMutations.set(fixedCacheKey, ret);\n        ret.then(() => {\n          if (runningMutations.get(fixedCacheKey) === ret) {\n            runningMutations.delete(fixedCacheKey);\n          }\n        });\n      }\n      return ret;\n    };\n  }\n}","import type { Middleware, StoreEnhancer } from 'redux';\nimport type { Tuple } from './utils';\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>) {\n  Object.assign(target, ...args);\n}\n\n/**\n * return True if T is `any`, otherwise return False\n * taken from https://github.com/joonhocho/tsdef\n *\n * @internal\n */\nexport type IsAny<T, True, False = never> =\n// test if we are going the left AND right path in the condition\ntrue | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;\n\n/**\n * return True if T is `unknown`, otherwise return False\n * taken from https://github.com/joonhocho/tsdef\n *\n * @internal\n */\nexport type IsUnknown<T, True, False = never> = unknown extends T ? IsAny<T, False, True> : False;\nexport type FallbackIfUnknown<T, Fallback> = IsUnknown<T, Fallback, T>;\n\n/**\n * @internal\n */\nexport type IfMaybeUndefined<P, True, False> = [undefined] extends [P] ? True : False;\n\n/**\n * @internal\n */\nexport type IfVoid<P, True, False> = [void] extends [P] ? True : False;\n\n/**\n * @internal\n */\nexport type IsEmptyObj<T, True, False = never> = T extends any ? keyof T extends never ? IsUnknown<T, False, IfMaybeUndefined<T, False, IfVoid<T, False, True>>> : False : never;\n\n/**\n * returns True if TS version is above 3.5, False if below.\n * uses feature detection to detect TS version >= 3.5\n * * versions below 3.5 will return `{}` for unresolvable interference\n * * versions above will return `unknown`\n *\n * @internal\n */\nexport type AtLeastTS35<True, False> = [True, False][IsUnknown<ReturnType<<T>() => T>, 0, 1>];\n\n/**\n * @internal\n */\nexport type IsUnknownOrNonInferrable<T, True, False> = AtLeastTS35<IsUnknown<T, True, False>, IsEmptyObj<T, True, IsUnknown<T, True, False>>>;\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\n\n// Appears to have a convenient side effect of ignoring `never` even if that's not what you specified\nexport type ExcludeFromTuple<T, E, Acc extends unknown[] = []> = T extends [infer Head, ...infer Tail] ? ExcludeFromTuple<Tail, E, [...Acc, ...([Head] extends [E] ? [] : [Head])]> : Acc;\ntype ExtractDispatchFromMiddlewareTuple<MiddlewareTuple extends readonly any[], Acc extends {}> = MiddlewareTuple extends [infer Head, ...infer Tail] ? ExtractDispatchFromMiddlewareTuple<Tail, Acc & (Head extends Middleware<infer D> ? IsAny<D, {}, D> : {})> : Acc;\nexport type ExtractDispatchExtensions<M> = M extends Tuple<infer MiddlewareTuple> ? ExtractDispatchFromMiddlewareTuple<MiddlewareTuple, {}> : M extends ReadonlyArray<Middleware> ? ExtractDispatchFromMiddlewareTuple<[...M], {}> : never;\ntype ExtractStoreExtensionsFromEnhancerTuple<EnhancerTuple extends readonly any[], Acc extends {}> = EnhancerTuple extends [infer Head, ...infer Tail] ? ExtractStoreExtensionsFromEnhancerTuple<Tail, Acc & (Head extends StoreEnhancer<infer Ext> ? IsAny<Ext, {}, Ext> : {})> : Acc;\nexport type ExtractStoreExtensions<E> = E extends Tuple<infer EnhancerTuple> ? ExtractStoreExtensionsFromEnhancerTuple<EnhancerTuple, {}> : E extends ReadonlyArray<StoreEnhancer> ? UnionToIntersection<E[number] extends StoreEnhancer<infer Ext> ? Ext extends {} ? IsAny<Ext, {}, Ext> : {} : {}> : never;\ntype ExtractStateExtensionsFromEnhancerTuple<EnhancerTuple extends readonly any[], Acc extends {}> = EnhancerTuple extends [infer Head, ...infer Tail] ? ExtractStateExtensionsFromEnhancerTuple<Tail, Acc & (Head extends StoreEnhancer<any, infer StateExt> ? IsAny<StateExt, {}, StateExt> : {})> : Acc;\nexport type ExtractStateExtensions<E> = E extends Tuple<infer EnhancerTuple> ? ExtractStateExtensionsFromEnhancerTuple<EnhancerTuple, {}> : E extends ReadonlyArray<StoreEnhancer> ? UnionToIntersection<E[number] extends StoreEnhancer<any, infer StateExt> ? StateExt extends {} ? IsAny<StateExt, {}, StateExt> : {} : {}> : never;\n\n/**\n * Helper type. Passes T out again, but boxes it in a way that it cannot\n * \"widen\" the type by accident if it is a generic that should be inferred\n * from elsewhere.\n *\n * @internal\n */\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type WithOptionalProp<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\nexport interface TypeGuard<T> {\n  (value: any): value is T;\n}\nexport interface HasMatchFunction<T> {\n  match: TypeGuard<T>;\n}\nexport const hasMatchFunction = <T,>(v: Matcher<T>): v is HasMatchFunction<T> => {\n  return v && typeof (v as HasMatchFunction<T>).match === 'function';\n};\n\n/** @public */\nexport type Matcher<T> = HasMatchFunction<T> | TypeGuard<T>;\n\n/** @public */\nexport type ActionFromMatcher<M extends Matcher<any>> = M extends Matcher<infer T> ? T : never;\nexport type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type Tail<T extends any[]> = T extends [any, ...infer Tail] ? Tail : never;\nexport type UnknownIfNonSpecific<T> = {} extends T ? unknown : T;\n\n/**\n * A Promise that will never reject.\n * @see https://github.com/reduxjs/redux-toolkit/issues/4101\n */\nexport type SafePromise<T> = Promise<T> & {\n  __linterBrands: 'SafePromise';\n};\n\n/**\n * Properly wraps a Promise as a {@link SafePromise} with .catch(fallback).\n */\nexport function asSafePromise<Resolved, Rejected>(promise: Promise<Resolved>, fallback: (error: unknown) => Rejected) {\n  return promise.catch(fallback) as SafePromise<Resolved | Rejected>;\n}","import type { UnknownAction } from '@reduxjs/toolkit';\nimport type { BaseQueryFn } from './baseQueryTypes';\nimport type { CombinedState, CoreModule, QueryKeys } from './core';\nimport type { ApiModules } from './core/module';\nimport type { CreateApiOptions } from './createApi';\nimport type { EndpointBuilder, EndpointDefinition, EndpointDefinitions, UpdateDefinitions } from './endpointDefinitions';\nimport type { NoInfer, UnionToIntersection, WithRequiredProp } from './tsHelpers';\nexport type ModuleName = keyof ApiModules<any, any, any, any>;\nexport type Module<Name extends ModuleName> = {\n  name: Name;\n  init<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string>(api: Api<BaseQuery, EndpointDefinitions, ReducerPath, TagTypes, ModuleName>, options: WithRequiredProp<CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>, 'reducerPath' | 'serializeQueryArgs' | 'keepUnusedDataFor' | 'refetchOnMountOrArgChange' | 'refetchOnFocus' | 'refetchOnReconnect' | 'invalidationBehavior' | 'tagTypes'>, context: ApiContext<Definitions>): {\n    injectEndpoint(endpointName: string, definition: EndpointDefinition<any, any, any, any>): void;\n  };\n};\nexport interface ApiContext<Definitions extends EndpointDefinitions> {\n  apiUid: string;\n  endpointDefinitions: Definitions;\n  batch(cb: () => void): void;\n  extractRehydrationInfo: (action: UnknownAction) => CombinedState<any, any, any> | undefined;\n  hasRehydrationInfo: (action: UnknownAction) => boolean;\n}\nexport const getEndpointDefinition = <Definitions extends EndpointDefinitions, EndpointName extends keyof Definitions>(context: ApiContext<Definitions>, endpointName: EndpointName) => context.endpointDefinitions[endpointName];\nexport type Api<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string, Enhancers extends ModuleName = CoreModule> = UnionToIntersection<ApiModules<BaseQuery, Definitions, ReducerPath, TagTypes>[Enhancers]> & {\n  /**\n   * A function to inject the endpoints into the original API, but also give you that same API with correct types for these endpoints back. Useful with code-splitting.\n   */\n  injectEndpoints<NewDefinitions extends EndpointDefinitions>(_: {\n    endpoints: (build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>) => NewDefinitions;\n    /**\n     * Optionally allows endpoints to be overridden if defined by multiple `injectEndpoints` calls.\n     *\n     * If set to `true`, will override existing endpoints with the new definition.\n     * If set to `'throw'`, will throw an error if an endpoint is redefined with a different definition.\n     * If set to `false` (or unset), will not override existing endpoints with the new definition, and log a warning in development.\n     */\n    overrideExisting?: boolean | 'throw';\n  }): Api<BaseQuery, Definitions & NewDefinitions, ReducerPath, TagTypes, Enhancers>;\n  /**\n   *A function to enhance a generated API with additional information. Useful with code-generation.\n   */\n  enhanceEndpoints<NewTagTypes extends string = never, NewDefinitions extends EndpointDefinitions = never>(_: {\n    addTagTypes?: readonly NewTagTypes[];\n    endpoints?: UpdateDefinitions<Definitions, TagTypes | NoInfer<NewTagTypes>, NewDefinitions> extends infer NewDefinitions ? { [K in keyof NewDefinitions]?: Partial<NewDefinitions[K]> | ((definition: NewDefinitions[K]) => void) } : never;\n  }): Api<BaseQuery, UpdateDefinitions<Definitions, TagTypes | NewTagTypes, NewDefinitions>, ReducerPath, TagTypes | NewTagTypes, Enhancers>;\n};","import type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { SchemaError } from '@standard-schema/utils';\nimport type { SchemaType } from './endpointDefinitions';\nexport class NamedSchemaError extends SchemaError {\n  constructor(issues: readonly StandardSchemaV1.Issue[], public readonly value: any, public readonly schemaName: `${SchemaType}Schema`, public readonly _bqMeta: any) {\n    super(issues);\n  }\n}\nexport const shouldSkip = (skipSchemaValidation: boolean | SchemaType[] | undefined, schemaName: SchemaType) => Array.isArray(skipSchemaValidation) ? skipSchemaValidation.includes(schemaName) : !!skipSchemaValidation;\nexport async function parseWithSchema<Schema extends StandardSchemaV1>(schema: Schema, data: unknown, schemaName: `${SchemaType}Schema`, bqMeta: any): Promise<StandardSchemaV1.InferOutput<Schema>> {\n  const result = await schema['~standard'].validate(data);\n  if (result.issues) {\n    throw new NamedSchemaError(result.issues, data, schemaName, bqMeta);\n  }\n  return result.value;\n}","import type { AsyncThunk, AsyncThunkPayloadCreator, Draft, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { Patch } from 'immer';\nimport { isDraftable, produceWithPatches } from '../utils/immerImports';\nimport type { Api, ApiContext } from '../apiTypes';\nimport type { BaseQueryError, BaseQueryFn, QueryReturnValue } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { AssertTagTypes, EndpointDefinition, EndpointDefinitions, InfiniteQueryArgFrom, InfiniteQueryCombinedArg, InfiniteQueryDefinition, MutationDefinition, PageParamFrom, QueryArgFrom, QueryDefinition, ResultDescription, ResultTypeFrom, SchemaFailureConverter, SchemaFailureHandler, SchemaFailureInfo, SchemaType } from '../endpointDefinitions';\nimport { calculateProvidedBy, ENDPOINT_QUERY, isInfiniteQueryDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { HandledError } from '../HandledError';\nimport type { UnwrapPromise } from '../tsHelpers';\nimport type { RootState, QueryKeys, QuerySubstateIdentifier, InfiniteData, InfiniteQueryConfigOptions, QueryCacheKey, InfiniteQueryDirection, InfiniteQueryKeys } from './apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from './apiState';\nimport type { InfiniteQueryActionCreatorResult, QueryActionCreatorResult, StartInfiniteQueryActionCreatorOptions, StartQueryActionCreatorOptions } from './buildInitiate';\nimport { forceQueryFnSymbol, isUpsertQuery } from './buildInitiate';\nimport type { AllSelectors } from './buildSelectors';\nimport type { ApiEndpointQuery, PrefetchOptions } from './module';\nimport { createAsyncThunk, isAllOf, isFulfilled, isPending, isRejected, isRejectedWithValue, SHOULD_AUTOBATCH } from './rtkImports';\nimport { parseWithSchema, NamedSchemaError, shouldSkip } from '../standardSchema';\nexport type BuildThunksApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>> = Matchers<QueryThunk, Definition>;\nexport type BuildThunksApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = Matchers<InfiniteQueryThunk<any>, Definition>;\nexport type BuildThunksApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>> = Matchers<MutationThunk, Definition>;\ntype EndpointThunk<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = Definition extends EndpointDefinition<infer QueryArg, infer BaseQueryFn, any, infer ResultType> ? Thunk extends AsyncThunk<unknown, infer ATArg, infer ATConfig> ? AsyncThunk<ResultType, ATArg & {\n  originalArgs: QueryArg;\n}, ATConfig & {\n  rejectValue: BaseQueryError<BaseQueryFn>;\n}> : never : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQueryFn, any, infer ResultType> ? Thunk extends AsyncThunk<unknown, infer ATArg, infer ATConfig> ? AsyncThunk<InfiniteData<ResultType, PageParam>, ATArg & {\n  originalArgs: QueryArg;\n}, ATConfig & {\n  rejectValue: BaseQueryError<BaseQueryFn>;\n}> : never : never;\nexport type PendingAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['pending']>;\nexport type FulfilledAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['fulfilled']>;\nexport type RejectedAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['rejected']>;\nexport type Matcher<M> = (value: any) => value is M;\nexport interface Matchers<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> {\n  matchPending: Matcher<PendingAction<Thunk, Definition>>;\n  matchFulfilled: Matcher<FulfilledAction<Thunk, Definition>>;\n  matchRejected: Matcher<RejectedAction<Thunk, Definition>>;\n}\nexport type QueryThunkArg = QuerySubstateIdentifier & StartQueryActionCreatorOptions & {\n  type: 'query';\n  originalArgs: unknown;\n  endpointName: string;\n};\nexport type InfiniteQueryThunkArg<D extends InfiniteQueryDefinition<any, any, any, any, any>> = QuerySubstateIdentifier & StartInfiniteQueryActionCreatorOptions<D> & {\n  type: `query`;\n  originalArgs: unknown;\n  endpointName: string;\n  param: unknown;\n  direction?: InfiniteQueryDirection;\n  refetchCachedPages?: boolean;\n};\ntype MutationThunkArg = {\n  type: 'mutation';\n  originalArgs: unknown;\n  endpointName: string;\n  track?: boolean;\n  fixedCacheKey?: string;\n};\nexport type ThunkResult = unknown;\nexport type ThunkApiMetaConfig = {\n  pendingMeta: {\n    startedTimeStamp: number;\n    [SHOULD_AUTOBATCH]: true;\n  };\n  fulfilledMeta: {\n    fulfilledTimeStamp: number;\n    baseQueryMeta: unknown;\n    [SHOULD_AUTOBATCH]: true;\n  };\n  rejectedMeta: {\n    baseQueryMeta: unknown;\n    [SHOULD_AUTOBATCH]: true;\n  };\n};\nexport type QueryThunk = AsyncThunk<ThunkResult, QueryThunkArg, ThunkApiMetaConfig>;\nexport type InfiniteQueryThunk<D extends InfiniteQueryDefinition<any, any, any, any, any>> = AsyncThunk<ThunkResult, InfiniteQueryThunkArg<D>, ThunkApiMetaConfig>;\nexport type MutationThunk = AsyncThunk<ThunkResult, MutationThunkArg, ThunkApiMetaConfig>;\nfunction defaultTransformResponse(baseQueryReturnValue: unknown) {\n  return baseQueryReturnValue;\n}\nexport type MaybeDrafted<T> = T | Draft<T>;\nexport type Recipe<T> = (data: MaybeDrafted<T>) => void | MaybeDrafted<T>;\nexport type UpsertRecipe<T> = (data: MaybeDrafted<T> | undefined) => void | MaybeDrafted<T>;\nexport type PatchQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFrom<Definitions[EndpointName]>, patches: readonly Patch[], updateProvided?: boolean) => ThunkAction<void, PartialState, any, UnknownAction>;\nexport type AllQueryKeys<Definitions extends EndpointDefinitions> = QueryKeys<Definitions> | InfiniteQueryKeys<Definitions>;\nexport type QueryArgFromAnyQueryDefinition<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryArgFrom<Definitions[EndpointName]> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? QueryArgFrom<Definitions[EndpointName]> : never;\nexport type DataFromAnyQueryDefinition<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteData<ResultTypeFrom<Definitions[EndpointName]>, PageParamFrom<Definitions[EndpointName]>> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? ResultTypeFrom<Definitions[EndpointName]> : unknown;\nexport type UpsertThunkResult<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryActionCreatorResult<Definitions[EndpointName]> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? QueryActionCreatorResult<Definitions[EndpointName]> : QueryActionCreatorResult<never>;\nexport type UpdateQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>, updateRecipe: Recipe<DataFromAnyQueryDefinition<Definitions, EndpointName>>, updateProvided?: boolean) => ThunkAction<PatchCollection, PartialState, any, UnknownAction>;\nexport type UpsertQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>, value: DataFromAnyQueryDefinition<Definitions, EndpointName>) => ThunkAction<UpsertThunkResult<Definitions, EndpointName>, PartialState, any, UnknownAction>;\n\n/**\n * An object returned from dispatching a `api.util.updateQueryData` call.\n */\nexport type PatchCollection = {\n  /**\n   * An `immer` Patch describing the cache update.\n   */\n  patches: Patch[];\n  /**\n   * An `immer` Patch to revert the cache update.\n   */\n  inversePatches: Patch[];\n  /**\n   * A function that will undo the cache update.\n   */\n  undo: () => void;\n};\ntype TransformCallback = (baseQueryReturnValue: unknown, meta: unknown, arg: unknown) => any;\nexport const addShouldAutoBatch = <T extends Record<string, any>,>(arg: T = {} as T): T & {\n  [SHOULD_AUTOBATCH]: true;\n} => {\n  return {\n    ...arg,\n    [SHOULD_AUTOBATCH]: true\n  };\n};\nexport function buildThunks<BaseQuery extends BaseQueryFn, ReducerPath extends string, Definitions extends EndpointDefinitions>({\n  reducerPath,\n  baseQuery,\n  context: {\n    endpointDefinitions\n  },\n  serializeQueryArgs,\n  api,\n  assertTagType,\n  selectors,\n  onSchemaFailure,\n  catchSchemaFailure: globalCatchSchemaFailure,\n  skipSchemaValidation: globalSkipSchemaValidation\n}: {\n  baseQuery: BaseQuery;\n  reducerPath: ReducerPath;\n  context: ApiContext<Definitions>;\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  api: Api<BaseQuery, Definitions, ReducerPath, any>;\n  assertTagType: AssertTagTypes;\n  selectors: AllSelectors;\n  onSchemaFailure: SchemaFailureHandler | undefined;\n  catchSchemaFailure: SchemaFailureConverter<BaseQuery> | undefined;\n  skipSchemaValidation: boolean | SchemaType[] | undefined;\n}) {\n  type State = RootState<any, string, ReducerPath>;\n  const patchQueryData: PatchQueryDataThunk<EndpointDefinitions, State> = (endpointName, arg, patches, updateProvided) => (dispatch, getState) => {\n    const endpointDefinition = endpointDefinitions[endpointName];\n    const queryCacheKey = serializeQueryArgs({\n      queryArgs: arg,\n      endpointDefinition,\n      endpointName\n    });\n    dispatch(api.internalActions.queryResultPatched({\n      queryCacheKey,\n      patches\n    }));\n    if (!updateProvided) {\n      return;\n    }\n    const newValue = api.endpoints[endpointName].select(arg)(\n    // Work around TS 4.1 mismatch\n    getState() as RootState<any, any, any>);\n    const providedTags = calculateProvidedBy(endpointDefinition.providesTags, newValue.data, undefined, arg, {}, assertTagType);\n    dispatch(api.internalActions.updateProvidedBy([{\n      queryCacheKey,\n      providedTags\n    }]));\n  };\n  function addToStart<T>(items: Array<T>, item: T, max = 0): Array<T> {\n    const newItems = [item, ...items];\n    return max && newItems.length > max ? newItems.slice(0, -1) : newItems;\n  }\n  function addToEnd<T>(items: Array<T>, item: T, max = 0): Array<T> {\n    const newItems = [...items, item];\n    return max && newItems.length > max ? newItems.slice(1) : newItems;\n  }\n  const updateQueryData: UpdateQueryDataThunk<EndpointDefinitions, State> = (endpointName, arg, updateRecipe, updateProvided = true) => (dispatch, getState) => {\n    const endpointDefinition = api.endpoints[endpointName];\n    const currentState = endpointDefinition.select(arg)(\n    // Work around TS 4.1 mismatch\n    getState() as RootState<any, any, any>);\n    const ret: PatchCollection = {\n      patches: [],\n      inversePatches: [],\n      undo: () => dispatch(api.util.patchQueryData(endpointName, arg, ret.inversePatches, updateProvided))\n    };\n    if (currentState.status === STATUS_UNINITIALIZED) {\n      return ret;\n    }\n    let newValue;\n    if ('data' in currentState) {\n      if (isDraftable(currentState.data)) {\n        const [value, patches, inversePatches] = produceWithPatches(currentState.data, updateRecipe);\n        ret.patches.push(...patches);\n        ret.inversePatches.push(...inversePatches);\n        newValue = value;\n      } else {\n        newValue = updateRecipe(currentState.data);\n        ret.patches.push({\n          op: 'replace',\n          path: [],\n          value: newValue\n        });\n        ret.inversePatches.push({\n          op: 'replace',\n          path: [],\n          value: currentState.data\n        });\n      }\n    }\n    if (ret.patches.length === 0) {\n      return ret;\n    }\n    dispatch(api.util.patchQueryData(endpointName, arg, ret.patches, updateProvided));\n    return ret;\n  };\n  const upsertQueryData: UpsertQueryDataThunk<Definitions, State> = (endpointName, arg, value) => dispatch => {\n    type EndpointName = typeof endpointName;\n    const res = dispatch((api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>).initiate(arg, {\n      subscribe: false,\n      forceRefetch: true,\n      [forceQueryFnSymbol]: () => ({\n        data: value\n      })\n    })) as UpsertThunkResult<Definitions, EndpointName>;\n    return res;\n  };\n  const getTransformCallbackForEndpoint = (endpointDefinition: EndpointDefinition<any, any, any, any>, transformFieldName: 'transformResponse' | 'transformErrorResponse'): TransformCallback => {\n    return endpointDefinition.query && endpointDefinition[transformFieldName] ? endpointDefinition[transformFieldName]! as TransformCallback : defaultTransformResponse;\n  };\n\n  // The generic async payload function for all of our thunks\n  const executeEndpoint: AsyncThunkPayloadCreator<ThunkResult, QueryThunkArg | MutationThunkArg | InfiniteQueryThunkArg<any>, ThunkApiMetaConfig & {\n    state: RootState<any, string, ReducerPath>;\n  }> = async (arg, {\n    signal,\n    abort,\n    rejectWithValue,\n    fulfillWithValue,\n    dispatch,\n    getState,\n    extra\n  }) => {\n    const endpointDefinition = endpointDefinitions[arg.endpointName];\n    const {\n      metaSchema,\n      skipSchemaValidation = globalSkipSchemaValidation\n    } = endpointDefinition;\n    const isQuery = arg.type === ENDPOINT_QUERY;\n    try {\n      let transformResponse: TransformCallback = defaultTransformResponse;\n      const baseQueryApi = {\n        signal,\n        abort,\n        dispatch,\n        getState,\n        extra,\n        endpoint: arg.endpointName,\n        type: arg.type,\n        forced: isQuery ? isForcedQuery(arg, getState()) : undefined,\n        queryCacheKey: isQuery ? arg.queryCacheKey : undefined\n      };\n      const forceQueryFn = isQuery ? arg[forceQueryFnSymbol] : undefined;\n      let finalQueryReturnValue: QueryReturnValue;\n\n      // Infinite query wrapper, which executes the request and returns\n      // the InfiniteData `{pages, pageParams}` structure\n      const fetchPage = async (data: InfiniteData<unknown, unknown>, param: unknown, maxPages: number, previous?: boolean): Promise<QueryReturnValue> => {\n        // This should handle cases where there is no `getPrevPageParam`,\n        // or `getPPP` returned nullish\n        if (param == null && data.pages.length) {\n          return Promise.resolve({\n            data\n          });\n        }\n        const finalQueryArg: InfiniteQueryCombinedArg<any, any> = {\n          queryArg: arg.originalArgs,\n          pageParam: param\n        };\n        const pageResponse = await executeRequest(finalQueryArg);\n        const addTo = previous ? addToStart : addToEnd;\n        return {\n          data: {\n            pages: addTo(data.pages, pageResponse.data, maxPages),\n            pageParams: addTo(data.pageParams, param, maxPages)\n          },\n          meta: pageResponse.meta\n        };\n      };\n\n      // Wrapper for executing either `query` or `queryFn`,\n      // and handling any errors\n      async function executeRequest(finalQueryArg: unknown): Promise<QueryReturnValue> {\n        let result: QueryReturnValue;\n        const {\n          extraOptions,\n          argSchema,\n          rawResponseSchema,\n          responseSchema\n        } = endpointDefinition;\n        if (argSchema && !shouldSkip(skipSchemaValidation, 'arg')) {\n          finalQueryArg = await parseWithSchema(argSchema, finalQueryArg, 'argSchema', {} // we don't have a meta yet, so we can't pass it\n          );\n        }\n        if (forceQueryFn) {\n          // upsertQueryData relies on this to pass in the user-provided value\n          result = forceQueryFn();\n        } else if (endpointDefinition.query) {\n          // We should only run `transformResponse` when the endpoint has a `query` method,\n          // and we're not doing an `upsertQueryData`.\n          transformResponse = getTransformCallbackForEndpoint(endpointDefinition, 'transformResponse');\n          result = await baseQuery(endpointDefinition.query(finalQueryArg as any), baseQueryApi, extraOptions as any);\n        } else {\n          result = await endpointDefinition.queryFn(finalQueryArg as any, baseQueryApi, extraOptions as any, arg => baseQuery(arg, baseQueryApi, extraOptions as any));\n        }\n        if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n          const what = endpointDefinition.query ? '`baseQuery`' : '`queryFn`';\n          let err: undefined | string;\n          if (!result) {\n            err = `${what} did not return anything.`;\n          } else if (typeof result !== 'object') {\n            err = `${what} did not return an object.`;\n          } else if (result.error && result.data) {\n            err = `${what} returned an object containing both \\`error\\` and \\`result\\`.`;\n          } else if (result.error === undefined && result.data === undefined) {\n            err = `${what} returned an object containing neither a valid \\`error\\` and \\`result\\`. At least one of them should not be \\`undefined\\``;\n          } else {\n            for (const key of Object.keys(result)) {\n              if (key !== 'error' && key !== 'data' && key !== 'meta') {\n                err = `The object returned by ${what} has the unknown property ${key}.`;\n                break;\n              }\n            }\n          }\n          if (err) {\n            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);\n          }\n        }\n        if (result.error) throw new HandledError(result.error, result.meta);\n        let {\n          data\n        } = result;\n        if (rawResponseSchema && !shouldSkip(skipSchemaValidation, 'rawResponse')) {\n          data = await parseWithSchema(rawResponseSchema, result.data, 'rawResponseSchema', result.meta);\n        }\n        let transformedResponse = await transformResponse(data, result.meta, finalQueryArg);\n        if (responseSchema && !shouldSkip(skipSchemaValidation, 'response')) {\n          transformedResponse = await parseWithSchema(responseSchema, transformedResponse, 'responseSchema', result.meta);\n        }\n        return {\n          ...result,\n          data: transformedResponse\n        };\n      }\n      if (isQuery && 'infiniteQueryOptions' in endpointDefinition) {\n        // This is an infinite query endpoint\n        const {\n          infiniteQueryOptions\n        } = endpointDefinition;\n\n        // Runtime checks should guarantee this is a positive number if provided\n        const {\n          maxPages = Infinity\n        } = infiniteQueryOptions;\n\n        // Priority: per-call override > endpoint config > default (true)\n        const refetchCachedPages = (arg as InfiniteQueryThunkArg<any>).refetchCachedPages ?? infiniteQueryOptions.refetchCachedPages ?? true;\n        let result: QueryReturnValue;\n\n        // Start by looking up the existing InfiniteData value from state,\n        // falling back to an empty value if it doesn't exist yet\n        const blankData = {\n          pages: [],\n          pageParams: []\n        };\n        const cachedData = selectors.selectQueryEntry(getState(), arg.queryCacheKey)?.data as InfiniteData<unknown, unknown> | undefined;\n\n        // When the arg changes or the user forces a refetch,\n        // we don't include the `direction` flag. This lets us distinguish\n        // between actually refetching with a forced query, vs just fetching\n        // the next page.\n        const isForcedQueryNeedingRefetch =\n        // arg.forceRefetch\n        isForcedQuery(arg, getState()) && !(arg as InfiniteQueryThunkArg<any>).direction;\n        const existingData = (isForcedQueryNeedingRefetch || !cachedData ? blankData : cachedData) as InfiniteData<unknown, unknown>;\n\n        // If the thunk specified a direction and we do have at least one page,\n        // fetch the next or previous page\n        if ('direction' in arg && arg.direction && existingData.pages.length) {\n          const previous = arg.direction === 'backward';\n          const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;\n          const param = pageParamFn(infiniteQueryOptions, existingData, arg.originalArgs);\n          result = await fetchPage(existingData, param, maxPages, previous);\n        } else {\n          // Otherwise, fetch the first page and then any remaining pages\n\n          const {\n            initialPageParam = infiniteQueryOptions.initialPageParam\n          } = arg as InfiniteQueryThunkArg<any>;\n\n          // If we're doing a refetch, we should start from\n          // the first page we have cached.\n          // Otherwise, we should start from the initialPageParam\n          const cachedPageParams = cachedData?.pageParams ?? [];\n          const firstPageParam = cachedPageParams[0] ?? initialPageParam;\n          const totalPages = cachedPageParams.length;\n\n          // Fetch first page\n          result = await fetchPage(existingData, firstPageParam, maxPages);\n          if (forceQueryFn) {\n            // HACK `upsertQueryData` expects the user to pass in the `{pages, pageParams}` structure,\n            // but `fetchPage` treats that as `pages[0]`. We have to manually un-nest it.\n            result = {\n              data: (result.data as InfiniteData<unknown, unknown>).pages[0]\n            } as QueryReturnValue;\n          }\n          if (refetchCachedPages) {\n            // Fetch remaining pages\n            for (let i = 1; i < totalPages; i++) {\n              const param = getNextPageParam(infiniteQueryOptions, result.data as InfiniteData<unknown, unknown>, arg.originalArgs);\n              result = await fetchPage(result.data as InfiniteData<unknown, unknown>, param, maxPages);\n            }\n          }\n        }\n        finalQueryReturnValue = result;\n      } else {\n        // Non-infinite endpoint. Just run the one request.\n        finalQueryReturnValue = await executeRequest(arg.originalArgs);\n      }\n      if (metaSchema && !shouldSkip(skipSchemaValidation, 'meta') && finalQueryReturnValue.meta) {\n        finalQueryReturnValue.meta = await parseWithSchema(metaSchema, finalQueryReturnValue.meta, 'metaSchema', finalQueryReturnValue.meta);\n      }\n\n      // console.log('Final result: ', transformedData)\n      return fulfillWithValue(finalQueryReturnValue.data, addShouldAutoBatch({\n        fulfilledTimeStamp: Date.now(),\n        baseQueryMeta: finalQueryReturnValue.meta\n      }));\n    } catch (error) {\n      let caughtError = error;\n      if (caughtError instanceof HandledError) {\n        let transformErrorResponse = getTransformCallbackForEndpoint(endpointDefinition, 'transformErrorResponse');\n        const {\n          rawErrorResponseSchema,\n          errorResponseSchema\n        } = endpointDefinition;\n        let {\n          value,\n          meta\n        } = caughtError;\n        try {\n          if (rawErrorResponseSchema && !shouldSkip(skipSchemaValidation, 'rawErrorResponse')) {\n            value = await parseWithSchema(rawErrorResponseSchema, value, 'rawErrorResponseSchema', meta);\n          }\n          if (metaSchema && !shouldSkip(skipSchemaValidation, 'meta')) {\n            meta = await parseWithSchema(metaSchema, meta, 'metaSchema', meta);\n          }\n          let transformedErrorResponse = await transformErrorResponse(value, meta, arg.originalArgs);\n          if (errorResponseSchema && !shouldSkip(skipSchemaValidation, 'errorResponse')) {\n            transformedErrorResponse = await parseWithSchema(errorResponseSchema, transformedErrorResponse, 'errorResponseSchema', meta);\n          }\n          return rejectWithValue(transformedErrorResponse, addShouldAutoBatch({\n            baseQueryMeta: meta\n          }));\n        } catch (e) {\n          caughtError = e;\n        }\n      }\n      try {\n        if (caughtError instanceof NamedSchemaError) {\n          const info: SchemaFailureInfo = {\n            endpoint: arg.endpointName,\n            arg: arg.originalArgs,\n            type: arg.type,\n            queryCacheKey: isQuery ? arg.queryCacheKey : undefined\n          };\n          endpointDefinition.onSchemaFailure?.(caughtError, info);\n          onSchemaFailure?.(caughtError, info);\n          const {\n            catchSchemaFailure = globalCatchSchemaFailure\n          } = endpointDefinition;\n          if (catchSchemaFailure) {\n            return rejectWithValue(catchSchemaFailure(caughtError, info), addShouldAutoBatch({\n              baseQueryMeta: caughtError._bqMeta\n            }));\n          }\n        }\n      } catch (e) {\n        caughtError = e;\n      }\n      if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production') {\n        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\".`, caughtError);\n      } else {\n        console.error(caughtError);\n      }\n      throw caughtError;\n    }\n  };\n  function isForcedQuery(arg: QueryThunkArg, state: RootState<any, string, ReducerPath>) {\n    const requestState = selectors.selectQueryEntry(state, arg.queryCacheKey);\n    const baseFetchOnMountOrArgChange = selectors.selectConfig(state).refetchOnMountOrArgChange;\n    const fulfilledVal = requestState?.fulfilledTimeStamp;\n    const refetchVal = arg.forceRefetch ?? (arg.subscribe && baseFetchOnMountOrArgChange);\n    if (refetchVal) {\n      // Return if it's true or compare the dates because it must be a number\n      return refetchVal === true || (Number(new Date()) - Number(fulfilledVal)) / 1000 >= refetchVal;\n    }\n    return false;\n  }\n  const createQueryThunk = <ThunkArgType extends QueryThunkArg | InfiniteQueryThunkArg<any>,>() => {\n    const generatedQueryThunk = createAsyncThunk<ThunkResult, ThunkArgType, ThunkApiMetaConfig & {\n      state: RootState<any, string, ReducerPath>;\n    }>(`${reducerPath}/executeQuery`, executeEndpoint, {\n      getPendingMeta({\n        arg\n      }) {\n        const endpointDefinition = endpointDefinitions[arg.endpointName];\n        return addShouldAutoBatch({\n          startedTimeStamp: Date.now(),\n          ...(isInfiniteQueryDefinition(endpointDefinition) ? {\n            direction: (arg as InfiniteQueryThunkArg<any>).direction\n          } : {})\n        });\n      },\n      condition(queryThunkArg, {\n        getState\n      }) {\n        const state = getState();\n        const requestState = selectors.selectQueryEntry(state, queryThunkArg.queryCacheKey);\n        const fulfilledVal = requestState?.fulfilledTimeStamp;\n        const currentArg = queryThunkArg.originalArgs;\n        const previousArg = requestState?.originalArgs;\n        const endpointDefinition = endpointDefinitions[queryThunkArg.endpointName];\n        const direction = (queryThunkArg as InfiniteQueryThunkArg<any>).direction;\n\n        // Order of these checks matters.\n        // In order for `upsertQueryData` to successfully run while an existing request is in flight,\n        /// we have to check for that first, otherwise `queryThunk` will bail out and not run at all.\n        if (isUpsertQuery(queryThunkArg)) {\n          return true;\n        }\n\n        // Don't retry a request that's currently in-flight\n        if (requestState?.status === 'pending') {\n          return false;\n        }\n\n        // if this is forced, continue\n        if (isForcedQuery(queryThunkArg, state)) {\n          return true;\n        }\n        if (isQueryDefinition(endpointDefinition) && endpointDefinition?.forceRefetch?.({\n          currentArg,\n          previousArg,\n          endpointState: requestState,\n          state\n        })) {\n          return true;\n        }\n\n        // Pull from the cache unless we explicitly force refetch or qualify based on time\n        if (fulfilledVal && !direction) {\n          // Value is cached and we didn't specify to refresh, skip it.\n          return false;\n        }\n        return true;\n      },\n      dispatchConditionRejection: true\n    });\n    return generatedQueryThunk;\n  };\n  const queryThunk = createQueryThunk<QueryThunkArg>();\n  const infiniteQueryThunk = createQueryThunk<InfiniteQueryThunkArg<any>>();\n  const mutationThunk = createAsyncThunk<ThunkResult, MutationThunkArg, ThunkApiMetaConfig & {\n    state: RootState<any, string, ReducerPath>;\n  }>(`${reducerPath}/executeMutation`, executeEndpoint, {\n    getPendingMeta() {\n      return addShouldAutoBatch({\n        startedTimeStamp: Date.now()\n      });\n    }\n  });\n  const hasTheForce = (options: any): options is {\n    force: boolean;\n  } => 'force' in options;\n  const hasMaxAge = (options: any): options is {\n    ifOlderThan: false | number;\n  } => 'ifOlderThan' in options;\n  const prefetch = <EndpointName extends QueryKeys<Definitions>,>(endpointName: EndpointName, arg: any, options: PrefetchOptions = {}): ThunkAction<void, any, any, UnknownAction> => (dispatch: ThunkDispatch<any, any, any>, getState: () => any) => {\n    const force = hasTheForce(options) && options.force;\n    const maxAge = hasMaxAge(options) && options.ifOlderThan;\n    const queryAction = (force: boolean = true) => {\n      const options: StartQueryActionCreatorOptions = {\n        forceRefetch: force,\n        subscribe: false\n      };\n      return (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).initiate(arg, options);\n    };\n    const latestStateValue = (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).select(arg)(getState());\n    if (force) {\n      dispatch(queryAction());\n    } else if (maxAge) {\n      const lastFulfilledTs = latestStateValue?.fulfilledTimeStamp;\n      if (!lastFulfilledTs) {\n        dispatch(queryAction());\n        return;\n      }\n      const shouldRetrigger = (Number(new Date()) - Number(new Date(lastFulfilledTs))) / 1000 >= maxAge;\n      if (shouldRetrigger) {\n        dispatch(queryAction());\n      }\n    } else {\n      // If prefetching with no options, just let it try\n      dispatch(queryAction(false));\n    }\n  };\n  function matchesEndpoint(endpointName: string) {\n    return (action: any): action is UnknownAction => action?.meta?.arg?.endpointName === endpointName;\n  }\n  function buildMatchThunkActions<Thunk extends AsyncThunk<any, QueryThunkArg, ThunkApiMetaConfig> | AsyncThunk<any, MutationThunkArg, ThunkApiMetaConfig>>(thunk: Thunk, endpointName: string) {\n    return {\n      matchPending: isAllOf(isPending(thunk), matchesEndpoint(endpointName)),\n      matchFulfilled: isAllOf(isFulfilled(thunk), matchesEndpoint(endpointName)),\n      matchRejected: isAllOf(isRejected(thunk), matchesEndpoint(endpointName))\n    } as Matchers<Thunk, any>;\n  }\n  return {\n    queryThunk,\n    mutationThunk,\n    infiniteQueryThunk,\n    prefetch,\n    updateQueryData,\n    upsertQueryData,\n    patchQueryData,\n    buildMatchThunkActions\n  };\n}\nexport function getNextPageParam(options: InfiniteQueryConfigOptions<unknown, unknown, unknown>, {\n  pages,\n  pageParams\n}: InfiniteData<unknown, unknown>, queryArg: unknown): unknown | undefined {\n  const lastIndex = pages.length - 1;\n  return options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams, queryArg);\n}\nexport function getPreviousPageParam(options: InfiniteQueryConfigOptions<unknown, unknown, unknown>, {\n  pages,\n  pageParams\n}: InfiniteData<unknown, unknown>, queryArg: unknown): unknown | undefined {\n  return options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams, queryArg);\n}\nexport function calculateProvidedByThunk(action: UnwrapPromise<ReturnType<ReturnType<QueryThunk>> | ReturnType<ReturnType<MutationThunk>> | ReturnType<ReturnType<InfiniteQueryThunk<any>>>>, type: 'providesTags' | 'invalidatesTags', endpointDefinitions: EndpointDefinitions, assertTagType: AssertTagTypes) {\n  return calculateProvidedBy(endpointDefinitions[action.meta.arg.endpointName][type] as ResultDescription<any, any, any, any, any>, isFulfilled(action) ? action.payload : undefined, isRejectedWithValue(action) ? action.payload : undefined, action.meta.arg.originalArgs, 'baseQueryMeta' in action.meta ? action.meta.baseQueryMeta : undefined, assertTagType);\n}","import type { Draft } from 'immer';\nimport { current, isDraft } from '../utils/immerImports';\nexport function getCurrent<T>(value: T | Draft<T>): T {\n  return (isDraft(value) ? current(value) : value) as T;\n}","import type { PayloadAction } from '@reduxjs/toolkit';\nimport { combineReducers, createAction, createSlice, isAnyOf, isFulfilled, isRejectedWithValue, createNextState, prepareAutoBatched, SHOULD_AUTOBATCH, nanoid } from './rtkImports';\nimport type { QuerySubstateIdentifier, QuerySubState, MutationSubstateIdentifier, MutationSubState, MutationState, QueryState, InvalidationState, Subscribers, QueryCacheKey, SubscriptionState, ConfigState, InfiniteQuerySubState, InfiniteQueryDirection } from './apiState';\nimport { STATUS_FULFILLED, STATUS_PENDING, QueryStatus, STATUS_REJECTED, STATUS_UNINITIALIZED } from './apiState';\nimport type { AllQueryKeys, QueryArgFromAnyQueryDefinition, DataFromAnyQueryDefinition, InfiniteQueryThunk, MutationThunk, QueryThunk, QueryThunkArg } from './buildThunks';\nimport { calculateProvidedByThunk } from './buildThunks';\nimport { ENDPOINT_QUERY, isInfiniteQueryDefinition, type AssertTagTypes, type EndpointDefinitions, type FullTagDescription, type QueryDefinition } from '../endpointDefinitions';\nimport type { Patch } from 'immer';\nimport { applyPatches, original, isDraft } from '../utils/immerImports';\nimport { onFocus, onFocusLost, onOffline, onOnline } from './setupListeners';\nimport { isDocumentVisible, isOnline, copyWithStructuralSharing } from '../utils';\nimport type { ApiContext } from '../apiTypes';\nimport { isUpsertQuery } from './buildInitiate';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { UnwrapPromise } from '../tsHelpers';\nimport { getCurrent } from '../utils/getCurrent';\n\n/**\n * A typesafe single entry to be upserted into the cache\n */\nexport type NormalizedQueryUpsertEntry<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = {\n  endpointName: EndpointName;\n  arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>;\n  value: DataFromAnyQueryDefinition<Definitions, EndpointName>;\n};\n\n/**\n * The internal version that is not typesafe since we can't carry the generics through `createSlice`\n */\ntype NormalizedQueryUpsertEntryPayload = {\n  endpointName: string;\n  arg: unknown;\n  value: unknown;\n};\nexport type ProcessedQueryUpsertEntry = {\n  queryDescription: QueryThunkArg;\n  value: unknown;\n};\n\n/**\n * A typesafe representation of a util action creator that accepts cache entry descriptions to upsert\n */\nexport type UpsertEntries<Definitions extends EndpointDefinitions> = (<EndpointNames extends Array<AllQueryKeys<Definitions>>>(entries: [...{ [I in keyof EndpointNames]: NormalizedQueryUpsertEntry<Definitions, EndpointNames[I]> }]) => PayloadAction<NormalizedQueryUpsertEntryPayload[]>) & {\n  match: (action: unknown) => action is PayloadAction<NormalizedQueryUpsertEntryPayload[]>;\n};\nfunction updateQuerySubstateIfExists(state: QueryState<any>, queryCacheKey: QueryCacheKey, update: (substate: QuerySubState<any> | InfiniteQuerySubState<any>) => void) {\n  const substate = state[queryCacheKey];\n  if (substate) {\n    update(substate);\n  }\n}\nexport function getMutationCacheKey(id: MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}): string;\nexport function getMutationCacheKey(id: {\n  fixedCacheKey?: string;\n  requestId?: string;\n}): string | undefined;\nexport function getMutationCacheKey(id: {\n  fixedCacheKey?: string;\n  requestId?: string;\n} | MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}): string | undefined {\n  return ('arg' in id ? id.arg.fixedCacheKey : id.fixedCacheKey) ?? id.requestId;\n}\nfunction updateMutationSubstateIfExists(state: MutationState<any>, id: MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}, update: (substate: MutationSubState<any>) => void) {\n  const substate = state[getMutationCacheKey(id)];\n  if (substate) {\n    update(substate);\n  }\n}\nconst initialState = {} as any;\nexport function buildSlice({\n  reducerPath,\n  queryThunk,\n  mutationThunk,\n  serializeQueryArgs,\n  context: {\n    endpointDefinitions: definitions,\n    apiUid,\n    extractRehydrationInfo,\n    hasRehydrationInfo\n  },\n  assertTagType,\n  config\n}: {\n  reducerPath: string;\n  queryThunk: QueryThunk;\n  infiniteQueryThunk: InfiniteQueryThunk<any>;\n  mutationThunk: MutationThunk;\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  context: ApiContext<EndpointDefinitions>;\n  assertTagType: AssertTagTypes;\n  config: Omit<ConfigState<string>, 'online' | 'focused' | 'middlewareRegistered'>;\n}) {\n  const resetApiState = createAction(`${reducerPath}/resetApiState`);\n  function writePendingCacheEntry(draft: QueryState<any>, arg: QueryThunkArg, upserting: boolean, meta: {\n    arg: QueryThunkArg;\n    requestId: string;\n    // requestStatus: 'pending'\n  } & {\n    startedTimeStamp: number;\n  }) {\n    draft[arg.queryCacheKey] ??= {\n      status: STATUS_UNINITIALIZED,\n      endpointName: arg.endpointName\n    };\n    updateQuerySubstateIfExists(draft, arg.queryCacheKey, substate => {\n      substate.status = STATUS_PENDING;\n      substate.requestId = upserting && substate.requestId ?\n      // for `upsertQuery` **updates**, keep the current `requestId`\n      substate.requestId :\n      // for normal queries or `upsertQuery` **inserts** always update the `requestId`\n      meta.requestId;\n      if (arg.originalArgs !== undefined) {\n        substate.originalArgs = arg.originalArgs;\n      }\n      substate.startedTimeStamp = meta.startedTimeStamp;\n      const endpointDefinition = definitions[meta.arg.endpointName];\n      if (isInfiniteQueryDefinition(endpointDefinition) && 'direction' in arg) {\n        ;\n        (substate as InfiniteQuerySubState<any>).direction = arg.direction as InfiniteQueryDirection;\n      }\n    });\n  }\n  function writeFulfilledCacheEntry(draft: QueryState<any>, meta: {\n    arg: QueryThunkArg;\n    requestId: string;\n  } & {\n    fulfilledTimeStamp: number;\n    baseQueryMeta: unknown;\n  }, payload: unknown, upserting: boolean) {\n    updateQuerySubstateIfExists(draft, meta.arg.queryCacheKey, substate => {\n      if (substate.requestId !== meta.requestId && !upserting) return;\n      const {\n        merge\n      } = definitions[meta.arg.endpointName] as QueryDefinition<any, any, any, any>;\n      substate.status = STATUS_FULFILLED;\n      if (merge) {\n        if (substate.data !== undefined) {\n          const {\n            fulfilledTimeStamp,\n            arg,\n            baseQueryMeta,\n            requestId\n          } = meta;\n          // There's existing cache data. Let the user merge it in themselves.\n          // We're already inside an Immer-powered reducer, and the user could just mutate `substate.data`\n          // themselves inside of `merge()`. But, they might also want to return a new value.\n          // Try to let Immer figure that part out, save the result, and assign it to `substate.data`.\n          let newData = createNextState(substate.data, draftSubstateData => {\n            // As usual with Immer, you can mutate _or_ return inside here, but not both\n            return merge(draftSubstateData, payload, {\n              arg: arg.originalArgs,\n              baseQueryMeta,\n              fulfilledTimeStamp,\n              requestId\n            });\n          });\n          substate.data = newData;\n        } else {\n          // Presumably a fresh request. Just cache the response data.\n          substate.data = payload;\n        }\n      } else {\n        // Assign or safely update the cache data.\n        substate.data = definitions[meta.arg.endpointName].structuralSharing ?? true ? copyWithStructuralSharing(isDraft(substate.data) ? original(substate.data) : substate.data, payload) : payload;\n      }\n      delete substate.error;\n      substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;\n    });\n  }\n  const querySlice = createSlice({\n    name: `${reducerPath}/queries`,\n    initialState: initialState as QueryState<any>,\n    reducers: {\n      removeQueryResult: {\n        reducer(draft, {\n          payload: {\n            queryCacheKey\n          }\n        }: PayloadAction<QuerySubstateIdentifier>) {\n          delete draft[queryCacheKey];\n        },\n        prepare: prepareAutoBatched<QuerySubstateIdentifier>()\n      },\n      cacheEntriesUpserted: {\n        reducer(draft, action: PayloadAction<ProcessedQueryUpsertEntry[], string, {\n          RTK_autoBatch: boolean;\n          requestId: string;\n          timestamp: number;\n        }>) {\n          for (const entry of action.payload) {\n            const {\n              queryDescription: arg,\n              value\n            } = entry;\n            writePendingCacheEntry(draft, arg, true, {\n              arg,\n              requestId: action.meta.requestId,\n              startedTimeStamp: action.meta.timestamp\n            });\n            writeFulfilledCacheEntry(draft, {\n              arg,\n              requestId: action.meta.requestId,\n              fulfilledTimeStamp: action.meta.timestamp,\n              baseQueryMeta: {}\n            }, value,\n            // We know we're upserting here\n            true);\n          }\n        },\n        prepare: (payload: NormalizedQueryUpsertEntryPayload[]) => {\n          const queryDescriptions: ProcessedQueryUpsertEntry[] = payload.map(entry => {\n            const {\n              endpointName,\n              arg,\n              value\n            } = entry;\n            const endpointDefinition = definitions[endpointName];\n            const queryDescription: QueryThunkArg = {\n              type: ENDPOINT_QUERY as 'query',\n              endpointName,\n              originalArgs: entry.arg,\n              queryCacheKey: serializeQueryArgs({\n                queryArgs: arg,\n                endpointDefinition,\n                endpointName\n              })\n            };\n            return {\n              queryDescription,\n              value\n            };\n          });\n          const result = {\n            payload: queryDescriptions,\n            meta: {\n              [SHOULD_AUTOBATCH]: true,\n              requestId: nanoid(),\n              timestamp: Date.now()\n            }\n          };\n          return result;\n        }\n      },\n      queryResultPatched: {\n        reducer(draft, {\n          payload: {\n            queryCacheKey,\n            patches\n          }\n        }: PayloadAction<QuerySubstateIdentifier & {\n          patches: readonly Patch[];\n        }>) {\n          updateQuerySubstateIfExists(draft, queryCacheKey, substate => {\n            substate.data = applyPatches(substate.data as any, patches.concat());\n          });\n        },\n        prepare: prepareAutoBatched<QuerySubstateIdentifier & {\n          patches: readonly Patch[];\n        }>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(queryThunk.pending, (draft, {\n        meta,\n        meta: {\n          arg\n        }\n      }) => {\n        const upserting = isUpsertQuery(arg);\n        writePendingCacheEntry(draft, arg, upserting, meta);\n      }).addCase(queryThunk.fulfilled, (draft, {\n        meta,\n        payload\n      }) => {\n        const upserting = isUpsertQuery(meta.arg);\n        writeFulfilledCacheEntry(draft, meta, payload, upserting);\n      }).addCase(queryThunk.rejected, (draft, {\n        meta: {\n          condition,\n          arg,\n          requestId\n        },\n        error,\n        payload\n      }) => {\n        updateQuerySubstateIfExists(draft, arg.queryCacheKey, substate => {\n          if (condition) {\n            // request was aborted due to condition (another query already running)\n          } else {\n            // request failed\n            if (substate.requestId !== requestId) return;\n            substate.status = STATUS_REJECTED;\n            substate.error = (payload ?? error) as any;\n          }\n        });\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          queries\n        } = extractRehydrationInfo(action)!;\n        for (const [key, entry] of Object.entries(queries)) {\n          if (\n          // do not rehydrate entries that were currently in flight.\n          entry?.status === STATUS_FULFILLED || entry?.status === STATUS_REJECTED) {\n            draft[key] = entry;\n          }\n        }\n      });\n    }\n  });\n  const mutationSlice = createSlice({\n    name: `${reducerPath}/mutations`,\n    initialState: initialState as MutationState<any>,\n    reducers: {\n      removeMutationResult: {\n        reducer(draft, {\n          payload\n        }: PayloadAction<MutationSubstateIdentifier>) {\n          const cacheKey = getMutationCacheKey(payload);\n          if (cacheKey in draft) {\n            delete draft[cacheKey];\n          }\n        },\n        prepare: prepareAutoBatched<MutationSubstateIdentifier>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(mutationThunk.pending, (draft, {\n        meta,\n        meta: {\n          requestId,\n          arg,\n          startedTimeStamp\n        }\n      }) => {\n        if (!arg.track) return;\n        draft[getMutationCacheKey(meta)] = {\n          requestId,\n          status: STATUS_PENDING,\n          endpointName: arg.endpointName,\n          startedTimeStamp\n        };\n      }).addCase(mutationThunk.fulfilled, (draft, {\n        payload,\n        meta\n      }) => {\n        if (!meta.arg.track) return;\n        updateMutationSubstateIfExists(draft, meta, substate => {\n          if (substate.requestId !== meta.requestId) return;\n          substate.status = STATUS_FULFILLED;\n          substate.data = payload;\n          substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;\n        });\n      }).addCase(mutationThunk.rejected, (draft, {\n        payload,\n        error,\n        meta\n      }) => {\n        if (!meta.arg.track) return;\n        updateMutationSubstateIfExists(draft, meta, substate => {\n          if (substate.requestId !== meta.requestId) return;\n          substate.status = STATUS_REJECTED;\n          substate.error = (payload ?? error) as any;\n        });\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          mutations\n        } = extractRehydrationInfo(action)!;\n        for (const [key, entry] of Object.entries(mutations)) {\n          if (\n          // do not rehydrate entries that were currently in flight.\n          (entry?.status === STATUS_FULFILLED || entry?.status === STATUS_REJECTED) &&\n          // only rehydrate endpoints that were persisted using a `fixedCacheKey`\n          key !== entry?.requestId) {\n            draft[key] = entry;\n          }\n        }\n      });\n    }\n  });\n  type CalculateProvidedByAction = UnwrapPromise<ReturnType<ReturnType<QueryThunk>> | ReturnType<ReturnType<InfiniteQueryThunk<any>>>>;\n  const initialInvalidationState: InvalidationState<string> = {\n    tags: {},\n    keys: {}\n  };\n  const invalidationSlice = createSlice({\n    name: `${reducerPath}/invalidation`,\n    initialState: initialInvalidationState,\n    reducers: {\n      updateProvidedBy: {\n        reducer(draft, action: PayloadAction<Array<{\n          queryCacheKey: QueryCacheKey;\n          providedTags: readonly FullTagDescription<string>[];\n        }>>) {\n          for (const {\n            queryCacheKey,\n            providedTags\n          } of action.payload) {\n            removeCacheKeyFromTags(draft, queryCacheKey);\n            for (const {\n              type,\n              id\n            } of providedTags) {\n              const subscribedQueries = (draft.tags[type] ??= {})[id || '__internal_without_id'] ??= [];\n              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);\n              if (!alreadySubscribed) {\n                subscribedQueries.push(queryCacheKey);\n              }\n            }\n\n            // Remove readonly from the providedTags array\n            draft.keys[queryCacheKey] = providedTags as FullTagDescription<string>[];\n          }\n        },\n        prepare: prepareAutoBatched<Array<{\n          queryCacheKey: QueryCacheKey;\n          providedTags: readonly FullTagDescription<string>[];\n        }>>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(querySlice.actions.removeQueryResult, (draft, {\n        payload: {\n          queryCacheKey\n        }\n      }) => {\n        removeCacheKeyFromTags(draft, queryCacheKey);\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          provided\n        } = extractRehydrationInfo(action)!;\n        for (const [type, incomingTags] of Object.entries(provided.tags ?? {})) {\n          for (const [id, cacheKeys] of Object.entries(incomingTags)) {\n            const subscribedQueries = (draft.tags[type] ??= {})[id || '__internal_without_id'] ??= [];\n            for (const queryCacheKey of cacheKeys) {\n              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);\n              if (!alreadySubscribed) {\n                subscribedQueries.push(queryCacheKey);\n              }\n              draft.keys[queryCacheKey] = provided.keys[queryCacheKey];\n            }\n          }\n        }\n      }).addMatcher(isAnyOf(isFulfilled(queryThunk), isRejectedWithValue(queryThunk)), (draft, action) => {\n        writeProvidedTagsForQueries(draft, [action]);\n      }).addMatcher(querySlice.actions.cacheEntriesUpserted.match, (draft, action) => {\n        const mockActions: CalculateProvidedByAction[] = action.payload.map(({\n          queryDescription,\n          value\n        }) => {\n          return {\n            type: 'UNKNOWN',\n            payload: value,\n            meta: {\n              requestStatus: 'fulfilled',\n              requestId: 'UNKNOWN',\n              arg: queryDescription\n            }\n          };\n        });\n        writeProvidedTagsForQueries(draft, mockActions);\n      });\n    }\n  });\n  function removeCacheKeyFromTags(draft: InvalidationState<any>, queryCacheKey: QueryCacheKey) {\n    const existingTags = getCurrent(draft.keys[queryCacheKey] ?? []);\n\n    // Delete this cache key from any existing tags that may have provided it\n    for (const tag of existingTags) {\n      const tagType = tag.type;\n      const tagId = tag.id ?? '__internal_without_id';\n      const tagSubscriptions = draft.tags[tagType]?.[tagId];\n      if (tagSubscriptions) {\n        draft.tags[tagType][tagId] = getCurrent(tagSubscriptions).filter(qc => qc !== queryCacheKey);\n      }\n    }\n    delete draft.keys[queryCacheKey];\n  }\n  function writeProvidedTagsForQueries(draft: InvalidationState<string>, actions: CalculateProvidedByAction[]) {\n    const providedByEntries = actions.map(action => {\n      const providedTags = calculateProvidedByThunk(action, 'providesTags', definitions, assertTagType);\n      const {\n        queryCacheKey\n      } = action.meta.arg;\n      return {\n        queryCacheKey,\n        providedTags\n      };\n    });\n    invalidationSlice.caseReducers.updateProvidedBy(draft, invalidationSlice.actions.updateProvidedBy(providedByEntries));\n  }\n\n  // Dummy slice to generate actions\n  const subscriptionSlice = createSlice({\n    name: `${reducerPath}/subscriptions`,\n    initialState: initialState as SubscriptionState,\n    reducers: {\n      updateSubscriptionOptions(d, a: PayloadAction<{\n        endpointName: string;\n        requestId: string;\n        options: Subscribers[number];\n      } & QuerySubstateIdentifier>) {\n        // Dummy\n      },\n      unsubscribeQueryResult(d, a: PayloadAction<{\n        requestId: string;\n      } & QuerySubstateIdentifier>) {\n        // Dummy\n      },\n      internal_getRTKQSubscriptions() {}\n    }\n  });\n  const internalSubscriptionsSlice = createSlice({\n    name: `${reducerPath}/internalSubscriptions`,\n    initialState: initialState as SubscriptionState,\n    reducers: {\n      subscriptionsUpdated: {\n        reducer(state, action: PayloadAction<Patch[]>) {\n          return applyPatches(state, action.payload);\n        },\n        prepare: prepareAutoBatched<Patch[]>()\n      }\n    }\n  });\n  const configSlice = createSlice({\n    name: `${reducerPath}/config`,\n    initialState: {\n      online: isOnline(),\n      focused: isDocumentVisible(),\n      middlewareRegistered: false,\n      ...config\n    } as ConfigState<string>,\n    reducers: {\n      middlewareRegistered(state, {\n        payload\n      }: PayloadAction<string>) {\n        state.middlewareRegistered = state.middlewareRegistered === 'conflict' || apiUid !== payload ? 'conflict' : true;\n      }\n    },\n    extraReducers: builder => {\n      builder.addCase(onOnline, state => {\n        state.online = true;\n      }).addCase(onOffline, state => {\n        state.online = false;\n      }).addCase(onFocus, state => {\n        state.focused = true;\n      }).addCase(onFocusLost, state => {\n        state.focused = false;\n      })\n      // update the state to be a new object to be picked up as a \"state change\"\n      // by redux-persist's `autoMergeLevel2`\n      .addMatcher(hasRehydrationInfo, draft => ({\n        ...draft\n      }));\n    }\n  });\n  const combinedReducer = combineReducers({\n    queries: querySlice.reducer,\n    mutations: mutationSlice.reducer,\n    provided: invalidationSlice.reducer,\n    subscriptions: internalSubscriptionsSlice.reducer,\n    config: configSlice.reducer\n  });\n  const reducer: typeof combinedReducer = (state, action) => combinedReducer(resetApiState.match(action) ? undefined : state, action);\n  const actions = {\n    ...configSlice.actions,\n    ...querySlice.actions,\n    ...subscriptionSlice.actions,\n    ...internalSubscriptionsSlice.actions,\n    ...mutationSlice.actions,\n    ...invalidationSlice.actions,\n    resetApiState\n  };\n  return {\n    reducer,\n    actions\n  };\n}\nexport type SliceActions = ReturnType<typeof buildSlice>['actions'];","import type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { EndpointDefinition, EndpointDefinitions, InfiniteQueryArgFrom, InfiniteQueryDefinition, MutationDefinition, QueryArgFrom, QueryArgFromAnyQuery, QueryDefinition, ReducerPathFrom, TagDescription, TagTypesFrom } from '../endpointDefinitions';\nimport { expandTagDescription } from '../endpointDefinitions';\nimport { filterMap, isNotNullish } from '../utils';\nimport type { InfiniteData, InfiniteQueryConfigOptions, InfiniteQuerySubState, MutationSubState, QueryCacheKey, QueryState, QuerySubState, RequestStatusFlags, RootState as _RootState, QueryStatus } from './apiState';\nimport { STATUS_UNINITIALIZED, getRequestStatusFlags } from './apiState';\nimport { getMutationCacheKey } from './buildSlice';\nimport type { createSelector as _createSelector } from './rtkImports';\nimport { createNextState } from './rtkImports';\nimport { type AllQueryKeys, getNextPageParam, getPreviousPageParam } from './buildThunks';\nexport type SkipToken = typeof skipToken;\n/**\n * Can be passed into `useQuery`, `useQueryState` or `useQuerySubscription`\n * instead of the query argument to get the same effect as if setting\n * `skip: true` in the query options.\n *\n * Useful for scenarios where a query should be skipped when `arg` is `undefined`\n * and TypeScript complains about it because `arg` is not allowed to be passed\n * in as `undefined`, such as\n *\n * ```ts\n * // codeblock-meta title=\"will error if the query argument is not allowed to be undefined\" no-transpile\n * useSomeQuery(arg, { skip: !!arg })\n * ```\n *\n * ```ts\n * // codeblock-meta title=\"using skipToken instead\" no-transpile\n * useSomeQuery(arg ?? skipToken)\n * ```\n *\n * If passed directly into a query or mutation selector, that selector will always\n * return an uninitialized state.\n */\nexport const skipToken = /* @__PURE__ */Symbol.for('RTKQ/skipToken');\nexport type BuildSelectorsApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: QueryResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\nexport type BuildSelectorsApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: InfiniteQueryResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\nexport type BuildSelectorsApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: MutationResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\ntype QueryResultSelectorFactory<Definition extends QueryDefinition<any, any, any, any>, RootState> = (queryArg: QueryArgFrom<Definition> | SkipToken) => (state: RootState) => QueryResultSelectorResult<Definition>;\nexport type QueryResultSelectorResult<Definition extends QueryDefinition<any, any, any, any>> = QuerySubState<Definition> & RequestStatusFlags;\ntype InfiniteQueryResultSelectorFactory<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, RootState> = (queryArg: InfiniteQueryArgFrom<Definition> | SkipToken) => (state: RootState) => InfiniteQueryResultSelectorResult<Definition>;\nexport type InfiniteQueryResultFlags = {\n  hasNextPage: boolean;\n  hasPreviousPage: boolean;\n  isFetchingNextPage: boolean;\n  isFetchingPreviousPage: boolean;\n  isFetchNextPageError: boolean;\n  isFetchPreviousPageError: boolean;\n};\nexport type InfiniteQueryResultSelectorResult<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = InfiniteQuerySubState<Definition> & RequestStatusFlags & InfiniteQueryResultFlags;\ntype MutationResultSelectorFactory<Definition extends MutationDefinition<any, any, any, any>, RootState> = (requestId: string | {\n  requestId: string | undefined;\n  fixedCacheKey: string | undefined;\n} | SkipToken) => (state: RootState) => MutationResultSelectorResult<Definition>;\nexport type MutationResultSelectorResult<Definition extends MutationDefinition<any, any, any, any>> = MutationSubState<Definition> & RequestStatusFlags;\nconst initialSubState: QuerySubState<any> = {\n  status: STATUS_UNINITIALIZED\n};\n\n// abuse immer to freeze default states\nconst defaultQuerySubState = /* @__PURE__ */createNextState(initialSubState, () => {});\nconst defaultMutationSubState = /* @__PURE__ */createNextState(initialSubState as MutationSubState<any>, () => {});\nexport type AllSelectors = ReturnType<typeof buildSelectors>;\nexport function buildSelectors<Definitions extends EndpointDefinitions, ReducerPath extends string>({\n  serializeQueryArgs,\n  reducerPath,\n  createSelector\n}: {\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  reducerPath: ReducerPath;\n  createSelector: typeof _createSelector;\n}) {\n  type RootState = _RootState<Definitions, string, string>;\n  const selectSkippedQuery = (state: RootState) => defaultQuerySubState;\n  const selectSkippedMutation = (state: RootState) => defaultMutationSubState;\n  return {\n    buildQuerySelector,\n    buildInfiniteQuerySelector,\n    buildMutationSelector,\n    selectInvalidatedBy,\n    selectCachedArgsForQuery,\n    selectApiState,\n    selectQueries,\n    selectMutations,\n    selectQueryEntry,\n    selectConfig\n  };\n  function withRequestFlags<T extends {\n    status: QueryStatus;\n  }>(substate: T): T & RequestStatusFlags {\n    return {\n      ...substate,\n      ...getRequestStatusFlags(substate.status)\n    };\n  }\n  function selectApiState(rootState: RootState) {\n    const state = rootState[reducerPath];\n    if (process.env.NODE_ENV !== 'production') {\n      if (!state) {\n        if ((selectApiState as any).triggered) return state;\n        (selectApiState as any).triggered = true;\n        console.error(`Error: No data found at \\`state.${reducerPath}\\`. Did you forget to add the reducer to the store?`);\n      }\n    }\n    return state;\n  }\n  function selectQueries(rootState: RootState) {\n    return selectApiState(rootState)?.queries;\n  }\n  function selectQueryEntry(rootState: RootState, cacheKey: QueryCacheKey) {\n    return selectQueries(rootState)?.[cacheKey];\n  }\n  function selectMutations(rootState: RootState) {\n    return selectApiState(rootState)?.mutations;\n  }\n  function selectConfig(rootState: RootState) {\n    return selectApiState(rootState)?.config;\n  }\n  function buildAnyQuerySelector(endpointName: string, endpointDefinition: EndpointDefinition<any, any, any, any>, combiner: <T extends {\n    status: QueryStatus;\n  }>(substate: T) => T & RequestStatusFlags) {\n    return (queryArgs: any) => {\n      // Avoid calling serializeQueryArgs if the arg is skipToken\n      if (queryArgs === skipToken) {\n        return createSelector(selectSkippedQuery, combiner);\n      }\n      const serializedArgs = serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      });\n      const selectQuerySubstate = (state: RootState) => selectQueryEntry(state, serializedArgs) ?? defaultQuerySubState;\n      return createSelector(selectQuerySubstate, combiner);\n    };\n  }\n  function buildQuerySelector(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any>) {\n    return buildAnyQuerySelector(endpointName, endpointDefinition, withRequestFlags) as QueryResultSelectorFactory<any, RootState>;\n  }\n  function buildInfiniteQuerySelector(endpointName: string, endpointDefinition: InfiniteQueryDefinition<any, any, any, any, any>) {\n    const {\n      infiniteQueryOptions\n    } = endpointDefinition;\n    function withInfiniteQueryResultFlags<T extends {\n      status: QueryStatus;\n    }>(substate: T): T & RequestStatusFlags & InfiniteQueryResultFlags {\n      const stateWithRequestFlags = {\n        ...(substate as InfiniteQuerySubState<any>),\n        ...getRequestStatusFlags(substate.status)\n      };\n      const {\n        isLoading,\n        isError,\n        direction\n      } = stateWithRequestFlags;\n      const isForward = direction === 'forward';\n      const isBackward = direction === 'backward';\n      return {\n        ...stateWithRequestFlags,\n        hasNextPage: getHasNextPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),\n        hasPreviousPage: getHasPreviousPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),\n        isFetchingNextPage: isLoading && isForward,\n        isFetchingPreviousPage: isLoading && isBackward,\n        isFetchNextPageError: isError && isForward,\n        isFetchPreviousPageError: isError && isBackward\n      };\n    }\n    return buildAnyQuerySelector(endpointName, endpointDefinition, withInfiniteQueryResultFlags) as unknown as InfiniteQueryResultSelectorFactory<any, RootState>;\n  }\n  function buildMutationSelector() {\n    return (id => {\n      let mutationId: string | typeof skipToken;\n      if (typeof id === 'object') {\n        mutationId = getMutationCacheKey(id) ?? skipToken;\n      } else {\n        mutationId = id;\n      }\n      const selectMutationSubstate = (state: RootState) => selectApiState(state)?.mutations?.[mutationId as string] ?? defaultMutationSubState;\n      const finalSelectMutationSubstate = mutationId === skipToken ? selectSkippedMutation : selectMutationSubstate;\n      return createSelector(finalSelectMutationSubstate, withRequestFlags);\n    }) as MutationResultSelectorFactory<any, RootState>;\n  }\n  function selectInvalidatedBy(state: RootState, tags: ReadonlyArray<TagDescription<string> | null | undefined>): Array<{\n    endpointName: string;\n    originalArgs: any;\n    queryCacheKey: QueryCacheKey;\n  }> {\n    const apiState = state[reducerPath];\n    const toInvalidate = new Set<QueryCacheKey>();\n    const finalTags = filterMap(tags, isNotNullish, expandTagDescription);\n    for (const tag of finalTags) {\n      const provided = apiState.provided.tags[tag.type];\n      if (!provided) {\n        continue;\n      }\n      let invalidateSubscriptions = (tag.id !== undefined ?\n      // id given: invalidate all queries that provide this type & id\n      provided[tag.id] :\n      // no id: invalidate all queries that provide this type\n      Object.values(provided).flat()) ?? [];\n      for (const invalidate of invalidateSubscriptions) {\n        toInvalidate.add(invalidate);\n      }\n    }\n    return Array.from(toInvalidate.values()).flatMap(queryCacheKey => {\n      const querySubState = apiState.queries[queryCacheKey];\n      return querySubState ? {\n        queryCacheKey,\n        endpointName: querySubState.endpointName!,\n        originalArgs: querySubState.originalArgs\n      } : [];\n    });\n  }\n  function selectCachedArgsForQuery<QueryName extends AllQueryKeys<Definitions>>(state: RootState, queryName: QueryName): Array<QueryArgFromAnyQuery<Definitions[QueryName]>> {\n    return filterMap(Object.values(selectQueries(state) as QueryState<any>), (entry): entry is Exclude<QuerySubState<Definitions[QueryName]>, {\n      status: QueryStatus.uninitialized;\n    }> => entry?.endpointName === queryName && entry.status !== STATUS_UNINITIALIZED, entry => entry.originalArgs);\n  }\n  function getHasNextPage(options: InfiniteQueryConfigOptions<any, any, any>, data?: InfiniteData<unknown, unknown>, queryArg?: unknown): boolean {\n    if (!data) return false;\n    return getNextPageParam(options, data, queryArg) != null;\n  }\n  function getHasPreviousPage(options: InfiniteQueryConfigOptions<any, any, any>, data?: InfiniteData<unknown, unknown>, queryArg?: unknown): boolean {\n    if (!data || !options.getPreviousPageParam) return false;\n    return getPreviousPageParam(options, data, queryArg) != null;\n  }\n}","import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3 } from \"@reduxjs/toolkit\";\nimport { getEndpointDefinition, type Api, type ApiContext, type Module, type ModuleName } from './apiTypes';\nimport type { CombinedState } from './core/apiState';\nimport type { BaseQueryArg, BaseQueryFn } from './baseQueryTypes';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport { defaultSerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { EndpointBuilder, EndpointDefinitions, SchemaFailureConverter, SchemaFailureHandler, SchemaType } from './endpointDefinitions';\nimport { DefinitionType, ENDPOINT_INFINITEQUERY, ENDPOINT_MUTATION, ENDPOINT_QUERY, isInfiniteQueryDefinition, isQueryDefinition } from './endpointDefinitions';\nimport { nanoid } from './core/rtkImports';\nimport type { UnknownAction } from '@reduxjs/toolkit';\nimport type { NoInfer } from './tsHelpers';\nimport { weakMapMemoize } from 'reselect';\nexport interface CreateApiOptions<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string = 'api', TagTypes extends string = never> {\n  /**\n   * The base query used by each endpoint if no `queryFn` option is specified. RTK Query exports a utility called [fetchBaseQuery](./fetchBaseQuery) as a lightweight wrapper around `fetch` for common use-cases. See [Customizing Queries](../../rtk-query/usage/customizing-queries) if `fetchBaseQuery` does not handle your requirements.\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   *\n   * const api = createApi({\n   *   // highlight-start\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // ...endpoints\n   *   }),\n   * })\n   * ```\n   */\n  baseQuery: BaseQuery;\n  /**\n   * An array of string tag type names. Specifying tag types is optional, but you should define them so that they can be used for caching and invalidation. When defining a tag type, you will be able to [provide](../../rtk-query/usage/automated-refetching#providing-tags) them with `providesTags` and [invalidate](../../rtk-query/usage/automated-refetching#invalidating-tags) them with `invalidatesTags` when configuring [endpoints](#endpoints).\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-start\n   *   tagTypes: ['Post', 'User'],\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // ...endpoints\n   *   }),\n   * })\n   * ```\n   */\n  tagTypes?: readonly TagTypes[];\n  /**\n   * The `reducerPath` is a _unique_ key that your service will be mounted to in your store. If you call `createApi` more than once in your application, you will need to provide a unique value each time. Defaults to `'api'`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"apis.js\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query';\n   *\n   * const apiOne = createApi({\n   *   // highlight-start\n   *   reducerPath: 'apiOne',\n   *   // highlight-end\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (builder) => ({\n   *     // ...endpoints\n   *   }),\n   * });\n   *\n   * const apiTwo = createApi({\n   *   // highlight-start\n   *   reducerPath: 'apiTwo',\n   *   // highlight-end\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (builder) => ({\n   *     // ...endpoints\n   *   }),\n   * });\n   * ```\n   */\n  reducerPath?: ReducerPath;\n  /**\n   * Accepts a custom function if you have a need to change the creation of cache keys for any reason.\n   */\n  serializeQueryArgs?: SerializeQueryArgs<unknown>;\n  /**\n   * Endpoints are a set of operations that you want to perform against your server. You define them as an object using the builder syntax. There are three endpoint types: [`query`](../../rtk-query/usage/queries), [`infiniteQuery`](../../rtk-query/usage/infinite-queries) and [`mutation`](../../rtk-query/usage/mutations).\n   */\n  endpoints(build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>): Definitions;\n  /**\n   * Defaults to `60` _(this value is in seconds)_. This is how long RTK Query will keep your data cached for **after** the last component unsubscribes. For example, if you query an endpoint, then unmount the component, then mount another component that makes the same request within the given time frame, the most recent value will be served from the cache.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"keepUnusedDataFor example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts'\n   *     })\n   *   }),\n   *   // highlight-start\n   *   keepUnusedDataFor: 5\n   *   // highlight-end\n   * })\n   * ```\n   */\n  keepUnusedDataFor?: number;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after the application window regains focus.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnFocus?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after regaining a network connection.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnReconnect?: boolean;\n  /**\n   * Defaults to `'delayed'`. This setting allows you to control when tags are invalidated after a mutation.\n   *\n   * - `'immediately'`: Queries are invalidated instantly after the mutation finished, even if they are running.\n   *   If the query provides tags that were invalidated while it ran, it won't be re-fetched.\n   * - `'delayed'`: Invalidation only happens after all queries and mutations are settled.\n   *   This ensures that queries are always invalidated correctly and automatically \"batches\" invalidations of concurrent mutations.\n   *   Note that if you constantly have some queries (or mutations) running, this can delay tag invalidations indefinitely.\n   */\n  invalidationBehavior?: 'delayed' | 'immediately';\n  /**\n   * A function that is passed every dispatched action. If this returns something other than `undefined`,\n   * that return value will be used to rehydrate fulfilled & errored queries.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"next-redux-wrapper rehydration example\"\n   * import type { Action, PayloadAction } from '@reduxjs/toolkit'\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import { HYDRATE } from 'next-redux-wrapper'\n   *\n   * type RootState = any; // normally inferred from state\n   *\n   * function isHydrateAction(action: Action): action is PayloadAction<RootState> {\n   *   return action.type === HYDRATE\n   * }\n   *\n   * export const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-start\n   *   extractRehydrationInfo(action, { reducerPath }): any {\n   *     if (isHydrateAction(action)) {\n   *       return action.payload[reducerPath]\n   *     }\n   *   },\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // omitted\n   *   }),\n   * })\n   * ```\n   */\n  extractRehydrationInfo?: (action: UnknownAction, {\n    reducerPath\n  }: {\n    reducerPath: ReducerPath;\n  }) => undefined | CombinedState<NoInfer<Definitions>, NoInfer<TagTypes>, NoInfer<ReducerPath>>;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *     }),\n   *   }),\n   *   onSchemaFailure: (error, info) => {\n   *     console.error(error, info)\n   *   },\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *     }),\n   *   }),\n   *   catchSchemaFailure: (error, info) => ({\n   *     status: \"CUSTOM_ERROR\",\n   *     error: error.schemaName + \" failed validation\",\n   *     data: error.issues,\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for all endpoints, unless overridden by the endpoint.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type CreateApi<Modules extends ModuleName> = {\n  /**\n   * Creates a service to use in your application. Contains only the basic redux logic (the core module).\n   *\n   * @link https://redux-toolkit.js.org/rtk-query/api/createApi\n   */\n  <BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string = 'api', TagTypes extends string = never>(options: CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>): Api<BaseQuery, Definitions, ReducerPath, TagTypes, Modules>;\n};\n\n/**\n * Builds a `createApi` method based on the provided `modules`.\n *\n * @link https://redux-toolkit.js.org/rtk-query/usage/customizing-create-api\n *\n * @example\n * ```ts\n * const MyContext = React.createContext<ReactReduxContextValue | null>(null);\n * const customCreateApi = buildCreateApi(\n *   coreModule(),\n *   reactHooksModule({\n *     hooks: {\n *       useDispatch: createDispatchHook(MyContext),\n *       useSelector: createSelectorHook(MyContext),\n *       useStore: createStoreHook(MyContext)\n *     }\n *   })\n * );\n * ```\n *\n * @param modules - A variable number of modules that customize how the `createApi` method handles endpoints\n * @returns A `createApi` method using the provided `modules`.\n */\nexport function buildCreateApi<Modules extends [Module<any>, ...Module<any>[]]>(...modules: Modules): CreateApi<Modules[number]['name']> {\n  return function baseCreateApi(options) {\n    const extractRehydrationInfo = weakMapMemoize((action: UnknownAction) => options.extractRehydrationInfo?.(action, {\n      reducerPath: (options.reducerPath ?? 'api') as any\n    }));\n    const optionsWithDefaults: CreateApiOptions<any, any, any, any> = {\n      reducerPath: 'api',\n      keepUnusedDataFor: 60,\n      refetchOnMountOrArgChange: false,\n      refetchOnFocus: false,\n      refetchOnReconnect: false,\n      invalidationBehavior: 'delayed',\n      ...options,\n      extractRehydrationInfo,\n      serializeQueryArgs(queryArgsApi) {\n        let finalSerializeQueryArgs = defaultSerializeQueryArgs;\n        if ('serializeQueryArgs' in queryArgsApi.endpointDefinition) {\n          const endpointSQA = queryArgsApi.endpointDefinition.serializeQueryArgs!;\n          finalSerializeQueryArgs = queryArgsApi => {\n            const initialResult = endpointSQA(queryArgsApi);\n            if (typeof initialResult === 'string') {\n              // If the user function returned a string, use it as-is\n              return initialResult;\n            } else {\n              // Assume they returned an object (such as a subset of the original\n              // query args) or a primitive, and serialize it ourselves\n              return defaultSerializeQueryArgs({\n                ...queryArgsApi,\n                queryArgs: initialResult\n              });\n            }\n          };\n        } else if (options.serializeQueryArgs) {\n          finalSerializeQueryArgs = options.serializeQueryArgs;\n        }\n        return finalSerializeQueryArgs(queryArgsApi);\n      },\n      tagTypes: [...(options.tagTypes || [])]\n    };\n    const context: ApiContext<EndpointDefinitions> = {\n      endpointDefinitions: {},\n      batch(fn) {\n        // placeholder \"batch\" method to be overridden by plugins, for example with React.unstable_batchedUpdate\n        fn();\n      },\n      apiUid: nanoid(),\n      extractRehydrationInfo,\n      hasRehydrationInfo: weakMapMemoize(action => extractRehydrationInfo(action) != null)\n    };\n    const api = {\n      injectEndpoints,\n      enhanceEndpoints({\n        addTagTypes,\n        endpoints\n      }) {\n        if (addTagTypes) {\n          for (const eT of addTagTypes) {\n            if (!optionsWithDefaults.tagTypes!.includes(eT as any)) {\n              ;\n              (optionsWithDefaults.tagTypes as any[]).push(eT);\n            }\n          }\n        }\n        if (endpoints) {\n          for (const [endpointName, partialDefinition] of Object.entries(endpoints)) {\n            if (typeof partialDefinition === 'function') {\n              partialDefinition(getEndpointDefinition(context, endpointName));\n            } else {\n              Object.assign(getEndpointDefinition(context, endpointName) || {}, partialDefinition);\n            }\n          }\n        }\n        return api;\n      }\n    } as Api<BaseQueryFn, {}, string, string, Modules[number]['name']>;\n    const initializedModules = modules.map(m => m.init(api as any, optionsWithDefaults as any, context));\n    function injectEndpoints(inject: Parameters<typeof api.injectEndpoints>[0]) {\n      const evaluatedEndpoints = inject.endpoints({\n        query: x => ({\n          ...x,\n          type: ENDPOINT_QUERY\n        }) as any,\n        mutation: x => ({\n          ...x,\n          type: ENDPOINT_MUTATION\n        }) as any,\n        infiniteQuery: x => ({\n          ...x,\n          type: ENDPOINT_INFINITEQUERY\n        }) as any\n      });\n      for (const [endpointName, definition] of Object.entries(evaluatedEndpoints)) {\n        if (inject.overrideExisting !== true && endpointName in context.endpointDefinitions) {\n          if (inject.overrideExisting === 'throw') {\n            throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(39) : `called \\`injectEndpoints\\` to override already-existing endpointName ${endpointName} without specifying \\`overrideExisting: true\\``);\n          } else if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n            console.error(`called \\`injectEndpoints\\` to override already-existing endpointName ${endpointName} without specifying \\`overrideExisting: true\\``);\n          }\n          continue;\n        }\n        if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n          if (isInfiniteQueryDefinition(definition)) {\n            const {\n              infiniteQueryOptions\n            } = definition;\n            const {\n              maxPages,\n              getPreviousPageParam\n            } = infiniteQueryOptions;\n            if (typeof maxPages === 'number') {\n              if (maxPages < 1) {\n                throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(40) : `maxPages for endpoint '${endpointName}' must be a number greater than 0`);\n              }\n              if (typeof getPreviousPageParam !== 'function') {\n                throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(41) : `getPreviousPageParam for endpoint '${endpointName}' must be a function if maxPages is used`);\n              }\n            }\n          }\n        }\n        context.endpointDefinitions[endpointName] = definition;\n        for (const m of initializedModules) {\n          m.injectEndpoint(endpointName, definition);\n        }\n      }\n      return api as any;\n    }\n    return api.injectEndpoints({\n      endpoints: options.endpoints as any\n    });\n  };\n}","import type { QueryCacheKey } from './core/apiState';\nimport type { EndpointDefinition } from './endpointDefinitions';\nimport { isPlainObject } from './core/rtkImports';\nconst cache: WeakMap<any, string> | undefined = WeakMap ? new WeakMap() : undefined;\nexport const defaultSerializeQueryArgs: SerializeQueryArgs<any> = ({\n  endpointName,\n  queryArgs\n}) => {\n  let serialized = '';\n  const cached = cache?.get(queryArgs);\n  if (typeof cached === 'string') {\n    serialized = cached;\n  } else {\n    const stringified = JSON.stringify(queryArgs, (key, value) => {\n      // Handle bigints\n      value = typeof value === 'bigint' ? {\n        $bigint: value.toString()\n      } : value;\n      // Sort the object keys before stringifying, to prevent useQuery({ a: 1, b: 2 }) having a different cache key than useQuery({ b: 2, a: 1 })\n      value = isPlainObject(value) ? Object.keys(value).sort().reduce<any>((acc, key) => {\n        acc[key] = (value as any)[key];\n        return acc;\n      }, {}) : value;\n      return value;\n    });\n    if (isPlainObject(queryArgs)) {\n      cache?.set(queryArgs, stringified);\n    }\n    serialized = stringified;\n  }\n  return `${endpointName}(${serialized})`;\n};\nexport type SerializeQueryArgs<QueryArgs, ReturnType = string> = (_: {\n  queryArgs: QueryArgs;\n  endpointDefinition: EndpointDefinition<any, any, any, any>;\n  endpointName: string;\n}) => ReturnType;\nexport type InternalSerializeQueryArgs = (_: {\n  queryArgs: any;\n  endpointDefinition: EndpointDefinition<any, any, any, any>;\n  endpointName: string;\n}) => QueryCacheKey;","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { BaseQueryFn } from './baseQueryTypes';\nexport const _NEVER = /* @__PURE__ */Symbol();\nexport type NEVER = typeof _NEVER;\n\n/**\n * Creates a \"fake\" baseQuery to be used if your api *only* uses the `queryFn` definition syntax.\n * This also allows you to specify a specific error type to be shared by all your `queryFn` definitions.\n */\nexport function fakeBaseQuery<ErrorType>(): BaseQueryFn<void, NEVER, ErrorType, {}> {\n  return function () {\n    throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(33) : 'When using `fakeBaseQuery`, all queries & mutations must use the `queryFn` definition syntax.');\n  };\n}","export type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type Override<T1, T2> = T2 extends any ? Omit<T1, keyof T2> & T2 : never;\nexport function assertCast<T>(v: any): asserts v is T {}\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>): T {\n  return Object.assign(target, ...args);\n}\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\nexport type NonOptionalKeys<T> = { [K in keyof T]-?: undefined extends T[K] ? never : K }[keyof T];\nexport type HasRequiredProps<T, True, False> = NonOptionalKeys<T> extends never ? False : True;\nexport type OptionalIfAllPropsOptional<T> = HasRequiredProps<T, T, T | never>;\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type UnwrapPromise<T> = T extends PromiseLike<infer V> ? V : T;\nexport type MaybePromise<T> = T | PromiseLike<T>;\nexport type OmitFromUnion<T, K extends keyof T> = T extends any ? Omit<T, K> : never;\nexport type IsAny<T, True, False = never> = true | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;","import type { InternalHandlerBuilder, SubscriptionSelectors } from './types';\nimport type { SubscriptionInternalState, SubscriptionState } from '../apiState';\nimport { produceWithPatches } from '../../utils/immerImports';\nimport type { Action } from '@reduxjs/toolkit';\nimport { getOrInsertComputed, createNewMap } from '../../utils/getOrInsert';\nexport const buildBatchedActionsHandler: InternalHandlerBuilder<[actionShouldContinue: boolean, returnValue: SubscriptionSelectors | boolean]> = ({\n  api,\n  queryThunk,\n  internalState,\n  mwApi\n}) => {\n  const subscriptionsPrefix = `${api.reducerPath}/subscriptions`;\n  let previousSubscriptions: SubscriptionState = null as unknown as SubscriptionState;\n  let updateSyncTimer: ReturnType<typeof window.setTimeout> | null = null;\n  const {\n    updateSubscriptionOptions,\n    unsubscribeQueryResult\n  } = api.internalActions;\n\n  // Actually intentionally mutate the subscriptions state used in the middleware\n  // This is done to speed up perf when loading many components\n  const actuallyMutateSubscriptions = (currentSubscriptions: SubscriptionInternalState, action: Action) => {\n    if (updateSubscriptionOptions.match(action)) {\n      const {\n        queryCacheKey,\n        requestId,\n        options\n      } = action.payload;\n      const sub = currentSubscriptions.get(queryCacheKey);\n      if (sub?.has(requestId)) {\n        sub.set(requestId, options);\n      }\n      return true;\n    }\n    if (unsubscribeQueryResult.match(action)) {\n      const {\n        queryCacheKey,\n        requestId\n      } = action.payload;\n      const sub = currentSubscriptions.get(queryCacheKey);\n      if (sub) {\n        sub.delete(requestId);\n      }\n      return true;\n    }\n    if (api.internalActions.removeQueryResult.match(action)) {\n      currentSubscriptions.delete(action.payload.queryCacheKey);\n      return true;\n    }\n    if (queryThunk.pending.match(action)) {\n      const {\n        meta: {\n          arg,\n          requestId\n        }\n      } = action;\n      const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);\n      if (arg.subscribe) {\n        substate.set(requestId, arg.subscriptionOptions ?? substate.get(requestId) ?? {});\n      }\n      return true;\n    }\n    let mutated = false;\n    if (queryThunk.rejected.match(action)) {\n      const {\n        meta: {\n          condition,\n          arg,\n          requestId\n        }\n      } = action;\n      if (condition && arg.subscribe) {\n        const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);\n        substate.set(requestId, arg.subscriptionOptions ?? substate.get(requestId) ?? {});\n        mutated = true;\n      }\n    }\n    return mutated;\n  };\n  const getSubscriptions = () => internalState.currentSubscriptions;\n  const getSubscriptionCount = (queryCacheKey: string) => {\n    const subscriptions = getSubscriptions();\n    const subscriptionsForQueryArg = subscriptions.get(queryCacheKey);\n    return subscriptionsForQueryArg?.size ?? 0;\n  };\n  const isRequestSubscribed = (queryCacheKey: string, requestId: string) => {\n    const subscriptions = getSubscriptions();\n    return !!subscriptions?.get(queryCacheKey)?.get(requestId);\n  };\n  const subscriptionSelectors: SubscriptionSelectors = {\n    getSubscriptions,\n    getSubscriptionCount,\n    isRequestSubscribed\n  };\n  function serializeSubscriptions(currentSubscriptions: SubscriptionInternalState): SubscriptionState {\n    // We now use nested Maps for subscriptions, instead of\n    // plain Records. Stringify this accordingly so we can\n    // convert it to the shape we need for the store.\n    return JSON.parse(JSON.stringify(Object.fromEntries([...currentSubscriptions].map(([k, v]) => [k, Object.fromEntries(v)]))));\n  }\n  return (action, mwApi): [actionShouldContinue: boolean, result: SubscriptionSelectors | boolean] => {\n    if (!previousSubscriptions) {\n      // Initialize it the first time this handler runs\n      previousSubscriptions = serializeSubscriptions(internalState.currentSubscriptions);\n    }\n    if (api.util.resetApiState.match(action)) {\n      previousSubscriptions = {};\n      internalState.currentSubscriptions.clear();\n      updateSyncTimer = null;\n      return [true, false];\n    }\n\n    // Intercept requests by hooks to see if they're subscribed\n    // We return the internal state reference so that hooks\n    // can do their own checks to see if they're still active.\n    // It's stupid and hacky, but it does cut down on some dispatch calls.\n    if (api.internalActions.internal_getRTKQSubscriptions.match(action)) {\n      return [false, subscriptionSelectors];\n    }\n\n    // Update subscription data based on this action\n    const didMutate = actuallyMutateSubscriptions(internalState.currentSubscriptions, action);\n    let actionShouldContinue = true;\n\n    // HACK Sneak the test-only polling state back out\n    if (process.env.NODE_ENV === 'test' && typeof action.type === 'string' && action.type === `${api.reducerPath}/getPolling`) {\n      return [false, internalState.currentPolls] as any;\n    }\n    if (didMutate) {\n      if (!updateSyncTimer) {\n        // We only use the subscription state for the Redux DevTools at this point,\n        // as the real data is kept here in the middleware.\n        // Given that, we can throttle synchronizing this state significantly to\n        // save on overall perf.\n        // In 1.9, it was updated in a microtask, but now we do it at most every 500ms.\n        updateSyncTimer = setTimeout(() => {\n          // Deep clone the current subscription data\n          const newSubscriptions: SubscriptionState = serializeSubscriptions(internalState.currentSubscriptions);\n          // Figure out a smaller diff between original and current\n          const [, patches] = produceWithPatches(previousSubscriptions, () => newSubscriptions);\n\n          // Sync the store state for visibility\n          mwApi.next(api.internalActions.subscriptionsUpdated(patches));\n          // Save the cloned state for later reference\n          previousSubscriptions = newSubscriptions;\n          updateSyncTimer = null;\n        }, 500);\n      }\n      const isSubscriptionSliceAction = typeof action.type == 'string' && !!action.type.startsWith(subscriptionsPrefix);\n      const isAdditionalSubscriptionAction = queryThunk.rejected.match(action) && action.meta.condition && !!action.meta.arg.subscribe;\n      actionShouldContinue = !isSubscriptionSliceAction && !isAdditionalSubscriptionAction;\n    }\n    return [actionShouldContinue, false];\n  };\n};","import { getEndpointDefinition } from '@internal/query/apiTypes';\nimport type { QueryDefinition } from '../../endpointDefinitions';\nimport type { ConfigState, QueryCacheKey, QuerySubState } from '../apiState';\nimport { isAnyOf } from '../rtkImports';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, QueryStateMeta, SubMiddlewareApi, TimeoutId } from './types';\nexport type ReferenceCacheCollection = never;\n\n/**\n * @example\n * ```ts\n * // codeblock-meta title=\"keepUnusedDataFor example\"\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n * interface Post {\n *   id: number\n *   name: string\n * }\n * type PostsResponse = Post[]\n *\n * const api = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsResponse, void>({\n *       query: () => 'posts',\n *       // highlight-start\n *       keepUnusedDataFor: 5\n *       // highlight-end\n *     })\n *   })\n * })\n * ```\n */\nexport type CacheCollectionQueryExtraOptions = {\n  /**\n   * Overrides the api-wide definition of `keepUnusedDataFor` for this endpoint only. _(This value is in seconds.)_\n   *\n   * This is how long RTK Query will keep your data cached for **after** the last component unsubscribes. For example, if you query an endpoint, then unmount the component, then mount another component that makes the same request within the given time frame, the most recent value will be served from the cache.\n   */\n  keepUnusedDataFor?: number;\n};\n\n// Per https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value , browsers store\n// `setTimeout()` timer values in a 32-bit int. If we pass a value in that's larger than that,\n// it wraps and ends up executing immediately.\n// Our `keepUnusedDataFor` values are in seconds, so adjust the numbers here accordingly.\nexport const THIRTY_TWO_BIT_MAX_INT = 2_147_483_647;\nexport const THIRTY_TWO_BIT_MAX_TIMER_SECONDS = 2_147_483_647 / 1_000 - 1;\nexport const buildCacheCollectionHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  api,\n  queryThunk,\n  context,\n  internalState,\n  selectors: {\n    selectQueryEntry,\n    selectConfig\n  },\n  getRunningQueryThunk,\n  mwApi\n}) => {\n  const {\n    removeQueryResult,\n    unsubscribeQueryResult,\n    cacheEntriesUpserted\n  } = api.internalActions;\n  const canTriggerUnsubscribe = isAnyOf(unsubscribeQueryResult.match, queryThunk.fulfilled, queryThunk.rejected, cacheEntriesUpserted.match);\n  function anySubscriptionsRemainingForKey(queryCacheKey: string) {\n    const subscriptions = internalState.currentSubscriptions.get(queryCacheKey);\n    if (!subscriptions) {\n      return false;\n    }\n    const hasSubscriptions = subscriptions.size > 0;\n    return hasSubscriptions;\n  }\n  const currentRemovalTimeouts: QueryStateMeta<TimeoutId> = {};\n  function abortAllPromises<T extends {\n    abort?: () => void;\n  }>(promiseMap: Map<string, T | undefined>): void {\n    for (const promise of promiseMap.values()) {\n      promise?.abort?.();\n    }\n  }\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    const state = mwApi.getState();\n    const config = selectConfig(state);\n    if (canTriggerUnsubscribe(action)) {\n      let queryCacheKeys: QueryCacheKey[];\n      if (cacheEntriesUpserted.match(action)) {\n        queryCacheKeys = action.payload.map(entry => entry.queryDescription.queryCacheKey);\n      } else {\n        const {\n          queryCacheKey\n        } = unsubscribeQueryResult.match(action) ? action.payload : action.meta.arg;\n        queryCacheKeys = [queryCacheKey];\n      }\n      handleUnsubscribeMany(queryCacheKeys, mwApi, config);\n    }\n    if (api.util.resetApiState.match(action)) {\n      for (const [key, timeout] of Object.entries(currentRemovalTimeouts)) {\n        if (timeout) clearTimeout(timeout);\n        delete currentRemovalTimeouts[key];\n      }\n      abortAllPromises(internalState.runningQueries);\n      abortAllPromises(internalState.runningMutations);\n    }\n    if (context.hasRehydrationInfo(action)) {\n      const {\n        queries\n      } = context.extractRehydrationInfo(action)!;\n      // Gotcha:\n      // If rehydrating before the endpoint has been injected,the global `keepUnusedDataFor`\n      // will be used instead of the endpoint-specific one.\n      handleUnsubscribeMany(Object.keys(queries) as QueryCacheKey[], mwApi, config);\n    }\n  };\n  function handleUnsubscribeMany(cacheKeys: QueryCacheKey[], api: SubMiddlewareApi, config: ConfigState<string>) {\n    const state = api.getState();\n    for (const queryCacheKey of cacheKeys) {\n      const entry = selectQueryEntry(state, queryCacheKey);\n      if (entry?.endpointName) {\n        handleUnsubscribe(queryCacheKey, entry.endpointName, api, config);\n      }\n    }\n  }\n  function handleUnsubscribe(queryCacheKey: QueryCacheKey, endpointName: string, api: SubMiddlewareApi, config: ConfigState<string>) {\n    const endpointDefinition = getEndpointDefinition(context, endpointName) as QueryDefinition<any, any, any, any>;\n    const keepUnusedDataFor = endpointDefinition?.keepUnusedDataFor ?? config.keepUnusedDataFor;\n    if (keepUnusedDataFor === Infinity) {\n      // Hey, user said keep this forever!\n      return;\n    }\n    // Prevent `setTimeout` timers from overflowing a 32-bit internal int, by\n    // clamping the max value to be at most 1000ms less than the 32-bit max.\n    // Look, a 24.8-day keepalive ought to be enough for anybody, right? :)\n    // Also avoid negative values too.\n    const finalKeepUnusedDataFor = Math.max(0, Math.min(keepUnusedDataFor, THIRTY_TWO_BIT_MAX_TIMER_SECONDS));\n    if (!anySubscriptionsRemainingForKey(queryCacheKey)) {\n      const currentTimeout = currentRemovalTimeouts[queryCacheKey];\n      if (currentTimeout) {\n        clearTimeout(currentTimeout);\n      }\n      currentRemovalTimeouts[queryCacheKey] = setTimeout(() => {\n        if (!anySubscriptionsRemainingForKey(queryCacheKey)) {\n          // Try to abort any running query for this cache key\n          const entry = selectQueryEntry(api.getState(), queryCacheKey);\n          if (entry?.endpointName) {\n            const runningQuery = api.dispatch(getRunningQueryThunk(entry.endpointName, entry.originalArgs));\n            runningQuery?.abort();\n          }\n          api.dispatch(removeQueryResult({\n            queryCacheKey\n          }));\n        }\n        delete currentRemovalTimeouts![queryCacheKey];\n      }, finalKeepUnusedDataFor * 1000);\n    }\n  }\n  return handler;\n};","import type { ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { BaseQueryFn, BaseQueryMeta, BaseQueryResult } from '../../baseQueryTypes';\nimport type { BaseEndpointDefinition, DefinitionType } from '../../endpointDefinitions';\nimport { isAnyQueryDefinition } from '../../endpointDefinitions';\nimport type { QueryCacheKey, RootState } from '../apiState';\nimport type { MutationResultSelectorResult, QueryResultSelectorResult } from '../buildSelectors';\nimport { getMutationCacheKey } from '../buildSlice';\nimport type { PatchCollection, Recipe } from '../buildThunks';\nimport { isAsyncThunkAction, isFulfilled } from '../rtkImports';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, PromiseWithKnownReason, SubMiddlewareApi } from './types';\nimport { getEndpointDefinition } from '@internal/query/apiTypes';\nexport type ReferenceCacheLifecycle = never;\nexport interface QueryBaseLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends LifecycleApi<ReducerPath> {\n  /**\n   * Gets the current value of this cache entry.\n   */\n  getCacheEntry(): QueryResultSelectorResult<{\n    type: DefinitionType.query;\n  } & BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, BaseQueryResult<BaseQuery>>>;\n  /**\n   * Updates the current cache entry value.\n   * For documentation see `api.util.updateQueryData`.\n   */\n  updateCachedData(updateRecipe: Recipe<ResultType>): PatchCollection;\n}\nexport type MutationBaseLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = LifecycleApi<ReducerPath> & {\n  /**\n   * Gets the current value of this cache entry.\n   */\n  getCacheEntry(): MutationResultSelectorResult<{\n    type: DefinitionType.mutation;\n  } & BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, BaseQueryResult<BaseQuery>>>;\n};\ntype LifecycleApi<ReducerPath extends string = string> = {\n  /**\n   * The dispatch method for the store\n   */\n  dispatch: ThunkDispatch<any, any, UnknownAction>;\n  /**\n   * A method to get the current state\n   */\n  getState(): RootState<any, any, ReducerPath>;\n  /**\n   * `extra` as provided as `thunk.extraArgument` to the `configureStore` `getDefaultMiddleware` option.\n   */\n  extra: unknown;\n  /**\n   * A unique ID generated for the mutation\n   */\n  requestId: string;\n};\ntype CacheLifecyclePromises<ResultType = unknown, MetaType = unknown> = {\n  /**\n   * Promise that will resolve with the first value for this cache key.\n   * This allows you to `await` until an actual value is in cache.\n   *\n   * If the cache entry is removed from the cache before any value has ever\n   * been resolved, this Promise will reject with\n   * `new Error('Promise never resolved before cacheEntryRemoved.')`\n   * to prevent memory leaks.\n   * You can just re-throw that error (or not handle it at all) -\n   * it will be caught outside of `cacheEntryAdded`.\n   *\n   * If you don't interact with this promise, it will not throw.\n   */\n  cacheDataLoaded: PromiseWithKnownReason<{\n    /**\n     * The (transformed) query result.\n     */\n    data: ResultType;\n    /**\n     * The `meta` returned by the `baseQuery`\n     */\n    meta: MetaType;\n  }, typeof neverResolvedError>;\n  /**\n   * Promise that allows you to wait for the point in time when the cache entry\n   * has been removed from the cache, by not being used/subscribed to any more\n   * in the application for too long or by dispatching `api.util.resetApiState`.\n   */\n  cacheEntryRemoved: Promise<void>;\n};\nexport interface QueryCacheLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>, CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>> {}\nexport type MutationCacheLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> & CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>>;\nexport type CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  onCacheEntryAdded?(arg: QueryArg, api: QueryCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport type CacheLifecycleInfiniteQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>;\nexport type CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  onCacheEntryAdded?(arg: QueryArg, api: MutationCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nconst neverResolvedError = new Error('Promise never resolved before cacheEntryRemoved.') as Error & {\n  message: 'Promise never resolved before cacheEntryRemoved.';\n};\nexport const buildCacheLifecycleHandler: InternalHandlerBuilder = ({\n  api,\n  reducerPath,\n  context,\n  queryThunk,\n  mutationThunk,\n  internalState,\n  selectors: {\n    selectQueryEntry,\n    selectApiState\n  }\n}) => {\n  const isQueryThunk = isAsyncThunkAction(queryThunk);\n  const isMutationThunk = isAsyncThunkAction(mutationThunk);\n  const isFulfilledThunk = isFulfilled(queryThunk, mutationThunk);\n  type CacheLifecycle = {\n    valueResolved?(value: {\n      data: unknown;\n      meta: unknown;\n    }): unknown;\n    cacheEntryRemoved(): void;\n  };\n  const lifecycleMap: Record<string, CacheLifecycle> = {};\n  const {\n    removeQueryResult,\n    removeMutationResult,\n    cacheEntriesUpserted\n  } = api.internalActions;\n  function resolveLifecycleEntry(cacheKey: string, data: unknown, meta: unknown) {\n    const lifecycle = lifecycleMap[cacheKey];\n    if (lifecycle?.valueResolved) {\n      lifecycle.valueResolved({\n        data,\n        meta\n      });\n      delete lifecycle.valueResolved;\n    }\n  }\n  function removeLifecycleEntry(cacheKey: string) {\n    const lifecycle = lifecycleMap[cacheKey];\n    if (lifecycle) {\n      delete lifecycleMap[cacheKey];\n      lifecycle.cacheEntryRemoved();\n    }\n  }\n  function getActionMetaFields(action: ReturnType<typeof queryThunk.pending> | ReturnType<typeof mutationThunk.pending>) {\n    const {\n      arg,\n      requestId\n    } = action.meta;\n    const {\n      endpointName,\n      originalArgs\n    } = arg;\n    return [endpointName, originalArgs, requestId] as const;\n  }\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi, stateBefore) => {\n    const cacheKey = getCacheKey(action) as QueryCacheKey;\n    function checkForNewCacheKey(endpointName: string, cacheKey: QueryCacheKey, requestId: string, originalArgs: unknown) {\n      const oldEntry = selectQueryEntry(stateBefore, cacheKey);\n      const newEntry = selectQueryEntry(mwApi.getState(), cacheKey);\n      if (!oldEntry && newEntry) {\n        handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId);\n      }\n    }\n    if (queryThunk.pending.match(action)) {\n      const [endpointName, originalArgs, requestId] = getActionMetaFields(action);\n      checkForNewCacheKey(endpointName, cacheKey, requestId, originalArgs);\n    } else if (cacheEntriesUpserted.match(action)) {\n      for (const {\n        queryDescription,\n        value\n      } of action.payload) {\n        const {\n          endpointName,\n          originalArgs,\n          queryCacheKey\n        } = queryDescription;\n        checkForNewCacheKey(endpointName, queryCacheKey, action.meta.requestId, originalArgs);\n        resolveLifecycleEntry(queryCacheKey, value, {});\n      }\n    } else if (mutationThunk.pending.match(action)) {\n      const state = mwApi.getState()[reducerPath].mutations[cacheKey];\n      if (state) {\n        const [endpointName, originalArgs, requestId] = getActionMetaFields(action);\n        handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId);\n      }\n    } else if (isFulfilledThunk(action)) {\n      resolveLifecycleEntry(cacheKey, action.payload, action.meta.baseQueryMeta);\n    } else if (removeQueryResult.match(action) || removeMutationResult.match(action)) {\n      removeLifecycleEntry(cacheKey);\n    } else if (api.util.resetApiState.match(action)) {\n      for (const cacheKey of Object.keys(lifecycleMap)) {\n        removeLifecycleEntry(cacheKey);\n      }\n    }\n  };\n  function getCacheKey(action: any) {\n    if (isQueryThunk(action)) return action.meta.arg.queryCacheKey;\n    if (isMutationThunk(action)) {\n      return action.meta.arg.fixedCacheKey ?? action.meta.requestId;\n    }\n    if (removeQueryResult.match(action)) return action.payload.queryCacheKey;\n    if (removeMutationResult.match(action)) return getMutationCacheKey(action.payload);\n    return '';\n  }\n  function handleNewKey(endpointName: string, originalArgs: any, queryCacheKey: string, mwApi: SubMiddlewareApi, requestId: string) {\n    const endpointDefinition = getEndpointDefinition(context, endpointName);\n    const onCacheEntryAdded = endpointDefinition?.onCacheEntryAdded;\n    if (!onCacheEntryAdded) return;\n    const lifecycle = {} as CacheLifecycle;\n    const cacheEntryRemoved = new Promise<void>(resolve => {\n      lifecycle.cacheEntryRemoved = resolve;\n    });\n    const cacheDataLoaded: PromiseWithKnownReason<{\n      data: unknown;\n      meta: unknown;\n    }, typeof neverResolvedError> = Promise.race([new Promise<{\n      data: unknown;\n      meta: unknown;\n    }>(resolve => {\n      lifecycle.valueResolved = resolve;\n    }), cacheEntryRemoved.then(() => {\n      throw neverResolvedError;\n    })]);\n    // prevent uncaught promise rejections from happening.\n    // if the original promise is used in any way, that will create a new promise that will throw again\n    cacheDataLoaded.catch(() => {});\n    lifecycleMap[queryCacheKey] = lifecycle;\n    const selector = (api.endpoints[endpointName] as any).select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : queryCacheKey);\n    const extra = mwApi.dispatch((_, __, extra) => extra);\n    const lifecycleApi = {\n      ...mwApi,\n      getCacheEntry: () => selector(mwApi.getState()),\n      requestId,\n      extra,\n      updateCachedData: (isAnyQueryDefinition(endpointDefinition) ? (updateRecipe: Recipe<any>) => mwApi.dispatch(api.util.updateQueryData(endpointName as never, originalArgs as never, updateRecipe)) : undefined) as any,\n      cacheDataLoaded,\n      cacheEntryRemoved\n    };\n    const runningHandler = onCacheEntryAdded(originalArgs, lifecycleApi as any);\n    // if a `neverResolvedError` was thrown, but not handled in the running handler, do not let it leak out further\n    Promise.resolve(runningHandler).catch(e => {\n      if (e === neverResolvedError) return;\n      throw e;\n    });\n  }\n  return handler;\n};","import type { InternalHandlerBuilder } from './types';\nexport const buildDevCheckHandler: InternalHandlerBuilder = ({\n  api,\n  context: {\n    apiUid\n  },\n  reducerPath\n}) => {\n  return (action, mwApi) => {\n    if (api.util.resetApiState.match(action)) {\n      // dispatch after api reset\n      mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));\n    }\n    if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n      if (api.internalActions.middlewareRegistered.match(action) && action.payload === apiUid && mwApi.getState()[reducerPath]?.config?.middlewareRegistered === 'conflict') {\n        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!` : ''}`);\n      }\n    }\n  };\n};","import { isAnyOf, isFulfilled, isRejected, isRejectedWithValue } from '../rtkImports';\nimport type { EndpointDefinitions, FullTagDescription } from '../../endpointDefinitions';\nimport { calculateProvidedBy } from '../../endpointDefinitions';\nimport type { CombinedState, QueryCacheKey } from '../apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport { calculateProvidedByThunk } from '../buildThunks';\nimport type { SubMiddlewareApi, InternalHandlerBuilder, ApiMiddlewareInternalHandler } from './types';\nimport { getOrInsertComputed, createNewMap } from '../../utils/getOrInsert';\nexport const buildInvalidationByTagsHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  context,\n  context: {\n    endpointDefinitions\n  },\n  mutationThunk,\n  queryThunk,\n  api,\n  assertTagType,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    removeQueryResult\n  } = api.internalActions;\n  const isThunkActionWithTags = isAnyOf(isFulfilled(mutationThunk), isRejectedWithValue(mutationThunk));\n  const isQueryEnd = isAnyOf(isFulfilled(queryThunk, mutationThunk), isRejected(queryThunk, mutationThunk));\n  let pendingTagInvalidations: FullTagDescription<string>[] = [];\n  // Track via counter so we can avoid iterating over state every time\n  let pendingRequestCount = 0;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (queryThunk.pending.match(action) || mutationThunk.pending.match(action)) {\n      pendingRequestCount++;\n    }\n    if (isQueryEnd(action)) {\n      pendingRequestCount = Math.max(0, pendingRequestCount - 1);\n    }\n    if (isThunkActionWithTags(action)) {\n      invalidateTags(calculateProvidedByThunk(action, 'invalidatesTags', endpointDefinitions, assertTagType), mwApi);\n    } else if (isQueryEnd(action)) {\n      invalidateTags([], mwApi);\n    } else if (api.util.invalidateTags.match(action)) {\n      invalidateTags(calculateProvidedBy(action.payload, undefined, undefined, undefined, undefined, assertTagType), mwApi);\n    }\n  };\n  function hasPendingRequests() {\n    return pendingRequestCount > 0;\n  }\n  function invalidateTags(newTags: readonly FullTagDescription<string>[], mwApi: SubMiddlewareApi) {\n    const rootState = mwApi.getState();\n    const state = rootState[reducerPath];\n    pendingTagInvalidations.push(...newTags);\n    if (state.config.invalidationBehavior === 'delayed' && hasPendingRequests()) {\n      return;\n    }\n    const tags = pendingTagInvalidations;\n    pendingTagInvalidations = [];\n    if (tags.length === 0) return;\n    const toInvalidate = api.util.selectInvalidatedBy(rootState, tags);\n    context.batch(() => {\n      const valuesArray = Array.from(toInvalidate.values());\n      for (const {\n        queryCacheKey\n      } of valuesArray) {\n        const querySubState = state.queries[queryCacheKey];\n        const subscriptionSubState = getOrInsertComputed(internalState.currentSubscriptions, queryCacheKey, createNewMap);\n        if (querySubState) {\n          if (subscriptionSubState.size === 0) {\n            mwApi.dispatch(removeQueryResult({\n              queryCacheKey: queryCacheKey as QueryCacheKey\n            }));\n          } else if (querySubState.status !== STATUS_UNINITIALIZED) {\n            mwApi.dispatch(refetchQuery(querySubState));\n          }\n        }\n      }\n    });\n  }\n  return handler;\n};","import type { QueryCacheKey, QuerySubstateIdentifier, Subscribers, SubscribersInternal } from '../apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport type { QueryStateMeta, SubMiddlewareApi, TimeoutId, InternalHandlerBuilder, ApiMiddlewareInternalHandler, InternalMiddlewareState } from './types';\nexport const buildPollingHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  queryThunk,\n  api,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    currentPolls,\n    currentSubscriptions\n  } = internalState;\n\n  // Batching state for polling updates\n  const pendingPollingUpdates = new Set<string>();\n  let pollingUpdateTimer: ReturnType<typeof setTimeout> | null = null;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (api.internalActions.updateSubscriptionOptions.match(action) || api.internalActions.unsubscribeQueryResult.match(action)) {\n      schedulePollingUpdate(action.payload.queryCacheKey, mwApi);\n    }\n    if (queryThunk.pending.match(action) || queryThunk.rejected.match(action) && action.meta.condition) {\n      schedulePollingUpdate(action.meta.arg.queryCacheKey, mwApi);\n    }\n    if (queryThunk.fulfilled.match(action) || queryThunk.rejected.match(action) && !action.meta.condition) {\n      startNextPoll(action.meta.arg, mwApi);\n    }\n    if (api.util.resetApiState.match(action)) {\n      clearPolls();\n      // Clear any pending updates\n      if (pollingUpdateTimer) {\n        clearTimeout(pollingUpdateTimer);\n        pollingUpdateTimer = null;\n      }\n      pendingPollingUpdates.clear();\n    }\n  };\n  function schedulePollingUpdate(queryCacheKey: string, api: SubMiddlewareApi) {\n    pendingPollingUpdates.add(queryCacheKey);\n    if (!pollingUpdateTimer) {\n      pollingUpdateTimer = setTimeout(() => {\n        // Process all pending updates in a single batch\n        for (const key of pendingPollingUpdates) {\n          updatePollingInterval({\n            queryCacheKey: key as any\n          }, api);\n        }\n        pendingPollingUpdates.clear();\n        pollingUpdateTimer = null;\n      }, 0);\n    }\n  }\n  function startNextPoll({\n    queryCacheKey\n  }: QuerySubstateIdentifier, api: SubMiddlewareApi) {\n    const state = api.getState()[reducerPath];\n    const querySubState = state.queries[queryCacheKey];\n    const subscriptions = currentSubscriptions.get(queryCacheKey);\n    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) return;\n    const {\n      lowestPollingInterval,\n      skipPollingIfUnfocused\n    } = findLowestPollingInterval(subscriptions);\n    if (!Number.isFinite(lowestPollingInterval)) return;\n    const currentPoll = currentPolls.get(queryCacheKey);\n    if (currentPoll?.timeout) {\n      clearTimeout(currentPoll.timeout);\n      currentPoll.timeout = undefined;\n    }\n    const nextPollTimestamp = Date.now() + lowestPollingInterval;\n    currentPolls.set(queryCacheKey, {\n      nextPollTimestamp,\n      pollingInterval: lowestPollingInterval,\n      timeout: setTimeout(() => {\n        if (state.config.focused || !skipPollingIfUnfocused) {\n          api.dispatch(refetchQuery(querySubState));\n        }\n        startNextPoll({\n          queryCacheKey\n        }, api);\n      }, lowestPollingInterval)\n    });\n  }\n  function updatePollingInterval({\n    queryCacheKey\n  }: QuerySubstateIdentifier, api: SubMiddlewareApi) {\n    const state = api.getState()[reducerPath];\n    const querySubState = state.queries[queryCacheKey];\n    const subscriptions = currentSubscriptions.get(queryCacheKey);\n    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) {\n      return;\n    }\n    const {\n      lowestPollingInterval\n    } = findLowestPollingInterval(subscriptions);\n\n    // HACK add extra data to track how many times this has been called in tests\n    // yes we're mutating a nonexistent field on a Map here\n    if (process.env.NODE_ENV === 'test') {\n      const updateCounters = (currentPolls as any).pollUpdateCounters ??= {};\n      updateCounters[queryCacheKey] ??= 0;\n      updateCounters[queryCacheKey]++;\n    }\n    if (!Number.isFinite(lowestPollingInterval)) {\n      cleanupPollForKey(queryCacheKey);\n      return;\n    }\n    const currentPoll = currentPolls.get(queryCacheKey);\n    const nextPollTimestamp = Date.now() + lowestPollingInterval;\n    if (!currentPoll || nextPollTimestamp < currentPoll.nextPollTimestamp) {\n      startNextPoll({\n        queryCacheKey\n      }, api);\n    }\n  }\n  function cleanupPollForKey(key: string) {\n    const existingPoll = currentPolls.get(key);\n    if (existingPoll?.timeout) {\n      clearTimeout(existingPoll.timeout);\n    }\n    currentPolls.delete(key);\n  }\n  function clearPolls() {\n    for (const key of currentPolls.keys()) {\n      cleanupPollForKey(key);\n    }\n  }\n  function findLowestPollingInterval(subscribers: SubscribersInternal = new Map()) {\n    let skipPollingIfUnfocused: boolean | undefined = false;\n    let lowestPollingInterval = Number.POSITIVE_INFINITY;\n    for (const entry of subscribers.values()) {\n      if (!!entry.pollingInterval) {\n        lowestPollingInterval = Math.min(entry.pollingInterval!, lowestPollingInterval);\n        skipPollingIfUnfocused = entry.skipPollingIfUnfocused || skipPollingIfUnfocused;\n      }\n    }\n    return {\n      lowestPollingInterval,\n      skipPollingIfUnfocused\n    };\n  }\n  return handler;\n};","import { getEndpointDefinition } from '@internal/query/apiTypes';\nimport type { BaseQueryError, BaseQueryFn, BaseQueryMeta } from '../../baseQueryTypes';\nimport { isAnyQueryDefinition } from '../../endpointDefinitions';\nimport type { Recipe } from '../buildThunks';\nimport { isFulfilled, isPending, isRejected } from '../rtkImports';\nimport type { MutationBaseLifecycleApi, QueryBaseLifecycleApi } from './cacheLifecycle';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, PromiseConstructorWithKnownReason, PromiseWithKnownReason } from './types';\nexport type ReferenceQueryLifecycle = never;\ntype QueryLifecyclePromises<ResultType, BaseQuery extends BaseQueryFn> = {\n  /**\n   * Promise that will resolve with the (transformed) query result.\n   *\n   * If the query fails, this promise will reject with the error.\n   *\n   * This allows you to `await` for the query to finish.\n   *\n   * If you don't interact with this promise, it will not throw.\n   */\n  queryFulfilled: PromiseWithKnownReason<{\n    /**\n     * The (transformed) query result.\n     */\n    data: ResultType;\n    /**\n     * The `meta` returned by the `baseQuery`\n     */\n    meta: BaseQueryMeta<BaseQuery>;\n  }, QueryFulfilledRejectionReason<BaseQuery>>;\n};\ntype QueryFulfilledRejectionReason<BaseQuery extends BaseQueryFn> = {\n  error: BaseQueryError<BaseQuery>;\n  /**\n   * If this is `false`, that means this error was returned from the `baseQuery` or `queryFn` in a controlled manner.\n   */\n  isUnhandledError: false;\n  /**\n   * The `meta` returned by the `baseQuery`\n   */\n  meta: BaseQueryMeta<BaseQuery>;\n} | {\n  error: unknown;\n  meta?: undefined;\n  /**\n   * If this is `true`, that means that this error is the result of `baseQueryFn`, `queryFn`, `transformResponse` or `transformErrorResponse` throwing an error instead of handling it properly.\n   * There can not be made any assumption about the shape of `error`.\n   */\n  isUnhandledError: true;\n};\nexport type QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  /**\n   * A function that is called when the individual query is started. The function is called with a lifecycle api object containing properties such as `queryFulfilled`, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. throughout the lifecycle of an individual query/mutation call).\n   *\n   * Can be used to perform side-effects throughout the lifecycle of the query.\n   *\n   * @example\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   * import { messageCreated } from './notificationsSlice\n   * export interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({\n   *     baseUrl: '/',\n   *   }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, number>({\n   *       query: (id) => `post/${id}`,\n   *       async onQueryStarted(id, { dispatch, queryFulfilled }) {\n   *         // `onStart` side-effect\n   *         dispatch(messageCreated('Fetching posts...'))\n   *         try {\n   *           const { data } = await queryFulfilled\n   *           // `onSuccess` side-effect\n   *           dispatch(messageCreated('Posts received!'))\n   *         } catch (err) {\n   *           // `onError` side-effect\n   *           dispatch(messageCreated('Error fetching posts!'))\n   *         }\n   *       }\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  onQueryStarted?(queryArgument: QueryArg, queryLifeCycleApi: QueryLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport type QueryLifecycleInfiniteQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>;\nexport type QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  /**\n   * A function that is called when the individual mutation is started. The function is called with a lifecycle api object containing properties such as `queryFulfilled`, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. throughout the lifecycle of an individual query/mutation call).\n   *\n   * Can be used for `optimistic updates`.\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   * export interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({\n   *     baseUrl: '/',\n   *   }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, number>({\n   *       query: (id) => `post/${id}`,\n   *       providesTags: ['Post'],\n   *     }),\n   *     updatePost: build.mutation<void, Pick<Post, 'id'> & Partial<Post>>({\n   *       query: ({ id, ...patch }) => ({\n   *         url: `post/${id}`,\n   *         method: 'PATCH',\n   *         body: patch,\n   *       }),\n   *       invalidatesTags: ['Post'],\n   *       async onQueryStarted({ id, ...patch }, { dispatch, queryFulfilled }) {\n   *         const patchResult = dispatch(\n   *           api.util.updateQueryData('getPost', id, (draft) => {\n   *             Object.assign(draft, patch)\n   *           })\n   *         )\n   *         try {\n   *           await queryFulfilled\n   *         } catch {\n   *           patchResult.undo()\n   *         }\n   *       },\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  onQueryStarted?(queryArgument: QueryArg, mutationLifeCycleApi: MutationLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport interface QueryLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>, QueryLifecyclePromises<ResultType, BaseQuery> {}\nexport type MutationLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> & QueryLifecyclePromises<ResultType, BaseQuery>;\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryLifecycleQueryExtraOptions.onQueryStarted | onQueryStarted}\n * for a specific query.\n *\n * @example\n * <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>\n *\n * ```ts\n * import type { TypedQueryOnQueryStarted } from '@reduxjs/toolkit/query'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n *\n * type Post = {\n *   id: number\n *   title: string\n *   userId: number\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = number | undefined\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * const baseApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, void>({\n *       query: () => `/posts`,\n *     }),\n *\n *     getPostById: build.query<Post, QueryArgument>({\n *       query: (postId) => `/posts/${postId}`,\n *     }),\n *   }),\n * })\n *\n * const updatePostOnFulfilled: TypedQueryOnQueryStarted<\n *   PostsApiResponse,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   'postsApi'\n * > = async (queryArgument, { dispatch, queryFulfilled }) => {\n *   const result = await queryFulfilled\n *\n *   const { posts } = result.data\n *\n *   // Pre-fill the individual post entries with the results\n *   // from the list endpoint query\n *   dispatch(\n *     baseApiSlice.util.upsertQueryEntries(\n *       posts.map((post) => ({\n *         endpointName: 'getPostById',\n *         arg: post.id,\n *         value: post,\n *       })),\n *     ),\n *   )\n * }\n *\n * export const extendedApiSlice = baseApiSlice.injectEndpoints({\n *   endpoints: (build) => ({\n *     getPostsByUserId: build.query<PostsApiResponse, QueryArgument>({\n *       query: (userId) => `/posts/user/${userId}`,\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *   }),\n * })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template ReducerPath - The type representing the `reducerPath` for the API slice.\n *\n * @since 2.4.0\n * @public\n */\nexport type TypedQueryOnQueryStarted<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleQueryExtraOptions<ResultType, QueryArgumentType, BaseQueryFunctionType, ReducerPath>['onQueryStarted'];\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryLifecycleMutationExtraOptions.onQueryStarted | onQueryStarted}\n * for a specific mutation.\n *\n * @example\n * <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>\n *\n * ```ts\n * import type { TypedMutationOnQueryStarted } from '@reduxjs/toolkit/query'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n *\n * type Post = {\n *   id: number\n *   title: string\n *   userId: number\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = Pick<Post, 'id'> & Partial<Post>\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * const baseApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, void>({\n *       query: () => `/posts`,\n *     }),\n *\n *     getPostById: build.query<Post, number>({\n *       query: (postId) => `/posts/${postId}`,\n *     }),\n *   }),\n * })\n *\n * const updatePostOnFulfilled: TypedMutationOnQueryStarted<\n *   Post,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   'postsApi'\n * > = async ({ id, ...patch }, { dispatch, queryFulfilled }) => {\n *   const patchCollection = dispatch(\n *     baseApiSlice.util.updateQueryData('getPostById', id, (draftPost) => {\n *       Object.assign(draftPost, patch)\n *     }),\n *   )\n *\n *   try {\n *     await queryFulfilled\n *   } catch {\n *     patchCollection.undo()\n *   }\n * }\n *\n * export const extendedApiSlice = baseApiSlice.injectEndpoints({\n *   endpoints: (build) => ({\n *     addPost: build.mutation<Post, Omit<QueryArgument, 'id'>>({\n *       query: (body) => ({\n *         url: `posts/add`,\n *         method: 'POST',\n *         body,\n *       }),\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *\n *     updatePost: build.mutation<Post, QueryArgument>({\n *       query: ({ id, ...patch }) => ({\n *         url: `post/${id}`,\n *         method: 'PATCH',\n *         body: patch,\n *       }),\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *   }),\n * })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template ReducerPath - The type representing the `reducerPath` for the API slice.\n *\n * @since 2.4.0\n * @public\n */\nexport type TypedMutationOnQueryStarted<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleMutationExtraOptions<ResultType, QueryArgumentType, BaseQueryFunctionType, ReducerPath>['onQueryStarted'];\nexport const buildQueryLifecycleHandler: InternalHandlerBuilder = ({\n  api,\n  context,\n  queryThunk,\n  mutationThunk\n}) => {\n  const isPendingThunk = isPending(queryThunk, mutationThunk);\n  const isRejectedThunk = isRejected(queryThunk, mutationThunk);\n  const isFullfilledThunk = isFulfilled(queryThunk, mutationThunk);\n  type CacheLifecycle = {\n    resolve(value: {\n      data: unknown;\n      meta: unknown;\n    }): unknown;\n    reject(value: QueryFulfilledRejectionReason<any>): unknown;\n  };\n  const lifecycleMap: Record<string, CacheLifecycle> = {};\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (isPendingThunk(action)) {\n      const {\n        requestId,\n        arg: {\n          endpointName,\n          originalArgs\n        }\n      } = action.meta;\n      const endpointDefinition = getEndpointDefinition(context, endpointName);\n      const onQueryStarted = endpointDefinition?.onQueryStarted;\n      if (onQueryStarted) {\n        const lifecycle = {} as CacheLifecycle;\n        const queryFulfilled = new (Promise as PromiseConstructorWithKnownReason)<{\n          data: unknown;\n          meta: unknown;\n        }, QueryFulfilledRejectionReason<any>>((resolve, reject) => {\n          lifecycle.resolve = resolve;\n          lifecycle.reject = reject;\n        });\n        // prevent uncaught promise rejections from happening.\n        // if the original promise is used in any way, that will create a new promise that will throw again\n        queryFulfilled.catch(() => {});\n        lifecycleMap[requestId] = lifecycle;\n        const selector = (api.endpoints[endpointName] as any).select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : requestId);\n        const extra = mwApi.dispatch((_, __, extra) => extra);\n        const lifecycleApi = {\n          ...mwApi,\n          getCacheEntry: () => selector(mwApi.getState()),\n          requestId,\n          extra,\n          updateCachedData: (isAnyQueryDefinition(endpointDefinition) ? (updateRecipe: Recipe<any>) => mwApi.dispatch(api.util.updateQueryData(endpointName as never, originalArgs as never, updateRecipe)) : undefined) as any,\n          queryFulfilled\n        };\n        onQueryStarted(originalArgs, lifecycleApi as any);\n      }\n    } else if (isFullfilledThunk(action)) {\n      const {\n        requestId,\n        baseQueryMeta\n      } = action.meta;\n      lifecycleMap[requestId]?.resolve({\n        data: action.payload,\n        meta: baseQueryMeta\n      });\n      delete lifecycleMap[requestId];\n    } else if (isRejectedThunk(action)) {\n      const {\n        requestId,\n        rejectedWithValue,\n        baseQueryMeta\n      } = action.meta;\n      lifecycleMap[requestId]?.reject({\n        error: action.payload ?? action.error,\n        isUnhandledError: !rejectedWithValue,\n        meta: baseQueryMeta as any\n      });\n      delete lifecycleMap[requestId];\n    }\n  };\n  return handler;\n};","import { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport type { QueryCacheKey } from '../apiState';\nimport { onFocus, onOnline } from '../setupListeners';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, SubMiddlewareApi } from './types';\nexport const buildWindowEventHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  context,\n  api,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    removeQueryResult\n  } = api.internalActions;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (onFocus.match(action)) {\n      refetchValidQueries(mwApi, 'refetchOnFocus');\n    }\n    if (onOnline.match(action)) {\n      refetchValidQueries(mwApi, 'refetchOnReconnect');\n    }\n  };\n  function refetchValidQueries(api: SubMiddlewareApi, type: 'refetchOnFocus' | 'refetchOnReconnect') {\n    const state = api.getState()[reducerPath];\n    const queries = state.queries;\n    const subscriptions = internalState.currentSubscriptions;\n    context.batch(() => {\n      for (const queryCacheKey of subscriptions.keys()) {\n        const querySubState = queries[queryCacheKey];\n        const subscriptionSubState = subscriptions.get(queryCacheKey);\n        if (!subscriptionSubState || !querySubState) continue;\n        const values = [...subscriptionSubState.values()];\n        const shouldRefetch = values.some(sub => sub[type] === true) || values.every(sub => sub[type] === undefined) && state.config[type];\n        if (shouldRefetch) {\n          if (subscriptionSubState.size === 0) {\n            api.dispatch(removeQueryResult({\n              queryCacheKey: queryCacheKey as QueryCacheKey\n            }));\n          } else if (querySubState.status !== STATUS_UNINITIALIZED) {\n            api.dispatch(refetchQuery(querySubState));\n          }\n        }\n      }\n    });\n  }\n  return handler;\n};","import type { Action, Middleware, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { EndpointDefinitions, FullTagDescription } from '../../endpointDefinitions';\nimport type { QueryStatus, QuerySubState, RootState } from '../apiState';\nimport type { QueryThunkArg } from '../buildThunks';\nimport { createAction, isAction } from '../rtkImports';\nimport { buildBatchedActionsHandler } from './batchActions';\nimport { buildCacheCollectionHandler } from './cacheCollection';\nimport { buildCacheLifecycleHandler } from './cacheLifecycle';\nimport { buildDevCheckHandler } from './devMiddleware';\nimport { buildInvalidationByTagsHandler } from './invalidationByTags';\nimport { buildPollingHandler } from './polling';\nimport { buildQueryLifecycleHandler } from './queryLifecycle';\nimport type { BuildMiddlewareInput, InternalHandlerBuilder, InternalMiddlewareState } from './types';\nimport { buildWindowEventHandler } from './windowEventHandling';\nimport type { ApiEndpointQuery } from '../module';\nexport type { ReferenceCacheCollection } from './cacheCollection';\nexport type { MutationCacheLifecycleApi, QueryCacheLifecycleApi, ReferenceCacheLifecycle } from './cacheLifecycle';\nexport type { MutationLifecycleApi, QueryLifecycleApi, ReferenceQueryLifecycle, TypedMutationOnQueryStarted, TypedQueryOnQueryStarted } from './queryLifecycle';\nexport type { SubscriptionSelectors } from './types';\nexport function buildMiddleware<Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string>(input: BuildMiddlewareInput<Definitions, ReducerPath, TagTypes>) {\n  const {\n    reducerPath,\n    queryThunk,\n    api,\n    context,\n    getInternalState\n  } = input;\n  const {\n    apiUid\n  } = context;\n  const actions = {\n    invalidateTags: createAction<Array<TagTypes | FullTagDescription<TagTypes> | null | undefined>>(`${reducerPath}/invalidateTags`)\n  };\n  const isThisApiSliceAction = (action: Action) => action.type.startsWith(`${reducerPath}/`);\n  const handlerBuilders: InternalHandlerBuilder[] = [buildDevCheckHandler, buildCacheCollectionHandler, buildInvalidationByTagsHandler, buildPollingHandler, buildCacheLifecycleHandler, buildQueryLifecycleHandler];\n  const middleware: Middleware<{}, RootState<Definitions, string, ReducerPath>, ThunkDispatch<any, any, UnknownAction>> = mwApi => {\n    let initialized = false;\n    const internalState = getInternalState(mwApi.dispatch);\n    const builderArgs = {\n      ...(input as any as BuildMiddlewareInput<EndpointDefinitions, string, string>),\n      internalState,\n      refetchQuery,\n      isThisApiSliceAction,\n      mwApi\n    };\n    const handlers = handlerBuilders.map(build => build(builderArgs));\n    const batchedActionsHandler = buildBatchedActionsHandler(builderArgs);\n    const windowEventsHandler = buildWindowEventHandler(builderArgs);\n    return next => {\n      return action => {\n        if (!isAction(action)) {\n          return next(action);\n        }\n        if (!initialized) {\n          initialized = true;\n          // dispatch before any other action\n          mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));\n        }\n        const mwApiWithNext = {\n          ...mwApi,\n          next\n        };\n        const stateBefore = mwApi.getState();\n        const [actionShouldContinue, internalProbeResult] = batchedActionsHandler(action, mwApiWithNext, stateBefore);\n        let res: any;\n        if (actionShouldContinue) {\n          res = next(action);\n        } else {\n          res = internalProbeResult;\n        }\n        if (!!mwApi.getState()[reducerPath]) {\n          // Only run these checks if the middleware is registered okay\n\n          // This looks for actions that aren't specific to the API slice\n          windowEventsHandler(action, mwApiWithNext, stateBefore);\n          if (isThisApiSliceAction(action) || context.hasRehydrationInfo(action)) {\n            // Only run these additional checks if the actions are part of the API slice,\n            // or the action has hydration-related data\n            for (const handler of handlers) {\n              handler(action, mwApiWithNext, stateBefore);\n            }\n          }\n        }\n        return res;\n      };\n    };\n  };\n  return {\n    middleware,\n    actions\n  };\n  function refetchQuery(querySubState: Exclude<QuerySubState<any>, {\n    status: QueryStatus.uninitialized;\n  }>) {\n    return (input.api.endpoints[querySubState.endpointName] as ApiEndpointQuery<any, any>).initiate(querySubState.originalArgs as any, {\n      subscribe: false,\n      forceRefetch: true\n    });\n  }\n}","/**\n * Note: this file should import all other files for type discovery and declaration merging\n */\nimport type { ActionCreatorWithPayload, Dispatch, Middleware, Reducer, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport { enablePatches } from '../utils/immerImports';\nimport type { Api, Module } from '../apiTypes';\nimport type { BaseQueryFn } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { AssertTagTypes, EndpointDefinitions, InfiniteQueryDefinition, MutationDefinition, QueryArgFrom, QueryArgFromAnyQuery, QueryDefinition, TagDescription } from '../endpointDefinitions';\nimport { isInfiniteQueryDefinition, isMutationDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { assertCast, safeAssign } from '../tsHelpers';\nimport type { CombinedState, MutationKeys, QueryKeys, RootState } from './apiState';\nimport type { BuildInitiateApiEndpointMutation, BuildInitiateApiEndpointQuery, MutationActionCreatorResult, QueryActionCreatorResult, InfiniteQueryActionCreatorResult, BuildInitiateApiEndpointInfiniteQuery } from './buildInitiate';\nimport { buildInitiate } from './buildInitiate';\nimport type { ReferenceCacheCollection, ReferenceCacheLifecycle, ReferenceQueryLifecycle } from './buildMiddleware';\nimport { buildMiddleware } from './buildMiddleware';\nimport type { BuildSelectorsApiEndpointInfiniteQuery, BuildSelectorsApiEndpointMutation, BuildSelectorsApiEndpointQuery } from './buildSelectors';\nimport { buildSelectors } from './buildSelectors';\nimport type { SliceActions, UpsertEntries } from './buildSlice';\nimport { buildSlice } from './buildSlice';\nimport type { AllQueryKeys, BuildThunksApiEndpointInfiniteQuery, BuildThunksApiEndpointMutation, BuildThunksApiEndpointQuery, PatchQueryDataThunk, QueryArgFromAnyQueryDefinition, UpdateQueryDataThunk, UpsertQueryDataThunk } from './buildThunks';\nimport { buildThunks } from './buildThunks';\nimport { createSelector as _createSelector } from './rtkImports';\nimport { onFocus, onFocusLost, onOffline, onOnline } from './setupListeners';\nimport type { InternalMiddlewareState } from './buildMiddleware/types';\nimport { getOrInsertComputed } from '../utils';\nimport type { CreateSelectorFunction } from 'reselect';\n\n/**\n * `ifOlderThan` - (default: `false` | `number`) - _number is value in seconds_\n * - If specified, it will only run the query if the difference between `new Date()` and the last `fulfilledTimeStamp` is greater than the given value\n *\n * @overloadSummary\n * `force`\n * - If `force: true`, it will ignore the `ifOlderThan` value if it is set and the query will be run even if it exists in the cache.\n */\nexport type PrefetchOptions = {\n  ifOlderThan?: false | number;\n} | {\n  force?: boolean;\n};\nexport const coreModuleName = /* @__PURE__ */Symbol();\nexport type CoreModule = typeof coreModuleName | ReferenceCacheLifecycle | ReferenceQueryLifecycle | ReferenceCacheCollection;\nexport type ThunkWithReturnValue<T> = ThunkAction<T, any, any, UnknownAction>;\nexport interface ApiModules<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nBaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string> {\n  [coreModuleName]: {\n    /**\n     * This api's reducer should be mounted at `store[api.reducerPath]`.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    reducerPath: ReducerPath;\n    /**\n     * Internal actions not part of the public API. Note: These are subject to change at any given time.\n     */\n    internalActions: InternalActions;\n    /**\n     *  A standard redux reducer that enables core functionality. Make sure it's included in your store.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    reducer: Reducer<CombinedState<Definitions, TagTypes, ReducerPath>, UnknownAction>;\n    /**\n     * This is a standard redux middleware and is responsible for things like polling, garbage collection and a handful of other things. Make sure it's included in your store.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    middleware: Middleware<{}, RootState<Definitions, string, ReducerPath>, ThunkDispatch<any, any, UnknownAction>>;\n    /**\n     * A collection of utility thunks for various situations.\n     */\n    util: {\n      /**\n       * A thunk that (if dispatched) will return a specific running query, identified\n       * by `endpointName` and `arg`.\n       * If that query is not running, dispatching the thunk will result in `undefined`.\n       *\n       * Can be used to await a specific query triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningQueryThunk<EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>): ThunkWithReturnValue<QueryActionCreatorResult<Definitions[EndpointName] & {\n        type: 'query';\n      }> | InfiniteQueryActionCreatorResult<Definitions[EndpointName] & {\n        type: 'infinitequery';\n      }> | undefined>;\n\n      /**\n       * A thunk that (if dispatched) will return a specific running mutation, identified\n       * by `endpointName` and `fixedCacheKey` or `requestId`.\n       * If that mutation is not running, dispatching the thunk will result in `undefined`.\n       *\n       * Can be used to await a specific mutation triggered in any way,\n       * including via hook trigger functions or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningMutationThunk<EndpointName extends MutationKeys<Definitions>>(endpointName: EndpointName, fixedCacheKeyOrRequestId: string): ThunkWithReturnValue<MutationActionCreatorResult<Definitions[EndpointName] & {\n        type: 'mutation';\n      }> | undefined>;\n\n      /**\n       * A thunk that (if dispatched) will return all running queries.\n       *\n       * Useful for SSR scenarios to await all running queries triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningQueriesThunk(): ThunkWithReturnValue<Array<QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>>;\n\n      /**\n       * A thunk that (if dispatched) will return all running mutations.\n       *\n       * Useful for SSR scenarios to await all running mutations triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningMutationsThunk(): ThunkWithReturnValue<Array<MutationActionCreatorResult<any>>>;\n\n      /**\n       * A Redux thunk that can be used to manually trigger pre-fetching of data.\n       *\n       * The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a set of options used to determine if the data actually should be re-fetched based on cache staleness.\n       *\n       * React Hooks users will most likely never need to use this directly, as the `usePrefetch` hook will dispatch this thunk internally as needed when you call the prefetching function supplied by the hook.\n       *\n       * @example\n       *\n       * ```ts no-transpile\n       * dispatch(api.util.prefetch('getPosts', undefined, { force: true }))\n       * ```\n       */\n      prefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions): ThunkAction<void, any, any, UnknownAction>;\n      /**\n       * A Redux thunk action creator that, when dispatched, creates and applies a set of JSON diff/patch objects to the current state. This immediately updates the Redux state with those changes.\n       *\n       * The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and an `updateRecipe` callback function. The callback receives an Immer-wrapped `draft` of the current state, and may modify the draft to match the expected results after the mutation completes successfully.\n       *\n       * The thunk executes _synchronously_, and returns an object containing `{patches: Patch[], inversePatches: Patch[], undo: () => void}`. The `patches` and `inversePatches` are generated using Immer's [`produceWithPatches` method](https://immerjs.github.io/immer/patches).\n       *\n       * This is typically used as the first step in implementing optimistic updates. The generated `inversePatches` can be used to revert the updates by calling `dispatch(patchQueryData(endpointName, arg, inversePatches))`. Alternatively, the `undo` method can be called directly to achieve the same effect.\n       *\n       * Note that the first two arguments (`endpointName` and `arg`) are used to determine which existing cache entry to update. If no existing cache entry is found, the `updateRecipe` callback will not run.\n       *\n       * @example\n       *\n       * ```ts\n       * const patchCollection = dispatch(\n       *   api.util.updateQueryData('getPosts', undefined, (draftPosts) => {\n       *     draftPosts.push({ id: 1, name: 'Teddy' })\n       *   })\n       * )\n       * ```\n       */\n      updateQueryData: UpdateQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n\n      /**\n       * A Redux thunk action creator that, when dispatched, acts as an artificial API request to upsert a value into the cache.\n       *\n       * The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and the data to upsert.\n       *\n       * If no cache entry for that cache key exists, a cache entry will be created and the data added. If a cache entry already exists, this will _overwrite_ the existing cache entry data.\n       *\n       * The thunk executes _asynchronously_, and returns a promise that resolves when the store has been updated.\n       *\n       * If dispatched while an actual request is in progress, both the upsert and request will be handled as soon as they resolve, resulting in a \"last result wins\" update behavior.\n       *\n       * @example\n       *\n       * ```ts\n       * await dispatch(\n       *   api.util.upsertQueryData('getPost', {id: 1}, {id: 1, text: \"Hello!\"})\n       * )\n       * ```\n       */\n      upsertQueryData: UpsertQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n      /**\n       * A Redux thunk that applies a JSON diff/patch array to the cached data for a given query result. This immediately updates the Redux state with those changes.\n       *\n       * The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a JSON diff/patch array as produced by Immer's `produceWithPatches`.\n       *\n       * This is typically used as the second step in implementing optimistic updates. If a request fails, the optimistically-applied changes can be reverted by dispatching `patchQueryData` with the `inversePatches` that were generated by `updateQueryData` earlier.\n       *\n       * In cases where it is desired to simply revert the previous changes, it may be preferable to call the `undo` method returned from dispatching `updateQueryData` instead.\n       *\n       * @example\n       * ```ts\n       * const patchCollection = dispatch(\n       *   api.util.updateQueryData('getPosts', undefined, (draftPosts) => {\n       *     draftPosts.push({ id: 1, name: 'Teddy' })\n       *   })\n       * )\n       *\n       * // later\n       * dispatch(\n       *   api.util.patchQueryData('getPosts', undefined, patchCollection.inversePatches)\n       * )\n       *\n       * // or\n       * patchCollection.undo()\n       * ```\n       */\n      patchQueryData: PatchQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n\n      /**\n       * A Redux action creator that can be dispatched to manually reset the api state completely. This will immediately remove all existing cache entries, and all queries will be considered 'uninitialized'.\n       *\n       * @example\n       *\n       * ```ts\n       * dispatch(api.util.resetApiState())\n       * ```\n       */\n      resetApiState: SliceActions['resetApiState'];\n      upsertQueryEntries: UpsertEntries<Definitions>;\n\n      /**\n       * A Redux action creator that can be used to manually invalidate cache tags for [automated re-fetching](../../usage/automated-refetching.mdx).\n       *\n       * The action creator accepts one argument: the cache tags to be invalidated. It returns an action with those tags as a payload, and the corresponding `invalidateTags` action type for the api.\n       *\n       * Dispatching the result of this action creator will [invalidate](../../usage/automated-refetching.mdx#invalidating-cache-data) the given tags, causing queries to automatically re-fetch if they are subscribed to cache data that [provides](../../usage/automated-refetching.mdx#providing-cache-data) the corresponding tags.\n       *\n       * The array of tags provided to the action creator should be in one of the following formats, where `TagType` is equal to a string provided to the [`tagTypes`](../createApi.mdx#tagtypes) property of the api:\n       *\n       * - `[TagType]`\n       * - `[{ type: TagType }]`\n       * - `[{ type: TagType, id: number | string }]`\n       *\n       * @example\n       *\n       * ```ts\n       * dispatch(api.util.invalidateTags(['Post']))\n       * dispatch(api.util.invalidateTags([{ type: 'Post', id: 1 }]))\n       * dispatch(\n       *   api.util.invalidateTags([\n       *     { type: 'Post', id: 1 },\n       *     { type: 'Post', id: 'LIST' },\n       *   ])\n       * )\n       * ```\n       */\n      invalidateTags: ActionCreatorWithPayload<Array<TagDescription<TagTypes> | null | undefined>, string>;\n\n      /**\n       * A function to select all `{ endpointName, originalArgs, queryCacheKey }` combinations that would be invalidated by a specific set of tags.\n       *\n       * Can be used for mutations that want to do optimistic updates instead of invalidating a set of tags, but don't know exactly what they need to update.\n       */\n      selectInvalidatedBy: (state: RootState<Definitions, string, ReducerPath>, tags: ReadonlyArray<TagDescription<TagTypes> | null | undefined>) => Array<{\n        endpointName: string;\n        originalArgs: any;\n        queryCacheKey: string;\n      }>;\n\n      /**\n       * A function to select all arguments currently cached for a given endpoint.\n       *\n       * Can be used for mutations that want to do optimistic updates instead of invalidating a set of tags, but don't know exactly what they need to update.\n       */\n      selectCachedArgsForQuery: <QueryName extends AllQueryKeys<Definitions>>(state: RootState<Definitions, string, ReducerPath>, queryName: QueryName) => Array<QueryArgFromAnyQuery<Definitions[QueryName]>>;\n    };\n    /**\n     * Endpoints based on the input endpoints provided to `createApi`, containing `select` and `action matchers`.\n     */\n    endpoints: { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? ApiEndpointQuery<Definitions[K], Definitions> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? ApiEndpointMutation<Definitions[K], Definitions> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? ApiEndpointInfiniteQuery<Definitions[K], Definitions> : never };\n  };\n}\nexport interface ApiEndpointQuery<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends QueryDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointQuery<Definition>, BuildInitiateApiEndpointQuery<Definition>, BuildSelectorsApiEndpointQuery<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\nexport interface ApiEndpointInfiniteQuery<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends InfiniteQueryDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointInfiniteQuery<Definition>, BuildInitiateApiEndpointInfiniteQuery<Definition>, BuildSelectorsApiEndpointInfiniteQuery<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport interface ApiEndpointMutation<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends MutationDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointMutation<Definition>, BuildInitiateApiEndpointMutation<Definition>, BuildSelectorsApiEndpointMutation<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\nexport type ListenerActions = {\n  /**\n   * Will cause the RTK Query middleware to trigger any refetchOnReconnect-related behavior\n   * @link https://redux-toolkit.js.org/rtk-query/api/setupListeners\n   */\n  onOnline: typeof onOnline;\n  onOffline: typeof onOffline;\n  /**\n   * Will cause the RTK Query middleware to trigger any refetchOnFocus-related behavior\n   * @link https://redux-toolkit.js.org/rtk-query/api/setupListeners\n   */\n  onFocus: typeof onFocus;\n  onFocusLost: typeof onFocusLost;\n};\nexport type InternalActions = SliceActions & ListenerActions;\nexport interface CoreModuleOptions {\n  /**\n   * A selector creator (usually from `reselect`, or matching the same signature)\n   */\n  createSelector?: CreateSelectorFunction<any, any, any>;\n}\n\n/**\n * Creates a module containing the basic redux logic for use with `buildCreateApi`.\n *\n * @example\n * ```ts\n * const createBaseApi = buildCreateApi(coreModule());\n * ```\n */\nexport const coreModule = ({\n  createSelector = _createSelector\n}: CoreModuleOptions = {}): Module<CoreModule> => ({\n  name: coreModuleName,\n  init(api, {\n    baseQuery,\n    tagTypes,\n    reducerPath,\n    serializeQueryArgs,\n    keepUnusedDataFor,\n    refetchOnMountOrArgChange,\n    refetchOnFocus,\n    refetchOnReconnect,\n    invalidationBehavior,\n    onSchemaFailure,\n    catchSchemaFailure,\n    skipSchemaValidation\n  }, context) {\n    enablePatches();\n    assertCast<InternalSerializeQueryArgs>(serializeQueryArgs);\n    const assertTagType: AssertTagTypes = tag => {\n      if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n        if (!tagTypes.includes(tag.type as any)) {\n          console.error(`Tag type '${tag.type}' was used, but not specified in \\`tagTypes\\`!`);\n        }\n      }\n      return tag;\n    };\n    Object.assign(api, {\n      reducerPath,\n      endpoints: {},\n      internalActions: {\n        onOnline,\n        onOffline,\n        onFocus,\n        onFocusLost\n      },\n      util: {}\n    });\n    const selectors = buildSelectors({\n      serializeQueryArgs: serializeQueryArgs as any,\n      reducerPath,\n      createSelector\n    });\n    const {\n      selectInvalidatedBy,\n      selectCachedArgsForQuery,\n      buildQuerySelector,\n      buildInfiniteQuerySelector,\n      buildMutationSelector\n    } = selectors;\n    safeAssign(api.util, {\n      selectInvalidatedBy,\n      selectCachedArgsForQuery\n    });\n    const {\n      queryThunk,\n      infiniteQueryThunk,\n      mutationThunk,\n      patchQueryData,\n      updateQueryData,\n      upsertQueryData,\n      prefetch,\n      buildMatchThunkActions\n    } = buildThunks({\n      baseQuery,\n      reducerPath,\n      context,\n      api,\n      serializeQueryArgs,\n      assertTagType,\n      selectors,\n      onSchemaFailure,\n      catchSchemaFailure,\n      skipSchemaValidation\n    });\n    const {\n      reducer,\n      actions: sliceActions\n    } = buildSlice({\n      context,\n      queryThunk,\n      infiniteQueryThunk,\n      mutationThunk,\n      serializeQueryArgs,\n      reducerPath,\n      assertTagType,\n      config: {\n        refetchOnFocus,\n        refetchOnReconnect,\n        refetchOnMountOrArgChange,\n        keepUnusedDataFor,\n        reducerPath,\n        invalidationBehavior\n      }\n    });\n    safeAssign(api.util, {\n      patchQueryData,\n      updateQueryData,\n      upsertQueryData,\n      prefetch,\n      resetApiState: sliceActions.resetApiState,\n      upsertQueryEntries: sliceActions.cacheEntriesUpserted as any\n    });\n    safeAssign(api.internalActions, sliceActions);\n    const internalStateMap = new WeakMap<Dispatch, InternalMiddlewareState>();\n    const getInternalState = (dispatch: Dispatch) => {\n      const state = getOrInsertComputed(internalStateMap, dispatch, () => ({\n        currentSubscriptions: new Map(),\n        currentPolls: new Map(),\n        runningQueries: new Map(),\n        runningMutations: new Map()\n      }));\n      return state;\n    };\n    const {\n      buildInitiateQuery,\n      buildInitiateInfiniteQuery,\n      buildInitiateMutation,\n      getRunningMutationThunk,\n      getRunningMutationsThunk,\n      getRunningQueriesThunk,\n      getRunningQueryThunk\n    } = buildInitiate({\n      queryThunk,\n      mutationThunk,\n      infiniteQueryThunk,\n      api,\n      serializeQueryArgs: serializeQueryArgs as any,\n      context,\n      getInternalState\n    });\n    safeAssign(api.util, {\n      getRunningMutationThunk,\n      getRunningMutationsThunk,\n      getRunningQueryThunk,\n      getRunningQueriesThunk\n    });\n    const {\n      middleware,\n      actions: middlewareActions\n    } = buildMiddleware({\n      reducerPath,\n      context,\n      queryThunk,\n      mutationThunk,\n      infiniteQueryThunk,\n      api,\n      assertTagType,\n      selectors,\n      getRunningQueryThunk,\n      getInternalState\n    });\n    safeAssign(api.util, middlewareActions);\n    safeAssign(api, {\n      reducer: reducer as any,\n      middleware\n    });\n    return {\n      name: coreModuleName,\n      injectEndpoint(endpointName, definition) {\n        const anyApi = api as any as Api<any, Record<string, any>, string, string, CoreModule>;\n        const endpoint = anyApi.endpoints[endpointName] ??= {} as any;\n        if (isQueryDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildQuerySelector(endpointName, definition),\n            initiate: buildInitiateQuery(endpointName, definition)\n          }, buildMatchThunkActions(queryThunk, endpointName));\n        }\n        if (isMutationDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildMutationSelector(),\n            initiate: buildInitiateMutation(endpointName)\n          }, buildMatchThunkActions(mutationThunk, endpointName));\n        }\n        if (isInfiniteQueryDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildInfiniteQuerySelector(endpointName, definition),\n            initiate: buildInitiateInfiniteQuery(endpointName, definition)\n          }, buildMatchThunkActions(queryThunk, endpointName));\n        }\n      }\n    };\n  }\n});","import { buildCreateApi } from '../createApi';\nimport { coreModule } from './module';\nexport const createApi = /* @__PURE__ */buildCreateApi(coreModule());\nexport { QueryStatus } from './apiState';\nexport type { CombinedState, InfiniteData, InfiniteQueryConfigOptions, InfiniteQuerySubState, MutationKeys, QueryCacheKey, QueryKeys, QuerySubState, RootState, SubscriptionOptions } from './apiState';\nexport type { InfiniteQueryActionCreatorResult, MutationActionCreatorResult, QueryActionCreatorResult, StartQueryActionCreatorOptions } from './buildInitiate';\nexport type { MutationCacheLifecycleApi, MutationLifecycleApi, QueryCacheLifecycleApi, QueryLifecycleApi, SubscriptionSelectors, TypedMutationOnQueryStarted, TypedQueryOnQueryStarted } from './buildMiddleware/index';\nexport { skipToken } from './buildSelectors';\nexport type { InfiniteQueryResultSelectorResult, MutationResultSelectorResult, QueryResultSelectorResult, SkipToken } from './buildSelectors';\nexport type { SliceActions } from './buildSlice';\nexport type { PatchQueryDataThunk, UpdateQueryDataThunk, UpsertQueryDataThunk } from './buildThunks';\nexport { coreModuleName } from './module';\nexport type { ApiEndpointInfiniteQuery, ApiEndpointMutation, ApiEndpointQuery, CoreModule, InternalActions, PrefetchOptions, ThunkWithReturnValue } from './module';\nexport { setupListeners } from './setupListeners';\nexport { buildCreateApi, coreModule };"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEO,IAAK,cAAL,kBAAKA,iBAAL;AACL,EAAAA,aAAA,mBAAgB;AAChB,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,eAAY;AACZ,EAAAA,aAAA,cAAW;AAJD,SAAAA;AAAA,GAAA;AAQL,IAAM,uBAAuB;AAC7B,IAAM,iBAAiB;AACvB,IAAM,mBAAmB;AACzB,IAAM,kBAAkB;AA0BxB,SAAS,sBAAsB,QAAyC;AAC7E,SAAO;AAAA,IACL;AAAA,IACA,iBAAiB,WAAW;AAAA,IAC5B,WAAW,WAAW;AAAA,IACtB,WAAW,WAAW;AAAA,IACtB,SAAS,WAAW;AAAA,EACtB;AACF;;;AC3GA,SAAS,cAAc,aAAa,gBAAgB,kBAAkB,iBAAiB,iBAAiB,SAAS,SAAS,UAAU,WAAW,YAAY,aAAa,qBAAqB,oBAAoB,oBAAoB,kBAAkB,eAAe,cAAc;;;ACDpR,IAAMC,iBAAqC;AAEpC,SAAS,0BAA0B,QAAa,QAAkB;AACvE,MAAI,WAAW,UAAU,EAAEA,eAAc,MAAM,KAAKA,eAAc,MAAM,KAAK,MAAM,QAAQ,MAAM,KAAK,MAAM,QAAQ,MAAM,IAAI;AAC5H,WAAO;AAAA,EACT;AACA,QAAM,UAAU,OAAO,KAAK,MAAM;AAClC,QAAM,UAAU,OAAO,KAAK,MAAM;AAClC,MAAI,eAAe,QAAQ,WAAW,QAAQ;AAC9C,QAAM,WAAgB,MAAM,QAAQ,MAAM,IAAI,CAAC,IAA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AAAA,YAC9B,UAAU,sBAAsB,YAAY;AAAA,UAC9C,GAAG,uBAAuB,eAAe,YAAY,CAAC;AAAA,QACxD;AACA,YAAI,0BAA0B,UAAU,GAAG;AACzC,qBAAW,UAAU;AAAA,YACnB,MAAM;AAAA,YACN,QAAQ,2BAA2B,cAAc,UAAU;AAAA,YAC3D,UAAU,2BAA2B,cAAc,UAAU;AAAA,UAC/D,GAAG,uBAAuB,YAAY,YAAY,CAAC;AAAA,QACrD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;ACniBO,IAAM,YAA2B,+BAAe,WAAW,CAAC;","names":["QueryStatus","isPlainObject","_a","retry","updateListeners","_a","arg","force","options","actions","createSelector","_a","_formatProdErrorMessage","_formatProdErrorMessage2","key","queryArgsApi","_formatProdErrorMessage","getPreviousPageParam","_formatProdErrorMessage2","_formatProdErrorMessage","mwApi","mwApi","api","cacheKey","extra","api","extra","api","actions","initialized","createSelector"]}
Index: node_modules/@reduxjs/toolkit/dist/query/rtk-query.modern.mjs
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/rtk-query.modern.mjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/rtk-query.modern.mjs	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,3047 @@
+// src/query/core/apiState.ts
+var QueryStatus = /* @__PURE__ */ ((QueryStatus7) => {
+  QueryStatus7["uninitialized"] = "uninitialized";
+  QueryStatus7["pending"] = "pending";
+  QueryStatus7["fulfilled"] = "fulfilled";
+  QueryStatus7["rejected"] = "rejected";
+  return QueryStatus7;
+})(QueryStatus || {});
+var STATUS_UNINITIALIZED = "uninitialized" /* uninitialized */;
+var STATUS_PENDING = "pending" /* pending */;
+var STATUS_FULFILLED = "fulfilled" /* fulfilled */;
+var STATUS_REJECTED = "rejected" /* rejected */;
+function getRequestStatusFlags(status) {
+  return {
+    status,
+    isUninitialized: status === STATUS_UNINITIALIZED,
+    isLoading: status === STATUS_PENDING,
+    isSuccess: status === STATUS_FULFILLED,
+    isError: status === STATUS_REJECTED
+  };
+}
+
+// src/query/core/rtkImports.ts
+import { createAction, createSlice, createSelector, createAsyncThunk, combineReducers, createNextState, isAnyOf, isAllOf, isAction, isPending, isRejected, isFulfilled, isRejectedWithValue, isAsyncThunkAction, prepareAutoBatched, SHOULD_AUTOBATCH, isPlainObject, nanoid } from "@reduxjs/toolkit";
+
+// src/query/utils/copyWithStructuralSharing.ts
+var isPlainObject2 = isPlainObject;
+function copyWithStructuralSharing(oldObj, newObj) {
+  if (oldObj === newObj || !(isPlainObject2(oldObj) && isPlainObject2(newObj) || Array.isArray(oldObj) && Array.isArray(newObj))) {
+    return newObj;
+  }
+  const newKeys = Object.keys(newObj);
+  const oldKeys = Object.keys(oldObj);
+  let isSameObject = newKeys.length === oldKeys.length;
+  const mergeObj = Array.isArray(newObj) ? [] : {};
+  for (const key of newKeys) {
+    mergeObj[key] = copyWithStructuralSharing(oldObj[key], newObj[key]);
+    if (isSameObject) isSameObject = oldObj[key] === mergeObj[key];
+  }
+  return isSameObject ? oldObj : mergeObj;
+}
+
+// src/query/utils/filterMap.ts
+function filterMap(array, predicate, mapper) {
+  return array.reduce((acc, item, i) => {
+    if (predicate(item, i)) {
+      acc.push(mapper(item, i));
+    }
+    return acc;
+  }, []).flat();
+}
+
+// src/query/utils/isAbsoluteUrl.ts
+function isAbsoluteUrl(url) {
+  return new RegExp(`(^|:)//`).test(url);
+}
+
+// src/query/utils/isDocumentVisible.ts
+function isDocumentVisible() {
+  if (typeof document === "undefined") {
+    return true;
+  }
+  return document.visibilityState !== "hidden";
+}
+
+// src/query/utils/isNotNullish.ts
+function isNotNullish(v) {
+  return v != null;
+}
+function filterNullishValues(map) {
+  return [...map?.values() ?? []].filter(isNotNullish);
+}
+
+// src/query/utils/isOnline.ts
+function isOnline() {
+  return typeof navigator === "undefined" ? true : navigator.onLine === void 0 ? true : navigator.onLine;
+}
+
+// src/query/utils/joinUrls.ts
+var withoutTrailingSlash = (url) => url.replace(/\/$/, "");
+var withoutLeadingSlash = (url) => url.replace(/^\//, "");
+function joinUrls(base, url) {
+  if (!base) {
+    return url;
+  }
+  if (!url) {
+    return base;
+  }
+  if (isAbsoluteUrl(url)) {
+    return url;
+  }
+  const delimiter = base.endsWith("/") || !url.startsWith("?") ? "/" : "";
+  base = withoutTrailingSlash(base);
+  url = withoutLeadingSlash(url);
+  return `${base}${delimiter}${url}`;
+}
+
+// src/query/utils/getOrInsert.ts
+function getOrInsertComputed(map, key, compute) {
+  if (map.has(key)) return map.get(key);
+  return map.set(key, compute(key)).get(key);
+}
+var createNewMap = () => /* @__PURE__ */ new Map();
+
+// src/query/utils/signals.ts
+var timeoutSignal = (milliseconds) => {
+  const abortController = new AbortController();
+  setTimeout(() => {
+    const message = "signal timed out";
+    const name = "TimeoutError";
+    abortController.abort(
+      // some environments (React Native, Node) don't have DOMException
+      typeof DOMException !== "undefined" ? new DOMException(message, name) : Object.assign(new Error(message), {
+        name
+      })
+    );
+  }, milliseconds);
+  return abortController.signal;
+};
+var anySignal = (...signals) => {
+  for (const signal of signals) if (signal.aborted) return AbortSignal.abort(signal.reason);
+  const abortController = new AbortController();
+  for (const signal of signals) {
+    signal.addEventListener("abort", () => abortController.abort(signal.reason), {
+      signal: abortController.signal,
+      once: true
+    });
+  }
+  return abortController.signal;
+};
+
+// src/query/fetchBaseQuery.ts
+var defaultFetchFn = (...args) => fetch(...args);
+var defaultValidateStatus = (response) => response.status >= 200 && response.status <= 299;
+var defaultIsJsonContentType = (headers) => (
+  /*applicat*/
+  /ion\/(vnd\.api\+)?json/.test(headers.get("content-type") || "")
+);
+function stripUndefined(obj) {
+  if (!isPlainObject(obj)) {
+    return obj;
+  }
+  const copy = {
+    ...obj
+  };
+  for (const [k, v] of Object.entries(copy)) {
+    if (v === void 0) delete copy[k];
+  }
+  return copy;
+}
+var isJsonifiable = (body) => typeof body === "object" && (isPlainObject(body) || Array.isArray(body) || typeof body.toJSON === "function");
+function fetchBaseQuery({
+  baseUrl,
+  prepareHeaders = (x) => x,
+  fetchFn = defaultFetchFn,
+  paramsSerializer,
+  isJsonContentType = defaultIsJsonContentType,
+  jsonContentType = "application/json",
+  jsonReplacer,
+  timeout: defaultTimeout,
+  responseHandler: globalResponseHandler,
+  validateStatus: globalValidateStatus,
+  ...baseFetchOptions
+} = {}) {
+  if (typeof fetch === "undefined" && fetchFn === defaultFetchFn) {
+    console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments.");
+  }
+  return async (arg, api, extraOptions) => {
+    const {
+      getState,
+      extra,
+      endpoint,
+      forced,
+      type
+    } = api;
+    let meta;
+    let {
+      url,
+      headers = new Headers(baseFetchOptions.headers),
+      params = void 0,
+      responseHandler = globalResponseHandler ?? "json",
+      validateStatus = globalValidateStatus ?? defaultValidateStatus,
+      timeout = defaultTimeout,
+      ...rest
+    } = typeof arg == "string" ? {
+      url: arg
+    } : arg;
+    let config = {
+      ...baseFetchOptions,
+      signal: timeout ? anySignal(api.signal, timeoutSignal(timeout)) : api.signal,
+      ...rest
+    };
+    headers = new Headers(stripUndefined(headers));
+    config.headers = await prepareHeaders(headers, {
+      getState,
+      arg,
+      extra,
+      endpoint,
+      forced,
+      type,
+      extraOptions
+    }) || headers;
+    const bodyIsJsonifiable = isJsonifiable(config.body);
+    if (config.body != null && !bodyIsJsonifiable && typeof config.body !== "string") {
+      config.headers.delete("content-type");
+    }
+    if (!config.headers.has("content-type") && bodyIsJsonifiable) {
+      config.headers.set("content-type", jsonContentType);
+    }
+    if (bodyIsJsonifiable && isJsonContentType(config.headers)) {
+      config.body = JSON.stringify(config.body, jsonReplacer);
+    }
+    if (!config.headers.has("accept")) {
+      if (responseHandler === "json") {
+        config.headers.set("accept", "application/json");
+      } else if (responseHandler === "text") {
+        config.headers.set("accept", "text/plain, text/html, */*");
+      }
+    }
+    if (params) {
+      const divider = ~url.indexOf("?") ? "&" : "?";
+      const query = paramsSerializer ? paramsSerializer(params) : new URLSearchParams(stripUndefined(params));
+      url += divider + query;
+    }
+    url = joinUrls(baseUrl, url);
+    const request = new Request(url, config);
+    const requestClone = new Request(url, config);
+    meta = {
+      request: requestClone
+    };
+    let response;
+    try {
+      response = await fetchFn(request);
+    } catch (e) {
+      return {
+        error: {
+          status: (e instanceof Error || typeof DOMException !== "undefined" && e instanceof DOMException) && e.name === "TimeoutError" ? "TIMEOUT_ERROR" : "FETCH_ERROR",
+          error: String(e)
+        },
+        meta
+      };
+    }
+    const responseClone = response.clone();
+    meta.response = responseClone;
+    let resultData;
+    let responseText = "";
+    try {
+      let handleResponseError;
+      await Promise.all([
+        handleResponse(response, responseHandler).then((r) => resultData = r, (e) => handleResponseError = e),
+        // see https://github.com/node-fetch/node-fetch/issues/665#issuecomment-538995182
+        // we *have* to "use up" both streams at the same time or they will stop running in node-fetch scenarios
+        responseClone.text().then((r) => responseText = r, () => {
+        })
+      ]);
+      if (handleResponseError) throw handleResponseError;
+    } catch (e) {
+      return {
+        error: {
+          status: "PARSING_ERROR",
+          originalStatus: response.status,
+          data: responseText,
+          error: String(e)
+        },
+        meta
+      };
+    }
+    return validateStatus(response, resultData) ? {
+      data: resultData,
+      meta
+    } : {
+      error: {
+        status: response.status,
+        data: resultData
+      },
+      meta
+    };
+  };
+  async function handleResponse(response, responseHandler) {
+    if (typeof responseHandler === "function") {
+      return responseHandler(response);
+    }
+    if (responseHandler === "content-type") {
+      responseHandler = isJsonContentType(response.headers) ? "json" : "text";
+    }
+    if (responseHandler === "json") {
+      const text = await response.text();
+      return text.length ? JSON.parse(text) : null;
+    }
+    return response.text();
+  }
+}
+
+// src/query/HandledError.ts
+var HandledError = class {
+  constructor(value, meta = void 0) {
+    this.value = value;
+    this.meta = meta;
+  }
+};
+
+// src/query/retry.ts
+async function defaultBackoff(attempt = 0, maxRetries = 5, signal) {
+  const attempts = Math.min(attempt, maxRetries);
+  const timeout = ~~((Math.random() + 0.4) * (300 << attempts));
+  await new Promise((resolve, reject) => {
+    const timeoutId = setTimeout(() => resolve(), timeout);
+    if (signal) {
+      const abortHandler = () => {
+        clearTimeout(timeoutId);
+        reject(new Error("Aborted"));
+      };
+      if (signal.aborted) {
+        clearTimeout(timeoutId);
+        reject(new Error("Aborted"));
+      } else {
+        signal.addEventListener("abort", abortHandler, {
+          once: true
+        });
+      }
+    }
+  });
+}
+function fail(error, meta) {
+  throw Object.assign(new HandledError({
+    error,
+    meta
+  }), {
+    throwImmediately: true
+  });
+}
+function failIfAborted(signal) {
+  if (signal.aborted) {
+    fail({
+      status: "CUSTOM_ERROR",
+      error: "Aborted"
+    });
+  }
+}
+var EMPTY_OPTIONS = {};
+var retryWithBackoff = (baseQuery, defaultOptions) => async (args, api, extraOptions) => {
+  const possibleMaxRetries = [5, (defaultOptions || EMPTY_OPTIONS).maxRetries, (extraOptions || EMPTY_OPTIONS).maxRetries].filter((x) => x !== void 0);
+  const [maxRetries] = possibleMaxRetries.slice(-1);
+  const defaultRetryCondition = (_, __, {
+    attempt
+  }) => attempt <= maxRetries;
+  const options = {
+    maxRetries,
+    backoff: defaultBackoff,
+    retryCondition: defaultRetryCondition,
+    ...defaultOptions,
+    ...extraOptions
+  };
+  let retry2 = 0;
+  while (true) {
+    failIfAborted(api.signal);
+    try {
+      const result = await baseQuery(args, api, extraOptions);
+      if (result.error) {
+        throw new HandledError(result);
+      }
+      return result;
+    } catch (e) {
+      retry2++;
+      if (e.throwImmediately) {
+        if (e instanceof HandledError) {
+          return e.value;
+        }
+        throw e;
+      }
+      if (e instanceof HandledError) {
+        if (!options.retryCondition(e.value.error, args, {
+          attempt: retry2,
+          baseQueryApi: api,
+          extraOptions
+        })) {
+          return e.value;
+        }
+      } else {
+        if (retry2 > options.maxRetries) {
+          return {
+            error: e
+          };
+        }
+      }
+      failIfAborted(api.signal);
+      try {
+        await options.backoff(retry2, options.maxRetries, api.signal);
+      } catch (backoffError) {
+        failIfAborted(api.signal);
+        throw backoffError;
+      }
+    }
+  }
+};
+var retry = /* @__PURE__ */ Object.assign(retryWithBackoff, {
+  fail
+});
+
+// src/query/core/setupListeners.ts
+var INTERNAL_PREFIX = "__rtkq/";
+var ONLINE = "online";
+var OFFLINE = "offline";
+var FOCUS = "focus";
+var FOCUSED = "focused";
+var VISIBILITYCHANGE = "visibilitychange";
+var onFocus = /* @__PURE__ */ createAction(`${INTERNAL_PREFIX}${FOCUSED}`);
+var onFocusLost = /* @__PURE__ */ createAction(`${INTERNAL_PREFIX}un${FOCUSED}`);
+var onOnline = /* @__PURE__ */ createAction(`${INTERNAL_PREFIX}${ONLINE}`);
+var onOffline = /* @__PURE__ */ createAction(`${INTERNAL_PREFIX}${OFFLINE}`);
+var actions = {
+  onFocus,
+  onFocusLost,
+  onOnline,
+  onOffline
+};
+var initialized = false;
+function setupListeners(dispatch, customHandler) {
+  function defaultHandler() {
+    const [handleFocus, handleFocusLost, handleOnline, handleOffline] = [onFocus, onFocusLost, onOnline, onOffline].map((action) => () => dispatch(action()));
+    const handleVisibilityChange = () => {
+      if (window.document.visibilityState === "visible") {
+        handleFocus();
+      } else {
+        handleFocusLost();
+      }
+    };
+    let unsubscribe = () => {
+      initialized = false;
+    };
+    if (!initialized) {
+      if (typeof window !== "undefined" && window.addEventListener) {
+        let updateListeners2 = function(add) {
+          Object.entries(handlers).forEach(([event, handler]) => {
+            if (add) {
+              window.addEventListener(event, handler, false);
+            } else {
+              window.removeEventListener(event, handler);
+            }
+          });
+        };
+        var updateListeners = updateListeners2;
+        const handlers = {
+          [FOCUS]: handleFocus,
+          [VISIBILITYCHANGE]: handleVisibilityChange,
+          [ONLINE]: handleOnline,
+          [OFFLINE]: handleOffline
+        };
+        updateListeners2(true);
+        initialized = true;
+        unsubscribe = () => {
+          updateListeners2(false);
+          initialized = false;
+        };
+      }
+    }
+    return unsubscribe;
+  }
+  return customHandler ? customHandler(dispatch, actions) : defaultHandler();
+}
+
+// src/query/endpointDefinitions.ts
+var ENDPOINT_QUERY = "query" /* query */;
+var ENDPOINT_MUTATION = "mutation" /* mutation */;
+var ENDPOINT_INFINITEQUERY = "infinitequery" /* infinitequery */;
+function isQueryDefinition(e) {
+  return e.type === ENDPOINT_QUERY;
+}
+function isMutationDefinition(e) {
+  return e.type === ENDPOINT_MUTATION;
+}
+function isInfiniteQueryDefinition(e) {
+  return e.type === ENDPOINT_INFINITEQUERY;
+}
+function isAnyQueryDefinition(e) {
+  return isQueryDefinition(e) || isInfiniteQueryDefinition(e);
+}
+function calculateProvidedBy(description, result, error, queryArg, meta, assertTagTypes) {
+  const finalDescription = isFunction(description) ? description(result, error, queryArg, meta) : description;
+  if (finalDescription) {
+    return filterMap(finalDescription, isNotNullish, (tag) => assertTagTypes(expandTagDescription(tag)));
+  }
+  return [];
+}
+function isFunction(t) {
+  return typeof t === "function";
+}
+function expandTagDescription(description) {
+  return typeof description === "string" ? {
+    type: description
+  } : description;
+}
+
+// src/query/utils/immerImports.ts
+import { current, isDraft, applyPatches, original, isDraftable, produceWithPatches, enablePatches } from "immer";
+
+// src/query/core/buildInitiate.ts
+import { formatProdErrorMessage as _formatProdErrorMessage } from "@reduxjs/toolkit";
+
+// src/tsHelpers.ts
+function asSafePromise(promise, fallback) {
+  return promise.catch(fallback);
+}
+
+// src/query/apiTypes.ts
+var getEndpointDefinition = (context, endpointName) => context.endpointDefinitions[endpointName];
+
+// src/query/core/buildInitiate.ts
+var forceQueryFnSymbol = Symbol("forceQueryFn");
+var isUpsertQuery = (arg) => typeof arg[forceQueryFnSymbol] === "function";
+function buildInitiate({
+  serializeQueryArgs,
+  queryThunk,
+  infiniteQueryThunk,
+  mutationThunk,
+  api,
+  context,
+  getInternalState
+}) {
+  const getRunningQueries = (dispatch) => getInternalState(dispatch)?.runningQueries;
+  const getRunningMutations = (dispatch) => getInternalState(dispatch)?.runningMutations;
+  const {
+    unsubscribeQueryResult,
+    removeMutationResult,
+    updateSubscriptionOptions
+  } = api.internalActions;
+  return {
+    buildInitiateQuery,
+    buildInitiateInfiniteQuery,
+    buildInitiateMutation,
+    getRunningQueryThunk,
+    getRunningMutationThunk,
+    getRunningQueriesThunk,
+    getRunningMutationsThunk
+  };
+  function getRunningQueryThunk(endpointName, queryArgs) {
+    return (dispatch) => {
+      const endpointDefinition = getEndpointDefinition(context, endpointName);
+      const queryCacheKey = serializeQueryArgs({
+        queryArgs,
+        endpointDefinition,
+        endpointName
+      });
+      return getRunningQueries(dispatch)?.get(queryCacheKey);
+    };
+  }
+  function getRunningMutationThunk(_endpointName, fixedCacheKeyOrRequestId) {
+    return (dispatch) => {
+      return getRunningMutations(dispatch)?.get(fixedCacheKeyOrRequestId);
+    };
+  }
+  function getRunningQueriesThunk() {
+    return (dispatch) => filterNullishValues(getRunningQueries(dispatch));
+  }
+  function getRunningMutationsThunk() {
+    return (dispatch) => filterNullishValues(getRunningMutations(dispatch));
+  }
+  function middlewareWarning(dispatch) {
+    if (process.env.NODE_ENV !== "production") {
+      if (middlewareWarning.triggered) return;
+      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());
+      middlewareWarning.triggered = true;
+      if (typeof returnedValue !== "object" || typeof returnedValue?.type === "string") {
+        throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage(34) : `Warning: Middleware for RTK-Query API at reducerPath "${api.reducerPath}" has not been added to the store.
+You must add the middleware for RTK-Query to function correctly!`);
+      }
+    }
+  }
+  function buildInitiateAnyQuery(endpointName, endpointDefinition) {
+    const queryAction = (arg, {
+      subscribe = true,
+      forceRefetch,
+      subscriptionOptions,
+      [forceQueryFnSymbol]: forceQueryFn,
+      ...rest
+    } = {}) => (dispatch, getState) => {
+      const queryCacheKey = serializeQueryArgs({
+        queryArgs: arg,
+        endpointDefinition,
+        endpointName
+      });
+      let thunk;
+      const commonThunkArgs = {
+        ...rest,
+        type: ENDPOINT_QUERY,
+        subscribe,
+        forceRefetch,
+        subscriptionOptions,
+        endpointName,
+        originalArgs: arg,
+        queryCacheKey,
+        [forceQueryFnSymbol]: forceQueryFn
+      };
+      if (isQueryDefinition(endpointDefinition)) {
+        thunk = queryThunk(commonThunkArgs);
+      } else {
+        const {
+          direction,
+          initialPageParam,
+          refetchCachedPages
+        } = rest;
+        thunk = infiniteQueryThunk({
+          ...commonThunkArgs,
+          // Supply these even if undefined. This helps with a field existence
+          // check over in `buildSlice.ts`
+          direction,
+          initialPageParam,
+          refetchCachedPages
+        });
+      }
+      const selector = api.endpoints[endpointName].select(arg);
+      const thunkResult = dispatch(thunk);
+      const stateAfter = selector(getState());
+      middlewareWarning(dispatch);
+      const {
+        requestId,
+        abort
+      } = thunkResult;
+      const skippedSynchronously = stateAfter.requestId !== requestId;
+      const runningQuery = getRunningQueries(dispatch)?.get(queryCacheKey);
+      const selectFromState = () => selector(getState());
+      const statePromise = Object.assign(forceQueryFn ? (
+        // a query has been forced (upsertQueryData)
+        // -> we want to resolve it once data has been written with the data that will be written
+        thunkResult.then(selectFromState)
+      ) : skippedSynchronously && !runningQuery ? (
+        // a query has been skipped due to a condition and we do not have any currently running query
+        // -> we want to resolve it immediately with the current data
+        Promise.resolve(stateAfter)
+      ) : (
+        // query just started or one is already in flight
+        // -> wait for the running query, then resolve with data from after that
+        Promise.all([runningQuery, thunkResult]).then(selectFromState)
+      ), {
+        arg,
+        requestId,
+        subscriptionOptions,
+        queryCacheKey,
+        abort,
+        async unwrap() {
+          const result = await statePromise;
+          if (result.isError) {
+            throw result.error;
+          }
+          return result.data;
+        },
+        refetch: (options) => dispatch(queryAction(arg, {
+          subscribe: false,
+          forceRefetch: true,
+          ...options
+        })),
+        unsubscribe() {
+          if (subscribe) dispatch(unsubscribeQueryResult({
+            queryCacheKey,
+            requestId
+          }));
+        },
+        updateSubscriptionOptions(options) {
+          statePromise.subscriptionOptions = options;
+          dispatch(updateSubscriptionOptions({
+            endpointName,
+            requestId,
+            queryCacheKey,
+            options
+          }));
+        }
+      });
+      if (!runningQuery && !skippedSynchronously && !forceQueryFn) {
+        const runningQueries = getRunningQueries(dispatch);
+        runningQueries.set(queryCacheKey, statePromise);
+        statePromise.then(() => {
+          runningQueries.delete(queryCacheKey);
+        });
+      }
+      return statePromise;
+    };
+    return queryAction;
+  }
+  function buildInitiateQuery(endpointName, endpointDefinition) {
+    const queryAction = buildInitiateAnyQuery(endpointName, endpointDefinition);
+    return queryAction;
+  }
+  function buildInitiateInfiniteQuery(endpointName, endpointDefinition) {
+    const infiniteQueryAction = buildInitiateAnyQuery(endpointName, endpointDefinition);
+    return infiniteQueryAction;
+  }
+  function buildInitiateMutation(endpointName) {
+    return (arg, {
+      track = true,
+      fixedCacheKey
+    } = {}) => (dispatch, getState) => {
+      const thunk = mutationThunk({
+        type: "mutation",
+        endpointName,
+        originalArgs: arg,
+        track,
+        fixedCacheKey
+      });
+      const thunkResult = dispatch(thunk);
+      middlewareWarning(dispatch);
+      const {
+        requestId,
+        abort,
+        unwrap
+      } = thunkResult;
+      const returnValuePromise = asSafePromise(thunkResult.unwrap().then((data) => ({
+        data
+      })), (error) => ({
+        error
+      }));
+      const reset = () => {
+        dispatch(removeMutationResult({
+          requestId,
+          fixedCacheKey
+        }));
+      };
+      const ret = Object.assign(returnValuePromise, {
+        arg: thunkResult.arg,
+        requestId,
+        abort,
+        unwrap,
+        reset
+      });
+      const runningMutations = getRunningMutations(dispatch);
+      runningMutations.set(requestId, ret);
+      ret.then(() => {
+        runningMutations.delete(requestId);
+      });
+      if (fixedCacheKey) {
+        runningMutations.set(fixedCacheKey, ret);
+        ret.then(() => {
+          if (runningMutations.get(fixedCacheKey) === ret) {
+            runningMutations.delete(fixedCacheKey);
+          }
+        });
+      }
+      return ret;
+    };
+  }
+}
+
+// src/query/standardSchema.ts
+import { SchemaError } from "@standard-schema/utils";
+var NamedSchemaError = class extends SchemaError {
+  constructor(issues, value, schemaName, _bqMeta) {
+    super(issues);
+    this.value = value;
+    this.schemaName = schemaName;
+    this._bqMeta = _bqMeta;
+  }
+};
+var shouldSkip = (skipSchemaValidation, schemaName) => Array.isArray(skipSchemaValidation) ? skipSchemaValidation.includes(schemaName) : !!skipSchemaValidation;
+async function parseWithSchema(schema, data, schemaName, bqMeta) {
+  const result = await schema["~standard"].validate(data);
+  if (result.issues) {
+    throw new NamedSchemaError(result.issues, data, schemaName, bqMeta);
+  }
+  return result.value;
+}
+
+// src/query/core/buildThunks.ts
+function defaultTransformResponse(baseQueryReturnValue) {
+  return baseQueryReturnValue;
+}
+var addShouldAutoBatch = (arg = {}) => {
+  return {
+    ...arg,
+    [SHOULD_AUTOBATCH]: true
+  };
+};
+function buildThunks({
+  reducerPath,
+  baseQuery,
+  context: {
+    endpointDefinitions
+  },
+  serializeQueryArgs,
+  api,
+  assertTagType,
+  selectors,
+  onSchemaFailure,
+  catchSchemaFailure: globalCatchSchemaFailure,
+  skipSchemaValidation: globalSkipSchemaValidation
+}) {
+  const patchQueryData = (endpointName, arg, patches, updateProvided) => (dispatch, getState) => {
+    const endpointDefinition = endpointDefinitions[endpointName];
+    const queryCacheKey = serializeQueryArgs({
+      queryArgs: arg,
+      endpointDefinition,
+      endpointName
+    });
+    dispatch(api.internalActions.queryResultPatched({
+      queryCacheKey,
+      patches
+    }));
+    if (!updateProvided) {
+      return;
+    }
+    const newValue = api.endpoints[endpointName].select(arg)(
+      // Work around TS 4.1 mismatch
+      getState()
+    );
+    const providedTags = calculateProvidedBy(endpointDefinition.providesTags, newValue.data, void 0, arg, {}, assertTagType);
+    dispatch(api.internalActions.updateProvidedBy([{
+      queryCacheKey,
+      providedTags
+    }]));
+  };
+  function addToStart(items, item, max = 0) {
+    const newItems = [item, ...items];
+    return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
+  }
+  function addToEnd(items, item, max = 0) {
+    const newItems = [...items, item];
+    return max && newItems.length > max ? newItems.slice(1) : newItems;
+  }
+  const updateQueryData = (endpointName, arg, updateRecipe, updateProvided = true) => (dispatch, getState) => {
+    const endpointDefinition = api.endpoints[endpointName];
+    const currentState = endpointDefinition.select(arg)(
+      // Work around TS 4.1 mismatch
+      getState()
+    );
+    const ret = {
+      patches: [],
+      inversePatches: [],
+      undo: () => dispatch(api.util.patchQueryData(endpointName, arg, ret.inversePatches, updateProvided))
+    };
+    if (currentState.status === STATUS_UNINITIALIZED) {
+      return ret;
+    }
+    let newValue;
+    if ("data" in currentState) {
+      if (isDraftable(currentState.data)) {
+        const [value, patches, inversePatches] = produceWithPatches(currentState.data, updateRecipe);
+        ret.patches.push(...patches);
+        ret.inversePatches.push(...inversePatches);
+        newValue = value;
+      } else {
+        newValue = updateRecipe(currentState.data);
+        ret.patches.push({
+          op: "replace",
+          path: [],
+          value: newValue
+        });
+        ret.inversePatches.push({
+          op: "replace",
+          path: [],
+          value: currentState.data
+        });
+      }
+    }
+    if (ret.patches.length === 0) {
+      return ret;
+    }
+    dispatch(api.util.patchQueryData(endpointName, arg, ret.patches, updateProvided));
+    return ret;
+  };
+  const upsertQueryData = (endpointName, arg, value) => (dispatch) => {
+    const res = dispatch(api.endpoints[endpointName].initiate(arg, {
+      subscribe: false,
+      forceRefetch: true,
+      [forceQueryFnSymbol]: () => ({
+        data: value
+      })
+    }));
+    return res;
+  };
+  const getTransformCallbackForEndpoint = (endpointDefinition, transformFieldName) => {
+    return endpointDefinition.query && endpointDefinition[transformFieldName] ? endpointDefinition[transformFieldName] : defaultTransformResponse;
+  };
+  const executeEndpoint = async (arg, {
+    signal,
+    abort,
+    rejectWithValue,
+    fulfillWithValue,
+    dispatch,
+    getState,
+    extra
+  }) => {
+    const endpointDefinition = endpointDefinitions[arg.endpointName];
+    const {
+      metaSchema,
+      skipSchemaValidation = globalSkipSchemaValidation
+    } = endpointDefinition;
+    const isQuery = arg.type === ENDPOINT_QUERY;
+    try {
+      let transformResponse = defaultTransformResponse;
+      const baseQueryApi = {
+        signal,
+        abort,
+        dispatch,
+        getState,
+        extra,
+        endpoint: arg.endpointName,
+        type: arg.type,
+        forced: isQuery ? isForcedQuery(arg, getState()) : void 0,
+        queryCacheKey: isQuery ? arg.queryCacheKey : void 0
+      };
+      const forceQueryFn = isQuery ? arg[forceQueryFnSymbol] : void 0;
+      let finalQueryReturnValue;
+      const fetchPage = async (data, param, maxPages, previous) => {
+        if (param == null && data.pages.length) {
+          return Promise.resolve({
+            data
+          });
+        }
+        const finalQueryArg = {
+          queryArg: arg.originalArgs,
+          pageParam: param
+        };
+        const pageResponse = await executeRequest(finalQueryArg);
+        const addTo = previous ? addToStart : addToEnd;
+        return {
+          data: {
+            pages: addTo(data.pages, pageResponse.data, maxPages),
+            pageParams: addTo(data.pageParams, param, maxPages)
+          },
+          meta: pageResponse.meta
+        };
+      };
+      async function executeRequest(finalQueryArg) {
+        let result;
+        const {
+          extraOptions,
+          argSchema,
+          rawResponseSchema,
+          responseSchema
+        } = endpointDefinition;
+        if (argSchema && !shouldSkip(skipSchemaValidation, "arg")) {
+          finalQueryArg = await parseWithSchema(
+            argSchema,
+            finalQueryArg,
+            "argSchema",
+            {}
+            // we don't have a meta yet, so we can't pass it
+          );
+        }
+        if (forceQueryFn) {
+          result = forceQueryFn();
+        } else if (endpointDefinition.query) {
+          transformResponse = getTransformCallbackForEndpoint(endpointDefinition, "transformResponse");
+          result = await baseQuery(endpointDefinition.query(finalQueryArg), baseQueryApi, extraOptions);
+        } else {
+          result = await endpointDefinition.queryFn(finalQueryArg, baseQueryApi, extraOptions, (arg2) => baseQuery(arg2, baseQueryApi, extraOptions));
+        }
+        if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
+          const what = endpointDefinition.query ? "`baseQuery`" : "`queryFn`";
+          let err;
+          if (!result) {
+            err = `${what} did not return anything.`;
+          } else if (typeof result !== "object") {
+            err = `${what} did not return an object.`;
+          } else if (result.error && result.data) {
+            err = `${what} returned an object containing both \`error\` and \`result\`.`;
+          } else if (result.error === void 0 && result.data === void 0) {
+            err = `${what} returned an object containing neither a valid \`error\` and \`result\`. At least one of them should not be \`undefined\``;
+          } else {
+            for (const key of Object.keys(result)) {
+              if (key !== "error" && key !== "data" && key !== "meta") {
+                err = `The object returned by ${what} has the unknown property ${key}.`;
+                break;
+              }
+            }
+          }
+          if (err) {
+            console.error(`Error encountered handling the endpoint ${arg.endpointName}.
+                  ${err}
+                  It needs to return an object with either the shape \`{ data: <value> }\` or \`{ error: <value> }\` that may contain an optional \`meta\` property.
+                  Object returned was:`, result);
+          }
+        }
+        if (result.error) throw new HandledError(result.error, result.meta);
+        let {
+          data
+        } = result;
+        if (rawResponseSchema && !shouldSkip(skipSchemaValidation, "rawResponse")) {
+          data = await parseWithSchema(rawResponseSchema, result.data, "rawResponseSchema", result.meta);
+        }
+        let transformedResponse = await transformResponse(data, result.meta, finalQueryArg);
+        if (responseSchema && !shouldSkip(skipSchemaValidation, "response")) {
+          transformedResponse = await parseWithSchema(responseSchema, transformedResponse, "responseSchema", result.meta);
+        }
+        return {
+          ...result,
+          data: transformedResponse
+        };
+      }
+      if (isQuery && "infiniteQueryOptions" in endpointDefinition) {
+        const {
+          infiniteQueryOptions
+        } = endpointDefinition;
+        const {
+          maxPages = Infinity
+        } = infiniteQueryOptions;
+        const refetchCachedPages = arg.refetchCachedPages ?? infiniteQueryOptions.refetchCachedPages ?? true;
+        let result;
+        const blankData = {
+          pages: [],
+          pageParams: []
+        };
+        const cachedData = selectors.selectQueryEntry(getState(), arg.queryCacheKey)?.data;
+        const isForcedQueryNeedingRefetch = (
+          // arg.forceRefetch
+          isForcedQuery(arg, getState()) && !arg.direction
+        );
+        const existingData = isForcedQueryNeedingRefetch || !cachedData ? blankData : cachedData;
+        if ("direction" in arg && arg.direction && existingData.pages.length) {
+          const previous = arg.direction === "backward";
+          const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
+          const param = pageParamFn(infiniteQueryOptions, existingData, arg.originalArgs);
+          result = await fetchPage(existingData, param, maxPages, previous);
+        } else {
+          const {
+            initialPageParam = infiniteQueryOptions.initialPageParam
+          } = arg;
+          const cachedPageParams = cachedData?.pageParams ?? [];
+          const firstPageParam = cachedPageParams[0] ?? initialPageParam;
+          const totalPages = cachedPageParams.length;
+          result = await fetchPage(existingData, firstPageParam, maxPages);
+          if (forceQueryFn) {
+            result = {
+              data: result.data.pages[0]
+            };
+          }
+          if (refetchCachedPages) {
+            for (let i = 1; i < totalPages; i++) {
+              const param = getNextPageParam(infiniteQueryOptions, result.data, arg.originalArgs);
+              result = await fetchPage(result.data, param, maxPages);
+            }
+          }
+        }
+        finalQueryReturnValue = result;
+      } else {
+        finalQueryReturnValue = await executeRequest(arg.originalArgs);
+      }
+      if (metaSchema && !shouldSkip(skipSchemaValidation, "meta") && finalQueryReturnValue.meta) {
+        finalQueryReturnValue.meta = await parseWithSchema(metaSchema, finalQueryReturnValue.meta, "metaSchema", finalQueryReturnValue.meta);
+      }
+      return fulfillWithValue(finalQueryReturnValue.data, addShouldAutoBatch({
+        fulfilledTimeStamp: Date.now(),
+        baseQueryMeta: finalQueryReturnValue.meta
+      }));
+    } catch (error) {
+      let caughtError = error;
+      if (caughtError instanceof HandledError) {
+        let transformErrorResponse = getTransformCallbackForEndpoint(endpointDefinition, "transformErrorResponse");
+        const {
+          rawErrorResponseSchema,
+          errorResponseSchema
+        } = endpointDefinition;
+        let {
+          value,
+          meta
+        } = caughtError;
+        try {
+          if (rawErrorResponseSchema && !shouldSkip(skipSchemaValidation, "rawErrorResponse")) {
+            value = await parseWithSchema(rawErrorResponseSchema, value, "rawErrorResponseSchema", meta);
+          }
+          if (metaSchema && !shouldSkip(skipSchemaValidation, "meta")) {
+            meta = await parseWithSchema(metaSchema, meta, "metaSchema", meta);
+          }
+          let transformedErrorResponse = await transformErrorResponse(value, meta, arg.originalArgs);
+          if (errorResponseSchema && !shouldSkip(skipSchemaValidation, "errorResponse")) {
+            transformedErrorResponse = await parseWithSchema(errorResponseSchema, transformedErrorResponse, "errorResponseSchema", meta);
+          }
+          return rejectWithValue(transformedErrorResponse, addShouldAutoBatch({
+            baseQueryMeta: meta
+          }));
+        } catch (e) {
+          caughtError = e;
+        }
+      }
+      try {
+        if (caughtError instanceof NamedSchemaError) {
+          const info = {
+            endpoint: arg.endpointName,
+            arg: arg.originalArgs,
+            type: arg.type,
+            queryCacheKey: isQuery ? arg.queryCacheKey : void 0
+          };
+          endpointDefinition.onSchemaFailure?.(caughtError, info);
+          onSchemaFailure?.(caughtError, info);
+          const {
+            catchSchemaFailure = globalCatchSchemaFailure
+          } = endpointDefinition;
+          if (catchSchemaFailure) {
+            return rejectWithValue(catchSchemaFailure(caughtError, info), addShouldAutoBatch({
+              baseQueryMeta: caughtError._bqMeta
+            }));
+          }
+        }
+      } catch (e) {
+        caughtError = e;
+      }
+      if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
+        console.error(`An unhandled error occurred processing a request for the endpoint "${arg.endpointName}".
+In the case of an unhandled error, no tags will be "provided" or "invalidated".`, caughtError);
+      } else {
+        console.error(caughtError);
+      }
+      throw caughtError;
+    }
+  };
+  function isForcedQuery(arg, state) {
+    const requestState = selectors.selectQueryEntry(state, arg.queryCacheKey);
+    const baseFetchOnMountOrArgChange = selectors.selectConfig(state).refetchOnMountOrArgChange;
+    const fulfilledVal = requestState?.fulfilledTimeStamp;
+    const refetchVal = arg.forceRefetch ?? (arg.subscribe && baseFetchOnMountOrArgChange);
+    if (refetchVal) {
+      return refetchVal === true || (Number(/* @__PURE__ */ new Date()) - Number(fulfilledVal)) / 1e3 >= refetchVal;
+    }
+    return false;
+  }
+  const createQueryThunk = () => {
+    const generatedQueryThunk = createAsyncThunk(`${reducerPath}/executeQuery`, executeEndpoint, {
+      getPendingMeta({
+        arg
+      }) {
+        const endpointDefinition = endpointDefinitions[arg.endpointName];
+        return addShouldAutoBatch({
+          startedTimeStamp: Date.now(),
+          ...isInfiniteQueryDefinition(endpointDefinition) ? {
+            direction: arg.direction
+          } : {}
+        });
+      },
+      condition(queryThunkArg, {
+        getState
+      }) {
+        const state = getState();
+        const requestState = selectors.selectQueryEntry(state, queryThunkArg.queryCacheKey);
+        const fulfilledVal = requestState?.fulfilledTimeStamp;
+        const currentArg = queryThunkArg.originalArgs;
+        const previousArg = requestState?.originalArgs;
+        const endpointDefinition = endpointDefinitions[queryThunkArg.endpointName];
+        const direction = queryThunkArg.direction;
+        if (isUpsertQuery(queryThunkArg)) {
+          return true;
+        }
+        if (requestState?.status === "pending") {
+          return false;
+        }
+        if (isForcedQuery(queryThunkArg, state)) {
+          return true;
+        }
+        if (isQueryDefinition(endpointDefinition) && endpointDefinition?.forceRefetch?.({
+          currentArg,
+          previousArg,
+          endpointState: requestState,
+          state
+        })) {
+          return true;
+        }
+        if (fulfilledVal && !direction) {
+          return false;
+        }
+        return true;
+      },
+      dispatchConditionRejection: true
+    });
+    return generatedQueryThunk;
+  };
+  const queryThunk = createQueryThunk();
+  const infiniteQueryThunk = createQueryThunk();
+  const mutationThunk = createAsyncThunk(`${reducerPath}/executeMutation`, executeEndpoint, {
+    getPendingMeta() {
+      return addShouldAutoBatch({
+        startedTimeStamp: Date.now()
+      });
+    }
+  });
+  const hasTheForce = (options) => "force" in options;
+  const hasMaxAge = (options) => "ifOlderThan" in options;
+  const prefetch = (endpointName, arg, options = {}) => (dispatch, getState) => {
+    const force = hasTheForce(options) && options.force;
+    const maxAge = hasMaxAge(options) && options.ifOlderThan;
+    const queryAction = (force2 = true) => {
+      const options2 = {
+        forceRefetch: force2,
+        subscribe: false
+      };
+      return api.endpoints[endpointName].initiate(arg, options2);
+    };
+    const latestStateValue = api.endpoints[endpointName].select(arg)(getState());
+    if (force) {
+      dispatch(queryAction());
+    } else if (maxAge) {
+      const lastFulfilledTs = latestStateValue?.fulfilledTimeStamp;
+      if (!lastFulfilledTs) {
+        dispatch(queryAction());
+        return;
+      }
+      const shouldRetrigger = (Number(/* @__PURE__ */ new Date()) - Number(new Date(lastFulfilledTs))) / 1e3 >= maxAge;
+      if (shouldRetrigger) {
+        dispatch(queryAction());
+      }
+    } else {
+      dispatch(queryAction(false));
+    }
+  };
+  function matchesEndpoint(endpointName) {
+    return (action) => action?.meta?.arg?.endpointName === endpointName;
+  }
+  function buildMatchThunkActions(thunk, endpointName) {
+    return {
+      matchPending: isAllOf(isPending(thunk), matchesEndpoint(endpointName)),
+      matchFulfilled: isAllOf(isFulfilled(thunk), matchesEndpoint(endpointName)),
+      matchRejected: isAllOf(isRejected(thunk), matchesEndpoint(endpointName))
+    };
+  }
+  return {
+    queryThunk,
+    mutationThunk,
+    infiniteQueryThunk,
+    prefetch,
+    updateQueryData,
+    upsertQueryData,
+    patchQueryData,
+    buildMatchThunkActions
+  };
+}
+function getNextPageParam(options, {
+  pages,
+  pageParams
+}, queryArg) {
+  const lastIndex = pages.length - 1;
+  return options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams, queryArg);
+}
+function getPreviousPageParam(options, {
+  pages,
+  pageParams
+}, queryArg) {
+  return options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams, queryArg);
+}
+function calculateProvidedByThunk(action, type, endpointDefinitions, assertTagType) {
+  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);
+}
+
+// src/query/utils/getCurrent.ts
+function getCurrent(value) {
+  return isDraft(value) ? current(value) : value;
+}
+
+// src/query/core/buildSlice.ts
+function updateQuerySubstateIfExists(state, queryCacheKey, update) {
+  const substate = state[queryCacheKey];
+  if (substate) {
+    update(substate);
+  }
+}
+function getMutationCacheKey(id) {
+  return ("arg" in id ? id.arg.fixedCacheKey : id.fixedCacheKey) ?? id.requestId;
+}
+function updateMutationSubstateIfExists(state, id, update) {
+  const substate = state[getMutationCacheKey(id)];
+  if (substate) {
+    update(substate);
+  }
+}
+var initialState = {};
+function buildSlice({
+  reducerPath,
+  queryThunk,
+  mutationThunk,
+  serializeQueryArgs,
+  context: {
+    endpointDefinitions: definitions,
+    apiUid,
+    extractRehydrationInfo,
+    hasRehydrationInfo
+  },
+  assertTagType,
+  config
+}) {
+  const resetApiState = createAction(`${reducerPath}/resetApiState`);
+  function writePendingCacheEntry(draft, arg, upserting, meta) {
+    draft[arg.queryCacheKey] ??= {
+      status: STATUS_UNINITIALIZED,
+      endpointName: arg.endpointName
+    };
+    updateQuerySubstateIfExists(draft, arg.queryCacheKey, (substate) => {
+      substate.status = STATUS_PENDING;
+      substate.requestId = upserting && substate.requestId ? (
+        // for `upsertQuery` **updates**, keep the current `requestId`
+        substate.requestId
+      ) : (
+        // for normal queries or `upsertQuery` **inserts** always update the `requestId`
+        meta.requestId
+      );
+      if (arg.originalArgs !== void 0) {
+        substate.originalArgs = arg.originalArgs;
+      }
+      substate.startedTimeStamp = meta.startedTimeStamp;
+      const endpointDefinition = definitions[meta.arg.endpointName];
+      if (isInfiniteQueryDefinition(endpointDefinition) && "direction" in arg) {
+        ;
+        substate.direction = arg.direction;
+      }
+    });
+  }
+  function writeFulfilledCacheEntry(draft, meta, payload, upserting) {
+    updateQuerySubstateIfExists(draft, meta.arg.queryCacheKey, (substate) => {
+      if (substate.requestId !== meta.requestId && !upserting) return;
+      const {
+        merge
+      } = definitions[meta.arg.endpointName];
+      substate.status = STATUS_FULFILLED;
+      if (merge) {
+        if (substate.data !== void 0) {
+          const {
+            fulfilledTimeStamp,
+            arg,
+            baseQueryMeta,
+            requestId
+          } = meta;
+          let newData = createNextState(substate.data, (draftSubstateData) => {
+            return merge(draftSubstateData, payload, {
+              arg: arg.originalArgs,
+              baseQueryMeta,
+              fulfilledTimeStamp,
+              requestId
+            });
+          });
+          substate.data = newData;
+        } else {
+          substate.data = payload;
+        }
+      } else {
+        substate.data = definitions[meta.arg.endpointName].structuralSharing ?? true ? copyWithStructuralSharing(isDraft(substate.data) ? original(substate.data) : substate.data, payload) : payload;
+      }
+      delete substate.error;
+      substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;
+    });
+  }
+  const querySlice = createSlice({
+    name: `${reducerPath}/queries`,
+    initialState,
+    reducers: {
+      removeQueryResult: {
+        reducer(draft, {
+          payload: {
+            queryCacheKey
+          }
+        }) {
+          delete draft[queryCacheKey];
+        },
+        prepare: prepareAutoBatched()
+      },
+      cacheEntriesUpserted: {
+        reducer(draft, action) {
+          for (const entry of action.payload) {
+            const {
+              queryDescription: arg,
+              value
+            } = entry;
+            writePendingCacheEntry(draft, arg, true, {
+              arg,
+              requestId: action.meta.requestId,
+              startedTimeStamp: action.meta.timestamp
+            });
+            writeFulfilledCacheEntry(
+              draft,
+              {
+                arg,
+                requestId: action.meta.requestId,
+                fulfilledTimeStamp: action.meta.timestamp,
+                baseQueryMeta: {}
+              },
+              value,
+              // We know we're upserting here
+              true
+            );
+          }
+        },
+        prepare: (payload) => {
+          const queryDescriptions = payload.map((entry) => {
+            const {
+              endpointName,
+              arg,
+              value
+            } = entry;
+            const endpointDefinition = definitions[endpointName];
+            const queryDescription = {
+              type: ENDPOINT_QUERY,
+              endpointName,
+              originalArgs: entry.arg,
+              queryCacheKey: serializeQueryArgs({
+                queryArgs: arg,
+                endpointDefinition,
+                endpointName
+              })
+            };
+            return {
+              queryDescription,
+              value
+            };
+          });
+          const result = {
+            payload: queryDescriptions,
+            meta: {
+              [SHOULD_AUTOBATCH]: true,
+              requestId: nanoid(),
+              timestamp: Date.now()
+            }
+          };
+          return result;
+        }
+      },
+      queryResultPatched: {
+        reducer(draft, {
+          payload: {
+            queryCacheKey,
+            patches
+          }
+        }) {
+          updateQuerySubstateIfExists(draft, queryCacheKey, (substate) => {
+            substate.data = applyPatches(substate.data, patches.concat());
+          });
+        },
+        prepare: prepareAutoBatched()
+      }
+    },
+    extraReducers(builder) {
+      builder.addCase(queryThunk.pending, (draft, {
+        meta,
+        meta: {
+          arg
+        }
+      }) => {
+        const upserting = isUpsertQuery(arg);
+        writePendingCacheEntry(draft, arg, upserting, meta);
+      }).addCase(queryThunk.fulfilled, (draft, {
+        meta,
+        payload
+      }) => {
+        const upserting = isUpsertQuery(meta.arg);
+        writeFulfilledCacheEntry(draft, meta, payload, upserting);
+      }).addCase(queryThunk.rejected, (draft, {
+        meta: {
+          condition,
+          arg,
+          requestId
+        },
+        error,
+        payload
+      }) => {
+        updateQuerySubstateIfExists(draft, arg.queryCacheKey, (substate) => {
+          if (condition) {
+          } else {
+            if (substate.requestId !== requestId) return;
+            substate.status = STATUS_REJECTED;
+            substate.error = payload ?? error;
+          }
+        });
+      }).addMatcher(hasRehydrationInfo, (draft, action) => {
+        const {
+          queries
+        } = extractRehydrationInfo(action);
+        for (const [key, entry] of Object.entries(queries)) {
+          if (
+            // do not rehydrate entries that were currently in flight.
+            entry?.status === STATUS_FULFILLED || entry?.status === STATUS_REJECTED
+          ) {
+            draft[key] = entry;
+          }
+        }
+      });
+    }
+  });
+  const mutationSlice = createSlice({
+    name: `${reducerPath}/mutations`,
+    initialState,
+    reducers: {
+      removeMutationResult: {
+        reducer(draft, {
+          payload
+        }) {
+          const cacheKey = getMutationCacheKey(payload);
+          if (cacheKey in draft) {
+            delete draft[cacheKey];
+          }
+        },
+        prepare: prepareAutoBatched()
+      }
+    },
+    extraReducers(builder) {
+      builder.addCase(mutationThunk.pending, (draft, {
+        meta,
+        meta: {
+          requestId,
+          arg,
+          startedTimeStamp
+        }
+      }) => {
+        if (!arg.track) return;
+        draft[getMutationCacheKey(meta)] = {
+          requestId,
+          status: STATUS_PENDING,
+          endpointName: arg.endpointName,
+          startedTimeStamp
+        };
+      }).addCase(mutationThunk.fulfilled, (draft, {
+        payload,
+        meta
+      }) => {
+        if (!meta.arg.track) return;
+        updateMutationSubstateIfExists(draft, meta, (substate) => {
+          if (substate.requestId !== meta.requestId) return;
+          substate.status = STATUS_FULFILLED;
+          substate.data = payload;
+          substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;
+        });
+      }).addCase(mutationThunk.rejected, (draft, {
+        payload,
+        error,
+        meta
+      }) => {
+        if (!meta.arg.track) return;
+        updateMutationSubstateIfExists(draft, meta, (substate) => {
+          if (substate.requestId !== meta.requestId) return;
+          substate.status = STATUS_REJECTED;
+          substate.error = payload ?? error;
+        });
+      }).addMatcher(hasRehydrationInfo, (draft, action) => {
+        const {
+          mutations
+        } = extractRehydrationInfo(action);
+        for (const [key, entry] of Object.entries(mutations)) {
+          if (
+            // do not rehydrate entries that were currently in flight.
+            (entry?.status === STATUS_FULFILLED || entry?.status === STATUS_REJECTED) && // only rehydrate endpoints that were persisted using a `fixedCacheKey`
+            key !== entry?.requestId
+          ) {
+            draft[key] = entry;
+          }
+        }
+      });
+    }
+  });
+  const initialInvalidationState = {
+    tags: {},
+    keys: {}
+  };
+  const invalidationSlice = createSlice({
+    name: `${reducerPath}/invalidation`,
+    initialState: initialInvalidationState,
+    reducers: {
+      updateProvidedBy: {
+        reducer(draft, action) {
+          for (const {
+            queryCacheKey,
+            providedTags
+          } of action.payload) {
+            removeCacheKeyFromTags(draft, queryCacheKey);
+            for (const {
+              type,
+              id
+            } of providedTags) {
+              const subscribedQueries = (draft.tags[type] ??= {})[id || "__internal_without_id"] ??= [];
+              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);
+              if (!alreadySubscribed) {
+                subscribedQueries.push(queryCacheKey);
+              }
+            }
+            draft.keys[queryCacheKey] = providedTags;
+          }
+        },
+        prepare: prepareAutoBatched()
+      }
+    },
+    extraReducers(builder) {
+      builder.addCase(querySlice.actions.removeQueryResult, (draft, {
+        payload: {
+          queryCacheKey
+        }
+      }) => {
+        removeCacheKeyFromTags(draft, queryCacheKey);
+      }).addMatcher(hasRehydrationInfo, (draft, action) => {
+        const {
+          provided
+        } = extractRehydrationInfo(action);
+        for (const [type, incomingTags] of Object.entries(provided.tags ?? {})) {
+          for (const [id, cacheKeys] of Object.entries(incomingTags)) {
+            const subscribedQueries = (draft.tags[type] ??= {})[id || "__internal_without_id"] ??= [];
+            for (const queryCacheKey of cacheKeys) {
+              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);
+              if (!alreadySubscribed) {
+                subscribedQueries.push(queryCacheKey);
+              }
+              draft.keys[queryCacheKey] = provided.keys[queryCacheKey];
+            }
+          }
+        }
+      }).addMatcher(isAnyOf(isFulfilled(queryThunk), isRejectedWithValue(queryThunk)), (draft, action) => {
+        writeProvidedTagsForQueries(draft, [action]);
+      }).addMatcher(querySlice.actions.cacheEntriesUpserted.match, (draft, action) => {
+        const mockActions = action.payload.map(({
+          queryDescription,
+          value
+        }) => {
+          return {
+            type: "UNKNOWN",
+            payload: value,
+            meta: {
+              requestStatus: "fulfilled",
+              requestId: "UNKNOWN",
+              arg: queryDescription
+            }
+          };
+        });
+        writeProvidedTagsForQueries(draft, mockActions);
+      });
+    }
+  });
+  function removeCacheKeyFromTags(draft, queryCacheKey) {
+    const existingTags = getCurrent(draft.keys[queryCacheKey] ?? []);
+    for (const tag of existingTags) {
+      const tagType = tag.type;
+      const tagId = tag.id ?? "__internal_without_id";
+      const tagSubscriptions = draft.tags[tagType]?.[tagId];
+      if (tagSubscriptions) {
+        draft.tags[tagType][tagId] = getCurrent(tagSubscriptions).filter((qc) => qc !== queryCacheKey);
+      }
+    }
+    delete draft.keys[queryCacheKey];
+  }
+  function writeProvidedTagsForQueries(draft, actions3) {
+    const providedByEntries = actions3.map((action) => {
+      const providedTags = calculateProvidedByThunk(action, "providesTags", definitions, assertTagType);
+      const {
+        queryCacheKey
+      } = action.meta.arg;
+      return {
+        queryCacheKey,
+        providedTags
+      };
+    });
+    invalidationSlice.caseReducers.updateProvidedBy(draft, invalidationSlice.actions.updateProvidedBy(providedByEntries));
+  }
+  const subscriptionSlice = createSlice({
+    name: `${reducerPath}/subscriptions`,
+    initialState,
+    reducers: {
+      updateSubscriptionOptions(d, a) {
+      },
+      unsubscribeQueryResult(d, a) {
+      },
+      internal_getRTKQSubscriptions() {
+      }
+    }
+  });
+  const internalSubscriptionsSlice = createSlice({
+    name: `${reducerPath}/internalSubscriptions`,
+    initialState,
+    reducers: {
+      subscriptionsUpdated: {
+        reducer(state, action) {
+          return applyPatches(state, action.payload);
+        },
+        prepare: prepareAutoBatched()
+      }
+    }
+  });
+  const configSlice = createSlice({
+    name: `${reducerPath}/config`,
+    initialState: {
+      online: isOnline(),
+      focused: isDocumentVisible(),
+      middlewareRegistered: false,
+      ...config
+    },
+    reducers: {
+      middlewareRegistered(state, {
+        payload
+      }) {
+        state.middlewareRegistered = state.middlewareRegistered === "conflict" || apiUid !== payload ? "conflict" : true;
+      }
+    },
+    extraReducers: (builder) => {
+      builder.addCase(onOnline, (state) => {
+        state.online = true;
+      }).addCase(onOffline, (state) => {
+        state.online = false;
+      }).addCase(onFocus, (state) => {
+        state.focused = true;
+      }).addCase(onFocusLost, (state) => {
+        state.focused = false;
+      }).addMatcher(hasRehydrationInfo, (draft) => ({
+        ...draft
+      }));
+    }
+  });
+  const combinedReducer = combineReducers({
+    queries: querySlice.reducer,
+    mutations: mutationSlice.reducer,
+    provided: invalidationSlice.reducer,
+    subscriptions: internalSubscriptionsSlice.reducer,
+    config: configSlice.reducer
+  });
+  const reducer = (state, action) => combinedReducer(resetApiState.match(action) ? void 0 : state, action);
+  const actions2 = {
+    ...configSlice.actions,
+    ...querySlice.actions,
+    ...subscriptionSlice.actions,
+    ...internalSubscriptionsSlice.actions,
+    ...mutationSlice.actions,
+    ...invalidationSlice.actions,
+    resetApiState
+  };
+  return {
+    reducer,
+    actions: actions2
+  };
+}
+
+// src/query/core/buildSelectors.ts
+var skipToken = /* @__PURE__ */ Symbol.for("RTKQ/skipToken");
+var initialSubState = {
+  status: STATUS_UNINITIALIZED
+};
+var defaultQuerySubState = /* @__PURE__ */ createNextState(initialSubState, () => {
+});
+var defaultMutationSubState = /* @__PURE__ */ createNextState(initialSubState, () => {
+});
+function buildSelectors({
+  serializeQueryArgs,
+  reducerPath,
+  createSelector: createSelector2
+}) {
+  const selectSkippedQuery = (state) => defaultQuerySubState;
+  const selectSkippedMutation = (state) => defaultMutationSubState;
+  return {
+    buildQuerySelector,
+    buildInfiniteQuerySelector,
+    buildMutationSelector,
+    selectInvalidatedBy,
+    selectCachedArgsForQuery,
+    selectApiState,
+    selectQueries,
+    selectMutations,
+    selectQueryEntry,
+    selectConfig
+  };
+  function withRequestFlags(substate) {
+    return {
+      ...substate,
+      ...getRequestStatusFlags(substate.status)
+    };
+  }
+  function selectApiState(rootState) {
+    const state = rootState[reducerPath];
+    if (process.env.NODE_ENV !== "production") {
+      if (!state) {
+        if (selectApiState.triggered) return state;
+        selectApiState.triggered = true;
+        console.error(`Error: No data found at \`state.${reducerPath}\`. Did you forget to add the reducer to the store?`);
+      }
+    }
+    return state;
+  }
+  function selectQueries(rootState) {
+    return selectApiState(rootState)?.queries;
+  }
+  function selectQueryEntry(rootState, cacheKey) {
+    return selectQueries(rootState)?.[cacheKey];
+  }
+  function selectMutations(rootState) {
+    return selectApiState(rootState)?.mutations;
+  }
+  function selectConfig(rootState) {
+    return selectApiState(rootState)?.config;
+  }
+  function buildAnyQuerySelector(endpointName, endpointDefinition, combiner) {
+    return (queryArgs) => {
+      if (queryArgs === skipToken) {
+        return createSelector2(selectSkippedQuery, combiner);
+      }
+      const serializedArgs = serializeQueryArgs({
+        queryArgs,
+        endpointDefinition,
+        endpointName
+      });
+      const selectQuerySubstate = (state) => selectQueryEntry(state, serializedArgs) ?? defaultQuerySubState;
+      return createSelector2(selectQuerySubstate, combiner);
+    };
+  }
+  function buildQuerySelector(endpointName, endpointDefinition) {
+    return buildAnyQuerySelector(endpointName, endpointDefinition, withRequestFlags);
+  }
+  function buildInfiniteQuerySelector(endpointName, endpointDefinition) {
+    const {
+      infiniteQueryOptions
+    } = endpointDefinition;
+    function withInfiniteQueryResultFlags(substate) {
+      const stateWithRequestFlags = {
+        ...substate,
+        ...getRequestStatusFlags(substate.status)
+      };
+      const {
+        isLoading,
+        isError,
+        direction
+      } = stateWithRequestFlags;
+      const isForward = direction === "forward";
+      const isBackward = direction === "backward";
+      return {
+        ...stateWithRequestFlags,
+        hasNextPage: getHasNextPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),
+        hasPreviousPage: getHasPreviousPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),
+        isFetchingNextPage: isLoading && isForward,
+        isFetchingPreviousPage: isLoading && isBackward,
+        isFetchNextPageError: isError && isForward,
+        isFetchPreviousPageError: isError && isBackward
+      };
+    }
+    return buildAnyQuerySelector(endpointName, endpointDefinition, withInfiniteQueryResultFlags);
+  }
+  function buildMutationSelector() {
+    return (id) => {
+      let mutationId;
+      if (typeof id === "object") {
+        mutationId = getMutationCacheKey(id) ?? skipToken;
+      } else {
+        mutationId = id;
+      }
+      const selectMutationSubstate = (state) => selectApiState(state)?.mutations?.[mutationId] ?? defaultMutationSubState;
+      const finalSelectMutationSubstate = mutationId === skipToken ? selectSkippedMutation : selectMutationSubstate;
+      return createSelector2(finalSelectMutationSubstate, withRequestFlags);
+    };
+  }
+  function selectInvalidatedBy(state, tags) {
+    const apiState = state[reducerPath];
+    const toInvalidate = /* @__PURE__ */ new Set();
+    const finalTags = filterMap(tags, isNotNullish, expandTagDescription);
+    for (const tag of finalTags) {
+      const provided = apiState.provided.tags[tag.type];
+      if (!provided) {
+        continue;
+      }
+      let invalidateSubscriptions = (tag.id !== void 0 ? (
+        // id given: invalidate all queries that provide this type & id
+        provided[tag.id]
+      ) : (
+        // no id: invalidate all queries that provide this type
+        Object.values(provided).flat()
+      )) ?? [];
+      for (const invalidate of invalidateSubscriptions) {
+        toInvalidate.add(invalidate);
+      }
+    }
+    return Array.from(toInvalidate.values()).flatMap((queryCacheKey) => {
+      const querySubState = apiState.queries[queryCacheKey];
+      return querySubState ? {
+        queryCacheKey,
+        endpointName: querySubState.endpointName,
+        originalArgs: querySubState.originalArgs
+      } : [];
+    });
+  }
+  function selectCachedArgsForQuery(state, queryName) {
+    return filterMap(Object.values(selectQueries(state)), (entry) => entry?.endpointName === queryName && entry.status !== STATUS_UNINITIALIZED, (entry) => entry.originalArgs);
+  }
+  function getHasNextPage(options, data, queryArg) {
+    if (!data) return false;
+    return getNextPageParam(options, data, queryArg) != null;
+  }
+  function getHasPreviousPage(options, data, queryArg) {
+    if (!data || !options.getPreviousPageParam) return false;
+    return getPreviousPageParam(options, data, queryArg) != null;
+  }
+}
+
+// src/query/createApi.ts
+import { formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage22, formatProdErrorMessage as _formatProdErrorMessage3 } from "@reduxjs/toolkit";
+
+// src/query/defaultSerializeQueryArgs.ts
+var cache = WeakMap ? /* @__PURE__ */ new WeakMap() : void 0;
+var defaultSerializeQueryArgs = ({
+  endpointName,
+  queryArgs
+}) => {
+  let serialized = "";
+  const cached = cache?.get(queryArgs);
+  if (typeof cached === "string") {
+    serialized = cached;
+  } else {
+    const stringified = JSON.stringify(queryArgs, (key, value) => {
+      value = typeof value === "bigint" ? {
+        $bigint: value.toString()
+      } : value;
+      value = isPlainObject(value) ? Object.keys(value).sort().reduce((acc, key2) => {
+        acc[key2] = value[key2];
+        return acc;
+      }, {}) : value;
+      return value;
+    });
+    if (isPlainObject(queryArgs)) {
+      cache?.set(queryArgs, stringified);
+    }
+    serialized = stringified;
+  }
+  return `${endpointName}(${serialized})`;
+};
+
+// src/query/createApi.ts
+import { weakMapMemoize } from "reselect";
+function buildCreateApi(...modules) {
+  return function baseCreateApi(options) {
+    const extractRehydrationInfo = weakMapMemoize((action) => options.extractRehydrationInfo?.(action, {
+      reducerPath: options.reducerPath ?? "api"
+    }));
+    const optionsWithDefaults = {
+      reducerPath: "api",
+      keepUnusedDataFor: 60,
+      refetchOnMountOrArgChange: false,
+      refetchOnFocus: false,
+      refetchOnReconnect: false,
+      invalidationBehavior: "delayed",
+      ...options,
+      extractRehydrationInfo,
+      serializeQueryArgs(queryArgsApi) {
+        let finalSerializeQueryArgs = defaultSerializeQueryArgs;
+        if ("serializeQueryArgs" in queryArgsApi.endpointDefinition) {
+          const endpointSQA = queryArgsApi.endpointDefinition.serializeQueryArgs;
+          finalSerializeQueryArgs = (queryArgsApi2) => {
+            const initialResult = endpointSQA(queryArgsApi2);
+            if (typeof initialResult === "string") {
+              return initialResult;
+            } else {
+              return defaultSerializeQueryArgs({
+                ...queryArgsApi2,
+                queryArgs: initialResult
+              });
+            }
+          };
+        } else if (options.serializeQueryArgs) {
+          finalSerializeQueryArgs = options.serializeQueryArgs;
+        }
+        return finalSerializeQueryArgs(queryArgsApi);
+      },
+      tagTypes: [...options.tagTypes || []]
+    };
+    const context = {
+      endpointDefinitions: {},
+      batch(fn) {
+        fn();
+      },
+      apiUid: nanoid(),
+      extractRehydrationInfo,
+      hasRehydrationInfo: weakMapMemoize((action) => extractRehydrationInfo(action) != null)
+    };
+    const api = {
+      injectEndpoints,
+      enhanceEndpoints({
+        addTagTypes,
+        endpoints
+      }) {
+        if (addTagTypes) {
+          for (const eT of addTagTypes) {
+            if (!optionsWithDefaults.tagTypes.includes(eT)) {
+              ;
+              optionsWithDefaults.tagTypes.push(eT);
+            }
+          }
+        }
+        if (endpoints) {
+          for (const [endpointName, partialDefinition] of Object.entries(endpoints)) {
+            if (typeof partialDefinition === "function") {
+              partialDefinition(getEndpointDefinition(context, endpointName));
+            } else {
+              Object.assign(getEndpointDefinition(context, endpointName) || {}, partialDefinition);
+            }
+          }
+        }
+        return api;
+      }
+    };
+    const initializedModules = modules.map((m) => m.init(api, optionsWithDefaults, context));
+    function injectEndpoints(inject) {
+      const evaluatedEndpoints = inject.endpoints({
+        query: (x) => ({
+          ...x,
+          type: ENDPOINT_QUERY
+        }),
+        mutation: (x) => ({
+          ...x,
+          type: ENDPOINT_MUTATION
+        }),
+        infiniteQuery: (x) => ({
+          ...x,
+          type: ENDPOINT_INFINITEQUERY
+        })
+      });
+      for (const [endpointName, definition] of Object.entries(evaluatedEndpoints)) {
+        if (inject.overrideExisting !== true && endpointName in context.endpointDefinitions) {
+          if (inject.overrideExisting === "throw") {
+            throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage2(39) : `called \`injectEndpoints\` to override already-existing endpointName ${endpointName} without specifying \`overrideExisting: true\``);
+          } else if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
+            console.error(`called \`injectEndpoints\` to override already-existing endpointName ${endpointName} without specifying \`overrideExisting: true\``);
+          }
+          continue;
+        }
+        if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
+          if (isInfiniteQueryDefinition(definition)) {
+            const {
+              infiniteQueryOptions
+            } = definition;
+            const {
+              maxPages,
+              getPreviousPageParam: getPreviousPageParam2
+            } = infiniteQueryOptions;
+            if (typeof maxPages === "number") {
+              if (maxPages < 1) {
+                throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage22(40) : `maxPages for endpoint '${endpointName}' must be a number greater than 0`);
+              }
+              if (typeof getPreviousPageParam2 !== "function") {
+                throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage3(41) : `getPreviousPageParam for endpoint '${endpointName}' must be a function if maxPages is used`);
+              }
+            }
+          }
+        }
+        context.endpointDefinitions[endpointName] = definition;
+        for (const m of initializedModules) {
+          m.injectEndpoint(endpointName, definition);
+        }
+      }
+      return api;
+    }
+    return api.injectEndpoints({
+      endpoints: options.endpoints
+    });
+  };
+}
+
+// src/query/fakeBaseQuery.ts
+import { formatProdErrorMessage as _formatProdErrorMessage4 } from "@reduxjs/toolkit";
+var _NEVER = /* @__PURE__ */ Symbol();
+function fakeBaseQuery() {
+  return function() {
+    throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage4(33) : "When using `fakeBaseQuery`, all queries & mutations must use the `queryFn` definition syntax.");
+  };
+}
+
+// src/query/tsHelpers.ts
+function assertCast(v) {
+}
+function safeAssign(target, ...args) {
+  return Object.assign(target, ...args);
+}
+
+// src/query/core/buildMiddleware/batchActions.ts
+var buildBatchedActionsHandler = ({
+  api,
+  queryThunk,
+  internalState,
+  mwApi
+}) => {
+  const subscriptionsPrefix = `${api.reducerPath}/subscriptions`;
+  let previousSubscriptions = null;
+  let updateSyncTimer = null;
+  const {
+    updateSubscriptionOptions,
+    unsubscribeQueryResult
+  } = api.internalActions;
+  const actuallyMutateSubscriptions = (currentSubscriptions, action) => {
+    if (updateSubscriptionOptions.match(action)) {
+      const {
+        queryCacheKey,
+        requestId,
+        options
+      } = action.payload;
+      const sub = currentSubscriptions.get(queryCacheKey);
+      if (sub?.has(requestId)) {
+        sub.set(requestId, options);
+      }
+      return true;
+    }
+    if (unsubscribeQueryResult.match(action)) {
+      const {
+        queryCacheKey,
+        requestId
+      } = action.payload;
+      const sub = currentSubscriptions.get(queryCacheKey);
+      if (sub) {
+        sub.delete(requestId);
+      }
+      return true;
+    }
+    if (api.internalActions.removeQueryResult.match(action)) {
+      currentSubscriptions.delete(action.payload.queryCacheKey);
+      return true;
+    }
+    if (queryThunk.pending.match(action)) {
+      const {
+        meta: {
+          arg,
+          requestId
+        }
+      } = action;
+      const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);
+      if (arg.subscribe) {
+        substate.set(requestId, arg.subscriptionOptions ?? substate.get(requestId) ?? {});
+      }
+      return true;
+    }
+    let mutated = false;
+    if (queryThunk.rejected.match(action)) {
+      const {
+        meta: {
+          condition,
+          arg,
+          requestId
+        }
+      } = action;
+      if (condition && arg.subscribe) {
+        const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);
+        substate.set(requestId, arg.subscriptionOptions ?? substate.get(requestId) ?? {});
+        mutated = true;
+      }
+    }
+    return mutated;
+  };
+  const getSubscriptions = () => internalState.currentSubscriptions;
+  const getSubscriptionCount = (queryCacheKey) => {
+    const subscriptions = getSubscriptions();
+    const subscriptionsForQueryArg = subscriptions.get(queryCacheKey);
+    return subscriptionsForQueryArg?.size ?? 0;
+  };
+  const isRequestSubscribed = (queryCacheKey, requestId) => {
+    const subscriptions = getSubscriptions();
+    return !!subscriptions?.get(queryCacheKey)?.get(requestId);
+  };
+  const subscriptionSelectors = {
+    getSubscriptions,
+    getSubscriptionCount,
+    isRequestSubscribed
+  };
+  function serializeSubscriptions(currentSubscriptions) {
+    return JSON.parse(JSON.stringify(Object.fromEntries([...currentSubscriptions].map(([k, v]) => [k, Object.fromEntries(v)]))));
+  }
+  return (action, mwApi2) => {
+    if (!previousSubscriptions) {
+      previousSubscriptions = serializeSubscriptions(internalState.currentSubscriptions);
+    }
+    if (api.util.resetApiState.match(action)) {
+      previousSubscriptions = {};
+      internalState.currentSubscriptions.clear();
+      updateSyncTimer = null;
+      return [true, false];
+    }
+    if (api.internalActions.internal_getRTKQSubscriptions.match(action)) {
+      return [false, subscriptionSelectors];
+    }
+    const didMutate = actuallyMutateSubscriptions(internalState.currentSubscriptions, action);
+    let actionShouldContinue = true;
+    if (process.env.NODE_ENV === "test" && typeof action.type === "string" && action.type === `${api.reducerPath}/getPolling`) {
+      return [false, internalState.currentPolls];
+    }
+    if (didMutate) {
+      if (!updateSyncTimer) {
+        updateSyncTimer = setTimeout(() => {
+          const newSubscriptions = serializeSubscriptions(internalState.currentSubscriptions);
+          const [, patches] = produceWithPatches(previousSubscriptions, () => newSubscriptions);
+          mwApi2.next(api.internalActions.subscriptionsUpdated(patches));
+          previousSubscriptions = newSubscriptions;
+          updateSyncTimer = null;
+        }, 500);
+      }
+      const isSubscriptionSliceAction = typeof action.type == "string" && !!action.type.startsWith(subscriptionsPrefix);
+      const isAdditionalSubscriptionAction = queryThunk.rejected.match(action) && action.meta.condition && !!action.meta.arg.subscribe;
+      actionShouldContinue = !isSubscriptionSliceAction && !isAdditionalSubscriptionAction;
+    }
+    return [actionShouldContinue, false];
+  };
+};
+
+// src/query/core/buildMiddleware/cacheCollection.ts
+var THIRTY_TWO_BIT_MAX_TIMER_SECONDS = 2147483647 / 1e3 - 1;
+var buildCacheCollectionHandler = ({
+  reducerPath,
+  api,
+  queryThunk,
+  context,
+  internalState,
+  selectors: {
+    selectQueryEntry,
+    selectConfig
+  },
+  getRunningQueryThunk,
+  mwApi
+}) => {
+  const {
+    removeQueryResult,
+    unsubscribeQueryResult,
+    cacheEntriesUpserted
+  } = api.internalActions;
+  const canTriggerUnsubscribe = isAnyOf(unsubscribeQueryResult.match, queryThunk.fulfilled, queryThunk.rejected, cacheEntriesUpserted.match);
+  function anySubscriptionsRemainingForKey(queryCacheKey) {
+    const subscriptions = internalState.currentSubscriptions.get(queryCacheKey);
+    if (!subscriptions) {
+      return false;
+    }
+    const hasSubscriptions = subscriptions.size > 0;
+    return hasSubscriptions;
+  }
+  const currentRemovalTimeouts = {};
+  function abortAllPromises(promiseMap) {
+    for (const promise of promiseMap.values()) {
+      promise?.abort?.();
+    }
+  }
+  const handler = (action, mwApi2) => {
+    const state = mwApi2.getState();
+    const config = selectConfig(state);
+    if (canTriggerUnsubscribe(action)) {
+      let queryCacheKeys;
+      if (cacheEntriesUpserted.match(action)) {
+        queryCacheKeys = action.payload.map((entry) => entry.queryDescription.queryCacheKey);
+      } else {
+        const {
+          queryCacheKey
+        } = unsubscribeQueryResult.match(action) ? action.payload : action.meta.arg;
+        queryCacheKeys = [queryCacheKey];
+      }
+      handleUnsubscribeMany(queryCacheKeys, mwApi2, config);
+    }
+    if (api.util.resetApiState.match(action)) {
+      for (const [key, timeout] of Object.entries(currentRemovalTimeouts)) {
+        if (timeout) clearTimeout(timeout);
+        delete currentRemovalTimeouts[key];
+      }
+      abortAllPromises(internalState.runningQueries);
+      abortAllPromises(internalState.runningMutations);
+    }
+    if (context.hasRehydrationInfo(action)) {
+      const {
+        queries
+      } = context.extractRehydrationInfo(action);
+      handleUnsubscribeMany(Object.keys(queries), mwApi2, config);
+    }
+  };
+  function handleUnsubscribeMany(cacheKeys, api2, config) {
+    const state = api2.getState();
+    for (const queryCacheKey of cacheKeys) {
+      const entry = selectQueryEntry(state, queryCacheKey);
+      if (entry?.endpointName) {
+        handleUnsubscribe(queryCacheKey, entry.endpointName, api2, config);
+      }
+    }
+  }
+  function handleUnsubscribe(queryCacheKey, endpointName, api2, config) {
+    const endpointDefinition = getEndpointDefinition(context, endpointName);
+    const keepUnusedDataFor = endpointDefinition?.keepUnusedDataFor ?? config.keepUnusedDataFor;
+    if (keepUnusedDataFor === Infinity) {
+      return;
+    }
+    const finalKeepUnusedDataFor = Math.max(0, Math.min(keepUnusedDataFor, THIRTY_TWO_BIT_MAX_TIMER_SECONDS));
+    if (!anySubscriptionsRemainingForKey(queryCacheKey)) {
+      const currentTimeout = currentRemovalTimeouts[queryCacheKey];
+      if (currentTimeout) {
+        clearTimeout(currentTimeout);
+      }
+      currentRemovalTimeouts[queryCacheKey] = setTimeout(() => {
+        if (!anySubscriptionsRemainingForKey(queryCacheKey)) {
+          const entry = selectQueryEntry(api2.getState(), queryCacheKey);
+          if (entry?.endpointName) {
+            const runningQuery = api2.dispatch(getRunningQueryThunk(entry.endpointName, entry.originalArgs));
+            runningQuery?.abort();
+          }
+          api2.dispatch(removeQueryResult({
+            queryCacheKey
+          }));
+        }
+        delete currentRemovalTimeouts[queryCacheKey];
+      }, finalKeepUnusedDataFor * 1e3);
+    }
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/cacheLifecycle.ts
+var neverResolvedError = new Error("Promise never resolved before cacheEntryRemoved.");
+var buildCacheLifecycleHandler = ({
+  api,
+  reducerPath,
+  context,
+  queryThunk,
+  mutationThunk,
+  internalState,
+  selectors: {
+    selectQueryEntry,
+    selectApiState
+  }
+}) => {
+  const isQueryThunk = isAsyncThunkAction(queryThunk);
+  const isMutationThunk = isAsyncThunkAction(mutationThunk);
+  const isFulfilledThunk = isFulfilled(queryThunk, mutationThunk);
+  const lifecycleMap = {};
+  const {
+    removeQueryResult,
+    removeMutationResult,
+    cacheEntriesUpserted
+  } = api.internalActions;
+  function resolveLifecycleEntry(cacheKey, data, meta) {
+    const lifecycle = lifecycleMap[cacheKey];
+    if (lifecycle?.valueResolved) {
+      lifecycle.valueResolved({
+        data,
+        meta
+      });
+      delete lifecycle.valueResolved;
+    }
+  }
+  function removeLifecycleEntry(cacheKey) {
+    const lifecycle = lifecycleMap[cacheKey];
+    if (lifecycle) {
+      delete lifecycleMap[cacheKey];
+      lifecycle.cacheEntryRemoved();
+    }
+  }
+  function getActionMetaFields(action) {
+    const {
+      arg,
+      requestId
+    } = action.meta;
+    const {
+      endpointName,
+      originalArgs
+    } = arg;
+    return [endpointName, originalArgs, requestId];
+  }
+  const handler = (action, mwApi, stateBefore) => {
+    const cacheKey = getCacheKey(action);
+    function checkForNewCacheKey(endpointName, cacheKey2, requestId, originalArgs) {
+      const oldEntry = selectQueryEntry(stateBefore, cacheKey2);
+      const newEntry = selectQueryEntry(mwApi.getState(), cacheKey2);
+      if (!oldEntry && newEntry) {
+        handleNewKey(endpointName, originalArgs, cacheKey2, mwApi, requestId);
+      }
+    }
+    if (queryThunk.pending.match(action)) {
+      const [endpointName, originalArgs, requestId] = getActionMetaFields(action);
+      checkForNewCacheKey(endpointName, cacheKey, requestId, originalArgs);
+    } else if (cacheEntriesUpserted.match(action)) {
+      for (const {
+        queryDescription,
+        value
+      } of action.payload) {
+        const {
+          endpointName,
+          originalArgs,
+          queryCacheKey
+        } = queryDescription;
+        checkForNewCacheKey(endpointName, queryCacheKey, action.meta.requestId, originalArgs);
+        resolveLifecycleEntry(queryCacheKey, value, {});
+      }
+    } else if (mutationThunk.pending.match(action)) {
+      const state = mwApi.getState()[reducerPath].mutations[cacheKey];
+      if (state) {
+        const [endpointName, originalArgs, requestId] = getActionMetaFields(action);
+        handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId);
+      }
+    } else if (isFulfilledThunk(action)) {
+      resolveLifecycleEntry(cacheKey, action.payload, action.meta.baseQueryMeta);
+    } else if (removeQueryResult.match(action) || removeMutationResult.match(action)) {
+      removeLifecycleEntry(cacheKey);
+    } else if (api.util.resetApiState.match(action)) {
+      for (const cacheKey2 of Object.keys(lifecycleMap)) {
+        removeLifecycleEntry(cacheKey2);
+      }
+    }
+  };
+  function getCacheKey(action) {
+    if (isQueryThunk(action)) return action.meta.arg.queryCacheKey;
+    if (isMutationThunk(action)) {
+      return action.meta.arg.fixedCacheKey ?? action.meta.requestId;
+    }
+    if (removeQueryResult.match(action)) return action.payload.queryCacheKey;
+    if (removeMutationResult.match(action)) return getMutationCacheKey(action.payload);
+    return "";
+  }
+  function handleNewKey(endpointName, originalArgs, queryCacheKey, mwApi, requestId) {
+    const endpointDefinition = getEndpointDefinition(context, endpointName);
+    const onCacheEntryAdded = endpointDefinition?.onCacheEntryAdded;
+    if (!onCacheEntryAdded) return;
+    const lifecycle = {};
+    const cacheEntryRemoved = new Promise((resolve) => {
+      lifecycle.cacheEntryRemoved = resolve;
+    });
+    const cacheDataLoaded = Promise.race([new Promise((resolve) => {
+      lifecycle.valueResolved = resolve;
+    }), cacheEntryRemoved.then(() => {
+      throw neverResolvedError;
+    })]);
+    cacheDataLoaded.catch(() => {
+    });
+    lifecycleMap[queryCacheKey] = lifecycle;
+    const selector = api.endpoints[endpointName].select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : queryCacheKey);
+    const extra = mwApi.dispatch((_, __, extra2) => extra2);
+    const lifecycleApi = {
+      ...mwApi,
+      getCacheEntry: () => selector(mwApi.getState()),
+      requestId,
+      extra,
+      updateCachedData: isAnyQueryDefinition(endpointDefinition) ? (updateRecipe) => mwApi.dispatch(api.util.updateQueryData(endpointName, originalArgs, updateRecipe)) : void 0,
+      cacheDataLoaded,
+      cacheEntryRemoved
+    };
+    const runningHandler = onCacheEntryAdded(originalArgs, lifecycleApi);
+    Promise.resolve(runningHandler).catch((e) => {
+      if (e === neverResolvedError) return;
+      throw e;
+    });
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/devMiddleware.ts
+var buildDevCheckHandler = ({
+  api,
+  context: {
+    apiUid
+  },
+  reducerPath
+}) => {
+  return (action, mwApi) => {
+    if (api.util.resetApiState.match(action)) {
+      mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));
+    }
+    if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
+      if (api.internalActions.middlewareRegistered.match(action) && action.payload === apiUid && mwApi.getState()[reducerPath]?.config?.middlewareRegistered === "conflict") {
+        console.warn(`There is a mismatch between slice and middleware for the reducerPath "${reducerPath}".
+You can only have one api per reducer path, this will lead to crashes in various situations!${reducerPath === "api" ? `
+If you have multiple apis, you *have* to specify the reducerPath option when using createApi!` : ""}`);
+      }
+    }
+  };
+};
+
+// src/query/core/buildMiddleware/invalidationByTags.ts
+var buildInvalidationByTagsHandler = ({
+  reducerPath,
+  context,
+  context: {
+    endpointDefinitions
+  },
+  mutationThunk,
+  queryThunk,
+  api,
+  assertTagType,
+  refetchQuery,
+  internalState
+}) => {
+  const {
+    removeQueryResult
+  } = api.internalActions;
+  const isThunkActionWithTags = isAnyOf(isFulfilled(mutationThunk), isRejectedWithValue(mutationThunk));
+  const isQueryEnd = isAnyOf(isFulfilled(queryThunk, mutationThunk), isRejected(queryThunk, mutationThunk));
+  let pendingTagInvalidations = [];
+  let pendingRequestCount = 0;
+  const handler = (action, mwApi) => {
+    if (queryThunk.pending.match(action) || mutationThunk.pending.match(action)) {
+      pendingRequestCount++;
+    }
+    if (isQueryEnd(action)) {
+      pendingRequestCount = Math.max(0, pendingRequestCount - 1);
+    }
+    if (isThunkActionWithTags(action)) {
+      invalidateTags(calculateProvidedByThunk(action, "invalidatesTags", endpointDefinitions, assertTagType), mwApi);
+    } else if (isQueryEnd(action)) {
+      invalidateTags([], mwApi);
+    } else if (api.util.invalidateTags.match(action)) {
+      invalidateTags(calculateProvidedBy(action.payload, void 0, void 0, void 0, void 0, assertTagType), mwApi);
+    }
+  };
+  function hasPendingRequests() {
+    return pendingRequestCount > 0;
+  }
+  function invalidateTags(newTags, mwApi) {
+    const rootState = mwApi.getState();
+    const state = rootState[reducerPath];
+    pendingTagInvalidations.push(...newTags);
+    if (state.config.invalidationBehavior === "delayed" && hasPendingRequests()) {
+      return;
+    }
+    const tags = pendingTagInvalidations;
+    pendingTagInvalidations = [];
+    if (tags.length === 0) return;
+    const toInvalidate = api.util.selectInvalidatedBy(rootState, tags);
+    context.batch(() => {
+      const valuesArray = Array.from(toInvalidate.values());
+      for (const {
+        queryCacheKey
+      } of valuesArray) {
+        const querySubState = state.queries[queryCacheKey];
+        const subscriptionSubState = getOrInsertComputed(internalState.currentSubscriptions, queryCacheKey, createNewMap);
+        if (querySubState) {
+          if (subscriptionSubState.size === 0) {
+            mwApi.dispatch(removeQueryResult({
+              queryCacheKey
+            }));
+          } else if (querySubState.status !== STATUS_UNINITIALIZED) {
+            mwApi.dispatch(refetchQuery(querySubState));
+          }
+        }
+      }
+    });
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/polling.ts
+var buildPollingHandler = ({
+  reducerPath,
+  queryThunk,
+  api,
+  refetchQuery,
+  internalState
+}) => {
+  const {
+    currentPolls,
+    currentSubscriptions
+  } = internalState;
+  const pendingPollingUpdates = /* @__PURE__ */ new Set();
+  let pollingUpdateTimer = null;
+  const handler = (action, mwApi) => {
+    if (api.internalActions.updateSubscriptionOptions.match(action) || api.internalActions.unsubscribeQueryResult.match(action)) {
+      schedulePollingUpdate(action.payload.queryCacheKey, mwApi);
+    }
+    if (queryThunk.pending.match(action) || queryThunk.rejected.match(action) && action.meta.condition) {
+      schedulePollingUpdate(action.meta.arg.queryCacheKey, mwApi);
+    }
+    if (queryThunk.fulfilled.match(action) || queryThunk.rejected.match(action) && !action.meta.condition) {
+      startNextPoll(action.meta.arg, mwApi);
+    }
+    if (api.util.resetApiState.match(action)) {
+      clearPolls();
+      if (pollingUpdateTimer) {
+        clearTimeout(pollingUpdateTimer);
+        pollingUpdateTimer = null;
+      }
+      pendingPollingUpdates.clear();
+    }
+  };
+  function schedulePollingUpdate(queryCacheKey, api2) {
+    pendingPollingUpdates.add(queryCacheKey);
+    if (!pollingUpdateTimer) {
+      pollingUpdateTimer = setTimeout(() => {
+        for (const key of pendingPollingUpdates) {
+          updatePollingInterval({
+            queryCacheKey: key
+          }, api2);
+        }
+        pendingPollingUpdates.clear();
+        pollingUpdateTimer = null;
+      }, 0);
+    }
+  }
+  function startNextPoll({
+    queryCacheKey
+  }, api2) {
+    const state = api2.getState()[reducerPath];
+    const querySubState = state.queries[queryCacheKey];
+    const subscriptions = currentSubscriptions.get(queryCacheKey);
+    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) return;
+    const {
+      lowestPollingInterval,
+      skipPollingIfUnfocused
+    } = findLowestPollingInterval(subscriptions);
+    if (!Number.isFinite(lowestPollingInterval)) return;
+    const currentPoll = currentPolls.get(queryCacheKey);
+    if (currentPoll?.timeout) {
+      clearTimeout(currentPoll.timeout);
+      currentPoll.timeout = void 0;
+    }
+    const nextPollTimestamp = Date.now() + lowestPollingInterval;
+    currentPolls.set(queryCacheKey, {
+      nextPollTimestamp,
+      pollingInterval: lowestPollingInterval,
+      timeout: setTimeout(() => {
+        if (state.config.focused || !skipPollingIfUnfocused) {
+          api2.dispatch(refetchQuery(querySubState));
+        }
+        startNextPoll({
+          queryCacheKey
+        }, api2);
+      }, lowestPollingInterval)
+    });
+  }
+  function updatePollingInterval({
+    queryCacheKey
+  }, api2) {
+    const state = api2.getState()[reducerPath];
+    const querySubState = state.queries[queryCacheKey];
+    const subscriptions = currentSubscriptions.get(queryCacheKey);
+    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) {
+      return;
+    }
+    const {
+      lowestPollingInterval
+    } = findLowestPollingInterval(subscriptions);
+    if (process.env.NODE_ENV === "test") {
+      const updateCounters = currentPolls.pollUpdateCounters ??= {};
+      updateCounters[queryCacheKey] ??= 0;
+      updateCounters[queryCacheKey]++;
+    }
+    if (!Number.isFinite(lowestPollingInterval)) {
+      cleanupPollForKey(queryCacheKey);
+      return;
+    }
+    const currentPoll = currentPolls.get(queryCacheKey);
+    const nextPollTimestamp = Date.now() + lowestPollingInterval;
+    if (!currentPoll || nextPollTimestamp < currentPoll.nextPollTimestamp) {
+      startNextPoll({
+        queryCacheKey
+      }, api2);
+    }
+  }
+  function cleanupPollForKey(key) {
+    const existingPoll = currentPolls.get(key);
+    if (existingPoll?.timeout) {
+      clearTimeout(existingPoll.timeout);
+    }
+    currentPolls.delete(key);
+  }
+  function clearPolls() {
+    for (const key of currentPolls.keys()) {
+      cleanupPollForKey(key);
+    }
+  }
+  function findLowestPollingInterval(subscribers = /* @__PURE__ */ new Map()) {
+    let skipPollingIfUnfocused = false;
+    let lowestPollingInterval = Number.POSITIVE_INFINITY;
+    for (const entry of subscribers.values()) {
+      if (!!entry.pollingInterval) {
+        lowestPollingInterval = Math.min(entry.pollingInterval, lowestPollingInterval);
+        skipPollingIfUnfocused = entry.skipPollingIfUnfocused || skipPollingIfUnfocused;
+      }
+    }
+    return {
+      lowestPollingInterval,
+      skipPollingIfUnfocused
+    };
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/queryLifecycle.ts
+var buildQueryLifecycleHandler = ({
+  api,
+  context,
+  queryThunk,
+  mutationThunk
+}) => {
+  const isPendingThunk = isPending(queryThunk, mutationThunk);
+  const isRejectedThunk = isRejected(queryThunk, mutationThunk);
+  const isFullfilledThunk = isFulfilled(queryThunk, mutationThunk);
+  const lifecycleMap = {};
+  const handler = (action, mwApi) => {
+    if (isPendingThunk(action)) {
+      const {
+        requestId,
+        arg: {
+          endpointName,
+          originalArgs
+        }
+      } = action.meta;
+      const endpointDefinition = getEndpointDefinition(context, endpointName);
+      const onQueryStarted = endpointDefinition?.onQueryStarted;
+      if (onQueryStarted) {
+        const lifecycle = {};
+        const queryFulfilled = new Promise((resolve, reject) => {
+          lifecycle.resolve = resolve;
+          lifecycle.reject = reject;
+        });
+        queryFulfilled.catch(() => {
+        });
+        lifecycleMap[requestId] = lifecycle;
+        const selector = api.endpoints[endpointName].select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : requestId);
+        const extra = mwApi.dispatch((_, __, extra2) => extra2);
+        const lifecycleApi = {
+          ...mwApi,
+          getCacheEntry: () => selector(mwApi.getState()),
+          requestId,
+          extra,
+          updateCachedData: isAnyQueryDefinition(endpointDefinition) ? (updateRecipe) => mwApi.dispatch(api.util.updateQueryData(endpointName, originalArgs, updateRecipe)) : void 0,
+          queryFulfilled
+        };
+        onQueryStarted(originalArgs, lifecycleApi);
+      }
+    } else if (isFullfilledThunk(action)) {
+      const {
+        requestId,
+        baseQueryMeta
+      } = action.meta;
+      lifecycleMap[requestId]?.resolve({
+        data: action.payload,
+        meta: baseQueryMeta
+      });
+      delete lifecycleMap[requestId];
+    } else if (isRejectedThunk(action)) {
+      const {
+        requestId,
+        rejectedWithValue,
+        baseQueryMeta
+      } = action.meta;
+      lifecycleMap[requestId]?.reject({
+        error: action.payload ?? action.error,
+        isUnhandledError: !rejectedWithValue,
+        meta: baseQueryMeta
+      });
+      delete lifecycleMap[requestId];
+    }
+  };
+  return handler;
+};
+
+// src/query/core/buildMiddleware/windowEventHandling.ts
+var buildWindowEventHandler = ({
+  reducerPath,
+  context,
+  api,
+  refetchQuery,
+  internalState
+}) => {
+  const {
+    removeQueryResult
+  } = api.internalActions;
+  const handler = (action, mwApi) => {
+    if (onFocus.match(action)) {
+      refetchValidQueries(mwApi, "refetchOnFocus");
+    }
+    if (onOnline.match(action)) {
+      refetchValidQueries(mwApi, "refetchOnReconnect");
+    }
+  };
+  function refetchValidQueries(api2, type) {
+    const state = api2.getState()[reducerPath];
+    const queries = state.queries;
+    const subscriptions = internalState.currentSubscriptions;
+    context.batch(() => {
+      for (const queryCacheKey of subscriptions.keys()) {
+        const querySubState = queries[queryCacheKey];
+        const subscriptionSubState = subscriptions.get(queryCacheKey);
+        if (!subscriptionSubState || !querySubState) continue;
+        const values = [...subscriptionSubState.values()];
+        const shouldRefetch = values.some((sub) => sub[type] === true) || values.every((sub) => sub[type] === void 0) && state.config[type];
+        if (shouldRefetch) {
+          if (subscriptionSubState.size === 0) {
+            api2.dispatch(removeQueryResult({
+              queryCacheKey
+            }));
+          } else if (querySubState.status !== STATUS_UNINITIALIZED) {
+            api2.dispatch(refetchQuery(querySubState));
+          }
+        }
+      }
+    });
+  }
+  return handler;
+};
+
+// src/query/core/buildMiddleware/index.ts
+function buildMiddleware(input) {
+  const {
+    reducerPath,
+    queryThunk,
+    api,
+    context,
+    getInternalState
+  } = input;
+  const {
+    apiUid
+  } = context;
+  const actions2 = {
+    invalidateTags: createAction(`${reducerPath}/invalidateTags`)
+  };
+  const isThisApiSliceAction = (action) => action.type.startsWith(`${reducerPath}/`);
+  const handlerBuilders = [buildDevCheckHandler, buildCacheCollectionHandler, buildInvalidationByTagsHandler, buildPollingHandler, buildCacheLifecycleHandler, buildQueryLifecycleHandler];
+  const middleware = (mwApi) => {
+    let initialized2 = false;
+    const internalState = getInternalState(mwApi.dispatch);
+    const builderArgs = {
+      ...input,
+      internalState,
+      refetchQuery,
+      isThisApiSliceAction,
+      mwApi
+    };
+    const handlers = handlerBuilders.map((build) => build(builderArgs));
+    const batchedActionsHandler = buildBatchedActionsHandler(builderArgs);
+    const windowEventsHandler = buildWindowEventHandler(builderArgs);
+    return (next) => {
+      return (action) => {
+        if (!isAction(action)) {
+          return next(action);
+        }
+        if (!initialized2) {
+          initialized2 = true;
+          mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));
+        }
+        const mwApiWithNext = {
+          ...mwApi,
+          next
+        };
+        const stateBefore = mwApi.getState();
+        const [actionShouldContinue, internalProbeResult] = batchedActionsHandler(action, mwApiWithNext, stateBefore);
+        let res;
+        if (actionShouldContinue) {
+          res = next(action);
+        } else {
+          res = internalProbeResult;
+        }
+        if (!!mwApi.getState()[reducerPath]) {
+          windowEventsHandler(action, mwApiWithNext, stateBefore);
+          if (isThisApiSliceAction(action) || context.hasRehydrationInfo(action)) {
+            for (const handler of handlers) {
+              handler(action, mwApiWithNext, stateBefore);
+            }
+          }
+        }
+        return res;
+      };
+    };
+  };
+  return {
+    middleware,
+    actions: actions2
+  };
+  function refetchQuery(querySubState) {
+    return input.api.endpoints[querySubState.endpointName].initiate(querySubState.originalArgs, {
+      subscribe: false,
+      forceRefetch: true
+    });
+  }
+}
+
+// src/query/core/module.ts
+var coreModuleName = /* @__PURE__ */ Symbol();
+var coreModule = ({
+  createSelector: createSelector2 = createSelector
+} = {}) => ({
+  name: coreModuleName,
+  init(api, {
+    baseQuery,
+    tagTypes,
+    reducerPath,
+    serializeQueryArgs,
+    keepUnusedDataFor,
+    refetchOnMountOrArgChange,
+    refetchOnFocus,
+    refetchOnReconnect,
+    invalidationBehavior,
+    onSchemaFailure,
+    catchSchemaFailure,
+    skipSchemaValidation
+  }, context) {
+    enablePatches();
+    assertCast(serializeQueryArgs);
+    const assertTagType = (tag) => {
+      if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
+        if (!tagTypes.includes(tag.type)) {
+          console.error(`Tag type '${tag.type}' was used, but not specified in \`tagTypes\`!`);
+        }
+      }
+      return tag;
+    };
+    Object.assign(api, {
+      reducerPath,
+      endpoints: {},
+      internalActions: {
+        onOnline,
+        onOffline,
+        onFocus,
+        onFocusLost
+      },
+      util: {}
+    });
+    const selectors = buildSelectors({
+      serializeQueryArgs,
+      reducerPath,
+      createSelector: createSelector2
+    });
+    const {
+      selectInvalidatedBy,
+      selectCachedArgsForQuery,
+      buildQuerySelector,
+      buildInfiniteQuerySelector,
+      buildMutationSelector
+    } = selectors;
+    safeAssign(api.util, {
+      selectInvalidatedBy,
+      selectCachedArgsForQuery
+    });
+    const {
+      queryThunk,
+      infiniteQueryThunk,
+      mutationThunk,
+      patchQueryData,
+      updateQueryData,
+      upsertQueryData,
+      prefetch,
+      buildMatchThunkActions
+    } = buildThunks({
+      baseQuery,
+      reducerPath,
+      context,
+      api,
+      serializeQueryArgs,
+      assertTagType,
+      selectors,
+      onSchemaFailure,
+      catchSchemaFailure,
+      skipSchemaValidation
+    });
+    const {
+      reducer,
+      actions: sliceActions
+    } = buildSlice({
+      context,
+      queryThunk,
+      infiniteQueryThunk,
+      mutationThunk,
+      serializeQueryArgs,
+      reducerPath,
+      assertTagType,
+      config: {
+        refetchOnFocus,
+        refetchOnReconnect,
+        refetchOnMountOrArgChange,
+        keepUnusedDataFor,
+        reducerPath,
+        invalidationBehavior
+      }
+    });
+    safeAssign(api.util, {
+      patchQueryData,
+      updateQueryData,
+      upsertQueryData,
+      prefetch,
+      resetApiState: sliceActions.resetApiState,
+      upsertQueryEntries: sliceActions.cacheEntriesUpserted
+    });
+    safeAssign(api.internalActions, sliceActions);
+    const internalStateMap = /* @__PURE__ */ new WeakMap();
+    const getInternalState = (dispatch) => {
+      const state = getOrInsertComputed(internalStateMap, dispatch, () => ({
+        currentSubscriptions: /* @__PURE__ */ new Map(),
+        currentPolls: /* @__PURE__ */ new Map(),
+        runningQueries: /* @__PURE__ */ new Map(),
+        runningMutations: /* @__PURE__ */ new Map()
+      }));
+      return state;
+    };
+    const {
+      buildInitiateQuery,
+      buildInitiateInfiniteQuery,
+      buildInitiateMutation,
+      getRunningMutationThunk,
+      getRunningMutationsThunk,
+      getRunningQueriesThunk,
+      getRunningQueryThunk
+    } = buildInitiate({
+      queryThunk,
+      mutationThunk,
+      infiniteQueryThunk,
+      api,
+      serializeQueryArgs,
+      context,
+      getInternalState
+    });
+    safeAssign(api.util, {
+      getRunningMutationThunk,
+      getRunningMutationsThunk,
+      getRunningQueryThunk,
+      getRunningQueriesThunk
+    });
+    const {
+      middleware,
+      actions: middlewareActions
+    } = buildMiddleware({
+      reducerPath,
+      context,
+      queryThunk,
+      mutationThunk,
+      infiniteQueryThunk,
+      api,
+      assertTagType,
+      selectors,
+      getRunningQueryThunk,
+      getInternalState
+    });
+    safeAssign(api.util, middlewareActions);
+    safeAssign(api, {
+      reducer,
+      middleware
+    });
+    return {
+      name: coreModuleName,
+      injectEndpoint(endpointName, definition) {
+        const anyApi = api;
+        const endpoint = anyApi.endpoints[endpointName] ??= {};
+        if (isQueryDefinition(definition)) {
+          safeAssign(endpoint, {
+            name: endpointName,
+            select: buildQuerySelector(endpointName, definition),
+            initiate: buildInitiateQuery(endpointName, definition)
+          }, buildMatchThunkActions(queryThunk, endpointName));
+        }
+        if (isMutationDefinition(definition)) {
+          safeAssign(endpoint, {
+            name: endpointName,
+            select: buildMutationSelector(),
+            initiate: buildInitiateMutation(endpointName)
+          }, buildMatchThunkActions(mutationThunk, endpointName));
+        }
+        if (isInfiniteQueryDefinition(definition)) {
+          safeAssign(endpoint, {
+            name: endpointName,
+            select: buildInfiniteQuerySelector(endpointName, definition),
+            initiate: buildInitiateInfiniteQuery(endpointName, definition)
+          }, buildMatchThunkActions(queryThunk, endpointName));
+        }
+      }
+    };
+  }
+});
+
+// src/query/core/index.ts
+var createApi = /* @__PURE__ */ buildCreateApi(coreModule());
+export {
+  NamedSchemaError,
+  QueryStatus,
+  _NEVER,
+  buildCreateApi,
+  copyWithStructuralSharing,
+  coreModule,
+  coreModuleName,
+  createApi,
+  defaultSerializeQueryArgs,
+  fakeBaseQuery,
+  fetchBaseQuery,
+  retry,
+  setupListeners,
+  skipToken
+};
+//# sourceMappingURL=rtk-query.modern.mjs.map
Index: node_modules/@reduxjs/toolkit/dist/query/rtk-query.modern.mjs.map
===================================================================
--- node_modules/@reduxjs/toolkit/dist/query/rtk-query.modern.mjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
+++ node_modules/@reduxjs/toolkit/dist/query/rtk-query.modern.mjs.map	(revision a762898ecd37a452c782821d4c2c4955c6ed2521)
@@ -0,0 +1,1 @@
+{"version":3,"sources":["../../src/query/core/apiState.ts","../../src/query/core/rtkImports.ts","../../src/query/utils/copyWithStructuralSharing.ts","../../src/query/utils/filterMap.ts","../../src/query/utils/isAbsoluteUrl.ts","../../src/query/utils/isDocumentVisible.ts","../../src/query/utils/isNotNullish.ts","../../src/query/utils/isOnline.ts","../../src/query/utils/joinUrls.ts","../../src/query/utils/getOrInsert.ts","../../src/query/utils/signals.ts","../../src/query/fetchBaseQuery.ts","../../src/query/HandledError.ts","../../src/query/retry.ts","../../src/query/core/setupListeners.ts","../../src/query/endpointDefinitions.ts","../../src/query/utils/immerImports.ts","../../src/query/core/buildInitiate.ts","../../src/tsHelpers.ts","../../src/query/apiTypes.ts","../../src/query/standardSchema.ts","../../src/query/core/buildThunks.ts","../../src/query/utils/getCurrent.ts","../../src/query/core/buildSlice.ts","../../src/query/core/buildSelectors.ts","../../src/query/createApi.ts","../../src/query/defaultSerializeQueryArgs.ts","../../src/query/fakeBaseQuery.ts","../../src/query/tsHelpers.ts","../../src/query/core/buildMiddleware/batchActions.ts","../../src/query/core/buildMiddleware/cacheCollection.ts","../../src/query/core/buildMiddleware/cacheLifecycle.ts","../../src/query/core/buildMiddleware/devMiddleware.ts","../../src/query/core/buildMiddleware/invalidationByTags.ts","../../src/query/core/buildMiddleware/polling.ts","../../src/query/core/buildMiddleware/queryLifecycle.ts","../../src/query/core/buildMiddleware/windowEventHandling.ts","../../src/query/core/buildMiddleware/index.ts","../../src/query/core/module.ts","../../src/query/core/index.ts"],"sourcesContent":["import type { SerializedError } from '@reduxjs/toolkit';\nimport type { BaseQueryError } from '../baseQueryTypes';\nimport type { BaseEndpointDefinition, EndpointDefinitions, FullTagDescription, InfiniteQueryDefinition, MutationDefinition, PageParamFrom, QueryArgFromAnyQuery, QueryDefinition, ResultTypeFrom } from '../endpointDefinitions';\nimport type { Id, WithRequiredProp } from '../tsHelpers';\nexport type QueryCacheKey = string & {\n  _type: 'queryCacheKey';\n};\nexport type QuerySubstateIdentifier = {\n  queryCacheKey: QueryCacheKey;\n};\nexport type MutationSubstateIdentifier = {\n  requestId: string;\n  fixedCacheKey?: string;\n} | {\n  requestId?: string;\n  fixedCacheKey: string;\n};\nexport type RefetchConfigOptions = {\n  refetchOnMountOrArgChange: boolean | number;\n  refetchOnReconnect: boolean;\n  refetchOnFocus: boolean;\n};\nexport type InfiniteQueryConfigOptions<DataType, PageParam, QueryArg> = {\n  /**\n   * The initial page parameter to use for the first page fetch.\n   */\n  initialPageParam: PageParam;\n  /**\n   * This function is required to automatically get the next cursor for infinite queries.\n   * The result will also be used to determine the value of `hasNextPage`.\n   */\n  getNextPageParam: (lastPage: DataType, allPages: Array<DataType>, lastPageParam: PageParam, allPageParams: Array<PageParam>, queryArg: QueryArg) => PageParam | undefined | null;\n  /**\n   * This function can be set to automatically get the previous cursor for infinite queries.\n   * The result will also be used to determine the value of `hasPreviousPage`.\n   */\n  getPreviousPageParam?: (firstPage: DataType, allPages: Array<DataType>, firstPageParam: PageParam, allPageParams: Array<PageParam>, queryArg: QueryArg) => PageParam | undefined | null;\n  /**\n   * If specified, only keep this many pages in cache at once.\n   * If additional pages are fetched, older pages in the other\n   * direction will be dropped from the cache.\n   */\n  maxPages?: number;\n  /**\n   * Defaults to `true`. When this is `true` and an infinite query endpoint is refetched\n   * (due to tag invalidation, polling, arg change configuration, or manual refetching),\n   * RTK Query will try to sequentially refetch all pages currently in the cache.\n   * When `false` only the first page will be refetched.\n   */\n  refetchCachedPages?: boolean;\n};\nexport type InfiniteData<DataType, PageParam> = {\n  pages: Array<DataType>;\n  pageParams: Array<PageParam>;\n};\n\n// NOTE: DO NOT import and use this for runtime comparisons internally,\n// except in the RTKQ React package. Use the string versions just below this.\n// ESBuild auto-inlines TS enums, which bloats our bundle with many repeated\n// constants like \"initialized\":\n// https://github.com/evanw/esbuild/releases/tag/v0.14.7\n// We still have to use this in the React package since we don't publicly export\n// the string constants below.\n/**\n * Strings describing the query state at any given time.\n */\nexport enum QueryStatus {\n  uninitialized = 'uninitialized',\n  pending = 'pending',\n  fulfilled = 'fulfilled',\n  rejected = 'rejected',\n}\n\n// Use these string constants for runtime comparisons internally\nexport const STATUS_UNINITIALIZED = QueryStatus.uninitialized;\nexport const STATUS_PENDING = QueryStatus.pending;\nexport const STATUS_FULFILLED = QueryStatus.fulfilled;\nexport const STATUS_REJECTED = QueryStatus.rejected;\nexport type RequestStatusFlags = {\n  status: QueryStatus.uninitialized;\n  isUninitialized: true;\n  isLoading: false;\n  isSuccess: false;\n  isError: false;\n} | {\n  status: QueryStatus.pending;\n  isUninitialized: false;\n  isLoading: true;\n  isSuccess: false;\n  isError: false;\n} | {\n  status: QueryStatus.fulfilled;\n  isUninitialized: false;\n  isLoading: false;\n  isSuccess: true;\n  isError: false;\n} | {\n  status: QueryStatus.rejected;\n  isUninitialized: false;\n  isLoading: false;\n  isSuccess: false;\n  isError: true;\n};\nexport function getRequestStatusFlags(status: QueryStatus): RequestStatusFlags {\n  return {\n    status,\n    isUninitialized: status === STATUS_UNINITIALIZED,\n    isLoading: status === STATUS_PENDING,\n    isSuccess: status === STATUS_FULFILLED,\n    isError: status === STATUS_REJECTED\n  } as any;\n}\n\n/**\n * @public\n */\nexport type SubscriptionOptions = {\n  /**\n   * How frequently to automatically re-fetch data (in milliseconds). Defaults to `0` (off).\n   */\n  pollingInterval?: number;\n  /**\n   *  Defaults to 'false'. This setting allows you to control whether RTK Query will continue polling if the window is not focused.\n   *\n   *  If pollingInterval is not set or set to 0, this **will not be evaluated** until pollingInterval is greater than 0.\n   *\n   *  Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  skipPollingIfUnfocused?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after regaining a network connection.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnReconnect?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after the application window regains focus.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnFocus?: boolean;\n};\nexport type SubscribersInternal = Map<string, SubscriptionOptions>;\nexport type Subscribers = {\n  [requestId: string]: SubscriptionOptions;\n};\nexport type QueryKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any> ? K : never }[keyof Definitions];\nexport type InfiniteQueryKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? K : never }[keyof Definitions];\nexport type MutationKeys<Definitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends MutationDefinition<any, any, any, any> ? K : never }[keyof Definitions];\ntype BaseQuerySubState<D extends BaseEndpointDefinition<any, any, any, any>, DataType = ResultTypeFrom<D>> = {\n  /**\n   * The argument originally passed into the hook or `initiate` action call\n   */\n  originalArgs: QueryArgFromAnyQuery<D>;\n  /**\n   * A unique ID associated with the request\n   */\n  requestId: string;\n  /**\n   * The received data from the query\n   */\n  data?: DataType;\n  /**\n   * The received error if applicable\n   */\n  error?: SerializedError | (D extends QueryDefinition<any, infer BaseQuery, any, any> ? BaseQueryError<BaseQuery> : never);\n  /**\n   * The name of the endpoint associated with the query\n   */\n  endpointName: string;\n  /**\n   * Time that the latest query started\n   */\n  startedTimeStamp: number;\n  /**\n   * Time that the latest query was fulfilled\n   */\n  fulfilledTimeStamp?: number;\n};\nexport type QuerySubState<D extends BaseEndpointDefinition<any, any, any, any>, DataType = ResultTypeFrom<D>> = Id<({\n  status: QueryStatus.fulfilled;\n} & WithRequiredProp<BaseQuerySubState<D, DataType>, 'data' | 'fulfilledTimeStamp'> & {\n  error: undefined;\n}) | ({\n  status: QueryStatus.pending;\n} & BaseQuerySubState<D, DataType>) | ({\n  status: QueryStatus.rejected;\n} & WithRequiredProp<BaseQuerySubState<D, DataType>, 'error'>) | {\n  status: QueryStatus.uninitialized;\n  originalArgs?: undefined;\n  data?: undefined;\n  error?: undefined;\n  requestId?: undefined;\n  endpointName?: string;\n  startedTimeStamp?: undefined;\n  fulfilledTimeStamp?: undefined;\n}>;\nexport type InfiniteQueryDirection = 'forward' | 'backward';\nexport type InfiniteQuerySubState<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any> ? QuerySubState<D, InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>> & {\n  direction?: InfiniteQueryDirection;\n} : never;\ntype BaseMutationSubState<D extends BaseEndpointDefinition<any, any, any, any>> = {\n  requestId: string;\n  data?: ResultTypeFrom<D>;\n  error?: SerializedError | (D extends MutationDefinition<any, infer BaseQuery, any, any> ? BaseQueryError<BaseQuery> : never);\n  endpointName: string;\n  startedTimeStamp: number;\n  fulfilledTimeStamp?: number;\n};\nexport type MutationSubState<D extends BaseEndpointDefinition<any, any, any, any>> = (({\n  status: QueryStatus.fulfilled;\n} & WithRequiredProp<BaseMutationSubState<D>, 'data' | 'fulfilledTimeStamp'>) & {\n  error: undefined;\n}) | (({\n  status: QueryStatus.pending;\n} & BaseMutationSubState<D>) & {\n  data?: undefined;\n}) | ({\n  status: QueryStatus.rejected;\n} & WithRequiredProp<BaseMutationSubState<D>, 'error'>) | {\n  requestId?: undefined;\n  status: QueryStatus.uninitialized;\n  data?: undefined;\n  error?: undefined;\n  endpointName?: string;\n  startedTimeStamp?: undefined;\n  fulfilledTimeStamp?: undefined;\n};\nexport type CombinedState<D extends EndpointDefinitions, E extends string, ReducerPath extends string> = {\n  queries: QueryState<D>;\n  mutations: MutationState<D>;\n  provided: InvalidationState<E>;\n  subscriptions: SubscriptionState;\n  config: ConfigState<ReducerPath>;\n};\nexport type InvalidationState<TagTypes extends string> = {\n  tags: { [_ in TagTypes]: {\n    [id: string]: Array<QueryCacheKey>;\n    [id: number]: Array<QueryCacheKey>;\n  } };\n  keys: Record<QueryCacheKey, Array<FullTagDescription<any>>>;\n};\nexport type QueryState<D extends EndpointDefinitions> = {\n  [queryCacheKey: string]: QuerySubState<D[string]> | InfiniteQuerySubState<D[string]> | undefined;\n};\nexport type SubscriptionInternalState = Map<string, SubscribersInternal>;\nexport type SubscriptionState = {\n  [queryCacheKey: string]: Subscribers | undefined;\n};\nexport type ConfigState<ReducerPath> = RefetchConfigOptions & {\n  reducerPath: ReducerPath;\n  online: boolean;\n  focused: boolean;\n  middlewareRegistered: boolean | 'conflict';\n} & ModifiableConfigState;\nexport type ModifiableConfigState = {\n  keepUnusedDataFor: number;\n  invalidationBehavior: 'delayed' | 'immediately';\n} & RefetchConfigOptions;\nexport type MutationState<D extends EndpointDefinitions> = {\n  [requestId: string]: MutationSubState<D[string]> | undefined;\n};\nexport type RootState<Definitions extends EndpointDefinitions, TagTypes extends string, ReducerPath extends string> = { [P in ReducerPath]: CombinedState<Definitions, TagTypes, P> };","// This file exists to consolidate all of the imports from the `@reduxjs/toolkit` package.\n// ESBuild does not de-duplicate imports, so this file is used to ensure that each method\n// imported is only listed once, and there's only one mention of the `@reduxjs/toolkit` package.\n\nexport { createAction, createSlice, createSelector, createAsyncThunk, combineReducers, createNextState, isAnyOf, isAllOf, isAction, isPending, isRejected, isFulfilled, isRejectedWithValue, isAsyncThunkAction, prepareAutoBatched, SHOULD_AUTOBATCH, isPlainObject, nanoid } from '@reduxjs/toolkit';","import { isPlainObject as _iPO } from '../core/rtkImports';\n\n// remove type guard\nconst isPlainObject: (_: any) => boolean = _iPO;\nexport function copyWithStructuralSharing<T>(oldObj: any, newObj: T): T;\nexport function copyWithStructuralSharing(oldObj: any, newObj: any): any {\n  if (oldObj === newObj || !(isPlainObject(oldObj) && isPlainObject(newObj) || Array.isArray(oldObj) && Array.isArray(newObj))) {\n    return newObj;\n  }\n  const newKeys = Object.keys(newObj);\n  const oldKeys = Object.keys(oldObj);\n  let isSameObject = newKeys.length === oldKeys.length;\n  const mergeObj: any = Array.isArray(newObj) ? [] : {};\n  for (const key of newKeys) {\n    mergeObj[key] = copyWithStructuralSharing(oldObj[key], newObj[key]);\n    if (isSameObject) isSameObject = oldObj[key] === mergeObj[key];\n  }\n  return isSameObject ? oldObj : mergeObj;\n}","// Preserve type guard predicate behavior when passing to mapper\nexport function filterMap<T, U, S extends T = T>(array: readonly T[], predicate: (item: T, index: number) => item is S, mapper: (item: S, index: number) => U | U[]): U[];\nexport function filterMap<T, U>(array: readonly T[], predicate: (item: T, index: number) => boolean, mapper: (item: T, index: number) => U | U[]): U[];\nexport function filterMap<T, U>(array: readonly T[], predicate: (item: T, index: number) => boolean, mapper: (item: T, index: number) => U | U[]): U[] {\n  return array.reduce<(U | U[])[]>((acc, item, i) => {\n    if (predicate(item as any, i)) {\n      acc.push(mapper(item as any, i));\n    }\n    return acc;\n  }, []).flat() as U[];\n}","/**\n * If either :// or // is present consider it to be an absolute url\n *\n * @param url string\n */\n\nexport function isAbsoluteUrl(url: string) {\n  return new RegExp(`(^|:)//`).test(url);\n}","/**\n * Assumes true for a non-browser env, otherwise makes a best effort\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState\n */\nexport function isDocumentVisible(): boolean {\n  // `document` may not exist in non-browser envs (like RN)\n  if (typeof document === 'undefined') {\n    return true;\n  }\n  // Match true for visible, prerender, undefined\n  return document.visibilityState !== 'hidden';\n}","export function isNotNullish<T>(v: T | null | undefined): v is T {\n  return v != null;\n}\nexport function filterNullishValues<T>(map?: Map<any, T>) {\n  return [...(map?.values() ?? [])].filter(isNotNullish) as NonNullable<T>[];\n}","/**\n * Assumes a browser is online if `undefined`, otherwise makes a best effort\n * @link https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine\n */\nexport function isOnline() {\n  // We set the default config value in the store, so we'd need to check for this in a SSR env\n  return typeof navigator === 'undefined' ? true : navigator.onLine === undefined ? true : navigator.onLine;\n}","import { isAbsoluteUrl } from './isAbsoluteUrl';\nconst withoutTrailingSlash = (url: string) => url.replace(/\\/$/, '');\nconst withoutLeadingSlash = (url: string) => url.replace(/^\\//, '');\nexport function joinUrls(base: string | undefined, url: string | undefined): string {\n  if (!base) {\n    return url!;\n  }\n  if (!url) {\n    return base;\n  }\n  if (isAbsoluteUrl(url)) {\n    return url;\n  }\n  const delimiter = base.endsWith('/') || !url.startsWith('?') ? '/' : '';\n  base = withoutTrailingSlash(base);\n  url = withoutLeadingSlash(url);\n  return `${base}${delimiter}${url}`;\n}","// Duplicate some of the utils in `/src/utils` to ensure\n// we don't end up dragging in larger chunks of the RTK core\n// into the RTKQ bundle\n\nexport function getOrInsert<K extends object, V>(map: WeakMap<K, V>, key: K, value: V): V;\nexport function getOrInsert<K, V>(map: Map<K, V>, key: K, value: V): V;\nexport function getOrInsert<K extends object, V>(map: Map<K, V> | WeakMap<K, V>, key: K, value: V): V {\n  if (map.has(key)) return map.get(key) as V;\n  return map.set(key, value).get(key) as V;\n}\nexport function getOrInsertComputed<K extends object, V>(map: WeakMap<K, V>, key: K, compute: (key: K) => V): V;\nexport function getOrInsertComputed<K, V>(map: Map<K, V>, key: K, compute: (key: K) => V): V;\nexport function getOrInsertComputed<K extends object, V>(map: Map<K, V> | WeakMap<K, V>, key: K, compute: (key: K) => V): V {\n  if (map.has(key)) return map.get(key) as V;\n  return map.set(key, compute(key)).get(key) as V;\n}\nexport const createNewMap = () => new Map();","// AbortSignal.timeout() is currently baseline 2024\nexport const timeoutSignal = (milliseconds: number) => {\n  const abortController = new AbortController();\n  setTimeout(() => {\n    const message = 'signal timed out';\n    const name = 'TimeoutError';\n    abortController.abort(\n    // some environments (React Native, Node) don't have DOMException\n    typeof DOMException !== 'undefined' ? new DOMException(message, name) : Object.assign(new Error(message), {\n      name\n    }));\n  }, milliseconds);\n  return abortController.signal;\n};\n\n// AbortSignal.any() is currently baseline 2024\nexport const anySignal = (...signals: AbortSignal[]) => {\n  // if any are already aborted, return an already aborted signal\n  for (const signal of signals) if (signal.aborted) return AbortSignal.abort(signal.reason);\n\n  // otherwise, create a new signal that aborts when any of the given signals abort\n  const abortController = new AbortController();\n  for (const signal of signals) {\n    signal.addEventListener('abort', () => abortController.abort(signal.reason), {\n      signal: abortController.signal,\n      once: true\n    });\n  }\n  return abortController.signal;\n};","import { joinUrls } from './utils';\nimport { isPlainObject } from './core/rtkImports';\nimport type { BaseQueryApi, BaseQueryFn } from './baseQueryTypes';\nimport type { MaybePromise, Override } from './tsHelpers';\nimport { anySignal, timeoutSignal } from './utils/signals';\nexport type ResponseHandler = 'content-type' | 'json' | 'text' | ((response: Response) => Promise<any>);\ntype CustomRequestInit = Override<RequestInit, {\n  headers?: Headers | string[][] | Record<string, string | undefined> | undefined;\n}>;\nexport interface FetchArgs extends CustomRequestInit {\n  url: string;\n  params?: Record<string, any>;\n  body?: any;\n  responseHandler?: ResponseHandler;\n  validateStatus?: (response: Response, body: any) => boolean;\n  /**\n   * A number in milliseconds that represents that maximum time a request can take before timing out.\n   */\n  timeout?: number;\n}\n\n/**\n * A mini-wrapper that passes arguments straight through to\n * {@link [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)}.\n * Avoids storing `fetch` in a closure, in order to permit mocking/monkey-patching.\n */\nconst defaultFetchFn: typeof fetch = (...args) => fetch(...args);\nconst defaultValidateStatus = (response: Response) => response.status >= 200 && response.status <= 299;\nconst defaultIsJsonContentType = (headers: Headers) => /*applicat*//ion\\/(vnd\\.api\\+)?json/.test(headers.get('content-type') || '');\nexport type FetchBaseQueryError = {\n  /**\n   * * `number`:\n   *   HTTP status code\n   */\n  status: number;\n  data: unknown;\n} | {\n  /**\n   * * `\"FETCH_ERROR\"`:\n   *   An error that occurred during execution of `fetch` or the `fetchFn` callback option\n   **/\n  status: 'FETCH_ERROR';\n  data?: undefined;\n  error: string;\n} | {\n  /**\n   * * `\"PARSING_ERROR\"`:\n   *   An error happened during parsing.\n   *   Most likely a non-JSON-response was returned with the default `responseHandler` \"JSON\",\n   *   or an error occurred while executing a custom `responseHandler`.\n   **/\n  status: 'PARSING_ERROR';\n  originalStatus: number;\n  data: string;\n  error: string;\n} | {\n  /**\n   * * `\"TIMEOUT_ERROR\"`:\n   *   Request timed out\n   **/\n  status: 'TIMEOUT_ERROR';\n  data?: undefined;\n  error: string;\n} | {\n  /**\n   * * `\"CUSTOM_ERROR\"`:\n   *   A custom error type that you can return from your `queryFn` where another error might not make sense.\n   **/\n  status: 'CUSTOM_ERROR';\n  data?: unknown;\n  error: string;\n};\nfunction stripUndefined(obj: any) {\n  if (!isPlainObject(obj)) {\n    return obj;\n  }\n  const copy: Record<string, any> = {\n    ...obj\n  };\n  for (const [k, v] of Object.entries(copy)) {\n    if (v === undefined) delete copy[k];\n  }\n  return copy;\n}\n\n// Only set the content-type to json if appropriate. Will not be true for FormData, ArrayBuffer, Blob, etc.\nconst isJsonifiable = (body: any) => typeof body === 'object' && (isPlainObject(body) || Array.isArray(body) || typeof body.toJSON === 'function');\nexport type FetchBaseQueryArgs = {\n  baseUrl?: string;\n  prepareHeaders?: (headers: Headers, api: Pick<BaseQueryApi, 'getState' | 'extra' | 'endpoint' | 'type' | 'forced'> & {\n    arg: string | FetchArgs;\n    extraOptions: unknown;\n  }) => MaybePromise<Headers | void>;\n  fetchFn?: (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;\n  paramsSerializer?: (params: Record<string, any>) => string;\n  /**\n   * By default, we only check for 'application/json' and 'application/vnd.api+json' as the content-types for json. If you need to support another format, you can pass\n   * in a predicate function for your given api to get the same automatic stringifying behavior\n   * @example\n   * ```ts\n   * const isJsonContentType = (headers: Headers) => [\"application/vnd.api+json\", \"application/json\", \"application/vnd.hal+json\"].includes(headers.get(\"content-type\")?.trim());\n   * ```\n   */\n  isJsonContentType?: (headers: Headers) => boolean;\n  /**\n   * Defaults to `application/json`;\n   */\n  jsonContentType?: string;\n\n  /**\n   * Custom replacer function used when calling `JSON.stringify()`;\n   */\n  jsonReplacer?: (this: any, key: string, value: any) => any;\n} & RequestInit & Pick<FetchArgs, 'responseHandler' | 'validateStatus' | 'timeout'>;\nexport type FetchBaseQueryMeta = {\n  request: Request;\n  response?: Response;\n};\n\n/**\n * This is a very small wrapper around fetch that aims to simplify requests.\n *\n * @example\n * ```ts\n * const baseQuery = fetchBaseQuery({\n *   baseUrl: 'https://api.your-really-great-app.com/v1/',\n *   prepareHeaders: (headers, { getState }) => {\n *     const token = (getState() as RootState).auth.token;\n *     // If we have a token set in state, let's assume that we should be passing it.\n *     if (token) {\n *       headers.set('authorization', `Bearer ${token}`);\n *     }\n *     return headers;\n *   },\n * })\n * ```\n *\n * @param {string} baseUrl\n * The base URL for an API service.\n * Typically in the format of https://example.com/\n *\n * @param {(headers: Headers, api: { getState: () => unknown; arg: string | FetchArgs; extra: unknown; endpoint: string; type: 'query' | 'mutation'; forced: boolean; }) => Headers} prepareHeaders\n * An optional function that can be used to inject headers on requests.\n * Provides a Headers object, most of the `BaseQueryApi` (`dispatch` is not available), and the arg passed into the query function.\n * Useful for setting authentication or headers that need to be set conditionally.\n *\n * @link https://developer.mozilla.org/en-US/docs/Web/API/Headers\n *\n * @param {(input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>} fetchFn\n * Accepts a custom `fetch` function if you do not want to use the default on the window.\n * Useful in SSR environments if you need to use a library such as `isomorphic-fetch` or `cross-fetch`\n *\n * @param {(params: Record<string, unknown>) => string} paramsSerializer\n * An optional function that can be used to stringify querystring parameters.\n *\n * @param {(headers: Headers) => boolean} isJsonContentType\n * An optional predicate function to determine if `JSON.stringify()` should be called on the `body` arg of `FetchArgs`\n *\n * @param {string} jsonContentType Used when automatically setting the content-type header for a request with a jsonifiable body that does not have an explicit content-type header. Defaults to `application/json`.\n *\n * @param {(this: any, key: string, value: any) => any} jsonReplacer Custom replacer function used when calling `JSON.stringify()`.\n *\n * @param {number} timeout\n * A number in milliseconds that represents the maximum time a request can take before timing out.\n */\n\nexport function fetchBaseQuery({\n  baseUrl,\n  prepareHeaders = x => x,\n  fetchFn = defaultFetchFn,\n  paramsSerializer,\n  isJsonContentType = defaultIsJsonContentType,\n  jsonContentType = 'application/json',\n  jsonReplacer,\n  timeout: defaultTimeout,\n  responseHandler: globalResponseHandler,\n  validateStatus: globalValidateStatus,\n  ...baseFetchOptions\n}: FetchBaseQueryArgs = {}): BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta> {\n  if (typeof fetch === 'undefined' && fetchFn === defaultFetchFn) {\n    console.warn('Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments.');\n  }\n  return async (arg, api, extraOptions) => {\n    const {\n      getState,\n      extra,\n      endpoint,\n      forced,\n      type\n    } = api;\n    let meta: FetchBaseQueryMeta | undefined;\n    let {\n      url,\n      headers = new Headers(baseFetchOptions.headers),\n      params = undefined,\n      responseHandler = globalResponseHandler ?? 'json' as const,\n      validateStatus = globalValidateStatus ?? defaultValidateStatus,\n      timeout = defaultTimeout,\n      ...rest\n    } = typeof arg == 'string' ? {\n      url: arg\n    } : arg;\n    let config: RequestInit = {\n      ...baseFetchOptions,\n      signal: timeout ? anySignal(api.signal, timeoutSignal(timeout)) : api.signal,\n      ...rest\n    };\n    headers = new Headers(stripUndefined(headers));\n    config.headers = (await prepareHeaders(headers, {\n      getState,\n      arg,\n      extra,\n      endpoint,\n      forced,\n      type,\n      extraOptions\n    })) || headers;\n    const bodyIsJsonifiable = isJsonifiable(config.body);\n\n    // Remove content-type for non-jsonifiable bodies to let the browser set it automatically\n    // Exception: keep content-type for string bodies as they might be intentional (text/plain, text/html, etc.)\n    if (config.body != null && !bodyIsJsonifiable && typeof config.body !== 'string') {\n      config.headers.delete('content-type');\n    }\n    if (!config.headers.has('content-type') && bodyIsJsonifiable) {\n      config.headers.set('content-type', jsonContentType);\n    }\n    if (bodyIsJsonifiable && isJsonContentType(config.headers)) {\n      config.body = JSON.stringify(config.body, jsonReplacer);\n    }\n\n    // Set Accept header based on responseHandler if not already set\n    if (!config.headers.has('accept')) {\n      if (responseHandler === 'json') {\n        config.headers.set('accept', 'application/json');\n      } else if (responseHandler === 'text') {\n        config.headers.set('accept', 'text/plain, text/html, */*');\n      }\n      // For 'content-type' responseHandler, don't set Accept (let server decide)\n    }\n    if (params) {\n      const divider = ~url.indexOf('?') ? '&' : '?';\n      const query = paramsSerializer ? paramsSerializer(params) : new URLSearchParams(stripUndefined(params));\n      url += divider + query;\n    }\n    url = joinUrls(baseUrl, url);\n    const request = new Request(url, config);\n    const requestClone = new Request(url, config);\n    meta = {\n      request: requestClone\n    };\n    let response;\n    try {\n      response = await fetchFn(request);\n    } catch (e) {\n      return {\n        error: {\n          status: (e instanceof Error || typeof DOMException !== 'undefined' && e instanceof DOMException) && e.name === 'TimeoutError' ? 'TIMEOUT_ERROR' : 'FETCH_ERROR',\n          error: String(e)\n        },\n        meta\n      };\n    }\n    const responseClone = response.clone();\n    meta.response = responseClone;\n    let resultData: any;\n    let responseText: string = '';\n    try {\n      let handleResponseError;\n      await Promise.all([handleResponse(response, responseHandler).then(r => resultData = r, e => handleResponseError = e),\n      // see https://github.com/node-fetch/node-fetch/issues/665#issuecomment-538995182\n      // we *have* to \"use up\" both streams at the same time or they will stop running in node-fetch scenarios\n      responseClone.text().then(r => responseText = r, () => {})]);\n      if (handleResponseError) throw handleResponseError;\n    } catch (e) {\n      return {\n        error: {\n          status: 'PARSING_ERROR',\n          originalStatus: response.status,\n          data: responseText,\n          error: String(e)\n        },\n        meta\n      };\n    }\n    return validateStatus(response, resultData) ? {\n      data: resultData,\n      meta\n    } : {\n      error: {\n        status: response.status,\n        data: resultData\n      },\n      meta\n    };\n  };\n  async function handleResponse(response: Response, responseHandler: ResponseHandler) {\n    if (typeof responseHandler === 'function') {\n      return responseHandler(response);\n    }\n    if (responseHandler === 'content-type') {\n      responseHandler = isJsonContentType(response.headers) ? 'json' : 'text';\n    }\n    if (responseHandler === 'json') {\n      const text = await response.text();\n      return text.length ? JSON.parse(text) : null;\n    }\n    return response.text();\n  }\n}","export class HandledError {\n  constructor(public readonly value: any, public readonly meta: any = undefined) {}\n}","import type { BaseQueryApi, BaseQueryArg, BaseQueryEnhancer, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta } from './baseQueryTypes';\nimport type { FetchBaseQueryError } from './fetchBaseQuery';\nimport { HandledError } from './HandledError';\n\n/**\n * Exponential backoff based on the attempt number.\n *\n * @remarks\n * 1. 600ms * random(0.4, 1.4)\n * 2. 1200ms * random(0.4, 1.4)\n * 3. 2400ms * random(0.4, 1.4)\n * 4. 4800ms * random(0.4, 1.4)\n * 5. 9600ms * random(0.4, 1.4)\n *\n * @param attempt - Current attempt\n * @param maxRetries - Maximum number of retries\n */\nasync function defaultBackoff(attempt: number = 0, maxRetries: number = 5, signal?: AbortSignal) {\n  const attempts = Math.min(attempt, maxRetries);\n  const timeout = ~~((Math.random() + 0.4) * (300 << attempts)); // Force a positive int in the case we make this an option\n\n  await new Promise<void>((resolve, reject) => {\n    const timeoutId = setTimeout(() => resolve(), timeout);\n\n    // If signal is provided and gets aborted, clear timeout and reject\n    if (signal) {\n      const abortHandler = () => {\n        clearTimeout(timeoutId);\n        reject(new Error('Aborted'));\n      };\n\n      // Check if already aborted\n      if (signal.aborted) {\n        clearTimeout(timeoutId);\n        reject(new Error('Aborted'));\n      } else {\n        signal.addEventListener('abort', abortHandler, {\n          once: true\n        });\n      }\n    }\n  });\n}\ntype RetryConditionFunction = (error: BaseQueryError<BaseQueryFn>, args: BaseQueryArg<BaseQueryFn>, extraArgs: {\n  attempt: number;\n  baseQueryApi: BaseQueryApi;\n  extraOptions: BaseQueryExtraOptions<BaseQueryFn> & RetryOptions;\n}) => boolean;\nexport type RetryOptions = {\n  /**\n   * Function used to determine delay between retries\n   */\n  backoff?: (attempt: number, maxRetries: number, signal?: AbortSignal) => Promise<void>;\n} & ({\n  /**\n   * How many times the query will be retried (default: 5)\n   */\n  maxRetries?: number;\n  retryCondition?: undefined;\n} | {\n  /**\n   * Callback to determine if a retry should be attempted.\n   * Return `true` for another retry and `false` to quit trying prematurely.\n   */\n  retryCondition?: RetryConditionFunction;\n  maxRetries?: undefined;\n});\nfunction fail<BaseQuery extends BaseQueryFn = BaseQueryFn>(error: BaseQueryError<BaseQuery>, meta?: BaseQueryMeta<BaseQuery>): never {\n  throw Object.assign(new HandledError({\n    error,\n    meta\n  }), {\n    throwImmediately: true\n  });\n}\n\n/**\n * Checks if the abort signal is aborted and fails immediately if so.\n * Used to exit retry loops cleanly when a request is aborted.\n */\nfunction failIfAborted(signal: AbortSignal): void {\n  if (signal.aborted) {\n    fail({\n      status: 'CUSTOM_ERROR',\n      error: 'Aborted'\n    });\n  }\n}\nconst EMPTY_OPTIONS = {};\nconst retryWithBackoff: BaseQueryEnhancer<unknown, RetryOptions, RetryOptions | void> = (baseQuery, defaultOptions) => async (args, api, extraOptions) => {\n  // We need to figure out `maxRetries` before we define `defaultRetryCondition.\n  // This is probably goofy, but ought to work.\n  // Put our defaults in one array, filter out undefineds, grab the last value.\n  const possibleMaxRetries: number[] = [5, (defaultOptions as any || EMPTY_OPTIONS).maxRetries, (extraOptions as any || EMPTY_OPTIONS).maxRetries].filter(x => x !== undefined);\n  const [maxRetries] = possibleMaxRetries.slice(-1);\n  const defaultRetryCondition: RetryConditionFunction = (_, __, {\n    attempt\n  }) => attempt <= maxRetries;\n  const options: {\n    maxRetries: number;\n    backoff: typeof defaultBackoff;\n    retryCondition: typeof defaultRetryCondition;\n  } = {\n    maxRetries,\n    backoff: defaultBackoff,\n    retryCondition: defaultRetryCondition,\n    ...defaultOptions,\n    ...extraOptions\n  };\n  let retry = 0;\n  while (true) {\n    // Check if aborted before each attempt\n    failIfAborted(api.signal);\n    try {\n      const result = await baseQuery(args, api, extraOptions);\n      // baseQueries _should_ return an error property, so we should check for that and throw it to continue retrying\n      if (result.error) {\n        throw new HandledError(result);\n      }\n      return result;\n    } catch (e: any) {\n      retry++;\n      if (e.throwImmediately) {\n        if (e instanceof HandledError) {\n          return e.value;\n        }\n\n        // We don't know what this is, so we have to rethrow it\n        throw e;\n      }\n      if (e instanceof HandledError) {\n        if (!options.retryCondition(e.value.error as FetchBaseQueryError, args, {\n          attempt: retry,\n          baseQueryApi: api,\n          extraOptions\n        })) {\n          return e.value; // Max retries for expected error\n        }\n      } else {\n        // For unexpected errors, respect maxRetries\n        if (retry > options.maxRetries) {\n          // Return the error as a proper error response instead of throwing\n          return {\n            error: e\n          };\n        }\n      }\n\n      // Check if aborted before backoff\n      failIfAborted(api.signal);\n      try {\n        await options.backoff(retry, options.maxRetries, api.signal);\n      } catch (backoffError) {\n        // If backoff was aborted, exit the retry loop\n        failIfAborted(api.signal);\n        // Otherwise, rethrow the backoff error\n        throw backoffError;\n      }\n    }\n  }\n};\n\n/**\n * A utility that can wrap `baseQuery` in the API definition to provide retries with a basic exponential backoff.\n *\n * @example\n *\n * ```ts\n * // codeblock-meta title=\"Retry every request 5 times by default\"\n * import { createApi, fetchBaseQuery, retry } from '@reduxjs/toolkit/query/react'\n * interface Post {\n *   id: number\n *   name: string\n * }\n * type PostsResponse = Post[]\n *\n * // maxRetries: 5 is the default, and can be omitted. Shown for documentation purposes.\n * const staggeredBaseQuery = retry(fetchBaseQuery({ baseUrl: '/' }), { maxRetries: 5 });\n * export const api = createApi({\n *   baseQuery: staggeredBaseQuery,\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsResponse, void>({\n *       query: () => ({ url: 'posts' }),\n *     }),\n *     getPost: build.query<PostsResponse, string>({\n *       query: (id) => ({ url: `post/${id}` }),\n *       extraOptions: { maxRetries: 8 }, // You can override the retry behavior on each endpoint\n *     }),\n *   }),\n * });\n *\n * export const { useGetPostsQuery, useGetPostQuery } = api;\n * ```\n */\nexport const retry = /* @__PURE__ */Object.assign(retryWithBackoff, {\n  fail\n});","import type { ThunkDispatch, ActionCreatorWithoutPayload // Workaround for API-Extractor\n} from '@reduxjs/toolkit';\nimport { createAction } from './rtkImports';\nexport const INTERNAL_PREFIX = '__rtkq/';\nconst ONLINE = 'online';\nconst OFFLINE = 'offline';\nconst FOCUS = 'focus';\nconst FOCUSED = 'focused';\nconst VISIBILITYCHANGE = 'visibilitychange';\nexport const onFocus = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${FOCUSED}`);\nexport const onFocusLost = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}un${FOCUSED}`);\nexport const onOnline = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${ONLINE}`);\nexport const onOffline = /* @__PURE__ */createAction(`${INTERNAL_PREFIX}${OFFLINE}`);\nconst actions = {\n  onFocus,\n  onFocusLost,\n  onOnline,\n  onOffline\n};\nlet initialized = false;\n\n/**\n * A utility used to enable `refetchOnMount` and `refetchOnReconnect` behaviors.\n * It requires the dispatch method from your store.\n * Calling `setupListeners(store.dispatch)` will configure listeners with the recommended defaults,\n * but you have the option of providing a callback for more granular control.\n *\n * @example\n * ```ts\n * setupListeners(store.dispatch)\n * ```\n *\n * @param dispatch - The dispatch method from your store\n * @param customHandler - An optional callback for more granular control over listener behavior\n * @returns Return value of the handler.\n * The default handler returns an `unsubscribe` method that can be called to remove the listeners.\n */\nexport function setupListeners(dispatch: ThunkDispatch<any, any, any>, customHandler?: (dispatch: ThunkDispatch<any, any, any>, actions: {\n  onFocus: typeof onFocus;\n  onFocusLost: typeof onFocusLost;\n  onOnline: typeof onOnline;\n  onOffline: typeof onOffline;\n}) => () => void) {\n  function defaultHandler() {\n    const [handleFocus, handleFocusLost, handleOnline, handleOffline] = [onFocus, onFocusLost, onOnline, onOffline].map(action => () => dispatch(action()));\n    const handleVisibilityChange = () => {\n      if (window.document.visibilityState === 'visible') {\n        handleFocus();\n      } else {\n        handleFocusLost();\n      }\n    };\n    let unsubscribe = () => {\n      initialized = false;\n    };\n    if (!initialized) {\n      if (typeof window !== 'undefined' && window.addEventListener) {\n        const handlers = {\n          [FOCUS]: handleFocus,\n          [VISIBILITYCHANGE]: handleVisibilityChange,\n          [ONLINE]: handleOnline,\n          [OFFLINE]: handleOffline\n        };\n        function updateListeners(add: boolean) {\n          Object.entries(handlers).forEach(([event, handler]) => {\n            if (add) {\n              window.addEventListener(event, handler, false);\n            } else {\n              window.removeEventListener(event, handler);\n            }\n          });\n        }\n        // Handle focus events\n        updateListeners(true);\n        initialized = true;\n        unsubscribe = () => {\n          updateListeners(false);\n          initialized = false;\n        };\n      }\n    }\n    return unsubscribe;\n  }\n  return customHandler ? customHandler(dispatch, actions) : defaultHandler();\n}","import type { Api } from '@reduxjs/toolkit/query';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { BaseQueryApi, BaseQueryArg, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta, BaseQueryResult, QueryReturnValue } from './baseQueryTypes';\nimport type { CacheCollectionQueryExtraOptions } from './core/buildMiddleware/cacheCollection';\nimport type { CacheLifecycleInfiniteQueryExtraOptions, CacheLifecycleMutationExtraOptions, CacheLifecycleQueryExtraOptions } from './core/buildMiddleware/cacheLifecycle';\nimport type { QueryLifecycleInfiniteQueryExtraOptions, QueryLifecycleMutationExtraOptions, QueryLifecycleQueryExtraOptions } from './core/buildMiddleware/queryLifecycle';\nimport type { InfiniteData, InfiniteQueryConfigOptions, QuerySubState, RootState } from './core/index';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { NEVER } from './fakeBaseQuery';\nimport type { CastAny, HasRequiredProps, MaybePromise, NonUndefined, OmitFromUnion, UnwrapPromise } from './tsHelpers';\nimport { isNotNullish } from './utils';\nimport type { NamedSchemaError } from './standardSchema';\nimport { filterMap } from './utils/filterMap';\nconst rawResultType = /* @__PURE__ */Symbol();\nconst resultType = /* @__PURE__ */Symbol();\nconst baseQuery = /* @__PURE__ */Symbol();\nexport interface SchemaFailureInfo {\n  endpoint: string;\n  arg: any;\n  type: 'query' | 'mutation';\n  queryCacheKey?: string;\n}\nexport type SchemaFailureHandler = (error: NamedSchemaError, info: SchemaFailureInfo) => void;\nexport type SchemaFailureConverter<BaseQuery extends BaseQueryFn> = (error: NamedSchemaError, info: SchemaFailureInfo) => BaseQueryError<BaseQuery>;\nexport type EndpointDefinitionWithQuery<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery>> = {\n  /**\n   * `query` can be a function that returns either a `string` or an `object` which is passed to your `baseQuery`. If you are using [fetchBaseQuery](./fetchBaseQuery), this can return either a `string` or an `object` of properties in `FetchArgs`. If you use your own custom [`baseQuery`](../../rtk-query/usage/customizing-queries), you can customize this behavior to your liking.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"query example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       // highlight-start\n   *       query: () => 'posts',\n   *       // highlight-end\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *      // highlight-start\n   *      query: (body) => ({\n   *        url: `posts`,\n   *        method: 'POST',\n   *        body,\n   *      }),\n   *      // highlight-end\n   *      invalidatesTags: [{ type: 'Post', id: 'LIST' }],\n   *    }),\n   *   })\n   * })\n   * ```\n   */\n  query(arg: QueryArg): BaseQueryArg<BaseQuery>;\n  queryFn?: never;\n  /**\n   * A function to manipulate the data returned by a query or mutation.\n   */\n  transformResponse?(baseQueryReturnValue: RawResultType, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): ResultType | Promise<ResultType>;\n  /**\n   * A function to manipulate the data returned by a failed query or mutation.\n   */\n  transformErrorResponse?(baseQueryReturnValue: BaseQueryError<BaseQuery>, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): unknown;\n\n  /**\n   * A schema for the result *before* it's passed to `transformResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPostName: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawResponseSchema: postSchema,\n   *       transformResponse: (post) => post.name,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawResponseSchema?: StandardSchemaV1<RawResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn`, *before* it's passed to `transformErrorResponse`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import {customBaseQuery, baseQueryErrorSchema} from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       rawErrorResponseSchema: baseQueryErrorSchema,\n   *       transformErrorResponse: (error) => error.data,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  rawErrorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n};\nexport type EndpointDefinitionWithQueryFn<QueryArg, BaseQuery extends BaseQueryFn, ResultType> = {\n  /**\n   * Can be used in place of `query` as an inline function that bypasses `baseQuery` completely for the endpoint.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Basic queryFn example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *     }),\n   *     flipCoin: build.query<'heads' | 'tails', void>({\n   *       // highlight-start\n   *       queryFn(arg, queryApi, extraOptions, baseQuery) {\n   *         const randomVal = Math.random()\n   *         if (randomVal < 0.45) {\n   *           return { data: 'heads' }\n   *         }\n   *         if (randomVal < 0.9) {\n   *           return { data: 'tails' }\n   *         }\n   *         return { error: { status: 500, statusText: 'Internal Server Error', data: \"Coin landed on its edge!\" } }\n   *       }\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  queryFn(arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions<BaseQuery>, baseQuery: (arg: Parameters<BaseQuery>[0]) => ReturnType<BaseQuery>): MaybePromise<QueryReturnValue<ResultType, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>>;\n  query?: never;\n  transformResponse?: never;\n  transformErrorResponse?: never;\n  rawResponseSchema?: never;\n  rawErrorResponseSchema?: never;\n};\ntype BaseEndpointTypes<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType> = {\n  QueryArg: QueryArg;\n  BaseQuery: BaseQuery;\n  ResultType: ResultType;\n  RawResultType: RawResultType;\n};\nexport type SchemaType = 'arg' | 'rawResponse' | 'response' | 'rawErrorResponse' | 'errorResponse' | 'meta';\ninterface CommonEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType> {\n  /**\n   * A schema for the arguments to be passed to the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       argSchema: v.object({ id: v.number() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  argSchema?: StandardSchemaV1<QueryArg>;\n\n  /**\n   * A schema for the result (including `transformResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const postSchema = v.object({ id: v.number(), name: v.string() })\n   * type Post = v.InferOutput<typeof postSchema>\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: postSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  responseSchema?: StandardSchemaV1<ResultType>;\n\n  /**\n   * A schema for the error object returned by the `query` or `queryFn` (including `transformErrorResponse` if provided).\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryErrorSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       errorResponseSchema: baseQueryErrorSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  errorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n\n  /**\n   * A schema for the `meta` property returned by the `query` or `queryFn`.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   * import { customBaseQuery, baseQueryMetaSchema } from \"./customBaseQuery\"\n   *\n   * const api = createApi({\n   *   baseQuery: customBaseQuery,\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       metaSchema: baseQueryMetaSchema,\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  metaSchema?: StandardSchemaV1<BaseQueryMeta<BaseQuery>>;\n\n  /**\n   * Defaults to `true`.\n   *\n   * Most apps should leave this setting on. The only time it can be a performance issue\n   * is if an API returns extremely large amounts of data (e.g. 10,000 rows per request) and\n   * you're unable to paginate it.\n   *\n   * For details of how this works, please see the below. When it is set to `false`,\n   * every request will cause subscribed components to rerender, even when the data has not changed.\n   *\n   * @see https://redux-toolkit.js.org/api/other-exports#copywithstructuralsharing\n   */\n  structuralSharing?: boolean;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       onSchemaFailure: (error, info) => {\n   *         console.error(error, info)\n   *       },\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       catchSchemaFailure: (error, info) => ({\n   *         status: \"CUSTOM_ERROR\",\n   *         error: error.schemaName + \" failed validation\",\n   *         data: error.issues,\n   *       }),\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for this endpoint.\n   * Overrides the global setting.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *       skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type BaseEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = (([CastAny<BaseQueryResult<BaseQuery>, {}>] extends [NEVER] ? never : EndpointDefinitionWithQuery<QueryArg, BaseQuery, ResultType, RawResultType>) | EndpointDefinitionWithQueryFn<QueryArg, BaseQuery, ResultType>) & CommonEndpointDefinition<QueryArg, BaseQuery, ResultType> & {\n  /* phantom type */\n  [rawResultType]?: RawResultType;\n  /* phantom type */\n  [resultType]?: ResultType;\n  /* phantom type */\n  [baseQuery]?: BaseQuery;\n} & HasRequiredProps<BaseQueryExtraOptions<BaseQuery>, {\n  extraOptions: BaseQueryExtraOptions<BaseQuery>;\n}, {\n  extraOptions?: BaseQueryExtraOptions<BaseQuery>;\n}>;\n\n// NOTE As with QueryStatus in `apiState.ts`, don't use this for real comparisons\n// at runtime, use the string constants defined below.\nexport enum DefinitionType {\n  query = 'query',\n  mutation = 'mutation',\n  infinitequery = 'infinitequery',\n}\nexport const ENDPOINT_QUERY = DefinitionType.query;\nexport const ENDPOINT_MUTATION = DefinitionType.mutation;\nexport const ENDPOINT_INFINITEQUERY = DefinitionType.infinitequery;\ntype TagDescriptionArray<TagTypes extends string> = ReadonlyArray<TagDescription<TagTypes> | undefined | null>;\nexport type GetResultDescriptionFn<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = (result: ResultType | undefined, error: ErrorType | undefined, arg: QueryArg, meta: MetaType) => TagDescriptionArray<TagTypes>;\nexport type FullTagDescription<TagType> = {\n  type: TagType;\n  id?: number | string;\n};\nexport type TagDescription<TagType> = TagType | FullTagDescription<TagType>;\n\n/**\n * @public\n */\nexport type ResultDescription<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = TagDescriptionArray<TagTypes> | GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>;\ntype QueryTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  QueryDefinition: QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface QueryExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.query;\n\n  /**\n   * Used by `query` endpoints. Determines which 'tag' is attached to the cached data returned by the query.\n   * Expects an array of tag type strings, an array of objects of tag types with ids, or a function that returns such an array.\n   * 1.  `['Post']` - equivalent to `2`\n   * 2.  `[{ type: 'Post' }]` - equivalent to `1`\n   * 3.  `[{ type: 'Post', id: 1 }]`\n   * 4.  `(result, error, arg) => ['Post']` - equivalent to `5`\n   * 5.  `(result, error, arg) => [{ type: 'Post' }]` - equivalent to `4`\n   * 6.  `(result, error, arg) => [{ type: 'Post', id: 1 }]`\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"providesTags example\"\n   *\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       // highlight-start\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     })\n   *   })\n   * })\n   * ```\n   */\n  providesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * Can be provided to merge an incoming response value into the current cache data.\n   * If supplied, no automatic structural sharing will be applied - it's up to\n   * you to update the cache appropriately.\n   *\n   * Since RTKQ normally replaces cache entries with the new response, you will usually\n   * need to use this with the `serializeQueryArgs` or `forceRefetch` options to keep\n   * an existing cache entry so that it can be updated.\n   *\n   * Since this is wrapped with Immer, you may either mutate the `currentCacheValue` directly,\n   * or return a new value, but _not_ both at once.\n   *\n   * Will only be called if the existing `currentCacheData` is _not_ `undefined` - on first response,\n   * the cache entry will just save the response data directly.\n   *\n   * Useful if you don't want a new request to completely override the current cache value,\n   * maybe because you have manually updated it from another source and don't want those\n   * updates to get lost.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"merge: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  merge?(currentCacheData: ResultType, responseData: ResultType, otherArgs: {\n    arg: QueryArg;\n    baseQueryMeta: BaseQueryMeta<BaseQuery>;\n    requestId: string;\n    fulfilledTimeStamp: number;\n  }): ResultType | void;\n\n  /**\n   * Check to see if the endpoint should force a refetch in cases where it normally wouldn't.\n   * This is primarily useful for \"infinite scroll\" / pagination use cases where\n   * RTKQ is keeping a single cache entry that is added to over time, in combination\n   * with `serializeQueryArgs` returning a fixed cache key and a `merge` callback\n   * set to add incoming data to the cache entry each time.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"forceRefresh: pagination\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    listItems: build.query<string[], number>({\n   *      query: (pageNumber) => `/listItems?page=${pageNumber}`,\n   *     // Only have one cache entry because the arg always maps to one string\n   *     serializeQueryArgs: ({ endpointName }) => {\n   *       return endpointName\n   *      },\n   *      // Always merge incoming data to the cache entry\n   *      merge: (currentCache, newItems) => {\n   *        currentCache.push(...newItems)\n   *      },\n   *      // Refetch when the page arg changes\n   *      forceRefetch({ currentArg, previousArg }) {\n   *        return currentArg !== previousArg\n   *      },\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  forceRefetch?(params: {\n    currentArg: QueryArg | undefined;\n    previousArg: QueryArg | undefined;\n    state: RootState<any, any, string>;\n    endpointState?: QuerySubState<any>;\n  }): boolean;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: QueryTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type QueryDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & QueryExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type InfiniteQueryTypes<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n   * ```\n   */\n  InfiniteQueryDefinition: InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\nexport interface InfiniteQueryExtraOptions<TagTypes extends string, ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n  type: DefinitionType.infinitequery;\n  providesTags?: ResultDescription<TagTypes, InfiniteData<ResultType, PageParam>, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A query should not invalidate tags in the cache.\n   */\n  invalidatesTags?: never;\n\n  /**\n   * Required options to configure the infinite query behavior.\n   * `initialPageParam` and `getNextPageParam` are required, to\n   * ensure the infinite query can properly fetch the next page of data.\n   * `initialPageParam` may be specified when using the\n   * endpoint, to override the default value.\n   * `maxPages` and `getPreviousPageParam` are both optional.\n   * \n   * @example\n   * \n   * ```ts\n   * // codeblock-meta title=\"infiniteQueryOptions example\"\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * \n   * type Pokemon = {\n   *   id: string\n   *   name: string\n   * }\n   * \n   * const pokemonApi = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),\n   *   endpoints: (build) => ({\n   *     getInfinitePokemonWithMax: build.infiniteQuery<Pokemon[], string, number>({\n   *       infiniteQueryOptions: {\n   *         initialPageParam: 0,\n   *         maxPages: 3,\n   *         getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) =>\n   *           lastPageParam + 1,\n   *         getPreviousPageParam: (\n   *           firstPage,\n   *           allPages,\n   *           firstPageParam,\n   *           allPageParams,\n   *         ) => {\n   *           return firstPageParam > 0 ? firstPageParam - 1 : undefined\n   *         },\n   *       },\n   *       query({pageParam}) {\n   *         return `https://example.com/listItems?page=${pageParam}`\n   *       },\n   *     }),\n   *   }),\n   * })\n   \n   * ```\n   */\n  infiniteQueryOptions: InfiniteQueryConfigOptions<ResultType, PageParam, QueryArg>;\n\n  /**\n   * Can be provided to return a custom cache key value based on the query arguments.\n   *\n   * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key.  It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n   *\n   * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean.  If it returns a string, that value will be used as the cache key directly.  If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`.  This simplifies the use case of stripping out args you don't want included in the cache key.\n   *\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n   *\n   * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * interface MyApiClient {\n   *   fetchPost: (id: string) => Promise<Post>\n   * }\n   *\n   * createApi({\n   *  baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *  endpoints: (build) => ({\n   *    // Example: an endpoint with an API client passed in as an argument,\n   *    // but only the item ID should be used as the cache key\n   *    getPost: build.query<Post, { id: string; client: MyApiClient }>({\n   *      queryFn: async ({ id, client }) => {\n   *        const post = await client.fetchPost(id)\n   *        return { data: post }\n   *      },\n   *      // highlight-start\n   *      serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n   *        const { id } = queryArgs\n   *        // This can return a string, an object, a number, or a boolean.\n   *        // If it returns an object, number or boolean, that value\n   *        // will be serialized automatically via `defaultSerializeQueryArgs`\n   *        return { id } // omit `client` from the cache key\n   *\n   *        // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n   *        // return defaultSerializeQueryArgs({\n   *        //   endpointName,\n   *        //   queryArgs: { id },\n   *        //   endpointDefinition\n   *        // })\n   *        // Or  create and return a string yourself:\n   *        // return `getPost(${id})`\n   *      },\n   *      // highlight-end\n   *    }),\n   *  }),\n   *})\n   * ```\n   */\n  serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: InfiniteQueryTypes<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> =\n// Infinite query endpoints receive `{queryArg, pageParam}`\nBaseEndpointDefinition<InfiniteQueryCombinedArg<QueryArg, PageParam>, BaseQuery, ResultType, RawResultType> & InfiniteQueryExtraOptions<TagTypes, ResultType, QueryArg, PageParam, BaseQuery, ReducerPath, RawResultType>;\ntype MutationTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType, RawResultType> & {\n  /**\n   * The endpoint definition type. To be used with some internal generic types.\n   * @example\n   * ```ts\n   * const useMyWrappedHook: UseMutation<typeof api.endpoints.query.Types.MutationDefinition> = ...\n   * ```\n   */\n  MutationDefinition: MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n  TagTypes: TagTypes;\n  ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface MutationExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> extends CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath> {\n  type: DefinitionType.mutation;\n\n  /**\n   * Used by `mutation` endpoints. Determines which cached data should be either re-fetched or removed from the cache.\n   * Expects the same shapes as `providesTags`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"invalidatesTags example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   tagTypes: ['Posts'],\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts',\n   *       providesTags: (result) =>\n   *         result\n   *           ? [\n   *               ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n   *               { type: 'Posts', id: 'LIST' },\n   *             ]\n   *           : [{ type: 'Posts', id: 'LIST' }],\n   *     }),\n   *     addPost: build.mutation<Post, Partial<Post>>({\n   *       query(body) {\n   *         return {\n   *           url: `posts`,\n   *           method: 'POST',\n   *           body,\n   *         }\n   *       },\n   *       // highlight-start\n   *       invalidatesTags: [{ type: 'Posts', id: 'LIST' }],\n   *       // highlight-end\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  invalidatesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n  /**\n   * Not to be used. A mutation should not provide tags to the cache.\n   */\n  providesTags?: never;\n\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types?: MutationTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n}\nexport type MutationDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & MutationExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath, RawResultType>;\nexport type EndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, PageParam = any, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\nexport type EndpointDefinitions = Record<string, EndpointDefinition<any, any, any, any, any, any, any>>;\nexport function isQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is QueryDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_QUERY;\n}\nexport function isMutationDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is MutationDefinition<any, any, any, any, any, any> {\n  return e.type === ENDPOINT_MUTATION;\n}\nexport function isInfiniteQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is InfiniteQueryDefinition<any, any, any, any, any, any, any> {\n  return e.type === ENDPOINT_INFINITEQUERY;\n}\nexport function isAnyQueryDefinition(e: EndpointDefinition<any, any, any, any>): e is QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any> {\n  return isQueryDefinition(e) || isInfiniteQueryDefinition(e);\n}\nexport type EndpointBuilder<BaseQuery extends BaseQueryFn, TagTypes extends string, ReducerPath extends string> = {\n  /**\n   * An endpoint definition that retrieves data, and may provide tags to the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all query endpoint options\"\n   * const api = createApi({\n   *  baseQuery,\n   *  endpoints: (build) => ({\n   *    getPost: build.query({\n   *      query: (id) => ({ url: `post/${id}` }),\n   *      // Pick out data and prevent nested properties in a hook or selector\n   *      transformResponse: (response) => response.data,\n   *      // Pick out error and prevent nested properties in a hook or selector\n   *      transformErrorResponse: (response) => response.error,\n   *      // `result` is the server response\n   *      providesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry, updateCachedData }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry, updateCachedData }) {},\n   *    }),\n   *  }),\n   *});\n   *```\n   */\n  query<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n\n  /**\n   * An endpoint definition that alters data on the server or will possibly invalidate the cache.\n   *\n   * @example\n   * ```js\n   * // codeblock-meta title=\"Example of all mutation endpoint options\"\n   * const api = createApi({\n   *   baseQuery,\n   *   endpoints: (build) => ({\n   *     updatePost: build.mutation({\n   *       query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),\n   *       // Pick out data and prevent nested properties in a hook or selector\n   *       transformResponse: (response) => response.data,\n   *       // Pick out error and prevent nested properties in a hook or selector\n   *       transformErrorResponse: (response) => response.error,\n   *       // `result` is the server response\n   *       invalidatesTags: (result, error, id) => [{ type: 'Post', id }],\n   *      // trigger side effects or optimistic updates\n   *      onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry }) {},\n   *      // handle subscriptions etc\n   *      onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry }) {},\n   *     }),\n   *   }),\n   * });\n   * ```\n   */\n  mutation<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n  infiniteQuery<ResultType, QueryArg, PageParam, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n};\nexport type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T;\nexport function calculateProvidedBy<ResultType, QueryArg, ErrorType, MetaType>(description: ResultDescription<string, ResultType, QueryArg, ErrorType, MetaType> | undefined, result: ResultType | undefined, error: ErrorType | undefined, queryArg: QueryArg, meta: MetaType | undefined, assertTagTypes: AssertTagTypes): readonly FullTagDescription<string>[] {\n  const finalDescription = isFunction(description) ? description(result as ResultType, error as undefined, queryArg, meta as MetaType) : description;\n  if (finalDescription) {\n    return filterMap(finalDescription, isNotNullish, tag => assertTagTypes(expandTagDescription(tag)));\n  }\n  return [];\n}\nfunction isFunction<T>(t: T): t is Extract<T, Function> {\n  return typeof t === 'function';\n}\nexport function expandTagDescription(description: TagDescription<string>): FullTagDescription<string> {\n  return typeof description === 'string' ? {\n    type: description\n  } : description;\n}\nexport type QueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<infer QA, any, any, any> ? QA : never;\n\n// Just extracting `QueryArg` from `BaseEndpointDefinition`\n// doesn't sufficiently match here.\n// We need to explicitly match against `InfiniteQueryDefinition`\nexport type InfiniteQueryArgFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<infer QA, any, any, any, any, any, any> ? QA : never;\nexport type QueryArgFromAnyQuery<D extends BaseEndpointDefinition<any, any, any, any>> = D extends InfiniteQueryDefinition<any, any, any, any, any, any, any> ? InfiniteQueryArgFrom<D> : D extends QueryDefinition<any, any, any, any, any, any> ? QueryArgFrom<D> : never;\nexport type ResultTypeFrom<D extends BaseEndpointDefinition<any, any, any, any>> = D extends BaseEndpointDefinition<any, any, infer RT, any> ? RT : unknown;\nexport type ReducerPathFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, any, any, infer RP, any, any> ? RP : unknown;\nexport type TagTypesFrom<D extends EndpointDefinition<any, any, any, any, any, any, any>> = D extends EndpointDefinition<any, any, infer TT, any, any, any, any> ? TT : unknown;\nexport type PageParamFrom<D extends InfiniteQueryDefinition<any, any, any, any, any, any, any>> = D extends InfiniteQueryDefinition<any, infer PP, any, any, any, any, any> ? PP : unknown;\nexport type InfiniteQueryCombinedArg<QueryArg, PageParam> = {\n  queryArg: QueryArg;\n  pageParam: PageParam;\n};\nexport type TagTypesFromApi<T> = T extends Api<any, any, any, infer TagTypes> ? TagTypes : never;\nexport type DefinitionsFromApi<T> = T extends Api<any, infer Definitions, any, any> ? Definitions : never;\nexport type TransformedResponse<NewDefinitions extends EndpointDefinitions, K, ResultType> = K extends keyof NewDefinitions ? NewDefinitions[K]['transformResponse'] extends undefined ? ResultType : UnwrapPromise<ReturnType<NonUndefined<NewDefinitions[K]['transformResponse']>>> : ResultType;\nexport type OverrideResultType<Definition, NewResultType> = Definition extends QueryDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends MutationDefinition<infer QueryArg, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, TagTypes, NewResultType, ReducerPath> : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, infer TagTypes, any, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, NewResultType, ReducerPath> : never;\nexport type UpdateDefinitions<Definitions extends EndpointDefinitions, NewTagTypes extends string, NewDefinitions extends EndpointDefinitions> = { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? QueryDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends MutationDefinition<infer QueryArg, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? MutationDefinition<QueryArg, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : Definitions[K] extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQuery, any, infer ResultType, infer ReducerPath> ? InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, NewTagTypes, TransformedResponse<NewDefinitions, K, ResultType>, ReducerPath> : never };","export { current, isDraft, applyPatches, original, isDraftable, produceWithPatches, enablePatches } from 'immer';","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { AsyncThunkAction, SafePromise, SerializedError, ThunkAction, UnknownAction } from '@reduxjs/toolkit';\nimport type { Dispatch } from 'redux';\nimport { asSafePromise } from '../../tsHelpers';\nimport { getEndpointDefinition, type Api, type ApiContext } from '../apiTypes';\nimport type { BaseQueryError, QueryReturnValue } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport { ENDPOINT_QUERY, isQueryDefinition, type EndpointDefinition, type EndpointDefinitions, type InfiniteQueryArgFrom, type InfiniteQueryDefinition, type MutationDefinition, type PageParamFrom, type QueryArgFrom, type QueryDefinition, type ResultTypeFrom } from '../endpointDefinitions';\nimport { filterNullishValues } from '../utils';\nimport type { InfiniteData, InfiniteQueryConfigOptions, InfiniteQueryDirection, SubscriptionOptions } from './apiState';\nimport type { InfiniteQueryResultSelectorResult, QueryResultSelectorResult } from './buildSelectors';\nimport type { InfiniteQueryThunk, InfiniteQueryThunkArg, MutationThunk, QueryThunk, QueryThunkArg, ThunkApiMetaConfig } from './buildThunks';\nimport type { ApiEndpointQuery } from './module';\nimport type { InternalMiddlewareState } from './buildMiddleware/types';\nexport type BuildInitiateApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>> = {\n  initiate: StartQueryActionCreator<Definition>;\n};\nexport type BuildInitiateApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = {\n  initiate: StartInfiniteQueryActionCreator<Definition>;\n};\nexport type BuildInitiateApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>> = {\n  initiate: StartMutationActionCreator<Definition>;\n};\nexport const forceQueryFnSymbol = Symbol('forceQueryFn');\nexport const isUpsertQuery = (arg: QueryThunkArg) => typeof arg[forceQueryFnSymbol] === 'function';\nexport type StartQueryActionCreatorOptions = {\n  subscribe?: boolean;\n  forceRefetch?: boolean | number;\n  subscriptionOptions?: SubscriptionOptions;\n  [forceQueryFnSymbol]?: () => QueryReturnValue;\n};\ntype RefetchOptions = {\n  refetchCachedPages?: boolean;\n};\nexport type StartInfiniteQueryActionCreatorOptions<D extends InfiniteQueryDefinition<any, any, any, any, any>> = StartQueryActionCreatorOptions & {\n  direction?: InfiniteQueryDirection;\n  param?: unknown;\n} & Partial<Pick<Partial<InfiniteQueryConfigOptions<ResultTypeFrom<D>, PageParamFrom<D>, InfiniteQueryArgFrom<D>>>, 'initialPageParam' | 'refetchCachedPages'>>;\ntype AnyQueryActionCreator<D extends EndpointDefinition<any, any, any, any>> = (arg: any, options?: StartQueryActionCreatorOptions) => ThunkAction<AnyActionCreatorResult, any, any, UnknownAction>;\ntype StartQueryActionCreator<D extends QueryDefinition<any, any, any, any, any>> = (arg: QueryArgFrom<D>, options?: StartQueryActionCreatorOptions) => ThunkAction<QueryActionCreatorResult<D>, any, any, UnknownAction>;\nexport type StartInfiniteQueryActionCreator<D extends InfiniteQueryDefinition<any, any, any, any, any>> = (arg: InfiniteQueryArgFrom<D>, options?: StartInfiniteQueryActionCreatorOptions<D>) => ThunkAction<InfiniteQueryActionCreatorResult<D>, any, any, UnknownAction>;\ntype QueryActionCreatorFields = {\n  requestId: string;\n  subscriptionOptions: SubscriptionOptions | undefined;\n  abort(): void;\n  unsubscribe(): void;\n  updateSubscriptionOptions(options: SubscriptionOptions): void;\n  queryCacheKey: string;\n};\ntype AnyActionCreatorResult = SafePromise<any> & QueryActionCreatorFields & {\n  arg: any;\n  unwrap(): Promise<any>;\n  refetch(options?: RefetchOptions): AnyActionCreatorResult;\n};\nexport type QueryActionCreatorResult<D extends QueryDefinition<any, any, any, any>> = SafePromise<QueryResultSelectorResult<D>> & QueryActionCreatorFields & {\n  arg: QueryArgFrom<D>;\n  unwrap(): Promise<ResultTypeFrom<D>>;\n  refetch(): QueryActionCreatorResult<D>;\n};\nexport type InfiniteQueryActionCreatorResult<D extends InfiniteQueryDefinition<any, any, any, any, any>> = SafePromise<InfiniteQueryResultSelectorResult<D>> & QueryActionCreatorFields & {\n  arg: InfiniteQueryArgFrom<D>;\n  unwrap(): Promise<InfiniteData<ResultTypeFrom<D>, PageParamFrom<D>>>;\n  refetch(options?: Pick<StartInfiniteQueryActionCreatorOptions<D>, 'refetchCachedPages'>): InfiniteQueryActionCreatorResult<D>;\n};\ntype StartMutationActionCreator<D extends MutationDefinition<any, any, any, any>> = (arg: QueryArgFrom<D>, options?: {\n  /**\n   * If this mutation should be tracked in the store.\n   * If you just want to manually trigger this mutation using `dispatch` and don't care about the\n   * result, state & potential errors being held in store, you can set this to false.\n   * (defaults to `true`)\n   */\n  track?: boolean;\n  fixedCacheKey?: string;\n}) => ThunkAction<MutationActionCreatorResult<D>, any, any, UnknownAction>;\nexport type MutationActionCreatorResult<D extends MutationDefinition<any, any, any, any>> = SafePromise<{\n  data: ResultTypeFrom<D>;\n  error?: undefined;\n} | {\n  data?: undefined;\n  error: Exclude<BaseQueryError<D extends MutationDefinition<any, infer BaseQuery, any, any> ? BaseQuery : never>, undefined> | SerializedError;\n}> & {\n  /** @internal */\n  arg: {\n    /**\n     * The name of the given endpoint for the mutation\n     */\n    endpointName: string;\n    /**\n     * The original arguments supplied to the mutation call\n     */\n    originalArgs: QueryArgFrom<D>;\n    /**\n     * Whether the mutation is being tracked in the store.\n     */\n    track?: boolean;\n    fixedCacheKey?: string;\n  };\n  /**\n   * A unique string generated for the request sequence\n   */\n  requestId: string;\n\n  /**\n   * A method to cancel the mutation promise. Note that this is not intended to prevent the mutation\n   * that was fired off from reaching the server, but only to assist in handling the response.\n   *\n   * Calling `abort()` prior to the promise resolving will force it to reach the error state with\n   * the serialized error:\n   * `{ name: 'AbortError', message: 'Aborted' }`\n   *\n   * @example\n   * ```ts\n   * const [updateUser] = useUpdateUserMutation();\n   *\n   * useEffect(() => {\n   *   const promise = updateUser(id);\n   *   promise\n   *     .unwrap()\n   *     .catch((err) => {\n   *       if (err.name === 'AbortError') return;\n   *       // else handle the unexpected error\n   *     })\n   *\n   *   return () => {\n   *     promise.abort();\n   *   }\n   * }, [id, updateUser])\n   * ```\n   */\n  abort(): void;\n  /**\n   * Unwraps a mutation call to provide the raw response/error.\n   *\n   * @remarks\n   * If you need to access the error or success payload immediately after a mutation, you can chain .unwrap().\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap\"\n   * addPost({ id: 1, name: 'Example' })\n   *   .unwrap()\n   *   .then((payload) => console.log('fulfilled', payload))\n   *   .catch((error) => console.error('rejected', error));\n   * ```\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"Using .unwrap with async await\"\n   * try {\n   *   const payload = await addPost({ id: 1, name: 'Example' }).unwrap();\n   *   console.log('fulfilled', payload)\n   * } catch (error) {\n   *   console.error('rejected', error);\n   * }\n   * ```\n   */\n  unwrap(): Promise<ResultTypeFrom<D>>;\n  /**\n   * A method to manually unsubscribe from the mutation call, meaning it will be removed from cache after the usual caching grace period.\n   The value returned by the hook will reset to `isUninitialized` afterwards.\n   */\n  reset(): void;\n};\nexport function buildInitiate({\n  serializeQueryArgs,\n  queryThunk,\n  infiniteQueryThunk,\n  mutationThunk,\n  api,\n  context,\n  getInternalState\n}: {\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  queryThunk: QueryThunk;\n  infiniteQueryThunk: InfiniteQueryThunk<any>;\n  mutationThunk: MutationThunk;\n  api: Api<any, EndpointDefinitions, any, any>;\n  context: ApiContext<EndpointDefinitions>;\n  getInternalState: (dispatch: Dispatch) => InternalMiddlewareState;\n}) {\n  const getRunningQueries = (dispatch: Dispatch) => getInternalState(dispatch)?.runningQueries;\n  const getRunningMutations = (dispatch: Dispatch) => getInternalState(dispatch)?.runningMutations;\n  const {\n    unsubscribeQueryResult,\n    removeMutationResult,\n    updateSubscriptionOptions\n  } = api.internalActions;\n  return {\n    buildInitiateQuery,\n    buildInitiateInfiniteQuery,\n    buildInitiateMutation,\n    getRunningQueryThunk,\n    getRunningMutationThunk,\n    getRunningQueriesThunk,\n    getRunningMutationsThunk\n  };\n  function getRunningQueryThunk(endpointName: string, queryArgs: any) {\n    return (dispatch: Dispatch) => {\n      const endpointDefinition = getEndpointDefinition(context, endpointName);\n      const queryCacheKey = serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      });\n      return getRunningQueries(dispatch)?.get(queryCacheKey) as QueryActionCreatorResult<never> | InfiniteQueryActionCreatorResult<never> | undefined;\n    };\n  }\n  function getRunningMutationThunk(\n  /**\n   * this is only here to allow TS to infer the result type by input value\n   * we could use it to validate the result, but it's probably not necessary\n   */\n  _endpointName: string, fixedCacheKeyOrRequestId: string) {\n    return (dispatch: Dispatch) => {\n      return getRunningMutations(dispatch)?.get(fixedCacheKeyOrRequestId) as MutationActionCreatorResult<never> | undefined;\n    };\n  }\n  function getRunningQueriesThunk() {\n    return (dispatch: Dispatch) => filterNullishValues(getRunningQueries(dispatch));\n  }\n  function getRunningMutationsThunk() {\n    return (dispatch: Dispatch) => filterNullishValues(getRunningMutations(dispatch));\n  }\n  function middlewareWarning(dispatch: Dispatch) {\n    if (process.env.NODE_ENV !== 'production') {\n      if ((middlewareWarning as any).triggered) return;\n      const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());\n      (middlewareWarning as any).triggered = true;\n\n      // The RTKQ middleware should return the internal state object,\n      // but it should _not_ be the action object.\n      if (typeof returnedValue !== 'object' || typeof returnedValue?.type === 'string') {\n        // Otherwise, must not have been added\n        throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(34) : `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!`);\n      }\n    }\n  }\n  function buildInitiateAnyQuery<T extends 'query' | 'infiniteQuery'>(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any>) {\n    const queryAction: AnyQueryActionCreator<any> = (arg, {\n      subscribe = true,\n      forceRefetch,\n      subscriptionOptions,\n      [forceQueryFnSymbol]: forceQueryFn,\n      ...rest\n    } = {}) => (dispatch, getState) => {\n      const queryCacheKey = serializeQueryArgs({\n        queryArgs: arg,\n        endpointDefinition,\n        endpointName\n      });\n      let thunk: AsyncThunkAction<unknown, QueryThunkArg, ThunkApiMetaConfig>;\n      const commonThunkArgs = {\n        ...rest,\n        type: ENDPOINT_QUERY as 'query',\n        subscribe,\n        forceRefetch: forceRefetch,\n        subscriptionOptions,\n        endpointName,\n        originalArgs: arg,\n        queryCacheKey,\n        [forceQueryFnSymbol]: forceQueryFn\n      };\n      if (isQueryDefinition(endpointDefinition)) {\n        thunk = queryThunk(commonThunkArgs);\n      } else {\n        const {\n          direction,\n          initialPageParam,\n          refetchCachedPages\n        } = rest as Pick<InfiniteQueryThunkArg<any>, 'direction' | 'initialPageParam' | 'refetchCachedPages'>;\n        thunk = infiniteQueryThunk({\n          ...(commonThunkArgs as InfiniteQueryThunkArg<any>),\n          // Supply these even if undefined. This helps with a field existence\n          // check over in `buildSlice.ts`\n          direction,\n          initialPageParam,\n          refetchCachedPages\n        });\n      }\n      const selector = (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).select(arg);\n      const thunkResult = dispatch(thunk);\n      const stateAfter = selector(getState());\n      middlewareWarning(dispatch);\n      const {\n        requestId,\n        abort\n      } = thunkResult;\n      const skippedSynchronously = stateAfter.requestId !== requestId;\n      const runningQuery = getRunningQueries(dispatch)?.get(queryCacheKey);\n      const selectFromState = () => selector(getState());\n      const statePromise: AnyActionCreatorResult = Object.assign((forceQueryFn ?\n      // a query has been forced (upsertQueryData)\n      // -> we want to resolve it once data has been written with the data that will be written\n      thunkResult.then(selectFromState) : skippedSynchronously && !runningQuery ?\n      // a query has been skipped due to a condition and we do not have any currently running query\n      // -> we want to resolve it immediately with the current data\n      Promise.resolve(stateAfter) :\n      // query just started or one is already in flight\n      // -> wait for the running query, then resolve with data from after that\n      Promise.all([runningQuery, thunkResult]).then(selectFromState)) as SafePromise<any>, {\n        arg,\n        requestId,\n        subscriptionOptions,\n        queryCacheKey,\n        abort,\n        async unwrap() {\n          const result = await statePromise;\n          if (result.isError) {\n            throw result.error;\n          }\n          return result.data;\n        },\n        refetch: (options?: RefetchOptions) => dispatch(queryAction(arg, {\n          subscribe: false,\n          forceRefetch: true,\n          ...options\n        })),\n        unsubscribe() {\n          if (subscribe) dispatch(unsubscribeQueryResult({\n            queryCacheKey,\n            requestId\n          }));\n        },\n        updateSubscriptionOptions(options: SubscriptionOptions) {\n          statePromise.subscriptionOptions = options;\n          dispatch(updateSubscriptionOptions({\n            endpointName,\n            requestId,\n            queryCacheKey,\n            options\n          }));\n        }\n      });\n      if (!runningQuery && !skippedSynchronously && !forceQueryFn) {\n        const runningQueries = getRunningQueries(dispatch)!;\n        runningQueries.set(queryCacheKey, statePromise);\n        statePromise.then(() => {\n          runningQueries.delete(queryCacheKey);\n        });\n      }\n      return statePromise;\n    };\n    return queryAction;\n  }\n  function buildInitiateQuery(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any>) {\n    const queryAction: StartQueryActionCreator<any> = buildInitiateAnyQuery(endpointName, endpointDefinition);\n    return queryAction;\n  }\n  function buildInitiateInfiniteQuery(endpointName: string, endpointDefinition: InfiniteQueryDefinition<any, any, any, any, any>) {\n    const infiniteQueryAction: StartInfiniteQueryActionCreator<any> = buildInitiateAnyQuery(endpointName, endpointDefinition);\n    return infiniteQueryAction;\n  }\n  function buildInitiateMutation(endpointName: string): StartMutationActionCreator<any> {\n    return (arg, {\n      track = true,\n      fixedCacheKey\n    } = {}) => (dispatch, getState) => {\n      const thunk = mutationThunk({\n        type: 'mutation',\n        endpointName,\n        originalArgs: arg,\n        track,\n        fixedCacheKey\n      });\n      const thunkResult = dispatch(thunk);\n      middlewareWarning(dispatch);\n      const {\n        requestId,\n        abort,\n        unwrap\n      } = thunkResult;\n      const returnValuePromise = asSafePromise(thunkResult.unwrap().then(data => ({\n        data\n      })), error => ({\n        error\n      }));\n      const reset = () => {\n        dispatch(removeMutationResult({\n          requestId,\n          fixedCacheKey\n        }));\n      };\n      const ret = Object.assign(returnValuePromise, {\n        arg: thunkResult.arg,\n        requestId,\n        abort,\n        unwrap,\n        reset\n      });\n      const runningMutations = getRunningMutations(dispatch)!;\n      runningMutations.set(requestId, ret);\n      ret.then(() => {\n        runningMutations.delete(requestId);\n      });\n      if (fixedCacheKey) {\n        runningMutations.set(fixedCacheKey, ret);\n        ret.then(() => {\n          if (runningMutations.get(fixedCacheKey) === ret) {\n            runningMutations.delete(fixedCacheKey);\n          }\n        });\n      }\n      return ret;\n    };\n  }\n}","import type { Middleware, StoreEnhancer } from 'redux';\nimport type { Tuple } from './utils';\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>) {\n  Object.assign(target, ...args);\n}\n\n/**\n * return True if T is `any`, otherwise return False\n * taken from https://github.com/joonhocho/tsdef\n *\n * @internal\n */\nexport type IsAny<T, True, False = never> =\n// test if we are going the left AND right path in the condition\ntrue | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;\n\n/**\n * return True if T is `unknown`, otherwise return False\n * taken from https://github.com/joonhocho/tsdef\n *\n * @internal\n */\nexport type IsUnknown<T, True, False = never> = unknown extends T ? IsAny<T, False, True> : False;\nexport type FallbackIfUnknown<T, Fallback> = IsUnknown<T, Fallback, T>;\n\n/**\n * @internal\n */\nexport type IfMaybeUndefined<P, True, False> = [undefined] extends [P] ? True : False;\n\n/**\n * @internal\n */\nexport type IfVoid<P, True, False> = [void] extends [P] ? True : False;\n\n/**\n * @internal\n */\nexport type IsEmptyObj<T, True, False = never> = T extends any ? keyof T extends never ? IsUnknown<T, False, IfMaybeUndefined<T, False, IfVoid<T, False, True>>> : False : never;\n\n/**\n * returns True if TS version is above 3.5, False if below.\n * uses feature detection to detect TS version >= 3.5\n * * versions below 3.5 will return `{}` for unresolvable interference\n * * versions above will return `unknown`\n *\n * @internal\n */\nexport type AtLeastTS35<True, False> = [True, False][IsUnknown<ReturnType<<T>() => T>, 0, 1>];\n\n/**\n * @internal\n */\nexport type IsUnknownOrNonInferrable<T, True, False> = AtLeastTS35<IsUnknown<T, True, False>, IsEmptyObj<T, True, IsUnknown<T, True, False>>>;\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\n\n// Appears to have a convenient side effect of ignoring `never` even if that's not what you specified\nexport type ExcludeFromTuple<T, E, Acc extends unknown[] = []> = T extends [infer Head, ...infer Tail] ? ExcludeFromTuple<Tail, E, [...Acc, ...([Head] extends [E] ? [] : [Head])]> : Acc;\ntype ExtractDispatchFromMiddlewareTuple<MiddlewareTuple extends readonly any[], Acc extends {}> = MiddlewareTuple extends [infer Head, ...infer Tail] ? ExtractDispatchFromMiddlewareTuple<Tail, Acc & (Head extends Middleware<infer D> ? IsAny<D, {}, D> : {})> : Acc;\nexport type ExtractDispatchExtensions<M> = M extends Tuple<infer MiddlewareTuple> ? ExtractDispatchFromMiddlewareTuple<MiddlewareTuple, {}> : M extends ReadonlyArray<Middleware> ? ExtractDispatchFromMiddlewareTuple<[...M], {}> : never;\ntype ExtractStoreExtensionsFromEnhancerTuple<EnhancerTuple extends readonly any[], Acc extends {}> = EnhancerTuple extends [infer Head, ...infer Tail] ? ExtractStoreExtensionsFromEnhancerTuple<Tail, Acc & (Head extends StoreEnhancer<infer Ext> ? IsAny<Ext, {}, Ext> : {})> : Acc;\nexport type ExtractStoreExtensions<E> = E extends Tuple<infer EnhancerTuple> ? ExtractStoreExtensionsFromEnhancerTuple<EnhancerTuple, {}> : E extends ReadonlyArray<StoreEnhancer> ? UnionToIntersection<E[number] extends StoreEnhancer<infer Ext> ? Ext extends {} ? IsAny<Ext, {}, Ext> : {} : {}> : never;\ntype ExtractStateExtensionsFromEnhancerTuple<EnhancerTuple extends readonly any[], Acc extends {}> = EnhancerTuple extends [infer Head, ...infer Tail] ? ExtractStateExtensionsFromEnhancerTuple<Tail, Acc & (Head extends StoreEnhancer<any, infer StateExt> ? IsAny<StateExt, {}, StateExt> : {})> : Acc;\nexport type ExtractStateExtensions<E> = E extends Tuple<infer EnhancerTuple> ? ExtractStateExtensionsFromEnhancerTuple<EnhancerTuple, {}> : E extends ReadonlyArray<StoreEnhancer> ? UnionToIntersection<E[number] extends StoreEnhancer<any, infer StateExt> ? StateExt extends {} ? IsAny<StateExt, {}, StateExt> : {} : {}> : never;\n\n/**\n * Helper type. Passes T out again, but boxes it in a way that it cannot\n * \"widen\" the type by accident if it is a generic that should be inferred\n * from elsewhere.\n *\n * @internal\n */\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type WithOptionalProp<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\nexport interface TypeGuard<T> {\n  (value: any): value is T;\n}\nexport interface HasMatchFunction<T> {\n  match: TypeGuard<T>;\n}\nexport const hasMatchFunction = <T,>(v: Matcher<T>): v is HasMatchFunction<T> => {\n  return v && typeof (v as HasMatchFunction<T>).match === 'function';\n};\n\n/** @public */\nexport type Matcher<T> = HasMatchFunction<T> | TypeGuard<T>;\n\n/** @public */\nexport type ActionFromMatcher<M extends Matcher<any>> = M extends Matcher<infer T> ? T : never;\nexport type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type Tail<T extends any[]> = T extends [any, ...infer Tail] ? Tail : never;\nexport type UnknownIfNonSpecific<T> = {} extends T ? unknown : T;\n\n/**\n * A Promise that will never reject.\n * @see https://github.com/reduxjs/redux-toolkit/issues/4101\n */\nexport type SafePromise<T> = Promise<T> & {\n  __linterBrands: 'SafePromise';\n};\n\n/**\n * Properly wraps a Promise as a {@link SafePromise} with .catch(fallback).\n */\nexport function asSafePromise<Resolved, Rejected>(promise: Promise<Resolved>, fallback: (error: unknown) => Rejected) {\n  return promise.catch(fallback) as SafePromise<Resolved | Rejected>;\n}","import type { UnknownAction } from '@reduxjs/toolkit';\nimport type { BaseQueryFn } from './baseQueryTypes';\nimport type { CombinedState, CoreModule, QueryKeys } from './core';\nimport type { ApiModules } from './core/module';\nimport type { CreateApiOptions } from './createApi';\nimport type { EndpointBuilder, EndpointDefinition, EndpointDefinitions, UpdateDefinitions } from './endpointDefinitions';\nimport type { NoInfer, UnionToIntersection, WithRequiredProp } from './tsHelpers';\nexport type ModuleName = keyof ApiModules<any, any, any, any>;\nexport type Module<Name extends ModuleName> = {\n  name: Name;\n  init<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string>(api: Api<BaseQuery, EndpointDefinitions, ReducerPath, TagTypes, ModuleName>, options: WithRequiredProp<CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>, 'reducerPath' | 'serializeQueryArgs' | 'keepUnusedDataFor' | 'refetchOnMountOrArgChange' | 'refetchOnFocus' | 'refetchOnReconnect' | 'invalidationBehavior' | 'tagTypes'>, context: ApiContext<Definitions>): {\n    injectEndpoint(endpointName: string, definition: EndpointDefinition<any, any, any, any>): void;\n  };\n};\nexport interface ApiContext<Definitions extends EndpointDefinitions> {\n  apiUid: string;\n  endpointDefinitions: Definitions;\n  batch(cb: () => void): void;\n  extractRehydrationInfo: (action: UnknownAction) => CombinedState<any, any, any> | undefined;\n  hasRehydrationInfo: (action: UnknownAction) => boolean;\n}\nexport const getEndpointDefinition = <Definitions extends EndpointDefinitions, EndpointName extends keyof Definitions>(context: ApiContext<Definitions>, endpointName: EndpointName) => context.endpointDefinitions[endpointName];\nexport type Api<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string, Enhancers extends ModuleName = CoreModule> = UnionToIntersection<ApiModules<BaseQuery, Definitions, ReducerPath, TagTypes>[Enhancers]> & {\n  /**\n   * A function to inject the endpoints into the original API, but also give you that same API with correct types for these endpoints back. Useful with code-splitting.\n   */\n  injectEndpoints<NewDefinitions extends EndpointDefinitions>(_: {\n    endpoints: (build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>) => NewDefinitions;\n    /**\n     * Optionally allows endpoints to be overridden if defined by multiple `injectEndpoints` calls.\n     *\n     * If set to `true`, will override existing endpoints with the new definition.\n     * If set to `'throw'`, will throw an error if an endpoint is redefined with a different definition.\n     * If set to `false` (or unset), will not override existing endpoints with the new definition, and log a warning in development.\n     */\n    overrideExisting?: boolean | 'throw';\n  }): Api<BaseQuery, Definitions & NewDefinitions, ReducerPath, TagTypes, Enhancers>;\n  /**\n   *A function to enhance a generated API with additional information. Useful with code-generation.\n   */\n  enhanceEndpoints<NewTagTypes extends string = never, NewDefinitions extends EndpointDefinitions = never>(_: {\n    addTagTypes?: readonly NewTagTypes[];\n    endpoints?: UpdateDefinitions<Definitions, TagTypes | NoInfer<NewTagTypes>, NewDefinitions> extends infer NewDefinitions ? { [K in keyof NewDefinitions]?: Partial<NewDefinitions[K]> | ((definition: NewDefinitions[K]) => void) } : never;\n  }): Api<BaseQuery, UpdateDefinitions<Definitions, TagTypes | NewTagTypes, NewDefinitions>, ReducerPath, TagTypes | NewTagTypes, Enhancers>;\n};","import type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { SchemaError } from '@standard-schema/utils';\nimport type { SchemaType } from './endpointDefinitions';\nexport class NamedSchemaError extends SchemaError {\n  constructor(issues: readonly StandardSchemaV1.Issue[], public readonly value: any, public readonly schemaName: `${SchemaType}Schema`, public readonly _bqMeta: any) {\n    super(issues);\n  }\n}\nexport const shouldSkip = (skipSchemaValidation: boolean | SchemaType[] | undefined, schemaName: SchemaType) => Array.isArray(skipSchemaValidation) ? skipSchemaValidation.includes(schemaName) : !!skipSchemaValidation;\nexport async function parseWithSchema<Schema extends StandardSchemaV1>(schema: Schema, data: unknown, schemaName: `${SchemaType}Schema`, bqMeta: any): Promise<StandardSchemaV1.InferOutput<Schema>> {\n  const result = await schema['~standard'].validate(data);\n  if (result.issues) {\n    throw new NamedSchemaError(result.issues, data, schemaName, bqMeta);\n  }\n  return result.value;\n}","import type { AsyncThunk, AsyncThunkPayloadCreator, Draft, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { Patch } from 'immer';\nimport { isDraftable, produceWithPatches } from '../utils/immerImports';\nimport type { Api, ApiContext } from '../apiTypes';\nimport type { BaseQueryError, BaseQueryFn, QueryReturnValue } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { AssertTagTypes, EndpointDefinition, EndpointDefinitions, InfiniteQueryArgFrom, InfiniteQueryCombinedArg, InfiniteQueryDefinition, MutationDefinition, PageParamFrom, QueryArgFrom, QueryDefinition, ResultDescription, ResultTypeFrom, SchemaFailureConverter, SchemaFailureHandler, SchemaFailureInfo, SchemaType } from '../endpointDefinitions';\nimport { calculateProvidedBy, ENDPOINT_QUERY, isInfiniteQueryDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { HandledError } from '../HandledError';\nimport type { UnwrapPromise } from '../tsHelpers';\nimport type { RootState, QueryKeys, QuerySubstateIdentifier, InfiniteData, InfiniteQueryConfigOptions, QueryCacheKey, InfiniteQueryDirection, InfiniteQueryKeys } from './apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from './apiState';\nimport type { InfiniteQueryActionCreatorResult, QueryActionCreatorResult, StartInfiniteQueryActionCreatorOptions, StartQueryActionCreatorOptions } from './buildInitiate';\nimport { forceQueryFnSymbol, isUpsertQuery } from './buildInitiate';\nimport type { AllSelectors } from './buildSelectors';\nimport type { ApiEndpointQuery, PrefetchOptions } from './module';\nimport { createAsyncThunk, isAllOf, isFulfilled, isPending, isRejected, isRejectedWithValue, SHOULD_AUTOBATCH } from './rtkImports';\nimport { parseWithSchema, NamedSchemaError, shouldSkip } from '../standardSchema';\nexport type BuildThunksApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>> = Matchers<QueryThunk, Definition>;\nexport type BuildThunksApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = Matchers<InfiniteQueryThunk<any>, Definition>;\nexport type BuildThunksApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>> = Matchers<MutationThunk, Definition>;\ntype EndpointThunk<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = Definition extends EndpointDefinition<infer QueryArg, infer BaseQueryFn, any, infer ResultType> ? Thunk extends AsyncThunk<unknown, infer ATArg, infer ATConfig> ? AsyncThunk<ResultType, ATArg & {\n  originalArgs: QueryArg;\n}, ATConfig & {\n  rejectValue: BaseQueryError<BaseQueryFn>;\n}> : never : Definition extends InfiniteQueryDefinition<infer QueryArg, infer PageParam, infer BaseQueryFn, any, infer ResultType> ? Thunk extends AsyncThunk<unknown, infer ATArg, infer ATConfig> ? AsyncThunk<InfiniteData<ResultType, PageParam>, ATArg & {\n  originalArgs: QueryArg;\n}, ATConfig & {\n  rejectValue: BaseQueryError<BaseQueryFn>;\n}> : never : never;\nexport type PendingAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['pending']>;\nexport type FulfilledAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['fulfilled']>;\nexport type RejectedAction<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> = ReturnType<EndpointThunk<Thunk, Definition>['rejected']>;\nexport type Matcher<M> = (value: any) => value is M;\nexport interface Matchers<Thunk extends QueryThunk | MutationThunk | InfiniteQueryThunk<any>, Definition extends EndpointDefinition<any, any, any, any>> {\n  matchPending: Matcher<PendingAction<Thunk, Definition>>;\n  matchFulfilled: Matcher<FulfilledAction<Thunk, Definition>>;\n  matchRejected: Matcher<RejectedAction<Thunk, Definition>>;\n}\nexport type QueryThunkArg = QuerySubstateIdentifier & StartQueryActionCreatorOptions & {\n  type: 'query';\n  originalArgs: unknown;\n  endpointName: string;\n};\nexport type InfiniteQueryThunkArg<D extends InfiniteQueryDefinition<any, any, any, any, any>> = QuerySubstateIdentifier & StartInfiniteQueryActionCreatorOptions<D> & {\n  type: `query`;\n  originalArgs: unknown;\n  endpointName: string;\n  param: unknown;\n  direction?: InfiniteQueryDirection;\n  refetchCachedPages?: boolean;\n};\ntype MutationThunkArg = {\n  type: 'mutation';\n  originalArgs: unknown;\n  endpointName: string;\n  track?: boolean;\n  fixedCacheKey?: string;\n};\nexport type ThunkResult = unknown;\nexport type ThunkApiMetaConfig = {\n  pendingMeta: {\n    startedTimeStamp: number;\n    [SHOULD_AUTOBATCH]: true;\n  };\n  fulfilledMeta: {\n    fulfilledTimeStamp: number;\n    baseQueryMeta: unknown;\n    [SHOULD_AUTOBATCH]: true;\n  };\n  rejectedMeta: {\n    baseQueryMeta: unknown;\n    [SHOULD_AUTOBATCH]: true;\n  };\n};\nexport type QueryThunk = AsyncThunk<ThunkResult, QueryThunkArg, ThunkApiMetaConfig>;\nexport type InfiniteQueryThunk<D extends InfiniteQueryDefinition<any, any, any, any, any>> = AsyncThunk<ThunkResult, InfiniteQueryThunkArg<D>, ThunkApiMetaConfig>;\nexport type MutationThunk = AsyncThunk<ThunkResult, MutationThunkArg, ThunkApiMetaConfig>;\nfunction defaultTransformResponse(baseQueryReturnValue: unknown) {\n  return baseQueryReturnValue;\n}\nexport type MaybeDrafted<T> = T | Draft<T>;\nexport type Recipe<T> = (data: MaybeDrafted<T>) => void | MaybeDrafted<T>;\nexport type UpsertRecipe<T> = (data: MaybeDrafted<T> | undefined) => void | MaybeDrafted<T>;\nexport type PatchQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFrom<Definitions[EndpointName]>, patches: readonly Patch[], updateProvided?: boolean) => ThunkAction<void, PartialState, any, UnknownAction>;\nexport type AllQueryKeys<Definitions extends EndpointDefinitions> = QueryKeys<Definitions> | InfiniteQueryKeys<Definitions>;\nexport type QueryArgFromAnyQueryDefinition<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryArgFrom<Definitions[EndpointName]> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? QueryArgFrom<Definitions[EndpointName]> : never;\nexport type DataFromAnyQueryDefinition<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteData<ResultTypeFrom<Definitions[EndpointName]>, PageParamFrom<Definitions[EndpointName]>> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? ResultTypeFrom<Definitions[EndpointName]> : unknown;\nexport type UpsertThunkResult<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = Definitions[EndpointName] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryActionCreatorResult<Definitions[EndpointName]> : Definitions[EndpointName] extends QueryDefinition<any, any, any, any> ? QueryActionCreatorResult<Definitions[EndpointName]> : QueryActionCreatorResult<never>;\nexport type UpdateQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>, updateRecipe: Recipe<DataFromAnyQueryDefinition<Definitions, EndpointName>>, updateProvided?: boolean) => ThunkAction<PatchCollection, PartialState, any, UnknownAction>;\nexport type UpsertQueryDataThunk<Definitions extends EndpointDefinitions, PartialState> = <EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>, value: DataFromAnyQueryDefinition<Definitions, EndpointName>) => ThunkAction<UpsertThunkResult<Definitions, EndpointName>, PartialState, any, UnknownAction>;\n\n/**\n * An object returned from dispatching a `api.util.updateQueryData` call.\n */\nexport type PatchCollection = {\n  /**\n   * An `immer` Patch describing the cache update.\n   */\n  patches: Patch[];\n  /**\n   * An `immer` Patch to revert the cache update.\n   */\n  inversePatches: Patch[];\n  /**\n   * A function that will undo the cache update.\n   */\n  undo: () => void;\n};\ntype TransformCallback = (baseQueryReturnValue: unknown, meta: unknown, arg: unknown) => any;\nexport const addShouldAutoBatch = <T extends Record<string, any>,>(arg: T = {} as T): T & {\n  [SHOULD_AUTOBATCH]: true;\n} => {\n  return {\n    ...arg,\n    [SHOULD_AUTOBATCH]: true\n  };\n};\nexport function buildThunks<BaseQuery extends BaseQueryFn, ReducerPath extends string, Definitions extends EndpointDefinitions>({\n  reducerPath,\n  baseQuery,\n  context: {\n    endpointDefinitions\n  },\n  serializeQueryArgs,\n  api,\n  assertTagType,\n  selectors,\n  onSchemaFailure,\n  catchSchemaFailure: globalCatchSchemaFailure,\n  skipSchemaValidation: globalSkipSchemaValidation\n}: {\n  baseQuery: BaseQuery;\n  reducerPath: ReducerPath;\n  context: ApiContext<Definitions>;\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  api: Api<BaseQuery, Definitions, ReducerPath, any>;\n  assertTagType: AssertTagTypes;\n  selectors: AllSelectors;\n  onSchemaFailure: SchemaFailureHandler | undefined;\n  catchSchemaFailure: SchemaFailureConverter<BaseQuery> | undefined;\n  skipSchemaValidation: boolean | SchemaType[] | undefined;\n}) {\n  type State = RootState<any, string, ReducerPath>;\n  const patchQueryData: PatchQueryDataThunk<EndpointDefinitions, State> = (endpointName, arg, patches, updateProvided) => (dispatch, getState) => {\n    const endpointDefinition = endpointDefinitions[endpointName];\n    const queryCacheKey = serializeQueryArgs({\n      queryArgs: arg,\n      endpointDefinition,\n      endpointName\n    });\n    dispatch(api.internalActions.queryResultPatched({\n      queryCacheKey,\n      patches\n    }));\n    if (!updateProvided) {\n      return;\n    }\n    const newValue = api.endpoints[endpointName].select(arg)(\n    // Work around TS 4.1 mismatch\n    getState() as RootState<any, any, any>);\n    const providedTags = calculateProvidedBy(endpointDefinition.providesTags, newValue.data, undefined, arg, {}, assertTagType);\n    dispatch(api.internalActions.updateProvidedBy([{\n      queryCacheKey,\n      providedTags\n    }]));\n  };\n  function addToStart<T>(items: Array<T>, item: T, max = 0): Array<T> {\n    const newItems = [item, ...items];\n    return max && newItems.length > max ? newItems.slice(0, -1) : newItems;\n  }\n  function addToEnd<T>(items: Array<T>, item: T, max = 0): Array<T> {\n    const newItems = [...items, item];\n    return max && newItems.length > max ? newItems.slice(1) : newItems;\n  }\n  const updateQueryData: UpdateQueryDataThunk<EndpointDefinitions, State> = (endpointName, arg, updateRecipe, updateProvided = true) => (dispatch, getState) => {\n    const endpointDefinition = api.endpoints[endpointName];\n    const currentState = endpointDefinition.select(arg)(\n    // Work around TS 4.1 mismatch\n    getState() as RootState<any, any, any>);\n    const ret: PatchCollection = {\n      patches: [],\n      inversePatches: [],\n      undo: () => dispatch(api.util.patchQueryData(endpointName, arg, ret.inversePatches, updateProvided))\n    };\n    if (currentState.status === STATUS_UNINITIALIZED) {\n      return ret;\n    }\n    let newValue;\n    if ('data' in currentState) {\n      if (isDraftable(currentState.data)) {\n        const [value, patches, inversePatches] = produceWithPatches(currentState.data, updateRecipe);\n        ret.patches.push(...patches);\n        ret.inversePatches.push(...inversePatches);\n        newValue = value;\n      } else {\n        newValue = updateRecipe(currentState.data);\n        ret.patches.push({\n          op: 'replace',\n          path: [],\n          value: newValue\n        });\n        ret.inversePatches.push({\n          op: 'replace',\n          path: [],\n          value: currentState.data\n        });\n      }\n    }\n    if (ret.patches.length === 0) {\n      return ret;\n    }\n    dispatch(api.util.patchQueryData(endpointName, arg, ret.patches, updateProvided));\n    return ret;\n  };\n  const upsertQueryData: UpsertQueryDataThunk<Definitions, State> = (endpointName, arg, value) => dispatch => {\n    type EndpointName = typeof endpointName;\n    const res = dispatch((api.endpoints[endpointName] as ApiEndpointQuery<QueryDefinition<any, any, any, any, any>, Definitions>).initiate(arg, {\n      subscribe: false,\n      forceRefetch: true,\n      [forceQueryFnSymbol]: () => ({\n        data: value\n      })\n    })) as UpsertThunkResult<Definitions, EndpointName>;\n    return res;\n  };\n  const getTransformCallbackForEndpoint = (endpointDefinition: EndpointDefinition<any, any, any, any>, transformFieldName: 'transformResponse' | 'transformErrorResponse'): TransformCallback => {\n    return endpointDefinition.query && endpointDefinition[transformFieldName] ? endpointDefinition[transformFieldName]! as TransformCallback : defaultTransformResponse;\n  };\n\n  // The generic async payload function for all of our thunks\n  const executeEndpoint: AsyncThunkPayloadCreator<ThunkResult, QueryThunkArg | MutationThunkArg | InfiniteQueryThunkArg<any>, ThunkApiMetaConfig & {\n    state: RootState<any, string, ReducerPath>;\n  }> = async (arg, {\n    signal,\n    abort,\n    rejectWithValue,\n    fulfillWithValue,\n    dispatch,\n    getState,\n    extra\n  }) => {\n    const endpointDefinition = endpointDefinitions[arg.endpointName];\n    const {\n      metaSchema,\n      skipSchemaValidation = globalSkipSchemaValidation\n    } = endpointDefinition;\n    const isQuery = arg.type === ENDPOINT_QUERY;\n    try {\n      let transformResponse: TransformCallback = defaultTransformResponse;\n      const baseQueryApi = {\n        signal,\n        abort,\n        dispatch,\n        getState,\n        extra,\n        endpoint: arg.endpointName,\n        type: arg.type,\n        forced: isQuery ? isForcedQuery(arg, getState()) : undefined,\n        queryCacheKey: isQuery ? arg.queryCacheKey : undefined\n      };\n      const forceQueryFn = isQuery ? arg[forceQueryFnSymbol] : undefined;\n      let finalQueryReturnValue: QueryReturnValue;\n\n      // Infinite query wrapper, which executes the request and returns\n      // the InfiniteData `{pages, pageParams}` structure\n      const fetchPage = async (data: InfiniteData<unknown, unknown>, param: unknown, maxPages: number, previous?: boolean): Promise<QueryReturnValue> => {\n        // This should handle cases where there is no `getPrevPageParam`,\n        // or `getPPP` returned nullish\n        if (param == null && data.pages.length) {\n          return Promise.resolve({\n            data\n          });\n        }\n        const finalQueryArg: InfiniteQueryCombinedArg<any, any> = {\n          queryArg: arg.originalArgs,\n          pageParam: param\n        };\n        const pageResponse = await executeRequest(finalQueryArg);\n        const addTo = previous ? addToStart : addToEnd;\n        return {\n          data: {\n            pages: addTo(data.pages, pageResponse.data, maxPages),\n            pageParams: addTo(data.pageParams, param, maxPages)\n          },\n          meta: pageResponse.meta\n        };\n      };\n\n      // Wrapper for executing either `query` or `queryFn`,\n      // and handling any errors\n      async function executeRequest(finalQueryArg: unknown): Promise<QueryReturnValue> {\n        let result: QueryReturnValue;\n        const {\n          extraOptions,\n          argSchema,\n          rawResponseSchema,\n          responseSchema\n        } = endpointDefinition;\n        if (argSchema && !shouldSkip(skipSchemaValidation, 'arg')) {\n          finalQueryArg = await parseWithSchema(argSchema, finalQueryArg, 'argSchema', {} // we don't have a meta yet, so we can't pass it\n          );\n        }\n        if (forceQueryFn) {\n          // upsertQueryData relies on this to pass in the user-provided value\n          result = forceQueryFn();\n        } else if (endpointDefinition.query) {\n          // We should only run `transformResponse` when the endpoint has a `query` method,\n          // and we're not doing an `upsertQueryData`.\n          transformResponse = getTransformCallbackForEndpoint(endpointDefinition, 'transformResponse');\n          result = await baseQuery(endpointDefinition.query(finalQueryArg as any), baseQueryApi, extraOptions as any);\n        } else {\n          result = await endpointDefinition.queryFn(finalQueryArg as any, baseQueryApi, extraOptions as any, arg => baseQuery(arg, baseQueryApi, extraOptions as any));\n        }\n        if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n          const what = endpointDefinition.query ? '`baseQuery`' : '`queryFn`';\n          let err: undefined | string;\n          if (!result) {\n            err = `${what} did not return anything.`;\n          } else if (typeof result !== 'object') {\n            err = `${what} did not return an object.`;\n          } else if (result.error && result.data) {\n            err = `${what} returned an object containing both \\`error\\` and \\`result\\`.`;\n          } else if (result.error === undefined && result.data === undefined) {\n            err = `${what} returned an object containing neither a valid \\`error\\` and \\`result\\`. At least one of them should not be \\`undefined\\``;\n          } else {\n            for (const key of Object.keys(result)) {\n              if (key !== 'error' && key !== 'data' && key !== 'meta') {\n                err = `The object returned by ${what} has the unknown property ${key}.`;\n                break;\n              }\n            }\n          }\n          if (err) {\n            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);\n          }\n        }\n        if (result.error) throw new HandledError(result.error, result.meta);\n        let {\n          data\n        } = result;\n        if (rawResponseSchema && !shouldSkip(skipSchemaValidation, 'rawResponse')) {\n          data = await parseWithSchema(rawResponseSchema, result.data, 'rawResponseSchema', result.meta);\n        }\n        let transformedResponse = await transformResponse(data, result.meta, finalQueryArg);\n        if (responseSchema && !shouldSkip(skipSchemaValidation, 'response')) {\n          transformedResponse = await parseWithSchema(responseSchema, transformedResponse, 'responseSchema', result.meta);\n        }\n        return {\n          ...result,\n          data: transformedResponse\n        };\n      }\n      if (isQuery && 'infiniteQueryOptions' in endpointDefinition) {\n        // This is an infinite query endpoint\n        const {\n          infiniteQueryOptions\n        } = endpointDefinition;\n\n        // Runtime checks should guarantee this is a positive number if provided\n        const {\n          maxPages = Infinity\n        } = infiniteQueryOptions;\n\n        // Priority: per-call override > endpoint config > default (true)\n        const refetchCachedPages = (arg as InfiniteQueryThunkArg<any>).refetchCachedPages ?? infiniteQueryOptions.refetchCachedPages ?? true;\n        let result: QueryReturnValue;\n\n        // Start by looking up the existing InfiniteData value from state,\n        // falling back to an empty value if it doesn't exist yet\n        const blankData = {\n          pages: [],\n          pageParams: []\n        };\n        const cachedData = selectors.selectQueryEntry(getState(), arg.queryCacheKey)?.data as InfiniteData<unknown, unknown> | undefined;\n\n        // When the arg changes or the user forces a refetch,\n        // we don't include the `direction` flag. This lets us distinguish\n        // between actually refetching with a forced query, vs just fetching\n        // the next page.\n        const isForcedQueryNeedingRefetch =\n        // arg.forceRefetch\n        isForcedQuery(arg, getState()) && !(arg as InfiniteQueryThunkArg<any>).direction;\n        const existingData = (isForcedQueryNeedingRefetch || !cachedData ? blankData : cachedData) as InfiniteData<unknown, unknown>;\n\n        // If the thunk specified a direction and we do have at least one page,\n        // fetch the next or previous page\n        if ('direction' in arg && arg.direction && existingData.pages.length) {\n          const previous = arg.direction === 'backward';\n          const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;\n          const param = pageParamFn(infiniteQueryOptions, existingData, arg.originalArgs);\n          result = await fetchPage(existingData, param, maxPages, previous);\n        } else {\n          // Otherwise, fetch the first page and then any remaining pages\n\n          const {\n            initialPageParam = infiniteQueryOptions.initialPageParam\n          } = arg as InfiniteQueryThunkArg<any>;\n\n          // If we're doing a refetch, we should start from\n          // the first page we have cached.\n          // Otherwise, we should start from the initialPageParam\n          const cachedPageParams = cachedData?.pageParams ?? [];\n          const firstPageParam = cachedPageParams[0] ?? initialPageParam;\n          const totalPages = cachedPageParams.length;\n\n          // Fetch first page\n          result = await fetchPage(existingData, firstPageParam, maxPages);\n          if (forceQueryFn) {\n            // HACK `upsertQueryData` expects the user to pass in the `{pages, pageParams}` structure,\n            // but `fetchPage` treats that as `pages[0]`. We have to manually un-nest it.\n            result = {\n              data: (result.data as InfiniteData<unknown, unknown>).pages[0]\n            } as QueryReturnValue;\n          }\n          if (refetchCachedPages) {\n            // Fetch remaining pages\n            for (let i = 1; i < totalPages; i++) {\n              const param = getNextPageParam(infiniteQueryOptions, result.data as InfiniteData<unknown, unknown>, arg.originalArgs);\n              result = await fetchPage(result.data as InfiniteData<unknown, unknown>, param, maxPages);\n            }\n          }\n        }\n        finalQueryReturnValue = result;\n      } else {\n        // Non-infinite endpoint. Just run the one request.\n        finalQueryReturnValue = await executeRequest(arg.originalArgs);\n      }\n      if (metaSchema && !shouldSkip(skipSchemaValidation, 'meta') && finalQueryReturnValue.meta) {\n        finalQueryReturnValue.meta = await parseWithSchema(metaSchema, finalQueryReturnValue.meta, 'metaSchema', finalQueryReturnValue.meta);\n      }\n\n      // console.log('Final result: ', transformedData)\n      return fulfillWithValue(finalQueryReturnValue.data, addShouldAutoBatch({\n        fulfilledTimeStamp: Date.now(),\n        baseQueryMeta: finalQueryReturnValue.meta\n      }));\n    } catch (error) {\n      let caughtError = error;\n      if (caughtError instanceof HandledError) {\n        let transformErrorResponse = getTransformCallbackForEndpoint(endpointDefinition, 'transformErrorResponse');\n        const {\n          rawErrorResponseSchema,\n          errorResponseSchema\n        } = endpointDefinition;\n        let {\n          value,\n          meta\n        } = caughtError;\n        try {\n          if (rawErrorResponseSchema && !shouldSkip(skipSchemaValidation, 'rawErrorResponse')) {\n            value = await parseWithSchema(rawErrorResponseSchema, value, 'rawErrorResponseSchema', meta);\n          }\n          if (metaSchema && !shouldSkip(skipSchemaValidation, 'meta')) {\n            meta = await parseWithSchema(metaSchema, meta, 'metaSchema', meta);\n          }\n          let transformedErrorResponse = await transformErrorResponse(value, meta, arg.originalArgs);\n          if (errorResponseSchema && !shouldSkip(skipSchemaValidation, 'errorResponse')) {\n            transformedErrorResponse = await parseWithSchema(errorResponseSchema, transformedErrorResponse, 'errorResponseSchema', meta);\n          }\n          return rejectWithValue(transformedErrorResponse, addShouldAutoBatch({\n            baseQueryMeta: meta\n          }));\n        } catch (e) {\n          caughtError = e;\n        }\n      }\n      try {\n        if (caughtError instanceof NamedSchemaError) {\n          const info: SchemaFailureInfo = {\n            endpoint: arg.endpointName,\n            arg: arg.originalArgs,\n            type: arg.type,\n            queryCacheKey: isQuery ? arg.queryCacheKey : undefined\n          };\n          endpointDefinition.onSchemaFailure?.(caughtError, info);\n          onSchemaFailure?.(caughtError, info);\n          const {\n            catchSchemaFailure = globalCatchSchemaFailure\n          } = endpointDefinition;\n          if (catchSchemaFailure) {\n            return rejectWithValue(catchSchemaFailure(caughtError, info), addShouldAutoBatch({\n              baseQueryMeta: caughtError._bqMeta\n            }));\n          }\n        }\n      } catch (e) {\n        caughtError = e;\n      }\n      if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production') {\n        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\".`, caughtError);\n      } else {\n        console.error(caughtError);\n      }\n      throw caughtError;\n    }\n  };\n  function isForcedQuery(arg: QueryThunkArg, state: RootState<any, string, ReducerPath>) {\n    const requestState = selectors.selectQueryEntry(state, arg.queryCacheKey);\n    const baseFetchOnMountOrArgChange = selectors.selectConfig(state).refetchOnMountOrArgChange;\n    const fulfilledVal = requestState?.fulfilledTimeStamp;\n    const refetchVal = arg.forceRefetch ?? (arg.subscribe && baseFetchOnMountOrArgChange);\n    if (refetchVal) {\n      // Return if it's true or compare the dates because it must be a number\n      return refetchVal === true || (Number(new Date()) - Number(fulfilledVal)) / 1000 >= refetchVal;\n    }\n    return false;\n  }\n  const createQueryThunk = <ThunkArgType extends QueryThunkArg | InfiniteQueryThunkArg<any>,>() => {\n    const generatedQueryThunk = createAsyncThunk<ThunkResult, ThunkArgType, ThunkApiMetaConfig & {\n      state: RootState<any, string, ReducerPath>;\n    }>(`${reducerPath}/executeQuery`, executeEndpoint, {\n      getPendingMeta({\n        arg\n      }) {\n        const endpointDefinition = endpointDefinitions[arg.endpointName];\n        return addShouldAutoBatch({\n          startedTimeStamp: Date.now(),\n          ...(isInfiniteQueryDefinition(endpointDefinition) ? {\n            direction: (arg as InfiniteQueryThunkArg<any>).direction\n          } : {})\n        });\n      },\n      condition(queryThunkArg, {\n        getState\n      }) {\n        const state = getState();\n        const requestState = selectors.selectQueryEntry(state, queryThunkArg.queryCacheKey);\n        const fulfilledVal = requestState?.fulfilledTimeStamp;\n        const currentArg = queryThunkArg.originalArgs;\n        const previousArg = requestState?.originalArgs;\n        const endpointDefinition = endpointDefinitions[queryThunkArg.endpointName];\n        const direction = (queryThunkArg as InfiniteQueryThunkArg<any>).direction;\n\n        // Order of these checks matters.\n        // In order for `upsertQueryData` to successfully run while an existing request is in flight,\n        /// we have to check for that first, otherwise `queryThunk` will bail out and not run at all.\n        if (isUpsertQuery(queryThunkArg)) {\n          return true;\n        }\n\n        // Don't retry a request that's currently in-flight\n        if (requestState?.status === 'pending') {\n          return false;\n        }\n\n        // if this is forced, continue\n        if (isForcedQuery(queryThunkArg, state)) {\n          return true;\n        }\n        if (isQueryDefinition(endpointDefinition) && endpointDefinition?.forceRefetch?.({\n          currentArg,\n          previousArg,\n          endpointState: requestState,\n          state\n        })) {\n          return true;\n        }\n\n        // Pull from the cache unless we explicitly force refetch or qualify based on time\n        if (fulfilledVal && !direction) {\n          // Value is cached and we didn't specify to refresh, skip it.\n          return false;\n        }\n        return true;\n      },\n      dispatchConditionRejection: true\n    });\n    return generatedQueryThunk;\n  };\n  const queryThunk = createQueryThunk<QueryThunkArg>();\n  const infiniteQueryThunk = createQueryThunk<InfiniteQueryThunkArg<any>>();\n  const mutationThunk = createAsyncThunk<ThunkResult, MutationThunkArg, ThunkApiMetaConfig & {\n    state: RootState<any, string, ReducerPath>;\n  }>(`${reducerPath}/executeMutation`, executeEndpoint, {\n    getPendingMeta() {\n      return addShouldAutoBatch({\n        startedTimeStamp: Date.now()\n      });\n    }\n  });\n  const hasTheForce = (options: any): options is {\n    force: boolean;\n  } => 'force' in options;\n  const hasMaxAge = (options: any): options is {\n    ifOlderThan: false | number;\n  } => 'ifOlderThan' in options;\n  const prefetch = <EndpointName extends QueryKeys<Definitions>,>(endpointName: EndpointName, arg: any, options: PrefetchOptions = {}): ThunkAction<void, any, any, UnknownAction> => (dispatch: ThunkDispatch<any, any, any>, getState: () => any) => {\n    const force = hasTheForce(options) && options.force;\n    const maxAge = hasMaxAge(options) && options.ifOlderThan;\n    const queryAction = (force: boolean = true) => {\n      const options: StartQueryActionCreatorOptions = {\n        forceRefetch: force,\n        subscribe: false\n      };\n      return (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).initiate(arg, options);\n    };\n    const latestStateValue = (api.endpoints[endpointName] as ApiEndpointQuery<any, any>).select(arg)(getState());\n    if (force) {\n      dispatch(queryAction());\n    } else if (maxAge) {\n      const lastFulfilledTs = latestStateValue?.fulfilledTimeStamp;\n      if (!lastFulfilledTs) {\n        dispatch(queryAction());\n        return;\n      }\n      const shouldRetrigger = (Number(new Date()) - Number(new Date(lastFulfilledTs))) / 1000 >= maxAge;\n      if (shouldRetrigger) {\n        dispatch(queryAction());\n      }\n    } else {\n      // If prefetching with no options, just let it try\n      dispatch(queryAction(false));\n    }\n  };\n  function matchesEndpoint(endpointName: string) {\n    return (action: any): action is UnknownAction => action?.meta?.arg?.endpointName === endpointName;\n  }\n  function buildMatchThunkActions<Thunk extends AsyncThunk<any, QueryThunkArg, ThunkApiMetaConfig> | AsyncThunk<any, MutationThunkArg, ThunkApiMetaConfig>>(thunk: Thunk, endpointName: string) {\n    return {\n      matchPending: isAllOf(isPending(thunk), matchesEndpoint(endpointName)),\n      matchFulfilled: isAllOf(isFulfilled(thunk), matchesEndpoint(endpointName)),\n      matchRejected: isAllOf(isRejected(thunk), matchesEndpoint(endpointName))\n    } as Matchers<Thunk, any>;\n  }\n  return {\n    queryThunk,\n    mutationThunk,\n    infiniteQueryThunk,\n    prefetch,\n    updateQueryData,\n    upsertQueryData,\n    patchQueryData,\n    buildMatchThunkActions\n  };\n}\nexport function getNextPageParam(options: InfiniteQueryConfigOptions<unknown, unknown, unknown>, {\n  pages,\n  pageParams\n}: InfiniteData<unknown, unknown>, queryArg: unknown): unknown | undefined {\n  const lastIndex = pages.length - 1;\n  return options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams, queryArg);\n}\nexport function getPreviousPageParam(options: InfiniteQueryConfigOptions<unknown, unknown, unknown>, {\n  pages,\n  pageParams\n}: InfiniteData<unknown, unknown>, queryArg: unknown): unknown | undefined {\n  return options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams, queryArg);\n}\nexport function calculateProvidedByThunk(action: UnwrapPromise<ReturnType<ReturnType<QueryThunk>> | ReturnType<ReturnType<MutationThunk>> | ReturnType<ReturnType<InfiniteQueryThunk<any>>>>, type: 'providesTags' | 'invalidatesTags', endpointDefinitions: EndpointDefinitions, assertTagType: AssertTagTypes) {\n  return calculateProvidedBy(endpointDefinitions[action.meta.arg.endpointName][type] as ResultDescription<any, any, any, any, any>, isFulfilled(action) ? action.payload : undefined, isRejectedWithValue(action) ? action.payload : undefined, action.meta.arg.originalArgs, 'baseQueryMeta' in action.meta ? action.meta.baseQueryMeta : undefined, assertTagType);\n}","import type { Draft } from 'immer';\nimport { current, isDraft } from '../utils/immerImports';\nexport function getCurrent<T>(value: T | Draft<T>): T {\n  return (isDraft(value) ? current(value) : value) as T;\n}","import type { PayloadAction } from '@reduxjs/toolkit';\nimport { combineReducers, createAction, createSlice, isAnyOf, isFulfilled, isRejectedWithValue, createNextState, prepareAutoBatched, SHOULD_AUTOBATCH, nanoid } from './rtkImports';\nimport type { QuerySubstateIdentifier, QuerySubState, MutationSubstateIdentifier, MutationSubState, MutationState, QueryState, InvalidationState, Subscribers, QueryCacheKey, SubscriptionState, ConfigState, InfiniteQuerySubState, InfiniteQueryDirection } from './apiState';\nimport { STATUS_FULFILLED, STATUS_PENDING, QueryStatus, STATUS_REJECTED, STATUS_UNINITIALIZED } from './apiState';\nimport type { AllQueryKeys, QueryArgFromAnyQueryDefinition, DataFromAnyQueryDefinition, InfiniteQueryThunk, MutationThunk, QueryThunk, QueryThunkArg } from './buildThunks';\nimport { calculateProvidedByThunk } from './buildThunks';\nimport { ENDPOINT_QUERY, isInfiniteQueryDefinition, type AssertTagTypes, type EndpointDefinitions, type FullTagDescription, type QueryDefinition } from '../endpointDefinitions';\nimport type { Patch } from 'immer';\nimport { applyPatches, original, isDraft } from '../utils/immerImports';\nimport { onFocus, onFocusLost, onOffline, onOnline } from './setupListeners';\nimport { isDocumentVisible, isOnline, copyWithStructuralSharing } from '../utils';\nimport type { ApiContext } from '../apiTypes';\nimport { isUpsertQuery } from './buildInitiate';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { UnwrapPromise } from '../tsHelpers';\nimport { getCurrent } from '../utils/getCurrent';\n\n/**\n * A typesafe single entry to be upserted into the cache\n */\nexport type NormalizedQueryUpsertEntry<Definitions extends EndpointDefinitions, EndpointName extends AllQueryKeys<Definitions>> = {\n  endpointName: EndpointName;\n  arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>;\n  value: DataFromAnyQueryDefinition<Definitions, EndpointName>;\n};\n\n/**\n * The internal version that is not typesafe since we can't carry the generics through `createSlice`\n */\ntype NormalizedQueryUpsertEntryPayload = {\n  endpointName: string;\n  arg: unknown;\n  value: unknown;\n};\nexport type ProcessedQueryUpsertEntry = {\n  queryDescription: QueryThunkArg;\n  value: unknown;\n};\n\n/**\n * A typesafe representation of a util action creator that accepts cache entry descriptions to upsert\n */\nexport type UpsertEntries<Definitions extends EndpointDefinitions> = (<EndpointNames extends Array<AllQueryKeys<Definitions>>>(entries: [...{ [I in keyof EndpointNames]: NormalizedQueryUpsertEntry<Definitions, EndpointNames[I]> }]) => PayloadAction<NormalizedQueryUpsertEntryPayload[]>) & {\n  match: (action: unknown) => action is PayloadAction<NormalizedQueryUpsertEntryPayload[]>;\n};\nfunction updateQuerySubstateIfExists(state: QueryState<any>, queryCacheKey: QueryCacheKey, update: (substate: QuerySubState<any> | InfiniteQuerySubState<any>) => void) {\n  const substate = state[queryCacheKey];\n  if (substate) {\n    update(substate);\n  }\n}\nexport function getMutationCacheKey(id: MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}): string;\nexport function getMutationCacheKey(id: {\n  fixedCacheKey?: string;\n  requestId?: string;\n}): string | undefined;\nexport function getMutationCacheKey(id: {\n  fixedCacheKey?: string;\n  requestId?: string;\n} | MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}): string | undefined {\n  return ('arg' in id ? id.arg.fixedCacheKey : id.fixedCacheKey) ?? id.requestId;\n}\nfunction updateMutationSubstateIfExists(state: MutationState<any>, id: MutationSubstateIdentifier | {\n  requestId: string;\n  arg: {\n    fixedCacheKey?: string | undefined;\n  };\n}, update: (substate: MutationSubState<any>) => void) {\n  const substate = state[getMutationCacheKey(id)];\n  if (substate) {\n    update(substate);\n  }\n}\nconst initialState = {} as any;\nexport function buildSlice({\n  reducerPath,\n  queryThunk,\n  mutationThunk,\n  serializeQueryArgs,\n  context: {\n    endpointDefinitions: definitions,\n    apiUid,\n    extractRehydrationInfo,\n    hasRehydrationInfo\n  },\n  assertTagType,\n  config\n}: {\n  reducerPath: string;\n  queryThunk: QueryThunk;\n  infiniteQueryThunk: InfiniteQueryThunk<any>;\n  mutationThunk: MutationThunk;\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  context: ApiContext<EndpointDefinitions>;\n  assertTagType: AssertTagTypes;\n  config: Omit<ConfigState<string>, 'online' | 'focused' | 'middlewareRegistered'>;\n}) {\n  const resetApiState = createAction(`${reducerPath}/resetApiState`);\n  function writePendingCacheEntry(draft: QueryState<any>, arg: QueryThunkArg, upserting: boolean, meta: {\n    arg: QueryThunkArg;\n    requestId: string;\n    // requestStatus: 'pending'\n  } & {\n    startedTimeStamp: number;\n  }) {\n    draft[arg.queryCacheKey] ??= {\n      status: STATUS_UNINITIALIZED,\n      endpointName: arg.endpointName\n    };\n    updateQuerySubstateIfExists(draft, arg.queryCacheKey, substate => {\n      substate.status = STATUS_PENDING;\n      substate.requestId = upserting && substate.requestId ?\n      // for `upsertQuery` **updates**, keep the current `requestId`\n      substate.requestId :\n      // for normal queries or `upsertQuery` **inserts** always update the `requestId`\n      meta.requestId;\n      if (arg.originalArgs !== undefined) {\n        substate.originalArgs = arg.originalArgs;\n      }\n      substate.startedTimeStamp = meta.startedTimeStamp;\n      const endpointDefinition = definitions[meta.arg.endpointName];\n      if (isInfiniteQueryDefinition(endpointDefinition) && 'direction' in arg) {\n        ;\n        (substate as InfiniteQuerySubState<any>).direction = arg.direction as InfiniteQueryDirection;\n      }\n    });\n  }\n  function writeFulfilledCacheEntry(draft: QueryState<any>, meta: {\n    arg: QueryThunkArg;\n    requestId: string;\n  } & {\n    fulfilledTimeStamp: number;\n    baseQueryMeta: unknown;\n  }, payload: unknown, upserting: boolean) {\n    updateQuerySubstateIfExists(draft, meta.arg.queryCacheKey, substate => {\n      if (substate.requestId !== meta.requestId && !upserting) return;\n      const {\n        merge\n      } = definitions[meta.arg.endpointName] as QueryDefinition<any, any, any, any>;\n      substate.status = STATUS_FULFILLED;\n      if (merge) {\n        if (substate.data !== undefined) {\n          const {\n            fulfilledTimeStamp,\n            arg,\n            baseQueryMeta,\n            requestId\n          } = meta;\n          // There's existing cache data. Let the user merge it in themselves.\n          // We're already inside an Immer-powered reducer, and the user could just mutate `substate.data`\n          // themselves inside of `merge()`. But, they might also want to return a new value.\n          // Try to let Immer figure that part out, save the result, and assign it to `substate.data`.\n          let newData = createNextState(substate.data, draftSubstateData => {\n            // As usual with Immer, you can mutate _or_ return inside here, but not both\n            return merge(draftSubstateData, payload, {\n              arg: arg.originalArgs,\n              baseQueryMeta,\n              fulfilledTimeStamp,\n              requestId\n            });\n          });\n          substate.data = newData;\n        } else {\n          // Presumably a fresh request. Just cache the response data.\n          substate.data = payload;\n        }\n      } else {\n        // Assign or safely update the cache data.\n        substate.data = definitions[meta.arg.endpointName].structuralSharing ?? true ? copyWithStructuralSharing(isDraft(substate.data) ? original(substate.data) : substate.data, payload) : payload;\n      }\n      delete substate.error;\n      substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;\n    });\n  }\n  const querySlice = createSlice({\n    name: `${reducerPath}/queries`,\n    initialState: initialState as QueryState<any>,\n    reducers: {\n      removeQueryResult: {\n        reducer(draft, {\n          payload: {\n            queryCacheKey\n          }\n        }: PayloadAction<QuerySubstateIdentifier>) {\n          delete draft[queryCacheKey];\n        },\n        prepare: prepareAutoBatched<QuerySubstateIdentifier>()\n      },\n      cacheEntriesUpserted: {\n        reducer(draft, action: PayloadAction<ProcessedQueryUpsertEntry[], string, {\n          RTK_autoBatch: boolean;\n          requestId: string;\n          timestamp: number;\n        }>) {\n          for (const entry of action.payload) {\n            const {\n              queryDescription: arg,\n              value\n            } = entry;\n            writePendingCacheEntry(draft, arg, true, {\n              arg,\n              requestId: action.meta.requestId,\n              startedTimeStamp: action.meta.timestamp\n            });\n            writeFulfilledCacheEntry(draft, {\n              arg,\n              requestId: action.meta.requestId,\n              fulfilledTimeStamp: action.meta.timestamp,\n              baseQueryMeta: {}\n            }, value,\n            // We know we're upserting here\n            true);\n          }\n        },\n        prepare: (payload: NormalizedQueryUpsertEntryPayload[]) => {\n          const queryDescriptions: ProcessedQueryUpsertEntry[] = payload.map(entry => {\n            const {\n              endpointName,\n              arg,\n              value\n            } = entry;\n            const endpointDefinition = definitions[endpointName];\n            const queryDescription: QueryThunkArg = {\n              type: ENDPOINT_QUERY as 'query',\n              endpointName,\n              originalArgs: entry.arg,\n              queryCacheKey: serializeQueryArgs({\n                queryArgs: arg,\n                endpointDefinition,\n                endpointName\n              })\n            };\n            return {\n              queryDescription,\n              value\n            };\n          });\n          const result = {\n            payload: queryDescriptions,\n            meta: {\n              [SHOULD_AUTOBATCH]: true,\n              requestId: nanoid(),\n              timestamp: Date.now()\n            }\n          };\n          return result;\n        }\n      },\n      queryResultPatched: {\n        reducer(draft, {\n          payload: {\n            queryCacheKey,\n            patches\n          }\n        }: PayloadAction<QuerySubstateIdentifier & {\n          patches: readonly Patch[];\n        }>) {\n          updateQuerySubstateIfExists(draft, queryCacheKey, substate => {\n            substate.data = applyPatches(substate.data as any, patches.concat());\n          });\n        },\n        prepare: prepareAutoBatched<QuerySubstateIdentifier & {\n          patches: readonly Patch[];\n        }>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(queryThunk.pending, (draft, {\n        meta,\n        meta: {\n          arg\n        }\n      }) => {\n        const upserting = isUpsertQuery(arg);\n        writePendingCacheEntry(draft, arg, upserting, meta);\n      }).addCase(queryThunk.fulfilled, (draft, {\n        meta,\n        payload\n      }) => {\n        const upserting = isUpsertQuery(meta.arg);\n        writeFulfilledCacheEntry(draft, meta, payload, upserting);\n      }).addCase(queryThunk.rejected, (draft, {\n        meta: {\n          condition,\n          arg,\n          requestId\n        },\n        error,\n        payload\n      }) => {\n        updateQuerySubstateIfExists(draft, arg.queryCacheKey, substate => {\n          if (condition) {\n            // request was aborted due to condition (another query already running)\n          } else {\n            // request failed\n            if (substate.requestId !== requestId) return;\n            substate.status = STATUS_REJECTED;\n            substate.error = (payload ?? error) as any;\n          }\n        });\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          queries\n        } = extractRehydrationInfo(action)!;\n        for (const [key, entry] of Object.entries(queries)) {\n          if (\n          // do not rehydrate entries that were currently in flight.\n          entry?.status === STATUS_FULFILLED || entry?.status === STATUS_REJECTED) {\n            draft[key] = entry;\n          }\n        }\n      });\n    }\n  });\n  const mutationSlice = createSlice({\n    name: `${reducerPath}/mutations`,\n    initialState: initialState as MutationState<any>,\n    reducers: {\n      removeMutationResult: {\n        reducer(draft, {\n          payload\n        }: PayloadAction<MutationSubstateIdentifier>) {\n          const cacheKey = getMutationCacheKey(payload);\n          if (cacheKey in draft) {\n            delete draft[cacheKey];\n          }\n        },\n        prepare: prepareAutoBatched<MutationSubstateIdentifier>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(mutationThunk.pending, (draft, {\n        meta,\n        meta: {\n          requestId,\n          arg,\n          startedTimeStamp\n        }\n      }) => {\n        if (!arg.track) return;\n        draft[getMutationCacheKey(meta)] = {\n          requestId,\n          status: STATUS_PENDING,\n          endpointName: arg.endpointName,\n          startedTimeStamp\n        };\n      }).addCase(mutationThunk.fulfilled, (draft, {\n        payload,\n        meta\n      }) => {\n        if (!meta.arg.track) return;\n        updateMutationSubstateIfExists(draft, meta, substate => {\n          if (substate.requestId !== meta.requestId) return;\n          substate.status = STATUS_FULFILLED;\n          substate.data = payload;\n          substate.fulfilledTimeStamp = meta.fulfilledTimeStamp;\n        });\n      }).addCase(mutationThunk.rejected, (draft, {\n        payload,\n        error,\n        meta\n      }) => {\n        if (!meta.arg.track) return;\n        updateMutationSubstateIfExists(draft, meta, substate => {\n          if (substate.requestId !== meta.requestId) return;\n          substate.status = STATUS_REJECTED;\n          substate.error = (payload ?? error) as any;\n        });\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          mutations\n        } = extractRehydrationInfo(action)!;\n        for (const [key, entry] of Object.entries(mutations)) {\n          if (\n          // do not rehydrate entries that were currently in flight.\n          (entry?.status === STATUS_FULFILLED || entry?.status === STATUS_REJECTED) &&\n          // only rehydrate endpoints that were persisted using a `fixedCacheKey`\n          key !== entry?.requestId) {\n            draft[key] = entry;\n          }\n        }\n      });\n    }\n  });\n  type CalculateProvidedByAction = UnwrapPromise<ReturnType<ReturnType<QueryThunk>> | ReturnType<ReturnType<InfiniteQueryThunk<any>>>>;\n  const initialInvalidationState: InvalidationState<string> = {\n    tags: {},\n    keys: {}\n  };\n  const invalidationSlice = createSlice({\n    name: `${reducerPath}/invalidation`,\n    initialState: initialInvalidationState,\n    reducers: {\n      updateProvidedBy: {\n        reducer(draft, action: PayloadAction<Array<{\n          queryCacheKey: QueryCacheKey;\n          providedTags: readonly FullTagDescription<string>[];\n        }>>) {\n          for (const {\n            queryCacheKey,\n            providedTags\n          } of action.payload) {\n            removeCacheKeyFromTags(draft, queryCacheKey);\n            for (const {\n              type,\n              id\n            } of providedTags) {\n              const subscribedQueries = (draft.tags[type] ??= {})[id || '__internal_without_id'] ??= [];\n              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);\n              if (!alreadySubscribed) {\n                subscribedQueries.push(queryCacheKey);\n              }\n            }\n\n            // Remove readonly from the providedTags array\n            draft.keys[queryCacheKey] = providedTags as FullTagDescription<string>[];\n          }\n        },\n        prepare: prepareAutoBatched<Array<{\n          queryCacheKey: QueryCacheKey;\n          providedTags: readonly FullTagDescription<string>[];\n        }>>()\n      }\n    },\n    extraReducers(builder) {\n      builder.addCase(querySlice.actions.removeQueryResult, (draft, {\n        payload: {\n          queryCacheKey\n        }\n      }) => {\n        removeCacheKeyFromTags(draft, queryCacheKey);\n      }).addMatcher(hasRehydrationInfo, (draft, action) => {\n        const {\n          provided\n        } = extractRehydrationInfo(action)!;\n        for (const [type, incomingTags] of Object.entries(provided.tags ?? {})) {\n          for (const [id, cacheKeys] of Object.entries(incomingTags)) {\n            const subscribedQueries = (draft.tags[type] ??= {})[id || '__internal_without_id'] ??= [];\n            for (const queryCacheKey of cacheKeys) {\n              const alreadySubscribed = subscribedQueries.includes(queryCacheKey);\n              if (!alreadySubscribed) {\n                subscribedQueries.push(queryCacheKey);\n              }\n              draft.keys[queryCacheKey] = provided.keys[queryCacheKey];\n            }\n          }\n        }\n      }).addMatcher(isAnyOf(isFulfilled(queryThunk), isRejectedWithValue(queryThunk)), (draft, action) => {\n        writeProvidedTagsForQueries(draft, [action]);\n      }).addMatcher(querySlice.actions.cacheEntriesUpserted.match, (draft, action) => {\n        const mockActions: CalculateProvidedByAction[] = action.payload.map(({\n          queryDescription,\n          value\n        }) => {\n          return {\n            type: 'UNKNOWN',\n            payload: value,\n            meta: {\n              requestStatus: 'fulfilled',\n              requestId: 'UNKNOWN',\n              arg: queryDescription\n            }\n          };\n        });\n        writeProvidedTagsForQueries(draft, mockActions);\n      });\n    }\n  });\n  function removeCacheKeyFromTags(draft: InvalidationState<any>, queryCacheKey: QueryCacheKey) {\n    const existingTags = getCurrent(draft.keys[queryCacheKey] ?? []);\n\n    // Delete this cache key from any existing tags that may have provided it\n    for (const tag of existingTags) {\n      const tagType = tag.type;\n      const tagId = tag.id ?? '__internal_without_id';\n      const tagSubscriptions = draft.tags[tagType]?.[tagId];\n      if (tagSubscriptions) {\n        draft.tags[tagType][tagId] = getCurrent(tagSubscriptions).filter(qc => qc !== queryCacheKey);\n      }\n    }\n    delete draft.keys[queryCacheKey];\n  }\n  function writeProvidedTagsForQueries(draft: InvalidationState<string>, actions: CalculateProvidedByAction[]) {\n    const providedByEntries = actions.map(action => {\n      const providedTags = calculateProvidedByThunk(action, 'providesTags', definitions, assertTagType);\n      const {\n        queryCacheKey\n      } = action.meta.arg;\n      return {\n        queryCacheKey,\n        providedTags\n      };\n    });\n    invalidationSlice.caseReducers.updateProvidedBy(draft, invalidationSlice.actions.updateProvidedBy(providedByEntries));\n  }\n\n  // Dummy slice to generate actions\n  const subscriptionSlice = createSlice({\n    name: `${reducerPath}/subscriptions`,\n    initialState: initialState as SubscriptionState,\n    reducers: {\n      updateSubscriptionOptions(d, a: PayloadAction<{\n        endpointName: string;\n        requestId: string;\n        options: Subscribers[number];\n      } & QuerySubstateIdentifier>) {\n        // Dummy\n      },\n      unsubscribeQueryResult(d, a: PayloadAction<{\n        requestId: string;\n      } & QuerySubstateIdentifier>) {\n        // Dummy\n      },\n      internal_getRTKQSubscriptions() {}\n    }\n  });\n  const internalSubscriptionsSlice = createSlice({\n    name: `${reducerPath}/internalSubscriptions`,\n    initialState: initialState as SubscriptionState,\n    reducers: {\n      subscriptionsUpdated: {\n        reducer(state, action: PayloadAction<Patch[]>) {\n          return applyPatches(state, action.payload);\n        },\n        prepare: prepareAutoBatched<Patch[]>()\n      }\n    }\n  });\n  const configSlice = createSlice({\n    name: `${reducerPath}/config`,\n    initialState: {\n      online: isOnline(),\n      focused: isDocumentVisible(),\n      middlewareRegistered: false,\n      ...config\n    } as ConfigState<string>,\n    reducers: {\n      middlewareRegistered(state, {\n        payload\n      }: PayloadAction<string>) {\n        state.middlewareRegistered = state.middlewareRegistered === 'conflict' || apiUid !== payload ? 'conflict' : true;\n      }\n    },\n    extraReducers: builder => {\n      builder.addCase(onOnline, state => {\n        state.online = true;\n      }).addCase(onOffline, state => {\n        state.online = false;\n      }).addCase(onFocus, state => {\n        state.focused = true;\n      }).addCase(onFocusLost, state => {\n        state.focused = false;\n      })\n      // update the state to be a new object to be picked up as a \"state change\"\n      // by redux-persist's `autoMergeLevel2`\n      .addMatcher(hasRehydrationInfo, draft => ({\n        ...draft\n      }));\n    }\n  });\n  const combinedReducer = combineReducers({\n    queries: querySlice.reducer,\n    mutations: mutationSlice.reducer,\n    provided: invalidationSlice.reducer,\n    subscriptions: internalSubscriptionsSlice.reducer,\n    config: configSlice.reducer\n  });\n  const reducer: typeof combinedReducer = (state, action) => combinedReducer(resetApiState.match(action) ? undefined : state, action);\n  const actions = {\n    ...configSlice.actions,\n    ...querySlice.actions,\n    ...subscriptionSlice.actions,\n    ...internalSubscriptionsSlice.actions,\n    ...mutationSlice.actions,\n    ...invalidationSlice.actions,\n    resetApiState\n  };\n  return {\n    reducer,\n    actions\n  };\n}\nexport type SliceActions = ReturnType<typeof buildSlice>['actions'];","import type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { EndpointDefinition, EndpointDefinitions, InfiniteQueryArgFrom, InfiniteQueryDefinition, MutationDefinition, QueryArgFrom, QueryArgFromAnyQuery, QueryDefinition, ReducerPathFrom, TagDescription, TagTypesFrom } from '../endpointDefinitions';\nimport { expandTagDescription } from '../endpointDefinitions';\nimport { filterMap, isNotNullish } from '../utils';\nimport type { InfiniteData, InfiniteQueryConfigOptions, InfiniteQuerySubState, MutationSubState, QueryCacheKey, QueryState, QuerySubState, RequestStatusFlags, RootState as _RootState, QueryStatus } from './apiState';\nimport { STATUS_UNINITIALIZED, getRequestStatusFlags } from './apiState';\nimport { getMutationCacheKey } from './buildSlice';\nimport type { createSelector as _createSelector } from './rtkImports';\nimport { createNextState } from './rtkImports';\nimport { type AllQueryKeys, getNextPageParam, getPreviousPageParam } from './buildThunks';\nexport type SkipToken = typeof skipToken;\n/**\n * Can be passed into `useQuery`, `useQueryState` or `useQuerySubscription`\n * instead of the query argument to get the same effect as if setting\n * `skip: true` in the query options.\n *\n * Useful for scenarios where a query should be skipped when `arg` is `undefined`\n * and TypeScript complains about it because `arg` is not allowed to be passed\n * in as `undefined`, such as\n *\n * ```ts\n * // codeblock-meta title=\"will error if the query argument is not allowed to be undefined\" no-transpile\n * useSomeQuery(arg, { skip: !!arg })\n * ```\n *\n * ```ts\n * // codeblock-meta title=\"using skipToken instead\" no-transpile\n * useSomeQuery(arg ?? skipToken)\n * ```\n *\n * If passed directly into a query or mutation selector, that selector will always\n * return an uninitialized state.\n */\nexport const skipToken = /* @__PURE__ */Symbol.for('RTKQ/skipToken');\nexport type BuildSelectorsApiEndpointQuery<Definition extends QueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: QueryResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\nexport type BuildSelectorsApiEndpointInfiniteQuery<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: InfiniteQueryResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\nexport type BuildSelectorsApiEndpointMutation<Definition extends MutationDefinition<any, any, any, any, any>, Definitions extends EndpointDefinitions> = {\n  select: MutationResultSelectorFactory<Definition, _RootState<Definitions, TagTypesFrom<Definition>, ReducerPathFrom<Definition>>>;\n};\ntype QueryResultSelectorFactory<Definition extends QueryDefinition<any, any, any, any>, RootState> = (queryArg: QueryArgFrom<Definition> | SkipToken) => (state: RootState) => QueryResultSelectorResult<Definition>;\nexport type QueryResultSelectorResult<Definition extends QueryDefinition<any, any, any, any>> = QuerySubState<Definition> & RequestStatusFlags;\ntype InfiniteQueryResultSelectorFactory<Definition extends InfiniteQueryDefinition<any, any, any, any, any>, RootState> = (queryArg: InfiniteQueryArgFrom<Definition> | SkipToken) => (state: RootState) => InfiniteQueryResultSelectorResult<Definition>;\nexport type InfiniteQueryResultFlags = {\n  hasNextPage: boolean;\n  hasPreviousPage: boolean;\n  isFetchingNextPage: boolean;\n  isFetchingPreviousPage: boolean;\n  isFetchNextPageError: boolean;\n  isFetchPreviousPageError: boolean;\n};\nexport type InfiniteQueryResultSelectorResult<Definition extends InfiniteQueryDefinition<any, any, any, any, any>> = InfiniteQuerySubState<Definition> & RequestStatusFlags & InfiniteQueryResultFlags;\ntype MutationResultSelectorFactory<Definition extends MutationDefinition<any, any, any, any>, RootState> = (requestId: string | {\n  requestId: string | undefined;\n  fixedCacheKey: string | undefined;\n} | SkipToken) => (state: RootState) => MutationResultSelectorResult<Definition>;\nexport type MutationResultSelectorResult<Definition extends MutationDefinition<any, any, any, any>> = MutationSubState<Definition> & RequestStatusFlags;\nconst initialSubState: QuerySubState<any> = {\n  status: STATUS_UNINITIALIZED\n};\n\n// abuse immer to freeze default states\nconst defaultQuerySubState = /* @__PURE__ */createNextState(initialSubState, () => {});\nconst defaultMutationSubState = /* @__PURE__ */createNextState(initialSubState as MutationSubState<any>, () => {});\nexport type AllSelectors = ReturnType<typeof buildSelectors>;\nexport function buildSelectors<Definitions extends EndpointDefinitions, ReducerPath extends string>({\n  serializeQueryArgs,\n  reducerPath,\n  createSelector\n}: {\n  serializeQueryArgs: InternalSerializeQueryArgs;\n  reducerPath: ReducerPath;\n  createSelector: typeof _createSelector;\n}) {\n  type RootState = _RootState<Definitions, string, string>;\n  const selectSkippedQuery = (state: RootState) => defaultQuerySubState;\n  const selectSkippedMutation = (state: RootState) => defaultMutationSubState;\n  return {\n    buildQuerySelector,\n    buildInfiniteQuerySelector,\n    buildMutationSelector,\n    selectInvalidatedBy,\n    selectCachedArgsForQuery,\n    selectApiState,\n    selectQueries,\n    selectMutations,\n    selectQueryEntry,\n    selectConfig\n  };\n  function withRequestFlags<T extends {\n    status: QueryStatus;\n  }>(substate: T): T & RequestStatusFlags {\n    return {\n      ...substate,\n      ...getRequestStatusFlags(substate.status)\n    };\n  }\n  function selectApiState(rootState: RootState) {\n    const state = rootState[reducerPath];\n    if (process.env.NODE_ENV !== 'production') {\n      if (!state) {\n        if ((selectApiState as any).triggered) return state;\n        (selectApiState as any).triggered = true;\n        console.error(`Error: No data found at \\`state.${reducerPath}\\`. Did you forget to add the reducer to the store?`);\n      }\n    }\n    return state;\n  }\n  function selectQueries(rootState: RootState) {\n    return selectApiState(rootState)?.queries;\n  }\n  function selectQueryEntry(rootState: RootState, cacheKey: QueryCacheKey) {\n    return selectQueries(rootState)?.[cacheKey];\n  }\n  function selectMutations(rootState: RootState) {\n    return selectApiState(rootState)?.mutations;\n  }\n  function selectConfig(rootState: RootState) {\n    return selectApiState(rootState)?.config;\n  }\n  function buildAnyQuerySelector(endpointName: string, endpointDefinition: EndpointDefinition<any, any, any, any>, combiner: <T extends {\n    status: QueryStatus;\n  }>(substate: T) => T & RequestStatusFlags) {\n    return (queryArgs: any) => {\n      // Avoid calling serializeQueryArgs if the arg is skipToken\n      if (queryArgs === skipToken) {\n        return createSelector(selectSkippedQuery, combiner);\n      }\n      const serializedArgs = serializeQueryArgs({\n        queryArgs,\n        endpointDefinition,\n        endpointName\n      });\n      const selectQuerySubstate = (state: RootState) => selectQueryEntry(state, serializedArgs) ?? defaultQuerySubState;\n      return createSelector(selectQuerySubstate, combiner);\n    };\n  }\n  function buildQuerySelector(endpointName: string, endpointDefinition: QueryDefinition<any, any, any, any>) {\n    return buildAnyQuerySelector(endpointName, endpointDefinition, withRequestFlags) as QueryResultSelectorFactory<any, RootState>;\n  }\n  function buildInfiniteQuerySelector(endpointName: string, endpointDefinition: InfiniteQueryDefinition<any, any, any, any, any>) {\n    const {\n      infiniteQueryOptions\n    } = endpointDefinition;\n    function withInfiniteQueryResultFlags<T extends {\n      status: QueryStatus;\n    }>(substate: T): T & RequestStatusFlags & InfiniteQueryResultFlags {\n      const stateWithRequestFlags = {\n        ...(substate as InfiniteQuerySubState<any>),\n        ...getRequestStatusFlags(substate.status)\n      };\n      const {\n        isLoading,\n        isError,\n        direction\n      } = stateWithRequestFlags;\n      const isForward = direction === 'forward';\n      const isBackward = direction === 'backward';\n      return {\n        ...stateWithRequestFlags,\n        hasNextPage: getHasNextPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),\n        hasPreviousPage: getHasPreviousPage(infiniteQueryOptions, stateWithRequestFlags.data, stateWithRequestFlags.originalArgs),\n        isFetchingNextPage: isLoading && isForward,\n        isFetchingPreviousPage: isLoading && isBackward,\n        isFetchNextPageError: isError && isForward,\n        isFetchPreviousPageError: isError && isBackward\n      };\n    }\n    return buildAnyQuerySelector(endpointName, endpointDefinition, withInfiniteQueryResultFlags) as unknown as InfiniteQueryResultSelectorFactory<any, RootState>;\n  }\n  function buildMutationSelector() {\n    return (id => {\n      let mutationId: string | typeof skipToken;\n      if (typeof id === 'object') {\n        mutationId = getMutationCacheKey(id) ?? skipToken;\n      } else {\n        mutationId = id;\n      }\n      const selectMutationSubstate = (state: RootState) => selectApiState(state)?.mutations?.[mutationId as string] ?? defaultMutationSubState;\n      const finalSelectMutationSubstate = mutationId === skipToken ? selectSkippedMutation : selectMutationSubstate;\n      return createSelector(finalSelectMutationSubstate, withRequestFlags);\n    }) as MutationResultSelectorFactory<any, RootState>;\n  }\n  function selectInvalidatedBy(state: RootState, tags: ReadonlyArray<TagDescription<string> | null | undefined>): Array<{\n    endpointName: string;\n    originalArgs: any;\n    queryCacheKey: QueryCacheKey;\n  }> {\n    const apiState = state[reducerPath];\n    const toInvalidate = new Set<QueryCacheKey>();\n    const finalTags = filterMap(tags, isNotNullish, expandTagDescription);\n    for (const tag of finalTags) {\n      const provided = apiState.provided.tags[tag.type];\n      if (!provided) {\n        continue;\n      }\n      let invalidateSubscriptions = (tag.id !== undefined ?\n      // id given: invalidate all queries that provide this type & id\n      provided[tag.id] :\n      // no id: invalidate all queries that provide this type\n      Object.values(provided).flat()) ?? [];\n      for (const invalidate of invalidateSubscriptions) {\n        toInvalidate.add(invalidate);\n      }\n    }\n    return Array.from(toInvalidate.values()).flatMap(queryCacheKey => {\n      const querySubState = apiState.queries[queryCacheKey];\n      return querySubState ? {\n        queryCacheKey,\n        endpointName: querySubState.endpointName!,\n        originalArgs: querySubState.originalArgs\n      } : [];\n    });\n  }\n  function selectCachedArgsForQuery<QueryName extends AllQueryKeys<Definitions>>(state: RootState, queryName: QueryName): Array<QueryArgFromAnyQuery<Definitions[QueryName]>> {\n    return filterMap(Object.values(selectQueries(state) as QueryState<any>), (entry): entry is Exclude<QuerySubState<Definitions[QueryName]>, {\n      status: QueryStatus.uninitialized;\n    }> => entry?.endpointName === queryName && entry.status !== STATUS_UNINITIALIZED, entry => entry.originalArgs);\n  }\n  function getHasNextPage(options: InfiniteQueryConfigOptions<any, any, any>, data?: InfiniteData<unknown, unknown>, queryArg?: unknown): boolean {\n    if (!data) return false;\n    return getNextPageParam(options, data, queryArg) != null;\n  }\n  function getHasPreviousPage(options: InfiniteQueryConfigOptions<any, any, any>, data?: InfiniteData<unknown, unknown>, queryArg?: unknown): boolean {\n    if (!data || !options.getPreviousPageParam) return false;\n    return getPreviousPageParam(options, data, queryArg) != null;\n  }\n}","import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3 } from \"@reduxjs/toolkit\";\nimport { getEndpointDefinition, type Api, type ApiContext, type Module, type ModuleName } from './apiTypes';\nimport type { CombinedState } from './core/apiState';\nimport type { BaseQueryArg, BaseQueryFn } from './baseQueryTypes';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport { defaultSerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { EndpointBuilder, EndpointDefinitions, SchemaFailureConverter, SchemaFailureHandler, SchemaType } from './endpointDefinitions';\nimport { DefinitionType, ENDPOINT_INFINITEQUERY, ENDPOINT_MUTATION, ENDPOINT_QUERY, isInfiniteQueryDefinition, isQueryDefinition } from './endpointDefinitions';\nimport { nanoid } from './core/rtkImports';\nimport type { UnknownAction } from '@reduxjs/toolkit';\nimport type { NoInfer } from './tsHelpers';\nimport { weakMapMemoize } from 'reselect';\nexport interface CreateApiOptions<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string = 'api', TagTypes extends string = never> {\n  /**\n   * The base query used by each endpoint if no `queryFn` option is specified. RTK Query exports a utility called [fetchBaseQuery](./fetchBaseQuery) as a lightweight wrapper around `fetch` for common use-cases. See [Customizing Queries](../../rtk-query/usage/customizing-queries) if `fetchBaseQuery` does not handle your requirements.\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   *\n   * const api = createApi({\n   *   // highlight-start\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // ...endpoints\n   *   }),\n   * })\n   * ```\n   */\n  baseQuery: BaseQuery;\n  /**\n   * An array of string tag type names. Specifying tag types is optional, but you should define them so that they can be used for caching and invalidation. When defining a tag type, you will be able to [provide](../../rtk-query/usage/automated-refetching#providing-tags) them with `providesTags` and [invalidate](../../rtk-query/usage/automated-refetching#invalidating-tags) them with `invalidatesTags` when configuring [endpoints](#endpoints).\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-start\n   *   tagTypes: ['Post', 'User'],\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // ...endpoints\n   *   }),\n   * })\n   * ```\n   */\n  tagTypes?: readonly TagTypes[];\n  /**\n   * The `reducerPath` is a _unique_ key that your service will be mounted to in your store. If you call `createApi` more than once in your application, you will need to provide a unique value each time. Defaults to `'api'`.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"apis.js\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query';\n   *\n   * const apiOne = createApi({\n   *   // highlight-start\n   *   reducerPath: 'apiOne',\n   *   // highlight-end\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (builder) => ({\n   *     // ...endpoints\n   *   }),\n   * });\n   *\n   * const apiTwo = createApi({\n   *   // highlight-start\n   *   reducerPath: 'apiTwo',\n   *   // highlight-end\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (builder) => ({\n   *     // ...endpoints\n   *   }),\n   * });\n   * ```\n   */\n  reducerPath?: ReducerPath;\n  /**\n   * Accepts a custom function if you have a need to change the creation of cache keys for any reason.\n   */\n  serializeQueryArgs?: SerializeQueryArgs<unknown>;\n  /**\n   * Endpoints are a set of operations that you want to perform against your server. You define them as an object using the builder syntax. There are three endpoint types: [`query`](../../rtk-query/usage/queries), [`infiniteQuery`](../../rtk-query/usage/infinite-queries) and [`mutation`](../../rtk-query/usage/mutations).\n   */\n  endpoints(build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>): Definitions;\n  /**\n   * Defaults to `60` _(this value is in seconds)_. This is how long RTK Query will keep your data cached for **after** the last component unsubscribes. For example, if you query an endpoint, then unmount the component, then mount another component that makes the same request within the given time frame, the most recent value will be served from the cache.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta title=\"keepUnusedDataFor example\"\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * interface Post {\n   *   id: number\n   *   name: string\n   * }\n   * type PostsResponse = Post[]\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPosts: build.query<PostsResponse, void>({\n   *       query: () => 'posts'\n   *     })\n   *   }),\n   *   // highlight-start\n   *   keepUnusedDataFor: 5\n   *   // highlight-end\n   * })\n   * ```\n   */\n  keepUnusedDataFor?: number;\n  /**\n   * Defaults to `false`. This setting allows you to control whether if a cached result is already available RTK Query will only serve a cached result, or if it should `refetch` when set to `true` or if an adequate amount of time has passed since the last successful query result.\n   * - `false` - Will not cause a query to be performed _unless_ it does not exist yet.\n   * - `true` - Will always refetch when a new subscriber to a query is added. Behaves the same as calling the `refetch` callback or passing `forceRefetch: true` in the action creator.\n   * - `number` - **Value is in seconds**. If a number is provided and there is an existing query in the cache, it will compare the current time vs the last fulfilled timestamp, and only refetch if enough time has elapsed.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   */\n  refetchOnMountOrArgChange?: boolean | number;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after the application window regains focus.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnFocus?: boolean;\n  /**\n   * Defaults to `false`. This setting allows you to control whether RTK Query will try to refetch all subscribed queries after regaining a network connection.\n   *\n   * If you specify this option alongside `skip: true`, this **will not be evaluated** until `skip` is false.\n   *\n   * Note: requires [`setupListeners`](./setupListeners) to have been called.\n   */\n  refetchOnReconnect?: boolean;\n  /**\n   * Defaults to `'delayed'`. This setting allows you to control when tags are invalidated after a mutation.\n   *\n   * - `'immediately'`: Queries are invalidated instantly after the mutation finished, even if they are running.\n   *   If the query provides tags that were invalidated while it ran, it won't be re-fetched.\n   * - `'delayed'`: Invalidation only happens after all queries and mutations are settled.\n   *   This ensures that queries are always invalidated correctly and automatically \"batches\" invalidations of concurrent mutations.\n   *   Note that if you constantly have some queries (or mutations) running, this can delay tag invalidations indefinitely.\n   */\n  invalidationBehavior?: 'delayed' | 'immediately';\n  /**\n   * A function that is passed every dispatched action. If this returns something other than `undefined`,\n   * that return value will be used to rehydrate fulfilled & errored queries.\n   *\n   * @example\n   *\n   * ```ts\n   * // codeblock-meta title=\"next-redux-wrapper rehydration example\"\n   * import type { Action, PayloadAction } from '@reduxjs/toolkit'\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n   * import { HYDRATE } from 'next-redux-wrapper'\n   *\n   * type RootState = any; // normally inferred from state\n   *\n   * function isHydrateAction(action: Action): action is PayloadAction<RootState> {\n   *   return action.type === HYDRATE\n   * }\n   *\n   * export const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   // highlight-start\n   *   extractRehydrationInfo(action, { reducerPath }): any {\n   *     if (isHydrateAction(action)) {\n   *       return action.payload[reducerPath]\n   *     }\n   *   },\n   *   // highlight-end\n   *   endpoints: (build) => ({\n   *     // omitted\n   *   }),\n   * })\n   * ```\n   */\n  extractRehydrationInfo?: (action: UnknownAction, {\n    reducerPath\n  }: {\n    reducerPath: ReducerPath;\n  }) => undefined | CombinedState<NoInfer<Definitions>, NoInfer<TagTypes>, NoInfer<ReducerPath>>;\n\n  /**\n   * A function that is called when a schema validation fails.\n   *\n   * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n   *\n   * `NamedSchemaError` has the following properties:\n   * - `issues`: an array of issues that caused the validation to fail\n   * - `value`: the value that was passed to the schema\n   * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *     }),\n   *   }),\n   *   onSchemaFailure: (error, info) => {\n   *     console.error(error, info)\n   *   },\n   * })\n   * ```\n   */\n  onSchemaFailure?: SchemaFailureHandler;\n\n  /**\n   * Convert a schema validation failure into an error shape matching base query errors.\n   *\n   * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *     }),\n   *   }),\n   *   catchSchemaFailure: (error, info) => ({\n   *     status: \"CUSTOM_ERROR\",\n   *     error: error.schemaName + \" failed validation\",\n   *     data: error.issues,\n   *   }),\n   * })\n   * ```\n   */\n  catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n  /**\n   * Defaults to `false`.\n   *\n   * If set to `true`, will skip schema validation for all endpoints, unless overridden by the endpoint.\n   *\n   * Can be overridden for specific schemas by passing an array of schema types to skip.\n   *\n   * @example\n   * ```ts\n   * // codeblock-meta no-transpile\n   * import { createApi } from '@reduxjs/toolkit/query/react'\n   * import * as v from \"valibot\"\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n   *   skipSchemaValidation: process.env.NODE_ENV === \"test\" ? [\"response\"] : false, // skip schema validation for response in tests, since we'll be mocking the response\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, { id: number }>({\n   *       query: ({ id }) => `/post/${id}`,\n   *       responseSchema: v.object({ id: v.number(), name: v.string() }),\n   *     }),\n   *   })\n   * })\n   * ```\n   */\n  skipSchemaValidation?: boolean | SchemaType[];\n}\nexport type CreateApi<Modules extends ModuleName> = {\n  /**\n   * Creates a service to use in your application. Contains only the basic redux logic (the core module).\n   *\n   * @link https://redux-toolkit.js.org/rtk-query/api/createApi\n   */\n  <BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string = 'api', TagTypes extends string = never>(options: CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>): Api<BaseQuery, Definitions, ReducerPath, TagTypes, Modules>;\n};\n\n/**\n * Builds a `createApi` method based on the provided `modules`.\n *\n * @link https://redux-toolkit.js.org/rtk-query/usage/customizing-create-api\n *\n * @example\n * ```ts\n * const MyContext = React.createContext<ReactReduxContextValue | null>(null);\n * const customCreateApi = buildCreateApi(\n *   coreModule(),\n *   reactHooksModule({\n *     hooks: {\n *       useDispatch: createDispatchHook(MyContext),\n *       useSelector: createSelectorHook(MyContext),\n *       useStore: createStoreHook(MyContext)\n *     }\n *   })\n * );\n * ```\n *\n * @param modules - A variable number of modules that customize how the `createApi` method handles endpoints\n * @returns A `createApi` method using the provided `modules`.\n */\nexport function buildCreateApi<Modules extends [Module<any>, ...Module<any>[]]>(...modules: Modules): CreateApi<Modules[number]['name']> {\n  return function baseCreateApi(options) {\n    const extractRehydrationInfo = weakMapMemoize((action: UnknownAction) => options.extractRehydrationInfo?.(action, {\n      reducerPath: (options.reducerPath ?? 'api') as any\n    }));\n    const optionsWithDefaults: CreateApiOptions<any, any, any, any> = {\n      reducerPath: 'api',\n      keepUnusedDataFor: 60,\n      refetchOnMountOrArgChange: false,\n      refetchOnFocus: false,\n      refetchOnReconnect: false,\n      invalidationBehavior: 'delayed',\n      ...options,\n      extractRehydrationInfo,\n      serializeQueryArgs(queryArgsApi) {\n        let finalSerializeQueryArgs = defaultSerializeQueryArgs;\n        if ('serializeQueryArgs' in queryArgsApi.endpointDefinition) {\n          const endpointSQA = queryArgsApi.endpointDefinition.serializeQueryArgs!;\n          finalSerializeQueryArgs = queryArgsApi => {\n            const initialResult = endpointSQA(queryArgsApi);\n            if (typeof initialResult === 'string') {\n              // If the user function returned a string, use it as-is\n              return initialResult;\n            } else {\n              // Assume they returned an object (such as a subset of the original\n              // query args) or a primitive, and serialize it ourselves\n              return defaultSerializeQueryArgs({\n                ...queryArgsApi,\n                queryArgs: initialResult\n              });\n            }\n          };\n        } else if (options.serializeQueryArgs) {\n          finalSerializeQueryArgs = options.serializeQueryArgs;\n        }\n        return finalSerializeQueryArgs(queryArgsApi);\n      },\n      tagTypes: [...(options.tagTypes || [])]\n    };\n    const context: ApiContext<EndpointDefinitions> = {\n      endpointDefinitions: {},\n      batch(fn) {\n        // placeholder \"batch\" method to be overridden by plugins, for example with React.unstable_batchedUpdate\n        fn();\n      },\n      apiUid: nanoid(),\n      extractRehydrationInfo,\n      hasRehydrationInfo: weakMapMemoize(action => extractRehydrationInfo(action) != null)\n    };\n    const api = {\n      injectEndpoints,\n      enhanceEndpoints({\n        addTagTypes,\n        endpoints\n      }) {\n        if (addTagTypes) {\n          for (const eT of addTagTypes) {\n            if (!optionsWithDefaults.tagTypes!.includes(eT as any)) {\n              ;\n              (optionsWithDefaults.tagTypes as any[]).push(eT);\n            }\n          }\n        }\n        if (endpoints) {\n          for (const [endpointName, partialDefinition] of Object.entries(endpoints)) {\n            if (typeof partialDefinition === 'function') {\n              partialDefinition(getEndpointDefinition(context, endpointName));\n            } else {\n              Object.assign(getEndpointDefinition(context, endpointName) || {}, partialDefinition);\n            }\n          }\n        }\n        return api;\n      }\n    } as Api<BaseQueryFn, {}, string, string, Modules[number]['name']>;\n    const initializedModules = modules.map(m => m.init(api as any, optionsWithDefaults as any, context));\n    function injectEndpoints(inject: Parameters<typeof api.injectEndpoints>[0]) {\n      const evaluatedEndpoints = inject.endpoints({\n        query: x => ({\n          ...x,\n          type: ENDPOINT_QUERY\n        }) as any,\n        mutation: x => ({\n          ...x,\n          type: ENDPOINT_MUTATION\n        }) as any,\n        infiniteQuery: x => ({\n          ...x,\n          type: ENDPOINT_INFINITEQUERY\n        }) as any\n      });\n      for (const [endpointName, definition] of Object.entries(evaluatedEndpoints)) {\n        if (inject.overrideExisting !== true && endpointName in context.endpointDefinitions) {\n          if (inject.overrideExisting === 'throw') {\n            throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(39) : `called \\`injectEndpoints\\` to override already-existing endpointName ${endpointName} without specifying \\`overrideExisting: true\\``);\n          } else if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n            console.error(`called \\`injectEndpoints\\` to override already-existing endpointName ${endpointName} without specifying \\`overrideExisting: true\\``);\n          }\n          continue;\n        }\n        if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n          if (isInfiniteQueryDefinition(definition)) {\n            const {\n              infiniteQueryOptions\n            } = definition;\n            const {\n              maxPages,\n              getPreviousPageParam\n            } = infiniteQueryOptions;\n            if (typeof maxPages === 'number') {\n              if (maxPages < 1) {\n                throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(40) : `maxPages for endpoint '${endpointName}' must be a number greater than 0`);\n              }\n              if (typeof getPreviousPageParam !== 'function') {\n                throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(41) : `getPreviousPageParam for endpoint '${endpointName}' must be a function if maxPages is used`);\n              }\n            }\n          }\n        }\n        context.endpointDefinitions[endpointName] = definition;\n        for (const m of initializedModules) {\n          m.injectEndpoint(endpointName, definition);\n        }\n      }\n      return api as any;\n    }\n    return api.injectEndpoints({\n      endpoints: options.endpoints as any\n    });\n  };\n}","import type { QueryCacheKey } from './core/apiState';\nimport type { EndpointDefinition } from './endpointDefinitions';\nimport { isPlainObject } from './core/rtkImports';\nconst cache: WeakMap<any, string> | undefined = WeakMap ? new WeakMap() : undefined;\nexport const defaultSerializeQueryArgs: SerializeQueryArgs<any> = ({\n  endpointName,\n  queryArgs\n}) => {\n  let serialized = '';\n  const cached = cache?.get(queryArgs);\n  if (typeof cached === 'string') {\n    serialized = cached;\n  } else {\n    const stringified = JSON.stringify(queryArgs, (key, value) => {\n      // Handle bigints\n      value = typeof value === 'bigint' ? {\n        $bigint: value.toString()\n      } : value;\n      // Sort the object keys before stringifying, to prevent useQuery({ a: 1, b: 2 }) having a different cache key than useQuery({ b: 2, a: 1 })\n      value = isPlainObject(value) ? Object.keys(value).sort().reduce<any>((acc, key) => {\n        acc[key] = (value as any)[key];\n        return acc;\n      }, {}) : value;\n      return value;\n    });\n    if (isPlainObject(queryArgs)) {\n      cache?.set(queryArgs, stringified);\n    }\n    serialized = stringified;\n  }\n  return `${endpointName}(${serialized})`;\n};\nexport type SerializeQueryArgs<QueryArgs, ReturnType = string> = (_: {\n  queryArgs: QueryArgs;\n  endpointDefinition: EndpointDefinition<any, any, any, any>;\n  endpointName: string;\n}) => ReturnType;\nexport type InternalSerializeQueryArgs = (_: {\n  queryArgs: any;\n  endpointDefinition: EndpointDefinition<any, any, any, any>;\n  endpointName: string;\n}) => QueryCacheKey;","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { BaseQueryFn } from './baseQueryTypes';\nexport const _NEVER = /* @__PURE__ */Symbol();\nexport type NEVER = typeof _NEVER;\n\n/**\n * Creates a \"fake\" baseQuery to be used if your api *only* uses the `queryFn` definition syntax.\n * This also allows you to specify a specific error type to be shared by all your `queryFn` definitions.\n */\nexport function fakeBaseQuery<ErrorType>(): BaseQueryFn<void, NEVER, ErrorType, {}> {\n  return function () {\n    throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(33) : 'When using `fakeBaseQuery`, all queries & mutations must use the `queryFn` definition syntax.');\n  };\n}","export type Id<T> = { [K in keyof T]: T[K] } & {};\nexport type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;\nexport type Override<T1, T2> = T2 extends any ? Omit<T1, keyof T2> & T2 : never;\nexport function assertCast<T>(v: any): asserts v is T {}\nexport function safeAssign<T extends object>(target: T, ...args: Array<Partial<NoInfer<T>>>): T {\n  return Object.assign(target, ...args);\n}\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\nexport type NonOptionalKeys<T> = { [K in keyof T]-?: undefined extends T[K] ? never : K }[keyof T];\nexport type HasRequiredProps<T, True, False> = NonOptionalKeys<T> extends never ? False : True;\nexport type OptionalIfAllPropsOptional<T> = HasRequiredProps<T, T, T | never>;\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\nexport type NonUndefined<T> = T extends undefined ? never : T;\nexport type UnwrapPromise<T> = T extends PromiseLike<infer V> ? V : T;\nexport type MaybePromise<T> = T | PromiseLike<T>;\nexport type OmitFromUnion<T, K extends keyof T> = T extends any ? Omit<T, K> : never;\nexport type IsAny<T, True, False = never> = true | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny<T, CastTo> = IsAny<T, CastTo, T>;","import type { InternalHandlerBuilder, SubscriptionSelectors } from './types';\nimport type { SubscriptionInternalState, SubscriptionState } from '../apiState';\nimport { produceWithPatches } from '../../utils/immerImports';\nimport type { Action } from '@reduxjs/toolkit';\nimport { getOrInsertComputed, createNewMap } from '../../utils/getOrInsert';\nexport const buildBatchedActionsHandler: InternalHandlerBuilder<[actionShouldContinue: boolean, returnValue: SubscriptionSelectors | boolean]> = ({\n  api,\n  queryThunk,\n  internalState,\n  mwApi\n}) => {\n  const subscriptionsPrefix = `${api.reducerPath}/subscriptions`;\n  let previousSubscriptions: SubscriptionState = null as unknown as SubscriptionState;\n  let updateSyncTimer: ReturnType<typeof window.setTimeout> | null = null;\n  const {\n    updateSubscriptionOptions,\n    unsubscribeQueryResult\n  } = api.internalActions;\n\n  // Actually intentionally mutate the subscriptions state used in the middleware\n  // This is done to speed up perf when loading many components\n  const actuallyMutateSubscriptions = (currentSubscriptions: SubscriptionInternalState, action: Action) => {\n    if (updateSubscriptionOptions.match(action)) {\n      const {\n        queryCacheKey,\n        requestId,\n        options\n      } = action.payload;\n      const sub = currentSubscriptions.get(queryCacheKey);\n      if (sub?.has(requestId)) {\n        sub.set(requestId, options);\n      }\n      return true;\n    }\n    if (unsubscribeQueryResult.match(action)) {\n      const {\n        queryCacheKey,\n        requestId\n      } = action.payload;\n      const sub = currentSubscriptions.get(queryCacheKey);\n      if (sub) {\n        sub.delete(requestId);\n      }\n      return true;\n    }\n    if (api.internalActions.removeQueryResult.match(action)) {\n      currentSubscriptions.delete(action.payload.queryCacheKey);\n      return true;\n    }\n    if (queryThunk.pending.match(action)) {\n      const {\n        meta: {\n          arg,\n          requestId\n        }\n      } = action;\n      const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);\n      if (arg.subscribe) {\n        substate.set(requestId, arg.subscriptionOptions ?? substate.get(requestId) ?? {});\n      }\n      return true;\n    }\n    let mutated = false;\n    if (queryThunk.rejected.match(action)) {\n      const {\n        meta: {\n          condition,\n          arg,\n          requestId\n        }\n      } = action;\n      if (condition && arg.subscribe) {\n        const substate = getOrInsertComputed(currentSubscriptions, arg.queryCacheKey, createNewMap);\n        substate.set(requestId, arg.subscriptionOptions ?? substate.get(requestId) ?? {});\n        mutated = true;\n      }\n    }\n    return mutated;\n  };\n  const getSubscriptions = () => internalState.currentSubscriptions;\n  const getSubscriptionCount = (queryCacheKey: string) => {\n    const subscriptions = getSubscriptions();\n    const subscriptionsForQueryArg = subscriptions.get(queryCacheKey);\n    return subscriptionsForQueryArg?.size ?? 0;\n  };\n  const isRequestSubscribed = (queryCacheKey: string, requestId: string) => {\n    const subscriptions = getSubscriptions();\n    return !!subscriptions?.get(queryCacheKey)?.get(requestId);\n  };\n  const subscriptionSelectors: SubscriptionSelectors = {\n    getSubscriptions,\n    getSubscriptionCount,\n    isRequestSubscribed\n  };\n  function serializeSubscriptions(currentSubscriptions: SubscriptionInternalState): SubscriptionState {\n    // We now use nested Maps for subscriptions, instead of\n    // plain Records. Stringify this accordingly so we can\n    // convert it to the shape we need for the store.\n    return JSON.parse(JSON.stringify(Object.fromEntries([...currentSubscriptions].map(([k, v]) => [k, Object.fromEntries(v)]))));\n  }\n  return (action, mwApi): [actionShouldContinue: boolean, result: SubscriptionSelectors | boolean] => {\n    if (!previousSubscriptions) {\n      // Initialize it the first time this handler runs\n      previousSubscriptions = serializeSubscriptions(internalState.currentSubscriptions);\n    }\n    if (api.util.resetApiState.match(action)) {\n      previousSubscriptions = {};\n      internalState.currentSubscriptions.clear();\n      updateSyncTimer = null;\n      return [true, false];\n    }\n\n    // Intercept requests by hooks to see if they're subscribed\n    // We return the internal state reference so that hooks\n    // can do their own checks to see if they're still active.\n    // It's stupid and hacky, but it does cut down on some dispatch calls.\n    if (api.internalActions.internal_getRTKQSubscriptions.match(action)) {\n      return [false, subscriptionSelectors];\n    }\n\n    // Update subscription data based on this action\n    const didMutate = actuallyMutateSubscriptions(internalState.currentSubscriptions, action);\n    let actionShouldContinue = true;\n\n    // HACK Sneak the test-only polling state back out\n    if (process.env.NODE_ENV === 'test' && typeof action.type === 'string' && action.type === `${api.reducerPath}/getPolling`) {\n      return [false, internalState.currentPolls] as any;\n    }\n    if (didMutate) {\n      if (!updateSyncTimer) {\n        // We only use the subscription state for the Redux DevTools at this point,\n        // as the real data is kept here in the middleware.\n        // Given that, we can throttle synchronizing this state significantly to\n        // save on overall perf.\n        // In 1.9, it was updated in a microtask, but now we do it at most every 500ms.\n        updateSyncTimer = setTimeout(() => {\n          // Deep clone the current subscription data\n          const newSubscriptions: SubscriptionState = serializeSubscriptions(internalState.currentSubscriptions);\n          // Figure out a smaller diff between original and current\n          const [, patches] = produceWithPatches(previousSubscriptions, () => newSubscriptions);\n\n          // Sync the store state for visibility\n          mwApi.next(api.internalActions.subscriptionsUpdated(patches));\n          // Save the cloned state for later reference\n          previousSubscriptions = newSubscriptions;\n          updateSyncTimer = null;\n        }, 500);\n      }\n      const isSubscriptionSliceAction = typeof action.type == 'string' && !!action.type.startsWith(subscriptionsPrefix);\n      const isAdditionalSubscriptionAction = queryThunk.rejected.match(action) && action.meta.condition && !!action.meta.arg.subscribe;\n      actionShouldContinue = !isSubscriptionSliceAction && !isAdditionalSubscriptionAction;\n    }\n    return [actionShouldContinue, false];\n  };\n};","import { getEndpointDefinition } from '@internal/query/apiTypes';\nimport type { QueryDefinition } from '../../endpointDefinitions';\nimport type { ConfigState, QueryCacheKey, QuerySubState } from '../apiState';\nimport { isAnyOf } from '../rtkImports';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, QueryStateMeta, SubMiddlewareApi, TimeoutId } from './types';\nexport type ReferenceCacheCollection = never;\n\n/**\n * @example\n * ```ts\n * // codeblock-meta title=\"keepUnusedDataFor example\"\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n * interface Post {\n *   id: number\n *   name: string\n * }\n * type PostsResponse = Post[]\n *\n * const api = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsResponse, void>({\n *       query: () => 'posts',\n *       // highlight-start\n *       keepUnusedDataFor: 5\n *       // highlight-end\n *     })\n *   })\n * })\n * ```\n */\nexport type CacheCollectionQueryExtraOptions = {\n  /**\n   * Overrides the api-wide definition of `keepUnusedDataFor` for this endpoint only. _(This value is in seconds.)_\n   *\n   * This is how long RTK Query will keep your data cached for **after** the last component unsubscribes. For example, if you query an endpoint, then unmount the component, then mount another component that makes the same request within the given time frame, the most recent value will be served from the cache.\n   */\n  keepUnusedDataFor?: number;\n};\n\n// Per https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value , browsers store\n// `setTimeout()` timer values in a 32-bit int. If we pass a value in that's larger than that,\n// it wraps and ends up executing immediately.\n// Our `keepUnusedDataFor` values are in seconds, so adjust the numbers here accordingly.\nexport const THIRTY_TWO_BIT_MAX_INT = 2_147_483_647;\nexport const THIRTY_TWO_BIT_MAX_TIMER_SECONDS = 2_147_483_647 / 1_000 - 1;\nexport const buildCacheCollectionHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  api,\n  queryThunk,\n  context,\n  internalState,\n  selectors: {\n    selectQueryEntry,\n    selectConfig\n  },\n  getRunningQueryThunk,\n  mwApi\n}) => {\n  const {\n    removeQueryResult,\n    unsubscribeQueryResult,\n    cacheEntriesUpserted\n  } = api.internalActions;\n  const canTriggerUnsubscribe = isAnyOf(unsubscribeQueryResult.match, queryThunk.fulfilled, queryThunk.rejected, cacheEntriesUpserted.match);\n  function anySubscriptionsRemainingForKey(queryCacheKey: string) {\n    const subscriptions = internalState.currentSubscriptions.get(queryCacheKey);\n    if (!subscriptions) {\n      return false;\n    }\n    const hasSubscriptions = subscriptions.size > 0;\n    return hasSubscriptions;\n  }\n  const currentRemovalTimeouts: QueryStateMeta<TimeoutId> = {};\n  function abortAllPromises<T extends {\n    abort?: () => void;\n  }>(promiseMap: Map<string, T | undefined>): void {\n    for (const promise of promiseMap.values()) {\n      promise?.abort?.();\n    }\n  }\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    const state = mwApi.getState();\n    const config = selectConfig(state);\n    if (canTriggerUnsubscribe(action)) {\n      let queryCacheKeys: QueryCacheKey[];\n      if (cacheEntriesUpserted.match(action)) {\n        queryCacheKeys = action.payload.map(entry => entry.queryDescription.queryCacheKey);\n      } else {\n        const {\n          queryCacheKey\n        } = unsubscribeQueryResult.match(action) ? action.payload : action.meta.arg;\n        queryCacheKeys = [queryCacheKey];\n      }\n      handleUnsubscribeMany(queryCacheKeys, mwApi, config);\n    }\n    if (api.util.resetApiState.match(action)) {\n      for (const [key, timeout] of Object.entries(currentRemovalTimeouts)) {\n        if (timeout) clearTimeout(timeout);\n        delete currentRemovalTimeouts[key];\n      }\n      abortAllPromises(internalState.runningQueries);\n      abortAllPromises(internalState.runningMutations);\n    }\n    if (context.hasRehydrationInfo(action)) {\n      const {\n        queries\n      } = context.extractRehydrationInfo(action)!;\n      // Gotcha:\n      // If rehydrating before the endpoint has been injected,the global `keepUnusedDataFor`\n      // will be used instead of the endpoint-specific one.\n      handleUnsubscribeMany(Object.keys(queries) as QueryCacheKey[], mwApi, config);\n    }\n  };\n  function handleUnsubscribeMany(cacheKeys: QueryCacheKey[], api: SubMiddlewareApi, config: ConfigState<string>) {\n    const state = api.getState();\n    for (const queryCacheKey of cacheKeys) {\n      const entry = selectQueryEntry(state, queryCacheKey);\n      if (entry?.endpointName) {\n        handleUnsubscribe(queryCacheKey, entry.endpointName, api, config);\n      }\n    }\n  }\n  function handleUnsubscribe(queryCacheKey: QueryCacheKey, endpointName: string, api: SubMiddlewareApi, config: ConfigState<string>) {\n    const endpointDefinition = getEndpointDefinition(context, endpointName) as QueryDefinition<any, any, any, any>;\n    const keepUnusedDataFor = endpointDefinition?.keepUnusedDataFor ?? config.keepUnusedDataFor;\n    if (keepUnusedDataFor === Infinity) {\n      // Hey, user said keep this forever!\n      return;\n    }\n    // Prevent `setTimeout` timers from overflowing a 32-bit internal int, by\n    // clamping the max value to be at most 1000ms less than the 32-bit max.\n    // Look, a 24.8-day keepalive ought to be enough for anybody, right? :)\n    // Also avoid negative values too.\n    const finalKeepUnusedDataFor = Math.max(0, Math.min(keepUnusedDataFor, THIRTY_TWO_BIT_MAX_TIMER_SECONDS));\n    if (!anySubscriptionsRemainingForKey(queryCacheKey)) {\n      const currentTimeout = currentRemovalTimeouts[queryCacheKey];\n      if (currentTimeout) {\n        clearTimeout(currentTimeout);\n      }\n      currentRemovalTimeouts[queryCacheKey] = setTimeout(() => {\n        if (!anySubscriptionsRemainingForKey(queryCacheKey)) {\n          // Try to abort any running query for this cache key\n          const entry = selectQueryEntry(api.getState(), queryCacheKey);\n          if (entry?.endpointName) {\n            const runningQuery = api.dispatch(getRunningQueryThunk(entry.endpointName, entry.originalArgs));\n            runningQuery?.abort();\n          }\n          api.dispatch(removeQueryResult({\n            queryCacheKey\n          }));\n        }\n        delete currentRemovalTimeouts![queryCacheKey];\n      }, finalKeepUnusedDataFor * 1000);\n    }\n  }\n  return handler;\n};","import type { ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { BaseQueryFn, BaseQueryMeta, BaseQueryResult } from '../../baseQueryTypes';\nimport type { BaseEndpointDefinition, DefinitionType } from '../../endpointDefinitions';\nimport { isAnyQueryDefinition } from '../../endpointDefinitions';\nimport type { QueryCacheKey, RootState } from '../apiState';\nimport type { MutationResultSelectorResult, QueryResultSelectorResult } from '../buildSelectors';\nimport { getMutationCacheKey } from '../buildSlice';\nimport type { PatchCollection, Recipe } from '../buildThunks';\nimport { isAsyncThunkAction, isFulfilled } from '../rtkImports';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, PromiseWithKnownReason, SubMiddlewareApi } from './types';\nimport { getEndpointDefinition } from '@internal/query/apiTypes';\nexport type ReferenceCacheLifecycle = never;\nexport interface QueryBaseLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends LifecycleApi<ReducerPath> {\n  /**\n   * Gets the current value of this cache entry.\n   */\n  getCacheEntry(): QueryResultSelectorResult<{\n    type: DefinitionType.query;\n  } & BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, BaseQueryResult<BaseQuery>>>;\n  /**\n   * Updates the current cache entry value.\n   * For documentation see `api.util.updateQueryData`.\n   */\n  updateCachedData(updateRecipe: Recipe<ResultType>): PatchCollection;\n}\nexport type MutationBaseLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = LifecycleApi<ReducerPath> & {\n  /**\n   * Gets the current value of this cache entry.\n   */\n  getCacheEntry(): MutationResultSelectorResult<{\n    type: DefinitionType.mutation;\n  } & BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, BaseQueryResult<BaseQuery>>>;\n};\ntype LifecycleApi<ReducerPath extends string = string> = {\n  /**\n   * The dispatch method for the store\n   */\n  dispatch: ThunkDispatch<any, any, UnknownAction>;\n  /**\n   * A method to get the current state\n   */\n  getState(): RootState<any, any, ReducerPath>;\n  /**\n   * `extra` as provided as `thunk.extraArgument` to the `configureStore` `getDefaultMiddleware` option.\n   */\n  extra: unknown;\n  /**\n   * A unique ID generated for the mutation\n   */\n  requestId: string;\n};\ntype CacheLifecyclePromises<ResultType = unknown, MetaType = unknown> = {\n  /**\n   * Promise that will resolve with the first value for this cache key.\n   * This allows you to `await` until an actual value is in cache.\n   *\n   * If the cache entry is removed from the cache before any value has ever\n   * been resolved, this Promise will reject with\n   * `new Error('Promise never resolved before cacheEntryRemoved.')`\n   * to prevent memory leaks.\n   * You can just re-throw that error (or not handle it at all) -\n   * it will be caught outside of `cacheEntryAdded`.\n   *\n   * If you don't interact with this promise, it will not throw.\n   */\n  cacheDataLoaded: PromiseWithKnownReason<{\n    /**\n     * The (transformed) query result.\n     */\n    data: ResultType;\n    /**\n     * The `meta` returned by the `baseQuery`\n     */\n    meta: MetaType;\n  }, typeof neverResolvedError>;\n  /**\n   * Promise that allows you to wait for the point in time when the cache entry\n   * has been removed from the cache, by not being used/subscribed to any more\n   * in the application for too long or by dispatching `api.util.resetApiState`.\n   */\n  cacheEntryRemoved: Promise<void>;\n};\nexport interface QueryCacheLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>, CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>> {}\nexport type MutationCacheLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> & CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>>;\nexport type CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  onCacheEntryAdded?(arg: QueryArg, api: QueryCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport type CacheLifecycleInfiniteQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>;\nexport type CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  onCacheEntryAdded?(arg: QueryArg, api: MutationCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nconst neverResolvedError = new Error('Promise never resolved before cacheEntryRemoved.') as Error & {\n  message: 'Promise never resolved before cacheEntryRemoved.';\n};\nexport const buildCacheLifecycleHandler: InternalHandlerBuilder = ({\n  api,\n  reducerPath,\n  context,\n  queryThunk,\n  mutationThunk,\n  internalState,\n  selectors: {\n    selectQueryEntry,\n    selectApiState\n  }\n}) => {\n  const isQueryThunk = isAsyncThunkAction(queryThunk);\n  const isMutationThunk = isAsyncThunkAction(mutationThunk);\n  const isFulfilledThunk = isFulfilled(queryThunk, mutationThunk);\n  type CacheLifecycle = {\n    valueResolved?(value: {\n      data: unknown;\n      meta: unknown;\n    }): unknown;\n    cacheEntryRemoved(): void;\n  };\n  const lifecycleMap: Record<string, CacheLifecycle> = {};\n  const {\n    removeQueryResult,\n    removeMutationResult,\n    cacheEntriesUpserted\n  } = api.internalActions;\n  function resolveLifecycleEntry(cacheKey: string, data: unknown, meta: unknown) {\n    const lifecycle = lifecycleMap[cacheKey];\n    if (lifecycle?.valueResolved) {\n      lifecycle.valueResolved({\n        data,\n        meta\n      });\n      delete lifecycle.valueResolved;\n    }\n  }\n  function removeLifecycleEntry(cacheKey: string) {\n    const lifecycle = lifecycleMap[cacheKey];\n    if (lifecycle) {\n      delete lifecycleMap[cacheKey];\n      lifecycle.cacheEntryRemoved();\n    }\n  }\n  function getActionMetaFields(action: ReturnType<typeof queryThunk.pending> | ReturnType<typeof mutationThunk.pending>) {\n    const {\n      arg,\n      requestId\n    } = action.meta;\n    const {\n      endpointName,\n      originalArgs\n    } = arg;\n    return [endpointName, originalArgs, requestId] as const;\n  }\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi, stateBefore) => {\n    const cacheKey = getCacheKey(action) as QueryCacheKey;\n    function checkForNewCacheKey(endpointName: string, cacheKey: QueryCacheKey, requestId: string, originalArgs: unknown) {\n      const oldEntry = selectQueryEntry(stateBefore, cacheKey);\n      const newEntry = selectQueryEntry(mwApi.getState(), cacheKey);\n      if (!oldEntry && newEntry) {\n        handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId);\n      }\n    }\n    if (queryThunk.pending.match(action)) {\n      const [endpointName, originalArgs, requestId] = getActionMetaFields(action);\n      checkForNewCacheKey(endpointName, cacheKey, requestId, originalArgs);\n    } else if (cacheEntriesUpserted.match(action)) {\n      for (const {\n        queryDescription,\n        value\n      } of action.payload) {\n        const {\n          endpointName,\n          originalArgs,\n          queryCacheKey\n        } = queryDescription;\n        checkForNewCacheKey(endpointName, queryCacheKey, action.meta.requestId, originalArgs);\n        resolveLifecycleEntry(queryCacheKey, value, {});\n      }\n    } else if (mutationThunk.pending.match(action)) {\n      const state = mwApi.getState()[reducerPath].mutations[cacheKey];\n      if (state) {\n        const [endpointName, originalArgs, requestId] = getActionMetaFields(action);\n        handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId);\n      }\n    } else if (isFulfilledThunk(action)) {\n      resolveLifecycleEntry(cacheKey, action.payload, action.meta.baseQueryMeta);\n    } else if (removeQueryResult.match(action) || removeMutationResult.match(action)) {\n      removeLifecycleEntry(cacheKey);\n    } else if (api.util.resetApiState.match(action)) {\n      for (const cacheKey of Object.keys(lifecycleMap)) {\n        removeLifecycleEntry(cacheKey);\n      }\n    }\n  };\n  function getCacheKey(action: any) {\n    if (isQueryThunk(action)) return action.meta.arg.queryCacheKey;\n    if (isMutationThunk(action)) {\n      return action.meta.arg.fixedCacheKey ?? action.meta.requestId;\n    }\n    if (removeQueryResult.match(action)) return action.payload.queryCacheKey;\n    if (removeMutationResult.match(action)) return getMutationCacheKey(action.payload);\n    return '';\n  }\n  function handleNewKey(endpointName: string, originalArgs: any, queryCacheKey: string, mwApi: SubMiddlewareApi, requestId: string) {\n    const endpointDefinition = getEndpointDefinition(context, endpointName);\n    const onCacheEntryAdded = endpointDefinition?.onCacheEntryAdded;\n    if (!onCacheEntryAdded) return;\n    const lifecycle = {} as CacheLifecycle;\n    const cacheEntryRemoved = new Promise<void>(resolve => {\n      lifecycle.cacheEntryRemoved = resolve;\n    });\n    const cacheDataLoaded: PromiseWithKnownReason<{\n      data: unknown;\n      meta: unknown;\n    }, typeof neverResolvedError> = Promise.race([new Promise<{\n      data: unknown;\n      meta: unknown;\n    }>(resolve => {\n      lifecycle.valueResolved = resolve;\n    }), cacheEntryRemoved.then(() => {\n      throw neverResolvedError;\n    })]);\n    // prevent uncaught promise rejections from happening.\n    // if the original promise is used in any way, that will create a new promise that will throw again\n    cacheDataLoaded.catch(() => {});\n    lifecycleMap[queryCacheKey] = lifecycle;\n    const selector = (api.endpoints[endpointName] as any).select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : queryCacheKey);\n    const extra = mwApi.dispatch((_, __, extra) => extra);\n    const lifecycleApi = {\n      ...mwApi,\n      getCacheEntry: () => selector(mwApi.getState()),\n      requestId,\n      extra,\n      updateCachedData: (isAnyQueryDefinition(endpointDefinition) ? (updateRecipe: Recipe<any>) => mwApi.dispatch(api.util.updateQueryData(endpointName as never, originalArgs as never, updateRecipe)) : undefined) as any,\n      cacheDataLoaded,\n      cacheEntryRemoved\n    };\n    const runningHandler = onCacheEntryAdded(originalArgs, lifecycleApi as any);\n    // if a `neverResolvedError` was thrown, but not handled in the running handler, do not let it leak out further\n    Promise.resolve(runningHandler).catch(e => {\n      if (e === neverResolvedError) return;\n      throw e;\n    });\n  }\n  return handler;\n};","import type { InternalHandlerBuilder } from './types';\nexport const buildDevCheckHandler: InternalHandlerBuilder = ({\n  api,\n  context: {\n    apiUid\n  },\n  reducerPath\n}) => {\n  return (action, mwApi) => {\n    if (api.util.resetApiState.match(action)) {\n      // dispatch after api reset\n      mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));\n    }\n    if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n      if (api.internalActions.middlewareRegistered.match(action) && action.payload === apiUid && mwApi.getState()[reducerPath]?.config?.middlewareRegistered === 'conflict') {\n        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!` : ''}`);\n      }\n    }\n  };\n};","import { isAnyOf, isFulfilled, isRejected, isRejectedWithValue } from '../rtkImports';\nimport type { EndpointDefinitions, FullTagDescription } from '../../endpointDefinitions';\nimport { calculateProvidedBy } from '../../endpointDefinitions';\nimport type { CombinedState, QueryCacheKey } from '../apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport { calculateProvidedByThunk } from '../buildThunks';\nimport type { SubMiddlewareApi, InternalHandlerBuilder, ApiMiddlewareInternalHandler } from './types';\nimport { getOrInsertComputed, createNewMap } from '../../utils/getOrInsert';\nexport const buildInvalidationByTagsHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  context,\n  context: {\n    endpointDefinitions\n  },\n  mutationThunk,\n  queryThunk,\n  api,\n  assertTagType,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    removeQueryResult\n  } = api.internalActions;\n  const isThunkActionWithTags = isAnyOf(isFulfilled(mutationThunk), isRejectedWithValue(mutationThunk));\n  const isQueryEnd = isAnyOf(isFulfilled(queryThunk, mutationThunk), isRejected(queryThunk, mutationThunk));\n  let pendingTagInvalidations: FullTagDescription<string>[] = [];\n  // Track via counter so we can avoid iterating over state every time\n  let pendingRequestCount = 0;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (queryThunk.pending.match(action) || mutationThunk.pending.match(action)) {\n      pendingRequestCount++;\n    }\n    if (isQueryEnd(action)) {\n      pendingRequestCount = Math.max(0, pendingRequestCount - 1);\n    }\n    if (isThunkActionWithTags(action)) {\n      invalidateTags(calculateProvidedByThunk(action, 'invalidatesTags', endpointDefinitions, assertTagType), mwApi);\n    } else if (isQueryEnd(action)) {\n      invalidateTags([], mwApi);\n    } else if (api.util.invalidateTags.match(action)) {\n      invalidateTags(calculateProvidedBy(action.payload, undefined, undefined, undefined, undefined, assertTagType), mwApi);\n    }\n  };\n  function hasPendingRequests() {\n    return pendingRequestCount > 0;\n  }\n  function invalidateTags(newTags: readonly FullTagDescription<string>[], mwApi: SubMiddlewareApi) {\n    const rootState = mwApi.getState();\n    const state = rootState[reducerPath];\n    pendingTagInvalidations.push(...newTags);\n    if (state.config.invalidationBehavior === 'delayed' && hasPendingRequests()) {\n      return;\n    }\n    const tags = pendingTagInvalidations;\n    pendingTagInvalidations = [];\n    if (tags.length === 0) return;\n    const toInvalidate = api.util.selectInvalidatedBy(rootState, tags);\n    context.batch(() => {\n      const valuesArray = Array.from(toInvalidate.values());\n      for (const {\n        queryCacheKey\n      } of valuesArray) {\n        const querySubState = state.queries[queryCacheKey];\n        const subscriptionSubState = getOrInsertComputed(internalState.currentSubscriptions, queryCacheKey, createNewMap);\n        if (querySubState) {\n          if (subscriptionSubState.size === 0) {\n            mwApi.dispatch(removeQueryResult({\n              queryCacheKey: queryCacheKey as QueryCacheKey\n            }));\n          } else if (querySubState.status !== STATUS_UNINITIALIZED) {\n            mwApi.dispatch(refetchQuery(querySubState));\n          }\n        }\n      }\n    });\n  }\n  return handler;\n};","import type { QueryCacheKey, QuerySubstateIdentifier, Subscribers, SubscribersInternal } from '../apiState';\nimport { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport type { QueryStateMeta, SubMiddlewareApi, TimeoutId, InternalHandlerBuilder, ApiMiddlewareInternalHandler, InternalMiddlewareState } from './types';\nexport const buildPollingHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  queryThunk,\n  api,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    currentPolls,\n    currentSubscriptions\n  } = internalState;\n\n  // Batching state for polling updates\n  const pendingPollingUpdates = new Set<string>();\n  let pollingUpdateTimer: ReturnType<typeof setTimeout> | null = null;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (api.internalActions.updateSubscriptionOptions.match(action) || api.internalActions.unsubscribeQueryResult.match(action)) {\n      schedulePollingUpdate(action.payload.queryCacheKey, mwApi);\n    }\n    if (queryThunk.pending.match(action) || queryThunk.rejected.match(action) && action.meta.condition) {\n      schedulePollingUpdate(action.meta.arg.queryCacheKey, mwApi);\n    }\n    if (queryThunk.fulfilled.match(action) || queryThunk.rejected.match(action) && !action.meta.condition) {\n      startNextPoll(action.meta.arg, mwApi);\n    }\n    if (api.util.resetApiState.match(action)) {\n      clearPolls();\n      // Clear any pending updates\n      if (pollingUpdateTimer) {\n        clearTimeout(pollingUpdateTimer);\n        pollingUpdateTimer = null;\n      }\n      pendingPollingUpdates.clear();\n    }\n  };\n  function schedulePollingUpdate(queryCacheKey: string, api: SubMiddlewareApi) {\n    pendingPollingUpdates.add(queryCacheKey);\n    if (!pollingUpdateTimer) {\n      pollingUpdateTimer = setTimeout(() => {\n        // Process all pending updates in a single batch\n        for (const key of pendingPollingUpdates) {\n          updatePollingInterval({\n            queryCacheKey: key as any\n          }, api);\n        }\n        pendingPollingUpdates.clear();\n        pollingUpdateTimer = null;\n      }, 0);\n    }\n  }\n  function startNextPoll({\n    queryCacheKey\n  }: QuerySubstateIdentifier, api: SubMiddlewareApi) {\n    const state = api.getState()[reducerPath];\n    const querySubState = state.queries[queryCacheKey];\n    const subscriptions = currentSubscriptions.get(queryCacheKey);\n    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) return;\n    const {\n      lowestPollingInterval,\n      skipPollingIfUnfocused\n    } = findLowestPollingInterval(subscriptions);\n    if (!Number.isFinite(lowestPollingInterval)) return;\n    const currentPoll = currentPolls.get(queryCacheKey);\n    if (currentPoll?.timeout) {\n      clearTimeout(currentPoll.timeout);\n      currentPoll.timeout = undefined;\n    }\n    const nextPollTimestamp = Date.now() + lowestPollingInterval;\n    currentPolls.set(queryCacheKey, {\n      nextPollTimestamp,\n      pollingInterval: lowestPollingInterval,\n      timeout: setTimeout(() => {\n        if (state.config.focused || !skipPollingIfUnfocused) {\n          api.dispatch(refetchQuery(querySubState));\n        }\n        startNextPoll({\n          queryCacheKey\n        }, api);\n      }, lowestPollingInterval)\n    });\n  }\n  function updatePollingInterval({\n    queryCacheKey\n  }: QuerySubstateIdentifier, api: SubMiddlewareApi) {\n    const state = api.getState()[reducerPath];\n    const querySubState = state.queries[queryCacheKey];\n    const subscriptions = currentSubscriptions.get(queryCacheKey);\n    if (!querySubState || querySubState.status === STATUS_UNINITIALIZED) {\n      return;\n    }\n    const {\n      lowestPollingInterval\n    } = findLowestPollingInterval(subscriptions);\n\n    // HACK add extra data to track how many times this has been called in tests\n    // yes we're mutating a nonexistent field on a Map here\n    if (process.env.NODE_ENV === 'test') {\n      const updateCounters = (currentPolls as any).pollUpdateCounters ??= {};\n      updateCounters[queryCacheKey] ??= 0;\n      updateCounters[queryCacheKey]++;\n    }\n    if (!Number.isFinite(lowestPollingInterval)) {\n      cleanupPollForKey(queryCacheKey);\n      return;\n    }\n    const currentPoll = currentPolls.get(queryCacheKey);\n    const nextPollTimestamp = Date.now() + lowestPollingInterval;\n    if (!currentPoll || nextPollTimestamp < currentPoll.nextPollTimestamp) {\n      startNextPoll({\n        queryCacheKey\n      }, api);\n    }\n  }\n  function cleanupPollForKey(key: string) {\n    const existingPoll = currentPolls.get(key);\n    if (existingPoll?.timeout) {\n      clearTimeout(existingPoll.timeout);\n    }\n    currentPolls.delete(key);\n  }\n  function clearPolls() {\n    for (const key of currentPolls.keys()) {\n      cleanupPollForKey(key);\n    }\n  }\n  function findLowestPollingInterval(subscribers: SubscribersInternal = new Map()) {\n    let skipPollingIfUnfocused: boolean | undefined = false;\n    let lowestPollingInterval = Number.POSITIVE_INFINITY;\n    for (const entry of subscribers.values()) {\n      if (!!entry.pollingInterval) {\n        lowestPollingInterval = Math.min(entry.pollingInterval!, lowestPollingInterval);\n        skipPollingIfUnfocused = entry.skipPollingIfUnfocused || skipPollingIfUnfocused;\n      }\n    }\n    return {\n      lowestPollingInterval,\n      skipPollingIfUnfocused\n    };\n  }\n  return handler;\n};","import { getEndpointDefinition } from '@internal/query/apiTypes';\nimport type { BaseQueryError, BaseQueryFn, BaseQueryMeta } from '../../baseQueryTypes';\nimport { isAnyQueryDefinition } from '../../endpointDefinitions';\nimport type { Recipe } from '../buildThunks';\nimport { isFulfilled, isPending, isRejected } from '../rtkImports';\nimport type { MutationBaseLifecycleApi, QueryBaseLifecycleApi } from './cacheLifecycle';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, PromiseConstructorWithKnownReason, PromiseWithKnownReason } from './types';\nexport type ReferenceQueryLifecycle = never;\ntype QueryLifecyclePromises<ResultType, BaseQuery extends BaseQueryFn> = {\n  /**\n   * Promise that will resolve with the (transformed) query result.\n   *\n   * If the query fails, this promise will reject with the error.\n   *\n   * This allows you to `await` for the query to finish.\n   *\n   * If you don't interact with this promise, it will not throw.\n   */\n  queryFulfilled: PromiseWithKnownReason<{\n    /**\n     * The (transformed) query result.\n     */\n    data: ResultType;\n    /**\n     * The `meta` returned by the `baseQuery`\n     */\n    meta: BaseQueryMeta<BaseQuery>;\n  }, QueryFulfilledRejectionReason<BaseQuery>>;\n};\ntype QueryFulfilledRejectionReason<BaseQuery extends BaseQueryFn> = {\n  error: BaseQueryError<BaseQuery>;\n  /**\n   * If this is `false`, that means this error was returned from the `baseQuery` or `queryFn` in a controlled manner.\n   */\n  isUnhandledError: false;\n  /**\n   * The `meta` returned by the `baseQuery`\n   */\n  meta: BaseQueryMeta<BaseQuery>;\n} | {\n  error: unknown;\n  meta?: undefined;\n  /**\n   * If this is `true`, that means that this error is the result of `baseQueryFn`, `queryFn`, `transformResponse` or `transformErrorResponse` throwing an error instead of handling it properly.\n   * There can not be made any assumption about the shape of `error`.\n   */\n  isUnhandledError: true;\n};\nexport type QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  /**\n   * A function that is called when the individual query is started. The function is called with a lifecycle api object containing properties such as `queryFulfilled`, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. throughout the lifecycle of an individual query/mutation call).\n   *\n   * Can be used to perform side-effects throughout the lifecycle of the query.\n   *\n   * @example\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   * import { messageCreated } from './notificationsSlice\n   * export interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({\n   *     baseUrl: '/',\n   *   }),\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, number>({\n   *       query: (id) => `post/${id}`,\n   *       async onQueryStarted(id, { dispatch, queryFulfilled }) {\n   *         // `onStart` side-effect\n   *         dispatch(messageCreated('Fetching posts...'))\n   *         try {\n   *           const { data } = await queryFulfilled\n   *           // `onSuccess` side-effect\n   *           dispatch(messageCreated('Posts received!'))\n   *         } catch (err) {\n   *           // `onError` side-effect\n   *           dispatch(messageCreated('Error fetching posts!'))\n   *         }\n   *       }\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  onQueryStarted?(queryArgument: QueryArg, queryLifeCycleApi: QueryLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport type QueryLifecycleInfiniteQueryExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>;\nexport type QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> = {\n  /**\n   * A function that is called when the individual mutation is started. The function is called with a lifecycle api object containing properties such as `queryFulfilled`, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. throughout the lifecycle of an individual query/mutation call).\n   *\n   * Can be used for `optimistic updates`.\n   *\n   * @example\n   *\n   * ```ts\n   * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n   * export interface Post {\n   *   id: number\n   *   name: string\n   * }\n   *\n   * const api = createApi({\n   *   baseQuery: fetchBaseQuery({\n   *     baseUrl: '/',\n   *   }),\n   *   tagTypes: ['Post'],\n   *   endpoints: (build) => ({\n   *     getPost: build.query<Post, number>({\n   *       query: (id) => `post/${id}`,\n   *       providesTags: ['Post'],\n   *     }),\n   *     updatePost: build.mutation<void, Pick<Post, 'id'> & Partial<Post>>({\n   *       query: ({ id, ...patch }) => ({\n   *         url: `post/${id}`,\n   *         method: 'PATCH',\n   *         body: patch,\n   *       }),\n   *       invalidatesTags: ['Post'],\n   *       async onQueryStarted({ id, ...patch }, { dispatch, queryFulfilled }) {\n   *         const patchResult = dispatch(\n   *           api.util.updateQueryData('getPost', id, (draft) => {\n   *             Object.assign(draft, patch)\n   *           })\n   *         )\n   *         try {\n   *           await queryFulfilled\n   *         } catch {\n   *           patchResult.undo()\n   *         }\n   *       },\n   *     }),\n   *   }),\n   * })\n   * ```\n   */\n  onQueryStarted?(queryArgument: QueryArg, mutationLifeCycleApi: MutationLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>): Promise<void> | void;\n};\nexport interface QueryLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>, QueryLifecyclePromises<ResultType, BaseQuery> {}\nexport type MutationLifecycleApi<QueryArg, BaseQuery extends BaseQueryFn, ResultType, ReducerPath extends string = string> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> & QueryLifecyclePromises<ResultType, BaseQuery>;\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryLifecycleQueryExtraOptions.onQueryStarted | onQueryStarted}\n * for a specific query.\n *\n * @example\n * <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>\n *\n * ```ts\n * import type { TypedQueryOnQueryStarted } from '@reduxjs/toolkit/query'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n *\n * type Post = {\n *   id: number\n *   title: string\n *   userId: number\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = number | undefined\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * const baseApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, void>({\n *       query: () => `/posts`,\n *     }),\n *\n *     getPostById: build.query<Post, QueryArgument>({\n *       query: (postId) => `/posts/${postId}`,\n *     }),\n *   }),\n * })\n *\n * const updatePostOnFulfilled: TypedQueryOnQueryStarted<\n *   PostsApiResponse,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   'postsApi'\n * > = async (queryArgument, { dispatch, queryFulfilled }) => {\n *   const result = await queryFulfilled\n *\n *   const { posts } = result.data\n *\n *   // Pre-fill the individual post entries with the results\n *   // from the list endpoint query\n *   dispatch(\n *     baseApiSlice.util.upsertQueryEntries(\n *       posts.map((post) => ({\n *         endpointName: 'getPostById',\n *         arg: post.id,\n *         value: post,\n *       })),\n *     ),\n *   )\n * }\n *\n * export const extendedApiSlice = baseApiSlice.injectEndpoints({\n *   endpoints: (build) => ({\n *     getPostsByUserId: build.query<PostsApiResponse, QueryArgument>({\n *       query: (userId) => `/posts/user/${userId}`,\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *   }),\n * })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template ReducerPath - The type representing the `reducerPath` for the API slice.\n *\n * @since 2.4.0\n * @public\n */\nexport type TypedQueryOnQueryStarted<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleQueryExtraOptions<ResultType, QueryArgumentType, BaseQueryFunctionType, ReducerPath>['onQueryStarted'];\n\n/**\n * Provides a way to define a strongly-typed version of\n * {@linkcode QueryLifecycleMutationExtraOptions.onQueryStarted | onQueryStarted}\n * for a specific mutation.\n *\n * @example\n * <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>\n *\n * ```ts\n * import type { TypedMutationOnQueryStarted } from '@reduxjs/toolkit/query'\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'\n *\n * type Post = {\n *   id: number\n *   title: string\n *   userId: number\n * }\n *\n * type PostsApiResponse = {\n *   posts: Post[]\n *   total: number\n *   skip: number\n *   limit: number\n * }\n *\n * type QueryArgument = Pick<Post, 'id'> & Partial<Post>\n *\n * type BaseQueryFunction = ReturnType<typeof fetchBaseQuery>\n *\n * const baseApiSlice = createApi({\n *   baseQuery: fetchBaseQuery({ baseUrl: 'https://dummyjson.com' }),\n *   reducerPath: 'postsApi',\n *   tagTypes: ['Posts'],\n *   endpoints: (build) => ({\n *     getPosts: build.query<PostsApiResponse, void>({\n *       query: () => `/posts`,\n *     }),\n *\n *     getPostById: build.query<Post, number>({\n *       query: (postId) => `/posts/${postId}`,\n *     }),\n *   }),\n * })\n *\n * const updatePostOnFulfilled: TypedMutationOnQueryStarted<\n *   Post,\n *   QueryArgument,\n *   BaseQueryFunction,\n *   'postsApi'\n * > = async ({ id, ...patch }, { dispatch, queryFulfilled }) => {\n *   const patchCollection = dispatch(\n *     baseApiSlice.util.updateQueryData('getPostById', id, (draftPost) => {\n *       Object.assign(draftPost, patch)\n *     }),\n *   )\n *\n *   try {\n *     await queryFulfilled\n *   } catch {\n *     patchCollection.undo()\n *   }\n * }\n *\n * export const extendedApiSlice = baseApiSlice.injectEndpoints({\n *   endpoints: (build) => ({\n *     addPost: build.mutation<Post, Omit<QueryArgument, 'id'>>({\n *       query: (body) => ({\n *         url: `posts/add`,\n *         method: 'POST',\n *         body,\n *       }),\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *\n *     updatePost: build.mutation<Post, QueryArgument>({\n *       query: ({ id, ...patch }) => ({\n *         url: `post/${id}`,\n *         method: 'PATCH',\n *         body: patch,\n *       }),\n *\n *       onQueryStarted: updatePostOnFulfilled,\n *     }),\n *   }),\n * })\n * ```\n *\n * @template ResultType - The type of the result `data` returned by the query.\n * @template QueryArgumentType - The type of the argument passed into the query.\n * @template BaseQueryFunctionType - The type of the base query function being used.\n * @template ReducerPath - The type representing the `reducerPath` for the API slice.\n *\n * @since 2.4.0\n * @public\n */\nexport type TypedMutationOnQueryStarted<ResultType, QueryArgumentType, BaseQueryFunctionType extends BaseQueryFn, ReducerPath extends string = string> = QueryLifecycleMutationExtraOptions<ResultType, QueryArgumentType, BaseQueryFunctionType, ReducerPath>['onQueryStarted'];\nexport const buildQueryLifecycleHandler: InternalHandlerBuilder = ({\n  api,\n  context,\n  queryThunk,\n  mutationThunk\n}) => {\n  const isPendingThunk = isPending(queryThunk, mutationThunk);\n  const isRejectedThunk = isRejected(queryThunk, mutationThunk);\n  const isFullfilledThunk = isFulfilled(queryThunk, mutationThunk);\n  type CacheLifecycle = {\n    resolve(value: {\n      data: unknown;\n      meta: unknown;\n    }): unknown;\n    reject(value: QueryFulfilledRejectionReason<any>): unknown;\n  };\n  const lifecycleMap: Record<string, CacheLifecycle> = {};\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (isPendingThunk(action)) {\n      const {\n        requestId,\n        arg: {\n          endpointName,\n          originalArgs\n        }\n      } = action.meta;\n      const endpointDefinition = getEndpointDefinition(context, endpointName);\n      const onQueryStarted = endpointDefinition?.onQueryStarted;\n      if (onQueryStarted) {\n        const lifecycle = {} as CacheLifecycle;\n        const queryFulfilled = new (Promise as PromiseConstructorWithKnownReason)<{\n          data: unknown;\n          meta: unknown;\n        }, QueryFulfilledRejectionReason<any>>((resolve, reject) => {\n          lifecycle.resolve = resolve;\n          lifecycle.reject = reject;\n        });\n        // prevent uncaught promise rejections from happening.\n        // if the original promise is used in any way, that will create a new promise that will throw again\n        queryFulfilled.catch(() => {});\n        lifecycleMap[requestId] = lifecycle;\n        const selector = (api.endpoints[endpointName] as any).select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : requestId);\n        const extra = mwApi.dispatch((_, __, extra) => extra);\n        const lifecycleApi = {\n          ...mwApi,\n          getCacheEntry: () => selector(mwApi.getState()),\n          requestId,\n          extra,\n          updateCachedData: (isAnyQueryDefinition(endpointDefinition) ? (updateRecipe: Recipe<any>) => mwApi.dispatch(api.util.updateQueryData(endpointName as never, originalArgs as never, updateRecipe)) : undefined) as any,\n          queryFulfilled\n        };\n        onQueryStarted(originalArgs, lifecycleApi as any);\n      }\n    } else if (isFullfilledThunk(action)) {\n      const {\n        requestId,\n        baseQueryMeta\n      } = action.meta;\n      lifecycleMap[requestId]?.resolve({\n        data: action.payload,\n        meta: baseQueryMeta\n      });\n      delete lifecycleMap[requestId];\n    } else if (isRejectedThunk(action)) {\n      const {\n        requestId,\n        rejectedWithValue,\n        baseQueryMeta\n      } = action.meta;\n      lifecycleMap[requestId]?.reject({\n        error: action.payload ?? action.error,\n        isUnhandledError: !rejectedWithValue,\n        meta: baseQueryMeta as any\n      });\n      delete lifecycleMap[requestId];\n    }\n  };\n  return handler;\n};","import { QueryStatus, STATUS_UNINITIALIZED } from '../apiState';\nimport type { QueryCacheKey } from '../apiState';\nimport { onFocus, onOnline } from '../setupListeners';\nimport type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, SubMiddlewareApi } from './types';\nexport const buildWindowEventHandler: InternalHandlerBuilder = ({\n  reducerPath,\n  context,\n  api,\n  refetchQuery,\n  internalState\n}) => {\n  const {\n    removeQueryResult\n  } = api.internalActions;\n  const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {\n    if (onFocus.match(action)) {\n      refetchValidQueries(mwApi, 'refetchOnFocus');\n    }\n    if (onOnline.match(action)) {\n      refetchValidQueries(mwApi, 'refetchOnReconnect');\n    }\n  };\n  function refetchValidQueries(api: SubMiddlewareApi, type: 'refetchOnFocus' | 'refetchOnReconnect') {\n    const state = api.getState()[reducerPath];\n    const queries = state.queries;\n    const subscriptions = internalState.currentSubscriptions;\n    context.batch(() => {\n      for (const queryCacheKey of subscriptions.keys()) {\n        const querySubState = queries[queryCacheKey];\n        const subscriptionSubState = subscriptions.get(queryCacheKey);\n        if (!subscriptionSubState || !querySubState) continue;\n        const values = [...subscriptionSubState.values()];\n        const shouldRefetch = values.some(sub => sub[type] === true) || values.every(sub => sub[type] === undefined) && state.config[type];\n        if (shouldRefetch) {\n          if (subscriptionSubState.size === 0) {\n            api.dispatch(removeQueryResult({\n              queryCacheKey: queryCacheKey as QueryCacheKey\n            }));\n          } else if (querySubState.status !== STATUS_UNINITIALIZED) {\n            api.dispatch(refetchQuery(querySubState));\n          }\n        }\n      }\n    });\n  }\n  return handler;\n};","import type { Action, Middleware, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport type { EndpointDefinitions, FullTagDescription } from '../../endpointDefinitions';\nimport type { QueryStatus, QuerySubState, RootState } from '../apiState';\nimport type { QueryThunkArg } from '../buildThunks';\nimport { createAction, isAction } from '../rtkImports';\nimport { buildBatchedActionsHandler } from './batchActions';\nimport { buildCacheCollectionHandler } from './cacheCollection';\nimport { buildCacheLifecycleHandler } from './cacheLifecycle';\nimport { buildDevCheckHandler } from './devMiddleware';\nimport { buildInvalidationByTagsHandler } from './invalidationByTags';\nimport { buildPollingHandler } from './polling';\nimport { buildQueryLifecycleHandler } from './queryLifecycle';\nimport type { BuildMiddlewareInput, InternalHandlerBuilder, InternalMiddlewareState } from './types';\nimport { buildWindowEventHandler } from './windowEventHandling';\nimport type { ApiEndpointQuery } from '../module';\nexport type { ReferenceCacheCollection } from './cacheCollection';\nexport type { MutationCacheLifecycleApi, QueryCacheLifecycleApi, ReferenceCacheLifecycle } from './cacheLifecycle';\nexport type { MutationLifecycleApi, QueryLifecycleApi, ReferenceQueryLifecycle, TypedMutationOnQueryStarted, TypedQueryOnQueryStarted } from './queryLifecycle';\nexport type { SubscriptionSelectors } from './types';\nexport function buildMiddleware<Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string>(input: BuildMiddlewareInput<Definitions, ReducerPath, TagTypes>) {\n  const {\n    reducerPath,\n    queryThunk,\n    api,\n    context,\n    getInternalState\n  } = input;\n  const {\n    apiUid\n  } = context;\n  const actions = {\n    invalidateTags: createAction<Array<TagTypes | FullTagDescription<TagTypes> | null | undefined>>(`${reducerPath}/invalidateTags`)\n  };\n  const isThisApiSliceAction = (action: Action) => action.type.startsWith(`${reducerPath}/`);\n  const handlerBuilders: InternalHandlerBuilder[] = [buildDevCheckHandler, buildCacheCollectionHandler, buildInvalidationByTagsHandler, buildPollingHandler, buildCacheLifecycleHandler, buildQueryLifecycleHandler];\n  const middleware: Middleware<{}, RootState<Definitions, string, ReducerPath>, ThunkDispatch<any, any, UnknownAction>> = mwApi => {\n    let initialized = false;\n    const internalState = getInternalState(mwApi.dispatch);\n    const builderArgs = {\n      ...(input as any as BuildMiddlewareInput<EndpointDefinitions, string, string>),\n      internalState,\n      refetchQuery,\n      isThisApiSliceAction,\n      mwApi\n    };\n    const handlers = handlerBuilders.map(build => build(builderArgs));\n    const batchedActionsHandler = buildBatchedActionsHandler(builderArgs);\n    const windowEventsHandler = buildWindowEventHandler(builderArgs);\n    return next => {\n      return action => {\n        if (!isAction(action)) {\n          return next(action);\n        }\n        if (!initialized) {\n          initialized = true;\n          // dispatch before any other action\n          mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid));\n        }\n        const mwApiWithNext = {\n          ...mwApi,\n          next\n        };\n        const stateBefore = mwApi.getState();\n        const [actionShouldContinue, internalProbeResult] = batchedActionsHandler(action, mwApiWithNext, stateBefore);\n        let res: any;\n        if (actionShouldContinue) {\n          res = next(action);\n        } else {\n          res = internalProbeResult;\n        }\n        if (!!mwApi.getState()[reducerPath]) {\n          // Only run these checks if the middleware is registered okay\n\n          // This looks for actions that aren't specific to the API slice\n          windowEventsHandler(action, mwApiWithNext, stateBefore);\n          if (isThisApiSliceAction(action) || context.hasRehydrationInfo(action)) {\n            // Only run these additional checks if the actions are part of the API slice,\n            // or the action has hydration-related data\n            for (const handler of handlers) {\n              handler(action, mwApiWithNext, stateBefore);\n            }\n          }\n        }\n        return res;\n      };\n    };\n  };\n  return {\n    middleware,\n    actions\n  };\n  function refetchQuery(querySubState: Exclude<QuerySubState<any>, {\n    status: QueryStatus.uninitialized;\n  }>) {\n    return (input.api.endpoints[querySubState.endpointName] as ApiEndpointQuery<any, any>).initiate(querySubState.originalArgs as any, {\n      subscribe: false,\n      forceRefetch: true\n    });\n  }\n}","/**\n * Note: this file should import all other files for type discovery and declaration merging\n */\nimport type { ActionCreatorWithPayload, Dispatch, Middleware, Reducer, ThunkAction, ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';\nimport { enablePatches } from '../utils/immerImports';\nimport type { Api, Module } from '../apiTypes';\nimport type { BaseQueryFn } from '../baseQueryTypes';\nimport type { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs';\nimport type { AssertTagTypes, EndpointDefinitions, InfiniteQueryDefinition, MutationDefinition, QueryArgFrom, QueryArgFromAnyQuery, QueryDefinition, TagDescription } from '../endpointDefinitions';\nimport { isInfiniteQueryDefinition, isMutationDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { assertCast, safeAssign } from '../tsHelpers';\nimport type { CombinedState, MutationKeys, QueryKeys, RootState } from './apiState';\nimport type { BuildInitiateApiEndpointMutation, BuildInitiateApiEndpointQuery, MutationActionCreatorResult, QueryActionCreatorResult, InfiniteQueryActionCreatorResult, BuildInitiateApiEndpointInfiniteQuery } from './buildInitiate';\nimport { buildInitiate } from './buildInitiate';\nimport type { ReferenceCacheCollection, ReferenceCacheLifecycle, ReferenceQueryLifecycle } from './buildMiddleware';\nimport { buildMiddleware } from './buildMiddleware';\nimport type { BuildSelectorsApiEndpointInfiniteQuery, BuildSelectorsApiEndpointMutation, BuildSelectorsApiEndpointQuery } from './buildSelectors';\nimport { buildSelectors } from './buildSelectors';\nimport type { SliceActions, UpsertEntries } from './buildSlice';\nimport { buildSlice } from './buildSlice';\nimport type { AllQueryKeys, BuildThunksApiEndpointInfiniteQuery, BuildThunksApiEndpointMutation, BuildThunksApiEndpointQuery, PatchQueryDataThunk, QueryArgFromAnyQueryDefinition, UpdateQueryDataThunk, UpsertQueryDataThunk } from './buildThunks';\nimport { buildThunks } from './buildThunks';\nimport { createSelector as _createSelector } from './rtkImports';\nimport { onFocus, onFocusLost, onOffline, onOnline } from './setupListeners';\nimport type { InternalMiddlewareState } from './buildMiddleware/types';\nimport { getOrInsertComputed } from '../utils';\nimport type { CreateSelectorFunction } from 'reselect';\n\n/**\n * `ifOlderThan` - (default: `false` | `number`) - _number is value in seconds_\n * - If specified, it will only run the query if the difference between `new Date()` and the last `fulfilledTimeStamp` is greater than the given value\n *\n * @overloadSummary\n * `force`\n * - If `force: true`, it will ignore the `ifOlderThan` value if it is set and the query will be run even if it exists in the cache.\n */\nexport type PrefetchOptions = {\n  ifOlderThan?: false | number;\n} | {\n  force?: boolean;\n};\nexport const coreModuleName = /* @__PURE__ */Symbol();\nexport type CoreModule = typeof coreModuleName | ReferenceCacheLifecycle | ReferenceQueryLifecycle | ReferenceCacheCollection;\nexport type ThunkWithReturnValue<T> = ThunkAction<T, any, any, UnknownAction>;\nexport interface ApiModules<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nBaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string> {\n  [coreModuleName]: {\n    /**\n     * This api's reducer should be mounted at `store[api.reducerPath]`.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    reducerPath: ReducerPath;\n    /**\n     * Internal actions not part of the public API. Note: These are subject to change at any given time.\n     */\n    internalActions: InternalActions;\n    /**\n     *  A standard redux reducer that enables core functionality. Make sure it's included in your store.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    reducer: Reducer<CombinedState<Definitions, TagTypes, ReducerPath>, UnknownAction>;\n    /**\n     * This is a standard redux middleware and is responsible for things like polling, garbage collection and a handful of other things. Make sure it's included in your store.\n     *\n     * @example\n     * ```ts\n     * configureStore({\n     *   reducer: {\n     *     [api.reducerPath]: api.reducer,\n     *   },\n     *   middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),\n     * })\n     * ```\n     */\n    middleware: Middleware<{}, RootState<Definitions, string, ReducerPath>, ThunkDispatch<any, any, UnknownAction>>;\n    /**\n     * A collection of utility thunks for various situations.\n     */\n    util: {\n      /**\n       * A thunk that (if dispatched) will return a specific running query, identified\n       * by `endpointName` and `arg`.\n       * If that query is not running, dispatching the thunk will result in `undefined`.\n       *\n       * Can be used to await a specific query triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningQueryThunk<EndpointName extends AllQueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFromAnyQueryDefinition<Definitions, EndpointName>): ThunkWithReturnValue<QueryActionCreatorResult<Definitions[EndpointName] & {\n        type: 'query';\n      }> | InfiniteQueryActionCreatorResult<Definitions[EndpointName] & {\n        type: 'infinitequery';\n      }> | undefined>;\n\n      /**\n       * A thunk that (if dispatched) will return a specific running mutation, identified\n       * by `endpointName` and `fixedCacheKey` or `requestId`.\n       * If that mutation is not running, dispatching the thunk will result in `undefined`.\n       *\n       * Can be used to await a specific mutation triggered in any way,\n       * including via hook trigger functions or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningMutationThunk<EndpointName extends MutationKeys<Definitions>>(endpointName: EndpointName, fixedCacheKeyOrRequestId: string): ThunkWithReturnValue<MutationActionCreatorResult<Definitions[EndpointName] & {\n        type: 'mutation';\n      }> | undefined>;\n\n      /**\n       * A thunk that (if dispatched) will return all running queries.\n       *\n       * Useful for SSR scenarios to await all running queries triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningQueriesThunk(): ThunkWithReturnValue<Array<QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>>;\n\n      /**\n       * A thunk that (if dispatched) will return all running mutations.\n       *\n       * Useful for SSR scenarios to await all running mutations triggered in any way,\n       * including via hook calls or manually dispatching `initiate` actions.\n       *\n       * See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.\n       */\n      getRunningMutationsThunk(): ThunkWithReturnValue<Array<MutationActionCreatorResult<any>>>;\n\n      /**\n       * A Redux thunk that can be used to manually trigger pre-fetching of data.\n       *\n       * The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a set of options used to determine if the data actually should be re-fetched based on cache staleness.\n       *\n       * React Hooks users will most likely never need to use this directly, as the `usePrefetch` hook will dispatch this thunk internally as needed when you call the prefetching function supplied by the hook.\n       *\n       * @example\n       *\n       * ```ts no-transpile\n       * dispatch(api.util.prefetch('getPosts', undefined, { force: true }))\n       * ```\n       */\n      prefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions): ThunkAction<void, any, any, UnknownAction>;\n      /**\n       * A Redux thunk action creator that, when dispatched, creates and applies a set of JSON diff/patch objects to the current state. This immediately updates the Redux state with those changes.\n       *\n       * The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and an `updateRecipe` callback function. The callback receives an Immer-wrapped `draft` of the current state, and may modify the draft to match the expected results after the mutation completes successfully.\n       *\n       * The thunk executes _synchronously_, and returns an object containing `{patches: Patch[], inversePatches: Patch[], undo: () => void}`. The `patches` and `inversePatches` are generated using Immer's [`produceWithPatches` method](https://immerjs.github.io/immer/patches).\n       *\n       * This is typically used as the first step in implementing optimistic updates. The generated `inversePatches` can be used to revert the updates by calling `dispatch(patchQueryData(endpointName, arg, inversePatches))`. Alternatively, the `undo` method can be called directly to achieve the same effect.\n       *\n       * Note that the first two arguments (`endpointName` and `arg`) are used to determine which existing cache entry to update. If no existing cache entry is found, the `updateRecipe` callback will not run.\n       *\n       * @example\n       *\n       * ```ts\n       * const patchCollection = dispatch(\n       *   api.util.updateQueryData('getPosts', undefined, (draftPosts) => {\n       *     draftPosts.push({ id: 1, name: 'Teddy' })\n       *   })\n       * )\n       * ```\n       */\n      updateQueryData: UpdateQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n\n      /**\n       * A Redux thunk action creator that, when dispatched, acts as an artificial API request to upsert a value into the cache.\n       *\n       * The thunk action creator accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and the data to upsert.\n       *\n       * If no cache entry for that cache key exists, a cache entry will be created and the data added. If a cache entry already exists, this will _overwrite_ the existing cache entry data.\n       *\n       * The thunk executes _asynchronously_, and returns a promise that resolves when the store has been updated.\n       *\n       * If dispatched while an actual request is in progress, both the upsert and request will be handled as soon as they resolve, resulting in a \"last result wins\" update behavior.\n       *\n       * @example\n       *\n       * ```ts\n       * await dispatch(\n       *   api.util.upsertQueryData('getPost', {id: 1}, {id: 1, text: \"Hello!\"})\n       * )\n       * ```\n       */\n      upsertQueryData: UpsertQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n      /**\n       * A Redux thunk that applies a JSON diff/patch array to the cached data for a given query result. This immediately updates the Redux state with those changes.\n       *\n       * The thunk accepts three arguments: the name of the endpoint we are updating (such as `'getPost'`), the appropriate query arg values to construct the desired cache key, and a JSON diff/patch array as produced by Immer's `produceWithPatches`.\n       *\n       * This is typically used as the second step in implementing optimistic updates. If a request fails, the optimistically-applied changes can be reverted by dispatching `patchQueryData` with the `inversePatches` that were generated by `updateQueryData` earlier.\n       *\n       * In cases where it is desired to simply revert the previous changes, it may be preferable to call the `undo` method returned from dispatching `updateQueryData` instead.\n       *\n       * @example\n       * ```ts\n       * const patchCollection = dispatch(\n       *   api.util.updateQueryData('getPosts', undefined, (draftPosts) => {\n       *     draftPosts.push({ id: 1, name: 'Teddy' })\n       *   })\n       * )\n       *\n       * // later\n       * dispatch(\n       *   api.util.patchQueryData('getPosts', undefined, patchCollection.inversePatches)\n       * )\n       *\n       * // or\n       * patchCollection.undo()\n       * ```\n       */\n      patchQueryData: PatchQueryDataThunk<Definitions, RootState<Definitions, string, ReducerPath>>;\n\n      /**\n       * A Redux action creator that can be dispatched to manually reset the api state completely. This will immediately remove all existing cache entries, and all queries will be considered 'uninitialized'.\n       *\n       * @example\n       *\n       * ```ts\n       * dispatch(api.util.resetApiState())\n       * ```\n       */\n      resetApiState: SliceActions['resetApiState'];\n      upsertQueryEntries: UpsertEntries<Definitions>;\n\n      /**\n       * A Redux action creator that can be used to manually invalidate cache tags for [automated re-fetching](../../usage/automated-refetching.mdx).\n       *\n       * The action creator accepts one argument: the cache tags to be invalidated. It returns an action with those tags as a payload, and the corresponding `invalidateTags` action type for the api.\n       *\n       * Dispatching the result of this action creator will [invalidate](../../usage/automated-refetching.mdx#invalidating-cache-data) the given tags, causing queries to automatically re-fetch if they are subscribed to cache data that [provides](../../usage/automated-refetching.mdx#providing-cache-data) the corresponding tags.\n       *\n       * The array of tags provided to the action creator should be in one of the following formats, where `TagType` is equal to a string provided to the [`tagTypes`](../createApi.mdx#tagtypes) property of the api:\n       *\n       * - `[TagType]`\n       * - `[{ type: TagType }]`\n       * - `[{ type: TagType, id: number | string }]`\n       *\n       * @example\n       *\n       * ```ts\n       * dispatch(api.util.invalidateTags(['Post']))\n       * dispatch(api.util.invalidateTags([{ type: 'Post', id: 1 }]))\n       * dispatch(\n       *   api.util.invalidateTags([\n       *     { type: 'Post', id: 1 },\n       *     { type: 'Post', id: 'LIST' },\n       *   ])\n       * )\n       * ```\n       */\n      invalidateTags: ActionCreatorWithPayload<Array<TagDescription<TagTypes> | null | undefined>, string>;\n\n      /**\n       * A function to select all `{ endpointName, originalArgs, queryCacheKey }` combinations that would be invalidated by a specific set of tags.\n       *\n       * Can be used for mutations that want to do optimistic updates instead of invalidating a set of tags, but don't know exactly what they need to update.\n       */\n      selectInvalidatedBy: (state: RootState<Definitions, string, ReducerPath>, tags: ReadonlyArray<TagDescription<TagTypes> | null | undefined>) => Array<{\n        endpointName: string;\n        originalArgs: any;\n        queryCacheKey: string;\n      }>;\n\n      /**\n       * A function to select all arguments currently cached for a given endpoint.\n       *\n       * Can be used for mutations that want to do optimistic updates instead of invalidating a set of tags, but don't know exactly what they need to update.\n       */\n      selectCachedArgsForQuery: <QueryName extends AllQueryKeys<Definitions>>(state: RootState<Definitions, string, ReducerPath>, queryName: QueryName) => Array<QueryArgFromAnyQuery<Definitions[QueryName]>>;\n    };\n    /**\n     * Endpoints based on the input endpoints provided to `createApi`, containing `select` and `action matchers`.\n     */\n    endpoints: { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? ApiEndpointQuery<Definitions[K], Definitions> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? ApiEndpointMutation<Definitions[K], Definitions> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? ApiEndpointInfiniteQuery<Definitions[K], Definitions> : never };\n  };\n}\nexport interface ApiEndpointQuery<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends QueryDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointQuery<Definition>, BuildInitiateApiEndpointQuery<Definition>, BuildSelectorsApiEndpointQuery<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\nexport interface ApiEndpointInfiniteQuery<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends InfiniteQueryDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointInfiniteQuery<Definition>, BuildInitiateApiEndpointInfiniteQuery<Definition>, BuildSelectorsApiEndpointInfiniteQuery<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport interface ApiEndpointMutation<\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinition extends MutationDefinition<any, any, any, any, any>,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nDefinitions extends EndpointDefinitions> extends BuildThunksApiEndpointMutation<Definition>, BuildInitiateApiEndpointMutation<Definition>, BuildSelectorsApiEndpointMutation<Definition, Definitions> {\n  name: string;\n  /**\n   * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n   */\n  Types: NonNullable<Definition['Types']>;\n}\nexport type ListenerActions = {\n  /**\n   * Will cause the RTK Query middleware to trigger any refetchOnReconnect-related behavior\n   * @link https://redux-toolkit.js.org/rtk-query/api/setupListeners\n   */\n  onOnline: typeof onOnline;\n  onOffline: typeof onOffline;\n  /**\n   * Will cause the RTK Query middleware to trigger any refetchOnFocus-related behavior\n   * @link https://redux-toolkit.js.org/rtk-query/api/setupListeners\n   */\n  onFocus: typeof onFocus;\n  onFocusLost: typeof onFocusLost;\n};\nexport type InternalActions = SliceActions & ListenerActions;\nexport interface CoreModuleOptions {\n  /**\n   * A selector creator (usually from `reselect`, or matching the same signature)\n   */\n  createSelector?: CreateSelectorFunction<any, any, any>;\n}\n\n/**\n * Creates a module containing the basic redux logic for use with `buildCreateApi`.\n *\n * @example\n * ```ts\n * const createBaseApi = buildCreateApi(coreModule());\n * ```\n */\nexport const coreModule = ({\n  createSelector = _createSelector\n}: CoreModuleOptions = {}): Module<CoreModule> => ({\n  name: coreModuleName,\n  init(api, {\n    baseQuery,\n    tagTypes,\n    reducerPath,\n    serializeQueryArgs,\n    keepUnusedDataFor,\n    refetchOnMountOrArgChange,\n    refetchOnFocus,\n    refetchOnReconnect,\n    invalidationBehavior,\n    onSchemaFailure,\n    catchSchemaFailure,\n    skipSchemaValidation\n  }, context) {\n    enablePatches();\n    assertCast<InternalSerializeQueryArgs>(serializeQueryArgs);\n    const assertTagType: AssertTagTypes = tag => {\n      if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n        if (!tagTypes.includes(tag.type as any)) {\n          console.error(`Tag type '${tag.type}' was used, but not specified in \\`tagTypes\\`!`);\n        }\n      }\n      return tag;\n    };\n    Object.assign(api, {\n      reducerPath,\n      endpoints: {},\n      internalActions: {\n        onOnline,\n        onOffline,\n        onFocus,\n        onFocusLost\n      },\n      util: {}\n    });\n    const selectors = buildSelectors({\n      serializeQueryArgs: serializeQueryArgs as any,\n      reducerPath,\n      createSelector\n    });\n    const {\n      selectInvalidatedBy,\n      selectCachedArgsForQuery,\n      buildQuerySelector,\n      buildInfiniteQuerySelector,\n      buildMutationSelector\n    } = selectors;\n    safeAssign(api.util, {\n      selectInvalidatedBy,\n      selectCachedArgsForQuery\n    });\n    const {\n      queryThunk,\n      infiniteQueryThunk,\n      mutationThunk,\n      patchQueryData,\n      updateQueryData,\n      upsertQueryData,\n      prefetch,\n      buildMatchThunkActions\n    } = buildThunks({\n      baseQuery,\n      reducerPath,\n      context,\n      api,\n      serializeQueryArgs,\n      assertTagType,\n      selectors,\n      onSchemaFailure,\n      catchSchemaFailure,\n      skipSchemaValidation\n    });\n    const {\n      reducer,\n      actions: sliceActions\n    } = buildSlice({\n      context,\n      queryThunk,\n      infiniteQueryThunk,\n      mutationThunk,\n      serializeQueryArgs,\n      reducerPath,\n      assertTagType,\n      config: {\n        refetchOnFocus,\n        refetchOnReconnect,\n        refetchOnMountOrArgChange,\n        keepUnusedDataFor,\n        reducerPath,\n        invalidationBehavior\n      }\n    });\n    safeAssign(api.util, {\n      patchQueryData,\n      updateQueryData,\n      upsertQueryData,\n      prefetch,\n      resetApiState: sliceActions.resetApiState,\n      upsertQueryEntries: sliceActions.cacheEntriesUpserted as any\n    });\n    safeAssign(api.internalActions, sliceActions);\n    const internalStateMap = new WeakMap<Dispatch, InternalMiddlewareState>();\n    const getInternalState = (dispatch: Dispatch) => {\n      const state = getOrInsertComputed(internalStateMap, dispatch, () => ({\n        currentSubscriptions: new Map(),\n        currentPolls: new Map(),\n        runningQueries: new Map(),\n        runningMutations: new Map()\n      }));\n      return state;\n    };\n    const {\n      buildInitiateQuery,\n      buildInitiateInfiniteQuery,\n      buildInitiateMutation,\n      getRunningMutationThunk,\n      getRunningMutationsThunk,\n      getRunningQueriesThunk,\n      getRunningQueryThunk\n    } = buildInitiate({\n      queryThunk,\n      mutationThunk,\n      infiniteQueryThunk,\n      api,\n      serializeQueryArgs: serializeQueryArgs as any,\n      context,\n      getInternalState\n    });\n    safeAssign(api.util, {\n      getRunningMutationThunk,\n      getRunningMutationsThunk,\n      getRunningQueryThunk,\n      getRunningQueriesThunk\n    });\n    const {\n      middleware,\n      actions: middlewareActions\n    } = buildMiddleware({\n      reducerPath,\n      context,\n      queryThunk,\n      mutationThunk,\n      infiniteQueryThunk,\n      api,\n      assertTagType,\n      selectors,\n      getRunningQueryThunk,\n      getInternalState\n    });\n    safeAssign(api.util, middlewareActions);\n    safeAssign(api, {\n      reducer: reducer as any,\n      middleware\n    });\n    return {\n      name: coreModuleName,\n      injectEndpoint(endpointName, definition) {\n        const anyApi = api as any as Api<any, Record<string, any>, string, string, CoreModule>;\n        const endpoint = anyApi.endpoints[endpointName] ??= {} as any;\n        if (isQueryDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildQuerySelector(endpointName, definition),\n            initiate: buildInitiateQuery(endpointName, definition)\n          }, buildMatchThunkActions(queryThunk, endpointName));\n        }\n        if (isMutationDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildMutationSelector(),\n            initiate: buildInitiateMutation(endpointName)\n          }, buildMatchThunkActions(mutationThunk, endpointName));\n        }\n        if (isInfiniteQueryDefinition(definition)) {\n          safeAssign(endpoint, {\n            name: endpointName,\n            select: buildInfiniteQuerySelector(endpointName, definition),\n            initiate: buildInitiateInfiniteQuery(endpointName, definition)\n          }, buildMatchThunkActions(queryThunk, endpointName));\n        }\n      }\n    };\n  }\n});","import { buildCreateApi } from '../createApi';\nimport { coreModule } from './module';\nexport const createApi = /* @__PURE__ */buildCreateApi(coreModule());\nexport { QueryStatus } from './apiState';\nexport type { CombinedState, InfiniteData, InfiniteQueryConfigOptions, InfiniteQuerySubState, MutationKeys, QueryCacheKey, QueryKeys, QuerySubState, RootState, SubscriptionOptions } from './apiState';\nexport type { InfiniteQueryActionCreatorResult, MutationActionCreatorResult, QueryActionCreatorResult, StartQueryActionCreatorOptions } from './buildInitiate';\nexport type { MutationCacheLifecycleApi, MutationLifecycleApi, QueryCacheLifecycleApi, QueryLifecycleApi, SubscriptionSelectors, TypedMutationOnQueryStarted, TypedQueryOnQueryStarted } from './buildMiddleware/index';\nexport { skipToken } from './buildSelectors';\nexport type { InfiniteQueryResultSelectorResult, MutationResultSelectorResult, QueryResultSelectorResult, SkipToken } from './buildSelectors';\nexport type { SliceActions } from './buildSlice';\nexport type { PatchQueryDataThunk, UpdateQueryDataThunk, UpsertQueryDataThunk } from './buildThunks';\nexport { coreModuleName } from './module';\nexport type { ApiEndpointInfiniteQuery, ApiEndpointMutation, ApiEndpointQuery, CoreModule, InternalActions, PrefetchOptions, ThunkWithReturnValue } from './module';\nexport { setupListeners } from './setupListeners';\nexport { buildCreateApi, coreModule };"],"mappings":";AAkEO,IAAK,cAAL,kBAAKA,iBAAL;AACL,EAAAA,aAAA,mBAAgB;AAChB,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,eAAY;AACZ,EAAAA,aAAA,cAAW;AAJD,SAAAA;AAAA,GAAA;AAQL,IAAM,uBAAuB;AAC7B,IAAM,iBAAiB;AACvB,IAAM,mBAAmB;AACzB,IAAM,kBAAkB;AA0BxB,SAAS,sBAAsB,QAAyC;AAC7E,SAAO;AAAA,IACL;AAAA,IACA,iBAAiB,WAAW;AAAA,IAC5B,WAAW,WAAW;AAAA,IACtB,WAAW,WAAW;AAAA,IACtB,SAAS,WAAW;AAAA,EACtB;AACF;;;AC3GA,SAAS,cAAc,aAAa,gBAAgB,k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,IAAM,YAA2B,+BAAe,WAAW,CAAC;","names":["QueryStatus","isPlainObject","retry","updateListeners","arg","force","options","actions","createSelector","_formatProdErrorMessage","_formatProdErrorMessage2","key","queryArgsApi","_formatProdErrorMessage","getPreviousPageParam","_formatProdErrorMessage2","_formatProdErrorMessage","mwApi","mwApi","api","cacheKey","extra","api","extra","api","actions","initialized","createSelector"]}
