>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new A;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return y[t]=e,e},S.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),f=s.redNeg(),u=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,u).cmp(f);)h.redIAdd(f);for(var c=this.pow(h,o),d=this.pow(t,o.addn(1).iushrn(1)),l=this.pow(t,o),p=a;0!==l.cmp(s);){for(var m=l,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b=0;n--){for(var u=e.words[n],h=f-1;h>=0;h--){var c=u>>h&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4===++s||0===n&&0===h)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}f=26}return o},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new k(t)},n(k,S),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this),t.exports}.call({})}var xb,Cb,Ib,Db,Pb=!1;function Ob(t){var e,r=t.modulus.byteLength();do{e=new Ib(Db(r))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function Lb(t,e){var r=function(t){var e=Ob(t);return{blinder:e.toRed(Ib.mont(t.modulus)).redPow(new Ib(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),n=e.modulus.byteLength(),i=new Ib(t).mul(r.blinder).umod(e.modulus),o=i.toRed(Ib.mont(e.prime1)),a=i.toRed(Ib.mont(e.prime2)),s=e.coefficient,f=e.prime1,u=e.prime2,h=o.redPow(e.exponent1).fromRed(),c=a.redPow(e.exponent2).fromRed(),d=h.isub(c).imul(s).umod(f).imul(u);return c.iadd(d).imul(r.unblinder).umod(e.modulus).toArrayLike(Cb,"be",n)}function Ub(){xb={},Cb=Ve().Buffer,Tb||(Tb=!0,Rb()),Ib=Bb,Db=wr(),Lb.getr=Ob,xb=Lb}function jb(){return Pb||(Pb=!0,Ub()),xb}var Nb,zb=!1;function Fb(){return zb||(zb=!0,Nb={},Nb=JSON.parse('{"name":"elliptic","version":"6.5.4","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"lint":"eslint lib test","lint:fix":"npm run lint -- --fix","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny ","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}')),Nb}var qb,Hb,Wb=!1;function Gb(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n>8,a=255&i;o?r.push(o,a):r.push(a)}return r}function Yb(t){return 1===t.length?"0"+t:t}function Kb(t){for(var e="",r=0;r(i>>1)-1?(i>>1)-f:f,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n}function eg(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,f=t.andln(3)+i&3,u=e.andln(3)+o&3;3===f&&(f=-1),3===u&&(u=-1),a=0==(1&f)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==u?f:-f,r[0].push(a),s=0==(1&u)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==f?u:-u,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r}function rg(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}}function ng(t){return"string"==typeof t?$b.toArray(t,"hex"):t}function ig(t){return new Xb(t,"hex","le")}function og(){return Qb||(Qb=!0,$b=Zb={},Xb=pm(),Jb=ec(),Vb(),$b.assert=Jb,$b.toArray=Vb().toArray,$b.zero2=Vb().zero2,$b.toHex=Vb().toHex,$b.encode=Vb().encode,$b.getNAF=tg,$b.getJSF=eg,$b.cachedProperty=rg,$b.parseBytes=ng,$b.intFromLE=ig),Zb}var ag,sg,fg,ug,hg,cg=!1;function dg(t,e){this.type=t,this.p=new sg(e.p,16),this.red=e.prime?sg.red(e.prime):sg.mont(this.p),this.zero=new sg(0).toRed(this.red),this.one=new sg(1).toRed(this.red),this.two=new sg(2).toRed(this.red),this.n=e.n&&new sg(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function lg(t,e){this.curve=t,this.type=e,this.precomputed=null}function pg(){return cg||(cg=!0,ag={},sg=pm(),og(),fg=og().getNAF,ug=og().getJSF,hg=og().assert,ag=dg,dg.prototype.point=function(){throw new Error("Not implemented")},dg.prototype.validate=function(){throw new Error("Not implemented")},dg.prototype._fixedNafMul=function(t,e){hg(t.precomputed);var r=t._getDoubles(),n=fg(e,1,this._bitLength),i=(1<=o;f--)a=(a<<1)+n[f];s.push(a)}for(var u=this.jpoint(null,null,null),h=this.jpoint(null,null,null),c=i;c>0;c--){for(o=0;o=0;s--){for(var f=0;s>=0&&0===o[s];s--)f++;if(s>=0&&f++,a=a.dblp(f),s<0)break;var u=o[s];hg(0!==u),a="affine"===t.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===t.type?a.toP():a},dg.prototype._wnafMulAdd=function(t,e,r,n,i){var o,a,s,f=this._wnafT1,u=this._wnafT2,h=this._wnafT3,c=0;for(o=0;o=1;o-=2){var l=o-1,p=o;if(1===f[l]&&1===f[p]){var m=[e[l],null,null,e[p]];0===e[l].y.cmp(e[p].y)?(m[1]=e[l].add(e[p]),m[2]=e[l].toJ().mixedAdd(e[p].neg())):0===e[l].y.cmp(e[p].y.redNeg())?(m[1]=e[l].toJ().mixedAdd(e[p]),m[2]=e[l].add(e[p].neg())):(m[1]=e[l].toJ().mixedAdd(e[p]),m[2]=e[l].toJ().mixedAdd(e[p].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],g=ug(r[l],r[p]);for(c=Math.max(g[0].length,c),h[l]=new Array(c),h[p]=new Array(c),a=0;a=0;o--){for(var A=0;o>=0;){var M=!0;for(a=0;a=0&&A++,w=w.dblp(A),o<0)break;for(a=0;a0?s=u[a][E-1>>1]:E<0&&(s=u[a][-E-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},lg.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=e,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},_g.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),f=i.mul(r.b),u=o.mul(n.b);return{k1:t.sub(a).sub(s),k2:f.add(u).neg()}},_g.prototype.pointFromX=function(t,e){(t=new bg(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},_g.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},_g.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},Ag.prototype.isInfinity=function(){return this.inf},Ag.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Ag.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Ag.prototype.getX=function(){return this.x.fromRed()},Ag.prototype.getY=function(){return this.y.fromRed()},Ag.prototype.mul=function(t){return t=new bg(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Ag.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},Ag.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},Ag.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Ag.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},Ag.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},gg(Mg,vg.BasePoint),_g.prototype.jpoint=function(t,e,r){return new Mg(this,t,e,r)},Mg.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},Mg.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Mg.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=n.redSub(i),f=o.redSub(a);if(0===s.cmpn(0))return 0!==f.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),h=u.redMul(s),c=n.redMul(u),d=f.redSqr().redIAdd(h).redISub(c).redISub(c),l=f.redMul(c.redISub(d)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,l,p)},Mg.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),u=f.redMul(a),h=r.redMul(f),c=s.redSqr().redIAdd(u).redISub(h).redISub(h),d=s.redMul(h.redISub(c)).redISub(i.redMul(u)),l=this.z.redMul(a);return this.curve.jpoint(c,d,l)},Mg.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},Mg.prototype.inspect=function(){return this.isInfinity()?"":""},Mg.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}),mg}var Sg,kg,Bg,Tg,Rg=!1;function xg(t){Tg.call(this,"mont",t),this.a=new kg(t.a,16).toRed(this.red),this.b=new kg(t.b,16).toRed(this.red),this.i4=new kg(4).toRed(this.red).redInvm(),this.two=new kg(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function Cg(t,e,r){Tg.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new kg(e,16),this.z=new kg(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}function Ig(){return Rg||(Rg=!0,Sg={},kg=pm(),Bg=Mr(),Tg=pg(),og(),Bg(xg,Tg),Sg=xg,xg.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},Bg(Cg,Tg.BasePoint),xg.prototype.decodePoint=function(t,e){return this.point(og().toArray(t,e),1)},xg.prototype.point=function(t,e){return new Cg(this,t,e)},xg.prototype.pointFromJSON=function(t){return Cg.fromJSON(this,t)},Cg.prototype.precompute=function(){},Cg.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Cg.fromJSON=function(t,e){return new Cg(t,e[0],e[1]||t.one)},Cg.prototype.inspect=function(){return this.isInfinity()?"":""},Cg.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Cg.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},Cg.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Cg.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),a=i.redMul(n),s=e.z.redMul(o.redAdd(a).redSqr()),f=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,f)},Cg.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},Cg.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Cg.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Cg.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},Cg.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Cg.prototype.getX=function(){return this.normalize(),this.x.fromRed()}),Sg}var Dg,Pg,Og,Lg,Ug,jg=!1;function Ng(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,Lg.call(this,"edwards",t),this.a=new Pg(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Pg(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Pg(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Ug(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function zg(t,e,r,n,i){Lg.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new Pg(e,16),this.y=new Pg(r,16),this.z=n?new Pg(n,16):this.curve.one,this.t=i&&new Pg(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}function Fg(){return jg||(jg=!0,Dg={},og(),Pg=pm(),Og=Mr(),Lg=pg(),Ug=og().assert,Og(Ng,Lg),Dg=Ng,Ng.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},Ng.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},Ng.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},Ng.prototype.pointFromX=function(t,e){(t=new Pg(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=this.c2.redSub(this.a.redMul(r)),i=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(e&&!s||!e&&s)&&(a=a.redNeg()),this.point(t,a)},Ng.prototype.pointFromY=function(t,e){(t=new Pg(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=r.redSub(this.c2),i=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},Ng.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),n=e.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===n.cmp(i)},Og(zg,Lg.BasePoint),Ng.prototype.pointFromJSON=function(t){return zg.fromJSON(this,t)},Ng.prototype.point=function(t,e,r,n){return new zg(this,t,e,r,n)},zg.fromJSON=function(t,e){return new zg(t,e[0],e[1],e[2])},zg.prototype.inspect=function(){return this.isInfinity()?"":""},zg.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},zg.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),a=o.redSub(r),s=n.redSub(e),f=i.redMul(a),u=o.redMul(s),h=i.redMul(s),c=a.redMul(o);return this.curve.point(f,u,c,h)},zg.prototype._projDbl=function(){var t,e,r,n,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),f=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(s)).redAdd(f);this.zOne?(t=a.redSub(s).redSub(f).redMul(u.redSub(this.curve.two)),e=u.redMul(n.redSub(f)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),t=a.redSub(s).redISub(f).redMul(o),e=u.redMul(n.redSub(f)),r=u.redMul(o))}else n=s.redAdd(f),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),t=this.curve._mulC(a.redISub(n)).redMul(o),e=this.curve._mulC(n).redMul(s.redISub(f)),r=n.redMul(o);return this.curve.point(t,e,r)},zg.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},zg.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),a=i.redSub(n),s=i.redAdd(n),f=r.redAdd(e),u=o.redMul(a),h=s.redMul(f),c=o.redMul(f),d=a.redMul(s);return this.curve.point(u,h,d,c)},zg.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),f=i.redSub(s),u=i.redAdd(s),h=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),c=n.redMul(f).redMul(h);return this.curve.twisted?(e=n.redMul(u).redMul(a.redSub(this.curve._mulA(o))),r=f.redMul(u)):(e=n.redMul(u).redMul(a.redSub(o)),r=this.curve._mulC(f).redMul(u)),this.curve.point(c,e,r)},zg.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},zg.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},zg.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},zg.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},zg.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},zg.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},zg.prototype.getX=function(){return this.normalize(),this.x.fromRed()},zg.prototype.getY=function(){return this.normalize(),this.y.fromRed()},zg.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},zg.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},zg.prototype.toP=zg.prototype.normalize,zg.prototype.mixedAdd=zg.prototype.add),Dg}var qg,Hg,Wg=!1;function Gg(){return Wg||(Wg=!0,(Hg=qg={}).base=pg(),Hg.short=Eg(),Hg.mont=Ig(),Hg.edwards=Fg()),qg}var Yg,Kg,Vg,Zg,$g,Xg,Jg,Qg,tv,ev,rv,nv,iv,ov,av,sv,fv,uv,hv,cv,dv,lv,pv,mv,bv,gv,vv,yv,wv,_v=!1;function Av(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function Mv(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,r[n++]=63&o|128):Av(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function kv(t,e){for(var r="",n=0;n>>0}return o}function xv(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r}function Cv(t,e){return t>>>e|t<<32-e}function Iv(t,e){return t<>>32-e}function Dv(t,e){return t+e>>>0}function Pv(t,e,r){return t+e+r>>>0}function Ov(t,e,r,n){return t+e+r+n>>>0}function Lv(t,e,r,n,i){return t+e+r+n+i>>>0}function Uv(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,a=(o>>0,t[e+1]=o}function jv(t,e,r,n){return(e+n>>>0>>0}function Nv(t,e,r,n){return e+n>>>0}function zv(t,e,r,n,i,o,a,s){var f=0,u=e;return f+=(u=u+n>>>0)>>0)>>0)>>0}function Fv(t,e,r,n,i,o,a,s){return e+n+o+s>>>0}function qv(t,e,r,n,i,o,a,s,f,u){var h=0,c=e;return h+=(c=c+n>>>0)>>0)>>0)>>0)>>0}function Hv(t,e,r,n,i,o,a,s,f,u){return e+n+o+s+u>>>0}function Wv(t,e,r){return(e<<32-r|t>>>r)>>>0}function Gv(t,e,r){return(t<<32-r|e>>>r)>>>0}function Yv(t,e,r){return t>>>r}function Kv(t,e,r){return(t<<32-r|e>>>r)>>>0}function Vv(){return _v||(_v=!0,Yg={},Kg=ec(),Vg=Mr(),Zg=Vg,Yg.inherits=Zg,$g=Mv,Yg.toArray=$g,Xg=Ev,Yg.toHex=Xg,Jg=Sv,Yg.htonl=Jg,Qg=kv,Yg.toHex32=Qg,tv=Bv,Yg.zero2=tv,ev=Tv,Yg.zero8=ev,rv=Rv,Yg.join32=rv,nv=xv,Yg.split32=nv,iv=Cv,Yg.rotr32=iv,ov=Iv,Yg.rotl32=ov,av=Dv,Yg.sum32=av,sv=Pv,Yg.sum32_3=sv,fv=Ov,Yg.sum32_4=fv,uv=Lv,Yg.sum32_5=uv,hv=Uv,Yg.sum64=hv,cv=jv,Yg.sum64_hi=cv,dv=Nv,Yg.sum64_lo=dv,lv=zv,Yg.sum64_4_hi=lv,pv=Fv,Yg.sum64_4_lo=pv,mv=qv,Yg.sum64_5_hi=mv,bv=Hv,Yg.sum64_5_lo=bv,gv=Wv,Yg.rotr64_hi=gv,vv=Gv,Yg.rotr64_lo=vv,yv=Yv,Yg.shr64_hi=yv,wv=Kv,Yg.shr64_lo=wv),Yg}var Zv,$v,Xv,Jv=!1;function Qv(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}function ty(){return Jv||(Jv=!0,Zv={},Vv(),$v=ec(),Xv=Qv,Zv.BlockHash=Xv,Qv.prototype.update=function(t,e){if(t=Vv().toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=Vv().join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o>>3}function gy(t){return ry(t,17)^ry(t,19)^t>>>10}function vy(){return hy||(hy=!0,ey={},Vv(),ry=Vv().rotr32,ny=cy,ey.ft_1=ny,iy=dy,ey.ch32=iy,oy=ly,ey.maj32=oy,ay=py,ey.s0_256=ay,sy=my,ey.s1_256=sy,fy=by,ey.g0_256=fy,uy=gy,ey.g1_256=uy),ey}var yy,wy,_y,Ay,My,Ey,Sy,ky=!1;function By(){if(!(this instanceof By))return new By;Ey.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}function Ty(){return ky||(ky=!0,yy={},Vv(),ty(),vy(),wy=Vv().rotl32,_y=Vv().sum32,Ay=Vv().sum32_5,My=vy().ft_1,Ey=ty().BlockHash,Sy=[1518500249,1859775393,2400959708,3395469782],Vv().inherits(By,Ey),yy=By,By.blockSize=512,By.outSize=160,By.hmacStrength=80,By.padLength=64,By.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;nthis.blockSize&&(t=(new this.Hash).update(t).digest()),e_(t.length<=this.blockSize);for(var e=t.length;e=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}function E_(){return A_||(A_=!0,w_={},f_(),Vb(),__=ec(),w_=M_,M_.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},M_.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=Vb().toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"}),S_}var C_,I_,D_,P_=!1;function O_(t,e){if(t instanceof O_)return t;this._importDER(t,e)||(D_(t.r&&t.s,"Signature without r or s"),this.r=new I_(t.r,16),this.s=new I_(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function L_(){this.place=0}function U_(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=e.place;o>>=0;return!(i<=127)&&(e.place=a,i)}function j_(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}function z_(){return P_||(P_=!0,C_={},I_=pm(),og(),D_=og().assert,C_=O_,O_.prototype._importDER=function(t,e){t=og().toArray(t,e);var r=new L_;if(48!==t[r.place++])return!1;var n=U_(t,r);if(!1===n)return!1;if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var i=U_(t,r);if(!1===i)return!1;var o=t.slice(r.place,i+r.place);if(r.place+=i,2!==t[r.place++])return!1;var a=U_(t,r);if(!1===a)return!1;if(t.length!==a+r.place)return!1;var s=t.slice(r.place,a+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new I_(o),this.s=new I_(s),this.recoveryParam=null,!0},O_.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=j_(e),r=j_(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];N_(n,e.length),(n=n.concat(e)).push(2),N_(n,r.length);var i=n.concat(r),o=[48];return N_(o,i.length),o=o.concat(i),og().encode(o,t)}),C_}var F_,q_,H_,W_,G_,Y_,K_,V_,Z_=!1;function $_(t){if(!(this instanceof $_))return new $_(t);"string"==typeof t&&(Y_(Object.prototype.hasOwnProperty.call(W_,t),"Unknown curve "+t),t=W_[t]),t instanceof W_.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}function X_(){return Z_||(Z_=!0,F_={},q_=pm(),H_=E_(),og(),W_=y_(),G_=wm(),Y_=og().assert,K_=x_(),V_=z_(),F_=$_,$_.prototype.keyPair=function(t){return new K_(this,t)},$_.prototype.keyFromPrivate=function(t,e){return K_.fromPrivate(this,t,e)},$_.prototype.keyFromPublic=function(t,e){return K_.fromPublic(this,t,e)},$_.prototype.genKeyPair=function(t){t||(t={});for(var e=new H_({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||G_(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new q_(2));;){var i=new q_(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},$_.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},$_.prototype.sign=function(t,e,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new q_(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new H_({hash:this.hash,entropy:o,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),f=this.n.sub(new q_(1)),u=0;;u++){var h=n.k?n.k(u):new q_(s.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(f)>=0)){var c=this.g.mul(h);if(!c.isInfinity()){var d=c.getX(),l=d.umod(this.n);if(0!==l.cmpn(0)){var p=h.invm(this.n).mul(l.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(c.getY().isOdd()?1:0)|(0!==d.cmp(l)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new V_({r:l,s:p,recoveryParam:m})}}}}}},$_.prototype.verify=function(t,e,r,n){t=this._truncateToN(new q_(t,16)),r=this.keyFromPublic(r,n);var i=(e=new V_(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),f=s.mul(t).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(f,r.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(f,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},$_.prototype.recoverPubKey=function(t,e,r,n){Y_((3&r)===r,"The recovery param is more than two bits"),e=new V_(e,n);var i=this.n,o=new q_(t),a=e.r,s=e.s,f=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),f):this.curve.pointFromX(a,f);var h=e.r.invm(i),c=i.sub(o).mul(h).umod(i),d=s.mul(h).umod(i);return this.g.mulAdd(c,a,d)},$_.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new V_(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}),F_}var J_,Q_,tA,eA,rA=!1;function nA(t,e){this.eddsa=t,this._secret=tA(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=tA(e.pub)}function iA(){return rA||(rA=!0,J_={},og(),Q_=og().assert,tA=og().parseBytes,eA=og().cachedProperty,nA.fromPublic=function(t,e){return e instanceof nA?e:new nA(t,{pub:e})},nA.fromSecret=function(t,e){return e instanceof nA?e:new nA(t,{secret:e})},nA.prototype.secret=function(){return this._secret},eA(nA,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),eA(nA,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),eA(nA,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,n=e.slice(0,t.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),eA(nA,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),eA(nA,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),eA(nA,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),nA.prototype.sign=function(t){return Q_(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},nA.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},nA.prototype.getSecret=function(t){return Q_(this._secret,"KeyPair is public only"),og().encode(this.secret(),t)},nA.prototype.getPublic=function(t){return og().encode(this.pubBytes(),t)},J_=nA),J_}var oA,aA,sA,fA,uA,hA=!1;function cA(t,e){this.eddsa=t,"object"!=typeof e&&(e=uA(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),sA(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof aA&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}function dA(){return hA||(hA=!0,oA={},aA=pm(),og(),sA=og().assert,fA=og().cachedProperty,uA=og().parseBytes,fA(cA,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),fA(cA,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),fA(cA,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),fA(cA,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),cA.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},cA.prototype.toHex=function(){return og().encode(this.toBytes(),"hex").toUpperCase()},oA=cA),oA}var lA,pA,mA,bA,gA,vA=!1;function yA(t){if(mA("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof yA))return new yA(t);t=pA[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=f_().sha512}function wA(){return vA||(vA=!0,lA={},f_(),pA=y_(),og(),mA=og().assert,bA=og().parseBytes,iA(),gA=dA(),lA=yA,yA.prototype.sign=function(t,e){t=bA(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},yA.prototype.verify=function(t,e,r){t=bA(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},yA.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function s(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function f(t,e,n,i){for(var o=0,a=0,s=Math.min(t.length,n),f=e;f=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=s(t,e,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(t){i.prototype.inspect=h}else i.prototype.inspect=h;function h(){return(this.red?""}var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?c[6-f.length]+f+n:f+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],h=l[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(h).toString(t);n=(p=p.idivn(h)).isZero()?m+n:c[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,f=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,c=67108863&f,d=Math.min(u,e.length-1),l=Math.max(0,u-t.length+1);l<=d;l++){var p=u-l|0;h+=(a=(i=0|t.words[p])*(o=0|e.words[l])+c)/67108864|0,c=67108863&a}r.words[u]=0|c,f=0|h}return 0!==f?r.words[u]=0|f:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,l=0|a[1],p=8191&l,m=l>>>13,b=0|a[2],g=8191&b,v=b>>>13,y=0|a[3],w=8191&y,_=y>>>13,A=0|a[4],M=8191&A,E=A>>>13,S=0|a[5],k=8191&S,B=S>>>13,T=0|a[6],R=8191&T,x=T>>>13,C=0|a[7],I=8191&C,D=C>>>13,P=0|a[8],O=8191&P,L=P>>>13,U=0|a[9],j=8191&U,N=U>>>13,z=0|s[0],F=8191&z,q=z>>>13,H=0|s[1],W=8191&H,G=H>>>13,Y=0|s[2],K=8191&Y,V=Y>>>13,Z=0|s[3],$=8191&Z,X=Z>>>13,J=0|s[4],Q=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ft=8191&st,ut=st>>>13,ht=0|s[8],ct=8191&ht,dt=ht>>>13,lt=0|s[9],pt=8191<,mt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var bt=(u+(n=Math.imul(c,F))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(d,F)|0))<<13)|0;u=((o=Math.imul(d,q))+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,q))+Math.imul(m,F)|0,o=Math.imul(m,q);var gt=(u+(n=n+Math.imul(c,W)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(d,W)|0))<<13)|0;u=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,F),i=(i=Math.imul(g,q))+Math.imul(v,F)|0,o=Math.imul(v,q),n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,G)|0;var vt=(u+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,V)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,q))+Math.imul(_,F)|0,o=Math.imul(_,q),n=n+Math.imul(g,W)|0,i=(i=i+Math.imul(g,G)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,G)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var yt=(u+(n=n+Math.imul(c,$)|0)|0)+((8191&(i=(i=i+Math.imul(c,X)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(M,F),i=(i=Math.imul(M,q))+Math.imul(E,F)|0,o=Math.imul(E,q),n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(g,K)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,X)|0;var wt=(u+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,F),i=(i=Math.imul(k,q))+Math.imul(B,F)|0,o=Math.imul(B,q),n=n+Math.imul(M,W)|0,i=(i=i+Math.imul(M,G)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,G)|0,n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(R,F),i=(i=Math.imul(R,q))+Math.imul(x,F)|0,o=Math.imul(x,q),n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(B,W)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(M,K)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,V)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var At=(u+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(I,F),i=(i=Math.imul(I,q))+Math.imul(D,F)|0,o=Math.imul(D,q),n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,n=n+Math.imul(M,$)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Mt=(u+(n=n+Math.imul(c,ft)|0)|0)+((8191&(i=(i=i+Math.imul(c,ut)|0)+Math.imul(d,ft)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(O,F),i=(i=Math.imul(O,q))+Math.imul(L,F)|0,o=Math.imul(L,q),n=n+Math.imul(I,W)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,G)|0,n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,ut)|0;var Et=(u+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(j,F),i=(i=Math.imul(j,q))+Math.imul(N,F)|0,o=Math.imul(N,q),n=n+Math.imul(O,W)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(D,K)|0,o=o+Math.imul(D,V)|0,n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(M,rt)|0,i=(i=i+Math.imul(M,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,ut)|0)+Math.imul(v,ft)|0,o=o+Math.imul(v,ut)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,dt)|0;var St=(u+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(d,pt)|0))<<13)|0;u=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,W),i=(i=Math.imul(j,G))+Math.imul(N,W)|0,o=Math.imul(N,G),n=n+Math.imul(O,K)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,V)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ut)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,dt)|0;var kt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,K),i=(i=Math.imul(j,V))+Math.imul(N,K)|0,o=Math.imul(N,V),n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,n=n+Math.imul(M,ft)|0,i=(i=i+Math.imul(M,ut)|0)+Math.imul(E,ft)|0,o=o+Math.imul(E,ut)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0;var Bt=(u+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,X))+Math.imul(N,$)|0,o=Math.imul(N,X),n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(D,rt)|0,o=o+Math.imul(D,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,ut)|0)+Math.imul(B,ft)|0,o=o+Math.imul(B,ut)|0,n=n+Math.imul(M,ct)|0,i=(i=i+Math.imul(M,dt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,dt)|0;var Tt=(u+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,tt))+Math.imul(N,Q)|0,o=Math.imul(N,tt),n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,ut)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,ut)|0,n=n+Math.imul(k,ct)|0,i=(i=i+Math.imul(k,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(n=n+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(j,rt),i=(i=Math.imul(j,nt))+Math.imul(N,rt)|0,o=Math.imul(N,nt),n=n+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(D,ft)|0,o=o+Math.imul(D,ut)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,dt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,dt)|0;var xt=(u+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(B,pt)|0))<<13)|0;u=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,ot),i=(i=Math.imul(j,at))+Math.imul(N,ot)|0,o=Math.imul(N,at),n=n+Math.imul(O,ft)|0,i=(i=i+Math.imul(O,ut)|0)+Math.imul(L,ft)|0,o=o+Math.imul(L,ut)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0;var Ct=(u+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(x,pt)|0))<<13)|0;u=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(j,ft),i=(i=Math.imul(j,ut))+Math.imul(N,ft)|0,o=Math.imul(N,ut),n=n+Math.imul(O,ct)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(L,ct)|0,o=o+Math.imul(L,dt)|0;var It=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(D,pt)|0))<<13)|0;u=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,ct),i=(i=Math.imul(j,dt))+Math.imul(N,ct)|0,o=Math.imul(N,dt);var Dt=(u+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Pt=(u+(n=Math.imul(j,pt))|0)+((8191&(i=(i=Math.imul(j,mt))+Math.imul(N,pt)|0))<<13)|0;return u=((o=Math.imul(N,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,f[0]=bt,f[1]=gt,f[2]=vt,f[3]=yt,f[4]=wt,f[5]=_t,f[6]=At,f[7]=Mt,f[8]=Et,f[9]=St,f[10]=kt,f[11]=Bt,f[12]=Tt,f[13]=Rt,f[14]=xt,f[15]=Ct,f[16]=It,f[17]=Dt,f[18]=Pt,0!==u&&(f[19]=u,r.length++),r};function b(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o