nova-ui/static/snarkjs.min.js

10 lines
706 KiB
JavaScript
Raw Normal View History

2022-12-04 09:02:30 +03:00
var snarkjs=function(A){"use strict";const t=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];function I(A,t){return t&&10!=t?16==t?"0x"==A.slice(0,2)?BigInt(A):BigInt("0x"+A):void 0:BigInt(A)}const i=I;function g(A,t){return BigInt(A)<<BigInt(t)}function e(A,t){return BigInt(A)>>BigInt(t)}const n=g,C=e;var Q=Object.freeze({__proto__:null,fromString:I,e:i,fromArray:function(A,t){let I=BigInt(0);t=BigInt(t);for(let i=0;i<A.length;i++)I=I*t+BigInt(A[i]);return I},bitLength:function(A){const I=A.toString(16);return 4*(I.length-1)+t[parseInt(I[0],16)]},isNegative:function(A){return BigInt(A)<BigInt(0)},isZero:function(A){return!A},shiftLeft:g,shiftRight:e,shl:n,shr:C,isOdd:function(A){return(BigInt(A)&BigInt(1))==BigInt(1)},naf:function(A){let t=BigInt(A);const I=[];for(;t;){if(t&BigInt(1)){const A=2-Number(t%BigInt(4));I.push(A),t-=BigInt(A)}else I.push(0);t>>=BigInt(1)}return I},bits:function(A){let t=BigInt(A);const I=[];for(;t;)t&BigInt(1)?I.push(1):I.push(0),t>>=BigInt(1);return I},toNumber:function(A){if(A>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("Number too big");return Number(A)},toArray:function(A,t){const I=[];let i=BigInt(A);for(t=BigInt(t);i;)I.unshift(Number(i%t)),i/=t;return I},add:function(A,t){return BigInt(A)+BigInt(t)},sub:function(A,t){return BigInt(A)-BigInt(t)},neg:function(A){return-BigInt(A)},mul:function(A,t){return BigInt(A)*BigInt(t)},square:function(A){return BigInt(A)*BigInt(A)},pow:function(A,t){return BigInt(A)**BigInt(t)},exp:function(A,t){return BigInt(A)**BigInt(t)},abs:function(A){return BigInt(A)>=0?BigInt(A):-BigInt(A)},div:function(A,t){return BigInt(A)/BigInt(t)},mod:function(A,t){return BigInt(A)%BigInt(t)},eq:function(A,t){return BigInt(A)==BigInt(t)},neq:function(A,t){return BigInt(A)!=BigInt(t)},lt:function(A,t){return BigInt(A)<BigInt(t)},gt:function(A,t){return BigInt(A)>BigInt(t)},leq:function(A,t){return BigInt(A)<=BigInt(t)},geq:function(A,t){return BigInt(A)>=BigInt(t)},band:function(A,t){return BigInt(A)&BigInt(t)},bor:function(A,t){return BigInt(A)|BigInt(t)},bxor:function(A,t){return BigInt(A)^BigInt(t)},land:function(A,t){return BigInt(A)&&BigInt(t)},lor:function(A,t){return BigInt(A)||BigInt(t)},lnot:function(A){return!BigInt(A)}}),B="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(A){var t={exports:{}};return A(t,t.exports),t.exports}var o=r((function(A){var t=function(A){var I=1e7,i=9007199254740992,g=E(i),e="0123456789abcdefghijklmnopqrstuvwxyz",n="function"==typeof BigInt;function C(A,t,I,i){return void 0===A?C[0]:void 0!==t&&(10!=+t||I)?O(A,t,I,i):z(A)}function Q(A,t){this.value=A,this.sign=t,this.isSmall=!1}function B(A){this.value=A,this.sign=A<0,this.isSmall=!0}function r(A){this.value=A}function o(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 a(A){s(A);var t=A.length;if(t<4&&H(A,g)<0)switch(t){case 0:return 0;case 1:return A[0];case 2:return A[0]+A[1]*I;default:return A[0]+(A[1]+A[2]*I)*I}return A}function s(A){for(var t=A.length;0===A[--t];);A.length=t+1}function h(A){for(var t=new Array(A),I=-1;++I<A;)t[I]=0;return t}function f(A){return A>0?Math.floor(A):Math.ceil(A)}function w(A,t){var i,g,e=A.length,n=t.length,C=new Array(e),Q=0,B=I;for(g=0;g<n;g++)Q=(i=A[g]+t[g]+Q)>=B?1:0,C[g]=i-Q*B;for(;g<e;)Q=(i=A[g]+Q)===B?1:0,C[g++]=i-Q*B;return Q>0&&C.push(Q),C}function c(A,t){return A.length>=t.length?w(A,t):w(t,A)}function D(A,t){var i,g,e=A.length,n=new Array(e),C=I;for(g=0;g<e;g++)i=A[g]-C+t,t=Math.floor(i/C),n[g]=i-t*C,t+=1;for(;t>0;)n[g++]=t%C,t=Math.floor(t/C);return n}function u(A,t){var i,g,e=A.length,n=t.length,C=new Array(e),Q=0,B=I;for(i=0;i<n;i++)(g=A[i]-Q-t[i])<0?(g+=B,Q=1):Q=0,C[i]=g;for(i=n;i<e;i++){if(!((g=A[i]-Q)<0)){C[i++]=g;break}g+=B,C[i]=g}for(;i<e;i++)C[i]=A[i];return s(C),C}function l(A,t,i){var g,e,n=A.length,C=new Array(n),r=-t,o=I;for(g=0;g<n;g++)e=A[g]+r,r=Math.floor(e/o),e%=o,C[g]=e<0?e+o:e;return"number"==typeof(C=a(C))?(i&&(C=-C),new B(C)):new Q(C,i)
/**
* [js-sha3]{@link https://github.com/emn178/js-sha3}
*
* @version 0.8.0
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2015-2018
* @license MIT
*/
var eQ=r((function(A){!function(){var t="input is invalid type",I="object"==typeof window,i=I?window:{};i.JS_SHA3_NO_WINDOW&&(I=!1);var g=!I&&"object"==typeof self;!i.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?i=B:g&&(i=self);var e=!i.JS_SHA3_NO_COMMON_JS&&A.exports,n=!i.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,C="0123456789abcdef".split(""),Q=[4,1024,262144,67108864],r=[0,8,16,24],o=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],E=[224,256,384,512],a=[128,256],s=["hex","buffer","arrayBuffer","array","digest"],h={128:168,256:136};!i.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(A){return"[object Array]"===Object.prototype.toString.call(A)}),!n||!i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(A){return"object"==typeof A&&A.buffer&&A.buffer.constructor===ArrayBuffer});for(var f=function(A,t,I){return function(i){return new U(A,t,A).update(i)[I]()}},w=function(A,t,I){return function(i,g){return new U(A,t,g).update(i)[I]()}},c=function(A,t,I){return function(t,i,g,e){return p["cshake"+A].update(t,i,g,e)[I]()}},D=function(A,t,I){return function(t,i,g,e){return p["kmac"+A].update(t,i,g,e)[I]()}},u=function(A,t,I,i){for(var g=0;g<s.length;++g){var e=s[g];A[e]=t(I,i,e)}return A},l=function(A,t){var I=f(A,t,"hex");return I.create=function(){return new U(A,t,A)},I.update=function(A){return I.create().update(A)},u(I,f,A,t)},y=[{name:"keccak",padding:[1,256,65536,16777216],bits:E,createMethod:l},{name:"sha3",padding:[6,1536,393216,100663296],bits:E,createMethod:l},{name:"shake",padding:[31,7936,2031616,520093696],bits:a,createMethod:function(A,t){var I=w(A,t,"hex");return I.create=function(I){return new U(A,t,I)},I.update=function(A,t){return I.create(t).update(A)},u(I,w,A,t)}},{name:"cshake",padding:Q,bits:a,createMethod:function(A,t){var I=h[A],i=c(A,0,"hex");return i.create=function(i,g,e){return g||e?new U(A,t,i).bytepad([g,e],I):p["shake"+A].create(i)},i.update=function(A,t,I,g){return i.create(t,I,g).update(A)},u(i,c,A,t)}},{name:"kmac",padding:Q,bits:a,createMethod:function(A,t){var I=h[A],i=D(A,0,"hex");return i.create=function(i,g,e){return new L(A,t,g).bytepad(["KMAC",e],I).bytepad([i],I)},i.update=function(A,t,I,g){return i.create(A,I,g).update(t)},u(i,D,A,t)}}],p={},F=[],M=0;M<y.length;++M)for(var m=y[M],d=m.bits,G=0;G<d.length;++G){var b=m.name+"_"+d[G];if(F.push(b),p[b]=m.createMethod(d[G],m.padding),"sha3"!==m.name){var H=m.name+d[G];F.push(H),p[H]=p[b]}}function U(A,t,I){this.blocks=[],this.s=[],this.padding=t,this.outputBits=I,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(A<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=I>>5,this.extraBytes=(31&I)>>3;for(var i=0;i<50;++i)this.s[i]=0}function L(A,t,I){U.call(this,A,t,I)}U.prototype.update=function(A){if(this.finalized)throw new Error("finalize already called");var I,i=typeof A;if("string"!==i){if("object"!==i)throw new Error(t);if(null===A)throw new Error(t);if(n&&A.constructor===ArrayBuffer)A=new Uint8Array(A);else if(!(Array.isArray(A)||n&&ArrayBuffer.isView(A)))throw new Error(t);I=!0}for(var g,e,C=this.blocks,Q=this.byteCount,B=A.length,o=this.blockCount,E=0,a=this.s;E<B;){if(this.reset)for(this.reset=!1,C[0]=this.block,g=1;g<o+1;++g)C[g]=0;if(I)for(g=this.start;E<B&&g<Q;++E)C[g>>2]|=A[E]<<r[3&g++];else for(g=this.start;E<B&&g<Q;++E)(e=A.charCodeAt(E))<128?C[g>>2]|=e<<r[3&g++]:e<2048?(C[g>>2]|=(192|e>>6)<<r[3&g++],C[g>>2]|=(128|63&e)<<r[3&g++]):e<55296||e>=57344?(C[g>>2]|=(224|e>>12)<<r[3&g++],C[g>>2]|=(128|e>>6&63)<<r[3&g++],C[g>>2]|=(128|63&e)<<r[3&g++]):(e=65536+((1023&e)<<10|1023&A.charCodeAt(++E)),C[g>>2]|=(240|e>>18)<<r[3&g++],C[g>>2]|=(128|e>>12&63)<<r[3&g++],C[g>>2]|=(128|e>>6&63)<<r[3&g++],C[g>>2]|=(128|6