(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.RTK = {})); }(this, (function (exports) { 'use strict'; exports.QueryStatus = void 0;var t,n,r,i=undefined&&undefined.__generator||function(e,t){var n,r,i,u,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return u={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function o(u){return function(o){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:S(e)?2:R(e)?3:0}function j(e,t){return 2===w(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function q(e,t){return 2===w(e)?e.get(t):e[t]}function A(e,t,n){var r=w(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n;}function P(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function S(e){return Y&&e instanceof Map}function R(e){return Z&&e instanceof Set}function T(e){return e.o||e.t}function E(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=ae(e);delete t[re];for(var n=ue(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=k),Object.freeze(e),t&&O(e,(function(e,t){return I(t,!0)}),!0)),e}function k(){m(2);}function x(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function C(e){var t=oe[e];return t||m(18,e),t}function D(e,t){oe[e]||(oe[e]=t);}function Q(){return r}function N(e,t){t&&(C("Patches"),e.u=[],e.s=[],e.v=t);}function M(e){_(e),e.p.forEach(K),e.p=null;}function _(e){e===r&&(r=e.l);}function F(e){return r={p:[],l:r,h:e,m:!0,_:0}}function K(e){var t=e[re];0===t.i||1===t.i?t.j():t.g=!0;}function z(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.O||C("ES5").S(t,e,r),r?(n[re].P&&(M(t),m(4)),b(e)&&(e=L(t,e),t.l||W(t,e)),t.u&&C("Patches").M(n[re],e,t.u,t.s)):e=L(t,n,[]),M(t),t.u&&t.v(t.u,t.s),e!==te?e:void 0}function L(e,t,n){if(x(t))return t;var r=t[re];if(!r)return O(t,(function(i,u){return U(e,r,t,i,u,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return W(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=E(r.k):r.o;O(3===r.i?new Set(i):i,(function(t,u){return U(e,r,i,t,u,n)})),W(e,i,!1),n&&e.u&&C("Patches").R(r,n,e.u,e.s);}return r.o}function U(e,t,n,r,i,u){if(g(i)){var a=L(e,i,u&&t&&3!==t.i&&!j(t.D,r)?u.concat(r):void 0);if(A(n,r,a),!g(a))return;e.m=!1;}if(b(i)&&!x(i)){if(!e.h.F&&e._<1)return;L(e,i),t&&t.A.l||W(e,i);}}function W(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&I(t,n);}function V(e,t){var n=e[re];return (n?T(n):e)[t]}function H(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n);}}function J(e){e.P||(e.P=!0,e.l&&J(e.l));}function B(e){e.o||(e.o=E(e.t));}function G(e,t,n){var r=S(t)?C("MapSet").N(t,n):R(t)?C("MapSet").T(t,n):e.O?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:Q(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=r,u=ce;n&&(i=[r],u=se);var a=Proxy.revocable(i,u),o=a.revoke,c=a.proxy;return r.k=c,r.j=o,c}(t,n):C("ES5").J(t,n);return (n?n.A:Q()).p.push(r),r}function $(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return E(e)}(t=exports.QueryStatus||(exports.QueryStatus={})).uninitialized="uninitialized",t.pending="pending",t.fulfilled="fulfilled",t.rejected="rejected";var X="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Y="undefined"!=typeof Map,Z="undefined"!=typeof Set,ee="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,te=X?Symbol.for("immer-nothing"):((n={})["immer-nothing"]=!0,n),ne=X?Symbol.for("immer-draftable"):"__$immer_draftable",re=X?Symbol.for("immer-state"):"__$immer_state",ie=(""+Object.prototype.constructor),ue="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,ae=Object.getOwnPropertyDescriptors||function(e){var t={};return ue(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n);})),t},oe={},ce={get:function(e,t){if(t===re)return e;var n,r,i,u=T(e);if(!j(u,t))return n=e,(i=H(u,t))?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(n.k):void 0;var a=u[t];return e.I||!b(a)?a:a===V(e.t,t)?(B(e),e.o[t]=G(e.A.h,a,e)):a},has:function(e,t){return t in T(e)},ownKeys:function(e){return Reflect.ownKeys(T(e))},set:function(e,t,n){var r=H(T(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var i=V(T(e),t),u=null==i?void 0:i[re];if(u&&u.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(P(n,i)&&(void 0!==n||j(e.t,t)))return !0;B(e),J(e);}return e.o[t]===n&&"number"!=typeof n||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==V(e.t,t)||t in e.t?(e.D[t]=!1,B(e),J(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=T(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){m(11);},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){m(12);}},se={};O(ce,(function(e,t){se[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)};})),se.deleteProperty=function(e,t){return ce.deleteProperty.call(this,e[0],t)},se.set=function(e,t,n){return ce.set.call(this,e[0],t,n,e[0])};var fe=new(function(){function e(e){var t=this;this.O=ee,this.F=!0,this.produce=function(e,n,r){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var u=t;return function(e){var t=this;void 0===e&&(e=i);for(var r=arguments.length,a=Array(r>1?r-1:0),o=1;o1?r-1:0),u=1;u=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}var i=C("Patches").$;return g(e)?i(e,t):this.produce(e,(function(e){return i(e,t.slice(n+1))}))},e}()),le=fe.produce,de=fe.produceWithPatches.bind(fe),pe=(fe.setAutoFreeze.bind(fe),fe.setUseProxies.bind(fe),fe.applyPatches.bind(fe)),ve=(fe.createDraft.bind(fe),fe.finishDraft.bind(fe),le);function he(e){return "Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var ye=function(){return Math.random().toString(36).substring(7).split("").join(".")},me={INIT:"@@redux/INIT"+ye(),REPLACE:"@@redux/REPLACE"+ye(),PROBE_UNKNOWN_ACTION:function(){return "@@redux/PROBE_UNKNOWN_ACTION"+ye()}};function ge(){for(var e=arguments.length,t=new Array(e),n=0;n1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:be,n=null,r=null;return function(){return Oe(t,n,arguments)||(r=e.apply(null,arguments)),n=arguments,r}}));function qe(e){if("object"!=typeof e||null===e)return !1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Ae(e,t){function n(){for(var n=[],r=0;r-1;return n&&r}function _e(e){return "function"==typeof e[0]&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Fe(){for(var e=[],t=0;t=0;t--){var i=e[t][re];if(!i.P)switch(i.i){case 5:r(i)&&J(i);break;case 4:n(i)&&J(i);}}}function n(e){for(var t=e.t,n=e.k,r=ue(n),i=r.length-1;i>=0;i--){var u=r[i];if(u!==re){var a=t[u];if(void 0===a&&!j(t,u))return !0;var o=n[u],c=o&&o[re];if(c?c.t!==a:!P(o,a))return !0}}var s=!!t[re];return r.length!==ue(t).length+(s?0:1)}function r(e){var t=e.k;if(t.length!==e.t.length)return !0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);return !(!n||n.get)}var i={};D("ES5",{J:function(t,n){var r=Array.isArray(t),i=function(t,n){if(t){for(var r=Array(n.length),i=0;i=200&&e.status<=299},Be=function(e,t){return y(void 0,null,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return "function"==typeof t?[2,t(e)]:"text"===t?[2,e.text()]:"json"!==t?[3,2]:[4,e.text()];case 1:return [2,(n=r.sent()).length?JSON.parse(n):void 0];case 2:return [2]}}))}))};function Ge(e){if(!qe(e))return e;for(var t=p({},e),n=0,r=Object.entries(t);na.maxRetries){if(s instanceof Xe)return [2,s.value];throw s}return [4,a.backoff(o,a.maxRetries)];case 5:return i.sent(),[3,6];case 6:return [3,1];case 7:return [2]}}))}))}}),{fail:function(e){throw Object.assign(new Xe({error:e}),{throwImmediately:!0})}}),et=Ae("__rtkq/focused"),tt=Ae("__rtkq/unfocused"),nt=Ae("__rtkq/online"),rt=Ae("__rtkq/offline"),it=!1;function ut(e,t){return t?t(e,{onFocus:et,onFocusLost:tt,onOffline:rt,onOnline:nt}):(n=function(){return e(et())},r=function(){return e(nt())},i=function(){return e(rt())},u=function(){"visible"===window.document.visibilityState?n():e(tt());},it||"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("visibilitychange",u,!1),window.addEventListener("focus",n,!1),window.addEventListener("online",r,!1),window.addEventListener("offline",i,!1),it=!0),function(){window.removeEventListener("focus",n),window.removeEventListener("visibilitychange",u),window.removeEventListener("online",r),window.removeEventListener("offline",i),it=!1;});var n,r,i,u;}var at,ot,ct=Symbol.for("RTKQ/skipToken"),st=ct,ft={status:exports.QueryStatus.uninitialized},lt=ve(ft,(function(){})),dt=ve(ft,(function(){})),pt=function(e){return e.endpointName+"("+JSON.stringify(e.queryArgs,(function(e,t){return qe(t)?Object.keys(t).sort().reduce((function(e,n){return e[n]=t[n],e}),{}):t}))+")"};function vt(e,t,n,r,i){return "function"==typeof e?e(t,n,r).map(ht).map(i):Array.isArray(e)?e.map(ht).map(i):[]}function ht(e){return "string"==typeof e?{type:e}:e}function yt(){for(var e=[],t=0;t=c))},dispatchConditionRejection:!0}),mutationThunk:xe(r+"/executeMutation",s,{getPendingMeta:function(){return {startedTimeStamp:Date.now()}}}),prefetch:function(e,t,n){return function(r,i){var u=function(e){return "force"in e}(n)&&n.force,a=function(e){return "ifOlderThan"in e}(n)&&n.ifOlderThan,o=function(n){return void 0===n&&(n=!0),c.endpoints[e].initiate(t,{forceRefetch:n})},s=c.endpoints[e].select(t)(i());if(u)r(o());else if(a){var f=null==s?void 0:s.fulfilledTimeStamp;if(!f)return void r(o());(Number(new Date)-Number(new Date(f)))/1e3>=a&&r(o());}else r(o(!1));}},updateQueryData:function(t,n,r){return function(i,u){var a,o,s=c.endpoints[t].select(n)(u()),f={patches:[],inversePatches:[],undo:function(){return i(c.util.patchQueryData(t,n,f.inversePatches))}};if(s.status===exports.QueryStatus.uninitialized)return f;if("data"in s)if(b(s.data)){var l=de(s.data,r),d=l[2];(a=f.patches).push.apply(a,l[1]),(o=f.inversePatches).push.apply(o,d);}else {var p=r(s.data);f.patches.push({op:"replace",path:[],value:p}),f.inversePatches.push({op:"replace",path:[],value:s.data});}return i(c.util.patchQueryData(t,n,f.patches)),f}},patchQueryData:function(e,t,n){return function(r){r(c.internalActions.queryResultPatched({queryCacheKey:o({queryArgs:t,endpointDefinition:a[e],endpointName:e}),patches:n}));}},buildMatchThunkActions:function(e,t){return {matchPending:Ne(Fe(e),f(t)),matchFulfilled:Ne(Le(e),f(t)),matchRejected:Ne(Ke(e),f(t))}}}}({baseQuery:u,reducerPath:a,context:r,api:t,serializeQueryArgs:o}),A=h.queryThunk,P=h.mutationThunk,T=h.patchQueryData,E=h.updateQueryData,I=h.prefetch,k=h.buildMatchThunkActions,x=function(t){var n=t.reducerPath,r=t.queryThunk,i=t.mutationThunk,u=t.context,a=u.endpointDefinitions,o=u.apiUid,c=t.assertTagType,s=t.config,f=Ae(n+"/resetApiState"),l=Se({name:n+"/queries",initialState:jt,reducers:{removeQueryResult:function(e,t){delete e[t.payload.queryCacheKey];},queryResultPatched:function(e,t){var n=t.payload,r=n.patches;Ot(e,n.queryCacheKey,(function(e){e.data=pe(e.data,r.concat());}));}},extraReducers:function(t){t.addCase(r.pending,(function(t,n){var r,i=n.meta,u=n.meta.arg;u.subscribe&&(null!=t[r=u.queryCacheKey]||(t[r]={status:exports.QueryStatus.uninitialized,endpointName:u.endpointName})),Ot(t,u.queryCacheKey,(function(t){t.status=exports.QueryStatus.pending,t.requestId=i.requestId,t.originalArgs=u.originalArgs,t.startedTimeStamp=i.startedTimeStamp;}));})).addCase(r.fulfilled,(function(t,n){var r=n.meta,i=n.payload;Ot(t,r.arg.queryCacheKey,(function(t){t.requestId===r.requestId&&(t.status=exports.QueryStatus.fulfilled,t.data=Ve(t.data,i),delete t.error,t.fulfilledTimeStamp=r.fulfilledTimeStamp);}));})).addCase(r.rejected,(function(t,n){var r=n.meta,i=r.condition,u=r.requestId,a=n.error,o=n.payload;Ot(t,r.arg.queryCacheKey,(function(t){if(i);else {if(t.requestId!==u)return;t.status=exports.QueryStatus.rejected,t.error=null!=o?o:a;}}));}));}}),d=Se({name:n+"/mutations",initialState:jt,reducers:{unsubscribeMutationResult:function(e,t){t.payload.requestId in e&&delete e[t.payload.requestId];}},extraReducers:function(t){t.addCase(i.pending,(function(t,n){var r=n.meta,i=r.arg;i.track&&(t[r.requestId]={status:exports.QueryStatus.pending,endpointName:i.endpointName,startedTimeStamp:r.startedTimeStamp});})).addCase(i.fulfilled,(function(t,n){var r=n.payload,i=n.meta;i.arg.track&&wt(t,{requestId:n.meta.requestId},(function(t){t.status=exports.QueryStatus.fulfilled,t.data=r,t.fulfilledTimeStamp=i.fulfilledTimeStamp;}));})).addCase(i.rejected,(function(t,n){var r=n.payload,i=n.error,u=n.meta;u.arg.track&&wt(t,{requestId:u.requestId},(function(t){t.status=exports.QueryStatus.rejected,t.error=null!=r?r:i;}));}));}}),h=Se({name:n+"/invalidation",initialState:jt,reducers:{},extraReducers:function(e){e.addCase(l.actions.removeQueryResult,(function(e,t){for(var n=t.payload.queryCacheKey,r=0,i=Object.values(e);r