/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/flow-io@0.1.0/lib/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.object=exports.$exact=exports.intersection=exports.mapping=exports.recursion=exports.refinement=exports.maybe=exports.tuple=exports.union=exports.array=exports.classOf=exports.instanceOf=exports.literal=exports.Function=exports.Object=exports.void=exports.null=exports.boolean=exports.number=exports.string=exports.any=exports.is=exports.fromValidation=exports.validate=exports.validateWithContext=exports.fold=exports.chain=exports.ap=exports.map=exports.of=exports.fromSuccess=exports.fromFailure=exports.isSuccess=exports.isFailure=exports.success=exports.failure=exports.failures=exports.getTypeName=exports.getDefaultContext=exports.getContextEntry=exports.getFunctionName=exports.unsafeCoerce=exports.ObjectType=exports.$ExactType=exports.RefinementType=exports.MappingType=exports.MaybeType=exports.IntersectionType=exports.TupleType=exports.UnionType=exports.ArrayType=exports.ClassType=exports.InstanceOfType=exports.LiteralType=exports.Type=void 0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_Either=require("flow-static-land/lib/Either"),either=_interopRequireWildcard(_Either),_Unsafe=require("flow-static-land/lib/Unsafe");function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Type=exports.Type=function e(t,r){_classCallCheck(this,e),this.name=t,this.validate=r};function getValidationError(e,t){return{value:e,context:t}}function pushAll(e,t){Array.prototype.push.apply(e,t)}function checkAdditionalProps(e,t,r){var n=[];for(var o in t)e.hasOwnProperty(o)||n.push(getValidationError(t[o],r.concat(getContextEntry(o,nil))));return n}function getFunctionName(e){return e.displayName||e.name||"<function"+e.length+">"}function getContextEntry(e,t){return{key:e,type:t}}function getDefaultContext(e){return[{key:"",type:e}]}function getTypeName(e){return e.name}function failures(e){return either.left(e)}function failure(e,t){return either.left([getValidationError(e,t)])}function success(e){return either.right(e)}function isFailure(e){return either.isLeft(e)}function isSuccess(e){return either.isRight(e)}function fromFailure(e){return either.fromLeft(e)}function fromSuccess(e){return either.fromRight(e)}function of(e){return either.of(e)}function map(e,t){return either.map(e,t)}function ap(e,t){return either.ap(e,t)}function chain(e,t){return either.chain(e,t)}function fold(e,t,r){return isFailure(r)?e(fromFailure(r)):t(fromSuccess(r))}function validateWithContext(e,t,r){return r.validate(e,t)}function validate(e,t){return validateWithContext(e,getDefaultContext(t),t)}function fromValidation(e,t){return fromSuccess(validate(e,t))}function is(e,t){return isSuccess(validate(e,t))}var LiteralType=exports.LiteralType=function(){function e(t,r,n){_classCallCheck(this,e);var o=_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return o.value=n,o}return _inherits(e,Type),e}();function literal(e){return new LiteralType(JSON.stringify(e),(function(t,r){return t===e?success(e):failure(t,r)}),e)}var InstanceOfType=exports.InstanceOfType=function(){function e(t,r,n){_classCallCheck(this,e);var o=_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return o.ctor=n,o}return _inherits(e,Type),e}();function instanceOf(e,t){return new InstanceOfType(t||getFunctionName(e),(function(t,r){return t instanceof e?success(t):failure(t,r)}),e)}var ClassType=exports.ClassType=function(){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return _inherits(e,Type),e}();function classOf(e,t){var r=refinement(functionType,(function(t){return t===e||t.prototype instanceof e}),t);return new ClassType(t||"Class<"+getFunctionName(e)+">",(function(e,t){return r.validate(e,t)}),e)}function isNil(e){return null==e}var nullType=new Type("null",(function(e,t){return null===e?success(e):failure(e,t)})),voidType=new Type("void",(function(e,t){return void 0===e?success(e):failure(e,t)})),nil=new Type("nil",(function(e,t){return isNil(e)?success(e):failure(e,t)})),any=new Type("any",(function(e,t){return success(e)})),string=new Type("string",(function(e,t){return"string"==typeof e?success(e):failure(e,t)})),number=new Type("number",(function(e,t){return"number"==typeof e&&isFinite(e)&&!isNaN(e)?success(e):failure(e,t)})),boolean=new Type("boolean",(function(e,t){return"boolean"==typeof e?success(e):failure(e,t)})),arrayType=new Type("Array",(function(e,t){return Array.isArray(e)?success(e):failure(e,t)})),objectType=new Type("Object",(function(e,t){return isNil(e)||"object"!==(void 0===e?"undefined":_typeof(e))||Array.isArray(e)?failure(e,t):success(e)})),functionType=new Type("Function",(function(e,t){return"function"==typeof e?success(e):failure(e,t)})),ArrayType=exports.ArrayType=function(){function e(t,r,n){_classCallCheck(this,e);var o=_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return o.type=n,o}return _inherits(e,Type),e}();function array(e,t){return new ArrayType(t||"Array<"+getTypeName(e)+">",(function(t,r){return either.chain((function(t){for(var n=[],o=[],i=!1,s=0,a=t.length;s<a;s++){var u=t[s],c=e.validate(u,r.concat(getContextEntry(String(s),e)));if(isFailure(c))pushAll(o,fromFailure(c));else{var p=fromSuccess(c);i=i||p!==u,n.push(p)}}return o.length?failures(o):success(i?n:(0,_Unsafe.unsafeCoerce)(t))}),arrayType.validate(t,r))}),e)}var UnionType=exports.UnionType=function(){function e(t,r,n){_classCallCheck(this,e);var o=_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return o.types=n,o}return _inherits(e,Type),e}();function union(e,t){return new UnionType(t||"("+e.map(getTypeName).join(" | ")+")",(function(t,r){for(var n=0,o=e.length;n<o;n++){var i=e[n].validate(t,r);if(isSuccess(i))return i}return failure(t,r)}),e)}var TupleType=exports.TupleType=function(){function e(t,r,n){_classCallCheck(this,e);var o=_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return o.types=n,o}return _inherits(e,Type),e}();function tuple(e,t){return new TupleType(t||"["+e.map(getTypeName).join(", ")+"]",(function(t,r){return either.chain((function(t){for(var n=[],o=[],i=!1,s=0,a=e.length;s<a;s++){var u=t[s],c=e[s],p=c.validate(u,r.concat(getContextEntry(String(s),c)));if(isFailure(p))pushAll(o,fromFailure(p));else{var l=fromSuccess(p);i=i||l!==u,n.push(l)}}return o.length?failures(o):success(i?n:t)}),arrayType.validate(t,r))}),e)}var IntersectionType=exports.IntersectionType=function(){function e(t,r,n){_classCallCheck(this,e);var o=_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return o.types=n,o}return _inherits(e,Type),e}();function intersection(e,t){return new IntersectionType(t||"("+e.map(getTypeName).join(" & ")+")",(function(t,r){for(var n=t,o=!1,i=[],s=0,a=e.length;s<a;s++){var u=e[s],c=u.validate(n,r.concat(getContextEntry(String(s),u)));if(isFailure(c))pushAll(i,fromFailure(c));else{var p=fromSuccess(c);o=o||p!==n,n=p}}return i.length?failures(i):success(o?n:t)}),e)}var MaybeType=exports.MaybeType=function(){function e(t,r,n){_classCallCheck(this,e);var o=_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return o.type=n,o}return _inherits(e,Type),e}();function maybe(e,t){return new MaybeType(t||"?"+getTypeName(e),(function(t,r){return(0,_Unsafe.unsafeCoerce)(isNil(t)?success(t):e.validate(t,r))}),e)}var MappingType=exports.MappingType=function(){function e(t,r,n,o){_classCallCheck(this,e);var i=_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return i.domain=n,i.codomain=o,i}return _inherits(e,Type),e}();function mapping(e,t,r){return new MappingType(r||"{ [key: "+getTypeName(e)+"]: "+getTypeName(t)+" }",(function(r,n){return either.chain((function(r){var o={},i=[],s=!1;for(var a in r){var u=r[a],c=e.validate(a,n.concat(getContextEntry(a,e))),p=t.validate(u,n.concat(getContextEntry(a,t)));if(isFailure(c))pushAll(i,fromFailure(c));else{var l=fromSuccess(c);s=s||l!==a,a=l}if(isFailure(p))pushAll(i,fromFailure(p));else{var f=fromSuccess(p);s=s||f!==u,o[a]=f}}return i.length?failures(i):success(s?o:r)}),objectType.validate(r,n))}),e,t)}var RefinementType=exports.RefinementType=function(){function e(t,r,n,o){_classCallCheck(this,e);var i=_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return i.type=n,i.predicate=o,i}return _inherits(e,Type),e}();function refinement(e,t,r){return new RefinementType(r||"("+getTypeName(e)+" | "+getFunctionName(t)+")",(function(r,n){return either.chain((function(e){return t(e)?success(e):failure(r,n)}),e.validate(r,n))}),e,t)}function recursion(e,t){var r=t(new Type(e,(function(e,t){return r.validate(e,t)})));return r.name=e,r}var $ExactType=exports.$ExactType=function(){function e(t,r,n){_classCallCheck(this,e);var o=_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return o.props=n,o}return _inherits(e,Type),e}();function $exact(e,t){t=t||"$Exact<"+getDefaultObjectTypeName(e)+">";var r=object(e,t);return new $ExactType(t,(function(t,n){return either.chain((function(t){var r=checkAdditionalProps(e,t,n);return r.length?failures(r):success((0,_Unsafe.unsafeCoerce)(t))}),r.validate(t,n))}),e)}var ObjectType=exports.ObjectType=function(){function e(t,r,n){_classCallCheck(this,e);var o=_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return o.props=n,o}return _inherits(e,Type),e}();function getDefaultObjectTypeName(e){return"{ "+Object.keys(e).map((function(t){return t+": "+e[t].name})).join(", ")+" }"}function object(e,t){return new ObjectType(t||getDefaultObjectTypeName(e),(function(t,r){return either.chain((function(t){var n=Object.assign({},t),o=[],i=!1;for(var s in e){var a=t[s],u=e[s],c=u.validate(a,r.concat(getContextEntry(s,u)));if(isFailure(c))pushAll(o,fromFailure(c));else{var p=fromSuccess(c);i=i||p!==a,n[s]=p}}return o.length?failures(o):success(i?n:t)}),objectType.validate(t,r))}),e)}exports.unsafeCoerce=_Unsafe.unsafeCoerce,exports.getFunctionName=getFunctionName,exports.getContextEntry=getContextEntry,exports.getDefaultContext=getDefaultContext,exports.getTypeName=getTypeName,exports.failures=failures,exports.failure=failure,exports.success=success,exports.isFailure=isFailure,exports.isSuccess=isSuccess,exports.fromFailure=fromFailure,exports.fromSuccess=fromSuccess,exports.of=of,exports.map=map,exports.ap=ap,exports.chain=chain,exports.fold=fold,exports.validateWithContext=validateWithContext,exports.validate=validate,exports.fromValidation=fromValidation,exports.is=is,exports.any=any,exports.string=string,exports.number=number,exports.boolean=boolean,exports.null=nullType,exports.void=voidType,exports.Object=objectType,exports.Function=functionType,exports.literal=literal,exports.instanceOf=instanceOf,exports.classOf=classOf,exports.array=array,exports.union=union,exports.tuple=tuple,exports.maybe=maybe,exports.refinement=refinement,exports.recursion=recursion,exports.mapping=mapping,exports.intersection=intersection,exports.$exact=$exact,exports.object=object;
//# sourceMappingURL=/sm/bcebe3faba98f66e90665c6f1fb9d3ec5c408fe0787aa9bea61221ba3904c634.map