snarkjs/build/snarkjs.min.js

2 lines
569 KiB
JavaScript
Raw Normal View History

2020-08-03 23:00:03 +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 g(A,I){return I&&10!=I?16==I?"0x"==A.slice(0,2)?BigInt(A):BigInt("0x"+A):void 0:BigInt(A)}const C=g;function Q(A,I){return BigInt(A)<<BigInt(I)}function t(A,I){return BigInt(A)>>BigInt(I)}const i=Q,B=t;var E=Object.freeze({__proto__:null,fromString:g,e:C,fromArray:function(A,I){let g=0n;I=BigInt(I);for(let C=0;C<A.length;C++)g=g*I+BigInt(A[C]);return g},bitLength:function(A){const g=A.toString(16);return 4*(g.length-1)+I[parseInt(g[0],16)]},isNegative:function(A){return BigInt(A)<0n},isZero:function(A){return!A},shiftLeft:Q,shiftRight:t,shl:i,shr:B,isOdd:function(A){return 1n==(1n&BigInt(A))},naf:function(A){let I=BigInt(A);const g=[];for(;I;){if(1n&I){const A=2-Number(I%4n);g.push(A),I-=BigInt(A)}else g.push(0);I>>=1n}return g},bits:function(A){let I=BigInt(A);const g=[];for(;I;)1n&I?g.push(1):g.push(0),I>>=1n;return g},toNumber:function(A){if(A>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("Number too big");return Number(A)},toArray:function(A,I){const g=[];let C=BigInt(A);for(I=BigInt(I);C;)g.unshift(Number(C%I)),C/=I;return g},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 e(A,I){return A(I={exports:{}},I.exports),I.exports}var n=e((function(A){var I=function(A){var g=1e7,C=9007199254740992,Q=h(C),t="function"==typeof BigInt;function i(A,I,g,C){return void 0===A?i[0]:void 0!==I&&(10!=+I||g)?P(A,I,g,C):K(A)}function B(A,I){this.value=A,this.sign=I,this.isSmall=!1}function E(A){this.value=A,this.sign=A<0,this.isSmall=!0}function e(A){this.value=A}function n(A){return-C<A&&A<C}function h(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 o(A){a(A);var I=A.length;if(I<4&&U(A,Q)<0)switch(I){case 0:return 0;case 1:return A[0];case 2:return A[0]+A[1]*g;default:return A[0]+(A[1]+A[2]*g)*g}return A}function a(A){for(var I=A.length;0===A[--I];);A.length=I+1}function r(A){for(var I=new Array(A),g=-1;++g<A;)I[g]=0;return I}function s(A){return A>0?Math.floor(A):Math.ceil(A)}function w(A,I){var C,Q,t=A.length,i=I.length,B=new Array(t),E=0,e=g;for(Q=0;Q<i;Q++)E=(C=A[Q]+I[Q]+E)>=e?1:0,B[Q]=C-E*e;for(;Q<t;)E=(C=A[Q]+E)===e?1:0,B[Q++]=C-E*e;return E>0&&B.push(E),B}function f(A,I){return A.length>=I.length?w(A,I):w(I,A)}function D(A,I){var C,Q,t=A.length,i=new Array(t),B=g;for(Q=0;Q<t;Q++)C=A[Q]-B+I,I=Math.floor(C/B),i[Q]=C-I*B,I+=1;for(;I>0;)i[Q++]=I%B,I=Math.floor(I/B);return i}function c(A,I){var g,C,Q=A.length,t=I.length,i=new Array(Q),B=0;for(g=0;g<t;g++)(C=A[g]-B-I[g])<0?(C+=1e7,B=1):B=0,i[g]=C;for(g=t;g<Q;g++){if(!((C=A[g]-B)<0)){i[g++]=C;break}C+=1e7,i[g]=C}for(;g<Q;g++)i[g]=A[g];return a(i),i}function y(A,I,g){var C,Q,t=A.length,i=new Array(t),e=-I;for(C=0;C<t;C++)Q=A[C]+e,e=Math.floor(Q/1e7),Q%=1e7,i[C]=Q<0?Q+1e7:Q;return"number"==typeof(i=o(i))?(g&&(i=-i),new E(i)):new B(i,g)}function F(A,I){var g,C,Q,t,i=A.length,B=I.length,E=r(i+B);for(Q=0;Q<i;++Q){t=A[Q];for(var e=0;e<B;++e)g=t*I[e]+E[Q+e],C=Math.floor(g/1e7),E[Q+e]=g-1e7*C,E[Q+e+1]+=C}return a(E),E}function M(A,I){var C,Q,t=A.length,i=new Array(t),B=g,E=0;for(Q=0;Q<t