@reduxjs/toolkit
Advanced tools
Comparing version 1.3.4 to 1.3.5
@@ -243,3 +243,6 @@ 'use strict'; | ||
_options$warnAfter = _options.warnAfter, | ||
warnAfter = _options$warnAfter === void 0 ? 32 : _options$warnAfter; | ||
warnAfter = _options$warnAfter === void 0 ? 32 : _options$warnAfter, | ||
ignore = _options.ignore; // Alias ignore->ignoredPaths, but prefer ignoredPaths if present | ||
ignoredPaths = ignoredPaths || ignore; | ||
var track = trackForMutations.bind(null, isImmutable, ignoredPaths); | ||
@@ -1243,2 +1246,3 @@ return function (_ref) { | ||
* @param payloadCreator | ||
* @param options | ||
* | ||
@@ -1248,3 +1252,3 @@ * @public | ||
function createAsyncThunk(type, payloadCreator) { | ||
function createAsyncThunk(type, payloadCreator, options) { | ||
var fulfilled = createAction(type + '/fulfilled', function (result, requestId, arg) { | ||
@@ -1270,2 +1274,3 @@ return { | ||
var aborted = !!error && error.name === 'AbortError'; | ||
var condition = !!error && error.name === 'ConditionError'; | ||
return { | ||
@@ -1277,3 +1282,4 @@ payload: payload, | ||
requestId: requestId, | ||
aborted: aborted | ||
aborted: aborted, | ||
condition: condition | ||
} | ||
@@ -1333,3 +1339,4 @@ }; | ||
try { | ||
var _temp3 = function _temp3() { | ||
var _temp3 = function _temp3(_result) { | ||
if (_exit2) return _result; | ||
// We dispatch the result action _after_ the catch, to avoid having any errors | ||
@@ -1339,9 +1346,25 @@ // here get swallowed by the try/catch block, | ||
// and https://redux-toolkit.js.org/tutorials/advanced-tutorial#async-error-handling-logic-in-thunks | ||
dispatch(finalAction); | ||
var skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition; | ||
if (!skipDispatch) { | ||
dispatch(finalAction); | ||
} | ||
return finalAction; | ||
}; | ||
var _exit2 = false; | ||
var finalAction; | ||
var _temp4 = _catch(function () { | ||
if (options && options.condition && options.condition(arg, { | ||
getState: getState, | ||
extra: extra | ||
}) === false) { | ||
throw { | ||
name: 'ConditionError', | ||
message: 'Aborted due to condition callback returning false.' | ||
}; | ||
} | ||
dispatch(pending(requestId, arg)); | ||
@@ -1348,0 +1371,0 @@ return Promise.resolve(Promise.race([abortedPromise, Promise.resolve(payloadCreator(arg, { |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("immer"),r=e(t),n=require("redux"),i=require("reselect"),o=e(require("redux-thunk"));function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var u="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?n.compose:n.compose.apply(null,arguments)};function c(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 f(e){return null==e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||Array.isArray(e)||c(e)}function s(e){void 0===e&&(e={});var t=e.thunk,r=void 0===t||t,n=[];return r&&n.push("boolean"==typeof r?o:o.withExtraArgument(r.extraArgument)),n}function l(e,t){function r(){if(t){var r=t.apply(void 0,arguments);if(!r)throw new Error("prepareAction did not return an object");return a({type:e,payload:r.payload},"meta"in r&&{meta:r.meta},{},"error"in r&&{error:r.error})}return{type:e,payload:arguments.length<=0?void 0:arguments[0]}}return r.toString=function(){return""+e},r.type=e,r.match=function(t){return t.type===e},r}function d(e){return["type","payload","error","meta"].indexOf(e)>-1}function y(e){var t={},r={addCase:function(e,n){var i="string"==typeof e?e:e.type;if(i in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[i]=n,r}};return e(r),t}function v(e,t){var n="function"==typeof t?y(t):t;return function(t,i){return void 0===t&&(t=e),r(t,(function(e){var t=n[i.type];return t?t(e,i):void 0}))}}function p(e){return function(n,i){var o=function(t){!function(e){return c(t=e)&&"string"==typeof t.type&&Object.keys(t).every(d);var t}(i)?e(i,t):e(i.payload,t)};return t.isDraft(n)?(o(n),n):r(n,o)}}function b(e,t){return t(e)}function m(e){function t(t,r){var n=b(t,e);n in r.entities||(r.ids.push(n),r.entities[n]=t)}function r(e,r){Array.isArray(e)||(e=Object.values(e));var n=e,i=Array.isArray(n),o=0;for(n=i?n:n[Symbol.iterator]();;){var a;if(i){if(o>=n.length)break;a=n[o++]}else{if((o=n.next()).done)break;a=o.value}t(a,r)}}function n(e,t){var r=!1;e.forEach((function(e){e in t.entities&&(delete t.entities[e],r=!0)})),r&&(t.ids=t.ids.filter((function(e){return e in t.entities})))}function i(t,r){var n={},i={};t.forEach((function(e){e.id in r.entities&&(i[e.id]=a({},i[e.id],{},e))})),(t=Object.values(i)).length>0&&t.filter((function(t){return function(t,r,n){var i=Object.assign({},n.entities[r.id],r.changes),o=b(i,e),a=o!==r.id;return a&&(t[r.id]=o,delete n.entities[r.id]),n.entities[o]=i,a}(n,t,r)})).length>0&&(r.ids=r.ids.map((function(e){return n[e]||e})))}function o(t,n){Array.isArray(t)||(t=Object.values(t));var o=[],a=[],u=t,c=Array.isArray(u),f=0;for(u=c?u:u[Symbol.iterator]();;){var s;if(c){if(f>=u.length)break;s=u[f++]}else{if((f=u.next()).done)break;s=f.value}var l=s,d=b(l,e);d in n.entities?a.push({id:d,changes:l}):o.push(l)}i(a,n),r(o,n)}return{removeAll:function(e){return Object.assign({},e,{ids:[],entities:{}})},addOne:p(t),addMany:p(r),setAll:p((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.ids=[],t.entities={},r(e,t)})),updateOne:p((function(e,t){return i([e],t)})),updateMany:p(i),upsertOne:p((function(e,t){return o([e],t)})),upsertMany:p(o),removeOne:p((function(e,t){return n([e],t)})),removeMany:p(n)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var h=function(e){void 0===e&&(e=21);for(var t="",r=e;r--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},g=["name","message","stack","code"],O=function(e){this.value=e},S=function(e){if("object"==typeof e&&null!==e){var t={},r=g,n=Array.isArray(r),i=0;for(r=n?r:r[Symbol.iterator]();;){var o;if(n){if(i>=r.length)break;o=r[i++]}else{if((i=r.next()).done)break;o=i.value}"string"==typeof e[o]&&(t[o]=e[o])}return t}return{message:String(e)}};t.enableES5(),Object.keys(n).forEach((function(e){"default"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})})),exports.createNextState=r,Object.defineProperty(exports,"createSelector",{enumerable:!0,get:function(){return i.createSelector}}),exports.configureStore=function(e){var t,r=e||{},i=r.reducer,o=void 0===i?void 0:i,f=r.middleware,l=void 0===f?s():f,d=r.devTools,y=void 0===d||d,v=r.preloadedState,p=void 0===v?void 0:v,b=r.enhancers,m=void 0===b?void 0:b;if("function"==typeof o)t=o;else{if(!c(o))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=n.combineReducers(o)}var h=n.applyMiddleware.apply(void 0,l),g=n.compose;y&&(g=u(a({trace:!1},"object"==typeof y&&y)));var O=[h];Array.isArray(m)?O=[h].concat(m):"function"==typeof m&&(O=m(O));var S=g.apply(void 0,O);return n.createStore(t,p,S)},exports.createAction=l,exports.createAsyncThunk=function(e,t){var r=l(e+"/fulfilled",(function(e,t,r){return{payload:e,meta:{arg:r,requestId:t}}})),n=l(e+"/pending",(function(e,t){return{payload:void 0,meta:{arg:t,requestId:e}}})),i=l(e+"/rejected",(function(e,t,r,n){var i=!!e&&"AbortError"===e.name;return{payload:n,error:S(e||"Rejected"),meta:{arg:r,requestId:t,aborted:i}}})),o="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(a,u,c){var f,s=h(),l=new o,d=new Promise((function(e,t){return l.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:f||"Aborted"})}))})),y=function(){try{var o,f=function(){return a(o),o},y=function(f,y){try{var v=(a(n(s,e)),Promise.resolve(Promise.race([d,Promise.resolve(t(e,{dispatch:a,getState:u,extra:c,requestId:s,signal:l.signal,rejectWithValue:function(e){return new O(e)}})).then((function(t){return t instanceof O?i(null,s,e,t.value):r(t,s,e)}))])).then((function(e){o=e})))}catch(e){return y(e)}return v&&v.then?v.then(void 0,y):v}(0,(function(t){o=i(t,s,e)}));return Promise.resolve(y&&y.then?y.then(f):f())}catch(e){return Promise.reject(e)}}();return Object.assign(y,{abort:function(e){f=e,l.abort()}})}}),{pending:n,rejected:i,fulfilled:r})},exports.createEntityAdapter=function(e){void 0===e&&(e={});var t=a({sortComparer:!1,selectId:function(e){return e.id}},e),r=t.selectId,n=t.sortComparer;return a({selectId:r,sortComparer:n},{getInitialState:function(e){return void 0===e&&(e={}),Object.assign({ids:[],entities:{}},e)}},{},{getSelectors:function(e){var t=function(e){return e.ids},r=function(e){return e.entities},n=i.createSelector(t,r,(function(e,t){return e.map((function(e){return t[e]}))})),o=function(e,t){return t},a=function(e,t){return e[t]},u=i.createSelector(t,(function(e){return e.length}));if(!e)return{selectIds:t,selectEntities:r,selectAll:n,selectTotal:u,selectById:i.createSelector(r,o,a)};var c=i.createSelector(e,r);return{selectIds:i.createSelector(e,t),selectEntities:c,selectAll:i.createSelector(e,n),selectTotal:i.createSelector(e,u),selectById:i.createSelector(c,o,a)}}},{},n?function(e,t){var r=m(e);function n(t,r){Array.isArray(t)||(t=Object.values(t));var n=t.filter((function(t){return!(b(t,e)in r.entities)}));0!==n.length&&a(n,r)}function i(t,r){var n=[];t.forEach((function(t){return function(t,r,n){if(!(r.id in n.entities))return!1;var i=Object.assign({},n.entities[r.id],r.changes),o=b(i,e);return delete n.entities[r.id],t.push(i),o!==r.id}(n,t,r)})),0!==n.length&&a(n,r)}function o(t,r){Array.isArray(t)||(t=Object.values(t));var o=[],a=[],u=t,c=Array.isArray(u),f=0;for(u=c?u:u[Symbol.iterator]();;){var s;if(c){if(f>=u.length)break;s=u[f++]}else{if((f=u.next()).done)break;s=f.value}var l=s,d=b(l,e);d in r.entities?a.push({id:d,changes:l}):o.push(l)}i(a,r),n(o,r)}function a(r,n){r.sort(t),r.forEach((function(t){n.entities[e(t)]=t}));var i=Object.values(n.entities);i.sort(t);var o=i.map(e);(function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(e[r]!==t[r])return!1;return!0})(n.ids,o)||(n.ids=o)}return{removeOne:r.removeOne,removeMany:r.removeMany,removeAll:r.removeAll,addOne:p((function(e,t){return n([e],t)})),updateOne:p((function(e,t){return i([e],t)})),upsertOne:p((function(e,t){return o([e],t)})),setAll:p((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.entities={},t.ids=[],n(e,t)})),addMany:p(n),updateMany:p(i),upsertMany:p(o)}}(r,n):m(r))},exports.createImmutableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},exports.createReducer=v,exports.createSerializableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},exports.createSlice=function(e){var t=e.name,r=e.initialState;if(!t)throw new Error("`name` is a required option for createSlice");var n=e.reducers||{},i=void 0===e.extraReducers?{}:"function"==typeof e.extraReducers?y(e.extraReducers):e.extraReducers,o=Object.keys(n),u={},c={},f={};o.forEach((function(e){var r,i,o=n[e],a=t+"/"+e;"reducer"in o?(r=o.reducer,i=o.prepare):r=o,u[e]=r,c[a]=r,f[e]=i?l(a,i):l(a)}));var s=v(r,a({},i,{},c));return{name:t,reducer:s,actions:f,caseReducers:u}},exports.findNonSerializableValue=function e(t,r,n,i,o){var a;if(void 0===r&&(r=[]),void 0===n&&(n=f),void 0===o&&(o=[]),!n(t))return{keyPath:r.join(".")||"<root>",value:t};if("object"!=typeof t||null===t)return!1;var u=null!=i?i(t):Object.entries(t),c=o.length>0,s=u,l=Array.isArray(s),d=0;for(s=l?s:s[Symbol.iterator]();;){var y;if(l){if(d>=s.length)break;y=s[d++]}else{if((d=s.next()).done)break;y=d.value}var v=y[1],p=r.concat(y[0]);if(!(c&&o.indexOf(p.join("."))>=0)){if(!n(v))return{keyPath:p.join("."),value:v};if("object"==typeof v&&(a=e(v,p,n,i,o)))return a}}return!1},exports.getDefaultMiddleware=s,exports.getType=function(e){return""+e},exports.isImmutableDefault=function(e){return"object"!=typeof e||null==e},exports.isPlain=f,exports.nanoid=h,exports.unwrapResult=function(e){if("error"in e)throw e.error;return e.payload}; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("immer"),r=e(t),n=require("redux"),i=require("reselect"),o=e(require("redux-thunk"));function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var u="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?n.compose:n.compose.apply(null,arguments)};function c(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 f(e){return null==e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||Array.isArray(e)||c(e)}function s(e){void 0===e&&(e={});var t=e.thunk,r=void 0===t||t,n=[];return r&&n.push("boolean"==typeof r?o:o.withExtraArgument(r.extraArgument)),n}function l(e,t){function r(){if(t){var r=t.apply(void 0,arguments);if(!r)throw new Error("prepareAction did not return an object");return a({type:e,payload:r.payload},"meta"in r&&{meta:r.meta},{},"error"in r&&{error:r.error})}return{type:e,payload:arguments.length<=0?void 0:arguments[0]}}return r.toString=function(){return""+e},r.type=e,r.match=function(t){return t.type===e},r}function d(e){return["type","payload","error","meta"].indexOf(e)>-1}function y(e){var t={},r={addCase:function(e,n){var i="string"==typeof e?e:e.type;if(i in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[i]=n,r}};return e(r),t}function p(e,t){var n="function"==typeof t?y(t):t;return function(t,i){return void 0===t&&(t=e),r(t,(function(e){var t=n[i.type];return t?t(e,i):void 0}))}}function v(e){return function(n,i){var o=function(t){!function(e){return c(t=e)&&"string"==typeof t.type&&Object.keys(t).every(d);var t}(i)?e(i,t):e(i.payload,t)};return t.isDraft(n)?(o(n),n):r(n,o)}}function b(e,t){return t(e)}function m(e){function t(t,r){var n=b(t,e);n in r.entities||(r.ids.push(n),r.entities[n]=t)}function r(e,r){Array.isArray(e)||(e=Object.values(e));var n=e,i=Array.isArray(n),o=0;for(n=i?n:n[Symbol.iterator]();;){var a;if(i){if(o>=n.length)break;a=n[o++]}else{if((o=n.next()).done)break;a=o.value}t(a,r)}}function n(e,t){var r=!1;e.forEach((function(e){e in t.entities&&(delete t.entities[e],r=!0)})),r&&(t.ids=t.ids.filter((function(e){return e in t.entities})))}function i(t,r){var n={},i={};t.forEach((function(e){e.id in r.entities&&(i[e.id]=a({},i[e.id],{},e))})),(t=Object.values(i)).length>0&&t.filter((function(t){return function(t,r,n){var i=Object.assign({},n.entities[r.id],r.changes),o=b(i,e),a=o!==r.id;return a&&(t[r.id]=o,delete n.entities[r.id]),n.entities[o]=i,a}(n,t,r)})).length>0&&(r.ids=r.ids.map((function(e){return n[e]||e})))}function o(t,n){Array.isArray(t)||(t=Object.values(t));var o=[],a=[],u=t,c=Array.isArray(u),f=0;for(u=c?u:u[Symbol.iterator]();;){var s;if(c){if(f>=u.length)break;s=u[f++]}else{if((f=u.next()).done)break;s=f.value}var l=s,d=b(l,e);d in n.entities?a.push({id:d,changes:l}):o.push(l)}i(a,n),r(o,n)}return{removeAll:function(e){return Object.assign({},e,{ids:[],entities:{}})},addOne:v(t),addMany:v(r),setAll:v((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.ids=[],t.entities={},r(e,t)})),updateOne:v((function(e,t){return i([e],t)})),updateMany:v(i),upsertOne:v((function(e,t){return o([e],t)})),upsertMany:v(o),removeOne:v((function(e,t){return n([e],t)})),removeMany:v(n)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var h=function(e){void 0===e&&(e=21);for(var t="",r=e;r--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},g=["name","message","stack","code"],O=function(e){this.value=e},S=function(e){if("object"==typeof e&&null!==e){var t={},r=g,n=Array.isArray(r),i=0;for(r=n?r:r[Symbol.iterator]();;){var o;if(n){if(i>=r.length)break;o=r[i++]}else{if((i=r.next()).done)break;o=i.value}"string"==typeof e[o]&&(t[o]=e[o])}return t}return{message:String(e)}};t.enableES5(),Object.keys(n).forEach((function(e){"default"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})})),exports.createNextState=r,Object.defineProperty(exports,"createSelector",{enumerable:!0,get:function(){return i.createSelector}}),exports.configureStore=function(e){var t,r=e||{},i=r.reducer,o=void 0===i?void 0:i,f=r.middleware,l=void 0===f?s():f,d=r.devTools,y=void 0===d||d,p=r.preloadedState,v=void 0===p?void 0:p,b=r.enhancers,m=void 0===b?void 0:b;if("function"==typeof o)t=o;else{if(!c(o))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=n.combineReducers(o)}var h=n.applyMiddleware.apply(void 0,l),g=n.compose;y&&(g=u(a({trace:!1},"object"==typeof y&&y)));var O=[h];Array.isArray(m)?O=[h].concat(m):"function"==typeof m&&(O=m(O));var S=g.apply(void 0,O);return n.createStore(t,v,S)},exports.createAction=l,exports.createAsyncThunk=function(e,t,r){var n=l(e+"/fulfilled",(function(e,t,r){return{payload:e,meta:{arg:r,requestId:t}}})),i=l(e+"/pending",(function(e,t){return{payload:void 0,meta:{arg:t,requestId:e}}})),o=l(e+"/rejected",(function(e,t,r,n){var i=!!e&&"AbortError"===e.name,o=!!e&&"ConditionError"===e.name;return{payload:n,error:S(e||"Rejected"),meta:{arg:r,requestId:t,aborted:i,condition:o}}})),a="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(u,c,f){var s,l=h(),d=new a,y=new Promise((function(e,t){return d.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:s||"Aborted"})}))})),p=function(){try{var a,s=function(e){return p?e:(r&&!r.dispatchConditionRejection&&o.match(a)&&a.meta.condition||u(a),a)},p=!1,v=function(s,p){try{var v=function(){if(r&&r.condition&&!1===r.condition(e,{getState:c,extra:f}))throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return u(i(l,e)),Promise.resolve(Promise.race([y,Promise.resolve(t(e,{dispatch:u,getState:c,extra:f,requestId:l,signal:d.signal,rejectWithValue:function(e){return new O(e)}})).then((function(t){return t instanceof O?o(null,l,e,t.value):n(t,l,e)}))])).then((function(e){a=e}))}()}catch(e){return p(e)}return v&&v.then?v.then(void 0,p):v}(0,(function(t){a=o(t,l,e)}));return Promise.resolve(v&&v.then?v.then(s):s(v))}catch(e){return Promise.reject(e)}}();return Object.assign(p,{abort:function(e){s=e,d.abort()}})}}),{pending:i,rejected:o,fulfilled:n})},exports.createEntityAdapter=function(e){void 0===e&&(e={});var t=a({sortComparer:!1,selectId:function(e){return e.id}},e),r=t.selectId,n=t.sortComparer;return a({selectId:r,sortComparer:n},{getInitialState:function(e){return void 0===e&&(e={}),Object.assign({ids:[],entities:{}},e)}},{},{getSelectors:function(e){var t=function(e){return e.ids},r=function(e){return e.entities},n=i.createSelector(t,r,(function(e,t){return e.map((function(e){return t[e]}))})),o=function(e,t){return t},a=function(e,t){return e[t]},u=i.createSelector(t,(function(e){return e.length}));if(!e)return{selectIds:t,selectEntities:r,selectAll:n,selectTotal:u,selectById:i.createSelector(r,o,a)};var c=i.createSelector(e,r);return{selectIds:i.createSelector(e,t),selectEntities:c,selectAll:i.createSelector(e,n),selectTotal:i.createSelector(e,u),selectById:i.createSelector(c,o,a)}}},{},n?function(e,t){var r=m(e);function n(t,r){Array.isArray(t)||(t=Object.values(t));var n=t.filter((function(t){return!(b(t,e)in r.entities)}));0!==n.length&&a(n,r)}function i(t,r){var n=[];t.forEach((function(t){return function(t,r,n){if(!(r.id in n.entities))return!1;var i=Object.assign({},n.entities[r.id],r.changes),o=b(i,e);return delete n.entities[r.id],t.push(i),o!==r.id}(n,t,r)})),0!==n.length&&a(n,r)}function o(t,r){Array.isArray(t)||(t=Object.values(t));var o=[],a=[],u=t,c=Array.isArray(u),f=0;for(u=c?u:u[Symbol.iterator]();;){var s;if(c){if(f>=u.length)break;s=u[f++]}else{if((f=u.next()).done)break;s=f.value}var l=s,d=b(l,e);d in r.entities?a.push({id:d,changes:l}):o.push(l)}i(a,r),n(o,r)}function a(r,n){r.sort(t),r.forEach((function(t){n.entities[e(t)]=t}));var i=Object.values(n.entities);i.sort(t);var o=i.map(e);(function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(e[r]!==t[r])return!1;return!0})(n.ids,o)||(n.ids=o)}return{removeOne:r.removeOne,removeMany:r.removeMany,removeAll:r.removeAll,addOne:v((function(e,t){return n([e],t)})),updateOne:v((function(e,t){return i([e],t)})),upsertOne:v((function(e,t){return o([e],t)})),setAll:v((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.entities={},t.ids=[],n(e,t)})),addMany:v(n),updateMany:v(i),upsertMany:v(o)}}(r,n):m(r))},exports.createImmutableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},exports.createReducer=p,exports.createSerializableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},exports.createSlice=function(e){var t=e.name,r=e.initialState;if(!t)throw new Error("`name` is a required option for createSlice");var n=e.reducers||{},i=void 0===e.extraReducers?{}:"function"==typeof e.extraReducers?y(e.extraReducers):e.extraReducers,o=Object.keys(n),u={},c={},f={};o.forEach((function(e){var r,i,o=n[e],a=t+"/"+e;"reducer"in o?(r=o.reducer,i=o.prepare):r=o,u[e]=r,c[a]=r,f[e]=i?l(a,i):l(a)}));var s=p(r,a({},i,{},c));return{name:t,reducer:s,actions:f,caseReducers:u}},exports.findNonSerializableValue=function e(t,r,n,i,o){var a;if(void 0===r&&(r=[]),void 0===n&&(n=f),void 0===o&&(o=[]),!n(t))return{keyPath:r.join(".")||"<root>",value:t};if("object"!=typeof t||null===t)return!1;var u=null!=i?i(t):Object.entries(t),c=o.length>0,s=u,l=Array.isArray(s),d=0;for(s=l?s:s[Symbol.iterator]();;){var y;if(l){if(d>=s.length)break;y=s[d++]}else{if((d=s.next()).done)break;y=d.value}var p=y[1],v=r.concat(y[0]);if(!(c&&o.indexOf(v.join("."))>=0)){if(!n(p))return{keyPath:v.join("."),value:p};if("object"==typeof p&&(a=e(p,v,n,i,o)))return a}}return!1},exports.getDefaultMiddleware=s,exports.getType=function(e){return""+e},exports.isImmutableDefault=function(e){return"object"!=typeof e||null==e},exports.isPlain=f,exports.nanoid=h,exports.unwrapResult=function(e){if("error"in e)throw e.error;return e.payload}; | ||
//# sourceMappingURL=redux-toolkit.cjs.production.min.js.map |
@@ -258,3 +258,6 @@ import createNextState, { isDraft, enableES5 } from 'immer'; | ||
_options$warnAfter = _options.warnAfter, | ||
warnAfter = _options$warnAfter === void 0 ? 32 : _options$warnAfter; | ||
warnAfter = _options$warnAfter === void 0 ? 32 : _options$warnAfter, | ||
ignore = _options.ignore; // Alias ignore->ignoredPaths, but prefer ignoredPaths if present | ||
ignoredPaths = ignoredPaths || ignore; | ||
var track = trackForMutations.bind(null, isImmutable, ignoredPaths); | ||
@@ -1268,2 +1271,3 @@ return function (_ref) { | ||
* @param payloadCreator | ||
* @param options | ||
* | ||
@@ -1273,3 +1277,3 @@ * @public | ||
function createAsyncThunk(type, payloadCreator) { | ||
function createAsyncThunk(type, payloadCreator, options) { | ||
var fulfilled = createAction(type + '/fulfilled', function (result, requestId, arg) { | ||
@@ -1295,2 +1299,3 @@ return { | ||
var aborted = !!error && error.name === 'AbortError'; | ||
var condition = !!error && error.name === 'ConditionError'; | ||
return { | ||
@@ -1302,3 +1307,4 @@ payload: payload, | ||
requestId: requestId, | ||
aborted: aborted | ||
aborted: aborted, | ||
condition: condition | ||
} | ||
@@ -1358,3 +1364,4 @@ }; | ||
try { | ||
var _temp3 = function _temp3() { | ||
var _temp3 = function _temp3(_result) { | ||
if (_exit2) return _result; | ||
// We dispatch the result action _after_ the catch, to avoid having any errors | ||
@@ -1364,9 +1371,25 @@ // here get swallowed by the try/catch block, | ||
// and https://redux-toolkit.js.org/tutorials/advanced-tutorial#async-error-handling-logic-in-thunks | ||
dispatch(finalAction); | ||
var skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition; | ||
if (!skipDispatch) { | ||
dispatch(finalAction); | ||
} | ||
return finalAction; | ||
}; | ||
var _exit2 = false; | ||
var finalAction; | ||
var _temp4 = _catch(function () { | ||
if (options && options.condition && options.condition(arg, { | ||
getState: getState, | ||
extra: extra | ||
}) === false) { | ||
throw { | ||
name: 'ConditionError', | ||
message: 'Aborted due to condition callback returning false.' | ||
}; | ||
} | ||
dispatch(pending(requestId, arg)); | ||
@@ -1373,0 +1396,0 @@ return Promise.resolve(Promise.race([abortedPromise, Promise.resolve(payloadCreator(arg, { |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).RTK={})}(this,(function(e){"use strict";function t(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.join(","):"")+". Find the full error at: https://bit.ly/38PiBHb")}function r(e){return!!e&&!!e[B]}function n(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return!t||t===Object.prototype}(e)||Array.isArray(e)||!!e[C]||!!e.constructor[C]||c(e)||f(e))}function o(e,t){0===i(e)?z(e).forEach((function(r){return t(r,e[r],e)})):e.forEach((function(r,n){return t(n,r,e)}))}function i(e){var t=e[B];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:c(e)?2:f(e)?3:0}function u(e,t){return 2===i(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function a(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function c(e){return N&&e instanceof Map}function f(e){return D&&e instanceof Set}function s(e){return e.o||e.t}function l(e,r){if(void 0===r&&(r=!1),Array.isArray(e))return e.slice();var n=Object.create(Object.getPrototypeOf(e));return o(e,(function(o){if(o!==B){var i=Object.getOwnPropertyDescriptor(e,o),u=i.value;i.get&&(r||t(1),u=i.get.call(e)),i.enumerable?n[o]=u:Object.defineProperty(n,o,{value:u,writable:!0,configurable:!0})}})),n}function d(e,t){r(e)||Object.isFrozen(e)||!n(e)||(i(e)>1&&(e.set=e.add=e.clear=e.delete=p),Object.freeze(e),t&&o(e,(function(e,t){return d(t,!0)})))}function p(){t(2)}function y(e){var r=F[e];return r||t(19,e),r}function v(){return _}function h(e,t){t&&(y("Patches"),e.u=[],e.s=[],e.v=t)}function b(e){g(e),e.p.forEach(O),e.p=null}function g(e){e===_&&(_=e.l)}function m(e){return _={p:[],l:_,h:e,m:!0,_:0}}function O(e){var t=e[B];0===t.i||1===t.i?t.j():t.O=!0}function w(e,r){r._=r.p.length;var o=r.p[0],i=void 0!==e&&e!==o;return r.h.g||y("ES5").P(r,e,i),i?(o[B].S&&(b(r),t(4)),n(e)&&(e=A(r,e),r.l||S(r,e)),r.u&&y("Patches").M(o[B],e,r.u,r.s)):e=A(r,o,[]),b(r),r.u&&r.v(r.u,r.s),e!==M?e:void 0}function A(e,t,r){if(Object.isFrozen(t))return t;var n=t[B];if(!n)return o(t,(function(o,i){return j(e,n,t,o,i,r)})),t;if(n.A!==e)return t;if(!n.S)return S(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=4===n.i||5===n.i?n.o=l(n.k,!0):n.o;o(i,(function(t,o){return j(e,n,i,t,o,r)})),S(e,i,!1),r&&e.u&&y("Patches").R(n,r,e.u,e.s)}return n.o}function j(e,t,o,c,f,s){if(r(f)){var l=A(e,f,s&&t&&3!==t.i&&!u(t.D,c)?s.concat(c):void 0);if(p=c,y=l,2===(v=i(d=o))?d.set(p,y):3===v?(d.delete(p),d.add(y)):d[p]=y,!r(l))return;e.m=!1}var d,p,y,v;if((!t||!a(f,function(e,t){return 2===i(e)?e.get(t):e[t]}(t.t,c)))&&n(f)){if(!e.h.N&&e._<1)return;A(e,f),t&&t.A.l||S(e,f)}}function S(e,t,r){void 0===r&&(r=!1),e.h.N&&e.m&&d(t,r)}function P(e,t){var r=e[B],n=Reflect.getOwnPropertyDescriptor(r?s(r):e,t);return n&&n.value}function E(e){if(!e.S){if(e.S=!0,0===e.i||1===e.i){var t=e.o=l(e.t);o(e.p,(function(e,r){t[e]=r})),e.p=void 0}e.l&&E(e.l)}}function x(e){e.o||(e.o=l(e.t))}function I(e,t,r){var n=c(t)?y("MapSet").T(t,r):f(t)?y("MapSet").F(t,r):e.g?function(e,t){var r=Array.isArray(e),n={i:r?1:0,A:t?t.A:v(),S:!1,I:!1,D:{},l:t,t:e,k:null,p:{},o:null,j:null,C:!1},o=n,i=U;r&&(o=[n],i=W);var u=Proxy.revocable(o,i),a=u.revoke,c=u.proxy;return n.k=c,n.j=a,c}(t,r):y("ES5").J(t,r);return(r?r.A:v()).p.push(n),n}var k,_,R="undefined"!=typeof Symbol,N="undefined"!=typeof Map,D="undefined"!=typeof Set,T="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,M=R?Symbol("immer-nothing"):((k={})["immer-nothing"]=!0,k),C=R?Symbol("immer-draftable"):"__$immer_draftable",B=R?Symbol("immer-state"):"__$immer_state",z="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,F={},U={get:function(e,t){if(t===B)return e;var r=e.p;if(!e.S&&u(r,t))return r[t];var o=s(e)[t];if(e.I||!n(o))return o;if(e.S){if(o!==P(e.t,t))return o;r=e.o}return r[t]=I(e.A.h,o,e)},has:function(e,t){return t in s(e)},ownKeys:function(e){return Reflect.ownKeys(s(e))},set:function(e,t,r){if(!e.S){var n=P(e.t,t);if(r?a(n,r)||r===e.p[t]:a(n,r)&&t in e.t)return!0;x(e),E(e)}return e.D[t]=!0,e.o[t]=r,!0},deleteProperty:function(e,t){return void 0!==P(e.t,t)||t in e.t?(e.D[t]=!1,x(e),E(e)):e.D[t]&&delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=s(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&(n.writable=!0,n.configurable=1!==e.i||"length"!==t),n},defineProperty:function(){t(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){t(12)}},W={};o(U,(function(e,t){W[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),W.deleteProperty=function(e,t){return U.deleteProperty.call(this,e[0],t)},W.set=function(e,t,r){return U.set.call(this,e[0],t,r,e[0])};var K=new(function(){function e(e){this.g=T,this.N=!1,"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),this.produce=this.produce.bind(this),this.produceWithPatches=this.produceWithPatches.bind(this)}var o=e.prototype;return o.produce=function(e,r,o){if("function"==typeof e&&"function"!=typeof r){var i=r;r=e;var u=this;return function(e){var t=this;void 0===e&&(e=i);for(var n=arguments.length,o=Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return u.produce(e,(function(e){var n;return(n=r).call.apply(n,[t,e].concat(o))}))}}var a;if("function"!=typeof r&&t(6),void 0!==o&&"function"!=typeof o&&t(7),n(e)){var c=m(this),f=I(this,e,void 0),s=!0;try{a=r(f),s=!1}finally{s?b(c):g(c)}return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return h(c,o),w(e,c)}),(function(e){throw b(c),e})):(h(c,o),w(a,c))}if((a=r(e))!==M)return void 0===a&&(a=e),this.N&&d(a,!0),a},o.produceWithPatches=function(e,t){var r,n,o=this;return"function"==typeof e?function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return o.produceWithPatches(t,(function(t){return e.apply(void 0,[t].concat(n))}))}:[this.produce(e,t,(function(e,t){r=e,n=t})),r,n]},o.createDraft=function(e){n(e)||t(8);var r=m(this),o=I(this,e,void 0);return o[B].C=!0,g(r),o},o.finishDraft=function(e,t){var r=(e&&e[B]).A;return h(r,t),w(void 0,r)},o.setAutoFreeze=function(e){this.N=e},o.setUseProxies=function(e){T||t(20),this.g=e},o.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}var i=y("Patches").H;return r(e)?i(e,t):this.produce(e,(function(e){return i(e,t.slice(n+1))}))},e}()),L=K.produce;K.produceWithPatches.bind(K),K.setAutoFreeze.bind(K),K.setUseProxies.bind(K),K.applyPatches.bind(K),K.createDraft.bind(K),K.finishDraft.bind(K);var q=function(e){var t,r=("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()).Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}(),V=function(){return Math.random().toString(36).substring(7).split("").join(".")},X={INIT:"@@redux/INIT"+V(),REPLACE:"@@redux/REPLACE"+V(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+V()}};function H(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 J(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function");if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error("Expected the enhancer to be a function.");return r(J)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var o=e,i=t,u=[],a=u,c=!1;function f(){a===u&&(a=u.slice())}function s(){if(c)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function l(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(c)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var t=!0;return f(),a.push(e),function(){if(t){if(c)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");t=!1,f();var r=a.indexOf(e);a.splice(r,1)}}}function d(e){if(!H(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(c)throw new Error("Reducers may not dispatch actions.");try{c=!0,i=o(i,e)}finally{c=!1}for(var t=u=a,r=0;r<t.length;r++)(0,t[r])();return e}function p(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");o=e,d({type:X.REPLACE})}function y(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function r(){e.next&&e.next(s())}return r(),{unsubscribe:t(r)}}})[q]=function(){return this},e}return d({type:X.INIT}),(n={dispatch:d,subscribe:l,getState:s,replaceReducer:p})[q]=y,n}function Y(e,t){var r=t&&t.type;return"Given "+(r&&'action "'+String(r)+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function $(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var o=t[n];"function"==typeof e[o]&&(r[o]=e[o])}var i,u=Object.keys(r);try{!function(e){Object.keys(e).forEach((function(t){var r=e[t];if(void 0===r(void 0,{type:X.INIT}))throw new Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===r(void 0,{type:X.PROBE_UNKNOWN_ACTION()}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+X.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')}))}(r)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var n=!1,o={},a=0;a<u.length;a++){var c=u[a],f=e[c],s=(0,r[c])(f,t);if(void 0===s){var l=Y(c,t);throw new Error(l)}o[c]=s,n=n||s!==f}return n?o:e}}function G(e,t){return function(){return t(e.apply(this,arguments))}}function Q(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Q(e,t,r[t])}))}return e}function ee(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function te(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return function(){var r=e.apply(void 0,arguments),n=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},o={getState:r.getState,dispatch:function(){return n.apply(void 0,arguments)}},i=t.map((function(e){return e(o)}));return Z({},r,{dispatch:n=ee.apply(void 0,i)(r.dispatch)})}}}function re(e,t){return e===t}function ne(e,t,r){if(null===t||null===r||t.length!==r.length)return!1;for(var n=t.length,o=0;o<n;o++)if(!e(t[o],r[o]))return!1;return!0}function oe(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var r=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+r+"]")}return t}var ie=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(){for(var t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];var i=0,u=n.pop(),a=oe(n),c=e.apply(void 0,[function(){return i++,u.apply(null,arguments)}].concat(r)),f=e((function(){for(var e=[],t=a.length,r=0;r<t;r++)e.push(a[r].apply(null,arguments));return c.apply(null,e)}));return f.resultFunc=u,f.dependencies=a,f.recomputations=function(){return i},f.resetRecomputations=function(){return i=0},f}}((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:re,r=null,n=null;return function(){return ne(t,r,arguments)||(n=e.apply(null,arguments)),r=arguments,n}}));function ue(){return(ue=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var ae="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ee:ee.apply(null,arguments)};function ce(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 fe(e){return function(t){var r=t.dispatch,n=t.getState;return function(t){return function(o){return"function"==typeof o?o(r,n,e):t(o)}}}}var se=fe();function le(e){return null==e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||Array.isArray(e)||ce(e)}function de(e){void 0===e&&(e={});var t=e.thunk,r=void 0===t||t,n=[];return r&&(function(e){return"boolean"==typeof e}(r)?n.push(se):n.push(se.withExtraArgument(r.extraArgument))),n}function pe(e,t){function r(){if(t){var r=t.apply(void 0,arguments);if(!r)throw new Error("prepareAction did not return an object");return ue({type:e,payload:r.payload},"meta"in r&&{meta:r.meta},{},"error"in r&&{error:r.error})}return{type:e,payload:arguments.length<=0?void 0:arguments[0]}}return r.toString=function(){return""+e},r.type=e,r.match=function(t){return t.type===e},r}function ye(e){return["type","payload","error","meta"].indexOf(e)>-1}function ve(e){var t={},r={addCase:function(e,n){var o="string"==typeof e?e:e.type;if(o in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[o]=n,r}};return e(r),t}function he(e,t){var r="function"==typeof t?ve(t):t;return function(t,n){return void 0===t&&(t=e),L(t,(function(e){var t=r[n.type];return t?t(e,n):void 0}))}}function be(e){return function(t,n){var o=function(t){!function(e){return ce(t=e)&&"string"==typeof t.type&&Object.keys(t).every(ye);var t}(n)?e(n,t):e(n.payload,t)};return r(t)?(o(t),t):L(t,o)}}function ge(e,t){return t(e)}function me(e){function t(t,r){var n=ge(t,e);n in r.entities||(r.ids.push(n),r.entities[n]=t)}function r(e,r){Array.isArray(e)||(e=Object.values(e));var n=e,o=Array.isArray(n),i=0;for(n=o?n:n[Symbol.iterator]();;){var u;if(o){if(i>=n.length)break;u=n[i++]}else{if((i=n.next()).done)break;u=i.value}t(u,r)}}function n(e,t){var r=!1;e.forEach((function(e){e in t.entities&&(delete t.entities[e],r=!0)})),r&&(t.ids=t.ids.filter((function(e){return e in t.entities})))}function o(t,r){var n={},o={};t.forEach((function(e){e.id in r.entities&&(o[e.id]=ue({},o[e.id],{},e))})),(t=Object.values(o)).length>0&&t.filter((function(t){return function(t,r,n){var o=Object.assign({},n.entities[r.id],r.changes),i=ge(o,e),u=i!==r.id;return u&&(t[r.id]=i,delete n.entities[r.id]),n.entities[i]=o,u}(n,t,r)})).length>0&&(r.ids=r.ids.map((function(e){return n[e]||e})))}function i(t,n){Array.isArray(t)||(t=Object.values(t));var i=[],u=[],a=t,c=Array.isArray(a),f=0;for(a=c?a:a[Symbol.iterator]();;){var s;if(c){if(f>=a.length)break;s=a[f++]}else{if((f=a.next()).done)break;s=f.value}var l=s,d=ge(l,e);d in n.entities?u.push({id:d,changes:l}):i.push(l)}o(u,n),r(i,n)}return{removeAll:function(e){return Object.assign({},e,{ids:[],entities:{}})},addOne:be(t),addMany:be(r),setAll:be((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.ids=[],t.entities={},r(e,t)})),updateOne:be((function(e,t){return o([e],t)})),updateMany:be(o),upsertOne:be((function(e,t){return i([e],t)})),upsertMany:be(i),removeOne:be((function(e,t){return n([e],t)})),removeMany:be(n)}}se.withExtraArgument=fe,"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var Oe=function(e){void 0===e&&(e=21);for(var t="",r=e;r--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},we=["name","message","stack","code"],Ae=function(e){this.value=e},je=function(e){if("object"==typeof e&&null!==e){var t={},r=we,n=Array.isArray(r),o=0;for(r=n?r:r[Symbol.iterator]();;){var i;if(n){if(o>=r.length)break;i=r[o++]}else{if((o=r.next()).done)break;i=o.value}"string"==typeof e[i]&&(t[i]=e[i])}return t}return{message:String(e)}};!function(){function e(e,t){var r=e[B];if(r&&!r.B){r.B=!0;var n=e[t];return r.B=!1,n}return e[t]}function i(e){e.S||(e.S=!0,e.l&&i(e.l))}function c(e){e.o||(e.o=f(e.t))}function f(e){var t=e&&e[B];if(t){t.B=!0;var r=l(t.k,!0);return t.B=!1,r}return l(e)}function d(e){for(var t=e.length-1;t>=0;t--){var r=e[t][B];if(!r.S)switch(r.i){case 5:y(r)&&i(r);break;case 4:p(r)&&i(r)}}}function p(e){for(var t=e.t,r=e.k,n=Object.keys(r),o=n.length-1;o>=0;o--){var i=n[o],c=t[i];if(void 0===c&&!u(t,i))return!0;var f=r[i],s=f&&f[B];if(s?s.t!==c:!a(f,c))return!0}return n.length!==Object.keys(t).length}function y(e){var t=e.k;if(t.length!==e.t.length)return!0;var r=Object.getOwnPropertyDescriptor(t,t.length-1);return!(!r||r.get)}function h(e){e.O&&t(3,JSON.stringify(s(e)))}var b={};!function(e,t){F.ES5=t}(0,{J:function(t,r){var u=Array.isArray(t),l=f(t);o(l,(function(r){!function(t,r,o){var u=b[r];u?u.enumerable=o:b[r]=u={enumerable:o,get:function(){return function(t,r){h(t);var o=e(s(t),r);return t.B?o:o===e(t.t,r)&&n(o)?(c(t),t.o[r]=I(t.A.h,o,t)):o}(this[B],r)},set:function(t){!function(t,r,n){if(h(t),t.D[r]=!0,!t.S){if(a(n,e(s(t),r)))return;i(t),c(t)}t.o[r]=n}(this[B],r,t)}},Object.defineProperty(t,r,u)}(l,r,u||function(e,t){var r=Object.getOwnPropertyDescriptor(e,t);return!(!r||!r.enumerable)}(t,r))}));var d={i:u?5:4,A:r?r.A:v(),S:!1,B:!1,I:!1,D:{},l:r,t:t,k:l,o:null,O:!1,C:!1};return Object.defineProperty(l,B,{value:d,writable:!0}),l},$:i,P:function(e,t,n){e.p.forEach((function(e){e[B].B=!0})),n?r(t)&&t[B].A===e&&d(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var r=t[B];if(r){var n=r.t,a=r.k,c=r.D,f=r.i;if(4===f)o(a,(function(t){t!==B&&(void 0!==n[t]||u(n,t)?c[t]||e(a[t]):(c[t]=!0,i(r)))})),o(n,(function(e){void 0!==a[e]||u(a,e)||(c[e]=!1,i(r))}));else if(5===f){if(y(r)&&(i(r),c.length=!0),a.length<n.length)for(var s=a.length;s<n.length;s++)c[s]=!1;else for(var l=n.length;l<a.length;l++)c[l]=!0;for(var d=Math.min(a.length,n.length),p=0;p<d;p++)void 0===c[p]&&e(a[p])}}}}(e.p[0]),d(e.p))}})}(),e.__DO_NOT_USE__ActionTypes=X,e.applyMiddleware=te,e.bindActionCreators=function(e,t){if("function"==typeof e)return G(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var r=Object.keys(e),n={},o=0;o<r.length;o++){var i=r[o],u=e[i];"function"==typeof u&&(n[i]=G(u,t))}return n},e.combineReducers=$,e.compose=ee,e.configureStore=function(e){var t,r=e||{},n=r.reducer,o=void 0===n?void 0:n,i=r.middleware,u=void 0===i?de():i,a=r.devTools,c=void 0===a||a,f=r.preloadedState,s=void 0===f?void 0:f,l=r.enhancers,d=void 0===l?void 0:l;if("function"==typeof o)t=o;else{if(!ce(o))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=$(o)}var p=te.apply(void 0,u),y=ee;c&&(y=ae(ue({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(d)?v=[p].concat(d):"function"==typeof d&&(v=d(v)),J(t,s,y.apply(void 0,v))},e.createAction=pe,e.createAsyncThunk=function(e,t){var r=pe(e+"/fulfilled",(function(e,t,r){return{payload:e,meta:{arg:r,requestId:t}}})),n=pe(e+"/pending",(function(e,t){return{payload:void 0,meta:{arg:t,requestId:e}}})),o=pe(e+"/rejected",(function(e,t,r,n){var o=!!e&&"AbortError"===e.name;return{payload:n,error:je(e||"Rejected"),meta:{arg:r,requestId:t,aborted:o}}})),i="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(u,a,c){var f,s=Oe(),l=new i,d=new Promise((function(e,t){return l.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:f||"Aborted"})}))})),p=function(){try{var i,f=function(){return u(i),i},p=function(f,p){try{var y=(u(n(s,e)),Promise.resolve(Promise.race([d,Promise.resolve(t(e,{dispatch:u,getState:a,extra:c,requestId:s,signal:l.signal,rejectWithValue:function(e){return new Ae(e)}})).then((function(t){return t instanceof Ae?o(null,s,e,t.value):r(t,s,e)}))])).then((function(e){i=e})))}catch(e){return p(e)}return y&&y.then?y.then(void 0,p):y}(0,(function(t){i=o(t,s,e)}));return Promise.resolve(p&&p.then?p.then(f):f())}catch(e){return Promise.reject(e)}}();return Object.assign(p,{abort:function(e){f=e,l.abort()}})}}),{pending:n,rejected:o,fulfilled:r})},e.createEntityAdapter=function(e){void 0===e&&(e={});var t=ue({sortComparer:!1,selectId:function(e){return e.id}},e),r=t.selectId,n=t.sortComparer;return ue({selectId:r,sortComparer:n},{getInitialState:function(e){return void 0===e&&(e={}),Object.assign({ids:[],entities:{}},e)}},{},{getSelectors:function(e){var t=function(e){return e.ids},r=function(e){return e.entities},n=ie(t,r,(function(e,t){return e.map((function(e){return t[e]}))})),o=function(e,t){return t},i=function(e,t){return e[t]},u=ie(t,(function(e){return e.length}));if(!e)return{selectIds:t,selectEntities:r,selectAll:n,selectTotal:u,selectById:ie(r,o,i)};var a=ie(e,r);return{selectIds:ie(e,t),selectEntities:a,selectAll:ie(e,n),selectTotal:ie(e,u),selectById:ie(a,o,i)}}},{},n?function(e,t){var r=me(e);function n(t,r){Array.isArray(t)||(t=Object.values(t));var n=t.filter((function(t){return!(ge(t,e)in r.entities)}));0!==n.length&&u(n,r)}function o(t,r){var n=[];t.forEach((function(t){return function(t,r,n){if(!(r.id in n.entities))return!1;var o=Object.assign({},n.entities[r.id],r.changes),i=ge(o,e);return delete n.entities[r.id],t.push(o),i!==r.id}(n,t,r)})),0!==n.length&&u(n,r)}function i(t,r){Array.isArray(t)||(t=Object.values(t));var i=[],u=[],a=t,c=Array.isArray(a),f=0;for(a=c?a:a[Symbol.iterator]();;){var s;if(c){if(f>=a.length)break;s=a[f++]}else{if((f=a.next()).done)break;s=f.value}var l=s,d=ge(l,e);d in r.entities?u.push({id:d,changes:l}):i.push(l)}o(u,r),n(i,r)}function u(r,n){r.sort(t),r.forEach((function(t){n.entities[e(t)]=t}));var o=Object.values(n.entities);o.sort(t);var i=o.map(e);(function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(e[r]!==t[r])return!1;return!0})(n.ids,i)||(n.ids=i)}return{removeOne:r.removeOne,removeMany:r.removeMany,removeAll:r.removeAll,addOne:be((function(e,t){return n([e],t)})),updateOne:be((function(e,t){return o([e],t)})),upsertOne:be((function(e,t){return i([e],t)})),setAll:be((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.entities={},t.ids=[],n(e,t)})),addMany:be(n),updateMany:be(o),upsertMany:be(i)}}(r,n):me(r))},e.createImmutableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},e.createNextState=L,e.createReducer=he,e.createSelector=ie,e.createSerializableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},e.createSlice=function(e){var t=e.name,r=e.initialState;if(!t)throw new Error("`name` is a required option for createSlice");var n=e.reducers||{},o=void 0===e.extraReducers?{}:"function"==typeof e.extraReducers?ve(e.extraReducers):e.extraReducers,i=Object.keys(n),u={},a={},c={};i.forEach((function(e){var r,o,i=n[e],f=t+"/"+e;"reducer"in i?(r=i.reducer,o=i.prepare):r=i,u[e]=r,a[f]=r,c[e]=o?pe(f,o):pe(f)}));var f=he(r,ue({},o,{},a));return{name:t,reducer:f,actions:c,caseReducers:u}},e.createStore=J,e.findNonSerializableValue=function e(t,r,n,o,i){var u;if(void 0===r&&(r=[]),void 0===n&&(n=le),void 0===i&&(i=[]),!n(t))return{keyPath:r.join(".")||"<root>",value:t};if("object"!=typeof t||null===t)return!1;var a=null!=o?o(t):Object.entries(t),c=i.length>0,f=a,s=Array.isArray(f),l=0;for(f=s?f:f[Symbol.iterator]();;){var d;if(s){if(l>=f.length)break;d=f[l++]}else{if((l=f.next()).done)break;d=l.value}var p=d[1],y=r.concat(d[0]);if(!(c&&i.indexOf(y.join("."))>=0)){if(!n(p))return{keyPath:y.join("."),value:p};if("object"==typeof p&&(u=e(p,y,n,o,i)))return u}}return!1},e.getDefaultMiddleware=de,e.getType=function(e){return""+e},e.isImmutableDefault=function(e){return"object"!=typeof e||null==e},e.isPlain=le,e.nanoid=Oe,e.unwrapResult=function(e){if("error"in e)throw e.error;return e.payload}})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).RTK={})}(this,(function(e){"use strict";function t(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.join(","):"")+". Find the full error at: https://bit.ly/38PiBHb")}function n(e){return!!e&&!!e[B]}function r(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return!t||t===Object.prototype}(e)||Array.isArray(e)||!!e[M]||!!e.constructor[M]||c(e)||f(e))}function o(e,t){0===i(e)?z(e).forEach((function(n){return t(n,e[n],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function i(e){var t=e[B];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:c(e)?2:f(e)?3:0}function u(e,t){return 2===i(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function a(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function c(e){return N&&e instanceof Map}function f(e){return D&&e instanceof Set}function s(e){return e.o||e.t}function l(e,n){if(void 0===n&&(n=!1),Array.isArray(e))return e.slice();var r=Object.create(Object.getPrototypeOf(e));return o(e,(function(o){if(o!==B){var i=Object.getOwnPropertyDescriptor(e,o),u=i.value;i.get&&(n||t(1),u=i.get.call(e)),i.enumerable?r[o]=u:Object.defineProperty(r,o,{value:u,writable:!0,configurable:!0})}})),r}function d(e,t){n(e)||Object.isFrozen(e)||!r(e)||(i(e)>1&&(e.set=e.add=e.clear=e.delete=p),Object.freeze(e),t&&o(e,(function(e,t){return d(t,!0)})))}function p(){t(2)}function y(e){var n=F[e];return n||t(19,e),n}function v(){return _}function h(e,t){t&&(y("Patches"),e.u=[],e.s=[],e.v=t)}function b(e){g(e),e.p.forEach(O),e.p=null}function g(e){e===_&&(_=e.l)}function m(e){return _={p:[],l:_,h:e,m:!0,_:0}}function O(e){var t=e[B];0===t.i||1===t.i?t.j():t.O=!0}function w(e,n){n._=n.p.length;var o=n.p[0],i=void 0!==e&&e!==o;return n.h.g||y("ES5").P(n,e,i),i?(o[B].S&&(b(n),t(4)),r(e)&&(e=A(n,e),n.l||S(n,e)),n.u&&y("Patches").M(o[B],e,n.u,n.s)):e=A(n,o,[]),b(n),n.u&&n.v(n.u,n.s),e!==C?e:void 0}function A(e,t,n){if(Object.isFrozen(t))return t;var r=t[B];if(!r)return o(t,(function(o,i){return j(e,r,t,o,i,n)})),t;if(r.A!==e)return t;if(!r.S)return S(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=l(r.k,!0):r.o;o(i,(function(t,o){return j(e,r,i,t,o,n)})),S(e,i,!1),n&&e.u&&y("Patches").R(r,n,e.u,e.s)}return r.o}function j(e,t,o,c,f,s){if(n(f)){var l=A(e,f,s&&t&&3!==t.i&&!u(t.D,c)?s.concat(c):void 0);if(p=c,y=l,2===(v=i(d=o))?d.set(p,y):3===v?(d.delete(p),d.add(y)):d[p]=y,!n(l))return;e.m=!1}var d,p,y,v;if((!t||!a(f,function(e,t){return 2===i(e)?e.get(t):e[t]}(t.t,c)))&&r(f)){if(!e.h.N&&e._<1)return;A(e,f),t&&t.A.l||S(e,f)}}function S(e,t,n){void 0===n&&(n=!1),e.h.N&&e.m&&d(t,n)}function P(e,t){var n=e[B],r=Reflect.getOwnPropertyDescriptor(n?s(n):e,t);return r&&r.value}function E(e){if(!e.S){if(e.S=!0,0===e.i||1===e.i){var t=e.o=l(e.t);o(e.p,(function(e,n){t[e]=n})),e.p=void 0}e.l&&E(e.l)}}function x(e){e.o||(e.o=l(e.t))}function I(e,t,n){var r=c(t)?y("MapSet").T(t,n):f(t)?y("MapSet").F(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:v(),S:!1,I:!1,D:{},l:t,t:e,k:null,p:{},o:null,j:null,C:!1},o=r,i=U;n&&(o=[r],i=W);var u=Proxy.revocable(o,i),a=u.revoke,c=u.proxy;return r.k=c,r.j=a,c}(t,n):y("ES5").J(t,n);return(n?n.A:v()).p.push(r),r}var k,_,R="undefined"!=typeof Symbol,N="undefined"!=typeof Map,D="undefined"!=typeof Set,T="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,C=R?Symbol("immer-nothing"):((k={})["immer-nothing"]=!0,k),M=R?Symbol("immer-draftable"):"__$immer_draftable",B=R?Symbol("immer-state"):"__$immer_state",z="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,F={},U={get:function(e,t){if(t===B)return e;var n=e.p;if(!e.S&&u(n,t))return n[t];var o=s(e)[t];if(e.I||!r(o))return o;if(e.S){if(o!==P(e.t,t))return o;n=e.o}return n[t]=I(e.A.h,o,e)},has:function(e,t){return t in s(e)},ownKeys:function(e){return Reflect.ownKeys(s(e))},set:function(e,t,n){if(!e.S){var r=P(e.t,t);if(n?a(r,n)||n===e.p[t]:a(r,n)&&t in e.t)return!0;x(e),E(e)}return e.D[t]=!0,e.o[t]=n,!0},deleteProperty:function(e,t){return void 0!==P(e.t,t)||t in e.t?(e.D[t]=!1,x(e),E(e)):e.D[t]&&delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=s(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&(r.writable=!0,r.configurable=1!==e.i||"length"!==t),r},defineProperty:function(){t(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){t(12)}},W={};o(U,(function(e,t){W[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),W.deleteProperty=function(e,t){return U.deleteProperty.call(this,e[0],t)},W.set=function(e,t,n){return U.set.call(this,e[0],t,n,e[0])};var K=new(function(){function e(e){this.g=T,this.N=!1,"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),this.produce=this.produce.bind(this),this.produceWithPatches=this.produceWithPatches.bind(this)}var o=e.prototype;return o.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var u=this;return function(e){var t=this;void 0===e&&(e=i);for(var r=arguments.length,o=Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];return u.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(o))}))}}var a;if("function"!=typeof n&&t(6),void 0!==o&&"function"!=typeof o&&t(7),r(e)){var c=m(this),f=I(this,e,void 0),s=!0;try{a=n(f),s=!1}finally{s?b(c):g(c)}return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return h(c,o),w(e,c)}),(function(e){throw b(c),e})):(h(c,o),w(a,c))}if((a=n(e))!==C)return void 0===a&&(a=e),this.N&&d(a,!0),a},o.produceWithPatches=function(e,t){var n,r,o=this;return"function"==typeof e?function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return o.produceWithPatches(t,(function(t){return e.apply(void 0,[t].concat(r))}))}:[this.produce(e,t,(function(e,t){n=e,r=t})),n,r]},o.createDraft=function(e){r(e)||t(8);var n=m(this),o=I(this,e,void 0);return o[B].C=!0,g(n),o},o.finishDraft=function(e,t){var n=(e&&e[B]).A;return h(n,t),w(void 0,n)},o.setAutoFreeze=function(e){this.N=e},o.setUseProxies=function(e){T||t(20),this.g=e},o.applyPatches=function(e,t){var r;for(r=t.length-1;r>=0;r--){var o=t[r];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}var i=y("Patches").H;return n(e)?i(e,t):this.produce(e,(function(e){return i(e,t.slice(r+1))}))},e}()),L=K.produce;K.produceWithPatches.bind(K),K.setAutoFreeze.bind(K),K.setUseProxies.bind(K),K.applyPatches.bind(K),K.createDraft.bind(K),K.finishDraft.bind(K);var q=function(e){var t,n=("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()).Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}(),V=function(){return Math.random().toString(36).substring(7).split("").join(".")},X={INIT:"@@redux/INIT"+V(),REPLACE:"@@redux/REPLACE"+V(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+V()}};function H(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 J(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function");if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(J)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var o=e,i=t,u=[],a=u,c=!1;function f(){a===u&&(a=u.slice())}function s(){if(c)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function l(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(c)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var t=!0;return f(),a.push(e),function(){if(t){if(c)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");t=!1,f();var n=a.indexOf(e);a.splice(n,1)}}}function d(e){if(!H(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(c)throw new Error("Reducers may not dispatch actions.");try{c=!0,i=o(i,e)}finally{c=!1}for(var t=u=a,n=0;n<t.length;n++)(0,t[n])();return e}function p(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");o=e,d({type:X.REPLACE})}function y(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function n(){e.next&&e.next(s())}return n(),{unsubscribe:t(n)}}})[q]=function(){return this},e}return d({type:X.INIT}),(r={dispatch:d,subscribe:l,getState:s,replaceReducer:p})[q]=y,r}function Y(e,t){var n=t&&t.type;return"Given "+(n&&'action "'+String(n)+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function $(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}var i,u=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:X.INIT}))throw new Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===n(void 0,{type:X.PROBE_UNKNOWN_ACTION()}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+X.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')}))}(n)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var r=!1,o={},a=0;a<u.length;a++){var c=u[a],f=e[c],s=(0,n[c])(f,t);if(void 0===s){var l=Y(c,t);throw new Error(l)}o[c]=s,r=r||s!==f}return r?o:e}}function G(e,t){return function(){return t(e.apply(this,arguments))}}function Q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Q(e,t,n[t])}))}return e}function ee(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function te(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},o={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},i=t.map((function(e){return e(o)}));return Z({},n,{dispatch:r=ee.apply(void 0,i)(n.dispatch)})}}}function ne(e,t){return e===t}function re(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}function oe(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var n=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+n+"]")}return t}var ie=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];var i=0,u=r.pop(),a=oe(r),c=e.apply(void 0,[function(){return i++,u.apply(null,arguments)}].concat(n)),f=e((function(){for(var e=[],t=a.length,n=0;n<t;n++)e.push(a[n].apply(null,arguments));return c.apply(null,e)}));return f.resultFunc=u,f.dependencies=a,f.recomputations=function(){return i},f.resetRecomputations=function(){return i=0},f}}((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ne,n=null,r=null;return function(){return re(t,n,arguments)||(r=e.apply(null,arguments)),n=arguments,r}}));function ue(){return(ue=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var ae="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ee:ee.apply(null,arguments)};function ce(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 fe(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}var se=fe();function le(e){return null==e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||Array.isArray(e)||ce(e)}function de(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,r=[];return n&&(function(e){return"boolean"==typeof e}(n)?r.push(se):r.push(se.withExtraArgument(n.extraArgument))),r}function pe(e,t){function n(){if(t){var n=t.apply(void 0,arguments);if(!n)throw new Error("prepareAction did not return an object");return ue({type:e,payload:n.payload},"meta"in n&&{meta:n.meta},{},"error"in n&&{error:n.error})}return{type:e,payload:arguments.length<=0?void 0:arguments[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ye(e){return["type","payload","error","meta"].indexOf(e)>-1}function ve(e){var t={},n={addCase:function(e,r){var o="string"==typeof e?e:e.type;if(o in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[o]=r,n}};return e(n),t}function he(e,t){var n="function"==typeof t?ve(t):t;return function(t,r){return void 0===t&&(t=e),L(t,(function(e){var t=n[r.type];return t?t(e,r):void 0}))}}function be(e){return function(t,r){var o=function(t){!function(e){return ce(t=e)&&"string"==typeof t.type&&Object.keys(t).every(ye);var t}(r)?e(r,t):e(r.payload,t)};return n(t)?(o(t),t):L(t,o)}}function ge(e,t){return t(e)}function me(e){function t(t,n){var r=ge(t,e);r in n.entities||(n.ids.push(r),n.entities[r]=t)}function n(e,n){Array.isArray(e)||(e=Object.values(e));var r=e,o=Array.isArray(r),i=0;for(r=o?r:r[Symbol.iterator]();;){var u;if(o){if(i>=r.length)break;u=r[i++]}else{if((i=r.next()).done)break;u=i.value}t(u,n)}}function r(e,t){var n=!1;e.forEach((function(e){e in t.entities&&(delete t.entities[e],n=!0)})),n&&(t.ids=t.ids.filter((function(e){return e in t.entities})))}function o(t,n){var r={},o={};t.forEach((function(e){e.id in n.entities&&(o[e.id]=ue({},o[e.id],{},e))})),(t=Object.values(o)).length>0&&t.filter((function(t){return function(t,n,r){var o=Object.assign({},r.entities[n.id],n.changes),i=ge(o,e),u=i!==n.id;return u&&(t[n.id]=i,delete r.entities[n.id]),r.entities[i]=o,u}(r,t,n)})).length>0&&(n.ids=n.ids.map((function(e){return r[e]||e})))}function i(t,r){Array.isArray(t)||(t=Object.values(t));var i=[],u=[],a=t,c=Array.isArray(a),f=0;for(a=c?a:a[Symbol.iterator]();;){var s;if(c){if(f>=a.length)break;s=a[f++]}else{if((f=a.next()).done)break;s=f.value}var l=s,d=ge(l,e);d in r.entities?u.push({id:d,changes:l}):i.push(l)}o(u,r),n(i,r)}return{removeAll:function(e){return Object.assign({},e,{ids:[],entities:{}})},addOne:be(t),addMany:be(n),setAll:be((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.ids=[],t.entities={},n(e,t)})),updateOne:be((function(e,t){return o([e],t)})),updateMany:be(o),upsertOne:be((function(e,t){return i([e],t)})),upsertMany:be(i),removeOne:be((function(e,t){return r([e],t)})),removeMany:be(r)}}se.withExtraArgument=fe,"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var Oe=function(e){void 0===e&&(e=21);for(var t="",n=e;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},we=["name","message","stack","code"],Ae=function(e){this.value=e},je=function(e){if("object"==typeof e&&null!==e){var t={},n=we,r=Array.isArray(n),o=0;for(n=r?n:n[Symbol.iterator]();;){var i;if(r){if(o>=n.length)break;i=n[o++]}else{if((o=n.next()).done)break;i=o.value}"string"==typeof e[i]&&(t[i]=e[i])}return t}return{message:String(e)}};!function(){function e(e,t){var n=e[B];if(n&&!n.B){n.B=!0;var r=e[t];return n.B=!1,r}return e[t]}function i(e){e.S||(e.S=!0,e.l&&i(e.l))}function c(e){e.o||(e.o=f(e.t))}function f(e){var t=e&&e[B];if(t){t.B=!0;var n=l(t.k,!0);return t.B=!1,n}return l(e)}function d(e){for(var t=e.length-1;t>=0;t--){var n=e[t][B];if(!n.S)switch(n.i){case 5:y(n)&&i(n);break;case 4:p(n)&&i(n)}}}function p(e){for(var t=e.t,n=e.k,r=Object.keys(n),o=r.length-1;o>=0;o--){var i=r[o],c=t[i];if(void 0===c&&!u(t,i))return!0;var f=n[i],s=f&&f[B];if(s?s.t!==c:!a(f,c))return!0}return r.length!==Object.keys(t).length}function y(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)}function h(e){e.O&&t(3,JSON.stringify(s(e)))}var b={};!function(e,t){F.ES5=t}(0,{J:function(t,n){var u=Array.isArray(t),l=f(t);o(l,(function(n){!function(t,n,o){var u=b[n];u?u.enumerable=o:b[n]=u={enumerable:o,get:function(){return function(t,n){h(t);var o=e(s(t),n);return t.B?o:o===e(t.t,n)&&r(o)?(c(t),t.o[n]=I(t.A.h,o,t)):o}(this[B],n)},set:function(t){!function(t,n,r){if(h(t),t.D[n]=!0,!t.S){if(a(r,e(s(t),n)))return;i(t),c(t)}t.o[n]=r}(this[B],n,t)}},Object.defineProperty(t,n,u)}(l,n,u||function(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return!(!n||!n.enumerable)}(t,n))}));var d={i:u?5:4,A:n?n.A:v(),S:!1,B:!1,I:!1,D:{},l:n,t:t,k:l,o:null,O:!1,C:!1};return Object.defineProperty(l,B,{value:d,writable:!0}),l},$:i,P:function(e,t,r){e.p.forEach((function(e){e[B].B=!0})),r?n(t)&&t[B].A===e&&d(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[B];if(n){var r=n.t,a=n.k,c=n.D,f=n.i;if(4===f)o(a,(function(t){t!==B&&(void 0!==r[t]||u(r,t)?c[t]||e(a[t]):(c[t]=!0,i(n)))})),o(r,(function(e){void 0!==a[e]||u(a,e)||(c[e]=!1,i(n))}));else if(5===f){if(y(n)&&(i(n),c.length=!0),a.length<r.length)for(var s=a.length;s<r.length;s++)c[s]=!1;else for(var l=r.length;l<a.length;l++)c[l]=!0;for(var d=Math.min(a.length,r.length),p=0;p<d;p++)void 0===c[p]&&e(a[p])}}}}(e.p[0]),d(e.p))}})}(),e.__DO_NOT_USE__ActionTypes=X,e.applyMiddleware=te,e.bindActionCreators=function(e,t){if("function"==typeof e)return G(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var n=Object.keys(e),r={},o=0;o<n.length;o++){var i=n[o],u=e[i];"function"==typeof u&&(r[i]=G(u,t))}return r},e.combineReducers=$,e.compose=ee,e.configureStore=function(e){var t,n=e||{},r=n.reducer,o=void 0===r?void 0:r,i=n.middleware,u=void 0===i?de():i,a=n.devTools,c=void 0===a||a,f=n.preloadedState,s=void 0===f?void 0:f,l=n.enhancers,d=void 0===l?void 0:l;if("function"==typeof o)t=o;else{if(!ce(o))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=$(o)}var p=te.apply(void 0,u),y=ee;c&&(y=ae(ue({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(d)?v=[p].concat(d):"function"==typeof d&&(v=d(v)),J(t,s,y.apply(void 0,v))},e.createAction=pe,e.createAsyncThunk=function(e,t,n){var r=pe(e+"/fulfilled",(function(e,t,n){return{payload:e,meta:{arg:n,requestId:t}}})),o=pe(e+"/pending",(function(e,t){return{payload:void 0,meta:{arg:t,requestId:e}}})),i=pe(e+"/rejected",(function(e,t,n,r){var o=!!e&&"AbortError"===e.name,i=!!e&&"ConditionError"===e.name;return{payload:r,error:je(e||"Rejected"),meta:{arg:n,requestId:t,aborted:o,condition:i}}})),u="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(a,c,f){var s,l=Oe(),d=new u,p=new Promise((function(e,t){return d.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:s||"Aborted"})}))})),y=function(){try{var u,s=function(e){return y?e:(n&&!n.dispatchConditionRejection&&i.match(u)&&u.meta.condition||a(u),u)},y=!1,v=function(s,y){try{var v=function(){if(n&&n.condition&&!1===n.condition(e,{getState:c,extra:f}))throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return a(o(l,e)),Promise.resolve(Promise.race([p,Promise.resolve(t(e,{dispatch:a,getState:c,extra:f,requestId:l,signal:d.signal,rejectWithValue:function(e){return new Ae(e)}})).then((function(t){return t instanceof Ae?i(null,l,e,t.value):r(t,l,e)}))])).then((function(e){u=e}))}()}catch(e){return y(e)}return v&&v.then?v.then(void 0,y):v}(0,(function(t){u=i(t,l,e)}));return Promise.resolve(v&&v.then?v.then(s):s(v))}catch(e){return Promise.reject(e)}}();return Object.assign(y,{abort:function(e){s=e,d.abort()}})}}),{pending:o,rejected:i,fulfilled:r})},e.createEntityAdapter=function(e){void 0===e&&(e={});var t=ue({sortComparer:!1,selectId:function(e){return e.id}},e),n=t.selectId,r=t.sortComparer;return ue({selectId:n,sortComparer:r},{getInitialState:function(e){return void 0===e&&(e={}),Object.assign({ids:[],entities:{}},e)}},{},{getSelectors:function(e){var t=function(e){return e.ids},n=function(e){return e.entities},r=ie(t,n,(function(e,t){return e.map((function(e){return t[e]}))})),o=function(e,t){return t},i=function(e,t){return e[t]},u=ie(t,(function(e){return e.length}));if(!e)return{selectIds:t,selectEntities:n,selectAll:r,selectTotal:u,selectById:ie(n,o,i)};var a=ie(e,n);return{selectIds:ie(e,t),selectEntities:a,selectAll:ie(e,r),selectTotal:ie(e,u),selectById:ie(a,o,i)}}},{},r?function(e,t){var n=me(e);function r(t,n){Array.isArray(t)||(t=Object.values(t));var r=t.filter((function(t){return!(ge(t,e)in n.entities)}));0!==r.length&&u(r,n)}function o(t,n){var r=[];t.forEach((function(t){return function(t,n,r){if(!(n.id in r.entities))return!1;var o=Object.assign({},r.entities[n.id],n.changes),i=ge(o,e);return delete r.entities[n.id],t.push(o),i!==n.id}(r,t,n)})),0!==r.length&&u(r,n)}function i(t,n){Array.isArray(t)||(t=Object.values(t));var i=[],u=[],a=t,c=Array.isArray(a),f=0;for(a=c?a:a[Symbol.iterator]();;){var s;if(c){if(f>=a.length)break;s=a[f++]}else{if((f=a.next()).done)break;s=f.value}var l=s,d=ge(l,e);d in n.entities?u.push({id:d,changes:l}):i.push(l)}o(u,n),r(i,n)}function u(n,r){n.sort(t),n.forEach((function(t){r.entities[e(t)]=t}));var o=Object.values(r.entities);o.sort(t);var i=o.map(e);(function(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(e[n]!==t[n])return!1;return!0})(r.ids,i)||(r.ids=i)}return{removeOne:n.removeOne,removeMany:n.removeMany,removeAll:n.removeAll,addOne:be((function(e,t){return r([e],t)})),updateOne:be((function(e,t){return o([e],t)})),upsertOne:be((function(e,t){return i([e],t)})),setAll:be((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.entities={},t.ids=[],r(e,t)})),addMany:be(r),updateMany:be(o),upsertMany:be(i)}}(n,r):me(n))},e.createImmutableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},e.createNextState=L,e.createReducer=he,e.createSelector=ie,e.createSerializableStateInvariantMiddleware=function(e){return function(){return function(e){return function(t){return e(t)}}}},e.createSlice=function(e){var t=e.name,n=e.initialState;if(!t)throw new Error("`name` is a required option for createSlice");var r=e.reducers||{},o=void 0===e.extraReducers?{}:"function"==typeof e.extraReducers?ve(e.extraReducers):e.extraReducers,i=Object.keys(r),u={},a={},c={};i.forEach((function(e){var n,o,i=r[e],f=t+"/"+e;"reducer"in i?(n=i.reducer,o=i.prepare):n=i,u[e]=n,a[f]=n,c[e]=o?pe(f,o):pe(f)}));var f=he(n,ue({},o,{},a));return{name:t,reducer:f,actions:c,caseReducers:u}},e.createStore=J,e.findNonSerializableValue=function e(t,n,r,o,i){var u;if(void 0===n&&(n=[]),void 0===r&&(r=le),void 0===i&&(i=[]),!r(t))return{keyPath:n.join(".")||"<root>",value:t};if("object"!=typeof t||null===t)return!1;var a=null!=o?o(t):Object.entries(t),c=i.length>0,f=a,s=Array.isArray(f),l=0;for(f=s?f:f[Symbol.iterator]();;){var d;if(s){if(l>=f.length)break;d=f[l++]}else{if((l=f.next()).done)break;d=l.value}var p=d[1],y=n.concat(d[0]);if(!(c&&i.indexOf(y.join("."))>=0)){if(!r(p))return{keyPath:y.join("."),value:p};if("object"==typeof p&&(u=e(p,y,r,o,i)))return u}}return!1},e.getDefaultMiddleware=de,e.getType=function(e){return""+e},e.isImmutableDefault=function(e){return"object"!=typeof e||null==e},e.isPlain=le,e.nanoid=Oe,e.unwrapResult=function(e){if("error"in e)throw e.error;return e.payload}})); | ||
//# sourceMappingURL=redux-toolkit.umd.min.js.map |
@@ -172,2 +172,23 @@ import { Action } from 'redux'; | ||
/** | ||
* A ThunkAction created by `createAsyncThunk`. | ||
* Dispatching it returns a Promise for either a | ||
* fulfilled or rejected action. | ||
* Also, the returned value contains a `abort()` method | ||
* that allows the asyncAction to be cancelled from the outside. | ||
* | ||
* @public | ||
*/ | ||
export declare type AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig extends AsyncThunkConfig> = (dispatch: GetDispatch<ThunkApiConfig>, getState: () => GetState<ThunkApiConfig>, extra: GetExtra<ThunkApiConfig>) => Promise<PayloadAction<Returned, string, { | ||
arg: ThunkArg; | ||
requestId: string; | ||
}> | PayloadAction<undefined | GetRejectValue<ThunkApiConfig>, string, { | ||
arg: ThunkArg; | ||
requestId: string; | ||
aborted: boolean; | ||
condition: boolean; | ||
}, SerializedError>> & { | ||
abort(reason?: string): void; | ||
}; | ||
declare type AsyncThunkConfig = { | ||
@@ -180,3 +201,37 @@ state?: unknown; | ||
declare interface AsyncThunkOptions<ThunkArg = void, ThunkApiConfig extends AsyncThunkConfig = {}> { | ||
/** | ||
* A method to control whether the asyncThunk should be executed. Has access to the | ||
* `arg`, `api.getState()` and `api.extra` arguments. | ||
* | ||
* @returns `true` if the asyncThunk should be executed, `false` if it should be skipped | ||
*/ | ||
condition?(arg: ThunkArg, api: Pick<GetThunkAPI<ThunkApiConfig>, 'getState' | 'extra'>): boolean; | ||
/** | ||
* If `condition` returns `false`, the asyncThunk will be skipped. | ||
* This option allows you to control whether a `rejected` action with `meta.condition == false` | ||
* will be dispatched or not. | ||
* | ||
* @default `false` | ||
*/ | ||
dispatchConditionRejection?: boolean; | ||
} | ||
/** | ||
* A type describing the `payloadCreator` argument to `createAsyncThunk`. | ||
* Might be useful for wrapping `createAsyncThunk` in custom abstractions. | ||
* | ||
* @public | ||
*/ | ||
export declare type AsyncThunkPayloadCreator<Returned, ThunkArg = void, ThunkApiConfig extends AsyncThunkConfig = {}> = (arg: ThunkArg, thunkAPI: GetThunkAPI<ThunkApiConfig>) => AsyncThunkPayloadCreatorReturnValue<Returned, ThunkApiConfig>; | ||
/** | ||
* A type describing the return value of the `payloadCreator` argument to `createAsyncThunk`. | ||
* Might be useful for wrapping `createAsyncThunk` in custom abstractions. | ||
* | ||
* @public | ||
*/ | ||
export declare type AsyncThunkPayloadCreatorReturnValue<Returned, ThunkApiConfig extends AsyncThunkConfig> = Promise<Returned | RejectWithValue<GetRejectValue<ThunkApiConfig>>> | Returned | RejectWithValue<GetRejectValue<ThunkApiConfig>>; | ||
/** | ||
* returns True if TS version is above 3.5, False if below. | ||
@@ -360,15 +415,7 @@ * uses feature detection to detect TS version >= 3.5 | ||
* @param payloadCreator | ||
* @param options | ||
* | ||
* @public | ||
*/ | ||
export declare function createAsyncThunk<Returned, ThunkArg = void, ThunkApiConfig extends AsyncThunkConfig = {}>(type: string, payloadCreator: (arg: ThunkArg, thunkAPI: GetThunkAPI<ThunkApiConfig>) => Promise<Returned | RejectWithValue<GetRejectValue<ThunkApiConfig>>> | Returned | RejectWithValue<GetRejectValue<ThunkApiConfig>>): ((arg: ThunkArg) => (dispatch: GetDispatch<ThunkApiConfig>, getState: () => GetState<ThunkApiConfig>, extra: GetExtra<ThunkApiConfig>) => Promise<PayloadAction<Returned, string, { | ||
arg: ThunkArg; | ||
requestId: string; | ||
}, never> | PayloadAction<GetRejectValue<ThunkApiConfig> | undefined, string, { | ||
arg: ThunkArg; | ||
requestId: string; | ||
aborted: boolean; | ||
}, SerializedError>> & { | ||
abort: (reason?: string | undefined) => void; | ||
}) & { | ||
export declare function createAsyncThunk<Returned, ThunkArg = void, ThunkApiConfig extends AsyncThunkConfig = {}>(type: string, payloadCreator: (arg: ThunkArg, thunkAPI: GetThunkAPI<ThunkApiConfig>) => Promise<Returned | RejectWithValue<GetRejectValue<ThunkApiConfig>>> | Returned | RejectWithValue<GetRejectValue<ThunkApiConfig>>, options?: AsyncThunkOptions<ThunkArg, ThunkApiConfig>): IsAny<ThunkArg, (arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>, unknown extends ThunkArg ? (arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> : [ThunkArg] extends [void] | [undefined] ? () => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> : [void] extends [ThunkArg] ? (arg?: ThunkArg | undefined) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> : [undefined] extends [ThunkArg] ? (arg?: ThunkArg | undefined) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> : (arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>> & { | ||
pending: ActionCreatorWithPreparedPayload<[string, ThunkArg], undefined, string, never, { | ||
@@ -382,2 +429,3 @@ arg: ThunkArg; | ||
aborted: boolean; | ||
condition: boolean; | ||
}>; | ||
@@ -857,2 +905,3 @@ fulfilled: ActionCreatorWithPreparedPayload<[Returned, string, ThunkArg], Returned, string, never, { | ||
warnAfter?: number; | ||
ignore?: string[]; | ||
} | ||
@@ -859,0 +908,0 @@ |
{ | ||
"name": "@reduxjs/toolkit", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "The official, opinionated, batteries-included toolset for efficient Redux development", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/reduxjs/redux-toolkit", |
@@ -479,1 +479,94 @@ import { | ||
}) | ||
describe('conditional skipping of asyncThunks', () => { | ||
const arg = {} | ||
const getState = jest.fn(() => ({})) | ||
const dispatch = jest.fn((x: any) => x) | ||
const payloadCreator = jest.fn((x: typeof arg) => 10) | ||
const condition = jest.fn(() => false) | ||
const extra = {} | ||
beforeEach(() => { | ||
getState.mockClear() | ||
dispatch.mockClear() | ||
payloadCreator.mockClear() | ||
condition.mockClear() | ||
}) | ||
test('returning false from condition skips payloadCreator and returns a rejected action', async () => { | ||
const asyncThunk = createAsyncThunk('test', payloadCreator, { condition }) | ||
const result = await asyncThunk(arg)(dispatch, getState, extra) | ||
expect(condition).toHaveBeenCalled() | ||
expect(payloadCreator).not.toHaveBeenCalled() | ||
expect(asyncThunk.rejected.match(result)).toBe(true) | ||
expect((result as any).meta.condition).toBe(true) | ||
}) | ||
test('return falsy from condition does not skip payload creator', async () => { | ||
// Override TS's expectation that this is a boolean | ||
condition.mockReturnValueOnce((undefined as unknown) as boolean) | ||
const asyncThunk = createAsyncThunk('test', payloadCreator, { condition }) | ||
const result = await asyncThunk(arg)(dispatch, getState, extra) | ||
expect(condition).toHaveBeenCalled() | ||
expect(payloadCreator).toHaveBeenCalled() | ||
expect(asyncThunk.fulfilled.match(result)).toBe(true) | ||
expect(result.payload).toBe(10) | ||
}) | ||
test('returning true from condition executes payloadCreator', async () => { | ||
condition.mockReturnValueOnce(true) | ||
const asyncThunk = createAsyncThunk('test', payloadCreator, { condition }) | ||
const result = await asyncThunk(arg)(dispatch, getState, extra) | ||
expect(condition).toHaveBeenCalled() | ||
expect(payloadCreator).toHaveBeenCalled() | ||
expect(asyncThunk.fulfilled.match(result)).toBe(true) | ||
expect(result.payload).toBe(10) | ||
}) | ||
test('condition is called with arg, getState and extra', async () => { | ||
const asyncThunk = createAsyncThunk('test', payloadCreator, { condition }) | ||
await asyncThunk(arg)(dispatch, getState, extra) | ||
expect(condition).toHaveBeenCalledTimes(1) | ||
expect(condition).toHaveBeenLastCalledWith( | ||
arg, | ||
expect.objectContaining({ getState, extra }) | ||
) | ||
}) | ||
test('rejected action is not dispatched by default', async () => { | ||
const asyncThunk = createAsyncThunk('test', payloadCreator, { condition }) | ||
await asyncThunk(arg)(dispatch, getState, extra) | ||
expect(dispatch).toHaveBeenCalledTimes(0) | ||
}) | ||
test('rejected action can be dispatched via option', async () => { | ||
const asyncThunk = createAsyncThunk('test', payloadCreator, { | ||
condition, | ||
dispatchConditionRejection: true | ||
}) | ||
await asyncThunk(arg)(dispatch, getState, extra) | ||
expect(dispatch).toHaveBeenCalledTimes(1) | ||
expect(dispatch).toHaveBeenLastCalledWith( | ||
expect.objectContaining({ | ||
error: { | ||
message: 'Aborted due to condition callback returning false.', | ||
name: 'ConditionError' | ||
}, | ||
meta: { | ||
aborted: false, | ||
arg: arg, | ||
condition: true, | ||
requestId: expect.stringContaining('') | ||
}, | ||
payload: undefined, | ||
type: 'test/rejected' | ||
}) | ||
) | ||
}) | ||
}) |
@@ -8,3 +8,3 @@ import { Dispatch, AnyAction } from 'redux' | ||
import { ThunkDispatch } from 'redux-thunk' | ||
import { FallbackIfUnknown } from './tsHelpers' | ||
import { FallbackIfUnknown, IsAny } from './tsHelpers' | ||
import { nanoid } from './nanoid' | ||
@@ -106,7 +106,120 @@ | ||
: unknown | ||
/** | ||
* A type describing the return value of the `payloadCreator` argument to `createAsyncThunk`. | ||
* Might be useful for wrapping `createAsyncThunk` in custom abstractions. | ||
* | ||
* @public | ||
*/ | ||
export type AsyncThunkPayloadCreatorReturnValue< | ||
Returned, | ||
ThunkApiConfig extends AsyncThunkConfig | ||
> = | ||
| Promise<Returned | RejectWithValue<GetRejectValue<ThunkApiConfig>>> | ||
| Returned | ||
| RejectWithValue<GetRejectValue<ThunkApiConfig>> | ||
/** | ||
* A type describing the `payloadCreator` argument to `createAsyncThunk`. | ||
* Might be useful for wrapping `createAsyncThunk` in custom abstractions. | ||
* | ||
* @public | ||
*/ | ||
export type AsyncThunkPayloadCreator< | ||
Returned, | ||
ThunkArg = void, | ||
ThunkApiConfig extends AsyncThunkConfig = {} | ||
> = ( | ||
arg: ThunkArg, | ||
thunkAPI: GetThunkAPI<ThunkApiConfig> | ||
) => AsyncThunkPayloadCreatorReturnValue<Returned, ThunkApiConfig> | ||
/** | ||
* A ThunkAction created by `createAsyncThunk`. | ||
* Dispatching it returns a Promise for either a | ||
* fulfilled or rejected action. | ||
* Also, the returned value contains a `abort()` method | ||
* that allows the asyncAction to be cancelled from the outside. | ||
* | ||
* @public | ||
*/ | ||
export type AsyncThunkAction< | ||
Returned, | ||
ThunkArg, | ||
ThunkApiConfig extends AsyncThunkConfig | ||
> = ( | ||
dispatch: GetDispatch<ThunkApiConfig>, | ||
getState: () => GetState<ThunkApiConfig>, | ||
extra: GetExtra<ThunkApiConfig> | ||
) => Promise< | ||
| PayloadAction<Returned, string, { arg: ThunkArg; requestId: string }> | ||
| PayloadAction< | ||
undefined | GetRejectValue<ThunkApiConfig>, | ||
string, | ||
{ | ||
arg: ThunkArg | ||
requestId: string | ||
aborted: boolean | ||
condition: boolean | ||
}, | ||
SerializedError | ||
> | ||
> & { | ||
abort(reason?: string): void | ||
} | ||
type AsyncThunkActionCreator< | ||
Returned, | ||
ThunkArg, | ||
ThunkApiConfig extends AsyncThunkConfig | ||
> = IsAny< | ||
ThunkArg, | ||
// any handling | ||
(arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>, | ||
// unknown handling | ||
unknown extends ThunkArg | ||
? (arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> // argument not specified or specified as void or undefined | ||
: [ThunkArg] extends [void] | [undefined] | ||
? () => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> // argument contains void | ||
: [void] extends [ThunkArg] // make optional | ||
? (arg?: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> // argument contains undefined | ||
: [undefined] extends [ThunkArg] | ||
? WithStrictNullChecks< | ||
// with strict nullChecks: make optional | ||
( | ||
arg?: ThunkArg | ||
) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>, | ||
// without strict null checks this will match everything, so don't make it optional | ||
(arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> | ||
> // default case: normal argument | ||
: (arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> | ||
> | ||
interface AsyncThunkOptions< | ||
ThunkArg = void, | ||
ThunkApiConfig extends AsyncThunkConfig = {} | ||
> { | ||
/** | ||
* A method to control whether the asyncThunk should be executed. Has access to the | ||
* `arg`, `api.getState()` and `api.extra` arguments. | ||
* | ||
* @returns `true` if the asyncThunk should be executed, `false` if it should be skipped | ||
*/ | ||
condition?( | ||
arg: ThunkArg, | ||
api: Pick<GetThunkAPI<ThunkApiConfig>, 'getState' | 'extra'> | ||
): boolean | ||
/** | ||
* If `condition` returns `false`, the asyncThunk will be skipped. | ||
* This option allows you to control whether a `rejected` action with `meta.condition == false` | ||
* will be dispatched or not. | ||
* | ||
* @default `false` | ||
*/ | ||
dispatchConditionRejection?: boolean | ||
} | ||
/** | ||
* | ||
* @param type | ||
* @param payloadCreator | ||
* @param options | ||
* | ||
@@ -127,3 +240,4 @@ * @public | ||
| Returned | ||
| RejectWithValue<GetRejectValue<ThunkApiConfig>> | ||
| RejectWithValue<GetRejectValue<ThunkApiConfig>>, | ||
options?: AsyncThunkOptions<ThunkArg, ThunkApiConfig> | ||
) { | ||
@@ -161,2 +275,3 @@ type RejectedValue = GetRejectValue<ThunkApiConfig> | ||
const aborted = !!error && error.name === 'AbortError' | ||
const condition = !!error && error.name === 'ConditionError' | ||
return { | ||
@@ -168,3 +283,4 @@ payload, | ||
requestId, | ||
aborted | ||
aborted, | ||
condition | ||
} | ||
@@ -203,8 +319,6 @@ } | ||
function actionCreator(arg: ThunkArg) { | ||
return ( | ||
dispatch: GetDispatch<ThunkApiConfig>, | ||
getState: () => GetState<ThunkApiConfig>, | ||
extra: GetExtra<ThunkApiConfig> | ||
) => { | ||
function actionCreator( | ||
arg: ThunkArg | ||
): AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> { | ||
return (dispatch, getState, extra) => { | ||
const requestId = nanoid() | ||
@@ -229,2 +343,12 @@ | ||
try { | ||
if ( | ||
options && | ||
options.condition && | ||
options.condition(arg, { getState, extra }) === false | ||
) { | ||
throw { | ||
name: 'ConditionError', | ||
message: 'Aborted due to condition callback returning false.' | ||
} | ||
} | ||
dispatch(pending(requestId, arg)) | ||
@@ -259,3 +383,11 @@ finalAction = await Promise.race([ | ||
dispatch(finalAction) | ||
const skipDispatch = | ||
options && | ||
!options.dispatchConditionRejection && | ||
rejected.match(finalAction) && | ||
finalAction.meta.condition | ||
if (!skipDispatch) { | ||
dispatch(finalAction) | ||
} | ||
return finalAction | ||
@@ -267,7 +399,14 @@ })() | ||
return Object.assign(actionCreator, { | ||
pending, | ||
rejected, | ||
fulfilled | ||
}) | ||
return Object.assign( | ||
actionCreator as AsyncThunkActionCreator< | ||
Returned, | ||
ThunkArg, | ||
ThunkApiConfig | ||
>, | ||
{ | ||
pending, | ||
rejected, | ||
fulfilled | ||
} | ||
) | ||
} | ||
@@ -295,1 +434,5 @@ | ||
} | ||
type WithStrictNullChecks<True, False> = undefined extends boolean | ||
? False | ||
: True |
@@ -113,3 +113,3 @@ import { Store, MiddlewareAPI, Dispatch } from 'redux' | ||
it('respects "ignore" option', () => { | ||
it('respects "ignoredPaths" option', () => { | ||
const next: Dispatch = action => { | ||
@@ -127,2 +127,15 @@ state.foo.bar.push(5) | ||
it('alias "ignore" to "ignoredPath" and respects option', () => { | ||
const next: Dispatch = action => { | ||
state.foo.bar.push(5) | ||
return action | ||
} | ||
const dispatch = middleware({ ignore: ['foo.bar'] })(next) | ||
expect(() => { | ||
dispatch({ type: 'SOME_ACTION' }) | ||
}).not.toThrow() | ||
}) | ||
it('Should print a warning if execution takes too long', () => { | ||
@@ -129,0 +142,0 @@ state.foo.bar = new Array(10000).fill({ value: 'more' }) |
@@ -190,2 +190,3 @@ import { Middleware } from 'redux' | ||
warnAfter?: number | ||
ignore?: string[] // @deprecated. Use ignoredPaths | ||
} | ||
@@ -209,7 +210,12 @@ | ||
const { | ||
let { | ||
isImmutable = isImmutableDefault, | ||
ignoredPaths, | ||
warnAfter = 32 | ||
warnAfter = 32, | ||
ignore | ||
} = options | ||
// Alias ignore->ignoredPaths, but prefer ignoredPaths if present | ||
ignoredPaths = ignoredPaths || ignore | ||
const track = trackForMutations.bind(null, isImmutable, ignoredPaths) | ||
@@ -216,0 +222,0 @@ |
@@ -99,2 +99,5 @@ import { enableES5 } from 'immer' | ||
export { | ||
AsyncThunkAction, | ||
AsyncThunkPayloadCreatorReturnValue, | ||
AsyncThunkPayloadCreator, | ||
createAsyncThunk, | ||
@@ -101,0 +104,0 @@ unwrapResult, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1336726
11548