Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

patronum

Package Overview
Dependencies
Maintainers
4
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

patronum - npm Package Compare versions

Comparing version 1.8.2 to 1.8.3

and/index.cjs

10

babel-plugin-factories.json
{
"factories": [
"patronum",
"patronum/and",
"patronum/combine-events",

@@ -8,2 +9,4 @@ "patronum/condition",

"patronum/delay",
"patronum/either",
"patronum/equals",
"patronum/every",

@@ -13,2 +16,4 @@ "patronum/format",

"patronum/interval",
"patronum/not",
"patronum/or",
"patronum/pending",

@@ -26,2 +31,3 @@ "patronum/reset",

"mapping": {
"and": "and",
"combineEvents": "combine-events",

@@ -31,2 +37,4 @@ "condition": "condition",

"delay": "delay",
"either": "either",
"equals": "equals",
"every": "every",

@@ -36,2 +44,4 @@ "format": "format",

"interval": "interval",
"not": "not",
"or": "or",
"pending": "pending",

@@ -38,0 +48,0 @@ "reset": "reset",

29

condition/index.js

@@ -1,2 +0,2 @@

import { createEvent, guard, is } from 'effector';
import { createEvent, guard, is, split } from 'effector';
export function condition(_ref) {

@@ -17,3 +17,20 @@ var {

if (thenBranch) {
if (thenBranch && elseBranch) {
split({
and: [{
source,
match: {
then: checker,
else: inverse(checker)
},
cases: {
then: thenBranch,
else: elseBranch
}
}],
or: {
sid: "9tug3k"
}
});
} else if (thenBranch) {
guard({

@@ -26,8 +43,6 @@ and: [{

or: {
sid: "9tug3k"
sid: "abznoh"
}
});
}
if (elseBranch) {
} else if (elseBranch) {
guard({

@@ -40,3 +55,3 @@ and: [{

or: {
sid: "a9shb1"
sid: "-eb29qp"
}

@@ -43,0 +58,0 @@ });

@@ -0,1 +1,2 @@

export { and } from './and';
export { combineEvents } from './combine-events';

@@ -6,2 +7,4 @@ export { condition } from './condition';

export { delay } from './delay';
export { either } from './either';
export { equals } from './equals';
export { every } from './every';

@@ -11,2 +14,4 @@ export { format } from './format';

export { interval } from './interval';
export { not } from './not';
export { or } from './or';
export { pending } from './pending';

@@ -13,0 +18,0 @@ export { reset } from './reset';

@@ -0,1 +1,2 @@

export { and } from './and/index.js'
export { combineEvents } from './combine-events/index.js'

@@ -6,2 +7,4 @@ export { condition } from './condition/index.js'

export { delay } from './delay/index.js'
export { either } from './either/index.js'
export { equals } from './equals/index.js'
export { every } from './every/index.js'

@@ -11,2 +14,4 @@ export { format } from './format/index.js'

export { interval } from './interval/index.js'
export { not } from './not/index.js'
export { or } from './or/index.js'
export { pending } from './pending/index.js'

@@ -13,0 +18,0 @@ export { reset } from './reset/index.js'

{
"name": "patronum",
"version": "1.8.2",
"version": "1.8.3",
"description": "☄️ Effector utility library delivering modularity and convenience",

@@ -46,2 +46,7 @@ "type": "module",

},
"./and/package.json": "./and/package.json",
"./and": {
"require": "./and/index.cjs",
"import": "./and/index.js"
},
"./combine-events/package.json": "./combine-events/package.json",

@@ -72,2 +77,12 @@ "./combine-events": {

},
"./either/package.json": "./either/package.json",
"./either": {
"require": "./either/index.cjs",
"import": "./either/index.js"
},
"./equals/package.json": "./equals/package.json",
"./equals": {
"require": "./equals/index.cjs",
"import": "./equals/index.js"
},
"./every/package.json": "./every/package.json",

@@ -93,2 +108,12 @@ "./every": {

},
"./not/package.json": "./not/package.json",
"./not": {
"require": "./not/index.cjs",
"import": "./not/index.js"
},
"./or/package.json": "./or/package.json",
"./or": {
"require": "./or/index.cjs",
"import": "./or/index.js"
},
"./pending/package.json": "./pending/package.json",

@@ -95,0 +120,0 @@ "./pending": {

@@ -1,2 +0,2 @@

import{createEvent as e,is as r,withRegion as t,createStore as n,sample as o,guard as i,merge as a,createEffect as s,forward as u,combine as c,attach as d,restore as f}from"effector";function m(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function l(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function p(s){var{events:u,reset:c,target:d=e({name:"target",sid:"3pez5"},{name:"target",sid:"3pez5"})}=s;return r.unit(d)||v("target should be a unit"),c&&!r.unit(c)&&v("reset should be a unit"),t(d,(()=>{var e=Object.keys(u),r=Array.isArray(u)?[...e].fill(""):{},t=n(e.length,{name:"$counter",sid:"-dszn9a"}),s=n(r,{name:"$results",sid:"boz3x7"});t.reset(o({and:[d],or:{sid:"-8yzcn6"}})),s.reset(d),c&&(t.reset(o({and:[c],or:{sid:"-72suil"}})),s.reset(c));var f=function(e){var r=n(!1,{name:"$isDone",sid:"ucs7nc"}).on(u[e],(()=>!0)).reset(d);c&&r.reset(c),t.on(r,(e=>e-1)),s.on(u[e],((r,t)=>{var n=Array.isArray(r)?[...r]:function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?m(Object(t),!0).forEach((function(r){l(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):m(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}({},r);return n[e]=t,n}))};for(var p of e)f(p);i({and:[{source:o({and:[s,a(Object.values(u),{name:"and",sid:"-l8g4ey"})],or:{name:"source",sid:"uf92v9"}}),filter:t.map((e=>0===e)),target:d}],or:{sid:"ciekm0"}})})),d}function v(e){throw new Error(e)}function y(t){var{if:n,then:o,else:a,source:s=e({name:"source",sid:"epke23"},{name:"source",sid:"epke23"})}=t,u=r.unit(n)||"function"==typeof n?n:e=>e===n;return o&&i({and:[{source:s,filter:u,target:o}],or:{sid:"9tug3k"}}),a&&i({and:[{source:s,filter:g(u),target:a}],or:{sid:"a9shb1"}}),s}function g(e){return r.unit(e)?e.map((e=>!e)):r=>!e(r)}function w(t){var n,o,{source:i,timeout:a,target:c}=t;if(!r.unit(i))throw new TypeError("source must be unit from effector");if(r.domain(i,{sid:"iu8yzo"}))throw new TypeError("source cannot be domain");if("number"!=typeof a||a<0||!Number.isFinite(a))throw new Error('timeout must be positive number or zero. Received: "'.concat(a,'"'));var d=null!=c?c:e({name:"tick",sid:"-xw52dh"}),f=s((e=>(clearTimeout(o),n&&n(),new Promise(((r,t)=>{n=t,o=setTimeout(r,a,e)})))),{name:"timerFx",sid:"m8kfsq"});return u({and:{from:i,to:f},or:{sid:"k4foqk"}}),u({and:{from:f.done.map((e=>{var{result:r}=e;return r})),to:d},or:{sid:"k76npd"}}),d}function b(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var o of t){var i=h(o);(r.store(o,{sid:"8mdztw"})||r.effect(o,{sid:"-gueih2"})||r.event(o,{sid:"-gueh0j"}))&&j(o,i),r.effect(o,{sid:"-jlpzbv"})&&k(o),r.domain(o,{sid:"-jjisyf"})&&(o.onCreateEvent((e=>j(e,"event"))),o.onCreateStore((e=>j(e,"store"))),o.onCreateEffect(k))}}function h(e){return r.store(e,{sid:"-j30z7b"})?"store":r.effect(e,{sid:"-j1dlf8"})?"effect":r.event(e,{sid:"-io6j6k"})?"event":r.domain(e,{sid:"-imj5eh"})?"domain":r.unit(e)?"unit":"unknown"}function j(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=t+A(e);e.watch((e=>{console.info("[".concat(r,"] ").concat(n),e)}))}function k(e){j(e.done,"effect",A(e)+"."),j(e.fail,"effect",A(e)+".")}function A(e){return e.compositeName&&e.compositeName.fullName?e.compositeName.fullName:e.shortName?e.shortName:e.name?e.name:""}function O(t){var{source:n,timeout:i,target:a=e({name:"target",sid:"-z2vw3w"},{name:"target",sid:"-z2vw3w"})}=t;if(!r.unit(n))throw new TypeError("source must be a unit from effector");if(!r.unit(a))throw new TypeError("target must be a unit from effector");var d=function(e){if(r.store(e,{sid:"-va560a"})||"function"==typeof e||"number"==typeof e)return e;throw new TypeError("'timeout' argument must be a function, Store, or a number. Passed \"".concat(typeof e,'"'))}(i),f=s((e=>{var{payload:r,milliseconds:t}=e;return new Promise((e=>{setTimeout(e,t,r)}))}),{name:"timerFx",sid:"-584o7j"});return o({and:[{source:c({and:[{milliseconds:d}],or:{name:"source",sid:"9rbdjo"}}),clock:n,fn:(e,r)=>{var{milliseconds:t}=e;return{payload:r,milliseconds:"function"==typeof t?t(r):t}},target:f}],or:{sid:"-wmj29s"}}),u({and:{from:f.doneData,to:a},or:{sid:"-vsadmx"}}),a}function E(e,t){var n,o=[],i=()=>!1;Array.isArray(e)?(o=e,i=t):Array.isArray(e.stores)&&(o=e.stores,i=e.predicate),n="function"==typeof i?i:r.store(i,{sid:"sid3ut"})?i.map((e=>r=>e===r)):e=>e===i;var a=c({and:[o],or:{name:"$values",sid:"h09uhg"}});return c({and:[n,a,(e,r)=>r.every(e)],or:{sid:"hfkdw9"}})}function z(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];return c({and:[t,r=>e.reduce(((t,n,o)=>t.concat(P(e,o)?n:"".concat(n).concat(T(r[o])))),"")],or:{sid:"-yrbthp"}})}function T(e){return Array.isArray(e)?e.map((e=>String(e))).join(", "):String(e)}function P(e,r){return r===e.length-1}function $(e){var{effects:r,domain:t}=e;if(t){var n=t.createStore(0,{name:"$inFlight",sid:"-y7vg7t"});return t.onCreateEffect((e=>{n.on(e,(e=>e+1)).on(e.finally,(e=>e-1))})),n}return c({and:[r.map((e=>e.inFlight)),e=>e.reduce(((e,r)=>e+r),0)],or:{sid:"ubqxa7"}})}function x(t){var{timeout:a,start:u,stop:c,leading:f=!1,trailing:m=!1}=t,l=e({name:"tick",sid:"uo9p3s"}),p=n(!1,{name:"$isRunning",sid:"-wxesi8"}),v=function(e){if(r.store(e,{sid:"6p7767"}))return e;if("number"==typeof e)return n(e,{and:{name:"$timeout"},sid:"5hw6se"});throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}(a),y=p.map((e=>!e)),g=e({name:"saveTimeout",sid:"as5clk"}),w=n(null,{name:"$timeoutId",sid:"-bh90bo"}).on(g,((e,r)=>r)),b=e({name:"saveReject",sid:"-64swis"}),h=n((()=>{}),{name:"$rejecter",sid:"eabbu7"}).on(b,((e,r)=>r)),j=s((e=>new Promise(((r,t)=>{var n=setTimeout(r,e);g(n),b(t)}))),{name:"timeoutFx",sid:"7lc3mj"}),k=d({and:{source:[w,h],effect:e=>{var[r,t]=e;t(),r&&clearTimeout(r)}},or:{name:"cleanupFx",sid:"pcn5jq"}});return i({and:[{clock:u,source:v,filter:y,target:j}],or:{sid:"-w5qmwp"}}),f&&i({and:[{clock:u,filter:y,target:l}],or:{sid:"-vpslni"}}),o({and:[{clock:u,fn:()=>!0,target:p}],or:{sid:"-vaed34"}}),i({and:[{clock:j.done,source:v,filter:p,target:j}],or:{sid:"-v73liy"}}),o({and:[{clock:j.done,fn:()=>{},target:l}],or:{sid:"-urpcwu"}}),c&&(m&&o({and:[{clock:c,target:l}],or:{sid:"-uanqf7"}}),p.on(c,(()=>!1)),o({and:[{clock:c,target:k}],or:{sid:"6lcmyy"}})),{tick:l,isRunning:p}}var S={some:e=>e.some(Boolean),every:e=>e.every(Boolean)};function N(e){var{effects:t,domain:n,of:o="some"}=e;if(!r.domain(n,{sid:"97b92c"})&&!t)throw new TypeError("domain or effects should be passed");if("some"!==o&&"every"!==o)throw new TypeError('strategy parameter "of" can be "every" or "some". Passed: "'.concat(o,'"'));var i=null!=t?t:[],a=S[o];return n&&(i=[],n.onCreateEffect((e=>i.push(e)))),c({and:[i.map((e=>e.pending)),a],or:{sid:"a37bj0"}})}function F(e){var{clock:r,target:t}=e,n=Array.isArray(t)?t:[t],o=Array.isArray(r)?r:[r];n.forEach((e=>{e.reset.call(e,o)}))}function q(e){var{source:r,shape:t}=e,n={};for(var o in t)o in t&&function(){var e=t[o];n[o]=r.map((r=>{var t=e(r);return void 0===t?null:t}))}();return n}function D(e){var{source:r,clock:t,fn:i=(e=>e)}=e,a=i(r.defaultState),s=o(t?{and:[r,t,i],or:{name:"onSnapshot",sid:"-auitd0"}}:{and:[{source:r,fn:i}],or:{name:"onSnapshot",sid:"-auir6n"}}),u=n(a,{name:"$snapshot",sid:"-7zyoaf"});return u.on(s,((e,r)=>r)),u}function C(e,t){var n,o=[],i=()=>!1;Array.isArray(e)?(o=e,i=t):Array.isArray(e.stores)&&(o=e.stores,i=e.predicate),n="function"==typeof i?i:r.store(i,{sid:"zbwu0l"})?i.map((e=>r=>e===r)):e=>e===i;var a=c({and:[o],or:{name:"$values",sid:"-lv5do0"}});return c({and:[n,a,(e,r)=>r.some(e)],or:{sid:"-efc5w7"}})}function R(e){var{source:t,cases:n}=e,o={},i=r.store(t,{name:"current",sid:"-htjkz7"})?t.updates:t;for(var a in n)a in n&&function(){var e=n[a];o[a]=i.filterMap(e),i=i.filter({fn:r=>!e(r)})}();return o.__=i,o}function B(t){var{targets:n,source:a=e({name:"source",sid:"-iel8gi"},{name:"source",sid:"-iel8gi"})}=t,s=function(e){if(e in n){var t=i({and:[{source:a,filter:r=>"object"==typeof r&&null!==r&&e in r}],or:{name:"hasTargetKey",sid:"-gh83lo"}});r.store(n[e],{sid:"jliekw"})?n[e].on(t,((r,t)=>t[e])):o({and:[{source:t,fn:r=>r[e],target:n[e]}],or:{sid:"lnzpe6"}})}};for(var u in n)s(u);return a}function _(e){var{effect:r,defaultValue:t="initial"}=e,o=n(t,{name:"$status",sid:"abrgim"});return o.on(r,(()=>"pending")).on(r.done,(()=>"done")).on(r.fail,(()=>"fail")),o}function I(t){var{source:n,timeout:a,target:u=e({name:"target",sid:"cenyj5"},{name:"target",sid:"cenyj5"})}=t;if(!r.unit(n))throw new TypeError("source must be unit from effector");if("number"!=typeof a||a<0)throw new Error("timeout must be positive number or zero");var c=s((()=>new Promise((e=>setTimeout(e,a)))),{name:"timerFx",sid:"uv7gwq"});return i({and:[{source:n,filter:c.pending.map((e=>!e)),target:c}],or:{sid:"-iy4kn2"}}),o({and:[{source:n,clock:c.done,target:u}],or:{sid:"-ija4mb"}}),u}var K=()=>Date.now();function M(e){var{clock:r,getNow:t,initial:n}=e,o=null!=t?t:K,i=s(o,{name:"readNowFx",sid:"459ysb"}),a=f(i,null!=n?n:o(),{name:"$time",sid:"-ys9vce"});return u({and:{from:r,to:i},or:{sid:"rdje9v"}}),a}export{p as combineEvents,y as condition,w as debounce,b as debug,O as delay,E as every,z as format,$ as inFlight,x as interval,N as pending,F as reset,q as reshape,D as snapshot,C as some,R as splitMap,B as spread,_ as status,I as throttle,M as time};
import{combine as e,createEvent as r,is as n,withRegion as t,createStore as o,sample as a,guard as i,merge as s,split as u,createEffect as c,forward as d,attach as f,restore as m}from"effector";function l(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];return e({and:[n,e=>e.reduce(((e,r)=>Boolean(e)&&Boolean(r)))],or:{sid:"-rbm5ks"}})}function v(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function p(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function y(e){var{events:u,reset:c,target:d=r({name:"target",sid:"3pez5"},{name:"target",sid:"3pez5"})}=e;return n.unit(d)||g("target should be a unit"),c&&!n.unit(c)&&g("reset should be a unit"),t(d,(()=>{var e=Object.keys(u),r=Array.isArray(u)?[...e].fill(""):{},n=o(e.length,{name:"$counter",sid:"-dszn9a"}),t=o(r,{name:"$results",sid:"boz3x7"});n.reset(a({and:[d],or:{sid:"-8yzcn6"}})),t.reset(d),c&&(n.reset(a({and:[c],or:{sid:"-72suil"}})),t.reset(c));var f=function(e){var r=o(!1,{name:"$isDone",sid:"ucs7nc"}).on(u[e],(()=>!0)).reset(d);c&&r.reset(c),n.on(r,(e=>e-1)),t.on(u[e],((r,n)=>{var t=Array.isArray(r)?[...r]:function(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?v(Object(n),!0).forEach((function(r){p(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}({},r);return t[e]=n,t}))};for(var m of e)f(m);i({and:[{source:a({and:[t,s(Object.values(u),{name:"and",sid:"-l8g4ey"})],or:{name:"source",sid:"uf92v9"}}),filter:n.map((e=>0===e)),target:d}],or:{sid:"ciekm0"}})})),d}function g(e){throw new Error(e)}function b(e){var{if:t,then:o,else:a,source:s=r({name:"source",sid:"epke23"},{name:"source",sid:"epke23"})}=e,c=n.unit(t)||"function"==typeof t?t:e=>e===t;return o&&a?u({and:[{source:s,match:{then:c,else:w(c)},cases:{then:o,else:a}}],or:{sid:"9tug3k"}}):o?i({and:[{source:s,filter:c,target:o}],or:{sid:"abznoh"}}):a&&i({and:[{source:s,filter:w(c),target:a}],or:{sid:"-eb29qp"}}),s}function w(e){return n.unit(e)?e.map((e=>!e)):r=>!e(r)}function h(e){var t,o,{source:a,timeout:i,target:s}=e;if(!n.unit(a))throw new TypeError("source must be unit from effector");if(n.domain(a,{sid:"iu8yzo"}))throw new TypeError("source cannot be domain");if("number"!=typeof i||i<0||!Number.isFinite(i))throw new Error('timeout must be positive number or zero. Received: "'.concat(i,'"'));var u=null!=s?s:r({name:"tick",sid:"-xw52dh"}),f=c((e=>(clearTimeout(o),t&&t(),new Promise(((r,n)=>{t=n,o=setTimeout(r,i,e)})))),{name:"timerFx",sid:"m8kfsq"});return d({and:{from:a,to:f},or:{sid:"k4foqk"}}),d({and:{from:f.done.map((e=>{var{result:r}=e;return r})),to:u},or:{sid:"k76npd"}}),u}function j(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];for(var o of r){var a=k(o);(n.store(o,{sid:"8mdztw"})||n.effect(o,{sid:"-gueih2"})||n.event(o,{sid:"-gueh0j"}))&&A(o,a),n.effect(o,{sid:"-jlpzbv"})&&O(o),n.domain(o,{sid:"-jjisyf"})&&(o.onCreateEvent((e=>A(e,"event"))),o.onCreateStore((e=>A(e,"store"))),o.onCreateEffect(O))}}function k(e){return n.store(e,{sid:"-j30z7b"})?"store":n.effect(e,{sid:"-j1dlf8"})?"effect":n.event(e,{sid:"-io6j6k"})?"event":n.domain(e,{sid:"-imj5eh"})?"domain":n.unit(e)?"unit":"unknown"}function A(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",t=n+E(e);e.watch((e=>{console.info("[".concat(r,"] ").concat(t),e)}))}function O(e){A(e.done,"effect",E(e)+"."),A(e.fail,"effect",E(e)+".")}function E(e){return e.compositeName&&e.compositeName.fullName?e.compositeName.fullName:e.shortName?e.shortName:e.name?e.name:""}function z(t){var{source:o,timeout:i,target:s=r({name:"target",sid:"-z2vw3w"},{name:"target",sid:"-z2vw3w"})}=t;if(!n.unit(o))throw new TypeError("source must be a unit from effector");if(!n.unit(s))throw new TypeError("target must be a unit from effector");var u=function(e){if(n.store(e,{sid:"-va560a"})||"function"==typeof e||"number"==typeof e)return e;throw new TypeError("'timeout' argument must be a function, Store, or a number. Passed \"".concat(typeof e,'"'))}(i),f=c((e=>{var{payload:r,milliseconds:n}=e;return new Promise((e=>{setTimeout(e,n,r)}))}),{name:"timerFx",sid:"-584o7j"});return a({and:[{source:e({and:[{milliseconds:u}],or:{name:"source",sid:"9rbdjo"}}),clock:o,fn:(e,r)=>{var{milliseconds:n}=e;return{payload:r,milliseconds:"function"==typeof n?n(r):n}},target:f}],or:{sid:"-wmj29s"}}),d({and:{from:f.doneData,to:s},or:{sid:"-vsadmx"}}),s}function T(r,t,o){return n.store(r,{sid:"n60kh0"})?e({and:[r,t,o,(e,r,n)=>e?r:n],or:{sid:"8ceklb"}}):T(r)}function P(r,n){return e({and:[r,n,(e,r)=>e===r],or:{sid:"jvku5g"}})}function $(r,t){var o,a=[],i=()=>!1;Array.isArray(r)?(a=r,i=t):Array.isArray(r.stores)&&(a=r.stores,i=r.predicate),o="function"==typeof i?i:n.store(i,{sid:"sid3ut"})?i.map((e=>r=>e===r)):e=>e===i;var s=e({and:[a],or:{name:"$values",sid:"h09uhg"}});return e({and:[o,s,(e,r)=>r.every(e)],or:{sid:"hfkdw9"}})}function x(r){for(var n=arguments.length,t=new Array(n>1?n-1:0),o=1;o<n;o++)t[o-1]=arguments[o];return e({and:[t,e=>r.reduce(((n,t,o)=>n.concat(N(r,o)?t:"".concat(t).concat(S(e[o])))),"")],or:{sid:"-yrbthp"}})}function S(e){return Array.isArray(e)?e.map((e=>String(e))).join(", "):String(e)}function N(e,r){return r===e.length-1}function F(r){var{effects:n,domain:t}=r;if(t){var o=t.createStore(0,{name:"$inFlight",sid:"-y7vg7t"});return t.onCreateEffect((e=>{o.on(e,(e=>e+1)).on(e.finally,(e=>e-1))})),o}return e({and:[n.map((e=>e.inFlight)),e=>e.reduce(((e,r)=>e+r),0)],or:{sid:"ubqxa7"}})}function q(e){var{timeout:t,start:s,stop:u,leading:d=!1,trailing:m=!1}=e,l=r({name:"tick",sid:"uo9p3s"}),v=o(!1,{name:"$isRunning",sid:"-wxesi8"}),p=function(e){if(n.store(e,{sid:"6p7767"}))return e;if("number"==typeof e)return o(e,{and:{name:"$timeout"},sid:"5hw6se"});throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}(t),y=v.map((e=>!e)),g=r({name:"saveTimeout",sid:"as5clk"}),b=o(null,{name:"$timeoutId",sid:"-bh90bo"}).on(g,((e,r)=>r)),w=r({name:"saveReject",sid:"-64swis"}),h=o((()=>{}),{name:"$rejecter",sid:"eabbu7"}).on(w,((e,r)=>r)),j=c((e=>new Promise(((r,n)=>{var t=setTimeout(r,e);g(t),w(n)}))),{name:"timeoutFx",sid:"7lc3mj"}),k=f({and:{source:[b,h],effect:e=>{var[r,n]=e;n(),r&&clearTimeout(r)}},or:{name:"cleanupFx",sid:"pcn5jq"}});return i({and:[{clock:s,source:p,filter:y,target:j}],or:{sid:"-w5qmwp"}}),d&&i({and:[{clock:s,filter:y,target:l}],or:{sid:"-vpslni"}}),a({and:[{clock:s,fn:()=>!0,target:v}],or:{sid:"-vaed34"}}),i({and:[{clock:j.done,source:p,filter:v,target:j}],or:{sid:"-v73liy"}}),a({and:[{clock:j.done,fn:()=>{},target:l}],or:{sid:"-urpcwu"}}),u&&(m&&a({and:[{clock:u,target:l}],or:{sid:"-uanqf7"}}),v.on(u,(()=>!1)),a({and:[{clock:u,target:k}],or:{sid:"6lcmyy"}})),{tick:l,isRunning:v}}function D(e){return e.map((e=>!e))}function B(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];return e({and:[n,e=>e.reduce(((e,r)=>Boolean(e)||Boolean(r)))],or:{sid:"-44722k"}})}var C={some:e=>e.some(Boolean),every:e=>e.every(Boolean)};function R(r){var{effects:t,domain:o,of:a="some"}=r;if(!n.domain(o,{sid:"97b92c"})&&!t)throw new TypeError("domain or effects should be passed");if("some"!==a&&"every"!==a)throw new TypeError('strategy parameter "of" can be "every" or "some". Passed: "'.concat(a,'"'));var i=null!=t?t:[],s=C[a];return o&&(i=[],o.onCreateEffect((e=>i.push(e)))),e({and:[i.map((e=>e.pending)),s],or:{sid:"a37bj0"}})}function _(e){var{clock:r,target:n}=e,t=Array.isArray(n)?n:[n],o=Array.isArray(r)?r:[r];t.forEach((e=>{e.reset.call(e,o)}))}function I(e){var{source:r,shape:n}=e,t={};for(var o in n)o in n&&function(){var e=n[o];t[o]=r.map((r=>{var n=e(r);return void 0===n?null:n}))}();return t}function K(e){var{source:r,clock:n,fn:t=(e=>e)}=e,i=t(r.defaultState),s=a(n?{and:[r,n,t],or:{name:"onSnapshot",sid:"-auitd0"}}:{and:[{source:r,fn:t}],or:{name:"onSnapshot",sid:"-auir6n"}}),u=o(i,{name:"$snapshot",sid:"-7zyoaf"});return u.on(s,((e,r)=>r)),u}function M(r,t){var o,a=[],i=()=>!1;Array.isArray(r)?(a=r,i=t):Array.isArray(r.stores)&&(a=r.stores,i=r.predicate),o="function"==typeof i?i:n.store(i,{sid:"zbwu0l"})?i.map((e=>r=>e===r)):e=>e===i;var s=e({and:[a],or:{name:"$values",sid:"-lv5do0"}});return e({and:[o,s,(e,r)=>r.some(e)],or:{sid:"-efc5w7"}})}function V(e){var{source:r,cases:t}=e,o={},a=n.store(r,{name:"current",sid:"-htjkz7"})?r.updates:r;for(var i in t)i in t&&function(){var e=t[i];o[i]=a.filterMap(e),a=a.filter({fn:r=>!e(r)})}();return o.__=a,o}function G(e){var{targets:t,source:o=r({name:"source",sid:"-iel8gi"},{name:"source",sid:"-iel8gi"})}=e,s=function(e){if(e in t){var r=i({and:[{source:o,filter:r=>"object"==typeof r&&null!==r&&e in r}],or:{name:"hasTargetKey",sid:"-gh83lo"}});n.store(t[e],{sid:"jliekw"})?t[e].on(r,((r,n)=>n[e])):a({and:[{source:r,fn:r=>r[e],target:t[e]}],or:{sid:"lnzpe6"}})}};for(var u in t)s(u);return o}function H(e){var{effect:r,defaultValue:n="initial"}=e,t=o(n,{name:"$status",sid:"abrgim"});return t.on(r,(()=>"pending")).on(r.done,(()=>"done")).on(r.fail,(()=>"fail")),t}function J(e){var{source:t,timeout:o,target:s=r({name:"target",sid:"cenyj5"},{name:"target",sid:"cenyj5"})}=e;if(!n.unit(t))throw new TypeError("source must be unit from effector");if("number"!=typeof o||o<0)throw new Error("timeout must be positive number or zero");var u=c((()=>new Promise((e=>setTimeout(e,o)))),{name:"timerFx",sid:"uv7gwq"});return i({and:[{source:t,filter:u.pending.map((e=>!e)),target:u}],or:{sid:"-iy4kn2"}}),a({and:[{source:t,clock:u.done,target:s}],or:{sid:"-ija4mb"}}),s}var L=()=>Date.now();function Q(e){var{clock:r,getNow:n,initial:t}=e,o=null!=n?n:L,a=c(o,{name:"readNowFx",sid:"459ysb"}),i=m(a,null!=t?t:o(),{name:"$time",sid:"-ys9vce"});return d({and:{from:r,to:a},or:{sid:"rdje9v"}}),i}export{l as and,y as combineEvents,b as condition,h as debounce,j as debug,z as delay,T as either,P as equals,$ as every,x as format,F as inFlight,q as interval,D as not,B as or,R as pending,_ as reset,I as reshape,K as snapshot,M as some,V as splitMap,G as spread,H as status,J as throttle,Q as time};
//# sourceMappingURL=patronum.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("effector")):"function"==typeof define&&define.amd?define(["exports","effector"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).patronum={},e.effector)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(t);function o(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var a=o((function(e,t){function n(e){throw new Error(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.combineEvents=function({events:e,reset:t,target:o=(0,r.default.createEvent)({name:"target",sid:"3pez5"})}){r.default.is.unit(o)||n("target should be a unit");t&&!r.default.is.unit(t)&&n("reset should be a unit");return(0,r.default.withRegion)(o,(()=>{const n=Object.keys(e),a=Array.isArray(e)?[...n].fill(""):{},i=(0,r.default.createStore)(n.length,{name:"$counter",sid:"-dszn9a"}),s=(0,r.default.createStore)(a,{name:"$results",sid:"boz3x7"});i.reset((0,r.default.sample)({and:[o],or:{sid:"-8yzcn6"}})),s.reset(o),t&&(i.reset((0,r.default.sample)({and:[t],or:{sid:"-72suil"}})),s.reset(t));for(const a of n){const n=(0,r.default.createStore)(!1,{name:"$isDone",sid:"ucs7nc"}).on(e[a],(()=>!0)).reset(o);t&&n.reset(t),i.on(n,(e=>e-1)),s.on(e[a],((e,t)=>{const n=Array.isArray(e)?[...e]:{...e};return n[a]=t,n}))}(0,r.default.guard)({and:[{source:(0,r.default.sample)({and:[s,(0,r.default.merge)(Object.values(e),{name:"and",sid:"-l8g4ey"})],or:{name:"source",sid:"uf92v9"}}),filter:i.map((e=>0===e)),target:o}],or:{sid:"ciekm0"}})})),o}})),i=o((function(e,t){function n(e){return r.default.is.unit(e)?e.map((e=>!e)):t=>!e(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.condition=function({if:e,then:t,else:o,source:a=(0,r.default.createEvent)({name:"source",sid:"epke23"})}){const i=r.default.is.unit(e)||(s=e,"function"==typeof s)?e:t=>t===e;var s;t&&(0,r.default.guard)({and:[{source:a,filter:i,target:t}],or:{sid:"9tug3k"}});o&&(0,r.default.guard)({and:[{source:a,filter:n(i),target:o}],or:{sid:"a9shb1"}});return a}})),s=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=function({source:e,timeout:t,target:n}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");if(r.default.is.domain(e,{sid:"iu8yzo"}))throw new TypeError("source cannot be domain");if("number"!=typeof t||t<0||!Number.isFinite(t))throw new Error(`timeout must be positive number or zero. Received: "${t}"`);let o,a;const i=n??(0,r.default.createEvent)({name:"tick",sid:"-xw52dh"}),s=(0,r.default.createEffect)((e=>(clearTimeout(a),o&&o(),new Promise(((n,r)=>{o=r,a=setTimeout(n,t,e)})))),{name:"timerFx",sid:"m8kfsq"});return(0,r.default.forward)({and:{from:e,to:s},or:{sid:"k4foqk"}}),(0,r.default.forward)({and:{from:s.done.map((({result:e})=>e)),to:i},or:{sid:"k76npd"}}),i}})),u=o((function(e,t){function n(e){return r.default.is.store(e,{sid:"-j30z7b"})?"store":r.default.is.effect(e,{sid:"-j1dlf8"})?"effect":r.default.is.event(e,{sid:"-io6j6k"})?"event":r.default.is.domain(e,{sid:"-imj5eh"})?"domain":r.default.is.unit(e)?"unit":"unknown"}function o(e,t,n=""){const r=n+i(e);e.watch((e=>{console.info(`[${t}] ${r}`,e)}))}function a(e){o(e.done,"effect",i(e)+"."),o(e.fail,"effect",i(e)+".")}function i(e){return e.compositeName&&e.compositeName.fullName?e.compositeName.fullName:e.shortName?e.shortName:e.name?e.name:""}Object.defineProperty(t,"__esModule",{value:!0}),t.debug=function(...e){for(const t of e){const e=n(t);(r.default.is.store(t,{sid:"8mdztw"})||r.default.is.effect(t,{sid:"-gueih2"})||r.default.is.event(t,{sid:"-gueh0j"}))&&o(t,e),r.default.is.effect(t,{sid:"-jlpzbv"})&&a(t),r.default.is.domain(t,{sid:"-jjisyf"})&&(t.onCreateEvent((e=>o(e,"event"))),t.onCreateStore((e=>o(e,"store"))),t.onCreateEffect(a))}}})),d=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.delay=function({source:e,timeout:t,target:n=(0,r.default.createEvent)({name:"target",sid:"-z2vw3w"})}){if(!r.default.is.unit(e))throw new TypeError("source must be a unit from effector");if(!r.default.is.unit(n))throw new TypeError("target must be a unit from effector");const o=function(e){if(r.default.is.store(e,{sid:"-va560a"})||"function"==typeof e||"number"==typeof e)return e;throw new TypeError(`'timeout' argument must be a function, Store, or a number. Passed "${typeof e}"`)}(t),a=(0,r.default.createEffect)((({payload:e,milliseconds:t})=>new Promise((n=>{setTimeout(n,t,e)}))),{name:"timerFx",sid:"-584o7j"});return(0,r.default.sample)({and:[{source:(0,r.default.combine)({and:[{milliseconds:o}],or:{name:"source",sid:"9rbdjo"}}),clock:e,fn:({milliseconds:e},t)=>({payload:t,milliseconds:"function"==typeof e?e(t):e}),target:a}],or:{sid:"-wmj29s"}}),(0,r.default.forward)({and:{from:a.doneData,to:n},or:{sid:"-vsadmx"}}),n}})),f=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.every=function(e,t){let n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate);i=a,n="function"==typeof i?a:r.default.is.store(a,{sid:"sid3ut"})?a.map((e=>t=>e===t)):e=>e===a;var i;const s=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"h09uhg"}}),u=n;return(0,r.default.combine)({and:[u,s,(e,t)=>t.every(e)],or:{sid:"hfkdw9"}})}})),c=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.format=function(e,...t){return(0,r.default.combine)({and:[t,t=>e.reduce(((n,r,o)=>n.concat(function(e,t){return t===e.length-1}(e,o)?r:`${r}${function(e){if(Array.isArray(e))return e.map((e=>String(e))).join(", ");return String(e)}(t[o])}`)),"")],or:{sid:"-yrbthp"}})}})),l=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.inFlight=function({effects:e,domain:t}){if(t){const e=t.createStore(0,{name:"$inFlight",sid:"-y7vg7t"});return t.onCreateEffect((t=>{e.on(t,(e=>e+1)).on(t.finally,(e=>e-1))})),e}return(0,r.default.combine)({and:[e.map((e=>e.inFlight)),e=>e.reduce(((e,t)=>e+t),0)],or:{sid:"ubqxa7"}})}})),m=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.interval=function({timeout:e,start:t,stop:n,leading:o=!1,trailing:a=!1}){const i=(0,r.default.createEvent)({name:"tick",sid:"uo9p3s"}),s=(0,r.default.createStore)(!1,{name:"$isRunning",sid:"-wxesi8"}),u=function(e){if(r.default.is.store(e,{sid:"6p7767"}))return e;if("number"==typeof e)return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"5hw6se"});throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(e),d=s.map((e=>!e)),f=(0,r.default.createEvent)({name:"saveTimeout",sid:"as5clk"}),c=(0,r.default.createStore)(null,{name:"$timeoutId",sid:"-bh90bo"}).on(f,((e,t)=>t)),l=(0,r.default.createEvent)({name:"saveReject",sid:"-64swis"}),m=(0,r.default.createStore)((()=>{}),{name:"$rejecter",sid:"eabbu7"}).on(l,((e,t)=>t)),p=(0,r.default.createEffect)((e=>new Promise(((t,n)=>{const r=setTimeout(t,e);f(r),l(n)}))),{name:"timeoutFx",sid:"7lc3mj"}),y=(0,r.default.attach)({and:{source:[c,m],effect:([e,t])=>{t(),e&&clearTimeout(e)}},or:{name:"cleanupFx",sid:"pcn5jq"}});(0,r.default.guard)({and:[{clock:t,source:u,filter:d,target:p}],or:{sid:"-w5qmwp"}}),o&&(0,r.default.guard)({and:[{clock:t,filter:d,target:i}],or:{sid:"-vpslni"}});(0,r.default.sample)({and:[{clock:t,fn:()=>!0,target:s}],or:{sid:"-vaed34"}}),(0,r.default.guard)({and:[{clock:p.done,source:u,filter:s,target:p}],or:{sid:"-v73liy"}}),(0,r.default.sample)({and:[{clock:p.done,fn:()=>{},target:i}],or:{sid:"-urpcwu"}}),n&&(a&&(0,r.default.sample)({and:[{clock:n,target:i}],or:{sid:"-uanqf7"}}),s.on(n,(()=>!1)),(0,r.default.sample)({and:[{clock:n,target:y}],or:{sid:"6lcmyy"}}));return{tick:i,isRunning:s}}})),p=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.pending=function({effects:e,domain:t,of:o="some"}){if(!r.default.is.domain(t,{sid:"97b92c"})&&!e)throw new TypeError("domain or effects should be passed");if("some"!==o&&"every"!==o)throw new TypeError(`strategy parameter "of" can be "every" or "some". Passed: "${o}"`);let a=e??[];const i=n[o];t&&(a=[],t.onCreateEffect((e=>a.push(e))));return(0,r.default.combine)({and:[a.map((e=>e.pending)),i],or:{sid:"a37bj0"}})};const n={some:e=>e.some(Boolean),every:e=>e.every(Boolean)}})),y=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reset=function({clock:e,target:t}){const n=Array.isArray(t)?t:[t],r=Array.isArray(e)?e:[e];n.forEach((e=>{e.reset.call(e,r)}))}})),b=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reshape=function({source:e,shape:t}){const n={};for(const r in t)if(r in t){const o=t[r];n[r]=e.map((e=>{const t=o(e);return void 0===t?null:t}))}return n}})),v=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.snapshot=function({source:e,clock:t,fn:n=(e=>e)}){const o=n(e.defaultState),a=t?(0,r.default.sample)({and:[e,t,n],or:{name:"onSnapshot",sid:"-auitd0"}}):(0,r.default.sample)({and:[{source:e,fn:n}],or:{name:"onSnapshot",sid:"-auir6n"}}),i=(0,r.default.createStore)(o,{name:"$snapshot",sid:"-7zyoaf"});return i.on(a,((e,t)=>t)),i}})),g=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.some=function(e,t){let n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate);i=a,n="function"==typeof i?a:r.default.is.store(a,{sid:"zbwu0l"})?a.map((e=>t=>e===t)):e=>e===a;var i;const s=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"-lv5do0"}}),u=n;return(0,r.default.combine)({and:[u,s,(e,t)=>t.some(e)],or:{sid:"-efc5w7"}})}})),h=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.splitMap=function({source:e,cases:t}){const n={};let o=r.default.is.store(e,{name:"current",sid:"-htjkz7"})?e.updates:e;for(const e in t)if(e in t){const r=t[e];n[e]=o.filterMap(r),o=o.filter({fn:e=>!r(e)})}return n.__=o,n}})),w=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.spread=function({targets:e,source:t=(0,r.default.createEvent)({name:"source",sid:"-iel8gi"})}){for(const n in e)if(n in e){const o=(0,r.default.guard)({and:[{source:t,filter:e=>"object"==typeof e&&null!==e&&n in e}],or:{name:"hasTargetKey",sid:"-gh83lo"}});r.default.is.store(e[n],{sid:"jliekw"})?e[n].on(o,((e,t)=>t[n])):(0,r.default.sample)({and:[{source:o,fn:e=>e[n],target:e[n]}],or:{sid:"lnzpe6"}})}return t}})),j=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.status=function({effect:e,defaultValue:t="initial"}){const n=(0,r.default.createStore)(t,{name:"$status",sid:"abrgim"});return n.on(e,(()=>"pending")).on(e.done,(()=>"done")).on(e.fail,(()=>"fail")),n}})),_=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=function({source:e,timeout:t,target:n=(0,r.default.createEvent)({name:"target",sid:"cenyj5"})}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");if("number"!=typeof t||t<0)throw new Error("timeout must be positive number or zero");const o=(0,r.default.createEffect)((()=>new Promise((e=>setTimeout(e,t)))),{name:"timerFx",sid:"uv7gwq"});return(0,r.default.guard)({and:[{source:e,filter:o.pending.map((e=>!e)),target:o}],or:{sid:"-iy4kn2"}}),(0,r.default.sample)({and:[{source:e,clock:o.done,target:n}],or:{sid:"-ija4mb"}}),n}})),E=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.time=function({clock:e,getNow:t,initial:o}){const a=t??n,i=(0,r.default.createEffect)(a,{name:"readNowFx",sid:"459ysb"}),s=(0,r.default.restore)(i,o??a(),{name:"$time",sid:"-ys9vce"});return(0,r.default.forward)({and:{from:e,to:i},or:{sid:"rdje9v"}}),s};const n=()=>Date.now()})),k=a.combineEvents,P=i.condition,M=s.debounce,O=u.debug,$=d.delay,T=f.every,A=c.format,S=l.inFlight,x=m.interval,z=p.pending,F=y.reset,q=b.reshape,N=v.snapshot,C=g.some,R=h.splitMap,D=w.spread,B=j.status,I=_.throttle,K=E.time,V={combineEvents:k,condition:P,debounce:M,debug:O,delay:$,every:T,format:A,inFlight:S,interval:x,pending:z,reset:F,reshape:q,snapshot:N,some:C,splitMap:R,spread:D,status:B,throttle:I,time:K};e.combineEvents=k,e.condition=P,e.debounce=M,e.debug=O,e.default=V,e.delay=$,e.every=T,e.format=A,e.inFlight=S,e.interval=x,e.pending=z,e.reset=F,e.reshape=q,e.snapshot=N,e.some=C,e.splitMap=R,e.spread=D,e.status=B,e.throttle=I,e.time=K,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("effector")):"function"==typeof define&&define.amd?define(["exports","effector"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).patronum={},e.effector)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(t);function o(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var a=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.and=function(...e){return(0,r.default.combine)({and:[e,e=>e.reduce(((e,t)=>Boolean(e)&&Boolean(t)))],or:{sid:"-rbm5ks"}})}})),i=o((function(e,t){function n(e){throw new Error(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.combineEvents=function({events:e,reset:t,target:o=(0,r.default.createEvent)({name:"target",sid:"3pez5"})}){r.default.is.unit(o)||n("target should be a unit");t&&!r.default.is.unit(t)&&n("reset should be a unit");return(0,r.default.withRegion)(o,(()=>{const n=Object.keys(e),a=Array.isArray(e)?[...n].fill(""):{},i=(0,r.default.createStore)(n.length,{name:"$counter",sid:"-dszn9a"}),u=(0,r.default.createStore)(a,{name:"$results",sid:"boz3x7"});i.reset((0,r.default.sample)({and:[o],or:{sid:"-8yzcn6"}})),u.reset(o),t&&(i.reset((0,r.default.sample)({and:[t],or:{sid:"-72suil"}})),u.reset(t));for(const a of n){const n=(0,r.default.createStore)(!1,{name:"$isDone",sid:"ucs7nc"}).on(e[a],(()=>!0)).reset(o);t&&n.reset(t),i.on(n,(e=>e-1)),u.on(e[a],((e,t)=>{const n=Array.isArray(e)?[...e]:{...e};return n[a]=t,n}))}(0,r.default.guard)({and:[{source:(0,r.default.sample)({and:[u,(0,r.default.merge)(Object.values(e),{name:"and",sid:"-l8g4ey"})],or:{name:"source",sid:"uf92v9"}}),filter:i.map((e=>0===e)),target:o}],or:{sid:"ciekm0"}})})),o}})),u=o((function(e,t){function n(e){return r.default.is.unit(e)?e.map((e=>!e)):t=>!e(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.condition=function({if:e,then:t,else:o,source:a=(0,r.default.createEvent)({name:"source",sid:"epke23"})}){const i=r.default.is.unit(e)||(u=e,"function"==typeof u)?e:t=>t===e;var u;t&&o?(0,r.default.split)({and:[{source:a,match:{then:i,else:n(i)},cases:{then:t,else:o}}],or:{sid:"9tug3k"}}):t?(0,r.default.guard)({and:[{source:a,filter:i,target:t}],or:{sid:"abznoh"}}):o&&(0,r.default.guard)({and:[{source:a,filter:n(i),target:o}],or:{sid:"-eb29qp"}});return a}})),s=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=function({source:e,timeout:t,target:n}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");if(r.default.is.domain(e,{sid:"iu8yzo"}))throw new TypeError("source cannot be domain");if("number"!=typeof t||t<0||!Number.isFinite(t))throw new Error(`timeout must be positive number or zero. Received: "${t}"`);let o,a;const i=n??(0,r.default.createEvent)({name:"tick",sid:"-xw52dh"}),u=(0,r.default.createEffect)((e=>(clearTimeout(a),o&&o(),new Promise(((n,r)=>{o=r,a=setTimeout(n,t,e)})))),{name:"timerFx",sid:"m8kfsq"});return(0,r.default.forward)({and:{from:e,to:u},or:{sid:"k4foqk"}}),(0,r.default.forward)({and:{from:u.done.map((({result:e})=>e)),to:i},or:{sid:"k76npd"}}),i}})),d=o((function(e,t){function n(e){return r.default.is.store(e,{sid:"-j30z7b"})?"store":r.default.is.effect(e,{sid:"-j1dlf8"})?"effect":r.default.is.event(e,{sid:"-io6j6k"})?"event":r.default.is.domain(e,{sid:"-imj5eh"})?"domain":r.default.is.unit(e)?"unit":"unknown"}function o(e,t,n=""){const r=n+i(e);e.watch((e=>{console.info(`[${t}] ${r}`,e)}))}function a(e){o(e.done,"effect",i(e)+"."),o(e.fail,"effect",i(e)+".")}function i(e){return e.compositeName&&e.compositeName.fullName?e.compositeName.fullName:e.shortName?e.shortName:e.name?e.name:""}Object.defineProperty(t,"__esModule",{value:!0}),t.debug=function(...e){for(const t of e){const e=n(t);(r.default.is.store(t,{sid:"8mdztw"})||r.default.is.effect(t,{sid:"-gueih2"})||r.default.is.event(t,{sid:"-gueh0j"}))&&o(t,e),r.default.is.effect(t,{sid:"-jlpzbv"})&&a(t),r.default.is.domain(t,{sid:"-jjisyf"})&&(t.onCreateEvent((e=>o(e,"event"))),t.onCreateStore((e=>o(e,"store"))),t.onCreateEffect(a))}}})),f=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.delay=function({source:e,timeout:t,target:n=(0,r.default.createEvent)({name:"target",sid:"-z2vw3w"})}){if(!r.default.is.unit(e))throw new TypeError("source must be a unit from effector");if(!r.default.is.unit(n))throw new TypeError("target must be a unit from effector");const o=function(e){if(r.default.is.store(e,{sid:"-va560a"})||"function"==typeof e||"number"==typeof e)return e;throw new TypeError(`'timeout' argument must be a function, Store, or a number. Passed "${typeof e}"`)}(t),a=(0,r.default.createEffect)((({payload:e,milliseconds:t})=>new Promise((n=>{setTimeout(n,t,e)}))),{name:"timerFx",sid:"-584o7j"});return(0,r.default.sample)({and:[{source:(0,r.default.combine)({and:[{milliseconds:o}],or:{name:"source",sid:"9rbdjo"}}),clock:e,fn:({milliseconds:e},t)=>({payload:t,milliseconds:"function"==typeof e?e(t):e}),target:a}],or:{sid:"-wmj29s"}}),(0,r.default.forward)({and:{from:a.doneData,to:n},or:{sid:"-vsadmx"}}),n}})),c=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.either=function e(t,n,o){if(r.default.is.store(t,{sid:"n60kh0"}))return(0,r.default.combine)({and:[t,n,o,(e,t,n)=>e?t:n],or:{sid:"8ceklb"}});return e(t)}})),l=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.equals=function(e,t){return(0,r.default.combine)({and:[e,t,(e,t)=>e===t],or:{sid:"jvku5g"}})}})),m=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.every=function(e,t){let n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate);i=a,n="function"==typeof i?a:r.default.is.store(a,{sid:"sid3ut"})?a.map((e=>t=>e===t)):e=>e===a;var i;const u=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"h09uhg"}}),s=n;return(0,r.default.combine)({and:[s,u,(e,t)=>t.every(e)],or:{sid:"hfkdw9"}})}})),p=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.format=function(e,...t){return(0,r.default.combine)({and:[t,t=>e.reduce(((n,r,o)=>n.concat(function(e,t){return t===e.length-1}(e,o)?r:`${r}${function(e){if(Array.isArray(e))return e.map((e=>String(e))).join(", ");return String(e)}(t[o])}`)),"")],or:{sid:"-yrbthp"}})}})),y=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.inFlight=function({effects:e,domain:t}){if(t){const e=t.createStore(0,{name:"$inFlight",sid:"-y7vg7t"});return t.onCreateEffect((t=>{e.on(t,(e=>e+1)).on(t.finally,(e=>e-1))})),e}return(0,r.default.combine)({and:[e.map((e=>e.inFlight)),e=>e.reduce(((e,t)=>e+t),0)],or:{sid:"ubqxa7"}})}})),b=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.interval=function({timeout:e,start:t,stop:n,leading:o=!1,trailing:a=!1}){const i=(0,r.default.createEvent)({name:"tick",sid:"uo9p3s"}),u=(0,r.default.createStore)(!1,{name:"$isRunning",sid:"-wxesi8"}),s=function(e){if(r.default.is.store(e,{sid:"6p7767"}))return e;if("number"==typeof e)return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"5hw6se"});throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(e),d=u.map((e=>!e)),f=(0,r.default.createEvent)({name:"saveTimeout",sid:"as5clk"}),c=(0,r.default.createStore)(null,{name:"$timeoutId",sid:"-bh90bo"}).on(f,((e,t)=>t)),l=(0,r.default.createEvent)({name:"saveReject",sid:"-64swis"}),m=(0,r.default.createStore)((()=>{}),{name:"$rejecter",sid:"eabbu7"}).on(l,((e,t)=>t)),p=(0,r.default.createEffect)((e=>new Promise(((t,n)=>{const r=setTimeout(t,e);f(r),l(n)}))),{name:"timeoutFx",sid:"7lc3mj"}),y=(0,r.default.attach)({and:{source:[c,m],effect:([e,t])=>{t(),e&&clearTimeout(e)}},or:{name:"cleanupFx",sid:"pcn5jq"}});(0,r.default.guard)({and:[{clock:t,source:s,filter:d,target:p}],or:{sid:"-w5qmwp"}}),o&&(0,r.default.guard)({and:[{clock:t,filter:d,target:i}],or:{sid:"-vpslni"}});(0,r.default.sample)({and:[{clock:t,fn:()=>!0,target:u}],or:{sid:"-vaed34"}}),(0,r.default.guard)({and:[{clock:p.done,source:s,filter:u,target:p}],or:{sid:"-v73liy"}}),(0,r.default.sample)({and:[{clock:p.done,fn:()=>{},target:i}],or:{sid:"-urpcwu"}}),n&&(a&&(0,r.default.sample)({and:[{clock:n,target:i}],or:{sid:"-uanqf7"}}),u.on(n,(()=>!1)),(0,r.default.sample)({and:[{clock:n,target:y}],or:{sid:"6lcmyy"}}));return{tick:i,isRunning:u}}})),v=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.not=function(e){return e.map((e=>!e))}})),g=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=function(...e){return(0,r.default.combine)({and:[e,e=>e.reduce(((e,t)=>Boolean(e)||Boolean(t)))],or:{sid:"-44722k"}})}})),h=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.pending=function({effects:e,domain:t,of:o="some"}){if(!r.default.is.domain(t,{sid:"97b92c"})&&!e)throw new TypeError("domain or effects should be passed");if("some"!==o&&"every"!==o)throw new TypeError(`strategy parameter "of" can be "every" or "some". Passed: "${o}"`);let a=e??[];const i=n[o];t&&(a=[],t.onCreateEffect((e=>a.push(e))));return(0,r.default.combine)({and:[a.map((e=>e.pending)),i],or:{sid:"a37bj0"}})};const n={some:e=>e.some(Boolean),every:e=>e.every(Boolean)}})),w=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reset=function({clock:e,target:t}){const n=Array.isArray(t)?t:[t],r=Array.isArray(e)?e:[e];n.forEach((e=>{e.reset.call(e,r)}))}})),j=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reshape=function({source:e,shape:t}){const n={};for(const r in t)if(r in t){const o=t[r];n[r]=e.map((e=>{const t=o(e);return void 0===t?null:t}))}return n}})),_=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.snapshot=function({source:e,clock:t,fn:n=(e=>e)}){const o=n(e.defaultState),a=t?(0,r.default.sample)({and:[e,t,n],or:{name:"onSnapshot",sid:"-auitd0"}}):(0,r.default.sample)({and:[{source:e,fn:n}],or:{name:"onSnapshot",sid:"-auir6n"}}),i=(0,r.default.createStore)(o,{name:"$snapshot",sid:"-7zyoaf"});return i.on(a,((e,t)=>t)),i}})),E=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.some=function(e,t){let n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate);i=a,n="function"==typeof i?a:r.default.is.store(a,{sid:"zbwu0l"})?a.map((e=>t=>e===t)):e=>e===a;var i;const u=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"-lv5do0"}}),s=n;return(0,r.default.combine)({and:[s,u,(e,t)=>t.some(e)],or:{sid:"-efc5w7"}})}})),k=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.splitMap=function({source:e,cases:t}){const n={};let o=r.default.is.store(e,{name:"current",sid:"-htjkz7"})?e.updates:e;for(const e in t)if(e in t){const r=t[e];n[e]=o.filterMap(r),o=o.filter({fn:e=>!r(e)})}return n.__=o,n}})),P=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.spread=function({targets:e,source:t=(0,r.default.createEvent)({name:"source",sid:"-iel8gi"})}){for(const n in e)if(n in e){const o=(0,r.default.guard)({and:[{source:t,filter:e=>"object"==typeof e&&null!==e&&n in e}],or:{name:"hasTargetKey",sid:"-gh83lo"}});r.default.is.store(e[n],{sid:"jliekw"})?e[n].on(o,((e,t)=>t[n])):(0,r.default.sample)({and:[{source:o,fn:e=>e[n],target:e[n]}],or:{sid:"lnzpe6"}})}return t}})),M=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.status=function({effect:e,defaultValue:t="initial"}){const n=(0,r.default.createStore)(t,{name:"$status",sid:"abrgim"});return n.on(e,(()=>"pending")).on(e.done,(()=>"done")).on(e.fail,(()=>"fail")),n}})),O=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=function({source:e,timeout:t,target:n=(0,r.default.createEvent)({name:"target",sid:"cenyj5"})}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");if("number"!=typeof t||t<0)throw new Error("timeout must be positive number or zero");const o=(0,r.default.createEffect)((()=>new Promise((e=>setTimeout(e,t)))),{name:"timerFx",sid:"uv7gwq"});return(0,r.default.guard)({and:[{source:e,filter:o.pending.map((e=>!e)),target:o}],or:{sid:"-iy4kn2"}}),(0,r.default.sample)({and:[{source:e,clock:o.done,target:n}],or:{sid:"-ija4mb"}}),n}})),$=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.time=function({clock:e,getNow:t,initial:o}){const a=t??n,i=(0,r.default.createEffect)(a,{name:"readNowFx",sid:"459ysb"}),u=(0,r.default.restore)(i,o??a(),{name:"$time",sid:"-ys9vce"});return(0,r.default.forward)({and:{from:e,to:i},or:{sid:"rdje9v"}}),u};const n=()=>Date.now()})),T=a.and,A=i.combineEvents,S=u.condition,x=s.debounce,z=d.debug,q=f.delay,F=c.either,N=l.equals,B=m.every,C=p.format,R=y.inFlight,D=b.interval,I=v.not,K=g.or,V=h.pending,G=w.reset,H=j.reshape,J=_.snapshot,L=E.some,Q=k.splitMap,U=P.spread,W=M.status,X=O.throttle,Y=$.time,Z={and:T,combineEvents:A,condition:S,debounce:x,debug:z,delay:q,either:F,equals:N,every:B,format:C,inFlight:R,interval:D,not:I,or:K,pending:V,reset:G,reshape:H,snapshot:J,some:L,splitMap:Q,spread:U,status:W,throttle:X,time:Y};e.and=T,e.combineEvents=A,e.condition=S,e.debounce=x,e.debug=z,e.default=Z,e.delay=q,e.either=F,e.equals=N,e.every=B,e.format=C,e.inFlight=R,e.interval=D,e.not=I,e.or=K,e.pending=V,e.reset=G,e.reshape=H,e.snapshot=J,e.some=L,e.splitMap=Q,e.spread=U,e.status=W,e.throttle=X,e.time=Y,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=patronum.umd.js.map

@@ -37,3 +37,3 @@ # <img src="logo.svg" title="effector patronum" alt="Effector Patronum logo" width="640px">

### Time
### Timeouts

@@ -40,0 +40,0 @@ - [Debounce](#debounce) — Creates event which waits until time passes after previous trigger.

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 not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc