partial.lenses
Advanced tools
Comparing version 13.7.3 to 13.7.4
# Partial Lenses Changelog | ||
## 13.7.4 | ||
Worked around an issue with React Native, see | ||
[#161](https://github.com/calmm-js/partial.lenses/issues/161). | ||
## 13.7.2 | ||
@@ -4,0 +9,0 @@ |
@@ -22,3 +22,3 @@ 'use strict'; | ||
}; | ||
var protoless0 = /*#__PURE__*/I.freeze( /*#__PURE__*/protoless(0)); | ||
var protoless0 = /*#__PURE__*/I.freeze( /*#__PURE__*/protoless(I.object0)); | ||
@@ -866,5 +866,7 @@ var dep = function dep(xs2xsyC) { | ||
var ifteU = function ifteU(c, t, e) { | ||
return function (x, i, C, xi2yC) { | ||
return (c(x, i) ? t : e)(x, i, C, xi2yC); | ||
var eitherU = function eitherU(t, e) { | ||
return function (c) { | ||
return function (x, i, C, xi2yC) { | ||
return (c(x, i) ? t : e)(x, i, C, xi2yC); | ||
}; | ||
}; | ||
@@ -1032,3 +1034,3 @@ }; | ||
var c = arguments[n]; | ||
r = c.length < 2 ? toFunction(c[0]) : ifteU(c[0], toFunction(c[1]), r); | ||
r = c.length < 2 ? toFunction(c[0]) : eitherU(toFunction(c[1]), r)(c[0]); | ||
} | ||
@@ -1063,3 +1065,3 @@ return r; | ||
var ifElse = /*#__PURE__*/I.curry(function (c, t, e) { | ||
return ifteU(c, toFunction(t), toFunction(e)); | ||
return eitherU(toFunction(t), toFunction(e))(c); | ||
}); | ||
@@ -1076,3 +1078,3 @@ | ||
while (0 <= (n -= 2)) { | ||
r = ifteU(arguments[n], toFunction(arguments[n + 1]), r); | ||
r = eitherU(toFunction(arguments[n + 1]), r)(arguments[n]); | ||
}return r; | ||
@@ -1099,9 +1101,5 @@ }); | ||
var unless = function unless(p) { | ||
return ifteU(p, zeroOp, identity); | ||
}; | ||
var unless = /*#__PURE__*/eitherU(zeroOp, identity); | ||
var when = function when(p) { | ||
return ifteU(p, identity, zeroOp); | ||
}; | ||
var when = /*#__PURE__*/eitherU(identity, zeroOp); | ||
@@ -1108,0 +1106,0 @@ var optional = /*#__PURE__*/when(I.isDefined); |
@@ -18,3 +18,3 @@ import { isArray, freeze, isObject, id, acyclicEqualsU, array0, object0, sndU, always, curry, isFunction, isString, curryN, assocPartialU, dissocPartialU, constructorOf, toObject, applyU, isDefined, keys, hasU, assign, arityN } from 'infestines'; | ||
}; | ||
var protoless0 = /*#__PURE__*/freeze( /*#__PURE__*/protoless(0)); | ||
var protoless0 = /*#__PURE__*/freeze( /*#__PURE__*/protoless(object0)); | ||
@@ -862,5 +862,7 @@ var dep = function dep(xs2xsyC) { | ||
var ifteU = function ifteU(c, t, e) { | ||
return function (x, i, C, xi2yC) { | ||
return (c(x, i) ? t : e)(x, i, C, xi2yC); | ||
var eitherU = function eitherU(t, e) { | ||
return function (c) { | ||
return function (x, i, C, xi2yC) { | ||
return (c(x, i) ? t : e)(x, i, C, xi2yC); | ||
}; | ||
}; | ||
@@ -1028,3 +1030,3 @@ }; | ||
var c = arguments[n]; | ||
r = c.length < 2 ? toFunction(c[0]) : ifteU(c[0], toFunction(c[1]), r); | ||
r = c.length < 2 ? toFunction(c[0]) : eitherU(toFunction(c[1]), r)(c[0]); | ||
} | ||
@@ -1059,3 +1061,3 @@ return r; | ||
var ifElse = /*#__PURE__*/curry(function (c, t, e) { | ||
return ifteU(c, toFunction(t), toFunction(e)); | ||
return eitherU(toFunction(t), toFunction(e))(c); | ||
}); | ||
@@ -1072,3 +1074,3 @@ | ||
while (0 <= (n -= 2)) { | ||
r = ifteU(arguments[n], toFunction(arguments[n + 1]), r); | ||
r = eitherU(toFunction(arguments[n + 1]), r)(arguments[n]); | ||
}return r; | ||
@@ -1095,9 +1097,5 @@ }); | ||
var unless = function unless(p) { | ||
return ifteU(p, zeroOp, identity); | ||
}; | ||
var unless = /*#__PURE__*/eitherU(zeroOp, identity); | ||
var when = function when(p) { | ||
return ifteU(p, identity, zeroOp); | ||
}; | ||
var when = /*#__PURE__*/eitherU(identity, zeroOp); | ||
@@ -1104,0 +1102,0 @@ var optional = /*#__PURE__*/when(isDefined); |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('infestines')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'infestines'], factory) : | ||
(factory((global.L = {}),global.I)); | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('infestines')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'infestines'], factory) : | ||
(factory((global.L = {}),global.I)); | ||
}(this, (function (exports,I) { 'use strict'; | ||
var ltU = function ltU(x, y) { | ||
return x < y; | ||
}; | ||
var gtU = function gtU(x, y) { | ||
return x > y; | ||
}; | ||
var ltU = function ltU(x, y) { | ||
return x < y; | ||
}; | ||
var gtU = function gtU(x, y) { | ||
return x > y; | ||
}; | ||
var isInstanceOf = /*#__PURE__*/I.curry(function (Class, x) { | ||
return x instanceof Class; | ||
}); | ||
var isInstanceOf = /*#__PURE__*/I.curry(function (Class, x) { | ||
return x instanceof Class; | ||
}); | ||
var create = Object.create; | ||
var protoless = function protoless(o) { | ||
return I.assign(create(null), o); | ||
}; | ||
var protoless0 = /*#__PURE__*/I.freeze( /*#__PURE__*/protoless(0)); | ||
var create = Object.create; | ||
var protoless = function protoless(o) { | ||
return I.assign(create(null), o); | ||
}; | ||
var protoless0 = /*#__PURE__*/I.freeze( /*#__PURE__*/protoless(I.object0)); | ||
var dep = function dep(xs2xsyC) { | ||
return function (xsy) { | ||
return I.arityN(xsy.length, function () { | ||
return xs2xsyC.apply(undefined, arguments)(xsy).apply(undefined, arguments); | ||
}); | ||
var dep = function dep(xs2xsyC) { | ||
return function (xsy) { | ||
return I.arityN(xsy.length, function () { | ||
return xs2xsyC.apply(undefined, arguments)(xsy).apply(undefined, arguments); | ||
}); | ||
}; | ||
}; | ||
}; | ||
var fn = function fn(xsC, yC) { | ||
return function (xsy) { | ||
return I.arityN(xsy.length, function () { | ||
for (var _len = arguments.length, xs = Array(_len), _key = 0; _key < _len; _key++) { | ||
xs[_key] = arguments[_key]; | ||
} | ||
var fn = function fn(xsC, yC) { | ||
return function (xsy) { | ||
return I.arityN(xsy.length, function () { | ||
for (var _len = arguments.length, xs = Array(_len), _key = 0; _key < _len; _key++) { | ||
xs[_key] = arguments[_key]; | ||
} | ||
return yC(xsy.apply(null, xsC(xs))); | ||
}); | ||
return yC(xsy.apply(null, xsC(xs))); | ||
}); | ||
}; | ||
}; | ||
}; | ||
var res = function res(yC) { | ||
return fn(I.id, yC); | ||
}; | ||
var res = function res(yC) { | ||
return fn(I.id, yC); | ||
}; | ||
var args = function args(xsC) { | ||
return fn(xsC, I.id); | ||
}; | ||
var args = function args(xsC) { | ||
return fn(xsC, I.id); | ||
}; | ||
var nth = function nth(i, xC) { | ||
return function (xs) { | ||
var ys = xs.slice(0); | ||
ys[i] = xC(ys[i]); | ||
return ys; | ||
var nth = function nth(i, xC) { | ||
return function (xs) { | ||
var ys = xs.slice(0); | ||
ys[i] = xC(ys[i]); | ||
return ys; | ||
}; | ||
}; | ||
}; | ||
var par = function par(i, xC) { | ||
return args(nth(i, xC)); | ||
}; | ||
var par = function par(i, xC) { | ||
return args(nth(i, xC)); | ||
}; | ||
var and = function and() { | ||
for (var _len2 = arguments.length, xCs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
xCs[_key2] = arguments[_key2]; | ||
} | ||
var and = function and() { | ||
for (var _len2 = arguments.length, xCs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
xCs[_key2] = arguments[_key2]; | ||
} | ||
return function (x) { | ||
for (var i = 0, n = xCs.length; i < n; ++i) { | ||
x = xCs[i](x); | ||
}return x; | ||
return function (x) { | ||
for (var i = 0, n = xCs.length; i < n; ++i) { | ||
x = xCs[i](x); | ||
}return x; | ||
}; | ||
}; | ||
}; | ||
var or = function or() { | ||
for (var _len3 = arguments.length, xCs = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
xCs[_key3] = arguments[_key3]; | ||
} | ||
var or = function or() { | ||
for (var _len3 = arguments.length, xCs = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
xCs[_key3] = arguments[_key3]; | ||
} | ||
return function (x) { | ||
var es = null; | ||
for (var i = 0, n = xCs.length; i < n; ++i) { | ||
try { | ||
return xCs[i](x); | ||
} catch (e) { | ||
es = e; | ||
return function (x) { | ||
var es = null; | ||
for (var i = 0, n = xCs.length; i < n; ++i) { | ||
try { | ||
return xCs[i](x); | ||
} catch (e) { | ||
es = e; | ||
} | ||
} | ||
} | ||
throw es; | ||
throw es; | ||
}; | ||
}; | ||
}; | ||
var ef = function ef(xE) { | ||
return function (x) { | ||
xE(x); | ||
return x; | ||
var ef = function ef(xE) { | ||
return function (x) { | ||
xE(x); | ||
return x; | ||
}; | ||
}; | ||
}; | ||
var tup = function tup() { | ||
for (var _len4 = arguments.length, xCs = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { | ||
xCs[_key4] = arguments[_key4]; | ||
} | ||
var tup = function tup() { | ||
for (var _len4 = arguments.length, xCs = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { | ||
xCs[_key4] = arguments[_key4]; | ||
} | ||
return function (xs) { | ||
if (xs.length !== xCs.length) throw Error('Expected array of ' + xCs.length + ' elements, but got ' + xs.length); | ||
return and.apply(null, xCs.map(function (xC, i) { | ||
return nth(i, xC); | ||
}))(xs); | ||
return function (xs) { | ||
if (xs.length !== xCs.length) throw Error('Expected array of ' + xCs.length + ' elements, but got ' + xs.length); | ||
return and.apply(null, xCs.map(function (xC, i) { | ||
return nth(i, xC); | ||
}))(xs); | ||
}; | ||
}; | ||
}; | ||
var arr = function arr(xC) { | ||
return function (xs) { | ||
return xs.map(xC); | ||
var arr = function arr(xC) { | ||
return function (xs) { | ||
return xs.map(xC); | ||
}; | ||
}; | ||
}; | ||
// | ||
// | ||
var toStringPartial = function toStringPartial(x) { | ||
return void 0 !== x ? String(x) : ''; | ||
}; | ||
var toStringPartial = function toStringPartial(x) { | ||
return void 0 !== x ? String(x) : ''; | ||
}; | ||
var sliceIndex = function sliceIndex(m, l, d, i) { | ||
return void 0 !== i ? Math.min(Math.max(m, i < 0 ? l + i : i), l) : d; | ||
}; | ||
var sliceIndex = function sliceIndex(m, l, d, i) { | ||
return void 0 !== i ? Math.min(Math.max(m, i < 0 ? l + i : i), l) : d; | ||
}; | ||
var cpair = function cpair(xs) { | ||
return function (x) { | ||
return [x, xs]; | ||
var cpair = function cpair(xs) { | ||
return function (x) { | ||
return [x, xs]; | ||
}; | ||
}; | ||
}; | ||
var unto = function unto(c) { | ||
return function (x) { | ||
return void 0 !== x ? x : c; | ||
var unto = function unto(c) { | ||
return function (x) { | ||
return void 0 !== x ? x : c; | ||
}; | ||
}; | ||
}; | ||
var unto0 = /*#__PURE__*/unto(0); | ||
var unto0 = /*#__PURE__*/unto(0); | ||
var notPartial = function notPartial(x) { | ||
return void 0 !== x ? !x : x; | ||
}; | ||
var notPartial = function notPartial(x) { | ||
return void 0 !== x ? !x : x; | ||
}; | ||
var singletonPartial = function singletonPartial(x) { | ||
return void 0 !== x ? [x] : x; | ||
}; | ||
var singletonPartial = function singletonPartial(x) { | ||
return void 0 !== x ? [x] : x; | ||
}; | ||
var expect = function expect(p, f) { | ||
return function (x) { | ||
return p(x) ? f(x) : void 0; | ||
var expect = function expect(p, f) { | ||
return function (x) { | ||
return p(x) ? f(x) : void 0; | ||
}; | ||
}; | ||
}; | ||
function deepFreeze(x) { | ||
if (I.isArray(x)) { | ||
x.forEach(deepFreeze); | ||
I.freeze(x); | ||
} else if (I.isObject(x)) { | ||
for (var k in x) { | ||
deepFreeze(x[k]); | ||
}I.freeze(x); | ||
function deepFreeze(x) { | ||
if (I.isArray(x)) { | ||
x.forEach(deepFreeze); | ||
I.freeze(x); | ||
} else if (I.isObject(x)) { | ||
for (var k in x) { | ||
deepFreeze(x[k]); | ||
}I.freeze(x); | ||
} | ||
return x; | ||
} | ||
return x; | ||
} | ||
function freezeArrayOfObjects(xs) { | ||
xs.forEach(I.freeze); | ||
return I.freeze(xs); | ||
} | ||
function freezeArrayOfObjects(xs) { | ||
xs.forEach(I.freeze); | ||
return I.freeze(xs); | ||
} | ||
var isArrayOrPrimitive = function isArrayOrPrimitive(x) { | ||
return !(x instanceof Object) || I.isArray(x); | ||
}; | ||
var isArrayOrPrimitive = function isArrayOrPrimitive(x) { | ||
return !(x instanceof Object) || I.isArray(x); | ||
}; | ||
var rev = /*#__PURE__*/(res(I.freeze))(function (xs) { | ||
if (seemsArrayLike(xs)) { | ||
var n = xs.length; | ||
var ys = Array(n); | ||
var i = 0; | ||
while (n) { | ||
ys[i++] = xs[--n]; | ||
}return ys; | ||
} | ||
}); | ||
var rev = /*#__PURE__*/(res(I.freeze))(function (xs) { | ||
if (seemsArrayLike(xs)) { | ||
var n = xs.length; | ||
var ys = Array(n); | ||
var i = 0; | ||
while (n) { | ||
ys[i++] = xs[--n]; | ||
}return ys; | ||
} | ||
}); | ||
// | ||
// | ||
var isEmptyArrayStringOrObject = function isEmptyArrayStringOrObject(x) { | ||
return I.acyclicEqualsU(I.array0, x) || I.acyclicEqualsU(I.object0, x) || x === ''; | ||
}; | ||
var isEmptyArrayStringOrObject = function isEmptyArrayStringOrObject(x) { | ||
return I.acyclicEqualsU(I.array0, x) || I.acyclicEqualsU(I.object0, x) || x === ''; | ||
}; | ||
var warnEmpty = function warnEmpty(o, v, f) { | ||
var msg = '`' + f + '(' + JSON.stringify(v) + ')` is likely unnecessary, because combinators no longer remove empty arrays, objects, or strings by default. See CHANGELOG for more information.'; | ||
return function (x) { | ||
if (I.acyclicEqualsU(v, x)) warn(o, msg); | ||
return x; | ||
var warnEmpty = function warnEmpty(o, v, f) { | ||
var msg = '`' + f + '(' + JSON.stringify(v) + ')` is likely unnecessary, because combinators no longer remove empty arrays, objects, or strings by default. See CHANGELOG for more information.'; | ||
return function (x) { | ||
if (I.acyclicEqualsU(v, x)) warn(o, msg); | ||
return x; | ||
}; | ||
}; | ||
}; | ||
// | ||
// | ||
var mapPartialIndexU = /*#__PURE__*/(res(I.freeze))(function (xi2y, xs) { | ||
var n = xs.length; | ||
var ys = Array(n); | ||
var j = 0; | ||
for (var i = 0, y; i < n; ++i) { | ||
if (void 0 !== (y = xi2y(xs[i], i))) ys[j++] = y; | ||
}if (j < n) ys.length = j; | ||
return ys; | ||
}); | ||
var mapPartialIndexU = /*#__PURE__*/(res(I.freeze))(function (xi2y, xs) { | ||
var n = xs.length; | ||
var ys = Array(n); | ||
var j = 0; | ||
for (var i = 0, y; i < n; ++i) { | ||
if (void 0 !== (y = xi2y(xs[i], i))) ys[j++] = y; | ||
}if (j < n) ys.length = j; | ||
return ys; | ||
}); | ||
var mapIfArrayLike = function mapIfArrayLike(xi2y, xs) { | ||
return seemsArrayLike(xs) ? mapPartialIndexU(xi2y, xs) : void 0; | ||
}; | ||
var copyToFrom = /*#__PURE__*/(function (fn$$1) { | ||
return function (ys, k, xs, i, j) { | ||
return ys.length === k + j - i ? I.freeze(fn$$1(ys, k, xs, i, j)) : fn$$1(ys, k, xs, i, j); | ||
var mapIfArrayLike = function mapIfArrayLike(xi2y, xs) { | ||
return seemsArrayLike(xs) ? mapPartialIndexU(xi2y, xs) : void 0; | ||
}; | ||
})(function (ys, k, xs, i, j) { | ||
while (i < j) { | ||
ys[k++] = xs[i++]; | ||
}return ys; | ||
}); | ||
// | ||
var copyToFrom = /*#__PURE__*/(function (fn$$1) { | ||
return function (ys, k, xs, i, j) { | ||
return ys.length === k + j - i ? I.freeze(fn$$1(ys, k, xs, i, j)) : fn$$1(ys, k, xs, i, j); | ||
}; | ||
})(function (ys, k, xs, i, j) { | ||
while (i < j) { | ||
ys[k++] = xs[i++]; | ||
}return ys; | ||
}); | ||
function selectInArrayLike(xi2v, xs) { | ||
for (var i = 0, n = xs.length; i < n; ++i) { | ||
var v = xi2v(xs[i], i); | ||
if (void 0 !== v) return v; | ||
// | ||
function selectInArrayLike(xi2v, xs) { | ||
for (var i = 0, n = xs.length; i < n; ++i) { | ||
var v = xi2v(xs[i], i); | ||
if (void 0 !== v) return v; | ||
} | ||
} | ||
} | ||
// | ||
// | ||
var Select = { | ||
map: I.sndU, | ||
of: function of() {}, | ||
ap: function ap(l, r) { | ||
return void 0 !== l ? l : r; | ||
} | ||
}; | ||
var Select = { | ||
map: I.sndU, | ||
of: function of() {}, | ||
ap: function ap(l, r) { | ||
return void 0 !== l ? l : r; | ||
} | ||
}; | ||
var ConcatOf = function ConcatOf(ap, empty) { | ||
return { map: I.sndU, ap: ap, of: I.always(empty) }; | ||
}; | ||
var ConcatOf = function ConcatOf(ap, empty) { | ||
return { map: I.sndU, ap: ap, of: I.always(empty) }; | ||
}; | ||
var Sum = /*#__PURE__*/ConcatOf(function (x, y) { | ||
return x + y; | ||
}, 0); | ||
var Sum = /*#__PURE__*/ConcatOf(function (x, y) { | ||
return x + y; | ||
}, 0); | ||
var mumBy = function mumBy(ord) { | ||
return I.curry(function (xi2y, t, s) { | ||
var minX = void 0; | ||
var minY = void 0; | ||
traverseU(Select, function (x, i) { | ||
var y = xi2y(x, i); | ||
if (void 0 !== y && (void 0 === minY || ord(y, minY))) { | ||
minX = x; | ||
minY = y; | ||
} | ||
}, t, s); | ||
return minX; | ||
}); | ||
}; | ||
var mumBy = function mumBy(ord) { | ||
return I.curry(function (xi2y, t, s) { | ||
var minX = void 0; | ||
var minY = void 0; | ||
traverseU(Select, function (x, i) { | ||
var y = xi2y(x, i); | ||
if (void 0 !== y && (void 0 === minY || ord(y, minY))) { | ||
minX = x; | ||
minY = y; | ||
} | ||
}, t, s); | ||
return minX; | ||
}); | ||
}; | ||
// | ||
// | ||
var traverseU = function traverseU(C, xi2yC, t, s) { | ||
return toFunction(t)(s, void 0, C, xi2yC); | ||
}; | ||
var traverseU = function traverseU(C, xi2yC, t, s) { | ||
return toFunction(t)(s, void 0, C, xi2yC); | ||
}; | ||
// | ||
// | ||
var expectedOptic = 'Expecting an optic'; | ||
var opticIsEither = 'An optic can be either\n- a string,\n- a non-negative integer,\n- a quaternary optic function,\n- an ordinary unary or binary function, or\n- an array of optics.\nSee documentation of `toFunction` and `compose` for details.'; | ||
var header = 'partial.lenses: '; | ||
var expectedOptic = 'Expecting an optic'; | ||
var opticIsEither = 'An optic can be either\n- a string,\n- a non-negative integer,\n- a quaternary optic function,\n- an ordinary unary or binary function, or\n- an array of optics.\nSee documentation of `toFunction` and `compose` for details.'; | ||
var header = 'partial.lenses: '; | ||
function warn(f, m) { | ||
if (!f.warned) { | ||
f.warned = 1; | ||
console.warn(header + m); | ||
function warn(f, m) { | ||
if (!f.warned) { | ||
f.warned = 1; | ||
console.warn(header + m); | ||
} | ||
} | ||
} | ||
function errorGiven(m, o, e) { | ||
m = header + m + '.'; | ||
e = e ? '\n' + e : ''; | ||
console.error(m, 'Given:', o, e); | ||
throw Error(m + e); | ||
} | ||
function errorGiven(m, o, e) { | ||
m = header + m + '.'; | ||
e = e ? '\n' + e : ''; | ||
console.error(m, 'Given:', o, e); | ||
throw Error(m + e); | ||
} | ||
function reqIndex(x) { | ||
if (!Number.isInteger(x) || x < 0) errorGiven('`index` expects a non-negative integer', x); | ||
} | ||
function reqIndex(x) { | ||
if (!Number.isInteger(x) || x < 0) errorGiven('`index` expects a non-negative integer', x); | ||
} | ||
function reqFunction(o) { | ||
if (!(I.isFunction(o) && (o.length === 4 || o.length <= 2))) errorGiven(expectedOptic, o, opticIsEither); | ||
} | ||
function reqFunction(o) { | ||
if (!(I.isFunction(o) && (o.length === 4 || o.length <= 2))) errorGiven(expectedOptic, o, opticIsEither); | ||
} | ||
function reqFn(x) { | ||
if (!I.isFunction(x)) errorGiven('Expected a function', x); | ||
} | ||
function reqFn(x) { | ||
if (!I.isFunction(x)) errorGiven('Expected a function', x); | ||
} | ||
function reqArray(o) { | ||
if (!I.isArray(o)) errorGiven(expectedOptic, o, opticIsEither); | ||
} | ||
function reqArray(o) { | ||
if (!I.isArray(o)) errorGiven(expectedOptic, o, opticIsEither); | ||
} | ||
function reqOptic(o) { | ||
switch (typeof o) { | ||
case 'string': | ||
break; | ||
case 'number': | ||
reqIndex(o); | ||
break; | ||
case 'object': | ||
reqArray(o); | ||
for (var i = 0, n = o.length; i < n; ++i) { | ||
reqOptic(o[i]); | ||
}break; | ||
default: | ||
reqFunction(o); | ||
break; | ||
function reqOptic(o) { | ||
switch (typeof o) { | ||
case 'string': | ||
break; | ||
case 'number': | ||
reqIndex(o); | ||
break; | ||
case 'object': | ||
reqArray(o); | ||
for (var i = 0, n = o.length; i < n; ++i) { | ||
reqOptic(o[i]); | ||
}break; | ||
default: | ||
reqFunction(o); | ||
break; | ||
} | ||
} | ||
} | ||
// | ||
// | ||
var reqString = function reqString(msg) { | ||
return function (x) { | ||
if (!I.isString(x)) errorGiven(msg, x); | ||
var reqString = function reqString(msg) { | ||
return function (x) { | ||
if (!I.isString(x)) errorGiven(msg, x); | ||
}; | ||
}; | ||
}; | ||
var reqMaybeArray = function reqMaybeArray(msg) { | ||
return function (zs) { | ||
if (!(void 0 === zs || seemsArrayLike(zs))) errorGiven(msg, zs); | ||
var reqMaybeArray = function reqMaybeArray(msg) { | ||
return function (zs) { | ||
if (!(void 0 === zs || seemsArrayLike(zs))) errorGiven(msg, zs); | ||
}; | ||
}; | ||
}; | ||
// | ||
// | ||
var reqApplicative = function reqApplicative(name, arg) { | ||
return function (C) { | ||
if (!C.of) errorGiven('`' + name + (arg ? '(' + arg + ')' : '') + '` requires an applicative', C, 'Note that you cannot `get` a traversal. Perhaps you wanted to `collect` it?'); | ||
var reqApplicative = function reqApplicative(name, arg) { | ||
return function (C) { | ||
if (!C.of) errorGiven('`' + name + (arg ? '(' + arg + ')' : '') + '` requires an applicative', C, 'Note that you cannot `get` a traversal. Perhaps you wanted to `collect` it?'); | ||
}; | ||
}; | ||
}; | ||
var reqMonad = function reqMonad(name) { | ||
return function (C) { | ||
if (!C.chain) errorGiven('`' + name + '` requires a monad', C, 'Note that you can only `modify`, `remove`, `set`, and `traverse` a transform.'); | ||
var reqMonad = function reqMonad(name) { | ||
return function (C) { | ||
if (!C.chain) errorGiven('`' + name + '` requires a monad', C, 'Note that you can only `modify`, `remove`, `set`, and `traverse` a transform.'); | ||
}; | ||
}; | ||
}; | ||
// | ||
// | ||
var mkTraverse = function mkTraverse(after, toC) { | ||
return I.curryN(4, function (xi2yC, m) { | ||
return m = toC(m), function (t, s) { | ||
return after(traverseU(m, xi2yC, t, s)); | ||
}; | ||
}); | ||
}; | ||
var mkTraverse = function mkTraverse(after, toC) { | ||
return I.curryN(4, function (xi2yC, m) { | ||
return m = toC(m), function (t, s) { | ||
return after(traverseU(m, xi2yC, t, s)); | ||
}; | ||
}); | ||
}; | ||
// | ||
// | ||
var cons = function cons(t) { | ||
return function (h) { | ||
return void 0 !== h ? [h, t] : t; | ||
var cons = function cons(t) { | ||
return function (h) { | ||
return void 0 !== h ? [h, t] : t; | ||
}; | ||
}; | ||
}; | ||
var consTo = /*#__PURE__*/(res(I.freeze))(function (n) { | ||
var xs = []; | ||
while (cons !== n) { | ||
xs.push(n[0]); | ||
n = n[1]; | ||
} | ||
return xs.reverse(); | ||
}); | ||
var consTo = /*#__PURE__*/(res(I.freeze))(function (n) { | ||
var xs = []; | ||
while (cons !== n) { | ||
xs.push(n[0]); | ||
n = n[1]; | ||
} | ||
return xs.reverse(); | ||
}); | ||
function traversePartialIndex(A, xi2yA, xs) { | ||
var map = A.map, | ||
ap = A.ap; | ||
function traversePartialIndex(A, xi2yA, xs) { | ||
var map = A.map, | ||
ap = A.ap; | ||
var xsA = A.of(cons); | ||
var n = xs.length; | ||
if (map === I.sndU) { | ||
for (var i = 0; i < n; ++i) { | ||
xsA = ap(xsA, xi2yA(xs[i], i)); | ||
}return xsA; | ||
} else { | ||
for (var _i2 = 0; _i2 < n; ++_i2) { | ||
xsA = ap(map(cons, xsA), xi2yA(xs[_i2], _i2)); | ||
}return map(consTo, xsA); | ||
var xsA = A.of(cons); | ||
var n = xs.length; | ||
if (map === I.sndU) { | ||
for (var i = 0; i < n; ++i) { | ||
xsA = ap(xsA, xi2yA(xs[i], i)); | ||
}return xsA; | ||
} else { | ||
for (var _i2 = 0; _i2 < n; ++_i2) { | ||
xsA = ap(map(cons, xsA), xi2yA(xs[_i2], _i2)); | ||
}return map(consTo, xsA); | ||
} | ||
} | ||
} | ||
// | ||
// | ||
var lensFrom = function lensFrom(get, set) { | ||
return function (i) { | ||
return function (x, _i, F, xi2yF) { | ||
return F.map(function (v) { | ||
return set(i, v, x); | ||
}, xi2yF(get(i, x), i)); | ||
var lensFrom = function lensFrom(get, set) { | ||
return function (i) { | ||
return function (x, _i, F, xi2yF) { | ||
return F.map(function (v) { | ||
return set(i, v, x); | ||
}, xi2yF(get(i, x), i)); | ||
}; | ||
}; | ||
}; | ||
}; | ||
// | ||
// | ||
var getProp = function getProp(k, o) { | ||
return o instanceof Object ? o[k] : void 0; | ||
}; | ||
var getProp = function getProp(k, o) { | ||
return o instanceof Object ? o[k] : void 0; | ||
}; | ||
var setProp = /*#__PURE__*/(res(I.freeze))(function (k, v, o) { | ||
return void 0 !== v ? I.assocPartialU(k, v, o) : I.dissocPartialU(k, o) || I.object0; | ||
}); | ||
var setProp = /*#__PURE__*/(res(I.freeze))(function (k, v, o) { | ||
return void 0 !== v ? I.assocPartialU(k, v, o) : I.dissocPartialU(k, o) || I.object0; | ||
}); | ||
var funProp = /*#__PURE__*/lensFrom(getProp, setProp); | ||
var funProp = /*#__PURE__*/lensFrom(getProp, setProp); | ||
// | ||
// | ||
var getIndex = function getIndex(i, xs) { | ||
return seemsArrayLike(xs) ? xs[i] : void 0; | ||
}; | ||
var getIndex = function getIndex(i, xs) { | ||
return seemsArrayLike(xs) ? xs[i] : void 0; | ||
}; | ||
var setIndex = /*#__PURE__*/(fn(nth(0, ef(reqIndex)), I.freeze))(function (i, x, xs) { | ||
if (!seemsArrayLike(xs)) xs = ''; | ||
var n = xs.length; | ||
if (void 0 !== x) { | ||
var m = Math.max(i + 1, n); | ||
var ys = Array(m); | ||
for (var j = 0; j < m; ++j) { | ||
ys[j] = xs[j]; | ||
}ys[i] = x; | ||
return ys; | ||
} else { | ||
if (n <= i) return copyToFrom(Array(n), 0, xs, 0, n); | ||
var _ys = Array(n - 1); | ||
for (var _j = 0; _j < i; ++_j) { | ||
_ys[_j] = xs[_j]; | ||
}for (var _j2 = i + 1; _j2 < n; ++_j2) { | ||
_ys[_j2 - 1] = xs[_j2]; | ||
}return _ys; | ||
} | ||
}); | ||
var setIndex = /*#__PURE__*/(fn(nth(0, ef(reqIndex)), I.freeze))(function (i, x, xs) { | ||
if (!seemsArrayLike(xs)) xs = ''; | ||
var n = xs.length; | ||
if (void 0 !== x) { | ||
var m = Math.max(i + 1, n); | ||
var ys = Array(m); | ||
for (var j = 0; j < m; ++j) { | ||
ys[j] = xs[j]; | ||
}ys[i] = x; | ||
return ys; | ||
} else { | ||
if (n <= i) return copyToFrom(Array(n), 0, xs, 0, n); | ||
var _ys = Array(n - 1); | ||
for (var _j = 0; _j < i; ++_j) { | ||
_ys[_j] = xs[_j]; | ||
}for (var _j2 = i + 1; _j2 < n; ++_j2) { | ||
_ys[_j2 - 1] = xs[_j2]; | ||
}return _ys; | ||
} | ||
}); | ||
var funIndex = /*#__PURE__*/lensFrom(getIndex, setIndex); | ||
var funIndex = /*#__PURE__*/lensFrom(getIndex, setIndex); | ||
// | ||
// | ||
var composedMiddle = function composedMiddle(o, r) { | ||
return function (F, xi2yF) { | ||
return xi2yF = r(F, xi2yF), function (x, i) { | ||
return o(x, i, F, xi2yF); | ||
var composedMiddle = function composedMiddle(o, r) { | ||
return function (F, xi2yF) { | ||
return xi2yF = r(F, xi2yF), function (x, i) { | ||
return o(x, i, F, xi2yF); | ||
}; | ||
}; | ||
}; | ||
}; | ||
function composed(oi0, os) { | ||
var n = os.length - oi0; | ||
if (n < 2) { | ||
return n ? toFunction(os[oi0]) : identity; | ||
} else { | ||
var _last = toFunction(os[oi0 + --n]); | ||
var r = function r(F, xi2yF) { | ||
return function (x, i) { | ||
return _last(x, i, F, xi2yF); | ||
function composed(oi0, os) { | ||
var n = os.length - oi0; | ||
if (n < 2) { | ||
return n ? toFunction(os[oi0]) : identity; | ||
} else { | ||
var _last = toFunction(os[oi0 + --n]); | ||
var r = function r(F, xi2yF) { | ||
return function (x, i) { | ||
return _last(x, i, F, xi2yF); | ||
}; | ||
}; | ||
}; | ||
while (--n) { | ||
r = composedMiddle(toFunction(os[oi0 + n]), r); | ||
}var _first = toFunction(os[oi0]); | ||
return function (x, i, F, xi2yF) { | ||
return _first(x, i, F, r(F, xi2yF)); | ||
}; | ||
while (--n) { | ||
r = composedMiddle(toFunction(os[oi0 + n]), r); | ||
}var _first = toFunction(os[oi0]); | ||
return function (x, i, F, xi2yF) { | ||
return _first(x, i, F, r(F, xi2yF)); | ||
}; | ||
} | ||
} | ||
} | ||
var setU = /*#__PURE__*/(par(0, ef(reqOptic)))(function (o, x, s) { | ||
switch (typeof o) { | ||
case 'string': | ||
return setProp(o, x, s); | ||
case 'number': | ||
return setIndex(o, x, s); | ||
case 'object': | ||
return modifyComposed(o, 0, s, x); | ||
default: | ||
return o.length === 4 ? o(s, void 0, Identity, I.always(x)) : s; | ||
} | ||
}); | ||
var setU = /*#__PURE__*/(par(0, ef(reqOptic)))(function (o, x, s) { | ||
switch (typeof o) { | ||
case 'string': | ||
return setProp(o, x, s); | ||
case 'number': | ||
return setIndex(o, x, s); | ||
case 'object': | ||
return modifyComposed(o, 0, s, x); | ||
default: | ||
return o.length === 4 ? o(s, void 0, Identity, I.always(x)) : s; | ||
} | ||
}); | ||
var modifyU = /*#__PURE__*/(par(0, ef(reqOptic)))(function (o, xi2x, s) { | ||
switch (typeof o) { | ||
case 'string': | ||
return setProp(o, xi2x(getProp(o, s), o), s); | ||
case 'number': | ||
return setIndex(o, xi2x(getIndex(o, s), o), s); | ||
case 'object': | ||
return modifyComposed(o, xi2x, s); | ||
default: | ||
return o.length === 4 ? o(s, void 0, Identity, xi2x) : (xi2x(o(s, void 0), void 0), s); | ||
} | ||
}); | ||
function makeIx(i) { | ||
var ix = function ix(s, j) { | ||
return ix.v = j, s; | ||
}; | ||
ix.v = i; | ||
return ix; | ||
} | ||
function getNestedU(l, s, j, ix) { | ||
for (var n = l.length, o; j < n; ++j) { | ||
switch (typeof (o = l[j])) { | ||
var modifyU = /*#__PURE__*/(par(0, ef(reqOptic)))(function (o, xi2x, s) { | ||
switch (typeof o) { | ||
case 'string': | ||
s = getProp(ix.v = o, s); | ||
break; | ||
return setProp(o, xi2x(getProp(o, s), o), s); | ||
case 'number': | ||
s = getIndex(ix.v = o, s); | ||
break; | ||
return setIndex(o, xi2x(getIndex(o, s), o), s); | ||
case 'object': | ||
s = getNestedU(o, s, 0, ix); | ||
break; | ||
return modifyComposed(o, xi2x, s); | ||
default: | ||
s = o(s, ix.v, Constant, ix); | ||
return o.length === 4 ? o(s, void 0, Identity, xi2x) : (xi2x(o(s, void 0), void 0), s); | ||
} | ||
}return s; | ||
} | ||
}); | ||
var getU = /*#__PURE__*/(par(0, ef(reqOptic)))(function (l, s) { | ||
switch (typeof l) { | ||
case 'string': | ||
return getProp(l, s); | ||
case 'number': | ||
return getIndex(l, s); | ||
case 'object': | ||
for (var i = 0, n = l.length, o; i < n; ++i) { | ||
switch (typeof (o = l[i])) { | ||
case 'string': | ||
s = getProp(o, s); | ||
break; | ||
case 'number': | ||
s = getIndex(o, s); | ||
break; | ||
default: | ||
return getNestedU(l, s, i, makeIx(l[i - 1])); | ||
} | ||
}return s; | ||
default: | ||
return l(s, void 0, Constant, I.id); | ||
function makeIx(i) { | ||
var ix = function ix(s, j) { | ||
return ix.v = j, s; | ||
}; | ||
ix.v = i; | ||
return ix; | ||
} | ||
}); | ||
function modifyComposed(os, xi2y, x, y) { | ||
var n = os.length; | ||
var xs = Array(n); | ||
for (var i = 0, o; i < n; ++i) { | ||
xs[i] = x; | ||
switch (typeof (o = os[i])) { | ||
function getNestedU(l, s, j, ix) { | ||
for (var n = l.length, o; j < n; ++j) { | ||
switch (typeof (o = l[j])) { | ||
case 'string': | ||
s = getProp(ix.v = o, s); | ||
break; | ||
case 'number': | ||
s = getIndex(ix.v = o, s); | ||
break; | ||
case 'object': | ||
s = getNestedU(o, s, 0, ix); | ||
break; | ||
default: | ||
s = o(s, ix.v, Constant, ix); | ||
} | ||
}return s; | ||
} | ||
var getU = /*#__PURE__*/(par(0, ef(reqOptic)))(function (l, s) { | ||
switch (typeof l) { | ||
case 'string': | ||
x = getProp(o, x); | ||
break; | ||
return getProp(l, s); | ||
case 'number': | ||
x = getIndex(o, x); | ||
break; | ||
return getIndex(l, s); | ||
case 'object': | ||
for (var i = 0, n = l.length, o; i < n; ++i) { | ||
switch (typeof (o = l[i])) { | ||
case 'string': | ||
s = getProp(o, s); | ||
break; | ||
case 'number': | ||
s = getIndex(o, s); | ||
break; | ||
default: | ||
return getNestedU(l, s, i, makeIx(l[i - 1])); | ||
} | ||
}return s; | ||
default: | ||
x = composed(i, os)(x, os[i - 1], Identity, xi2y || I.always(y)); | ||
n = i; | ||
break; | ||
return l(s, void 0, Constant, I.id); | ||
} | ||
}); | ||
function modifyComposed(os, xi2y, x, y) { | ||
var n = os.length; | ||
var xs = Array(n); | ||
for (var i = 0, o; i < n; ++i) { | ||
xs[i] = x; | ||
switch (typeof (o = os[i])) { | ||
case 'string': | ||
x = getProp(o, x); | ||
break; | ||
case 'number': | ||
x = getIndex(o, x); | ||
break; | ||
default: | ||
x = composed(i, os)(x, os[i - 1], Identity, xi2y || I.always(y)); | ||
n = i; | ||
break; | ||
} | ||
} | ||
if (n === os.length) x = xi2y ? xi2y(x, os[n - 1]) : y; | ||
for (var _o; 0 <= --n;) { | ||
x = I.isString(_o = os[n]) ? setProp(_o, x, xs[n]) : setIndex(_o, x, xs[n]); | ||
}return x; | ||
} | ||
if (n === os.length) x = xi2y ? xi2y(x, os[n - 1]) : y; | ||
for (var _o; 0 <= --n;) { | ||
x = I.isString(_o = os[n]) ? setProp(_o, x, xs[n]) : setIndex(_o, x, xs[n]); | ||
}return x; | ||
} | ||
// | ||
// | ||
var lensU = function lensU(get, set) { | ||
return function (x, i, F, xi2yF) { | ||
return F.map(function (y) { | ||
return set(y, x, i); | ||
}, xi2yF(get(x, i), i)); | ||
var lensU = function lensU(get, set) { | ||
return function (x, i, F, xi2yF) { | ||
return F.map(function (y) { | ||
return set(y, x, i); | ||
}, xi2yF(get(x, i), i)); | ||
}; | ||
}; | ||
}; | ||
var isoU = function isoU(bwd, fwd) { | ||
return function (x, i, F, xi2yF) { | ||
return F.map(fwd, xi2yF(bwd(x), i)); | ||
var isoU = function isoU(bwd, fwd) { | ||
return function (x, i, F, xi2yF) { | ||
return F.map(fwd, xi2yF(bwd(x), i)); | ||
}; | ||
}; | ||
}; | ||
// | ||
// | ||
var getPick = /*#__PURE__*/(res(I.freeze))(function (template, x) { | ||
var r = void 0; | ||
for (var k in template) { | ||
var t = template[k]; | ||
var v = I.isObject(t) ? getPick(t, x) : getU(t, x); | ||
if (void 0 !== v) { | ||
if (!r) r = {}; | ||
r[k] = v; | ||
var getPick = /*#__PURE__*/(res(I.freeze))(function (template, x) { | ||
var r = void 0; | ||
for (var k in template) { | ||
var t = template[k]; | ||
var v = I.isObject(t) ? getPick(t, x) : getU(t, x); | ||
if (void 0 !== v) { | ||
if (!r) r = {}; | ||
r[k] = v; | ||
} | ||
} | ||
} | ||
return r; | ||
}); | ||
return r; | ||
}); | ||
var reqTemplate = function reqTemplate(name) { | ||
return function (template) { | ||
if (!I.isObject(template)) errorGiven('`' + name + '` expects a plain Object template', template); | ||
var reqTemplate = function reqTemplate(name) { | ||
return function (template) { | ||
if (!I.isObject(template)) errorGiven('`' + name + '` expects a plain Object template', template); | ||
}; | ||
}; | ||
}; | ||
var reqObject = function reqObject(msg) { | ||
return function (value) { | ||
if (!(void 0 === value || value instanceof Object)) errorGiven(msg, value); | ||
var reqObject = function reqObject(msg) { | ||
return function (value) { | ||
if (!(void 0 === value || value instanceof Object)) errorGiven(msg, value); | ||
}; | ||
}; | ||
}; | ||
var setPick = /*#__PURE__*/(par(1, ef(reqObject('`pick` must be set with undefined or an object'))))(function (template, value, x) { | ||
for (var k in template) { | ||
var v = value && value[k]; | ||
var t = template[k]; | ||
x = I.isObject(t) ? setPick(t, v, x) : setU(t, v, x); | ||
} | ||
return x; | ||
}); | ||
var setPick = /*#__PURE__*/(par(1, ef(reqObject('`pick` must be set with undefined or an object'))))(function (template, value, x) { | ||
for (var k in template) { | ||
var v = value && value[k]; | ||
var t = template[k]; | ||
x = I.isObject(t) ? setPick(t, v, x) : setU(t, v, x); | ||
} | ||
return x; | ||
}); | ||
// | ||
// | ||
var toObject = function toObject(x) { | ||
return I.constructorOf(x) !== Object ? I.toObject(x) : x; | ||
}; | ||
var toObject = function toObject(x) { | ||
return I.constructorOf(x) !== Object ? I.toObject(x) : x; | ||
}; | ||
// | ||
// | ||
var identity = function identity(x, i, _F, xi2yF) { | ||
return xi2yF(x, i); | ||
}; | ||
var identity = function identity(x, i, _F, xi2yF) { | ||
return xi2yF(x, i); | ||
}; | ||
// | ||
// | ||
var branchAssemble = /*#__PURE__*/(res(res(I.freeze)))(function (ks) { | ||
return function (xs) { | ||
var r = {}; | ||
var i = ks.length; | ||
while (i--) { | ||
var v = xs[0]; | ||
if (void 0 !== v) { | ||
r[ks[i]] = v; | ||
var branchAssemble = /*#__PURE__*/(res(res(I.freeze)))(function (ks) { | ||
return function (xs) { | ||
var r = {}; | ||
var i = ks.length; | ||
while (i--) { | ||
var v = xs[0]; | ||
if (void 0 !== v) { | ||
r[ks[i]] = v; | ||
} | ||
xs = xs[1]; | ||
} | ||
xs = xs[1]; | ||
} | ||
return r; | ||
}; | ||
}); | ||
return r; | ||
}; | ||
}); | ||
var branchOr1Level = function branchOr1Level(otherwise, k2o) { | ||
return function (x, _i, A, xi2yA) { | ||
var xO = x instanceof Object ? toObject(x) : I.object0; | ||
var branchOr1Level = function branchOr1Level(otherwise, k2o) { | ||
return function (x, _i, A, xi2yA) { | ||
var xO = x instanceof Object ? toObject(x) : I.object0; | ||
if (Identity === A) { | ||
var written = void 0; | ||
var r = {}; | ||
for (var k in k2o) { | ||
written = 1; | ||
var y = k2o[k](xO[k], k, A, xi2yA); | ||
if (void 0 !== y) r[k] = y; | ||
} | ||
var t = written; | ||
for (var _k in xO) { | ||
if (void 0 === (t && k2o[_k])) { | ||
if (Identity === A) { | ||
var written = void 0; | ||
var r = {}; | ||
for (var k in k2o) { | ||
written = 1; | ||
var _y = otherwise(xO[_k], _k, A, xi2yA); | ||
if (void 0 !== _y) r[_k] = _y; | ||
var y = k2o[k](xO[k], k, A, xi2yA); | ||
if (void 0 !== y) r[k] = y; | ||
} | ||
} | ||
return written ? r : x; | ||
} else if (Select === A) { | ||
for (var _k2 in k2o) { | ||
var _y2 = k2o[_k2](xO[_k2], _k2, A, xi2yA); | ||
if (void 0 !== _y2) return _y2; | ||
} | ||
for (var _k3 in xO) { | ||
if (void 0 === k2o[_k3]) { | ||
var _y3 = otherwise(xO[_k3], _k3, A, xi2yA); | ||
if (void 0 !== _y3) return _y3; | ||
var t = written; | ||
for (var _k in xO) { | ||
if (void 0 === (t && k2o[_k])) { | ||
written = 1; | ||
var _y = otherwise(xO[_k], _k, A, xi2yA); | ||
if (void 0 !== _y) r[_k] = _y; | ||
} | ||
} | ||
} | ||
} else { | ||
var map = A.map, | ||
ap = A.ap, | ||
of = A.of; | ||
return written ? r : x; | ||
} else if (Select === A) { | ||
for (var _k2 in k2o) { | ||
var _y2 = k2o[_k2](xO[_k2], _k2, A, xi2yA); | ||
if (void 0 !== _y2) return _y2; | ||
} | ||
for (var _k3 in xO) { | ||
if (void 0 === k2o[_k3]) { | ||
var _y3 = otherwise(xO[_k3], _k3, A, xi2yA); | ||
if (void 0 !== _y3) return _y3; | ||
} | ||
} | ||
} else { | ||
var map = A.map, | ||
ap = A.ap, | ||
of = A.of; | ||
var xsA = of(cpair); | ||
var ks = []; | ||
for (var _k4 in k2o) { | ||
ks.push(_k4); | ||
xsA = ap(map(cpair, xsA), k2o[_k4](xO[_k4], _k4, A, xi2yA)); | ||
} | ||
var _t2 = ks.length ? true : void 0; | ||
for (var _k5 in xO) { | ||
if (void 0 === (_t2 && k2o[_k5])) { | ||
ks.push(_k5); | ||
xsA = ap(map(cpair, xsA), otherwise(xO[_k5], _k5, A, xi2yA)); | ||
var xsA = of(cpair); | ||
var ks = []; | ||
for (var _k4 in k2o) { | ||
ks.push(_k4); | ||
xsA = ap(map(cpair, xsA), k2o[_k4](xO[_k4], _k4, A, xi2yA)); | ||
} | ||
var _t2 = ks.length ? true : void 0; | ||
for (var _k5 in xO) { | ||
if (void 0 === (_t2 && k2o[_k5])) { | ||
ks.push(_k5); | ||
xsA = ap(map(cpair, xsA), otherwise(xO[_k5], _k5, A, xi2yA)); | ||
} | ||
} | ||
return ks.length ? map(branchAssemble(ks), xsA) : of(x); | ||
} | ||
return ks.length ? map(branchAssemble(ks), xsA) : of(x); | ||
} | ||
}; | ||
}; | ||
}; | ||
function branchOrU(otherwise, template) { | ||
var k2o = create(null); | ||
for (var k in template) { | ||
var v = template[k]; | ||
k2o[k] = I.isObject(v) ? branchOrU(otherwise, v) : toFunction(v); | ||
function branchOrU(otherwise, template) { | ||
var k2o = create(null); | ||
for (var k in template) { | ||
var v = template[k]; | ||
k2o[k] = I.isObject(v) ? branchOrU(otherwise, v) : toFunction(v); | ||
} | ||
return branchOr1Level(otherwise, k2o); | ||
} | ||
return branchOr1Level(otherwise, k2o); | ||
} | ||
var replaced = function replaced(inn, out, x) { | ||
return I.acyclicEqualsU(x, inn) ? out : x; | ||
}; | ||
var replaced = function replaced(inn, out, x) { | ||
return I.acyclicEqualsU(x, inn) ? out : x; | ||
}; | ||
function findIndexHint(hint, xi2b, xs) { | ||
var u = hint.hint; | ||
var n = xs.length; | ||
if (n <= u) u = n - 1; | ||
if (u < 0) u = 0; | ||
var d = u - 1; | ||
for (; 0 <= d && u < n; ++u, --d) { | ||
if (xi2b(xs[u], u, hint)) return u; | ||
if (xi2b(xs[d], d, hint)) return d; | ||
function findIndexHint(hint, xi2b, xs) { | ||
var u = hint.hint; | ||
var n = xs.length; | ||
if (n <= u) u = n - 1; | ||
if (u < 0) u = 0; | ||
var d = u - 1; | ||
for (; 0 <= d && u < n; ++u, --d) { | ||
if (xi2b(xs[u], u, hint)) return u; | ||
if (xi2b(xs[d], d, hint)) return d; | ||
} | ||
for (; u < n; ++u) { | ||
if (xi2b(xs[u], u, hint)) return u; | ||
}for (; 0 <= d; --d) { | ||
if (xi2b(xs[d], d, hint)) return d; | ||
}return n; | ||
} | ||
for (; u < n; ++u) { | ||
if (xi2b(xs[u], u, hint)) return u; | ||
}for (; 0 <= d; --d) { | ||
if (xi2b(xs[d], d, hint)) return d; | ||
}return n; | ||
} | ||
var partitionIntoIndex = /*#__PURE__*/(dep(function (_xi2b, _xs, ts, fs) { | ||
return res(ef(function () { | ||
I.freeze(ts); | ||
I.freeze(fs); | ||
})); | ||
}))(function (xi2b, xs, ts, fs) { | ||
for (var i = 0, n = xs.length, x; i < n; ++i) { | ||
(xi2b(x = xs[i], i) ? ts : fs).push(x); | ||
} | ||
}); | ||
var partitionIntoIndex = /*#__PURE__*/(dep(function (_xi2b, _xs, ts, fs) { | ||
return res(ef(function () { | ||
I.freeze(ts); | ||
I.freeze(fs); | ||
})); | ||
}))(function (xi2b, xs, ts, fs) { | ||
for (var i = 0, n = xs.length, x; i < n; ++i) { | ||
(xi2b(x = xs[i], i) ? ts : fs).push(x); | ||
} | ||
}); | ||
var fromReader = function fromReader(wi2x) { | ||
return function (w, i, F, xi2yF) { | ||
return F.map(I.always(w), xi2yF(wi2x(w, i), i)); | ||
var fromReader = function fromReader(wi2x) { | ||
return function (w, i, F, xi2yF) { | ||
return F.map(I.always(w), xi2yF(wi2x(w, i), i)); | ||
}; | ||
}; | ||
}; | ||
// | ||
// | ||
var reValue = function reValue(m) { | ||
return m[0]; | ||
}; | ||
var reIndex = function reIndex(m) { | ||
return m.index; | ||
}; | ||
var reNext = /*#__PURE__*/(function (fn$$1) { | ||
return function (m, re) { | ||
var res$$1 = fn$$1(m, re); | ||
if ('' === res$$1) warn(reNext, '`matches(' + re + ')` traversal terminated due to empty match. `matches` traversal shouldn\'t be used with regular expressions that can produce empty matches.'); | ||
return res$$1; | ||
var reValue = function reValue(m) { | ||
return m[0]; | ||
}; | ||
})(function (m, re) { | ||
var lastIndex = re.lastIndex; | ||
re.lastIndex = reIndex(m) + m[0].length; | ||
var n = re.exec(m.input); | ||
re.lastIndex = lastIndex; | ||
return n && n[0] && n; | ||
}); | ||
var reIndex = function reIndex(m) { | ||
return m.index; | ||
}; | ||
// | ||
var reNext = /*#__PURE__*/(function (fn$$1) { | ||
return function (m, re) { | ||
var res$$1 = fn$$1(m, re); | ||
if ('' === res$$1) warn(reNext, '`matches(' + re + ')` traversal terminated due to empty match. `matches` traversal shouldn\'t be used with regular expressions that can produce empty matches.'); | ||
return res$$1; | ||
}; | ||
})(function (m, re) { | ||
var lastIndex = re.lastIndex; | ||
re.lastIndex = reIndex(m) + m[0].length; | ||
var n = re.exec(m.input); | ||
re.lastIndex = lastIndex; | ||
return n && n[0] && n; | ||
}); | ||
var iterCollect = function iterCollect(s) { | ||
return function (xs) { | ||
return function (x) { | ||
return [s, x, xs]; | ||
// | ||
var iterCollect = function iterCollect(s) { | ||
return function (xs) { | ||
return function (x) { | ||
return [s, x, xs]; | ||
}; | ||
}; | ||
}; | ||
}; | ||
var iterToArray = function iterToArray(xs) { | ||
var ys = []; | ||
while (iterCollect !== xs) { | ||
ys.push(xs[0], xs[1]); | ||
xs = xs[2]; | ||
var iterToArray = function iterToArray(xs) { | ||
var ys = []; | ||
while (iterCollect !== xs) { | ||
ys.push(xs[0], xs[1]); | ||
xs = xs[2]; | ||
} | ||
return ys; | ||
}; | ||
function iterSelect(xi2y, t, s) { | ||
while (s = reNext(s, t)) { | ||
var y = xi2y(reValue(s), reIndex(s)); | ||
if (void 0 !== y) return y; | ||
} | ||
} | ||
return ys; | ||
}; | ||
function iterSelect(xi2y, t, s) { | ||
while (s = reNext(s, t)) { | ||
var y = xi2y(reValue(s), reIndex(s)); | ||
if (void 0 !== y) return y; | ||
function iterEager(map, ap, of, xi2yA, t, s) { | ||
var r = of(iterCollect); | ||
while (s = reNext(s, t)) { | ||
r = ap(ap(map(iterCollect, of(s)), r), xi2yA(reValue(s), reIndex(s))); | ||
}return r; | ||
} | ||
} | ||
function iterEager(map, ap, of, xi2yA, t, s) { | ||
var r = of(iterCollect); | ||
while (s = reNext(s, t)) { | ||
r = ap(ap(map(iterCollect, of(s)), r), xi2yA(reValue(s), reIndex(s))); | ||
}return r; | ||
} | ||
// | ||
// | ||
var keyed = /*#__PURE__*/isoU( /*#__PURE__*/expect( /*#__PURE__*/isInstanceOf(Object), /*#__PURE__*/(res(freezeArrayOfObjects))(function (x) { | ||
x = toObject(x); | ||
var es = []; | ||
for (var key in x) { | ||
es.push([key, x[key]]); | ||
}return es; | ||
})), /*#__PURE__*/expect(I.isArray, /*#__PURE__*/(res(I.freeze))(function (es) { | ||
var o = {}; | ||
for (var i = 0, n = es.length; i < n; ++i) { | ||
var entry = es[i]; | ||
if (entry.length === 2) o[entry[0]] = entry[1]; | ||
} | ||
return o; | ||
}))); | ||
var keyed = /*#__PURE__*/isoU( /*#__PURE__*/expect( /*#__PURE__*/isInstanceOf(Object), /*#__PURE__*/(res(freezeArrayOfObjects))(function (x) { | ||
x = toObject(x); | ||
var es = []; | ||
for (var key in x) { | ||
es.push([key, x[key]]); | ||
}return es; | ||
})), /*#__PURE__*/expect(I.isArray, /*#__PURE__*/(res(I.freeze))(function (es) { | ||
var o = {}; | ||
for (var i = 0, n = es.length; i < n; ++i) { | ||
var entry = es[i]; | ||
if (entry.length === 2) o[entry[0]] = entry[1]; | ||
} | ||
return o; | ||
}))); | ||
// | ||
// | ||
var matchesJoin = function matchesJoin(input) { | ||
return function (matchesIn) { | ||
var result = ''; | ||
var lastIndex = 0; | ||
var matches = iterToArray(matchesIn); | ||
var n = matches.length; | ||
for (var j = n - 2; j !== -2; j += -2) { | ||
var m = matches[j]; | ||
var i = reIndex(m); | ||
result += input.slice(lastIndex, i); | ||
var s = matches[j + 1]; | ||
if (void 0 !== s) result += s; | ||
lastIndex = i + m[0].length; | ||
} | ||
var matchesJoin = function matchesJoin(input) { | ||
return function (matchesIn) { | ||
var result = ''; | ||
var lastIndex = 0; | ||
var matches = iterToArray(matchesIn); | ||
var n = matches.length; | ||
for (var j = n - 2; j !== -2; j += -2) { | ||
var m = matches[j]; | ||
var i = reIndex(m); | ||
result += input.slice(lastIndex, i); | ||
var s = matches[j + 1]; | ||
if (void 0 !== s) result += s; | ||
lastIndex = i + m[0].length; | ||
} | ||
result += input.slice(lastIndex); | ||
return result; | ||
result += input.slice(lastIndex); | ||
return result; | ||
}; | ||
}; | ||
}; | ||
// | ||
// | ||
var ifteU = function ifteU(c, t, e) { | ||
return function (x, i, C, xi2yC) { | ||
return (c(x, i) ? t : e)(x, i, C, xi2yC); | ||
var eitherU = function eitherU(t, e) { | ||
return function (c) { | ||
return function (x, i, C, xi2yC) { | ||
return (c(x, i) ? t : e)(x, i, C, xi2yC); | ||
}; | ||
}; | ||
}; | ||
}; | ||
var orElseU = function orElseU(back, prim) { | ||
return prim = toFunction(prim), back = toFunction(back), function (x, i, C, xi2yC) { | ||
return (isDefined(prim, x) ? prim : back)(x, i, C, xi2yC); | ||
var orElseU = function orElseU(back, prim) { | ||
return prim = toFunction(prim), back = toFunction(back), function (x, i, C, xi2yC) { | ||
return (isDefined(prim, x) ? prim : back)(x, i, C, xi2yC); | ||
}; | ||
}; | ||
}; | ||
function zeroOp(y, i, C, xi2yC, x) { | ||
var of = C.of; | ||
return of ? of(y) : C.map(I.always(y), xi2yC(x, i)); | ||
} | ||
function zeroOp(y, i, C, xi2yC, x) { | ||
var of = C.of; | ||
return of ? of(y) : C.map(I.always(y), xi2yC(x, i)); | ||
} | ||
// | ||
// | ||
var elemsI = function elemsI(xs, _i, A, xi2yA) { | ||
return A === Identity ? mapPartialIndexU(xi2yA, xs) : A === Select ? selectInArrayLike(xi2yA, xs) : traversePartialIndex(A, xi2yA, xs); | ||
}; | ||
var elemsI = function elemsI(xs, _i, A, xi2yA) { | ||
return A === Identity ? mapPartialIndexU(xi2yA, xs) : A === Select ? selectInArrayLike(xi2yA, xs) : traversePartialIndex(A, xi2yA, xs); | ||
}; | ||
// | ||
// | ||
var seq2U = function seq2U(l, r) { | ||
return function (x, i, M, xi2yM) { | ||
return M.chain(function (x) { | ||
return r(x, i, M, xi2yM); | ||
}, l(x, i, M, xi2yM)); | ||
var seq2U = function seq2U(l, r) { | ||
return function (x, i, M, xi2yM) { | ||
return M.chain(function (x) { | ||
return r(x, i, M, xi2yM); | ||
}, l(x, i, M, xi2yM)); | ||
}; | ||
}; | ||
}; | ||
// | ||
// | ||
var pickInAux = function pickInAux(t, k) { | ||
return [k, pickIn(t)]; | ||
}; | ||
var pickInAux = function pickInAux(t, k) { | ||
return [k, pickIn(t)]; | ||
}; | ||
// | ||
// | ||
var condOfDefault = /*#__PURE__*/I.always(zeroOp); | ||
var condOfCase = function condOfCase(p, o, r) { | ||
return function (y, j) { | ||
return p(y, j) ? o : r(y, j); | ||
var condOfDefault = /*#__PURE__*/I.always(zeroOp); | ||
var condOfCase = function condOfCase(p, o, r) { | ||
return function (y, j) { | ||
return p(y, j) ? o : r(y, j); | ||
}; | ||
}; | ||
}; | ||
// Auxiliary | ||
// Auxiliary | ||
var seemsArrayLike = function seemsArrayLike(x) { | ||
return x instanceof Object && (x = x.length, x === x >> 0 && 0 <= x) || I.isString(x); | ||
}; | ||
var seemsArrayLike = function seemsArrayLike(x) { | ||
return x instanceof Object && (x = x.length, x === x >> 0 && 0 <= x) || I.isString(x); | ||
}; | ||
// Internals | ||
// Internals | ||
var Identity = /*#__PURE__*/(I.freeze)({ | ||
map: I.applyU, | ||
of: I.id, | ||
ap: I.applyU, | ||
chain: I.applyU | ||
}); | ||
var Identity = /*#__PURE__*/(I.freeze)({ | ||
map: I.applyU, | ||
of: I.id, | ||
ap: I.applyU, | ||
chain: I.applyU | ||
}); | ||
var Constant = /*#__PURE__*/(I.freeze)({ | ||
map: I.sndU | ||
}); | ||
var Constant = /*#__PURE__*/(I.freeze)({ | ||
map: I.sndU | ||
}); | ||
var toFunction = /*#__PURE__*/(par(0, ef(reqOptic)))(function (o) { | ||
switch (typeof o) { | ||
case 'string': | ||
return funProp(o); | ||
case 'number': | ||
return funIndex(o); | ||
case 'object': | ||
return composed(0, o); | ||
default: | ||
return o.length === 4 ? o : fromReader(o); | ||
} | ||
}); | ||
var toFunction = /*#__PURE__*/(par(0, ef(reqOptic)))(function (o) { | ||
switch (typeof o) { | ||
case 'string': | ||
return funProp(o); | ||
case 'number': | ||
return funIndex(o); | ||
case 'object': | ||
return composed(0, o); | ||
default: | ||
return o.length === 4 ? o : fromReader(o); | ||
} | ||
}); | ||
// Operations on optics | ||
// Operations on optics | ||
var assign = /*#__PURE__*/I.curry(function (o, x, s) { | ||
return setU([o, propsOf(x)], x, s); | ||
}); | ||
var assign = /*#__PURE__*/I.curry(function (o, x, s) { | ||
return setU([o, propsOf(x)], x, s); | ||
}); | ||
var modify = /*#__PURE__*/I.curry(modifyU); | ||
var modify = /*#__PURE__*/I.curry(modifyU); | ||
var remove = /*#__PURE__*/I.curry(function (o, s) { | ||
return setU(o, void 0, s); | ||
}); | ||
var remove = /*#__PURE__*/I.curry(function (o, s) { | ||
return setU(o, void 0, s); | ||
}); | ||
var set = /*#__PURE__*/I.curry(setU); | ||
var set = /*#__PURE__*/I.curry(setU); | ||
var transform = /*#__PURE__*/I.curry(function (o, s) { | ||
return modifyU(o, I.id, s); | ||
}); | ||
var transform = /*#__PURE__*/I.curry(function (o, s) { | ||
return modifyU(o, I.id, s); | ||
}); | ||
var traverse = /*#__PURE__*/I.curry(traverseU); | ||
var traverse = /*#__PURE__*/I.curry(traverseU); | ||
// Nesting | ||
// Nesting | ||
function compose() { | ||
var n = arguments.length; | ||
if (n < 2) { | ||
return n ? arguments[0] : identity; | ||
} else { | ||
var os = Array(n); | ||
while (n--) { | ||
os[n] = arguments[n]; | ||
}return os; | ||
function compose() { | ||
var n = arguments.length; | ||
if (n < 2) { | ||
return n ? arguments[0] : identity; | ||
} else { | ||
var os = Array(n); | ||
while (n--) { | ||
os[n] = arguments[n]; | ||
}return os; | ||
} | ||
} | ||
} | ||
function flat() { | ||
var r = [flatten]; | ||
for (var i = 0, n = arguments.length; i < n; ++i) { | ||
r.push(arguments[i], flatten); | ||
}return r; | ||
} | ||
function flat() { | ||
var r = [flatten]; | ||
for (var i = 0, n = arguments.length; i < n; ++i) { | ||
r.push(arguments[i], flatten); | ||
}return r; | ||
} | ||
// Recursing | ||
// Recursing | ||
function lazy(o2o) { | ||
var _memo = function memo(x, i, C, xi2yC) { | ||
return (_memo = toFunction(o2o(rec)))(x, i, C, xi2yC); | ||
}; | ||
function rec(x, i, C, xi2yC) { | ||
return _memo(x, i, C, xi2yC); | ||
function lazy(o2o) { | ||
var _memo = function memo(x, i, C, xi2yC) { | ||
return (_memo = toFunction(o2o(rec)))(x, i, C, xi2yC); | ||
}; | ||
function rec(x, i, C, xi2yC) { | ||
return _memo(x, i, C, xi2yC); | ||
} | ||
return rec; | ||
} | ||
return rec; | ||
} | ||
// Adapting | ||
// Adapting | ||
var choices = function choices(o) { | ||
for (var _len = arguments.length, os = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
os[_key - 1] = arguments[_key]; | ||
} | ||
var choices = function choices(o) { | ||
for (var _len = arguments.length, os = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
os[_key - 1] = arguments[_key]; | ||
} | ||
return os.length ? orElseU(os.reduceRight(orElseU), o) : o; | ||
}; | ||
return os.length ? orElseU(os.reduceRight(orElseU), o) : o; | ||
}; | ||
var choose = function choose(xiM2o) { | ||
return function (x, i, C, xi2yC) { | ||
return toFunction(xiM2o(x, i))(x, i, C, xi2yC); | ||
var choose = function choose(xiM2o) { | ||
return function (x, i, C, xi2yC) { | ||
return toFunction(xiM2o(x, i))(x, i, C, xi2yC); | ||
}; | ||
}; | ||
}; | ||
var cond = /*#__PURE__*/(function (fn$$1) { | ||
return function () { | ||
for (var _len2 = arguments.length, cs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
cs[_key2] = arguments[_key2]; | ||
var cond = /*#__PURE__*/(function (fn$$1) { | ||
return function () { | ||
for (var _len2 = arguments.length, cs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
cs[_key2] = arguments[_key2]; | ||
} | ||
var pair = tup(ef(reqFn), ef(reqOptic)); | ||
arr(pair)(cs.slice(0, -1)); | ||
arr(or(tup(ef(reqOptic)), pair))(cs.slice(-1)); | ||
return fn$$1.apply(undefined, cs); | ||
}; | ||
})(function () { | ||
var n = arguments.length; | ||
var r = zero; | ||
while (n--) { | ||
var c = arguments[n]; | ||
r = c.length < 2 ? toFunction(c[0]) : eitherU(toFunction(c[1]), r)(c[0]); | ||
} | ||
return r; | ||
}); | ||
var pair = tup(ef(reqFn), ef(reqOptic)); | ||
arr(pair)(cs.slice(0, -1)); | ||
arr(or(tup(ef(reqOptic)), pair))(cs.slice(-1)); | ||
return fn$$1.apply(undefined, cs); | ||
}; | ||
})(function () { | ||
var n = arguments.length; | ||
var r = zero; | ||
while (n--) { | ||
var c = arguments[n]; | ||
r = c.length < 2 ? toFunction(c[0]) : ifteU(c[0], toFunction(c[1]), r); | ||
} | ||
return r; | ||
}); | ||
var condOf = /*#__PURE__*/(function (fn$$1) { | ||
return function (of) { | ||
for (var _len3 = arguments.length, cs = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { | ||
cs[_key3 - 1] = arguments[_key3]; | ||
} | ||
var condOf = /*#__PURE__*/(function (fn$$1) { | ||
return function (of) { | ||
for (var _len3 = arguments.length, cs = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { | ||
cs[_key3 - 1] = arguments[_key3]; | ||
var pair = tup(ef(reqFn), ef(reqOptic)); | ||
arr(pair)(cs.slice(0, -1)); | ||
arr(or(tup(ef(reqOptic)), pair))(cs.slice(-1)); | ||
return fn$$1.apply(undefined, [of].concat(cs)); | ||
}; | ||
})(function (of) { | ||
of = toFunction(of); | ||
var op = condOfDefault; | ||
var n = arguments.length; | ||
while (--n) { | ||
var c = arguments[n]; | ||
op = c.length === 1 ? I.always(toFunction(c[0])) : condOfCase(c[0], toFunction(c[1]), op); | ||
} | ||
return function (x, i, C, xi2yC) { | ||
return of(x, i, Constant, op)(x, i, C, xi2yC); | ||
}; | ||
}); | ||
var pair = tup(ef(reqFn), ef(reqOptic)); | ||
arr(pair)(cs.slice(0, -1)); | ||
arr(or(tup(ef(reqOptic)), pair))(cs.slice(-1)); | ||
return fn$$1.apply(undefined, [of].concat(cs)); | ||
}; | ||
})(function (of) { | ||
of = toFunction(of); | ||
var op = condOfDefault; | ||
var n = arguments.length; | ||
while (--n) { | ||
var c = arguments[n]; | ||
op = c.length === 1 ? I.always(toFunction(c[0])) : condOfCase(c[0], toFunction(c[1]), op); | ||
} | ||
return function (x, i, C, xi2yC) { | ||
return of(x, i, Constant, op)(x, i, C, xi2yC); | ||
}; | ||
}); | ||
var ifElse = /*#__PURE__*/I.curry(function (c, t, e) { | ||
return eitherU(toFunction(t), toFunction(e))(c); | ||
}); | ||
var ifElse = /*#__PURE__*/I.curry(function (c, t, e) { | ||
return ifteU(c, toFunction(t), toFunction(e)); | ||
}); | ||
var iftes = /*#__PURE__*/(function (fn$$1) { | ||
return function (_c, _t) { | ||
warn(iftes, '`iftes` has been obsoleted. Use `ifElse` or `cond` instead. See CHANGELOG for details.'); | ||
return fn$$1.apply(null, arguments); | ||
}; | ||
})(function (_c, _t) { | ||
var n = arguments.length; | ||
var r = n & 1 ? toFunction(arguments[--n]) : zero; | ||
while (0 <= (n -= 2)) { | ||
r = eitherU(toFunction(arguments[n + 1]), r)(arguments[n]); | ||
}return r; | ||
}); | ||
var iftes = /*#__PURE__*/(function (fn$$1) { | ||
return function (_c, _t) { | ||
warn(iftes, '`iftes` has been obsoleted. Use `ifElse` or `cond` instead. See CHANGELOG for details.'); | ||
return fn$$1.apply(null, arguments); | ||
}; | ||
})(function (_c, _t) { | ||
var n = arguments.length; | ||
var r = n & 1 ? toFunction(arguments[--n]) : zero; | ||
while (0 <= (n -= 2)) { | ||
r = ifteU(arguments[n], toFunction(arguments[n + 1]), r); | ||
}return r; | ||
}); | ||
var orElse = /*#__PURE__*/I.curry(orElseU); | ||
var orElse = /*#__PURE__*/I.curry(orElseU); | ||
// Querying | ||
// Querying | ||
var chain = /*#__PURE__*/I.curry(function (xi2yO, xO) { | ||
return [xO, choose(function (xM, i) { | ||
return void 0 !== xM ? xi2yO(xM, i) : zero; | ||
})]; | ||
}); | ||
var chain = /*#__PURE__*/I.curry(function (xi2yO, xO) { | ||
return [xO, choose(function (xM, i) { | ||
return void 0 !== xM ? xi2yO(xM, i) : zero; | ||
})]; | ||
}); | ||
var choice = function choice() { | ||
for (var _len4 = arguments.length, os = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { | ||
os[_key4] = arguments[_key4]; | ||
} | ||
var choice = function choice() { | ||
for (var _len4 = arguments.length, os = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { | ||
os[_key4] = arguments[_key4]; | ||
} | ||
return os.reduceRight(orElseU, zero); | ||
}; | ||
return os.reduceRight(orElseU, zero); | ||
}; | ||
var unless = /*#__PURE__*/eitherU(zeroOp, identity); | ||
var unless = function unless(p) { | ||
return ifteU(p, zeroOp, identity); | ||
}; | ||
var when = /*#__PURE__*/eitherU(identity, zeroOp); | ||
var when = function when(p) { | ||
return ifteU(p, identity, zeroOp); | ||
}; | ||
var optional = /*#__PURE__*/when(I.isDefined); | ||
var optional = /*#__PURE__*/when(I.isDefined); | ||
var zero = function zero(x, i, C, xi2yC) { | ||
return zeroOp(x, i, C, xi2yC); | ||
}; | ||
var zero = function zero(x, i, C, xi2yC) { | ||
return zeroOp(x, i, C, xi2yC); | ||
}; | ||
// Transforming | ||
// Transforming | ||
var assignOp = function assignOp(x) { | ||
return [propsOf(x), setOp(x)]; | ||
}; | ||
var assignOp = function assignOp(x) { | ||
return [propsOf(x), setOp(x)]; | ||
}; | ||
var modifyOp = function modifyOp(xi2y) { | ||
return function (x, i, C, xi2yC) { | ||
return zeroOp(x = xi2y(x, i), i, C, xi2yC, x); | ||
var modifyOp = function modifyOp(xi2y) { | ||
return function (x, i, C, xi2yC) { | ||
return zeroOp(x = xi2y(x, i), i, C, xi2yC, x); | ||
}; | ||
}; | ||
}; | ||
var setOp = function setOp(y) { | ||
return function (_x, i, C, xi2yC) { | ||
return zeroOp(y, i, C, xi2yC, y); | ||
var setOp = function setOp(y) { | ||
return function (_x, i, C, xi2yC) { | ||
return zeroOp(y, i, C, xi2yC, y); | ||
}; | ||
}; | ||
}; | ||
var removeOp = /*#__PURE__*/setOp(); | ||
var removeOp = /*#__PURE__*/setOp(); | ||
// Debugging | ||
// Debugging | ||
function log() { | ||
var _arguments = arguments; | ||
function log() { | ||
var _arguments = arguments; | ||
var show = I.curry(function (dir, x) { | ||
return console.log.apply(console, copyToFrom([], 0, _arguments, 0, _arguments.length).concat([dir, x])), x; | ||
}); | ||
return isoU(show('get'), show('set')); | ||
} | ||
var show = I.curry(function (dir, x) { | ||
return console.log.apply(console, copyToFrom([], 0, _arguments, 0, _arguments.length).concat([dir, x])), x; | ||
}); | ||
return isoU(show('get'), show('set')); | ||
} | ||
// Sequencing | ||
// Sequencing | ||
var seq = /*#__PURE__*/(function (fn$$1) { | ||
return function () { | ||
return par(2, ef(reqMonad('seq')))(fn$$1.apply(undefined, arguments)); | ||
}; | ||
})(function () { | ||
var n = arguments.length; | ||
var r = zero; | ||
if (n) { | ||
r = toFunction(arguments[--n]); | ||
while (n) { | ||
r = seq2U(toFunction(arguments[--n]), r); | ||
var seq = /*#__PURE__*/(function (fn$$1) { | ||
return function () { | ||
return par(2, ef(reqMonad('seq')))(fn$$1.apply(undefined, arguments)); | ||
}; | ||
})(function () { | ||
var n = arguments.length; | ||
var r = zero; | ||
if (n) { | ||
r = toFunction(arguments[--n]); | ||
while (n) { | ||
r = seq2U(toFunction(arguments[--n]), r); | ||
} | ||
} | ||
} | ||
return r; | ||
}); | ||
return r; | ||
}); | ||
// Creating new traversals | ||
// Creating new traversals | ||
var branchOr = /*#__PURE__*/(par(1, ef(reqTemplate('branchOr'))))( /*#__PURE__*/I.curryN(2, function (otherwise) { | ||
return otherwise = toFunction(otherwise), function (template) { | ||
return branchOrU(otherwise, template); | ||
}; | ||
})); | ||
var branchOr = /*#__PURE__*/(par(1, ef(reqTemplate('branchOr'))))( /*#__PURE__*/I.curryN(2, function (otherwise) { | ||
return otherwise = toFunction(otherwise), function (template) { | ||
return branchOrU(otherwise, template); | ||
}; | ||
})); | ||
var branch = /*#__PURE__*/branchOr(zero); | ||
var branch = /*#__PURE__*/branchOr(zero); | ||
function branches() { | ||
var n = arguments.length; | ||
var template = {}; | ||
for (var i = 0; i < n; ++i) { | ||
template[arguments[i]] = identity; | ||
}return branch(template); | ||
} | ||
function branches() { | ||
var n = arguments.length; | ||
var template = {}; | ||
for (var i = 0; i < n; ++i) { | ||
template[arguments[i]] = identity; | ||
}return branch(template); | ||
} | ||
// Traversals and combinators | ||
// Traversals and combinators | ||
var elems = /*#__PURE__*/(par(2, ef(reqApplicative('elems'))))(function (xs, i, A, xi2yA) { | ||
return seemsArrayLike(xs) ? elemsI(xs, i, A, xi2yA) : A.of(xs); | ||
}); | ||
var elems = /*#__PURE__*/(par(2, ef(reqApplicative('elems'))))(function (xs, i, A, xi2yA) { | ||
return seemsArrayLike(xs) ? elemsI(xs, i, A, xi2yA) : A.of(xs); | ||
}); | ||
var entries = /*#__PURE__*/toFunction([keyed, elems]); | ||
var entries = /*#__PURE__*/toFunction([keyed, elems]); | ||
var keys = /*#__PURE__*/toFunction([keyed, elems, 0]); | ||
var keys = /*#__PURE__*/toFunction([keyed, elems, 0]); | ||
var matches = /*#__PURE__*/(dep(function (re) { | ||
return re.global ? res(par(2, ef(reqApplicative('matches', re)))) : I.id; | ||
}))(function (re) { | ||
return function (x, _i, C, xi2yC) { | ||
if (I.isString(x)) { | ||
var map = C.map; | ||
var matches = /*#__PURE__*/(dep(function (re) { | ||
return re.global ? res(par(2, ef(reqApplicative('matches', re)))) : I.id; | ||
}))(function (re) { | ||
return function (x, _i, C, xi2yC) { | ||
if (I.isString(x)) { | ||
var map = C.map; | ||
if (re.global) { | ||
var m0 = ['']; | ||
m0.input = x; | ||
m0.index = 0; | ||
if (Select === C) { | ||
return iterSelect(xi2yC, re, m0); | ||
if (re.global) { | ||
var m0 = ['']; | ||
m0.input = x; | ||
m0.index = 0; | ||
if (Select === C) { | ||
return iterSelect(xi2yC, re, m0); | ||
} else { | ||
var ap = C.ap, | ||
of = C.of; | ||
return map(matchesJoin(x), iterEager(map, ap, of, xi2yC, re, m0)); | ||
} | ||
} else { | ||
var ap = C.ap, | ||
of = C.of; | ||
return map(matchesJoin(x), iterEager(map, ap, of, xi2yC, re, m0)); | ||
var m = x.match(re); | ||
if (m) return map(function (y) { | ||
return x.replace(re, void 0 !== y ? y : ''); | ||
}, xi2yC(m[0], reIndex(m))); | ||
} | ||
} else { | ||
var m = x.match(re); | ||
if (m) return map(function (y) { | ||
return x.replace(re, void 0 !== y ? y : ''); | ||
}, xi2yC(m[0], reIndex(m))); | ||
} | ||
} | ||
return zeroOp(x, void 0, C, xi2yC); | ||
}; | ||
}); | ||
return zeroOp(x, void 0, C, xi2yC); | ||
}; | ||
}); | ||
var values = /*#__PURE__*/(par(2, ef(reqApplicative('values'))))( /*#__PURE__*/branchOr1Level(identity, protoless0)); | ||
var values = /*#__PURE__*/(par(2, ef(reqApplicative('values'))))( /*#__PURE__*/branchOr1Level(identity, protoless0)); | ||
var children = /*#__PURE__*/(par(2, ef(reqApplicative('children'))))(function (x, i, C, xi2yC) { | ||
return I.isArray(x) ? elemsI(x, i, C, xi2yC) : I.isObject(x) ? values(x, i, C, xi2yC) : C.of(x); | ||
}); | ||
var children = /*#__PURE__*/(par(2, ef(reqApplicative('children'))))(function (x, i, C, xi2yC) { | ||
return I.isArray(x) ? elemsI(x, i, C, xi2yC) : I.isObject(x) ? values(x, i, C, xi2yC) : C.of(x); | ||
}); | ||
var flatten = /*#__PURE__*/(par(2, ef(reqApplicative('flatten'))))(function (x, i, C, xi2yC) { | ||
var rec = function rec(x, i) { | ||
return I.isArray(x) ? elemsI(x, i, C, rec) : void 0 !== x ? xi2yC(x, i) : C.of(x); | ||
}; | ||
return rec(x, i); | ||
}); | ||
var flatten = /*#__PURE__*/(par(2, ef(reqApplicative('flatten'))))(function (x, i, C, xi2yC) { | ||
var rec = function rec(x, i) { | ||
return I.isArray(x) ? elemsI(x, i, C, rec) : void 0 !== x ? xi2yC(x, i) : C.of(x); | ||
}; | ||
return rec(x, i); | ||
}); | ||
function query() { | ||
var r = []; | ||
for (var i = 0, n = arguments.length; i < n; ++i) { | ||
var o = toFunction(arguments[i]); | ||
r.push(satisfying(isDefined(o)), o); | ||
function query() { | ||
var r = []; | ||
for (var i = 0, n = arguments.length; i < n; ++i) { | ||
var o = toFunction(arguments[i]); | ||
r.push(satisfying(isDefined(o)), o); | ||
} | ||
return r; | ||
} | ||
return r; | ||
} | ||
var satisfying = function satisfying(p) { | ||
return function (x, i, C, xi2yC) { | ||
var rec = function rec(x, i) { | ||
return p(x, i) ? xi2yC(x, i) : children(x, i, C, rec); | ||
var satisfying = function satisfying(p) { | ||
return function (x, i, C, xi2yC) { | ||
var rec = function rec(x, i) { | ||
return p(x, i) ? xi2yC(x, i) : children(x, i, C, rec); | ||
}; | ||
return rec(x, i); | ||
}; | ||
return rec(x, i); | ||
}; | ||
}; | ||
var leafs = /*#__PURE__*/satisfying(function (x) { | ||
return void 0 !== x && !I.isArray(x) && !I.isObject(x); | ||
}); | ||
var leafs = /*#__PURE__*/satisfying(function (x) { | ||
return void 0 !== x && !I.isArray(x) && !I.isObject(x); | ||
}); | ||
// Folds over traversals | ||
// Folds over traversals | ||
var all = /*#__PURE__*/I.curry(function (xi2b, t, s) { | ||
return !traverseU(Select, function (x, i) { | ||
if (!xi2b(x, i)) return true; | ||
}, t, s); | ||
}); | ||
var all = /*#__PURE__*/I.curry(function (xi2b, t, s) { | ||
return !traverseU(Select, function (x, i) { | ||
if (!xi2b(x, i)) return true; | ||
}, t, s); | ||
}); | ||
var and$1 = /*#__PURE__*/all(I.id); | ||
var and$1 = /*#__PURE__*/all(I.id); | ||
var any = /*#__PURE__*/I.curry(function (xi2b, t, s) { | ||
return !!traverseU(Select, function (x, i) { | ||
if (xi2b(x, i)) return true; | ||
}, t, s); | ||
}); | ||
var any = /*#__PURE__*/I.curry(function (xi2b, t, s) { | ||
return !!traverseU(Select, function (x, i) { | ||
if (xi2b(x, i)) return true; | ||
}, t, s); | ||
}); | ||
var collectAs = /*#__PURE__*/(res(I.freeze))(function (xi2y, t, s) { | ||
var results = []; | ||
traverseU(Select, function (x, i) { | ||
var y = xi2y(x, i); | ||
if (void 0 !== y) results.push(y); | ||
}, t, s); | ||
return results; | ||
}); | ||
var collectAs = /*#__PURE__*/(res(I.freeze))(function (xi2y, t, s) { | ||
var results = []; | ||
traverseU(Select, function (x, i) { | ||
var y = xi2y(x, i); | ||
if (void 0 !== y) results.push(y); | ||
}, t, s); | ||
return results; | ||
}); | ||
var collect = /*#__PURE__*/collectAs(I.id); | ||
var collect = /*#__PURE__*/collectAs(I.id); | ||
var concatAs = /*#__PURE__*/mkTraverse(I.id, function (m) { | ||
return ConcatOf(m.concat, m.empty()); | ||
}); | ||
var concatAs = /*#__PURE__*/mkTraverse(I.id, function (m) { | ||
return ConcatOf(m.concat, m.empty()); | ||
}); | ||
var concat = /*#__PURE__*/concatAs(I.id); | ||
var concat = /*#__PURE__*/concatAs(I.id); | ||
var countIf = /*#__PURE__*/I.curry(function (p, t, s) { | ||
return traverseU(Sum, function (x, i) { | ||
return p(x, i) ? 1 : 0; | ||
}, t, s); | ||
}); | ||
var countIf = /*#__PURE__*/I.curry(function (p, t, s) { | ||
return traverseU(Sum, function (x, i) { | ||
return p(x, i) ? 1 : 0; | ||
}, t, s); | ||
}); | ||
var count = /*#__PURE__*/countIf(I.isDefined); | ||
var count = /*#__PURE__*/countIf(I.isDefined); | ||
var countsAs = /*#__PURE__*/I.curry(function (xi2k, t, s) { | ||
var counts = new Map(); | ||
traverseU(Select, function (x, i) { | ||
var k = xi2k(x, i); | ||
var n = counts.get(k); | ||
counts.set(k, void 0 !== n ? n + 1 : 1); | ||
}, t, s); | ||
return counts; | ||
}); | ||
var countsAs = /*#__PURE__*/I.curry(function (xi2k, t, s) { | ||
var counts = new Map(); | ||
traverseU(Select, function (x, i) { | ||
var k = xi2k(x, i); | ||
var n = counts.get(k); | ||
counts.set(k, void 0 !== n ? n + 1 : 1); | ||
}, t, s); | ||
return counts; | ||
}); | ||
var counts = /*#__PURE__*/countsAs(I.id); | ||
var counts = /*#__PURE__*/countsAs(I.id); | ||
var foldl = /*#__PURE__*/I.curry(function (f, r, t, s) { | ||
traverseU(Select, function (x, i) { | ||
r = f(r, x, i); | ||
}, t, s); | ||
return r; | ||
}); | ||
var foldl = /*#__PURE__*/I.curry(function (f, r, t, s) { | ||
traverseU(Select, function (x, i) { | ||
r = f(r, x, i); | ||
}, t, s); | ||
return r; | ||
}); | ||
var foldr = /*#__PURE__*/I.curry(function (f, r, t, s) { | ||
var is = []; | ||
var xs = []; | ||
traverseU(Select, function (x, i) { | ||
xs.push(x); | ||
is.push(i); | ||
}, t, s); | ||
for (var i = xs.length - 1; 0 <= i; --i) { | ||
r = f(r, xs[i], is[i]); | ||
}return r; | ||
}); | ||
var foldr = /*#__PURE__*/I.curry(function (f, r, t, s) { | ||
var is = []; | ||
var xs = []; | ||
traverseU(Select, function (x, i) { | ||
xs.push(x); | ||
is.push(i); | ||
}, t, s); | ||
for (var i = xs.length - 1; 0 <= i; --i) { | ||
r = f(r, xs[i], is[i]); | ||
}return r; | ||
}); | ||
var forEach = /*#__PURE__*/I.curry(function (f, t, s) { | ||
return traverseU(Select, function (x, i) { | ||
f(x, i); | ||
}, t, s); | ||
}); | ||
var forEach = /*#__PURE__*/I.curry(function (f, t, s) { | ||
return traverseU(Select, function (x, i) { | ||
f(x, i); | ||
}, t, s); | ||
}); | ||
var forEachWith = /*#__PURE__*/I.curry(function (newC, ef$$1, t, s) { | ||
var c = newC(); | ||
traverseU(Select, function (x, i) { | ||
ef$$1(c, x, i); | ||
}, t, s); | ||
return c; | ||
}); | ||
var forEachWith = /*#__PURE__*/I.curry(function (newC, ef$$1, t, s) { | ||
var c = newC(); | ||
traverseU(Select, function (x, i) { | ||
ef$$1(c, x, i); | ||
}, t, s); | ||
return c; | ||
}); | ||
var isDefined = /*#__PURE__*/I.curry(function (t, s) { | ||
return void 0 !== traverseU(Select, I.id, t, s); | ||
}); | ||
var isDefined = /*#__PURE__*/I.curry(function (t, s) { | ||
return void 0 !== traverseU(Select, I.id, t, s); | ||
}); | ||
var isEmpty = /*#__PURE__*/I.curry(function (t, s) { | ||
return !traverseU(Select, I.always(true), t, s); | ||
}); | ||
var joinAs = /*#__PURE__*/mkTraverse(toStringPartial, /*#__PURE__*/(par(0, ef(reqString('`join` and `joinAs` expect a string delimiter'))))(function (d) { | ||
return ConcatOf(function (x, y) { | ||
return void 0 !== x ? void 0 !== y ? x + d + y : x : y; | ||
var isEmpty = /*#__PURE__*/I.curry(function (t, s) { | ||
return !traverseU(Select, I.always(true), t, s); | ||
}); | ||
})); | ||
var join = /*#__PURE__*/joinAs(I.id); | ||
var joinAs = /*#__PURE__*/mkTraverse(toStringPartial, /*#__PURE__*/(par(0, ef(reqString('`join` and `joinAs` expect a string delimiter'))))(function (d) { | ||
return ConcatOf(function (x, y) { | ||
return void 0 !== x ? void 0 !== y ? x + d + y : x : y; | ||
}); | ||
})); | ||
var maximumBy = /*#__PURE__*/mumBy(gtU); | ||
var join = /*#__PURE__*/joinAs(I.id); | ||
var maximum = /*#__PURE__*/maximumBy(I.id); | ||
var maximumBy = /*#__PURE__*/mumBy(gtU); | ||
var meanAs = /*#__PURE__*/I.curry(function (xi2y, t, s) { | ||
var sum = 0; | ||
var num = 0; | ||
traverseU(Select, function (x, i) { | ||
var y = xi2y(x, i); | ||
if (void 0 !== y) { | ||
num += 1; | ||
sum += y; | ||
} | ||
}, t, s); | ||
return sum / num; | ||
}); | ||
var maximum = /*#__PURE__*/maximumBy(I.id); | ||
var mean = /*#__PURE__*/meanAs(I.id); | ||
var meanAs = /*#__PURE__*/I.curry(function (xi2y, t, s) { | ||
var sum = 0; | ||
var num = 0; | ||
traverseU(Select, function (x, i) { | ||
var y = xi2y(x, i); | ||
if (void 0 !== y) { | ||
num += 1; | ||
sum += y; | ||
} | ||
}, t, s); | ||
return sum / num; | ||
}); | ||
var minimumBy = /*#__PURE__*/mumBy(ltU); | ||
var mean = /*#__PURE__*/meanAs(I.id); | ||
var minimum = /*#__PURE__*/minimumBy(I.id); | ||
var minimumBy = /*#__PURE__*/mumBy(ltU); | ||
var none = /*#__PURE__*/I.curry(function (xi2b, t, s) { | ||
return !traverseU(Select, function (x, i) { | ||
if (xi2b(x, i)) return true; | ||
}, t, s); | ||
}); | ||
var minimum = /*#__PURE__*/minimumBy(I.id); | ||
var or$1 = /*#__PURE__*/any(I.id); | ||
var none = /*#__PURE__*/I.curry(function (xi2b, t, s) { | ||
return !traverseU(Select, function (x, i) { | ||
if (xi2b(x, i)) return true; | ||
}, t, s); | ||
}); | ||
var productAs = /*#__PURE__*/traverse( /*#__PURE__*/ConcatOf(function (x, y) { | ||
return x * y; | ||
}, 1)); | ||
var or$1 = /*#__PURE__*/any(I.id); | ||
var product = /*#__PURE__*/productAs( /*#__PURE__*/unto(1)); | ||
var productAs = /*#__PURE__*/traverse( /*#__PURE__*/ConcatOf(function (x, y) { | ||
return x * y; | ||
}, 1)); | ||
var selectAs = /*#__PURE__*/traverse(Select); | ||
var product = /*#__PURE__*/productAs( /*#__PURE__*/unto(1)); | ||
var select = /*#__PURE__*/selectAs(I.id); | ||
var selectAs = /*#__PURE__*/traverse(Select); | ||
var sumAs = /*#__PURE__*/traverse(Sum); | ||
var select = /*#__PURE__*/selectAs(I.id); | ||
var sum = /*#__PURE__*/sumAs(unto0); | ||
var sumAs = /*#__PURE__*/traverse(Sum); | ||
// Operations on lenses | ||
var sum = /*#__PURE__*/sumAs(unto0); | ||
function get(l, s) { | ||
return 1 < arguments.length ? getU(l, s) : function (s) { | ||
return getU(l, s); | ||
}; | ||
} | ||
// Operations on lenses | ||
// Creating new lenses | ||
function get(l, s) { | ||
return 1 < arguments.length ? getU(l, s) : function (s) { | ||
return getU(l, s); | ||
}; | ||
} | ||
var lens = /*#__PURE__*/I.curry(lensU); | ||
// Creating new lenses | ||
var setter = /*#__PURE__*/lens(I.id); | ||
var lens = /*#__PURE__*/I.curry(lensU); | ||
var foldTraversalLens = /*#__PURE__*/I.curry(function (fold, traversal) { | ||
return lensU(fold(traversal), set(traversal)); | ||
}); | ||
var setter = /*#__PURE__*/lens(I.id); | ||
// Enforcing invariants | ||
var foldTraversalLens = /*#__PURE__*/I.curry(function (fold, traversal) { | ||
return lensU(fold(traversal), set(traversal)); | ||
}); | ||
function defaults(out) { | ||
function o2u(x) { | ||
return replaced(out, void 0, x); | ||
// Enforcing invariants | ||
function defaults(out) { | ||
function o2u(x) { | ||
return replaced(out, void 0, x); | ||
} | ||
return function (x, i, F, xi2yF) { | ||
return F.map(o2u, xi2yF(void 0 !== x ? x : out, i)); | ||
}; | ||
} | ||
return function (x, i, F, xi2yF) { | ||
return F.map(o2u, xi2yF(void 0 !== x ? x : out, i)); | ||
}; | ||
} | ||
var define = /*#__PURE__*/(function (fn$$1) { | ||
return function (inn) { | ||
var res$$1 = fn$$1(inn); | ||
if (isEmptyArrayStringOrObject(inn)) return toFunction([isoU(warnEmpty(fn$$1, inn, 'define'), I.id), res$$1, isoU(I.id, warnEmpty(define, inn, 'define'))]);else return res$$1; | ||
var define = /*#__PURE__*/(function (fn$$1) { | ||
return function (inn) { | ||
var res$$1 = fn$$1(inn); | ||
if (isEmptyArrayStringOrObject(inn)) return toFunction([isoU(warnEmpty(fn$$1, inn, 'define'), I.id), res$$1, isoU(I.id, warnEmpty(define, inn, 'define'))]);else return res$$1; | ||
}; | ||
})(function (v) { | ||
var untoV = unto(v); | ||
return function (x, i, F, xi2yF) { | ||
return F.map(untoV, xi2yF(void 0 !== x ? x : v, i)); | ||
}; | ||
}); | ||
var normalize = function normalize(xi2x) { | ||
return [reread(xi2x), rewrite(xi2x)]; | ||
}; | ||
})(function (v) { | ||
var untoV = unto(v); | ||
return function (x, i, F, xi2yF) { | ||
return F.map(untoV, xi2yF(void 0 !== x ? x : v, i)); | ||
}; | ||
}); | ||
var normalize = function normalize(xi2x) { | ||
return [reread(xi2x), rewrite(xi2x)]; | ||
}; | ||
var required = /*#__PURE__*/(function (fn$$1) { | ||
return function (inn) { | ||
var res$$1 = fn$$1(inn); | ||
if (isEmptyArrayStringOrObject(inn)) return toFunction([res$$1, isoU(I.id, warnEmpty(required, inn, 'required'))]);else return res$$1; | ||
}; | ||
})(function (inn) { | ||
return replace(inn, void 0); | ||
}); | ||
var required = /*#__PURE__*/(function (fn$$1) { | ||
return function (inn) { | ||
var res$$1 = fn$$1(inn); | ||
if (isEmptyArrayStringOrObject(inn)) return toFunction([res$$1, isoU(I.id, warnEmpty(required, inn, 'required'))]);else return res$$1; | ||
var reread = function reread(xi2x) { | ||
return function (x, i, _F, xi2yF) { | ||
return xi2yF(void 0 !== x ? xi2x(x, i) : x, i); | ||
}; | ||
}; | ||
})(function (inn) { | ||
return replace(inn, void 0); | ||
}); | ||
var reread = function reread(xi2x) { | ||
return function (x, i, _F, xi2yF) { | ||
return xi2yF(void 0 !== x ? xi2x(x, i) : x, i); | ||
var rewrite = function rewrite(yi2y) { | ||
return function (x, i, F, xi2yF) { | ||
return F.map(function (y) { | ||
return void 0 !== y ? yi2y(y, i) : y; | ||
}, xi2yF(x, i)); | ||
}; | ||
}; | ||
}; | ||
var rewrite = function rewrite(yi2y) { | ||
return function (x, i, F, xi2yF) { | ||
return F.map(function (y) { | ||
return void 0 !== y ? yi2y(y, i) : y; | ||
}, xi2yF(x, i)); | ||
}; | ||
}; | ||
// Lensing arrays | ||
// Lensing arrays | ||
function append(xs, _, F, xi2yF) { | ||
var i = seemsArrayLike(xs) ? xs.length : 0; | ||
return F.map(function (x) { | ||
return setIndex(i, x, xs); | ||
}, xi2yF(void 0, i)); | ||
} | ||
function append(xs, _, F, xi2yF) { | ||
var i = seemsArrayLike(xs) ? xs.length : 0; | ||
return F.map(function (x) { | ||
return setIndex(i, x, xs); | ||
}, xi2yF(void 0, i)); | ||
} | ||
var filter = /*#__PURE__*/(res(function (lens) { | ||
return toFunction([lens, isoU(I.id, ef(reqMaybeArray('`filter` must be set with undefined or an array-like object')))]); | ||
}))(function (xi2b) { | ||
return function (xs, i, F, xi2yF) { | ||
var ts = void 0; | ||
var fs = I.array0; | ||
if (seemsArrayLike(xs)) partitionIntoIndex(xi2b, xs, ts = [], fs = []); | ||
return F.map(function (ts) { | ||
var tsN = ts ? ts.length : 0; | ||
var fsN = fs.length; | ||
var n = tsN + fsN; | ||
return n === fsN ? fs : copyToFrom(copyToFrom(Array(n), 0, ts, 0, tsN), tsN, fs, 0, fsN); | ||
}, xi2yF(ts, i)); | ||
}; | ||
}); | ||
var filter = /*#__PURE__*/(res(function (lens) { | ||
return toFunction([lens, isoU(I.id, ef(reqMaybeArray('`filter` must be set with undefined or an array-like object')))]); | ||
}))(function (xi2b) { | ||
return function (xs, i, F, xi2yF) { | ||
var ts = void 0; | ||
var fs = I.array0; | ||
if (seemsArrayLike(xs)) partitionIntoIndex(xi2b, xs, ts = [], fs = []); | ||
return F.map(function (ts) { | ||
var tsN = ts ? ts.length : 0; | ||
var fsN = fs.length; | ||
var n = tsN + fsN; | ||
return n === fsN ? fs : copyToFrom(copyToFrom(Array(n), 0, ts, 0, tsN), tsN, fs, 0, fsN); | ||
}, xi2yF(ts, i)); | ||
}; | ||
}); | ||
function find(xih2b) { | ||
var hint = arguments.length > 1 ? arguments[1] : { hint: 0 }; | ||
return function (xs, _i, F, xi2yF) { | ||
var ys = seemsArrayLike(xs) ? xs : ''; | ||
var i = hint.hint = findIndexHint(hint, xih2b, ys); | ||
return F.map(function (v) { | ||
return setIndex(i, v, ys); | ||
}, xi2yF(ys[i], i)); | ||
}; | ||
} | ||
function find(xih2b) { | ||
var hint = arguments.length > 1 ? arguments[1] : { hint: 0 }; | ||
return function (xs, _i, F, xi2yF) { | ||
var ys = seemsArrayLike(xs) ? xs : ''; | ||
var i = hint.hint = findIndexHint(hint, xih2b, ys); | ||
return F.map(function (v) { | ||
return setIndex(i, v, ys); | ||
}, xi2yF(ys[i], i)); | ||
}; | ||
} | ||
function findWith(o) { | ||
var oo = toFunction(o); | ||
var p = isDefined(oo); | ||
return [arguments.length > 1 ? find(p, arguments[1]) : find(p), oo]; | ||
} | ||
function findWith(o) { | ||
var oo = toFunction(o); | ||
var p = isDefined(oo); | ||
return [arguments.length > 1 ? find(p, arguments[1]) : find(p), oo]; | ||
} | ||
var first = 0; | ||
var first = 0; | ||
var index = ef(reqIndex); | ||
var index = ef(reqIndex); | ||
var last = /*#__PURE__*/choose(function (maybeArray) { | ||
return seemsArrayLike(maybeArray) && maybeArray.length ? maybeArray.length - 1 : 0; | ||
}); | ||
var last = /*#__PURE__*/choose(function (maybeArray) { | ||
return seemsArrayLike(maybeArray) && maybeArray.length ? maybeArray.length - 1 : 0; | ||
}); | ||
var prefix = function prefix(n) { | ||
return slice(0, n); | ||
}; | ||
var prefix = function prefix(n) { | ||
return slice(0, n); | ||
}; | ||
var slice = /*#__PURE__*/(res(function (lens) { | ||
return toFunction([lens, isoU(I.id, ef(reqMaybeArray('`slice` must be set with undefined or an array-like object')))]); | ||
}))(function (begin, end) { | ||
return function (xs, i, F, xsi2yF) { | ||
var seems = seemsArrayLike(xs); | ||
var xsN = seems && xs.length; | ||
var b = sliceIndex(0, xsN, 0, begin); | ||
var e = sliceIndex(b, xsN, xsN, end); | ||
return F.map(function (zs) { | ||
var zsN = zs ? zs.length : 0; | ||
var bPzsN = b + zsN; | ||
var n = xsN - e + bPzsN; | ||
return copyToFrom(copyToFrom(copyToFrom(Array(n), 0, xs, 0, b), b, zs, 0, zsN), bPzsN, xs, e, xsN); | ||
}, xsi2yF(seems ? copyToFrom(Array(Math.max(0, e - b)), 0, xs, b, e) : void 0, i)); | ||
}; | ||
}); | ||
var slice = /*#__PURE__*/(res(function (lens) { | ||
return toFunction([lens, isoU(I.id, ef(reqMaybeArray('`slice` must be set with undefined or an array-like object')))]); | ||
}))(function (begin, end) { | ||
return function (xs, i, F, xsi2yF) { | ||
var seems = seemsArrayLike(xs); | ||
var xsN = seems && xs.length; | ||
var b = sliceIndex(0, xsN, 0, begin); | ||
var e = sliceIndex(b, xsN, xsN, end); | ||
return F.map(function (zs) { | ||
var zsN = zs ? zs.length : 0; | ||
var bPzsN = b + zsN; | ||
var n = xsN - e + bPzsN; | ||
return copyToFrom(copyToFrom(copyToFrom(Array(n), 0, xs, 0, b), b, zs, 0, zsN), bPzsN, xs, e, xsN); | ||
}, xsi2yF(seems ? copyToFrom(Array(Math.max(0, e - b)), 0, xs, b, e) : void 0, i)); | ||
var suffix = function suffix(n) { | ||
return slice(0 === n ? Infinity : !n ? 0 : -n, void 0); | ||
}; | ||
}); | ||
var suffix = function suffix(n) { | ||
return slice(0 === n ? Infinity : !n ? 0 : -n, void 0); | ||
}; | ||
// Lensing objects | ||
// Lensing objects | ||
var pickIn = function pickIn(t) { | ||
return I.isObject(t) ? pick(modify(values, pickInAux, t)) : t; | ||
}; | ||
var pickIn = function pickIn(t) { | ||
return I.isObject(t) ? pick(modify(values, pickInAux, t)) : t; | ||
}; | ||
var prop = function (x) { | ||
if (!I.isString(x)) errorGiven('`prop` expects a string', x); | ||
return x; | ||
}; | ||
var prop = function (x) { | ||
if (!I.isString(x)) errorGiven('`prop` expects a string', x); | ||
return x; | ||
}; | ||
function props() { | ||
var n = arguments.length; | ||
var template = {}; | ||
for (var i = 0, k; i < n; ++i) { | ||
template[k = arguments[i]] = k; | ||
}return pick(template); | ||
} | ||
function props() { | ||
var n = arguments.length; | ||
var template = {}; | ||
for (var i = 0, k; i < n; ++i) { | ||
template[k = arguments[i]] = k; | ||
}return pick(template); | ||
} | ||
var propsOf = function propsOf(o) { | ||
return props.apply(null, I.keys(o)); | ||
}; | ||
var propsOf = function propsOf(o) { | ||
return props.apply(null, I.keys(o)); | ||
}; | ||
function removable() { | ||
for (var _len5 = arguments.length, ps = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { | ||
ps[_key5] = arguments[_key5]; | ||
} | ||
function removable() { | ||
for (var _len5 = arguments.length, ps = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { | ||
ps[_key5] = arguments[_key5]; | ||
} | ||
function drop(y) { | ||
if (!(y instanceof Object)) return y; | ||
for (var i = 0, n = ps.length; i < n; ++i) { | ||
if (I.hasU(ps[i], y)) return y; | ||
function drop(y) { | ||
if (!(y instanceof Object)) return y; | ||
for (var i = 0, n = ps.length; i < n; ++i) { | ||
if (I.hasU(ps[i], y)) return y; | ||
} | ||
} | ||
return function (x, i, F, xi2yF) { | ||
return F.map(drop, xi2yF(x, i)); | ||
}; | ||
} | ||
return function (x, i, F, xi2yF) { | ||
return F.map(drop, xi2yF(x, i)); | ||
}; | ||
} | ||
// Providing defaults | ||
// Providing defaults | ||
var valueOr = function valueOr(v) { | ||
return function (x, i, _F, xi2yF) { | ||
return xi2yF(x != null ? x : v, i); | ||
var valueOr = function valueOr(v) { | ||
return function (x, i, _F, xi2yF) { | ||
return xi2yF(x != null ? x : v, i); | ||
}; | ||
}; | ||
}; | ||
// Transforming data | ||
// Transforming data | ||
var pick = /*#__PURE__*/(par(0, ef(reqTemplate('pick'))))(function (template) { | ||
return function (x, i, F, xi2yF) { | ||
return F.map(function (v) { | ||
return setPick(template, v, x); | ||
}, xi2yF(getPick(template, x), i)); | ||
}; | ||
}); | ||
var pick = /*#__PURE__*/(par(0, ef(reqTemplate('pick'))))(function (template) { | ||
return function (x, i, F, xi2yF) { | ||
return F.map(function (v) { | ||
return setPick(template, v, x); | ||
}, xi2yF(getPick(template, x), i)); | ||
}; | ||
}); | ||
var replace = /*#__PURE__*/I.curry(function (inn, out) { | ||
function o2i(x) { | ||
return replaced(out, inn, x); | ||
} | ||
return function (x, i, F, xi2yF) { | ||
return F.map(o2i, xi2yF(replaced(inn, out, x), i)); | ||
}; | ||
}); | ||
var replace = /*#__PURE__*/I.curry(function (inn, out) { | ||
function o2i(x) { | ||
return replaced(out, inn, x); | ||
} | ||
return function (x, i, F, xi2yF) { | ||
return F.map(o2i, xi2yF(replaced(inn, out, x), i)); | ||
}; | ||
}); | ||
// Operations on isomorphisms | ||
// Operations on isomorphisms | ||
function getInverse(o, s) { | ||
return 1 < arguments.length ? setU(o, s, void 0) : function (s) { | ||
return setU(o, s, void 0); | ||
}; | ||
} | ||
function getInverse(o, s) { | ||
return 1 < arguments.length ? setU(o, s, void 0) : function (s) { | ||
return setU(o, s, void 0); | ||
}; | ||
} | ||
// Creating new isomorphisms | ||
// Creating new isomorphisms | ||
var iso = /*#__PURE__*/I.curry(isoU); | ||
var iso = /*#__PURE__*/I.curry(isoU); | ||
// Isomorphism combinators | ||
// Isomorphism combinators | ||
var array = function array(elem) { | ||
var fwd = getInverse(elem); | ||
var bwd = get(elem); | ||
var mapFwd = function mapFwd(x) { | ||
return mapIfArrayLike(fwd, x); | ||
var array = function array(elem) { | ||
var fwd = getInverse(elem); | ||
var bwd = get(elem); | ||
var mapFwd = function mapFwd(x) { | ||
return mapIfArrayLike(fwd, x); | ||
}; | ||
return function (x, i, F, xi2yF) { | ||
return F.map(mapFwd, xi2yF(mapIfArrayLike(bwd, x), i)); | ||
}; | ||
}; | ||
return function (x, i, F, xi2yF) { | ||
return F.map(mapFwd, xi2yF(mapIfArrayLike(bwd, x), i)); | ||
}; | ||
}; | ||
var inverse = function inverse(iso) { | ||
return function (x, i, F, xi2yF) { | ||
return F.map(function (x) { | ||
return getU(iso, x); | ||
}, xi2yF(setU(iso, x, void 0), i)); | ||
var inverse = function inverse(iso) { | ||
return function (x, i, F, xi2yF) { | ||
return F.map(function (x) { | ||
return getU(iso, x); | ||
}, xi2yF(setU(iso, x, void 0), i)); | ||
}; | ||
}; | ||
}; | ||
// Basic isomorphisms | ||
// Basic isomorphisms | ||
var complement = /*#__PURE__*/isoU(notPartial, notPartial); | ||
var complement = /*#__PURE__*/isoU(notPartial, notPartial); | ||
var indexed = /*#__PURE__*/isoU( /*#__PURE__*/expect(seemsArrayLike, /*#__PURE__*/(res(freezeArrayOfObjects))(function (xs) { | ||
var n = xs.length; | ||
var xis = Array(n); | ||
for (var i = 0; i < n; ++i) { | ||
xis[i] = [i, xs[i]]; | ||
}return xis; | ||
})), /*#__PURE__*/expect(I.isArray, /*#__PURE__*/(res(I.freeze))(function (xis) { | ||
var n = xis.length; | ||
var xs = Array(n); | ||
for (var i = 0; i < n; ++i) { | ||
var xi = xis[i]; | ||
if (xi.length === 2) xs[xi[0]] = xi[1]; | ||
} | ||
n = xs.length; | ||
var j = 0; | ||
for (var _i3 = 0; _i3 < n; ++_i3) { | ||
var x = xs[_i3]; | ||
if (void 0 !== x) { | ||
if (_i3 !== j) xs[j] = x; | ||
++j; | ||
var indexed = /*#__PURE__*/isoU( /*#__PURE__*/expect(seemsArrayLike, /*#__PURE__*/(res(freezeArrayOfObjects))(function (xs) { | ||
var n = xs.length; | ||
var xis = Array(n); | ||
for (var i = 0; i < n; ++i) { | ||
xis[i] = [i, xs[i]]; | ||
}return xis; | ||
})), /*#__PURE__*/expect(I.isArray, /*#__PURE__*/(res(I.freeze))(function (xis) { | ||
var n = xis.length; | ||
var xs = Array(n); | ||
for (var i = 0; i < n; ++i) { | ||
var xi = xis[i]; | ||
if (xi.length === 2) xs[xi[0]] = xi[1]; | ||
} | ||
} | ||
xs.length = j; | ||
return xs; | ||
}))); | ||
n = xs.length; | ||
var j = 0; | ||
for (var _i3 = 0; _i3 < n; ++_i3) { | ||
var x = xs[_i3]; | ||
if (void 0 !== x) { | ||
if (_i3 !== j) xs[j] = x; | ||
++j; | ||
} | ||
} | ||
xs.length = j; | ||
return xs; | ||
}))); | ||
var is = function is(v) { | ||
return isoU(function (x) { | ||
return I.acyclicEqualsU(v, x); | ||
}, function (b) { | ||
return true === b ? v : void 0; | ||
}); | ||
}; | ||
var is = function is(v) { | ||
return isoU(function (x) { | ||
return I.acyclicEqualsU(v, x); | ||
}, function (b) { | ||
return true === b ? v : void 0; | ||
}); | ||
}; | ||
var reverse = /*#__PURE__*/isoU(rev, rev); | ||
var reverse = /*#__PURE__*/isoU(rev, rev); | ||
var singleton = /*#__PURE__*/(function (iso) { | ||
return toFunction([isoU(I.id, I.freeze), iso]); | ||
})(function (x, i, F, xi2yF) { | ||
return F.map(singletonPartial, xi2yF((x instanceof Object || I.isString(x)) && x.length === 1 ? x[0] : void 0, i)); | ||
}); | ||
var singleton = /*#__PURE__*/(function (iso) { | ||
return toFunction([isoU(I.id, I.freeze), iso]); | ||
})(function (x, i, F, xi2yF) { | ||
return F.map(singletonPartial, xi2yF((x instanceof Object || I.isString(x)) && x.length === 1 ? x[0] : void 0, i)); | ||
}); | ||
// Standard isomorphisms | ||
// Standard isomorphisms | ||
var uri = /*#__PURE__*/isoU( /*#__PURE__*/expect(I.isString, decodeURI), /*#__PURE__*/expect(I.isString, encodeURI)); | ||
var uri = /*#__PURE__*/isoU( /*#__PURE__*/expect(I.isString, decodeURI), /*#__PURE__*/expect(I.isString, encodeURI)); | ||
var uriComponent = /*#__PURE__*/isoU( /*#__PURE__*/expect(I.isString, decodeURIComponent), /*#__PURE__*/expect(I.isString, encodeURIComponent)); | ||
var uriComponent = /*#__PURE__*/isoU( /*#__PURE__*/expect(I.isString, decodeURIComponent), /*#__PURE__*/expect(I.isString, encodeURIComponent)); | ||
var json = /*#__PURE__*/(res(function (iso) { | ||
return toFunction([iso, isoU(deepFreeze, I.id)]); | ||
}))(function (options) { | ||
var _ref = options || I.object0, | ||
reviver = _ref.reviver, | ||
replacer = _ref.replacer, | ||
space = _ref.space; | ||
var json = /*#__PURE__*/(res(function (iso) { | ||
return toFunction([iso, isoU(deepFreeze, I.id)]); | ||
}))(function (options) { | ||
var _ref = options || I.object0, | ||
reviver = _ref.reviver, | ||
replacer = _ref.replacer, | ||
space = _ref.space; | ||
return isoU(expect(I.isString, function (text) { | ||
return JSON.parse(text, reviver); | ||
}), expect(I.isDefined, function (value) { | ||
return JSON.stringify(value, replacer, space); | ||
})); | ||
}); | ||
return isoU(expect(I.isString, function (text) { | ||
return JSON.parse(text, reviver); | ||
}), expect(I.isDefined, function (value) { | ||
return JSON.stringify(value, replacer, space); | ||
})); | ||
}); | ||
// Interop | ||
// Interop | ||
var pointer = function pointer(s) { | ||
if (s[0] === '#') s = decodeURIComponent(s); | ||
var ts = s.split('/'); | ||
var n = ts.length; | ||
for (var i = 1; i < n; ++i) { | ||
var t = ts[i]; | ||
ts[i - 1] = /^(0|[1-9]\d*)$/.test(t) ? ifElse(isArrayOrPrimitive, Number(t), t) : '-' === t ? ifElse(isArrayOrPrimitive, append, t) : t.replace('~1', '/').replace('~0', '~'); | ||
} | ||
ts.length = n - 1; | ||
return ts; | ||
}; | ||
var pointer = function pointer(s) { | ||
if (s[0] === '#') s = decodeURIComponent(s); | ||
var ts = s.split('/'); | ||
var n = ts.length; | ||
for (var i = 1; i < n; ++i) { | ||
var t = ts[i]; | ||
ts[i - 1] = /^(0|[1-9]\d*)$/.test(t) ? ifElse(isArrayOrPrimitive, Number(t), t) : '-' === t ? ifElse(isArrayOrPrimitive, append, t) : t.replace('~1', '/').replace('~0', '~'); | ||
} | ||
ts.length = n - 1; | ||
return ts; | ||
}; | ||
exports.seemsArrayLike = seemsArrayLike; | ||
exports.Identity = Identity; | ||
exports.Constant = Constant; | ||
exports.toFunction = toFunction; | ||
exports.assign = assign; | ||
exports.modify = modify; | ||
exports.remove = remove; | ||
exports.set = set; | ||
exports.transform = transform; | ||
exports.traverse = traverse; | ||
exports.compose = compose; | ||
exports.flat = flat; | ||
exports.lazy = lazy; | ||
exports.choices = choices; | ||
exports.choose = choose; | ||
exports.cond = cond; | ||
exports.condOf = condOf; | ||
exports.ifElse = ifElse; | ||
exports.iftes = iftes; | ||
exports.orElse = orElse; | ||
exports.chain = chain; | ||
exports.choice = choice; | ||
exports.unless = unless; | ||
exports.when = when; | ||
exports.optional = optional; | ||
exports.zero = zero; | ||
exports.assignOp = assignOp; | ||
exports.modifyOp = modifyOp; | ||
exports.setOp = setOp; | ||
exports.removeOp = removeOp; | ||
exports.log = log; | ||
exports.seq = seq; | ||
exports.branchOr = branchOr; | ||
exports.branch = branch; | ||
exports.branches = branches; | ||
exports.elems = elems; | ||
exports.entries = entries; | ||
exports.keys = keys; | ||
exports.matches = matches; | ||
exports.values = values; | ||
exports.children = children; | ||
exports.flatten = flatten; | ||
exports.query = query; | ||
exports.satisfying = satisfying; | ||
exports.leafs = leafs; | ||
exports.all = all; | ||
exports.and = and$1; | ||
exports.any = any; | ||
exports.collectAs = collectAs; | ||
exports.collect = collect; | ||
exports.concatAs = concatAs; | ||
exports.concat = concat; | ||
exports.countIf = countIf; | ||
exports.count = count; | ||
exports.countsAs = countsAs; | ||
exports.counts = counts; | ||
exports.foldl = foldl; | ||
exports.foldr = foldr; | ||
exports.forEach = forEach; | ||
exports.forEachWith = forEachWith; | ||
exports.isDefined = isDefined; | ||
exports.isEmpty = isEmpty; | ||
exports.joinAs = joinAs; | ||
exports.join = join; | ||
exports.maximumBy = maximumBy; | ||
exports.maximum = maximum; | ||
exports.meanAs = meanAs; | ||
exports.mean = mean; | ||
exports.minimumBy = minimumBy; | ||
exports.minimum = minimum; | ||
exports.none = none; | ||
exports.or = or$1; | ||
exports.productAs = productAs; | ||
exports.product = product; | ||
exports.selectAs = selectAs; | ||
exports.select = select; | ||
exports.sumAs = sumAs; | ||
exports.sum = sum; | ||
exports.get = get; | ||
exports.lens = lens; | ||
exports.setter = setter; | ||
exports.foldTraversalLens = foldTraversalLens; | ||
exports.defaults = defaults; | ||
exports.define = define; | ||
exports.normalize = normalize; | ||
exports.required = required; | ||
exports.reread = reread; | ||
exports.rewrite = rewrite; | ||
exports.append = append; | ||
exports.filter = filter; | ||
exports.find = find; | ||
exports.findWith = findWith; | ||
exports.first = first; | ||
exports.index = index; | ||
exports.last = last; | ||
exports.prefix = prefix; | ||
exports.slice = slice; | ||
exports.suffix = suffix; | ||
exports.pickIn = pickIn; | ||
exports.prop = prop; | ||
exports.props = props; | ||
exports.propsOf = propsOf; | ||
exports.removable = removable; | ||
exports.valueOr = valueOr; | ||
exports.pick = pick; | ||
exports.replace = replace; | ||
exports.getInverse = getInverse; | ||
exports.iso = iso; | ||
exports.array = array; | ||
exports.inverse = inverse; | ||
exports.complement = complement; | ||
exports.identity = identity; | ||
exports.indexed = indexed; | ||
exports.is = is; | ||
exports.keyed = keyed; | ||
exports.reverse = reverse; | ||
exports.singleton = singleton; | ||
exports.uri = uri; | ||
exports.uriComponent = uriComponent; | ||
exports.json = json; | ||
exports.pointer = pointer; | ||
exports.seemsArrayLike = seemsArrayLike; | ||
exports.Identity = Identity; | ||
exports.Constant = Constant; | ||
exports.toFunction = toFunction; | ||
exports.assign = assign; | ||
exports.modify = modify; | ||
exports.remove = remove; | ||
exports.set = set; | ||
exports.transform = transform; | ||
exports.traverse = traverse; | ||
exports.compose = compose; | ||
exports.flat = flat; | ||
exports.lazy = lazy; | ||
exports.choices = choices; | ||
exports.choose = choose; | ||
exports.cond = cond; | ||
exports.condOf = condOf; | ||
exports.ifElse = ifElse; | ||
exports.iftes = iftes; | ||
exports.orElse = orElse; | ||
exports.chain = chain; | ||
exports.choice = choice; | ||
exports.unless = unless; | ||
exports.when = when; | ||
exports.optional = optional; | ||
exports.zero = zero; | ||
exports.assignOp = assignOp; | ||
exports.modifyOp = modifyOp; | ||
exports.setOp = setOp; | ||
exports.removeOp = removeOp; | ||
exports.log = log; | ||
exports.seq = seq; | ||
exports.branchOr = branchOr; | ||
exports.branch = branch; | ||
exports.branches = branches; | ||
exports.elems = elems; | ||
exports.entries = entries; | ||
exports.keys = keys; | ||
exports.matches = matches; | ||
exports.values = values; | ||
exports.children = children; | ||
exports.flatten = flatten; | ||
exports.query = query; | ||
exports.satisfying = satisfying; | ||
exports.leafs = leafs; | ||
exports.all = all; | ||
exports.and = and$1; | ||
exports.any = any; | ||
exports.collectAs = collectAs; | ||
exports.collect = collect; | ||
exports.concatAs = concatAs; | ||
exports.concat = concat; | ||
exports.countIf = countIf; | ||
exports.count = count; | ||
exports.countsAs = countsAs; | ||
exports.counts = counts; | ||
exports.foldl = foldl; | ||
exports.foldr = foldr; | ||
exports.forEach = forEach; | ||
exports.forEachWith = forEachWith; | ||
exports.isDefined = isDefined; | ||
exports.isEmpty = isEmpty; | ||
exports.joinAs = joinAs; | ||
exports.join = join; | ||
exports.maximumBy = maximumBy; | ||
exports.maximum = maximum; | ||
exports.meanAs = meanAs; | ||
exports.mean = mean; | ||
exports.minimumBy = minimumBy; | ||
exports.minimum = minimum; | ||
exports.none = none; | ||
exports.or = or$1; | ||
exports.productAs = productAs; | ||
exports.product = product; | ||
exports.selectAs = selectAs; | ||
exports.select = select; | ||
exports.sumAs = sumAs; | ||
exports.sum = sum; | ||
exports.get = get; | ||
exports.lens = lens; | ||
exports.setter = setter; | ||
exports.foldTraversalLens = foldTraversalLens; | ||
exports.defaults = defaults; | ||
exports.define = define; | ||
exports.normalize = normalize; | ||
exports.required = required; | ||
exports.reread = reread; | ||
exports.rewrite = rewrite; | ||
exports.append = append; | ||
exports.filter = filter; | ||
exports.find = find; | ||
exports.findWith = findWith; | ||
exports.first = first; | ||
exports.index = index; | ||
exports.last = last; | ||
exports.prefix = prefix; | ||
exports.slice = slice; | ||
exports.suffix = suffix; | ||
exports.pickIn = pickIn; | ||
exports.prop = prop; | ||
exports.props = props; | ||
exports.propsOf = propsOf; | ||
exports.removable = removable; | ||
exports.valueOr = valueOr; | ||
exports.pick = pick; | ||
exports.replace = replace; | ||
exports.getInverse = getInverse; | ||
exports.iso = iso; | ||
exports.array = array; | ||
exports.inverse = inverse; | ||
exports.complement = complement; | ||
exports.identity = identity; | ||
exports.indexed = indexed; | ||
exports.is = is; | ||
exports.keyed = keyed; | ||
exports.reverse = reverse; | ||
exports.singleton = singleton; | ||
exports.uri = uri; | ||
exports.uriComponent = uriComponent; | ||
exports.json = json; | ||
exports.pointer = pointer; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); |
@@ -1,1 +0,1 @@ | ||
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("infestines")):"function"==typeof define&&define.amd?define(["exports","infestines"],r):r(n.L={},n.I)}(this,function(n,r){"use strict";function t(n,r){var t=r.length-n;if(t<2)return t?mn(r[n]):X;for(var u=mn(r[n+--t]),e=function(n,r){return function(t,e){return u(t,e,n,r)}};--t;)e=_(mn(r[n+t]),e);var i=mn(r[n]);return function(n,r,t,u){return i(n,r,t,e(t,u))}}function u(n){var r=function n(r,t){return n.v=t,r};return r.v=n,r}function e(n,r,t,u){for(var i,o=n.length;t<o;++t)switch(typeof(i=n[t])){case"string":r=D(u.v=i,r);break;case"number":r=B(u.v=i,r);break;case"object":r=e(i,r,0,u);break;default:r=i(r,u.v,gn,u)}return r}function i(n,u,e,i){for(var o,c,f=n.length,a=Array(f),v=0;v<f;++v)switch(a[v]=e,typeof(o=n[v])){case"string":e=D(o,e);break;case"number":e=B(o,e);break;default:e=t(v,n)(e,n[v-1],yn,u||r.always(i)),f=v}for(f===n.length&&(e=u?u(e,n[f-1]):i);0<=--f;)e=r.isString(c=n[f])?L(c,e,a[f]):J(c,e,a[f]);return e}function o(n,t,u,e,i){var o=u.of;return o?o(n):u.map(r.always(n),e(i,t))}function c(n,r){return 1<arguments.length?$(n,r):function(r){return $(n,r)}}function f(n,r,t,u){var e=pn(n)?n.length:0;return t.map(function(r){return J(e,r,n)},u(void 0,e))}function a(n){var r=arguments.length>1?arguments[1]:{hint:0};return function(t,u,e,i){var o=pn(t)?t:"",c=r.hint=function(n,r,t){var u=n.hint,e=t.length;e<=u&&(u=e-1),u<0&&(u=0);for(var i=u-1;0<=i&&u<e;++u,--i){if(r(t[u],u,n))return u;if(r(t[i],i,n))return i}for(;u<e;++u)if(r(t[u],u,n))return u;for(;0<=i;--i)if(r(t[i],i,n))return i;return e}(r,n,o);return e.map(function(n){return J(c,n,o)},i(o[c],c))}}function v(){for(var n,r=arguments.length,t={},u=0;u<r;++u)t[n=arguments[u]]=n;return _r(t)}function d(n,r){return 1<arguments.length?F(n,r,void 0):function(r){return F(n,r,void 0)}}var s=r.curry(function(n,r){return r instanceof n}),l=Object.create,h=r.freeze(function(n){return r.assign(l(null),0)}()),p=function(n,r,t,u){return void 0!==u?Math.min(Math.max(n,u<0?r+u:u),r):t},y=function(n){return function(r){return[r,n]}},g=function(n){return function(r){return void 0!==r?r:n}},m=g(0),b=function(n){return void 0!==n?!n:n},A=function(n){return void 0!==n?[n]:n},j=function(n,r){return function(t){return n(t)?r(t):void 0}},O=function(n){return!(n instanceof Object)||r.isArray(n)},w=r.id(function(n){if(pn(n)){for(var r=n.length,t=Array(r),u=0;r;)t[u++]=n[--r];return t}}),x=r.id(function(n,r){for(var t,u=r.length,e=Array(u),i=0,o=0;o<u;++o)void 0!==(t=n(r[o],o))&&(e[i++]=t);return i<u&&(e.length=i),e}),U=function(n,r){return pn(r)?x(n,r):void 0},k=r.id(function(n,r,t,u,e){for(;u<e;)n[r++]=t[u++];return n}),I={map:r.sndU,of:function(){},ap:function(n,r){return void 0!==n?n:r}},S=function(n,t){return{map:r.sndU,ap:n,of:r.always(t)}},E=S(function(n,r){return n+r},0),R=function(n){return r.curry(function(r,t,u){var e=void 0,i=void 0;return q(I,function(t,u){var o=r(t,u);void 0===o||void 0!==i&&!n(o,i)||(e=t,i=o)},t,u),e})},q=function(n,r,t,u){return mn(t)(u,void 0,n,r)},M=function(n,t){return r.curryN(4,function(r,u){return u=t(u),function(t,e){return n(q(u,r,t,e))}})},C=function(n){return function(r){return void 0!==r?[r,n]:n}},N=r.id(function(n){for(var r=[];C!==n;)r.push(n[0]),n=n[1];return r.reverse()}),z=function(n,r){return function(t){return function(u,e,i,o){return i.map(function(n){return r(t,n,u)},o(n(t,u),t))}}},D=function(n,r){return r instanceof Object?r[n]:void 0},L=r.id(function(n,t,u){return void 0!==t?r.assocPartialU(n,t,u):r.dissocPartialU(n,u)||r.object0}),P=z(D,L),B=function(n,r){return pn(r)?r[n]:void 0},J=r.id(function(n,r,t){pn(t)||(t="");var u=t.length;if(void 0!==r){for(var e=Math.max(n+1,u),i=Array(e),o=0;o<e;++o)i[o]=t[o];return i[n]=r,i}if(u<=n)return k(Array(u),0,t,0,u);for(var c=Array(u-1),f=0;f<n;++f)c[f]=t[f];for(var a=n+1;a<u;++a)c[a-1]=t[a];return c}),W=z(B,J),_=function(n,r){return function(t,u){return u=r(t,u),function(r,e){return n(r,e,t,u)}}},F=r.id(function(n,t,u){switch(typeof n){case"string":return L(n,t,u);case"number":return J(n,t,u);case"object":return i(n,0,u,t);default:return 4===n.length?n(u,void 0,yn,r.always(t)):u}}),T=r.id(function(n,r,t){switch(typeof n){case"string":return L(n,r(D(n,t),n),t);case"number":return J(n,r(B(n,t),n),t);case"object":return i(n,r,t);default:return 4===n.length?n(t,void 0,yn,r):(r(n(t,void 0),void 0),t)}}),$=r.id(function(n,t){switch(typeof n){case"string":return D(n,t);case"number":return B(n,t);case"object":for(var i,o=0,c=n.length;o<c;++o)switch(typeof(i=n[o])){case"string":t=D(i,t);break;case"number":t=B(i,t);break;default:return e(n,t,o,u(n[o-1]))}return t;default:return n(t,void 0,gn,r.id)}}),G=function(n,r){return function(t,u,e,i){return e.map(function(n){return r(n,t,u)},i(n(t,u),u))}},H=function(n,r){return function(t,u,e,i){return e.map(r,i(n(t),u))}},K=r.id(function(n,t){var u=void 0;for(var e in n){var i=n[e],o=r.isObject(i)?K(i,t):$(i,t);void 0!==o&&(u||(u={}),u[e]=o)}return u}),Q=r.id(function(n,t,u){for(var e in n){var i=t&&t[e],o=n[e];u=r.isObject(o)?Q(o,i,u):F(o,i,u)}return u}),V=function(n){return r.constructorOf(n)!==Object?r.toObject(n):n},X=function(n,r,t,u){return u(n,r)},Y=r.id(function(n){return function(r){for(var t={},u=n.length;u--;){var e=r[0];void 0!==e&&(t[n[u]]=e),r=r[1]}return t}}),Z=function(n,t){return function(u,e,i,o){var c=u instanceof Object?V(u):r.object0;if(yn===i){var f=void 0,a={};for(var v in t){f=1;var d=t[v](c[v],v,i,o);void 0!==d&&(a[v]=d)}var s=f;for(var l in c)if(void 0===(s&&t[l])){f=1;var h=n(c[l],l,i,o);void 0!==h&&(a[l]=h)}return f?a:u}if(I!==i){var p=i.map,g=i.ap,m=i.of,b=m(y),A=[];for(var j in t)A.push(j),b=g(p(y,b),t[j](c[j],j,i,o));var O=!!A.length||void 0;for(var w in c)void 0===(O&&t[w])&&(A.push(w),b=g(p(y,b),n(c[w],w,i,o)));return A.length?p(Y(A),b):m(u)}for(var x in t){var U=t[x](c[x],x,i,o);if(void 0!==U)return U}for(var k in c)if(void 0===t[k]){var S=n(c[k],k,i,o);if(void 0!==S)return S}}},nn=function(n,t,u){return r.acyclicEqualsU(u,n)?t:u},rn=r.id(function(n,r,t,u){for(var e,i=0,o=r.length;i<o;++i)(n(e=r[i],i)?t:u).push(e)}),tn=function(n){return n[0]},un=function(n){return n.index},en=r.id(function(n,r){var t=r.lastIndex;r.lastIndex=un(n)+n[0].length;var u=r.exec(n.input);return r.lastIndex=t,u&&u[0]&&u}),on=function(n){return function(r){return function(t){return[n,t,r]}}},cn=H(j(s(Object),r.id(function(n){n=V(n);var r=[];for(var t in n)r.push([t,n[t]]);return r})),j(r.isArray,r.id(function(n){for(var r={},t=0,u=n.length;t<u;++t){var e=n[t];2===e.length&&(r[e[0]]=e[1])}return r}))),fn=function(n,r,t){return function(u,e,i,o){return(n(u,e)?r:t)(u,e,i,o)}},an=function(n,r){return r=mn(r),n=mn(n),function(t,u,e,i){return(vr(r,t)?r:n)(t,u,e,i)}},vn=function(n,t,u,e){return u===yn?x(e,n):u===I?function(n,r){for(var t=0,u=r.length;t<u;++t){var e=n(r[t],t);if(void 0!==e)return e}}(e,n):function(n,t,u){var e=n.map,i=n.ap,o=n.of(C),c=u.length;if(e===r.sndU){for(var f=0;f<c;++f)o=i(o,t(u[f],f));return o}for(var a=0;a<c;++a)o=i(e(C,o),t(u[a],a));return e(N,o)}(u,e,n)},dn=function(n,r){return function(t,u,e,i){return e.chain(function(n){return r(n,u,e,i)},n(t,u,e,i))}},sn=function(n,r){return[r,Br(n)]},ln=r.always(o),hn=function(n,r,t){return function(u,e){return n(u,e)?r:t(u,e)}},pn=function(n){return n instanceof Object&&(n=n.length)===n>>0&&0<=n||r.isString(n)},yn=r.id({map:r.applyU,of:r.id,ap:r.applyU,chain:r.applyU}),gn=r.id({map:r.sndU}),mn=r.id(function(n){switch(typeof n){case"string":return P(n);case"number":return W(n);case"object":return t(0,n);default:return 4===n.length?n:(u=n,function(n,t,e,i){return e.map(r.always(n),i(u(n,t),t))})}var u}),bn=r.curry(function(n,r,t){return F([n,Wr(r)],r,t)}),An=r.curry(T),jn=r.curry(function(n,r){return F(n,void 0,r)}),On=r.curry(F),wn=r.curry(function(n,t){return T(n,r.id,t)}),xn=r.curry(q),Un=function(n){return function(r,t,u,e){return mn(n(r,t))(r,t,u,e)}},kn=r.id(function(){for(var n=arguments.length,r=Nn;n--;){var t=arguments[n];r=t.length<2?mn(t[0]):fn(t[0],mn(t[1]),r)}return r}),In=r.id(function(n){n=mn(n);for(var t=ln,u=arguments.length;--u;){var e=arguments[u];t=1===e.length?r.always(mn(e[0])):hn(e[0],mn(e[1]),t)}return function(r,u,e,i){return n(r,u,gn,t)(r,u,e,i)}}),Sn=r.curry(function(n,r,t){return fn(n,mn(r),mn(t))}),En=r.id(function(n,r){for(var t=arguments.length,u=1&t?mn(arguments[--t]):Nn;0<=(t-=2);)u=fn(arguments[t],mn(arguments[t+1]),u);return u}),Rn=r.curry(an),qn=r.curry(function(n,r){return[r,Un(function(r,t){return void 0!==r?n(r,t):Nn})]}),Mn=function(n){return fn(n,X,o)},Cn=Mn(r.isDefined),Nn=function(n,r,t,u){return o(n,r,t,u)},zn=function(n){return function(r,t,u,e){return o(n,t,u,e,n)}},Dn=zn(),Ln=r.id(function(){var n=arguments.length,r=Nn;if(n)for(r=mn(arguments[--n]);n;)r=dn(mn(arguments[--n]),r);return r}),Pn=r.id(r.curryN(2,function(n){return n=mn(n),function(t){return function n(t,u){var e=l(null);for(var i in u){var o=u[i];e[i]=r.isObject(o)?n(t,o):mn(o)}return Z(t,e)}(n,t)}})),Bn=Pn(Nn),Jn=r.id(function(n,r,t,u){return pn(n)?vn(n,0,t,u):t.of(n)}),Wn=mn([cn,Jn]),_n=mn([cn,Jn,0]),Fn=r.id(function(n){return function(t,u,e,i){if(r.isString(t)){var c=e.map;if(n.global){var f=[""];return f.input=t,f.index=0,I===e?function(n,r,t){for(;t=en(t,r);){var u=n(tn(t),un(t));if(void 0!==u)return u}}(i,n,f):c((v=t,function(n){for(var r="",t=0,u=function(n){for(var r=[];on!==n;)r.push(n[0],n[1]),n=n[2];return r}(n),e=u.length-2;-2!==e;e+=-2){var i=u[e],o=un(i);r+=v.slice(t,o);var c=u[e+1];void 0!==c&&(r+=c),t=o+i[0].length}return r+v.slice(t)}),function(n,r,t,u,e,i){for(var o=t(on);i=en(i,e);)o=r(r(n(on,t(i)),o),u(tn(i),un(i)));return o}(c,e.ap,e.of,i,n,f))}var a=t.match(n);if(a)return c(function(r){return t.replace(n,void 0!==r?r:"")},i(a[0],un(a)))}var v;return o(t,void 0,e,i)}}),Tn=r.id(Z(X,h)),$n=r.id(function(n,t,u,e){return r.isArray(n)?vn(n,0,u,e):r.isObject(n)?Tn(n,t,u,e):u.of(n)}),Gn=r.id(function(n,t,u,e){return function n(t,i){return r.isArray(t)?vn(t,0,u,n):void 0!==t?e(t,i):u.of(t)}(n,t)}),Hn=function(n){return function(r,t,u,e){return function r(t,i){return n(t,i)?e(t,i):$n(t,i,u,r)}(r,t)}},Kn=Hn(function(n){return void 0!==n&&!r.isArray(n)&&!r.isObject(n)}),Qn=r.curry(function(n,r,t){return!q(I,function(r,t){if(!n(r,t))return!0},r,t)}),Vn=Qn(r.id),Xn=r.curry(function(n,r,t){return!!q(I,function(r,t){if(n(r,t))return!0},r,t)}),Yn=r.curry(function(n,r,t){var u=[];return q(I,function(r,t){var e=n(r,t);void 0!==e&&u.push(e)},r,t),u}),Zn=Yn(r.id),nr=M(r.id,function(n){return S(n.concat,n.empty())}),rr=nr(r.id),tr=r.curry(function(n,r,t){return q(E,function(r,t){return n(r,t)?1:0},r,t)}),ur=tr(r.isDefined),er=r.curry(function(n,r,t){var u=new Map;return q(I,function(r,t){var e=n(r,t),i=u.get(e);u.set(e,void 0!==i?i+1:1)},r,t),u}),ir=er(r.id),or=r.curry(function(n,r,t,u){return q(I,function(t,u){r=n(r,t,u)},t,u),r}),cr=r.curry(function(n,r,t,u){var e=[],i=[];q(I,function(n,r){i.push(n),e.push(r)},t,u);for(var o=i.length-1;0<=o;--o)r=n(r,i[o],e[o]);return r}),fr=r.curry(function(n,r,t){return q(I,function(r,t){n(r,t)},r,t)}),ar=r.curry(function(n,r,t,u){var e=n();return q(I,function(n,t){r(e,n,t)},t,u),e}),vr=r.curry(function(n,t){return void 0!==q(I,r.id,n,t)}),dr=r.curry(function(n,t){return!q(I,r.always(!0),n,t)}),sr=M(function(n){return void 0!==n?String(n):""},r.id(function(n){return S(function(r,t){return void 0!==r?void 0!==t?r+n+t:r:t})})),lr=sr(r.id),hr=R(function(n,r){return n>r}),pr=hr(r.id),yr=r.curry(function(n,r,t){var u=0,e=0;return q(I,function(r,t){var i=n(r,t);void 0!==i&&(e+=1,u+=i)},r,t),u/e}),gr=yr(r.id),mr=R(function(n,r){return n<r}),br=mr(r.id),Ar=r.curry(function(n,r,t){return!q(I,function(r,t){if(n(r,t))return!0},r,t)}),jr=Xn(r.id),Or=xn(S(function(n,r){return n*r},1)),wr=Or(g(1)),xr=xn(I),Ur=xr(r.id),kr=xn(E),Ir=kr(m),Sr=r.curry(G),Er=Sr(r.id),Rr=r.curry(function(n,r){return G(n(r),On(r))}),qr=r.id(function(n){var r=g(n);return function(t,u,e,i){return e.map(r,i(void 0!==t?t:n,u))}}),Mr=r.id(function(n){return Fr(n,void 0)}),Cr=function(n){return function(r,t,u,e){return e(void 0!==r?n(r,t):r,t)}},Nr=function(n){return function(r,t,u,e){return u.map(function(r){return void 0!==r?n(r,t):r},e(r,t))}},zr=r.id(function(n){return function(t,u,e,i){var o=void 0,c=r.array0;return pn(t)&&rn(n,t,o=[],c=[]),e.map(function(n){var r=n?n.length:0,t=c.length,u=r+t;return u===t?c:k(k(Array(u),0,n,0,r),r,c,0,t)},i(o,u))}}),Dr=r.id,Lr=Un(function(n){return pn(n)&&n.length?n.length-1:0}),Pr=r.curry(function(n,r){return function(t,u,e,i){var o=pn(t),c=o&&t.length,f=p(0,c,0,n),a=p(f,c,c,r);return e.map(function(n){var r=n?n.length:0,u=f+r;return k(k(k(Array(c-a+u),0,t,0,f),f,n,0,r),u,t,a,c)},i(o?k(Array(Math.max(0,a-f)),0,t,f,a):void 0,u))}}),Br=function(n){return r.isObject(n)?_r(An(Tn,sn,n)):n},Jr=r.id,Wr=function(n){return v.apply(null,r.keys(n))},_r=r.id(function(n){return function(r,t,u,e){return u.map(function(t){return Q(n,t,r)},e(K(n,r),t))}}),Fr=r.curry(function(n,r){function t(t){return nn(r,n,t)}return function(u,e,i,o){return i.map(t,o(nn(n,r,u),e))}}),Tr=r.curry(H),$r=H(b,b),Gr=H(j(pn,r.id(function(n){for(var r=n.length,t=Array(r),u=0;u<r;++u)t[u]=[u,n[u]];return t})),j(r.isArray,r.id(function(n){for(var r=n.length,t=Array(r),u=0;u<r;++u){var e=n[u];2===e.length&&(t[e[0]]=e[1])}r=t.length;for(var i=0,o=0;o<r;++o){var c=t[o];void 0!==c&&(o!==i&&(t[i]=c),++i)}return t.length=i,t}))),Hr=H(w,w),Kr=r.id(function(n,t,u,e){return u.map(A,e((n instanceof Object||r.isString(n))&&1===n.length?n[0]:void 0,t))}),Qr=H(j(r.isString,decodeURI),j(r.isString,encodeURI)),Vr=H(j(r.isString,decodeURIComponent),j(r.isString,encodeURIComponent)),Xr=r.id(function(n){var t=n||r.object0,u=t.reviver,e=t.replacer,i=t.space;return H(j(r.isString,function(n){return JSON.parse(n,u)}),j(r.isDefined,function(n){return JSON.stringify(n,e,i)}))});n.seemsArrayLike=pn,n.Identity=yn,n.Constant=gn,n.toFunction=mn,n.assign=bn,n.modify=An,n.remove=jn,n.set=On,n.transform=wn,n.traverse=xn,n.compose=function(){var n=arguments.length;if(n<2)return n?arguments[0]:X;for(var r=Array(n);n--;)r[n]=arguments[n];return r},n.flat=function(){for(var n=[Gn],r=0,t=arguments.length;r<t;++r)n.push(arguments[r],Gn);return n},n.lazy=function(n){function r(n,r,u,e){return t(n,r,u,e)}var t=function(u,e,i,o){return(t=mn(n(r)))(u,e,i,o)};return r},n.choices=function(n){for(var r=arguments.length,t=Array(r>1?r-1:0),u=1;u<r;u++)t[u-1]=arguments[u];return t.length?an(t.reduceRight(an),n):n},n.choose=Un,n.cond=kn,n.condOf=In,n.ifElse=Sn,n.iftes=En,n.orElse=Rn,n.chain=qn,n.choice=function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return r.reduceRight(an,Nn)},n.unless=function(n){return fn(n,o,X)},n.when=Mn,n.optional=Cn,n.zero=Nn,n.assignOp=function(n){return[Wr(n),zn(n)]},n.modifyOp=function(n){return function(r,t,u,e){return o(r=n(r,t),t,u,e,r)}},n.setOp=zn,n.removeOp=Dn,n.log=function(){var n=arguments,t=r.curry(function(r,t){return console.log.apply(console,k([],0,n,0,n.length).concat([r,t])),t});return H(t("get"),t("set"))},n.seq=Ln,n.branchOr=Pn,n.branch=Bn,n.branches=function(){for(var n=arguments.length,r={},t=0;t<n;++t)r[arguments[t]]=X;return Bn(r)},n.elems=Jn,n.entries=Wn,n.keys=_n,n.matches=Fn,n.values=Tn,n.children=$n,n.flatten=Gn,n.query=function(){for(var n=[],r=0,t=arguments.length;r<t;++r){var u=mn(arguments[r]);n.push(Hn(vr(u)),u)}return n},n.satisfying=Hn,n.leafs=Kn,n.all=Qn,n.and=Vn,n.any=Xn,n.collectAs=Yn,n.collect=Zn,n.concatAs=nr,n.concat=rr,n.countIf=tr,n.count=ur,n.countsAs=er,n.counts=ir,n.foldl=or,n.foldr=cr,n.forEach=fr,n.forEachWith=ar,n.isDefined=vr,n.isEmpty=dr,n.joinAs=sr,n.join=lr,n.maximumBy=hr,n.maximum=pr,n.meanAs=yr,n.mean=gr,n.minimumBy=mr,n.minimum=br,n.none=Ar,n.or=jr,n.productAs=Or,n.product=wr,n.selectAs=xr,n.select=Ur,n.sumAs=kr,n.sum=Ir,n.get=c,n.lens=Sr,n.setter=Er,n.foldTraversalLens=Rr,n.defaults=function(n){function r(r){return nn(n,void 0,r)}return function(t,u,e,i){return e.map(r,i(void 0!==t?t:n,u))}},n.define=qr,n.normalize=function(n){return[Cr(n),Nr(n)]},n.required=Mr,n.reread=Cr,n.rewrite=Nr,n.append=f,n.filter=zr,n.find=a,n.findWith=function(n){var r=mn(n),t=vr(r);return[arguments.length>1?a(t,arguments[1]):a(t),r]},n.first=0,n.index=Dr,n.last=Lr,n.prefix=function(n){return Pr(0,n)},n.slice=Pr,n.suffix=function(n){return Pr(0===n?1/0:n?-n:0,void 0)},n.pickIn=Br,n.prop=Jr,n.props=v,n.propsOf=Wr,n.removable=function(){function n(n){if(!(n instanceof Object))return n;for(var t=0,e=u.length;t<e;++t)if(r.hasU(u[t],n))return n}for(var t=arguments.length,u=Array(t),e=0;e<t;e++)u[e]=arguments[e];return function(r,t,u,e){return u.map(n,e(r,t))}},n.valueOr=function(n){return function(r,t,u,e){return e(null!=r?r:n,t)}},n.pick=_r,n.replace=Fr,n.getInverse=d,n.iso=Tr,n.array=function(n){var r=d(n),t=c(n),u=function(n){return U(r,n)};return function(n,r,e,i){return e.map(u,i(U(t,n),r))}},n.inverse=function(n){return function(r,t,u,e){return u.map(function(r){return $(n,r)},e(F(n,r,void 0),t))}},n.complement=$r,n.identity=X,n.indexed=Gr,n.is=function(n){return H(function(t){return r.acyclicEqualsU(n,t)},function(r){return!0===r?n:void 0})},n.keyed=cn,n.reverse=Hr,n.singleton=Kr,n.uri=Qr,n.uriComponent=Vr,n.json=Xr,n.pointer=function(n){"#"===n[0]&&(n=decodeURIComponent(n));for(var r=n.split("/"),t=r.length,u=1;u<t;++u){var e=r[u];r[u-1]=/^(0|[1-9]\d*)$/.test(e)?Sn(O,Number(e),e):"-"===e?Sn(O,f,e):e.replace("~1","/").replace("~0","~")}return r.length=t-1,r},Object.defineProperty(n,"__esModule",{value:!0})}); | ||
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("infestines")):"function"==typeof define&&define.amd?define(["exports","infestines"],r):r(n.L={},n.I)}(this,function(n,r){"use strict";function t(n,r){var t=r.length-n;if(t<2)return t?mn(r[n]):X;for(var u=mn(r[n+--t]),e=function(n,r){return function(t,e){return u(t,e,n,r)}};--t;)e=_(mn(r[n+t]),e);var i=mn(r[n]);return function(n,r,t,u){return i(n,r,t,e(t,u))}}function u(n){var r=function n(r,t){return n.v=t,r};return r.v=n,r}function e(n,r,t,u){for(var i,o=n.length;t<o;++t)switch(typeof(i=n[t])){case"string":r=D(u.v=i,r);break;case"number":r=B(u.v=i,r);break;case"object":r=e(i,r,0,u);break;default:r=i(r,u.v,gn,u)}return r}function i(n,u,e,i){for(var o,c,f=n.length,a=Array(f),v=0;v<f;++v)switch(a[v]=e,typeof(o=n[v])){case"string":e=D(o,e);break;case"number":e=B(o,e);break;default:e=t(v,n)(e,n[v-1],yn,u||r.always(i)),f=v}for(f===n.length&&(e=u?u(e,n[f-1]):i);0<=--f;)e=r.isString(c=n[f])?L(c,e,a[f]):J(c,e,a[f]);return e}function o(n,t,u,e,i){var o=u.of;return o?o(n):u.map(r.always(n),e(i,t))}function c(n,r){return 1<arguments.length?$(n,r):function(r){return $(n,r)}}function f(n,r,t,u){var e=pn(n)?n.length:0;return t.map(function(r){return J(e,r,n)},u(void 0,e))}function a(n){var r=arguments.length>1?arguments[1]:{hint:0};return function(t,u,e,i){var o=pn(t)?t:"",c=r.hint=function(n,r,t){var u=n.hint,e=t.length;e<=u&&(u=e-1),u<0&&(u=0);for(var i=u-1;0<=i&&u<e;++u,--i){if(r(t[u],u,n))return u;if(r(t[i],i,n))return i}for(;u<e;++u)if(r(t[u],u,n))return u;for(;0<=i;--i)if(r(t[i],i,n))return i;return e}(r,n,o);return e.map(function(n){return J(c,n,o)},i(o[c],c))}}function v(){for(var n,r=arguments.length,t={},u=0;u<r;++u)t[n=arguments[u]]=n;return Fr(t)}function d(n,r){return 1<arguments.length?F(n,r,void 0):function(r){return F(n,r,void 0)}}var s=r.curry(function(n,r){return r instanceof n}),l=Object.create,h=r.freeze(function(n){return r.assign(l(null),n)}(r.object0)),p=function(n,r,t,u){return void 0!==u?Math.min(Math.max(n,u<0?r+u:u),r):t},y=function(n){return function(r){return[r,n]}},g=function(n){return function(r){return void 0!==r?r:n}},m=g(0),b=function(n){return void 0!==n?!n:n},j=function(n){return void 0!==n?[n]:n},A=function(n,r){return function(t){return n(t)?r(t):void 0}},O=function(n){return!(n instanceof Object)||r.isArray(n)},w=r.id(function(n){if(pn(n)){for(var r=n.length,t=Array(r),u=0;r;)t[u++]=n[--r];return t}}),x=r.id(function(n,r){for(var t,u=r.length,e=Array(u),i=0,o=0;o<u;++o)void 0!==(t=n(r[o],o))&&(e[i++]=t);return i<u&&(e.length=i),e}),U=function(n,r){return pn(r)?x(n,r):void 0},k=r.id(function(n,r,t,u,e){for(;u<e;)n[r++]=t[u++];return n}),I={map:r.sndU,of:function(){},ap:function(n,r){return void 0!==n?n:r}},S=function(n,t){return{map:r.sndU,ap:n,of:r.always(t)}},E=S(function(n,r){return n+r},0),R=function(n){return r.curry(function(r,t,u){var e=void 0,i=void 0;return q(I,function(t,u){var o=r(t,u);void 0===o||void 0!==i&&!n(o,i)||(e=t,i=o)},t,u),e})},q=function(n,r,t,u){return mn(t)(u,void 0,n,r)},M=function(n,t){return r.curryN(4,function(r,u){return u=t(u),function(t,e){return n(q(u,r,t,e))}})},C=function(n){return function(r){return void 0!==r?[r,n]:n}},N=r.id(function(n){for(var r=[];C!==n;)r.push(n[0]),n=n[1];return r.reverse()}),z=function(n,r){return function(t){return function(u,e,i,o){return i.map(function(n){return r(t,n,u)},o(n(t,u),t))}}},D=function(n,r){return r instanceof Object?r[n]:void 0},L=r.id(function(n,t,u){return void 0!==t?r.assocPartialU(n,t,u):r.dissocPartialU(n,u)||r.object0}),P=z(D,L),B=function(n,r){return pn(r)?r[n]:void 0},J=r.id(function(n,r,t){pn(t)||(t="");var u=t.length;if(void 0!==r){for(var e=Math.max(n+1,u),i=Array(e),o=0;o<e;++o)i[o]=t[o];return i[n]=r,i}if(u<=n)return k(Array(u),0,t,0,u);for(var c=Array(u-1),f=0;f<n;++f)c[f]=t[f];for(var a=n+1;a<u;++a)c[a-1]=t[a];return c}),W=z(B,J),_=function(n,r){return function(t,u){return u=r(t,u),function(r,e){return n(r,e,t,u)}}},F=r.id(function(n,t,u){switch(typeof n){case"string":return L(n,t,u);case"number":return J(n,t,u);case"object":return i(n,0,u,t);default:return 4===n.length?n(u,void 0,yn,r.always(t)):u}}),T=r.id(function(n,r,t){switch(typeof n){case"string":return L(n,r(D(n,t),n),t);case"number":return J(n,r(B(n,t),n),t);case"object":return i(n,r,t);default:return 4===n.length?n(t,void 0,yn,r):(r(n(t,void 0),void 0),t)}}),$=r.id(function(n,t){switch(typeof n){case"string":return D(n,t);case"number":return B(n,t);case"object":for(var i,o=0,c=n.length;o<c;++o)switch(typeof(i=n[o])){case"string":t=D(i,t);break;case"number":t=B(i,t);break;default:return e(n,t,o,u(n[o-1]))}return t;default:return n(t,void 0,gn,r.id)}}),G=function(n,r){return function(t,u,e,i){return e.map(function(n){return r(n,t,u)},i(n(t,u),u))}},H=function(n,r){return function(t,u,e,i){return e.map(r,i(n(t),u))}},K=r.id(function(n,t){var u=void 0;for(var e in n){var i=n[e],o=r.isObject(i)?K(i,t):$(i,t);void 0!==o&&(u||(u={}),u[e]=o)}return u}),Q=r.id(function(n,t,u){for(var e in n){var i=t&&t[e],o=n[e];u=r.isObject(o)?Q(o,i,u):F(o,i,u)}return u}),V=function(n){return r.constructorOf(n)!==Object?r.toObject(n):n},X=function(n,r,t,u){return u(n,r)},Y=r.id(function(n){return function(r){for(var t={},u=n.length;u--;){var e=r[0];void 0!==e&&(t[n[u]]=e),r=r[1]}return t}}),Z=function(n,t){return function(u,e,i,o){var c=u instanceof Object?V(u):r.object0;if(yn===i){var f=void 0,a={};for(var v in t){f=1;var d=t[v](c[v],v,i,o);void 0!==d&&(a[v]=d)}var s=f;for(var l in c)if(void 0===(s&&t[l])){f=1;var h=n(c[l],l,i,o);void 0!==h&&(a[l]=h)}return f?a:u}if(I!==i){var p=i.map,g=i.ap,m=i.of,b=m(y),j=[];for(var A in t)j.push(A),b=g(p(y,b),t[A](c[A],A,i,o));var O=!!j.length||void 0;for(var w in c)void 0===(O&&t[w])&&(j.push(w),b=g(p(y,b),n(c[w],w,i,o)));return j.length?p(Y(j),b):m(u)}for(var x in t){var U=t[x](c[x],x,i,o);if(void 0!==U)return U}for(var k in c)if(void 0===t[k]){var S=n(c[k],k,i,o);if(void 0!==S)return S}}},nn=function(n,t,u){return r.acyclicEqualsU(u,n)?t:u},rn=r.id(function(n,r,t,u){for(var e,i=0,o=r.length;i<o;++i)(n(e=r[i],i)?t:u).push(e)}),tn=function(n){return n[0]},un=function(n){return n.index},en=r.id(function(n,r){var t=r.lastIndex;r.lastIndex=un(n)+n[0].length;var u=r.exec(n.input);return r.lastIndex=t,u&&u[0]&&u}),on=function(n){return function(r){return function(t){return[n,t,r]}}},cn=H(A(s(Object),r.id(function(n){n=V(n);var r=[];for(var t in n)r.push([t,n[t]]);return r})),A(r.isArray,r.id(function(n){for(var r={},t=0,u=n.length;t<u;++t){var e=n[t];2===e.length&&(r[e[0]]=e[1])}return r}))),fn=function(n,r){return function(t){return function(u,e,i,o){return(t(u,e)?n:r)(u,e,i,o)}}},an=function(n,r){return r=mn(r),n=mn(n),function(t,u,e,i){return(dr(r,t)?r:n)(t,u,e,i)}},vn=function(n,t,u,e){return u===yn?x(e,n):u===I?function(n,r){for(var t=0,u=r.length;t<u;++t){var e=n(r[t],t);if(void 0!==e)return e}}(e,n):function(n,t,u){var e=n.map,i=n.ap,o=n.of(C),c=u.length;if(e===r.sndU){for(var f=0;f<c;++f)o=i(o,t(u[f],f));return o}for(var a=0;a<c;++a)o=i(e(C,o),t(u[a],a));return e(N,o)}(u,e,n)},dn=function(n,r){return function(t,u,e,i){return e.chain(function(n){return r(n,u,e,i)},n(t,u,e,i))}},sn=function(n,r){return[r,Jr(n)]},ln=r.always(o),hn=function(n,r,t){return function(u,e){return n(u,e)?r:t(u,e)}},pn=function(n){return n instanceof Object&&(n=n.length)===n>>0&&0<=n||r.isString(n)},yn=r.id({map:r.applyU,of:r.id,ap:r.applyU,chain:r.applyU}),gn=r.id({map:r.sndU}),mn=r.id(function(n){switch(typeof n){case"string":return P(n);case"number":return W(n);case"object":return t(0,n);default:return 4===n.length?n:(u=n,function(n,t,e,i){return e.map(r.always(n),i(u(n,t),t))})}var u}),bn=r.curry(function(n,r,t){return F([n,_r(r)],r,t)}),jn=r.curry(T),An=r.curry(function(n,r){return F(n,void 0,r)}),On=r.curry(F),wn=r.curry(function(n,t){return T(n,r.id,t)}),xn=r.curry(q),Un=function(n){return function(r,t,u,e){return mn(n(r,t))(r,t,u,e)}},kn=r.id(function(){for(var n=arguments.length,r=zn;n--;){var t=arguments[n];r=t.length<2?mn(t[0]):fn(mn(t[1]),r)(t[0])}return r}),In=r.id(function(n){n=mn(n);for(var t=ln,u=arguments.length;--u;){var e=arguments[u];t=1===e.length?r.always(mn(e[0])):hn(e[0],mn(e[1]),t)}return function(r,u,e,i){return n(r,u,gn,t)(r,u,e,i)}}),Sn=r.curry(function(n,r,t){return fn(mn(r),mn(t))(n)}),En=r.id(function(n,r){for(var t=arguments.length,u=1&t?mn(arguments[--t]):zn;0<=(t-=2);)u=fn(mn(arguments[t+1]),u)(arguments[t]);return u}),Rn=r.curry(an),qn=r.curry(function(n,r){return[r,Un(function(r,t){return void 0!==r?n(r,t):zn})]}),Mn=fn(o,X),Cn=fn(X,o),Nn=Cn(r.isDefined),zn=function(n,r,t,u){return o(n,r,t,u)},Dn=function(n){return function(r,t,u,e){return o(n,t,u,e,n)}},Ln=Dn(),Pn=r.id(function(){var n=arguments.length,r=zn;if(n)for(r=mn(arguments[--n]);n;)r=dn(mn(arguments[--n]),r);return r}),Bn=r.id(r.curryN(2,function(n){return n=mn(n),function(t){return function n(t,u){var e=l(null);for(var i in u){var o=u[i];e[i]=r.isObject(o)?n(t,o):mn(o)}return Z(t,e)}(n,t)}})),Jn=Bn(zn),Wn=r.id(function(n,r,t,u){return pn(n)?vn(n,0,t,u):t.of(n)}),_n=mn([cn,Wn]),Fn=mn([cn,Wn,0]),Tn=r.id(function(n){return function(t,u,e,i){if(r.isString(t)){var c=e.map;if(n.global){var f=[""];return f.input=t,f.index=0,I===e?function(n,r,t){for(;t=en(t,r);){var u=n(tn(t),un(t));if(void 0!==u)return u}}(i,n,f):c((v=t,function(n){for(var r="",t=0,u=function(n){for(var r=[];on!==n;)r.push(n[0],n[1]),n=n[2];return r}(n),e=u.length-2;-2!==e;e+=-2){var i=u[e],o=un(i);r+=v.slice(t,o);var c=u[e+1];void 0!==c&&(r+=c),t=o+i[0].length}return r+v.slice(t)}),function(n,r,t,u,e,i){for(var o=t(on);i=en(i,e);)o=r(r(n(on,t(i)),o),u(tn(i),un(i)));return o}(c,e.ap,e.of,i,n,f))}var a=t.match(n);if(a)return c(function(r){return t.replace(n,void 0!==r?r:"")},i(a[0],un(a)))}var v;return o(t,void 0,e,i)}}),$n=r.id(Z(X,h)),Gn=r.id(function(n,t,u,e){return r.isArray(n)?vn(n,0,u,e):r.isObject(n)?$n(n,t,u,e):u.of(n)}),Hn=r.id(function(n,t,u,e){return function n(t,i){return r.isArray(t)?vn(t,0,u,n):void 0!==t?e(t,i):u.of(t)}(n,t)}),Kn=function(n){return function(r,t,u,e){return function r(t,i){return n(t,i)?e(t,i):Gn(t,i,u,r)}(r,t)}},Qn=Kn(function(n){return void 0!==n&&!r.isArray(n)&&!r.isObject(n)}),Vn=r.curry(function(n,r,t){return!q(I,function(r,t){if(!n(r,t))return!0},r,t)}),Xn=Vn(r.id),Yn=r.curry(function(n,r,t){return!!q(I,function(r,t){if(n(r,t))return!0},r,t)}),Zn=r.curry(function(n,r,t){var u=[];return q(I,function(r,t){var e=n(r,t);void 0!==e&&u.push(e)},r,t),u}),nr=Zn(r.id),rr=M(r.id,function(n){return S(n.concat,n.empty())}),tr=rr(r.id),ur=r.curry(function(n,r,t){return q(E,function(r,t){return n(r,t)?1:0},r,t)}),er=ur(r.isDefined),ir=r.curry(function(n,r,t){var u=new Map;return q(I,function(r,t){var e=n(r,t),i=u.get(e);u.set(e,void 0!==i?i+1:1)},r,t),u}),or=ir(r.id),cr=r.curry(function(n,r,t,u){return q(I,function(t,u){r=n(r,t,u)},t,u),r}),fr=r.curry(function(n,r,t,u){var e=[],i=[];q(I,function(n,r){i.push(n),e.push(r)},t,u);for(var o=i.length-1;0<=o;--o)r=n(r,i[o],e[o]);return r}),ar=r.curry(function(n,r,t){return q(I,function(r,t){n(r,t)},r,t)}),vr=r.curry(function(n,r,t,u){var e=n();return q(I,function(n,t){r(e,n,t)},t,u),e}),dr=r.curry(function(n,t){return void 0!==q(I,r.id,n,t)}),sr=r.curry(function(n,t){return!q(I,r.always(!0),n,t)}),lr=M(function(n){return void 0!==n?String(n):""},r.id(function(n){return S(function(r,t){return void 0!==r?void 0!==t?r+n+t:r:t})})),hr=lr(r.id),pr=R(function(n,r){return n>r}),yr=pr(r.id),gr=r.curry(function(n,r,t){var u=0,e=0;return q(I,function(r,t){var i=n(r,t);void 0!==i&&(e+=1,u+=i)},r,t),u/e}),mr=gr(r.id),br=R(function(n,r){return n<r}),jr=br(r.id),Ar=r.curry(function(n,r,t){return!q(I,function(r,t){if(n(r,t))return!0},r,t)}),Or=Yn(r.id),wr=xn(S(function(n,r){return n*r},1)),xr=wr(g(1)),Ur=xn(I),kr=Ur(r.id),Ir=xn(E),Sr=Ir(m),Er=r.curry(G),Rr=Er(r.id),qr=r.curry(function(n,r){return G(n(r),On(r))}),Mr=r.id(function(n){var r=g(n);return function(t,u,e,i){return e.map(r,i(void 0!==t?t:n,u))}}),Cr=r.id(function(n){return Tr(n,void 0)}),Nr=function(n){return function(r,t,u,e){return e(void 0!==r?n(r,t):r,t)}},zr=function(n){return function(r,t,u,e){return u.map(function(r){return void 0!==r?n(r,t):r},e(r,t))}},Dr=r.id(function(n){return function(t,u,e,i){var o=void 0,c=r.array0;return pn(t)&&rn(n,t,o=[],c=[]),e.map(function(n){var r=n?n.length:0,t=c.length,u=r+t;return u===t?c:k(k(Array(u),0,n,0,r),r,c,0,t)},i(o,u))}}),Lr=r.id,Pr=Un(function(n){return pn(n)&&n.length?n.length-1:0}),Br=r.curry(function(n,r){return function(t,u,e,i){var o=pn(t),c=o&&t.length,f=p(0,c,0,n),a=p(f,c,c,r);return e.map(function(n){var r=n?n.length:0,u=f+r;return k(k(k(Array(c-a+u),0,t,0,f),f,n,0,r),u,t,a,c)},i(o?k(Array(Math.max(0,a-f)),0,t,f,a):void 0,u))}}),Jr=function(n){return r.isObject(n)?Fr(jn($n,sn,n)):n},Wr=r.id,_r=function(n){return v.apply(null,r.keys(n))},Fr=r.id(function(n){return function(r,t,u,e){return u.map(function(t){return Q(n,t,r)},e(K(n,r),t))}}),Tr=r.curry(function(n,r){function t(t){return nn(r,n,t)}return function(u,e,i,o){return i.map(t,o(nn(n,r,u),e))}}),$r=r.curry(H),Gr=H(b,b),Hr=H(A(pn,r.id(function(n){for(var r=n.length,t=Array(r),u=0;u<r;++u)t[u]=[u,n[u]];return t})),A(r.isArray,r.id(function(n){for(var r=n.length,t=Array(r),u=0;u<r;++u){var e=n[u];2===e.length&&(t[e[0]]=e[1])}r=t.length;for(var i=0,o=0;o<r;++o){var c=t[o];void 0!==c&&(o!==i&&(t[i]=c),++i)}return t.length=i,t}))),Kr=H(w,w),Qr=r.id(function(n,t,u,e){return u.map(j,e((n instanceof Object||r.isString(n))&&1===n.length?n[0]:void 0,t))}),Vr=H(A(r.isString,decodeURI),A(r.isString,encodeURI)),Xr=H(A(r.isString,decodeURIComponent),A(r.isString,encodeURIComponent)),Yr=r.id(function(n){var t=n||r.object0,u=t.reviver,e=t.replacer,i=t.space;return H(A(r.isString,function(n){return JSON.parse(n,u)}),A(r.isDefined,function(n){return JSON.stringify(n,e,i)}))});n.seemsArrayLike=pn,n.Identity=yn,n.Constant=gn,n.toFunction=mn,n.assign=bn,n.modify=jn,n.remove=An,n.set=On,n.transform=wn,n.traverse=xn,n.compose=function(){var n=arguments.length;if(n<2)return n?arguments[0]:X;for(var r=Array(n);n--;)r[n]=arguments[n];return r},n.flat=function(){for(var n=[Hn],r=0,t=arguments.length;r<t;++r)n.push(arguments[r],Hn);return n},n.lazy=function(n){function r(n,r,u,e){return t(n,r,u,e)}var t=function(u,e,i,o){return(t=mn(n(r)))(u,e,i,o)};return r},n.choices=function(n){for(var r=arguments.length,t=Array(r>1?r-1:0),u=1;u<r;u++)t[u-1]=arguments[u];return t.length?an(t.reduceRight(an),n):n},n.choose=Un,n.cond=kn,n.condOf=In,n.ifElse=Sn,n.iftes=En,n.orElse=Rn,n.chain=qn,n.choice=function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return r.reduceRight(an,zn)},n.unless=Mn,n.when=Cn,n.optional=Nn,n.zero=zn,n.assignOp=function(n){return[_r(n),Dn(n)]},n.modifyOp=function(n){return function(r,t,u,e){return o(r=n(r,t),t,u,e,r)}},n.setOp=Dn,n.removeOp=Ln,n.log=function(){var n=arguments,t=r.curry(function(r,t){return console.log.apply(console,k([],0,n,0,n.length).concat([r,t])),t});return H(t("get"),t("set"))},n.seq=Pn,n.branchOr=Bn,n.branch=Jn,n.branches=function(){for(var n=arguments.length,r={},t=0;t<n;++t)r[arguments[t]]=X;return Jn(r)},n.elems=Wn,n.entries=_n,n.keys=Fn,n.matches=Tn,n.values=$n,n.children=Gn,n.flatten=Hn,n.query=function(){for(var n=[],r=0,t=arguments.length;r<t;++r){var u=mn(arguments[r]);n.push(Kn(dr(u)),u)}return n},n.satisfying=Kn,n.leafs=Qn,n.all=Vn,n.and=Xn,n.any=Yn,n.collectAs=Zn,n.collect=nr,n.concatAs=rr,n.concat=tr,n.countIf=ur,n.count=er,n.countsAs=ir,n.counts=or,n.foldl=cr,n.foldr=fr,n.forEach=ar,n.forEachWith=vr,n.isDefined=dr,n.isEmpty=sr,n.joinAs=lr,n.join=hr,n.maximumBy=pr,n.maximum=yr,n.meanAs=gr,n.mean=mr,n.minimumBy=br,n.minimum=jr,n.none=Ar,n.or=Or,n.productAs=wr,n.product=xr,n.selectAs=Ur,n.select=kr,n.sumAs=Ir,n.sum=Sr,n.get=c,n.lens=Er,n.setter=Rr,n.foldTraversalLens=qr,n.defaults=function(n){function r(r){return nn(n,void 0,r)}return function(t,u,e,i){return e.map(r,i(void 0!==t?t:n,u))}},n.define=Mr,n.normalize=function(n){return[Nr(n),zr(n)]},n.required=Cr,n.reread=Nr,n.rewrite=zr,n.append=f,n.filter=Dr,n.find=a,n.findWith=function(n){var r=mn(n),t=dr(r);return[arguments.length>1?a(t,arguments[1]):a(t),r]},n.first=0,n.index=Lr,n.last=Pr,n.prefix=function(n){return Br(0,n)},n.slice=Br,n.suffix=function(n){return Br(0===n?1/0:n?-n:0,void 0)},n.pickIn=Jr,n.prop=Wr,n.props=v,n.propsOf=_r,n.removable=function(){function n(n){if(!(n instanceof Object))return n;for(var t=0,e=u.length;t<e;++t)if(r.hasU(u[t],n))return n}for(var t=arguments.length,u=Array(t),e=0;e<t;e++)u[e]=arguments[e];return function(r,t,u,e){return u.map(n,e(r,t))}},n.valueOr=function(n){return function(r,t,u,e){return e(null!=r?r:n,t)}},n.pick=Fr,n.replace=Tr,n.getInverse=d,n.iso=$r,n.array=function(n){var r=d(n),t=c(n),u=function(n){return U(r,n)};return function(n,r,e,i){return e.map(u,i(U(t,n),r))}},n.inverse=function(n){return function(r,t,u,e){return u.map(function(r){return $(n,r)},e(F(n,r,void 0),t))}},n.complement=Gr,n.identity=X,n.indexed=Hr,n.is=function(n){return H(function(t){return r.acyclicEqualsU(n,t)},function(r){return!0===r?n:void 0})},n.keyed=cn,n.reverse=Kr,n.singleton=Qr,n.uri=Vr,n.uriComponent=Xr,n.json=Yr,n.pointer=function(n){"#"===n[0]&&(n=decodeURIComponent(n));for(var r=n.split("/"),t=r.length,u=1;u<t;++u){var e=r[u];r[u-1]=/^(0|[1-9]\d*)$/.test(e)?Sn(O,Number(e),e):"-"===e?Sn(O,f,e):e.replace("~1","/").replace("~0","~")}return r.length=t-1,r},Object.defineProperty(n,"__esModule",{value:!0})}); |
{ | ||
"name": "partial.lenses", | ||
"version": "13.7.3", | ||
"version": "13.7.4", | ||
"description": "Partial lenses is a comprehensive, high-performance optics library for JavaScript", | ||
@@ -74,17 +74,17 @@ "module": "dist/partial.lenses.es.js", | ||
"codecov": "^3.0.0", | ||
"eslint": "^4.18.1", | ||
"eslint": "^4.19.0", | ||
"klipse-github-docs-generator": "^0.3.2", | ||
"livereload": "^0.7.0", | ||
"mocha": "^5.0.1", | ||
"nyc": "^11.4.1", | ||
"mocha": "^5.0.4", | ||
"nyc": "^11.6.0", | ||
"ramda": "^0.25.0", | ||
"rollup": "^0.56.2", | ||
"rollup": "^0.57.1", | ||
"rollup-plugin-babel": "^3.0.3", | ||
"rollup-plugin-node-resolve": "^3.0.3", | ||
"rollup-plugin-node-resolve": "^3.3.0", | ||
"rollup-plugin-replace": "^2.0.0", | ||
"rollup-plugin-uglify": "^3.0.0", | ||
"sprintf-js": "^1.1.1", | ||
"uglify-js": "^3.3.12", | ||
"uglify-js": "^3.3.16", | ||
"watch-run": "^1.2.5" | ||
} | ||
} |
@@ -12,2 +12,2 @@ import * as I from 'infestines' | ||
export const protoless = o => I.assign(create(null), o) | ||
export const protoless0 = I.freeze(protoless(0)) | ||
export const protoless0 = I.freeze(protoless(I.object0)) |
@@ -700,3 +700,4 @@ import * as I from './ext/infestines' | ||
const ifteU = (c, t, e) => (x, i, C, xi2yC) => (c(x, i) ? t : e)(x, i, C, xi2yC) | ||
const eitherU = (t, e) => c => (x, i, C, xi2yC) => | ||
(c(x, i) ? t : e)(x, i, C, xi2yC) | ||
@@ -839,3 +840,3 @@ const orElseU = (back, prim) => ( | ||
const c = arguments[n] | ||
r = c.length < 2 ? toFunction(c[0]) : ifteU(c[0], toFunction(c[1]), r) | ||
r = c.length < 2 ? toFunction(c[0]) : eitherU(toFunction(c[1]), r)(c[0]) | ||
} | ||
@@ -867,3 +868,3 @@ return r | ||
export const ifElse = I.curry((c, t, e) => | ||
ifteU(c, toFunction(t), toFunction(e)) | ||
eitherU(toFunction(t), toFunction(e))(c) | ||
) | ||
@@ -883,3 +884,4 @@ | ||
let r = n & 1 ? toFunction(arguments[--n]) : zero | ||
while (0 <= (n -= 2)) r = ifteU(arguments[n], toFunction(arguments[n + 1]), r) | ||
while (0 <= (n -= 2)) | ||
r = eitherU(toFunction(arguments[n + 1]), r)(arguments[n]) | ||
return r | ||
@@ -899,5 +901,5 @@ }) | ||
export const unless = p => ifteU(p, zeroOp, identity) | ||
export const unless = eitherU(zeroOp, identity) | ||
export const when = p => ifteU(p, identity, zeroOp) | ||
export const when = eitherU(identity, zeroOp) | ||
@@ -904,0 +906,0 @@ export const optional = when(I.isDefined) |
462658
5993