Comparing version 0.3.0 to 0.4.0
@@ -20,3 +20,3 @@ // Generated by BUCKLESCRIPT VERSION 5.0.4, PLEASE EDIT WITH CARE | ||
var randomAccount = "0x160c5ce58e2cc4fe7cc45a9dd569a10083b2a275"; | ||
var randomAccount = "0x2036c6cd85692f0fb2c26e6c6b2eced9e4478dfd"; | ||
@@ -27,2 +27,4 @@ var primaryAddress = /* record */[/* contents */randomAccount]; | ||
var lastTx = /* record */[/* contents */"0x"]; | ||
Jest.beforeAllPromise(undefined, (function (param) { | ||
@@ -119,3 +121,3 @@ return Repromise.Rejectable[/* toJsPromise */11](Repromise.map((function (result) { | ||
Jest.describe("#getTransactionCount", (function (param) { | ||
Jest.describe("#transactionCount", (function (param) { | ||
Jest.testPromise("with 1 transaction", undefined, (function (param) { | ||
@@ -128,3 +130,3 @@ return Repromise.Rejectable[/* toJsPromise */11](Repromise.map((function (result) { | ||
} | ||
}), Eth$BsEth.getTransactionCount(provider, primaryAddress[0], undefined, /* () */0))); | ||
}), Eth$BsEth.transactionCount(provider, primaryAddress[0], undefined, /* () */0))); | ||
})); | ||
@@ -138,3 +140,3 @@ return Jest.testPromise("with no transactions", undefined, (function (param) { | ||
} | ||
}), Eth$BsEth.getTransactionCount(provider, primaryAddress[0], /* Block */[0], /* () */0))); | ||
}), Eth$BsEth.transactionCount(provider, primaryAddress[0], /* Block */[0], /* () */0))); | ||
})); | ||
@@ -161,13 +163,36 @@ })); | ||
} else { | ||
return Jest.Expect[/* toBe */2](66, Jest.Expect[/* expect */0](result[0].length)); | ||
var result$1 = result[0]; | ||
lastTx[0] = result$1; | ||
return Jest.Expect[/* toBe */2](66, Jest.Expect[/* expect */0](result$1.length)); | ||
} | ||
}), Eth$BsEth.sendTransaction(provider, { | ||
to: "0x160c5ce58e2cc4fe7cc45a9dd569a10083b2a275", | ||
to: randomAccount, | ||
from: primaryAddress[0], | ||
value: BigInt$BsEth.fromString("10000000000000000000", 10), | ||
nonce: 0 | ||
}, /* () */0))); | ||
}))); | ||
})); | ||
})); | ||
Jest.describe("#sendRawTransaction", (function (param) { | ||
Jest.testPromise("sends eth", undefined, (function (param) { | ||
return Repromise.Rejectable[/* toJsPromise */11](Repromise.map((function (result) { | ||
if (result.tag) { | ||
return Jest.fail(result[0]); | ||
} else { | ||
return Jest.Expect[/* toEqual */12]("0x218f5bab3339d03f52a202fb571c4a259482569163af0b61396b9d4b2e169985", Jest.Expect[/* expect */0](result[0])); | ||
} | ||
}), Eth$BsEth.sendRawTransaction(provider, "0xf864808207d08301e0f3942036c6cd85692f0fb2c26e6c6b2eced9e4478dfd8204cf001ca0f5d033ee6f1be4cca13379137234e7d1e620c4d268c679c560d5609dac6b3f15a06738dc64a3d7f4f419461b3dbfb0f0a26433ac4adbc45d636ba5bc81dc9f1028"))); | ||
})); | ||
return Jest.testPromise("fails with invalid transaction", undefined, (function (param) { | ||
return Repromise.Rejectable[/* toJsPromise */11](Repromise.map((function (result) { | ||
if (result.tag) { | ||
return Jest.Expect[/* toEqual */12]("Invalid Signature", Jest.Expect[/* expect */0](result[0])); | ||
} else { | ||
return Jest.fail("Bad transaction should not be accepted"); | ||
} | ||
}), Eth$BsEth.sendRawTransaction(provider, "0x0"))); | ||
})); | ||
})); | ||
Jest.describe("#estimateGas", (function (param) { | ||
@@ -216,2 +241,68 @@ return Jest.testPromise("receives estimation", undefined, (function (param) { | ||
Jest.describe("#transactionByHash", (function (param) { | ||
return Jest.testPromise("fetches TX", undefined, (function (param) { | ||
return Repromise.Rejectable[/* toJsPromise */11](Repromise.map((function (result) { | ||
if (result.tag) { | ||
return Jest.fail(result[0]); | ||
} else { | ||
return Jest.Expect[/* toEqual */12](primaryAddress[0], Jest.Expect[/* expect */0](result[0][/* from */5])); | ||
} | ||
}), Eth$BsEth.transactionByHash(provider, lastTx[0]))); | ||
})); | ||
})); | ||
Jest.describe("#transactionReceipt", (function (param) { | ||
return Jest.testPromise("fetches TX Receipt", undefined, (function (param) { | ||
return Repromise.Rejectable[/* toJsPromise */11](Repromise.map((function (result) { | ||
if (result.tag) { | ||
return Jest.fail(result[0]); | ||
} else { | ||
return Jest.Expect[/* toEqual */12](primaryAddress[0], Jest.Expect[/* expect */0](result[0][/* from */5])); | ||
} | ||
}), Eth$BsEth.transactionReceipt(provider, lastTx[0]))); | ||
})); | ||
})); | ||
Jest.describe("#blocksByXXX", (function (param) { | ||
var lastBlock = /* record */[/* contents */undefined]; | ||
Jest.testPromise("fetches Block by number", undefined, (function (param) { | ||
return Repromise.Rejectable[/* toJsPromise */11](Repromise.map((function (blockResult) { | ||
if (blockResult.tag) { | ||
return Jest.fail(blockResult[0]); | ||
} else { | ||
var blk = blockResult[0]; | ||
lastBlock[0] = blk; | ||
return Jest.Expect[/* toEqual */12](2, Jest.Expect[/* expect */0](blk[/* number */0])); | ||
} | ||
}), Eth$BsEth.blockByNumber(provider, 2, true))); | ||
})); | ||
return Jest.testPromise("fetches Block by hash", undefined, (function (param) { | ||
var match = lastBlock[0]; | ||
if (match !== undefined) { | ||
var blk1 = match; | ||
return Repromise.Rejectable[/* toJsPromise */11](Repromise.map((function (blockResult) { | ||
if (blockResult.tag) { | ||
return Jest.fail(blockResult[0]); | ||
} else { | ||
return Jest.Expect[/* toEqual */12](blk1, Jest.Expect[/* expect */0](blockResult[0])); | ||
} | ||
}), Eth$BsEth.blockByHash(provider, blk1[/* hash */1], true))); | ||
} else { | ||
return Repromise.Rejectable[/* toJsPromise */11](Repromise.Rejectable[/* resolved */2](Jest.fail("did not have ablock"))); | ||
} | ||
})); | ||
})); | ||
Jest.describe("#netVersion", (function (param) { | ||
return Jest.testPromise("fetches version", undefined, (function (param) { | ||
return Repromise.Rejectable[/* toJsPromise */11](Repromise.map((function (result) { | ||
if (result.tag) { | ||
return Jest.fail(result[0]); | ||
} else { | ||
return Jest.Expect[/* toEqual */12](1, Jest.Expect[/* expect */0](result[0])); | ||
} | ||
}), Eth$BsEth.netVersion(infura))); | ||
})); | ||
})); | ||
export { | ||
@@ -223,4 +314,5 @@ provider , | ||
allAccounts , | ||
lastTx , | ||
} | ||
/* partial_arg Not a pure module */ |
@@ -20,6 +20,6 @@ // Generated by BUCKLESCRIPT VERSION 5.0.4, PLEASE EDIT WITH CARE | ||
Jest.test("small number", (function (param) { | ||
return Jest.Expect[/* toEqual */12]("0x4d2", Jest.Expect[/* expect */0](Formats$BsEth.Encode[/* block */4](1234))); | ||
return Jest.Expect[/* toEqual */12]("0x4d2", Jest.Expect[/* expect */0](Formats$BsEth.Encode[/* blockNumber */4](1234))); | ||
})); | ||
return Jest.test("zero", (function (param) { | ||
return Jest.Expect[/* toEqual */12]("0x0", Jest.Expect[/* expect */0](Formats$BsEth.Encode[/* block */4](0))); | ||
return Jest.Expect[/* toEqual */12]("0x0", Jest.Expect[/* expect */0](Formats$BsEth.Encode[/* blockNumber */4](0))); | ||
})); | ||
@@ -29,15 +29,15 @@ })); | ||
Jest.test("small number", (function (param) { | ||
return Jest.Expect[/* toEqual */12]("0x4d2", Jest.Expect[/* expect */0](Formats$BsEth.Encode[/* blockOrTag */6](/* Block */[1234]))); | ||
return Jest.Expect[/* toEqual */12]("0x4d2", Jest.Expect[/* expect */0](Formats$BsEth.Encode[/* blockOrTag */7](/* Block */[1234]))); | ||
})); | ||
Jest.test("zero", (function (param) { | ||
return Jest.Expect[/* toEqual */12]("0x0", Jest.Expect[/* expect */0](Formats$BsEth.Encode[/* blockOrTag */6](/* Block */[0]))); | ||
return Jest.Expect[/* toEqual */12]("0x0", Jest.Expect[/* expect */0](Formats$BsEth.Encode[/* blockOrTag */7](/* Block */[0]))); | ||
})); | ||
Jest.test("latest", (function (param) { | ||
return Jest.Expect[/* toEqual */12]("latest", Jest.Expect[/* expect */0](Formats$BsEth.Encode[/* blockOrTag */6](/* Latest */1))); | ||
return Jest.Expect[/* toEqual */12]("latest", Jest.Expect[/* expect */0](Formats$BsEth.Encode[/* blockOrTag */7](/* Latest */1))); | ||
})); | ||
Jest.test("pending", (function (param) { | ||
return Jest.Expect[/* toEqual */12]("pending", Jest.Expect[/* expect */0](Formats$BsEth.Encode[/* blockOrTag */6](/* Pending */2))); | ||
return Jest.Expect[/* toEqual */12]("pending", Jest.Expect[/* expect */0](Formats$BsEth.Encode[/* blockOrTag */7](/* Pending */2))); | ||
})); | ||
return Jest.test("earliest", (function (param) { | ||
return Jest.Expect[/* toEqual */12]("earliest", Jest.Expect[/* expect */0](Formats$BsEth.Encode[/* blockOrTag */6](/* Earliest */0))); | ||
return Jest.Expect[/* toEqual */12]("earliest", Jest.Expect[/* expect */0](Formats$BsEth.Encode[/* blockOrTag */7](/* Earliest */0))); | ||
})); | ||
@@ -84,9 +84,9 @@ })); | ||
Jest.test("smallish number", (function (param) { | ||
return Jest.Expect[/* toEqual */12](1234, Jest.Expect[/* expect */0](Formats$BsEth.Decode[/* block */2]("0x4d2"))); | ||
return Jest.Expect[/* toEqual */12](1234, Jest.Expect[/* expect */0](Formats$BsEth.Decode[/* blockNumber */2]("0x4d2"))); | ||
})); | ||
Jest.test("zero", (function (param) { | ||
return Jest.Expect[/* toEqual */12](0, Jest.Expect[/* expect */0](Formats$BsEth.Decode[/* block */2]("0x0"))); | ||
return Jest.Expect[/* toEqual */12](0, Jest.Expect[/* expect */0](Formats$BsEth.Decode[/* blockNumber */2]("0x0"))); | ||
})); | ||
return Jest.test("largeish number", (function (param) { | ||
return Jest.Expect[/* toEqual */12](226982304, Jest.Expect[/* expect */0](Formats$BsEth.Decode[/* block */2]("0x0D8779a0"))); | ||
return Jest.Expect[/* toEqual */12](226982304, Jest.Expect[/* expect */0](Formats$BsEth.Decode[/* blockNumber */2]("0x0D8779a0"))); | ||
})); | ||
@@ -93,0 +93,0 @@ })); |
{ | ||
"name": "bs-eth", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"package-specs": { | ||
@@ -5,0 +5,0 @@ "module": "es6", |
@@ -1,2 +0,2 @@ | ||
var r,e=(r=require("jsbi"))&&"object"==typeof r&&"default"in r?r.default:r,n=require("@glennsl/bs-json/src/Json_decode.bs.js"),t=require("bs-fetch/src/Fetch.js"),a=require("@aantron/repromise/src/js/repromise.js");function u(r,e){return e.tag=r,e}var c=["Invalid_argument",-3],i=["Division_by_zero",-5],o=["Assert_failure",-10];function f(r,e,n){for(var t=new Array(n),a=0,u=e;a<n;)t[a]=r[u],a=a+1|0,u=u+1|0;return t}function s(r,e){for(;;){var n=e,t=r,a=t.length,u=0===a?1:a,c=u-n.length|0;if(0===c)return t.apply(null,n);if(!(c<0))return function(r,e){return function(n){return s(r,e.concat([n]))}}(t,n);e=f(n,u,0|-c),r=t.apply(null,f(n,0,u))}}function v(r,e){var n=r.length;return 1===n?r(e):function(r,e,n){switch(n){case 1:return r(e);case 2:return function(n){return r(e,n)};case 3:return function(n,t){return r(e,n,t)};case 4:return function(n,t,a){return r(e,n,t,a)};case 5:return function(n,t,a,u){return r(e,n,t,a,u)};case 6:return function(n,t,a,u,c){return r(e,n,t,a,u,c)};case 7:return function(n,t,a,u,c,i){return r(e,n,t,a,u,c,i)};default:return s(r,[e])}}(r,e,n)}function h(r,e,n){var t=r.length;return 2===t?r(e,n):function(r,e,n,t){switch(t){case 1:return s(r(e),[n]);case 2:return r(e,n);case 3:return function(t){return r(e,n,t)};case 4:return function(t,a){return r(e,n,t,a)};case 5:return function(t,a,u){return r(e,n,t,a,u)};case 6:return function(t,a,u,c){return r(e,n,t,a,u,c)};case 7:return function(t,a,u,c,i){return r(e,n,t,a,u,c,i)};default:return s(r,[e,n])}}(r,e,n,t)}function l(r){if(r<0)throw[c,"String.create"];for(var e=new Array(r),n=0,t=r-1|0;n<=t;++n)e[n]=0;return e}function b(r,e,n,t,a){if(a>0){if(r===n){var u=r,c=e,i=t,o=a;if(c<i){for(var f=(u.length-i|0)-1|0,s=o-1|0,v=f>s?s:f;v>=0;--v)u[i+v|0]=u[c+v|0];return 0}if(c>i){for(var h=(u.length-c|0)-1|0,l=o-1|0,b=h>l?l:h,m=0;m<=b;++m)u[i+m|0]=u[c+m|0];return 0}return 0}var g=r.length-e|0;if(a<=g){for(var w=0,p=a-1|0;w<=p;++w)n[t+w|0]=r[e+w|0];return 0}for(var k=0,d=g-1|0;k<=d;++k)n[t+k|0]=r[e+k|0];for(var y=g,C=a-1|0;y<=C;++y)n[t+y|0]=0;return 0}return 0}function m(r){var e=r,n=r.length,t="",a=n;if(n<=4096&&n===e.length)return String.fromCharCode.apply(null,e);for(var u=0;a>0;){var c=a<1024?a:1024,i=new Array(c);b(e,u,i,0,c),t+=String.fromCharCode.apply(null,i),a=a-c|0,u=u+c|0}return t}function g(r,e,n,t,a){if(a>0){var u=r.length-e|0;if(a<=u){for(var c=0,i=a-1|0;c<=i;++c)n[t+c|0]=r.charCodeAt(e+c|0);return 0}for(var o=0,f=u-1|0;o<=f;++o)n[t+o|0]=r.charCodeAt(e+o|0);for(var s=u,v=a-1|0;s<=v;++s)n[t+s|0]=0;return 0}return 0}function w(r,e){return r>e?r:e}function p(r,e){for(var n in r)e(n)}function k(r,e){return!function r(e,n){for(;;){var t=n,a=e;if(a===t)return!0;var u=typeof a;if("string"===u||"number"===u||"boolean"===u||"undefined"===u||null===a)return!1;var i=typeof t;if("function"===u||"function"===i)throw[c,"equal: functional value"];if("number"===i||"undefined"===i||null===t)return!1;var o=0|a.tag,f=0|t.tag;if(250!==o)if(250!==f){if(248===o)return a[1]===t[1];if(251===o)throw[c,"equal: abstract value"];if(o!==f)return!1;if(256===o)return a[1]===t[1];var s=0|a.length;if(s!==(0|t.length))return!1;if(!Array.isArray(a)){if(a instanceof Date&&t instanceof Date)return!(a>t||a<t);var v=a,h=t,l=[!0],b=function(r,e){return function(n){return r.hasOwnProperty(n)?0:(e[0]=!1,0)}}(h,l),m=function(e,n,t){return function(a){return e.hasOwnProperty(a)&&r(n[a],e[a])?0:(t[0]=!1,0)}}(v,h,l);return p(v,b),l[0]&&p(h,m),l[0]}for(var g=a,w=t,k=0,d=s;;){var y=k;if(y===d)return!0;if(!r(g[y],w[y]))return!1;k=y+1|0}}else n=t[0];else e=a[0]}}(r,e)}c.tag=248,i.tag=248,o.tag=248;var d=Math.imul||function(r,e){return((r>>16)*(e|=0)<<16)+(65535&r)*e|0};function y(r,e){if(e.repeat)return e.repeat(r);if(0==e.length||0==r)return"";if(e.length*r>=1<<28)throw new RangeError("repeat count must not overflow maximum string size");for(var n="";1==(1&r)&&(n+=e),0!=(r>>>=1);)e+=e;return n}var C=[-2147483648,0],F=[2147483647,1],A=[0,1],x=[0,0],S=[-1,4294967295];function _(r){return 0!=(2147483648&r)}function j(r,e){var n=e[1],t=r[1],a=t+n&4294967295,u=_(t)&&(_(n)||!_(a))||_(n)&&!_(a)?1:0;return[r[0]+e[0]+u&4294967295,a>>>0]}function N(r,e){return r[0]===e[0]&&r[1]===e[1]}function P(r){return N(r,C)?C:j([-1^(e=r)[0],(-1^e[1])>>>0],A);var e}function E(r,e){if(0===e)return r;var n=r[1];return e>=32?[n<<(e-32|0),0]:[n>>>(32-e|0)|r[0]<<e,n<<e>>>0]}function B(r,e){if(0===e)return r;var n=r[0];return e<32?[n>>e,(n<<(32-e|0)|r[1]>>>e)>>>0]:[n>=0?0:-1,n>>(e-32|0)>>>0]}function R(r,e){for(;;){var n,t=e,a=r,u=0,c=a[0],i=0;if(0===c&&0===a[1])return x;if(0===t[0]&&0===t[1])return x;if(-2147483648!==c||0!==a[1]?i=2:(n=t[1],u=1),2===i){var o=t[0],f=a[1],s=0;if(-2147483648!==o||0!==t[1]?s=3:(n=f,u=1),3===s){var v=t[1];if(c<0){if(o<0){e=P(t),r=P(a);continue}return P(R(P(a),t))}if(o<0)return P(R(a,P(t)));var h=65535&c,l=f>>>16,b=65535&f,m=65535&o,g=v>>>16,w=65535&v,p=0,k=0,d=0,y=b*w;return p=(k=(k=(d=(y>>>16)+l*w)>>>16)+((d=(65535&d)+b*g)>>>16)+h*w)>>>16,p+=(k=(65535&k)+l*g)>>>16,p+=(k=(65535&k)+b*m)>>>16,[(k&=65535)|(p=p+((c>>>16)*w+h*g+l*m+b*(o>>>16))&65535)<<16,(65535&y|(65535&d)<<16)>>>0]}}if(1===u)return 0==(1&n)?x:C}}function q(r,e){var n=e[0],t=r[0];return t>n||!(t<n)&&r[1]>=e[1]}function I(r,e){return!N(r,e)}function M(r,e){return!q(r,e)}function T(r,e){return r[0]>e[0]||!(r[0]<e[0])&&r[1]>e[1]}function O(r){return 4294967296*r[0]+r[1]}function D(r){return isNaN(r)||!isFinite(r)?x:r<=-0x8000000000000000?C:r+1>=0x8000000000000000?F:r<0?P(D(-r)):[r/4294967296|0,(r%4294967296|0)>>>0]}function X(r,e){var n=function r(e,n){for(;;){var t=n,a=e,u=a[0],c=0;if(0===t[0]&&0===t[1])throw i;if(-2147483648!==u){if(0===u&&0===a[1])return x;c=1}else{if(0===a[1]){if(N(t,A)||N(t,S))return a;if(N(t,C))return A;var o=t[0],f=E(r(B(a,1),t),1);if(0===f[0]&&0===f[1])return o<0?A:P(A);var s=j(a,P(R(t,f)));return j(f,r(s,t))}c=1}if(1===c){var v=t[0];if(-2147483648===v&&0===t[1])return x;if(u<0){if(v<0){n=P(t),e=P(a);continue}return P(r(P(a),t))}if(v<0)return P(r(a,P(t)));for(var h=x,l=a;q(l,t);){for(var b=w(1,Math.floor(O(l)/O(t))),m=Math.ceil(Math.log(b)/Math.LN2),g=m<=48?1:Math.pow(2,m-48),p=D(b),k=R(p,t);k[0]<0||T(k,l);)k=R(p=D(b-=g),t);0===(d=p)[0]&&0===d[1]&&(p=A),h=j(h,p),l=j(l,P(k))}return h}}var d}(r,e);return[n,j(r,P(R(n,e)))]}function J(r){return[2147483647&r[0],r[1]]}function $(r){return r>=65&&r<=90||r>=192&&r<=214||r>=216&&r<=222?r+32|0:r}function z(r){var e=r.length;if(e>31)throw[c,"format_int: format too long"];for(var n=["+","-"," ",!1,2,!1,0,!1,1,-1,"f"],t=0;;){var a=t;if(a>=e)return n;var u=r.charCodeAt(a),i=0;if(u>=69)if(u>=88)if(u>=121)i=1;else switch(u-88|0){case 0:n[4]=1,n[7]=!0,t=a+1|0;continue;case 13:case 14:case 15:i=5;break;case 12:case 17:i=4;break;case 23:n[4]=0,t=a+1|0;continue;case 29:n[4]=2,t=a+1|0;continue;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 16:case 18:case 19:case 20:case 21:case 22:case 24:case 25:case 26:case 27:case 28:case 30:case 31:i=1;break;case 32:n[4]=1,t=a+1|0;continue}else{if(!(u>=72)){n[5]=!0,n[7]=!0,n[10]=String.fromCharCode($(u)),t=a+1|0;continue}i=1}else switch(u){case 35:n[3]=!0,t=a+1|0;continue;case 32:case 43:i=2;break;case 45:n[0]="-",t=a+1|0;continue;case 46:n[9]=0;for(var o=a+1|0;function(e){return function(){var n=r.charCodeAt(e)-48|0;return n>=0&&n<=9}}(o)();)n[9]=(d(n[9],10)+r.charCodeAt(o)|0)-48|0,o=o+1|0;t=o;continue;case 33:case 34:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 44:case 47:i=1;break;case 48:n[2]="0",t=a+1|0;continue;case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:i=3;break;default:i=1}switch(i){case 1:t=a+1|0;continue;case 2:n[1]=String.fromCharCode(u),t=a+1|0;continue;case 3:n[6]=0;for(var f=a;function(e){return function(){var n=r.charCodeAt(e)-48|0;return n>=0&&n<=9}}(f)();)n[6]=(d(n[6],10)+r.charCodeAt(f)|0)-48|0,f=f+1|0;t=f;continue;case 4:n[5]=!0,n[4]=2,t=a+1|0;continue;case 5:n[5]=!0,n[10]=String.fromCharCode(u),t=a+1|0;continue}}}function G(r,e){var n=r[0],t=r[1],a=r[2],u=r[3],c=r[4],i=r[5],o=r[6],f=r[7],s=r[8],v=e.length;i&&(s<0||"-"!==t)&&(v=v+1|0),u&&(0===c?v=v+1|0:1===c&&(v=v+2|0));var h="";if("+"===n&&" "===a)for(var l=v,b=o-1|0;l<=b;++l)h+=a;if(i&&(s<0?h+="-":"-"!==t&&(h+=t)),u&&0===c&&(h+="0"),u&&1===c&&(h+="0x"),"+"===n&&"0"===a)for(var m=v,g=o-1|0;m<=g;++m)h+=a;if(h=f?h+e.toUpperCase():h+e,"-"===n)for(var w=v,p=o-1|0;w<=p;++w)h+=" ";return h}function L(r,e){if("%d"===r)return String(e);var n=z(r),t=e,a=(t<0?n[5]?(n[8]=-1,-t):t>>>0:t).toString(function(r){switch(n[4]){case 0:return 8;case 1:return 16;case 2:return 10}}());if(n[9]>=0){n[2]=" ";var u=n[9]-a.length|0;u>0&&(a=y(u,"0")+a)}return G(n,a)}var U=L,Z=L;function H(r,e){if(e<0||e>=r.length)throw[c,"index out of bounds"];return r.charCodeAt(e)}var K=[0];function Q(r){var e=[r,(K[0]+=1,K[0])];return e.tag=248,e}function V(r){if("number"==typeof r)return 0;switch(0|r.tag){case 0:return u(0,[V(r[0])]);case 1:return u(1,[V(r[0])]);case 2:return u(2,[V(r[0])]);case 3:return u(3,[V(r[0])]);case 4:return u(4,[V(r[0])]);case 5:return u(5,[V(r[0])]);case 6:return u(6,[V(r[0])]);case 7:return u(7,[V(r[0])]);case 8:return u(8,[r[0],V(r[1])]);case 9:var e=r[0];return u(9,[e,e,V(r[2])]);case 10:return u(10,[V(r[0])]);case 11:return u(11,[V(r[0])]);case 12:return u(12,[V(r[0])]);case 13:return u(13,[V(r[0])]);case 14:return u(14,[V(r[0])])}}function W(r,e){if("number"==typeof r)return e;switch(0|r.tag){case 0:return u(0,[W(r[0],e)]);case 1:return u(1,[W(r[0],e)]);case 2:return u(2,[r[0],W(r[1],e)]);case 3:return u(3,[r[0],W(r[1],e)]);case 4:return u(4,[r[0],r[1],r[2],W(r[3],e)]);case 5:return u(5,[r[0],r[1],r[2],W(r[3],e)]);case 6:return u(6,[r[0],r[1],r[2],W(r[3],e)]);case 7:return u(7,[r[0],r[1],r[2],W(r[3],e)]);case 8:return u(8,[r[0],r[1],r[2],W(r[3],e)]);case 9:return u(9,[W(r[0],e)]);case 10:return u(10,[W(r[0],e)]);case 11:return u(11,[r[0],W(r[1],e)]);case 12:return u(12,[r[0],W(r[1],e)]);case 13:return u(13,[r[0],r[1],W(r[2],e)]);case 14:return u(14,[r[0],r[1],W(r[2],e)]);case 15:return u(15,[W(r[0],e)]);case 16:return u(16,[W(r[0],e)]);case 17:return u(17,[r[0],W(r[1],e)]);case 18:return u(18,[r[0],W(r[1],e)]);case 19:return u(19,[W(r[0],e)]);case 20:return u(20,[r[0],r[1],W(r[2],e)]);case 21:return u(21,[r[0],W(r[1],e)]);case 22:return u(22,[W(r[0],e)]);case 23:return u(23,[r[0],W(r[1],e)]);case 24:return u(24,[r[0],r[1],W(r[2],e)])}}function Y(r){return r>=0?r:0|-r}function rr(r,e){for(;;){var n=e;if(!n)return 0;v(r,n[0]),e=n[1]}}function er(r,e){var n=l(r);return function(e,n,t,a){if(r>0)for(var u=0,c=(r+0|0)-1|0;u<=c;++u)e[u]=a}(n,0,0,e),n}function nr(r,e,n){return m(function(r,e,n){if(e<0||n<0||e>(r.length-n|0))throw[c,"String.sub / Bytes.sub"];var t=l(n);return b(r,e,t,0,n),t}(r,e,n))}function tr(r,e,n,t,a){if(a<0||e<0||e>(r.length-a|0)||t<0||t>(n.length-a|0))throw[c,"Bytes.blit"];return b(r,e,n,t,a)}function ar(r,e,n,t,a){if(a<0||e<0||e>(r.length-a|0)||t<0||t>(n.length-a|0))throw[c,"String.blit / Bytes.blit_string"];return g(r,e,n,t,a)}function ur(r,e){if(e){var n=e[0],t=[0],a=[0];rr(function(r){return t[0]=t[0]+1|0,a[0]=a[0]+r.length|0,0},e);var u=l(a[0]+d(r.length,t[0]-1|0)|0);g(n,0,u,0,n.length);var c=[n.length];return rr(function(e){return g(r,0,u,c[0],r.length),c[0]=c[0]+r.length|0,g(e,0,u,c[0],e.length),c[0]=c[0]+e.length|0,0},e[1]),m(u)}return""}Q("Pervasives.Exit");var cr=ar;function ir(r,e){for(var n=r[2];(r[1]+e|0)>n;)n<<=1;var t=l(n);return tr(r[0],0,t,0,r[1]),r[0]=t,r[2]=n,0}function or(r,e){var n=r[1];return n>=r[2]&&ir(r,1),r[0][n]=e,r[1]=n+1|0,0}function fr(r,e){var n=e.length,t=r[1]+n|0;return t>r[2]&&ir(r,n),ar(e,0,r[0],r[1],n),r[1]=t,0}var sr=[];function vr(r){if(void 0===r){var e=[sr,0];return e.tag=256,e}if(null!==r&&r[0]===sr){var n=[sr,r[1]+1|0];return n.tag=256,n}return r}function hr(r){if(null!==r&&r[0]===sr){var e=r[1];return 0===e?void 0:[sr,e-1|0]}return r}function lr(r,e){var n,t,a=r[1].length,u=r[0]+e|0;if(u>a){var c=l((n=a<<1)>(t=u)?n:t);return tr(r[1],0,c,0,a),r[1]=c,0}return 0}function br(r,e){return lr(r,1),r[1][r[0]]=e,r[0]=r[0]+1|0,0}function mr(r,e){var n=e.length;return lr(r,n),cr(e,0,r[1],r[0],n),r[0]=r[0]+n|0,0}function gr(r){return nr(r[1],0,r[0])}function wr(r){if("number"==typeof r)switch(r){case 0:return"@]";case 1:return"@}";case 2:return"@?";case 3:return"@\n";case 4:return"@.";case 5:return"@@";case 6:return"@%"}else switch(0|r.tag){case 0:case 1:return r[0];case 2:return"@"+m(er(1,r[0]))}}function pr(r){if("number"==typeof r)return 0;switch(0|r.tag){case 0:return u(0,[pr(r[0])]);case 1:return u(1,[pr(r[0])]);case 2:return u(2,[pr(r[0])]);case 3:return u(3,[pr(r[0])]);case 4:return u(4,[pr(r[0])]);case 5:return u(5,[pr(r[0])]);case 6:return u(6,[pr(r[0])]);case 7:return u(7,[pr(r[0])]);case 8:return u(8,[r[0],pr(r[1])]);case 9:return u(9,[r[1],r[0],pr(r[2])]);case 10:return u(10,[pr(r[0])]);case 11:return u(11,[pr(r[0])]);case 12:return u(12,[pr(r[0])]);case 13:return u(13,[pr(r[0])]);case 14:return u(14,[pr(r[0])])}}function kr(r){if("number"==typeof r)return[function(r){return 0},function(r){return 0},function(r){return 0},function(r){return 0}];switch(0|r.tag){case 0:var e=kr(r[0]),n=e[1],t=e[0];return[function(r){return v(t,0),0},function(r){return v(n,0),0},e[2],e[3]];case 1:var a=kr(r[0]),u=a[1],c=a[0];return[function(r){return v(c,0),0},function(r){return v(u,0),0},a[2],a[3]];case 2:var i=kr(r[0]),o=i[1],f=i[0];return[function(r){return v(f,0),0},function(r){return v(o,0),0},i[2],i[3]];case 3:var s=kr(r[0]),h=s[1],l=s[0];return[function(r){return v(l,0),0},function(r){return v(h,0),0},s[2],s[3]];case 4:var b=kr(r[0]),m=b[1],g=b[0];return[function(r){return v(g,0),0},function(r){return v(m,0),0},b[2],b[3]];case 5:var w=kr(r[0]),p=w[1],k=w[0];return[function(r){return v(k,0),0},function(r){return v(p,0),0},w[2],w[3]];case 6:var d=kr(r[0]),y=d[1],C=d[0];return[function(r){return v(C,0),0},function(r){return v(y,0),0},d[2],d[3]];case 7:var F=kr(r[0]),A=F[1],x=F[0];return[function(r){return v(x,0),0},function(r){return v(A,0),0},F[2],F[3]];case 8:var S=kr(r[1]),_=S[1],j=S[0];return[function(r){return v(j,0),0},function(r){return v(_,0),0},S[2],S[3]];case 9:var N=kr(r[2]),P=N[3],E=N[2],B=N[1],R=N[0],q=kr(dr(pr(r[0]),r[1])),I=q[3],M=q[2],T=q[1],O=q[0];return[function(r){return v(R,0),v(O,0),0},function(r){return v(T,0),v(B,0),0},function(r){return v(E,0),v(M,0),0},function(r){return v(I,0),v(P,0),0}];case 10:var D=kr(r[0]),X=D[1],J=D[0];return[function(r){return v(J,0),0},function(r){return v(X,0),0},D[2],D[3]];case 11:var $=kr(r[0]),z=$[1],G=$[0];return[function(r){return v(G,0),0},function(r){return v(z,0),0},$[2],$[3]];case 12:var L=kr(r[0]),U=L[1],Z=L[0];return[function(r){return v(Z,0),0},function(r){return v(U,0),0},L[2],L[3]];case 13:var H=kr(r[0]),K=H[3],Q=H[2],V=H[1],W=H[0];return[function(r){return v(W,0),0},function(r){return v(V,0),0},function(r){return v(Q,0),0},function(r){return v(K,0),0}];case 14:var Y=kr(r[0]),rr=Y[3],er=Y[2],nr=Y[1],tr=Y[0];return[function(r){return v(tr,0),0},function(r){return v(nr,0),0},function(r){return v(er,0),0},function(r){return v(rr,0),0}]}}function dr(r,e){var n=0;if("number"==typeof r){if("number"==typeof e)return 0;switch(0|e.tag){case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5;break;default:throw[o,["camlinternalFormat.ml",816,23]]}}else switch(0|r.tag){case 0:if("number"==typeof e)n=8;else switch(0|e.tag){case 0:return u(0,[dr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 1:if("number"==typeof e)n=8;else switch(0|e.tag){case 1:return u(1,[dr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 2:if("number"==typeof e)n=8;else switch(0|e.tag){case 2:return u(2,[dr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 3:if("number"==typeof e)n=8;else switch(0|e.tag){case 3:return u(3,[dr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 4:if("number"==typeof e)n=8;else switch(0|e.tag){case 4:return u(4,[dr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 5:if("number"==typeof e)n=8;else switch(0|e.tag){case 5:return u(5,[dr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 6:if("number"==typeof e)n=8;else switch(0|e.tag){case 6:return u(6,[dr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 7:if("number"==typeof e)n=8;else switch(0|e.tag){case 7:return u(7,[dr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 8:if("number"==typeof e)throw[o,["camlinternalFormat.ml",802,26]];switch(0|e.tag){case 8:return u(8,[dr(r[0],e[0]),dr(r[1],e[1])]);case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5;break;default:throw[o,["camlinternalFormat.ml",802,26]]}break;case 9:if("number"==typeof e)throw[o,["camlinternalFormat.ml",812,28]];switch(0|e.tag){case 8:n=6;break;case 9:var t=kr(dr(pr(r[1]),e[0]));return v(t[1],0),v(t[3],0),u(9,[r[0],e[1],dr(r[2],e[2])]);case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5;break;default:throw[o,["camlinternalFormat.ml",812,28]]}break;case 10:if("number"==typeof e)throw[o,["camlinternalFormat.ml",780,21]];if(10===e.tag)return u(10,[dr(r[0],e[0])]);throw[o,["camlinternalFormat.ml",780,21]];case 11:if("number"==typeof e)throw[o,["camlinternalFormat.ml",784,21]];switch(0|e.tag){case 10:n=1;break;case 11:return u(11,[dr(r[0],e[0])]);default:throw[o,["camlinternalFormat.ml",784,21]]}break;case 12:if("number"==typeof e)throw[o,["camlinternalFormat.ml",788,19]];switch(0|e.tag){case 10:n=1;break;case 11:n=2;break;case 12:return u(12,[dr(r[0],e[0])]);default:throw[o,["camlinternalFormat.ml",788,19]]}break;case 13:if("number"==typeof e)throw[o,["camlinternalFormat.ml",792,22]];switch(0|e.tag){case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:return u(13,[dr(r[0],e[0])]);default:throw[o,["camlinternalFormat.ml",792,22]]}break;case 14:if("number"==typeof e)throw[o,["camlinternalFormat.ml",797,30]];switch(0|e.tag){case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:return u(14,[dr(r[0],e[0])]);default:throw[o,["camlinternalFormat.ml",797,30]]}}switch(n){case 1:throw[o,["camlinternalFormat.ml",781,21]];case 2:throw[o,["camlinternalFormat.ml",785,21]];case 3:throw[o,["camlinternalFormat.ml",789,19]];case 4:throw[o,["camlinternalFormat.ml",793,22]];case 5:throw[o,["camlinternalFormat.ml",798,30]];case 6:throw[o,["camlinternalFormat.ml",803,26]];case 7:throw[o,["camlinternalFormat.ml",813,28]];case 8:throw[o,["camlinternalFormat.ml",817,23]]}}Q("Caml_js_exceptions.Error");var yr=Q("CamlinternalFormat.Type_mismatch");function Cr(r,e){if("number"==typeof r)return[0,e];if(r.tag){if("number"==typeof e)throw yr;if(2===e.tag)return[u(1,[r[0]]),e[0]];throw yr}return[u(0,[r[0],r[1]]),e]}function Fr(r,e,n){var t=Cr(r,n);if("number"==typeof e){if(0!==e){var a=t[1];if("number"==typeof a)throw yr;if(2===a.tag)return[t[0],1,a[0]];throw yr}return[t[0],0,t[1]]}return[t[0],[e[0]],t[1]]}function Ar(r,e,n){var t=xr(e,n);return[u(23,[r,t[0]]),t[1]]}function xr(r,e){if("number"==typeof r)return[0,e];switch(0|r.tag){case 0:if("number"==typeof e)throw yr;if(e.tag)throw yr;var n=xr(r[0],e[0]);return[u(0,[n[0]]),n[1]];case 1:if("number"==typeof e)throw yr;if(e.tag)throw yr;var t=xr(r[0],e[0]);return[u(1,[t[0]]),t[1]];case 2:var a=Cr(r[0],e),c=a[1];if("number"==typeof c)throw yr;if(1===c.tag){var i=xr(r[1],c[0]);return[u(2,[a[0],i[0]]),i[1]]}throw yr;case 3:var o=Cr(r[0],e),f=o[1];if("number"==typeof f)throw yr;if(1===f.tag){var s=xr(r[1],f[0]);return[u(3,[o[0],s[0]]),s[1]]}throw yr;case 4:var h=Fr(r[1],r[2],e),l=h[2];if("number"==typeof l)throw yr;if(2===l.tag){var b=xr(r[3],l[0]);return[u(4,[r[0],h[0],h[1],b[0]]),b[1]]}throw yr;case 5:var m=Fr(r[1],r[2],e),g=m[2];if("number"==typeof g)throw yr;if(3===g.tag){var w=xr(r[3],g[0]);return[u(5,[r[0],m[0],m[1],w[0]]),w[1]]}throw yr;case 6:var p=Fr(r[1],r[2],e),d=p[2];if("number"==typeof d)throw yr;if(4===d.tag){var y=xr(r[3],d[0]);return[u(6,[r[0],p[0],p[1],y[0]]),y[1]]}throw yr;case 7:var C=Fr(r[1],r[2],e),F=C[2];if("number"==typeof F)throw yr;if(5===F.tag){var A=xr(r[3],F[0]);return[u(7,[r[0],C[0],C[1],A[0]]),A[1]]}throw yr;case 8:var x=Fr(r[1],r[2],e),S=x[2];if("number"==typeof S)throw yr;if(6===S.tag){var _=xr(r[3],S[0]);return[u(8,[r[0],x[0],x[1],_[0]]),_[1]]}throw yr;case 9:if("number"==typeof e)throw yr;if(7===e.tag){var j=xr(r[0],e[0]);return[u(9,[j[0]]),j[1]]}throw yr;case 10:var N=xr(r[0],e);return[u(10,[N[0]]),N[1]];case 11:var P=xr(r[1],e);return[u(11,[r[0],P[0]]),P[1]];case 12:var E=xr(r[1],e);return[u(12,[r[0],E[0]]),E[1]];case 13:if("number"==typeof e)throw yr;if(8===e.tag){var B=e[0];if(k([r[1]],[B]))throw yr;var R=xr(r[2],e[1]);return[u(13,[r[0],B,R[0]]),R[1]]}throw yr;case 14:if("number"==typeof e)throw yr;if(9===e.tag){var q=e[0];if(k([V(r[1])],[V(q)]))throw yr;var I=xr(r[2],V(e[2]));return[u(14,[r[0],q,I[0]]),I[1]]}throw yr;case 15:if("number"==typeof e)throw yr;if(10===e.tag){var M=xr(r[0],e[0]);return[u(15,[M[0]]),M[1]]}throw yr;case 16:if("number"==typeof e)throw yr;if(11===e.tag){var T=xr(r[0],e[0]);return[u(16,[T[0]]),T[1]]}throw yr;case 17:var O=xr(r[1],e);return[u(17,[r[0],O[0]]),O[1]];case 18:var D=r[0],X=r[1],J=e;if(D.tag){var $=D[0],z=xr($[0],J),G=xr(X,z[1]);return[u(18,[u(1,[[z[0],$[1]]]),G[0]]),G[1]]}var L=D[0],U=xr(L[0],J),Z=xr(X,U[1]);return[u(18,[u(0,[[U[0],L[1]]]),Z[0]]),Z[1]];case 19:if("number"==typeof e)throw yr;if(13===e.tag){var H=xr(r[0],e[0]);return[u(19,[H[0]]),H[1]]}throw yr;case 20:if("number"==typeof e)throw yr;if(1===e.tag){var K=xr(r[2],e[0]);return[u(20,[r[0],r[1],K[0]]),K[1]]}throw yr;case 21:if("number"==typeof e)throw yr;if(2===e.tag){var Q=xr(r[1],e[0]);return[u(21,[r[0],Q[0]]),Q[1]]}throw yr;case 23:var W=r[0],Y=r[1],rr=e;if("number"==typeof W){if(3===W){if("number"==typeof rr)throw yr;if(14===rr.tag){var er=xr(Y,rr[0]);return[u(23,[3,er[0]]),er[1]]}throw yr}return Ar(W,Y,rr)}switch(0|W.tag){case 7:return Ar(u(7,[W[0],W[1]]),Y,rr);case 8:var nr=function r(e,n,t){if("number"==typeof e)return[0,xr(n,t)];switch(0|e.tag){case 0:if("number"==typeof t)throw yr;if(t.tag)throw yr;var a=r(e[0],n,t[0]);return[u(0,[a[0]]),a[1]];case 1:if("number"==typeof t)throw yr;if(1===t.tag){var c=r(e[0],n,t[0]);return[u(1,[c[0]]),c[1]]}throw yr;case 2:if("number"==typeof t)throw yr;if(2===t.tag){var i=r(e[0],n,t[0]);return[u(2,[i[0]]),i[1]]}throw yr;case 3:if("number"==typeof t)throw yr;if(3===t.tag){var o=r(e[0],n,t[0]);return[u(3,[o[0]]),o[1]]}throw yr;case 4:if("number"==typeof t)throw yr;if(4===t.tag){var f=r(e[0],n,t[0]);return[u(4,[f[0]]),f[1]]}throw yr;case 5:if("number"==typeof t)throw yr;if(5===t.tag){var s=r(e[0],n,t[0]);return[u(5,[s[0]]),s[1]]}throw yr;case 6:if("number"==typeof t)throw yr;if(6===t.tag){var h=r(e[0],n,t[0]);return[u(6,[h[0]]),h[1]]}throw yr;case 7:if("number"==typeof t)throw yr;if(7===t.tag){var l=r(e[0],n,t[0]);return[u(7,[l[0]]),l[1]]}throw yr;case 8:if("number"==typeof t)throw yr;if(8===t.tag){var b=t[0];if(k([e[0]],[b]))throw yr;var m=r(e[1],n,t[1]);return[u(8,[b,m[0]]),m[1]]}throw yr;case 9:if("number"==typeof t)throw yr;if(9===t.tag){var g=t[1],w=t[0];if(k([V(e[0])],[V(w)]))throw yr;if(k([V(e[1])],[V(g)]))throw yr;var p=kr(dr(pr(w),g));v(p[1],0),v(p[3],0);var d=r(V(e[2]),n,t[2]);return[u(9,[w,g,pr(d[0])]),d[1]]}throw yr;case 10:if("number"==typeof t)throw yr;if(10===t.tag){var y=r(e[0],n,t[0]);return[u(10,[y[0]]),y[1]]}throw yr;case 11:if("number"==typeof t)throw yr;if(11===t.tag){var C=r(e[0],n,t[0]);return[u(11,[C[0]]),C[1]]}throw yr;case 12:throw yr;case 13:if("number"==typeof t)throw yr;if(13===t.tag){var F=r(e[0],n,t[0]);return[u(13,[F[0]]),F[1]]}throw yr;case 14:if("number"==typeof t)throw yr;if(14===t.tag){var A=r(e[0],n,t[0]);return[u(14,[A[0]]),A[1]]}throw yr}}(W[1],Y,rr),tr=nr[1];return[u(23,[u(8,[W[0],nr[0]]),tr[0]]),tr[1]];default:return Ar(W,Y,rr)}case 22:case 24:throw yr}}function Sr(r,e){return function(r,e){var n=xr(r,e);if("number"==typeof n[1])return n[0];throw yr}(r,V(pr(e)))}function _r(r,e,n){var t=n.length,a=Y(e),u=e<0?0:r;if(a<=t)return n;var c=er(a,2===u?48:32);switch(u){case 0:cr(n,0,c,0,t);break;case 1:cr(n,0,c,a-t|0,t);break;case 2:t>0&&(43===H(n,0)||45===H(n,0)||32===H(n,0))?(c[0]=H(n,0),cr(n,1,c,1+(a-t|0)|0,t-1|0)):t>1&&48===H(n,0)&&(120===H(n,1)||88===H(n,1))?(c[1]=H(n,1),cr(n,2,c,2+(a-t|0)|0,t-2|0)):cr(n,0,c,a-t|0,t)}return m(c)}function jr(r,e){var n=Y(r),t=e.length,a=H(e,0),u=0;if(a>=58)if(a>=71){if(a>102||a<97)return e;u=2}else{if(!(a>=65))return e;u=2}else if(32!==a){if(!(a>=43))return e;switch(a-43|0){case 0:case 2:u=1;break;case 1:case 3:case 4:return e;case 5:if((n+2|0)>t&&t>1&&(120===H(e,1)||88===H(e,1))){var c=er(n+2|0,48);return c[1]=H(e,1),cr(e,2,c,4+(n-t|0)|0,t-2|0),m(c)}u=2;break;case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:u=2}}else u=1;switch(u){case 1:if((n+1|0)>t){var i=er(n+1|0,48);return i[0]=a,cr(e,1,i,2+(n-t|0)|0,t-1|0),m(i)}return e;case 2:if(n>t){var o=er(n,48);return cr(e,0,o,n-t|0,t),m(o)}return e}}function Nr(r){return ur((e=r,function(r){for(;;){var n=r;if(n>=e.length)return!1;var t=e.charCodeAt(n);if(!(t>=32))return!0;var a=t-34|0;if(a>58||a<0){if(a>=93)return!0;r=n+1|0}else{if(a>57||a<1)return!0;r=n+1|0}}}(0)?m(function(r){for(var e=0,n=0,t=r.length-1|0;n<=t;++n){var a,u=r[n];if(u>=32){var c=u-34|0;a=c>58||c<0?c>=93?4:1:c>57||c<1?2:1}else a=u>=11?13!==u?4:2:u>=8?2:4;e=e+a|0}if(e===r.length)return function(r){var e=r.length,n=l(e);return b(r,0,n,0,e),n}(r);var i=l(e);e=0;for(var o=0,f=r.length-1|0;o<=f;++o){var s=r[o],v=0;if(s>=35)92!==s?s>=127?v=1:i[e]=s:v=2;else if(s>=32)s>=34?v=2:i[e]=s;else if(s>=14)v=1;else switch(s){case 8:i[e]=92,i[e=e+1|0]=98;break;case 9:i[e]=92,i[e=e+1|0]=116;break;case 10:i[e]=92,i[e=e+1|0]=110;break;case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 11:case 12:v=1;break;case 13:i[e]=92,i[e=e+1|0]=114}switch(v){case 1:i[e]=92,i[e=e+1|0]=48+(s/100|0)|0,i[e=e+1|0]=48+(s/10|0)%10|0,i[e=e+1|0]=48+s%10|0;break;case 2:i[e]=92,i[e=e+1|0]=s}e=e+1|0}return i}(function(r){for(var e=r.length,n=new Array(e),t=0,a=e-1|0;t<=a;++t)n[t]=r.charCodeAt(t);return n}(e))):e),['"',['"',0]]);var e}function Pr(r,e){var n;switch(r){case 0:n=["%",["d",0]];break;case 1:n=["%+",["d",0]];break;case 2:n=["% ",["d",0]];break;case 3:n=["%",["i",0]];break;case 4:n=["%+",["i",0]];break;case 5:n=["% ",["i",0]];break;case 6:n=["%",["x",0]];break;case 7:n=["%#",["x",0]];break;case 8:n=["%",["X",0]];break;case 9:n=["%#",["X",0]];break;case 10:n=["%",["o",0]];break;case 11:n=["%#",["o",0]];break;case 12:n=["%",["u",0]]}return ur(m(er(1,e)),n)}function Er(r,e){return L(function(r){switch(r){case 0:return"%d";case 1:return"%+d";case 2:return"% d";case 3:return"%i";case 4:return"%+i";case 5:return"% i";case 6:return"%x";case 7:return"%#x";case 8:return"%X";case 9:return"%#X";case 10:return"%o";case 11:return"%#o";case 12:return"%u"}}(r),e)}function Br(r,e){return Z(Pr(r,108),e)}function Rr(r,e){return U(Pr(r,110),e)}function qr(r,e){return function(r,e){var n=z(r),t=n[5]&&M(e,[0,0])?(n[8]=-1,P(e)):e,a="";switch(n[4]){case 0:var u=[0,8],c="01234567";if(M(t,[0,0])){var i=X(J(t),u),o=j([268435456,0],i[0]),f=i[1];for(a=String.fromCharCode(c.charCodeAt(0|f[1]))+a;I(o,[0,0]);){var s=X(o,u);o=s[0],f=s[1],a=String.fromCharCode(c.charCodeAt(0|f[1]))+a}}else{var v=X(t,u),h=v[0],l=v[1];for(a=String.fromCharCode(c.charCodeAt(0|l[1]))+a;I(h,[0,0]);){var b=X(h,u);h=b[0],l=b[1],a=String.fromCharCode(c.charCodeAt(0|l[1]))+a}}break;case 1:a=function(r){var e=t[1],n=t[0],a=function(r){return(r>>>0).toString(16)};if(0===n&&0===e)return"0";if(0!==e){if(0!==n){var u=a(e),c=8-u.length|0;return c<=0?a(n)+u:a(n)+(y(c,"0")+u)}return a(e)}return a(n)+"00000000"}()+a;break;case 2:var m=[0,10];if(M(t,[0,0])){var g=X(J(t),m),w=X(j([0,8],g[1]),m),p=j(j([214748364,3435973836],g[0]),w[0]),k=w[1];for(a=String.fromCharCode("0123456789".charCodeAt(0|k[1]))+a;I(p,[0,0]);){var d=X(p,m);p=d[0],k=d[1],a=String.fromCharCode("0123456789".charCodeAt(0|k[1]))+a}}else{var C=X(t,m),F=C[0],A=C[1];for(a=String.fromCharCode("0123456789".charCodeAt(0|A[1]))+a;I(F,[0,0]);){var x=X(F,m);F=x[0],A=x[1],a=String.fromCharCode("0123456789".charCodeAt(0|A[1]))+a}}}if(n[9]>=0){n[2]=" ";var S=n[9]-a.length|0;S>0&&(a=y(S,"0")+a)}return G(n,a)}(Pr(r,76),e)}function Ir(r,e,n){var t=function(r,e){var n=z(r),t=n[9]<0?6:n[9],a=e<0?(n[8]=-1,-e):e,u="";if(isNaN(a))u="nan",n[2]=" ";else if(isFinite(a))switch(n[10]){case"e":var c=(u=a.toExponential(t)).length;"e"===u[c-3|0]&&(u=u.slice(0,c-1|0)+"0"+u.slice(c-1|0));break;case"f":u=a.toFixed(t);break;case"g":var i=0!==t?t:1,o=(u=a.toExponential(i-1|0)).indexOf("e"),f=0|Number(u.slice(o+1|0));if(f<-4||a>=1e21||a.toFixed().length>i){for(var s=o-1|0;"0"===u[s];)s=s-1|0;"."===u[s]&&(s=s-1|0);var v=(u=u.slice(0,s+1|0)+u.slice(o)).length;"e"===u[v-3|0]&&(u=u.slice(0,v-1|0)+"0"+u.slice(v-1|0))}else{var h=i;if(f<0)u=a.toFixed(h=h-(f+1|0)|0);else for(;(u=a.toFixed(h)).length>(i+1|0);)h=h-1|0;if(0!==h){for(var l=u.length-1|0;"0"===u[l];)l=l-1|0;"."===u[l]&&(l=l-1|0),u=u.slice(0,l+1|0)}}}else u="inf",n[2]=" ";return G(n,u)}(function(r,e){if(15===r)return"%.12g";var n=Y(e),t=function(r){switch(r){case 0:case 1:case 2:return 102;case 3:case 4:case 5:return 101;case 6:case 7:case 8:return 69;case 9:case 10:case 11:return 103;case 12:case 13:case 14:return 71;case 15:return 70}}(r),a=[0,l(16)];return br(a,37),function(r,e){switch(e){case 1:case 4:case 7:case 10:case 13:return br(r,43);case 2:case 5:case 8:case 11:case 14:br(r,32)}}(a,r),br(a,46),mr(a,String(n)),br(a,t),gr(a)}(r,Y(e)),n);if(15!==r)return t;var a=t.length,u=function(r){return isFinite(r)?Math.abs(r)>=2.2250738585072014e-308?0:0!==r?1:2:isNaN(r)?4:3}(n);return 3!==u?u>=4?"nan":function(r){for(;;){var e=r;if(e===a)return!1;var n=H(t,e)-46|0;if(n>23||n<0){if(55!==n){r=e+1|0;continue}return!0}if(n>22||n<1)return!0;r=e+1|0}}(0)?t:t+".":n<0?"neg_infinity":"infinity"}function Mr(r){return ur(function(r){var e=0;if(r>=40){if(92===r)return"\\\\";e=r>=127?1:2}else if(r>=32){if(r>=39)return"\\'";e=2}else if(r>=14)e=1;else switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 11:case 12:e=1;break;case 13:return"\\r"}switch(e){case 1:var n=[0,0,0,0];return n[0]=92,n[1]=48+(r/100|0)|0,n[2]=48+(r/10|0)%10|0,n[3]=48+r%10|0,m(n);case 2:var t=[0];return t[0]=r,m(t)}}(r),["'",["'",0]])}function Tr(r){var e=[0,l(16)];return function r(e,n){for(;;){var t=n;if("number"==typeof t)return 0;switch(0|t.tag){case 0:mr(e,"%c"),n=t[0];continue;case 1:mr(e,"%s"),n=t[0];continue;case 2:mr(e,"%i"),n=t[0];continue;case 3:mr(e,"%li"),n=t[0];continue;case 4:mr(e,"%ni"),n=t[0];continue;case 5:mr(e,"%Li"),n=t[0];continue;case 6:mr(e,"%f"),n=t[0];continue;case 7:mr(e,"%B"),n=t[0];continue;case 8:mr(e,"%{"),r(e,t[0]),mr(e,"%}"),n=t[1];continue;case 9:mr(e,"%("),r(e,t[0]),mr(e,"%)"),n=t[2];continue;case 10:mr(e,"%a"),n=t[0];continue;case 11:mr(e,"%t"),n=t[0];continue;case 12:mr(e,"%?"),n=t[0];continue;case 13:mr(e,"%r"),n=t[0];continue;case 14:mr(e,"%_r"),n=t[0];continue}}}(e,r),gr(e)}function Or(r,e,n,t){for(;;){var a=t,c=n,i=r;if("number"==typeof a)return h(i,e,c);switch(0|a.tag){case 0:return function(r,n,t){return function(a){var c=u(5,[n,a]);return Or(r,e,c,t)}}(i,c,a[0]);case 1:return function(r,n,t){return function(a){var c=Mr(a),i=u(4,[n,c]);return Or(r,e,i,t)}}(i,c,a[0]);case 2:return Jr(i,e,c,a[1],a[0],function(r){return r});case 3:return Jr(i,e,c,a[1],a[0],Nr);case 4:return $r(i,e,c,a[3],a[1],a[2],Er,a[0]);case 5:return $r(i,e,c,a[3],a[1],a[2],Br,a[0]);case 6:return $r(i,e,c,a[3],a[1],a[2],Rr,a[0]);case 7:return $r(i,e,c,a[3],a[1],a[2],qr,a[0]);case 8:var f=i,s=e,l=c,b=a[3],m=a[1],g=a[2],w=a[0];if("number"==typeof m)return"number"==typeof g?0!==g?function(r,e,n,t,a){return function(c,i){var o=Ir(a,c,i);return Or(r,e,u(4,[n,o]),t)}}(f,s,l,b,w):function(r,e,n,t,a){return function(c){var i=Ir(a,6,c);return Or(r,e,u(4,[n,i]),t)}}(f,s,l,b,w):function(r,e,n,t,a,c){return function(i){var o=Ir(a,c,i);return Or(r,e,u(4,[n,o]),t)}}(f,s,l,b,w,g[0]);if(m.tag){var p=m[0];return"number"==typeof g?0!==g?function(r,e,n,t,a,c){return function(i,o,f){var s=_r(c,i,Ir(a,o,f));return Or(r,e,u(4,[n,s]),t)}}(f,s,l,b,w,p):function(r,e,n,t,a,c){return function(i,o){var f=Ir(a,6,o),s=_r(c,i,f);return Or(r,e,u(4,[n,s]),t)}}(f,s,l,b,w,p):function(r,e,n,t,a,c,i){return function(o,f){var s=_r(c,o,Ir(a,i,f));return Or(r,e,u(4,[n,s]),t)}}(f,s,l,b,w,p,g[0])}var k=m[1],d=m[0];return"number"==typeof g?0!==g?function(r,e,n,t,a,c,i){return function(o,f){var s=_r(c,i,Ir(a,o,f));return Or(r,e,u(4,[n,s]),t)}}(f,s,l,b,w,d,k):function(r,e,n,t,a,c,i){return function(o){var f=Ir(a,6,o),s=_r(c,i,f);return Or(r,e,u(4,[n,s]),t)}}(f,s,l,b,w,d,k):function(r,e,n,t,a,c,i,o){return function(f){var s=_r(c,i,Ir(a,o,f));return Or(r,e,u(4,[n,s]),t)}}(f,s,l,b,w,d,k,g[0]);case 9:return function(r,n,t){return function(a){return Or(r,e,u(4,[n,a?"true":"false"]),t)}}(i,c,a[0]);case 10:t=a[0],n=u(7,[c]);continue;case 11:t=a[1],n=u(2,[c,a[0]]);continue;case 12:t=a[1],n=u(3,[c,a[0]]);continue;case 13:return function(r,n,t,a){return function(c){return Or(r,e,u(4,[n,a]),t)}}(i,c,a[2],Tr(a[1]));case 14:return function(r,n,t,a){return function(u){return Or(r,e,n,W(Sr(u[0],t),a))}}(i,c,a[1],a[2]);case 15:return function(r,n,t){return function(a,c){return Or(r,e,u(6,[n,function(r){return h(a,r,c)}]),t)}}(i,c,a[0]);case 16:return function(r,n,t){return function(a){return Or(r,e,u(6,[n,a]),t)}}(i,c,a[0]);case 17:t=a[1],n=u(0,[c,a[0]]);continue;case 18:var y=a[0];if(y.tag){var C=function(r,e,n){return function(t,a){return Or(r,t,u(1,[e,u(1,[a])]),n)}}(i,c,a[1]);t=y[0][0],n=0,r=C;continue}var F=function(r,e,n){return function(t,a){return Or(r,t,u(1,[e,u(0,[a])]),n)}}(i,c,a[1]);t=y[0][0],n=0,r=F;continue;case 19:throw[o,["camlinternalFormat.ml",1449,4]];case 20:return function(r,n,t){return function(a){return Or(r,e,t,n)}}(i,a[2],u(8,[c,"Printf: bad conversion %["]));case 21:return function(r,n,t){return function(a){var c=L("%u",a),i=u(4,[n,c]);return Or(r,e,i,t)}}(i,c,a[1]);case 22:return function(r,n,t){return function(a){var c=u(5,[n,a]);return Or(r,e,c,t)}}(i,c,a[0]);case 23:var A=i,x=e,S=c,_=a[0],j=a[1];if("number"==typeof _){if(3===_)throw[o,["camlinternalFormat.ml",1517,39]];return Xr(A,x,S,j)}return 8===_.tag?Dr(A,x,S,_[1],j):Xr(A,x,S,j);case 24:return zr(i,e,c,a[2],a[0],v(a[1],0))}}}function Dr(r,e,n,t,a){if("number"==typeof t)return Xr(r,e,n,a);switch(0|t.tag){case 0:var c=t[0];return function(t){return Dr(r,e,n,c,a)};case 1:var i=t[0];return function(t){return Dr(r,e,n,i,a)};case 2:var f=t[0];return function(t){return Dr(r,e,n,f,a)};case 3:var s=t[0];return function(t){return Dr(r,e,n,s,a)};case 4:var v=t[0];return function(t){return Dr(r,e,n,v,a)};case 5:var h=t[0];return function(t){return Dr(r,e,n,h,a)};case 6:var l=t[0];return function(t){return Dr(r,e,n,l,a)};case 7:var b=t[0];return function(t){return Dr(r,e,n,b,a)};case 8:var m=t[1];return function(t){return Dr(r,e,n,m,a)};case 9:var g=t[2],w=dr(pr(t[0]),t[1]);return function(t){return Dr(r,e,n,function r(e,n){if("number"==typeof e)return n;switch(0|e.tag){case 0:return u(0,[r(e[0],n)]);case 1:return u(1,[r(e[0],n)]);case 2:return u(2,[r(e[0],n)]);case 3:return u(3,[r(e[0],n)]);case 4:return u(4,[r(e[0],n)]);case 5:return u(5,[r(e[0],n)]);case 6:return u(6,[r(e[0],n)]);case 7:return u(7,[r(e[0],n)]);case 8:return u(8,[e[0],r(e[1],n)]);case 9:return u(9,[e[0],e[1],r(e[2],n)]);case 10:return u(10,[r(e[0],n)]);case 11:return u(11,[r(e[0],n)]);case 12:return u(12,[r(e[0],n)]);case 13:return u(13,[r(e[0],n)]);case 14:return u(14,[r(e[0],n)])}}(w,g),a)};case 10:var p=t[0];return function(t,u){return Dr(r,e,n,p,a)};case 11:var k=t[0];return function(t){return Dr(r,e,n,k,a)};case 12:var d=t[0];return function(t){return Dr(r,e,n,d,a)};case 13:throw[o,["camlinternalFormat.ml",1540,31]];case 14:throw[o,["camlinternalFormat.ml",1541,31]]}}function Xr(r,e,n,t){return Or(r,e,u(8,[n,"Printf: bad conversion %_"]),t)}function Jr(r,e,n,t,a,c){if("number"==typeof a)return function(a){var i=v(c,a),o=u(4,[n,i]);return Or(r,e,o,t)};if(a.tag){var i=a[0];return function(a,o){var f=_r(i,a,v(c,o)),s=u(4,[n,f]);return Or(r,e,s,t)}}var o=a[1],f=a[0];return function(a){var i=_r(f,o,v(c,a)),s=u(4,[n,i]);return Or(r,e,s,t)}}function $r(r,e,n,t,a,c,i,o){if("number"==typeof a){if("number"==typeof c)return 0!==c?function(a,c){var f=jr(a,h(i,o,c));return Or(r,e,u(4,[n,f]),t)}:function(a){var c=h(i,o,a);return Or(r,e,u(4,[n,c]),t)};var f=c[0];return function(a){var c=jr(f,h(i,o,a));return Or(r,e,u(4,[n,c]),t)}}if(a.tag){var s=a[0];if("number"==typeof c)return 0!==c?function(a,c,f){var v=_r(s,a,jr(c,h(i,o,f)));return Or(r,e,u(4,[n,v]),t)}:function(a,c){var f=_r(s,a,h(i,o,c));return Or(r,e,u(4,[n,f]),t)};var v=c[0];return function(a,c){var f=_r(s,a,jr(v,h(i,o,c)));return Or(r,e,u(4,[n,f]),t)}}var l=a[1],b=a[0];if("number"==typeof c)return 0!==c?function(a,c){var f=_r(b,l,jr(a,h(i,o,c)));return Or(r,e,u(4,[n,f]),t)}:function(a){var c=_r(b,l,h(i,o,a));return Or(r,e,u(4,[n,c]),t)};var m=c[0];return function(a){var c=_r(b,l,jr(m,h(i,o,a)));return Or(r,e,u(4,[n,c]),t)}}function zr(r,e,n,t,a,c){if(a){var i=a[0];return function(a){return zr(r,e,n,t,i,v(c,a))}}return Or(r,e,u(4,[n,c]),t)}function Gr(r){return e=function(r){return r},Or(function(r,n){var t,a,u=[t=l(64),0,64,t];return function r(e,n){for(;;){var t=n,a=0;if("number"==typeof t)return 0;switch(0|t.tag){case 0:var u=wr(t[1]);return r(e,t[0]),fr(e,u);case 1:var i=t[1];if(r(e,t[0]),i.tag){fr(e,"@["),n=i[0];continue}fr(e,"@{"),n=i[0];continue;case 2:case 4:a=1;break;case 3:case 5:a=2;break;case 6:return r(e,t[0]),fr(e,v(t[1],0));case 7:n=t[0];continue;case 8:throw r(e,t[0]),[c,t[1]]}switch(a){case 1:return r(e,t[0]),fr(e,t[1]);case 2:return r(e,t[0]),or(e,t[1])}}}(u,n),v(e,nr((a=u)[0],0,a[1]))},0,0,r[0]);var e}function Lr(r){var e=typeof r;return"string"===e?u(0,[r]):"number"===e?u(1,[r]):"boolean"===e?!0===r?1:0:null===r?2:Array.isArray(r)?u(3,[r]):u(2,[r])}function Ur(r){if("string"==typeof r)return r}function Zr(r){return e.toNumber(r)}function Hr(r,n){return e.__fromString(r,n)}function Kr(r){return e.BigInt(r)}function Qr(r){return r.replace(/^0x/,"")}var Vr=/^0x[0-9a-fA-F]+$/;function Wr(r){return Vr.test(r)}var Yr=/^[0-9]+$/,re=Kr(0);function ee(r){var e=Lr(r);if("number"==typeof e)return 0;switch(0|e.tag){case 0:var n=e[0];return Wr(n)?Zr(Hr(Qr(n),16)):Yr.test(n)?Zr(Hr(Qr(n),10)):0;case 1:return 0|e[0];default:return 0}}function ne(r){var e=Ur(r);return void 0!==e?e:""}function te(r){var e=Ur(r);return void 0!==e?e:""}var ae=[ee,ee,ee,function(r){var n=Lr(r);if("number"==typeof n)return re;switch(0|n.tag){case 0:var t=n[0];return Wr(t)?Hr(Qr(t),16):re;case 1:return e.BigInt(n[0]);default:return re}},ne,function(r){var e,n=Lr(r);return"number"==typeof n?[]:3===n.tag?function(r,e){for(var n=r.length,t=new Array(n),a=0,u=n-1|0;a<=u;++a)t[a]=e(r[a]);return t}(n[0],1===(e=ne).length?e:function(r){return v(e,r)}):[]},te,te],ue=/^0x[0-9a-fA-F]{40}$/;function ce(r){return ue.test(r)}function ie(r){return"0x"+Kr(r).toString(16)}function oe(r){return"0x"+r.toString(16)}var fe=[function(r){return r},function(r){return r},ie,oe,function(r){return v(Gr([u(11,["0x",u(4,[6,0,0,0])]),"0x%x"]),r)},function(r){var e={};e.to=r.to;var n=r.value;void 0!==n&&(e.value=oe(n));var t=r.from;void 0!==t&&(e.from=t);var a=r.data;void 0!==a&&(e.data=a);var u=r.gas;void 0!==u&&(e.gas=oe(u));var c=r.gasPrice;void 0!==c&&(e.gasPrice=oe(c));var i=r.nonce;return void 0!==i&&(e.nonce=ie(i)),e},function(r){if("number"!=typeof r)return v(Gr([u(11,["0x",u(4,[6,0,0,0])]),"0x%x"]),r[0]);switch(r){case 0:return"earliest";case 1:return"latest";case 2:return"pending"}}],se={coinbase:function(r){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[ae[4](r[0])])},h(r,"eth_coinbase",[]))},accounts:function(r){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[ae[5](r[0])])},h(r,"eth_accounts",[]))},balanceOf:function(r,e,n,t){var c=void 0!==n?n:1;if(ce(e)){var i=[fe[0](e),fe[6](c)];return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[ae[3](r[0])])},h(r,"eth_getBalance",i))}return a.resolved(u(1,["Invalid Address: "+e]))},getTransactionCount:function(r,e,n,t){var c=void 0!==n?n:1;if(ce(e)){var i=[fe[0](e),fe[6](c)];return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[ae[1](r[0])])},h(r,"eth_getTransactionCount",i))}return a.resolved(u(1,["Invalid Address: "+e]))},blockNumber:function(r){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[ae[2](r[0])])},h(r,"eth_blockNumber",[]))},gasPrice:function(r){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[ae[3](r[0])])},h(r,"eth_gasPrice",[]))},sendTransaction:function(r,e,n){var t=[fe[5](e)];return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[ae[7](r[0])])},h(r,"eth_sendTransaction",t))},estimateGas:function(r,e,n,t){var c=void 0!==n?n:1,i=[fe[5](e),fe[6](c)];return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[ae[3](r[0])])},h(r,"eth_estimateGas",i))},call:function(r,e,n,t){var c=void 0!==n?n:1,i=[fe[5](e),fe[6](c)];return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[ae[7](r[0])])},h(r,"eth_call",i))},mineBlock:function(r){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[ae[6](r[0])])},h(r,"evm_mine",[]))}};function ve(r,e){var n={jsonrpc:"2.0",id:1};return n.method=r,n.params=e,n}function he(r){var e=n.optional(n.at(["error",["message",0]],n.string),r);return void 0!==e?u(1,[e]):function(r){var e=Lr(r);if("number"==typeof e||2!==e.tag)return u(1,["Invalid response"]);var n=function(r,e){if(e in r)return vr(r[e])}(e[0],"result");return void 0!==n?u(0,[hr(n)]):u(1,["No result"])}(r)}require("isomorphic-fetch"),Q("Providers-BsEth.JsonRpcError");var le={web3:function(r,e,n){var t=a.make(0),c=t[1];return r.sendAsync(ve(e,n),function(r,e){return v(c,null==e?u(1,null==r?["Something went wrong"]:[r]):he(e))}),t[0]},http:function(r,e,n){return a.map(function(r){return r.tag?u(1,[r[0]]):he(r[0])},function(r,e){return a.Rejectable[7](function(r){return a.Rejectable[2](u(1,["Error"]))},a.Rejectable[5](function(r){return u(0,[r])},a.Rejectable[4](function(r){return a.Rejectable[10](r.json())},a.Rejectable[10](fetch(r,t.RequestInit[0](2,{"Content-Type":"application/json"},vr(JSON.stringify(e)),void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)(0))))))}(r,ve(e,n)))}},be={bnZero:re,Decode:ae,Encode:fe};exports.Eth=se,exports.Providers=le,exports.Formats=be; | ||
var r,e=(r=require("jsbi"))&&"object"==typeof r&&"default"in r?r.default:r,n=require("@glennsl/bs-json/src/Json_decode.bs.js"),t=require("bs-fetch/src/Fetch.js"),a=require("@aantron/repromise/src/js/repromise.js");function u(r,e){return e.tag=r,e}var c=["Invalid_argument",-3],i=["Division_by_zero",-5],o=["Assert_failure",-10];function s(r,e,n){for(var t=new Array(n),a=0,u=e;a<n;)t[a]=r[u],a=a+1|0,u=u+1|0;return t}function f(r,e){for(;;){var n=e,t=r,a=t.length,u=0===a?1:a,c=u-n.length|0;if(0===c)return t.apply(null,n);if(!(c<0))return function(r,e){return function(n){return f(r,e.concat([n]))}}(t,n);e=s(n,u,0|-c),r=t.apply(null,s(n,0,u))}}function v(r,e){var n=r.length;return 1===n?r(e):function(r,e,n){switch(n){case 1:return r(e);case 2:return function(n){return r(e,n)};case 3:return function(n,t){return r(e,n,t)};case 4:return function(n,t,a){return r(e,n,t,a)};case 5:return function(n,t,a,u){return r(e,n,t,a,u)};case 6:return function(n,t,a,u,c){return r(e,n,t,a,u,c)};case 7:return function(n,t,a,u,c,i){return r(e,n,t,a,u,c,i)};default:return f(r,[e])}}(r,e,n)}function l(r,e,n){var t=r.length;return 2===t?r(e,n):function(r,e,n,t){switch(t){case 1:return f(r(e),[n]);case 2:return r(e,n);case 3:return function(t){return r(e,n,t)};case 4:return function(t,a){return r(e,n,t,a)};case 5:return function(t,a,u){return r(e,n,t,a,u)};case 6:return function(t,a,u,c){return r(e,n,t,a,u,c)};case 7:return function(t,a,u,c,i){return r(e,n,t,a,u,c,i)};default:return f(r,[e,n])}}(r,e,n,t)}function h(r){if(r<0)throw[c,"String.create"];for(var e=new Array(r),n=0,t=r-1|0;n<=t;++n)e[n]=0;return e}function g(r,e,n,t,a){if(a>0){if(r===n){var u=r,c=e,i=t,o=a;if(c<i){for(var s=(u.length-i|0)-1|0,f=o-1|0,v=s>f?f:s;v>=0;--v)u[i+v|0]=u[c+v|0];return 0}if(c>i){for(var l=(u.length-c|0)-1|0,h=o-1|0,g=l>h?h:l,b=0;b<=g;++b)u[i+b|0]=u[c+b|0];return 0}return 0}var m=r.length-e|0;if(a<=m){for(var d=0,w=a-1|0;d<=w;++d)n[t+d|0]=r[e+d|0];return 0}for(var p=0,k=m-1|0;p<=k;++p)n[t+p|0]=r[e+p|0];for(var y=m,C=a-1|0;y<=C;++y)n[t+y|0]=0;return 0}return 0}function b(r){var e=r,n=r.length,t="",a=n;if(n<=4096&&n===e.length)return String.fromCharCode.apply(null,e);for(var u=0;a>0;){var c=a<1024?a:1024,i=new Array(c);g(e,u,i,0,c),t+=String.fromCharCode.apply(null,i),a=a-c|0,u=u+c|0}return t}function m(r,e,n,t,a){if(a>0){var u=r.length-e|0;if(a<=u){for(var c=0,i=a-1|0;c<=i;++c)n[t+c|0]=r.charCodeAt(e+c|0);return 0}for(var o=0,s=u-1|0;o<=s;++o)n[t+o|0]=r.charCodeAt(e+o|0);for(var f=u,v=a-1|0;f<=v;++f)n[t+f|0]=0;return 0}return 0}function d(r,e){return r>e?r:e}function w(r,e){for(var n in r)e(n)}function p(r,e){return!function r(e,n){for(;;){var t=n,a=e;if(a===t)return!0;var u=typeof a;if("string"===u||"number"===u||"boolean"===u||"undefined"===u||null===a)return!1;var i=typeof t;if("function"===u||"function"===i)throw[c,"equal: functional value"];if("number"===i||"undefined"===i||null===t)return!1;var o=0|a.tag,s=0|t.tag;if(250!==o)if(250!==s){if(248===o)return a[1]===t[1];if(251===o)throw[c,"equal: abstract value"];if(o!==s)return!1;if(256===o)return a[1]===t[1];var f=0|a.length;if(f!==(0|t.length))return!1;if(!Array.isArray(a)){if(a instanceof Date&&t instanceof Date)return!(a>t||a<t);var v=a,l=t,h=[!0],g=function(r,e){return function(n){return r.hasOwnProperty(n)?0:(e[0]=!1,0)}}(l,h),b=function(e,n,t){return function(a){return e.hasOwnProperty(a)&&r(n[a],e[a])?0:(t[0]=!1,0)}}(v,l,h);return w(v,g),h[0]&&w(l,b),h[0]}for(var m=a,d=t,p=0,k=f;;){var y=p;if(y===k)return!0;if(!r(m[y],d[y]))return!1;p=y+1|0}}else n=t[0];else e=a[0]}}(r,e)}c.tag=248,i.tag=248,o.tag=248;var k=Math.imul||function(r,e){return((r>>16)*(e|=0)<<16)+(65535&r)*e|0};function y(r,e){if(e.repeat)return e.repeat(r);if(0==e.length||0==r)return"";if(e.length*r>=1<<28)throw new RangeError("repeat count must not overflow maximum string size");for(var n="";1==(1&r)&&(n+=e),0!=(r>>>=1);)e+=e;return n}var C=[-2147483648,0],F=[2147483647,1],x=[0,1],A=[0,0],_=[-1,4294967295];function S(r){return 0!=(2147483648&r)}function B(r,e){var n=e[1],t=r[1],a=t+n&4294967295,u=S(t)&&(S(n)||!S(a))||S(n)&&!S(a)?1:0;return[r[0]+e[0]+u&4294967295,a>>>0]}function N(r,e){return r[0]===e[0]&&r[1]===e[1]}function j(r){return N(r,C)?C:B([-1^(e=r)[0],(-1^e[1])>>>0],x);var e}function R(r,e){if(0===e)return r;var n=r[1];return e>=32?[n<<(e-32|0),0]:[n>>>(32-e|0)|r[0]<<e,n<<e>>>0]}function P(r,e){if(0===e)return r;var n=r[0];return e<32?[n>>e,(n<<(32-e|0)|r[1]>>>e)>>>0]:[n>=0?0:-1,n>>(e-32|0)>>>0]}function I(r,e){for(;;){var n,t=e,a=r,u=0,c=a[0],i=0;if(0===c&&0===a[1])return A;if(0===t[0]&&0===t[1])return A;if(-2147483648!==c||0!==a[1]?i=2:(n=t[1],u=1),2===i){var o=t[0],s=a[1],f=0;if(-2147483648!==o||0!==t[1]?f=3:(n=s,u=1),3===f){var v=t[1];if(c<0){if(o<0){e=j(t),r=j(a);continue}return j(I(j(a),t))}if(o<0)return j(I(a,j(t)));var l=65535&c,h=s>>>16,g=65535&s,b=65535&o,m=v>>>16,d=65535&v,w=0,p=0,k=0,y=g*d;return w=(p=(p=(k=(y>>>16)+h*d)>>>16)+((k=(65535&k)+g*m)>>>16)+l*d)>>>16,w+=(p=(65535&p)+h*m)>>>16,w+=(p=(65535&p)+g*b)>>>16,[(p&=65535)|(w=w+((c>>>16)*d+l*m+h*b+g*(o>>>16))&65535)<<16,(65535&y|(65535&k)<<16)>>>0]}}if(1===u)return 0==(1&n)?A:C}}function E(r,e){var n=e[0],t=r[0];return t>n||!(t<n)&&r[1]>=e[1]}function H(r,e){return!N(r,e)}function T(r,e){return!E(r,e)}function q(r,e){return r[0]>e[0]||!(r[0]<e[0])&&r[1]>e[1]}function M(r){return 4294967296*r[0]+r[1]}function D(r){return isNaN(r)||!isFinite(r)?A:r<=-0x8000000000000000?C:r+1>=0x8000000000000000?F:r<0?j(D(-r)):[r/4294967296|0,(r%4294967296|0)>>>0]}function O(r,e){var n=function r(e,n){for(;;){var t=n,a=e,u=a[0],c=0;if(0===t[0]&&0===t[1])throw i;if(-2147483648!==u){if(0===u&&0===a[1])return A;c=1}else{if(0===a[1]){if(N(t,x)||N(t,_))return a;if(N(t,C))return x;var o=t[0],s=R(r(P(a,1),t),1);if(0===s[0]&&0===s[1])return o<0?x:j(x);var f=B(a,j(I(t,s)));return B(s,r(f,t))}c=1}if(1===c){var v=t[0];if(-2147483648===v&&0===t[1])return A;if(u<0){if(v<0){n=j(t),e=j(a);continue}return j(r(j(a),t))}if(v<0)return j(r(a,j(t)));for(var l=A,h=a;E(h,t);){for(var g=d(1,Math.floor(M(h)/M(t))),b=Math.ceil(Math.log(g)/Math.LN2),m=b<=48?1:Math.pow(2,b-48),w=D(g),p=I(w,t);p[0]<0||q(p,h);)p=I(w=D(g-=m),t);0===(k=w)[0]&&0===k[1]&&(w=x),l=B(l,w),h=B(h,j(p))}return l}}var k}(r,e);return[n,B(r,j(I(n,e)))]}function U(r){return[2147483647&r[0],r[1]]}function X(r){return r>=65&&r<=90||r>=192&&r<=214||r>=216&&r<=222?r+32|0:r}function z(r){var e=r.length;if(e>31)throw[c,"format_int: format too long"];for(var n=["+","-"," ",!1,2,!1,0,!1,1,-1,"f"],t=0;;){var a=t;if(a>=e)return n;var u=r.charCodeAt(a),i=0;if(u>=69)if(u>=88)if(u>=121)i=1;else switch(u-88|0){case 0:n[4]=1,n[7]=!0,t=a+1|0;continue;case 13:case 14:case 15:i=5;break;case 12:case 17:i=4;break;case 23:n[4]=0,t=a+1|0;continue;case 29:n[4]=2,t=a+1|0;continue;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 16:case 18:case 19:case 20:case 21:case 22:case 24:case 25:case 26:case 27:case 28:case 30:case 31:i=1;break;case 32:n[4]=1,t=a+1|0;continue}else{if(!(u>=72)){n[5]=!0,n[7]=!0,n[10]=String.fromCharCode(X(u)),t=a+1|0;continue}i=1}else switch(u){case 35:n[3]=!0,t=a+1|0;continue;case 32:case 43:i=2;break;case 45:n[0]="-",t=a+1|0;continue;case 46:n[9]=0;for(var o=a+1|0;function(e){return function(){var n=r.charCodeAt(e)-48|0;return n>=0&&n<=9}}(o)();)n[9]=(k(n[9],10)+r.charCodeAt(o)|0)-48|0,o=o+1|0;t=o;continue;case 33:case 34:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 44:case 47:i=1;break;case 48:n[2]="0",t=a+1|0;continue;case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:i=3;break;default:i=1}switch(i){case 1:t=a+1|0;continue;case 2:n[1]=String.fromCharCode(u),t=a+1|0;continue;case 3:n[6]=0;for(var s=a;function(e){return function(){var n=r.charCodeAt(e)-48|0;return n>=0&&n<=9}}(s)();)n[6]=(k(n[6],10)+r.charCodeAt(s)|0)-48|0,s=s+1|0;t=s;continue;case 4:n[5]=!0,n[4]=2,t=a+1|0;continue;case 5:n[5]=!0,n[10]=String.fromCharCode(u),t=a+1|0;continue}}}function G(r,e){var n=r[0],t=r[1],a=r[2],u=r[3],c=r[4],i=r[5],o=r[6],s=r[7],f=r[8],v=e.length;i&&(f<0||"-"!==t)&&(v=v+1|0),u&&(0===c?v=v+1|0:1===c&&(v=v+2|0));var l="";if("+"===n&&" "===a)for(var h=v,g=o-1|0;h<=g;++h)l+=a;if(i&&(f<0?l+="-":"-"!==t&&(l+=t)),u&&0===c&&(l+="0"),u&&1===c&&(l+="0x"),"+"===n&&"0"===a)for(var b=v,m=o-1|0;b<=m;++b)l+=a;if(l=s?l+e.toUpperCase():l+e,"-"===n)for(var d=v,w=o-1|0;d<=w;++d)l+=" ";return l}function J(r,e){if("%d"===r)return String(e);var n=z(r),t=e,a=(t<0?n[5]?(n[8]=-1,-t):t>>>0:t).toString(function(r){switch(n[4]){case 0:return 8;case 1:return 16;case 2:return 10}}());if(n[9]>=0){n[2]=" ";var u=n[9]-a.length|0;u>0&&(a=y(u,"0")+a)}return G(n,a)}var L=J,$=J;function V(r,e){if(e<0||e>=r.length)throw[c,"index out of bounds"];return r.charCodeAt(e)}var Z=[0];function K(r){var e=[r,(Z[0]+=1,Z[0])];return e.tag=248,e}function Q(r){if("number"==typeof r)return 0;switch(0|r.tag){case 0:return u(0,[Q(r[0])]);case 1:return u(1,[Q(r[0])]);case 2:return u(2,[Q(r[0])]);case 3:return u(3,[Q(r[0])]);case 4:return u(4,[Q(r[0])]);case 5:return u(5,[Q(r[0])]);case 6:return u(6,[Q(r[0])]);case 7:return u(7,[Q(r[0])]);case 8:return u(8,[r[0],Q(r[1])]);case 9:var e=r[0];return u(9,[e,e,Q(r[2])]);case 10:return u(10,[Q(r[0])]);case 11:return u(11,[Q(r[0])]);case 12:return u(12,[Q(r[0])]);case 13:return u(13,[Q(r[0])]);case 14:return u(14,[Q(r[0])])}}function W(r,e){if("number"==typeof r)return e;switch(0|r.tag){case 0:return u(0,[W(r[0],e)]);case 1:return u(1,[W(r[0],e)]);case 2:return u(2,[r[0],W(r[1],e)]);case 3:return u(3,[r[0],W(r[1],e)]);case 4:return u(4,[r[0],r[1],r[2],W(r[3],e)]);case 5:return u(5,[r[0],r[1],r[2],W(r[3],e)]);case 6:return u(6,[r[0],r[1],r[2],W(r[3],e)]);case 7:return u(7,[r[0],r[1],r[2],W(r[3],e)]);case 8:return u(8,[r[0],r[1],r[2],W(r[3],e)]);case 9:return u(9,[W(r[0],e)]);case 10:return u(10,[W(r[0],e)]);case 11:return u(11,[r[0],W(r[1],e)]);case 12:return u(12,[r[0],W(r[1],e)]);case 13:return u(13,[r[0],r[1],W(r[2],e)]);case 14:return u(14,[r[0],r[1],W(r[2],e)]);case 15:return u(15,[W(r[0],e)]);case 16:return u(16,[W(r[0],e)]);case 17:return u(17,[r[0],W(r[1],e)]);case 18:return u(18,[r[0],W(r[1],e)]);case 19:return u(19,[W(r[0],e)]);case 20:return u(20,[r[0],r[1],W(r[2],e)]);case 21:return u(21,[r[0],W(r[1],e)]);case 22:return u(22,[W(r[0],e)]);case 23:return u(23,[r[0],W(r[1],e)]);case 24:return u(24,[r[0],r[1],W(r[2],e)])}}function Y(r){return r>=0?r:0|-r}function rr(r,e){for(;;){var n=e;if(!n)return 0;v(r,n[0]),e=n[1]}}function er(r,e){var n=h(r);return function(e,n,t,a){if(r>0)for(var u=0,c=(r+0|0)-1|0;u<=c;++u)e[u]=a}(n,0,0,e),n}function nr(r,e,n){return b(function(r,e,n){if(e<0||n<0||e>(r.length-n|0))throw[c,"String.sub / Bytes.sub"];var t=h(n);return g(r,e,t,0,n),t}(r,e,n))}function tr(r,e,n,t,a){if(a<0||e<0||e>(r.length-a|0)||t<0||t>(n.length-a|0))throw[c,"Bytes.blit"];return g(r,e,n,t,a)}function ar(r,e,n,t,a){if(a<0||e<0||e>(r.length-a|0)||t<0||t>(n.length-a|0))throw[c,"String.blit / Bytes.blit_string"];return m(r,e,n,t,a)}function ur(r,e){if(e){var n=e[0],t=[0],a=[0];rr(function(r){return t[0]=t[0]+1|0,a[0]=a[0]+r.length|0,0},e);var u=h(a[0]+k(r.length,t[0]-1|0)|0);m(n,0,u,0,n.length);var c=[n.length];return rr(function(e){return m(r,0,u,c[0],r.length),c[0]=c[0]+r.length|0,m(e,0,u,c[0],e.length),c[0]=c[0]+e.length|0,0},e[1]),b(u)}return""}K("Pervasives.Exit");var cr=ar;function ir(r,e){for(var n=r[2];(r[1]+e|0)>n;)n<<=1;var t=h(n);return tr(r[0],0,t,0,r[1]),r[0]=t,r[2]=n,0}function or(r,e){var n=r[1];return n>=r[2]&&ir(r,1),r[0][n]=e,r[1]=n+1|0,0}function sr(r,e){var n=e.length,t=r[1]+n|0;return t>r[2]&&ir(r,n),ar(e,0,r[0],r[1],n),r[1]=t,0}var fr=[];function vr(r){if(void 0===r){var e=[fr,0];return e.tag=256,e}if(null!==r&&r[0]===fr){var n=[fr,r[1]+1|0];return n.tag=256,n}return r}function lr(r){if(null!==r&&r[0]===fr){var e=r[1];return 0===e?void 0:[fr,e-1|0]}return r}function hr(r,e){var n,t,a=r[1].length,u=r[0]+e|0;if(u>a){var c=h((n=a<<1)>(t=u)?n:t);return tr(r[1],0,c,0,a),r[1]=c,0}return 0}function gr(r,e){return hr(r,1),r[1][r[0]]=e,r[0]=r[0]+1|0,0}function br(r,e){var n=e.length;return hr(r,n),cr(e,0,r[1],r[0],n),r[0]=r[0]+n|0,0}function mr(r){return nr(r[1],0,r[0])}function dr(r){if("number"==typeof r)switch(r){case 0:return"@]";case 1:return"@}";case 2:return"@?";case 3:return"@\n";case 4:return"@.";case 5:return"@@";case 6:return"@%"}else switch(0|r.tag){case 0:case 1:return r[0];case 2:return"@"+b(er(1,r[0]))}}function wr(r){if("number"==typeof r)return 0;switch(0|r.tag){case 0:return u(0,[wr(r[0])]);case 1:return u(1,[wr(r[0])]);case 2:return u(2,[wr(r[0])]);case 3:return u(3,[wr(r[0])]);case 4:return u(4,[wr(r[0])]);case 5:return u(5,[wr(r[0])]);case 6:return u(6,[wr(r[0])]);case 7:return u(7,[wr(r[0])]);case 8:return u(8,[r[0],wr(r[1])]);case 9:return u(9,[r[1],r[0],wr(r[2])]);case 10:return u(10,[wr(r[0])]);case 11:return u(11,[wr(r[0])]);case 12:return u(12,[wr(r[0])]);case 13:return u(13,[wr(r[0])]);case 14:return u(14,[wr(r[0])])}}function pr(r){if("number"==typeof r)return[function(r){return 0},function(r){return 0},function(r){return 0},function(r){return 0}];switch(0|r.tag){case 0:var e=pr(r[0]),n=e[1],t=e[0];return[function(r){return v(t,0),0},function(r){return v(n,0),0},e[2],e[3]];case 1:var a=pr(r[0]),u=a[1],c=a[0];return[function(r){return v(c,0),0},function(r){return v(u,0),0},a[2],a[3]];case 2:var i=pr(r[0]),o=i[1],s=i[0];return[function(r){return v(s,0),0},function(r){return v(o,0),0},i[2],i[3]];case 3:var f=pr(r[0]),l=f[1],h=f[0];return[function(r){return v(h,0),0},function(r){return v(l,0),0},f[2],f[3]];case 4:var g=pr(r[0]),b=g[1],m=g[0];return[function(r){return v(m,0),0},function(r){return v(b,0),0},g[2],g[3]];case 5:var d=pr(r[0]),w=d[1],p=d[0];return[function(r){return v(p,0),0},function(r){return v(w,0),0},d[2],d[3]];case 6:var k=pr(r[0]),y=k[1],C=k[0];return[function(r){return v(C,0),0},function(r){return v(y,0),0},k[2],k[3]];case 7:var F=pr(r[0]),x=F[1],A=F[0];return[function(r){return v(A,0),0},function(r){return v(x,0),0},F[2],F[3]];case 8:var _=pr(r[1]),S=_[1],B=_[0];return[function(r){return v(B,0),0},function(r){return v(S,0),0},_[2],_[3]];case 9:var N=pr(r[2]),j=N[3],R=N[2],P=N[1],I=N[0],E=pr(kr(wr(r[0]),r[1])),H=E[3],T=E[2],q=E[1],M=E[0];return[function(r){return v(I,0),v(M,0),0},function(r){return v(q,0),v(P,0),0},function(r){return v(R,0),v(T,0),0},function(r){return v(H,0),v(j,0),0}];case 10:var D=pr(r[0]),O=D[1],U=D[0];return[function(r){return v(U,0),0},function(r){return v(O,0),0},D[2],D[3]];case 11:var X=pr(r[0]),z=X[1],G=X[0];return[function(r){return v(G,0),0},function(r){return v(z,0),0},X[2],X[3]];case 12:var J=pr(r[0]),L=J[1],$=J[0];return[function(r){return v($,0),0},function(r){return v(L,0),0},J[2],J[3]];case 13:var V=pr(r[0]),Z=V[3],K=V[2],Q=V[1],W=V[0];return[function(r){return v(W,0),0},function(r){return v(Q,0),0},function(r){return v(K,0),0},function(r){return v(Z,0),0}];case 14:var Y=pr(r[0]),rr=Y[3],er=Y[2],nr=Y[1],tr=Y[0];return[function(r){return v(tr,0),0},function(r){return v(nr,0),0},function(r){return v(er,0),0},function(r){return v(rr,0),0}]}}function kr(r,e){var n=0;if("number"==typeof r){if("number"==typeof e)return 0;switch(0|e.tag){case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5;break;default:throw[o,["camlinternalFormat.ml",816,23]]}}else switch(0|r.tag){case 0:if("number"==typeof e)n=8;else switch(0|e.tag){case 0:return u(0,[kr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 1:if("number"==typeof e)n=8;else switch(0|e.tag){case 1:return u(1,[kr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 2:if("number"==typeof e)n=8;else switch(0|e.tag){case 2:return u(2,[kr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 3:if("number"==typeof e)n=8;else switch(0|e.tag){case 3:return u(3,[kr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 4:if("number"==typeof e)n=8;else switch(0|e.tag){case 4:return u(4,[kr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 5:if("number"==typeof e)n=8;else switch(0|e.tag){case 5:return u(5,[kr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 6:if("number"==typeof e)n=8;else switch(0|e.tag){case 6:return u(6,[kr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 7:if("number"==typeof e)n=8;else switch(0|e.tag){case 7:return u(7,[kr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 8:if("number"==typeof e)throw[o,["camlinternalFormat.ml",802,26]];switch(0|e.tag){case 8:return u(8,[kr(r[0],e[0]),kr(r[1],e[1])]);case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5;break;default:throw[o,["camlinternalFormat.ml",802,26]]}break;case 9:if("number"==typeof e)throw[o,["camlinternalFormat.ml",812,28]];switch(0|e.tag){case 8:n=6;break;case 9:var t=pr(kr(wr(r[1]),e[0]));return v(t[1],0),v(t[3],0),u(9,[r[0],e[1],kr(r[2],e[2])]);case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5;break;default:throw[o,["camlinternalFormat.ml",812,28]]}break;case 10:if("number"==typeof e)throw[o,["camlinternalFormat.ml",780,21]];if(10===e.tag)return u(10,[kr(r[0],e[0])]);throw[o,["camlinternalFormat.ml",780,21]];case 11:if("number"==typeof e)throw[o,["camlinternalFormat.ml",784,21]];switch(0|e.tag){case 10:n=1;break;case 11:return u(11,[kr(r[0],e[0])]);default:throw[o,["camlinternalFormat.ml",784,21]]}break;case 12:if("number"==typeof e)throw[o,["camlinternalFormat.ml",788,19]];switch(0|e.tag){case 10:n=1;break;case 11:n=2;break;case 12:return u(12,[kr(r[0],e[0])]);default:throw[o,["camlinternalFormat.ml",788,19]]}break;case 13:if("number"==typeof e)throw[o,["camlinternalFormat.ml",792,22]];switch(0|e.tag){case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:return u(13,[kr(r[0],e[0])]);default:throw[o,["camlinternalFormat.ml",792,22]]}break;case 14:if("number"==typeof e)throw[o,["camlinternalFormat.ml",797,30]];switch(0|e.tag){case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:return u(14,[kr(r[0],e[0])]);default:throw[o,["camlinternalFormat.ml",797,30]]}}switch(n){case 1:throw[o,["camlinternalFormat.ml",781,21]];case 2:throw[o,["camlinternalFormat.ml",785,21]];case 3:throw[o,["camlinternalFormat.ml",789,19]];case 4:throw[o,["camlinternalFormat.ml",793,22]];case 5:throw[o,["camlinternalFormat.ml",798,30]];case 6:throw[o,["camlinternalFormat.ml",803,26]];case 7:throw[o,["camlinternalFormat.ml",813,28]];case 8:throw[o,["camlinternalFormat.ml",817,23]]}}K("Caml_js_exceptions.Error");var yr=K("CamlinternalFormat.Type_mismatch");function Cr(r,e){if("number"==typeof r)return[0,e];if(r.tag){if("number"==typeof e)throw yr;if(2===e.tag)return[u(1,[r[0]]),e[0]];throw yr}return[u(0,[r[0],r[1]]),e]}function Fr(r,e,n){var t=Cr(r,n);if("number"==typeof e){if(0!==e){var a=t[1];if("number"==typeof a)throw yr;if(2===a.tag)return[t[0],1,a[0]];throw yr}return[t[0],0,t[1]]}return[t[0],[e[0]],t[1]]}function xr(r,e,n){var t=Ar(e,n);return[u(23,[r,t[0]]),t[1]]}function Ar(r,e){if("number"==typeof r)return[0,e];switch(0|r.tag){case 0:if("number"==typeof e)throw yr;if(e.tag)throw yr;var n=Ar(r[0],e[0]);return[u(0,[n[0]]),n[1]];case 1:if("number"==typeof e)throw yr;if(e.tag)throw yr;var t=Ar(r[0],e[0]);return[u(1,[t[0]]),t[1]];case 2:var a=Cr(r[0],e),c=a[1];if("number"==typeof c)throw yr;if(1===c.tag){var i=Ar(r[1],c[0]);return[u(2,[a[0],i[0]]),i[1]]}throw yr;case 3:var o=Cr(r[0],e),s=o[1];if("number"==typeof s)throw yr;if(1===s.tag){var f=Ar(r[1],s[0]);return[u(3,[o[0],f[0]]),f[1]]}throw yr;case 4:var l=Fr(r[1],r[2],e),h=l[2];if("number"==typeof h)throw yr;if(2===h.tag){var g=Ar(r[3],h[0]);return[u(4,[r[0],l[0],l[1],g[0]]),g[1]]}throw yr;case 5:var b=Fr(r[1],r[2],e),m=b[2];if("number"==typeof m)throw yr;if(3===m.tag){var d=Ar(r[3],m[0]);return[u(5,[r[0],b[0],b[1],d[0]]),d[1]]}throw yr;case 6:var w=Fr(r[1],r[2],e),k=w[2];if("number"==typeof k)throw yr;if(4===k.tag){var y=Ar(r[3],k[0]);return[u(6,[r[0],w[0],w[1],y[0]]),y[1]]}throw yr;case 7:var C=Fr(r[1],r[2],e),F=C[2];if("number"==typeof F)throw yr;if(5===F.tag){var x=Ar(r[3],F[0]);return[u(7,[r[0],C[0],C[1],x[0]]),x[1]]}throw yr;case 8:var A=Fr(r[1],r[2],e),_=A[2];if("number"==typeof _)throw yr;if(6===_.tag){var S=Ar(r[3],_[0]);return[u(8,[r[0],A[0],A[1],S[0]]),S[1]]}throw yr;case 9:if("number"==typeof e)throw yr;if(7===e.tag){var B=Ar(r[0],e[0]);return[u(9,[B[0]]),B[1]]}throw yr;case 10:var N=Ar(r[0],e);return[u(10,[N[0]]),N[1]];case 11:var j=Ar(r[1],e);return[u(11,[r[0],j[0]]),j[1]];case 12:var R=Ar(r[1],e);return[u(12,[r[0],R[0]]),R[1]];case 13:if("number"==typeof e)throw yr;if(8===e.tag){var P=e[0];if(p([r[1]],[P]))throw yr;var I=Ar(r[2],e[1]);return[u(13,[r[0],P,I[0]]),I[1]]}throw yr;case 14:if("number"==typeof e)throw yr;if(9===e.tag){var E=e[0];if(p([Q(r[1])],[Q(E)]))throw yr;var H=Ar(r[2],Q(e[2]));return[u(14,[r[0],E,H[0]]),H[1]]}throw yr;case 15:if("number"==typeof e)throw yr;if(10===e.tag){var T=Ar(r[0],e[0]);return[u(15,[T[0]]),T[1]]}throw yr;case 16:if("number"==typeof e)throw yr;if(11===e.tag){var q=Ar(r[0],e[0]);return[u(16,[q[0]]),q[1]]}throw yr;case 17:var M=Ar(r[1],e);return[u(17,[r[0],M[0]]),M[1]];case 18:var D=r[0],O=r[1],U=e;if(D.tag){var X=D[0],z=Ar(X[0],U),G=Ar(O,z[1]);return[u(18,[u(1,[[z[0],X[1]]]),G[0]]),G[1]]}var J=D[0],L=Ar(J[0],U),$=Ar(O,L[1]);return[u(18,[u(0,[[L[0],J[1]]]),$[0]]),$[1]];case 19:if("number"==typeof e)throw yr;if(13===e.tag){var V=Ar(r[0],e[0]);return[u(19,[V[0]]),V[1]]}throw yr;case 20:if("number"==typeof e)throw yr;if(1===e.tag){var Z=Ar(r[2],e[0]);return[u(20,[r[0],r[1],Z[0]]),Z[1]]}throw yr;case 21:if("number"==typeof e)throw yr;if(2===e.tag){var K=Ar(r[1],e[0]);return[u(21,[r[0],K[0]]),K[1]]}throw yr;case 23:var W=r[0],Y=r[1],rr=e;if("number"==typeof W){if(3===W){if("number"==typeof rr)throw yr;if(14===rr.tag){var er=Ar(Y,rr[0]);return[u(23,[3,er[0]]),er[1]]}throw yr}return xr(W,Y,rr)}switch(0|W.tag){case 7:return xr(u(7,[W[0],W[1]]),Y,rr);case 8:var nr=function r(e,n,t){if("number"==typeof e)return[0,Ar(n,t)];switch(0|e.tag){case 0:if("number"==typeof t)throw yr;if(t.tag)throw yr;var a=r(e[0],n,t[0]);return[u(0,[a[0]]),a[1]];case 1:if("number"==typeof t)throw yr;if(1===t.tag){var c=r(e[0],n,t[0]);return[u(1,[c[0]]),c[1]]}throw yr;case 2:if("number"==typeof t)throw yr;if(2===t.tag){var i=r(e[0],n,t[0]);return[u(2,[i[0]]),i[1]]}throw yr;case 3:if("number"==typeof t)throw yr;if(3===t.tag){var o=r(e[0],n,t[0]);return[u(3,[o[0]]),o[1]]}throw yr;case 4:if("number"==typeof t)throw yr;if(4===t.tag){var s=r(e[0],n,t[0]);return[u(4,[s[0]]),s[1]]}throw yr;case 5:if("number"==typeof t)throw yr;if(5===t.tag){var f=r(e[0],n,t[0]);return[u(5,[f[0]]),f[1]]}throw yr;case 6:if("number"==typeof t)throw yr;if(6===t.tag){var l=r(e[0],n,t[0]);return[u(6,[l[0]]),l[1]]}throw yr;case 7:if("number"==typeof t)throw yr;if(7===t.tag){var h=r(e[0],n,t[0]);return[u(7,[h[0]]),h[1]]}throw yr;case 8:if("number"==typeof t)throw yr;if(8===t.tag){var g=t[0];if(p([e[0]],[g]))throw yr;var b=r(e[1],n,t[1]);return[u(8,[g,b[0]]),b[1]]}throw yr;case 9:if("number"==typeof t)throw yr;if(9===t.tag){var m=t[1],d=t[0];if(p([Q(e[0])],[Q(d)]))throw yr;if(p([Q(e[1])],[Q(m)]))throw yr;var w=pr(kr(wr(d),m));v(w[1],0),v(w[3],0);var k=r(Q(e[2]),n,t[2]);return[u(9,[d,m,wr(k[0])]),k[1]]}throw yr;case 10:if("number"==typeof t)throw yr;if(10===t.tag){var y=r(e[0],n,t[0]);return[u(10,[y[0]]),y[1]]}throw yr;case 11:if("number"==typeof t)throw yr;if(11===t.tag){var C=r(e[0],n,t[0]);return[u(11,[C[0]]),C[1]]}throw yr;case 12:throw yr;case 13:if("number"==typeof t)throw yr;if(13===t.tag){var F=r(e[0],n,t[0]);return[u(13,[F[0]]),F[1]]}throw yr;case 14:if("number"==typeof t)throw yr;if(14===t.tag){var x=r(e[0],n,t[0]);return[u(14,[x[0]]),x[1]]}throw yr}}(W[1],Y,rr),tr=nr[1];return[u(23,[u(8,[W[0],nr[0]]),tr[0]]),tr[1]];default:return xr(W,Y,rr)}case 22:case 24:throw yr}}function _r(r,e){return function(r,e){var n=Ar(r,e);if("number"==typeof n[1])return n[0];throw yr}(r,Q(wr(e)))}function Sr(r,e,n){var t=n.length,a=Y(e),u=e<0?0:r;if(a<=t)return n;var c=er(a,2===u?48:32);switch(u){case 0:cr(n,0,c,0,t);break;case 1:cr(n,0,c,a-t|0,t);break;case 2:t>0&&(43===V(n,0)||45===V(n,0)||32===V(n,0))?(c[0]=V(n,0),cr(n,1,c,1+(a-t|0)|0,t-1|0)):t>1&&48===V(n,0)&&(120===V(n,1)||88===V(n,1))?(c[1]=V(n,1),cr(n,2,c,2+(a-t|0)|0,t-2|0)):cr(n,0,c,a-t|0,t)}return b(c)}function Br(r,e){var n=Y(r),t=e.length,a=V(e,0),u=0;if(a>=58)if(a>=71){if(a>102||a<97)return e;u=2}else{if(!(a>=65))return e;u=2}else if(32!==a){if(!(a>=43))return e;switch(a-43|0){case 0:case 2:u=1;break;case 1:case 3:case 4:return e;case 5:if((n+2|0)>t&&t>1&&(120===V(e,1)||88===V(e,1))){var c=er(n+2|0,48);return c[1]=V(e,1),cr(e,2,c,4+(n-t|0)|0,t-2|0),b(c)}u=2;break;case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:u=2}}else u=1;switch(u){case 1:if((n+1|0)>t){var i=er(n+1|0,48);return i[0]=a,cr(e,1,i,2+(n-t|0)|0,t-1|0),b(i)}return e;case 2:if(n>t){var o=er(n,48);return cr(e,0,o,n-t|0,t),b(o)}return e}}function Nr(r){return ur((e=r,function(r){for(;;){var n=r;if(n>=e.length)return!1;var t=e.charCodeAt(n);if(!(t>=32))return!0;var a=t-34|0;if(a>58||a<0){if(a>=93)return!0;r=n+1|0}else{if(a>57||a<1)return!0;r=n+1|0}}}(0)?b(function(r){for(var e=0,n=0,t=r.length-1|0;n<=t;++n){var a,u=r[n];if(u>=32){var c=u-34|0;a=c>58||c<0?c>=93?4:1:c>57||c<1?2:1}else a=u>=11?13!==u?4:2:u>=8?2:4;e=e+a|0}if(e===r.length)return function(r){var e=r.length,n=h(e);return g(r,0,n,0,e),n}(r);var i=h(e);e=0;for(var o=0,s=r.length-1|0;o<=s;++o){var f=r[o],v=0;if(f>=35)92!==f?f>=127?v=1:i[e]=f:v=2;else if(f>=32)f>=34?v=2:i[e]=f;else if(f>=14)v=1;else switch(f){case 8:i[e]=92,i[e=e+1|0]=98;break;case 9:i[e]=92,i[e=e+1|0]=116;break;case 10:i[e]=92,i[e=e+1|0]=110;break;case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 11:case 12:v=1;break;case 13:i[e]=92,i[e=e+1|0]=114}switch(v){case 1:i[e]=92,i[e=e+1|0]=48+(f/100|0)|0,i[e=e+1|0]=48+(f/10|0)%10|0,i[e=e+1|0]=48+f%10|0;break;case 2:i[e]=92,i[e=e+1|0]=f}e=e+1|0}return i}(function(r){for(var e=r.length,n=new Array(e),t=0,a=e-1|0;t<=a;++t)n[t]=r.charCodeAt(t);return n}(e))):e),['"',['"',0]]);var e}function jr(r,e){var n;switch(r){case 0:n=["%",["d",0]];break;case 1:n=["%+",["d",0]];break;case 2:n=["% ",["d",0]];break;case 3:n=["%",["i",0]];break;case 4:n=["%+",["i",0]];break;case 5:n=["% ",["i",0]];break;case 6:n=["%",["x",0]];break;case 7:n=["%#",["x",0]];break;case 8:n=["%",["X",0]];break;case 9:n=["%#",["X",0]];break;case 10:n=["%",["o",0]];break;case 11:n=["%#",["o",0]];break;case 12:n=["%",["u",0]]}return ur(b(er(1,e)),n)}function Rr(r,e){return J(function(r){switch(r){case 0:return"%d";case 1:return"%+d";case 2:return"% d";case 3:return"%i";case 4:return"%+i";case 5:return"% i";case 6:return"%x";case 7:return"%#x";case 8:return"%X";case 9:return"%#X";case 10:return"%o";case 11:return"%#o";case 12:return"%u"}}(r),e)}function Pr(r,e){return $(jr(r,108),e)}function Ir(r,e){return L(jr(r,110),e)}function Er(r,e){return function(r,e){var n=z(r),t=n[5]&&T(e,[0,0])?(n[8]=-1,j(e)):e,a="";switch(n[4]){case 0:var u=[0,8],c="01234567";if(T(t,[0,0])){var i=O(U(t),u),o=B([268435456,0],i[0]),s=i[1];for(a=String.fromCharCode(c.charCodeAt(0|s[1]))+a;H(o,[0,0]);){var f=O(o,u);o=f[0],s=f[1],a=String.fromCharCode(c.charCodeAt(0|s[1]))+a}}else{var v=O(t,u),l=v[0],h=v[1];for(a=String.fromCharCode(c.charCodeAt(0|h[1]))+a;H(l,[0,0]);){var g=O(l,u);l=g[0],h=g[1],a=String.fromCharCode(c.charCodeAt(0|h[1]))+a}}break;case 1:a=function(r){var e=t[1],n=t[0],a=function(r){return(r>>>0).toString(16)};if(0===n&&0===e)return"0";if(0!==e){if(0!==n){var u=a(e),c=8-u.length|0;return c<=0?a(n)+u:a(n)+(y(c,"0")+u)}return a(e)}return a(n)+"00000000"}()+a;break;case 2:var b=[0,10];if(T(t,[0,0])){var m=O(U(t),b),d=O(B([0,8],m[1]),b),w=B(B([214748364,3435973836],m[0]),d[0]),p=d[1];for(a=String.fromCharCode("0123456789".charCodeAt(0|p[1]))+a;H(w,[0,0]);){var k=O(w,b);w=k[0],p=k[1],a=String.fromCharCode("0123456789".charCodeAt(0|p[1]))+a}}else{var C=O(t,b),F=C[0],x=C[1];for(a=String.fromCharCode("0123456789".charCodeAt(0|x[1]))+a;H(F,[0,0]);){var A=O(F,b);F=A[0],x=A[1],a=String.fromCharCode("0123456789".charCodeAt(0|x[1]))+a}}}if(n[9]>=0){n[2]=" ";var _=n[9]-a.length|0;_>0&&(a=y(_,"0")+a)}return G(n,a)}(jr(r,76),e)}function Hr(r,e,n){var t=function(r,e){var n=z(r),t=n[9]<0?6:n[9],a=e<0?(n[8]=-1,-e):e,u="";if(isNaN(a))u="nan",n[2]=" ";else if(isFinite(a))switch(n[10]){case"e":var c=(u=a.toExponential(t)).length;"e"===u[c-3|0]&&(u=u.slice(0,c-1|0)+"0"+u.slice(c-1|0));break;case"f":u=a.toFixed(t);break;case"g":var i=0!==t?t:1,o=(u=a.toExponential(i-1|0)).indexOf("e"),s=0|Number(u.slice(o+1|0));if(s<-4||a>=1e21||a.toFixed().length>i){for(var f=o-1|0;"0"===u[f];)f=f-1|0;"."===u[f]&&(f=f-1|0);var v=(u=u.slice(0,f+1|0)+u.slice(o)).length;"e"===u[v-3|0]&&(u=u.slice(0,v-1|0)+"0"+u.slice(v-1|0))}else{var l=i;if(s<0)u=a.toFixed(l=l-(s+1|0)|0);else for(;(u=a.toFixed(l)).length>(i+1|0);)l=l-1|0;if(0!==l){for(var h=u.length-1|0;"0"===u[h];)h=h-1|0;"."===u[h]&&(h=h-1|0),u=u.slice(0,h+1|0)}}}else u="inf",n[2]=" ";return G(n,u)}(function(r,e){if(15===r)return"%.12g";var n=Y(e),t=function(r){switch(r){case 0:case 1:case 2:return 102;case 3:case 4:case 5:return 101;case 6:case 7:case 8:return 69;case 9:case 10:case 11:return 103;case 12:case 13:case 14:return 71;case 15:return 70}}(r),a=[0,h(16)];return gr(a,37),function(r,e){switch(e){case 1:case 4:case 7:case 10:case 13:return gr(r,43);case 2:case 5:case 8:case 11:case 14:gr(r,32)}}(a,r),gr(a,46),br(a,String(n)),gr(a,t),mr(a)}(r,Y(e)),n);if(15!==r)return t;var a=t.length,u=function(r){return isFinite(r)?Math.abs(r)>=2.2250738585072014e-308?0:0!==r?1:2:isNaN(r)?4:3}(n);return 3!==u?u>=4?"nan":function(r){for(;;){var e=r;if(e===a)return!1;var n=V(t,e)-46|0;if(n>23||n<0){if(55!==n){r=e+1|0;continue}return!0}if(n>22||n<1)return!0;r=e+1|0}}(0)?t:t+".":n<0?"neg_infinity":"infinity"}function Tr(r){return ur(function(r){var e=0;if(r>=40){if(92===r)return"\\\\";e=r>=127?1:2}else if(r>=32){if(r>=39)return"\\'";e=2}else if(r>=14)e=1;else switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 11:case 12:e=1;break;case 13:return"\\r"}switch(e){case 1:var n=[0,0,0,0];return n[0]=92,n[1]=48+(r/100|0)|0,n[2]=48+(r/10|0)%10|0,n[3]=48+r%10|0,b(n);case 2:var t=[0];return t[0]=r,b(t)}}(r),["'",["'",0]])}function qr(r){var e=[0,h(16)];return function r(e,n){for(;;){var t=n;if("number"==typeof t)return 0;switch(0|t.tag){case 0:br(e,"%c"),n=t[0];continue;case 1:br(e,"%s"),n=t[0];continue;case 2:br(e,"%i"),n=t[0];continue;case 3:br(e,"%li"),n=t[0];continue;case 4:br(e,"%ni"),n=t[0];continue;case 5:br(e,"%Li"),n=t[0];continue;case 6:br(e,"%f"),n=t[0];continue;case 7:br(e,"%B"),n=t[0];continue;case 8:br(e,"%{"),r(e,t[0]),br(e,"%}"),n=t[1];continue;case 9:br(e,"%("),r(e,t[0]),br(e,"%)"),n=t[2];continue;case 10:br(e,"%a"),n=t[0];continue;case 11:br(e,"%t"),n=t[0];continue;case 12:br(e,"%?"),n=t[0];continue;case 13:br(e,"%r"),n=t[0];continue;case 14:br(e,"%_r"),n=t[0];continue}}}(e,r),mr(e)}function Mr(r,e,n,t){for(;;){var a=t,c=n,i=r;if("number"==typeof a)return l(i,e,c);switch(0|a.tag){case 0:return function(r,n,t){return function(a){var c=u(5,[n,a]);return Mr(r,e,c,t)}}(i,c,a[0]);case 1:return function(r,n,t){return function(a){var c=Tr(a),i=u(4,[n,c]);return Mr(r,e,i,t)}}(i,c,a[0]);case 2:return Ur(i,e,c,a[1],a[0],function(r){return r});case 3:return Ur(i,e,c,a[1],a[0],Nr);case 4:return Xr(i,e,c,a[3],a[1],a[2],Rr,a[0]);case 5:return Xr(i,e,c,a[3],a[1],a[2],Pr,a[0]);case 6:return Xr(i,e,c,a[3],a[1],a[2],Ir,a[0]);case 7:return Xr(i,e,c,a[3],a[1],a[2],Er,a[0]);case 8:var s=i,f=e,h=c,g=a[3],b=a[1],m=a[2],d=a[0];if("number"==typeof b)return"number"==typeof m?0!==m?function(r,e,n,t,a){return function(c,i){var o=Hr(a,c,i);return Mr(r,e,u(4,[n,o]),t)}}(s,f,h,g,d):function(r,e,n,t,a){return function(c){var i=Hr(a,6,c);return Mr(r,e,u(4,[n,i]),t)}}(s,f,h,g,d):function(r,e,n,t,a,c){return function(i){var o=Hr(a,c,i);return Mr(r,e,u(4,[n,o]),t)}}(s,f,h,g,d,m[0]);if(b.tag){var w=b[0];return"number"==typeof m?0!==m?function(r,e,n,t,a,c){return function(i,o,s){var f=Sr(c,i,Hr(a,o,s));return Mr(r,e,u(4,[n,f]),t)}}(s,f,h,g,d,w):function(r,e,n,t,a,c){return function(i,o){var s=Hr(a,6,o),f=Sr(c,i,s);return Mr(r,e,u(4,[n,f]),t)}}(s,f,h,g,d,w):function(r,e,n,t,a,c,i){return function(o,s){var f=Sr(c,o,Hr(a,i,s));return Mr(r,e,u(4,[n,f]),t)}}(s,f,h,g,d,w,m[0])}var p=b[1],k=b[0];return"number"==typeof m?0!==m?function(r,e,n,t,a,c,i){return function(o,s){var f=Sr(c,i,Hr(a,o,s));return Mr(r,e,u(4,[n,f]),t)}}(s,f,h,g,d,k,p):function(r,e,n,t,a,c,i){return function(o){var s=Hr(a,6,o),f=Sr(c,i,s);return Mr(r,e,u(4,[n,f]),t)}}(s,f,h,g,d,k,p):function(r,e,n,t,a,c,i,o){return function(s){var f=Sr(c,i,Hr(a,o,s));return Mr(r,e,u(4,[n,f]),t)}}(s,f,h,g,d,k,p,m[0]);case 9:return function(r,n,t){return function(a){return Mr(r,e,u(4,[n,a?"true":"false"]),t)}}(i,c,a[0]);case 10:t=a[0],n=u(7,[c]);continue;case 11:t=a[1],n=u(2,[c,a[0]]);continue;case 12:t=a[1],n=u(3,[c,a[0]]);continue;case 13:return function(r,n,t,a){return function(c){return Mr(r,e,u(4,[n,a]),t)}}(i,c,a[2],qr(a[1]));case 14:return function(r,n,t,a){return function(u){return Mr(r,e,n,W(_r(u[0],t),a))}}(i,c,a[1],a[2]);case 15:return function(r,n,t){return function(a,c){return Mr(r,e,u(6,[n,function(r){return l(a,r,c)}]),t)}}(i,c,a[0]);case 16:return function(r,n,t){return function(a){return Mr(r,e,u(6,[n,a]),t)}}(i,c,a[0]);case 17:t=a[1],n=u(0,[c,a[0]]);continue;case 18:var y=a[0];if(y.tag){var C=function(r,e,n){return function(t,a){return Mr(r,t,u(1,[e,u(1,[a])]),n)}}(i,c,a[1]);t=y[0][0],n=0,r=C;continue}var F=function(r,e,n){return function(t,a){return Mr(r,t,u(1,[e,u(0,[a])]),n)}}(i,c,a[1]);t=y[0][0],n=0,r=F;continue;case 19:throw[o,["camlinternalFormat.ml",1449,4]];case 20:return function(r,n,t){return function(a){return Mr(r,e,t,n)}}(i,a[2],u(8,[c,"Printf: bad conversion %["]));case 21:return function(r,n,t){return function(a){var c=J("%u",a),i=u(4,[n,c]);return Mr(r,e,i,t)}}(i,c,a[1]);case 22:return function(r,n,t){return function(a){var c=u(5,[n,a]);return Mr(r,e,c,t)}}(i,c,a[0]);case 23:var x=i,A=e,_=c,S=a[0],B=a[1];if("number"==typeof S){if(3===S)throw[o,["camlinternalFormat.ml",1517,39]];return Or(x,A,_,B)}return 8===S.tag?Dr(x,A,_,S[1],B):Or(x,A,_,B);case 24:return zr(i,e,c,a[2],a[0],v(a[1],0))}}}function Dr(r,e,n,t,a){if("number"==typeof t)return Or(r,e,n,a);switch(0|t.tag){case 0:var c=t[0];return function(t){return Dr(r,e,n,c,a)};case 1:var i=t[0];return function(t){return Dr(r,e,n,i,a)};case 2:var s=t[0];return function(t){return Dr(r,e,n,s,a)};case 3:var f=t[0];return function(t){return Dr(r,e,n,f,a)};case 4:var v=t[0];return function(t){return Dr(r,e,n,v,a)};case 5:var l=t[0];return function(t){return Dr(r,e,n,l,a)};case 6:var h=t[0];return function(t){return Dr(r,e,n,h,a)};case 7:var g=t[0];return function(t){return Dr(r,e,n,g,a)};case 8:var b=t[1];return function(t){return Dr(r,e,n,b,a)};case 9:var m=t[2],d=kr(wr(t[0]),t[1]);return function(t){return Dr(r,e,n,function r(e,n){if("number"==typeof e)return n;switch(0|e.tag){case 0:return u(0,[r(e[0],n)]);case 1:return u(1,[r(e[0],n)]);case 2:return u(2,[r(e[0],n)]);case 3:return u(3,[r(e[0],n)]);case 4:return u(4,[r(e[0],n)]);case 5:return u(5,[r(e[0],n)]);case 6:return u(6,[r(e[0],n)]);case 7:return u(7,[r(e[0],n)]);case 8:return u(8,[e[0],r(e[1],n)]);case 9:return u(9,[e[0],e[1],r(e[2],n)]);case 10:return u(10,[r(e[0],n)]);case 11:return u(11,[r(e[0],n)]);case 12:return u(12,[r(e[0],n)]);case 13:return u(13,[r(e[0],n)]);case 14:return u(14,[r(e[0],n)])}}(d,m),a)};case 10:var w=t[0];return function(t,u){return Dr(r,e,n,w,a)};case 11:var p=t[0];return function(t){return Dr(r,e,n,p,a)};case 12:var k=t[0];return function(t){return Dr(r,e,n,k,a)};case 13:throw[o,["camlinternalFormat.ml",1540,31]];case 14:throw[o,["camlinternalFormat.ml",1541,31]]}}function Or(r,e,n,t){return Mr(r,e,u(8,[n,"Printf: bad conversion %_"]),t)}function Ur(r,e,n,t,a,c){if("number"==typeof a)return function(a){var i=v(c,a),o=u(4,[n,i]);return Mr(r,e,o,t)};if(a.tag){var i=a[0];return function(a,o){var s=Sr(i,a,v(c,o)),f=u(4,[n,s]);return Mr(r,e,f,t)}}var o=a[1],s=a[0];return function(a){var i=Sr(s,o,v(c,a)),f=u(4,[n,i]);return Mr(r,e,f,t)}}function Xr(r,e,n,t,a,c,i,o){if("number"==typeof a){if("number"==typeof c)return 0!==c?function(a,c){var s=Br(a,l(i,o,c));return Mr(r,e,u(4,[n,s]),t)}:function(a){var c=l(i,o,a);return Mr(r,e,u(4,[n,c]),t)};var s=c[0];return function(a){var c=Br(s,l(i,o,a));return Mr(r,e,u(4,[n,c]),t)}}if(a.tag){var f=a[0];if("number"==typeof c)return 0!==c?function(a,c,s){var v=Sr(f,a,Br(c,l(i,o,s)));return Mr(r,e,u(4,[n,v]),t)}:function(a,c){var s=Sr(f,a,l(i,o,c));return Mr(r,e,u(4,[n,s]),t)};var v=c[0];return function(a,c){var s=Sr(f,a,Br(v,l(i,o,c)));return Mr(r,e,u(4,[n,s]),t)}}var h=a[1],g=a[0];if("number"==typeof c)return 0!==c?function(a,c){var s=Sr(g,h,Br(a,l(i,o,c)));return Mr(r,e,u(4,[n,s]),t)}:function(a){var c=Sr(g,h,l(i,o,a));return Mr(r,e,u(4,[n,c]),t)};var b=c[0];return function(a){var c=Sr(g,h,Br(b,l(i,o,a)));return Mr(r,e,u(4,[n,c]),t)}}function zr(r,e,n,t,a,c){if(a){var i=a[0];return function(a){return zr(r,e,n,t,i,v(c,a))}}return Mr(r,e,u(4,[n,c]),t)}function Gr(r){return e=function(r){return r},Mr(function(r,n){var t,a,u=[t=h(64),0,64,t];return function r(e,n){for(;;){var t=n,a=0;if("number"==typeof t)return 0;switch(0|t.tag){case 0:var u=dr(t[1]);return r(e,t[0]),sr(e,u);case 1:var i=t[1];if(r(e,t[0]),i.tag){sr(e,"@["),n=i[0];continue}sr(e,"@{"),n=i[0];continue;case 2:case 4:a=1;break;case 3:case 5:a=2;break;case 6:return r(e,t[0]),sr(e,v(t[1],0));case 7:n=t[0];continue;case 8:throw r(e,t[0]),[c,t[1]]}switch(a){case 1:return r(e,t[0]),sr(e,t[1]);case 2:return r(e,t[0]),or(e,t[1])}}}(u,n),v(e,nr((a=u)[0],0,a[1]))},0,0,r[0]);var e}function Jr(r){var e=typeof r;return"string"===e?u(0,[r]):"number"===e?u(1,[r]):"boolean"===e?!0===r?1:0:null===r?2:Array.isArray(r)?u(3,[r]):u(2,[r])}function Lr(r){if("string"==typeof r)return r}function $r(r){return e.toNumber(r)}function Vr(r,n){return e.__fromString(r,n)}function Zr(r){return e.BigInt(r)}function Kr(r){return r.replace(/^0x/,"")}var Qr=/^0x[0-9a-fA-F]+$/;function Wr(r){return Qr.test(r)}var Yr=/^[0-9]+$/,re=Zr(0);function ee(r){return"0x1"===r?2:3}function ne(r){var e=n.field("logIndex",n.string,r),t=n.field("blockNumber",n.string,r),a=n.field("transactionIndex",n.string,r);return[n.field("removed",n.bool,r),$r(Vr(Kr(e),16)),n.field("transactionHash",n.string,r),n.field("blockHash",n.string,r),$r(Vr(Kr(t),16)),$r(Vr(Kr(a),16)),n.field("address",n.string,r),n.field("data",n.string,r),n.field("topics",function(r){return n.array(n.string,r)},r)]}function te(r){var e=n.optional(function(r){return n.field("blockNumber",n.string,r)},r),t=n.optional(function(r){return n.field("transactionIndex",n.string,r)},r),a=n.field("gas",n.string,r),u=n.field("gasPrice",n.string,r),c=n.field("value",n.string,r),i=n.field("nonce",n.string,r);return[n.field("hash",n.string,r),n.optional(function(r){return n.field("blockHash",n.string,r)},r),void 0!==e?$r(Vr(Kr(e),16)):void 0,void 0!==t?$r(Vr(Kr(t),16)):void 0,n.field("to",n.string,r),n.field("from",n.string,r),$r(Vr(Kr(a),16)),Vr(Kr(u),16),Vr(Kr(c),16),n.field("input",n.string,r),$r(Vr(Kr(i),16))]}function ae(r){var e=Jr(r);if("number"==typeof e)return 0;switch(0|e.tag){case 0:return u(0,[e[0]]);case 2:return u(1,[te(r)]);default:return 0}}function ue(r){var e=Jr(r);if("number"==typeof e)return 0;switch(0|e.tag){case 0:var n=e[0];return Wr(n)?$r(Vr(Kr(n),16)):Yr.test(n)?$r(Vr(Kr(n),10)):0;case 1:return 0|e[0];default:return 0}}function ce(r){var e=Lr(r);return void 0!==e?e:""}function ie(r){var e=Lr(r);return void 0!==e?e:""}var oe=[ue,ue,ue,function(r){var n=Jr(r);if("number"==typeof n)return re;switch(0|n.tag){case 0:var t=n[0];return Wr(t)?Vr(Kr(t),16):re;case 1:return e.BigInt(n[0]);default:return re}},ce,function(r){var e,n=Jr(r);return"number"==typeof n?[]:3===n.tag?function(r,e){for(var n=r.length,t=new Array(n),a=0,u=n-1|0;a<=u;++a)t[a]=e(r[a]);return t}(n[0],1===(e=ce).length?e:function(r){return v(e,r)}):[]},ie,ie,te,function(r){var e=n.field("blockNumber",n.string,r),t=n.field("transactionIndex",n.string,r),a=n.field("gasUsed",n.string,r),u=n.field("cumulativeGasUsed",n.string,r);return[n.field("transactionHash",n.string,r),n.field("blockHash",n.string,r),$r(Vr(Kr(e),16)),$r(Vr(Kr(t),16)),n.field("to",n.string,r),n.field("from",n.string,r),$r(Vr(Kr(a),16)),$r(Vr(Kr(u),16)),n.optional(function(r){return n.field("contractAddress",n.string,r)},r),n.field("logs",function(r){return n.array(ne,r)},r),ee(n.field("status",n.string,r))]},function(r){var e=n.field("number",n.string,r),t=n.field("difficulty",n.string,r),a=n.field("totalDifficulty",n.string,r),u=n.field("size",n.string,r),c=n.field("gasLimit",n.string,r),i=n.field("gasUsed",n.string,r),o=n.field("timestamp",n.string,r);return[$r(Vr(Kr(e),16)),n.field("hash",n.string,r),n.optional(function(r){return n.field("parentHash",n.string,r)},r),n.field("nonce",n.string,r),n.field("sha3Uncles",n.string,r),n.field("logsBloom",n.string,r),n.field("transactionsRoot",n.string,r),n.field("stateRoot",n.string,r),n.field("receiptsRoot",n.string,r),n.field("miner",n.string,r),$r(Vr(Kr(t),16)),$r(Vr(Kr(a),16)),n.field("extraData",n.string,r),$r(Vr(Kr(u),16)),$r(Vr(Kr(c),16)),$r(Vr(Kr(i),16)),$r(Vr(Kr(o),16)),n.field("transactions",function(r){return n.array(ae,r)},r),n.field("uncles",function(r){return n.array(n.string,r)},r)]},function(r){var e=Jr(r);return"number"==typeof e&&1===e}],se=/^0x[0-9a-fA-F]{40}$/;function fe(r){return se.test(r)}function ve(r){return"0x"+Zr(r).toString(16)}function le(r){return"0x"+r.toString(16)}var he=[function(r){return r},function(r){return r},ve,le,function(r){return v(Gr([u(11,["0x",u(4,[6,0,0,0])]),"0x%x"]),r)},function(r){return r},function(r){var e={};e.to=r.to;var n=r.value;void 0!==n&&(e.value=le(n));var t=r.from;void 0!==t&&(e.from=t);var a=r.data;void 0!==a&&(e.data=a);var u=r.gas;void 0!==u&&(e.gas=ve(u));var c=r.gasPrice;void 0!==c&&(e.gasPrice=le(c));var i=r.nonce;return void 0!==i&&(e.nonce=ve(i)),e},function(r){if("number"!=typeof r)return v(Gr([u(11,["0x",u(4,[6,0,0,0])]),"0x%x"]),r[0]);switch(r){case 0:return"earliest";case 1:return"latest";case 2:return"pending"}}],ge={coinbase:function(r){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[4](r[0])])},l(r,"eth_coinbase",[]))},accounts:function(r){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[5](r[0])])},l(r,"eth_accounts",[]))},balanceOf:function(r,e,n,t){var c=void 0!==n?n:1;if(fe(e)){var i=[he[0](e),he[7](c)];return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[3](r[0])])},l(r,"eth_getBalance",i))}return a.resolved(u(1,["Invalid Address: "+e]))},transactionCount:function(r,e,n,t){var c=void 0!==n?n:1;if(fe(e)){var i=[he[0](e),he[7](c)];return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[1](r[0])])},l(r,"eth_getTransactionCount",i))}return a.resolved(u(1,["Invalid Address: "+e]))},blockNumber:function(r){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[2](r[0])])},l(r,"eth_blockNumber",[]))},gasPrice:function(r){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[3](r[0])])},l(r,"eth_gasPrice",[]))},sendTransaction:function(r,e){var n=[he[6](e)];return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[7](r[0])])},l(r,"eth_sendTransaction",n))},sendRawTransaction:function(r,e){var n=[he[1](e)];return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[7](r[0])])},l(r,"eth_sendRawTransaction",n))},transactionByHash:function(r,e){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[8](r[0])])},l(r,"eth_getTransactionByHash",[he[1](e)]))},transactionReceipt:function(r,e){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[9](r[0])])},l(r,"eth_getTransactionReceipt",[he[1](e)]))},estimateGas:function(r,e,n,t){var c=void 0!==n?n:1,i=[he[6](e),he[7](c)];return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[3](r[0])])},l(r,"eth_estimateGas",i))},call:function(r,e,n,t){var c=void 0!==n?n:1,i=[he[6](e),he[7](c)];return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[7](r[0])])},l(r,"eth_call",i))},mineBlock:function(r){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[6](r[0])])},l(r,"evm_mine",[]))},blockByHash:function(r,e,n){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[10](r[0])])},l(r,"eth_getBlockByHash",[he[1](e),he[5](n)]))},blockByNumber:function(r,e,n){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[10](r[0])])},l(r,"eth_getBlockByNumber",[he[2](e),he[5](n)]))},netVersion:function(r){return a.map(function(r){return r.tag?u(1,[r[0]]):u(0,[oe[0](r[0])])},l(r,"net_version",[]))}};function be(r,e){var n={jsonrpc:"2.0",id:1};return n.method=r,n.params=e,n}function me(r){var e=n.optional(n.at(["error",["message",0]],n.string),r);return void 0!==e?u(1,[e]):function(r){var e=Jr(r);if("number"==typeof e||2!==e.tag)return u(1,["Invalid response"]);var n=function(r,e){if(e in r)return vr(r[e])}(e[0],"result");return void 0!==n?u(0,[lr(n)]):u(1,["No result"])}(r)}require("isomorphic-fetch"),K("Providers-BsEth.JsonRpcError");var de={web3:function(r,e,n){var t=a.make(0),c=t[1];return r.sendAsync(be(e,n),function(r,e){return v(c,null==e?u(1,null==r?["Something went wrong"]:[r]):me(e))}),t[0]},http:function(r,e,n){return a.map(function(r){return r.tag?u(1,[r[0]]):me(r[0])},function(r,e){return a.Rejectable[7](function(r){return a.Rejectable[2](u(1,["Error"]))},a.Rejectable[5](function(r){return u(0,[r])},a.Rejectable[4](function(r){return a.Rejectable[10](r.json())},a.Rejectable[10](fetch(r,t.RequestInit[0](2,{"Content-Type":"application/json"},vr(JSON.stringify(e)),void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)(0))))))}(r,be(e,n)))}},we={bnZero:re,Decode:oe,Encode:he};exports.Eth=ge,exports.Providers=de,exports.Formats=we; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jsbi"),require("@glennsl/bs-json/src/Json_decode.bs.js"),require("bs-fetch/src/Fetch.js"),require("@aantron/repromise/src/js/repromise.js")):"function"==typeof define&&define.amd?define(["exports","jsbi","@glennsl/bs-json/src/Json_decode.bs.js","bs-fetch/src/Fetch.js","@aantron/repromise/src/js/repromise.js"],e):e(r.bsEth={},r.jsbi,r.Json_decode,r.Fetch,r.Repromise)}(this,function(r,e,n,t,a){var u="default"in e?e.default:e;function c(r,e){return e.tag=r,e}var i=["Invalid_argument",-3],o=["Division_by_zero",-5],s=["Assert_failure",-10];function f(r,e,n){for(var t=new Array(n),a=0,u=e;a<n;)t[a]=r[u],a=a+1|0,u=u+1|0;return t}function v(r,e){for(;;){var n=e,t=r,a=t.length,u=0===a?1:a,c=u-n.length|0;if(0===c)return t.apply(null,n);if(!(c<0))return function(r,e){return function(n){return v(r,e.concat([n]))}}(t,n);e=f(n,u,0|-c),r=t.apply(null,f(n,0,u))}}function h(r,e){var n=r.length;return 1===n?r(e):function(r,e,n){switch(n){case 1:return r(e);case 2:return function(n){return r(e,n)};case 3:return function(n,t){return r(e,n,t)};case 4:return function(n,t,a){return r(e,n,t,a)};case 5:return function(n,t,a,u){return r(e,n,t,a,u)};case 6:return function(n,t,a,u,c){return r(e,n,t,a,u,c)};case 7:return function(n,t,a,u,c,i){return r(e,n,t,a,u,c,i)};default:return v(r,[e])}}(r,e,n)}function l(r,e,n){var t=r.length;return 2===t?r(e,n):function(r,e,n,t){switch(t){case 1:return v(r(e),[n]);case 2:return r(e,n);case 3:return function(t){return r(e,n,t)};case 4:return function(t,a){return r(e,n,t,a)};case 5:return function(t,a,u){return r(e,n,t,a,u)};case 6:return function(t,a,u,c){return r(e,n,t,a,u,c)};case 7:return function(t,a,u,c,i){return r(e,n,t,a,u,c,i)};default:return v(r,[e,n])}}(r,e,n,t)}function b(r){if(r<0)throw[i,"String.create"];for(var e=new Array(r),n=0,t=r-1|0;n<=t;++n)e[n]=0;return e}function m(r,e,n,t,a){if(a>0){if(r===n){var u=r,c=e,i=t,o=a;if(c<i){for(var s=(u.length-i|0)-1|0,f=o-1|0,v=s>f?f:s;v>=0;--v)u[i+v|0]=u[c+v|0];return 0}if(c>i){for(var h=(u.length-c|0)-1|0,l=o-1|0,b=h>l?l:h,m=0;m<=b;++m)u[i+m|0]=u[c+m|0];return 0}return 0}var g=r.length-e|0;if(a<=g){for(var w=0,p=a-1|0;w<=p;++w)n[t+w|0]=r[e+w|0];return 0}for(var k=0,d=g-1|0;k<=d;++k)n[t+k|0]=r[e+k|0];for(var y=g,C=a-1|0;y<=C;++y)n[t+y|0]=0;return 0}return 0}function g(r){var e=r,n=r.length,t="",a=n;if(n<=4096&&n===e.length)return String.fromCharCode.apply(null,e);for(var u=0;a>0;){var c=a<1024?a:1024,i=new Array(c);m(e,u,i,0,c),t+=String.fromCharCode.apply(null,i),a=a-c|0,u=u+c|0}return t}function w(r,e,n,t,a){if(a>0){var u=r.length-e|0;if(a<=u){for(var c=0,i=a-1|0;c<=i;++c)n[t+c|0]=r.charCodeAt(e+c|0);return 0}for(var o=0,s=u-1|0;o<=s;++o)n[t+o|0]=r.charCodeAt(e+o|0);for(var f=u,v=a-1|0;f<=v;++f)n[t+f|0]=0;return 0}return 0}function p(r,e){return r>e?r:e}function k(r,e){for(var n in r)e(n)}function d(r,e){return!function r(e,n){for(;;){var t=n,a=e;if(a===t)return!0;var u=typeof a;if("string"===u||"number"===u||"boolean"===u||"undefined"===u||null===a)return!1;var c=typeof t;if("function"===u||"function"===c)throw[i,"equal: functional value"];if("number"===c||"undefined"===c||null===t)return!1;var o=0|a.tag,s=0|t.tag;if(250!==o)if(250!==s){if(248===o)return a[1]===t[1];if(251===o)throw[i,"equal: abstract value"];if(o!==s)return!1;if(256===o)return a[1]===t[1];var f=0|a.length;if(f!==(0|t.length))return!1;if(!Array.isArray(a)){if(a instanceof Date&&t instanceof Date)return!(a>t||a<t);var v=a,h=t,l=[!0],b=function(r,e){return function(n){return r.hasOwnProperty(n)?0:(e[0]=!1,0)}}(h,l),m=function(e,n,t){return function(a){return e.hasOwnProperty(a)&&r(n[a],e[a])?0:(t[0]=!1,0)}}(v,h,l);return k(v,b),l[0]&&k(h,m),l[0]}for(var g=a,w=t,p=0,d=f;;){var y=p;if(y===d)return!0;if(!r(g[y],w[y]))return!1;p=y+1|0}}else n=t[0];else e=a[0]}}(r,e)}i.tag=248,o.tag=248,s.tag=248;var y=Math.imul||function(r,e){return((r>>16)*(e|=0)<<16)+(65535&r)*e|0};function C(r,e){if(e.repeat)return e.repeat(r);if(0==e.length||0==r)return"";if(e.length*r>=1<<28)throw new RangeError("repeat count must not overflow maximum string size");for(var n="";1==(1&r)&&(n+=e),0!=(r>>>=1);)e+=e;return n}var F=[-2147483648,0],A=[2147483647,1],x=[0,1],_=[0,0],S=[-1,4294967295];function j(r){return 0!=(2147483648&r)}function N(r,e){var n=e[1],t=r[1],a=t+n&4294967295,u=j(t)&&(j(n)||!j(a))||j(n)&&!j(a)?1:0;return[r[0]+e[0]+u&4294967295,a>>>0]}function E(r,e){return r[0]===e[0]&&r[1]===e[1]}function P(r){return E(r,F)?F:N([-1^(e=r)[0],(-1^e[1])>>>0],x);var e}function R(r,e){if(0===e)return r;var n=r[1];return e>=32?[n<<(e-32|0),0]:[n>>>(32-e|0)|r[0]<<e,n<<e>>>0]}function B(r,e){if(0===e)return r;var n=r[0];return e<32?[n>>e,(n<<(32-e|0)|r[1]>>>e)>>>0]:[n>=0?0:-1,n>>(e-32|0)>>>0]}function q(r,e){for(;;){var n,t=e,a=r,u=0,c=a[0],i=0;if(0===c&&0===a[1])return _;if(0===t[0]&&0===t[1])return _;if(-2147483648!==c||0!==a[1]?i=2:(n=t[1],u=1),2===i){var o=t[0],s=a[1],f=0;if(-2147483648!==o||0!==t[1]?f=3:(n=s,u=1),3===f){var v=t[1];if(c<0){if(o<0){e=P(t),r=P(a);continue}return P(q(P(a),t))}if(o<0)return P(q(a,P(t)));var h=65535&c,l=s>>>16,b=65535&s,m=65535&o,g=v>>>16,w=65535&v,p=0,k=0,d=0,y=b*w;return p=(k=(k=(d=(y>>>16)+l*w)>>>16)+((d=(65535&d)+b*g)>>>16)+h*w)>>>16,p+=(k=(65535&k)+l*g)>>>16,p+=(k=(65535&k)+b*m)>>>16,[(k&=65535)|(p=p+((c>>>16)*w+h*g+l*m+b*(o>>>16))&65535)<<16,(65535&y|(65535&d)<<16)>>>0]}}if(1===u)return 0==(1&n)?_:F}}function I(r,e){var n=e[0],t=r[0];return t>n||!(t<n)&&r[1]>=e[1]}function M(r,e){return!E(r,e)}function T(r,e){return!I(r,e)}function J(r,e){return r[0]>e[0]||!(r[0]<e[0])&&r[1]>e[1]}function O(r){return 4294967296*r[0]+r[1]}function D(r){return isNaN(r)||!isFinite(r)?_:r<=-0x8000000000000000?F:r+1>=0x8000000000000000?A:r<0?P(D(-r)):[r/4294967296|0,(r%4294967296|0)>>>0]}function X(r,e){var n=function r(e,n){for(;;){var t=n,a=e,u=a[0],c=0;if(0===t[0]&&0===t[1])throw o;if(-2147483648!==u){if(0===u&&0===a[1])return _;c=1}else{if(0===a[1]){if(E(t,x)||E(t,S))return a;if(E(t,F))return x;var i=t[0],s=R(r(B(a,1),t),1);if(0===s[0]&&0===s[1])return i<0?x:P(x);var f=N(a,P(q(t,s)));return N(s,r(f,t))}c=1}if(1===c){var v=t[0];if(-2147483648===v&&0===t[1])return _;if(u<0){if(v<0){n=P(t),e=P(a);continue}return P(r(P(a),t))}if(v<0)return P(r(a,P(t)));for(var h=_,l=a;I(l,t);){for(var b=p(1,Math.floor(O(l)/O(t))),m=Math.ceil(Math.log(b)/Math.LN2),g=m<=48?1:Math.pow(2,m-48),w=D(b),k=q(w,t);k[0]<0||J(k,l);)k=q(w=D(b-=g),t);0===(d=w)[0]&&0===d[1]&&(w=x),h=N(h,w),l=N(l,P(k))}return h}}var d}(r,e);return[n,N(r,P(q(n,e)))]}function $(r){return[2147483647&r[0],r[1]]}function z(r){return r>=65&&r<=90||r>=192&&r<=214||r>=216&&r<=222?r+32|0:r}function G(r){var e=r.length;if(e>31)throw[i,"format_int: format too long"];for(var n=["+","-"," ",!1,2,!1,0,!1,1,-1,"f"],t=0;;){var a=t;if(a>=e)return n;var u=r.charCodeAt(a),c=0;if(u>=69)if(u>=88)if(u>=121)c=1;else switch(u-88|0){case 0:n[4]=1,n[7]=!0,t=a+1|0;continue;case 13:case 14:case 15:c=5;break;case 12:case 17:c=4;break;case 23:n[4]=0,t=a+1|0;continue;case 29:n[4]=2,t=a+1|0;continue;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 16:case 18:case 19:case 20:case 21:case 22:case 24:case 25:case 26:case 27:case 28:case 30:case 31:c=1;break;case 32:n[4]=1,t=a+1|0;continue}else{if(!(u>=72)){n[5]=!0,n[7]=!0,n[10]=String.fromCharCode(z(u)),t=a+1|0;continue}c=1}else switch(u){case 35:n[3]=!0,t=a+1|0;continue;case 32:case 43:c=2;break;case 45:n[0]="-",t=a+1|0;continue;case 46:n[9]=0;for(var o=a+1|0;function(e){return function(){var n=r.charCodeAt(e)-48|0;return n>=0&&n<=9}}(o)();)n[9]=(y(n[9],10)+r.charCodeAt(o)|0)-48|0,o=o+1|0;t=o;continue;case 33:case 34:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 44:case 47:c=1;break;case 48:n[2]="0",t=a+1|0;continue;case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:c=3;break;default:c=1}switch(c){case 1:t=a+1|0;continue;case 2:n[1]=String.fromCharCode(u),t=a+1|0;continue;case 3:n[6]=0;for(var s=a;function(e){return function(){var n=r.charCodeAt(e)-48|0;return n>=0&&n<=9}}(s)();)n[6]=(y(n[6],10)+r.charCodeAt(s)|0)-48|0,s=s+1|0;t=s;continue;case 4:n[5]=!0,n[4]=2,t=a+1|0;continue;case 5:n[5]=!0,n[10]=String.fromCharCode(u),t=a+1|0;continue}}}function L(r,e){var n=r[0],t=r[1],a=r[2],u=r[3],c=r[4],i=r[5],o=r[6],s=r[7],f=r[8],v=e.length;i&&(f<0||"-"!==t)&&(v=v+1|0),u&&(0===c?v=v+1|0:1===c&&(v=v+2|0));var h="";if("+"===n&&" "===a)for(var l=v,b=o-1|0;l<=b;++l)h+=a;if(i&&(f<0?h+="-":"-"!==t&&(h+=t)),u&&0===c&&(h+="0"),u&&1===c&&(h+="0x"),"+"===n&&"0"===a)for(var m=v,g=o-1|0;m<=g;++m)h+=a;if(h=s?h+e.toUpperCase():h+e,"-"===n)for(var w=v,p=o-1|0;w<=p;++w)h+=" ";return h}function U(r,e){if("%d"===r)return String(e);var n=G(r),t=e,a=(t<0?n[5]?(n[8]=-1,-t):t>>>0:t).toString(function(r){switch(n[4]){case 0:return 8;case 1:return 16;case 2:return 10}}());if(n[9]>=0){n[2]=" ";var u=n[9]-a.length|0;u>0&&(a=C(u,"0")+a)}return L(n,a)}var Z=U,H=U;function K(r,e){if(e<0||e>=r.length)throw[i,"index out of bounds"];return r.charCodeAt(e)}var Q=[0];function V(r){var e=[r,(Q[0]+=1,Q[0])];return e.tag=248,e}function W(r){if("number"==typeof r)return 0;switch(0|r.tag){case 0:return c(0,[W(r[0])]);case 1:return c(1,[W(r[0])]);case 2:return c(2,[W(r[0])]);case 3:return c(3,[W(r[0])]);case 4:return c(4,[W(r[0])]);case 5:return c(5,[W(r[0])]);case 6:return c(6,[W(r[0])]);case 7:return c(7,[W(r[0])]);case 8:return c(8,[r[0],W(r[1])]);case 9:var e=r[0];return c(9,[e,e,W(r[2])]);case 10:return c(10,[W(r[0])]);case 11:return c(11,[W(r[0])]);case 12:return c(12,[W(r[0])]);case 13:return c(13,[W(r[0])]);case 14:return c(14,[W(r[0])])}}function Y(r,e){if("number"==typeof r)return e;switch(0|r.tag){case 0:return c(0,[Y(r[0],e)]);case 1:return c(1,[Y(r[0],e)]);case 2:return c(2,[r[0],Y(r[1],e)]);case 3:return c(3,[r[0],Y(r[1],e)]);case 4:return c(4,[r[0],r[1],r[2],Y(r[3],e)]);case 5:return c(5,[r[0],r[1],r[2],Y(r[3],e)]);case 6:return c(6,[r[0],r[1],r[2],Y(r[3],e)]);case 7:return c(7,[r[0],r[1],r[2],Y(r[3],e)]);case 8:return c(8,[r[0],r[1],r[2],Y(r[3],e)]);case 9:return c(9,[Y(r[0],e)]);case 10:return c(10,[Y(r[0],e)]);case 11:return c(11,[r[0],Y(r[1],e)]);case 12:return c(12,[r[0],Y(r[1],e)]);case 13:return c(13,[r[0],r[1],Y(r[2],e)]);case 14:return c(14,[r[0],r[1],Y(r[2],e)]);case 15:return c(15,[Y(r[0],e)]);case 16:return c(16,[Y(r[0],e)]);case 17:return c(17,[r[0],Y(r[1],e)]);case 18:return c(18,[r[0],Y(r[1],e)]);case 19:return c(19,[Y(r[0],e)]);case 20:return c(20,[r[0],r[1],Y(r[2],e)]);case 21:return c(21,[r[0],Y(r[1],e)]);case 22:return c(22,[Y(r[0],e)]);case 23:return c(23,[r[0],Y(r[1],e)]);case 24:return c(24,[r[0],r[1],Y(r[2],e)])}}function rr(r){return r>=0?r:0|-r}function er(r,e){for(;;){var n=e;if(!n)return 0;h(r,n[0]),e=n[1]}}function nr(r,e){var n=b(r);return function(e,n,t,a){if(r>0)for(var u=0,c=(r+0|0)-1|0;u<=c;++u)e[u]=a}(n,0,0,e),n}function tr(r,e,n){return g(function(r,e,n){if(e<0||n<0||e>(r.length-n|0))throw[i,"String.sub / Bytes.sub"];var t=b(n);return m(r,e,t,0,n),t}(r,e,n))}function ar(r,e,n,t,a){if(a<0||e<0||e>(r.length-a|0)||t<0||t>(n.length-a|0))throw[i,"Bytes.blit"];return m(r,e,n,t,a)}function ur(r,e,n,t,a){if(a<0||e<0||e>(r.length-a|0)||t<0||t>(n.length-a|0))throw[i,"String.blit / Bytes.blit_string"];return w(r,e,n,t,a)}function cr(r,e){if(e){var n=e[0],t=[0],a=[0];er(function(r){return t[0]=t[0]+1|0,a[0]=a[0]+r.length|0,0},e);var u=b(a[0]+y(r.length,t[0]-1|0)|0);w(n,0,u,0,n.length);var c=[n.length];return er(function(e){return w(r,0,u,c[0],r.length),c[0]=c[0]+r.length|0,w(e,0,u,c[0],e.length),c[0]=c[0]+e.length|0,0},e[1]),g(u)}return""}V("Pervasives.Exit");var ir=ur;function or(r,e){for(var n=r[2];(r[1]+e|0)>n;)n<<=1;var t=b(n);return ar(r[0],0,t,0,r[1]),r[0]=t,r[2]=n,0}function sr(r,e){var n=r[1];return n>=r[2]&&or(r,1),r[0][n]=e,r[1]=n+1|0,0}function fr(r,e){var n=e.length,t=r[1]+n|0;return t>r[2]&&or(r,n),ur(e,0,r[0],r[1],n),r[1]=t,0}var vr=[];function hr(r){if(void 0===r){var e=[vr,0];return e.tag=256,e}if(null!==r&&r[0]===vr){var n=[vr,r[1]+1|0];return n.tag=256,n}return r}function lr(r){if(null!==r&&r[0]===vr){var e=r[1];return 0===e?void 0:[vr,e-1|0]}return r}function br(r,e){var n,t,a=r[1].length,u=r[0]+e|0;if(u>a){var c=b((n=a<<1)>(t=u)?n:t);return ar(r[1],0,c,0,a),r[1]=c,0}return 0}function mr(r,e){return br(r,1),r[1][r[0]]=e,r[0]=r[0]+1|0,0}function gr(r,e){var n=e.length;return br(r,n),ir(e,0,r[1],r[0],n),r[0]=r[0]+n|0,0}function wr(r){return tr(r[1],0,r[0])}function pr(r){if("number"==typeof r)switch(r){case 0:return"@]";case 1:return"@}";case 2:return"@?";case 3:return"@\n";case 4:return"@.";case 5:return"@@";case 6:return"@%"}else switch(0|r.tag){case 0:case 1:return r[0];case 2:return"@"+g(nr(1,r[0]))}}function kr(r){if("number"==typeof r)return 0;switch(0|r.tag){case 0:return c(0,[kr(r[0])]);case 1:return c(1,[kr(r[0])]);case 2:return c(2,[kr(r[0])]);case 3:return c(3,[kr(r[0])]);case 4:return c(4,[kr(r[0])]);case 5:return c(5,[kr(r[0])]);case 6:return c(6,[kr(r[0])]);case 7:return c(7,[kr(r[0])]);case 8:return c(8,[r[0],kr(r[1])]);case 9:return c(9,[r[1],r[0],kr(r[2])]);case 10:return c(10,[kr(r[0])]);case 11:return c(11,[kr(r[0])]);case 12:return c(12,[kr(r[0])]);case 13:return c(13,[kr(r[0])]);case 14:return c(14,[kr(r[0])])}}function dr(r){if("number"==typeof r)return[function(r){return 0},function(r){return 0},function(r){return 0},function(r){return 0}];switch(0|r.tag){case 0:var e=dr(r[0]),n=e[1],t=e[0];return[function(r){return h(t,0),0},function(r){return h(n,0),0},e[2],e[3]];case 1:var a=dr(r[0]),u=a[1],c=a[0];return[function(r){return h(c,0),0},function(r){return h(u,0),0},a[2],a[3]];case 2:var i=dr(r[0]),o=i[1],s=i[0];return[function(r){return h(s,0),0},function(r){return h(o,0),0},i[2],i[3]];case 3:var f=dr(r[0]),v=f[1],l=f[0];return[function(r){return h(l,0),0},function(r){return h(v,0),0},f[2],f[3]];case 4:var b=dr(r[0]),m=b[1],g=b[0];return[function(r){return h(g,0),0},function(r){return h(m,0),0},b[2],b[3]];case 5:var w=dr(r[0]),p=w[1],k=w[0];return[function(r){return h(k,0),0},function(r){return h(p,0),0},w[2],w[3]];case 6:var d=dr(r[0]),y=d[1],C=d[0];return[function(r){return h(C,0),0},function(r){return h(y,0),0},d[2],d[3]];case 7:var F=dr(r[0]),A=F[1],x=F[0];return[function(r){return h(x,0),0},function(r){return h(A,0),0},F[2],F[3]];case 8:var _=dr(r[1]),S=_[1],j=_[0];return[function(r){return h(j,0),0},function(r){return h(S,0),0},_[2],_[3]];case 9:var N=dr(r[2]),E=N[3],P=N[2],R=N[1],B=N[0],q=dr(yr(kr(r[0]),r[1])),I=q[3],M=q[2],T=q[1],J=q[0];return[function(r){return h(B,0),h(J,0),0},function(r){return h(T,0),h(R,0),0},function(r){return h(P,0),h(M,0),0},function(r){return h(I,0),h(E,0),0}];case 10:var O=dr(r[0]),D=O[1],X=O[0];return[function(r){return h(X,0),0},function(r){return h(D,0),0},O[2],O[3]];case 11:var $=dr(r[0]),z=$[1],G=$[0];return[function(r){return h(G,0),0},function(r){return h(z,0),0},$[2],$[3]];case 12:var L=dr(r[0]),U=L[1],Z=L[0];return[function(r){return h(Z,0),0},function(r){return h(U,0),0},L[2],L[3]];case 13:var H=dr(r[0]),K=H[3],Q=H[2],V=H[1],W=H[0];return[function(r){return h(W,0),0},function(r){return h(V,0),0},function(r){return h(Q,0),0},function(r){return h(K,0),0}];case 14:var Y=dr(r[0]),rr=Y[3],er=Y[2],nr=Y[1],tr=Y[0];return[function(r){return h(tr,0),0},function(r){return h(nr,0),0},function(r){return h(er,0),0},function(r){return h(rr,0),0}]}}function yr(r,e){var n=0;if("number"==typeof r){if("number"==typeof e)return 0;switch(0|e.tag){case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5;break;default:throw[s,["camlinternalFormat.ml",816,23]]}}else switch(0|r.tag){case 0:if("number"==typeof e)n=8;else switch(0|e.tag){case 0:return c(0,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 1:if("number"==typeof e)n=8;else switch(0|e.tag){case 1:return c(1,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 2:if("number"==typeof e)n=8;else switch(0|e.tag){case 2:return c(2,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 3:if("number"==typeof e)n=8;else switch(0|e.tag){case 3:return c(3,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 4:if("number"==typeof e)n=8;else switch(0|e.tag){case 4:return c(4,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 5:if("number"==typeof e)n=8;else switch(0|e.tag){case 5:return c(5,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 6:if("number"==typeof e)n=8;else switch(0|e.tag){case 6:return c(6,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 7:if("number"==typeof e)n=8;else switch(0|e.tag){case 7:return c(7,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 8:if("number"==typeof e)throw[s,["camlinternalFormat.ml",802,26]];switch(0|e.tag){case 8:return c(8,[yr(r[0],e[0]),yr(r[1],e[1])]);case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5;break;default:throw[s,["camlinternalFormat.ml",802,26]]}break;case 9:if("number"==typeof e)throw[s,["camlinternalFormat.ml",812,28]];switch(0|e.tag){case 8:n=6;break;case 9:var t=dr(yr(kr(r[1]),e[0]));return h(t[1],0),h(t[3],0),c(9,[r[0],e[1],yr(r[2],e[2])]);case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5;break;default:throw[s,["camlinternalFormat.ml",812,28]]}break;case 10:if("number"==typeof e)throw[s,["camlinternalFormat.ml",780,21]];if(10===e.tag)return c(10,[yr(r[0],e[0])]);throw[s,["camlinternalFormat.ml",780,21]];case 11:if("number"==typeof e)throw[s,["camlinternalFormat.ml",784,21]];switch(0|e.tag){case 10:n=1;break;case 11:return c(11,[yr(r[0],e[0])]);default:throw[s,["camlinternalFormat.ml",784,21]]}break;case 12:if("number"==typeof e)throw[s,["camlinternalFormat.ml",788,19]];switch(0|e.tag){case 10:n=1;break;case 11:n=2;break;case 12:return c(12,[yr(r[0],e[0])]);default:throw[s,["camlinternalFormat.ml",788,19]]}break;case 13:if("number"==typeof e)throw[s,["camlinternalFormat.ml",792,22]];switch(0|e.tag){case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:return c(13,[yr(r[0],e[0])]);default:throw[s,["camlinternalFormat.ml",792,22]]}break;case 14:if("number"==typeof e)throw[s,["camlinternalFormat.ml",797,30]];switch(0|e.tag){case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:return c(14,[yr(r[0],e[0])]);default:throw[s,["camlinternalFormat.ml",797,30]]}}switch(n){case 1:throw[s,["camlinternalFormat.ml",781,21]];case 2:throw[s,["camlinternalFormat.ml",785,21]];case 3:throw[s,["camlinternalFormat.ml",789,19]];case 4:throw[s,["camlinternalFormat.ml",793,22]];case 5:throw[s,["camlinternalFormat.ml",798,30]];case 6:throw[s,["camlinternalFormat.ml",803,26]];case 7:throw[s,["camlinternalFormat.ml",813,28]];case 8:throw[s,["camlinternalFormat.ml",817,23]]}}V("Caml_js_exceptions.Error");var Cr=V("CamlinternalFormat.Type_mismatch");function Fr(r,e){if("number"==typeof r)return[0,e];if(r.tag){if("number"==typeof e)throw Cr;if(2===e.tag)return[c(1,[r[0]]),e[0]];throw Cr}return[c(0,[r[0],r[1]]),e]}function Ar(r,e,n){var t=Fr(r,n);if("number"==typeof e){if(0!==e){var a=t[1];if("number"==typeof a)throw Cr;if(2===a.tag)return[t[0],1,a[0]];throw Cr}return[t[0],0,t[1]]}return[t[0],[e[0]],t[1]]}function xr(r,e,n){var t=_r(e,n);return[c(23,[r,t[0]]),t[1]]}function _r(r,e){if("number"==typeof r)return[0,e];switch(0|r.tag){case 0:if("number"==typeof e)throw Cr;if(e.tag)throw Cr;var n=_r(r[0],e[0]);return[c(0,[n[0]]),n[1]];case 1:if("number"==typeof e)throw Cr;if(e.tag)throw Cr;var t=_r(r[0],e[0]);return[c(1,[t[0]]),t[1]];case 2:var a=Fr(r[0],e),u=a[1];if("number"==typeof u)throw Cr;if(1===u.tag){var i=_r(r[1],u[0]);return[c(2,[a[0],i[0]]),i[1]]}throw Cr;case 3:var o=Fr(r[0],e),s=o[1];if("number"==typeof s)throw Cr;if(1===s.tag){var f=_r(r[1],s[0]);return[c(3,[o[0],f[0]]),f[1]]}throw Cr;case 4:var v=Ar(r[1],r[2],e),l=v[2];if("number"==typeof l)throw Cr;if(2===l.tag){var b=_r(r[3],l[0]);return[c(4,[r[0],v[0],v[1],b[0]]),b[1]]}throw Cr;case 5:var m=Ar(r[1],r[2],e),g=m[2];if("number"==typeof g)throw Cr;if(3===g.tag){var w=_r(r[3],g[0]);return[c(5,[r[0],m[0],m[1],w[0]]),w[1]]}throw Cr;case 6:var p=Ar(r[1],r[2],e),k=p[2];if("number"==typeof k)throw Cr;if(4===k.tag){var y=_r(r[3],k[0]);return[c(6,[r[0],p[0],p[1],y[0]]),y[1]]}throw Cr;case 7:var C=Ar(r[1],r[2],e),F=C[2];if("number"==typeof F)throw Cr;if(5===F.tag){var A=_r(r[3],F[0]);return[c(7,[r[0],C[0],C[1],A[0]]),A[1]]}throw Cr;case 8:var x=Ar(r[1],r[2],e),_=x[2];if("number"==typeof _)throw Cr;if(6===_.tag){var S=_r(r[3],_[0]);return[c(8,[r[0],x[0],x[1],S[0]]),S[1]]}throw Cr;case 9:if("number"==typeof e)throw Cr;if(7===e.tag){var j=_r(r[0],e[0]);return[c(9,[j[0]]),j[1]]}throw Cr;case 10:var N=_r(r[0],e);return[c(10,[N[0]]),N[1]];case 11:var E=_r(r[1],e);return[c(11,[r[0],E[0]]),E[1]];case 12:var P=_r(r[1],e);return[c(12,[r[0],P[0]]),P[1]];case 13:if("number"==typeof e)throw Cr;if(8===e.tag){var R=e[0];if(d([r[1]],[R]))throw Cr;var B=_r(r[2],e[1]);return[c(13,[r[0],R,B[0]]),B[1]]}throw Cr;case 14:if("number"==typeof e)throw Cr;if(9===e.tag){var q=e[0];if(d([W(r[1])],[W(q)]))throw Cr;var I=_r(r[2],W(e[2]));return[c(14,[r[0],q,I[0]]),I[1]]}throw Cr;case 15:if("number"==typeof e)throw Cr;if(10===e.tag){var M=_r(r[0],e[0]);return[c(15,[M[0]]),M[1]]}throw Cr;case 16:if("number"==typeof e)throw Cr;if(11===e.tag){var T=_r(r[0],e[0]);return[c(16,[T[0]]),T[1]]}throw Cr;case 17:var J=_r(r[1],e);return[c(17,[r[0],J[0]]),J[1]];case 18:var O=r[0],D=r[1],X=e;if(O.tag){var $=O[0],z=_r($[0],X),G=_r(D,z[1]);return[c(18,[c(1,[[z[0],$[1]]]),G[0]]),G[1]]}var L=O[0],U=_r(L[0],X),Z=_r(D,U[1]);return[c(18,[c(0,[[U[0],L[1]]]),Z[0]]),Z[1]];case 19:if("number"==typeof e)throw Cr;if(13===e.tag){var H=_r(r[0],e[0]);return[c(19,[H[0]]),H[1]]}throw Cr;case 20:if("number"==typeof e)throw Cr;if(1===e.tag){var K=_r(r[2],e[0]);return[c(20,[r[0],r[1],K[0]]),K[1]]}throw Cr;case 21:if("number"==typeof e)throw Cr;if(2===e.tag){var Q=_r(r[1],e[0]);return[c(21,[r[0],Q[0]]),Q[1]]}throw Cr;case 23:var V=r[0],Y=r[1],rr=e;if("number"==typeof V){if(3===V){if("number"==typeof rr)throw Cr;if(14===rr.tag){var er=_r(Y,rr[0]);return[c(23,[3,er[0]]),er[1]]}throw Cr}return xr(V,Y,rr)}switch(0|V.tag){case 7:return xr(c(7,[V[0],V[1]]),Y,rr);case 8:var nr=function r(e,n,t){if("number"==typeof e)return[0,_r(n,t)];switch(0|e.tag){case 0:if("number"==typeof t)throw Cr;if(t.tag)throw Cr;var a=r(e[0],n,t[0]);return[c(0,[a[0]]),a[1]];case 1:if("number"==typeof t)throw Cr;if(1===t.tag){var u=r(e[0],n,t[0]);return[c(1,[u[0]]),u[1]]}throw Cr;case 2:if("number"==typeof t)throw Cr;if(2===t.tag){var i=r(e[0],n,t[0]);return[c(2,[i[0]]),i[1]]}throw Cr;case 3:if("number"==typeof t)throw Cr;if(3===t.tag){var o=r(e[0],n,t[0]);return[c(3,[o[0]]),o[1]]}throw Cr;case 4:if("number"==typeof t)throw Cr;if(4===t.tag){var s=r(e[0],n,t[0]);return[c(4,[s[0]]),s[1]]}throw Cr;case 5:if("number"==typeof t)throw Cr;if(5===t.tag){var f=r(e[0],n,t[0]);return[c(5,[f[0]]),f[1]]}throw Cr;case 6:if("number"==typeof t)throw Cr;if(6===t.tag){var v=r(e[0],n,t[0]);return[c(6,[v[0]]),v[1]]}throw Cr;case 7:if("number"==typeof t)throw Cr;if(7===t.tag){var l=r(e[0],n,t[0]);return[c(7,[l[0]]),l[1]]}throw Cr;case 8:if("number"==typeof t)throw Cr;if(8===t.tag){var b=t[0];if(d([e[0]],[b]))throw Cr;var m=r(e[1],n,t[1]);return[c(8,[b,m[0]]),m[1]]}throw Cr;case 9:if("number"==typeof t)throw Cr;if(9===t.tag){var g=t[1],w=t[0];if(d([W(e[0])],[W(w)]))throw Cr;if(d([W(e[1])],[W(g)]))throw Cr;var p=dr(yr(kr(w),g));h(p[1],0),h(p[3],0);var k=r(W(e[2]),n,t[2]);return[c(9,[w,g,kr(k[0])]),k[1]]}throw Cr;case 10:if("number"==typeof t)throw Cr;if(10===t.tag){var y=r(e[0],n,t[0]);return[c(10,[y[0]]),y[1]]}throw Cr;case 11:if("number"==typeof t)throw Cr;if(11===t.tag){var C=r(e[0],n,t[0]);return[c(11,[C[0]]),C[1]]}throw Cr;case 12:throw Cr;case 13:if("number"==typeof t)throw Cr;if(13===t.tag){var F=r(e[0],n,t[0]);return[c(13,[F[0]]),F[1]]}throw Cr;case 14:if("number"==typeof t)throw Cr;if(14===t.tag){var A=r(e[0],n,t[0]);return[c(14,[A[0]]),A[1]]}throw Cr}}(V[1],Y,rr),tr=nr[1];return[c(23,[c(8,[V[0],nr[0]]),tr[0]]),tr[1]];default:return xr(V,Y,rr)}case 22:case 24:throw Cr}}function Sr(r,e){return function(r,e){var n=_r(r,e);if("number"==typeof n[1])return n[0];throw Cr}(r,W(kr(e)))}function jr(r,e,n){var t=n.length,a=rr(e),u=e<0?0:r;if(a<=t)return n;var c=nr(a,2===u?48:32);switch(u){case 0:ir(n,0,c,0,t);break;case 1:ir(n,0,c,a-t|0,t);break;case 2:t>0&&(43===K(n,0)||45===K(n,0)||32===K(n,0))?(c[0]=K(n,0),ir(n,1,c,1+(a-t|0)|0,t-1|0)):t>1&&48===K(n,0)&&(120===K(n,1)||88===K(n,1))?(c[1]=K(n,1),ir(n,2,c,2+(a-t|0)|0,t-2|0)):ir(n,0,c,a-t|0,t)}return g(c)}function Nr(r,e){var n=rr(r),t=e.length,a=K(e,0),u=0;if(a>=58)if(a>=71){if(a>102||a<97)return e;u=2}else{if(!(a>=65))return e;u=2}else if(32!==a){if(!(a>=43))return e;switch(a-43|0){case 0:case 2:u=1;break;case 1:case 3:case 4:return e;case 5:if((n+2|0)>t&&t>1&&(120===K(e,1)||88===K(e,1))){var c=nr(n+2|0,48);return c[1]=K(e,1),ir(e,2,c,4+(n-t|0)|0,t-2|0),g(c)}u=2;break;case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:u=2}}else u=1;switch(u){case 1:if((n+1|0)>t){var i=nr(n+1|0,48);return i[0]=a,ir(e,1,i,2+(n-t|0)|0,t-1|0),g(i)}return e;case 2:if(n>t){var o=nr(n,48);return ir(e,0,o,n-t|0,t),g(o)}return e}}function Er(r){return cr((e=r,function(r){for(;;){var n=r;if(n>=e.length)return!1;var t=e.charCodeAt(n);if(!(t>=32))return!0;var a=t-34|0;if(a>58||a<0){if(a>=93)return!0;r=n+1|0}else{if(a>57||a<1)return!0;r=n+1|0}}}(0)?g(function(r){for(var e=0,n=0,t=r.length-1|0;n<=t;++n){var a,u=r[n];if(u>=32){var c=u-34|0;a=c>58||c<0?c>=93?4:1:c>57||c<1?2:1}else a=u>=11?13!==u?4:2:u>=8?2:4;e=e+a|0}if(e===r.length)return function(r){var e=r.length,n=b(e);return m(r,0,n,0,e),n}(r);var i=b(e);e=0;for(var o=0,s=r.length-1|0;o<=s;++o){var f=r[o],v=0;if(f>=35)92!==f?f>=127?v=1:i[e]=f:v=2;else if(f>=32)f>=34?v=2:i[e]=f;else if(f>=14)v=1;else switch(f){case 8:i[e]=92,i[e=e+1|0]=98;break;case 9:i[e]=92,i[e=e+1|0]=116;break;case 10:i[e]=92,i[e=e+1|0]=110;break;case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 11:case 12:v=1;break;case 13:i[e]=92,i[e=e+1|0]=114}switch(v){case 1:i[e]=92,i[e=e+1|0]=48+(f/100|0)|0,i[e=e+1|0]=48+(f/10|0)%10|0,i[e=e+1|0]=48+f%10|0;break;case 2:i[e]=92,i[e=e+1|0]=f}e=e+1|0}return i}(function(r){for(var e=r.length,n=new Array(e),t=0,a=e-1|0;t<=a;++t)n[t]=r.charCodeAt(t);return n}(e))):e),['"',['"',0]]);var e}function Pr(r,e){var n;switch(r){case 0:n=["%",["d",0]];break;case 1:n=["%+",["d",0]];break;case 2:n=["% ",["d",0]];break;case 3:n=["%",["i",0]];break;case 4:n=["%+",["i",0]];break;case 5:n=["% ",["i",0]];break;case 6:n=["%",["x",0]];break;case 7:n=["%#",["x",0]];break;case 8:n=["%",["X",0]];break;case 9:n=["%#",["X",0]];break;case 10:n=["%",["o",0]];break;case 11:n=["%#",["o",0]];break;case 12:n=["%",["u",0]]}return cr(g(nr(1,e)),n)}function Rr(r,e){return U(function(r){switch(r){case 0:return"%d";case 1:return"%+d";case 2:return"% d";case 3:return"%i";case 4:return"%+i";case 5:return"% i";case 6:return"%x";case 7:return"%#x";case 8:return"%X";case 9:return"%#X";case 10:return"%o";case 11:return"%#o";case 12:return"%u"}}(r),e)}function Br(r,e){return H(Pr(r,108),e)}function qr(r,e){return Z(Pr(r,110),e)}function Ir(r,e){return function(r,e){var n=G(r),t=n[5]&&T(e,[0,0])?(n[8]=-1,P(e)):e,a="";switch(n[4]){case 0:var u=[0,8],c="01234567";if(T(t,[0,0])){var i=X($(t),u),o=N([268435456,0],i[0]),s=i[1];for(a=String.fromCharCode(c.charCodeAt(0|s[1]))+a;M(o,[0,0]);){var f=X(o,u);o=f[0],s=f[1],a=String.fromCharCode(c.charCodeAt(0|s[1]))+a}}else{var v=X(t,u),h=v[0],l=v[1];for(a=String.fromCharCode(c.charCodeAt(0|l[1]))+a;M(h,[0,0]);){var b=X(h,u);h=b[0],l=b[1],a=String.fromCharCode(c.charCodeAt(0|l[1]))+a}}break;case 1:a=function(r){var e=t[1],n=t[0],a=function(r){return(r>>>0).toString(16)};if(0===n&&0===e)return"0";if(0!==e){if(0!==n){var u=a(e),c=8-u.length|0;return c<=0?a(n)+u:a(n)+(C(c,"0")+u)}return a(e)}return a(n)+"00000000"}()+a;break;case 2:var m=[0,10];if(T(t,[0,0])){var g=X($(t),m),w=X(N([0,8],g[1]),m),p=N(N([214748364,3435973836],g[0]),w[0]),k=w[1];for(a=String.fromCharCode("0123456789".charCodeAt(0|k[1]))+a;M(p,[0,0]);){var d=X(p,m);p=d[0],k=d[1],a=String.fromCharCode("0123456789".charCodeAt(0|k[1]))+a}}else{var y=X(t,m),F=y[0],A=y[1];for(a=String.fromCharCode("0123456789".charCodeAt(0|A[1]))+a;M(F,[0,0]);){var x=X(F,m);F=x[0],A=x[1],a=String.fromCharCode("0123456789".charCodeAt(0|A[1]))+a}}}if(n[9]>=0){n[2]=" ";var _=n[9]-a.length|0;_>0&&(a=C(_,"0")+a)}return L(n,a)}(Pr(r,76),e)}function Mr(r,e,n){var t=function(r,e){var n=G(r),t=n[9]<0?6:n[9],a=e<0?(n[8]=-1,-e):e,u="";if(isNaN(a))u="nan",n[2]=" ";else if(isFinite(a))switch(n[10]){case"e":var c=(u=a.toExponential(t)).length;"e"===u[c-3|0]&&(u=u.slice(0,c-1|0)+"0"+u.slice(c-1|0));break;case"f":u=a.toFixed(t);break;case"g":var i=0!==t?t:1,o=(u=a.toExponential(i-1|0)).indexOf("e"),s=0|Number(u.slice(o+1|0));if(s<-4||a>=1e21||a.toFixed().length>i){for(var f=o-1|0;"0"===u[f];)f=f-1|0;"."===u[f]&&(f=f-1|0);var v=(u=u.slice(0,f+1|0)+u.slice(o)).length;"e"===u[v-3|0]&&(u=u.slice(0,v-1|0)+"0"+u.slice(v-1|0))}else{var h=i;if(s<0)u=a.toFixed(h=h-(s+1|0)|0);else for(;(u=a.toFixed(h)).length>(i+1|0);)h=h-1|0;if(0!==h){for(var l=u.length-1|0;"0"===u[l];)l=l-1|0;"."===u[l]&&(l=l-1|0),u=u.slice(0,l+1|0)}}}else u="inf",n[2]=" ";return L(n,u)}(function(r,e){if(15===r)return"%.12g";var n=rr(e),t=function(r){switch(r){case 0:case 1:case 2:return 102;case 3:case 4:case 5:return 101;case 6:case 7:case 8:return 69;case 9:case 10:case 11:return 103;case 12:case 13:case 14:return 71;case 15:return 70}}(r),a=[0,b(16)];return mr(a,37),function(r,e){switch(e){case 1:case 4:case 7:case 10:case 13:return mr(r,43);case 2:case 5:case 8:case 11:case 14:mr(r,32)}}(a,r),mr(a,46),gr(a,String(n)),mr(a,t),wr(a)}(r,rr(e)),n);if(15!==r)return t;var a=t.length,u=function(r){return isFinite(r)?Math.abs(r)>=2.2250738585072014e-308?0:0!==r?1:2:isNaN(r)?4:3}(n);return 3!==u?u>=4?"nan":function(r){for(;;){var e=r;if(e===a)return!1;var n=K(t,e)-46|0;if(n>23||n<0){if(55!==n){r=e+1|0;continue}return!0}if(n>22||n<1)return!0;r=e+1|0}}(0)?t:t+".":n<0?"neg_infinity":"infinity"}function Tr(r){return cr(function(r){var e=0;if(r>=40){if(92===r)return"\\\\";e=r>=127?1:2}else if(r>=32){if(r>=39)return"\\'";e=2}else if(r>=14)e=1;else switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 11:case 12:e=1;break;case 13:return"\\r"}switch(e){case 1:var n=[0,0,0,0];return n[0]=92,n[1]=48+(r/100|0)|0,n[2]=48+(r/10|0)%10|0,n[3]=48+r%10|0,g(n);case 2:var t=[0];return t[0]=r,g(t)}}(r),["'",["'",0]])}function Jr(r){var e=[0,b(16)];return function r(e,n){for(;;){var t=n;if("number"==typeof t)return 0;switch(0|t.tag){case 0:gr(e,"%c"),n=t[0];continue;case 1:gr(e,"%s"),n=t[0];continue;case 2:gr(e,"%i"),n=t[0];continue;case 3:gr(e,"%li"),n=t[0];continue;case 4:gr(e,"%ni"),n=t[0];continue;case 5:gr(e,"%Li"),n=t[0];continue;case 6:gr(e,"%f"),n=t[0];continue;case 7:gr(e,"%B"),n=t[0];continue;case 8:gr(e,"%{"),r(e,t[0]),gr(e,"%}"),n=t[1];continue;case 9:gr(e,"%("),r(e,t[0]),gr(e,"%)"),n=t[2];continue;case 10:gr(e,"%a"),n=t[0];continue;case 11:gr(e,"%t"),n=t[0];continue;case 12:gr(e,"%?"),n=t[0];continue;case 13:gr(e,"%r"),n=t[0];continue;case 14:gr(e,"%_r"),n=t[0];continue}}}(e,r),wr(e)}function Or(r,e,n,t){for(;;){var a=t,u=n,i=r;if("number"==typeof a)return l(i,e,u);switch(0|a.tag){case 0:return function(r,n,t){return function(a){var u=c(5,[n,a]);return Or(r,e,u,t)}}(i,u,a[0]);case 1:return function(r,n,t){return function(a){var u=Tr(a),i=c(4,[n,u]);return Or(r,e,i,t)}}(i,u,a[0]);case 2:return $r(i,e,u,a[1],a[0],function(r){return r});case 3:return $r(i,e,u,a[1],a[0],Er);case 4:return zr(i,e,u,a[3],a[1],a[2],Rr,a[0]);case 5:return zr(i,e,u,a[3],a[1],a[2],Br,a[0]);case 6:return zr(i,e,u,a[3],a[1],a[2],qr,a[0]);case 7:return zr(i,e,u,a[3],a[1],a[2],Ir,a[0]);case 8:var o=i,f=e,v=u,b=a[3],m=a[1],g=a[2],w=a[0];if("number"==typeof m)return"number"==typeof g?0!==g?function(r,e,n,t,a){return function(u,i){var o=Mr(a,u,i);return Or(r,e,c(4,[n,o]),t)}}(o,f,v,b,w):function(r,e,n,t,a){return function(u){var i=Mr(a,6,u);return Or(r,e,c(4,[n,i]),t)}}(o,f,v,b,w):function(r,e,n,t,a,u){return function(i){var o=Mr(a,u,i);return Or(r,e,c(4,[n,o]),t)}}(o,f,v,b,w,g[0]);if(m.tag){var p=m[0];return"number"==typeof g?0!==g?function(r,e,n,t,a,u){return function(i,o,s){var f=jr(u,i,Mr(a,o,s));return Or(r,e,c(4,[n,f]),t)}}(o,f,v,b,w,p):function(r,e,n,t,a,u){return function(i,o){var s=Mr(a,6,o),f=jr(u,i,s);return Or(r,e,c(4,[n,f]),t)}}(o,f,v,b,w,p):function(r,e,n,t,a,u,i){return function(o,s){var f=jr(u,o,Mr(a,i,s));return Or(r,e,c(4,[n,f]),t)}}(o,f,v,b,w,p,g[0])}var k=m[1],d=m[0];return"number"==typeof g?0!==g?function(r,e,n,t,a,u,i){return function(o,s){var f=jr(u,i,Mr(a,o,s));return Or(r,e,c(4,[n,f]),t)}}(o,f,v,b,w,d,k):function(r,e,n,t,a,u,i){return function(o){var s=Mr(a,6,o),f=jr(u,i,s);return Or(r,e,c(4,[n,f]),t)}}(o,f,v,b,w,d,k):function(r,e,n,t,a,u,i,o){return function(s){var f=jr(u,i,Mr(a,o,s));return Or(r,e,c(4,[n,f]),t)}}(o,f,v,b,w,d,k,g[0]);case 9:return function(r,n,t){return function(a){return Or(r,e,c(4,[n,a?"true":"false"]),t)}}(i,u,a[0]);case 10:t=a[0],n=c(7,[u]);continue;case 11:t=a[1],n=c(2,[u,a[0]]);continue;case 12:t=a[1],n=c(3,[u,a[0]]);continue;case 13:return function(r,n,t,a){return function(u){return Or(r,e,c(4,[n,a]),t)}}(i,u,a[2],Jr(a[1]));case 14:return function(r,n,t,a){return function(u){return Or(r,e,n,Y(Sr(u[0],t),a))}}(i,u,a[1],a[2]);case 15:return function(r,n,t){return function(a,u){return Or(r,e,c(6,[n,function(r){return l(a,r,u)}]),t)}}(i,u,a[0]);case 16:return function(r,n,t){return function(a){return Or(r,e,c(6,[n,a]),t)}}(i,u,a[0]);case 17:t=a[1],n=c(0,[u,a[0]]);continue;case 18:var y=a[0];if(y.tag){var C=function(r,e,n){return function(t,a){return Or(r,t,c(1,[e,c(1,[a])]),n)}}(i,u,a[1]);t=y[0][0],n=0,r=C;continue}var F=function(r,e,n){return function(t,a){return Or(r,t,c(1,[e,c(0,[a])]),n)}}(i,u,a[1]);t=y[0][0],n=0,r=F;continue;case 19:throw[s,["camlinternalFormat.ml",1449,4]];case 20:return function(r,n,t){return function(a){return Or(r,e,t,n)}}(i,a[2],c(8,[u,"Printf: bad conversion %["]));case 21:return function(r,n,t){return function(a){var u=U("%u",a),i=c(4,[n,u]);return Or(r,e,i,t)}}(i,u,a[1]);case 22:return function(r,n,t){return function(a){var u=c(5,[n,a]);return Or(r,e,u,t)}}(i,u,a[0]);case 23:var A=i,x=e,_=u,S=a[0],j=a[1];if("number"==typeof S){if(3===S)throw[s,["camlinternalFormat.ml",1517,39]];return Xr(A,x,_,j)}return 8===S.tag?Dr(A,x,_,S[1],j):Xr(A,x,_,j);case 24:return Gr(i,e,u,a[2],a[0],h(a[1],0))}}}function Dr(r,e,n,t,a){if("number"==typeof t)return Xr(r,e,n,a);switch(0|t.tag){case 0:var u=t[0];return function(t){return Dr(r,e,n,u,a)};case 1:var i=t[0];return function(t){return Dr(r,e,n,i,a)};case 2:var o=t[0];return function(t){return Dr(r,e,n,o,a)};case 3:var f=t[0];return function(t){return Dr(r,e,n,f,a)};case 4:var v=t[0];return function(t){return Dr(r,e,n,v,a)};case 5:var h=t[0];return function(t){return Dr(r,e,n,h,a)};case 6:var l=t[0];return function(t){return Dr(r,e,n,l,a)};case 7:var b=t[0];return function(t){return Dr(r,e,n,b,a)};case 8:var m=t[1];return function(t){return Dr(r,e,n,m,a)};case 9:var g=t[2],w=yr(kr(t[0]),t[1]);return function(t){return Dr(r,e,n,function r(e,n){if("number"==typeof e)return n;switch(0|e.tag){case 0:return c(0,[r(e[0],n)]);case 1:return c(1,[r(e[0],n)]);case 2:return c(2,[r(e[0],n)]);case 3:return c(3,[r(e[0],n)]);case 4:return c(4,[r(e[0],n)]);case 5:return c(5,[r(e[0],n)]);case 6:return c(6,[r(e[0],n)]);case 7:return c(7,[r(e[0],n)]);case 8:return c(8,[e[0],r(e[1],n)]);case 9:return c(9,[e[0],e[1],r(e[2],n)]);case 10:return c(10,[r(e[0],n)]);case 11:return c(11,[r(e[0],n)]);case 12:return c(12,[r(e[0],n)]);case 13:return c(13,[r(e[0],n)]);case 14:return c(14,[r(e[0],n)])}}(w,g),a)};case 10:var p=t[0];return function(t,u){return Dr(r,e,n,p,a)};case 11:var k=t[0];return function(t){return Dr(r,e,n,k,a)};case 12:var d=t[0];return function(t){return Dr(r,e,n,d,a)};case 13:throw[s,["camlinternalFormat.ml",1540,31]];case 14:throw[s,["camlinternalFormat.ml",1541,31]]}}function Xr(r,e,n,t){return Or(r,e,c(8,[n,"Printf: bad conversion %_"]),t)}function $r(r,e,n,t,a,u){if("number"==typeof a)return function(a){var i=h(u,a),o=c(4,[n,i]);return Or(r,e,o,t)};if(a.tag){var i=a[0];return function(a,o){var s=jr(i,a,h(u,o)),f=c(4,[n,s]);return Or(r,e,f,t)}}var o=a[1],s=a[0];return function(a){var i=jr(s,o,h(u,a)),f=c(4,[n,i]);return Or(r,e,f,t)}}function zr(r,e,n,t,a,u,i,o){if("number"==typeof a){if("number"==typeof u)return 0!==u?function(a,u){var s=Nr(a,l(i,o,u));return Or(r,e,c(4,[n,s]),t)}:function(a){var u=l(i,o,a);return Or(r,e,c(4,[n,u]),t)};var s=u[0];return function(a){var u=Nr(s,l(i,o,a));return Or(r,e,c(4,[n,u]),t)}}if(a.tag){var f=a[0];if("number"==typeof u)return 0!==u?function(a,u,s){var v=jr(f,a,Nr(u,l(i,o,s)));return Or(r,e,c(4,[n,v]),t)}:function(a,u){var s=jr(f,a,l(i,o,u));return Or(r,e,c(4,[n,s]),t)};var v=u[0];return function(a,u){var s=jr(f,a,Nr(v,l(i,o,u)));return Or(r,e,c(4,[n,s]),t)}}var h=a[1],b=a[0];if("number"==typeof u)return 0!==u?function(a,u){var s=jr(b,h,Nr(a,l(i,o,u)));return Or(r,e,c(4,[n,s]),t)}:function(a){var u=jr(b,h,l(i,o,a));return Or(r,e,c(4,[n,u]),t)};var m=u[0];return function(a){var u=jr(b,h,Nr(m,l(i,o,a)));return Or(r,e,c(4,[n,u]),t)}}function Gr(r,e,n,t,a,u){if(a){var i=a[0];return function(a){return Gr(r,e,n,t,i,h(u,a))}}return Or(r,e,c(4,[n,u]),t)}function Lr(r){return e=function(r){return r},Or(function(r,n){var t,a,u=[t=b(64),0,64,t];return function r(e,n){for(;;){var t=n,a=0;if("number"==typeof t)return 0;switch(0|t.tag){case 0:var u=pr(t[1]);return r(e,t[0]),fr(e,u);case 1:var c=t[1];if(r(e,t[0]),c.tag){fr(e,"@["),n=c[0];continue}fr(e,"@{"),n=c[0];continue;case 2:case 4:a=1;break;case 3:case 5:a=2;break;case 6:return r(e,t[0]),fr(e,h(t[1],0));case 7:n=t[0];continue;case 8:throw r(e,t[0]),[i,t[1]]}switch(a){case 1:return r(e,t[0]),fr(e,t[1]);case 2:return r(e,t[0]),sr(e,t[1])}}}(u,n),h(e,tr((a=u)[0],0,a[1]))},0,0,r[0]);var e}function Ur(r){var e=typeof r;return"string"===e?c(0,[r]):"number"===e?c(1,[r]):"boolean"===e?!0===r?1:0:null===r?2:Array.isArray(r)?c(3,[r]):c(2,[r])}function Zr(r){if("string"==typeof r)return r}function Hr(r){return u.toNumber(r)}function Kr(r,e){return u.__fromString(r,e)}function Qr(r){return u.BigInt(r)}function Vr(r){return r.replace(/^0x/,"")}var Wr=/^0x[0-9a-fA-F]+$/;function Yr(r){return Wr.test(r)}var re=/^[0-9]+$/,ee=Qr(0);function ne(r){var e=Ur(r);if("number"==typeof e)return 0;switch(0|e.tag){case 0:var n=e[0];return Yr(n)?Hr(Kr(Vr(n),16)):re.test(n)?Hr(Kr(Vr(n),10)):0;case 1:return 0|e[0];default:return 0}}function te(r){var e=Zr(r);return void 0!==e?e:""}function ae(r){var e=Zr(r);return void 0!==e?e:""}var ue=[ne,ne,ne,function(r){var e=Ur(r);if("number"==typeof e)return ee;switch(0|e.tag){case 0:var n=e[0];return Yr(n)?Kr(Vr(n),16):ee;case 1:return u.BigInt(e[0]);default:return ee}},te,function(r){var e,n=Ur(r);return"number"==typeof n?[]:3===n.tag?function(r,e){for(var n=r.length,t=new Array(n),a=0,u=n-1|0;a<=u;++a)t[a]=e(r[a]);return t}(n[0],1===(e=te).length?e:function(r){return h(e,r)}):[]},ae,ae],ce=/^0x[0-9a-fA-F]{40}$/;function ie(r){return ce.test(r)}function oe(r){return"0x"+Qr(r).toString(16)}function se(r){return"0x"+r.toString(16)}var fe=[function(r){return r},function(r){return r},oe,se,function(r){return h(Lr([c(11,["0x",c(4,[6,0,0,0])]),"0x%x"]),r)},function(r){var e={};e.to=r.to;var n=r.value;void 0!==n&&(e.value=se(n));var t=r.from;void 0!==t&&(e.from=t);var a=r.data;void 0!==a&&(e.data=a);var u=r.gas;void 0!==u&&(e.gas=se(u));var c=r.gasPrice;void 0!==c&&(e.gasPrice=se(c));var i=r.nonce;return void 0!==i&&(e.nonce=oe(i)),e},function(r){if("number"!=typeof r)return h(Lr([c(11,["0x",c(4,[6,0,0,0])]),"0x%x"]),r[0]);switch(r){case 0:return"earliest";case 1:return"latest";case 2:return"pending"}}],ve={coinbase:function(r){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[ue[4](r[0])])},l(r,"eth_coinbase",[]))},accounts:function(r){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[ue[5](r[0])])},l(r,"eth_accounts",[]))},balanceOf:function(r,e,n,t){var u=void 0!==n?n:1;if(ie(e)){var i=[fe[0](e),fe[6](u)];return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[ue[3](r[0])])},l(r,"eth_getBalance",i))}return a.resolved(c(1,["Invalid Address: "+e]))},getTransactionCount:function(r,e,n,t){var u=void 0!==n?n:1;if(ie(e)){var i=[fe[0](e),fe[6](u)];return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[ue[1](r[0])])},l(r,"eth_getTransactionCount",i))}return a.resolved(c(1,["Invalid Address: "+e]))},blockNumber:function(r){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[ue[2](r[0])])},l(r,"eth_blockNumber",[]))},gasPrice:function(r){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[ue[3](r[0])])},l(r,"eth_gasPrice",[]))},sendTransaction:function(r,e,n){var t=[fe[5](e)];return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[ue[7](r[0])])},l(r,"eth_sendTransaction",t))},estimateGas:function(r,e,n,t){var u=void 0!==n?n:1,i=[fe[5](e),fe[6](u)];return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[ue[3](r[0])])},l(r,"eth_estimateGas",i))},call:function(r,e,n,t){var u=void 0!==n?n:1,i=[fe[5](e),fe[6](u)];return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[ue[7](r[0])])},l(r,"eth_call",i))},mineBlock:function(r){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[ue[6](r[0])])},l(r,"evm_mine",[]))}};function he(r,e){var n={jsonrpc:"2.0",id:1};return n.method=r,n.params=e,n}function le(r){var e=n.optional(n.at(["error",["message",0]],n.string),r);return void 0!==e?c(1,[e]):function(r){var e=Ur(r);if("number"==typeof e||2!==e.tag)return c(1,["Invalid response"]);var n=function(r,e){if(e in r)return hr(r[e])}(e[0],"result");return void 0!==n?c(0,[lr(n)]):c(1,["No result"])}(r)}require("isomorphic-fetch"),V("Providers-BsEth.JsonRpcError");var be={web3:function(r,e,n){var t=a.make(0),u=t[1];return r.sendAsync(he(e,n),function(r,e){return h(u,null==e?c(1,null==r?["Something went wrong"]:[r]):le(e))}),t[0]},http:function(r,e,n){return a.map(function(r){return r.tag?c(1,[r[0]]):le(r[0])},function(r,e){return a.Rejectable[7](function(r){return a.Rejectable[2](c(1,["Error"]))},a.Rejectable[5](function(r){return c(0,[r])},a.Rejectable[4](function(r){return a.Rejectable[10](r.json())},a.Rejectable[10](fetch(r,t.RequestInit[0](2,{"Content-Type":"application/json"},hr(JSON.stringify(e)),void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)(0))))))}(r,he(e,n)))}},me={bnZero:ee,Decode:ue,Encode:fe};r.Eth=ve,r.Providers=be,r.Formats=me}); | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jsbi"),require("@glennsl/bs-json/src/Json_decode.bs.js"),require("bs-fetch/src/Fetch.js"),require("@aantron/repromise/src/js/repromise.js")):"function"==typeof define&&define.amd?define(["exports","jsbi","@glennsl/bs-json/src/Json_decode.bs.js","bs-fetch/src/Fetch.js","@aantron/repromise/src/js/repromise.js"],e):e(r.bsEth={},r.jsbi,r.Json_decode,r.Fetch,r.Repromise)}(this,function(r,e,n,t,a){var u="default"in e?e.default:e;function c(r,e){return e.tag=r,e}var i=["Invalid_argument",-3],o=["Division_by_zero",-5],s=["Assert_failure",-10];function f(r,e,n){for(var t=new Array(n),a=0,u=e;a<n;)t[a]=r[u],a=a+1|0,u=u+1|0;return t}function v(r,e){for(;;){var n=e,t=r,a=t.length,u=0===a?1:a,c=u-n.length|0;if(0===c)return t.apply(null,n);if(!(c<0))return function(r,e){return function(n){return v(r,e.concat([n]))}}(t,n);e=f(n,u,0|-c),r=t.apply(null,f(n,0,u))}}function l(r,e){var n=r.length;return 1===n?r(e):function(r,e,n){switch(n){case 1:return r(e);case 2:return function(n){return r(e,n)};case 3:return function(n,t){return r(e,n,t)};case 4:return function(n,t,a){return r(e,n,t,a)};case 5:return function(n,t,a,u){return r(e,n,t,a,u)};case 6:return function(n,t,a,u,c){return r(e,n,t,a,u,c)};case 7:return function(n,t,a,u,c,i){return r(e,n,t,a,u,c,i)};default:return v(r,[e])}}(r,e,n)}function h(r,e,n){var t=r.length;return 2===t?r(e,n):function(r,e,n,t){switch(t){case 1:return v(r(e),[n]);case 2:return r(e,n);case 3:return function(t){return r(e,n,t)};case 4:return function(t,a){return r(e,n,t,a)};case 5:return function(t,a,u){return r(e,n,t,a,u)};case 6:return function(t,a,u,c){return r(e,n,t,a,u,c)};case 7:return function(t,a,u,c,i){return r(e,n,t,a,u,c,i)};default:return v(r,[e,n])}}(r,e,n,t)}function b(r){if(r<0)throw[i,"String.create"];for(var e=new Array(r),n=0,t=r-1|0;n<=t;++n)e[n]=0;return e}function g(r,e,n,t,a){if(a>0){if(r===n){var u=r,c=e,i=t,o=a;if(c<i){for(var s=(u.length-i|0)-1|0,f=o-1|0,v=s>f?f:s;v>=0;--v)u[i+v|0]=u[c+v|0];return 0}if(c>i){for(var l=(u.length-c|0)-1|0,h=o-1|0,b=l>h?h:l,g=0;g<=b;++g)u[i+g|0]=u[c+g|0];return 0}return 0}var m=r.length-e|0;if(a<=m){for(var d=0,w=a-1|0;d<=w;++d)n[t+d|0]=r[e+d|0];return 0}for(var p=0,k=m-1|0;p<=k;++p)n[t+p|0]=r[e+p|0];for(var y=m,C=a-1|0;y<=C;++y)n[t+y|0]=0;return 0}return 0}function m(r){var e=r,n=r.length,t="",a=n;if(n<=4096&&n===e.length)return String.fromCharCode.apply(null,e);for(var u=0;a>0;){var c=a<1024?a:1024,i=new Array(c);g(e,u,i,0,c),t+=String.fromCharCode.apply(null,i),a=a-c|0,u=u+c|0}return t}function d(r,e,n,t,a){if(a>0){var u=r.length-e|0;if(a<=u){for(var c=0,i=a-1|0;c<=i;++c)n[t+c|0]=r.charCodeAt(e+c|0);return 0}for(var o=0,s=u-1|0;o<=s;++o)n[t+o|0]=r.charCodeAt(e+o|0);for(var f=u,v=a-1|0;f<=v;++f)n[t+f|0]=0;return 0}return 0}function w(r,e){return r>e?r:e}function p(r,e){for(var n in r)e(n)}function k(r,e){return!function r(e,n){for(;;){var t=n,a=e;if(a===t)return!0;var u=typeof a;if("string"===u||"number"===u||"boolean"===u||"undefined"===u||null===a)return!1;var c=typeof t;if("function"===u||"function"===c)throw[i,"equal: functional value"];if("number"===c||"undefined"===c||null===t)return!1;var o=0|a.tag,s=0|t.tag;if(250!==o)if(250!==s){if(248===o)return a[1]===t[1];if(251===o)throw[i,"equal: abstract value"];if(o!==s)return!1;if(256===o)return a[1]===t[1];var f=0|a.length;if(f!==(0|t.length))return!1;if(!Array.isArray(a)){if(a instanceof Date&&t instanceof Date)return!(a>t||a<t);var v=a,l=t,h=[!0],b=function(r,e){return function(n){return r.hasOwnProperty(n)?0:(e[0]=!1,0)}}(l,h),g=function(e,n,t){return function(a){return e.hasOwnProperty(a)&&r(n[a],e[a])?0:(t[0]=!1,0)}}(v,l,h);return p(v,b),h[0]&&p(l,g),h[0]}for(var m=a,d=t,w=0,k=f;;){var y=w;if(y===k)return!0;if(!r(m[y],d[y]))return!1;w=y+1|0}}else n=t[0];else e=a[0]}}(r,e)}i.tag=248,o.tag=248,s.tag=248;var y=Math.imul||function(r,e){return((r>>16)*(e|=0)<<16)+(65535&r)*e|0};function C(r,e){if(e.repeat)return e.repeat(r);if(0==e.length||0==r)return"";if(e.length*r>=1<<28)throw new RangeError("repeat count must not overflow maximum string size");for(var n="";1==(1&r)&&(n+=e),0!=(r>>>=1);)e+=e;return n}var F=[-2147483648,0],x=[2147483647,1],A=[0,1],_=[0,0],S=[-1,4294967295];function j(r){return 0!=(2147483648&r)}function B(r,e){var n=e[1],t=r[1],a=t+n&4294967295,u=j(t)&&(j(n)||!j(a))||j(n)&&!j(a)?1:0;return[r[0]+e[0]+u&4294967295,a>>>0]}function N(r,e){return r[0]===e[0]&&r[1]===e[1]}function R(r){return N(r,F)?F:B([-1^(e=r)[0],(-1^e[1])>>>0],A);var e}function P(r,e){if(0===e)return r;var n=r[1];return e>=32?[n<<(e-32|0),0]:[n>>>(32-e|0)|r[0]<<e,n<<e>>>0]}function E(r,e){if(0===e)return r;var n=r[0];return e<32?[n>>e,(n<<(32-e|0)|r[1]>>>e)>>>0]:[n>=0?0:-1,n>>(e-32|0)>>>0]}function I(r,e){for(;;){var n,t=e,a=r,u=0,c=a[0],i=0;if(0===c&&0===a[1])return _;if(0===t[0]&&0===t[1])return _;if(-2147483648!==c||0!==a[1]?i=2:(n=t[1],u=1),2===i){var o=t[0],s=a[1],f=0;if(-2147483648!==o||0!==t[1]?f=3:(n=s,u=1),3===f){var v=t[1];if(c<0){if(o<0){e=R(t),r=R(a);continue}return R(I(R(a),t))}if(o<0)return R(I(a,R(t)));var l=65535&c,h=s>>>16,b=65535&s,g=65535&o,m=v>>>16,d=65535&v,w=0,p=0,k=0,y=b*d;return w=(p=(p=(k=(y>>>16)+h*d)>>>16)+((k=(65535&k)+b*m)>>>16)+l*d)>>>16,w+=(p=(65535&p)+h*m)>>>16,w+=(p=(65535&p)+b*g)>>>16,[(p&=65535)|(w=w+((c>>>16)*d+l*m+h*g+b*(o>>>16))&65535)<<16,(65535&y|(65535&k)<<16)>>>0]}}if(1===u)return 0==(1&n)?_:F}}function H(r,e){var n=e[0],t=r[0];return t>n||!(t<n)&&r[1]>=e[1]}function T(r,e){return!N(r,e)}function q(r,e){return!H(r,e)}function M(r,e){return r[0]>e[0]||!(r[0]<e[0])&&r[1]>e[1]}function D(r){return 4294967296*r[0]+r[1]}function J(r){return isNaN(r)||!isFinite(r)?_:r<=-0x8000000000000000?F:r+1>=0x8000000000000000?x:r<0?R(J(-r)):[r/4294967296|0,(r%4294967296|0)>>>0]}function O(r,e){var n=function r(e,n){for(;;){var t=n,a=e,u=a[0],c=0;if(0===t[0]&&0===t[1])throw o;if(-2147483648!==u){if(0===u&&0===a[1])return _;c=1}else{if(0===a[1]){if(N(t,A)||N(t,S))return a;if(N(t,F))return A;var i=t[0],s=P(r(E(a,1),t),1);if(0===s[0]&&0===s[1])return i<0?A:R(A);var f=B(a,R(I(t,s)));return B(s,r(f,t))}c=1}if(1===c){var v=t[0];if(-2147483648===v&&0===t[1])return _;if(u<0){if(v<0){n=R(t),e=R(a);continue}return R(r(R(a),t))}if(v<0)return R(r(a,R(t)));for(var l=_,h=a;H(h,t);){for(var b=w(1,Math.floor(D(h)/D(t))),g=Math.ceil(Math.log(b)/Math.LN2),m=g<=48?1:Math.pow(2,g-48),d=J(b),p=I(d,t);p[0]<0||M(p,h);)p=I(d=J(b-=m),t);0===(k=d)[0]&&0===k[1]&&(d=A),l=B(l,d),h=B(h,R(p))}return l}}var k}(r,e);return[n,B(r,R(I(n,e)))]}function U(r){return[2147483647&r[0],r[1]]}function X(r){return r>=65&&r<=90||r>=192&&r<=214||r>=216&&r<=222?r+32|0:r}function z(r){var e=r.length;if(e>31)throw[i,"format_int: format too long"];for(var n=["+","-"," ",!1,2,!1,0,!1,1,-1,"f"],t=0;;){var a=t;if(a>=e)return n;var u=r.charCodeAt(a),c=0;if(u>=69)if(u>=88)if(u>=121)c=1;else switch(u-88|0){case 0:n[4]=1,n[7]=!0,t=a+1|0;continue;case 13:case 14:case 15:c=5;break;case 12:case 17:c=4;break;case 23:n[4]=0,t=a+1|0;continue;case 29:n[4]=2,t=a+1|0;continue;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 16:case 18:case 19:case 20:case 21:case 22:case 24:case 25:case 26:case 27:case 28:case 30:case 31:c=1;break;case 32:n[4]=1,t=a+1|0;continue}else{if(!(u>=72)){n[5]=!0,n[7]=!0,n[10]=String.fromCharCode(X(u)),t=a+1|0;continue}c=1}else switch(u){case 35:n[3]=!0,t=a+1|0;continue;case 32:case 43:c=2;break;case 45:n[0]="-",t=a+1|0;continue;case 46:n[9]=0;for(var o=a+1|0;function(e){return function(){var n=r.charCodeAt(e)-48|0;return n>=0&&n<=9}}(o)();)n[9]=(y(n[9],10)+r.charCodeAt(o)|0)-48|0,o=o+1|0;t=o;continue;case 33:case 34:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 44:case 47:c=1;break;case 48:n[2]="0",t=a+1|0;continue;case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:c=3;break;default:c=1}switch(c){case 1:t=a+1|0;continue;case 2:n[1]=String.fromCharCode(u),t=a+1|0;continue;case 3:n[6]=0;for(var s=a;function(e){return function(){var n=r.charCodeAt(e)-48|0;return n>=0&&n<=9}}(s)();)n[6]=(y(n[6],10)+r.charCodeAt(s)|0)-48|0,s=s+1|0;t=s;continue;case 4:n[5]=!0,n[4]=2,t=a+1|0;continue;case 5:n[5]=!0,n[10]=String.fromCharCode(u),t=a+1|0;continue}}}function G(r,e){var n=r[0],t=r[1],a=r[2],u=r[3],c=r[4],i=r[5],o=r[6],s=r[7],f=r[8],v=e.length;i&&(f<0||"-"!==t)&&(v=v+1|0),u&&(0===c?v=v+1|0:1===c&&(v=v+2|0));var l="";if("+"===n&&" "===a)for(var h=v,b=o-1|0;h<=b;++h)l+=a;if(i&&(f<0?l+="-":"-"!==t&&(l+=t)),u&&0===c&&(l+="0"),u&&1===c&&(l+="0x"),"+"===n&&"0"===a)for(var g=v,m=o-1|0;g<=m;++g)l+=a;if(l=s?l+e.toUpperCase():l+e,"-"===n)for(var d=v,w=o-1|0;d<=w;++d)l+=" ";return l}function L(r,e){if("%d"===r)return String(e);var n=z(r),t=e,a=(t<0?n[5]?(n[8]=-1,-t):t>>>0:t).toString(function(r){switch(n[4]){case 0:return 8;case 1:return 16;case 2:return 10}}());if(n[9]>=0){n[2]=" ";var u=n[9]-a.length|0;u>0&&(a=C(u,"0")+a)}return G(n,a)}var $=L,V=L;function Z(r,e){if(e<0||e>=r.length)throw[i,"index out of bounds"];return r.charCodeAt(e)}var K=[0];function Q(r){var e=[r,(K[0]+=1,K[0])];return e.tag=248,e}function W(r){if("number"==typeof r)return 0;switch(0|r.tag){case 0:return c(0,[W(r[0])]);case 1:return c(1,[W(r[0])]);case 2:return c(2,[W(r[0])]);case 3:return c(3,[W(r[0])]);case 4:return c(4,[W(r[0])]);case 5:return c(5,[W(r[0])]);case 6:return c(6,[W(r[0])]);case 7:return c(7,[W(r[0])]);case 8:return c(8,[r[0],W(r[1])]);case 9:var e=r[0];return c(9,[e,e,W(r[2])]);case 10:return c(10,[W(r[0])]);case 11:return c(11,[W(r[0])]);case 12:return c(12,[W(r[0])]);case 13:return c(13,[W(r[0])]);case 14:return c(14,[W(r[0])])}}function Y(r,e){if("number"==typeof r)return e;switch(0|r.tag){case 0:return c(0,[Y(r[0],e)]);case 1:return c(1,[Y(r[0],e)]);case 2:return c(2,[r[0],Y(r[1],e)]);case 3:return c(3,[r[0],Y(r[1],e)]);case 4:return c(4,[r[0],r[1],r[2],Y(r[3],e)]);case 5:return c(5,[r[0],r[1],r[2],Y(r[3],e)]);case 6:return c(6,[r[0],r[1],r[2],Y(r[3],e)]);case 7:return c(7,[r[0],r[1],r[2],Y(r[3],e)]);case 8:return c(8,[r[0],r[1],r[2],Y(r[3],e)]);case 9:return c(9,[Y(r[0],e)]);case 10:return c(10,[Y(r[0],e)]);case 11:return c(11,[r[0],Y(r[1],e)]);case 12:return c(12,[r[0],Y(r[1],e)]);case 13:return c(13,[r[0],r[1],Y(r[2],e)]);case 14:return c(14,[r[0],r[1],Y(r[2],e)]);case 15:return c(15,[Y(r[0],e)]);case 16:return c(16,[Y(r[0],e)]);case 17:return c(17,[r[0],Y(r[1],e)]);case 18:return c(18,[r[0],Y(r[1],e)]);case 19:return c(19,[Y(r[0],e)]);case 20:return c(20,[r[0],r[1],Y(r[2],e)]);case 21:return c(21,[r[0],Y(r[1],e)]);case 22:return c(22,[Y(r[0],e)]);case 23:return c(23,[r[0],Y(r[1],e)]);case 24:return c(24,[r[0],r[1],Y(r[2],e)])}}function rr(r){return r>=0?r:0|-r}function er(r,e){for(;;){var n=e;if(!n)return 0;l(r,n[0]),e=n[1]}}function nr(r,e){var n=b(r);return function(e,n,t,a){if(r>0)for(var u=0,c=(r+0|0)-1|0;u<=c;++u)e[u]=a}(n,0,0,e),n}function tr(r,e,n){return m(function(r,e,n){if(e<0||n<0||e>(r.length-n|0))throw[i,"String.sub / Bytes.sub"];var t=b(n);return g(r,e,t,0,n),t}(r,e,n))}function ar(r,e,n,t,a){if(a<0||e<0||e>(r.length-a|0)||t<0||t>(n.length-a|0))throw[i,"Bytes.blit"];return g(r,e,n,t,a)}function ur(r,e,n,t,a){if(a<0||e<0||e>(r.length-a|0)||t<0||t>(n.length-a|0))throw[i,"String.blit / Bytes.blit_string"];return d(r,e,n,t,a)}function cr(r,e){if(e){var n=e[0],t=[0],a=[0];er(function(r){return t[0]=t[0]+1|0,a[0]=a[0]+r.length|0,0},e);var u=b(a[0]+y(r.length,t[0]-1|0)|0);d(n,0,u,0,n.length);var c=[n.length];return er(function(e){return d(r,0,u,c[0],r.length),c[0]=c[0]+r.length|0,d(e,0,u,c[0],e.length),c[0]=c[0]+e.length|0,0},e[1]),m(u)}return""}Q("Pervasives.Exit");var ir=ur;function or(r,e){for(var n=r[2];(r[1]+e|0)>n;)n<<=1;var t=b(n);return ar(r[0],0,t,0,r[1]),r[0]=t,r[2]=n,0}function sr(r,e){var n=r[1];return n>=r[2]&&or(r,1),r[0][n]=e,r[1]=n+1|0,0}function fr(r,e){var n=e.length,t=r[1]+n|0;return t>r[2]&&or(r,n),ur(e,0,r[0],r[1],n),r[1]=t,0}var vr=[];function lr(r){if(void 0===r){var e=[vr,0];return e.tag=256,e}if(null!==r&&r[0]===vr){var n=[vr,r[1]+1|0];return n.tag=256,n}return r}function hr(r){if(null!==r&&r[0]===vr){var e=r[1];return 0===e?void 0:[vr,e-1|0]}return r}function br(r,e){var n,t,a=r[1].length,u=r[0]+e|0;if(u>a){var c=b((n=a<<1)>(t=u)?n:t);return ar(r[1],0,c,0,a),r[1]=c,0}return 0}function gr(r,e){return br(r,1),r[1][r[0]]=e,r[0]=r[0]+1|0,0}function mr(r,e){var n=e.length;return br(r,n),ir(e,0,r[1],r[0],n),r[0]=r[0]+n|0,0}function dr(r){return tr(r[1],0,r[0])}function wr(r){if("number"==typeof r)switch(r){case 0:return"@]";case 1:return"@}";case 2:return"@?";case 3:return"@\n";case 4:return"@.";case 5:return"@@";case 6:return"@%"}else switch(0|r.tag){case 0:case 1:return r[0];case 2:return"@"+m(nr(1,r[0]))}}function pr(r){if("number"==typeof r)return 0;switch(0|r.tag){case 0:return c(0,[pr(r[0])]);case 1:return c(1,[pr(r[0])]);case 2:return c(2,[pr(r[0])]);case 3:return c(3,[pr(r[0])]);case 4:return c(4,[pr(r[0])]);case 5:return c(5,[pr(r[0])]);case 6:return c(6,[pr(r[0])]);case 7:return c(7,[pr(r[0])]);case 8:return c(8,[r[0],pr(r[1])]);case 9:return c(9,[r[1],r[0],pr(r[2])]);case 10:return c(10,[pr(r[0])]);case 11:return c(11,[pr(r[0])]);case 12:return c(12,[pr(r[0])]);case 13:return c(13,[pr(r[0])]);case 14:return c(14,[pr(r[0])])}}function kr(r){if("number"==typeof r)return[function(r){return 0},function(r){return 0},function(r){return 0},function(r){return 0}];switch(0|r.tag){case 0:var e=kr(r[0]),n=e[1],t=e[0];return[function(r){return l(t,0),0},function(r){return l(n,0),0},e[2],e[3]];case 1:var a=kr(r[0]),u=a[1],c=a[0];return[function(r){return l(c,0),0},function(r){return l(u,0),0},a[2],a[3]];case 2:var i=kr(r[0]),o=i[1],s=i[0];return[function(r){return l(s,0),0},function(r){return l(o,0),0},i[2],i[3]];case 3:var f=kr(r[0]),v=f[1],h=f[0];return[function(r){return l(h,0),0},function(r){return l(v,0),0},f[2],f[3]];case 4:var b=kr(r[0]),g=b[1],m=b[0];return[function(r){return l(m,0),0},function(r){return l(g,0),0},b[2],b[3]];case 5:var d=kr(r[0]),w=d[1],p=d[0];return[function(r){return l(p,0),0},function(r){return l(w,0),0},d[2],d[3]];case 6:var k=kr(r[0]),y=k[1],C=k[0];return[function(r){return l(C,0),0},function(r){return l(y,0),0},k[2],k[3]];case 7:var F=kr(r[0]),x=F[1],A=F[0];return[function(r){return l(A,0),0},function(r){return l(x,0),0},F[2],F[3]];case 8:var _=kr(r[1]),S=_[1],j=_[0];return[function(r){return l(j,0),0},function(r){return l(S,0),0},_[2],_[3]];case 9:var B=kr(r[2]),N=B[3],R=B[2],P=B[1],E=B[0],I=kr(yr(pr(r[0]),r[1])),H=I[3],T=I[2],q=I[1],M=I[0];return[function(r){return l(E,0),l(M,0),0},function(r){return l(q,0),l(P,0),0},function(r){return l(R,0),l(T,0),0},function(r){return l(H,0),l(N,0),0}];case 10:var D=kr(r[0]),J=D[1],O=D[0];return[function(r){return l(O,0),0},function(r){return l(J,0),0},D[2],D[3]];case 11:var U=kr(r[0]),X=U[1],z=U[0];return[function(r){return l(z,0),0},function(r){return l(X,0),0},U[2],U[3]];case 12:var G=kr(r[0]),L=G[1],$=G[0];return[function(r){return l($,0),0},function(r){return l(L,0),0},G[2],G[3]];case 13:var V=kr(r[0]),Z=V[3],K=V[2],Q=V[1],W=V[0];return[function(r){return l(W,0),0},function(r){return l(Q,0),0},function(r){return l(K,0),0},function(r){return l(Z,0),0}];case 14:var Y=kr(r[0]),rr=Y[3],er=Y[2],nr=Y[1],tr=Y[0];return[function(r){return l(tr,0),0},function(r){return l(nr,0),0},function(r){return l(er,0),0},function(r){return l(rr,0),0}]}}function yr(r,e){var n=0;if("number"==typeof r){if("number"==typeof e)return 0;switch(0|e.tag){case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5;break;default:throw[s,["camlinternalFormat.ml",816,23]]}}else switch(0|r.tag){case 0:if("number"==typeof e)n=8;else switch(0|e.tag){case 0:return c(0,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 1:if("number"==typeof e)n=8;else switch(0|e.tag){case 1:return c(1,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 2:if("number"==typeof e)n=8;else switch(0|e.tag){case 2:return c(2,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 3:if("number"==typeof e)n=8;else switch(0|e.tag){case 3:return c(3,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 4:if("number"==typeof e)n=8;else switch(0|e.tag){case 4:return c(4,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 5:if("number"==typeof e)n=8;else switch(0|e.tag){case 5:return c(5,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 6:if("number"==typeof e)n=8;else switch(0|e.tag){case 6:return c(6,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 7:if("number"==typeof e)n=8;else switch(0|e.tag){case 7:return c(7,[yr(r[0],e[0])]);case 8:n=6;break;case 9:n=7;break;case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5}break;case 8:if("number"==typeof e)throw[s,["camlinternalFormat.ml",802,26]];switch(0|e.tag){case 8:return c(8,[yr(r[0],e[0]),yr(r[1],e[1])]);case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5;break;default:throw[s,["camlinternalFormat.ml",802,26]]}break;case 9:if("number"==typeof e)throw[s,["camlinternalFormat.ml",812,28]];switch(0|e.tag){case 8:n=6;break;case 9:var t=kr(yr(pr(r[1]),e[0]));return l(t[1],0),l(t[3],0),c(9,[r[0],e[1],yr(r[2],e[2])]);case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:n=5;break;default:throw[s,["camlinternalFormat.ml",812,28]]}break;case 10:if("number"==typeof e)throw[s,["camlinternalFormat.ml",780,21]];if(10===e.tag)return c(10,[yr(r[0],e[0])]);throw[s,["camlinternalFormat.ml",780,21]];case 11:if("number"==typeof e)throw[s,["camlinternalFormat.ml",784,21]];switch(0|e.tag){case 10:n=1;break;case 11:return c(11,[yr(r[0],e[0])]);default:throw[s,["camlinternalFormat.ml",784,21]]}break;case 12:if("number"==typeof e)throw[s,["camlinternalFormat.ml",788,19]];switch(0|e.tag){case 10:n=1;break;case 11:n=2;break;case 12:return c(12,[yr(r[0],e[0])]);default:throw[s,["camlinternalFormat.ml",788,19]]}break;case 13:if("number"==typeof e)throw[s,["camlinternalFormat.ml",792,22]];switch(0|e.tag){case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:return c(13,[yr(r[0],e[0])]);default:throw[s,["camlinternalFormat.ml",792,22]]}break;case 14:if("number"==typeof e)throw[s,["camlinternalFormat.ml",797,30]];switch(0|e.tag){case 10:n=1;break;case 11:n=2;break;case 12:n=3;break;case 13:n=4;break;case 14:return c(14,[yr(r[0],e[0])]);default:throw[s,["camlinternalFormat.ml",797,30]]}}switch(n){case 1:throw[s,["camlinternalFormat.ml",781,21]];case 2:throw[s,["camlinternalFormat.ml",785,21]];case 3:throw[s,["camlinternalFormat.ml",789,19]];case 4:throw[s,["camlinternalFormat.ml",793,22]];case 5:throw[s,["camlinternalFormat.ml",798,30]];case 6:throw[s,["camlinternalFormat.ml",803,26]];case 7:throw[s,["camlinternalFormat.ml",813,28]];case 8:throw[s,["camlinternalFormat.ml",817,23]]}}Q("Caml_js_exceptions.Error");var Cr=Q("CamlinternalFormat.Type_mismatch");function Fr(r,e){if("number"==typeof r)return[0,e];if(r.tag){if("number"==typeof e)throw Cr;if(2===e.tag)return[c(1,[r[0]]),e[0]];throw Cr}return[c(0,[r[0],r[1]]),e]}function xr(r,e,n){var t=Fr(r,n);if("number"==typeof e){if(0!==e){var a=t[1];if("number"==typeof a)throw Cr;if(2===a.tag)return[t[0],1,a[0]];throw Cr}return[t[0],0,t[1]]}return[t[0],[e[0]],t[1]]}function Ar(r,e,n){var t=_r(e,n);return[c(23,[r,t[0]]),t[1]]}function _r(r,e){if("number"==typeof r)return[0,e];switch(0|r.tag){case 0:if("number"==typeof e)throw Cr;if(e.tag)throw Cr;var n=_r(r[0],e[0]);return[c(0,[n[0]]),n[1]];case 1:if("number"==typeof e)throw Cr;if(e.tag)throw Cr;var t=_r(r[0],e[0]);return[c(1,[t[0]]),t[1]];case 2:var a=Fr(r[0],e),u=a[1];if("number"==typeof u)throw Cr;if(1===u.tag){var i=_r(r[1],u[0]);return[c(2,[a[0],i[0]]),i[1]]}throw Cr;case 3:var o=Fr(r[0],e),s=o[1];if("number"==typeof s)throw Cr;if(1===s.tag){var f=_r(r[1],s[0]);return[c(3,[o[0],f[0]]),f[1]]}throw Cr;case 4:var v=xr(r[1],r[2],e),h=v[2];if("number"==typeof h)throw Cr;if(2===h.tag){var b=_r(r[3],h[0]);return[c(4,[r[0],v[0],v[1],b[0]]),b[1]]}throw Cr;case 5:var g=xr(r[1],r[2],e),m=g[2];if("number"==typeof m)throw Cr;if(3===m.tag){var d=_r(r[3],m[0]);return[c(5,[r[0],g[0],g[1],d[0]]),d[1]]}throw Cr;case 6:var w=xr(r[1],r[2],e),p=w[2];if("number"==typeof p)throw Cr;if(4===p.tag){var y=_r(r[3],p[0]);return[c(6,[r[0],w[0],w[1],y[0]]),y[1]]}throw Cr;case 7:var C=xr(r[1],r[2],e),F=C[2];if("number"==typeof F)throw Cr;if(5===F.tag){var x=_r(r[3],F[0]);return[c(7,[r[0],C[0],C[1],x[0]]),x[1]]}throw Cr;case 8:var A=xr(r[1],r[2],e),_=A[2];if("number"==typeof _)throw Cr;if(6===_.tag){var S=_r(r[3],_[0]);return[c(8,[r[0],A[0],A[1],S[0]]),S[1]]}throw Cr;case 9:if("number"==typeof e)throw Cr;if(7===e.tag){var j=_r(r[0],e[0]);return[c(9,[j[0]]),j[1]]}throw Cr;case 10:var B=_r(r[0],e);return[c(10,[B[0]]),B[1]];case 11:var N=_r(r[1],e);return[c(11,[r[0],N[0]]),N[1]];case 12:var R=_r(r[1],e);return[c(12,[r[0],R[0]]),R[1]];case 13:if("number"==typeof e)throw Cr;if(8===e.tag){var P=e[0];if(k([r[1]],[P]))throw Cr;var E=_r(r[2],e[1]);return[c(13,[r[0],P,E[0]]),E[1]]}throw Cr;case 14:if("number"==typeof e)throw Cr;if(9===e.tag){var I=e[0];if(k([W(r[1])],[W(I)]))throw Cr;var H=_r(r[2],W(e[2]));return[c(14,[r[0],I,H[0]]),H[1]]}throw Cr;case 15:if("number"==typeof e)throw Cr;if(10===e.tag){var T=_r(r[0],e[0]);return[c(15,[T[0]]),T[1]]}throw Cr;case 16:if("number"==typeof e)throw Cr;if(11===e.tag){var q=_r(r[0],e[0]);return[c(16,[q[0]]),q[1]]}throw Cr;case 17:var M=_r(r[1],e);return[c(17,[r[0],M[0]]),M[1]];case 18:var D=r[0],J=r[1],O=e;if(D.tag){var U=D[0],X=_r(U[0],O),z=_r(J,X[1]);return[c(18,[c(1,[[X[0],U[1]]]),z[0]]),z[1]]}var G=D[0],L=_r(G[0],O),$=_r(J,L[1]);return[c(18,[c(0,[[L[0],G[1]]]),$[0]]),$[1]];case 19:if("number"==typeof e)throw Cr;if(13===e.tag){var V=_r(r[0],e[0]);return[c(19,[V[0]]),V[1]]}throw Cr;case 20:if("number"==typeof e)throw Cr;if(1===e.tag){var Z=_r(r[2],e[0]);return[c(20,[r[0],r[1],Z[0]]),Z[1]]}throw Cr;case 21:if("number"==typeof e)throw Cr;if(2===e.tag){var K=_r(r[1],e[0]);return[c(21,[r[0],K[0]]),K[1]]}throw Cr;case 23:var Q=r[0],Y=r[1],rr=e;if("number"==typeof Q){if(3===Q){if("number"==typeof rr)throw Cr;if(14===rr.tag){var er=_r(Y,rr[0]);return[c(23,[3,er[0]]),er[1]]}throw Cr}return Ar(Q,Y,rr)}switch(0|Q.tag){case 7:return Ar(c(7,[Q[0],Q[1]]),Y,rr);case 8:var nr=function r(e,n,t){if("number"==typeof e)return[0,_r(n,t)];switch(0|e.tag){case 0:if("number"==typeof t)throw Cr;if(t.tag)throw Cr;var a=r(e[0],n,t[0]);return[c(0,[a[0]]),a[1]];case 1:if("number"==typeof t)throw Cr;if(1===t.tag){var u=r(e[0],n,t[0]);return[c(1,[u[0]]),u[1]]}throw Cr;case 2:if("number"==typeof t)throw Cr;if(2===t.tag){var i=r(e[0],n,t[0]);return[c(2,[i[0]]),i[1]]}throw Cr;case 3:if("number"==typeof t)throw Cr;if(3===t.tag){var o=r(e[0],n,t[0]);return[c(3,[o[0]]),o[1]]}throw Cr;case 4:if("number"==typeof t)throw Cr;if(4===t.tag){var s=r(e[0],n,t[0]);return[c(4,[s[0]]),s[1]]}throw Cr;case 5:if("number"==typeof t)throw Cr;if(5===t.tag){var f=r(e[0],n,t[0]);return[c(5,[f[0]]),f[1]]}throw Cr;case 6:if("number"==typeof t)throw Cr;if(6===t.tag){var v=r(e[0],n,t[0]);return[c(6,[v[0]]),v[1]]}throw Cr;case 7:if("number"==typeof t)throw Cr;if(7===t.tag){var h=r(e[0],n,t[0]);return[c(7,[h[0]]),h[1]]}throw Cr;case 8:if("number"==typeof t)throw Cr;if(8===t.tag){var b=t[0];if(k([e[0]],[b]))throw Cr;var g=r(e[1],n,t[1]);return[c(8,[b,g[0]]),g[1]]}throw Cr;case 9:if("number"==typeof t)throw Cr;if(9===t.tag){var m=t[1],d=t[0];if(k([W(e[0])],[W(d)]))throw Cr;if(k([W(e[1])],[W(m)]))throw Cr;var w=kr(yr(pr(d),m));l(w[1],0),l(w[3],0);var p=r(W(e[2]),n,t[2]);return[c(9,[d,m,pr(p[0])]),p[1]]}throw Cr;case 10:if("number"==typeof t)throw Cr;if(10===t.tag){var y=r(e[0],n,t[0]);return[c(10,[y[0]]),y[1]]}throw Cr;case 11:if("number"==typeof t)throw Cr;if(11===t.tag){var C=r(e[0],n,t[0]);return[c(11,[C[0]]),C[1]]}throw Cr;case 12:throw Cr;case 13:if("number"==typeof t)throw Cr;if(13===t.tag){var F=r(e[0],n,t[0]);return[c(13,[F[0]]),F[1]]}throw Cr;case 14:if("number"==typeof t)throw Cr;if(14===t.tag){var x=r(e[0],n,t[0]);return[c(14,[x[0]]),x[1]]}throw Cr}}(Q[1],Y,rr),tr=nr[1];return[c(23,[c(8,[Q[0],nr[0]]),tr[0]]),tr[1]];default:return Ar(Q,Y,rr)}case 22:case 24:throw Cr}}function Sr(r,e){return function(r,e){var n=_r(r,e);if("number"==typeof n[1])return n[0];throw Cr}(r,W(pr(e)))}function jr(r,e,n){var t=n.length,a=rr(e),u=e<0?0:r;if(a<=t)return n;var c=nr(a,2===u?48:32);switch(u){case 0:ir(n,0,c,0,t);break;case 1:ir(n,0,c,a-t|0,t);break;case 2:t>0&&(43===Z(n,0)||45===Z(n,0)||32===Z(n,0))?(c[0]=Z(n,0),ir(n,1,c,1+(a-t|0)|0,t-1|0)):t>1&&48===Z(n,0)&&(120===Z(n,1)||88===Z(n,1))?(c[1]=Z(n,1),ir(n,2,c,2+(a-t|0)|0,t-2|0)):ir(n,0,c,a-t|0,t)}return m(c)}function Br(r,e){var n=rr(r),t=e.length,a=Z(e,0),u=0;if(a>=58)if(a>=71){if(a>102||a<97)return e;u=2}else{if(!(a>=65))return e;u=2}else if(32!==a){if(!(a>=43))return e;switch(a-43|0){case 0:case 2:u=1;break;case 1:case 3:case 4:return e;case 5:if((n+2|0)>t&&t>1&&(120===Z(e,1)||88===Z(e,1))){var c=nr(n+2|0,48);return c[1]=Z(e,1),ir(e,2,c,4+(n-t|0)|0,t-2|0),m(c)}u=2;break;case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:u=2}}else u=1;switch(u){case 1:if((n+1|0)>t){var i=nr(n+1|0,48);return i[0]=a,ir(e,1,i,2+(n-t|0)|0,t-1|0),m(i)}return e;case 2:if(n>t){var o=nr(n,48);return ir(e,0,o,n-t|0,t),m(o)}return e}}function Nr(r){return cr((e=r,function(r){for(;;){var n=r;if(n>=e.length)return!1;var t=e.charCodeAt(n);if(!(t>=32))return!0;var a=t-34|0;if(a>58||a<0){if(a>=93)return!0;r=n+1|0}else{if(a>57||a<1)return!0;r=n+1|0}}}(0)?m(function(r){for(var e=0,n=0,t=r.length-1|0;n<=t;++n){var a,u=r[n];if(u>=32){var c=u-34|0;a=c>58||c<0?c>=93?4:1:c>57||c<1?2:1}else a=u>=11?13!==u?4:2:u>=8?2:4;e=e+a|0}if(e===r.length)return function(r){var e=r.length,n=b(e);return g(r,0,n,0,e),n}(r);var i=b(e);e=0;for(var o=0,s=r.length-1|0;o<=s;++o){var f=r[o],v=0;if(f>=35)92!==f?f>=127?v=1:i[e]=f:v=2;else if(f>=32)f>=34?v=2:i[e]=f;else if(f>=14)v=1;else switch(f){case 8:i[e]=92,i[e=e+1|0]=98;break;case 9:i[e]=92,i[e=e+1|0]=116;break;case 10:i[e]=92,i[e=e+1|0]=110;break;case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 11:case 12:v=1;break;case 13:i[e]=92,i[e=e+1|0]=114}switch(v){case 1:i[e]=92,i[e=e+1|0]=48+(f/100|0)|0,i[e=e+1|0]=48+(f/10|0)%10|0,i[e=e+1|0]=48+f%10|0;break;case 2:i[e]=92,i[e=e+1|0]=f}e=e+1|0}return i}(function(r){for(var e=r.length,n=new Array(e),t=0,a=e-1|0;t<=a;++t)n[t]=r.charCodeAt(t);return n}(e))):e),['"',['"',0]]);var e}function Rr(r,e){var n;switch(r){case 0:n=["%",["d",0]];break;case 1:n=["%+",["d",0]];break;case 2:n=["% ",["d",0]];break;case 3:n=["%",["i",0]];break;case 4:n=["%+",["i",0]];break;case 5:n=["% ",["i",0]];break;case 6:n=["%",["x",0]];break;case 7:n=["%#",["x",0]];break;case 8:n=["%",["X",0]];break;case 9:n=["%#",["X",0]];break;case 10:n=["%",["o",0]];break;case 11:n=["%#",["o",0]];break;case 12:n=["%",["u",0]]}return cr(m(nr(1,e)),n)}function Pr(r,e){return L(function(r){switch(r){case 0:return"%d";case 1:return"%+d";case 2:return"% d";case 3:return"%i";case 4:return"%+i";case 5:return"% i";case 6:return"%x";case 7:return"%#x";case 8:return"%X";case 9:return"%#X";case 10:return"%o";case 11:return"%#o";case 12:return"%u"}}(r),e)}function Er(r,e){return V(Rr(r,108),e)}function Ir(r,e){return $(Rr(r,110),e)}function Hr(r,e){return function(r,e){var n=z(r),t=n[5]&&q(e,[0,0])?(n[8]=-1,R(e)):e,a="";switch(n[4]){case 0:var u=[0,8],c="01234567";if(q(t,[0,0])){var i=O(U(t),u),o=B([268435456,0],i[0]),s=i[1];for(a=String.fromCharCode(c.charCodeAt(0|s[1]))+a;T(o,[0,0]);){var f=O(o,u);o=f[0],s=f[1],a=String.fromCharCode(c.charCodeAt(0|s[1]))+a}}else{var v=O(t,u),l=v[0],h=v[1];for(a=String.fromCharCode(c.charCodeAt(0|h[1]))+a;T(l,[0,0]);){var b=O(l,u);l=b[0],h=b[1],a=String.fromCharCode(c.charCodeAt(0|h[1]))+a}}break;case 1:a=function(r){var e=t[1],n=t[0],a=function(r){return(r>>>0).toString(16)};if(0===n&&0===e)return"0";if(0!==e){if(0!==n){var u=a(e),c=8-u.length|0;return c<=0?a(n)+u:a(n)+(C(c,"0")+u)}return a(e)}return a(n)+"00000000"}()+a;break;case 2:var g=[0,10];if(q(t,[0,0])){var m=O(U(t),g),d=O(B([0,8],m[1]),g),w=B(B([214748364,3435973836],m[0]),d[0]),p=d[1];for(a=String.fromCharCode("0123456789".charCodeAt(0|p[1]))+a;T(w,[0,0]);){var k=O(w,g);w=k[0],p=k[1],a=String.fromCharCode("0123456789".charCodeAt(0|p[1]))+a}}else{var y=O(t,g),F=y[0],x=y[1];for(a=String.fromCharCode("0123456789".charCodeAt(0|x[1]))+a;T(F,[0,0]);){var A=O(F,g);F=A[0],x=A[1],a=String.fromCharCode("0123456789".charCodeAt(0|x[1]))+a}}}if(n[9]>=0){n[2]=" ";var _=n[9]-a.length|0;_>0&&(a=C(_,"0")+a)}return G(n,a)}(Rr(r,76),e)}function Tr(r,e,n){var t=function(r,e){var n=z(r),t=n[9]<0?6:n[9],a=e<0?(n[8]=-1,-e):e,u="";if(isNaN(a))u="nan",n[2]=" ";else if(isFinite(a))switch(n[10]){case"e":var c=(u=a.toExponential(t)).length;"e"===u[c-3|0]&&(u=u.slice(0,c-1|0)+"0"+u.slice(c-1|0));break;case"f":u=a.toFixed(t);break;case"g":var i=0!==t?t:1,o=(u=a.toExponential(i-1|0)).indexOf("e"),s=0|Number(u.slice(o+1|0));if(s<-4||a>=1e21||a.toFixed().length>i){for(var f=o-1|0;"0"===u[f];)f=f-1|0;"."===u[f]&&(f=f-1|0);var v=(u=u.slice(0,f+1|0)+u.slice(o)).length;"e"===u[v-3|0]&&(u=u.slice(0,v-1|0)+"0"+u.slice(v-1|0))}else{var l=i;if(s<0)u=a.toFixed(l=l-(s+1|0)|0);else for(;(u=a.toFixed(l)).length>(i+1|0);)l=l-1|0;if(0!==l){for(var h=u.length-1|0;"0"===u[h];)h=h-1|0;"."===u[h]&&(h=h-1|0),u=u.slice(0,h+1|0)}}}else u="inf",n[2]=" ";return G(n,u)}(function(r,e){if(15===r)return"%.12g";var n=rr(e),t=function(r){switch(r){case 0:case 1:case 2:return 102;case 3:case 4:case 5:return 101;case 6:case 7:case 8:return 69;case 9:case 10:case 11:return 103;case 12:case 13:case 14:return 71;case 15:return 70}}(r),a=[0,b(16)];return gr(a,37),function(r,e){switch(e){case 1:case 4:case 7:case 10:case 13:return gr(r,43);case 2:case 5:case 8:case 11:case 14:gr(r,32)}}(a,r),gr(a,46),mr(a,String(n)),gr(a,t),dr(a)}(r,rr(e)),n);if(15!==r)return t;var a=t.length,u=function(r){return isFinite(r)?Math.abs(r)>=2.2250738585072014e-308?0:0!==r?1:2:isNaN(r)?4:3}(n);return 3!==u?u>=4?"nan":function(r){for(;;){var e=r;if(e===a)return!1;var n=Z(t,e)-46|0;if(n>23||n<0){if(55!==n){r=e+1|0;continue}return!0}if(n>22||n<1)return!0;r=e+1|0}}(0)?t:t+".":n<0?"neg_infinity":"infinity"}function qr(r){return cr(function(r){var e=0;if(r>=40){if(92===r)return"\\\\";e=r>=127?1:2}else if(r>=32){if(r>=39)return"\\'";e=2}else if(r>=14)e=1;else switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 11:case 12:e=1;break;case 13:return"\\r"}switch(e){case 1:var n=[0,0,0,0];return n[0]=92,n[1]=48+(r/100|0)|0,n[2]=48+(r/10|0)%10|0,n[3]=48+r%10|0,m(n);case 2:var t=[0];return t[0]=r,m(t)}}(r),["'",["'",0]])}function Mr(r){var e=[0,b(16)];return function r(e,n){for(;;){var t=n;if("number"==typeof t)return 0;switch(0|t.tag){case 0:mr(e,"%c"),n=t[0];continue;case 1:mr(e,"%s"),n=t[0];continue;case 2:mr(e,"%i"),n=t[0];continue;case 3:mr(e,"%li"),n=t[0];continue;case 4:mr(e,"%ni"),n=t[0];continue;case 5:mr(e,"%Li"),n=t[0];continue;case 6:mr(e,"%f"),n=t[0];continue;case 7:mr(e,"%B"),n=t[0];continue;case 8:mr(e,"%{"),r(e,t[0]),mr(e,"%}"),n=t[1];continue;case 9:mr(e,"%("),r(e,t[0]),mr(e,"%)"),n=t[2];continue;case 10:mr(e,"%a"),n=t[0];continue;case 11:mr(e,"%t"),n=t[0];continue;case 12:mr(e,"%?"),n=t[0];continue;case 13:mr(e,"%r"),n=t[0];continue;case 14:mr(e,"%_r"),n=t[0];continue}}}(e,r),dr(e)}function Dr(r,e,n,t){for(;;){var a=t,u=n,i=r;if("number"==typeof a)return h(i,e,u);switch(0|a.tag){case 0:return function(r,n,t){return function(a){var u=c(5,[n,a]);return Dr(r,e,u,t)}}(i,u,a[0]);case 1:return function(r,n,t){return function(a){var u=qr(a),i=c(4,[n,u]);return Dr(r,e,i,t)}}(i,u,a[0]);case 2:return Ur(i,e,u,a[1],a[0],function(r){return r});case 3:return Ur(i,e,u,a[1],a[0],Nr);case 4:return Xr(i,e,u,a[3],a[1],a[2],Pr,a[0]);case 5:return Xr(i,e,u,a[3],a[1],a[2],Er,a[0]);case 6:return Xr(i,e,u,a[3],a[1],a[2],Ir,a[0]);case 7:return Xr(i,e,u,a[3],a[1],a[2],Hr,a[0]);case 8:var o=i,f=e,v=u,b=a[3],g=a[1],m=a[2],d=a[0];if("number"==typeof g)return"number"==typeof m?0!==m?function(r,e,n,t,a){return function(u,i){var o=Tr(a,u,i);return Dr(r,e,c(4,[n,o]),t)}}(o,f,v,b,d):function(r,e,n,t,a){return function(u){var i=Tr(a,6,u);return Dr(r,e,c(4,[n,i]),t)}}(o,f,v,b,d):function(r,e,n,t,a,u){return function(i){var o=Tr(a,u,i);return Dr(r,e,c(4,[n,o]),t)}}(o,f,v,b,d,m[0]);if(g.tag){var w=g[0];return"number"==typeof m?0!==m?function(r,e,n,t,a,u){return function(i,o,s){var f=jr(u,i,Tr(a,o,s));return Dr(r,e,c(4,[n,f]),t)}}(o,f,v,b,d,w):function(r,e,n,t,a,u){return function(i,o){var s=Tr(a,6,o),f=jr(u,i,s);return Dr(r,e,c(4,[n,f]),t)}}(o,f,v,b,d,w):function(r,e,n,t,a,u,i){return function(o,s){var f=jr(u,o,Tr(a,i,s));return Dr(r,e,c(4,[n,f]),t)}}(o,f,v,b,d,w,m[0])}var p=g[1],k=g[0];return"number"==typeof m?0!==m?function(r,e,n,t,a,u,i){return function(o,s){var f=jr(u,i,Tr(a,o,s));return Dr(r,e,c(4,[n,f]),t)}}(o,f,v,b,d,k,p):function(r,e,n,t,a,u,i){return function(o){var s=Tr(a,6,o),f=jr(u,i,s);return Dr(r,e,c(4,[n,f]),t)}}(o,f,v,b,d,k,p):function(r,e,n,t,a,u,i,o){return function(s){var f=jr(u,i,Tr(a,o,s));return Dr(r,e,c(4,[n,f]),t)}}(o,f,v,b,d,k,p,m[0]);case 9:return function(r,n,t){return function(a){return Dr(r,e,c(4,[n,a?"true":"false"]),t)}}(i,u,a[0]);case 10:t=a[0],n=c(7,[u]);continue;case 11:t=a[1],n=c(2,[u,a[0]]);continue;case 12:t=a[1],n=c(3,[u,a[0]]);continue;case 13:return function(r,n,t,a){return function(u){return Dr(r,e,c(4,[n,a]),t)}}(i,u,a[2],Mr(a[1]));case 14:return function(r,n,t,a){return function(u){return Dr(r,e,n,Y(Sr(u[0],t),a))}}(i,u,a[1],a[2]);case 15:return function(r,n,t){return function(a,u){return Dr(r,e,c(6,[n,function(r){return h(a,r,u)}]),t)}}(i,u,a[0]);case 16:return function(r,n,t){return function(a){return Dr(r,e,c(6,[n,a]),t)}}(i,u,a[0]);case 17:t=a[1],n=c(0,[u,a[0]]);continue;case 18:var y=a[0];if(y.tag){var C=function(r,e,n){return function(t,a){return Dr(r,t,c(1,[e,c(1,[a])]),n)}}(i,u,a[1]);t=y[0][0],n=0,r=C;continue}var F=function(r,e,n){return function(t,a){return Dr(r,t,c(1,[e,c(0,[a])]),n)}}(i,u,a[1]);t=y[0][0],n=0,r=F;continue;case 19:throw[s,["camlinternalFormat.ml",1449,4]];case 20:return function(r,n,t){return function(a){return Dr(r,e,t,n)}}(i,a[2],c(8,[u,"Printf: bad conversion %["]));case 21:return function(r,n,t){return function(a){var u=L("%u",a),i=c(4,[n,u]);return Dr(r,e,i,t)}}(i,u,a[1]);case 22:return function(r,n,t){return function(a){var u=c(5,[n,a]);return Dr(r,e,u,t)}}(i,u,a[0]);case 23:var x=i,A=e,_=u,S=a[0],j=a[1];if("number"==typeof S){if(3===S)throw[s,["camlinternalFormat.ml",1517,39]];return Or(x,A,_,j)}return 8===S.tag?Jr(x,A,_,S[1],j):Or(x,A,_,j);case 24:return zr(i,e,u,a[2],a[0],l(a[1],0))}}}function Jr(r,e,n,t,a){if("number"==typeof t)return Or(r,e,n,a);switch(0|t.tag){case 0:var u=t[0];return function(t){return Jr(r,e,n,u,a)};case 1:var i=t[0];return function(t){return Jr(r,e,n,i,a)};case 2:var o=t[0];return function(t){return Jr(r,e,n,o,a)};case 3:var f=t[0];return function(t){return Jr(r,e,n,f,a)};case 4:var v=t[0];return function(t){return Jr(r,e,n,v,a)};case 5:var l=t[0];return function(t){return Jr(r,e,n,l,a)};case 6:var h=t[0];return function(t){return Jr(r,e,n,h,a)};case 7:var b=t[0];return function(t){return Jr(r,e,n,b,a)};case 8:var g=t[1];return function(t){return Jr(r,e,n,g,a)};case 9:var m=t[2],d=yr(pr(t[0]),t[1]);return function(t){return Jr(r,e,n,function r(e,n){if("number"==typeof e)return n;switch(0|e.tag){case 0:return c(0,[r(e[0],n)]);case 1:return c(1,[r(e[0],n)]);case 2:return c(2,[r(e[0],n)]);case 3:return c(3,[r(e[0],n)]);case 4:return c(4,[r(e[0],n)]);case 5:return c(5,[r(e[0],n)]);case 6:return c(6,[r(e[0],n)]);case 7:return c(7,[r(e[0],n)]);case 8:return c(8,[e[0],r(e[1],n)]);case 9:return c(9,[e[0],e[1],r(e[2],n)]);case 10:return c(10,[r(e[0],n)]);case 11:return c(11,[r(e[0],n)]);case 12:return c(12,[r(e[0],n)]);case 13:return c(13,[r(e[0],n)]);case 14:return c(14,[r(e[0],n)])}}(d,m),a)};case 10:var w=t[0];return function(t,u){return Jr(r,e,n,w,a)};case 11:var p=t[0];return function(t){return Jr(r,e,n,p,a)};case 12:var k=t[0];return function(t){return Jr(r,e,n,k,a)};case 13:throw[s,["camlinternalFormat.ml",1540,31]];case 14:throw[s,["camlinternalFormat.ml",1541,31]]}}function Or(r,e,n,t){return Dr(r,e,c(8,[n,"Printf: bad conversion %_"]),t)}function Ur(r,e,n,t,a,u){if("number"==typeof a)return function(a){var i=l(u,a),o=c(4,[n,i]);return Dr(r,e,o,t)};if(a.tag){var i=a[0];return function(a,o){var s=jr(i,a,l(u,o)),f=c(4,[n,s]);return Dr(r,e,f,t)}}var o=a[1],s=a[0];return function(a){var i=jr(s,o,l(u,a)),f=c(4,[n,i]);return Dr(r,e,f,t)}}function Xr(r,e,n,t,a,u,i,o){if("number"==typeof a){if("number"==typeof u)return 0!==u?function(a,u){var s=Br(a,h(i,o,u));return Dr(r,e,c(4,[n,s]),t)}:function(a){var u=h(i,o,a);return Dr(r,e,c(4,[n,u]),t)};var s=u[0];return function(a){var u=Br(s,h(i,o,a));return Dr(r,e,c(4,[n,u]),t)}}if(a.tag){var f=a[0];if("number"==typeof u)return 0!==u?function(a,u,s){var v=jr(f,a,Br(u,h(i,o,s)));return Dr(r,e,c(4,[n,v]),t)}:function(a,u){var s=jr(f,a,h(i,o,u));return Dr(r,e,c(4,[n,s]),t)};var v=u[0];return function(a,u){var s=jr(f,a,Br(v,h(i,o,u)));return Dr(r,e,c(4,[n,s]),t)}}var l=a[1],b=a[0];if("number"==typeof u)return 0!==u?function(a,u){var s=jr(b,l,Br(a,h(i,o,u)));return Dr(r,e,c(4,[n,s]),t)}:function(a){var u=jr(b,l,h(i,o,a));return Dr(r,e,c(4,[n,u]),t)};var g=u[0];return function(a){var u=jr(b,l,Br(g,h(i,o,a)));return Dr(r,e,c(4,[n,u]),t)}}function zr(r,e,n,t,a,u){if(a){var i=a[0];return function(a){return zr(r,e,n,t,i,l(u,a))}}return Dr(r,e,c(4,[n,u]),t)}function Gr(r){return e=function(r){return r},Dr(function(r,n){var t,a,u=[t=b(64),0,64,t];return function r(e,n){for(;;){var t=n,a=0;if("number"==typeof t)return 0;switch(0|t.tag){case 0:var u=wr(t[1]);return r(e,t[0]),fr(e,u);case 1:var c=t[1];if(r(e,t[0]),c.tag){fr(e,"@["),n=c[0];continue}fr(e,"@{"),n=c[0];continue;case 2:case 4:a=1;break;case 3:case 5:a=2;break;case 6:return r(e,t[0]),fr(e,l(t[1],0));case 7:n=t[0];continue;case 8:throw r(e,t[0]),[i,t[1]]}switch(a){case 1:return r(e,t[0]),fr(e,t[1]);case 2:return r(e,t[0]),sr(e,t[1])}}}(u,n),l(e,tr((a=u)[0],0,a[1]))},0,0,r[0]);var e}function Lr(r){var e=typeof r;return"string"===e?c(0,[r]):"number"===e?c(1,[r]):"boolean"===e?!0===r?1:0:null===r?2:Array.isArray(r)?c(3,[r]):c(2,[r])}function $r(r){if("string"==typeof r)return r}function Vr(r){return u.toNumber(r)}function Zr(r,e){return u.__fromString(r,e)}function Kr(r){return u.BigInt(r)}function Qr(r){return r.replace(/^0x/,"")}var Wr=/^0x[0-9a-fA-F]+$/;function Yr(r){return Wr.test(r)}var re=/^[0-9]+$/,ee=Kr(0);function ne(r){return"0x1"===r?2:3}function te(r){var e=n.field("logIndex",n.string,r),t=n.field("blockNumber",n.string,r),a=n.field("transactionIndex",n.string,r);return[n.field("removed",n.bool,r),Vr(Zr(Qr(e),16)),n.field("transactionHash",n.string,r),n.field("blockHash",n.string,r),Vr(Zr(Qr(t),16)),Vr(Zr(Qr(a),16)),n.field("address",n.string,r),n.field("data",n.string,r),n.field("topics",function(r){return n.array(n.string,r)},r)]}function ae(r){var e=n.optional(function(r){return n.field("blockNumber",n.string,r)},r),t=n.optional(function(r){return n.field("transactionIndex",n.string,r)},r),a=n.field("gas",n.string,r),u=n.field("gasPrice",n.string,r),c=n.field("value",n.string,r),i=n.field("nonce",n.string,r);return[n.field("hash",n.string,r),n.optional(function(r){return n.field("blockHash",n.string,r)},r),void 0!==e?Vr(Zr(Qr(e),16)):void 0,void 0!==t?Vr(Zr(Qr(t),16)):void 0,n.field("to",n.string,r),n.field("from",n.string,r),Vr(Zr(Qr(a),16)),Zr(Qr(u),16),Zr(Qr(c),16),n.field("input",n.string,r),Vr(Zr(Qr(i),16))]}function ue(r){var e=Lr(r);if("number"==typeof e)return 0;switch(0|e.tag){case 0:return c(0,[e[0]]);case 2:return c(1,[ae(r)]);default:return 0}}function ce(r){var e=Lr(r);if("number"==typeof e)return 0;switch(0|e.tag){case 0:var n=e[0];return Yr(n)?Vr(Zr(Qr(n),16)):re.test(n)?Vr(Zr(Qr(n),10)):0;case 1:return 0|e[0];default:return 0}}function ie(r){var e=$r(r);return void 0!==e?e:""}function oe(r){var e=$r(r);return void 0!==e?e:""}var se=[ce,ce,ce,function(r){var e=Lr(r);if("number"==typeof e)return ee;switch(0|e.tag){case 0:var n=e[0];return Yr(n)?Zr(Qr(n),16):ee;case 1:return u.BigInt(e[0]);default:return ee}},ie,function(r){var e,n=Lr(r);return"number"==typeof n?[]:3===n.tag?function(r,e){for(var n=r.length,t=new Array(n),a=0,u=n-1|0;a<=u;++a)t[a]=e(r[a]);return t}(n[0],1===(e=ie).length?e:function(r){return l(e,r)}):[]},oe,oe,ae,function(r){var e=n.field("blockNumber",n.string,r),t=n.field("transactionIndex",n.string,r),a=n.field("gasUsed",n.string,r),u=n.field("cumulativeGasUsed",n.string,r);return[n.field("transactionHash",n.string,r),n.field("blockHash",n.string,r),Vr(Zr(Qr(e),16)),Vr(Zr(Qr(t),16)),n.field("to",n.string,r),n.field("from",n.string,r),Vr(Zr(Qr(a),16)),Vr(Zr(Qr(u),16)),n.optional(function(r){return n.field("contractAddress",n.string,r)},r),n.field("logs",function(r){return n.array(te,r)},r),ne(n.field("status",n.string,r))]},function(r){var e=n.field("number",n.string,r),t=n.field("difficulty",n.string,r),a=n.field("totalDifficulty",n.string,r),u=n.field("size",n.string,r),c=n.field("gasLimit",n.string,r),i=n.field("gasUsed",n.string,r),o=n.field("timestamp",n.string,r);return[Vr(Zr(Qr(e),16)),n.field("hash",n.string,r),n.optional(function(r){return n.field("parentHash",n.string,r)},r),n.field("nonce",n.string,r),n.field("sha3Uncles",n.string,r),n.field("logsBloom",n.string,r),n.field("transactionsRoot",n.string,r),n.field("stateRoot",n.string,r),n.field("receiptsRoot",n.string,r),n.field("miner",n.string,r),Vr(Zr(Qr(t),16)),Vr(Zr(Qr(a),16)),n.field("extraData",n.string,r),Vr(Zr(Qr(u),16)),Vr(Zr(Qr(c),16)),Vr(Zr(Qr(i),16)),Vr(Zr(Qr(o),16)),n.field("transactions",function(r){return n.array(ue,r)},r),n.field("uncles",function(r){return n.array(n.string,r)},r)]},function(r){var e=Lr(r);return"number"==typeof e&&1===e}],fe=/^0x[0-9a-fA-F]{40}$/;function ve(r){return fe.test(r)}function le(r){return"0x"+Kr(r).toString(16)}function he(r){return"0x"+r.toString(16)}var be=[function(r){return r},function(r){return r},le,he,function(r){return l(Gr([c(11,["0x",c(4,[6,0,0,0])]),"0x%x"]),r)},function(r){return r},function(r){var e={};e.to=r.to;var n=r.value;void 0!==n&&(e.value=he(n));var t=r.from;void 0!==t&&(e.from=t);var a=r.data;void 0!==a&&(e.data=a);var u=r.gas;void 0!==u&&(e.gas=le(u));var c=r.gasPrice;void 0!==c&&(e.gasPrice=he(c));var i=r.nonce;return void 0!==i&&(e.nonce=le(i)),e},function(r){if("number"!=typeof r)return l(Gr([c(11,["0x",c(4,[6,0,0,0])]),"0x%x"]),r[0]);switch(r){case 0:return"earliest";case 1:return"latest";case 2:return"pending"}}],ge={coinbase:function(r){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[4](r[0])])},h(r,"eth_coinbase",[]))},accounts:function(r){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[5](r[0])])},h(r,"eth_accounts",[]))},balanceOf:function(r,e,n,t){var u=void 0!==n?n:1;if(ve(e)){var i=[be[0](e),be[7](u)];return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[3](r[0])])},h(r,"eth_getBalance",i))}return a.resolved(c(1,["Invalid Address: "+e]))},transactionCount:function(r,e,n,t){var u=void 0!==n?n:1;if(ve(e)){var i=[be[0](e),be[7](u)];return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[1](r[0])])},h(r,"eth_getTransactionCount",i))}return a.resolved(c(1,["Invalid Address: "+e]))},blockNumber:function(r){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[2](r[0])])},h(r,"eth_blockNumber",[]))},gasPrice:function(r){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[3](r[0])])},h(r,"eth_gasPrice",[]))},sendTransaction:function(r,e){var n=[be[6](e)];return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[7](r[0])])},h(r,"eth_sendTransaction",n))},sendRawTransaction:function(r,e){var n=[be[1](e)];return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[7](r[0])])},h(r,"eth_sendRawTransaction",n))},transactionByHash:function(r,e){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[8](r[0])])},h(r,"eth_getTransactionByHash",[be[1](e)]))},transactionReceipt:function(r,e){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[9](r[0])])},h(r,"eth_getTransactionReceipt",[be[1](e)]))},estimateGas:function(r,e,n,t){var u=void 0!==n?n:1,i=[be[6](e),be[7](u)];return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[3](r[0])])},h(r,"eth_estimateGas",i))},call:function(r,e,n,t){var u=void 0!==n?n:1,i=[be[6](e),be[7](u)];return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[7](r[0])])},h(r,"eth_call",i))},mineBlock:function(r){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[6](r[0])])},h(r,"evm_mine",[]))},blockByHash:function(r,e,n){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[10](r[0])])},h(r,"eth_getBlockByHash",[be[1](e),be[5](n)]))},blockByNumber:function(r,e,n){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[10](r[0])])},h(r,"eth_getBlockByNumber",[be[2](e),be[5](n)]))},netVersion:function(r){return a.map(function(r){return r.tag?c(1,[r[0]]):c(0,[se[0](r[0])])},h(r,"net_version",[]))}};function me(r,e){var n={jsonrpc:"2.0",id:1};return n.method=r,n.params=e,n}function de(r){var e=n.optional(n.at(["error",["message",0]],n.string),r);return void 0!==e?c(1,[e]):function(r){var e=Lr(r);if("number"==typeof e||2!==e.tag)return c(1,["Invalid response"]);var n=function(r,e){if(e in r)return lr(r[e])}(e[0],"result");return void 0!==n?c(0,[hr(n)]):c(1,["No result"])}(r)}require("isomorphic-fetch"),Q("Providers-BsEth.JsonRpcError");var we={web3:function(r,e,n){var t=a.make(0),u=t[1];return r.sendAsync(me(e,n),function(r,e){return l(u,null==e?c(1,null==r?["Something went wrong"]:[r]):de(e))}),t[0]},http:function(r,e,n){return a.map(function(r){return r.tag?c(1,[r[0]]):de(r[0])},function(r,e){return a.Rejectable[7](function(r){return a.Rejectable[2](c(1,["Error"]))},a.Rejectable[5](function(r){return c(0,[r])},a.Rejectable[4](function(r){return a.Rejectable[10](r.json())},a.Rejectable[10](fetch(r,t.RequestInit[0](2,{"Content-Type":"application/json"},lr(JSON.stringify(e)),void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)(0))))))}(r,me(e,n)))}},pe={bnZero:ee,Decode:se,Encode:be};r.Eth=ge,r.Providers=we,r.Formats=pe}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "bs-eth", | ||
"description": "Web3 like library for ReasonML/Bucklescript", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"scripts": { | ||
@@ -6,0 +6,0 @@ "clean": "./node_modules/.bin/bsb -clean-world", |
@@ -9,2 +9,26 @@ # Really Basic ReasonML web3 like interface | ||
## Setting up a Provider | ||
There is currently support for the following providers that both live in the `Providers` namespace: | ||
- `Providers.web3(web3provider)` which wraps an existing web3 provider eg. MetaMask | ||
- `Providers.http(url)` which is configured with a url to a http based provider like [infura](https://infura.io) | ||
Once you have a provider you pass it as a parameter to all the functions in the `Eth` namespace. | ||
```reasonml | ||
let provider = Providers.http("https://mainnet.infura.io/bs-eth"); | ||
netVersion(provider) | ||
|> Repromise.wait(result => switch (result) { | ||
| Ok(netId) => Js.log("we are on the " ++ string_of_int(netId) ++ " chain") | ||
| Error(msg) => Js.log(msg) | ||
}); | ||
``` | ||
## Calling functions | ||
All functions in the `Eth` module return typed [`Belt.Result`](https://bucklescript.github.io/bucklescript/api/Belt.Result.html) in a [Repromise](https://aantron.github.io/repromise/). So instead of looking out for rejected calls, do a pattern match. | ||
See the [List of Methods](#ethereum-json-rpc-implemented-methods) implemented for more details. | ||
## Roadmap | ||
@@ -14,4 +38,4 @@ | ||
- [x] Wrap javascript Web3 provider (a la metamask) | ||
- [ ] Basic Documentation | ||
- [ ] Most common JSON-RPC methods implemented (In bold below) | ||
- [x] Most common JSON-RPC methods implemented (In bold below) | ||
- [x] Basic Documentation | ||
- [ ] Solidity ABI codec in native reasonml | ||
@@ -26,3 +50,2 @@ - [ ] Add support for WebSocket provider | ||
### Ethereum JSON-RPC Implemented Methods | ||
@@ -39,7 +62,7 @@ | ||
- [x] **`eth_getBalance` as `balanceOf()`** | ||
- [ ] **`eth_getBlockByNumber`** | ||
- [ ] **`eth_getBlockByHash`** | ||
- [x] **`eth_getBlockByNumber` as `blockByNumber`** | ||
- [x] **`eth_getBlockByHash` as `blockByHash`** | ||
- [ ] `eth_getBlockTransactionCountByHash` | ||
- [ ] `eth_getBlockTransactionCountByNumber` | ||
- [ ] `eth_getCode` (only supports block number “latest”) | ||
- [ ] `eth_getCode` | ||
- [ ] `eth_getCompilers` | ||
@@ -50,7 +73,7 @@ - [ ] `eth_getFilterChanges` | ||
- [ ] `eth_getStorageAt` | ||
- [ ] **`eth_getTransactionByHash`** | ||
- [x] **`eth_getTransactionByHash` as `transactionByHash()`** | ||
- [ ] `eth_getTransactionByBlockHashAndIndex` | ||
- [ ] `eth_getTransactionByBlockNumberAndIndex` | ||
- [ ] `eth_getTransactionCount` | ||
- [ ] **`eth_getTransactionReceipt`** | ||
- [x] **`eth_getTransactionCount` as `transactionCount()`** | ||
- [x] **`eth_getTransactionReceipt` as `transactionReceipt()** | ||
- [ ] `eth_hashrate` | ||
@@ -61,5 +84,4 @@ - [ ] `eth_mining` | ||
- [ ] `eth_protocolVersion` | ||
- [x] `eth_sendTransaction` as `sendTransaction()` | ||
- [ ] **`eth_sendRawTransaction`** | ||
- [ ] `eth_sign` | ||
- [x] **`eth_sendTransaction` as `sendTransaction()`** | ||
- [x] **`eth_sendRawTransaction` as `sendRawTransaction()`** | ||
- [ ] `eth_subscribe` (only for websocket connections. "syncing" subscriptions are not yet supported) | ||
@@ -71,7 +93,3 @@ - [ ] `eth_unsubscribe` (only for websocket connections. "syncing" subscriptions are not yet supported) | ||
- [ ] `net_peerCount` | ||
- [ ] `net_version` | ||
- [ ] `miner_start` | ||
- [ ] `miner_stop` | ||
- [ ] `rpc_modules` | ||
- [ ] **`web3_clientVersion`** | ||
- [x] **`net_version` as `netVersion()`** | ||
@@ -78,0 +96,0 @@ Non-Standard [ganache-cli](https://github.com/trufflesuite/ganache-cli) methods: |
@@ -33,3 +33,3 @@ // Generated by BUCKLESCRIPT VERSION 5.0.4, PLEASE EDIT WITH CARE | ||
Formats$BsEth.Encode[/* address */0](account), | ||
Formats$BsEth.Encode[/* blockOrTag */6](from) | ||
Formats$BsEth.Encode[/* blockOrTag */7](from) | ||
]; | ||
@@ -48,3 +48,3 @@ return Repromise.map((function (result) { | ||
function getTransactionCount(provider, account, $staropt$star, param) { | ||
function transactionCount(provider, account, $staropt$star, param) { | ||
var from = $staropt$star !== undefined ? $staropt$star : /* Latest */1; | ||
@@ -54,3 +54,3 @@ if (Formats$BsEth.validateAddress(account)) { | ||
Formats$BsEth.Encode[/* address */0](account), | ||
Formats$BsEth.Encode[/* blockOrTag */6](from) | ||
Formats$BsEth.Encode[/* blockOrTag */7](from) | ||
]; | ||
@@ -74,3 +74,3 @@ return Repromise.map((function (result) { | ||
} else { | ||
return /* Ok */Block.__(0, [Formats$BsEth.Decode[/* block */2](result[0])]); | ||
return /* Ok */Block.__(0, [Formats$BsEth.Decode[/* blockNumber */2](result[0])]); | ||
} | ||
@@ -90,4 +90,4 @@ }), Curry._2(provider, "eth_blockNumber", /* array */[])); | ||
function sendTransaction(provider, tx, param) { | ||
var params = /* array */[Formats$BsEth.Encode[/* transaction */5](tx)]; | ||
function sendTransaction(provider, tx) { | ||
var params = /* array */[Formats$BsEth.Encode[/* transaction */6](tx)]; | ||
return Repromise.map((function (result) { | ||
@@ -102,7 +102,38 @@ if (result.tag) { | ||
function sendRawTransaction(provider, tx) { | ||
var params = /* array */[Formats$BsEth.Encode[/* data */1](tx)]; | ||
return Repromise.map((function (result) { | ||
if (result.tag) { | ||
return /* Error */Block.__(1, [result[0]]); | ||
} else { | ||
return /* Ok */Block.__(0, [Formats$BsEth.Decode[/* data */7](result[0])]); | ||
} | ||
}), Curry._2(provider, "eth_sendRawTransaction", params)); | ||
} | ||
function transactionByHash(provider, txHash) { | ||
return Repromise.map((function (result) { | ||
if (result.tag) { | ||
return /* Error */Block.__(1, [result[0]]); | ||
} else { | ||
return /* Ok */Block.__(0, [Formats$BsEth.Decode[/* transaction */8](result[0])]); | ||
} | ||
}), Curry._2(provider, "eth_getTransactionByHash", /* array */[Formats$BsEth.Encode[/* data */1](txHash)])); | ||
} | ||
function transactionReceipt(provider, txHash) { | ||
return Repromise.map((function (result) { | ||
if (result.tag) { | ||
return /* Error */Block.__(1, [result[0]]); | ||
} else { | ||
return /* Ok */Block.__(0, [Formats$BsEth.Decode[/* receipt */9](result[0])]); | ||
} | ||
}), Curry._2(provider, "eth_getTransactionReceipt", /* array */[Formats$BsEth.Encode[/* data */1](txHash)])); | ||
} | ||
function estimateGas(provider, tx, $staropt$star, param) { | ||
var from = $staropt$star !== undefined ? $staropt$star : /* Latest */1; | ||
var params = /* array */[ | ||
Formats$BsEth.Encode[/* transaction */5](tx), | ||
Formats$BsEth.Encode[/* blockOrTag */6](from) | ||
Formats$BsEth.Encode[/* transaction */6](tx), | ||
Formats$BsEth.Encode[/* blockOrTag */7](from) | ||
]; | ||
@@ -121,4 +152,4 @@ return Repromise.map((function (result) { | ||
var params = /* array */[ | ||
Formats$BsEth.Encode[/* transaction */5](tx), | ||
Formats$BsEth.Encode[/* blockOrTag */6](from) | ||
Formats$BsEth.Encode[/* transaction */6](tx), | ||
Formats$BsEth.Encode[/* blockOrTag */7](from) | ||
]; | ||
@@ -144,2 +175,38 @@ return Repromise.map((function (result) { | ||
function blockByHash(provider, blockHash, deep) { | ||
return Repromise.map((function (result) { | ||
if (result.tag) { | ||
return /* Error */Block.__(1, [result[0]]); | ||
} else { | ||
return /* Ok */Block.__(0, [Formats$BsEth.Decode[/* block */10](result[0])]); | ||
} | ||
}), Curry._2(provider, "eth_getBlockByHash", /* array */[ | ||
Formats$BsEth.Encode[/* data */1](blockHash), | ||
Formats$BsEth.Encode[/* bool */5](deep) | ||
])); | ||
} | ||
function blockByNumber(provider, blockNumber, deep) { | ||
return Repromise.map((function (result) { | ||
if (result.tag) { | ||
return /* Error */Block.__(1, [result[0]]); | ||
} else { | ||
return /* Ok */Block.__(0, [Formats$BsEth.Decode[/* block */10](result[0])]); | ||
} | ||
}), Curry._2(provider, "eth_getBlockByNumber", /* array */[ | ||
Formats$BsEth.Encode[/* quantity */2](blockNumber), | ||
Formats$BsEth.Encode[/* bool */5](deep) | ||
])); | ||
} | ||
function netVersion(provider) { | ||
return Repromise.map((function (result) { | ||
if (result.tag) { | ||
return /* Error */Block.__(1, [result[0]]); | ||
} else { | ||
return /* Ok */Block.__(0, [Formats$BsEth.Decode[/* quantity */0](result[0])]); | ||
} | ||
}), Curry._2(provider, "net_version", /* array */[])); | ||
} | ||
export { | ||
@@ -149,11 +216,17 @@ coinbase , | ||
balanceOf , | ||
getTransactionCount , | ||
transactionCount , | ||
blockNumber , | ||
gasPrice , | ||
sendTransaction , | ||
sendRawTransaction , | ||
transactionByHash , | ||
transactionReceipt , | ||
estimateGas , | ||
call , | ||
mineBlock , | ||
blockByHash , | ||
blockByNumber , | ||
netVersion , | ||
} | ||
/* Repromise Not a pure module */ |
@@ -8,2 +8,3 @@ // Generated by BUCKLESCRIPT VERSION 5.0.4, PLEASE EDIT WITH CARE | ||
import * as Belt_Array from "bs-platform/lib/es6/belt_Array.js"; | ||
import * as Json_decode from "@glennsl/bs-json/src/Json_decode.bs.js"; | ||
import * as BigInt$BsEth from "./BigInt.bs.js"; | ||
@@ -29,2 +30,150 @@ | ||
function hexToBigInt(hex) { | ||
return BigInt$BsEth.fromString(strip0x(hex), 16); | ||
} | ||
function hexToInt(hex) { | ||
return BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex), 16)); | ||
} | ||
function toStatus(hex) { | ||
if (hex === "0x1") { | ||
return /* TxSuccess */2; | ||
} else { | ||
return /* TxFailed */3; | ||
} | ||
} | ||
function filterData(json) { | ||
var hex = Json_decode.field("logIndex", Json_decode.string, json); | ||
var hex$1 = Json_decode.field("blockNumber", Json_decode.string, json); | ||
var hex$2 = Json_decode.field("transactionIndex", Json_decode.string, json); | ||
return /* record */[ | ||
/* removed */Json_decode.field("removed", Json_decode.bool, json), | ||
/* logIndex */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex), 16)), | ||
/* transactionHash */Json_decode.field("transactionHash", Json_decode.string, json), | ||
/* blockHash */Json_decode.field("blockHash", Json_decode.string, json), | ||
/* blockNumber */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex$1), 16)), | ||
/* transactionIndex */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex$2), 16)), | ||
/* address */Json_decode.field("address", Json_decode.string, json), | ||
/* data */Json_decode.field("data", Json_decode.string, json), | ||
/* topics */Json_decode.field("topics", (function (param) { | ||
return Json_decode.array(Json_decode.string, param); | ||
}), json) | ||
]; | ||
} | ||
function receipt(json) { | ||
var hex = Json_decode.field("blockNumber", Json_decode.string, json); | ||
var hex$1 = Json_decode.field("transactionIndex", Json_decode.string, json); | ||
var hex$2 = Json_decode.field("gasUsed", Json_decode.string, json); | ||
var hex$3 = Json_decode.field("cumulativeGasUsed", Json_decode.string, json); | ||
return /* record */[ | ||
/* transactionHash */Json_decode.field("transactionHash", Json_decode.string, json), | ||
/* blockHash */Json_decode.field("blockHash", Json_decode.string, json), | ||
/* blockNumber */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex), 16)), | ||
/* transactionIndex */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex$1), 16)), | ||
/* to_ */Json_decode.field("to", Json_decode.string, json), | ||
/* from */Json_decode.field("from", Json_decode.string, json), | ||
/* gasUsed */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex$2), 16)), | ||
/* cumulativeGasUsed */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex$3), 16)), | ||
/* contractAddress */Json_decode.optional((function (param) { | ||
return Json_decode.field("contractAddress", Json_decode.string, param); | ||
}), json), | ||
/* logs */Json_decode.field("logs", (function (param) { | ||
return Json_decode.array(filterData, param); | ||
}), json), | ||
/* status */toStatus(Json_decode.field("status", Json_decode.string, json)) | ||
]; | ||
} | ||
function transaction(json) { | ||
var match = Json_decode.optional((function (param) { | ||
return Json_decode.field("blockNumber", Json_decode.string, param); | ||
}), json); | ||
var match$1 = Json_decode.optional((function (param) { | ||
return Json_decode.field("transactionIndex", Json_decode.string, param); | ||
}), json); | ||
var hex = Json_decode.field("gas", Json_decode.string, json); | ||
var hex$1 = Json_decode.field("gasPrice", Json_decode.string, json); | ||
var hex$2 = Json_decode.field("value", Json_decode.string, json); | ||
var hex$3 = Json_decode.field("nonce", Json_decode.string, json); | ||
return /* record */[ | ||
/* hash */Json_decode.field("hash", Json_decode.string, json), | ||
/* blockHash */Json_decode.optional((function (param) { | ||
return Json_decode.field("blockHash", Json_decode.string, param); | ||
}), json), | ||
/* blockNumber */match !== undefined ? BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(match), 16)) : undefined, | ||
/* transactionIndex */match$1 !== undefined ? BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(match$1), 16)) : undefined, | ||
/* to_ */Json_decode.field("to", Json_decode.string, json), | ||
/* from */Json_decode.field("from", Json_decode.string, json), | ||
/* gas */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex), 16)), | ||
/* gasPrice */BigInt$BsEth.fromString(strip0x(hex$1), 16), | ||
/* value */BigInt$BsEth.fromString(strip0x(hex$2), 16), | ||
/* input */Json_decode.field("input", Json_decode.string, json), | ||
/* nonce */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex$3), 16)) | ||
]; | ||
} | ||
function blockTxDecoder(json) { | ||
var match = Js_json.classify(json); | ||
if (typeof match === "number") { | ||
return /* None */0; | ||
} else { | ||
switch (match.tag | 0) { | ||
case 0 : | ||
return /* TxHash */Block.__(0, [match[0]]); | ||
case 2 : | ||
return /* Tx */Block.__(1, [transaction(json)]); | ||
default: | ||
return /* None */0; | ||
} | ||
} | ||
} | ||
function block(json) { | ||
var hex = Json_decode.field("number", Json_decode.string, json); | ||
var hex$1 = Json_decode.field("difficulty", Json_decode.string, json); | ||
var hex$2 = Json_decode.field("totalDifficulty", Json_decode.string, json); | ||
var hex$3 = Json_decode.field("size", Json_decode.string, json); | ||
var hex$4 = Json_decode.field("gasLimit", Json_decode.string, json); | ||
var hex$5 = Json_decode.field("gasUsed", Json_decode.string, json); | ||
var hex$6 = Json_decode.field("timestamp", Json_decode.string, json); | ||
return /* record */[ | ||
/* number */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex), 16)), | ||
/* hash */Json_decode.field("hash", Json_decode.string, json), | ||
/* parentHash */Json_decode.optional((function (param) { | ||
return Json_decode.field("parentHash", Json_decode.string, param); | ||
}), json), | ||
/* nonce */Json_decode.field("nonce", Json_decode.string, json), | ||
/* sha3Uncles */Json_decode.field("sha3Uncles", Json_decode.string, json), | ||
/* logsBloom */Json_decode.field("logsBloom", Json_decode.string, json), | ||
/* transactionsRoot */Json_decode.field("transactionsRoot", Json_decode.string, json), | ||
/* stateRoot */Json_decode.field("stateRoot", Json_decode.string, json), | ||
/* receiptsRoot */Json_decode.field("receiptsRoot", Json_decode.string, json), | ||
/* miner */Json_decode.field("miner", Json_decode.string, json), | ||
/* difficulty */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex$1), 16)), | ||
/* totalDifficulty */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex$2), 16)), | ||
/* extraData */Json_decode.field("extraData", Json_decode.string, json), | ||
/* size */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex$3), 16)), | ||
/* gasLimit */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex$4), 16)), | ||
/* gasUsed */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex$5), 16)), | ||
/* timestamp */BigInt$BsEth.toInt(BigInt$BsEth.fromString(strip0x(hex$6), 16)), | ||
/* transactions */Json_decode.field("transactions", (function (param) { | ||
return Json_decode.array(blockTxDecoder, param); | ||
}), json), | ||
/* uncles */Json_decode.field("uncles", (function (param) { | ||
return Json_decode.array(Json_decode.string, param); | ||
}), json) | ||
]; | ||
} | ||
var ObjectDecoders = /* module */[ | ||
/* filterData */filterData, | ||
/* receipt */receipt, | ||
/* transaction */transaction, | ||
/* blockTxDecoder */blockTxDecoder, | ||
/* block */block | ||
]; | ||
function quantity(result) { | ||
@@ -104,6 +253,15 @@ var match = Js_json.classify(result); | ||
function bool(result) { | ||
var match = Js_json.classify(result); | ||
if (typeof match === "number") { | ||
return match === 1; | ||
} else { | ||
return false; | ||
} | ||
} | ||
var Decode = /* module */[ | ||
/* quantity */quantity, | ||
/* nonce */quantity, | ||
/* block */quantity, | ||
/* blockNumber */quantity, | ||
/* amount */amount, | ||
@@ -113,3 +271,7 @@ /* address */address, | ||
/* string */string, | ||
/* data */string | ||
/* data */string, | ||
/* transaction */transaction, | ||
/* receipt */receipt, | ||
/* block */block, | ||
/* bool */bool | ||
]; | ||
@@ -154,5 +316,9 @@ | ||
var block = toHex; | ||
var blockNumber = toHex; | ||
function transaction(tx) { | ||
function bool$1(b) { | ||
return b; | ||
} | ||
function transaction$1(tx) { | ||
var json = { }; | ||
@@ -174,3 +340,3 @@ json["to"] = tx.to; | ||
if (match$3 !== undefined) { | ||
json["gas"] = amount$1(match$3); | ||
json["gas"] = quantity$1(match$3); | ||
} | ||
@@ -220,4 +386,5 @@ var match$4 = tx.gasPrice; | ||
/* amount */amount$1, | ||
/* block */block, | ||
/* transaction */transaction, | ||
/* blockNumber */blockNumber, | ||
/* bool */bool$1, | ||
/* transaction */transaction$1, | ||
/* blockOrTag */blockOrTag | ||
@@ -231,2 +398,6 @@ ]; | ||
bnZero , | ||
hexToBigInt , | ||
hexToInt , | ||
toStatus , | ||
ObjectDecoders , | ||
Decode , | ||
@@ -233,0 +404,0 @@ addressMatcher , |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1778620
1698
95