rubico 2.3.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/_internal/arrayMapSeries.js +4 -4
- package/_internal/findAllFilePaths.js +2 -4
- package/dist/Transducer.es.js +2 -2
- package/dist/Transducer.es.min.js +2 -2
- package/dist/Transducer.js +2 -2
- package/dist/Transducer.min.js +2 -2
- package/dist/Transducer.mjs +2 -2
- package/dist/__.es.js +2 -2
- package/dist/__.es.min.js +2 -2
- package/dist/__.js +2 -2
- package/dist/__.min.js +2 -2
- package/dist/__.mjs +2 -2
- package/dist/all.es.js +2 -2
- package/dist/all.es.min.js +2 -2
- package/dist/all.js +2 -2
- package/dist/all.min.js +2 -2
- package/dist/all.mjs +2 -2
- package/dist/always.es.js +2 -2
- package/dist/always.es.min.js +2 -2
- package/dist/always.js +2 -2
- package/dist/always.min.js +2 -2
- package/dist/always.mjs +2 -2
- package/dist/and.es.js +2 -2
- package/dist/and.es.min.js +2 -2
- package/dist/and.js +2 -2
- package/dist/and.min.js +2 -2
- package/dist/and.mjs +2 -2
- package/dist/assign.es.js +2 -2
- package/dist/assign.es.min.js +2 -2
- package/dist/assign.js +2 -2
- package/dist/assign.min.js +2 -2
- package/dist/assign.mjs +2 -2
- package/dist/compose.es.js +2 -2
- package/dist/compose.es.min.js +2 -2
- package/dist/compose.js +2 -2
- package/dist/compose.min.js +2 -2
- package/dist/compose.mjs +2 -2
- package/dist/curry.es.js +2 -2
- package/dist/curry.es.min.js +2 -2
- package/dist/curry.js +2 -2
- package/dist/curry.min.js +2 -2
- package/dist/curry.mjs +2 -2
- package/dist/eq.es.js +2 -2
- package/dist/eq.es.min.js +2 -2
- package/dist/eq.js +2 -2
- package/dist/eq.min.js +2 -2
- package/dist/eq.mjs +2 -2
- package/dist/every.es.js +2 -2
- package/dist/every.es.min.js +2 -2
- package/dist/every.js +2 -2
- package/dist/every.min.js +2 -2
- package/dist/every.mjs +2 -2
- package/dist/filter.es.js +2 -2
- package/dist/filter.es.min.js +2 -2
- package/dist/filter.js +2 -2
- package/dist/filter.min.js +2 -2
- package/dist/filter.mjs +2 -2
- package/dist/flatMap.es.js +2 -2
- package/dist/flatMap.es.min.js +2 -2
- package/dist/flatMap.js +2 -2
- package/dist/flatMap.min.js +2 -2
- package/dist/flatMap.mjs +2 -2
- package/dist/forEach.es.js +2 -2
- package/dist/forEach.es.min.js +2 -2
- package/dist/forEach.js +2 -2
- package/dist/forEach.min.js +2 -2
- package/dist/forEach.mjs +2 -2
- package/dist/get.es.js +6 -6
- package/dist/get.es.min.js +3 -3
- package/dist/get.js +6 -6
- package/dist/get.min.js +3 -3
- package/dist/get.mjs +6 -6
- package/dist/gt.es.js +2 -2
- package/dist/gt.es.min.js +2 -2
- package/dist/gt.js +2 -2
- package/dist/gt.min.js +2 -2
- package/dist/gt.mjs +2 -2
- package/dist/gte.es.js +2 -2
- package/dist/gte.es.min.js +2 -2
- package/dist/gte.js +2 -2
- package/dist/gte.min.js +2 -2
- package/dist/gte.mjs +2 -2
- package/dist/lt.es.js +2 -2
- package/dist/lt.es.min.js +2 -2
- package/dist/lt.js +2 -2
- package/dist/lt.min.js +2 -2
- package/dist/lt.mjs +2 -2
- package/dist/lte.es.js +2 -2
- package/dist/lte.es.min.js +2 -2
- package/dist/lte.js +2 -2
- package/dist/lte.min.js +2 -2
- package/dist/lte.mjs +2 -2
- package/dist/map.es.js +4 -4
- package/dist/map.es.min.js +3 -3
- package/dist/map.js +4 -4
- package/dist/map.min.js +3 -3
- package/dist/map.mjs +4 -4
- package/dist/not.es.js +2 -2
- package/dist/not.es.min.js +2 -2
- package/dist/not.js +2 -2
- package/dist/not.min.js +2 -2
- package/dist/not.mjs +2 -2
- package/dist/omit.es.js +2 -2
- package/dist/omit.es.min.js +2 -2
- package/dist/omit.js +2 -2
- package/dist/omit.min.js +2 -2
- package/dist/omit.mjs +2 -2
- package/dist/or.es.js +2 -2
- package/dist/or.es.min.js +2 -2
- package/dist/or.js +2 -2
- package/dist/or.min.js +2 -2
- package/dist/or.mjs +2 -2
- package/dist/pick.es.js +2 -2
- package/dist/pick.es.min.js +2 -2
- package/dist/pick.js +2 -2
- package/dist/pick.min.js +2 -2
- package/dist/pick.mjs +2 -2
- package/dist/pipe.es.js +2 -2
- package/dist/pipe.es.min.js +2 -2
- package/dist/pipe.js +2 -2
- package/dist/pipe.min.js +2 -2
- package/dist/pipe.mjs +2 -2
- package/dist/reduce.es.js +2 -2
- package/dist/reduce.es.min.js +2 -2
- package/dist/reduce.js +2 -2
- package/dist/reduce.min.js +2 -2
- package/dist/reduce.mjs +2 -2
- package/dist/rubico.es.js +8 -8
- package/dist/rubico.es.min.js +3 -3
- package/dist/rubico.global.js +8 -8
- package/dist/rubico.global.min.js +3 -3
- package/dist/rubico.js +8 -8
- package/dist/rubico.min.js +3 -3
- package/dist/rubico.mjs +8 -8
- package/dist/set.es.js +2 -2
- package/dist/set.es.min.js +2 -2
- package/dist/set.js +2 -2
- package/dist/set.min.js +2 -2
- package/dist/set.mjs +2 -2
- package/dist/some.es.js +2 -2
- package/dist/some.es.min.js +2 -2
- package/dist/some.js +2 -2
- package/dist/some.min.js +2 -2
- package/dist/some.mjs +2 -2
- package/dist/switchCase.es.js +2 -2
- package/dist/switchCase.es.min.js +2 -2
- package/dist/switchCase.js +2 -2
- package/dist/switchCase.min.js +2 -2
- package/dist/switchCase.mjs +2 -2
- package/dist/tap.es.js +2 -2
- package/dist/tap.es.min.js +2 -2
- package/dist/tap.js +2 -2
- package/dist/tap.min.js +2 -2
- package/dist/tap.mjs +2 -2
- package/dist/thunkify.es.js +2 -2
- package/dist/thunkify.es.min.js +2 -2
- package/dist/thunkify.js +2 -2
- package/dist/thunkify.min.js +2 -2
- package/dist/thunkify.mjs +2 -2
- package/dist/transform.es.js +2 -2
- package/dist/transform.es.min.js +2 -2
- package/dist/transform.js +2 -2
- package/dist/transform.min.js +2 -2
- package/dist/transform.mjs +2 -2
- package/dist/tryCatch.es.js +2 -2
- package/dist/tryCatch.es.min.js +2 -2
- package/dist/tryCatch.js +2 -2
- package/dist/tryCatch.min.js +2 -2
- package/dist/tryCatch.mjs +2 -2
- package/dist/x/append.es.js +2 -2
- package/dist/x/append.es.min.js +2 -2
- package/dist/x/append.js +2 -2
- package/dist/x/append.min.js +2 -2
- package/dist/x/append.mjs +2 -2
- package/dist/x/callProp.es.js +2 -2
- package/dist/x/callProp.es.min.js +2 -2
- package/dist/x/callProp.js +2 -2
- package/dist/x/callProp.min.js +2 -2
- package/dist/x/callProp.mjs +2 -2
- package/dist/x/defaultsDeep.es.js +2 -2
- package/dist/x/defaultsDeep.es.min.js +2 -2
- package/dist/x/defaultsDeep.js +2 -2
- package/dist/x/defaultsDeep.min.js +2 -2
- package/dist/x/defaultsDeep.mjs +2 -2
- package/dist/x/differenceWith.es.js +2 -2
- package/dist/x/differenceWith.es.min.js +2 -2
- package/dist/x/differenceWith.js +2 -2
- package/dist/x/differenceWith.min.js +2 -2
- package/dist/x/differenceWith.mjs +2 -2
- package/dist/x/filterOut.es.js +2 -2
- package/dist/x/filterOut.es.min.js +2 -2
- package/dist/x/filterOut.js +2 -2
- package/dist/x/filterOut.min.js +2 -2
- package/dist/x/filterOut.mjs +2 -2
- package/dist/x/find.es.js +2 -2
- package/dist/x/find.es.min.js +2 -2
- package/dist/x/find.js +2 -2
- package/dist/x/find.min.js +2 -2
- package/dist/x/find.mjs +2 -2
- package/dist/x/findIndex.es.js +2 -2
- package/dist/x/findIndex.es.min.js +2 -2
- package/dist/x/findIndex.js +2 -2
- package/dist/x/findIndex.min.js +2 -2
- package/dist/x/findIndex.mjs +2 -2
- package/dist/x/first.es.js +2 -2
- package/dist/x/first.es.min.js +2 -2
- package/dist/x/first.js +2 -2
- package/dist/x/first.min.js +2 -2
- package/dist/x/first.mjs +2 -2
- package/dist/x/flatten.es.js +2 -2
- package/dist/x/flatten.es.min.js +2 -2
- package/dist/x/flatten.js +2 -2
- package/dist/x/flatten.min.js +2 -2
- package/dist/x/flatten.mjs +2 -2
- package/dist/x/groupBy.es.js +2 -2
- package/dist/x/groupBy.es.min.js +2 -2
- package/dist/x/groupBy.js +2 -2
- package/dist/x/groupBy.min.js +2 -2
- package/dist/x/groupBy.mjs +2 -2
- package/dist/x/has.es.js +2 -2
- package/dist/x/has.es.min.js +2 -2
- package/dist/x/has.js +2 -2
- package/dist/x/has.min.js +2 -2
- package/dist/x/has.mjs +2 -2
- package/dist/x/identity.es.js +2 -2
- package/dist/x/identity.es.min.js +2 -2
- package/dist/x/identity.js +2 -2
- package/dist/x/identity.min.js +2 -2
- package/dist/x/identity.mjs +2 -2
- package/dist/x/includes.es.js +2 -2
- package/dist/x/includes.es.min.js +2 -2
- package/dist/x/includes.js +2 -2
- package/dist/x/includes.min.js +2 -2
- package/dist/x/includes.mjs +2 -2
- package/dist/x/isDeepEqual.es.js +2 -2
- package/dist/x/isDeepEqual.es.min.js +2 -2
- package/dist/x/isDeepEqual.js +2 -2
- package/dist/x/isDeepEqual.min.js +2 -2
- package/dist/x/isDeepEqual.mjs +2 -2
- package/dist/x/isEmpty.es.js +2 -2
- package/dist/x/isEmpty.es.min.js +2 -2
- package/dist/x/isEmpty.js +2 -2
- package/dist/x/isEmpty.min.js +2 -2
- package/dist/x/isEmpty.mjs +2 -2
- package/dist/x/isEqual.es.js +2 -2
- package/dist/x/isEqual.es.min.js +2 -2
- package/dist/x/isEqual.js +2 -2
- package/dist/x/isEqual.min.js +2 -2
- package/dist/x/isEqual.mjs +2 -2
- package/dist/x/isFunction.es.js +2 -2
- package/dist/x/isFunction.es.min.js +2 -2
- package/dist/x/isFunction.js +2 -2
- package/dist/x/isFunction.min.js +2 -2
- package/dist/x/isFunction.mjs +2 -2
- package/dist/x/isIn.es.js +2 -2
- package/dist/x/isIn.es.min.js +2 -2
- package/dist/x/isIn.js +2 -2
- package/dist/x/isIn.min.js +2 -2
- package/dist/x/isIn.mjs +2 -2
- package/dist/x/isObject.es.js +2 -2
- package/dist/x/isObject.es.min.js +2 -2
- package/dist/x/isObject.js +2 -2
- package/dist/x/isObject.min.js +2 -2
- package/dist/x/isObject.mjs +2 -2
- package/dist/x/isString.es.js +2 -2
- package/dist/x/isString.es.min.js +2 -2
- package/dist/x/isString.js +2 -2
- package/dist/x/isString.min.js +2 -2
- package/dist/x/isString.mjs +2 -2
- package/dist/x/keys.es.js +2 -2
- package/dist/x/keys.es.min.js +2 -2
- package/dist/x/keys.js +2 -2
- package/dist/x/keys.min.js +2 -2
- package/dist/x/keys.mjs +2 -2
- package/dist/x/last.es.js +2 -2
- package/dist/x/last.es.min.js +2 -2
- package/dist/x/last.js +2 -2
- package/dist/x/last.min.js +2 -2
- package/dist/x/last.mjs +2 -2
- package/dist/x/maxBy.es.js +6 -6
- package/dist/x/maxBy.es.min.js +3 -3
- package/dist/x/maxBy.js +6 -6
- package/dist/x/maxBy.min.js +3 -3
- package/dist/x/maxBy.mjs +6 -6
- package/dist/x/noop.es.js +2 -2
- package/dist/x/noop.es.min.js +2 -2
- package/dist/x/noop.js +2 -2
- package/dist/x/noop.min.js +2 -2
- package/dist/x/noop.mjs +2 -2
- package/dist/x/pluck.es.js +8 -8
- package/dist/x/pluck.es.min.js +3 -3
- package/dist/x/pluck.js +8 -8
- package/dist/x/pluck.min.js +3 -3
- package/dist/x/pluck.mjs +8 -8
- package/dist/x/prepend.es.js +2 -2
- package/dist/x/prepend.es.min.js +2 -2
- package/dist/x/prepend.js +2 -2
- package/dist/x/prepend.min.js +2 -2
- package/dist/x/prepend.mjs +2 -2
- package/dist/x/size.es.js +2 -2
- package/dist/x/size.es.min.js +2 -2
- package/dist/x/size.js +2 -2
- package/dist/x/size.min.js +2 -2
- package/dist/x/size.mjs +2 -2
- package/dist/x/trace.es.js +2 -2
- package/dist/x/trace.es.min.js +2 -2
- package/dist/x/trace.js +2 -2
- package/dist/x/trace.min.js +2 -2
- package/dist/x/trace.mjs +2 -2
- package/dist/x/unionWith.es.js +2 -2
- package/dist/x/unionWith.es.min.js +2 -2
- package/dist/x/unionWith.js +2 -2
- package/dist/x/unionWith.min.js +2 -2
- package/dist/x/unionWith.mjs +2 -2
- package/dist/x/uniq.es.js +2 -2
- package/dist/x/uniq.es.min.js +2 -2
- package/dist/x/uniq.js +2 -2
- package/dist/x/uniq.min.js +2 -2
- package/dist/x/uniq.mjs +2 -2
- package/dist/x/unless.es.js +2 -2
- package/dist/x/unless.es.min.js +2 -2
- package/dist/x/unless.js +2 -2
- package/dist/x/unless.min.js +2 -2
- package/dist/x/unless.mjs +2 -2
- package/dist/x/values.es.js +2 -2
- package/dist/x/values.es.min.js +2 -2
- package/dist/x/values.js +2 -2
- package/dist/x/values.min.js +2 -2
- package/dist/x/values.mjs +2 -2
- package/dist/x/when.es.js +2 -2
- package/dist/x/when.es.min.js +2 -2
- package/dist/x/when.js +2 -2
- package/dist/x/when.min.js +2 -2
- package/dist/x/when.mjs +2 -2
- package/es.js +8 -8
- package/get.js +4 -4
- package/index.js +8 -8
- package/map.d.ts +2 -2
- package/package.json +1 -1
package/dist/rubico.es.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.3.
|
|
2
|
+
* rubico v2.3.2
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
|
-
* (c) 2019-
|
|
4
|
+
* (c) 2019-2024 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
6
6
|
*/
|
|
7
|
-
const isPromise=r=>null!=r&&"function"==typeof r.then,areAnyValuesPromises=function(r){const e=r.length;let t=-1;for(;++t<e;){const e=r[t];if(isPromise(e))return!0}return!1},promiseAll=Promise.all.bind(Promise),funcConcat=(r,e)=>function(...t){const n=r(...t);return isPromise(n)?n.then(e):e(n)},funcApply=(r,e)=>r(...e),__=Symbol.for("placeholder"),curry2ResolveArg0=(r,e)=>function(t){return r(t,e)},curry2ResolveArg1=(r,e)=>function(t){return r(e,t)},curry2=function(r,e,t){return e==__?curry2ResolveArg0(r,t):curry2ResolveArg1(r,e)},pipe=function(...r){const e=r.pop().reduce(funcConcat);return 0==r.length?e:areAnyValuesPromises(r)?promiseAll(r).then(curry2(funcApply,e,__)):e(...r)},compose=function(...r){const e=r.pop().reduceRight(funcConcat);return 0==r.length?e:areAnyValuesPromises(r)?promiseAll(r).then(curry2(funcApply,e,__)):e(...r)},always=r=>function(){return r},thunkifyArgs=(r,e)=>function(){return r(...e)},thunkConditional=(r,e,t)=>r?e():t(),curry3ResolveArg0=(r,e,t)=>function(n){return r(n,e,t)},curry3ResolveArg1=(r,e,t)=>function(n){return r(e,n,t)},curry3ResolveArg2=(r,e,t)=>function(n){return r(e,t,n)},curry3=function(r,e,t,n){return e==__?curry3ResolveArg0(r,t,n):t==__?curry3ResolveArg1(r,e,n):curry3ResolveArg2(r,e,t)},curryArgs2ResolveArgs0=(r,e,t)=>function(...t){return r(t,e)},curryArgs2ResolveArgs1=(r,e,t)=>function(...t){return r(e,t)},curryArgs2=function(r,e,t){return e==__?curryArgs2ResolveArgs0(r,t):curryArgs2ResolveArgs1(r,e)},_tap=function(r,e){const t=r[0],n=e(...r);return isPromise(n)?n.then(always(t)):t},tap=function(...r){const e=r.pop();return 0==r.length?curryArgs2(_tap,__,e):_tap(r,e)};tap.if=(r,e)=>function(...t){const n=r(...t);if(isPromise(n))return n.then(curry3(thunkConditional,__,thunkifyArgs(tap(e),t),always(t[0])));if(n){const r=e(...t);if(isPromise(r))return r.then(always(t[0]))}return t[0]};const isArray=Array.isArray,functionArrayAll=function(r,e){const t=r.length,n=Array(t);let o=-1,s=!1;for(;++o<t;){const t=r[o](...e);isPromise(t)&&(s=!0),n[o]=t}return s?promiseAll(n):n},curry4ResolveArg0=(r,e,t,n)=>function(o){return r(o,e,t,n)},curry4ResolveArg1=(r,e,t,n)=>function(o){return r(e,o,t,n)},curry4ResolveArg2=(r,e,t,n)=>function(o){return r(e,t,o,n)},curry4ResolveArg3=(r,e,t,n)=>function(o){return r(e,t,n,o)},curry4=function(r,e,t,n,o){return e==__?curry4ResolveArg0(r,t,n,o):t==__?curry4ResolveArg1(r,e,n,o):n==__?curry4ResolveArg2(r,e,t,o):curry4ResolveArg3(r,e,t,n)},objectSet=function(r,e,t){return r[e]=t,r},asyncFunctionArrayAllSeries=async function(r,e,t,n){const o=r.length;for(;++n<o;){const o=r[n](...e);t[n]=isPromise(o)?await o:o}return t},functionArrayAllSeries=function(r,e){const t=r.length,n=[];let o=-1;for(;++o<t;){const t=r[o](...e);if(isPromise(t))return t.then(funcConcat(curry3(objectSet,n,o,__),curry4(asyncFunctionArrayAllSeries,r,e,__,o)));n[o]=t}return n},functionObjectAll=function(r,e){const t={},n=[];for(const o in r){const s=r[o](...e);isPromise(s)?n.push(s.then(curry3(objectSet,t,o,__))):t[o]=s}return 0==n.length?t:promiseAll(n).then(always(t))},all=function(...r){const e=r.pop();return 0==r.length?isArray(e)?curryArgs2(functionArrayAll,e,__):curryArgs2(functionObjectAll,e,__):areAnyValuesPromises(r)?isArray(e)?promiseAll(r).then(curry2(functionArrayAll,e,__)):promiseAll(r).then(curry2(functionObjectAll,e,__)):isArray(e)?functionArrayAll(e,r):functionObjectAll(e,r)};all.series=function(...r){const e=r.pop();return 0==r.length?curryArgs2(functionArrayAllSeries,e,__):areAnyValuesPromises(r)?promiseAll(r).then(curry2(functionArrayAllSeries,e,__)):functionArrayAllSeries(e,r)};const objectAssign=Object.assign,_assign=function(r,e){const t=functionObjectAll(e,[r]);return isPromise(t)?t.then(curry3(objectAssign,{},r,__)):{...r,...t}},assign=function(r,e){return null==e?curry2(_assign,__,r):isPromise(r)?r.then(curry2(_assign,__,e)):_assign(r,e)},catcherApply=function(r,e,t){return r(e,...t)},_tryCatch=function(r,e,t){try{const n=r(...t);return isPromise(n)?n.catch(curry3(catcherApply,e,__,t)):n}catch(r){return e(r,...t)}},tryCatch=function(...r){if(r.length>2){const e=r.pop(),t=r.pop();return areAnyValuesPromises(r)?promiseAll(r).then(curry3(_tryCatch,t,e,__)):_tryCatch(t,e,r)}const e=r[0],t=r[1];return function(...r){return _tryCatch(e,t,r)}},thunkify3=(r,e,t,n)=>function(){return r(e,t,n)},arrayConditional=function(r,e,t){const n=r.length-1;for(;(t+=2)<n;){const n=r[t],o=r[t+1],s="function"==typeof n?n(...e):n;if(isPromise(s))return s.then(curry3(thunkConditional,__,"function"==typeof o?thunkifyArgs(o,e):always(o),thunkify3(arrayConditional,r,e,t)));if(s)return"function"==typeof o?o(...e):o}if(t==r.length)return;const o=r[n];return"function"==typeof o?o(...e):o},areAllValuesNonfunctions=function(r){const e=r.length;let t=-1;for(;++t<e;)if("function"==typeof r[t])return!1;return!0},thunkify2=(r,e,t)=>function(){return r(e,t)},nonfunctionsConditional=function(r,e){const t=r.length,n=t-1;for(;(e+=2)<n;){const t=r[e],n=r[e+1];if(isPromise(t))return t.then(curry3(thunkConditional,__,always(n),thunkify2(nonfunctionsConditional,r,e)));if(t)return n}if(e!=t)return r[e]},curryArgs3ResolveArgs0=(r,e,t)=>function(...n){return r(n,e,t)},curryArgs3ResolveArgs1=(r,e,t)=>function(...n){return r(e,n,t)},curryArgs3ResolveArgs2=(r,e,t)=>function(...n){return r(e,t,n)},curryArgs3=function(r,e,t,n){return e==__?curryArgs3ResolveArgs0(r,t,n):t==__?curryArgs3ResolveArgs1(r,e,n):curryArgs3ResolveArgs2(r,e,t)},switchCase=(...r)=>{const e=r.pop();return areAllValuesNonfunctions(e)?nonfunctionsConditional(e,-2):0==r.length?(t=arrayConditional,o=__,s=-2,(n=e)==__?curryArgs3ResolveArgs0(t,o,s):o==__?curryArgs3ResolveArgs1(t,n,s):curryArgs3ResolveArgs2(t,n,o)):areAnyValuesPromises(r)?promiseAll(r).then(curry3(arrayConditional,e,__,-2)):arrayConditional(e,r,-2);var t,n,o,s},symbolIterator=Symbol.iterator,MappingIterator=(r,e)=>({toString:()=>"[object MappingIterator]",[symbolIterator](){return this},next(){const t=r.next();return t.done?t:{value:e(t.value),done:!1}}}),NextIteration=r=>({value:r,done:!1}),symbolAsyncIterator=Symbol.asyncIterator,MappingAsyncIterator=(r,e)=>({[symbolAsyncIterator](){return this},async next(){const t=await r.next();if(t.done)return t;const n=e(t.value);return isPromise(n)?n.then(NextIteration):{value:n,done:!1}}}),isObject=r=>{if(null==r)return!1;const e=typeof r;return"object"==e||"function"==e},arrayMap=function(r,e){const t=r.length,n=Array(t);let o=-1,s=!1;for(;++o<t;){const t=e(r[o],o,r);isPromise(t)&&(s=!0),n[o]=t}return s?promiseAll(n):n},callPropUnary=(r,e,t)=>r[e](t),stringMap=function(r,e){const t=arrayMap(r,e);return isPromise(t)?t.then(curry3(callPropUnary,__,"join","")):t.join("")},setMap=function(r,e){const t=new Set,n=[];for(const o of r){const s=e(o,o,r);isPromise(s)?n.push(s.then(curry3(callPropUnary,t,"add",__))):t.add(s)}return 0==n.length?t:promiseAll(n).then(always(t))},callPropBinary=(r,e,t,n)=>r[e](t,n),mapMap=function(r,e){const t=new Map,n=[];for(const[o,s]of r){const i=e(s,o,r);isPromise(i)?n.push(i.then(curry4(callPropBinary,t,"set",o,__))):t.set(o,i)}return 0==n.length?t:promiseAll(n).then(always(t))},promiseObjectAllExecutor=r=>function(e){const t={};let n=0;for(const o in r){const s=r[o];isPromise(s)?(n+=1,s.then((r=>function(o){t[r]=o,n-=1,0==n&&e(t)})(o))):t[o]=s}0==n&&e(t)},promiseObjectAll=r=>new Promise(promiseObjectAllExecutor(r)),objectMap=function(r,e){const t={};let n=!1;for(const o in r){const s=e(r[o],o,r);isPromise(s)&&(n=!0),t[o]=s}return n?promiseObjectAll(t):t},arrayMapSeriesAsync=async function(r,e,t,n){const o=r.length;for(;++n<o;){const o=e(r[n]);t[n]=isPromise(o)?await o:o}return t},arrayMapSeries=function(r,e){const t=r.length,n=Array(t);let o=-1;for(;++o<t;){const t=e(r[o]);if(isPromise(t))return t.then(funcConcat(curry3(objectSet,n,o,__),curry4(arrayMapSeriesAsync,r,e,__,o)));n[o]=t}return n},tapSync=r=>function(...e){return r(...e),e[0]},promiseRace=Promise.race.bind(Promise),arrayMapPoolAsync=async function(r,e,t,n,o,s){const i=r.length;for(;++o<i;){s.size>=t&&await promiseRace(s);const i=e(r[o]);if(isPromise(i)){const r=i.then(tapSync((()=>s.delete(r))));s.add(r),n[o]=r}else n[o]=i}return promiseAll(n)},arrayMapPool=function(r,e,t){const n=r.length,o=Array(n);let s=-1;for(;++s<n;){const n=e(r[s]);if(isPromise(n)){const i=new Set,c=n.then(tapSync((()=>i.delete(c))));return i.add(c),o[s]=c,arrayMapPoolAsync(r,e,t,o,s,i)}o[s]=n}return o},_curryArity=(r,e,t)=>function(...n){const o=t.length,s=n.length,i=[];let c=-1,u=-1,a=0;for(;++c<o;){const o=t[c];if(o==__&&(u+=1)<s){const r=n[u];r==__&&(a+=1),i.push(r)}else i.push(o);if(i.length==r)return 0==a?e(...i):curryArity(r,e,i)}for(;++u<s;){const t=n[u];if(t==__&&(a+=1),i.push(t),i.length==r)return 0==a?e(...i):curryArity(r,e,i)}return curryArity(r,e,i)},curryArity=function(r,e,t){const n=t.length;if(n<r)return _curryArity(r,e,t);let o=-1;for(;++o<n;){if(t[o]==__)return _curryArity(r,e,t)}return e(...t)},spread2=r=>function([e,t]){return r(e,t)},objectMapEntries=function(r,e){const t={},n=[];for(const o in r){const s=e([o,r[o]]);isPromise(s)?n.push(s.then(spread2(curryArity(3,objectSet,[t])))):t[s[0]]=s[1]}return 0==n.length?t:promiseAll(n).then(always(t))},mapSet=function(r,e,t){return r.set(e,t)},mapMapEntriesForEachCallback=(r,e,t)=>function(n,o){const s=r([o,n]);isPromise(s)?t.push(s.then(spread2(curryArity(3,mapSet,[e])))):e.set(s[0],s[1])},mapMapEntries=function(r,e){const t=new Map,n=[];return r.forEach(mapMapEntriesForEachCallback(e,t,n)),0==n.length?t:promiseAll(n).then(always(t))},_map=function(r,e){return isArray(r)?arrayMap(r,e):null==r?r:"function"==typeof r.then?r.then(e):"function"==typeof r.map?r.map(e):"string"==typeof r||r.constructor==String?stringMap(r,e):r.constructor==Set?setMap(r,e):r.constructor==Map?mapMap(r,e):"function"==typeof r[symbolIterator]?MappingIterator(r[symbolIterator](),e):"function"==typeof r[symbolAsyncIterator]?MappingAsyncIterator(r[symbolAsyncIterator](),e):r.constructor==Object?objectMap(r,e):e(r)},map=(...r)=>{const e=r.pop();if(0==r.length)return curry2(_map,__,e);const t=r[0];return isPromise(t)?t.then(curry2(_map,__,e)):_map(t,e)};map.entries=function(r){return function(e){if(null==e)throw new TypeError("value is not an Object or Map");if(e.constructor==Object)return objectMapEntries(e,r);if(e.constructor==Map)return mapMapEntries(e,r);throw new TypeError("value is not an Object or Map")}},map.series=r=>function(e){if(isArray(e))return arrayMapSeries(e,r);throw new TypeError(`${e} is not an Array`)},map.pool=(r,e)=>function(t){if(isArray(t))return arrayMapPool(t,e,r);throw new TypeError(`${t} is not an Array`)};const FilteringIterator=(r,e)=>({[symbolIterator](){return this},next(){let t=r.next();for(;!t.done;){const{value:n}=t;if(e(n))return{value:n,done:!1};t=r.next()}return t}}),FilteringAsyncIterator=(r,e)=>({isAsyncIteratorDone:!1,[symbolAsyncIterator](){return this},async next(){for(;!this.isAsyncIteratorDone;){const{value:t,done:n}=await r.next();if(n)this.isAsyncIteratorDone=!0;else{const r=e(t);if(isPromise(r)?await r:r)return{value:t,done:!1}}}return{value:void 0,done:!0}}}),arrayExtendMap=function(r,e,t,n){const o=e.length;let s=r.length-1;for(;++n<o;)r[++s]=t(e[n],n,r);return r},arrayFilterByConditions=function(r,e,t,n){const o=r.length;let s=-1;for(;++t<o;)n[++s]&&e.push(r[t]);return e},arrayFilter=function(r,e){const t=r.length,n=[];let o=-1,s=-1;for(;++o<t;){const t=r[o],i=e(t,o,r);if(isPromise(i))return promiseAll(arrayExtendMap([i],r,e,o)).then(curry4(arrayFilterByConditions,r,n,o-1,__));i&&(n[++s]=t)}return n},stringFilter=function(r,e){const t=arrayFilter(r,e);return isPromise(t)?t.then(curry3(callPropUnary,__,"join","")):t.join("")},thunkify1=(r,e)=>function(){return r(e)},noop=function(){},setFilter=function(r,e){const t=new Set,n=t.add.bind(t),o=[];for(const s of r){const i=e(s,s,r);isPromise(i)?o.push(i.then(curry3(thunkConditional,__,thunkify1(n,s),noop))):i&&t.add(s)}return 0==o.length?t:promiseAll(o).then(always(t))},thunkify4=(r,e,t,n,o)=>function(){return r(e,t,n,o)},mapFilter=function(r,e){const t=new Map,n=[];for(const[o,s]of r){const i=e(s,o,r);isPromise(i)?n.push(i.then(curry3(thunkConditional,__,thunkify4(callPropBinary,t,"set",o,s),noop))):i&&t.set(o,s)}return 0==n.length?t:promiseAll(n).then(always(t))},objectSetIf=function(r,e,t,n){n&&(r[e]=t)},objectFilter=function(r,e){const t={},n=[];for(const o in r){const s=r[o],i=e(s,o,r);isPromise(i)?n.push(i.then(curry4(objectSetIf,t,o,r[o],__))):i&&(t[o]=s)}return 0==n.length?t:promiseAll(n).then(always(t))},_filter=function(r,e){return isArray(r)?arrayFilter(r,e):null==r?r:"string"==typeof r||r.constructor==String?stringFilter(r,e):r.constructor==Set?setFilter(r,e):r.constructor==Map?mapFilter(r,e):"function"==typeof r.filter?r.filter(e):"function"==typeof r[symbolIterator]?FilteringIterator(r[symbolIterator](),e):"function"==typeof r[symbolAsyncIterator]?FilteringAsyncIterator(r[symbolAsyncIterator](),e):r.constructor==Object?objectFilter(r,e):r},filter=function(...r){const e=r.pop();return 0==r.length?curry2(_filter,__,e):_filter(r[0],e)},objectValues=Object.values,objectProto=Object.prototype,nativeObjectToString=objectProto.toString,objectToString=r=>nativeObjectToString.call(r),generatorFunctionTag="[object GeneratorFunction]",isGeneratorFunction=r=>objectToString(r)==generatorFunctionTag,asyncGeneratorFunctionTag="[object AsyncGeneratorFunction]",isAsyncGeneratorFunction=r=>objectToString(r)==asyncGeneratorFunctionTag,iteratorReduceAsync=async function(r,e,t){let n=r.next();if(n.done)return t;for(;!n.done;)t=e(t,n.value),isPromise(t)&&(t=await t),n=r.next();return t},iteratorReduce=function(r,e,t){let n=r.next();if(n.done)return t;for(void 0===t&&(t=n.value,n=r.next());!n.done;){if(t=e(t,n.value),isPromise(t))return t.then(curry3(iteratorReduceAsync,r,e,__));n=r.next()}return t},asyncIteratorReduce=async function(r,e,t){let n=await r.next();if(n.done)return t;for(void 0===t&&(t=n.value,n=await r.next());!n.done;)t=await e(t,n.value),n=await r.next();return t},arrayReduceAsync=async function(r,e,t,n){const o=r.length;for(;++n<o;)t=e(t,r[n],n,r),isPromise(t)&&(t=await t);return t},arrayReduce=function(r,e,t){const n=r.length;let o=-1;for(void 0===t&&(t=r[++o]);++o<n;)if(t=e(t,r[o],o,r),isPromise(t))return t.then(curry4(arrayReduceAsync,r,e,__,o));return t},curry5ResolveArg0=(r,e,t,n,o)=>function(s){return r(s,e,t,n,o)},curry5ResolveArg1=(r,e,t,n,o)=>function(s){return r(e,s,t,n,o)},curry5ResolveArg2=(r,e,t,n,o)=>function(s){return r(e,t,s,n,o)},curry5ResolveArg3=(r,e,t,n,o)=>function(s){return r(e,t,n,s,o)},curry5ResolveArg4=(r,e,t,n,o)=>function(s){return r(e,t,n,o,s)},curry5=function(r,e,t,n,o,s){return e==__?curry5ResolveArg0(r,t,n,o,s):t==__?curry5ResolveArg1(r,e,n,o,s):n==__?curry5ResolveArg2(r,e,t,o,s):o==__?curry5ResolveArg3(r,e,t,n,s):curry5ResolveArg4(r,e,t,n,o)},objectKeys=Object.keys,objectReduceAsync=async function(r,e,t,n,o){const s=n.length;for(;++o<s;){const s=n[o];t=e(t,r[s],s,r),isPromise(t)&&(t=await t)}return t},objectReduce=function(r,e,t){const n=objectKeys(r),o=n.length;let s=-1;for(void 0===t&&(t=r[n[++s]]);++s<o;){const o=n[s];if(t=e(t,r[o],o,r),isPromise(t))return t.then((i=objectReduceAsync,u=e,a=__,l=n,y=s,(c=r)==__?curry5ResolveArg0(i,u,a,l,y):u==__?curry5ResolveArg1(i,c,a,l,y):a==__?curry5ResolveArg2(i,c,u,l,y):l==__?curry5ResolveArg3(i,c,u,a,y):curry5ResolveArg4(i,c,u,a,l)))}var i,c,u,a,l,y;return t},mapReduceAsync=async function(r,e,t,n){for(const[o,s]of n)t=e(t,s,o,r),isPromise(t)&&(t=await t);return t},mapReduce=function(r,e,t){const n=r.entries();if(void 0===t){const r=n.next();if(r.done)return t;t=r.value[1]}for(const[o,s]of n)if(t=e(t,s,o,r),isPromise(t))return t.then(curry4(mapReduceAsync,r,e,__,n));return t},reducerConcat=(r,e)=>function(t,n){const o=r(t,n);return isPromise(o)?o.then(curry2(e,__,n)):e(o,n)},genericReduce=function(r,e,t){return isArray(r)?arrayReduce(r,e,t):null==r?void 0===t?curry2(e,r,__):e(t,r):r.constructor==Map?mapReduce(r,e,t):"function"==typeof r[symbolIterator]?iteratorReduce(r[symbolIterator](),e,t):"function"==typeof r[symbolAsyncIterator]?asyncIteratorReduce(r[symbolAsyncIterator](),e,t):"function"==typeof r.reduce?r.reduce(e,t):"function"==typeof r.chain?r.chain(curry2(e,t,__)):"function"==typeof r.flatMap?r.flatMap(curry2(e,t,__)):r.constructor==Object?objectReduce(r,e,t):void 0===t?curry2(e,r,__):e(t,r)},_reduce=function(r,e,t){if("function"==typeof t){const n=t(r);return isPromise(n)?n.then(curry3(genericReduce,r,e,__)):genericReduce(r,e,n)}return isPromise(t)?t.then(curry3(genericReduce,r,e,__)):genericReduce(r,e,t)},reduce=function(...r){return"function"==typeof r[0]?curry3(_reduce,__,r[0],r[1]):isPromise(r[0])?r[0].then(curry3(_reduce,__,r[1],r[2])):_reduce(r[0],r[1],r[2])},isBinary=ArrayBuffer.isView,add=(r,e)=>r+e,_arrayExtend=function(r,e){const t=r.length,n=e.length;let o=-1;for(;++o<n;)r[t+o]=e[o];return r},arrayExtend=function(r,e){return isArray(e)||isBinary(e)?_arrayExtend(r,e):(r.push(e),r)},globalThisHasBuffer="function"==typeof Buffer,bufferAlloc=globalThisHasBuffer?Buffer.alloc:noop,_binaryExtend=function(r,e){const t=r.length,n=globalThisHasBuffer&&r.constructor==Buffer?bufferAlloc(t+e.length):new r.constructor(t+e.length);return n.set(r),n.set(e,t),n},binaryExtend=function(r,e){return isArray(e)||isBinary(e)?_binaryExtend(r,e):_binaryExtend(r,[e])},isNodeReadStream=r=>null!=r&&"function"==typeof r.pipe,__streamWrite=r=>function(e,t,n){return r.write(e,t,n),r},_streamExtendExecutor=(r,e)=>function(t,n){e.on("data",__streamWrite(r)),e.on("end",thunkify1(t,r)),e.on("error",n)},_streamExtend=(r,e)=>new Promise(_streamExtendExecutor(r,e)),streamExtend=function(r,e){return null!=(t=e)&&"function"==typeof t.pipe?_streamExtend(r,e):(r.write(e),r);var t},setExtend=function(r,e){if(null!=e&&e.constructor==Set){for(const t of e)r.add(t);return r}return r.add(e)},callConcat=function(r,e){return r.concat(e)},identityTransform=function(r,e,t){const n=genericReduce(r,e(noop),null);return isPromise(n)?n.then(always(t)):t},genericTransform=function(r,e,t){if(isArray(t))return genericReduce(r,e(arrayExtend),t);if(isBinary(t)){const n=genericReduce(r,e(arrayExtend),[]);return isPromise(n)?n.then(curry2(binaryExtend,t,__)):binaryExtend(t,n)}if(null==t)return identityTransform(r,e,t);const n=t.constructor;if("string"==typeof t||n==String){const n=genericReduce(r,e(arrayExtend),[t]);return isPromise(n)?n.then(curry3(callPropUnary,__,"join","")):n.join("")}return"function"==typeof t.concat?genericReduce(r,e(callConcat),t):"function"==typeof t.write?genericReduce(r,e(streamExtend),t):n==Set?genericReduce(r,e(setExtend),t):n==Object?genericReduce(r,e(objectAssign),t):identityTransform(r,e,t)},_transform=function(r,e,t){if("function"==typeof t){const n=t(r);return isPromise(n)?n.then(curry3(genericTransform,r,e,__)):genericTransform(r,e,n)}return isPromise(t)?t.then(curry3(genericTransform,r,e,__)):genericTransform(r,e,t)},transform=function(...r){return"function"==typeof r[0]?curry3(_transform,__,r[0],r[1]):isPromise(r[0])?r[0].then(curry3(_transform,__,r[1],r[2])):_transform(r[0],r[1],r[2])},arrayPush=function(r,e){return r.push(e),r},FlatMappingIterator=function(r,e){let t=[],n=0;return{[symbolIterator](){return this},next(){if(n<t.length){const r=t[n];return n+=1,{value:r,done:!1}}const o=r.next();if(o.done)return o;const s=genericReduce(e(o.value),arrayPush,[]);return s.length>1&&(t=s,n=1),{value:s[0],done:!1}}}},sleep=r=>new Promise((e=>{setTimeout(e,r)})),FlatMappingAsyncIterator=function(r,e){const t=[],n=new Set;return{isAsyncIteratorDone:!1,[symbolAsyncIterator](){return this},toString:()=>"[object FlatMappingAsyncIterator]",async next(){for(;!this.isAsyncIteratorDone||t.length>0||n.size>0;){if(!this.isAsyncIteratorDone){const{value:o,done:s}=await r.next();if(s)this.isAsyncIteratorDone=s;else{const r=e(o);if(isPromise(r)){const e=r.then(curry3(genericReduce,__,arrayPush,t)).then((()=>n.delete(e)));n.add(e)}else{const e=genericReduce(r,arrayPush,t);if(isPromise(e)){const r=e.then((()=>n.delete(r)));n.add(r)}}}}if(t.length>0)return{value:t.shift(),done:!1};n.size>0&&await promiseRace([sleep(1e3),...n])}return{value:void 0,done:!0}}}},getArg1=(r,e)=>e,identity=r=>r,funcConcatSync=(r,e)=>function(...t){return e(r(...t))},asyncIteratorForEach=async function(r,e){const t=[];for await(const n of r){const r=e(n);isPromise(r)&&t.push(r)}return 0==t.length?r:promiseAll(t).then(always(r))},arrayFlatten=function(r){const e=r.length,t=[],n=[];let o=-1;for(;++o<e;){const e=r[o];if(isArray(e)){const r=e.length;let t=-1;for(;++t<r;)n.push(e[t])}else if(null==e)n.push(e);else if("function"==typeof e.then)t.push(e.then(curry2(arrayPush,n,__)));else if("function"==typeof e[symbolIterator])for(const r of e)n.push(r);else if("function"==typeof e[symbolAsyncIterator])t.push(asyncIteratorForEach(e[symbolAsyncIterator](),curry2(arrayPush,n,__)));else if("function"==typeof e.chain){const r=e.chain(identity);isPromise(r)?t.push(r.then(curry2(arrayPush,n,__))):n.push(r)}else if("function"==typeof e.flatMap){const r=e.flatMap(identity);isPromise(r)?t.push(r.then(curry2(arrayPush,n,__))):n.push(r)}else if("function"==typeof e.reduce){const r=e.reduce(funcConcatSync(getArg1,curry2(arrayPush,n,__)),null);isPromise(r)&&t.push(r)}else if(e.constructor==Object)for(const r in e)n.push(e[r]);else n.push(e)}return 0==t.length?n:promiseAll(t).then(always(n))},arrayFlatMap=function(r,e){const t=arrayMap(r,e);return isPromise(t)?t.then(arrayFlatten):arrayFlatten(t)},objectFlatten=function(r){const e=[],t={},n=curry2(objectAssign,t,__),o=funcConcatSync(getArg1,n);for(const s in r){const i=r[s];if(null!=i)if("function"==typeof i[symbolIterator])for(const r of i)objectAssign(t,r);else if("function"==typeof i[symbolAsyncIterator])e.push(asyncIteratorForEach(i[symbolAsyncIterator](),n));else if("function"==typeof i.chain){const r=i.chain(identity);isPromise(r)?e.push(r.then(n)):objectAssign(t,r)}else if("function"==typeof i.flatMap){const r=i.flatMap(identity);isPromise(r)?e.push(r.then(n)):n(r)}else if("function"==typeof i.reduce){const r=i.reduce(o,null);isPromise(r)&&e.push(r)}else objectAssign(t,i)}return 0==e.length?t:promiseAll(e).then((()=>t))},objectFlatMap=function(r,e){const t=objectMap(r,e);return isPromise(t)?t.then(objectFlatten):objectFlatten(t)},setFlatten=function(r){r.size;const e=[],t=new Set,n=(r,e)=>t.add(e),o=curry3(callPropUnary,t,"add",__);for(const s of r)if(isArray(s)){const r=s.length;let e=-1;for(;++e<r;)t.add(s[e])}else if(null==s)t.add(s);else if("function"==typeof s[symbolIterator])for(const r of s)t.add(r);else if("function"==typeof s[symbolAsyncIterator])e.push(asyncIteratorForEach(s[symbolAsyncIterator](),o));else if("function"==typeof s.chain){const r=s.chain(identity);isPromise(r)?e.push(r.then(o)):t.add(r)}else if("function"==typeof s.flatMap){const r=s.flatMap(identity);isPromise(r)?e.push(r.then(o)):t.add(r)}else if("function"==typeof s.reduce){const r=s.reduce(n,null);isPromise(r)&&e.push(r)}else if(s.constructor==Object)for(const r in s)t.add(s[r]);else t.add(s);return 0==e.length?t:promiseAll(e).then((()=>t))},setFlatMap=function(r,e){const t=setMap(r,e);return isPromise(t)?t.then(setFlatten):setFlatten(t)},arrayJoin=(r,e)=>r.join(e),arrayFlattenToString=funcConcat(arrayFlatten,curry2(arrayJoin,__,"")),stringFlatMap=function(r,e){const t=arrayMap(r,e);return isPromise(t)?t.then(arrayFlattenToString):arrayFlattenToString(t)},_flatMap=function(r,e){if(isArray(r))return arrayFlatMap(r,e);if(null==r)return e(r);if("function"==typeof r.then)return r.then(e);if("function"==typeof r.next)return symbolIterator in r?FlatMappingIterator(r,e):FlatMappingAsyncIterator(r,e);if("function"==typeof r.chain)return r.chain(e);if("function"==typeof r.flatMap)return r.flatMap(e);const t=r.constructor;return t==Object?objectFlatMap(r,e):t==Set?setFlatMap(r,e):"string"==typeof r||t==String?stringFlatMap(r,e):e(r)},flatMap=(...r)=>{const e=r.pop();if(0==r.length)return curry2(_flatMap,__,e);const t=r[0];return isPromise(t)?t.then(curry2(_flatMap,__,e)):_flatMap(r[0],e)},arrayForEach=function(r,e){const t=r.length,n=[];let o=-1;for(;++o<t;){const t=e(r[o]);isPromise(t)&&n.push(t)}return 0==n.length?r:promiseAll(n).then(always(r))},objectForEach=function(r,e){const t=[];for(const n in r){const o=e(r[n]);isPromise(o)&&t.push(o)}return 0==t.length?r:promiseAll(t).then(always(r))},iteratorForEach=function(r,e){const t=[];for(const n of r){const r=e(n);isPromise(r)&&t.push(r)}return 0==t.length?r:promiseAll(t).then(always(r))},_forEach=function(r,e){return isArray(r)?arrayForEach(r,e):null==r?r:"function"==typeof r.forEach?r.forEach(e):"function"==typeof r[symbolIterator]?iteratorForEach(r[symbolIterator](),e):"function"==typeof r[symbolAsyncIterator]?asyncIteratorForEach(r[symbolAsyncIterator](),e):r.constructor==Object?objectForEach(r,e):r},forEach=function(...r){const e=r.pop();if(0==r.length)return curry2(_forEach,__,e);const t=r[0];return isPromise(t)?t.then(curry2(_forEach,__,e)):_forEach(t,e)},SelfReferencingPromise=function(r){const e=r.then((r=>[r,e]));return e},asyncArraySome=async function(r,e,t,n){const o=r.length;for(;++t<o;){const o=e(r[t]);if(isPromise(o))n.add(SelfReferencingPromise(o));else if(o)return!0}for(;n.size>0;){const[r,e]=await promiseRace(n);if(n.delete(e),r)return!0}return!1},arraySome=function(r,e){const t=r.length;let n=-1;for(;++n<t;){const t=e(r[n]);if(isPromise(t))return asyncArraySome(r,e,n,new Set([SelfReferencingPromise(t)]));if(t)return!0}return!1},asyncIteratorSome=async function(r,e,t,n=20){let o=r.next();for(isPromise(o)&&(o=await o);!o.done;){if(t.size>=n){const[r,e]=await promiseRace(t);if(t.delete(e),r)return!0}const s=e(o.value);if(isPromise(s))t.add(SelfReferencingPromise(s));else if(s)return!0;o=r.next(),isPromise(o)&&(o=await o)}for(;t.size>0;){const[r,e]=await promiseRace(t);if(t.delete(e),r)return!0}return!1},iteratorSome=function(r,e){for(const t of r){const n=e(t);if(isPromise(n))return asyncIteratorSome(r,e,new Set([SelfReferencingPromise(n)]));if(n)return!0}return!1},reducerAnySync=r=>function(e,t){return!!e||r(t)},reducerSome=r=>function(e,t){return!0===e?e:isPromise(e)?e.then(curry2(reducerAnySync(r),__,t)):!!e||r(t)},_some=function(r,e){return isArray(r)?arraySome(r,e):null==r?e(r):"function"==typeof r[symbolIterator]?iteratorSome(r[symbolIterator](),e):"function"==typeof r[symbolAsyncIterator]?asyncIteratorSome(r[symbolAsyncIterator](),e,new Set):"function"==typeof r.reduce?r.reduce(reducerSome(e),!1):r.constructor==Object?arraySome(objectValues(r),e):e(r)},some=function(...r){const e=r.pop();if(0==r.length)return curry2(_some,__,e);const t=r[0];return isPromise(t)?t.then(curry2(_some,__,e)):_some(t,e)},arrayEvery=function(r,e){const t=r.length,n=[];let o=-1;for(;++o<t;){const t=e(r[o]);if(isPromise(t))n.push(t);else if(!t)return!1}return 0==n.length||promiseAll(n).then(curry3(callPropUnary,__,"every",Boolean))},iteratorEvery=function(r,e){const t=[];for(const n of r){const r=e(n);if(isPromise(r))t.push(r);else if(!r)return!1}return 0==t.length||promiseAll(t).then(curry3(callPropUnary,__,"every",Boolean))},asyncIteratorEvery=async function(r,e,t,n=20){let o=await r.next();for(;!o.done;){if(t.size>=n){const[r,e]=await promiseRace(t);if(t.delete(e),!r)return!1}const s=e(o.value);if(isPromise(s))t.add(SelfReferencingPromise(s));else if(!s)return!1;o=await r.next()}for(;t.size>0;){const[r,e]=await promiseRace(t);if(t.delete(e),!r)return!1}return!0},reducerAllSync=(r,e,t)=>!!e&&r(t),reducerEvery=r=>function(e,t){return!1!==e&&(isPromise(e)?e.then(curry3(reducerAllSync,r,__,t)):!!e&&r(t))},_every=function(r,e){return isArray(r)?arrayEvery(r,e):null==r?e(r):"function"==typeof r[symbolIterator]?iteratorEvery(r[symbolIterator](),e):"function"==typeof r[symbolAsyncIterator]?asyncIteratorEvery(r[symbolAsyncIterator](),e,new Set):"function"==typeof r.reduce?r.reduce(reducerEvery(e),!0):r.constructor==Object?arrayEvery(objectValues(r),e):e(r)},every=function(...r){const e=r.pop();if(0==r.length)return curry2(_every,__,e);const t=r[0];return isPromise(t)?t.then(curry2(_every,__,e)):_every(t,e)},areAllValuesTruthy=function(r,e){const t=r.length;for(;++e<t;){const t=r[e];if(isPromise(t))return t.then(curry3(thunkConditional,__,thunkify2(areAllValuesTruthy,r,e),always(!1)));if(!t)return!1}return!0},asyncArePredicatesAllTruthy=async function(r,e,t){const n=e.length;for(;++t<n;){let n=e[t];if("function"==typeof n&&(n=n(...r)),isPromise(n)&&(n=await n),!n)return!1}return!0},areAllPredicatesTruthy=function(r,e){const t=e.length;let n=-1;for(;++n<t;){let t=e[n];if("function"==typeof t&&(t=t(...r)),isPromise(t))return t.then(curry3(thunkConditional,__,thunkify3(asyncArePredicatesAllTruthy,r,e,n),always(!1)));if(!t)return!1}return!0},and=function(...r){const e=r.pop();return areAllValuesNonfunctions(e)?areAllValuesTruthy(e,-1):0==r.length?curryArgs2(areAllPredicatesTruthy,__,e):areAnyValuesPromises(r)?promiseAll(r).then(curry2(areAllPredicatesTruthy,__,e)):areAllPredicatesTruthy(r,e)},areAnyNonfunctionsTruthy=function(r,e){const t=r.length;for(;++e<t;){const t=r[e];if(isPromise(t))return t.then(curry3(thunkConditional,__,always(!0),thunkify2(areAnyNonfunctionsTruthy,r,e)));if(t)return!0}return!1},asyncAreAnyPredicatesTruthy=async function(r,e,t){const n=e.length;for(;++t<n;){let n=e[t];if("function"==typeof n&&(n=n(...r)),isPromise(n)&&(n=await n),n)return!0}return!1},areAnyPredicatesTruthy=function(r,e){const t=e.length;let n=-1;for(;++n<t;){let t=e[n];if("function"==typeof t&&(t=t(...r)),isPromise(t))return t.then(curry3(thunkConditional,__,always(!0),thunkify3(asyncAreAnyPredicatesTruthy,r,e,n)));if(t)return!0}return!1},or=function(...r){const e=r.pop();return areAllValuesNonfunctions(e)?areAnyNonfunctionsTruthy(e,-1):0==r.length?curryArgs2(areAnyPredicatesTruthy,__,e):areAnyValuesPromises(r)?promiseAll(r).then(curry2(areAnyPredicatesTruthy,__,e)):areAnyPredicatesTruthy(r,e)},negate=r=>!r,_not=function(r,e){const t=e(...r);return isPromise(t)?t.then(negate):!t},not=function(...r){const e=r.pop();return"function"==typeof e?0==r.length?curryArgs2(_not,__,e):areAnyValuesPromises(r)?promiseAll(r).then(curry2(_not,__,e)):_not(r,e):!e},curryArgs4ResolveArgs0=(r,e,t,n)=>function(...o){return r(o,e,t,n)},curryArgs4ResolveArgs1=(r,e,t,n)=>function(...o){return r(e,o,t,n)},curryArgs4ResolveArgs2=(r,e,t,n)=>function(...o){return r(e,t,o,n)},curryArgs4ResolveArgs3=(r,e,t,n)=>function(...o){return r(e,t,n,o)},curryArgs4=function(r,e,t,n,o){return e==__?curryArgs4ResolveArgs0(r,t,n,o):t==__?curryArgs4ResolveArgs1(r,e,n,o):n==__?curryArgs4ResolveArgs2(r,e,t,o):curryArgs4ResolveArgs3(r,e,t,n)},leftResolverRightResolverCompare=function(r,e,t,n){const o=t(...r),s=n(...r);return isPromise(o)||isPromise(s)?promiseAll([o,s]).then(spread2(e)):e(o,s)},leftResolverRightValueCompare=function(r,e,t,n){const o=t(...r);return isPromise(o)||isPromise(n)?promiseAll([o,n]).then(spread2(e)):e(o,n)},leftValueRightResolverCompare=function(r,e,t,n){const o=n(...r);return isPromise(t)||isPromise(o)?promiseAll([t,o]).then(spread2(e)):e(t,o)},ComparisonOperator=r=>function(...e){const t=e.pop(),n=e.pop(),o="function"==typeof n,s="function"==typeof t;return o&&s?0==e.length?curryArgs4(leftResolverRightResolverCompare,__,r,n,t):areAnyValuesPromises(e)?promiseAll(e).then(curry4(leftResolverRightResolverCompare,__,r,n,t)):leftResolverRightResolverCompare(e,r,n,t):o?0==e.length?curryArgs4(leftResolverRightValueCompare,__,r,n,t):areAnyValuesPromises(e)?promiseAll(e).then(curry4(leftResolverRightValueCompare,__,r,n,t)):leftResolverRightValueCompare(e,r,n,t):s?0==e.length?curryArgs4(leftValueRightResolverCompare,__,r,n,t):areAnyValuesPromises(e)?promiseAll(e).then(curry4(leftValueRightResolverCompare,__,r,n,t)):leftValueRightResolverCompare(e,r,n,t):isPromise(n)||isPromise(t)?promiseAll([n,t]).then(spread2(r)):r(n,t)},equals=function(r,e){return r==e},eq=ComparisonOperator(equals),greaterThan=(r,e)=>r>e,gt=ComparisonOperator(greaterThan),lessThan=(r,e)=>r<e,lt=ComparisonOperator(lessThan),greaterThanOrEqual=(r,e)=>r>=e,gte=ComparisonOperator(greaterThanOrEqual),lessThanOrEqual=(r,e)=>r<=e,lte=ComparisonOperator(lessThanOrEqual),memoizeCappedUnary=function(r,e){const t=new Map,n=function(n){if(t.has(n))return t.get(n);const o=r(n);return t.set(n,o),t.size>e&&t.clear(),o};return n.cache=t,n},pathDelimiters=/[.|[|\]]+/,parsePropertyPath=function(r){const e=r.length-1,t="["==r[0],n="]"==r[e];return t&&n?r.slice(1,e).split(pathDelimiters):t?r.slice(1).split(pathDelimiters):n?r.slice(0,e).split(pathDelimiters):r.split(pathDelimiters)},memoizedCappedParsePropertyPath=memoizeCappedUnary(parsePropertyPath,500),propertyPathToArray=r=>isArray(r)?r:"string"==typeof r?memoizedCappedParsePropertyPath(r):[r],getByPath=function(r,e){const t=propertyPathToArray(e),n=t.length;let o=-1,s=r;for(;++o<n;)if(s=s[t[o]],null==s)return;return s},_get=function(r,e,t){const n=null==r?void 0:getByPath(r,e);return void 0===n?"function"==typeof t?t(r):t:n},get=function(r,e,t){return isPromise(r)?r.then(curry3(_get,__,e,t)):isObject(r)&&!isArray(r)?_get(r,e,t):curry3(_get,__,r,e)},setByPath=function(r,e,t){if(!isObject(r))return r;const n=propertyPathToArray(t),o=n.length,s=o-1,i={...r};let c=i,u=-1;for(;++u<o;){const r=n[u];if(u==s)c[r]=e;else{const e=c[r],t=isArray(e)?e.slice():{...e};c[r]=t,c=t}}return i},_set=function(r,e,t){if("function"==typeof t){const n=t(r);return isPromise(n)?n.then(curry3(setByPath,r,__,e)):setByPath(r,n,e)}return isPromise(t)?t.then(curry3(setByPath,r,__,e)):setByPath(r,t,e)},set=function(r,e,t){return null==t?curry3(_set,__,r,e):isPromise(r)?r.then(curry3(_set,__,e,t)):_set(r,e,t)},_pick=function(r,e){if(null==r)return r;const t=e.length;let n={},o=-1;for(;++o<t;){const t=e[o],s=getByPath(r,t);null!=s&&(n=setByPath(n,s,t))}return n},pick=function(r,e){return null==e?curry2(_pick,__,r):isPromise(r)?r.then(curry2(_pick,__,e)):_pick(r,e)},deleteByPath=function(r,e){if(null==r)return;const t=propertyPathToArray(e),n=t.length-1;let o=-1,s=r;for(;++o<n;)if(s=s[t[o]],null==s)return;const i=t[o];null!=s&&i in s&&delete s[i]},objectCopyDeep=function(r){const e={};for(const t in r){const n=r[t];isArray(n)?e[t]=arrayCopyDeep(n):null!=n&&n.constructor==Object?e[t]=objectCopyDeep(n):e[t]=n}return e},arrayCopyDeep=function(r){const e=r.length,t=[];let n=-1;for(;++n<e;){const e=r[n];isArray(e)?t[n]=arrayCopyDeep(e):null!=e&&e.constructor==Object?t[n]=objectCopyDeep(e):t[n]=e}return t},copyDeep=function(r){return isArray(r)?arrayCopyDeep(r):null==r?r:r.constructor==Object?objectCopyDeep(r):r},_omit=function(r,e){const t=e.length,n=isArray(o=r)?arrayCopyDeep(o):null==o?o:o.constructor==Object?objectCopyDeep(o):o;var o;let s=-1;for(;++s<t;)deleteByPath(n,e[s]);return n},omit=function(r,e){return null==e?curry2(_omit,__,r):isPromise(r)?r.then(curry2(_omit,__,e)):_omit(r,e)},thunkify=(r,...e)=>function(){return areAnyValuesPromises(e)?promiseAll(e).then(curry2(funcApply,r,__)):r(...e)},curry=(r,...e)=>curryArity(r.length,r,e);curry.arity=function(r,e,...t){return curryArity(r,e,t)};const rubico={pipe:pipe,compose:compose,tap:tap,forEach:forEach,switchCase:switchCase,tryCatch:tryCatch,all:all,assign:assign,get:get,set:set,pick:pick,omit:omit,map:map,filter:filter,flatMap:flatMap,reduce:reduce,transform:transform,and:and,or:or,not:not,some:some,every:every,eq:eq,gt:gt,lt:lt,gte:gte,lte:lte,thunkify:thunkify,always:always,curry:curry,__:__};export{pipe,compose,tap,forEach,switchCase,tryCatch,all,assign,get,set,pick,omit,map,filter,reduce,transform,flatMap,and,or,not,some,every,eq,gt,lt,gte,lte,thunkify,always,curry,__};export default rubico;
|
|
7
|
+
const isPromise=r=>null!=r&&"function"==typeof r.then,areAnyValuesPromises=function(r){const e=r.length;let t=-1;for(;++t<e;){const e=r[t];if(isPromise(e))return!0}return!1},promiseAll=Promise.all.bind(Promise),funcConcat=(r,e)=>function(...t){const n=r(...t);return isPromise(n)?n.then(e):e(n)},funcApply=(r,e)=>r(...e),__=Symbol.for("placeholder"),curry2ResolveArg0=(r,e)=>function(t){return r(t,e)},curry2ResolveArg1=(r,e)=>function(t){return r(e,t)},curry2=function(r,e,t){return e==__?curry2ResolveArg0(r,t):curry2ResolveArg1(r,e)},pipe=function(...r){const e=r.pop().reduce(funcConcat);return 0==r.length?e:areAnyValuesPromises(r)?promiseAll(r).then(curry2(funcApply,e,__)):e(...r)},compose=function(...r){const e=r.pop().reduceRight(funcConcat);return 0==r.length?e:areAnyValuesPromises(r)?promiseAll(r).then(curry2(funcApply,e,__)):e(...r)},always=r=>function(){return r},thunkifyArgs=(r,e)=>function(){return r(...e)},thunkConditional=(r,e,t)=>r?e():t(),curry3ResolveArg0=(r,e,t)=>function(n){return r(n,e,t)},curry3ResolveArg1=(r,e,t)=>function(n){return r(e,n,t)},curry3ResolveArg2=(r,e,t)=>function(n){return r(e,t,n)},curry3=function(r,e,t,n){return e==__?curry3ResolveArg0(r,t,n):t==__?curry3ResolveArg1(r,e,n):curry3ResolveArg2(r,e,t)},curryArgs2ResolveArgs0=(r,e,t)=>function(...t){return r(t,e)},curryArgs2ResolveArgs1=(r,e,t)=>function(...t){return r(e,t)},curryArgs2=function(r,e,t){return e==__?curryArgs2ResolveArgs0(r,t):curryArgs2ResolveArgs1(r,e)},_tap=function(r,e){const t=r[0],n=e(...r);return isPromise(n)?n.then(always(t)):t},tap=function(...r){const e=r.pop();return 0==r.length?curryArgs2(_tap,__,e):_tap(r,e)};tap.if=(r,e)=>function(...t){const n=r(...t);if(isPromise(n))return n.then(curry3(thunkConditional,__,thunkifyArgs(tap(e),t),always(t[0])));if(n){const r=e(...t);if(isPromise(r))return r.then(always(t[0]))}return t[0]};const isArray=Array.isArray,functionArrayAll=function(r,e){const t=r.length,n=Array(t);let o=-1,s=!1;for(;++o<t;){const t=r[o](...e);isPromise(t)&&(s=!0),n[o]=t}return s?promiseAll(n):n},curry4ResolveArg0=(r,e,t,n)=>function(o){return r(o,e,t,n)},curry4ResolveArg1=(r,e,t,n)=>function(o){return r(e,o,t,n)},curry4ResolveArg2=(r,e,t,n)=>function(o){return r(e,t,o,n)},curry4ResolveArg3=(r,e,t,n)=>function(o){return r(e,t,n,o)},curry4=function(r,e,t,n,o){return e==__?curry4ResolveArg0(r,t,n,o):t==__?curry4ResolveArg1(r,e,n,o):n==__?curry4ResolveArg2(r,e,t,o):curry4ResolveArg3(r,e,t,n)},objectSet=function(r,e,t){return r[e]=t,r},asyncFunctionArrayAllSeries=async function(r,e,t,n){const o=r.length;for(;++n<o;){const o=r[n](...e);t[n]=isPromise(o)?await o:o}return t},functionArrayAllSeries=function(r,e){const t=r.length,n=[];let o=-1;for(;++o<t;){const t=r[o](...e);if(isPromise(t))return t.then(funcConcat(curry3(objectSet,n,o,__),curry4(asyncFunctionArrayAllSeries,r,e,__,o)));n[o]=t}return n},functionObjectAll=function(r,e){const t={},n=[];for(const o in r){const s=r[o](...e);isPromise(s)?n.push(s.then(curry3(objectSet,t,o,__))):t[o]=s}return 0==n.length?t:promiseAll(n).then(always(t))},all=function(...r){const e=r.pop();return 0==r.length?isArray(e)?curryArgs2(functionArrayAll,e,__):curryArgs2(functionObjectAll,e,__):areAnyValuesPromises(r)?isArray(e)?promiseAll(r).then(curry2(functionArrayAll,e,__)):promiseAll(r).then(curry2(functionObjectAll,e,__)):isArray(e)?functionArrayAll(e,r):functionObjectAll(e,r)};all.series=function(...r){const e=r.pop();return 0==r.length?curryArgs2(functionArrayAllSeries,e,__):areAnyValuesPromises(r)?promiseAll(r).then(curry2(functionArrayAllSeries,e,__)):functionArrayAllSeries(e,r)};const objectAssign=Object.assign,_assign=function(r,e){const t=functionObjectAll(e,[r]);return isPromise(t)?t.then(curry3(objectAssign,{},r,__)):{...r,...t}},assign=function(r,e){return null==e?curry2(_assign,__,r):isPromise(r)?r.then(curry2(_assign,__,e)):_assign(r,e)},catcherApply=function(r,e,t){return r(e,...t)},_tryCatch=function(r,e,t){try{const n=r(...t);return isPromise(n)?n.catch(curry3(catcherApply,e,__,t)):n}catch(r){return e(r,...t)}},tryCatch=function(...r){if(r.length>2){const e=r.pop(),t=r.pop();return areAnyValuesPromises(r)?promiseAll(r).then(curry3(_tryCatch,t,e,__)):_tryCatch(t,e,r)}const e=r[0],t=r[1];return function(...r){return _tryCatch(e,t,r)}},thunkify3=(r,e,t,n)=>function(){return r(e,t,n)},arrayConditional=function(r,e,t){const n=r.length-1;for(;(t+=2)<n;){const n=r[t],o=r[t+1],s="function"==typeof n?n(...e):n;if(isPromise(s))return s.then(curry3(thunkConditional,__,"function"==typeof o?thunkifyArgs(o,e):always(o),thunkify3(arrayConditional,r,e,t)));if(s)return"function"==typeof o?o(...e):o}if(t==r.length)return;const o=r[n];return"function"==typeof o?o(...e):o},areAllValuesNonfunctions=function(r){const e=r.length;let t=-1;for(;++t<e;)if("function"==typeof r[t])return!1;return!0},thunkify2=(r,e,t)=>function(){return r(e,t)},nonfunctionsConditional=function(r,e){const t=r.length,n=t-1;for(;(e+=2)<n;){const t=r[e],n=r[e+1];if(isPromise(t))return t.then(curry3(thunkConditional,__,always(n),thunkify2(nonfunctionsConditional,r,e)));if(t)return n}if(e!=t)return r[e]},curryArgs3ResolveArgs0=(r,e,t)=>function(...n){return r(n,e,t)},curryArgs3ResolveArgs1=(r,e,t)=>function(...n){return r(e,n,t)},curryArgs3ResolveArgs2=(r,e,t)=>function(...n){return r(e,t,n)},curryArgs3=function(r,e,t,n){return e==__?curryArgs3ResolveArgs0(r,t,n):t==__?curryArgs3ResolveArgs1(r,e,n):curryArgs3ResolveArgs2(r,e,t)},switchCase=(...r)=>{const e=r.pop();return areAllValuesNonfunctions(e)?nonfunctionsConditional(e,-2):0==r.length?(t=arrayConditional,o=__,s=-2,(n=e)==__?curryArgs3ResolveArgs0(t,o,s):o==__?curryArgs3ResolveArgs1(t,n,s):curryArgs3ResolveArgs2(t,n,o)):areAnyValuesPromises(r)?promiseAll(r).then(curry3(arrayConditional,e,__,-2)):arrayConditional(e,r,-2);var t,n,o,s},symbolIterator=Symbol.iterator,MappingIterator=(r,e)=>({toString:()=>"[object MappingIterator]",[symbolIterator](){return this},next(){const t=r.next();return t.done?t:{value:e(t.value),done:!1}}}),NextIteration=r=>({value:r,done:!1}),symbolAsyncIterator=Symbol.asyncIterator,MappingAsyncIterator=(r,e)=>({[symbolAsyncIterator](){return this},async next(){const t=await r.next();if(t.done)return t;const n=e(t.value);return isPromise(n)?n.then(NextIteration):{value:n,done:!1}}}),isObject=r=>{if(null==r)return!1;const e=typeof r;return"object"==e||"function"==e},arrayMap=function(r,e){const t=r.length,n=Array(t);let o=-1,s=!1;for(;++o<t;){const t=e(r[o],o,r);isPromise(t)&&(s=!0),n[o]=t}return s?promiseAll(n):n},callPropUnary=(r,e,t)=>r[e](t),stringMap=function(r,e){const t=arrayMap(r,e);return isPromise(t)?t.then(curry3(callPropUnary,__,"join","")):t.join("")},setMap=function(r,e){const t=new Set,n=[];for(const o of r){const s=e(o,o,r);isPromise(s)?n.push(s.then(curry3(callPropUnary,t,"add",__))):t.add(s)}return 0==n.length?t:promiseAll(n).then(always(t))},callPropBinary=(r,e,t,n)=>r[e](t,n),mapMap=function(r,e){const t=new Map,n=[];for(const[o,s]of r){const i=e(s,o,r);isPromise(i)?n.push(i.then(curry4(callPropBinary,t,"set",o,__))):t.set(o,i)}return 0==n.length?t:promiseAll(n).then(always(t))},promiseObjectAllExecutor=r=>function(e){const t={};let n=0;for(const o in r){const s=r[o];isPromise(s)?(n+=1,s.then((r=>function(o){t[r]=o,n-=1,0==n&&e(t)})(o))):t[o]=s}0==n&&e(t)},promiseObjectAll=r=>new Promise(promiseObjectAllExecutor(r)),objectMap=function(r,e){const t={};let n=!1;for(const o in r){const s=e(r[o],o,r);isPromise(s)&&(n=!0),t[o]=s}return n?promiseObjectAll(t):t},arrayMapSeriesAsync=async function(r,e,t,n){const o=r.length;for(;++n<o;){const o=e(r[n],n);t[n]=isPromise(o)?await o:o}return t},arrayMapSeries=function(r,e){const t=r.length,n=Array(t);let o=-1;for(;++o<t;){const t=e(r[o],o);if(isPromise(t))return t.then(funcConcat(curry3(objectSet,n,o,__),curry4(arrayMapSeriesAsync,r,e,__,o)));n[o]=t}return n},tapSync=r=>function(...e){return r(...e),e[0]},promiseRace=Promise.race.bind(Promise),arrayMapPoolAsync=async function(r,e,t,n,o,s){const i=r.length;for(;++o<i;){s.size>=t&&await promiseRace(s);const i=e(r[o]);if(isPromise(i)){const r=i.then(tapSync((()=>s.delete(r))));s.add(r),n[o]=r}else n[o]=i}return promiseAll(n)},arrayMapPool=function(r,e,t){const n=r.length,o=Array(n);let s=-1;for(;++s<n;){const n=e(r[s]);if(isPromise(n)){const i=new Set,c=n.then(tapSync((()=>i.delete(c))));return i.add(c),o[s]=c,arrayMapPoolAsync(r,e,t,o,s,i)}o[s]=n}return o},_curryArity=(r,e,t)=>function(...n){const o=t.length,s=n.length,i=[];let c=-1,u=-1,a=0;for(;++c<o;){const o=t[c];if(o==__&&(u+=1)<s){const r=n[u];r==__&&(a+=1),i.push(r)}else i.push(o);if(i.length==r)return 0==a?e(...i):curryArity(r,e,i)}for(;++u<s;){const t=n[u];if(t==__&&(a+=1),i.push(t),i.length==r)return 0==a?e(...i):curryArity(r,e,i)}return curryArity(r,e,i)},curryArity=function(r,e,t){const n=t.length;if(n<r)return _curryArity(r,e,t);let o=-1;for(;++o<n;){if(t[o]==__)return _curryArity(r,e,t)}return e(...t)},spread2=r=>function([e,t]){return r(e,t)},objectMapEntries=function(r,e){const t={},n=[];for(const o in r){const s=e([o,r[o]]);isPromise(s)?n.push(s.then(spread2(curryArity(3,objectSet,[t])))):t[s[0]]=s[1]}return 0==n.length?t:promiseAll(n).then(always(t))},mapSet=function(r,e,t){return r.set(e,t)},mapMapEntriesForEachCallback=(r,e,t)=>function(n,o){const s=r([o,n]);isPromise(s)?t.push(s.then(spread2(curryArity(3,mapSet,[e])))):e.set(s[0],s[1])},mapMapEntries=function(r,e){const t=new Map,n=[];return r.forEach(mapMapEntriesForEachCallback(e,t,n)),0==n.length?t:promiseAll(n).then(always(t))},_map=function(r,e){return isArray(r)?arrayMap(r,e):null==r?r:"function"==typeof r.then?r.then(e):"function"==typeof r.map?r.map(e):"string"==typeof r||r.constructor==String?stringMap(r,e):r.constructor==Set?setMap(r,e):r.constructor==Map?mapMap(r,e):"function"==typeof r[symbolIterator]?MappingIterator(r[symbolIterator](),e):"function"==typeof r[symbolAsyncIterator]?MappingAsyncIterator(r[symbolAsyncIterator](),e):r.constructor==Object?objectMap(r,e):e(r)},map=(...r)=>{const e=r.pop();if(0==r.length)return curry2(_map,__,e);const t=r[0];return isPromise(t)?t.then(curry2(_map,__,e)):_map(t,e)};map.entries=function(r){return function(e){if(null==e)throw new TypeError("value is not an Object or Map");if(e.constructor==Object)return objectMapEntries(e,r);if(e.constructor==Map)return mapMapEntries(e,r);throw new TypeError("value is not an Object or Map")}},map.series=r=>function(e){if(isArray(e))return arrayMapSeries(e,r);throw new TypeError(`${e} is not an Array`)},map.pool=(r,e)=>function(t){if(isArray(t))return arrayMapPool(t,e,r);throw new TypeError(`${t} is not an Array`)};const FilteringIterator=(r,e)=>({[symbolIterator](){return this},next(){let t=r.next();for(;!t.done;){const{value:n}=t;if(e(n))return{value:n,done:!1};t=r.next()}return t}}),FilteringAsyncIterator=(r,e)=>({isAsyncIteratorDone:!1,[symbolAsyncIterator](){return this},async next(){for(;!this.isAsyncIteratorDone;){const{value:t,done:n}=await r.next();if(n)this.isAsyncIteratorDone=!0;else{const r=e(t);if(isPromise(r)?await r:r)return{value:t,done:!1}}}return{value:void 0,done:!0}}}),arrayExtendMap=function(r,e,t,n){const o=e.length;let s=r.length-1;for(;++n<o;)r[++s]=t(e[n],n,r);return r},arrayFilterByConditions=function(r,e,t,n){const o=r.length;let s=-1;for(;++t<o;)n[++s]&&e.push(r[t]);return e},arrayFilter=function(r,e){const t=r.length,n=[];let o=-1,s=-1;for(;++o<t;){const t=r[o],i=e(t,o,r);if(isPromise(i))return promiseAll(arrayExtendMap([i],r,e,o)).then(curry4(arrayFilterByConditions,r,n,o-1,__));i&&(n[++s]=t)}return n},stringFilter=function(r,e){const t=arrayFilter(r,e);return isPromise(t)?t.then(curry3(callPropUnary,__,"join","")):t.join("")},thunkify1=(r,e)=>function(){return r(e)},noop=function(){},setFilter=function(r,e){const t=new Set,n=t.add.bind(t),o=[];for(const s of r){const i=e(s,s,r);isPromise(i)?o.push(i.then(curry3(thunkConditional,__,thunkify1(n,s),noop))):i&&t.add(s)}return 0==o.length?t:promiseAll(o).then(always(t))},thunkify4=(r,e,t,n,o)=>function(){return r(e,t,n,o)},mapFilter=function(r,e){const t=new Map,n=[];for(const[o,s]of r){const i=e(s,o,r);isPromise(i)?n.push(i.then(curry3(thunkConditional,__,thunkify4(callPropBinary,t,"set",o,s),noop))):i&&t.set(o,s)}return 0==n.length?t:promiseAll(n).then(always(t))},objectSetIf=function(r,e,t,n){n&&(r[e]=t)},objectFilter=function(r,e){const t={},n=[];for(const o in r){const s=r[o],i=e(s,o,r);isPromise(i)?n.push(i.then(curry4(objectSetIf,t,o,r[o],__))):i&&(t[o]=s)}return 0==n.length?t:promiseAll(n).then(always(t))},_filter=function(r,e){return isArray(r)?arrayFilter(r,e):null==r?r:"string"==typeof r||r.constructor==String?stringFilter(r,e):r.constructor==Set?setFilter(r,e):r.constructor==Map?mapFilter(r,e):"function"==typeof r.filter?r.filter(e):"function"==typeof r[symbolIterator]?FilteringIterator(r[symbolIterator](),e):"function"==typeof r[symbolAsyncIterator]?FilteringAsyncIterator(r[symbolAsyncIterator](),e):r.constructor==Object?objectFilter(r,e):r},filter=function(...r){const e=r.pop();return 0==r.length?curry2(_filter,__,e):_filter(r[0],e)},objectValues=Object.values,objectProto=Object.prototype,nativeObjectToString=objectProto.toString,objectToString=r=>nativeObjectToString.call(r),generatorFunctionTag="[object GeneratorFunction]",isGeneratorFunction=r=>objectToString(r)==generatorFunctionTag,asyncGeneratorFunctionTag="[object AsyncGeneratorFunction]",isAsyncGeneratorFunction=r=>objectToString(r)==asyncGeneratorFunctionTag,iteratorReduceAsync=async function(r,e,t){let n=r.next();if(n.done)return t;for(;!n.done;)t=e(t,n.value),isPromise(t)&&(t=await t),n=r.next();return t},iteratorReduce=function(r,e,t){let n=r.next();if(n.done)return t;for(void 0===t&&(t=n.value,n=r.next());!n.done;){if(t=e(t,n.value),isPromise(t))return t.then(curry3(iteratorReduceAsync,r,e,__));n=r.next()}return t},asyncIteratorReduce=async function(r,e,t){let n=await r.next();if(n.done)return t;for(void 0===t&&(t=n.value,n=await r.next());!n.done;)t=await e(t,n.value),n=await r.next();return t},arrayReduceAsync=async function(r,e,t,n){const o=r.length;for(;++n<o;)t=e(t,r[n],n,r),isPromise(t)&&(t=await t);return t},arrayReduce=function(r,e,t){const n=r.length;let o=-1;for(void 0===t&&(t=r[++o]);++o<n;)if(t=e(t,r[o],o,r),isPromise(t))return t.then(curry4(arrayReduceAsync,r,e,__,o));return t},curry5ResolveArg0=(r,e,t,n,o)=>function(s){return r(s,e,t,n,o)},curry5ResolveArg1=(r,e,t,n,o)=>function(s){return r(e,s,t,n,o)},curry5ResolveArg2=(r,e,t,n,o)=>function(s){return r(e,t,s,n,o)},curry5ResolveArg3=(r,e,t,n,o)=>function(s){return r(e,t,n,s,o)},curry5ResolveArg4=(r,e,t,n,o)=>function(s){return r(e,t,n,o,s)},curry5=function(r,e,t,n,o,s){return e==__?curry5ResolveArg0(r,t,n,o,s):t==__?curry5ResolveArg1(r,e,n,o,s):n==__?curry5ResolveArg2(r,e,t,o,s):o==__?curry5ResolveArg3(r,e,t,n,s):curry5ResolveArg4(r,e,t,n,o)},objectKeys=Object.keys,objectReduceAsync=async function(r,e,t,n,o){const s=n.length;for(;++o<s;){const s=n[o];t=e(t,r[s],s,r),isPromise(t)&&(t=await t)}return t},objectReduce=function(r,e,t){const n=objectKeys(r),o=n.length;let s=-1;for(void 0===t&&(t=r[n[++s]]);++s<o;){const o=n[s];if(t=e(t,r[o],o,r),isPromise(t))return t.then((i=objectReduceAsync,u=e,a=__,l=n,y=s,(c=r)==__?curry5ResolveArg0(i,u,a,l,y):u==__?curry5ResolveArg1(i,c,a,l,y):a==__?curry5ResolveArg2(i,c,u,l,y):l==__?curry5ResolveArg3(i,c,u,a,y):curry5ResolveArg4(i,c,u,a,l)))}var i,c,u,a,l,y;return t},mapReduceAsync=async function(r,e,t,n){for(const[o,s]of n)t=e(t,s,o,r),isPromise(t)&&(t=await t);return t},mapReduce=function(r,e,t){const n=r.entries();if(void 0===t){const r=n.next();if(r.done)return t;t=r.value[1]}for(const[o,s]of n)if(t=e(t,s,o,r),isPromise(t))return t.then(curry4(mapReduceAsync,r,e,__,n));return t},reducerConcat=(r,e)=>function(t,n){const o=r(t,n);return isPromise(o)?o.then(curry2(e,__,n)):e(o,n)},genericReduce=function(r,e,t){return isArray(r)?arrayReduce(r,e,t):null==r?void 0===t?curry2(e,r,__):e(t,r):r.constructor==Map?mapReduce(r,e,t):"function"==typeof r[symbolIterator]?iteratorReduce(r[symbolIterator](),e,t):"function"==typeof r[symbolAsyncIterator]?asyncIteratorReduce(r[symbolAsyncIterator](),e,t):"function"==typeof r.reduce?r.reduce(e,t):"function"==typeof r.chain?r.chain(curry2(e,t,__)):"function"==typeof r.flatMap?r.flatMap(curry2(e,t,__)):r.constructor==Object?objectReduce(r,e,t):void 0===t?curry2(e,r,__):e(t,r)},_reduce=function(r,e,t){if("function"==typeof t){const n=t(r);return isPromise(n)?n.then(curry3(genericReduce,r,e,__)):genericReduce(r,e,n)}return isPromise(t)?t.then(curry3(genericReduce,r,e,__)):genericReduce(r,e,t)},reduce=function(...r){return"function"==typeof r[0]?curry3(_reduce,__,r[0],r[1]):isPromise(r[0])?r[0].then(curry3(_reduce,__,r[1],r[2])):_reduce(r[0],r[1],r[2])},isBinary=ArrayBuffer.isView,add=(r,e)=>r+e,_arrayExtend=function(r,e){const t=r.length,n=e.length;let o=-1;for(;++o<n;)r[t+o]=e[o];return r},arrayExtend=function(r,e){return isArray(e)||isBinary(e)?_arrayExtend(r,e):(r.push(e),r)},globalThisHasBuffer="function"==typeof Buffer,bufferAlloc=globalThisHasBuffer?Buffer.alloc:noop,_binaryExtend=function(r,e){const t=r.length,n=globalThisHasBuffer&&r.constructor==Buffer?bufferAlloc(t+e.length):new r.constructor(t+e.length);return n.set(r),n.set(e,t),n},binaryExtend=function(r,e){return isArray(e)||isBinary(e)?_binaryExtend(r,e):_binaryExtend(r,[e])},isNodeReadStream=r=>null!=r&&"function"==typeof r.pipe,__streamWrite=r=>function(e,t,n){return r.write(e,t,n),r},_streamExtendExecutor=(r,e)=>function(t,n){e.on("data",__streamWrite(r)),e.on("end",thunkify1(t,r)),e.on("error",n)},_streamExtend=(r,e)=>new Promise(_streamExtendExecutor(r,e)),streamExtend=function(r,e){return null!=(t=e)&&"function"==typeof t.pipe?_streamExtend(r,e):(r.write(e),r);var t},setExtend=function(r,e){if(null!=e&&e.constructor==Set){for(const t of e)r.add(t);return r}return r.add(e)},callConcat=function(r,e){return r.concat(e)},identityTransform=function(r,e,t){const n=genericReduce(r,e(noop),null);return isPromise(n)?n.then(always(t)):t},genericTransform=function(r,e,t){if(isArray(t))return genericReduce(r,e(arrayExtend),t);if(isBinary(t)){const n=genericReduce(r,e(arrayExtend),[]);return isPromise(n)?n.then(curry2(binaryExtend,t,__)):binaryExtend(t,n)}if(null==t)return identityTransform(r,e,t);const n=t.constructor;if("string"==typeof t||n==String){const n=genericReduce(r,e(arrayExtend),[t]);return isPromise(n)?n.then(curry3(callPropUnary,__,"join","")):n.join("")}return"function"==typeof t.concat?genericReduce(r,e(callConcat),t):"function"==typeof t.write?genericReduce(r,e(streamExtend),t):n==Set?genericReduce(r,e(setExtend),t):n==Object?genericReduce(r,e(objectAssign),t):identityTransform(r,e,t)},_transform=function(r,e,t){if("function"==typeof t){const n=t(r);return isPromise(n)?n.then(curry3(genericTransform,r,e,__)):genericTransform(r,e,n)}return isPromise(t)?t.then(curry3(genericTransform,r,e,__)):genericTransform(r,e,t)},transform=function(...r){return"function"==typeof r[0]?curry3(_transform,__,r[0],r[1]):isPromise(r[0])?r[0].then(curry3(_transform,__,r[1],r[2])):_transform(r[0],r[1],r[2])},arrayPush=function(r,e){return r.push(e),r},FlatMappingIterator=function(r,e){let t=[],n=0;return{[symbolIterator](){return this},next(){if(n<t.length){const r=t[n];return n+=1,{value:r,done:!1}}const o=r.next();if(o.done)return o;const s=genericReduce(e(o.value),arrayPush,[]);return s.length>1&&(t=s,n=1),{value:s[0],done:!1}}}},sleep=r=>new Promise((e=>{setTimeout(e,r)})),FlatMappingAsyncIterator=function(r,e){const t=[],n=new Set;return{isAsyncIteratorDone:!1,[symbolAsyncIterator](){return this},toString:()=>"[object FlatMappingAsyncIterator]",async next(){for(;!this.isAsyncIteratorDone||t.length>0||n.size>0;){if(!this.isAsyncIteratorDone){const{value:o,done:s}=await r.next();if(s)this.isAsyncIteratorDone=s;else{const r=e(o);if(isPromise(r)){const e=r.then(curry3(genericReduce,__,arrayPush,t)).then((()=>n.delete(e)));n.add(e)}else{const e=genericReduce(r,arrayPush,t);if(isPromise(e)){const r=e.then((()=>n.delete(r)));n.add(r)}}}}if(t.length>0)return{value:t.shift(),done:!1};n.size>0&&await promiseRace([sleep(1e3),...n])}return{value:void 0,done:!0}}}},getArg1=(r,e)=>e,identity=r=>r,funcConcatSync=(r,e)=>function(...t){return e(r(...t))},asyncIteratorForEach=async function(r,e){const t=[];for await(const n of r){const r=e(n);isPromise(r)&&t.push(r)}return 0==t.length?r:promiseAll(t).then(always(r))},arrayFlatten=function(r){const e=r.length,t=[],n=[];let o=-1;for(;++o<e;){const e=r[o];if(isArray(e)){const r=e.length;let t=-1;for(;++t<r;)n.push(e[t])}else if(null==e)n.push(e);else if("function"==typeof e.then)t.push(e.then(curry2(arrayPush,n,__)));else if("function"==typeof e[symbolIterator])for(const r of e)n.push(r);else if("function"==typeof e[symbolAsyncIterator])t.push(asyncIteratorForEach(e[symbolAsyncIterator](),curry2(arrayPush,n,__)));else if("function"==typeof e.chain){const r=e.chain(identity);isPromise(r)?t.push(r.then(curry2(arrayPush,n,__))):n.push(r)}else if("function"==typeof e.flatMap){const r=e.flatMap(identity);isPromise(r)?t.push(r.then(curry2(arrayPush,n,__))):n.push(r)}else if("function"==typeof e.reduce){const r=e.reduce(funcConcatSync(getArg1,curry2(arrayPush,n,__)),null);isPromise(r)&&t.push(r)}else if(e.constructor==Object)for(const r in e)n.push(e[r]);else n.push(e)}return 0==t.length?n:promiseAll(t).then(always(n))},arrayFlatMap=function(r,e){const t=arrayMap(r,e);return isPromise(t)?t.then(arrayFlatten):arrayFlatten(t)},objectFlatten=function(r){const e=[],t={},n=curry2(objectAssign,t,__),o=funcConcatSync(getArg1,n);for(const s in r){const i=r[s];if(null!=i)if("function"==typeof i[symbolIterator])for(const r of i)objectAssign(t,r);else if("function"==typeof i[symbolAsyncIterator])e.push(asyncIteratorForEach(i[symbolAsyncIterator](),n));else if("function"==typeof i.chain){const r=i.chain(identity);isPromise(r)?e.push(r.then(n)):objectAssign(t,r)}else if("function"==typeof i.flatMap){const r=i.flatMap(identity);isPromise(r)?e.push(r.then(n)):n(r)}else if("function"==typeof i.reduce){const r=i.reduce(o,null);isPromise(r)&&e.push(r)}else objectAssign(t,i)}return 0==e.length?t:promiseAll(e).then((()=>t))},objectFlatMap=function(r,e){const t=objectMap(r,e);return isPromise(t)?t.then(objectFlatten):objectFlatten(t)},setFlatten=function(r){r.size;const e=[],t=new Set,n=(r,e)=>t.add(e),o=curry3(callPropUnary,t,"add",__);for(const s of r)if(isArray(s)){const r=s.length;let e=-1;for(;++e<r;)t.add(s[e])}else if(null==s)t.add(s);else if("function"==typeof s[symbolIterator])for(const r of s)t.add(r);else if("function"==typeof s[symbolAsyncIterator])e.push(asyncIteratorForEach(s[symbolAsyncIterator](),o));else if("function"==typeof s.chain){const r=s.chain(identity);isPromise(r)?e.push(r.then(o)):t.add(r)}else if("function"==typeof s.flatMap){const r=s.flatMap(identity);isPromise(r)?e.push(r.then(o)):t.add(r)}else if("function"==typeof s.reduce){const r=s.reduce(n,null);isPromise(r)&&e.push(r)}else if(s.constructor==Object)for(const r in s)t.add(s[r]);else t.add(s);return 0==e.length?t:promiseAll(e).then((()=>t))},setFlatMap=function(r,e){const t=setMap(r,e);return isPromise(t)?t.then(setFlatten):setFlatten(t)},arrayJoin=(r,e)=>r.join(e),arrayFlattenToString=funcConcat(arrayFlatten,curry2(arrayJoin,__,"")),stringFlatMap=function(r,e){const t=arrayMap(r,e);return isPromise(t)?t.then(arrayFlattenToString):arrayFlattenToString(t)},_flatMap=function(r,e){if(isArray(r))return arrayFlatMap(r,e);if(null==r)return e(r);if("function"==typeof r.then)return r.then(e);if("function"==typeof r.next)return symbolIterator in r?FlatMappingIterator(r,e):FlatMappingAsyncIterator(r,e);if("function"==typeof r.chain)return r.chain(e);if("function"==typeof r.flatMap)return r.flatMap(e);const t=r.constructor;return t==Object?objectFlatMap(r,e):t==Set?setFlatMap(r,e):"string"==typeof r||t==String?stringFlatMap(r,e):e(r)},flatMap=(...r)=>{const e=r.pop();if(0==r.length)return curry2(_flatMap,__,e);const t=r[0];return isPromise(t)?t.then(curry2(_flatMap,__,e)):_flatMap(r[0],e)},arrayForEach=function(r,e){const t=r.length,n=[];let o=-1;for(;++o<t;){const t=e(r[o]);isPromise(t)&&n.push(t)}return 0==n.length?r:promiseAll(n).then(always(r))},objectForEach=function(r,e){const t=[];for(const n in r){const o=e(r[n]);isPromise(o)&&t.push(o)}return 0==t.length?r:promiseAll(t).then(always(r))},iteratorForEach=function(r,e){const t=[];for(const n of r){const r=e(n);isPromise(r)&&t.push(r)}return 0==t.length?r:promiseAll(t).then(always(r))},_forEach=function(r,e){return isArray(r)?arrayForEach(r,e):null==r?r:"function"==typeof r.forEach?r.forEach(e):"function"==typeof r[symbolIterator]?iteratorForEach(r[symbolIterator](),e):"function"==typeof r[symbolAsyncIterator]?asyncIteratorForEach(r[symbolAsyncIterator](),e):r.constructor==Object?objectForEach(r,e):r},forEach=function(...r){const e=r.pop();if(0==r.length)return curry2(_forEach,__,e);const t=r[0];return isPromise(t)?t.then(curry2(_forEach,__,e)):_forEach(t,e)},SelfReferencingPromise=function(r){const e=r.then((r=>[r,e]));return e},asyncArraySome=async function(r,e,t,n){const o=r.length;for(;++t<o;){const o=e(r[t]);if(isPromise(o))n.add(SelfReferencingPromise(o));else if(o)return!0}for(;n.size>0;){const[r,e]=await promiseRace(n);if(n.delete(e),r)return!0}return!1},arraySome=function(r,e){const t=r.length;let n=-1;for(;++n<t;){const t=e(r[n]);if(isPromise(t))return asyncArraySome(r,e,n,new Set([SelfReferencingPromise(t)]));if(t)return!0}return!1},asyncIteratorSome=async function(r,e,t,n=20){let o=r.next();for(isPromise(o)&&(o=await o);!o.done;){if(t.size>=n){const[r,e]=await promiseRace(t);if(t.delete(e),r)return!0}const s=e(o.value);if(isPromise(s))t.add(SelfReferencingPromise(s));else if(s)return!0;o=r.next(),isPromise(o)&&(o=await o)}for(;t.size>0;){const[r,e]=await promiseRace(t);if(t.delete(e),r)return!0}return!1},iteratorSome=function(r,e){for(const t of r){const n=e(t);if(isPromise(n))return asyncIteratorSome(r,e,new Set([SelfReferencingPromise(n)]));if(n)return!0}return!1},reducerAnySync=r=>function(e,t){return!!e||r(t)},reducerSome=r=>function(e,t){return!0===e?e:isPromise(e)?e.then(curry2(reducerAnySync(r),__,t)):!!e||r(t)},_some=function(r,e){return isArray(r)?arraySome(r,e):null==r?e(r):"function"==typeof r[symbolIterator]?iteratorSome(r[symbolIterator](),e):"function"==typeof r[symbolAsyncIterator]?asyncIteratorSome(r[symbolAsyncIterator](),e,new Set):"function"==typeof r.reduce?r.reduce(reducerSome(e),!1):r.constructor==Object?arraySome(objectValues(r),e):e(r)},some=function(...r){const e=r.pop();if(0==r.length)return curry2(_some,__,e);const t=r[0];return isPromise(t)?t.then(curry2(_some,__,e)):_some(t,e)},arrayEvery=function(r,e){const t=r.length,n=[];let o=-1;for(;++o<t;){const t=e(r[o]);if(isPromise(t))n.push(t);else if(!t)return!1}return 0==n.length||promiseAll(n).then(curry3(callPropUnary,__,"every",Boolean))},iteratorEvery=function(r,e){const t=[];for(const n of r){const r=e(n);if(isPromise(r))t.push(r);else if(!r)return!1}return 0==t.length||promiseAll(t).then(curry3(callPropUnary,__,"every",Boolean))},asyncIteratorEvery=async function(r,e,t,n=20){let o=await r.next();for(;!o.done;){if(t.size>=n){const[r,e]=await promiseRace(t);if(t.delete(e),!r)return!1}const s=e(o.value);if(isPromise(s))t.add(SelfReferencingPromise(s));else if(!s)return!1;o=await r.next()}for(;t.size>0;){const[r,e]=await promiseRace(t);if(t.delete(e),!r)return!1}return!0},reducerAllSync=(r,e,t)=>!!e&&r(t),reducerEvery=r=>function(e,t){return!1!==e&&(isPromise(e)?e.then(curry3(reducerAllSync,r,__,t)):!!e&&r(t))},_every=function(r,e){return isArray(r)?arrayEvery(r,e):null==r?e(r):"function"==typeof r[symbolIterator]?iteratorEvery(r[symbolIterator](),e):"function"==typeof r[symbolAsyncIterator]?asyncIteratorEvery(r[symbolAsyncIterator](),e,new Set):"function"==typeof r.reduce?r.reduce(reducerEvery(e),!0):r.constructor==Object?arrayEvery(objectValues(r),e):e(r)},every=function(...r){const e=r.pop();if(0==r.length)return curry2(_every,__,e);const t=r[0];return isPromise(t)?t.then(curry2(_every,__,e)):_every(t,e)},areAllValuesTruthy=function(r,e){const t=r.length;for(;++e<t;){const t=r[e];if(isPromise(t))return t.then(curry3(thunkConditional,__,thunkify2(areAllValuesTruthy,r,e),always(!1)));if(!t)return!1}return!0},asyncArePredicatesAllTruthy=async function(r,e,t){const n=e.length;for(;++t<n;){let n=e[t];if("function"==typeof n&&(n=n(...r)),isPromise(n)&&(n=await n),!n)return!1}return!0},areAllPredicatesTruthy=function(r,e){const t=e.length;let n=-1;for(;++n<t;){let t=e[n];if("function"==typeof t&&(t=t(...r)),isPromise(t))return t.then(curry3(thunkConditional,__,thunkify3(asyncArePredicatesAllTruthy,r,e,n),always(!1)));if(!t)return!1}return!0},and=function(...r){const e=r.pop();return areAllValuesNonfunctions(e)?areAllValuesTruthy(e,-1):0==r.length?curryArgs2(areAllPredicatesTruthy,__,e):areAnyValuesPromises(r)?promiseAll(r).then(curry2(areAllPredicatesTruthy,__,e)):areAllPredicatesTruthy(r,e)},areAnyNonfunctionsTruthy=function(r,e){const t=r.length;for(;++e<t;){const t=r[e];if(isPromise(t))return t.then(curry3(thunkConditional,__,always(!0),thunkify2(areAnyNonfunctionsTruthy,r,e)));if(t)return!0}return!1},asyncAreAnyPredicatesTruthy=async function(r,e,t){const n=e.length;for(;++t<n;){let n=e[t];if("function"==typeof n&&(n=n(...r)),isPromise(n)&&(n=await n),n)return!0}return!1},areAnyPredicatesTruthy=function(r,e){const t=e.length;let n=-1;for(;++n<t;){let t=e[n];if("function"==typeof t&&(t=t(...r)),isPromise(t))return t.then(curry3(thunkConditional,__,always(!0),thunkify3(asyncAreAnyPredicatesTruthy,r,e,n)));if(t)return!0}return!1},or=function(...r){const e=r.pop();return areAllValuesNonfunctions(e)?areAnyNonfunctionsTruthy(e,-1):0==r.length?curryArgs2(areAnyPredicatesTruthy,__,e):areAnyValuesPromises(r)?promiseAll(r).then(curry2(areAnyPredicatesTruthy,__,e)):areAnyPredicatesTruthy(r,e)},negate=r=>!r,_not=function(r,e){const t=e(...r);return isPromise(t)?t.then(negate):!t},not=function(...r){const e=r.pop();return"function"==typeof e?0==r.length?curryArgs2(_not,__,e):areAnyValuesPromises(r)?promiseAll(r).then(curry2(_not,__,e)):_not(r,e):!e},curryArgs4ResolveArgs0=(r,e,t,n)=>function(...o){return r(o,e,t,n)},curryArgs4ResolveArgs1=(r,e,t,n)=>function(...o){return r(e,o,t,n)},curryArgs4ResolveArgs2=(r,e,t,n)=>function(...o){return r(e,t,o,n)},curryArgs4ResolveArgs3=(r,e,t,n)=>function(...o){return r(e,t,n,o)},curryArgs4=function(r,e,t,n,o){return e==__?curryArgs4ResolveArgs0(r,t,n,o):t==__?curryArgs4ResolveArgs1(r,e,n,o):n==__?curryArgs4ResolveArgs2(r,e,t,o):curryArgs4ResolveArgs3(r,e,t,n)},leftResolverRightResolverCompare=function(r,e,t,n){const o=t(...r),s=n(...r);return isPromise(o)||isPromise(s)?promiseAll([o,s]).then(spread2(e)):e(o,s)},leftResolverRightValueCompare=function(r,e,t,n){const o=t(...r);return isPromise(o)||isPromise(n)?promiseAll([o,n]).then(spread2(e)):e(o,n)},leftValueRightResolverCompare=function(r,e,t,n){const o=n(...r);return isPromise(t)||isPromise(o)?promiseAll([t,o]).then(spread2(e)):e(t,o)},ComparisonOperator=r=>function(...e){const t=e.pop(),n=e.pop(),o="function"==typeof n,s="function"==typeof t;return o&&s?0==e.length?curryArgs4(leftResolverRightResolverCompare,__,r,n,t):areAnyValuesPromises(e)?promiseAll(e).then(curry4(leftResolverRightResolverCompare,__,r,n,t)):leftResolverRightResolverCompare(e,r,n,t):o?0==e.length?curryArgs4(leftResolverRightValueCompare,__,r,n,t):areAnyValuesPromises(e)?promiseAll(e).then(curry4(leftResolverRightValueCompare,__,r,n,t)):leftResolverRightValueCompare(e,r,n,t):s?0==e.length?curryArgs4(leftValueRightResolverCompare,__,r,n,t):areAnyValuesPromises(e)?promiseAll(e).then(curry4(leftValueRightResolverCompare,__,r,n,t)):leftValueRightResolverCompare(e,r,n,t):isPromise(n)||isPromise(t)?promiseAll([n,t]).then(spread2(r)):r(n,t)},equals=function(r,e){return r==e},eq=ComparisonOperator(equals),greaterThan=(r,e)=>r>e,gt=ComparisonOperator(greaterThan),lessThan=(r,e)=>r<e,lt=ComparisonOperator(lessThan),greaterThanOrEqual=(r,e)=>r>=e,gte=ComparisonOperator(greaterThanOrEqual),lessThanOrEqual=(r,e)=>r<=e,lte=ComparisonOperator(lessThanOrEqual),memoizeCappedUnary=function(r,e){const t=new Map,n=function(n){if(t.has(n))return t.get(n);const o=r(n);return t.set(n,o),t.size>e&&t.clear(),o};return n.cache=t,n},pathDelimiters=/[.|[|\]]+/,parsePropertyPath=function(r){const e=r.length-1,t="["==r[0],n="]"==r[e];return t&&n?r.slice(1,e).split(pathDelimiters):t?r.slice(1).split(pathDelimiters):n?r.slice(0,e).split(pathDelimiters):r.split(pathDelimiters)},memoizedCappedParsePropertyPath=memoizeCappedUnary(parsePropertyPath,500),propertyPathToArray=r=>isArray(r)?r:"string"==typeof r?memoizedCappedParsePropertyPath(r):[r],getByPath=function(r,e){const t=propertyPathToArray(e),n=t.length;let o=-1,s=r;for(;++o<n;)if(s=s[t[o]],null==s)return;return s},_get=function(r,e,t){const n=null==r?void 0:getByPath(r,e);return void 0===n?"function"==typeof t?t(r):t:n},get=function(r,e,t){return"string"==typeof r||"number"==typeof r||isArray(r)?curry3(_get,__,r,e):isPromise(r)?r.then(curry3(_get,__,e,t)):_get(r,e,t)},setByPath=function(r,e,t){if(!isObject(r))return r;const n=propertyPathToArray(t),o=n.length,s=o-1,i={...r};let c=i,u=-1;for(;++u<o;){const r=n[u];if(u==s)c[r]=e;else{const e=c[r],t=isArray(e)?e.slice():{...e};c[r]=t,c=t}}return i},_set=function(r,e,t){if("function"==typeof t){const n=t(r);return isPromise(n)?n.then(curry3(setByPath,r,__,e)):setByPath(r,n,e)}return isPromise(t)?t.then(curry3(setByPath,r,__,e)):setByPath(r,t,e)},set=function(r,e,t){return null==t?curry3(_set,__,r,e):isPromise(r)?r.then(curry3(_set,__,e,t)):_set(r,e,t)},_pick=function(r,e){if(null==r)return r;const t=e.length;let n={},o=-1;for(;++o<t;){const t=e[o],s=getByPath(r,t);null!=s&&(n=setByPath(n,s,t))}return n},pick=function(r,e){return null==e?curry2(_pick,__,r):isPromise(r)?r.then(curry2(_pick,__,e)):_pick(r,e)},deleteByPath=function(r,e){if(null==r)return;const t=propertyPathToArray(e),n=t.length-1;let o=-1,s=r;for(;++o<n;)if(s=s[t[o]],null==s)return;const i=t[o];null!=s&&i in s&&delete s[i]},objectCopyDeep=function(r){const e={};for(const t in r){const n=r[t];isArray(n)?e[t]=arrayCopyDeep(n):null!=n&&n.constructor==Object?e[t]=objectCopyDeep(n):e[t]=n}return e},arrayCopyDeep=function(r){const e=r.length,t=[];let n=-1;for(;++n<e;){const e=r[n];isArray(e)?t[n]=arrayCopyDeep(e):null!=e&&e.constructor==Object?t[n]=objectCopyDeep(e):t[n]=e}return t},copyDeep=function(r){return isArray(r)?arrayCopyDeep(r):null==r?r:r.constructor==Object?objectCopyDeep(r):r},_omit=function(r,e){const t=e.length,n=isArray(o=r)?arrayCopyDeep(o):null==o?o:o.constructor==Object?objectCopyDeep(o):o;var o;let s=-1;for(;++s<t;)deleteByPath(n,e[s]);return n},omit=function(r,e){return null==e?curry2(_omit,__,r):isPromise(r)?r.then(curry2(_omit,__,e)):_omit(r,e)},thunkify=(r,...e)=>function(){return areAnyValuesPromises(e)?promiseAll(e).then(curry2(funcApply,r,__)):r(...e)},curry=(r,...e)=>curryArity(r.length,r,e);curry.arity=function(r,e,...t){return curryArity(r,e,t)};const rubico={pipe:pipe,compose:compose,tap:tap,forEach:forEach,switchCase:switchCase,tryCatch:tryCatch,all:all,assign:assign,get:get,set:set,pick:pick,omit:omit,map:map,filter:filter,flatMap:flatMap,reduce:reduce,transform:transform,and:and,or:or,not:not,some:some,every:every,eq:eq,gt:gt,lt:lt,gte:gte,lte:lte,thunkify:thunkify,always:always,curry:curry,__:__};export{pipe,compose,tap,forEach,switchCase,tryCatch,all,assign,get,set,pick,omit,map,filter,reduce,transform,flatMap,and,or,not,some,every,eq,gt,lt,gte,lte,thunkify,always,curry,__};export default rubico;
|
package/dist/rubico.global.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.3.
|
|
2
|
+
* rubico v2.3.2
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
|
-
* (c) 2019-
|
|
4
|
+
* (c) 2019-2024 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -641,7 +641,7 @@ const arrayMapSeriesAsync = async function (
|
|
|
641
641
|
) {
|
|
642
642
|
const arrayLength = array.length
|
|
643
643
|
while (++index < arrayLength) {
|
|
644
|
-
const resultItem = mapper(array[index])
|
|
644
|
+
const resultItem = mapper(array[index], index)
|
|
645
645
|
result[index] = isPromise(resultItem) ? await resultItem : resultItem
|
|
646
646
|
}
|
|
647
647
|
return result
|
|
@@ -653,7 +653,7 @@ const arrayMapSeries = function (array, mapper) {
|
|
|
653
653
|
let index = -1
|
|
654
654
|
|
|
655
655
|
while (++index < arrayLength) {
|
|
656
|
-
const resultItem = mapper(array[index])
|
|
656
|
+
const resultItem = mapper(array[index], index)
|
|
657
657
|
if (isPromise(resultItem)) {
|
|
658
658
|
return resultItem.then(funcConcat(
|
|
659
659
|
curry3(objectSet, result, index, __),
|
|
@@ -2589,13 +2589,13 @@ const _get = function (object, path, defaultValue) {
|
|
|
2589
2589
|
}
|
|
2590
2590
|
|
|
2591
2591
|
const get = function (arg0, arg1, arg2) {
|
|
2592
|
+
if (typeof arg0 == 'string' || typeof arg0 == 'number' || isArray(arg0)) {
|
|
2593
|
+
return curry3(_get, __, arg0, arg1)
|
|
2594
|
+
}
|
|
2592
2595
|
if (isPromise(arg0)) {
|
|
2593
2596
|
return arg0.then(curry3(_get, __, arg1, arg2))
|
|
2594
2597
|
}
|
|
2595
|
-
|
|
2596
|
-
return _get(arg0, arg1, arg2)
|
|
2597
|
-
}
|
|
2598
|
-
return curry3(_get, __, arg0, arg1)
|
|
2598
|
+
return _get(arg0, arg1, arg2)
|
|
2599
2599
|
}
|
|
2600
2600
|
|
|
2601
2601
|
const setByPath = function (obj, value, path) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.3.
|
|
2
|
+
* rubico v2.3.2
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
|
-
* (c) 2019-
|
|
4
|
+
* (c) 2019-2024 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
!function(n,t){for(const e in t)n[e]=t[e]}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=n=>null!=n&&"function"==typeof n.then,t=function(t){const e=t.length;let o=-1;for(;++o<e;){const e=t[o];if(n(e))return!0}return!1},e=Promise.all.bind(Promise),o=(t,e)=>function(...o){const r=t(...o);return n(r)?r.then(e):e(r)},r=(n,t)=>n(...t),u=Symbol.for("placeholder"),c=function(n,t,e){return t==u?((n,t)=>function(e){return n(e,t)})(n,e):((n,t)=>function(e){return n(t,e)})(n,t)},f=n=>function(){return n},i=(n,t)=>function(){return n(...t)},s=(n,t,e)=>n?t():e(),l=function(n,t,e,o){return t==u?((n,t,e)=>function(o){return n(o,t,e)})(n,e,o):e==u?((n,t,e)=>function(o){return n(t,o,e)})(n,t,o):((n,t,e)=>function(o){return n(t,e,o)})(n,t,e)},h=function(n,t,e){return t==u?((n,t,e)=>function(...e){return n(e,t)})(n,e):((n,t,e)=>function(...e){return n(t,e)})(n,t)},a=function(t,e){const o=t[0],r=e(...t);return n(r)?r.then(f(o)):o},p=function(...n){const t=n.pop();return 0==n.length?h(a,u,t):a(n,t)};p.if=(t,e)=>function(...o){const r=t(...o);if(n(r))return r.then(l(s,u,i(p(e),o),f(o[0])));if(r){const t=e(...o);if(n(t))return t.then(f(o[0]))}return o[0]};const y=Array.isArray,g=function(t,o){const r=t.length,u=Array(r);let c=-1,f=!1;for(;++c<r;){const e=t[c](...o);n(e)&&(f=!0),u[c]=e}return f?e(u):u},d=function(n,t,e,o,r){return t==u?((n,t,e,o)=>function(r){return n(r,t,e,o)})(n,e,o,r):e==u?((n,t,e,o)=>function(r){return n(t,r,e,o)})(n,t,o,r):o==u?((n,t,e,o)=>function(r){return n(t,e,r,o)})(n,t,e,r):((n,t,e,o)=>function(r){return n(t,e,o,r)})(n,t,e,o)},w=function(n,t,e){return n[t]=e,n},v=async function(t,e,o,r){const u=t.length;for(;++r<u;){const u=t[r](...e);o[r]=n(u)?await u:u}return o},b=function(t,e){const r=t.length,c=[];let f=-1;for(;++f<r;){const r=t[f](...e);if(n(r))return r.then(o(l(w,c,f,u),d(v,t,e,u,f)));c[f]=r}return c},j=function(t,o){const r={},c=[];for(const e in t){const f=t[e](...o);n(f)?c.push(f.then(l(w,r,e,u))):r[e]=f}return 0==c.length?r:e(c).then(f(r))},x=function(...n){const o=n.pop();return 0==n.length?y(o)?h(g,o,u):h(j,o,u):t(n)?y(o)?e(n).then(c(g,o,u)):e(n).then(c(j,o,u)):y(o)?g(o,n):j(o,n)};x.series=function(...n){const o=n.pop();return 0==n.length?h(b,o,u):t(n)?e(n).then(c(b,o,u)):b(o,n)};const S=Object.assign,M=function(t,e){const o=j(e,[t]);return n(o)?o.then(l(S,{},t,u)):{...t,...o}},O=function(n,t,e){return n(t,...e)},m=function(t,e,o){try{const r=t(...o);return n(r)?r.catch(l(O,e,u,o)):r}catch(n){return e(n,...o)}},A=(n,t,e,o)=>function(){return n(t,e,o)},z=function(t,e,o){const r=t.length-1;for(;(o+=2)<r;){const r=t[o],c=t[o+1],h="function"==typeof r?r(...e):r;if(n(h))return h.then(l(s,u,"function"==typeof c?i(c,e):f(c),A(z,t,e,o)));if(h)return"function"==typeof c?c(...e):c}if(o==t.length)return;const c=t[r];return"function"==typeof c?c(...e):c},I=function(n){const t=n.length;let e=-1;for(;++e<t;)if("function"==typeof n[e])return!1;return!0},E=(n,t,e)=>function(){return n(t,e)},D=function(t,e){const o=t.length,r=o-1;for(;(e+=2)<r;){const o=t[e],r=t[e+1];if(n(o))return o.then(l(s,u,f(r),E(D,t,e)));if(o)return r}if(e!=o)return t[e]},P=Symbol.iterator,T=(n,t)=>({toString:()=>"[object MappingIterator]",[P](){return this},next(){const e=n.next();return e.done?e:{value:t(e.value),done:!1}}}),B=n=>({value:n,done:!1}),k=Symbol.asyncIterator,C=(t,e)=>({[k](){return this},async next(){const o=await t.next();if(o.done)return o;const r=e(o.value);return n(r)?r.then(B):{value:r,done:!1}}}),$=n=>{if(null==n)return!1;const t=typeof n;return"object"==t||"function"==t},_=function(t,o){const r=t.length,u=Array(r);let c=-1,f=!1;for(;++c<r;){const e=o(t[c],c,t);n(e)&&(f=!0),u[c]=e}return f?e(u):u},q=(n,t,e)=>n[t](e),F=function(t,o){const r=new Set,c=[];for(const e of t){const f=o(e,e,t);n(f)?c.push(f.then(l(q,r,"add",u))):r.add(f)}return 0==c.length?r:e(c).then(f(r))},R=(n,t,e,o)=>n[t](e,o),V=t=>new Promise((t=>function(e){const o={};let r=0;for(const u in t){const c=t[u];n(c)?(r+=1,c.then((n=>function(t){o[n]=t,r-=1,0==r&&e(o)})(u))):o[u]=c}0==r&&e(o)})(t)),G=function(t,e){const o={};let r=!1;for(const u in t){const c=e(t[u],u,t);n(c)&&(r=!0),o[u]=c}return r?V(o):o},H=async function(t,e,o,r){const u=t.length;for(;++r<u;){const u=e(t[r]);o[r]=n(u)?await u:u}return o},J=n=>function(...t){return n(...t),t[0]},K=Promise.race.bind(Promise),L=async function(t,o,r,u,c,f){const i=t.length;for(;++c<i;){f.size>=r&&await K(f);const e=o(t[c]);if(n(e)){const n=e.then(J((()=>f.delete(n))));f.add(n),u[c]=n}else u[c]=e}return e(u)},N=(n,t,e)=>function(...o){const r=e.length,c=o.length,f=[];let i=-1,s=-1,l=0;for(;++i<r;){const r=e[i];if(r==u&&(s+=1)<c){const n=o[s];n==u&&(l+=1),f.push(n)}else f.push(r);if(f.length==n)return 0==l?t(...f):Q(n,t,f)}for(;++s<c;){const e=o[s];if(e==u&&(l+=1),f.push(e),f.length==n)return 0==l?t(...f):Q(n,t,f)}return Q(n,t,f)},Q=function(n,t,e){const o=e.length;if(o<n)return N(n,t,e);let r=-1;for(;++r<o;){if(e[r]==u)return N(n,t,e)}return t(...e)},U=n=>function([t,e]){return n(t,e)},W=function(n,t,e){return n.set(t,e)},X=function(t,o){const r=new Map,u=[];return t.forEach(((t,e,o)=>function(r,u){const c=t([u,r]);n(c)?o.push(c.then(U(Q(3,W,[e])))):e.set(c[0],c[1])})(o,r,u)),0==u.length?r:e(u).then(f(r))},Y=function(t,o){return y(t)?_(t,o):null==t?t:"function"==typeof t.then?t.then(o):"function"==typeof t.map?t.map(o):"string"==typeof t||t.constructor==String?function(t,e){const o=_(t,e);return n(o)?o.then(l(q,u,"join","")):o.join("")}(t,o):t.constructor==Set?F(t,o):t.constructor==Map?function(t,o){const r=new Map,c=[];for(const[e,f]of t){const i=o(f,e,t);n(i)?c.push(i.then(d(R,r,"set",e,u))):r.set(e,i)}return 0==c.length?r:e(c).then(f(r))}(t,o):"function"==typeof t[P]?T(t[P](),o):"function"==typeof t[k]?C(t[k](),o):t.constructor==Object?G(t,o):o(t)},Z=(...t)=>{const e=t.pop();if(0==t.length)return c(Y,u,e);const o=t[0];return n(o)?o.then(c(Y,u,e)):Y(o,e)};Z.entries=function(t){return function(o){if(null==o)throw new TypeError("value is not an Object or Map");if(o.constructor==Object)return function(t,o){const r={},u=[];for(const e in t){const c=o([e,t[e]]);n(c)?u.push(c.then(U(Q(3,w,[r])))):r[c[0]]=c[1]}return 0==u.length?r:e(u).then(f(r))}(o,t);if(o.constructor==Map)return X(o,t);throw new TypeError("value is not an Object or Map")}},Z.series=t=>function(e){if(y(e))return function(t,e){const r=t.length,c=Array(r);let f=-1;for(;++f<r;){const r=e(t[f]);if(n(r))return r.then(o(l(w,c,f,u),d(H,t,e,u,f)));c[f]=r}return c}(e,t);throw new TypeError(`${e} is not an Array`)},Z.pool=(t,e)=>function(o){if(y(o))return function(t,e,o){const r=t.length,u=Array(r);let c=-1;for(;++c<r;){const r=e(t[c]);if(n(r)){const n=new Set,f=r.then(J((()=>n.delete(f))));return n.add(f),u[c]=f,L(t,e,o,u,c,n)}u[c]=r}return u}(o,e,t);throw new TypeError(`${o} is not an Array`)};const nn=(n,t)=>({[P](){return this},next(){let e=n.next();for(;!e.done;){const{value:o}=e;if(t(o))return{value:o,done:!1};e=n.next()}return e}}),tn=(t,e)=>({isAsyncIteratorDone:!1,[k](){return this},async next(){for(;!this.isAsyncIteratorDone;){const{value:o,done:r}=await t.next();if(r)this.isAsyncIteratorDone=!0;else{const t=e(o);if(n(t)?await t:t)return{value:o,done:!1}}}return{value:void 0,done:!0}}}),en=function(n,t,e,o){const r=t.length;let u=n.length-1;for(;++o<r;)n[++u]=e(t[o],o,n);return n},on=function(n,t,e,o){const r=n.length;let u=-1;for(;++e<r;)o[++u]&&t.push(n[e]);return t},rn=function(t,o){const r=t.length,c=[];let f=-1,i=-1;for(;++f<r;){const r=t[f],s=o(r,f,t);if(n(s))return e(en([s],t,o,f)).then(d(on,t,c,f-1,u));s&&(c[++i]=r)}return c},un=(n,t)=>function(){return n(t)},cn=function(){},fn=(n,t,e,o,r)=>function(){return n(t,e,o,r)},sn=function(n,t,e,o){o&&(n[t]=e)},ln=function(t,o){return y(t)?rn(t,o):null==t?t:"string"==typeof t||t.constructor==String?function(t,e){const o=rn(t,e);return n(o)?o.then(l(q,u,"join","")):o.join("")}(t,o):t.constructor==Set?function(t,o){const r=new Set,c=r.add.bind(r),i=[];for(const e of t){const f=o(e,e,t);n(f)?i.push(f.then(l(s,u,un(c,e),cn))):f&&r.add(e)}return 0==i.length?r:e(i).then(f(r))}(t,o):t.constructor==Map?function(t,o){const r=new Map,c=[];for(const[e,f]of t){const i=o(f,e,t);n(i)?c.push(i.then(l(s,u,fn(R,r,"set",e,f),cn))):i&&r.set(e,f)}return 0==c.length?r:e(c).then(f(r))}(t,o):"function"==typeof t.filter?t.filter(o):"function"==typeof t[P]?nn(t[P](),o):"function"==typeof t[k]?tn(t[k](),o):t.constructor==Object?function(t,o){const r={},c=[];for(const e in t){const f=t[e],i=o(f,e,t);n(i)?c.push(i.then(d(sn,r,e,t[e],u))):i&&(r[e]=f)}return 0==c.length?r:e(c).then(f(r))}(t,o):t},hn=Object.values,an=(Object.prototype.toString,async function(t,e,o){let r=t.next();if(r.done)return o;for(;!r.done;)o=e(o,r.value),n(o)&&(o=await o),r=t.next();return o}),pn=async function(t,e,o,r){const u=t.length;for(;++r<u;)o=e(o,t[r],r,t),n(o)&&(o=await o);return o},yn=Object.keys,gn=async function(t,e,o,r,u){const c=r.length;for(;++u<c;){const c=r[u];o=e(o,t[c],c,t),n(o)&&(o=await o)}return o},dn=async function(t,e,o,r){for(const[u,c]of r)o=e(o,c,u,t),n(o)&&(o=await o);return o},wn=function(t,e,o){return y(t)?function(t,e,o){const r=t.length;let c=-1;for(void 0===o&&(o=t[++c]);++c<r;)if(o=e(o,t[c],c,t),n(o))return o.then(d(pn,t,e,u,c));return o}(t,e,o):null==t?void 0===o?c(e,t,u):e(o,t):t.constructor==Map?function(t,e,o){const r=t.entries();if(void 0===o){const n=r.next();if(n.done)return o;o=n.value[1]}for(const[c,f]of r)if(o=e(o,f,c,t),n(o))return o.then(d(dn,t,e,u,r));return o}(t,e,o):"function"==typeof t[P]?function(t,e,o){let r=t.next();if(r.done)return o;for(void 0===o&&(o=r.value,r=t.next());!r.done;){if(o=e(o,r.value),n(o))return o.then(l(an,t,e,u));r=t.next()}return o}(t[P](),e,o):"function"==typeof t[k]?async function(n,t,e){let o=await n.next();if(o.done)return e;for(void 0===e&&(e=o.value,o=await n.next());!o.done;)e=await t(e,o.value),o=await n.next();return e}(t[k](),e,o):"function"==typeof t.reduce?t.reduce(e,o):"function"==typeof t.chain?t.chain(c(e,o,u)):"function"==typeof t.flatMap?t.flatMap(c(e,o,u)):t.constructor==Object?function(t,e,o){const r=yn(t),c=r.length;let f=-1;for(void 0===o&&(o=t[r[++f]]);++f<c;){const c=r[f];if(o=e(o,t[c],c,t),n(o))return o.then((i=gn,l=e,h=u,a=r,p=f,(s=t)==u?((n,t,e,o,r)=>function(u){return n(u,t,e,o,r)})(i,l,h,a,p):l==u?((n,t,e,o,r)=>function(u){return n(t,u,e,o,r)})(i,s,h,a,p):h==u?((n,t,e,o,r)=>function(u){return n(t,e,u,o,r)})(i,s,l,a,p):a==u?((n,t,e,o,r)=>function(u){return n(t,e,o,u,r)})(i,s,l,h,p):((n,t,e,o,r)=>function(u){return n(t,e,o,r,u)})(i,s,l,h,a)))}var i,s,l,h,a,p;return o}(t,e,o):void 0===o?c(e,t,u):e(o,t)},vn=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(wn,t,e,u)):wn(t,e,r)}return n(o)?o.then(l(wn,t,e,u)):wn(t,e,o)},bn=ArrayBuffer.isView,jn=function(n,t){return y(t)||bn(t)?function(n,t){const e=n.length,o=t.length;let r=-1;for(;++r<o;)n[e+r]=t[r];return n}(n,t):(n.push(t),n)},xn="function"==typeof Buffer,Sn=xn?Buffer.alloc:cn,Mn=function(n,t){const e=n.length,o=xn&&n.constructor==Buffer?Sn(e+t.length):new n.constructor(e+t.length);return o.set(n),o.set(t,e),o},On=function(n,t){return y(t)||bn(t)?Mn(n,t):Mn(n,[t])},mn=(n,t)=>new Promise(((n,t)=>function(e,o){t.on("data",(n=>function(t,e,o){return n.write(t,e,o),n})(n)),t.on("end",un(e,n)),t.on("error",o)})(n,t)),An=function(n,t){return null!=(e=t)&&"function"==typeof e.pipe?mn(n,t):(n.write(t),n);var e},zn=function(n,t){if(null!=t&&t.constructor==Set){for(const e of t)n.add(e);return n}return n.add(t)},In=function(n,t){return n.concat(t)},En=function(t,e,o){const r=wn(t,e(cn),null);return n(r)?r.then(f(o)):o},Dn=function(t,e,o){if(y(o))return wn(t,e(jn),o);if(bn(o)){const r=wn(t,e(jn),[]);return n(r)?r.then(c(On,o,u)):On(o,r)}if(null==o)return En(t,e,o);const r=o.constructor;if("string"==typeof o||r==String){const r=wn(t,e(jn),[o]);return n(r)?r.then(l(q,u,"join","")):r.join("")}return"function"==typeof o.concat?wn(t,e(In),o):"function"==typeof o.write?wn(t,e(An),o):r==Set?wn(t,e(zn),o):r==Object?wn(t,e(S),o):En(t,e,o)},Pn=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(Dn,t,e,u)):Dn(t,e,r)}return n(o)?o.then(l(Dn,t,e,u)):Dn(t,e,o)},Tn=function(n,t){return n.push(t),n},Bn=n=>new Promise((t=>{setTimeout(t,n)})),kn=(n,t)=>t,Cn=n=>n,$n=(n,t)=>function(...e){return t(n(...e))},_n=async function(t,o){const r=[];for await(const e of t){const t=o(e);n(t)&&r.push(t)}return 0==r.length?t:e(r).then(f(t))},qn=function(t){const o=t.length,r=[],i=[];let s=-1;for(;++s<o;){const e=t[s];if(y(e)){const n=e.length;let t=-1;for(;++t<n;)i.push(e[t])}else if(null==e)i.push(e);else if("function"==typeof e.then)r.push(e.then(c(Tn,i,u)));else if("function"==typeof e[P])for(const n of e)i.push(n);else if("function"==typeof e[k])r.push(_n(e[k](),c(Tn,i,u)));else if("function"==typeof e.chain){const t=e.chain(Cn);n(t)?r.push(t.then(c(Tn,i,u))):i.push(t)}else if("function"==typeof e.flatMap){const t=e.flatMap(Cn);n(t)?r.push(t.then(c(Tn,i,u))):i.push(t)}else if("function"==typeof e.reduce){const t=e.reduce($n(kn,c(Tn,i,u)),null);n(t)&&r.push(t)}else if(e.constructor==Object)for(const n in e)i.push(e[n]);else i.push(e)}return 0==r.length?i:e(r).then(f(i))},Fn=function(t){const o=[],r={},f=c(S,r,u),i=$n(kn,f);for(const e in t){const u=t[e];if(null!=u)if("function"==typeof u[P])for(const n of u)S(r,n);else if("function"==typeof u[k])o.push(_n(u[k](),f));else if("function"==typeof u.chain){const t=u.chain(Cn);n(t)?o.push(t.then(f)):S(r,t)}else if("function"==typeof u.flatMap){const t=u.flatMap(Cn);n(t)?o.push(t.then(f)):f(t)}else if("function"==typeof u.reduce){const t=u.reduce(i,null);n(t)&&o.push(t)}else S(r,u)}return 0==o.length?r:e(o).then((()=>r))},Rn=function(t){t.size;const o=[],r=new Set,c=(n,t)=>r.add(t),f=l(q,r,"add",u);for(const e of t)if(y(e)){const n=e.length;let t=-1;for(;++t<n;)r.add(e[t])}else if(null==e)r.add(e);else if("function"==typeof e[P])for(const n of e)r.add(n);else if("function"==typeof e[k])o.push(_n(e[k](),f));else if("function"==typeof e.chain){const t=e.chain(Cn);n(t)?o.push(t.then(f)):r.add(t)}else if("function"==typeof e.flatMap){const t=e.flatMap(Cn);n(t)?o.push(t.then(f)):r.add(t)}else if("function"==typeof e.reduce){const t=e.reduce(c,null);n(t)&&o.push(t)}else if(e.constructor==Object)for(const n in e)r.add(e[n]);else r.add(e);return 0==o.length?r:e(o).then((()=>r))},Vn=o(qn,c(((n,t)=>n.join(t)),u,"")),Gn=function(t,e){if(y(t))return function(t,e){const o=_(t,e);return n(o)?o.then(qn):qn(o)}(t,e);if(null==t)return e(t);if("function"==typeof t.then)return t.then(e);if("function"==typeof t.next)return P in t?function(n,t){let e=[],o=0;return{[P](){return this},next(){if(o<e.length){const n=e[o];return o+=1,{value:n,done:!1}}const r=n.next();if(r.done)return r;const u=wn(t(r.value),Tn,[]);return u.length>1&&(e=u,o=1),{value:u[0],done:!1}}}}(t,e):function(t,e){const o=[],r=new Set;return{isAsyncIteratorDone:!1,[k](){return this},toString:()=>"[object FlatMappingAsyncIterator]",async next(){for(;!this.isAsyncIteratorDone||o.length>0||r.size>0;){if(!this.isAsyncIteratorDone){const{value:c,done:f}=await t.next();if(f)this.isAsyncIteratorDone=f;else{const t=e(c);if(n(t)){const n=t.then(l(wn,u,Tn,o)).then((()=>r.delete(n)));r.add(n)}else{const e=wn(t,Tn,o);if(n(e)){const n=e.then((()=>r.delete(n)));r.add(n)}}}}if(o.length>0)return{value:o.shift(),done:!1};r.size>0&&await K([Bn(1e3),...r])}return{value:void 0,done:!0}}}}(t,e);if("function"==typeof t.chain)return t.chain(e);if("function"==typeof t.flatMap)return t.flatMap(e);const o=t.constructor;return o==Object?function(t,e){const o=G(t,e);return n(o)?o.then(Fn):Fn(o)}(t,e):o==Set?function(t,e){const o=F(t,e);return n(o)?o.then(Rn):Rn(o)}(t,e):"string"==typeof t||o==String?function(t,e){const o=_(t,e);return n(o)?o.then(Vn):Vn(o)}(t,e):e(t)},Hn=function(t,o){return y(t)?function(t,o){const r=t.length,u=[];let c=-1;for(;++c<r;){const e=o(t[c]);n(e)&&u.push(e)}return 0==u.length?t:e(u).then(f(t))}(t,o):null==t?t:"function"==typeof t.forEach?t.forEach(o):"function"==typeof t[P]?function(t,o){const r=[];for(const e of t){const t=o(e);n(t)&&r.push(t)}return 0==r.length?t:e(r).then(f(t))}(t[P](),o):"function"==typeof t[k]?_n(t[k](),o):t.constructor==Object?function(t,o){const r=[];for(const e in t){const u=o(t[e]);n(u)&&r.push(u)}return 0==r.length?t:e(r).then(f(t))}(t,o):t},Jn=function(n){const t=n.then((n=>[n,t]));return t},Kn=async function(t,e,o,r){const u=t.length;for(;++o<u;){const u=e(t[o]);if(n(u))r.add(Jn(u));else if(u)return!0}for(;r.size>0;){const[n,t]=await K(r);if(r.delete(t),n)return!0}return!1},Ln=function(t,e){const o=t.length;let r=-1;for(;++r<o;){const o=e(t[r]);if(n(o))return Kn(t,e,r,new Set([Jn(o)]));if(o)return!0}return!1},Nn=async function(t,e,o,r=20){let u=t.next();for(n(u)&&(u=await u);!u.done;){if(o.size>=r){const[n,t]=await K(o);if(o.delete(t),n)return!0}const c=e(u.value);if(n(c))o.add(Jn(c));else if(c)return!0;u=t.next(),n(u)&&(u=await u)}for(;o.size>0;){const[n,t]=await K(o);if(o.delete(t),n)return!0}return!1},Qn=function(t,e){return y(t)?Ln(t,e):null==t?e(t):"function"==typeof t[P]?function(t,e){for(const o of t){const r=e(o);if(n(r))return Nn(t,e,new Set([Jn(r)]));if(r)return!0}return!1}(t[P](),e):"function"==typeof t[k]?Nn(t[k](),e,new Set):"function"==typeof t.reduce?t.reduce((t=>function(e,o){return!0===e?e:n(e)?e.then(c((n=>function(t,e){return!!t||n(e)})(t),u,o)):!!e||t(o)})(e),!1):t.constructor==Object?Ln(hn(t),e):e(t)},Un=function(t,o){const r=t.length,c=[];let f=-1;for(;++f<r;){const e=o(t[f]);if(n(e))c.push(e);else if(!e)return!1}return 0==c.length||e(c).then(l(q,u,"every",Boolean))},Wn=(n,t,e)=>!!t&&n(e),Xn=function(t,o){return y(t)?Un(t,o):null==t?o(t):"function"==typeof t[P]?function(t,o){const r=[];for(const e of t){const t=o(e);if(n(t))r.push(t);else if(!t)return!1}return 0==r.length||e(r).then(l(q,u,"every",Boolean))}(t[P](),o):"function"==typeof t[k]?async function(t,e,o,r=20){let u=await t.next();for(;!u.done;){if(o.size>=r){const[n,t]=await K(o);if(o.delete(t),!n)return!1}const c=e(u.value);if(n(c))o.add(Jn(c));else if(!c)return!1;u=await t.next()}for(;o.size>0;){const[n,t]=await K(o);if(o.delete(t),!n)return!1}return!0}(t[k](),o,new Set):"function"==typeof t.reduce?t.reduce((t=>function(e,o){return!1!==e&&(n(e)?e.then(l(Wn,t,u,o)):!!e&&t(o))})(o),!0):t.constructor==Object?Un(hn(t),o):o(t)},Yn=function(t,e){const o=t.length;for(;++e<o;){const o=t[e];if(n(o))return o.then(l(s,u,E(Yn,t,e),f(!1)));if(!o)return!1}return!0},Zn=async function(t,e,o){const r=e.length;for(;++o<r;){let r=e[o];if("function"==typeof r&&(r=r(...t)),n(r)&&(r=await r),!r)return!1}return!0},nt=function(t,e){const o=e.length;let r=-1;for(;++r<o;){let o=e[r];if("function"==typeof o&&(o=o(...t)),n(o))return o.then(l(s,u,A(Zn,t,e,r),f(!1)));if(!o)return!1}return!0},tt=function(t,e){const o=t.length;for(;++e<o;){const o=t[e];if(n(o))return o.then(l(s,u,f(!0),E(tt,t,e)));if(o)return!0}return!1},et=async function(t,e,o){const r=e.length;for(;++o<r;){let r=e[o];if("function"==typeof r&&(r=r(...t)),n(r)&&(r=await r),r)return!0}return!1},ot=function(t,e){const o=e.length;let r=-1;for(;++r<o;){let o=e[r];if("function"==typeof o&&(o=o(...t)),n(o))return o.then(l(s,u,f(!0),A(et,t,e,r)));if(o)return!0}return!1},rt=n=>!n,ut=function(t,e){const o=e(...t);return n(o)?o.then(rt):!o},ct=function(n,t,e,o,r){return t==u?((n,t,e,o)=>function(...r){return n(r,t,e,o)})(n,e,o,r):e==u?((n,t,e,o)=>function(...r){return n(t,r,e,o)})(n,t,o,r):o==u?((n,t,e,o)=>function(...r){return n(t,e,r,o)})(n,t,e,r):((n,t,e,o)=>function(...r){return n(t,e,o,r)})(n,t,e,o)},ft=function(t,o,r,u){const c=r(...t),f=u(...t);return n(c)||n(f)?e([c,f]).then(U(o)):o(c,f)},it=function(t,o,r,u){const c=r(...t);return n(c)||n(u)?e([c,u]).then(U(o)):o(c,u)},st=function(t,o,r,u){const c=u(...t);return n(r)||n(c)?e([r,c]).then(U(o)):o(r,c)},lt=o=>function(...r){const c=r.pop(),f=r.pop(),i="function"==typeof f,s="function"==typeof c;return i&&s?0==r.length?ct(ft,u,o,f,c):t(r)?e(r).then(d(ft,u,o,f,c)):ft(r,o,f,c):i?0==r.length?ct(it,u,o,f,c):t(r)?e(r).then(d(it,u,o,f,c)):it(r,o,f,c):s?0==r.length?ct(st,u,o,f,c):t(r)?e(r).then(d(st,u,o,f,c)):st(r,o,f,c):n(f)||n(c)?e([f,c]).then(U(o)):o(f,c)},ht=lt((function(n,t){return n==t})),at=lt(((n,t)=>n>t)),pt=lt(((n,t)=>n<t)),yt=lt(((n,t)=>n>=t)),gt=lt(((n,t)=>n<=t)),dt=/[.|[|\]]+/,wt=function(n,t){const e=new Map,o=function(o){if(e.has(o))return e.get(o);const r=n(o);return e.set(o,r),e.size>t&&e.clear(),r};return o.cache=e,o}((function(n){const t=n.length-1,e="["==n[0],o="]"==n[t];return e&&o?n.slice(1,t).split(dt):e?n.slice(1).split(dt):o?n.slice(0,t).split(dt):n.split(dt)}),500),vt=n=>y(n)?n:"string"==typeof n?wt(n):[n],bt=function(n,t){const e=vt(t),o=e.length;let r=-1,u=n;for(;++r<o;)if(u=u[e[r]],null==u)return;return u},jt=function(n,t,e){const o=null==n?void 0:bt(n,t);return void 0===o?"function"==typeof e?e(n):e:o},xt=function(n,t,e){if(!$(n))return n;const o=vt(e),r=o.length,u=r-1,c={...n};let f=c,i=-1;for(;++i<r;){const n=o[i];if(i==u)f[n]=t;else{const t=f[n],e=y(t)?t.slice():{...t};f[n]=e,f=e}}return c},St=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(xt,t,u,e)):xt(t,r,e)}return n(o)?o.then(l(xt,t,u,e)):xt(t,o,e)},Mt=function(n,t){if(null==n)return n;const e=t.length;let o={},r=-1;for(;++r<e;){const e=t[r],u=bt(n,e);null!=u&&(o=xt(o,u,e))}return o},Ot=function(n,t){if(null==n)return;const e=vt(t),o=e.length-1;let r=-1,u=n;for(;++r<o;)if(u=u[e[r]],null==u)return;const c=e[r];null!=u&&c in u&&delete u[c]},mt=function(n){const t={};for(const e in n){const o=n[e];y(o)?t[e]=At(o):null!=o&&o.constructor==Object?t[e]=mt(o):t[e]=o}return t},At=function(n){const t=n.length,e=[];let o=-1;for(;++o<t;){const t=n[o];y(t)?e[o]=At(t):null!=t&&t.constructor==Object?e[o]=mt(t):e[o]=t}return e},zt=function(n,t){const e=t.length,o=y(r=n)?At(r):null==r?r:r.constructor==Object?mt(r):r;var r;let u=-1;for(;++u<e;)Ot(o,t[u]);return o},It=(n,...t)=>Q(n.length,n,t);It.arity=function(n,t,...e){return Q(n,t,e)};return{pipe:function(...n){const f=n.pop().reduce(o);return 0==n.length?f:t(n)?e(n).then(c(r,f,u)):f(...n)},compose:function(...n){const f=n.pop().reduceRight(o);return 0==n.length?f:t(n)?e(n).then(c(r,f,u)):f(...n)},tap:p,forEach:function(...t){const e=t.pop();if(0==t.length)return c(Hn,u,e);const o=t[0];return n(o)?o.then(c(Hn,u,e)):Hn(o,e)},switchCase:(...n)=>{const o=n.pop();return I(o)?D(o,-2):0==n.length?(r=z,f=u,i=-2,(c=o)==u?((n,t,e)=>function(...o){return n(o,t,e)})(r,f,i):f==u?((n,t,e)=>function(...o){return n(t,o,e)})(r,c,i):((n,t,e)=>function(...o){return n(t,e,o)})(r,c,f)):t(n)?e(n).then(l(z,o,u,-2)):z(o,n,-2);var r,c,f,i},tryCatch:function(...n){if(n.length>2){const o=n.pop(),r=n.pop();return t(n)?e(n).then(l(m,r,o,u)):m(r,o,n)}const o=n[0],r=n[1];return function(...n){return m(o,r,n)}},all:x,assign:function(t,e){return null==e?c(M,u,t):n(t)?t.then(c(M,u,e)):M(t,e)},get:function(t,e,o){return n(t)?t.then(l(jt,u,e,o)):$(t)&&!y(t)?jt(t,e,o):l(jt,u,t,e)},set:function(t,e,o){return null==o?l(St,u,t,e):n(t)?t.then(l(St,u,e,o)):St(t,e,o)},pick:function(t,e){return null==e?c(Mt,u,t):n(t)?t.then(c(Mt,u,e)):Mt(t,e)},omit:function(t,e){return null==e?c(zt,u,t):n(t)?t.then(c(zt,u,e)):zt(t,e)},map:Z,filter:function(...n){const t=n.pop();return 0==n.length?c(ln,u,t):ln(n[0],t)},flatMap:(...t)=>{const e=t.pop();if(0==t.length)return c(Gn,u,e);const o=t[0];return n(o)?o.then(c(Gn,u,e)):Gn(t[0],e)},reduce:function(...t){return"function"==typeof t[0]?l(vn,u,t[0],t[1]):n(t[0])?t[0].then(l(vn,u,t[1],t[2])):vn(t[0],t[1],t[2])},transform:function(...t){return"function"==typeof t[0]?l(Pn,u,t[0],t[1]):n(t[0])?t[0].then(l(Pn,u,t[1],t[2])):Pn(t[0],t[1],t[2])},and:function(...n){const o=n.pop();return I(o)?Yn(o,-1):0==n.length?h(nt,u,o):t(n)?e(n).then(c(nt,u,o)):nt(n,o)},or:function(...n){const o=n.pop();return I(o)?tt(o,-1):0==n.length?h(ot,u,o):t(n)?e(n).then(c(ot,u,o)):ot(n,o)},not:function(...n){const o=n.pop();return"function"==typeof o?0==n.length?h(ut,u,o):t(n)?e(n).then(c(ut,u,o)):ut(n,o):!o},some:function(...t){const e=t.pop();if(0==t.length)return c(Qn,u,e);const o=t[0];return n(o)?o.then(c(Qn,u,e)):Qn(o,e)},every:function(...t){const e=t.pop();if(0==t.length)return c(Xn,u,e);const o=t[0];return n(o)?o.then(c(Xn,u,e)):Xn(o,e)},eq:ht,gt:at,lt:pt,gte:yt,lte:gt,thunkify:(n,...o)=>function(){return t(o)?e(o).then(c(r,n,u)):n(...o)},always:f,curry:It,__:u}}());
|
|
8
|
+
!function(n,t){for(const e in t)n[e]=t[e]}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=n=>null!=n&&"function"==typeof n.then,t=function(t){const e=t.length;let o=-1;for(;++o<e;){const e=t[o];if(n(e))return!0}return!1},e=Promise.all.bind(Promise),o=(t,e)=>function(...o){const r=t(...o);return n(r)?r.then(e):e(r)},r=(n,t)=>n(...t),u=Symbol.for("placeholder"),c=function(n,t,e){return t==u?((n,t)=>function(e){return n(e,t)})(n,e):((n,t)=>function(e){return n(t,e)})(n,t)},f=n=>function(){return n},i=(n,t)=>function(){return n(...t)},s=(n,t,e)=>n?t():e(),l=function(n,t,e,o){return t==u?((n,t,e)=>function(o){return n(o,t,e)})(n,e,o):e==u?((n,t,e)=>function(o){return n(t,o,e)})(n,t,o):((n,t,e)=>function(o){return n(t,e,o)})(n,t,e)},h=function(n,t,e){return t==u?((n,t,e)=>function(...e){return n(e,t)})(n,e):((n,t,e)=>function(...e){return n(t,e)})(n,t)},a=function(t,e){const o=t[0],r=e(...t);return n(r)?r.then(f(o)):o},p=function(...n){const t=n.pop();return 0==n.length?h(a,u,t):a(n,t)};p.if=(t,e)=>function(...o){const r=t(...o);if(n(r))return r.then(l(s,u,i(p(e),o),f(o[0])));if(r){const t=e(...o);if(n(t))return t.then(f(o[0]))}return o[0]};const y=Array.isArray,g=function(t,o){const r=t.length,u=Array(r);let c=-1,f=!1;for(;++c<r;){const e=t[c](...o);n(e)&&(f=!0),u[c]=e}return f?e(u):u},d=function(n,t,e,o,r){return t==u?((n,t,e,o)=>function(r){return n(r,t,e,o)})(n,e,o,r):e==u?((n,t,e,o)=>function(r){return n(t,r,e,o)})(n,t,o,r):o==u?((n,t,e,o)=>function(r){return n(t,e,r,o)})(n,t,e,r):((n,t,e,o)=>function(r){return n(t,e,o,r)})(n,t,e,o)},w=function(n,t,e){return n[t]=e,n},v=async function(t,e,o,r){const u=t.length;for(;++r<u;){const u=t[r](...e);o[r]=n(u)?await u:u}return o},b=function(t,e){const r=t.length,c=[];let f=-1;for(;++f<r;){const r=t[f](...e);if(n(r))return r.then(o(l(w,c,f,u),d(v,t,e,u,f)));c[f]=r}return c},j=function(t,o){const r={},c=[];for(const e in t){const f=t[e](...o);n(f)?c.push(f.then(l(w,r,e,u))):r[e]=f}return 0==c.length?r:e(c).then(f(r))},x=function(...n){const o=n.pop();return 0==n.length?y(o)?h(g,o,u):h(j,o,u):t(n)?y(o)?e(n).then(c(g,o,u)):e(n).then(c(j,o,u)):y(o)?g(o,n):j(o,n)};x.series=function(...n){const o=n.pop();return 0==n.length?h(b,o,u):t(n)?e(n).then(c(b,o,u)):b(o,n)};const S=Object.assign,M=function(t,e){const o=j(e,[t]);return n(o)?o.then(l(S,{},t,u)):{...t,...o}},O=function(n,t,e){return n(t,...e)},m=function(t,e,o){try{const r=t(...o);return n(r)?r.catch(l(O,e,u,o)):r}catch(n){return e(n,...o)}},A=(n,t,e,o)=>function(){return n(t,e,o)},z=function(t,e,o){const r=t.length-1;for(;(o+=2)<r;){const r=t[o],c=t[o+1],h="function"==typeof r?r(...e):r;if(n(h))return h.then(l(s,u,"function"==typeof c?i(c,e):f(c),A(z,t,e,o)));if(h)return"function"==typeof c?c(...e):c}if(o==t.length)return;const c=t[r];return"function"==typeof c?c(...e):c},I=function(n){const t=n.length;let e=-1;for(;++e<t;)if("function"==typeof n[e])return!1;return!0},E=(n,t,e)=>function(){return n(t,e)},D=function(t,e){const o=t.length,r=o-1;for(;(e+=2)<r;){const o=t[e],r=t[e+1];if(n(o))return o.then(l(s,u,f(r),E(D,t,e)));if(o)return r}if(e!=o)return t[e]},P=Symbol.iterator,T=(n,t)=>({toString:()=>"[object MappingIterator]",[P](){return this},next(){const e=n.next();return e.done?e:{value:t(e.value),done:!1}}}),B=n=>({value:n,done:!1}),k=Symbol.asyncIterator,C=(t,e)=>({[k](){return this},async next(){const o=await t.next();if(o.done)return o;const r=e(o.value);return n(r)?r.then(B):{value:r,done:!1}}}),$=function(t,o){const r=t.length,u=Array(r);let c=-1,f=!1;for(;++c<r;){const e=o(t[c],c,t);n(e)&&(f=!0),u[c]=e}return f?e(u):u},_=(n,t,e)=>n[t](e),q=function(t,o){const r=new Set,c=[];for(const e of t){const f=o(e,e,t);n(f)?c.push(f.then(l(_,r,"add",u))):r.add(f)}return 0==c.length?r:e(c).then(f(r))},F=(n,t,e,o)=>n[t](e,o),R=t=>new Promise((t=>function(e){const o={};let r=0;for(const u in t){const c=t[u];n(c)?(r+=1,c.then((n=>function(t){o[n]=t,r-=1,0==r&&e(o)})(u))):o[u]=c}0==r&&e(o)})(t)),V=function(t,e){const o={};let r=!1;for(const u in t){const c=e(t[u],u,t);n(c)&&(r=!0),o[u]=c}return r?R(o):o},G=async function(t,e,o,r){const u=t.length;for(;++r<u;){const u=e(t[r],r);o[r]=n(u)?await u:u}return o},H=n=>function(...t){return n(...t),t[0]},J=Promise.race.bind(Promise),K=async function(t,o,r,u,c,f){const i=t.length;for(;++c<i;){f.size>=r&&await J(f);const e=o(t[c]);if(n(e)){const n=e.then(H((()=>f.delete(n))));f.add(n),u[c]=n}else u[c]=e}return e(u)},L=(n,t,e)=>function(...o){const r=e.length,c=o.length,f=[];let i=-1,s=-1,l=0;for(;++i<r;){const r=e[i];if(r==u&&(s+=1)<c){const n=o[s];n==u&&(l+=1),f.push(n)}else f.push(r);if(f.length==n)return 0==l?t(...f):N(n,t,f)}for(;++s<c;){const e=o[s];if(e==u&&(l+=1),f.push(e),f.length==n)return 0==l?t(...f):N(n,t,f)}return N(n,t,f)},N=function(n,t,e){const o=e.length;if(o<n)return L(n,t,e);let r=-1;for(;++r<o;){if(e[r]==u)return L(n,t,e)}return t(...e)},Q=n=>function([t,e]){return n(t,e)},U=function(n,t,e){return n.set(t,e)},W=function(t,o){const r=new Map,u=[];return t.forEach(((t,e,o)=>function(r,u){const c=t([u,r]);n(c)?o.push(c.then(Q(N(3,U,[e])))):e.set(c[0],c[1])})(o,r,u)),0==u.length?r:e(u).then(f(r))},X=function(t,o){return y(t)?$(t,o):null==t?t:"function"==typeof t.then?t.then(o):"function"==typeof t.map?t.map(o):"string"==typeof t||t.constructor==String?function(t,e){const o=$(t,e);return n(o)?o.then(l(_,u,"join","")):o.join("")}(t,o):t.constructor==Set?q(t,o):t.constructor==Map?function(t,o){const r=new Map,c=[];for(const[e,f]of t){const i=o(f,e,t);n(i)?c.push(i.then(d(F,r,"set",e,u))):r.set(e,i)}return 0==c.length?r:e(c).then(f(r))}(t,o):"function"==typeof t[P]?T(t[P](),o):"function"==typeof t[k]?C(t[k](),o):t.constructor==Object?V(t,o):o(t)},Y=(...t)=>{const e=t.pop();if(0==t.length)return c(X,u,e);const o=t[0];return n(o)?o.then(c(X,u,e)):X(o,e)};Y.entries=function(t){return function(o){if(null==o)throw new TypeError("value is not an Object or Map");if(o.constructor==Object)return function(t,o){const r={},u=[];for(const e in t){const c=o([e,t[e]]);n(c)?u.push(c.then(Q(N(3,w,[r])))):r[c[0]]=c[1]}return 0==u.length?r:e(u).then(f(r))}(o,t);if(o.constructor==Map)return W(o,t);throw new TypeError("value is not an Object or Map")}},Y.series=t=>function(e){if(y(e))return function(t,e){const r=t.length,c=Array(r);let f=-1;for(;++f<r;){const r=e(t[f],f);if(n(r))return r.then(o(l(w,c,f,u),d(G,t,e,u,f)));c[f]=r}return c}(e,t);throw new TypeError(`${e} is not an Array`)},Y.pool=(t,e)=>function(o){if(y(o))return function(t,e,o){const r=t.length,u=Array(r);let c=-1;for(;++c<r;){const r=e(t[c]);if(n(r)){const n=new Set,f=r.then(H((()=>n.delete(f))));return n.add(f),u[c]=f,K(t,e,o,u,c,n)}u[c]=r}return u}(o,e,t);throw new TypeError(`${o} is not an Array`)};const Z=(n,t)=>({[P](){return this},next(){let e=n.next();for(;!e.done;){const{value:o}=e;if(t(o))return{value:o,done:!1};e=n.next()}return e}}),nn=(t,e)=>({isAsyncIteratorDone:!1,[k](){return this},async next(){for(;!this.isAsyncIteratorDone;){const{value:o,done:r}=await t.next();if(r)this.isAsyncIteratorDone=!0;else{const t=e(o);if(n(t)?await t:t)return{value:o,done:!1}}}return{value:void 0,done:!0}}}),tn=function(n,t,e,o){const r=t.length;let u=n.length-1;for(;++o<r;)n[++u]=e(t[o],o,n);return n},en=function(n,t,e,o){const r=n.length;let u=-1;for(;++e<r;)o[++u]&&t.push(n[e]);return t},on=function(t,o){const r=t.length,c=[];let f=-1,i=-1;for(;++f<r;){const r=t[f],s=o(r,f,t);if(n(s))return e(tn([s],t,o,f)).then(d(en,t,c,f-1,u));s&&(c[++i]=r)}return c},rn=(n,t)=>function(){return n(t)},un=function(){},cn=(n,t,e,o,r)=>function(){return n(t,e,o,r)},fn=function(n,t,e,o){o&&(n[t]=e)},sn=function(t,o){return y(t)?on(t,o):null==t?t:"string"==typeof t||t.constructor==String?function(t,e){const o=on(t,e);return n(o)?o.then(l(_,u,"join","")):o.join("")}(t,o):t.constructor==Set?function(t,o){const r=new Set,c=r.add.bind(r),i=[];for(const e of t){const f=o(e,e,t);n(f)?i.push(f.then(l(s,u,rn(c,e),un))):f&&r.add(e)}return 0==i.length?r:e(i).then(f(r))}(t,o):t.constructor==Map?function(t,o){const r=new Map,c=[];for(const[e,f]of t){const i=o(f,e,t);n(i)?c.push(i.then(l(s,u,cn(F,r,"set",e,f),un))):i&&r.set(e,f)}return 0==c.length?r:e(c).then(f(r))}(t,o):"function"==typeof t.filter?t.filter(o):"function"==typeof t[P]?Z(t[P](),o):"function"==typeof t[k]?nn(t[k](),o):t.constructor==Object?function(t,o){const r={},c=[];for(const e in t){const f=t[e],i=o(f,e,t);n(i)?c.push(i.then(d(fn,r,e,t[e],u))):i&&(r[e]=f)}return 0==c.length?r:e(c).then(f(r))}(t,o):t},ln=Object.values,hn=(Object.prototype.toString,async function(t,e,o){let r=t.next();if(r.done)return o;for(;!r.done;)o=e(o,r.value),n(o)&&(o=await o),r=t.next();return o}),an=async function(t,e,o,r){const u=t.length;for(;++r<u;)o=e(o,t[r],r,t),n(o)&&(o=await o);return o},pn=Object.keys,yn=async function(t,e,o,r,u){const c=r.length;for(;++u<c;){const c=r[u];o=e(o,t[c],c,t),n(o)&&(o=await o)}return o},gn=async function(t,e,o,r){for(const[u,c]of r)o=e(o,c,u,t),n(o)&&(o=await o);return o},dn=function(t,e,o){return y(t)?function(t,e,o){const r=t.length;let c=-1;for(void 0===o&&(o=t[++c]);++c<r;)if(o=e(o,t[c],c,t),n(o))return o.then(d(an,t,e,u,c));return o}(t,e,o):null==t?void 0===o?c(e,t,u):e(o,t):t.constructor==Map?function(t,e,o){const r=t.entries();if(void 0===o){const n=r.next();if(n.done)return o;o=n.value[1]}for(const[c,f]of r)if(o=e(o,f,c,t),n(o))return o.then(d(gn,t,e,u,r));return o}(t,e,o):"function"==typeof t[P]?function(t,e,o){let r=t.next();if(r.done)return o;for(void 0===o&&(o=r.value,r=t.next());!r.done;){if(o=e(o,r.value),n(o))return o.then(l(hn,t,e,u));r=t.next()}return o}(t[P](),e,o):"function"==typeof t[k]?async function(n,t,e){let o=await n.next();if(o.done)return e;for(void 0===e&&(e=o.value,o=await n.next());!o.done;)e=await t(e,o.value),o=await n.next();return e}(t[k](),e,o):"function"==typeof t.reduce?t.reduce(e,o):"function"==typeof t.chain?t.chain(c(e,o,u)):"function"==typeof t.flatMap?t.flatMap(c(e,o,u)):t.constructor==Object?function(t,e,o){const r=pn(t),c=r.length;let f=-1;for(void 0===o&&(o=t[r[++f]]);++f<c;){const c=r[f];if(o=e(o,t[c],c,t),n(o))return o.then((i=yn,l=e,h=u,a=r,p=f,(s=t)==u?((n,t,e,o,r)=>function(u){return n(u,t,e,o,r)})(i,l,h,a,p):l==u?((n,t,e,o,r)=>function(u){return n(t,u,e,o,r)})(i,s,h,a,p):h==u?((n,t,e,o,r)=>function(u){return n(t,e,u,o,r)})(i,s,l,a,p):a==u?((n,t,e,o,r)=>function(u){return n(t,e,o,u,r)})(i,s,l,h,p):((n,t,e,o,r)=>function(u){return n(t,e,o,r,u)})(i,s,l,h,a)))}var i,s,l,h,a,p;return o}(t,e,o):void 0===o?c(e,t,u):e(o,t)},wn=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(dn,t,e,u)):dn(t,e,r)}return n(o)?o.then(l(dn,t,e,u)):dn(t,e,o)},vn=ArrayBuffer.isView,bn=function(n,t){return y(t)||vn(t)?function(n,t){const e=n.length,o=t.length;let r=-1;for(;++r<o;)n[e+r]=t[r];return n}(n,t):(n.push(t),n)},jn="function"==typeof Buffer,xn=jn?Buffer.alloc:un,Sn=function(n,t){const e=n.length,o=jn&&n.constructor==Buffer?xn(e+t.length):new n.constructor(e+t.length);return o.set(n),o.set(t,e),o},Mn=function(n,t){return y(t)||vn(t)?Sn(n,t):Sn(n,[t])},On=(n,t)=>new Promise(((n,t)=>function(e,o){t.on("data",(n=>function(t,e,o){return n.write(t,e,o),n})(n)),t.on("end",rn(e,n)),t.on("error",o)})(n,t)),mn=function(n,t){return null!=(e=t)&&"function"==typeof e.pipe?On(n,t):(n.write(t),n);var e},An=function(n,t){if(null!=t&&t.constructor==Set){for(const e of t)n.add(e);return n}return n.add(t)},zn=function(n,t){return n.concat(t)},In=function(t,e,o){const r=dn(t,e(un),null);return n(r)?r.then(f(o)):o},En=function(t,e,o){if(y(o))return dn(t,e(bn),o);if(vn(o)){const r=dn(t,e(bn),[]);return n(r)?r.then(c(Mn,o,u)):Mn(o,r)}if(null==o)return In(t,e,o);const r=o.constructor;if("string"==typeof o||r==String){const r=dn(t,e(bn),[o]);return n(r)?r.then(l(_,u,"join","")):r.join("")}return"function"==typeof o.concat?dn(t,e(zn),o):"function"==typeof o.write?dn(t,e(mn),o):r==Set?dn(t,e(An),o):r==Object?dn(t,e(S),o):In(t,e,o)},Dn=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(En,t,e,u)):En(t,e,r)}return n(o)?o.then(l(En,t,e,u)):En(t,e,o)},Pn=function(n,t){return n.push(t),n},Tn=n=>new Promise((t=>{setTimeout(t,n)})),Bn=(n,t)=>t,kn=n=>n,Cn=(n,t)=>function(...e){return t(n(...e))},$n=async function(t,o){const r=[];for await(const e of t){const t=o(e);n(t)&&r.push(t)}return 0==r.length?t:e(r).then(f(t))},_n=function(t){const o=t.length,r=[],i=[];let s=-1;for(;++s<o;){const e=t[s];if(y(e)){const n=e.length;let t=-1;for(;++t<n;)i.push(e[t])}else if(null==e)i.push(e);else if("function"==typeof e.then)r.push(e.then(c(Pn,i,u)));else if("function"==typeof e[P])for(const n of e)i.push(n);else if("function"==typeof e[k])r.push($n(e[k](),c(Pn,i,u)));else if("function"==typeof e.chain){const t=e.chain(kn);n(t)?r.push(t.then(c(Pn,i,u))):i.push(t)}else if("function"==typeof e.flatMap){const t=e.flatMap(kn);n(t)?r.push(t.then(c(Pn,i,u))):i.push(t)}else if("function"==typeof e.reduce){const t=e.reduce(Cn(Bn,c(Pn,i,u)),null);n(t)&&r.push(t)}else if(e.constructor==Object)for(const n in e)i.push(e[n]);else i.push(e)}return 0==r.length?i:e(r).then(f(i))},qn=function(t){const o=[],r={},f=c(S,r,u),i=Cn(Bn,f);for(const e in t){const u=t[e];if(null!=u)if("function"==typeof u[P])for(const n of u)S(r,n);else if("function"==typeof u[k])o.push($n(u[k](),f));else if("function"==typeof u.chain){const t=u.chain(kn);n(t)?o.push(t.then(f)):S(r,t)}else if("function"==typeof u.flatMap){const t=u.flatMap(kn);n(t)?o.push(t.then(f)):f(t)}else if("function"==typeof u.reduce){const t=u.reduce(i,null);n(t)&&o.push(t)}else S(r,u)}return 0==o.length?r:e(o).then((()=>r))},Fn=function(t){t.size;const o=[],r=new Set,c=(n,t)=>r.add(t),f=l(_,r,"add",u);for(const e of t)if(y(e)){const n=e.length;let t=-1;for(;++t<n;)r.add(e[t])}else if(null==e)r.add(e);else if("function"==typeof e[P])for(const n of e)r.add(n);else if("function"==typeof e[k])o.push($n(e[k](),f));else if("function"==typeof e.chain){const t=e.chain(kn);n(t)?o.push(t.then(f)):r.add(t)}else if("function"==typeof e.flatMap){const t=e.flatMap(kn);n(t)?o.push(t.then(f)):r.add(t)}else if("function"==typeof e.reduce){const t=e.reduce(c,null);n(t)&&o.push(t)}else if(e.constructor==Object)for(const n in e)r.add(e[n]);else r.add(e);return 0==o.length?r:e(o).then((()=>r))},Rn=o(_n,c(((n,t)=>n.join(t)),u,"")),Vn=function(t,e){if(y(t))return function(t,e){const o=$(t,e);return n(o)?o.then(_n):_n(o)}(t,e);if(null==t)return e(t);if("function"==typeof t.then)return t.then(e);if("function"==typeof t.next)return P in t?function(n,t){let e=[],o=0;return{[P](){return this},next(){if(o<e.length){const n=e[o];return o+=1,{value:n,done:!1}}const r=n.next();if(r.done)return r;const u=dn(t(r.value),Pn,[]);return u.length>1&&(e=u,o=1),{value:u[0],done:!1}}}}(t,e):function(t,e){const o=[],r=new Set;return{isAsyncIteratorDone:!1,[k](){return this},toString:()=>"[object FlatMappingAsyncIterator]",async next(){for(;!this.isAsyncIteratorDone||o.length>0||r.size>0;){if(!this.isAsyncIteratorDone){const{value:c,done:f}=await t.next();if(f)this.isAsyncIteratorDone=f;else{const t=e(c);if(n(t)){const n=t.then(l(dn,u,Pn,o)).then((()=>r.delete(n)));r.add(n)}else{const e=dn(t,Pn,o);if(n(e)){const n=e.then((()=>r.delete(n)));r.add(n)}}}}if(o.length>0)return{value:o.shift(),done:!1};r.size>0&&await J([Tn(1e3),...r])}return{value:void 0,done:!0}}}}(t,e);if("function"==typeof t.chain)return t.chain(e);if("function"==typeof t.flatMap)return t.flatMap(e);const o=t.constructor;return o==Object?function(t,e){const o=V(t,e);return n(o)?o.then(qn):qn(o)}(t,e):o==Set?function(t,e){const o=q(t,e);return n(o)?o.then(Fn):Fn(o)}(t,e):"string"==typeof t||o==String?function(t,e){const o=$(t,e);return n(o)?o.then(Rn):Rn(o)}(t,e):e(t)},Gn=function(t,o){return y(t)?function(t,o){const r=t.length,u=[];let c=-1;for(;++c<r;){const e=o(t[c]);n(e)&&u.push(e)}return 0==u.length?t:e(u).then(f(t))}(t,o):null==t?t:"function"==typeof t.forEach?t.forEach(o):"function"==typeof t[P]?function(t,o){const r=[];for(const e of t){const t=o(e);n(t)&&r.push(t)}return 0==r.length?t:e(r).then(f(t))}(t[P](),o):"function"==typeof t[k]?$n(t[k](),o):t.constructor==Object?function(t,o){const r=[];for(const e in t){const u=o(t[e]);n(u)&&r.push(u)}return 0==r.length?t:e(r).then(f(t))}(t,o):t},Hn=function(n){const t=n.then((n=>[n,t]));return t},Jn=async function(t,e,o,r){const u=t.length;for(;++o<u;){const u=e(t[o]);if(n(u))r.add(Hn(u));else if(u)return!0}for(;r.size>0;){const[n,t]=await J(r);if(r.delete(t),n)return!0}return!1},Kn=function(t,e){const o=t.length;let r=-1;for(;++r<o;){const o=e(t[r]);if(n(o))return Jn(t,e,r,new Set([Hn(o)]));if(o)return!0}return!1},Ln=async function(t,e,o,r=20){let u=t.next();for(n(u)&&(u=await u);!u.done;){if(o.size>=r){const[n,t]=await J(o);if(o.delete(t),n)return!0}const c=e(u.value);if(n(c))o.add(Hn(c));else if(c)return!0;u=t.next(),n(u)&&(u=await u)}for(;o.size>0;){const[n,t]=await J(o);if(o.delete(t),n)return!0}return!1},Nn=function(t,e){return y(t)?Kn(t,e):null==t?e(t):"function"==typeof t[P]?function(t,e){for(const o of t){const r=e(o);if(n(r))return Ln(t,e,new Set([Hn(r)]));if(r)return!0}return!1}(t[P](),e):"function"==typeof t[k]?Ln(t[k](),e,new Set):"function"==typeof t.reduce?t.reduce((t=>function(e,o){return!0===e?e:n(e)?e.then(c((n=>function(t,e){return!!t||n(e)})(t),u,o)):!!e||t(o)})(e),!1):t.constructor==Object?Kn(ln(t),e):e(t)},Qn=function(t,o){const r=t.length,c=[];let f=-1;for(;++f<r;){const e=o(t[f]);if(n(e))c.push(e);else if(!e)return!1}return 0==c.length||e(c).then(l(_,u,"every",Boolean))},Un=(n,t,e)=>!!t&&n(e),Wn=function(t,o){return y(t)?Qn(t,o):null==t?o(t):"function"==typeof t[P]?function(t,o){const r=[];for(const e of t){const t=o(e);if(n(t))r.push(t);else if(!t)return!1}return 0==r.length||e(r).then(l(_,u,"every",Boolean))}(t[P](),o):"function"==typeof t[k]?async function(t,e,o,r=20){let u=await t.next();for(;!u.done;){if(o.size>=r){const[n,t]=await J(o);if(o.delete(t),!n)return!1}const c=e(u.value);if(n(c))o.add(Hn(c));else if(!c)return!1;u=await t.next()}for(;o.size>0;){const[n,t]=await J(o);if(o.delete(t),!n)return!1}return!0}(t[k](),o,new Set):"function"==typeof t.reduce?t.reduce((t=>function(e,o){return!1!==e&&(n(e)?e.then(l(Un,t,u,o)):!!e&&t(o))})(o),!0):t.constructor==Object?Qn(ln(t),o):o(t)},Xn=function(t,e){const o=t.length;for(;++e<o;){const o=t[e];if(n(o))return o.then(l(s,u,E(Xn,t,e),f(!1)));if(!o)return!1}return!0},Yn=async function(t,e,o){const r=e.length;for(;++o<r;){let r=e[o];if("function"==typeof r&&(r=r(...t)),n(r)&&(r=await r),!r)return!1}return!0},Zn=function(t,e){const o=e.length;let r=-1;for(;++r<o;){let o=e[r];if("function"==typeof o&&(o=o(...t)),n(o))return o.then(l(s,u,A(Yn,t,e,r),f(!1)));if(!o)return!1}return!0},nt=function(t,e){const o=t.length;for(;++e<o;){const o=t[e];if(n(o))return o.then(l(s,u,f(!0),E(nt,t,e)));if(o)return!0}return!1},tt=async function(t,e,o){const r=e.length;for(;++o<r;){let r=e[o];if("function"==typeof r&&(r=r(...t)),n(r)&&(r=await r),r)return!0}return!1},et=function(t,e){const o=e.length;let r=-1;for(;++r<o;){let o=e[r];if("function"==typeof o&&(o=o(...t)),n(o))return o.then(l(s,u,f(!0),A(tt,t,e,r)));if(o)return!0}return!1},ot=n=>!n,rt=function(t,e){const o=e(...t);return n(o)?o.then(ot):!o},ut=function(n,t,e,o,r){return t==u?((n,t,e,o)=>function(...r){return n(r,t,e,o)})(n,e,o,r):e==u?((n,t,e,o)=>function(...r){return n(t,r,e,o)})(n,t,o,r):o==u?((n,t,e,o)=>function(...r){return n(t,e,r,o)})(n,t,e,r):((n,t,e,o)=>function(...r){return n(t,e,o,r)})(n,t,e,o)},ct=function(t,o,r,u){const c=r(...t),f=u(...t);return n(c)||n(f)?e([c,f]).then(Q(o)):o(c,f)},ft=function(t,o,r,u){const c=r(...t);return n(c)||n(u)?e([c,u]).then(Q(o)):o(c,u)},it=function(t,o,r,u){const c=u(...t);return n(r)||n(c)?e([r,c]).then(Q(o)):o(r,c)},st=o=>function(...r){const c=r.pop(),f=r.pop(),i="function"==typeof f,s="function"==typeof c;return i&&s?0==r.length?ut(ct,u,o,f,c):t(r)?e(r).then(d(ct,u,o,f,c)):ct(r,o,f,c):i?0==r.length?ut(ft,u,o,f,c):t(r)?e(r).then(d(ft,u,o,f,c)):ft(r,o,f,c):s?0==r.length?ut(it,u,o,f,c):t(r)?e(r).then(d(it,u,o,f,c)):it(r,o,f,c):n(f)||n(c)?e([f,c]).then(Q(o)):o(f,c)},lt=st((function(n,t){return n==t})),ht=st(((n,t)=>n>t)),at=st(((n,t)=>n<t)),pt=st(((n,t)=>n>=t)),yt=st(((n,t)=>n<=t)),gt=/[.|[|\]]+/,dt=function(n,t){const e=new Map,o=function(o){if(e.has(o))return e.get(o);const r=n(o);return e.set(o,r),e.size>t&&e.clear(),r};return o.cache=e,o}((function(n){const t=n.length-1,e="["==n[0],o="]"==n[t];return e&&o?n.slice(1,t).split(gt):e?n.slice(1).split(gt):o?n.slice(0,t).split(gt):n.split(gt)}),500),wt=n=>y(n)?n:"string"==typeof n?dt(n):[n],vt=function(n,t){const e=wt(t),o=e.length;let r=-1,u=n;for(;++r<o;)if(u=u[e[r]],null==u)return;return u},bt=function(n,t,e){const o=null==n?void 0:vt(n,t);return void 0===o?"function"==typeof e?e(n):e:o},jt=function(n,t,e){if(!(n=>{if(null==n)return!1;const t=typeof n;return"object"==t||"function"==t})(n))return n;const o=wt(e),r=o.length,u=r-1,c={...n};let f=c,i=-1;for(;++i<r;){const n=o[i];if(i==u)f[n]=t;else{const t=f[n],e=y(t)?t.slice():{...t};f[n]=e,f=e}}return c},xt=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(jt,t,u,e)):jt(t,r,e)}return n(o)?o.then(l(jt,t,u,e)):jt(t,o,e)},St=function(n,t){if(null==n)return n;const e=t.length;let o={},r=-1;for(;++r<e;){const e=t[r],u=vt(n,e);null!=u&&(o=jt(o,u,e))}return o},Mt=function(n,t){if(null==n)return;const e=wt(t),o=e.length-1;let r=-1,u=n;for(;++r<o;)if(u=u[e[r]],null==u)return;const c=e[r];null!=u&&c in u&&delete u[c]},Ot=function(n){const t={};for(const e in n){const o=n[e];y(o)?t[e]=mt(o):null!=o&&o.constructor==Object?t[e]=Ot(o):t[e]=o}return t},mt=function(n){const t=n.length,e=[];let o=-1;for(;++o<t;){const t=n[o];y(t)?e[o]=mt(t):null!=t&&t.constructor==Object?e[o]=Ot(t):e[o]=t}return e},At=function(n,t){const e=t.length,o=y(r=n)?mt(r):null==r?r:r.constructor==Object?Ot(r):r;var r;let u=-1;for(;++u<e;)Mt(o,t[u]);return o},zt=(n,...t)=>N(n.length,n,t);zt.arity=function(n,t,...e){return N(n,t,e)};return{pipe:function(...n){const f=n.pop().reduce(o);return 0==n.length?f:t(n)?e(n).then(c(r,f,u)):f(...n)},compose:function(...n){const f=n.pop().reduceRight(o);return 0==n.length?f:t(n)?e(n).then(c(r,f,u)):f(...n)},tap:p,forEach:function(...t){const e=t.pop();if(0==t.length)return c(Gn,u,e);const o=t[0];return n(o)?o.then(c(Gn,u,e)):Gn(o,e)},switchCase:(...n)=>{const o=n.pop();return I(o)?D(o,-2):0==n.length?(r=z,f=u,i=-2,(c=o)==u?((n,t,e)=>function(...o){return n(o,t,e)})(r,f,i):f==u?((n,t,e)=>function(...o){return n(t,o,e)})(r,c,i):((n,t,e)=>function(...o){return n(t,e,o)})(r,c,f)):t(n)?e(n).then(l(z,o,u,-2)):z(o,n,-2);var r,c,f,i},tryCatch:function(...n){if(n.length>2){const o=n.pop(),r=n.pop();return t(n)?e(n).then(l(m,r,o,u)):m(r,o,n)}const o=n[0],r=n[1];return function(...n){return m(o,r,n)}},all:x,assign:function(t,e){return null==e?c(M,u,t):n(t)?t.then(c(M,u,e)):M(t,e)},get:function(t,e,o){return"string"==typeof t||"number"==typeof t||y(t)?l(bt,u,t,e):n(t)?t.then(l(bt,u,e,o)):bt(t,e,o)},set:function(t,e,o){return null==o?l(xt,u,t,e):n(t)?t.then(l(xt,u,e,o)):xt(t,e,o)},pick:function(t,e){return null==e?c(St,u,t):n(t)?t.then(c(St,u,e)):St(t,e)},omit:function(t,e){return null==e?c(At,u,t):n(t)?t.then(c(At,u,e)):At(t,e)},map:Y,filter:function(...n){const t=n.pop();return 0==n.length?c(sn,u,t):sn(n[0],t)},flatMap:(...t)=>{const e=t.pop();if(0==t.length)return c(Vn,u,e);const o=t[0];return n(o)?o.then(c(Vn,u,e)):Vn(t[0],e)},reduce:function(...t){return"function"==typeof t[0]?l(wn,u,t[0],t[1]):n(t[0])?t[0].then(l(wn,u,t[1],t[2])):wn(t[0],t[1],t[2])},transform:function(...t){return"function"==typeof t[0]?l(Dn,u,t[0],t[1]):n(t[0])?t[0].then(l(Dn,u,t[1],t[2])):Dn(t[0],t[1],t[2])},and:function(...n){const o=n.pop();return I(o)?Xn(o,-1):0==n.length?h(Zn,u,o):t(n)?e(n).then(c(Zn,u,o)):Zn(n,o)},or:function(...n){const o=n.pop();return I(o)?nt(o,-1):0==n.length?h(et,u,o):t(n)?e(n).then(c(et,u,o)):et(n,o)},not:function(...n){const o=n.pop();return"function"==typeof o?0==n.length?h(rt,u,o):t(n)?e(n).then(c(rt,u,o)):rt(n,o):!o},some:function(...t){const e=t.pop();if(0==t.length)return c(Nn,u,e);const o=t[0];return n(o)?o.then(c(Nn,u,e)):Nn(o,e)},every:function(...t){const e=t.pop();if(0==t.length)return c(Wn,u,e);const o=t[0];return n(o)?o.then(c(Wn,u,e)):Wn(o,e)},eq:lt,gt:ht,lt:at,gte:pt,lte:yt,thunkify:(n,...o)=>function(){return t(o)?e(o).then(c(r,n,u)):n(...o)},always:f,curry:zt,__:u}}());
|
package/dist/rubico.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.3.
|
|
2
|
+
* rubico v2.3.2
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
|
-
* (c) 2019-
|
|
4
|
+
* (c) 2019-2024 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -641,7 +641,7 @@ const arrayMapSeriesAsync = async function (
|
|
|
641
641
|
) {
|
|
642
642
|
const arrayLength = array.length
|
|
643
643
|
while (++index < arrayLength) {
|
|
644
|
-
const resultItem = mapper(array[index])
|
|
644
|
+
const resultItem = mapper(array[index], index)
|
|
645
645
|
result[index] = isPromise(resultItem) ? await resultItem : resultItem
|
|
646
646
|
}
|
|
647
647
|
return result
|
|
@@ -653,7 +653,7 @@ const arrayMapSeries = function (array, mapper) {
|
|
|
653
653
|
let index = -1
|
|
654
654
|
|
|
655
655
|
while (++index < arrayLength) {
|
|
656
|
-
const resultItem = mapper(array[index])
|
|
656
|
+
const resultItem = mapper(array[index], index)
|
|
657
657
|
if (isPromise(resultItem)) {
|
|
658
658
|
return resultItem.then(funcConcat(
|
|
659
659
|
curry3(objectSet, result, index, __),
|
|
@@ -2589,13 +2589,13 @@ const _get = function (object, path, defaultValue) {
|
|
|
2589
2589
|
}
|
|
2590
2590
|
|
|
2591
2591
|
const get = function (arg0, arg1, arg2) {
|
|
2592
|
+
if (typeof arg0 == 'string' || typeof arg0 == 'number' || isArray(arg0)) {
|
|
2593
|
+
return curry3(_get, __, arg0, arg1)
|
|
2594
|
+
}
|
|
2592
2595
|
if (isPromise(arg0)) {
|
|
2593
2596
|
return arg0.then(curry3(_get, __, arg1, arg2))
|
|
2594
2597
|
}
|
|
2595
|
-
|
|
2596
|
-
return _get(arg0, arg1, arg2)
|
|
2597
|
-
}
|
|
2598
|
-
return curry3(_get, __, arg0, arg1)
|
|
2598
|
+
return _get(arg0, arg1, arg2)
|
|
2599
2599
|
}
|
|
2600
2600
|
|
|
2601
2601
|
const setByPath = function (obj, value, path) {
|
package/dist/rubico.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.3.
|
|
2
|
+
* rubico v2.3.2
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
|
-
* (c) 2019-
|
|
4
|
+
* (c) 2019-2024 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
!function(n,t){"object"==typeof module?module.exports=t:"function"==typeof define?define((()=>t)):n.rubico=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=n=>null!=n&&"function"==typeof n.then,t=function(t){const e=t.length;let o=-1;for(;++o<e;){const e=t[o];if(n(e))return!0}return!1},e=Promise.all.bind(Promise),o=(t,e)=>function(...o){const r=t(...o);return n(r)?r.then(e):e(r)},r=(n,t)=>n(...t),u=Symbol.for("placeholder"),c=function(n,t,e){return t==u?((n,t)=>function(e){return n(e,t)})(n,e):((n,t)=>function(e){return n(t,e)})(n,t)},f=n=>function(){return n},i=(n,t)=>function(){return n(...t)},s=(n,t,e)=>n?t():e(),l=function(n,t,e,o){return t==u?((n,t,e)=>function(o){return n(o,t,e)})(n,e,o):e==u?((n,t,e)=>function(o){return n(t,o,e)})(n,t,o):((n,t,e)=>function(o){return n(t,e,o)})(n,t,e)},h=function(n,t,e){return t==u?((n,t,e)=>function(...e){return n(e,t)})(n,e):((n,t,e)=>function(...e){return n(t,e)})(n,t)},a=function(t,e){const o=t[0],r=e(...t);return n(r)?r.then(f(o)):o},p=function(...n){const t=n.pop();return 0==n.length?h(a,u,t):a(n,t)};p.if=(t,e)=>function(...o){const r=t(...o);if(n(r))return r.then(l(s,u,i(p(e),o),f(o[0])));if(r){const t=e(...o);if(n(t))return t.then(f(o[0]))}return o[0]};const y=Array.isArray,d=function(t,o){const r=t.length,u=Array(r);let c=-1,f=!1;for(;++c<r;){const e=t[c](...o);n(e)&&(f=!0),u[c]=e}return f?e(u):u},g=function(n,t,e,o,r){return t==u?((n,t,e,o)=>function(r){return n(r,t,e,o)})(n,e,o,r):e==u?((n,t,e,o)=>function(r){return n(t,r,e,o)})(n,t,o,r):o==u?((n,t,e,o)=>function(r){return n(t,e,r,o)})(n,t,e,r):((n,t,e,o)=>function(r){return n(t,e,o,r)})(n,t,e,o)},w=function(n,t,e){return n[t]=e,n},v=async function(t,e,o,r){const u=t.length;for(;++r<u;){const u=t[r](...e);o[r]=n(u)?await u:u}return o},b=function(t,e){const r=t.length,c=[];let f=-1;for(;++f<r;){const r=t[f](...e);if(n(r))return r.then(o(l(w,c,f,u),g(v,t,e,u,f)));c[f]=r}return c},j=function(t,o){const r={},c=[];for(const e in t){const f=t[e](...o);n(f)?c.push(f.then(l(w,r,e,u))):r[e]=f}return 0==c.length?r:e(c).then(f(r))},x=function(...n){const o=n.pop();return 0==n.length?y(o)?h(d,o,u):h(j,o,u):t(n)?y(o)?e(n).then(c(d,o,u)):e(n).then(c(j,o,u)):y(o)?d(o,n):j(o,n)};x.series=function(...n){const o=n.pop();return 0==n.length?h(b,o,u):t(n)?e(n).then(c(b,o,u)):b(o,n)};const S=Object.assign,M=function(t,e){const o=j(e,[t]);return n(o)?o.then(l(S,{},t,u)):{...t,...o}},m=function(n,t,e){return n(t,...e)},O=function(t,e,o){try{const r=t(...o);return n(r)?r.catch(l(m,e,u,o)):r}catch(n){return e(n,...o)}},A=(n,t,e,o)=>function(){return n(t,e,o)},z=function(t,e,o){const r=t.length-1;for(;(o+=2)<r;){const r=t[o],c=t[o+1],h="function"==typeof r?r(...e):r;if(n(h))return h.then(l(s,u,"function"==typeof c?i(c,e):f(c),A(z,t,e,o)));if(h)return"function"==typeof c?c(...e):c}if(o==t.length)return;const c=t[r];return"function"==typeof c?c(...e):c},I=function(n){const t=n.length;let e=-1;for(;++e<t;)if("function"==typeof n[e])return!1;return!0},E=(n,t,e)=>function(){return n(t,e)},D=function(t,e){const o=t.length,r=o-1;for(;(e+=2)<r;){const o=t[e],r=t[e+1];if(n(o))return o.then(l(s,u,f(r),E(D,t,e)));if(o)return r}if(e!=o)return t[e]},P=Symbol.iterator,T=(n,t)=>({toString:()=>"[object MappingIterator]",[P](){return this},next(){const e=n.next();return e.done?e:{value:t(e.value),done:!1}}}),B=n=>({value:n,done:!1}),k=Symbol.asyncIterator,C=(t,e)=>({[k](){return this},async next(){const o=await t.next();if(o.done)return o;const r=e(o.value);return n(r)?r.then(B):{value:r,done:!1}}}),$=n=>{if(null==n)return!1;const t=typeof n;return"object"==t||"function"==t},_=function(t,o){const r=t.length,u=Array(r);let c=-1,f=!1;for(;++c<r;){const e=o(t[c],c,t);n(e)&&(f=!0),u[c]=e}return f?e(u):u},q=(n,t,e)=>n[t](e),F=function(t,o){const r=new Set,c=[];for(const e of t){const f=o(e,e,t);n(f)?c.push(f.then(l(q,r,"add",u))):r.add(f)}return 0==c.length?r:e(c).then(f(r))},R=(n,t,e,o)=>n[t](e,o),V=t=>new Promise((t=>function(e){const o={};let r=0;for(const u in t){const c=t[u];n(c)?(r+=1,c.then((n=>function(t){o[n]=t,r-=1,0==r&&e(o)})(u))):o[u]=c}0==r&&e(o)})(t)),G=function(t,e){const o={};let r=!1;for(const u in t){const c=e(t[u],u,t);n(c)&&(r=!0),o[u]=c}return r?V(o):o},H=async function(t,e,o,r){const u=t.length;for(;++r<u;){const u=e(t[r]);o[r]=n(u)?await u:u}return o},J=n=>function(...t){return n(...t),t[0]},K=Promise.race.bind(Promise),L=async function(t,o,r,u,c,f){const i=t.length;for(;++c<i;){f.size>=r&&await K(f);const e=o(t[c]);if(n(e)){const n=e.then(J((()=>f.delete(n))));f.add(n),u[c]=n}else u[c]=e}return e(u)},N=(n,t,e)=>function(...o){const r=e.length,c=o.length,f=[];let i=-1,s=-1,l=0;for(;++i<r;){const r=e[i];if(r==u&&(s+=1)<c){const n=o[s];n==u&&(l+=1),f.push(n)}else f.push(r);if(f.length==n)return 0==l?t(...f):Q(n,t,f)}for(;++s<c;){const e=o[s];if(e==u&&(l+=1),f.push(e),f.length==n)return 0==l?t(...f):Q(n,t,f)}return Q(n,t,f)},Q=function(n,t,e){const o=e.length;if(o<n)return N(n,t,e);let r=-1;for(;++r<o;){if(e[r]==u)return N(n,t,e)}return t(...e)},U=n=>function([t,e]){return n(t,e)},W=function(n,t,e){return n.set(t,e)},X=function(t,o){const r=new Map,u=[];return t.forEach(((t,e,o)=>function(r,u){const c=t([u,r]);n(c)?o.push(c.then(U(Q(3,W,[e])))):e.set(c[0],c[1])})(o,r,u)),0==u.length?r:e(u).then(f(r))},Y=function(t,o){return y(t)?_(t,o):null==t?t:"function"==typeof t.then?t.then(o):"function"==typeof t.map?t.map(o):"string"==typeof t||t.constructor==String?function(t,e){const o=_(t,e);return n(o)?o.then(l(q,u,"join","")):o.join("")}(t,o):t.constructor==Set?F(t,o):t.constructor==Map?function(t,o){const r=new Map,c=[];for(const[e,f]of t){const i=o(f,e,t);n(i)?c.push(i.then(g(R,r,"set",e,u))):r.set(e,i)}return 0==c.length?r:e(c).then(f(r))}(t,o):"function"==typeof t[P]?T(t[P](),o):"function"==typeof t[k]?C(t[k](),o):t.constructor==Object?G(t,o):o(t)},Z=(...t)=>{const e=t.pop();if(0==t.length)return c(Y,u,e);const o=t[0];return n(o)?o.then(c(Y,u,e)):Y(o,e)};Z.entries=function(t){return function(o){if(null==o)throw new TypeError("value is not an Object or Map");if(o.constructor==Object)return function(t,o){const r={},u=[];for(const e in t){const c=o([e,t[e]]);n(c)?u.push(c.then(U(Q(3,w,[r])))):r[c[0]]=c[1]}return 0==u.length?r:e(u).then(f(r))}(o,t);if(o.constructor==Map)return X(o,t);throw new TypeError("value is not an Object or Map")}},Z.series=t=>function(e){if(y(e))return function(t,e){const r=t.length,c=Array(r);let f=-1;for(;++f<r;){const r=e(t[f]);if(n(r))return r.then(o(l(w,c,f,u),g(H,t,e,u,f)));c[f]=r}return c}(e,t);throw new TypeError(`${e} is not an Array`)},Z.pool=(t,e)=>function(o){if(y(o))return function(t,e,o){const r=t.length,u=Array(r);let c=-1;for(;++c<r;){const r=e(t[c]);if(n(r)){const n=new Set,f=r.then(J((()=>n.delete(f))));return n.add(f),u[c]=f,L(t,e,o,u,c,n)}u[c]=r}return u}(o,e,t);throw new TypeError(`${o} is not an Array`)};const nn=(n,t)=>({[P](){return this},next(){let e=n.next();for(;!e.done;){const{value:o}=e;if(t(o))return{value:o,done:!1};e=n.next()}return e}}),tn=(t,e)=>({isAsyncIteratorDone:!1,[k](){return this},async next(){for(;!this.isAsyncIteratorDone;){const{value:o,done:r}=await t.next();if(r)this.isAsyncIteratorDone=!0;else{const t=e(o);if(n(t)?await t:t)return{value:o,done:!1}}}return{value:void 0,done:!0}}}),en=function(n,t,e,o){const r=t.length;let u=n.length-1;for(;++o<r;)n[++u]=e(t[o],o,n);return n},on=function(n,t,e,o){const r=n.length;let u=-1;for(;++e<r;)o[++u]&&t.push(n[e]);return t},rn=function(t,o){const r=t.length,c=[];let f=-1,i=-1;for(;++f<r;){const r=t[f],s=o(r,f,t);if(n(s))return e(en([s],t,o,f)).then(g(on,t,c,f-1,u));s&&(c[++i]=r)}return c},un=(n,t)=>function(){return n(t)},cn=function(){},fn=(n,t,e,o,r)=>function(){return n(t,e,o,r)},sn=function(n,t,e,o){o&&(n[t]=e)},ln=function(t,o){return y(t)?rn(t,o):null==t?t:"string"==typeof t||t.constructor==String?function(t,e){const o=rn(t,e);return n(o)?o.then(l(q,u,"join","")):o.join("")}(t,o):t.constructor==Set?function(t,o){const r=new Set,c=r.add.bind(r),i=[];for(const e of t){const f=o(e,e,t);n(f)?i.push(f.then(l(s,u,un(c,e),cn))):f&&r.add(e)}return 0==i.length?r:e(i).then(f(r))}(t,o):t.constructor==Map?function(t,o){const r=new Map,c=[];for(const[e,f]of t){const i=o(f,e,t);n(i)?c.push(i.then(l(s,u,fn(R,r,"set",e,f),cn))):i&&r.set(e,f)}return 0==c.length?r:e(c).then(f(r))}(t,o):"function"==typeof t.filter?t.filter(o):"function"==typeof t[P]?nn(t[P](),o):"function"==typeof t[k]?tn(t[k](),o):t.constructor==Object?function(t,o){const r={},c=[];for(const e in t){const f=t[e],i=o(f,e,t);n(i)?c.push(i.then(g(sn,r,e,t[e],u))):i&&(r[e]=f)}return 0==c.length?r:e(c).then(f(r))}(t,o):t},hn=Object.values,an=(Object.prototype.toString,async function(t,e,o){let r=t.next();if(r.done)return o;for(;!r.done;)o=e(o,r.value),n(o)&&(o=await o),r=t.next();return o}),pn=async function(t,e,o,r){const u=t.length;for(;++r<u;)o=e(o,t[r],r,t),n(o)&&(o=await o);return o},yn=Object.keys,dn=async function(t,e,o,r,u){const c=r.length;for(;++u<c;){const c=r[u];o=e(o,t[c],c,t),n(o)&&(o=await o)}return o},gn=async function(t,e,o,r){for(const[u,c]of r)o=e(o,c,u,t),n(o)&&(o=await o);return o},wn=function(t,e,o){return y(t)?function(t,e,o){const r=t.length;let c=-1;for(void 0===o&&(o=t[++c]);++c<r;)if(o=e(o,t[c],c,t),n(o))return o.then(g(pn,t,e,u,c));return o}(t,e,o):null==t?void 0===o?c(e,t,u):e(o,t):t.constructor==Map?function(t,e,o){const r=t.entries();if(void 0===o){const n=r.next();if(n.done)return o;o=n.value[1]}for(const[c,f]of r)if(o=e(o,f,c,t),n(o))return o.then(g(gn,t,e,u,r));return o}(t,e,o):"function"==typeof t[P]?function(t,e,o){let r=t.next();if(r.done)return o;for(void 0===o&&(o=r.value,r=t.next());!r.done;){if(o=e(o,r.value),n(o))return o.then(l(an,t,e,u));r=t.next()}return o}(t[P](),e,o):"function"==typeof t[k]?async function(n,t,e){let o=await n.next();if(o.done)return e;for(void 0===e&&(e=o.value,o=await n.next());!o.done;)e=await t(e,o.value),o=await n.next();return e}(t[k](),e,o):"function"==typeof t.reduce?t.reduce(e,o):"function"==typeof t.chain?t.chain(c(e,o,u)):"function"==typeof t.flatMap?t.flatMap(c(e,o,u)):t.constructor==Object?function(t,e,o){const r=yn(t),c=r.length;let f=-1;for(void 0===o&&(o=t[r[++f]]);++f<c;){const c=r[f];if(o=e(o,t[c],c,t),n(o))return o.then((i=dn,l=e,h=u,a=r,p=f,(s=t)==u?((n,t,e,o,r)=>function(u){return n(u,t,e,o,r)})(i,l,h,a,p):l==u?((n,t,e,o,r)=>function(u){return n(t,u,e,o,r)})(i,s,h,a,p):h==u?((n,t,e,o,r)=>function(u){return n(t,e,u,o,r)})(i,s,l,a,p):a==u?((n,t,e,o,r)=>function(u){return n(t,e,o,u,r)})(i,s,l,h,p):((n,t,e,o,r)=>function(u){return n(t,e,o,r,u)})(i,s,l,h,a)))}var i,s,l,h,a,p;return o}(t,e,o):void 0===o?c(e,t,u):e(o,t)},vn=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(wn,t,e,u)):wn(t,e,r)}return n(o)?o.then(l(wn,t,e,u)):wn(t,e,o)},bn=ArrayBuffer.isView,jn=function(n,t){return y(t)||bn(t)?function(n,t){const e=n.length,o=t.length;let r=-1;for(;++r<o;)n[e+r]=t[r];return n}(n,t):(n.push(t),n)},xn="function"==typeof Buffer,Sn=xn?Buffer.alloc:cn,Mn=function(n,t){const e=n.length,o=xn&&n.constructor==Buffer?Sn(e+t.length):new n.constructor(e+t.length);return o.set(n),o.set(t,e),o},mn=function(n,t){return y(t)||bn(t)?Mn(n,t):Mn(n,[t])},On=(n,t)=>new Promise(((n,t)=>function(e,o){t.on("data",(n=>function(t,e,o){return n.write(t,e,o),n})(n)),t.on("end",un(e,n)),t.on("error",o)})(n,t)),An=function(n,t){return null!=(e=t)&&"function"==typeof e.pipe?On(n,t):(n.write(t),n);var e},zn=function(n,t){if(null!=t&&t.constructor==Set){for(const e of t)n.add(e);return n}return n.add(t)},In=function(n,t){return n.concat(t)},En=function(t,e,o){const r=wn(t,e(cn),null);return n(r)?r.then(f(o)):o},Dn=function(t,e,o){if(y(o))return wn(t,e(jn),o);if(bn(o)){const r=wn(t,e(jn),[]);return n(r)?r.then(c(mn,o,u)):mn(o,r)}if(null==o)return En(t,e,o);const r=o.constructor;if("string"==typeof o||r==String){const r=wn(t,e(jn),[o]);return n(r)?r.then(l(q,u,"join","")):r.join("")}return"function"==typeof o.concat?wn(t,e(In),o):"function"==typeof o.write?wn(t,e(An),o):r==Set?wn(t,e(zn),o):r==Object?wn(t,e(S),o):En(t,e,o)},Pn=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(Dn,t,e,u)):Dn(t,e,r)}return n(o)?o.then(l(Dn,t,e,u)):Dn(t,e,o)},Tn=function(n,t){return n.push(t),n},Bn=n=>new Promise((t=>{setTimeout(t,n)})),kn=(n,t)=>t,Cn=n=>n,$n=(n,t)=>function(...e){return t(n(...e))},_n=async function(t,o){const r=[];for await(const e of t){const t=o(e);n(t)&&r.push(t)}return 0==r.length?t:e(r).then(f(t))},qn=function(t){const o=t.length,r=[],i=[];let s=-1;for(;++s<o;){const e=t[s];if(y(e)){const n=e.length;let t=-1;for(;++t<n;)i.push(e[t])}else if(null==e)i.push(e);else if("function"==typeof e.then)r.push(e.then(c(Tn,i,u)));else if("function"==typeof e[P])for(const n of e)i.push(n);else if("function"==typeof e[k])r.push(_n(e[k](),c(Tn,i,u)));else if("function"==typeof e.chain){const t=e.chain(Cn);n(t)?r.push(t.then(c(Tn,i,u))):i.push(t)}else if("function"==typeof e.flatMap){const t=e.flatMap(Cn);n(t)?r.push(t.then(c(Tn,i,u))):i.push(t)}else if("function"==typeof e.reduce){const t=e.reduce($n(kn,c(Tn,i,u)),null);n(t)&&r.push(t)}else if(e.constructor==Object)for(const n in e)i.push(e[n]);else i.push(e)}return 0==r.length?i:e(r).then(f(i))},Fn=function(t){const o=[],r={},f=c(S,r,u),i=$n(kn,f);for(const e in t){const u=t[e];if(null!=u)if("function"==typeof u[P])for(const n of u)S(r,n);else if("function"==typeof u[k])o.push(_n(u[k](),f));else if("function"==typeof u.chain){const t=u.chain(Cn);n(t)?o.push(t.then(f)):S(r,t)}else if("function"==typeof u.flatMap){const t=u.flatMap(Cn);n(t)?o.push(t.then(f)):f(t)}else if("function"==typeof u.reduce){const t=u.reduce(i,null);n(t)&&o.push(t)}else S(r,u)}return 0==o.length?r:e(o).then((()=>r))},Rn=function(t){t.size;const o=[],r=new Set,c=(n,t)=>r.add(t),f=l(q,r,"add",u);for(const e of t)if(y(e)){const n=e.length;let t=-1;for(;++t<n;)r.add(e[t])}else if(null==e)r.add(e);else if("function"==typeof e[P])for(const n of e)r.add(n);else if("function"==typeof e[k])o.push(_n(e[k](),f));else if("function"==typeof e.chain){const t=e.chain(Cn);n(t)?o.push(t.then(f)):r.add(t)}else if("function"==typeof e.flatMap){const t=e.flatMap(Cn);n(t)?o.push(t.then(f)):r.add(t)}else if("function"==typeof e.reduce){const t=e.reduce(c,null);n(t)&&o.push(t)}else if(e.constructor==Object)for(const n in e)r.add(e[n]);else r.add(e);return 0==o.length?r:e(o).then((()=>r))},Vn=o(qn,c(((n,t)=>n.join(t)),u,"")),Gn=function(t,e){if(y(t))return function(t,e){const o=_(t,e);return n(o)?o.then(qn):qn(o)}(t,e);if(null==t)return e(t);if("function"==typeof t.then)return t.then(e);if("function"==typeof t.next)return P in t?function(n,t){let e=[],o=0;return{[P](){return this},next(){if(o<e.length){const n=e[o];return o+=1,{value:n,done:!1}}const r=n.next();if(r.done)return r;const u=wn(t(r.value),Tn,[]);return u.length>1&&(e=u,o=1),{value:u[0],done:!1}}}}(t,e):function(t,e){const o=[],r=new Set;return{isAsyncIteratorDone:!1,[k](){return this},toString:()=>"[object FlatMappingAsyncIterator]",async next(){for(;!this.isAsyncIteratorDone||o.length>0||r.size>0;){if(!this.isAsyncIteratorDone){const{value:c,done:f}=await t.next();if(f)this.isAsyncIteratorDone=f;else{const t=e(c);if(n(t)){const n=t.then(l(wn,u,Tn,o)).then((()=>r.delete(n)));r.add(n)}else{const e=wn(t,Tn,o);if(n(e)){const n=e.then((()=>r.delete(n)));r.add(n)}}}}if(o.length>0)return{value:o.shift(),done:!1};r.size>0&&await K([Bn(1e3),...r])}return{value:void 0,done:!0}}}}(t,e);if("function"==typeof t.chain)return t.chain(e);if("function"==typeof t.flatMap)return t.flatMap(e);const o=t.constructor;return o==Object?function(t,e){const o=G(t,e);return n(o)?o.then(Fn):Fn(o)}(t,e):o==Set?function(t,e){const o=F(t,e);return n(o)?o.then(Rn):Rn(o)}(t,e):"string"==typeof t||o==String?function(t,e){const o=_(t,e);return n(o)?o.then(Vn):Vn(o)}(t,e):e(t)},Hn=function(t,o){return y(t)?function(t,o){const r=t.length,u=[];let c=-1;for(;++c<r;){const e=o(t[c]);n(e)&&u.push(e)}return 0==u.length?t:e(u).then(f(t))}(t,o):null==t?t:"function"==typeof t.forEach?t.forEach(o):"function"==typeof t[P]?function(t,o){const r=[];for(const e of t){const t=o(e);n(t)&&r.push(t)}return 0==r.length?t:e(r).then(f(t))}(t[P](),o):"function"==typeof t[k]?_n(t[k](),o):t.constructor==Object?function(t,o){const r=[];for(const e in t){const u=o(t[e]);n(u)&&r.push(u)}return 0==r.length?t:e(r).then(f(t))}(t,o):t},Jn=function(n){const t=n.then((n=>[n,t]));return t},Kn=async function(t,e,o,r){const u=t.length;for(;++o<u;){const u=e(t[o]);if(n(u))r.add(Jn(u));else if(u)return!0}for(;r.size>0;){const[n,t]=await K(r);if(r.delete(t),n)return!0}return!1},Ln=function(t,e){const o=t.length;let r=-1;for(;++r<o;){const o=e(t[r]);if(n(o))return Kn(t,e,r,new Set([Jn(o)]));if(o)return!0}return!1},Nn=async function(t,e,o,r=20){let u=t.next();for(n(u)&&(u=await u);!u.done;){if(o.size>=r){const[n,t]=await K(o);if(o.delete(t),n)return!0}const c=e(u.value);if(n(c))o.add(Jn(c));else if(c)return!0;u=t.next(),n(u)&&(u=await u)}for(;o.size>0;){const[n,t]=await K(o);if(o.delete(t),n)return!0}return!1},Qn=function(t,e){return y(t)?Ln(t,e):null==t?e(t):"function"==typeof t[P]?function(t,e){for(const o of t){const r=e(o);if(n(r))return Nn(t,e,new Set([Jn(r)]));if(r)return!0}return!1}(t[P](),e):"function"==typeof t[k]?Nn(t[k](),e,new Set):"function"==typeof t.reduce?t.reduce((t=>function(e,o){return!0===e?e:n(e)?e.then(c((n=>function(t,e){return!!t||n(e)})(t),u,o)):!!e||t(o)})(e),!1):t.constructor==Object?Ln(hn(t),e):e(t)},Un=function(t,o){const r=t.length,c=[];let f=-1;for(;++f<r;){const e=o(t[f]);if(n(e))c.push(e);else if(!e)return!1}return 0==c.length||e(c).then(l(q,u,"every",Boolean))},Wn=(n,t,e)=>!!t&&n(e),Xn=function(t,o){return y(t)?Un(t,o):null==t?o(t):"function"==typeof t[P]?function(t,o){const r=[];for(const e of t){const t=o(e);if(n(t))r.push(t);else if(!t)return!1}return 0==r.length||e(r).then(l(q,u,"every",Boolean))}(t[P](),o):"function"==typeof t[k]?async function(t,e,o,r=20){let u=await t.next();for(;!u.done;){if(o.size>=r){const[n,t]=await K(o);if(o.delete(t),!n)return!1}const c=e(u.value);if(n(c))o.add(Jn(c));else if(!c)return!1;u=await t.next()}for(;o.size>0;){const[n,t]=await K(o);if(o.delete(t),!n)return!1}return!0}(t[k](),o,new Set):"function"==typeof t.reduce?t.reduce((t=>function(e,o){return!1!==e&&(n(e)?e.then(l(Wn,t,u,o)):!!e&&t(o))})(o),!0):t.constructor==Object?Un(hn(t),o):o(t)},Yn=function(t,e){const o=t.length;for(;++e<o;){const o=t[e];if(n(o))return o.then(l(s,u,E(Yn,t,e),f(!1)));if(!o)return!1}return!0},Zn=async function(t,e,o){const r=e.length;for(;++o<r;){let r=e[o];if("function"==typeof r&&(r=r(...t)),n(r)&&(r=await r),!r)return!1}return!0},nt=function(t,e){const o=e.length;let r=-1;for(;++r<o;){let o=e[r];if("function"==typeof o&&(o=o(...t)),n(o))return o.then(l(s,u,A(Zn,t,e,r),f(!1)));if(!o)return!1}return!0},tt=function(t,e){const o=t.length;for(;++e<o;){const o=t[e];if(n(o))return o.then(l(s,u,f(!0),E(tt,t,e)));if(o)return!0}return!1},et=async function(t,e,o){const r=e.length;for(;++o<r;){let r=e[o];if("function"==typeof r&&(r=r(...t)),n(r)&&(r=await r),r)return!0}return!1},ot=function(t,e){const o=e.length;let r=-1;for(;++r<o;){let o=e[r];if("function"==typeof o&&(o=o(...t)),n(o))return o.then(l(s,u,f(!0),A(et,t,e,r)));if(o)return!0}return!1},rt=n=>!n,ut=function(t,e){const o=e(...t);return n(o)?o.then(rt):!o},ct=function(n,t,e,o,r){return t==u?((n,t,e,o)=>function(...r){return n(r,t,e,o)})(n,e,o,r):e==u?((n,t,e,o)=>function(...r){return n(t,r,e,o)})(n,t,o,r):o==u?((n,t,e,o)=>function(...r){return n(t,e,r,o)})(n,t,e,r):((n,t,e,o)=>function(...r){return n(t,e,o,r)})(n,t,e,o)},ft=function(t,o,r,u){const c=r(...t),f=u(...t);return n(c)||n(f)?e([c,f]).then(U(o)):o(c,f)},it=function(t,o,r,u){const c=r(...t);return n(c)||n(u)?e([c,u]).then(U(o)):o(c,u)},st=function(t,o,r,u){const c=u(...t);return n(r)||n(c)?e([r,c]).then(U(o)):o(r,c)},lt=o=>function(...r){const c=r.pop(),f=r.pop(),i="function"==typeof f,s="function"==typeof c;return i&&s?0==r.length?ct(ft,u,o,f,c):t(r)?e(r).then(g(ft,u,o,f,c)):ft(r,o,f,c):i?0==r.length?ct(it,u,o,f,c):t(r)?e(r).then(g(it,u,o,f,c)):it(r,o,f,c):s?0==r.length?ct(st,u,o,f,c):t(r)?e(r).then(g(st,u,o,f,c)):st(r,o,f,c):n(f)||n(c)?e([f,c]).then(U(o)):o(f,c)},ht=lt((function(n,t){return n==t})),at=lt(((n,t)=>n>t)),pt=lt(((n,t)=>n<t)),yt=lt(((n,t)=>n>=t)),dt=lt(((n,t)=>n<=t)),gt=/[.|[|\]]+/,wt=function(n,t){const e=new Map,o=function(o){if(e.has(o))return e.get(o);const r=n(o);return e.set(o,r),e.size>t&&e.clear(),r};return o.cache=e,o}((function(n){const t=n.length-1,e="["==n[0],o="]"==n[t];return e&&o?n.slice(1,t).split(gt):e?n.slice(1).split(gt):o?n.slice(0,t).split(gt):n.split(gt)}),500),vt=n=>y(n)?n:"string"==typeof n?wt(n):[n],bt=function(n,t){const e=vt(t),o=e.length;let r=-1,u=n;for(;++r<o;)if(u=u[e[r]],null==u)return;return u},jt=function(n,t,e){const o=null==n?void 0:bt(n,t);return void 0===o?"function"==typeof e?e(n):e:o},xt=function(n,t,e){if(!$(n))return n;const o=vt(e),r=o.length,u=r-1,c={...n};let f=c,i=-1;for(;++i<r;){const n=o[i];if(i==u)f[n]=t;else{const t=f[n],e=y(t)?t.slice():{...t};f[n]=e,f=e}}return c},St=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(xt,t,u,e)):xt(t,r,e)}return n(o)?o.then(l(xt,t,u,e)):xt(t,o,e)},Mt=function(n,t){if(null==n)return n;const e=t.length;let o={},r=-1;for(;++r<e;){const e=t[r],u=bt(n,e);null!=u&&(o=xt(o,u,e))}return o},mt=function(n,t){if(null==n)return;const e=vt(t),o=e.length-1;let r=-1,u=n;for(;++r<o;)if(u=u[e[r]],null==u)return;const c=e[r];null!=u&&c in u&&delete u[c]},Ot=function(n){const t={};for(const e in n){const o=n[e];y(o)?t[e]=At(o):null!=o&&o.constructor==Object?t[e]=Ot(o):t[e]=o}return t},At=function(n){const t=n.length,e=[];let o=-1;for(;++o<t;){const t=n[o];y(t)?e[o]=At(t):null!=t&&t.constructor==Object?e[o]=Ot(t):e[o]=t}return e},zt=function(n,t){const e=t.length,o=y(r=n)?At(r):null==r?r:r.constructor==Object?Ot(r):r;var r;let u=-1;for(;++u<e;)mt(o,t[u]);return o},It=(n,...t)=>Q(n.length,n,t);It.arity=function(n,t,...e){return Q(n,t,e)};return{pipe:function(...n){const f=n.pop().reduce(o);return 0==n.length?f:t(n)?e(n).then(c(r,f,u)):f(...n)},compose:function(...n){const f=n.pop().reduceRight(o);return 0==n.length?f:t(n)?e(n).then(c(r,f,u)):f(...n)},tap:p,forEach:function(...t){const e=t.pop();if(0==t.length)return c(Hn,u,e);const o=t[0];return n(o)?o.then(c(Hn,u,e)):Hn(o,e)},switchCase:(...n)=>{const o=n.pop();return I(o)?D(o,-2):0==n.length?(r=z,f=u,i=-2,(c=o)==u?((n,t,e)=>function(...o){return n(o,t,e)})(r,f,i):f==u?((n,t,e)=>function(...o){return n(t,o,e)})(r,c,i):((n,t,e)=>function(...o){return n(t,e,o)})(r,c,f)):t(n)?e(n).then(l(z,o,u,-2)):z(o,n,-2);var r,c,f,i},tryCatch:function(...n){if(n.length>2){const o=n.pop(),r=n.pop();return t(n)?e(n).then(l(O,r,o,u)):O(r,o,n)}const o=n[0],r=n[1];return function(...n){return O(o,r,n)}},all:x,assign:function(t,e){return null==e?c(M,u,t):n(t)?t.then(c(M,u,e)):M(t,e)},get:function(t,e,o){return n(t)?t.then(l(jt,u,e,o)):$(t)&&!y(t)?jt(t,e,o):l(jt,u,t,e)},set:function(t,e,o){return null==o?l(St,u,t,e):n(t)?t.then(l(St,u,e,o)):St(t,e,o)},pick:function(t,e){return null==e?c(Mt,u,t):n(t)?t.then(c(Mt,u,e)):Mt(t,e)},omit:function(t,e){return null==e?c(zt,u,t):n(t)?t.then(c(zt,u,e)):zt(t,e)},map:Z,filter:function(...n){const t=n.pop();return 0==n.length?c(ln,u,t):ln(n[0],t)},flatMap:(...t)=>{const e=t.pop();if(0==t.length)return c(Gn,u,e);const o=t[0];return n(o)?o.then(c(Gn,u,e)):Gn(t[0],e)},reduce:function(...t){return"function"==typeof t[0]?l(vn,u,t[0],t[1]):n(t[0])?t[0].then(l(vn,u,t[1],t[2])):vn(t[0],t[1],t[2])},transform:function(...t){return"function"==typeof t[0]?l(Pn,u,t[0],t[1]):n(t[0])?t[0].then(l(Pn,u,t[1],t[2])):Pn(t[0],t[1],t[2])},and:function(...n){const o=n.pop();return I(o)?Yn(o,-1):0==n.length?h(nt,u,o):t(n)?e(n).then(c(nt,u,o)):nt(n,o)},or:function(...n){const o=n.pop();return I(o)?tt(o,-1):0==n.length?h(ot,u,o):t(n)?e(n).then(c(ot,u,o)):ot(n,o)},not:function(...n){const o=n.pop();return"function"==typeof o?0==n.length?h(ut,u,o):t(n)?e(n).then(c(ut,u,o)):ut(n,o):!o},some:function(...t){const e=t.pop();if(0==t.length)return c(Qn,u,e);const o=t[0];return n(o)?o.then(c(Qn,u,e)):Qn(o,e)},every:function(...t){const e=t.pop();if(0==t.length)return c(Xn,u,e);const o=t[0];return n(o)?o.then(c(Xn,u,e)):Xn(o,e)},eq:ht,gt:at,lt:pt,gte:yt,lte:dt,thunkify:(n,...o)=>function(){return t(o)?e(o).then(c(r,n,u)):n(...o)},always:f,curry:It,__:u}}());
|
|
8
|
+
!function(n,t){"object"==typeof module?module.exports=t:"function"==typeof define?define((()=>t)):n.rubico=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=n=>null!=n&&"function"==typeof n.then,t=function(t){const e=t.length;let o=-1;for(;++o<e;){const e=t[o];if(n(e))return!0}return!1},e=Promise.all.bind(Promise),o=(t,e)=>function(...o){const r=t(...o);return n(r)?r.then(e):e(r)},r=(n,t)=>n(...t),u=Symbol.for("placeholder"),c=function(n,t,e){return t==u?((n,t)=>function(e){return n(e,t)})(n,e):((n,t)=>function(e){return n(t,e)})(n,t)},f=n=>function(){return n},i=(n,t)=>function(){return n(...t)},s=(n,t,e)=>n?t():e(),l=function(n,t,e,o){return t==u?((n,t,e)=>function(o){return n(o,t,e)})(n,e,o):e==u?((n,t,e)=>function(o){return n(t,o,e)})(n,t,o):((n,t,e)=>function(o){return n(t,e,o)})(n,t,e)},h=function(n,t,e){return t==u?((n,t,e)=>function(...e){return n(e,t)})(n,e):((n,t,e)=>function(...e){return n(t,e)})(n,t)},a=function(t,e){const o=t[0],r=e(...t);return n(r)?r.then(f(o)):o},p=function(...n){const t=n.pop();return 0==n.length?h(a,u,t):a(n,t)};p.if=(t,e)=>function(...o){const r=t(...o);if(n(r))return r.then(l(s,u,i(p(e),o),f(o[0])));if(r){const t=e(...o);if(n(t))return t.then(f(o[0]))}return o[0]};const y=Array.isArray,d=function(t,o){const r=t.length,u=Array(r);let c=-1,f=!1;for(;++c<r;){const e=t[c](...o);n(e)&&(f=!0),u[c]=e}return f?e(u):u},g=function(n,t,e,o,r){return t==u?((n,t,e,o)=>function(r){return n(r,t,e,o)})(n,e,o,r):e==u?((n,t,e,o)=>function(r){return n(t,r,e,o)})(n,t,o,r):o==u?((n,t,e,o)=>function(r){return n(t,e,r,o)})(n,t,e,r):((n,t,e,o)=>function(r){return n(t,e,o,r)})(n,t,e,o)},w=function(n,t,e){return n[t]=e,n},v=async function(t,e,o,r){const u=t.length;for(;++r<u;){const u=t[r](...e);o[r]=n(u)?await u:u}return o},b=function(t,e){const r=t.length,c=[];let f=-1;for(;++f<r;){const r=t[f](...e);if(n(r))return r.then(o(l(w,c,f,u),g(v,t,e,u,f)));c[f]=r}return c},j=function(t,o){const r={},c=[];for(const e in t){const f=t[e](...o);n(f)?c.push(f.then(l(w,r,e,u))):r[e]=f}return 0==c.length?r:e(c).then(f(r))},x=function(...n){const o=n.pop();return 0==n.length?y(o)?h(d,o,u):h(j,o,u):t(n)?y(o)?e(n).then(c(d,o,u)):e(n).then(c(j,o,u)):y(o)?d(o,n):j(o,n)};x.series=function(...n){const o=n.pop();return 0==n.length?h(b,o,u):t(n)?e(n).then(c(b,o,u)):b(o,n)};const S=Object.assign,M=function(t,e){const o=j(e,[t]);return n(o)?o.then(l(S,{},t,u)):{...t,...o}},m=function(n,t,e){return n(t,...e)},O=function(t,e,o){try{const r=t(...o);return n(r)?r.catch(l(m,e,u,o)):r}catch(n){return e(n,...o)}},A=(n,t,e,o)=>function(){return n(t,e,o)},z=function(t,e,o){const r=t.length-1;for(;(o+=2)<r;){const r=t[o],c=t[o+1],h="function"==typeof r?r(...e):r;if(n(h))return h.then(l(s,u,"function"==typeof c?i(c,e):f(c),A(z,t,e,o)));if(h)return"function"==typeof c?c(...e):c}if(o==t.length)return;const c=t[r];return"function"==typeof c?c(...e):c},I=function(n){const t=n.length;let e=-1;for(;++e<t;)if("function"==typeof n[e])return!1;return!0},E=(n,t,e)=>function(){return n(t,e)},D=function(t,e){const o=t.length,r=o-1;for(;(e+=2)<r;){const o=t[e],r=t[e+1];if(n(o))return o.then(l(s,u,f(r),E(D,t,e)));if(o)return r}if(e!=o)return t[e]},P=Symbol.iterator,T=(n,t)=>({toString:()=>"[object MappingIterator]",[P](){return this},next(){const e=n.next();return e.done?e:{value:t(e.value),done:!1}}}),B=n=>({value:n,done:!1}),k=Symbol.asyncIterator,C=(t,e)=>({[k](){return this},async next(){const o=await t.next();if(o.done)return o;const r=e(o.value);return n(r)?r.then(B):{value:r,done:!1}}}),$=function(t,o){const r=t.length,u=Array(r);let c=-1,f=!1;for(;++c<r;){const e=o(t[c],c,t);n(e)&&(f=!0),u[c]=e}return f?e(u):u},_=(n,t,e)=>n[t](e),q=function(t,o){const r=new Set,c=[];for(const e of t){const f=o(e,e,t);n(f)?c.push(f.then(l(_,r,"add",u))):r.add(f)}return 0==c.length?r:e(c).then(f(r))},F=(n,t,e,o)=>n[t](e,o),R=t=>new Promise((t=>function(e){const o={};let r=0;for(const u in t){const c=t[u];n(c)?(r+=1,c.then((n=>function(t){o[n]=t,r-=1,0==r&&e(o)})(u))):o[u]=c}0==r&&e(o)})(t)),V=function(t,e){const o={};let r=!1;for(const u in t){const c=e(t[u],u,t);n(c)&&(r=!0),o[u]=c}return r?R(o):o},G=async function(t,e,o,r){const u=t.length;for(;++r<u;){const u=e(t[r],r);o[r]=n(u)?await u:u}return o},H=n=>function(...t){return n(...t),t[0]},J=Promise.race.bind(Promise),K=async function(t,o,r,u,c,f){const i=t.length;for(;++c<i;){f.size>=r&&await J(f);const e=o(t[c]);if(n(e)){const n=e.then(H((()=>f.delete(n))));f.add(n),u[c]=n}else u[c]=e}return e(u)},L=(n,t,e)=>function(...o){const r=e.length,c=o.length,f=[];let i=-1,s=-1,l=0;for(;++i<r;){const r=e[i];if(r==u&&(s+=1)<c){const n=o[s];n==u&&(l+=1),f.push(n)}else f.push(r);if(f.length==n)return 0==l?t(...f):N(n,t,f)}for(;++s<c;){const e=o[s];if(e==u&&(l+=1),f.push(e),f.length==n)return 0==l?t(...f):N(n,t,f)}return N(n,t,f)},N=function(n,t,e){const o=e.length;if(o<n)return L(n,t,e);let r=-1;for(;++r<o;){if(e[r]==u)return L(n,t,e)}return t(...e)},Q=n=>function([t,e]){return n(t,e)},U=function(n,t,e){return n.set(t,e)},W=function(t,o){const r=new Map,u=[];return t.forEach(((t,e,o)=>function(r,u){const c=t([u,r]);n(c)?o.push(c.then(Q(N(3,U,[e])))):e.set(c[0],c[1])})(o,r,u)),0==u.length?r:e(u).then(f(r))},X=function(t,o){return y(t)?$(t,o):null==t?t:"function"==typeof t.then?t.then(o):"function"==typeof t.map?t.map(o):"string"==typeof t||t.constructor==String?function(t,e){const o=$(t,e);return n(o)?o.then(l(_,u,"join","")):o.join("")}(t,o):t.constructor==Set?q(t,o):t.constructor==Map?function(t,o){const r=new Map,c=[];for(const[e,f]of t){const i=o(f,e,t);n(i)?c.push(i.then(g(F,r,"set",e,u))):r.set(e,i)}return 0==c.length?r:e(c).then(f(r))}(t,o):"function"==typeof t[P]?T(t[P](),o):"function"==typeof t[k]?C(t[k](),o):t.constructor==Object?V(t,o):o(t)},Y=(...t)=>{const e=t.pop();if(0==t.length)return c(X,u,e);const o=t[0];return n(o)?o.then(c(X,u,e)):X(o,e)};Y.entries=function(t){return function(o){if(null==o)throw new TypeError("value is not an Object or Map");if(o.constructor==Object)return function(t,o){const r={},u=[];for(const e in t){const c=o([e,t[e]]);n(c)?u.push(c.then(Q(N(3,w,[r])))):r[c[0]]=c[1]}return 0==u.length?r:e(u).then(f(r))}(o,t);if(o.constructor==Map)return W(o,t);throw new TypeError("value is not an Object or Map")}},Y.series=t=>function(e){if(y(e))return function(t,e){const r=t.length,c=Array(r);let f=-1;for(;++f<r;){const r=e(t[f],f);if(n(r))return r.then(o(l(w,c,f,u),g(G,t,e,u,f)));c[f]=r}return c}(e,t);throw new TypeError(`${e} is not an Array`)},Y.pool=(t,e)=>function(o){if(y(o))return function(t,e,o){const r=t.length,u=Array(r);let c=-1;for(;++c<r;){const r=e(t[c]);if(n(r)){const n=new Set,f=r.then(H((()=>n.delete(f))));return n.add(f),u[c]=f,K(t,e,o,u,c,n)}u[c]=r}return u}(o,e,t);throw new TypeError(`${o} is not an Array`)};const Z=(n,t)=>({[P](){return this},next(){let e=n.next();for(;!e.done;){const{value:o}=e;if(t(o))return{value:o,done:!1};e=n.next()}return e}}),nn=(t,e)=>({isAsyncIteratorDone:!1,[k](){return this},async next(){for(;!this.isAsyncIteratorDone;){const{value:o,done:r}=await t.next();if(r)this.isAsyncIteratorDone=!0;else{const t=e(o);if(n(t)?await t:t)return{value:o,done:!1}}}return{value:void 0,done:!0}}}),tn=function(n,t,e,o){const r=t.length;let u=n.length-1;for(;++o<r;)n[++u]=e(t[o],o,n);return n},en=function(n,t,e,o){const r=n.length;let u=-1;for(;++e<r;)o[++u]&&t.push(n[e]);return t},on=function(t,o){const r=t.length,c=[];let f=-1,i=-1;for(;++f<r;){const r=t[f],s=o(r,f,t);if(n(s))return e(tn([s],t,o,f)).then(g(en,t,c,f-1,u));s&&(c[++i]=r)}return c},rn=(n,t)=>function(){return n(t)},un=function(){},cn=(n,t,e,o,r)=>function(){return n(t,e,o,r)},fn=function(n,t,e,o){o&&(n[t]=e)},sn=function(t,o){return y(t)?on(t,o):null==t?t:"string"==typeof t||t.constructor==String?function(t,e){const o=on(t,e);return n(o)?o.then(l(_,u,"join","")):o.join("")}(t,o):t.constructor==Set?function(t,o){const r=new Set,c=r.add.bind(r),i=[];for(const e of t){const f=o(e,e,t);n(f)?i.push(f.then(l(s,u,rn(c,e),un))):f&&r.add(e)}return 0==i.length?r:e(i).then(f(r))}(t,o):t.constructor==Map?function(t,o){const r=new Map,c=[];for(const[e,f]of t){const i=o(f,e,t);n(i)?c.push(i.then(l(s,u,cn(F,r,"set",e,f),un))):i&&r.set(e,f)}return 0==c.length?r:e(c).then(f(r))}(t,o):"function"==typeof t.filter?t.filter(o):"function"==typeof t[P]?Z(t[P](),o):"function"==typeof t[k]?nn(t[k](),o):t.constructor==Object?function(t,o){const r={},c=[];for(const e in t){const f=t[e],i=o(f,e,t);n(i)?c.push(i.then(g(fn,r,e,t[e],u))):i&&(r[e]=f)}return 0==c.length?r:e(c).then(f(r))}(t,o):t},ln=Object.values,hn=(Object.prototype.toString,async function(t,e,o){let r=t.next();if(r.done)return o;for(;!r.done;)o=e(o,r.value),n(o)&&(o=await o),r=t.next();return o}),an=async function(t,e,o,r){const u=t.length;for(;++r<u;)o=e(o,t[r],r,t),n(o)&&(o=await o);return o},pn=Object.keys,yn=async function(t,e,o,r,u){const c=r.length;for(;++u<c;){const c=r[u];o=e(o,t[c],c,t),n(o)&&(o=await o)}return o},dn=async function(t,e,o,r){for(const[u,c]of r)o=e(o,c,u,t),n(o)&&(o=await o);return o},gn=function(t,e,o){return y(t)?function(t,e,o){const r=t.length;let c=-1;for(void 0===o&&(o=t[++c]);++c<r;)if(o=e(o,t[c],c,t),n(o))return o.then(g(an,t,e,u,c));return o}(t,e,o):null==t?void 0===o?c(e,t,u):e(o,t):t.constructor==Map?function(t,e,o){const r=t.entries();if(void 0===o){const n=r.next();if(n.done)return o;o=n.value[1]}for(const[c,f]of r)if(o=e(o,f,c,t),n(o))return o.then(g(dn,t,e,u,r));return o}(t,e,o):"function"==typeof t[P]?function(t,e,o){let r=t.next();if(r.done)return o;for(void 0===o&&(o=r.value,r=t.next());!r.done;){if(o=e(o,r.value),n(o))return o.then(l(hn,t,e,u));r=t.next()}return o}(t[P](),e,o):"function"==typeof t[k]?async function(n,t,e){let o=await n.next();if(o.done)return e;for(void 0===e&&(e=o.value,o=await n.next());!o.done;)e=await t(e,o.value),o=await n.next();return e}(t[k](),e,o):"function"==typeof t.reduce?t.reduce(e,o):"function"==typeof t.chain?t.chain(c(e,o,u)):"function"==typeof t.flatMap?t.flatMap(c(e,o,u)):t.constructor==Object?function(t,e,o){const r=pn(t),c=r.length;let f=-1;for(void 0===o&&(o=t[r[++f]]);++f<c;){const c=r[f];if(o=e(o,t[c],c,t),n(o))return o.then((i=yn,l=e,h=u,a=r,p=f,(s=t)==u?((n,t,e,o,r)=>function(u){return n(u,t,e,o,r)})(i,l,h,a,p):l==u?((n,t,e,o,r)=>function(u){return n(t,u,e,o,r)})(i,s,h,a,p):h==u?((n,t,e,o,r)=>function(u){return n(t,e,u,o,r)})(i,s,l,a,p):a==u?((n,t,e,o,r)=>function(u){return n(t,e,o,u,r)})(i,s,l,h,p):((n,t,e,o,r)=>function(u){return n(t,e,o,r,u)})(i,s,l,h,a)))}var i,s,l,h,a,p;return o}(t,e,o):void 0===o?c(e,t,u):e(o,t)},wn=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(gn,t,e,u)):gn(t,e,r)}return n(o)?o.then(l(gn,t,e,u)):gn(t,e,o)},vn=ArrayBuffer.isView,bn=function(n,t){return y(t)||vn(t)?function(n,t){const e=n.length,o=t.length;let r=-1;for(;++r<o;)n[e+r]=t[r];return n}(n,t):(n.push(t),n)},jn="function"==typeof Buffer,xn=jn?Buffer.alloc:un,Sn=function(n,t){const e=n.length,o=jn&&n.constructor==Buffer?xn(e+t.length):new n.constructor(e+t.length);return o.set(n),o.set(t,e),o},Mn=function(n,t){return y(t)||vn(t)?Sn(n,t):Sn(n,[t])},mn=(n,t)=>new Promise(((n,t)=>function(e,o){t.on("data",(n=>function(t,e,o){return n.write(t,e,o),n})(n)),t.on("end",rn(e,n)),t.on("error",o)})(n,t)),On=function(n,t){return null!=(e=t)&&"function"==typeof e.pipe?mn(n,t):(n.write(t),n);var e},An=function(n,t){if(null!=t&&t.constructor==Set){for(const e of t)n.add(e);return n}return n.add(t)},zn=function(n,t){return n.concat(t)},In=function(t,e,o){const r=gn(t,e(un),null);return n(r)?r.then(f(o)):o},En=function(t,e,o){if(y(o))return gn(t,e(bn),o);if(vn(o)){const r=gn(t,e(bn),[]);return n(r)?r.then(c(Mn,o,u)):Mn(o,r)}if(null==o)return In(t,e,o);const r=o.constructor;if("string"==typeof o||r==String){const r=gn(t,e(bn),[o]);return n(r)?r.then(l(_,u,"join","")):r.join("")}return"function"==typeof o.concat?gn(t,e(zn),o):"function"==typeof o.write?gn(t,e(On),o):r==Set?gn(t,e(An),o):r==Object?gn(t,e(S),o):In(t,e,o)},Dn=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(En,t,e,u)):En(t,e,r)}return n(o)?o.then(l(En,t,e,u)):En(t,e,o)},Pn=function(n,t){return n.push(t),n},Tn=n=>new Promise((t=>{setTimeout(t,n)})),Bn=(n,t)=>t,kn=n=>n,Cn=(n,t)=>function(...e){return t(n(...e))},$n=async function(t,o){const r=[];for await(const e of t){const t=o(e);n(t)&&r.push(t)}return 0==r.length?t:e(r).then(f(t))},_n=function(t){const o=t.length,r=[],i=[];let s=-1;for(;++s<o;){const e=t[s];if(y(e)){const n=e.length;let t=-1;for(;++t<n;)i.push(e[t])}else if(null==e)i.push(e);else if("function"==typeof e.then)r.push(e.then(c(Pn,i,u)));else if("function"==typeof e[P])for(const n of e)i.push(n);else if("function"==typeof e[k])r.push($n(e[k](),c(Pn,i,u)));else if("function"==typeof e.chain){const t=e.chain(kn);n(t)?r.push(t.then(c(Pn,i,u))):i.push(t)}else if("function"==typeof e.flatMap){const t=e.flatMap(kn);n(t)?r.push(t.then(c(Pn,i,u))):i.push(t)}else if("function"==typeof e.reduce){const t=e.reduce(Cn(Bn,c(Pn,i,u)),null);n(t)&&r.push(t)}else if(e.constructor==Object)for(const n in e)i.push(e[n]);else i.push(e)}return 0==r.length?i:e(r).then(f(i))},qn=function(t){const o=[],r={},f=c(S,r,u),i=Cn(Bn,f);for(const e in t){const u=t[e];if(null!=u)if("function"==typeof u[P])for(const n of u)S(r,n);else if("function"==typeof u[k])o.push($n(u[k](),f));else if("function"==typeof u.chain){const t=u.chain(kn);n(t)?o.push(t.then(f)):S(r,t)}else if("function"==typeof u.flatMap){const t=u.flatMap(kn);n(t)?o.push(t.then(f)):f(t)}else if("function"==typeof u.reduce){const t=u.reduce(i,null);n(t)&&o.push(t)}else S(r,u)}return 0==o.length?r:e(o).then((()=>r))},Fn=function(t){t.size;const o=[],r=new Set,c=(n,t)=>r.add(t),f=l(_,r,"add",u);for(const e of t)if(y(e)){const n=e.length;let t=-1;for(;++t<n;)r.add(e[t])}else if(null==e)r.add(e);else if("function"==typeof e[P])for(const n of e)r.add(n);else if("function"==typeof e[k])o.push($n(e[k](),f));else if("function"==typeof e.chain){const t=e.chain(kn);n(t)?o.push(t.then(f)):r.add(t)}else if("function"==typeof e.flatMap){const t=e.flatMap(kn);n(t)?o.push(t.then(f)):r.add(t)}else if("function"==typeof e.reduce){const t=e.reduce(c,null);n(t)&&o.push(t)}else if(e.constructor==Object)for(const n in e)r.add(e[n]);else r.add(e);return 0==o.length?r:e(o).then((()=>r))},Rn=o(_n,c(((n,t)=>n.join(t)),u,"")),Vn=function(t,e){if(y(t))return function(t,e){const o=$(t,e);return n(o)?o.then(_n):_n(o)}(t,e);if(null==t)return e(t);if("function"==typeof t.then)return t.then(e);if("function"==typeof t.next)return P in t?function(n,t){let e=[],o=0;return{[P](){return this},next(){if(o<e.length){const n=e[o];return o+=1,{value:n,done:!1}}const r=n.next();if(r.done)return r;const u=gn(t(r.value),Pn,[]);return u.length>1&&(e=u,o=1),{value:u[0],done:!1}}}}(t,e):function(t,e){const o=[],r=new Set;return{isAsyncIteratorDone:!1,[k](){return this},toString:()=>"[object FlatMappingAsyncIterator]",async next(){for(;!this.isAsyncIteratorDone||o.length>0||r.size>0;){if(!this.isAsyncIteratorDone){const{value:c,done:f}=await t.next();if(f)this.isAsyncIteratorDone=f;else{const t=e(c);if(n(t)){const n=t.then(l(gn,u,Pn,o)).then((()=>r.delete(n)));r.add(n)}else{const e=gn(t,Pn,o);if(n(e)){const n=e.then((()=>r.delete(n)));r.add(n)}}}}if(o.length>0)return{value:o.shift(),done:!1};r.size>0&&await J([Tn(1e3),...r])}return{value:void 0,done:!0}}}}(t,e);if("function"==typeof t.chain)return t.chain(e);if("function"==typeof t.flatMap)return t.flatMap(e);const o=t.constructor;return o==Object?function(t,e){const o=V(t,e);return n(o)?o.then(qn):qn(o)}(t,e):o==Set?function(t,e){const o=q(t,e);return n(o)?o.then(Fn):Fn(o)}(t,e):"string"==typeof t||o==String?function(t,e){const o=$(t,e);return n(o)?o.then(Rn):Rn(o)}(t,e):e(t)},Gn=function(t,o){return y(t)?function(t,o){const r=t.length,u=[];let c=-1;for(;++c<r;){const e=o(t[c]);n(e)&&u.push(e)}return 0==u.length?t:e(u).then(f(t))}(t,o):null==t?t:"function"==typeof t.forEach?t.forEach(o):"function"==typeof t[P]?function(t,o){const r=[];for(const e of t){const t=o(e);n(t)&&r.push(t)}return 0==r.length?t:e(r).then(f(t))}(t[P](),o):"function"==typeof t[k]?$n(t[k](),o):t.constructor==Object?function(t,o){const r=[];for(const e in t){const u=o(t[e]);n(u)&&r.push(u)}return 0==r.length?t:e(r).then(f(t))}(t,o):t},Hn=function(n){const t=n.then((n=>[n,t]));return t},Jn=async function(t,e,o,r){const u=t.length;for(;++o<u;){const u=e(t[o]);if(n(u))r.add(Hn(u));else if(u)return!0}for(;r.size>0;){const[n,t]=await J(r);if(r.delete(t),n)return!0}return!1},Kn=function(t,e){const o=t.length;let r=-1;for(;++r<o;){const o=e(t[r]);if(n(o))return Jn(t,e,r,new Set([Hn(o)]));if(o)return!0}return!1},Ln=async function(t,e,o,r=20){let u=t.next();for(n(u)&&(u=await u);!u.done;){if(o.size>=r){const[n,t]=await J(o);if(o.delete(t),n)return!0}const c=e(u.value);if(n(c))o.add(Hn(c));else if(c)return!0;u=t.next(),n(u)&&(u=await u)}for(;o.size>0;){const[n,t]=await J(o);if(o.delete(t),n)return!0}return!1},Nn=function(t,e){return y(t)?Kn(t,e):null==t?e(t):"function"==typeof t[P]?function(t,e){for(const o of t){const r=e(o);if(n(r))return Ln(t,e,new Set([Hn(r)]));if(r)return!0}return!1}(t[P](),e):"function"==typeof t[k]?Ln(t[k](),e,new Set):"function"==typeof t.reduce?t.reduce((t=>function(e,o){return!0===e?e:n(e)?e.then(c((n=>function(t,e){return!!t||n(e)})(t),u,o)):!!e||t(o)})(e),!1):t.constructor==Object?Kn(ln(t),e):e(t)},Qn=function(t,o){const r=t.length,c=[];let f=-1;for(;++f<r;){const e=o(t[f]);if(n(e))c.push(e);else if(!e)return!1}return 0==c.length||e(c).then(l(_,u,"every",Boolean))},Un=(n,t,e)=>!!t&&n(e),Wn=function(t,o){return y(t)?Qn(t,o):null==t?o(t):"function"==typeof t[P]?function(t,o){const r=[];for(const e of t){const t=o(e);if(n(t))r.push(t);else if(!t)return!1}return 0==r.length||e(r).then(l(_,u,"every",Boolean))}(t[P](),o):"function"==typeof t[k]?async function(t,e,o,r=20){let u=await t.next();for(;!u.done;){if(o.size>=r){const[n,t]=await J(o);if(o.delete(t),!n)return!1}const c=e(u.value);if(n(c))o.add(Hn(c));else if(!c)return!1;u=await t.next()}for(;o.size>0;){const[n,t]=await J(o);if(o.delete(t),!n)return!1}return!0}(t[k](),o,new Set):"function"==typeof t.reduce?t.reduce((t=>function(e,o){return!1!==e&&(n(e)?e.then(l(Un,t,u,o)):!!e&&t(o))})(o),!0):t.constructor==Object?Qn(ln(t),o):o(t)},Xn=function(t,e){const o=t.length;for(;++e<o;){const o=t[e];if(n(o))return o.then(l(s,u,E(Xn,t,e),f(!1)));if(!o)return!1}return!0},Yn=async function(t,e,o){const r=e.length;for(;++o<r;){let r=e[o];if("function"==typeof r&&(r=r(...t)),n(r)&&(r=await r),!r)return!1}return!0},Zn=function(t,e){const o=e.length;let r=-1;for(;++r<o;){let o=e[r];if("function"==typeof o&&(o=o(...t)),n(o))return o.then(l(s,u,A(Yn,t,e,r),f(!1)));if(!o)return!1}return!0},nt=function(t,e){const o=t.length;for(;++e<o;){const o=t[e];if(n(o))return o.then(l(s,u,f(!0),E(nt,t,e)));if(o)return!0}return!1},tt=async function(t,e,o){const r=e.length;for(;++o<r;){let r=e[o];if("function"==typeof r&&(r=r(...t)),n(r)&&(r=await r),r)return!0}return!1},et=function(t,e){const o=e.length;let r=-1;for(;++r<o;){let o=e[r];if("function"==typeof o&&(o=o(...t)),n(o))return o.then(l(s,u,f(!0),A(tt,t,e,r)));if(o)return!0}return!1},ot=n=>!n,rt=function(t,e){const o=e(...t);return n(o)?o.then(ot):!o},ut=function(n,t,e,o,r){return t==u?((n,t,e,o)=>function(...r){return n(r,t,e,o)})(n,e,o,r):e==u?((n,t,e,o)=>function(...r){return n(t,r,e,o)})(n,t,o,r):o==u?((n,t,e,o)=>function(...r){return n(t,e,r,o)})(n,t,e,r):((n,t,e,o)=>function(...r){return n(t,e,o,r)})(n,t,e,o)},ct=function(t,o,r,u){const c=r(...t),f=u(...t);return n(c)||n(f)?e([c,f]).then(Q(o)):o(c,f)},ft=function(t,o,r,u){const c=r(...t);return n(c)||n(u)?e([c,u]).then(Q(o)):o(c,u)},it=function(t,o,r,u){const c=u(...t);return n(r)||n(c)?e([r,c]).then(Q(o)):o(r,c)},st=o=>function(...r){const c=r.pop(),f=r.pop(),i="function"==typeof f,s="function"==typeof c;return i&&s?0==r.length?ut(ct,u,o,f,c):t(r)?e(r).then(g(ct,u,o,f,c)):ct(r,o,f,c):i?0==r.length?ut(ft,u,o,f,c):t(r)?e(r).then(g(ft,u,o,f,c)):ft(r,o,f,c):s?0==r.length?ut(it,u,o,f,c):t(r)?e(r).then(g(it,u,o,f,c)):it(r,o,f,c):n(f)||n(c)?e([f,c]).then(Q(o)):o(f,c)},lt=st((function(n,t){return n==t})),ht=st(((n,t)=>n>t)),at=st(((n,t)=>n<t)),pt=st(((n,t)=>n>=t)),yt=st(((n,t)=>n<=t)),dt=/[.|[|\]]+/,gt=function(n,t){const e=new Map,o=function(o){if(e.has(o))return e.get(o);const r=n(o);return e.set(o,r),e.size>t&&e.clear(),r};return o.cache=e,o}((function(n){const t=n.length-1,e="["==n[0],o="]"==n[t];return e&&o?n.slice(1,t).split(dt):e?n.slice(1).split(dt):o?n.slice(0,t).split(dt):n.split(dt)}),500),wt=n=>y(n)?n:"string"==typeof n?gt(n):[n],vt=function(n,t){const e=wt(t),o=e.length;let r=-1,u=n;for(;++r<o;)if(u=u[e[r]],null==u)return;return u},bt=function(n,t,e){const o=null==n?void 0:vt(n,t);return void 0===o?"function"==typeof e?e(n):e:o},jt=function(n,t,e){if(!(n=>{if(null==n)return!1;const t=typeof n;return"object"==t||"function"==t})(n))return n;const o=wt(e),r=o.length,u=r-1,c={...n};let f=c,i=-1;for(;++i<r;){const n=o[i];if(i==u)f[n]=t;else{const t=f[n],e=y(t)?t.slice():{...t};f[n]=e,f=e}}return c},xt=function(t,e,o){if("function"==typeof o){const r=o(t);return n(r)?r.then(l(jt,t,u,e)):jt(t,r,e)}return n(o)?o.then(l(jt,t,u,e)):jt(t,o,e)},St=function(n,t){if(null==n)return n;const e=t.length;let o={},r=-1;for(;++r<e;){const e=t[r],u=vt(n,e);null!=u&&(o=jt(o,u,e))}return o},Mt=function(n,t){if(null==n)return;const e=wt(t),o=e.length-1;let r=-1,u=n;for(;++r<o;)if(u=u[e[r]],null==u)return;const c=e[r];null!=u&&c in u&&delete u[c]},mt=function(n){const t={};for(const e in n){const o=n[e];y(o)?t[e]=Ot(o):null!=o&&o.constructor==Object?t[e]=mt(o):t[e]=o}return t},Ot=function(n){const t=n.length,e=[];let o=-1;for(;++o<t;){const t=n[o];y(t)?e[o]=Ot(t):null!=t&&t.constructor==Object?e[o]=mt(t):e[o]=t}return e},At=function(n,t){const e=t.length,o=y(r=n)?Ot(r):null==r?r:r.constructor==Object?mt(r):r;var r;let u=-1;for(;++u<e;)Mt(o,t[u]);return o},zt=(n,...t)=>N(n.length,n,t);zt.arity=function(n,t,...e){return N(n,t,e)};return{pipe:function(...n){const f=n.pop().reduce(o);return 0==n.length?f:t(n)?e(n).then(c(r,f,u)):f(...n)},compose:function(...n){const f=n.pop().reduceRight(o);return 0==n.length?f:t(n)?e(n).then(c(r,f,u)):f(...n)},tap:p,forEach:function(...t){const e=t.pop();if(0==t.length)return c(Gn,u,e);const o=t[0];return n(o)?o.then(c(Gn,u,e)):Gn(o,e)},switchCase:(...n)=>{const o=n.pop();return I(o)?D(o,-2):0==n.length?(r=z,f=u,i=-2,(c=o)==u?((n,t,e)=>function(...o){return n(o,t,e)})(r,f,i):f==u?((n,t,e)=>function(...o){return n(t,o,e)})(r,c,i):((n,t,e)=>function(...o){return n(t,e,o)})(r,c,f)):t(n)?e(n).then(l(z,o,u,-2)):z(o,n,-2);var r,c,f,i},tryCatch:function(...n){if(n.length>2){const o=n.pop(),r=n.pop();return t(n)?e(n).then(l(O,r,o,u)):O(r,o,n)}const o=n[0],r=n[1];return function(...n){return O(o,r,n)}},all:x,assign:function(t,e){return null==e?c(M,u,t):n(t)?t.then(c(M,u,e)):M(t,e)},get:function(t,e,o){return"string"==typeof t||"number"==typeof t||y(t)?l(bt,u,t,e):n(t)?t.then(l(bt,u,e,o)):bt(t,e,o)},set:function(t,e,o){return null==o?l(xt,u,t,e):n(t)?t.then(l(xt,u,e,o)):xt(t,e,o)},pick:function(t,e){return null==e?c(St,u,t):n(t)?t.then(c(St,u,e)):St(t,e)},omit:function(t,e){return null==e?c(At,u,t):n(t)?t.then(c(At,u,e)):At(t,e)},map:Y,filter:function(...n){const t=n.pop();return 0==n.length?c(sn,u,t):sn(n[0],t)},flatMap:(...t)=>{const e=t.pop();if(0==t.length)return c(Vn,u,e);const o=t[0];return n(o)?o.then(c(Vn,u,e)):Vn(t[0],e)},reduce:function(...t){return"function"==typeof t[0]?l(wn,u,t[0],t[1]):n(t[0])?t[0].then(l(wn,u,t[1],t[2])):wn(t[0],t[1],t[2])},transform:function(...t){return"function"==typeof t[0]?l(Dn,u,t[0],t[1]):n(t[0])?t[0].then(l(Dn,u,t[1],t[2])):Dn(t[0],t[1],t[2])},and:function(...n){const o=n.pop();return I(o)?Xn(o,-1):0==n.length?h(Zn,u,o):t(n)?e(n).then(c(Zn,u,o)):Zn(n,o)},or:function(...n){const o=n.pop();return I(o)?nt(o,-1):0==n.length?h(et,u,o):t(n)?e(n).then(c(et,u,o)):et(n,o)},not:function(...n){const o=n.pop();return"function"==typeof o?0==n.length?h(rt,u,o):t(n)?e(n).then(c(rt,u,o)):rt(n,o):!o},some:function(...t){const e=t.pop();if(0==t.length)return c(Nn,u,e);const o=t[0];return n(o)?o.then(c(Nn,u,e)):Nn(o,e)},every:function(...t){const e=t.pop();if(0==t.length)return c(Wn,u,e);const o=t[0];return n(o)?o.then(c(Wn,u,e)):Wn(o,e)},eq:lt,gt:ht,lt:at,gte:pt,lte:yt,thunkify:(n,...o)=>function(){return t(o)?e(o).then(c(r,n,u)):n(...o)},always:f,curry:zt,__:u}}());
|
package/dist/rubico.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.3.
|
|
2
|
+
* rubico v2.3.2
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
|
-
* (c) 2019-
|
|
4
|
+
* (c) 2019-2024 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -635,7 +635,7 @@ const arrayMapSeriesAsync = async function (
|
|
|
635
635
|
) {
|
|
636
636
|
const arrayLength = array.length
|
|
637
637
|
while (++index < arrayLength) {
|
|
638
|
-
const resultItem = mapper(array[index])
|
|
638
|
+
const resultItem = mapper(array[index], index)
|
|
639
639
|
result[index] = isPromise(resultItem) ? await resultItem : resultItem
|
|
640
640
|
}
|
|
641
641
|
return result
|
|
@@ -647,7 +647,7 @@ const arrayMapSeries = function (array, mapper) {
|
|
|
647
647
|
let index = -1
|
|
648
648
|
|
|
649
649
|
while (++index < arrayLength) {
|
|
650
|
-
const resultItem = mapper(array[index])
|
|
650
|
+
const resultItem = mapper(array[index], index)
|
|
651
651
|
if (isPromise(resultItem)) {
|
|
652
652
|
return resultItem.then(funcConcat(
|
|
653
653
|
curry3(objectSet, result, index, __),
|
|
@@ -2583,13 +2583,13 @@ const _get = function (object, path, defaultValue) {
|
|
|
2583
2583
|
}
|
|
2584
2584
|
|
|
2585
2585
|
const get = function (arg0, arg1, arg2) {
|
|
2586
|
+
if (typeof arg0 == 'string' || typeof arg0 == 'number' || isArray(arg0)) {
|
|
2587
|
+
return curry3(_get, __, arg0, arg1)
|
|
2588
|
+
}
|
|
2586
2589
|
if (isPromise(arg0)) {
|
|
2587
2590
|
return arg0.then(curry3(_get, __, arg1, arg2))
|
|
2588
2591
|
}
|
|
2589
|
-
|
|
2590
|
-
return _get(arg0, arg1, arg2)
|
|
2591
|
-
}
|
|
2592
|
-
return curry3(_get, __, arg0, arg1)
|
|
2592
|
+
return _get(arg0, arg1, arg2)
|
|
2593
2593
|
}
|
|
2594
2594
|
|
|
2595
2595
|
const setByPath = function (obj, value, path) {
|
package/dist/set.es.js
CHANGED
package/dist/set.es.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rubico v2.3.
|
|
2
|
+
* rubico v2.3.2
|
|
3
3
|
* https://github.com/a-synchronous/rubico
|
|
4
|
-
* (c) 2019-
|
|
4
|
+
* (c) 2019-2024 Richard Tong
|
|
5
5
|
* rubico may be freely distributed under the MIT license.
|
|
6
6
|
*/
|
|
7
7
|
const isPromise=r=>null!=r&&"function"==typeof r.then,isArray=Array.isArray,isObject=r=>{if(null==r)return!1;const e=typeof r;return"object"==e||"function"==e},memoizeCappedUnary=function(r,e){const t=new Map,n=function(n){if(t.has(n))return t.get(n);const s=r(n);return t.set(n,s),t.size>e&&t.clear(),s};return n.cache=t,n},pathDelimiters=/[.|[|\]]+/,parsePropertyPath=function(r){const e=r.length-1,t="["==r[0],n="]"==r[e];return t&&n?r.slice(1,e).split(pathDelimiters):t?r.slice(1).split(pathDelimiters):n?r.slice(0,e).split(pathDelimiters):r.split(pathDelimiters)},memoizedCappedParsePropertyPath=memoizeCappedUnary(parsePropertyPath,500),propertyPathToArray=r=>isArray(r)?r:"string"==typeof r?memoizedCappedParsePropertyPath(r):[r],setByPath=function(r,e,t){if(!isObject(r))return r;const n=propertyPathToArray(t),s=n.length,i=s-1,o={...r};let c=o,u=-1;for(;++u<s;){const r=n[u];if(u==i)c[r]=e;else{const e=c[r],t=isArray(e)?e.slice():{...e};c[r]=t,c=t}}return o},__=Symbol.for("placeholder"),curry3ResolveArg0=(r,e,t)=>function(n){return r(n,e,t)},curry3ResolveArg1=(r,e,t)=>function(n){return r(e,n,t)},curry3ResolveArg2=(r,e,t)=>function(n){return r(e,t,n)},curry3=function(r,e,t,n){return e==__?curry3ResolveArg0(r,t,n):t==__?curry3ResolveArg1(r,e,n):curry3ResolveArg2(r,e,t)},_set=function(r,e,t){if("function"==typeof t){const n=t(r);return isPromise(n)?n.then(curry3(setByPath,r,__,e)):setByPath(r,n,e)}return isPromise(t)?t.then(curry3(setByPath,r,__,e)):setByPath(r,t,e)},set=function(r,e,t){return null==t?curry3(_set,__,r,e):isPromise(r)?r.then(curry3(_set,__,e,t)):_set(r,e,t)};export default set;
|