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

patronum

Package Overview
Dependencies
Maintainers
5
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.12.3 to 1.13.0

2

and/index.js

@@ -6,3 +6,2 @@ import { combine } from 'effector';

}
return combine({

@@ -15,3 +14,2 @@ and: [stores, values => {

}
return true;

@@ -18,0 +16,0 @@ }],

14

combine-events/index.js
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import { createEvent, createStore, guard, is, merge, sample, withRegion } from 'effector';

@@ -48,3 +47,2 @@ export function combineEvents(_ref) {

$results.reset(target);
if (reset) {

@@ -61,3 +59,2 @@ $counter.reset(sample({

}
var _loop = function _loop(key) {

@@ -71,7 +68,5 @@ var $isDone = createStore(false, {

}).on(events[key], () => true).reset(target);
if (reset) {
$isDone.reset(reset);
}
$counter.on($isDone, value => value - 1);

@@ -84,7 +79,5 @@ $results.on(events[key], (shape, payload) => {

};
for (var key of keys) {
_loop(key);
}
guard({

@@ -115,5 +108,4 @@ and: [{

}
function throwError(message) {
throw new Error(message);
}

@@ -16,3 +16,2 @@ import { createEvent, guard, is, split } from 'effector';

var checker = is.unit(test) || isFunction(test) ? test : value => value === test;
if (thenBranch && elseBranch) {

@@ -58,10 +57,7 @@ split({

}
return source;
}
function isFunction(value) {
return typeof value === 'function';
}
function inverse(fnOrUnit) {

@@ -71,4 +67,3 @@ if (is.unit(fnOrUnit)) {

}
return value => !fnOrUnit(value);
}

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

import { createEffect, createEvent, createStore, forward, is, sample, attach } from 'effector';
import { createEffect, createEvent, createStore, is, sample, attach, guard, merge } from 'effector';
export function debounce(_ref) {

@@ -10,3 +10,3 @@ var {

if (is.domain(source, {
sid: "jne2ft"
sid: "jnxv16"
})) throw new TypeError('source cannot be domain');

@@ -16,3 +16,3 @@ var $timeout = toStoreNumber(timeout);

name: "saveTimeoutId",
sid: "eqtrwk"
sid: "f7vear"
});

@@ -24,9 +24,9 @@ var $timeoutId = createStore(null, {

name: "$timeoutId",
sid: "-5hlcyp"
sid: "-50jqki"
}).on(saveTimeoutId, (_, id) => id);
var saveReject = createEvent({
name: "saveReject",
sid: "-m6vk0"
}); // eslint-disable-next-line @typescript-eslint/no-empty-function
sid: "-5595t"
});
// eslint-disable-next-line @typescript-eslint/no-empty-function
var $rejecter = createStore(null, {

@@ -37,11 +37,10 @@ and: {

name: "$rejecter",
sid: "tqvf32"
sid: "u7x1h9"
}).on(saveReject, (_, rj) => rj);
var tick = target !== null && target !== void 0 ? target : createEvent({
name: "tick",
sid: "-6wklwe"
sid: "-6fizi7"
});
var timerBaseFx = createEffect(_ref2 => {
var {
parameter,
timeout,

@@ -55,7 +54,7 @@ timeoutId,

saveReject(reject);
saveTimeoutId(setTimeout(resolve, timeout, parameter));
saveTimeoutId(setTimeout(resolve, timeout));
});
}, {
name: "timerBaseFx",
sid: "-xd98qa"
sid: "-ww7mc3"
});

@@ -68,13 +67,8 @@ var timerFx = attach({

},
mapParams: (_ref3, _ref4) => {
mapParams: (timeout, _ref3) => {
var {
parameter,
timeout
} = _ref3;
var {
timeoutId,
rejectPromise
} = _ref4;
} = _ref3;
return {
parameter,
timeout,

@@ -94,28 +88,61 @@ timeoutId,

$timeoutId.reset(timerFx.done);
// It's ok - nothing will ever start unless source is triggered
var $payload = createStore(null, {
and: {
serialize: 'ignore'
},
name: "$payload",
sid: "-5sqiq6"
}).on(source, (_, payload) => payload);
var $canTick = createStore(true, {
and: {
serialize: 'ignore'
},
name: "$canTick",
sid: "-ytfpys"
});
var triggerTick = createEvent({
name: "triggerTick",
sid: "aamdmm"
});
$canTick.on(triggerTick, () => false).on([tick,
// debounce timeout should be restarted on timeout change
$timeout,
// debounce timeout can be restarted in later ticks
timerFx], () => true);
var requestTick = merge([source,
// debounce timeout is restarted on timeout change
$timeout], {
name: "requestTick",
sid: "-8mwak3"
});
guard({
and: [{
clock: requestTick,
filter: $canTick,
target: triggerTick
}],
or: {
sid: "-2h4urv"
}
});
sample({
and: [{
source: $timeout,
clock: source,
fn: (timeout, parameter) => ({
timeout,
parameter
}),
clock: triggerTick,
target: timerFx
}],
or: {
sid: "m29k3f"
sid: "-22aer4"
}
});
forward({
and: {
from: timerFx.done.map(_ref5 => {
var {
result
} = _ref5;
return result;
}),
to: tick
},
sample({
and: [{
source: $payload,
clock: timerFx.done,
target: tick
}],
or: {
sid: "-32ktwy"
sid: "-1nfyqd"
}

@@ -125,8 +152,6 @@ });

}
function toStoreNumber(value) {
if (is.store(value, {
sid: "-2xmoh9"
sid: "-16ec8q"
})) return value;
if (typeof value === 'number') {

@@ -138,7 +163,6 @@ if (value < 0 || !Number.isFinite(value)) throw new Error("timeout must be positive number or zero. Received: \"".concat(value, "\""));

},
sid: "-757cx6"
sid: "-xo2xu0"
});
}
throw new TypeError("timeout parameter in interval method should be number or Store. \"".concat(typeof value, "\" was passed"));
}

@@ -1,6 +0,33 @@

import { Unit, Scope } from 'effector';
import { Node, Unit, Scope } from 'effector';
declare type LogContext = {
logType: 'initial' | 'update';
scope: Scope | null;
scopeName: string | null;
/** node, kind, value, name - common fields for logs and traces */
node: Node;
kind: string;
value: unknown;
name: string | null;
loc?: {
file?: string;
line: number;
column: number;
};
trace: {
node: Node;
name: string | null;
kind: string;
value: unknown;
loc?: {
file?: string;
line: number;
column: number;
};
}[];
};
interface Config {
trace?: boolean;
handler?: (context: LogContext) => void;
}
export declare function debug(...units: [Unit<any>, ...Unit<any>[]] | [Config, ...Unit<any>[]] | [Record<string, Unit<any>>] | [Config, Record<string, Unit<any>>]): void;
export declare function debug(...entries: [Unit<any>, ...Unit<any>[]] | [Config, ...Unit<any>[]] | [Record<string, Unit<any>>] | [Config, Record<string, Unit<any>>]): void;
export declare namespace debug {

@@ -7,0 +34,0 @@ var registerScope: (scope: Scope, config: {

@@ -1,105 +0,105 @@

import { is, createNode, step } from 'effector';
function isConfig(maybeConfig) {
if (!is.unit(maybeConfig)) {
return !Object.values(maybeConfig).every(is.unit);
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import { is, createNode, step, clearNode } from 'effector';
var defaultConfig = {
trace: false,
// default logger to console.info
handler: context => {
var {
scope,
scopeName,
name,
kind,
value,
loc,
trace,
node,
logType
} = context;
var scopeLog = scope ? " (scope: ".concat(scopeName, ")") : '';
var logName = name !== null && name !== void 0 ? name : loc ? "".concat(loc.file, ":").concat(loc.line, ":").concat(loc.column) : '';
var logPrintType = logType === 'initial' ? ' [getState]' : '';
console.info("[".concat(kind, "]").concat(scopeLog, " ").concat(logName).concat(logPrintType), value);
if (
// logging trace only if there is something to log
trace && trace.length > 0 &&
// do not log trace for effect children, as it is always the same effect internals
!isEffectChild(node)) {
console.groupCollapsed("[".concat(kind, "]").concat(scopeLog, " ").concat(logName, " trace"));
trace.forEach(update => {
var {
name: traceName,
kind,
value,
loc
} = update;
var logTraceName = traceName !== null && traceName !== void 0 ? traceName : loc ? "".concat(loc.file, ":").concat(loc.line, ":").concat(loc.column) : '';
console.info("<- [".concat(kind, "] ").concat(logTraceName), value);
});
console.groupEnd();
}
}
return false;
}
};
export function debug() {
var config = {
trace: false
};
for (var _len = arguments.length, units = new Array(_len), _key = 0; _key < _len; _key++) {
units[_key] = arguments[_key];
}
var [maybeConfig, ...restUnits] = units;
if (isConfig(maybeConfig)) {
config = maybeConfig;
} else if (!is.unit(maybeConfig)) {
for (var [name, unit] of Object.entries(maybeConfig)) {
customNames.set(getGraph(unit).id, name);
logUnit(unit, config);
}
} else {
logUnit(maybeConfig);
}
for (var maybeUnit of restUnits) {
if (is.unit(maybeUnit)) {
logUnit(maybeUnit, config);
var {
config,
units
} = resolveParams(...arguments);
units.forEach(unit => {
if (is.store(unit, {
sid: "-fst7ky"
}) || is.event(unit, {
sid: "7emphc"
}) || is.effect(unit, {
sid: "7emqx0"
})) {
watchUnit(unit, config);
} else if (is.domain(unit, {
sid: "8cpxi6"
})) {
watchDomain(unit, config);
} else {
for (var [_name, _unit] of Object.entries(maybeUnit)) {
customNames.set(getGraph(_unit).id, _name);
logUnit(_unit, config);
}
/**
* Let unknown stuff pass through as noop
*
* It's useful for debug of custom entities:
* debug(myFarfetchedQuery)
*/
}
}
});
}
function getType(unit) {
// Log node
function watchDomain(domain, config) {
domain.onCreateStore(store => watchUnit(store, config));
domain.onCreateEvent(event => watchUnit(event, config));
domain.onCreateEffect(effect => watchUnit(effect, config));
domain.onCreateDomain(domain => watchDomain(domain, config));
}
function watchUnit(unit, config) {
if (is.store(unit, {
sid: "-h7y2t9"
sid: "vrzjgo"
})) {
return 'store';
}
if (is.effect(unit, {
sid: "-h6ap16"
// store has its initial/current value - we can log it right away
watchStoreInit(unit, config);
watch(unit, config);
} else if (is.event(unit, {
sid: "2i5ewx"
})) {
return 'effect';
}
if (is.event(unit, {
sid: "-h4nb93"
watch(unit, config);
} else if (is.effect(unit, {
sid: "3g8npb"
})) {
return 'event';
watch(unit, config);
watch(unit.done, config);
watch(unit.fail, config);
}
if (is.domain(unit, {
sid: "-grg90f"
})) {
return 'domain';
}
if (is.unit(unit)) {
return 'unit';
}
return 'unknown';
}
var debugStores = [];
function log(unit, type) {
var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var name = prefix + getName(unit);
if (is.store(unit, {
sid: "-g609vc"
})) {
// log initial state
logUpdate({
type,
name,
value: unit.getState()
});
scopes.forEach((scope, meta) => {
logUpdate({
type,
name,
scopeName: meta.name,
value: scope.getState(unit)
});
});
debugStores.push(unit);
}
createNode({
function watch(unit, config) {
var watcher = createNode({
parent: [unit],
// debug watchers should behave like normal watchers
meta: {

@@ -112,222 +112,149 @@ op: 'watch'

regional: true,
// node only gets all required data
node: [step.run({
fn(_data, _scope, stack) {
if (!stack.scope) {
logUpdate({
type,
name,
value: _data
});
} else {
if (!scopes.get(stack.scope)) {
scopes.save(stack.scope);
}
fn(value, _internal, stack) {
var _stack$scope;
var scope = (_stack$scope = stack === null || stack === void 0 ? void 0 : stack.scope) !== null && _stack$scope !== void 0 ? _stack$scope : null;
var _meta = scopes.get(stack.scope);
logUpdate({
type,
name,
scopeName: _meta === null || _meta === void 0 ? void 0 : _meta.name,
value: _data
});
// If new unknown scope is found - save it
if (scope && !scopes.get(scope)) {
scopes.save(scope);
}
var context = {
logType: 'update',
scope,
scopeName: getScopeName(scope),
node: getNode(unit),
kind: getType(unit),
value,
name: getName(unit),
loc: getLoc(unit),
trace: config.trace ? collectTrace(stack) : []
};
if (!config.handler) {
throw Error('patronum/debug must have the handler');
}
config.handler(context);
}
})]
});
return () => clearNode(watcher);
}
function logEffect(unit) {
log(unit.done, 'effect', getName(unit) + '.');
log(unit.fail, 'effect', getName(unit) + '.');
function collectTrace(stack) {
var trace = [];
var parent = stack === null || stack === void 0 ? void 0 : stack.parent;
while (parent) {
var {
node,
value
} = parent;
var entry = {
node,
value,
name: getName(node),
loc: getLoc(node),
kind: getType(node)
};
trace.push(entry);
parent = parent.parent;
}
return trace;
}
function getNode(node) {
var actualNode = 'graphite' in node ? node.graphite : node;
return actualNode;
}
var customNames = new Map();
function getName(unit) {
var custom = customNames.get(getGraph(unit).id);
if (custom) {
return custom;
function watchStoreInit(store, config) {
if (!config.handler) {
throw Error('patronum/debug must have the handler');
}
var node = getNode(store);
if (unit.compositeName && unit.compositeName.fullName) {
return unit.compositeName.fullName;
}
// current state
var context = {
logType: 'initial',
scope: null,
scopeName: null,
node,
kind: getType(store),
value: store.getState(),
name: getName(store),
loc: getLoc(store),
// nothing to trace for store.getState() - it is one-step call
trace: []
};
config.handler(context);
if (unit.shortName) {
return unit.shortName;
// current state in every known scope
scopes.forEach(scope => watchStoreInitInScope(store, config, scope));
// subscribe to new scopes
watchScopeRegister(newScope => watchStoreInitInScope(store, config, newScope));
}
function watchStoreInitInScope(store, config, scope) {
if (!config.handler) {
throw Error('patronum/debug must have the handler');
}
var node = getNode(store);
if (unit.name) {
return unit.name;
}
return '';
// current state
var context = {
logType: 'initial',
scope,
scopeName: getScopeName(scope),
node,
kind: getType(store),
value: scope.getState(store),
name: getName(store),
loc: getLoc(store),
// nothing to trace for scope.getState(store) - it is one-step call
trace: []
};
config.handler(context);
}
function readLoc(_ref) {
var {
meta
} = _ref;
var loc = 'config' in meta ? meta.config.loc : meta.loc;
return loc;
}
// Config
function getLoc(unit) {
var _loc$file;
var loc = readLoc(unit);
if (!loc) return null;
return "".concat((_loc$file = loc.file) !== null && _loc$file !== void 0 ? _loc$file : '', ":").concat(loc.line, ":").concat(loc.column);
}
function logUnit(unit, config) {
var type = getType(unit);
if (is.store(unit, {
sid: "zfed9z"
}) || is.effect(unit, {
sid: "wsoi2z"
}) || is.event(unit, {
sid: "wsojji"
})) {
log(unit, type);
if (config !== null && config !== void 0 && config.trace) {
logTrace(unit);
function resolveParams() {
var config = defaultConfig;
for (var _len = arguments.length, entry = new Array(_len), _key = 0; _key < _len; _key++) {
entry[_key] = arguments[_key];
}
var [maybeConfig, ...restUnits] = entry;
var units = [];
if (isConfig(maybeConfig)) {
config = _objectSpread(_objectSpread({}, defaultConfig), maybeConfig);
} else if (!is.unit(maybeConfig)) {
for (var [name, unit] of Object.entries(maybeConfig)) {
customNames.set(getGraph(unit).id, name);
units.push(unit);
}
} else {
units.push(maybeConfig);
}
if (is.effect(unit, {
sid: "-zhbby9"
})) {
logEffect(unit);
}
if (is.domain(unit, {
sid: "-p5meu5"
})) {
unit.onCreateEvent(event => {
log(event, 'event');
if (config !== null && config !== void 0 && config.trace) {
logTrace(event);
for (var maybeUnit of restUnits) {
if (is.unit(maybeUnit)) {
units.push(maybeUnit);
} else {
for (var [_name, _unit] of Object.entries(maybeUnit)) {
customNames.set(getGraph(_unit).id, _name);
units.push(_unit);
}
});
unit.onCreateStore(store => {
log(store, 'store');
if (config !== null && config !== void 0 && config.trace) {
logTrace(store);
}
});
unit.onCreateEffect(effect => {
log(effect, 'effect');
logEffect(effect);
if (config !== null && config !== void 0 && config.trace) {
logTrace(effect);
}
});
}
}
return {
config,
units
};
}
function isEffectChild(node) {
var actualNode = getNode(node);
var {
sid,
named
} = actualNode.meta;
return Boolean(!sid && (named === 'finally' || named === 'done' || named === 'doneData' || named === 'fail' || named === 'failData' || named === 'inFlight' || named === 'pending'));
}
function getNodeName(node) {
if (!node) return '';
var {
meta,
id
} = node;
var customName = customNames.get(id);
if (customName) {
return customName;
function isConfig(maybeConfig) {
if (!is.unit(maybeConfig)) {
return !Object.values(maybeConfig).every(is.unit);
}
if (!isEffectChild(node)) {
return meta.name;
}
var parentEffect = node.family.owners.find(n => n.meta.op === 'effect');
if (parentEffect) {
return "".concat(getNodeName(parentEffect), ".").concat(meta.named);
}
return meta.named;
return false;
}
function logTrace(unit) {
var type = getType(unit);
var name = getName(unit);
createNode({
parent: [unit],
meta: {
op: 'watch'
},
family: {
owners: unit
},
regional: true,
node: [step.run({
fn(_data, _scope, stack) {
var parent = stack === null || stack === void 0 ? void 0 : stack.parent;
var scopeMeta = scopes.get(stack === null || stack === void 0 ? void 0 : stack.scope);
var scopeName = scopeMeta ? " (scope: ".concat(scopeMeta.name, ")") : '';
var groupName = "[".concat(type, "]").concat(scopeName, " ").concat(name, " trace"); // eslint-disable-next-line no-console
console.groupCollapsed(groupName);
while (parent) {
var {
node,
value
} = parent;
var {
meta: _meta2
} = node;
var opName = _meta2.op;
var unitName = getNodeName(node);
if (!unitName) {
var _getLoc;
unitName = (_getLoc = getLoc(node)) !== null && _getLoc !== void 0 ? _getLoc : '';
}
if (opName === 'on') {
var _parent$parent;
var parentStore = getNodeName(node.next[0]);
opName = "".concat(parentStore, ".").concat(_meta2.op);
unitName = "".concat(parentStore, ".").concat(_meta2.op, "(").concat(getNodeName((_parent$parent = parent.parent) === null || _parent$parent === void 0 ? void 0 : _parent$parent.node), ")");
}
console.info("<- [".concat(opName, "] ").concat(unitName), value);
parent = parent.parent;
}
console.groupEnd();
}
})]
});
}
// Scopes
var watchers = new Set();
var watchScopeRegister = cb => {
watchers.add(cb);
return () => {
watchers.delete(cb);
};
};
function registerScope(scope, config) {

@@ -337,10 +264,3 @@ scopes.save(scope, {

});
debugStores.forEach(store => {
logUpdate({
type: 'store',
name: getName(store),
scopeName: config.name,
value: scope.getState(store)
});
});
watchers.forEach(cb => cb(scope));
return () => {

@@ -350,41 +270,11 @@ scopes.delete(scope);

}
function unregisterAllScopes() {
scopes.clear();
}
debug.registerScope = registerScope;
debug.unregisterAllScopes = unregisterAllScopes;
function logUpdate(_ref2) {
var {
type,
scopeName,
name,
value
} = _ref2;
var typeString = "[".concat(type, "]");
var scopeNameString = scopeName ? " (scope: ".concat(scopeName, ")") : '';
var nameString = " ".concat(name);
console.info("".concat(typeString).concat(scopeNameString).concat(nameString), value);
}
var getGraph = graph => graph.graphite || graph;
/**
* This is inlined in the index file because "./scope-cache" import
* does not work correctly with esm imports
* since in the resulting build scope-cache does not have explicit "js" extension
*
* TODO: fix this at the level of build configuration
*/
var cache = new Map();
var unknownScopes = 0;
function getDefaultName() {
unknownScopes += 1;
return "unknown_scope_".concat(unknownScopes);
return "unknown_".concat(unknownScopes);
}
var scopes = {

@@ -398,22 +288,136 @@ save(scope, meta) {

},
get(scope) {
var _cache$get;
if (!scope) return null;
return (_cache$get = cache.get(scope)) !== null && _cache$get !== void 0 ? _cache$get : null;
},
delete(scope) {
cache.delete(scope);
},
forEach(callback) {
cache.forEach((meta, scope) => callback(scope, meta));
},
clear() {
cache.clear();
}
};
debug.registerScope = registerScope;
debug.unregisterAllScopes = unregisterAllScopes;
function getScopeName(scope) {
if (!scope) return null;
var meta = scopes.get(scope);
if (!meta) return null;
return meta.name;
}
};
// Utils
function isEffectChild(node) {
var actualNode = getNode(node);
var {
sid,
named
} = actualNode.meta;
return Boolean(!sid && (named === 'finally' || named === 'done' || named === 'doneData' || named === 'fail' || named === 'failData' || named === 'inFlight' || named === 'pending'));
}
function isStoreOn(node) {
var actualNode = getNode(node);
var {
op
} = actualNode.meta;
if (op === 'on') return true;
return false;
}
function getType(unit) {
if (is.store(unit, {
sid: "-652k3k"
})) {
return 'store';
}
if (is.effect(unit, {
sid: "462kf7"
}) || isEffectChild(unit)) {
return 'effect';
}
if (is.event(unit, {
sid: "47py7a"
})) {
return 'event';
}
if (is.domain(unit, {
sid: "49dbzd"
})) {
return 'domain';
}
if (is.unit(unit)) {
return 'unit';
}
var node = getNode(unit);
if (node.meta.op) {
return node.meta.op;
}
return 'unknown';
}
var getGraph = graph => graph.graphite || graph;
var customNames = new Map();
function getName(unit) {
var _getNode, _getNode$meta;
var custom = customNames.get(getGraph(unit).id);
if (custom) {
return custom;
}
if (isEffectChild(unit)) {
var node = getNode(unit);
var parentEffect = node.family.owners.find(n => n.meta.op === 'effect');
if (parentEffect) {
var closestParentDomainName = getOwningDomainName(parentEffect);
var formattedDomainName = closestParentDomainName ? "".concat(closestParentDomainName, "/") : '';
return "".concat(formattedDomainName).concat(getName(parentEffect), ".").concat(node.meta.named);
}
return node.meta.named;
}
if (isStoreOn(unit)) {
var _node = getNode(unit);
var targetStoreName = getName(_node.next[0]);
var triggerEventName = getName(_node.family.owners[0]);
return "".concat(targetStoreName, ".on(").concat(triggerEventName, ")");
}
if (is.unit(unit)) {
var _compositeName;
if (unit !== null && unit !== void 0 && (_compositeName = unit.compositeName) !== null && _compositeName !== void 0 && _compositeName.fullName) {
return unit.compositeName.fullName;
}
var _closestParentDomainName = getOwningDomainName(unit);
var _formattedDomainName = _closestParentDomainName ? "".concat(_closestParentDomainName, "/") : '';
if (unit !== null && unit !== void 0 && unit.shortName) {
return "".concat(_formattedDomainName).concat(unit.shortName);
}
if (unit !== null && unit !== void 0 && unit.name) {
return "".concat(_formattedDomainName).concat(unit.name);
}
}
if ((_getNode = getNode(unit)) !== null && _getNode !== void 0 && (_getNode$meta = _getNode.meta) !== null && _getNode$meta !== void 0 && _getNode$meta.name) {
return getNode(unit).meta.name;
}
return null;
}
function getOwningDomainName(unit) {
var closestParentDomain = getNode(unit).family.owners.find(n => n.meta.op === 'domain');
if (!closestParentDomain) return null;
return getName(closestParentDomain);
}
function readLoc(_ref) {
var {
meta
} = _ref;
var loc = 'config' in meta ? meta.config.loc : meta.loc;
return loc;
}
function getLoc(unit) {
var loc = readLoc(getNode(unit));
if (!loc) return undefined;
return loc;
}
function getNode(node) {
var actualNode = 'graphite' in node ? node.graphite : node;
return actualNode;
}

@@ -69,3 +69,2 @@ import { createEffect, createEvent, forward, is, sample, combine } from 'effector';

}
function validateTimeout(timeout) {

@@ -77,4 +76,3 @@ if (is.store(timeout, {

}
throw new TypeError("'timeout' argument must be a function, Store, or a number. Passed \"".concat(typeof timeout, "\""));
}

@@ -14,5 +14,4 @@ /* eslint-disable @typescript-eslint/no-unused-vars */

}
var objectForm = filterOptions;
return either(objectForm.filter, objectForm.then, objectForm.other);
}

@@ -5,5 +5,3 @@ /* eslint-disable @typescript-eslint/no-unused-vars */

var stores = [];
var predicate = () => false;
if (Array.isArray(configOrStores)) {

@@ -16,5 +14,3 @@ stores = configOrStores;

}
var checker;
if (isFunction(predicate)) {

@@ -29,3 +25,2 @@ checker = predicate;

}
var $values = combine({

@@ -37,4 +32,4 @@ and: [stores],

}
}); // Combine pass simple values as is
});
// Combine pass simple values as is
var $checker = checker;

@@ -48,5 +43,4 @@ return combine({

}
function isFunction(value) {
return typeof value === 'function';
}

@@ -6,3 +6,2 @@ import { combine } from 'effector';

}
return combine({

@@ -15,3 +14,2 @@ and: [stores, stores => strings.reduce((acc, value, index) => acc.concat(isLastElement(strings, index) ? value : "".concat(value).concat(toString(stores[index]))), '')],

}
function toString(value) {

@@ -21,8 +19,6 @@ if (Array.isArray(value)) {

}
return String(value);
}
function isLastElement(array, index) {
return index === array.length - 1;
}

@@ -7,3 +7,2 @@ import { combine } from 'effector';

} = _ref;
if (domain) {

@@ -19,3 +18,2 @@ var $inFlight = domain.createStore(0, {

}
return combine({

@@ -22,0 +20,0 @@ and: [effects.map(fx => fx.inFlight), inFlights => inFlights.reduce((all, current) => all + current, 0)],

@@ -32,4 +32,4 @@ import { createEvent, createStore, guard, sample, attach, is } from 'effector';

return timeoutId;
}); // eslint-disable-next-line @typescript-eslint/no-empty-function
});
// eslint-disable-next-line @typescript-eslint/no-empty-function
var $rejecter = createStore(() => {}, {

@@ -55,7 +55,5 @@ name: "$rejecter",

} = _ref4;
if (!running) {
return Promise.reject();
}
return new Promise((resolve, reject) => {

@@ -106,3 +104,2 @@ var timeoutId = setTimeout(resolve, timeout);

});
if (leading) {

@@ -129,3 +126,2 @@ var onReady = guard({

}
sample({

@@ -164,3 +160,2 @@ and: [{

});
if (stop) {

@@ -178,3 +173,2 @@ if (trailing) {

}
$isRunning.on(stop, () => false);

@@ -191,3 +185,2 @@ sample({

}
return {

@@ -198,3 +191,2 @@ tick,

}
function toStoreNumber(value) {

@@ -204,3 +196,2 @@ if (is.store(value, {

})) return value;
if (typeof value === 'number') {

@@ -214,4 +205,3 @@ return createStore(value, {

}
throw new TypeError("timeout parameter in interval method should be number or Store. \"".concat(typeof value, "\" was passed"));
}

@@ -6,3 +6,2 @@ import { combine } from 'effector';

}
return combine({

@@ -15,3 +14,2 @@ and: [stores, values => {

}
return false;

@@ -18,0 +16,0 @@ }],

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

@@ -5,0 +5,0 @@ "type": "module",

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

import{combine as e,createEvent as r,is as t,withRegion as n,createStore as o,sample as a,guard as i,merge as c,split as s,createEffect as u,attach as d,forward as f,createNode as m,step as l,restore as p}from"effector";function v(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return e({and:[t,e=>{for(var r of e)if(!r)return!1;return!0}],or:{sid:"-rbm5ks"}})}function g(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 y(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function h(e){var{events:s,reset:u,target:d=r({name:"target",sid:"3pez5"},{name:"target",sid:"3pez5"})}=e;return t.unit(d)||w("target should be a unit"),u&&!t.unit(u)&&w("reset should be a unit"),n(d,(()=>{var e=Object.keys(s),r=Array.isArray(s)?[...e].fill(""):{},t=o(e.length,{and:{serialize:"ignore"},name:"$counter",sid:"-dszn9a"}),n=o(r,{and:{serialize:"ignore"},name:"$results",sid:"boz3x7"});t.reset(a({and:[{source:d}],or:{sid:"-8yzcn6"}})),n.reset(d),u&&(t.reset(a({and:[{source:u}],or:{sid:"-72suil"}})),n.reset(u));var f=function(e){var r=o(!1,{and:{serialize:"ignore"},name:"$isDone",sid:"ucs7nc"}).on(s[e],(()=>!0)).reset(d);u&&r.reset(u),t.on(r,(e=>e-1)),n.on(s[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?g(Object(t),!0).forEach((function(r){y(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):g(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}({},r);return n[e]=t,n}))};for(var m of e)f(m);i({and:[{source:a({and:[{source:n,clock:c(Object.values(s),{name:"clock",sid:"-5k316x"})}],or:{name:"source",sid:"uf92v9"}}),filter:t.map((e=>0===e)),target:d}],or:{sid:"ciekm0"}})})),d}function w(e){throw new Error(e)}function b(e){var{if:n,then:o,else:a,source:c=r({name:"source",sid:"epke23"},{name:"source",sid:"epke23"})}=e,u=t.unit(n)||"function"==typeof n?n:e=>e===n;return o&&a?s({and:[{source:c,match:{then:u,else:j(u)},cases:{then:o,else:a}}],or:{sid:"9tug3k"}}):o?i({and:[{source:c,filter:u,target:o}],or:{sid:"abznoh"}}):a&&i({and:[{source:c,filter:j(u),target:a}],or:{sid:"-eb29qp"}}),c}function j(e){return t.unit(e)?e.map((e=>!e)):r=>!e(r)}function k(e){var{source:n,timeout:i,target:c}=e;if(!t.unit(n))throw new TypeError("source must be unit from effector");if(t.domain(n,{sid:"jne2ft"}))throw new TypeError("source cannot be domain");var s=function(e){if(t.store(e,{sid:"-2xmoh9"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error('timeout must be positive number or zero. Received: "'.concat(e,'"'));return o(e,{and:{name:"$timeout"},sid:"-757cx6"})}throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}(i),m=r({name:"saveTimeoutId",sid:"eqtrwk"}),l=o(null,{and:{serialize:"ignore"},name:"$timeoutId",sid:"-5hlcyp"}).on(m,((e,r)=>r)),p=r({name:"saveReject",sid:"-m6vk0"}),v=o(null,{and:{serialize:"ignore"},name:"$rejecter",sid:"tqvf32"}).on(p,((e,r)=>r)),g=null!=c?c:r({name:"tick",sid:"-6wklwe"}),y=u((e=>{var{parameter:r,timeout:t,timeoutId:n,rejectPromise:o}=e;return n&&clearTimeout(n),o&&o(),new Promise(((e,n)=>{p(n),m(setTimeout(e,t,r))}))}),{name:"timerBaseFx",sid:"-xd98qa"}),h=d({and:{source:{timeoutId:l,rejectPromise:v},mapParams:(e,r)=>{var{parameter:t,timeout:n}=e,{timeoutId:o,rejectPromise:a}=r;return{parameter:t,timeout:n,timeoutId:o,rejectPromise:a}},effect:y},or:{name:"timerFx",sid:"-4ab544"}});return v.reset(h.done),l.reset(h.done),a({and:[{source:s,clock:n,fn:(e,r)=>({timeout:e,parameter:r}),target:h}],or:{sid:"m29k3f"}}),f({and:{from:h.done.map((e=>{var{result:r}=e;return r})),to:g},or:{sid:"-32ktwy"}}),g}function E(e){return!t.unit(e)&&!Object.values(e).every(t.unit)}function z(){for(var e={trace:!1},r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];var[a,...i]=n;if(E(a))e=a;else if(t.unit(a))N(a);else for(var[c,s]of Object.entries(a))x.set(D(s).id,c),N(s,e);for(var u of i)if(t.unit(u))N(u,e);else for(var[d,f]of Object.entries(u))x.set(D(f).id,d),N(f,e)}function O(e){return t.store(e,{sid:"-h7y2t9"})?"store":t.effect(e,{sid:"-h6ap16"})?"effect":t.event(e,{sid:"-h4nb93"})?"event":t.domain(e,{sid:"-grg90f"})?"domain":t.unit(e)?"unit":"unknown"}var A=[];function P(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=n+S(e);t.store(e,{sid:"-g609vc"})&&(q({type:r,name:o,value:e.getState()}),B.forEach(((t,n)=>{q({type:r,name:o,scopeName:n.name,value:t.getState(e)})})),A.push(e)),m({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[l.run({fn(e,t,n){if(n.scope){B.get(n.scope)||B.save(n.scope);var a=B.get(n.scope);q({type:r,name:o,scopeName:null==a?void 0:a.name,value:e})}else q({type:r,name:o,value:e})}})]})}function T(e){P(e.done,"effect",S(e)+"."),P(e.fail,"effect",S(e)+".")}var x=new Map;function S(e){var r=x.get(D(e).id);return r||(e.compositeName&&e.compositeName.fullName?e.compositeName.fullName:e.shortName?e.shortName:e.name?e.name:"")}function $(e){var r,t=function(e){var{meta:r}=e;return"config"in r?r.config.loc:r.loc}(e);return t?"".concat(null!==(r=t.file)&&void 0!==r?r:"",":").concat(t.line,":").concat(t.column):null}function N(e,r){var n=O(e);(t.store(e,{sid:"zfed9z"})||t.effect(e,{sid:"wsoi2z"})||t.event(e,{sid:"wsojji"}))&&(P(e,n),null!=r&&r.trace&&I(e)),t.effect(e,{sid:"-zhbby9"})&&T(e),t.domain(e,{sid:"-p5meu5"})&&(e.onCreateEvent((e=>{P(e,"event"),null!=r&&r.trace&&I(e)})),e.onCreateStore((e=>{P(e,"store"),null!=r&&r.trace&&I(e)})),e.onCreateEffect((e=>{P(e,"effect"),T(e),null!=r&&r.trace&&I(e)})))}function F(e){if(!e)return"";var{meta:r,id:t}=e,n=x.get(t);if(n)return n;if(!function(e){var r=function(e){return"graphite"in e?e.graphite:e}(e),{sid:t,named:n}=r.meta;return Boolean(!t&&("finally"===n||"done"===n||"doneData"===n||"fail"===n||"failData"===n||"inFlight"===n||"pending"===n))}(e))return r.name;var o=e.family.owners.find((e=>"effect"===e.meta.op));return o?"".concat(F(o),".").concat(r.named):r.named}function I(e){var r=O(e),t=S(e);m({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[l.run({fn(e,n,o){var a=null==o?void 0:o.parent,i=B.get(null==o?void 0:o.scope),c=i?" (scope: ".concat(i.name,")"):"",s="[".concat(r,"]").concat(c," ").concat(t," trace");for(console.groupCollapsed(s);a;){var u,{node:d,value:f}=a,{meta:m}=d,l=m.op,p=F(d);if(!p)p=null!==(u=$(d))&&void 0!==u?u:"";if("on"===l){var v,g=F(d.next[0]);l="".concat(g,".").concat(m.op),p="".concat(g,".").concat(m.op,"(").concat(F(null===(v=a.parent)||void 0===v?void 0:v.node),")")}console.info("<- [".concat(l,"] ").concat(p),f),a=a.parent}console.groupEnd()}})]})}function q(e){var{type:r,scopeName:t,name:n,value:o}=e,a="[".concat(r,"]"),i=t?" (scope: ".concat(t,")"):"",c=" ".concat(n);console.info("".concat(a).concat(i).concat(c),o)}z.registerScope=function(e,r){return B.save(e,{name:r.name}),A.forEach((t=>{q({type:"store",name:S(t),scopeName:r.name,value:e.getState(t)})})),()=>{B.delete(e)}},z.unregisterAllScopes=function(){B.clear()};var D=e=>e.graphite||e,C=new Map,R=0;var B={save(e,r){B.get(e)||C.set(e,null!=r?r:{name:"unknown_scope_".concat(R+=1)})},get(e){var r;return e&&null!==(r=C.get(e))&&void 0!==r?r:null},delete(e){C.delete(e)},forEach(e){C.forEach(((r,t)=>e(t,r)))},clear(){C.clear()}};function _(n){var{source:o,timeout:i,target:c=r({name:"target",sid:"-z2vw3w"},{name:"target",sid:"-z2vw3w"})}=n;if(!t.unit(o))throw new TypeError("source must be a unit from effector");if(!t.unit(c))throw new TypeError("target must be a unit from effector");var s=function(e){if(t.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),d=u((e=>{var{payload:r,milliseconds:t}=e;return new Promise((e=>{setTimeout(e,t,r)}))}),{name:"timerFx",sid:"-584o7j"});return a({and:[{source:e({and:[{milliseconds:s}],or:{name:"source",sid:"9rbdjo"}}),clock:o,fn:(e,r)=>{var{milliseconds:t}=e;return{payload:r,milliseconds:"function"==typeof t?t(r):t}},target:d}],or:{sid:"-wmj29s"}}),f({and:{from:d.doneData,to:c},or:{sid:"-vsadmx"}}),c}function M(r,n,o){if(t.store(r,{sid:"ozzvoc"}))return e({and:[r,n,o,(e,r,t)=>e?r:t],or:{sid:"-5vau2h"}});var a=r;return M(a.filter,a.then,a.other)}function K(e){return e.map((e=>null===e))}function V(r,t){return e({and:[r,t,(e,r)=>e===r],or:{sid:"-pqjlti"}})}function G(r,n){var o,a=[],i=()=>!1;Array.isArray(r)?(a=r,i=n):Array.isArray(r.stores)&&(a=r.stores,i=r.predicate),o="function"==typeof i?i:t.store(i,{sid:"sid3ut"})?i.map((e=>r=>e===r)):e=>e===i;var c=e({and:[a],or:{name:"$values",sid:"h09uhg"}});return e({and:[o,c,(e,r)=>r.every(e)],or:{sid:"hfkdw9"}})}function H(r){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return e({and:[n,e=>r.reduce(((t,n,o)=>t.concat(L(r,o)?n:"".concat(n).concat(J(e[o])))),"")],or:{sid:"-yrbthp"}})}function J(e){return Array.isArray(e)?e.map((e=>String(e))).join(", "):String(e)}function L(e,r){return r===e.length-1}function Q(r){var{effects:t,domain:n}=r;if(n){var o=n.createStore(0,{name:"$inFlight",sid:"-y7vg7t"});return n.onCreateEffect((e=>{o.on(e,(e=>e+1)).on(e.finally,(e=>e-1))})),o}return e({and:[t.map((e=>e.inFlight)),e=>e.reduce(((e,r)=>e+r),0)],or:{sid:"ubqxa7"}})}function U(e){var{timeout:n,start:c,stop:s,leading:u=!1,trailing:f=!1}=e,m=r({name:"tick",sid:"u782pl"}),l=o(!1,{name:"$isRunning",sid:"-xegewf"}),p=function(e){if(t.store(e,{sid:"7icamc"}))return e;if("number"==typeof e)return o(e,{and:{name:"$timeout"},sid:"knc3em"});throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}(n),v=l.map((e=>!e)),g=r({name:"saveTimeout",sid:"ab3q7d"}),y=o(null,{name:"$timeoutId",sid:"-aj5rja"}).on(g,((e,r)=>{var{timeoutId:t}=r;return t})),h=o((()=>{}),{name:"$rejecter",sid:"opb0ih"}).on(g,((e,r)=>{var{reject:t}=r;return t})),w=d({and:{source:{timeout:p,running:l},effect:e=>{var{timeout:r,running:t}=e;return t?new Promise(((e,t)=>{var n=setTimeout(e,r);g({timeoutId:n,reject:t})})):Promise.reject()}},or:{name:"timeoutFx",sid:"9hil7b"}}),b=d({and:{source:{timeoutId:y,rejecter:h},effect:e=>{var{timeoutId:r,rejecter:t}=e;t(),r&&clearTimeout(r)}},or:{name:"cleanupFx",sid:"-v02m7d"}});if(i({and:[{clock:c,source:p,filter:v,target:w}],or:{sid:"-vop0ii"}}),u){var j=i({and:[{clock:c,filter:v}],or:{name:"onReady",sid:"-cmw7lh"}});a({and:[{clock:j,target:m}],or:{sid:"-v876ny"}})}return a({and:[{clock:c,fn:()=>!0,target:l}],or:{sid:"-v6jsxl"}}),i({and:[{clock:w.done,source:p,filter:l,target:w}],or:{sid:"-urpcwu"}}),i({and:[{clock:w.done,filter:l,target:m.prepend((()=>{}))}],or:{sid:"-ucb4aq"}}),s&&(f&&a({and:[{clock:s,target:m}],or:{sid:"6lcn0o"}}),l.on(s,(()=>!1)),a({and:[{clock:s,target:b}],or:{sid:"71ao6f"}})),{tick:m,isRunning:l}}function W(e){return e.map((e=>!e))}function X(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return e({and:[t,e=>{for(var r of e)if(r)return!0;return!1}],or:{sid:"-44722k"}})}var Y={some:e=>e.some(Boolean),every:e=>e.every(Boolean)};function Z(r){var{effects:n,domain:o,of:a="some"}=r;if(!t.domain(o,{sid:"97b92c"})&&!n)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!=n?n:[],c=Y[a];return o&&(i=[],o.onCreateEffect((e=>i.push(e)))),e({and:[i.map((e=>e.pending)),c],or:{sid:"a37bj0"}})}function ee(e){var{clock:r,target:t}=e,n=Array.isArray(t)?t:[t],o=Array.isArray(r)?r:[r];n.forEach((e=>{e.reset(o)}))}function re(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 te(e){var{source:r,clock:t,fn:n=(e=>e)}=e,i=n(r.defaultState),c=a(t?{and:[{source:r,clock:t,fn:n}],or:{name:"onSnapshot",sid:"-auitd0"}}:{and:[{source:r,fn:n}],or:{name:"onSnapshot",sid:"-auiql4"}}),s=o(i,{name:"$snapshot",sid:"-7zyoaf"});return s.on(c,((e,r)=>r)),s}function ne(r,n){var o,a=[],i=()=>!1;Array.isArray(r)?(a=r,i=n):Array.isArray(r.stores)&&(a=r.stores,i=r.predicate),o="function"==typeof i?i:t.store(i,{sid:"zbwu0l"})?i.map((e=>r=>e===r)):e=>e===i;var c=e({and:[a],or:{name:"$values",sid:"-lv5do0"}});return e({and:[o,c,(e,r)=>r.some(e)],or:{sid:"-efc5w7"}})}function oe(e){var{source:r,cases:n}=e,o={},a=t.store(r,{name:"current",sid:"-htjkz7"})?r.updates:r;for(var i in n)i in n&&function(){var e=n[i];o[i]=a.filterMap(e),a=a.filter({fn:r=>!e(r)})}();return o.__=a,o}var ae={}.hasOwnProperty;function ie(e){var{targets:t,source:n=r({name:"source",sid:"-fkbi3c"},{name:"source",sid:"-fkbi3c"})}=e,o=function(e){if(c=t,s=e,ae.call(c,s)){var r=t[e],o=i({and:[{source:n,greedy:!0,filter:r=>"object"==typeof r&&null!==r&&e in r}],or:{name:"hasTargetKey",sid:"-cov4g4"}});a({and:[{greedy:!0,clock:o,fn:r=>r[e],target:r}],or:{sid:"lpn34j"}})}var c,s};for(var c in t)o(c);return n}function ce(e){var{effect:r,defaultValue:t="initial"}=e,n=o(t,{name:"$status",sid:"abrgim"});return n.on(r,(()=>"pending")).on(r.done,(()=>"done")).on(r.fail,(()=>"fail")),n}function se(e){var{source:n,timeout:c,target:s=r({name:"target",sid:"r328r6"},{name:"target",sid:"r328r6"})}=e;if(!t.unit(n))throw new TypeError("source must be unit from effector");var d=function(e){if(t.store(e,{sid:"-hl6vqh"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error('timeout must be positive number or zero. Received: "'.concat(e,'"'));return o(e,{and:{name:"$timeout"},sid:"pu8pon"})}throw new TypeError('timeout parameter should be number or Store. "'.concat(typeof e,'" was passed'))}(c),f=u((e=>new Promise((r=>setTimeout(r,e)))),{name:"timerFx",sid:"-pyjx8k"}),m=i({and:[{clock:n,filter:f.pending.map((e=>!e))}],or:{name:"start",sid:"-p67kgr"}});return a({and:[{source:d,clock:m,target:f}],or:{sid:"-ievrvf"}}),a({and:[{source:n,clock:f.done,target:s}],or:{sid:"-i01buo"}}),s}var ue=()=>Date.now();function de(e){var{clock:r,getNow:t,initial:n}=e,o=null!=t?t:ue,a=u(o,{name:"readNowFx",sid:"459ysb"}),i=p(a,null!=n?n:o(),{name:"$time",sid:"-ys9vce"});return f({and:{from:r,to:a},or:{sid:"rdje9v"}}),i}export{v as and,h as combineEvents,b as condition,k as debounce,z as debug,_ as delay,M as either,K as empty,V as equals,G as every,H as format,Q as inFlight,U as interval,W as not,X as or,Z as pending,ee as reset,re as reshape,te as snapshot,ne as some,oe as splitMap,ie as spread,ce as status,se as throttle,de 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 c,split as u,createEffect as s,attach as d,createNode as f,step as l,clearNode as m,forward as v,restore as p}from"effector";function g(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];return e({and:[n,e=>{for(var r of e)if(!r)return!1;return!0}],or:{sid:"-rbm5ks"}})}function y(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 h(e,r,n){return(r=function(e){var r=function(e,r){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var t=n.call(e,r||"default");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function b(e){var{events:u,reset:s,target:d=r({name:"target",sid:"3pez5"},{name:"target",sid:"3pez5"})}=e;return n.unit(d)||w("target should be a unit"),s&&!n.unit(s)&&w("reset should be a unit"),t(d,(()=>{var e=Object.keys(u),r=Array.isArray(u)?[...e].fill(""):{},n=o(e.length,{and:{serialize:"ignore"},name:"$counter",sid:"-dszn9a"}),t=o(r,{and:{serialize:"ignore"},name:"$results",sid:"boz3x7"});n.reset(a({and:[{source:d}],or:{sid:"-8yzcn6"}})),t.reset(d),s&&(n.reset(a({and:[{source:s}],or:{sid:"-72suil"}})),t.reset(s));var f=function(e){var r=o(!1,{and:{serialize:"ignore"},name:"$isDone",sid:"ucs7nc"}).on(u[e],(()=>!0)).reset(d);s&&r.reset(s),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?y(Object(n),!0).forEach((function(r){h(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}({},r);return t[e]=n,t}))};for(var l of e)f(l);i({and:[{source:a({and:[{source:t,clock:c(Object.values(u),{name:"clock",sid:"-5k316x"})}],or:{name:"source",sid:"uf92v9"}}),filter:n.map((e=>0===e)),target:d}],or:{sid:"ciekm0"}})})),d}function w(e){throw new Error(e)}function j(e){var{if:t,then:o,else:a,source:c=r({name:"source",sid:"epke23"},{name:"source",sid:"epke23"})}=e,s=n.unit(t)||"function"==typeof t?t:e=>e===t;return o&&a?u({and:[{source:c,match:{then:s,else:k(s)},cases:{then:o,else:a}}],or:{sid:"9tug3k"}}):o?i({and:[{source:c,filter:s,target:o}],or:{sid:"abznoh"}}):a&&i({and:[{source:c,filter:k(s),target:a}],or:{sid:"-eb29qp"}}),c}function k(e){return n.unit(e)?e.map((e=>!e)):r=>!e(r)}function O(e){var{source:t,timeout:u,target:f}=e;if(!n.unit(t))throw new TypeError("source must be unit from effector");if(n.domain(t,{sid:"jnxv16"}))throw new TypeError("source cannot be domain");var l=function(e){if(n.store(e,{sid:"-16ec8q"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error('timeout must be positive number or zero. Received: "'.concat(e,'"'));return o(e,{and:{name:"$timeout"},sid:"-xo2xu0"})}throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}(u),m=r({name:"saveTimeoutId",sid:"f7vear"}),v=o(null,{and:{serialize:"ignore"},name:"$timeoutId",sid:"-50jqki"}).on(m,((e,r)=>r)),p=r({name:"saveReject",sid:"-5595t"}),g=o(null,{and:{serialize:"ignore"},name:"$rejecter",sid:"u7x1h9"}).on(p,((e,r)=>r)),y=null!=f?f:r({name:"tick",sid:"-6fizi7"}),h=s((e=>{var{timeout:r,timeoutId:n,rejectPromise:t}=e;return n&&clearTimeout(n),t&&t(),new Promise(((e,n)=>{p(n),m(setTimeout(e,r))}))}),{name:"timerBaseFx",sid:"-ww7mc3"}),b=d({and:{source:{timeoutId:v,rejectPromise:g},mapParams:(e,r)=>{var{timeoutId:n,rejectPromise:t}=r;return{timeout:e,timeoutId:n,rejectPromise:t}},effect:h},or:{name:"timerFx",sid:"-4ab544"}});g.reset(b.done),v.reset(b.done);var w=o(null,{and:{serialize:"ignore"},name:"$payload",sid:"-5sqiq6"}).on(t,((e,r)=>r)),j=o(!0,{and:{serialize:"ignore"},name:"$canTick",sid:"-ytfpys"}),k=r({name:"triggerTick",sid:"aamdmm"});j.on(k,(()=>!1)).on([y,l,b],(()=>!0));var O=c([t,l],{name:"requestTick",sid:"-8mwak3"});return i({and:[{clock:O,filter:j,target:k}],or:{sid:"-2h4urv"}}),a({and:[{source:l,clock:k,target:b}],or:{sid:"-22aer4"}}),a({and:[{source:w,clock:b.done,target:y}],or:{sid:"-1nfyqd"}}),y}function E(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){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?E(Object(n),!0).forEach((function(r){T(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function T(e,r,n){return(r=function(e){var r=function(e,r){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var t=n.call(e,r||"default");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var z={trace:!1,handler:e=>{var{scope:r,scopeName:n,name:t,kind:o,value:a,loc:i,trace:c,node:u,logType:s}=e,d=r?" (scope: ".concat(n,")"):"",f=null!=t?t:i?"".concat(i.file,":").concat(i.line,":").concat(i.column):"",l="initial"===s?" [getState]":"";console.info("[".concat(o,"]").concat(d," ").concat(f).concat(l),a),c&&c.length>0&&!K(u)&&(console.groupCollapsed("[".concat(o,"]").concat(d," ").concat(f," trace")),c.forEach((e=>{var{name:r,kind:n,value:t,loc:o}=e,a=null!=r?r:o?"".concat(o.file,":").concat(o.line,":").concat(o.column):"";console.info("<- [".concat(n,"] ").concat(a),t)})),console.groupEnd())}};function S(){var{config:e,units:r}=D(...arguments);r.forEach((r=>{n.store(r,{sid:"-fst7ky"})||n.event(r,{sid:"7emphc"})||n.effect(r,{sid:"7emqx0"})?A(r,e):n.domain(r,{sid:"8cpxi6"})&&x(r,e)}))}function x(e,r){e.onCreateStore((e=>A(e,r))),e.onCreateEvent((e=>A(e,r))),e.onCreateEffect((e=>A(e,r))),e.onCreateDomain((e=>x(e,r)))}function A(e,r){n.store(e,{sid:"vrzjgo"})?(!function(e,r){if(!r.handler)throw Error("patronum/debug must have the handler");var n={logType:"initial",scope:null,scopeName:null,node:U(e),kind:V(e),value:e.getState(),name:J(e),loc:Q(e),trace:[]};r.handler(n),M.forEach((n=>q(e,r,n))),C((n=>q(e,r,n)))}(e,r),$(e,r)):n.event(e,{sid:"2i5ewx"})?$(e,r):n.effect(e,{sid:"3g8npb"})&&($(e,r),$(e.done,r),$(e.fail,r))}function $(e,r){var n=f({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[l.run({fn(n,t,o){var a,i=null!==(a=null==o?void 0:o.scope)&&void 0!==a?a:null;i&&!M.get(i)&&M.save(i);var c={logType:"update",scope:i,scopeName:_(i),node:U(e),kind:V(e),value:n,name:J(e),loc:Q(e),trace:r.trace?N(o):[]};if(!r.handler)throw Error("patronum/debug must have the handler");r.handler(c)}})]});return()=>m(n)}function N(e){for(var r=[],n=null==e?void 0:e.parent;n;){var{node:t,value:o}=n,a={node:t,value:o,name:J(t),loc:Q(t),kind:V(t)};r.push(a),n=n.parent}return r}function q(e,r,n){if(!r.handler)throw Error("patronum/debug must have the handler");var t=U(e),o={logType:"initial",scope:n,scopeName:_(n),node:t,kind:V(e),value:n.getState(e),name:J(e),loc:Q(e),trace:[]};r.handler(o)}function D(){for(var e=z,r=arguments.length,t=new Array(r),o=0;o<r;o++)t[o]=arguments[o];var[a,...i]=t,c=[];if(F(a))e=P(P({},z),a);else if(n.unit(a))c.push(a);else for(var[u,s]of Object.entries(a))H.set(G(s).id,u),c.push(s);for(var d of i)if(n.unit(d))c.push(d);else for(var[f,l]of Object.entries(d))H.set(G(l).id,f),c.push(l);return{config:e,units:c}}function F(e){return!n.unit(e)&&!Object.values(e).every(n.unit)}var I=new Set,C=e=>(I.add(e),()=>{I.delete(e)});var R=new Map,B=0;var M={save(e,r){M.get(e)||R.set(e,null!=r?r:{name:"unknown_".concat(B+=1)})},get(e){var r;return e&&null!==(r=R.get(e))&&void 0!==r?r:null},delete(e){R.delete(e)},forEach(e){R.forEach(((r,n)=>e(n,r)))},clear(){R.clear()}};function _(e){if(!e)return null;var r=M.get(e);return r?r.name:null}function K(e){var r=U(e),{sid:n,named:t}=r.meta;return Boolean(!n&&("finally"===t||"done"===t||"doneData"===t||"fail"===t||"failData"===t||"inFlight"===t||"pending"===t))}function V(e){if(n.store(e,{sid:"-652k3k"}))return"store";if(n.effect(e,{sid:"462kf7"})||K(e))return"effect";if(n.event(e,{sid:"47py7a"}))return"event";if(n.domain(e,{sid:"49dbzd"}))return"domain";if(n.unit(e))return"unit";var r=U(e);return r.meta.op?r.meta.op:"unknown"}S.registerScope=function(e,r){return M.save(e,{name:r.name}),I.forEach((r=>r(e))),()=>{M.delete(e)}},S.unregisterAllScopes=function(){M.clear()};var G=e=>e.graphite||e,H=new Map;function J(e){var r,t,o=H.get(G(e).id);if(o)return o;if(K(e)){var a=U(e),i=a.family.owners.find((e=>"effect"===e.meta.op));if(i){var c=L(i),u=c?"".concat(c,"/"):"";return"".concat(u).concat(J(i),".").concat(a.meta.named)}return a.meta.named}if(function(e){var r=U(e),{op:n}=r.meta;return"on"===n}(e)){var s=U(e),d=J(s.next[0]),f=J(s.family.owners[0]);return"".concat(d,".on(").concat(f,")")}if(n.unit(e)){var l;if(null!=e&&null!==(l=e.compositeName)&&void 0!==l&&l.fullName)return e.compositeName.fullName;var m=L(e),v=m?"".concat(m,"/"):"";if(null!=e&&e.shortName)return"".concat(v).concat(e.shortName);if(null!=e&&e.name)return"".concat(v).concat(e.name)}return null!==(r=U(e))&&void 0!==r&&null!==(t=r.meta)&&void 0!==t&&t.name?U(e).meta.name:null}function L(e){var r=U(e).family.owners.find((e=>"domain"===e.meta.op));return r?J(r):null}function Q(e){var r=function(e){var{meta:r}=e;return"config"in r?r.config.loc:r.loc}(U(e));if(r)return r}function U(e){return"graphite"in e?e.graphite:e}function W(t){var{source:o,timeout:i,target:c=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(c))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),d=s((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:d}],or:{sid:"-wmj29s"}}),v({and:{from:d.doneData,to:c},or:{sid:"-vsadmx"}}),c}function X(r,t,o){if(n.store(r,{sid:"ozzvoc"}))return e({and:[r,t,o,(e,r,n)=>e?r:n],or:{sid:"-5vau2h"}});var a=r;return X(a.filter,a.then,a.other)}function Y(e){return e.map((e=>null===e))}function Z(r,n){return e({and:[r,n,(e,r)=>e===r],or:{sid:"-pqjlti"}})}function ee(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 c=e({and:[a],or:{name:"$values",sid:"h09uhg"}});return e({and:[o,c,(e,r)=>r.every(e)],or:{sid:"hfkdw9"}})}function re(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(te(r,o)?t:"".concat(t).concat(ne(e[o])))),"")],or:{sid:"-yrbthp"}})}function ne(e){return Array.isArray(e)?e.map((e=>String(e))).join(", "):String(e)}function te(e,r){return r===e.length-1}function oe(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 ae(e){var{timeout:t,start:c,stop:u,leading:s=!1,trailing:f=!1}=e,l=r({name:"tick",sid:"u782pl"}),m=o(!1,{name:"$isRunning",sid:"-xegewf"}),v=function(e){if(n.store(e,{sid:"7icamc"}))return e;if("number"==typeof e)return o(e,{and:{name:"$timeout"},sid:"knc3em"});throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}(t),p=m.map((e=>!e)),g=r({name:"saveTimeout",sid:"ab3q7d"}),y=o(null,{name:"$timeoutId",sid:"-aj5rja"}).on(g,((e,r)=>{var{timeoutId:n}=r;return n})),h=o((()=>{}),{name:"$rejecter",sid:"opb0ih"}).on(g,((e,r)=>{var{reject:n}=r;return n})),b=d({and:{source:{timeout:v,running:m},effect:e=>{var{timeout:r,running:n}=e;return n?new Promise(((e,n)=>{var t=setTimeout(e,r);g({timeoutId:t,reject:n})})):Promise.reject()}},or:{name:"timeoutFx",sid:"9hil7b"}}),w=d({and:{source:{timeoutId:y,rejecter:h},effect:e=>{var{timeoutId:r,rejecter:n}=e;n(),r&&clearTimeout(r)}},or:{name:"cleanupFx",sid:"-v02m7d"}});if(i({and:[{clock:c,source:v,filter:p,target:b}],or:{sid:"-vop0ii"}}),s){var j=i({and:[{clock:c,filter:p}],or:{name:"onReady",sid:"-cmw7lh"}});a({and:[{clock:j,target:l}],or:{sid:"-v876ny"}})}return a({and:[{clock:c,fn:()=>!0,target:m}],or:{sid:"-v6jsxl"}}),i({and:[{clock:b.done,source:v,filter:m,target:b}],or:{sid:"-urpcwu"}}),i({and:[{clock:b.done,filter:m,target:l.prepend((()=>{}))}],or:{sid:"-ucb4aq"}}),u&&(f&&a({and:[{clock:u,target:l}],or:{sid:"6lcn0o"}}),m.on(u,(()=>!1)),a({and:[{clock:u,target:w}],or:{sid:"71ao6f"}})),{tick:l,isRunning:m}}function ie(e){return e.map((e=>!e))}function ce(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];return e({and:[n,e=>{for(var r of e)if(r)return!0;return!1}],or:{sid:"-44722k"}})}var ue={some:e=>e.some(Boolean),every:e=>e.every(Boolean)};function se(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:[],c=ue[a];return o&&(i=[],o.onCreateEffect((e=>i.push(e)))),e({and:[i.map((e=>e.pending)),c],or:{sid:"a37bj0"}})}function de(e){var{clock:r,target:n}=e,t=Array.isArray(n)?n:[n],o=Array.isArray(r)?r:[r];t.forEach((e=>{e.reset(o)}))}function fe(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 le(e){var{source:r,clock:n,fn:t=(e=>e)}=e,i=t(r.defaultState),c=a(n?{and:[{source:r,clock:n,fn:t}],or:{name:"onSnapshot",sid:"-auitd0"}}:{and:[{source:r,fn:t}],or:{name:"onSnapshot",sid:"-auiql4"}}),u=o(i,{name:"$snapshot",sid:"-7zyoaf"});return u.on(c,((e,r)=>r)),u}function me(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 c=e({and:[a],or:{name:"$values",sid:"-lv5do0"}});return e({and:[o,c,(e,r)=>r.some(e)],or:{sid:"-efc5w7"}})}function ve(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}var pe={}.hasOwnProperty;function ge(e){var{targets:n,source:t=r({name:"source",sid:"-fkbi3c"},{name:"source",sid:"-fkbi3c"})}=e,o=function(e){if(c=n,u=e,pe.call(c,u)){var r=n[e],o=i({and:[{source:t,greedy:!0,filter:r=>"object"==typeof r&&null!==r&&e in r}],or:{name:"hasTargetKey",sid:"-cov4g4"}});a({and:[{greedy:!0,clock:o,fn:r=>r[e],target:r}],or:{sid:"lpn34j"}})}var c,u};for(var c in n)o(c);return t}function ye(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 he(e){var{source:t,timeout:c,target:u=r({name:"target",sid:"r328r6"},{name:"target",sid:"r328r6"})}=e;if(!n.unit(t))throw new TypeError("source must be unit from effector");var d=function(e){if(n.store(e,{sid:"-h0ap6r"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error('timeout must be positive number or zero. Received: "'.concat(e,'"'));return o(e,{and:{name:"$timeout"},sid:"-h97n10"})}throw new TypeError('timeout parameter should be number or Store. "'.concat(typeof e,'" was passed'))}(c),f=s((e=>new Promise((r=>setTimeout(r,e)))),{name:"timerFx",sid:"-pyjx8k"}),l=o(null,{and:{serialize:"ignore"},name:"$payload",sid:"hinjft"}).on(t,((e,r)=>r)),m=r({name:"triggerTick",sid:"-sf8sou"}),v=o(!0,{and:{serialize:"ignore"},name:"$canTick",sid:"-m0cqc"}).on(m,(()=>!1)).on(u,(()=>!0));return i({and:[{clock:t,filter:v,target:m}],or:{sid:"-hzhj9b"}}),a({and:[{source:d,clock:m,target:f}],or:{sid:"-hkn38k"}}),a({and:[{source:l,clock:f.done,target:u}],or:{sid:"-hhcboe"}}),u}var be=()=>Date.now();function we(e){var{clock:r,getNow:n,initial:t}=e,o=null!=n?n:be,a=s(o,{name:"readNowFx",sid:"459ysb"}),i=p(a,null!=t?t:o(),{name:"$time",sid:"-ys9vce"});return v({and:{from:r,to:a},or:{sid:"rdje9v"}}),i}export{g as and,b as combineEvents,j as condition,O as debounce,S as debug,W as delay,X as either,Y as empty,Z as equals,ee as every,re as format,oe as inFlight,ae as interval,ie as not,ce as or,se as pending,de as reset,fe as reshape,le as snapshot,me as some,ve as splitMap,ge as spread,ye as status,he as throttle,we 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){Object.defineProperty(t,"__esModule",{value:!0}),t.and=function(...e){return(0,r.default.combine)({and:[e,e=>{for(const t of e)if(!t)return!1;return!0}],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,{and:{serialize:"ignore"},name:"$counter",sid:"-dszn9a"}),u=(0,r.default.createStore)(a,{and:{serialize:"ignore"},name:"$results",sid:"boz3x7"});i.reset((0,r.default.sample)({and:[{source:o}],or:{sid:"-8yzcn6"}})),u.reset(o),t&&(i.reset((0,r.default.sample)({and:[{source:t}],or:{sid:"-72suil"}})),u.reset(t));for(const a of n){const n=(0,r.default.createStore)(!1,{and:{serialize:"ignore"},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:[{source:u,clock:(0,r.default.merge)(Object.values(e),{name:"clock",sid:"-5k316x"})}],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:"jne2ft"}))throw new TypeError("source cannot be domain");const o=function(e){if(r.default.is.store(e,{sid:"-2xmoh9"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error(`timeout must be positive number or zero. Received: "${e}"`);return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"-757cx6"})}throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(t),a=(0,r.default.createEvent)({name:"saveTimeoutId",sid:"eqtrwk"}),i=(0,r.default.createStore)(null,{and:{serialize:"ignore"},name:"$timeoutId",sid:"-5hlcyp"}).on(a,((e,t)=>t)),u=(0,r.default.createEvent)({name:"saveReject",sid:"-m6vk0"}),s=(0,r.default.createStore)(null,{and:{serialize:"ignore"},name:"$rejecter",sid:"tqvf32"}).on(u,((e,t)=>t)),d=null!=n?n:(0,r.default.createEvent)({name:"tick",sid:"-6wklwe"}),c=(0,r.default.createEffect)((({parameter:e,timeout:t,timeoutId:n,rejectPromise:r})=>(n&&clearTimeout(n),r&&r(),new Promise(((n,r)=>{u(r),a(setTimeout(n,t,e))})))),{name:"timerBaseFx",sid:"-xd98qa"}),f=(0,r.default.attach)({and:{source:{timeoutId:i,rejectPromise:s},mapParams:({parameter:e,timeout:t},{timeoutId:n,rejectPromise:r})=>({parameter:e,timeout:t,timeoutId:n,rejectPromise:r}),effect:c},or:{name:"timerFx",sid:"-4ab544"}});return s.reset(f.done),i.reset(f.done),(0,r.default.sample)({and:[{source:o,clock:e,fn:(e,t)=>({timeout:e,parameter:t}),target:f}],or:{sid:"m29k3f"}}),(0,r.default.forward)({and:{from:f.done.map((({result:e})=>e)),to:d},or:{sid:"-32ktwy"}}),d}})),d=o((function(e,t){function n(...e){let t={trace:!1};const[n,...o]=e;if(function(e){return!r.default.is.unit(e)&&!Object.values(e).every(r.default.is.unit)}(n))t=n;else if(r.default.is.unit(n))f(n);else for(const[e,r]of Object.entries(n))s.set(y(r).id,e),f(r,t);for(const e of o)if(r.default.is.unit(e))f(e,t);else for(const[n,r]of Object.entries(e))s.set(y(r).id,n),f(r,t)}function o(e){return r.default.is.store(e,{sid:"-h7y2t9"})?"store":r.default.is.effect(e,{sid:"-h6ap16"})?"effect":r.default.is.event(e,{sid:"-h4nb93"})?"event":r.default.is.domain(e,{sid:"-grg90f"})?"domain":r.default.is.unit(e)?"unit":"unknown"}Object.defineProperty(t,"__esModule",{value:!0}),t.debug=n;const a=[];function i(e,t,n=""){const o=n+d(e);r.default.is.store(e,{sid:"-g609vc"})&&(p({type:t,name:o,value:e.getState()}),b.forEach(((n,r)=>{p({type:t,name:o,scopeName:r.name,value:n.getState(e)})})),a.push(e)),(0,r.default.createNode)({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[r.default.step.run({fn(e,n,r){if(r.scope){b.get(r.scope)||b.save(r.scope);const n=b.get(r.scope);p({type:t,name:o,scopeName:n?.name,value:e})}else p({type:t,name:o,value:e})}})]})}function u(e){i(e.done,"effect",d(e)+"."),i(e.fail,"effect",d(e)+".")}const s=new Map;function d(e){const t=s.get(y(e).id);return t||(e.compositeName&&e.compositeName.fullName?e.compositeName.fullName:e.shortName?e.shortName:e.name?e.name:"")}function c(e){var t;const n=function({meta:e}){return"config"in e?e.config.loc:e.loc}(e);return n?`${null!==(t=n.file)&&void 0!==t?t:""}:${n.line}:${n.column}`:null}function f(e,t){const n=o(e);(r.default.is.store(e,{sid:"zfed9z"})||r.default.is.effect(e,{sid:"wsoi2z"})||r.default.is.event(e,{sid:"wsojji"}))&&(i(e,n),t?.trace&&m(e)),r.default.is.effect(e,{sid:"-zhbby9"})&&u(e),r.default.is.domain(e,{sid:"-p5meu5"})&&(e.onCreateEvent((e=>{i(e,"event"),t?.trace&&m(e)})),e.onCreateStore((e=>{i(e,"store"),t?.trace&&m(e)})),e.onCreateEffect((e=>{i(e,"effect"),u(e),t?.trace&&m(e)})))}function l(e){if(!e)return"";const{meta:t,id:n}=e,r=s.get(n);if(r)return r;if(!function(e){const t=function(e){return"graphite"in e?e.graphite:e}(e),{sid:n,named:r}=t.meta;return Boolean(!n&&("finally"===r||"done"===r||"doneData"===r||"fail"===r||"failData"===r||"inFlight"===r||"pending"===r))}(e))return t.name;const o=e.family.owners.find((e=>"effect"===e.meta.op));return o?`${l(o)}.${t.named}`:t.named}function m(e){const t=o(e),n=d(e);(0,r.default.createNode)({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[r.default.step.run({fn(e,r,o){let a=o?.parent;const i=b.get(o?.scope),u=i?` (scope: ${i.name})`:"",s=`[${t}]${u} ${n} trace`;for(console.groupCollapsed(s);a;){const{node:e,value:t}=a,{meta:n}=e;let r=n.op,o=l(e);var d;if(!o)o=null!==(d=c(e))&&void 0!==d?d:"";if("on"===r){const t=l(e.next[0]);r=`${t}.${n.op}`,o=`${t}.${n.op}(${l(a.parent?.node)})`}console.info(`<- [${r}] ${o}`,t),a=a.parent}console.groupEnd()}})]})}function p({type:e,scopeName:t,name:n,value:r}){const o=`[${e}]`,a=t?` (scope: ${t})`:"",i=` ${n}`;console.info(`${o}${a}${i}`,r)}n.registerScope=function(e,t){return b.save(e,{name:t.name}),a.forEach((n=>{p({type:"store",name:d(n),scopeName:t.name,value:e.getState(n)})})),()=>{b.delete(e)}},n.unregisterAllScopes=function(){b.clear()};const y=e=>e.graphite||e,v=new Map;let g=0;const b={save(e,t){b.get(e)||v.set(e,null!=t?t:{name:(g+=1,`unknown_scope_${g}`)})},get(e){var t;return e&&null!==(t=v.get(e))&&void 0!==t?t:null},delete(e){v.delete(e)},forEach(e){v.forEach(((t,n)=>e(n,t)))},clear(){v.clear()}}})),c=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.either=function e(t,n,o){if(r.default.is.store(t,{sid:"ozzvoc"}))return(0,r.default.combine)({and:[t,n,o,(e,t,n)=>e?t:n],or:{sid:"-5vau2h"}});const a=t;return e(a.filter,a.then,a.other)}})),l=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.empty=function(e){return e.map((e=>null===e))}})),m=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:"-pqjlti"}})}})),p=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"}})}})),y=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"}})}})),v=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"}})}})),g=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:"u782pl"}),u=(0,r.default.createStore)(!1,{name:"$isRunning",sid:"-xegewf"}),s=function(e){if(r.default.is.store(e,{sid:"7icamc"}))return e;if("number"==typeof e)return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"knc3em"});throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(e),d=u.map((e=>!e)),c=(0,r.default.createEvent)({name:"saveTimeout",sid:"ab3q7d"}),f=(0,r.default.createStore)(null,{name:"$timeoutId",sid:"-aj5rja"}).on(c,((e,{timeoutId:t})=>t)),l=(0,r.default.createStore)((()=>{}),{name:"$rejecter",sid:"opb0ih"}).on(c,((e,{reject:t})=>t)),m=(0,r.default.attach)({and:{source:{timeout:s,running:u},effect:({timeout:e,running:t})=>t?new Promise(((t,n)=>{const r=setTimeout(t,e);c({timeoutId:r,reject:n})})):Promise.reject()},or:{name:"timeoutFx",sid:"9hil7b"}}),p=(0,r.default.attach)({and:{source:{timeoutId:f,rejecter:l},effect:({timeoutId:e,rejecter:t})=>{t(),e&&clearTimeout(e)}},or:{name:"cleanupFx",sid:"-v02m7d"}});if((0,r.default.guard)({and:[{clock:t,source:s,filter:d,target:m}],or:{sid:"-vop0ii"}}),o){const e=(0,r.default.guard)({and:[{clock:t,filter:d}],or:{name:"onReady",sid:"-cmw7lh"}});(0,r.default.sample)({and:[{clock:e,target:i}],or:{sid:"-v876ny"}})}(0,r.default.sample)({and:[{clock:t,fn:()=>!0,target:u}],or:{sid:"-v6jsxl"}}),(0,r.default.guard)({and:[{clock:m.done,source:s,filter:u,target:m}],or:{sid:"-urpcwu"}}),(0,r.default.guard)({and:[{clock:m.done,filter:u,target:i.prepend((()=>{}))}],or:{sid:"-ucb4aq"}}),n&&(a&&(0,r.default.sample)({and:[{clock:n,target:i}],or:{sid:"6lcn0o"}}),u.on(n,(()=>!1)),(0,r.default.sample)({and:[{clock:n,target:p}],or:{sid:"71ao6f"}}));return{tick:i,isRunning:u}}})),b=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.not=function(e){return e.map((e=>!e))}})),h=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=function(...e){return(0,r.default.combine)({and:[e,e=>{for(const t of e)if(t)return!0;return!1}],or:{sid:"-44722k"}})}})),w=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=null!=e?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)}})),j=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(r)}))}})),_=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:[{source:e,clock:t,fn:n}],or:{name:"onSnapshot",sid:"-auitd0"}}):(0,r.default.sample)({and:[{source:e,fn:n}],or:{name:"onSnapshot",sid:"-auiql4"}}),i=(0,r.default.createStore)(o,{name:"$snapshot",sid:"-7zyoaf"});return i.on(a,((e,t)=>t)),i}})),k=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"}})}})),E=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:"-fkbi3c"})}){for(const i in e)if(o=e,a=i,n.call(o,a)){const n=e[i],o=(0,r.default.guard)({and:[{source:t,greedy:!0,filter:e=>"object"==typeof e&&null!==e&&i in e}],or:{name:"hasTargetKey",sid:"-cov4g4"}});(0,r.default.sample)({and:[{greedy:!0,clock:o,fn:e=>e[i],target:n}],or:{sid:"lpn34j"}})}var o,a;return t};const n={}.hasOwnProperty})),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:"r328r6"})}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");const o=function(e){if(r.default.is.store(e,{sid:"-hl6vqh"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error(`timeout must be positive number or zero. Received: "${e}"`);return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"pu8pon"})}throw new TypeError(`timeout parameter should be number or Store. "${typeof e}" was passed`)}(t),a=(0,r.default.createEffect)((e=>new Promise((t=>setTimeout(t,e)))),{name:"timerFx",sid:"-pyjx8k"}),i=(0,r.default.guard)({and:[{clock:e,filter:a.pending.map((e=>!e))}],or:{name:"start",sid:"-p67kgr"}});return(0,r.default.sample)({and:[{source:o,clock:i,target:a}],or:{sid:"-ievrvf"}}),(0,r.default.sample)({and:[{source:e,clock:a.done,target:n}],or:{sid:"-i01buo"}}),n}})),S=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.time=function({clock:e,getNow:t,initial:o}){const a=null!=t?t:n,i=(0,r.default.createEffect)(a,{name:"readNowFx",sid:"459ysb"}),u=(0,r.default.restore)(i,null!=o?o:a(),{name:"$time",sid:"-ys9vce"});return(0,r.default.forward)({and:{from:e,to:i},or:{sid:"rdje9v"}}),u};const n=()=>Date.now()})),x=a.and,z=i.combineEvents,T=u.condition,A=s.debounce,q=d.debug,N=c.delay,F=f.either,I=l.empty,R=m.equals,C=p.every,D=y.format,B=v.inFlight,K=g.interval,V=b.not,G=h.or,H=w.pending,J=j.reset,L=_.reshape,Q=$.snapshot,U=k.some,W=E.splitMap,X=P.spread,Y=M.status,Z=O.throttle,ee=S.time,te={and:x,combineEvents:z,condition:T,debounce:A,debug:q,delay:N,either:F,empty:I,equals:R,every:C,format:D,inFlight:B,interval:K,not:V,or:G,pending:H,reset:J,reshape:L,snapshot:Q,some:U,splitMap:W,spread:X,status:Y,throttle:Z,time:ee};e.and=x,e.combineEvents=z,e.condition=T,e.debounce=A,e.debug=q,e.default=te,e.delay=N,e.either=F,e.empty=I,e.equals=R,e.every=C,e.format=D,e.inFlight=B,e.interval=K,e.not=V,e.or=G,e.pending=H,e.reset=J,e.reshape=L,e.snapshot=Q,e.some=U,e.splitMap=W,e.spread=X,e.status=Y,e.throttle=Z,e.time=ee,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=>{for(const t of e)if(!t)return!1;return!0}],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,{and:{serialize:"ignore"},name:"$counter",sid:"-dszn9a"}),u=(0,r.default.createStore)(a,{and:{serialize:"ignore"},name:"$results",sid:"boz3x7"});i.reset((0,r.default.sample)({and:[{source:o}],or:{sid:"-8yzcn6"}})),u.reset(o),t&&(i.reset((0,r.default.sample)({and:[{source:t}],or:{sid:"-72suil"}})),u.reset(t));for(const a of n){const n=(0,r.default.createStore)(!1,{and:{serialize:"ignore"},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:[{source:u,clock:(0,r.default.merge)(Object.values(e),{name:"clock",sid:"-5k316x"})}],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:"jnxv16"}))throw new TypeError("source cannot be domain");const o=function(e){if(r.default.is.store(e,{sid:"-16ec8q"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error(`timeout must be positive number or zero. Received: "${e}"`);return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"-xo2xu0"})}throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(t),a=(0,r.default.createEvent)({name:"saveTimeoutId",sid:"f7vear"}),i=(0,r.default.createStore)(null,{and:{serialize:"ignore"},name:"$timeoutId",sid:"-50jqki"}).on(a,((e,t)=>t)),u=(0,r.default.createEvent)({name:"saveReject",sid:"-5595t"}),s=(0,r.default.createStore)(null,{and:{serialize:"ignore"},name:"$rejecter",sid:"u7x1h9"}).on(u,((e,t)=>t)),d=null!=n?n:(0,r.default.createEvent)({name:"tick",sid:"-6fizi7"}),c=(0,r.default.createEffect)((({timeout:e,timeoutId:t,rejectPromise:n})=>(t&&clearTimeout(t),n&&n(),new Promise(((t,n)=>{u(n),a(setTimeout(t,e))})))),{name:"timerBaseFx",sid:"-ww7mc3"}),l=(0,r.default.attach)({and:{source:{timeoutId:i,rejectPromise:s},mapParams:(e,{timeoutId:t,rejectPromise:n})=>({timeout:e,timeoutId:t,rejectPromise:n}),effect:c},or:{name:"timerFx",sid:"-4ab544"}});s.reset(l.done),i.reset(l.done);const f=(0,r.default.createStore)(null,{and:{serialize:"ignore"},name:"$payload",sid:"-5sqiq6"}).on(e,((e,t)=>t)),m=(0,r.default.createStore)(!0,{and:{serialize:"ignore"},name:"$canTick",sid:"-ytfpys"}),p=(0,r.default.createEvent)({name:"triggerTick",sid:"aamdmm"});m.on(p,(()=>!1)).on([d,o,l],(()=>!0));const g=(0,r.default.merge)([e,o],{name:"requestTick",sid:"-8mwak3"});return(0,r.default.guard)({and:[{clock:g,filter:m,target:p}],or:{sid:"-2h4urv"}}),(0,r.default.sample)({and:[{source:o,clock:p,target:l}],or:{sid:"-22aer4"}}),(0,r.default.sample)({and:[{source:f,clock:l.done,target:d}],or:{sid:"-1nfyqd"}}),d}})),d=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.debug=o;const n={trace:!1,handler:e=>{const{scope:t,scopeName:n,name:r,kind:o,value:a,loc:i,trace:u,node:s,logType:d}=e,c=t?` (scope: ${n})`:"",l=null!=r?r:i?`${i.file}:${i.line}:${i.column}`:"",f="initial"===d?" [getState]":"";console.info(`[${o}]${c} ${l}${f}`,a),u&&u.length>0&&!h(s)&&(console.groupCollapsed(`[${o}]${c} ${l} trace`),u.forEach((e=>{const{name:t,kind:n,value:r,loc:o}=e,a=null!=t?t:o?`${o.file}:${o.line}:${o.column}`:"";console.info(`<- [${n}] ${a}`,r)})),console.groupEnd())}};function o(...e){const{config:t,units:o}=function(...e){let t=n;const[o,...a]=e,i=[];if(function(e){if(!r.default.is.unit(e))return!Object.values(e).every(r.default.is.unit);return!1}(o))t={...n,...o};else if(r.default.is.unit(o))i.push(o);else for(const[e,t]of Object.entries(o))b.set(v(t).id,e),i.push(t);for(const e of a)if(r.default.is.unit(e))i.push(e);else for(const[t,n]of Object.entries(e))b.set(v(n).id,t),i.push(n);return{config:t,units:i}}(...e);o.forEach((e=>{r.default.is.store(e,{sid:"-fst7ky"})||r.default.is.event(e,{sid:"7emphc"})||r.default.is.effect(e,{sid:"7emqx0"})?i(e,t):r.default.is.domain(e,{sid:"8cpxi6"})&&a(e,t)}))}function a(e,t){e.onCreateStore((e=>i(e,t))),e.onCreateEvent((e=>i(e,t))),e.onCreateEffect((e=>i(e,t))),e.onCreateDomain((e=>a(e,t)))}function i(e,t){r.default.is.store(e,{sid:"vrzjgo"})?(!function(e,t){if(!t.handler)throw Error("patronum/debug must have the handler");const n={logType:"initial",scope:null,scopeName:null,node:$(e),kind:y(e),value:e.getState(),name:w(e),loc:k(e),trace:[]};t.handler(n),p.forEach((n=>d(e,t,n))),l((n=>d(e,t,n)))}(e,t),u(e,t)):r.default.is.event(e,{sid:"2i5ewx"})?u(e,t):r.default.is.effect(e,{sid:"3g8npb"})&&(u(e,t),u(e.done,t),u(e.fail,t))}function u(e,t){const n=(0,r.default.createNode)({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[r.default.step.run({fn(n,r,o){var a;const i=null!==(a=o?.scope)&&void 0!==a?a:null;i&&!p.get(i)&&p.save(i);const u={logType:"update",scope:i,scopeName:g(i),node:$(e),kind:y(e),value:n,name:w(e),loc:k(e),trace:t.trace?s(o):[]};if(!t.handler)throw Error("patronum/debug must have the handler");t.handler(u)}})]});return()=>(0,r.default.clearNode)(n)}function s(e){const t=[];let n=e?.parent;for(;n;){const{node:e,value:r}=n,o={node:e,value:r,name:w(e),loc:k(e),kind:y(e)};t.push(o),n=n.parent}return t}function d(e,t,n){if(!t.handler)throw Error("patronum/debug must have the handler");const r=$(e),o={logType:"initial",scope:n,scopeName:g(n),node:r,kind:y(e),value:n.getState(e),name:w(e),loc:k(e),trace:[]};t.handler(o)}const c=new Set,l=e=>(c.add(e),()=>{c.delete(e)});const f=new Map;let m=0;const p={save(e,t){p.get(e)||f.set(e,null!=t?t:{name:(m+=1,`unknown_${m}`)})},get(e){var t;return e&&null!==(t=f.get(e))&&void 0!==t?t:null},delete(e){f.delete(e)},forEach(e){f.forEach(((t,n)=>e(n,t)))},clear(){f.clear()}};function g(e){if(!e)return null;const t=p.get(e);return t?t.name:null}function h(e){const t=$(e),{sid:n,named:r}=t.meta;return Boolean(!n&&("finally"===r||"done"===r||"doneData"===r||"fail"===r||"failData"===r||"inFlight"===r||"pending"===r))}function y(e){if(r.default.is.store(e,{sid:"-652k3k"}))return"store";if(r.default.is.effect(e,{sid:"462kf7"})||h(e))return"effect";if(r.default.is.event(e,{sid:"47py7a"}))return"event";if(r.default.is.domain(e,{sid:"49dbzd"}))return"domain";if(r.default.is.unit(e))return"unit";const t=$(e);return t.meta.op?t.meta.op:"unknown"}o.registerScope=function(e,t){return p.save(e,{name:t.name}),c.forEach((t=>t(e))),()=>{p.delete(e)}},o.unregisterAllScopes=function(){p.clear()};const v=e=>e.graphite||e,b=new Map;function w(e){const t=b.get(v(e).id);if(t)return t;if(h(e)){const t=$(e),n=t.family.owners.find((e=>"effect"===e.meta.op));if(n){const e=j(n);return`${e?`${e}/`:""}${w(n)}.${t.meta.named}`}return t.meta.named}if(function(e){const t=$(e),{op:n}=t.meta;return"on"===n}(e)){const t=$(e);return`${w(t.next[0])}.on(${w(t.family.owners[0])})`}if(r.default.is.unit(e)){if(e?.compositeName?.fullName)return e.compositeName.fullName;const t=j(e),n=t?`${t}/`:"";if(e?.shortName)return`${n}${e.shortName}`;if(e?.name)return`${n}${e.name}`}return $(e)?.meta?.name?$(e).meta.name:null}function j(e){const t=$(e).family.owners.find((e=>"domain"===e.meta.op));return t?w(t):null}function k(e){const t=function({meta:e}){return"config"in e?e.config.loc:e.loc}($(e));if(t)return t}function $(e){return"graphite"in e?e.graphite:e}})),c=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}})),l=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.either=function e(t,n,o){if(r.default.is.store(t,{sid:"ozzvoc"}))return(0,r.default.combine)({and:[t,n,o,(e,t,n)=>e?t:n],or:{sid:"-5vau2h"}});const a=t;return e(a.filter,a.then,a.other)}})),f=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.empty=function(e){return e.map((e=>null===e))}})),m=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:"-pqjlti"}})}})),p=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"}})}})),g=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"}})}})),h=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"}})}})),y=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:"u782pl"}),u=(0,r.default.createStore)(!1,{name:"$isRunning",sid:"-xegewf"}),s=function(e){if(r.default.is.store(e,{sid:"7icamc"}))return e;if("number"==typeof e)return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"knc3em"});throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(e),d=u.map((e=>!e)),c=(0,r.default.createEvent)({name:"saveTimeout",sid:"ab3q7d"}),l=(0,r.default.createStore)(null,{name:"$timeoutId",sid:"-aj5rja"}).on(c,((e,{timeoutId:t})=>t)),f=(0,r.default.createStore)((()=>{}),{name:"$rejecter",sid:"opb0ih"}).on(c,((e,{reject:t})=>t)),m=(0,r.default.attach)({and:{source:{timeout:s,running:u},effect:({timeout:e,running:t})=>t?new Promise(((t,n)=>{const r=setTimeout(t,e);c({timeoutId:r,reject:n})})):Promise.reject()},or:{name:"timeoutFx",sid:"9hil7b"}}),p=(0,r.default.attach)({and:{source:{timeoutId:l,rejecter:f},effect:({timeoutId:e,rejecter:t})=>{t(),e&&clearTimeout(e)}},or:{name:"cleanupFx",sid:"-v02m7d"}});if((0,r.default.guard)({and:[{clock:t,source:s,filter:d,target:m}],or:{sid:"-vop0ii"}}),o){const e=(0,r.default.guard)({and:[{clock:t,filter:d}],or:{name:"onReady",sid:"-cmw7lh"}});(0,r.default.sample)({and:[{clock:e,target:i}],or:{sid:"-v876ny"}})}(0,r.default.sample)({and:[{clock:t,fn:()=>!0,target:u}],or:{sid:"-v6jsxl"}}),(0,r.default.guard)({and:[{clock:m.done,source:s,filter:u,target:m}],or:{sid:"-urpcwu"}}),(0,r.default.guard)({and:[{clock:m.done,filter:u,target:i.prepend((()=>{}))}],or:{sid:"-ucb4aq"}}),n&&(a&&(0,r.default.sample)({and:[{clock:n,target:i}],or:{sid:"6lcn0o"}}),u.on(n,(()=>!1)),(0,r.default.sample)({and:[{clock:n,target:p}],or:{sid:"71ao6f"}}));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))}})),b=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=function(...e){return(0,r.default.combine)({and:[e,e=>{for(const t of e)if(t)return!0;return!1}],or:{sid:"-44722k"}})}})),w=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=null!=e?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)}})),j=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(r)}))}})),k=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:[{source:e,clock:t,fn:n}],or:{name:"onSnapshot",sid:"-auitd0"}}):(0,r.default.sample)({and:[{source:e,fn:n}],or:{name:"onSnapshot",sid:"-auiql4"}}),i=(0,r.default.createStore)(o,{name:"$snapshot",sid:"-7zyoaf"});return i.on(a,((e,t)=>t)),i}})),_=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"}})}})),E=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:"-fkbi3c"})}){for(const i in e)if(o=e,a=i,n.call(o,a)){const n=e[i],o=(0,r.default.guard)({and:[{source:t,greedy:!0,filter:e=>"object"==typeof e&&null!==e&&i in e}],or:{name:"hasTargetKey",sid:"-cov4g4"}});(0,r.default.sample)({and:[{greedy:!0,clock:o,fn:e=>e[i],target:n}],or:{sid:"lpn34j"}})}var o,a;return t};const n={}.hasOwnProperty})),S=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}})),M=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:"r328r6"})}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");const o=function(e){if(r.default.is.store(e,{sid:"-h0ap6r"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error(`timeout must be positive number or zero. Received: "${e}"`);return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"-h97n10"})}throw new TypeError(`timeout parameter should be number or Store. "${typeof e}" was passed`)}(t),a=(0,r.default.createEffect)((e=>new Promise((t=>setTimeout(t,e)))),{name:"timerFx",sid:"-pyjx8k"}),i=(0,r.default.createStore)(null,{and:{serialize:"ignore"},name:"$payload",sid:"hinjft"}).on(e,((e,t)=>t)),u=(0,r.default.createEvent)({name:"triggerTick",sid:"-sf8sou"}),s=(0,r.default.createStore)(!0,{and:{serialize:"ignore"},name:"$canTick",sid:"-m0cqc"}).on(u,(()=>!1)).on(n,(()=>!0));return(0,r.default.guard)({and:[{clock:e,filter:s,target:u}],or:{sid:"-hzhj9b"}}),(0,r.default.sample)({and:[{source:o,clock:u,target:a}],or:{sid:"-hkn38k"}}),(0,r.default.sample)({and:[{source:i,clock:a.done,target:n}],or:{sid:"-hhcboe"}}),n}})),O=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.time=function({clock:e,getNow:t,initial:o}){const a=null!=t?t:n,i=(0,r.default.createEffect)(a,{name:"readNowFx",sid:"459ysb"}),u=(0,r.default.restore)(i,null!=o?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,x=i.combineEvents,z=u.condition,q=s.debounce,A=d.debug,F=c.delay,N=l.either,I=f.empty,C=m.equals,D=p.every,R=g.format,B=h.inFlight,K=y.interval,V=v.not,G=b.or,H=w.pending,J=j.reset,L=k.reshape,Q=$.snapshot,U=_.some,W=E.splitMap,X=P.spread,Y=S.status,Z=M.throttle,ee=O.time,te={and:T,combineEvents:x,condition:z,debounce:q,debug:A,delay:F,either:N,empty:I,equals:C,every:D,format:R,inFlight:B,interval:K,not:V,or:G,pending:H,reset:J,reshape:L,snapshot:Q,some:U,splitMap:W,spread:X,status:Y,throttle:Z,time:ee};e.and=T,e.combineEvents=x,e.condition=z,e.debounce=q,e.debug=A,e.default=te,e.delay=F,e.either=N,e.empty=I,e.equals=C,e.every=D,e.format=R,e.inFlight=B,e.interval=K,e.not=V,e.or=G,e.pending=H,e.reset=J,e.reshape=L,e.snapshot=Q,e.some=U,e.splitMap=W,e.spread=X,e.status=Y,e.throttle=Z,e.time=ee,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=patronum.umd.js.map

@@ -18,3 +18,2 @@ import { combine, is } from 'effector';

var strategy = strategies[of];
if (domain) {

@@ -24,3 +23,2 @@ effects = [];

}
return combine({

@@ -27,0 +25,0 @@ and: [effects.map(fx => fx.pending), strategy],

@@ -7,3 +7,2 @@ export function reshape(_ref) {

var result = {};
for (var key in shape) {

@@ -20,4 +19,3 @@ if (key in shape) {

}
return result;
}
import { combine, is } from 'effector';
export function some(configOrStores, predicateOrNone) {
var stores = [];
var predicate = () => false;
if (Array.isArray(configOrStores)) {

@@ -14,5 +12,3 @@ stores = configOrStores;

}
var checker;
if (isFunction(predicate)) {

@@ -27,3 +23,2 @@ checker = predicate;

}
var $values = combine({

@@ -35,4 +30,4 @@ and: [stores],

}
}); // Combine pass simple values as is
});
// Combine pass simple values as is
var $checker = checker;

@@ -46,5 +41,4 @@ return combine({

}
function isFunction(value) {
return typeof value === 'function';
}

@@ -12,3 +12,2 @@ import { is } from 'effector';

}) ? source.updates : source;
for (var key in cases) {

@@ -24,7 +23,7 @@ if (key in cases) {

}
} // eslint-disable-next-line no-underscore-dangle
}
// eslint-disable-next-line no-underscore-dangle
result.__ = current;
return result;
}
import { createEvent, guard, sample } from 'effector';
var hasPropBase = {}.hasOwnProperty;
var hasOwnProp = (object, key) => hasPropBase.call(object, key);
/**

@@ -24,3 +22,2 @@ * @example

} = _ref;
var _loop = function _loop(targetKey) {

@@ -53,8 +50,6 @@ if (hasOwnProp(targets, targetKey)) {

};
for (var targetKey in targets) {
_loop(targetKey);
}
return source;
}

@@ -20,10 +20,30 @@ import { createEffect, createEvent, createStore, guard, is, sample } from 'effector';

});
var start = guard({
// It's ok - nothing will ever start unless source is triggered
var $payload = createStore(null, {
and: {
serialize: 'ignore'
},
name: "$payload",
sid: "hinjft"
}).on(source, (_, payload) => payload);
var triggerTick = createEvent({
name: "triggerTick",
sid: "-sf8sou"
});
var $canTick = createStore(true, {
and: {
serialize: 'ignore'
},
name: "$canTick",
sid: "-m0cqc"
}).on(triggerTick, () => false).on(target, () => true);
guard({
and: [{
clock: source,
filter: timerFx.pending.map(pending => !pending)
filter: $canTick,
target: triggerTick
}],
or: {
name: "start",
sid: "-p67kgr"
sid: "-hzhj9b"
}

@@ -34,7 +54,7 @@ });

source: $timeout,
clock: start,
clock: triggerTick,
target: timerFx
}],
or: {
sid: "-ievrvf"
sid: "-hkn38k"
}

@@ -44,3 +64,3 @@ });

and: [{
source,
source: $payload,
clock: timerFx.done,

@@ -50,3 +70,3 @@ target

or: {
sid: "-i01buo"
sid: "-hhcboe"
}

@@ -56,8 +76,6 @@ });

}
function toStoreNumber(value) {
if (is.store(value, {
sid: "-hl6vqh"
sid: "-h0ap6r"
})) return value;
if (typeof value === 'number') {

@@ -69,7 +87,6 @@ if (value < 0 || !Number.isFinite(value)) throw new Error("timeout must be positive number or zero. Received: \"".concat(value, "\""));

},
sid: "pu8pon"
sid: "-h97n10"
});
}
throw new TypeError("timeout parameter should be number or Store. \"".concat(typeof value, "\" was passed"));
}
import { createEffect, forward, restore } from 'effector';
var defaultNow = () => Date.now();
export function time(_ref) {

@@ -6,0 +4,0 @@ var {

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

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

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

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

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