state-decorator 6.6.2 → 6.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/impl.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t(e){var t={exports:{}};return e(t,t.exports),t.exports}Object.defineProperty(exports,"__esModule",{value:!0});var r,n=t((function(e){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n},e.exports.default=e.exports,e.exports.__esModule=!0})),o=t((function(e){e.exports=function(e){if(Array.isArray(e))return n(e)},e.exports.default=e.exports,e.exports.__esModule=!0})),i=t((function(e){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)},e.exports.default=e.exports,e.exports.__esModule=!0})),a=t((function(e){e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0})),c=t((function(e){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0})),u=e(t((function(e){e.exports=function(e){return o(e)||i(e)||a(e)||c()},e.exports.default=e.exports,e.exports.__esModule=!0}))),s=t((function(e){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0})),f=t((function(e){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return r}},e.exports.default=e.exports,e.exports.__esModule=!0})),l=t((function(e){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0})),p=e(t((function(e){e.exports=function(e,t){return s(e)||f(e,t)||a(e,t)||l()},e.exports.default=e.exports,e.exports.__esModule=!0}))),d=e(t((function(e){function t(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}e.exports=function(e){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=e.apply(r,n);function c(e){t(a,o,i,c,u,"next",e)}function u(e){t(a,o,i,c,u,"throw",e)}c(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0}))),h=e(t((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.default=e.exports,e.exports.__esModule=!0}))),v=t((function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var o=t&&t.prototype instanceof y?t:y,i=Object.create(o.prototype),a=new L(n||[]);return i._invoke=function(e,t,r){var n=l;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw i;return R()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=O(a,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=f(e,t,r);if("normal"===u.type){if(n=r.done?h:p,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=h,r.method="throw",r.arg=u.arg)}}}(e,r,a),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l="suspendedStart",p="suspendedYield",d="executing",h="completed",v={};function y(){}function g(){}function m(){}var x={};x[i]=function(){return this};var w=Object.getPrototypeOf,E=w&&w(w(j([])));E&&E!==r&&n.call(E,i)&&(x=E);var b=m.prototype=y.prototype=Object.create(x);function S(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,t){function r(o,i,a,c){var u=f(e[o],e,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,a,c)}),(function(e){r("throw",e,a,c)})):t.resolve(l).then((function(e){s.value=e,a(s)}),(function(e){return r("throw",e,a,c)}))}c(u.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}}function O(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function j(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:R}}function R(){return{value:t,done:!0}}return g.prototype=b.constructor=m,m.constructor=g,g.displayName=u(m,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},S(P.prototype),P.prototype[a]=function(){return this},e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new P(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},S(b),u(b,c,"Generator"),b[i]=function(){return this},b.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=j,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),y=e(t((function(e){function t(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=t=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),t(r)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0})));function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}!function(e){e.REJECT="reject",e.IGNORE="ignore",e.KEEP_LAST="keepLast",e.KEEP_ALL="keepAll",e.PARALLEL="parallel",e.REUSE="reuse"}(r||(r={}));var x={clone:function(e){return JSON.parse(JSON.stringify(e))},comparator:function(e,t){if(Object.is(e,t))return!0;if("object"!==y(e)||null===e||"object"!==y(t)||null===t)return!1;if(e instanceof Set||t instanceof Set)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(t,r[o])||!Object.is(e[r[o]],t[r[o]]))return!1;return!0},asyncErrorHandler:function(){},retryOnErrorFunction:function(e){return e instanceof TypeError},notifySuccess:void 0,notifyError:void 0,notifyWarning:void 0,getErrorMessage:void 0,defaultMiddlewares:[]};function w(e){try{return x.clone(e)}catch(e){var t="StateDecorator: Cannot clone object. Call setCloneFunction with another implementation like lodash/cloneDeep.";throw"development"===process.env.NODE_ENV&&(console.error(t),console.error(e.toString())),new Error(t)}}function E(e){return"function"!=typeof e&&!e.hasOwnProperty("getPromise")&&e.hasOwnProperty("getGetPromise")}function b(e,t,r,n){return m(m({},e),{},h({},t,n?m(m({},e[t]||{}),{},h({},r,n)):m(m({},e[t]),{},h({},r,!1))))}function S(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){return!0};return 1===t?e:function(o){function i(e,t){return a.apply(this,arguments)}function a(){return(a=d(v.mark((function a(c,u){return v.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(null!==u){a.next=2;break}return a.abrupt("return",null);case 2:return a.abrupt("return",u.catch((function(a){return n(a)?c===t?Promise.reject(a):new Promise((function(t,n){setTimeout((function(){var r=e(o);i(c+1,r).then(t).catch(n)}),r*c)})):Promise.reject(a)})));case 3:case"end":return a.stop()}}),a)})))).apply(this,arguments)}var c=e(o);return null===c?null:i(1,c)}}function P(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return{current:e}}function O(e,t,r){var n,o;return{state:e.current,s:e.current,ds:null==t||null===(n=t.current)||void 0===n?void 0:n.state,derived:null==t||null===(o=t.current)||void 0===o?void 0:o.state,props:r.current,p:r.current}}function _(e,t,r,n,o,i){var a=O(e,t,r);return a.indices=n,a.index=o,a.isInit=i,a}function A(e,t,r,n,o){var i=O(e,t,r);return i.args=n,o&&(i.promiseId=o),i}function L(e,t,r,n,o,i){var a=A(e,t,r,n,i);return a.result=o,a.res=o,a}function j(e,t,r,n,o,i,a){var c=M(A(e,t,r,n,a),o);return c.abortSignal=i,c}function R(e,t){var r=e;return r.state=t.current,r.s=t.current,r}function M(e,t){var r=e;return r.actions=t.current,r.a=t.current,r}function C(e,t,r,n,o){var i,a=M(e,n);R(e,t);var c=null==r||null===(i=r.current)||void 0===i?void 0:i.state;return a.derived=c,a.ds=c,a.notifyWarning=o,a}function T(e){"development"===process.env.NODE_ENV&&console.warn("[state-decorator] ".concat(e," action was called while store is not initialized or destroyed, this is probably a leak"))}function k(e,t,r,n,o,i,a,c,u,s){var f=L(r,n,o,s,void 0),l=!1;if(null!=t.effects){var p=t.effects(f);null===p?l=!0:u(p,void 0,e,"effects",!1,f,!1)}if(!l)if(t.debounceSideEffectsTimeout>0){var d=a.current[e];d&&clearTimeout(d),a.current[e]=setTimeout((function(){t.sideEffects(C(f,r,n,i,c.notifyWarning)),delete a.current[e]}),t.debounceSideEffectsTimeout)}else t.sideEffects&&t.sideEffects(C(f,r,n,i,c.notifyWarning))}function I(e,t,r,n){var o=e.action,i=e.stateRef,a=e.derivedStateRef,c=e.propsRef,u=e.promisesRef,s=e.actionsRef,f=e.loadingMapRef,l=e.conflictActionsRef,p=e.actionName,d=e.options,h=e.setState;if(e.initializedRef.current){var v=null,y=L(i,a,c,n,r,t);o.effects&&(v=o.effects(y)),h(v,b(f.current,p,t,!1),p,"effects",!0,y,!1);var g,m=d.notifySuccess||x.notifySuccess;if(m)o.getSuccessMessage&&(g=o.getSuccessMessage(y)),g&&m(g);return delete u.current[p][t],o.sideEffects&&o.sideEffects(C(y,i,a,s,x.notifyWarning)),U(p,s.current,l.current),r}}function G(e,t,r,n){var o=e.action,i=e.stateRef,a=e.derivedStateRef,c=e.propsRef,u=e.actionsRef,s=e.loadingMapRef,f=e.promisesRef,l=e.conflictActionsRef,p=e.actionName,d=e.options,h=e.setState;if(e.initializedRef.current){var v=null,y=function(e,t,r,n,o,i){var a=A(e,t,r,n,i);return a.error=o,a.err=o,a}(i,a,c,n,r,t);o.errorEffects&&(v=o.errorEffects(y)),h(v,b(s.current,p,t,!1),p,"errorEffects",!0,y,!1);var g=!1;(null!=v||o.errorSideEffects)&&(g=!0);var m,w=d.notifyError||x.notifyError;if(w)o.getErrorMessage&&(m=o.getErrorMessage(y)),m||g||!x.getErrorMessage||(m=x.getErrorMessage(r)),m&&(g=!0,w(m));return x.asyncErrorHandler(r,g||o.rejectPromiseOnError,i.current,c.current,p,n),delete f.current[p][t],o.errorSideEffects&&o.errorSideEffects(C(y,i,a,u,x.notifyWarning)),U(p,u.current,l.current),!g||o.rejectPromiseOnError?Promise.reject(r):Promise.resolve()}}var N="__def__";function D(e,t){return e.length===t.length&&-1===e.findIndex((function(e,r){return t[r]!==e}))}function F(e,t,n,o,i){var a=o;if(a===r.REUSE){if(D(e[n][N].refArgs,i))return e[n][N].promise;a=r.KEEP_ALL}return new Promise((function(e,o){var c={resolve:e,reject:o,args:w(i),timestamp:Date.now()};switch(a){case r.IGNORE:e(void 0);break;case r.REJECT:o(new Error("An asynchronous action ".concat(n," is already ongoing.")));break;case r.KEEP_LAST:t[n]=[c];break;case r.KEEP_ALL:var u=t[n];u||(t[n]=u=[]),u.push(c);break;case r.PARALLEL:case r.REUSE:}}))}function U(e,t,r){var n=r[e];if(n&&n.length>0){var o=r[e].shift();if(o){var i=t[e].apply(t,u(o.args));null==i?U(e,t,r):i.then((function(n){null===n&&U(e,t,r),o.resolve(n)})).catch((function(e){return o.reject(e)}))}}}exports.DEFAULT_PROMISE_ID=N,exports.addContextActions=M,exports.addStateToContext=R,exports.areSameArgs=D,exports.buildInvocationContextBase=O,exports.buildLoadingMap=b,exports.buildOnMountInvocationContext=function(e,t,r,n){return M(O(e,t,r),n)},exports.buildOnPropChangeEffects=_,exports.computeAsyncActionInput=function(e){return E(e)?m(m({},e),{},{getPromise:e.getGetPromise,retryCount:3,conflictPolicy:r.REUSE}):e},exports.computeDerivedValues=function(e,t,r,n){if(null==(null==n?void 0:n.derivedState))return!1;var o=!1,i=x.comparator,a=r.current.deps,c=O(e,null,t),u=Object.keys(n.derivedState);return r.current.state=u.reduce((function(e,t){var u=!1,s=a[t],f=n.derivedState[t].getDeps(c);return u=null==s||null!=f.find((function(e,t){return s.length<t||!i(s[t],e)})),o=o||u,a[t]=f,e[t]=u?n.derivedState[t].get(c):r.current.state[t],e}),{}),o},exports.createRef=P,exports.decorateAsyncAction=function(e){var t=e.action,n=e.stateRef,o=e.derivedStateRef,i=e.propsRef,a=e.actionsRef,c=e.promisesRef,u=e.loadingMapRef,s=e.initializedRef,f=e.conflictActionsRef,l=e.actionName,p=e.setState;return function(){for(var d,v,y=arguments.length,g=new Array(y),w=0;w<y;w++)g[w]=arguments[w];if(!s.current)return T(l),null;var E=c.current,P=t.conflictPolicy,O=void 0===P?r.KEEP_ALL:P,_=O===r.PARALLEL,L=null;if(_){if(!t.getPromiseId)throw new Error("If conflict policy is set to ConflictPolicy.PARALLEL, getPromiseId must be set and return a string.");L=t.getPromiseId.apply(t,g)}else L=N;if(!_&&null!==(d=E[l])&&void 0!==d&&d[L])return F(E,f.current,l,O,g);var R=null,M=!1,C=A(n,o,i,g,L);t.preEffects&&(R=t.preEffects(C))&&(M=!0,n.current=R);var k=t.abortable,D=t.retryCount,U=t.retryDelaySeed,K=t.isTriggerRetryError,W=k&&window.AbortController?new AbortController:null,z=S(t.getPromise,D?1+D:1,U,K||x.retryOnErrorFunction),J=null===(v=z(j(n,o,i,g,a,null==W?void 0:W.signal)))||void 0===v?void 0:v.then((function(t){return I(e,L,t,g)})).catch((function(t){return G(e,L,t,g)}));return null!=J&&(E[l]=m(m({},E[l]||{}),{},h({},L||N,{abortController:W,promise:J,refArgs:O===r.REUSE&&g.length>0?[].concat(g):[]}))),p(null!=J||M?n.current:void 0,null==J?void 0:b(u.current,l,L,!0),l,"preEffects",!0,C,!1),J}},exports.decorateSimpleSyncAction=function(e,t,r,n,o,i,a){return function(){if(i.current){for(var c=arguments.length,u=new Array(c),s=0;s<c;s++)u[s]=arguments[s];var f=A(r,n,o,u),l=t(f);a(l,null,e,"effects",!1,f,!1)}else T(e)}},exports.decorateSyncAction=function(e,t,r,n,o,i,a,c,u,s){return function(){for(var f=arguments.length,l=new Array(f),p=0;p<f;p++)l[p]=arguments[p];if(a.current)if(t.debounceTimeout){var d=c.current[e];d&&clearTimeout(d),c.current[e]=setTimeout((function(){delete c.current[e],k(e,t,r,n,o,i,c,u,s,l)}),t.debounceTimeout)}else k(e,t,r,n,o,i,c,u,s,l);else T(e)}},exports.globalConfig=x,exports.isAsyncAction=function(e){return!(e instanceof Function)&&(e.hasOwnProperty("getPromise")||e.hasOwnProperty("getGetPromise"))},exports.isAsyncGetPromiseAction=function(e){return"function"!=typeof e&&e.hasOwnProperty("getPromise")&&!e.hasOwnProperty("getGetPromise")},exports.isAsyncGetPromiseGetAction=E,exports.isLoadingImpl=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return r.some((function(t){var r=null,n=N;if(Array.isArray(t)){var o=p(t,2);r=o[0];var i=o[1];n=void 0===i?N:i}else r=t;var a=e[r];return null!=a&&(null!=a[n]&&a[n])}))},exports.isSimpleSyncAction=function(e){return"function"==typeof e},exports.isSyncAction=function(e){return"function"!=typeof e&&!e.hasOwnProperty("getPromise")&&!e.hasOwnProperty("getGetPromise")},exports.onPropChange=function(e,t,r,n,o,i,a,c){var u=null!=(null==i?void 0:i.derivedState);if(null!=i.onPropsChange){var s;s=Array.isArray(i.onPropsChange)?i.onPropsChange:[i.onPropsChange];var f=!1,l=P(e.current),p=[],d=x.comparator;s.forEach((function(e,o){var i=e.getDeps;if(i){var u=!1,s=[];if(c){if(!e.onMount)return;u=!0}else{var h=i(n),v=i(r.current);h.length!==v.length?(console.warn("options.onPropsChange.getDeps returned array must be stable (same length)"),u=!0):h.forEach((function(e,t){d(e,v[t])||(u=!0,s.push(t))}))}if(u){var y,g,m=_(l,t,r,s,o,c),x=null!==(y=null===(g=e.effects)||void 0===g?void 0:g.call(e,m))&&void 0!==y?y:null;null!=x&&(f=!0,l.current=x,a(l.current,void 0,"onPropsChange","effects",!1,m,!0,c)),e.sideEffects&&p.push({index:o,indices:s,ctx:m})}}})),!f&&u&&a(void 0,void 0,"onPropsChange","effects",!1,null,!0),p.length>0&&p.forEach((function(e){s[e.index].sideEffects(m(m({},R(M(e.ctx,o),l)),{},{indices:e.indices}))}))}else null!=(null==i?void 0:i.derivedState)&&a(void 0,void 0,"onPropsChange","effects",!1,null,!0)},exports.retryPromiseDecorator=S,exports.runMiddlewares=function(e,t,r,n,o,i,a,c){if("onPropsChange"===o&&void 0===r)return{newState:null,newLoading:!1};if(e&&e.length>0){var u=e.reduce((function(e,t){var r=t.effects({isAsync:a,name:o,type:i,context:c},e.oldState,e.newState,n);return{newState:(null==r?void 0:r.state)||e.newState,oldState:null!=r&&r.state?e.newState:e.oldState,loading:null==(null==r?void 0:r.loading)?e.loading:r.loading}}),{oldState:t,newState:r,loading:n});return{newLoading:u.loading,newState:u.newState}}return{newState:r,newLoading:n}},exports.setGlobalConfig=function(e){Object.keys(e).forEach((function(t){null!=e[t]&&(x[t]=e[t])}))};
1
+ "use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t(e){var t={exports:{}};return e(t,t.exports),t.exports}Object.defineProperty(exports,"__esModule",{value:!0});var r,n=t((function(e){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n},e.exports.default=e.exports,e.exports.__esModule=!0})),o=t((function(e){e.exports=function(e){if(Array.isArray(e))return n(e)},e.exports.default=e.exports,e.exports.__esModule=!0})),i=t((function(e){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)},e.exports.default=e.exports,e.exports.__esModule=!0})),a=t((function(e){e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0})),c=t((function(e){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0})),u=e(t((function(e){e.exports=function(e){return o(e)||i(e)||a(e)||c()},e.exports.default=e.exports,e.exports.__esModule=!0}))),s=t((function(e){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0})),f=t((function(e){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return r}},e.exports.default=e.exports,e.exports.__esModule=!0})),l=t((function(e){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0})),p=e(t((function(e){e.exports=function(e,t){return s(e)||f(e,t)||a(e,t)||l()},e.exports.default=e.exports,e.exports.__esModule=!0}))),d=e(t((function(e){function t(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}e.exports=function(e){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=e.apply(r,n);function c(e){t(a,o,i,c,u,"next",e)}function u(e){t(a,o,i,c,u,"throw",e)}c(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0}))),h=e(t((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.default=e.exports,e.exports.__esModule=!0}))),v=t((function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var o=t&&t.prototype instanceof y?t:y,i=Object.create(o.prototype),a=new L(n||[]);return i._invoke=function(e,t,r){var n=l;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw i;return R()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=O(a,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=f(e,t,r);if("normal"===u.type){if(n=r.done?h:p,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=h,r.method="throw",r.arg=u.arg)}}}(e,r,a),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l="suspendedStart",p="suspendedYield",d="executing",h="completed",v={};function y(){}function g(){}function m(){}var x={};x[i]=function(){return this};var w=Object.getPrototypeOf,E=w&&w(w(j([])));E&&E!==r&&n.call(E,i)&&(x=E);var b=m.prototype=y.prototype=Object.create(x);function S(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,t){function r(o,i,a,c){var u=f(e[o],e,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,a,c)}),(function(e){r("throw",e,a,c)})):t.resolve(l).then((function(e){s.value=e,a(s)}),(function(e){return r("throw",e,a,c)}))}c(u.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}}function O(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function j(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:R}}function R(){return{value:t,done:!0}}return g.prototype=b.constructor=m,m.constructor=g,g.displayName=u(m,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},S(P.prototype),P.prototype[a]=function(){return this},e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new P(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},S(b),u(b,c,"Generator"),b[i]=function(){return this},b.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=j,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),y=e(t((function(e){function t(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=t=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),t(r)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0})));function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}!function(e){e.REJECT="reject",e.IGNORE="ignore",e.KEEP_LAST="keepLast",e.KEEP_ALL="keepAll",e.PARALLEL="parallel",e.REUSE="reuse"}(r||(r={}));var x={clone:function(e){return JSON.parse(JSON.stringify(e))},comparator:function(e,t){if(Object.is(e,t))return!0;if("object"!==y(e)||null===e||"object"!==y(t)||null===t)return!1;if(e instanceof Set||t instanceof Set)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(t,r[o])||!Object.is(e[r[o]],t[r[o]]))return!1;return!0},asyncErrorHandler:function(){},retryOnErrorFunction:function(e){return e instanceof TypeError},notifySuccess:void 0,notifyError:void 0,notifyWarning:void 0,getErrorMessage:void 0,defaultMiddlewares:[]};function w(e){try{return x.clone(e)}catch(e){var t="StateDecorator: Cannot clone object. Call setCloneFunction with another implementation like lodash/cloneDeep.";throw"development"===process.env.NODE_ENV&&(console.error(t),console.error(e.toString())),new Error(t)}}function E(e){return"function"!=typeof e&&!e.hasOwnProperty("getPromise")&&e.hasOwnProperty("getGetPromise")}function b(e,t,r,n){return m(m({},e),{},h({},t,n?m(m({},e[t]||{}),{},h({},r,n)):m(m({},e[t]),{},h({},r,!1))))}function S(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){return!0};return 1===t?e:function(o){function i(e,t){return a.apply(this,arguments)}function a(){return(a=d(v.mark((function a(c,u){return v.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(null!==u){a.next=2;break}return a.abrupt("return",null);case 2:return a.abrupt("return",u.catch((function(a){return n(a)?c===t?Promise.reject(a):new Promise((function(t,n){setTimeout((function(){var r=e(o);i(c+1,r).then(t).catch(n)}),r*c)})):Promise.reject(a)})));case 3:case"end":return a.stop()}}),a)})))).apply(this,arguments)}var c=e(o);return null===c?null:i(1,c)}}function P(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return{current:e}}function O(e,t,r){var n,o;return{state:e.current,s:e.current,ds:null==t||null===(n=t.current)||void 0===n?void 0:n.state,derived:null==t||null===(o=t.current)||void 0===o?void 0:o.state,props:r.current,p:r.current}}function _(e,t,r,n,o,i){var a=O(e,t,r);return a.indices=n,a.index=o,a.isInit=i,a}function A(e,t,r,n,o){var i=O(e,t,r);return i.args=n,o&&(i.promiseId=o),i}function L(e,t,r,n,o,i){var a=A(e,t,r,n,i);return a.result=o,a.res=o,a}function j(e,t,r,n,o,i,a){var c=M(A(e,t,r,n,a),o);return c.abortSignal=i,c}function R(e,t){var r=e;return r.state=t.current,r.s=t.current,r}function M(e,t){var r=e;return r.actions=t.current,r.a=t.current,r}function C(e,t,r,n,o){var i,a=M(e,n);R(e,t);var c=null==r||null===(i=r.current)||void 0===i?void 0:i.state;return a.derived=c,a.ds=c,a.notifyWarning=o,a}function T(e){"development"===process.env.NODE_ENV&&console.warn("[state-decorator] ".concat(e," action was called while store is not initialized or destroyed, this is probably a leak"))}function k(e,t,r,n,o,i,a,c,u,s){var f=L(r,n,o,s,void 0),l=!1;if(null!=t.effects){var p=t.effects(f);null===p?l=!0:u(p,void 0,e,"effects",!1,f,!1)}if(!l)if(t.debounceSideEffectsTimeout>0){var d=a.current[e];d&&clearTimeout(d),a.current[e]=setTimeout((function(){t.sideEffects(C(f,r,n,i,c.notifyWarning)),delete a.current[e]}),t.debounceSideEffectsTimeout)}else t.sideEffects&&t.sideEffects(C(f,r,n,i,c.notifyWarning))}function I(e,t,r,n){var o=e.action,i=e.stateRef,a=e.derivedStateRef,c=e.propsRef,u=e.promisesRef,s=e.actionsRef,f=e.loadingMapRef,l=e.conflictActionsRef,p=e.actionName,d=e.options,h=e.setState;if(e.initializedRef.current){var v=null,y=L(i,a,c,n,r,t);o.effects&&(v=o.effects(y)),h(v,b(f.current,p,t,!1),p,"effects",!0,y,!1);var g,m=d.notifySuccess||x.notifySuccess;if(m)o.getSuccessMessage&&(g=o.getSuccessMessage(y)),g&&m(g);return delete u.current[p][t],o.sideEffects&&o.sideEffects(C(y,i,a,s,x.notifyWarning)),U(p,s.current,l.current),r}}function G(e,t,r,n){var o=e.action,i=e.stateRef,a=e.derivedStateRef,c=e.propsRef,u=e.actionsRef,s=e.loadingMapRef,f=e.promisesRef,l=e.conflictActionsRef,p=e.actionName,d=e.options,h=e.setState;if(e.initializedRef.current){var v=null,y=function(e,t,r,n,o,i){var a=A(e,t,r,n,i);return a.error=o,a.err=o,a}(i,a,c,n,r,t);o.errorEffects&&(v=o.errorEffects(y)),h(v,b(s.current,p,t,!1),p,"errorEffects",!0,y,!1);var g=!1;(null!=v||o.errorSideEffects)&&(g=!0);var m,w=d.notifyError||x.notifyError;if(w)o.getErrorMessage&&(m=o.getErrorMessage(y)),void 0===m&&!g&&x.getErrorMessage&&(m=x.getErrorMessage(r)),m&&(g=!0,w(m));return x.asyncErrorHandler(r,g||o.rejectPromiseOnError,i.current,c.current,p,n),delete f.current[p][t],o.errorSideEffects&&o.errorSideEffects(C(y,i,a,u,x.notifyWarning)),U(p,u.current,l.current),!g||o.rejectPromiseOnError?Promise.reject(r):Promise.resolve()}}var N="__def__";function D(e,t){return e.length===t.length&&-1===e.findIndex((function(e,r){return t[r]!==e}))}function F(e,t,n,o,i){var a=o;if(a===r.REUSE){if(D(e[n][N].refArgs,i))return e[n][N].promise;a=r.KEEP_ALL}return new Promise((function(e,o){var c={resolve:e,reject:o,args:w(i),timestamp:Date.now()};switch(a){case r.IGNORE:e(void 0);break;case r.REJECT:o(new Error("An asynchronous action ".concat(n," is already ongoing.")));break;case r.KEEP_LAST:t[n]=[c];break;case r.KEEP_ALL:var u=t[n];u||(t[n]=u=[]),u.push(c);break;case r.PARALLEL:case r.REUSE:}}))}function U(e,t,r){var n=r[e];if(n&&n.length>0){var o=r[e].shift();if(o){var i=t[e].apply(t,u(o.args));null==i?U(e,t,r):i.then((function(n){null===n&&U(e,t,r),o.resolve(n)})).catch((function(e){return o.reject(e)}))}}}exports.DEFAULT_PROMISE_ID=N,exports.addContextActions=M,exports.addStateToContext=R,exports.areSameArgs=D,exports.buildInvocationContextBase=O,exports.buildLoadingMap=b,exports.buildOnMountInvocationContext=function(e,t,r,n){return M(O(e,t,r),n)},exports.buildOnPropChangeEffects=_,exports.computeAsyncActionInput=function(e){return E(e)?m(m({},e),{},{getPromise:e.getGetPromise,retryCount:3,conflictPolicy:r.REUSE}):e},exports.computeDerivedValues=function(e,t,r,n){if(null==(null==n?void 0:n.derivedState))return!1;var o=!1,i=x.comparator,a=r.current.deps,c=O(e,null,t),u=Object.keys(n.derivedState);return r.current.state=u.reduce((function(e,t){var u=!1,s=a[t],f=n.derivedState[t].getDeps(c);return u=null==s||null!=f.find((function(e,t){return s.length<t||!i(s[t],e)})),o=o||u,a[t]=f,e[t]=u?n.derivedState[t].get(c):r.current.state[t],e}),{}),o},exports.createRef=P,exports.decorateAsyncAction=function(e){var t=e.action,n=e.stateRef,o=e.derivedStateRef,i=e.propsRef,a=e.actionsRef,c=e.promisesRef,u=e.loadingMapRef,s=e.initializedRef,f=e.conflictActionsRef,l=e.actionName,p=e.setState;return function(){for(var d,v,y=arguments.length,g=new Array(y),w=0;w<y;w++)g[w]=arguments[w];if(!s.current)return T(l),null;var E=c.current,P=t.conflictPolicy,O=void 0===P?r.KEEP_ALL:P,_=O===r.PARALLEL,L=null;if(_){if(!t.getPromiseId)throw new Error("If conflict policy is set to ConflictPolicy.PARALLEL, getPromiseId must be set and return a string.");L=t.getPromiseId.apply(t,g)}else L=N;if(!_&&null!==(d=E[l])&&void 0!==d&&d[L])return F(E,f.current,l,O,g);var R=null,M=!1,C=A(n,o,i,g,L);t.preEffects&&(R=t.preEffects(C))&&(M=!0,n.current=R);var k=t.abortable,D=t.retryCount,U=t.retryDelaySeed,K=t.isTriggerRetryError,W=k&&window.AbortController?new AbortController:null,z=S(t.getPromise,D?1+D:1,U,K||x.retryOnErrorFunction),J=null===(v=z(j(n,o,i,g,a,null==W?void 0:W.signal)))||void 0===v?void 0:v.then((function(t){return I(e,L,t,g)})).catch((function(t){return G(e,L,t,g)}));return null!=J&&(E[l]=m(m({},E[l]||{}),{},h({},L||N,{abortController:W,promise:J,refArgs:O===r.REUSE&&g.length>0?[].concat(g):[]}))),p(null!=J||M?n.current:void 0,null==J?void 0:b(u.current,l,L,!0),l,"preEffects",!0,C,!1),J}},exports.decorateSimpleSyncAction=function(e,t,r,n,o,i,a){return function(){if(i.current){for(var c=arguments.length,u=new Array(c),s=0;s<c;s++)u[s]=arguments[s];var f=A(r,n,o,u),l=t(f);a(l,null,e,"effects",!1,f,!1)}else T(e)}},exports.decorateSyncAction=function(e,t,r,n,o,i,a,c,u,s){return function(){for(var f=arguments.length,l=new Array(f),p=0;p<f;p++)l[p]=arguments[p];if(a.current)if(t.debounceTimeout){var d=c.current[e];d&&clearTimeout(d),c.current[e]=setTimeout((function(){delete c.current[e],k(e,t,r,n,o,i,c,u,s,l)}),t.debounceTimeout)}else k(e,t,r,n,o,i,c,u,s,l);else T(e)}},exports.globalConfig=x,exports.isAsyncAction=function(e){return!(e instanceof Function)&&(e.hasOwnProperty("getPromise")||e.hasOwnProperty("getGetPromise"))},exports.isAsyncGetPromiseAction=function(e){return"function"!=typeof e&&e.hasOwnProperty("getPromise")&&!e.hasOwnProperty("getGetPromise")},exports.isAsyncGetPromiseGetAction=E,exports.isLoadingImpl=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return r.some((function(t){var r=null,n=N;if(Array.isArray(t)){var o=p(t,2);r=o[0];var i=o[1];n=void 0===i?N:i}else r=t;var a=e[r];return null!=a&&(null!=a[n]&&a[n])}))},exports.isSimpleSyncAction=function(e){return"function"==typeof e},exports.isSyncAction=function(e){return"function"!=typeof e&&!e.hasOwnProperty("getPromise")&&!e.hasOwnProperty("getGetPromise")},exports.onPropChange=function(e,t,r,n,o,i,a,c){var u=null!=(null==i?void 0:i.derivedState);if(null!=i.onPropsChange){var s;s=Array.isArray(i.onPropsChange)?i.onPropsChange:[i.onPropsChange];var f=!1,l=P(e.current),p=[],d=x.comparator;s.forEach((function(e,o){var i=e.getDeps;if(i){var u=!1,s=[];if(c){if(!e.onMount)return;u=!0}else{var h=i(n),v=i(r.current);h.length!==v.length?(console.warn("options.onPropsChange.getDeps returned array must be stable (same length)"),u=!0):h.forEach((function(e,t){d(e,v[t])||(u=!0,s.push(t))}))}if(u){var y,g,m=_(l,t,r,s,o,c),x=null!==(y=null===(g=e.effects)||void 0===g?void 0:g.call(e,m))&&void 0!==y?y:null;null!=x&&(f=!0,l.current=x,a(l.current,void 0,"onPropsChange","effects",!1,m,!0,c)),e.sideEffects&&p.push({index:o,indices:s,ctx:m})}}})),!f&&u&&a(void 0,void 0,"onPropsChange","effects",!1,null,!0),p.length>0&&p.forEach((function(e){s[e.index].sideEffects(m(m({},R(M(e.ctx,o),l)),{},{indices:e.indices}))}))}else null!=(null==i?void 0:i.derivedState)&&a(void 0,void 0,"onPropsChange","effects",!1,null,!0)},exports.retryPromiseDecorator=S,exports.runMiddlewares=function(e,t,r,n,o,i,a,c){if("onPropsChange"===o&&void 0===r)return{newState:null,newLoading:!1};if(e&&e.length>0){var u=e.reduce((function(e,t){var r=t.effects({isAsync:a,name:o,type:i,context:c},e.oldState,e.newState,n);return{newState:(null==r?void 0:r.state)||e.newState,oldState:null!=r&&r.state?e.newState:e.oldState,loading:null==(null==r?void 0:r.loading)?e.loading:r.loading}}),{oldState:t,newState:r,loading:n});return{newLoading:u.loading,newState:u.newState}}return{newState:r,newLoading:n}},exports.setGlobalConfig=function(e){Object.keys(e).forEach((function(t){null!=e[t]&&(x[t]=e[t])}))};
2
2
  //# sourceMappingURL=impl.js.map