forked from Stock-control-supervisors/awesome-go
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
1607-5c7ce92db387eb88.js.download
1 lines (1 loc) · 11.4 KB
/
1607-5c7ce92db387eb88.js.download
1
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1607],{71607:function(n,t,r){r.d(t,{mI:function(){return D},IX:function(){return K},O7:function(){return x},mM:function(){return F},i0:function(){return B},pk:function(){return E},wY:function(){return Y},Z_:function(){return R},dt:function(){return V},S1:function(){return S},G0:function(){return X}});Object.prototype.hasOwnProperty;var e,i,u,o,a,c,f,s,l=function(n){return{_tag:"Right",right:n}},p=function(n){return"Left"===n._tag},v=(e=function(n,t){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),y=function(){return(y=Object.assign||function(n){for(var t,r=1,e=arguments.length;r<e;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}).apply(this,arguments)},h=function(n){return{_tag:"Left",left:n}},g=function(n,t,r){return h([{value:n,context:t,message:r}])},d=function(){function n(n,t,r,e){this.name=n,this.is=t,this.validate=r,this.encode=e,this.decode=this.decode.bind(this)}return n.prototype.pipe=function(t,r){var e=this;return void 0===r&&(r="pipe("+this.name+", "+t.name+")"),new n(r,t.is,function(n,r){var i=e.validate(n,r);return p(i)?i:t.validate(i.right,r)},this.encode===_&&t.encode===_?_:function(n){return e.encode(t.encode(n))})},n.prototype.asDecoder=function(){return this},n.prototype.asEncoder=function(){return this},n.prototype.decode=function(n){return this.validate(n,[{key:"",type:this,actual:n}])},n}(),_=function(n){return n};function T(n,t,r,e){for(var i=n.length,u=Array(i+1),o=0;o<i;o++)u[o]=n[o];return u[i]={key:t,type:r,actual:e},u}function w(n,t){for(var r=t.length,e=0;e<r;e++)n.push(t[e])}var b=Object.prototype.hasOwnProperty;function O(n){return Object.keys(n).map(function(t){return t+": "+n[t].name}).join(", ")}function m(n){for(var t=0;t<n.length;t++)if(n[t].encode!==_)return!1;return!0}function j(n,t){for(var r=Object.getOwnPropertyNames(n),e=!1,i={},u=0;u<r.length;u++){var o=r[u];b.call(t,o)?i[o]=n[o]:e=!0}return e?i:n}var k={};function I(n,t){for(var r=[],e=0;e<n.length;e++){var i=n[e];-1!==t.indexOf(i)&&r.push(i)}return r}function P(n){return"InterfaceType"===n._tag}var A=[];function N(n){if(-1!==A.indexOf(n))return k;if(P(n)||"StrictType"===n._tag){var t=k;for(var r in n.props){var e=n.props[r];"LiteralType"===e._tag&&(t===k&&(t={}),t[r]=[e.value])}return t}if("ExactType"===n._tag||"RefinementType"===n._tag)return N(n.type);if("IntersectionType"===n._tag)return n.types.reduce(function(n,t){return function(n,t){if(n===k)return t;if(t===k)return n;var r=Object.assign({},n);for(var e in t)if(n.hasOwnProperty(e)){var i=I(n[e],t[e]);if(i.length>0)r[e]=i;else{r=k;break}}else r[e]=t[e];return r}(n,N(t))},k);if("UnionType"===n._tag)return n.types.slice(1).reduce(function(n,t){return function(n,t){if(n===k||t===k)return k;var r=k;for(var e in n)t.hasOwnProperty(e)&&0===I(n[e],t[e]).length&&(r===k&&(r={}),r[e]=n[e].concat(t[e]));return r}(n,N(t))},N(n.types[0]));if("RecursiveType"===n._tag){A.push(n);var i=N(n.type);return A.pop(),i}return k}new(function(n){function t(){var t=n.call(this,"null",function(n){return null===n},function(n,r){return t.is(n)?l(n):g(n,r)},_)||this;return t._tag="NullType",t}return v(t,n),t}(d));var S=new(function(n){function t(){var t=n.call(this,"undefined",function(n){return void 0===n},function(n,r){return t.is(n)?l(n):g(n,r)},_)||this;return t._tag="UndefinedType",t}return v(t,n),t}(d));new(function(n){function t(){var t=n.call(this,"void",S.is,S.validate,_)||this;return t._tag="VoidType",t}return v(t,n),t}(d)),new(function(n){function t(){var t=n.call(this,"unknown",function(n){return!0},l,_)||this;return t._tag="UnknownType",t}return v(t,n),t}(d));var R=new(function(n){function t(){var t=n.call(this,"string",function(n){return"string"==typeof n},function(n,r){return t.is(n)?l(n):g(n,r)},_)||this;return t._tag="StringType",t}return v(t,n),t}(d)),E=new(function(n){function t(){var t=n.call(this,"number",function(n){return"number"==typeof n},function(n,r){return t.is(n)?l(n):g(n,r)},_)||this;return t._tag="NumberType",t}return v(t,n),t}(d));new(function(n){function t(){var t=n.call(this,"bigint",function(n){return"bigint"==typeof n},function(n,r){return t.is(n)?l(n):g(n,r)},_)||this;return t._tag="BigIntType",t}return v(t,n),t}(d));var x=new(function(n){function t(){var t=n.call(this,"boolean",function(n){return"boolean"==typeof n},function(n,r){return t.is(n)?l(n):g(n,r)},_)||this;return t._tag="BooleanType",t}return v(t,n),t}(d)),U=new(function(n){function t(){var t=n.call(this,"UnknownArray",Array.isArray,function(n,r){return t.is(n)?l(n):g(n,r)},_)||this;return t._tag="AnyArrayType",t}return v(t,n),t}(d)),D=new(function(n){function t(){var t=n.call(this,"UnknownRecord",function(n){var t=Object.prototype.toString.call(n);return"[object Object]"===t||"[object Window]"===t},function(n,r){return t.is(n)?l(n):g(n,r)},_)||this;return t._tag="AnyDictionaryType",t}return v(t,n),t}(d)),L=function(n){function t(t,r,e,i,u){var o=n.call(this,t,r,e,i)||this;return o.value=u,o._tag="LiteralType",o}return v(t,n),t}(d);function B(n,t){void 0===t&&(t=JSON.stringify(n));var r=function(t){return t===n};return new L(t,r,function(t,e){return r(t)?l(n):g(t,e)},_,n)}var C=function(n){function t(t,r,e,i,u){var o=n.call(this,t,r,e,i)||this;return o.keys=u,o._tag="KeyofType",o}return v(t,n),t}(d);function F(n,t){void 0===t&&(t=Object.keys(n).map(function(n){return JSON.stringify(n)}).join(" | "));var r=function(t){return R.is(t)&&b.call(n,t)};return new C(t,r,function(n,t){return r(n)?l(n):g(n,t)},_,n)}var J=function(n){function t(t,r,e,i,u,o){var a=n.call(this,t,r,e,i)||this;return a.type=u,a.predicate=o,a._tag="RefinementType",a}return v(t,n),t}(d);z(E,function(n){return Number.isInteger(n)},"Int"),Object.defineProperty(function(n){function t(t,r,e,i,u){var o=n.call(this,t,r,e,i)||this;return o.runDefinition=u,o._tag="RecursiveType",o}return v(t,n),t}(d).prototype,"type",{get:function(){return this.runDefinition()},enumerable:!0,configurable:!0});var G=function(n){function t(t,r,e,i,u){var o=n.call(this,t,r,e,i)||this;return o.type=u,o._tag="ArrayType",o}return v(t,n),t}(d);function K(n,t){return void 0===t&&(t="Array<"+n.name+">"),new G(t,function(t){return U.is(t)&&t.every(n.is)},function(t,r){var e=U.validate(t,r);if(p(e))return e;for(var i=e.right,u=i.length,o=i,a=[],c=0;c<u;c++){var f=i[c],s=n.validate(f,T(r,String(c),n,f));if(p(s))w(a,s.left);else{var v=s.right;v!==f&&(o===i&&(o=i.slice()),o[c]=v)}}return a.length>0?h(a):l(o)},n.encode===_?_:function(t){return t.map(n.encode)},n)}var M=function(n){function t(t,r,e,i,u){var o=n.call(this,t,r,e,i)||this;return o.props=u,o._tag="InterfaceType",o}return v(t,n),t}(d);function V(n,t){void 0===t&&(t="{ "+O(n)+" }");var r=Object.keys(n),e=r.map(function(t){return n[t]}),i=r.length;return new M(t,function(n){if(D.is(n)){for(var t=0;t<i;t++){var u=r[t],o=n[u];if(void 0===o&&!b.call(n,u)||!e[t].is(o))return!1}return!0}return!1},function(n,t){var u=D.validate(n,t);if(p(u))return u;for(var o=u.right,a=o,c=[],f=0;f<i;f++){var s=r[f],v=a[s],g=e[f],d=g.validate(v,T(t,s,g,v));if(p(d))w(c,d.left);else{var _=d.right;_===v&&(void 0!==_||b.call(a,s))||(a===o&&(a=y({},o)),a[s]=_)}}return c.length>0?h(c):l(a)},m(e)?_:function(n){for(var t=y({},n),u=0;u<i;u++){var o=r[u],a=e[u].encode;a!==_&&(t[o]=a(n[o]))}return t},n)}v(function(n,t,r,e,u){var o=i.call(this,n,t,r,e)||this;return o.props=u,o._tag="PartialType",o},i=d),v(function(n,t,r,e,i,o){var a=u.call(this,n,t,r,e)||this;return a.domain=i,a.codomain=o,a._tag="DictionaryType",a},u=d);var W=function(n){function t(t,r,e,i,u){var o=n.call(this,t,r,e,i)||this;return o.types=u,o._tag="UnionType",o}return v(t,n),t}(d);function X(n,t){void 0===t&&(t="("+n.map(function(n){return n.name}).join(" | ")+")");var r=function(n){for(var t=N(n[0]),r=Object.keys(t),e=n.length,i=0;i<r.length;i++){var u=function(r){for(var i=t[r].slice(),u=[t[r]],o=1;o<e;o++){var a=N(n[o])[r];if(void 0===a||a.some(function(n){return -1!==i.indexOf(n)}))return"continue-keys";i.push.apply(i,a),u.push(a)}return{value:[r,u]}}(r[i]);if("object"==typeof u)return u.value;if("continue-keys"===u)continue}}(n);if(void 0===r||!(n.length>0))return new W(t,function(t){return n.some(function(n){return n.is(t)})},function(t,r){for(var e=[],i=0;i<n.length;i++){var u=n[i],o=u.validate(t,T(r,String(i),u,t));if(!p(o))return l(o.right);w(e,o.left)}return h(e)},m(n)?_:function(r){for(var e=0;e<n.length;e++){var i=n[e];if(i.is(r))return i.encode(r)}throw Error("no codec found to encode value in union type "+t)},n);var e=r[0],i=r[1],u=i.length,o=function(n){for(var t=0;t<u;t++)if(-1!==i[t].indexOf(n))return t};return new q(t,function(t){if(D.is(t)){var r=o(t[e]);return void 0!==r&&n[r].is(t)}return!1},function(t,r){var i=D.validate(t,r);if(p(i))return i;var u=i.right,a=o(u[e]);if(void 0===a)return g(t,r);var c=n[a];return c.validate(u,T(r,String(a),c,u))},m(n)?_:function(r){var i=o(r[e]);if(void 0!==i)return n[i].encode(r);throw Error("no codec found to encode value in union codec "+t)},n,e)}v(function(n,t,r,e,i){var u=o.call(this,n,t,r,e)||this;return u.types=i,u._tag="IntersectionType",u},o=d),v(function(n,t,r,e,i){var u=a.call(this,n,t,r,e)||this;return u.types=i,u._tag="TupleType",u},a=d),v(function(n,t,r,e,i){var u=c.call(this,n,t,r,e)||this;return u.type=i,u._tag="ReadonlyType",u},c=d),v(function(n,t,r,e,i){var u=f.call(this,n,t,r,e)||this;return u.type=i,u._tag="ReadonlyArrayType",u},f=d);var Y=function(n,t){var r,e,i,u;return r=V(n),void 0===(e=t)&&(e=P(u=r)?"{| "+O(u.props)+" |}":"PartialType"===u._tag?"Partial<{| "+O(u.props)+" |}>":"Exact<"+u.name+">"),i=function n(t){switch(t._tag){case"RefinementType":case"ReadonlyType":return n(t.type);case"InterfaceType":case"StrictType":case"PartialType":return t.props;case"IntersectionType":return t.types.reduce(function(t,r){return Object.assign(t,n(r))},{})}}(r),new Z(e,r.is,function(n,t){var e=D.validate(n,t);if(p(e))return e;var u=r.validate(n,t);return p(u)?u:l(j(u.right,i))},function(n){return r.encode(j(n,i))},r)},Z=function(n){function t(t,r,e,i,u){var o=n.call(this,t,r,e,i)||this;return o.type=u,o._tag="ExactType",o}return v(t,n),t}(d);new(function(n){function t(){var t=n.call(this,"Function",function(n){return"function"==typeof n},function(n,r){return t.is(n)?l(n):g(n,r)},_)||this;return t._tag="FunctionType",t}return v(t,n),t}(d));var q=function(n){function t(t,r,e,i,u,o){var a=n.call(this,t,r,e,i,u)||this;return a.tag=o,a}return v(t,n),t}(W);function z(n,t,r){return void 0===r&&(r="("+n.name+" | "+(t.displayName||t.name||"<function"+t.length+">")+")"),new J(r,function(r){return n.is(r)&&t(r)},function(r,e){var i=n.validate(r,e);if(p(i))return i;var u=i.right;return t(u)?l(u):g(u,e)},n.encode,n,t)}new(function(n){function t(){var t=n.call(this,"never",function(n){return!1},function(n,t){return g(n,t)},function(){throw Error("cannot encode never")})||this;return t._tag="NeverType",t}return v(t,n),t}(d)),new(function(n){function t(){var t=n.call(this,"any",function(n){return!0},l,_)||this;return t._tag="AnyType",t}return v(t,n),t}(d)),new(function(n){function t(){var t=n.call(this,"object",function(n){return null!==n&&"object"==typeof n},function(n,r){return t.is(n)?l(n):g(n,r)},_)||this;return t._tag="ObjectType",t}return v(t,n),t}(d)),z(E,Number.isInteger,"Integer"),v(function(n,t,r,e,i){var u=s.call(this,n,t,r,e)||this;return u.props=i,u._tag="StrictType",u},s=d)}}]);