snarkjs/build/snarkjs.min.js

2 lines
643 KiB
JavaScript
Raw Normal View History

2020-08-13 01:44:40 +03:00
var snarkjs=function(A){"use strict";const I=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];function t(A,I){return I&&10!=I?16==I?"0x"==A.slice(0,2)?BigInt(A):BigInt("0x"+A):void 0:BigInt(A)}const i=t;function g(A,I){return BigInt(A)<<BigInt(I)}function C(A,I){return BigInt(A)>>BigInt(I)}const Q=g,e=C;var n=Object.freeze({__proto__:null,fromString:t,e:i,fromArray:function(A,I){let t=0n;I=BigInt(I);for(let i=0;i<A.length;i++)t=t*I+BigInt(A[i]);return t},bitLength:function(A){const t=A.toString(16);return 4*(t.length-1)+I[parseInt(t[0],16)]},isNegative:function(A){return BigInt(A)<0n},isZero:function(A){return!A},shiftLeft:g,shiftRight:C,shl:Q,shr:e,isOdd:function(A){return 1n==(1n&BigInt(A))},naf:function(A){let I=BigInt(A);const t=[];for(;I;){if(1n&I){const A=2-Number(I%4n);t.push(A),I-=BigInt(A)}else t.push(0);I>>=1n}return t},bits:function(A){let I=BigInt(A);const t=[];for(;I;)1n&I?t.push(1):t.push(0),I>>=1n;return t},toNumber:function(A){if(A>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("Number too big");return Number(A)},toArray:function(A,I){const t=[];let i=BigInt(A);for(I=BigInt(I);i;)t.unshift(Number(i%I)),i/=I;return t},add:function(A,I){return BigInt(A)+BigInt(I)},sub:function(A,I){return BigInt(A)-BigInt(I)},neg:function(A){return-BigInt(A)},mul:function(A,I){return BigInt(A)*BigInt(I)},square:function(A){return BigInt(A)*BigInt(A)},pow:function(A,I){return BigInt(A)**BigInt(I)},exp:function(A,I){return BigInt(A)**BigInt(I)},abs:function(A){return BigInt(A)>=0?BigInt(A):-BigInt(A)},div:function(A,I){return BigInt(A)/BigInt(I)},mod:function(A,I){return BigInt(A)%BigInt(I)},eq:function(A,I){return BigInt(A)==BigInt(I)},neq:function(A,I){return BigInt(A)!=BigInt(I)},lt:function(A,I){return BigInt(A)<BigInt(I)},gt:function(A,I){return BigInt(A)>BigInt(I)},leq:function(A,I){return BigInt(A)<=BigInt(I)},geq:function(A,I){return BigInt(A)>=BigInt(I)},band:function(A,I){return BigInt(A)&BigInt(I)},bor:function(A,I){return BigInt(A)|BigInt(I)},bxor:function(A,I){return BigInt(A)^BigInt(I)},land:function(A,I){return BigInt(A)&&BigInt(I)},lor:function(A,I){return BigInt(A)||BigInt(I)},lnot:function(A){return!BigInt(A)}});function B(A,I){return A(I={exports:{}},I.exports),I.exports}var r=B((function(A){var I=function(A){var t=1e7,i=9007199254740992,g=E(i),C="function"==typeof BigInt;function Q(A,I,t,i){return void 0===A?Q[0]:void 0!==I&&(10!=+I||t)?Y(A,I,t,i):Z(A)}function e(A,I){this.value=A,this.sign=I,this.isSmall=!1}function n(A){this.value=A,this.sign=A<0,this.isSmall=!0}function B(A){this.value=A}function r(A){return-i<A&&A<i}function E(A){return A<1e7?[A]:A<1e14?[A%1e7,Math.floor(A/1e7)]:[A%1e7,Math.floor(A/1e7)%1e7,Math.floor(A/1e14)]}function h(A){o(A);var I=A.length;if(I<4&&G(A,g)<0)switch(I){case 0:return 0;case 1:return A[0];case 2:return A[0]+A[1]*t;default:return A[0]+(A[1]+A[2]*t)*t}return A}function o(A){for(var I=A.length;0===A[--I];);A.length=I+1}function s(A){for(var I=new Array(A),t=-1;++t<A;)I[t]=0;return I}function a(A){return A>0?Math.floor(A):Math.ceil(A)}function f(A,I){var i,g,C=A.length,Q=I.length,e=new Array(C),n=0,B=t;for(g=0;g<Q;g++)n=(i=A[g]+I[g]+n)>=B?1:0,e[g]=i-n*B;for(;g<C;)n=(i=A[g]+n)===B?1:0,e[g++]=i-n*B;return n>0&&e.push(n),e}function w(A,I){return A.length>=I.length?f(A,I):f(I,A)}function D(A,I){var i,g,C=A.length,Q=new Array(C),e=t;for(g=0;g<C;g++)i=A[g]-e+I,I=Math.floor(i/e),Q[g]=i-I*e,I+=1;for(;I>0;)Q[g++]=I%e,I=Math.floor(I/e);return Q}function c(A,I){var t,i,g=A.length,C=I.length,Q=new Array(g),e=0;for(t=0;t<C;t++)(i=A[t]-e-I[t])<0?(i+=1e7,e=1):e=0,Q[t]=i;for(t=C;t<g;t++){if(!((i=A[t]-e)<0)){Q[t++]=i;break}i+=1e7,Q[t]=i}for(;t<g;t++)Q[t]=A[t];return o(Q),Q}function u(A,I,t){var i,g,C=A.length,Q=new Array(C),B=-I;for(i=0;i<C;i++)g=A[i]+B,B=Math.floor(g/1e7),g%=1e7,Q[i]=g<0?g+1e7:g;return"number"==typeof(Q=h(Q))?(t&&(Q=-Q),new n(Q)):new e(Q,t)}function y(A,I){var t,i,g,C,Q=A.length,e=I.length,n=s(Q+e);for(g=0;g<Q;++g){C=A[g];for(var B=0;B<e;++B)t=C*I[B]+n[g+B],i=Math.floor(t/1e7),n[g+B]=t-1e7*i,n[g+B+1]+=i}return o(n),n}function p(A,I){var i,g,C=A.length,Q=new Array(C),e=t,n=0;for(g=0;g<C