@kofile/react-form
Advanced tools
Comparing version 0.0.0-development to 0.0.0
@@ -91,3 +91,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
Field.prototype.render = function render() { | ||
var children = this.props.children; | ||
var render = this.props.render; | ||
@@ -101,3 +101,8 @@ | ||
return children(childProps); | ||
if (render.prototype.render) { | ||
// eslint-disable-next-line new-cap | ||
return new render(childProps); | ||
} | ||
return render(childProps); | ||
}; | ||
@@ -111,4 +116,4 @@ | ||
Field.defaultProps = { | ||
validate: function validate() { | ||
return ''; | ||
render: function render() { | ||
return null; | ||
} | ||
@@ -122,6 +127,5 @@ }; | ||
validate: PropTypes.func, | ||
children: PropTypes.func.isRequired | ||
render: PropTypes.func | ||
}; | ||
export default Field; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL21vZHVsZXMvRmllbGQuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiUHJvcFR5cGVzIiwiUiIsImlzRXZlbnQiLCJoYXMiLCJlIiwiZ2V0RXZlbnRWYWx1ZSIsInBhdGgiLCJ2YWxpZGF0aW9uRXZlbnRzIiwiZ2V0VmFsdWVGcm9tRXZlbnQiLCJpZkVsc2UiLCJpZGVudGl0eSIsIkZpZWxkIiwicHJvcHMiLCJ1cGRhdGVFcnJvciIsInZhbHVlIiwidmFsaWRhdGUiLCJ1cGRhdGVGb3JtRXJyb3IiLCJvbkNoYW5nZSIsInZhbGlkYXRlT24iLCJ1cGRhdGVGb3JtVmFsdWUiLCJnZXRFcnJvclByb3BzIiwiZXJyb3IiLCJyb2xlIiwiZ2V0TGFiZWxQcm9wcyIsImh0bWxGb3IiLCJpZCIsImdldElucHV0UHJvcHMiLCJkZWZhdWx0UHJvcHMiLCJjb250YWlucyIsImdldElucHV0VmFsdWVzIiwic3Rh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cnJvcjogUHJvcFR5cGVzLmZ1bmMsXG4gIHZhbGlkYXRlT246IFByb3BUeXBlcy5vbmVPZihbJ29uQmx1cicsICdvblN1Ym1pdCcsICdvbkNoYW5nZScsICdvbkZvY3VzJ10pLFxuICB2YWxpZGF0ZTogUHJvcFR5cGVzLmZ1bmMsXG4gIGNoaWxkcmVuOiBQcm9wVHlwZXMuZnVuYy5pc1JlcXVpcmVkXG59XG5cbmV4cG9ydCBkZWZhdWx0IEZpZWxkXG4iXX0= | ||
export default Field; |
@@ -8,2 +8,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import R from 'ramda'; | ||
@@ -13,2 +14,3 @@ import Field from './Field.js'; | ||
var clone = React.cloneElement; | ||
var noop = function noop() {}; | ||
@@ -62,4 +64,4 @@ var checkChildType = function checkChildType(child) { | ||
error: _this2.state.formErrors[id] || '', | ||
validate: validate || _this2.props.validate, | ||
validateOn: validateOn || _this2.props.validateOn | ||
validateOn: validateOn || _this2.props.validateOn, | ||
validate: validate || _this2.props.validate | ||
}); | ||
@@ -112,3 +114,3 @@ }); | ||
this.updateChildErrorsOnSubmit = function () { | ||
var formFields = _this3.props.children.filter(checkChildType); | ||
var formFields = React.Children.toArray(_this3.props.children).filter(checkChildType); | ||
@@ -141,3 +143,3 @@ if (_this3.props.validateOn === 'onSubmit') { | ||
var formFields = _this3.props.children.filter(checkChildType); | ||
var formFields = React.Children.toArray(_this3.props.children).filter(checkChildType); | ||
@@ -150,7 +152,10 @@ var formErrors = _this3.state.formErrors; | ||
var id = props.id, | ||
validate = props.validate, | ||
_props$validate = props.validate, | ||
validate = _props$validate === undefined ? function () { | ||
return ''; | ||
} : _props$validate, | ||
value = props.value; | ||
return !formErrors[id] && R.complement(validate)(value); | ||
return !formErrors[id] && !validate(value); | ||
}); | ||
@@ -174,5 +179,20 @@ | ||
Form.displayName = 'Form'; | ||
Form.propTypes = { | ||
onChange: PropTypes.func, | ||
onSubmit: PropTypes.func, | ||
validate: PropTypes.func, | ||
validateOn: PropTypes.string | ||
}; | ||
Form.defaultProps = { | ||
onChange: noop, | ||
onSubmit: noop, | ||
validate: function validate() { | ||
return ''; | ||
} | ||
}; | ||
Form.Field = Field; | ||
export default Form; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL21vZHVsZXMvRm9ybS5qcyJdLCJuYW1lcyI6WyJSZWFjdCIsIkNvbXBvbmVudCIsIlIiLCJGaWVsZCIsImNsb25lIiwiY2xvbmVFbGVtZW50IiwiY2hlY2tDaGlsZFR5cGUiLCJjaGlsZCIsInR5cGUiLCJuYW1lIiwiRm9ybSIsInByb3BzIiwic3RhdGUiLCJmb3JtVmFsdWVzIiwiZm9ybUVycm9ycyIsInJlbmRlciIsImNoaWxkcmVuIiwibWFwcGVkQ2hpbGRyZW4iLCJDaGlsZHJlbiIsIm1hcCIsImlkIiwidmFsaWRhdGUiLCJ2YWxpZGF0ZU9uIiwidXBkYXRlRm9ybVZhbHVlIiwidXBkYXRlRm9ybUVycm9yIiwidmFsdWUiLCJlcnJvciIsImhhbmRsZVN1Ym1pdCIsInVwZGF0ZUZvcm1TdGF0ZSIsIm9uQ2hhbmdlIiwibmV3U3RhdGUiLCJzZXRTdGF0ZSIsIm1lcmdlRGVlcFJpZ2h0Iiwia2V5IiwidXBkYXRlQ2hpbGRFcnJvcnNPblN1Ym1pdCIsImZvcm1GaWVsZHMiLCJmaWx0ZXIiLCJlcnJvckFycmF5IiwidmFsaWRhdGlvblJlc3BvbnNlIiwibWVyZ2VBbGwiLCJlIiwicHJldmVudERlZmF1bHQiLCJ2YWxpZCIsImV2ZXJ5IiwiY29tcGxlbWVudCIsIm9uU3VibWl0IiwiaXNWYWxpZCJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsT0FBT0EsS0FBUCxJQ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lRm9ybUVycm9yKGlkKSxcbiAgICAgICAgdmFsdWU6IHRoaXMuc3RhdGUuZm9ybVZhbHVlc1tpZF0gfHwgJycsXG4gICAgICAgIGVycm9yOiB0aGlzLnN0YXRlLmZvcm1FcnJvcnNbaWRdIHx8ICcnLFxuICAgICAgICB2YWxpZGF0ZTogdmFsaWRhdGUgfHwgdGhpcy5wcm9wcy52YWxpZGF0ZSxcbiAgICAgICAgdmFsaWRhdGVPbjogdmFsaWRhdGVPbiB8fCB0aGlzLnByb3BzLnZhbGlkYXRlT25cbiAgICAgIH0pXG4gICAgfSlcblxuICAgIHJldHVybiA8Zm9ybSBvblN1Ym1pdD17dGhpcy5oYW5kbGVTdWJtaXR9PnttYXBwZWRDaGlsZHJlbn08L2Zvcm0+XG4gIH1cbn1cblxuRm9ybS5GaWVsZCA9IEZpZWxkXG5cbmV4cG9ydCBkZWZhdWx0IEZvcm1cbiJdfQ== | ||
export default Form; |
import Form from './Form'; | ||
export { Form }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL21vZHVsZXMvaW5kZXguanMiXSwibmFtZXMiOlsiRm9ybSJdLCJtYXBwaW5ncyI6IkFBQUEsT0FBT0EsSUFBUCxNQUFpQixRQUFqQjs7QUFFQSxTQUFTQSxJQUFUIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IEZvcm0gZnJvbSAnLi9Gb3JtJ1xuXG5leHBvcnQgeyBGb3JtIH1cbiJdfQ== | ||
export { Form }; |
18
Field.js
@@ -103,3 +103,3 @@ 'use strict'; | ||
Field.prototype.render = function render() { | ||
var children = this.props.children; | ||
var render = this.props.render; | ||
@@ -113,3 +113,8 @@ | ||
return children(childProps); | ||
if (render.prototype.render) { | ||
// eslint-disable-next-line new-cap | ||
return new render(childProps); | ||
} | ||
return render(childProps); | ||
}; | ||
@@ -123,4 +128,4 @@ | ||
Field.defaultProps = { | ||
validate: function validate() { | ||
return ''; | ||
render: function render() { | ||
return null; | ||
} | ||
@@ -134,6 +139,5 @@ }; | ||
validate: _propTypes2.default.func, | ||
children: _propTypes2.default.func.isRequired | ||
render: _propTypes2.default.func | ||
}; | ||
exports.default = Field; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm1vZHVsZXMvRmllbGQuanMiXSwibmFtZXMiOlsiaXNFdmVudCIsImhhcyIsImUiLCJnZXRFdmVudFZhbHVlIiwicGF0aCIsInZhbGlkYXRpb25FdmVudHMiLCJnZXRWYWx1ZUZyb21FdmVudCIsImlmRWxzZSIsImlkZW50aXR5IiwiRmllbGQiLCJwcm9wcyIsInVwZGF0ZUVycm9yIiwidmFsdWUiLCJ2YWxpZGF0ZSIsInVwZGF0ZUZvcm1FcnJvciIsIm9uQ2hhbmdlIiwidmFsaWRhdGVPbiIsInVwZGF0ZUZvcm1WYWx1ZSIsImdldEVycm9yUHJvcHMiLCJlcnJvciIsInJvbGUiLCJnZXRMYWJlbFByb3BzIiwiaHRtbEZvciIsImlkIiwiZ2V0SW5wdXRQcm9wcyIsImRlZmF1bHRQcm9wcyIsImNvbnRhaW5zIiwiZ2V0SW5wdXRWYWx1ZXMiLCJzdGF0ZSIsInJlbmRlciIsImNoaWxkcmVuIiwiY2hpbGRQcm9wcyIsImRpc3BsYXlOYW1lIiwicHJvcFR5cGVzIiwiZnVuYyIsIm9uZU9mIiwiaXNSZXF1aXJlZCJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUE7O0FBQ0E7Ozs7QUFDQTs7Ozs7Ozs7Ozs7O0FBRUEsSUFBTUEsVUFBVSxTQUFWQSxPQUFVO0FBQUEsU0FBSyxnQkFBRUMsR0FBRixDQUFNLGFBQU4sRUFBcUJDLENBQXJCLENBQUw7QUFBQSxDQUFoQjs7QUFFQSxJQUFNQyxnQkFBZ0IsZ0JBQUVDLElBQUYsQ0FBTyxD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9PiAoe1xuICAgIGVycm9yOiB0aGlzLnByb3BzLmVycm9yXG4gIH0pXG5cbiAgcmVuZGVyICgpIHtcbiAgICBjb25zdCB7IGNoaWxkcmVuIH0gPSB0aGlzLnByb3BzXG5cbiAgICBjb25zdCBjaGlsZFByb3BzID0ge1xuICAgICAgZ2V0SW5wdXRQcm9wczogdGhpcy5nZXRJbnB1dFByb3BzLFxuICAgICAgZ2V0SW5wdXRWYWx1ZXM6IHRoaXMuZ2V0SW5wdXRWYWx1ZXMsXG4gICAgICBlcnJvcjogdGhpcy5wcm9wcy5lcnJvclxuICAgIH1cblxuICAgIHJldHVybiBjaGlsZHJlbihjaGlsZFByb3BzKVxuICB9XG59XG5cbkZpZWxkLmRpc3BsYXlOYW1lID0gJ0ZpZWxkJ1xuXG5GaWVsZC5kZWZhdWx0UHJvcHMgPSB7XG4gIHZhbGlkYXRlOiAoKSA9PiAnJ1xufVxuXG5GaWVsZC5wcm9wVHlwZXMgPSB7XG4gIHVwZGF0ZUZvcm1WYWx1ZTogUHJvcFR5cGVzLmZ1bmMsXG4gIHVwZGF0ZUZvcm1FcnJvcjogUHJvcFR5cGVzLmZ1bmMsXG4gIHZhbGlkYXRlT246IFByb3BUeXBlcy5vbmVPZihbJ29uQmx1cicsICdvblN1Ym1pdCcsICdvbkNoYW5nZScsICdvbkZvY3VzJ10pLFxuICB2YWxpZGF0ZTogUHJvcFR5cGVzLmZ1bmMsXG4gIGNoaWxkcmVuOiBQcm9wVHlwZXMuZnVuYy5pc1JlcXVpcmVkXG59XG5cbmV4cG9ydCBkZWZhdWx0IEZpZWxkXG4iXX0= | ||
exports.default = Field; |
39
Form.js
@@ -9,2 +9,6 @@ 'use strict'; | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _ramda = require('ramda'); | ||
@@ -27,2 +31,3 @@ | ||
var clone = _react2.default.cloneElement; | ||
var noop = function noop() {}; | ||
@@ -76,4 +81,4 @@ var checkChildType = function checkChildType(child) { | ||
error: _this2.state.formErrors[id] || '', | ||
validate: validate || _this2.props.validate, | ||
validateOn: validateOn || _this2.props.validateOn | ||
validateOn: validateOn || _this2.props.validateOn, | ||
validate: validate || _this2.props.validate | ||
}); | ||
@@ -126,3 +131,3 @@ }); | ||
this.updateChildErrorsOnSubmit = function () { | ||
var formFields = _this3.props.children.filter(checkChildType); | ||
var formFields = _react2.default.Children.toArray(_this3.props.children).filter(checkChildType); | ||
@@ -155,3 +160,3 @@ if (_this3.props.validateOn === 'onSubmit') { | ||
var formFields = _this3.props.children.filter(checkChildType); | ||
var formFields = _react2.default.Children.toArray(_this3.props.children).filter(checkChildType); | ||
@@ -164,7 +169,10 @@ var formErrors = _this3.state.formErrors; | ||
var id = props.id, | ||
validate = props.validate, | ||
_props$validate = props.validate, | ||
validate = _props$validate === undefined ? function () { | ||
return ''; | ||
} : _props$validate, | ||
value = props.value; | ||
return !formErrors[id] && _ramda2.default.complement(validate)(value); | ||
return !formErrors[id] && !validate(value); | ||
}); | ||
@@ -188,5 +196,20 @@ | ||
Form.displayName = 'Form'; | ||
Form.propTypes = { | ||
onChange: _propTypes2.default.func, | ||
onSubmit: _propTypes2.default.func, | ||
validate: _propTypes2.default.func, | ||
validateOn: _propTypes2.default.string | ||
}; | ||
Form.defaultProps = { | ||
onChange: noop, | ||
onSubmit: noop, | ||
validate: function validate() { | ||
return ''; | ||
} | ||
}; | ||
Form.Field = _Field2.default; | ||
exports.default = Form; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm1vZHVsZXMvRm9ybS5qcyJdLCJuYW1lcyI6WyJjbG9uZSIsImNsb25lRWxlbWVudCIsImNoZWNrQ2hpbGRUeXBlIiwiY2hpbGQiLCJ0eXBlIiwibmFtZSIsIkZvcm0iLCJwcm9wcyIsInN0YXRlIiwiZm9ybVZhbHVlcyIsImZvcm1FcnJvcnMiLCJyZW5kZXIiLCJjaGlsZHJlbiIs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25zdCBtYXBwZWRDaGlsZHJlbiA9IFJlYWN0LkNoaWxkcmVuLm1hcChjaGlsZHJlbiwgY2hpbGQgPT4ge1xuICAgICAgY29uc3QgeyBpZCwgdmFsaWRhdGUsIHZhbGlkYXRlT24gfSA9IGNoaWxkLnByb3BzXG5cbiAgICAgIGlmICghY2hlY2tDaGlsZFR5cGUoY2hpbGQpKSB7XG4gICAgICAgIHJldHVybiBjaGlsZFxuICAgICAgfVxuXG4gICAgICByZXR1cm4gY2xvbmUoY2hpbGQsIHtcbiAgICAgICAgdXBkYXRlRm9ybVZhbHVlOiB0aGlzLnVwZGF0ZUZvcm1WYWx1ZShpZCksXG4gICAgICAgIHVwZGF0ZUZvcm1FcnJvcjogdGhpcy51cGRhdGVGb3JtRXJyb3IoaWQpLFxuICAgICAgICB2YWx1ZTogdGhpcy5zdGF0ZS5mb3JtVmFsdWVzW2lkXSB8fCAnJyxcbiAgICAgICAgZXJyb3I6IHRoaXMuc3RhdGUuZm9ybUVycm9yc1tpZF0gfHwgJycsXG4gICAgICAgIHZhbGlkYXRlOiB2YWxpZGF0ZSB8fCB0aGlzLnByb3BzLnZhbGlkYXRlLFxuICAgICAgICB2YWxpZGF0ZU9uOiB2YWxpZGF0ZU9uIHx8IHRoaXMucHJvcHMudmFsaWRhdGVPblxuICAgICAgfSlcbiAgICB9KVxuXG4gICAgcmV0dXJuIDxmb3JtIG9uU3VibWl0PXt0aGlzLmhhbmRsZVN1Ym1pdH0+e21hcHBlZENoaWxkcmVufTwvZm9ybT5cbiAgfVxufVxuXG5Gb3JtLkZpZWxkID0gRmllbGRcblxuZXhwb3J0IGRlZmF1bHQgRm9ybVxuIl19 | ||
exports.default = Form; |
@@ -12,3 +12,2 @@ 'use strict'; | ||
exports.Form = _Form2.default; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm1vZHVsZXMvaW5kZXguanMiXSwibmFtZXMiOlsiRm9ybSJdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQTs7Ozs7O1FBRVNBLEkiLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgRm9ybSBmcm9tICcuL0Zvcm0nXG5cbmV4cG9ydCB7IEZvcm0gfVxuIl19 | ||
exports.Form = _Form2.default; |
{ | ||
"name": "@kofile/react-form", | ||
"version": "0.0.0-development", | ||
"version": "0.0.0", | ||
"description": "A basic template for ES6 modules", | ||
@@ -38,2 +38,3 @@ "contributors": [ | ||
"babel-preset-stage-1": "^6.24.1", | ||
"browser-env": "^3.2.0", | ||
"commitizen": "^2.9.6", | ||
@@ -43,2 +44,3 @@ "coveralls": "^2.13.1", | ||
"cz-conventional-changelog": "^2.0.0", | ||
"enzyme": "^2.9.1", | ||
"gzip-size": "^3.0.0", | ||
@@ -51,6 +53,12 @@ "husky": "^0.13.4", | ||
"react": "^15.6.1", | ||
"react-dom": "^15.6.1", | ||
"react-test-renderer": "^15.6.1", | ||
"react-test-utils": "^0.0.1", | ||
"rollup": "^0.47.4", | ||
"rollup-plugin-babel": "^3.0.2", | ||
"rollup-plugin-commonjs": "^8.2.1", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
"rollup-plugin-uglify": "^2.0.1", | ||
"semantic-release": "^7.0.2", | ||
"sinon": "^3.2.1", | ||
"snazzy": "^7.0.0", | ||
@@ -83,5 +91,13 @@ "standard": "^10.0.3" | ||
"ava": { | ||
"files": [ | ||
"tests/**/*.js" | ||
], | ||
"require": [ | ||
"babel-register" | ||
] | ||
], | ||
"babel": { | ||
"presets": [ | ||
"./.babelrc.js" | ||
] | ||
} | ||
}, | ||
@@ -110,2 +126,2 @@ "babel": { | ||
} | ||
} | ||
} |
@@ -1,1 +0,1 @@ | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("ramda"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","ramda","prop-types"],e):e(r.ReactMenu={},r.React,r.R,r.PropTypes)}(this,function(r,e,t,n){"use strict";var o="default"in e?e.default:e;t=t&&t.hasOwnProperty("default")?t.default:t,n=n&&n.hasOwnProperty("default")?n.default:n;var a=function(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")},u=Object.assign||function(r){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},i=function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)},p=function(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?r:e},s=t.path(["target","value"]),l=["onBlur","onFocus"],f=t.ifElse(function(r){return t.has("nativeEvent",r)},s,t.identity),d=function(r){function e(n){a(this,e);var o=p(this,r.call(this,n));return o.updateError=function(r){var e=f(r),t=o.props,n=t.validate;(0,t.updateFormError)(n(e))},o.onChange=function(r){var e=f(r);return"onChange"===o.props.validateOn&&o.updateError(r),o.props.updateFormValue(e)},o.getErrorProps=function(){return{error:o.props.error,role:"alert"}},o.getLabelProps=function(){return{htmlFor:o.props.id}},o.getInputProps=function(){var r={value:o.props.value,onChange:o.onChange,id:o.props.id};if(t.contains(o.props.validateOn,l)){var e;return u({},r,(e={},e[o.props.validateOn]=o.updateError,e))}return r},o.getInputValues=function(){return{error:o.props.error}},o.state={},o}return i(e,r),e.prototype.render=function(){return(0,this.props.children)({getInputProps:this.getInputProps,getInputValues:this.getInputValues,error:this.props.error})},e}(e.Component);d.displayName="Field",d.defaultProps={validate:function(){return""}},d.propTypes={updateFormValue:n.func,updateFormError:n.func,validateOn:n.oneOf(["onBlur","onSubmit","onChange","onFocus"]),validate:n.func,children:n.func.isRequired};var c=o.cloneElement,m=function(r){return"Field"===r.type.name},v=function(r){function e(t){a(this,e);var n=p(this,r.call(this,t));return h.call(n),n.state={formValues:{},formErrors:{}},n}return i(e,r),e.prototype.render=function(){var r=this,e=this.props.children,t=o.Children.map(e,function(e){var t=e.props,n=t.id,o=t.validate,a=t.validateOn;return m(e)?c(e,{updateFormValue:r.updateFormValue(n),updateFormError:r.updateFormError(n),value:r.state.formValues[n]||"",error:r.state.formErrors[n]||"",validate:o||r.props.validate,validateOn:a||r.props.validateOn}):e});return o.createElement("form",{onSubmit:this.handleSubmit},t)},e}(e.Component),h=function(){var r=this;this.updateFormState=function(e){r.props.onChange(e),r.setState(e)},this.updateFormValue=function(e){return function(n){var o,a=t.mergeDeepRight(r.state,{formValues:(o={},o[e]=n,o)});r.updateFormState(a)}},this.updateFormError=function(e){return function(n){var o,a=n?t.mergeDeepRight(r.state,{formErrors:(o={},o[e]=n,o)}):r.state;r.updateFormState(a)}},this.updateChildErrorsOnSubmit=function(){var e=r.props.children.filter(m);if("onSubmit"===r.props.validateOn){var n=e.map(function(r){var e,t=r.props,n=t.id,o=t.validate,a=t.value;if(!t.validateOn||"onSubmit"===t.validateOn){var u=o(a);return u?(e={},e[n]=u,e):{}}});return r.setState({formErrors:t.mergeAll(n)})}},this.handleSubmit=function(e){e.preventDefault();var n=r.props.children.filter(m),o=r.state.formErrors;n.every(function(r){var e=r.props,n=e.id,a=e.validate,u=e.value;return!o[n]&&t.complement(a)(u)})?r.props.onSubmit({formValues:r.state.formValues,isValid:!0}):(r.props.onSubmit({formValues:r.state.formValues,isValid:!1}),r.updateChildErrorsOnSubmit())}};v.Field=d,r.Form=v,Object.defineProperty(r,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","prop-types"],n):n(t.ReactForm={},t.React,t.PropTypes)}(this,function(t,n,r){"use strict";var e="default"in n?n.default:n;r=r&&r.hasOwnProperty("default")?r.default:r;var u=function(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]},i=function(t){return function n(r){return 0===arguments.length||u(r)?n:t.apply(this,arguments)}},o=i(function(t){return function(){return t}}),c=o(!1),a=o(!0),f={"@@functional/placeholder":!0},s=function(t){return function n(r,e){switch(arguments.length){case 0:return n;case 1:return u(r)?n:i(function(n){return t(r,n)});default:return u(r)&&u(e)?n:u(r)?i(function(n){return t(n,e)}):u(e)?i(function(n){return t(r,n)}):t(r,e)}}},l=s(function(t,n){return+t+ +n}),p=function(t,n){t=t||[],n=n||[];var r,e=t.length,u=n.length,i=[];for(r=0;e>r;)i[i.length]=t[r],r+=1;for(r=0;u>r;)i[i.length]=n[r],r+=1;return i},h=function(t,n){switch(t){case 0:return function(){return n.apply(this,arguments)};case 1:return function(t){return n.apply(this,arguments)};case 2:return function(t,r){return n.apply(this,arguments)};case 3:return function(t,r,e){return n.apply(this,arguments)};case 4:return function(t,r,e,u){return n.apply(this,arguments)};case 5:return function(t,r,e,u,i){return n.apply(this,arguments)};case 6:return function(t,r,e,u,i,o){return n.apply(this,arguments)};case 7:return function(t,r,e,u,i,o,c){return n.apply(this,arguments)};case 8:return function(t,r,e,u,i,o,c,a){return n.apply(this,arguments)};case 9:return function(t,r,e,u,i,o,c,a,f){return n.apply(this,arguments)};case 10:return function(t,r,e,u,i,o,c,a,f,s){return n.apply(this,arguments)};default:throw Error("First argument to _arity must be a non-negative integer no greater than ten")}},y=function t(n,r,e){return function(){for(var i=[],o=0,c=n,a=0;r.length>a||arguments.length>o;){var f;a>=r.length||u(r[a])&&arguments.length>o?(f=arguments[o],o+=1):f=r[a],i[a]=f,u(f)||(c-=1),a+=1}return c>0?h(c,t(n,i,e)):e.apply(this,i)}},d=s(function(t,n){return 1===t?i(n):h(t,y(t,[],n))}),g=i(function(t){return d(t.length,function(){var n=0,r=arguments[0],e=arguments[arguments.length-1],u=Array.prototype.slice.call(arguments,0);return u[0]=function(){var t=r.apply(this,p(arguments,[n,e]));return n+=1,t},t.apply(this,u)})}),v=function(t){return function n(r,e,o){switch(arguments.length){case 0:return n;case 1:return u(r)?n:s(function(n,e){return t(r,n,e)});case 2:return u(r)&&u(e)?n:u(r)?s(function(n,r){return t(n,e,r)}):u(e)?s(function(n,e){return t(r,n,e)}):i(function(n){return t(r,e,n)});default:return u(r)&&u(e)&&u(o)?n:u(r)&&u(e)?s(function(n,r){return t(n,r,o)}):u(r)&&u(o)?s(function(n,r){return t(n,e,r)}):u(e)&&u(o)?s(function(n,e){return t(r,n,e)}):u(r)?i(function(n){return t(n,e,o)}):u(e)?i(function(n){return t(r,n,o)}):u(o)?i(function(n){return t(r,e,n)}):t(r,e,o)}}},m=v(function(t,n,r){if(n>=r.length||-r.length>n)return r;var e=(0>n?r.length:0)+n,u=p(r);return u[e]=t(r[e]),u}),b=Array.isArray||function(t){return null!=t&&t.length>=0&&"[object Array]"===Object.prototype.toString.call(t)},w=function(t){return"function"==typeof t["@@transducer/step"]},x=function(t,n,r){return function(){if(0===arguments.length)return r();var e=Array.prototype.slice.call(arguments,0),u=e.pop();if(!b(u)){for(var i=0;t.length>i;){if("function"==typeof u[t[i]])return u[t[i]].apply(u,e);i+=1}if(w(u))return n.apply(null,e)(u)}return r.apply(this,arguments)}},O=function(t){return t&&t["@@transducer/reduced"]?t:{"@@transducer/value":t,"@@transducer/reduced":!0}},j={init:function(){return this.xf["@@transducer/init"]()},result:function(t){return this.xf["@@transducer/result"](t)}},A=function(){function t(t,n){this.xf=n,this.f=t,this.all=!0}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=function(t){return this.all&&(t=this.xf["@@transducer/step"](t,!0)),this.xf["@@transducer/result"](t)},t.prototype["@@transducer/step"]=function(t,n){return this.f(n)||(this.all=!1,t=O(this.xf["@@transducer/step"](t,!1))),t},s(function(n,r){return new t(n,r)})}(),E=s(x(["all"],A,function(t,n){for(var r=0;n.length>r;){if(!t(n[r]))return!1;r+=1}return!0})),S=s(function(t,n){return n>t?n:t}),_=function(t,n){for(var r=0,e=n.length,u=Array(e);e>r;)u[r]=t(n[r]),r+=1;return u},F=function(t){return"[object String]"===Object.prototype.toString.call(t)},C=i(function(t){return!!b(t)||!!t&&("object"==typeof t&&(!F(t)&&(1===t.nodeType?!!t.length:0===t.length||t.length>0&&(t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1)))))}),q=function(){function t(t){this.f=t}return t.prototype["@@transducer/init"]=function(){throw Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(t){return t},t.prototype["@@transducer/step"]=function(t,n){return this.f(t,n)},function(n){return new t(n)}}(),P=s(function(t,n){return h(t.length,function(){return t.apply(n,arguments)})}),I=function(){function t(t,n,r){for(var e=0,u=r.length;u>e;){if((n=t["@@transducer/step"](n,r[e]))&&n["@@transducer/reduced"]){n=n["@@transducer/value"];break}e+=1}return t["@@transducer/result"](n)}function n(t,n,r){for(var e=r.next();!e.done;){if((n=t["@@transducer/step"](n,e.value))&&n["@@transducer/reduced"]){n=n["@@transducer/value"];break}e=r.next()}return t["@@transducer/result"](n)}function r(t,n,r,e){return t["@@transducer/result"](r[e](P(t["@@transducer/step"],t),n))}var e="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";return function(u,i,o){if("function"==typeof u&&(u=q(u)),C(o))return t(u,i,o);if("function"==typeof o["fantasy-land/reduce"])return r(u,i,o,"fantasy-land/reduce");if(null!=o[e])return n(u,i,o[e]());if("function"==typeof o.next)return n(u,i,o);if("function"==typeof o.reduce)return r(u,i,o,"reduce");throw new TypeError("reduce: list must be array or iterable")}}(),k=function(){function t(t,n){this.xf=n,this.f=t}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=j.result,t.prototype["@@transducer/step"]=function(t,n){return this.xf["@@transducer/step"](t,this.f(n))},s(function(n,r){return new t(n,r)})}(),N=function(t,n){return Object.prototype.hasOwnProperty.call(n,t)},W=function(){var t=Object.prototype.toString;return"[object Arguments]"===t.call(arguments)?function(n){return"[object Arguments]"===t.call(n)}:function(t){return N("callee",t)}}(),T=function(){var t=!{toString:null}.propertyIsEnumerable("toString"),n=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],r=function(){return arguments.propertyIsEnumerable("length")}(),e=function(t,n){for(var r=0;t.length>r;){if(t[r]===n)return!0;r+=1}return!1};return i("function"!=typeof Object.keys||r?function(u){if(Object(u)!==u)return[];var i,o,c=[],a=r&&W(u);for(i in u)!N(i,u)||a&&"length"===i||(c[c.length]=i);if(t)for(o=6;o>=0;)N(i=n[o],u)&&!e(c,i)&&(c[c.length]=i),o-=1;return c}:function(t){return Object(t)!==t?[]:Object.keys(t)})}(),V=s(x(["fantasy-land/map","map"],k,function(t,n){switch(Object.prototype.toString.call(n)){case"[object Function]":return d(n.length,function(){return t.call(this,n.apply(this,arguments))});case"[object Object]":return I(function(r,e){return r[e]=t(n[e]),r},{},T(n));default:return _(t,n)}})),R=s(function(t,n){return n[t]}),B=s(function(t,n){return V(R(t),n)}),D=v(I),U=i(function(t){return d(D(S,0,B("length",t)),function(){for(var n=0,r=t.length;r>n;){if(!t[n].apply(this,arguments))return!1;n+=1}return!0})}),M=s(function(t,n){return t&&n}),L=function(){function t(t,n){this.xf=n,this.f=t,this.any=!1}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=function(t){return this.any||(t=this.xf["@@transducer/step"](t,!1)),this.xf["@@transducer/result"](t)},t.prototype["@@transducer/step"]=function(t,n){return this.f(n)&&(this.any=!0,t=O(this.xf["@@transducer/step"](t,!0))),t},s(function(n,r){return new t(n,r)})}(),z=s(x(["any"],L,function(t,n){for(var r=0;n.length>r;){if(t(n[r]))return!0;r+=1}return!1})),K=i(function(t){return d(D(S,0,B("length",t)),function(){for(var n=0,r=t.length;r>n;){if(t[n].apply(this,arguments))return!0;n+=1}return!1})}),$=s(function(t,n){return"function"==typeof n["fantasy-land/ap"]?n["fantasy-land/ap"](t):"function"==typeof t.ap?t.ap(n):"function"==typeof t?function(r){return t(r)(n(r))}:I(function(t,r){return p(t,V(r,n))},[],t)}),H=function(){function t(t,n){this.xf=n,this.pos=0,this.full=!1,this.acc=Array(t)}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=function(t){return this.acc=null,this.xf["@@transducer/result"](t)},t.prototype["@@transducer/step"]=function(t,n){return this.store(n),this.full?this.xf["@@transducer/step"](t,this.getCopy()):t},t.prototype.store=function(t){this.acc[this.pos]=t,(this.pos+=1)===this.acc.length&&(this.pos=0,this.full=!0)},t.prototype.getCopy=function(){return p(Array.prototype.slice.call(this.acc,this.pos),Array.prototype.slice.call(this.acc,0,this.pos))},s(function(n,r){return new t(n,r)})}(),J=s(x([],H,function(t,n){for(var r=0,e=n.length-(t-1),u=Array(0>e?0:e);e>r;)u[r]=Array.prototype.slice.call(n,r,r+t),r+=1;return u})),X=s(function(t,n){return p(n,[t])}),Y=s(function(t,n){return t.apply(this,n)}),Z=i(function(t){for(var n=T(t),r=n.length,e=[],u=0;r>u;)e[u]=t[n[u]],u+=1;return e}),G=i(function t(n){return n=V(function(n){return"function"==typeof n?n:t(n)},n),d(D(S,0,B("length",Z(n))),function(){var t=arguments;return V(function(n){return Y(n,t)},n)})}),Q=v(function(t,n,r){var e=t(n),u=t(r);return u>e?-1:e>u?1:0}),tt=v(function(t,n,r){var e={};for(var u in r)e[u]=r[u];return e[t]=n,e}),nt=Number.isInteger||function(t){return t<<0===t},rt=i(function(t){return null==t}),et=v(function t(n,r,e){if(0===n.length)return r;var u=n[0];if(n.length>1){var i=!rt(e)&&N(u,e)?e[u]:nt(n[1])?[]:{};r=t(Array.prototype.slice.call(n,1),r,i)}if(nt(u)&&b(e)){var o=[].concat(e);return o[u]=r,o}return tt(u,r,e)}),ut=s(function(t,n){switch(t){case 0:return function(){return n.call(this)};case 1:return function(t){return n.call(this,t)};case 2:return function(t,r){return n.call(this,t,r)};case 3:return function(t,r,e){return n.call(this,t,r,e)};case 4:return function(t,r,e,u){return n.call(this,t,r,e,u)};case 5:return function(t,r,e,u,i){return n.call(this,t,r,e,u,i)};case 6:return function(t,r,e,u,i,o){return n.call(this,t,r,e,u,i,o)};case 7:return function(t,r,e,u,i,o,c){return n.call(this,t,r,e,u,i,o,c)};case 8:return function(t,r,e,u,i,o,c,a){return n.call(this,t,r,e,u,i,o,c,a)};case 9:return function(t,r,e,u,i,o,c,a,f){return n.call(this,t,r,e,u,i,o,c,a,f)};case 10:return function(t,r,e,u,i,o,c,a,f,s){return n.call(this,t,r,e,u,i,o,c,a,f,s)};default:throw Error("First argument to nAry must be a non-negative integer no greater than ten")}}),it=i(function(t){return ut(2,t)}),ot=function(t){return"[object Function]"===Object.prototype.toString.call(t)},ct=s(function(t,n){var r=d(t,n);return d(t,function(){return I($,V(r,arguments[0]),Array.prototype.slice.call(arguments,1))})}),at=i(function(t){return ct(t.length,t)}),ft=s(function(t,n){return ot(t)?function(){return t.apply(this,arguments)&&n.apply(this,arguments)}:at(M)(t,n)}),st=i(function(t){return d(t.length,t)}),lt=st(function(t){return t.apply(this,Array.prototype.slice.call(arguments,1))}),pt=function(t){return function n(r){for(var e,u,i,o=[],c=0,a=r.length;a>c;){if(C(r[c]))for(i=0,u=(e=t?n(r[c]):r[c]).length;u>i;)o[o.length]=e[i],i+=1;else o[o.length]=r[c];c+=1}return o}},ht=function(t){return{"@@transducer/value":t,"@@transducer/reduced":!0}},yt=function(){var t=function(t){return{"@@transducer/init":j.init,"@@transducer/result":function(n){return t["@@transducer/result"](n)},"@@transducer/step":function(n,r){var e=t["@@transducer/step"](n,r);return e["@@transducer/reduced"]?ht(e):e}}};return function(n){var r=t(n);return{"@@transducer/init":j.init,"@@transducer/result":function(t){return r["@@transducer/result"](t)},"@@transducer/step":function(t,n){return C(n)?I(r,t,n):I(r,t,[n])}}}}(),dt=s(function(t,n){return V(t,yt(n))}),gt=s(x(["fantasy-land/chain","chain"],dt,function(t,n){return"function"==typeof n?function(r){return t(n(r))(r)}:pt(!1)(V(t,n))})),vt=v(function(t,n,r){if(t>n)throw Error("min must not be greater than max in clamp(min, max, value)");return t>r?t:r>n?n:r}),mt=function(t){return RegExp(t.source,(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":""))},bt=i(function(t){return null===t?"Null":void 0===t?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}),wt=function t(n,r,e,u){var i=function(i){for(var o=r.length,c=0;o>c;){if(n===r[c])return e[c];c+=1}r[c+1]=n,e[c+1]=i;for(var a in n)i[a]=u?t(n[a],r,e,!0):n[a];return i};switch(bt(n)){case"Object":return i({});case"Array":return i([]);case"Date":return new Date(n.valueOf());case"RegExp":return mt(n);default:return n}},xt=i(function(t){return null!=t&&"function"==typeof t.clone?t.clone():wt(t,[],[],!0)}),Ot=i(function(t){return function(n,r){return t(n,r)?-1:t(r,n)?1:0}}),jt=i(function(t){return!t}),At=at(jt),Et=function(t,n){return function(){return n.call(this,t.apply(this,arguments))}},St=function(t,n){return function(){var r=arguments.length;if(0===r)return n();var e=arguments[r-1];return b(e)||"function"!=typeof e[t]?n.apply(this,arguments):e[t].apply(e,Array.prototype.slice.call(arguments,0,r-1))}},_t=v(St("slice",function(t,n,r){return Array.prototype.slice.call(r,t,n)})),Ft=i(St("tail",_t(1,1/0))),Ct=function(){if(0===arguments.length)throw Error("pipe requires at least one argument");return h(arguments[0].length,D(Et,arguments[0],Ft(arguments)))},qt=i(function(t){return F(t)?t.split("").reverse().join(""):Array.prototype.slice.call(t,0).reverse()}),Pt=function(){if(0===arguments.length)throw Error("compose requires at least one argument");return Ct.apply(this,qt(arguments))},It=function(){if(0===arguments.length)throw Error("composeK requires at least one argument");var t=Array.prototype.slice.call(arguments),n=t.pop();return Pt(Pt.apply(this,V(gt,t)),n)},kt=function(t,n){return function(){var r=this;return t.apply(r,arguments).then(function(t){return n.call(r,t)})}},Nt=function(){if(0===arguments.length)throw Error("pipeP requires at least one argument");return h(arguments[0].length,D(kt,arguments[0],Ft(arguments)))},Wt=function(t){for(var n,r=[];!(n=t.next()).done;)r.push(n.value);return r},Tt=function(t){var n=(t+"").match(/^function (\w*)/);return null==n?"":n[1]},Vt=s(function(t,n){return t===n?0!==t||1/t==1/n:t!==t&&n!==n}),Rt=function t(n,r,e,u){if(Vt(n,r))return!0;if(bt(n)!==bt(r))return!1;if(null==n||null==r)return!1;if("function"==typeof n["fantasy-land/equals"]||"function"==typeof r["fantasy-land/equals"])return"function"==typeof n["fantasy-land/equals"]&&n["fantasy-land/equals"](r)&&"function"==typeof r["fantasy-land/equals"]&&r["fantasy-land/equals"](n);if("function"==typeof n.equals||"function"==typeof r.equals)return"function"==typeof n.equals&&n.equals(r)&&"function"==typeof r.equals&&r.equals(n);switch(bt(n)){case"Arguments":case"Array":case"Object":if("function"==typeof n.constructor&&"Promise"===Tt(n.constructor))return n===r;break;case"Boolean":case"Number":case"String":if(typeof n!=typeof r||!Vt(n.valueOf(),r.valueOf()))return!1;break;case"Date":if(!Vt(n.valueOf(),r.valueOf()))return!1;break;case"Error":return n.name===r.name&&n.message===r.message;case"RegExp":if(n.source!==r.source||n.global!==r.global||n.ignoreCase!==r.ignoreCase||n.multiline!==r.multiline||n.sticky!==r.sticky||n.unicode!==r.unicode)return!1;break;case"Map":case"Set":if(!t(Wt(n.entries()),Wt(r.entries()),e,u))return!1;break;case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var i=T(n);if(i.length!==T(r).length)return!1;for(var o=e.length-1;o>=0;){if(e[o]===n)return u[o]===r;o-=1}for(e.push(n),u.push(r),o=i.length-1;o>=0;){var c=i[o];if(!N(c,r)||!t(r[c],n[c],e,u))return!1;o-=1}return e.pop(),u.pop(),!0},Bt=s(function(t,n){return Rt(t,n,[],[])}),Dt=function(t,n,r){var e,u;if("function"==typeof t.indexOf)switch(typeof n){case"number":if(0===n){for(e=1/n;t.length>r;){if(0===(u=t[r])&&1/u===e)return r;r+=1}return-1}if(n!==n){for(;t.length>r;){if("number"==typeof(u=t[r])&&u!==u)return r;r+=1}return-1}return t.indexOf(n,r);case"string":case"boolean":case"function":case"undefined":return t.indexOf(n,r);case"object":if(null===n)return t.indexOf(n,r)}for(;t.length>r;){if(Bt(t[r],n))return r;r+=1}return-1},Ut=function(t,n){return Dt(n,t,0)>=0},Mt=function(t){return'"'+t.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0").replace(/"/g,'\\"')+'"'},Lt=function(){var t=function(t){return(10>t?"0":"")+t};return"function"==typeof Date.prototype.toISOString?function(t){return t.toISOString()}:function(n){return n.getUTCFullYear()+"-"+t(n.getUTCMonth()+1)+"-"+t(n.getUTCDate())+"T"+t(n.getUTCHours())+":"+t(n.getUTCMinutes())+":"+t(n.getUTCSeconds())+"."+(n.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}}(),zt=function(t){return function(){return!t.apply(this,arguments)}},Kt=function(t,n){for(var r=0,e=n.length,u=[];e>r;)t(n[r])&&(u[u.length]=n[r]),r+=1;return u},$t=function(t){return"[object Object]"===Object.prototype.toString.call(t)},Ht=function(){function t(t,n){this.xf=n,this.f=t}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=j.result,t.prototype["@@transducer/step"]=function(t,n){return this.f(n)?this.xf["@@transducer/step"](t,n):t},s(function(n,r){return new t(n,r)})}(),Jt=s(x(["filter"],Ht,function(t,n){return $t(n)?I(function(r,e){return t(n[e])&&(r[e]=n[e]),r},{},T(n)):Kt(t,n)})),Xt=s(function(t,n){return Jt(zt(t),n)}),Yt=function t(n,r){var e=function(e){var u=r.concat([n]);return Ut(e,u)?"<Circular>":t(e,u)},u=function(t,n){return _(function(n){return Mt(n)+": "+e(t[n])},n.slice().sort())};switch(Object.prototype.toString.call(n)){case"[object Arguments]":return"(function() { return arguments; }("+_(e,n).join(", ")+"))";case"[object Array]":return"["+_(e,n).concat(u(n,Xt(function(t){return/^\d+$/.test(t)},T(n)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof n?"new Boolean("+e(n.valueOf())+")":""+n;case"[object Date]":return"new Date("+(isNaN(n.valueOf())?e(NaN):Mt(Lt(n)))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof n?"new Number("+e(n.valueOf())+")":1/n==-1/0?"-0":n.toString(10);case"[object String]":return"object"==typeof n?"new String("+e(n.valueOf())+")":Mt(n);case"[object Undefined]":return"undefined";default:if("function"==typeof n.toString){var i=""+n;if("[object Object]"!==i)return i}return"{"+u(n,T(n)).join(", ")+"}"}},Zt=i(function(t){return Yt(t,[])}),Gt=s(function(t,n){if(b(t)){if(b(n))return t.concat(n);throw new TypeError(Zt(n)+" is not an array")}if(F(t)){if(F(n))return t+n;throw new TypeError(Zt(n)+" is not a string")}if(null!=t&&ot(t["fantasy-land/concat"]))return t["fantasy-land/concat"](n);if(null!=t&&ot(t.concat))return t.concat(n);throw new TypeError(Zt(t)+' does not have a method named "concat" or "fantasy-land/concat"')}),Qt=i(function(t){var n=D(S,0,V(function(t){return t[0].length},t));return h(n,function(){for(var n=0;t.length>n;){if(t[n][0].apply(this,arguments))return t[n][1].apply(this,arguments);n+=1}})}),tn=s(function(t,n){if(t>10)throw Error("Constructor with greater than ten arguments");return 0===t?function(){return new n}:st(ut(t,function(t,r,e,u,i,o,c,a,f,s){switch(arguments.length){case 1:return new n(t);case 2:return new n(t,r);case 3:return new n(t,r,e);case 4:return new n(t,r,e,u);case 5:return new n(t,r,e,u,i);case 6:return new n(t,r,e,u,i,o);case 7:return new n(t,r,e,u,i,o,c);case 8:return new n(t,r,e,u,i,o,c,a);case 9:return new n(t,r,e,u,i,o,c,a,f);case 10:return new n(t,r,e,u,i,o,c,a,f,s)}}))}),nn=i(function(t){return tn(t.length,t)}),rn=s(Ut),en=s(function(t,n){return d(D(S,0,B("length",n)),function(){var r=arguments,e=this;return t.apply(e,_(function(t){return t.apply(e,r)},n))})}),un=function(){function t(t,n,r,e){this.valueFn=t,this.valueAcc=n,this.keyFn=r,this.xf=e,this.inputs={}}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=function(t){var n;for(n in this.inputs)if(N(n,this.inputs)&&(t=this.xf["@@transducer/step"](t,this.inputs[n]))["@@transducer/reduced"]){t=t["@@transducer/value"];break}return this.inputs=null,this.xf["@@transducer/result"](t)},t.prototype["@@transducer/step"]=function(t,n){var r=this.keyFn(n);return this.inputs[r]=this.inputs[r]||[r,this.valueAcc],this.inputs[r][1]=this.valueFn(this.inputs[r][1],n),t},y(4,[],function(n,r,e,u){return new t(n,r,e,u)})}(),on=y(4,[],x([],un,function(t,n,r,e){return I(function(e,u){var i=r(u);return e[i]=t(N(i,e)?e[i]:n,u),e},{},e)})),cn=on(function(t,n){return t+1},0),an=l(-1),fn=s(function(t,n){return null==n||n!==n?t:n}),sn=v(function(t,n,r){var e=t(n),u=t(r);return e>u?-1:u>e?1:0}),ln=s(function(t,n){for(var r=[],e=0,u=t.length;u>e;)Ut(t[e],n)||Ut(t[e],r)||(r[r.length]=t[e]),e+=1;return r}),pn=function(t,n,r){for(var e=0,u=r.length;u>e;){if(t(n,r[e]))return!0;e+=1}return!1},hn=v(function(t,n,r){for(var e=[],u=0,i=n.length;i>u;)pn(t,n[u],r)||pn(t,n[u],e)||e.push(n[u]),u+=1;return e}),yn=s(function(t,n){var r={};for(var e in n)r[e]=n[e];return delete r[t],r}),dn=v(function(t,n,r){var e=Array.prototype.slice.call(r,0);return e.splice(t,n),e}),gn=v(function(t,n,r){return m(o(n),t,r)}),vn=s(function t(n,r){switch(n.length){case 0:return r;case 1:return nt(n[0])?dn(n[0],1,r):yn(n[0],r);default:var e=n[0],u=Array.prototype.slice.call(n,1);return null==r[e]?r:nt(n[0])?gn(e,t(u,r[e]),r):tt(e,t(u,r[e]),r)}}),mn=s(function(t,n){return t/n}),bn=function(){function t(t,n){this.xf=n,this.n=t}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=j.result,t.prototype["@@transducer/step"]=function(t,n){return this.n>0?(this.n-=1,t):this.xf["@@transducer/step"](t,n)},s(function(n,r){return new t(n,r)})}(),wn=s(x(["drop"],bn,function(t,n){return _t(Math.max(0,t),1/0,n)})),xn=function(){function t(t,n){this.xf=n,this.n=t,this.i=0}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=j.result,t.prototype["@@transducer/step"]=function(t,n){this.i+=1;var r=0===this.n?t:this.xf["@@transducer/step"](t,n);return 0>this.n||this.n>this.i?r:O(r)},s(function(n,r){return new t(n,r)})}(),On=s(x(["take"],xn,function(t,n){return _t(0,0>t?1/0:t,n)})),jn=function(){function t(t,n){this.xf=n,this.pos=0,this.full=!1,this.acc=Array(t)}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=function(t){return this.acc=null,this.xf["@@transducer/result"](t)},t.prototype["@@transducer/step"]=function(t,n){return this.full&&(t=this.xf["@@transducer/step"](t,this.acc[this.pos])),this.store(n),t},t.prototype.store=function(t){this.acc[this.pos]=t,(this.pos+=1)===this.acc.length&&(this.pos=0,this.full=!0)},s(function(n,r){return new t(n,r)})}(),An=s(x([],jn,function(t,n){return On(n.length>t?n.length-t:0,n)})),En=function(){function t(t,n){this.f=t,this.retained=[],this.xf=n}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=function(t){return this.retained=null,this.xf["@@transducer/result"](t)},t.prototype["@@transducer/step"]=function(t,n){return this.f(n)?this.retain(t,n):this.flush(t,n)},t.prototype.flush=function(t,n){return t=I(this.xf["@@transducer/step"],t,this.retained),this.retained=[],this.xf["@@transducer/step"](t,n)},t.prototype.retain=function(t,n){return this.retained.push(n),t},s(function(n,r){return new t(n,r)})}(),Sn=s(x([],En,function(t,n){for(var r=n.length-1;r>=0&&t(n[r]);)r-=1;return Array.prototype.slice.call(n,0,r+1)})),_n=function(){function t(t,n){this.xf=n,this.pred=t,this.lastValue=void 0,this.seenFirstValue=!1}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=j.result,t.prototype["@@transducer/step"]=function(t,n){var r=!1;return this.seenFirstValue?this.pred(this.lastValue,n)&&(r=!0):this.seenFirstValue=!0,this.lastValue=n,r?t:this.xf["@@transducer/step"](t,n)},s(function(n,r){return new t(n,r)})}(),Fn=s(function(t,n){var r=0>t?n.length+t:t;return F(n)?n.charAt(r):n[r]}),Cn=Fn(-1),qn=s(x([],_n,function(t,n){var r=[],e=1,u=n.length;if(0!==u)for(r[0]=n[0];u>e;)t(Cn(r),n[e])||(r[r.length]=n[e]),e+=1;return r})),Pn=i(x([],_n(Bt),qn(Bt))),In=function(){function t(t,n){this.xf=n,this.f=t}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=j.result,t.prototype["@@transducer/step"]=function(t,n){if(this.f){if(this.f(n))return t;this.f=null}return this.xf["@@transducer/step"](t,n)},s(function(n,r){return new t(n,r)})}(),kn=s(x(["dropWhile"],In,function(t,n){for(var r=0,e=n.length;e>r&&t(n[r]);)r+=1;return Array.prototype.slice.call(n,r)})),Nn=s(function(t,n){return t||n}),Wn=s(function(t,n){return ot(t)?function(){return t.apply(this,arguments)||n.apply(this,arguments)}:at(Nn)(t,n)}),Tn=i(function(t){return null!=t&&"function"==typeof t["fantasy-land/empty"]?t["fantasy-land/empty"]():null!=t&&null!=t.constructor&&"function"==typeof t.constructor["fantasy-land/empty"]?t.constructor["fantasy-land/empty"]():null!=t&&"function"==typeof t.empty?t.empty():null!=t&&null!=t.constructor&&"function"==typeof t.constructor.empty?t.constructor.empty():b(t)?[]:F(t)?"":$t(t)?{}:W(t)?function(){return arguments}():void 0}),Vn=s(function(t,n){return wn(0>t?0:n.length-t,n)}),Rn=s(function(t,n){return Bt(Vn(t.length,n),t)}),Bn=v(function(t,n,r){return Bt(t(n),t(r))}),Dn=v(function(t,n,r){return Bt(n[t],r[t])}),Un=s(function t(n,r){var e,u,i,o={};for(u in r)i=typeof(e=n[u]),o[u]="function"===i?e(r[u]):e&&"object"===i?t(e,r[u]):r[u];return o}),Mn=function(){function t(t,n){this.xf=n,this.f=t,this.found=!1}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=function(t){return this.found||(t=this.xf["@@transducer/step"](t,void 0)),this.xf["@@transducer/result"](t)},t.prototype["@@transducer/step"]=function(t,n){return this.f(n)&&(this.found=!0,t=O(this.xf["@@transducer/step"](t,n))),t},s(function(n,r){return new t(n,r)})}(),Ln=s(x(["find"],Mn,function(t,n){for(var r=0,e=n.length;e>r;){if(t(n[r]))return n[r];r+=1}})),zn=function(){function t(t,n){this.xf=n,this.f=t,this.idx=-1,this.found=!1}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=function(t){return this.found||(t=this.xf["@@transducer/step"](t,-1)),this.xf["@@transducer/result"](t)},t.prototype["@@transducer/step"]=function(t,n){return this.idx+=1,this.f(n)&&(this.found=!0,t=O(this.xf["@@transducer/step"](t,this.idx))),t},s(function(n,r){return new t(n,r)})}(),Kn=s(x([],zn,function(t,n){for(var r=0,e=n.length;e>r;){if(t(n[r]))return r;r+=1}return-1})),$n=function(){function t(t,n){this.xf=n,this.f=t}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=function(t){return this.xf["@@transducer/result"](this.xf["@@transducer/step"](t,this.last))},t.prototype["@@transducer/step"]=function(t,n){return this.f(n)&&(this.last=n),t},s(function(n,r){return new t(n,r)})}(),Hn=s(x([],$n,function(t,n){for(var r=n.length-1;r>=0;){if(t(n[r]))return n[r];r-=1}})),Jn=function(){function t(t,n){this.xf=n,this.f=t,this.idx=-1,this.lastIdx=-1}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=function(t){return this.xf["@@transducer/result"](this.xf["@@transducer/step"](t,this.lastIdx))},t.prototype["@@transducer/step"]=function(t,n){return this.idx+=1,this.f(n)&&(this.lastIdx=this.idx),t},s(function(n,r){return new t(n,r)})}(),Xn=s(x([],Jn,function(t,n){for(var r=n.length-1;r>=0;){if(t(n[r]))return r;r-=1}return-1})),Yn=i(pt(!0)),Zn=i(function(t){return st(function(n,r){var e=Array.prototype.slice.call(arguments,0);return e[0]=r,e[1]=n,t.apply(this,e)})}),Gn=s(St("forEach",function(t,n){for(var r=n.length,e=0;r>e;)t(n[e]),e+=1;return n})),Qn=s(function(t,n){for(var r=T(n),e=0;r.length>e;){var u=r[e];t(n[u],u,n),e+=1}return n}),tr=i(function(t){for(var n={},r=0;t.length>r;)n[t[r][0]]=t[r][1],r+=1;return n}),nr=s(St("groupBy",on(function(t,n){return null==t&&(t=[]),t.push(n),t},null))),rr=s(function(t,n){for(var r=[],e=0,u=n.length;u>e;){for(var i=e+1;u>i&&t(n[i-1],n[i]);)i+=1;r.push(n.slice(e,i)),e=i}return r}),er=s(function(t,n){return t>n}),ur=s(function(t,n){return t>=n}),ir=s(N),or=s(function(t,n){return t in n}),cr=Fn(0),ar=function(t){return t},fr=i(ar),sr=v(function(t,n,r){return d(Math.max(t.length,n.length,r.length),function(){return t.apply(this,arguments)?n.apply(this,arguments):r.apply(this,arguments)})}),lr=l(1),pr=on(function(t,n){return n},null),hr=s(function(t,n){return"function"!=typeof n.indexOf||b(n)?Dt(n,t,0):n.indexOf(t)}),yr=_t(0,-1),dr=v(function(t,n,r){return Kt(function(n){return pn(t,n,r)},n)}),gr=v(function(t,n,r){t=r.length>t&&t>=0?t:r.length;var e=Array.prototype.slice.call(r,0);return e.splice(t,0,n),e}),vr=v(function(t,n,r){return t=r.length>t&&t>=0?t:r.length,[].concat(Array.prototype.slice.call(r,0,t),n,Array.prototype.slice.call(r,t))}),mr=function(){function t(){this._nativeSet="function"==typeof Set?new Set:null,this._items={}}function n(t,n,r){var e,u=typeof t;switch(u){case"string":case"number":return 0===t&&1/t==-1/0?!!r._items["-0"]||(n&&(r._items["-0"]=!0),!1):null!==r._nativeSet?n?(e=r._nativeSet.size,r._nativeSet.add(t),r._nativeSet.size===e):r._nativeSet.has(t):u in r._items?t in r._items[u]||(n&&(r._items[u][t]=!0),!1):(n&&(r._items[u]={},r._items[u][t]=!0),!1);case"boolean":if(u in r._items){var i=t?1:0;return!!r._items[u][i]||(n&&(r._items[u][i]=!0),!1)}return n&&(r._items[u]=t?[!1,!0]:[!0,!1]),!1;case"function":return null!==r._nativeSet?n?(e=r._nativeSet.size,r._nativeSet.add(t),r._nativeSet.size===e):r._nativeSet.has(t):u in r._items?!!Ut(t,r._items[u])||(n&&r._items[u].push(t),!1):(n&&(r._items[u]=[t]),!1);case"undefined":return!!r._items[u]||(n&&(r._items[u]=!0),!1);case"object":if(null===t)return!!r._items.null||(n&&(r._items.null=!0),!1);default:return(u=Object.prototype.toString.call(t))in r._items?!!Ut(t,r._items[u])||(n&&r._items[u].push(t),!1):(n&&(r._items[u]=[t]),!1)}}return t.prototype.add=function(t){return!n(t,!0,this)},t.prototype.has=function(t){return n(t,!1,this)},t}(),br=s(function(t,n){for(var r,e,u=new mr,i=[],o=0;n.length>o;)r=t(e=n[o]),u.add(r)&&i.push(e),o+=1;return i}),wr=br(fr),xr=s(function(t,n){var r,e;return t.length>n.length?(r=t,e=n):(r=n,e=t),wr(Kt(Zn(Ut)(r),e))}),Or=s(function(t,n){for(var r,e=0,u=n.length,i=[];u>e;)pn(t,r=n[e],i)||(i[i.length]=r),e+=1;return i}),jr=v(function(t,n,r){var e,u;n.length>r.length?(e=n,u=r):(e=r,u=n);for(var i=[],o=0;u.length>o;)pn(t,u[o],e)&&(i[i.length]=u[o]),o+=1;return Or(t,i)}),Ar=s(St("intersperse",function(t,n){for(var r=[],e=0,u=n.length;u>e;)e===u-1?r.push(n[e]):r.push(n[e],t),e+=1;return r})),Er="function"==typeof Object.assign?Object.assign:function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(t),r=1,e=arguments.length;e>r;){var u=arguments[r];if(null!=u)for(var i in u)N(i,u)&&(n[i]=u[i]);r+=1}return n},Sr=s(function(t,n){var r={};return r[t]=n,r}),_r=function(){var t={"@@transducer/init":Array,"@@transducer/step":function(t,n){return t.push(n),t},"@@transducer/result":ar},n={"@@transducer/init":String,"@@transducer/step":function(t,n){return t+n},"@@transducer/result":ar},r={"@@transducer/init":Object,"@@transducer/step":function(t,n){return Er(t,C(n)?Sr(n[0],n[1]):n)},"@@transducer/result":ar};return function(e){if(w(e))return e;if(C(e))return t;if("string"==typeof e)return n;if("object"==typeof e)return r;throw Error("Cannot create transformer for "+e)}}(),Fr=v(function(t,n,r){return w(t)?I(n(t),t["@@transducer/init"](),r):I(n(_r(t)),wt(t,[],[],!1),r)}),Cr=i(function(t){for(var n=T(t),r=n.length,e=0,u={};r>e;){var i=n[e],o=t[i],c=N(o,u)?u[o]:u[o]=[];c[c.length]=i,e+=1}return u}),qr=i(function(t){for(var n=T(t),r=n.length,e=0,u={};r>e;){var i=n[e];u[t[i]]=i,e+=1}return u}),Pr=s(function(t,n){return d(t+1,function(){var r=arguments[t];if(null!=r&&ot(r[n]))return r[n].apply(r,Array.prototype.slice.call(arguments,0,t));throw new TypeError(Zt(r)+' does not have a method named "'+n+'"')})}),Ir=s(function(t,n){return null!=n&&n.constructor===t||n instanceof t}),kr=i(function(t){return null!=t&&Bt(t,Tn(t))}),Nr=Pr(1,"join"),Wr=i(function(t){return en(function(){return Array.prototype.slice.call(arguments,0)},t)}),Tr=i(function(t){var n,r=[];for(n in t)r[r.length]=n;return r}),Vr=s(function(t,n){if("function"!=typeof n.lastIndexOf||b(n)){for(var r=n.length-1;r>=0;){if(Bt(n[r],t))return r;r-=1}return-1}return n.lastIndexOf(t)}),Rr=function(t){return"[object Number]"===Object.prototype.toString.call(t)},Br=i(function(t){return null!=t&&Rr(t.length)?t.length:NaN}),Dr=s(function(t,n){return function(r){return function(e){return V(function(t){return n(t,e)},r(t(e)))}}}),Ur=i(function(t){return Dr(Fn(t),gn(t))}),Mr=s(function(t,n){for(var r=n,e=0;t.length>e;){if(null==r)return;r=r[t[e]],e+=1}return r}),Lr=i(function(t){return Dr(Mr(t),et(t))}),zr=i(function(t){return Dr(R(t),tt(t))}),Kr=s(function(t,n){return n>t}),$r=s(function(t,n){return n>=t}),Hr=v(function(t,n,r){for(var e=0,u=r.length,i=[],o=[n];u>e;)o=t(o[0],r[e]),i[e]=o[1],e+=1;return[o[0],i]}),Jr=v(function(t,n,r){for(var e=r.length-1,u=[],i=[n];e>=0;)i=t(r[e],i[0]),u[e]=i[1],e-=1;return[u,i[0]]}),Xr=s(function(t,n){return I(function(r,e){return r[e]=t(n[e],e,n),r},{},T(n))}),Yr=s(function(t,n){return n.match(t)||[]}),Zr=s(function(t,n){return nt(t)?!nt(n)||1>n?NaN:(t%n+n)%n:NaN}),Gr=v(function(t,n,r){return t(r)>t(n)?r:n}),Qr=D(l,0),te=i(function(t){return Qr(t)/t.length}),ne=i(function(t){var n=t.length;if(0===n)return NaN;var r=2-n%2,e=(n-r)/2;return te(Array.prototype.slice.call(t,0).sort(function(t,n){return n>t?-1:t>n?1:0}).slice(e,e+r))}),re=s(function(t,n){var r={};return h(n.length,function(){var e=t.apply(this,arguments);return N(e,r)||(r[e]=n.apply(this,arguments)),r[e]})}),ee=re(function(){return Zt(arguments)}),ue=s(function(t,n){return Er({},t,n)}),ie=i(function(t){return Er.apply(null,[{}].concat(t))}),oe=v(function(t,n,r){var e,u={};for(e in n)N(e,n)&&(u[e]=N(e,r)?t(e,n[e],r[e]):n[e]);for(e in r)N(e,r)&&!N(e,u)&&(u[e]=r[e]);return u}),ce=v(function t(n,r,e){return oe(function(r,e,u){return $t(e)&&$t(u)?t(n,e,u):n(r,e,u)},r,e)}),ae=s(function(t,n){return ce(function(t,n,r){return n},t,n)}),fe=s(function(t,n){return ce(function(t,n,r){return r},t,n)}),se=v(function(t,n,r){return ce(function(n,r,e){return t(r,e)},n,r)}),le=v(function(t,n,r){return oe(function(n,r,e){return t(r,e)},n,r)}),pe=s(function(t,n){return t>n?n:t}),he=v(function(t,n,r){return t(r)<t(n)?r:n}),ye=s(function(t,n){return t%n}),de=s(function(t,n){return t*n}),ge=i(function(t){return-t}),ve=s(zt(x(["any"],L,z))),me=i(function(t){return d(0>t?1:t+1,function(){return Fn(t,arguments)})}),be=v(function(t,n,r){return t(n(r))}),we=i(function(t){return[t]}),xe=s(function(t,n){var r={};for(var e in n)Ut(e,t)||(r[e]=n[e]);return r}),Oe=i(function(t){var n,r=!1;return h(t.length,function(){return r?n:(r=!0,n=t.apply(this,arguments))})}),je=function(){var t=function(n){return{value:n,map:function(r){return t(r(n))}}};return v(function(n,r,e){return n(function(n){return t(r(n))})(e).value})}(),Ae=s(function(t,n){return[t,n]}),Ee=function(t){return s(function(n,r){return h(Math.max(0,n.length-r.length),function(){return n.apply(this,t(r,arguments))})})},Se=Ee(p),_e=Ee(Zn(p)),Fe=Wr([Jt,Xt]),Ce=v(function(t,n,r){return Bt(Mr(t,r),n)}),qe=v(function(t,n,r){return fn(t,Mr(n,r))}),Pe=v(function(t,n,r){return n.length>0&&t(Mr(n,r))}),Ie=s(function(t,n){for(var r={},e=0;t.length>e;)t[e]in n&&(r[t[e]]=n[t[e]]),e+=1;return r}),ke=s(function(t,n){for(var r={},e=0,u=t.length;u>e;){var i=t[e];r[i]=n[i],e+=1}return r}),Ne=s(function(t,n){var r={};for(var e in n)t(n[e],e,n)&&(r[e]=n[e]);return r}),We=s(function(t,n){return p([t],n)}),Te=D(de,1),Ve=s(function(t,n){return d(n.length,function(){for(var r=[],e=0;n.length>e;)r.push(n[e].call(this,arguments[e])),e+=1;return t.apply(this,r.concat(Array.prototype.slice.call(arguments,n.length)))})}),Re=Ve(_,[ke,fr]),Be=v(function(t,n,r){return Bt(n,r[t])}),De=v(function(t,n,r){return Ir(t,r[n])}),Ue=v(function(t,n,r){return null!=r&&N(n,r)?r[n]:t}),Me=v(function(t,n,r){return t(r[n])}),Le=s(function(t,n){for(var r=t.length,e=[],u=0;r>u;)e[u]=n[t[u]],u+=1;return e}),ze=s(function(t,n){if(!Rr(t)||!Rr(n))throw new TypeError("Both arguments to range must be numbers");for(var r=[],e=t;n>e;)r.push(e),e+=1;return r}),Ke=v(function(t,n,r){for(var e=r.length-1;e>=0;)n=t(r[e],n),e-=1;return n}),$e=y(4,[],function(t,n,r,e){return I(function(r,e){return t(r,e)?n(r,e):O(r)},r,e)}),He=i(O),Je=s(function(t,n){var r,e=+n,u=0;if(0>e||isNaN(e))throw new RangeError("n must be a non-negative number");for(r=Array(e);e>u;)r[u]=t(u),u+=1;return r}),Xe=s(function(t,n){return Je(o(t),n)}),Ye=v(function(t,n,r){return r.replace(t,n)}),Ze=v(function(t,n,r){for(var e=0,u=r.length,i=[n];u>e;)n=t(n,r[e]),i[e+1]=n,e+=1;return i}),Ge=s(function(t,n){return"function"==typeof n.sequence?n.sequence(t):Ke(function(t,n){return $(V(We,t),n)},t([]),n)}),Qe=v(function(t,n,r){return je(t,o(n),r)}),tu=s(function(t,n){return Array.prototype.slice.call(n,0).sort(t)}),nu=s(function(t,n){return Array.prototype.slice.call(n,0).sort(function(n,r){var e=t(n),u=t(r);return u>e?-1:e>u?1:0})}),ru=s(function(t,n){return Array.prototype.slice.call(n,0).sort(function(n,r){for(var e=0,u=0;0===e&&t.length>u;)e=t[u](n,r),u+=1;return e})}),eu=Pr(1,"split"),uu=s(function(t,n){return[_t(0,t,n),_t(t,Br(n),n)]}),iu=s(function(t,n){if(0>=t)throw Error("First argument to splitEvery must be a positive integer");for(var r=[],e=0;n.length>e;)r.push(_t(e,e+=t,n));return r}),ou=s(function(t,n){for(var r=0,e=n.length,u=[];e>r&&!t(n[r]);)u.push(n[r]),r+=1;return[u,Array.prototype.slice.call(n,r)]}),cu=s(function(t,n){return Bt(On(t.length,n),t)}),au=s(function(t,n){return+t-+n}),fu=s(function(t,n){return Gt(ln(t,n),ln(n,t))}),su=v(function(t,n,r){return Gt(hn(t,n,r),hn(t,r,n))}),lu=s(function(t,n){for(var r=n.length-1;r>=0&&t(n[r]);)r-=1;return Array.prototype.slice.call(n,r+1)}),pu=function(){function t(t,n){this.xf=n,this.f=t}return t.prototype["@@transducer/init"]=j.init,t.prototype["@@transducer/result"]=j.result,t.prototype["@@transducer/step"]=function(t,n){return this.f(n)?this.xf["@@transducer/step"](t,n):O(t)},s(function(n,r){return new t(n,r)})}(),hu=s(x(["takeWhile"],pu,function(t,n){for(var r=0,e=n.length;e>r&&t(n[r]);)r+=1;return Array.prototype.slice.call(n,0,r)})),yu=s(function(t,n){return t(n),n}),du=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},gu=s(function(t,n){if(!du(t))throw new TypeError("‘test’ requires a value of type RegExp as its first argument; received "+Zt(t));return mt(t).test(n)}),vu=Pr(0,"toLowerCase"),mu=i(function(t){var n=[];for(var r in t)N(r,t)&&(n[n.length]=[r,t[r]]);return n}),bu=i(function(t){var n=[];for(var r in t)n[n.length]=[r,t[r]];return n}),wu=Pr(0,"toUpperCase"),xu=d(4,function(t,n,r,e){return I(t("function"==typeof n?q(n):n),r,e)}),Ou=i(function(t){for(var n=0,r=[];t.length>n;){for(var e=t[n],u=0;e.length>u;)void 0===r[u]&&(r[u]=[]),r[u].push(e[u]),u+=1;n+=1}return r}),ju=v(function(t,n,r){return"function"==typeof r["fantasy-land/traverse"]?r["fantasy-land/traverse"](n,t):Ge(t,V(n,r))}),Au=function(){var t="\t\n\v\f\r \u2028\u2029\ufeff";return i(!("function"==typeof String.prototype.trim)||t.trim()?function(n){var r=RegExp("^["+t+"]["+t+"]*"),e=RegExp("["+t+"]["+t+"]*$");return n.replace(r,"").replace(e,"")}:function(t){return t.trim()})}(),Eu=s(function(t,n){return h(t.length,function(){try{return t.apply(this,arguments)}catch(t){return n.apply(this,p([t],arguments))}})}),Su=i(function(t){return function(){return t(Array.prototype.slice.call(arguments,0))}}),_u=i(function(t){return ut(1,t)}),Fu=s(function(t,n){return d(t,function(){for(var r,e=1,u=n,i=0;t>=e&&"function"==typeof u;)r=e===t?arguments.length:i+u.length,u=u.apply(this,Array.prototype.slice.call(arguments,i,r)),e+=1,i=r;return u})}),Cu=s(function(t,n){for(var r=t(n),e=[];r&&r.length;)e[e.length]=r[0],r=t(r[1]);return e}),qu=s(Pt(wr,p)),Pu=v(function(t,n,r){return Or(t,p(n,r))}),Iu=v(function(t,n,r){return t(r)?r:n(r)}),ku=gt(ar),Nu=v(function(t,n,r){for(var e=r;!t(e);)e=n(e);return e}),Wu=i(function(t){var n,r=[];for(n in t)r[r.length]=t[n];return r}),Tu=function(){var t=function(t){return{value:t,"fantasy-land/map":function(){return this}}};return s(function(n,r){return n(t)(r).value})}(),Vu=v(function(t,n,r){return t(r)?n(r):r}),Ru=s(function(t,n){for(var r in t)if(N(r,t)&&!t[r](n[r]))return!1;return!0}),Bu=s(function(t,n){return Ru(V(Bt,t),n)}),Du=s(function(t,n){return Xt(Zn(Ut)(t),n)}),Uu=s(function(t,n){for(var r,e=0,u=t.length,i=n.length,o=[];u>e;){for(r=0;i>r;)o[o.length]=[t[e],n[r]],r+=1;e+=1}return o}),Mu=s(function(t,n){for(var r=[],e=0,u=Math.min(t.length,n.length);u>e;)r[e]=[t[e],n[e]],e+=1;return r}),Lu=s(function(t,n){for(var r=0,e=Math.min(t.length,n.length),u={};e>r;)u[t[r]]=n[r],r+=1;return u}),zu=v(function(t,n,r){for(var e=[],u=0,i=Math.min(n.length,r.length);i>u;)e[u]=t(n[u],r[u]),u+=1;return e}),Ku={F:c,T:a,__:f,add:l,addIndex:g,adjust:m,all:E,allPass:U,always:o,and:M,any:z,anyPass:K,ap:$,aperture:J,append:X,apply:Y,applySpec:G,ascend:Q,assoc:tt,assocPath:et,binary:it,bind:P,both:ft,call:lt,chain:gt,clamp:vt,clone:xt,comparator:Ot,complement:At,compose:Pt,composeK:It,composeP:function(){if(0===arguments.length)throw Error("composeP requires at least one argument");return Nt.apply(this,qt(arguments))},concat:Gt,cond:Qt,construct:nn,constructN:tn,contains:rn,converge:en,countBy:cn,curry:st,curryN:d,dec:an,defaultTo:fn,descend:sn,difference:ln,differenceWith:hn,dissoc:yn,dissocPath:vn,divide:mn,drop:wn,dropLast:An,dropLastWhile:Sn,dropRepeats:Pn,dropRepeatsWith:qn,dropWhile:kn,either:Wn,empty:Tn,endsWith:Rn,eqBy:Bn,eqProps:Dn,equals:Bt,evolve:Un,filter:Jt,find:Ln,findIndex:Kn,findLast:Hn,findLastIndex:Xn,flatten:Yn,flip:Zn,forEach:Gn,forEachObjIndexed:Qn,fromPairs:tr,groupBy:nr,groupWith:rr,gt:er,gte:ur,has:ir,hasIn:or,head:cr,identical:Vt,identity:fr,ifElse:sr,inc:lr,indexBy:pr,indexOf:hr,init:yr,innerJoin:dr,insert:gr,insertAll:vr,intersection:xr,intersectionWith:jr,intersperse:Ar,into:Fr,invert:Cr,invertObj:qr,invoker:Pr,is:Ir,isEmpty:kr,isNil:rt,join:Nr,juxt:Wr,keys:T,keysIn:Tr,last:Cn,lastIndexOf:Vr,length:Br,lens:Dr,lensIndex:Ur,lensPath:Lr,lensProp:zr,lift:at,liftN:ct,lt:Kr,lte:$r,map:V,mapAccum:Hr,mapAccumRight:Jr,mapObjIndexed:Xr,match:Yr,mathMod:Zr,max:S,maxBy:Gr,mean:te,median:ne,memoize:ee,memoizeWith:re,merge:ue,mergeAll:ie,mergeDeepLeft:ae,mergeDeepRight:fe,mergeDeepWith:se,mergeDeepWithKey:ce,mergeWith:le,mergeWithKey:oe,min:pe,minBy:he,modulo:ye,multiply:de,nAry:ut,negate:ge,none:ve,not:jt,nth:Fn,nthArg:me,o:be,objOf:Sr,of:we,omit:xe,once:Oe,or:Nn,over:je,pair:Ae,partial:Se,partialRight:_e,partition:Fe,path:Mr,pathEq:Ce,pathOr:qe,pathSatisfies:Pe,pick:Ie,pickAll:ke,pickBy:Ne,pipe:Ct,pipeK:function(){if(0===arguments.length)throw Error("pipeK requires at least one argument");return It.apply(this,qt(arguments))},pipeP:Nt,pluck:B,prepend:We,product:Te,project:Re,prop:R,propEq:Be,propIs:De,propOr:Ue,propSatisfies:Me,props:Le,range:ze,reduce:D,reduceBy:on,reduceRight:Ke,reduceWhile:$e,reduced:He,reject:Xt,remove:dn,repeat:Xe,replace:Ye,reverse:qt,scan:Ze,sequence:Ge,set:Qe,slice:_t,sort:tu,sortBy:nu,sortWith:ru,split:eu,splitAt:uu,splitEvery:iu,splitWhen:ou,startsWith:cu,subtract:au,sum:Qr,symmetricDifference:fu,symmetricDifferenceWith:su,tail:Ft,take:On,takeLast:Vn,takeLastWhile:lu,takeWhile:hu,tap:yu,test:gu,times:Je,toLower:vu,toPairs:mu,toPairsIn:bu,toString:Zt,toUpper:wu,transduce:xu,transpose:Ou,traverse:ju,trim:Au,tryCatch:Eu,type:bt,unapply:Su,unary:_u,uncurryN:Fu,unfold:Cu,union:qu,unionWith:Pu,uniq:wr,uniqBy:br,uniqWith:Or,unless:Iu,unnest:ku,until:Nu,update:gn,useWith:Ve,values:Z,valuesIn:Wu,view:Tu,when:Vu,where:Ru,whereEq:Bu,without:Du,xprod:Uu,zip:Mu,zipObj:Lu,zipWith:zu},$u=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")},Hu=Object.assign||function(t){for(var n=1;arguments.length>n;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},Ju=function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n)},Xu=function(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?t:n},Yu=Ku.path(["target","value"]),Zu=["onBlur","onFocus"],Gu=Ku.ifElse(function(t){return Ku.has("nativeEvent",t)},Yu,Ku.identity),Qu=function(t){function n(r){$u(this,n);var e=Xu(this,t.call(this,r));return e.updateError=function(t){var n=Gu(t),r=e.props,u=r.validate;(0,r.updateFormError)(u(n))},e.onChange=function(t){var n=Gu(t);return"onChange"===e.props.validateOn&&e.updateError(t),e.props.updateFormValue(n)},e.getErrorProps=function(){return{error:e.props.error,role:"alert"}},e.getLabelProps=function(){return{htmlFor:e.props.id}},e.getInputProps=function(){var t={value:e.props.value,onChange:e.onChange,id:e.props.id};if(Ku.contains(e.props.validateOn,Zu)){var n;return Hu({},t,(n={},n[e.props.validateOn]=e.updateError,n))}return t},e.getInputValues=function(){return{error:e.props.error}},e.state={},e}return Ju(n,t),n.prototype.render=function(){var t=this.props.render,n={getInputProps:this.getInputProps,getInputValues:this.getInputValues,error:this.props.error};return t.prototype.render?new t(n):t(n)},n}(n.Component);Qu.displayName="Field",Qu.defaultProps={render:function(){return null}},Qu.propTypes={updateFormValue:r.func,updateFormError:r.func,validateOn:r.oneOf(["onBlur","onSubmit","onChange","onFocus"]),validate:r.func,render:r.func};var ti=e.cloneElement,ni=function(){},ri=function(t){return"Field"===t.type.name},ei=function(t){function n(r){$u(this,n);var e=Xu(this,t.call(this,r));return ui.call(e),e.state={formValues:{},formErrors:{}},e}return Ju(n,t),n.prototype.render=function(){var t=this,n=this.props.children,r=e.Children.map(n,function(n){var r=n.props,e=r.id,u=r.validate,i=r.validateOn;return ri(n)?ti(n,{updateFormValue:t.updateFormValue(e),updateFormError:t.updateFormError(e),value:t.state.formValues[e]||"",error:t.state.formErrors[e]||"",validateOn:i||t.props.validateOn,validate:u||t.props.validate}):n});return e.createElement("form",{onSubmit:this.handleSubmit},r)},n}(n.Component),ui=function(){var t=this;this.updateFormState=function(n){t.props.onChange(n),t.setState(n)},this.updateFormValue=function(n){return function(r){var e,u=Ku.mergeDeepRight(t.state,{formValues:(e={},e[n]=r,e)});t.updateFormState(u)}},this.updateFormError=function(n){return function(r){var e,u=r?Ku.mergeDeepRight(t.state,{formErrors:(e={},e[n]=r,e)}):t.state;t.updateFormState(u)}},this.updateChildErrorsOnSubmit=function(){var n=e.Children.toArray(t.props.children).filter(ri);if("onSubmit"===t.props.validateOn){var r=n.map(function(t){var n,r=t.props,e=r.id,u=r.validate,i=r.value;if(!r.validateOn||"onSubmit"===r.validateOn){var o=u(i);return o?(n={},n[e]=o,n):{}}});return t.setState({formErrors:Ku.mergeAll(r)})}},this.handleSubmit=function(n){n.preventDefault();var r=e.Children.toArray(t.props.children).filter(ri),u=t.state.formErrors;r.every(function(t){var n=t.props,r=n.id,e=n.validate,i=void 0===e?function(){return""}:e,o=n.value;return!u[r]&&!i(o)})?t.props.onSubmit({formValues:t.state.formValues,isValid:!0}):(t.props.onSubmit({formValues:t.state.formValues,isValid:!1}),t.updateChildErrorsOnSubmit())}};ei.displayName="Form",ei.propTypes={onChange:r.func,onSubmit:r.func,validate:r.func,validateOn:r.string},ei.defaultProps={onChange:ni,onSubmit:ni,validate:function(){return""}},ei.Field=Qu,t.Form=ei,Object.defineProperty(t,"__esModule",{value:!0})}); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
355119
9769
37
1