1 | function n(n){return null==n}function t(n){throw new Error("Argument "+n+" is empty.")}function r(n){return"function"==typeof n&&"getType"in n}function e(n){throw new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions"')}function i(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if(null==n.getType)throw new Error("Argument contains array with invalid element at index "+t+', it should be an action-creator instance from "typesafe-actions"')}function o(n){return"string"==typeof n||"symbol"==typeof n}function u(n){return!o(n)}function a(n){throw new Error("Argument "+n+" is invalid, it should be an action type of type: string | symbol")}function c(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("Argument contains array with invalid element at index "+t+", it should be of type: string | symbol")}function f(r,i,o,a){return n(r)&&t(1),u(r)&&e(1),{type:r,payload:i,meta:o,error:a}}function s(r,e){n(r)&&t(1),u(r)&&a(1);return Object.assign((function(){var n=null!=e?e.apply(void 0,arguments):void 0;return Object.assign({type:r},n)}),{getType:function(){return r},toString:function(){return r}})}function y(r,e,i){return n(r)&&t(1),u(r)&&a(1),function(){return s(r,(function(){var n=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1];return null==e&&null==i||(n=null!=e?e.apply(void 0,arguments):void 0,t=null!=i?i.apply(void 0,arguments):void 0),Object.assign({},void 0!==n&&{payload:n},{},void 0!==t&&{meta:t})}))}}function l(n,t,r,e){return function(){var i=[n,t,r,e].map((function(n,t){return Array.isArray(n)?y(n[0],n[1],n[2])():"string"==typeof n||"symbol"==typeof n?y(n)():void(t<3&&function(n){throw new Error("Argument "+n+' is invalid, it should be an action type of "string | symbol" or a tuple of "[string | symbol, Function, Function?]"')}(t))}));return{request:i[0],success:i[1],failure:i[2],cancel:i[3]}}}function p(i){return n(i)&&t(1),r(i)||e(1),i.getType()}function d(n,t){void 0===t&&(t={});var e=Object.assign({},t),i=function(t,i){var u=Array.isArray(t)?t:[t],a={};return u.map((function(n,t){return r(n)?p(n):o(n)?n:function(n){throw new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}(t+1)})).forEach((function(n){return a[n]=i})),d(n,Object.assign({},e,{},a))};return Object.assign((function(t,r){if(void 0===t&&(t=n),e.hasOwnProperty(r.type)){var i=e[r.type];if("function"!=typeof i)throw Error('Reducer under "'+r.type+'" key is not a valid reducer');return i(t,r)}return t}),{handlers:Object.assign({},e),handleAction:i,handleType:i})}function g(r,e){n(r)&&t(1);var i=Array.isArray(r)?r:[r];i.forEach(c);var o=function(n){return i.includes(n.type)};return void 0===e?o:o(e)}function m(r,e){n(r)&&t(1);var o=Array.isArray(r)?r:[r];o.forEach(i);var u=function(n){return o.some((function(t){return n.type===t.getType()}))};return void 0===e?u:u(e)}function v(r,e){n(r)&&t(1),u(r)&&a(1);var i=null!=e?e(r):function(){return{type:r}};return Object.assign(i,{getType:function(){return r},toString:function(){return r}})}var h={createAction:function(n,t){var r=null==t?function(){return f(n)}:t(f.bind(null,n));return Object.assign(r,{getType:function(){return n},toString:function(){return n}})},createCustomAction:v,createStandardAction:function(r){return n(r)&&t(1),u(r)&&a(1),Object.assign((function(){return v(r,(function(n){return function(t,r){return{type:n,payload:t,meta:r}}}))}),{map:function(n){return v(r,(function(t){return function(r,e){return Object.assign(n(r,e),{type:t})}}))}})}};export{f as action,y as createAction,l as createAsyncAction,s as createCustomAction,d as createReducer,h as deprecated,p as getType,m as isActionOf,g as isOfType};
|